diff --git a/.jcheck/conf b/.jcheck/conf index 659e3a123d6c..34c6450501de 100644 --- a/.jcheck/conf +++ b/.jcheck/conf @@ -1,7 +1,7 @@ [general] project=jdk-updates jbs=JDK -version=21.0.7 +version=21.0.8 [checks] error=author,committer,reviewers,merge,issues,executable,symlink,message,hg-tag,whitespace,problemlists diff --git a/make/Bundles.gmk b/make/Bundles.gmk index e6955bfab412..b2a4f51af03e 100644 --- a/make/Bundles.gmk +++ b/make/Bundles.gmk @@ -242,7 +242,10 @@ ifneq ($(filter product-bundles% legacy-bundles, $(MAKECMDGOALS)), ) ) JDK_SYMBOLS_BUNDLE_FILES := \ - $(call FindFiles, $(SYMBOLS_IMAGE_DIR)) + $(filter-out \ + %.stripped.pdb, \ + $(call FindFiles, $(SYMBOLS_IMAGE_DIR)) \ + ) TEST_DEMOS_BUNDLE_FILES := $(filter $(JDK_DEMOS_IMAGE_HOMEDIR)/demo/%, \ $(ALL_JDK_DEMOS_FILES)) diff --git a/make/RunTests.gmk b/make/RunTests.gmk index bab0a1466445..8c6e0f1924fc 100644 --- a/make/RunTests.gmk +++ b/make/RunTests.gmk @@ -602,7 +602,7 @@ define SetupRunMicroTestBody $1_JMH_JVM_ARGS += $$(MICRO_VM_OPTIONS) $$(MICRO_JAVA_OPTIONS) endif - $1_MICRO_VM_OPTIONS := -jvmArgs $(call ShellQuote,$$($1_JMH_JVM_ARGS)) + $1_MICRO_VM_OPTIONS := -jvmArgsPrepend $(call ShellQuote,$$($1_JMH_JVM_ARGS)) ifneq ($$(MICRO_ITER), ) $1_MICRO_ITER := -i $$(MICRO_ITER) @@ -848,6 +848,10 @@ define SetupRunJtregTestBody endif endif + ifneq ($$(findstring -XX:+UseShenandoahGC, $$(JTREG_ALL_OPTIONS)), ) + JTREG_AUTO_PROBLEM_LISTS += ProblemList-shenandoah.txt + endif + ifneq ($$(JTREG_EXTRA_PROBLEM_LISTS), ) # Accept both absolute paths as well as relative to the current test root. $1_JTREG_BASIC_OPTIONS += $$(addprefix $$(JTREG_PROBLEM_LIST_PREFIX), $$(wildcard \ diff --git a/make/autoconf/jdk-options.m4 b/make/autoconf/jdk-options.m4 index 946af99a9b71..8f3458ee9d68 100644 --- a/make/autoconf/jdk-options.m4 +++ b/make/autoconf/jdk-options.m4 @@ -197,9 +197,8 @@ AC_DEFUN_ONCE([JDKOPT_SETUP_JDK_OPTIONS], # three different page sizes: 4K, 64K, and if run on Mac m1 hardware, 16K. COMPATIBLE_CDS_ALIGNMENT_DEFAULT=false if test "x$OPENJDK_TARGET_OS" = "xlinux" && test "x$OPENJDK_TARGET_CPU" = "xaarch64"; then - COMPATIBLE_CDS_ALIGNMENT_DEFAULT=true + COMPATIBLE_CDS_ALIGNMENT_DEFAULT=auto fi - AC_SUBST(COMPATIBLE_CDS_ALIGNMENT_DEFAULT) # Compress jars COMPRESS_JARS=false @@ -718,7 +717,7 @@ AC_DEFUN([JDKOPT_ENABLE_DISABLE_COMPATIBLE_CDS_ALIGNMENT], UTIL_ARG_ENABLE(NAME: compatible-cds-alignment, DEFAULT: $COMPATIBLE_CDS_ALIGNMENT_DEFAULT, RESULT: ENABLE_COMPATIBLE_CDS_ALIGNMENT, DESC: [enable use alternative compatible cds core region alignment], - DEFAULT_DESC: [disabled], + DEFAULT_DESC: [disabled except on linux-aarch64], CHECKING_MSG: [if compatible cds region alignment enabled], CHECK_AVAILABLE: [ AC_MSG_CHECKING([if CDS archive is available]) diff --git a/make/conf/version-numbers.conf b/make/conf/version-numbers.conf index bb17b4fb3453..bad26af70405 100644 --- a/make/conf/version-numbers.conf +++ b/make/conf/version-numbers.conf @@ -28,12 +28,12 @@ DEFAULT_VERSION_FEATURE=21 DEFAULT_VERSION_INTERIM=0 -DEFAULT_VERSION_UPDATE=7 +DEFAULT_VERSION_UPDATE=8 DEFAULT_VERSION_PATCH=0 DEFAULT_VERSION_EXTRA1=0 DEFAULT_VERSION_EXTRA2=0 DEFAULT_VERSION_EXTRA3=0 -DEFAULT_VERSION_DATE=2025-04-15 +DEFAULT_VERSION_DATE=2025-07-15 DEFAULT_VERSION_CLASSFILE_MAJOR=65 # "`$EXPR $DEFAULT_VERSION_FEATURE + 44`" DEFAULT_VERSION_CLASSFILE_MINOR=0 DEFAULT_VERSION_DOCS_API_SINCE=11 diff --git a/make/hotspot/lib/CompileGtest.gmk b/make/hotspot/lib/CompileGtest.gmk index bba3ce15bb15..efdd9254f68c 100644 --- a/make/hotspot/lib/CompileGtest.gmk +++ b/make/hotspot/lib/CompileGtest.gmk @@ -57,7 +57,8 @@ $(eval $(call SetupJdkLibrary, BUILD_GTEST_LIBGTEST, \ $(GTEST_FRAMEWORK_SRC)/googletest/src \ $(GTEST_FRAMEWORK_SRC)/googlemock/src, \ INCLUDE_FILES := gtest-all.cc gmock-all.cc, \ - DISABLED_WARNINGS_gcc := undef unused-result format-nonliteral maybe-uninitialized, \ + DISABLED_WARNINGS_gcc := undef unused-result format-nonliteral \ + maybe-uninitialized zero-as-null-pointer-constant, \ DISABLED_WARNINGS_clang := undef unused-result format-nonliteral, \ CFLAGS := $(JVM_CFLAGS) \ -I$(GTEST_FRAMEWORK_SRC)/googletest \ diff --git a/make/modules/java.desktop/lib/Awt2dLibraries.gmk b/make/modules/java.desktop/lib/Awt2dLibraries.gmk index 1a4ec2118c16..cfff2352c8ff 100644 --- a/make/modules/java.desktop/lib/Awt2dLibraries.gmk +++ b/make/modules/java.desktop/lib/Awt2dLibraries.gmk @@ -509,7 +509,7 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBLCMS, \ common/awt/debug \ libawt/java2d, \ HEADERS_FROM_SRC := $(LIBLCMS_HEADERS_FROM_SRC), \ - DISABLED_WARNINGS_gcc := format-nonliteral type-limits stringop-truncation, \ + DISABLED_WARNINGS_gcc := format-nonliteral stringop-truncation, \ DISABLED_WARNINGS_clang := format-nonliteral, \ DISABLED_WARNINGS_clang_cmstypes.c := unused-but-set-parameter, \ LDFLAGS := $(LDFLAGS_JDKLIB) \ @@ -686,7 +686,7 @@ else # range-loop-analysis -> clang on Xcode12 HARFBUZZ_DISABLED_WARNINGS_gcc := missing-field-initializers strict-aliasing \ - unused-result array-bounds parentheses + unused-result array-bounds parentheses dangling-pointer # noexcept-type required for GCC 7 builds. Not required for GCC 8+. # expansion-to-defined required for GCC 9 builds. Not required for GCC 10+. # maybe-uninitialized required for GCC 8 builds. Not required for GCC 9+. @@ -1045,6 +1045,7 @@ ifeq ($(ENABLE_HEADLESS_ONLY), false) EXCLUDE_SRC_PATTERNS := $(LIBSPLASHSCREEN_EXCLUDE_SRC_PATTERNS), \ DISABLED_WARNINGS_gcc := $(LIBSPLASHSCREEN_DISABLED_WARNINGS_gcc), \ DISABLED_WARNINGS_clang := $(LIBSPLASHSCREEN_DISABLED_WARNINGS_clang), \ + DISABLED_WARNINGS_clang_png.c := $(LIBSPLASHSCREEN_DISABLED_WARNINGS_clang) unused-function, \ DISABLED_WARNINGS_microsoft := $(LIBSPLASHSCREEN_DISABLED_WARNINGS_microsoft), \ EXCLUDE_FILES := $(LIBSPLASHSCREEN_EXCLUDE_FILES), \ EXCLUDES := $(LIBSPLASHSCREEN_EXCLUDES), \ diff --git a/make/modules/jdk.jdwp.agent/Lib.gmk b/make/modules/jdk.jdwp.agent/Lib.gmk index ba694f50e1b6..52ac6564d302 100644 --- a/make/modules/jdk.jdwp.agent/Lib.gmk +++ b/make/modules/jdk.jdwp.agent/Lib.gmk @@ -58,6 +58,7 @@ $(eval $(call SetupJdkLibrary, BUILD_LIBJDWP, \ DISABLED_WARNINGS_clang_EventRequestImpl.c := self-assign, \ DISABLED_WARNINGS_clang_inStream.c := sometimes-uninitialized, \ DISABLED_WARNINGS_clang_log_messages.c := format-nonliteral, \ + DISABLED_WARNINGS_microsoft_debugInit.c := 5287, \ EXTRA_HEADER_DIRS := \ include \ libjdwp/export, \ diff --git a/src/hotspot/cpu/aarch64/aarch64.ad b/src/hotspot/cpu/aarch64/aarch64.ad index 015bfabc2f71..c4270fbe40be 100644 --- a/src/hotspot/cpu/aarch64/aarch64.ad +++ b/src/hotspot/cpu/aarch64/aarch64.ad @@ -1,6 +1,6 @@ // // Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved. -// Copyright (c) 2014, 2021, Red Hat, Inc. All rights reserved. +// Copyright (c) 2014, 2024, 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 @@ -1648,8 +1648,8 @@ int MachCallRuntimeNode::ret_addr_offset() { // for real runtime callouts it will be six instructions // see aarch64_enc_java_to_runtime // adr(rscratch2, retaddr) + // str(rscratch2, Address(rthread, JavaThread::last_Java_pc_offset())); // lea(rscratch1, RuntimeAddress(addr) - // stp(zr, rscratch2, Address(__ pre(sp, -2 * wordSize))) // blr(rscratch1) CodeBlob *cb = CodeCache::find_blob(_entry_point); if (cb) { @@ -2739,10 +2739,6 @@ typedef void (MacroAssembler::* mem_vector_insn)(FloatRegister Rt, { Address addr = mem2address(opcode, base, index, scale, disp); if (addr.getMode() == Address::base_plus_offset) { - /* If we get an out-of-range offset it is a bug in the compiler, - so we assert here. */ - assert(Address::offset_ok_for_immed(addr.offset(), exact_log2(size_in_memory)), - "c2 compiler bug"); /* Fix up any out-of-range offsets. */ assert_different_registers(rscratch1, base); assert_different_registers(rscratch1, reg); @@ -3774,14 +3770,13 @@ encode %{ __ post_call_nop(); } else { Label retaddr; + // Make the anchor frame walkable __ adr(rscratch2, retaddr); + __ str(rscratch2, Address(rthread, JavaThread::last_Java_pc_offset())); __ lea(rscratch1, RuntimeAddress(entry)); - // Leave a breadcrumb for JavaFrameAnchor::capture_last_Java_pc() - __ stp(zr, rscratch2, Address(__ pre(sp, -2 * wordSize))); __ blr(rscratch1); __ bind(retaddr); __ post_call_nop(); - __ add(sp, sp, 2 * wordSize); } if (Compile::current()->max_vector_size() > 0) { __ reinitialize_ptrue(); @@ -16696,6 +16691,39 @@ instruct partialSubtypeCheck(iRegP_R4 sub, iRegP_R0 super, iRegP_R2 temp, iRegP_ ins_pipe(pipe_class_memory); %} +instruct partialSubtypeCheckConstSuper(iRegP_R4 sub, iRegP_R0 super_reg, immP super_con, vRegD_V0 vtemp, iRegP_R5 result, + iRegP_R1 tempR1, iRegP_R2 tempR2, iRegP_R3 tempR3, + rFlagsReg cr) +%{ + match(Set result (PartialSubtypeCheck sub (Binary super_reg super_con))); + predicate(UseSecondarySupersTable); + effect(KILL cr, TEMP tempR1, TEMP tempR2, TEMP tempR3, TEMP vtemp); + + ins_cost(700); // smaller than the next version + format %{ "partialSubtypeCheck $result, $sub, super" %} + + ins_encode %{ + bool success = false; + u1 super_klass_slot = ((Klass*)$super_con$$constant)->hash_slot(); + if (InlineSecondarySupersTest) { + success = __ lookup_secondary_supers_table($sub$$Register, $super_reg$$Register, + $tempR1$$Register, $tempR2$$Register, $tempR3$$Register, + $vtemp$$FloatRegister, + $result$$Register, + super_klass_slot); + } else { + address call = __ trampoline_call(RuntimeAddress(StubRoutines::lookup_secondary_supers_table_stub(super_klass_slot))); + success = (call != nullptr); + } + if (!success) { + ciEnv::current()->record_failure("CodeCache is full"); + return; + } + %} + + ins_pipe(pipe_class_memory); +%} + instruct partialSubtypeCheckVsZero(iRegP_R4 sub, iRegP_R0 super, iRegP_R2 temp, iRegP_R5 result, immP0 zero, rFlagsReg cr) %{ match(Set cr (CmpP (PartialSubtypeCheck sub super) zero)); diff --git a/src/hotspot/cpu/aarch64/abstractInterpreter_aarch64.cpp b/src/hotspot/cpu/aarch64/abstractInterpreter_aarch64.cpp index 33a72263a277..35207c2fd4d5 100644 --- a/src/hotspot/cpu/aarch64/abstractInterpreter_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/abstractInterpreter_aarch64.cpp @@ -150,7 +150,8 @@ void AbstractInterpreter::layout_activation(Method* method, #ifdef ASSERT if (caller->is_interpreted_frame()) { - assert(locals < caller->fp() + frame::interpreter_frame_initial_sp_offset, "bad placement"); + assert(locals <= caller->interpreter_frame_expression_stack(), "bad placement"); + assert(locals >= interpreter_frame->sender_sp() + max_locals - 1, "bad placement"); } #endif diff --git a/src/hotspot/cpu/aarch64/assembler_aarch64.hpp b/src/hotspot/cpu/aarch64/assembler_aarch64.hpp index 0c42a1727f55..dafb4f5229b4 100644 --- a/src/hotspot/cpu/aarch64/assembler_aarch64.hpp +++ b/src/hotspot/cpu/aarch64/assembler_aarch64.hpp @@ -2631,6 +2631,7 @@ template #undef INSN + // Advanced SIMD across lanes #define INSN(NAME, opc, opc2, accepted) \ void NAME(FloatRegister Vd, SIMD_Arrangement T, FloatRegister Vn) { \ guarantee(T != T1Q && T != T1D, "incorrect arrangement"); \ diff --git a/src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp b/src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp index 656dbdf7ae8c..c42c93cc2707 100644 --- a/src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/c1_LIRAssembler_aarch64.cpp @@ -276,14 +276,14 @@ void LIR_Assembler::osr_entry() { // verify the interpreter's monitor has a non-null object { Label L; - __ ldr(rscratch1, Address(OSR_buf, slot_offset + 1*BytesPerWord)); + __ ldr(rscratch1, __ form_address(rscratch1, OSR_buf, slot_offset + 1*BytesPerWord, 0)); __ cbnz(rscratch1, L); __ stop("locked object is null"); __ bind(L); } #endif - __ ldr(r19, Address(OSR_buf, slot_offset)); - __ ldr(r20, Address(OSR_buf, slot_offset + BytesPerWord)); + __ ldr(r19, __ form_address(rscratch1, OSR_buf, slot_offset, 0)); + __ ldr(r20, __ form_address(rscratch1, OSR_buf, slot_offset + BytesPerWord, 0)); __ str(r19, frame_map()->address_for_monitor_lock(i)); __ str(r20, frame_map()->address_for_monitor_object(i)); } diff --git a/src/hotspot/cpu/aarch64/c2_MacroAssembler_aarch64.cpp b/src/hotspot/cpu/aarch64/c2_MacroAssembler_aarch64.cpp index 0bc5a5a0f982..6a2f892a5900 100644 --- a/src/hotspot/cpu/aarch64/c2_MacroAssembler_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/c2_MacroAssembler_aarch64.cpp @@ -107,7 +107,8 @@ address C2_MacroAssembler::arrays_hashcode(Register ary, Register cnt, Register assert(is_power_of_2(unroll_factor), "can't use this value to calculate the jump target PC"); andr(tmp2, cnt, unroll_factor - 1); adr(tmp1, BR_BASE); - sub(tmp1, tmp1, tmp2, ext::sxtw, 3); + // For Cortex-A53 offset is 4 because 2 nops are generated. + sub(tmp1, tmp1, tmp2, ext::sxtw, VM_Version::supports_a53mac() ? 4 : 3); movw(tmp2, 0x1f); br(tmp1); @@ -115,6 +116,11 @@ address C2_MacroAssembler::arrays_hashcode(Register ary, Register cnt, Register for (size_t i = 0; i < unroll_factor; ++i) { load(tmp1, Address(post(ary, type2aelembytes(eltype))), eltype); maddw(result, result, tmp2, tmp1); + // maddw generates an extra nop for Cortex-A53 (see maddw definition in macroAssembler). + // Generate 2nd nop to have 4 instructions per iteration. + if (VM_Version::supports_a53mac()) { + nop(); + } } bind(BR_BASE); subsw(cnt, cnt, unroll_factor); diff --git a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp index 02feaa02bf2d..0a2dd0dce979 100644 --- a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2014, 2021, Red Hat Inc. All rights reserved. + * Copyright (c) 2014, 2024, 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 @@ -1465,6 +1465,9 @@ void MacroAssembler::check_klass_subtype_slow_path(Register sub_klass, Label* L_success, Label* L_failure, bool set_cond_codes) { + // NB! Callers may assume that, when temp2_reg is a valid register, + // this code sets it to a nonzero value. + assert_different_registers(sub_klass, super_klass, temp_reg); if (temp2_reg != noreg) assert_different_registers(sub_klass, super_klass, temp_reg, temp2_reg, rscratch1); @@ -1540,6 +1543,241 @@ void MacroAssembler::check_klass_subtype_slow_path(Register sub_klass, bind(L_fallthrough); } +// Ensure that the inline code and the stub are using the same registers. +#define LOOKUP_SECONDARY_SUPERS_TABLE_REGISTERS \ +do { \ + assert(r_super_klass == r0 && \ + r_array_base == r1 && \ + r_array_length == r2 && \ + (r_array_index == r3 || r_array_index == noreg) && \ + (r_sub_klass == r4 || r_sub_klass == noreg) && \ + (r_bitmap == rscratch2 || r_bitmap == noreg) && \ + (result == r5 || result == noreg), "registers must match aarch64.ad"); \ +} while(0) + +// Return true: we succeeded in generating this code +bool MacroAssembler::lookup_secondary_supers_table(Register r_sub_klass, + Register r_super_klass, + Register temp1, + Register temp2, + Register temp3, + FloatRegister vtemp, + Register result, + u1 super_klass_slot, + bool stub_is_near) { + assert_different_registers(r_sub_klass, temp1, temp2, temp3, result, rscratch1, rscratch2); + + Label L_fallthrough; + + BLOCK_COMMENT("lookup_secondary_supers_table {"); + + const Register + r_array_base = temp1, // r1 + r_array_length = temp2, // r2 + r_array_index = temp3, // r3 + r_bitmap = rscratch2; + + LOOKUP_SECONDARY_SUPERS_TABLE_REGISTERS; + + u1 bit = super_klass_slot; + + // Make sure that result is nonzero if the TBZ below misses. + mov(result, 1); + + // We're going to need the bitmap in a vector reg and in a core reg, + // so load both now. + ldr(r_bitmap, Address(r_sub_klass, Klass::bitmap_offset())); + if (bit != 0) { + ldrd(vtemp, Address(r_sub_klass, Klass::bitmap_offset())); + } + // First check the bitmap to see if super_klass might be present. If + // the bit is zero, we are certain that super_klass is not one of + // the secondary supers. + tbz(r_bitmap, bit, L_fallthrough); + + // Get the first array index that can contain super_klass into r_array_index. + if (bit != 0) { + shld(vtemp, vtemp, Klass::SECONDARY_SUPERS_TABLE_MASK - bit); + cnt(vtemp, T8B, vtemp); + addv(vtemp, T8B, vtemp); + fmovd(r_array_index, vtemp); + } else { + mov(r_array_index, (u1)1); + } + // NB! r_array_index is off by 1. It is compensated by keeping r_array_base off by 1 word. + + // We will consult the secondary-super array. + ldr(r_array_base, Address(r_sub_klass, in_bytes(Klass::secondary_supers_offset()))); + + // The value i in r_array_index is >= 1, so even though r_array_base + // points to the length, we don't need to adjust it to point to the + // data. + assert(Array::base_offset_in_bytes() == wordSize, "Adjust this code"); + assert(Array::length_offset_in_bytes() == 0, "Adjust this code"); + + ldr(result, Address(r_array_base, r_array_index, Address::lsl(LogBytesPerWord))); + eor(result, result, r_super_klass); + cbz(result, L_fallthrough); // Found a match + + // Is there another entry to check? Consult the bitmap. + tbz(r_bitmap, (bit + 1) & Klass::SECONDARY_SUPERS_TABLE_MASK, L_fallthrough); + + // Linear probe. + if (bit != 0) { + ror(r_bitmap, r_bitmap, bit); + } + + // The slot we just inspected is at secondary_supers[r_array_index - 1]. + // The next slot to be inspected, by the stub we're about to call, + // is secondary_supers[r_array_index]. Bits 0 and 1 in the bitmap + // have been checked. + Address stub = RuntimeAddress(StubRoutines::lookup_secondary_supers_table_slow_path_stub()); + if (stub_is_near) { + bl(stub); + } else { + address call = trampoline_call(stub); + if (call == nullptr) { + return false; // trampoline allocation failed + } + } + + BLOCK_COMMENT("} lookup_secondary_supers_table"); + + bind(L_fallthrough); + + if (VerifySecondarySupers) { + verify_secondary_supers_table(r_sub_klass, r_super_klass, // r4, r0 + temp1, temp2, result); // r1, r2, r5 + } + return true; +} + +// Called by code generated by check_klass_subtype_slow_path +// above. This is called when there is a collision in the hashed +// lookup in the secondary supers array. +void MacroAssembler::lookup_secondary_supers_table_slow_path(Register r_super_klass, + Register r_array_base, + Register r_array_index, + Register r_bitmap, + Register temp1, + Register result) { + assert_different_registers(r_super_klass, r_array_base, r_array_index, r_bitmap, temp1, result, rscratch1); + + const Register + r_array_length = temp1, + r_sub_klass = noreg; // unused + + LOOKUP_SECONDARY_SUPERS_TABLE_REGISTERS; + + Label L_fallthrough, L_huge; + + // Load the array length. + ldrw(r_array_length, Address(r_array_base, Array::length_offset_in_bytes())); + // And adjust the array base to point to the data. + // NB! Effectively increments current slot index by 1. + assert(Array::base_offset_in_bytes() == wordSize, ""); + add(r_array_base, r_array_base, Array::base_offset_in_bytes()); + + // The bitmap is full to bursting. + // Implicit invariant: BITMAP_FULL implies (length > 0) + assert(Klass::SECONDARY_SUPERS_BITMAP_FULL == ~uintx(0), ""); + cmpw(r_array_length, (u1)(Klass::SECONDARY_SUPERS_TABLE_SIZE - 2)); + br(GT, L_huge); + + // NB! Our caller has checked bits 0 and 1 in the bitmap. The + // current slot (at secondary_supers[r_array_index]) has not yet + // been inspected, and r_array_index may be out of bounds if we + // wrapped around the end of the array. + + { // This is conventional linear probing, but instead of terminating + // when a null entry is found in the table, we maintain a bitmap + // in which a 0 indicates missing entries. + // The check above guarantees there are 0s in the bitmap, so the loop + // eventually terminates. + Label L_loop; + bind(L_loop); + + // Check for wraparound. + cmp(r_array_index, r_array_length); + csel(r_array_index, zr, r_array_index, GE); + + ldr(rscratch1, Address(r_array_base, r_array_index, Address::lsl(LogBytesPerWord))); + eor(result, rscratch1, r_super_klass); + cbz(result, L_fallthrough); + + tbz(r_bitmap, 2, L_fallthrough); // look-ahead check (Bit 2); result is non-zero + + ror(r_bitmap, r_bitmap, 1); + add(r_array_index, r_array_index, 1); + b(L_loop); + } + + { // Degenerate case: more than 64 secondary supers. + // FIXME: We could do something smarter here, maybe a vectorized + // comparison or a binary search, but is that worth any added + // complexity? + bind(L_huge); + cmp(sp, zr); // Clear Z flag; SP is never zero + repne_scan(r_array_base, r_super_klass, r_array_length, rscratch1); + cset(result, NE); // result == 0 iff we got a match. + } + + bind(L_fallthrough); +} + +// Make sure that the hashed lookup and a linear scan agree. +void MacroAssembler::verify_secondary_supers_table(Register r_sub_klass, + Register r_super_klass, + Register temp1, + Register temp2, + Register result) { + assert_different_registers(r_sub_klass, r_super_klass, temp1, temp2, result, rscratch1); + + const Register + r_array_base = temp1, + r_array_length = temp2, + r_array_index = noreg, // unused + r_bitmap = noreg; // unused + + LOOKUP_SECONDARY_SUPERS_TABLE_REGISTERS; + + BLOCK_COMMENT("verify_secondary_supers_table {"); + + // We will consult the secondary-super array. + ldr(r_array_base, Address(r_sub_klass, in_bytes(Klass::secondary_supers_offset()))); + + // Load the array length. + ldrw(r_array_length, Address(r_array_base, Array::length_offset_in_bytes())); + // And adjust the array base to point to the data. + add(r_array_base, r_array_base, Array::base_offset_in_bytes()); + + cmp(sp, zr); // Clear Z flag; SP is never zero + // Scan R2 words at [R5] for an occurrence of R0. + // Set NZ/Z based on last compare. + repne_scan(/*addr*/r_array_base, /*value*/r_super_klass, /*count*/r_array_length, rscratch2); + // rscratch1 == 0 iff we got a match. + cset(rscratch1, NE); + + Label passed; + cmp(result, zr); + cset(result, NE); // normalize result to 0/1 for comparison + + cmp(rscratch1, result); + br(EQ, passed); + { + mov(r0, r_super_klass); // r0 <- r0 + mov(r1, r_sub_klass); // r1 <- r4 + mov(r2, /*expected*/rscratch1); // r2 <- r8 + mov(r3, result); // r3 <- r5 + mov(r4, (address)("mismatch")); // r4 <- const + rt_call(CAST_FROM_FN_PTR(address, Klass::on_secondary_supers_verification_failure), rscratch2); + should_not_reach_here(); + } + bind(passed); + + BLOCK_COMMENT("} verify_secondary_supers_table"); +} + void MacroAssembler::clinit_barrier(Register klass, Register scratch, Label* L_fast_path, Label* L_slow_path) { assert(L_fast_path != nullptr || L_slow_path != nullptr, "at least one is required"); assert_different_registers(klass, rthread, scratch); diff --git a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.hpp b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.hpp index 1a8d084ef3de..71d4f74d6113 100644 --- a/src/hotspot/cpu/aarch64/macroAssembler_aarch64.hpp +++ b/src/hotspot/cpu/aarch64/macroAssembler_aarch64.hpp @@ -1,6 +1,6 @@ /* * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2014, 2021, Red Hat Inc. All rights reserved. + * Copyright (c) 2014, 2024, 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 @@ -997,6 +997,31 @@ class MacroAssembler: public Assembler { Label* L_failure, bool set_cond_codes = false); + // As above, but with a constant super_klass. + // The result is in Register result, not the condition codes. + bool lookup_secondary_supers_table(Register r_sub_klass, + Register r_super_klass, + Register temp1, + Register temp2, + Register temp3, + FloatRegister vtemp, + Register result, + u1 super_klass_slot, + bool stub_is_near = false); + + void verify_secondary_supers_table(Register r_sub_klass, + Register r_super_klass, + Register temp1, + Register temp2, + Register result); + + void lookup_secondary_supers_table_slow_path(Register r_super_klass, + Register r_array_base, + Register r_array_index, + Register r_bitmap, + Register temp1, + Register result); + // Simplified, combined version, good for typical uses. // Falls through on failure. void check_klass_subtype(Register sub_klass, @@ -1211,6 +1236,7 @@ class MacroAssembler: public Assembler { // - relocInfo::virtual_call_type // // Return: the call PC or null if CodeCache is full. + // Clobbers: rscratch1 address trampoline_call(Address entry); static bool far_branches() { diff --git a/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp b/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp index 51f095506da8..b2cc462ff8e9 100644 --- a/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/stubGenerator_aarch64.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2014, 2022, Red Hat Inc. All rights reserved. + * Copyright (c) 2014, 2024, 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 @@ -5472,7 +5472,8 @@ class StubGenerator: public StubCodeGenerator { __ andr(rscratch2, cnt, vf - 1); __ bind(TAIL_SHORTCUT); __ adr(rscratch1, BR_BASE); - __ sub(rscratch1, rscratch1, rscratch2, ext::uxtw, 3); + // For Cortex-A53 offset is 4 because 2 nops are generated. + __ sub(rscratch1, rscratch1, rscratch2, ext::uxtw, VM_Version::supports_a53mac() ? 4 : 3); __ movw(rscratch2, 0x1f); __ br(rscratch1); @@ -5480,6 +5481,11 @@ class StubGenerator: public StubCodeGenerator { __ load(rscratch1, Address(__ post(ary, type2aelembytes(eltype))), eltype); __ maddw(result, result, rscratch2, rscratch1); + // maddw generates an extra nop for Cortex-A53 (see maddw definition in macroAssembler). + // Generate 2nd nop to have 4 instructions per iteration. + if (VM_Version::supports_a53mac()) { + __ nop(); + } } __ bind(BR_BASE); @@ -7057,6 +7063,52 @@ class StubGenerator: public StubCodeGenerator { return start; } + address generate_lookup_secondary_supers_table_stub(u1 super_klass_index) { + StubCodeMark mark(this, "StubRoutines", "lookup_secondary_supers_table"); + + address start = __ pc(); + const Register + r_super_klass = r0, + r_array_base = r1, + r_array_length = r2, + r_array_index = r3, + r_sub_klass = r4, + r_bitmap = rscratch2, + result = r5; + const FloatRegister + vtemp = v0; + + Label L_success; + __ enter(); + __ lookup_secondary_supers_table(r_sub_klass, r_super_klass, + r_array_base, r_array_length, r_array_index, + vtemp, result, super_klass_index, + /*stub_is_near*/true); + __ leave(); + __ ret(lr); + + return start; + } + + // Slow path implementation for UseSecondarySupersTable. + address generate_lookup_secondary_supers_table_slow_path_stub() { + StubCodeMark mark(this, "StubRoutines", "lookup_secondary_supers_table_slow_path"); + + address start = __ pc(); + const Register + r_super_klass = r0, // argument + r_array_base = r1, // argument + temp1 = r2, // temp + r_array_index = r3, // argument + r_bitmap = rscratch2, // argument + result = r5; // argument + + __ lookup_secondary_supers_table_slow_path(r_super_klass, r_array_base, r_array_index, r_bitmap, temp1, result); + __ ret(lr); + + return start; + } + #if defined (LINUX) && !defined (__ARM_FEATURE_ATOMICS) // ARMv8.1 LSE versions of the atomic stubs used by Atomic::PlatformXX. @@ -8691,6 +8743,16 @@ class StubGenerator: public StubCodeGenerator { #endif // LINUX + if (UseSecondarySupersTable) { + StubRoutines::_lookup_secondary_supers_table_slow_path_stub = generate_lookup_secondary_supers_table_slow_path_stub(); + if (! InlineSecondarySupersTest) { + for (int slot = 0; slot < Klass::SECONDARY_SUPERS_TABLE_SIZE; slot++) { + StubRoutines::_lookup_secondary_supers_table_stubs[slot] + = generate_lookup_secondary_supers_table_stub(slot); + } + } + } + StubRoutines::aarch64::set_completed(); // Inidicate that arraycopy and zero_blocks stubs are generated } diff --git a/src/hotspot/cpu/aarch64/vm_version_aarch64.cpp b/src/hotspot/cpu/aarch64/vm_version_aarch64.cpp index 9b87a3daf41b..6c95dc9c8ff9 100644 --- a/src/hotspot/cpu/aarch64/vm_version_aarch64.cpp +++ b/src/hotspot/cpu/aarch64/vm_version_aarch64.cpp @@ -158,6 +158,9 @@ void VM_Version::initialize() { if (FLAG_IS_DEFAULT(OnSpinWaitInstCount)) { FLAG_SET_DEFAULT(OnSpinWaitInstCount, 2); } + if (FLAG_IS_DEFAULT(UseSignumIntrinsic)) { + FLAG_SET_DEFAULT(UseSignumIntrinsic, true); + } } // ThunderX diff --git a/src/hotspot/cpu/aarch64/vm_version_aarch64.hpp b/src/hotspot/cpu/aarch64/vm_version_aarch64.hpp index c25c38a09c3b..aa7d5db44a4e 100644 --- a/src/hotspot/cpu/aarch64/vm_version_aarch64.hpp +++ b/src/hotspot/cpu/aarch64/vm_version_aarch64.hpp @@ -171,6 +171,8 @@ enum Ampere_CPU_Model { static void get_compatible_board(char *buf, int buflen); + constexpr static bool supports_secondary_supers_table() { return true; } + static const SpinWait& spin_wait_desc() { return _spin_wait; } static bool supports_on_spin_wait() { return _spin_wait.inst() != SpinWait::NONE; } diff --git a/src/hotspot/cpu/arm/abstractInterpreter_arm.cpp b/src/hotspot/cpu/arm/abstractInterpreter_arm.cpp index 53e557fad86c..fba3e4c28a39 100644 --- a/src/hotspot/cpu/arm/abstractInterpreter_arm.cpp +++ b/src/hotspot/cpu/arm/abstractInterpreter_arm.cpp @@ -132,6 +132,15 @@ void AbstractInterpreter::layout_activation(Method* method, intptr_t* locals = interpreter_frame->sender_sp() + max_locals - 1; +#ifdef ASSERT + if (caller->is_interpreted_frame()) { + // Test exact placement on top of caller args + intptr_t* l2 = caller->interpreter_frame_last_sp() + caller_actual_parameters - 1; + assert(l2 <= caller->interpreter_frame_expression_stack(), "bad placement"); + assert(l2 >= locals, "bad placement"); + } +#endif + interpreter_frame->interpreter_frame_set_locals(locals); BasicObjectLock* montop = interpreter_frame->interpreter_frame_monitor_begin(); BasicObjectLock* monbot = montop - moncount; diff --git a/src/hotspot/cpu/ppc/abstractInterpreter_ppc.cpp b/src/hotspot/cpu/ppc/abstractInterpreter_ppc.cpp index 56f8fce5ce92..61d27badb129 100644 --- a/src/hotspot/cpu/ppc/abstractInterpreter_ppc.cpp +++ b/src/hotspot/cpu/ppc/abstractInterpreter_ppc.cpp @@ -129,6 +129,15 @@ void AbstractInterpreter::layout_activation(Method* method, caller->interpreter_frame_esp() + caller_actual_parameters : caller->sp() + method->max_locals() - 1 + (frame::java_abi_size / Interpreter::stackElementSize); +#ifdef ASSERT + if (caller->is_interpreted_frame()) { + assert(locals_base <= caller->interpreter_frame_expression_stack(), "bad placement"); + const int caller_abi_bytesize = (is_bottom_frame ? frame::top_ijava_frame_abi_size : frame::parent_ijava_frame_abi_size); + intptr_t* l2 = caller->sp() + method->max_locals() - 1 + (caller_abi_bytesize / Interpreter::stackElementSize); + assert(locals_base >= l2, "bad placement"); + } +#endif + intptr_t* monitor_base = caller->sp() - frame::ijava_state_size / Interpreter::stackElementSize; intptr_t* monitor = monitor_base - (moncount * frame::interpreter_frame_monitor_size()); intptr_t* esp_base = monitor - 1; diff --git a/src/hotspot/cpu/ppc/assembler_ppc.hpp b/src/hotspot/cpu/ppc/assembler_ppc.hpp index a2206055c920..7eda53749fb2 100644 --- a/src/hotspot/cpu/ppc/assembler_ppc.hpp +++ b/src/hotspot/cpu/ppc/assembler_ppc.hpp @@ -514,6 +514,9 @@ class Assembler : public AbstractAssembler { LFSU_OPCODE = (49u << OPCODE_SHIFT | 00u << 1), LFSX_OPCODE = (31u << OPCODE_SHIFT | 535u << 1), + LFIWAX_OPCODE = (31u << OPCODE_SHIFT | 855u << 1), + LFIWZX_OPCODE = (31u << OPCODE_SHIFT | 887u << 1), + STFD_OPCODE = (54u << OPCODE_SHIFT | 00u << 1), STFDU_OPCODE = (55u << OPCODE_SHIFT | 00u << 1), STFDX_OPCODE = (31u << OPCODE_SHIFT | 727u << 1), @@ -521,6 +524,8 @@ class Assembler : public AbstractAssembler { STFSU_OPCODE = (53u << OPCODE_SHIFT | 00u << 1), STFSX_OPCODE = (31u << OPCODE_SHIFT | 663u << 1), + STFIWX_OPCODE = (31u << OPCODE_SHIFT | 983u << 1), + FSQRT_OPCODE = (63u << OPCODE_SHIFT | 22u << 1), // A-FORM FSQRTS_OPCODE = (59u << OPCODE_SHIFT | 22u << 1), // A-FORM @@ -563,6 +568,10 @@ class Assembler : public AbstractAssembler { XVDIVSP_OPCODE = (60u << OPCODE_SHIFT | 88u << 3), XXBRD_OPCODE = (60u << OPCODE_SHIFT | 475u << 2 | 23u << 16), // XX2-FORM XXBRW_OPCODE = (60u << OPCODE_SHIFT | 475u << 2 | 15u << 16), // XX2-FORM + XVCVHPSP_OPCODE= (60u << OPCODE_SHIFT | 475u << 2 | 24u << 16), // XX2-FORM + XVCVSPHP_OPCODE= (60u << OPCODE_SHIFT | 475u << 2 | 25u << 16), // XX2-FORM + XSCVHPDP_OPCODE= (60u << OPCODE_SHIFT | 347u << 2 | 16u << 16), // XX2-FORM + XSCVDPHP_OPCODE= (60u << OPCODE_SHIFT | 347u << 2 | 17u << 16), // XX2-FORM XXPERM_OPCODE = (60u << OPCODE_SHIFT | 26u << 3), XXSEL_OPCODE = (60u << OPCODE_SHIFT | 3u << 4), XXSPLTIB_OPCODE= (60u << OPCODE_SHIFT | 360u << 1), @@ -2119,6 +2128,9 @@ class Assembler : public AbstractAssembler { inline void lfdu( FloatRegister d, int si16, Register a); inline void lfdx( FloatRegister d, Register a, Register b); + inline void lfiwax(FloatRegister d, Register a, Register b); + inline void lfiwzx(FloatRegister d, Register a, Register b); + // PPC 1, section 4.6.3 Floating-Point Store Instructions inline void stfs( FloatRegister s, int si16, Register a); inline void stfsu( FloatRegister s, int si16, Register a); @@ -2127,6 +2139,8 @@ class Assembler : public AbstractAssembler { inline void stfdu( FloatRegister s, int si16, Register a); inline void stfdx( FloatRegister s, Register a, Register b); + inline void stfiwx(FloatRegister s, Register a, Register b); + // PPC 1, section 4.6.4 Floating-Point Move Instructions inline void fmr( FloatRegister d, FloatRegister b); inline void fmr_( FloatRegister d, FloatRegister b); @@ -2391,6 +2405,10 @@ class Assembler : public AbstractAssembler { inline void xxleqv( VectorSRegister d, VectorSRegister a, VectorSRegister b); inline void xxbrd( VectorSRegister d, VectorSRegister b); inline void xxbrw( VectorSRegister d, VectorSRegister b); + inline void xvcvhpsp( VectorSRegister d, VectorSRegister b); + inline void xvcvsphp( VectorSRegister d, VectorSRegister b); + inline void xscvhpdp( VectorSRegister d, VectorSRegister b); + inline void xscvdphp( VectorSRegister d, VectorSRegister b); inline void xxland( VectorSRegister d, VectorSRegister a, VectorSRegister b); inline void xxsel( VectorSRegister d, VectorSRegister a, VectorSRegister b, VectorSRegister c); inline void xxspltib( VectorSRegister d, int ui8); @@ -2536,10 +2554,13 @@ class Assembler : public AbstractAssembler { inline void lfsx( FloatRegister d, Register b); inline void lfd( FloatRegister d, int si16); inline void lfdx( FloatRegister d, Register b); + inline void lfiwax(FloatRegister d, Register b); + inline void lfiwzx(FloatRegister d, Register b); inline void stfs( FloatRegister s, int si16); inline void stfsx( FloatRegister s, Register b); inline void stfd( FloatRegister s, int si16); inline void stfdx( FloatRegister s, Register b); + inline void stfiwx(FloatRegister s, Register b); inline void lvebx( VectorRegister d, Register s2); inline void lvehx( VectorRegister d, Register s2); inline void lvewx( VectorRegister d, Register s2); diff --git a/src/hotspot/cpu/ppc/assembler_ppc.inline.hpp b/src/hotspot/cpu/ppc/assembler_ppc.inline.hpp index cb05b2fa566c..4aa767174a8e 100644 --- a/src/hotspot/cpu/ppc/assembler_ppc.inline.hpp +++ b/src/hotspot/cpu/ppc/assembler_ppc.inline.hpp @@ -706,6 +706,9 @@ inline void Assembler::lfd( FloatRegister d, int si16, Register a) { emit_int3 inline void Assembler::lfdu(FloatRegister d, int si16, Register a) { emit_int32( LFDU_OPCODE | frt(d) | ra(a) | simm(si16,16)); } inline void Assembler::lfdx(FloatRegister d, Register a, Register b) { emit_int32( LFDX_OPCODE | frt(d) | ra0mem(a) | rb(b)); } +inline void Assembler::lfiwax(FloatRegister d, Register a, Register b) { emit_int32( LFIWAX_OPCODE | frt(d) | ra0mem(a) |rb(b)); } +inline void Assembler::lfiwzx(FloatRegister d, Register a, Register b) { emit_int32( LFIWZX_OPCODE | frt(d) | ra0mem(a) |rb(b)); } + // PPC 1, section 4.6.3 Floating-Point Store Instructions // Use ra0mem instead of ra in some instructions below. inline void Assembler::stfs( FloatRegister s, int si16, Register a) { emit_int32( STFS_OPCODE | frs(s) | ra0mem(a) | simm(si16,16)); } @@ -715,6 +718,8 @@ inline void Assembler::stfd( FloatRegister s, int si16, Register a) { emit_int3 inline void Assembler::stfdu(FloatRegister s, int si16, Register a) { emit_int32( STFDU_OPCODE | frs(s) | ra(a) | simm(si16,16)); } inline void Assembler::stfdx(FloatRegister s, Register a, Register b){ emit_int32( STFDX_OPCODE | frs(s) | ra0mem(a) | rb(b)); } +inline void Assembler::stfiwx(FloatRegister s, Register a, Register b) { emit_int32( STFIWX_OPCODE | frs(s) | ra0mem(a) |rb(b)); } + // PPC 1, section 4.6.4 Floating-Point Move Instructions inline void Assembler::fmr( FloatRegister d, FloatRegister b) { emit_int32( FMR_OPCODE | frt(d) | frb(b) | rc(0)); } inline void Assembler::fmr_(FloatRegister d, FloatRegister b) { emit_int32( FMR_OPCODE | frt(d) | frb(b) | rc(1)); } @@ -836,6 +841,10 @@ inline void Assembler::xxlxor( VectorSRegister d, VectorSRegister a, VectorSReg inline void Assembler::xxleqv( VectorSRegister d, VectorSRegister a, VectorSRegister b) { emit_int32( XXLEQV_OPCODE | vsrt(d) | vsra(a) | vsrb(b)); } inline void Assembler::xxbrd( VectorSRegister d, VectorSRegister b) { emit_int32( XXBRD_OPCODE | vsrt(d) | vsrb(b) ); } inline void Assembler::xxbrw( VectorSRegister d, VectorSRegister b) { emit_int32( XXBRW_OPCODE | vsrt(d) | vsrb(b) ); } +inline void Assembler::xvcvhpsp(VectorSRegister d, VectorSRegister b) { emit_int32( XVCVHPSP_OPCODE | vsrt(d) | vsrb(b) ); } +inline void Assembler::xvcvsphp(VectorSRegister d, VectorSRegister b) { emit_int32( XVCVSPHP_OPCODE | vsrt(d) | vsrb(b) ); } +inline void Assembler::xscvhpdp(VectorSRegister d, VectorSRegister b) { emit_int32( XSCVHPDP_OPCODE | vsrt(d) | vsrb(b) ); } +inline void Assembler::xscvdphp(VectorSRegister d, VectorSRegister b) { emit_int32( XSCVDPHP_OPCODE | vsrt(d) | vsrb(b) ); } inline void Assembler::xvdivsp( VectorSRegister d, VectorSRegister a, VectorSRegister b) { emit_int32( XVDIVSP_OPCODE | vsrt(d) | vsra(a) | vsrb(b)); } inline void Assembler::xvdivdp( VectorSRegister d, VectorSRegister a, VectorSRegister b) { emit_int32( XVDIVDP_OPCODE | vsrt(d) | vsra(a) | vsrb(b)); } inline void Assembler::xvabssp( VectorSRegister d, VectorSRegister b) { emit_int32( XVABSSP_OPCODE | vsrt(d) | vsrb(b)); } @@ -1130,12 +1139,17 @@ inline void Assembler::lfsx(FloatRegister d, Register b) { emit_int32( LFSX_OPCO inline void Assembler::lfd( FloatRegister d, int si16) { emit_int32( LFD_OPCODE | frt(d) | simm(si16,16)); } inline void Assembler::lfdx(FloatRegister d, Register b) { emit_int32( LFDX_OPCODE | frt(d) | rb(b)); } +inline void Assembler::lfiwax(FloatRegister d, Register b) { emit_int32( LFIWAX_OPCODE | frt(d) | rb(b)); } +inline void Assembler::lfiwzx(FloatRegister d, Register b) { emit_int32( LFIWZX_OPCODE | frt(d) | rb(b)); } + // ra0 version inline void Assembler::stfs( FloatRegister s, int si16) { emit_int32( STFS_OPCODE | frs(s) | simm(si16, 16)); } inline void Assembler::stfsx(FloatRegister s, Register b) { emit_int32( STFSX_OPCODE | frs(s) | rb(b)); } inline void Assembler::stfd( FloatRegister s, int si16) { emit_int32( STFD_OPCODE | frs(s) | simm(si16, 16)); } inline void Assembler::stfdx(FloatRegister s, Register b) { emit_int32( STFDX_OPCODE | frs(s) | rb(b)); } +inline void Assembler::stfiwx(FloatRegister s, Register b) { emit_int32( STFIWX_OPCODE | frs(s) |rb(b)); } + // ra0 version inline void Assembler::lvebx( VectorRegister d, Register s2) { emit_int32( LVEBX_OPCODE | vrt(d) | rb(s2)); } inline void Assembler::lvehx( VectorRegister d, Register s2) { emit_int32( LVEHX_OPCODE | vrt(d) | rb(s2)); } diff --git a/src/hotspot/cpu/ppc/c1_LIRAssembler_ppc.cpp b/src/hotspot/cpu/ppc/c1_LIRAssembler_ppc.cpp index 188d405b15df..1d97a43c90a2 100644 --- a/src/hotspot/cpu/ppc/c1_LIRAssembler_ppc.cpp +++ b/src/hotspot/cpu/ppc/c1_LIRAssembler_ppc.cpp @@ -1715,7 +1715,7 @@ void LIR_Assembler::arith_op(LIR_Code code, LIR_Opr left, LIR_Opr right, LIR_Opr } -void LIR_Assembler::intrinsic_op(LIR_Code code, LIR_Opr value, LIR_Opr thread, LIR_Opr dest, LIR_Op* op) { +void LIR_Assembler::intrinsic_op(LIR_Code code, LIR_Opr value, LIR_Opr tmp, LIR_Opr dest, LIR_Op* op) { switch (code) { case lir_sqrt: { __ fsqrt(dest->as_double_reg(), value->as_double_reg()); @@ -1725,6 +1725,14 @@ void LIR_Assembler::intrinsic_op(LIR_Code code, LIR_Opr value, LIR_Opr thread, L __ fabs(dest->as_double_reg(), value->as_double_reg()); break; } + case lir_f2hf: { + __ f2hf(dest.as_register(), value.as_float_reg(), tmp.as_float_reg()); + break; + } + case lir_hf2f: { + __ hf2f(dest->as_float_reg(), value.as_register()); + break; + } default: { ShouldNotReachHere(); break; diff --git a/src/hotspot/cpu/ppc/c1_LIRGenerator_ppc.cpp b/src/hotspot/cpu/ppc/c1_LIRGenerator_ppc.cpp index 2caca1dc556e..493a6d33f466 100644 --- a/src/hotspot/cpu/ppc/c1_LIRGenerator_ppc.cpp +++ b/src/hotspot/cpu/ppc/c1_LIRGenerator_ppc.cpp @@ -690,6 +690,25 @@ void LIRGenerator::do_MathIntrinsic(Intrinsic* x) { __ abs(value.result(), dst, LIR_OprFact::illegalOpr); break; } + case vmIntrinsics::_floatToFloat16: { + assert(x->number_of_arguments() == 1, "wrong type"); + LIRItem value(x->argument_at(0), this); + value.load_item(); + LIR_Opr dst = rlock_result(x); + LIR_Opr tmp = new_register(T_FLOAT); + // f2hf treats tmp as live_in. Workaround: initialize to some value. + __ move(LIR_OprFact::floatConst(-0.0), tmp); // just to satisfy LinearScan + __ f2hf(value.result(), dst, tmp); + break; + } + case vmIntrinsics::_float16ToFloat: { + assert(x->number_of_arguments() == 1, "wrong type"); + LIRItem value(x->argument_at(0), this); + value.load_item(); + LIR_Opr dst = rlock_result(x); + __ hf2f(value.result(), dst, LIR_OprFact::illegalOpr); + break; + } case vmIntrinsics::_dsqrt: case vmIntrinsics::_dsqrt_strict: { if (VM_Version::has_fsqrt()) { diff --git a/src/hotspot/cpu/ppc/macroAssembler_ppc.hpp b/src/hotspot/cpu/ppc/macroAssembler_ppc.hpp index 9947644475ec..628e54322b46 100644 --- a/src/hotspot/cpu/ppc/macroAssembler_ppc.hpp +++ b/src/hotspot/cpu/ppc/macroAssembler_ppc.hpp @@ -179,6 +179,9 @@ class MacroAssembler: public Assembler { void inline set_cmp3(Register dst); // set dst to (treat_unordered_like_less ? -1 : +1) void inline set_cmpu3(Register dst, bool treat_unordered_like_less); + // Convert between half precision float encoded into a short and a float in a FloatRegister. + void inline f2hf(Register dst, FloatRegister src, FloatRegister tmp); + void inline hf2f(FloatRegister dst, Register src); inline void pd_patch_instruction(address branch, address target, const char* file, int line); NOT_PRODUCT(static void pd_print_patched_instruction(address branch);) diff --git a/src/hotspot/cpu/ppc/macroAssembler_ppc.inline.hpp b/src/hotspot/cpu/ppc/macroAssembler_ppc.inline.hpp index f81d49684c99..14972b3077fa 100644 --- a/src/hotspot/cpu/ppc/macroAssembler_ppc.inline.hpp +++ b/src/hotspot/cpu/ppc/macroAssembler_ppc.inline.hpp @@ -264,6 +264,20 @@ inline void MacroAssembler::set_cmpu3(Register dst, bool treat_unordered_like_le set_cmp3(dst); } +inline void MacroAssembler::f2hf(Register dst, FloatRegister src, FloatRegister tmp) { + // Single precision values in FloatRegisters use double precision format on PPC64. + xscvdphp(tmp->to_vsr(), src->to_vsr()); + mffprd(dst, tmp); + // Make it a proper short (sign-extended). + extsh(dst, dst); +} + +inline void MacroAssembler::hf2f(FloatRegister dst, Register src) { + mtfprd(dst, src); + // Single precision values in FloatRegisters use double precision format on PPC64. + xscvhpdp(dst->to_vsr(), dst->to_vsr()); +} + // Convenience bc_far versions inline void MacroAssembler::blt_far(ConditionRegister crx, Label& L, int optimize) { MacroAssembler::bc_far(bcondCRbiIs1, bi0(crx, less), L, optimize); } inline void MacroAssembler::bgt_far(ConditionRegister crx, Label& L, int optimize) { MacroAssembler::bc_far(bcondCRbiIs1, bi0(crx, greater), L, optimize); } diff --git a/src/hotspot/cpu/ppc/ppc.ad b/src/hotspot/cpu/ppc/ppc.ad index 871563db33d3..bc7dba082dae 100644 --- a/src/hotspot/cpu/ppc/ppc.ad +++ b/src/hotspot/cpu/ppc/ppc.ad @@ -2125,6 +2125,9 @@ const bool Matcher::match_rule_supported(int opcode) { case Op_PopCountI: case Op_PopCountL: return (UsePopCountInstruction && VM_Version::has_popcntw()); + case Op_ConvF2HF: + case Op_ConvHF2F: + return VM_Version::supports_float16(); case Op_AddVB: case Op_AddVS: @@ -11345,6 +11348,34 @@ instruct convF2D_reg(regD dst, regF src) %{ ins_pipe(pipe_class_default); %} +instruct convF2HF_reg_reg(iRegIdst dst, regF src, regF tmp) %{ + match(Set dst (ConvF2HF src)); + effect(TEMP tmp); + ins_cost(3 * DEFAULT_COST); + size(12); + format %{ "xscvdphp $tmp, $src\t# convert to half precision\n\t" + "mffprd $dst, $tmp\t# move result from $tmp to $dst\n\t" + "extsh $dst, $dst\t# make it a proper short" + %} + ins_encode %{ + __ f2hf($dst$$Register, $src$$FloatRegister, $tmp$$FloatRegister); + %} + ins_pipe(pipe_class_default); +%} + +instruct convHF2F_reg_reg(regF dst, iRegIsrc src) %{ + match(Set dst (ConvHF2F src)); + ins_cost(2 * DEFAULT_COST); + size(8); + format %{ "mtfprd $dst, $src\t# move source from $src to $dst\n\t" + "xscvhpdp $dst, $dst\t# convert from half precision" + %} + ins_encode %{ + __ hf2f($dst$$FloatRegister, $src$$Register); + %} + ins_pipe(pipe_class_default); +%} + //----------Control Flow Instructions------------------------------------------ // Compare Instructions diff --git a/src/hotspot/cpu/ppc/stubGenerator_ppc.cpp b/src/hotspot/cpu/ppc/stubGenerator_ppc.cpp index c06f22e0fbb7..62c4c0974867 100644 --- a/src/hotspot/cpu/ppc/stubGenerator_ppc.cpp +++ b/src/hotspot/cpu/ppc/stubGenerator_ppc.cpp @@ -3557,6 +3557,24 @@ class StubGenerator: public StubCodeGenerator { return start; } + address generate_floatToFloat16() { + __ align(CodeEntryAlignment); + StubCodeMark mark(this, "StubRoutines", "floatToFloat16"); + address start = __ function_entry(); + __ f2hf(R3_RET, F1_ARG1, F0); + __ blr(); + return start; + } + + address generate_float16ToFloat() { + __ align(CodeEntryAlignment); + StubCodeMark mark(this, "StubRoutines", "float16ToFloat"); + address start = __ function_entry(); + __ hf2f(F1_RET, R3_ARG1); + __ blr(); + return start; + } + address generate_nmethod_entry_barrier() { __ align(CodeEntryAlignment); StubCodeMark mark(this, "StubRoutines", "nmethod_entry_barrier"); @@ -4755,6 +4773,12 @@ class StubGenerator: public StubCodeGenerator { StubRoutines::_crc32c_table_addr = StubRoutines::ppc::generate_crc_constants(REVERSE_CRC32C_POLY); StubRoutines::_updateBytesCRC32C = generate_CRC32_updateBytes(true); } + + if (VM_Version::supports_float16()) { + // For results consistency both intrinsics should be enabled. + StubRoutines::_hf2f = generate_float16ToFloat(); + StubRoutines::_f2hf = generate_floatToFloat16(); + } } void generate_continuation_stubs() { diff --git a/src/hotspot/cpu/ppc/templateInterpreterGenerator_ppc.cpp b/src/hotspot/cpu/ppc/templateInterpreterGenerator_ppc.cpp index 2cfea75792cb..a53997442f61 100644 --- a/src/hotspot/cpu/ppc/templateInterpreterGenerator_ppc.cpp +++ b/src/hotspot/cpu/ppc/templateInterpreterGenerator_ppc.cpp @@ -1156,6 +1156,44 @@ address TemplateInterpreterGenerator::generate_math_entry(AbstractInterpreter::M return entry; } +address TemplateInterpreterGenerator::generate_Float_floatToFloat16_entry() { + if (!VM_Version::supports_float16()) return nullptr; + + address entry = __ pc(); + + __ lfs(F1, Interpreter::stackElementSize, R15_esp); + __ f2hf(R3_RET, F1, F0); + + // Restore caller sp for c2i case (from compiled) and for resized sender frame (from interpreted). + __ resize_frame_absolute(R21_sender_SP, R11_scratch1, R0); + __ blr(); + + __ flush(); + + return entry; +} + +address TemplateInterpreterGenerator::generate_Float_float16ToFloat_entry() { + if (!VM_Version::supports_float16()) return nullptr; + + address entry = __ pc(); + + // Note: Could also use: + //__ li(R3, Interpreter::stackElementSize); + //__ lfiwax(F1_RET, R15_esp, R3); // short stored as 32 bit integer + //__ xscvhpdp(F1_RET->to_vsr(), F1_RET->to_vsr()); + __ lwa(R3, Interpreter::stackElementSize, R15_esp); + __ hf2f(F1_RET, R3); + + // Restore caller sp for c2i case (from compiled) and for resized sender frame (from interpreted). + __ resize_frame_absolute(R21_sender_SP, R11_scratch1, R0); + __ blr(); + + __ flush(); + + return entry; +} + void TemplateInterpreterGenerator::bang_stack_shadow_pages(bool native_call) { // Quick & dirty stack overflow checking: bang the stack & handle trap. // Note that we do the banging after the frame is setup, since the exception @@ -1936,8 +1974,6 @@ address TemplateInterpreterGenerator::generate_Float_intBitsToFloat_entry() { re address TemplateInterpreterGenerator::generate_Float_floatToRawIntBits_entry() { return nullptr; } address TemplateInterpreterGenerator::generate_Double_longBitsToDouble_entry() { return nullptr; } address TemplateInterpreterGenerator::generate_Double_doubleToRawLongBits_entry() { return nullptr; } -address TemplateInterpreterGenerator::generate_Float_float16ToFloat_entry() { return nullptr; } -address TemplateInterpreterGenerator::generate_Float_floatToFloat16_entry() { return nullptr; } // ============================================================================= // Exceptions diff --git a/src/hotspot/cpu/ppc/vm_version_ppc.hpp b/src/hotspot/cpu/ppc/vm_version_ppc.hpp index 0a9d5ce08104..ac6ade8605f9 100644 --- a/src/hotspot/cpu/ppc/vm_version_ppc.hpp +++ b/src/hotspot/cpu/ppc/vm_version_ppc.hpp @@ -97,6 +97,8 @@ class VM_Version: public Abstract_VM_Version { static bool supports_fast_class_init_checks() { return true; } constexpr static bool supports_stack_watermark_barrier() { return true; } + static bool supports_float16() { return PowerArchitecturePPC64 >= 9; } + static bool is_determine_features_test_running() { return _is_determine_features_test_running; } // CPU instruction support static bool has_fsqrt() { return (_features & fsqrt_m) != 0; } diff --git a/src/hotspot/cpu/riscv/abstractInterpreter_riscv.cpp b/src/hotspot/cpu/riscv/abstractInterpreter_riscv.cpp index 7e7321501cbb..7cf4bc6cfb2d 100644 --- a/src/hotspot/cpu/riscv/abstractInterpreter_riscv.cpp +++ b/src/hotspot/cpu/riscv/abstractInterpreter_riscv.cpp @@ -142,7 +142,8 @@ void AbstractInterpreter::layout_activation(Method* method, #ifdef ASSERT if (caller->is_interpreted_frame()) { - assert(locals < caller->fp() + frame::interpreter_frame_initial_sp_offset, "bad placement"); + assert(locals <= caller->interpreter_frame_expression_stack(), "bad placement"); + assert(locals >= interpreter_frame->sender_sp() + max_locals - 1, "bad placement"); } #endif diff --git a/src/hotspot/cpu/s390/abstractInterpreter_s390.cpp b/src/hotspot/cpu/s390/abstractInterpreter_s390.cpp index c24c2b56bf7a..4a567405bfc2 100644 --- a/src/hotspot/cpu/s390/abstractInterpreter_s390.cpp +++ b/src/hotspot/cpu/s390/abstractInterpreter_s390.cpp @@ -183,6 +183,13 @@ void AbstractInterpreter::layout_activation(Method* method, intptr_t* sender_sp; if (caller->is_interpreted_frame()) { sender_sp = caller->interpreter_frame_top_frame_sp(); +#ifdef ASSERT + assert(locals_base <= caller->interpreter_frame_expression_stack(), "bad placement"); + // Test caller-aligned placement vs callee-aligned + intptr_t* l2 = (caller->sp() + method->max_locals() - 1 + + frame::z_parent_ijava_frame_abi_size / Interpreter::stackElementSize); + assert(locals_base >= l2, "bad placement"); +#endif } else if (caller->is_compiled_frame()) { sender_sp = caller->fp() - caller->cb()->frame_size(); // The bottom frame's sender_sp is its caller's unextended_sp. diff --git a/src/hotspot/cpu/x86/abstractInterpreter_x86.cpp b/src/hotspot/cpu/x86/abstractInterpreter_x86.cpp index fef137257b02..e64b10d5c240 100644 --- a/src/hotspot/cpu/x86/abstractInterpreter_x86.cpp +++ b/src/hotspot/cpu/x86/abstractInterpreter_x86.cpp @@ -88,7 +88,10 @@ void AbstractInterpreter::layout_activation(Method* method, #ifdef ASSERT if (caller->is_interpreted_frame()) { - assert(locals < caller->fp() + frame::interpreter_frame_initial_sp_offset, "bad placement"); + // Test exact placement on top of caller args + intptr_t* l2 = caller->interpreter_frame_last_sp() + caller_actual_parameters - 1; + assert(l2 <= caller->interpreter_frame_expression_stack(), "bad placement"); + assert(l2 >= locals, "bad placement"); } #endif diff --git a/src/hotspot/cpu/x86/assembler_x86.cpp b/src/hotspot/cpu/x86/assembler_x86.cpp index d3b35a52fb99..7daf7589fb09 100644 --- a/src/hotspot/cpu/x86/assembler_x86.cpp +++ b/src/hotspot/cpu/x86/assembler_x86.cpp @@ -3555,6 +3555,14 @@ void Assembler::movsd(Address dst, XMMRegister src) { emit_operand(src, dst, 0); } +void Assembler::vmovsd(XMMRegister dst, XMMRegister src, XMMRegister src2) { + assert(UseAVX > 0, "Requires some form of AVX"); + InstructionMark im(this); + InstructionAttr attributes(AVX_128bit, /* rex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false); + int encode = vex_prefix_and_encode(src2->encoding(), src->encoding(), dst->encoding(), VEX_SIMD_F2, VEX_OPCODE_0F, &attributes); + emit_int16(0x11, (0xC0 | encode)); +} + void Assembler::movss(XMMRegister dst, XMMRegister src) { NOT_LP64(assert(VM_Version::supports_sse(), "")); InstructionAttr attributes(AVX_128bit, /* rex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false); @@ -6208,11 +6216,17 @@ void Assembler::subss(XMMRegister dst, Address src) { emit_operand(dst, src, 0); } -void Assembler::testb(Register dst, int imm8) { +void Assembler::testb(Register dst, int imm8, bool use_ral) { NOT_LP64(assert(dst->has_byte_register(), "must have byte register")); if (dst == rax) { - emit_int8((unsigned char)0xA8); - emit_int8(imm8); + if (use_ral) { + emit_int8((unsigned char)0xA8); + emit_int8(imm8); + } else { + emit_int8((unsigned char)0xF6); + emit_int8((unsigned char)0xC4); + emit_int8(imm8); + } } else { (void) prefix_and_encode(dst->encoding(), true); emit_arith_b(0xF6, 0xC0, dst, imm8); @@ -6547,6 +6561,29 @@ void Assembler::vfmadd231sd(XMMRegister dst, XMMRegister src1, XMMRegister src2) emit_int16((unsigned char)0xB9, (0xC0 | encode)); } +void Assembler::evfnmadd213sd(XMMRegister dst, XMMRegister src1, XMMRegister src2, EvexRoundPrefix rmode) { // Need to add rmode for rounding mode support + assert(VM_Version::supports_evex(), ""); + InstructionAttr attributes(rmode, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false); + attributes.set_extended_context(); + attributes.set_is_evex_instruction(); + int encode = vex_prefix_and_encode(dst->encoding(), src1->encoding(), src2->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); + emit_int16((unsigned char)0xAD, (0xC0 | encode)); +} + +void Assembler::vfnmadd213sd(XMMRegister dst, XMMRegister src1, XMMRegister src2) { + assert(VM_Version::supports_fma(), ""); + InstructionAttr attributes(AVX_128bit, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false); + int encode = vex_prefix_and_encode(dst->encoding(), src1->encoding(), src2->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); + emit_int16((unsigned char)0xAD, (0xC0 | encode)); +} + +void Assembler::vfnmadd231sd(XMMRegister dst, XMMRegister src1, XMMRegister src2) { + assert(VM_Version::supports_fma(), ""); + InstructionAttr attributes(AVX_128bit, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false); + int encode = vex_prefix_and_encode(dst->encoding(), src1->encoding(), src2->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_38, &attributes); + emit_int16((unsigned char)0xBD, (0xC0 | encode)); +} + void Assembler::vfmadd231ss(XMMRegister dst, XMMRegister src1, XMMRegister src2) { assert(VM_Version::supports_fma(), ""); InstructionAttr attributes(AVX_128bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false); @@ -6908,6 +6945,22 @@ void Assembler::vroundpd(XMMRegister dst, Address src, int32_t rmode, int vecto emit_int8((rmode)); } +void Assembler::vroundsd(XMMRegister dst, XMMRegister src, XMMRegister src2, int32_t rmode) { + assert(VM_Version::supports_avx(), ""); + assert(rmode <= 0x0f, "rmode 0x%x", rmode); + InstructionAttr attributes(AVX_128bit, /* vex_w */ false, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false); + int encode = vex_prefix_and_encode(dst->encoding(), src->encoding(), src2->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes); + emit_int24(0x0B, (0xC0 | encode), (rmode)); +} + +void Assembler::vrndscalesd(XMMRegister dst, XMMRegister src1, XMMRegister src2, int32_t rmode) { + assert(VM_Version::supports_evex(), "requires EVEX support"); + InstructionAttr attributes(AVX_128bit, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false); + attributes.set_is_evex_instruction(); + int encode = vex_prefix_and_encode(dst->encoding(), src1->encoding(), src2->encoding(), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes); + emit_int24(0x0B, (0xC0 | encode), (rmode)); +} + void Assembler::vrndscalepd(XMMRegister dst, XMMRegister src, int32_t rmode, int vector_len) { assert(VM_Version::supports_evex(), "requires EVEX support"); InstructionAttr attributes(vector_len, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ true); @@ -8873,6 +8926,19 @@ void Assembler::vextractf64x4(Address dst, XMMRegister src, uint8_t imm8) { emit_int8(imm8 & 0x01); } +void Assembler::extractps(Register dst, XMMRegister src, uint8_t imm8) { + assert(VM_Version::supports_sse4_1(), ""); + assert(imm8 <= 0x03, "imm8: %u", imm8); + InstructionAttr attributes(AVX_128bit, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false); + int encode = simd_prefix_and_encode(src, xnoreg, as_XMMRegister(dst->encoding()), VEX_SIMD_66, VEX_OPCODE_0F_3A, &attributes); + // imm8: + // 0x00 - extract from bits 31:0 + // 0x01 - extract from bits 63:32 + // 0x02 - extract from bits 95:64 + // 0x03 - extract from bits 127:96 + emit_int24(0x17, (0xC0 | encode), imm8 & 0x03); +} + // duplicate 1-byte integer data from src into programmed locations in dest : requires AVX512BW and AVX512VL void Assembler::vpbroadcastb(XMMRegister dst, XMMRegister src, int vector_len) { assert(VM_Version::supports_avx2(), ""); @@ -9547,6 +9613,15 @@ void Assembler::evdivpd(XMMRegister dst, KRegister mask, XMMRegister nds, Addres emit_operand(dst, src, 0); } +void Assembler::evdivsd(XMMRegister dst, XMMRegister nds, XMMRegister src, EvexRoundPrefix rmode) { + assert(VM_Version::supports_evex(), ""); + InstructionAttr attributes(rmode, /* vex_w */ true, /* legacy_mode */ false, /* no_mask_reg */ true, /* uses_vl */ false); + attributes.set_extended_context(); + attributes.set_is_evex_instruction(); + int encode = vex_prefix_and_encode(dst->encoding(), nds->encoding(), src->encoding(), VEX_SIMD_F2, VEX_OPCODE_0F, &attributes); + emit_int16(0x5E, (0xC0 | encode)); +} + void Assembler::evpabsb(XMMRegister dst, KRegister mask, XMMRegister src, bool merge, int vector_len) { assert(VM_Version::supports_avx512bw() && (vector_len == AVX_512bit || VM_Version::supports_avx512vl()), ""); InstructionAttr attributes(vector_len, /* vex_w */ false,/* legacy_mode */ false, /* no_mask_reg */ false,/* uses_vl */ true); @@ -10890,6 +10965,36 @@ void Assembler::emit_operand32(Register reg, Address adr, int post_addr_length) emit_operand(reg, adr._base, adr._index, adr._scale, adr._disp, adr._rspec, post_addr_length); } +void Assembler::fld_d(Address adr) { + InstructionMark im(this); + emit_int8((unsigned char)0xDD); + emit_operand32(rax, adr, 0); +} + +void Assembler::fprem() { + emit_int16((unsigned char)0xD9, (unsigned char)0xF8); +} + +void Assembler::fnstsw_ax() { + emit_int16((unsigned char)0xDF, (unsigned char)0xE0); +} + +void Assembler::fstp_d(Address adr) { + InstructionMark im(this); + emit_int8((unsigned char)0xDD); + emit_operand32(rbx, adr, 0); +} + +void Assembler::fstp_d(int index) { + emit_farith(0xDD, 0xD8, index); +} + +void Assembler::emit_farith(int b1, int b2, int i) { + assert(isByte(b1) && isByte(b2), "wrong opcode"); + assert(0 <= i && i < 8, "illegal stack offset"); + emit_int16(b1, b2 + i); +} + #ifndef _LP64 // 32bit only pieces of the assembler @@ -10933,12 +11038,6 @@ void Assembler::decl(Register dst) { // 64bit doesn't use the x87 -void Assembler::emit_farith(int b1, int b2, int i) { - assert(isByte(b1) && isByte(b2), "wrong opcode"); - assert(0 <= i && i < 8, "illegal stack offset"); - emit_int16(b1, b2 + i); -} - void Assembler::fabs() { emit_int16((unsigned char)0xD9, (unsigned char)0xE1); } @@ -11100,12 +11199,6 @@ void Assembler::fld1() { emit_int16((unsigned char)0xD9, (unsigned char)0xE8); } -void Assembler::fld_d(Address adr) { - InstructionMark im(this); - emit_int8((unsigned char)0xDD); - emit_operand32(rax, adr, 0); -} - void Assembler::fld_s(Address adr) { InstructionMark im(this); emit_int8((unsigned char)0xD9); @@ -11189,14 +11282,6 @@ void Assembler::fnstcw(Address src) { emit_operand32(rdi, src, 0); } -void Assembler::fnstsw_ax() { - emit_int16((unsigned char)0xDF, (unsigned char)0xE0); -} - -void Assembler::fprem() { - emit_int16((unsigned char)0xD9, (unsigned char)0xF8); -} - void Assembler::fprem1() { emit_int16((unsigned char)0xD9, (unsigned char)0xF5); } @@ -11227,16 +11312,6 @@ void Assembler::fst_s(Address adr) { emit_operand32(rdx, adr, 0); } -void Assembler::fstp_d(Address adr) { - InstructionMark im(this); - emit_int8((unsigned char)0xDD); - emit_operand32(rbx, adr, 0); -} - -void Assembler::fstp_d(int index) { - emit_farith(0xDD, 0xD8, index); -} - void Assembler::fstp_s(Address adr) { InstructionMark im(this); emit_int8((unsigned char)0xD9); @@ -13442,6 +13517,15 @@ void Assembler::notq(Register dst) { emit_int16((unsigned char)0xF7, (0xD0 | encode)); } +void Assembler::btq(Register src, int imm8) { + assert(isByte(imm8), "not a byte"); + InstructionMark im(this); + int encode = prefixq_and_encode(src->encoding()); + emit_int16(0x0f, 0xba); + emit_int8(0xe0|encode); + emit_int8(imm8); +} + void Assembler::btsq(Address dst, int imm8) { assert(isByte(imm8), "not a byte"); InstructionMark im(this); diff --git a/src/hotspot/cpu/x86/assembler_x86.hpp b/src/hotspot/cpu/x86/assembler_x86.hpp index 0f8966f17093..8b17abd3fe6e 100644 --- a/src/hotspot/cpu/x86/assembler_x86.hpp +++ b/src/hotspot/cpu/x86/assembler_x86.hpp @@ -528,6 +528,13 @@ class Assembler : public AbstractAssembler { EVEX_Z = 0x80 }; + enum EvexRoundPrefix { + EVEX_RNE = 0x0, + EVEX_RD = 0x1, + EVEX_RU = 0x2, + EVEX_RZ = 0x3 + }; + enum VexSimdPrefix { VEX_SIMD_NONE = 0x0, VEX_SIMD_66 = 0x1, @@ -886,6 +893,8 @@ class Assembler : public AbstractAssembler { void movsd(Address dst, XMMRegister src); void movlpd(XMMRegister dst, Address src); + void vmovsd(XMMRegister dst, XMMRegister src, XMMRegister src2); + // New cpus require use of movaps and movapd to avoid partial register stall // when moving between registers. void movaps(XMMRegister dst, XMMRegister src); @@ -1233,12 +1242,18 @@ class Assembler : public AbstractAssembler { void divss(XMMRegister dst, XMMRegister src); -#ifndef _LP64 + void fnstsw_ax(); + void fprem(); + void fld_d(Address adr); + void fstp_d(Address adr); + void fstp_d(int index); + private: void emit_farith(int b1, int b2, int i); public: +#ifndef _LP64 void emms(); void fabs(); @@ -1297,7 +1312,6 @@ class Assembler : public AbstractAssembler { void fld1(); - void fld_d(Address adr); void fld_s(Address adr); void fld_s(int index); @@ -1326,10 +1340,6 @@ class Assembler : public AbstractAssembler { void fnsave(Address dst); void fnstcw(Address src); - - void fnstsw_ax(); - - void fprem(); void fprem1(); void frstor(Address src); @@ -1341,8 +1351,6 @@ class Assembler : public AbstractAssembler { void fst_d(Address adr); void fst_s(Address adr); - void fstp_d(Address adr); - void fstp_d(int index); void fstp_s(Address adr); void fsub(int i); @@ -1717,6 +1725,7 @@ class Assembler : public AbstractAssembler { void btsq(Address dst, int imm8); void btrq(Address dst, int imm8); + void btq(Register src, int imm8); #endif void orw(Register dst, Register src); @@ -2171,7 +2180,7 @@ class Assembler : public AbstractAssembler { void subss(XMMRegister dst, XMMRegister src); void testb(Address dst, int imm8); - void testb(Register dst, int imm8); + void testb(Register dst, int imm8, bool use_ral = true); void testl(Address dst, int32_t imm32); void testl(Register dst, int32_t imm32); @@ -2244,9 +2253,13 @@ class Assembler : public AbstractAssembler { void vaddss(XMMRegister dst, XMMRegister nds, XMMRegister src); void vdivsd(XMMRegister dst, XMMRegister nds, Address src); void vdivsd(XMMRegister dst, XMMRegister nds, XMMRegister src); + void evdivsd(XMMRegister dst, XMMRegister nds, XMMRegister src, EvexRoundPrefix rmode); void vdivss(XMMRegister dst, XMMRegister nds, Address src); void vdivss(XMMRegister dst, XMMRegister nds, XMMRegister src); void vfmadd231sd(XMMRegister dst, XMMRegister nds, XMMRegister src); + void vfnmadd213sd(XMMRegister dst, XMMRegister nds, XMMRegister src); + void evfnmadd213sd(XMMRegister dst, XMMRegister nds, XMMRegister src, EvexRoundPrefix rmode); + void vfnmadd231sd(XMMRegister dst, XMMRegister src1, XMMRegister src2); void vfmadd231ss(XMMRegister dst, XMMRegister nds, XMMRegister src); void vmulsd(XMMRegister dst, XMMRegister nds, Address src); void vmulsd(XMMRegister dst, XMMRegister nds, XMMRegister src); @@ -2336,8 +2349,11 @@ class Assembler : public AbstractAssembler { // Round Packed Double precision value. void vroundpd(XMMRegister dst, XMMRegister src, int32_t rmode, int vector_len); void vroundpd(XMMRegister dst, Address src, int32_t rmode, int vector_len); + void vrndscalesd(XMMRegister dst, XMMRegister src1, XMMRegister src2, int32_t rmode); void vrndscalepd(XMMRegister dst, XMMRegister src, int32_t rmode, int vector_len); void vrndscalepd(XMMRegister dst, Address src, int32_t rmode, int vector_len); + void vroundsd(XMMRegister dst, XMMRegister src, XMMRegister src2, int32_t rmode); + void vroundsd(XMMRegister dst, XMMRegister src, Address src2, int32_t rmode); // Bitwise Logical AND of Packed Floating-Point Values void andpd(XMMRegister dst, XMMRegister src); @@ -2721,6 +2737,8 @@ class Assembler : public AbstractAssembler { void vextractf64x4(XMMRegister dst, XMMRegister src, uint8_t imm8); void vextractf64x4(Address dst, XMMRegister src, uint8_t imm8); + void extractps(Register dst, XMMRegister src, uint8_t imm8); + // xmm/mem sourced byte/word/dword/qword replicate void vpbroadcastb(XMMRegister dst, XMMRegister src, int vector_len); void vpbroadcastb(XMMRegister dst, Address src, int vector_len); @@ -2954,6 +2972,8 @@ class InstructionAttr { _embedded_opmask_register_specifier = mask->encoding() & 0x7; } + void set_extended_context(void) { _is_extended_context = true; } + }; #endif // CPU_X86_ASSEMBLER_X86_HPP diff --git a/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp b/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp index db332274a68b..b6a27abf0f37 100644 --- a/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp +++ b/src/hotspot/cpu/x86/c1_LIRGenerator_x86.cpp @@ -968,7 +968,7 @@ void LIRGenerator::do_LibmIntrinsic(Intrinsic* x) { break; case vmIntrinsics::_dpow: if (StubRoutines::dpow() != nullptr) { - __ call_runtime_leaf(StubRoutines::dpow(), getThreadTemp(), result_reg, cc->args()); + __ call_runtime_leaf(StubRoutines::dpow(), getThreadTemp(), result_reg, cc->args()); } else { __ call_runtime_leaf(CAST_FROM_FN_PTR(address, SharedRuntime::dpow), getThreadTemp(), result_reg, cc->args()); } diff --git a/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp b/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp index 84a1f1895180..acf8fc8267a8 100644 --- a/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp +++ b/src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp @@ -3852,13 +3852,11 @@ void C2_MacroAssembler::count_positives(Register ary1, Register len, VM_Version::supports_bmi2()) { Label test_64_loop, test_tail, BREAK_LOOP; - Register tmp3_aliased = len; - movl(tmp1, len); vpxor(vec2, vec2, vec2, Assembler::AVX_512bit); - andl(tmp1, 64 - 1); // tail count (in chars) 0x3F - andl(len, ~(64 - 1)); // vector count (in chars) + andl(tmp1, 0x0000003f); // tail count (in chars) 0x3F + andl(len, 0xffffffc0); // vector count (in chars) jccb(Assembler::zero, test_tail); lea(ary1, Address(ary1, len, Address::times_1)); @@ -3878,12 +3876,17 @@ void C2_MacroAssembler::count_positives(Register ary1, Register len, testl(tmp1, -1); jcc(Assembler::zero, DONE); + + // check the tail for absense of negatives // ~(~0 << len) applied up to two times (for 32-bit scenario) #ifdef _LP64 - mov64(tmp3_aliased, 0xFFFFFFFFFFFFFFFF); - shlxq(tmp3_aliased, tmp3_aliased, tmp1); - notq(tmp3_aliased); - kmovql(mask2, tmp3_aliased); + { + Register tmp3_aliased = len; + mov64(tmp3_aliased, 0xFFFFFFFFFFFFFFFF); + shlxq(tmp3_aliased, tmp3_aliased, tmp1); + notq(tmp3_aliased); + kmovql(mask2, tmp3_aliased); + } #else Label k_init; jmp(k_init); @@ -3915,8 +3918,13 @@ void C2_MacroAssembler::count_positives(Register ary1, Register len, ktestq(mask1, mask2); jcc(Assembler::zero, DONE); + // do a full check for negative registers in the tail + movl(len, tmp1); // tmp1 holds low 6-bit from original len; + // ary1 already pointing to the right place + jmpb(TAIL_START); + bind(BREAK_LOOP); - // At least one byte in the last 64 bytes is negative. + // At least one byte in the last 64 byte block was negative. // Set up to look at the last 64 bytes as if they were a tail lea(ary1, Address(ary1, len, Address::times_1)); addptr(result, len); @@ -5732,15 +5740,21 @@ void C2_MacroAssembler::vector_count_leading_zeros_int_avx(XMMRegister dst, XMMR // Since IEEE 754 floating point format represents mantissa in 1.0 format // hence biased exponent can be used to compute leading zero count as per // following formula:- - // LZCNT = 32 - (biased_exp - 127) + // LZCNT = 31 - (biased_exp - 127) // Special handling has been introduced for Zero, Max_Int and -ve source values. // Broadcast 0xFF vpcmpeqd(xtmp1, xtmp1, xtmp1, vec_enc); vpsrld(xtmp1, xtmp1, 24, vec_enc); + // Remove the bit to the right of the highest set bit ensuring that the conversion to float cannot round up to a higher + // power of 2, which has a higher exponent than the input. This transformation is valid as only the highest set bit + // contributes to the leading number of zeros. + vpsrld(xtmp2, src, 1, vec_enc); + vpandn(xtmp3, xtmp2, src, vec_enc); + // Extract biased exponent. - vcvtdq2ps(dst, src, vec_enc); + vcvtdq2ps(dst, xtmp3, vec_enc); vpsrld(dst, dst, 23, vec_enc); vpand(dst, dst, xtmp1, vec_enc); @@ -5749,7 +5763,7 @@ void C2_MacroAssembler::vector_count_leading_zeros_int_avx(XMMRegister dst, XMMR // Exponent = biased_exp - 127 vpsubd(dst, dst, xtmp1, vec_enc); - // Exponent = Exponent + 1 + // Exponent_plus_one = Exponent + 1 vpsrld(xtmp3, xtmp1, 6, vec_enc); vpaddd(dst, dst, xtmp3, vec_enc); @@ -5762,7 +5776,7 @@ void C2_MacroAssembler::vector_count_leading_zeros_int_avx(XMMRegister dst, XMMR vpslld(xtmp1, xtmp3, 5, vec_enc); // Exponent is 32 if corresponding source lane contains max_int value. vpcmpeqd(xtmp2, dst, xtmp1, vec_enc); - // LZCNT = 32 - exponent + // LZCNT = 32 - exponent_plus_one vpsubd(dst, xtmp1, dst, vec_enc); // Replace LZCNT with a value 1 if corresponding source lane diff --git a/src/hotspot/cpu/x86/c2_intelJccErratum_x86.cpp b/src/hotspot/cpu/x86/c2_intelJccErratum_x86.cpp index 349ca325fa98..6cfa2ce1a31b 100644 --- a/src/hotspot/cpu/x86/c2_intelJccErratum_x86.cpp +++ b/src/hotspot/cpu/x86/c2_intelJccErratum_x86.cpp @@ -100,7 +100,7 @@ int IntelJccErratum::compute_padding(uintptr_t current_offset, const MachNode* m if (index_in_block < block->number_of_nodes() - 1) { Node* next = block->get_node(index_in_block + 1); if (next->is_Mach() && (next->as_Mach()->flags() & Node::PD::Flag_intel_jcc_erratum)) { - jcc_size += mach->size(regalloc); + jcc_size += next->size(regalloc); } } if (jcc_size > largest_jcc_size()) { diff --git a/src/hotspot/cpu/x86/gc/g1/g1BarrierSetAssembler_x86.cpp b/src/hotspot/cpu/x86/gc/g1/g1BarrierSetAssembler_x86.cpp index f609846f00d6..4f00461e41ad 100644 --- a/src/hotspot/cpu/x86/gc/g1/g1BarrierSetAssembler_x86.cpp +++ b/src/hotspot/cpu/x86/gc/g1/g1BarrierSetAssembler_x86.cpp @@ -269,8 +269,6 @@ void G1BarrierSetAssembler::g1_write_barrier_post(MacroAssembler* masm, Register thread, Register tmp, Register tmp2) { - // Generated code assumes that buffer index is pointer sized. - STATIC_ASSERT(in_bytes(SATBMarkQueue::byte_width_of_index()) == sizeof(intptr_t)); #ifdef _LP64 assert(thread == r15_thread, "must be"); #endif // _LP64 @@ -321,6 +319,9 @@ void G1BarrierSetAssembler::g1_write_barrier_post(MacroAssembler* masm, __ movb(Address(card_addr, 0), G1CardTable::dirty_card_val()); + // The code below assumes that buffer index is pointer sized. + STATIC_ASSERT(in_bytes(G1DirtyCardQueue::byte_width_of_index()) == sizeof(intptr_t)); + __ movptr(tmp2, queue_index); __ testptr(tmp2, tmp2); __ jcc(Assembler::zero, runtime); diff --git a/src/hotspot/cpu/x86/macroAssembler_x86.cpp b/src/hotspot/cpu/x86/macroAssembler_x86.cpp index 26585a8a1bd8..6ebf3b501726 100644 --- a/src/hotspot/cpu/x86/macroAssembler_x86.cpp +++ b/src/hotspot/cpu/x86/macroAssembler_x86.cpp @@ -4652,6 +4652,339 @@ void MacroAssembler::check_klass_subtype_slow_path(Register sub_klass, bind(L_fallthrough); } +#ifdef _LP64 + +// population_count variant for running without the POPCNT +// instruction, which was introduced with SSE4.2 in 2008. +void MacroAssembler::population_count(Register dst, Register src, + Register scratch1, Register scratch2) { + assert_different_registers(src, scratch1, scratch2); + if (UsePopCountInstruction) { + Assembler::popcntq(dst, src); + } else { + assert_different_registers(src, scratch1, scratch2); + assert_different_registers(dst, scratch1, scratch2); + Label loop, done; + + mov(scratch1, src); + // dst = 0; + // while(scratch1 != 0) { + // dst++; + // scratch1 &= (scratch1 - 1); + // } + xorl(dst, dst); + testq(scratch1, scratch1); + jccb(Assembler::equal, done); + { + bind(loop); + incq(dst); + movq(scratch2, scratch1); + decq(scratch2); + andq(scratch1, scratch2); + jccb(Assembler::notEqual, loop); + } + bind(done); + } +} + +// Ensure that the inline code and the stub are using the same registers. +#define LOOKUP_SECONDARY_SUPERS_TABLE_REGISTERS \ +do { \ + assert(r_super_klass == rax, "mismatch"); \ + assert(r_array_base == rbx, "mismatch"); \ + assert(r_array_length == rcx, "mismatch"); \ + assert(r_array_index == rdx, "mismatch"); \ + assert(r_sub_klass == rsi || r_sub_klass == noreg, "mismatch"); \ + assert(r_bitmap == r11 || r_bitmap == noreg, "mismatch"); \ + assert(result == rdi || result == noreg, "mismatch"); \ +} while(0) + +void MacroAssembler::lookup_secondary_supers_table(Register r_sub_klass, + Register r_super_klass, + Register temp1, + Register temp2, + Register temp3, + Register temp4, + Register result, + u1 super_klass_slot) { + assert_different_registers(r_sub_klass, r_super_klass, temp1, temp2, temp3, temp4, result); + + Label L_fallthrough, L_success, L_failure; + + BLOCK_COMMENT("lookup_secondary_supers_table {"); + + const Register + r_array_index = temp1, + r_array_length = temp2, + r_array_base = temp3, + r_bitmap = temp4; + + LOOKUP_SECONDARY_SUPERS_TABLE_REGISTERS; + + xorq(result, result); // = 0 + + movq(r_bitmap, Address(r_sub_klass, Klass::bitmap_offset())); + movq(r_array_index, r_bitmap); + + // First check the bitmap to see if super_klass might be present. If + // the bit is zero, we are certain that super_klass is not one of + // the secondary supers. + u1 bit = super_klass_slot; + { + // NB: If the count in a x86 shift instruction is 0, the flags are + // not affected, so we do a testq instead. + int shift_count = Klass::SECONDARY_SUPERS_TABLE_MASK - bit; + if (shift_count != 0) { + salq(r_array_index, shift_count); + } else { + testq(r_array_index, r_array_index); + } + } + // We test the MSB of r_array_index, i.e. its sign bit + jcc(Assembler::positive, L_failure); + + // Get the first array index that can contain super_klass into r_array_index. + if (bit != 0) { + population_count(r_array_index, r_array_index, temp2, temp3); + } else { + movl(r_array_index, 1); + } + // NB! r_array_index is off by 1. It is compensated by keeping r_array_base off by 1 word. + + // We will consult the secondary-super array. + movptr(r_array_base, Address(r_sub_klass, in_bytes(Klass::secondary_supers_offset()))); + + // We're asserting that the first word in an Array is the + // length, and the second word is the first word of the data. If + // that ever changes, r_array_base will have to be adjusted here. + assert(Array::base_offset_in_bytes() == wordSize, "Adjust this code"); + assert(Array::length_offset_in_bytes() == 0, "Adjust this code"); + + cmpq(r_super_klass, Address(r_array_base, r_array_index, Address::times_8)); + jccb(Assembler::equal, L_success); + + // Is there another entry to check? Consult the bitmap. + btq(r_bitmap, (bit + 1) & Klass::SECONDARY_SUPERS_TABLE_MASK); + jccb(Assembler::carryClear, L_failure); + + // Linear probe. Rotate the bitmap so that the next bit to test is + // in Bit 1. + if (bit != 0) { + rorq(r_bitmap, bit); + } + + // Calls into the stub generated by lookup_secondary_supers_table_slow_path. + // Arguments: r_super_klass, r_array_base, r_array_index, r_bitmap. + // Kills: r_array_length. + // Returns: result. + call(RuntimeAddress(StubRoutines::lookup_secondary_supers_table_slow_path_stub())); + // Result (0/1) is in rdi + jmpb(L_fallthrough); + + bind(L_failure); + incq(result); // 0 => 1 + + bind(L_success); + // result = 0; + + bind(L_fallthrough); + BLOCK_COMMENT("} lookup_secondary_supers_table"); + + if (VerifySecondarySupers) { + verify_secondary_supers_table(r_sub_klass, r_super_klass, result, + temp1, temp2, temp3); + } +} + +void MacroAssembler::repne_scanq(Register addr, Register value, Register count, Register limit, + Label* L_success, Label* L_failure) { + Label L_loop, L_fallthrough; + { + int label_nulls = 0; + if (L_success == nullptr) { L_success = &L_fallthrough; label_nulls++; } + if (L_failure == nullptr) { L_failure = &L_fallthrough; label_nulls++; } + assert(label_nulls <= 1, "at most one null in the batch"); + } + bind(L_loop); + cmpq(value, Address(addr, count, Address::times_8)); + jcc(Assembler::equal, *L_success); + addl(count, 1); + cmpl(count, limit); + jcc(Assembler::less, L_loop); + + if (&L_fallthrough != L_failure) { + jmp(*L_failure); + } + bind(L_fallthrough); +} + +// Called by code generated by check_klass_subtype_slow_path +// above. This is called when there is a collision in the hashed +// lookup in the secondary supers array. +void MacroAssembler::lookup_secondary_supers_table_slow_path(Register r_super_klass, + Register r_array_base, + Register r_array_index, + Register r_bitmap, + Register temp1, + Register temp2, + Label* L_success, + Label* L_failure) { + assert_different_registers(r_super_klass, r_array_base, r_array_index, r_bitmap, temp1, temp2); + + const Register + r_array_length = temp1, + r_sub_klass = noreg, + result = noreg; + + LOOKUP_SECONDARY_SUPERS_TABLE_REGISTERS; + + Label L_fallthrough; + int label_nulls = 0; + if (L_success == nullptr) { L_success = &L_fallthrough; label_nulls++; } + if (L_failure == nullptr) { L_failure = &L_fallthrough; label_nulls++; } + assert(label_nulls <= 1, "at most one null in the batch"); + + // Load the array length. + movl(r_array_length, Address(r_array_base, Array::length_offset_in_bytes())); + // And adjust the array base to point to the data. + // NB! Effectively increments current slot index by 1. + assert(Array::base_offset_in_bytes() == wordSize, ""); + addptr(r_array_base, Array::base_offset_in_bytes()); + + // Linear probe + Label L_huge; + + // The bitmap is full to bursting. + // Implicit invariant: BITMAP_FULL implies (length > 0) + cmpl(r_array_length, (int32_t)Klass::SECONDARY_SUPERS_TABLE_SIZE - 2); + jcc(Assembler::greater, L_huge); + + // NB! Our caller has checked bits 0 and 1 in the bitmap. The + // current slot (at secondary_supers[r_array_index]) has not yet + // been inspected, and r_array_index may be out of bounds if we + // wrapped around the end of the array. + + { // This is conventional linear probing, but instead of terminating + // when a null entry is found in the table, we maintain a bitmap + // in which a 0 indicates missing entries. + // The check above guarantees there are 0s in the bitmap, so the loop + // eventually terminates. + + xorl(temp2, temp2); // = 0; + + Label L_again; + bind(L_again); + + // Check for array wraparound. + cmpl(r_array_index, r_array_length); + cmovl(Assembler::greaterEqual, r_array_index, temp2); + + cmpq(r_super_klass, Address(r_array_base, r_array_index, Address::times_8)); + jcc(Assembler::equal, *L_success); + + // If the next bit in bitmap is zero, we're done. + btq(r_bitmap, 2); // look-ahead check (Bit 2); Bits 0 and 1 are tested by now + jcc(Assembler::carryClear, *L_failure); + + rorq(r_bitmap, 1); // Bits 1/2 => 0/1 + addl(r_array_index, 1); + + jmp(L_again); + } + + { // Degenerate case: more than 64 secondary supers. + // FIXME: We could do something smarter here, maybe a vectorized + // comparison or a binary search, but is that worth any added + // complexity? + bind(L_huge); + xorl(r_array_index, r_array_index); // = 0 + repne_scanq(r_array_base, r_super_klass, r_array_index, r_array_length, + L_success, + (&L_fallthrough != L_failure ? L_failure : nullptr)); + + bind(L_fallthrough); + } +} + +struct VerifyHelperArguments { + Klass* _super; + Klass* _sub; + intptr_t _linear_result; + intptr_t _table_result; +}; + +static void verify_secondary_supers_table_helper(const char* msg, VerifyHelperArguments* args) { + Klass::on_secondary_supers_verification_failure(args->_super, + args->_sub, + args->_linear_result, + args->_table_result, + msg); +} + +// Make sure that the hashed lookup and a linear scan agree. +void MacroAssembler::verify_secondary_supers_table(Register r_sub_klass, + Register r_super_klass, + Register result, + Register temp1, + Register temp2, + Register temp3) { + const Register + r_array_index = temp1, + r_array_length = temp2, + r_array_base = temp3, + r_bitmap = noreg; + + LOOKUP_SECONDARY_SUPERS_TABLE_REGISTERS; + + BLOCK_COMMENT("verify_secondary_supers_table {"); + + Label L_success, L_failure, L_check, L_done; + + movptr(r_array_base, Address(r_sub_klass, in_bytes(Klass::secondary_supers_offset()))); + movl(r_array_length, Address(r_array_base, Array::length_offset_in_bytes())); + // And adjust the array base to point to the data. + addptr(r_array_base, Array::base_offset_in_bytes()); + + testl(r_array_length, r_array_length); // array_length == 0? + jcc(Assembler::zero, L_failure); + + movl(r_array_index, 0); + repne_scanq(r_array_base, r_super_klass, r_array_index, r_array_length, &L_success); + // fall through to L_failure + + const Register linear_result = r_array_index; // reuse temp1 + + bind(L_failure); // not present + movl(linear_result, 1); + jmp(L_check); + + bind(L_success); // present + movl(linear_result, 0); + + bind(L_check); + cmpl(linear_result, result); + jcc(Assembler::equal, L_done); + + { // To avoid calling convention issues, build a record on the stack + // and pass the pointer to that instead. + push(result); + push(linear_result); + push(r_sub_klass); + push(r_super_klass); + movptr(c_rarg1, rsp); + movptr(c_rarg0, (uintptr_t) "mismatch"); + call(RuntimeAddress(CAST_FROM_FN_PTR(address, verify_secondary_supers_table_helper))); + should_not_reach_here(); + } + bind(L_done); + + BLOCK_COMMENT("} verify_secondary_supers_table"); +} + +#undef LOOKUP_SECONDARY_SUPERS_TABLE_REGISTERS + +#endif // LP64 + void MacroAssembler::clinit_barrier(Register klass, Register thread, Label* L_fast_path, Label* L_slow_path) { assert(L_fast_path != nullptr || L_slow_path != nullptr, "at least one is required"); diff --git a/src/hotspot/cpu/x86/macroAssembler_x86.hpp b/src/hotspot/cpu/x86/macroAssembler_x86.hpp index c78ab80ea5a0..38f56e7f277f 100644 --- a/src/hotspot/cpu/x86/macroAssembler_x86.hpp +++ b/src/hotspot/cpu/x86/macroAssembler_x86.hpp @@ -594,6 +594,8 @@ class MacroAssembler: public Assembler { ); void zero_memory(Register address, Register length_in_bytes, int offset_in_bytes, Register temp); + void population_count(Register dst, Register src, Register scratch1, Register scratch2); + // interface method calling void lookup_interface_method(Register recv_klass, Register intf_klass, @@ -644,8 +646,46 @@ class MacroAssembler: public Assembler { Label* L_success, Label* L_failure, bool set_cond_codes = false); + void hashed_check_klass_subtype_slow_path(Register sub_klass, + Register super_klass, + Register temp_reg, + Register temp2_reg, + Label* L_success, + Label* L_failure, + bool set_cond_codes = false); - // Simplified, combined version, good for typical uses. + // As above, but with a constant super_klass. + // The result is in Register result, not the condition codes. + void lookup_secondary_supers_table(Register sub_klass, + Register super_klass, + Register temp1, + Register temp2, + Register temp3, + Register temp4, + Register result, + u1 super_klass_slot); + + void lookup_secondary_supers_table_slow_path(Register r_super_klass, + Register r_array_base, + Register r_array_index, + Register r_bitmap, + Register temp1, + Register temp2, + Label* L_success, + Label* L_failure = nullptr); + + void verify_secondary_supers_table(Register r_sub_klass, + Register r_super_klass, + Register expected, + Register temp1, + Register temp2, + Register temp3); + + void repne_scanq(Register addr, Register value, Register count, Register limit, + Label* L_success, + Label* L_failure = nullptr); + + // Simplified, combined version, good for typical uses. // Falls through on failure. void check_klass_subtype(Register sub_klass, Register super_klass, diff --git a/src/hotspot/cpu/x86/sharedRuntime_x86.cpp b/src/hotspot/cpu/x86/sharedRuntime_x86.cpp index 1fd5f9eb272d..3ecbb43f7f51 100644 --- a/src/hotspot/cpu/x86/sharedRuntime_x86.cpp +++ b/src/hotspot/cpu/x86/sharedRuntime_x86.cpp @@ -92,34 +92,18 @@ void SharedRuntime::inline_check_hashcode_from_object_header(MacroAssembler* mas } #endif //COMPILER1 -#if defined(TARGET_COMPILER_gcc) && !defined(_WIN64) JRT_LEAF(jfloat, SharedRuntime::frem(jfloat x, jfloat y)) - jfloat retval; - asm ("\ -1: \n\ -fprem \n\ -fnstsw %%ax \n\ -test $0x4,%%ah \n\ -jne 1b \n\ -" - :"=t"(retval) - :"0"(x), "u"(y) - :"cc", "ax"); - return retval; + assert(StubRoutines::fmod() != nullptr, ""); + jdouble (*addr)(jdouble, jdouble) = (double (*)(double, double))StubRoutines::fmod(); + jdouble dx = (jdouble) x; + jdouble dy = (jdouble) y; + + return (jfloat) (*addr)(dx, dy); JRT_END JRT_LEAF(jdouble, SharedRuntime::drem(jdouble x, jdouble y)) - jdouble retval; - asm ("\ -1: \n\ -fprem \n\ -fnstsw %%ax \n\ -test $0x4,%%ah \n\ -jne 1b \n\ -" - :"=t"(retval) - :"0"(x), "u"(y) - :"cc", "ax"); - return retval; + assert(StubRoutines::fmod() != nullptr, ""); + jdouble (*addr)(jdouble, jdouble) = (double (*)(double, double))StubRoutines::fmod(); + + return (*addr)(x, y); JRT_END -#endif // TARGET_COMPILER_gcc && !_WIN64 diff --git a/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp b/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp index 2a52fa200c94..15e9ba59c9ce 100644 --- a/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp +++ b/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp @@ -3896,9 +3896,59 @@ address StubGenerator::generate_throw_exception(const char* name, return stub->entry_point(); } +address StubGenerator::generate_lookup_secondary_supers_table_stub(u1 super_klass_index) { + StubCodeMark mark(this, "StubRoutines", "lookup_secondary_supers_table"); + + address start = __ pc(); + + const Register + r_super_klass = rax, + r_sub_klass = rsi, + result = rdi; + + __ lookup_secondary_supers_table(r_sub_klass, r_super_klass, + rdx, rcx, rbx, r11, // temps + result, + super_klass_index); + __ ret(0); + + return start; +} + +// Slow path implementation for UseSecondarySupersTable. +address StubGenerator::generate_lookup_secondary_supers_table_slow_path_stub() { + StubCodeMark mark(this, "StubRoutines", "lookup_secondary_supers_table"); + + address start = __ pc(); + + const Register + r_super_klass = rax, + r_array_base = rbx, + r_array_index = rdx, + r_sub_klass = rsi, + r_bitmap = r11, + result = rdi; + + Label L_success; + __ lookup_secondary_supers_table_slow_path(r_super_klass, r_array_base, r_array_index, r_bitmap, + rcx, rdi, // temps + &L_success); + // bind(L_failure); + __ movl(result, 1); + __ ret(0); + + __ bind(L_success); + __ movl(result, 0); + __ ret(0); + + return start; +} + void StubGenerator::create_control_words() { // Round to nearest, 64-bit mode, exceptions masked StubRoutines::x86::_mxcsr_std = 0x1F80; + // Round to zero, 64-bit mode, exceptions masked + StubRoutines::x86::_mxcsr_rz = 0x7F80; } // Initialization @@ -3980,6 +4030,8 @@ void StubGenerator::generate_initial_stubs() { } generate_libm_stubs(); + + StubRoutines::_fmod = generate_libmFmod(); // from stubGenerator_x86_64_fmod.cpp } void StubGenerator::generate_continuation_stubs() { @@ -4168,6 +4220,14 @@ void StubGenerator::generate_compiler_stubs() { StubRoutines::_bigIntegerRightShiftWorker = generate_bigIntegerRightShift(); StubRoutines::_bigIntegerLeftShiftWorker = generate_bigIntegerLeftShift(); } + if (UseSecondarySupersTable) { + StubRoutines::_lookup_secondary_supers_table_slow_path_stub = generate_lookup_secondary_supers_table_slow_path_stub(); + if (! InlineSecondarySupersTest) { + for (int slot = 0; slot < Klass::SECONDARY_SUPERS_TABLE_SIZE; slot++) { + StubRoutines::_lookup_secondary_supers_table_stubs[slot] = generate_lookup_secondary_supers_table_stub(slot); + } + } + } if (UseMontgomeryMultiplyIntrinsic) { StubRoutines::_montgomeryMultiply = CAST_FROM_FN_PTR(address, SharedRuntime::montgomery_multiply); @@ -4240,6 +4300,7 @@ void StubGenerator::generate_compiler_stubs() { StubRoutines::_vector_d_math[VectorSupport::VEC_SIZE_256][op] = (address)os::dll_lookup(libjsvml, ebuf); } } + #endif // COMPILER2 #endif // COMPILER2_OR_JVMCI } diff --git a/src/hotspot/cpu/x86/stubGenerator_x86_64.hpp b/src/hotspot/cpu/x86/stubGenerator_x86_64.hpp index 94545965fc9e..0e813681fcf2 100644 --- a/src/hotspot/cpu/x86/stubGenerator_x86_64.hpp +++ b/src/hotspot/cpu/x86/stubGenerator_x86_64.hpp @@ -487,6 +487,7 @@ class StubGenerator: public StubCodeGenerator { address generate_libmPow(); address generate_libmLog(); address generate_libmLog10(); + address generate_libmFmod(); // Shared constants static address ZERO; @@ -549,6 +550,12 @@ class StubGenerator: public StubCodeGenerator { Register arg1 = noreg, Register arg2 = noreg); + // Specialized stub implementations for UseSecondarySupersTable. + address generate_lookup_secondary_supers_table_stub(u1 super_klass_index); + + // Slow path implementation for UseSecondarySupersTable. + address generate_lookup_secondary_supers_table_slow_path_stub(); + void create_control_words(); // Initialization diff --git a/src/hotspot/cpu/x86/stubGenerator_x86_64_fmod.cpp b/src/hotspot/cpu/x86/stubGenerator_x86_64_fmod.cpp new file mode 100644 index 000000000000..26b5b594424d --- /dev/null +++ b/src/hotspot/cpu/x86/stubGenerator_x86_64_fmod.cpp @@ -0,0 +1,527 @@ +/* + * Copyright (c) 2023, Intel Corporation. All rights reserved. + * Intel Math Library (LIBM) Source Code + * + * 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 "macroAssembler_x86.hpp" +#include "stubGenerator_x86_64.hpp" +#include "runtime/stubRoutines.hpp" + +/******************************************************************************/ +// ALGORITHM DESCRIPTION - FMOD() +// --------------------- +// +// If either value1 or value2 is NaN, the result is NaN. +// +// If neither value1 nor value2 is NaN, the sign of the result equals the sign of the dividend. +// +// If the dividend is an infinity or the divisor is a zero or both, the result is NaN. +// +// If the dividend is finite and the divisor is an infinity, the result equals the dividend. +// +// If the dividend is a zero and the divisor is finite, the result equals the dividend. +// +// In the remaining cases, where neither operand is an infinity, a zero, or NaN, the floating-point +// remainder result from a dividend value1 and a divisor value2 is defined by the mathematical +// relation result = value1 - (value2 * q), where q is an integer that is negative only if +// value1 / value2 is negative, and positive only if value1 / value2 is positive, and whose magnitude +// is as large as possible without exceeding the magnitude of the true mathematical quotient of value1 and value2. +// +/******************************************************************************/ + +#define __ _masm-> + +ATTRIBUTE_ALIGNED(32) static const uint64_t CONST_NaN[] = { + 0x7FFFFFFFFFFFFFFFULL, 0x7FFFFFFFFFFFFFFFULL // NaN vector +}; +ATTRIBUTE_ALIGNED(32) static const uint64_t CONST_1p260[] = { + 0x5030000000000000ULL, // 0x1p+260 +}; + +ATTRIBUTE_ALIGNED(32) static const uint64_t CONST_MAX[] = { + 0x7FEFFFFFFFFFFFFFULL, // Max +}; + +ATTRIBUTE_ALIGNED(32) static const uint64_t CONST_INF[] = { + 0x7FF0000000000000ULL, // Inf +}; + +ATTRIBUTE_ALIGNED(32) static const uint64_t CONST_e307[] = { + 0x7FE0000000000000ULL +}; + +address StubGenerator::generate_libmFmod() { + __ align(CodeEntryAlignment); + StubCodeMark mark(this, "StubRoutines", "libmFmod"); + address start = __ pc(); + __ enter(); // required for proper stackwalking of RuntimeStub frame + + if (VM_Version::supports_avx512vlbwdq()) { // AVX512 version + + // Source used to generate the AVX512 fmod assembly below: + // + // #include + // #include + // #pragma float_control(precise, on) + // + // #define UINT32 unsigned int + // #define SINT32 int + // #define UINT64 unsigned __int64 + // #define SINT64 __int64 + // + // #define DP_FMA(a, b, c) __fence(_mm_cvtsd_f64(_mm_fmadd_sd(_mm_set_sd(a), _mm_set_sd(b), _mm_set_sd(c)))) + // #define DP_FMA_RN(a, b, c) _mm_cvtsd_f64(_mm_fmadd_round_sd(_mm_set_sd(a), _mm_set_sd(b), _mm_set_sd(c), (_MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC))) + // #define DP_FMA_RZ(a, b, c) __fence(_mm_cvtsd_f64(_mm_fmadd_round_sd(_mm_set_sd(a), _mm_set_sd(b), _mm_set_sd(c), (_MM_FROUND_TO_ZERO | _MM_FROUND_NO_EXC)))) + // + // #define DP_ROUND_RZ(a) _mm_cvtsd_f64(_mm_roundscale_sd(_mm_setzero_pd(), _mm_set_sd(a), (_MM_FROUND_TO_ZERO | _MM_FROUND_NO_EXC))) + // + // #define DP_CONST(C) _castu64_f64(0x##C##ull) + // #define DP_AND(X, Y) _mm_cvtsd_f64(_mm_and_pd(_mm_set_sd(X), _mm_set_sd(Y))) + // #define DP_XOR(X, Y) _mm_cvtsd_f64(_mm_xor_pd(_mm_set_sd(X), _mm_set_sd(Y))) + // #define DP_OR(X, Y) _mm_cvtsd_f64(_mm_or_pd(_mm_set_sd(X), _mm_set_sd(Y))) + // #define DP_DIV_RZ(a, b) __fence(_mm_cvtsd_f64(_mm_div_round_sd(_mm_set_sd(a), _mm_set_sd(b), (_MM_FROUND_TO_ZERO | _MM_FROUND_NO_EXC)))) + // #define DP_FNMA(a, b, c) __fence(_mm_cvtsd_f64(_mm_fnmadd_sd(_mm_set_sd(a), _mm_set_sd(b), _mm_set_sd(c)))) + // #define DP_FNMA_RZ(a, b, c) __fence(_mm_cvtsd_f64(_mm_fnmadd_round_sd(_mm_set_sd(a), _mm_set_sd(b), _mm_set_sd(c), (_MM_FROUND_TO_ZERO | _MM_FROUND_NO_EXC)))) + // + // #define D2L(x) _mm_castpd_si128(x) + // // transfer highest 32 bits (of low 64b) to GPR + // #define TRANSFER_HIGH_INT32(X) _mm_extract_epi32(D2L(_mm_set_sd(X)), 1) + // + // double fmod(double x, double y) + // { + // double a, b, sgn_a, q, bs, bs2; + // unsigned eq; + + Label L_5280, L_52a0, L_5256, L_5300, L_5320, L_52c0, L_52d0, L_5360, L_5380, L_53b0, L_5390; + Label L_53c0, L_52a6, L_53d0, L_exit; + + __ movdqa(xmm2, xmm0); + // // |x|, |y| + // a = DP_AND(x, DP_CONST(7fffffffffffffff)); + __ movq(xmm0, xmm0); + __ mov64(rax, 0x7FFFFFFFFFFFFFFFULL); + __ evpbroadcastq(xmm3, rax, Assembler::AVX_128bit); + __ vpand(xmm6, xmm0, xmm3, Assembler::AVX_128bit); + // b = DP_AND(y, DP_CONST(7fffffffffffffff)); + __ vpand(xmm4, xmm1, xmm3, Assembler::AVX_128bit); + // // sign(x) + // sgn_a = DP_XOR(x, a); + __ vpxor(xmm3, xmm6, xmm0, Assembler::AVX_128bit); + // q = DP_DIV_RZ(a, b); + __ movq(xmm5, xmm4); + __ evdivsd(xmm0, xmm6, xmm5, Assembler::EVEX_RZ); + // q = DP_ROUND_RZ(q); + __ movq(xmm0, xmm0); + // a = DP_AND(x, DP_CONST(7fffffffffffffff)); + __ vxorpd(xmm7, xmm7, xmm7, Assembler::AVX_128bit); + // q = DP_ROUND_RZ(q); + __ vroundsd(xmm0, xmm7, xmm0, 0xb); + // eq = TRANSFER_HIGH_INT32(q); + __ extractps(rax, xmm0, 1); + // if (!eq) return x + sgn_a; + __ testl(rax, rax); + __ jcc(Assembler::equal, L_5280); + // if (eq >= 0x7fefffffu) goto SPECIAL_FMOD; + __ cmpl(rax, 0x7feffffe); + __ jcc(Assembler::belowEqual, L_52a0); + __ vpxor(xmm2, xmm2, xmm2, Assembler::AVX_128bit); + // SPECIAL_FMOD: + // + // // y==0 or x==Inf? + // if ((b == 0.0) || (!(a <= DP_CONST(7fefffffffffffff)))) + __ ucomisd(xmm4, xmm2); + __ jcc(Assembler::notEqual, L_5256); + __ jcc(Assembler::noParity, L_5300); + __ bind(L_5256); + __ movsd(xmm2, ExternalAddress((address)CONST_MAX), rax); + __ ucomisd(xmm2, xmm6); + __ jcc(Assembler::below, L_5300); + __ movsd(xmm0, ExternalAddress((address)CONST_INF), rax); + // return DP_FNMA(b, q, a); // NaN + // // y is NaN? + // if (!(b <= DP_CONST(7ff0000000000000))) return y + y; + __ ucomisd(xmm0, xmm4); + __ jcc(Assembler::aboveEqual, L_5320); + __ vaddsd(xmm0, xmm1, xmm1); + __ jmp(L_exit); + // if (!eq) return x + sgn_a; + __ align32(); + __ bind(L_5280); + __ vaddsd(xmm0, xmm3, xmm2); + __ jmp(L_exit); + // a = DP_FNMA_RZ(b, q, a); + __ align(8); + __ bind(L_52a0); + __ evfnmadd213sd(xmm0, xmm4, xmm6, Assembler::EVEX_RZ); + // while (b <= a) + __ bind(L_52a6); + __ ucomisd(xmm0, xmm4); + __ jcc(Assembler::aboveEqual, L_52c0); + // a = DP_XOR(a, sgn_a); + __ vpxor(xmm0, xmm3, xmm0, Assembler::AVX_128bit); + __ jmp(L_exit); + __ bind(L_52c0); + __ movq(xmm6, xmm0); + // q = DP_ROUND_RZ(q); + __ vpxor(xmm1, xmm1, xmm1, Assembler::AVX_128bit); + __ align32(); + __ bind(L_52d0); + // q = DP_DIV_RZ(a, b); + __ evdivsd(xmm2, xmm6, xmm5, Assembler::EVEX_RZ); + // q = DP_ROUND_RZ(q); + __ movq(xmm2, xmm2); + __ vroundsd(xmm2, xmm1, xmm2, 0xb); + // a = DP_FNMA_RZ(b, q, a); + __ evfnmadd213sd(xmm2, xmm4, xmm0, Assembler::EVEX_RZ); + // while (b <= a) + __ ucomisd(xmm2, xmm4); + __ movq(xmm6, xmm2); + __ movapd(xmm0, xmm2); + __ jcc(Assembler::aboveEqual, L_52d0); + // a = DP_XOR(a, sgn_a); + __ vpxor(xmm0, xmm3, xmm2, Assembler::AVX_128bit); + __ jmp(L_exit); + // return DP_FNMA(b, q, a); // NaN + __ bind(L_5300); + __ vfnmadd213sd(xmm0, xmm4, xmm6); + __ jmp(L_exit); + // bs = b * DP_CONST(7fe0000000000000); + __ bind(L_5320); + __ vmulsd(xmm1, xmm4, ExternalAddress((address)CONST_e307), rax); + // q = DP_DIV_RZ(a, bs); + __ movq(xmm2, xmm1); + __ evdivsd(xmm0, xmm6, xmm2, Assembler::EVEX_RZ); + // q = DP_ROUND_RZ(q); + __ movq(xmm0, xmm0); + __ vroundsd(xmm7, xmm7, xmm0, 0xb); + // eq = TRANSFER_HIGH_INT32(q); + __ extractps(rax, xmm7, 1); + // if (eq >= 0x7fefffffu) + __ cmpl(rax, 0x7fefffff); + __ jcc(Assembler::below, L_5360); + // // b* 2*1023 * 2^1023 + // bs2 = bs * DP_CONST(7fe0000000000000); + __ vmulsd(xmm0, xmm1, ExternalAddress((address)CONST_e307), rax); + // while (bs2 <= a) + __ ucomisd(xmm6, xmm0); + __ jcc(Assembler::aboveEqual, L_5380); + __ movapd(xmm7, xmm6); + __ jmp(L_53b0); + // a = DP_FNMA_RZ(b, q, a); + __ bind(L_5360); + __ evfnmadd213sd(xmm7, xmm1, xmm6, Assembler::EVEX_RZ); + __ jmp(L_53b0); + // q = DP_ROUND_RZ(q); + __ bind(L_5380); + __ vxorpd(xmm8, xmm8, xmm8, Assembler::AVX_128bit); + // q = DP_DIV_RZ(qa, bs2); + __ align32(); + __ bind(L_5390); + __ evdivsd(xmm7, xmm6, xmm0, Assembler::EVEX_RZ); + // q = DP_ROUND_RZ(q); + __ movq(xmm7, xmm7); + __ vroundsd(xmm7, xmm8, xmm7, 0xb); + // a = DP_FNMA_RZ(bs2, q, a); + __ evfnmadd213sd(xmm7, xmm0, xmm6, Assembler::EVEX_RZ); + // while (bs2 <= a) + __ ucomisd(xmm7, xmm0); + __ movapd(xmm6, xmm7); + __ jcc(Assembler::aboveEqual, L_5390); + // while (bs <= a) + __ bind(L_53b0); + __ ucomisd(xmm7, xmm1); + __ jcc(Assembler::aboveEqual, L_53c0); + __ movapd(xmm0, xmm7); + __ jmp(L_52a6); + // q = DP_ROUND_RZ(q); + __ bind(L_53c0); + __ vxorpd(xmm6, xmm6, xmm6, Assembler::AVX_128bit); + // q = DP_DIV_RZ(a, bs); + __ align32(); + __ bind(L_53d0); + __ evdivsd(xmm0, xmm7, xmm2, Assembler::EVEX_RZ); + // q = DP_ROUND_RZ(q); + __ movq(xmm0, xmm0); + __ vroundsd(xmm0, xmm6, xmm0, 0xb); + // a = DP_FNMA_RZ(bs, q, a); + __ evfnmadd213sd(xmm0, xmm1, xmm7, Assembler::EVEX_RZ); + // while (bs <= a) + __ ucomisd(xmm0, xmm1); + __ movapd(xmm7, xmm0); + __ jcc(Assembler::aboveEqual, L_53d0); + __ jmp(L_52a6); + + __ bind(L_exit); + +//////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////// +// AVX2 code +//////////////////////////////////////////////////////////////////////////////////////// +//////////////////////////////////////////////////////////////////////////////////////// + } else if (VM_Version::supports_fma()) { // AVX2 version + + Label L_104a, L_11bd, L_10c1, L_1090, L_11b9, L_10e7, L_11af, L_111c, L_10f3, L_116e, L_112a; + Label L_1173, L_1157, L_117f, L_11a0; + + // double fmod(double x, double y) + // { + // double a, b, sgn_a, q, bs, bs2, corr, res; + // unsigned eq; + + // // |x|, |y| + // a = DP_AND(x, DP_CONST(7fffffffffffffff)); + __ movq(xmm2, xmm0); + __ movdqu(xmm3, ExternalAddress((address)CONST_NaN), rcx); + __ vpand(xmm4, xmm2, xmm3, Assembler::AVX_128bit); + // b = DP_AND(y, DP_CONST(7fffffffffffffff)); + __ vpand(xmm3, xmm1, xmm3, Assembler::AVX_128bit); + // // sign(x) + // sgn_a = DP_XOR(x, a); + __ mov64(rcx, 0x8000000000000000ULL); + __ movq(xmm5, rcx); + __ vpand(xmm2, xmm2, xmm5, Assembler::AVX_128bit); + + // if (a < b) return x + sgn_a; + __ ucomisd(xmm3, xmm4); + __ jccb(Assembler::belowEqual, L_104a); + __ vaddsd(xmm0, xmm2, xmm0); + __ jmp(L_11bd); + + // if (a < b * 0x1p+260) + __ bind(L_104a); + + __ vmulsd(xmm0, xmm3, ExternalAddress((address)CONST_1p260), rax); + __ ucomisd(xmm0, xmm4); + __ jccb(Assembler::belowEqual, L_10c1); + // { + // q = DP_DIV(a, b); + __ vdivpd(xmm0, xmm4, xmm3, Assembler::AVX_128bit); + // corr = DP_SHR(DP_FNMA(b, q, a), 63); + __ movapd(xmm1, xmm0); + __ vfnmadd213sd(xmm1, xmm3, xmm4); + __ movq(xmm5, xmm1); + __ vpxor(xmm1, xmm1, xmm1, Assembler::AVX_128bit); + __ vpcmpgtq(xmm5, xmm1, xmm5, Assembler::AVX_128bit); + // q = DP_PSUBQ(q, corr); + __ vpaddq(xmm0, xmm5, xmm0, Assembler::AVX_128bit); + // q = DP_TRUNC(q); + __ vroundsd(xmm0, xmm0, xmm0, 3); + // a = DP_FNMA(b, q, a); + __ vfnmadd213sd(xmm0, xmm3, xmm4); + __ align(16); + // while (b <= a) + __ bind(L_1090); + __ ucomisd(xmm0, xmm3); + __ jcc(Assembler::below, L_11b9); + // { + // q = DP_DIV(a, b); + __ vdivsd(xmm4, xmm0, xmm3); + // corr = DP_SHR(DP_FNMA(b, q, a), 63); + __ movapd(xmm5, xmm4); + __ vfnmadd213sd(xmm5, xmm3, xmm0); + __ movq(xmm5, xmm5); + __ vpcmpgtq(xmm5, xmm1, xmm5, Assembler::AVX_128bit); + // q = DP_PSUBQ(q, corr); + __ vpaddq(xmm4, xmm5, xmm4, Assembler::AVX_128bit); + // q = DP_TRUNC(q); + __ vroundsd(xmm4, xmm4, xmm4, 3); + // a = DP_FNMA(b, q, a); + __ vfnmadd231sd(xmm0, xmm3, xmm4); + __ jmpb(L_1090); + // } + // return DP_XOR(a, sgn_a); + // } + + // __asm { ldmxcsr DWORD PTR [mxcsr_rz] } + __ bind(L_10c1); + __ ldmxcsr(ExternalAddress(StubRoutines::x86::addr_mxcsr_rz()), rax /*rscratch*/); + + // q = DP_DIV(a, b); + __ vdivpd(xmm0, xmm4, xmm3, Assembler::AVX_128bit); + // q = DP_TRUNC(q); + __ vroundsd(xmm0, xmm0, xmm0, 3); + + // eq = TRANSFER_HIGH_INT32(q); + __ extractps(rax, xmm0, 1); + + // if (__builtin_expect((eq >= 0x7fefffffu), (0==1))) goto SPECIAL_FMOD; + __ cmpl(rax, 0x7feffffe); + __ jccb(Assembler::above, L_10e7); + + // a = DP_FNMA(b, q, a); + __ vfnmadd213sd(xmm0, xmm3, xmm4); + __ jmp(L_11af); + + // SPECIAL_FMOD: + + // // y==0 or x==Inf? + // if ((b == 0.0) || (!(a <= DP_CONST(7fefffffffffffff)))) + __ bind(L_10e7); + __ vpxor(xmm5, xmm5, xmm5, Assembler::AVX_128bit); + __ ucomisd(xmm3, xmm5); + __ jccb(Assembler::notEqual, L_10f3); + __ jccb(Assembler::noParity, L_111c); + + __ bind(L_10f3); + __ movsd(xmm5, ExternalAddress((address)CONST_MAX), rax); + __ ucomisd(xmm5, xmm4); + __ jccb(Assembler::below, L_111c); + // return res; + // } + // // y is NaN? + // if (!(b <= DP_CONST(7ff0000000000000))) { + __ movsd(xmm0, ExternalAddress((address)CONST_INF), rax); + __ ucomisd(xmm0, xmm3); + __ jccb(Assembler::aboveEqual, L_112a); + // res = y + y; + __ vaddsd(xmm0, xmm1, xmm1); + // __asm { ldmxcsr DWORD PTR[mxcsr] } + __ ldmxcsr(ExternalAddress(StubRoutines::x86::addr_mxcsr_std()), rax /*rscratch*/); + __ jmp(L_11bd); + // { + // res = DP_FNMA(b, q, a); // NaN + __ bind(L_111c); + __ vfnmadd213sd(xmm0, xmm3, xmm4); + // __asm { ldmxcsr DWORD PTR[mxcsr] } + __ ldmxcsr(ExternalAddress(StubRoutines::x86::addr_mxcsr_std()), rax /*rscratch*/); + __ jmp(L_11bd); + // return res; + // } + + // // b* 2*1023 + // bs = b * DP_CONST(7fe0000000000000); + __ bind(L_112a); + __ vmulsd(xmm1, xmm3, ExternalAddress((address)CONST_e307), rax); + + // q = DP_DIV(a, bs); + __ vdivsd(xmm0, xmm4, xmm1); + // q = DP_TRUNC(q); + __ vroundsd(xmm0, xmm0, xmm0, 3); + + // eq = TRANSFER_HIGH_INT32(q); + __ extractps(rax, xmm0, 1); + + // if (eq >= 0x7fefffffu) + __ cmpl(rax, 0x7fefffff); + __ jccb(Assembler::below, L_116e); + // { + // // b* 2*1023 * 2^1023 + // bs2 = bs * DP_CONST(7fe0000000000000); + __ vmulsd(xmm0, xmm1, ExternalAddress((address)CONST_e307), rax); + // while (bs2 <= a) + __ ucomisd(xmm4, xmm0); + __ jccb(Assembler::below, L_1173); + // { + // q = DP_DIV(a, bs2); + __ bind(L_1157); + __ vdivsd(xmm5, xmm4, xmm0); + // q = DP_TRUNC(q); + __ vroundsd(xmm5, xmm5, xmm5, 3); + // a = DP_FNMA(bs2, q, a); + __ vfnmadd231sd(xmm4, xmm0, xmm5); + // while (bs2 <= a) + __ ucomisd(xmm4, xmm0); + __ jccb(Assembler::aboveEqual, L_1157); + __ jmpb(L_1173); + // } + // } + // else + // a = DP_FNMA(bs, q, a); + __ bind(L_116e); + __ vfnmadd231sd(xmm4, xmm1, xmm0); + + // while (bs <= a) + __ bind(L_1173); + __ ucomisd(xmm4, xmm1); + __ jccb(Assembler::aboveEqual, L_117f); + __ movapd(xmm0, xmm4); + __ jmpb(L_11af); + // { + // q = DP_DIV(a, bs); + __ bind(L_117f); + __ vdivsd(xmm0, xmm4, xmm1); + // q = DP_TRUNC(q); + __ vroundsd(xmm0, xmm0, xmm0, 3); + // a = DP_FNMA(bs, q, a); + __ vfnmadd213sd(xmm0, xmm1, xmm4); + + // while (bs <= a) + __ ucomisd(xmm0, xmm1); + __ movapd(xmm4, xmm0); + __ jccb(Assembler::aboveEqual, L_117f); + __ jmpb(L_11af); + __ align(16); + // { + // q = DP_DIV(a, b); + __ bind(L_11a0); + __ vdivsd(xmm1, xmm0, xmm3); + // q = DP_TRUNC(q); + __ vroundsd(xmm1, xmm1, xmm1, 3); + // a = DP_FNMA(b, q, a); + __ vfnmadd231sd(xmm0, xmm3, xmm1); + + // FMOD_CONT: + // while (b <= a) + __ bind(L_11af); + __ ucomisd(xmm0, xmm3); + __ jccb(Assembler::aboveEqual, L_11a0); + // } + + // __asm { ldmxcsr DWORD PTR[mxcsr] } + __ ldmxcsr(ExternalAddress(StubRoutines::x86::addr_mxcsr_std()), rax /*rscratch*/); + __ bind(L_11b9); + __ vpxor(xmm0, xmm2, xmm0, Assembler::AVX_128bit); + // } + + // goto FMOD_CONT; + + // } + __ bind(L_11bd); + + } else { // SSE version + Label x87_loop; + __ movsd(Address(rbp, -8), xmm1); + __ movsd(Address(rbp, -16), xmm0); + __ fld_d(Address(rbp, -8)); + __ fld_d(Address(rbp, -16)); + + __ bind(x87_loop); + __ fprem(); + __ fnstsw_ax(); + __ testb(rax, 0x4, false); + __ jcc(Assembler::notZero, x87_loop); + + __ fstp_d(1); + __ fstp_d(Address(rbp, -8)); + __ movsd(xmm0, Address(rbp, -8)); + } + + __ leave(); // required for proper stackwalking of RuntimeStub frame + __ ret(0); + + return start; +} + +#undef __ diff --git a/src/hotspot/cpu/x86/stubRoutines_x86.hpp b/src/hotspot/cpu/x86/stubRoutines_x86.hpp index 2038fdff5ae4..a5246860c0f6 100644 --- a/src/hotspot/cpu/x86/stubRoutines_x86.hpp +++ b/src/hotspot/cpu/x86/stubRoutines_x86.hpp @@ -126,6 +126,9 @@ class x86 { private: static jint _mxcsr_std; +#ifdef _LP64 + static jint _mxcsr_rz; +#endif // _LP64 static address _verify_mxcsr_entry; @@ -207,6 +210,9 @@ class x86 { public: static address addr_mxcsr_std() { return (address)&_mxcsr_std; } +#ifdef _LP64 + static address addr_mxcsr_rz() { return (address)&_mxcsr_rz; } +#endif // _LP64 static address verify_mxcsr_entry() { return _verify_mxcsr_entry; } static address crc_by128_masks_addr() { return (address)_crc_by128_masks; } #ifdef _LP64 diff --git a/src/hotspot/cpu/x86/stubRoutines_x86_64.cpp b/src/hotspot/cpu/x86/stubRoutines_x86_64.cpp index b4d96473c37c..4287580e7f92 100644 --- a/src/hotspot/cpu/x86/stubRoutines_x86_64.cpp +++ b/src/hotspot/cpu/x86/stubRoutines_x86_64.cpp @@ -32,6 +32,7 @@ // a description of how to extend it, see the stubRoutines.hpp file. jint StubRoutines::x86::_mxcsr_std = 0; +jint StubRoutines::x86::_mxcsr_rz = 0; address StubRoutines::x86::_get_previous_sp_entry = nullptr; diff --git a/src/hotspot/cpu/x86/vm_version_x86.hpp b/src/hotspot/cpu/x86/vm_version_x86.hpp index cb9e806999b8..98b81267dd2f 100644 --- a/src/hotspot/cpu/x86/vm_version_x86.hpp +++ b/src/hotspot/cpu/x86/vm_version_x86.hpp @@ -762,6 +762,11 @@ class VM_Version : public Abstract_VM_Version { return LP64_ONLY(true) NOT_LP64(false); // not implemented on x86_32 } + // x86_64 supports secondary supers table + constexpr static bool supports_secondary_supers_table() { + return LP64_ONLY(true) NOT_LP64(false); // not implemented on x86_32 + } + constexpr static bool supports_stack_watermark_barrier() { return true; } diff --git a/src/hotspot/cpu/x86/x86_64.ad b/src/hotspot/cpu/x86/x86_64.ad index bd64c981b1bd..3eefda043e9d 100644 --- a/src/hotspot/cpu/x86/x86_64.ad +++ b/src/hotspot/cpu/x86/x86_64.ad @@ -296,6 +296,9 @@ reg_class long_rcx_reg(RCX, RCX_H); // Singleton class for RDX long register reg_class long_rdx_reg(RDX, RDX_H); +// Singleton class for R11 long register +reg_class long_r11_reg(R11, R11_H); + // Singleton class for RAX int register reg_class int_rax_reg(RAX); @@ -3724,6 +3727,16 @@ operand rdx_RegL() interface(REG_INTER); %} +operand r11_RegL() +%{ + constraint(ALLOC_IN_RC(long_r11_reg)); + match(RegL); + match(rRegL); + + format %{ %} + interface(REG_INTER); +%} + operand no_rbp_r13_RegL() %{ constraint(ALLOC_IN_RC(long_no_rbp_r13_reg)); @@ -13121,6 +13134,31 @@ instruct partialSubtypeCheck(rdi_RegP result, ins_pipe(pipe_slow); %} +instruct partialSubtypeCheckConstSuper(rsi_RegP sub, rax_RegP super_reg, immP super_con, rdi_RegP result, + rdx_RegL temp1, rcx_RegL temp2, rbx_RegP temp3, r11_RegL temp4, + rFlagsReg cr) +%{ + match(Set result (PartialSubtypeCheck sub (Binary super_reg super_con))); + predicate(UseSecondarySupersTable); + effect(KILL cr, TEMP temp1, TEMP temp2, TEMP temp3, TEMP temp4); + + ins_cost(700); // smaller than the next version + format %{ "partialSubtypeCheck $result, $sub, super" %} + + ins_encode %{ + u1 super_klass_slot = ((Klass*)$super_con$$constant)->hash_slot(); + if (InlineSecondarySupersTest) { + __ lookup_secondary_supers_table($sub$$Register, $super_reg$$Register, $temp1$$Register, $temp2$$Register, + $temp3$$Register, $temp4$$Register, $result$$Register, + super_klass_slot); + } else { + __ call(RuntimeAddress(StubRoutines::lookup_secondary_supers_table_stub(super_klass_slot))); + } + %} + + ins_pipe(pipe_slow); +%} + instruct partialSubtypeCheck_vs_Zero(rFlagsReg cr, rsi_RegP sub, rax_RegP super, rcx_RegI rcx, immP0 zero, diff --git a/src/hotspot/os/aix/os_aix.cpp b/src/hotspot/os/aix/os_aix.cpp index 032c9ca5a23b..83276dfb062e 100644 --- a/src/hotspot/os/aix/os_aix.cpp +++ b/src/hotspot/os/aix/os_aix.cpp @@ -901,13 +901,6 @@ bool os::create_attached_thread(JavaThread* thread) { thread->set_osthread(osthread); - if (UseNUMA) { - int lgrp_id = os::numa_get_group_id(); - if (lgrp_id != -1) { - thread->set_lgrp_id(lgrp_id); - } - } - // initialize signal mask for this thread // and save the caller's signal mask PosixSignals::hotspot_sigmask(thread); diff --git a/src/hotspot/os/aix/os_perf_aix.cpp b/src/hotspot/os/aix/os_perf_aix.cpp index f4e13374fd7c..0e808d22045d 100644 --- a/src/hotspot/os/aix/os_perf_aix.cpp +++ b/src/hotspot/os/aix/os_perf_aix.cpp @@ -73,7 +73,7 @@ enum { * Get info for requested PID from /proc//psinfo file */ static bool read_psinfo(const u_longlong_t& pid, psinfo_t& psinfo) { - static size_t BUF_LENGTH = 32 + sizeof(u_longlong_t); + const size_t BUF_LENGTH = 32 + sizeof(u_longlong_t); FILE* fp; char buf[BUF_LENGTH]; diff --git a/src/hotspot/os/bsd/os_bsd.cpp b/src/hotspot/os/bsd/os_bsd.cpp index 5363bea6493e..155920e0a5a2 100644 --- a/src/hotspot/os/bsd/os_bsd.cpp +++ b/src/hotspot/os/bsd/os_bsd.cpp @@ -203,11 +203,13 @@ static char cpu_arch[] = "ppc"; #error Add appropriate cpu_arch setting #endif -// Compiler variant -#ifdef COMPILER2 - #define COMPILER_VARIANT "server" +// JVM variant +#if defined(ZERO) + #define JVM_VARIANT "zero" +#elif defined(COMPILER2) + #define JVM_VARIANT "server" #else - #define COMPILER_VARIANT "client" + #define JVM_VARIANT "client" #endif @@ -1503,10 +1505,10 @@ void os::jvm_path(char *buf, jint buflen) { snprintf(jrelib_p, buflen-len, "/lib"); } - // Add the appropriate client or server subdir + // Add the appropriate JVM variant subdir len = strlen(buf); jrelib_p = buf + len; - snprintf(jrelib_p, buflen-len, "/%s", COMPILER_VARIANT); + snprintf(jrelib_p, buflen-len, "/%s", JVM_VARIANT); if (0 != access(buf, F_OK)) { snprintf(jrelib_p, buflen-len, "%s", ""); } @@ -2492,7 +2494,9 @@ void os::jfr_report_memory_info() { // Send the RSS JFR event EventResidentSetSize event; event.set_size(info.resident_size); - event.set_peak(info.resident_size_max); + // We've seen that resident_size_max sometimes trails resident_size with one page. + // Make sure we always report size <= peak + event.set_peak(MAX2(info.resident_size_max, info.resident_size)); event.commit(); } else { // Log a warning diff --git a/src/hotspot/os/linux/memMapPrinter_linux.cpp b/src/hotspot/os/linux/memMapPrinter_linux.cpp new file mode 100644 index 000000000000..0b696b9914ef --- /dev/null +++ b/src/hotspot/os/linux/memMapPrinter_linux.cpp @@ -0,0 +1,189 @@ +/* + * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2024, Red Hat, Inc. and/or its affiliates. + * 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 "nmt/memMapPrinter.hpp" +#include "procMapsParser.hpp" +#include "runtime/os.hpp" +#include "utilities/align.hpp" +#include "utilities/globalDefinitions.hpp" +#include "utilities/powerOfTwo.hpp" + +#include + +class ProcSmapsSummary { + unsigned _num_mappings; + size_t _vsize; // combined virtual size + size_t _rss; // combined resident set size + size_t _committed; // combined committed size + size_t _shared; // combined shared size + size_t _swapped_out; // combined amount of swapped-out memory + size_t _hugetlb; // combined amount of memory backed by explicit huge pages + size_t _thp; // combined amount of memory backed by THPs +public: + ProcSmapsSummary() : _num_mappings(0), _vsize(0), _rss(0), _committed(0), _shared(0), + _swapped_out(0), _hugetlb(0), _thp(0) {} + void add_mapping(const ProcSmapsInfo& info) { + _num_mappings++; + _vsize += info.vsize(); + _rss += info.rss; + _committed += info.nr ? 0 : info.vsize(); + _shared += info.sh ? info.vsize() : 0; + _swapped_out += info.swap; + _hugetlb += info.private_hugetlb + info.shared_hugetlb; + _thp += info.anonhugepages; + } + + void print_on(const MappingPrintSession& session) const { + outputStream* st = session.out(); + st->print_cr("Number of mappings: %u", _num_mappings); + st->print_cr(" vsize: %zu (" PROPERFMT ")", _vsize, PROPERFMTARGS(_vsize)); + st->print_cr(" rss: %zu (" PROPERFMT ")", _rss, PROPERFMTARGS(_rss)); + st->print_cr(" committed: %zu (" PROPERFMT ")", _committed, PROPERFMTARGS(_committed)); + st->print_cr(" shared: %zu (" PROPERFMT ")", _shared, PROPERFMTARGS(_shared)); + st->print_cr(" swapped out: %zu (" PROPERFMT ")", _swapped_out, PROPERFMTARGS(_swapped_out)); + st->print_cr(" using thp: %zu (" PROPERFMT ")", _thp, PROPERFMTARGS(_thp)); + st->print_cr(" hugetlb: %zu (" PROPERFMT ")", _hugetlb, PROPERFMTARGS(_hugetlb)); + } +}; + +class ProcSmapsPrinter { + const MappingPrintSession& _session; +public: + ProcSmapsPrinter(const MappingPrintSession& session) : + _session(session) + {} + + void print_single_mapping(const ProcSmapsInfo& info) const { + outputStream* st = _session.out(); +#define INDENT_BY(n) \ + if (st->fill_to(n) == 0) { \ + st->print(" "); \ + } + st->print(PTR_FORMAT "-" PTR_FORMAT, p2i(info.from), p2i(info.to)); + INDENT_BY(38); + st->print("%12zu", info.vsize()); + INDENT_BY(51); + st->print("%s", info.prot); + INDENT_BY(56); + st->print("%12zu", info.rss); + INDENT_BY(69); + st->print("%12zu", info.private_hugetlb); + INDENT_BY(82); + st->print(EXACTFMT, EXACTFMTARGS(info.kernelpagesize)); + { + INDENT_BY(87); + int num_printed = 0; +#define PRINTIF(cond, s) \ + if (cond) { \ + st->print("%s%s", (num_printed > 0 ? "," : ""), s); \ + num_printed++; \ + } + PRINTIF(info.sh, "shrd"); + PRINTIF(!info.nr, "com"); + PRINTIF(info.swap > 0, "swap"); + PRINTIF(info.ht, "huge"); + PRINTIF(info.anonhugepages > 0, "thp"); + PRINTIF(info.hg, "thpad"); + PRINTIF(info.nh, "nothp"); + if (num_printed == 0) { + st->print("-"); + } +#undef PRINTIF + } + INDENT_BY(104); + if (!_session.print_nmt_info_for_region(info.from, info.to)) { + st->print("-"); + } + INDENT_BY(142); + st->print_raw(info.filename[0] == '\0' ? "-" : info.filename); + #undef INDENT_BY + st->cr(); + } + + void print_legend() const { + outputStream* st = _session.out(); + st->print_cr("from, to, vsize: address range and size"); + st->print_cr("prot: protection"); + st->print_cr("rss: resident set size"); + st->print_cr("hugetlb: size of private hugetlb pages"); + st->print_cr("pgsz: page size"); + st->print_cr("notes: mapping information (detail mode only)"); + st->print_cr(" shrd: mapping is shared"); + st->print_cr(" com: mapping committed (swap space reserved)"); + st->print_cr(" swap: mapping partly or completely swapped out"); + st->print_cr(" thp: mapping uses THP"); + st->print_cr(" thpad: mapping is THP-madvised"); + st->print_cr(" nothp: mapping is forbidden to use THP"); + st->print_cr(" huge: mapping uses hugetlb pages"); + st->print_cr("vm info: VM information (requires NMT)"); + { + streamIndentor si(st, 16); + _session.print_nmt_flag_legend(); + } + st->print_cr("file: file mapped, if mapping is not anonymous"); + } + + void print_header() const { + outputStream* st = _session.out(); + // 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 + // 012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789 + // 0x0000000414000000-0x0000000453000000 123456789012 rw-p 123456789012 123456789012 16g thp,thpadv STACK-340754-Monitor-Deflation-Thread /shared/tmp.txt + st->print_cr("from to vsize prot rss hugetlb pgsz notes info file"); + st->print_cr("========================================================================================================================================================================"); + } +}; + +void MemMapPrinter::pd_print_all_mappings(const MappingPrintSession& session) { + constexpr char filename[] = "/proc/self/smaps"; + FILE* f = os::fopen(filename, "r"); + if (f == nullptr) { + session.out()->print_cr("Cannot open %s", filename); + return; + } + + ProcSmapsPrinter printer(session); + ProcSmapsSummary summary; + + outputStream* const st = session.out(); + + printer.print_legend(); + st->cr(); + printer.print_header(); + + ProcSmapsInfo info; + ProcSmapsParser parser(f); + while (parser.parse_next(info)) { + printer.print_single_mapping(info); + summary.add_mapping(info); + } + st->cr(); + + summary.print_on(session); + st->cr(); + + ::fclose(f); +} diff --git a/src/hotspot/os/linux/osContainer_linux.cpp b/src/hotspot/os/linux/osContainer_linux.cpp index c70c96c678ac..3f8c352dee3b 100644 --- a/src/hotspot/os/linux/osContainer_linux.cpp +++ b/src/hotspot/os/linux/osContainer_linux.cpp @@ -139,7 +139,7 @@ jlong OSContainer::pids_current() { void OSContainer::print_container_helper(outputStream* st, jlong j, const char* metrics) { st->print("%s: ", metrics); - if (j > 0) { + if (j >= 0) { if (j >= 1024) { st->print_cr(UINT64_FORMAT " k", uint64_t(j) / K); } else { diff --git a/src/hotspot/os/linux/os_linux.cpp b/src/hotspot/os/linux/os_linux.cpp index 7281ec664bd1..b57e2a26e092 100644 --- a/src/hotspot/os/linux/os_linux.cpp +++ b/src/hotspot/os/linux/os_linux.cpp @@ -138,8 +138,6 @@ #define MAX_PATH (2 * K) -#define MAX_SECS 100000000 - // for timer info max values which include all bits #define ALL_64_BITS CONST64(0xFFFFFFFFFFFFFFFF) diff --git a/src/hotspot/os/linux/os_linux.hpp b/src/hotspot/os/linux/os_linux.hpp index 029f2aa7a52d..49f2777d1396 100644 --- a/src/hotspot/os/linux/os_linux.hpp +++ b/src/hotspot/os/linux/os_linux.hpp @@ -30,9 +30,7 @@ // os::Linux defines the interface to Linux operating systems class os::Linux { - friend class CgroupSubsystem; friend class os; - friend class OSContainer; friend class TestReserveMemorySpecial; static int (*_pthread_getcpuclockid)(pthread_t, clockid_t *); @@ -59,7 +57,6 @@ class os::Linux { static julong available_memory(); static julong free_memory(); - static int active_processor_count(); static void initialize_system_info(); @@ -109,6 +106,7 @@ class os::Linux { bool has_steal_ticks; }; + static int active_processor_count(); static void kernel_version(long* major, long* minor); // which_logical_cpu=-1 returns accumulated ticks for all cpus. diff --git a/src/hotspot/os/linux/procMapsParser.cpp b/src/hotspot/os/linux/procMapsParser.cpp new file mode 100644 index 000000000000..6dfd49a0596e --- /dev/null +++ b/src/hotspot/os/linux/procMapsParser.cpp @@ -0,0 +1,125 @@ +/* + * Copyright (c) 2024, Red Hat, Inc. and/or its affiliates. + * Copyright (c) 2024, 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 "procMapsParser.hpp" +#include "runtime/os.hpp" +#include "utilities/globalDefinitions.hpp" + +static bool is_lowercase_hex(char c) { + return (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f'); +} + +static size_t max_mapping_line_len() { + return 100 + // everything but the file name + os::vm_page_size() // the file name (kernel limits /proc/pid/cmdline to one page + ; +} + +ProcSmapsParser::ProcSmapsParser(FILE* f) : + _f(f), _linelen(max_mapping_line_len()), _line(nullptr) { + assert(_f != nullptr, "Invalid file handle given"); + _line = NEW_C_HEAP_ARRAY(char, max_mapping_line_len(), mtInternal); + _line[0] = '\0'; +} + +ProcSmapsParser::~ProcSmapsParser() { + FREE_C_HEAP_ARRAY(char, _line); +} + +bool ProcSmapsParser::read_line() { + _line[0] = '\0'; + return ::fgets(_line, _linelen, _f) != nullptr; +} + +bool ProcSmapsParser::is_header_line() { + // e.g. ffffffffff600000-ffffffffff601000 --xp 00000000 00:00 0 [vsyscall] + return is_lowercase_hex(_line[0]); // All non-header lines in /proc/pid/smaps start with upper-case letters. +} + +void ProcSmapsParser::scan_header_line(ProcSmapsInfo& out) { + const int items_read = ::sscanf(_line, "%p-%p %20s %*s %*s %*s %1024s", + &out.from, &out.to, out.prot, out.filename); + assert(items_read >= 2, "Expected header_line"); +} + +void ProcSmapsParser::scan_additional_line(ProcSmapsInfo& out) { +#define SCAN(key, var) \ + if (::sscanf(_line, key ": %zu kB", &var) == 1) { \ + var *= K; \ + return; \ + } + SCAN("KernelPageSize", out.kernelpagesize); + SCAN("Rss", out.rss); + SCAN("AnonHugePages", out.anonhugepages); + SCAN("Private_Hugetlb", out.private_hugetlb); + SCAN("Shared_Hugetlb", out.shared_hugetlb); + SCAN("Swap", out.swap); + int i = 0; +#undef SCAN + // scan some flags too + if (strncmp(_line, "VmFlags:", 8) == 0) { +#define SCAN(flag) { out.flag = (::strstr(_line + 8, " " #flag) != nullptr); } + SCAN(rd); + SCAN(wr); + SCAN(ex); + SCAN(nr); + SCAN(sh); + SCAN(hg); + SCAN(ht); + SCAN(nh); +#undef SCAN + } +} + +// Starts or continues parsing. Returns true on success, +// false on EOF or on error. +bool ProcSmapsParser::parse_next(ProcSmapsInfo& out) { + + // Information about a single mapping reaches across several lines. + out.reset(); + + // Read header line, unless we already read it + if (_line[0] == '\0') { + if (!read_line()) { + return false; + } + } + assert(is_header_line(), "Not a header line: \"%s\".", _line); + scan_header_line(out); + + // Now read until we encounter the next header line or EOF or an error. + bool ok = false, stop = false; + do { + ok = read_line(); + stop = !ok || is_header_line(); + if (!stop) { + scan_additional_line(out); + } + } while (!stop); + + return ok; +} diff --git a/src/hotspot/os/linux/procMapsParser.hpp b/src/hotspot/os/linux/procMapsParser.hpp new file mode 100644 index 000000000000..0971c4fb084f --- /dev/null +++ b/src/hotspot/os/linux/procMapsParser.hpp @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2024, Red Hat, Inc. and/or its affiliates. + * Copyright (c) 2024, 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 OS_LINUX_PROCMAPSPARSER_HPP +#define OS_LINUX_PROCMAPSPARSER_HPP + +#include "utilities/globalDefinitions.hpp" + +// This header exposes two simple parsers for /proc/pid/maps and +// /proc/pid/smaps. +// +// Usage: +// +// FILE* f = fopen(...) +// ProcSMapsParser parser(f); +// ProcSMapsInfo info; +// while (parser.parse_next(info)) { ... } + +struct ProcSmapsInfo { + void* from; + void* to; + char prot[20 + 1]; + char filename[1024 + 1]; + size_t kernelpagesize; + size_t rss; + size_t private_hugetlb; + size_t shared_hugetlb; + size_t anonhugepages; + size_t swap; + bool rd, wr, ex; + bool sh; // shared + bool nr; // no reserve + bool hg; // thp-advised + bool ht; // uses hugetlb pages + bool nh; // thp forbidden + + size_t vsize() const { + return from < to ? pointer_delta(to, from, 1) : 0; + } + + void reset() { + from = to = nullptr; + prot[0] = filename[0] = '\0'; + kernelpagesize = rss = private_hugetlb = shared_hugetlb = anonhugepages = swap = 0; + rd = wr = ex = sh = nr = hg = ht = nh = false; + } +}; + +class ProcSmapsParser { + FILE* _f; + const size_t _linelen; + char* _line; + + bool read_line(); // sets had_error in case of error + bool is_header_line(); + void scan_header_line(ProcSmapsInfo& out); + void scan_additional_line(ProcSmapsInfo& out); + +public: + + ProcSmapsParser(FILE* f); + ~ProcSmapsParser(); + + // Starts or continues parsing. Returns true on success, + // false on EOF or on error. + bool parse_next(ProcSmapsInfo& out); +}; + +#endif // OS_LINUX_PROCMAPSPARSER_HPP diff --git a/src/hotspot/os/windows/globals_windows.hpp b/src/hotspot/os/windows/globals_windows.hpp index 6888c4093a0e..f13e10b03acd 100644 --- a/src/hotspot/os/windows/globals_windows.hpp +++ b/src/hotspot/os/windows/globals_windows.hpp @@ -39,6 +39,10 @@ product(bool, UseAllWindowsProcessorGroups, false, \ "Use all processor groups on supported Windows versions") \ \ +product(bool, EnableAllLargePageSizesForWindows, false, \ + "Enable support for multiple large page sizes on " \ + "Windows Server") \ + \ product(bool, UseOSErrorReporting, false, \ "Let VM fatal error propagate to the OS (ie. WER on Windows)") \ \ diff --git a/src/hotspot/os/windows/os_windows.cpp b/src/hotspot/os/windows/os_windows.cpp index 23742409f4e8..b3e14e54035b 100644 --- a/src/hotspot/os/windows/os_windows.cpp +++ b/src/hotspot/os/windows/os_windows.cpp @@ -3297,7 +3297,7 @@ class NUMANodeListHolder { static size_t _large_page_size = 0; -static bool request_lock_memory_privilege() { +bool os::win32::request_lock_memory_privilege() { HANDLE hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, os::current_process_id()); @@ -3481,14 +3481,14 @@ static char* allocate_pages_individually(size_t bytes, char* addr, DWORD flags, return p_buf; } -static size_t large_page_init_decide_size() { +size_t os::win32::large_page_init_decide_size() { // print a warning if any large page related flag is specified on command line bool warn_on_failure = !FLAG_IS_DEFAULT(UseLargePages) || !FLAG_IS_DEFAULT(LargePageSizeInBytes); -#define WARN(msg) if (warn_on_failure) { warning(msg); } +#define WARN(...) if (warn_on_failure) { warning(__VA_ARGS__); } - if (!request_lock_memory_privilege()) { + if (!os::win32::request_lock_memory_privilege()) { WARN("JVM cannot use large page memory because it does not have enough privilege to lock pages in memory."); return 0; } @@ -3499,15 +3499,26 @@ static size_t large_page_init_decide_size() { return 0; } -#if defined(IA32) || defined(AMD64) - if (size > 4*M || LargePageSizeInBytes > 4*M) { +#if defined(IA32) + if (size > 4 * M || LargePageSizeInBytes > 4 * M) { WARN("JVM cannot use large pages bigger than 4mb."); return 0; } +#elif defined(AMD64) + if (!EnableAllLargePageSizesForWindows) { + if (size > 4 * M || LargePageSizeInBytes > 4 * M) { + WARN("JVM cannot use large pages bigger than 4mb."); + return 0; + } + } #endif - if (LargePageSizeInBytes > 0 && LargePageSizeInBytes % size == 0) { - size = LargePageSizeInBytes; + if (LargePageSizeInBytes > 0) { + if (LargePageSizeInBytes % size == 0) { + size = LargePageSizeInBytes; + } else { + WARN("The specified large page size (%d) is not a multiple of the minimum large page size (%d), defaulting to minimum page size.", LargePageSizeInBytes, size); + } } #undef WARN @@ -3520,12 +3531,23 @@ void os::large_page_init() { return; } - _large_page_size = large_page_init_decide_size(); + _large_page_size = os::win32::large_page_init_decide_size(); const size_t default_page_size = os::vm_page_size(); if (_large_page_size > default_page_size) { +#if !defined(IA32) + if (EnableAllLargePageSizesForWindows) { + size_t min_size = GetLargePageMinimum(); + + // Populate _page_sizes with large page sizes less than or equal to _large_page_size, ensuring each page size is double the size of the previous one. + for (size_t page_size = min_size; page_size < _large_page_size; page_size *= 2) { + _page_sizes.add(page_size); + } + } +#endif + _page_sizes.add(_large_page_size); } - + // Set UseLargePages based on whether a large page size was successfully determined UseLargePages = _large_page_size != 0; } @@ -3787,7 +3809,6 @@ static char* reserve_large_pages_aligned(size_t size, size_t alignment, bool exe char* os::pd_reserve_memory_special(size_t bytes, size_t alignment, size_t page_size, char* addr, bool exec) { assert(UseLargePages, "only for large pages"); - assert(page_size == os::large_page_size(), "Currently only support one large page size on Windows"); assert(is_aligned(addr, alignment), "Must be"); assert(is_aligned(addr, page_size), "Must be"); @@ -3796,11 +3817,17 @@ char* os::pd_reserve_memory_special(size_t bytes, size_t alignment, size_t page_ return nullptr; } + // Ensure GetLargePageMinimum() returns a valid positive value + size_t large_page_min = GetLargePageMinimum(); + if (large_page_min <= 0) { + return nullptr; + } + // The requested alignment can be larger than the page size, for example with G1 // the alignment is bound to the heap region size. So this reservation needs to // ensure that the requested alignment is met. When there is a requested address // this solves it self, since it must be properly aligned already. - if (addr == nullptr && alignment > page_size) { + if (addr == nullptr && alignment > large_page_min) { return reserve_large_pages_aligned(bytes, alignment, exec); } diff --git a/src/hotspot/os/windows/os_windows.hpp b/src/hotspot/os/windows/os_windows.hpp index 489e2cc814b9..c4e5483ce8e3 100644 --- a/src/hotspot/os/windows/os_windows.hpp +++ b/src/hotspot/os/windows/os_windows.hpp @@ -65,6 +65,8 @@ class os::win32 { static void setmode_streams(); static bool is_windows_11_or_greater(); static bool is_windows_server_2022_or_greater(); + static bool request_lock_memory_privilege(); + static size_t large_page_init_decide_size(); static int windows_major_version() { assert(_major_version > 0, "windows version not initialized."); return _major_version; diff --git a/src/hotspot/os_cpu/aix_ppc/os_aix_ppc.cpp b/src/hotspot/os_cpu/aix_ppc/os_aix_ppc.cpp index a253d65e5ce5..1245b36d7ebd 100644 --- a/src/hotspot/os_cpu/aix_ppc/os_aix_ppc.cpp +++ b/src/hotspot/os_cpu/aix_ppc/os_aix_ppc.cpp @@ -449,7 +449,7 @@ void os::print_context(outputStream *st, const void *context) { } void os::print_register_info(outputStream *st, const void *context, int& continuation) { - const int register_count = 32 /* r0-r32 */ + 3 /* pc, lr, sp */; + const int register_count = 32 /* r0-r31 */ + 3 /* pc, lr, sp */; int n = continuation; assert(n >= 0 && n <= register_count, "Invalid continuation value"); if (context == nullptr || n == register_count) { diff --git a/src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp b/src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp index 7e7ae01a2e31..2be1f63ddc35 100644 --- a/src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp +++ b/src/hotspot/os_cpu/linux_aarch64/os_linux_aarch64.cpp @@ -356,7 +356,7 @@ void os::print_context(outputStream *st, const void *context) { } void os::print_register_info(outputStream *st, const void *context, int& continuation) { - const int register_count = 32 /* r0-r31 */; + const int register_count = 31 /* r0-r30 */; int n = continuation; assert(n >= 0 && n <= register_count, "Invalid continuation value"); if (context == nullptr || n == register_count) { diff --git a/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp b/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp index f4db505175f4..e8b5aea9bd8e 100644 --- a/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp +++ b/src/hotspot/os_cpu/linux_ppc/os_linux_ppc.cpp @@ -469,7 +469,7 @@ void os::print_context(outputStream *st, const void *context) { } void os::print_register_info(outputStream *st, const void *context, int& continuation) { - const int register_count = 32 /* r0-r32 */ + 3 /* pc, lr, ctr */; + const int register_count = 32 /* r0-r31 */ + 3 /* pc, lr, ctr */; int n = continuation; assert(n >= 0 && n <= register_count, "Invalid continuation value"); if (context == nullptr || n == register_count) { diff --git a/src/hotspot/share/cds/filemap.cpp b/src/hotspot/share/cds/filemap.cpp index d593a45af520..e1f45ba9c357 100644 --- a/src/hotspot/share/cds/filemap.cpp +++ b/src/hotspot/share/cds/filemap.cpp @@ -221,6 +221,7 @@ void FileMapHeader::populate(FileMapInfo *info, size_t core_region_alignment, } _compressed_oops = UseCompressedOops; _compressed_class_ptrs = UseCompressedClassPointers; + _use_secondary_supers_table = UseSecondarySupersTable; _max_heap_size = MaxHeapSize; _narrow_klass_shift = CompressedKlassPointers::shift(); _use_optimized_module_handling = MetaspaceShared::use_optimized_module_handling(); @@ -286,6 +287,7 @@ void FileMapHeader::print(outputStream* st) { st->print_cr("- narrow_klass_shift: %d", _narrow_klass_shift); st->print_cr("- compressed_oops: %d", _compressed_oops); st->print_cr("- compressed_class_ptrs: %d", _compressed_class_ptrs); + st->print_cr("- use_secondary_supers_table: %d", _use_secondary_supers_table); st->print_cr("- cloned_vtables_offset: " SIZE_FORMAT_X, _cloned_vtables_offset); st->print_cr("- serialized_data_offset: " SIZE_FORMAT_X, _serialized_data_offset); st->print_cr("- heap_begin: " INTPTR_FORMAT, p2i(_heap_begin)); @@ -2423,6 +2425,11 @@ bool FileMapHeader::validate() { return false; } + if (! _use_secondary_supers_table && UseSecondarySupersTable) { + log_warning(cds)("The shared archive was created without UseSecondarySupersTable."); + return false; + } + if (!_use_optimized_module_handling) { MetaspaceShared::disable_optimized_module_handling(); log_info(cds)("optimized module handling: disabled because archive was created without optimized module handling"); diff --git a/src/hotspot/share/cds/filemap.hpp b/src/hotspot/share/cds/filemap.hpp index 9848e8f434a2..2c715aeb8d35 100644 --- a/src/hotspot/share/cds/filemap.hpp +++ b/src/hotspot/share/cds/filemap.hpp @@ -192,6 +192,7 @@ class FileMapHeader: private CDSFileMapHeaderBase { int _narrow_klass_shift; // save narrow klass base and shift bool _compressed_oops; // save the flag UseCompressedOops bool _compressed_class_ptrs; // save the flag UseCompressedClassPointers + bool _use_secondary_supers_table; // save the flag UseSecondarySupersTable size_t _cloned_vtables_offset; // The address of the first cloned vtable size_t _serialized_data_offset; // Data accessed using {ReadClosure,WriteClosure}::serialize() address _heap_begin; // heap begin at dump time. diff --git a/src/hotspot/share/ci/ciInstanceKlass.cpp b/src/hotspot/share/ci/ciInstanceKlass.cpp index fa084e2287fb..240bb25ae3aa 100644 --- a/src/hotspot/share/ci/ciInstanceKlass.cpp +++ b/src/hotspot/share/ci/ciInstanceKlass.cpp @@ -661,7 +661,8 @@ class StaticFinalFieldPrinter : public FieldClosure { ResourceMark rm; oop mirror = fd->field_holder()->java_mirror(); _out->print("staticfield %s %s %s ", _holder, fd->name()->as_quoted_ascii(), fd->signature()->as_quoted_ascii()); - switch (fd->field_type()) { + BasicType field_type = fd->field_type(); + switch (field_type) { case T_BYTE: _out->print_cr("%d", mirror->byte_field(fd->offset())); break; case T_BOOLEAN: _out->print_cr("%d", mirror->bool_field(fd->offset())); break; case T_SHORT: _out->print_cr("%d", mirror->short_field(fd->offset())); break; @@ -682,9 +683,12 @@ class StaticFinalFieldPrinter : public FieldClosure { case T_OBJECT: { oop value = mirror->obj_field_acquire(fd->offset()); if (value == nullptr) { - _out->print_cr("null"); + if (field_type == T_ARRAY) { + _out->print("%d", -1); + } + _out->cr(); } else if (value->is_instance()) { - assert(fd->field_type() == T_OBJECT, ""); + assert(field_type == T_OBJECT, ""); if (value->is_a(vmClasses::String_klass())) { const char* ascii_value = java_lang_String::as_quoted_ascii(value); _out->print_cr("\"%s\"", (ascii_value != nullptr) ? ascii_value : ""); diff --git a/src/hotspot/share/ci/ciReplay.cpp b/src/hotspot/share/ci/ciReplay.cpp index 68d4308a2d3a..a8edc37ea439 100644 --- a/src/hotspot/share/ci/ciReplay.cpp +++ b/src/hotspot/share/ci/ciReplay.cpp @@ -1065,46 +1065,48 @@ class CompileReplay : public StackObj { int length = parse_int("array length"); oop value = nullptr; - if (field_signature[1] == JVM_SIGNATURE_ARRAY) { - // multi dimensional array - ArrayKlass* kelem = (ArrayKlass *)parse_klass(CHECK); - if (kelem == nullptr) { - return; - } - int rank = 0; - while (field_signature[rank] == JVM_SIGNATURE_ARRAY) { - rank++; - } - jint* dims = NEW_RESOURCE_ARRAY(jint, rank); - dims[0] = length; - for (int i = 1; i < rank; i++) { - dims[i] = 1; // These aren't relevant to the compiler - } - value = kelem->multi_allocate(rank, dims, CHECK); - } else { - if (strcmp(field_signature, "[B") == 0) { - value = oopFactory::new_byteArray(length, CHECK); - } else if (strcmp(field_signature, "[Z") == 0) { - value = oopFactory::new_boolArray(length, CHECK); - } else if (strcmp(field_signature, "[C") == 0) { - value = oopFactory::new_charArray(length, CHECK); - } else if (strcmp(field_signature, "[S") == 0) { - value = oopFactory::new_shortArray(length, CHECK); - } else if (strcmp(field_signature, "[F") == 0) { - value = oopFactory::new_floatArray(length, CHECK); - } else if (strcmp(field_signature, "[D") == 0) { - value = oopFactory::new_doubleArray(length, CHECK); - } else if (strcmp(field_signature, "[I") == 0) { - value = oopFactory::new_intArray(length, CHECK); - } else if (strcmp(field_signature, "[J") == 0) { - value = oopFactory::new_longArray(length, CHECK); - } else if (field_signature[0] == JVM_SIGNATURE_ARRAY && - field_signature[1] == JVM_SIGNATURE_CLASS) { - parse_klass(CHECK); // eat up the array class name - Klass* kelem = resolve_klass(field_signature + 1, CHECK); - value = oopFactory::new_objArray(kelem, length, CHECK); + if (length != -1) { + if (field_signature[1] == JVM_SIGNATURE_ARRAY) { + // multi dimensional array + ArrayKlass* kelem = (ArrayKlass *)parse_klass(CHECK); + if (kelem == nullptr) { + return; + } + int rank = 0; + while (field_signature[rank] == JVM_SIGNATURE_ARRAY) { + rank++; + } + jint* dims = NEW_RESOURCE_ARRAY(jint, rank); + dims[0] = length; + for (int i = 1; i < rank; i++) { + dims[i] = 1; // These aren't relevant to the compiler + } + value = kelem->multi_allocate(rank, dims, CHECK); } else { - report_error("unhandled array staticfield"); + if (strcmp(field_signature, "[B") == 0) { + value = oopFactory::new_byteArray(length, CHECK); + } else if (strcmp(field_signature, "[Z") == 0) { + value = oopFactory::new_boolArray(length, CHECK); + } else if (strcmp(field_signature, "[C") == 0) { + value = oopFactory::new_charArray(length, CHECK); + } else if (strcmp(field_signature, "[S") == 0) { + value = oopFactory::new_shortArray(length, CHECK); + } else if (strcmp(field_signature, "[F") == 0) { + value = oopFactory::new_floatArray(length, CHECK); + } else if (strcmp(field_signature, "[D") == 0) { + value = oopFactory::new_doubleArray(length, CHECK); + } else if (strcmp(field_signature, "[I") == 0) { + value = oopFactory::new_intArray(length, CHECK); + } else if (strcmp(field_signature, "[J") == 0) { + value = oopFactory::new_longArray(length, CHECK); + } else if (field_signature[0] == JVM_SIGNATURE_ARRAY && + field_signature[1] == JVM_SIGNATURE_CLASS) { + Klass* actual_array_klass = parse_klass(CHECK); + Klass* kelem = ObjArrayKlass::cast(actual_array_klass)->element_klass(); + value = oopFactory::new_objArray(kelem, length, CHECK); + } else { + report_error("unhandled array staticfield"); + } } } java_mirror->obj_field_put(fd.offset(), value); @@ -1142,8 +1144,11 @@ class CompileReplay : public StackObj { Handle value = java_lang_String::create_from_str(string_value, CHECK); java_mirror->obj_field_put(fd.offset(), value()); } else if (field_signature[0] == JVM_SIGNATURE_CLASS) { - Klass* k = resolve_klass(string_value, CHECK); - oop value = InstanceKlass::cast(k)->allocate_instance(CHECK); + oop value = nullptr; + if (string_value != nullptr) { + Klass* k = resolve_klass(string_value, CHECK); + value = InstanceKlass::cast(k)->allocate_instance(CHECK); + } java_mirror->obj_field_put(fd.offset(), value); } else { report_error("unhandled staticfield"); diff --git a/src/hotspot/share/classfile/classLoader.cpp b/src/hotspot/share/classfile/classLoader.cpp index 306740f1e8b7..bc744f309894 100644 --- a/src/hotspot/share/classfile/classLoader.cpp +++ b/src/hotspot/share/classfile/classLoader.cpp @@ -136,6 +136,7 @@ PerfCounter* ClassLoader::_perf_define_appclass_selftime = nullptr; PerfCounter* ClassLoader::_perf_app_classfile_bytes_read = nullptr; PerfCounter* ClassLoader::_perf_sys_classfile_bytes_read = nullptr; PerfCounter* ClassLoader::_unsafe_defineClassCallCounter = nullptr; +PerfCounter* ClassLoader::_perf_secondary_hash_time = nullptr; GrowableArray* ClassLoader::_patch_mod_entries = nullptr; GrowableArray* ClassLoader::_exploded_entries = nullptr; @@ -1435,6 +1436,7 @@ void ClassLoader::initialize(TRAPS) { NEWPERFBYTECOUNTER(_perf_sys_classfile_bytes_read, SUN_CLS, "sysClassBytes"); NEWPERFEVENTCOUNTER(_unsafe_defineClassCallCounter, SUN_CLS, "unsafeDefineClassCalls"); + NEWPERFTICKCOUNTER(_perf_secondary_hash_time, SUN_CLS, "secondarySuperHashTime"); } // lookup java library entry points diff --git a/src/hotspot/share/classfile/classLoader.hpp b/src/hotspot/share/classfile/classLoader.hpp index 3fbf14527928..fc7da9e4034a 100644 --- a/src/hotspot/share/classfile/classLoader.hpp +++ b/src/hotspot/share/classfile/classLoader.hpp @@ -181,6 +181,9 @@ class ClassLoader: AllStatic { static PerfCounter* _unsafe_defineClassCallCounter; + // Count the time taken to hash the scondary superclass arrays. + static PerfCounter* _perf_secondary_hash_time; + // The boot class path consists of 3 ordered pieces: // 1. the module/path pairs specified to --patch-module // --patch-module==()* @@ -289,6 +292,9 @@ class ClassLoader: AllStatic { static PerfCounter* perf_class_link_time() { return _perf_class_link_time; } static PerfCounter* perf_class_link_selftime() { return _perf_class_link_selftime; } static PerfCounter* perf_shared_classload_time() { return _perf_shared_classload_time; } + static PerfCounter* perf_secondary_hash_time() { + return _perf_secondary_hash_time; + } static PerfCounter* perf_sys_classload_time() { return _perf_sys_classload_time; } static PerfCounter* perf_app_classload_time() { return _perf_app_classload_time; } static PerfCounter* perf_app_classload_selftime() { return _perf_app_classload_selftime; } diff --git a/src/hotspot/share/code/codeCache.cpp b/src/hotspot/share/code/codeCache.cpp index df8cc14712c7..d240f5e9690b 100644 --- a/src/hotspot/share/code/codeCache.cpp +++ b/src/hotspot/share/code/codeCache.cpp @@ -1715,6 +1715,10 @@ void CodeCache::print() { void CodeCache::print_summary(outputStream* st, bool detailed) { int full_count = 0; + julong total_used = 0; + julong total_max_used = 0; + julong total_free = 0; + julong total_size = 0; FOR_ALL_HEAPS(heap_iterator) { CodeHeap* heap = (*heap_iterator); size_t total = (heap->high_boundary() - heap->low_boundary()); @@ -1723,10 +1727,17 @@ void CodeCache::print_summary(outputStream* st, bool detailed) { } else { st->print("CodeCache:"); } + size_t size = total/K; + size_t used = (total - heap->unallocated_capacity())/K; + size_t max_used = heap->max_allocated_capacity()/K; + size_t free = heap->unallocated_capacity()/K; + total_size += size; + total_used += used; + total_max_used += max_used; + total_free += free; st->print_cr(" size=" SIZE_FORMAT "Kb used=" SIZE_FORMAT "Kb max_used=" SIZE_FORMAT "Kb free=" SIZE_FORMAT "Kb", - total/K, (total - heap->unallocated_capacity())/K, - heap->max_allocated_capacity()/K, heap->unallocated_capacity()/K); + size, used, max_used, free); if (detailed) { st->print_cr(" bounds [" INTPTR_FORMAT ", " INTPTR_FORMAT ", " INTPTR_FORMAT "]", @@ -1739,17 +1750,22 @@ void CodeCache::print_summary(outputStream* st, bool detailed) { } if (detailed) { - st->print_cr(" total_blobs=" UINT32_FORMAT " nmethods=" UINT32_FORMAT - " adapters=" UINT32_FORMAT, - blob_count(), nmethod_count(), adapter_count()); - st->print_cr(" compilation: %s", CompileBroker::should_compile_new_jobs() ? + if (SegmentedCodeCache) { + st->print("CodeCache:"); + st->print_cr(" size=" JULONG_FORMAT "Kb, used=" JULONG_FORMAT + "Kb, max_used=" JULONG_FORMAT "Kb, free=" JULONG_FORMAT "Kb", + total_size, total_used, total_max_used, total_free); + } + st->print_cr(" total_blobs=" UINT32_FORMAT ", nmethods=" UINT32_FORMAT + ", adapters=" UINT32_FORMAT ", full_count=" UINT32_FORMAT, + blob_count(), nmethod_count(), adapter_count(), full_count); + st->print_cr("Compilation: %s, stopped_count=%d, restarted_count=%d", + CompileBroker::should_compile_new_jobs() ? "enabled" : Arguments::mode() == Arguments::_int ? "disabled (interpreter mode)" : - "disabled (not enough contiguous free space left)"); - st->print_cr(" stopped_count=%d, restarted_count=%d", + "disabled (not enough contiguous free space left)", CompileBroker::get_total_compiler_stopped_count(), CompileBroker::get_total_compiler_restarted_count()); - st->print_cr(" full_count=%d", full_count); } } diff --git a/src/hotspot/share/compiler/compileBroker.cpp b/src/hotspot/share/compiler/compileBroker.cpp index 878af2e22f4d..b3705c869af6 100644 --- a/src/hotspot/share/compiler/compileBroker.cpp +++ b/src/hotspot/share/compiler/compileBroker.cpp @@ -2261,7 +2261,7 @@ void CompileBroker::invoke_compiler_on_method(CompileTask* task) { } } } - if (!task->is_success()) { + if (!task->is_success() && !JVMCI::in_shutdown()) { handle_compile_error(thread, task, nullptr, compilable, failure_reason); } if (event.should_commit()) { @@ -2537,6 +2537,11 @@ void CompileBroker::collect_statistics(CompilerThread* thread, elapsedTimer time // C1 and C2 counters are counting both successful and unsuccessful compiles _t_total_compilation.add(time); + // Update compilation times. Used by the implementation of JFR CompilerStatistics + // and java.lang.management.CompilationMXBean. + _perf_total_compilation->inc(time.ticks()); + _peak_compilation_time = MAX2(time.milliseconds(), _peak_compilation_time); + if (!success) { _total_bailout_count++; if (UsePerfData) { @@ -2555,12 +2560,6 @@ void CompileBroker::collect_statistics(CompilerThread* thread, elapsedTimer time _t_invalidated_compilation.add(time); } else { // Compilation succeeded - - // update compilation ticks - used by the implementation of - // java.lang.management.CompilationMXBean - _perf_total_compilation->inc(time.ticks()); - _peak_compilation_time = time.milliseconds() > _peak_compilation_time ? time.milliseconds() : _peak_compilation_time; - if (CITime) { int bytes_compiled = method->code_size() + task->num_inlined_bytecodes(); if (is_osr) { diff --git a/src/hotspot/share/gc/g1/g1Allocator.cpp b/src/hotspot/share/gc/g1/g1Allocator.cpp index 5b33e24de75d..23c7ee839d80 100644 --- a/src/hotspot/share/gc/g1/g1Allocator.cpp +++ b/src/hotspot/share/gc/g1/g1Allocator.cpp @@ -212,10 +212,10 @@ size_t G1Allocator::used_in_alloc_regions() { HeapWord* G1Allocator::par_allocate_during_gc(G1HeapRegionAttr dest, - size_t word_size, - uint node_index) { + uint node_index, + size_t word_size) { size_t temp = 0; - HeapWord* result = par_allocate_during_gc(dest, word_size, word_size, &temp, node_index); + HeapWord* result = par_allocate_during_gc(dest, node_index, word_size, word_size, &temp); assert(result == nullptr || temp == word_size, "Requested " SIZE_FORMAT " words, but got " SIZE_FORMAT " at " PTR_FORMAT, word_size, temp, p2i(result)); @@ -223,13 +223,13 @@ HeapWord* G1Allocator::par_allocate_during_gc(G1HeapRegionAttr dest, } HeapWord* G1Allocator::par_allocate_during_gc(G1HeapRegionAttr dest, + uint node_index, size_t min_word_size, size_t desired_word_size, - size_t* actual_word_size, - uint node_index) { + size_t* actual_word_size) { switch (dest.type()) { case G1HeapRegionAttr::Young: - return survivor_attempt_allocation(min_word_size, desired_word_size, actual_word_size, node_index); + return survivor_attempt_allocation(node_index, min_word_size, desired_word_size, actual_word_size); case G1HeapRegionAttr::Old: return old_attempt_allocation(min_word_size, desired_word_size, actual_word_size); default: @@ -238,10 +238,10 @@ HeapWord* G1Allocator::par_allocate_during_gc(G1HeapRegionAttr dest, } } -HeapWord* G1Allocator::survivor_attempt_allocation(size_t min_word_size, +HeapWord* G1Allocator::survivor_attempt_allocation(uint node_index, + size_t min_word_size, size_t desired_word_size, - size_t* actual_word_size, - uint node_index) { + size_t* actual_word_size) { assert(!_g1h->is_humongous(desired_word_size), "we should not be seeing humongous-size allocations in this path"); @@ -396,10 +396,10 @@ HeapWord* G1PLABAllocator::allocate_direct_or_new_plab(G1HeapRegionAttr dest, size_t actual_plab_size = 0; HeapWord* buf = _allocator->par_allocate_during_gc(dest, + node_index, required_in_plab, plab_word_size, - &actual_plab_size, - node_index); + &actual_plab_size); assert(buf == nullptr || ((actual_plab_size >= required_in_plab) && (actual_plab_size <= plab_word_size)), "Requested at minimum %zu, desired %zu words, but got %zu at " PTR_FORMAT, @@ -418,7 +418,7 @@ HeapWord* G1PLABAllocator::allocate_direct_or_new_plab(G1HeapRegionAttr dest, *plab_refill_failed = true; } // Try direct allocation. - HeapWord* result = _allocator->par_allocate_during_gc(dest, word_sz, node_index); + HeapWord* result = _allocator->par_allocate_during_gc(dest, node_index, word_sz); if (result != nullptr) { plab_data->_direct_allocated += word_sz; plab_data->_num_direct_allocations++; diff --git a/src/hotspot/share/gc/g1/g1Allocator.hpp b/src/hotspot/share/gc/g1/g1Allocator.hpp index 32f37778a18a..b2828d64d87d 100644 --- a/src/hotspot/share/gc/g1/g1Allocator.hpp +++ b/src/hotspot/share/gc/g1/g1Allocator.hpp @@ -78,19 +78,16 @@ class G1Allocator : public CHeapObj { inline OldGCAllocRegion* old_gc_alloc_region(); // Allocation attempt during GC for a survivor object / PLAB. - HeapWord* survivor_attempt_allocation(size_t min_word_size, + HeapWord* survivor_attempt_allocation(uint node_index, + size_t min_word_size, size_t desired_word_size, - size_t* actual_word_size, - uint node_index); + size_t* actual_word_size); // Allocation attempt during GC for an old object / PLAB. HeapWord* old_attempt_allocation(size_t min_word_size, size_t desired_word_size, size_t* actual_word_size); - // Node index of current thread. - inline uint current_node_index() const; - public: G1Allocator(G1CollectedHeap* heap); ~G1Allocator(); @@ -110,18 +107,22 @@ class G1Allocator : public CHeapObj { void abandon_gc_alloc_regions(); bool is_retained_old_region(HeapRegion* hr); + // Node index of current thread. + inline uint current_node_index() const; + // Allocate blocks of memory during mutator time. // Attempt allocation in the current alloc region. - inline HeapWord* attempt_allocation(size_t min_word_size, + inline HeapWord* attempt_allocation(uint node_index, + size_t min_word_size, size_t desired_word_size, size_t* actual_word_size); // This is to be called when holding an appropriate lock. It first tries in the // current allocation region, and then attempts an allocation using a new region. - inline HeapWord* attempt_allocation_locked(size_t word_size); + inline HeapWord* attempt_allocation_locked(uint node_index, size_t word_size); - inline HeapWord* attempt_allocation_force(size_t word_size); + inline HeapWord* attempt_allocation_force(uint node_index, size_t word_size); size_t unsafe_max_tlab_alloc(); size_t used_in_alloc_regions(); @@ -131,14 +132,15 @@ class G1Allocator : public CHeapObj { // heap, and then allocate a block of the given size. The block // may not be a humongous - it must fit into a single heap region. HeapWord* par_allocate_during_gc(G1HeapRegionAttr dest, - size_t word_size, - uint node_index); + uint node_index, + size_t word_size + ); HeapWord* par_allocate_during_gc(G1HeapRegionAttr dest, + uint node_index, size_t min_word_size, size_t desired_word_size, - size_t* actual_word_size, - uint node_index); + size_t* actual_word_size); }; // Manages the PLABs used during garbage collection. Interface for allocation from PLABs. diff --git a/src/hotspot/share/gc/g1/g1Allocator.inline.hpp b/src/hotspot/share/gc/g1/g1Allocator.inline.hpp index 13ae9b9bbbde..7e516b48faa4 100644 --- a/src/hotspot/share/gc/g1/g1Allocator.inline.hpp +++ b/src/hotspot/share/gc/g1/g1Allocator.inline.hpp @@ -49,11 +49,10 @@ inline OldGCAllocRegion* G1Allocator::old_gc_alloc_region() { return &_old_gc_alloc_region; } -inline HeapWord* G1Allocator::attempt_allocation(size_t min_word_size, +inline HeapWord* G1Allocator::attempt_allocation(uint node_index, + size_t min_word_size, size_t desired_word_size, size_t* actual_word_size) { - uint node_index = current_node_index(); - HeapWord* result = mutator_alloc_region(node_index)->attempt_retained_allocation(min_word_size, desired_word_size, actual_word_size); if (result != nullptr) { return result; @@ -62,8 +61,7 @@ inline HeapWord* G1Allocator::attempt_allocation(size_t min_word_size, return mutator_alloc_region(node_index)->attempt_allocation(min_word_size, desired_word_size, actual_word_size); } -inline HeapWord* G1Allocator::attempt_allocation_locked(size_t word_size) { - uint node_index = current_node_index(); +inline HeapWord* G1Allocator::attempt_allocation_locked(uint node_index, size_t word_size) { HeapWord* result = mutator_alloc_region(node_index)->attempt_allocation_locked(word_size); assert(result != nullptr || mutator_alloc_region(node_index)->get() == nullptr, @@ -71,8 +69,7 @@ inline HeapWord* G1Allocator::attempt_allocation_locked(size_t word_size) { return result; } -inline HeapWord* G1Allocator::attempt_allocation_force(size_t word_size) { - uint node_index = current_node_index(); +inline HeapWord* G1Allocator::attempt_allocation_force(uint node_index, size_t word_size) { return mutator_alloc_region(node_index)->attempt_allocation_force(word_size); } diff --git a/src/hotspot/share/gc/g1/g1BarrierSet.hpp b/src/hotspot/share/gc/g1/g1BarrierSet.hpp index c925b01826b1..f641fabf7c3d 100644 --- a/src/hotspot/share/gc/g1/g1BarrierSet.hpp +++ b/src/hotspot/share/gc/g1/g1BarrierSet.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2023, 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 @@ -29,6 +29,7 @@ #include "gc/g1/g1SATBMarkQueueSet.hpp" #include "gc/shared/cardTable.hpp" #include "gc/shared/cardTableBarrierSet.hpp" +#include "gc/shared/bufferNode.hpp" class G1CardTable; diff --git a/src/hotspot/share/gc/g1/g1CardTableEntryClosure.hpp b/src/hotspot/share/gc/g1/g1CardTableEntryClosure.hpp index 4db654c21293..590feaefc2f1 100644 --- a/src/hotspot/share/gc/g1/g1CardTableEntryClosure.hpp +++ b/src/hotspot/share/gc/g1/g1CardTableEntryClosure.hpp @@ -25,8 +25,8 @@ #ifndef SHARE_GC_G1_G1CARDTABLEENTRYCLOSURE_HPP #define SHARE_GC_G1_G1CARDTABLEENTRYCLOSURE_HPP +#include "gc/shared/bufferNode.hpp" #include "gc/shared/cardTable.hpp" -#include "gc/shared/ptrQueue.hpp" #include "memory/allocation.hpp" // A closure class for processing card table entries. Note that we don't diff --git a/src/hotspot/share/gc/g1/g1CollectedHeap.cpp b/src/hotspot/share/gc/g1/g1CollectedHeap.cpp index e7609281e147..c01b3482c103 100644 --- a/src/hotspot/share/gc/g1/g1CollectedHeap.cpp +++ b/src/hotspot/share/gc/g1/g1CollectedHeap.cpp @@ -401,7 +401,7 @@ G1CollectedHeap::mem_allocate(size_t word_size, return attempt_allocation(word_size, word_size, &dummy); } -HeapWord* G1CollectedHeap::attempt_allocation_slow(size_t word_size) { +HeapWord* G1CollectedHeap::attempt_allocation_slow(uint node_index, size_t word_size) { ResourceMark rm; // For retrieving the thread names in log messages. // Make sure you read the note in attempt_allocation_humongous(). @@ -427,7 +427,7 @@ HeapWord* G1CollectedHeap::attempt_allocation_slow(size_t word_size) { // Now that we have the lock, we first retry the allocation in case another // thread changed the region while we were waiting to acquire the lock. - result = _allocator->attempt_allocation_locked(word_size); + result = _allocator->attempt_allocation_locked(node_index, word_size); if (result != nullptr) { return result; } @@ -438,7 +438,7 @@ HeapWord* G1CollectedHeap::attempt_allocation_slow(size_t word_size) { if (GCLocker::is_active_and_needs_gc() && policy()->can_expand_young_list()) { // No need for an ergo message here, can_expand_young_list() does this when // it returns true. - result = _allocator->attempt_allocation_force(word_size); + result = _allocator->attempt_allocation_force(node_index, word_size); if (result != nullptr) { return result; } @@ -495,7 +495,7 @@ HeapWord* G1CollectedHeap::attempt_allocation_slow(size_t word_size) { // follow-on attempt will be at the start of the next loop // iteration (after taking the Heap_lock). size_t dummy = 0; - result = _allocator->attempt_allocation(word_size, word_size, &dummy); + result = _allocator->attempt_allocation(node_index, word_size, word_size, &dummy); if (result != nullptr) { return result; } @@ -636,11 +636,14 @@ inline HeapWord* G1CollectedHeap::attempt_allocation(size_t min_word_size, assert(!is_humongous(desired_word_size), "attempt_allocation() should not " "be called for humongous allocation requests"); - HeapWord* result = _allocator->attempt_allocation(min_word_size, desired_word_size, actual_word_size); + // Fix NUMA node association for the duration of this allocation + const uint node_index = _allocator->current_node_index(); + + HeapWord* result = _allocator->attempt_allocation(node_index, min_word_size, desired_word_size, actual_word_size); if (result == nullptr) { *actual_word_size = desired_word_size; - result = attempt_allocation_slow(desired_word_size); + result = attempt_allocation_slow(node_index, desired_word_size); } assert_heap_not_locked(); @@ -778,8 +781,11 @@ HeapWord* G1CollectedHeap::attempt_allocation_at_safepoint(size_t word_size, assert(!_allocator->has_mutator_alloc_region() || !expect_null_mutator_alloc_region, "the current alloc region was unexpectedly found to be non-null"); + // Fix NUMA node association for the duration of this allocation + const uint node_index = _allocator->current_node_index(); + if (!is_humongous(word_size)) { - return _allocator->attempt_allocation_locked(word_size); + return _allocator->attempt_allocation_locked(node_index, word_size); } else { HeapWord* result = humongous_obj_allocate(word_size); if (result != nullptr && policy()->need_to_start_conc_mark("STW humongous allocation")) { diff --git a/src/hotspot/share/gc/g1/g1CollectedHeap.hpp b/src/hotspot/share/gc/g1/g1CollectedHeap.hpp index 83f9967c09c6..ef2e8093a60e 100644 --- a/src/hotspot/share/gc/g1/g1CollectedHeap.hpp +++ b/src/hotspot/share/gc/g1/g1CollectedHeap.hpp @@ -454,7 +454,7 @@ class G1CollectedHeap : public CollectedHeap { // Second-level mutator allocation attempt: take the Heap_lock and // retry the allocation attempt, potentially scheduling a GC // pause. This should only be used for non-humongous allocations. - HeapWord* attempt_allocation_slow(size_t word_size); + HeapWord* attempt_allocation_slow(uint node_index, size_t word_size); // Takes the Heap_lock and attempts a humongous allocation. It can // potentially schedule a GC pause. diff --git a/src/hotspot/share/gc/g1/g1DirtyCardQueue.cpp b/src/hotspot/share/gc/g1/g1DirtyCardQueue.cpp index 66dff511f077..5a3896ee62c2 100644 --- a/src/hotspot/share/gc/g1/g1DirtyCardQueue.cpp +++ b/src/hotspot/share/gc/g1/g1DirtyCardQueue.cpp @@ -34,6 +34,7 @@ #include "gc/g1/g1RemSet.hpp" #include "gc/g1/g1ThreadLocalData.hpp" #include "gc/g1/heapRegionRemSet.inline.hpp" +#include "gc/shared/bufferNode.hpp" #include "gc/shared/bufferNodeList.hpp" #include "gc/shared/suspendibleThreadSet.hpp" #include "memory/iterator.hpp" diff --git a/src/hotspot/share/gc/g1/g1DirtyCardQueue.hpp b/src/hotspot/share/gc/g1/g1DirtyCardQueue.hpp index b3a2237f5554..c1a10bba8626 100644 --- a/src/hotspot/share/gc/g1/g1DirtyCardQueue.hpp +++ b/src/hotspot/share/gc/g1/g1DirtyCardQueue.hpp @@ -28,6 +28,7 @@ #include "gc/g1/g1FreeIdSet.hpp" #include "gc/g1/g1CardTable.hpp" #include "gc/g1/g1ConcurrentRefineStats.hpp" +#include "gc/shared/bufferNode.hpp" #include "gc/shared/bufferNodeList.hpp" #include "gc/shared/ptrQueue.hpp" #include "memory/allocation.hpp" diff --git a/src/hotspot/share/gc/g1/g1RedirtyCardsQueue.cpp b/src/hotspot/share/gc/g1/g1RedirtyCardsQueue.cpp index a9a06b2c82eb..4f6f391fed70 100644 --- a/src/hotspot/share/gc/g1/g1RedirtyCardsQueue.cpp +++ b/src/hotspot/share/gc/g1/g1RedirtyCardsQueue.cpp @@ -24,6 +24,7 @@ #include "precompiled.hpp" #include "gc/g1/g1RedirtyCardsQueue.hpp" +#include "gc/shared/bufferNode.hpp" #include "runtime/atomic.hpp" #include "utilities/debug.hpp" #include "utilities/macros.hpp" diff --git a/src/hotspot/share/gc/g1/g1RedirtyCardsQueue.hpp b/src/hotspot/share/gc/g1/g1RedirtyCardsQueue.hpp index b464d3772985..f270e31f7726 100644 --- a/src/hotspot/share/gc/g1/g1RedirtyCardsQueue.hpp +++ b/src/hotspot/share/gc/g1/g1RedirtyCardsQueue.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,7 @@ #ifndef SHARE_GC_G1_G1REDIRTYCARDSQUEUE_HPP #define SHARE_GC_G1_G1REDIRTYCARDSQUEUE_HPP +#include "gc/shared/bufferNode.hpp" #include "gc/shared/bufferNodeList.hpp" #include "gc/shared/ptrQueue.hpp" #include "memory/padded.hpp" diff --git a/src/hotspot/share/gc/g1/g1RemSet.cpp b/src/hotspot/share/gc/g1/g1RemSet.cpp index 2d454fb4c65f..102ff40b8ff6 100644 --- a/src/hotspot/share/gc/g1/g1RemSet.cpp +++ b/src/hotspot/share/gc/g1/g1RemSet.cpp @@ -43,9 +43,9 @@ #include "gc/g1/heapRegion.inline.hpp" #include "gc/g1/heapRegionManager.inline.hpp" #include "gc/g1/heapRegionRemSet.inline.hpp" +#include "gc/shared/bufferNode.hpp" #include "gc/shared/bufferNodeList.hpp" #include "gc/shared/gcTraceTime.inline.hpp" -#include "gc/shared/ptrQueue.hpp" #include "jfr/jfrEvents.hpp" #include "memory/iterator.hpp" #include "memory/resourceArea.hpp" @@ -760,27 +760,71 @@ class G1ScanAndCountCodeBlobClosure : public CodeBlobClosure { // Heap region closure to be applied to all regions in the current collection set // increment to fix up non-card related roots. -class G1ScanCollectionSetRegionClosure : public HeapRegionClosure { +class G1ScanCodeRootsClosure : public HeapRegionClosure { G1ParScanThreadState* _pss; G1RemSetScanState* _scan_state; - G1GCPhaseTimes::GCParPhases _scan_phase; - G1GCPhaseTimes::GCParPhases _code_roots_phase; - uint _worker_id; size_t _code_roots_scanned; +public: + G1ScanCodeRootsClosure(G1RemSetScanState* scan_state, + G1ParScanThreadState* pss, + uint worker_id) : + _pss(pss), + _scan_state(scan_state), + _worker_id(worker_id), + _code_roots_scanned(0) { } + + bool do_heap_region(HeapRegion* r) { + // Scan the code root list attached to the current region + G1ScanAndCountCodeBlobClosure cl(_pss->closures()->weak_codeblobs()); + r->code_roots_do(&cl); + _code_roots_scanned += cl.count(); + return false; + } + + size_t code_roots_scanned() const { return _code_roots_scanned; } +}; + +void G1RemSet::scan_collection_set_code_roots(G1ParScanThreadState* pss, + uint worker_id, + G1GCPhaseTimes::GCParPhases coderoots_phase, + G1GCPhaseTimes::GCParPhases objcopy_phase) { + EventGCPhaseParallel event; + + Tickspan code_root_scan_time; + Tickspan code_root_trim_partially_time; + G1EvacPhaseWithTrimTimeTracker timer(pss, code_root_scan_time, code_root_trim_partially_time); + + G1GCPhaseTimes* p = _g1h->phase_times(); + + G1ScanCodeRootsClosure cl(_scan_state, pss, worker_id); + // Code roots work distribution occurs inside the iteration method. So scan all collection + // set regions for all threads. + _g1h->collection_set_iterate_increment_from(&cl, worker_id); + + p->record_or_add_time_secs(coderoots_phase, worker_id, code_root_scan_time.seconds()); + p->add_time_secs(objcopy_phase, worker_id, code_root_trim_partially_time.seconds()); + + p->record_or_add_thread_work_item(coderoots_phase, worker_id, cl.code_roots_scanned(), G1GCPhaseTimes::CodeRootsScannedNMethods); + + event.commit(GCId::current(), worker_id, G1GCPhaseTimes::phase_name(coderoots_phase)); +} + +class G1ScanOptionalRemSetRootsClosure : public HeapRegionClosure { + G1ParScanThreadState* _pss; + + uint _worker_id; + + G1GCPhaseTimes::GCParPhases _scan_phase; + size_t _opt_roots_scanned; + size_t _opt_refs_scanned; size_t _opt_refs_memory_used; - Tickspan _code_root_scan_time; - Tickspan _code_trim_partially_time; - - Tickspan _rem_set_opt_root_scan_time; - Tickspan _rem_set_opt_trim_partially_time; - void scan_opt_rem_set_roots(HeapRegion* r) { G1OopStarChunkedList* opt_rem_set_list = _pss->oops_into_optional_region(r); @@ -791,92 +835,58 @@ class G1ScanCollectionSetRegionClosure : public HeapRegionClosure { } public: - G1ScanCollectionSetRegionClosure(G1RemSetScanState* scan_state, - G1ParScanThreadState* pss, + G1ScanOptionalRemSetRootsClosure(G1ParScanThreadState* pss, uint worker_id, - G1GCPhaseTimes::GCParPhases scan_phase, - G1GCPhaseTimes::GCParPhases code_roots_phase) : + G1GCPhaseTimes::GCParPhases scan_phase) : _pss(pss), - _scan_state(scan_state), - _scan_phase(scan_phase), - _code_roots_phase(code_roots_phase), _worker_id(worker_id), - _code_roots_scanned(0), + _scan_phase(scan_phase), _opt_roots_scanned(0), _opt_refs_scanned(0), - _opt_refs_memory_used(0), - _code_root_scan_time(), - _code_trim_partially_time(), - _rem_set_opt_root_scan_time(), - _rem_set_opt_trim_partially_time() { } + _opt_refs_memory_used(0) { } - bool do_heap_region(HeapRegion* r) { - // The individual references for the optional remembered set are per-worker, so we - // always need to scan them. + bool do_heap_region(HeapRegion* r) override { if (r->has_index_in_opt_cset()) { - EventGCPhaseParallel event; - G1EvacPhaseWithTrimTimeTracker timer(_pss, _rem_set_opt_root_scan_time, _rem_set_opt_trim_partially_time); scan_opt_rem_set_roots(r); - - event.commit(GCId::current(), _worker_id, G1GCPhaseTimes::phase_name(_scan_phase)); - } - - // Scan code root remembered sets. - { - EventGCPhaseParallel event; - G1EvacPhaseWithTrimTimeTracker timer(_pss, _code_root_scan_time, _code_trim_partially_time); - G1ScanAndCountCodeBlobClosure cl(_pss->closures()->weak_codeblobs()); - - // Scan the code root list attached to the current region - r->code_roots_do(&cl); - - _code_roots_scanned += cl.count(); - - event.commit(GCId::current(), _worker_id, G1GCPhaseTimes::phase_name(_code_roots_phase)); } - return false; } - Tickspan code_root_scan_time() const { return _code_root_scan_time; } - Tickspan code_root_trim_partially_time() const { return _code_trim_partially_time; } - - size_t code_roots_scanned() const { return _code_roots_scanned; } - - Tickspan rem_set_opt_root_scan_time() const { return _rem_set_opt_root_scan_time; } - Tickspan rem_set_opt_trim_partially_time() const { return _rem_set_opt_trim_partially_time; } - size_t opt_roots_scanned() const { return _opt_roots_scanned; } size_t opt_refs_scanned() const { return _opt_refs_scanned; } size_t opt_refs_memory_used() const { return _opt_refs_memory_used; } }; -void G1RemSet::scan_collection_set_regions(G1ParScanThreadState* pss, - uint worker_id, - G1GCPhaseTimes::GCParPhases scan_phase, - G1GCPhaseTimes::GCParPhases coderoots_phase, - G1GCPhaseTimes::GCParPhases objcopy_phase) { - G1ScanCollectionSetRegionClosure cl(_scan_state, pss, worker_id, scan_phase, coderoots_phase); - _g1h->collection_set_iterate_increment_from(&cl, worker_id); +void G1RemSet::scan_collection_set_optional_roots(G1ParScanThreadState* pss, + uint worker_id, + G1GCPhaseTimes::GCParPhases scan_phase, + G1GCPhaseTimes::GCParPhases objcopy_phase) { + assert(scan_phase == G1GCPhaseTimes::OptScanHR, "must be"); + + EventGCPhaseParallel event; + + Tickspan rem_set_opt_root_scan_time; + Tickspan rem_set_opt_trim_partially_time; + G1EvacPhaseWithTrimTimeTracker timer(pss, rem_set_opt_root_scan_time, rem_set_opt_trim_partially_time); G1GCPhaseTimes* p = _g1h->phase_times(); - p->record_or_add_time_secs(scan_phase, worker_id, cl.rem_set_opt_root_scan_time().seconds()); - p->record_or_add_time_secs(scan_phase, worker_id, cl.rem_set_opt_trim_partially_time().seconds()); + G1ScanOptionalRemSetRootsClosure cl(pss, worker_id, scan_phase); + // The individual references for the optional remembered set are per-worker, so every worker + // always need to scan all regions (no claimer). + _g1h->collection_set_iterate_increment_from(&cl, worker_id); - p->record_or_add_time_secs(coderoots_phase, worker_id, cl.code_root_scan_time().seconds()); - p->record_or_add_thread_work_item(coderoots_phase, worker_id, cl.code_roots_scanned(), G1GCPhaseTimes::CodeRootsScannedNMethods); + p->record_or_add_time_secs(scan_phase, worker_id, rem_set_opt_root_scan_time.seconds()); + p->record_or_add_time_secs(objcopy_phase, worker_id, rem_set_opt_trim_partially_time.seconds()); - p->add_time_secs(objcopy_phase, worker_id, cl.code_root_trim_partially_time().seconds()); + p->record_or_add_thread_work_item(scan_phase, worker_id, cl.opt_roots_scanned(), G1GCPhaseTimes::ScanHRFoundRoots); + p->record_or_add_thread_work_item(scan_phase, worker_id, cl.opt_refs_scanned(), G1GCPhaseTimes::ScanHRScannedOptRefs); + p->record_or_add_thread_work_item(scan_phase, worker_id, cl.opt_refs_memory_used(), G1GCPhaseTimes::ScanHRUsedMemory); - // At this time we record some metrics only for the evacuations after the initial one. - if (scan_phase == G1GCPhaseTimes::OptScanHR) { - p->record_or_add_thread_work_item(scan_phase, worker_id, cl.opt_roots_scanned(), G1GCPhaseTimes::ScanHRFoundRoots); - p->record_or_add_thread_work_item(scan_phase, worker_id, cl.opt_refs_scanned(), G1GCPhaseTimes::ScanHRScannedOptRefs); - p->record_or_add_thread_work_item(scan_phase, worker_id, cl.opt_refs_memory_used(), G1GCPhaseTimes::ScanHRUsedMemory); - } + event.commit(GCId::current(), worker_id, G1GCPhaseTimes::phase_name(scan_phase)); } + #ifdef ASSERT void G1RemSet::assert_scan_top_is_null(uint hrm_index) { assert(_scan_state->scan_top(hrm_index) == nullptr, diff --git a/src/hotspot/share/gc/g1/g1RemSet.hpp b/src/hotspot/share/gc/g1/g1RemSet.hpp index 053fc39aa836..db09f178813f 100644 --- a/src/hotspot/share/gc/g1/g1RemSet.hpp +++ b/src/hotspot/share/gc/g1/g1RemSet.hpp @@ -113,11 +113,15 @@ class G1RemSet: public CHeapObj { // Do work for regions in the current increment of the collection set, scanning // non-card based (heap) roots. - void scan_collection_set_regions(G1ParScanThreadState* pss, - uint worker_id, - G1GCPhaseTimes::GCParPhases scan_phase, - G1GCPhaseTimes::GCParPhases coderoots_phase, - G1GCPhaseTimes::GCParPhases objcopy_phase); + void scan_collection_set_code_roots(G1ParScanThreadState* pss, + uint worker_id, + G1GCPhaseTimes::GCParPhases coderoots_phase, + G1GCPhaseTimes::GCParPhases objcopy_phase); + + void scan_collection_set_optional_roots(G1ParScanThreadState* pss, + uint worker_id, + G1GCPhaseTimes::GCParPhases scan_phase, + G1GCPhaseTimes::GCParPhases objcopy_phase); // Two methods for concurrent refinement support, executed concurrently to // the mutator: diff --git a/src/hotspot/share/gc/g1/g1SATBMarkQueueSet.hpp b/src/hotspot/share/gc/g1/g1SATBMarkQueueSet.hpp index 5533d6cdfed7..4db9313805a7 100644 --- a/src/hotspot/share/gc/g1/g1SATBMarkQueueSet.hpp +++ b/src/hotspot/share/gc/g1/g1SATBMarkQueueSet.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,7 @@ #ifndef SHARE_GC_G1_G1SATBMARKQUEUESET_HPP #define SHARE_GC_G1_G1SATBMARKQUEUESET_HPP +#include "gc/shared/bufferNode.hpp" #include "gc/shared/satbMarkQueue.hpp" class Monitor; diff --git a/src/hotspot/share/gc/g1/g1YoungCollector.cpp b/src/hotspot/share/gc/g1/g1YoungCollector.cpp index aac7aced7b49..c9905dd51b68 100644 --- a/src/hotspot/share/gc/g1/g1YoungCollector.cpp +++ b/src/hotspot/share/gc/g1/g1YoungCollector.cpp @@ -573,8 +573,10 @@ class G1EvacuateRegionsBaseTask : public WorkerTask { protected: G1CollectedHeap* _g1h; G1ParScanThreadStateSet* _per_thread_states; + G1ScannerTasksQueueSet* _task_queues; TaskTerminator _terminator; + uint _num_workers; void evacuate_live_objects(G1ParScanThreadState* pss, @@ -649,7 +651,22 @@ class G1EvacuateRegionsTask : public G1EvacuateRegionsBaseTask { void scan_roots(G1ParScanThreadState* pss, uint worker_id) { _root_processor->evacuate_roots(pss, worker_id); _g1h->rem_set()->scan_heap_roots(pss, worker_id, G1GCPhaseTimes::ScanHR, G1GCPhaseTimes::ObjCopy, _has_optional_evacuation_work); - _g1h->rem_set()->scan_collection_set_regions(pss, worker_id, G1GCPhaseTimes::ScanHR, G1GCPhaseTimes::CodeRoots, G1GCPhaseTimes::ObjCopy); + _g1h->rem_set()->scan_collection_set_code_roots(pss, worker_id, G1GCPhaseTimes::CodeRoots, G1GCPhaseTimes::ObjCopy); + // There are no optional roots to scan right now. +#ifdef ASSERT + class VerifyOptionalCollectionSetRootsEmptyClosure : public HeapRegionClosure { + G1ParScanThreadState* _pss; + + public: + VerifyOptionalCollectionSetRootsEmptyClosure(G1ParScanThreadState* pss) : _pss(pss) { } + + bool do_heap_region(HeapRegion* r) override { + assert(!r->has_index_in_opt_cset(), "must be"); + return false; + } + } cl(pss); + _g1h->collection_set_iterate_increment_from(&cl, worker_id); +#endif } void evacuate_live_objects(G1ParScanThreadState* pss, uint worker_id) { @@ -718,7 +735,8 @@ class G1EvacuateOptionalRegionsTask : public G1EvacuateRegionsBaseTask { void scan_roots(G1ParScanThreadState* pss, uint worker_id) { _g1h->rem_set()->scan_heap_roots(pss, worker_id, G1GCPhaseTimes::OptScanHR, G1GCPhaseTimes::OptObjCopy, true /* remember_already_scanned_cards */); - _g1h->rem_set()->scan_collection_set_regions(pss, worker_id, G1GCPhaseTimes::OptScanHR, G1GCPhaseTimes::OptCodeRoots, G1GCPhaseTimes::OptObjCopy); + _g1h->rem_set()->scan_collection_set_code_roots(pss, worker_id, G1GCPhaseTimes::OptCodeRoots, G1GCPhaseTimes::OptObjCopy); + _g1h->rem_set()->scan_collection_set_optional_roots(pss, worker_id, G1GCPhaseTimes::OptScanHR, G1GCPhaseTimes::ObjCopy); } void evacuate_live_objects(G1ParScanThreadState* pss, uint worker_id) { diff --git a/src/hotspot/share/gc/g1/g1YoungGCPostEvacuateTasks.cpp b/src/hotspot/share/gc/g1/g1YoungGCPostEvacuateTasks.cpp index 6edf87bb9919..732406237864 100644 --- a/src/hotspot/share/gc/g1/g1YoungGCPostEvacuateTasks.cpp +++ b/src/hotspot/share/gc/g1/g1YoungGCPostEvacuateTasks.cpp @@ -35,6 +35,7 @@ #include "gc/g1/g1ParScanThreadState.hpp" #include "gc/g1/g1RemSet.hpp" #include "gc/g1/g1YoungGCPostEvacuateTasks.hpp" +#include "gc/shared/bufferNode.hpp" #include "gc/shared/preservedMarks.inline.hpp" #include "jfr/jfrEvents.hpp" #include "runtime/threads.hpp" diff --git a/src/hotspot/share/gc/g1/jvmFlagConstraintsG1.cpp b/src/hotspot/share/gc/g1/jvmFlagConstraintsG1.cpp index 889af717deb6..40a833ebccd5 100644 --- a/src/hotspot/share/gc/g1/jvmFlagConstraintsG1.cpp +++ b/src/hotspot/share/gc/g1/jvmFlagConstraintsG1.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,7 @@ #include "precompiled.hpp" #include "gc/g1/heapRegionBounds.inline.hpp" #include "gc/g1/jvmFlagConstraintsG1.hpp" +#include "gc/shared/bufferNode.hpp" #include "runtime/globals_extension.hpp" #include "utilities/globalDefinitions.hpp" diff --git a/src/hotspot/share/gc/shared/bufferNode.cpp b/src/hotspot/share/gc/shared/bufferNode.cpp new file mode 100644 index 000000000000..2c7098db20be --- /dev/null +++ b/src/hotspot/share/gc/shared/bufferNode.cpp @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2023, 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/bufferNode.hpp" +#include "utilities/debug.hpp" +#include "memory/allocation.inline.hpp" + +#include + +BufferNode::AllocatorConfig::AllocatorConfig(size_t size) : _buffer_size(size) {} + +void* BufferNode::AllocatorConfig::allocate() { + size_t byte_size = _buffer_size * sizeof(void*); + return NEW_C_HEAP_ARRAY(char, buffer_offset() + byte_size, mtGC); +} + +void BufferNode::AllocatorConfig::deallocate(void* node) { + assert(node != nullptr, "precondition"); + FREE_C_HEAP_ARRAY(char, node); +} + +BufferNode::Allocator::Allocator(const char* name, size_t buffer_size) : + _config(buffer_size), + _free_list(name, &_config) +{} + +size_t BufferNode::Allocator::free_count() const { + return _free_list.free_count(); +} + +BufferNode* BufferNode::Allocator::allocate() { + return ::new (_free_list.allocate()) BufferNode(); +} + +void BufferNode::Allocator::release(BufferNode* node) { + assert(node != nullptr, "precondition"); + assert(node->next() == nullptr, "precondition"); + node->~BufferNode(); + _free_list.release(node); +} diff --git a/src/hotspot/share/gc/shared/bufferNode.hpp b/src/hotspot/share/gc/shared/bufferNode.hpp new file mode 100644 index 000000000000..dbeacc054fcd --- /dev/null +++ b/src/hotspot/share/gc/shared/bufferNode.hpp @@ -0,0 +1,112 @@ +/* + * Copyright (c) 2023, 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_GC_SHARED_BUFFERNODE_HPP +#define SHARE_GC_SHARED_BUFFERNODE_HPP + +#include "gc/shared/freeListAllocator.hpp" +#include "utilities/debug.hpp" +#include "utilities/globalDefinitions.hpp" +#include "utilities/lockFreeStack.hpp" +#include "utilities/macros.hpp" + +class BufferNode { + size_t _index; + BufferNode* volatile _next; + void* _buffer[1]; // Pseudo flexible array member. + + BufferNode() : _index(0), _next(nullptr) { } + ~BufferNode() { } + + NONCOPYABLE(BufferNode); + + static size_t buffer_offset() { + return offset_of(BufferNode, _buffer); + } + +public: + static BufferNode* volatile* next_ptr(BufferNode& bn) { return &bn._next; } + typedef LockFreeStack Stack; + + BufferNode* next() const { return _next; } + void set_next(BufferNode* n) { _next = n; } + size_t index() const { return _index; } + void set_index(size_t i) { _index = i; } + + // Return the BufferNode containing the buffer, after setting its index. + static BufferNode* make_node_from_buffer(void** buffer, size_t index) { + BufferNode* node = + reinterpret_cast( + reinterpret_cast(buffer) - buffer_offset()); + node->set_index(index); + return node; + } + + // Return the buffer for node. + static void** make_buffer_from_node(BufferNode *node) { + // &_buffer[0] might lead to index out of bounds warnings. + return reinterpret_cast( + reinterpret_cast(node) + buffer_offset()); + } + + class AllocatorConfig; + class Allocator; // Free-list based allocator. + class TestSupport; // Unit test support. +}; + +// We use BufferNode::AllocatorConfig to set the allocation options for the +// FreeListAllocator. +class BufferNode::AllocatorConfig : public FreeListConfig { + const size_t _buffer_size; +public: + explicit AllocatorConfig(size_t size); + + ~AllocatorConfig() = default; + + void* allocate() override; + + void deallocate(void* node) override; + + size_t buffer_size() const { return _buffer_size; } +}; + +class BufferNode::Allocator { + friend class TestSupport; + + AllocatorConfig _config; + FreeListAllocator _free_list; + + NONCOPYABLE(Allocator); + +public: + Allocator(const char* name, size_t buffer_size); + ~Allocator() = default; + + size_t buffer_size() const { return _config.buffer_size(); } + size_t free_count() const; + BufferNode* allocate(); + void release(BufferNode* node); +}; + +#endif // SHARE_GC_SHARED_BUFFERNODE_HPP diff --git a/src/hotspot/share/gc/shared/ptrQueue.cpp b/src/hotspot/share/gc/shared/ptrQueue.cpp index 57bb71706e1e..3f28dafdff26 100644 --- a/src/hotspot/share/gc/shared/ptrQueue.cpp +++ b/src/hotspot/share/gc/shared/ptrQueue.cpp @@ -23,10 +23,8 @@ */ #include "precompiled.hpp" +#include "gc/shared/bufferNode.hpp" #include "gc/shared/ptrQueue.hpp" -#include "memory/allocation.inline.hpp" - -#include PtrQueue::PtrQueue(PtrQueueSet* qset) : _index(0), @@ -38,39 +36,7 @@ PtrQueue::~PtrQueue() { assert(_buf == nullptr, "queue must be flushed before delete"); } -BufferNode::AllocatorConfig::AllocatorConfig(size_t size) : _buffer_size(size) {} - -void* BufferNode::AllocatorConfig::allocate() { - size_t byte_size = _buffer_size * sizeof(void*); - return NEW_C_HEAP_ARRAY(char, buffer_offset() + byte_size, mtGC); -} -void BufferNode::AllocatorConfig::deallocate(void* node) { - assert(node != nullptr, "precondition"); - FREE_C_HEAP_ARRAY(char, node); -} - -BufferNode::Allocator::Allocator(const char* name, size_t buffer_size) : - _config(buffer_size), - _free_list(name, &_config) -{ - -} - -size_t BufferNode::Allocator::free_count() const { - return _free_list.free_count(); -} - -BufferNode* BufferNode::Allocator::allocate() { - return ::new (_free_list.allocate()) BufferNode(); -} - -void BufferNode::Allocator::release(BufferNode* node) { - assert(node != nullptr, "precondition"); - assert(node->next() == nullptr, "precondition"); - node->~BufferNode(); - _free_list.release(node); -} PtrQueueSet::PtrQueueSet(BufferNode::Allocator* allocator) : _allocator(allocator) diff --git a/src/hotspot/share/gc/shared/ptrQueue.hpp b/src/hotspot/share/gc/shared/ptrQueue.hpp index eb691e9c7e7b..648a557ebad9 100644 --- a/src/hotspot/share/gc/shared/ptrQueue.hpp +++ b/src/hotspot/share/gc/shared/ptrQueue.hpp @@ -25,12 +25,10 @@ #ifndef SHARE_GC_SHARED_PTRQUEUE_HPP #define SHARE_GC_SHARED_PTRQUEUE_HPP -#include "gc/shared/freeListAllocator.hpp" -#include "memory/padded.hpp" +#include "gc/shared/bufferNode.hpp" #include "utilities/align.hpp" #include "utilities/debug.hpp" #include "utilities/globalDefinitions.hpp" -#include "utilities/lockFreeStack.hpp" #include "utilities/sizes.hpp" // There are various techniques that require threads to be able to log @@ -38,7 +36,6 @@ // the addresses of modified old-generation objects. This type supports // this operation. -class BufferNode; class PtrQueueSet; class PtrQueue { friend class VMStructs; @@ -118,84 +115,6 @@ class PtrQueue { static ByteSize byte_width_of_buf() { return in_ByteSize(_element_size); } }; -class BufferNode { - size_t _index; - BufferNode* volatile _next; - void* _buffer[1]; // Pseudo flexible array member. - - BufferNode() : _index(0), _next(nullptr) { } - ~BufferNode() { } - - NONCOPYABLE(BufferNode); - - static size_t buffer_offset() { - return offset_of(BufferNode, _buffer); - } - -public: - static BufferNode* volatile* next_ptr(BufferNode& bn) { return &bn._next; } - typedef LockFreeStack Stack; - - BufferNode* next() const { return _next; } - void set_next(BufferNode* n) { _next = n; } - size_t index() const { return _index; } - void set_index(size_t i) { _index = i; } - - // Return the BufferNode containing the buffer, after setting its index. - static BufferNode* make_node_from_buffer(void** buffer, size_t index) { - BufferNode* node = - reinterpret_cast( - reinterpret_cast(buffer) - buffer_offset()); - node->set_index(index); - return node; - } - - // Return the buffer for node. - static void** make_buffer_from_node(BufferNode *node) { - // &_buffer[0] might lead to index out of bounds warnings. - return reinterpret_cast( - reinterpret_cast(node) + buffer_offset()); - } - - class AllocatorConfig; - class Allocator; // Free-list based allocator. - class TestSupport; // Unit test support. -}; - -// We use BufferNode::AllocatorConfig to set the allocation options for the -// FreeListAllocator. -class BufferNode::AllocatorConfig : public FreeListConfig { - const size_t _buffer_size; -public: - explicit AllocatorConfig(size_t size); - - ~AllocatorConfig() = default; - - void* allocate() override; - - void deallocate(void* node) override; - - size_t buffer_size() const { return _buffer_size; } -}; - -class BufferNode::Allocator { - friend class TestSupport; - - AllocatorConfig _config; - FreeListAllocator _free_list; - - NONCOPYABLE(Allocator); - -public: - Allocator(const char* name, size_t buffer_size); - ~Allocator() = default; - - size_t buffer_size() const { return _config.buffer_size(); } - size_t free_count() const; - BufferNode* allocate(); - void release(BufferNode* node); -}; - // A PtrQueueSet represents resources common to a set of pointer queues. // In particular, the individual queues allocate buffers from this shared // set, and return completed buffers to the set. diff --git a/src/hotspot/share/gc/shenandoah/c2/shenandoahSupport.cpp b/src/hotspot/share/gc/shenandoah/c2/shenandoahSupport.cpp index 49b36b85b9ee..168d8769195e 100644 --- a/src/hotspot/share/gc/shenandoah/c2/shenandoahSupport.cpp +++ b/src/hotspot/share/gc/shenandoah/c2/shenandoahSupport.cpp @@ -1322,6 +1322,14 @@ void ShenandoahBarrierC2Support::pin_and_expand(PhaseIdealLoop* phase) { OuterStripMinedLoopNode* outer = head->as_OuterStripMinedLoop(); hide_strip_mined_loop(outer, outer->unique_ctrl_out()->as_CountedLoop(), phase); } + if (head->is_BaseCountedLoop() && ctrl->is_IfProj() && ctrl->in(0)->is_BaseCountedLoopEnd() && + head->as_BaseCountedLoop()->loopexit() == ctrl->in(0)) { + Node* entry = head->in(LoopNode::EntryControl); + Node* backedge = head->in(LoopNode::LoopBackControl); + Node* new_head = new LoopNode(entry, backedge); + phase->register_control(new_head, phase->get_loop(entry), entry); + phase->lazy_replace(head, new_head); + } } // Expand load-reference-barriers diff --git a/src/hotspot/share/gc/shenandoah/shenandoahAsserts.cpp b/src/hotspot/share/gc/shenandoah/shenandoahAsserts.cpp index beb4a1d28923..3699e2b3e857 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahAsserts.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahAsserts.cpp @@ -37,7 +37,7 @@ void print_raw_memory(ShenandoahMessageBuffer &msg, void* loc) { // should be in heap, in known committed region, within that region. ShenandoahHeap* heap = ShenandoahHeap::heap(); - if (!heap->is_in(loc)) return; + if (!heap->is_in_reserved(loc)) return; ShenandoahHeapRegion* r = heap->heap_region_containing(loc); if (r != nullptr && r->is_committed()) { @@ -77,7 +77,7 @@ void ShenandoahAsserts::print_obj(ShenandoahMessageBuffer& msg, oop obj) { void ShenandoahAsserts::print_non_obj(ShenandoahMessageBuffer& msg, void* loc) { ShenandoahHeap* heap = ShenandoahHeap::heap(); - if (heap->is_in(loc)) { + if (heap->is_in_reserved(loc)) { msg.append(" inside Java heap\n"); ShenandoahHeapRegion *r = heap->heap_region_containing(loc); stringStream ss; @@ -96,7 +96,7 @@ void ShenandoahAsserts::print_non_obj(ShenandoahMessageBuffer& msg, void* loc) { void ShenandoahAsserts::print_obj_safe(ShenandoahMessageBuffer& msg, void* loc) { ShenandoahHeap* heap = ShenandoahHeap::heap(); msg.append(" " PTR_FORMAT " - safe print, no details\n", p2i(loc)); - if (heap->is_in(loc)) { + if (heap->is_in_reserved(loc)) { ShenandoahHeapRegion* r = heap->heap_region_containing(loc); if (r != nullptr) { stringStream ss; @@ -113,7 +113,7 @@ void ShenandoahAsserts::print_failure(SafeLevel level, oop obj, void* interior_l ShenandoahHeap* heap = ShenandoahHeap::heap(); ResourceMark rm; - bool loc_in_heap = (loc != nullptr && heap->is_in(loc)); + bool loc_in_heap = (loc != nullptr && heap->is_in_reserved(loc)); ShenandoahMessageBuffer msg("%s; %s\n\n", phase, label); @@ -166,22 +166,22 @@ void ShenandoahAsserts::print_failure(SafeLevel level, oop obj, void* interior_l report_vm_error(file, line, msg.buffer()); } -void ShenandoahAsserts::assert_in_heap(void* interior_loc, oop obj, const char *file, int line) { +void ShenandoahAsserts::assert_in_heap_bounds(void* interior_loc, oop obj, const char *file, int line) { ShenandoahHeap* heap = ShenandoahHeap::heap(); - if (!heap->is_in(obj)) { - print_failure(_safe_unknown, obj, interior_loc, nullptr, "Shenandoah assert_in_heap failed", - "oop must point to a heap address", + if (!heap->is_in_reserved(obj)) { + print_failure(_safe_unknown, obj, interior_loc, nullptr, "Shenandoah assert_in_heap_bounds failed", + "oop must be in heap bounds", file, line); } } -void ShenandoahAsserts::assert_in_heap_or_null(void* interior_loc, oop obj, const char *file, int line) { +void ShenandoahAsserts::assert_in_heap_bounds_or_null(void* interior_loc, oop obj, const char *file, int line) { ShenandoahHeap* heap = ShenandoahHeap::heap(); - if (obj != nullptr && !heap->is_in(obj)) { - print_failure(_safe_unknown, obj, interior_loc, nullptr, "Shenandoah assert_in_heap_or_null failed", - "oop must point to a heap address", + if (obj != nullptr && !heap->is_in_reserved(obj)) { + print_failure(_safe_unknown, obj, interior_loc, nullptr, "Shenandoah assert_in_heap_bounds_or_null failed", + "oop must be in heap bounds", file, line); } } @@ -191,9 +191,9 @@ void ShenandoahAsserts::assert_correct(void* interior_loc, oop obj, const char* // Step 1. Check that obj is correct. // After this step, it is safe to call heap_region_containing(). - if (!heap->is_in(obj)) { + if (!heap->is_in_reserved(obj)) { print_failure(_safe_unknown, obj, interior_loc, nullptr, "Shenandoah assert_correct failed", - "oop must point to a heap address", + "oop must be in heap bounds", file, line); } @@ -210,6 +210,12 @@ void ShenandoahAsserts::assert_correct(void* interior_loc, oop obj, const char* file,line); } + if (!heap->is_in(obj)) { + print_failure(_safe_unknown, obj, interior_loc, nullptr, "Shenandoah assert_correct failed", + "Object should be in active region area", + file, line); + } + oop fwd = ShenandoahForwarding::get_forwardee_raw_unchecked(obj); if (obj != fwd) { @@ -223,9 +229,9 @@ void ShenandoahAsserts::assert_correct(void* interior_loc, oop obj, const char* } // Step 2. Check that forwardee is correct - if (!heap->is_in(fwd)) { + if (!heap->is_in_reserved(fwd)) { print_failure(_safe_oop, obj, interior_loc, nullptr, "Shenandoah assert_correct failed", - "Forwardee must point to a heap address", + "Forwardee must be in heap bounds", file, line); } @@ -236,9 +242,15 @@ void ShenandoahAsserts::assert_correct(void* interior_loc, oop obj, const char* } // Step 3. Check that forwardee points to correct region + if (!heap->is_in(fwd)) { + print_failure(_safe_oop, obj, interior_loc, nullptr, "Shenandoah assert_correct failed", + "Forwardee should be in active region area", + file, line); + } + if (heap->heap_region_index_containing(fwd) == heap->heap_region_index_containing(obj)) { print_failure(_safe_all, obj, interior_loc, nullptr, "Shenandoah assert_correct failed", - "Non-trivial forwardee should in another region", + "Non-trivial forwardee should be in another region", file, line); } diff --git a/src/hotspot/share/gc/shenandoah/shenandoahAsserts.hpp b/src/hotspot/share/gc/shenandoah/shenandoahAsserts.hpp index c730eafb89d0..154edebcf3ed 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahAsserts.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahAsserts.hpp @@ -53,8 +53,8 @@ class ShenandoahAsserts { static void print_rp_failure(const char *label, BoolObjectClosure* actual, const char *file, int line); - static void assert_in_heap(void* interior_loc, oop obj, const char* file, int line); - static void assert_in_heap_or_null(void* interior_loc, oop obj, const char* file, int line); + static void assert_in_heap_bounds(void* interior_loc, oop obj, const char* file, int line); + static void assert_in_heap_bounds_or_null(void* interior_loc, oop obj, const char* file, int line); static void assert_in_correct_region(void* interior_loc, oop obj, const char* file, int line); static void assert_correct(void* interior_loc, oop obj, const char* file, int line); @@ -74,10 +74,10 @@ class ShenandoahAsserts { static void assert_heaplocked_or_safepoint(const char* file, int line); #ifdef ASSERT -#define shenandoah_assert_in_heap(interior_loc, obj) \ - ShenandoahAsserts::assert_in_heap(interior_loc, obj, __FILE__, __LINE__) -#define shenandoah_assert_in_heap_or_null(interior_loc, obj) \ - ShenandoahAsserts::assert_in_heap_or_null(interior_loc, obj, __FILE__, __LINE__) +#define shenandoah_assert_in_heap_bounds(interior_loc, obj) \ + ShenandoahAsserts::assert_in_heap_bounds(interior_loc, obj, __FILE__, __LINE__) +#define shenandoah_assert_in_heap_bounds_or_null(interior_loc, obj) \ + ShenandoahAsserts::assert_in_heap_bounds_or_null(interior_loc, obj, __FILE__, __LINE__) #define shenandoah_assert_in_correct_region(interior_loc, obj) \ ShenandoahAsserts::assert_in_correct_region(interior_loc, obj, __FILE__, __LINE__) @@ -164,8 +164,8 @@ class ShenandoahAsserts { #define shenandoah_assert_heaplocked_or_safepoint() \ ShenandoahAsserts::assert_heaplocked_or_safepoint(__FILE__, __LINE__) #else -#define shenandoah_assert_in_heap(interior_loc, obj) -#define shenandoah_assert_in_heap_or_null(interior_loc, obj) +#define shenandoah_assert_in_heap_bounds(interior_loc, obj) +#define shenandoah_assert_in_heap_bounds_or_null(interior_loc, obj) #define shenandoah_assert_in_correct_region(interior_loc, obj) #define shenandoah_assert_correct_if(interior_loc, obj, condition) diff --git a/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.hpp b/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.hpp index 1d4dd7b9e3e5..beb6ae492b80 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahBarrierSet.hpp @@ -26,6 +26,7 @@ #define SHARE_GC_SHENANDOAH_SHENANDOAHBARRIERSET_HPP #include "gc/shared/barrierSet.hpp" +#include "gc/shared/bufferNode.hpp" #include "gc/shenandoah/shenandoahSATBMarkQueueSet.hpp" class ShenandoahHeap; diff --git a/src/hotspot/share/gc/shenandoah/shenandoahCollectionSet.inline.hpp b/src/hotspot/share/gc/shenandoah/shenandoahCollectionSet.inline.hpp index 6eb026561e46..cceebae0b1c6 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahCollectionSet.inline.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahCollectionSet.inline.hpp @@ -41,12 +41,12 @@ bool ShenandoahCollectionSet::is_in(ShenandoahHeapRegion* r) const { } bool ShenandoahCollectionSet::is_in(oop p) const { - shenandoah_assert_in_heap_or_null(nullptr, p); + shenandoah_assert_in_heap_bounds_or_null(nullptr, p); return is_in_loc(cast_from_oop(p)); } bool ShenandoahCollectionSet::is_in_loc(void* p) const { - assert(p == nullptr || _heap->is_in(p), "Must be in the heap"); + assert(p == nullptr || _heap->is_in_reserved(p), "Must be in the heap"); uintx index = ((uintx) p) >> _region_size_bytes_shift; // no need to subtract the bottom of the heap from p, // _biased_cset_map is biased diff --git a/src/hotspot/share/gc/shenandoah/shenandoahConcurrentGC.cpp b/src/hotspot/share/gc/shenandoah/shenandoahConcurrentGC.cpp index ec25cdf2a099..95320192526d 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahConcurrentGC.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahConcurrentGC.cpp @@ -699,7 +699,7 @@ void ShenandoahEvacUpdateCleanupOopStorageRootsClosure::do_oop(oop* p) { const oop obj = RawAccess<>::oop_load(p); if (!CompressedOops::is_null(obj)) { if (!_mark_context->is_marked(obj)) { - shenandoah_assert_correct(p, obj); + // Note: The obj is dead here. Do not touch it, just clear. ShenandoahHeap::atomic_clear_oop(p, obj); } else if (_evac_in_progress && _heap->in_collection_set(obj)) { oop resolved = ShenandoahBarrierSet::resolve_forwarded_not_null(obj); @@ -806,7 +806,7 @@ void ShenandoahConcurrentGC::op_weak_roots() { // Perform handshake to flush out dead oops { ShenandoahTimingsTracker t(ShenandoahPhaseTimings::conc_weak_roots_rendezvous); - heap->rendezvous_threads(); + heap->rendezvous_threads("Shenandoah Concurrent Weak Roots"); } } diff --git a/src/hotspot/share/gc/shenandoah/shenandoahConcurrentMark.cpp b/src/hotspot/share/gc/shenandoah/shenandoahConcurrentMark.cpp index f3c72dfc0b10..e362f89f2258 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahConcurrentMark.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahConcurrentMark.cpp @@ -186,7 +186,7 @@ class ShenandoahFlushSATBHandshakeClosure : public HandshakeClosure { SATBMarkQueueSet& _qset; public: ShenandoahFlushSATBHandshakeClosure(SATBMarkQueueSet& qset) : - HandshakeClosure("Shenandoah Flush SATB Handshake"), + HandshakeClosure("Shenandoah Flush SATB"), _qset(qset) {} void do_thread(Thread* thread) { diff --git a/src/hotspot/share/gc/shenandoah/shenandoahForwarding.inline.hpp b/src/hotspot/share/gc/shenandoah/shenandoahForwarding.inline.hpp index cf69eb67e475..01294f9c8908 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahForwarding.inline.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahForwarding.inline.hpp @@ -32,7 +32,7 @@ #include "runtime/javaThread.hpp" inline oop ShenandoahForwarding::get_forwardee_raw(oop obj) { - shenandoah_assert_in_heap(nullptr, obj); + shenandoah_assert_in_heap_bounds(nullptr, obj); return get_forwardee_raw_unchecked(obj); } diff --git a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp index 4540a3386c93..8a395b6f74f6 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.cpp @@ -710,9 +710,18 @@ size_t ShenandoahHeap::initial_capacity() const { } bool ShenandoahHeap::is_in(const void* p) const { - HeapWord* heap_base = (HeapWord*) base(); - HeapWord* last_region_end = heap_base + ShenandoahHeapRegion::region_size_words() * num_regions(); - return p >= heap_base && p < last_region_end; + if (is_in_reserved(p)) { + if (is_full_gc_move_in_progress()) { + // Full GC move is running, we do not have a consistent region + // information yet. But we know the pointer is in heap. + return true; + } + // Now check if we point to a live section in active region. + ShenandoahHeapRegion* r = heap_region_containing(p); + return (r->is_active() && p < r->top()); + } else { + return false; + } } void ShenandoahHeap::op_uncommit(double shrink_before, size_t shrink_until) { @@ -1568,12 +1577,12 @@ class ShenandoahInitMarkUpdateRegionStateClosure : public ShenandoahHeapRegionCl class ShenandoahRendezvousClosure : public HandshakeClosure { public: - inline ShenandoahRendezvousClosure() : HandshakeClosure("ShenandoahRendezvous") {} + inline ShenandoahRendezvousClosure(const char* name) : HandshakeClosure(name) {} inline void do_thread(Thread* thread) {} }; -void ShenandoahHeap::rendezvous_threads() { - ShenandoahRendezvousClosure cl; +void ShenandoahHeap::rendezvous_threads(const char* name) { + ShenandoahRendezvousClosure cl(name); Handshake::execute(&cl); } diff --git a/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp b/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp index 8b5281026657..3aa33e8ecee1 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahHeap.hpp @@ -374,7 +374,7 @@ class ShenandoahHeap : public CollectedHeap { void update_heap_region_states(bool concurrent); void rebuild_free_set(bool concurrent); - void rendezvous_threads(); + void rendezvous_threads(const char* name); void recycle_trash(); public: void notify_gc_progress() { _progress_last_gc.set(); } @@ -469,6 +469,8 @@ class ShenandoahHeap : public CollectedHeap { public: bool is_maximal_no_gc() const override shenandoah_not_implemented_return(false); + // Check the pointer is in active part of Java heap. + // Use is_in_reserved to check if object is within heap bounds. bool is_in(const void* p) const override; bool requires_barriers(stackChunkOop obj) const override; diff --git a/src/hotspot/share/gc/shenandoah/shenandoahMarkBitMap.cpp b/src/hotspot/share/gc/shenandoah/shenandoahMarkBitMap.cpp index 30389b4e95cd..fa2e15a98c74 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahMarkBitMap.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahMarkBitMap.cpp @@ -122,7 +122,7 @@ void ShenandoahMarkBitMap::clear_range_large(MemRegion mr) { #ifdef ASSERT void ShenandoahMarkBitMap::check_mark(HeapWord* addr) const { - assert(ShenandoahHeap::heap()->is_in(addr), + assert(ShenandoahHeap::heap()->is_in_reserved(addr), "Trying to access bitmap " PTR_FORMAT " for address " PTR_FORMAT " not in the heap.", p2i(this), p2i(addr)); } diff --git a/src/hotspot/share/gc/shenandoah/shenandoahMarkingContext.hpp b/src/hotspot/share/gc/shenandoah/shenandoahMarkingContext.hpp index d58117c02e2d..62baf3e61eae 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahMarkingContext.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahMarkingContext.hpp @@ -63,8 +63,10 @@ class ShenandoahMarkingContext : public CHeapObj { inline bool mark_weak(oop obj); // Simple versions of marking accessors, to be used outside of marking (e.g. no possible concurrent updates) - inline bool is_marked(oop) const; + inline bool is_marked(oop obj) const; + inline bool is_marked(HeapWord* raw_obj) const; inline bool is_marked_strong(oop obj) const; + inline bool is_marked_strong(HeapWord* raw_obj) const; inline bool is_marked_weak(oop obj) const; inline HeapWord* get_next_marked_addr(HeapWord* addr, HeapWord* limit) const; diff --git a/src/hotspot/share/gc/shenandoah/shenandoahMarkingContext.inline.hpp b/src/hotspot/share/gc/shenandoah/shenandoahMarkingContext.inline.hpp index 34b8288f4767..1ba3caf26b72 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahMarkingContext.inline.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahMarkingContext.inline.hpp @@ -38,11 +38,19 @@ inline bool ShenandoahMarkingContext::mark_weak(oop obj) { } inline bool ShenandoahMarkingContext::is_marked(oop obj) const { - return allocated_after_mark_start(obj) || _mark_bit_map.is_marked(cast_from_oop(obj)); + return is_marked(cast_from_oop(obj)); +} + +inline bool ShenandoahMarkingContext::is_marked(HeapWord* raw_obj) const { + return allocated_after_mark_start(raw_obj) || _mark_bit_map.is_marked(raw_obj); } inline bool ShenandoahMarkingContext::is_marked_strong(oop obj) const { - return allocated_after_mark_start(obj) || _mark_bit_map.is_marked_strong(cast_from_oop(obj)); + return is_marked_strong(cast_from_oop(obj)); +} + +inline bool ShenandoahMarkingContext::is_marked_strong(HeapWord* raw_obj) const { + return allocated_after_mark_start(raw_obj) || _mark_bit_map.is_marked_strong(raw_obj); } inline bool ShenandoahMarkingContext::is_marked_weak(oop obj) const { diff --git a/src/hotspot/share/gc/shenandoah/shenandoahReferenceProcessor.cpp b/src/hotspot/share/gc/shenandoah/shenandoahReferenceProcessor.cpp index 0bd92da1b5d1..7f669845e7b0 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahReferenceProcessor.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahReferenceProcessor.cpp @@ -83,10 +83,21 @@ static volatile T* reference_referent_addr(oop reference) { return (volatile T*)java_lang_ref_Reference::referent_addr_raw(reference); } +inline oop reference_coop_decode_raw(narrowOop v) { + return CompressedOops::is_null(v) ? nullptr : CompressedOops::decode_raw(v); +} + +inline oop reference_coop_decode_raw(oop v) { + return v; +} + +// Raw referent, it can be dead. You cannot treat it as oop without additional safety +// checks, this is why it is HeapWord*. The decoding uses a special-case inlined +// CompressedOops::decode method that bypasses normal oop-ness checks. template -static oop reference_referent(oop reference) { - T heap_oop = Atomic::load(reference_referent_addr(reference)); - return CompressedOops::decode(heap_oop); +static HeapWord* reference_referent_raw(oop reference) { + T raw_oop = Atomic::load(reference_referent_addr(reference)); + return cast_from_oop(reference_coop_decode_raw(raw_oop)); } static void reference_clear_referent(oop reference) { @@ -278,8 +289,8 @@ bool ShenandoahReferenceProcessor::should_discover(oop reference, ReferenceType template bool ShenandoahReferenceProcessor::should_drop(oop reference, ReferenceType type) const { - const oop referent = reference_referent(reference); - if (referent == nullptr) { + HeapWord* raw_referent = reference_referent_raw(reference); + if (raw_referent == nullptr) { // Reference has been cleared, by a call to Reference.enqueue() // or Reference.clear() from the application, which means we // should drop the reference. @@ -289,9 +300,9 @@ bool ShenandoahReferenceProcessor::should_drop(oop reference, ReferenceType type // Check if the referent is still alive, in which case we should // drop the reference. if (type == REF_PHANTOM) { - return ShenandoahHeap::heap()->complete_marking_context()->is_marked(referent); + return ShenandoahHeap::heap()->complete_marking_context()->is_marked(raw_referent); } else { - return ShenandoahHeap::heap()->complete_marking_context()->is_marked_strong(referent); + return ShenandoahHeap::heap()->complete_marking_context()->is_marked_strong(raw_referent); } } @@ -303,7 +314,7 @@ void ShenandoahReferenceProcessor::make_inactive(oop reference, ReferenceType ty // next field. An application can't call FinalReference.enqueue(), so there is // no race to worry about when setting the next field. assert(reference_next(reference) == nullptr, "Already inactive"); - assert(ShenandoahHeap::heap()->marking_context()->is_marked(reference_referent(reference)), "only make inactive final refs with alive referents"); + assert(ShenandoahHeap::heap()->marking_context()->is_marked(reference_referent_raw(reference)), "only make inactive final refs with alive referents"); reference_set_next(reference, reference); } else { // Clear referent @@ -376,8 +387,8 @@ oop ShenandoahReferenceProcessor::drop(oop reference, ReferenceType type) { log_trace(gc, ref)("Dropped Reference: " PTR_FORMAT " (%s)", p2i(reference), reference_type_name(type)); #ifdef ASSERT - oop referent = reference_referent(reference); - assert(referent == nullptr || ShenandoahHeap::heap()->marking_context()->is_marked(referent), + HeapWord* raw_referent = reference_referent_raw(reference); + assert(raw_referent == nullptr || ShenandoahHeap::heap()->marking_context()->is_marked(raw_referent), "only drop references with alive referents"); #endif diff --git a/src/hotspot/share/gc/shenandoah/shenandoahSATBMarkQueueSet.hpp b/src/hotspot/share/gc/shenandoah/shenandoahSATBMarkQueueSet.hpp index 9e4984a325f3..bda7e9b95456 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahSATBMarkQueueSet.hpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahSATBMarkQueueSet.hpp @@ -25,6 +25,7 @@ #ifndef SHARE_GC_SHENANDOAH_SHENANDOAHSATBMARKQUEUESET_HPP #define SHARE_GC_SHENANDOAH_SHENANDOAHSATBMARKQUEUESET_HPP +#include "gc/shared/bufferNode.hpp" #include "gc/shared/satbMarkQueue.hpp" #include "gc/shenandoah/shenandoahHeap.hpp" #include "runtime/javaThread.hpp" diff --git a/src/hotspot/share/gc/shenandoah/shenandoahUnload.cpp b/src/hotspot/share/gc/shenandoah/shenandoahUnload.cpp index bb13e9b8e224..b460151840d4 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahUnload.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahUnload.cpp @@ -171,7 +171,7 @@ void ShenandoahUnload::unload() { // Make sure stale metadata and nmethods are no longer observable { ShenandoahTimingsTracker t(ShenandoahPhaseTimings::conc_class_unload_rendezvous); - heap->rendezvous_threads(); + heap->rendezvous_threads("Shenandoah Class Unloading"); } // Purge stale metadata and nmethods that were unlinked diff --git a/src/hotspot/share/gc/shenandoah/shenandoahVerifier.cpp b/src/hotspot/share/gc/shenandoah/shenandoahVerifier.cpp index f67cafdb8fe7..159cbf7b6034 100644 --- a/src/hotspot/share/gc/shenandoah/shenandoahVerifier.cpp +++ b/src/hotspot/share/gc/shenandoah/shenandoahVerifier.cpp @@ -51,13 +51,6 @@ static bool is_instance_ref_klass(Klass* k) { return k->is_instance_klass() && InstanceKlass::cast(k)->reference_type() != REF_NONE; } -class ShenandoahIgnoreReferenceDiscoverer : public ReferenceDiscoverer { -public: - virtual bool discover_reference(oop obj, ReferenceType type) { - return true; - } -}; - class ShenandoahVerifyOopClosure : public BasicOopIterateClosure { private: const char* _phase; @@ -68,6 +61,7 @@ class ShenandoahVerifyOopClosure : public BasicOopIterateClosure { ShenandoahLivenessData* _ld; void* _interior_loc; oop _loc; + ReferenceIterationMode _ref_mode; public: ShenandoahVerifyOopClosure(ShenandoahVerifierStack* stack, MarkBitMap* map, ShenandoahLivenessData* ld, @@ -82,10 +76,20 @@ class ShenandoahVerifyOopClosure : public BasicOopIterateClosure { _loc(nullptr) { if (options._verify_marked == ShenandoahVerifier::_verify_marked_complete_except_references || options._verify_marked == ShenandoahVerifier::_verify_marked_disable) { - set_ref_discoverer_internal(new ShenandoahIgnoreReferenceDiscoverer()); + // Unknown status for Reference.referent field. Do not touch it, it might be dead. + // Normally, barriers would prevent us from seeing the dead referents, but verifier + // runs with barriers disabled. + _ref_mode = DO_FIELDS_EXCEPT_REFERENT; + } else { + // Otherwise do all fields. + _ref_mode = DO_FIELDS; } } + ReferenceIterationMode reference_iteration_mode() override { + return _ref_mode; + } + private: void check(ShenandoahAsserts::SafeLevel level, oop obj, bool test, const char* label) { if (!test) { @@ -119,8 +123,8 @@ class ShenandoahVerifyOopClosure : public BasicOopIterateClosure { // that failure report would not try to touch something that was not yet verified to be // safe to process. - check(ShenandoahAsserts::_safe_unknown, obj, _heap->is_in(obj), - "oop must be in heap"); + check(ShenandoahAsserts::_safe_unknown, obj, _heap->is_in_reserved(obj), + "oop must be in heap bounds"); check(ShenandoahAsserts::_safe_unknown, obj, is_object_aligned(obj), "oop must be aligned"); @@ -177,8 +181,8 @@ class ShenandoahVerifyOopClosure : public BasicOopIterateClosure { ShenandoahHeapRegion* fwd_reg = nullptr; if (obj != fwd) { - check(ShenandoahAsserts::_safe_oop, obj, _heap->is_in(fwd), - "Forwardee must be in heap"); + check(ShenandoahAsserts::_safe_oop, obj, _heap->is_in_reserved(fwd), + "Forwardee must be in heap bounds"); check(ShenandoahAsserts::_safe_oop, obj, !CompressedOops::is_null(fwd), "Forwardee is set"); check(ShenandoahAsserts::_safe_oop, obj, is_object_aligned(fwd), @@ -195,6 +199,9 @@ class ShenandoahVerifyOopClosure : public BasicOopIterateClosure { fwd_reg = _heap->heap_region_containing(fwd); + check(ShenandoahAsserts::_safe_oop, obj, fwd_reg->is_active(), + "Forwardee should be in active region"); + // Verify that forwardee is not in the dead space: check(ShenandoahAsserts::_safe_oop, obj, !fwd_reg->is_humongous(), "Should have no humongous forwardees"); @@ -309,8 +316,8 @@ class ShenandoahVerifyOopClosure : public BasicOopIterateClosure { _loc = nullptr; } - virtual void do_oop(oop* p) { do_oop_work(p); } - virtual void do_oop(narrowOop* p) { do_oop_work(p); } + virtual void do_oop(oop* p) override { do_oop_work(p); } + virtual void do_oop(narrowOop* p) override { do_oop_work(p); } }; class ShenandoahCalculateRegionStatsClosure : public ShenandoahHeapRegionClosure { diff --git a/src/hotspot/share/gc/z/zDirector.cpp b/src/hotspot/share/gc/z/zDirector.cpp index 2b0e70a0016a..8944799fb944 100644 --- a/src/hotspot/share/gc/z/zDirector.cpp +++ b/src/hotspot/share/gc/z/zDirector.cpp @@ -33,6 +33,8 @@ #include "gc/z/zStat.hpp" #include "logging/log.hpp" +#include + ZDirector* ZDirector::_director; constexpr double one_in_1000 = 3.290527; @@ -453,16 +455,22 @@ static double calculate_extra_young_gc_time(const ZDirectorStats& stats) { // relocation headroom into account to avoid in-place relocation. const size_t old_used = stats._old_stats._general._used; const size_t old_live = stats._old_stats._stat_heap._live_at_mark_end; - const size_t old_garbage = old_used - old_live; + const double old_garbage = double(old_used - old_live); const double young_gc_time = gc_time(stats._young_stats); // Calculate how much memory young collections are predicted to free. - const size_t reclaimed_per_young_gc = stats._young_stats._stat_heap._reclaimed_avg; + const double reclaimed_per_young_gc = stats._young_stats._stat_heap._reclaimed_avg; // Calculate current YC time and predicted YC time after an old collection. - const double current_young_gc_time_per_bytes_freed = double(young_gc_time) / double(reclaimed_per_young_gc); - const double potential_young_gc_time_per_bytes_freed = double(young_gc_time) / double(reclaimed_per_young_gc + old_garbage); + const double current_young_gc_time_per_bytes_freed = young_gc_time / reclaimed_per_young_gc; + const double potential_young_gc_time_per_bytes_freed = young_gc_time / (reclaimed_per_young_gc + old_garbage); + + if (current_young_gc_time_per_bytes_freed == std::numeric_limits::infinity()) { + // Young collection's are not reclaiming any memory. Return infinity as a signal + // to trigger an old collection, regardless of the amount of old garbage. + return std::numeric_limits::infinity(); + } // Calculate extra time per young collection inflicted by *not* doing an // old collection that frees up memory in the old generation. @@ -483,13 +491,12 @@ static bool rule_major_allocation_rate(const ZDirectorStats& stats) { const double young_gc_time = gc_time(stats._young_stats); // Calculate how much memory collections are predicted to free. - const size_t reclaimed_per_young_gc = stats._young_stats._stat_heap._reclaimed_avg; - const size_t reclaimed_per_old_gc = stats._old_stats._stat_heap._reclaimed_avg; + const double reclaimed_per_young_gc = stats._young_stats._stat_heap._reclaimed_avg; + const double reclaimed_per_old_gc = stats._old_stats._stat_heap._reclaimed_avg; // Calculate the GC cost for each reclaimed byte - const double current_young_gc_time_per_bytes_freed = double(young_gc_time) / double(reclaimed_per_young_gc); - const double current_old_gc_time_per_bytes_freed = reclaimed_per_old_gc == 0 ? std::numeric_limits::infinity() - : (double(old_gc_time) / double(reclaimed_per_old_gc)); + const double current_young_gc_time_per_bytes_freed = young_gc_time / reclaimed_per_young_gc; + const double current_old_gc_time_per_bytes_freed = old_gc_time / reclaimed_per_old_gc; // Calculate extra time per young collection inflicted by *not* doing an // old collection that frees up memory in the old generation. @@ -531,10 +538,10 @@ static double calculate_young_to_old_worker_ratio(const ZDirectorStats& stats) { const double young_gc_time = gc_time(stats._young_stats); const double old_gc_time = gc_time(stats._old_stats); - const size_t reclaimed_per_young_gc = stats._young_stats._stat_heap._reclaimed_avg; - const size_t reclaimed_per_old_gc = stats._old_stats._stat_heap._reclaimed_avg; - const double current_young_bytes_freed_per_gc_time = double(reclaimed_per_young_gc) / double(young_gc_time); - const double current_old_bytes_freed_per_gc_time = double(reclaimed_per_old_gc) / double(old_gc_time); + const double reclaimed_per_young_gc = stats._young_stats._stat_heap._reclaimed_avg; + const double reclaimed_per_old_gc = stats._old_stats._stat_heap._reclaimed_avg; + const double current_young_bytes_freed_per_gc_time = reclaimed_per_young_gc / young_gc_time; + const double current_old_bytes_freed_per_gc_time = reclaimed_per_old_gc / old_gc_time; if (current_young_bytes_freed_per_gc_time == 0.0) { if (current_old_bytes_freed_per_gc_time == 0.0) { diff --git a/src/hotspot/share/gc/z/zStat.cpp b/src/hotspot/share/gc/z/zStat.cpp index d838cb0b8138..d2730b156848 100644 --- a/src/hotspot/share/gc/z/zStat.cpp +++ b/src/hotspot/share/gc/z/zStat.cpp @@ -46,6 +46,8 @@ #include "utilities/debug.hpp" #include "utilities/ticks.hpp" +#include + #define ZSIZE_FMT SIZE_FORMAT "M(%.0f%%)" #define ZSIZE_ARGS_WITH_MAX(size, max) ((size) / M), (percent_of(size, max)) #define ZSIZE_ARGS(size) ZSIZE_ARGS_WITH_MAX(size, ZStatHeap::max_capacity()) @@ -1845,8 +1847,9 @@ void ZStatHeap::at_relocate_end(const ZPageAllocatorStats& stats, bool record_st } } -size_t ZStatHeap::reclaimed_avg() { - return _reclaimed_bytes.davg(); +double ZStatHeap::reclaimed_avg() { + // Make sure the reclaimed average is greater than 0.0 to avoid division by zero. + return _reclaimed_bytes.davg() + std::numeric_limits::denorm_min(); } size_t ZStatHeap::max_capacity() { diff --git a/src/hotspot/share/gc/z/zStat.hpp b/src/hotspot/share/gc/z/zStat.hpp index 346773c3b7e2..ee6e90ce80c2 100644 --- a/src/hotspot/share/gc/z/zStat.hpp +++ b/src/hotspot/share/gc/z/zStat.hpp @@ -587,7 +587,7 @@ class ZStatReferences : public AllStatic { struct ZStatHeapStats { size_t _live_at_mark_end; size_t _used_at_relocate_end; - size_t _reclaimed_avg; + double _reclaimed_avg; }; // @@ -698,7 +698,7 @@ class ZStatHeap { size_t stalls_at_relocate_start() const; size_t stalls_at_relocate_end() const; - size_t reclaimed_avg(); + double reclaimed_avg(); ZStatHeapStats stats(); diff --git a/src/hotspot/share/interpreter/bytecode.hpp b/src/hotspot/share/interpreter/bytecode.hpp index d9943aa74126..45f352ccd6f3 100644 --- a/src/hotspot/share/interpreter/bytecode.hpp +++ b/src/hotspot/share/interpreter/bytecode.hpp @@ -233,6 +233,8 @@ class Bytecode_invoke: public Bytecode_member_ref { bool has_appendix(); + bool has_member_arg() const; + int size_of_parameters() const; private: diff --git a/src/hotspot/share/interpreter/bytecode.inline.hpp b/src/hotspot/share/interpreter/bytecode.inline.hpp index 9e38428c1606..b4b9d50a092f 100644 --- a/src/hotspot/share/interpreter/bytecode.inline.hpp +++ b/src/hotspot/share/interpreter/bytecode.inline.hpp @@ -28,6 +28,7 @@ #include "interpreter/bytecode.hpp" #include "oops/cpCache.inline.hpp" +#include "prims/methodHandles.hpp" inline bool Bytecode_invoke::has_appendix() { if (invoke_code() == Bytecodes::_invokedynamic) { @@ -37,4 +38,13 @@ inline bool Bytecode_invoke::has_appendix() { } } +inline bool Bytecode_invoke::has_member_arg() const { + // NOTE: We could resolve the call and use the resolved adapter method here, but this function + // is used by deoptimization, where resolving could lead to problems, so we avoid that here + // by doing things symbolically. + // + // invokedynamic instructions don't have a class but obviously don't have a MemberName appendix. + return !is_invokedynamic() && MethodHandles::has_member_arg(klass(), name()); +} + #endif // SHARE_INTERPRETER_BYTECODE_INLINE_HPP diff --git a/src/hotspot/share/jfr/leakprofiler/leakProfiler.cpp b/src/hotspot/share/jfr/leakprofiler/leakProfiler.cpp index 895eafc44099..cf69dd56934e 100644 --- a/src/hotspot/share/jfr/leakprofiler/leakProfiler.cpp +++ b/src/hotspot/share/jfr/leakprofiler/leakProfiler.cpp @@ -34,6 +34,15 @@ #include "runtime/javaThread.inline.hpp" #include "runtime/vmThread.hpp" +bool LeakProfiler::is_supported() { + if (UseShenandoahGC) { + // Leak Profiler uses mark words in the ways that might interfere + // with concurrent GC uses of them. This affects Shenandoah. + return false; + } + return true; +} + bool LeakProfiler::is_running() { return ObjectSampler::is_created(); } @@ -48,6 +57,12 @@ bool LeakProfiler::start(int sample_count) { return false; } + // Exit cleanly if not supported + if (!is_supported()) { + log_trace(jfr, system)("Object sampling is not supported"); + return false; + } + assert(!is_running(), "invariant"); assert(sample_count > 0, "invariant"); diff --git a/src/hotspot/share/jfr/leakprofiler/leakProfiler.hpp b/src/hotspot/share/jfr/leakprofiler/leakProfiler.hpp index 6290a10ff748..08544f439488 100644 --- a/src/hotspot/share/jfr/leakprofiler/leakProfiler.hpp +++ b/src/hotspot/share/jfr/leakprofiler/leakProfiler.hpp @@ -35,6 +35,7 @@ class LeakProfiler : public AllStatic { static bool start(int sample_count); static bool stop(); static bool is_running(); + static bool is_supported(); static void emit_events(int64_t cutoff_ticks, bool emit_all, bool skip_bfs); static void sample(HeapWord* object, size_t size, JavaThread* thread); diff --git a/src/hotspot/share/jfr/periodic/sampling/jfrThreadSampler.cpp b/src/hotspot/share/jfr/periodic/sampling/jfrThreadSampler.cpp index bda6acbc800b..fda0e12fd3ab 100644 --- a/src/hotspot/share/jfr/periodic/sampling/jfrThreadSampler.cpp +++ b/src/hotspot/share/jfr/periodic/sampling/jfrThreadSampler.cpp @@ -23,6 +23,7 @@ */ #include "precompiled.hpp" +#include "classfile/javaThreadStatus.hpp" #include "jfr/jfrEvents.hpp" #include "jfr/recorder/jfrRecorder.hpp" #include "jfr/periodic/sampling/jfrCallTrace.hpp" @@ -200,7 +201,7 @@ void OSThreadSampler::protected_task(const SuspendedThreadTaskContext& context) ev->set_starttime(_suspend_time); ev->set_endtime(_suspend_time); // fake to not take an end time ev->set_sampledThread(JfrThreadLocal::thread_id(jt)); - ev->set_state(static_cast(java_lang_Thread::get_thread_status(_thread_oop))); + ev->set_state(static_cast(JavaThreadStatus::RUNNABLE)); } } } @@ -230,7 +231,7 @@ static void write_native_event(JfrThreadSampleClosure& closure, JavaThread* jt, EventNativeMethodSample *ev = closure.next_event_native(); ev->set_starttime(JfrTicks::now()); ev->set_sampledThread(JfrThreadLocal::thread_id(jt)); - ev->set_state(static_cast(java_lang_Thread::get_thread_status(thread_oop))); + ev->set_state(static_cast(JavaThreadStatus::RUNNABLE)); } void JfrNativeSamplerCallback::call() { diff --git a/src/hotspot/share/jfr/recorder/service/jfrRecorderService.cpp b/src/hotspot/share/jfr/recorder/service/jfrRecorderService.cpp index 3c6d004650b4..f5d0028ee173 100644 --- a/src/hotspot/share/jfr/recorder/service/jfrRecorderService.cpp +++ b/src/hotspot/share/jfr/recorder/service/jfrRecorderService.cpp @@ -392,14 +392,22 @@ static u4 write_metadata(JfrChunkWriter& chunkwriter) { return invoke(wm); } -template -class JfrVMOperation : public VM_Operation { +class JfrSafepointClearVMOperation : public VM_Operation { private: - Instance& _instance; + JfrRecorderService& _instance; + public: + JfrSafepointClearVMOperation(JfrRecorderService& instance) : _instance(instance) {} + void doit() { _instance.safepoint_clear(); } + VMOp_Type type() const { return VMOp_JFRSafepointClear; } +}; + +class JfrSafepointWriteVMOperation : public VM_Operation { + private: + JfrRecorderService& _instance; public: - JfrVMOperation(Instance& instance) : _instance(instance) {} - void doit() { (_instance.*func)(); } - VMOp_Type type() const { return VMOp_JFRCheckpoint; } + JfrSafepointWriteVMOperation(JfrRecorderService& instance) : _instance(instance) {} + void doit() { _instance.safepoint_write(); } + VMOp_Type type() const { return VMOp_JFRSafepointWrite; } }; JfrRecorderService::JfrRecorderService() : @@ -468,9 +476,9 @@ void JfrRecorderService::pre_safepoint_clear() { } void JfrRecorderService::invoke_safepoint_clear() { - JfrVMOperation safepoint_task(*this); + JfrSafepointClearVMOperation op(*this); ThreadInVMfromNative transition(JavaThread::current()); - VMThread::execute(&safepoint_task); + VMThread::execute(&op); } void JfrRecorderService::safepoint_clear() { @@ -573,10 +581,10 @@ void JfrRecorderService::pre_safepoint_write() { } void JfrRecorderService::invoke_safepoint_write() { - JfrVMOperation safepoint_task(*this); + JfrSafepointWriteVMOperation op(*this); // can safepoint here ThreadInVMfromNative transition(JavaThread::current()); - VMThread::execute(&safepoint_task); + VMThread::execute(&op); } void JfrRecorderService::safepoint_write() { diff --git a/src/hotspot/share/jfr/recorder/service/jfrRecorderService.hpp b/src/hotspot/share/jfr/recorder/service/jfrRecorderService.hpp index 3daa96b8e1f6..4bf4f00b7c0c 100644 --- a/src/hotspot/share/jfr/recorder/service/jfrRecorderService.hpp +++ b/src/hotspot/share/jfr/recorder/service/jfrRecorderService.hpp @@ -35,6 +35,8 @@ class JfrStorage; class JfrStringPool; class JfrRecorderService : public StackObj { + friend class JfrSafepointClearVMOperation; + friend class JfrSafepointWriteVMOperation; private: JfrCheckpointManager& _checkpoint_manager; JfrChunkWriter& _chunkwriter; diff --git a/src/hotspot/share/jfr/support/jfrJdkJfrEvent.cpp b/src/hotspot/share/jfr/support/jfrJdkJfrEvent.cpp index 5388349c3f6b..a524ab7af54a 100644 --- a/src/hotspot/share/jfr/support/jfrJdkJfrEvent.cpp +++ b/src/hotspot/share/jfr/support/jfrJdkJfrEvent.cpp @@ -136,7 +136,9 @@ jobject JdkJfrEvent::get_all_klasses(TRAPS) { transform_klasses_to_local_jni_handles(event_subklasses, THREAD); Handle h_array_list(THREAD, new_java_util_arraylist(THREAD)); - assert(h_array_list.not_null(), "invariant"); + if (h_array_list.is_null()) { + return empty_java_util_arraylist; + } static const char add_method_name[] = "add"; static const char add_method_signature[] = "(Ljava/lang/Object;)Z"; diff --git a/src/hotspot/share/logging/logAsyncWriter.hpp b/src/hotspot/share/logging/logAsyncWriter.hpp index 02397f633f7f..413d7417c2f2 100644 --- a/src/hotspot/share/logging/logAsyncWriter.hpp +++ b/src/hotspot/share/logging/logAsyncWriter.hpp @@ -172,7 +172,6 @@ class AsyncLogWriter : public NonJavaThread { NonJavaThread::pre_run(); log_debug(logging, thread)("starting AsyncLog Thread tid = " INTX_FORMAT, os::current_thread_id()); } - const char* name() const override { return "AsyncLog Thread"; } const char* type_name() const override { return "AsyncLogWriter"; } void print_on(outputStream* st) const override { st->print("\"%s\" ", name()); @@ -197,6 +196,8 @@ class AsyncLogWriter : public NonJavaThread { static AsyncLogWriter* instance(); static void initialize(); static void flush(); + + const char* name() const override { return "AsyncLog Thread"; } }; #endif // SHARE_LOGGING_LOGASYNCWRITER_HPP diff --git a/src/hotspot/share/memory/universe.cpp b/src/hotspot/share/memory/universe.cpp index f202c93e917c..7a61b1125571 100644 --- a/src/hotspot/share/memory/universe.cpp +++ b/src/hotspot/share/memory/universe.cpp @@ -145,6 +145,9 @@ Array* Universe::_the_empty_klass_array = nullptr; Array* Universe::_the_empty_instance_klass_array = nullptr; Array* Universe::_the_empty_method_array = nullptr; +uintx Universe::_the_array_interfaces_bitmap = 0; +uintx Universe::_the_empty_klass_bitmap = 0; + // These variables are guarded by FullGCALot_lock. debug_only(OopHandle Universe::_fullgc_alot_dummy_array;) debug_only(int Universe::_fullgc_alot_dummy_next = 0;) @@ -379,6 +382,11 @@ void Universe::genesis(TRAPS) { _the_array_interfaces_array->at_put(1, vmClasses::Serializable_klass()); } + if (UseSecondarySupersTable) { + Universe::_the_array_interfaces_bitmap = Klass::compute_secondary_supers_bitmap(_the_array_interfaces_array); + Universe::_the_empty_klass_bitmap = Klass::compute_secondary_supers_bitmap(_the_empty_klass_array); + } + initialize_basic_type_klass(_fillerArrayKlassObj, CHECK); initialize_basic_type_klass(boolArrayKlassObj(), CHECK); diff --git a/src/hotspot/share/memory/universe.hpp b/src/hotspot/share/memory/universe.hpp index b8e72c596cf7..d05654fe4a6e 100644 --- a/src/hotspot/share/memory/universe.hpp +++ b/src/hotspot/share/memory/universe.hpp @@ -128,6 +128,9 @@ class Universe: AllStatic { static Array* _the_array_interfaces_array; + static uintx _the_array_interfaces_bitmap; + static uintx _the_empty_klass_bitmap; + // array of preallocated error objects with backtrace static OopHandle _preallocated_out_of_memory_error_array; @@ -274,8 +277,9 @@ class Universe: AllStatic { static oop arithmetic_exception_instance(); static oop virtual_machine_error_instance(); static oop vm_exception() { return virtual_machine_error_instance(); } + static Array* the_array_interfaces_array() { return _the_array_interfaces_array; } + static uintx the_array_interfaces_bitmap() { return _the_array_interfaces_bitmap; } - static Array* the_array_interfaces_array() { return _the_array_interfaces_array; } static Method* finalizer_register_method() { return _finalizer_register_cache->get_method(); } static Method* loader_addClass_method() { return _loader_addClass_cache->get_method(); } @@ -311,6 +315,8 @@ class Universe: AllStatic { static Array* the_empty_klass_array() { return _the_empty_klass_array; } static Array* the_empty_instance_klass_array() { return _the_empty_instance_klass_array; } + static uintx the_empty_klass_bitmap() { return _the_empty_klass_bitmap; } + // OutOfMemoryError support. Returns an error with the required message. The returned error // may or may not have a backtrace. If error has a backtrace then the stack trace is already // filled in. diff --git a/src/hotspot/share/nmt/memFlagBitmap.hpp b/src/hotspot/share/nmt/memFlagBitmap.hpp new file mode 100644 index 000000000000..878155369807 --- /dev/null +++ b/src/hotspot/share/nmt/memFlagBitmap.hpp @@ -0,0 +1,54 @@ +/* + * Copyright (c) 2022, 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_NMT_MEMFLAGBITMAP_HPP +#define SHARE_NMT_MEMFLAGBITMAP_HPP + +#include "memory/allocation.hpp" // for mt_number_of_types +#include "utilities/globalDefinitions.hpp" + +class MemFlagBitmap { + uint32_t _v; + STATIC_ASSERT(sizeof(_v) * BitsPerByte >= mt_number_of_types); + +public: + MemFlagBitmap(uint32_t v = 0) : _v(v) {} + MemFlagBitmap(const MemFlagBitmap& o) : _v(o._v) {} + + uint32_t raw_value() const { return _v; } + + void set_flag(MEMFLAGS f) { + const int bitno = (int)f; + _v |= nth_bit(bitno); + } + + bool has_flag(MEMFLAGS f) const { + const int bitno = (int)f; + return _v & nth_bit(bitno); + } + + bool has_any() const { return _v > 0; } +}; + +#endif // SHARE_NMT_NMTUSAGE_HPP diff --git a/src/hotspot/share/nmt/memMapPrinter.cpp b/src/hotspot/share/nmt/memMapPrinter.cpp new file mode 100644 index 000000000000..ce23997d1547 --- /dev/null +++ b/src/hotspot/share/nmt/memMapPrinter.cpp @@ -0,0 +1,280 @@ +/* + * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, Red Hat, Inc. and/or its affiliates. + * 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" + +#ifdef LINUX + +#include "gc/shared/collectedHeap.hpp" +#include "logging/logAsyncWriter.hpp" +#include "memory/allocation.hpp" +#include "memory/universe.hpp" +#include "runtime/nonJavaThread.hpp" +#include "runtime/osThread.hpp" +#include "runtime/thread.hpp" +#include "runtime/threadSMR.hpp" +#include "runtime/vmThread.hpp" +#include "nmt/memFlagBitmap.hpp" +#include "nmt/memMapPrinter.hpp" +#include "services/memTracker.hpp" +#include "services/virtualMemoryTracker.hpp" +#include "utilities/globalDefinitions.hpp" +#include "utilities/ostream.hpp" + +// Note: throughout this code we will use the term "VMA" for OS system level memory mapping + +/// NMT mechanics + +// Short, clear, descriptive names for all possible markers. Note that we only expect to see +// those that have been used with mmap. Flags left out are printed with their nmt flag name. +#define NMT_FLAGS_DO(f) \ + /* flag, short, description */ \ + f(mtGCCardSet, "CARDTBL", "GC Card table") \ + f(mtClassShared, "CDS", "CDS archives") \ + f(mtClass, "CLASS", "Class Space") \ + f(mtCode, "CODE", "Code Heap") \ + f(mtGC, "GC", "GC support data (e.g. bitmaps)") \ + f(mtInternal, "INTERN", "Internal") \ + f(mtJavaHeap, "JAVAHEAP", "Java Heap") \ + f(mtOther, "JDK", "allocated by JDK libraries other than VM") \ + f(mtMetaspace, "META", "Metaspace nodes (non-class)") \ + f(mtSafepoint, "POLL", "Polling pages") \ + f(mtThreadStack, "STACK", "(known) Thread Stack") \ + f(mtTest, "TEST", "JVM internal test mappings") + //end + +static const char* get_shortname_for_nmt_flag(MEMFLAGS f) { +#define DO(flag, shortname, text) if (flag == f) return shortname; + NMT_FLAGS_DO(DO) +#undef DO + return NMTUtil::flag_to_enum_name(f); +} + +/// NMT virtual memory + +static bool range_intersects(const void* from1, const void* to1, const void* from2, const void* to2) { + return MAX2(from1, from2) < MIN2(to1, to2); +} + +// A Cache that correlates range with MEMFLAG, optimized to be iterated quickly +// (cache friendly). +class CachedNMTInformation : public VirtualMemoryWalker { + struct Range { const void* from; const void* to; }; + // We keep ranges apart from flags since that prevents the padding a combined + // structure would have, and it allows for faster iteration of ranges since more + // of them fit into a cache line. + Range* _ranges; + MEMFLAGS* _flags; + size_t _count, _capacity; + mutable size_t _last; + +public: + CachedNMTInformation() : _ranges(nullptr), _flags(nullptr), + _count(0), _capacity(0), _last(0) {} + + ~CachedNMTInformation() { + ALLOW_C_FUNCTION(free, ::free(_ranges);) + ALLOW_C_FUNCTION(free, ::free(_flags);) + } + + bool add(const void* from, const void* to, MEMFLAGS f) { + // We rely on NMT regions being sorted by base + assert(_count == 0 || (from >= _ranges[_count - 1].to), "NMT regions unordered?"); + // we can just fold two regions if they are adjacent and have the same flag. + if (_count > 0 && from == _ranges[_count - 1].to && f == _flags[_count - 1]) { + _ranges[_count - 1].to = to; + return true; + } + if (_count == _capacity) { + // Enlarge if needed + const size_t new_capacity = MAX2((size_t)4096, 2 * _capacity); + // Unfortunately, we need to allocate manually, raw, since we must prevent NMT deadlocks (ThreadCritical). + ALLOW_C_FUNCTION(realloc, _ranges = (Range*)::realloc(_ranges, new_capacity * sizeof(Range));) + ALLOW_C_FUNCTION(realloc, _flags = (MEMFLAGS*)::realloc(_flags, new_capacity * sizeof(MEMFLAGS));) + if (_ranges == nullptr || _flags == nullptr) { + // In case of OOM lets make no fuss. Just return. + return false; + } + _capacity = new_capacity; + } + assert(_capacity > _count, "Sanity"); + _ranges[_count] = Range { from, to }; + _flags[_count] = f; + _count++; + return true; + } + + // Given a vma [from, to), find all regions that intersect with this vma and + // return their collective flags. + MemFlagBitmap lookup(const void* from, const void* to) const { + assert(from <= to, "Sanity"); + // We optimize for sequential lookups. Since this class is used when a list + // of OS mappings is scanned (VirtualQuery, /proc/pid/maps), and these lists + // are usually sorted in order of addresses, ascending. + if (to <= _ranges[_last].from) { + // the range is to the right of the given section, we need to re-start the search + _last = 0; + } + MemFlagBitmap bm; + for(uintx i = _last; i < _count; i++) { + if (range_intersects(from, to, _ranges[i].from, _ranges[i].to)) { + bm.set_flag(_flags[i]); + } else if (to <= _ranges[i].from) { + _last = i; + break; + } + } + return bm; + } + + bool do_allocation_site(const ReservedMemoryRegion* rgn) override { + // Cancel iteration if we run out of memory (add returns false); + return add(rgn->base(), rgn->end(), rgn->flag()); + } + + // Iterate all NMT virtual memory regions and fill this cache. + bool fill_from_nmt() { + return VirtualMemoryTracker::walk_virtual_memory(this); + } +}; + +/////// Thread information ////////////////////////// + +// Given a VMA [from, to) and a thread, check if vma intersects with thread stack +static bool vma_touches_thread_stack(const void* from, const void* to, const Thread* t) { + // Java thread stacks (and sometimes also other threads) have guard pages. Therefore they typically occupy + // at least two distinct neighboring VMAs. Therefore we typically have a 1:n relationshipt between thread + // stack and vma. + // Very rarely however is a VMA backing a thread stack folded together with another adjacent VMA by the + // kernel. That can happen, e.g., for non-java threads that don't have guard pages. + // Therefore we go for the simplest way here and check for intersection between VMA and thread stack. + return range_intersects(from, to, (const void*)t->stack_end(), (const void*)t->stack_base()); +} + +struct GCThreadClosure : public ThreadClosure { + bool _found; + uintx _tid; + const void* const _from; + const void* const _to; + GCThreadClosure(const void* from, const void* to) : _found(false), _tid(0), _from(from), _to(to) {} + void do_thread(Thread* t) override { + if (_tid == 0 && t != nullptr && vma_touches_thread_stack(_from, _to, t)) { + _found = true; + _tid = t->osthread()->thread_id(); + // lemme stooop! No way to signal stop :( + } + } +}; + +static void print_thread_details(uintx thread_id, const char* name, outputStream* st) { + // avoid commas and spaces in output to ease post-processing via awk + char tmp[64]; + stringStream ss(tmp, sizeof(tmp)); + ss.print(":" UINTX_FORMAT "-%s", (uintx)thread_id, name); + for (int i = 0; tmp[i] != '\0'; i++) { + if (!isalnum(tmp[i])) { + tmp[i] = '-'; + } + } + st->print_raw(tmp); +} + +// Given a region [from, to), if it intersects a known thread stack, print detail infos about that thread. +static void print_thread_details_for_supposed_stack_address(const void* from, const void* to, outputStream* st) { + +#define HANDLE_THREAD(T) \ + if (T != nullptr && vma_touches_thread_stack(from, to, T)) { \ + print_thread_details((uintx)(T->osthread()->thread_id()), T->name(), st); \ + return; \ + } + for (JavaThreadIteratorWithHandle jtiwh; JavaThread* t = jtiwh.next(); ) { + HANDLE_THREAD(t); + } + HANDLE_THREAD(VMThread::vm_thread()); + HANDLE_THREAD(WatcherThread::watcher_thread()); + HANDLE_THREAD(AsyncLogWriter::instance()); +#undef HANDLE_THREAD + + if (Universe::heap() != nullptr) { + GCThreadClosure cl(from, to); + Universe::heap()->gc_threads_do(&cl); + if (cl._found) { + print_thread_details(cl._tid, "GC Thread", st); + } + } +} + +/////////////// + +MappingPrintSession::MappingPrintSession(outputStream* st, const CachedNMTInformation& nmt_info) : + _out(st), _nmt_info(nmt_info) +{} + +void MappingPrintSession::print_nmt_flag_legend() const { +#define DO(flag, shortname, text) _out->indent(); _out->print_cr("%10s: %s", shortname, text); + NMT_FLAGS_DO(DO) +#undef DO +} + +bool MappingPrintSession::print_nmt_info_for_region(const void* vma_from, const void* vma_to) const { + int num_printed = 0; + // print NMT information, if available + if (MemTracker::enabled()) { + // Correlate vma region (from, to) with NMT region(s) we collected previously. + const MemFlagBitmap flags = _nmt_info.lookup(vma_from, vma_to); + if (flags.has_any()) { + for (int i = 0; i < mt_number_of_types; i++) { + const MEMFLAGS flag = (MEMFLAGS)i; + if (flags.has_flag(flag)) { + if (num_printed > 0) { + _out->put(','); + } + _out->print("%s", get_shortname_for_nmt_flag(flag)); + if (flag == mtThreadStack) { + print_thread_details_for_supposed_stack_address(vma_from, vma_to, _out); + } + num_printed++; + } + } + } + } + return num_printed > 0; +} + +void MemMapPrinter::print_all_mappings(outputStream* st) { + CachedNMTInformation nmt_info; + st->print_cr("Memory mappings:"); + // Prepare NMT info cache. But only do so if we print individual mappings, + // otherwise, we won't need it and can save that work. + if (MemTracker::enabled()) { + nmt_info.fill_from_nmt(); + } else { + st->print_cr("NMT is disabled. VM info not available."); + } + MappingPrintSession session(st, nmt_info); + pd_print_all_mappings(session); +} + +#endif // LINUX diff --git a/src/hotspot/share/nmt/memMapPrinter.hpp b/src/hotspot/share/nmt/memMapPrinter.hpp new file mode 100644 index 000000000000..d677a3a76366 --- /dev/null +++ b/src/hotspot/share/nmt/memMapPrinter.hpp @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, Red Hat, Inc. and/or its affiliates. + * 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_SERVICES_MEMMAPPRINTER_HPP +#define SHARE_SERVICES_MEMMAPPRINTER_HPP + +#include "memory/allocation.hpp" +#include "memory/allStatic.hpp" +#include "utilities/globalDefinitions.hpp" + +#ifdef LINUX + +class outputStream; +class CachedNMTInformation; + +class MappingPrintSession { + outputStream* const _out; + const CachedNMTInformation& _nmt_info; +public: + MappingPrintSession(outputStream* st, const CachedNMTInformation& nmt_info); + bool print_nmt_info_for_region(const void* from, const void* to) const; + void print_nmt_flag_legend() const; + outputStream* out() const { return _out; } +}; + +class MemMapPrinter : public AllStatic { + static void pd_print_all_mappings(const MappingPrintSession& session); +public: + static void print_all_mappings(outputStream* st); +}; + +#endif // LINUX + +#endif // SHARE_SERVICES_MEMMAPPRINTER_HPP diff --git a/src/hotspot/share/oops/arrayKlass.cpp b/src/hotspot/share/oops/arrayKlass.cpp index 1243786aff26..d1e31765ebc9 100644 --- a/src/hotspot/share/oops/arrayKlass.cpp +++ b/src/hotspot/share/oops/arrayKlass.cpp @@ -120,7 +120,8 @@ GrowableArray* ArrayKlass::compute_secondary_supers(int num_extra_slots, assert(num_extra_slots == 0, "sanity of primitive array type"); assert(transitive_interfaces == nullptr, "sanity"); // Must share this for correct bootstrapping! - set_secondary_supers(Universe::the_array_interfaces_array()); + set_secondary_supers(Universe::the_array_interfaces_array(), + Universe::the_array_interfaces_bitmap()); return nullptr; } diff --git a/src/hotspot/share/oops/instanceKlass.cpp b/src/hotspot/share/oops/instanceKlass.cpp index 0cc797c07659..29dd49f1a78e 100644 --- a/src/hotspot/share/oops/instanceKlass.cpp +++ b/src/hotspot/share/oops/instanceKlass.cpp @@ -1426,29 +1426,37 @@ bool InstanceKlass::can_be_primary_super_slow() const { GrowableArray* InstanceKlass::compute_secondary_supers(int num_extra_slots, Array* transitive_interfaces) { // The secondaries are the implemented interfaces. - Array* interfaces = transitive_interfaces; + // We need the cast because Array is NOT a supertype of Array, + // (but it's safe to do here because we won't write into _secondary_supers from this point on). + Array* interfaces = (Array*)(address)transitive_interfaces; int num_secondaries = num_extra_slots + interfaces->length(); if (num_secondaries == 0) { // Must share this for correct bootstrapping! - set_secondary_supers(Universe::the_empty_klass_array()); + set_secondary_supers(Universe::the_empty_klass_array(), Universe::the_empty_klass_bitmap()); return nullptr; } else if (num_extra_slots == 0) { // The secondary super list is exactly the same as the transitive interfaces, so // let's use it instead of making a copy. // Redefine classes has to be careful not to delete this! - // We need the cast because Array is NOT a supertype of Array, - // (but it's safe to do here because we won't write into _secondary_supers from this point on). - set_secondary_supers((Array*)(address)interfaces); - return nullptr; - } else { - // Copy transitive interfaces to a temporary growable array to be constructed - // into the secondary super list with extra slots. - GrowableArray* secondaries = new GrowableArray(interfaces->length()); - for (int i = 0; i < interfaces->length(); i++) { - secondaries->push(interfaces->at(i)); + if (!UseSecondarySupersTable) { + set_secondary_supers(interfaces); + return nullptr; + } else if (num_extra_slots == 0 && interfaces->length() <= 1) { + // We will reuse the transitive interfaces list if we're certain + // it's in hash order. + uintx bitmap = compute_secondary_supers_bitmap(interfaces); + set_secondary_supers(interfaces, bitmap); + return nullptr; } - return secondaries; + // ... fall through if that didn't work. } + // Copy transitive interfaces to a temporary growable array to be constructed + // into the secondary super list with extra slots. + GrowableArray* secondaries = new GrowableArray(interfaces->length()); + for (int i = 0; i < interfaces->length(); i++) { + secondaries->push(interfaces->at(i)); + } + return secondaries; } bool InstanceKlass::implements_interface(Klass* k) const { @@ -3716,7 +3724,7 @@ void InstanceKlass::print_on(outputStream* st) const { } st->print(BULLET"arrays: "); Metadata::print_value_on_maybe_null(st, array_klasses()); st->cr(); - st->print(BULLET"methods: "); methods()->print_value_on(st); st->cr(); + st->print(BULLET"methods: "); methods()->print_value_on(st); st->cr(); if (Verbose || WizardMode) { Array* method_array = methods(); for (int i = 0; i < method_array->length(); i++) { @@ -3736,6 +3744,29 @@ void InstanceKlass::print_on(outputStream* st) const { print_on_maybe_null(st, BULLET"default vtable indices: ", default_vtable_indices()); st->print(BULLET"local interfaces: "); local_interfaces()->print_value_on(st); st->cr(); st->print(BULLET"trans. interfaces: "); transitive_interfaces()->print_value_on(st); st->cr(); + + st->print(BULLET"secondary supers: "); secondary_supers()->print_value_on(st); st->cr(); + if (UseSecondarySupersTable) { + st->print(BULLET"hash_slot: %d", hash_slot()); st->cr(); + st->print(BULLET"bitmap: " UINTX_FORMAT_X_0, _bitmap); st->cr(); + } + if (secondary_supers() != nullptr) { + if (Verbose) { + bool is_hashed = UseSecondarySupersTable && (_bitmap != SECONDARY_SUPERS_BITMAP_FULL); + st->print_cr(BULLET"---- secondary supers (%d words):", _secondary_supers->length()); + for (int i = 0; i < _secondary_supers->length(); i++) { + ResourceMark rm; // for external_name() + Klass* secondary_super = _secondary_supers->at(i); + st->print(BULLET"%2d:", i); + if (is_hashed) { + int home_slot = compute_home_slot(secondary_super, _bitmap); + int distance = (i - home_slot) & SECONDARY_SUPERS_TABLE_MASK; + st->print(" dist:%02d:", distance); + } + st->print_cr(" %p %s", secondary_super, secondary_super->external_name()); + } + } + } st->print(BULLET"constants: "); constants()->print_value_on(st); st->cr(); print_on_maybe_null(st, BULLET"class loader data: ", class_loader_data()); @@ -3780,6 +3811,7 @@ void InstanceKlass::print_on(outputStream* st) const { st->print(BULLET"itable length %d (start addr: " PTR_FORMAT ")", itable_length(), p2i(start_of_itable())); st->cr(); if (itable_length() > 0 && (Verbose || WizardMode)) print_vtable(start_of_itable(), itable_length(), st); st->print_cr(BULLET"---- static fields (%d words):", static_field_size()); + FieldPrinter print_static_field(st); ((InstanceKlass*)this)->do_local_static_fields(&print_static_field); st->print_cr(BULLET"---- non-static fields (%d words):", nonstatic_field_size()); diff --git a/src/hotspot/share/oops/klass.cpp b/src/hotspot/share/oops/klass.cpp index c9338b508eae..715f98d9bce9 100644 --- a/src/hotspot/share/oops/klass.cpp +++ b/src/hotspot/share/oops/klass.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,7 @@ #include "precompiled.hpp" #include "cds/archiveHeapLoader.hpp" #include "cds/heapShared.hpp" +#include "classfile/classLoader.hpp" #include "classfile/classLoaderData.inline.hpp" #include "classfile/classLoaderDataGraph.inline.hpp" #include "classfile/javaClasses.inline.hpp" @@ -51,8 +52,10 @@ #include "runtime/arguments.hpp" #include "runtime/atomic.hpp" #include "runtime/handles.inline.hpp" +#include "runtime/perfData.hpp" #include "utilities/macros.hpp" #include "utilities/powerOfTwo.hpp" +#include "utilities/rotate_bits.hpp" #include "utilities/stack.inline.hpp" void Klass::set_java_mirror(Handle m) { @@ -77,11 +80,68 @@ void Klass::set_is_cloneable() { } } +uint8_t Klass::compute_hash_slot(Symbol* n) { + uint hash_code; + // Special cases for the two superclasses of all Array instances. + // Code elsewhere assumes, for all instances of ArrayKlass, that + // these two interfaces will be in this order. + + // We ensure there are some empty slots in the hash table between + // these two very common interfaces because if they were adjacent + // (e.g. Slots 0 and 1), then any other class which hashed to 0 or 1 + // would result in a probe length of 3. + if (n == vmSymbols::java_lang_Cloneable()) { + hash_code = 0; + } else if (n == vmSymbols::java_io_Serializable()) { + hash_code = SECONDARY_SUPERS_TABLE_SIZE / 2; + } else { + auto s = (const jbyte*) n->bytes(); + hash_code = java_lang_String::hash_code(s, n->utf8_length()); + // We use String::hash_code here (rather than e.g. + // Symbol::identity_hash()) in order to have a hash code that + // does not change from run to run. We want that because the + // hash value for a secondary superclass appears in generated + // code as a constant. + + // This constant is magic: see Knuth, "Fibonacci Hashing". + constexpr uint multiplier + = 2654435769; // (uint)(((u8)1 << 32) / ((1 + sqrt(5)) / 2 )) + constexpr uint hash_shift = sizeof(hash_code) * 8 - 6; + // The leading bits of the least significant half of the product. + hash_code = (hash_code * multiplier) >> hash_shift; + + if (StressSecondarySupers) { + // Generate many hash collisions in order to stress-test the + // linear search fallback. + hash_code = hash_code % 3; + hash_code = hash_code * (SECONDARY_SUPERS_TABLE_SIZE / 3); + } + } + + return (hash_code & SECONDARY_SUPERS_TABLE_MASK); +} + void Klass::set_name(Symbol* n) { _name = n; - if (_name != nullptr) _name->increment_refcount(); - if (Arguments::is_dumping_archive() && is_instance_klass()) { + if (_name != nullptr) { + _name->increment_refcount(); + } + + if (UseSecondarySupersTable) { + elapsedTimer selftime; + selftime.start(); + + _hash_slot = compute_hash_slot(n); + assert(_hash_slot < SECONDARY_SUPERS_TABLE_SIZE, "required"); + + selftime.stop(); + if (UsePerfData) { + ClassLoader::perf_secondary_hash_time()->inc(selftime.ticks()); + } + } + + if (Arguments::is_dumping_archive() && is_instance_klass()) { SystemDictionaryShared::init_dumptime_info(InstanceKlass::cast(this)); } } @@ -240,6 +300,177 @@ bool Klass::can_be_primary_super_slow() const { return true; } +void Klass::set_secondary_supers(Array* secondaries) { + assert(!UseSecondarySupersTable || secondaries == nullptr, ""); + set_secondary_supers(secondaries, SECONDARY_SUPERS_BITMAP_EMPTY); +} + +void Klass::set_secondary_supers(Array* secondaries, uintx bitmap) { +#ifdef ASSERT + if (UseSecondarySupersTable && secondaries != nullptr) { + uintx real_bitmap = compute_secondary_supers_bitmap(secondaries); + assert(bitmap == real_bitmap, "must be"); + assert(secondaries->length() >= (int)population_count(bitmap), "must be"); + } +#endif + _bitmap = bitmap; + _secondary_supers = secondaries; + + if (secondaries != nullptr) { + LogMessage(class, load) msg; + NonInterleavingLogStream log {LogLevel::Debug, msg}; + if (log.is_enabled()) { + ResourceMark rm; + log.print_cr("set_secondary_supers: hash_slot: %d; klass: %s", hash_slot(), external_name()); + print_secondary_supers_on(&log); + } + } +} + +// Hashed secondary superclasses +// +// We use a compressed 64-entry hash table with linear probing. We +// start by creating a hash table in the usual way, followed by a pass +// that removes all the null entries. To indicate which entries would +// have been null we use a bitmap that contains a 1 in each position +// where an entry is present, 0 otherwise. This bitmap also serves as +// a kind of Bloom filter, which in many cases allows us quickly to +// eliminate the possibility that something is a member of a set of +// secondaries. +uintx Klass::hash_secondary_supers(Array* secondaries, bool rewrite) { + const int length = secondaries->length(); + + if (length == 0) { + return SECONDARY_SUPERS_BITMAP_EMPTY; + } + + if (length == 1) { + int hash_slot = secondaries->at(0)->hash_slot(); + return uintx(1) << hash_slot; + } + + // Invariant: _secondary_supers.length >= population_count(_secondary_supers_bitmap) + + // Don't attempt to hash a table that's completely full, because in + // the case of an absent interface linear probing would not + // terminate. + if (length >= SECONDARY_SUPERS_TABLE_SIZE) { + return SECONDARY_SUPERS_BITMAP_FULL; + } + + { + PerfTraceTime ptt(ClassLoader::perf_secondary_hash_time()); + + ResourceMark rm; + uintx bitmap = SECONDARY_SUPERS_BITMAP_EMPTY; + auto hashed_secondaries = new GrowableArray(SECONDARY_SUPERS_TABLE_SIZE, + SECONDARY_SUPERS_TABLE_SIZE, nullptr); + + for (int j = 0; j < length; j++) { + Klass* k = secondaries->at(j); + hash_insert(k, hashed_secondaries, bitmap); + } + + // Pack the hashed secondaries array by copying it into the + // secondaries array, sans nulls, if modification is allowed. + // Otherwise, validate the order. + int i = 0; + for (int slot = 0; slot < SECONDARY_SUPERS_TABLE_SIZE; slot++) { + bool has_element = ((bitmap >> slot) & 1) != 0; + assert(has_element == (hashed_secondaries->at(slot) != nullptr), ""); + if (has_element) { + Klass* k = hashed_secondaries->at(slot); + if (rewrite) { + secondaries->at_put(i, k); + } else if (secondaries->at(i) != k) { + assert(false, "broken secondary supers hash table"); + return SECONDARY_SUPERS_BITMAP_FULL; + } + i++; + } + } + assert(i == secondaries->length(), "mismatch"); + + return bitmap; + } +} + +void Klass::hash_insert(Klass* klass, GrowableArray* secondaries, uintx& bitmap) { + assert(bitmap != SECONDARY_SUPERS_BITMAP_FULL, ""); + + int dist = 0; + for (int slot = klass->hash_slot(); true; slot = (slot + 1) & SECONDARY_SUPERS_TABLE_MASK) { + Klass* existing = secondaries->at(slot); + assert(((bitmap >> slot) & 1) == (existing != nullptr), "mismatch"); + if (existing == nullptr) { // no conflict + secondaries->at_put(slot, klass); + bitmap |= uintx(1) << slot; + assert(bitmap != SECONDARY_SUPERS_BITMAP_FULL, ""); + return; + } else { + // Use Robin Hood hashing to minimize the worst case search. + // Also, every permutation of the insertion sequence produces + // the same final Robin Hood hash table, provided that a + // consistent tie breaker is used. + int existing_dist = (slot - existing->hash_slot()) & SECONDARY_SUPERS_TABLE_MASK; + if (existing_dist < dist + // This tie breaker ensures that the hash order is maintained. + || ((existing_dist == dist) + && (uintptr_t(existing) < uintptr_t(klass)))) { + Klass* tmp = secondaries->at(slot); + secondaries->at_put(slot, klass); + klass = tmp; + dist = existing_dist; + } + ++dist; + } + } +} + +Array* Klass::pack_secondary_supers(ClassLoaderData* loader_data, + GrowableArray* primaries, + GrowableArray* secondaries, + uintx& bitmap, TRAPS) { + int new_length = primaries->length() + secondaries->length(); + Array* secondary_supers = MetadataFactory::new_array(loader_data, new_length, CHECK_NULL); + + // Combine the two arrays into a metadata object to pack the array. + // The primaries are added in the reverse order, then the secondaries. + int fill_p = primaries->length(); + for (int j = 0; j < fill_p; j++) { + secondary_supers->at_put(j, primaries->pop()); // add primaries in reverse order. + } + for( int j = 0; j < secondaries->length(); j++ ) { + secondary_supers->at_put(j+fill_p, secondaries->at(j)); // add secondaries on the end. + } +#ifdef ASSERT + // We must not copy any null placeholders left over from bootstrap. + for (int j = 0; j < secondary_supers->length(); j++) { + assert(secondary_supers->at(j) != nullptr, "correct bootstrapping order"); + } +#endif + + if (UseSecondarySupersTable) { + bitmap = hash_secondary_supers(secondary_supers, /*rewrite=*/true); // rewrites freshly allocated array + } else { + bitmap = SECONDARY_SUPERS_BITMAP_EMPTY; + } + return secondary_supers; +} + +uintx Klass::compute_secondary_supers_bitmap(Array* secondary_supers) { + return hash_secondary_supers(secondary_supers, /*rewrite=*/false); // no rewrites allowed +} + +uint8_t Klass::compute_home_slot(Klass* k, uintx bitmap) { + uint8_t hash = k->hash_slot(); + if (hash > 0) { + return population_count(bitmap << (SECONDARY_SUPERS_TABLE_SIZE - hash)); + } + return 0; +} + + void Klass::initialize_supers(Klass* k, Array* transitive_interfaces, TRAPS) { if (k == nullptr) { set_super(nullptr); @@ -330,26 +561,9 @@ void Klass::initialize_supers(Klass* k, Array* transitive_interf primaries->push(p); } // Combine the two arrays into a metadata object to pack the array. - // The primaries are added in the reverse order, then the secondaries. - int new_length = primaries->length() + secondaries->length(); - Array* s2 = MetadataFactory::new_array( - class_loader_data(), new_length, CHECK); - int fill_p = primaries->length(); - for (int j = 0; j < fill_p; j++) { - s2->at_put(j, primaries->pop()); // add primaries in reverse order. - } - for( int j = 0; j < secondaries->length(); j++ ) { - s2->at_put(j+fill_p, secondaries->at(j)); // add secondaries on the end. - } - - #ifdef ASSERT - // We must not copy any null placeholders left over from bootstrap. - for (int j = 0; j < s2->length(); j++) { - assert(s2->at(j) != nullptr, "correct bootstrapping order"); - } - #endif - - set_secondary_supers(s2); + uintx bitmap = 0; + Array* s2 = pack_secondary_supers(class_loader_data(), primaries, secondaries, bitmap, CHECK); + set_secondary_supers(s2, bitmap); } } @@ -357,7 +571,7 @@ GrowableArray* Klass::compute_secondary_supers(int num_extra_slots, Array* transitive_interfaces) { assert(num_extra_slots == 0, "override for complex klasses"); assert(transitive_interfaces == nullptr, "sanity"); - set_secondary_supers(Universe::the_empty_klass_array()); + set_secondary_supers(Universe::the_empty_klass_array(), Universe::the_empty_klass_bitmap()); return nullptr; } @@ -577,6 +791,11 @@ void Klass::remove_unshareable_info() { // Null out class_loader_data because we don't share that yet. set_class_loader_data(nullptr); set_is_shared(); + + // FIXME: validation in Klass::hash_secondary_supers() may fail for shared klasses. + // Even though the bitmaps always match, the canonical order of elements in the table + // is not guaranteed to stay the same (see tie breaker during Robin Hood hashing in Klass::hash_insert). + //assert(compute_secondary_supers_bitmap(secondary_supers()) == _bitmap, "broken table"); } void Klass::remove_java_mirror() { @@ -592,6 +811,7 @@ void Klass::remove_java_mirror() { void Klass::restore_unshareable_info(ClassLoaderData* loader_data, Handle protection_domain, TRAPS) { assert(is_klass(), "ensure C++ vtable is restored"); assert(is_shared(), "must be set"); + assert(secondary_supers()->length() >= (int)population_count(_bitmap), "must be"); JFR_ONLY(RESTORE_ID(this);) if (log_is_enabled(Trace, cds, unshareable)) { ResourceMark rm(THREAD); @@ -981,6 +1201,103 @@ const char* Klass::class_in_module_of_loader(bool use_are, bool include_parent_l return class_description; } +class LookupStats : StackObj { + private: + uint _no_of_samples; + uint _worst; + uint _worst_count; + uint _average; + uint _best; + uint _best_count; + public: + LookupStats() : _no_of_samples(0), _worst(0), _worst_count(0), _average(0), _best(INT_MAX), _best_count(0) {} + + ~LookupStats() { + assert(_best <= _worst || _no_of_samples == 0, "sanity"); + } + + void sample(uint value) { + ++_no_of_samples; + _average += value; + + if (_worst < value) { + _worst = value; + _worst_count = 1; + } else if (_worst == value) { + ++_worst_count; + } + + if (_best > value) { + _best = value; + _best_count = 1; + } else if (_best == value) { + ++_best_count; + } + } + + void print_on(outputStream* st) const { + st->print("best: %2d (%4.1f%%)", _best, (100.0 * _best_count) / _no_of_samples); + if (_best_count < _no_of_samples) { + st->print("; average: %4.1f; worst: %2d (%4.1f%%)", + (1.0 * _average) / _no_of_samples, + _worst, (100.0 * _worst_count) / _no_of_samples); + } + } +}; + +static void print_positive_lookup_stats(Array* secondary_supers, uintx bitmap, outputStream* st) { + int num_of_supers = secondary_supers->length(); + + LookupStats s; + for (int i = 0; i < num_of_supers; i++) { + Klass* secondary_super = secondary_supers->at(i); + int home_slot = Klass::compute_home_slot(secondary_super, bitmap); + uint score = 1 + ((i - home_slot) & Klass::SECONDARY_SUPERS_TABLE_MASK); + s.sample(score); + } + st->print("positive_lookup: "); s.print_on(st); +} + +static uint compute_distance_to_nearest_zero(int slot, uintx bitmap) { + assert(~bitmap != 0, "no zeroes"); + uintx start = rotate_right(bitmap, slot); + return count_trailing_zeros(~start); +} + +static void print_negative_lookup_stats(uintx bitmap, outputStream* st) { + LookupStats s; + for (int slot = 0; slot < Klass::SECONDARY_SUPERS_TABLE_SIZE; slot++) { + uint score = compute_distance_to_nearest_zero(slot, bitmap); + s.sample(score); + } + st->print("negative_lookup: "); s.print_on(st); +} + +void Klass::print_secondary_supers_on(outputStream* st) const { + if (secondary_supers() != nullptr) { + if (UseSecondarySupersTable) { + st->print(" - "); st->print("%d elements;", _secondary_supers->length()); + st->print_cr(" bitmap: " UINTX_FORMAT_X_0 ";", _bitmap); + if (_bitmap != SECONDARY_SUPERS_BITMAP_EMPTY && + _bitmap != SECONDARY_SUPERS_BITMAP_FULL) { + st->print(" - "); print_positive_lookup_stats(secondary_supers(), _bitmap, st); st->cr(); + st->print(" - "); print_negative_lookup_stats(_bitmap, st); st->cr(); + } + } + } else { + st->print("null"); + } +} + +void Klass::on_secondary_supers_verification_failure(Klass* super, Klass* sub, bool linear_result, bool table_result, const char* msg) { + ResourceMark rm; + super->print(); + sub->print(); + fatal("%s: %s implements %s: is_subtype_of: %d; linear_search: %d; table_lookup: %d", + msg, sub->external_name(), super->external_name(), + sub->is_subtype_of(super), linear_result, table_result); +} + void Klass::update_supers_dcevm() { if (_super != NULL) { _super = _super->newest_version(); diff --git a/src/hotspot/share/oops/klass.hpp b/src/hotspot/share/oops/klass.hpp index 2d7768fda52c..16dd1deb6000 100644 --- a/src/hotspot/share/oops/klass.hpp +++ b/src/hotspot/share/oops/klass.hpp @@ -159,6 +159,12 @@ class Klass : public Metadata { // Provide access the corresponding instance java.lang.ClassLoader. ClassLoaderData* _class_loader_data; + // Bitmap and hash code used by hashed secondary supers. + uintx _bitmap; + uint8_t _hash_slot; + + static uint8_t compute_hash_slot(Symbol* s); + int _vtable_len; // vtable length. This field may be read very often when we // have lots of itable dispatches (e.g., lambdas and streams). // Keep it away from the beginning of a Klass to avoid cacheline @@ -245,7 +251,10 @@ class Klass : public Metadata { void set_secondary_super_cache(Klass* k) { _secondary_super_cache = k; } Array* secondary_supers() const { return _secondary_supers; } - void set_secondary_supers(Array* k) { _secondary_supers = k; } + void set_secondary_supers(Array* k); + void set_secondary_supers(Array* k, uintx bitmap); + + uint8_t hash_slot() const { return _hash_slot; } // Return the element of the _super chain of the given depth. // If there is no such element, return either null or this. @@ -431,7 +440,27 @@ class Klass : public Metadata { void set_subklass(Klass* s); void set_next_sibling(Klass* s); + private: + static void hash_insert(Klass* klass, GrowableArray* secondaries, uintx& bitmap); + static uintx hash_secondary_supers(Array* secondaries, bool rewrite); + public: + // Secondary supers table support + static Array* pack_secondary_supers(ClassLoaderData* loader_data, + GrowableArray* primaries, + GrowableArray* secondaries, + uintx& bitmap, + TRAPS); + + static uintx compute_secondary_supers_bitmap(Array* secondary_supers); + static uint8_t compute_home_slot(Klass* k, uintx bitmap); + + static constexpr int SECONDARY_SUPERS_TABLE_SIZE = sizeof(_bitmap) * 8; + static constexpr int SECONDARY_SUPERS_TABLE_MASK = SECONDARY_SUPERS_TABLE_SIZE - 1; + + static constexpr uintx SECONDARY_SUPERS_BITMAP_EMPTY = 0; + static constexpr uintx SECONDARY_SUPERS_BITMAP_FULL = ~(uintx)0; + enum RedefinitionFlags { NoRedefinition, // This class is not redefined at all! ModifyClass = 1, // There are changes to the class meta data. @@ -459,6 +488,7 @@ class Klass : public Metadata { static ByteSize subklass_offset() { return byte_offset_of(Klass, _subklass); } static ByteSize next_sibling_offset() { return byte_offset_of(Klass, _next_sibling); } #endif + static ByteSize bitmap_offset() { return byte_offset_of(Klass, _bitmap); } // Unpacking layout_helper: static const int _lh_neutral_value = 0; // neutral non-array non-instance value @@ -771,6 +801,8 @@ class Klass : public Metadata { virtual void oop_print_value_on(oop obj, outputStream* st); virtual void oop_print_on (oop obj, outputStream* st); + void print_secondary_supers_on(outputStream* st) const; + virtual const char* internal_name() const = 0; // Verification @@ -786,6 +818,8 @@ class Klass : public Metadata { // for error reporting static bool is_valid(Klass* k); + static void on_secondary_supers_verification_failure(Klass* super, Klass* sub, bool linear_result, bool table_result, const char* msg); + // (DCEVM) void update_supers_dcevm(); }; diff --git a/src/hotspot/share/oops/objArrayKlass.cpp b/src/hotspot/share/oops/objArrayKlass.cpp index a0e3661e555b..46a7c299f900 100644 --- a/src/hotspot/share/oops/objArrayKlass.cpp +++ b/src/hotspot/share/oops/objArrayKlass.cpp @@ -382,7 +382,8 @@ GrowableArray* ObjArrayKlass::compute_secondary_supers(int num_extra_slo int num_secondaries = num_extra_slots + 2 + num_elem_supers; if (num_secondaries == 2) { // Must share this for correct bootstrapping! - set_secondary_supers(Universe::the_array_interfaces_array()); + set_secondary_supers(Universe::the_array_interfaces_array(), + Universe::the_array_interfaces_bitmap()); return nullptr; } else { GrowableArray* secondaries = new GrowableArray(num_elem_supers+2); diff --git a/src/hotspot/share/opto/block.cpp b/src/hotspot/share/opto/block.cpp index 7bad416c21d1..b31f68105052 100644 --- a/src/hotspot/share/opto/block.cpp +++ b/src/hotspot/share/opto/block.cpp @@ -1604,7 +1604,8 @@ void PhaseBlockLayout::find_edges() { Block *target = b->non_connector_successor(j); float freq = b->_freq * b->succ_prob(j); int from_pct = (int) ((100 * freq) / b->_freq); - int to_pct = (int) ((100 * freq) / target->_freq); + float f_to_pct = (100 * freq) / target->_freq; + int to_pct = (f_to_pct < 100.0) ? (int)f_to_pct : 100; edges->append(new CFGEdge(b, target, freq, from_pct, to_pct)); } } diff --git a/src/hotspot/share/opto/c2_globals.hpp b/src/hotspot/share/opto/c2_globals.hpp index 29dd95322a03..fdfde87aab18 100644 --- a/src/hotspot/share/opto/c2_globals.hpp +++ b/src/hotspot/share/opto/c2_globals.hpp @@ -774,8 +774,11 @@ \ product(bool, VerifyReceiverTypes, trueInDebug, DIAGNOSTIC, \ "Verify receiver types at runtime") \ + \ + product(bool, InlineSecondarySupersTest, true, DIAGNOSTIC, \ + "Inline the secondary supers hash lookup.") \ -// end of C2_FLAGS + // end of C2_FLAGS DECLARE_FLAGS(C2_FLAGS) diff --git a/src/hotspot/share/opto/compile.cpp b/src/hotspot/share/opto/compile.cpp index def117afb177..cbe7b929c8d8 100644 --- a/src/hotspot/share/opto/compile.cpp +++ b/src/hotspot/share/opto/compile.cpp @@ -2998,10 +2998,9 @@ void Compile::Code_Gen() { output.Output(); if (failing()) return; output.install(); + print_method(PHASE_FINAL_CODE, 1); // Compile::_output is not null here } - print_method(PHASE_FINAL_CODE, 1); - // He's dead, Jim. _cfg = (PhaseCFG*)((intptr_t)0xdeadbeef); _regalloc = (PhaseChaitin*)((intptr_t)0xdeadbeef); @@ -4962,16 +4961,7 @@ void Compile::remove_speculative_types(PhaseIterGVN &igvn) { const Type* t_no_spec = t->remove_speculative(); if (t_no_spec != t) { bool in_hash = igvn.hash_delete(n); -#ifdef ASSERT - if (!in_hash) { - tty->print_cr("current graph:"); - n->dump_bfs(MaxNodeLimit, nullptr, "S$"); - tty->cr(); - tty->print_cr("erroneous node:"); - n->dump(); - assert(false, "node should be in igvn hash table"); - } -#endif + assert(in_hash || n->hash() == Node::NO_HASH, "node should be in igvn hash table"); tn->set_type(t_no_spec); igvn.hash_insert(n); igvn._worklist.push(n); // give it a chance to go away diff --git a/src/hotspot/share/opto/escape.cpp b/src/hotspot/share/opto/escape.cpp index 7169fc2eb3d5..190b3ae75510 100644 --- a/src/hotspot/share/opto/escape.cpp +++ b/src/hotspot/share/opto/escape.cpp @@ -2800,7 +2800,7 @@ PhiNode *ConnectionGraph::create_split_phi(PhiNode *orig_phi, int alias_idx, Gro // Return a new version of Memory Phi "orig_phi" with the inputs having the // specified alias index. // -PhiNode *ConnectionGraph::split_memory_phi(PhiNode *orig_phi, int alias_idx, GrowableArray &orig_phi_worklist) { +PhiNode *ConnectionGraph::split_memory_phi(PhiNode *orig_phi, int alias_idx, GrowableArray &orig_phi_worklist, uint rec_depth) { assert(alias_idx != Compile::AliasIdxBot, "can't split out bottom memory"); Compile *C = _compile; PhaseGVN* igvn = _igvn; @@ -2816,7 +2816,7 @@ PhiNode *ConnectionGraph::split_memory_phi(PhiNode *orig_phi, int alias_idx, Gro bool finished = false; while(!finished) { while (idx < phi->req()) { - Node *mem = find_inst_mem(phi->in(idx), alias_idx, orig_phi_worklist); + Node *mem = find_inst_mem(phi->in(idx), alias_idx, orig_phi_worklist, rec_depth + 1); if (mem != nullptr && mem->is_Phi()) { PhiNode *newphi = create_split_phi(mem->as_Phi(), alias_idx, orig_phi_worklist, new_phi_created); if (new_phi_created) { @@ -2958,7 +2958,12 @@ void ConnectionGraph::move_inst_mem(Node* n, GrowableArray &orig_phi // Search memory chain of "mem" to find a MemNode whose address // is the specified alias index. // -Node* ConnectionGraph::find_inst_mem(Node *orig_mem, int alias_idx, GrowableArray &orig_phis) { +#define FIND_INST_MEM_RECURSION_DEPTH_LIMIT 1000 +Node* ConnectionGraph::find_inst_mem(Node *orig_mem, int alias_idx, GrowableArray &orig_phis, uint rec_depth) { + if (rec_depth > FIND_INST_MEM_RECURSION_DEPTH_LIMIT) { + _compile->record_failure(_invocation > 0 ? C2Compiler::retry_no_iterative_escape_analysis() : C2Compiler::retry_no_escape_analysis()); + return nullptr; + } if (orig_mem == nullptr) { return orig_mem; } @@ -3032,7 +3037,7 @@ Node* ConnectionGraph::find_inst_mem(Node *orig_mem, int alias_idx, GrowableArra if (result == mmem->base_memory()) { // Didn't find instance memory, search through general slice recursively. result = mmem->memory_at(C->get_general_index(alias_idx)); - result = find_inst_mem(result, alias_idx, orig_phis); + result = find_inst_mem(result, alias_idx, orig_phis, rec_depth + 1); if (C->failing()) { return nullptr; } @@ -3100,7 +3105,7 @@ Node* ConnectionGraph::find_inst_mem(Node *orig_mem, int alias_idx, GrowableArra orig_phis.append_if_missing(mphi); } else if (C->get_alias_index(t) != alias_idx) { // Create a new Phi with the specified alias index type. - result = split_memory_phi(mphi, alias_idx, orig_phis); + result = split_memory_phi(mphi, alias_idx, orig_phis, rec_depth + 1); } } // the result is either MemNode, PhiNode, InitializeNode. diff --git a/src/hotspot/share/opto/escape.hpp b/src/hotspot/share/opto/escape.hpp index e6e8b0d9a207..36dedc18badf 100644 --- a/src/hotspot/share/opto/escape.hpp +++ b/src/hotspot/share/opto/escape.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2024, 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 @@ -540,10 +540,10 @@ class ConnectionGraph: public ArenaObj { bool split_AddP(Node *addp, Node *base); PhiNode *create_split_phi(PhiNode *orig_phi, int alias_idx, GrowableArray &orig_phi_worklist, bool &new_created); - PhiNode *split_memory_phi(PhiNode *orig_phi, int alias_idx, GrowableArray &orig_phi_worklist); + PhiNode *split_memory_phi(PhiNode *orig_phi, int alias_idx, GrowableArray &orig_phi_worklist, uint rec_depth); void move_inst_mem(Node* n, GrowableArray &orig_phis); - Node* find_inst_mem(Node* mem, int alias_idx,GrowableArray &orig_phi_worklist); + Node* find_inst_mem(Node* mem, int alias_idx,GrowableArray &orig_phi_worklist, uint rec_depth = 0); Node* step_through_mergemem(MergeMemNode *mmem, int alias_idx, const TypeOopPtr *toop); Node_Array _node_map; // used for bookkeeping during type splitting diff --git a/src/hotspot/share/opto/loopPredicate.cpp b/src/hotspot/share/opto/loopPredicate.cpp index ba4c2195bd27..fbee140dcbcb 100644 --- a/src/hotspot/share/opto/loopPredicate.cpp +++ b/src/hotspot/share/opto/loopPredicate.cpp @@ -1456,7 +1456,7 @@ bool PhaseIdealLoop::loop_predication_impl_helper(IdealLoopTree* loop, IfProjNod IfNode* upper_bound_iff = upper_bound_proj->in(0)->as_If(); _igvn.hash_delete(upper_bound_iff); upper_bound_iff->set_req(1, upper_bound_bol); - if (TraceLoopPredicate) tty->print_cr("upper bound check if: %d", lower_bound_iff->_idx); + if (TraceLoopPredicate) tty->print_cr("upper bound check if: %d", upper_bound_iff->_idx); // Fall through into rest of the cleanup code which will move any dependent nodes to the skeleton predicates of the // upper bound test. We always need to create skeleton predicates in order to properly remove dead loops when later diff --git a/src/hotspot/share/opto/loopnode.cpp b/src/hotspot/share/opto/loopnode.cpp index 8ba5e8cf685b..87c60e6e76c7 100644 --- a/src/hotspot/share/opto/loopnode.cpp +++ b/src/hotspot/share/opto/loopnode.cpp @@ -2342,7 +2342,8 @@ Node* PhaseIdealLoop::exact_limit( IdealLoopTree *loop ) { CountedLoopNode *cl = loop->_head->as_CountedLoop(); assert(cl->is_valid_counted_loop(T_INT), ""); - if (ABS(cl->stride_con()) == 1 || + if (cl->stride_con() == 1 || + cl->stride_con() == -1 || cl->limit()->Opcode() == Op_LoopLimit) { // Old code has exact limit (it could be incorrect in case of int overflow). // Loop limit is exact with stride == 1. And loop may already have exact limit. @@ -2979,14 +2980,22 @@ void OuterStripMinedLoopNode::adjust_strip_mined_loop(PhaseIterGVN* igvn) { CountedLoopEndNode* inner_cle = inner_cl->loopexit(); int stride = inner_cl->stride_con(); - jlong scaled_iters_long = ((jlong)LoopStripMiningIter) * ABS(stride); + // For a min int stride, LoopStripMiningIter * stride overflows the int range for all values of LoopStripMiningIter + // except 0 or 1. Those values are handled early on in this method and causes the method to return. So for a min int + // stride, the method is guaranteed to return at the next check below. + jlong scaled_iters_long = ((jlong)LoopStripMiningIter) * ABS((jlong)stride); int scaled_iters = (int)scaled_iters_long; - int short_scaled_iters = LoopStripMiningIterShortLoop* ABS(stride); + if ((jlong)scaled_iters != scaled_iters_long) { + // Remove outer loop and safepoint (too few iterations) + remove_outer_loop_and_safepoint(igvn); + return; + } + jlong short_scaled_iters = LoopStripMiningIterShortLoop * ABS(stride); const TypeInt* inner_iv_t = igvn->type(inner_iv_phi)->is_int(); jlong iter_estimate = (jlong)inner_iv_t->_hi - (jlong)inner_iv_t->_lo; assert(iter_estimate > 0, "broken"); - if ((jlong)scaled_iters != scaled_iters_long || iter_estimate <= short_scaled_iters) { - // Remove outer loop and safepoint (too few iterations) + if (iter_estimate <= short_scaled_iters) { + // Remove outer loop and safepoint: loop executes less than LoopStripMiningIterShortLoop remove_outer_loop_and_safepoint(igvn); return; } diff --git a/src/hotspot/share/opto/matcher.cpp b/src/hotspot/share/opto/matcher.cpp index 51fad220e53c..319cb3cff5ff 100644 --- a/src/hotspot/share/opto/matcher.cpp +++ b/src/hotspot/share/opto/matcher.cpp @@ -2499,6 +2499,14 @@ void Matcher::find_shared_post_visit(Node* n, uint opcode) { n->del_req(3); break; } + case Op_PartialSubtypeCheck: { + if (UseSecondarySupersTable && n->in(2)->is_Con()) { + // PartialSubtypeCheck uses both constant and register operands for superclass input. + n->set_req(2, new BinaryNode(n->in(2), n->in(2))); + break; + } + break; + } default: break; } diff --git a/src/hotspot/share/opto/memnode.cpp b/src/hotspot/share/opto/memnode.cpp index d5c02b474e36..def2dbb71055 100644 --- a/src/hotspot/share/opto/memnode.cpp +++ b/src/hotspot/share/opto/memnode.cpp @@ -2405,6 +2405,12 @@ const Type* LoadNode::klass_value_common(PhaseGVN* phase) const { } } + if (tkls != nullptr && !UseSecondarySupersCache + && tkls->offset() == in_bytes(Klass::secondary_super_cache_offset())) { + // Treat Klass::_secondary_super_cache as a constant when the cache is disabled. + return TypePtr::NULL_PTR; + } + // Bailout case return LoadNode::Value(phase); } diff --git a/src/hotspot/share/opto/stringopts.cpp b/src/hotspot/share/opto/stringopts.cpp index 9a25b259532c..0fcc8f8cb525 100644 --- a/src/hotspot/share/opto/stringopts.cpp +++ b/src/hotspot/share/opto/stringopts.cpp @@ -988,12 +988,21 @@ bool StringConcat::validate_control_flow() { continue; } - // A test which leads to an uncommon trap which should be safe. - // Later this trap will be converted into a trap that restarts + // A test which leads to an uncommon trap. It is safe to convert the trap + // into a trap that restarts at the beginning as long as its test does not + // depend on intermediate results of the candidate chain. // at the beginning. if (otherproj->outcnt() == 1) { CallStaticJavaNode* call = otherproj->unique_out()->isa_CallStaticJava(); if (call != nullptr && call->_name != nullptr && strcmp(call->_name, "uncommon_trap") == 0) { + // First check for dependency on a toString that is going away during stacked concats. + if (_multiple && + ((v1->is_Proj() && is_SB_toString(v1->in(0)) && ctrl_path.member(v1->in(0))) || + (v2->is_Proj() && is_SB_toString(v2->in(0)) && ctrl_path.member(v2->in(0))))) { + // iftrue -> if -> bool -> cmpp -> resproj -> tostring + fail = true; + break; + } // control flow leads to uct so should be ok _uncommon_traps.push(call); ctrl_path.push(call); diff --git a/src/hotspot/share/opto/superword.cpp b/src/hotspot/share/opto/superword.cpp index 3791cb49aa1b..ea888366b0f8 100644 --- a/src/hotspot/share/opto/superword.cpp +++ b/src/hotspot/share/opto/superword.cpp @@ -3802,6 +3802,12 @@ const Type* SuperWord::container_type(Node* n) { } const Type* t = _igvn.type(n); if (t->basic_type() == T_INT) { + // Float to half float conversion may be succeeded by a conversion from + // half float to float, in such a case back propagation of narrow type (SHORT) + // may not be possible. + if (n->Opcode() == Op_ConvF2HF) { + return TypeInt::SHORT; + } // A narrow type of arithmetic operations will be determined by // propagating the type of memory operations. return TypeInt::INT; diff --git a/src/hotspot/share/opto/vectorIntrinsics.cpp b/src/hotspot/share/opto/vectorIntrinsics.cpp index 76529a95ed73..b5bfeb3f2150 100644 --- a/src/hotspot/share/opto/vectorIntrinsics.cpp +++ b/src/hotspot/share/opto/vectorIntrinsics.cpp @@ -2678,7 +2678,7 @@ bool LibraryCallKit::inline_vector_insert() { default: fatal("%s", type2name(elem_bt)); break; } - Node* operation = gvn().transform(VectorInsertNode::make(opd, insert_val, idx->get_con())); + Node* operation = gvn().transform(VectorInsertNode::make(opd, insert_val, idx->get_con(), gvn())); Node* vbox = box_vector(operation, vbox_type, elem_bt, num_elem); set_result(vbox); diff --git a/src/hotspot/share/opto/vectornode.cpp b/src/hotspot/share/opto/vectornode.cpp index fdfa0718a458..ffc19d8da3c2 100644 --- a/src/hotspot/share/opto/vectornode.cpp +++ b/src/hotspot/share/opto/vectornode.cpp @@ -1733,9 +1733,9 @@ Node* VectorReinterpretNode::Identity(PhaseGVN *phase) { return this; } -Node* VectorInsertNode::make(Node* vec, Node* new_val, int position) { +Node* VectorInsertNode::make(Node* vec, Node* new_val, int position, PhaseGVN& gvn) { assert(position < (int)vec->bottom_type()->is_vect()->length(), "pos in range"); - ConINode* pos = ConINode::make(position); + ConINode* pos = gvn.intcon(position); return new VectorInsertNode(vec, new_val, pos, vec->bottom_type()->is_vect()); } diff --git a/src/hotspot/share/opto/vectornode.hpp b/src/hotspot/share/opto/vectornode.hpp index 9279037cf122..9316dca69271 100644 --- a/src/hotspot/share/opto/vectornode.hpp +++ b/src/hotspot/share/opto/vectornode.hpp @@ -1695,7 +1695,7 @@ class VectorInsertNode : public VectorNode { virtual int Opcode() const; uint pos() const { return in(3)->get_int(); } - static Node* make(Node* vec, Node* new_val, int position); + static Node* make(Node* vec, Node* new_val, int position, PhaseGVN& gvn); }; class VectorBoxNode : public Node { diff --git a/src/hotspot/share/prims/jvmtiAgentList.hpp b/src/hotspot/share/prims/jvmtiAgentList.hpp index cf698c69c01f..4f8349f92e99 100644 --- a/src/hotspot/share/prims/jvmtiAgentList.hpp +++ b/src/hotspot/share/prims/jvmtiAgentList.hpp @@ -61,7 +61,6 @@ class JvmtiAgentList : AllStatic { private: static JvmtiAgent* _list; - static Iterator all(); static void initialize(); static void convert_xrun_agents(); @@ -81,6 +80,7 @@ class JvmtiAgentList : AllStatic { static JvmtiAgent* lookup(JvmtiEnv* env, void* f_ptr); + static Iterator all(); static Iterator agents() NOT_JVMTI({ Iterator it; return it; }); static Iterator java_agents(); static Iterator native_agents(); diff --git a/src/hotspot/share/prims/whitebox.cpp b/src/hotspot/share/prims/whitebox.cpp index 4a7e69ca8b42..5c8e350cefa4 100644 --- a/src/hotspot/share/prims/whitebox.cpp +++ b/src/hotspot/share/prims/whitebox.cpp @@ -771,6 +771,7 @@ WB_END WB_ENTRY(jboolean, WB_IsFrameDeoptimized(JNIEnv* env, jobject o, jint depth)) bool result = false; if (thread->has_last_Java_frame()) { + ResourceMark rm(THREAD); RegisterMap reg_map(thread, RegisterMap::UpdateMap::include, RegisterMap::ProcessFrames::include, diff --git a/src/hotspot/share/runtime/abstract_vm_version.hpp b/src/hotspot/share/runtime/abstract_vm_version.hpp index f610d58e287f..4bf0741a25da 100644 --- a/src/hotspot/share/runtime/abstract_vm_version.hpp +++ b/src/hotspot/share/runtime/abstract_vm_version.hpp @@ -180,6 +180,9 @@ class Abstract_VM_Version: AllStatic { // Does platform support stack watermark barriers for concurrent stack processing? constexpr static bool supports_stack_watermark_barrier() { return false; } + // Does platform support secondary supers table lookup? + constexpr static bool supports_secondary_supers_table() { return false; } + // Does platform support float16 instructions? static bool supports_float16() { return false; } diff --git a/src/hotspot/share/runtime/arguments.cpp b/src/hotspot/share/runtime/arguments.cpp index dbf7aa094c09..bbf989f87d73 100644 --- a/src/hotspot/share/runtime/arguments.cpp +++ b/src/hotspot/share/runtime/arguments.cpp @@ -317,7 +317,6 @@ static bool matches_property_suffix(const char* option, const char* property, si // any of the reserved module properties. // property should be passed without the leading "-D". bool Arguments::is_internal_module_property(const char* property) { - assert((strncmp(property, "-D", 2) != 0), "Unexpected leading -D"); if (strncmp(property, MODULE_PROPERTY_PREFIX, MODULE_PROPERTY_PREFIX_LEN) == 0) { const char* property_suffix = property + MODULE_PROPERTY_PREFIX_LEN; if (matches_property_suffix(property_suffix, ADDEXPORTS, ADDEXPORTS_LEN) || @@ -4100,6 +4099,17 @@ jint Arguments::apply_ergo() { return code; } + if (FLAG_IS_DEFAULT(UseSecondarySupersTable)) { + FLAG_SET_DEFAULT(UseSecondarySupersTable, VM_Version::supports_secondary_supers_table()); + } else if (UseSecondarySupersTable && !VM_Version::supports_secondary_supers_table()) { + warning("UseSecondarySupersTable is not supported"); + FLAG_SET_DEFAULT(UseSecondarySupersTable, false); + } + if (!UseSecondarySupersTable) { + FLAG_SET_DEFAULT(StressSecondarySupers, false); + FLAG_SET_DEFAULT(VerifySecondarySupers, false); + } + #ifdef ZERO // Clear flags not supported on zero. FLAG_SET_DEFAULT(ProfileInterpreter, false); diff --git a/src/hotspot/share/runtime/deoptimization.cpp b/src/hotspot/share/runtime/deoptimization.cpp index 199610788fc4..2058da0ff2aa 100644 --- a/src/hotspot/share/runtime/deoptimization.cpp +++ b/src/hotspot/share/runtime/deoptimization.cpp @@ -36,6 +36,7 @@ #include "compiler/compilerDefinitions.inline.hpp" #include "gc/shared/collectedHeap.hpp" #include "interpreter/bytecode.hpp" +#include "interpreter/bytecode.inline.hpp" #include "interpreter/interpreter.hpp" #include "interpreter/oopMapCache.hpp" #include "jvm.h" @@ -636,11 +637,12 @@ Deoptimization::UnrollBlock* Deoptimization::fetch_unroll_info_helper(JavaThread bool caller_was_method_handle = false; if (deopt_sender.is_interpreted_frame()) { methodHandle method(current, deopt_sender.interpreter_frame_method()); - Bytecode_invoke cur = Bytecode_invoke_check(method, deopt_sender.interpreter_frame_bci()); - if (cur.is_invokedynamic() || cur.is_invokehandle()) { - // Method handle invokes may involve fairly arbitrary chains of - // calls so it's impossible to know how much actual space the - // caller has for locals. + Bytecode_invoke cur(method, deopt_sender.interpreter_frame_bci()); + if (cur.has_member_arg()) { + // This should cover all real-world cases. One exception is a pathological chain of + // MH.linkToXXX() linker calls, which only trusted code could do anyway. To handle that case, we + // would need to get the size from the resolved method entry. Another exception would + // be an invokedynamic with an adapter that is really a MethodHandle linker. caller_was_method_handle = true; } } @@ -743,9 +745,14 @@ Deoptimization::UnrollBlock* Deoptimization::fetch_unroll_info_helper(JavaThread } #endif + int caller_actual_parameters = -1; // value not used except for interpreted frames, see below + if (deopt_sender.is_interpreted_frame()) { + caller_actual_parameters = callee_parameters + (caller_was_method_handle ? 1 : 0); + } + UnrollBlock* info = new UnrollBlock(array->frame_size() * BytesPerWord, caller_adjustment * BytesPerWord, - caller_was_method_handle ? 0 : callee_parameters, + caller_actual_parameters, number_of_frames, frame_sizes, frame_pcs, @@ -934,7 +941,7 @@ JRT_LEAF(BasicType, Deoptimization::unpack_frames(JavaThread* thread, int exec_m if (Bytecodes::is_invoke(cur_code)) { Bytecode_invoke invoke(mh, iframe->interpreter_frame_bci()); cur_invoke_parameter_size = invoke.size_of_parameters(); - if (i != 0 && !invoke.is_invokedynamic() && MethodHandles::has_member_arg(invoke.klass(), invoke.name())) { + if (i != 0 && invoke.has_member_arg()) { callee_size_of_parameters++; } } diff --git a/src/hotspot/share/runtime/globals.hpp b/src/hotspot/share/runtime/globals.hpp index 8f5cf0bbb9c7..cfed80af4d1e 100644 --- a/src/hotspot/share/runtime/globals.hpp +++ b/src/hotspot/share/runtime/globals.hpp @@ -1998,6 +1998,18 @@ const int ObjectAlignmentInBytes = 8; "(default) disables native heap trimming.") \ range(0, UINT_MAX) \ \ + product(bool, UseSecondarySupersCache, true, DIAGNOSTIC, \ + "Use secondary supers cache during subtype checks.") \ + \ + product(bool, UseSecondarySupersTable, false, DIAGNOSTIC, \ + "Use hash table to lookup secondary supers.") \ + \ + product(bool, VerifySecondarySupers, false, DIAGNOSTIC, \ + "Check that linear and hashed secondary lookups return the same result.") \ + \ + product(bool, StressSecondarySupers, false, DIAGNOSTIC, \ + "Use a terrible hash function in order to generate many collisions.") \ + \ product(bool, ProfileExceptionHandlers, true, \ "Profile exception handlers") \ \ diff --git a/src/hotspot/share/runtime/os.cpp b/src/hotspot/share/runtime/os.cpp index ec4a4594f2c8..fa15342a08b7 100644 --- a/src/hotspot/share/runtime/os.cpp +++ b/src/hotspot/share/runtime/os.cpp @@ -42,6 +42,7 @@ #include "oops/compressedOops.inline.hpp" #include "oops/oop.inline.hpp" #include "prims/jvmtiAgent.hpp" +#include "prims/jvmtiAgentList.hpp" #include "prims/jvm_misc.hpp" #include "runtime/arguments.hpp" #include "runtime/atomic.hpp" @@ -1077,6 +1078,31 @@ void os::print_environment_variables(outputStream* st, const char** env_list) { } } +void os::print_jvmti_agent_info(outputStream* st) { +#if INCLUDE_JVMTI + const JvmtiAgentList::Iterator it = JvmtiAgentList::all(); + if (it.has_next()) { + st->print_cr("JVMTI agents:"); + } else { + st->print_cr("JVMTI agents: none"); + } + while (it.has_next()) { + const JvmtiAgent* agent = it.next(); + if (agent != nullptr) { + const char* dyninfo = agent->is_dynamic() ? "dynamic " : ""; + const char* instrumentinfo = agent->is_instrument_lib() ? "instrumentlib " : ""; + const char* loadinfo = agent->is_loaded() ? "loaded" : "not loaded"; + const char* initinfo = agent->is_initialized() ? "initialized" : "not initialized"; + const char* optionsinfo = agent->options(); + const char* pathinfo = agent->os_lib_path(); + if (optionsinfo == nullptr) optionsinfo = "none"; + if (pathinfo == nullptr) pathinfo = "none"; + st->print_cr("%s path:%s, %s, %s, %s%soptions:%s", agent->name(), pathinfo, loadinfo, initinfo, dyninfo, instrumentinfo, optionsinfo); + } + } +#endif +} + void os::print_register_info(outputStream* st, const void* context) { int continuation = 0; print_register_info(st, context, continuation); @@ -1142,8 +1168,7 @@ void os::print_date_and_time(outputStream *st, char* buf, size_t buflen) { if (localtime_pd(&tloc, &tz) != nullptr) { wchar_t w_buf[80]; size_t n = ::wcsftime(w_buf, 80, L"%Z", &tz); - if (n > 0) { - ::wcstombs(buf, w_buf, buflen); + if (n > 0 && ::wcstombs(buf, w_buf, buflen) != (size_t)-1) { st->print("Time: %s %s", timestring, buf); } else { st->print("Time: %s", timestring); diff --git a/src/hotspot/share/runtime/os.hpp b/src/hotspot/share/runtime/os.hpp index c6facde4abec..cece254e8089 100644 --- a/src/hotspot/share/runtime/os.hpp +++ b/src/hotspot/share/runtime/os.hpp @@ -776,6 +776,7 @@ class os: AllStatic { static void print_summary_info(outputStream* st, char* buf, size_t buflen); static void print_memory_info(outputStream* st); static void print_dll_info(outputStream* st); + static void print_jvmti_agent_info(outputStream* st); static void print_environment_variables(outputStream* st, const char** env_list); static void print_context(outputStream* st, const void* context); static void print_tos_pc(outputStream* st, const void* context); diff --git a/src/hotspot/share/runtime/safepoint.cpp b/src/hotspot/share/runtime/safepoint.cpp index 6cffd1d18af8..0a047a9ed665 100644 --- a/src/hotspot/share/runtime/safepoint.cpp +++ b/src/hotspot/share/runtime/safepoint.cpp @@ -500,6 +500,8 @@ void SafepointSynchronize::disarm_safepoint() { // operation has been carried out void SafepointSynchronize::end() { assert(Threads_lock->owned_by_self(), "must hold Threads_lock"); + SafepointTracing::leave(); + EventSafepointEnd event; assert(Thread::current()->is_VM_thread(), "Only VM thread can execute a safepoint"); @@ -1028,6 +1030,7 @@ void ThreadSafepointState::handle_polling_page_exception() { jlong SafepointTracing::_last_safepoint_begin_time_ns = 0; jlong SafepointTracing::_last_safepoint_sync_time_ns = 0; jlong SafepointTracing::_last_safepoint_cleanup_time_ns = 0; +jlong SafepointTracing::_last_safepoint_leave_time_ns = 0; jlong SafepointTracing::_last_safepoint_end_time_ns = 0; jlong SafepointTracing::_last_app_time_ns = 0; int SafepointTracing::_nof_threads = 0; @@ -1139,6 +1142,10 @@ void SafepointTracing::cleanup() { _last_safepoint_cleanup_time_ns = os::javaTimeNanos(); } +void SafepointTracing::leave() { + _last_safepoint_leave_time_ns = os::javaTimeNanos(); +} + void SafepointTracing::end() { _last_safepoint_end_time_ns = os::javaTimeNanos(); @@ -1161,12 +1168,14 @@ void SafepointTracing::end() { "Reaching safepoint: " JLONG_FORMAT " ns, " "Cleanup: " JLONG_FORMAT " ns, " "At safepoint: " JLONG_FORMAT " ns, " + "Leaving safepoint: " JLONG_FORMAT " ns, " "Total: " JLONG_FORMAT " ns", VM_Operation::name(_current_type), _last_app_time_ns, _last_safepoint_sync_time_ns - _last_safepoint_begin_time_ns, _last_safepoint_cleanup_time_ns - _last_safepoint_sync_time_ns, - _last_safepoint_end_time_ns - _last_safepoint_cleanup_time_ns, + _last_safepoint_leave_time_ns - _last_safepoint_cleanup_time_ns, + _last_safepoint_end_time_ns - _last_safepoint_leave_time_ns, _last_safepoint_end_time_ns - _last_safepoint_begin_time_ns ); diff --git a/src/hotspot/share/runtime/safepoint.hpp b/src/hotspot/share/runtime/safepoint.hpp index df99a63e3b5a..983dcc82f5e3 100644 --- a/src/hotspot/share/runtime/safepoint.hpp +++ b/src/hotspot/share/runtime/safepoint.hpp @@ -246,6 +246,7 @@ class SafepointTracing : public AllStatic { static jlong _last_safepoint_begin_time_ns; static jlong _last_safepoint_sync_time_ns; static jlong _last_safepoint_cleanup_time_ns; + static jlong _last_safepoint_leave_time_ns; static jlong _last_safepoint_end_time_ns; // Relative @@ -269,6 +270,7 @@ class SafepointTracing : public AllStatic { static void begin(VM_Operation::VMOp_Type type); static void synchronized(int nof_threads, int nof_running, int traps); static void cleanup(); + static void leave(); static void end(); static void statistics_exit_log(); diff --git a/src/hotspot/share/runtime/sharedRuntime.cpp b/src/hotspot/share/runtime/sharedRuntime.cpp index ce554bda8e1e..929ab9fb9a6d 100644 --- a/src/hotspot/share/runtime/sharedRuntime.cpp +++ b/src/hotspot/share/runtime/sharedRuntime.cpp @@ -238,7 +238,7 @@ const julong double_sign_mask = CONST64(0x7FFFFFFFFFFFFFFF); const julong double_infinity = CONST64(0x7FF0000000000000); #endif -#if !defined(X86) || !defined(TARGET_COMPILER_gcc) || defined(_WIN64) +#if !defined(X86) JRT_LEAF(jfloat, SharedRuntime::frem(jfloat x, jfloat y)) #ifdef _WIN64 // 64-bit Windows on amd64 returns the wrong values for @@ -270,7 +270,7 @@ JRT_LEAF(jdouble, SharedRuntime::drem(jdouble x, jdouble y)) return ((jdouble)fmod((double)x,(double)y)); #endif JRT_END -#endif // !X86 || !TARGET_COMPILER_gcc || _WIN64 +#endif // !X86 JRT_LEAF(jfloat, SharedRuntime::i2f(jint x)) return (jfloat)x; diff --git a/src/hotspot/share/runtime/stubRoutines.cpp b/src/hotspot/share/runtime/stubRoutines.cpp index 73be830463e9..c5ef1c771949 100644 --- a/src/hotspot/share/runtime/stubRoutines.cpp +++ b/src/hotspot/share/runtime/stubRoutines.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2024, 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,6 +27,7 @@ #include "asm/macroAssembler.inline.hpp" #include "memory/resourceArea.hpp" #include "oops/access.inline.hpp" +#include "oops/klass.hpp" #include "oops/oop.inline.hpp" #include "prims/vectorSupport.hpp" #include "runtime/continuation.hpp" @@ -161,6 +162,7 @@ address StubRoutines::_vectorizedMismatch = nullptr; address StubRoutines::_dexp = nullptr; address StubRoutines::_dlog = nullptr; address StubRoutines::_dlog10 = nullptr; +address StubRoutines::_fmod = nullptr; address StubRoutines::_dpow = nullptr; address StubRoutines::_dsin = nullptr; address StubRoutines::_dcos = nullptr; @@ -184,6 +186,10 @@ JFR_ONLY(address StubRoutines::_jfr_write_checkpoint = nullptr;) JFR_ONLY(RuntimeStub* StubRoutines::_jfr_return_lease_stub = nullptr;) JFR_ONLY(address StubRoutines::_jfr_return_lease = nullptr;) +address StubRoutines::_lookup_secondary_supers_table_slow_path_stub = nullptr; +address StubRoutines::_lookup_secondary_supers_table_stubs[Klass::SECONDARY_SUPERS_TABLE_SIZE] = { nullptr }; + + // Initialization // // Note: to break cycle with universe initialization, stubs are generated in two phases. diff --git a/src/hotspot/share/runtime/stubRoutines.hpp b/src/hotspot/share/runtime/stubRoutines.hpp index b414b0b905b4..96946643c087 100644 --- a/src/hotspot/share/runtime/stubRoutines.hpp +++ b/src/hotspot/share/runtime/stubRoutines.hpp @@ -249,6 +249,7 @@ class StubRoutines: AllStatic { static address _dlibm_reduce_pi04l; static address _dlibm_tan_cot_huge; static address _dtan; + static address _fmod; static address _f2hf; static address _hf2f; @@ -266,6 +267,9 @@ class StubRoutines: AllStatic { static address _vector_f_math[VectorSupport::NUM_VEC_SIZES][VectorSupport::NUM_SVML_OP]; static address _vector_d_math[VectorSupport::NUM_VEC_SIZES][VectorSupport::NUM_SVML_OP]; + static address _lookup_secondary_supers_table_stubs[]; + static address _lookup_secondary_supers_table_slow_path_stub; + public: // Initialization/Testing static void initialize_initial_stubs(); // must happen before universe::genesis @@ -427,6 +431,7 @@ class StubRoutines: AllStatic { static address dlog() { return _dlog; } static address dlog10() { return _dlog10; } static address dpow() { return _dpow; } + static address fmod() { return _fmod; } static address dsin() { return _dsin; } static address dcos() { return _dcos; } static address dlibm_reduce_pi04l() { return _dlibm_reduce_pi04l; } @@ -459,6 +464,17 @@ class StubRoutines: AllStatic { JFR_ONLY(static address jfr_write_checkpoint() { return _jfr_write_checkpoint; }) JFR_ONLY(static address jfr_return_lease() { return _jfr_return_lease; }) + static address lookup_secondary_supers_table_stub(u1 slot) { + assert(slot < Klass::SECONDARY_SUPERS_TABLE_SIZE, "out of bounds"); + assert(_lookup_secondary_supers_table_stubs[slot] != nullptr, "not implemented"); + return _lookup_secondary_supers_table_stubs[slot]; + } + + static address lookup_secondary_supers_table_slow_path_stub() { + assert(_lookup_secondary_supers_table_slow_path_stub != nullptr, "not implemented"); + return _lookup_secondary_supers_table_slow_path_stub; + } + static address select_fill_function(BasicType t, bool aligned, const char* &name); // diff --git a/src/hotspot/share/runtime/synchronizer.cpp b/src/hotspot/share/runtime/synchronizer.cpp index b5859ed2714b..cc73082ed3c1 100644 --- a/src/hotspot/share/runtime/synchronizer.cpp +++ b/src/hotspot/share/runtime/synchronizer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2025, 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 @@ -1140,36 +1140,49 @@ static bool monitors_used_above_threshold(MonitorList* list) { if (MonitorUsedDeflationThreshold == 0) { // disabled case is easy return false; } - // Start with ceiling based on a per-thread estimate: - size_t ceiling = ObjectSynchronizer::in_use_list_ceiling(); - size_t old_ceiling = ceiling; - if (ceiling < list->max()) { - // The max used by the system has exceeded the ceiling so use that: - ceiling = list->max(); - } size_t monitors_used = list->count(); if (monitors_used == 0) { // empty list is easy return false; } - if (NoAsyncDeflationProgressMax != 0 && - _no_progress_cnt >= NoAsyncDeflationProgressMax) { - float remainder = (100.0 - MonitorUsedDeflationThreshold) / 100.0; - size_t new_ceiling = ceiling + (ceiling * remainder) + 1; - ObjectSynchronizer::set_in_use_list_ceiling(new_ceiling); - log_info(monitorinflation)("Too many deflations without progress; " - "bumping in_use_list_ceiling from " SIZE_FORMAT - " to " SIZE_FORMAT, old_ceiling, new_ceiling); - _no_progress_cnt = 0; - ceiling = new_ceiling; - } + size_t old_ceiling = ObjectSynchronizer::in_use_list_ceiling(); + // Make sure that we use a ceiling value that is not lower than + // previous, not lower than the recorded max used by the system, and + // not lower than the current number of monitors in use (which can + // race ahead of max). The result is guaranteed > 0. + size_t ceiling = MAX3(old_ceiling, list->max(), monitors_used); // Check if our monitor usage is above the threshold: size_t monitor_usage = (monitors_used * 100LL) / ceiling; if (int(monitor_usage) > MonitorUsedDeflationThreshold) { + // Deflate monitors if over the threshold percentage, unless no + // progress on previous deflations. + bool is_above_threshold = true; + + // Check if it's time to adjust the in_use_list_ceiling up, due + // to too many async deflation attempts without any progress. + if (NoAsyncDeflationProgressMax != 0 && + _no_progress_cnt >= NoAsyncDeflationProgressMax) { + double remainder = (100.0 - MonitorUsedDeflationThreshold) / 100.0; + size_t delta = (size_t)(ceiling * remainder) + 1; + size_t new_ceiling = (ceiling > SIZE_MAX - delta) + ? SIZE_MAX // Overflow, let's clamp new_ceiling. + : ceiling + delta; + + ObjectSynchronizer::set_in_use_list_ceiling(new_ceiling); + log_info(monitorinflation)("Too many deflations without progress; " + "bumping in_use_list_ceiling from " SIZE_FORMAT + " to " SIZE_FORMAT, old_ceiling, new_ceiling); + _no_progress_cnt = 0; + ceiling = new_ceiling; + + // Check if our monitor usage is still above the threshold: + monitor_usage = (monitors_used * 100LL) / ceiling; + is_above_threshold = int(monitor_usage) > MonitorUsedDeflationThreshold; + } log_info(monitorinflation)("monitors_used=" SIZE_FORMAT ", ceiling=" SIZE_FORMAT ", monitor_usage=" SIZE_FORMAT ", threshold=" INTX_FORMAT, monitors_used, ceiling, monitor_usage, MonitorUsedDeflationThreshold); - return true; + return is_above_threshold; } return false; diff --git a/src/hotspot/share/runtime/threadSMR.cpp b/src/hotspot/share/runtime/threadSMR.cpp index d3676c444239..1469c7a42aa6 100644 --- a/src/hotspot/share/runtime/threadSMR.cpp +++ b/src/hotspot/share/runtime/threadSMR.cpp @@ -367,6 +367,7 @@ class ScanHazardPtrPrintMatchingThreadsClosure : public ThreadClosure { } }; +#ifdef ASSERT // Closure to validate hazard ptrs. // class ValidateHazardPtrsClosure : public ThreadClosure { @@ -387,6 +388,7 @@ class ValidateHazardPtrsClosure : public ThreadClosure { p2i(thread)); } }; +#endif // Closure to determine if the specified JavaThread is found by // threads_do(). @@ -951,8 +953,10 @@ void ThreadsSMRSupport::free_list(ThreadsList* threads) { log_debug(thread, smr)("tid=" UINTX_FORMAT ": ThreadsSMRSupport::free_list: threads=" INTPTR_FORMAT " is not freed.", os::current_thread_id(), p2i(threads)); } +#ifdef ASSERT ValidateHazardPtrsClosure validate_cl; threads_do(&validate_cl); +#endif delete scan_table; } diff --git a/src/hotspot/share/runtime/vframeArray.cpp b/src/hotspot/share/runtime/vframeArray.cpp index a95deaf6fc13..0cb45f8efc15 100644 --- a/src/hotspot/share/runtime/vframeArray.cpp +++ b/src/hotspot/share/runtime/vframeArray.cpp @@ -26,6 +26,7 @@ #include "classfile/vmSymbols.hpp" #include "code/vmreg.inline.hpp" #include "interpreter/bytecode.hpp" +#include "interpreter/bytecode.inline.hpp" #include "interpreter/interpreter.hpp" #include "memory/allocation.inline.hpp" #include "memory/resourceArea.hpp" @@ -614,10 +615,7 @@ void vframeArray::unpack_to_stack(frame &unpack_frame, int exec_mode, int caller methodHandle caller(current, elem->method()); methodHandle callee(current, element(index - 1)->method()); Bytecode_invoke inv(caller, elem->bci()); - // invokedynamic instructions don't have a class but obviously don't have a MemberName appendix. - // NOTE: Use machinery here that avoids resolving of any kind. - const bool has_member_arg = - !inv.is_invokedynamic() && MethodHandles::has_member_arg(inv.klass(), inv.name()); + const bool has_member_arg = inv.has_member_arg(); callee_parameters = callee->size_of_parameters() + (has_member_arg ? 1 : 0); callee_locals = callee->max_locals(); } diff --git a/src/hotspot/share/runtime/vmOperation.hpp b/src/hotspot/share/runtime/vmOperation.hpp index c0d268e4d338..764f56a4542a 100644 --- a/src/hotspot/share/runtime/vmOperation.hpp +++ b/src/hotspot/share/runtime/vmOperation.hpp @@ -91,7 +91,8 @@ template(HeapWalkOperation) \ template(HeapIterateOperation) \ template(ReportJavaOutOfMemory) \ - template(JFRCheckpoint) \ + template(JFRSafepointClear) \ + template(JFRSafepointWrite) \ template(ShenandoahFullGC) \ template(ShenandoahInitMark) \ template(ShenandoahFinalMarkStartEvac) \ diff --git a/src/hotspot/share/runtime/vmStructs.cpp b/src/hotspot/share/runtime/vmStructs.cpp index 827cb0cdf877..6c57c7998e7f 100644 --- a/src/hotspot/share/runtime/vmStructs.cpp +++ b/src/hotspot/share/runtime/vmStructs.cpp @@ -557,6 +557,7 @@ static_field(StubRoutines, _dlog, address) \ static_field(StubRoutines, _dlog10, address) \ static_field(StubRoutines, _dpow, address) \ + static_field(StubRoutines, _fmod, address) \ static_field(StubRoutines, _dsin, address) \ static_field(StubRoutines, _dcos, address) \ static_field(StubRoutines, _dtan, address) \ diff --git a/src/hotspot/share/services/attachListener.cpp b/src/hotspot/share/services/attachListener.cpp index 8c03ececee06..df6765a829e1 100644 --- a/src/hotspot/share/services/attachListener.cpp +++ b/src/hotspot/share/services/attachListener.cpp @@ -396,7 +396,13 @@ static void attach_listener_thread_entry(JavaThread* thread, TRAPS) { } ResourceMark rm; - bufferedStream st; + // jcmd output can get lengthy. As long as we miss jcmd continuous streaming output + // and instead just send the output in bulk, make sure large command output does not + // cause asserts. We still retain a max cap, but dimensioned in a way that makes it + // highly unlikely we should ever hit it under normal conditions. + constexpr size_t initial_size = 1 * M; + constexpr size_t max_size = 3 * G; + bufferedStream st(initial_size, max_size); jint res = JNI_OK; // handle special detachall operation diff --git a/src/hotspot/share/services/diagnosticCommand.cpp b/src/hotspot/share/services/diagnosticCommand.cpp index e43d7bbec854..f36f786396f4 100644 --- a/src/hotspot/share/services/diagnosticCommand.cpp +++ b/src/hotspot/share/services/diagnosticCommand.cpp @@ -38,6 +38,7 @@ #include "memory/metaspace/metaspaceDCmd.hpp" #include "memory/resourceArea.hpp" #include "memory/universe.hpp" +#include "nmt/memMapPrinter.hpp" #include "oops/instanceKlass.hpp" #include "oops/objArrayOop.inline.hpp" #include "oops/oop.inline.hpp" @@ -57,6 +58,7 @@ #include "services/diagnosticFramework.hpp" #include "services/heapDumper.hpp" #include "services/management.hpp" +#include "services/memTracker.hpp" #include "services/nmtDCmd.hpp" #include "services/writeableFlags.hpp" #include "utilities/debug.hpp" @@ -64,8 +66,10 @@ #include "utilities/formatBuffer.hpp" #include "utilities/macros.hpp" #ifdef LINUX +#include "os_posix.hpp" #include "trimCHeapDCmd.hpp" #include "mallocInfoDcmd.hpp" +#include #endif static void loadAgentModule(TRAPS) { @@ -130,6 +134,8 @@ void DCmd::register_dcmds(){ DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl(full_export, true, false)); DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl(full_export, true, false)); DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl(full_export, true, false)); + DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl(full_export, true,false)); + DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl(full_export, true,false)); #endif // LINUX DCmdFactory::register_DCmdFactory(new DCmdFactoryImpl(full_export, true, false)); @@ -1116,3 +1122,41 @@ void ThreadDumpToFileDCmd::dumpToFile(Symbol* name, Symbol* signature, const cha jbyte* addr = typeArrayOop(res)->byte_at_addr(0); output()->print_raw((const char*)addr, ba->length()); } + +#ifdef LINUX + +SystemMapDCmd::SystemMapDCmd(outputStream* output, bool heap) : DCmd(output, heap) {} + +void SystemMapDCmd::execute(DCmdSource source, TRAPS) { + MemMapPrinter::print_all_mappings(output()); +} + +static constexpr char default_filename[] = "vm_memory_map_.txt"; + +SystemDumpMapDCmd::SystemDumpMapDCmd(outputStream* output, bool heap) : + DCmdWithParser(output, heap), + _filename("-F", "file path", "STRING", false, default_filename) { + _dcmdparser.add_dcmd_option(&_filename); +} + +void SystemDumpMapDCmd::execute(DCmdSource source, TRAPS) { + stringStream default_name; + default_name.print("vm_memory_map_%d.txt", os::current_process_id()); + const char* name = _filename.is_set() ? _filename.value() : default_name.base(); + fileStream fs(name); + if (fs.is_open()) { + if (!MemTracker::enabled()) { + output()->print_cr("(NMT is disabled, will not annotate mappings)."); + } + MemMapPrinter::print_all_mappings(&fs); + // For the readers convenience, resolve path name. + char tmp[JVM_MAXPATHLEN]; + const char* absname = os::Posix::realpath(name, tmp, sizeof(tmp)); + name = absname != nullptr ? absname : name; + output()->print_cr("Memory map dumped to \"%s\".", name); + } else { + output()->print_cr("Failed to open \"%s\" for writing (%s).", name, os::strerror(errno)); + } +} + +#endif // LINUX diff --git a/src/hotspot/share/services/diagnosticCommand.hpp b/src/hotspot/share/services/diagnosticCommand.hpp index 28bd6a9f14e0..ad018259f835 100644 --- a/src/hotspot/share/services/diagnosticCommand.hpp +++ b/src/hotspot/share/services/diagnosticCommand.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2024, 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 @@ -953,4 +953,42 @@ class ThreadDumpToFileDCmd : public DCmdWithParser { virtual void execute(DCmdSource source, TRAPS); }; +#ifdef LINUX + +class SystemMapDCmd : public DCmd { +public: + SystemMapDCmd(outputStream* output, bool heap); + static const char* name() { return "System.map"; } + static const char* description() { + return "Prints an annotated process memory map of the VM process (linux only)."; + } + static const char* impact() { return "Medium; can be high for very large java heaps."; } + static const JavaPermission permission() { + JavaPermission p = {"java.lang.management.ManagementPermission", + "control", nullptr}; + return p; + } + virtual void execute(DCmdSource source, TRAPS); +}; + +class SystemDumpMapDCmd : public DCmdWithParser { + DCmdArgument _filename; +public: + static int num_arguments() { return 1; } + SystemDumpMapDCmd(outputStream* output, bool heap); + static const char* name() { return "System.dump_map"; } + static const char* description() { + return "Dumps an annotated process memory map to an output file (linux only)."; + } + static const char* impact() { return "Medium; can be high for very large java heaps."; } + static const JavaPermission permission() { + JavaPermission p = {"java.lang.management.ManagementPermission", + "control", nullptr}; + return p; + } + virtual void execute(DCmdSource source, TRAPS); +}; + +#endif // LINUX + #endif // SHARE_SERVICES_DIAGNOSTICCOMMAND_HPP diff --git a/src/hotspot/share/utilities/concurrentHashTable.hpp b/src/hotspot/share/utilities/concurrentHashTable.hpp index fe6fdb0a95e4..c1cfe5d2e5c4 100644 --- a/src/hotspot/share/utilities/concurrentHashTable.hpp +++ b/src/hotspot/share/utilities/concurrentHashTable.hpp @@ -65,6 +65,7 @@ class ConcurrentHashTable : public CHeapObj { // the InternalTable or user-defined memory. class Node { private: + DEBUG_ONLY(size_t _saved_hash); Node * volatile _next; VALUE _value; public: @@ -77,6 +78,10 @@ class ConcurrentHashTable : public CHeapObj { Node* next() const; void set_next(Node* node) { _next = node; } Node* const volatile * next_ptr() { return &_next; } +#ifdef ASSERT + size_t saved_hash() const { return _saved_hash; } + void set_saved_hash(size_t hash) { _saved_hash = hash; } +#endif VALUE* value() { return &_value; } diff --git a/src/hotspot/share/utilities/concurrentHashTable.inline.hpp b/src/hotspot/share/utilities/concurrentHashTable.inline.hpp index 212778530897..1f22d9a8a7f6 100644 --- a/src/hotspot/share/utilities/concurrentHashTable.inline.hpp +++ b/src/hotspot/share/utilities/concurrentHashTable.inline.hpp @@ -679,7 +679,9 @@ inline bool ConcurrentHashTable:: // Keep in odd list odd = aux->next_ptr(); } else { - fatal("aux_index does not match even or odd indices"); + const char* msg = "Cannot resize table: Node hash code has changed possibly due to corruption of the contents."; + DEBUG_ONLY(fatal("%s Node hash code changed from " SIZE_FORMAT " to " SIZE_FORMAT, msg, aux->saved_hash(), aux_hash);) + NOT_DEBUG(fatal("%s", msg);) } } aux = aux_next; @@ -892,6 +894,7 @@ inline bool ConcurrentHashTable:: size_t i = 0; uintx hash = lookup_f.get_hash(); Node* new_node = Node::create_node(_context, value, nullptr); + DEBUG_ONLY(new_node->set_saved_hash(hash);) while (true) { { @@ -1108,6 +1111,7 @@ inline bool ConcurrentHashTable:: Bucket* bucket = get_bucket_in(table, hash); assert(!bucket->have_redirect() && !bucket->is_locked(), "bad"); Node* new_node = Node::create_node(_context, value, bucket->first()); + DEBUG_ONLY(new_node->set_saved_hash(hash);) if (!bucket->cas_first(new_node, bucket->first())) { assert(false, "bad"); } diff --git a/src/hotspot/share/utilities/globalDefinitions.hpp b/src/hotspot/share/utilities/globalDefinitions.hpp index b58adbb90f15..0083442be6c7 100644 --- a/src/hotspot/share/utilities/globalDefinitions.hpp +++ b/src/hotspot/share/utilities/globalDefinitions.hpp @@ -150,6 +150,11 @@ class oopDesc; #define INTX_FORMAT_W(width) "%" #width PRIdPTR #define UINTX_FORMAT "%" PRIuPTR #define UINTX_FORMAT_X "0x%" PRIxPTR +#ifdef _LP64 +#define UINTX_FORMAT_X_0 "0x%016" PRIxPTR +#else +#define UINTX_FORMAT_X_0 "0x%08" PRIxPTR +#endif #define UINTX_FORMAT_W(width) "%" #width PRIuPTR // Format jlong, if necessary diff --git a/src/hotspot/share/utilities/json.cpp b/src/hotspot/share/utilities/json.cpp index fc0ac36bbb17..baa15b435dbc 100644 --- a/src/hotspot/share/utilities/json.cpp +++ b/src/hotspot/share/utilities/json.cpp @@ -580,7 +580,7 @@ u_char JSON::skip_line_comment() { return 0; } next(); - return next(); + return peek(); } /* diff --git a/src/hotspot/share/utilities/ostream.cpp b/src/hotspot/share/utilities/ostream.cpp index fcb5aa5731ce..49257795ef2b 100644 --- a/src/hotspot/share/utilities/ostream.cpp +++ b/src/hotspot/share/utilities/ostream.cpp @@ -166,9 +166,10 @@ void outputStream::vprint_cr(const char* format, va_list argptr) { do_vsnprintf_and_write(format, argptr, true); } -void outputStream::fill_to(int col) { - int need_fill = col - position(); +int outputStream::fill_to(int col) { + const int need_fill = MAX2(col - position(), 0); sp(need_fill); + return need_fill; } void outputStream::move_to(int col, int slop, int min_space) { diff --git a/src/hotspot/share/utilities/ostream.hpp b/src/hotspot/share/utilities/ostream.hpp index 1b2a041a6baa..eaef66f7186c 100644 --- a/src/hotspot/share/utilities/ostream.hpp +++ b/src/hotspot/share/utilities/ostream.hpp @@ -81,7 +81,7 @@ class outputStream : public CHeapObjBase { void dec(int n) { _indentation -= n; }; int indentation() const { return _indentation; } void set_indentation(int i) { _indentation = i; } - void fill_to(int col); + int fill_to(int col); void move_to(int col, int slop = 6, int min_space = 2); // sizing diff --git a/src/hotspot/share/utilities/rotate_bits.hpp b/src/hotspot/share/utilities/rotate_bits.hpp new file mode 100644 index 000000000000..7228cca108c4 --- /dev/null +++ b/src/hotspot/share/utilities/rotate_bits.hpp @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2024, 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_UTILITIES_ROTATE_BITS_HPP +#define SHARE_UTILITIES_ROTATE_BITS_HPP + +#include "utilities/globalDefinitions.hpp" + +inline uint32_t rotate_right_32(uint32_t x, int distance) { + distance = distance & 0x1F; + if (distance > 0) { + return (x >> distance) | (x << (32 - distance)); + } else { + return x; + } +} + +inline uint64_t rotate_right_64(uint64_t x, int distance) { + distance = distance & 0x3F; + if (distance > 0) { + return (x >> distance) | (x << (64 - distance)); + } else { + return x; + } +} + +template::value), +ENABLE_IF(sizeof(T) <= sizeof(uint64_t))> +inline T rotate_right(T x, int dist) { + return (sizeof(x) <= sizeof(uint32_t)) ? + rotate_right_32(static_cast(x), dist) : + rotate_right_64(static_cast(x), dist); +} + +#endif // SHARE_UTILITIES_ROTATE_BITS_HPP diff --git a/src/hotspot/share/utilities/vmError.cpp b/src/hotspot/share/utilities/vmError.cpp index 495660d258b3..8d20a3482208 100644 --- a/src/hotspot/share/utilities/vmError.cpp +++ b/src/hotspot/share/utilities/vmError.cpp @@ -1275,6 +1275,12 @@ void VMError::report(outputStream* st, bool _verbose) { os::print_dll_info(st); st->cr(); +#if INCLUDE_JVMTI + STEP_IF("printing jvmti agent info", _verbose) + os::print_jvmti_agent_info(st); + st->cr(); +#endif + STEP_IF("printing native decoder state", _verbose) Decoder::print_state_on(st); st->cr(); @@ -1472,6 +1478,11 @@ void VMError::print_vm_info(outputStream* st) { os::print_dll_info(st); st->cr(); +#if INCLUDE_JVMTI + os::print_jvmti_agent_info(st); + st->cr(); +#endif + // STEP("printing VM options") // VM options diff --git a/src/java.base/aix/classes/sun/nio/ch/PollsetPoller.java b/src/java.base/aix/classes/sun/nio/ch/PollsetPoller.java index 1aecbf7d57af..4664ca7e6cca 100644 --- a/src/java.base/aix/classes/sun/nio/ch/PollsetPoller.java +++ b/src/java.base/aix/classes/sun/nio/ch/PollsetPoller.java @@ -66,7 +66,7 @@ void implRegister(int fd) throws IOException { } @Override - void implDeregister(int fd) { + void implDeregister(int fd, boolean polled) { int ret = Pollset.pollsetCtl(setid, Pollset.PS_DELETE, fd, 0); assert ret == 0; } diff --git a/src/java.base/linux/classes/sun/nio/ch/EPollPoller.java b/src/java.base/linux/classes/sun/nio/ch/EPollPoller.java index d3f7f97e3ab1..9e374bd5e5ab 100644 --- a/src/java.base/linux/classes/sun/nio/ch/EPollPoller.java +++ b/src/java.base/linux/classes/sun/nio/ch/EPollPoller.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2023, 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 @@ -62,8 +62,11 @@ void implRegister(int fdVal) throws IOException { } @Override - void implDeregister(int fdVal) { - EPoll.ctl(epfd, EPOLL_CTL_DEL, fdVal, 0); + void implDeregister(int fdVal, boolean polled) { + // event is disabled if already polled + if (!polled) { + EPoll.ctl(epfd, EPOLL_CTL_DEL, fdVal, 0); + } } @Override diff --git a/src/java.base/macosx/classes/sun/nio/ch/KQueuePoller.java b/src/java.base/macosx/classes/sun/nio/ch/KQueuePoller.java index dd3738b7d720..fb5a4cf8ab96 100644 --- a/src/java.base/macosx/classes/sun/nio/ch/KQueuePoller.java +++ b/src/java.base/macosx/classes/sun/nio/ch/KQueuePoller.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2023, 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 @@ -57,8 +57,11 @@ void implRegister(int fdVal) throws IOException { } @Override - void implDeregister(int fdVal) { - KQueue.register(kqfd, fdVal, filter, EV_DELETE); + void implDeregister(int fdVal, boolean polled) { + // event was deleted if already polled + if (!polled) { + KQueue.register(kqfd, fdVal, filter, EV_DELETE); + } } @Override diff --git a/src/java.base/share/classes/java/io/SequenceInputStream.java b/src/java.base/share/classes/java/io/SequenceInputStream.java index de3fafc884d7..b89d9ca80b0f 100644 --- a/src/java.base/share/classes/java/io/SequenceInputStream.java +++ b/src/java.base/share/classes/java/io/SequenceInputStream.java @@ -242,11 +242,14 @@ public long transferTo(OutputStream out) throws IOException { if (getClass() == SequenceInputStream.class) { long transferred = 0; while (in != null) { + long numTransferred = in.transferTo(out); + // increment the total transferred byte count + // only if we haven't already reached the Long.MAX_VALUE if (transferred < Long.MAX_VALUE) { try { - transferred = Math.addExact(transferred, in.transferTo(out)); + transferred = Math.addExact(transferred, numTransferred); } catch (ArithmeticException ignore) { - return Long.MAX_VALUE; + transferred = Long.MAX_VALUE; } } nextStream(); diff --git a/src/java.base/share/classes/java/lang/Byte.java b/src/java.base/share/classes/java/lang/Byte.java index 18502abf69c4..7f7617b28f03 100644 --- a/src/java.base/share/classes/java/lang/Byte.java +++ b/src/java.base/share/classes/java/lang/Byte.java @@ -118,7 +118,7 @@ private ByteCache() {} // Load and use the archived cache if it exists CDS.initializeFromArchive(ByteCache.class); - if (archivedCache == null || archivedCache.length != size) { + if (archivedCache == null) { Byte[] c = new Byte[size]; byte value = (byte)-128; for(int i = 0; i < size; i++) { @@ -127,6 +127,7 @@ private ByteCache() {} archivedCache = c; } cache = archivedCache; + assert cache.length == size; } } diff --git a/src/java.base/share/classes/java/lang/Character.java b/src/java.base/share/classes/java/lang/Character.java index d4399d2af6ab..1e3ac020b98a 100644 --- a/src/java.base/share/classes/java/lang/Character.java +++ b/src/java.base/share/classes/java/lang/Character.java @@ -8969,7 +8969,7 @@ private CharacterCache(){} // Load and use the archived cache if it exists CDS.initializeFromArchive(CharacterCache.class); - if (archivedCache == null || archivedCache.length != size) { + if (archivedCache == null) { Character[] c = new Character[size]; for (int i = 0; i < size; i++) { c[i] = new Character((char) i); @@ -8977,6 +8977,7 @@ private CharacterCache(){} archivedCache = c; } cache = archivedCache; + assert cache.length == size; } } diff --git a/src/java.base/share/classes/java/lang/Integer.java b/src/java.base/share/classes/java/lang/Integer.java index 8c8bcb9226f4..1f00ebf30199 100644 --- a/src/java.base/share/classes/java/lang/Integer.java +++ b/src/java.base/share/classes/java/lang/Integer.java @@ -1038,7 +1038,17 @@ private static final class IntegerCache { if (archivedCache == null || size > archivedCache.length) { Integer[] c = new Integer[size]; int j = low; - for(int i = 0; i < c.length; i++) { + // If archive has Integer cache, we must use all instances from it. + // Otherwise, the identity checks between archived Integers and + // runtime-cached Integers would fail. + int archivedSize = (archivedCache == null) ? 0 : archivedCache.length; + for (int i = 0; i < archivedSize; i++) { + c[i] = archivedCache[i]; + assert j == archivedCache[i]; + j++; + } + // Fill the rest of the cache. + for (int i = archivedSize; i < size; i++) { c[i] = new Integer(j++); } archivedCache = c; diff --git a/src/java.base/share/classes/java/lang/Long.java b/src/java.base/share/classes/java/lang/Long.java index fb5e4cecca80..45400d2bb22e 100644 --- a/src/java.base/share/classes/java/lang/Long.java +++ b/src/java.base/share/classes/java/lang/Long.java @@ -1169,7 +1169,7 @@ private LongCache() {} // Load and use the archived cache if it exists CDS.initializeFromArchive(LongCache.class); - if (archivedCache == null || archivedCache.length != size) { + if (archivedCache == null) { Long[] c = new Long[size]; long value = -128; for(int i = 0; i < size; i++) { @@ -1178,6 +1178,7 @@ private LongCache() {} archivedCache = c; } cache = archivedCache; + assert cache.length == size; } } diff --git a/src/java.base/share/classes/java/lang/Short.java b/src/java.base/share/classes/java/lang/Short.java index 6a148d1edac0..659ace0084ed 100644 --- a/src/java.base/share/classes/java/lang/Short.java +++ b/src/java.base/share/classes/java/lang/Short.java @@ -244,7 +244,7 @@ private ShortCache() {} // Load and use the archived cache if it exists CDS.initializeFromArchive(ShortCache.class); - if (archivedCache == null || archivedCache.length != size) { + if (archivedCache == null) { Short[] c = new Short[size]; short value = -128; for(int i = 0; i < size; i++) { @@ -253,6 +253,7 @@ private ShortCache() {} archivedCache = c; } cache = archivedCache; + assert cache.length == size; } } diff --git a/src/java.base/share/classes/java/lang/foreign/AddressLayout.java b/src/java.base/share/classes/java/lang/foreign/AddressLayout.java index 877a64329618..6985beb110f9 100644 --- a/src/java.base/share/classes/java/lang/foreign/AddressLayout.java +++ b/src/java.base/share/classes/java/lang/foreign/AddressLayout.java @@ -1,27 +1,26 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * Copyright (c) 2023, 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 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). + * 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. + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. */ package java.lang.foreign; diff --git a/src/java.base/share/classes/java/lang/foreign/FunctionDescriptor.java b/src/java.base/share/classes/java/lang/foreign/FunctionDescriptor.java index f536f6fdcf95..003eb7c3aa65 100644 --- a/src/java.base/share/classes/java/lang/foreign/FunctionDescriptor.java +++ b/src/java.base/share/classes/java/lang/foreign/FunctionDescriptor.java @@ -1,27 +1,28 @@ /* - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * Copyright (c) 2020, 2023, 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 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). + * 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. + * 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. + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. */ + package java.lang.foreign; import java.lang.invoke.MethodHandle; diff --git a/src/java.base/share/classes/java/lang/foreign/GroupLayout.java b/src/java.base/share/classes/java/lang/foreign/GroupLayout.java index ff2d37c6a8c4..177f1f1d5fa7 100644 --- a/src/java.base/share/classes/java/lang/foreign/GroupLayout.java +++ b/src/java.base/share/classes/java/lang/foreign/GroupLayout.java @@ -1,28 +1,28 @@ /* - * Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * Copyright (c) 2019, 2023, 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 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). + * 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. + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. */ + package java.lang.foreign; import java.util.List; diff --git a/src/java.base/share/classes/java/lang/foreign/Linker.java b/src/java.base/share/classes/java/lang/foreign/Linker.java index 3af21dd56c23..56a2244168f5 100644 --- a/src/java.base/share/classes/java/lang/foreign/Linker.java +++ b/src/java.base/share/classes/java/lang/foreign/Linker.java @@ -1,28 +1,28 @@ /* - * Copyright (c) 2020, 2023, 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. - * + * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. */ + package java.lang.foreign; import jdk.internal.foreign.abi.AbstractLinker; diff --git a/src/java.base/share/classes/java/lang/foreign/MemoryLayout.java b/src/java.base/share/classes/java/lang/foreign/MemoryLayout.java index 41093a1cc326..c36bb2c34546 100644 --- a/src/java.base/share/classes/java/lang/foreign/MemoryLayout.java +++ b/src/java.base/share/classes/java/lang/foreign/MemoryLayout.java @@ -1,28 +1,28 @@ /* - * Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * Copyright (c) 2019, 2023, 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 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). + * 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. + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. */ + package java.lang.foreign; import java.lang.invoke.MethodHandle; diff --git a/src/java.base/share/classes/java/lang/foreign/MemorySegment.java b/src/java.base/share/classes/java/lang/foreign/MemorySegment.java index 2c2332018f04..dda487bfe5d8 100644 --- a/src/java.base/share/classes/java/lang/foreign/MemorySegment.java +++ b/src/java.base/share/classes/java/lang/foreign/MemorySegment.java @@ -1,27 +1,26 @@ /* - * Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * Copyright (c) 2019, 2023, 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 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). + * 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. + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. */ package java.lang.foreign; diff --git a/src/java.base/share/classes/java/lang/foreign/PaddingLayout.java b/src/java.base/share/classes/java/lang/foreign/PaddingLayout.java index cd0cd44ed30c..0df705999e30 100644 --- a/src/java.base/share/classes/java/lang/foreign/PaddingLayout.java +++ b/src/java.base/share/classes/java/lang/foreign/PaddingLayout.java @@ -1,28 +1,28 @@ /* - * Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * Copyright (c) 2019, 2023, 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 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). + * 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. + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. */ + package java.lang.foreign; import jdk.internal.foreign.layout.PaddingLayoutImpl; diff --git a/src/java.base/share/classes/java/lang/foreign/SequenceLayout.java b/src/java.base/share/classes/java/lang/foreign/SequenceLayout.java index 8259e766b157..c08b5ef4a8d6 100644 --- a/src/java.base/share/classes/java/lang/foreign/SequenceLayout.java +++ b/src/java.base/share/classes/java/lang/foreign/SequenceLayout.java @@ -1,28 +1,28 @@ /* - * Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * Copyright (c) 2019, 2023, 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 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). + * 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. + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. */ + package java.lang.foreign; import jdk.internal.foreign.layout.SequenceLayoutImpl; diff --git a/src/java.base/share/classes/java/lang/foreign/StructLayout.java b/src/java.base/share/classes/java/lang/foreign/StructLayout.java index 57ddc00caee3..81421ff5acff 100644 --- a/src/java.base/share/classes/java/lang/foreign/StructLayout.java +++ b/src/java.base/share/classes/java/lang/foreign/StructLayout.java @@ -1,28 +1,28 @@ /* - * Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * Copyright (c) 2019, 2023, 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 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). + * 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. + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. */ + package java.lang.foreign; import jdk.internal.foreign.layout.StructLayoutImpl; diff --git a/src/java.base/share/classes/java/lang/foreign/UnionLayout.java b/src/java.base/share/classes/java/lang/foreign/UnionLayout.java index f13d9274df12..8d0048aee4c9 100644 --- a/src/java.base/share/classes/java/lang/foreign/UnionLayout.java +++ b/src/java.base/share/classes/java/lang/foreign/UnionLayout.java @@ -1,28 +1,28 @@ /* - * Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * Copyright (c) 2019, 2023, 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 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). + * 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. + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. */ + package java.lang.foreign; import jdk.internal.foreign.layout.UnionLayoutImpl; diff --git a/src/java.base/share/classes/java/lang/foreign/ValueLayout.java b/src/java.base/share/classes/java/lang/foreign/ValueLayout.java index 24f5b641991e..585fa9d467d0 100644 --- a/src/java.base/share/classes/java/lang/foreign/ValueLayout.java +++ b/src/java.base/share/classes/java/lang/foreign/ValueLayout.java @@ -1,28 +1,28 @@ /* - * Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * Copyright (c) 2019, 2023, 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 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). + * 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. + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. */ + package java.lang.foreign; import java.lang.invoke.MethodHandles; diff --git a/src/java.base/share/classes/java/lang/foreign/package-info.java b/src/java.base/share/classes/java/lang/foreign/package-info.java index 95485943a191..64076e04820b 100644 --- a/src/java.base/share/classes/java/lang/foreign/package-info.java +++ b/src/java.base/share/classes/java/lang/foreign/package-info.java @@ -1,27 +1,26 @@ /* - * Copyright (c) 2019, 2023, 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. - * + * Copyright (c) 2019, 2023, 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. */ /** diff --git a/src/java.base/share/classes/java/lang/foreign/snippet-files/Snippets.java b/src/java.base/share/classes/java/lang/foreign/snippet-files/Snippets.java index c1e18f27c027..dd99c2b4f8d3 100644 --- a/src/java.base/share/classes/java/lang/foreign/snippet-files/Snippets.java +++ b/src/java.base/share/classes/java/lang/foreign/snippet-files/Snippets.java @@ -22,6 +22,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ + package java.lang.foreign.snippets; import java.lang.foreign.AddressLayout; diff --git a/src/java.base/share/classes/java/math/BigDecimal.java b/src/java.base/share/classes/java/math/BigDecimal.java index 094c48bc02fb..cbed115cdae4 100644 --- a/src/java.base/share/classes/java/math/BigDecimal.java +++ b/src/java.base/share/classes/java/math/BigDecimal.java @@ -3482,21 +3482,19 @@ public String toPlainString() { return "0"; } int trailingZeros = checkScaleNonZero((-(long)scale)); - StringBuilder buf; - if(intCompact!=INFLATED) { - buf = new StringBuilder(20+trailingZeros); - buf.append(intCompact); - } else { - String str = intVal.toString(); - buf = new StringBuilder(str.length()+trailingZeros); - buf.append(str); - } - for (int i = 0; i < trailingZeros; i++) { - buf.append('0'); + String str = intCompact != INFLATED + ? Long.toString(intCompact) + : intVal.toString(); + int len = str.length() + trailingZeros; + if (len < 0) { + throw new OutOfMemoryError("too large to fit in a String"); } + StringBuilder buf = new StringBuilder(len); + buf.append(str); + buf.repeat('0', trailingZeros); return buf.toString(); } - String str ; + String str; if(intCompact!=INFLATED) { str = Long.toString(Math.abs(intCompact)); } else { @@ -3506,11 +3504,11 @@ public String toPlainString() { } /* Returns a digit.digit string */ - private String getValueString(int signum, String intString, int scale) { + private static String getValueString(int signum, String intString, int scale) { /* Insert decimal point */ StringBuilder buf; int insertionPoint = intString.length() - scale; - if (insertionPoint == 0) { /* Point goes right before intVal */ + if (insertionPoint == 0) { /* Point goes just before intVal */ return (signum<0 ? "-0." : "0.") + intString; } else if (insertionPoint > 0) { /* Point goes inside intVal */ buf = new StringBuilder(intString); @@ -3518,11 +3516,13 @@ private String getValueString(int signum, String intString, int scale) { if (signum < 0) buf.insert(0, '-'); } else { /* We must insert zeros between point and intVal */ - buf = new StringBuilder(3-insertionPoint + intString.length()); - buf.append(signum<0 ? "-0." : "0."); - for (int i=0; i<-insertionPoint; i++) { - buf.append('0'); + int len = (signum < 0 ? 3 : 2) + scale; + if (len < 0) { + throw new OutOfMemoryError("too large to fit in a String"); } + buf = new StringBuilder(len); + buf.append(signum<0 ? "-0." : "0."); + buf.repeat('0', -insertionPoint); // insertionPoint != MIN_VALUE buf.append(intString); } return buf.toString(); diff --git a/src/java.base/share/classes/java/security/Provider.java b/src/java.base/share/classes/java/security/Provider.java index de857d014bc3..ba0458ae74f9 100644 --- a/src/java.base/share/classes/java/security/Provider.java +++ b/src/java.base/share/classes/java/security/Provider.java @@ -1289,6 +1289,7 @@ public Service getService(String type, String algorithm) { s = legacyMap.get(key); if (s != null && !s.isValid()) { legacyMap.remove(key, s); + return null; } } diff --git a/src/java.base/share/classes/java/text/DateFormatSymbols.java b/src/java.base/share/classes/java/text/DateFormatSymbols.java index e09d80886405..fe3bc3725aa1 100644 --- a/src/java.base/share/classes/java/text/DateFormatSymbols.java +++ b/src/java.base/share/classes/java/text/DateFormatSymbols.java @@ -612,7 +612,8 @@ public void setZoneStrings(String[][] newZoneStrings) { for (int i = 0; i < newZoneStrings.length; ++i) { int len = newZoneStrings[i].length; if (len < 5) { - throw new IllegalArgumentException(); + throw new IllegalArgumentException(String.format( + "Row %s of the input array does not have a length of at least 5", i)); } aCopy[i] = Arrays.copyOf(newZoneStrings[i], len); } diff --git a/src/java.base/share/classes/java/util/Collections.java b/src/java.base/share/classes/java/util/Collections.java index f45d297f3007..63949db2cc07 100644 --- a/src/java.base/share/classes/java/util/Collections.java +++ b/src/java.base/share/classes/java/util/Collections.java @@ -816,15 +816,16 @@ private static void rotate1(List list, int distance) { if (distance == 0) return; - for (int cycleStart = 0, nMoved = 0; nMoved != size; cycleStart++) { + int bound = size - distance; + for (int cycleStart = 0, nMoved = 0; nMoved < size; cycleStart++) { T displaced = list.get(cycleStart); int i = cycleStart; do { - i += distance; - if (i >= size) + if (i >= bound) i -= size; + i += distance; displaced = list.set(i, displaced); - nMoved ++; + nMoved++; } while (i != cycleStart); } } diff --git a/src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java b/src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java index 0edc633a203b..f565940dacb2 100644 --- a/src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java +++ b/src/java.base/share/classes/java/util/concurrent/ForkJoinPool.java @@ -2149,7 +2149,7 @@ private int awaitWork(WorkQueue w, int phase) { if (deadline != 0L && TIMEOUT_SLOP > deadline - System.currentTimeMillis()) { long sp = w.stackPred & LMASK, c = ctl; - long nc = sp | (UMASK & (c - TC_UNIT)); + long nc = sp | (c & RC_MASK) | ((c - TC_UNIT) & TC_MASK); if (((int)c & SMASK) == (active & SMASK) && compareAndSetCtl(c, nc)) { w.source = DEREGISTERED; diff --git a/src/java.base/share/classes/java/util/concurrent/StructuredTaskScope.java b/src/java.base/share/classes/java/util/concurrent/StructuredTaskScope.java index 4d9f8cb45b9e..030390f47b4d 100644 --- a/src/java.base/share/classes/java/util/concurrent/StructuredTaskScope.java +++ b/src/java.base/share/classes/java/util/concurrent/StructuredTaskScope.java @@ -576,8 +576,6 @@ public Subtask fork(Callable task) { } SubtaskImpl subtask = new SubtaskImpl<>(this, task, round); - boolean started = false; - if (s < SHUTDOWN) { // create thread to run task Thread thread = factory.newThread(subtask); @@ -588,15 +586,14 @@ public Subtask fork(Callable task) { // attempt to start the thread try { flock.start(thread); - started = true; } catch (IllegalStateException e) { // shutdown by another thread, or underlying flock is shutdown due // to unstructured use } } - // force owner to join if thread started - if (started && Thread.currentThread() == flock.owner() && round > forkRound) { + // force owner to join if this is the first fork in the round + if (Thread.currentThread() == flock.owner() && round > forkRound) { forkRound = round; } @@ -933,7 +930,8 @@ public T get() { T r = (T) result; return r; } - throw new IllegalStateException("Subtask not completed or did not complete successfully"); + throw new IllegalStateException( + "Result is unavailable or subtask did not complete successfully"); } @Override @@ -943,7 +941,8 @@ public Throwable exception() { if (result instanceof AltResult alt && alt.state() == State.FAILED) { return alt.exception(); } - throw new IllegalStateException("Subtask not completed or did not complete with exception"); + throw new IllegalStateException( + "Exception is unavailable or subtask did not complete with exception"); } @Override diff --git a/src/java.base/share/classes/java/util/jar/Attributes.java b/src/java.base/share/classes/java/util/jar/Attributes.java index 33363fd566c4..b8ea79a5e1fd 100644 --- a/src/java.base/share/classes/java/util/jar/Attributes.java +++ b/src/java.base/share/classes/java/util/jar/Attributes.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, 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 @@ -726,6 +726,7 @@ private static void addName(Map names, Name name) { addName(names, new Name("Created-By")); addName(names, new Name("SHA1-Digest")); addName(names, new Name("SHA-256-Digest")); + addName(names, new Name("SHA-384-Digest")); KNOWN_NAMES = Map.copyOf(names); } else { // Even if KNOWN_NAMES was read from archive, we still need diff --git a/src/java.base/share/classes/java/util/regex/Pattern.java b/src/java.base/share/classes/java/util/regex/Pattern.java index 45c48ddab542..f756bb056cf0 100644 --- a/src/java.base/share/classes/java/util/regex/Pattern.java +++ b/src/java.base/share/classes/java/util/regex/Pattern.java @@ -5529,10 +5529,10 @@ boolean match(Matcher matcher, int i, CharSequence seq) { * they are ignored for purposes of finding word boundaries. */ static final class Bound extends Node { - static int LEFT = 0x1; - static int RIGHT= 0x2; - static int BOTH = 0x3; - static int NONE = 0x4; + static final int LEFT = 0x1; + static final int RIGHT= 0x2; + static final int BOTH = 0x3; + static final int NONE = 0x4; int type; boolean useUWORD; Bound(int n, boolean useUWORD) { diff --git a/src/java.base/share/classes/java/util/zip/GZIPInputStream.java b/src/java.base/share/classes/java/util/zip/GZIPInputStream.java index d704fd3c9255..1ffb5fdea64d 100644 --- a/src/java.base/share/classes/java/util/zip/GZIPInputStream.java +++ b/src/java.base/share/classes/java/util/zip/GZIPInputStream.java @@ -31,6 +31,7 @@ import java.io.InputStream; import java.io.IOException; import java.io.EOFException; +import java.util.Objects; /** * This class implements a stream filter for reading compressed data in @@ -74,9 +75,29 @@ private void ensureOpen() throws IOException { * @throws IllegalArgumentException if {@code size <= 0} */ public GZIPInputStream(InputStream in, int size) throws IOException { - super(in, in != null ? new Inflater(true) : null, size); + super(in, createInflater(in, size), size); usesDefaultInflater = true; - readHeader(in); + try { + readHeader(in); + } catch (IOException ioe) { + this.inf.end(); + throw ioe; + } + } + + /* + * Creates and returns an Inflater only if the input stream is not null and the + * buffer size is > 0. + * If the input stream is null, then this method throws a + * NullPointerException. If the size is <= 0, then this method throws + * an IllegalArgumentException + */ + private static Inflater createInflater(InputStream in, int size) { + Objects.requireNonNull(in); + if (size <= 0) { + throw new IllegalArgumentException("buffer size <= 0"); + } + return new Inflater(true); } /** diff --git a/src/java.base/share/classes/jdk/internal/foreign/abi/riscv64/RISCV64Architecture.java b/src/java.base/share/classes/jdk/internal/foreign/abi/riscv64/RISCV64Architecture.java index 594a8b31119b..9c3d64be7ad9 100644 --- a/src/java.base/share/classes/jdk/internal/foreign/abi/riscv64/RISCV64Architecture.java +++ b/src/java.base/share/classes/jdk/internal/foreign/abi/riscv64/RISCV64Architecture.java @@ -6,7 +6,9 @@ * * 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. + * 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 diff --git a/src/java.base/share/classes/jdk/internal/foreign/abi/riscv64/linux/LinuxRISCV64CallArranger.java b/src/java.base/share/classes/jdk/internal/foreign/abi/riscv64/linux/LinuxRISCV64CallArranger.java index 29a824afdcaa..8da7a124abc1 100644 --- a/src/java.base/share/classes/jdk/internal/foreign/abi/riscv64/linux/LinuxRISCV64CallArranger.java +++ b/src/java.base/share/classes/jdk/internal/foreign/abi/riscv64/linux/LinuxRISCV64CallArranger.java @@ -6,7 +6,9 @@ * * 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. + * 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 diff --git a/src/java.base/share/classes/jdk/internal/foreign/abi/riscv64/linux/LinuxRISCV64Linker.java b/src/java.base/share/classes/jdk/internal/foreign/abi/riscv64/linux/LinuxRISCV64Linker.java index 0ffba55d9291..a6593979e99b 100644 --- a/src/java.base/share/classes/jdk/internal/foreign/abi/riscv64/linux/LinuxRISCV64Linker.java +++ b/src/java.base/share/classes/jdk/internal/foreign/abi/riscv64/linux/LinuxRISCV64Linker.java @@ -6,7 +6,9 @@ * * 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. + * 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 diff --git a/src/java.base/share/classes/jdk/internal/foreign/abi/riscv64/linux/TypeClass.java b/src/java.base/share/classes/jdk/internal/foreign/abi/riscv64/linux/TypeClass.java index 368a7571beb8..380f0a831097 100644 --- a/src/java.base/share/classes/jdk/internal/foreign/abi/riscv64/linux/TypeClass.java +++ b/src/java.base/share/classes/jdk/internal/foreign/abi/riscv64/linux/TypeClass.java @@ -6,7 +6,9 @@ * * 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. + * 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 diff --git a/src/java.base/share/classes/sun/net/ftp/impl/FtpClient.java b/src/java.base/share/classes/sun/net/ftp/impl/FtpClient.java index f8518fff4c4d..c480dc115a60 100644 --- a/src/java.base/share/classes/sun/net/ftp/impl/FtpClient.java +++ b/src/java.base/share/classes/sun/net/ftp/impl/FtpClient.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,6 @@ */ package sun.net.ftp.impl; - - import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.BufferedReader; @@ -64,6 +62,7 @@ import java.util.regex.Pattern; import javax.net.ssl.SSLSocket; import javax.net.ssl.SSLSocketFactory; + import sun.net.ftp.FtpDirEntry; import sun.net.ftp.FtpDirParser; import sun.net.ftp.FtpProtocolException; @@ -71,6 +70,7 @@ import sun.net.util.IPAddressUtil; import sun.util.logging.PlatformLogger; +import static sun.net.util.ProxyUtil.copyProxy; public class FtpClient extends sun.net.ftp.FtpClient { @@ -982,7 +982,7 @@ public int getReadTimeout() { } public sun.net.ftp.FtpClient setProxy(Proxy p) { - proxy = p; + proxy = copyProxy(p); return this; } diff --git a/src/java.base/share/classes/sun/net/util/ProxyUtil.java b/src/java.base/share/classes/sun/net/util/ProxyUtil.java new file mode 100644 index 000000000000..dfb60671e379 --- /dev/null +++ b/src/java.base/share/classes/sun/net/util/ProxyUtil.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package sun.net.util; + +import sun.net.ApplicationProxy; + +import java.net.Proxy; + +public final class ProxyUtil { + + private ProxyUtil() {} + + /** + * Creates a new {@link Proxy} instance for the given proxy iff it is + * neither null, {@link Proxy#NO_PROXY Proxy.NO_PROXY}, an + * {@link ApplicationProxy} instance, nor already a {@code Proxy} instance. + */ + public static Proxy copyProxy(Proxy proxy) { + return proxy == null + || proxy.getClass() == Proxy.class + || proxy instanceof ApplicationProxy + ? proxy + : new Proxy(proxy.type(), proxy.address()); + } + +} diff --git a/src/java.base/share/classes/sun/net/www/http/HttpClient.java b/src/java.base/share/classes/sun/net/www/http/HttpClient.java index a1c9e9729902..47d59c99cd91 100644 --- a/src/java.base/share/classes/sun/net/www/http/HttpClient.java +++ b/src/java.base/share/classes/sun/net/www/http/HttpClient.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1994, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1994, 2025, 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 @@ -41,6 +41,8 @@ import sun.net.www.protocol.http.AuthCacheImpl; import sun.net.www.protocol.http.HttpURLConnection; import sun.util.logging.PlatformLogger; + +import static sun.net.util.ProxyUtil.copyProxy; import static sun.net.www.protocol.http.HttpURLConnection.TunnelState.*; import sun.security.action.GetPropertyAction; @@ -267,7 +269,7 @@ public HttpClient(URL url, String proxyHost, int proxyPort) } protected HttpClient(URL url, Proxy p, int to) throws IOException { - proxy = (p == null) ? Proxy.NO_PROXY : p; + proxy = p == null ? Proxy.NO_PROXY : copyProxy(p); this.host = url.getHost(); this.url = url; port = url.getPort(); @@ -332,9 +334,7 @@ public static HttpClient New(URL url, boolean useCache) public static HttpClient New(URL url, Proxy p, int to, boolean useCache, HttpURLConnection httpuc) throws IOException { - if (p == null) { - p = Proxy.NO_PROXY; - } + p = p == null ? Proxy.NO_PROXY : copyProxy(p); HttpClient ret = null; /* see if one's already around */ if (useCache) { diff --git a/src/java.base/share/classes/sun/net/www/protocol/file/FileURLConnection.java b/src/java.base/share/classes/sun/net/www/protocol/file/FileURLConnection.java index a9ce7cee9a18..545dc4b69e54 100644 --- a/src/java.base/share/classes/sun/net/www/protocol/file/FileURLConnection.java +++ b/src/java.base/share/classes/sun/net/www/protocol/file/FileURLConnection.java @@ -90,6 +90,12 @@ public void connect() throws IOException { } } + public synchronized void closeInputStream() throws IOException { + if (is != null) { + is.close(); + } + } + private boolean initializedHeaders = false; private void initializeHeaders() { diff --git a/src/java.base/share/classes/sun/net/www/protocol/ftp/FtpURLConnection.java b/src/java.base/share/classes/sun/net/www/protocol/ftp/FtpURLConnection.java index ecc17ea85ec4..73b60d5c98eb 100644 --- a/src/java.base/share/classes/sun/net/www/protocol/ftp/FtpURLConnection.java +++ b/src/java.base/share/classes/sun/net/www/protocol/ftp/FtpURLConnection.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1994, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1994, 2025, 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 @@ -48,6 +48,7 @@ import java.util.StringTokenizer; import java.security.Permission; import java.util.Properties; + import sun.net.NetworkClient; import sun.net.util.IPAddressUtil; import sun.net.www.MessageHeader; @@ -59,6 +60,7 @@ import sun.net.www.ParseUtil; import sun.security.action.GetPropertyAction; +import static sun.net.util.ProxyUtil.copyProxy; /** * This class Opens an FTP input (or output) stream given a URL. @@ -246,7 +248,7 @@ public ProxySelector run() { throw new IOException("Failed to select a proxy", iae); } for (Proxy proxy : proxies) { - p = proxy; + p = copyProxy(proxy); if (p == null || p == Proxy.NO_PROXY || p.type() == Proxy.Type.SOCKS) { break; diff --git a/src/java.base/share/classes/sun/net/www/protocol/ftp/Handler.java b/src/java.base/share/classes/sun/net/www/protocol/ftp/Handler.java index 1de4c52abea5..53fa355cb013 100644 --- a/src/java.base/share/classes/sun/net/www/protocol/ftp/Handler.java +++ b/src/java.base/share/classes/sun/net/www/protocol/ftp/Handler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1994, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1994, 2025, 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 @@ -33,11 +33,9 @@ import java.net.MalformedURLException; import java.net.URL; import java.net.Proxy; -import java.util.Map; -import java.util.HashMap; import java.util.Objects; -import sun.net.ftp.FtpClient; -import sun.net.www.protocol.http.HttpURLConnection; + +import static sun.net.util.ProxyUtil.copyProxy; /** open an ftp connection given a URL */ public class Handler extends java.net.URLStreamHandler { @@ -57,11 +55,11 @@ protected java.net.URLConnection openConnection(URL u) return openConnection(u, null); } - protected java.net.URLConnection openConnection(URL u, Proxy p) + protected java.net.URLConnection openConnection(URL u, Proxy proxy) throws IOException { - FtpURLConnection connection = null; + FtpURLConnection connection; try { - connection = new FtpURLConnection(u, p); + connection = new FtpURLConnection(u, copyProxy(proxy)); } catch (IllegalArgumentException e) { var mfue = new MalformedURLException(e.getMessage()); mfue.initCause(e); diff --git a/src/java.base/share/classes/sun/net/www/protocol/http/HttpURLConnection.java b/src/java.base/share/classes/sun/net/www/protocol/http/HttpURLConnection.java index 2f72334b66d2..bc747a53dd9a 100644 --- a/src/java.base/share/classes/sun/net/www/protocol/http/HttpURLConnection.java +++ b/src/java.base/share/classes/sun/net/www/protocol/http/HttpURLConnection.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 2025, 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 @@ -84,6 +84,7 @@ import java.util.Properties; import java.util.concurrent.locks.ReentrantLock; +import static sun.net.util.ProxyUtil.copyProxy; import static sun.net.www.protocol.http.AuthScheme.BASIC; import static sun.net.www.protocol.http.AuthScheme.DIGEST; import static sun.net.www.protocol.http.AuthScheme.NTLM; @@ -931,7 +932,7 @@ protected HttpURLConnection(URL u, Proxy p, Handler handler) responses = new MessageHeader(maxHeaderSize); userHeaders = new MessageHeader(); this.handler = handler; - instProxy = p; + instProxy = copyProxy(p); if (instProxy instanceof sun.net.ApplicationProxy) { /* Application set Proxies should not have access to cookies * in a secure environment unless explicitly allowed. */ @@ -1246,7 +1247,7 @@ public ProxySelector run() { final Iterator it = proxies.iterator(); Proxy p; while (it.hasNext()) { - p = it.next(); + p = copyProxy(it.next()); try { if (!failedOnce) { http = getNewHttpClient(url, p, connectTimeout); diff --git a/src/java.base/share/classes/sun/net/www/protocol/jar/JarURLConnection.java b/src/java.base/share/classes/sun/net/www/protocol/jar/JarURLConnection.java index 163924f7bb72..85d36fe23207 100644 --- a/src/java.base/share/classes/sun/net/www/protocol/jar/JarURLConnection.java +++ b/src/java.base/share/classes/sun/net/www/protocol/jar/JarURLConnection.java @@ -25,6 +25,7 @@ package sun.net.www.protocol.jar; +import sun.net.www.protocol.file.FileURLConnection; import java.io.BufferedInputStream; import java.io.FileNotFoundException; import java.io.IOException; @@ -88,8 +89,14 @@ public void close () throws IOException { try { super.close(); } finally { - if (!getUseCaches()) { - jarFile.close(); + try { + if (!getUseCaches()) { + jarFile.close(); + } + } finally { + if (jarFileURLConnection instanceof FileURLConnection fileURLConnection) { + fileURLConnection.closeInputStream(); + } } } } diff --git a/src/java.base/share/classes/sun/nio/ch/Poller.java b/src/java.base/share/classes/sun/nio/ch/Poller.java index d39b5945b075..5893c03995f0 100644 --- a/src/java.base/share/classes/sun/nio/ch/Poller.java +++ b/src/java.base/share/classes/sun/nio/ch/Poller.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -146,12 +146,18 @@ private void pollIndirect(int fdVal, long nanos, BooleanSupplier supplier) { } /** - * Registers the file descriptor. + * Registers the file descriptor to be polled at most once when the file descriptor + * is ready for I/O. */ private void register(int fdVal) throws IOException { - Thread previous = map.putIfAbsent(fdVal, Thread.currentThread()); + Thread previous = map.put(fdVal, Thread.currentThread()); assert previous == null; - implRegister(fdVal); + try { + implRegister(fdVal); + } catch (Throwable t) { + map.remove(fdVal); + throw t; + } } /** @@ -159,7 +165,7 @@ private void register(int fdVal) throws IOException { * a Request object to track the request. */ private Request registerAsync(int fdVal) { - Thread previous = map.putIfAbsent(fdVal, Thread.currentThread()); + Thread previous = map.put(fdVal, Thread.currentThread()); assert previous == null; Request request = new Request(fdVal); queue.add(request); @@ -167,14 +173,13 @@ private Request registerAsync(int fdVal) { } /** - * Deregister the file descriptor, a no-op if already polled. + * Deregister the file descriptor so that the file descriptor is not polled. */ private void deregister(int fdVal) { Thread previous = map.remove(fdVal); - assert previous == null || previous == Thread.currentThread(); - if (previous != null) { - implDeregister(fdVal); - } + boolean polled = (previous == null); + assert polled || previous == Thread.currentThread(); + implDeregister(fdVal, polled); } /** @@ -225,14 +230,16 @@ void awaitFinish() { } /** - * Register the file descriptor. + * Register the file descriptor. The registration is "one shot", meaning it should + * be polled at most once. */ abstract void implRegister(int fdVal) throws IOException; /** * Deregister the file descriptor. + * @param polled true if the file descriptor has already been polled */ - abstract void implDeregister(int fdVal); + abstract void implDeregister(int fdVal, boolean polled); /** * Starts the poller threads. diff --git a/src/java.base/share/classes/sun/nio/cs/StreamEncoder.java b/src/java.base/share/classes/sun/nio/cs/StreamEncoder.java index 456d89b32e3b..f922a7874661 100644 --- a/src/java.base/share/classes/sun/nio/cs/StreamEncoder.java +++ b/src/java.base/share/classes/sun/nio/cs/StreamEncoder.java @@ -414,8 +414,8 @@ void implFlush() throws IOException { } void implClose() throws IOException { - flushLeftoverChar(null, true); - try { + try (ch; out) { + flushLeftoverChar(null, true); for (;;) { CoderResult cr = encoder.flush(bb); if (cr.isUnderflow()) @@ -430,15 +430,8 @@ void implClose() throws IOException { if (bb.position() > 0) writeBytes(); - if (ch != null) - ch.close(); - else { - try { - out.flush(); - } finally { - out.close(); - } - } + if (out != null) + out.flush(); } catch (IOException x) { encoder.reset(); throw x; diff --git a/src/java.base/share/classes/sun/security/jca/ProviderList.java b/src/java.base/share/classes/sun/security/jca/ProviderList.java index c93983cd4aac..0dfead031582 100644 --- a/src/java.base/share/classes/sun/security/jca/ProviderList.java +++ b/src/java.base/share/classes/sun/security/jca/ProviderList.java @@ -369,17 +369,19 @@ public Service getService(String type, String name) { int i; // Preferred provider list - if (preferredPropList != null && - (pList = preferredPropList.getAll(type, name)) != null) { + if (preferredPropList != null) { + pList = preferredPropList.getAll(type, name); for (i = 0; i < pList.size(); i++) { Provider p = getProvider(pList.get(i).provider); + if (p == null) { + continue; + } Service s = p.getService(type, name); if (s != null) { return s; } } } - for (i = 0; i < configs.length; i++) { Provider p = getProvider(i); Service s = p.getService(type, name); diff --git a/src/java.base/share/classes/sun/security/pkcs12/PKCS12KeyStore.java b/src/java.base/share/classes/sun/security/pkcs12/PKCS12KeyStore.java index 253301223c5d..52393f0466ab 100644 --- a/src/java.base/share/classes/sun/security/pkcs12/PKCS12KeyStore.java +++ b/src/java.base/share/classes/sun/security/pkcs12/PKCS12KeyStore.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2024, 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 @@ -295,9 +295,13 @@ static S run(RetryWithZero f, char[] password) throws Exception { * (e.g., the given password is wrong). */ public Key engineGetKey(String alias, char[] password) - throws NoSuchAlgorithmException, UnrecoverableKeyException - { + throws NoSuchAlgorithmException, UnrecoverableKeyException { Entry entry = entries.get(alias.toLowerCase(Locale.ENGLISH)); + return internalGetKey(entry, password); + } + + private Key internalGetKey(Entry entry, char[] password) + throws NoSuchAlgorithmException, UnrecoverableKeyException { Key key; if (!(entry instanceof KeyEntry)) { @@ -321,7 +325,7 @@ public Key engineGetKey(String alias, char[] password) try { // get the encrypted private key EncryptedPrivateKeyInfo encrInfo = - new EncryptedPrivateKeyInfo(encrBytes); + new EncryptedPrivateKeyInfo(encrBytes); encryptedKey = encrInfo.getEncryptedData(); // parse Algorithm parameters @@ -332,20 +336,20 @@ public Key engineGetKey(String alias, char[] password) } catch (IOException ioe) { UnrecoverableKeyException uke = - new UnrecoverableKeyException("Private key not stored as " - + "PKCS#8 EncryptedPrivateKeyInfo: " + ioe); + new UnrecoverableKeyException("Private key not stored as " + + "PKCS#8 EncryptedPrivateKeyInfo: " + ioe); uke.initCause(ioe); throw uke; } - try { + try { PBEParameterSpec pbeSpec; int ic; if (algParams != null) { try { pbeSpec = - algParams.getParameterSpec(PBEParameterSpec.class); + algParams.getParameterSpec(PBEParameterSpec.class); } catch (InvalidParameterSpecException ipse) { throw new IOException("Invalid PBE algorithm parameters"); } @@ -392,7 +396,7 @@ public Key engineGetKey(String alias, char[] password) if (debug != null) { debug.println("Retrieved a protected private key at alias" + - " '" + alias + "' (" + + " '" + entry.alias + "' (" + aid.getName() + " iterations: " + ic + ")"); } @@ -433,7 +437,7 @@ public Key engineGetKey(String alias, char[] password) if (debug != null) { debug.println("Retrieved a protected secret key at alias " + - "'" + alias + "' (" + + "'" + entry.alias + "' (" + aid.getName() + " iterations: " + ic + ")"); } @@ -450,8 +454,8 @@ public Key engineGetKey(String alias, char[] password) } catch (Exception e) { UnrecoverableKeyException uke = - new UnrecoverableKeyException("Get Key failed: " + - e.getMessage()); + new UnrecoverableKeyException("Get Key failed: " + + e.getMessage()); uke.initCause(e); throw uke; } @@ -471,6 +475,10 @@ public Key engineGetKey(String alias, char[] password) */ public Certificate[] engineGetCertificateChain(String alias) { Entry entry = entries.get(alias.toLowerCase(Locale.ENGLISH)); + return internalGetCertificateChain(entry); + } + + private Certificate[] internalGetCertificateChain(Entry entry) { if (entry instanceof PrivateKeyEntry privateKeyEntry) { if (privateKeyEntry.chain == null) { return null; @@ -478,8 +486,8 @@ public Certificate[] engineGetCertificateChain(String alias) { if (debug != null) { debug.println("Retrieved a " + - privateKeyEntry.chain.length + - "-certificate chain at alias '" + alias + "'"); + privateKeyEntry.chain.length + + "-certificate chain at alias '" + entry.alias + "'"); } return privateKeyEntry.chain.clone(); @@ -705,6 +713,7 @@ private void setKeyEntry(String alias, Key key, // set the alias entry.alias = alias.toLowerCase(Locale.ENGLISH); // add the entry + populateAttributes(entry); entries.put(alias.toLowerCase(Locale.ENGLISH), entry); } catch (KeyStoreException kse) { @@ -785,6 +794,7 @@ public synchronized void engineSetKeyEntry(String alias, byte[] key, // add the entry privateKeyCount++; + populateAttributes(entry); entries.put(alias.toLowerCase(Locale.ENGLISH), entry); } @@ -988,6 +998,7 @@ private void setCertEntry(String alias, Certificate cert, new CertEntry((X509Certificate) cert, null, alias, AnyUsage, attributes); certificateCount++; + populateAttributes(certEntry); entries.put(alias.toLowerCase(Locale.ENGLISH), certEntry); if (debug != null) { @@ -1010,18 +1021,19 @@ public synchronized void engineDeleteEntry(String alias) debug.println("Removing entry at alias '" + alias + "'"); } - Entry entry = entries.get(alias.toLowerCase(Locale.ENGLISH)); - if (entry instanceof PrivateKeyEntry keyEntry) { - if (keyEntry.chain != null) { - certificateCount -= keyEntry.chain.length; + Entry entry = entries.remove(alias.toLowerCase(Locale.ENGLISH)); + if (entry != null) { + if (entry instanceof PrivateKeyEntry keyEntry) { + if (keyEntry.chain != null) { + certificateCount -= keyEntry.chain.length; + } + privateKeyCount--; + } else if (entry instanceof CertEntry) { + certificateCount--; + } else if (entry instanceof SecretKeyEntry) { + secretKeyCount--; } - privateKeyCount--; - } else if (entry instanceof CertEntry) { - certificateCount--; - } else if (entry instanceof SecretKeyEntry) { - secretKeyCount--; } - entries.remove(alias.toLowerCase(Locale.ENGLISH)); } /** @@ -1062,6 +1074,10 @@ public int engineSize() { */ public boolean engineIsKeyEntry(String alias) { Entry entry = entries.get(alias.toLowerCase(Locale.ENGLISH)); + return internalIsKeyEntry(entry); + } + + private boolean internalIsKeyEntry(Entry entry) { return entry instanceof KeyEntry; } @@ -1072,8 +1088,13 @@ public boolean engineIsKeyEntry(String alias) { * @return true if the entry identified by the given alias is a * trusted certificate entry, false otherwise. */ + public boolean engineIsCertificateEntry(String alias) { Entry entry = entries.get(alias.toLowerCase(Locale.ENGLISH)); + return internalIsCertificateEntry(entry); + } + + private boolean internalIsCertificateEntry(Entry entry) { return entry instanceof CertEntry certEntry && certEntry.trustedKeyUsage != null; } @@ -1264,7 +1285,7 @@ public Set engineGetAttributes(String alias) { return super.engineGetAttributes(alias); } Entry entry = entries.get(alias.toLowerCase(Locale.ENGLISH)); - return Collections.unmodifiableSet(new HashSet<>(getAttributes(entry))); + return Collections.unmodifiableSet(new HashSet<>(entry.attributes)); } /** @@ -1303,18 +1324,14 @@ public KeyStore.Entry engineGetEntry(String alias, Entry entry = entries.get(alias.toLowerCase(Locale.ENGLISH)); if (protParam == null) { - if (engineIsCertificateEntry(alias)) { - if (entry instanceof CertEntry && - ((CertEntry) entry).trustedKeyUsage != null) { - - if (debug != null) { - debug.println("Retrieved a trusted certificate at " + + if (internalIsCertificateEntry(entry)) { + if (debug != null) { + debug.println("Retrieved a trusted certificate at " + "alias '" + alias + "'"); - } - - return new KeyStore.TrustedCertificateEntry( - ((CertEntry)entry).cert, getAttributes(entry)); } + + return new KeyStore.TrustedCertificateEntry( + ((CertEntry)entry).cert, entry.attributes); } else { throw new UnrecoverableKeyException ("requested entry requires a password"); @@ -1322,27 +1339,27 @@ public KeyStore.Entry engineGetEntry(String alias, } if (protParam instanceof KeyStore.PasswordProtection) { - if (engineIsCertificateEntry(alias)) { + if (internalIsCertificateEntry(entry)) { throw new UnsupportedOperationException ("trusted certificate entries are not password-protected"); - } else if (engineIsKeyEntry(alias)) { + } else if (internalIsKeyEntry(entry)) { KeyStore.PasswordProtection pp = (KeyStore.PasswordProtection)protParam; char[] password = pp.getPassword(); - Key key = engineGetKey(alias, password); + Key key = internalGetKey(entry, password); if (key instanceof PrivateKey) { - Certificate[] chain = engineGetCertificateChain(alias); + Certificate[] chain = internalGetCertificateChain(entry); return new KeyStore.PrivateKeyEntry((PrivateKey)key, chain, - getAttributes(entry)); + entry.attributes); } else if (key instanceof SecretKey) { return new KeyStore.SecretKeyEntry((SecretKey)key, - getAttributes(entry)); + entry.attributes); } - } else if (!engineIsKeyEntry(alias)) { + } else { throw new UnsupportedOperationException ("untrusted certificate entries are not " + "password-protected"); @@ -1429,9 +1446,9 @@ public synchronized void engineSetEntry(String alias, KeyStore.Entry entry, } /* - * Assemble the entry attributes + * Populate the entry with additional attributes used by the implementation. */ - private Set getAttributes(Entry entry) { + private void populateAttributes(Entry entry) { if (entry.attributes == null) { entry.attributes = new HashSet<>(); @@ -1464,8 +1481,6 @@ private Set getAttributes(Entry entry) { } } } - - return entry.attributes; } /* @@ -2522,6 +2537,7 @@ private void loadSafeContents(DerInputStream stream) alias = getUnfriendlyName(); } entry.alias = alias; + populateAttributes(entry); entries.put(alias.toLowerCase(Locale.ENGLISH), entry); } else if (bagItem instanceof X509Certificate cert) { @@ -2543,6 +2559,7 @@ private void loadSafeContents(DerInputStream stream) CertEntry certEntry = new CertEntry(cert, keyId, alias, trustedKeyUsage, attributes); + populateAttributes(certEntry); entries.put(alias.toLowerCase(Locale.ENGLISH), certEntry); } else { certEntries.add(new CertEntry(cert, keyId, alias)); diff --git a/src/java.base/share/classes/sun/security/provider/HSS.java b/src/java.base/share/classes/sun/security/provider/HSS.java index cb7d470b4807..c1cb5ed6a308 100644 --- a/src/java.base/share/classes/sun/security/provider/HSS.java +++ b/src/java.base/share/classes/sun/security/provider/HSS.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, 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 @@ -757,12 +757,8 @@ static class HSSPublicKey extends X509Key implements Serializable { Arrays.copyOfRange(keyArray, 4, keyArray.length), 0, true); algid = new AlgorithmId(ObjectIdentifier.of(KnownOIDs.HSSLMS)); - byte[] derEncodedKeyarray = - new DerOutputStream() - .putOctetString(keyArray) - .toByteArray(); this.setKey(new BitArray( - 8 * derEncodedKeyarray.length, derEncodedKeyarray)); + 8 * keyArray.length, keyArray)); } } @@ -783,11 +779,17 @@ public String toString() { @Override protected void parseKeyBits() throws InvalidKeyException { byte[] keyArray = getKey().toByteArray(); - if ((keyArray[0] != DerValue.tag_OctetString) || (keyArray[1] != keyArray.length -2)) { - throw new InvalidKeyException("Bad X509Key"); + if (keyArray.length < 12) { // More length check in LMSPublicKey + throw new InvalidKeyException("LMS public key is too short"); + } + if (keyArray[0] == DerValue.tag_OctetString + && keyArray[1] == keyArray.length - 2) { + // pre-8347596 format that has an inner OCTET STRING. + keyArray = Arrays.copyOfRange(keyArray, 2, keyArray.length); + setKey(new BitArray(keyArray.length * 8, keyArray)); } - L = LMSUtils.fourBytesToInt(keyArray, 2); - lmsPublicKey = new LMSPublicKey(keyArray, 6, true); + L = LMSUtils.fourBytesToInt(keyArray, 0); + lmsPublicKey = new LMSPublicKey(keyArray, 4, true); } @java.io.Serial diff --git a/src/java.base/share/classes/sun/security/provider/certpath/DistributionPointFetcher.java b/src/java.base/share/classes/sun/security/provider/certpath/DistributionPointFetcher.java index b231b7cbc86f..31c0f4ecb9c5 100644 --- a/src/java.base/share/classes/sun/security/provider/certpath/DistributionPointFetcher.java +++ b/src/java.base/share/classes/sun/security/provider/certpath/DistributionPointFetcher.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -101,16 +101,28 @@ public static Collection getCRLs(X509CRLSelector selector, } return Collections.emptySet(); } - List points = - ext.getDistributionPoints(); + List points = ext.getDistributionPoints(); Set results = new HashSet<>(); + CertStoreException savedCSE = null; for (Iterator t = points.iterator(); t.hasNext() && !Arrays.equals(reasonsMask, ALL_REASONS); ) { - DistributionPoint point = t.next(); - Collection crls = getCRLs(selector, certImpl, - point, reasonsMask, signFlag, prevKey, prevCert, provider, - certStores, trustAnchors, validity, variant, anchor); - results.addAll(crls); + try { + DistributionPoint point = t.next(); + Collection crls = getCRLs(selector, certImpl, + point, reasonsMask, signFlag, prevKey, prevCert, provider, + certStores, trustAnchors, validity, variant, anchor); + results.addAll(crls); + } catch (CertStoreException cse) { + if (savedCSE == null) { + savedCSE = cse; + } else { + savedCSE.addSuppressed(cse); + } + } + } + // only throw CertStoreException if no CRLs are retrieved + if (results.isEmpty() && savedCSE != null) { + throw savedCSE; } if (debug != null) { debug.println("Returning " + results.size() + " CRLs"); @@ -182,7 +194,11 @@ private static Collection getCRLs(X509CRLSelector selector, } } } catch (CertStoreException cse) { - savedCSE = cse; + if (savedCSE == null) { + savedCSE = cse; + } else { + savedCSE.addSuppressed(cse); + } } } // only throw CertStoreException if no CRLs are retrieved diff --git a/src/java.base/share/classes/sun/security/provider/certpath/OCSP.java b/src/java.base/share/classes/sun/security/provider/certpath/OCSP.java index 6f1f7b6ad737..bb96a587a9d3 100644 --- a/src/java.base/share/classes/sun/security/provider/certpath/OCSP.java +++ b/src/java.base/share/classes/sun/security/provider/certpath/OCSP.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2025, 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 @@ -67,7 +67,6 @@ public final class OCSP { private static final Debug debug = Debug.getInstance("certpath"); private static final int DEFAULT_CONNECT_TIMEOUT = 15000; - private static final int DEFAULT_READ_TIMEOUT = 15000; /** * Integer value indicating the timeout length, in milliseconds, to be @@ -83,7 +82,7 @@ public final class OCSP { * zero is interpreted as an infinite timeout. */ private static final int READ_TIMEOUT = initializeTimeout( - "com.sun.security.ocsp.readtimeout", DEFAULT_READ_TIMEOUT); + "com.sun.security.ocsp.readtimeout", CONNECT_TIMEOUT); /** * Boolean value indicating whether OCSP client can use GET for OCSP diff --git a/src/java.base/share/classes/sun/security/ssl/CertificateMessage.java b/src/java.base/share/classes/sun/security/ssl/CertificateMessage.java index bdf2935eff3b..61a9cfb270e4 100644 --- a/src/java.base/share/classes/sun/security/ssl/CertificateMessage.java +++ b/src/java.base/share/classes/sun/security/ssl/CertificateMessage.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, 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 @@ -1129,6 +1129,15 @@ public void consume(ConnectionContext context, // clean up this consumer hc.handshakeConsumers.remove(SSLHandshake.CERTIFICATE.id); + + // Ensure that the Certificate message has not been sent w/o + // an EncryptedExtensions preceding + if (hc.handshakeConsumers.containsKey( + SSLHandshake.ENCRYPTED_EXTENSIONS.id)) { + throw hc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, + "Unexpected Certificate handshake message"); + } + T13CertificateMessage cm = new T13CertificateMessage(hc, message); if (hc.sslConfig.isClientMode) { if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) { diff --git a/src/java.base/share/classes/sun/security/ssl/CertificateVerify.java b/src/java.base/share/classes/sun/security/ssl/CertificateVerify.java index 518a525b12fc..09d07d8e62d7 100644 --- a/src/java.base/share/classes/sun/security/ssl/CertificateVerify.java +++ b/src/java.base/share/classes/sun/security/ssl/CertificateVerify.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, 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 @@ -1163,6 +1163,14 @@ public void consume(ConnectionContext context, // Clean up this consumer hc.handshakeConsumers.remove(SSLHandshake.CERTIFICATE_VERIFY.id); + // Ensure that the Certificate Verify message has not been sent w/o + // a Certificate message preceding + if (hc.handshakeConsumers.containsKey( + SSLHandshake.CERTIFICATE.id)) { + throw hc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, + "Unexpected Certificate Verify handshake message"); + } + T13CertificateVerifyMessage cvm = new T13CertificateVerifyMessage(hc, message); if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) { diff --git a/src/java.base/share/classes/sun/security/ssl/Finished.java b/src/java.base/share/classes/sun/security/ssl/Finished.java index 604a15fe1a68..7aef02d65e0d 100644 --- a/src/java.base/share/classes/sun/security/ssl/Finished.java +++ b/src/java.base/share/classes/sun/security/ssl/Finished.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, 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 @@ -900,6 +900,14 @@ public void consume(ConnectionContext context, private void onConsumeFinished(ClientHandshakeContext chc, ByteBuffer message) throws IOException { + // Ensure that the Finished message has not been sent w/o + // an EncryptedExtensions preceding + if (chc.handshakeConsumers.containsKey( + SSLHandshake.ENCRYPTED_EXTENSIONS.id)) { + throw chc.conContext.fatal(Alert.UNEXPECTED_MESSAGE, + "Unexpected Finished handshake message"); + } + // Make sure that any expected CertificateVerify message // has been received and processed. if (!chc.isResumption) { diff --git a/src/java.base/share/classes/sun/security/validator/CamerfirmaTLSPolicy.java b/src/java.base/share/classes/sun/security/validator/CamerfirmaTLSPolicy.java index 591a7a26c689..984f5a0ab47f 100644 --- a/src/java.base/share/classes/sun/security/validator/CamerfirmaTLSPolicy.java +++ b/src/java.base/share/classes/sun/security/validator/CamerfirmaTLSPolicy.java @@ -43,26 +43,14 @@ final class CamerfirmaTLSPolicy { private static final Debug debug = Debug.getInstance("certpath"); - // SHA-256 certificate fingerprints of distrusted roots - private static final Set FINGERPRINTS = Set.of( - // cacerts alias: camerfirmachamberscommerceca - // DN: CN=Chambers of Commerce Root, - // OU=http://www.chambersign.org, - // O=AC Camerfirma SA CIF A82743287, C=EU - "0C258A12A5674AEF25F28BA7DCFAECEEA348E541E6F5CC4EE63B71B361606AC3", - // cacerts alias: camerfirmachambersca - // DN: CN=Chambers of Commerce Root - 2008, - // O=AC Camerfirma S.A., SERIALNUMBER=A82743287, - // L=Madrid (see current address at www.camerfirma.com/address), - // C=EU - "063E4AFAC491DFD332F3089B8542E94617D893D7FE944E10A7937EE29D9693C0", - // cacerts alias: camerfirmachambersignca - // DN: CN=Global Chambersign Root - 2008, - // O=AC Camerfirma S.A., SERIALNUMBER=A82743287, - // L=Madrid (see current address at www.camerfirma.com/address), - // C=EU - "136335439334A7698016A0D324DE72284E079D7B5220BB8FBD747816EEBEBACA" - ); + // SHA-256 certificate fingerprint of distrusted root for TLS + // cacerts alias: camerfirmachambersca + // DN: CN=Chambers of Commerce Root - 2008, + // O=AC Camerfirma S.A., SERIALNUMBER=A82743287, + // L=Madrid (see current address at www.camerfirma.com/address), + // C=EU + private static final String FINGERPRINT = + "063E4AFAC491DFD332F3089B8542E94617D893D7FE944E10A7937EE29D9693C0"; // Any TLS Server certificate that is anchored by one of the Camerfirma // roots above and is issued after this date will be distrusted. @@ -85,7 +73,7 @@ static void checkDistrust(X509Certificate[] chain) throw new ValidatorException("Cannot generate fingerprint for " + "trust anchor of TLS server certificate"); } - if (FINGERPRINTS.contains(fp)) { + if (FINGERPRINT.equalsIgnoreCase(fp)) { Date notBefore = chain[0].getNotBefore(); LocalDate ldNotBefore = LocalDate.ofInstant(notBefore.toInstant(), ZoneOffset.UTC); diff --git a/src/java.base/share/classes/sun/util/resources/CurrencyNames.properties b/src/java.base/share/classes/sun/util/resources/CurrencyNames.properties index 3559f793c543..1d1e9db237db 100644 --- a/src/java.base/share/classes/sun/util/resources/CurrencyNames.properties +++ b/src/java.base/share/classes/sun/util/resources/CurrencyNames.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2005, 2025, 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 @@ -261,6 +261,7 @@ VES=VES VND=VND VUV=VUV WST=WST +XAD=XAD XAF=XAF XAG=XAG XAU=XAU @@ -488,6 +489,7 @@ ves=Venezuelan Bol\u00edvar Soberano vnd=Vietnamese Dong vuv=Vanuatu Vatu wst=Samoan Tala +xad=Arab Accounting Dinar xaf=CFA Franc BEAC xag=Silver xau=Gold diff --git a/src/java.base/share/data/cacerts/baltimorecybertrustca b/src/java.base/share/data/cacerts/baltimorecybertrustca deleted file mode 100644 index b3cf6547c166..000000000000 --- a/src/java.base/share/data/cacerts/baltimorecybertrustca +++ /dev/null @@ -1,28 +0,0 @@ -Owner: CN=Baltimore CyberTrust Root, OU=CyberTrust, O=Baltimore, C=IE -Issuer: CN=Baltimore CyberTrust Root, OU=CyberTrust, O=Baltimore, C=IE -Serial number: 20000b9 -Valid from: Fri May 12 18:46:00 GMT 2000 until: Mon May 12 23:59:00 GMT 2025 -Signature algorithm name: SHA1withRSA -Subject Public Key Algorithm: 2048-bit RSA key -Version: 3 ------BEGIN CERTIFICATE----- -MIIDdzCCAl+gAwIBAgIEAgAAuTANBgkqhkiG9w0BAQUFADBaMQswCQYDVQQGEwJJ -RTESMBAGA1UEChMJQmFsdGltb3JlMRMwEQYDVQQLEwpDeWJlclRydXN0MSIwIAYD -VQQDExlCYWx0aW1vcmUgQ3liZXJUcnVzdCBSb290MB4XDTAwMDUxMjE4NDYwMFoX -DTI1MDUxMjIzNTkwMFowWjELMAkGA1UEBhMCSUUxEjAQBgNVBAoTCUJhbHRpbW9y -ZTETMBEGA1UECxMKQ3liZXJUcnVzdDEiMCAGA1UEAxMZQmFsdGltb3JlIEN5YmVy -VHJ1c3QgUm9vdDCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAKMEuyKr -mD1X6CZymrV51Cni4eiVgLGw41uOKymaZN+hXe2wCQVt2yguzmKiYv60iNoS6zjr -IZ3AQSsBUnuId9Mcj8e6uYi1agnnc+gRQKfRzMpijS3ljwumUNKoUMMo6vWrJYeK -mpYcqWe4PwzV9/lSEy/CG9VwcPCPwBLKBsua4dnKM3p31vjsufFoREJIE9LAwqSu -XmD+tqYF/LTdB1kC1FkYmGP1pWPgkAx9XbIGevOF6uvUA65ehD5f/xXtabz5OTZy -dc93Uk3zyZAsuT3lySNTPx8kmCFcB5kpvcY67Oduhjprl3RjM71oGDHweI12v/ye -jl0qhqdNkNwnGjkCAwEAAaNFMEMwHQYDVR0OBBYEFOWdWTCCR1jMrPoIVDaGezq1 -BE3wMBIGA1UdEwEB/wQIMAYBAf8CAQMwDgYDVR0PAQH/BAQDAgEGMA0GCSqGSIb3 -DQEBBQUAA4IBAQCFDF2O5G9RaEIFoN27TyclhAO992T9Ldcw46QQF+vaKSm2eT92 -9hkTI7gQCvlYpNRhcL0EYWoSihfVCr3FvDB81ukMJY2GQE/szKN+OMY3EU/t3Wgx -jkzSswF07r51XgdIGn9w/xZchMB5hbgF/X++ZRGjD8ACtPhSNzkE1akxehi/oCr0 -Epn3o0WC4zxe9Z2etciefC7IpJ5OCBRLbf1wbWsaY71k5h+3zvDyny67G7fyUIhz -ksLi4xaNmjICq44Y3ekQEe5+NauQrz4wlHrQMz2nZQ/1/I6eYs9HRCwBXbsdtTLS -R9I4LtD+gdwyah617jzV/OeBHRnDJELqYzmp ------END CERTIFICATE----- diff --git a/src/java.base/share/data/cacerts/camerfirmachamberscommerceca b/src/java.base/share/data/cacerts/camerfirmachamberscommerceca deleted file mode 100644 index b92255f770cd..000000000000 --- a/src/java.base/share/data/cacerts/camerfirmachamberscommerceca +++ /dev/null @@ -1,35 +0,0 @@ -Owner: CN=Chambers of Commerce Root, OU=http://www.chambersign.org, O=AC Camerfirma SA CIF A82743287, C=EU -Issuer: CN=Chambers of Commerce Root, OU=http://www.chambersign.org, O=AC Camerfirma SA CIF A82743287, C=EU -Serial number: 0 -Valid from: Tue Sep 30 16:13:43 GMT 2003 until: Wed Sep 30 16:13:44 GMT 2037 -Signature algorithm name: SHA1withRSA -Subject Public Key Algorithm: 2048-bit RSA key -Version: 3 ------BEGIN CERTIFICATE----- -MIIEvTCCA6WgAwIBAgIBADANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJFVTEn -MCUGA1UEChMeQUMgQ2FtZXJmaXJtYSBTQSBDSUYgQTgyNzQzMjg3MSMwIQYDVQQL -ExpodHRwOi8vd3d3LmNoYW1iZXJzaWduLm9yZzEiMCAGA1UEAxMZQ2hhbWJlcnMg -b2YgQ29tbWVyY2UgUm9vdDAeFw0wMzA5MzAxNjEzNDNaFw0zNzA5MzAxNjEzNDRa -MH8xCzAJBgNVBAYTAkVVMScwJQYDVQQKEx5BQyBDYW1lcmZpcm1hIFNBIENJRiBB -ODI3NDMyODcxIzAhBgNVBAsTGmh0dHA6Ly93d3cuY2hhbWJlcnNpZ24ub3JnMSIw -IAYDVQQDExlDaGFtYmVycyBvZiBDb21tZXJjZSBSb290MIIBIDANBgkqhkiG9w0B -AQEFAAOCAQ0AMIIBCAKCAQEAtzZV5aVdGDDg2olUkfzIx1L4L1DZ77F1c2VHfRtb -unXF/KGIJPov7coISjlUxFF6tdpg6jg8gbLL8bvZkSM/SAFwdakFKq0fcfPJVD0d -BmpAPrMMhe5cG3nCYsS4No41XQEMIwRHNaqbYE6gZj3LJgqcQKH0XZi/caulAGgq -7YN6D6IUtdQis4CwPAxaUWktWBiP7Zme8a7ileb2R6jWDA+wWFjbw2Y3npuRVDM3 -0pQcakjJyfKl2qUMI/cjDpwyVV5xnIQFUZot/eZOKjRa3spAN2cMVCFVd9oKDMyX -roDclDZK9D7ONhMeU+SsTjoF7Nuucpw4i9A5O4kKPnf+dQIBA6OCAUQwggFAMBIG -A1UdEwEB/wQIMAYBAf8CAQwwPAYDVR0fBDUwMzAxoC+gLYYraHR0cDovL2NybC5j -aGFtYmVyc2lnbi5vcmcvY2hhbWJlcnNyb290LmNybDAdBgNVHQ4EFgQU45T1sU3p -26EpW1eLTXYGduHRooowDgYDVR0PAQH/BAQDAgEGMBEGCWCGSAGG+EIBAQQEAwIA -BzAnBgNVHREEIDAegRxjaGFtYmVyc3Jvb3RAY2hhbWJlcnNpZ24ub3JnMCcGA1Ud -EgQgMB6BHGNoYW1iZXJzcm9vdEBjaGFtYmVyc2lnbi5vcmcwWAYDVR0gBFEwTzBN -BgsrBgEEAYGHLgoDATA+MDwGCCsGAQUFBwIBFjBodHRwOi8vY3BzLmNoYW1iZXJz -aWduLm9yZy9jcHMvY2hhbWJlcnNyb290Lmh0bWwwDQYJKoZIhvcNAQEFBQADggEB -AAxBl8IahsAifJ/7kPMa0QOx7xP5IV8EnNrJpY0nbJaHkb5BkAFyk+cefV/2icZd -p0AJPaxJRUXcLo0waLIJuvvDL8y6C98/d3tGfToSJI6WjzwFCm/SlCgdbQzALogi -1djPHRPH8EjX1wWnz8dHnjs8NMiAT9QUu/wNUPf6s+xCX6ndbcj0dc97wXImsQEc -XCz9ek60AcUFV7nnPKoF2YjpB0ZBzu9Bga5Y34OirsrXdx/nADydb47kMgkdTXg0 -eDQ8lJsm7U9xxhl6vSAiSFr+S30Dt+dYvsYyTnQeaN2oaFuzPu5ifdmA6Ap1erfu -tGWaIZDgqtCYvDi1czyL+Nw= ------END CERTIFICATE----- diff --git a/src/java.base/share/data/cacerts/camerfirmachambersignca b/src/java.base/share/data/cacerts/camerfirmachambersignca deleted file mode 100644 index 935eea9c2121..000000000000 --- a/src/java.base/share/data/cacerts/camerfirmachambersignca +++ /dev/null @@ -1,48 +0,0 @@ -Owner: CN=Global Chambersign Root - 2008, O=AC Camerfirma S.A., SERIALNUMBER=A82743287, L=Madrid (see current address at www.camerfirma.com/address), C=EU -Issuer: CN=Global Chambersign Root - 2008, O=AC Camerfirma S.A., SERIALNUMBER=A82743287, L=Madrid (see current address at www.camerfirma.com/address), C=EU -Serial number: c9cdd3e9d57d23ce -Valid from: Fri Aug 01 12:31:40 GMT 2008 until: Sat Jul 31 12:31:40 GMT 2038 -Signature algorithm name: SHA1withRSA -Subject Public Key Algorithm: 4096-bit RSA key -Version: 3 ------BEGIN CERTIFICATE----- -MIIHSTCCBTGgAwIBAgIJAMnN0+nVfSPOMA0GCSqGSIb3DQEBBQUAMIGsMQswCQYD -VQQGEwJFVTFDMEEGA1UEBxM6TWFkcmlkIChzZWUgY3VycmVudCBhZGRyZXNzIGF0 -IHd3dy5jYW1lcmZpcm1hLmNvbS9hZGRyZXNzKTESMBAGA1UEBRMJQTgyNzQzMjg3 -MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMuQS4xJzAlBgNVBAMTHkdsb2JhbCBD -aGFtYmVyc2lnbiBSb290IC0gMjAwODAeFw0wODA4MDExMjMxNDBaFw0zODA3MzEx -MjMxNDBaMIGsMQswCQYDVQQGEwJFVTFDMEEGA1UEBxM6TWFkcmlkIChzZWUgY3Vy -cmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNvbS9hZGRyZXNzKTESMBAG -A1UEBRMJQTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMuQS4xJzAl -BgNVBAMTHkdsb2JhbCBDaGFtYmVyc2lnbiBSb290IC0gMjAwODCCAiIwDQYJKoZI -hvcNAQEBBQADggIPADCCAgoCggIBAMDfVtPkOpt2RbQT2//BthmLN0EYlVJH6xed -KYiONWwGMi5HYvNJBL99RDaxccy9Wglz1dmFRP+RVyXfXjaOcNFccUMd2drvXNL7 -G706tcuto8xEpw2uIRU/uXpbknXYpBI4iRmKt4DS4jJvVpyR1ogQC7N0ZJJ0YPP2 -zxhPYLIj0Mc7zmFLmY/CDNBAspjcDahOo7kKrmCgrUVSY7pmvWjg+b4aqIG7HkF4 -ddPB/gBVsIdU6CeQNR1MM62X/JcumIS/LMmjv9GYERTtY/jKmIhYF5ntRQOXfjyG -HoiMvvKRhI9lNNgATH23MRdaKXoKGCQwoze1eqkBfSbW+Q6OWfH9GzO1KTsXO0G2 -Id3UwD2ln58fQ1DJu7xsepeY7s2MH/ucUa6LcL0nn3HAa6x9kGbo1106DbDVwo3V -yJ2dwW3Q0L9R5OP4wzg2rtandeavhENdk5IMagfeOx2YItaswTXbo6Al/3K1dh3e -beksZixShNBFks4c5eUzHdwHU1SjqoI7mjcv3N2gZOnm3b2u/GSFHTynyQbehP9r -6GsaPMWis0L7iwk+XwhSx2LE1AVxv8Rk5Pihg+g+EpuoHtQ2TS9x9o0o9oOpE9Jh -wZG7SMA0j0GMS0zbaRL/UJScIINZc+18ofLx/d33SdNDWKBWY8o9PeU1VlnpDsog -zCtLkykPAgMBAAGjggFqMIIBZjASBgNVHRMBAf8ECDAGAQH/AgEMMB0GA1UdDgQW -BBS5CcqcHtvTbDprru1U8VuTBjUuXjCB4QYDVR0jBIHZMIHWgBS5CcqcHtvTbDpr -ru1U8VuTBjUuXqGBsqSBrzCBrDELMAkGA1UEBhMCRVUxQzBBBgNVBAcTOk1hZHJp -ZCAoc2VlIGN1cnJlbnQgYWRkcmVzcyBhdCB3d3cuY2FtZXJmaXJtYS5jb20vYWRk -cmVzcykxEjAQBgNVBAUTCUE4Mjc0MzI4NzEbMBkGA1UEChMSQUMgQ2FtZXJmaXJt -YSBTLkEuMScwJQYDVQQDEx5HbG9iYWwgQ2hhbWJlcnNpZ24gUm9vdCAtIDIwMDiC -CQDJzdPp1X0jzjAOBgNVHQ8BAf8EBAMCAQYwPQYDVR0gBDYwNDAyBgRVHSAAMCow -KAYIKwYBBQUHAgEWHGh0dHA6Ly9wb2xpY3kuY2FtZXJmaXJtYS5jb20wDQYJKoZI -hvcNAQEFBQADggIBAICIf3DekijZBZRG/5BXqfEv3xoNa/p8DhxJJHkn2EaqbylZ -UohwEurdPfWbU1Rv4WCiqAm57OtZfMY18dwY6fFn5a+6ReAJ3spED8IXDneRRXoz -X1+WLGiLwUePmJs9wOzL9dWCkoQ10b42OFZyMVtHLaoXpGNR6woBrX/sdZ7LoR/x -fxKxueRkf2fWIyr0uDldmOghp+G9PUIadJpwr2hsUF1Jz//7Dl3mLEfXgTpZALVz -a2Mg9jFFCDkO9HB+QHBaP9BrQql0PSgvAm11cpUJjUhjxsYjV5KTXjXBjfkK9yyd -Yhz2rXzdpjEetrHHfoUm+qRqtdpjMNHvkzeyZi99Bffnt0uYlDXA2TopwZ2yUDMd -SqlapskD7+3056huirRXhOukP9DuqqqHW2Pok+JrqNS4cnhrG+055F3Lm6qH1U9O -AP7Zap88MQ8oAgF9mOinsKJknnn4SPIVqczmyETrP3iZ8ntxPjzxmKfFGBI/5rso -M0LpRQp8bfKGeS/Fghl9CYl8slR2iK7ewfPM4W7bMdaTrpmg7yVqc5iJWzouE4ge -v8CSlDQb4ye3ix5vQv/n6TebUB0tovkC7stYWDpxvGjjqsGvHCgfotwjZT+B6q6Z -09gwzxMNTxXJhLynSC34MCN32EZLeW32jO06f2ARePTpm67VVMB0gNELQp/B ------END CERTIFICATE----- diff --git a/src/java.base/share/data/cacerts/sectigocodesignroote46 b/src/java.base/share/data/cacerts/sectigocodesignroote46 new file mode 100644 index 000000000000..7f13b28a4018 --- /dev/null +++ b/src/java.base/share/data/cacerts/sectigocodesignroote46 @@ -0,0 +1,21 @@ +Owner: CN=Sectigo Public Code Signing Root E46, O=Sectigo Limited, C=GB +Issuer: CN=Sectigo Public Code Signing Root E46, O=Sectigo Limited, C=GB +Serial number: 50249ba2ef8ea6bf6c2c1f1a6385d4c3 +Valid from: Mon Mar 22 00:00:00 GMT 2021 until: Wed Mar 21 23:59:59 GMT 2046 +Signature algorithm name: SHA384withECDSA +Subject Public Key Algorithm: 384-bit EC (secp384r1) key +Version: 3 +-----BEGIN CERTIFICATE----- +MIICKDCCAa+gAwIBAgIQUCSbou+Opr9sLB8aY4XUwzAKBggqhkjOPQQDAzBWMQsw +CQYDVQQGEwJHQjEYMBYGA1UEChMPU2VjdGlnbyBMaW1pdGVkMS0wKwYDVQQDEyRT +ZWN0aWdvIFB1YmxpYyBDb2RlIFNpZ25pbmcgUm9vdCBFNDYwHhcNMjEwMzIyMDAw +MDAwWhcNNDYwMzIxMjM1OTU5WjBWMQswCQYDVQQGEwJHQjEYMBYGA1UEChMPU2Vj +dGlnbyBMaW1pdGVkMS0wKwYDVQQDEyRTZWN0aWdvIFB1YmxpYyBDb2RlIFNpZ25p +bmcgUm9vdCBFNDYwdjAQBgcqhkjOPQIBBgUrgQQAIgNiAAQIMoEDH487om+BR4zl +e7m6wWmyW0nAKLkUWG8kM85Qm3PZO8FoOZx6Yc5c0iJHRKuAhanllayqrmZYhlan +uIODzLTRDqlR+EtnOX+MubY5aDSPGUq6jiHrQrisVp0J3AejQjBAMB0GA1UdDgQW +BBTPfSygkHqYHd22XoXC4NoVcdLlXjAOBgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/ +BAUwAwEB/zAKBggqhkjOPQQDAwNnADBkAjACd++zAerlV83j8HflRwwwlLmgchbs +aGX/4g44dv/oG8KfzCVTRg6sZHMobtK0IqYCMGk5W6+oBFyZMtOebrSwXs8lGjll +/zHz43Zy8DMXO+iiqzSEwWGneZ6KupkGGqfVKw== +-----END CERTIFICATE----- diff --git a/src/java.base/share/data/cacerts/sectigocodesignrootr46 b/src/java.base/share/data/cacerts/sectigocodesignrootr46 new file mode 100644 index 000000000000..38270cb0c526 --- /dev/null +++ b/src/java.base/share/data/cacerts/sectigocodesignrootr46 @@ -0,0 +1,39 @@ +Owner: CN=Sectigo Public Code Signing Root R46, O=Sectigo Limited, C=GB +Issuer: CN=Sectigo Public Code Signing Root R46, O=Sectigo Limited, C=GB +Serial number: 4b2c3b01018bad2abc8c7b5b3eed9057 +Valid from: Mon Mar 22 00:00:00 GMT 2021 until: Wed Mar 21 23:59:59 GMT 2046 +Signature algorithm name: SHA384withRSA +Subject Public Key Algorithm: 4096-bit RSA key +Version: 3 +-----BEGIN CERTIFICATE----- +MIIFeDCCA2CgAwIBAgIQSyw7AQGLrSq8jHtbPu2QVzANBgkqhkiG9w0BAQwFADBW +MQswCQYDVQQGEwJHQjEYMBYGA1UEChMPU2VjdGlnbyBMaW1pdGVkMS0wKwYDVQQD +EyRTZWN0aWdvIFB1YmxpYyBDb2RlIFNpZ25pbmcgUm9vdCBSNDYwHhcNMjEwMzIy +MDAwMDAwWhcNNDYwMzIxMjM1OTU5WjBWMQswCQYDVQQGEwJHQjEYMBYGA1UEChMP +U2VjdGlnbyBMaW1pdGVkMS0wKwYDVQQDEyRTZWN0aWdvIFB1YmxpYyBDb2RlIFNp +Z25pbmcgUm9vdCBSNDYwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCN +55QSIgQkdC7/FiMCkoq2rjaFrEfUI5ErPtx94jGgUW+shJHjUoq14pbe0IdjJImK +/+8Skzt9u7aKvb0Ffyeba2XTpQxpsbxJOZrxbW6q5KCDJ9qaDStQ6Utbs7hkNqR+ +Sj2pcaths3OzPAsM79szV+W+NDfjlxtd/R8SPYIDdub7P2bSlDFp+m2zNKzBenjc +klDyZMeqLQSrw2rq4C+np9xu1+j/2iGrQL+57g2extmeme/G3h+pDHazJyCh1rr9 +gOcB0u/rgimVcI3/uxXP/tEPNqIuTzKQdEZrRzUTdwUzT2MuuC3hv2WnBGsY2HH6 +zAjybYmZELGt2z4s5KoYsMYHAXVn3m3pY2MeNn9pib6qRT5uWl+PoVvLnTCGMOgD +s0DGDQ84zWeoU4j6uDBl+m/H5x2xg3RpPqzEaDux5mczmrYI4IAFSEDu9oJkRqj1 +c7AGlfJsZZ+/VVscnFcax3hGfHCqlBuCF6yH6bbJDoEcQNYWFyn8XJwYK+pF9e+9 +1WdPKF4F7pBMeufG9ND8+s0+MkYTIDaKBOq3qgdGnA2TOglmmVhcKaO5DKYwODzQ +RjY1fJy67sPV+Qp2+n4FG0DKkjXp1XrRtX8ArqmQqsV/AZwQsRb8zG4Y3G9i/qZQ +p7h7uJ0VP/4gDHXIIloTlRmQAOka1cKG8eOO7F/05QIDAQABo0IwQDAdBgNVHQ4E +FgQUMuuSmv81lkgvKEBCcCA2kVwXheYwDgYDVR0PAQH/BAQDAgGGMA8GA1UdEwEB +/wQFMAMBAf8wDQYJKoZIhvcNAQEMBQADggIBAHZlwuPXIkrXHYle/2lexhQCTXOm +zc0oyrA36r+nySGqql/av/aDbNCA0QpcAKTL88w5D55BcYjVPOiKe4wXI/fKNHSR +bAauUD8AWbImPDwXg1cDPi3RGj3UzwdUskMLUnKoiPXEF/Jv0Vil0WjkPZgIGO42 +9EhImvpUcPCI1HAWMEJJ0Nk/dUtFcdiuorthDoiFUFe5uhErNikfjyBynlyeidGC +2kWNapnahHFrM6UQu3nwl/Z0gaA/V8eGjDCMDjiVrgHGHqvcqB9vL9f/dh6uF3Nt +5bl1s2EGqJUzwk5vsjfylb6FVBK5yL1iQnb3Kvz1NzEDJlf+0ebb8BYCcoOMCLOE +rKnkB/ihiMQTWlBHVEKm7dBBNCyYsT6iNKEMXb2s9395p79tDFYyhRtLl7jhrOSk +PHHxo+FOY9b0Rrr1CwjhYzztolkvCtQsayOinqFN7tESzRgzUO1Bbst/PUFgC2ML +ePV170MVtzYLEK/cXBipmNk22R3YhLMGioLjexskp0LO7g8+VlwyfexL3lYrOzu6 ++XpY0FG2bNb2WKJSJHpEhqEcYD9J0/z6+YQcBcI0v+Lm8RkqmS9WVzWctfUHw0Yv +3jg9GQ37o/HfE57nqXJYMa+96trX1m13MzOO9Kz9wb9Jh9JwBWd0Bqb2eEAtFgSR +Dx/TFsS4ehcNJMmy +-----END CERTIFICATE----- diff --git a/src/java.base/share/data/cacerts/sectigotlsroote46 b/src/java.base/share/data/cacerts/sectigotlsroote46 new file mode 100644 index 000000000000..60e0b83c97e4 --- /dev/null +++ b/src/java.base/share/data/cacerts/sectigotlsroote46 @@ -0,0 +1,21 @@ +Owner: CN=Sectigo Public Server Authentication Root E46, O=Sectigo Limited, C=GB +Issuer: CN=Sectigo Public Server Authentication Root E46, O=Sectigo Limited, C=GB +Serial number: 42f2ccda1b6937445f15fe752810b8f4 +Valid from: Mon Mar 22 00:00:00 GMT 2021 until: Wed Mar 21 23:59:59 GMT 2046 +Signature algorithm name: SHA384withECDSA +Subject Public Key Algorithm: 384-bit EC (secp384r1) key +Version: 3 +-----BEGIN CERTIFICATE----- +MIICOjCCAcGgAwIBAgIQQvLM2htpN0RfFf51KBC49DAKBggqhkjOPQQDAzBfMQsw +CQYDVQQGEwJHQjEYMBYGA1UEChMPU2VjdGlnbyBMaW1pdGVkMTYwNAYDVQQDEy1T +ZWN0aWdvIFB1YmxpYyBTZXJ2ZXIgQXV0aGVudGljYXRpb24gUm9vdCBFNDYwHhcN +MjEwMzIyMDAwMDAwWhcNNDYwMzIxMjM1OTU5WjBfMQswCQYDVQQGEwJHQjEYMBYG +A1UEChMPU2VjdGlnbyBMaW1pdGVkMTYwNAYDVQQDEy1TZWN0aWdvIFB1YmxpYyBT +ZXJ2ZXIgQXV0aGVudGljYXRpb24gUm9vdCBFNDYwdjAQBgcqhkjOPQIBBgUrgQQA +IgNiAAR2+pmpbiDt+dd34wc7qNs9Xzjoq1WmVk/WSOrsfy2qw7LFeeyZYX8QeccC +WvkEN/U0NSt3zn8gj1KjAIns1aeibVvjS5KToID1AZTc8GgHHs3u/iVStSBDHBv+ +6xnOQ6OjQjBAMB0GA1UdDgQWBBTRItpMWfFLXyY4qp3W7usNw/upYTAOBgNVHQ8B +Af8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAKBggqhkjOPQQDAwNnADBkAjAn7qRa +qCG76UeXlImldCBteU/IvZNeWBj7LRoAasm4PdCkT0RHlAFWovgzJQxC36oCMB3q +4S6ILuH5px0CMk7yn2xVdOOurvulGu7t0vzCAxHrRVxgED1cf5kDW21USAGKcw== +-----END CERTIFICATE----- diff --git a/src/java.base/share/data/cacerts/sectigotlsrootr46 b/src/java.base/share/data/cacerts/sectigotlsrootr46 new file mode 100644 index 000000000000..7ec1b263de74 --- /dev/null +++ b/src/java.base/share/data/cacerts/sectigotlsrootr46 @@ -0,0 +1,39 @@ +Owner: CN=Sectigo Public Server Authentication Root R46, O=Sectigo Limited, C=GB +Issuer: CN=Sectigo Public Server Authentication Root R46, O=Sectigo Limited, C=GB +Serial number: 758dfd8bae7c0700faa925a7e1c7ad14 +Valid from: Mon Mar 22 00:00:00 GMT 2021 until: Wed Mar 21 23:59:59 GMT 2046 +Signature algorithm name: SHA384withRSA +Subject Public Key Algorithm: 4096-bit RSA key +Version: 3 +-----BEGIN CERTIFICATE----- +MIIFijCCA3KgAwIBAgIQdY39i658BwD6qSWn4cetFDANBgkqhkiG9w0BAQwFADBf +MQswCQYDVQQGEwJHQjEYMBYGA1UEChMPU2VjdGlnbyBMaW1pdGVkMTYwNAYDVQQD +Ey1TZWN0aWdvIFB1YmxpYyBTZXJ2ZXIgQXV0aGVudGljYXRpb24gUm9vdCBSNDYw +HhcNMjEwMzIyMDAwMDAwWhcNNDYwMzIxMjM1OTU5WjBfMQswCQYDVQQGEwJHQjEY +MBYGA1UEChMPU2VjdGlnbyBMaW1pdGVkMTYwNAYDVQQDEy1TZWN0aWdvIFB1Ymxp +YyBTZXJ2ZXIgQXV0aGVudGljYXRpb24gUm9vdCBSNDYwggIiMA0GCSqGSIb3DQEB +AQUAA4ICDwAwggIKAoICAQCTvtU2UnXYASOgHEdCSe5jtrch/cSV1UgrJnwUUxDa +ef0rty2k1Cz66jLdScK5vQ9IPXtamFSvnl0xdE8H/FAh3aTPaE8bEmNtJZlMKpnz +SDBh+oF8HqcIStw+KxwfGExxqjWMrfhu6DtK2eWUAtaJhBOqbchPM8xQljeSM9xf +iOefVNlI8JhD1mb9nxc4Q8UBUQvX4yMPFF1bFOdLvt30yNoDN9HWOaEhUTCDsG3X +ME6WW5HwcCSrv0WBZEMNvSE6Lzzpng3LILVCJ8zab5vuZDCQOc2TZYEhMbUjUDM3 +IuM47fgxMMxF/mL50V0yeUKH32rMVhlATc6qu/m1dkmU8Sf4kaWD5QazYw6A3OAS +VYCmO2a0OYctyPDQ0RTp5A1NDvZdV3LFOxxHVp3i1fuBYYzMTYCQNFu31xR13NgE +SJ/AwSiItOkcyqex8Va3e0lMWeUgFaiEAin6OJRpmkkGj80feRQXEgyDet4fsZfu ++Zd4KKTIRJLpfSYFplhym3kT2BFfrsU4YjRosoYwjviQYZ4ybPUHNs2iTG7sijbt +8uaZFURww3y8nDnAtOFr94MlI1fZEoDlSfB1D++N6xybVCi0ITz8fAr/73trdf+L +HaAZBav6+CuBQug4urv7qv094PPK306Xlynt8xhW6aWWrL3DkJiy4Pmi1KZHQ3xt +zwIDAQABo0IwQDAdBgNVHQ4EFgQUVnNYZJX5khqwEioEYnmhQBWIIUkwDgYDVR0P +AQH/BAQDAgGGMA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEMBQADggIBAC9c +mTz8Bl6MlC5w6tIyMY208FHVvArzZJ8HXtXBc2hkeqK5Duj5XYUtqDdFqij0lgVQ +YKlJfp/imTYpE0RHap1VIDzYm/EDMrraQKFz6oOht0SmDpkBm+S8f74TlH7Kph52 +gDY9hAaLMyZlbcp+nv4fjFg4exqDsQ+8FxG75gbMY/qB8oFM2gsQa6H61SilzwZA +Fv97fRheORKkU55+MkIQpiGRqRxOF3yEvJ+M0ejf5lG5Nkc/kLnHvALcWxxPDkjB +JYOcCj+esQMzEhonrPcibCTRAUH4WAP+JWgiH5paPHxsnnVI84HxZmduTILA7rpX +DhjvLpr3Etiga+kFpaHpaPi8TD8SHkXoUsCjvxInebnMMTzD9joiFgOgyY9mpFui +TdaBJQbpdqQACj7LzTWb4OE4y2BThihCQRxEV+ioratF4yUQvNs+ZUH7G6aXD+u5 +dHn5HrwdVw1Hr8Mvn4dGp+smWg9WY7ViYG4A++MnESLn/pmPNPW56MORcr3Ywx65 +LvKRRFHQV80MNNVIIb/bE/FmJUNS0nAiNs2fxBx1IK1jcmMGDw4nztJqDby1ORrp +0XZ60Vzk50lJLVU3aPAaOpg+VBeHVOmmJ1CJeyAvP/+/oYtKR5j/K3tJPsMpRmAY +QqszKbrAKbkTidOIijlBO8n9pu0f9GBj39ItVQGL +-----END CERTIFICATE----- diff --git a/src/java.base/share/data/currency/CurrencyData.properties b/src/java.base/share/data/currency/CurrencyData.properties index 550662ec38a1..cc845e398f19 100644 --- a/src/java.base/share/data/currency/CurrencyData.properties +++ b/src/java.base/share/data/currency/CurrencyData.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved. # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. # # This code is free software; you can redistribute it and/or modify it @@ -32,7 +32,7 @@ formatVersion=3 # Version of the currency code information in this class. # It is a serial number that accompanies with each amendment. -dataVersion=177 +dataVersion=179 # List of all valid ISO 4217 currency codes. # To ensure compatibility, do not remove codes. @@ -54,7 +54,7 @@ all=ADP020-AED784-AFA004-AFN971-ALL008-AMD051-ANG532-AOA973-ARS032-ATS040-AUD036 SBD090-SCR690-SDD736-SDG938-SEK752-SGD702-SHP654-SIT705-SKK703-SLE925-SLL694-SOS706-\ SRD968-SRG740-SSP728-STD678-STN930-SVC222-SYP760-SZL748-THB764-TJS972-TMM795-TMT934-TND788-TOP776-\ TPE626-TRL792-TRY949-TTD780-TWD901-TZS834-UAH980-UGX800-USD840-USN997-USS998-UYI940-\ - UYU858-UZS860-VEB862-VED926-VEF937-VES928-VND704-VUV548-WST882-XAF950-XAG961-XAU959-XBA955-\ + UYU858-UZS860-VEB862-VED926-VEF937-VES928-VND704-VUV548-WST882-XAD396-XAF950-XAG961-XAU959-XBA955-\ XBB956-XBC957-XBD958-XCD951-XCG532-XDR960-XFO000-XFU000-XOF952-XPD964-XPF953-\ XPT962-XSU994-XTS963-XUA965-XXX999-YER886-YUM891-ZAR710-ZMK894-ZMW967-ZWD716-ZWG924-\ ZWL932-ZWN942-ZWR935 diff --git a/src/java.base/share/data/tzdata/VERSION b/src/java.base/share/data/tzdata/VERSION index 9c056fac3457..4bd54efbcdcf 100644 --- a/src/java.base/share/data/tzdata/VERSION +++ b/src/java.base/share/data/tzdata/VERSION @@ -21,4 +21,4 @@ # or visit www.oracle.com if you need additional information or have any # questions. # -tzdata2025a +tzdata2025b diff --git a/src/java.base/share/data/tzdata/asia b/src/java.base/share/data/tzdata/asia index b0a6fa01d208..55b13134f9c6 100644 --- a/src/java.base/share/data/tzdata/asia +++ b/src/java.base/share/data/tzdata/asia @@ -1523,6 +1523,16 @@ Zone Asia/Jayapura 9:22:48 - LMT 1932 Nov # (UIT No. 143 17.XI.1977) and not 23 September (UIT No. 141 13.IX.1977). # UIT is the Operational Bulletin of International Telecommunication Union. +# From Roozbeh Pournader (2025-03-18): +# ... the exact time of Iran's transition from +0400 to +0330 ... was Friday +# 1357/8/19 AP=1978-11-10. Here's a newspaper clip from the Ettela'at +# newspaper, dated 1357/8/14 AP=1978-11-05, translated from Persian +# (at https://w.wiki/DUEY): +# Following the government's decision about returning the official time +# to the previous status, the spokesperson for the Ministry of Energy +# announced today: At the hour 24 of Friday 19th of Aban (=1978-11-10), +# the country's time will be pulled back half an hour. +# # From Roozbeh Pournader (2003-03-15): # This is an English translation of what I just found (originally in Persian). # The Gregorian dates in brackets are mine: @@ -1650,7 +1660,7 @@ Rule Iran 2021 2022 - Sep 21 24:00 0 - Zone Asia/Tehran 3:25:44 - LMT 1916 3:25:44 - TMT 1935 Jun 13 # Tehran Mean Time 3:30 Iran %z 1977 Oct 20 24:00 - 4:00 Iran %z 1979 + 4:00 Iran %z 1978 Nov 10 24:00 3:30 Iran %z diff --git a/src/java.base/share/data/tzdata/northamerica b/src/java.base/share/data/tzdata/northamerica index 0a54e63becc8..21f178ee8cb0 100644 --- a/src/java.base/share/data/tzdata/northamerica +++ b/src/java.base/share/data/tzdata/northamerica @@ -1634,6 +1634,15 @@ Zone America/Moncton -4:19:08 - LMT 1883 Dec 9 # For more on Orillia, see: Daubs K. Bold attempt at daylight saving # time became a comic failure in Orillia. Toronto Star 2017-07-08. # https://www.thestar.com/news/insight/2017/07/08/bold-attempt-at-daylight-saving-time-became-a-comic-failure-in-orillia.html +# From Paul Eggert (2025-03-20): +# Also see the 1912-06-17 front page of The Evening Sunbeam, +# reproduced in: Richardson M. "Daylight saving was a confusing +# time in Orillia" in the 2025-03-15 Orillia Matters. Richardson writes, +# "The first Sunday after the switch was made, [DST proponent and +# Orillia mayor William Sword] Frost walked into church an hour late. +# This became a symbol of the downfall of daylight saving in Orillia." +# The mayor became known as "Daylight Bill". +# https://www.orilliamatters.com/local-news/column-daylight-saving-was-a-confusing-time-in-orillia-10377529 # From Mark Brader (2010-03-06): # diff --git a/src/java.base/share/data/tzdata/southamerica b/src/java.base/share/data/tzdata/southamerica index 0a5859600e8f..ca3c338591fd 100644 --- a/src/java.base/share/data/tzdata/southamerica +++ b/src/java.base/share/data/tzdata/southamerica @@ -1269,35 +1269,45 @@ Zone America/Rio_Branco -4:31:12 - LMT 1914 # dates to 2014. # DST End: last Saturday of April 2014 (Sun 27 Apr 2014 03:00 UTC) # DST Start: first Saturday of September 2014 (Sun 07 Sep 2014 04:00 UTC) -# http://www.diariooficial.interior.gob.cl//media/2014/02/19/do-20140219.pdf +# From Tim Parenti (2025-03-22): +# Decreto 307 of 2014 of the Ministry of the Interior and Public Security, +# promulgated 2014-01-30 and published 2014-02-19: +# https://www.diariooficial.interior.gob.cl/media/2014/02/19/do-20140219.pdf#page=1 +# https://www.bcn.cl/leychile/navegar?idNorma=1059557 # From Eduardo Romero Urra (2015-03-03): # Today has been published officially that Chile will use the DST time # permanently until March 25 of 2017 -# http://www.diariooficial.interior.gob.cl/media/2015/03/03/1-large.jpg -# -# From Paul Eggert (2015-03-03): -# For now, assume that the extension will persist indefinitely. +# From Tim Parenti (2025-03-22): +# Decreto 106 of 2015 of the Ministry of the Interior and Public Security, +# promulgated 2015-01-27 and published 2015-03-03: +# https://www.diariooficial.interior.gob.cl/media/2015/03/03/do-20150303.pdf#page=1 +# https://www.bcn.cl/leychile/navegar?idNorma=1075157 # From Juan Correa (2016-03-18): -# The decree regarding DST has been published in today's Official Gazette: -# http://www.diariooficial.interior.gob.cl/versiones-anteriores/do/20160318/ -# http://www.leychile.cl/Navegar?idNorma=1088502 +# The decree regarding DST has been published in today's Official Gazette... # It does consider the second Saturday of May and August as the dates # for the transition; and it lists DST dates until 2019, but I think # this scheme will stick. -# # From Paul Eggert (2016-03-18): -# For now, assume the pattern holds for the indefinite future. # The decree says transitions occur at 24:00; in practice this appears # to mean 24:00 mainland time, not 24:00 local time, so that Easter # Island is always two hours behind the mainland. +# From Tim Parenti (2025-03-22): +# Decreto 253 of 2016 of the Ministry of the Interior and Public Security, +# promulgated 2016-03-16 and published 2016-03-18. +# https://www.diariooficial.interior.gob.cl/media/2016/03/18/do-20160318.pdf#page=1 +# https://www.bcn.cl/leychile/navegar?idNorma=1088502 # From Juan Correa (2016-12-04): # Magallanes region ... will keep DST (UTC -3) all year round.... # http://www.soychile.cl/Santiago/Sociedad/2016/12/04/433428/Bachelet-firmo-el-decreto-para-establecer-un-horario-unico-para-la-Region-de-Magallanes.aspx -# From Deborah Goldsmith (2017-01-19): -# http://www.diariooficial.interior.gob.cl/publicaciones/2017/01/17/41660/01/1169626.pdf +# From Tim Parenti (2025-03-22), via Deborah Goldsmith (2017-01-19): +# Decreto 1820 of 2016 of the Ministry of the Interior and Public Security, +# promulgated 2016-12-02 and published 2017-01-17: +# https://www.diariooficial.interior.gob.cl/publicaciones/2017/01/17/41660/01/1169626.pdf +# https://www.bcn.cl/leychile/Navegar?idNorma=1099217 +# Model this as a change to standard offset effective 2016-12-04. # From Juan Correa (2018-08-13): # As of moments ago, the Ministry of Energy in Chile has announced the new @@ -1316,13 +1326,20 @@ Zone America/Rio_Branco -4:31:12 - LMT 1914 # https://twitter.com/MinEnergia/status/1029009354001973248 # "We will keep the new time policy unchanged for at least the next 4 years." # So we extend the new rules on Saturdays at 24:00 mainland time indefinitely. -# From Juan Correa (2019-02-04): -# http://www.diariooficial.interior.gob.cl/publicaciones/2018/11/23/42212/01/1498738.pdf +# From Tim Parenti (2025-03-22), via Juan Correa (2019-02-04): +# Decreto 1286 of 2018 of the Ministry of the Interior and Public Security, +# promulgated 2018-09-21 and published 2018-11-23: +# https://www.diariooficial.interior.gob.cl/publicaciones/2018/11/23/42212/01/1498738.pdf +# https://www.bcn.cl/leychile/Navegar?idNorma=1125760 # From Juan Correa (2022-04-02): # I found there was a decree published last Thursday that will keep -# Magallanes region to UTC -3 "indefinitely". The decree is available at +# Magallanes region to UTC -3 "indefinitely". +# From Tim Parenti (2025-03-22): +# Decreto 143 of 2022 of the Ministry of the Interior and Public Security, +# promulgated 2022-03-29 and published 2022-03-31: # https://www.diariooficial.interior.gob.cl/publicaciones/2022/03/31/43217-B/01/2108910.pdf +# https://www.bcn.cl/leychile/Navegar?idNorma=1174342 # From Juan Correa (2022-08-09): # the Internal Affairs Ministry (Ministerio del Interior) informed DST @@ -1331,13 +1348,36 @@ Zone America/Rio_Branco -4:31:12 - LMT 1914 # will keep UTC -3 "indefinitely"... This is because on September 4th # we will have a voting whether to approve a new Constitution. # -# From Eduardo Romero Urra (2022-08-17): +# From Tim Parenti (2025-03-22), via Eduardo Romero Urra (2022-08-17): +# Decreto 224 of 2022 of the Ministry of the Interior and Public Security, +# promulgated 2022-07-14 and published 2022-08-13: # https://www.diariooficial.interior.gob.cl/publicaciones/2022/08/13/43327/01/2172567.pdf +# https://www.bcn.cl/leychile/navegar?idNorma=1179983 # # From Paul Eggert (2022-08-17): # Although the presidential decree stops at fall 2026, assume that # similar DST rules will continue thereafter. +# From Paul Eggert (2025-01-15): +# Diario Regional Aysén's Sebastián Martel reports that 94% of Aysén +# citizens polled in November favored changing the rules from +# -04/-03-with-DST to -03 all year... +# https://www.diarioregionalaysen.cl/noticia/actualidad/2024/12/presentan-decision-que-gano-la-votacion-sobre-el-cambio-del-huso-horario-en-aysen +# +# From Yonathan Dossow (2025-03-20): +# [T]oday we have more confirmation of the change. [Aysén] region will keep +# UTC-3 all year... +# https://www.cnnchile.com/pais/region-de-aysen-mantendra-horario-de-verano-todo-el-ano_20250320/ +# https://www.latercera.com/nacional/noticia/tras-consulta-ciudadana-region-de-aysen-mantendra-el-horario-de-verano-durante-todo-el-ano/ +# https://x.com/min_interior/status/1902692504270672098 +# +# From Tim Parenti (2025-03-22), via Eduardo Romero Urra (2025-03-20): +# Decreto 93 of 2025 of the Ministry of the Interior and Public Security, +# promulgated 2025-03-11 and published 2025-03-20: +# https://www.diariooficial.interior.gob.cl/publicaciones/2025/03/20/44104/01/2624263.pdf +# https://www.bcn.cl/leychile/Navegar?idNorma=1211955 +# Model this as a change to standard offset effective 2025-03-20. + # Rule NAME FROM TO - IN ON AT SAVE LETTER/S Rule Chile 1927 1931 - Sep 1 0:00 1:00 - Rule Chile 1928 1932 - Apr 1 0:00 0 - @@ -1394,6 +1434,20 @@ Zone America/Santiago -4:42:45 - LMT 1890 -5:00 1:00 %z 1947 Mar 31 24:00 -5:00 - %z 1947 May 21 23:00 -4:00 Chile %z +Zone America/Coyhaique -4:48:16 - LMT 1890 + -4:42:45 - SMT 1910 Jan 10 + -5:00 - %z 1916 Jul 1 + -4:42:45 - SMT 1918 Sep 10 + -4:00 - %z 1919 Jul 1 + -4:42:45 - SMT 1927 Sep 1 + -5:00 Chile %z 1932 Sep 1 + -4:00 - %z 1942 Jun 1 + -5:00 - %z 1942 Aug 1 + -4:00 - %z 1946 Aug 28 24:00 + -5:00 1:00 %z 1947 Mar 31 24:00 + -5:00 - %z 1947 May 21 23:00 + -4:00 Chile %z 2025 Mar 20 + -3:00 - %z Zone America/Punta_Arenas -4:43:40 - LMT 1890 -4:42:45 - SMT 1910 Jan 10 -5:00 - %z 1916 Jul 1 diff --git a/src/java.base/share/data/tzdata/zone.tab b/src/java.base/share/data/tzdata/zone.tab index e7a4868c39d0..c8fc601041bc 100644 --- a/src/java.base/share/data/tzdata/zone.tab +++ b/src/java.base/share/data/tzdata/zone.tab @@ -162,7 +162,8 @@ CH +4723+00832 Europe/Zurich CI +0519-00402 Africa/Abidjan CK -2114-15946 Pacific/Rarotonga CL -3327-07040 America/Santiago most of Chile -CL -5309-07055 America/Punta_Arenas Region of Magallanes +CL -4534-07204 America/Coyhaique Aysen Region +CL -5309-07055 America/Punta_Arenas Magallanes Region CL -2709-10926 Pacific/Easter Easter Island CM +0403+00942 Africa/Douala CN +3114+12128 Asia/Shanghai Beijing Time diff --git a/src/java.base/unix/native/libjava/java_props_md.c b/src/java.base/unix/native/libjava/java_props_md.c index 4766a8834729..4a6d0f7f5a4b 100644 --- a/src/java.base/unix/native/libjava/java_props_md.c +++ b/src/java.base/unix/native/libjava/java_props_md.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2024, 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 @@ -521,11 +521,14 @@ GetJavaProperties(JNIEnv *env) { char buf[MAXPATHLEN]; errno = 0; - if (getcwd(buf, sizeof(buf)) == NULL) + if (getcwd(buf, sizeof(buf)) == NULL) { JNU_ThrowByName(env, "java/lang/Error", - "Properties init: Could not determine current working directory."); - else + "Properties init: Could not determine current working directory."); + return NULL; + } + else { sprops.user_dir = strdup(buf); + } } sprops.file_separator = "/"; diff --git a/src/java.base/unix/native/libnio/ch/Net.c b/src/java.base/unix/native/libnio/ch/Net.c index 5af38db378b2..89c670014937 100644 --- a/src/java.base/unix/native/libnio/ch/Net.c +++ b/src/java.base/unix/native/libnio/ch/Net.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -655,6 +655,16 @@ Java_sun_nio_ch_Net_joinOrDrop4(JNIEnv *env, jobject this, jboolean join, jobjec n = setsockopt(fdval(env,fdo), IPPROTO_IP, opt, optval, optlen); } #endif +#ifdef _AIX + // workaround AIX bug where IP_ADD_MEMBERSHIP fails intermittently + if (n < 0 && errno == EAGAIN) { + int countdown = 3; + while (n < 0 && errno == EAGAIN && countdown > 0) { + n = setsockopt(fdval(env,fdo), IPPROTO_IP, opt, optval, optlen); + countdown--; + } + } +#endif if (n < 0) { if (join && (errno == ENOPROTOOPT || errno == EOPNOTSUPP)) diff --git a/src/java.base/windows/classes/sun/nio/ch/PipeImpl.java b/src/java.base/windows/classes/sun/nio/ch/PipeImpl.java index 01a72835b88b..67a344a663d4 100644 --- a/src/java.base/windows/classes/sun/nio/ch/PipeImpl.java +++ b/src/java.base/windows/classes/sun/nio/ch/PipeImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2023, 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 @@ -129,14 +129,7 @@ public void run() { } // Establish connection (assume connection is eagerly accepted) - if (sa instanceof InetSocketAddress - && Thread.currentThread().isVirtual()) { - // workaround "lost event" issue on older releases of Windows - sc1 = SocketChannel.open(); - sc1.socket().connect(sa, 10_000); - } else { - sc1 = SocketChannel.open(sa); - } + sc1 = SocketChannel.open(sa); RANDOM_NUMBER_GENERATOR.nextBytes(secret.array()); do { sc1.write(secret); diff --git a/src/java.base/windows/classes/sun/nio/ch/WEPollPoller.java b/src/java.base/windows/classes/sun/nio/ch/WEPollPoller.java index e24bc0f83b39..87e80071c7a9 100644 --- a/src/java.base/windows/classes/sun/nio/ch/WEPollPoller.java +++ b/src/java.base/windows/classes/sun/nio/ch/WEPollPoller.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -47,16 +47,13 @@ class WEPollPoller extends Poller { @Override void implRegister(int fdVal) throws IOException { - // re-arm - int err = WEPoll.ctl(handle, EPOLL_CTL_MOD, fdVal, (event | EPOLLONESHOT)); - if (err == ENOENT) - err = WEPoll.ctl(handle, EPOLL_CTL_ADD, fdVal, (event | EPOLLONESHOT)); + int err = WEPoll.ctl(handle, EPOLL_CTL_ADD, fdVal, (event | EPOLLONESHOT)); if (err != 0) throw new IOException("epoll_ctl failed: " + err); } @Override - void implDeregister(int fdVal) { + void implDeregister(int fdVal, boolean polled) { WEPoll.ctl(handle, EPOLL_CTL_DEL, fdVal, 0); } diff --git a/src/java.desktop/macosx/classes/com/apple/laf/AquaTabbedPaneCopyFromBasicUI.java b/src/java.desktop/macosx/classes/com/apple/laf/AquaTabbedPaneCopyFromBasicUI.java index 7aa5fe67d58b..896eeb5fded2 100644 --- a/src/java.desktop/macosx/classes/com/apple/laf/AquaTabbedPaneCopyFromBasicUI.java +++ b/src/java.desktop/macosx/classes/com/apple/laf/AquaTabbedPaneCopyFromBasicUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2025, 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 @@ -404,7 +404,11 @@ protected void installListeners() { } tabPane.addContainerListener(getHandler()); if (tabPane.getTabCount() > 0) { - htmlViews = createHTMLVector(); + Boolean htmlDisabled = (Boolean) + tabPane.getClientProperty("html.disable"); + if (!(Boolean.TRUE.equals(htmlDisabled))) { + htmlViews = createHTMLVector(); + } } } @@ -3445,8 +3449,10 @@ public void componentAdded(final ContainerEvent e) { private void updateHtmlViews(int index, boolean inserted) { final String title = tabPane.getTitleAt(index); + Boolean htmlDisabled = (Boolean) + tabPane.getClientProperty("html.disable"); final boolean isHTML = BasicHTML.isHTMLString(title); - if (isHTML) { + if (isHTML && !(Boolean.TRUE.equals(htmlDisabled))) { if (htmlViews == null) { // Initialize vector htmlViews = createHTMLVector(); } else { // Vector already exists diff --git a/src/java.desktop/macosx/classes/sun/lwawt/macosx/CAccessible.java b/src/java.desktop/macosx/classes/sun/lwawt/macosx/CAccessible.java index bb080688acf9..29c55de12293 100644 --- a/src/java.desktop/macosx/classes/sun/lwawt/macosx/CAccessible.java +++ b/src/java.desktop/macosx/classes/sun/lwawt/macosx/CAccessible.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2025, 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,6 +30,7 @@ import java.beans.PropertyChangeListener; import java.security.PrivilegedAction; import java.util.concurrent.atomic.AtomicBoolean; +import java.util.Objects; import javax.accessibility.*; import javax.swing.*; @@ -271,7 +272,11 @@ public void propertyChange(PropertyChangeEvent e) { // Notify macOS Accessibility Zoom to move focus to the new caret location. execute(ptr -> updateZoomCaretFocus(ptr)); } else if (name.equals(ACCESSIBLE_TEXT_PROPERTY)) { - execute(ptr -> valueChanged(ptr)); + AccessibleContext thisAC = accessible.getAccessibleContext(); + Accessible parentAccessible = thisAC.getAccessibleParent(); + if (!(parentAccessible instanceof JSpinner.NumberEditor)) { + execute(ptr -> valueChanged(ptr)); + } } else if (name.equals(ACCESSIBLE_SELECTION_PROPERTY)) { if (timer != null) { timer.stop(); @@ -366,7 +371,7 @@ public void propertyChange(PropertyChangeEvent e) { // Do send check box state changes to native side if (thisRole == AccessibleRole.CHECK_BOX) { - if (newValue != null && !newValue.equals(oldValue)) { + if (!Objects.equals(newValue, oldValue)) { execute(ptr -> valueChanged(ptr)); } @@ -392,7 +397,7 @@ public void propertyChange(PropertyChangeEvent e) { // Do send toggle button state changes to native side if (thisRole == AccessibleRole.TOGGLE_BUTTON) { - if (newValue != null && !newValue.equals(oldValue)) { + if (!Objects.equals(newValue, oldValue)) { valueChanged(ptr); } } diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTWindow.m b/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTWindow.m index 02c971df1027..ecb318f66813 100644 --- a/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTWindow.m +++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/AWTWindow.m @@ -1538,7 +1538,11 @@ - (void)sendEvent:(NSEvent *)event { NSRect contentRect = [self.nsWindow contentRectForFrameRect:frame]; // Check if the click happened in the non-client area (title bar) - if (p.y >= (frame.origin.y + contentRect.size.height)) { + // Also, non-client area includes the edges at left, right and botton of frame + if ((p.y >= (frame.origin.y + contentRect.size.height)) || + (p.x >= (frame.origin.x + contentRect.size.width - 3)) || + (fabs(frame.origin.x - p.x) < 3) || + (fabs(frame.origin.y - p.y) < 3)) { JNIEnv *env = [ThreadUtilities getJNIEnvUncached]; jobject platformWindow = (*env)->NewLocalRef(env, self.javaPlatformWindow); if (platformWindow != NULL) { diff --git a/src/java.desktop/macosx/native/libawt_lwawt/font/CGGlyphImages.m b/src/java.desktop/macosx/native/libawt_lwawt/font/CGGlyphImages.m index 9ab739a5f932..aa4f6af99f82 100644 --- a/src/java.desktop/macosx/native/libawt_lwawt/font/CGGlyphImages.m +++ b/src/java.desktop/macosx/native/libawt_lwawt/font/CGGlyphImages.m @@ -238,6 +238,7 @@ @implementation CGGI_GlyphCanvas { UInt32 *src = (UInt32 *)canvas->image->data; size_t srcRowWidth = canvas->image->width; + size_t srcHeight = canvas->image->height; UInt8 *dest = (UInt8 *)info->image; size_t destRowWidth = info->width; @@ -247,12 +248,12 @@ @implementation CGGI_GlyphCanvas size_t y; // fill empty glyph image with black-on-white glyph - for (y = 0; y < height; y++) { + for (y = 0; y < height && y < srcHeight; y++) { size_t destRow = y * destRowWidth * 3; size_t srcRow = y * srcRowWidth; size_t x; - for (x = 0; x < destRowWidth; x++) { + for (x = 0; x < destRowWidth && x < srcRowWidth; x++) { CGGI_CopyARGBPixelToRGBPixel(src[srcRow + x], dest + destRow + x * 3); } @@ -289,6 +290,7 @@ @implementation CGGI_GlyphCanvas CGGI_CopyImageFromCanvasToAlphaInfo(CGGI_GlyphCanvas *canvas, GlyphInfo *info) { size_t srcRowWidth = canvas->image->width; + size_t srcHeight = canvas->image->height; size_t destRowWidth = info->width; size_t height = info->height; @@ -300,11 +302,11 @@ @implementation CGGI_GlyphCanvas size_t y; // fill empty glyph image with black-on-white glyph - for (y = 0; y < height; y++) { + for (y = 0; y < height && y < srcHeight; y++) { size_t destRow = y * destRowWidth; size_t srcRow = y * srcRowWidth; size_t x; - for (x = 0; x < destRowWidth; x++) { + for (x = 0; x < destRowWidth && x < srcRowWidth; x++) { UInt32 p = src[srcRow + x]; dest[destRow + x] = CGGI_ConvertBWPixelToByteGray(p); } @@ -321,6 +323,7 @@ @implementation CGGI_GlyphCanvas UInt32 *src = (UInt32 *)canvas->image->data; size_t srcRowWidth = canvas->image->width; + size_t srcHeight = canvas->image->height; UInt8 *dest = (UInt8 *)info->image; size_t destRowWidth = info->width; @@ -329,15 +332,16 @@ @implementation CGGI_GlyphCanvas size_t y; - for (y = 0; y < height; y++) { + for (y = 0; y < height && y < srcHeight; y++) { size_t srcRow = y * srcRowWidth; if (littleEndian) { - UInt16 destRowBytes = info->rowBytes; + size_t srcRowBytes = canvas->image->rowBytes; + UInt16 destRowBytes = (info->rowBytes < srcRowBytes) ? info->rowBytes : srcRowBytes; memcpy(dest, src + srcRow, destRowBytes); dest += destRowBytes; } else { size_t x; - for (x = 0; x < destRowWidth; x++) { + for (x = 0; x < destRowWidth && x < srcRowWidth; x++) { UInt32 p = src[srcRow + x]; *dest++ = (p >> 24 & 0xFF); // blue (alpha-premultiplied) *dest++ = (p >> 16 & 0xFF); // green (alpha-premultiplied) @@ -446,8 +450,10 @@ @implementation CGGI_GlyphCanvas canvas->image->data = (void *)calloc(byteCount, sizeof(UInt8)); if (canvas->image->data == NULL) { - [[NSException exceptionWithName:NSMallocException - reason:@"Failed to allocate memory for the buffer which backs the CGContext for glyph strikes." userInfo:nil] raise]; + canvas->image->width = 0; + canvas->image->height = 0; + canvas->image->rowBytes = 0; + canvas->image->data = malloc(0); } uint32_t bmpInfo = kCGImageAlphaPremultipliedFirst; @@ -497,6 +503,10 @@ @implementation CGGI_GlyphCanvas /* * Quick and easy inline to check if this canvas is big enough. + * This function only increases the size. To get a smaller canvas, free it first. + * This function adds padding / slack multiplier to the requested size. + * So resizes must be based on the size you need, not the size of the canvas. + * The function will internally account for the multiplier it uses. */ static inline void CGGI_SizeCanvas(CGGI_GlyphCanvas *canvas, const vImagePixelCount width, @@ -504,18 +514,31 @@ @implementation CGGI_GlyphCanvas const CGGI_RenderingMode* mode) { if (canvas->image != NULL && - width < canvas->image->width && - height < canvas->image->height) + width * CGGI_GLYPH_CANVAS_SLACK <= canvas->image->width && + height * CGGI_GLYPH_CANVAS_SLACK <= canvas->image->height) { return; } + vImagePixelCount w = width * CGGI_GLYPH_CANVAS_SLACK; + vImagePixelCount h = height * CGGI_GLYPH_CANVAS_SLACK; + + // Do not allow the canvas to be resized smaller. + if (canvas->image != NULL) { + if (w < canvas->image->width) { + w = canvas->image->width; + } + if (h < canvas->image->height) { + h = canvas->image->height; + } + } + // if we don't have enough space to strike the largest glyph in the // run, resize the canvas CGGI_FreeCanvas(canvas); CGGI_InitCanvas(canvas, - width * CGGI_GLYPH_CANVAS_SLACK, - height * CGGI_GLYPH_CANVAS_SLACK, + w, + h, mode); JRSFontSetRenderingStyleOnContext(canvas->context, mode->cgFontMode); } @@ -531,6 +554,12 @@ @implementation CGGI_GlyphCanvas canvasRectToClear.data = canvas->image->data; canvasRectToClear.height = info->height * info->subpixelResolutionY; canvasRectToClear.width = info->width * info->subpixelResolutionX; + if (canvas->image->width < canvasRectToClear.width) { + canvasRectToClear.width = canvas->image->width; + } + if (canvas->image->height < canvasRectToClear.height) { + canvasRectToClear.height = canvas->image->height; + } // use the row stride of the canvas, not the info canvasRectToClear.rowBytes = canvas->image->rowBytes; @@ -1042,26 +1071,32 @@ static CTFontRef CopyFontWithSize(CTFontRef originalFont, CGFloat size) { return; } - // just do one malloc, and carve it up for all the buffers - void *buffer = malloc(sizeof(CGRect) * sizeof(CGSize) * - sizeof(CGGlyph) * sizeof(UnicodeScalarValue) * len); - if (buffer == NULL) { + CGRect *bboxes = (CGRect*)calloc(len, sizeof(CGRect)); + CGSize *advances = (CGSize*)calloc(len, sizeof(CGSize)); + CGGlyph *glyphs = (CGGlyph*)calloc(len, sizeof(CGGlyph)); + UnicodeScalarValue *uniChars = (UnicodeScalarValue*)calloc(len, sizeof(UnicodeScalarValue)); + + if (bboxes == NULL || advances == NULL || glyphs == NULL || uniChars == NULL) { + free(bboxes); + free(advances); + free(glyphs); + free(uniChars); [[NSException exceptionWithName:NSMallocException reason:@"Failed to allocate memory for the temporary glyph strike and measurement buffers." userInfo:nil] raise]; } - CGRect *bboxes = (CGRect *)(buffer); - CGSize *advances = (CGSize *)(bboxes + sizeof(CGRect) * len); - CGGlyph *glyphs = (CGGlyph *)(advances + sizeof(CGGlyph) * len); - UnicodeScalarValue *uniChars = (UnicodeScalarValue *)(glyphs + sizeof(UnicodeScalarValue) * len); - CGGI_CreateGlyphsAndScanForComplexities(glyphInfos, strike, &mode, rawGlyphCodes, uniChars, glyphs, advances, bboxes, len); - free(buffer); + free(bboxes); + free(advances); + free(glyphs); + free(uniChars); } +#define TX_FIXED_UNSAFE(v) (isinf(v) || isnan(v) || fabs(v) >= (1<<30)) + /* * Calculates bounding boxes (for given transform) and advance (for untransformed 1pt-size font) for specified glyphs. */ @@ -1075,6 +1110,27 @@ static CTFontRef CopyFontWithSize(CTFontRef originalFont, CGFloat size) { CGRect bboxes[], CGSize advances[], const bool isCatalinaOrAbove) { + + if (TX_FIXED_UNSAFE(tx->a) || TX_FIXED_UNSAFE(tx->b) || TX_FIXED_UNSAFE(tx->c) || + TX_FIXED_UNSAFE(tx->d) || TX_FIXED_UNSAFE(tx->tx) || TX_FIXED_UNSAFE(tx->tx)) { + + if (bboxes) { + for (int i = 0; i < count; i++) { + bboxes[i].origin.x = 0; + bboxes[i].origin.y = 0; + bboxes[i].size.width = 0; + bboxes[i].size.height = 0; + } + } + if (advances) { + for (int i = 0; i < count; i++) { + advances[i].width = 0; + advances[i].height = 0; + } + } + return; + } + if (isCatalinaOrAbove || IsEmojiFont(font)) { // Glyph metrics for emoji font are not strictly proportional to font size, // so we need to construct real-sized font object to calculate them. diff --git a/src/java.desktop/share/classes/com/sun/imageio/plugins/png/PNGImageWriter.java b/src/java.desktop/share/classes/com/sun/imageio/plugins/png/PNGImageWriter.java index 27707613f76e..ca9ba7631ca0 100644 --- a/src/java.desktop/share/classes/com/sun/imageio/plugins/png/PNGImageWriter.java +++ b/src/java.desktop/share/classes/com/sun/imageio/plugins/png/PNGImageWriter.java @@ -26,6 +26,7 @@ package com.sun.imageio.plugins.png; import java.awt.Rectangle; +import java.awt.image.BufferedImage; import java.awt.image.IndexColorModel; import java.awt.image.Raster; import java.awt.image.RenderedImage; @@ -919,17 +920,28 @@ private void encodePass(ImageOutputStream os, int bitDepth = metadata.IHDR_bitDepth; for (int row = minY + yOffset; row < minY + height; row += ySkip) { - Rectangle rect = new Rectangle(minX, row, width, 1); - Raster ras = image.getData(rect); + Raster ras; + if (image instanceof BufferedImage bi) { + // Use the raster directly (no copy). + ras = bi.getRaster(); + } else if (image.getNumXTiles() == 1 && image.getNumYTiles() == 1 && + image.getTileWidth() == width && image.getTileHeight() == height) { + // Use the single tile directly (no copy). + ras = image.getTile(image.getMinTileX(), image.getMinTileY()); + } else { + // Make a copy of the raster data. + Rectangle rect = new Rectangle(minX, row, width, 1); + ras = image.getData(rect); + } + if (sourceBands != null) { - ras = ras.createChild(minX, row, width, 1, minX, row, - sourceBands); + ras = ras.createChild(minX, row, width, 1, minX, row, sourceBands); } ras.getPixels(minX, row, width, 1, samples); if (image.getColorModel().isAlphaPremultiplied()) { - WritableRaster wr = ras.createCompatibleWritableRaster(); + WritableRaster wr = ras.createCompatibleWritableRaster(minX, row, width, 1); wr.setPixels(wr.getMinX(), wr.getMinY(), wr.getWidth(), wr.getHeight(), samples); diff --git a/src/java.desktop/share/classes/java/awt/image/ColorConvertOp.java b/src/java.desktop/share/classes/java/awt/image/ColorConvertOp.java index ced1e634dbbb..1e7176e4b398 100644 --- a/src/java.desktop/share/classes/java/awt/image/ColorConvertOp.java +++ b/src/java.desktop/share/classes/java/awt/image/ColorConvertOp.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2024, 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 @@ -768,7 +768,7 @@ private BufferedImage nonICCBIFilter(BufferedImage src, } float[] srcMinVal = new float[iccSrcNumComp]; float[] srcInvDiffMinMax = new float[iccSrcNumComp]; - for (int i = 0; i < srcNumComp; i++) { + for (int i = 0; i < iccSrcNumComp; i++) { srcMinVal[i] = cs.getMinValue(i); srcInvDiffMinMax[i] = maxNum / (cs.getMaxValue(i) - srcMinVal[i]); } @@ -782,7 +782,7 @@ private BufferedImage nonICCBIFilter(BufferedImage src, } float[] dstMinVal = new float[iccDstNumComp]; float[] dstDiffMinMax = new float[iccDstNumComp]; - for (int i = 0; i < dstNumComp; i++) { + for (int i = 0; i < iccDstNumComp; i++) { dstMinVal[i] = cs.getMinValue(i); dstDiffMinMax[i] = (cs.getMaxValue(i) - dstMinVal[i]) / maxNum; } @@ -835,7 +835,7 @@ private BufferedImage nonICCBIFilter(BufferedImage src, dstDiffMinMax[i] + dstMinVal[i]; } if (nonICCDst) { - color = srcColorSpace.fromCIEXYZ(dstColor); + color = dstColorSpace.fromCIEXYZ(dstColor); for (int i = 0; i < dstNumComp; i++) { dstColor[i] = color[i]; } diff --git a/src/java.desktop/share/classes/javax/swing/JColorChooser.java b/src/java.desktop/share/classes/javax/swing/JColorChooser.java index 945c6f606970..62c4fe8b0838 100644 --- a/src/java.desktop/share/classes/javax/swing/JColorChooser.java +++ b/src/java.desktop/share/classes/javax/swing/JColorChooser.java @@ -175,7 +175,9 @@ public static Color showDialog(Component component, * @return the selected color or null if the user opted out * @throws HeadlessException if GraphicsEnvironment.isHeadless() * returns true. + * * @see java.awt.GraphicsEnvironment#isHeadless + * @since 9 */ @SuppressWarnings("deprecation") public static Color showDialog(Component component, String title, diff --git a/src/java.desktop/share/classes/javax/swing/border/TitledBorder.java b/src/java.desktop/share/classes/javax/swing/border/TitledBorder.java index 706ae9ab3208..3115b7682635 100644 --- a/src/java.desktop/share/classes/javax/swing/border/TitledBorder.java +++ b/src/java.desktop/share/classes/javax/swing/border/TitledBorder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, 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 @@ -738,6 +738,10 @@ private Color getColor(Component c) { } private JLabel getLabel(Component c) { + if (c instanceof JComponent comp) { + this.label.putClientProperty("html.disable", + comp.getClientProperty("html.disable")); + } this.label.setText(getTitle()); this.label.setFont(getFont(c)); this.label.setForeground(getColor(c)); diff --git a/src/java.desktop/share/classes/javax/swing/colorchooser/AbstractColorChooserPanel.java b/src/java.desktop/share/classes/javax/swing/colorchooser/AbstractColorChooserPanel.java index 9a4284925128..5664051cf6b6 100644 --- a/src/java.desktop/share/classes/javax/swing/colorchooser/AbstractColorChooserPanel.java +++ b/src/java.desktop/share/classes/javax/swing/colorchooser/AbstractColorChooserPanel.java @@ -229,6 +229,7 @@ void setSelectedColor(Color color) { * * @param b true if the transparency of a color can be selected * @see #isColorTransparencySelectionEnabled() + * @since 9 */ @BeanProperty(description = "Sets the transparency of a color selection on or off.") @@ -241,6 +242,7 @@ public void setColorTransparencySelectionEnabled(boolean b){ * * @return true if the transparency of a color can be selected * @see #setColorTransparencySelectionEnabled(boolean) + * @since 9 */ public boolean isColorTransparencySelectionEnabled(){ return true; diff --git a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicOptionPaneUI.java b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicOptionPaneUI.java index 07674af2362b..20596774a18e 100644 --- a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicOptionPaneUI.java +++ b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicOptionPaneUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, 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 @@ -472,6 +472,10 @@ protected void addMessageComponents(Container container, } JLabel label; label = new JLabel(s, JLabel.LEADING); + if (Boolean.TRUE.equals( + this.optionPane.getClientProperty("html.disable"))) { + label.putClientProperty("html.disable", true); + } label.setName("OptionPane.label"); configureMessageLabel(label); addMessageComponents(container, cons, label, maxll, true); diff --git a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTabbedPaneUI.java b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTabbedPaneUI.java index 2fac8b2e2113..1c21e8747da9 100644 --- a/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTabbedPaneUI.java +++ b/src/java.desktop/share/classes/javax/swing/plaf/basic/BasicTabbedPaneUI.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2025, 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 @@ -495,7 +495,11 @@ protected void installListeners() { } tabPane.addContainerListener(getHandler()); if (tabPane.getTabCount()>0) { - htmlViews = createHTMLVector(); + Boolean htmlDisabled = (Boolean) + tabPane.getClientProperty("html.disable"); + if (!(Boolean.TRUE.equals(htmlDisabled))) { + htmlViews = createHTMLVector(); + } } } @@ -4065,8 +4069,10 @@ else if (name =="indexForTitle") { private void updateHtmlViews(int index, boolean inserted) { String title = tabPane.getTitleAt(index); + Boolean htmlDisabled = (Boolean) + tabPane.getClientProperty("html.disable"); boolean isHTML = BasicHTML.isHTMLString(title); - if (isHTML) { + if (isHTML && !(Boolean.TRUE.equals(htmlDisabled))) { if (htmlViews==null) { // Initialize vector htmlViews = createHTMLVector(); } else { // Vector already exists diff --git a/src/java.desktop/share/classes/sun/print/CustomMediaSizeName.java b/src/java.desktop/share/classes/sun/print/CustomMediaSizeName.java index b8d3ec723b8f..04772f29858c 100644 --- a/src/java.desktop/share/classes/sun/print/CustomMediaSizeName.java +++ b/src/java.desktop/share/classes/sun/print/CustomMediaSizeName.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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 @@ -203,16 +203,17 @@ public static CustomMediaSizeName create(String name, String choice, if (value == null) { value = new CustomMediaSizeName(name, choice, width, length); customMap.put(key, value); - - // add this new custom media size name to MediaSize array - if ((width > 0.0) && (length > 0.0)) { - try { - new MediaSize(width, length, Size2DSyntax.INCH, value); - } catch (IllegalArgumentException e) { + if (value.getStandardMedia() == null) { + // add this new custom media size name to MediaSize array + if ((width > 0.0) && (length > 0.0)) { + try { + new MediaSize(width, length, Size2DSyntax.INCH, value); + } catch (IllegalArgumentException e) { /* PDF printer in Linux for Ledger paper causes "IllegalArgumentException: X dimension > Y dimension". We rotate based on IPP spec. */ - new MediaSize(length, width, Size2DSyntax.INCH, value); + new MediaSize(length, width, Size2DSyntax.INCH, value); + } } } } diff --git a/src/java.desktop/share/legal/freetype.md b/src/java.desktop/share/legal/freetype.md index 6bcb4976fd20..2c654e154ba4 100644 --- a/src/java.desktop/share/legal/freetype.md +++ b/src/java.desktop/share/legal/freetype.md @@ -1,4 +1,4 @@ -## The FreeType Project: Freetype v2.13.2 +## The FreeType Project: Freetype v2.13.3 ### FreeType Notice @@ -21,23 +21,23 @@ which fits your needs best. ### FreeType License ``` -Copyright (C) 1996-2023 by David Turner, Robert Wilhelm, and Werner Lemberg. -Copyright (C) 2007-2023 by Dereg Clegg and Michael Toftdal. -Copyright (C) 1996-2023 by Just van Rossum, David Turner, Robert Wilhelm, and Werner Lemberg. -Copyright (C) 2022-2023 by David Turner, Robert Wilhelm, Werner Lemberg, George Williams, and -Copyright (C) 2004-2023 by Masatake YAMATO and Redhat K.K. -Copyright (C) 2007-2023 by Derek Clegg and Michael Toftdal. -Copyright (C) 2003-2023 by Masatake YAMATO, Red Hat K.K., -Copyright (C) 1996-2023 by David Turner, Robert Wilhelm, Werner Lemberg, and Dominik Röttsches. -Copyright (C) 2007-2023 by David Turner. -Copyright (C) 2022-2023 by David Turner, Robert Wilhelm, Werner Lemberg, and Moazin Khatti. -Copyright (C) 2007-2023 by Rahul Bhalerao , . -Copyright (C) 2008-2023 by David Turner, Robert Wilhelm, Werner Lemberg, and suzuki toshiya. -Copyright (C) 2013-2023 by Google, Inc. -Copyright (C) 2019-2023 by Nikhil Ramakrishnan, David Turner, Robert Wilhelm, and Werner Lemberg. -Copyright (C) 2009-2023 by Oran Agra and Mickey Gabel. -Copyright (C) 2018-2023 by David Turner, Robert Wilhelm, Dominik Röttsches, and Werner Lemberg. -Copyright (C) 2004-2023 by David Turner, Robert Wilhelm, Werner Lemberg, and George Williams. +Copyright (C) 1996-2024 by David Turner, Robert Wilhelm, and Werner Lemberg. +Copyright (C) 2007-2024 by Dereg Clegg and Michael Toftdal. +Copyright (C) 1996-2024 by Just van Rossum, David Turner, Robert Wilhelm, and Werner Lemberg. +Copyright (C) 2022-2024 by David Turner, Robert Wilhelm, Werner Lemberg, George Williams, and +Copyright (C) 2004-2024 by Masatake YAMATO and Redhat K.K. +Copyright (C) 2007-2024 by Derek Clegg and Michael Toftdal. +Copyright (C) 2003-2024 by Masatake YAMATO, Red Hat K.K., +Copyright (C) 1996-2024 by David Turner, Robert Wilhelm, Werner Lemberg, and Dominik Röttsches. +Copyright (C) 2007-2024 by David Turner. +Copyright (C) 2022-2024 by David Turner, Robert Wilhelm, Werner Lemberg, and Moazin Khatti. +Copyright (C) 2007-2024 by Rahul Bhalerao , . +Copyright (C) 2008-2024 by David Turner, Robert Wilhelm, Werner Lemberg, and suzuki toshiya. +Copyright (C) 2013-2024 by Google, Inc. +Copyright (C) 2019-2024 by Nikhil Ramakrishnan, David Turner, Robert Wilhelm, and Werner Lemberg. +Copyright (C) 2009-2024 by Oran Agra and Mickey Gabel. +Copyright (C) 2018-2024 by David Turner, Robert Wilhelm, Dominik Röttsches, and Werner Lemberg. +Copyright (C) 2004-2024 by David Turner, Robert Wilhelm, Werner Lemberg, and George Williams. The FreeType Project LICENSE @@ -559,7 +559,7 @@ Public License instead of this License. ``` --------------------------------- -The below license applies to the following files: +The below applies to the following file(s): libfreetype/src/psaux/psarrst.c libfreetype/src/psaux/psarrst.h libfreetype/src/psaux/psblues.c @@ -582,7 +582,7 @@ libfreetype/src/psaux/psstack.c libfreetype/src/psaux/psstack.h libfreetype/src/psaux/pstypes.h -Copyright 2006-2014 Adobe Systems Incorporated. +Copyright (C) 2006-2014 Adobe Systems Incorporated. This software, and all works of authorship, whether in source or object code form as indicated by the copyright notice(s) included @@ -618,12 +618,12 @@ and you accept them fully. ``` --------------------------------- -The below license applies to the following files: +The below applies to the following file(s): libfreetype/include/freetype/internal/fthash.h libfreetype/src/base/fthash.c -Copyright 2000 Computing Research Labs, New Mexico State University -Copyright 2001-2015 +Copyright (C) 2000 Computing Research Labs, New Mexico State University +Copyright (C) 2001-2015 Francesco Zappa Nardelli diff --git a/src/java.desktop/share/legal/harfbuzz.md b/src/java.desktop/share/legal/harfbuzz.md index 3ae73d215b04..2d0a28ed310b 100644 --- a/src/java.desktop/share/legal/harfbuzz.md +++ b/src/java.desktop/share/legal/harfbuzz.md @@ -1,4 +1,4 @@ -## Harfbuzz v8.2.2 +## Harfbuzz v10.4.0 ### Harfbuzz License @@ -8,14 +8,14 @@ HarfBuzz is licensed under the so-called "Old MIT" license. Details follow. For parts of HarfBuzz that are licensed under different licenses see individual files names COPYING in subdirectories where applicable. -Copyright © 2010-2023 Google, Inc. +Copyright © 2010-2024 Google, Inc. Copyright © 2018-2020 Ebrahim Byagowi Copyright © 2004-2013 Red Hat, Inc. Copyright © 2019 Facebook, Inc. Copyright (C) 2012 Zilong Tan (eric.zltan@gmail.com) Copyright © 2007 Chris Wilson Copyright © 2018-2019 Adobe Inc. -Copyright © 2006-2023 Behdad Esfahbod +Copyright © 2006-2025 Behdad Esfahbod Copyright © 1998-2004 David Turner and Werner Lemberg Copyright © 2009 Keith Stribley Copyright © 2018 Khaled Hosny @@ -54,7 +54,7 @@ exception is licensed with a slightly different MIT variant: The contents of this directory are licensed under the following terms: --------------------------------- -The below license applies to the following files: +The below applies to the following file(s): libharfbuzz/hb-ucd.cc Copyright (C) 2012 Grigori Goronzy @@ -72,13 +72,14 @@ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. --------------------------------- -The below license applies to the following files: +The below applies to the following file(s): libharfbuzz/hb-unicode-emoji-table.hh -© 2023 Unicode®, Inc. +© 2024 Unicode®, Inc. + Unicode and the Unicode Logo are registered trademarks of Unicode, Inc. in the U.S. and other countries. -For terms of use, see https://www.unicode.org/terms_of_use.html +For terms of use and license, see https://www.unicode.org/terms_of_use.html diff --git a/src/java.desktop/share/legal/lcms.md b/src/java.desktop/share/legal/lcms.md index 02af4fff0005..83c47d3acdb4 100644 --- a/src/java.desktop/share/legal/lcms.md +++ b/src/java.desktop/share/legal/lcms.md @@ -1,11 +1,11 @@ -## Little Color Management System (LCMS) v2.16 +## Little Color Management System (LCMS) v2.17 ### LCMS License
 
 MIT License
 
-Copyright (C) 1998-2023 Marti Maria Saguer
+Copyright (C) 1998-2025 Marti Maria Saguer
 
 Permission is hereby granted, free of charge, to any person obtaining
 a copy of this software and associated documentation files (the "Software"),
@@ -26,10 +26,10 @@ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 ---------------------------------
-The below license applies to the following files:
+The below applies to the following file(s):
 liblcms/cmssm.c
 
-Copyright 2001, softSurfer (www.softsurfer.com)
+Copyright (C) 2001, softSurfer (www.softsurfer.com)
 
 This code may be freely used and modified for any purpose
 providing that this copyright notice is included with it.
@@ -99,5 +99,5 @@ Christian Albrecht
 Dimitrios Anastassakis
 Lemke Software
 Tim Zaman
-
-```
+Amir Montazery and Open Source Technology Improvement Fund (ostif.org), Google, for fuzzer fundings.
+```
\ No newline at end of file
diff --git a/src/java.desktop/share/legal/libpng.md b/src/java.desktop/share/legal/libpng.md
index cbffed813320..d43ccf2e8e49 100644
--- a/src/java.desktop/share/legal/libpng.md
+++ b/src/java.desktop/share/legal/libpng.md
@@ -1,4 +1,4 @@
-## libpng v1.6.43
+## libpng v1.6.47
 
 ### libpng License
 
@@ -9,8 +9,8 @@ COPYRIGHT NOTICE, DISCLAIMER, and LICENSE
 PNG Reference Library License version 2
 ---------------------------------------
 
-Copyright (C) 1995-2024 The PNG Reference Library Authors.
-Copyright (C) 2018-2024 Cosmin Truta
+Copyright (c) 1995-2025 The PNG Reference Library Authors.
+Copyright (C) 2018-2025 Cosmin Truta
 Copyright (C) 1998-2018 Glenn Randers-Pehrson
 Copyright (C) 1996-1997 Andreas Dilger
 Copyright (C) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
@@ -170,6 +170,7 @@ Authors, for copyright and licensing purposes.
  * James Yu
  * John Bowler
  * Kevin Bracey
+ * Lucas Chollet
  * Magnus Holmgren
  * Mandar Sahastrabuddhe
  * Mans Rullgard
diff --git a/src/java.desktop/share/native/libawt/java2d/loops/TransformHelper.c b/src/java.desktop/share/native/libawt/java2d/loops/TransformHelper.c
index 02c99ea9adad..cad849961d12 100644
--- a/src/java.desktop/share/native/libawt/java2d/loops/TransformHelper.c
+++ b/src/java.desktop/share/native/libawt/java2d/loops/TransformHelper.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2025, 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
@@ -33,6 +33,8 @@
 #include "sun_java2d_loops_TransformHelper.h"
 #include "java_awt_image_AffineTransformOp.h"
 
+#include "ub.h"
+
 /*
  * The stub functions replace the bilinear and bicubic interpolation
  * functions with NOP versions so that the performance of the helper
@@ -661,6 +663,7 @@ Transform_SafeHelper(JNIEnv *env,
         ((jubyte *)pRes)[comp] = (jubyte) ((cR + (1<<15)) >> 16); \
     } while (0)
 
+ATTRIBUTE_NO_UBSAN
 static void
 BilinearInterp(jint *pRGB, jint numpix,
                jint xfract, jint dxfract,
diff --git a/src/java.desktop/share/native/libawt/java2d/pipe/ShapeSpanIterator.c b/src/java.desktop/share/native/libawt/java2d/pipe/ShapeSpanIterator.c
index 333231c508fa..f2bb4b40ee12 100644
--- a/src/java.desktop/share/native/libawt/java2d/pipe/ShapeSpanIterator.c
+++ b/src/java.desktop/share/native/libawt/java2d/pipe/ShapeSpanIterator.c
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1998, 2025, 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
@@ -39,6 +39,8 @@
 #include "sun_java2d_pipe_ShapeSpanIterator.h"
 #include "java_awt_geom_PathIterator.h"
 
+#include "ub.h"
+
 /*
  * This structure holds all of the information needed to trace and
  * manage a single line segment of the shape's outline.
@@ -1243,6 +1245,7 @@ ShapeSIIntersectClipBox(JNIEnv *env, void *private,
     }
 }
 
+ATTRIBUTE_NO_UBSAN
 static jboolean
 ShapeSINextSpan(void *state, jint spanbox[])
 {
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/config/ftconfig.h b/src/java.desktop/share/native/libfreetype/include/freetype/config/ftconfig.h
index a85151699d0e..0667493fec64 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/config/ftconfig.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/config/ftconfig.h
@@ -4,7 +4,7 @@
  *
  *   ANSI-specific configuration file (specification only).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/config/ftheader.h b/src/java.desktop/share/native/libfreetype/include/freetype/config/ftheader.h
index e607bce15c57..f6ef2618dede 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/config/ftheader.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/config/ftheader.h
@@ -4,7 +4,7 @@
  *
  *   Build macros of the FreeType 2 library.
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/config/ftoption.h b/src/java.desktop/share/native/libfreetype/include/freetype/config/ftoption.h
index 4375c7a6ff34..d29a0a7cefbd 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/config/ftoption.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/config/ftoption.h
@@ -4,7 +4,7 @@
  *
  *   User-selectable configuration macros (specification only).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -757,6 +757,22 @@ FT_BEGIN_HEADER
 #endif
 
 
+  /**************************************************************************
+   *
+   * Option `TT_CONFIG_OPTION_GPOS_KERNING` enables a basic GPOS kerning
+   * implementation (for TrueType fonts only).  With this defined, FreeType
+   * is able to get kerning pair data from the GPOS 'kern' feature as well as
+   * legacy 'kern' tables; without this defined, FreeType will only be able
+   * to use legacy 'kern' tables.
+   *
+   * Note that FreeType does not support more advanced GPOS layout features;
+   * even the 'kern' feature implemented here doesn't handle more
+   * sophisticated kerning variants.  Use a higher-level library like
+   * HarfBuzz instead for that.
+   */
+/* #define TT_CONFIG_OPTION_GPOS_KERNING */
+
+
   /*************************************************************************/
   /*************************************************************************/
   /****                                                                 ****/
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/config/ftstdlib.h b/src/java.desktop/share/native/libfreetype/include/freetype/config/ftstdlib.h
index f65148a902ea..e17aa7b89d57 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/config/ftstdlib.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/config/ftstdlib.h
@@ -5,7 +5,7 @@
  *   ANSI-specific library and header configuration file (specification
  *   only).
  *
- * Copyright (C) 2002-2023 by
+ * Copyright (C) 2002-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/config/integer-types.h b/src/java.desktop/share/native/libfreetype/include/freetype/config/integer-types.h
index 7258b5085415..c27505ffc4b6 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/config/integer-types.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/config/integer-types.h
@@ -4,7 +4,7 @@
  *
  *   FreeType integer types definitions.
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/config/mac-support.h b/src/java.desktop/share/native/libfreetype/include/freetype/config/mac-support.h
index b77b96d5db83..07b6f915bd83 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/config/mac-support.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/config/mac-support.h
@@ -4,7 +4,7 @@
  *
  *   Mac/OS X support configuration header.
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/config/public-macros.h b/src/java.desktop/share/native/libfreetype/include/freetype/config/public-macros.h
index 23d0fa6a329c..f56581a6ee79 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/config/public-macros.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/config/public-macros.h
@@ -4,7 +4,7 @@
  *
  *   Define a set of compiler macros used in public FreeType headers.
  *
- * Copyright (C) 2020-2023 by
+ * Copyright (C) 2020-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/freetype.h b/src/java.desktop/share/native/libfreetype/include/freetype/freetype.h
index 92acf3794a7e..58fc33dfe60a 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/freetype.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/freetype.h
@@ -4,7 +4,7 @@
  *
  *   FreeType high-level API and common types (specification only).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -1322,9 +1322,13 @@ FT_BEGIN_HEADER
    *   FT_FACE_FLAG_KERNING ::
    *     The face contains kerning information.  If set, the kerning distance
    *     can be retrieved using the function @FT_Get_Kerning.  Otherwise the
-   *     function always returns the vector (0,0).  Note that FreeType
-   *     doesn't handle kerning data from the SFNT 'GPOS' table (as present
-   *     in many OpenType fonts).
+   *     function always returns the vector (0,0).
+   *
+   *     Note that for TrueType fonts only, FreeType supports both the 'kern'
+   *     table and the basic, pair-wise kerning feature from the 'GPOS' table
+   *     (with `TT_CONFIG_OPTION_GPOS_KERNING` enabled), though FreeType does
+   *     not support the more advanced GPOS layout features; use a library
+   *     like HarfBuzz for those instead.
    *
    *   FT_FACE_FLAG_FAST_GLYPHS ::
    *     THIS FLAG IS DEPRECATED.  DO NOT USE OR TEST IT.
@@ -3767,87 +3771,18 @@ FT_BEGIN_HEADER
    *     pixels and use the @FT_PIXEL_MODE_LCD_V mode.
    *
    *   FT_RENDER_MODE_SDF ::
-   *     This mode corresponds to 8-bit, single-channel signed distance field
-   *     (SDF) bitmaps.  Each pixel in the SDF grid is the value from the
-   *     pixel's position to the nearest glyph's outline.  The distances are
-   *     calculated from the center of the pixel and are positive if they are
-   *     filled by the outline (i.e., inside the outline) and negative
-   *     otherwise.  Check the note below on how to convert the output values
-   *     to usable data.
+   *     The positive (unsigned) 8-bit bitmap values can be converted to the
+   *     single-channel signed distance field (SDF) by subtracting 128, with
+   *     the positive and negative results corresponding to the inside and
+   *     the outside of a glyph contour, respectively.  The distance units are
+   *     arbitrarily determined by an adjustable @spread property.
    *
    * @note:
-   *   The selected render mode only affects vector glyphs of a font.
+   *   The selected render mode only affects scalable vector glyphs of a font.
    *   Embedded bitmaps often have a different pixel mode like
    *   @FT_PIXEL_MODE_MONO.  You can use @FT_Bitmap_Convert to transform them
    *   into 8-bit pixmaps.
    *
-   *   For @FT_RENDER_MODE_SDF the output bitmap buffer contains normalized
-   *   distances that are packed into unsigned 8-bit values.  To get pixel
-   *   values in floating point representation use the following pseudo-C
-   *   code for the conversion.
-   *
-   *   ```
-   *   // Load glyph and render using FT_RENDER_MODE_SDF,
-   *   // then use the output buffer as follows.
-   *
-   *   ...
-   *   FT_Byte  buffer = glyph->bitmap->buffer;
-   *
-   *
-   *   for pixel in buffer
-   *   {
-   *     // `sd` is the signed distance and `spread` is the current spread;
-   *     // the default spread is 2 and can be changed.
-   *
-   *     float  sd = (float)pixel - 128.0f;
-   *
-   *
-   *     // Convert to pixel values.
-   *     sd = ( sd / 128.0f ) * spread;
-   *
-   *     // Store `sd` in a buffer or use as required.
-   *   }
-   *
-   *   ```
-   *
-   *   FreeType has two rasterizers for generating SDF, namely:
-   *
-   *   1. `sdf` for generating SDF directly from glyph's outline, and
-   *
-   *   2. `bsdf` for generating SDF from rasterized bitmaps.
-   *
-   *   Depending on the glyph type (i.e., outline or bitmap), one of the two
-   *   rasterizers is chosen at runtime and used for generating SDFs.  To
-   *   force the use of `bsdf` you should render the glyph with any of the
-   *   FreeType's other rendering modes (e.g., `FT_RENDER_MODE_NORMAL`) and
-   *   then re-render with `FT_RENDER_MODE_SDF`.
-   *
-   *   There are some issues with stability and possible failures of the SDF
-   *   renderers (specifically `sdf`).
-   *
-   *   1. The `sdf` rasterizer is sensitive to really small features (e.g.,
-   *      sharp turns that are less than 1~pixel) and imperfections in the
-   *      glyph's outline, causing artifacts in the final output.
-   *
-   *   2. The `sdf` rasterizer has limited support for handling intersecting
-   *      contours and *cannot* handle self-intersecting contours whatsoever.
-   *      Self-intersection happens when a single connected contour
-   *      intersects itself at some point; having these in your font
-   *      definitely poses a problem to the rasterizer and cause artifacts,
-   *      too.
-   *
-   *   3. Generating SDF for really small glyphs may result in undesirable
-   *      output; the pixel grid (which stores distance information) becomes
-   *      too coarse.
-   *
-   *   4. Since the output buffer is normalized, precision at smaller spreads
-   *      is greater than precision at larger spread values because the
-   *      output range of [0..255] gets mapped to a smaller SDF range.  A
-   *      spread of~2 should be sufficient in most cases.
-   *
-   *   Points (1) and (2) can be avoided by using the `bsdf` rasterizer,
-   *   which is more stable than the `sdf` rasterizer in general.
-   *
    */
   typedef enum  FT_Render_Mode_
   {
@@ -4058,9 +3993,26 @@ FT_BEGIN_HEADER
    *   out of the scope of this API function -- they can be implemented
    *   through format-specific interfaces.
    *
-   *   Kerning for OpenType fonts implemented in a 'GPOS' table is not
-   *   supported; use @FT_HAS_KERNING to find out whether a font has data
-   *   that can be extracted with `FT_Get_Kerning`.
+   *   Note that, for TrueType fonts only, this can extract data from both
+   *   the 'kern' table and the basic, pair-wise kerning feature from the
+   *   GPOS table (with `TT_CONFIG_OPTION_GPOS_KERNING` enabled), though
+   *   FreeType does not support the more advanced GPOS layout features; use
+   *   a library like HarfBuzz for those instead.  If a font has both a
+   *   'kern' table and kern features of a GPOS table, the 'kern' table will
+   *   be used.
+   *
+   *   Also note for right-to-left scripts, the functionality may differ for
+   *   fonts with GPOS tables vs. 'kern' tables.  For GPOS, right-to-left
+   *   fonts typically use both a placement offset and an advance for pair
+   *   positioning, which this API does not support, so it would output
+   *   kerning values of zero; though if the right-to-left font used only
+   *   advances in GPOS pair positioning, then this API could output kerning
+   *   values for it, but it would use `left_glyph` to mean the first glyph
+   *   for that case.  Whereas 'kern' tables are always advance-only and
+   *   always store the left glyph first.
+   *
+   *   Use @FT_HAS_KERNING to find out whether a font has data that can be
+   *   extracted with `FT_Get_Kerning`.
    */
   FT_EXPORT( FT_Error )
   FT_Get_Kerning( FT_Face     face,
@@ -5222,7 +5174,7 @@ FT_BEGIN_HEADER
    */
 #define FREETYPE_MAJOR  2
 #define FREETYPE_MINOR  13
-#define FREETYPE_PATCH  2
+#define FREETYPE_PATCH  3
 
 
   /**************************************************************************
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/ftadvanc.h b/src/java.desktop/share/native/libfreetype/include/freetype/ftadvanc.h
index 4560ded6dcbd..85b8ba2554be 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/ftadvanc.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/ftadvanc.h
@@ -4,7 +4,7 @@
  *
  *   Quick computation of advance widths (specification only).
  *
- * Copyright (C) 2008-2023 by
+ * Copyright (C) 2008-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/ftbbox.h b/src/java.desktop/share/native/libfreetype/include/freetype/ftbbox.h
index fc21740fc2bf..12bbfa63a628 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/ftbbox.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/ftbbox.h
@@ -4,7 +4,7 @@
  *
  *   FreeType exact bbox computation (specification).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/ftbdf.h b/src/java.desktop/share/native/libfreetype/include/freetype/ftbdf.h
index e8ce6431285d..6f63b0b1e781 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/ftbdf.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/ftbdf.h
@@ -4,7 +4,7 @@
  *
  *   FreeType API for accessing BDF-specific strings (specification).
  *
- * Copyright (C) 2002-2023 by
+ * Copyright (C) 2002-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/ftbitmap.h b/src/java.desktop/share/native/libfreetype/include/freetype/ftbitmap.h
index eb6b4b1eebed..df9d462652e7 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/ftbitmap.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/ftbitmap.h
@@ -4,7 +4,7 @@
  *
  *   FreeType utility functions for bitmaps (specification).
  *
- * Copyright (C) 2004-2023 by
+ * Copyright (C) 2004-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/ftcid.h b/src/java.desktop/share/native/libfreetype/include/freetype/ftcid.h
index ef2293902245..96b2a90fc59f 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/ftcid.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/ftcid.h
@@ -4,7 +4,7 @@
  *
  *   FreeType API for accessing CID font information (specification).
  *
- * Copyright (C) 2007-2023 by
+ * Copyright (C) 2007-2024 by
  * Dereg Clegg and Michael Toftdal.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/ftcolor.h b/src/java.desktop/share/native/libfreetype/include/freetype/ftcolor.h
index eae200fdf148..420720ddf225 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/ftcolor.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/ftcolor.h
@@ -4,7 +4,7 @@
  *
  *   FreeType's glyph color management (specification).
  *
- * Copyright (C) 2018-2023 by
+ * Copyright (C) 2018-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/ftdriver.h b/src/java.desktop/share/native/libfreetype/include/freetype/ftdriver.h
index 7af7465bc768..1b7f539f5e22 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/ftdriver.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/ftdriver.h
@@ -4,7 +4,7 @@
  *
  *   FreeType API for controlling driver modules (specification only).
  *
- * Copyright (C) 2017-2023 by
+ * Copyright (C) 2017-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -817,6 +817,80 @@ FT_BEGIN_HEADER
    *   2.5
    */
 
+
+  /**************************************************************************
+   *
+   * @property:
+   *   spread
+   *
+   * @description:
+   *   This property of the 'sdf' and 'bsdf' renderers defines how the signed
+   *   distance field (SDF) is represented in the output bitmap.  The output
+   *   values are calculated as follows, '128 * ( SDF / spread + 1 )', with
+   *   the result clamped to the 8-bit range [0..255].  Therefore, 'spread'
+   *   is also the maximum euclidean distance from the edge after which the
+   *   values are clamped.  The spread is specified in pixels with the
+   *   default value of 8.  For accurate SDF texture mapping (interpolation),
+   *   the spread should be large enough to accommodate the target grid unit.
+   *
+   * @example:
+   *   The following example code demonstrates how to set the SDF spread
+   *   (omitting the error handling).
+   *
+   *   ```
+   *     FT_Library  library;
+   *     FT_Int      spread = 2;
+   *
+   *
+   *     FT_Init_FreeType( &library );
+   *
+   *     FT_Property_Set( library, "sdf", "spread", &spread );
+   *   ```
+   *
+   * @note:
+   *   FreeType has two rasterizers for generating SDF, namely:
+   *
+   *   1. `sdf` for generating SDF directly from glyph's outline, and
+   *
+   *   2. `bsdf` for generating SDF from rasterized bitmaps.
+   *
+   *   Depending on the glyph type (i.e., outline or bitmap), one of the two
+   *   rasterizers is chosen at runtime and used for generating SDFs.  To
+   *   force the use of `bsdf` you should render the glyph with any of the
+   *   FreeType's other rendering modes (e.g., `FT_RENDER_MODE_NORMAL`) and
+   *   then re-render with `FT_RENDER_MODE_SDF`.
+   *
+   *   There are some issues with stability and possible failures of the SDF
+   *   renderers (specifically `sdf`).
+   *
+   *   1. The `sdf` rasterizer is sensitive to really small features (e.g.,
+   *      sharp turns that are less than 1~pixel) and imperfections in the
+   *      glyph's outline, causing artifacts in the final output.
+   *
+   *   2. The `sdf` rasterizer has limited support for handling intersecting
+   *      contours and *cannot* handle self-intersecting contours whatsoever.
+   *      Self-intersection happens when a single connected contour
+   *      intersects itself at some point; having these in your font
+   *      definitely poses a problem to the rasterizer and cause artifacts,
+   *      too.
+   *
+   *   3. Generating SDF for really small glyphs may result in undesirable
+   *      output; the pixel grid (which stores distance information) becomes
+   *      too coarse.
+   *
+   *   4. Since the output buffer is normalized, precision at smaller spreads
+   *      is greater than precision at larger spread values because the
+   *      output range of [0..255] gets mapped to a smaller SDF range.  A
+   *      spread of~2 should be sufficient in most cases.
+   *
+   *   Points (1) and (2) can be avoided by using the `bsdf` rasterizer,
+   *   which is more stable than the `sdf` rasterizer in general.
+   *
+   * @since:
+   *   2.11
+   */
+
+
   /**************************************************************************
    *
    * @property:
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/fterrdef.h b/src/java.desktop/share/native/libfreetype/include/freetype/fterrdef.h
index d59b3cc2da27..710ca91bbddb 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/fterrdef.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/fterrdef.h
@@ -4,7 +4,7 @@
  *
  *   FreeType error codes (specification).
  *
- * Copyright (C) 2002-2023 by
+ * Copyright (C) 2002-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/fterrors.h b/src/java.desktop/share/native/libfreetype/include/freetype/fterrors.h
index 15ef3f76b59f..27c0ece5c1ca 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/fterrors.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/fterrors.h
@@ -4,7 +4,7 @@
  *
  *   FreeType error code handling (specification).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/ftfntfmt.h b/src/java.desktop/share/native/libfreetype/include/freetype/ftfntfmt.h
index c0018fc830c2..7c8b0874a818 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/ftfntfmt.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/ftfntfmt.h
@@ -4,7 +4,7 @@
  *
  *   Support functions for font formats.
  *
- * Copyright (C) 2002-2023 by
+ * Copyright (C) 2002-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/ftgasp.h b/src/java.desktop/share/native/libfreetype/include/freetype/ftgasp.h
index d5f19add8f20..30e5a9bf82b0 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/ftgasp.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/ftgasp.h
@@ -4,7 +4,7 @@
  *
  *   Access of TrueType's 'gasp' table (specification).
  *
- * Copyright (C) 2007-2023 by
+ * Copyright (C) 2007-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/ftglyph.h b/src/java.desktop/share/native/libfreetype/include/freetype/ftglyph.h
index 4658895f7a96..dc1eb8873ae8 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/ftglyph.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/ftglyph.h
@@ -4,7 +4,7 @@
  *
  *   FreeType convenience functions to handle glyphs (specification).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/ftgzip.h b/src/java.desktop/share/native/libfreetype/include/freetype/ftgzip.h
index 443ec29db1bd..9516dc030ac5 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/ftgzip.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/ftgzip.h
@@ -4,7 +4,7 @@
  *
  *   Gzip-compressed stream support.
  *
- * Copyright (C) 2002-2023 by
+ * Copyright (C) 2002-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/ftimage.h b/src/java.desktop/share/native/libfreetype/include/freetype/ftimage.h
index 6baa812560ea..2b4b4ac60ae2 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/ftimage.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/ftimage.h
@@ -5,7 +5,7 @@
  *   FreeType glyph image formats and default raster interface
  *   (specification).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -21,6 +21,11 @@
    * Note: A 'raster' is simply a scan-line converter, used to render
    *       `FT_Outline`s into `FT_Bitmap`s.
    *
+   * Note: This file can be used for `STANDALONE_` compilation of raster
+   *       (B/W) and smooth (anti-aliased) renderers.  Therefore, it must
+   *       rely on standard variable types only instead of aliases in
+   *       `fttypes.h`.
+   *
    */
 
 
@@ -318,7 +323,7 @@ FT_BEGIN_HEADER
    *
    *     If bit~2 is set, bits 5-7 contain the drop-out mode (as defined in
    *     the OpenType specification; the value is the same as the argument to
-   *     the 'SCANMODE' instruction).
+   *     the 'SCANTYPE' instruction).
    *
    *     Bits 3 and~4 are reserved for internal purposes.
    *
@@ -341,14 +346,14 @@ FT_BEGIN_HEADER
    */
   typedef struct  FT_Outline_
   {
-    short       n_contours;      /* number of contours in glyph        */
-    short       n_points;        /* number of points in the glyph      */
+    unsigned short   n_contours;  /* number of contours in glyph        */
+    unsigned short   n_points;    /* number of points in the glyph      */
 
-    FT_Vector*  points;          /* the outline's points               */
-    char*       tags;            /* the points flags                   */
-    short*      contours;        /* the contour end points             */
+    FT_Vector*       points;      /* the outline's points               */
+    unsigned char*   tags;        /* the points flags                   */
+    unsigned short*  contours;    /* the contour end points             */
 
-    int         flags;           /* outline masks                      */
+    int              flags;       /* outline masks                      */
 
   } FT_Outline;
 
@@ -356,8 +361,8 @@ FT_BEGIN_HEADER
 
   /* Following limits must be consistent with */
   /* FT_Outline.{n_contours,n_points}         */
-#define FT_OUTLINE_CONTOURS_MAX  SHRT_MAX
-#define FT_OUTLINE_POINTS_MAX    SHRT_MAX
+#define FT_OUTLINE_CONTOURS_MAX  USHRT_MAX
+#define FT_OUTLINE_POINTS_MAX    USHRT_MAX
 
 
   /**************************************************************************
@@ -434,8 +439,8 @@ FT_BEGIN_HEADER
    *   rasterizer; see the `tags` field in @FT_Outline.
    *
    *   Please refer to the description of the 'SCANTYPE' instruction in the
-   *   OpenType specification (in file `ttinst1.doc`) how simple drop-outs,
-   *   smart drop-outs, and stubs are defined.
+   *   [OpenType specification](https://learn.microsoft.com/en-us/typography/opentype/spec/tt_instructions#scantype)
+   *   how simple drop-outs, smart drop-outs, and stubs are defined.
    */
 #define FT_OUTLINE_NONE             0x0
 #define FT_OUTLINE_OWNER            0x1
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/ftincrem.h b/src/java.desktop/share/native/libfreetype/include/freetype/ftincrem.h
index 2d4f5def241b..816581b78ebd 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/ftincrem.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/ftincrem.h
@@ -4,7 +4,7 @@
  *
  *   FreeType incremental loading (specification).
  *
- * Copyright (C) 2002-2023 by
+ * Copyright (C) 2002-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/ftlcdfil.h b/src/java.desktop/share/native/libfreetype/include/freetype/ftlcdfil.h
index d3723e16f67d..25274dc4ac22 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/ftlcdfil.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/ftlcdfil.h
@@ -5,7 +5,7 @@
  *   FreeType API for color filtering of subpixel bitmap glyphs
  *   (specification).
  *
- * Copyright (C) 2006-2023 by
+ * Copyright (C) 2006-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/ftlist.h b/src/java.desktop/share/native/libfreetype/include/freetype/ftlist.h
index b55313133593..972fbfa2fe4e 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/ftlist.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/ftlist.h
@@ -4,7 +4,7 @@
  *
  *   Generic list support for FreeType (specification).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/ftlogging.h b/src/java.desktop/share/native/libfreetype/include/freetype/ftlogging.h
index 53b8b8964271..1813cfc2c27a 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/ftlogging.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/ftlogging.h
@@ -4,7 +4,7 @@
  *
  *   Additional debugging APIs.
  *
- * Copyright (C) 2020-2023 by
+ * Copyright (C) 2020-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/ftmac.h b/src/java.desktop/share/native/libfreetype/include/freetype/ftmac.h
index a91e38f9ea75..e4efde33dd83 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/ftmac.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/ftmac.h
@@ -4,7 +4,7 @@
  *
  *   Additional Mac-specific API.
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * Just van Rossum, David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/ftmm.h b/src/java.desktop/share/native/libfreetype/include/freetype/ftmm.h
index d145128a9bcd..35ed039c89b8 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/ftmm.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/ftmm.h
@@ -4,7 +4,7 @@
  *
  *   FreeType Multiple Master font interface (specification).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -19,8 +19,13 @@
 #ifndef FTMM_H_
 #define FTMM_H_
 
+#include 
 
-#include 
+#ifdef FREETYPE_H
+#error "freetype.h of FreeType 1 has been loaded!"
+#error "Please fix the directory search order for header files"
+#error "so that freetype.h of FreeType 2 is found first."
+#endif
 
 
 FT_BEGIN_HEADER
@@ -53,6 +58,30 @@ FT_BEGIN_HEADER
    */
 
 
+  /**************************************************************************
+   *
+   * @enum:
+   *   T1_MAX_MM_XXX
+   *
+   * @description:
+   *   Multiple Masters limits as defined in their specifications.
+   *
+   * @values:
+   *   T1_MAX_MM_AXIS ::
+   *     The maximum number of Multiple Masters axes.
+   *
+   *   T1_MAX_MM_DESIGNS ::
+   *     The maximum number of Multiple Masters designs.
+   *
+   *   T1_MAX_MM_MAP_POINTS ::
+   *     The maximum number of elements in a design map.
+   *
+   */
+#define T1_MAX_MM_AXIS         4
+#define T1_MAX_MM_DESIGNS     16
+#define T1_MAX_MM_MAP_POINTS  20
+
+
   /**************************************************************************
    *
    * @struct:
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/ftmodapi.h b/src/java.desktop/share/native/libfreetype/include/freetype/ftmodapi.h
index c8f0c2c2a45e..0ee715898f7b 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/ftmodapi.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/ftmodapi.h
@@ -4,7 +4,7 @@
  *
  *   FreeType modules public interface (specification).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/ftmoderr.h b/src/java.desktop/share/native/libfreetype/include/freetype/ftmoderr.h
index c8c892dcce8b..6722fbf8b709 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/ftmoderr.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/ftmoderr.h
@@ -4,7 +4,7 @@
  *
  *   FreeType module error offsets (specification).
  *
- * Copyright (C) 2001-2023 by
+ * Copyright (C) 2001-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/ftoutln.h b/src/java.desktop/share/native/libfreetype/include/freetype/ftoutln.h
index f9329ca40c98..44e94b4f5bbb 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/ftoutln.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/ftoutln.h
@@ -5,7 +5,7 @@
  *   Support for the FT_Outline type used to store glyph shapes of
  *   most scalable font formats (specification).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -112,7 +112,7 @@ FT_BEGIN_HEADER
    *   Degenerate contours, segments, and Bezier arcs may be reported.  In
    *   most cases, it is best to filter these out before using the outline
    *   for stroking or other path modification purposes (which may cause
-   *   degenerate segments to become non-degenrate and visible, like when
+   *   degenerate segments to become non-degenerate and visible, like when
    *   stroke caps are used or the path is otherwise outset).  Some glyph
    *   outlines may contain deliberate degenerate single points for mark
    *   attachement.
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/ftparams.h b/src/java.desktop/share/native/libfreetype/include/freetype/ftparams.h
index 6a9f243bc904..43bf69c202f7 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/ftparams.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/ftparams.h
@@ -4,7 +4,7 @@
  *
  *   FreeType API for possible FT_Parameter tags (specification only).
  *
- * Copyright (C) 2017-2023 by
+ * Copyright (C) 2017-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/ftrender.h b/src/java.desktop/share/native/libfreetype/include/freetype/ftrender.h
index 0b6fad32e849..dc5018a1b54b 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/ftrender.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/ftrender.h
@@ -4,7 +4,7 @@
  *
  *   FreeType renderer modules public interface (specification).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/ftsizes.h b/src/java.desktop/share/native/libfreetype/include/freetype/ftsizes.h
index 7bfb1aed4c25..4ef5c7955dfd 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/ftsizes.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/ftsizes.h
@@ -4,7 +4,7 @@
  *
  *   FreeType size objects management (specification).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/ftsnames.h b/src/java.desktop/share/native/libfreetype/include/freetype/ftsnames.h
index 9d5d22bb2554..d5d5cd931032 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/ftsnames.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/ftsnames.h
@@ -7,7 +7,7 @@
  *
  *   This is _not_ used to retrieve glyph names!
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/ftstroke.h b/src/java.desktop/share/native/libfreetype/include/freetype/ftstroke.h
index b3d90802a56a..41626dc9d7b3 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/ftstroke.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/ftstroke.h
@@ -4,7 +4,7 @@
  *
  *   FreeType path stroker (specification).
  *
- * Copyright (C) 2002-2023 by
+ * Copyright (C) 2002-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/ftsynth.h b/src/java.desktop/share/native/libfreetype/include/freetype/ftsynth.h
index af90967dda0d..43081b6c3307 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/ftsynth.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/ftsynth.h
@@ -5,7 +5,7 @@
  *   FreeType synthesizing code for emboldening and slanting
  *   (specification).
  *
- * Copyright (C) 2000-2023 by
+ * Copyright (C) 2000-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/ftsystem.h b/src/java.desktop/share/native/libfreetype/include/freetype/ftsystem.h
index 3a08f4912c98..1eacb3af398f 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/ftsystem.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/ftsystem.h
@@ -4,7 +4,7 @@
  *
  *   FreeType low-level system interface definition (specification).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/fttrigon.h b/src/java.desktop/share/native/libfreetype/include/freetype/fttrigon.h
index 294981a6f312..a5299e938d45 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/fttrigon.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/fttrigon.h
@@ -4,7 +4,7 @@
  *
  *   FreeType trigonometric functions (specification).
  *
- * Copyright (C) 2001-2023 by
+ * Copyright (C) 2001-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/fttypes.h b/src/java.desktop/share/native/libfreetype/include/freetype/fttypes.h
index 5b109f0c73c2..27815143a645 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/fttypes.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/fttypes.h
@@ -4,7 +4,7 @@
  *
  *   FreeType simple types definitions (specification only).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/autohint.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/autohint.h
index bf9c8b7cf2a5..8865d53b3894 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/autohint.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/autohint.h
@@ -4,7 +4,7 @@
  *
  *   High-level 'autohint' module-specific interface (specification).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/cffotypes.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/cffotypes.h
index 50d535384989..36b0390a5a56 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/cffotypes.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/cffotypes.h
@@ -4,7 +4,7 @@
  *
  *   Basic OpenType/CFF object type definitions (specification).
  *
- * Copyright (C) 2017-2023 by
+ * Copyright (C) 2017-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/cfftypes.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/cfftypes.h
index c2521764caa0..ef2e8e7569c3 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/cfftypes.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/cfftypes.h
@@ -5,7 +5,7 @@
  *   Basic OpenType/CFF type definitions and interface (specification
  *   only).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -248,10 +248,10 @@ FT_BEGIN_HEADER
     FT_Byte   num_family_blues;
     FT_Byte   num_family_other_blues;
 
-    FT_Pos    blue_values[14];
-    FT_Pos    other_blues[10];
-    FT_Pos    family_blues[14];
-    FT_Pos    family_other_blues[10];
+    FT_Fixed  blue_values[14];
+    FT_Fixed  other_blues[10];
+    FT_Fixed  family_blues[14];
+    FT_Fixed  family_other_blues[10];
 
     FT_Fixed  blue_scale;
     FT_Pos    blue_shift;
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/compiler-macros.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/compiler-macros.h
index 6f67650979e9..876f66e25617 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/compiler-macros.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/compiler-macros.h
@@ -4,7 +4,7 @@
  *
  *   Compiler-specific macro definitions used internally by FreeType.
  *
- * Copyright (C) 2020-2023 by
+ * Copyright (C) 2020-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftcalc.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftcalc.h
index d9aea236024f..71128a2df909 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftcalc.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftcalc.h
@@ -4,7 +4,7 @@
  *
  *   Arithmetic computations (specification).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -415,7 +415,7 @@ FT_BEGIN_HEADER
 
 #define FT_MSB( x )  ( 31 - _CountLeadingZeros( x ) )
 
-#elif defined( _M_ARM64 ) || defined( _M_ARM )
+#elif defined( _M_ARM64 ) || defined( _M_ARM ) || defined( _M_ARM64EC )
 
 #include 
 #pragma intrinsic( _CountLeadingZeros )
@@ -455,6 +455,12 @@ FT_BEGIN_HEADER
 
 #define FT_MSB( x )  FT_MSB_i386( x )
 
+#elif defined( __SunOS_5_11 )
+
+#include 
+
+#define FT_MSB( x )  ( fls( x ) - 1 )
+
 #elif defined( __DECC ) || defined( __DECCXX )
 
 #include 
@@ -489,8 +495,6 @@ FT_BEGIN_HEADER
             FT_Fixed  y );
 
 
-#if 0
-
   /**************************************************************************
    *
    * @function:
@@ -507,12 +511,11 @@ FT_BEGIN_HEADER
    *   The result of 'sqrt(x)'.
    *
    * @note:
-   *   This function is not very fast.
+   *   This function is slow and should be avoided.  Consider @FT_Hypot or
+   *   @FT_Vector_NormLen instead.
    */
-  FT_BASE( FT_Int32 )
-  FT_SqrtFixed( FT_Int32  x );
-
-#endif /* 0 */
+  FT_BASE( FT_UInt32 )
+  FT_SqrtFixed( FT_UInt32  x );
 
 
 #define INT_TO_F26DOT6( x )    ( (FT_Long)(x) * 64  )    /* << 6  */
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftdebug.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftdebug.h
index 4e013ba1e267..d7fa8dc93cf7 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftdebug.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftdebug.h
@@ -4,7 +4,7 @@
  *
  *   Debugging and logging component (specification).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftdrv.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftdrv.h
index 9001c07ad0b4..5609b3ef12bd 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftdrv.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftdrv.h
@@ -4,7 +4,7 @@
  *
  *   FreeType internal font driver interface (specification).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftgloadr.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftgloadr.h
index 36e5509f9eab..f1c155b162ca 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftgloadr.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftgloadr.h
@@ -4,7 +4,7 @@
  *
  *   The FreeType glyph loader (specification).
  *
- * Copyright (C) 2002-2023 by
+ * Copyright (C) 2002-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftmemory.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftmemory.h
index 5eb1d21ff67c..4e05a29f13a1 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftmemory.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftmemory.h
@@ -4,7 +4,7 @@
  *
  *   The FreeType memory management macros (specification).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg
  *
  * This file is part of the FreeType project, and may only be used,
@@ -371,8 +371,11 @@ extern "C++"
 #define FT_STRDUP( dst, str )                           \
           FT_MEM_SET_ERROR( FT_MEM_STRDUP( dst, str ) )
 
-#define FT_MEM_DUP( dst, address, size )                                    \
-          (dst) = ft_mem_dup( memory, (address), (FT_ULong)(size), &error )
+#define FT_MEM_DUP( dst, address, size )                       \
+          FT_ASSIGNP_INNER( dst, ft_mem_dup( memory,           \
+                                             (address),        \
+                                             (FT_ULong)(size), \
+                                             &error ) )
 
 #define FT_DUP( dst, address, size )                           \
           FT_MEM_SET_ERROR( FT_MEM_DUP( dst, address, size ) )
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftmmtypes.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftmmtypes.h
index c4b21d6144ea..8449e7a010d0 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftmmtypes.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftmmtypes.h
@@ -5,7 +5,7 @@
  *   OpenType Variations type definitions for internal use
  *   with the multi-masters service (specification).
  *
- * Copyright (C) 2022-2023 by
+ * Copyright (C) 2022-2024 by
  * David Turner, Robert Wilhelm, Werner Lemberg, George Williams, and
  * Dominik Röttsches.
  *
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftobjs.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftobjs.h
index 28bc9b65f058..a1e93298fdbc 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftobjs.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftobjs.h
@@ -4,7 +4,7 @@
  *
  *   The FreeType private base classes (specification).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -604,12 +604,6 @@ FT_BEGIN_HEADER
 #define FT_FACE_MEMORY( x )   FT_FACE( x )->memory
 #define FT_FACE_STREAM( x )   FT_FACE( x )->stream
 
-#define FT_SIZE_FACE( x )     FT_SIZE( x )->face
-#define FT_SLOT_FACE( x )     FT_SLOT( x )->face
-
-#define FT_FACE_SLOT( x )     FT_FACE( x )->glyph
-#define FT_FACE_SIZE( x )     FT_FACE( x )->size
-
 
   /**************************************************************************
    *
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftpsprop.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftpsprop.h
index 1d5b287ad208..4f11aa16ba11 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftpsprop.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftpsprop.h
@@ -4,7 +4,7 @@
  *
  *   Get and set properties of PostScript drivers (specification).
  *
- * Copyright (C) 2017-2023 by
+ * Copyright (C) 2017-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftrfork.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftrfork.h
index e96459921ef9..05c1d6c48b53 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftrfork.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftrfork.h
@@ -4,7 +4,7 @@
  *
  *   Embedded resource forks accessor (specification).
  *
- * Copyright (C) 2004-2023 by
+ * Copyright (C) 2004-2024 by
  * Masatake YAMATO and Redhat K.K.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftserv.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftserv.h
index 1e85d6d3856a..8c35dbd71395 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftserv.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftserv.h
@@ -4,7 +4,7 @@
  *
  *   The FreeType services (specification only).
  *
- * Copyright (C) 2003-2023 by
+ * Copyright (C) 2003-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftstream.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftstream.h
index 88e19287c809..fd52f767ef77 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftstream.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftstream.h
@@ -4,7 +4,7 @@
  *
  *   Stream handling (specification).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/fttrace.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/fttrace.h
index 319fe56fd2d3..42595a29ff33 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/fttrace.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/fttrace.h
@@ -4,7 +4,7 @@
  *
  *   Tracing handling (specification only).
  *
- * Copyright (C) 2002-2023 by
+ * Copyright (C) 2002-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -64,6 +64,7 @@ FT_TRACE_DEF( ttbdf )     /* TrueType embedded BDF   (ttbdf.c)    */
 FT_TRACE_DEF( ttcmap )    /* charmap handler         (ttcmap.c)   */
 FT_TRACE_DEF( ttcolr )    /* glyph layer table       (ttcolr.c)   */
 FT_TRACE_DEF( ttcpal )    /* color palette table     (ttcpal.c)   */
+FT_TRACE_DEF( ttgpos )    /* GPOS handler            (ttgpos.c)   */
 FT_TRACE_DEF( ttsvg )     /* OpenType SVG table      (ttsvg.c)    */
 FT_TRACE_DEF( ttkern )    /* kerning handler         (ttkern.c)   */
 FT_TRACE_DEF( ttload )    /* basic TrueType tables   (ttload.c)   */
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftvalid.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftvalid.h
index e98ee4e47373..a1312f2aba6c 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftvalid.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/ftvalid.h
@@ -4,7 +4,7 @@
  *
  *   FreeType validation support (specification).
  *
- * Copyright (C) 2004-2023 by
+ * Copyright (C) 2004-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/psaux.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/psaux.h
index dfb1987f8689..745d2cb56b77 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/psaux.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/psaux.h
@@ -5,7 +5,7 @@
  *   Auxiliary functions and data structures related to PostScript fonts
  *   (specification).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -225,6 +225,7 @@ FT_BEGIN_HEADER
 
   typedef enum  T1_FieldLocation_
   {
+    T1_FIELD_LOCATION_NONE = 0,
     T1_FIELD_LOCATION_CID_INFO,
     T1_FIELD_LOCATION_FONT_DICT,
     T1_FIELD_LOCATION_FONT_EXTRA,
@@ -249,6 +250,7 @@ FT_BEGIN_HEADER
   /* structure type used to model object fields */
   typedef struct  T1_FieldRec_
   {
+    FT_UInt             len;          /* field identifier length        */
     const char*         ident;        /* field identifier               */
     T1_FieldLocation    location;
     T1_FieldType        type;         /* type of field                  */
@@ -273,8 +275,9 @@ FT_BEGIN_HEADER
 
 #define T1_NEW_SIMPLE_FIELD( _ident, _type, _fname, _dict ) \
           {                                                 \
+            sizeof ( _ident ) - 1,                          \
             _ident, T1CODE, _type,                          \
-            0,                                              \
+            NULL,                                           \
             FT_FIELD_OFFSET( _fname ),                      \
             FT_FIELD_SIZE( _fname ),                        \
             0, 0,                                           \
@@ -283,6 +286,7 @@ FT_BEGIN_HEADER
 
 #define T1_NEW_CALLBACK_FIELD( _ident, _reader, _dict ) \
           {                                             \
+            sizeof ( _ident ) - 1,                      \
             _ident, T1CODE, T1_FIELD_TYPE_CALLBACK,     \
             (T1_Field_ParseFunc)_reader,                \
             0, 0,                                       \
@@ -292,8 +296,9 @@ FT_BEGIN_HEADER
 
 #define T1_NEW_TABLE_FIELD( _ident, _type, _fname, _max, _dict ) \
           {                                                      \
+            sizeof ( _ident ) - 1,                               \
             _ident, T1CODE, _type,                               \
-            0,                                                   \
+            NULL,                                                \
             FT_FIELD_OFFSET( _fname ),                           \
             FT_FIELD_SIZE_DELTA( _fname ),                       \
             _max,                                                \
@@ -303,8 +308,9 @@ FT_BEGIN_HEADER
 
 #define T1_NEW_TABLE_FIELD2( _ident, _type, _fname, _max, _dict ) \
           {                                                       \
+            sizeof ( _ident ) - 1,                                \
             _ident, T1CODE, _type,                                \
-            0,                                                    \
+            NULL,                                                 \
             FT_FIELD_OFFSET( _fname ),                            \
             FT_FIELD_SIZE_DELTA( _fname ),                        \
             _max, 0,                                              \
@@ -354,6 +360,13 @@ FT_BEGIN_HEADER
 #define T1_FIELD_CALLBACK( _ident, _name, _dict )       \
           T1_NEW_CALLBACK_FIELD( _ident, _name, _dict )
 
+#define T1_FIELD_ZERO                                         \
+          {                                                   \
+            0,                                                \
+            NULL, T1_FIELD_LOCATION_NONE, T1_FIELD_TYPE_NONE, \
+            NULL, 0, 0, 0, 0, 0                               \
+          }
+
 
   /*************************************************************************/
   /*************************************************************************/
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/pshints.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/pshints.h
index ededc4c72e7a..dba6c7303fdc 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/pshints.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/pshints.h
@@ -6,7 +6,7 @@
  *   recorders (specification only).  These are used to support native
  *   T1/T2 hints in the 'type1', 'cid', and 'cff' font drivers.
  *
- * Copyright (C) 2001-2023 by
+ * Copyright (C) 2001-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svbdf.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svbdf.h
index bf0c1dcc7145..89e9c2e5de80 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svbdf.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svbdf.h
@@ -4,7 +4,7 @@
  *
  *   The FreeType BDF services (specification).
  *
- * Copyright (C) 2003-2023 by
+ * Copyright (C) 2003-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svcfftl.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svcfftl.h
index 4a20498ee0cf..3cb483c344f8 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svcfftl.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svcfftl.h
@@ -4,7 +4,7 @@
  *
  *   The FreeType CFF tables loader service (specification).
  *
- * Copyright (C) 2017-2023 by
+ * Copyright (C) 2017-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svcid.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svcid.h
index 06d0cb8fd62e..8362cb8724d8 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svcid.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svcid.h
@@ -4,7 +4,7 @@
  *
  *   The FreeType CID font services (specification).
  *
- * Copyright (C) 2007-2023 by
+ * Copyright (C) 2007-2024 by
  * Derek Clegg and Michael Toftdal.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svfntfmt.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svfntfmt.h
index bc45e80568fc..6b837e79fcd4 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svfntfmt.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svfntfmt.h
@@ -4,7 +4,7 @@
  *
  *   The FreeType font format service (specification only).
  *
- * Copyright (C) 2003-2023 by
+ * Copyright (C) 2003-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svgldict.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svgldict.h
index 6437abfbf2e8..6126ec9ada4a 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svgldict.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svgldict.h
@@ -4,7 +4,7 @@
  *
  *   The FreeType glyph dictionary services (specification).
  *
- * Copyright (C) 2003-2023 by
+ * Copyright (C) 2003-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svgxval.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svgxval.h
index 31016afe0d04..29cf55281893 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svgxval.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svgxval.h
@@ -4,7 +4,7 @@
  *
  *   FreeType API for validating TrueTypeGX/AAT tables (specification).
  *
- * Copyright (C) 2004-2023 by
+ * Copyright (C) 2004-2024 by
  * Masatake YAMATO, Red Hat K.K.,
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svkern.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svkern.h
index bcabbc3e68fd..ac1bc30c412f 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svkern.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svkern.h
@@ -4,7 +4,7 @@
  *
  *   The FreeType Kerning service (specification).
  *
- * Copyright (C) 2006-2023 by
+ * Copyright (C) 2006-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svmetric.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svmetric.h
index 167617ebb3d0..8b3563b25ca4 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svmetric.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svmetric.h
@@ -4,7 +4,7 @@
  *
  *   The FreeType services for metrics variations (specification).
  *
- * Copyright (C) 2016-2023 by
+ * Copyright (C) 2016-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svmm.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svmm.h
index 7e76ab8324e4..5288fadf3755 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svmm.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svmm.h
@@ -4,7 +4,7 @@
  *
  *   The FreeType Multiple Masters and GX var services (specification).
  *
- * Copyright (C) 2003-2023 by
+ * Copyright (C) 2003-2024 by
  * David Turner, Robert Wilhelm, Werner Lemberg, and Dominik Röttsches.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svotval.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svotval.h
index a4683cd5fb64..7aea7ec11f02 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svotval.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svotval.h
@@ -4,7 +4,7 @@
  *
  *   The FreeType OpenType validation service (specification).
  *
- * Copyright (C) 2004-2023 by
+ * Copyright (C) 2004-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svpfr.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svpfr.h
index fd189c7de773..b2fac6d086b2 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svpfr.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svpfr.h
@@ -4,7 +4,7 @@
  *
  *   Internal PFR service functions (specification).
  *
- * Copyright (C) 2003-2023 by
+ * Copyright (C) 2003-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svpostnm.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svpostnm.h
index 2b8f6dfecfb0..d19f3adc6d5a 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svpostnm.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svpostnm.h
@@ -4,7 +4,7 @@
  *
  *   The FreeType PostScript name services (specification).
  *
- * Copyright (C) 2003-2023 by
+ * Copyright (C) 2003-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svprop.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svprop.h
index 932ce32e03d7..ba39c0dd4da9 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svprop.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svprop.h
@@ -4,7 +4,7 @@
  *
  *   The FreeType property service (specification).
  *
- * Copyright (C) 2012-2023 by
+ * Copyright (C) 2012-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svpscmap.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svpscmap.h
index 6e599f3aabe4..d4908ee41aa2 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svpscmap.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svpscmap.h
@@ -4,7 +4,7 @@
  *
  *   The FreeType PostScript charmap service (specification).
  *
- * Copyright (C) 2003-2023 by
+ * Copyright (C) 2003-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svpsinfo.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svpsinfo.h
index 09c4cdccc534..2aadcdd02a1b 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svpsinfo.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svpsinfo.h
@@ -4,7 +4,7 @@
  *
  *   The FreeType PostScript info service (specification).
  *
- * Copyright (C) 2003-2023 by
+ * Copyright (C) 2003-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svsfnt.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svsfnt.h
index f98df2ef5fe7..9e0f4ff202e9 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svsfnt.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svsfnt.h
@@ -4,7 +4,7 @@
  *
  *   The FreeType SFNT table loading service (specification).
  *
- * Copyright (C) 2003-2023 by
+ * Copyright (C) 2003-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svttcmap.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svttcmap.h
index 5f9eb02d6655..250886bcc5db 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svttcmap.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svttcmap.h
@@ -4,7 +4,7 @@
  *
  *   The FreeType TrueType/sfnt cmap extra information service.
  *
- * Copyright (C) 2003-2023 by
+ * Copyright (C) 2003-2024 by
  * Masatake YAMATO, Redhat K.K.,
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svtteng.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svtteng.h
index ad577cb2904d..14967529a9ac 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svtteng.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svtteng.h
@@ -4,7 +4,7 @@
  *
  *   The FreeType TrueType engine query service (specification).
  *
- * Copyright (C) 2006-2023 by
+ * Copyright (C) 2006-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svttglyf.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svttglyf.h
index ca6fff74444b..f190b3985d02 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svttglyf.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svttglyf.h
@@ -4,7 +4,7 @@
  *
  *   The FreeType TrueType glyph service.
  *
- * Copyright (C) 2007-2023 by
+ * Copyright (C) 2007-2024 by
  * David Turner.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svwinfnt.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svwinfnt.h
index 002923f8c914..49f3fb7f775b 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svwinfnt.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/services/svwinfnt.h
@@ -4,7 +4,7 @@
  *
  *   The FreeType Windows FNT/FONT service (specification).
  *
- * Copyright (C) 2003-2023 by
+ * Copyright (C) 2003-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/sfnt.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/sfnt.h
index a2d4e15baafd..35e4e73af02f 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/sfnt.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/sfnt.h
@@ -4,7 +4,7 @@
  *
  *   High-level 'sfnt' driver interface (specification).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -924,6 +924,7 @@ FT_BEGIN_HEADER
     /* this field was called `load_kerning' up to version 2.1.10 */
     TT_Load_Table_Func  load_kern;
 
+    TT_Load_Table_Func  load_gpos;
     TT_Load_Table_Func  load_gasp;
     TT_Load_Table_Func  load_pclt;
 
@@ -944,6 +945,8 @@ FT_BEGIN_HEADER
 
     /* new elements introduced after version 2.1.10 */
 
+    TT_Face_GetKerningFunc  get_gpos_kerning;
+
     /* load the font directory, i.e., the offset table and */
     /* the table directory                                 */
     TT_Load_Table_Func    load_font_dir;
@@ -1002,6 +1005,7 @@ FT_BEGIN_HEADER
           load_name_,                    \
           free_name_,                    \
           load_kern_,                    \
+          load_gpos_,                    \
           load_gasp_,                    \
           load_pclt_,                    \
           load_bhed_,                    \
@@ -1009,6 +1013,7 @@ FT_BEGIN_HEADER
           get_psname_,                   \
           free_psnames_,                 \
           get_kerning_,                  \
+          get_gpos_kerning_,             \
           load_font_dir_,                \
           load_hmtx_,                    \
           load_eblc_,                    \
@@ -1050,6 +1055,7 @@ FT_BEGIN_HEADER
     load_name_,                          \
     free_name_,                          \
     load_kern_,                          \
+    load_gpos_,                          \
     load_gasp_,                          \
     load_pclt_,                          \
     load_bhed_,                          \
@@ -1057,6 +1063,7 @@ FT_BEGIN_HEADER
     get_psname_,                         \
     free_psnames_,                       \
     get_kerning_,                        \
+    get_gpos_kerning_,                   \
     load_font_dir_,                      \
     load_hmtx_,                          \
     load_eblc_,                          \
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/svginterface.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/svginterface.h
index f464b2c0583a..68c99efb10ab 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/svginterface.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/svginterface.h
@@ -4,7 +4,7 @@
  *
  *   Interface of ot-svg module (specification only).
  *
- * Copyright (C) 2022-2023 by
+ * Copyright (C) 2022-2024 by
  * David Turner, Robert Wilhelm, Werner Lemberg, and Moazin Khatti.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/t1types.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/t1types.h
index b9c94398fd15..1821ae5cc839 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/t1types.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/t1types.h
@@ -5,7 +5,7 @@
  *   Basic Type1/Type2 type definitions and interface (specification
  *   only).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -21,7 +21,7 @@
 #define T1TYPES_H_
 
 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -137,6 +137,54 @@ FT_BEGIN_HEADER
   } CID_SubrsRec, *CID_Subrs;
 
 
+  /* this structure is used to store the BlendDesignMap entry for an axis */
+  typedef struct  PS_DesignMap_
+  {
+    FT_Byte    num_points;
+    FT_Long*   design_points;
+    FT_Fixed*  blend_points;
+
+  } PS_DesignMapRec, *PS_DesignMap;
+
+  /* backward compatible definition */
+  typedef PS_DesignMapRec  T1_DesignMap;
+
+
+  typedef struct  PS_BlendRec_
+  {
+    FT_UInt          num_designs;
+    FT_UInt          num_axis;
+
+    FT_String*       axis_names[T1_MAX_MM_AXIS];
+    FT_Fixed*        design_pos[T1_MAX_MM_DESIGNS];
+    PS_DesignMapRec  design_map[T1_MAX_MM_AXIS];
+
+    FT_Fixed*        weight_vector;
+    FT_Fixed*        default_weight_vector;
+
+    PS_FontInfo      font_infos[T1_MAX_MM_DESIGNS + 1];
+    PS_Private       privates  [T1_MAX_MM_DESIGNS + 1];
+
+    FT_ULong         blend_bitflags;
+
+    FT_BBox*         bboxes    [T1_MAX_MM_DESIGNS + 1];
+
+    /* since 2.3.0 */
+
+    /* undocumented, optional: the default design instance;   */
+    /* corresponds to default_weight_vector --                */
+    /* num_default_design_vector == 0 means it is not present */
+    /* in the font and associated metrics files               */
+    FT_UInt          default_design_vector[T1_MAX_MM_DESIGNS];
+    FT_UInt          num_default_design_vector;
+
+  } PS_BlendRec, *PS_Blend;
+
+
+  /* backward compatible definition */
+  typedef PS_BlendRec  T1_Blend;
+
+
   /*************************************************************************/
   /*************************************************************************/
   /*************************************************************************/
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/tttypes.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/tttypes.h
index b9788c7831ec..7053e656a7e5 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/tttypes.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/tttypes.h
@@ -5,7 +5,7 @@
  *   Basic SFNT/TrueType type definitions and interface (specification
  *   only).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -24,6 +24,7 @@
 #include 
 #include 
 #include 
+#include "freetype/fttypes.h"
 
 #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
 #include 
@@ -1581,6 +1582,11 @@ FT_BEGIN_HEADER
     FT_UInt32             kern_avail_bits;
     FT_UInt32             kern_order_bits;
 
+#ifdef TT_CONFIG_OPTION_GPOS_KERNING
+    FT_Byte*              gpos_table;
+    FT_Bool               gpos_kerning_available;
+#endif
+
 #ifdef TT_CONFIG_OPTION_BDF
     TT_BDFRec             bdf;
 #endif /* TT_CONFIG_OPTION_BDF */
@@ -1649,9 +1655,9 @@ FT_BEGIN_HEADER
   {
     FT_Memory   memory;
     FT_UShort   max_points;
-    FT_Short    max_contours;
+    FT_UShort   max_contours;
     FT_UShort   n_points;    /* number of points in zone    */
-    FT_Short    n_contours;  /* number of contours          */
+    FT_UShort   n_contours;  /* number of contours          */
 
     FT_Vector*  org;         /* original point coordinates  */
     FT_Vector*  cur;         /* current point coordinates   */
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/internal/wofftypes.h b/src/java.desktop/share/native/libfreetype/include/freetype/internal/wofftypes.h
index 0c1d8eeaf8c8..4a169d12f57e 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/internal/wofftypes.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/internal/wofftypes.h
@@ -5,7 +5,7 @@
  *   Basic WOFF/WOFF2 type definitions and interface (specification
  *   only).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/otsvg.h b/src/java.desktop/share/native/libfreetype/include/freetype/otsvg.h
index bfe9a6ab74e4..9d356938cc70 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/otsvg.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/otsvg.h
@@ -4,7 +4,7 @@
  *
  *   Interface for OT-SVG support related things (specification).
  *
- * Copyright (C) 2022-2023 by
+ * Copyright (C) 2022-2024 by
  * David Turner, Robert Wilhelm, Werner Lemberg, and Moazin Khatti.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/t1tables.h b/src/java.desktop/share/native/libfreetype/include/freetype/t1tables.h
index 1aecfbbd902f..fbd558aa34d0 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/t1tables.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/t1tables.h
@@ -5,7 +5,7 @@
  *   Basic Type 1/Type 2 tables definitions and interface (specification
  *   only).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -269,64 +269,6 @@ FT_BEGIN_HEADER
   /* */
 
 
-  /* maximum number of Multiple Masters designs, as defined in the spec */
-#define T1_MAX_MM_DESIGNS     16
-
-  /* maximum number of Multiple Masters axes, as defined in the spec */
-#define T1_MAX_MM_AXIS        4
-
-  /* maximum number of elements in a design map */
-#define T1_MAX_MM_MAP_POINTS  20
-
-
-  /* this structure is used to store the BlendDesignMap entry for an axis */
-  typedef struct  PS_DesignMap_
-  {
-    FT_Byte    num_points;
-    FT_Long*   design_points;
-    FT_Fixed*  blend_points;
-
-  } PS_DesignMapRec, *PS_DesignMap;
-
-  /* backward compatible definition */
-  typedef PS_DesignMapRec  T1_DesignMap;
-
-
-  typedef struct  PS_BlendRec_
-  {
-    FT_UInt          num_designs;
-    FT_UInt          num_axis;
-
-    FT_String*       axis_names[T1_MAX_MM_AXIS];
-    FT_Fixed*        design_pos[T1_MAX_MM_DESIGNS];
-    PS_DesignMapRec  design_map[T1_MAX_MM_AXIS];
-
-    FT_Fixed*        weight_vector;
-    FT_Fixed*        default_weight_vector;
-
-    PS_FontInfo      font_infos[T1_MAX_MM_DESIGNS + 1];
-    PS_Private       privates  [T1_MAX_MM_DESIGNS + 1];
-
-    FT_ULong         blend_bitflags;
-
-    FT_BBox*         bboxes    [T1_MAX_MM_DESIGNS + 1];
-
-    /* since 2.3.0 */
-
-    /* undocumented, optional: the default design instance;   */
-    /* corresponds to default_weight_vector --                */
-    /* num_default_design_vector == 0 means it is not present */
-    /* in the font and associated metrics files               */
-    FT_UInt          default_design_vector[T1_MAX_MM_DESIGNS];
-    FT_UInt          num_default_design_vector;
-
-  } PS_BlendRec, *PS_Blend;
-
-
-  /* backward compatible definition */
-  typedef PS_BlendRec  T1_Blend;
-
-
   /**************************************************************************
    *
    * @struct:
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/ttnameid.h b/src/java.desktop/share/native/libfreetype/include/freetype/ttnameid.h
index e31c68b9baf3..d5d470e380f4 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/ttnameid.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/ttnameid.h
@@ -4,7 +4,7 @@
  *
  *   TrueType name ID definitions (specification only).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/tttables.h b/src/java.desktop/share/native/libfreetype/include/freetype/tttables.h
index a9f60e76201b..2cf0ff1bc61e 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/tttables.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/tttables.h
@@ -5,7 +5,7 @@
  *   Basic SFNT/TrueType tables definitions and interface
  *   (specification only).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -838,8 +838,9 @@ FT_BEGIN_HEADER
    *     The target charmap.
    *
    * @return:
-   *   The format of `charmap`.  If `charmap` doesn't belong to an SFNT face,
-   *   return -1.
+   *   The format of `charmap`.  If `charmap` doesn't belong to an SFNT face
+   *   (including the synthetic Unicode charmap sometimes created by
+   *   FreeType), return -1.
    */
   FT_EXPORT( FT_Long )
   FT_Get_CMap_Format( FT_CharMap  charmap );
diff --git a/src/java.desktop/share/native/libfreetype/include/freetype/tttags.h b/src/java.desktop/share/native/libfreetype/include/freetype/tttags.h
index 9bf4fca23fb3..da0af5d3f235 100644
--- a/src/java.desktop/share/native/libfreetype/include/freetype/tttags.h
+++ b/src/java.desktop/share/native/libfreetype/include/freetype/tttags.h
@@ -4,7 +4,7 @@
  *
  *   Tags for TrueType and OpenType tables (specification only).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/include/ft2build.h b/src/java.desktop/share/native/libfreetype/include/ft2build.h
index 58491ceea1fb..d3d7685039c4 100644
--- a/src/java.desktop/share/native/libfreetype/include/ft2build.h
+++ b/src/java.desktop/share/native/libfreetype/include/ft2build.h
@@ -4,7 +4,7 @@
  *
  *   FreeType 2 build and setup macros.
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/autofit/afblue.c b/src/java.desktop/share/native/libfreetype/src/autofit/afblue.c
index d7655b9b99e1..ea83969cdc97 100644
--- a/src/java.desktop/share/native/libfreetype/src/autofit/afblue.c
+++ b/src/java.desktop/share/native/libfreetype/src/autofit/afblue.c
@@ -7,7 +7,7 @@
  *
  *   Auto-fitter data for blue strings (body).
  *
- * Copyright (C) 2013-2023 by
+ * Copyright (C) 2013-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/autofit/afblue.cin b/src/java.desktop/share/native/libfreetype/src/autofit/afblue.cin
index d561c5093b78..d2270fac7443 100644
--- a/src/java.desktop/share/native/libfreetype/src/autofit/afblue.cin
+++ b/src/java.desktop/share/native/libfreetype/src/autofit/afblue.cin
@@ -4,7 +4,7 @@
  *
  *   Auto-fitter data for blue strings (body).
  *
- * Copyright (C) 2013-2023 by
+ * Copyright (C) 2013-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/autofit/afblue.dat b/src/java.desktop/share/native/libfreetype/src/autofit/afblue.dat
index 8299baa2591d..88bab2632abe 100644
--- a/src/java.desktop/share/native/libfreetype/src/autofit/afblue.dat
+++ b/src/java.desktop/share/native/libfreetype/src/autofit/afblue.dat
@@ -2,7 +2,7 @@
 //
 //   Auto-fitter data for blue strings.
 //
-// Copyright (C) 2013-2023 by
+// Copyright (C) 2013-2024 by
 // David Turner, Robert Wilhelm, and Werner Lemberg.
 //
 // This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/autofit/afblue.h b/src/java.desktop/share/native/libfreetype/src/autofit/afblue.h
index 76f2f47cb008..2aa9d0984ef7 100644
--- a/src/java.desktop/share/native/libfreetype/src/autofit/afblue.h
+++ b/src/java.desktop/share/native/libfreetype/src/autofit/afblue.h
@@ -7,7 +7,7 @@
  *
  *   Auto-fitter data for blue strings (specification).
  *
- * Copyright (C) 2013-2023 by
+ * Copyright (C) 2013-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/autofit/afblue.hin b/src/java.desktop/share/native/libfreetype/src/autofit/afblue.hin
index 6a31298e65fd..38031505a85b 100644
--- a/src/java.desktop/share/native/libfreetype/src/autofit/afblue.hin
+++ b/src/java.desktop/share/native/libfreetype/src/autofit/afblue.hin
@@ -4,7 +4,7 @@
  *
  *   Auto-fitter data for blue strings (specification).
  *
- * Copyright (C) 2013-2023 by
+ * Copyright (C) 2013-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/autofit/afcjk.c b/src/java.desktop/share/native/libfreetype/src/autofit/afcjk.c
index f414289adcd2..869b60487c21 100644
--- a/src/java.desktop/share/native/libfreetype/src/autofit/afcjk.c
+++ b/src/java.desktop/share/native/libfreetype/src/autofit/afcjk.c
@@ -4,7 +4,7 @@
  *
  *   Auto-fitter hinting routines for CJK writing system (body).
  *
- * Copyright (C) 2006-2023 by
+ * Copyright (C) 2006-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/autofit/afcjk.h b/src/java.desktop/share/native/libfreetype/src/autofit/afcjk.h
index f380ef6e0321..bc5aaf12e6ee 100644
--- a/src/java.desktop/share/native/libfreetype/src/autofit/afcjk.h
+++ b/src/java.desktop/share/native/libfreetype/src/autofit/afcjk.h
@@ -4,7 +4,7 @@
  *
  *   Auto-fitter hinting routines for CJK writing system (specification).
  *
- * Copyright (C) 2006-2023 by
+ * Copyright (C) 2006-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -84,7 +84,7 @@ FT_BEGIN_HEADER
     /* used for horizontal metrics too for CJK */
     FT_Bool        control_overshoot;
     FT_UInt        blue_count;
-    AF_CJKBlueRec  blues[AF_BLUE_STRINGSET_MAX];
+    AF_CJKBlueRec  blues[AF_BLUE_STRINGSET_MAX_LEN];
 
     FT_Fixed       org_scale;
     FT_Pos         org_delta;
diff --git a/src/java.desktop/share/native/libfreetype/src/autofit/afcover.h b/src/java.desktop/share/native/libfreetype/src/autofit/afcover.h
index 102ed4278287..7980cf2e9796 100644
--- a/src/java.desktop/share/native/libfreetype/src/autofit/afcover.h
+++ b/src/java.desktop/share/native/libfreetype/src/autofit/afcover.h
@@ -4,7 +4,7 @@
  *
  *   Auto-fitter coverages (specification only).
  *
- * Copyright (C) 2013-2023 by
+ * Copyright (C) 2013-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/autofit/afdummy.c b/src/java.desktop/share/native/libfreetype/src/autofit/afdummy.c
index a4629b528dc6..ad667d2edc79 100644
--- a/src/java.desktop/share/native/libfreetype/src/autofit/afdummy.c
+++ b/src/java.desktop/share/native/libfreetype/src/autofit/afdummy.c
@@ -5,7 +5,7 @@
  *   Auto-fitter dummy routines to be used if no hinting should be
  *   performed (body).
  *
- * Copyright (C) 2003-2023 by
+ * Copyright (C) 2003-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/autofit/afdummy.h b/src/java.desktop/share/native/libfreetype/src/autofit/afdummy.h
index a7af3f62c9ec..613c2f88a389 100644
--- a/src/java.desktop/share/native/libfreetype/src/autofit/afdummy.h
+++ b/src/java.desktop/share/native/libfreetype/src/autofit/afdummy.h
@@ -5,7 +5,7 @@
  *   Auto-fitter dummy routines to be used if no hinting should be
  *   performed (specification).
  *
- * Copyright (C) 2003-2023 by
+ * Copyright (C) 2003-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/autofit/aferrors.h b/src/java.desktop/share/native/libfreetype/src/autofit/aferrors.h
index 88faf05c9500..ae584ff06db6 100644
--- a/src/java.desktop/share/native/libfreetype/src/autofit/aferrors.h
+++ b/src/java.desktop/share/native/libfreetype/src/autofit/aferrors.h
@@ -4,7 +4,7 @@
  *
  *   Autofitter error codes (specification only).
  *
- * Copyright (C) 2005-2023 by
+ * Copyright (C) 2005-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/autofit/afglobal.c b/src/java.desktop/share/native/libfreetype/src/autofit/afglobal.c
index b1957570f03b..b7403fa65e1b 100644
--- a/src/java.desktop/share/native/libfreetype/src/autofit/afglobal.c
+++ b/src/java.desktop/share/native/libfreetype/src/autofit/afglobal.c
@@ -4,7 +4,7 @@
  *
  *   Auto-fitter routines to compute global hinting values (body).
  *
- * Copyright (C) 2003-2023 by
+ * Copyright (C) 2003-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/autofit/afglobal.h b/src/java.desktop/share/native/libfreetype/src/autofit/afglobal.h
index 66170e419ddc..ddb54c89b276 100644
--- a/src/java.desktop/share/native/libfreetype/src/autofit/afglobal.h
+++ b/src/java.desktop/share/native/libfreetype/src/autofit/afglobal.h
@@ -5,7 +5,7 @@
  *   Auto-fitter routines to compute global hinting values
  *   (specification).
  *
- * Copyright (C) 2003-2023 by
+ * Copyright (C) 2003-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/autofit/afhints.c b/src/java.desktop/share/native/libfreetype/src/autofit/afhints.c
index e4a378fbf74c..96ffe343aa44 100644
--- a/src/java.desktop/share/native/libfreetype/src/autofit/afhints.c
+++ b/src/java.desktop/share/native/libfreetype/src/autofit/afhints.c
@@ -4,7 +4,7 @@
  *
  *   Auto-fitter hinting routines (body).
  *
- * Copyright (C) 2003-2023 by
+ * Copyright (C) 2003-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -979,8 +979,8 @@
       /* compute coordinates & Bezier flags, next and prev */
       {
         FT_Vector*  vec           = outline->points;
-        char*       tag           = outline->tags;
-        FT_Short    endpoint      = outline->contours[0];
+        FT_Byte*    tag           = outline->tags;
+        FT_UShort   endpoint      = outline->contours[0];
         AF_Point    end           = points + endpoint;
         AF_Point    prev          = end;
         FT_Int      contour_index = 0;
@@ -1046,16 +1046,16 @@
 
       /* set up the contours array */
       {
-        AF_Point*  contour       = hints->contours;
-        AF_Point*  contour_limit = contour + hints->num_contours;
-        short*     end           = outline->contours;
-        short      idx           = 0;
+        AF_Point*   contour       = hints->contours;
+        AF_Point*   contour_limit = contour + hints->num_contours;
+        FT_UShort*  end           = outline->contours;
+        FT_Int      idx           = 0;
 
 
         for ( ; contour < contour_limit; contour++, end++ )
         {
           contour[0] = points + idx;
-          idx        = (short)( end[0] + 1 );
+          idx        = *end + 1;
         }
       }
 
@@ -1292,7 +1292,7 @@
     AF_Point    point = hints->points;
     AF_Point    limit = point + hints->num_points;
     FT_Vector*  vec   = outline->points;
-    char*       tag   = outline->tags;
+    FT_Byte*    tag   = outline->tags;
 
 
     for ( ; point < limit; point++, vec++, tag++ )
diff --git a/src/java.desktop/share/native/libfreetype/src/autofit/afhints.h b/src/java.desktop/share/native/libfreetype/src/autofit/afhints.h
index d1cf9529bf12..76fe83006a52 100644
--- a/src/java.desktop/share/native/libfreetype/src/autofit/afhints.h
+++ b/src/java.desktop/share/native/libfreetype/src/autofit/afhints.h
@@ -4,7 +4,7 @@
  *
  *   Auto-fitter hinting routines (specification).
  *
- * Copyright (C) 2003-2023 by
+ * Copyright (C) 2003-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/autofit/afindic.c b/src/java.desktop/share/native/libfreetype/src/autofit/afindic.c
index 7fb12c63d5a3..c6d23efd86f5 100644
--- a/src/java.desktop/share/native/libfreetype/src/autofit/afindic.c
+++ b/src/java.desktop/share/native/libfreetype/src/autofit/afindic.c
@@ -4,7 +4,7 @@
  *
  *   Auto-fitter hinting routines for Indic writing system (body).
  *
- * Copyright (C) 2007-2023 by
+ * Copyright (C) 2007-2024 by
  * Rahul Bhalerao , .
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/autofit/afindic.h b/src/java.desktop/share/native/libfreetype/src/autofit/afindic.h
index 3eb67f63b001..a7f73f25153a 100644
--- a/src/java.desktop/share/native/libfreetype/src/autofit/afindic.h
+++ b/src/java.desktop/share/native/libfreetype/src/autofit/afindic.h
@@ -5,7 +5,7 @@
  *   Auto-fitter hinting routines for Indic writing system
  *   (specification).
  *
- * Copyright (C) 2007-2023 by
+ * Copyright (C) 2007-2024 by
  * Rahul Bhalerao , .
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/autofit/aflatin.c b/src/java.desktop/share/native/libfreetype/src/autofit/aflatin.c
index b86367aa94dc..89287f7ea5a6 100644
--- a/src/java.desktop/share/native/libfreetype/src/autofit/aflatin.c
+++ b/src/java.desktop/share/native/libfreetype/src/autofit/aflatin.c
@@ -4,7 +4,7 @@
  *
  *   Auto-fitter hinting routines for latin writing system (body).
  *
- * Copyright (C) 2003-2023 by
+ * Copyright (C) 2003-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -981,7 +981,7 @@
       /* `ref' and `shoot' values of two blue zones must not overlap */
 
       FT_UInt       i;
-      AF_LatinBlue  blue_sorted[AF_BLUE_STRINGSET_MAX_LEN + 2];
+      AF_LatinBlue  blue_sorted[AF_BLUE_STRINGSET_MAX_LEN];
 
 
       for ( i = 0; i < axis->blue_count; i++ )
@@ -1263,10 +1263,9 @@
               max_height = FT_MAX( max_height, -Axis->blues[nn].descender );
             }
 
-            dist  = FT_ABS( FT_MulFix( max_height, new_scale - scale ) );
-            dist &= ~127;
+            dist  = FT_MulFix( max_height, new_scale - scale );
 
-            if ( dist == 0 )
+            if ( -128 < dist && dist < 128 )
             {
               FT_TRACE5(( "af_latin_metrics_scale_dim:"
                           " x height alignment (style `%s'):\n",
diff --git a/src/java.desktop/share/native/libfreetype/src/autofit/aflatin.h b/src/java.desktop/share/native/libfreetype/src/autofit/aflatin.h
index 31aa91d3bdb0..54e506150214 100644
--- a/src/java.desktop/share/native/libfreetype/src/autofit/aflatin.h
+++ b/src/java.desktop/share/native/libfreetype/src/autofit/aflatin.h
@@ -5,7 +5,7 @@
  *   Auto-fitter hinting routines for latin writing system
  *   (specification).
  *
- * Copyright (C) 2003-2023 by
+ * Copyright (C) 2003-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -98,7 +98,7 @@ FT_BEGIN_HEADER
 
     /* ignored for horizontal metrics */
     FT_UInt          blue_count;
-    AF_LatinBlueRec  blues[AF_BLUE_STRINGSET_MAX];
+    AF_LatinBlueRec  blues[AF_BLUE_STRINGSET_MAX_LEN];
 
     FT_Fixed         org_scale;
     FT_Pos           org_delta;
diff --git a/src/java.desktop/share/native/libfreetype/src/autofit/afloader.c b/src/java.desktop/share/native/libfreetype/src/autofit/afloader.c
index 7c47d562af66..af1d59a68969 100644
--- a/src/java.desktop/share/native/libfreetype/src/autofit/afloader.c
+++ b/src/java.desktop/share/native/libfreetype/src/autofit/afloader.c
@@ -4,7 +4,7 @@
  *
  *   Auto-fitter glyph loading routines (body).
  *
- * Copyright (C) 2003-2023 by
+ * Copyright (C) 2003-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/autofit/afloader.h b/src/java.desktop/share/native/libfreetype/src/autofit/afloader.h
index e4e197e374fd..99f0e15f92b6 100644
--- a/src/java.desktop/share/native/libfreetype/src/autofit/afloader.h
+++ b/src/java.desktop/share/native/libfreetype/src/autofit/afloader.h
@@ -4,7 +4,7 @@
  *
  *   Auto-fitter glyph loading routines (specification).
  *
- * Copyright (C) 2003-2023 by
+ * Copyright (C) 2003-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/autofit/afmodule.c b/src/java.desktop/share/native/libfreetype/src/autofit/afmodule.c
index 20a6b96bc4ff..726f6ca2b78b 100644
--- a/src/java.desktop/share/native/libfreetype/src/autofit/afmodule.c
+++ b/src/java.desktop/share/native/libfreetype/src/autofit/afmodule.c
@@ -4,7 +4,7 @@
  *
  *   Auto-fitter module implementation (body).
  *
- * Copyright (C) 2003-2023 by
+ * Copyright (C) 2003-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -438,7 +438,7 @@
     AF_Module  module = (AF_Module)module_;
 
     FT_Error   error  = FT_Err_Ok;
-    FT_Memory  memory = module->root.library->memory;
+    FT_Memory  memory = module->root.memory;
 
 #ifdef FT_DEBUG_AUTOFIT
 
diff --git a/src/java.desktop/share/native/libfreetype/src/autofit/afmodule.h b/src/java.desktop/share/native/libfreetype/src/autofit/afmodule.h
index 4b8b4562c67c..91a1abfef1fd 100644
--- a/src/java.desktop/share/native/libfreetype/src/autofit/afmodule.h
+++ b/src/java.desktop/share/native/libfreetype/src/autofit/afmodule.h
@@ -4,7 +4,7 @@
  *
  *   Auto-fitter module implementation (specification).
  *
- * Copyright (C) 2003-2023 by
+ * Copyright (C) 2003-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/autofit/afranges.c b/src/java.desktop/share/native/libfreetype/src/autofit/afranges.c
index cfcaf340a79e..007b43281898 100644
--- a/src/java.desktop/share/native/libfreetype/src/autofit/afranges.c
+++ b/src/java.desktop/share/native/libfreetype/src/autofit/afranges.c
@@ -4,7 +4,7 @@
  *
  *   Auto-fitter Unicode script ranges (body).
  *
- * Copyright (C) 2013-2023 by
+ * Copyright (C) 2013-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/autofit/afranges.h b/src/java.desktop/share/native/libfreetype/src/autofit/afranges.h
index 5775738bc0bb..813b3ee78ef6 100644
--- a/src/java.desktop/share/native/libfreetype/src/autofit/afranges.h
+++ b/src/java.desktop/share/native/libfreetype/src/autofit/afranges.h
@@ -4,7 +4,7 @@
  *
  *   Auto-fitter Unicode script ranges (specification).
  *
- * Copyright (C) 2013-2023 by
+ * Copyright (C) 2013-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/autofit/afscript.h b/src/java.desktop/share/native/libfreetype/src/autofit/afscript.h
index 3a101937d703..0a83d771501f 100644
--- a/src/java.desktop/share/native/libfreetype/src/autofit/afscript.h
+++ b/src/java.desktop/share/native/libfreetype/src/autofit/afscript.h
@@ -4,7 +4,7 @@
  *
  *   Auto-fitter scripts (specification only).
  *
- * Copyright (C) 2013-2023 by
+ * Copyright (C) 2013-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/autofit/afshaper.c b/src/java.desktop/share/native/libfreetype/src/autofit/afshaper.c
index abc6f1d292d4..df0f46ada898 100644
--- a/src/java.desktop/share/native/libfreetype/src/autofit/afshaper.c
+++ b/src/java.desktop/share/native/libfreetype/src/autofit/afshaper.c
@@ -4,7 +4,7 @@
  *
  *   HarfBuzz interface for accessing OpenType features (body).
  *
- * Copyright (C) 2013-2023 by
+ * Copyright (C) 2013-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/autofit/afshaper.h b/src/java.desktop/share/native/libfreetype/src/autofit/afshaper.h
index 054a18ffbc2d..2eb03bb5d988 100644
--- a/src/java.desktop/share/native/libfreetype/src/autofit/afshaper.h
+++ b/src/java.desktop/share/native/libfreetype/src/autofit/afshaper.h
@@ -4,7 +4,7 @@
  *
  *   HarfBuzz interface for accessing OpenType features (specification).
  *
- * Copyright (C) 2013-2023 by
+ * Copyright (C) 2013-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/autofit/afstyles.h b/src/java.desktop/share/native/libfreetype/src/autofit/afstyles.h
index 73ebef01716c..7a33f37a8568 100644
--- a/src/java.desktop/share/native/libfreetype/src/autofit/afstyles.h
+++ b/src/java.desktop/share/native/libfreetype/src/autofit/afstyles.h
@@ -4,7 +4,7 @@
  *
  *   Auto-fitter styles (specification only).
  *
- * Copyright (C) 2013-2023 by
+ * Copyright (C) 2013-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/autofit/aftypes.h b/src/java.desktop/share/native/libfreetype/src/autofit/aftypes.h
index 661519449653..27e4185e9f85 100644
--- a/src/java.desktop/share/native/libfreetype/src/autofit/aftypes.h
+++ b/src/java.desktop/share/native/libfreetype/src/autofit/aftypes.h
@@ -4,7 +4,7 @@
  *
  *   Auto-fitter types (specification only).
  *
- * Copyright (C) 2003-2023 by
+ * Copyright (C) 2003-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/autofit/afws-decl.h b/src/java.desktop/share/native/libfreetype/src/autofit/afws-decl.h
index 48c888afed88..b78745af74e9 100644
--- a/src/java.desktop/share/native/libfreetype/src/autofit/afws-decl.h
+++ b/src/java.desktop/share/native/libfreetype/src/autofit/afws-decl.h
@@ -4,7 +4,7 @@
  *
  *   Auto-fitter writing system declarations (specification only).
  *
- * Copyright (C) 2013-2023 by
+ * Copyright (C) 2013-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/autofit/afws-iter.h b/src/java.desktop/share/native/libfreetype/src/autofit/afws-iter.h
index a0a686f8cee7..c86d609a3523 100644
--- a/src/java.desktop/share/native/libfreetype/src/autofit/afws-iter.h
+++ b/src/java.desktop/share/native/libfreetype/src/autofit/afws-iter.h
@@ -4,7 +4,7 @@
  *
  *   Auto-fitter writing systems iterator (specification only).
  *
- * Copyright (C) 2013-2023 by
+ * Copyright (C) 2013-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/base/ftadvanc.c b/src/java.desktop/share/native/libfreetype/src/base/ftadvanc.c
index de25476fe928..717f7d08b354 100644
--- a/src/java.desktop/share/native/libfreetype/src/base/ftadvanc.c
+++ b/src/java.desktop/share/native/libfreetype/src/base/ftadvanc.c
@@ -4,7 +4,7 @@
  *
  *   Quick computation of advance widths (body).
  *
- * Copyright (C) 2008-2023 by
+ * Copyright (C) 2008-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/base/ftbase.h b/src/java.desktop/share/native/libfreetype/src/base/ftbase.h
index 00790d3b226f..1d98b26dd510 100644
--- a/src/java.desktop/share/native/libfreetype/src/base/ftbase.h
+++ b/src/java.desktop/share/native/libfreetype/src/base/ftbase.h
@@ -4,7 +4,7 @@
  *
  *   Private functions used in the `base' module (specification).
  *
- * Copyright (C) 2008-2023 by
+ * Copyright (C) 2008-2024 by
  * David Turner, Robert Wilhelm, Werner Lemberg, and suzuki toshiya.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/base/ftbbox.c b/src/java.desktop/share/native/libfreetype/src/base/ftbbox.c
index 385fea404010..d6aa5d56df87 100644
--- a/src/java.desktop/share/native/libfreetype/src/base/ftbbox.c
+++ b/src/java.desktop/share/native/libfreetype/src/base/ftbbox.c
@@ -4,7 +4,7 @@
  *
  *   FreeType bbox computation (body).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used
@@ -489,7 +489,7 @@
       return FT_THROW( Invalid_Outline );
 
     /* if outline is empty, return (0,0,0,0) */
-    if ( outline->n_points == 0 || outline->n_contours <= 0 )
+    if ( outline->n_points == 0 || outline->n_contours == 0 )
     {
       abbox->xMin = abbox->xMax = 0;
       abbox->yMin = abbox->yMax = 0;
diff --git a/src/java.desktop/share/native/libfreetype/src/base/ftbitmap.c b/src/java.desktop/share/native/libfreetype/src/base/ftbitmap.c
index 1c93648dcbc8..4be145679fd5 100644
--- a/src/java.desktop/share/native/libfreetype/src/base/ftbitmap.c
+++ b/src/java.desktop/share/native/libfreetype/src/base/ftbitmap.c
@@ -4,7 +4,7 @@
  *
  *   FreeType utility functions for bitmaps (body).
  *
- * Copyright (C) 2004-2023 by
+ * Copyright (C) 2004-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/base/ftcalc.c b/src/java.desktop/share/native/libfreetype/src/base/ftcalc.c
index c5bc7e3b14ee..92de09ed8770 100644
--- a/src/java.desktop/share/native/libfreetype/src/base/ftcalc.c
+++ b/src/java.desktop/share/native/libfreetype/src/base/ftcalc.c
@@ -4,7 +4,7 @@
  *
  *   Arithmetic computations (body).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -69,13 +69,15 @@
 
   /* transfer sign, leaving a positive number;                        */
   /* we need an unsigned value to safely negate INT_MIN (or LONG_MIN) */
-#define FT_MOVE_SIGN( x, x_unsigned, s ) \
-  FT_BEGIN_STMNT                         \
-    if ( x < 0 )                         \
-    {                                    \
-      x_unsigned = 0U - (x_unsigned);    \
-      s          = -s;                   \
-    }                                    \
+#define FT_MOVE_SIGN( utype, x, x_unsigned, s ) \
+  FT_BEGIN_STMNT                                \
+    if ( x < 0 )                                \
+    {                                           \
+      x_unsigned = 0U - (utype)x;               \
+      s          = -s;                          \
+    }                                           \
+    else                                        \
+      x_unsigned = (utype)x;                    \
   FT_END_STMNT
 
   /* The following three functions are available regardless of whether */
@@ -179,13 +181,9 @@
     FT_Long    d_;
 
 
-    a = (FT_UInt64)a_;
-    b = (FT_UInt64)b_;
-    c = (FT_UInt64)c_;
-
-    FT_MOVE_SIGN( a_, a, s );
-    FT_MOVE_SIGN( b_, b, s );
-    FT_MOVE_SIGN( c_, c, s );
+    FT_MOVE_SIGN( FT_UInt64, a_, a, s );
+    FT_MOVE_SIGN( FT_UInt64, b_, b, s );
+    FT_MOVE_SIGN( FT_UInt64, c_, c, s );
 
     d = c > 0 ? ( a * b + ( c >> 1 ) ) / c
               : 0x7FFFFFFFUL;
@@ -208,13 +206,9 @@
     FT_Long    d_;
 
 
-    a = (FT_UInt64)a_;
-    b = (FT_UInt64)b_;
-    c = (FT_UInt64)c_;
-
-    FT_MOVE_SIGN( a_, a, s );
-    FT_MOVE_SIGN( b_, b, s );
-    FT_MOVE_SIGN( c_, c, s );
+    FT_MOVE_SIGN( FT_UInt64, a_, a, s );
+    FT_MOVE_SIGN( FT_UInt64, b_, b, s );
+    FT_MOVE_SIGN( FT_UInt64, c_, c, s );
 
     d = c > 0 ? a * b / c
               : 0x7FFFFFFFUL;
@@ -257,11 +251,8 @@
     FT_Long    q_;
 
 
-    a = (FT_UInt64)a_;
-    b = (FT_UInt64)b_;
-
-    FT_MOVE_SIGN( a_, a, s );
-    FT_MOVE_SIGN( b_, b, s );
+    FT_MOVE_SIGN( FT_UInt64, a_, a, s );
+    FT_MOVE_SIGN( FT_UInt64, b_, b, s );
 
     q = b > 0 ? ( ( a << 16 ) + ( b >> 1 ) ) / b
               : 0x7FFFFFFFUL;
@@ -422,13 +413,9 @@
 
     /* XXX: this function does not allow 64-bit arguments */
 
-    a = (FT_UInt32)a_;
-    b = (FT_UInt32)b_;
-    c = (FT_UInt32)c_;
-
-    FT_MOVE_SIGN( a_, a, s );
-    FT_MOVE_SIGN( b_, b, s );
-    FT_MOVE_SIGN( c_, c, s );
+    FT_MOVE_SIGN( FT_UInt32, a_, a, s );
+    FT_MOVE_SIGN( FT_UInt32, b_, b, s );
+    FT_MOVE_SIGN( FT_UInt32, c_, c, s );
 
     if ( c == 0 )
       a = 0x7FFFFFFFUL;
@@ -470,13 +457,9 @@
 
     /* XXX: this function does not allow 64-bit arguments */
 
-    a = (FT_UInt32)a_;
-    b = (FT_UInt32)b_;
-    c = (FT_UInt32)c_;
-
-    FT_MOVE_SIGN( a_, a, s );
-    FT_MOVE_SIGN( b_, b, s );
-    FT_MOVE_SIGN( c_, c, s );
+    FT_MOVE_SIGN( FT_UInt32, a_, a, s );
+    FT_MOVE_SIGN( FT_UInt32, b_, b, s );
+    FT_MOVE_SIGN( FT_UInt32, c_, c, s );
 
     if ( c == 0 )
       a = 0x7FFFFFFFUL;
@@ -575,11 +558,8 @@
 
     /* XXX: this function does not allow 64-bit arguments */
 
-    a = (FT_UInt32)a_;
-    b = (FT_UInt32)b_;
-
-    FT_MOVE_SIGN( a_, a, s );
-    FT_MOVE_SIGN( b_, b, s );
+    FT_MOVE_SIGN( FT_UInt32, a_, a, s );
+    FT_MOVE_SIGN( FT_UInt32, b_, b, s );
 
     if ( a + ( b >> 8 ) <= 8190UL )
       a = ( a * b + 0x8000UL ) >> 16;
@@ -614,11 +594,8 @@
 
     /* XXX: this function does not allow 64-bit arguments */
 
-    a = (FT_UInt32)a_;
-    b = (FT_UInt32)b_;
-
-    FT_MOVE_SIGN( a_, a, s );
-    FT_MOVE_SIGN( b_, b, s );
+    FT_MOVE_SIGN( FT_UInt32, a_, a, s );
+    FT_MOVE_SIGN( FT_UInt32, b_, b, s );
 
     if ( b == 0 )
     {
@@ -829,11 +806,8 @@
     FT_Int     sx = 1, sy = 1, shift;
 
 
-    x = (FT_UInt32)x_;
-    y = (FT_UInt32)y_;
-
-    FT_MOVE_SIGN( x_, x, sx );
-    FT_MOVE_SIGN( y_, y, sy );
+    FT_MOVE_SIGN( FT_UInt32, x_, x, sx );
+    FT_MOVE_SIGN( FT_UInt32, y_, y, sy );
 
     /* trivial cases */
     if ( x == 0 )
@@ -913,43 +887,71 @@
   }
 
 
-#if 0
-
   /* documentation is in ftcalc.h */
 
-  FT_BASE_DEF( FT_Int32 )
-  FT_SqrtFixed( FT_Int32  x )
+  FT_BASE_DEF( FT_UInt32 )
+  FT_SqrtFixed( FT_UInt32  v )
   {
-    FT_UInt32  root, rem_hi, rem_lo, test_div;
-    FT_Int     count;
-
+    if ( v == 0 )
+      return 0;
 
-    root = 0;
+#ifndef FT_INT64
 
-    if ( x > 0 )
+    /* Algorithm by Christophe Meessen (1993) with overflow fixed and     */
+    /* rounding added.  Any unsigned fixed 16.16 argument is acceptable.  */
+    /* However, this algorithm is slower than the Babylonian method with  */
+    /* a good initial guess.  We only use it for large 32-bit values when */
+    /* 64-bit computations are not desirable.                             */
+    else if ( v > 0x10000U )
     {
-      rem_hi = 0;
-      rem_lo = (FT_UInt32)x;
-      count  = 24;
+      FT_UInt32  r = v >> 1;
+      FT_UInt32  q = ( v & 1 ) << 15;
+      FT_UInt32  b = 0x20000000;
+      FT_UInt32  t;
+
+
       do
       {
-        rem_hi   = ( rem_hi << 2 ) | ( rem_lo >> 30 );
-        rem_lo <<= 2;
-        root   <<= 1;
-        test_div = ( root << 1 ) + 1;
-
-        if ( rem_hi >= test_div )
+        t = q + b;
+        if ( r >= t )
         {
-          rem_hi -= test_div;
-          root   += 1;
+          r -= t;
+          q  = t + b;  /* equivalent to q += 2*b */
         }
-      } while ( --count );
+        r <<= 1;
+        b >>= 1;
+
+      } while ( b > 0x10 );  /* exactly 25 cycles */
+
+      return ( q + 0x40 ) >> 7;
     }
+    else
+    {
+      FT_UInt32  r = ( v << 16 ) - 1;
 
-    return (FT_Int32)root;
-  }
+#else /* FT_INT64 */
 
-#endif /* 0 */
+    else
+    {
+      FT_UInt64  r = ( (FT_UInt64)v << 16 ) - 1;
+
+#endif /* FT_INT64 */
+
+      FT_UInt32  q = 1 << ( ( 17 + FT_MSB( v ) ) >> 1 );
+      FT_UInt32  t;
+
+
+      /* Babylonian method with rounded-up division */
+      do
+      {
+        t = q;
+        q = ( t + (FT_UInt32)( r / t ) + 1 ) >> 1;
+
+      } while ( q != t );  /* less than 6 cycles */
+
+      return q;
+    }
+  }
 
 
   /* documentation is in ftcalc.h */
@@ -1094,11 +1096,8 @@
       FT_UInt32  factor;
 
 
-      scalar = (FT_UInt32)s[i];
-      factor = (FT_UInt32)f[i];
-
-      FT_MOVE_SIGN( s[i], scalar, sign );
-      FT_MOVE_SIGN( f[i], factor, sign );
+      FT_MOVE_SIGN( FT_UInt32, s[i], scalar, sign );
+      FT_MOVE_SIGN( FT_UInt32, f[i], factor, sign );
 
       ft_multo64( scalar, factor, &multResult );
 
diff --git a/src/java.desktop/share/native/libfreetype/src/base/ftcid.c b/src/java.desktop/share/native/libfreetype/src/base/ftcid.c
index 866cd23e91b5..4f2deb19a053 100644
--- a/src/java.desktop/share/native/libfreetype/src/base/ftcid.c
+++ b/src/java.desktop/share/native/libfreetype/src/base/ftcid.c
@@ -4,7 +4,7 @@
  *
  *   FreeType API for accessing CID font information.
  *
- * Copyright (C) 2007-2023 by
+ * Copyright (C) 2007-2024 by
  * Derek Clegg and Michael Toftdal.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/base/ftcolor.c b/src/java.desktop/share/native/libfreetype/src/base/ftcolor.c
index bcd6e893d4a5..c6bf2a3cd1a4 100644
--- a/src/java.desktop/share/native/libfreetype/src/base/ftcolor.c
+++ b/src/java.desktop/share/native/libfreetype/src/base/ftcolor.c
@@ -4,7 +4,7 @@
  *
  *   FreeType's glyph color management (body).
  *
- * Copyright (C) 2018-2023 by
+ * Copyright (C) 2018-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/base/ftdbgmem.c b/src/java.desktop/share/native/libfreetype/src/base/ftdbgmem.c
index 8fab50dd017e..902a5dc8bbce 100644
--- a/src/java.desktop/share/native/libfreetype/src/base/ftdbgmem.c
+++ b/src/java.desktop/share/native/libfreetype/src/base/ftdbgmem.c
@@ -4,7 +4,7 @@
  *
  *   Memory debugger (body).
  *
- * Copyright (C) 2001-2023 by
+ * Copyright (C) 2001-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/base/ftdebug.c b/src/java.desktop/share/native/libfreetype/src/base/ftdebug.c
index 61c4563b0c43..11307eaace4e 100644
--- a/src/java.desktop/share/native/libfreetype/src/base/ftdebug.c
+++ b/src/java.desktop/share/native/libfreetype/src/base/ftdebug.c
@@ -4,7 +4,7 @@
  *
  *   Debugging and logging component (body).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/base/ftfntfmt.c b/src/java.desktop/share/native/libfreetype/src/base/ftfntfmt.c
index 0b41f7cc83d0..77b4089e7e27 100644
--- a/src/java.desktop/share/native/libfreetype/src/base/ftfntfmt.c
+++ b/src/java.desktop/share/native/libfreetype/src/base/ftfntfmt.c
@@ -4,7 +4,7 @@
  *
  *   FreeType utility file for font formats (body).
  *
- * Copyright (C) 2002-2023 by
+ * Copyright (C) 2002-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/base/ftfstype.c b/src/java.desktop/share/native/libfreetype/src/base/ftfstype.c
index ea24e64c6ea9..1565c3b7e25a 100644
--- a/src/java.desktop/share/native/libfreetype/src/base/ftfstype.c
+++ b/src/java.desktop/share/native/libfreetype/src/base/ftfstype.c
@@ -4,7 +4,7 @@
  *
  *   FreeType utility file to access FSType data (body).
  *
- * Copyright (C) 2008-2023 by
+ * Copyright (C) 2008-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/base/ftgasp.c b/src/java.desktop/share/native/libfreetype/src/base/ftgasp.c
index 29b7b08b787c..c63d30e978c6 100644
--- a/src/java.desktop/share/native/libfreetype/src/base/ftgasp.c
+++ b/src/java.desktop/share/native/libfreetype/src/base/ftgasp.c
@@ -4,7 +4,7 @@
  *
  *   Access of TrueType's `gasp' table (body).
  *
- * Copyright (C) 2007-2023 by
+ * Copyright (C) 2007-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/base/ftgloadr.c b/src/java.desktop/share/native/libfreetype/src/base/ftgloadr.c
index 9823d09e41af..484d98f1722a 100644
--- a/src/java.desktop/share/native/libfreetype/src/base/ftgloadr.c
+++ b/src/java.desktop/share/native/libfreetype/src/base/ftgloadr.c
@@ -4,7 +4,7 @@
  *
  *   The FreeType glyph loader (body).
  *
- * Copyright (C) 2002-2023 by
+ * Copyright (C) 2002-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg
  *
  * This file is part of the FreeType project, and may only be used,
@@ -355,34 +355,25 @@
   FT_BASE_DEF( void )
   FT_GlyphLoader_Add( FT_GlyphLoader  loader )
   {
-    FT_GlyphLoad  base;
-    FT_GlyphLoad  current;
-
-    FT_Int        n_curr_contours;
-    FT_Int        n_base_points;
-    FT_Int        n;
+    FT_Outline*  base;
+    FT_Outline*  current;
+    FT_Int       n;
 
 
     if ( !loader )
       return;
 
-    base    = &loader->base;
-    current = &loader->current;
-
-    n_curr_contours = current->outline.n_contours;
-    n_base_points   = base->outline.n_points;
+    base    = &loader->base.outline;
+    current = &loader->current.outline;
 
-    base->outline.n_points =
-      (short)( base->outline.n_points + current->outline.n_points );
-    base->outline.n_contours =
-      (short)( base->outline.n_contours + current->outline.n_contours );
+    /* adjust contours count in newest outline */
+    for ( n = 0; n < current->n_contours; n++ )
+      current->contours[n] += base->n_points;
 
-    base->num_subglyphs += current->num_subglyphs;
+    base->n_points   += current->n_points;
+    base->n_contours += current->n_contours;
 
-    /* adjust contours count in newest outline */
-    for ( n = 0; n < n_curr_contours; n++ )
-      current->outline.contours[n] =
-        (short)( current->outline.contours[n] + n_base_points );
+    loader->base.num_subglyphs += loader->current.num_subglyphs;
 
     /* prepare for another new glyph image */
     FT_GlyphLoader_Prepare( loader );
diff --git a/src/java.desktop/share/native/libfreetype/src/base/ftglyph.c b/src/java.desktop/share/native/libfreetype/src/base/ftglyph.c
index 393d4949f849..1b5849f99afa 100644
--- a/src/java.desktop/share/native/libfreetype/src/base/ftglyph.c
+++ b/src/java.desktop/share/native/libfreetype/src/base/ftglyph.c
@@ -4,7 +4,7 @@
  *
  *   FreeType convenience functions to handle glyphs (body).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/base/ftinit.c b/src/java.desktop/share/native/libfreetype/src/base/ftinit.c
index c9c71d24bf96..9a6c00e13efa 100644
--- a/src/java.desktop/share/native/libfreetype/src/base/ftinit.c
+++ b/src/java.desktop/share/native/libfreetype/src/base/ftinit.c
@@ -4,7 +4,7 @@
  *
  *   FreeType initialization layer (body).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/base/ftlcdfil.c b/src/java.desktop/share/native/libfreetype/src/base/ftlcdfil.c
index 6c3fd66e0bb1..1e69d4da70f5 100644
--- a/src/java.desktop/share/native/libfreetype/src/base/ftlcdfil.c
+++ b/src/java.desktop/share/native/libfreetype/src/base/ftlcdfil.c
@@ -4,7 +4,7 @@
  *
  *   FreeType API for color filtering of subpixel bitmap glyphs (body).
  *
- * Copyright (C) 2006-2023 by
+ * Copyright (C) 2006-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/base/ftmac.c b/src/java.desktop/share/native/libfreetype/src/base/ftmac.c
index 492d0553845d..e8e35627b50c 100644
--- a/src/java.desktop/share/native/libfreetype/src/base/ftmac.c
+++ b/src/java.desktop/share/native/libfreetype/src/base/ftmac.c
@@ -8,7 +8,7 @@
  * This file is for Mac OS X only; see builds/mac/ftoldmac.c for
  * classic platforms built by MPW.
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * Just van Rossum, David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -812,6 +812,7 @@
     ResourceIndex  res_index;
     Handle         fond;
     short          num_faces_in_res;
+    FT_Long        count;
 
 
     if ( noErr != FT_FSPathMakeRes( pathname, &res_ref ) )
@@ -821,8 +822,10 @@
     if ( ResError() )
       return FT_THROW( Cannot_Open_Resource );
 
+    res_index        = 1;
     num_faces_in_res = 0;
-    for ( res_index = 1; ; res_index++ )
+    count            = face_index;
+    while ( count >= 0 )
     {
       short  num_faces_in_fond;
 
@@ -834,15 +837,21 @@
       num_faces_in_fond  = count_faces( fond, pathname );
       num_faces_in_res  += num_faces_in_fond;
 
-      if ( 0 <= face_index && face_index < num_faces_in_fond && error )
-        error = FT_New_Face_From_FOND( library, fond, face_index, aface );
+      if ( count < num_faces_in_fond )
+        error = FT_New_Face_From_FOND( library, fond, count, aface );
 
-      face_index -= num_faces_in_fond;
+      res_index++;
+      count -= num_faces_in_fond;
     }
 
     CloseResFile( res_ref );
+
     if ( !error && aface && *aface )
-      (*aface)->num_faces = num_faces_in_res;
+    {
+      (*aface)->num_faces  = num_faces_in_res;
+      (*aface)->face_index = face_index;
+    }
+
     return error;
   }
 
diff --git a/src/java.desktop/share/native/libfreetype/src/base/ftmm.c b/src/java.desktop/share/native/libfreetype/src/base/ftmm.c
index 9e2dd7ee79dd..cc4ca22fba3b 100644
--- a/src/java.desktop/share/native/libfreetype/src/base/ftmm.c
+++ b/src/java.desktop/share/native/libfreetype/src/base/ftmm.c
@@ -4,7 +4,7 @@
  *
  *   Multiple Master font support (body).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/base/ftobjs.c b/src/java.desktop/share/native/libfreetype/src/base/ftobjs.c
index 89a25bc732d6..9b97820c379e 100644
--- a/src/java.desktop/share/native/libfreetype/src/base/ftobjs.c
+++ b/src/java.desktop/share/native/libfreetype/src/base/ftobjs.c
@@ -4,7 +4,7 @@
  *
  *   The FreeType private base classes (body).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -2302,7 +2302,10 @@
                                       face_index_internal, aface );
       FT_FREE( data_offsets );
       if ( !error )
-        (*aface)->num_faces = count;
+      {
+        (*aface)->num_faces  = count;
+        (*aface)->face_index = face_index_internal;
+      }
     }
 
     return error;
@@ -5791,7 +5794,7 @@
     ttface = (TT_Face)face;
     sfnt   = (SFNT_Service)ttface->sfnt;
 
-    if ( sfnt->get_colr_layer )
+    if ( sfnt->get_colr_glyph_paint )
       return sfnt->get_colr_glyph_paint( ttface,
                                          base_glyph,
                                          root_transform,
diff --git a/src/java.desktop/share/native/libfreetype/src/base/ftoutln.c b/src/java.desktop/share/native/libfreetype/src/base/ftoutln.c
index 134f39d2b1fa..ef699b3c7cd3 100644
--- a/src/java.desktop/share/native/libfreetype/src/base/ftoutln.c
+++ b/src/java.desktop/share/native/libfreetype/src/base/ftoutln.c
@@ -4,7 +4,7 @@
  *
  *   FreeType outline management (body).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -53,7 +53,7 @@
 
     FT_Vector*  point;
     FT_Vector*  limit;
-    char*       tags;
+    FT_Byte*    tags;
 
     FT_Error    error;
 
@@ -332,8 +332,8 @@
          FT_NEW_ARRAY( anoutline->contours, numContours ) )
       goto Fail;
 
-    anoutline->n_points    = (FT_Short)numPoints;
-    anoutline->n_contours  = (FT_Short)numContours;
+    anoutline->n_points    = (FT_UShort)numPoints;
+    anoutline->n_contours  = (FT_UShort)numContours;
     anoutline->flags      |= FT_OUTLINE_OWNER;
 
     return FT_Err_Ok;
@@ -359,12 +359,14 @@
       FT_Int  n;
 
 
+      FT_TRACE5(( "FT_Outline_Check: contours = %d, points = %d\n",
+                  n_contours, n_points ));
       /* empty glyph? */
       if ( n_points == 0 && n_contours == 0 )
         return FT_Err_Ok;
 
       /* check point and contour counts */
-      if ( n_points <= 0 || n_contours <= 0 )
+      if ( n_points == 0 || n_contours == 0 )
         goto Bad;
 
       end0 = -1;
@@ -576,13 +578,13 @@
 
       /* reverse tags table */
       {
-        char*  p = outline->tags + first;
-        char*  q = outline->tags + last;
+        FT_Byte*  p = outline->tags + first;
+        FT_Byte*  q = outline->tags + last;
 
 
         while ( p < q )
         {
-          char  swap;
+          FT_Byte  swap;
 
 
           swap = *p;
diff --git a/src/java.desktop/share/native/libfreetype/src/base/ftpatent.c b/src/java.desktop/share/native/libfreetype/src/base/ftpatent.c
index cb5efadffb1d..2055757e023c 100644
--- a/src/java.desktop/share/native/libfreetype/src/base/ftpatent.c
+++ b/src/java.desktop/share/native/libfreetype/src/base/ftpatent.c
@@ -5,7 +5,7 @@
  *   FreeType API for checking patented TrueType bytecode instructions
  *   (body).  Obsolete, retained for backward compatibility.
  *
- * Copyright (C) 2007-2023 by
+ * Copyright (C) 2007-2024 by
  * David Turner.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/base/ftpsprop.c b/src/java.desktop/share/native/libfreetype/src/base/ftpsprop.c
index cefdf489d7f6..37a6cee6cc9a 100644
--- a/src/java.desktop/share/native/libfreetype/src/base/ftpsprop.c
+++ b/src/java.desktop/share/native/libfreetype/src/base/ftpsprop.c
@@ -5,7 +5,7 @@
  *   Get and set properties of PostScript drivers (body).
  *   See `ftdriver.h' for available properties.
  *
- * Copyright (C) 2017-2023 by
+ * Copyright (C) 2017-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/base/ftrfork.c b/src/java.desktop/share/native/libfreetype/src/base/ftrfork.c
index 2ab430195f20..dc9b043d8bb5 100644
--- a/src/java.desktop/share/native/libfreetype/src/base/ftrfork.c
+++ b/src/java.desktop/share/native/libfreetype/src/base/ftrfork.c
@@ -4,7 +4,7 @@
  *
  *   Embedded resource forks accessor (body).
  *
- * Copyright (C) 2004-2023 by
+ * Copyright (C) 2004-2024 by
  * Masatake YAMATO and Redhat K.K.
  *
  * FT_Raccess_Get_HeaderInfo() and raccess_guess_darwin_hfsplus() are
diff --git a/src/java.desktop/share/native/libfreetype/src/base/ftsnames.c b/src/java.desktop/share/native/libfreetype/src/base/ftsnames.c
index 1917a3f1dffb..f7231fd61ccd 100644
--- a/src/java.desktop/share/native/libfreetype/src/base/ftsnames.c
+++ b/src/java.desktop/share/native/libfreetype/src/base/ftsnames.c
@@ -7,7 +7,7 @@
  *
  *   This is _not_ used to retrieve glyph names!
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/base/ftstream.c b/src/java.desktop/share/native/libfreetype/src/base/ftstream.c
index 64826acebe52..667222461282 100644
--- a/src/java.desktop/share/native/libfreetype/src/base/ftstream.c
+++ b/src/java.desktop/share/native/libfreetype/src/base/ftstream.c
@@ -4,7 +4,7 @@
  *
  *   I/O stream support (body).
  *
- * Copyright (C) 2000-2023 by
+ * Copyright (C) 2000-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -763,10 +763,10 @@
       case ft_frame_bytes:  /* read a byte sequence */
       case ft_frame_skip:   /* skip some bytes      */
         {
-          FT_UInt  len = fields->size;
+          FT_Offset  len = fields->size;
 
 
-          if ( cursor + len > stream->limit )
+          if ( len > (FT_Offset)( stream->limit - cursor ) )
           {
             error = FT_THROW( Invalid_Stream_Operation );
             goto Exit;
@@ -830,7 +830,7 @@
         goto Exit;
       }
 
-      /* now, compute the signed value is necessary */
+      /* now, compute the signed value if necessary */
       if ( fields->value & FT_FRAME_OP_SIGNED )
         value = (FT_ULong)( (FT_Int32)( value << sign_shift ) >> sign_shift );
 
diff --git a/src/java.desktop/share/native/libfreetype/src/base/ftstroke.c b/src/java.desktop/share/native/libfreetype/src/base/ftstroke.c
index 92f1e43080fd..64f46ce43e76 100644
--- a/src/java.desktop/share/native/libfreetype/src/base/ftstroke.c
+++ b/src/java.desktop/share/native/libfreetype/src/base/ftstroke.c
@@ -4,7 +4,7 @@
  *
  *   FreeType path stroker (body).
  *
- * Copyright (C) 2002-2023 by
+ * Copyright (C) 2002-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -711,7 +711,7 @@
     {
       FT_UInt   count = border->num_points;
       FT_Byte*  read  = border->tags;
-      FT_Byte*  write = (FT_Byte*)outline->tags + outline->n_points;
+      FT_Byte*  write = outline->tags + outline->n_points;
 
 
       for ( ; count > 0; count--, read++, write++ )
@@ -727,10 +727,10 @@
 
     /* copy contours */
     {
-      FT_UInt    count = border->num_points;
-      FT_Byte*   tags  = border->tags;
-      FT_Short*  write = outline->contours + outline->n_contours;
-      FT_Short   idx   = (FT_Short)outline->n_points;
+      FT_UInt     count = border->num_points;
+      FT_Byte*    tags  = border->tags;
+      FT_UShort*  write = outline->contours + outline->n_contours;
+      FT_UShort   idx   = outline->n_points;
 
 
       for ( ; count > 0; count--, tags++, idx++ )
@@ -743,7 +743,7 @@
       }
     }
 
-    outline->n_points += (short)border->num_points;
+    outline->n_points += (FT_UShort)border->num_points;
 
     FT_ASSERT( FT_Outline_Check( outline ) == 0 );
   }
@@ -2050,7 +2050,7 @@
 
     FT_Vector*  point;
     FT_Vector*  limit;
-    char*       tags;
+    FT_Byte*    tags;
 
     FT_Error    error;
 
diff --git a/src/java.desktop/share/native/libfreetype/src/base/ftsynth.c b/src/java.desktop/share/native/libfreetype/src/base/ftsynth.c
index f32edd3388b0..ec05bce33a9a 100644
--- a/src/java.desktop/share/native/libfreetype/src/base/ftsynth.c
+++ b/src/java.desktop/share/native/libfreetype/src/base/ftsynth.c
@@ -4,7 +4,7 @@
  *
  *   FreeType synthesizing code for emboldening and slanting (body).
  *
- * Copyright (C) 2000-2023 by
+ * Copyright (C) 2000-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/base/ftsystem.c b/src/java.desktop/share/native/libfreetype/src/base/ftsystem.c
index 61c99e363571..eee3642334f6 100644
--- a/src/java.desktop/share/native/libfreetype/src/base/ftsystem.c
+++ b/src/java.desktop/share/native/libfreetype/src/base/ftsystem.c
@@ -4,7 +4,7 @@
  *
  *   ANSI-specific FreeType low-level system interface (body).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/base/fttrigon.c b/src/java.desktop/share/native/libfreetype/src/base/fttrigon.c
index 2dd2c3459e5f..4b1aced1cbab 100644
--- a/src/java.desktop/share/native/libfreetype/src/base/fttrigon.c
+++ b/src/java.desktop/share/native/libfreetype/src/base/fttrigon.c
@@ -4,7 +4,7 @@
  *
  *   FreeType trigonometric functions (body).
  *
- * Copyright (C) 2001-2023 by
+ * Copyright (C) 2001-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/base/fttype1.c b/src/java.desktop/share/native/libfreetype/src/base/fttype1.c
index 637c5cf775e6..cedf7c405054 100644
--- a/src/java.desktop/share/native/libfreetype/src/base/fttype1.c
+++ b/src/java.desktop/share/native/libfreetype/src/base/fttype1.c
@@ -4,7 +4,7 @@
  *
  *   FreeType utility file for PS names support (body).
  *
- * Copyright (C) 2002-2023 by
+ * Copyright (C) 2002-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/base/ftutil.c b/src/java.desktop/share/native/libfreetype/src/base/ftutil.c
index 6120846d2ca0..b13512f87042 100644
--- a/src/java.desktop/share/native/libfreetype/src/base/ftutil.c
+++ b/src/java.desktop/share/native/libfreetype/src/base/ftutil.c
@@ -4,7 +4,7 @@
  *
  *   FreeType utility file for memory and list management (body).
  *
- * Copyright (C) 2002-2023 by
+ * Copyright (C) 2002-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/cff/cffcmap.c b/src/java.desktop/share/native/libfreetype/src/cff/cffcmap.c
index 10d287bc81fb..ea5f8ed28851 100644
--- a/src/java.desktop/share/native/libfreetype/src/cff/cffcmap.c
+++ b/src/java.desktop/share/native/libfreetype/src/cff/cffcmap.c
@@ -4,7 +4,7 @@
  *
  *   CFF character mapping table (cmap) support (body).
  *
- * Copyright (C) 2002-2023 by
+ * Copyright (C) 2002-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/cff/cffcmap.h b/src/java.desktop/share/native/libfreetype/src/cff/cffcmap.h
index b2afc2fab622..1dd8700cd8ba 100644
--- a/src/java.desktop/share/native/libfreetype/src/cff/cffcmap.h
+++ b/src/java.desktop/share/native/libfreetype/src/cff/cffcmap.h
@@ -4,7 +4,7 @@
  *
  *   CFF character mapping table (cmap) support (specification).
  *
- * Copyright (C) 2002-2023 by
+ * Copyright (C) 2002-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/cff/cffdrivr.c b/src/java.desktop/share/native/libfreetype/src/cff/cffdrivr.c
index 9898d625ca4e..f6ebdb3810a2 100644
--- a/src/java.desktop/share/native/libfreetype/src/cff/cffdrivr.c
+++ b/src/java.desktop/share/native/libfreetype/src/cff/cffdrivr.c
@@ -4,7 +4,7 @@
  *
  *   OpenType font driver implementation (body).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, Werner Lemberg, and Dominik Röttsches.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/cff/cffdrivr.h b/src/java.desktop/share/native/libfreetype/src/cff/cffdrivr.h
index ab1f147bb2a6..fd5bc37ecd42 100644
--- a/src/java.desktop/share/native/libfreetype/src/cff/cffdrivr.h
+++ b/src/java.desktop/share/native/libfreetype/src/cff/cffdrivr.h
@@ -4,7 +4,7 @@
  *
  *   High-level OpenType driver interface (specification).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/cff/cfferrs.h b/src/java.desktop/share/native/libfreetype/src/cff/cfferrs.h
index bc9a3043fcff..128adc3b716b 100644
--- a/src/java.desktop/share/native/libfreetype/src/cff/cfferrs.h
+++ b/src/java.desktop/share/native/libfreetype/src/cff/cfferrs.h
@@ -4,7 +4,7 @@
  *
  *   CFF error codes (specification only).
  *
- * Copyright (C) 2001-2023 by
+ * Copyright (C) 2001-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/cff/cffgload.c b/src/java.desktop/share/native/libfreetype/src/cff/cffgload.c
index c483d1d1a591..cbb071abdfeb 100644
--- a/src/java.desktop/share/native/libfreetype/src/cff/cffgload.c
+++ b/src/java.desktop/share/native/libfreetype/src/cff/cffgload.c
@@ -4,7 +4,7 @@
  *
  *   OpenType Glyph Loader (body).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/cff/cffgload.h b/src/java.desktop/share/native/libfreetype/src/cff/cffgload.h
index 3b8cf236ddc2..346d4b11c31a 100644
--- a/src/java.desktop/share/native/libfreetype/src/cff/cffgload.h
+++ b/src/java.desktop/share/native/libfreetype/src/cff/cffgload.h
@@ -4,7 +4,7 @@
  *
  *   OpenType Glyph Loader (specification).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/cff/cffload.c b/src/java.desktop/share/native/libfreetype/src/cff/cffload.c
index af79082e98cb..979fd45f6ca8 100644
--- a/src/java.desktop/share/native/libfreetype/src/cff/cffload.c
+++ b/src/java.desktop/share/native/libfreetype/src/cff/cffload.c
@@ -4,7 +4,7 @@
  *
  *   OpenType and CFF data/program tables loader (body).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -1202,17 +1202,21 @@
         {
           CFF_AxisCoords*  axis = ®ion->axisList[j];
 
-          FT_Int16  start14, peak14, end14;
+          FT_Int  start, peak, end;
 
 
-          if ( FT_READ_SHORT( start14 ) ||
-               FT_READ_SHORT( peak14 )  ||
-               FT_READ_SHORT( end14 )   )
+          if ( FT_READ_SHORT( start ) ||
+               FT_READ_SHORT( peak )  ||
+               FT_READ_SHORT( end )   )
             goto Exit;
 
-          axis->startCoord = FT_fdot14ToFixed( start14 );
-          axis->peakCoord  = FT_fdot14ToFixed( peak14 );
-          axis->endCoord   = FT_fdot14ToFixed( end14 );
+          /* immediately tag invalid ranges with special peak = 0 */
+          if ( ( start < 0 && end > 0 ) || start > peak || peak > end )
+            peak = 0;
+
+          axis->startCoord = FT_fdot14ToFixed( start );
+          axis->peakCoord  = FT_fdot14ToFixed( peak );
+          axis->endCoord   = FT_fdot14ToFixed( end );
         }
       }
 
@@ -1379,10 +1383,10 @@
       /* opcode in both CFF and CFF2 DICTs.  See `cff_parse_num' for    */
       /* decode of this, which rounds to an integer.                    */
       *subFont->blend_top++ = 255;
-      *subFont->blend_top++ = (FT_Byte)( sum >> 24 );
-      *subFont->blend_top++ = (FT_Byte)( sum >> 16 );
-      *subFont->blend_top++ = (FT_Byte)( sum >>  8 );
-      *subFont->blend_top++ = (FT_Byte)sum;
+      *subFont->blend_top++ = (FT_Byte)( (FT_UInt32)sum >> 24 );
+      *subFont->blend_top++ = (FT_Byte)( (FT_UInt32)sum >> 16 );
+      *subFont->blend_top++ = (FT_Byte)( (FT_UInt32)sum >>  8 );
+      *subFont->blend_top++ = (FT_Byte)( (FT_UInt32)sum );
     }
 
     /* leave only numBlends results on parser stack */
@@ -1495,44 +1499,31 @@
       for ( j = 0; j < lenNDV; j++ )
       {
         CFF_AxisCoords*  axis = &varRegion->axisList[j];
-        FT_Fixed         axisScalar;
-
-
-        /* compute the scalar contribution of this axis; */
-        /* ignore invalid ranges                         */
-        if ( axis->startCoord > axis->peakCoord ||
-             axis->peakCoord > axis->endCoord   )
-          axisScalar = FT_FIXED_ONE;
 
-        else if ( axis->startCoord < 0 &&
-                  axis->endCoord > 0   &&
-                  axis->peakCoord != 0 )
-          axisScalar = FT_FIXED_ONE;
 
-        /* peak of 0 means ignore this axis */
-        else if ( axis->peakCoord == 0 )
-          axisScalar = FT_FIXED_ONE;
+        /* compute the scalar contribution of this axis */
+        /* with peak of 0 used for invalid axes         */
+        if ( axis->peakCoord == NDV[j] ||
+             axis->peakCoord == 0      )
+          continue;
 
         /* ignore this region if coords are out of range */
-        else if ( NDV[j] < axis->startCoord ||
-                  NDV[j] > axis->endCoord   )
-          axisScalar = 0;
-
-        /* calculate a proportional factor */
-        else
+        else if ( NDV[j] <= axis->startCoord ||
+                  NDV[j] >= axis->endCoord   )
         {
-          if ( NDV[j] == axis->peakCoord )
-            axisScalar = FT_FIXED_ONE;
-          else if ( NDV[j] < axis->peakCoord )
-            axisScalar = FT_DivFix( NDV[j] - axis->startCoord,
-                                    axis->peakCoord - axis->startCoord );
-          else
-            axisScalar = FT_DivFix( axis->endCoord - NDV[j],
-                                    axis->endCoord - axis->peakCoord );
+          blend->BV[master] = 0;
+          break;
         }
 
-        /* take product of all the axis scalars */
-        blend->BV[master] = FT_MulFix( blend->BV[master], axisScalar );
+        /* adjust proportionally */
+        else if ( NDV[j] < axis->peakCoord )
+          blend->BV[master] = FT_MulDiv( blend->BV[master],
+                                         NDV[j] - axis->startCoord,
+                                         axis->peakCoord - axis->startCoord );
+        else   /* NDV[j] > axis->peakCoord ) */
+          blend->BV[master] = FT_MulDiv( blend->BV[master],
+                                         axis->endCoord - NDV[j],
+                                         axis->endCoord - axis->peakCoord );
       }
 
       FT_TRACE4(( ", %f ",
diff --git a/src/java.desktop/share/native/libfreetype/src/cff/cffload.h b/src/java.desktop/share/native/libfreetype/src/cff/cffload.h
index b5286b0c8cb0..022092454218 100644
--- a/src/java.desktop/share/native/libfreetype/src/cff/cffload.h
+++ b/src/java.desktop/share/native/libfreetype/src/cff/cffload.h
@@ -4,7 +4,7 @@
  *
  *   OpenType & CFF data/program tables loader (specification).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/cff/cffobjs.c b/src/java.desktop/share/native/libfreetype/src/cff/cffobjs.c
index 6d08620c487c..7c6713739a12 100644
--- a/src/java.desktop/share/native/libfreetype/src/cff/cffobjs.c
+++ b/src/java.desktop/share/native/libfreetype/src/cff/cffobjs.c
@@ -4,7 +4,7 @@
  *
  *   OpenType objects manager (body).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -42,6 +42,8 @@
 #include 
 #include 
 
+#define CFF_fixedToInt( x )                          \
+          ( (FT_Short)( ( (x) + 0x8000U ) >> 16 ) )
 
   /**************************************************************************
    *
@@ -124,19 +126,20 @@
 
     count = priv->num_blue_values = cpriv->num_blue_values;
     for ( n = 0; n < count; n++ )
-      priv->blue_values[n] = (FT_Short)cpriv->blue_values[n];
+      priv->blue_values[n] = CFF_fixedToInt( cpriv->blue_values[n] );
 
     count = priv->num_other_blues = cpriv->num_other_blues;
     for ( n = 0; n < count; n++ )
-      priv->other_blues[n] = (FT_Short)cpriv->other_blues[n];
+      priv->other_blues[n] = CFF_fixedToInt( cpriv->other_blues[n] );
 
     count = priv->num_family_blues = cpriv->num_family_blues;
     for ( n = 0; n < count; n++ )
-      priv->family_blues[n] = (FT_Short)cpriv->family_blues[n];
+      priv->family_blues[n] = CFF_fixedToInt( cpriv->family_blues[n] );
 
     count = priv->num_family_other_blues = cpriv->num_family_other_blues;
     for ( n = 0; n < count; n++ )
-      priv->family_other_blues[n] = (FT_Short)cpriv->family_other_blues[n];
+      priv->family_other_blues[n] =
+        CFF_fixedToInt( cpriv->family_other_blues[n] );
 
     priv->blue_scale = cpriv->blue_scale;
     priv->blue_shift = (FT_Int)cpriv->blue_shift;
@@ -421,32 +424,23 @@
   static void
   remove_subset_prefix( FT_String*  name )
   {
-    FT_Int32  idx             = 0;
-    FT_Int32  length          = (FT_Int32)ft_strlen( name ) + 1;
-    FT_Bool   continue_search = 1;
+    FT_UInt32  i = 0, idx = 0;
 
 
-    while ( continue_search )
+    /* six ASCII uppercase letters followed by a plus sign */
+    while ( 'A' <= name[i] && name[i++] <= 'Z' &&
+            'A' <= name[i] && name[i++] <= 'Z' &&
+            'A' <= name[i] && name[i++] <= 'Z' &&
+            'A' <= name[i] && name[i++] <= 'Z' &&
+            'A' <= name[i] && name[i++] <= 'Z' &&
+            'A' <= name[i] && name[i++] <= 'Z' &&
+                              name[i++] == '+' )
     {
-      if ( length >= 7 && name[6] == '+' )
-      {
-        for ( idx = 0; idx < 6; idx++ )
-        {
-          /* ASCII uppercase letters */
-          if ( !( 'A' <= name[idx] && name[idx] <= 'Z' ) )
-            continue_search = 0;
-        }
-
-        if ( continue_search )
-        {
-          for ( idx = 7; idx < length; idx++ )
-            name[idx - 7] = name[idx];
-          length -= 7;
-        }
-      }
-      else
-        continue_search = 0;
+      idx = i;
     }
+
+    if ( idx )
+      FT_MEM_MOVE( name, name + idx, ft_strlen( name + idx ) + 1 );
   }
 
 
@@ -456,42 +450,20 @@
   remove_style( FT_String*        family_name,
                 const FT_String*  style_name )
   {
-    FT_Int32  family_name_length, style_name_length;
+    FT_String*        f = family_name + ft_strlen( family_name );
+    const FT_String*  s =  style_name + ft_strlen(  style_name );
 
 
-    family_name_length = (FT_Int32)ft_strlen( family_name );
-    style_name_length  = (FT_Int32)ft_strlen( style_name );
+    /* compare strings moving backwards */
+    while ( s > style_name )
+      if ( f == family_name || *--s != *--f )
+        return;
 
-    if ( family_name_length > style_name_length )
-    {
-      FT_Int  idx;
-
-
-      for ( idx = 1; idx <= style_name_length; idx++ )
-      {
-        if ( family_name[family_name_length - idx] !=
-             style_name[style_name_length - idx] )
-          break;
-      }
-
-      if ( idx > style_name_length )
-      {
-        /* family_name ends with style_name; remove it */
-        idx = family_name_length - style_name_length - 1;
-
-        /* also remove special characters     */
-        /* between real family name and style */
-        while ( idx > 0                     &&
-                ( family_name[idx] == '-' ||
-                  family_name[idx] == ' ' ||
-                  family_name[idx] == '_' ||
-                  family_name[idx] == '+' ) )
-          idx--;
-
-        if ( idx > 0 )
-          family_name[idx + 1] = '\0';
-      }
-    }
+    /* terminate and remove special characters */
+    do
+      *f = '\0';
+    while ( f-- > family_name                                    &&
+            ( *f == '-' || *f == ' ' || *f == '_' || *f == '+' ) );
   }
 
 
@@ -722,8 +694,7 @@
         FT_UInt  instance_index = (FT_UInt)face_index >> 16;
 
 
-        if ( FT_HAS_MULTIPLE_MASTERS( cffface ) &&
-             instance_index > 0                 )
+        if ( FT_HAS_MULTIPLE_MASTERS( cffface ) )
         {
           error = FT_Set_Named_Instance( cffface, instance_index );
           if ( error )
diff --git a/src/java.desktop/share/native/libfreetype/src/cff/cffobjs.h b/src/java.desktop/share/native/libfreetype/src/cff/cffobjs.h
index 8f05f6132bc0..91ad83b1cd0c 100644
--- a/src/java.desktop/share/native/libfreetype/src/cff/cffobjs.h
+++ b/src/java.desktop/share/native/libfreetype/src/cff/cffobjs.h
@@ -4,7 +4,7 @@
  *
  *   OpenType objects manager (specification).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/cff/cffparse.c b/src/java.desktop/share/native/libfreetype/src/cff/cffparse.c
index 3b076704cf73..92a69c3b5165 100644
--- a/src/java.desktop/share/native/libfreetype/src/cff/cffparse.c
+++ b/src/java.desktop/share/native/libfreetype/src/cff/cffparse.c
@@ -4,7 +4,7 @@
  *
  *   CFF token stream parser (body)
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -501,10 +501,10 @@
       return cff_parse_real( *d, parser->limit, scaling, NULL );
     else if ( **d == 255 )
     {
-      FT_Fixed val = ( ( ( (FT_UInt32)*( d[0] + 1 ) << 24 ) |
-                         ( (FT_UInt32)*( d[0] + 2 ) << 16 ) |
-                         ( (FT_UInt32)*( d[0] + 3 ) <<  8 ) |
-                           (FT_UInt32)*( d[0] + 4 )         ) );
+      FT_Fixed val = (FT_Int32)( ( ( (FT_UInt32)*( d[0] + 1 ) << 24 ) |
+                                   ( (FT_UInt32)*( d[0] + 2 ) << 16 ) |
+                                   ( (FT_UInt32)*( d[0] + 3 ) <<  8 ) |
+                                     (FT_UInt32)*( d[0] + 4 )         ) );
 
       if ( scaling )
       {
@@ -1031,10 +1031,14 @@
           CFF_FIELD( code, name, id, cff_kind_string )
 #define CFF_FIELD_BOOL( code, name, id )             \
           CFF_FIELD( code, name, id, cff_kind_bool )
+#define CFF_FIELD_DELTA( code, name, max, id )                        \
+          CFF_FIELD_DELTA_KIND( code, name, max, id, cff_kind_delta )
+#define CFF_FIELD_DELTA_FIXED( code, name, max, id )                        \
+          CFF_FIELD_DELTA_KIND( code, name, max, id, cff_kind_delta_fixed )
 
 
 #undef  CFF_FIELD
-#undef  CFF_FIELD_DELTA
+#undef  CFF_FIELD_DELTA_KIND
 
 
 #ifndef FT_DEBUG_LEVEL_TRACE
@@ -1064,18 +1068,18 @@
             code | CFFCODE,               \
             FT_FIELD_OFFSET( name ),      \
             FT_FIELD_SIZE( name ),        \
-            0, 0, 0                       \
+            NULL, 0, 0                    \
           },
 
-#define CFF_FIELD_DELTA( code, name, max, id ) \
-          {                                    \
-            cff_kind_delta,                    \
-            code | CFFCODE,                    \
-            FT_FIELD_OFFSET( name ),           \
-            FT_FIELD_SIZE_DELTA( name ),       \
-            0,                                 \
-            max,                               \
-            FT_FIELD_OFFSET( num_ ## name )    \
+#define CFF_FIELD_DELTA_KIND( code, name, max, id, kind ) \
+          {                                               \
+            kind,                                         \
+            code | CFFCODE,                               \
+            FT_FIELD_OFFSET( name ),                      \
+            FT_FIELD_SIZE_DELTA( name ),                  \
+            NULL,                                         \
+            max,                                          \
+            FT_FIELD_OFFSET( num_ ## name )               \
           },
 
   static const CFF_Field_Handler  cff_field_handlers[] =
@@ -1083,7 +1087,7 @@
 
 #include "cfftoken.h"
 
-    { 0, 0, 0, 0, 0, 0, 0 }
+    { 0, 0, 0, 0, NULL, 0, 0 }
   };
 
 
@@ -1117,20 +1121,20 @@
             code | CFFCODE,               \
             FT_FIELD_OFFSET( name ),      \
             FT_FIELD_SIZE( name ),        \
-            0, 0, 0,                      \
+            NULL, 0, 0,                   \
             id                            \
           },
 
-#define CFF_FIELD_DELTA( code, name, max, id ) \
-          {                                    \
-            cff_kind_delta,                    \
-            code | CFFCODE,                    \
-            FT_FIELD_OFFSET( name ),           \
-            FT_FIELD_SIZE_DELTA( name ),       \
-            0,                                 \
-            max,                               \
-            FT_FIELD_OFFSET( num_ ## name ),   \
-            id                                 \
+#define CFF_FIELD_DELTA_KIND( code, name, max, id, kind ) \
+          {                                               \
+            kind,                                         \
+            code | CFFCODE,                               \
+            FT_FIELD_OFFSET( name ),                      \
+            FT_FIELD_SIZE_DELTA( name ),                  \
+            NULL,                                         \
+            max,                                          \
+            FT_FIELD_OFFSET( num_ ## name ),              \
+            id                                            \
           },
 
   static const CFF_Field_Handler  cff_field_handlers[] =
@@ -1138,7 +1142,7 @@
 
 #include "cfftoken.h"
 
-    { 0, 0, 0, 0, 0, 0, 0, 0 }
+    { 0, 0, 0, 0, NULL, 0, 0, NULL }
   };
 
 
@@ -1356,7 +1360,8 @@
 
             /* check that we have enough arguments -- except for */
             /* delta encoded arrays, which can be empty          */
-            if ( field->kind != cff_kind_delta && num_args < 1 )
+            if ( field->kind != cff_kind_delta                       &&
+                 field->kind != cff_kind_delta_fixed && num_args < 1 )
               goto Stack_Underflow;
 
             switch ( field->kind )
@@ -1471,6 +1476,38 @@
               }
               break;
 
+            case cff_kind_delta_fixed:
+              {
+                FT_Byte*   qcount = (FT_Byte*)parser->object +
+                                      field->count_offset;
+
+                FT_Byte**  data = parser->stack;
+
+
+                if ( num_args > field->array_max )
+                  num_args = field->array_max;
+
+                FT_TRACE4(( " [" ));
+
+                /* store count */
+                *qcount = (FT_Byte)num_args;
+
+                val = 0;
+                while ( num_args > 0 )
+                {
+                  val = ADD_LONG( val, cff_parse_fixed( parser, data++ ) );
+                  *(FT_Long*)q = val;
+
+                  FT_TRACE4(( " %f\n", (double)val / 65536 ));
+
+                  q += field->size;
+                  num_args--;
+                }
+
+                FT_TRACE4(( "]\n" ));
+              }
+              break;
+
             default:  /* callback or blend */
               error = field->reader( parser );
               if ( error )
diff --git a/src/java.desktop/share/native/libfreetype/src/cff/cffparse.h b/src/java.desktop/share/native/libfreetype/src/cff/cffparse.h
index 418caacc68c9..ca6b18af6aa3 100644
--- a/src/java.desktop/share/native/libfreetype/src/cff/cffparse.h
+++ b/src/java.desktop/share/native/libfreetype/src/cff/cffparse.h
@@ -4,7 +4,7 @@
  *
  *   CFF token stream parser (specification)
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -107,6 +107,7 @@ FT_BEGIN_HEADER
     cff_kind_string,
     cff_kind_bool,
     cff_kind_delta,
+    cff_kind_delta_fixed,
     cff_kind_callback,
     cff_kind_blend,
 
diff --git a/src/java.desktop/share/native/libfreetype/src/cff/cfftoken.h b/src/java.desktop/share/native/libfreetype/src/cff/cfftoken.h
index b61cb0e66e8d..da45faa7f4ee 100644
--- a/src/java.desktop/share/native/libfreetype/src/cff/cfftoken.h
+++ b/src/java.desktop/share/native/libfreetype/src/cff/cfftoken.h
@@ -4,7 +4,7 @@
  *
  *   CFF token definitions (specification only).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -80,26 +80,26 @@
 #undef  CFFCODE
 #define CFFCODE       CFF_CODE_PRIVATE
 
-  CFF_FIELD_DELTA     ( 6,     blue_values, 14,        "BlueValues" )
-  CFF_FIELD_DELTA     ( 7,     other_blues, 10,        "OtherBlues" )
-  CFF_FIELD_DELTA     ( 8,     family_blues, 14,       "FamilyBlues" )
-  CFF_FIELD_DELTA     ( 9,     family_other_blues, 10, "FamilyOtherBlues" )
-  CFF_FIELD_FIXED_1000( 0x109, blue_scale,             "BlueScale" )
-  CFF_FIELD_NUM       ( 0x10A, blue_shift,             "BlueShift" )
-  CFF_FIELD_NUM       ( 0x10B, blue_fuzz,              "BlueFuzz" )
-  CFF_FIELD_NUM       ( 10,    standard_width,         "StdHW" )
-  CFF_FIELD_NUM       ( 11,    standard_height,        "StdVW" )
-  CFF_FIELD_DELTA     ( 0x10C, snap_widths, 13,        "StemSnapH" )
-  CFF_FIELD_DELTA     ( 0x10D, snap_heights, 13,       "StemSnapV" )
-  CFF_FIELD_BOOL      ( 0x10E, force_bold,             "ForceBold" )
-  CFF_FIELD_FIXED     ( 0x10F, force_bold_threshold,   "ForceBoldThreshold" )
-  CFF_FIELD_NUM       ( 0x110, lenIV,                  "lenIV" )
-  CFF_FIELD_NUM       ( 0x111, language_group,         "LanguageGroup" )
-  CFF_FIELD_FIXED     ( 0x112, expansion_factor,       "ExpansionFactor" )
-  CFF_FIELD_NUM       ( 0x113, initial_random_seed,    "initialRandomSeed" )
-  CFF_FIELD_NUM       ( 19,    local_subrs_offset,     "Subrs" )
-  CFF_FIELD_NUM       ( 20,    default_width,          "defaultWidthX" )
-  CFF_FIELD_NUM       ( 21,    nominal_width,          "nominalWidthX" )
+  CFF_FIELD_DELTA_FIXED( 6,     blue_values, 14,        "BlueValues" )
+  CFF_FIELD_DELTA_FIXED( 7,     other_blues, 10,        "OtherBlues" )
+  CFF_FIELD_DELTA_FIXED( 8,     family_blues, 14,       "FamilyBlues" )
+  CFF_FIELD_DELTA_FIXED( 9,     family_other_blues, 10, "FamilyOtherBlues" )
+  CFF_FIELD_FIXED_1000 ( 0x109, blue_scale,             "BlueScale" )
+  CFF_FIELD_NUM        ( 0x10A, blue_shift,             "BlueShift" )
+  CFF_FIELD_NUM        ( 0x10B, blue_fuzz,              "BlueFuzz" )
+  CFF_FIELD_NUM        ( 10,    standard_width,         "StdHW" )
+  CFF_FIELD_NUM        ( 11,    standard_height,        "StdVW" )
+  CFF_FIELD_DELTA      ( 0x10C, snap_widths, 13,        "StemSnapH" )
+  CFF_FIELD_DELTA      ( 0x10D, snap_heights, 13,       "StemSnapV" )
+  CFF_FIELD_BOOL       ( 0x10E, force_bold,             "ForceBold" )
+  CFF_FIELD_FIXED      ( 0x10F, force_bold_threshold,   "ForceBoldThreshold" )
+  CFF_FIELD_NUM        ( 0x110, lenIV,                  "lenIV" )
+  CFF_FIELD_NUM        ( 0x111, language_group,         "LanguageGroup" )
+  CFF_FIELD_FIXED      ( 0x112, expansion_factor,       "ExpansionFactor" )
+  CFF_FIELD_NUM        ( 0x113, initial_random_seed,    "initialRandomSeed" )
+  CFF_FIELD_NUM        ( 19,    local_subrs_offset,     "Subrs" )
+  CFF_FIELD_NUM        ( 20,    default_width,          "defaultWidthX" )
+  CFF_FIELD_NUM        ( 21,    nominal_width,          "nominalWidthX" )
 
 
 #undef  FT_STRUCTURE
@@ -129,22 +129,22 @@
 #undef  CFFCODE
 #define CFFCODE       CFF2_CODE_PRIVATE
 
-  CFF_FIELD_DELTA     ( 6,     blue_values, 14,        "BlueValues" )
-  CFF_FIELD_DELTA     ( 7,     other_blues, 10,        "OtherBlues" )
-  CFF_FIELD_DELTA     ( 8,     family_blues, 14,       "FamilyBlues" )
-  CFF_FIELD_DELTA     ( 9,     family_other_blues, 10, "FamilyOtherBlues" )
-  CFF_FIELD_FIXED_1000( 0x109, blue_scale,             "BlueScale" )
-  CFF_FIELD_NUM       ( 0x10A, blue_shift,             "BlueShift" )
-  CFF_FIELD_NUM       ( 0x10B, blue_fuzz,              "BlueFuzz" )
-  CFF_FIELD_NUM       ( 10,    standard_width,         "StdHW" )
-  CFF_FIELD_NUM       ( 11,    standard_height,        "StdVW" )
-  CFF_FIELD_DELTA     ( 0x10C, snap_widths, 13,        "StemSnapH" )
-  CFF_FIELD_DELTA     ( 0x10D, snap_heights, 13,       "StemSnapV" )
-  CFF_FIELD_NUM       ( 0x111, language_group,         "LanguageGroup" )
-  CFF_FIELD_FIXED     ( 0x112, expansion_factor,       "ExpansionFactor" )
-  CFF_FIELD_CALLBACK  ( 22,    vsindex,                "vsindex" )
-  CFF_FIELD_BLEND     ( 23,                            "blend" )
-  CFF_FIELD_NUM       ( 19,    local_subrs_offset,     "Subrs" )
+  CFF_FIELD_DELTA_FIXED( 6,     blue_values, 14,        "BlueValues" )
+  CFF_FIELD_DELTA_FIXED( 7,     other_blues, 10,        "OtherBlues" )
+  CFF_FIELD_DELTA_FIXED( 8,     family_blues, 14,       "FamilyBlues" )
+  CFF_FIELD_DELTA_FIXED( 9,     family_other_blues, 10, "FamilyOtherBlues" )
+  CFF_FIELD_FIXED_1000 ( 0x109, blue_scale,             "BlueScale" )
+  CFF_FIELD_NUM        ( 0x10A, blue_shift,             "BlueShift" )
+  CFF_FIELD_NUM        ( 0x10B, blue_fuzz,              "BlueFuzz" )
+  CFF_FIELD_NUM        ( 10,    standard_width,         "StdHW" )
+  CFF_FIELD_NUM        ( 11,    standard_height,        "StdVW" )
+  CFF_FIELD_DELTA      ( 0x10C, snap_widths, 13,        "StemSnapH" )
+  CFF_FIELD_DELTA      ( 0x10D, snap_heights, 13,       "StemSnapV" )
+  CFF_FIELD_NUM        ( 0x111, language_group,         "LanguageGroup" )
+  CFF_FIELD_FIXED      ( 0x112, expansion_factor,       "ExpansionFactor" )
+  CFF_FIELD_CALLBACK   ( 22,    vsindex,                "vsindex" )
+  CFF_FIELD_BLEND      ( 23,                            "blend" )
+  CFF_FIELD_NUM        ( 19,    local_subrs_offset,     "Subrs" )
 
 
 /* END */
diff --git a/src/java.desktop/share/native/libfreetype/src/cid/ciderrs.h b/src/java.desktop/share/native/libfreetype/src/cid/ciderrs.h
index 40a1097d0ac7..c439a8c4a0b3 100644
--- a/src/java.desktop/share/native/libfreetype/src/cid/ciderrs.h
+++ b/src/java.desktop/share/native/libfreetype/src/cid/ciderrs.h
@@ -4,7 +4,7 @@
  *
  *   CID error codes (specification only).
  *
- * Copyright (C) 2001-2023 by
+ * Copyright (C) 2001-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/cid/cidgload.c b/src/java.desktop/share/native/libfreetype/src/cid/cidgload.c
index eaca765ad06c..7b571322d456 100644
--- a/src/java.desktop/share/native/libfreetype/src/cid/cidgload.c
+++ b/src/java.desktop/share/native/libfreetype/src/cid/cidgload.c
@@ -4,7 +4,7 @@
  *
  *   CID-keyed Type1 Glyph Loader (body).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/cid/cidgload.h b/src/java.desktop/share/native/libfreetype/src/cid/cidgload.h
index edd6229234c4..9fdc9db58923 100644
--- a/src/java.desktop/share/native/libfreetype/src/cid/cidgload.h
+++ b/src/java.desktop/share/native/libfreetype/src/cid/cidgload.h
@@ -4,7 +4,7 @@
  *
  *   OpenType Glyph Loader (specification).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/cid/cidload.c b/src/java.desktop/share/native/libfreetype/src/cid/cidload.c
index a7da8ea39d5d..722f5a34ddf9 100644
--- a/src/java.desktop/share/native/libfreetype/src/cid/cidload.c
+++ b/src/java.desktop/share/native/libfreetype/src/cid/cidload.c
@@ -4,7 +4,7 @@
  *
  *   CID-keyed Type1 font loader (body).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -388,7 +388,7 @@
     T1_FIELD_CALLBACK( "ExpansionFactor", parse_expansion_factor, 0 )
     T1_FIELD_CALLBACK( "FontName",        parse_font_name, 0 )
 
-    { 0, T1_FIELD_LOCATION_CID_INFO, T1_FIELD_TYPE_NONE, 0, 0, 0, 0, 0, 0 }
+    T1_FIELD_ZERO
   };
 
 
@@ -469,36 +469,23 @@
             T1_Field  keyword = (T1_Field)cid_field_records;
 
 
-            for (;;)
+            while ( keyword->len )
             {
-              FT_Byte*  name;
+              FT_Byte*  name = (FT_Byte*)keyword->ident;
 
 
-              name = (FT_Byte*)keyword->ident;
-              if ( !name )
-                break;
-
-              if ( cur[0] == name[0]                     &&
-                   len == ft_strlen( (const char*)name ) )
+              if ( keyword->len == len              &&
+                   ft_memcmp( cur, name, len ) == 0 )
               {
-                FT_UInt  n;
-
-
-                for ( n = 1; n < len; n++ )
-                  if ( cur[n] != name[n] )
-                    break;
-
-                if ( n >= len )
-                {
-                  /* we found it - run the parsing callback */
-                  parser->root.error = cid_load_keyword( face,
-                                                         loader,
-                                                         keyword );
-                  if ( parser->root.error )
-                    return parser->root.error;
-                  break;
-                }
+                /* we found it - run the parsing callback */
+                parser->root.error = cid_load_keyword( face,
+                                                       loader,
+                                                       keyword );
+                if ( parser->root.error )
+                  return parser->root.error;
+                break;
               }
+
               keyword++;
             }
           }
diff --git a/src/java.desktop/share/native/libfreetype/src/cid/cidload.h b/src/java.desktop/share/native/libfreetype/src/cid/cidload.h
index d12d2962a686..7f030b32df73 100644
--- a/src/java.desktop/share/native/libfreetype/src/cid/cidload.h
+++ b/src/java.desktop/share/native/libfreetype/src/cid/cidload.h
@@ -4,7 +4,7 @@
  *
  *   CID-keyed Type1 font loader (specification).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/cid/cidobjs.c b/src/java.desktop/share/native/libfreetype/src/cid/cidobjs.c
index f698a419289e..8d337c411283 100644
--- a/src/java.desktop/share/native/libfreetype/src/cid/cidobjs.c
+++ b/src/java.desktop/share/native/libfreetype/src/cid/cidobjs.c
@@ -4,7 +4,7 @@
  *
  *   CID objects manager (body).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/cid/cidobjs.h b/src/java.desktop/share/native/libfreetype/src/cid/cidobjs.h
index 83c0c61c3ca6..d371cbe99542 100644
--- a/src/java.desktop/share/native/libfreetype/src/cid/cidobjs.h
+++ b/src/java.desktop/share/native/libfreetype/src/cid/cidobjs.h
@@ -4,7 +4,7 @@
  *
  *   CID objects manager (specification).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/cid/cidparse.c b/src/java.desktop/share/native/libfreetype/src/cid/cidparse.c
index 171a886215ad..73a3ade893be 100644
--- a/src/java.desktop/share/native/libfreetype/src/cid/cidparse.c
+++ b/src/java.desktop/share/native/libfreetype/src/cid/cidparse.c
@@ -4,7 +4,7 @@
  *
  *   CID-keyed Type1 parser (body).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -90,10 +90,15 @@
     if ( error )
       goto Exit;
 
-  Again:
-    /* now, read the rest of the file until we find */
-    /* `StartData' or `/sfnts'                      */
+    if ( !stream->read ) {
+      /* just parse memory-based streams */
+      offset = stream->size;
+    }
+    else
     {
+      /* Find the last `StartData` or `/sfnts`.  The parser requires */
+      /* contiguous memory; attempt to pin as little as necessary.   */
+
       /*
        * The algorithm is as follows (omitting the case with less than 256
        * bytes to fill for simplicity).
@@ -119,7 +124,8 @@
       FT_Byte*  p           = buffer;
 
 
-      for ( offset = FT_STREAM_POS(); ; offset += 256 )
+      offset = 0;
+      while ( 1 )
       {
         FT_ULong  stream_len;
 
@@ -127,7 +133,7 @@
         stream_len = stream->size - FT_STREAM_POS();
 
         read_len = FT_MIN( read_len, stream_len );
-        if ( FT_STREAM_READ( p, read_len ) )
+        if ( read_len && FT_STREAM_READ( p, read_len ) )
           goto Exit;
 
         /* ensure that we do not compare with data beyond the buffer */
@@ -141,20 +147,23 @@
                ft_strncmp( (char*)p, STARTDATA, STARTDATA_LEN ) == 0 )
           {
             /* save offset of binary data after `StartData' */
-            offset += (FT_ULong)( p - buffer ) + STARTDATA_LEN + 1;
-            goto Found;
+            offset = FT_STREAM_POS() - read_len - read_offset
+                     + (FT_ULong)( p - buffer ) + STARTDATA_LEN + 1;
           }
           else if ( p[1] == 's'                                   &&
                     ft_strncmp( (char*)p, SFNTS, SFNTS_LEN ) == 0 )
           {
-            offset += (FT_ULong)( p - buffer ) + SFNTS_LEN + 1;
-            goto Found;
+            offset = FT_STREAM_POS() - read_len - read_offset
+                     + (FT_ULong)( p - buffer ) + SFNTS_LEN + 1;
           }
         }
 
-        if ( read_offset + read_len < STARTDATA_LEN )
+        if ( read_offset + read_len <= STARTDATA_LEN )
         {
-          FT_TRACE2(( "cid_parser_new: no `StartData' keyword found\n" ));
+          if ( offset )
+            goto Found;
+
+          FT_TRACE2(( "cid_parser_new: no `StartData` keyword found\n" ));
           error = FT_THROW( Invalid_File_Format );
           goto Exit;
         }
@@ -171,9 +180,9 @@
     }
 
   Found:
-    /* We have found the start of the binary data or the `/sfnts' token. */
-    /* Now rewind and extract the frame corresponding to this PostScript */
-    /* section.                                                          */
+    /* We have found an efficient range to look for the binary data or    */
+    /* `/sfnts' token.  Now rewind and extract the frame corresponding to */
+    /* this PostScript section.                                           */
 
     ps_len = offset - base_offset;
     if ( FT_STREAM_SEEK( base_offset )                  ||
@@ -187,8 +196,8 @@
     parser->root.limit     = parser->root.cursor + ps_len;
     parser->num_dict       = FT_UINT_MAX;
 
-    /* Finally, we check whether `StartData' or `/sfnts' was real --  */
-    /* it could be in a comment or string.  We also get the arguments */
+    /* Find the first real `StartData' or `/sfnts' -- the last one    */
+    /* could be in a comment or string.  We also get the arguments    */
     /* of `StartData' to find out whether the data is represented in  */
     /* binary or hex format.                                          */
 
@@ -216,6 +225,7 @@
       {
         T1_TokenRec  type_token;
         FT_Long      binary_length;
+        FT_ULong     found_offset;
 
 
         parser->root.cursor = arg1;
@@ -234,6 +244,24 @@
             parser->binary_length = (FT_ULong)binary_length;
         }
 
+        /* set the real values for the parser, if different */
+        found_offset = (FT_ULong)( cur - parser->postscript )
+                       + STARTDATA_LEN + 1;
+        if ( found_offset != offset )
+        {
+          FT_FRAME_RELEASE( parser->postscript );
+
+          ps_len = found_offset - base_offset;
+          if ( FT_STREAM_SEEK( base_offset )                  ||
+               FT_FRAME_EXTRACT( ps_len, parser->postscript ) )
+            goto Exit;
+
+          parser->data_offset    = found_offset;
+          parser->postscript_len = ps_len;
+          parser->root.base      = parser->postscript;
+          parser->root.cursor    = parser->postscript;
+          parser->root.limit     = parser->root.cursor + ps_len;
+        }
         goto Exit;
       }
       else if ( cur[1] == 's'                                   &&
@@ -251,11 +279,8 @@
       cur  = parser->root.cursor;
     }
 
-    /* we haven't found the correct `StartData'; go back and continue */
-    /* searching                                                      */
-    FT_FRAME_RELEASE( parser->postscript );
-    if ( !FT_STREAM_SEEK( offset ) )
-      goto Again;
+    FT_TRACE2(( "cid_parser_new: no `StartData` token found\n" ));
+    error = FT_THROW( Invalid_File_Format );
 
   Exit:
     return error;
diff --git a/src/java.desktop/share/native/libfreetype/src/cid/cidparse.h b/src/java.desktop/share/native/libfreetype/src/cid/cidparse.h
index 2fd4e7a9310b..0f5baddcb926 100644
--- a/src/java.desktop/share/native/libfreetype/src/cid/cidparse.h
+++ b/src/java.desktop/share/native/libfreetype/src/cid/cidparse.h
@@ -4,7 +4,7 @@
  *
  *   CID-keyed Type1 parser (specification).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/cid/cidriver.c b/src/java.desktop/share/native/libfreetype/src/cid/cidriver.c
index 99e7b1183951..4be8a5c00d51 100644
--- a/src/java.desktop/share/native/libfreetype/src/cid/cidriver.c
+++ b/src/java.desktop/share/native/libfreetype/src/cid/cidriver.c
@@ -4,7 +4,7 @@
  *
  *   CID driver interface (body).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/cid/cidriver.h b/src/java.desktop/share/native/libfreetype/src/cid/cidriver.h
index a6249385c811..7ddce431c5b1 100644
--- a/src/java.desktop/share/native/libfreetype/src/cid/cidriver.h
+++ b/src/java.desktop/share/native/libfreetype/src/cid/cidriver.h
@@ -4,7 +4,7 @@
  *
  *   High-level CID driver interface (specification).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/cid/cidtoken.h b/src/java.desktop/share/native/libfreetype/src/cid/cidtoken.h
index 925951acdbd2..160897d14472 100644
--- a/src/java.desktop/share/native/libfreetype/src/cid/cidtoken.h
+++ b/src/java.desktop/share/native/libfreetype/src/cid/cidtoken.h
@@ -4,7 +4,7 @@
  *
  *   CID token definitions (specification only).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/psaux/afmparse.c b/src/java.desktop/share/native/libfreetype/src/psaux/afmparse.c
index db08941def74..e2f6a8e5adb9 100644
--- a/src/java.desktop/share/native/libfreetype/src/psaux/afmparse.c
+++ b/src/java.desktop/share/native/libfreetype/src/psaux/afmparse.c
@@ -4,7 +4,7 @@
  *
  *   AFM parser (body).
  *
- * Copyright (C) 2006-2023 by
+ * Copyright (C) 2006-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/psaux/afmparse.h b/src/java.desktop/share/native/libfreetype/src/psaux/afmparse.h
index 2d3b6e6e1695..b7766372821a 100644
--- a/src/java.desktop/share/native/libfreetype/src/psaux/afmparse.h
+++ b/src/java.desktop/share/native/libfreetype/src/psaux/afmparse.h
@@ -4,7 +4,7 @@
  *
  *   AFM parser (specification).
  *
- * Copyright (C) 2006-2023 by
+ * Copyright (C) 2006-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/psaux/cffdecode.c b/src/java.desktop/share/native/libfreetype/src/psaux/cffdecode.c
index 562d17d22164..9556e11a5861 100644
--- a/src/java.desktop/share/native/libfreetype/src/psaux/cffdecode.c
+++ b/src/java.desktop/share/native/libfreetype/src/psaux/cffdecode.c
@@ -4,7 +4,7 @@
  *
  *   PostScript CFF (Type 2) decoding routines (body).
  *
- * Copyright (C) 2017-2023 by
+ * Copyright (C) 2017-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -17,6 +17,7 @@
 
 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -1752,22 +1753,9 @@
 
           /* without upper limit the loop below might not finish */
           if ( args[0] > 0x7FFFFFFFL )
-            args[0] = 46341;
+            args[0] = 0xB504F4L;    /* sqrt( 32768.0044 ) */
           else if ( args[0] > 0 )
-          {
-            FT_Fixed  root = args[0];
-            FT_Fixed  new_root;
-
-
-            for (;;)
-            {
-              new_root = ( root + FT_DivFix( args[0], root ) + 1 ) >> 1;
-              if ( new_root == root )
-                break;
-              root = new_root;
-            }
-            args[0] = new_root;
-          }
+            args[0] = (FT_Fixed)FT_SqrtFixed( args[0] );
           else
             args[0] = 0;
           args++;
diff --git a/src/java.desktop/share/native/libfreetype/src/psaux/cffdecode.h b/src/java.desktop/share/native/libfreetype/src/psaux/cffdecode.h
index e8bb4001cba2..038f7235c3d6 100644
--- a/src/java.desktop/share/native/libfreetype/src/psaux/cffdecode.h
+++ b/src/java.desktop/share/native/libfreetype/src/psaux/cffdecode.h
@@ -4,7 +4,7 @@
  *
  *   PostScript CFF (Type 2) decoding routines (specification).
  *
- * Copyright (C) 2017-2023 by
+ * Copyright (C) 2017-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/psaux/psauxerr.h b/src/java.desktop/share/native/libfreetype/src/psaux/psauxerr.h
index 895ffa48c2c3..18428c40d5a4 100644
--- a/src/java.desktop/share/native/libfreetype/src/psaux/psauxerr.h
+++ b/src/java.desktop/share/native/libfreetype/src/psaux/psauxerr.h
@@ -4,7 +4,7 @@
  *
  *   PS auxiliary module error codes (specification only).
  *
- * Copyright (C) 2001-2023 by
+ * Copyright (C) 2001-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/psaux/psauxmod.c b/src/java.desktop/share/native/libfreetype/src/psaux/psauxmod.c
index 45e35aa53c4c..6826f9d8d3ed 100644
--- a/src/java.desktop/share/native/libfreetype/src/psaux/psauxmod.c
+++ b/src/java.desktop/share/native/libfreetype/src/psaux/psauxmod.c
@@ -4,7 +4,7 @@
  *
  *   FreeType auxiliary PostScript module implementation (body).
  *
- * Copyright (C) 2000-2023 by
+ * Copyright (C) 2000-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/psaux/psauxmod.h b/src/java.desktop/share/native/libfreetype/src/psaux/psauxmod.h
index 94dbf48813c1..82d7e348af81 100644
--- a/src/java.desktop/share/native/libfreetype/src/psaux/psauxmod.h
+++ b/src/java.desktop/share/native/libfreetype/src/psaux/psauxmod.h
@@ -4,7 +4,7 @@
  *
  *   FreeType auxiliary PostScript module implementation (specification).
  *
- * Copyright (C) 2000-2023 by
+ * Copyright (C) 2000-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/psaux/psblues.c b/src/java.desktop/share/native/libfreetype/src/psaux/psblues.c
index f9c864fea9ae..213b943b4657 100644
--- a/src/java.desktop/share/native/libfreetype/src/psaux/psblues.c
+++ b/src/java.desktop/share/native/libfreetype/src/psaux/psblues.c
@@ -54,14 +54,6 @@
 #define FT_COMPONENT  cf2blues
 
 
-  /*
-   * For blue values, the FreeType parser produces an array of integers,
-   * while the Adobe CFF engine produces an array of fixed.
-   * Define a macro to convert FreeType to fixed.
-   */
-#define cf2_blueToFixed( x )  cf2_intToFixed( x )
-
-
   FT_LOCAL_DEF( void )
   cf2_blues_init( CF2_Blues  blues,
                   CF2_Font   font )
@@ -78,10 +70,10 @@
     size_t  numFamilyBlues;
     size_t  numFamilyOtherBlues;
 
-    FT_Pos*  blueValues;
-    FT_Pos*  otherBlues;
-    FT_Pos*  familyBlues;
-    FT_Pos*  familyOtherBlues;
+    FT_Fixed*  blueValues;
+    FT_Fixed*  otherBlues;
+    FT_Fixed*  familyBlues;
+    FT_Fixed*  familyOtherBlues;
 
     size_t     i;
     CF2_Fixed  emBoxBottom, emBoxTop;
@@ -138,13 +130,13 @@
       emBoxTop    = CF2_ICF_Top;
     }
 
-    if ( cf2_getLanguageGroup( decoder ) == 1                   &&
-         ( numBlueValues == 0                                 ||
-           ( numBlueValues == 4                             &&
-             cf2_blueToFixed( blueValues[0] ) < emBoxBottom &&
-             cf2_blueToFixed( blueValues[1] ) < emBoxBottom &&
-             cf2_blueToFixed( blueValues[2] ) > emBoxTop    &&
-             cf2_blueToFixed( blueValues[3] ) > emBoxTop    ) ) )
+    if ( cf2_getLanguageGroup( decoder ) == 1     &&
+         ( numBlueValues == 0                   ||
+           ( numBlueValues == 4               &&
+             blueValues[0] < emBoxBottom      &&
+             blueValues[1] < emBoxBottom      &&
+             blueValues[2] > emBoxTop         &&
+             blueValues[3] > emBoxTop         ) ) )
     {
       /*
        * Construct hint edges suitable for synthetic ghost hints at top
@@ -189,10 +181,8 @@
     /* bottom zones                                                      */
     for ( i = 0; i < numBlueValues; i += 2 )
     {
-      blues->zone[blues->count].csBottomEdge =
-        cf2_blueToFixed( blueValues[i] );
-      blues->zone[blues->count].csTopEdge =
-        cf2_blueToFixed( blueValues[i + 1] );
+      blues->zone[blues->count].csBottomEdge = blueValues[i];
+      blues->zone[blues->count].csTopEdge    = blueValues[i + 1];
 
       zoneHeight = SUB_INT32( blues->zone[blues->count].csTopEdge,
                               blues->zone[blues->count].csBottomEdge );
@@ -238,10 +228,8 @@
 
     for ( i = 0; i < numOtherBlues; i += 2 )
     {
-      blues->zone[blues->count].csBottomEdge =
-        cf2_blueToFixed( otherBlues[i] );
-      blues->zone[blues->count].csTopEdge =
-        cf2_blueToFixed( otherBlues[i + 1] );
+      blues->zone[blues->count].csBottomEdge = otherBlues[i];
+      blues->zone[blues->count].csTopEdge    = otherBlues[i + 1];
 
       zoneHeight = SUB_INT32( blues->zone[blues->count].csTopEdge,
                               blues->zone[blues->count].csBottomEdge );
@@ -299,7 +287,7 @@
         for ( j = 0; j < numFamilyOtherBlues; j += 2 )
         {
           /* top edge */
-          flatFamilyEdge = cf2_blueToFixed( familyOtherBlues[j + 1] );
+          flatFamilyEdge = familyOtherBlues[j + 1];
 
           diff = cf2_fixedAbs( SUB_INT32( flatEdge, flatFamilyEdge ) );
 
@@ -317,7 +305,7 @@
         if ( numFamilyBlues >= 2 )
         {
           /* top edge */
-          flatFamilyEdge = cf2_blueToFixed( familyBlues[1] );
+          flatFamilyEdge = familyBlues[1];
 
           diff = cf2_fixedAbs( SUB_INT32( flatEdge, flatFamilyEdge ) );
 
@@ -337,7 +325,7 @@
         for ( j = 2; j < numFamilyBlues; j += 2 )
         {
           /* bottom edge */
-          flatFamilyEdge = cf2_blueToFixed( familyBlues[j] );
+          flatFamilyEdge = familyBlues[j];
 
           /* adjust edges of top zone upward by twice darkening amount */
           flatFamilyEdge += 2 * font->darkenY;      /* bottom edge */
diff --git a/src/java.desktop/share/native/libfreetype/src/psaux/psconv.c b/src/java.desktop/share/native/libfreetype/src/psaux/psconv.c
index b9c7138d8463..56c0ecd1d7f2 100644
--- a/src/java.desktop/share/native/libfreetype/src/psaux/psconv.c
+++ b/src/java.desktop/share/native/libfreetype/src/psaux/psconv.c
@@ -4,7 +4,7 @@
  *
  *   Some convenience conversions (body).
  *
- * Copyright (C) 2006-2023 by
+ * Copyright (C) 2006-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/psaux/psconv.h b/src/java.desktop/share/native/libfreetype/src/psaux/psconv.h
index b7c3ee00be87..91fcd15a1c96 100644
--- a/src/java.desktop/share/native/libfreetype/src/psaux/psconv.h
+++ b/src/java.desktop/share/native/libfreetype/src/psaux/psconv.h
@@ -4,7 +4,7 @@
  *
  *   Some convenience conversions (specification).
  *
- * Copyright (C) 2006-2023 by
+ * Copyright (C) 2006-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/psaux/psft.c b/src/java.desktop/share/native/libfreetype/src/psaux/psft.c
index 618864e6e072..fd0abe17154c 100644
--- a/src/java.desktop/share/native/libfreetype/src/psaux/psft.c
+++ b/src/java.desktop/share/native/libfreetype/src/psaux/psft.c
@@ -566,12 +566,12 @@
   FT_LOCAL_DEF( void )
   cf2_getBlueValues( PS_Decoder*  decoder,
                      size_t*      count,
-                     FT_Pos*     *data )
+                     FT_Fixed*   *data )
   {
     FT_ASSERT( decoder && decoder->current_subfont );
 
     *count = decoder->current_subfont->private_dict.num_blue_values;
-    *data  = (FT_Pos*)
+    *data  = (FT_Fixed*)
                &decoder->current_subfont->private_dict.blue_values;
   }
 
@@ -579,12 +579,12 @@
   FT_LOCAL_DEF( void )
   cf2_getOtherBlues( PS_Decoder*  decoder,
                      size_t*      count,
-                     FT_Pos*     *data )
+                     FT_Fixed*   *data )
   {
     FT_ASSERT( decoder && decoder->current_subfont );
 
     *count = decoder->current_subfont->private_dict.num_other_blues;
-    *data  = (FT_Pos*)
+    *data  = (FT_Fixed*)
                &decoder->current_subfont->private_dict.other_blues;
   }
 
@@ -592,12 +592,12 @@
   FT_LOCAL_DEF( void )
   cf2_getFamilyBlues( PS_Decoder*  decoder,
                       size_t*      count,
-                      FT_Pos*     *data )
+                      FT_Fixed*   *data )
   {
     FT_ASSERT( decoder && decoder->current_subfont );
 
     *count = decoder->current_subfont->private_dict.num_family_blues;
-    *data  = (FT_Pos*)
+    *data  = (FT_Fixed*)
                &decoder->current_subfont->private_dict.family_blues;
   }
 
@@ -605,12 +605,12 @@
   FT_LOCAL_DEF( void )
   cf2_getFamilyOtherBlues( PS_Decoder*  decoder,
                            size_t*      count,
-                           FT_Pos*     *data )
+                           FT_Fixed*   *data )
   {
     FT_ASSERT( decoder && decoder->current_subfont );
 
     *count = decoder->current_subfont->private_dict.num_family_other_blues;
-    *data  = (FT_Pos*)
+    *data  = (FT_Fixed*)
                &decoder->current_subfont->private_dict.family_other_blues;
   }
 
diff --git a/src/java.desktop/share/native/libfreetype/src/psaux/psft.h b/src/java.desktop/share/native/libfreetype/src/psaux/psft.h
index 3da454e6012a..d9082f3a2be1 100644
--- a/src/java.desktop/share/native/libfreetype/src/psaux/psft.h
+++ b/src/java.desktop/share/native/libfreetype/src/psaux/psft.h
@@ -92,19 +92,19 @@ FT_BEGIN_HEADER
   FT_LOCAL( void )
   cf2_getBlueValues( PS_Decoder*  decoder,
                      size_t*      count,
-                     FT_Pos*     *data );
+                     FT_Fixed*   *data );
   FT_LOCAL( void )
   cf2_getOtherBlues( PS_Decoder*  decoder,
                      size_t*      count,
-                     FT_Pos*     *data );
+                     FT_Fixed*   *data );
   FT_LOCAL( void )
   cf2_getFamilyBlues( PS_Decoder*  decoder,
                       size_t*      count,
-                      FT_Pos*     *data );
+                      FT_Fixed*   *data );
   FT_LOCAL( void )
   cf2_getFamilyOtherBlues( PS_Decoder*  decoder,
                            size_t*      count,
-                           FT_Pos*     *data );
+                           FT_Fixed*   *data );
 
   FT_LOCAL( CF2_Int )
   cf2_getLanguageGroup( PS_Decoder*  decoder );
diff --git a/src/java.desktop/share/native/libfreetype/src/psaux/psintrp.c b/src/java.desktop/share/native/libfreetype/src/psaux/psintrp.c
index 6c640eebd5a5..7572e225e377 100644
--- a/src/java.desktop/share/native/libfreetype/src/psaux/psintrp.c
+++ b/src/java.desktop/share/native/libfreetype/src/psaux/psintrp.c
@@ -37,6 +37,7 @@
 
 
 #include "psft.h"
+#include 
 #include 
 #include 
 
@@ -428,6 +429,8 @@
     base  = cf2_stack_count( opStack ) - numOperands;
     delta = base + numBlends;
 
+    FT_TRACE6(( " (" ));
+
     for ( i = 0; i < numBlends; i++ )
     {
       const CF2_Fixed*  weight = &blend->BV[1];
@@ -442,10 +445,14 @@
                                     cf2_stack_getReal( opStack,
                                                        delta++ ) ) );
 
+      FT_TRACE6(( "%f ", (double)sum / 65536 ));
+
       /* store blended result  */
       cf2_stack_setReal( opStack, i + base, sum );
     }
 
+    FT_TRACE6(( "blended)\n" ));
+
     /* leave only `numBlends' results on stack */
     cf2_stack_pop( opStack, numOperands - numBlends );
   }
@@ -734,7 +741,7 @@
           FT_UInt  numBlends;
 
 
-          FT_TRACE4(( " blend\n" ));
+          FT_TRACE4(( " blend" ));
 
           if ( !font->isCFF2 )
             break;    /* clear stack & ignore */
@@ -2275,23 +2282,7 @@
 
                     arg = cf2_stack_popFixed( opStack );
                     if ( arg > 0 )
-                    {
-                      /* use a start value that doesn't make */
-                      /* the algorithm's addition overflow   */
-                      FT_Fixed  root = arg < 10 ? arg : arg >> 1;
-                      FT_Fixed  new_root;
-
-
-                      /* Babylonian method */
-                      for (;;)
-                      {
-                        new_root = ( root + FT_DivFix( arg, root ) + 1 ) >> 1;
-                        if ( new_root == root )
-                          break;
-                        root = new_root;
-                      }
-                      arg = new_root;
-                    }
+                      arg = (CF2_F16Dot16)FT_SqrtFixed( (FT_UInt32)arg );
                     else
                       arg = 0;
 
diff --git a/src/java.desktop/share/native/libfreetype/src/psaux/psobjs.c b/src/java.desktop/share/native/libfreetype/src/psaux/psobjs.c
index 8da755d0e576..eca465f009e9 100644
--- a/src/java.desktop/share/native/libfreetype/src/psaux/psobjs.c
+++ b/src/java.desktop/share/native/libfreetype/src/psaux/psobjs.c
@@ -4,7 +4,7 @@
  *
  *   Auxiliary functions for PostScript fonts (body).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -23,6 +23,7 @@
 
 #include "psobjs.h"
 #include "psconv.h"
+#include "psft.h"
 
 #include "psauxerr.h"
 #include "psauxmod.h"
@@ -200,7 +201,9 @@
     /* add the object to the base block and adjust offset */
     table->elements[idx] = FT_OFFSET( table->block, table->cursor );
     table->lengths [idx] = length;
-    FT_MEM_COPY( table->block + table->cursor, object, length );
+    /* length == 0 also implies a NULL destination, so skip the copy call */
+    if ( length > 0 )
+      FT_MEM_COPY( table->block + table->cursor, object, length );
 
     table->cursor += length;
     return FT_Err_Ok;
@@ -1624,7 +1627,7 @@
     if ( builder->load_points )
     {
       FT_Vector*  point   = outline->points + outline->n_points;
-      FT_Byte*    control = (FT_Byte*)outline->tags + outline->n_points;
+      FT_Byte*    control = outline->tags   + outline->n_points;
 
 
       point->x = FIXED_TO_INT( x );
@@ -1677,8 +1680,7 @@
     if ( !error )
     {
       if ( outline->n_contours > 0 )
-        outline->contours[outline->n_contours - 1] =
-          (short)( outline->n_points - 1 );
+        outline->contours[outline->n_contours - 1] = outline->n_points - 1;
 
       outline->n_contours++;
     }
@@ -1740,7 +1742,7 @@
     {
       FT_Vector*  p1      = outline->points + first;
       FT_Vector*  p2      = outline->points + outline->n_points - 1;
-      FT_Byte*    control = (FT_Byte*)outline->tags + outline->n_points - 1;
+      FT_Byte*    control = outline->tags   + outline->n_points - 1;
 
 
       /* `delete' last point only if it coincides with the first */
@@ -1760,8 +1762,7 @@
         outline->n_points--;
       }
       else
-        outline->contours[outline->n_contours - 1] =
-          (short)( outline->n_points - 1 );
+        outline->contours[outline->n_contours - 1] = outline->n_points - 1;
     }
   }
 
@@ -1899,7 +1900,7 @@
     if ( builder->load_points )
     {
       FT_Vector*  point   = outline->points + outline->n_points;
-      FT_Byte*    control = (FT_Byte*)outline->tags + outline->n_points;
+      FT_Byte*    control = outline->tags   + outline->n_points;
 
 #ifdef CFF_CONFIG_OPTION_OLD_ENGINE
       PS_Driver  driver   = (PS_Driver)FT_FACE_DRIVER( builder->face );
@@ -1959,8 +1960,7 @@
     if ( !error )
     {
       if ( outline->n_contours > 0 )
-        outline->contours[outline->n_contours - 1] =
-          (short)( outline->n_points - 1 );
+        outline->contours[outline->n_contours - 1] = outline->n_points - 1;
 
       outline->n_contours++;
     }
@@ -2019,7 +2019,7 @@
     {
       FT_Vector*  p1      = outline->points + first;
       FT_Vector*  p2      = outline->points + outline->n_points - 1;
-      FT_Byte*    control = (FT_Byte*)outline->tags + outline->n_points - 1;
+      FT_Byte*    control = outline->tags   + outline->n_points - 1;
 
 
       /* `delete' last point only if it coincides with the first    */
@@ -2039,8 +2039,7 @@
         outline->n_points--;
       }
       else
-        outline->contours[outline->n_contours - 1] =
-          (short)( outline->n_points - 1 );
+        outline->contours[outline->n_contours - 1] = outline->n_points - 1;
     }
   }
 
@@ -2188,7 +2187,7 @@
     if ( builder->load_points )
     {
       FT_Vector*  point   = outline->points + outline->n_points;
-      FT_Byte*    control = (FT_Byte*)outline->tags + outline->n_points;
+      FT_Byte*    control = outline->tags   + outline->n_points;
 
 #ifdef CFF_CONFIG_OPTION_OLD_ENGINE
       PS_Driver  driver   = (PS_Driver)FT_FACE_DRIVER( builder->face );
@@ -2267,8 +2266,7 @@
     if ( !error )
     {
       if ( outline->n_contours > 0 )
-        outline->contours[outline->n_contours - 1] =
-          (short)( outline->n_points - 1 );
+        outline->contours[outline->n_contours - 1] = outline->n_points - 1;
 
       outline->n_contours++;
     }
@@ -2327,7 +2325,7 @@
     {
       FT_Vector*  p1      = outline->points + first;
       FT_Vector*  p2      = outline->points + outline->n_points - 1;
-      FT_Byte*    control = (FT_Byte*)outline->tags + outline->n_points - 1;
+      FT_Byte*    control = outline->tags   + outline->n_points - 1;
 
 
       /* `delete' last point only if it coincides with the first */
@@ -2347,8 +2345,7 @@
         outline->n_points--;
       }
       else
-        outline->contours[outline->n_contours - 1] =
-          (short)( outline->n_points - 1 );
+        outline->contours[outline->n_contours - 1] = outline->n_points - 1;
     }
   }
 
@@ -2463,19 +2460,20 @@
 
     count = cpriv->num_blue_values = priv->num_blue_values;
     for ( n = 0; n < count; n++ )
-      cpriv->blue_values[n] = (FT_Pos)priv->blue_values[n];
+      cpriv->blue_values[n] = cf2_intToFixed( priv->blue_values[n] );
 
     count = cpriv->num_other_blues = priv->num_other_blues;
     for ( n = 0; n < count; n++ )
-      cpriv->other_blues[n] = (FT_Pos)priv->other_blues[n];
+      cpriv->other_blues[n] = cf2_intToFixed( priv->other_blues[n] );
 
     count = cpriv->num_family_blues = priv->num_family_blues;
     for ( n = 0; n < count; n++ )
-      cpriv->family_blues[n] = (FT_Pos)priv->family_blues[n];
+      cpriv->family_blues[n] = cf2_intToFixed( priv->family_blues[n] );
 
     count = cpriv->num_family_other_blues = priv->num_family_other_blues;
     for ( n = 0; n < count; n++ )
-      cpriv->family_other_blues[n] = (FT_Pos)priv->family_other_blues[n];
+      cpriv->family_other_blues[n] =
+        cf2_intToFixed( priv->family_other_blues[n] );
 
     cpriv->blue_scale = priv->blue_scale;
     cpriv->blue_shift = (FT_Pos)priv->blue_shift;
diff --git a/src/java.desktop/share/native/libfreetype/src/psaux/psobjs.h b/src/java.desktop/share/native/libfreetype/src/psaux/psobjs.h
index d5bce541082f..345fc8a73356 100644
--- a/src/java.desktop/share/native/libfreetype/src/psaux/psobjs.h
+++ b/src/java.desktop/share/native/libfreetype/src/psaux/psobjs.h
@@ -4,7 +4,7 @@
  *
  *   Auxiliary functions for PostScript fonts (specification).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/psaux/t1cmap.c b/src/java.desktop/share/native/libfreetype/src/psaux/t1cmap.c
index c4bcf599ea3a..5681c3bd0fdb 100644
--- a/src/java.desktop/share/native/libfreetype/src/psaux/t1cmap.c
+++ b/src/java.desktop/share/native/libfreetype/src/psaux/t1cmap.c
@@ -4,7 +4,7 @@
  *
  *   Type 1 character map support (body).
  *
- * Copyright (C) 2002-2023 by
+ * Copyright (C) 2002-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/psaux/t1cmap.h b/src/java.desktop/share/native/libfreetype/src/psaux/t1cmap.h
index b3702498a553..445e6a2784f5 100644
--- a/src/java.desktop/share/native/libfreetype/src/psaux/t1cmap.h
+++ b/src/java.desktop/share/native/libfreetype/src/psaux/t1cmap.h
@@ -4,7 +4,7 @@
  *
  *   Type 1 character map support (specification).
  *
- * Copyright (C) 2002-2023 by
+ * Copyright (C) 2002-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/psaux/t1decode.c b/src/java.desktop/share/native/libfreetype/src/psaux/t1decode.c
index 4b6b969bcb99..c74baa8038f3 100644
--- a/src/java.desktop/share/native/libfreetype/src/psaux/t1decode.c
+++ b/src/java.desktop/share/native/libfreetype/src/psaux/t1decode.c
@@ -4,7 +4,7 @@
  *
  *   PostScript Type 1 decoding routines (body).
  *
- * Copyright (C) 2000-2023 by
+ * Copyright (C) 2000-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/psaux/t1decode.h b/src/java.desktop/share/native/libfreetype/src/psaux/t1decode.h
index 0970def960b2..16203b8f734f 100644
--- a/src/java.desktop/share/native/libfreetype/src/psaux/t1decode.h
+++ b/src/java.desktop/share/native/libfreetype/src/psaux/t1decode.h
@@ -4,7 +4,7 @@
  *
  *   PostScript Type 1 decoding routines (specification).
  *
- * Copyright (C) 2000-2023 by
+ * Copyright (C) 2000-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/pshinter/pshalgo.c b/src/java.desktop/share/native/libfreetype/src/pshinter/pshalgo.c
index 4f622e1e440f..967767b34857 100644
--- a/src/java.desktop/share/native/libfreetype/src/pshinter/pshalgo.c
+++ b/src/java.desktop/share/native/libfreetype/src/pshinter/pshalgo.c
@@ -4,7 +4,7 @@
  *
  *   PostScript hinting algorithm (body).
  *
- * Copyright (C) 2001-2023 by
+ * Copyright (C) 2001-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used
@@ -1118,7 +1118,7 @@
     FT_UInt     n;
     PSH_Point   point = glyph->points;
     FT_Vector*  vec   = glyph->outline->points;
-    char*       tags  = glyph->outline->tags;
+    FT_Byte*    tags  = glyph->outline->tags;
 
 
     for ( n = 0; n < glyph->num_points; n++ )
@@ -1171,8 +1171,8 @@
          FT_QNEW_ARRAY( glyph->contours, outline->n_contours ) )
       goto Exit;
 
-    glyph->num_points   = (FT_UInt)outline->n_points;
-    glyph->num_contours = (FT_UInt)outline->n_contours;
+    glyph->num_points   = outline->n_points;
+    glyph->num_contours = outline->n_contours;
 
     {
       FT_UInt      first = 0, next, n;
@@ -1186,7 +1186,7 @@
         PSH_Point  point;
 
 
-        next  = (FT_UInt)outline->contours[n] + 1;
+        next  = outline->contours[n] + 1;
         count = next - first;
 
         contour->start = points + first;
diff --git a/src/java.desktop/share/native/libfreetype/src/pshinter/pshalgo.h b/src/java.desktop/share/native/libfreetype/src/pshinter/pshalgo.h
index 3f0ba28a6930..fb362f061b6e 100644
--- a/src/java.desktop/share/native/libfreetype/src/pshinter/pshalgo.h
+++ b/src/java.desktop/share/native/libfreetype/src/pshinter/pshalgo.h
@@ -4,7 +4,7 @@
  *
  *   PostScript hinting algorithm (specification).
  *
- * Copyright (C) 2001-2023 by
+ * Copyright (C) 2001-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/pshinter/pshglob.c b/src/java.desktop/share/native/libfreetype/src/pshinter/pshglob.c
index d4c5eb32b1c5..435f45838ffd 100644
--- a/src/java.desktop/share/native/libfreetype/src/pshinter/pshglob.c
+++ b/src/java.desktop/share/native/libfreetype/src/pshinter/pshglob.c
@@ -5,7 +5,7 @@
  *   PostScript hinter global hinting management (body).
  *   Inspired by the new auto-hinter module.
  *
- * Copyright (C) 2001-2023 by
+ * Copyright (C) 2001-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used
diff --git a/src/java.desktop/share/native/libfreetype/src/pshinter/pshglob.h b/src/java.desktop/share/native/libfreetype/src/pshinter/pshglob.h
index 579eb2148a57..c5a5c9131680 100644
--- a/src/java.desktop/share/native/libfreetype/src/pshinter/pshglob.h
+++ b/src/java.desktop/share/native/libfreetype/src/pshinter/pshglob.h
@@ -4,7 +4,7 @@
  *
  *   PostScript hinter global hinting management.
  *
- * Copyright (C) 2001-2023 by
+ * Copyright (C) 2001-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/pshinter/pshmod.c b/src/java.desktop/share/native/libfreetype/src/pshinter/pshmod.c
index 974a99e0186d..9965d5b16bf1 100644
--- a/src/java.desktop/share/native/libfreetype/src/pshinter/pshmod.c
+++ b/src/java.desktop/share/native/libfreetype/src/pshinter/pshmod.c
@@ -4,7 +4,7 @@
  *
  *   FreeType PostScript hinter module implementation (body).
  *
- * Copyright (C) 2001-2023 by
+ * Copyright (C) 2001-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/pshinter/pshmod.h b/src/java.desktop/share/native/libfreetype/src/pshinter/pshmod.h
index 4bd781a35d76..62ac0a60fdce 100644
--- a/src/java.desktop/share/native/libfreetype/src/pshinter/pshmod.h
+++ b/src/java.desktop/share/native/libfreetype/src/pshinter/pshmod.h
@@ -4,7 +4,7 @@
  *
  *   PostScript hinter module interface (specification).
  *
- * Copyright (C) 2001-2023 by
+ * Copyright (C) 2001-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/pshinter/pshnterr.h b/src/java.desktop/share/native/libfreetype/src/pshinter/pshnterr.h
index 97624952d8ca..e9641340e530 100644
--- a/src/java.desktop/share/native/libfreetype/src/pshinter/pshnterr.h
+++ b/src/java.desktop/share/native/libfreetype/src/pshinter/pshnterr.h
@@ -4,7 +4,7 @@
  *
  *   PS Hinter error codes (specification only).
  *
- * Copyright (C) 2003-2023 by
+ * Copyright (C) 2003-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/pshinter/pshrec.c b/src/java.desktop/share/native/libfreetype/src/pshinter/pshrec.c
index 680e6d013588..0b2b549fc296 100644
--- a/src/java.desktop/share/native/libfreetype/src/pshinter/pshrec.c
+++ b/src/java.desktop/share/native/libfreetype/src/pshinter/pshrec.c
@@ -4,7 +4,7 @@
  *
  *   FreeType PostScript hints recorder (body).
  *
- * Copyright (C) 2001-2023 by
+ * Copyright (C) 2001-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -806,7 +806,7 @@
   ps_hints_stem( PS_Hints  hints,
                  FT_UInt   dimension,
                  FT_Int    count,
-                 FT_Long*  stems )
+                 FT_Pos*   stems )
   {
     PS_Dimension  dim;
 
diff --git a/src/java.desktop/share/native/libfreetype/src/pshinter/pshrec.h b/src/java.desktop/share/native/libfreetype/src/pshinter/pshrec.h
index 0b2484af1210..7e375af7ba87 100644
--- a/src/java.desktop/share/native/libfreetype/src/pshinter/pshrec.h
+++ b/src/java.desktop/share/native/libfreetype/src/pshinter/pshrec.h
@@ -4,7 +4,7 @@
  *
  *   Postscript (Type1/Type2) hints recorder (specification).
  *
- * Copyright (C) 2001-2023 by
+ * Copyright (C) 2001-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/psnames/psmodule.c b/src/java.desktop/share/native/libfreetype/src/psnames/psmodule.c
index 8203a0465d25..35d054d1cfb6 100644
--- a/src/java.desktop/share/native/libfreetype/src/psnames/psmodule.c
+++ b/src/java.desktop/share/native/libfreetype/src/psnames/psmodule.c
@@ -4,7 +4,7 @@
  *
  *   psnames module implementation (body).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/psnames/psmodule.h b/src/java.desktop/share/native/libfreetype/src/psnames/psmodule.h
index 0904700bfb8d..770458316b1e 100644
--- a/src/java.desktop/share/native/libfreetype/src/psnames/psmodule.h
+++ b/src/java.desktop/share/native/libfreetype/src/psnames/psmodule.h
@@ -4,7 +4,7 @@
  *
  *   High-level psnames module interface (specification).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/psnames/psnamerr.h b/src/java.desktop/share/native/libfreetype/src/psnames/psnamerr.h
index 0073f8228486..e123eb65e393 100644
--- a/src/java.desktop/share/native/libfreetype/src/psnames/psnamerr.h
+++ b/src/java.desktop/share/native/libfreetype/src/psnames/psnamerr.h
@@ -4,7 +4,7 @@
  *
  *   PS names module error codes (specification only).
  *
- * Copyright (C) 2001-2023 by
+ * Copyright (C) 2001-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/psnames/pstables.h b/src/java.desktop/share/native/libfreetype/src/psnames/pstables.h
index 7f92cce60396..2a941b046096 100644
--- a/src/java.desktop/share/native/libfreetype/src/psnames/pstables.h
+++ b/src/java.desktop/share/native/libfreetype/src/psnames/pstables.h
@@ -4,7 +4,7 @@
  *
  *   PostScript glyph names.
  *
- * Copyright (C) 2005-2023 by
+ * Copyright (C) 2005-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/raster/ftmisc.h b/src/java.desktop/share/native/libfreetype/src/raster/ftmisc.h
index 33dbfd631e92..943f2aa0a50a 100644
--- a/src/java.desktop/share/native/libfreetype/src/raster/ftmisc.h
+++ b/src/java.desktop/share/native/libfreetype/src/raster/ftmisc.h
@@ -5,7 +5,7 @@
  *   Miscellaneous macros for stand-alone rasterizer (specification
  *   only).
  *
- * Copyright (C) 2005-2023 by
+ * Copyright (C) 2005-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used
@@ -92,27 +92,6 @@
 #endif
 
 
-  static FT_Long
-  FT_MulDiv( FT_Long  a,
-             FT_Long  b,
-             FT_Long  c )
-  {
-    FT_Int   s;
-    FT_Long  d;
-
-
-    s = 1;
-    if ( a < 0 ) { a = -a; s = -1; }
-    if ( b < 0 ) { b = -b; s = -s; }
-    if ( c < 0 ) { c = -c; s = -s; }
-
-    d = (FT_Long)( c > 0 ? ( (FT_Int64)a * b + ( c >> 1 ) ) / c
-                         : 0x7FFFFFFFL );
-
-    return ( s > 0 ) ? d : -d;
-  }
-
-
   static FT_Long
   FT_MulDiv_No_Round( FT_Long  a,
                       FT_Long  b,
diff --git a/src/java.desktop/share/native/libfreetype/src/raster/ftraster.c b/src/java.desktop/share/native/libfreetype/src/raster/ftraster.c
index 192ca0701a24..e4b7b937d5a8 100644
--- a/src/java.desktop/share/native/libfreetype/src/raster/ftraster.c
+++ b/src/java.desktop/share/native/libfreetype/src/raster/ftraster.c
@@ -4,7 +4,7 @@
  *
  *   The FreeType glyph rasterizer (body).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -63,8 +63,7 @@
 #else /* !STANDALONE_ */
 
 #include "ftraster.h"
-#include  /* for FT_MulDiv and FT_MulDiv_No_Round */
-#include          /* for FT_Outline_Get_CBox              */
+#include  /* for FT_MulDiv_No_Round */
 
 #endif /* !STANDALONE_ */
 
@@ -115,12 +114,12 @@
    *   a change of direction is detected in the outline, a new profile is
    *   generated until the end of the outline.
    *
-   *   Note that when all profiles have been generated, the function
-   *   Finalize_Profile_Table() is used to record, for each profile, its
-   *   bottom-most scanline as well as the scanline above its upmost
-   *   boundary.  These positions are called `y-turns' because they (sort
-   *   of) correspond to local extrema.  They are stored in a sorted list
-   *   built from the top of the render pool as a downwards stack:
+   *   Note that, for all generated profiles, the function End_Profile()
+   *   is used to record all their bottom-most scanlines as well as the
+   *   scanline above their upmost boundary.  These positions are called
+   *   `y-turns' because they (sort of) correspond to local extrema.
+   *   They are stored in a sorted list built from the top of the render
+   *   pool as a downwards stack:
    *
    *     _ _ _______________________________________
    *                           |                    |
@@ -136,7 +135,7 @@
    *   optimize performance (see technical note on the sweep below).
    *
    *   Of course, the raster detects whether the two stacks collide and
-   *   handles the situation properly.
+   *   handles the situation by bisecting the job and restarting.
    *
    */
 
@@ -252,7 +251,6 @@
   /* On the other hand, SMulDiv means `Slow MulDiv', and is used typically */
   /* for clipping computations.  It simply uses the FT_MulDiv() function   */
   /* defined in `ftcalc.h'.                                                */
-#define SMulDiv           FT_MulDiv
 #define SMulDiv_No_Round  FT_MulDiv_No_Round
 
   /* The rasterizer is a very general purpose component; please leave */
@@ -305,16 +303,6 @@
   typedef unsigned char   Byte, *PByte;
   typedef char            Bool;
 
-
-  typedef union  Alignment_
-  {
-    Long    l;
-    void*   p;
-    void  (*f)(void);
-
-  } Alignment, *PAlignment;
-
-
   typedef struct  TPoint_
   {
     Long  x;
@@ -327,6 +315,7 @@
 #define Flow_Up           0x08U
 #define Overshoot_Top     0x10U
 #define Overshoot_Bottom  0x20U
+#define Dropout           0x40U
 
 
   /* States of each line, arc, and profile */
@@ -345,31 +334,28 @@
 
   struct  TProfile_
   {
-    FT_F26Dot6  X;           /* current coordinate during sweep          */
     PProfile    link;        /* link to next profile (various purposes)  */
-    PLong       offset;      /* start of profile's data in render pool   */
+    PProfile    next;        /* next profile in same contour, used       */
+                             /* during drop-out control                  */
+    Int         offset;      /* bottom or currently scanned array index  */
+    Int         height;      /* profile's height in scanlines            */
+    Int         start;       /* profile's starting scanline, also use    */
+                             /* as activation counter                    */
     UShort      flags;       /* Bit 0-2: drop-out mode                   */
                              /* Bit 3: profile orientation (up/down)     */
                              /* Bit 4: is top profile?                   */
                              /* Bit 5: is bottom profile?                */
-    Long        height;      /* profile's height in scanlines            */
-    Long        start;       /* profile's starting scanline              */
+                             /* Bit 6: dropout detected                  */
 
-    Int         countL;      /* number of lines to step before this      */
-                             /* profile becomes drawable                 */
-
-    PProfile    next;        /* next profile in same contour, used       */
-                             /* during drop-out control                  */
+    FT_F26Dot6  X;           /* current coordinate during sweep          */
+    Long        x[1];        /* actually variable array of scanline      */
+                             /* intersections with `height` elements     */
   };
 
   typedef PProfile   TProfileList;
   typedef PProfile*  PProfileList;
 
 
-#define AlignProfileSize \
-  ( ( sizeof ( TProfile ) + sizeof ( Alignment ) - 1 ) / sizeof ( Long ) )
-
-
 #undef RAS_ARG
 #undef RAS_ARGS
 #undef RAS_VAR
@@ -407,15 +393,13 @@
 
   /* prototypes used for sweep function dispatch */
   typedef void
-  Function_Sweep_Init( RAS_ARGS Short  min,
-                                Short  max );
+  Function_Sweep_Init( RAS_ARGS Int  min,
+                                Int  max );
 
   typedef void
-  Function_Sweep_Span( RAS_ARGS Short       y,
+  Function_Sweep_Span( RAS_ARGS Int         y,
                                 FT_F26Dot6  x1,
-                                FT_F26Dot6  x2,
-                                PProfile    left,
-                                PProfile    right );
+                                FT_F26Dot6  x2 );
 
   typedef void
   Function_Sweep_Step( RAS_ARG );
@@ -441,8 +425,7 @@
           (Bool)( x - FLOOR( x ) >= ras.precision_half )
 
   /* Smart dropout rounding to find which pixel is closer to span ends. */
-  /* To mimick Windows, symmetric cases break down indepenently of the  */
-  /* precision.                                                         */
+  /* To mimic Windows, symmetric cases do not depend on the precision.  */
 #define SMART( p, q )  FLOOR( ( (p) + (q) + ras.precision * 63 / 64 ) >> 1 )
 
 #if FT_RENDER_POOL_SIZE > 2048
@@ -462,7 +445,6 @@
     Int         precision_half;
     Int         precision_scale;
     Int         precision_step;
-    Int         precision_jitter;
 
     PLong       buff;               /* The profiles buffer                 */
     PLong       sizeBuff;           /* Render pool size                    */
@@ -471,24 +453,14 @@
 
     FT_Error    error;
 
-    Int         numTurns;           /* number of Y-turns in outline        */
-
     Byte        dropOutControl;     /* current drop_out control method     */
 
-    UShort      bWidth;             /* target bitmap width                 */
-    PByte       bOrigin;            /* target bitmap bottom-left origin    */
-    PByte       bLine;              /* target bitmap current line          */
-
     Long        lastX, lastY;
     Long        minY, maxY;
 
     UShort      num_Profs;          /* current number of profiles          */
+    Int         numTurns;           /* number of Y-turns in outline        */
 
-    Bool        fresh;              /* signals a fresh new profile which   */
-                                    /* `start' field must be completed     */
-    Bool        joint;              /* signals that the last arc ended     */
-                                    /* exactly on a scanline.  Allows      */
-                                    /* removal of doublets                 */
     PProfile    cProfile;           /* current profile                     */
     PProfile    fProfile;           /* head of linked list of profiles     */
     PProfile    gProfile;           /* contour's first profile in case     */
@@ -496,9 +468,14 @@
 
     TStates     state;              /* rendering state                     */
 
-    FT_Bitmap   target;             /* description of target bit/pixmap    */
     FT_Outline  outline;
 
+    Int         bTop;               /* target bitmap max line  index       */
+    Int         bRight;             /* target bitmap rightmost index       */
+    Int         bPitch;             /* target bitmap pitch                 */
+    PByte       bOrigin;            /* target bitmap bottom-left origin    */
+    PByte       bLine;              /* target bitmap current line          */
+
     /* dispatch variables */
 
     Function_Sweep_Init*  Proc_Sweep_Init;
@@ -563,37 +540,82 @@
      *
      *   256 / (1 << 12) = 0.0625 pixels.
      *
-     * `precision_jitter' is an epsilon threshold used in
-     * `Vertical_Sweep_Span' to deal with small imperfections in the Bezier
-     * decomposition (after all, we are working with approximations only);
-     * it avoids switching on additional pixels which would cause artifacts
-     * otherwise.
-     *
-     * The value of `precision_jitter' has been determined heuristically.
-     *
      */
 
     if ( High )
     {
       ras.precision_bits   = 12;
       ras.precision_step   = 256;
-      ras.precision_jitter = 30;
     }
     else
     {
       ras.precision_bits   = 6;
       ras.precision_step   = 32;
-      ras.precision_jitter = 2;
     }
 
-    FT_TRACE6(( "Set_High_Precision(%s)\n", High ? "true" : "false" ));
-
     ras.precision       = 1 << ras.precision_bits;
     ras.precision_half  = ras.precision >> 1;
     ras.precision_scale = ras.precision >> Pixel_Bits;
   }
 
 
+  /**************************************************************************
+   *
+   * @Function:
+   *   Insert_Y_Turn
+   *
+   * @Description:
+   *   Insert a salient into the sorted list placed on top of the render
+   *   pool.
+   *
+   * @Input:
+   *   New y scanline position.
+   *
+   * @Return:
+   *   SUCCESS on success.  FAILURE in case of overflow.
+   */
+  static Bool
+  Insert_Y_Turns( RAS_ARGS Int  y,
+                           Int  top )
+  {
+    Int    n       = ras.numTurns;
+    PLong  y_turns = ras.maxBuff;
+
+
+    /* update top value */
+    if ( n == 0 || top > y_turns[n] )
+      y_turns[n] = top;
+
+    /* look for first y value that is <= */
+    while ( n-- && y < y_turns[n] )
+      ;
+
+    /* if it is <, simply insert it, ignore if == */
+    if ( n < 0 || y > y_turns[n] )
+    {
+      ras.maxBuff--;
+      if ( ras.maxBuff <= ras.top )
+      {
+        ras.error = FT_THROW( Raster_Overflow );
+        return FAILURE;
+      }
+
+      do
+      {
+        Int  y2 = (Int)y_turns[n];
+
+
+        y_turns[n] = y;
+        y = y2;
+      } while ( n-- >= 0 );
+
+      ras.numTurns++;
+    }
+
+    return SUCCESS;
+  }
+
+
   /**************************************************************************
    *
    * @Function:
@@ -606,52 +628,48 @@
    *   aState ::
    *     The state/orientation of the new profile.
    *
-   *   overshoot ::
-   *     Whether the profile's unrounded start position
-   *     differs by at least a half pixel.
-   *
    * @Return:
    *  SUCCESS on success.  FAILURE in case of overflow or of incoherent
    *  profile.
    */
   static Bool
-  New_Profile( RAS_ARGS TStates  aState,
-                        Bool     overshoot )
+  New_Profile( RAS_ARGS TStates  aState )
   {
-    if ( !ras.fProfile )
+    Long  e;
+
+
+    if ( !ras.cProfile || ras.cProfile->height )
     {
       ras.cProfile  = (PProfile)ras.top;
-      ras.fProfile  = ras.cProfile;
-      ras.top      += AlignProfileSize;
-    }
+      ras.top       = ras.cProfile->x;
 
-    if ( ras.top >= ras.maxBuff )
-    {
-      ras.error = FT_THROW( Raster_Overflow );
-      return FAILURE;
+      if ( ras.top >= ras.maxBuff )
+      {
+        FT_TRACE1(( "overflow in New_Profile\n" ));
+        ras.error = FT_THROW( Raster_Overflow );
+        return FAILURE;
+      }
+
+      ras.cProfile->height = 0;
     }
 
-    ras.cProfile->start  = 0;
-    ras.cProfile->height = 0;
-    ras.cProfile->offset = ras.top;
-    ras.cProfile->link   = (PProfile)0;
-    ras.cProfile->next   = (PProfile)0;
     ras.cProfile->flags  = ras.dropOutControl;
 
     switch ( aState )
     {
     case Ascending_State:
       ras.cProfile->flags |= Flow_Up;
-      if ( overshoot )
+      if ( IS_BOTTOM_OVERSHOOT( ras.lastY ) )
         ras.cProfile->flags |= Overshoot_Bottom;
 
-      FT_TRACE6(( "  new ascending profile = %p\n", (void *)ras.cProfile ));
+      e = CEILING( ras.lastY );
       break;
 
     case Descending_State:
-      if ( overshoot )
+      if ( IS_TOP_OVERSHOOT( ras.lastY ) )
         ras.cProfile->flags |= Overshoot_Top;
-      FT_TRACE6(( "  new descending profile = %p\n", (void *)ras.cProfile ));
+
+      e = FLOOR( ras.lastY );
       break;
 
     default:
@@ -660,12 +678,20 @@
       return FAILURE;
     }
 
-    if ( !ras.gProfile )
-      ras.gProfile = ras.cProfile;
+    if ( e > ras.maxY )
+      e = ras.maxY;
+    if ( e < ras.minY )
+      e = ras.minY;
+    ras.cProfile->start = (Int)TRUNC( e );
+
+    FT_TRACE7(( "  new %s profile = %p, start = %d\n",
+                aState == Ascending_State ? "ascending" : "descending",
+                (void *)ras.cProfile, ras.cProfile->start ));
+
+    if ( ras.lastY == e )
+      *ras.top++ = ras.lastX;
 
     ras.state = aState;
-    ras.fresh = TRUE;
-    ras.joint = FALSE;
 
     return SUCCESS;
   }
@@ -677,24 +703,19 @@
    *   End_Profile
    *
    * @Description:
-   *   Finalize the current profile.
-   *
-   * @Input:
-   *   overshoot ::
-   *     Whether the profile's unrounded end position differs
-   *     by at least a half pixel.
+   *   Finalize the current profile and record y-turns.
    *
    * @Return:
    *   SUCCESS on success.  FAILURE in case of overflow or incoherency.
    */
   static Bool
-  End_Profile( RAS_ARGS Bool  overshoot )
+  End_Profile( RAS_ARG )
   {
-    Long  h;
+    PProfile  p = ras.cProfile;
+    Int       h = (Int)( ras.top - p->x );
+    Int       bottom, top;
 
 
-    h = (Long)( ras.top - ras.cProfile->offset );
-
     if ( h < 0 )
     {
       FT_ERROR(( "End_Profile: negative height encountered\n" ));
@@ -704,98 +725,46 @@
 
     if ( h > 0 )
     {
-      PProfile  oldProfile;
+      FT_TRACE7(( "  ending profile %p, start = %2d, height = %+3d\n",
+                  (void *)p, p->start, p->flags & Flow_Up ? h : -h ));
 
+      p->height = h;
 
-      FT_TRACE6(( "  ending profile %p, start = %ld, height = %ld\n",
-                  (void *)ras.cProfile, ras.cProfile->start, h ));
+      if ( p->flags & Flow_Up )
+      {
+        if ( IS_TOP_OVERSHOOT( ras.lastY ) )
+          p->flags |= Overshoot_Top;
 
-      ras.cProfile->height = h;
-      if ( overshoot )
+        bottom    = p->start;
+        top       = bottom + h;
+        p->offset = 0;
+        p->X      = p->x[0];
+      }
+      else
       {
-        if ( ras.cProfile->flags & Flow_Up )
-          ras.cProfile->flags |= Overshoot_Top;
-        else
-          ras.cProfile->flags |= Overshoot_Bottom;
+        if ( IS_BOTTOM_OVERSHOOT( ras.lastY ) )
+          p->flags |= Overshoot_Bottom;
+
+        top       = p->start + 1;
+        bottom    = top - h;
+        p->start  = bottom;
+        p->offset = h - 1;
+        p->X      = p->x[h - 1];
       }
 
-      oldProfile   = ras.cProfile;
-      ras.cProfile = (PProfile)ras.top;
+      if ( Insert_Y_Turns( RAS_VARS bottom, top ) )
+        return FAILURE;
 
-      ras.top += AlignProfileSize;
+      if ( !ras.gProfile )
+        ras.gProfile = p;
 
-      ras.cProfile->height = 0;
-      ras.cProfile->offset = ras.top;
+      /* preliminary values to be finalized */
+      p->next = ras.gProfile;
+      p->link = (PProfile)ras.top;
 
-      oldProfile->next = ras.cProfile;
       ras.num_Profs++;
     }
 
-    if ( ras.top >= ras.maxBuff )
-    {
-      FT_TRACE1(( "overflow in End_Profile\n" ));
-      ras.error = FT_THROW( Raster_Overflow );
-      return FAILURE;
-    }
-
-    ras.joint = FALSE;
-
-    return SUCCESS;
-  }
-
-
-  /**************************************************************************
-   *
-   * @Function:
-   *   Insert_Y_Turn
-   *
-   * @Description:
-   *   Insert a salient into the sorted list placed on top of the render
-   *   pool.
-   *
-   * @Input:
-   *   New y scanline position.
-   *
-   * @Return:
-   *   SUCCESS on success.  FAILURE in case of overflow.
-   */
-  static Bool
-  Insert_Y_Turn( RAS_ARGS Int  y )
-  {
-    PLong  y_turns;
-    Int    n;
-
-
-    n       = ras.numTurns - 1;
-    y_turns = ras.sizeBuff - ras.numTurns;
-
-    /* look for first y value that is <= */
-    while ( n >= 0 && y < y_turns[n] )
-      n--;
-
-    /* if it is <, simply insert it, ignore if == */
-    if ( n >= 0 && y > y_turns[n] )
-      do
-      {
-        Int  y2 = (Int)y_turns[n];
-
-
-        y_turns[n] = y;
-        y = y2;
-      } while ( --n >= 0 );
-
-    if ( n < 0 )
-    {
-      ras.maxBuff--;
-      if ( ras.maxBuff <= ras.top )
-      {
-        ras.error = FT_THROW( Raster_Overflow );
-        return FAILURE;
-      }
-      ras.numTurns++;
-      ras.sizeBuff[-ras.numTurns] = y;
-    }
-
     return SUCCESS;
   }
 
@@ -807,56 +776,29 @@
    *
    * @Description:
    *   Adjust all links in the profiles list.
-   *
-   * @Return:
-   *   SUCCESS on success.  FAILURE in case of overflow.
    */
-  static Bool
+  static void
   Finalize_Profile_Table( RAS_ARG )
   {
-    UShort    n;
-    PProfile  p;
-
+    UShort    n = ras.num_Profs;
+    PProfile  p = ras.fProfile;
+    PProfile  q;
 
-    n = ras.num_Profs;
-    p = ras.fProfile;
 
-    if ( n > 1 && p )
+    /* there should be at least two profiles, up and down */
+    while ( --n )
     {
-      do
-      {
-        Int  bottom, top;
+      q = p->link;
 
+      /* fix the contour loop */
+      if ( q->next == p->next )
+        p->next = q;
 
-        if ( n > 1 )
-          p->link = (PProfile)( p->offset + p->height );
-        else
-          p->link = NULL;
-
-        if ( p->flags & Flow_Up )
-        {
-          bottom = (Int)p->start;
-          top    = (Int)( p->start + p->height - 1 );
-        }
-        else
-        {
-          bottom     = (Int)( p->start - p->height + 1 );
-          top        = (Int)p->start;
-          p->start   = bottom;
-          p->offset += p->height - 1;
-        }
-
-        if ( Insert_Y_Turn( RAS_VARS bottom )  ||
-             Insert_Y_Turn( RAS_VARS top + 1 ) )
-          return FAILURE;
-
-        p = p->link;
-      } while ( --n );
+      p = q;
     }
-    else
-      ras.fProfile = NULL;
 
-    return SUCCESS;
+    /* null-terminate */
+    p->link = NULL;
   }
 
 
@@ -986,107 +928,78 @@
                     Long  miny,
                     Long  maxy )
   {
-    Long   Dx, Dy;
-    Int    e1, e2, f1, f2, size;     /* XXX: is `Short' sufficient? */
-    Long   Ix, Rx, Ax;
+    Long  e, e2, Dx, Dy;
+    Long  Ix, Rx, Ax;
+    Int   size;
 
     PLong  top;
 
 
-    Dx = x2 - x1;
-    Dy = y2 - y1;
-
-    if ( Dy <= 0 || y2 < miny || y1 > maxy )
+    if ( y2 < miny || y1 > maxy )
       return SUCCESS;
 
-    if ( y1 < miny )
-    {
-      /* Take care: miny-y1 can be a very large value; we use     */
-      /*            a slow MulDiv function to avoid clipping bugs */
-      x1 += SMulDiv( Dx, miny - y1, Dy );
-      e1  = (Int)TRUNC( miny );
-      f1  = 0;
-    }
-    else
-    {
-      e1 = (Int)TRUNC( y1 );
-      f1 = (Int)FRAC( y1 );
-    }
+    e2 = y2 > maxy ? maxy : FLOOR( y2 );
+    e  = y1 < miny ? miny : CEILING( y1 );
 
-    if ( y2 > maxy )
-    {
-      /* x2 += FMulDiv( Dx, maxy - y2, Dy );  UNNECESSARY */
-      e2  = (Int)TRUNC( maxy );
-      f2  = 0;
-    }
-    else
-    {
-      e2 = (Int)TRUNC( y2 );
-      f2 = (Int)FRAC( y2 );
-    }
+    if ( y1 == e )
+      e += ras.precision;
 
-    if ( f1 > 0 )
-    {
-      if ( e1 == e2 )
-        return SUCCESS;
-      else
-      {
-        x1 += SMulDiv( Dx, ras.precision - f1, Dy );
-        e1 += 1;
-      }
-    }
-    else
-      if ( ras.joint )
-      {
-        ras.top--;
-        ras.joint = FALSE;
-      }
-
-    ras.joint = (char)( f2 == 0 );
+    if ( e2 < e )  /* nothing to do */
+      return SUCCESS;
 
-    if ( ras.fresh )
-    {
-      ras.cProfile->start = e1;
-      ras.fresh           = FALSE;
-    }
+    size = (Int)TRUNC( e2 - e ) + 1;
+    top  = ras.top;
 
-    size = e2 - e1 + 1;
-    if ( ras.top + size >= ras.maxBuff )
+    if ( top + size >= ras.maxBuff )
     {
       ras.error = FT_THROW( Raster_Overflow );
       return FAILURE;
     }
 
-    if ( Dx > 0 )
-    {
-      Ix = SMulDiv_No_Round( ras.precision, Dx, Dy );
-      Rx = ( ras.precision * Dx ) % Dy;
-      Dx = 1;
-    }
-    else
+    Dx = x2 - x1;
+    Dy = y2 - y1;
+
+    if ( Dx == 0 )  /* very easy */
     {
-      Ix = -SMulDiv_No_Round( ras.precision, -Dx, Dy );
-      Rx = ( ras.precision * -Dx ) % Dy;
-      Dx = -1;
+      do
+        *top++ = x1;
+      while ( --size );
+      goto Fin;
     }
 
-    Ax  = -Dy;
-    top = ras.top;
+    Ix     = SMulDiv_No_Round( e - y1, Dx, Dy );
+    x1    += Ix;
+    *top++ = x1;
 
-    while ( size > 0 )
+    if ( --size )
     {
-      *top++ = x1;
+      Ax = Dx * ( e - y1 )    - Dy * Ix;  /* remainder */
+      Ix = FMulDiv( ras.precision, Dx, Dy );
+      Rx = Dx * ras.precision - Dy * Ix;  /* remainder */
+      Dx = 1;
 
-      x1 += Ix;
-      Ax += Rx;
-      if ( Ax >= 0 )
+      if ( x2 < x1 )
+      {
+        Ax = -Ax;
+        Rx = -Rx;
+        Dx = -Dx;
+      }
+
+      do
       {
-        Ax -= Dy;
-        x1 += Dx;
+        x1 += Ix;
+        Ax += Rx;
+        if ( Ax >= Dy )
+        {
+          Ax -= Dy;
+          x1 += Dx;
+        }
+        *top++ = x1;
       }
-      size--;
+      while ( --size );
     }
 
+  Fin:
     ras.top = top;
     return SUCCESS;
   }
@@ -1131,17 +1044,7 @@
                       Long  miny,
                       Long  maxy )
   {
-    Bool  result, fresh;
-
-
-    fresh  = ras.fresh;
-
-    result = Line_Up( RAS_VARS x1, -y1, x2, -y2, -maxy, -miny );
-
-    if ( fresh && !ras.fresh )
-      ras.cProfile->start = -ras.cProfile->start;
-
-    return result;
+    return Line_Up( RAS_VARS x1, -y1, x2, -y2, -maxy, -miny );
   }
 
 
@@ -1181,105 +1084,73 @@
                       Long       miny,
                       Long       maxy )
   {
-    Long   y1, y2, e, e2, e0;
-    Short  f1;
+    Long  y1, y2, e, e2, dy;
+    Long  dx, x2;
 
-    TPoint*  start_arc;
-
-    PLong top;
+    PLong  top;
 
 
     y1  = arc[degree].y;
     y2  = arc[0].y;
-    top = ras.top;
 
     if ( y2 < miny || y1 > maxy )
-      goto Fin;
-
-    e2 = FLOOR( y2 );
-
-    if ( e2 > maxy )
-      e2 = maxy;
-
-    e0 = miny;
-
-    if ( y1 < miny )
-      e = miny;
-    else
-    {
-      e  = CEILING( y1 );
-      f1 = (Short)( FRAC( y1 ) );
-      e0 = e;
-
-      if ( f1 == 0 )
-      {
-        if ( ras.joint )
-        {
-          top--;
-          ras.joint = FALSE;
-        }
+      return SUCCESS;
 
-        *top++ = arc[degree].x;
+    e2 = y2 > maxy ? maxy : FLOOR( y2 );
+    e  = y1 < miny ? miny : CEILING( y1 );
 
-        e += ras.precision;
-      }
-    }
+    if ( y1 == e )
+      e += ras.precision;
 
-    if ( ras.fresh )
-    {
-      ras.cProfile->start = TRUNC( e0 );
-      ras.fresh = FALSE;
-    }
+    if ( e2 < e )  /* nothing to do */
+      return SUCCESS;
 
-    if ( e2 < e )
-      goto Fin;
+    top = ras.top;
 
     if ( ( top + TRUNC( e2 - e ) + 1 ) >= ras.maxBuff )
     {
-      ras.top   = top;
       ras.error = FT_THROW( Raster_Overflow );
       return FAILURE;
     }
 
-    start_arc = arc;
-
     do
     {
-      ras.joint = FALSE;
-
       y2 = arc[0].y;
+      x2 = arc[0].x;
 
       if ( y2 > e )
       {
-        y1 = arc[degree].y;
-        if ( y2 - y1 >= ras.precision_step )
+        dy = y2 - arc[degree].y;
+        dx = x2 - arc[degree].x;
+
+        /* split condition should be invariant of direction */
+        if (  dy > ras.precision_step ||
+              dx > ras.precision_step ||
+             -dx > ras.precision_step )
         {
           splitter( arc );
           arc += degree;
         }
         else
         {
-          *top++ = arc[degree].x + FMulDiv( arc[0].x - arc[degree].x,
-                                            e - y1, y2 - y1 );
+          *top++ = x2 - FMulDiv( y2 - e, dx, dy );
+          e     += ras.precision;
           arc -= degree;
-          e   += ras.precision;
         }
       }
       else
       {
         if ( y2 == e )
         {
-          ras.joint  = TRUE;
-          *top++     = arc[0].x;
-
-          e += ras.precision;
+          *top++ = x2;
+          e     += ras.precision;
         }
-        arc -= degree;
+        arc   -= degree;
       }
-    } while ( arc >= start_arc && e <= e2 );
+    }
+    while ( e <= e2 );
 
-  Fin:
-    ras.top  = top;
+    ras.top = top;
     return SUCCESS;
   }
 
@@ -1316,7 +1187,7 @@
                         Long       miny,
                         Long       maxy )
   {
-    Bool     result, fresh;
+    Bool  result;
 
 
     arc[0].y = -arc[0].y;
@@ -1325,13 +1196,8 @@
     if ( degree > 2 )
       arc[3].y = -arc[3].y;
 
-    fresh = ras.fresh;
-
     result = Bezier_Up( RAS_VARS degree, arc, splitter, -maxy, -miny );
 
-    if ( fresh && !ras.fresh )
-      ras.cProfile->start = -ras.cProfile->start;
-
     arc[0].y = -arc[0].y;
     return result;
   }
@@ -1362,74 +1228,50 @@
   Line_To( RAS_ARGS Long  x,
                     Long  y )
   {
-    /* First, detect a change of direction */
+    TStates  state;
 
-    switch ( ras.state )
-    {
-    case Unknown_State:
-      if ( y > ras.lastY )
-      {
-        if ( New_Profile( RAS_VARS Ascending_State,
-                                   IS_BOTTOM_OVERSHOOT( ras.lastY ) ) )
-          return FAILURE;
-      }
-      else
-      {
-        if ( y < ras.lastY )
-          if ( New_Profile( RAS_VARS Descending_State,
-                                     IS_TOP_OVERSHOOT( ras.lastY ) ) )
-            return FAILURE;
-      }
-      break;
 
-    case Ascending_State:
-      if ( y < ras.lastY )
-      {
-        if ( End_Profile( RAS_VARS IS_TOP_OVERSHOOT( ras.lastY ) ) ||
-             New_Profile( RAS_VARS Descending_State,
-                                   IS_TOP_OVERSHOOT( ras.lastY ) ) )
-          return FAILURE;
-      }
-      break;
+    if ( y == ras.lastY )
+      goto Fin;
 
-    case Descending_State:
-      if ( y > ras.lastY )
-      {
-        if ( End_Profile( RAS_VARS IS_BOTTOM_OVERSHOOT( ras.lastY ) ) ||
-             New_Profile( RAS_VARS Ascending_State,
-                                   IS_BOTTOM_OVERSHOOT( ras.lastY ) ) )
-          return FAILURE;
-      }
-      break;
+    /* First, detect a change of direction */
 
-    default:
-      ;
+    state = ras.lastY < y ? Ascending_State : Descending_State;
+
+    if ( ras.state != state )
+    {
+      /* finalize current profile if any */
+      if ( ras.state != Unknown_State &&
+           End_Profile( RAS_VAR )     )
+        goto Fail;
+
+      /* create a new profile */
+      if ( New_Profile( RAS_VARS state ) )
+        goto Fail;
     }
 
     /* Then compute the lines */
 
-    switch ( ras.state )
+    if ( state == Ascending_State )
     {
-    case Ascending_State:
       if ( Line_Up( RAS_VARS ras.lastX, ras.lastY,
                              x, y, ras.minY, ras.maxY ) )
-        return FAILURE;
-      break;
-
-    case Descending_State:
+        goto Fail;
+    }
+    else
+    {
       if ( Line_Down( RAS_VARS ras.lastX, ras.lastY,
                                x, y, ras.minY, ras.maxY ) )
-        return FAILURE;
-      break;
-
-    default:
-      ;
+        goto Fail;
     }
 
+  Fin:
     ras.lastX = x;
     ras.lastY = y;
-
     return SUCCESS;
+
+  Fail:
+    return FAILURE;
   }
 
 
@@ -1500,7 +1342,7 @@
         ymax = y1;
       }
 
-      if ( y2 < ymin || y2 > ymax )
+      if ( y2 < FLOOR( ymin ) || y2 > CEILING( ymax ) )
       {
         /* this arc has no given direction, split it! */
         Split_Conic( arc );
@@ -1508,8 +1350,12 @@
       }
       else if ( y1 == y3 )
       {
-        /* this arc is flat, ignore it and pop it from the Bezier stack */
+        /* this arc is flat, advance position */
+        /* and pop it from the Bezier stack   */
         arc -= 2;
+
+        ras.lastX = x3;
+        ras.lastY = y3;
       }
       else
       {
@@ -1518,18 +1364,13 @@
         state_bez = y1 < y3 ? Ascending_State : Descending_State;
         if ( ras.state != state_bez )
         {
-          Bool  o = ( state_bez == Ascending_State )
-                      ? IS_BOTTOM_OVERSHOOT( y1 )
-                      : IS_TOP_OVERSHOOT( y1 );
-
-
           /* finalize current profile if any */
           if ( ras.state != Unknown_State &&
-               End_Profile( RAS_VARS o )  )
+               End_Profile( RAS_VAR )     )
             goto Fail;
 
           /* create a new profile */
-          if ( New_Profile( RAS_VARS state_bez, o ) )
+          if ( New_Profile( RAS_VARS state_bez ) )
             goto Fail;
         }
 
@@ -1545,13 +1386,13 @@
                                      ras.minY, ras.maxY ) )
             goto Fail;
         arc -= 2;
+
+        ras.lastX = x3;
+        ras.lastY = y3;
       }
 
     } while ( arc >= arcs );
 
-    ras.lastX = x3;
-    ras.lastY = y3;
-
     return SUCCESS;
 
   Fail:
@@ -1648,7 +1489,7 @@
         ymax2 = y2;
       }
 
-      if ( ymin2 < ymin1 || ymax2 > ymax1 )
+      if ( ymin2 < FLOOR( ymin1 ) || ymax2 > CEILING( ymax1 ) )
       {
         /* this arc has no given direction, split it! */
         Split_Cubic( arc );
@@ -1656,27 +1497,26 @@
       }
       else if ( y1 == y4 )
       {
-        /* this arc is flat, ignore it and pop it from the Bezier stack */
+        /* this arc is flat, advance position */
+        /* and pop it from the Bezier stack   */
         arc -= 3;
+
+        ras.lastX = x4;
+        ras.lastY = y4;
       }
       else
       {
-        state_bez = ( y1 <= y4 ) ? Ascending_State : Descending_State;
+        state_bez = y1 < y4 ? Ascending_State : Descending_State;
 
         /* detect a change of direction */
         if ( ras.state != state_bez )
         {
-          Bool  o = ( state_bez == Ascending_State )
-                      ? IS_BOTTOM_OVERSHOOT( y1 )
-                      : IS_TOP_OVERSHOOT( y1 );
-
-
           /* finalize current profile if any */
           if ( ras.state != Unknown_State &&
-               End_Profile( RAS_VARS o )  )
+               End_Profile( RAS_VAR )     )
             goto Fail;
 
-          if ( New_Profile( RAS_VARS state_bez, o ) )
+          if ( New_Profile( RAS_VARS state_bez ) )
             goto Fail;
         }
 
@@ -1692,13 +1532,13 @@
                                      ras.minY, ras.maxY ) )
             goto Fail;
         arc -= 3;
+
+        ras.lastX = x4;
+        ras.lastY = y4;
       }
 
     } while ( arc >= arcs );
 
-    ras.lastX = x4;
-    ras.lastY = y4;
-
     return SUCCESS;
 
   Fail:
@@ -1740,6 +1580,11 @@
    *
    * @Return:
    *   SUCCESS on success, FAILURE on error.
+   *
+   * @Note:
+   *   Unlike FT_Outline_Decompose(), this function handles the scanmode
+   *   dropout tags in the individual contours.  Therefore, it cannot be
+   *   replaced.
    */
   static Bool
   Decompose_Curve( RAS_ARGS Int  first,
@@ -1753,7 +1598,7 @@
     FT_Vector*  points;
     FT_Vector*  point;
     FT_Vector*  limit;
-    char*       tags;
+    FT_Byte*    tags;
 
     UInt        tag;       /* current point's state           */
 
@@ -1974,24 +1819,17 @@
 
 
     ras.fProfile = NULL;
-    ras.joint    = FALSE;
-    ras.fresh    = FALSE;
-
-    ras.maxBuff  = ras.sizeBuff - AlignProfileSize;
+    ras.cProfile = NULL;
 
-    ras.numTurns = 0;
+    ras.top      = ras.buff;
+    ras.maxBuff  = ras.sizeBuff - 1;  /* top reserve */
 
-    ras.cProfile         = (PProfile)ras.top;
-    ras.cProfile->offset = ras.top;
-    ras.num_Profs        = 0;
+    ras.numTurns  = 0;
+    ras.num_Profs = 0;
 
     last = -1;
     for ( i = 0; i < ras.outline.n_contours; i++ )
     {
-      PProfile  lastProfile;
-      Bool      o;
-
-
       ras.state    = Unknown_State;
       ras.gProfile = NULL;
 
@@ -2001,35 +1839,30 @@
       if ( Decompose_Curve( RAS_VARS first, last, flipped ) )
         return FAILURE;
 
+      /* Note that ras.gProfile can stay nil if the contour was */
+      /* too small to be drawn or degenerate.                   */
+      if ( !ras.gProfile )
+        continue;
+
       /* we must now check whether the extreme arcs join or not */
       if ( FRAC( ras.lastY ) == 0 &&
            ras.lastY >= ras.minY  &&
            ras.lastY <= ras.maxY  )
-        if ( ras.gProfile                        &&
-             ( ras.gProfile->flags & Flow_Up ) ==
+        if ( ( ras.gProfile->flags & Flow_Up ) ==
                ( ras.cProfile->flags & Flow_Up ) )
           ras.top--;
-        /* Note that ras.gProfile can be nil if the contour was too small */
-        /* to be drawn.                                                   */
 
-      lastProfile = ras.cProfile;
-      if ( ras.top != ras.cProfile->offset &&
-           ( ras.cProfile->flags & Flow_Up ) )
-        o = IS_TOP_OVERSHOOT( ras.lastY );
-      else
-        o = IS_BOTTOM_OVERSHOOT( ras.lastY );
-      if ( End_Profile( RAS_VARS o ) )
+      if ( End_Profile( RAS_VAR ) )
         return FAILURE;
 
-      /* close the `next profile in contour' linked list */
-      if ( ras.gProfile )
-        lastProfile->next = ras.gProfile;
+      if ( !ras.fProfile )
+        ras.fProfile = ras.gProfile;
     }
 
-    if ( Finalize_Profile_Table( RAS_VAR ) )
-      return FAILURE;
+    if ( ras.fProfile )
+      Finalize_Profile_Table( RAS_VAR );
 
-    return (Bool)( ras.top < ras.maxBuff ? SUCCESS : FAILURE );
+    return SUCCESS;
   }
 
 
@@ -2042,24 +1875,11 @@
   /*************************************************************************/
 
 
-  /**************************************************************************
-   *
-   * Init_Linked
-   *
-   *   Initializes an empty linked list.
-   */
-  static void
-  Init_Linked( TProfileList*  l )
-  {
-    *l = NULL;
-  }
-
-
   /**************************************************************************
    *
    * InsNew
    *
-   *   Inserts a new profile in a linked list.
+   *   Inserts a new profile in a linked list, sorted by coordinate.
    */
   static void
   InsNew( PProfileList  list,
@@ -2073,10 +1893,8 @@
     current = *old;
     x       = profile->X;
 
-    while ( current )
+    while ( current && current->X < x )
     {
-      if ( x < current->X )
-        break;
       old     = ¤t->link;
       current = *old;
     }
@@ -2088,79 +1906,51 @@
 
   /**************************************************************************
    *
-   * DelOld
+   * Increment
    *
-   *   Removes an old profile from a linked list.
+   *   Advances all profile in the list to the next scanline.  It also
+   *   sorts the trace list in the unlikely case of profile crossing.
+   *   The profiles are inserted in sorted order.  We might need a single
+   *   swap to fix it when profiles (contours) cross.
+   *   Bubble sort with immediate restart is good enough and simple.
    */
   static void
-  DelOld( PProfileList    list,
-          const PProfile  profile )
+  Increment( PProfileList  list,
+             Int           flow )
   {
-    PProfile  *old, current;
-
+    PProfile  *old, current, next;
 
-    old     = list;
-    current = *old;
 
-    while ( current )
+    /* First, set the new X coordinates and remove exhausted profiles */
+    old = list;
+    while ( *old )
     {
-      if ( current == profile )
+      current = *old;
+      if ( --current->height )
       {
-        *old = current->link;
-        return;
+        current->offset += flow;
+        current->X       = current->x[current->offset];
+        old = ¤t->link;
       }
-
-      old     = ¤t->link;
-      current = *old;
-    }
-
-    /* we should never get there, unless the profile was not part of */
-    /* the list.                                                     */
-  }
-
-
-  /**************************************************************************
-   *
-   * Sort
-   *
-   *   Sorts a trace list.  In 95%, the list is already sorted.  We need
-   *   an algorithm which is fast in this case.  Bubble sort is enough
-   *   and simple.
-   */
-  static void
-  Sort( PProfileList  list )
-  {
-    PProfile  *old, current, next;
-
-
-    /* First, set the new X coordinate of each profile */
-    current = *list;
-    while ( current )
-    {
-      current->X       = *current->offset;
-      current->offset += ( current->flags & Flow_Up ) ? 1 : -1;
-      current->height--;
-      current = current->link;
+      else
+        *old = current->link;  /* remove */
     }
 
-    /* Then sort them */
+    /* Then make sure the list remains sorted */
     old     = list;
     current = *old;
 
     if ( !current )
       return;
 
-    next = current->link;
-
-    while ( next )
+    while ( current->link )
     {
+      next = current->link;
+
       if ( current->X <= next->X )
       {
         old     = ¤t->link;
-        current = *old;
-
-        if ( !current )
-          return;
+        current = next;
       }
       else
       {
@@ -2168,11 +1958,10 @@
         current->link = next->link;
         next->link    = current;
 
+        /* this is likely the only necessary swap -- restart */
         old     = list;
         current = *old;
       }
-
-      next = current->link;
     }
   }
 
@@ -2187,74 +1976,51 @@
    */
 
   static void
-  Vertical_Sweep_Init( RAS_ARGS Short  min,
-                                Short  max )
+  Vertical_Sweep_Init( RAS_ARGS Int  min,
+                                Int  max )
   {
     FT_UNUSED( max );
 
 
-    ras.bLine = ras.bOrigin - min * ras.target.pitch;
+    ras.bLine = ras.bOrigin - min * ras.bPitch;
   }
 
 
   static void
-  Vertical_Sweep_Span( RAS_ARGS Short       y,
+  Vertical_Sweep_Span( RAS_ARGS Int         y,
                                 FT_F26Dot6  x1,
-                                FT_F26Dot6  x2,
-                                PProfile    left,
-                                PProfile    right )
+                                FT_F26Dot6  x2 )
   {
-    Long  e1, e2;
-
-    Int  dropOutControl = left->flags & 7;
+    Int  e1 = (Int)TRUNC( CEILING( x1 ) );
+    Int  e2 = (Int)TRUNC(   FLOOR( x2 ) );
 
     FT_UNUSED( y );
-    FT_UNUSED( left );
-    FT_UNUSED( right );
 
 
-    /* in high-precision mode, we need 12 digits after the comma to */
-    /* represent multiples of 1/(1<<12) = 1/4096                    */
-    FT_TRACE7(( "  y=%d x=[% .12f;% .12f]",
+    FT_TRACE7(( "  y=%d x=[% .*f;% .*f]",
                 y,
-                (double)x1 / (double)ras.precision,
-                (double)x2 / (double)ras.precision ));
-
-    /* Drop-out control */
-
-    e1 = CEILING( x1 );
-    e2 = FLOOR( x2 );
-
-    /* take care of the special case where both the left */
-    /* and right contour lie exactly on pixel centers    */
-    if ( dropOutControl != 2                             &&
-         x2 - x1 - ras.precision <= ras.precision_jitter &&
-         e1 != x1 && e2 != x2                            )
-      e2 = e1;
+                ras.precision_bits, (double)x1 / (double)ras.precision,
+                ras.precision_bits, (double)x2 / (double)ras.precision ));
 
-    e1 = TRUNC( e1 );
-    e2 = TRUNC( e2 );
-
-    if ( e2 >= 0 && e1 < ras.bWidth )
+    if ( e2 >= 0 && e1 <= ras.bRight )
     {
-      Byte*  target;
+      PByte  target;
 
-      Int   c1, c2;
-      Byte  f1, f2;
+      Int   c1, f1, c2, f2;
 
 
       if ( e1 < 0 )
         e1 = 0;
-      if ( e2 >= ras.bWidth )
-        e2 = ras.bWidth - 1;
+      if ( e2 > ras.bRight )
+        e2 = ras.bRight;
 
-      FT_TRACE7(( " -> x=[%ld;%ld]", e1, e2 ));
+      FT_TRACE7(( " -> x=[%d;%d]", e1, e2 ));
 
-      c1 = (Short)( e1 >> 3 );
-      c2 = (Short)( e2 >> 3 );
+      c1 = e1 >> 3;
+      c2 = e2 >> 3;
 
-      f1 = (Byte)  ( 0xFF >> ( e1 & 7 ) );
-      f2 = (Byte) ~( 0x7F >> ( e2 & 7 ) );
+      f1 =  0xFF >> ( e1 & 7 );
+      f2 = ~0x7F >> ( e2 & 7 );
 
       target = ras.bLine + c1;
       c2 -= c1;
@@ -2280,163 +2046,50 @@
 
 
   static void
-  Vertical_Sweep_Drop( RAS_ARGS Short       y,
+  Vertical_Sweep_Drop( RAS_ARGS Int         y,
                                 FT_F26Dot6  x1,
-                                FT_F26Dot6  x2,
-                                PProfile    left,
-                                PProfile    right )
+                                FT_F26Dot6  x2 )
   {
-    Long   e1, e2, pxl;
-    Short  c1, f1;
-
-
-    FT_TRACE7(( "  y=%d x=[% .12f;% .12f]",
-                y,
-                (double)x1 / (double)ras.precision,
-                (double)x2 / (double)ras.precision ));
-
-    /* Drop-out control */
-
-    /*   e2            x2                    x1           e1   */
-    /*                                                         */
-    /*                 ^                     |                 */
-    /*                 |                     |                 */
-    /*   +-------------+---------------------+------------+    */
-    /*                 |                     |                 */
-    /*                 |                     v                 */
-    /*                                                         */
-    /* pixel         contour              contour       pixel  */
-    /* center                                           center */
-
-    /* drop-out mode    scan conversion rules (as defined in OpenType) */
-    /* --------------------------------------------------------------- */
-    /*  0                1, 2, 3                                       */
-    /*  1                1, 2, 4                                       */
-    /*  2                1, 2                                          */
-    /*  3                same as mode 2                                */
-    /*  4                1, 2, 5                                       */
-    /*  5                1, 2, 6                                       */
-    /*  6, 7             same as mode 2                                */
-
-    e1  = CEILING( x1 );
-    e2  = FLOOR  ( x2 );
-    pxl = e1;
-
-    if ( e1 > e2 )
-    {
-      Int  dropOutControl = left->flags & 7;
-
-
-      if ( e1 == e2 + ras.precision )
-      {
-        switch ( dropOutControl )
-        {
-        case 0: /* simple drop-outs including stubs */
-          pxl = e2;
-          break;
-
-        case 4: /* smart drop-outs including stubs */
-          pxl = SMART( x1, x2 );
-          break;
-
-        case 1: /* simple drop-outs excluding stubs */
-        case 5: /* smart drop-outs excluding stubs  */
-
-          /* Drop-out Control Rules #4 and #6 */
-
-          /* The specification neither provides an exact definition */
-          /* of a `stub' nor gives exact rules to exclude them.     */
-          /*                                                        */
-          /* Here the constraints we use to recognize a stub.       */
-          /*                                                        */
-          /*  upper stub:                                           */
-          /*                                                        */
-          /*   - P_Left and P_Right are in the same contour         */
-          /*   - P_Right is the successor of P_Left in that contour */
-          /*   - y is the top of P_Left and P_Right                 */
-          /*                                                        */
-          /*  lower stub:                                           */
-          /*                                                        */
-          /*   - P_Left and P_Right are in the same contour         */
-          /*   - P_Left is the successor of P_Right in that contour */
-          /*   - y is the bottom of P_Left                          */
-          /*                                                        */
-          /* We draw a stub if the following constraints are met.   */
-          /*                                                        */
-          /*   - for an upper or lower stub, there is top or bottom */
-          /*     overshoot, respectively                            */
-          /*   - the covered interval is greater or equal to a half */
-          /*     pixel                                              */
-
-          /* upper stub test */
-          if ( left->next == right                &&
-               left->height <= 0                  &&
-               !( left->flags & Overshoot_Top   &&
-                  x2 - x1 >= ras.precision_half ) )
-            goto Exit;
-
-          /* lower stub test */
-          if ( right->next == left                 &&
-               left->start == y                    &&
-               !( left->flags & Overshoot_Bottom &&
-                  x2 - x1 >= ras.precision_half  ) )
-            goto Exit;
-
-          if ( dropOutControl == 1 )
-            pxl = e2;
-          else
-            pxl = SMART( x1, x2 );
-          break;
-
-        default: /* modes 2, 3, 6, 7 */
-          goto Exit;  /* no drop-out control */
-        }
+    Int  e1 = (Int)TRUNC( x1 );
+    Int  e2 = (Int)TRUNC( x2 );
+    Int  c1, f1;
 
-        /* undocumented but confirmed: If the drop-out would result in a  */
-        /* pixel outside of the bounding box, use the pixel inside of the */
-        /* bounding box instead                                           */
-        if ( pxl < 0 )
-          pxl = e1;
-        else if ( TRUNC( pxl ) >= ras.bWidth )
-          pxl = e2;
+    FT_UNUSED( y );
 
-        /* check that the other pixel isn't set */
-        e1 = ( pxl == e1 ) ? e2 : e1;
 
-        e1 = TRUNC( e1 );
+    /* undocumented but confirmed: If the drop-out would result in a  */
+    /* pixel outside of the bounding box, use the pixel inside of the */
+    /* bounding box instead                                           */
+    if ( e1 < 0 || e1 > ras.bRight )
+      e1 = e2;
 
-        c1 = (Short)( e1 >> 3 );
-        f1 = (Short)( e1 &  7 );
+    /* otherwise check that the other pixel isn't set */
+    else if ( e2 >=0 && e2 <= ras.bRight )
+    {
+      c1 = e2 >> 3;
+      f1 = 0x80 >> ( e2 & 7 );
 
-        if ( e1 >= 0 && e1 < ras.bWidth     &&
-             ras.bLine[c1] & ( 0x80 >> f1 ) )
-          goto Exit;
-      }
-      else
-        goto Exit;
+      if ( ras.bLine[c1] & f1 )
+        return;
     }
 
-    e1 = TRUNC( pxl );
-
-    if ( e1 >= 0 && e1 < ras.bWidth )
+    if ( e1 >= 0 && e1 <= ras.bRight )
     {
-      FT_TRACE7(( " -> x=%ld", e1 ));
+      c1 = e1 >> 3;
+      f1 = 0x80 >> ( e1 & 7 );
 
-      c1 = (Short)( e1 >> 3 );
-      f1 = (Short)( e1 & 7 );
+      FT_TRACE7(( "  y=%d x=%d%s\n", y, e1,
+                  ras.bLine[c1] & f1 ? " redundant" : "" ));
 
-      ras.bLine[c1] |= (char)( 0x80 >> f1 );
+      ras.bLine[c1] |= f1;
     }
-
-  Exit:
-    FT_TRACE7(( " dropout=%d\n", left->flags & 7 ));
   }
 
 
   static void
   Vertical_Sweep_Step( RAS_ARG )
   {
-    ras.bLine -= ras.target.pitch;
+    ras.bLine -= ras.bPitch;
   }
 
 
@@ -2450,8 +2103,8 @@
    */
 
   static void
-  Horizontal_Sweep_Init( RAS_ARGS Short  min,
-                                  Short  max )
+  Horizontal_Sweep_Init( RAS_ARGS Int  min,
+                                  Int  max )
   {
     /* nothing, really */
     FT_UNUSED_RASTER;
@@ -2461,22 +2114,18 @@
 
 
   static void
-  Horizontal_Sweep_Span( RAS_ARGS Short       y,
+  Horizontal_Sweep_Span( RAS_ARGS Int         y,
                                   FT_F26Dot6  x1,
-                                  FT_F26Dot6  x2,
-                                  PProfile    left,
-                                  PProfile    right )
+                                  FT_F26Dot6  x2 )
   {
-    Long  e1, e2;
+    Long  e1 = CEILING( x1 );
+    Long  e2 =   FLOOR( x2 );
 
-    FT_UNUSED( left );
-    FT_UNUSED( right );
 
-
-    FT_TRACE7(( "  x=%d y=[% .12f;% .12f]",
+    FT_TRACE7(( "  x=%d y=[% .*f;% .*f]",
                 y,
-                (double)x1 / (double)ras.precision,
-                (double)x2 / (double)ras.precision ));
+                ras.precision_bits, (double)x1 / (double)ras.precision,
+                ras.precision_bits, (double)x2 / (double)ras.precision ));
 
     /* We should not need this procedure but the vertical sweep   */
     /* mishandles horizontal lines through pixel centers.  So we  */
@@ -2484,20 +2133,18 @@
     /*                                                            */
     /* XXX: Can we handle horizontal lines better and drop this?  */
 
-    e1 = CEILING( x1 );
-
     if ( x1 == e1 )
     {
       e1 = TRUNC( e1 );
 
-      if ( e1 >= 0 && (ULong)e1 < ras.target.rows )
+      if ( e1 >= 0 && e1 <= ras.bTop )
       {
-        Byte   f1;
+        Int    f1;
         PByte  bits;
 
 
-        bits = ras.bOrigin + ( y >> 3 ) - e1 * ras.target.pitch;
-        f1   = (Byte)( 0x80 >> ( y & 7 ) );
+        bits = ras.bOrigin + ( y >> 3 ) - e1 * ras.bPitch;
+        f1   = 0x80 >> ( y & 7 );
 
         FT_TRACE7(( bits[0] & f1 ? " redundant"
                                  : " -> y=%ld edge", e1 ));
@@ -2506,20 +2153,18 @@
       }
     }
 
-    e2 = FLOOR  ( x2 );
-
     if ( x2 == e2 )
     {
       e2 = TRUNC( e2 );
 
-      if ( e2 >= 0 && (ULong)e2 < ras.target.rows )
+      if ( e2 >= 0 && e2 <= ras.bTop )
       {
-        Byte   f1;
+        Int    f1;
         PByte  bits;
 
 
-        bits = ras.bOrigin + ( y >> 3 ) - e2 * ras.target.pitch;
-        f1   = (Byte)( 0x80 >> ( y & 7 ) );
+        bits = ras.bOrigin + ( y >> 3 ) - e2 * ras.bPitch;
+        f1   = 0x80 >> ( y & 7 );
 
         FT_TRACE7(( bits[0] & f1 ? " redundant"
                                  : " -> y=%ld edge", e2 ));
@@ -2533,122 +2178,42 @@
 
 
   static void
-  Horizontal_Sweep_Drop( RAS_ARGS Short       y,
+  Horizontal_Sweep_Drop( RAS_ARGS Int         y,
                                   FT_F26Dot6  x1,
-                                  FT_F26Dot6  x2,
-                                  PProfile    left,
-                                  PProfile    right )
+                                  FT_F26Dot6  x2 )
   {
-    Long   e1, e2, pxl;
+    Int    e1 = (Int)TRUNC( x1 );
+    Int    e2 = (Int)TRUNC( x2 );
     PByte  bits;
-    Byte   f1;
-
-
-    FT_TRACE7(( "  x=%d y=[% .12f;% .12f]",
-                y,
-                (double)x1 / (double)ras.precision,
-                (double)x2 / (double)ras.precision ));
-
-    /* During the horizontal sweep, we only take care of drop-outs */
-
-    /* e1     +       <-- pixel center */
-    /*        |                        */
-    /* x1  ---+-->    <-- contour      */
-    /*        |                        */
-    /*        |                        */
-    /* x2  <--+---    <-- contour      */
-    /*        |                        */
-    /*        |                        */
-    /* e2     +       <-- pixel center */
-
-    e1  = CEILING( x1 );
-    e2  = FLOOR  ( x2 );
-    pxl = e1;
-
-    if ( e1 > e2 )
-    {
-      Int  dropOutControl = left->flags & 7;
-
+    Int    f1;
 
-      if ( e1 == e2 + ras.precision )
-      {
-        switch ( dropOutControl )
-        {
-        case 0: /* simple drop-outs including stubs */
-          pxl = e2;
-          break;
-
-        case 4: /* smart drop-outs including stubs */
-          pxl = SMART( x1, x2 );
-          break;
-
-        case 1: /* simple drop-outs excluding stubs */
-        case 5: /* smart drop-outs excluding stubs  */
-          /* see Vertical_Sweep_Drop for details */
-
-          /* rightmost stub test */
-          if ( left->next == right                &&
-               left->height <= 0                  &&
-               !( left->flags & Overshoot_Top   &&
-                  x2 - x1 >= ras.precision_half ) )
-            goto Exit;
-
-          /* leftmost stub test */
-          if ( right->next == left                 &&
-               left->start == y                    &&
-               !( left->flags & Overshoot_Bottom &&
-                  x2 - x1 >= ras.precision_half  ) )
-            goto Exit;
-
-          if ( dropOutControl == 1 )
-            pxl = e2;
-          else
-            pxl = SMART( x1, x2 );
-          break;
 
-        default: /* modes 2, 3, 6, 7 */
-          goto Exit;  /* no drop-out control */
-        }
-
-        /* undocumented but confirmed: If the drop-out would result in a  */
-        /* pixel outside of the bounding box, use the pixel inside of the */
-        /* bounding box instead                                           */
-        if ( pxl < 0 )
-          pxl = e1;
-        else if ( (ULong)( TRUNC( pxl ) ) >= ras.target.rows )
-          pxl = e2;
-
-        /* check that the other pixel isn't set */
-        e1 = ( pxl == e1 ) ? e2 : e1;
-
-        e1 = TRUNC( e1 );
+    /* undocumented but confirmed: If the drop-out would result in a  */
+    /* pixel outside of the bounding box, use the pixel inside of the */
+    /* bounding box instead                                           */
+    if ( e1 < 0 || e1 > ras.bTop )
+      e1 = e2;
 
-        bits = ras.bOrigin + ( y >> 3 ) - e1 * ras.target.pitch;
-        f1   = (Byte)( 0x80 >> ( y & 7 ) );
+    /* otherwise check that the other pixel isn't set */
+    else if ( e2 >=0 && e2 <= ras.bTop )
+    {
+      bits = ras.bOrigin + ( y >> 3 ) - e2 * ras.bPitch;
+      f1   = 0x80 >> ( y & 7 );
 
-        if ( e1 >= 0                     &&
-             (ULong)e1 < ras.target.rows &&
-             *bits & f1                  )
-          goto Exit;
-      }
-      else
-        goto Exit;
+      if ( *bits & f1 )
+        return;
     }
 
-    e1 = TRUNC( pxl );
-
-    if ( e1 >= 0 && (ULong)e1 < ras.target.rows )
+    if ( e1 >= 0 && e1 <= ras.bTop )
     {
-      FT_TRACE7(( " -> y=%ld", e1 ));
+      bits  = ras.bOrigin + ( y >> 3 ) - e1 * ras.bPitch;
+      f1    = 0x80 >> ( y & 7 );
 
-      bits  = ras.bOrigin + ( y >> 3 ) - e1 * ras.target.pitch;
-      f1    = (Byte)( 0x80 >> ( y & 7 ) );
+      FT_TRACE7(( "  x=%d y=%d%s\n", y, e1,
+                  *bits & f1 ? " redundant" : "" ));
 
-      bits[0] |= f1;
+      *bits |= f1;
     }
-
-  Exit:
-    FT_TRACE7(( " dropout=%d\n", left->flags & 7 ));
   }
 
 
@@ -2664,116 +2229,61 @@
    *
    * Generic Sweep Drawing routine
    *
+   * Note that this routine is executed with the pool containing at least
+   * two valid profiles (up and down) and two y-turns (top and bottom).
+   *
    */
 
-  static Bool
+  static void
   Draw_Sweep( RAS_ARG )
   {
-    Short         y, y_change, y_height;
-
-    PProfile      P, Q, P_Left, P_Right;
-
-    Short         min_Y, max_Y, top, bottom, dropouts;
-
-    Long          x1, x2, xs, e1, e2;
-
-    TProfileList  waiting;
-    TProfileList  draw_left, draw_right;
-
-
-    /* initialize empty linked lists */
-
-    Init_Linked( &waiting );
-
-    Init_Linked( &draw_left  );
-    Init_Linked( &draw_right );
-
-    /* first, compute min and max Y */
-
-    P     = ras.fProfile;
-    max_Y = (Short)TRUNC( ras.minY );
-    min_Y = (Short)TRUNC( ras.maxY );
-
-    while ( P )
-    {
-      Q = P->link;
+    Int           min_Y, max_Y, dropouts;
+    Int           y, y_turn;
 
-      bottom = (Short)P->start;
-      top    = (Short)( P->start + P->height - 1 );
+    PProfile      *Q, P, P_Left, P_Right;
 
-      if ( min_Y > bottom )
-        min_Y = bottom;
-      if ( max_Y < top )
-        max_Y = top;
+    TProfileList  waiting    = ras.fProfile;
+    TProfileList  draw_left  = NULL;
+    TProfileList  draw_right = NULL;
 
-      P->X = 0;
-      InsNew( &waiting, P );
 
-      P = Q;
-    }
+    /* use y_turns to set the drawing range */
 
-    /* check the Y-turns */
-    if ( ras.numTurns == 0 )
-    {
-      ras.error = FT_THROW( Invalid_Outline );
-      return FAILURE;
-    }
+    min_Y = (Int)ras.maxBuff[0];
+    max_Y = (Int)ras.maxBuff[ras.numTurns] - 1;
 
     /* now initialize the sweep */
 
     ras.Proc_Sweep_Init( RAS_VARS min_Y, max_Y );
 
-    /* then compute the distance of each profile from min_Y */
-
-    P = waiting;
-
-    while ( P )
-    {
-      P->countL = P->start - min_Y;
-      P = P->link;
-    }
-
     /* let's go */
 
-    y        = min_Y;
-    y_height = 0;
-
-    if ( ras.numTurns > 0                     &&
-         ras.sizeBuff[-ras.numTurns] == min_Y )
-      ras.numTurns--;
-
-    while ( ras.numTurns > 0 )
+    for ( y = min_Y; y <= max_Y; )
     {
-      /* check waiting list for new activations */
-
-      P = waiting;
+      /* check waiting list for new profile activations */
 
-      while ( P )
+      Q = &waiting;
+      while ( *Q )
       {
-        Q = P->link;
-        P->countL -= y_height;
-        if ( P->countL == 0 )
+        P = *Q;
+        if ( P->start == y )
         {
-          DelOld( &waiting, P );
+          *Q = P->link;  /* remove */
 
+          /* each active list contains profiles with the same flow */
+          /* left and right are arbitrary, correspond to TrueType  */
           if ( P->flags & Flow_Up )
             InsNew( &draw_left,  P );
           else
             InsNew( &draw_right, P );
         }
-
-        P = Q;
+        else
+          Q = &P->link;
       }
 
-      /* sort the drawing lists */
+      y_turn = (Int)*++ras.maxBuff;
 
-      Sort( &draw_left );
-      Sort( &draw_right );
-
-      y_change = (Short)ras.sizeBuff[-ras.numTurns--];
-      y_height = (Short)( y_change - y );
-
-      while ( y < y_change )
+      do
       {
         /* let's trace */
 
@@ -2784,9 +2294,13 @@
 
         while ( P_Left && P_Right )
         {
-          x1 = P_Left ->X;
-          x2 = P_Right->X;
+          Long  x1 = P_Left ->X;
+          Long  x2 = P_Right->X;
+          Long  xs;
+
 
+          /* TrueType should have x2 > x1, but can be opposite */
+          /* by mistake or in CFF/Type1, fix it then           */
           if ( x1 > x2 )
           {
             xs = x1;
@@ -2794,205 +2308,130 @@
             x2 = xs;
           }
 
-          e1 = FLOOR( x1 );
-          e2 = CEILING( x2 );
+          if ( CEILING( x1 ) <= FLOOR( x2 ) )
+            ras.Proc_Sweep_Span( RAS_VARS y, x1, x2 );
 
-          if ( x2 - x1 <= ras.precision &&
-               e1 != x1 && e2 != x2     )
+          /* otherwise, bottom ceiling > top floor, it is a drop-out */
+          else
           {
-            if ( e1 > e2 || e2 == e1 + ras.precision )
+            Int  dropOutControl = P_Left->flags & 7;
+
+
+            /* Drop-out control */
+
+            /*   e2            x2                    x1           e1   */
+            /*                                                         */
+            /*                 ^                     |                 */
+            /*                 |                     |                 */
+            /*   +-------------+---------------------+------------+    */
+            /*                 |                     |                 */
+            /*                 |                     v                 */
+            /*                                                         */
+            /* pixel         contour              contour       pixel  */
+            /* center                                           center */
+
+            /* drop-out mode   scan conversion rules (OpenType specs)  */
+            /* ------------------------------------------------------- */
+            /*  bit 0          exclude stubs if set                    */
+            /*  bit 1          ignore drop-outs if set                 */
+            /*  bit 2          smart rounding if set                   */
+
+            if ( dropOutControl & 2 )
+              goto Next_Pair;
+
+            /* The specification neither provides an exact definition */
+            /* of a `stub' nor gives exact rules to exclude them.     */
+            /*                                                        */
+            /* Here the constraints we use to recognize a stub.       */
+            /*                                                        */
+            /*  upper stub:                                           */
+            /*                                                        */
+            /*   - P_Left and P_Right are in the same contour         */
+            /*   - P_Right is the successor of P_Left in that contour */
+            /*   - y is the top of P_Left and P_Right                 */
+            /*                                                        */
+            /*  lower stub:                                           */
+            /*                                                        */
+            /*   - P_Left and P_Right are in the same contour         */
+            /*   - P_Left is the successor of P_Right in that contour */
+            /*   - y is the bottom of P_Left                          */
+            /*                                                        */
+            /* We draw a stub if the following constraints are met.   */
+            /*                                                        */
+            /*   - for an upper or lower stub, there is top or bottom */
+            /*     overshoot, respectively                            */
+            /*   - the covered interval is greater or equal to a half */
+            /*     pixel                                              */
+
+            if ( dropOutControl & 1 )
             {
-              Int  dropOutControl = P_Left->flags & 7;
-
-
-              if ( dropOutControl != 2 )
-              {
-                /* a drop-out was detected */
-
-                P_Left ->X = x1;
-                P_Right->X = x2;
-
-                /* mark profile for drop-out processing */
-                P_Left->countL = 1;
-                dropouts++;
-              }
+              /* upper stub test */
+              if ( P_Left->height == 1                &&
+                   P_Left->next == P_Right            &&
+                   !( P_Left->flags & Overshoot_Top   &&
+                      x2 - x1 >= ras.precision_half   ) )
+                goto Next_Pair;
+
+              /* lower stub test */
+              if ( P_Left->offset == 0                 &&
+                   P_Right->next == P_Left             &&
+                   !( P_Left->flags & Overshoot_Bottom &&
+                      x2 - x1 >= ras.precision_half    ) )
+                goto Next_Pair;
+            }
 
-              goto Skip_To_Next;
+            /* select the pixel to set and the other pixel */
+            if ( dropOutControl & 4 )
+            {
+              x2 = SMART( x1, x2 );
+              x1 = x1 > x2 ? x2 + ras.precision : x2 - ras.precision;
+            }
+            else
+            {
+              x2 = FLOOR  ( x2 );
+              x1 = CEILING( x1 );
             }
-          }
 
-          ras.Proc_Sweep_Span( RAS_VARS y, x1, x2, P_Left, P_Right );
+            P_Left ->X = x2;
+            P_Right->X = x1;
 
-        Skip_To_Next:
+            /* mark profile for drop-out processing */
+            P_Left->flags |= Dropout;
+            dropouts++;
+          }
 
+        Next_Pair:
           P_Left  = P_Left->link;
           P_Right = P_Right->link;
         }
 
-        /* handle drop-outs _after_ the span drawing --       */
-        /* drop-out processing has been moved out of the loop */
-        /* for performance tuning                             */
-        if ( dropouts > 0 )
-          goto Scan_DropOuts;
-
-      Next_Line:
-
-        ras.Proc_Sweep_Step( RAS_VAR );
-
-        y++;
+        /* handle drop-outs _after_ the span drawing */
+        P_Left  = draw_left;
+        P_Right = draw_right;
 
-        if ( y < y_change )
+        while ( dropouts )
         {
-          Sort( &draw_left  );
-          Sort( &draw_right );
-        }
-      }
-
-      /* now finalize the profiles that need it */
-
-      P = draw_left;
-      while ( P )
-      {
-        Q = P->link;
-        if ( P->height == 0 )
-          DelOld( &draw_left, P );
-        P = Q;
-      }
-
-      P = draw_right;
-      while ( P )
-      {
-        Q = P->link;
-        if ( P->height == 0 )
-          DelOld( &draw_right, P );
-        P = Q;
-      }
-    }
-
-    /* for gray-scaling, flush the bitmap scanline cache */
-    while ( y <= max_Y )
-    {
-      ras.Proc_Sweep_Step( RAS_VAR );
-      y++;
-    }
-
-    return SUCCESS;
-
-  Scan_DropOuts:
-
-    P_Left  = draw_left;
-    P_Right = draw_right;
-
-    while ( P_Left && P_Right )
-    {
-      if ( P_Left->countL )
-      {
-        P_Left->countL = 0;
-#if 0
-        dropouts--;  /* -- this is useful when debugging only */
-#endif
-        ras.Proc_Sweep_Drop( RAS_VARS y,
-                                      P_Left->X,
-                                      P_Right->X,
-                                      P_Left,
-                                      P_Right );
-      }
-
-      P_Left  = P_Left->link;
-      P_Right = P_Right->link;
-    }
-
-    goto Next_Line;
-  }
-
-
-#ifdef STANDALONE_
-
-  /**************************************************************************
-   *
-   * The following functions should only compile in stand-alone mode,
-   * i.e., when building this component without the rest of FreeType.
-   *
-   */
-
-  /**************************************************************************
-   *
-   * @Function:
-   *   FT_Outline_Get_CBox
-   *
-   * @Description:
-   *   Return an outline's `control box'.  The control box encloses all
-   *   the outline's points, including Bézier control points.  Though it
-   *   coincides with the exact bounding box for most glyphs, it can be
-   *   slightly larger in some situations (like when rotating an outline
-   *   that contains Bézier outside arcs).
-   *
-   *   Computing the control box is very fast, while getting the bounding
-   *   box can take much more time as it needs to walk over all segments
-   *   and arcs in the outline.  To get the latter, you can use the
-   *   `ftbbox' component, which is dedicated to this single task.
-   *
-   * @Input:
-   *   outline ::
-   *     A pointer to the source outline descriptor.
-   *
-   * @Output:
-   *   acbox ::
-   *     The outline's control box.
-   *
-   * @Note:
-   *   See @FT_Glyph_Get_CBox for a discussion of tricky fonts.
-   */
-
-  static void
-  FT_Outline_Get_CBox( const FT_Outline*  outline,
-                       FT_BBox           *acbox )
-  {
-    if ( outline && acbox )
-    {
-      Long  xMin, yMin, xMax, yMax;
-
-
-      if ( outline->n_points == 0 )
-      {
-        xMin = 0;
-        yMin = 0;
-        xMax = 0;
-        yMax = 0;
-      }
-      else
-      {
-        FT_Vector*  vec   = outline->points;
-        FT_Vector*  limit = vec + outline->n_points;
-
-
-        xMin = xMax = vec->x;
-        yMin = yMax = vec->y;
-        vec++;
+          if ( P_Left->flags & Dropout )
+          {
+            ras.Proc_Sweep_Drop( RAS_VARS y, P_Left->X, P_Right->X );
 
-        for ( ; vec < limit; vec++ )
-        {
-          Long  x, y;
+            P_Left->flags &= ~Dropout;
+            dropouts--;
+          }
 
+          P_Left  = P_Left->link;
+          P_Right = P_Right->link;
+        }
 
-          x = vec->x;
-          if ( x < xMin ) xMin = x;
-          if ( x > xMax ) xMax = x;
+        ras.Proc_Sweep_Step( RAS_VAR );
 
-          y = vec->y;
-          if ( y < yMin ) yMin = y;
-          if ( y > yMax ) yMax = y;
-        }
+        Increment( &draw_left,   1 );
+        Increment( &draw_right, -1 );
       }
-      acbox->xMin = xMin;
-      acbox->xMax = xMax;
-      acbox->yMin = yMin;
-      acbox->yMax = yMax;
+      while ( ++y < y_turn );
     }
   }
 
-#endif /* STANDALONE_ */
-
 
   /**************************************************************************
    *
@@ -3019,13 +2458,15 @@
     Int  band_stack[32];  /* enough to bisect 32-bit int bands */
 
 
+    FT_TRACE6(( "%s pass [%d..%d]\n",
+                flipped ? "Horizontal" : "Vertical",
+                y_min, y_max ));
+
     while ( 1 )
     {
       ras.minY = (Long)y_min * ras.precision;
       ras.maxY = (Long)y_max * ras.precision;
 
-      ras.top = ras.buff;
-
       ras.error = Raster_Err_Ok;
 
       if ( Convert_Glyph( RAS_VARS flipped ) )
@@ -3038,6 +2479,9 @@
         if ( y_min == y_max )
           return ras.error;  /* still Raster_Overflow */
 
+        FT_TRACE6(( "band [%d..%d]: to be bisected\n",
+                    y_min, y_max ));
+
         y_mid = ( y_min + y_max ) >> 1;
 
         band_stack[band_top++] = y_min;
@@ -3045,9 +2489,12 @@
       }
       else
       {
+        FT_TRACE6(( "band [%d..%d]: %hd profiles; %td bytes remaining\n",
+                    y_min, y_max, ras.num_Profs,
+                    (char*)ras.maxBuff - (char*)ras.top ));
+
         if ( ras.fProfile )
-          if ( Draw_Sweep( RAS_VAR ) )
-             return ras.error;
+          Draw_Sweep( RAS_VAR );
 
         if ( --band_top < 0 )
           break;
@@ -3076,53 +2523,48 @@
   Render_Glyph( RAS_ARG )
   {
     FT_Error  error;
+    Long      buffer[FT_MAX_BLACK_POOL];
 
 
+    ras.buff     = buffer;
+    ras.sizeBuff = (&buffer)[1]; /* Points to right after buffer. */
+
     Set_High_Precision( RAS_VARS ras.outline.flags &
                                  FT_OUTLINE_HIGH_PRECISION );
 
+    ras.dropOutControl = 0;
+
     if ( ras.outline.flags & FT_OUTLINE_IGNORE_DROPOUTS )
-      ras.dropOutControl = 2;
-    else
-    {
-      if ( ras.outline.flags & FT_OUTLINE_SMART_DROPOUTS )
-        ras.dropOutControl = 4;
-      else
-        ras.dropOutControl = 0;
+      ras.dropOutControl |= 2;
 
-      if ( !( ras.outline.flags & FT_OUTLINE_INCLUDE_STUBS ) )
-        ras.dropOutControl += 1;
-    }
+    if ( ras.outline.flags & FT_OUTLINE_SMART_DROPOUTS )
+      ras.dropOutControl |= 4;
 
-    /* Vertical Sweep */
-    FT_TRACE7(( "Vertical pass (ftraster)\n" ));
+    if ( !( ras.outline.flags & FT_OUTLINE_INCLUDE_STUBS ) )
+      ras.dropOutControl |= 1;
+
+    FT_TRACE6(( "BW Raster: precision 1/%d, dropout mode %d\n",
+                ras.precision, ras.dropOutControl ));
 
+    /* Vertical Sweep */
     ras.Proc_Sweep_Init = Vertical_Sweep_Init;
     ras.Proc_Sweep_Span = Vertical_Sweep_Span;
     ras.Proc_Sweep_Drop = Vertical_Sweep_Drop;
     ras.Proc_Sweep_Step = Vertical_Sweep_Step;
 
-    ras.bWidth  = (UShort)ras.target.width;
-    ras.bOrigin = (Byte*)ras.target.buffer;
-
-    if ( ras.target.pitch > 0 )
-      ras.bOrigin += (Long)( ras.target.rows - 1 ) * ras.target.pitch;
-
-    error = Render_Single_Pass( RAS_VARS 0, 0, (Int)ras.target.rows - 1 );
+    error = Render_Single_Pass( RAS_VARS 0, 0, ras.bTop );
     if ( error )
       return error;
 
     /* Horizontal Sweep */
     if ( !( ras.outline.flags & FT_OUTLINE_SINGLE_PASS ) )
     {
-      FT_TRACE7(( "Horizontal pass (ftraster)\n" ));
-
       ras.Proc_Sweep_Init = Horizontal_Sweep_Init;
       ras.Proc_Sweep_Span = Horizontal_Sweep_Span;
       ras.Proc_Sweep_Drop = Horizontal_Sweep_Drop;
       ras.Proc_Sweep_Step = Horizontal_Sweep_Step;
 
-      error = Render_Single_Pass( RAS_VARS 1, 0, (Int)ras.target.width - 1 );
+      error = Render_Single_Pass( RAS_VARS 1, 0, ras.bRight );
       if ( error )
         return error;
     }
@@ -3233,8 +2675,6 @@
     black_TWorker  worker[1];
 #endif
 
-    Long  buffer[FT_MAX_BLACK_POOL];
-
 
     if ( !raster )
       return FT_THROW( Raster_Uninitialized );
@@ -3243,7 +2683,7 @@
       return FT_THROW( Invalid_Outline );
 
     /* return immediately if the outline is empty */
-    if ( outline->n_points == 0 || outline->n_contours <= 0 )
+    if ( outline->n_points == 0 || outline->n_contours == 0 )
       return Raster_Err_Ok;
 
     if ( !outline->contours || !outline->points )
@@ -3269,10 +2709,14 @@
       return FT_THROW( Invalid_Argument );
 
     ras.outline = *outline;
-    ras.target  = *target_map;
 
-    ras.buff     = buffer;
-    ras.sizeBuff = (&buffer)[1]; /* Points to right after buffer. */
+    ras.bTop    =   (Int)target_map->rows - 1;
+    ras.bRight  =   (Int)target_map->width - 1;
+    ras.bPitch  =   (Int)target_map->pitch;
+    ras.bOrigin = (PByte)target_map->buffer;
+
+    if ( ras.bPitch > 0 )
+      ras.bOrigin += ras.bTop * ras.bPitch;
 
     return Render_Glyph( RAS_VAR );
   }
diff --git a/src/java.desktop/share/native/libfreetype/src/raster/ftraster.h b/src/java.desktop/share/native/libfreetype/src/raster/ftraster.h
index b511b3a99e9c..ad9cb1b9fe0d 100644
--- a/src/java.desktop/share/native/libfreetype/src/raster/ftraster.h
+++ b/src/java.desktop/share/native/libfreetype/src/raster/ftraster.h
@@ -4,7 +4,7 @@
  *
  *   The FreeType glyph rasterizer (specification).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used
diff --git a/src/java.desktop/share/native/libfreetype/src/raster/ftrend1.c b/src/java.desktop/share/native/libfreetype/src/raster/ftrend1.c
index 6d442b1ff8c5..fd9f174f2e1f 100644
--- a/src/java.desktop/share/native/libfreetype/src/raster/ftrend1.c
+++ b/src/java.desktop/share/native/libfreetype/src/raster/ftrend1.c
@@ -4,7 +4,7 @@
  *
  *   The FreeType glyph rasterizer interface (body).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/raster/ftrend1.h b/src/java.desktop/share/native/libfreetype/src/raster/ftrend1.h
index cec35c8528ac..cf3e73c0a248 100644
--- a/src/java.desktop/share/native/libfreetype/src/raster/ftrend1.h
+++ b/src/java.desktop/share/native/libfreetype/src/raster/ftrend1.h
@@ -4,7 +4,7 @@
  *
  *   The FreeType glyph rasterizer interface (specification).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/raster/rasterrs.h b/src/java.desktop/share/native/libfreetype/src/raster/rasterrs.h
index 989d8b44be15..326d42e0438e 100644
--- a/src/java.desktop/share/native/libfreetype/src/raster/rasterrs.h
+++ b/src/java.desktop/share/native/libfreetype/src/raster/rasterrs.h
@@ -4,7 +4,7 @@
  *
  *   monochrome renderer error codes (specification only).
  *
- * Copyright (C) 2001-2023 by
+ * Copyright (C) 2001-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/sfnt/pngshim.c b/src/java.desktop/share/native/libfreetype/src/sfnt/pngshim.c
index 33712162e00d..76181568af9f 100644
--- a/src/java.desktop/share/native/libfreetype/src/sfnt/pngshim.c
+++ b/src/java.desktop/share/native/libfreetype/src/sfnt/pngshim.c
@@ -4,7 +4,7 @@
  *
  *   PNG Bitmap glyph support.
  *
- * Copyright (C) 2013-2023 by
+ * Copyright (C) 2013-2024 by
  * Google, Inc.
  * Written by Stuart Gill and Behdad Esfahbod.
  *
diff --git a/src/java.desktop/share/native/libfreetype/src/sfnt/pngshim.h b/src/java.desktop/share/native/libfreetype/src/sfnt/pngshim.h
index 903bd2bc3482..6e7a5c08e712 100644
--- a/src/java.desktop/share/native/libfreetype/src/sfnt/pngshim.h
+++ b/src/java.desktop/share/native/libfreetype/src/sfnt/pngshim.h
@@ -4,7 +4,7 @@
  *
  *   PNG Bitmap glyph support.
  *
- * Copyright (C) 2013-2023 by
+ * Copyright (C) 2013-2024 by
  * Google, Inc.
  * Written by Stuart Gill and Behdad Esfahbod.
  *
diff --git a/src/java.desktop/share/native/libfreetype/src/sfnt/sfdriver.c b/src/java.desktop/share/native/libfreetype/src/sfnt/sfdriver.c
index 0925940b03f2..81072207b490 100644
--- a/src/java.desktop/share/native/libfreetype/src/sfnt/sfdriver.c
+++ b/src/java.desktop/share/native/libfreetype/src/sfnt/sfdriver.c
@@ -4,7 +4,7 @@
  *
  *   High-level SFNT driver interface (body).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -49,6 +49,10 @@
 #include 
 #endif
 
+#ifdef TT_CONFIG_OPTION_GPOS_KERNING
+#include "ttgpos.h"
+#endif
+
 #include "ttcmap.h"
 #include "ttkern.h"
 #include "ttmtx.h"
@@ -1249,6 +1253,12 @@
 #define PUT_PS_NAMES( a )  a
 #else
 #define PUT_PS_NAMES( a )  NULL
+#endif
+
+#ifdef TT_CONFIG_OPTION_GPOS_KERNING
+#define PUT_GPOS_KERNING( a )  a
+#else
+#define PUT_GPOS_KERNING( a )  NULL
 #endif
 
   FT_DEFINE_SFNT_INTERFACE(
@@ -1274,6 +1284,8 @@
     tt_face_free_name,      /* TT_Free_Table_Func      free_name       */
 
     tt_face_load_kern,      /* TT_Load_Table_Func      load_kern       */
+    PUT_GPOS_KERNING( tt_face_load_gpos ),
+                            /* TT_Load_Table_Func      load_gpos       */
     tt_face_load_gasp,      /* TT_Load_Table_Func      load_gasp       */
     tt_face_load_pclt,      /* TT_Load_Table_Func      load_init       */
 
@@ -1292,6 +1304,9 @@
     /* since version 2.1.8 */
     tt_face_get_kerning,    /* TT_Face_GetKerningFunc  get_kerning     */
 
+    PUT_GPOS_KERNING( tt_face_get_gpos_kerning ),
+                           /* TT_Face_GetKerningFunc  get_gpos_kerning */
+
     /* since version 2.2 */
     tt_face_load_font_dir,  /* TT_Load_Table_Func      load_font_dir   */
     tt_face_load_hmtx,      /* TT_Load_Metrics_Func    load_hmtx       */
diff --git a/src/java.desktop/share/native/libfreetype/src/sfnt/sfdriver.h b/src/java.desktop/share/native/libfreetype/src/sfnt/sfdriver.h
index 2445958b69f4..6f71489fdc17 100644
--- a/src/java.desktop/share/native/libfreetype/src/sfnt/sfdriver.h
+++ b/src/java.desktop/share/native/libfreetype/src/sfnt/sfdriver.h
@@ -4,7 +4,7 @@
  *
  *   High-level SFNT driver interface (specification).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/sfnt/sferrors.h b/src/java.desktop/share/native/libfreetype/src/sfnt/sferrors.h
index e7a8eb04bb88..d3ca1d9aa8b3 100644
--- a/src/java.desktop/share/native/libfreetype/src/sfnt/sferrors.h
+++ b/src/java.desktop/share/native/libfreetype/src/sfnt/sferrors.h
@@ -4,7 +4,7 @@
  *
  *   SFNT error codes (specification only).
  *
- * Copyright (C) 2001-2023 by
+ * Copyright (C) 2001-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/sfnt/sfobjs.c b/src/java.desktop/share/native/libfreetype/src/sfnt/sfobjs.c
index f5d66ef8403a..6ee4e5e939b4 100644
--- a/src/java.desktop/share/native/libfreetype/src/sfnt/sfobjs.c
+++ b/src/java.desktop/share/native/libfreetype/src/sfnt/sfobjs.c
@@ -4,7 +4,7 @@
  *
  *   SFNT object management (base).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -40,6 +40,10 @@
 #include "ttbdf.h"
 #endif
 
+#ifdef TT_CONFIG_OPTION_GPOS_KERNING
+#include "ttgpos.h"
+#endif
+
 
   /**************************************************************************
    *
@@ -1026,6 +1030,10 @@
     LOAD_( gasp );
     LOAD_( kern );
 
+#ifdef TT_CONFIG_OPTION_GPOS_KERNING
+    LOAD_( gpos );
+#endif
+
     face->root.num_glyphs = face->max_profile.numGlyphs;
 
     /* Bit 8 of the `fsSelection' field in the `OS/2' table denotes  */
@@ -1119,7 +1127,11 @@
         flags |= FT_FACE_FLAG_VERTICAL;
 
       /* kerning available ? */
-      if ( TT_FACE_HAS_KERNING( face ) )
+      if ( TT_FACE_HAS_KERNING( face )
+#ifdef TT_CONFIG_OPTION_GPOS_KERNING
+           || face->gpos_kerning_available
+#endif
+         )
         flags |= FT_FACE_FLAG_KERNING;
 
 #ifdef TT_CONFIG_OPTION_GX_VAR_SUPPORT
@@ -1470,6 +1482,11 @@
     /* freeing the kerning table */
     tt_face_done_kern( face );
 
+#ifdef TT_CONFIG_OPTION_GPOS_KERNING
+    /* freeing the GPOS table */
+    tt_face_done_gpos( face );
+#endif
+
     /* freeing the collection table */
     FT_FREE( face->ttc_header.offsets );
     face->ttc_header.count = 0;
diff --git a/src/java.desktop/share/native/libfreetype/src/sfnt/sfobjs.h b/src/java.desktop/share/native/libfreetype/src/sfnt/sfobjs.h
index 906aebbf904f..90847d957322 100644
--- a/src/java.desktop/share/native/libfreetype/src/sfnt/sfobjs.h
+++ b/src/java.desktop/share/native/libfreetype/src/sfnt/sfobjs.h
@@ -4,7 +4,7 @@
  *
  *   SFNT object management (specification).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/sfnt/sfwoff.c b/src/java.desktop/share/native/libfreetype/src/sfnt/sfwoff.c
index 7c0ce2205e67..14514bf9574c 100644
--- a/src/java.desktop/share/native/libfreetype/src/sfnt/sfwoff.c
+++ b/src/java.desktop/share/native/libfreetype/src/sfnt/sfwoff.c
@@ -4,7 +4,7 @@
  *
  *   WOFF format management (base).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -18,6 +18,7 @@
 
 #include "sfwoff.h"
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -149,6 +150,7 @@
     /* Miscellaneous checks. */
     if ( woff.length != stream->size                              ||
          woff.num_tables == 0                                     ||
+         woff.num_tables >  0xFFFU                                ||
          44 + woff.num_tables * 20UL >= woff.length               ||
          12 + woff.num_tables * 16UL >= woff.totalSfntSize        ||
          ( woff.totalSfntSize & 3 ) != 0                          ||
@@ -169,21 +171,11 @@
 
     /* Write sfnt header. */
     {
-      FT_UInt  searchRange, entrySelector, rangeShift, x;
+      FT_Int  entrySelector = FT_MSB( woff.num_tables );
+      FT_Int  searchRange   = ( 1 << entrySelector ) * 16;
+      FT_Int  rangeShift    = woff.num_tables * 16 - searchRange;
 
 
-      x             = woff.num_tables;
-      entrySelector = 0;
-      while ( x )
-      {
-        x            >>= 1;
-        entrySelector += 1;
-      }
-      entrySelector--;
-
-      searchRange = ( 1 << entrySelector ) * 16;
-      rangeShift  = woff.num_tables * 16 - searchRange;
-
       WRITE_ULONG ( sfnt_header, woff.flavor );
       WRITE_USHORT( sfnt_header, woff.num_tables );
       WRITE_USHORT( sfnt_header, searchRange );
diff --git a/src/java.desktop/share/native/libfreetype/src/sfnt/sfwoff.h b/src/java.desktop/share/native/libfreetype/src/sfnt/sfwoff.h
index d4384227376b..a04735ffe280 100644
--- a/src/java.desktop/share/native/libfreetype/src/sfnt/sfwoff.h
+++ b/src/java.desktop/share/native/libfreetype/src/sfnt/sfwoff.h
@@ -4,7 +4,7 @@
  *
  *   WOFFF format management (specification).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/sfnt/sfwoff2.c b/src/java.desktop/share/native/libfreetype/src/sfnt/sfwoff2.c
index 2be44a347ad9..589b3e0c6b77 100644
--- a/src/java.desktop/share/native/libfreetype/src/sfnt/sfwoff2.c
+++ b/src/java.desktop/share/native/libfreetype/src/sfnt/sfwoff2.c
@@ -4,7 +4,7 @@
  *
  *   WOFF2 format management (base).
  *
- * Copyright (C) 2019-2023 by
+ * Copyright (C) 2019-2024 by
  * Nikhil Ramakrishnan, David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -18,6 +18,7 @@
 #include "sfwoff2.h"
 #include "woff2tags.h"
 #include 
+#include 
 #include 
 #include 
 
@@ -289,23 +290,15 @@
     FT_ULong  checksum     = 0;
     FT_ULong  aligned_size = size & ~3UL;
     FT_ULong  i;
-    FT_ULong  v;
+    FT_Int    shift;
 
 
     for ( i = 0; i < aligned_size; i += 4 )
-      checksum += ( (FT_ULong)buf[i    ] << 24 ) |
-                  ( (FT_ULong)buf[i + 1] << 16 ) |
-                  ( (FT_ULong)buf[i + 2] <<  8 ) |
-                  ( (FT_ULong)buf[i + 3] <<  0 );
+      checksum += FT_NEXT_ULONG( buf );
 
-    /* If size is not aligned to 4, treat as if it is padded with 0s. */
-    if ( size != aligned_size )
-    {
-      v = 0;
-      for ( i = aligned_size ; i < size; ++i )
-        v |= (FT_ULong)buf[i] << ( 24 - 8 * ( i & 3 ) );
-      checksum += v;
-    }
+    /* remaining bytes can be shifted and added one at a time */
+    for ( shift = 24; i < size; i++, shift -= 8 )
+      checksum += (FT_UInt32)FT_NEXT_BYTE( buf ) << shift;
 
     return checksum;
   }
@@ -1799,7 +1792,6 @@
 
     FT_Byte*   sfnt        = NULL;
     FT_Stream  sfnt_stream = NULL;
-    FT_Byte*   sfnt_header;
     FT_ULong   sfnt_size;
 
     FT_Byte*  uncompressed_buf = NULL;
@@ -1853,6 +1845,7 @@
     /* Miscellaneous checks. */
     if ( woff2.length != stream->size                               ||
          woff2.num_tables == 0                                      ||
+         woff2.num_tables >  0xFFFU                                 ||
          48 + woff2.num_tables * 20UL >= woff2.length               ||
          ( woff2.metaOffset == 0 && ( woff2.metaLength != 0     ||
                                       woff2.metaOrigLength != 0 ) ) ||
@@ -2143,6 +2136,13 @@
       WOFF2_TtcFont  ttc_font = woff2.ttc_fonts + face_index;
 
 
+      if ( ttc_font->num_tables == 0 || ttc_font->num_tables > 0xFFFU )
+      {
+        FT_ERROR(( "woff2_open_font: invalid WOFF2 CollectionFontEntry\n" ));
+        error = FT_THROW( Invalid_Table );
+        goto Exit;
+      }
+
       /* Create a temporary array. */
       if ( FT_QNEW_ARRAY( temp_indices,
                           ttc_font->num_tables ) )
@@ -2198,27 +2198,15 @@
          FT_NEW( sfnt_stream )        )
       goto Exit;
 
-    sfnt_header = sfnt;
-
-    WRITE_ULONG( sfnt_header, woff2.flavor );
-
-    if ( woff2.num_tables )
     {
-      FT_UInt  searchRange, entrySelector, rangeShift, x;
+      FT_Byte*  sfnt_header = sfnt;
 
+      FT_Int  entrySelector = FT_MSB( woff2.num_tables );
+      FT_Int  searchRange   = ( 1 << entrySelector ) * 16;
+      FT_Int  rangeShift    = woff2.num_tables * 16 - searchRange;
 
-      x             = woff2.num_tables;
-      entrySelector = 0;
-      while ( x )
-      {
-        x            >>= 1;
-        entrySelector += 1;
-      }
-      entrySelector--;
-
-      searchRange = ( 1 << entrySelector ) * 16;
-      rangeShift  = ( woff2.num_tables * 16 ) - searchRange;
 
+      WRITE_ULONG ( sfnt_header, woff2.flavor );
       WRITE_USHORT( sfnt_header, woff2.num_tables );
       WRITE_USHORT( sfnt_header, searchRange );
       WRITE_USHORT( sfnt_header, entrySelector );
diff --git a/src/java.desktop/share/native/libfreetype/src/sfnt/sfwoff2.h b/src/java.desktop/share/native/libfreetype/src/sfnt/sfwoff2.h
index 4901286ee085..f41140648dc4 100644
--- a/src/java.desktop/share/native/libfreetype/src/sfnt/sfwoff2.h
+++ b/src/java.desktop/share/native/libfreetype/src/sfnt/sfwoff2.h
@@ -4,7 +4,7 @@
  *
  *   WOFFF2 format management (specification).
  *
- * Copyright (C) 2019-2023 by
+ * Copyright (C) 2019-2024 by
  * Nikhil Ramakrishnan, David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/sfnt/ttcmap.c b/src/java.desktop/share/native/libfreetype/src/sfnt/ttcmap.c
index 9ba25dcbc138..28f4d1173c06 100644
--- a/src/java.desktop/share/native/libfreetype/src/sfnt/ttcmap.c
+++ b/src/java.desktop/share/native/libfreetype/src/sfnt/ttcmap.c
@@ -4,7 +4,7 @@
  *
  *   TrueType character mapping table (cmap) support (body).
  *
- * Copyright (C) 2002-2023 by
+ * Copyright (C) 2002-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/sfnt/ttcmap.h b/src/java.desktop/share/native/libfreetype/src/sfnt/ttcmap.h
index ff52917ed5bc..e2c5e72bf029 100644
--- a/src/java.desktop/share/native/libfreetype/src/sfnt/ttcmap.h
+++ b/src/java.desktop/share/native/libfreetype/src/sfnt/ttcmap.h
@@ -4,7 +4,7 @@
  *
  *   TrueType character mapping table (cmap) support (specification).
  *
- * Copyright (C) 2002-2023 by
+ * Copyright (C) 2002-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/sfnt/ttcmapc.h b/src/java.desktop/share/native/libfreetype/src/sfnt/ttcmapc.h
index 0af48c2478af..370898363f34 100644
--- a/src/java.desktop/share/native/libfreetype/src/sfnt/ttcmapc.h
+++ b/src/java.desktop/share/native/libfreetype/src/sfnt/ttcmapc.h
@@ -4,7 +4,7 @@
  *
  *   TT CMAP classes definitions (specification only).
  *
- * Copyright (C) 2009-2023 by
+ * Copyright (C) 2009-2024 by
  * Oran Agra and Mickey Gabel.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/sfnt/ttcolr.c b/src/java.desktop/share/native/libfreetype/src/sfnt/ttcolr.c
index 281e7135eea8..b37658dde9ec 100644
--- a/src/java.desktop/share/native/libfreetype/src/sfnt/ttcolr.c
+++ b/src/java.desktop/share/native/libfreetype/src/sfnt/ttcolr.c
@@ -4,7 +4,7 @@
  *
  *   TrueType and OpenType colored glyph layer support (body).
  *
- * Copyright (C) 2018-2023 by
+ * Copyright (C) 2018-2024 by
  * David Turner, Robert Wilhelm, Dominik Röttsches, and Werner Lemberg.
  *
  * Originally written by Shao Yu Zhang .
@@ -208,18 +208,19 @@
     colr->num_base_glyphs = FT_NEXT_USHORT( p );
     base_glyph_offset     = FT_NEXT_ULONG( p );
 
-    if ( base_glyph_offset >= table_size )
+    if ( table_size <= base_glyph_offset )
       goto InvalidTable;
-    if ( colr->num_base_glyphs * BASE_GLYPH_SIZE >
-           table_size - base_glyph_offset )
+    if ( ( table_size - base_glyph_offset ) / BASE_GLYPH_SIZE
+             < colr->num_base_glyphs )
       goto InvalidTable;
 
     layer_offset     = FT_NEXT_ULONG( p );
     colr->num_layers = FT_NEXT_USHORT( p );
 
-    if ( layer_offset >= table_size )
+    if ( table_size <= layer_offset )
       goto InvalidTable;
-    if ( colr->num_layers * LAYER_SIZE > table_size - layer_offset )
+    if ( ( table_size - layer_offset ) / LAYER_SIZE
+             < colr->num_layers )
       goto InvalidTable;
 
     if ( colr->version == 1 )
@@ -229,14 +230,14 @@
 
       base_glyphs_offset_v1 = FT_NEXT_ULONG( p );
 
-      if ( base_glyphs_offset_v1 >= table_size - 4 )
+      if ( table_size - 4 <= base_glyphs_offset_v1 )
         goto InvalidTable;
 
       p1                 = (FT_Byte*)( table + base_glyphs_offset_v1 );
       num_base_glyphs_v1 = FT_PEEK_ULONG( p1 );
 
-      if ( num_base_glyphs_v1 * BASE_GLYPH_PAINT_RECORD_SIZE >
-             table_size - base_glyphs_offset_v1 )
+      if ( ( table_size - base_glyphs_offset_v1 ) / BASE_GLYPH_PAINT_RECORD_SIZE
+               < num_base_glyphs_v1 )
         goto InvalidTable;
 
       colr->num_base_glyphs_v1 = num_base_glyphs_v1;
@@ -244,19 +245,19 @@
 
       layer_offset_v1 = FT_NEXT_ULONG( p );
 
-      if ( layer_offset_v1 >= table_size )
+      if ( table_size <= layer_offset_v1 )
         goto InvalidTable;
 
       if ( layer_offset_v1 )
       {
-        if ( layer_offset_v1 >= table_size - 4 )
+        if ( table_size - 4 <= layer_offset_v1 )
           goto InvalidTable;
 
         p1            = (FT_Byte*)( table + layer_offset_v1 );
         num_layers_v1 = FT_PEEK_ULONG( p1 );
 
-        if ( num_layers_v1 * LAYER_V1_LIST_PAINT_OFFSET_SIZE >
-               table_size - layer_offset_v1 )
+        if ( ( table_size - layer_offset_v1 ) / LAYER_V1_LIST_PAINT_OFFSET_SIZE
+                < num_layers_v1 )
           goto InvalidTable;
 
         colr->num_layers_v1 = num_layers_v1;
@@ -279,7 +280,7 @@
 
       clip_list_offset = FT_NEXT_ULONG( p );
 
-      if ( clip_list_offset >= table_size )
+      if ( table_size <= clip_list_offset )
         goto InvalidTable;
 
       if ( clip_list_offset )
@@ -311,7 +312,7 @@
           goto InvalidTable;
 
         var_store_offset = FT_NEXT_ULONG( p );
-        if ( var_store_offset >= table_size )
+        if ( table_size <= var_store_offset )
           goto InvalidTable;
 
         if ( var_store_offset )
@@ -661,6 +662,7 @@
       FT_UInt32  first_layer_index;
 
 
+      ENSURE_READ_BYTES( 5 );
       num_layers = FT_NEXT_BYTE( p );
       if ( num_layers > colr->num_layers_v1 )
         return 0;
@@ -1278,7 +1280,8 @@
 
     while ( min < max )
     {
-      FT_UInt  mid = min + ( max - min ) / 2;
+      FT_UInt    mid = min + ( max - min ) / 2;
+      FT_UShort  gid;
 
       /*
        * `base_glyph_begin` is the beginning of `BaseGlyphV1List`;
@@ -1287,8 +1290,7 @@
        */
       FT_Byte  *p = base_glyph_begin + 4 + mid * BASE_GLYPH_PAINT_RECORD_SIZE;
 
-      FT_UShort  gid = FT_NEXT_USHORT( p );
-
+      gid = FT_NEXT_USHORT( p );
 
       if ( gid < glyph_id )
         min = mid + 1;
diff --git a/src/java.desktop/share/native/libfreetype/src/sfnt/ttcolr.h b/src/java.desktop/share/native/libfreetype/src/sfnt/ttcolr.h
index 20c85f0359fe..30031464c737 100644
--- a/src/java.desktop/share/native/libfreetype/src/sfnt/ttcolr.h
+++ b/src/java.desktop/share/native/libfreetype/src/sfnt/ttcolr.h
@@ -4,7 +4,7 @@
  *
  *   TrueType and OpenType colored glyph layer support (specification).
  *
- * Copyright (C) 2018-2023 by
+ * Copyright (C) 2018-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * Originally written by Shao Yu Zhang .
diff --git a/src/java.desktop/share/native/libfreetype/src/sfnt/ttcpal.c b/src/java.desktop/share/native/libfreetype/src/sfnt/ttcpal.c
index 46ae08596f39..997eb869ffca 100644
--- a/src/java.desktop/share/native/libfreetype/src/sfnt/ttcpal.c
+++ b/src/java.desktop/share/native/libfreetype/src/sfnt/ttcpal.c
@@ -4,7 +4,7 @@
  *
  *   TrueType and OpenType color palette support (body).
  *
- * Copyright (C) 2018-2023 by
+ * Copyright (C) 2018-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * Originally written by Shao Yu Zhang .
diff --git a/src/java.desktop/share/native/libfreetype/src/sfnt/ttcpal.h b/src/java.desktop/share/native/libfreetype/src/sfnt/ttcpal.h
index 8e9913f0ccd4..bb301ae88b6a 100644
--- a/src/java.desktop/share/native/libfreetype/src/sfnt/ttcpal.h
+++ b/src/java.desktop/share/native/libfreetype/src/sfnt/ttcpal.h
@@ -4,7 +4,7 @@
  *
  *   TrueType and OpenType color palette support (specification).
  *
- * Copyright (C) 2018-2023 by
+ * Copyright (C) 2018-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * Originally written by Shao Yu Zhang .
diff --git a/src/java.desktop/share/native/libfreetype/src/sfnt/ttkern.c b/src/java.desktop/share/native/libfreetype/src/sfnt/ttkern.c
index a47d08bd6de6..f0411366af49 100644
--- a/src/java.desktop/share/native/libfreetype/src/sfnt/ttkern.c
+++ b/src/java.desktop/share/native/libfreetype/src/sfnt/ttkern.c
@@ -5,7 +5,7 @@
  *   Load the basic TrueType kerning table.  This doesn't handle
  *   kerning data within the GPOS table at the moment.
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/sfnt/ttkern.h b/src/java.desktop/share/native/libfreetype/src/sfnt/ttkern.h
index 960c7da4946d..a54e51df12d9 100644
--- a/src/java.desktop/share/native/libfreetype/src/sfnt/ttkern.h
+++ b/src/java.desktop/share/native/libfreetype/src/sfnt/ttkern.h
@@ -5,7 +5,7 @@
  *   Load the basic TrueType kerning table.  This doesn't handle
  *   kerning data within the GPOS table at the moment.
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/sfnt/ttload.c b/src/java.desktop/share/native/libfreetype/src/sfnt/ttload.c
index 7b44e9cd2e71..c3a5fae2cb9b 100644
--- a/src/java.desktop/share/native/libfreetype/src/sfnt/ttload.c
+++ b/src/java.desktop/share/native/libfreetype/src/sfnt/ttload.c
@@ -5,7 +5,7 @@
  *   Load the basic TrueType tables, i.e., tables that can be either in
  *   TTF or OTF fonts (body).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -1046,7 +1046,7 @@
   FT_LOCAL_DEF( void )
   tt_face_free_name( TT_Face  face )
   {
-    FT_Memory     memory = face->root.driver->root.memory;
+    FT_Memory     memory = face->root.memory;
     TT_NameTable  table  = &face->name_table;
 
 
diff --git a/src/java.desktop/share/native/libfreetype/src/sfnt/ttload.h b/src/java.desktop/share/native/libfreetype/src/sfnt/ttload.h
index 1499dd5735f5..2b1d62d9bd9d 100644
--- a/src/java.desktop/share/native/libfreetype/src/sfnt/ttload.h
+++ b/src/java.desktop/share/native/libfreetype/src/sfnt/ttload.h
@@ -5,7 +5,7 @@
  *   Load the basic TrueType tables, i.e., tables that can be either in
  *   TTF or OTF fonts (specification).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/sfnt/ttmtx.c b/src/java.desktop/share/native/libfreetype/src/sfnt/ttmtx.c
index 38ee9ae728a1..278841185636 100644
--- a/src/java.desktop/share/native/libfreetype/src/sfnt/ttmtx.c
+++ b/src/java.desktop/share/native/libfreetype/src/sfnt/ttmtx.c
@@ -4,7 +4,7 @@
  *
  *   Load the metrics tables common to TTF and OTF fonts (body).
  *
- * Copyright (C) 2006-2023 by
+ * Copyright (C) 2006-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/sfnt/ttmtx.h b/src/java.desktop/share/native/libfreetype/src/sfnt/ttmtx.h
index 56d2b6276616..34b3c0e18f2d 100644
--- a/src/java.desktop/share/native/libfreetype/src/sfnt/ttmtx.h
+++ b/src/java.desktop/share/native/libfreetype/src/sfnt/ttmtx.h
@@ -4,7 +4,7 @@
  *
  *   Load the metrics tables common to TTF and OTF fonts (specification).
  *
- * Copyright (C) 2006-2023 by
+ * Copyright (C) 2006-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/sfnt/ttpost.c b/src/java.desktop/share/native/libfreetype/src/sfnt/ttpost.c
index 1dfad4298bd6..5698a62c8d1f 100644
--- a/src/java.desktop/share/native/libfreetype/src/sfnt/ttpost.c
+++ b/src/java.desktop/share/native/libfreetype/src/sfnt/ttpost.c
@@ -5,7 +5,7 @@
  *   PostScript name table processing for TrueType and OpenType fonts
  *   (body).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -204,8 +204,8 @@
     /* now load the name strings */
     if ( num_names )
     {
-      FT_ULong   p;
-      FT_Byte*   strings;
+      FT_Byte*   p;
+      FT_Byte*   p_end;
 
 
       post_len -= (FT_ULong)num_glyphs * 2;
@@ -214,36 +214,36 @@
                                     post_len + 1 ) )
         goto Fail;
 
-      strings = (FT_Byte*)( name_strings + num_names );
-      if ( FT_STREAM_READ( strings, post_len ) )
+      p = (FT_Byte*)( name_strings + num_names );
+      if ( FT_STREAM_READ( p, post_len ) )
         goto Fail;
 
+      p_end = p + post_len;
+
       /* convert from Pascal- to C-strings and set pointers */
-      for ( p = 0, n = 0; p < post_len && n < num_names; n++ )
+      for ( n = 0; p < p_end && n < num_names; n++ )
       {
-        FT_UInt  len = strings[p];
+        FT_UInt  len = *p;
 
 
-        if ( len > 63U )
-        {
-          error = FT_THROW( Invalid_File_Format );
-          goto Fail;
-        }
+        /* names in the Adobe Glyph List are shorter than 40 characters */
+        if ( len >= 40U )
+          FT_TRACE4(( "load_format_20: unusual %u-char name found\n", len ));
 
-        strings[p]      = 0;
-        name_strings[n] = strings + p + 1;
-        p              += len + 1;
+        *p++            = 0;
+        name_strings[n] = p;
+        p              += len;
       }
-      strings[post_len] = 0;
+      *p_end = 0;
 
       /* deal with missing or insufficient string data */
       if ( n < num_names )
       {
         FT_TRACE4(( "load_format_20: %hu PostScript names are truncated\n",
-                    num_names - n ));
+                    (FT_UShort)( num_names - n ) ));
 
         for ( ; n < num_names; n++ )
-          name_strings[n] = strings + post_len;
+          name_strings[n] = p_end;
       }
     }
 
@@ -436,13 +436,8 @@
 
     format = face->postscript.FormatType;
 
-    if ( format == 0x00010000L )
-    {
-      if ( idx < 258 )                    /* paranoid checking */
-        *PSname = MAC_NAME( idx );
-    }
-    else if ( format == 0x00020000L ||
-              format == 0x00025000L )
+    if ( format == 0x00020000L ||
+         format == 0x00025000L )
     {
       TT_Post_Names  names = &face->postscript_names;
 
@@ -466,6 +461,11 @@
       }
     }
 
+    /* version 1.0 is only valid with 258 glyphs */
+    else if ( format == 0x00010000L              &&
+              face->max_profile.numGlyphs == 258 )
+      *PSname = MAC_NAME( idx );
+
     /* nothing to do for format == 0x00030000L */
 
   End:
diff --git a/src/java.desktop/share/native/libfreetype/src/sfnt/ttpost.h b/src/java.desktop/share/native/libfreetype/src/sfnt/ttpost.h
index 528f1c5f2f20..150db6c3981e 100644
--- a/src/java.desktop/share/native/libfreetype/src/sfnt/ttpost.h
+++ b/src/java.desktop/share/native/libfreetype/src/sfnt/ttpost.h
@@ -5,7 +5,7 @@
  *   PostScript name table processing for TrueType and OpenType fonts
  *   (specification).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/sfnt/ttsbit.c b/src/java.desktop/share/native/libfreetype/src/sfnt/ttsbit.c
index 03f90a628d6e..cb3a8abf1821 100644
--- a/src/java.desktop/share/native/libfreetype/src/sfnt/ttsbit.c
+++ b/src/java.desktop/share/native/libfreetype/src/sfnt/ttsbit.c
@@ -4,7 +4,7 @@
  *
  *   TrueType and OpenType embedded bitmap support (body).
  *
- * Copyright (C) 2005-2023 by
+ * Copyright (C) 2005-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * Copyright 2013 by Google, Inc.
diff --git a/src/java.desktop/share/native/libfreetype/src/sfnt/ttsbit.h b/src/java.desktop/share/native/libfreetype/src/sfnt/ttsbit.h
index 07e2db461a5c..96f80a584248 100644
--- a/src/java.desktop/share/native/libfreetype/src/sfnt/ttsbit.h
+++ b/src/java.desktop/share/native/libfreetype/src/sfnt/ttsbit.h
@@ -4,7 +4,7 @@
  *
  *   TrueType and OpenType embedded bitmap support (specification).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/sfnt/woff2tags.c b/src/java.desktop/share/native/libfreetype/src/sfnt/woff2tags.c
index eeedd9906be5..532ccfa1737e 100644
--- a/src/java.desktop/share/native/libfreetype/src/sfnt/woff2tags.c
+++ b/src/java.desktop/share/native/libfreetype/src/sfnt/woff2tags.c
@@ -4,7 +4,7 @@
  *
  *   WOFF2 Font table tags (base).
  *
- * Copyright (C) 2019-2023 by
+ * Copyright (C) 2019-2024 by
  * Nikhil Ramakrishnan, David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/sfnt/woff2tags.h b/src/java.desktop/share/native/libfreetype/src/sfnt/woff2tags.h
index 1201848e5ecd..d03b4b41bc9d 100644
--- a/src/java.desktop/share/native/libfreetype/src/sfnt/woff2tags.h
+++ b/src/java.desktop/share/native/libfreetype/src/sfnt/woff2tags.h
@@ -4,7 +4,7 @@
  *
  *   WOFF2 Font table tags (specification).
  *
- * Copyright (C) 2019-2023 by
+ * Copyright (C) 2019-2024 by
  * Nikhil Ramakrishnan, David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/smooth/ftgrays.c b/src/java.desktop/share/native/libfreetype/src/smooth/ftgrays.c
index 0918272f8704..b7c0632a6fa9 100644
--- a/src/java.desktop/share/native/libfreetype/src/smooth/ftgrays.c
+++ b/src/java.desktop/share/native/libfreetype/src/smooth/ftgrays.c
@@ -4,7 +4,7 @@
  *
  *   A new `perfect' anti-aliasing renderer (body).
  *
- * Copyright (C) 2000-2023 by
+ * Copyright (C) 2000-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -489,7 +489,7 @@ typedef ptrdiff_t  FT_PtrDist;
 
   typedef struct  gray_TWorker_
   {
-    ft_jmp_buf  jump_buffer;
+    FT_BBox     cbox;
 
     TCoord  min_ex, max_ex;  /* min and max integer pixel coordinates */
     TCoord  min_ey, max_ey;
@@ -510,6 +510,8 @@ typedef ptrdiff_t  FT_PtrDist;
     FT_Raster_Span_Func  render_span;
     void*                render_span_data;
 
+    ft_jmp_buf  jump_buffer;
+
   } gray_TWorker, *gray_PWorker;
 
 #if defined( _MSC_VER )
@@ -997,49 +999,12 @@ typedef ptrdiff_t  FT_PtrDist;
 #endif
 
   /*
-   * Benchmarking shows that using DDA to flatten the quadratic Bézier arcs
-   * is slightly faster in the following cases:
-   *
-   *   - When the host CPU is 64-bit.
-   *   - When SSE2 SIMD registers and instructions are available (even on
-   *     x86).
-   *
-   * For other cases, using binary splits is actually slightly faster.
-   */
-#if ( defined( __SSE2__ )                          ||   \
-      defined( __x86_64__ )                        ||   \
-      defined( _M_AMD64 )                          ||   \
-      ( defined( _M_IX86_FP ) && _M_IX86_FP >= 2 ) ) && \
-    !defined( __VMS )
-#  define FT_SSE2 1
-#else
-#  define FT_SSE2 0
-#endif
-
-#if FT_SSE2                || \
-    defined( __aarch64__ ) || \
-    defined( _M_ARM64 )
-#  define BEZIER_USE_DDA  1
-#else
-#  define BEZIER_USE_DDA  0
-#endif
-
-  /*
-   * For now, the code that depends on `BEZIER_USE_DDA` requires `FT_Int64`
-   * to be defined.  If `FT_INT64` is not defined, meaning there is no
-   * 64-bit type available, disable it to avoid compilation errors.  See for
-   * example https://gitlab.freedesktop.org/freetype/freetype/-/issues/1071.
+   * For now, the code that uses DDA to render conic curves requires
+   * `FT_Int64` to be defined.  See for example
+   *    https://gitlab.freedesktop.org/freetype/freetype/-/issues/1071.
    */
-#if !defined( FT_INT64 )
-#  undef BEZIER_USE_DDA
-#  define BEZIER_USE_DDA  0
-#endif
-
-#if BEZIER_USE_DDA
 
-#if FT_SSE2
-#  include 
-#endif
+#ifdef FT_INT64
 
 #define LEFT_SHIFT( a, b )  (FT_Int64)( (FT_UInt64)(a) << (b) )
 
@@ -1095,16 +1060,17 @@ typedef ptrdiff_t  FT_PtrDist;
       return;
     }
 
-    /* We can calculate the number of necessary bisections because  */
+    /* We can calculate the number of necessary segments because    */
     /* each bisection predictably reduces deviation exactly 4-fold. */
     /* Even 32-bit deviation would vanish after 16 bisections.      */
-    shift = 0;
+    shift = 16;
     do
     {
-      dx   >>= 2;
-      shift += 1;
+      dx >>= 2;
+      shift--;
 
     } while ( dx > ONE_PIXEL / 4 );
+    count = 0x10000U >> shift;
 
     /*
      * The (P0,P1,P2) arc equation, for t in [0,1] range:
@@ -1150,75 +1116,19 @@ typedef ptrdiff_t  FT_PtrDist;
      *             = (B << (33 - N)) + (A << (32 - 2*N))
      */
 
-#if FT_SSE2
-    /* Experience shows that for small shift values, */
-    /* SSE2 is actually slower.                      */
-    if ( shift > 2 )
-    {
-      union
-      {
-        struct { FT_Int64  ax, ay, bx, by; }  i;
-        struct { __m128i  a, b; }  vec;
-
-      } u;
-
-      union
-      {
-        struct { FT_Int32  px_lo, px_hi, py_lo, py_hi; }  i;
-        __m128i  vec;
-
-      } v;
-
-      __m128i  a, b;
-      __m128i  r, q, q2;
-      __m128i  p;
-
-
-      u.i.ax = ax;
-      u.i.ay = ay;
-      u.i.bx = bx;
-      u.i.by = by;
-
-      a = _mm_load_si128( &u.vec.a );
-      b = _mm_load_si128( &u.vec.b );
-
-      r  = _mm_slli_epi64( a, 33 - 2 * shift );
-      q  = _mm_slli_epi64( b, 33 - shift );
-      q2 = _mm_slli_epi64( a, 32 - 2 * shift );
-
-      q = _mm_add_epi64( q2, q );
-
-      v.i.px_lo = 0;
-      v.i.px_hi = p0.x;
-      v.i.py_lo = 0;
-      v.i.py_hi = p0.y;
-
-      p = _mm_load_si128( &v.vec );
-
-      for ( count = 1U << shift; count > 0; count-- )
-      {
-        p = _mm_add_epi64( p, q );
-        q = _mm_add_epi64( q, r );
-
-        _mm_store_si128( &v.vec, p );
-
-        gray_render_line( RAS_VAR_ v.i.px_hi, v.i.py_hi );
-      }
-
-      return;
-    }
-#endif  /* FT_SSE2 */
+    rx = LEFT_SHIFT( ax, shift + shift );
+    ry = LEFT_SHIFT( ay, shift + shift );
 
-    rx = LEFT_SHIFT( ax, 33 - 2 * shift );
-    ry = LEFT_SHIFT( ay, 33 - 2 * shift );
+    qx = LEFT_SHIFT( bx, shift + 17 ) + rx;
+    qy = LEFT_SHIFT( by, shift + 17 ) + ry;
 
-    qx = LEFT_SHIFT( bx, 33 - shift ) + LEFT_SHIFT( ax, 32 - 2 * shift );
-    qy = LEFT_SHIFT( by, 33 - shift ) + LEFT_SHIFT( ay, 32 - 2 * shift );
+    rx *= 2;
+    ry *= 2;
 
     px = LEFT_SHIFT( p0.x, 32 );
     py = LEFT_SHIFT( p0.y, 32 );
 
-    for ( count = 1U << shift; count > 0; count-- )
+    do
     {
       px += qx;
       py += qy;
@@ -1227,10 +1137,10 @@ typedef ptrdiff_t  FT_PtrDist;
 
       gray_render_line( RAS_VAR_ (FT_Pos)( px >> 32 ),
                                  (FT_Pos)( py >> 32 ) );
-    }
+    } while ( --count );
   }
 
-#else  /* !BEZIER_USE_DDA */
+#else  /* !FT_INT64 */
 
   /*
    * Note that multiple attempts to speed up the function below
@@ -1324,7 +1234,7 @@ typedef ptrdiff_t  FT_PtrDist;
     } while ( --draw );
   }
 
-#endif  /* !BEZIER_USE_DDA */
+#endif  /* !FT_INT64 */
 
 
   /*
@@ -1486,139 +1396,6 @@ typedef ptrdiff_t  FT_PtrDist;
   }
 
 
-  static void
-  gray_sweep( RAS_ARG )
-  {
-    int  fill = ( ras.outline.flags & FT_OUTLINE_EVEN_ODD_FILL ) ? 0x100
-                                                                 : INT_MIN;
-    int  coverage;
-    int  y;
-
-
-    for ( y = ras.min_ey; y < ras.max_ey; y++ )
-    {
-      PCell   cell  = ras.ycells[y - ras.min_ey];
-      TCoord  x     = ras.min_ex;
-      TArea   cover = 0;
-
-      unsigned char*  line = ras.target.origin - ras.target.pitch * y;
-
-
-      for ( ; cell != ras.cell_null; cell = cell->next )
-      {
-        TArea  area;
-
-
-        if ( cover != 0 && cell->x > x )
-        {
-          FT_FILL_RULE( coverage, cover, fill );
-          FT_GRAY_SET( line + x, coverage, cell->x - x );
-        }
-
-        cover += (TArea)cell->cover * ( ONE_PIXEL * 2 );
-        area   = cover - cell->area;
-
-        if ( area != 0 && cell->x >= ras.min_ex )
-        {
-          FT_FILL_RULE( coverage, area, fill );
-          line[cell->x] = (unsigned char)coverage;
-        }
-
-        x = cell->x + 1;
-      }
-
-      if ( cover != 0 )  /* only if cropped */
-      {
-        FT_FILL_RULE( coverage, cover, fill );
-        FT_GRAY_SET( line + x, coverage, ras.max_ex - x );
-      }
-    }
-  }
-
-
-  static void
-  gray_sweep_direct( RAS_ARG )
-  {
-    int  fill = ( ras.outline.flags & FT_OUTLINE_EVEN_ODD_FILL ) ? 0x100
-                                                                 : INT_MIN;
-    int  coverage;
-    int  y;
-
-    FT_Span  span[FT_MAX_GRAY_SPANS];
-    int      n = 0;
-
-
-    for ( y = ras.min_ey; y < ras.max_ey; y++ )
-    {
-      PCell   cell  = ras.ycells[y - ras.min_ey];
-      TCoord  x     = ras.min_ex;
-      TArea   cover = 0;
-
-
-      for ( ; cell != ras.cell_null; cell = cell->next )
-      {
-        TArea  area;
-
-
-        if ( cover != 0 && cell->x > x )
-        {
-          FT_FILL_RULE( coverage, cover, fill );
-
-          span[n].coverage = (unsigned char)coverage;
-          span[n].x        = (short)x;
-          span[n].len      = (unsigned short)( cell->x - x );
-
-          if ( ++n == FT_MAX_GRAY_SPANS )
-          {
-            /* flush the span buffer and reset the count */
-            ras.render_span( y, n, span, ras.render_span_data );
-            n = 0;
-          }
-        }
-
-        cover += (TArea)cell->cover * ( ONE_PIXEL * 2 );
-        area   = cover - cell->area;
-
-        if ( area != 0 && cell->x >= ras.min_ex )
-        {
-          FT_FILL_RULE( coverage, area, fill );
-
-          span[n].coverage = (unsigned char)coverage;
-          span[n].x        = (short)cell->x;
-          span[n].len      = 1;
-
-          if ( ++n == FT_MAX_GRAY_SPANS )
-          {
-            /* flush the span buffer and reset the count */
-            ras.render_span( y, n, span, ras.render_span_data );
-            n = 0;
-          }
-        }
-
-        x = cell->x + 1;
-      }
-
-      if ( cover != 0 )  /* only if cropped */
-      {
-        FT_FILL_RULE( coverage, cover, fill );
-
-        span[n].coverage = (unsigned char)coverage;
-        span[n].x        = (short)x;
-        span[n].len      = (unsigned short)( ras.max_ex - x );
-
-        ++n;
-      }
-
-      if ( n )
-      {
-        /* flush the span buffer and reset the count */
-        ras.render_span( y, n, span, ras.render_span_data );
-        n = 0;
-      }
-    }
-  }
-
-
 #ifdef STANDALONE_
 
   /**************************************************************************
@@ -1934,7 +1711,7 @@ typedef ptrdiff_t  FT_PtrDist;
       if ( continued )
         FT_Trace_Enable();
 
-      FT_TRACE7(( "band [%d..%d]: %td cell%s remaining/\n",
+      FT_TRACE7(( "band [%d..%d]: %td cell%s remaining\n",
                   ras.min_ey,
                   ras.max_ey,
                   ras.cell_null - ras.cell_free,
@@ -1952,14 +1729,144 @@ typedef ptrdiff_t  FT_PtrDist;
   }
 
 
+  static void
+  gray_sweep( RAS_ARG )
+  {
+    int  fill = ( ras.outline.flags & FT_OUTLINE_EVEN_ODD_FILL ) ? 0x100
+                                                                 : INT_MIN;
+    int  coverage;
+    int  y;
+
+
+    for ( y = ras.min_ey; y < ras.max_ey; y++ )
+    {
+      PCell   cell  = ras.ycells[y - ras.min_ey];
+      TCoord  x     = ras.min_ex;
+      TArea   cover = 0;
+
+      unsigned char*  line = ras.target.origin - ras.target.pitch * y;
+
+
+      for ( ; cell != ras.cell_null; cell = cell->next )
+      {
+        TArea  area;
+
+
+        if ( cover != 0 && cell->x > x )
+        {
+          FT_FILL_RULE( coverage, cover, fill );
+          FT_GRAY_SET( line + x, coverage, cell->x - x );
+        }
+
+        cover += (TArea)cell->cover * ( ONE_PIXEL * 2 );
+        area   = cover - cell->area;
+
+        if ( area != 0 && cell->x >= ras.min_ex )
+        {
+          FT_FILL_RULE( coverage, area, fill );
+          line[cell->x] = (unsigned char)coverage;
+        }
+
+        x = cell->x + 1;
+      }
+
+      if ( cover != 0 )  /* only if cropped */
+      {
+        FT_FILL_RULE( coverage, cover, fill );
+        FT_GRAY_SET( line + x, coverage, ras.max_ex - x );
+      }
+    }
+  }
+
+
+  static void
+  gray_sweep_direct( RAS_ARG )
+  {
+    int  fill = ( ras.outline.flags & FT_OUTLINE_EVEN_ODD_FILL ) ? 0x100
+                                                                 : INT_MIN;
+    int  coverage;
+    int  y;
+
+    FT_Span  span[FT_MAX_GRAY_SPANS];
+    int      n = 0;
+
+
+    for ( y = ras.min_ey; y < ras.max_ey; y++ )
+    {
+      PCell   cell  = ras.ycells[y - ras.min_ey];
+      TCoord  x     = ras.min_ex;
+      TArea   cover = 0;
+
+
+      for ( ; cell != ras.cell_null; cell = cell->next )
+      {
+        TArea  area;
+
+
+        if ( cover != 0 && cell->x > x )
+        {
+          FT_FILL_RULE( coverage, cover, fill );
+
+          span[n].coverage = (unsigned char)coverage;
+          span[n].x        = (short)x;
+          span[n].len      = (unsigned short)( cell->x - x );
+
+          if ( ++n == FT_MAX_GRAY_SPANS )
+          {
+            /* flush the span buffer and reset the count */
+            ras.render_span( y, n, span, ras.render_span_data );
+            n = 0;
+          }
+        }
+
+        cover += (TArea)cell->cover * ( ONE_PIXEL * 2 );
+        area   = cover - cell->area;
+
+        if ( area != 0 && cell->x >= ras.min_ex )
+        {
+          FT_FILL_RULE( coverage, area, fill );
+
+          span[n].coverage = (unsigned char)coverage;
+          span[n].x        = (short)cell->x;
+          span[n].len      = 1;
+
+          if ( ++n == FT_MAX_GRAY_SPANS )
+          {
+            /* flush the span buffer and reset the count */
+            ras.render_span( y, n, span, ras.render_span_data );
+            n = 0;
+          }
+        }
+
+        x = cell->x + 1;
+      }
+
+      if ( cover != 0 )  /* only if cropped */
+      {
+        FT_FILL_RULE( coverage, cover, fill );
+
+        span[n].coverage = (unsigned char)coverage;
+        span[n].x        = (short)x;
+        span[n].len      = (unsigned short)( ras.max_ex - x );
+
+        ++n;
+      }
+
+      if ( n )
+      {
+        /* flush the span buffer and reset the count */
+        ras.render_span( y, n, span, ras.render_span_data );
+        n = 0;
+      }
+    }
+  }
+
+
   static int
   gray_convert_glyph( RAS_ARG )
   {
-    const TCoord  yMin = ras.min_ey;
-    const TCoord  yMax = ras.max_ey;
-
     TCell    buffer[FT_MAX_GRAY_POOL];
-    size_t   height = (size_t)( yMax - yMin );
+    size_t   height = (size_t)( ras.cbox.yMax - ras.cbox.yMin );
     size_t   n = FT_MAX_GRAY_POOL / 8;
     TCoord   y;
     TCoord   bands[32];  /* enough to accommodate bisections */
@@ -1985,35 +1892,36 @@ typedef ptrdiff_t  FT_PtrDist;
       height  = ( height + n - 1 ) / n;
     }
 
-    for ( y = yMin; y < yMax; )
+    for ( y = ras.cbox.yMin; y < ras.cbox.yMax; )
     {
       ras.min_ey = y;
       y         += height;
-      ras.max_ey = FT_MIN( y, yMax );
+      ras.max_ey = FT_MIN( y, ras.cbox.yMax );
+
+      ras.count_ey = ras.max_ey - ras.min_ey;
 
       band    = bands;
-      band[1] = ras.min_ey;
-      band[0] = ras.max_ey;
+      band[1] = ras.cbox.xMin;
+      band[0] = ras.cbox.xMax;
 
       do
       {
-        TCoord  width = band[0] - band[1];
-        TCoord  w;
+        TCoord  i;
         int     error;
 
 
-        for ( w = 0; w < width; ++w )
-          ras.ycells[w] = ras.cell_null;
+        ras.min_ex = band[1];
+        ras.max_ex = band[0];
+
+        /* memory management: zero out and skip ycells */
+        for ( i = 0; i < ras.count_ey; ++i )
+          ras.ycells[i] = ras.cell_null;
 
-        /* memory management: skip ycells */
-        n = ( (size_t)width * sizeof ( PCell ) + sizeof ( TCell ) - 1 ) /
-              sizeof ( TCell );
+        n = ( (size_t)ras.count_ey * sizeof ( PCell ) + sizeof ( TCell ) - 1 )
+              / sizeof ( TCell );
 
         ras.cell_free = buffer + n;
         ras.cell      = ras.cell_null;
-        ras.min_ey    = band[1];
-        ras.max_ey    = band[0];
-        ras.count_ey  = width;
 
         error     = gray_convert_glyph_inner( RAS_VAR_ continued );
         continued = 1;
@@ -2031,10 +1939,10 @@ typedef ptrdiff_t  FT_PtrDist;
           return error;
 
         /* render pool overflow; we will reduce the render band by half */
-        width >>= 1;
+        i = ( band[0] - band[1] ) >> 1;
 
         /* this should never happen even with tiny rendering pool */
-        if ( width == 0 )
+        if ( i == 0 )
         {
           FT_TRACE7(( "gray_convert_glyph: rotten glyph\n" ));
           return FT_THROW( Raster_Overflow );
@@ -2042,7 +1950,7 @@ typedef ptrdiff_t  FT_PtrDist;
 
         band++;
         band[1]  = band[0];
-        band[0] += width;
+        band[0] += i;
       } while ( band >= bands );
     }
 
@@ -2073,7 +1981,7 @@ typedef ptrdiff_t  FT_PtrDist;
       return FT_THROW( Invalid_Outline );
 
     /* return immediately if the outline is empty */
-    if ( outline->n_points == 0 || outline->n_contours <= 0 )
+    if ( outline->n_points == 0 || outline->n_contours == 0 )
       return Smooth_Err_Ok;
 
     if ( !outline->contours || !outline->points )
@@ -2093,10 +2001,7 @@ typedef ptrdiff_t  FT_PtrDist;
       ras.render_span      = (FT_Raster_Span_Func)params->gray_spans;
       ras.render_span_data = params->user;
 
-      ras.min_ex = params->clip_box.xMin;
-      ras.min_ey = params->clip_box.yMin;
-      ras.max_ex = params->clip_box.xMax;
-      ras.max_ey = params->clip_box.yMax;
+      ras.cbox = params->clip_box;
     }
     else
     {
@@ -2122,14 +2027,14 @@ typedef ptrdiff_t  FT_PtrDist;
       ras.render_span      = (FT_Raster_Span_Func)NULL;
       ras.render_span_data = NULL;
 
-      ras.min_ex = 0;
-      ras.min_ey = 0;
-      ras.max_ex = (FT_Pos)target_map->width;
-      ras.max_ey = (FT_Pos)target_map->rows;
+      ras.cbox.xMin = 0;
+      ras.cbox.yMin = 0;
+      ras.cbox.xMax = (FT_Pos)target_map->width;
+      ras.cbox.yMax = (FT_Pos)target_map->rows;
     }
 
     /* exit if nothing to do */
-    if ( ras.max_ex <= ras.min_ex || ras.max_ey <= ras.min_ey )
+    if ( ras.cbox.xMin >= ras.cbox.xMax || ras.cbox.yMin >= ras.cbox.yMax )
       return Smooth_Err_Ok;
 
     return gray_convert_glyph( RAS_VAR );
diff --git a/src/java.desktop/share/native/libfreetype/src/smooth/ftgrays.h b/src/java.desktop/share/native/libfreetype/src/smooth/ftgrays.h
index a5001bf40d32..940fbe8c79bd 100644
--- a/src/java.desktop/share/native/libfreetype/src/smooth/ftgrays.h
+++ b/src/java.desktop/share/native/libfreetype/src/smooth/ftgrays.h
@@ -4,7 +4,7 @@
  *
  *   FreeType smooth renderer declaration
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/smooth/ftsmerrs.h b/src/java.desktop/share/native/libfreetype/src/smooth/ftsmerrs.h
index f4ac93dc410f..6d41fb8e0fd9 100644
--- a/src/java.desktop/share/native/libfreetype/src/smooth/ftsmerrs.h
+++ b/src/java.desktop/share/native/libfreetype/src/smooth/ftsmerrs.h
@@ -4,7 +4,7 @@
  *
  *   smooth renderer error codes (specification only).
  *
- * Copyright (C) 2001-2023 by
+ * Copyright (C) 2001-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/smooth/ftsmooth.c b/src/java.desktop/share/native/libfreetype/src/smooth/ftsmooth.c
index 9b0e8886cb33..f0acc1ea4a6e 100644
--- a/src/java.desktop/share/native/libfreetype/src/smooth/ftsmooth.c
+++ b/src/java.desktop/share/native/libfreetype/src/smooth/ftsmooth.c
@@ -4,7 +4,7 @@
  *
  *   Anti-aliasing renderer interface (body).
  *
- * Copyright (C) 2000-2023 by
+ * Copyright (C) 2000-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/smooth/ftsmooth.h b/src/java.desktop/share/native/libfreetype/src/smooth/ftsmooth.h
index f8bdc9938b32..d7b61a9e60ec 100644
--- a/src/java.desktop/share/native/libfreetype/src/smooth/ftsmooth.h
+++ b/src/java.desktop/share/native/libfreetype/src/smooth/ftsmooth.h
@@ -4,7 +4,7 @@
  *
  *   Anti-aliasing renderer interface (specification).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/truetype/ttdriver.c b/src/java.desktop/share/native/libfreetype/src/truetype/ttdriver.c
index d1496fec7fad..4ab68eb9a12d 100644
--- a/src/java.desktop/share/native/libfreetype/src/truetype/ttdriver.c
+++ b/src/java.desktop/share/native/libfreetype/src/truetype/ttdriver.c
@@ -4,7 +4,7 @@
  *
  *   TrueType font driver implementation (body).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -217,7 +217,20 @@
     kerning->y = 0;
 
     if ( sfnt )
-      kerning->x = sfnt->get_kerning( ttface, left_glyph, right_glyph );
+    {
+      /* Use 'kern' table if available since that can be faster; otherwise */
+      /* use GPOS kerning pairs if available.                              */
+      if ( ttface->kern_avail_bits != 0 )
+        kerning->x = sfnt->get_kerning( ttface,
+                                        left_glyph,
+                                        right_glyph );
+#ifdef TT_CONFIG_OPTION_GPOS_KERNING
+      else if ( ttface->gpos_kerning_available )
+        kerning->x = sfnt->get_gpos_kerning( ttface,
+                                             left_glyph,
+                                             right_glyph );
+#endif
+    }
 
     return 0;
   }
diff --git a/src/java.desktop/share/native/libfreetype/src/truetype/ttdriver.h b/src/java.desktop/share/native/libfreetype/src/truetype/ttdriver.h
index 757a66f425d5..3e1cf234fcfd 100644
--- a/src/java.desktop/share/native/libfreetype/src/truetype/ttdriver.h
+++ b/src/java.desktop/share/native/libfreetype/src/truetype/ttdriver.h
@@ -4,7 +4,7 @@
  *
  *   High-level TrueType driver interface (specification).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/truetype/tterrors.h b/src/java.desktop/share/native/libfreetype/src/truetype/tterrors.h
index 008ee99853cb..7ad937bd04d3 100644
--- a/src/java.desktop/share/native/libfreetype/src/truetype/tterrors.h
+++ b/src/java.desktop/share/native/libfreetype/src/truetype/tterrors.h
@@ -4,7 +4,7 @@
  *
  *   TrueType error codes (specification only).
  *
- * Copyright (C) 2001-2023 by
+ * Copyright (C) 2001-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/truetype/ttgload.c b/src/java.desktop/share/native/libfreetype/src/truetype/ttgload.c
index dc427e8a1160..b656ccf04e3c 100644
--- a/src/java.desktop/share/native/libfreetype/src/truetype/ttgload.c
+++ b/src/java.desktop/share/native/libfreetype/src/truetype/ttgload.c
@@ -4,7 +4,7 @@
  *
  *   TrueType Glyph Loader (body).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -353,7 +353,8 @@
     FT_Byte         c, count;
     FT_Vector       *vec, *vec_limit;
     FT_Pos          x, y;
-    FT_Short        *cont, *cont_limit, last;
+    FT_UShort       *cont, *cont_limit;
+    FT_Int          last;
 
 
     /* check that we can add the contours to the glyph */
@@ -372,7 +373,7 @@
     last = -1;
     for ( ; cont < cont_limit; cont++ )
     {
-      *cont = FT_NEXT_SHORT( p );
+      *cont = FT_NEXT_USHORT( p );
 
       if ( *cont <= last )
         goto Invalid_Outline;
@@ -418,11 +419,9 @@
       /* and thus allocate the bytecode array size by ourselves     */
       if ( n_ins )
       {
-        if ( FT_QNEW_ARRAY( exec->glyphIns, n_ins ) )
+        if ( FT_DUP( exec->glyphIns, p, n_ins ) )
           return error;
 
-        FT_MEM_COPY( exec->glyphIns, p, (FT_Long)n_ins );
-
         exec->glyphSize  = n_ins;
       }
     }
@@ -432,7 +431,7 @@
     p += n_ins;
 
     /* reading the point tags */
-    flag       = (FT_Byte*)outline->tags;
+    flag       = outline->tags;
     flag_limit = flag + n_points;
 
     FT_ASSERT( flag );
@@ -465,7 +464,7 @@
 
     vec       = outline->points;
     vec_limit = vec + n_points;
-    flag      = (FT_Byte*)outline->tags;
+    flag      = outline->tags;
     x         = 0;
 
     for ( ; vec < vec_limit; vec++, flag++ )
@@ -499,7 +498,7 @@
 
     vec       = outline->points;
     vec_limit = vec + n_points;
-    flag      = (FT_Byte*)outline->tags;
+    flag      = outline->tags;
     y         = 0;
 
     for ( ; vec < vec_limit; vec++, flag++ )
@@ -532,8 +531,8 @@
       *flag  = (FT_Byte)( f & ON_CURVE_POINT );
     }
 
-    outline->n_points   = (FT_Short)n_points;
-    outline->n_contours = (FT_Short)n_contours;
+    outline->n_points   = (FT_UShort)n_points;
+    outline->n_contours = (FT_UShort)n_contours;
 
     load->cursor = p;
 
@@ -754,15 +753,13 @@
                    FT_UInt       start_point,
                    FT_UInt       start_contour )
   {
-    zone->n_points    = (FT_UShort)load->outline.n_points + 4 -
-                          (FT_UShort)start_point;
-    zone->n_contours  = load->outline.n_contours -
-                          (FT_Short)start_contour;
+    zone->n_points    = load->outline.n_points + 4 - (FT_UShort)start_point;
+    zone->n_contours  = load->outline.n_contours - (FT_UShort)start_contour;
     zone->org         = load->extra_points + start_point;
     zone->cur         = load->outline.points + start_point;
     zone->orus        = load->extra_points2 + start_point;
-    zone->tags        = (FT_Byte*)load->outline.tags + start_point;
-    zone->contours    = (FT_UShort*)load->outline.contours + start_contour;
+    zone->tags        = load->outline.tags + start_point;
+    zone->contours    = load->outline.contours + start_contour;
     zone->first_point = (FT_UShort)start_point;
   }
 
@@ -1046,7 +1043,7 @@
     current.points   = gloader->base.outline.points +
                          num_base_points;
     current.n_points = gloader->base.outline.n_points -
-                         (short)num_base_points;
+                         (FT_UShort)num_base_points;
 
     have_scale = FT_BOOL( subglyph->flags & ( WE_HAVE_A_SCALE     |
                                               WE_HAVE_AN_XY_SCALE |
@@ -1059,7 +1056,7 @@
     /* get offset */
     if ( !( subglyph->flags & ARGS_ARE_XY_VALUES ) )
     {
-      FT_UInt     num_points = (FT_UInt)gloader->base.outline.n_points;
+      FT_UInt     num_points = gloader->base.outline.n_points;
       FT_UInt     k = (FT_UInt)subglyph->arg1;
       FT_UInt     l = (FT_UInt)subglyph->arg2;
       FT_Vector*  p1;
@@ -1721,8 +1718,8 @@
         FT_List_Add( &loader->composites, node );
       }
 
-      start_point   = (FT_UInt)gloader->base.outline.n_points;
-      start_contour = (FT_UInt)gloader->base.outline.n_contours;
+      start_point   = gloader->base.outline.n_points;
+      start_contour = gloader->base.outline.n_contours;
 
       /* for each subglyph, read composite header */
       error = face->read_composite_glyph( loader );
@@ -1741,14 +1738,14 @@
       if ( FT_IS_NAMED_INSTANCE( FT_FACE( face ) ) ||
            FT_IS_VARIATION( FT_FACE( face ) )      )
       {
-        short        i, limit;
+        FT_UShort    i, limit;
         FT_SubGlyph  subglyph;
 
         FT_Outline  outline = { 0, 0, NULL, NULL, NULL, 0 };
         FT_Vector*  unrounded = NULL;
 
 
-        limit = (short)gloader->current.num_subglyphs;
+        limit = (FT_UShort)gloader->current.num_subglyphs;
 
         /* construct an outline structure for              */
         /* communication with `TT_Vary_Apply_Glyph_Deltas' */
@@ -1874,7 +1871,7 @@
           linear_hadvance = loader->linear;
           linear_vadvance = loader->vadvance;
 
-          num_base_points = (FT_UInt)gloader->base.outline.n_points;
+          num_base_points = gloader->base.outline.n_points;
 
           error = load_truetype_glyph( loader,
                                        (FT_UInt)subglyph->index,
@@ -1898,7 +1895,7 @@
             loader->vadvance = linear_vadvance;
           }
 
-          num_points = (FT_UInt)gloader->base.outline.n_points;
+          num_points = gloader->base.outline.n_points;
 
           if ( num_points == num_base_points )
             continue;
@@ -2313,7 +2310,7 @@
        *
        * 1) we have a `tricky' font that heavily relies on the interpreter to
        *    render glyphs correctly, for example DFKai-SB, or
-       * 2) FT_RENDER_MODE_MONO (i.e, monochome rendering) is requested.
+       * 2) FT_RENDER_MODE_MONO (i.e, monochrome rendering) is requested.
        *
        * In those cases, backward compatibility needs to be turned off to get
        * correct rendering.  The rendering is then completely up to the
@@ -2719,7 +2716,7 @@
          size->metrics->y_ppem < 24         )
       glyph->outline.flags |= FT_OUTLINE_HIGH_PRECISION;
 
-    FT_TRACE1(( "  subglyphs = %u, contours = %hd, points = %hd,"
+    FT_TRACE1(( "  subglyphs = %u, contours = %hu, points = %hu,"
                 " flags = 0x%.3x\n",
                 loader.gloader->base.num_subglyphs,
                 glyph->outline.n_contours,
diff --git a/src/java.desktop/share/native/libfreetype/src/truetype/ttgload.h b/src/java.desktop/share/native/libfreetype/src/truetype/ttgload.h
index f18637dce330..22ea967f3013 100644
--- a/src/java.desktop/share/native/libfreetype/src/truetype/ttgload.h
+++ b/src/java.desktop/share/native/libfreetype/src/truetype/ttgload.h
@@ -4,7 +4,7 @@
  *
  *   TrueType Glyph Loader (specification).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/truetype/ttgxvar.c b/src/java.desktop/share/native/libfreetype/src/truetype/ttgxvar.c
index 9d149ea365cf..4f0083c96b7c 100644
--- a/src/java.desktop/share/native/libfreetype/src/truetype/ttgxvar.c
+++ b/src/java.desktop/share/native/libfreetype/src/truetype/ttgxvar.c
@@ -4,7 +4,7 @@
  *
  *   TrueType GX Font Variation loader
  *
- * Copyright (C) 2004-2023 by
+ * Copyright (C) 2004-2024 by
  * David Turner, Robert Wilhelm, Werner Lemberg, and George Williams.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -129,9 +129,6 @@
    *   stream ::
    *     The data stream.
    *
-   *   size ::
-   *     The size of the table holding the data.
-   *
    * @Output:
    *   point_cnt ::
    *     The number of points read.  A zero value means that
@@ -144,14 +141,14 @@
    */
   static FT_UShort*
   ft_var_readpackedpoints( FT_Stream  stream,
-                           FT_ULong   size,
                            FT_UInt   *point_cnt )
   {
     FT_UShort *points = NULL;
     FT_UInt    n;
-    FT_UInt    runcnt;
+    FT_UInt    runcnt, cnt;
     FT_UInt    i, j;
     FT_UShort  first;
+    FT_Byte*   p;
     FT_Memory  memory = stream->memory;
     FT_Error   error;
 
@@ -169,56 +166,60 @@
       n  |= FT_GET_BYTE();
     }
 
-    if ( n > size )
-    {
-      FT_TRACE1(( "ft_var_readpackedpoints: number of points too large\n" ));
+    if ( FT_QNEW_ARRAY( points, n ) )
       return NULL;
-    }
-
-    /* in the nested loops below we increase `i' twice; */
-    /* it is faster to simply allocate one more slot    */
-    /* than to add another test within the loop         */
-    if ( FT_QNEW_ARRAY( points, n + 1 ) )
-      return NULL;
-
-    *point_cnt = n;
 
+    p     = stream->cursor;
     first = 0;
     i     = 0;
     while ( i < n )
     {
-      runcnt = FT_GET_BYTE();
+      if ( p >= stream->limit )
+        goto Fail;
+
+      runcnt = FT_NEXT_BYTE( p );
+      cnt    = runcnt & GX_PT_POINT_RUN_COUNT_MASK;
+
+      /* first point not included in run count */
+      cnt++;
+      if ( cnt > n - i )
+        cnt = n - i;
+
       if ( runcnt & GX_PT_POINTS_ARE_WORDS )
       {
-        runcnt     &= GX_PT_POINT_RUN_COUNT_MASK;
-        first      += FT_GET_USHORT();
-        points[i++] = first;
+        if ( 2 * cnt > (FT_UInt)( stream->limit - p ) )
+          goto Fail;
 
-        /* first point not included in run count */
-        for ( j = 0; j < runcnt; j++ )
+        for ( j = 0; j < cnt; j++ )
         {
-          first      += FT_GET_USHORT();
+          first      += FT_NEXT_USHORT( p );
           points[i++] = first;
-          if ( i >= n )
-            break;
         }
       }
       else
       {
-        first      += FT_GET_BYTE();
-        points[i++] = first;
+        if ( cnt > (FT_UInt)( stream->limit - p ) )
+          goto Fail;
 
-        for ( j = 0; j < runcnt; j++ )
+        for ( j = 0; j < cnt; j++ )
         {
-          first      += FT_GET_BYTE();
+          first      += FT_NEXT_BYTE( p );
           points[i++] = first;
-          if ( i >= n )
-            break;
         }
       }
     }
 
+    stream->cursor = p;
+
+    *point_cnt = n;
+
     return points;
+
+  Fail:
+    FT_TRACE1(( "ft_var_readpackedpoints: invalid table\n" ));
+
+    FT_FREE( points );
+    return NULL;
   }
 
 
@@ -240,9 +241,6 @@
    *   stream ::
    *     The data stream.
    *
-   *   size ::
-   *     The size of the table holding the data.
-   *
    *   delta_cnt ::
    *     The number of deltas to be read.
    *
@@ -258,13 +256,12 @@
    */
   static FT_Fixed*
   ft_var_readpackeddeltas( FT_Stream  stream,
-                           FT_ULong   size,
                            FT_UInt    delta_cnt )
   {
     FT_Fixed  *deltas = NULL;
     FT_UInt    runcnt, cnt;
     FT_UInt    i, j;
-    FT_UInt    bytes_used;
+    FT_Byte*   p;
     FT_Memory  memory = stream->memory;
     FT_Error   error;
 
@@ -272,68 +269,51 @@
     if ( FT_QNEW_ARRAY( deltas, delta_cnt ) )
       return NULL;
 
-    i          = 0;
-    bytes_used = 0;
-
-    while ( i < delta_cnt && bytes_used < size )
+    p = stream->cursor;
+    i = 0;
+    while ( i < delta_cnt )
     {
-      runcnt = FT_GET_BYTE();
+      if ( p >= stream->limit )
+        goto Fail;
+
+      runcnt = FT_NEXT_BYTE( p );
       cnt    = runcnt & GX_DT_DELTA_RUN_COUNT_MASK;
 
-      bytes_used++;
+      /* first point not included in run count */
+      cnt++;
+      if ( cnt > delta_cnt - i )
+        cnt = delta_cnt - i;
 
       if ( runcnt & GX_DT_DELTAS_ARE_ZERO )
       {
-        /* `cnt` + 1 zeroes get added */
-        for ( j = 0; j <= cnt && i < delta_cnt; j++ )
+        for ( j = 0; j < cnt; j++ )
           deltas[i++] = 0;
       }
       else if ( runcnt & GX_DT_DELTAS_ARE_WORDS )
       {
-        /* `cnt` + 1 shorts from the stack */
-        bytes_used += 2 * ( cnt + 1 );
-        if ( bytes_used > size )
-        {
-          FT_TRACE1(( "ft_var_readpackeddeltas:"
-                      " number of short deltas too large\n" ));
+        if ( 2 * cnt > (FT_UInt)( stream->limit - p ) )
           goto Fail;
-        }
 
-        for ( j = 0; j <= cnt && i < delta_cnt; j++ )
-          deltas[i++] = FT_intToFixed( FT_GET_SHORT() );
+        for ( j = 0; j < cnt; j++ )
+          deltas[i++] = FT_intToFixed( FT_NEXT_SHORT( p ) );
       }
       else
       {
-        /* `cnt` + 1 signed bytes from the stack */
-        bytes_used += cnt + 1;
-        if ( bytes_used > size )
-        {
-          FT_TRACE1(( "ft_var_readpackeddeltas:"
-                      " number of byte deltas too large\n" ));
+        if ( cnt > (FT_UInt)( stream->limit - p ) )
           goto Fail;
-        }
 
-        for ( j = 0; j <= cnt && i < delta_cnt; j++ )
-          deltas[i++] = FT_intToFixed( FT_GET_CHAR() );
-      }
-
-      if ( j <= cnt )
-      {
-        FT_TRACE1(( "ft_var_readpackeddeltas:"
-                    " number of deltas too large\n" ));
-        goto Fail;
+        for ( j = 0; j < cnt; j++ )
+          deltas[i++] = FT_intToFixed( FT_NEXT_CHAR( p ) );
       }
     }
 
-    if ( i < delta_cnt )
-    {
-      FT_TRACE1(( "ft_var_readpackeddeltas: not enough deltas\n" ));
-      goto Fail;
-    }
+    stream->cursor = p;
 
     return deltas;
 
   Fail:
+    FT_TRACE1(( "ft_var_readpackeddeltas: invalid table\n" ));
+
     FT_FREE( deltas );
     return NULL;
   }
@@ -596,7 +576,7 @@
 
       for ( j = 0; j < itemStore->axisCount; j++ )
       {
-        FT_Short  start, peak, end;
+        FT_Int  start, peak, end;
 
 
         if ( FT_READ_SHORT( start ) ||
@@ -604,6 +584,10 @@
              FT_READ_SHORT( end )   )
           goto Exit;
 
+        /* immediately tag invalid ranges with special peak = 0 */
+        if ( ( start < 0 && end > 0 ) || start > peak || peak > end )
+          peak = 0;
+
         axisCoords[j].startCoord = FT_fdot14ToFixed( start );
         axisCoords[j].peakCoord  = FT_fdot14ToFixed( peak );
         axisCoords[j].endCoord   = FT_fdot14ToFixed( end );
@@ -1024,6 +1008,9 @@
     if ( innerIndex >= varData->itemCount )
       return 0; /* Out of range. */
 
+    if ( varData->regionIdxCount == 0 )
+      return 0; /* Avoid "applying zero offset to null pointer". */
+
     if ( varData->regionIdxCount < 16 )
     {
       deltaSet = deltaSetStack;
@@ -1074,43 +1061,32 @@
       /* inner loop steps through axes in this region */
       for ( j = 0; j < itemStore->axisCount; j++, axis++ )
       {
-        /* compute the scalar contribution of this axis; */
-        /* ignore invalid ranges                         */
-        if ( axis->startCoord > axis->peakCoord ||
-             axis->peakCoord > axis->endCoord   )
-          continue;
+        FT_Fixed  ncv = ttface->blend->normalizedcoords[j];
 
-        else if ( axis->startCoord < 0 &&
-                  axis->endCoord > 0   &&
-                  axis->peakCoord != 0 )
-          continue;
 
-        /* peak of 0 means ignore this axis */
-        else if ( axis->peakCoord == 0 )
-          continue;
-
-        else if ( ttface->blend->normalizedcoords[j] == axis->peakCoord )
+        /* compute the scalar contribution of this axis */
+        /* with peak of 0 used for invalid axes         */
+        if ( axis->peakCoord == ncv ||
+             axis->peakCoord == 0   )
           continue;
 
         /* ignore this region if coords are out of range */
-        else if ( ttface->blend->normalizedcoords[j] <= axis->startCoord ||
-                  ttface->blend->normalizedcoords[j] >= axis->endCoord   )
+        else if ( ncv <= axis->startCoord ||
+                  ncv >= axis->endCoord   )
         {
           scalar = 0;
           break;
         }
 
         /* cumulative product of all the axis scalars */
-        else if ( ttface->blend->normalizedcoords[j] < axis->peakCoord )
-          scalar =
-            FT_MulDiv( scalar,
-                       ttface->blend->normalizedcoords[j] - axis->startCoord,
-                       axis->peakCoord - axis->startCoord );
-        else
-          scalar =
-            FT_MulDiv( scalar,
-                       axis->endCoord - ttface->blend->normalizedcoords[j],
-                       axis->endCoord - axis->peakCoord );
+        else if ( ncv < axis->peakCoord )
+          scalar = FT_MulDiv( scalar,
+                              ncv - axis->startCoord,
+                              axis->peakCoord - axis->startCoord );
+        else   /* ncv > axis->peakCoord */
+          scalar = FT_MulDiv( scalar,
+                              axis->endCoord - ncv,
+                              axis->endCoord - axis->peakCoord );
 
       } /* per-axis loop */
 
@@ -1920,32 +1896,27 @@
 
     for ( i = 0; i < blend->num_axis; i++ )
     {
-      FT_TRACE6(( "    axis %d coordinate %.5f:\n",
-                  i, (double)blend->normalizedcoords[i] / 65536 ));
+      FT_Fixed  ncv = blend->normalizedcoords[i];
+
+
+      FT_TRACE6(( "    axis %d coordinate %.5f:\n", i, (double)ncv / 65536 ));
 
       /* It's not clear why (for intermediate tuples) we don't need     */
       /* to check against start/end -- the documentation says we don't. */
       /* Similarly, it's unclear why we don't need to scale along the   */
       /* axis.                                                          */
 
-      if ( tuple_coords[i] == 0 )
+      if ( tuple_coords[i] == ncv )
       {
-        FT_TRACE6(( "      tuple coordinate is zero, ignore\n" ));
+        FT_TRACE6(( "      tuple coordinate %.5f fits perfectly\n",
+                    (double)tuple_coords[i] / 65536 ));
+        /* `apply' does not change */
         continue;
       }
 
-      if ( blend->normalizedcoords[i] == 0 )
-      {
-        FT_TRACE6(( "      axis coordinate is zero, stop\n" ));
-        apply = 0;
-        break;
-      }
-
-      if ( blend->normalizedcoords[i] == tuple_coords[i] )
+      if ( tuple_coords[i] == 0 )
       {
-        FT_TRACE6(( "      tuple coordinate %.5f fits perfectly\n",
-                    (double)tuple_coords[i] / 65536 ));
-        /* `apply' does not change */
+        FT_TRACE6(( "      tuple coordinate is zero, ignore\n" ));
         continue;
       }
 
@@ -1953,27 +1924,27 @@
       {
         /* not an intermediate tuple */
 
-        if ( blend->normalizedcoords[i] < FT_MIN( 0, tuple_coords[i] ) ||
-             blend->normalizedcoords[i] > FT_MAX( 0, tuple_coords[i] ) )
+        if ( ( tuple_coords[i] > ncv && ncv > 0 ) ||
+             ( tuple_coords[i] < ncv && ncv < 0 ) )
+        {
+          FT_TRACE6(( "      tuple coordinate %.5f fits\n",
+                      (double)tuple_coords[i] / 65536 ));
+          apply = FT_MulDiv( apply, ncv, tuple_coords[i] );
+        }
+        else
         {
           FT_TRACE6(( "      tuple coordinate %.5f is exceeded, stop\n",
                       (double)tuple_coords[i] / 65536 ));
           apply = 0;
           break;
         }
-
-        FT_TRACE6(( "      tuple coordinate %.5f fits\n",
-                    (double)tuple_coords[i] / 65536 ));
-        apply = FT_MulDiv( apply,
-                           blend->normalizedcoords[i],
-                           tuple_coords[i] );
       }
       else
       {
         /* intermediate tuple */
 
-        if ( blend->normalizedcoords[i] <= im_start_coords[i] ||
-             blend->normalizedcoords[i] >= im_end_coords[i]   )
+        if ( ncv <= im_start_coords[i] ||
+             ncv >= im_end_coords[i]   )
         {
           FT_TRACE6(( "      intermediate tuple range ]%.5f;%.5f[ is exceeded,"
                       " stop\n",
@@ -1986,13 +1957,13 @@
         FT_TRACE6(( "      intermediate tuple range ]%.5f;%.5f[ fits\n",
                     (double)im_start_coords[i] / 65536,
                     (double)im_end_coords[i] / 65536 ));
-        if ( blend->normalizedcoords[i] < tuple_coords[i] )
+        if ( ncv < tuple_coords[i] )
           apply = FT_MulDiv( apply,
-                             blend->normalizedcoords[i] - im_start_coords[i],
+                             ncv - im_start_coords[i],
                              tuple_coords[i] - im_start_coords[i] );
-        else
+        else /* ncv > tuple_coords[i] */
           apply = FT_MulDiv( apply,
-                             im_end_coords[i] - blend->normalizedcoords[i],
+                             im_end_coords[i] - ncv,
                              im_end_coords[i] - tuple_coords[i] );
       }
     }
@@ -2141,11 +2112,12 @@
                                          outerIndex,
                                          innerIndex );
 
-      v += delta << 2;
+          /* Convert delta in F2DOT14 to 16.16 before adding. */
+          v += MUL_INT( delta, 4 );
 
-      /* Clamp value range. */
-      v = v >=  0x10000L ?  0x10000 : v;
-      v = v <= -0x10000L ? -0x10000 : v;
+          /* Clamp value to range [-1, 1]. */
+          v = v >=  0x10000L ?  0x10000 : v;
+          v = v <= -0x10000L ? -0x10000 : v;
 
           new_normalized[i] = v;
         }
@@ -2721,9 +2693,8 @@
       FT_UInt  n;
 
 
-      if ( FT_ALLOC( mmvar, ttface->blend->mmvar_len ) )
+      if ( FT_DUP( mmvar, ttface->blend->mmvar, ttface->blend->mmvar_len ) )
         goto Exit;
-      FT_MEM_COPY( mmvar, ttface->blend->mmvar, ttface->blend->mmvar_len );
 
       axis_flags =
         (FT_UShort*)( (char*)mmvar + mmvar_size );
@@ -3533,9 +3504,10 @@
     FT_ULong  here;
     FT_UInt   i, j;
 
-    FT_Fixed*  tuple_coords    = NULL;
-    FT_Fixed*  im_start_coords = NULL;
-    FT_Fixed*  im_end_coords   = NULL;
+    FT_Fixed*  peak_coords = NULL;
+    FT_Fixed*  tuple_coords;
+    FT_Fixed*  im_start_coords;
+    FT_Fixed*  im_end_coords;
 
     GX_Blend  blend = face->blend;
 
@@ -3556,16 +3528,16 @@
     {
       FT_TRACE2(( "\n" ));
       FT_TRACE2(( "tt_face_vary_cvt: no blend specified\n" ));
-      error = FT_Err_Ok;
-      goto Exit;
+
+      return FT_Err_Ok;
     }
 
     if ( !face->cvt )
     {
       FT_TRACE2(( "\n" ));
       FT_TRACE2(( "tt_face_vary_cvt: no `cvt ' table\n" ));
-      error = FT_Err_Ok;
-      goto Exit;
+
+      return FT_Err_Ok;
     }
 
     error = face->goto_table( face, TTAG_cvar, stream, &table_len );
@@ -3573,15 +3545,11 @@
     {
       FT_TRACE2(( "is missing\n" ));
 
-      error = FT_Err_Ok;
-      goto Exit;
+      return FT_Err_Ok;
     }
 
     if ( FT_FRAME_ENTER( table_len ) )
-    {
-      error = FT_Err_Ok;
-      goto Exit;
-    }
+      return FT_Err_Ok;
 
     table_start = FT_Stream_FTell( stream );
     if ( FT_GET_LONG() != 0x00010000L )
@@ -3594,11 +3562,6 @@
 
     FT_TRACE2(( "loaded\n" ));
 
-    if ( FT_NEW_ARRAY( tuple_coords, blend->num_axis )    ||
-         FT_NEW_ARRAY( im_start_coords, blend->num_axis ) ||
-         FT_NEW_ARRAY( im_end_coords, blend->num_axis )   )
-      goto FExit;
-
     tupleCount   = FT_GET_USHORT();
     offsetToData = FT_GET_USHORT();
 
@@ -3621,9 +3584,8 @@
 
       FT_Stream_SeekSet( stream, offsetToData );
 
-      sharedpoints = ft_var_readpackedpoints( stream,
-                                              table_len,
-                                              &spoint_count );
+      sharedpoints = ft_var_readpackedpoints( stream, &spoint_count );
+
       offsetToData = FT_Stream_FTell( stream );
 
       FT_Stream_SeekSet( stream, here );
@@ -3634,8 +3596,12 @@
                 tupleCount & GX_TC_TUPLE_COUNT_MASK,
                 ( tupleCount & GX_TC_TUPLE_COUNT_MASK ) == 1 ? "" : "s" ));
 
-    if ( FT_NEW_ARRAY( cvt_deltas, face->cvt_size ) )
-      goto FExit;
+    if ( FT_QNEW_ARRAY( peak_coords, 3 * blend->num_axis ) ||
+         FT_NEW_ARRAY( cvt_deltas, face->cvt_size )        )
+      goto Exit;
+
+    im_start_coords = peak_coords + blend->num_axis;
+    im_end_coords = im_start_coords + blend->num_axis;
 
     for ( i = 0; i < ( tupleCount & GX_TC_TUPLE_COUNT_MASK ); i++ )
     {
@@ -3652,32 +3618,19 @@
       if ( tupleIndex & GX_TI_EMBEDDED_TUPLE_COORD )
       {
         for ( j = 0; j < blend->num_axis; j++ )
-          tuple_coords[j] = FT_fdot14ToFixed( FT_GET_SHORT() );
+          peak_coords[j] = FT_fdot14ToFixed( FT_GET_SHORT() );
+        tuple_coords = peak_coords;
       }
-      else if ( ( tupleIndex & GX_TI_TUPLE_INDEX_MASK ) >= blend->tuplecount )
+      else if ( ( tupleIndex & GX_TI_TUPLE_INDEX_MASK ) < blend->tuplecount )
+        tuple_coords = blend->tuplecoords +
+            ( tupleIndex & GX_TI_TUPLE_INDEX_MASK ) * blend->num_axis;
+      else
       {
         FT_TRACE2(( "tt_face_vary_cvt:"
                     " invalid tuple index\n" ));
 
         error = FT_THROW( Invalid_Table );
-        goto FExit;
-      }
-      else
-      {
-        if ( !blend->tuplecoords )
-        {
-          FT_TRACE2(( "tt_face_vary_cvt:"
-                      " no valid tuple coordinates available\n" ));
-
-          error = FT_THROW( Invalid_Table );
-          goto FExit;
-        }
-
-        FT_MEM_COPY(
-          tuple_coords,
-          blend->tuplecoords +
-            ( tupleIndex & GX_TI_TUPLE_INDEX_MASK ) * blend->num_axis,
-          blend->num_axis * sizeof ( FT_Fixed ) );
+        goto Exit;
       }
 
       if ( tupleIndex & GX_TI_INTERMEDIATE_TUPLE )
@@ -3706,9 +3659,7 @@
 
       if ( tupleIndex & GX_TI_PRIVATE_POINT_NUMBERS )
       {
-        localpoints = ft_var_readpackedpoints( stream,
-                                               table_len,
-                                               &point_count );
+        localpoints = ft_var_readpackedpoints( stream, &point_count );
         points      = localpoints;
       }
       else
@@ -3719,7 +3670,6 @@
       }
 
       deltas = ft_var_readpackeddeltas( stream,
-                                        table_len,
                                         point_count == 0 ? face->cvt_size
                                                          : point_count );
 
@@ -3820,22 +3770,20 @@
     for ( i = 0; i < face->cvt_size; i++ )
       face->cvt[i] += FT_fixedToFdot6( cvt_deltas[i] );
 
-  FExit:
-    FT_FRAME_EXIT();
+    /* Iterate over all `FT_Size` objects and set `cvt_ready` to -1 */
+    /* to trigger rescaling of all CVT values.                      */
+    FT_List_Iterate( &root->sizes_list,
+                     tt_cvt_ready_iterator,
+                     NULL );
 
   Exit:
     if ( sharedpoints != ALL_POINTS )
       FT_FREE( sharedpoints );
-    FT_FREE( tuple_coords );
-    FT_FREE( im_start_coords );
-    FT_FREE( im_end_coords );
     FT_FREE( cvt_deltas );
+    FT_FREE( peak_coords );
 
-    /* iterate over all FT_Size objects and set `cvt_ready' to -1 */
-    /* to trigger rescaling of all CVT values                     */
-    FT_List_Iterate( &root->sizes_list,
-                     tt_cvt_ready_iterator,
-                     NULL );
+  FExit:
+    FT_FRAME_EXIT();
 
     return error;
 
@@ -4099,9 +4047,10 @@
     FT_ULong  here;
     FT_UInt   i, j;
 
-    FT_Fixed*  tuple_coords    = NULL;
-    FT_Fixed*  im_start_coords = NULL;
-    FT_Fixed*  im_end_coords   = NULL;
+    FT_Fixed*  peak_coords = NULL;
+    FT_Fixed*  tuple_coords;
+    FT_Fixed*  im_start_coords;
+    FT_Fixed*  im_end_coords;
 
     GX_Blend  blend = face->blend;
 
@@ -4136,27 +4085,17 @@
       return FT_Err_Ok;
     }
 
-    if ( FT_NEW_ARRAY( points_org, n_points ) ||
-         FT_NEW_ARRAY( points_out, n_points ) ||
-         FT_NEW_ARRAY( has_delta, n_points )  )
-      goto Fail1;
-
     dataSize = blend->glyphoffsets[glyph_index + 1] -
                  blend->glyphoffsets[glyph_index];
 
     if ( FT_STREAM_SEEK( blend->glyphoffsets[glyph_index] ) ||
          FT_FRAME_ENTER( dataSize )                         )
-      goto Fail1;
+      return error;
 
     glyph_start = FT_Stream_FTell( stream );
 
     /* each set of glyph variation data is formatted similarly to `cvar' */
 
-    if ( FT_NEW_ARRAY( tuple_coords, blend->num_axis )    ||
-         FT_NEW_ARRAY( im_start_coords, blend->num_axis ) ||
-         FT_NEW_ARRAY( im_end_coords, blend->num_axis )   )
-      goto Fail2;
-
     tupleCount   = FT_GET_USHORT();
     offsetToData = FT_GET_USHORT();
 
@@ -4168,7 +4107,7 @@
                   " invalid glyph variation array header\n" ));
 
       error = FT_THROW( Invalid_Table );
-      goto Fail2;
+      goto FExit;
     }
 
     offsetToData += glyph_start;
@@ -4179,9 +4118,8 @@
 
       FT_Stream_SeekSet( stream, offsetToData );
 
-      sharedpoints = ft_var_readpackedpoints( stream,
-                                              blend->gvar_size,
-                                              &spoint_count );
+      sharedpoints = ft_var_readpackedpoints( stream, &spoint_count );
+
       offsetToData = FT_Stream_FTell( stream );
 
       FT_Stream_SeekSet( stream, here );
@@ -4192,9 +4130,16 @@
                 tupleCount & GX_TC_TUPLE_COUNT_MASK,
                 ( tupleCount & GX_TC_TUPLE_COUNT_MASK ) == 1 ? "" : "s" ));
 
-    if ( FT_NEW_ARRAY( point_deltas_x, n_points ) ||
-         FT_NEW_ARRAY( point_deltas_y, n_points ) )
-      goto Fail3;
+    if ( FT_QNEW_ARRAY( peak_coords, 3 * blend->num_axis ) ||
+         FT_NEW_ARRAY( point_deltas_x, 2 * n_points )      ||
+         FT_QNEW_ARRAY( points_org, n_points )             ||
+         FT_QNEW_ARRAY( points_out, n_points )             ||
+         FT_QNEW_ARRAY( has_delta, n_points )              )
+      goto Exit;
+
+    im_start_coords = peak_coords + blend->num_axis;
+    im_end_coords   = im_start_coords + blend->num_axis;
+    point_deltas_y  = point_deltas_x + n_points;
 
     for ( j = 0; j < n_points; j++ )
     {
@@ -4217,22 +4162,20 @@
       if ( tupleIndex & GX_TI_EMBEDDED_TUPLE_COORD )
       {
         for ( j = 0; j < blend->num_axis; j++ )
-          tuple_coords[j] = FT_fdot14ToFixed( FT_GET_SHORT() );
+          peak_coords[j] = FT_fdot14ToFixed( FT_GET_SHORT() );
+        tuple_coords = peak_coords;
       }
-      else if ( ( tupleIndex & GX_TI_TUPLE_INDEX_MASK ) >= blend->tuplecount )
+      else if ( ( tupleIndex & GX_TI_TUPLE_INDEX_MASK ) < blend->tuplecount )
+        tuple_coords = blend->tuplecoords +
+            ( tupleIndex & GX_TI_TUPLE_INDEX_MASK ) * blend->num_axis;
+      else
       {
         FT_TRACE2(( "TT_Vary_Apply_Glyph_Deltas:"
                     " invalid tuple index\n" ));
 
         error = FT_THROW( Invalid_Table );
-        goto Fail3;
+        goto Exit;
       }
-      else
-        FT_MEM_COPY(
-          tuple_coords,
-          blend->tuplecoords +
-            ( tupleIndex & GX_TI_TUPLE_INDEX_MASK ) * blend->num_axis,
-          blend->num_axis * sizeof ( FT_Fixed ) );
 
       if ( tupleIndex & GX_TI_INTERMEDIATE_TUPLE )
       {
@@ -4260,9 +4203,7 @@
 
       if ( tupleIndex & GX_TI_PRIVATE_POINT_NUMBERS )
       {
-        localpoints = ft_var_readpackedpoints( stream,
-                                               blend->gvar_size,
-                                               &point_count );
+        localpoints = ft_var_readpackedpoints( stream, &point_count );
         points      = localpoints;
       }
       else
@@ -4272,11 +4213,9 @@
       }
 
       deltas_x = ft_var_readpackeddeltas( stream,
-                                          blend->gvar_size,
                                           point_count == 0 ? n_points
                                                            : point_count );
       deltas_y = ft_var_readpackeddeltas( stream,
-                                          blend->gvar_size,
                                           point_count == 0 ? n_points
                                                            : point_count );
 
@@ -4460,23 +4399,17 @@
                                        unrounded[n_points - 2].y ) / 64;
     }
 
-  Fail3:
-    FT_FREE( point_deltas_x );
-    FT_FREE( point_deltas_y );
-
-  Fail2:
+  Exit:
     if ( sharedpoints != ALL_POINTS )
       FT_FREE( sharedpoints );
-    FT_FREE( tuple_coords );
-    FT_FREE( im_start_coords );
-    FT_FREE( im_end_coords );
-
-    FT_FRAME_EXIT();
-
-  Fail1:
     FT_FREE( points_org );
     FT_FREE( points_out );
     FT_FREE( has_delta );
+    FT_FREE( peak_coords );
+    FT_FREE( point_deltas_x );
+
+  FExit:
+    FT_FRAME_EXIT();
 
     return error;
   }
diff --git a/src/java.desktop/share/native/libfreetype/src/truetype/ttgxvar.h b/src/java.desktop/share/native/libfreetype/src/truetype/ttgxvar.h
index e3da6d1705cc..9326011e3a24 100644
--- a/src/java.desktop/share/native/libfreetype/src/truetype/ttgxvar.h
+++ b/src/java.desktop/share/native/libfreetype/src/truetype/ttgxvar.h
@@ -4,7 +4,7 @@
  *
  *   TrueType GX Font Variation loader (specification)
  *
- * Copyright (C) 2004-2023 by
+ * Copyright (C) 2004-2024 by
  * David Turner, Robert Wilhelm, Werner Lemberg and George Williams.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/truetype/ttinterp.c b/src/java.desktop/share/native/libfreetype/src/truetype/ttinterp.c
index 79df4555d943..951891dbf51c 100644
--- a/src/java.desktop/share/native/libfreetype/src/truetype/ttinterp.c
+++ b/src/java.desktop/share/native/libfreetype/src/truetype/ttinterp.c
@@ -4,7 +4,7 @@
  *
  *   TrueType bytecode interpreter (body).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -5270,11 +5270,11 @@
     FT_UShort        refp;
     FT_F26Dot6       dx, dy;
 
-    FT_Short         contour, bounds;
+    FT_UShort        contour, bounds;
     FT_UShort        start, limit, i;
 
 
-    contour = (FT_Short)args[0];
+    contour = (FT_UShort)args[0];
     bounds  = ( exc->GS.gep2 == 0 ) ? 1 : exc->zp2.n_contours;
 
     if ( BOUNDS( contour, bounds ) )
@@ -5290,15 +5290,13 @@
     if ( contour == 0 )
       start = 0;
     else
-      start = (FT_UShort)( exc->zp2.contours[contour - 1] + 1 -
-                           exc->zp2.first_point );
+      start = exc->zp2.contours[contour - 1] + 1 - exc->zp2.first_point;
 
     /* we use the number of points if in the twilight zone */
     if ( exc->GS.gep2 == 0 )
       limit = exc->zp2.n_points;
     else
-      limit = (FT_UShort)( exc->zp2.contours[contour] -
-                           exc->zp2.first_point + 1 );
+      limit = exc->zp2.contours[contour] + 1 - exc->zp2.first_point;
 
     for ( i = start; i < limit; i++ )
     {
@@ -5341,9 +5339,9 @@
     /*      Normal zone's `n_points' includes phantoms, so must    */
     /*      use end of last contour.                               */
     if ( exc->GS.gep2 == 0 )
-      limit = (FT_UShort)exc->zp2.n_points;
+      limit = exc->zp2.n_points;
     else if ( exc->GS.gep2 == 1 && exc->zp2.n_contours > 0 )
-      limit = (FT_UShort)( exc->zp2.contours[exc->zp2.n_contours - 1] + 1 );
+      limit = exc->zp2.contours[exc->zp2.n_contours - 1] + 1;
     else
       limit = 0;
 
diff --git a/src/java.desktop/share/native/libfreetype/src/truetype/ttinterp.h b/src/java.desktop/share/native/libfreetype/src/truetype/ttinterp.h
index e98e258fe7ed..4f1a9bbc6794 100644
--- a/src/java.desktop/share/native/libfreetype/src/truetype/ttinterp.h
+++ b/src/java.desktop/share/native/libfreetype/src/truetype/ttinterp.h
@@ -4,7 +4,7 @@
  *
  *   TrueType bytecode interpreter (specification).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/truetype/ttobjs.c b/src/java.desktop/share/native/libfreetype/src/truetype/ttobjs.c
index 5b56af711df4..d0ac31812045 100644
--- a/src/java.desktop/share/native/libfreetype/src/truetype/ttobjs.c
+++ b/src/java.desktop/share/native/libfreetype/src/truetype/ttobjs.c
@@ -4,7 +4,7 @@
  *
  *   Objects manager (body).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -115,7 +115,7 @@
   FT_LOCAL_DEF( FT_Error )
   tt_glyphzone_new( FT_Memory     memory,
                     FT_UShort     maxPoints,
-                    FT_Short      maxContours,
+                    FT_UShort     maxContours,
                     TT_GlyphZone  zone )
   {
     FT_Error  error;
@@ -152,18 +152,20 @@
   static const FT_String*
   tt_skip_pdffont_random_tag( const FT_String*  name )
   {
-    unsigned int  i;
-
-
-    if ( ft_strlen( name ) < 8 || name[6] != '+' )
-      return name;
-
-    for ( i = 0; i < 6; i++ )
-      if ( !ft_isupper( name[i] ) )
-        return name;
+    if ( ft_isupper( name[0] ) &&
+         ft_isupper( name[1] ) &&
+         ft_isupper( name[2] ) &&
+         ft_isupper( name[3] ) &&
+         ft_isupper( name[4] ) &&
+         ft_isupper( name[5] ) &&
+              '+' == name[6]   &&
+                     name[7]   )
+    {
+      FT_TRACE7(( "name without randomization tag: %s\n", name + 7 ));
+      return name + 7;
+    }
 
-    FT_TRACE7(( "name without randomization tag: %s\n", name + 7 ));
-    return name + 7;
+    return name;
   }
 
 
@@ -254,17 +256,20 @@
   {
     FT_Error   error;
     FT_UInt32  checksum = 0;
-    FT_UInt    i;
+    FT_Byte*   p;
+    FT_Int     shift;
 
 
     if ( FT_FRAME_ENTER( length ) )
       return 0;
 
+    p = (FT_Byte*)stream->cursor;
+
     for ( ; length > 3; length -= 4 )
-      checksum += (FT_UInt32)FT_GET_ULONG();
+      checksum += FT_NEXT_ULONG( p );
 
-    for ( i = 3; length > 0; length--, i-- )
-      checksum += (FT_UInt32)FT_GET_BYTE() << ( i * 8 );
+    for ( shift = 24; length > 0; length--, shift -=8 )
+      checksum += (FT_UInt32)FT_NEXT_BYTE( p ) << shift;
 
     FT_FRAME_EXIT();
 
@@ -782,8 +787,7 @@
       FT_UInt  instance_index = (FT_UInt)face_index >> 16;
 
 
-      if ( FT_HAS_MULTIPLE_MASTERS( ttface ) &&
-           instance_index > 0                )
+      if ( FT_HAS_MULTIPLE_MASTERS( ttface ) )
       {
         error = FT_Set_Named_Instance( ttface, instance_index );
         if ( error )
@@ -990,16 +994,16 @@
     FT_Error        error;
     FT_UInt         i;
 
-    /* unscaled CVT values are already stored in 26.6 format */
-    FT_Fixed  scale = size->ttmetrics.scale >> 6;
-
 
     /* Scale the cvt values to the new ppem.            */
     /* By default, we use the y ppem value for scaling. */
     FT_TRACE6(( "CVT values:\n" ));
     for ( i = 0; i < size->cvt_size; i++ )
     {
-      size->cvt[i] = FT_MulFix( face->cvt[i], scale );
+      /* Unscaled CVT values are already stored in 26.6 format.            */
+      /* Note that this scaling operation is very sensitive to rounding;   */
+      /* the integer division by 64 must be applied to the first argument. */
+      size->cvt[i] = FT_MulFix( face->cvt[i] / 64, size->ttmetrics.scale );
       FT_TRACE6(( "  %3d: %f (%f)\n",
                   i, (double)face->cvt[i] / 64, (double)size->cvt[i] / 64 ));
     }
diff --git a/src/java.desktop/share/native/libfreetype/src/truetype/ttobjs.h b/src/java.desktop/share/native/libfreetype/src/truetype/ttobjs.h
index 40eb37b4c43e..9c36ca783620 100644
--- a/src/java.desktop/share/native/libfreetype/src/truetype/ttobjs.h
+++ b/src/java.desktop/share/native/libfreetype/src/truetype/ttobjs.h
@@ -4,7 +4,7 @@
  *
  *   Objects manager (specification).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -105,7 +105,7 @@ FT_BEGIN_HEADER
   FT_LOCAL( FT_Error )
   tt_glyphzone_new( FT_Memory     memory,
                     FT_UShort     maxPoints,
-                    FT_Short      maxContours,
+                    FT_UShort     maxContours,
                     TT_GlyphZone  zone );
 
 #endif /* TT_USE_BYTECODE_INTERPRETER */
diff --git a/src/java.desktop/share/native/libfreetype/src/truetype/ttpload.c b/src/java.desktop/share/native/libfreetype/src/truetype/ttpload.c
index 54a64c7b462f..9505b5f179f2 100644
--- a/src/java.desktop/share/native/libfreetype/src/truetype/ttpload.c
+++ b/src/java.desktop/share/native/libfreetype/src/truetype/ttpload.c
@@ -4,7 +4,7 @@
  *
  *   TrueType-specific tables loader (body).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/truetype/ttpload.h b/src/java.desktop/share/native/libfreetype/src/truetype/ttpload.h
index ed229fa4616d..bc32b58020c3 100644
--- a/src/java.desktop/share/native/libfreetype/src/truetype/ttpload.h
+++ b/src/java.desktop/share/native/libfreetype/src/truetype/ttpload.h
@@ -4,7 +4,7 @@
  *
  *   TrueType-specific tables loader (specification).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/type1/t1afm.c b/src/java.desktop/share/native/libfreetype/src/type1/t1afm.c
index d9b9398b013a..a63cd4dc48af 100644
--- a/src/java.desktop/share/native/libfreetype/src/type1/t1afm.c
+++ b/src/java.desktop/share/native/libfreetype/src/type1/t1afm.c
@@ -4,7 +4,7 @@
  *
  *   AFM support for Type 1 fonts (body).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/type1/t1afm.h b/src/java.desktop/share/native/libfreetype/src/type1/t1afm.h
index e0d5aa5a8827..7f5cdda191f4 100644
--- a/src/java.desktop/share/native/libfreetype/src/type1/t1afm.h
+++ b/src/java.desktop/share/native/libfreetype/src/type1/t1afm.h
@@ -4,7 +4,7 @@
  *
  *   AFM support for Type 1 fonts (specification).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/type1/t1driver.c b/src/java.desktop/share/native/libfreetype/src/type1/t1driver.c
index a4cdf372a9e3..8ed01914a5a5 100644
--- a/src/java.desktop/share/native/libfreetype/src/type1/t1driver.c
+++ b/src/java.desktop/share/native/libfreetype/src/type1/t1driver.c
@@ -4,7 +4,7 @@
  *
  *   Type 1 driver interface (body).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -312,10 +312,7 @@
       {
         retval = ft_strlen( type1->glyph_names[idx] ) + 1;
         if ( value && value_len >= retval )
-        {
           ft_memcpy( value, (void *)( type1->glyph_names[idx] ), retval );
-          ((FT_Char *)value)[retval - 1] = (FT_Char)'\0';
-        }
       }
       break;
 
@@ -344,11 +341,8 @@
       {
         retval = ft_strlen( type1->encoding.char_name[idx] ) + 1;
         if ( value && value_len >= retval )
-        {
           ft_memcpy( value, (void *)( type1->encoding.char_name[idx] ),
-                     retval - 1 );
-          ((FT_Char *)value)[retval - 1] = (FT_Char)'\0';
-        }
+                     retval );
       }
       break;
 
diff --git a/src/java.desktop/share/native/libfreetype/src/type1/t1driver.h b/src/java.desktop/share/native/libfreetype/src/type1/t1driver.h
index ee7fcf43e01d..5ff52b55b1a8 100644
--- a/src/java.desktop/share/native/libfreetype/src/type1/t1driver.h
+++ b/src/java.desktop/share/native/libfreetype/src/type1/t1driver.h
@@ -4,7 +4,7 @@
  *
  *   High-level Type 1 driver interface (specification).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/type1/t1errors.h b/src/java.desktop/share/native/libfreetype/src/type1/t1errors.h
index 2fbd1e513f3e..8aeb24ae188b 100644
--- a/src/java.desktop/share/native/libfreetype/src/type1/t1errors.h
+++ b/src/java.desktop/share/native/libfreetype/src/type1/t1errors.h
@@ -4,7 +4,7 @@
  *
  *   Type 1 error codes (specification only).
  *
- * Copyright (C) 2001-2023 by
+ * Copyright (C) 2001-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/type1/t1gload.c b/src/java.desktop/share/native/libfreetype/src/type1/t1gload.c
index a32a4649d6d5..c29e682510c2 100644
--- a/src/java.desktop/share/native/libfreetype/src/type1/t1gload.c
+++ b/src/java.desktop/share/native/libfreetype/src/type1/t1gload.c
@@ -4,7 +4,7 @@
  *
  *   Type 1 Glyph Loader (body).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/type1/t1gload.h b/src/java.desktop/share/native/libfreetype/src/type1/t1gload.h
index c06484758a59..17a6a5941e32 100644
--- a/src/java.desktop/share/native/libfreetype/src/type1/t1gload.h
+++ b/src/java.desktop/share/native/libfreetype/src/type1/t1gload.h
@@ -4,7 +4,7 @@
  *
  *   Type 1 Glyph Loader (specification).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/type1/t1load.c b/src/java.desktop/share/native/libfreetype/src/type1/t1load.c
index be7cd0fd5e97..ee7fb42a517a 100644
--- a/src/java.desktop/share/native/libfreetype/src/type1/t1load.c
+++ b/src/java.desktop/share/native/libfreetype/src/type1/t1load.c
@@ -4,7 +4,7 @@
  *
  *   Type 1 font loader (body).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
@@ -751,6 +751,7 @@
         PS_DesignMap  dmap = blend->design_map + n;
 
 
+        FT_FREE( dmap->blend_points );
         FT_FREE( dmap->design_points );
         dmap->num_points = 0;
       }
@@ -1043,9 +1044,9 @@
       }
 
       /* allocate design map data */
-      if ( FT_QNEW_ARRAY( map->design_points, num_points * 2 ) )
+      if ( FT_QNEW_ARRAY( map->design_points, num_points ) ||
+           FT_QNEW_ARRAY( map->blend_points,  num_points ) )
         goto Exit;
-      map->blend_points = map->design_points + num_points;
       map->num_points   = (FT_Byte)num_points;
 
       for ( p = 0; p < num_points; p++ )
@@ -1876,9 +1877,8 @@
         }
 
         /* t1_decrypt() shouldn't write to base -- make temporary copy */
-        if ( FT_QALLOC( temp, size ) )
+        if ( FT_DUP( temp, base, size ) )
           goto Fail;
-        FT_MEM_COPY( temp, base, size );
         psaux->t1_decrypt( temp, size, 4330 );
         size -= (FT_ULong)t1face->type1.private_dict.lenIV;
         error = T1_Add_Table( table,
@@ -2090,9 +2090,8 @@
           }
 
           /* t1_decrypt() shouldn't write to base -- make temporary copy */
-          if ( FT_QALLOC( temp, size ) )
+          if ( FT_DUP( temp, base, size ) )
             goto Fail;
-          FT_MEM_COPY( temp, base, size );
           psaux->t1_decrypt( temp, size, 4330 );
           size -= (FT_ULong)t1face->type1.private_dict.lenIV;
           error = T1_Add_Table( code_table,
@@ -2284,7 +2283,7 @@
                        T1_FIELD_DICT_PRIVATE )
 #endif
 
-    { 0, T1_FIELD_LOCATION_CID_INFO, T1_FIELD_TYPE_NONE, 0, 0, 0, 0, 0, 0 }
+    T1_FIELD_ZERO
   };
 
 
@@ -2392,18 +2391,13 @@
           T1_Field  keyword = (T1_Field)t1_keywords;
 
 
-          for (;;)
+          while ( keyword->len )
           {
-            FT_Byte*  name;
+            FT_Byte*  name = (FT_Byte*)keyword->ident;
 
 
-            name = (FT_Byte*)keyword->ident;
-            if ( !name )
-              break;
-
-            if ( cur[0] == name[0]                      &&
-                 len == ft_strlen( (const char *)name ) &&
-                 ft_memcmp( cur, name, len ) == 0       )
+            if ( keyword->len == len              &&
+                 ft_memcmp( cur, name, len ) == 0 )
             {
               /* We found it -- run the parsing callback!     */
               /* We record every instance of every field      */
diff --git a/src/java.desktop/share/native/libfreetype/src/type1/t1load.h b/src/java.desktop/share/native/libfreetype/src/type1/t1load.h
index d8c9d2d8abe9..a45efa7cb7ba 100644
--- a/src/java.desktop/share/native/libfreetype/src/type1/t1load.h
+++ b/src/java.desktop/share/native/libfreetype/src/type1/t1load.h
@@ -4,7 +4,7 @@
  *
  *   Type 1 font loader (specification).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/type1/t1objs.c b/src/java.desktop/share/native/libfreetype/src/type1/t1objs.c
index 69e4fd5065e5..b1b27c31fe3b 100644
--- a/src/java.desktop/share/native/libfreetype/src/type1/t1objs.c
+++ b/src/java.desktop/share/native/libfreetype/src/type1/t1objs.c
@@ -4,7 +4,7 @@
  *
  *   Type 1 objects manager (body).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/type1/t1objs.h b/src/java.desktop/share/native/libfreetype/src/type1/t1objs.h
index 03847b27e96a..3809370c1e08 100644
--- a/src/java.desktop/share/native/libfreetype/src/type1/t1objs.h
+++ b/src/java.desktop/share/native/libfreetype/src/type1/t1objs.h
@@ -4,7 +4,7 @@
  *
  *   Type 1 objects manager (specification).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/type1/t1parse.c b/src/java.desktop/share/native/libfreetype/src/type1/t1parse.c
index 6dec6c16c3e7..3717ea7c5720 100644
--- a/src/java.desktop/share/native/libfreetype/src/type1/t1parse.c
+++ b/src/java.desktop/share/native/libfreetype/src/type1/t1parse.c
@@ -4,7 +4,7 @@
  *
  *   Type 1 parser (body).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/type1/t1parse.h b/src/java.desktop/share/native/libfreetype/src/type1/t1parse.h
index 0d9a2865df08..a0a2134d45c0 100644
--- a/src/java.desktop/share/native/libfreetype/src/type1/t1parse.h
+++ b/src/java.desktop/share/native/libfreetype/src/type1/t1parse.h
@@ -4,7 +4,7 @@
  *
  *   Type 1 parser (specification).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libfreetype/src/type1/t1tokens.h b/src/java.desktop/share/native/libfreetype/src/type1/t1tokens.h
index 40f360926220..5a3d2f1ef087 100644
--- a/src/java.desktop/share/native/libfreetype/src/type1/t1tokens.h
+++ b/src/java.desktop/share/native/libfreetype/src/type1/t1tokens.h
@@ -4,7 +4,7 @@
  *
  *   Type 1 tokenizer (specification).
  *
- * Copyright (C) 1996-2023 by
+ * Copyright (C) 1996-2024 by
  * David Turner, Robert Wilhelm, and Werner Lemberg.
  *
  * This file is part of the FreeType project, and may only be used,
diff --git a/src/java.desktop/share/native/libharfbuzz/OT/Color/CBDT/CBDT.hh b/src/java.desktop/share/native/libharfbuzz/OT/Color/CBDT/CBDT.hh
index d7b2b13e4d38..43a611a0058b 100644
--- a/src/java.desktop/share/native/libharfbuzz/OT/Color/CBDT/CBDT.hh
+++ b/src/java.desktop/share/native/libharfbuzz/OT/Color/CBDT/CBDT.hh
@@ -204,6 +204,7 @@ struct IndexSubtable
   {
     TRACE_SANITIZE (this);
     if (!u.header.sanitize (c)) return_trace (false);
+    hb_barrier ();
     switch (u.header.indexFormat)
     {
     case 1: return_trace (u.format1.sanitize (c, glyph_count));
@@ -378,6 +379,7 @@ struct IndexSubtableRecord
   {
     TRACE_SANITIZE (this);
     return_trace (c->check_struct (this) &&
+                  hb_barrier () &&
                   firstGlyphIndex <= lastGlyphIndex &&
                   offsetToSubtable.sanitize (c, base, lastGlyphIndex - firstGlyphIndex + 1));
   }
@@ -635,6 +637,7 @@ struct BitmapSizeTable
   {
     TRACE_SANITIZE (this);
     return_trace (c->check_struct (this) &&
+                  hb_barrier () &&
                   indexSubtableArrayOffset.sanitize (c, base, numberOfIndexSubtables) &&
                   horizontal.sanitize (c) &&
                   vertical.sanitize (c));
@@ -738,7 +741,9 @@ struct CBLC
   {
     TRACE_SANITIZE (this);
     return_trace (c->check_struct (this) &&
+                  hb_barrier () &&
                   likely (version.major == 2 || version.major == 3) &&
+                  hb_barrier () &&
                   sizeTables.sanitize (c, this));
   }
 
@@ -936,10 +941,12 @@ struct CBDT
       }
     }
 
-    bool has_data () const { return cbdt.get_length (); }
+    bool has_data () const { return cbdt->version.major; }
 
     bool paint_glyph (hb_font_t *font, hb_codepoint_t glyph, hb_paint_funcs_t *funcs, void *data) const
     {
+      if (!has_data ()) return false;
+
       hb_glyph_extents_t extents;
       hb_glyph_extents_t pixel_extents;
       hb_blob_t *blob = reference_png (font, glyph);
@@ -975,6 +982,7 @@ struct CBDT
   {
     TRACE_SANITIZE (this);
     return_trace (c->check_struct (this) &&
+                  hb_barrier () &&
                   likely (version.major == 2 || version.major == 3));
   }
 
diff --git a/src/java.desktop/share/native/libharfbuzz/OT/Color/COLR/COLR.hh b/src/java.desktop/share/native/libharfbuzz/OT/Color/COLR/COLR.hh
index fb2c42a88f08..4d6272d05cb5 100644
--- a/src/java.desktop/share/native/libharfbuzz/OT/Color/COLR/COLR.hh
+++ b/src/java.desktop/share/native/libharfbuzz/OT/Color/COLR/COLR.hh
@@ -29,11 +29,14 @@
 #define OT_COLOR_COLR_COLR_HH
 
 #include "../../../hb.hh"
+#include "../../../hb-decycler.hh"
 #include "../../../hb-open-type.hh"
 #include "../../../hb-ot-var-common.hh"
 #include "../../../hb-paint.hh"
 #include "../../../hb-paint-extents.hh"
 
+#include "../CPAL/CPAL.hh"
+
 /*
  * COLR -- Color
  * https://docs.microsoft.com/en-us/typography/opentype/spec/colr
@@ -66,13 +69,13 @@ public:
   hb_paint_funcs_t *funcs;
   void *data;
   hb_font_t *font;
-  unsigned int palette_index;
+  hb_array_t palette;
   hb_color_t foreground;
-  VarStoreInstancer &instancer;
-  hb_map_t current_glyphs;
-  hb_map_t current_layers;
+  ItemVarStoreInstancer &instancer;
+  hb_decycler_t glyphs_decycler;
+  hb_decycler_t layers_decycler;
   int depth_left = HB_MAX_NESTING_LEVEL;
-  int edge_count = HB_COLRV1_MAX_EDGE_COUNT;
+  int edge_count = HB_MAX_GRAPH_EDGE_COUNT;
 
   hb_paint_context_t (const void *base_,
                       hb_paint_funcs_t *funcs_,
@@ -80,12 +83,16 @@ public:
                       hb_font_t *font_,
                       unsigned int palette_,
                       hb_color_t foreground_,
-                      VarStoreInstancer &instancer_) :
+                      ItemVarStoreInstancer &instancer_) :
     base (base_),
     funcs (funcs_),
     data (data_),
     font (font_),
-    palette_index (palette_),
+    palette (
+#ifndef HB_NO_COLOR
+             font->face->table.CPAL->get_palette_colors (palette_)
+#endif
+    ),
     foreground (foreground_),
     instancer (instancer_)
   { }
@@ -99,12 +106,7 @@ public:
     if (color_index != 0xffff)
     {
       if (!funcs->custom_palette_color (data, color_index, &color))
-      {
-        unsigned int clen = 1;
-        hb_face_t *face = hb_font_get_face (font);
-
-        hb_ot_color_palette_get_colors (face, palette_index, color_index, &clen, &color);
-      }
+        color = palette[color_index];
 
       *is_foreground = false;
     }
@@ -159,23 +161,35 @@ struct hb_colrv1_closure_context_t :
   void add_palette_index (unsigned palette_index)
   { palette_indices->add (palette_index); }
 
+  void add_var_idxes (unsigned first_var_idx, unsigned num_idxes)
+  {
+    if (!num_idxes || first_var_idx == VarIdx::NO_VARIATION) return;
+    variation_indices->add_range (first_var_idx, first_var_idx + num_idxes - 1);
+  }
+
   public:
   const void *base;
   hb_set_t visited_paint;
   hb_set_t *glyphs;
   hb_set_t *layer_indices;
   hb_set_t *palette_indices;
+  hb_set_t *variation_indices;
+  unsigned num_var_idxes;
   unsigned nesting_level_left;
 
   hb_colrv1_closure_context_t (const void *base_,
                                hb_set_t *glyphs_,
                                hb_set_t *layer_indices_,
                                hb_set_t *palette_indices_,
+                               hb_set_t *variation_indices_,
+                               unsigned num_var_idxes_ = 1,
                                unsigned nesting_level_left_ = HB_MAX_NESTING_LEVEL) :
                           base (base_),
                           glyphs (glyphs_),
                           layer_indices (layer_indices_),
                           palette_indices (palette_indices_),
+                          variation_indices (variation_indices_),
+                          num_var_idxes (num_var_idxes_),
                           nesting_level_left (nesting_level_left_)
   {}
 };
@@ -242,18 +256,33 @@ struct Variable
   }
 
   void closurev1 (hb_colrv1_closure_context_t* c) const
-  { value.closurev1 (c); }
+  {
+    c->num_var_idxes = 0;
+    // update c->num_var_idxes during value closure
+    value.closurev1 (c);
+    c->add_var_idxes (varIdxBase, c->num_var_idxes);
+  }
 
   bool subset (hb_subset_context_t *c,
-               const VarStoreInstancer &instancer) const
+               const ItemVarStoreInstancer &instancer) const
   {
     TRACE_SUBSET (this);
     if (!value.subset (c, instancer, varIdxBase)) return_trace (false);
     if (c->plan->all_axes_pinned)
       return_trace (true);
 
-    //TODO: update varIdxBase for partial-instancing
-    return_trace (c->serializer->embed (varIdxBase));
+    VarIdx new_varidx;
+    new_varidx = varIdxBase;
+    if (varIdxBase != VarIdx::NO_VARIATION)
+    {
+      hb_pair_t *new_varidx_delta;
+      if (!c->plan->colrv1_variation_idx_delta_map.has (varIdxBase, &new_varidx_delta))
+        return_trace (false);
+
+      new_varidx = hb_first (*new_varidx_delta);
+    }
+
+    return_trace (c->serializer->embed (new_varidx));
   }
 
   bool sanitize (hb_sanitize_context_t *c) const
@@ -270,7 +299,7 @@ struct Variable
 
   void get_color_stop (hb_paint_context_t *c,
                        hb_color_stop_t *stop,
-                       const VarStoreInstancer &instancer) const
+                       const ItemVarStoreInstancer &instancer) const
   {
     value.get_color_stop (c, stop, varIdxBase, instancer);
   }
@@ -305,7 +334,7 @@ struct NoVariable
   { value.closurev1 (c); }
 
   bool subset (hb_subset_context_t *c,
-               const VarStoreInstancer &instancer) const
+               const ItemVarStoreInstancer &instancer) const
   {
     TRACE_SUBSET (this);
     return_trace (value.subset (c, instancer, varIdxBase));
@@ -325,7 +354,7 @@ struct NoVariable
 
   void get_color_stop (hb_paint_context_t *c,
                        hb_color_stop_t *stop,
-                       const VarStoreInstancer &instancer) const
+                       const ItemVarStoreInstancer &instancer) const
   {
     value.get_color_stop (c, stop, VarIdx::NO_VARIATION, instancer);
   }
@@ -345,10 +374,13 @@ struct NoVariable
 struct ColorStop
 {
   void closurev1 (hb_colrv1_closure_context_t* c) const
-  { c->add_palette_index (paletteIndex); }
+  {
+    c->add_palette_index (paletteIndex);
+    c->num_var_idxes = 2;
+  }
 
   bool subset (hb_subset_context_t *c,
-               const VarStoreInstancer &instancer,
+               const ItemVarStoreInstancer &instancer,
                uint32_t varIdxBase) const
   {
     TRACE_SUBSET (this);
@@ -374,7 +406,7 @@ struct ColorStop
   void get_color_stop (hb_paint_context_t *c,
                        hb_color_stop_t *out,
                        uint32_t varIdx,
-                       const VarStoreInstancer &instancer) const
+                       const ItemVarStoreInstancer &instancer) const
   {
     out->offset = stopOffset.to_float(instancer (varIdx, 0));
     out->color = c->get_color (paletteIndex,
@@ -410,7 +442,7 @@ struct ColorLine
   }
 
   bool subset (hb_subset_context_t *c,
-               const VarStoreInstancer &instancer) const
+               const ItemVarStoreInstancer &instancer) const
   {
     TRACE_SUBSET (this);
     auto *out = c->serializer->start_embed (this);
@@ -439,7 +471,7 @@ struct ColorLine
                    unsigned int start,
                    unsigned int *count,
                    hb_color_stop_t *color_stops,
-                   const VarStoreInstancer &instancer) const
+                   const ItemVarStoreInstancer &instancer) const
   {
     unsigned int len = stops.len;
 
@@ -542,8 +574,11 @@ struct Affine2x3
     return_trace (c->check_struct (this));
   }
 
+  void closurev1 (hb_colrv1_closure_context_t* c) const
+  { c->num_var_idxes = 6; }
+
   bool subset (hb_subset_context_t *c,
-               const VarStoreInstancer &instancer,
+               const ItemVarStoreInstancer &instancer,
                uint32_t varIdxBase) const
   {
     TRACE_SUBSET (this);
@@ -588,7 +623,7 @@ struct PaintColrLayers
   void closurev1 (hb_colrv1_closure_context_t* c) const;
 
   bool subset (hb_subset_context_t *c,
-               const VarStoreInstancer &instancer HB_UNUSED) const
+               const ItemVarStoreInstancer &instancer HB_UNUSED) const
   {
     TRACE_SUBSET (this);
     auto *out = c->serializer->embed (this);
@@ -617,10 +652,13 @@ struct PaintColrLayers
 struct PaintSolid
 {
   void closurev1 (hb_colrv1_closure_context_t* c) const
-  { c->add_palette_index (paletteIndex); }
+  {
+    c->add_palette_index (paletteIndex);
+    c->num_var_idxes = 1;
+  }
 
   bool subset (hb_subset_context_t *c,
-               const VarStoreInstancer &instancer,
+               const ItemVarStoreInstancer &instancer,
                uint32_t varIdxBase) const
   {
     TRACE_SUBSET (this);
@@ -666,10 +704,13 @@ template  class Var>
 struct PaintLinearGradient
 {
   void closurev1 (hb_colrv1_closure_context_t* c) const
-  { (this+colorLine).closurev1 (c); }
+  {
+    (this+colorLine).closurev1 (c);
+    c->num_var_idxes = 6;
+  }
 
   bool subset (hb_subset_context_t *c,
-               const VarStoreInstancer &instancer,
+               const ItemVarStoreInstancer &instancer,
                uint32_t varIdxBase) const
   {
     TRACE_SUBSET (this);
@@ -733,10 +774,13 @@ template  class Var>
 struct PaintRadialGradient
 {
   void closurev1 (hb_colrv1_closure_context_t* c) const
-  { (this+colorLine).closurev1 (c); }
+  {
+    (this+colorLine).closurev1 (c);
+    c->num_var_idxes = 6;
+  }
 
   bool subset (hb_subset_context_t *c,
-               const VarStoreInstancer &instancer,
+               const ItemVarStoreInstancer &instancer,
                uint32_t varIdxBase) const
   {
     TRACE_SUBSET (this);
@@ -800,10 +844,13 @@ template  class Var>
 struct PaintSweepGradient
 {
   void closurev1 (hb_colrv1_closure_context_t* c) const
-  { (this+colorLine).closurev1 (c); }
+  {
+    (this+colorLine).closurev1 (c);
+    c->num_var_idxes = 4;
+  }
 
   bool subset (hb_subset_context_t *c,
-               const VarStoreInstancer &instancer,
+               const ItemVarStoreInstancer &instancer,
                uint32_t varIdxBase) const
   {
     TRACE_SUBSET (this);
@@ -863,7 +910,7 @@ struct PaintGlyph
   void closurev1 (hb_colrv1_closure_context_t* c) const;
 
   bool subset (hb_subset_context_t *c,
-               const VarStoreInstancer &instancer) const
+               const ItemVarStoreInstancer &instancer) const
   {
     TRACE_SUBSET (this);
     auto *out = c->serializer->embed (this);
@@ -906,7 +953,7 @@ struct PaintColrGlyph
   void closurev1 (hb_colrv1_closure_context_t* c) const;
 
   bool subset (hb_subset_context_t *c,
-               const VarStoreInstancer &instancer HB_UNUSED) const
+               const ItemVarStoreInstancer &instancer HB_UNUSED) const
   {
     TRACE_SUBSET (this);
     auto *out = c->serializer->embed (this);
@@ -936,7 +983,7 @@ struct PaintTransform
   HB_INTERNAL void closurev1 (hb_colrv1_closure_context_t* c) const;
 
   bool subset (hb_subset_context_t *c,
-               const VarStoreInstancer &instancer) const
+               const ItemVarStoreInstancer &instancer) const
   {
     TRACE_SUBSET (this);
     auto *out = c->serializer->embed (this);
@@ -958,7 +1005,7 @@ struct PaintTransform
   void paint_glyph (hb_paint_context_t *c) const
   {
     TRACE_PAINT (this);
-    (this+transform).paint_glyph (c);
+    (this+transform).paint_glyph (c); // This does a push_transform()
     c->recurse (this+src);
     c->funcs->pop_transform (c->data);
   }
@@ -975,7 +1022,7 @@ struct PaintTranslate
   HB_INTERNAL void closurev1 (hb_colrv1_closure_context_t* c) const;
 
   bool subset (hb_subset_context_t *c,
-               const VarStoreInstancer &instancer,
+               const ItemVarStoreInstancer &instancer,
                uint32_t varIdxBase) const
   {
     TRACE_SUBSET (this);
@@ -1024,7 +1071,7 @@ struct PaintScale
   HB_INTERNAL void closurev1 (hb_colrv1_closure_context_t* c) const;
 
   bool subset (hb_subset_context_t *c,
-               const VarStoreInstancer &instancer,
+               const ItemVarStoreInstancer &instancer,
                uint32_t varIdxBase) const
   {
     TRACE_SUBSET (this);
@@ -1073,7 +1120,7 @@ struct PaintScaleAroundCenter
   HB_INTERNAL void closurev1 (hb_colrv1_closure_context_t* c) const;
 
   bool subset (hb_subset_context_t *c,
-               const VarStoreInstancer &instancer,
+               const ItemVarStoreInstancer &instancer,
                uint32_t varIdxBase) const
   {
     TRACE_SUBSET (this);
@@ -1132,7 +1179,7 @@ struct PaintScaleUniform
   HB_INTERNAL void closurev1 (hb_colrv1_closure_context_t* c) const;
 
   bool subset (hb_subset_context_t *c,
-               const VarStoreInstancer &instancer,
+               const ItemVarStoreInstancer &instancer,
                uint32_t varIdxBase) const
   {
     TRACE_SUBSET (this);
@@ -1176,7 +1223,7 @@ struct PaintScaleUniformAroundCenter
   HB_INTERNAL void closurev1 (hb_colrv1_closure_context_t* c) const;
 
   bool subset (hb_subset_context_t *c,
-               const VarStoreInstancer &instancer,
+               const ItemVarStoreInstancer &instancer,
                uint32_t varIdxBase) const
   {
     TRACE_SUBSET (this);
@@ -1232,7 +1279,7 @@ struct PaintRotate
   HB_INTERNAL void closurev1 (hb_colrv1_closure_context_t* c) const;
 
   bool subset (hb_subset_context_t *c,
-               const VarStoreInstancer &instancer,
+               const ItemVarStoreInstancer &instancer,
                uint32_t varIdxBase) const
   {
     TRACE_SUBSET (this);
@@ -1276,7 +1323,7 @@ struct PaintRotateAroundCenter
   HB_INTERNAL void closurev1 (hb_colrv1_closure_context_t* c) const;
 
   bool subset (hb_subset_context_t *c,
-               const VarStoreInstancer &instancer,
+               const ItemVarStoreInstancer &instancer,
                uint32_t varIdxBase) const
   {
     TRACE_SUBSET (this);
@@ -1332,7 +1379,7 @@ struct PaintSkew
   HB_INTERNAL void closurev1 (hb_colrv1_closure_context_t* c) const;
 
   bool subset (hb_subset_context_t *c,
-               const VarStoreInstancer &instancer,
+               const ItemVarStoreInstancer &instancer,
                uint32_t varIdxBase) const
   {
     TRACE_SUBSET (this);
@@ -1381,7 +1428,7 @@ struct PaintSkewAroundCenter
   HB_INTERNAL void closurev1 (hb_colrv1_closure_context_t* c) const;
 
   bool subset (hb_subset_context_t *c,
-               const VarStoreInstancer &instancer,
+               const ItemVarStoreInstancer &instancer,
                uint32_t varIdxBase) const
   {
     TRACE_SUBSET (this);
@@ -1440,7 +1487,7 @@ struct PaintComposite
   void closurev1 (hb_colrv1_closure_context_t* c) const;
 
   bool subset (hb_subset_context_t *c,
-               const VarStoreInstancer &instancer) const
+               const ItemVarStoreInstancer &instancer) const
   {
     TRACE_SUBSET (this);
     auto *out = c->serializer->embed (this);
@@ -1491,7 +1538,7 @@ struct ClipBoxFormat1
     return_trace (c->check_struct (this));
   }
 
-  void get_clip_box (ClipBoxData &clip_box, const VarStoreInstancer &instancer HB_UNUSED) const
+  void get_clip_box (ClipBoxData &clip_box, const ItemVarStoreInstancer &instancer HB_UNUSED) const
   {
     clip_box.xMin = xMin;
     clip_box.yMin = yMin;
@@ -1500,7 +1547,7 @@ struct ClipBoxFormat1
   }
 
   bool subset (hb_subset_context_t *c,
-               const VarStoreInstancer &instancer,
+               const ItemVarStoreInstancer &instancer,
                uint32_t varIdxBase) const
   {
     TRACE_SUBSET (this);
@@ -1533,7 +1580,7 @@ struct ClipBoxFormat1
 
 struct ClipBoxFormat2 : Variable
 {
-  void get_clip_box (ClipBoxData &clip_box, const VarStoreInstancer &instancer) const
+  void get_clip_box (ClipBoxData &clip_box, const ItemVarStoreInstancer &instancer) const
   {
     value.get_clip_box(clip_box, instancer);
     if (instancer)
@@ -1544,12 +1591,15 @@ struct ClipBoxFormat2 : Variable
       clip_box.yMax += roundf (instancer (varIdxBase, 3));
     }
   }
+
+  void closurev1 (hb_colrv1_closure_context_t* c) const
+  { c->variation_indices->add_range (varIdxBase, varIdxBase + 3); }
 };
 
 struct ClipBox
 {
   bool subset (hb_subset_context_t *c,
-               const VarStoreInstancer &instancer) const
+               const ItemVarStoreInstancer &instancer) const
   {
     TRACE_SUBSET (this);
     switch (u.format) {
@@ -1559,6 +1609,14 @@ struct ClipBox
     }
   }
 
+  void closurev1 (hb_colrv1_closure_context_t* c) const
+  {
+    switch (u.format) {
+    case 2: u.format2.closurev1 (c);
+    default:return;
+    }
+  }
+
   template 
   typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const
   {
@@ -1572,7 +1630,7 @@ struct ClipBox
   }
 
   bool get_extents (hb_glyph_extents_t *extents,
-                    const VarStoreInstancer &instancer) const
+                    const ItemVarStoreInstancer &instancer) const
   {
     ClipBoxData clip_box;
     switch (u.format) {
@@ -1606,9 +1664,15 @@ struct ClipRecord
   int cmp (hb_codepoint_t g) const
   { return g < startGlyphID ? -1 : g <= endGlyphID ? 0 : +1; }
 
+  void closurev1 (hb_colrv1_closure_context_t* c, const void *base) const
+  {
+    if (!c->glyphs->intersects (startGlyphID, endGlyphID)) return;
+    (base+clipBox).closurev1 (c);
+  }
+
   bool subset (hb_subset_context_t *c,
                const void *base,
-               const VarStoreInstancer &instancer) const
+               const ItemVarStoreInstancer &instancer) const
   {
     TRACE_SUBSET (this);
     auto *out = c->serializer->embed (*this);
@@ -1625,7 +1689,7 @@ struct ClipRecord
 
   bool get_extents (hb_glyph_extents_t *extents,
                     const void *base,
-                    const VarStoreInstancer &instancer) const
+                    const ItemVarStoreInstancer &instancer) const
   {
     return (base+clipBox).get_extents (extents, instancer);
   }
@@ -1642,7 +1706,7 @@ DECLARE_NULL_NAMESPACE_BYTES (OT, ClipRecord);
 struct ClipList
 {
   unsigned serialize_clip_records (hb_subset_context_t *c,
-                                   const VarStoreInstancer &instancer,
+                                   const ItemVarStoreInstancer &instancer,
                                    const hb_set_t& gids,
                                    const hb_map_t& gid_offset_map) const
   {
@@ -1695,7 +1759,7 @@ struct ClipList
   }
 
   bool subset (hb_subset_context_t *c,
-               const VarStoreInstancer &instancer) const
+               const ItemVarStoreInstancer &instancer) const
   {
     TRACE_SUBSET (this);
     auto *out = c->serializer->start_embed (*this);
@@ -1735,7 +1799,7 @@ struct ClipList
   bool
   get_extents (hb_codepoint_t gid,
                hb_glyph_extents_t *extents,
-               const VarStoreInstancer &instancer) const
+               const ItemVarStoreInstancer &instancer) const
   {
     auto *rec = clips.as_array ().bsearch (gid);
     if (rec)
@@ -1855,7 +1919,7 @@ struct BaseGlyphPaintRecord
 
   bool serialize (hb_serialize_context_t *s, const hb_map_t* glyph_map,
                   const void* src_base, hb_subset_context_t *c,
-                  const VarStoreInstancer &instancer) const
+                  const ItemVarStoreInstancer &instancer) const
   {
     TRACE_SERIALIZE (this);
     auto *out = s->embed (this);
@@ -1884,7 +1948,7 @@ struct BaseGlyphPaintRecord
 struct BaseGlyphList : SortedArray32Of
 {
   bool subset (hb_subset_context_t *c,
-               const VarStoreInstancer &instancer) const
+               const ItemVarStoreInstancer &instancer) const
   {
     TRACE_SUBSET (this);
     auto *out = c->serializer->start_embed (this);
@@ -1916,7 +1980,7 @@ struct LayerList : Array32OfOffset32To
   { return this+(*this)[i]; }
 
   bool subset (hb_subset_context_t *c,
-               const VarStoreInstancer &instancer) const
+               const ItemVarStoreInstancer &instancer) const
   {
     TRACE_SUBSET (this);
     auto *out = c->serializer->start_embed (this);
@@ -1941,6 +2005,76 @@ struct LayerList : Array32OfOffset32To
   }
 };
 
+struct delta_set_index_map_subset_plan_t
+{
+  unsigned get_inner_bit_count () const { return inner_bit_count; }
+  unsigned get_width ()           const { return ((outer_bit_count + inner_bit_count + 7) / 8); }
+  hb_array_t get_output_map () const { return output_map.as_array (); }
+
+  delta_set_index_map_subset_plan_t (const hb_map_t &new_deltaset_idx_varidx_map)
+  {
+    map_count = 0;
+    outer_bit_count = 0;
+    inner_bit_count = 1;
+    output_map.init ();
+
+    /* search backwards */
+    unsigned count = new_deltaset_idx_varidx_map.get_population ();
+    if (!count) return;
+
+    unsigned last_idx = (unsigned)-1;
+    unsigned last_varidx = (unsigned)-1;
+
+    for (unsigned i = count; i; i--)
+    {
+      unsigned delta_set_idx = i - 1;
+      unsigned var_idx = new_deltaset_idx_varidx_map.get (delta_set_idx);
+      if (i == count)
+      {
+        last_idx = delta_set_idx;
+        last_varidx = var_idx;
+        continue;
+      }
+      if (var_idx != last_varidx)
+        break;
+      last_idx = delta_set_idx;
+    }
+
+    map_count = last_idx + 1;
+  }
+
+  bool remap (const hb_map_t &new_deltaset_idx_varidx_map)
+  {
+    /* recalculate bit_count */
+    outer_bit_count = 1;
+    inner_bit_count = 1;
+
+    if (unlikely (!output_map.resize (map_count, false))) return false;
+
+    for (unsigned idx = 0; idx < map_count; idx++)
+    {
+      uint32_t *var_idx;
+      if (!new_deltaset_idx_varidx_map.has (idx, &var_idx)) return false;
+      output_map.arrayZ[idx] = *var_idx;
+
+      unsigned outer = (*var_idx) >> 16;
+      unsigned bit_count = (outer == 0) ? 1 : hb_bit_storage (outer);
+      outer_bit_count = hb_max (bit_count, outer_bit_count);
+
+      unsigned inner = (*var_idx) & 0xFFFF;
+      bit_count = (inner == 0) ? 1 : hb_bit_storage (inner);
+      inner_bit_count = hb_max (bit_count, inner_bit_count);
+    }
+    return true;
+  }
+
+  private:
+  unsigned map_count;
+  unsigned outer_bit_count;
+  unsigned inner_bit_count;
+  hb_vector_t output_map;
+};
+
 struct COLR
 {
   static constexpr hb_tag_t tableTag = HB_OT_TAG_COLR;
@@ -1948,10 +2082,11 @@ struct COLR
   bool has_v0_data () const { return numBaseGlyphs; }
   bool has_v1_data () const
   {
-    if (version == 1)
-      return (this+baseGlyphList).len > 0;
+    if (version < 1)
+      return false;
+    hb_barrier ();
 
-    return false;
+    return (this+baseGlyphList).len > 0;
   }
 
   unsigned int get_glyph_layers (hb_codepoint_t       glyph,
@@ -1991,8 +2126,26 @@ struct COLR
 
     void closure_forV1 (hb_set_t *glyphset,
                         hb_set_t *layer_indices,
-                        hb_set_t *palette_indices) const
-    { colr->closure_forV1 (glyphset, layer_indices, palette_indices); }
+                        hb_set_t *palette_indices,
+                        hb_set_t *variation_indices,
+                        hb_set_t *delta_set_indices) const
+    { colr->closure_forV1 (glyphset, layer_indices, palette_indices, variation_indices, delta_set_indices); }
+
+    bool has_var_store () const
+    { return colr->has_var_store (); }
+
+    const ItemVariationStore &get_var_store () const
+    { return colr->get_var_store (); }
+    const ItemVariationStore *get_var_store_ptr () const
+    { return colr->get_var_store_ptr (); }
+
+    bool has_delta_set_index_map () const
+    { return colr->has_delta_set_index_map (); }
+
+    const DeltaSetIndexMap &get_delta_set_index_map () const
+    { return colr->get_delta_set_index_map (); }
+    const DeltaSetIndexMap *get_delta_set_index_map_ptr () const
+    { return colr->get_delta_set_index_map_ptr (); }
 
     private:
     hb_blob_ptr_t colr;
@@ -2029,12 +2182,16 @@ struct COLR
 
   void closure_forV1 (hb_set_t *glyphset,
                       hb_set_t *layer_indices,
-                      hb_set_t *palette_indices) const
+                      hb_set_t *palette_indices,
+                      hb_set_t *variation_indices,
+                      hb_set_t *delta_set_indices) const
   {
-    if (version != 1) return;
+    if (version < 1) return;
+    hb_barrier ();
+
     hb_set_t visited_glyphs;
 
-    hb_colrv1_closure_context_t c (this, &visited_glyphs, layer_indices, palette_indices);
+    hb_colrv1_closure_context_t c (this, &visited_glyphs, layer_indices, palette_indices, variation_indices);
     const BaseGlyphList &baseglyph_paintrecords = this+baseGlyphList;
 
     for (const BaseGlyphPaintRecord &baseglyph_paintrecord: baseglyph_paintrecords.iter ())
@@ -2046,6 +2203,22 @@ struct COLR
       paint.dispatch (&c);
     }
     hb_set_union (glyphset, &visited_glyphs);
+
+    const ClipList &cliplist = this+clipList;
+    c.glyphs = glyphset;
+    for (const ClipRecord &clip_record : cliplist.clips.iter())
+      clip_record.closurev1 (&c, &cliplist);
+
+    // if a DeltaSetIndexMap is included, collected variation indices are
+    // actually delta set indices, we need to map them into variation indices
+    if (has_delta_set_index_map ())
+    {
+      const DeltaSetIndexMap &var_idx_map = this+varIdxMap;
+      delta_set_indices->set (*variation_indices);
+      variation_indices->clear ();
+      for (unsigned delta_set_idx : *delta_set_indices)
+        variation_indices->add (var_idx_map.map (delta_set_idx));
+    }
   }
 
   const LayerList& get_layerList () const
@@ -2054,14 +2227,37 @@ struct COLR
   const BaseGlyphList& get_baseglyphList () const
   { return (this+baseGlyphList); }
 
+  bool has_var_store () const
+  { return version >= 1 && hb_barrier () && varStore != 0; }
+
+  bool has_delta_set_index_map () const
+  { return version >= 1 && hb_barrier () && varIdxMap != 0; }
+
+  bool has_clip_list () const
+  { return version >= 1 && hb_barrier () && clipList != 0; }
+
+  const DeltaSetIndexMap &get_delta_set_index_map () const
+  { return has_delta_set_index_map () && hb_barrier () ? this+varIdxMap : Null (DeltaSetIndexMap); }
+  const DeltaSetIndexMap *get_delta_set_index_map_ptr () const
+  { return has_delta_set_index_map () && hb_barrier () ? &(this+varIdxMap) : nullptr; }
+
+  const ItemVariationStore &get_var_store () const
+  { return has_var_store () && hb_barrier () ? this+varStore : Null (ItemVariationStore); }
+  const ItemVariationStore *get_var_store_ptr () const
+  { return has_var_store () && hb_barrier () ? &(this+varStore) : nullptr; }
+
+  const ClipList &get_clip_list () const
+  { return has_clip_list () && hb_barrier () ? this+clipList : Null (ClipList); }
+
   bool sanitize (hb_sanitize_context_t *c) const
   {
     TRACE_SANITIZE (this);
     return_trace (c->check_struct (this) &&
+                  hb_barrier () &&
                   (this+baseGlyphsZ).sanitize (c, numBaseGlyphs) &&
                   (this+layersZ).sanitize (c, numLayers) &&
                   (version == 0 ||
-                   (version == 1 &&
+                   (hb_barrier () &&
                     baseGlyphList.sanitize (c, this) &&
                     layerList.sanitize (c, this) &&
                     clipList.sanitize (c, this) &&
@@ -2127,6 +2323,94 @@ struct COLR
     return record;
   }
 
+  bool downgrade_to_V0 (const hb_set_t &glyphset) const
+  {
+    //no more COLRv1 glyphs, downgrade to version 0
+    for (const BaseGlyphPaintRecord& _ : get_baseglyphList ())
+      if (glyphset.has (_.glyphId))
+        return false;
+
+    return true;
+  }
+
+  bool subset_varstore (hb_subset_context_t *c,
+                        COLR* out /* OUT */) const
+  {
+    TRACE_SUBSET (this);
+    if (!varStore || c->plan->all_axes_pinned ||
+        !c->plan->colrv1_variation_idx_delta_map)
+      return_trace (true);
+
+    const ItemVariationStore& var_store = this+varStore;
+    if (c->plan->normalized_coords)
+    {
+      item_variations_t item_vars;
+      /* turn off varstore optimization when varIdxMap is null, so we maintain
+       * original var_idx sequence */
+      bool optimize = (varIdxMap != 0) ? true : false;
+      if (!item_vars.instantiate (var_store, c->plan,
+                                  optimize, /* optimization */
+                                  optimize, /* use_no_variation_idx = false */
+                                  c->plan->colrv1_varstore_inner_maps.as_array ()))
+        return_trace (false);
+
+      /* do not serialize varStore if there's no variation data after
+       * instancing: region_list or var_data is empty */
+      if (item_vars.get_region_list () &&
+          item_vars.get_vardata_encodings () &&
+          !out->varStore.serialize_serialize (c->serializer,
+                                              item_vars.has_long_word (),
+                                              c->plan->axis_tags,
+                                              item_vars.get_region_list (),
+                                              item_vars.get_vardata_encodings ()))
+        return_trace (false);
+
+      /* if varstore is optimized, update colrv1_new_deltaset_idx_varidx_map in
+       * subset plan.
+       * If varstore is empty after instancing, varidx_map would be empty and
+       * all var_idxes will be updated to VarIdx::NO_VARIATION */
+      if (optimize)
+      {
+        const hb_map_t &varidx_map = item_vars.get_varidx_map ();
+        for (auto _ : c->plan->colrv1_new_deltaset_idx_varidx_map.iter_ref ())
+        {
+          uint32_t varidx = _.second;
+          uint32_t *new_varidx;
+          if (varidx_map.has (varidx, &new_varidx))
+            _.second = *new_varidx;
+          else
+            _.second = VarIdx::NO_VARIATION;
+        }
+      }
+    }
+    else
+    {
+      if (unlikely (!out->varStore.serialize_serialize (c->serializer,
+                                                        &var_store,
+                                                        c->plan->colrv1_varstore_inner_maps.as_array ())))
+        return_trace (false);
+    }
+
+    return_trace (true);
+  }
+
+  bool subset_delta_set_index_map (hb_subset_context_t *c,
+                                   COLR* out /* OUT */) const
+  {
+    TRACE_SUBSET (this);
+    if (!varIdxMap || c->plan->all_axes_pinned ||
+        !c->plan->colrv1_new_deltaset_idx_varidx_map)
+      return_trace (true);
+
+    const hb_map_t &deltaset_idx_varidx_map = c->plan->colrv1_new_deltaset_idx_varidx_map;
+    delta_set_index_map_subset_plan_t index_map_plan (deltaset_idx_varidx_map);
+
+    if (unlikely (!index_map_plan.remap (deltaset_idx_varidx_map)))
+      return_trace (false);
+
+    return_trace (out->varIdxMap.serialize_serialize (c->serializer, index_map_plan));
+  }
+
   bool subset (hb_subset_context_t *c) const
   {
     TRACE_SUBSET (this);
@@ -2195,34 +2479,30 @@ struct COLR
     auto *colr_prime = c->serializer->start_embed ();
     if (unlikely (!c->serializer->extend_min (colr_prime)))  return_trace (false);
 
-    if (version == 0)
-    return_trace (colr_prime->serialize_V0 (c->serializer, version, base_it, layer_it));
+    if (version == 0 || downgrade_to_V0 (glyphset))
+      return_trace (colr_prime->serialize_V0 (c->serializer, 0, base_it, layer_it));
+
+    hb_barrier ();
 
-    auto snap = c->serializer->snapshot ();
+    //start version 1
     if (!c->serializer->allocate_size (5 * HBUINT32::static_size)) return_trace (false);
+    if (!colr_prime->serialize_V0 (c->serializer, version, base_it, layer_it)) return_trace (false);
 
-    VarStoreInstancer instancer (varStore ? &(this+varStore) : nullptr,
-                                 varIdxMap ? &(this+varIdxMap) : nullptr,
-                                 c->plan->normalized_coords.as_array ());
+    /* subset ItemVariationStore first, cause varidx_map needs to be updated
+     * after instancing */
+    if (!subset_varstore (c, colr_prime)) return_trace (false);
 
-    if (!colr_prime->baseGlyphList.serialize_subset (c, baseGlyphList, this, instancer))
-    {
-      if (c->serializer->in_error ()) return_trace (false);
-      //no more COLRv1 glyphs: downgrade to version 0
-      c->serializer->revert (snap);
-      return_trace (colr_prime->serialize_V0 (c->serializer, 0, base_it, layer_it));
-    }
+    ItemVarStoreInstancer instancer (get_var_store_ptr (),
+                                     get_delta_set_index_map_ptr (),
+                                     c->plan->normalized_coords.as_array ());
 
-    if (!colr_prime->serialize_V0 (c->serializer, version, base_it, layer_it)) return_trace (false);
+    if (!colr_prime->baseGlyphList.serialize_subset (c, baseGlyphList, this, instancer))
+      return_trace (false);
 
     colr_prime->layerList.serialize_subset (c, layerList, this, instancer);
     colr_prime->clipList.serialize_subset (c, clipList, this, instancer);
-    if (!varStore || c->plan->all_axes_pinned)
-      return_trace (true);
 
-    colr_prime->varIdxMap.serialize_copy (c->serializer, varIdxMap, this);
-    colr_prime->varStore.serialize_copy (c->serializer, varStore, this);
-    return_trace (true);
+    return_trace (subset_delta_set_index_map (c, colr_prime));
   }
 
   const Paint *get_base_glyph_paint (hb_codepoint_t glyph) const
@@ -2242,12 +2522,10 @@ struct COLR
   bool
   get_extents (hb_font_t *font, hb_codepoint_t glyph, hb_glyph_extents_t *extents) const
   {
-    if (version != 1)
-      return false;
 
-    VarStoreInstancer instancer (&(this+varStore),
-                                 &(this+varIdxMap),
-                                 hb_array (font->coords, font->num_coords));
+    ItemVarStoreInstancer instancer (get_var_store_ptr (),
+                                     get_delta_set_index_map_ptr (),
+                                     hb_array (font->coords, font->num_coords));
 
     if (get_clip (glyph, extents, instancer))
     {
@@ -2282,8 +2560,10 @@ struct COLR
   bool
   has_paint_for_glyph (hb_codepoint_t glyph) const
   {
-    if (version == 1)
+    if (version >= 1)
     {
+      hb_barrier ();
+
       const Paint *paint = get_base_glyph_paint (glyph);
 
       return paint != nullptr;
@@ -2294,9 +2574,9 @@ struct COLR
 
   bool get_clip (hb_codepoint_t glyph,
                  hb_glyph_extents_t *extents,
-                 const VarStoreInstancer instancer) const
+                 const ItemVarStoreInstancer instancer) const
   {
-    return (this+clipList).get_extents (glyph,
+    return get_clip_list ().get_extents (glyph,
                                         extents,
                                         instancer);
   }
@@ -2305,23 +2585,23 @@ struct COLR
   bool
   paint_glyph (hb_font_t *font, hb_codepoint_t glyph, hb_paint_funcs_t *funcs, void *data, unsigned int palette_index, hb_color_t foreground, bool clip = true) const
   {
-    VarStoreInstancer instancer (&(this+varStore),
-                                 &(this+varIdxMap),
-                                 hb_array (font->coords, font->num_coords));
+    ItemVarStoreInstancer instancer (get_var_store_ptr (),
+                                     get_delta_set_index_map_ptr (),
+                                     hb_array (font->coords, font->num_coords));
     hb_paint_context_t c (this, funcs, data, font, palette_index, foreground, instancer);
-    c.current_glyphs.add (glyph);
 
-    if (version == 1)
+    hb_decycler_node_t node (c.glyphs_decycler);
+    node.visit (glyph);
+
+    if (version >= 1)
     {
+      hb_barrier ();
+
       const Paint *paint = get_base_glyph_paint (glyph);
       if (paint)
       {
         // COLRv1 glyph
 
-        VarStoreInstancer instancer (&(this+varStore),
-                                     &(this+varIdxMap),
-                                     hb_array (font->coords, font->num_coords));
-
         bool is_bounded = true;
         if (clip)
         {
@@ -2404,7 +2684,7 @@ struct COLR
   Offset32To                 layerList;
   Offset32To                  clipList;   // Offset to ClipList table (may be NULL)
   Offset32To          varIdxMap;  // Offset to DeltaSetIndexMap table (may be NULL)
-  Offset32To            varStore;
+  Offset32To        varStore;
   public:
   DEFINE_SIZE_MIN (14);
 };
@@ -2427,19 +2707,16 @@ void PaintColrLayers::paint_glyph (hb_paint_context_t *c) const
 {
   TRACE_PAINT (this);
   const LayerList &paint_offset_lists = c->get_colr_table ()->get_layerList ();
+  hb_decycler_node_t node (c->layers_decycler);
   for (unsigned i = firstLayerIndex; i < firstLayerIndex + numLayers; i++)
   {
-    if (unlikely (c->current_layers.has (i)))
-      continue;
-
-    c->current_layers.add (i);
+    if (unlikely (!node.visit (i)))
+      return;
 
     const Paint &paint = paint_offset_lists.get_paint (i);
     c->funcs->push_group (c->data);
     c->recurse (paint);
     c->funcs->pop_group (c->data, HB_PAINT_COMPOSITE_MODE_SRC_OVER);
-
-    c->current_layers.del (i);
   }
 }
 
@@ -2447,16 +2724,14 @@ void PaintColrGlyph::paint_glyph (hb_paint_context_t *c) const
 {
   TRACE_PAINT (this);
 
-  if (unlikely (c->current_glyphs.has (gid)))
+  hb_decycler_node_t node (c->glyphs_decycler);
+  if (unlikely (!node.visit (gid)))
     return;
 
-  c->current_glyphs.add (gid);
-
   c->funcs->push_inverse_root_transform (c->data, c->font);
   if (c->funcs->color_glyph (c->data, gid, c->font))
   {
     c->funcs->pop_transform (c->data);
-    c->current_glyphs.del (gid);
     return;
   }
   c->funcs->pop_transform (c->data);
@@ -2479,8 +2754,6 @@ void PaintColrGlyph::paint_glyph (hb_paint_context_t *c) const
 
   if (has_clip_box)
     c->funcs->pop_clip (c->data);
-
-  c->current_glyphs.del (gid);
 }
 
 } /* namespace OT */
diff --git a/src/java.desktop/share/native/libharfbuzz/OT/Color/COLR/colrv1-closure.hh b/src/java.desktop/share/native/libharfbuzz/OT/Color/COLR/colrv1-closure.hh
index 705863d4ade5..9ed0aa5632ae 100644
--- a/src/java.desktop/share/native/libharfbuzz/OT/Color/COLR/colrv1-closure.hh
+++ b/src/java.desktop/share/native/libharfbuzz/OT/Color/COLR/colrv1-closure.hh
@@ -66,34 +66,64 @@ HB_INTERNAL void PaintColrGlyph::closurev1 (hb_colrv1_closure_context_t* c) cons
 
 template  class Var>
 HB_INTERNAL void PaintTransform::closurev1 (hb_colrv1_closure_context_t* c) const
-{ (this+src).dispatch (c); }
+{
+  (this+src).dispatch (c);
+  (this+transform).closurev1 (c);
+}
 
 HB_INTERNAL void PaintTranslate::closurev1 (hb_colrv1_closure_context_t* c) const
-{ (this+src).dispatch (c); }
+{
+  (this+src).dispatch (c);
+  c->num_var_idxes = 2;
+}
 
 HB_INTERNAL void PaintScale::closurev1 (hb_colrv1_closure_context_t* c) const
-{ (this+src).dispatch (c); }
+{
+  (this+src).dispatch (c);
+  c->num_var_idxes = 2;
+}
 
 HB_INTERNAL void PaintScaleAroundCenter::closurev1 (hb_colrv1_closure_context_t* c) const
-{ (this+src).dispatch (c); }
+{
+  (this+src).dispatch (c);
+  c->num_var_idxes = 4;
+}
 
 HB_INTERNAL void PaintScaleUniform::closurev1 (hb_colrv1_closure_context_t* c) const
-{ (this+src).dispatch (c); }
+{
+  (this+src).dispatch (c);
+  c->num_var_idxes = 1;
+}
 
 HB_INTERNAL void PaintScaleUniformAroundCenter::closurev1 (hb_colrv1_closure_context_t* c) const
-{ (this+src).dispatch (c); }
+{
+  (this+src).dispatch (c);
+  c->num_var_idxes = 3;
+}
 
 HB_INTERNAL void PaintRotate::closurev1 (hb_colrv1_closure_context_t* c) const
-{ (this+src).dispatch (c); }
+{
+  (this+src).dispatch (c);
+  c->num_var_idxes = 1;
+}
 
 HB_INTERNAL void PaintRotateAroundCenter::closurev1 (hb_colrv1_closure_context_t* c) const
-{ (this+src).dispatch (c); }
+{
+  (this+src).dispatch (c);
+  c->num_var_idxes = 3;
+}
 
 HB_INTERNAL void PaintSkew::closurev1 (hb_colrv1_closure_context_t* c) const
-{ (this+src).dispatch (c); }
+{
+  (this+src).dispatch (c);
+  c->num_var_idxes = 2;
+}
 
 HB_INTERNAL void PaintSkewAroundCenter::closurev1 (hb_colrv1_closure_context_t* c) const
-{ (this+src).dispatch (c); }
+{
+  (this+src).dispatch (c);
+  c->num_var_idxes = 4;
+}
 
 HB_INTERNAL void PaintComposite::closurev1 (hb_colrv1_closure_context_t* c) const
 {
diff --git a/src/java.desktop/share/native/libharfbuzz/OT/Color/CPAL/CPAL.hh b/src/java.desktop/share/native/libharfbuzz/OT/Color/CPAL/CPAL.hh
index ed8f5957e961..51fc1b52af40 100644
--- a/src/java.desktop/share/native/libharfbuzz/OT/Color/CPAL/CPAL.hh
+++ b/src/java.desktop/share/native/libharfbuzz/OT/Color/CPAL/CPAL.hh
@@ -187,6 +187,14 @@ struct CPAL
   hb_ot_name_id_t get_color_name_id (unsigned int color_index) const
   { return v1 ().get_color_name_id (this, color_index, numColors); }
 
+  hb_array_t get_palette_colors (unsigned int palette_index) const
+  {
+    if (unlikely (palette_index >= numPalettes))
+      return hb_array_t ();
+    unsigned int start_index = colorRecordIndicesZ[palette_index];
+    hb_array_t all_colors ((this+colorRecordsZ).arrayZ, numColorRecords);
+    return all_colors.sub_array (start_index, numColors);
+  }
   unsigned int get_palette_colors (unsigned int  palette_index,
                                    unsigned int  start_offset,
                                    unsigned int *color_count, /* IN/OUT.  May be NULL. */
@@ -214,13 +222,17 @@ struct CPAL
                          hb_set_t *nameids_to_retain /* OUT */) const
   {
     if (version == 1)
+    {
+      hb_barrier ();
       v1 ().collect_name_ids (this, numPalettes, numColors, color_index_map, nameids_to_retain);
+    }
   }
 
   private:
   const CPALV1Tail& v1 () const
   {
     if (version == 0) return Null (CPALV1Tail);
+    hb_barrier ();
     return StructAfter (*this);
   }
 
@@ -312,7 +324,10 @@ struct CPAL
       return_trace (false);
 
     if (version == 1)
+    {
+      hb_barrier ();
       return_trace (v1 ().serialize (c->serializer, numPalettes, numColors, this, color_index_map));
+    }
 
     return_trace (true);
   }
@@ -321,6 +336,7 @@ struct CPAL
   {
     TRACE_SANITIZE (this);
     return_trace (c->check_struct (this) &&
+                  hb_barrier () &&
                   (this+colorRecordsZ).sanitize (c, numColorRecords) &&
                   colorRecordIndicesZ.sanitize (c, numPalettes) &&
                   (version == 0 || v1 ().sanitize (c, this, numPalettes, numColors)));
diff --git a/src/java.desktop/share/native/libharfbuzz/OT/Color/sbix/sbix.hh b/src/java.desktop/share/native/libharfbuzz/OT/Color/sbix/sbix.hh
index 20b06ab13e37..e95d8c13a44b 100644
--- a/src/java.desktop/share/native/libharfbuzz/OT/Color/sbix/sbix.hh
+++ b/src/java.desktop/share/native/libharfbuzz/OT/Color/sbix/sbix.hh
@@ -368,6 +368,7 @@ struct sbix
   {
     TRACE_SANITIZE (this);
     return_trace (likely (c->check_struct (this) &&
+                          hb_barrier () &&
                           version >= 1 &&
                           strikes.sanitize (c, this)));
   }
diff --git a/src/java.desktop/share/native/libharfbuzz/OT/Color/svg/svg.hh b/src/java.desktop/share/native/libharfbuzz/OT/Color/svg/svg.hh
index c8ff6ab743e8..9f676f9689ef 100644
--- a/src/java.desktop/share/native/libharfbuzz/OT/Color/svg/svg.hh
+++ b/src/java.desktop/share/native/libharfbuzz/OT/Color/svg/svg.hh
@@ -56,6 +56,7 @@ struct SVGDocumentIndexEntry
   {
     TRACE_SANITIZE (this);
     return_trace (c->check_struct (this) &&
+                  hb_barrier () &&
                   svgDoc.sanitize (c, base, svgDocLength));
   }
 
diff --git a/src/java.desktop/share/native/libharfbuzz/OT/Layout/Common/Coverage.hh b/src/java.desktop/share/native/libharfbuzz/OT/Layout/Common/Coverage.hh
index 257b2a3361ac..35d73c7b8582 100644
--- a/src/java.desktop/share/native/libharfbuzz/OT/Layout/Common/Coverage.hh
+++ b/src/java.desktop/share/native/libharfbuzz/OT/Layout/Common/Coverage.hh
@@ -64,6 +64,7 @@ struct Coverage
   {
     TRACE_SANITIZE (this);
     if (!u.format.sanitize (c)) return_trace (false);
+    hb_barrier ();
     switch (u.format)
     {
     case 1: return_trace (u.format1.sanitize (c));
@@ -95,6 +96,15 @@ struct Coverage
     default:return NOT_COVERED;
     }
   }
+  unsigned int get_coverage (hb_codepoint_t glyph_id,
+                             hb_ot_lookup_cache_t *cache) const
+  {
+    unsigned coverage;
+    if (cache && cache->get (glyph_id, &coverage)) return coverage;
+    coverage = get_coverage (glyph_id);
+    if (cache) cache->set (glyph_id, coverage);
+    return coverage;
+  }
 
   unsigned get_population () const
   {
@@ -200,6 +210,19 @@ struct Coverage
     }
   }
 
+  unsigned cost () const
+  {
+    switch (u.format) {
+    case 1: hb_barrier (); return u.format1.cost ();
+    case 2: hb_barrier (); return u.format2.cost ();
+#ifndef HB_NO_BEYOND_64K
+    case 3: hb_barrier (); return u.format3.cost ();
+    case 4: hb_barrier (); return u.format4.cost ();
+#endif
+    default:return 0u;
+    }
+  }
+
   /* Might return false if array looks unsorted.
    * Used for faster rejection of corrupt data. */
   template 
diff --git a/src/java.desktop/share/native/libharfbuzz/OT/Layout/Common/CoverageFormat1.hh b/src/java.desktop/share/native/libharfbuzz/OT/Layout/Common/CoverageFormat1.hh
index 995f1ebdbda4..4a925763bd70 100644
--- a/src/java.desktop/share/native/libharfbuzz/OT/Layout/Common/CoverageFormat1.hh
+++ b/src/java.desktop/share/native/libharfbuzz/OT/Layout/Common/CoverageFormat1.hh
@@ -103,6 +103,8 @@ struct CoverageFormat1_3
         intersect_glyphs << glyphArray[i];
   }
 
+  unsigned cost () const { return hb_bit_storage ((unsigned) glyphArray.len); /* bsearch cost */ }
+
   template 
   bool collect_coverage (set_t *glyphs) const
   { return glyphs->add_sorted_array (glyphArray.as_array ()); }
diff --git a/src/java.desktop/share/native/libharfbuzz/OT/Layout/Common/CoverageFormat2.hh b/src/java.desktop/share/native/libharfbuzz/OT/Layout/Common/CoverageFormat2.hh
index d47c7eea9925..247b7274b143 100644
--- a/src/java.desktop/share/native/libharfbuzz/OT/Layout/Common/CoverageFormat2.hh
+++ b/src/java.desktop/share/native/libharfbuzz/OT/Layout/Common/CoverageFormat2.hh
@@ -157,6 +157,8 @@ struct CoverageFormat2_4
     }
   }
 
+  unsigned cost () const { return hb_bit_storage ((unsigned) rangeRecord.len); /* bsearch cost */ }
+
   template 
   bool collect_coverage (set_t *glyphs) const
   {
diff --git a/src/java.desktop/share/native/libharfbuzz/OT/Layout/GDEF/GDEF.hh b/src/java.desktop/share/native/libharfbuzz/OT/Layout/GDEF/GDEF.hh
index 98543f56c3bc..542480d2dd0e 100644
--- a/src/java.desktop/share/native/libharfbuzz/OT/Layout/GDEF/GDEF.hh
+++ b/src/java.desktop/share/native/libharfbuzz/OT/Layout/GDEF/GDEF.hh
@@ -189,7 +189,7 @@ struct CaretValueFormat3
   friend struct CaretValue;
 
   hb_position_t get_caret_value (hb_font_t *font, hb_direction_t direction,
-                                 const VariationStore &var_store) const
+                                 const ItemVariationStore &var_store) const
   {
     return HB_DIRECTION_IS_HORIZONTAL (direction) ?
            font->em_scale_x (coordinate) + (this+deviceTable).get_x_delta (font, var_store) :
@@ -251,7 +251,7 @@ struct CaretValue
   hb_position_t get_caret_value (hb_font_t *font,
                                  hb_direction_t direction,
                                  hb_codepoint_t glyph_id,
-                                 const VariationStore &var_store) const
+                                 const ItemVariationStore &var_store) const
   {
     switch (u.format) {
     case 1: return u.format1.get_caret_value (font, direction);
@@ -291,6 +291,7 @@ struct CaretValue
   {
     TRACE_SANITIZE (this);
     if (!u.format.sanitize (c)) return_trace (false);
+    hb_barrier ();
     switch (u.format) {
     case 1: return_trace (u.format1.sanitize (c));
     case 2: return_trace (u.format2.sanitize (c));
@@ -315,7 +316,7 @@ struct LigGlyph
   unsigned get_lig_carets (hb_font_t            *font,
                            hb_direction_t        direction,
                            hb_codepoint_t        glyph_id,
-                           const VariationStore &var_store,
+                           const ItemVariationStore &var_store,
                            unsigned              start_offset,
                            unsigned             *caret_count /* IN/OUT */,
                            hb_position_t        *caret_array /* OUT */) const
@@ -371,7 +372,7 @@ struct LigCaretList
   unsigned int get_lig_carets (hb_font_t *font,
                                hb_direction_t direction,
                                hb_codepoint_t glyph_id,
-                               const VariationStore &var_store,
+                               const ItemVariationStore &var_store,
                                unsigned int start_offset,
                                unsigned int *caret_count /* IN/OUT */,
                                hb_position_t *caret_array /* OUT */) const
@@ -441,6 +442,20 @@ struct MarkGlyphSetsFormat1
   bool covers (unsigned int set_index, hb_codepoint_t glyph_id) const
   { return (this+coverage[set_index]).get_coverage (glyph_id) != NOT_COVERED; }
 
+  void collect_used_mark_sets (const hb_set_t& glyph_set,
+                               hb_set_t& used_mark_sets /* OUT */) const
+  {
+    unsigned i = 0;
+    for (const auto &offset : coverage)
+     {
+       const auto &cov = this+offset;
+       if (cov.intersects (&glyph_set))
+         used_mark_sets.add (i);
+
+       i++;
+     }
+  }
+
   template 
   void collect_coverage (hb_vector_t &sets) const
   {
@@ -461,6 +476,7 @@ struct MarkGlyphSetsFormat1
     bool ret = true;
     for (const Offset32To& offset : coverage.iter ())
     {
+      auto snap = c->serializer->snapshot ();
       auto *o = out->coverage.serialize_append (c->serializer);
       if (unlikely (!o))
       {
@@ -468,11 +484,17 @@ struct MarkGlyphSetsFormat1
         break;
       }
 
-      //not using o->serialize_subset (c, offset, this, out) here because
-      //OTS doesn't allow null offset.
-      //See issue: https://github.com/khaledhosny/ots/issues/172
+      //skip empty coverage
       c->serializer->push ();
-      c->dispatch (this+offset);
+      bool res = false;
+      if (offset) res = c->dispatch (this+offset);
+      if (!res)
+      {
+        c->serializer->pop_discard ();
+        c->serializer->revert (snap);
+        (out->coverage.len)--;
+        continue;
+      }
       c->serializer->add_link (*o, c->serializer->pop_pack ());
     }
 
@@ -513,6 +535,15 @@ struct MarkGlyphSets
     }
   }
 
+  void collect_used_mark_sets (const hb_set_t& glyph_set,
+                               hb_set_t& used_mark_sets /* OUT */) const
+  {
+    switch (u.format) {
+    case 1: u.format1.collect_used_mark_sets (glyph_set, used_mark_sets); return;
+    default:return;
+    }
+  }
+
   bool subset (hb_subset_context_t *c) const
   {
     TRACE_SUBSET (this);
@@ -526,6 +557,7 @@ struct MarkGlyphSets
   {
     TRACE_SANITIZE (this);
     if (!u.format.sanitize (c)) return_trace (false);
+    hb_barrier ();
     switch (u.format) {
     case 1: return_trace (u.format1.sanitize (c));
     default:return_trace (true);
@@ -577,7 +609,7 @@ struct GDEFVersion1_2
                                          * definitions--from beginning of GDEF
                                          * header (may be NULL).  Introduced
                                          * in version 0x00010002. */
-  Offset32To
+  Offset32To
                 varStore;               /* Offset to the table of Item Variation
                                          * Store--from beginning of GDEF
                                          * header (may be NULL).  Introduced
@@ -600,8 +632,9 @@ struct GDEFVersion1_2
                   attachList.sanitize (c, this) &&
                   ligCaretList.sanitize (c, this) &&
                   markAttachClassDef.sanitize (c, this) &&
-                  (version.to_int () < 0x00010002u || markGlyphSetsDef.sanitize (c, this)) &&
-                  (version.to_int () < 0x00010003u || varStore.sanitize (c, this)));
+                  hb_barrier () &&
+                  ((version.to_int () < 0x00010002u && hb_barrier ()) || markGlyphSetsDef.sanitize (c, this)) &&
+                  ((version.to_int () < 0x00010003u && hb_barrier ()) || varStore.sanitize (c, this)));
   }
 
   static void remap_varidx_after_instantiation (const hb_map_t& varidx_map,
@@ -627,23 +660,23 @@ struct GDEFVersion1_2
   bool subset (hb_subset_context_t *c) const
   {
     TRACE_SUBSET (this);
-    auto *out = c->serializer->embed (*this);
-    if (unlikely (!out)) return_trace (false);
-
-    bool subset_glyphclassdef = out->glyphClassDef.serialize_subset (c, glyphClassDef, this, nullptr, false, true);
-    bool subset_attachlist = out->attachList.serialize_subset (c, attachList, this);
-    bool subset_ligcaretlist = out->ligCaretList.serialize_subset (c, ligCaretList, this);
-    bool subset_markattachclassdef = out->markAttachClassDef.serialize_subset (c, markAttachClassDef, this, nullptr, false, true);
+    auto *out = c->serializer->start_embed (*this);
+    if (unlikely (!c->serializer->extend_min (out))) return_trace (false);
 
-    bool subset_markglyphsetsdef = false;
-    if (version.to_int () >= 0x00010002u)
-    {
-      subset_markglyphsetsdef = out->markGlyphSetsDef.serialize_subset (c, markGlyphSetsDef, this);
-    }
+    // Push var store first (if it's needed) so that it's last in the
+    // serialization order. Some font consumers assume that varstore runs to
+    // the end of the GDEF table.
+    // See: https://github.com/harfbuzz/harfbuzz/issues/4636
+    auto snapshot_version0 = c->serializer->snapshot ();
+    if (unlikely (version.to_int () >= 0x00010002u && hb_barrier () && !c->serializer->embed (markGlyphSetsDef)))
+      return_trace (false);
 
     bool subset_varstore = false;
-    if (version.to_int () >= 0x00010003u)
+    unsigned varstore_index = (unsigned) -1;
+    auto snapshot_version2 = c->serializer->snapshot ();
+    if (version.to_int () >= 0x00010003u && hb_barrier ())
     {
+      if (unlikely (!c->serializer->embed (varStore))) return_trace (false);
       if (c->plan->all_axes_pinned)
         out->varStore = 0;
       else if (c->plan->normalized_coords)
@@ -652,27 +685,56 @@ struct GDEFVersion1_2
         {
           item_variations_t item_vars;
           if (item_vars.instantiate (this+varStore, c->plan, true, true,
-                                     c->plan->gdef_varstore_inner_maps.as_array ()))
+                                     c->plan->gdef_varstore_inner_maps.as_array ())) {
             subset_varstore = out->varStore.serialize_serialize (c->serializer,
                                                                  item_vars.has_long_word (),
                                                                  c->plan->axis_tags,
                                                                  item_vars.get_region_list (),
                                                                  item_vars.get_vardata_encodings ());
+            varstore_index = c->serializer->last_added_child_index();
+          }
           remap_varidx_after_instantiation (item_vars.get_varidx_map (),
                                             c->plan->layout_variation_idx_delta_map);
         }
       }
       else
+      {
         subset_varstore = out->varStore.serialize_subset (c, varStore, this, c->plan->gdef_varstore_inner_maps.as_array ());
+        varstore_index = c->serializer->last_added_child_index();
+      }
+    }
+
+    out->version.major = version.major;
+    out->version.minor = version.minor;
+
+    if (!subset_varstore && version.to_int () >= 0x00010002u) {
+      c->serializer->revert (snapshot_version2);
+    }
+
+    bool subset_markglyphsetsdef = false;
+    if (version.to_int () >= 0x00010002u && hb_barrier ())
+    {
+      subset_markglyphsetsdef = out->markGlyphSetsDef.serialize_subset (c, markGlyphSetsDef, this);
     }
 
     if (subset_varstore)
     {
       out->version.minor = 3;
+      c->plan->has_gdef_varstore = true;
     } else if (subset_markglyphsetsdef) {
       out->version.minor = 2;
     } else  {
       out->version.minor = 0;
+      c->serializer->revert (snapshot_version0);
+    }
+
+    bool subset_glyphclassdef = out->glyphClassDef.serialize_subset (c, glyphClassDef, this, nullptr, false, true);
+    bool subset_attachlist = out->attachList.serialize_subset (c, attachList, this);
+    bool subset_markattachclassdef = out->markAttachClassDef.serialize_subset (c, markAttachClassDef, this, nullptr, false, true);
+    bool subset_ligcaretlist = out->ligCaretList.serialize_subset (c, ligCaretList, this);
+
+    if (subset_varstore && varstore_index != (unsigned) -1) {
+      c->serializer->repack_last(varstore_index);
     }
 
     return_trace (subset_glyphclassdef || subset_attachlist ||
@@ -709,6 +771,7 @@ struct GDEF
   {
     TRACE_SANITIZE (this);
     if (unlikely (!u.version.sanitize (c))) return_trace (false);
+    hb_barrier ();
     switch (u.version.major) {
     case 1: return_trace (u.version1.sanitize (c));
 #ifndef HB_NO_BEYOND_64K
@@ -812,7 +875,7 @@ struct GDEF
   bool has_mark_glyph_sets () const
   {
     switch (u.version.major) {
-    case 1: return u.version.to_int () >= 0x00010002u && u.version1.markGlyphSetsDef != 0;
+    case 1: return u.version.to_int () >= 0x00010002u && hb_barrier () && u.version1.markGlyphSetsDef != 0;
 #ifndef HB_NO_BEYOND_64K
     case 2: return u.version2.markGlyphSetsDef != 0;
 #endif
@@ -822,7 +885,7 @@ struct GDEF
   const MarkGlyphSets &get_mark_glyph_sets () const
   {
     switch (u.version.major) {
-    case 1: return u.version.to_int () >= 0x00010002u ? this+u.version1.markGlyphSetsDef : Null(MarkGlyphSets);
+    case 1: return u.version.to_int () >= 0x00010002u && hb_barrier () ? this+u.version1.markGlyphSetsDef : Null(MarkGlyphSets);
 #ifndef HB_NO_BEYOND_64K
     case 2: return this+u.version2.markGlyphSetsDef;
 #endif
@@ -832,21 +895,21 @@ struct GDEF
   bool has_var_store () const
   {
     switch (u.version.major) {
-    case 1: return u.version.to_int () >= 0x00010003u && u.version1.varStore != 0;
+    case 1: return u.version.to_int () >= 0x00010003u && hb_barrier () && u.version1.varStore != 0;
 #ifndef HB_NO_BEYOND_64K
     case 2: return u.version2.varStore != 0;
 #endif
     default: return false;
     }
   }
-  const VariationStore &get_var_store () const
+  const ItemVariationStore &get_var_store () const
   {
     switch (u.version.major) {
-    case 1: return u.version.to_int () >= 0x00010003u ? this+u.version1.varStore : Null(VariationStore);
+    case 1: return u.version.to_int () >= 0x00010003u && hb_barrier () ? this+u.version1.varStore : Null(ItemVariationStore);
 #ifndef HB_NO_BEYOND_64K
     case 2: return this+u.version2.varStore;
 #endif
-    default: return Null(VariationStore);
+    default: return Null(ItemVariationStore);
     }
   }
 
@@ -959,47 +1022,6 @@ struct GDEF
   void collect_variation_indices (hb_collect_variation_indices_context_t *c) const
   { get_lig_caret_list ().collect_variation_indices (c); }
 
-  void remap_layout_variation_indices (const hb_set_t *layout_variation_indices,
-                                       const hb_vector_t& normalized_coords,
-                                       bool calculate_delta, /* not pinned at default */
-                                       bool no_variations, /* all axes pinned */
-                                       hb_hashmap_t> *layout_variation_idx_delta_map /* OUT */) const
-  {
-    if (!has_var_store ()) return;
-    const VariationStore &var_store = get_var_store ();
-    float *store_cache = var_store.create_cache ();
-
-    unsigned new_major = 0, new_minor = 0;
-    unsigned last_major = (layout_variation_indices->get_min ()) >> 16;
-    for (unsigned idx : layout_variation_indices->iter ())
-    {
-      int delta = 0;
-      if (calculate_delta)
-        delta = roundf (var_store.get_delta (idx, normalized_coords.arrayZ,
-                                             normalized_coords.length, store_cache));
-
-      if (no_variations)
-      {
-        layout_variation_idx_delta_map->set (idx, hb_pair_t (HB_OT_LAYOUT_NO_VARIATIONS_INDEX, delta));
-        continue;
-      }
-
-      uint16_t major = idx >> 16;
-      if (major >= var_store.get_sub_table_count ()) break;
-      if (major != last_major)
-      {
-        new_minor = 0;
-        ++new_major;
-      }
-
-      unsigned new_idx = (new_major << 16) + new_minor;
-      layout_variation_idx_delta_map->set (idx, hb_pair_t (new_idx, delta));
-      ++new_minor;
-      last_major = major;
-    }
-    var_store.destroy_cache (store_cache);
-  }
-
   protected:
   union {
   FixedVersion<>                version;        /* Version identifier */
diff --git a/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/Anchor.hh b/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/Anchor.hh
index 49e76e77509e..7802e397f4cf 100644
--- a/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/Anchor.hh
+++ b/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/Anchor.hh
@@ -25,6 +25,7 @@ struct Anchor
   {
     TRACE_SANITIZE (this);
     if (!u.format.sanitize (c)) return_trace (false);
+    hb_barrier ();
     switch (u.format) {
     case 1: return_trace (u.format1.sanitize (c));
     case 2: return_trace (u.format2.sanitize (c));
diff --git a/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/AnchorFormat3.hh b/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/AnchorFormat3.hh
index 23821a49c77a..61bd90310a51 100644
--- a/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/AnchorFormat3.hh
+++ b/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/AnchorFormat3.hh
@@ -38,9 +38,15 @@ struct AnchorFormat3
     *y = font->em_fscale_y (yCoordinate);
 
     if ((font->x_ppem || font->num_coords) && xDeviceTable.sanitize (&c->sanitizer, this))
+    {
+      hb_barrier ();
       *x += (this+xDeviceTable).get_x_delta (font, c->var_store, c->var_store_cache);
+    }
     if ((font->y_ppem || font->num_coords) && yDeviceTable.sanitize (&c->sanitizer, this))
+    {
+      hb_barrier ();
       *y += (this+yDeviceTable).get_y_delta (font, c->var_store, c->var_store_cache);
+    }
   }
 
   bool subset (hb_subset_context_t *c) const
diff --git a/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/AnchorMatrix.hh b/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/AnchorMatrix.hh
index b61f1413ea5a..9da9fff50ba8 100644
--- a/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/AnchorMatrix.hh
+++ b/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/AnchorMatrix.hh
@@ -8,7 +8,7 @@ namespace GPOS_impl {
 struct AnchorMatrix
 {
   HBUINT16      rows;                   /* Number of rows */
-  UnsizedArrayOf>
+  UnsizedArrayOf>
                 matrixZ;                /* Matrix of offsets to Anchor tables--
                                          * from beginning of AnchorMatrix table */
   public:
@@ -18,6 +18,7 @@ struct AnchorMatrix
   {
     TRACE_SANITIZE (this);
     if (!c->check_struct (this)) return_trace (false);
+    hb_barrier ();
     if (unlikely (hb_unsigned_mul_overflows (rows, cols))) return_trace (false);
     unsigned int count = rows * cols;
     if (!c->check_array (matrixZ.arrayZ, count)) return_trace (false);
@@ -25,6 +26,7 @@ struct AnchorMatrix
     if (c->lazy_some_gpos)
       return_trace (true);
 
+    hb_barrier ();
     for (unsigned int i = 0; i < count; i++)
       if (!matrixZ[i].sanitize (c, this)) return_trace (false);
     return_trace (true);
@@ -38,6 +40,7 @@ struct AnchorMatrix
     if (unlikely (row >= rows || col >= cols)) return Null (Anchor);
     auto &offset = matrixZ[row * cols + col];
     if (unlikely (!offset.sanitize (&c->sanitizer, this))) return Null (Anchor);
+    hb_barrier ();
     *found = !offset.is_null ();
     return this+offset;
   }
@@ -65,15 +68,14 @@ struct AnchorMatrix
     if (unlikely (!c->serializer->extend_min (out)))  return_trace (false);
 
     out->rows = num_rows;
-    bool ret = false;
     for (const unsigned i : index_iter)
     {
       auto *offset = c->serializer->embed (matrixZ[i]);
       if (!offset) return_trace (false);
-      ret |= offset->serialize_subset (c, matrixZ[i], this);
+      offset->serialize_subset (c, matrixZ[i], this);
     }
 
-    return_trace (ret);
+    return_trace (true);
   }
 };
 
diff --git a/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/Common.hh b/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/Common.hh
index 408197454f1c..696d25d75c88 100644
--- a/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/Common.hh
+++ b/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/Common.hh
@@ -23,7 +23,7 @@ static void SinglePos_serialize (hb_serialize_context_t *c,
                                  const SrcLookup *src,
                                  Iterator it,
                                  const hb_hashmap_t> *layout_variation_idx_delta_map,
-                                 bool all_axes_pinned);
+                                 unsigned new_format);
 
 
 }
diff --git a/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/CursivePosFormat1.hh b/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/CursivePosFormat1.hh
index 3a2957af1a54..361aaed658a9 100644
--- a/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/CursivePosFormat1.hh
+++ b/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/CursivePosFormat1.hh
@@ -11,21 +11,21 @@ struct EntryExitRecord
 {
   friend struct CursivePosFormat1;
 
-  bool sanitize (hb_sanitize_context_t *c, const void *base) const
+  bool sanitize (hb_sanitize_context_t *c, const struct CursivePosFormat1 *base) const
   {
     TRACE_SANITIZE (this);
     return_trace (entryAnchor.sanitize (c, base) && exitAnchor.sanitize (c, base));
   }
 
   void collect_variation_indices (hb_collect_variation_indices_context_t *c,
-                                  const void *src_base) const
+                                  const struct CursivePosFormat1 *src_base) const
   {
     (src_base+entryAnchor).collect_variation_indices (c);
     (src_base+exitAnchor).collect_variation_indices (c);
   }
 
   bool subset (hb_subset_context_t *c,
-               const void *src_base) const
+               const struct CursivePosFormat1 *src_base) const
   {
     TRACE_SERIALIZE (this);
     auto *out = c->serializer->embed (this);
@@ -38,11 +38,11 @@ struct EntryExitRecord
   }
 
   protected:
-  Offset16To
+  Offset16To
                 entryAnchor;            /* Offset to EntryAnchor table--from
                                          * beginning of CursivePos
                                          * subtable--may be NULL */
-  Offset16To
+  Offset16To
                 exitAnchor;             /* Offset to ExitAnchor table--from
                                          * beginning of CursivePos
                                          * subtable--may be NULL */
@@ -128,6 +128,7 @@ struct CursivePosFormat1
     const EntryExitRecord &this_record = entryExitRecord[(this+coverage).get_coverage  (buffer->cur().codepoint)];
     if (!this_record.entryAnchor ||
         unlikely (!this_record.entryAnchor.sanitize (&c->sanitizer, this))) return_trace (false);
+    hb_barrier ();
 
     hb_ot_apply_context_t::skipping_iterator_t &skippy_iter = c->iter_input;
     skippy_iter.reset_fast (buffer->idx);
@@ -145,6 +146,7 @@ struct CursivePosFormat1
       buffer->unsafe_to_concat_from_outbuffer (skippy_iter.idx, buffer->idx + 1);
       return_trace (false);
     }
+    hb_barrier ();
 
     unsigned int i = skippy_iter.idx;
     unsigned int j = buffer->idx;
@@ -262,7 +264,7 @@ struct CursivePosFormat1
             hb_requires (hb_is_iterator (Iterator))>
   void serialize (hb_subset_context_t *c,
                   Iterator it,
-                  const void *src_base)
+                  const struct CursivePosFormat1 *src_base)
   {
     if (unlikely (!c->serializer->extend_min ((*this)))) return;
     this->format = 1;
diff --git a/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/MarkMarkPosFormat1.hh b/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/MarkMarkPosFormat1.hh
index ea196581aff8..6519e79b4439 100644
--- a/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/MarkMarkPosFormat1.hh
+++ b/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/MarkMarkPosFormat1.hh
@@ -42,6 +42,7 @@ struct MarkMarkPosFormat1_2
                   mark1Coverage.sanitize (c, this) &&
                   mark2Coverage.sanitize (c, this) &&
                   mark1Array.sanitize (c, this) &&
+                  hb_barrier () &&
                   mark2Array.sanitize (c, this, (unsigned int) classCount));
   }
 
diff --git a/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/PairPosFormat1.hh b/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/PairPosFormat1.hh
index 478c72df750b..597ff4c088a0 100644
--- a/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/PairPosFormat1.hh
+++ b/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/PairPosFormat1.hh
@@ -36,6 +36,7 @@ struct PairPosFormat1_3
     TRACE_SANITIZE (this);
 
     if (!c->check_struct (this)) return_trace (false);
+    hb_barrier ();
 
     unsigned int len1 = valueFormat[0].get_len ();
     unsigned int len2 = valueFormat[1].get_len ();
@@ -102,12 +103,50 @@ struct PairPosFormat1_3
 
   const Coverage &get_coverage () const { return this+coverage; }
 
-  bool apply (hb_ot_apply_context_t *c) const
+  unsigned cache_cost () const
+  {
+    return (this+coverage).cost ();
+  }
+  static void * cache_func (void *p, hb_ot_lookup_cache_op_t op)
+  {
+    switch (op)
+    {
+      case hb_ot_lookup_cache_op_t::CREATE:
+      {
+        hb_ot_lookup_cache_t *cache = (hb_ot_lookup_cache_t *) hb_malloc (sizeof (hb_ot_lookup_cache_t));
+        if (likely (cache))
+          cache->clear ();
+        return cache;
+      }
+      case hb_ot_lookup_cache_op_t::ENTER:
+        return (void *) true;
+      case hb_ot_lookup_cache_op_t::LEAVE:
+        return nullptr;
+      case hb_ot_lookup_cache_op_t::DESTROY:
+      {
+        hb_ot_lookup_cache_t *cache = (hb_ot_lookup_cache_t *) p;
+        hb_free (cache);
+        return nullptr;
+      }
+    }
+    return nullptr;
+  }
+
+  bool apply_cached (hb_ot_apply_context_t *c) const { return _apply (c, true); }
+  bool apply (hb_ot_apply_context_t *c) const { return _apply (c, false); }
+  bool _apply (hb_ot_apply_context_t *c, bool cached) const
   {
     TRACE_APPLY (this);
+
     hb_buffer_t *buffer = c->buffer;
+
+#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
+    hb_ot_lookup_cache_t *cache = cached ? (hb_ot_lookup_cache_t *) c->lookup_accel->cache : nullptr;
+    unsigned int index = (this+coverage).get_coverage  (buffer->cur().codepoint, cache);
+#else
     unsigned int index = (this+coverage).get_coverage  (buffer->cur().codepoint);
-    if (likely (index == NOT_COVERED)) return_trace (false);
+#endif
+    if (index == NOT_COVERED) return_trace (false);
 
     hb_ot_apply_context_t::skipping_iterator_t &skippy_iter = c->iter_input;
     skippy_iter.reset_fast (buffer->idx);
@@ -131,21 +170,34 @@ struct PairPosFormat1_3
     auto *out = c->serializer->start_embed (*this);
     if (unlikely (!c->serializer->extend_min (out))) return_trace (false);
     out->format = format;
-    out->valueFormat[0] = valueFormat[0];
-    out->valueFormat[1] = valueFormat[1];
-    if (c->plan->flags & HB_SUBSET_FLAGS_NO_HINTING)
+
+    hb_pair_t newFormats = hb_pair (valueFormat[0], valueFormat[1]);
+
+    if (c->plan->normalized_coords)
     {
-      hb_pair_t newFormats = compute_effective_value_formats (glyphset);
-      out->valueFormat[0] = newFormats.first;
-      out->valueFormat[1] = newFormats.second;
+      /* all device flags will be dropped when full instancing, no need to strip
+       * hints, also do not strip emtpy cause we don't compute the new default
+       * value during stripping */
+      newFormats = compute_effective_value_formats (glyphset, false, false, &c->plan->layout_variation_idx_delta_map);
     }
-
-    if (c->plan->all_axes_pinned)
+    /* do not strip hints for VF */
+    else if (c->plan->flags & HB_SUBSET_FLAGS_NO_HINTING)
     {
-      out->valueFormat[0] = out->valueFormat[0].drop_device_table_flags ();
-      out->valueFormat[1] = out->valueFormat[1].drop_device_table_flags ();
+      hb_blob_t* blob = hb_face_reference_table (c->plan->source, HB_TAG ('f','v','a','r'));
+      bool has_fvar = (blob != hb_blob_get_empty ());
+      hb_blob_destroy (blob);
+
+      bool strip = !has_fvar;
+      /* special case: strip hints when a VF has no GDEF varstore after
+       * subsetting*/
+      if (has_fvar && !c->plan->has_gdef_varstore)
+        strip = true;
+      newFormats = compute_effective_value_formats (glyphset, strip, true);
     }
 
+    out->valueFormat[0] = newFormats.first;
+    out->valueFormat[1] = newFormats.second;
+
     hb_sorted_vector_t new_coverage;
 
     + hb_zip (this+coverage, pairSet)
@@ -175,7 +227,9 @@ struct PairPosFormat1_3
   }
 
 
-  hb_pair_t compute_effective_value_formats (const hb_set_t& glyphset) const
+  hb_pair_t compute_effective_value_formats (const hb_set_t& glyphset,
+                                                                 bool strip_hints, bool strip_empty,
+                                                                 const hb_hashmap_t> *varidx_delta_map = nullptr) const
   {
     unsigned record_size = PairSet::get_size (valueFormat);
 
@@ -195,8 +249,8 @@ struct PairPosFormat1_3
       {
         if (record->intersects (glyphset))
         {
-          format1 = format1 | valueFormat[0].get_effective_format (record->get_values_1 ());
-          format2 = format2 | valueFormat[1].get_effective_format (record->get_values_2 (valueFormat[0]));
+          format1 = format1 | valueFormat[0].get_effective_format (record->get_values_1 (), strip_hints, strip_empty, &set, varidx_delta_map);
+          format2 = format2 | valueFormat[1].get_effective_format (record->get_values_2 (valueFormat[0]), strip_hints, strip_empty, &set, varidx_delta_map);
         }
         record = &StructAtOffset (record, record_size);
       }
diff --git a/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/PairPosFormat2.hh b/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/PairPosFormat2.hh
index ce6eec4f2069..d85b1ac2c177 100644
--- a/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/PairPosFormat2.hh
+++ b/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/PairPosFormat2.hh
@@ -8,7 +8,7 @@ namespace Layout {
 namespace GPOS_impl {
 
 template 
-struct PairPosFormat2_4
+struct PairPosFormat2_4 : ValueBase
 {
   protected:
   HBUINT16      format;                 /* Format identifier--format = 2 */
@@ -123,12 +123,61 @@ struct PairPosFormat2_4
 
   const Coverage &get_coverage () const { return this+coverage; }
 
-  bool apply (hb_ot_apply_context_t *c) const
+  struct pair_pos_cache_t
+  {
+    hb_ot_lookup_cache_t coverage;
+    hb_ot_lookup_cache_t first;
+    hb_ot_lookup_cache_t second;
+  };
+
+  unsigned cache_cost () const
+  {
+    return (this+coverage).cost () + (this+classDef1).cost () + (this+classDef2).cost ();
+  }
+  static void * cache_func (void *p, hb_ot_lookup_cache_op_t op)
+  {
+    switch (op)
+    {
+      case hb_ot_lookup_cache_op_t::CREATE:
+      {
+        pair_pos_cache_t *cache = (pair_pos_cache_t *) hb_malloc (sizeof (pair_pos_cache_t));
+        if (likely (cache))
+        {
+          cache->coverage.clear ();
+          cache->first.clear ();
+          cache->second.clear ();
+        }
+        return cache;
+      }
+      case hb_ot_lookup_cache_op_t::ENTER:
+        return (void *) true;
+      case hb_ot_lookup_cache_op_t::LEAVE:
+        return nullptr;
+      case hb_ot_lookup_cache_op_t::DESTROY:
+        {
+          pair_pos_cache_t *cache = (pair_pos_cache_t *) p;
+          hb_free (cache);
+          return nullptr;
+        }
+    }
+    return nullptr;
+  }
+
+  bool apply_cached (hb_ot_apply_context_t *c) const { return _apply (c, true); }
+  bool apply (hb_ot_apply_context_t *c) const { return _apply (c, false); }
+  bool _apply (hb_ot_apply_context_t *c, bool cached) const
   {
     TRACE_APPLY (this);
+
     hb_buffer_t *buffer = c->buffer;
+
+#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
+    pair_pos_cache_t *cache = cached ? (pair_pos_cache_t *) c->lookup_accel->cache : nullptr;
+    unsigned int index = (this+coverage).get_coverage  (buffer->cur().codepoint, cache ? &cache->coverage : nullptr);
+#else
     unsigned int index = (this+coverage).get_coverage  (buffer->cur().codepoint);
-    if (likely (index == NOT_COVERED)) return_trace (false);
+#endif
+    if (index == NOT_COVERED) return_trace (false);
 
     hb_ot_apply_context_t::skipping_iterator_t &skippy_iter = c->iter_input;
     skippy_iter.reset_fast (buffer->idx);
@@ -139,14 +188,13 @@ struct PairPosFormat2_4
       return_trace (false);
     }
 
-    unsigned int klass2 = (this+classDef2).get_class (buffer->info[skippy_iter.idx].codepoint);
-    if (!klass2)
-    {
-      buffer->unsafe_to_concat (buffer->idx, skippy_iter.idx + 1);
-      return_trace (false);
-    }
-
+#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
+    unsigned int klass1 = (this+classDef1).get_class (buffer->cur().codepoint, cache ? &cache->first : nullptr);
+    unsigned int klass2 = (this+classDef2).get_class (buffer->info[skippy_iter.idx].codepoint, cache ? &cache->second : nullptr);
+#else
     unsigned int klass1 = (this+classDef1).get_class (buffer->cur().codepoint);
+    unsigned int klass2 = (this+classDef2).get_class (buffer->info[skippy_iter.idx].codepoint);
+#endif
     if (unlikely (klass1 >= class1Count || klass2 >= class2Count))
     {
       buffer->unsafe_to_concat (buffer->idx, skippy_iter.idx + 1);
@@ -287,18 +335,31 @@ struct PairPosFormat2_4
     unsigned len2 = valueFormat2.get_len ();
 
     hb_pair_t newFormats = hb_pair (valueFormat1, valueFormat2);
-    if (c->plan->flags & HB_SUBSET_FLAGS_NO_HINTING)
-      newFormats = compute_effective_value_formats (klass1_map, klass2_map);
-
-    out->valueFormat1 = newFormats.first;
-    out->valueFormat2 = newFormats.second;
 
-    if (c->plan->all_axes_pinned)
+    if (c->plan->normalized_coords)
     {
-      out->valueFormat1 = out->valueFormat1.drop_device_table_flags ();
-      out->valueFormat2 = out->valueFormat2.drop_device_table_flags ();
+      /* in case of full instancing, all var device flags will be dropped so no
+       * need to strip hints here */
+      newFormats = compute_effective_value_formats (klass1_map, klass2_map, false, false, &c->plan->layout_variation_idx_delta_map);
+    }
+    /* do not strip hints for VF */
+    else if (c->plan->flags & HB_SUBSET_FLAGS_NO_HINTING)
+    {
+      hb_blob_t* blob = hb_face_reference_table (c->plan->source, HB_TAG ('f','v','a','r'));
+      bool has_fvar = (blob != hb_blob_get_empty ());
+      hb_blob_destroy (blob);
+
+      bool strip = !has_fvar;
+      /* special case: strip hints when a VF has no GDEF varstore after
+       * subsetting*/
+      if (has_fvar && !c->plan->has_gdef_varstore)
+        strip = true;
+      newFormats = compute_effective_value_formats (klass1_map, klass2_map, strip, true);
     }
 
+    out->valueFormat1 = newFormats.first;
+    out->valueFormat2 = newFormats.second;
+
     unsigned total_len = len1 + len2;
     hb_vector_t class2_idxs (+ hb_range ((unsigned) class2Count) | hb_filter (klass2_map));
     for (unsigned class1_idx : + hb_range ((unsigned) class1Count) | hb_filter (klass1_map))
@@ -311,22 +372,15 @@ struct PairPosFormat2_4
       }
     }
 
-    const hb_set_t &glyphset = *c->plan->glyphset_gsub ();
-    const hb_map_t &glyph_map = *c->plan->glyph_map;
-
-    auto it =
-    + hb_iter (this+coverage)
-    | hb_filter (glyphset)
-    | hb_map_retains_sorting (glyph_map)
-    ;
-
-    out->coverage.serialize_serialize (c->serializer, it);
-    return_trace (out->class1Count && out->class2Count && bool (it));
+    bool ret = out->coverage.serialize_subset(c, coverage, this);
+    return_trace (out->class1Count && out->class2Count && ret);
   }
 
 
   hb_pair_t compute_effective_value_formats (const hb_map_t& klass1_map,
-                                                                 const hb_map_t& klass2_map) const
+                                                                 const hb_map_t& klass2_map,
+                                                                 bool strip_hints, bool strip_empty,
+                                                                 const hb_hashmap_t> *varidx_delta_map = nullptr) const
   {
     unsigned len1 = valueFormat1.get_len ();
     unsigned len2 = valueFormat2.get_len ();
@@ -340,8 +394,8 @@ struct PairPosFormat2_4
       for (unsigned class2_idx : + hb_range ((unsigned) class2Count) | hb_filter (klass2_map))
       {
         unsigned idx = (class1_idx * (unsigned) class2Count + class2_idx) * record_size;
-        format1 = format1 | valueFormat1.get_effective_format (&values[idx]);
-        format2 = format2 | valueFormat2.get_effective_format (&values[idx + len1]);
+        format1 = format1 | valueFormat1.get_effective_format (&values[idx], strip_hints, strip_empty, this, varidx_delta_map);
+        format2 = format2 | valueFormat2.get_effective_format (&values[idx + len1], strip_hints, strip_empty, this, varidx_delta_map);
       }
 
       if (format1 == valueFormat1 && format2 == valueFormat2)
diff --git a/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/PairSet.hh b/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/PairSet.hh
index 7ccec1df841d..e610fcd75170 100644
--- a/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/PairSet.hh
+++ b/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/PairSet.hh
@@ -9,7 +9,7 @@ namespace GPOS_impl {
 
 
 template 
-struct PairSet
+struct PairSet : ValueBase
 {
   template 
   friend struct PairPosFormat1_3;
@@ -45,10 +45,12 @@ struct PairSet
   bool sanitize (hb_sanitize_context_t *c, const sanitize_closure_t *closure) const
   {
     TRACE_SANITIZE (this);
-    if (!(c->check_struct (this)
-       && c->check_range (&firstPairValueRecord,
+    if (!(c->check_struct (this) &&
+          hb_barrier () &&
+          c->check_range (&firstPairValueRecord,
                           len,
                           closure->stride))) return_trace (false);
+    hb_barrier ();
 
     unsigned int count = len;
     const PairValueRecord *record = &firstPairValueRecord;
diff --git a/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/PairValueRecord.hh b/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/PairValueRecord.hh
index b32abe46d21b..fe9595f1266c 100644
--- a/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/PairValueRecord.hh
+++ b/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/PairValueRecord.hh
@@ -29,7 +29,7 @@ struct PairValueRecord
 
   struct context_t
   {
-    const void          *base;
+    const ValueBase     *base;
     const ValueFormat   *valueFormats;
     const ValueFormat   *newFormats;
     unsigned            len1; /* valueFormats[0].get_len() */
@@ -62,7 +62,7 @@ struct PairValueRecord
 
   void collect_variation_indices (hb_collect_variation_indices_context_t *c,
                                   const ValueFormat *valueFormats,
-                                  const void *base) const
+                                  const ValueBase *base) const
   {
     unsigned record1_len = valueFormats[0].get_len ();
     unsigned record2_len = valueFormats[1].get_len ();
diff --git a/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/SinglePos.hh b/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/SinglePos.hh
index 3af6c4996594..a0243a218c58 100644
--- a/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/SinglePos.hh
+++ b/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/SinglePos.hh
@@ -39,14 +39,12 @@ struct SinglePos
                   const SrcLookup* src,
                   Iterator glyph_val_iter_pairs,
                   const hb_hashmap_t> *layout_variation_idx_delta_map,
-                  bool all_axes_pinned)
+                  unsigned newFormat)
   {
     if (unlikely (!c->extend_min (u.format))) return;
     unsigned format = 2;
-    ValueFormat new_format = src->get_value_format ();
-
-    if (all_axes_pinned)
-      new_format = new_format.drop_device_table_flags ();
+    ValueFormat new_format;
+    new_format = newFormat;
 
     if (glyph_val_iter_pairs)
       format = get_format (glyph_val_iter_pairs);
@@ -89,8 +87,8 @@ SinglePos_serialize (hb_serialize_context_t *c,
                      const SrcLookup *src,
                      Iterator it,
                      const hb_hashmap_t> *layout_variation_idx_delta_map,
-                     bool all_axes_pinned)
-{ c->start_embed ()->serialize (c, src, it, layout_variation_idx_delta_map, all_axes_pinned); }
+                     unsigned new_format)
+{ c->start_embed ()->serialize (c, src, it, layout_variation_idx_delta_map, new_format); }
 
 
 }
diff --git a/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/SinglePosFormat1.hh b/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/SinglePosFormat1.hh
index 8e21c5f8e713..1a14be020f93 100644
--- a/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/SinglePosFormat1.hh
+++ b/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/SinglePosFormat1.hh
@@ -8,7 +8,7 @@ namespace OT {
 namespace Layout {
 namespace GPOS_impl {
 
-struct SinglePosFormat1
+struct SinglePosFormat1 : ValueBase
 {
   protected:
   HBUINT16      format;                 /* Format identifier--format = 1 */
@@ -28,6 +28,7 @@ struct SinglePosFormat1
     TRACE_SANITIZE (this);
     return_trace (c->check_struct (this) &&
                   coverage.sanitize (c, this) &&
+                  hb_barrier () &&
                   /* The coverage  table may use a range to represent a set
                    * of glyphs, which means a small number of bytes can
                    * generate a large glyph set. Manually modify the
@@ -66,7 +67,7 @@ struct SinglePosFormat1
     TRACE_APPLY (this);
     hb_buffer_t *buffer = c->buffer;
     unsigned int index = (this+coverage).get_coverage  (buffer->cur().codepoint);
-    if (likely (index == NOT_COVERED)) return_trace (false);
+    if (index == NOT_COVERED) return_trace (false);
 
     if (HB_BUFFER_MESSAGE_MORE && c->buffer->messaging ())
     {
@@ -146,6 +147,30 @@ struct SinglePosFormat1
     hb_set_t intersection;
     (this+coverage).intersect_set (glyphset, intersection);
 
+    unsigned new_format = valueFormat;
+
+    if (c->plan->normalized_coords)
+    {
+      new_format = valueFormat.get_effective_format (values.arrayZ, false, false, this, &c->plan->layout_variation_idx_delta_map);
+    }
+    /* do not strip hints for VF */
+    else if (c->plan->flags & HB_SUBSET_FLAGS_NO_HINTING)
+    {
+      hb_blob_t* blob = hb_face_reference_table (c->plan->source, HB_TAG ('f','v','a','r'));
+      bool has_fvar = (blob != hb_blob_get_empty ());
+      hb_blob_destroy (blob);
+
+      bool strip = !has_fvar;
+      /* special case: strip hints when a VF has no GDEF varstore after
+       * subsetting*/
+      if (has_fvar && !c->plan->has_gdef_varstore)
+        strip = true;
+      new_format = valueFormat.get_effective_format (values.arrayZ,
+                                                     strip, /* strip hints */
+                                                     true, /* strip empty */
+                                                     this, nullptr);
+    }
+
     auto it =
     + hb_iter (intersection)
     | hb_map_retains_sorting (glyph_map)
@@ -153,7 +178,7 @@ struct SinglePosFormat1
     ;
 
     bool ret = bool (it);
-    SinglePos_serialize (c->serializer, this, it, &c->plan->layout_variation_idx_delta_map, c->plan->all_axes_pinned);
+    SinglePos_serialize (c->serializer, this, it, &c->plan->layout_variation_idx_delta_map, new_format);
     return_trace (ret);
   }
 };
diff --git a/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/SinglePosFormat2.hh b/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/SinglePosFormat2.hh
index ddc4c18ec1c4..455796b4b27e 100644
--- a/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/SinglePosFormat2.hh
+++ b/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/SinglePosFormat2.hh
@@ -7,7 +7,7 @@ namespace OT {
 namespace Layout {
 namespace GPOS_impl {
 
-struct SinglePosFormat2
+struct SinglePosFormat2 : ValueBase
 {
   protected:
   HBUINT16      format;                 /* Format identifier--format = 2 */
@@ -66,7 +66,7 @@ struct SinglePosFormat2
     TRACE_APPLY (this);
     hb_buffer_t *buffer = c->buffer;
     unsigned int index = (this+coverage).get_coverage  (buffer->cur().codepoint);
-    if (likely (index == NOT_COVERED)) return_trace (false);
+    if (index == NOT_COVERED) return_trace (false);
 
     if (unlikely (index >= valueCount)) return_trace (false);
 
@@ -143,6 +143,37 @@ struct SinglePosFormat2
     coverage.serialize_serialize (c, glyphs);
   }
 
+  template
+  unsigned compute_effective_format (const hb_face_t *face,
+                                     Iterator it,
+                                     bool is_instancing, bool strip_hints,
+                                     bool has_gdef_varstore,
+                                     const hb_hashmap_t> *varidx_delta_map) const
+  {
+    hb_blob_t* blob = hb_face_reference_table (face, HB_TAG ('f','v','a','r'));
+    bool has_fvar = (blob != hb_blob_get_empty ());
+    hb_blob_destroy (blob);
+
+    unsigned new_format = 0;
+    if (is_instancing)
+    {
+      new_format = new_format | valueFormat.get_effective_format (+ it | hb_map (hb_second), false, false, this, varidx_delta_map);
+    }
+    /* do not strip hints for VF */
+    else if (strip_hints)
+    {
+      bool strip = !has_fvar;
+      if (has_fvar && !has_gdef_varstore)
+        strip = true;
+      new_format = new_format | valueFormat.get_effective_format (+ it | hb_map (hb_second), strip, true, this, nullptr);
+    }
+    else
+      new_format = valueFormat;
+
+    return new_format;
+  }
+
   bool subset (hb_subset_context_t *c) const
   {
     TRACE_SUBSET (this);
@@ -163,8 +194,13 @@ struct SinglePosFormat2
                               })
     ;
 
+    unsigned new_format = compute_effective_format (c->plan->source, it,
+                                                    bool (c->plan->normalized_coords),
+                                                    bool (c->plan->flags & HB_SUBSET_FLAGS_NO_HINTING),
+                                                    c->plan->has_gdef_varstore,
+                                                    &c->plan->layout_variation_idx_delta_map);
     bool ret = bool (it);
-    SinglePos_serialize (c->serializer, this, it, &c->plan->layout_variation_idx_delta_map, c->plan->all_axes_pinned);
+    SinglePos_serialize (c->serializer, this, it, &c->plan->layout_variation_idx_delta_map, new_format);
     return_trace (ret);
   }
 };
diff --git a/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/ValueFormat.hh b/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/ValueFormat.hh
index 8618cddad1c7..731d1ffca1a5 100644
--- a/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/ValueFormat.hh
+++ b/src/java.desktop/share/native/libharfbuzz/OT/Layout/GPOS/ValueFormat.hh
@@ -9,6 +9,8 @@ namespace GPOS_impl {
 
 typedef HBUINT16 Value;
 
+struct ValueBase {}; // Dummy base class tag for OffsetTo bases.
+
 typedef UnsizedArrayOf ValueRecord;
 
 struct ValueFormat : HBUINT16
@@ -78,7 +80,7 @@ struct ValueFormat : HBUINT16
   }
 
   bool apply_value (hb_ot_apply_context_t *c,
-                    const void            *base,
+                    const ValueBase       *base,
                     const Value           *values,
                     hb_glyph_position_t   &glyph_pos) const
   {
@@ -114,7 +116,7 @@ struct ValueFormat : HBUINT16
 
     if (!use_x_device && !use_y_device) return ret;
 
-    const VariationStore &store = c->var_store;
+    const ItemVariationStore &store = c->var_store;
     auto *cache = c->var_store_cache;
 
     /* pixel -> fractional pixel */
@@ -142,11 +144,29 @@ struct ValueFormat : HBUINT16
     return ret;
   }
 
-  unsigned int get_effective_format (const Value *values) const
+  unsigned int get_effective_format (const Value *values, bool strip_hints, bool strip_empty, const ValueBase *base,
+                                     const hb_hashmap_t> *varidx_delta_map) const
   {
     unsigned int format = *this;
     for (unsigned flag = xPlacement; flag <= yAdvDevice; flag = flag << 1) {
-      if (format & flag) should_drop (*values++, (Flags) flag, &format);
+      if (format & flag)
+      {
+        if (strip_hints && flag >= xPlaDevice)
+        {
+          format = format & ~flag;
+          values++;
+          continue;
+        }
+        if (varidx_delta_map && flag >= xPlaDevice)
+        {
+          update_var_flag (values++, (Flags) flag, &format, base, varidx_delta_map);
+          continue;
+        }
+        /* do not strip empty when instancing, cause we don't know whether the new
+         * default value is 0 or not */
+        if (strip_empty) should_drop (*values, (Flags) flag, &format);
+        values++;
+      }
     }
 
     return format;
@@ -154,18 +174,19 @@ struct ValueFormat : HBUINT16
 
   template
-  unsigned int get_effective_format (Iterator it) const {
+  unsigned int get_effective_format (Iterator it, bool strip_hints, bool strip_empty, const ValueBase *base,
+                                     const hb_hashmap_t> *varidx_delta_map) const {
     unsigned int new_format = 0;
 
     for (const hb_array_t& values : it)
-      new_format = new_format | get_effective_format (&values);
+      new_format = new_format | get_effective_format (&values, strip_hints, strip_empty, base, varidx_delta_map);
 
     return new_format;
   }
 
   void copy_values (hb_serialize_context_t *c,
                     unsigned int new_format,
-                    const void *base,
+                    const ValueBase *base,
                     const Value *values,
                     const hb_hashmap_t> *layout_variation_idx_delta_map) const
   {
@@ -217,7 +238,7 @@ struct ValueFormat : HBUINT16
   }
 
   void collect_variation_indices (hb_collect_variation_indices_context_t *c,
-                                  const void *base,
+                                  const ValueBase *base,
                                   const hb_array_t& values) const
   {
     unsigned format = *this;
@@ -251,17 +272,8 @@ struct ValueFormat : HBUINT16
     }
   }
 
-  unsigned drop_device_table_flags () const
-  {
-    unsigned format = *this;
-    for (unsigned flag = xPlaDevice; flag <= yAdvDevice; flag = flag << 1)
-      format = format & ~flag;
-
-    return format;
-  }
-
   private:
-  bool sanitize_value_devices (hb_sanitize_context_t *c, const void *base, const Value *values) const
+  bool sanitize_value_devices (hb_sanitize_context_t *c, const ValueBase *base, const Value *values) const
   {
     unsigned int format = *this;
 
@@ -278,17 +290,17 @@ struct ValueFormat : HBUINT16
     return true;
   }
 
-  static inline Offset16To& get_device (Value* value)
+  static inline Offset16To& get_device (Value* value)
   {
-    return *static_cast *> (value);
+    return *static_cast *> (value);
   }
-  static inline const Offset16To& get_device (const Value* value)
+  static inline const Offset16To& get_device (const Value* value)
   {
-    return *static_cast *> (value);
+    return *static_cast *> (value);
   }
   static inline const Device& get_device (const Value* value,
                                           bool *worked,
-                                          const void *base,
+                                          const ValueBase *base,
                                           hb_sanitize_context_t &c)
   {
     if (worked) *worked |= bool (*value);
@@ -296,12 +308,13 @@ struct ValueFormat : HBUINT16
 
     if (unlikely (!offset.sanitize (&c, base)))
       return Null(Device);
+    hb_barrier ();
 
     return base + offset;
   }
 
   void add_delta_to_value (HBINT16 *value,
-                           const void *base,
+                           const ValueBase *base,
                            const Value *src_value,
                            const hb_hashmap_t> *layout_variation_idx_delta_map) const
   {
@@ -313,7 +326,8 @@ struct ValueFormat : HBUINT16
     *value += hb_second (*varidx_delta);
   }
 
-  bool copy_device (hb_serialize_context_t *c, const void *base,
+  bool copy_device (hb_serialize_context_t *c,
+                    const ValueBase *base,
                     const Value *src_value,
                     const hb_hashmap_t> *layout_variation_idx_delta_map,
                     unsigned int new_format, Flags flag) const
@@ -354,7 +368,7 @@ struct ValueFormat : HBUINT16
     return (format & devices) != 0;
   }
 
-  bool sanitize_value (hb_sanitize_context_t *c, const void *base, const Value *values) const
+  bool sanitize_value (hb_sanitize_context_t *c, const ValueBase *base, const Value *values) const
   {
     TRACE_SANITIZE (this);
 
@@ -366,7 +380,7 @@ struct ValueFormat : HBUINT16
     return_trace (!has_device () || sanitize_value_devices (c, base, values));
   }
 
-  bool sanitize_values (hb_sanitize_context_t *c, const void *base, const Value *values, unsigned int count) const
+  bool sanitize_values (hb_sanitize_context_t *c, const ValueBase *base, const Value *values, unsigned int count) const
   {
     TRACE_SANITIZE (this);
     unsigned size = get_size ();
@@ -376,11 +390,12 @@ struct ValueFormat : HBUINT16
     if (c->lazy_some_gpos)
       return_trace (true);
 
+    hb_barrier ();
     return_trace (sanitize_values_stride_unsafe (c, base, values, count, size));
   }
 
   /* Just sanitize referenced Device tables.  Doesn't check the values themselves. */
-  bool sanitize_values_stride_unsafe (hb_sanitize_context_t *c, const void *base, const Value *values, unsigned int count, unsigned int stride) const
+  bool sanitize_values_stride_unsafe (hb_sanitize_context_t *c, const ValueBase *base, const Value *values, unsigned int count, unsigned int stride) const
   {
     TRACE_SANITIZE (this);
 
@@ -403,6 +418,20 @@ struct ValueFormat : HBUINT16
     *format = *format & ~flag;
   }
 
+  void update_var_flag (const Value* value, Flags flag,
+                        unsigned int* format, const ValueBase *base,
+                        const hb_hashmap_t> *varidx_delta_map) const
+  {
+    if (*value)
+    {
+      unsigned varidx = (base + get_device (value)).get_variation_index ();
+      hb_pair_t *varidx_delta;
+      if (varidx_delta_map->has (varidx, &varidx_delta) &&
+          varidx_delta->first != HB_OT_LAYOUT_NO_VARIATIONS_INDEX)
+        return;
+    }
+    *format = *format & ~flag;
+  }
 };
 
 }
diff --git a/src/java.desktop/share/native/libharfbuzz/OT/Layout/GSUB/AlternateSubstFormat1.hh b/src/java.desktop/share/native/libharfbuzz/OT/Layout/GSUB/AlternateSubstFormat1.hh
index adec65d58646..421a6e066278 100644
--- a/src/java.desktop/share/native/libharfbuzz/OT/Layout/GSUB/AlternateSubstFormat1.hh
+++ b/src/java.desktop/share/native/libharfbuzz/OT/Layout/GSUB/AlternateSubstFormat1.hh
@@ -74,7 +74,7 @@ struct AlternateSubstFormat1_2
     TRACE_APPLY (this);
 
     unsigned int index = (this+coverage).get_coverage (c->buffer->cur().codepoint);
-    if (likely (index == NOT_COVERED)) return_trace (false);
+    if (index == NOT_COVERED) return_trace (false);
 
     return_trace ((this+alternateSet[index]).apply (c));
   }
diff --git a/src/java.desktop/share/native/libharfbuzz/OT/Layout/GSUB/Ligature.hh b/src/java.desktop/share/native/libharfbuzz/OT/Layout/GSUB/Ligature.hh
index de4a111b46cf..726da458fac3 100644
--- a/src/java.desktop/share/native/libharfbuzz/OT/Layout/GSUB/Ligature.hh
+++ b/src/java.desktop/share/native/libharfbuzz/OT/Layout/GSUB/Ligature.hh
@@ -90,8 +90,17 @@ struct Ligature
 
     unsigned int total_component_count = 0;
 
+    if (unlikely (count > HB_MAX_CONTEXT_LENGTH)) return false;
+    unsigned match_positions_stack[4];
+    unsigned *match_positions = match_positions_stack;
+    if (unlikely (count > ARRAY_LENGTH (match_positions_stack)))
+    {
+      match_positions = (unsigned *) hb_malloc (hb_max (count, 1u) * sizeof (unsigned));
+      if (unlikely (!match_positions))
+        return_trace (false);
+    }
+
     unsigned int match_end = 0;
-    unsigned int match_positions[HB_MAX_CONTEXT_LENGTH];
 
     if (likely (!match_input (c, count,
                               &component[1],
@@ -102,6 +111,8 @@ struct Ligature
                               &total_component_count)))
     {
       c->buffer->unsafe_to_concat (c->buffer->idx, match_end);
+      if (match_positions != match_positions_stack)
+        hb_free (match_positions);
       return_trace (false);
     }
 
@@ -145,6 +156,8 @@ struct Ligature
                           pos);
     }
 
+    if (match_positions != match_positions_stack)
+      hb_free (match_positions);
     return_trace (true);
   }
 
diff --git a/src/java.desktop/share/native/libharfbuzz/OT/Layout/GSUB/LigatureSubstFormat1.hh b/src/java.desktop/share/native/libharfbuzz/OT/Layout/GSUB/LigatureSubstFormat1.hh
index 5c7df97d13ae..6ae24b337540 100644
--- a/src/java.desktop/share/native/libharfbuzz/OT/Layout/GSUB/LigatureSubstFormat1.hh
+++ b/src/java.desktop/share/native/libharfbuzz/OT/Layout/GSUB/LigatureSubstFormat1.hh
@@ -78,12 +78,49 @@ struct LigatureSubstFormat1_2
     return lig_set.would_apply (c);
   }
 
-  bool apply (hb_ot_apply_context_t *c) const
+  unsigned cache_cost () const
   {
-    TRACE_APPLY (this);
+    return (this+coverage).cost ();
+  }
+  static void * cache_func (void *p, hb_ot_lookup_cache_op_t op)
+  {
+    switch (op)
+    {
+      case hb_ot_lookup_cache_op_t::CREATE:
+      {
+        hb_ot_lookup_cache_t *cache = (hb_ot_lookup_cache_t *) hb_malloc (sizeof (hb_ot_lookup_cache_t));
+        if (likely (cache))
+          cache->clear ();
+        return cache;
+      }
+      case hb_ot_lookup_cache_op_t::ENTER:
+        return (void *) true;
+      case hb_ot_lookup_cache_op_t::LEAVE:
+        return nullptr;
+      case hb_ot_lookup_cache_op_t::DESTROY:
+      {
+        hb_ot_lookup_cache_t *cache = (hb_ot_lookup_cache_t *) p;
+        hb_free (cache);
+        return nullptr;
+      }
+    }
+    return nullptr;
+  }
 
-    unsigned int index = (this+coverage).get_coverage (c->buffer->cur ().codepoint);
-    if (likely (index == NOT_COVERED)) return_trace (false);
+  bool apply_cached (hb_ot_apply_context_t *c) const { return _apply (c, true); }
+  bool apply (hb_ot_apply_context_t *c) const { return _apply (c, false); }
+  bool _apply (hb_ot_apply_context_t *c, bool cached) const
+  {
+    TRACE_APPLY (this);
+    hb_buffer_t *buffer = c->buffer;
+
+#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
+    hb_ot_lookup_cache_t *cache = cached ? (hb_ot_lookup_cache_t *) c->lookup_accel->cache : nullptr;
+    unsigned int index = (this+coverage).get_coverage  (buffer->cur().codepoint, cache);
+#else
+    unsigned int index = (this+coverage).get_coverage  (buffer->cur().codepoint);
+#endif
+    if (index == NOT_COVERED) return_trace (false);
 
     const auto &lig_set = this+ligatureSet[index];
     return_trace (lig_set.apply (c));
diff --git a/src/java.desktop/share/native/libharfbuzz/OT/Layout/GSUB/MultipleSubstFormat1.hh b/src/java.desktop/share/native/libharfbuzz/OT/Layout/GSUB/MultipleSubstFormat1.hh
index 4a9972c29cc5..aec8d0f2c07f 100644
--- a/src/java.desktop/share/native/libharfbuzz/OT/Layout/GSUB/MultipleSubstFormat1.hh
+++ b/src/java.desktop/share/native/libharfbuzz/OT/Layout/GSUB/MultipleSubstFormat1.hh
@@ -66,7 +66,7 @@ struct MultipleSubstFormat1_2
     TRACE_APPLY (this);
 
     unsigned int index = (this+coverage).get_coverage (c->buffer->cur().codepoint);
-    if (likely (index == NOT_COVERED)) return_trace (false);
+    if (index == NOT_COVERED) return_trace (false);
 
     return_trace ((this+sequence[index]).apply (c));
   }
diff --git a/src/java.desktop/share/native/libharfbuzz/OT/Layout/GSUB/ReverseChainSingleSubstFormat1.hh b/src/java.desktop/share/native/libharfbuzz/OT/Layout/GSUB/ReverseChainSingleSubstFormat1.hh
index ec6dfa476476..400a9e737911 100644
--- a/src/java.desktop/share/native/libharfbuzz/OT/Layout/GSUB/ReverseChainSingleSubstFormat1.hh
+++ b/src/java.desktop/share/native/libharfbuzz/OT/Layout/GSUB/ReverseChainSingleSubstFormat1.hh
@@ -33,9 +33,11 @@ struct ReverseChainSingleSubstFormat1
     TRACE_SANITIZE (this);
     if (!(coverage.sanitize (c, this) && backtrack.sanitize (c, this)))
       return_trace (false);
+    hb_barrier ();
     const auto &lookahead = StructAfter (backtrack);
     if (!lookahead.sanitize (c, this))
       return_trace (false);
+    hb_barrier ();
     const auto &substitute = StructAfter (lookahead);
     return_trace (substitute.sanitize (c));
   }
@@ -109,12 +111,12 @@ struct ReverseChainSingleSubstFormat1
   bool apply (hb_ot_apply_context_t *c) const
   {
     TRACE_APPLY (this);
+    unsigned int index = (this+coverage).get_coverage (c->buffer->cur ().codepoint);
+    if (index == NOT_COVERED) return_trace (false);
+
     if (unlikely (c->nesting_level_left != HB_MAX_NESTING_LEVEL))
       return_trace (false); /* No chaining to this type */
 
-    unsigned int index = (this+coverage).get_coverage (c->buffer->cur ().codepoint);
-    if (likely (index == NOT_COVERED)) return_trace (false);
-
     const auto &lookahead = StructAfter (backtrack);
     const auto &substitute = StructAfter (lookahead);
 
diff --git a/src/java.desktop/share/native/libharfbuzz/OT/Layout/GSUB/SingleSubstFormat1.hh b/src/java.desktop/share/native/libharfbuzz/OT/Layout/GSUB/SingleSubstFormat1.hh
index 268487c5ae77..be6cd820d284 100644
--- a/src/java.desktop/share/native/libharfbuzz/OT/Layout/GSUB/SingleSubstFormat1.hh
+++ b/src/java.desktop/share/native/libharfbuzz/OT/Layout/GSUB/SingleSubstFormat1.hh
@@ -128,7 +128,7 @@ struct SingleSubstFormat1_3
     TRACE_APPLY (this);
     hb_codepoint_t glyph_id = c->buffer->cur().codepoint;
     unsigned int index = (this+coverage).get_coverage (glyph_id);
-    if (likely (index == NOT_COVERED)) return_trace (false);
+    if (index == NOT_COVERED) return_trace (false);
 
     hb_codepoint_t d = deltaGlyphID;
     hb_codepoint_t mask = get_mask ();
diff --git a/src/java.desktop/share/native/libharfbuzz/OT/Layout/GSUB/SingleSubstFormat2.hh b/src/java.desktop/share/native/libharfbuzz/OT/Layout/GSUB/SingleSubstFormat2.hh
index 518900116710..e90964604511 100644
--- a/src/java.desktop/share/native/libharfbuzz/OT/Layout/GSUB/SingleSubstFormat2.hh
+++ b/src/java.desktop/share/native/libharfbuzz/OT/Layout/GSUB/SingleSubstFormat2.hh
@@ -104,7 +104,7 @@ struct SingleSubstFormat2_4
   {
     TRACE_APPLY (this);
     unsigned int index = (this+coverage).get_coverage (c->buffer->cur().codepoint);
-    if (likely (index == NOT_COVERED)) return_trace (false);
+    if (index == NOT_COVERED) return_trace (false);
 
     if (unlikely (index >= substitute.len)) return_trace (false);
 
diff --git a/src/java.desktop/share/native/libharfbuzz/OT/Layout/types.hh b/src/java.desktop/share/native/libharfbuzz/OT/Layout/types.hh
index 6a43403e94b2..527f64114b40 100644
--- a/src/java.desktop/share/native/libharfbuzz/OT/Layout/types.hh
+++ b/src/java.desktop/share/native/libharfbuzz/OT/Layout/types.hh
@@ -29,6 +29,9 @@
 #ifndef OT_LAYOUT_TYPES_HH
 #define OT_LAYOUT_TYPES_HH
 
+using hb_ot_lookup_cache_t = hb_cache_t<15, 8, 7>;
+static_assert (sizeof (hb_ot_lookup_cache_t) == 256, "");
+
 namespace OT {
 namespace Layout {
 
@@ -38,8 +41,8 @@ struct SmallTypes {
   using HBUINT = HBUINT16;
   using HBGlyphID = HBGlyphID16;
   using Offset = Offset16;
-  template 
-  using OffsetTo = OT::Offset16To;
+  template 
+  using OffsetTo = OT::Offset16To;
   template 
   using ArrayOf = OT::Array16Of;
   template 
@@ -52,8 +55,8 @@ struct MediumTypes {
   using HBUINT = HBUINT24;
   using HBGlyphID = HBGlyphID24;
   using Offset = Offset24;
-  template 
-  using OffsetTo = OT::Offset24To;
+  template 
+  using OffsetTo = OT::Offset24To;
   template 
   using ArrayOf = OT::Array24Of;
   template 
diff --git a/src/java.desktop/share/native/libharfbuzz/OT/Var/VARC/VARC.hh b/src/java.desktop/share/native/libharfbuzz/OT/Var/VARC/VARC.hh
new file mode 100644
index 000000000000..dbbbec9eee04
--- /dev/null
+++ b/src/java.desktop/share/native/libharfbuzz/OT/Var/VARC/VARC.hh
@@ -0,0 +1,218 @@
+#ifndef OT_VAR_VARC_VARC_HH
+#define OT_VAR_VARC_VARC_HH
+
+#include "../../../hb-decycler.hh"
+#include "../../../hb-geometry.hh"
+#include "../../../hb-ot-layout-common.hh"
+#include "../../../hb-ot-glyf-table.hh"
+#include "../../../hb-ot-cff2-table.hh"
+#include "../../../hb-ot-cff1-table.hh"
+
+#include "coord-setter.hh"
+
+namespace OT {
+
+//namespace Var {
+
+/*
+ * VARC -- Variable Composites
+ * https://github.com/harfbuzz/boring-expansion-spec/blob/main/VARC.md
+ */
+
+#ifndef HB_NO_VAR_COMPOSITES
+
+struct VarComponent
+{
+  enum class flags_t : uint32_t
+  {
+    RESET_UNSPECIFIED_AXES      = 1u << 0,
+    HAVE_AXES                   = 1u << 1,
+    AXIS_VALUES_HAVE_VARIATION  = 1u << 2,
+    TRANSFORM_HAS_VARIATION     = 1u << 3,
+    HAVE_TRANSLATE_X            = 1u << 4,
+    HAVE_TRANSLATE_Y            = 1u << 5,
+    HAVE_ROTATION               = 1u << 6,
+    HAVE_CONDITION              = 1u << 7,
+    HAVE_SCALE_X                = 1u << 8,
+    HAVE_SCALE_Y                = 1u << 9,
+    HAVE_TCENTER_X              = 1u << 10,
+    HAVE_TCENTER_Y              = 1u << 11,
+    GID_IS_24BIT                = 1u << 12,
+    HAVE_SKEW_X                 = 1u << 13,
+    HAVE_SKEW_Y                 = 1u << 14,
+    RESERVED_MASK               = ~((1u << 15) - 1),
+  };
+
+  HB_INTERNAL hb_ubytes_t
+  get_path_at (hb_font_t *font,
+               hb_codepoint_t parent_gid,
+               hb_draw_session_t &draw_session,
+               hb_array_t coords,
+               hb_transform_t transform,
+               hb_ubytes_t record,
+               hb_decycler_t *decycler,
+               signed *edges_left,
+               signed depth_left,
+               hb_glyf_scratch_t &scratch,
+               VarRegionList::cache_t *cache = nullptr) const;
+};
+
+struct VarCompositeGlyph
+{
+  static void
+  get_path_at (hb_font_t *font,
+               hb_codepoint_t glyph,
+               hb_draw_session_t &draw_session,
+               hb_array_t coords,
+               hb_transform_t transform,
+               hb_ubytes_t record,
+               hb_decycler_t *decycler,
+               signed *edges_left,
+               signed depth_left,
+               hb_glyf_scratch_t &scratch,
+               VarRegionList::cache_t *cache = nullptr)
+  {
+    while (record)
+    {
+      const VarComponent &comp = * (const VarComponent *) (record.arrayZ);
+      record = comp.get_path_at (font, glyph,
+                                 draw_session, coords, transform,
+                                 record,
+                                 decycler, edges_left, depth_left, scratch, cache);
+    }
+  }
+};
+
+HB_MARK_AS_FLAG_T (VarComponent::flags_t);
+
+struct VARC
+{
+  friend struct VarComponent;
+
+  static constexpr hb_tag_t tableTag = HB_TAG ('V', 'A', 'R', 'C');
+
+  HB_INTERNAL bool
+  get_path_at (hb_font_t *font,
+               hb_codepoint_t glyph,
+               hb_draw_session_t &draw_session,
+               hb_array_t coords,
+               hb_transform_t transform,
+               hb_codepoint_t parent_glyph,
+               hb_decycler_t *decycler,
+               signed *edges_left,
+               signed depth_left,
+               hb_glyf_scratch_t &scratch) const;
+
+  bool
+  get_path (hb_font_t *font,
+            hb_codepoint_t gid,
+            hb_draw_session_t &draw_session,
+            hb_glyf_scratch_t &scratch) const
+  {
+    hb_decycler_t decycler;
+    signed edges = HB_MAX_GRAPH_EDGE_COUNT;
+
+    return get_path_at (font,
+                        gid,
+                        draw_session,
+                        hb_array (font->coords, font->num_coords),
+                        HB_TRANSFORM_IDENTITY,
+                        HB_CODEPOINT_INVALID,
+                        &decycler,
+                        &edges,
+                        HB_MAX_NESTING_LEVEL,
+                        scratch);
+  }
+
+  bool sanitize (hb_sanitize_context_t *c) const
+  {
+    TRACE_SANITIZE (this);
+    return_trace (version.sanitize (c) &&
+                  hb_barrier () &&
+                  version.major == 1 &&
+                  coverage.sanitize (c, this) &&
+                  varStore.sanitize (c, this) &&
+                  conditionList.sanitize (c, this) &&
+                  axisIndicesList.sanitize (c, this) &&
+                  glyphRecords.sanitize (c, this));
+  }
+
+  struct accelerator_t
+  {
+    friend struct VarComponent;
+
+    accelerator_t (hb_face_t *face)
+    {
+      table = hb_sanitize_context_t ().reference_table (face);
+    }
+    ~accelerator_t ()
+    {
+      auto *scratch = cached_scratch.get_relaxed ();
+      if (scratch)
+      {
+        scratch->~hb_glyf_scratch_t ();
+        hb_free (scratch);
+      }
+
+      table.destroy ();
+    }
+
+    bool
+    get_path (hb_font_t *font, hb_codepoint_t gid, hb_draw_session_t &draw_session) const
+    {
+      if (!table->has_data ()) return false;
+
+      hb_glyf_scratch_t *scratch;
+
+      // Borrow the cached strach buffer.
+      {
+        scratch = cached_scratch.get_acquire ();
+        if (!scratch || unlikely (!cached_scratch.cmpexch (scratch, nullptr)))
+        {
+          scratch = (hb_glyf_scratch_t *) hb_calloc (1, sizeof (hb_glyf_scratch_t));
+          if (unlikely (!scratch))
+            return true;
+        }
+      }
+
+      bool ret = table->get_path (font, gid, draw_session, *scratch);
+
+      // Put it back.
+      if (!cached_scratch.cmpexch (nullptr, scratch))
+      {
+        scratch->~hb_glyf_scratch_t ();
+        hb_free (scratch);
+      }
+
+      return ret;
+    }
+
+    private:
+    hb_blob_ptr_t table;
+    hb_atomic_ptr_t cached_scratch;
+  };
+
+  bool has_data () const { return version.major != 0; }
+
+  protected:
+  FixedVersion<> version; /* Version identifier */
+  Offset32To coverage;
+  Offset32To varStore;
+  Offset32To conditionList;
+  Offset32To axisIndicesList;
+  Offset32To*/> glyphRecords;
+  public:
+  DEFINE_SIZE_STATIC (24);
+};
+
+struct VARC_accelerator_t : VARC::accelerator_t {
+  VARC_accelerator_t (hb_face_t *face) : VARC::accelerator_t (face) {}
+};
+
+#endif
+
+//}
+
+}
+
+#endif  /* OT_VAR_VARC_VARC_HH */
diff --git a/src/java.desktop/share/native/libharfbuzz/OT/Var/VARC/coord-setter.hh b/src/java.desktop/share/native/libharfbuzz/OT/Var/VARC/coord-setter.hh
new file mode 100644
index 000000000000..70c0968e1e40
--- /dev/null
+++ b/src/java.desktop/share/native/libharfbuzz/OT/Var/VARC/coord-setter.hh
@@ -0,0 +1,63 @@
+#ifndef OT_VAR_VARC_COORD_SETTER_HH
+#define OT_VAR_VARC_COORD_SETTER_HH
+
+
+#include "../../../hb.hh"
+
+
+namespace OT {
+//namespace Var {
+
+
+struct coord_setter_t
+{
+  coord_setter_t (hb_array_t coords_)
+  {
+    length = coords_.length;
+    if (length <= ARRAY_LENGTH (static_coords))
+      hb_memcpy (static_coords, coords_.arrayZ, length * sizeof (int));
+    else
+      dynamic_coords.extend (coords_);
+  }
+
+  int& operator [] (unsigned idx)
+  {
+    if (unlikely (idx >= HB_VAR_COMPOSITE_MAX_AXES))
+      return Crap(int);
+
+    if (length <= ARRAY_LENGTH (static_coords))
+    {
+      if (idx < ARRAY_LENGTH (static_coords))
+      {
+        while (length <= idx)
+          static_coords[length++] = 0;
+        return static_coords[idx];
+      }
+      else
+        dynamic_coords.extend (hb_array (static_coords, length));
+    }
+
+    if (dynamic_coords.length <= idx)
+    {
+      if (unlikely (!dynamic_coords.resize (idx + 1)))
+        return Crap(int);
+      length = idx + 1;
+    }
+    return dynamic_coords.arrayZ[idx];
+  }
+
+  hb_array_t get_coords ()
+  { return length <= ARRAY_LENGTH (static_coords) ? hb_array (static_coords, length) : dynamic_coords.as_array (); }
+
+  private:
+  hb_vector_t dynamic_coords;
+  unsigned length;
+  int static_coords[sizeof (void *) * 8];
+};
+
+
+//} // namespace Var
+
+} // namespace OT
+
+#endif /* OT_VAR_VARC_COORD_SETTER_HH */
diff --git a/src/java.desktop/share/native/libharfbuzz/OT/glyf/CompositeGlyph.hh b/src/java.desktop/share/native/libharfbuzz/OT/glyf/CompositeGlyph.hh
index 151c1ac48cb7..fb347770e6f4 100644
--- a/src/java.desktop/share/native/libharfbuzz/OT/glyf/CompositeGlyph.hh
+++ b/src/java.desktop/share/native/libharfbuzz/OT/glyf/CompositeGlyph.hh
@@ -143,7 +143,7 @@ struct CompositeGlyphRecord
     float matrix[4];
     contour_point_t trans;
     get_transformation (matrix, trans);
-    if (unlikely (!points.alloc (points.length + 4))) return false; // For phantom points
+    if (unlikely (!points.alloc (points.length + 1 + 4))) return false; // For phantom points
     points.push (trans);
     return true;
   }
@@ -240,7 +240,8 @@ struct CompositeGlyphRecord
     }
     if (is_anchored ()) tx = ty = 0;
 
-    trans.init ((float) tx, (float) ty);
+    /* set is_end_point flag to true, used by IUP delta optimization */
+    trans.init ((float) tx, (float) ty, true);
 
     {
       const F2DOT14 *points = (const F2DOT14 *) p;
diff --git a/src/java.desktop/share/native/libharfbuzz/OT/glyf/Glyph.hh b/src/java.desktop/share/native/libharfbuzz/OT/glyf/Glyph.hh
index b295e41510fd..1805df262aa0 100644
--- a/src/java.desktop/share/native/libharfbuzz/OT/glyf/Glyph.hh
+++ b/src/java.desktop/share/native/libharfbuzz/OT/glyf/Glyph.hh
@@ -7,8 +7,6 @@
 #include "GlyphHeader.hh"
 #include "SimpleGlyph.hh"
 #include "CompositeGlyph.hh"
-#include "VarCompositeGlyph.hh"
-#include "coord-setter.hh"
 
 
 namespace OT {
@@ -33,9 +31,6 @@ struct Glyph
     EMPTY,
     SIMPLE,
     COMPOSITE,
-#ifndef HB_NO_VAR_COMPOSITES
-    VAR_COMPOSITE,
-#endif
   };
 
   public:
@@ -44,22 +39,10 @@ struct Glyph
     if (type != COMPOSITE) return composite_iter_t ();
     return CompositeGlyph (*header, bytes).iter ();
   }
-  var_composite_iter_t get_var_composite_iterator () const
-  {
-#ifndef HB_NO_VAR_COMPOSITES
-    if (type != VAR_COMPOSITE) return var_composite_iter_t ();
-    return VarCompositeGlyph (*header, bytes).iter ();
-#else
-    return var_composite_iter_t ();
-#endif
-  }
 
   const hb_bytes_t trim_padding () const
   {
     switch (type) {
-#ifndef HB_NO_VAR_COMPOSITES
-    case VAR_COMPOSITE: return VarCompositeGlyph (*header, bytes).trim_padding ();
-#endif
     case COMPOSITE: return CompositeGlyph (*header, bytes).trim_padding ();
     case SIMPLE:    return SimpleGlyph (*header, bytes).trim_padding ();
     case EMPTY:     return bytes;
@@ -70,9 +53,6 @@ struct Glyph
   void drop_hints ()
   {
     switch (type) {
-#ifndef HB_NO_VAR_COMPOSITES
-    case VAR_COMPOSITE: return; // No hinting
-#endif
     case COMPOSITE: CompositeGlyph (*header, bytes).drop_hints (); return;
     case SIMPLE:    SimpleGlyph (*header, bytes).drop_hints (); return;
     case EMPTY:     return;
@@ -82,9 +62,6 @@ struct Glyph
   void set_overlaps_flag ()
   {
     switch (type) {
-#ifndef HB_NO_VAR_COMPOSITES
-    case VAR_COMPOSITE: return; // No overlaps flag
-#endif
     case COMPOSITE: CompositeGlyph (*header, bytes).set_overlaps_flag (); return;
     case SIMPLE:    SimpleGlyph (*header, bytes).set_overlaps_flag (); return;
     case EMPTY:     return;
@@ -94,15 +71,15 @@ struct Glyph
   void drop_hints_bytes (hb_bytes_t &dest_start, hb_bytes_t &dest_end) const
   {
     switch (type) {
-#ifndef HB_NO_VAR_COMPOSITES
-    case VAR_COMPOSITE: return; // No hinting
-#endif
     case COMPOSITE: CompositeGlyph (*header, bytes).drop_hints_bytes (dest_start); return;
     case SIMPLE:    SimpleGlyph (*header, bytes).drop_hints_bytes (dest_start, dest_end); return;
     case EMPTY:     return;
     }
   }
 
+  bool is_composite () const
+  { return type == COMPOSITE; }
+
   bool get_all_points_without_var (const hb_face_t *face,
                                    contour_point_vector_t &points /* OUT */) const
   {
@@ -117,14 +94,6 @@ struct Glyph
         if (unlikely (!item.get_points (points))) return false;
       break;
     }
-#ifndef HB_NO_VAR_COMPOSITES
-    case VAR_COMPOSITE:
-    {
-      for (auto &item : get_var_composite_iterator ())
-        if (unlikely (!item.get_points (points))) return false;
-      break;
-    }
-#endif
     case EMPTY:
       break;
     }
@@ -282,7 +251,8 @@ struct Glyph
       composite_contours_p = nullptr;
     }
 
-    if (!get_points (font, glyf, all_points, &points_with_deltas, head_maxp_info_p, composite_contours_p, false, false))
+    hb_glyf_scratch_t scratch;
+    if (!get_points (font, glyf, all_points, scratch, &points_with_deltas, head_maxp_info_p, composite_contours_p, false, false))
       return false;
 
     // .notdef, set type to empty so we only update metrics and don't compile bytes for
@@ -300,13 +270,6 @@ struct Glyph
     {
       switch (type)
       {
-#ifndef HB_NO_VAR_COMPOSITES
-      case VAR_COMPOSITE:
-        // TODO
-        dest_end = hb_bytes_t ();
-        break;
-#endif
-
       case COMPOSITE:
         if (!CompositeGlyph (*header, bytes).compile_bytes_with_deltas (dest_start,
                                                                         points_with_deltas,
@@ -343,27 +306,23 @@ struct Glyph
   template 
   bool get_points (hb_font_t *font, const accelerator_t &glyf_accelerator,
                    contour_point_vector_t &all_points /* OUT */,
+                   hb_glyf_scratch_t &scratch,
                    contour_point_vector_t *points_with_deltas = nullptr, /* OUT */
                    head_maxp_info_t * head_maxp_info = nullptr, /* OUT */
                    unsigned *composite_contours = nullptr, /* OUT */
                    bool shift_points_hori = true,
                    bool use_my_metrics = true,
                    bool phantom_only = false,
-                   hb_array_t coords = hb_array_t (),
-                   hb_map_t *current_glyphs = nullptr,
+                   hb_array_t coords = hb_array_t (),
                    unsigned int depth = 0,
                    unsigned *edge_count = nullptr) const
   {
     if (unlikely (depth > HB_MAX_NESTING_LEVEL)) return false;
     unsigned stack_edge_count = 0;
     if (!edge_count) edge_count = &stack_edge_count;
-    if (unlikely (*edge_count > HB_GLYF_MAX_EDGE_COUNT)) return false;
+    if (unlikely (*edge_count > HB_MAX_GRAPH_EDGE_COUNT)) return false;
     (*edge_count)++;
 
-    hb_map_t current_glyphs_stack;
-    if (current_glyphs == nullptr)
-      current_glyphs = ¤t_glyphs_stack;
-
     if (head_maxp_info)
     {
       head_maxp_info->maxComponentDepth = hb_max (head_maxp_info->maxComponentDepth, depth);
@@ -372,8 +331,7 @@ struct Glyph
     if (!coords)
       coords = hb_array (font->coords, font->num_coords);
 
-    contour_point_vector_t stack_points;
-    contour_point_vector_t &points = type == SIMPLE ? all_points : stack_points;
+    contour_point_vector_t &points = type == SIMPLE ? all_points : scratch.comp_points;
     unsigned old_length = points.length;
 
     switch (type) {
@@ -391,14 +349,6 @@ struct Glyph
         if (unlikely (!item.get_points (points))) return false;
       break;
     }
-#ifndef HB_NO_VAR_COMPOSITES
-    case VAR_COMPOSITE:
-    {
-      for (auto &item : get_var_composite_iterator ())
-        if (unlikely (!item.get_points (points))) return false;
-      break;
-    }
-#endif
     case EMPTY:
       break;
     }
@@ -434,36 +384,53 @@ struct Glyph
 
 #ifndef HB_NO_VAR
     if (coords)
-      glyf_accelerator.gvar->apply_deltas_to_points (gid,
-                                                     coords,
-                                                     points.as_array ().sub_array (old_length),
-                                                     phantom_only && type == SIMPLE);
+    {
+#ifndef HB_NO_BEYOND_64K
+      if (glyf_accelerator.GVAR->has_data ())
+        glyf_accelerator.GVAR->apply_deltas_to_points (gid,
+                                                       coords,
+                                                       points.as_array ().sub_array (old_length),
+                                                       scratch,
+                                                       phantom_only && type == SIMPLE);
+      else
+#endif
+        glyf_accelerator.gvar->apply_deltas_to_points (gid,
+                                                       coords,
+                                                       points.as_array ().sub_array (old_length),
+                                                       scratch,
+                                                       phantom_only && type == SIMPLE);
+    }
 #endif
 
     // mainly used by CompositeGlyph calculating new X/Y offset value so no need to extend it
     // with child glyphs' points
     if (points_with_deltas != nullptr && depth == 0 && type == COMPOSITE)
     {
-      if (unlikely (!points_with_deltas->resize (points.length))) return false;
+      assert (old_length == 0);
       *points_with_deltas = points;
     }
 
+    float shift = 0;
     switch (type) {
     case SIMPLE:
       if (depth == 0 && head_maxp_info)
         head_maxp_info->maxPoints = hb_max (head_maxp_info->maxPoints, all_points.length - old_length - 4);
+      shift = phantoms[PHANTOM_LEFT].x;
       break;
     case COMPOSITE:
     {
+      hb_decycler_node_t decycler_node (scratch.decycler);
+
       unsigned int comp_index = 0;
       for (auto &item : get_composite_iterator ())
       {
         hb_codepoint_t item_gid = item.get_gid ();
 
-        if (unlikely (current_glyphs->has (item_gid)))
+        if (unlikely (!decycler_node.visit (item_gid)))
+        {
+          comp_index++;
           continue;
-
-        current_glyphs->add (item_gid);
+        }
 
         unsigned old_count = all_points.length;
 
@@ -472,6 +439,7 @@ struct Glyph
                                        .get_points (font,
                                                     glyf_accelerator,
                                                     all_points,
+                                                    scratch,
                                                     points_with_deltas,
                                                     head_maxp_info,
                                                     composite_contours,
@@ -479,14 +447,16 @@ struct Glyph
                                                     use_my_metrics,
                                                     phantom_only,
                                                     coords,
-                                                    current_glyphs,
                                                     depth + 1,
                                                     edge_count)))
         {
-          current_glyphs->del (item_gid);
+          points.resize (old_length);
           return false;
         }
 
+        // points might have been reallocated. Relocate phantoms.
+        phantoms = points.as_array ().sub_array (points.length - PHANTOM_COUNT, PHANTOM_COUNT);
+
         auto comp_points = all_points.as_array ().sub_array (old_count);
 
         /* Copy phantom points from component if USE_MY_METRICS flag set */
@@ -501,7 +471,7 @@ struct Glyph
           item.get_transformation (matrix, default_trans);
 
           /* Apply component transformation & translation (with deltas applied) */
-          item.transform_points (comp_points, matrix, points[comp_index]);
+          item.transform_points (comp_points, matrix, points[old_length + comp_index]);
         }
 
         if (item.is_anchored () && !phantom_only)
@@ -522,12 +492,11 @@ struct Glyph
 
         if (all_points.length > HB_GLYF_MAX_POINTS)
         {
-          current_glyphs->del (item_gid);
+          points.resize (old_length);
           return false;
         }
 
         comp_index++;
-        current_glyphs->del (item_gid);
       }
 
       if (head_maxp_info && depth == 0)
@@ -538,84 +507,13 @@ struct Glyph
         head_maxp_info->maxComponentElements = hb_max (head_maxp_info->maxComponentElements, comp_index);
       }
       all_points.extend (phantoms);
+      shift = phantoms[PHANTOM_LEFT].x;
+      points.resize (old_length);
     } break;
-#ifndef HB_NO_VAR_COMPOSITES
-    case VAR_COMPOSITE:
-    {
-      hb_array_t points_left = points.as_array ();
-      for (auto &item : get_var_composite_iterator ())
-      {
-        hb_codepoint_t item_gid = item.get_gid ();
-
-        if (unlikely (current_glyphs->has (item_gid)))
-          continue;
-
-        current_glyphs->add (item_gid);
-
-        unsigned item_num_points = item.get_num_points ();
-        hb_array_t record_points = points_left.sub_array (0, item_num_points);
-        assert (record_points.length == item_num_points);
-
-        auto component_coords = coords;
-        /* Copying coords is expensive; so we have put an arbitrary
-         * limit on the max number of coords for now. */
-        if (item.is_reset_unspecified_axes () ||
-            coords.length > HB_GLYF_VAR_COMPOSITE_MAX_AXES)
-          component_coords = hb_array ();
-
-        coord_setter_t coord_setter (component_coords);
-        item.set_variations (coord_setter, record_points);
-
-        unsigned old_count = all_points.length;
-
-        if (unlikely ((!phantom_only || (use_my_metrics && item.is_use_my_metrics ())) &&
-                      !glyf_accelerator.glyph_for_gid (item_gid)
-                                       .get_points (font,
-                                                    glyf_accelerator,
-                                                    all_points,
-                                                    points_with_deltas,
-                                                    head_maxp_info,
-                                                    nullptr,
-                                                    shift_points_hori,
-                                                    use_my_metrics,
-                                                    phantom_only,
-                                                    coord_setter.get_coords (),
-                                                    current_glyphs,
-                                                    depth + 1,
-                                                    edge_count)))
-        {
-          current_glyphs->del (item_gid);
-          return false;
-        }
-
-        auto comp_points = all_points.as_array ().sub_array (old_count);
-
-        /* Apply component transformation */
-        if (comp_points) // Empty in case of phantom_only
-          item.transform_points (record_points, comp_points);
-
-        /* Copy phantom points from component if USE_MY_METRICS flag set */
-        if (use_my_metrics && item.is_use_my_metrics ())
-          for (unsigned int i = 0; i < PHANTOM_COUNT; i++)
-            phantoms[i] = comp_points[comp_points.length - PHANTOM_COUNT + i];
-
-        all_points.resize (all_points.length - PHANTOM_COUNT);
-
-        if (all_points.length > HB_GLYF_MAX_POINTS)
-        {
-          current_glyphs->del (item_gid);
-          return false;
-        }
-
-        points_left += item_num_points;
-
-        current_glyphs->del (item_gid);
-      }
-      all_points.extend (phantoms);
-    } break;
-#endif
     case EMPTY:
       all_points.extend (phantoms);
+      shift = phantoms[PHANTOM_LEFT].x;
+      points.resize (old_length);
       break;
     }
 
@@ -624,10 +522,9 @@ struct Glyph
       /* Undocumented rasterizer behavior:
        * Shift points horizontally by the updated left side bearing
        */
-      int v = -phantoms[PHANTOM_LEFT].x;
-      if (v)
+      if (shift)
         for (auto &point : all_points)
-          point.x += v;
+          point.x -= shift;
     }
 
     return !all_points.in_error ();
@@ -658,10 +555,7 @@ struct Glyph
     int num_contours = header->numberOfContours;
     if (unlikely (num_contours == 0)) type = EMPTY;
     else if (num_contours > 0) type = SIMPLE;
-    else if (num_contours == -1) type = COMPOSITE;
-#ifndef HB_NO_VAR_COMPOSITES
-    else if (num_contours == -2) type = VAR_COMPOSITE;
-#endif
+    else if (num_contours <= -1) type = COMPOSITE;
     else type = EMPTY; // Spec deviation; Spec says COMPOSITE, but not seen in the wild.
   }
 
diff --git a/src/java.desktop/share/native/libharfbuzz/OT/glyf/SimpleGlyph.hh b/src/java.desktop/share/native/libharfbuzz/OT/glyf/SimpleGlyph.hh
index 5088397266d2..601e1303792c 100644
--- a/src/java.desktop/share/native/libharfbuzz/OT/glyf/SimpleGlyph.hh
+++ b/src/java.desktop/share/native/libharfbuzz/OT/glyf/SimpleGlyph.hh
@@ -127,19 +127,20 @@ struct SimpleGlyph
                           hb_array_t points_ /* IN/OUT */,
                           const HBUINT8 *end)
   {
+    auto *points = points_.arrayZ;
     unsigned count = points_.length;
     for (unsigned int i = 0; i < count;)
     {
       if (unlikely (p + 1 > end)) return false;
       uint8_t flag = *p++;
-      points_.arrayZ[i++].flag = flag;
+      points[i++].flag = flag;
       if (flag & FLAG_REPEAT)
       {
         if (unlikely (p + 1 > end)) return false;
         unsigned int repeat_count = *p++;
         unsigned stop = hb_min (i + repeat_count, count);
         for (; i < stop; i++)
-          points_.arrayZ[i].flag = flag;
+          points[i].flag = flag;
       }
     }
     return true;
@@ -160,10 +161,7 @@ struct SimpleGlyph
       if (flag & short_flag)
       {
         if (unlikely (p + 1 > end)) return false;
-        if (flag & same_flag)
-          v += *p++;
-        else
-          v -= *p++;
+        v += (bool(flag & same_flag) * 2 - 1) * *p++;
       }
       else
       {
@@ -190,7 +188,7 @@ struct SimpleGlyph
     unsigned int num_points = endPtsOfContours[num_contours - 1] + 1;
 
     unsigned old_length = points.length;
-    points.alloc (points.length + num_points + 4, true); // Allocate for phantom points, to avoid a possible copy
+    points.alloc (points.length + num_points + 4); // Allocate for phantom points, to avoid a possible copy
     if (unlikely (!points.resize (points.length + num_points, false))) return false;
     auto points_ = points.as_array ().sub_array (old_length);
     if (!phantom_only)
@@ -281,9 +279,9 @@ struct SimpleGlyph
     unsigned num_points = all_points.length - 4;
 
     hb_vector_t flags, x_coords, y_coords;
-    if (unlikely (!flags.alloc (num_points, true))) return false;
-    if (unlikely (!x_coords.alloc (2*num_points, true))) return false;
-    if (unlikely (!y_coords.alloc (2*num_points, true))) return false;
+    if (unlikely (!flags.alloc_exact (num_points))) return false;
+    if (unlikely (!x_coords.alloc_exact (2*num_points))) return false;
+    if (unlikely (!y_coords.alloc_exact (2*num_points))) return false;
 
     unsigned lastflag = 255, repeat = 0;
     int prev_x = 0, prev_y = 0;
diff --git a/src/java.desktop/share/native/libharfbuzz/OT/glyf/SubsetGlyph.hh b/src/java.desktop/share/native/libharfbuzz/OT/glyf/SubsetGlyph.hh
index 9c04d890d1ab..643b0226492e 100644
--- a/src/java.desktop/share/native/libharfbuzz/OT/glyf/SubsetGlyph.hh
+++ b/src/java.desktop/share/native/libharfbuzz/OT/glyf/SubsetGlyph.hh
@@ -53,23 +53,12 @@ struct SubsetGlyph
       if (plan->new_gid_for_old_gid (_.get_gid(), &new_gid))
         const_cast (_).set_gid (new_gid);
     }
-#ifndef HB_NO_VAR_COMPOSITES
-    for (auto &_ : Glyph (dest_glyph).get_var_composite_iterator ())
-    {
-      hb_codepoint_t new_gid;
-      if (plan->new_gid_for_old_gid (_.get_gid(), &new_gid))
-        const_cast (_).set_gid (new_gid);
-    }
-#endif
 
 #ifndef HB_NO_BEYOND_64K
     auto it = Glyph (dest_glyph).get_composite_iterator ();
     if (it)
     {
-      /* lower GID24 to GID16 in components if possible.
-       *
-       * TODO: VarComposite. Not as critical, since VarComposite supports
-       * gid24 from the first version. */
+      /* lower GID24 to GID16 in components if possible. */
       char *p = it ? (char *) &*it : nullptr;
       char *q = p;
       const char *end = dest_glyph.arrayZ + dest_glyph.length;
diff --git a/src/java.desktop/share/native/libharfbuzz/OT/glyf/VarCompositeGlyph.hh b/src/java.desktop/share/native/libharfbuzz/OT/glyf/VarCompositeGlyph.hh
deleted file mode 100644
index 4f29f0aab37c..000000000000
--- a/src/java.desktop/share/native/libharfbuzz/OT/glyf/VarCompositeGlyph.hh
+++ /dev/null
@@ -1,401 +0,0 @@
-#ifndef OT_GLYF_VARCOMPOSITEGLYPH_HH
-#define OT_GLYF_VARCOMPOSITEGLYPH_HH
-
-
-#include "../../hb-open-type.hh"
-#include "coord-setter.hh"
-
-
-namespace OT {
-namespace glyf_impl {
-
-
-struct VarCompositeGlyphRecord
-{
-  protected:
-  enum var_composite_glyph_flag_t
-  {
-    USE_MY_METRICS              = 0x0001,
-    AXIS_INDICES_ARE_SHORT      = 0x0002,
-    UNIFORM_SCALE               = 0x0004,
-    HAVE_TRANSLATE_X            = 0x0008,
-    HAVE_TRANSLATE_Y            = 0x0010,
-    HAVE_ROTATION               = 0x0020,
-    HAVE_SCALE_X                = 0x0040,
-    HAVE_SCALE_Y                = 0x0080,
-    HAVE_SKEW_X                 = 0x0100,
-    HAVE_SKEW_Y                 = 0x0200,
-    HAVE_TCENTER_X              = 0x0400,
-    HAVE_TCENTER_Y              = 0x0800,
-    GID_IS_24BIT                = 0x1000,
-    AXES_HAVE_VARIATION         = 0x2000,
-    RESET_UNSPECIFIED_AXES      = 0x4000,
-  };
-
-  public:
-
-  unsigned int get_size () const
-  {
-    unsigned fl = flags;
-    unsigned int size = min_size;
-
-    unsigned axis_width = (fl & AXIS_INDICES_ARE_SHORT) ? 4 : 3;
-    size += numAxes * axis_width;
-
-    if (fl & GID_IS_24BIT)      size += 1;
-
-    // 2 bytes each for the following flags
-    fl = fl & (HAVE_TRANSLATE_X | HAVE_TRANSLATE_Y |
-               HAVE_ROTATION |
-               HAVE_SCALE_X | HAVE_SCALE_Y |
-               HAVE_SKEW_X | HAVE_SKEW_Y |
-               HAVE_TCENTER_X | HAVE_TCENTER_Y);
-    size += hb_popcount (fl) * 2;
-
-    return size;
-  }
-
-  bool has_more () const { return true; }
-
-  bool is_use_my_metrics () const { return flags & USE_MY_METRICS; }
-  bool is_reset_unspecified_axes () const { return flags & RESET_UNSPECIFIED_AXES; }
-
-  hb_codepoint_t get_gid () const
-  {
-    if (flags & GID_IS_24BIT)
-      return * (const HBGlyphID24 *) &pad;
-    else
-      return * (const HBGlyphID16 *) &pad;
-  }
-
-  void set_gid (hb_codepoint_t gid)
-  {
-    if (flags & GID_IS_24BIT)
-      * (HBGlyphID24 *) &pad = gid;
-    else
-      * (HBGlyphID16 *) &pad = gid;
-  }
-
-  unsigned get_numAxes () const
-  {
-    return numAxes;
-  }
-
-  unsigned get_num_points () const
-  {
-    unsigned fl = flags;
-    unsigned num = 0;
-    if (fl & AXES_HAVE_VARIATION)                       num += numAxes;
-
-    /* Hopefully faster code, relying on the value of the flags. */
-    fl = (((fl & (HAVE_TRANSLATE_Y | HAVE_SCALE_Y | HAVE_SKEW_Y | HAVE_TCENTER_Y)) >> 1) | fl) &
-         (HAVE_TRANSLATE_X | HAVE_ROTATION | HAVE_SCALE_X | HAVE_SKEW_X | HAVE_TCENTER_X);
-    num += hb_popcount (fl);
-    return num;
-
-    /* Slower but more readable code. */
-    if (fl & (HAVE_TRANSLATE_X | HAVE_TRANSLATE_Y))     num++;
-    if (fl & HAVE_ROTATION)                             num++;
-    if (fl & (HAVE_SCALE_X | HAVE_SCALE_Y))             num++;
-    if (fl & (HAVE_SKEW_X | HAVE_SKEW_Y))               num++;
-    if (fl & (HAVE_TCENTER_X | HAVE_TCENTER_Y))         num++;
-    return num;
-  }
-
-  void transform_points (hb_array_t record_points,
-                         hb_array_t points) const
-  {
-    float matrix[4];
-    contour_point_t trans;
-
-    get_transformation_from_points (record_points.arrayZ, matrix, trans);
-
-    auto arrayZ = points.arrayZ;
-    unsigned count = points.length;
-
-    if (matrix[0] != 1.f || matrix[1] != 0.f ||
-        matrix[2] != 0.f || matrix[3] != 1.f)
-      for (unsigned i = 0; i < count; i++)
-        arrayZ[i].transform (matrix);
-
-    if (trans.x != 0.f || trans.y != 0.f)
-      for (unsigned i = 0; i < count; i++)
-        arrayZ[i].translate (trans);
-  }
-
-  static inline void transform (float (&matrix)[4], contour_point_t &trans,
-                                float (other)[6])
-  {
-    // https://github.com/fonttools/fonttools/blob/f66ee05f71c8b57b5f519ee975e95edcd1466e14/Lib/fontTools/misc/transform.py#L268
-    float xx1 = other[0];
-    float xy1 = other[1];
-    float yx1 = other[2];
-    float yy1 = other[3];
-    float dx1 = other[4];
-    float dy1 = other[5];
-    float xx2 = matrix[0];
-    float xy2 = matrix[1];
-    float yx2 = matrix[2];
-    float yy2 = matrix[3];
-    float dx2 = trans.x;
-    float dy2 = trans.y;
-
-    matrix[0] = xx1*xx2 + xy1*yx2;
-    matrix[1] = xx1*xy2 + xy1*yy2;
-    matrix[2] = yx1*xx2 + yy1*yx2;
-    matrix[3] = yx1*xy2 + yy1*yy2;
-    trans.x = xx2*dx1 + yx2*dy1 + dx2;
-    trans.y = xy2*dx1 + yy2*dy1 + dy2;
-  }
-
-  static void translate (float (&matrix)[4], contour_point_t &trans,
-                         float translateX, float translateY)
-  {
-    if (!translateX && !translateY)
-      return;
-
-    trans.x += matrix[0] * translateX + matrix[2] * translateY;
-    trans.y += matrix[1] * translateX + matrix[3] * translateY;
-  }
-
-  static void scale (float (&matrix)[4], contour_point_t &trans,
-                     float scaleX, float scaleY)
-  {
-    if (scaleX == 1.f && scaleY == 1.f)
-      return;
-
-    matrix[0] *= scaleX;
-    matrix[1] *= scaleX;
-    matrix[2] *= scaleY;
-    matrix[3] *= scaleY;
-  }
-
-  static void rotate (float (&matrix)[4], contour_point_t &trans,
-                      float rotation)
-  {
-    if (!rotation)
-      return;
-
-    // https://github.com/fonttools/fonttools/blob/f66ee05f71c8b57b5f519ee975e95edcd1466e14/Lib/fontTools/misc/transform.py#L240
-    rotation = rotation * HB_PI;
-    float c;
-    float s;
-#ifdef HAVE_SINCOSF
-    sincosf (rotation, &s, &c);
-#else
-    c = cosf (rotation);
-    s = sinf (rotation);
-#endif
-    float other[6] = {c, s, -s, c, 0.f, 0.f};
-    transform (matrix, trans, other);
-  }
-
-  static void skew (float (&matrix)[4], contour_point_t &trans,
-                    float skewX, float skewY)
-  {
-    if (!skewX && !skewY)
-      return;
-
-    // https://github.com/fonttools/fonttools/blob/f66ee05f71c8b57b5f519ee975e95edcd1466e14/Lib/fontTools/misc/transform.py#L255
-    skewX = skewX * HB_PI;
-    skewY = skewY * HB_PI;
-    float other[6] = {1.f,
-                      skewY ? tanf (skewY) : 0.f,
-                      skewX ? tanf (skewX) : 0.f,
-                      1.f,
-                      0.f, 0.f};
-    transform (matrix, trans, other);
-  }
-
-  bool get_points (contour_point_vector_t &points) const
-  {
-    unsigned num_points = get_num_points ();
-
-    points.alloc (points.length + num_points + 4); // For phantom points
-    if (unlikely (!points.resize (points.length + num_points, false))) return false;
-    contour_point_t *rec_points = points.arrayZ + (points.length - num_points);
-    hb_memset (rec_points, 0, num_points * sizeof (rec_points[0]));
-
-    unsigned fl = flags;
-
-    unsigned num_axes = numAxes;
-    unsigned axis_width = (fl & AXIS_INDICES_ARE_SHORT) ? 2 : 1;
-    unsigned axes_size = num_axes * axis_width;
-
-    const F2DOT14 *q = (const F2DOT14 *) (axes_size +
-                                          (fl & GID_IS_24BIT ? 3 : 2) +
-                                          (const HBUINT8 *) &pad);
-
-    unsigned count = num_axes;
-    if (fl & AXES_HAVE_VARIATION)
-    {
-      for (unsigned i = 0; i < count; i++)
-        rec_points++->x = q++->to_int ();
-    }
-    else
-      q += count;
-
-    const HBUINT16 *p = (const HBUINT16 *) q;
-
-    if (fl & (HAVE_TRANSLATE_X | HAVE_TRANSLATE_Y))
-    {
-      int translateX = (fl & HAVE_TRANSLATE_X) ? * (const FWORD *) p++ : 0;
-      int translateY = (fl & HAVE_TRANSLATE_Y) ? * (const FWORD *) p++ : 0;
-      rec_points->x = translateX;
-      rec_points->y = translateY;
-      rec_points++;
-    }
-    if (fl & HAVE_ROTATION)
-    {
-      int rotation = (fl & HAVE_ROTATION) ? ((const F4DOT12 *) p++)->to_int () : 0;
-      rec_points->x = rotation;
-      rec_points++;
-    }
-    if (fl & (HAVE_SCALE_X | HAVE_SCALE_Y))
-    {
-      int scaleX = (fl & HAVE_SCALE_X) ? ((const F6DOT10 *) p++)->to_int () : 1 << 10;
-      int scaleY = (fl & HAVE_SCALE_Y) ? ((const F6DOT10 *) p++)->to_int () : 1 << 10;
-      if ((fl & UNIFORM_SCALE) && !(fl & HAVE_SCALE_Y))
-        scaleY = scaleX;
-      rec_points->x = scaleX;
-      rec_points->y = scaleY;
-      rec_points++;
-    }
-    if (fl & (HAVE_SKEW_X | HAVE_SKEW_Y))
-    {
-      int skewX = (fl & HAVE_SKEW_X) ? ((const F4DOT12 *) p++)->to_int () : 0;
-      int skewY = (fl & HAVE_SKEW_Y) ? ((const F4DOT12 *) p++)->to_int () : 0;
-      rec_points->x = skewX;
-      rec_points->y = skewY;
-      rec_points++;
-    }
-    if (fl & (HAVE_TCENTER_X | HAVE_TCENTER_Y))
-    {
-      int tCenterX = (fl & HAVE_TCENTER_X) ? * (const FWORD *) p++ : 0;
-      int tCenterY = (fl & HAVE_TCENTER_Y) ? * (const FWORD *) p++ : 0;
-      rec_points->x = tCenterX;
-      rec_points->y = tCenterY;
-      rec_points++;
-    }
-
-    return true;
-  }
-
-  void get_transformation_from_points (const contour_point_t *rec_points,
-                                       float (&matrix)[4], contour_point_t &trans) const
-  {
-    unsigned fl = flags;
-
-    if (fl & AXES_HAVE_VARIATION)
-      rec_points += numAxes;
-
-    matrix[0] = matrix[3] = 1.f;
-    matrix[1] = matrix[2] = 0.f;
-    trans.init (0.f, 0.f);
-
-    float translateX = 0.f;
-    float translateY = 0.f;
-    float rotation = 0.f;
-    float scaleX = 1.f;
-    float scaleY = 1.f;
-    float skewX = 0.f;
-    float skewY = 0.f;
-    float tCenterX = 0.f;
-    float tCenterY = 0.f;
-
-    if (fl & (HAVE_TRANSLATE_X | HAVE_TRANSLATE_Y))
-    {
-      translateX = rec_points->x;
-      translateY = rec_points->y;
-      rec_points++;
-    }
-    if (fl & HAVE_ROTATION)
-    {
-      rotation = rec_points->x / (1 << 12);
-      rec_points++;
-    }
-    if (fl & (HAVE_SCALE_X | HAVE_SCALE_Y))
-    {
-      scaleX = rec_points->x / (1 << 10);
-      scaleY = rec_points->y / (1 << 10);
-      rec_points++;
-    }
-    if (fl & (HAVE_SKEW_X | HAVE_SKEW_Y))
-    {
-      skewX = rec_points->x / (1 << 12);
-      skewY = rec_points->y / (1 << 12);
-      rec_points++;
-    }
-    if (fl & (HAVE_TCENTER_X | HAVE_TCENTER_Y))
-    {
-      tCenterX = rec_points->x;
-      tCenterY = rec_points->y;
-      rec_points++;
-    }
-
-    translate (matrix, trans, translateX + tCenterX, translateY + tCenterY);
-    rotate (matrix, trans, rotation);
-    scale (matrix, trans, scaleX, scaleY);
-    skew (matrix, trans, -skewX, skewY);
-    translate (matrix, trans, -tCenterX, -tCenterY);
-  }
-
-  void set_variations (coord_setter_t &setter,
-                       hb_array_t rec_points) const
-  {
-    bool have_variations = flags & AXES_HAVE_VARIATION;
-    unsigned axis_width = (flags & AXIS_INDICES_ARE_SHORT) ? 2 : 1;
-    unsigned num_axes = numAxes;
-
-    const HBUINT8  *p = (const HBUINT8 *)  (((HBUINT8 *) &numAxes) + numAxes.static_size + (flags & GID_IS_24BIT ? 3 : 2));
-    const HBUINT16 *q = (const HBUINT16 *) (((HBUINT8 *) &numAxes) + numAxes.static_size + (flags & GID_IS_24BIT ? 3 : 2));
-
-    const F2DOT14 *a = (const F2DOT14 *) ((HBUINT8 *) (axis_width == 1 ? (p + num_axes) : (HBUINT8 *) (q + num_axes)));
-
-    unsigned count = num_axes;
-    for (unsigned i = 0; i < count; i++)
-    {
-      unsigned axis_index = axis_width == 1 ? (unsigned) *p++ : (unsigned) *q++;
-
-      signed v = have_variations ? rec_points.arrayZ[i].x : a++->to_int ();
-
-      v = hb_clamp (v, -(1<<14), (1<<14));
-      setter[axis_index] = v;
-    }
-  }
-
-  protected:
-  HBUINT16      flags;
-  HBUINT8       numAxes;
-  HBUINT16      pad;
-  public:
-  DEFINE_SIZE_MIN (5);
-};
-
-using var_composite_iter_t = composite_iter_tmpl;
-
-struct VarCompositeGlyph
-{
-  const GlyphHeader &header;
-  hb_bytes_t bytes;
-  VarCompositeGlyph (const GlyphHeader &header_, hb_bytes_t bytes_) :
-    header (header_), bytes (bytes_) {}
-
-  var_composite_iter_t iter () const
-  { return var_composite_iter_t (bytes, &StructAfter (header)); }
-
-  const hb_bytes_t trim_padding () const
-  {
-    unsigned length = GlyphHeader::static_size;
-    for (auto &comp : iter ())
-      length += comp.get_size ();
-    return bytes.sub_array (0, length);
-  }
-};
-
-
-} /* namespace glyf_impl */
-} /* namespace OT */
-
-
-#endif /* OT_GLYF_VARCOMPOSITEGLYPH_HH */
diff --git a/src/java.desktop/share/native/libharfbuzz/OT/glyf/coord-setter.hh b/src/java.desktop/share/native/libharfbuzz/OT/glyf/coord-setter.hh
deleted file mode 100644
index cf05929362f5..000000000000
--- a/src/java.desktop/share/native/libharfbuzz/OT/glyf/coord-setter.hh
+++ /dev/null
@@ -1,36 +0,0 @@
-#ifndef OT_GLYF_COORD_SETTER_HH
-#define OT_GLYF_COORD_SETTER_HH
-
-
-#include "../../hb.hh"
-
-
-namespace OT {
-namespace glyf_impl {
-
-
-struct coord_setter_t
-{
-  coord_setter_t (hb_array_t coords) :
-    coords (coords) {}
-
-  int& operator [] (unsigned idx)
-  {
-    if (unlikely (idx >= HB_GLYF_VAR_COMPOSITE_MAX_AXES))
-      return Crap(int);
-    if (coords.length < idx + 1)
-      coords.resize (idx + 1);
-    return coords[idx];
-  }
-
-  hb_array_t get_coords ()
-  { return coords.as_array (); }
-
-  hb_vector_t coords;
-};
-
-
-} /* namespace glyf_impl */
-} /* namespace OT */
-
-#endif /* OT_GLYF_COORD_SETTER_HH */
diff --git a/src/java.desktop/share/native/libharfbuzz/OT/glyf/glyf-helpers.hh b/src/java.desktop/share/native/libharfbuzz/OT/glyf/glyf-helpers.hh
index 3462e4d1ea5f..bd07e941393f 100644
--- a/src/java.desktop/share/native/libharfbuzz/OT/glyf/glyf-helpers.hh
+++ b/src/java.desktop/share/native/libharfbuzz/OT/glyf/glyf-helpers.hh
@@ -38,7 +38,7 @@ _write_loca (IteratorIn&& it,
 
     unsigned padded_size = *it++;
     offset += padded_size;
-    DEBUG_MSG (SUBSET, nullptr, "loca entry gid %u offset %u padded-size %u", gid, offset, padded_size);
+    DEBUG_MSG (SUBSET, nullptr, "loca entry gid %" PRIu32 " offset %u padded-size %u", gid, offset, padded_size);
     value = offset >> right_shift;
     *dest++ = value;
 
diff --git a/src/java.desktop/share/native/libharfbuzz/OT/glyf/glyf.hh b/src/java.desktop/share/native/libharfbuzz/OT/glyf/glyf.hh
index 175e1de308c5..681c3b9a007e 100644
--- a/src/java.desktop/share/native/libharfbuzz/OT/glyf/glyf.hh
+++ b/src/java.desktop/share/native/libharfbuzz/OT/glyf/glyf.hh
@@ -94,7 +94,7 @@ struct glyf
     }
 
     hb_vector_t padded_offsets;
-    if (unlikely (!padded_offsets.alloc (c->plan->new_to_old_gid_list.length, true)))
+    if (unlikely (!padded_offsets.alloc_exact (c->plan->new_to_old_gid_list.length)))
       return_trace (false);
 
     hb_vector_t glyphs;
@@ -172,6 +172,9 @@ struct glyf_accelerator_t
     glyf_table = nullptr;
 #ifndef HB_NO_VAR
     gvar = nullptr;
+#ifndef HB_NO_BEYOND_64K
+    GVAR = nullptr;
+#endif
 #endif
     hmtx = nullptr;
 #ifndef HB_NO_VERTICAL
@@ -187,6 +190,9 @@ struct glyf_accelerator_t
     glyf_table = hb_sanitize_context_t ().reference_table (face);
 #ifndef HB_NO_VAR
     gvar = face->table.gvar;
+#ifndef HB_NO_BEYOND_64K
+    GVAR = face->table.GVAR;
+#endif
 #endif
     hmtx = face->table.hmtx;
 #ifndef HB_NO_VERTICAL
@@ -198,6 +204,13 @@ struct glyf_accelerator_t
   }
   ~glyf_accelerator_t ()
   {
+    auto *scratch = cached_scratch.get_relaxed ();
+    if (scratch)
+    {
+      scratch->~hb_glyf_scratch_t ();
+      hb_free (scratch);
+    }
+
     glyf_table.destroy ();
   }
 
@@ -205,18 +218,17 @@ struct glyf_accelerator_t
 
   protected:
   template
-  bool get_points (hb_font_t *font, hb_codepoint_t gid, T consumer) const
+  bool get_points (hb_font_t *font, hb_codepoint_t gid, T consumer,
+                   hb_array_t coords,
+                   hb_glyf_scratch_t &scratch) const
   {
     if (gid >= num_glyphs) return false;
 
-    /* Making this allocfree is not that easy
-       https://github.com/harfbuzz/harfbuzz/issues/2095
-       mostly because of gvar handling in VF fonts,
-       perhaps a separate path for non-VF fonts can be considered */
-    contour_point_vector_t all_points;
+    auto &all_points = scratch.all_points;
+    all_points.resize (0);
 
     bool phantom_only = !consumer.is_consuming_contour_points ();
-    if (unlikely (!glyph_for_gid (gid).get_points (font, *this, all_points, nullptr, nullptr, nullptr, true, true, phantom_only)))
+    if (unlikely (!glyph_for_gid (gid).get_points (font, *this, all_points, scratch, nullptr, nullptr, nullptr, true, true, phantom_only, coords)))
       return false;
 
     unsigned count = all_points.length;
@@ -225,8 +237,61 @@ struct glyf_accelerator_t
 
     if (consumer.is_consuming_contour_points ())
     {
-      for (auto &point : all_points.as_array ().sub_array (0, count))
-        consumer.consume_point (point);
+      auto *points = all_points.arrayZ;
+
+      if (false)
+      {
+        /* Our path-builder was designed to work with this simple loop.
+         * But FreeType and CoreText do it differently, so we match those
+         * with the other, more complicated, code branch below. */
+        for (unsigned i = 0; i < count; i++)
+        {
+          consumer.consume_point (points[i]);
+          if (points[i].is_end_point)
+            consumer.contour_end ();
+        }
+      }
+      else
+      {
+        for (unsigned i = 0; i < count; i++)
+        {
+          // Start of a contour.
+          if (points[i].flag & glyf_impl::SimpleGlyph::FLAG_ON_CURVE)
+          {
+            // First point is on-curve. Draw the contour.
+            for (; i < count; i++)
+            {
+              consumer.consume_point (points[i]);
+              if (points[i].is_end_point)
+              {
+                consumer.contour_end ();
+                break;
+              }
+            }
+          }
+          else
+          {
+            unsigned start = i;
+
+            // Find end of the contour.
+            for (; i < count; i++)
+              if (points[i].is_end_point)
+                break;
+
+            unsigned end = i;
+
+            // Enough to start from the end. Our path-builder takes care of the rest.
+            if (likely (end < count)) // Can only fail in case of alloc failure *maybe*.
+              consumer.consume_point (points[end]);
+
+            for (i = start; i < end; i++)
+              consumer.consume_point (points[i]);
+
+            consumer.contour_end ();
+          }
+        }
+      }
+
       consumer.points_end ();
     }
 
@@ -299,6 +364,7 @@ struct glyf_accelerator_t
 
     HB_ALWAYS_INLINE
     void consume_point (const contour_point_t &point) { bounds.add (point); }
+    void contour_end () {}
     void points_end () { bounds.get_extents (font, extents, scaled); }
 
     bool is_consuming_contour_points () { return extents; }
@@ -314,7 +380,12 @@ struct glyf_accelerator_t
 
     contour_point_t phantoms[glyf_impl::PHANTOM_COUNT];
     if (font->num_coords)
-      success = get_points (font, gid, points_aggregator_t (font, nullptr, phantoms, false));
+    {
+      hb_glyf_scratch_t scratch;
+      success = get_points (font, gid, points_aggregator_t (font, nullptr, phantoms, false),
+                            hb_array (font->coords, font->num_coords),
+                            scratch);
+    }
 
     if (unlikely (!success))
       return
@@ -334,9 +405,11 @@ struct glyf_accelerator_t
     if (unlikely (gid >= num_glyphs)) return false;
 
     hb_glyph_extents_t extents;
-
+    hb_glyf_scratch_t scratch;
     contour_point_t phantoms[glyf_impl::PHANTOM_COUNT];
-    if (unlikely (!get_points (font, gid, points_aggregator_t (font, &extents, phantoms, false))))
+    if (unlikely (!get_points (font, gid, points_aggregator_t (font, &extents, phantoms, false),
+                               hb_array (font->coords, font->num_coords),
+                               scratch)))
       return false;
 
     *lsb = is_vertical
@@ -362,20 +435,16 @@ struct glyf_accelerator_t
 
 #ifndef HB_NO_VAR
     if (font->num_coords)
-      return get_points (font, gid, points_aggregator_t (font, extents, nullptr, true));
+    {
+      hb_glyf_scratch_t scratch;
+      return get_points (font, gid, points_aggregator_t (font, extents, nullptr, true),
+                         hb_array (font->coords, font->num_coords),
+                         scratch);
+    }
 #endif
     return glyph_for_gid (gid).get_extents_without_var_scaled (font, *this, extents);
   }
 
-  bool paint_glyph (hb_font_t *font, hb_codepoint_t gid, hb_paint_funcs_t *funcs, void *data, hb_color_t foreground) const
-  {
-    funcs->push_clip_glyph (data, gid, font);
-    funcs->color (data, true, foreground);
-    funcs->pop_clip (data);
-
-    return true;
-  }
-
   const glyf_impl::Glyph
   glyph_for_gid (hb_codepoint_t gid, bool needs_padding_removal = false) const
   {
@@ -406,10 +475,52 @@ struct glyf_accelerator_t
 
   bool
   get_path (hb_font_t *font, hb_codepoint_t gid, hb_draw_session_t &draw_session) const
-  { return get_points (font, gid, glyf_impl::path_builder_t (font, draw_session)); }
+  {
+    if (!has_data ()) return false;
+
+    hb_glyf_scratch_t *scratch;
+
+    // Borrow the cached strach buffer.
+    {
+      scratch = cached_scratch.get_acquire ();
+      if (!scratch || unlikely (!cached_scratch.cmpexch (scratch, nullptr)))
+      {
+        scratch = (hb_glyf_scratch_t *) hb_calloc (1, sizeof (hb_glyf_scratch_t));
+        if (unlikely (!scratch))
+          return true;
+      }
+    }
+
+    bool ret = get_points (font, gid, glyf_impl::path_builder_t (font, draw_session),
+                           hb_array (font->coords, font->num_coords),
+                           *scratch);
+
+    // Put it back.
+    if (!cached_scratch.cmpexch (nullptr, scratch))
+    {
+      scratch->~hb_glyf_scratch_t ();
+      hb_free (scratch);
+    }
+
+    return ret;
+  }
+
+  bool
+  get_path_at (hb_font_t *font, hb_codepoint_t gid, hb_draw_session_t &draw_session,
+               hb_array_t coords,
+               hb_glyf_scratch_t &scratch) const
+  {
+    if (!has_data ()) return false;
+    return get_points (font, gid, glyf_impl::path_builder_t (font, draw_session),
+                       coords,
+                       scratch);
+  }
 
 #ifndef HB_NO_VAR
   const gvar_accelerator_t *gvar;
+#ifndef HB_NO_BEYOND_64K
+  const GVAR_accelerator_t *GVAR;
+#endif
 #endif
   const hmtx_accelerator_t *hmtx;
 #ifndef HB_NO_VERTICAL
@@ -421,6 +532,7 @@ struct glyf_accelerator_t
   unsigned int num_glyphs;
   hb_blob_ptr_t loca_table;
   hb_blob_ptr_t glyf_table;
+  hb_atomic_ptr_t cached_scratch;
 };
 
 
@@ -430,7 +542,7 @@ glyf::_populate_subset_glyphs (const hb_subset_plan_t   *plan,
                                hb_vector_t& glyphs /* OUT */) const
 {
   OT::glyf_accelerator_t glyf (plan->source);
-  if (!glyphs.alloc (plan->new_to_old_gid_list.length, true)) return false;
+  if (!glyphs.alloc_exact (plan->new_to_old_gid_list.length)) return false;
 
   for (const auto &pair : plan->new_to_old_gid_list)
   {
diff --git a/src/java.desktop/share/native/libharfbuzz/OT/glyf/path-builder.hh b/src/java.desktop/share/native/libharfbuzz/OT/glyf/path-builder.hh
index d56ea3e45ff4..f5495f923328 100644
--- a/src/java.desktop/share/native/libharfbuzz/OT/glyf/path-builder.hh
+++ b/src/java.desktop/share/native/libharfbuzz/OT/glyf/path-builder.hh
@@ -42,7 +42,7 @@ struct path_builder_t
   {
     bool is_on_curve = point.flag & glyf_impl::SimpleGlyph::FLAG_ON_CURVE;
 #ifdef HB_NO_CUBIC_GLYF
-    bool is_cubic = false;
+    constexpr bool is_cubic = false;
 #else
     bool is_cubic = !is_on_curve && (point.flag & glyf_impl::SimpleGlyph::FLAG_CUBIC);
 #endif
@@ -124,58 +124,60 @@ struct path_builder_t
       }
     }
 
-    if (unlikely (point.is_end_point))
-    {
-      if (first_offcurve && last_offcurve)
-      {
-        optional_point_t mid = last_offcurve.mid (first_offcurve2 ?
-                                                  first_offcurve2 :
-                                                  first_offcurve);
-        if (last_offcurve2)
-          draw_session->cubic_to (last_offcurve2.x, last_offcurve2.y,
-                                  last_offcurve.x, last_offcurve.y,
-                                  mid.x, mid.y);
-        else
-          draw_session->quadratic_to (last_offcurve.x, last_offcurve.y,
-                                     mid.x, mid.y);
-        last_offcurve = optional_point_t ();
-      }
-      /* now check the rest */
+  }
 
-      if (first_offcurve && first_oncurve)
-      {
-        if (first_offcurve2)
-          draw_session->cubic_to (first_offcurve2.x, first_offcurve2.y,
-                                  first_offcurve.x, first_offcurve.y,
-                                  first_oncurve.x, first_oncurve.y);
-        else
-          draw_session->quadratic_to (first_offcurve.x, first_offcurve.y,
-                                     first_oncurve.x, first_oncurve.y);
-      }
-      else if (last_offcurve && first_oncurve)
-      {
-        if (last_offcurve2)
-          draw_session->cubic_to (last_offcurve2.x, last_offcurve2.y,
-                                  last_offcurve.x, last_offcurve.y,
-                                  first_oncurve.x, first_oncurve.y);
-        else
-          draw_session->quadratic_to (last_offcurve.x, last_offcurve.y,
-                                     first_oncurve.x, first_oncurve.y);
-      }
-      else if (first_oncurve)
-        draw_session->line_to (first_oncurve.x, first_oncurve.y);
-      else if (first_offcurve)
-      {
-        float x = first_offcurve.x, y = first_offcurve.y;
-        draw_session->move_to (x, y);
-        draw_session->quadratic_to (x, y, x, y);
-      }
+  void contour_end ()
+  {
+    if (first_offcurve && last_offcurve)
+    {
+      optional_point_t mid = last_offcurve.mid (first_offcurve2 ?
+                                                first_offcurve2 :
+                                                first_offcurve);
+      if (last_offcurve2)
+        draw_session->cubic_to (last_offcurve2.x, last_offcurve2.y,
+                                last_offcurve.x, last_offcurve.y,
+                                mid.x, mid.y);
+      else
+        draw_session->quadratic_to (last_offcurve.x, last_offcurve.y,
+                                   mid.x, mid.y);
+      last_offcurve = optional_point_t ();
+    }
+    /* now check the rest */
 
-      /* Getting ready for the next contour */
-      first_oncurve = first_offcurve = last_offcurve = last_offcurve2 = optional_point_t ();
-      draw_session->close_path ();
+    if (first_offcurve && first_oncurve)
+    {
+      if (first_offcurve2)
+        draw_session->cubic_to (first_offcurve2.x, first_offcurve2.y,
+                                first_offcurve.x, first_offcurve.y,
+                                first_oncurve.x, first_oncurve.y);
+      else
+        draw_session->quadratic_to (first_offcurve.x, first_offcurve.y,
+                                   first_oncurve.x, first_oncurve.y);
     }
+    else if (last_offcurve && first_oncurve)
+    {
+      if (last_offcurve2)
+        draw_session->cubic_to (last_offcurve2.x, last_offcurve2.y,
+                                last_offcurve.x, last_offcurve.y,
+                                first_oncurve.x, first_oncurve.y);
+      else
+        draw_session->quadratic_to (last_offcurve.x, last_offcurve.y,
+                                   first_oncurve.x, first_oncurve.y);
+    }
+    else if (first_oncurve)
+      draw_session->line_to (first_oncurve.x, first_oncurve.y);
+    else if (first_offcurve)
+    {
+      float x = first_offcurve.x, y = first_offcurve.y;
+      draw_session->move_to (x, y);
+      draw_session->quadratic_to (x, y, x, y);
+    }
+
+    /* Getting ready for the next contour */
+    first_oncurve = first_offcurve = last_offcurve = last_offcurve2 = optional_point_t ();
+    draw_session->close_path ();
   }
+
   void points_end () {}
 
   bool is_consuming_contour_points () { return true; }
diff --git a/src/java.desktop/share/native/libharfbuzz/OT/name/name.hh b/src/java.desktop/share/native/libharfbuzz/OT/name/name.hh
index f14c2da2de68..b440379afbe6 100644
--- a/src/java.desktop/share/native/libharfbuzz/OT/name/name.hh
+++ b/src/java.desktop/share/native/libharfbuzz/OT/name/name.hh
@@ -242,7 +242,9 @@ struct NameRecord
   bool sanitize (hb_sanitize_context_t *c, const void *base) const
   {
     TRACE_SANITIZE (this);
-    return_trace (c->check_struct (this) && offset.sanitize (c, base, length));
+    return_trace (c->check_struct (this) &&
+                  hb_barrier () &&
+                  offset.sanitize (c, base, length));
   }
 
   HBUINT16      platformID;     /* Platform ID. */
@@ -465,6 +467,7 @@ struct name
   {
     TRACE_SANITIZE (this);
     return_trace (c->check_struct (this) &&
+                  hb_barrier () &&
                   likely (format == 0 || format == 1) &&
                   c->check_array (nameRecordZ.arrayZ, count) &&
                   c->check_range (this, stringOffset) &&
@@ -482,7 +485,7 @@ struct name
       const hb_array_t all_names (this->table->nameRecordZ.arrayZ,
                                                     this->table->count);
 
-      this->names.alloc (all_names.length, true);
+      this->names.alloc_exact (all_names.length);
 
       for (unsigned int i = 0; i < all_names.length; i++)
       {
diff --git a/src/java.desktop/share/native/libharfbuzz/UPDATING.txt b/src/java.desktop/share/native/libharfbuzz/UPDATING.txt
index 3f72983a4557..d536fad05ac5 100644
--- a/src/java.desktop/share/native/libharfbuzz/UPDATING.txt
+++ b/src/java.desktop/share/native/libharfbuzz/UPDATING.txt
@@ -53,9 +53,9 @@ STEP 2: BUILD CHANGES INCREMENTALLY
 
 STEP 3: COMPILER WARNINGS AND SETTING FLAGS
 -------------------------------------------
-- Update make parameters in Awt2DLibraries.gmk
+- Update make parameters in make/modules/java.desktop/lib/ClientLibraries.gmk
   Since we don't use configure we need to manually specify the options
-  we need in the Harfbuzz section of Awt2DLibraries.gmk.
+  we need in the Harfbuzz section of ClientLibraries.gmk.
   As well as adding new options, we may need to clean up obsolete options.
   Note there may be platform variations in the flags.
 
diff --git a/src/java.desktop/share/native/libharfbuzz/graph/classdef-graph.hh b/src/java.desktop/share/native/libharfbuzz/graph/classdef-graph.hh
index c1432883ffaa..da6378820bbc 100644
--- a/src/java.desktop/share/native/libharfbuzz/graph/classdef-graph.hh
+++ b/src/java.desktop/share/native/libharfbuzz/graph/classdef-graph.hh
@@ -39,6 +39,7 @@ struct ClassDefFormat1 : public OT::ClassDefFormat1_3
     int64_t vertex_len = vertex.obj.tail - vertex.obj.head;
     constexpr unsigned min_size = OT::ClassDefFormat1_3::min_size;
     if (vertex_len < min_size) return false;
+    hb_barrier ();
     return vertex_len >= min_size + classValue.get_size () - classValue.len.get_size ();
   }
 };
@@ -50,6 +51,7 @@ struct ClassDefFormat2 : public OT::ClassDefFormat2_4
     int64_t vertex_len = vertex.obj.tail - vertex.obj.head;
     constexpr unsigned min_size = OT::ClassDefFormat2_4::min_size;
     if (vertex_len < min_size) return false;
+    hb_barrier ();
     return vertex_len >= min_size + rangeRecord.get_size () - rangeRecord.len.get_size ();
   }
 };
@@ -114,6 +116,7 @@ struct ClassDef : public OT::ClassDef
   {
     int64_t vertex_len = vertex.obj.tail - vertex.obj.head;
     if (vertex_len < OT::ClassDef::min_size) return false;
+    hb_barrier ();
     switch (u.format)
     {
     case 1: return ((ClassDefFormat1*)this)->sanitize (vertex);
@@ -131,20 +134,23 @@ struct ClassDef : public OT::ClassDef
 
 struct class_def_size_estimator_t
 {
+  // TODO(garretrieger): update to support beyond64k coverage/classdef tables.
+  constexpr static unsigned class_def_format1_base_size = 6;
+  constexpr static unsigned class_def_format2_base_size = 4;
+  constexpr static unsigned coverage_base_size = 4;
+  constexpr static unsigned bytes_per_range = 6;
+  constexpr static unsigned bytes_per_glyph = 2;
+
   template
   class_def_size_estimator_t (It glyph_and_class)
-      : gids_consecutive (true), num_ranges_per_class (), glyphs_per_class ()
+      : num_ranges_per_class (), glyphs_per_class ()
   {
-    unsigned last_gid = (unsigned) -1;
+    reset();
     for (auto p : + glyph_and_class)
     {
       unsigned gid = p.first;
       unsigned klass = p.second;
 
-      if (last_gid != (unsigned) -1 && gid != last_gid + 1)
-        gids_consecutive = false;
-      last_gid = gid;
-
       hb_set_t* glyphs;
       if (glyphs_per_class.has (klass, &glyphs) && glyphs) {
         glyphs->add (gid);
@@ -174,28 +180,54 @@ struct class_def_size_estimator_t
     }
   }
 
-  // Incremental increase in the Coverage and ClassDef table size
-  // (worst case) if all glyphs associated with 'klass' were added.
-  unsigned incremental_coverage_size (unsigned klass) const
+  void reset() {
+    class_def_1_size = class_def_format1_base_size;
+    class_def_2_size = class_def_format2_base_size;
+    included_glyphs.clear();
+    included_classes.clear();
+  }
+
+  // Compute the size of coverage for all glyphs added via 'add_class_def_size'.
+  unsigned coverage_size () const
   {
-    // Coverage takes 2 bytes per glyph worst case,
-    return 2 * glyphs_per_class.get (klass).get_population ();
+    unsigned format1_size = coverage_base_size + bytes_per_glyph * included_glyphs.get_population();
+    unsigned format2_size = coverage_base_size + bytes_per_range * num_glyph_ranges();
+    return hb_min(format1_size, format2_size);
   }
 
-  // Incremental increase in the Coverage and ClassDef table size
-  // (worst case) if all glyphs associated with 'klass' were added.
-  unsigned incremental_class_def_size (unsigned klass) const
+  // Compute the new size of the ClassDef table if all glyphs associated with 'klass' were added.
+  unsigned add_class_def_size (unsigned klass)
   {
-    // ClassDef takes 6 bytes per range
-    unsigned class_def_2_size = 6 * num_ranges_per_class.get (klass);
-    if (gids_consecutive)
-    {
-      // ClassDef1 takes 2 bytes per glyph, but only can be used
-      // when gids are consecutive.
-      return hb_min (2 * glyphs_per_class.get (klass).get_population (), class_def_2_size);
+    if (!included_classes.has(klass)) {
+      hb_set_t* glyphs = nullptr;
+      if (glyphs_per_class.has(klass, &glyphs)) {
+        included_glyphs.union_(*glyphs);
+      }
+
+      class_def_1_size = class_def_format1_base_size;
+      if (!included_glyphs.is_empty()) {
+        unsigned min_glyph = included_glyphs.get_min();
+        unsigned max_glyph = included_glyphs.get_max();
+        class_def_1_size += bytes_per_glyph * (max_glyph - min_glyph + 1);
+      }
+
+      class_def_2_size += bytes_per_range * num_ranges_per_class.get (klass);
+
+      included_classes.add(klass);
     }
 
-    return class_def_2_size;
+    return hb_min (class_def_1_size, class_def_2_size);
+  }
+
+  unsigned num_glyph_ranges() const {
+    hb_codepoint_t start = HB_SET_VALUE_INVALID;
+    hb_codepoint_t end = HB_SET_VALUE_INVALID;
+
+    unsigned count = 0;
+    while (included_glyphs.next_range (&start, &end)) {
+        count++;
+    }
+    return count;
   }
 
   bool in_error ()
@@ -211,9 +243,12 @@ struct class_def_size_estimator_t
   }
 
  private:
-  bool gids_consecutive;
   hb_hashmap_t num_ranges_per_class;
   hb_hashmap_t glyphs_per_class;
+  hb_set_t included_classes;
+  hb_set_t included_glyphs;
+  unsigned class_def_1_size;
+  unsigned class_def_2_size;
 };
 
 
diff --git a/src/java.desktop/share/native/libharfbuzz/graph/coverage-graph.hh b/src/java.desktop/share/native/libharfbuzz/graph/coverage-graph.hh
index 4f44e076d1f3..61ca063e3451 100644
--- a/src/java.desktop/share/native/libharfbuzz/graph/coverage-graph.hh
+++ b/src/java.desktop/share/native/libharfbuzz/graph/coverage-graph.hh
@@ -39,6 +39,7 @@ struct CoverageFormat1 : public OT::Layout::Common::CoverageFormat1_3::min_size;
     if (vertex_len < min_size) return false;
+    hb_barrier ();
     return vertex_len >= min_size + glyphArray.get_size () - glyphArray.len.get_size ();
   }
 };
@@ -50,6 +51,7 @@ struct CoverageFormat2 : public OT::Layout::Common::CoverageFormat2_4::min_size;
     if (vertex_len < min_size) return false;
+    hb_barrier ();
     return vertex_len >= min_size + rangeRecord.get_size () - rangeRecord.len.get_size ();
   }
 };
@@ -138,6 +140,7 @@ struct Coverage : public OT::Layout::Common::Coverage
   {
     int64_t vertex_len = vertex.obj.tail - vertex.obj.head;
     if (vertex_len < OT::Layout::Common::Coverage::min_size) return false;
+    hb_barrier ();
     switch (u.format)
     {
     case 1: return ((CoverageFormat1*)this)->sanitize (vertex);
diff --git a/src/java.desktop/share/native/libharfbuzz/graph/graph.hh b/src/java.desktop/share/native/libharfbuzz/graph/graph.hh
index 4a1f7ebf5a5c..ed1026f58663 100644
--- a/src/java.desktop/share/native/libharfbuzz/graph/graph.hh
+++ b/src/java.desktop/share/native/libharfbuzz/graph/graph.hh
@@ -195,6 +195,15 @@ struct graph_t
       return incoming_edges_;
     }
 
+    unsigned incoming_edges_from_parent (unsigned parent_index) const {
+      if (single_parent != (unsigned) -1) {
+        return single_parent == parent_index ? 1 : 0;
+      }
+
+      unsigned* count;
+      return  parents.has(parent_index, &count) ? *count : 0;
+    }
+
     void reset_parents ()
     {
       incoming_edges_ = 0;
@@ -334,6 +343,16 @@ struct graph_t
       return true;
     }
 
+    bool give_max_priority ()
+    {
+      bool result = false;
+      while (!has_max_priority()) {
+        result = true;
+        priority++;
+      }
+      return result;
+    }
+
     bool has_max_priority () const {
       return priority >= 3;
     }
@@ -349,7 +368,7 @@ struct graph_t
       // it's parent where possible.
 
       int64_t modified_distance =
-          hb_min (hb_max(distance + distance_modifier (), 0), 0x7FFFFFFFFFF);
+          hb_clamp (distance + distance_modifier (), (int64_t) 0, 0x7FFFFFFFFFF);
       if (has_max_priority ()) {
         modified_distance = 0;
       }
@@ -567,6 +586,7 @@ struct graph_t
     update_distances ();
 
     hb_priority_queue_t queue;
+    queue.alloc (vertices_.length);
     hb_vector_t &sorted_graph = vertices_scratch_;
     if (unlikely (!check_success (sorted_graph.resize (vertices_.length)))) return;
     hb_vector_t id_map;
@@ -1022,6 +1042,11 @@ struct graph_t
    * Creates a copy of child and re-assigns the link from
    * parent to the clone. The copy is a shallow copy, objects
    * linked from child are not duplicated.
+   *
+   * Returns the index of the newly created duplicate.
+   *
+   * If the child_idx only has incoming edges from parent_idx, this
+   * will do nothing and return the original child_idx.
    */
   unsigned duplicate_if_shared (unsigned parent_idx, unsigned child_idx)
   {
@@ -1035,18 +1060,20 @@ struct graph_t
    * Creates a copy of child and re-assigns the link from
    * parent to the clone. The copy is a shallow copy, objects
    * linked from child are not duplicated.
+   *
+   * Returns the index of the newly created duplicate.
+   *
+   * If the child_idx only has incoming edges from parent_idx,
+   * duplication isn't possible and this will return -1.
    */
   unsigned duplicate (unsigned parent_idx, unsigned child_idx)
   {
     update_parents ();
 
-    unsigned links_to_child = 0;
-    for (const auto& l : vertices_[parent_idx].obj.all_links ())
-    {
-      if (l.objidx == child_idx) links_to_child++;
-    }
+    const auto& child = vertices_[child_idx];
+    unsigned links_to_child = child.incoming_edges_from_parent(parent_idx);
 
-    if (vertices_[child_idx].incoming_edges () <= links_to_child)
+    if (child.incoming_edges () <= links_to_child)
     {
       // Can't duplicate this node, doing so would orphan the original one as all remaining links
       // to child are from parent.
@@ -1059,7 +1086,7 @@ struct graph_t
                parent_idx, child_idx);
 
     unsigned clone_idx = duplicate (child_idx);
-    if (clone_idx == (unsigned) -1) return false;
+    if (clone_idx == (unsigned) -1) return -1;
     // duplicate shifts the root node idx, so if parent_idx was root update it.
     if (parent_idx == clone_idx) parent_idx++;
 
@@ -1075,6 +1102,62 @@ struct graph_t
     return clone_idx;
   }
 
+  /*
+   * Creates a copy of child and re-assigns the links from
+   * parents to the clone. The copy is a shallow copy, objects
+   * linked from child are not duplicated.
+   *
+   * Returns the index of the newly created duplicate.
+   *
+   * If the child_idx only has incoming edges from parents,
+   * duplication isn't possible or duplication fails and this will
+   * return -1.
+   */
+  unsigned duplicate (const hb_set_t* parents, unsigned child_idx)
+  {
+    if (parents->is_empty()) {
+      return -1;
+    }
+
+    update_parents ();
+
+    const auto& child = vertices_[child_idx];
+    unsigned links_to_child = 0;
+    unsigned last_parent = parents->get_max();
+    unsigned first_parent = parents->get_min();
+    for (unsigned parent_idx : *parents) {
+      links_to_child += child.incoming_edges_from_parent(parent_idx);
+    }
+
+    if (child.incoming_edges () <= links_to_child)
+    {
+      // Can't duplicate this node, doing so would orphan the original one as all remaining links
+      // to child are from parent.
+      DEBUG_MSG (SUBSET_REPACK, nullptr, "  Not duplicating %u, ..., %u => %u", first_parent, last_parent, child_idx);
+      return -1;
+    }
+
+    DEBUG_MSG (SUBSET_REPACK, nullptr, "  Duplicating %u, ..., %u => %u", first_parent, last_parent, child_idx);
+
+    unsigned clone_idx = duplicate (child_idx);
+    if (clone_idx == (unsigned) -1) return false;
+
+    for (unsigned parent_idx : *parents) {
+      // duplicate shifts the root node idx, so if parent_idx was root update it.
+      if (parent_idx == clone_idx) parent_idx++;
+      auto& parent = vertices_[parent_idx];
+      for (auto& l : parent.obj.all_links_writer ())
+      {
+        if (l.objidx != child_idx)
+          continue;
+
+        reassign_link (l, parent_idx, clone_idx);
+      }
+    }
+
+    return clone_idx;
+  }
+
 
   /*
    * Adds a new node to the graph, not connected to anything.
@@ -1370,6 +1453,7 @@ struct graph_t
     vertices_.tail ().distance = 0;
 
     hb_priority_queue_t queue;
+    queue.alloc (count);
     queue.insert (0, vertices_.length - 1);
 
     hb_vector_t visited;
diff --git a/src/java.desktop/share/native/libharfbuzz/graph/gsubgpos-graph.hh b/src/java.desktop/share/native/libharfbuzz/graph/gsubgpos-graph.hh
index a5f9223e6059..7ad2ba430b71 100644
--- a/src/java.desktop/share/native/libharfbuzz/graph/gsubgpos-graph.hh
+++ b/src/java.desktop/share/native/libharfbuzz/graph/gsubgpos-graph.hh
@@ -76,6 +76,7 @@ struct Lookup : public OT::Lookup
   {
     int64_t vertex_len = vertex.obj.tail - vertex.obj.head;
     if (vertex_len < OT::Lookup::min_size) return false;
+    hb_barrier ();
     return vertex_len >= this->get_size ();
   }
 
@@ -351,6 +352,7 @@ struct LookupList : public OT::LookupList
   {
     int64_t vertex_len = vertex.obj.tail - vertex.obj.head;
     if (vertex_len < OT::LookupList::min_size) return false;
+    hb_barrier ();
     return vertex_len >= OT::LookupList::item_size * this->len;
   }
 };
@@ -364,6 +366,7 @@ struct GSTAR : public OT::GSUBGPOS
     GSTAR* gstar = (GSTAR*) r.obj.head;
     if (!gstar || !gstar->sanitize (r))
       return nullptr;
+    hb_barrier ();
 
     return gstar;
   }
@@ -383,6 +386,7 @@ struct GSTAR : public OT::GSUBGPOS
   {
     int64_t len = vertex.obj.tail - vertex.obj.head;
     if (len < OT::GSUBGPOS::min_size) return false;
+    hb_barrier ();
     return len >= get_size ();
   }
 
diff --git a/src/java.desktop/share/native/libharfbuzz/graph/markbasepos-graph.hh b/src/java.desktop/share/native/libharfbuzz/graph/markbasepos-graph.hh
index ae5ebd0d1675..fb4166128a95 100644
--- a/src/java.desktop/share/native/libharfbuzz/graph/markbasepos-graph.hh
+++ b/src/java.desktop/share/native/libharfbuzz/graph/markbasepos-graph.hh
@@ -40,6 +40,7 @@ struct AnchorMatrix : public OT::Layout::GPOS_impl::AnchorMatrix
   {
     int64_t vertex_len = vertex.obj.tail - vertex.obj.head;
     if (vertex_len < AnchorMatrix::min_size) return false;
+    hb_barrier ();
 
     return vertex_len >= AnchorMatrix::min_size +
         OT::Offset16::static_size * class_count * this->rows;
@@ -128,6 +129,7 @@ struct MarkArray : public OT::Layout::GPOS_impl::MarkArray
     int64_t vertex_len = vertex.obj.tail - vertex.obj.head;
     unsigned min_size = MarkArray::min_size;
     if (vertex_len < min_size) return false;
+    hb_barrier ();
 
     return vertex_len >= get_size ();
   }
@@ -495,6 +497,7 @@ struct MarkBasePos : public OT::Layout::GPOS_impl::MarkBasePos
   {
     int64_t vertex_len = vertex.obj.tail - vertex.obj.head;
     if (vertex_len < u.format.get_size ()) return false;
+    hb_barrier ();
 
     switch (u.format) {
     case 1:
diff --git a/src/java.desktop/share/native/libharfbuzz/graph/pairpos-graph.hh b/src/java.desktop/share/native/libharfbuzz/graph/pairpos-graph.hh
index ad158cc9e8fa..fd46861de462 100644
--- a/src/java.desktop/share/native/libharfbuzz/graph/pairpos-graph.hh
+++ b/src/java.desktop/share/native/libharfbuzz/graph/pairpos-graph.hh
@@ -42,6 +42,7 @@ struct PairPosFormat1 : public OT::Layout::GPOS_impl::PairPosFormat1_3::min_size;
     if (vertex_len < min_size) return false;
+    hb_barrier ();
 
     return vertex_len >=
         min_size + pairSet.get_size () - pairSet.len.get_size();
@@ -198,6 +199,7 @@ struct PairPosFormat2 : public OT::Layout::GPOS_impl::PairPosFormat2_4::min_size;
     if (vertex_len < min_size) return false;
+    hb_barrier ();
 
     const unsigned class1_count = class1Count;
     return vertex_len >=
@@ -245,8 +247,8 @@ struct PairPosFormat2 : public OT::Layout::GPOS_impl::PairPosFormat2_4check_struct (this) &&
+                          hb_barrier () &&
                           version == 0 &&
                           c->check_range (this, anchorData) &&
                           lookupTable.sanitize (c, this, &(this+anchorData))));
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-aat-layout-bsln-table.hh b/src/java.desktop/share/native/libharfbuzz/hb-aat-layout-bsln-table.hh
index 24d53e224c78..b14540f3a714 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-aat-layout-bsln-table.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-aat-layout-bsln-table.hh
@@ -123,6 +123,7 @@ struct bsln
     TRACE_SANITIZE (this);
     if (unlikely (!(c->check_struct (this) && defaultBaseline < 32)))
       return_trace (false);
+    hb_barrier ();
 
     switch (format)
     {
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-aat-layout-common.hh b/src/java.desktop/share/native/libharfbuzz/hb-aat-layout-common.hh
index b2d1b7b67e0c..673c7fbe9454 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-aat-layout-common.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-aat-layout-common.hh
@@ -30,6 +30,10 @@
 #include "hb-aat-layout.hh"
 #include "hb-aat-map.hh"
 #include "hb-open-type.hh"
+#include "hb-cache.hh"
+#include "hb-bit-set.hh"
+#include "hb-bit-page.hh"
+
 
 namespace OT {
 struct GDEF;
@@ -39,15 +43,18 @@ namespace AAT {
 
 using namespace OT;
 
-
 struct ankr;
 
+using hb_aat_class_cache_t = hb_cache_t<15, 8, 7>;
+static_assert (sizeof (hb_aat_class_cache_t) == 256, "");
+
 struct hb_aat_apply_context_t :
        hb_dispatch_context_t
 {
   const char *get_name () { return "APPLY"; }
-  template 
-  return_t dispatch (const T &obj) { return obj.apply (this); }
+  template 
+  return_t dispatch (const T &obj, Ts&&... ds)
+  { return obj.apply (this, std::forward (ds)...); }
   static return_t default_return_value () { return false; }
   bool stop_sublookup_iteration (return_t r) const { return r; }
 
@@ -59,6 +66,12 @@ struct hb_aat_apply_context_t :
   const ankr *ankr_table;
   const OT::GDEF *gdef_table;
   const hb_sorted_vector_t *range_flags = nullptr;
+  bool using_buffer_glyph_set = false;
+  hb_bit_set_t buffer_glyph_set;
+  const hb_bit_set_t *left_set = nullptr;
+  const hb_bit_set_t *right_set = nullptr;
+  const hb_bit_set_t *machine_glyph_set = nullptr;
+  hb_aat_class_cache_t *machine_class_cache = nullptr;
   hb_mask_t subtable_flags = 0;
 
   /* Unused. For debug tracing only. */
@@ -74,6 +87,25 @@ struct hb_aat_apply_context_t :
   HB_INTERNAL void set_ankr_table (const AAT::ankr *ankr_table_);
 
   void set_lookup_index (unsigned int i) { lookup_index = i; }
+
+  void setup_buffer_glyph_set ()
+  {
+    using_buffer_glyph_set = buffer->len >= 4;
+
+    if (using_buffer_glyph_set)
+      buffer->collect_codepoints (buffer_glyph_set);
+  }
+  bool buffer_intersects_machine () const
+  {
+    if (using_buffer_glyph_set)
+      return buffer_glyph_set.intersects (*machine_glyph_set);
+
+    // Faster for shorter buffers.
+    for (unsigned i = 0; i < buffer->len; i++)
+      if (machine_glyph_set->has (buffer->info[i].codepoint))
+        return true;
+    return false;
+  }
 };
 
 
@@ -81,6 +113,8 @@ struct hb_aat_apply_context_t :
  * Lookup Table
  */
 
+enum { DELETED_GLYPH = 0xFFFF };
+
 template  struct Lookup;
 
 template 
@@ -95,6 +129,19 @@ struct LookupFormat0
     return &arrayZ[glyph_id];
   }
 
+  template 
+  void collect_glyphs (set_t &glyphs, unsigned num_glyphs) const
+  {
+    glyphs.add_range (0, num_glyphs - 1);
+  }
+  template 
+  void collect_glyphs_filtered (set_t &glyphs, unsigned num_glyphs, const filter_t &filter) const
+  {
+    for (unsigned i = 0; i < num_glyphs; i++)
+      if (filter (arrayZ[i]))
+        glyphs.add (i);
+  }
+
   bool sanitize (hb_sanitize_context_t *c) const
   {
     TRACE_SANITIZE (this);
@@ -123,6 +170,19 @@ struct LookupSegmentSingle
   int cmp (hb_codepoint_t g) const
   { return g < first ? -1 : g <= last ? 0 : +1 ; }
 
+  template 
+  void collect_glyphs (set_t &glyphs) const
+  {
+    if (first == DELETED_GLYPH) return;
+    glyphs.add_range (first, last);
+  }
+  template 
+  void collect_glyphs_filtered (set_t &glyphs, const filter_t &filter) const
+  {
+    if (!filter (value)) return;
+    glyphs.add_range (first, last);
+  }
+
   bool sanitize (hb_sanitize_context_t *c) const
   {
     TRACE_SANITIZE (this);
@@ -153,6 +213,21 @@ struct LookupFormat2
     return v ? &v->value : nullptr;
   }
 
+  template 
+  void collect_glyphs (set_t &glyphs) const
+  {
+    unsigned count = segments.get_length ();
+    for (unsigned int i = 0; i < count; i++)
+      segments[i].collect_glyphs (glyphs);
+  }
+  template 
+  void collect_glyphs_filtered (set_t &glyphs, const filter_t &filter) const
+  {
+    unsigned count = segments.get_length ();
+    for (unsigned int i = 0; i < count; i++)
+      segments[i].collect_glyphs_filtered (glyphs, filter);
+  }
+
   bool sanitize (hb_sanitize_context_t *c) const
   {
     TRACE_SANITIZE (this);
@@ -184,6 +259,21 @@ struct LookupSegmentArray
     return first <= glyph_id && glyph_id <= last ? &(base+valuesZ)[glyph_id - first] : nullptr;
   }
 
+  template 
+  void collect_glyphs (set_t &glyphs) const
+  {
+    if (first == DELETED_GLYPH) return;
+    glyphs.add_range (first, last);
+  }
+  template 
+  void collect_glyphs_filtered (set_t &glyphs, const void *base, const filter_t &filter) const
+  {
+    const auto &values = base+valuesZ;
+    for (hb_codepoint_t i = first; i <= last; i++)
+      if (filter (values[i - first]))
+        glyphs.add (i);
+  }
+
   int cmp (hb_codepoint_t g) const
   { return g < first ? -1 : g <= last ? 0 : +1; }
 
@@ -191,6 +281,7 @@ struct LookupSegmentArray
   {
     TRACE_SANITIZE (this);
     return_trace (c->check_struct (this) &&
+                  hb_barrier () &&
                   first <= last &&
                   valuesZ.sanitize (c, base, last - first + 1));
   }
@@ -199,6 +290,7 @@ struct LookupSegmentArray
   {
     TRACE_SANITIZE (this);
     return_trace (c->check_struct (this) &&
+                  hb_barrier () &&
                   first <= last &&
                   valuesZ.sanitize (c, base, last - first + 1, std::forward (ds)...));
   }
@@ -224,6 +316,21 @@ struct LookupFormat4
     return v ? v->get_value (glyph_id, this) : nullptr;
   }
 
+  template 
+  void collect_glyphs (set_t &glyphs) const
+  {
+    unsigned count = segments.get_length ();
+    for (unsigned i = 0; i < count; i++)
+      segments[i].collect_glyphs (glyphs);
+  }
+  template 
+  void collect_glyphs_filtered (set_t &glyphs, const filter_t &filter) const
+  {
+    unsigned count = segments.get_length ();
+    for (unsigned i = 0; i < count; i++)
+      segments[i].collect_glyphs_filtered (glyphs, this, filter);
+  }
+
   bool sanitize (hb_sanitize_context_t *c) const
   {
     TRACE_SANITIZE (this);
@@ -252,6 +359,19 @@ struct LookupSingle
 
   int cmp (hb_codepoint_t g) const { return glyph.cmp (g); }
 
+  template 
+  void collect_glyphs (set_t &glyphs) const
+  {
+    if (glyph == DELETED_GLYPH) return;
+    glyphs.add (glyph);
+  }
+  template 
+  void collect_glyphs_filtered (set_t &glyphs, const filter_t &filter) const
+  {
+    if (!filter (value)) return;
+    glyphs.add (glyph);
+  }
+
   bool sanitize (hb_sanitize_context_t *c) const
   {
     TRACE_SANITIZE (this);
@@ -281,6 +401,21 @@ struct LookupFormat6
     return v ? &v->value : nullptr;
   }
 
+  template 
+  void collect_glyphs (set_t &glyphs) const
+  {
+    unsigned count = entries.get_length ();
+    for (unsigned i = 0; i < count; i++)
+      entries[i].collect_glyphs (glyphs);
+  }
+  template 
+  void collect_glyphs_filtered (set_t &glyphs, const filter_t &filter) const
+  {
+    unsigned count = entries.get_length ();
+    for (unsigned i = 0; i < count; i++)
+      entries[i].collect_glyphs_filtered (glyphs, filter);
+  }
+
   bool sanitize (hb_sanitize_context_t *c) const
   {
     TRACE_SANITIZE (this);
@@ -312,6 +447,24 @@ struct LookupFormat8
            &valueArrayZ[glyph_id - firstGlyph] : nullptr;
   }
 
+  template 
+  void collect_glyphs (set_t &glyphs) const
+  {
+    if (unlikely (!glyphCount)) return;
+    if (firstGlyph == DELETED_GLYPH) return;
+    glyphs.add_range (firstGlyph, firstGlyph + glyphCount - 1);
+  }
+  template 
+  void collect_glyphs_filtered (set_t &glyphs, const filter_t &filter) const
+  {
+    if (unlikely (!glyphCount)) return;
+    if (firstGlyph == DELETED_GLYPH) return;
+    const T *p = valueArrayZ.arrayZ;
+    for (unsigned i = 0; i < glyphCount; i++)
+      if (filter (p[i]))
+        glyphs.add (firstGlyph + i);
+  }
+
   bool sanitize (hb_sanitize_context_t *c) const
   {
     TRACE_SANITIZE (this);
@@ -356,10 +509,19 @@ struct LookupFormat10
     return v;
   }
 
+  template 
+  void collect_glyphs (set_t &glyphs) const
+  {
+    if (unlikely (!glyphCount)) return;
+    if (firstGlyph == DELETED_GLYPH) return;
+    glyphs.add_range (firstGlyph, firstGlyph + glyphCount - 1);
+  }
+
   bool sanitize (hb_sanitize_context_t *c) const
   {
     TRACE_SANITIZE (this);
     return_trace (c->check_struct (this) &&
+                  hb_barrier () &&
                   valueSize <= 4 &&
                   valueArrayZ.sanitize (c, glyphCount * valueSize));
   }
@@ -383,11 +545,11 @@ struct Lookup
   const T* get_value (hb_codepoint_t glyph_id, unsigned int num_glyphs) const
   {
     switch (u.format) {
-    case 0: return u.format0.get_value (glyph_id, num_glyphs);
-    case 2: return u.format2.get_value (glyph_id);
-    case 4: return u.format4.get_value (glyph_id);
-    case 6: return u.format6.get_value (glyph_id);
-    case 8: return u.format8.get_value (glyph_id);
+    case 0: hb_barrier (); return u.format0.get_value (glyph_id, num_glyphs);
+    case 2: hb_barrier (); return u.format2.get_value (glyph_id);
+    case 4: hb_barrier (); return u.format4.get_value (glyph_id);
+    case 6: hb_barrier (); return u.format6.get_value (glyph_id);
+    case 8: hb_barrier (); return u.format8.get_value (glyph_id);
     default:return nullptr;
     }
   }
@@ -396,13 +558,39 @@ struct Lookup
   {
     switch (u.format) {
       /* Format 10 cannot return a pointer. */
-      case 10: return u.format10.get_value_or_null (glyph_id);
+      case 10: hb_barrier (); return u.format10.get_value_or_null (glyph_id);
       default:
       const T *v = get_value (glyph_id, num_glyphs);
       return v ? *v : Null (T);
     }
   }
 
+  template 
+  void collect_glyphs (set_t &glyphs, unsigned int num_glyphs) const
+  {
+    switch (u.format) {
+    case 0: hb_barrier (); u.format0.collect_glyphs (glyphs, num_glyphs); return;
+    case 2: hb_barrier (); u.format2.collect_glyphs (glyphs); return;
+    case 4: hb_barrier (); u.format4.collect_glyphs (glyphs); return;
+    case 6: hb_barrier (); u.format6.collect_glyphs (glyphs); return;
+    case 8: hb_barrier (); u.format8.collect_glyphs (glyphs); return;
+    case 10: hb_barrier (); u.format10.collect_glyphs (glyphs); return;
+    default:return;
+    }
+  }
+  template 
+  void collect_glyphs_filtered (set_t &glyphs, unsigned num_glyphs, const filter_t &filter) const
+  {
+    switch (u.format) {
+    case 0: hb_barrier (); u.format0.collect_glyphs_filtered (glyphs, num_glyphs, filter); return;
+    case 2: hb_barrier (); u.format2.collect_glyphs_filtered (glyphs, filter); return;
+    case 4: hb_barrier (); u.format4.collect_glyphs_filtered (glyphs, filter); return;
+    case 6: hb_barrier (); u.format6.collect_glyphs_filtered (glyphs, filter); return;
+    case 8: hb_barrier (); u.format8.collect_glyphs_filtered (glyphs, filter); return;
+    default:return;
+    }
+  }
+
   typename T::type get_class (hb_codepoint_t glyph_id,
                               unsigned int num_glyphs,
                               unsigned int outOfRange) const
@@ -415,13 +603,14 @@ struct Lookup
   {
     TRACE_SANITIZE (this);
     if (!u.format.sanitize (c)) return_trace (false);
+    hb_barrier ();
     switch (u.format) {
-    case 0: return_trace (u.format0.sanitize (c));
-    case 2: return_trace (u.format2.sanitize (c));
-    case 4: return_trace (u.format4.sanitize (c));
-    case 6: return_trace (u.format6.sanitize (c));
-    case 8: return_trace (u.format8.sanitize (c));
-    case 10: return_trace (u.format10.sanitize (c));
+    case 0: hb_barrier (); return_trace (u.format0.sanitize (c));
+    case 2: hb_barrier (); return_trace (u.format2.sanitize (c));
+    case 4: hb_barrier (); return_trace (u.format4.sanitize (c));
+    case 6: hb_barrier (); return_trace (u.format6.sanitize (c));
+    case 8: hb_barrier (); return_trace (u.format8.sanitize (c));
+    case 10: hb_barrier (); return_trace (u.format10.sanitize (c));
     default:return_trace (true);
     }
   }
@@ -429,12 +618,13 @@ struct Lookup
   {
     TRACE_SANITIZE (this);
     if (!u.format.sanitize (c)) return_trace (false);
+    hb_barrier ();
     switch (u.format) {
-    case 0: return_trace (u.format0.sanitize (c, base));
-    case 2: return_trace (u.format2.sanitize (c, base));
-    case 4: return_trace (u.format4.sanitize (c, base));
-    case 6: return_trace (u.format6.sanitize (c, base));
-    case 8: return_trace (u.format8.sanitize (c, base));
+    case 0: hb_barrier (); return_trace (u.format0.sanitize (c, base));
+    case 2: hb_barrier (); return_trace (u.format2.sanitize (c, base));
+    case 4: hb_barrier (); return_trace (u.format4.sanitize (c, base));
+    case 6: hb_barrier (); return_trace (u.format6.sanitize (c, base));
+    case 8: hb_barrier (); return_trace (u.format8.sanitize (c, base));
     case 10: return_trace (false); /* We don't support format10 here currently. */
     default:return_trace (true);
     }
@@ -455,8 +645,6 @@ struct Lookup
 };
 DECLARE_NULL_NAMESPACE_BYTES_TEMPLATE1 (AAT, Lookup, 2);
 
-enum { DELETED_GLYPH = 0xFFFF };
-
 /*
  * (Extended) State Table
  */
@@ -464,7 +652,7 @@ enum { DELETED_GLYPH = 0xFFFF };
 template 
 struct Entry
 {
-  // This does seem like it's ever called.
+  // This doesn't seem like it's ever called.
   bool sanitize (hb_sanitize_context_t *c) const
   {
     TRACE_SANITIZE (this);
@@ -507,6 +695,14 @@ struct Entry
   DEFINE_SIZE_STATIC (4);
 };
 
+enum Class
+{
+  CLASS_END_OF_TEXT = 0,
+  CLASS_OUT_OF_BOUNDS = 1,
+  CLASS_DELETED_GLYPH = 2,
+  CLASS_END_OF_LINE = 3,
+};
+
 template 
 struct StateTable
 {
@@ -519,21 +715,53 @@ struct StateTable
     STATE_START_OF_TEXT = 0,
     STATE_START_OF_LINE = 1,
   };
-  enum Class
+
+  template 
+  void collect_glyphs (set_t &glyphs, unsigned num_glyphs) const
   {
-    CLASS_END_OF_TEXT = 0,
-    CLASS_OUT_OF_BOUNDS = 1,
-    CLASS_DELETED_GLYPH = 2,
-    CLASS_END_OF_LINE = 3,
-  };
+    (this+classTable).collect_glyphs (glyphs, num_glyphs);
+  }
+  template 
+  void collect_initial_glyphs (set_t &glyphs, unsigned num_glyphs, const table_t &table) const
+  {
+    unsigned num_classes = nClasses;
+
+    if (unlikely (num_classes > hb_bit_page_t::BITS))
+    {
+      (this+classTable).collect_glyphs (glyphs, num_glyphs);
+      return;
+    }
+
+    // Collect all classes going out from the start state.
+    hb_bit_page_t filter;
+
+    for (unsigned i = 0; i < num_classes; i++)
+    {
+      const auto &entry = get_entry (STATE_START_OF_TEXT, i);
+      if (new_state (entry.newState) == STATE_START_OF_TEXT &&
+          !table.is_action_initiable (entry) && !table.is_actionable (entry))
+        continue;
+
+      filter.add (i);
+    }
+
+    // And glyphs in those classes.
+    (this+classTable).collect_glyphs_filtered (glyphs, num_glyphs, filter);
+  }
 
   int new_state (unsigned int newState) const
   { return Types::extended ? newState : ((int) newState - (int) stateArrayTable) / (int) nClasses; }
 
-  unsigned int get_class (hb_codepoint_t glyph_id, unsigned int num_glyphs) const
+  unsigned int get_class (hb_codepoint_t glyph_id,
+                          unsigned int num_glyphs,
+                          hb_aat_class_cache_t *cache = nullptr) const
   {
+    unsigned klass;
+    if (cache && cache->get (glyph_id, &klass)) return klass;
     if (unlikely (glyph_id == DELETED_GLYPH)) return CLASS_DELETED_GLYPH;
-    return (this+classTable).get_class (glyph_id, num_glyphs, 1);
+    klass = (this+classTable).get_class (glyph_id, num_glyphs, CLASS_OUT_OF_BOUNDS);
+    if (cache) cache->set (glyph_id, klass);
+    return klass;
   }
 
   const Entry *get_entries () const
@@ -541,13 +769,14 @@ struct StateTable
 
   const Entry &get_entry (int state, unsigned int klass) const
   {
-    if (unlikely (klass >= nClasses))
-      klass = StateTable::CLASS_OUT_OF_BOUNDS;
+    unsigned n_classes = nClasses;
+    if (unlikely (klass >= n_classes))
+      klass = CLASS_OUT_OF_BOUNDS;
 
     const HBUSHORT *states = (this+stateArrayTable).arrayZ;
     const Entry *entries = (this+entryTable).arrayZ;
 
-    unsigned int entry = states[state * nClasses + klass];
+    unsigned int entry = states[state * n_classes + klass];
     DEBUG_MSG (APPLY, nullptr, "e%u", entry);
 
     return entries[entry];
@@ -558,6 +787,7 @@ struct StateTable
   {
     TRACE_SANITIZE (this);
     if (unlikely (!(c->check_struct (this) &&
+                    hb_barrier () &&
                     nClasses >= 4 /* Ensure pre-defined classes fit.  */ &&
                     classTable.sanitize (c, this)))) return_trace (false);
 
@@ -684,6 +914,22 @@ struct ClassTable
   {
     return get_class (glyph_id, outOfRange);
   }
+
+  template 
+  void collect_glyphs (set_t &glyphs, unsigned num_glyphs) const
+  {
+    for (unsigned i = 0; i < classArray.len; i++)
+      if (classArray.arrayZ[i] != CLASS_OUT_OF_BOUNDS)
+        glyphs.add (firstGlyph + i);
+  }
+  template 
+  void collect_glyphs_filtered (set_t &glyphs, unsigned num_glyphs, const filter_t &filter) const
+  {
+    for (unsigned i = 0; i < classArray.len; i++)
+      if (filter (classArray.arrayZ[i]))
+        glyphs.add (firstGlyph + i);
+  }
+
   bool sanitize (hb_sanitize_context_t *c) const
   {
     TRACE_SANITIZE (this);
@@ -697,6 +943,38 @@ struct ClassTable
   DEFINE_SIZE_ARRAY (4, classArray);
 };
 
+struct SubtableGlyphCoverage
+{
+  bool sanitize (hb_sanitize_context_t *c, unsigned subtable_count) const
+  {
+    TRACE_SANITIZE (this);
+
+    if (unlikely (!c->check_array (&subtableOffsets, subtable_count)))
+      return_trace (false);
+
+    unsigned bytes = (c->get_num_glyphs () + CHAR_BIT - 1) / CHAR_BIT;
+    for (unsigned i = 0; i < subtable_count; i++)
+    {
+      uint32_t offset = (uint32_t) subtableOffsets[i];
+      if (offset == 0 || offset == 0xFFFFFFFF)
+        continue;
+      if (unlikely (!subtableOffsets[i].sanitize (c, this, bytes)))
+        return_trace (false);
+    }
+
+    return_trace (true);
+  }
+  protected:
+  UnsizedArrayOf>> subtableOffsets;
+                                            /* Array of offsets from the beginning of the
+                                             * subtable glyph coverage table to the glyph
+                                             * coverage bitfield for a given subtable; there
+                                             * is one offset for each subtable in the chain */
+  /* UnsizedArrayOf coverageBitfields; *//* The individual coverage bitfields. */
+  public:
+  DEFINE_SIZE_ARRAY (0, subtableOffsets);
+};
+
 struct ObsoleteTypes
 {
   static constexpr bool extended = false;
@@ -766,22 +1044,22 @@ struct ExtendedTypes
   }
 };
 
-template 
+template 
 struct StateTableDriver
 {
   using StateTableT = StateTable;
   using EntryT = Entry;
 
   StateTableDriver (const StateTableT &machine_,
-                    hb_buffer_t *buffer_,
                     hb_face_t *face_) :
               machine (machine_),
-              buffer (buffer_),
               num_glyphs (face_->get_num_glyphs ()) {}
 
   template 
   void drive (context_t *c, hb_aat_apply_context_t *ac)
   {
+    hb_buffer_t *buffer = ac->buffer;
+
     if (!c->in_place)
       buffer->clear_output ();
 
@@ -816,9 +1094,9 @@ struct StateTableDriver
         }
       }
 
-      unsigned int klass = buffer->idx < buffer->len ?
-                           machine.get_class (buffer->cur().codepoint, num_glyphs) :
-                           (unsigned) StateTableT::CLASS_END_OF_TEXT;
+      unsigned int klass = likely (buffer->idx < buffer->len) ?
+                           machine.get_class (buffer->cur().codepoint, num_glyphs, ac->machine_class_cache) :
+                           (unsigned) CLASS_END_OF_TEXT;
       DEBUG_MSG (APPLY, nullptr, "c%u at %u", klass, buffer->idx);
       const EntryT &entry = machine.get_entry (state, klass);
       const int next_state = machine.new_state (entry.newState);
@@ -851,44 +1129,39 @@ struct StateTableDriver
        *
        *   https://github.com/harfbuzz/harfbuzz/issues/2860
        */
-
-      const auto is_safe_to_break_extra = [&]()
-      {
-          /* 2c. */
-          const auto wouldbe_entry = machine.get_entry(StateTableT::STATE_START_OF_TEXT, klass);
-
-          /* 2c'. */
-          if (c->is_actionable (this, wouldbe_entry))
-              return false;
-
-          /* 2c". */
-          return next_state == machine.new_state(wouldbe_entry.newState)
-              && (entry.flags & context_t::DontAdvance) == (wouldbe_entry.flags & context_t::DontAdvance);
-      };
-
-      const auto is_safe_to_break = [&]()
-      {
+      const EntryT *wouldbe_entry;
+      bool is_safe_to_break =
+      (
           /* 1. */
-          if (c->is_actionable (this, entry))
-              return false;
+          !c->table->is_actionable (entry) &&
 
           /* 2. */
           // This one is meh, I know...
-          const auto ok =
+          (
                  state == StateTableT::STATE_START_OF_TEXT
-              || ((entry.flags & context_t::DontAdvance) && next_state == StateTableT::STATE_START_OF_TEXT)
-              || is_safe_to_break_extra();
-          if (!ok)
-              return false;
+              || ((entry.flags & Flags::DontAdvance) && next_state == StateTableT::STATE_START_OF_TEXT)
+              || (
+                    /* 2c. */
+                    wouldbe_entry = &machine.get_entry(StateTableT::STATE_START_OF_TEXT, klass)
+                    ,
+                    /* 2c'. */
+                    !c->table->is_actionable (*wouldbe_entry) &&
+                    /* 2c". */
+                    (
+                      next_state == machine.new_state(wouldbe_entry->newState) &&
+                      (entry.flags & Flags::DontAdvance) == (wouldbe_entry->flags & Flags::DontAdvance)
+                    )
+                 )
+          ) &&
 
           /* 3. */
-          return !c->is_actionable (this, machine.get_entry (state, StateTableT::CLASS_END_OF_TEXT));
-      };
+          !c->table->is_actionable (machine.get_entry (state, CLASS_END_OF_TEXT))
+      );
 
-      if (!is_safe_to_break () && buffer->backtrack_len () && buffer->idx < buffer->len)
+      if (!is_safe_to_break && buffer->backtrack_len () && buffer->idx < buffer->len)
         buffer->unsafe_to_break_from_outbuffer (buffer->backtrack_len () - 1, buffer->idx + 1);
 
-      c->transition (this, entry);
+      c->transition (buffer, this, entry);
 
       state = next_state;
       DEBUG_MSG (APPLY, nullptr, "s%d", state);
@@ -896,7 +1169,7 @@ struct StateTableDriver
       if (buffer->idx == buffer->len || unlikely (!buffer->successful))
         break;
 
-      if (!(entry.flags & context_t::DontAdvance) || buffer->max_ops-- <= 0)
+      if (!(entry.flags & Flags::DontAdvance) || buffer->max_ops-- <= 0)
         (void) buffer->next_glyph ();
     }
 
@@ -906,7 +1179,6 @@ struct StateTableDriver
 
   public:
   const StateTableT &machine;
-  hb_buffer_t *buffer;
   unsigned int num_glyphs;
 };
 
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-aat-layout-feat-table.hh b/src/java.desktop/share/native/libharfbuzz/hb-aat-layout-feat-table.hh
index 04260a946168..7b68a932c3f1 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-aat-layout-feat-table.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-aat-layout-feat-table.hh
@@ -138,6 +138,7 @@ struct FeatureName
   {
     TRACE_SANITIZE (this);
     return_trace (likely (c->check_struct (this) &&
+                          hb_barrier () &&
                           (base+settingTableZ).sanitize (c, nSettings)));
   }
 
@@ -200,6 +201,7 @@ struct feat
   {
     TRACE_SANITIZE (this);
     return_trace (likely (c->check_struct (this) &&
+                          hb_barrier () &&
                           version.major == 1 &&
                           namesZ.sanitize (c, featureNameCount, this)));
   }
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-aat-layout-just-table.hh b/src/java.desktop/share/native/libharfbuzz/hb-aat-layout-just-table.hh
index 0588310b53b7..193d14d94d07 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-aat-layout-just-table.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-aat-layout-just-table.hh
@@ -185,15 +185,16 @@ struct ActionSubrecord
     TRACE_SANITIZE (this);
     if (unlikely (!c->check_struct (this)))
       return_trace (false);
+    hb_barrier ();
 
     switch (u.header.actionType)
     {
-    case 0:  return_trace (u.decompositionAction.sanitize (c));
-    case 1:  return_trace (u.unconditionalAddGlyphAction.sanitize (c));
-    case 2:  return_trace (u.conditionalAddGlyphAction.sanitize (c));
-    // case 3: return_trace (u.stretchGlyphAction.sanitize (c));
-    case 4:  return_trace (u.decompositionAction.sanitize (c));
-    case 5:  return_trace (u.decompositionAction.sanitize (c));
+    case 0: hb_barrier ();  return_trace (u.decompositionAction.sanitize (c));
+    case 1: hb_barrier ();  return_trace (u.unconditionalAddGlyphAction.sanitize (c));
+    case 2: hb_barrier ();  return_trace (u.conditionalAddGlyphAction.sanitize (c));
+    // case 3: hb_barrier (); return_trace (u.stretchGlyphAction.sanitize (c));
+    case 4: hb_barrier ();  return_trace (u.decompositionAction.sanitize (c));
+    case 5: hb_barrier ();  return_trace (u.decompositionAction.sanitize (c));
     default: return_trace (true);
     }
   }
@@ -220,6 +221,7 @@ struct PostcompensationActionChain
     TRACE_SANITIZE (this);
     if (unlikely (!c->check_struct (this)))
       return_trace (false);
+    hb_barrier ();
 
     unsigned int offset = min_size;
     for (unsigned int i = 0; i < count; i++)
@@ -389,6 +391,7 @@ struct just
     TRACE_SANITIZE (this);
 
     return_trace (likely (c->check_struct (this) &&
+                          hb_barrier () &&
                           version.major == 1 &&
                           horizData.sanitize (c, this, this) &&
                           vertData.sanitize (c, this, this)));
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-aat-layout-kerx-table.hh b/src/java.desktop/share/native/libharfbuzz/hb-aat-layout-kerx-table.hh
index 2bc7b03ce896..a091b05660c5 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-aat-layout-kerx-table.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-aat-layout-kerx-table.hh
@@ -30,6 +30,7 @@
 
 #include "hb-kern.hh"
 #include "hb-aat-layout-ankr-table.hh"
+#include "hb-set-digest.hh"
 
 /*
  * kerx -- Extended Kerning
@@ -54,6 +55,7 @@ kerxTupleKern (int value,
   unsigned int offset = value;
   const FWORD *pv = &StructAtOffset (base, offset);
   if (unlikely (!c->sanitizer.check_array (pv, tupleCount))) return 0;
+  hb_barrier ();
   return *pv;
 }
 
@@ -81,7 +83,7 @@ struct KernPair
     return_trace (c->check_struct (this));
   }
 
-  protected:
+  public:
   HBGlyphID16   left;
   HBGlyphID16   right;
   FWORD         value;
@@ -105,10 +107,10 @@ struct KerxSubTableFormat0
     TRACE_APPLY (this);
 
     if (!c->plan->requested_kerning)
-      return false;
+      return_trace (false);
 
     if (header.coverage & header.Backwards)
-      return false;
+      return_trace (false);
 
     accelerator_t accel (*this, c);
     hb_kern_machine_t machine (accel, header.coverage & header.CrossStream);
@@ -117,6 +119,16 @@ struct KerxSubTableFormat0
     return_trace (true);
   }
 
+  template 
+  void collect_glyphs (set_t &left_set, set_t &right_set, unsigned num_glyphs) const
+  {
+    for (const KernPair& pair : pairs)
+    {
+      left_set.add (pair.left);
+      right_set.add (pair.right);
+    }
+  }
+
   struct accelerator_t
   {
     const KerxSubTableFormat0 &table;
@@ -127,7 +139,10 @@ struct KerxSubTableFormat0
                      table (table_), c (c_) {}
 
     int get_kerning (hb_codepoint_t left, hb_codepoint_t right) const
-    { return table.get_kerning (left, right, c); }
+    {
+      if (!(*c->left_set)[left] || !(*c->right_set)[right]) return 0;
+      return table.get_kerning (left, right, c);
+    }
   };
 
 
@@ -192,6 +207,9 @@ struct Format1Entry
 
   typedef void EntryData;
 
+  static bool initiateAction (const Entry &entry)
+  { return entry.flags & Push; }
+
   static bool performAction (const Entry &entry)
   { return entry.flags & Offset; }
 
@@ -208,13 +226,23 @@ struct KerxSubTableFormat1
   typedef Format1Entry Format1EntryT;
   typedef typename Format1EntryT::EntryData EntryData;
 
+  enum Flags
+  {
+    DontAdvance = Format1EntryT::DontAdvance,
+  };
+
+  bool is_action_initiable (const Entry &entry) const
+  {
+    return Format1EntryT::initiateAction (entry);
+  }
+  bool is_actionable (const Entry &entry) const
+  {
+    return Format1EntryT::performAction (entry);
+  }
+
   struct driver_context_t
   {
     static constexpr bool in_place = true;
-    enum
-    {
-      DontAdvance       = Format1EntryT::DontAdvance,
-    };
 
     driver_context_t (const KerxSubTableFormat1 *table_,
                       hb_aat_apply_context_t *c_) :
@@ -227,13 +255,10 @@ struct KerxSubTableFormat1
         depth (0),
         crossStream (table->header.coverage & table->header.CrossStream) {}
 
-    bool is_actionable (StateTableDriver *driver HB_UNUSED,
-                        const Entry &entry)
-    { return Format1EntryT::performAction (entry); }
-    void transition (StateTableDriver *driver,
+    void transition (hb_buffer_t *buffer,
+                     StateTableDriver *driver,
                      const Entry &entry)
     {
-      hb_buffer_t *buffer = driver->buffer;
       unsigned int flags = entry.flags;
 
       if (flags & Format1EntryT::Reset)
@@ -259,6 +284,7 @@ struct KerxSubTableFormat1
           depth = 0;
           return;
         }
+        hb_barrier ();
 
         hb_mask_t kern_mask = c->plan->kern_mask;
 
@@ -330,9 +356,10 @@ struct KerxSubTableFormat1
       }
     }
 
-    private:
+    public:
     hb_aat_apply_context_t *c;
     const KerxSubTableFormat1 *table;
+    private:
     const UnsizedArrayOf &kernAction;
     unsigned int stack[8];
     unsigned int depth;
@@ -349,7 +376,8 @@ struct KerxSubTableFormat1
 
     driver_context_t dc (this, c);
 
-    StateTableDriver driver (machine, c->buffer, c->font->face);
+    StateTableDriver driver (machine, c->font->face);
+
     driver.drive (&dc, c);
 
     return_trace (true);
@@ -363,12 +391,21 @@ struct KerxSubTableFormat1
                           machine.sanitize (c)));
   }
 
+  template 
+  void collect_glyphs (set_t &left_set, set_t &right_set, unsigned num_glyphs) const
+  {
+    set_t set;
+    machine.collect_glyphs (set, num_glyphs);
+    left_set.union_ (set);
+    right_set.union_ (set);
+  }
+
   protected:
   KernSubTableHeader                            header;
   StateTable                  machine;
   NNOffsetTo, HBUINT>     kernAction;
   public:
-  DEFINE_SIZE_STATIC (KernSubTableHeader::static_size + 5 * sizeof (HBUINT));
+  DEFINE_SIZE_STATIC (KernSubTableHeader::static_size + (StateTable::static_size + HBUINT::static_size));
 };
 
 template 
@@ -389,6 +426,7 @@ struct KerxSubTableFormat2
     kern_idx = Types::offsetToIndex (kern_idx, this, arrayZ.arrayZ);
     const FWORD *v = &arrayZ[kern_idx];
     if (unlikely (!v->sanitize (&c->sanitizer))) return 0;
+    hb_barrier ();
 
     return kerxTupleKern (*v, header.tuple_count (), this, c);
   }
@@ -398,10 +436,10 @@ struct KerxSubTableFormat2
     TRACE_APPLY (this);
 
     if (!c->plan->requested_kerning)
-      return false;
+      return_trace (false);
 
     if (header.coverage & header.Backwards)
-      return false;
+      return_trace (false);
 
     accelerator_t accel (*this, c);
     hb_kern_machine_t machine (accel, header.coverage & header.CrossStream);
@@ -410,6 +448,13 @@ struct KerxSubTableFormat2
     return_trace (true);
   }
 
+  template 
+  void collect_glyphs (set_t &left_set, set_t &right_set, unsigned num_glyphs) const
+  {
+    (this+leftClassTable).collect_glyphs (left_set, num_glyphs);
+    (this+rightClassTable).collect_glyphs (right_set, num_glyphs);
+  }
+
   struct accelerator_t
   {
     const KerxSubTableFormat2 &table;
@@ -420,7 +465,10 @@ struct KerxSubTableFormat2
                      table (table_), c (c_) {}
 
     int get_kerning (hb_codepoint_t left, hb_codepoint_t right) const
-    { return table.get_kerning (left, right, c); }
+    {
+      if (!(*c->left_set)[left] || !(*c->right_set)[right]) return 0;
+      return table.get_kerning (left, right, c);
+    }
   };
 
   bool sanitize (hb_sanitize_context_t *c) const
@@ -429,6 +477,7 @@ struct KerxSubTableFormat2
     return_trace (likely (c->check_struct (this) &&
                           leftClassTable.sanitize (c, this) &&
                           rightClassTable.sanitize (c, this) &&
+                          hb_barrier () &&
                           c->check_range (this, array)));
   }
 
@@ -461,17 +510,26 @@ struct KerxSubTableFormat4
     DEFINE_SIZE_STATIC (2);
   };
 
-  struct driver_context_t
+  enum Flags
   {
-    static constexpr bool in_place = true;
-    enum Flags
-    {
-      Mark              = 0x8000,       /* If set, remember this glyph as the marked glyph. */
-      DontAdvance       = 0x4000,       /* If set, don't advance to the next glyph before
+    Mark                = 0x8000,       /* If set, remember this glyph as the marked glyph. */
+    DontAdvance         = 0x4000,       /* If set, don't advance to the next glyph before
                                          * going to the new state. */
-      Reserved          = 0x3FFF,       /* Not used; set to 0. */
-    };
+    Reserved            = 0x3FFF,       /* Not used; set to 0. */
+  };
+
+  bool is_action_initiable (const Entry &entry) const
+  {
+    return (entry.flags & Mark);
+  }
+  bool is_actionable (const Entry &entry) const
+  {
+    return entry.data.ankrActionIndex != 0xFFFF;
+  }
 
+  struct driver_context_t
+  {
+    static constexpr bool in_place = true;
     enum SubTableFlags
     {
       ActionType        = 0xC0000000,   /* A two-bit field containing the action type. */
@@ -481,22 +539,19 @@ struct KerxSubTableFormat4
                                          * point table. */
     };
 
-    driver_context_t (const KerxSubTableFormat4 *table,
+    driver_context_t (const KerxSubTableFormat4 *table_,
                       hb_aat_apply_context_t *c_) :
         c (c_),
+        table (table_),
         action_type ((table->flags & ActionType) >> 30),
         ankrData ((HBUINT16 *) ((const char *) &table->machine + (table->flags & Offset))),
         mark_set (false),
         mark (0) {}
 
-    bool is_actionable (StateTableDriver *driver HB_UNUSED,
-                        const Entry &entry)
-    { return entry.data.ankrActionIndex != 0xFFFF; }
-    void transition (StateTableDriver *driver,
+    void transition (hb_buffer_t *buffer,
+                     StateTableDriver *driver,
                      const Entry &entry)
     {
-      hb_buffer_t *buffer = driver->buffer;
-
       if (mark_set && entry.data.ankrActionIndex != 0xFFFF && buffer->idx < buffer->len)
       {
         hb_glyph_position_t &o = buffer->cur_pos();
@@ -509,6 +564,7 @@ struct KerxSubTableFormat4
                double the ankrActionIndex to get the correct offset here. */
             const HBUINT16 *data = &ankrData[entry.data.ankrActionIndex * 2];
             if (!c->sanitizer.check_array (data, 2)) return;
+            hb_barrier ();
             unsigned int markControlPoint = *data++;
             unsigned int currControlPoint = *data++;
             hb_position_t markX = 0;
@@ -537,6 +593,7 @@ struct KerxSubTableFormat4
                double the ankrActionIndex to get the correct offset here. */
             const HBUINT16 *data = &ankrData[entry.data.ankrActionIndex * 2];
             if (!c->sanitizer.check_array (data, 2)) return;
+            hb_barrier ();
             unsigned int markAnchorPoint = *data++;
             unsigned int currAnchorPoint = *data++;
             const Anchor &markAnchor = c->ankr_table->get_anchor (c->buffer->info[mark].codepoint,
@@ -557,6 +614,7 @@ struct KerxSubTableFormat4
                by 4 to get the correct offset for the given action. */
             const FWORD *data = (const FWORD *) &ankrData[entry.data.ankrActionIndex * 4];
             if (!c->sanitizer.check_array (data, 4)) return;
+            hb_barrier ();
             int markX = *data++;
             int markY = *data++;
             int currX = *data++;
@@ -579,8 +637,10 @@ struct KerxSubTableFormat4
       }
     }
 
-    private:
+    public:
     hb_aat_apply_context_t *c;
+    const KerxSubTableFormat4 *table;
+    private:
     unsigned int action_type;
     const HBUINT16 *ankrData;
     bool mark_set;
@@ -593,7 +653,8 @@ struct KerxSubTableFormat4
 
     driver_context_t dc (this, c);
 
-    StateTableDriver driver (machine, c->buffer, c->font->face);
+    StateTableDriver driver (machine, c->font->face);
+
     driver.drive (&dc, c);
 
     return_trace (true);
@@ -607,12 +668,21 @@ struct KerxSubTableFormat4
                           machine.sanitize (c)));
   }
 
+  template 
+  void collect_glyphs (set_t &left_set, set_t &right_set, unsigned num_glyphs) const
+  {
+    set_t set;
+    machine.collect_glyphs (set, num_glyphs);
+    left_set.union_ (set);
+    right_set.union_ (set);
+  }
+
   protected:
   KernSubTableHeader            header;
   StateTable  machine;
   HBUINT32                      flags;
   public:
-  DEFINE_SIZE_STATIC (KernSubTableHeader::static_size + 20);
+  DEFINE_SIZE_STATIC (KernSubTableHeader::static_size + (StateTable::static_size + HBUINT32::static_size));
 };
 
 template 
@@ -631,7 +701,7 @@ struct KerxSubTableFormat6
     unsigned int num_glyphs = c->sanitizer.get_num_glyphs ();
     if (is_long ())
     {
-      const typename U::Long &t = u.l;
+      const auto &t = u.l;
       unsigned int l = (this+t.rowIndexTable).get_value_or_null (left, num_glyphs);
       unsigned int r = (this+t.columnIndexTable).get_value_or_null (right, num_glyphs);
       unsigned int offset = l + r;
@@ -639,16 +709,18 @@ struct KerxSubTableFormat6
       if (unlikely (hb_unsigned_mul_overflows (offset, sizeof (FWORD32)))) return 0;
       const FWORD32 *v = &StructAtOffset (&(this+t.array), offset * sizeof (FWORD32));
       if (unlikely (!v->sanitize (&c->sanitizer))) return 0;
+      hb_barrier ();
       return kerxTupleKern (*v, header.tuple_count (), &(this+vector), c);
     }
     else
     {
-      const typename U::Short &t = u.s;
+      const auto &t = u.s;
       unsigned int l = (this+t.rowIndexTable).get_value_or_null (left, num_glyphs);
       unsigned int r = (this+t.columnIndexTable).get_value_or_null (right, num_glyphs);
       unsigned int offset = l + r;
       const FWORD *v = &StructAtOffset (&(this+t.array), offset * sizeof (FWORD));
       if (unlikely (!v->sanitize (&c->sanitizer))) return 0;
+      hb_barrier ();
       return kerxTupleKern (*v, header.tuple_count (), &(this+vector), c);
     }
   }
@@ -658,10 +730,10 @@ struct KerxSubTableFormat6
     TRACE_APPLY (this);
 
     if (!c->plan->requested_kerning)
-      return false;
+      return_trace (false);
 
     if (header.coverage & header.Backwards)
-      return false;
+      return_trace (false);
 
     accelerator_t accel (*this, c);
     hb_kern_machine_t machine (accel, header.coverage & header.CrossStream);
@@ -674,6 +746,7 @@ struct KerxSubTableFormat6
   {
     TRACE_SANITIZE (this);
     return_trace (likely (c->check_struct (this) &&
+                          hb_barrier () &&
                           (is_long () ?
                            (
                              u.l.rowIndexTable.sanitize (c, this) &&
@@ -688,6 +761,23 @@ struct KerxSubTableFormat6
                            c->check_range (this, vector))));
   }
 
+  template 
+  void collect_glyphs (set_t &left_set, set_t &right_set, unsigned num_glyphs) const
+  {
+    if (is_long ())
+    {
+      const auto &t = u.l;
+      (this+t.rowIndexTable).collect_glyphs (left_set, num_glyphs);
+      (this+t.columnIndexTable).collect_glyphs (right_set, num_glyphs);
+    }
+    else
+    {
+      const auto &t = u.s;
+      (this+t.rowIndexTable).collect_glyphs (left_set, num_glyphs);
+      (this+t.columnIndexTable).collect_glyphs (right_set, num_glyphs);
+    }
+  }
+
   struct accelerator_t
   {
     const KerxSubTableFormat6 &table;
@@ -698,7 +788,10 @@ struct KerxSubTableFormat6
                      table (table_), c (c_) {}
 
     int get_kerning (hb_codepoint_t left, hb_codepoint_t right) const
-    { return table.get_kerning (left, right, c); }
+    {
+      if (!(*c->left_set)[left] || !(*c->right_set)[right]) return 0;
+      return table.get_kerning (left, right, c);
+    }
   };
 
   protected:
@@ -784,12 +877,27 @@ struct KerxSubTable
     }
   }
 
+  template 
+  void collect_glyphs (set_t &left_set, set_t &right_set, unsigned num_glyphs) const
+  {
+    unsigned int subtable_type = get_type ();
+    switch (subtable_type) {
+    case 0:     u.format0.collect_glyphs (left_set, right_set, num_glyphs); return;
+    case 1:     u.format1.collect_glyphs (left_set, right_set, num_glyphs); return;
+    case 2:     u.format2.collect_glyphs (left_set, right_set, num_glyphs); return;
+    case 4:     u.format4.collect_glyphs (left_set, right_set, num_glyphs); return;
+    case 6:     u.format6.collect_glyphs (left_set, right_set, num_glyphs); return;
+    default:    return;
+    }
+  }
+
   bool sanitize (hb_sanitize_context_t *c) const
   {
     TRACE_SANITIZE (this);
-    if (!u.header.sanitize (c) ||
-        u.header.length <= u.header.static_size ||
-        !c->check_range (this, u.header.length))
+    if (!(u.header.sanitize (c) &&
+          hb_barrier () &&
+          u.header.length >= u.header.static_size &&
+          c->check_range (this, u.header.length)))
       return_trace (false);
 
     return_trace (dispatch (c));
@@ -813,6 +921,8 @@ struct KerxSubTable
  * The 'kerx' Table
  */
 
+using kern_accelerator_data_t = hb_vector_t>;
+
 template 
 struct KerxTable
 {
@@ -829,6 +939,9 @@ struct KerxTable
     {
       if (st->get_type () == 1)
         return true;
+
+      // TODO: What about format 4? What's this API used for anyway?
+
       st = &StructAfter (*st);
     }
     return false;
@@ -867,7 +980,8 @@ struct KerxTable
     return v;
   }
 
-  bool apply (AAT::hb_aat_apply_context_t *c) const
+  bool apply (AAT::hb_aat_apply_context_t *c,
+              const kern_accelerator_data_t &accel_data) const
   {
     c->buffer->unsafe_to_concat ();
 
@@ -914,6 +1028,9 @@ struct KerxTable
       if (reverse)
         c->buffer->reverse ();
 
+      c->left_set = &accel_data[i].first;
+      c->right_set = &accel_data[i].second;
+
       {
         /* See comment in sanitize() for conditional here. */
         hb_sanitize_with_object_t with (&c->sanitizer, i < count - 1 ? st : (const SubTable *) nullptr);
@@ -936,9 +1053,10 @@ struct KerxTable
   bool sanitize (hb_sanitize_context_t *c) const
   {
     TRACE_SANITIZE (this);
-    if (unlikely (!thiz()->version.sanitize (c) ||
-                  (unsigned) thiz()->version < (unsigned) T::minVersion ||
-                  !thiz()->tableCount.sanitize (c)))
+    if (unlikely (!(thiz()->version.sanitize (c) &&
+                    hb_barrier () &&
+                    (unsigned) thiz()->version >= (unsigned) T::minVersion &&
+                    thiz()->tableCount.sanitize (c))))
       return_trace (false);
 
     typedef typename T::SubTable SubTable;
@@ -949,6 +1067,7 @@ struct KerxTable
     {
       if (unlikely (!st->u.header.sanitize (c)))
         return_trace (false);
+      hb_barrier ();
       /* OpenType kern table has 2-byte subtable lengths.  That's limiting.
        * MS implementation also only supports one subtable, of format 0,
        * anyway.  Certain versions of some fonts, like Calibry, contain
@@ -964,8 +1083,61 @@ struct KerxTable
       st = &StructAfter (*st);
     }
 
+    unsigned majorVersion = thiz()->version;
+    if (sizeof (thiz()->version) == 4)
+      majorVersion = majorVersion >> 16;
+    if (majorVersion >= 3)
+    {
+      const SubtableGlyphCoverage *coverage = (const SubtableGlyphCoverage *) st;
+      if (!coverage->sanitize (c, count))
+        return_trace (false);
+    }
+
     return_trace (true);
   }
+
+  kern_accelerator_data_t create_accelerator_data (unsigned num_glyphs) const
+  {
+    kern_accelerator_data_t accel_data;
+
+    typedef typename T::SubTable SubTable;
+
+    const SubTable *st = &thiz()->firstSubTable;
+    unsigned int count = thiz()->tableCount;
+    for (unsigned int i = 0; i < count; i++)
+    {
+      hb_bit_set_t left_set, right_set;
+      st->collect_glyphs (left_set, right_set, num_glyphs);
+      accel_data.push (hb_pair (left_set, right_set));
+      st = &StructAfter (*st);
+    }
+
+    return accel_data;
+  }
+
+  struct accelerator_t
+  {
+    accelerator_t (hb_face_t *face)
+    {
+      hb_sanitize_context_t sc;
+      this->table = sc.reference_table (face);
+      this->accel_data = this->table->create_accelerator_data (face->get_num_glyphs ());
+    }
+    ~accelerator_t ()
+    {
+      this->table.destroy ();
+    }
+
+    hb_blob_t *get_blob () const { return table.get_blob (); }
+
+    bool apply (AAT::hb_aat_apply_context_t *c) const
+    {
+      return table->apply (c, accel_data);
+    }
+
+    hb_blob_ptr_t table;
+    kern_accelerator_data_t accel_data;
+  };
 };
 
 struct kerx : KerxTable
@@ -994,8 +1166,10 @@ struct kerx : KerxTable
   DEFINE_SIZE_MIN (8);
 };
 
+struct kerx_accelerator_t : kerx::accelerator_t {
+  kerx_accelerator_t (hb_face_t *face) : kerx::accelerator_t (face) {}
+};
 
 } /* namespace AAT */
 
-
 #endif /* HB_AAT_LAYOUT_KERX_TABLE_HH */
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-aat-layout-morx-table.hh b/src/java.desktop/share/native/libharfbuzz/hb-aat-layout-morx-table.hh
index 81e126d5eb11..cabdc0eb555a 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-aat-layout-morx-table.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-aat-layout-morx-table.hh
@@ -29,6 +29,7 @@
 
 #include "hb-open-type.hh"
 #include "hb-aat-layout-common.hh"
+#include "hb-ot-layout.hh"
 #include "hb-ot-layout-common.hh"
 #include "hb-ot-layout-gdef-table.hh"
 #include "hb-aat-map.hh"
@@ -53,36 +54,42 @@ struct RearrangementSubtable
 
   typedef void EntryData;
 
-  struct driver_context_t
+  enum Flags
   {
-    static constexpr bool in_place = true;
-    enum Flags
-    {
-      MarkFirst         = 0x8000,       /* If set, make the current glyph the first
+    MarkFirst           = 0x8000,       /* If set, make the current glyph the first
                                          * glyph to be rearranged. */
-      DontAdvance       = 0x4000,       /* If set, don't advance to the next glyph
+    DontAdvance         = 0x4000,       /* If set, don't advance to the next glyph
                                          * before going to the new state. This means
                                          * that the glyph index doesn't change, even
                                          * if the glyph at that index has changed. */
-      MarkLast          = 0x2000,       /* If set, make the current glyph the last
+    MarkLast            = 0x2000,       /* If set, make the current glyph the last
                                          * glyph to be rearranged. */
-      Reserved          = 0x1FF0,       /* These bits are reserved and should be set to 0. */
-      Verb              = 0x000F,       /* The type of rearrangement specified. */
-    };
+    Reserved            = 0x1FF0,       /* These bits are reserved and should be set to 0. */
+    Verb                = 0x000F,       /* The type of rearrangement specified. */
+  };
+
+  bool is_action_initiable (const Entry &entry) const
+  {
+    return (entry.flags & MarkFirst);
+  }
+  bool is_actionable (const Entry &entry) const
+  {
+    return (entry.flags & Verb);
+  }
+
+  struct driver_context_t
+  {
+    static constexpr bool in_place = true;
 
-    driver_context_t (const RearrangementSubtable *table HB_UNUSED) :
+    driver_context_t (const RearrangementSubtable *table_) :
         ret (false),
+        table (table_),
         start (0), end (0) {}
 
-    bool is_actionable (StateTableDriver *driver HB_UNUSED,
-                        const Entry &entry)
-    {
-      return (entry.flags & Verb) && start < end;
-    }
-    void transition (StateTableDriver *driver,
+    void transition (hb_buffer_t *buffer,
+                     StateTableDriver *driver,
                      const Entry &entry)
     {
-      hb_buffer_t *buffer = driver->buffer;
       unsigned int flags = entry.flags;
 
       if (flags & MarkFirst)
@@ -157,6 +164,7 @@ struct RearrangementSubtable
 
     public:
     bool ret;
+    const RearrangementSubtable *table;
     private:
     unsigned int start;
     unsigned int end;
@@ -168,7 +176,14 @@ struct RearrangementSubtable
 
     driver_context_t dc (this);
 
-    StateTableDriver driver (machine, c->buffer, c->face);
+    StateTableDriver driver (machine, c->face);
+
+    if (!c->buffer_intersects_machine ())
+    {
+      (void) c->buffer->message (c->font, "skipped chainsubtable because no glyph matches");
+      return_trace (false);
+    }
+
     driver.drive (&dc, c);
 
     return_trace (dc.ret);
@@ -180,10 +195,10 @@ struct RearrangementSubtable
     return_trace (machine.sanitize (c));
   }
 
-  protected:
+  public:
   StateTable  machine;
   public:
-  DEFINE_SIZE_STATIC (16);
+  DEFINE_SIZE_STATIC ((StateTable::static_size));
 };
 
 template 
@@ -201,43 +216,42 @@ struct ContextualSubtable
     DEFINE_SIZE_STATIC (4);
   };
 
+  enum Flags
+  {
+    SetMark             = 0x8000,       /* If set, make the current glyph the marked glyph. */
+    DontAdvance         = 0x4000,       /* If set, don't advance to the next glyph before
+                                         * going to the new state. */
+    Reserved            = 0x3FFF,       /* These bits are reserved and should be set to 0. */
+  };
+
+  bool is_action_initiable (const Entry &entry) const
+  {
+    return (entry.flags & SetMark);
+  }
+  bool is_actionable (const Entry &entry) const
+  {
+    return entry.data.markIndex != 0xFFFF || entry.data.currentIndex != 0xFFFF;
+  }
+
   struct driver_context_t
   {
     static constexpr bool in_place = true;
-    enum Flags
-    {
-      SetMark           = 0x8000,       /* If set, make the current glyph the marked glyph. */
-      DontAdvance       = 0x4000,       /* If set, don't advance to the next glyph before
-                                         * going to the new state. */
-      Reserved          = 0x3FFF,       /* These bits are reserved and should be set to 0. */
-    };
 
     driver_context_t (const ContextualSubtable *table_,
                              hb_aat_apply_context_t *c_) :
         ret (false),
         c (c_),
+        table (table_),
         gdef (*c->gdef_table),
         mark_set (false),
         has_glyph_classes (gdef.has_glyph_classes ()),
         mark (0),
-        table (table_),
         subs (table+table->substitutionTables) {}
 
-    bool is_actionable (StateTableDriver *driver,
-                        const Entry &entry)
-    {
-      hb_buffer_t *buffer = driver->buffer;
-
-      if (buffer->idx == buffer->len && !mark_set)
-        return false;
-
-      return entry.data.markIndex != 0xFFFF || entry.data.currentIndex != 0xFFFF;
-    }
-    void transition (StateTableDriver *driver,
+    void transition (hb_buffer_t *buffer,
+                     StateTableDriver *driver,
                      const Entry &entry)
     {
-      hb_buffer_t *buffer = driver->buffer;
-
       /* Looks like CoreText applies neither mark nor current substitution for
        * end-of-text if mark was not explicitly set. */
       if (buffer->idx == buffer->len && !mark_set)
@@ -259,13 +273,17 @@ struct ContextualSubtable
         unsigned int offset = entry.data.markIndex + buffer->info[mark].codepoint;
         const UnsizedArrayOf &subs_old = (const UnsizedArrayOf &) subs;
         replacement = &subs_old[Types::wordOffsetToIndex (offset, table, subs_old.arrayZ)];
-        if (!replacement->sanitize (&c->sanitizer) || !*replacement)
+        if (!(replacement->sanitize (&c->sanitizer) &&
+              hb_barrier () &&
+              *replacement))
           replacement = nullptr;
       }
       if (replacement)
       {
         buffer->unsafe_to_break (mark, hb_min (buffer->idx + 1, buffer->len));
-        buffer->info[mark].codepoint = *replacement;
+        hb_codepoint_t glyph = *replacement;
+        buffer->info[mark].codepoint = glyph;
+        c->buffer_glyph_set.add (glyph);
         if (has_glyph_classes)
           _hb_glyph_info_set_glyph_props (&buffer->info[mark],
                                           gdef.get_glyph_props (*replacement));
@@ -287,12 +305,16 @@ struct ContextualSubtable
         unsigned int offset = entry.data.currentIndex + buffer->info[idx].codepoint;
         const UnsizedArrayOf &subs_old = (const UnsizedArrayOf &) subs;
         replacement = &subs_old[Types::wordOffsetToIndex (offset, table, subs_old.arrayZ)];
-        if (!replacement->sanitize (&c->sanitizer) || !*replacement)
+        if (!(replacement->sanitize (&c->sanitizer) &&
+              hb_barrier () &&
+              *replacement))
           replacement = nullptr;
       }
       if (replacement)
       {
-        buffer->info[idx].codepoint = *replacement;
+        hb_codepoint_t glyph = *replacement;
+        buffer->info[idx].codepoint = glyph;
+        c->buffer_glyph_set.add (glyph);
         if (has_glyph_classes)
           _hb_glyph_info_set_glyph_props (&buffer->info[idx],
                                           gdef.get_glyph_props (*replacement));
@@ -308,14 +330,14 @@ struct ContextualSubtable
 
     public:
     bool ret;
-    private:
     hb_aat_apply_context_t *c;
+    const ContextualSubtable *table;
+    private:
     const OT::GDEF &gdef;
     bool mark_set;
     bool has_glyph_classes;
     unsigned int mark;
-    const ContextualSubtable *table;
-    const UnsizedListOfOffset16To, HBUINT, false> &subs;
+    const UnsizedListOfOffset16To, HBUINT, void, false> &subs;
   };
 
   bool apply (hb_aat_apply_context_t *c) const
@@ -324,7 +346,14 @@ struct ContextualSubtable
 
     driver_context_t dc (this, c);
 
-    StateTableDriver driver (machine, c->buffer, c->face);
+    StateTableDriver driver (machine, c->face);
+
+    if (!c->buffer_intersects_machine ())
+    {
+      (void) c->buffer->message (c->font, "skipped chainsubtable because no glyph matches");
+      return_trace (false);
+    }
+
     driver.drive (&dc, c);
 
     return_trace (dc.ret);
@@ -336,6 +365,7 @@ struct ContextualSubtable
 
     unsigned int num_entries = 0;
     if (unlikely (!machine.sanitize (c, &num_entries))) return_trace (false);
+    hb_barrier ();
 
     if (!Types::extended)
       return_trace (substitutionTables.sanitize (c, this, 0));
@@ -356,13 +386,14 @@ struct ContextualSubtable
     return_trace (substitutionTables.sanitize (c, this, num_lookups));
   }
 
-  protected:
+  public:
   StateTable
                 machine;
-  NNOffsetTo, HBUINT, false>, HBUINT>
+  protected:
+  NNOffsetTo, HBUINT, void, false>, HBUINT>
                 substitutionTables;
   public:
-  DEFINE_SIZE_STATIC (20);
+  DEFINE_SIZE_STATIC ((StateTable::static_size + HBUINT::static_size));
 };
 
 
@@ -372,6 +403,16 @@ struct LigatureEntry;
 template <>
 struct LigatureEntry
 {
+
+  struct EntryData
+  {
+    HBUINT16    ligActionIndex; /* Index to the first ligActionTable entry
+                                 * for processing this group, if indicated
+                                 * by the flags. */
+    public:
+    DEFINE_SIZE_STATIC (2);
+  };
+
   enum Flags
   {
     SetComponent        = 0x8000,       /* Push this glyph onto the component stack for
@@ -383,14 +424,8 @@ struct LigatureEntry
     Reserved            = 0x1FFF,       /* These bits are reserved and should be set to 0. */
   };
 
-  struct EntryData
-  {
-    HBUINT16    ligActionIndex; /* Index to the first ligActionTable entry
-                                 * for processing this group, if indicated
-                                 * by the flags. */
-    public:
-    DEFINE_SIZE_STATIC (2);
-  };
+  static bool initiateAction (const Entry &entry)
+  { return entry.flags & SetComponent; }
 
   static bool performAction (const Entry &entry)
   { return entry.flags & PerformAction; }
@@ -401,6 +436,8 @@ struct LigatureEntry
 template <>
 struct LigatureEntry
 {
+  typedef void EntryData;
+
   enum Flags
   {
     SetComponent        = 0x8000,       /* Push this glyph onto the component stack for
@@ -412,7 +449,8 @@ struct LigatureEntry
                                          * multiple of 4. */
   };
 
-  typedef void EntryData;
+  static bool initiateAction (const Entry &entry)
+  { return entry.flags & SetComponent; }
 
   static bool performAction (const Entry &entry)
   { return entry.flags & Offset; }
@@ -430,13 +468,23 @@ struct LigatureSubtable
   typedef LigatureEntry LigatureEntryT;
   typedef typename LigatureEntryT::EntryData EntryData;
 
+  enum Flags
+  {
+    DontAdvance = LigatureEntryT::DontAdvance,
+  };
+
+  bool is_action_initiable (const Entry &entry) const
+  {
+    return LigatureEntryT::initiateAction (entry);
+  }
+  bool is_actionable (const Entry &entry) const
+  {
+    return LigatureEntryT::performAction (entry);
+  }
+
   struct driver_context_t
   {
     static constexpr bool in_place = false;
-    enum
-    {
-      DontAdvance       = LigatureEntryT::DontAdvance,
-    };
     enum LigActionFlags
     {
       LigActionLast     = 0x80000000,   /* This is the last action in the list. This also
@@ -459,16 +507,10 @@ struct LigatureSubtable
         ligature (table+table->ligature),
         match_length (0) {}
 
-    bool is_actionable (StateTableDriver *driver HB_UNUSED,
-                        const Entry &entry)
-    {
-      return LigatureEntryT::performAction (entry);
-    }
-    void transition (StateTableDriver *driver,
+    void transition (hb_buffer_t *buffer,
+                     StateTableDriver *driver,
                      const Entry &entry)
     {
-      hb_buffer_t *buffer = driver->buffer;
-
       DEBUG_MSG (APPLY, nullptr, "Ligature transition at %u", buffer->idx);
       if (entry.flags & LigatureEntryT::SetComponent)
       {
@@ -513,6 +555,7 @@ struct LigatureSubtable
           if (unlikely (!buffer->move_to (match_positions[--cursor % ARRAY_LENGTH (match_positions)]))) return;
 
           if (unlikely (!actionData->sanitize (&c->sanitizer))) break;
+          hb_barrier ();
           action = *actionData;
 
           uint32_t uoffset = action & LigActionOffset;
@@ -523,6 +566,7 @@ struct LigatureSubtable
           component_idx = Types::wordOffsetToIndex (component_idx, table, component.arrayZ);
           const HBUINT16 &componentData = component[component_idx];
           if (unlikely (!componentData.sanitize (&c->sanitizer))) break;
+          hb_barrier ();
           ligature_idx += componentData;
 
           DEBUG_MSG (APPLY, nullptr, "Action store %d last %d",
@@ -533,6 +577,7 @@ struct LigatureSubtable
             ligature_idx = Types::offsetToIndex (ligature_idx, table, ligature.arrayZ);
             const HBGlyphID16 &ligatureData = ligature[ligature_idx];
             if (unlikely (!ligatureData.sanitize (&c->sanitizer))) break;
+            hb_barrier ();
             hb_codepoint_t lig = ligatureData;
 
             DEBUG_MSG (APPLY, nullptr, "Produced ligature %u", lig);
@@ -544,6 +589,7 @@ struct LigatureSubtable
             {
               DEBUG_MSG (APPLY, nullptr, "Skipping ligature component");
               if (unlikely (!buffer->move_to (match_positions[--match_length % ARRAY_LENGTH (match_positions)]))) return;
+              _hb_glyph_info_set_default_ignorable (&buffer->cur());
               if (unlikely (!buffer->replace_glyph (DELETED_GLYPH))) return;
             }
 
@@ -560,9 +606,9 @@ struct LigatureSubtable
 
     public:
     bool ret;
-    private:
     hb_aat_apply_context_t *c;
     const LigatureSubtable *table;
+    private:
     const UnsizedArrayOf &ligAction;
     const UnsizedArrayOf &component;
     const UnsizedArrayOf &ligature;
@@ -576,7 +622,14 @@ struct LigatureSubtable
 
     driver_context_t dc (this, c);
 
-    StateTableDriver driver (machine, c->buffer, c->face);
+    StateTableDriver driver (machine, c->face);
+
+    if (!c->buffer_intersects_machine ())
+    {
+      (void) c->buffer->message (c->font, "skipped chainsubtable because no glyph matches");
+      return_trace (false);
+    }
+
     driver.drive (&dc, c);
 
     return_trace (dc.ret);
@@ -587,12 +640,14 @@ struct LigatureSubtable
     TRACE_SANITIZE (this);
     /* The rest of array sanitizations are done at run-time. */
     return_trace (c->check_struct (this) && machine.sanitize (c) &&
+                  hb_barrier () &&
                   ligAction && component && ligature);
   }
 
-  protected:
+  public:
   StateTable
                 machine;
+  protected:
   NNOffsetTo, HBUINT>
                 ligAction;      /* Offset to the ligature action table. */
   NNOffsetTo, HBUINT>
@@ -600,7 +655,7 @@ struct LigatureSubtable
   NNOffsetTo, HBUINT>
                 ligature;       /* Offset to the actual ligature lists. */
   public:
-  DEFINE_SIZE_STATIC (28);
+  DEFINE_SIZE_STATIC ((StateTable::static_size + 3 * HBUINT::static_size));
 };
 
 template 
@@ -610,6 +665,12 @@ struct NoncontextualSubtable
   {
     TRACE_APPLY (this);
 
+    if (!c->buffer_intersects_machine ())
+    {
+      (void) c->buffer->message (c->font, "skipped chainsubtable because no glyph matches");
+      return_trace (false);
+    }
+
     const OT::GDEF &gdef (*c->gdef_table);
     bool has_glyph_classes = gdef.has_glyph_classes ();
 
@@ -642,7 +703,9 @@ struct NoncontextualSubtable
       const HBGlyphID16 *replacement = substitute.get_value (info[i].codepoint, num_glyphs);
       if (replacement)
       {
-        info[i].codepoint = *replacement;
+        hb_codepoint_t glyph = *replacement;
+        info[i].codepoint = glyph;
+        c->buffer_glyph_set.add (glyph);
         if (has_glyph_classes)
           _hb_glyph_info_set_glyph_props (&info[i],
                                           gdef.get_glyph_props (*replacement));
@@ -653,6 +716,12 @@ struct NoncontextualSubtable
     return_trace (ret);
   }
 
+  template 
+  void collect_initial_glyphs (set_t &glyphs, unsigned num_glyphs) const
+  {
+    substitute.collect_glyphs (glyphs, num_glyphs);
+  }
+
   bool sanitize (hb_sanitize_context_t *c) const
   {
     TRACE_SANITIZE (this);
@@ -686,74 +755,80 @@ struct InsertionSubtable
     DEFINE_SIZE_STATIC (4);
   };
 
+  enum Flags
+  {
+    SetMark             = 0x8000,     /* If set, mark the current glyph. */
+    DontAdvance         = 0x4000,     /* If set, don't advance to the next glyph before
+                                       * going to the new state.  This does not mean
+                                       * that the glyph pointed to is the same one as
+                                       * before. If you've made insertions immediately
+                                       * downstream of the current glyph, the next glyph
+                                       * processed would in fact be the first one
+                                       * inserted. */
+    CurrentIsKashidaLike= 0x2000,     /* If set, and the currentInsertList is nonzero,
+                                       * then the specified glyph list will be inserted
+                                       * as a kashida-like insertion, either before or
+                                       * after the current glyph (depending on the state
+                                       * of the currentInsertBefore flag). If clear, and
+                                       * the currentInsertList is nonzero, then the
+                                       * specified glyph list will be inserted as a
+                                       * split-vowel-like insertion, either before or
+                                       * after the current glyph (depending on the state
+                                       * of the currentInsertBefore flag). */
+    MarkedIsKashidaLike= 0x1000,      /* If set, and the markedInsertList is nonzero,
+                                       * then the specified glyph list will be inserted
+                                       * as a kashida-like insertion, either before or
+                                       * after the marked glyph (depending on the state
+                                       * of the markedInsertBefore flag). If clear, and
+                                       * the markedInsertList is nonzero, then the
+                                       * specified glyph list will be inserted as a
+                                       * split-vowel-like insertion, either before or
+                                       * after the marked glyph (depending on the state
+                                       * of the markedInsertBefore flag). */
+    CurrentInsertBefore= 0x0800,      /* If set, specifies that insertions are to be made
+                                       * to the left of the current glyph. If clear,
+                                       * they're made to the right of the current glyph. */
+    MarkedInsertBefore= 0x0400,       /* If set, specifies that insertions are to be
+                                       * made to the left of the marked glyph. If clear,
+                                       * they're made to the right of the marked glyph. */
+    CurrentInsertCount= 0x3E0,        /* This 5-bit field is treated as a count of the
+                                       * number of glyphs to insert at the current
+                                       * position. Since zero means no insertions, the
+                                       * largest number of insertions at any given
+                                       * current location is 31 glyphs. */
+    MarkedInsertCount= 0x001F,        /* This 5-bit field is treated as a count of the
+                                       * number of glyphs to insert at the marked
+                                       * position. Since zero means no insertions, the
+                                       * largest number of insertions at any given
+                                       * marked location is 31 glyphs. */
+  };
+
+  bool is_action_initiable (const Entry &entry) const
+  {
+    return (entry.flags & SetMark);
+  }
+  bool is_actionable (const Entry &entry) const
+  {
+    return (entry.flags & (CurrentInsertCount | MarkedInsertCount)) &&
+           (entry.data.currentInsertIndex != 0xFFFF ||entry.data.markedInsertIndex != 0xFFFF);
+  }
+
   struct driver_context_t
   {
     static constexpr bool in_place = false;
-    enum Flags
-    {
-      SetMark           = 0x8000,       /* If set, mark the current glyph. */
-      DontAdvance       = 0x4000,       /* If set, don't advance to the next glyph before
-                                         * going to the new state.  This does not mean
-                                         * that the glyph pointed to is the same one as
-                                         * before. If you've made insertions immediately
-                                         * downstream of the current glyph, the next glyph
-                                         * processed would in fact be the first one
-                                         * inserted. */
-      CurrentIsKashidaLike= 0x2000,     /* If set, and the currentInsertList is nonzero,
-                                         * then the specified glyph list will be inserted
-                                         * as a kashida-like insertion, either before or
-                                         * after the current glyph (depending on the state
-                                         * of the currentInsertBefore flag). If clear, and
-                                         * the currentInsertList is nonzero, then the
-                                         * specified glyph list will be inserted as a
-                                         * split-vowel-like insertion, either before or
-                                         * after the current glyph (depending on the state
-                                         * of the currentInsertBefore flag). */
-      MarkedIsKashidaLike= 0x1000,      /* If set, and the markedInsertList is nonzero,
-                                         * then the specified glyph list will be inserted
-                                         * as a kashida-like insertion, either before or
-                                         * after the marked glyph (depending on the state
-                                         * of the markedInsertBefore flag). If clear, and
-                                         * the markedInsertList is nonzero, then the
-                                         * specified glyph list will be inserted as a
-                                         * split-vowel-like insertion, either before or
-                                         * after the marked glyph (depending on the state
-                                         * of the markedInsertBefore flag). */
-      CurrentInsertBefore= 0x0800,      /* If set, specifies that insertions are to be made
-                                         * to the left of the current glyph. If clear,
-                                         * they're made to the right of the current glyph. */
-      MarkedInsertBefore= 0x0400,       /* If set, specifies that insertions are to be
-                                         * made to the left of the marked glyph. If clear,
-                                         * they're made to the right of the marked glyph. */
-      CurrentInsertCount= 0x3E0,        /* This 5-bit field is treated as a count of the
-                                         * number of glyphs to insert at the current
-                                         * position. Since zero means no insertions, the
-                                         * largest number of insertions at any given
-                                         * current location is 31 glyphs. */
-      MarkedInsertCount= 0x001F,        /* This 5-bit field is treated as a count of the
-                                         * number of glyphs to insert at the marked
-                                         * position. Since zero means no insertions, the
-                                         * largest number of insertions at any given
-                                         * marked location is 31 glyphs. */
-    };
 
-    driver_context_t (const InsertionSubtable *table,
+    driver_context_t (const InsertionSubtable *table_,
                       hb_aat_apply_context_t *c_) :
         ret (false),
         c (c_),
+        table (table_),
         mark (0),
         insertionAction (table+table->insertionAction) {}
 
-    bool is_actionable (StateTableDriver *driver HB_UNUSED,
-                        const Entry &entry)
-    {
-      return (entry.flags & (CurrentInsertCount | MarkedInsertCount)) &&
-             (entry.data.currentInsertIndex != 0xFFFF ||entry.data.markedInsertIndex != 0xFFFF);
-    }
-    void transition (StateTableDriver *driver,
+    void transition (hb_buffer_t *buffer,
+                     StateTableDriver *driver,
                      const Entry &entry)
     {
-      hb_buffer_t *buffer = driver->buffer;
       unsigned int flags = entry.flags;
 
       unsigned mark_loc = buffer->out_len;
@@ -765,6 +840,7 @@ struct InsertionSubtable
         unsigned int start = entry.data.markedInsertIndex;
         const HBGlyphID16 *glyphs = &insertionAction[start];
         if (unlikely (!c->sanitizer.check_array (glyphs, count))) count = 0;
+        hb_barrier ();
 
         bool before = flags & MarkedInsertBefore;
 
@@ -775,6 +851,9 @@ struct InsertionSubtable
           if (unlikely (!buffer->copy_glyph ())) return;
         /* TODO We ignore KashidaLike setting. */
         if (unlikely (!buffer->replace_glyphs (0, count, glyphs))) return;
+        for (unsigned int i = 0; i < count; i++)
+          c->buffer_glyph_set.add (glyphs[i]);
+        ret = true;
         if (buffer->idx < buffer->len && !before)
           buffer->skip_glyph ();
 
@@ -793,6 +872,7 @@ struct InsertionSubtable
         unsigned int start = entry.data.currentInsertIndex;
         const HBGlyphID16 *glyphs = &insertionAction[start];
         if (unlikely (!c->sanitizer.check_array (glyphs, count))) count = 0;
+        hb_barrier ();
 
         bool before = flags & CurrentInsertBefore;
 
@@ -826,8 +906,9 @@ struct InsertionSubtable
 
     public:
     bool ret;
-    private:
     hb_aat_apply_context_t *c;
+    const InsertionSubtable *table;
+    private:
     unsigned int mark;
     const UnsizedArrayOf &insertionAction;
   };
@@ -838,7 +919,14 @@ struct InsertionSubtable
 
     driver_context_t dc (this, c);
 
-    StateTableDriver driver (machine, c->buffer, c->face);
+    StateTableDriver driver (machine, c->face);
+
+    if (!c->buffer_intersects_machine ())
+    {
+      (void) c->buffer->message (c->font, "skipped chainsubtable because no glyph matches");
+      return_trace (false);
+    }
+
     driver.drive (&dc, c);
 
     return_trace (dc.ret);
@@ -849,17 +937,19 @@ struct InsertionSubtable
     TRACE_SANITIZE (this);
     /* The rest of array sanitizations are done at run-time. */
     return_trace (c->check_struct (this) && machine.sanitize (c) &&
+                  hb_barrier () &&
                   insertionAction);
   }
 
-  protected:
+  public:
   StateTable
                 machine;
+  protected:
   NNOffsetTo, HBUINT>
                 insertionAction;        /* Byte offset from stateHeader to the start of
                                          * the insertion glyph table. */
   public:
-  DEFINE_SIZE_STATIC (20);
+  DEFINE_SIZE_STATIC ((StateTable::static_size + HBUINT::static_size));
 };
 
 
@@ -883,6 +973,107 @@ struct Feature
   DEFINE_SIZE_STATIC (12);
 };
 
+
+struct hb_accelerate_subtables_context_t :
+       hb_dispatch_context_t
+{
+  struct hb_applicable_t
+  {
+    friend struct hb_accelerate_subtables_context_t;
+    friend struct hb_aat_layout_lookup_accelerator_t;
+
+    public:
+    hb_bit_set_t glyph_set;
+    mutable hb_aat_class_cache_t class_cache;
+
+    template 
+    auto init_ (const T &obj_, unsigned num_glyphs, hb_priority<1>) HB_AUTO_RETURN
+    (
+      obj_.machine.collect_initial_glyphs (glyph_set, num_glyphs, obj_)
+    )
+
+    template 
+    void init_ (const T &obj_, unsigned num_glyphs, hb_priority<0>)
+    {
+      obj_.collect_initial_glyphs (glyph_set, num_glyphs);
+    }
+
+    template 
+    void init (const T &obj_, unsigned num_glyphs)
+    {
+      glyph_set.init ();
+      init_ (obj_, num_glyphs, hb_prioritize);
+      class_cache.clear ();
+    }
+
+    void
+    fini ()
+    {
+      glyph_set.fini ();
+    }
+  };
+
+  /* Dispatch interface. */
+  template 
+  return_t dispatch (const T &obj)
+  {
+    hb_applicable_t *entry = &array[i++];
+
+    entry->init (obj, num_glyphs);
+
+    return hb_empty_t ();
+  }
+  static return_t default_return_value () { return hb_empty_t (); }
+
+  bool stop_sublookup_iteration (return_t r) const { return false; }
+
+  hb_accelerate_subtables_context_t (hb_applicable_t *array_, unsigned num_glyphs_) :
+                                     hb_dispatch_context_t (),
+                                     array (array_), num_glyphs (num_glyphs_) {}
+
+  hb_applicable_t *array;
+  unsigned num_glyphs;
+  unsigned i = 0;
+};
+
+struct hb_aat_layout_chain_accelerator_t
+{
+  template 
+  static hb_aat_layout_chain_accelerator_t *create (const TChain &chain, unsigned num_glyphs)
+  {
+    unsigned count = chain.get_subtable_count ();
+
+    unsigned size = sizeof (hb_aat_layout_chain_accelerator_t) -
+                    HB_VAR_ARRAY * sizeof (hb_accelerate_subtables_context_t::hb_applicable_t) +
+                    count * sizeof (hb_accelerate_subtables_context_t::hb_applicable_t);
+
+    /* The following is a calloc because when we are collecting subtables,
+     * some of them might be invalid and hence not collect; as a result,
+     * we might not fill in all the count entries of the subtables array.
+     * Zeroing it allows the set digest to gatekeep it without having to
+     * initialize it further. */
+    auto *thiz = (hb_aat_layout_chain_accelerator_t *) hb_calloc (1, size);
+    if (unlikely (!thiz))
+      return nullptr;
+
+    thiz->count = count;
+
+    hb_accelerate_subtables_context_t c_accelerate_subtables (thiz->subtables, num_glyphs);
+    chain.dispatch (&c_accelerate_subtables);
+
+    return thiz;
+  }
+
+  void destroy ()
+  {
+    for (unsigned i = 0; i < count; i++)
+      subtables[i].fini ();
+  }
+
+  unsigned count;
+  hb_accelerate_subtables_context_t::hb_applicable_t subtables[HB_VAR_ARRAY];
+};
+
 template 
 struct ChainSubtable
 {
@@ -937,19 +1128,22 @@ struct ChainSubtable
   bool apply (hb_aat_apply_context_t *c) const
   {
     TRACE_APPLY (this);
-    hb_sanitize_with_object_t with (&c->sanitizer, this);
+    // Disabled for https://github.com/harfbuzz/harfbuzz/issues/4873
+    //hb_sanitize_with_object_t with (&c->sanitizer, this);
     return_trace (dispatch (c));
   }
 
   bool sanitize (hb_sanitize_context_t *c) const
   {
     TRACE_SANITIZE (this);
-    if (!length.sanitize (c) ||
-        length <= min_size ||
-        !c->check_range (this, length))
+    if (!(length.sanitize (c) &&
+          hb_barrier () &&
+          length >= min_size &&
+          c->check_range (this, length)))
       return_trace (false);
 
-    hb_sanitize_with_object_t with (c, this);
+    // Disabled for https://github.com/harfbuzz/harfbuzz/issues/4873
+    //hb_sanitize_with_object_t with (c, this);
     return_trace (dispatch (c));
   }
 
@@ -973,6 +1167,8 @@ struct Chain
 {
   typedef typename Types::HBUINT HBUINT;
 
+  unsigned get_subtable_count () const { return subtableCount; }
+
   hb_mask_t compile_flags (const hb_aat_map_builder_t *map) const
   {
     hb_mask_t flags = defaultFlags;
@@ -1013,7 +1209,8 @@ struct Chain
     return flags;
   }
 
-  void apply (hb_aat_apply_context_t *c) const
+  void apply (hb_aat_apply_context_t *c,
+              const hb_aat_layout_chain_accelerator_t *accel) const
   {
     const ChainSubtable *subtable = &StructAfter> (featureZ.as_array (featureCount));
     unsigned int count = subtableCount;
@@ -1021,14 +1218,19 @@ struct Chain
     {
       bool reverse;
 
+      auto coverage = subtable->get_coverage ();
+
+      hb_mask_t subtable_flags = subtable->subFeatureFlags;
       if (hb_none (hb_iter (c->range_flags) |
-                   hb_map ([&subtable] (const hb_aat_map_t::range_flags_t _) -> bool { return subtable->subFeatureFlags & (_.flags); })))
+                   hb_map ([subtable_flags] (const hb_aat_map_t::range_flags_t _) -> bool { return subtable_flags & (_.flags); })))
         goto skip;
-      c->subtable_flags = subtable->subFeatureFlags;
+      c->subtable_flags = subtable_flags;
+      c->machine_glyph_set = accel ? &accel->subtables[i].glyph_set : &Null(hb_bit_set_t);
+      c->machine_class_cache = accel ? &accel->subtables[i].class_cache : nullptr;
 
-      if (!(subtable->get_coverage() & ChainSubtable::AllDirections) &&
+      if (!(coverage & ChainSubtable::AllDirections) &&
           HB_DIRECTION_IS_VERTICAL (c->buffer->props.direction) !=
-          bool (subtable->get_coverage() & ChainSubtable::Vertical))
+          bool (coverage & ChainSubtable::Vertical))
         goto skip;
 
       /* Buffer contents is always in logical direction.  Determine if
@@ -1058,9 +1260,9 @@ struct Chain
                                 (the order opposite that of the characters, which
                                 may be right-to-left or left-to-right).
        */
-      reverse = subtable->get_coverage () & ChainSubtable::Logical ?
-                bool (subtable->get_coverage () & ChainSubtable::Backwards) :
-                bool (subtable->get_coverage () & ChainSubtable::Backwards) !=
+      reverse = coverage & ChainSubtable::Logical ?
+                bool (coverage & ChainSubtable::Backwards) :
+                bool (coverage & ChainSubtable::Backwards) !=
                 HB_DIRECTION_IS_BACKWARD (c->buffer->props.direction);
 
       if (!c->buffer->message (c->font, "start chainsubtable %u", c->lookup_index))
@@ -1086,12 +1288,28 @@ struct Chain
 
   unsigned int get_size () const { return length; }
 
-  bool sanitize (hb_sanitize_context_t *c, unsigned int version HB_UNUSED) const
+  template 
+  typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const
+  {
+    const ChainSubtable *subtable = &StructAfter> (featureZ.as_array (featureCount));
+    unsigned int count = subtableCount;
+    for (unsigned int i = 0; i < count; i++)
+    {
+      typename context_t::return_t ret = subtable->dispatch (c, std::forward (ds)...);
+      if (c->stop_sublookup_iteration (ret))
+        return ret;
+      subtable = &StructAfter> (*subtable);
+    }
+    return c->default_return_value ();
+  }
+
+  bool sanitize (hb_sanitize_context_t *c, unsigned int version) const
   {
     TRACE_SANITIZE (this);
-    if (!length.sanitize (c) ||
-        length < min_size ||
-        !c->check_range (this, length))
+    if (!(length.sanitize (c) &&
+          hb_barrier () &&
+          length >= min_size &&
+          c->check_range (this, length)))
       return_trace (false);
 
     if (!c->check_array (featureZ.arrayZ, featureCount))
@@ -1103,9 +1321,17 @@ struct Chain
     {
       if (!subtable->sanitize (c))
         return_trace (false);
+      hb_barrier ();
       subtable = &StructAfter> (*subtable);
     }
 
+    if (version >= 3)
+    {
+      const SubtableGlyphCoverage *coverage = (const SubtableGlyphCoverage *) subtable;
+      if (!coverage->sanitize (c, count))
+        return_trace (false);
+    }
+
     return_trace (true);
   }
 
@@ -1117,7 +1343,7 @@ struct Chain
 
   UnsizedArrayOf       featureZ;       /* Features. */
 /*ChainSubtable firstSubtable;*//* Subtables. */
-/*subtableGlyphCoverageArray*/  /* Only if version >= 3. We don't use. */
+/*SubtableGlyphCoverage coverages*//* Only if version >= 3. */
 
   public:
   DEFINE_SIZE_MIN (8 + 2 * sizeof (HBUINT));
@@ -1128,13 +1354,79 @@ struct Chain
  * The 'mort'/'morx' Table
  */
 
-template 
+template 
 struct mortmorx
 {
   static constexpr hb_tag_t tableTag = TAG;
 
   bool has_data () const { return version != 0; }
 
+  struct accelerator_t
+  {
+    accelerator_t (hb_face_t *face)
+    {
+      hb_sanitize_context_t sc;
+      this->table = sc.reference_table (face);
+
+      if (unlikely (this->table->is_blocklisted (this->table.get_blob (), face)))
+      {
+        hb_blob_destroy (this->table.get_blob ());
+        this->table = hb_blob_get_empty ();
+      }
+
+      this->chain_count = table->get_chain_count ();
+
+      this->accels = (hb_atomic_ptr_t *) hb_calloc (this->chain_count, sizeof (*accels));
+      if (unlikely (!this->accels))
+      {
+        this->chain_count = 0;
+        this->table.destroy ();
+        this->table = hb_blob_get_empty ();
+      }
+    }
+    ~accelerator_t ()
+    {
+      for (unsigned int i = 0; i < this->chain_count; i++)
+      {
+        if (this->accels[i])
+          this->accels[i]->destroy ();
+        hb_free (this->accels[i]);
+      }
+      hb_free (this->accels);
+      this->table.destroy ();
+    }
+
+    hb_blob_t *get_blob () const { return table.get_blob (); }
+
+    template 
+    hb_aat_layout_chain_accelerator_t *get_accel (unsigned chain_index, const Chain &chain, unsigned num_glyphs) const
+    {
+      if (unlikely (chain_index >= chain_count)) return nullptr;
+
+    retry:
+      auto *accel = accels[chain_index].get_acquire ();
+      if (unlikely (!accel))
+      {
+        accel = hb_aat_layout_chain_accelerator_t::create (chain, num_glyphs);
+        if (unlikely (!accel))
+          return nullptr;
+
+        if (unlikely (!accels[chain_index].cmpexch (nullptr, accel)))
+        {
+          hb_free (accel);
+          goto retry;
+        }
+      }
+
+      return accel;
+    }
+
+    hb_blob_ptr_t table;
+    unsigned int chain_count;
+    hb_atomic_ptr_t *accels;
+  };
+
+
   void compile_flags (const hb_aat_map_builder_t *mapper,
                       hb_aat_map_t *map) const
   {
@@ -1151,20 +1443,28 @@ struct mortmorx
     }
   }
 
+  unsigned get_chain_count () const
+  {
+    return chainCount;
+  }
   void apply (hb_aat_apply_context_t *c,
-              const hb_aat_map_t &map) const
+              const hb_aat_map_t &map,
+              const accelerator_t &accel) const
   {
     if (unlikely (!c->buffer->successful)) return;
 
     c->buffer->unsafe_to_concat ();
 
+    c->setup_buffer_glyph_set ();
+
     c->set_lookup_index (0);
     const Chain *chain = &firstChain;
     unsigned int count = chainCount;
     for (unsigned int i = 0; i < count; i++)
     {
+      auto *chain_accel = accel.get_accel (i, *chain, c->face->get_num_glyphs ());
       c->range_flags = &map.chain_flags[i];
-      chain->apply (c);
+      chain->apply (c, chain_accel);
       if (unlikely (!c->buffer->successful)) return;
       chain = &StructAfter> (*chain);
     }
@@ -1173,7 +1473,10 @@ struct mortmorx
   bool sanitize (hb_sanitize_context_t *c) const
   {
     TRACE_SANITIZE (this);
-    if (!version.sanitize (c) || !version || !chainCount.sanitize (c))
+    if (!(version.sanitize (c) &&
+          hb_barrier () &&
+          version &&
+          chainCount.sanitize (c)))
       return_trace (false);
 
     const Chain *chain = &firstChain;
@@ -1182,6 +1485,7 @@ struct mortmorx
     {
       if (!chain->sanitize (c, version))
         return_trace (false);
+      hb_barrier ();
       chain = &StructAfter> (*chain);
     }
 
@@ -1200,8 +1504,24 @@ struct mortmorx
   DEFINE_SIZE_MIN (8);
 };
 
-struct morx : mortmorx {};
-struct mort : mortmorx {};
+struct morx : mortmorx
+{
+  HB_INTERNAL bool is_blocklisted (hb_blob_t *blob,
+                                   hb_face_t *face) const;
+};
+
+struct mort : mortmorx
+{
+  HB_INTERNAL bool is_blocklisted (hb_blob_t *blob,
+                                   hb_face_t *face) const;
+};
+
+struct morx_accelerator_t : morx::accelerator_t {
+  morx_accelerator_t (hb_face_t *face) : morx::accelerator_t (face) {}
+};
+struct mort_accelerator_t : mort::accelerator_t {
+  mort_accelerator_t (hb_face_t *face) : mort::accelerator_t (face) {}
+};
 
 
 } /* namespace AAT */
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-aat-layout-opbd-table.hh b/src/java.desktop/share/native/libharfbuzz/hb-aat-layout-opbd-table.hh
index 959382f356fb..f28ec326b459 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-aat-layout-opbd-table.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-aat-layout-opbd-table.hh
@@ -133,8 +133,8 @@ struct opbd
   {
     switch (format)
     {
-    case 0: return u.format0.get_bounds (font, glyph_id, extents, this);
-    case 1: return u.format1.get_bounds (font, glyph_id, extents, this);
+    case 0: hb_barrier (); return u.format0.get_bounds (font, glyph_id, extents, this);
+    case 1: hb_barrier (); return u.format1.get_bounds (font, glyph_id, extents, this);
     default:return false;
     }
   }
@@ -144,11 +144,12 @@ struct opbd
     TRACE_SANITIZE (this);
     if (unlikely (!c->check_struct (this) || version.major != 1))
       return_trace (false);
+    hb_barrier ();
 
     switch (format)
     {
-    case 0: return_trace (u.format0.sanitize (c, this));
-    case 1: return_trace (u.format1.sanitize (c, this));
+    case 0: hb_barrier (); return_trace (u.format0.sanitize (c, this));
+    case 1: hb_barrier (); return_trace (u.format1.sanitize (c, this));
     default:return_trace (true);
     }
   }
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-aat-layout-trak-table.hh b/src/java.desktop/share/native/libharfbuzz/hb-aat-layout-trak-table.hh
index 5c49d1f0562c..0db4035fd8c4 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-aat-layout-trak-table.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-aat-layout-trak-table.hh
@@ -48,17 +48,69 @@ struct TrackTableEntry
 
   float get_track_value () const { return track.to_float (); }
 
-  int get_value (const void *base, unsigned int index,
-                 unsigned int table_size) const
-  { return (base+valuesZ).as_array (table_size)[index]; }
+  float interpolate_at (unsigned int idx,
+                        float ptem,
+                        const void *base,
+                        hb_array_t size_table) const
+  {
+    const FWORD *values = (base+valuesZ).arrayZ;
+
+    float s0 = size_table[idx].to_float ();
+    float s1 = size_table[idx + 1].to_float ();
+    int v0 = values[idx];
+    int v1 = values[idx + 1];
+
+    // Deal with font bugs.
+    if (unlikely (s1 < s0))
+    { hb_swap (s0, s1); hb_swap (v0, v1); }
+    if (unlikely (ptem < s0)) return v0;
+    if (unlikely (ptem > s1)) return v1;
+    if (unlikely (s0 == s1)) return (v0 + v1) * 0.5f;
+
+    float t = (ptem - s0) / (s1 - s0);
+    return v0 + t * (v1 - v0);
+  }
+
+  float get_value (float ptem,
+                   const void *base,
+                   hb_array_t size_table) const
+  {
+    const FWORD *values = (base+valuesZ).arrayZ;
+
+    unsigned int n_sizes = size_table.length;
+
+    /*
+     * Choose size.
+     */
+    if (!n_sizes) return 0.f;
+    if (n_sizes == 1) return values[0];
+
+    // At least two entries.
+
+    unsigned i;
+    for (i = 0; i < n_sizes; i++)
+      if (size_table[i].to_float () >= ptem)
+        break;
+
+    // Boundary conditions.
+    if (i == 0)       return values[0];
+    if (i == n_sizes) return values[n_sizes - 1];
+
+    // Exact match.
+    if (size_table[i].to_float () == ptem) return values[i];
+
+    // Interpolate.
+    return interpolate_at (i - 1, ptem, base, size_table);
+  }
 
   public:
-  bool sanitize (hb_sanitize_context_t *c, const void *base,
-                 unsigned int table_size) const
+  bool sanitize (hb_sanitize_context_t *c,
+                 const void *base,
+                 unsigned int n_sizes) const
   {
     TRACE_SANITIZE (this);
     return_trace (likely (c->check_struct (this) &&
-                          (valuesZ.sanitize (c, base, table_size))));
+                          (valuesZ.sanitize (c, base, n_sizes))));
   }
 
   protected:
@@ -76,64 +128,45 @@ struct TrackTableEntry
 
 struct TrackData
 {
-  float interpolate_at (unsigned int idx,
-                        float target_size,
-                        const TrackTableEntry &trackTableEntry,
-                        const void *base) const
+  float get_tracking (const void *base, float ptem, float track = 0.f) const
   {
-    unsigned int sizes = nSizes;
-    hb_array_t size_table ((base+sizeTable).arrayZ, sizes);
+    unsigned count = nTracks;
+    hb_array_t size_table = (base+sizeTable).as_array (nSizes);
 
-    float s0 = size_table[idx].to_float ();
-    float s1 = size_table[idx + 1].to_float ();
-    float t = unlikely (s0 == s1) ? 0.f : (target_size - s0) / (s1 - s0);
-    return t * trackTableEntry.get_value (base, idx + 1, sizes) +
-           (1.f - t) * trackTableEntry.get_value (base, idx, sizes);
-  }
+    if (!count) return 0.f;
+    if (count == 1) return trackTable[0].get_value (ptem, base, size_table);
 
-  int get_tracking (const void *base, float ptem) const
-  {
-    /*
-     * Choose track.
-     */
-    const TrackTableEntry *trackTableEntry = nullptr;
-    unsigned int count = nTracks;
-    for (unsigned int i = 0; i < count; i++)
-    {
-      /* Note: Seems like the track entries are sorted by values.  But the
-       * spec doesn't explicitly say that.  It just mentions it in the example. */
-
-      /* For now we only seek for track entries with zero tracking value */
-
-      if (trackTable[i].get_track_value () == 0.f)
-      {
-        trackTableEntry = &trackTable[i];
-        break;
-      }
-    }
-    if (!trackTableEntry) return 0;
+    // At least two entries.
 
-    /*
-     * Choose size.
-     */
-    unsigned int sizes = nSizes;
-    if (!sizes) return 0;
-    if (sizes == 1) return trackTableEntry->get_value (base, 0, sizes);
-
-    hb_array_t size_table ((base+sizeTable).arrayZ, sizes);
-    unsigned int size_index;
-    for (size_index = 0; size_index < sizes - 1; size_index++)
-      if (size_table[size_index].to_float () >= ptem)
-        break;
+    unsigned i = 0;
+    unsigned j = count - 1;
+
+    // Find the two entries that track is between.
+    while (i + 1 < count && trackTable[i + 1].get_track_value () < track)
+      i++;
+    while (j > 0 && trackTable[j - 1].get_track_value () > track)
+      j--;
+
+    // Exact match.
+    if (i == j) return trackTable[i].get_value (ptem, base, size_table);
+
+    // Interpolate.
 
-    return roundf (interpolate_at (size_index ? size_index - 1 : 0, ptem,
-                                   *trackTableEntry, base));
+    float t0 = trackTable[i].get_track_value ();
+    float t1 = trackTable[j].get_track_value ();
+
+    float t = (track - t0) / (t1 - t0);
+
+    float a = trackTable[i].get_value (ptem, base, size_table);
+    float b = trackTable[j].get_value (ptem, base, size_table);
+    return a + t * (b - a);
   }
 
   bool sanitize (hb_sanitize_context_t *c, const void *base) const
   {
     TRACE_SANITIZE (this);
     return_trace (likely (c->check_struct (this) &&
+                          hb_barrier () &&
                           sizeTable.sanitize (c, base, nSizes) &&
                           trackTable.sanitize (c, nTracks, base, nSizes)));
   }
@@ -157,45 +190,15 @@ struct trak
 
   bool has_data () const { return version.to_int (); }
 
-  bool apply (hb_aat_apply_context_t *c) const
+  hb_position_t get_h_tracking (hb_font_t *font, float track = 0.f) const
+  {
+    float ptem = font->ptem > 0.f ? font->ptem : HB_CORETEXT_DEFAULT_FONT_SIZE;
+    return font->em_scalef_x ((this+horizData).get_tracking (this, ptem, track));
+  }
+  hb_position_t get_v_tracking (hb_font_t *font, float track = 0.f) const
   {
-    TRACE_APPLY (this);
-
-    hb_mask_t trak_mask = c->plan->trak_mask;
-
-    const float ptem = c->font->ptem;
-    if (unlikely (ptem <= 0.f))
-      return_trace (false);
-
-    hb_buffer_t *buffer = c->buffer;
-    if (HB_DIRECTION_IS_HORIZONTAL (buffer->props.direction))
-    {
-      const TrackData &trackData = this+horizData;
-      int tracking = trackData.get_tracking (this, ptem);
-      hb_position_t offset_to_add = c->font->em_scalef_x (tracking / 2);
-      hb_position_t advance_to_add = c->font->em_scalef_x (tracking);
-      foreach_grapheme (buffer, start, end)
-      {
-        if (!(buffer->info[start].mask & trak_mask)) continue;
-        buffer->pos[start].x_advance += advance_to_add;
-        buffer->pos[start].x_offset += offset_to_add;
-      }
-    }
-    else
-    {
-      const TrackData &trackData = this+vertData;
-      int tracking = trackData.get_tracking (this, ptem);
-      hb_position_t offset_to_add = c->font->em_scalef_y (tracking / 2);
-      hb_position_t advance_to_add = c->font->em_scalef_y (tracking);
-      foreach_grapheme (buffer, start, end)
-      {
-        if (!(buffer->info[start].mask & trak_mask)) continue;
-        buffer->pos[start].y_advance += advance_to_add;
-        buffer->pos[start].y_offset += offset_to_add;
-      }
-    }
-
-    return_trace (true);
+    float ptem = font->ptem > 0.f ? font->ptem : HB_CORETEXT_DEFAULT_FONT_SIZE;
+    return font->em_scalef_y ((this+vertData).get_tracking (this, ptem, track));
   }
 
   bool sanitize (hb_sanitize_context_t *c) const
@@ -203,6 +206,7 @@ struct trak
     TRACE_SANITIZE (this);
 
     return_trace (likely (c->check_struct (this) &&
+                          hb_barrier () &&
                           version.major == 1 &&
                           horizData.sanitize (c, this, this) &&
                           vertData.sanitize (c, this, this)));
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-aat-layout.cc b/src/java.desktop/share/native/libharfbuzz/hb-aat-layout.cc
index fc5834c7ca1b..2cc94257aa73 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-aat-layout.cc
+++ b/src/java.desktop/share/native/libharfbuzz/hb-aat-layout.cc
@@ -34,9 +34,12 @@
 #include "hb-aat-layout-just-table.hh" // Just so we compile it; unused otherwise.
 #include "hb-aat-layout-kerx-table.hh"
 #include "hb-aat-layout-morx-table.hh"
-#include "hb-aat-layout-trak-table.hh"
+#include "hb-aat-layout-trak-table.hh" // Just so we compile it; unused otherwise.
 #include "hb-aat-ltag-table.hh"
 
+#include "hb-ot-layout-gsub-table.hh"
+#include "hb-ot-layout-gdef-table.hh"
+
 
 /*
  * hb_aat_apply_context_t
@@ -207,18 +210,48 @@ hb_aat_layout_find_feature_mapping (hb_tag_t tag)
  */
 
 
+bool
+AAT::morx::is_blocklisted (hb_blob_t *blob,
+                           hb_face_t *face) const
+{
+#ifdef HB_NO_AAT_LAYOUT_BLOCKLIST
+  return false;
+#endif
+
+  switch HB_CODEPOINT_ENCODE3 (blob->length,
+                               face->table.GSUB->table.get_length (),
+                               face->table.GDEF->table.get_length ())
+  {
+    /* https://github.com/harfbuzz/harfbuzz/issues/4108
+       sha1sum:a71ca6813b7e56a772cffff7c24a5166b087197c  AALMAGHRIBI.ttf */
+    case HB_CODEPOINT_ENCODE3 (19892, 2794, 340):
+      return true;
+  }
+  return false;
+}
+
+bool
+AAT::mort::is_blocklisted (hb_blob_t *blob,
+                           hb_face_t *face) const
+{
+#ifdef HB_NO_AAT_LAYOUT_BLOCKLIST
+  return false;
+#endif
+  return false;
+}
+
 void
 hb_aat_layout_compile_map (const hb_aat_map_builder_t *mapper,
                            hb_aat_map_t *map)
 {
-  const AAT::morx& morx = *mapper->face->table.morx;
+  const AAT::morx& morx = *mapper->face->table.morx->table;
   if (morx.has_data ())
   {
     morx.compile_flags (mapper, map);
     return;
   }
 
-  const AAT::mort& mort = *mapper->face->table.mort;
+  const AAT::mort& mort = *mapper->face->table.mort->table;
   if (mort.has_data ())
   {
     mort.compile_flags (mapper, map);
@@ -243,8 +276,8 @@ hb_aat_layout_compile_map (const hb_aat_map_builder_t *mapper,
 hb_bool_t
 hb_aat_layout_has_substitution (hb_face_t *face)
 {
-  return face->table.morx->has_data () ||
-         face->table.mort->has_data ();
+  return face->table.morx->table->has_data () ||
+         face->table.mort->table->has_data ();
 }
 
 void
@@ -260,26 +293,30 @@ hb_aat_layout_substitute (const hb_ot_shape_plan_t *plan,
   hb_aat_map_t map;
   builder.compile (map);
 
-  hb_blob_t *morx_blob = font->face->table.morx.get_blob ();
-  const AAT::morx& morx = *morx_blob->as ();
-  if (morx.has_data ())
   {
-    AAT::hb_aat_apply_context_t c (plan, font, buffer, morx_blob);
-    if (!buffer->message (font, "start table morx")) return;
-    morx.apply (&c, map);
-    (void) buffer->message (font, "end table morx");
-    return;
+    auto &accel = *font->face->table.morx;
+    const AAT::morx& morx = *accel.table;
+    if (morx.has_data ())
+    {
+      AAT::hb_aat_apply_context_t c (plan, font, buffer, accel.get_blob ());
+      if (!buffer->message (font, "start table morx")) return;
+      morx.apply (&c, map, accel);
+      (void) buffer->message (font, "end table morx");
+      return;
+    }
   }
 
-  hb_blob_t *mort_blob = font->face->table.mort.get_blob ();
-  const AAT::mort& mort = *mort_blob->as ();
-  if (mort.has_data ())
   {
-    AAT::hb_aat_apply_context_t c (plan, font, buffer, mort_blob);
-    if (!buffer->message (font, "start table mort")) return;
-    mort.apply (&c, map);
-    (void) buffer->message (font, "end table mort");
-    return;
+    auto &accel = *font->face->table.mort;
+    const AAT::mort& mort = *accel.table;
+    if (mort.has_data ())
+    {
+      AAT::hb_aat_apply_context_t c (plan, font, buffer, accel.get_blob ());
+      if (!buffer->message (font, "start table mort")) return;
+      mort.apply (&c, map, accel);
+      (void) buffer->message (font, "end table mort");
+      return;
+    }
   }
 }
 
@@ -322,7 +359,7 @@ hb_aat_layout_remove_deleted_glyphs (hb_buffer_t *buffer)
 hb_bool_t
 hb_aat_layout_has_positioning (hb_face_t *face)
 {
-  return face->table.kerx->has_data ();
+  return face->table.kerx->table->has_data ();
 }
 
 void
@@ -330,13 +367,12 @@ hb_aat_layout_position (const hb_ot_shape_plan_t *plan,
                         hb_font_t *font,
                         hb_buffer_t *buffer)
 {
-  hb_blob_t *kerx_blob = font->face->table.kerx.get_blob ();
-  const AAT::kerx& kerx = *kerx_blob->as ();
+  auto &accel = *font->face->table.kerx;
 
-  AAT::hb_aat_apply_context_t c (plan, font, buffer, kerx_blob);
+  AAT::hb_aat_apply_context_t c (plan, font, buffer, accel.get_blob ());
   if (!buffer->message (font, "start table kerx")) return;
   c.set_ankr_table (font->face->table.ankr.get ());
-  kerx.apply (&c);
+  accel.apply (&c);
   (void) buffer->message (font, "end table kerx");
 }
 
@@ -358,17 +394,6 @@ hb_aat_layout_has_tracking (hb_face_t *face)
   return face->table.trak->has_data ();
 }
 
-void
-hb_aat_layout_track (const hb_ot_shape_plan_t *plan,
-                     hb_font_t *font,
-                     hb_buffer_t *buffer)
-{
-  const AAT::trak& trak = *font->face->table.trak;
-
-  AAT::hb_aat_apply_context_t c (plan, font, buffer);
-  trak.apply (&c);
-}
-
 /**
  * hb_aat_layout_get_feature_types:
  * @face: #hb_face_t to work upon
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-aat-layout.h b/src/java.desktop/share/native/libharfbuzz/hb-aat-layout.h
index c833ea8f6237..88e040d7e2b4 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-aat-layout.h
+++ b/src/java.desktop/share/native/libharfbuzz/hb-aat-layout.h
@@ -40,7 +40,7 @@ HB_BEGIN_DECLS
  * @HB_AAT_LAYOUT_FEATURE_TYPE_INVALID: Initial, unset feature type
  * @HB_AAT_LAYOUT_FEATURE_TYPE_ALL_TYPOGRAPHIC: [All Typographic Features](https://developer.apple.com/fonts/TrueType-Reference-Manual/RM09/AppendixF.html#Type0)
  * @HB_AAT_LAYOUT_FEATURE_TYPE_LIGATURES: [Ligatures](https://developer.apple.com/fonts/TrueType-Reference-Manual/RM09/AppendixF.html#Type1)
- * @HB_AAT_LAYOUT_FEATURE_TYPE_CURISVE_CONNECTION: [Cursive Connection](https://developer.apple.com/fonts/TrueType-Reference-Manual/RM09/AppendixF.html#Type2)
+ * @HB_AAT_LAYOUT_FEATURE_TYPE_CURSIVE_CONNECTION: [Cursive Connection](https://developer.apple.com/fonts/TrueType-Reference-Manual/RM09/AppendixF.html#Type2)
  * @HB_AAT_LAYOUT_FEATURE_TYPE_LETTER_CASE: [Letter Case](https://developer.apple.com/fonts/TrueType-Reference-Manual/RM09/AppendixF.html#Type3)
  * @HB_AAT_LAYOUT_FEATURE_TYPE_VERTICAL_SUBSTITUTION: [Vertical Substitution](https://developer.apple.com/fonts/TrueType-Reference-Manual/RM09/AppendixF.html#Type4)
  * @HB_AAT_LAYOUT_FEATURE_TYPE_LINGUISTIC_REARRANGEMENT: [Linguistic Rearrangement](https://developer.apple.com/fonts/TrueType-Reference-Manual/RM09/AppendixF.html#Type5)
@@ -88,7 +88,7 @@ typedef enum
 
   HB_AAT_LAYOUT_FEATURE_TYPE_ALL_TYPOGRAPHIC                    = 0,
   HB_AAT_LAYOUT_FEATURE_TYPE_LIGATURES                          = 1,
-  HB_AAT_LAYOUT_FEATURE_TYPE_CURISVE_CONNECTION                 = 2,
+  HB_AAT_LAYOUT_FEATURE_TYPE_CURSIVE_CONNECTION                 = 2,
   HB_AAT_LAYOUT_FEATURE_TYPE_LETTER_CASE                        = 3,
   HB_AAT_LAYOUT_FEATURE_TYPE_VERTICAL_SUBSTITUTION              = 4,
   HB_AAT_LAYOUT_FEATURE_TYPE_LINGUISTIC_REARRANGEMENT           = 5,
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-aat-layout.hh b/src/java.desktop/share/native/libharfbuzz/hb-aat-layout.hh
index 36bb0ef07ddb..ee33223651a0 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-aat-layout.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-aat-layout.hh
@@ -32,6 +32,9 @@
 #include "hb-ot-shape.hh"
 #include "hb-aat-ltag-table.hh"
 
+/* https://developer.apple.com/documentation/coretext/1508745-ctfontcreatewithgraphicsfont */
+#define HB_CORETEXT_DEFAULT_FONT_SIZE 12.f
+
 struct hb_aat_feature_mapping_t
 {
   hb_tag_t otFeatureTag;
@@ -68,10 +71,5 @@ hb_aat_layout_position (const hb_ot_shape_plan_t *plan,
                         hb_font_t *font,
                         hb_buffer_t *buffer);
 
-HB_INTERNAL void
-hb_aat_layout_track (const hb_ot_shape_plan_t *plan,
-                     hb_font_t *font,
-                     hb_buffer_t *buffer);
-
 
 #endif /* HB_AAT_LAYOUT_HH */
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-aat-ltag-table.hh b/src/java.desktop/share/native/libharfbuzz/hb-aat-ltag-table.hh
index 17b341ef277e..da4dcb1212fd 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-aat-ltag-table.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-aat-ltag-table.hh
@@ -46,7 +46,9 @@ struct FTStringRange
   bool sanitize (hb_sanitize_context_t *c, const void *base) const
   {
     TRACE_SANITIZE (this);
-    return_trace (c->check_struct (this) && (base+tag).sanitize (c, length));
+    return_trace (c->check_struct (this) &&
+                  hb_barrier () &&
+                  (base+tag).sanitize (c, length));
   }
 
   protected:
@@ -73,6 +75,7 @@ struct ltag
   {
     TRACE_SANITIZE (this);
     return_trace (likely (c->check_struct (this) &&
+                          hb_barrier () &&
                           version >= 1 &&
                           tagRanges.sanitize (c, this)));
   }
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-aat-map.cc b/src/java.desktop/share/native/libharfbuzz/hb-aat-map.cc
index 122f29dc6816..e0e9d14d9b8f 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-aat-map.cc
+++ b/src/java.desktop/share/native/libharfbuzz/hb-aat-map.cc
@@ -88,22 +88,23 @@ hb_aat_map_builder_t::compile (hb_aat_map_t  &m)
 
   /* Sort features by start/end events. */
   hb_vector_t feature_events;
+  feature_events.alloc_exact (features.length * 2 + 1);
   for (unsigned int i = 0; i < features.length; i++)
   {
-    auto &feature = features[i];
+    auto &feature = features.arrayZ[i];
 
-    if (features[i].start == features[i].end)
+    if (feature.start == feature.end)
       continue;
 
     feature_event_t *event;
 
     event = feature_events.push ();
-    event->index = features[i].start;
+    event->index = feature.start;
     event->start = true;
     event->feature = feature.info;
 
     event = feature_events.push ();
-    event->index = features[i].end;
+    event->index = feature.end;
     event->start = false;
     event->feature = feature.info;
   }
@@ -139,12 +140,12 @@ hb_aat_map_builder_t::compile (hb_aat_map_t  &m)
         current_features.qsort ();
         unsigned int j = 0;
         for (unsigned int i = 1; i < current_features.length; i++)
-          if (current_features[i].type != current_features[j].type ||
+          if (current_features.arrayZ[i].type != current_features.arrayZ[j].type ||
               /* Nonexclusive feature selectors come in even/odd pairs to turn a setting on/off
                * respectively, so we mask out the low-order bit when checking for "duplicates"
                * (selectors referring to the same feature setting) here. */
-              (!current_features[i].is_exclusive && ((current_features[i].setting & ~1) != (current_features[j].setting & ~1))))
-            current_features[++j] = current_features[i];
+              (!current_features.arrayZ[i].is_exclusive && ((current_features.arrayZ[i].setting & ~1) != (current_features.arrayZ[j].setting & ~1))))
+            current_features.arrayZ[++j] = current_features.arrayZ[i];
         current_features.shrink (j + 1);
       }
 
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-algs.hh b/src/java.desktop/share/native/libharfbuzz/hb-algs.hh
index b2b7c2567392..6e250bfdef0e 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-algs.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-algs.hh
@@ -202,8 +202,12 @@ struct BEInt
 /* Floats. */
 
 /* We want our rounding towards +infinity. */
+static inline double
+_hb_roundf (double x) { return floor (x + .5); }
+
 static inline float
 _hb_roundf (float x) { return floorf (x + .5f); }
+
 #define roundf(x) _hb_roundf(x)
 
 
@@ -282,7 +286,7 @@ HB_FUNCOBJ (hb_bool);
 
 // Compression function for Merkle-Damgard construction.
 // This function is generated using the framework provided.
-#define mix(h) (                                        \
+#define fasthash_mix(h) (                                       \
                         (void) ((h) ^= (h) >> 23),              \
                         (void) ((h) *= 0x2127599bf4325c37ULL),  \
                         (h) ^= (h) >> 47)
@@ -306,7 +310,7 @@ static inline uint64_t fasthash64(const void *buf, size_t len, uint64_t seed)
 #pragma GCC diagnostic ignored "-Wcast-align"
             v  = * (const uint64_t *) (pos++);
 #pragma GCC diagnostic pop
-            h ^= mix(v);
+            h ^= fasthash_mix(v);
             h *= m;
           }
         }
@@ -316,7 +320,7 @@ static inline uint64_t fasthash64(const void *buf, size_t len, uint64_t seed)
           while (pos != end)
           {
             v  = pos++->v;
-            h ^= mix(v);
+            h ^= fasthash_mix(v);
             h *= m;
           }
         }
@@ -332,11 +336,11 @@ static inline uint64_t fasthash64(const void *buf, size_t len, uint64_t seed)
         case 3: v ^= (uint64_t)pos2[2] << 16; HB_FALLTHROUGH;
         case 2: v ^= (uint64_t)pos2[1] <<  8; HB_FALLTHROUGH;
         case 1: v ^= (uint64_t)pos2[0];
-                h ^= mix(v);
+                h ^= fasthash_mix(v);
                 h *= m;
         }
 
-        return mix(h);
+        return fasthash_mix(h);
 }
 
 static inline uint32_t fasthash32(const void *buf, size_t len, uint32_t seed)
@@ -671,7 +675,7 @@ struct hb_pair_t
     return 0;
   }
 
-  friend void swap (hb_pair_t& a, hb_pair_t& b)
+  friend void swap (hb_pair_t& a, hb_pair_t& b) noexcept
   {
     hb_swap (a.first, b.first);
     hb_swap (a.second, b.second);
@@ -1053,6 +1057,18 @@ _hb_cmp_method (const void *pkey, const void *pval, Ts... ds)
   return val.cmp (key, ds...);
 }
 
+template 
+static int
+_hb_cmp_operator (const void *pkey, const void *pval)
+{
+  const K& key = * (const K*) pkey;
+  const V& val = * (const V*) pval;
+
+  if (key < val) return -1;
+  if (key > val) return  1;
+  return 0;
+}
+
 template 
 static inline bool
 hb_bsearch_impl (unsigned *pos, /* Out */
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-array.hh b/src/java.desktop/share/native/libharfbuzz/hb-array.hh
index 439f18259cf5..d65bbc5c7115 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-array.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-array.hh
@@ -47,6 +47,8 @@ enum hb_not_found_t
 template 
 struct hb_array_t : hb_iter_with_fallback_t, Type&>
 {
+  static constexpr bool realloc_move = true;
+
   /*
    * Constructors.
    */
@@ -249,7 +251,8 @@ struct hb_array_t : hb_iter_with_fallback_t, Type&>
     if (end < start + 2)
       return;
 
-    for (unsigned lhs = start, rhs = end - 1; lhs < rhs; lhs++, rhs--)
+    unsigned stop = start + (end - start) / 2;
+    for (unsigned lhs = start, rhs = end - 1; lhs < stop; lhs++, rhs--)
       hb_swap (arrayZ[rhs], arrayZ[lhs]);
   }
 
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-atomic.hh b/src/java.desktop/share/native/libharfbuzz/hb-atomic.hh
index 459d82e0f2e7..d2de5f693f01 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-atomic.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-atomic.hh
@@ -118,12 +118,12 @@ _hb_atomic_ptr_impl_cmplexch (const void **P, const void *O_, const void *N)
  */
 #ifndef _hb_compiler_memory_r_barrier
 #if defined(__ATOMIC_ACQUIRE) // gcc-like
-#define _hb_compiler_memory_r_barrier() asm volatile("": : :"memory")
+static inline void _hb_compiler_memory_r_barrier () { asm volatile("": : :"memory"); }
 #elif !defined(_MSC_VER)
 #include 
 #define _hb_compiler_memory_r_barrier() std::atomic_signal_fence (std::memory_order_acquire)
 #else
-#define _hb_compiler_memory_r_barrier() do {} while (0)
+static inline void _hb_compiler_memory_r_barrier () {}
 #endif
 #endif
 
@@ -212,11 +212,18 @@ struct hb_atomic_ptr_t
   T *get_acquire () const { return (T *) hb_atomic_ptr_impl_get ((void **) &v); }
   bool cmpexch (const T *old, T *new_) const { return hb_atomic_ptr_impl_cmpexch ((void **) &v, (void *) old, (void *) new_); }
 
+  operator bool () const { return get_acquire () != nullptr; }
   T * operator -> () const                    { return get_acquire (); }
   template  operator C * () const { return get_acquire (); }
 
   T *v = nullptr;
 };
 
+static inline bool hb_barrier ()
+{
+  _hb_compiler_memory_r_barrier ();
+  return true;
+}
+
 
 #endif /* HB_ATOMIC_HH */
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-bit-page.hh b/src/java.desktop/share/native/libharfbuzz/hb-bit-page.hh
index 404a19ce557f..9562a9674a55 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-bit-page.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-bit-page.hh
@@ -78,6 +78,28 @@ struct hb_vector_size_t
   hb_vector_size_t operator ~ () const
   { return process (hb_bitwise_neg); }
 
+  operator bool () const
+  {
+    for (unsigned int i = 0; i < ARRAY_LENGTH (v); i++)
+      if (v[i])
+        return true;
+    return false;
+  }
+  operator unsigned int () const
+  {
+    unsigned int r = 0;
+    for (unsigned int i = 0; i < ARRAY_LENGTH (v); i++)
+      r += hb_popcount (v[i]);
+    return r;
+  }
+  bool operator == (const hb_vector_size_t &o) const
+  {
+    for (unsigned int i = 0; i < ARRAY_LENGTH (v); i++)
+      if (v[i] != o.v[i])
+        return false;
+    return true;
+  }
+
   hb_array_t iter () const
   { return hb_array (v); }
 
@@ -89,6 +111,8 @@ struct hb_vector_size_t
 
 struct hb_bit_page_t
 {
+  hb_bit_page_t () { init0 (); }
+
   void init0 () { v.init0 (); population = 0; }
   void init1 () { v.init1 (); population = PAGE_BITS; }
 
@@ -101,10 +125,9 @@ struct hb_bit_page_t
   bool is_empty () const
   {
     if (has_population ()) return !population;
-    return
-    + hb_iter (v)
-    | hb_none
-    ;
+    bool empty = !v;
+    if (empty) population = 0;
+    return empty;
   }
   uint32_t hash () const
   {
@@ -115,6 +138,10 @@ struct hb_bit_page_t
   void del (hb_codepoint_t g) { elt (g) &= ~mask (g); dirty (); }
   void set (hb_codepoint_t g, bool value) { if (value) add (g); else del (g); }
   bool get (hb_codepoint_t g) const { return elt (g) & mask (g); }
+  bool may_have (hb_codepoint_t g) const { return get (g); }
+
+  bool operator [] (hb_codepoint_t g) const { return get (g); }
+  bool operator () (hb_codepoint_t g) const { return get (g); }
 
   void add_range (hb_codepoint_t a, hb_codepoint_t b)
   {
@@ -220,13 +247,17 @@ struct hb_bit_page_t
   }
 
   bool operator == (const hb_bit_page_t &other) const { return is_equal (other); }
-  bool is_equal (const hb_bit_page_t &other) const
+  bool is_equal (const hb_bit_page_t &other) const { return v == other.v; }
+  bool intersects (const hb_bit_page_t &other) const
   {
     for (unsigned i = 0; i < len (); i++)
-      if (v[i] != other.v[i])
-        return false;
-    return true;
+      if (v[i] & other.v[i])
+        return true;
+    return false;
   }
+  bool may_intersect (const hb_bit_page_t &other) const
+  { return intersects (other); }
+
   bool operator <= (const hb_bit_page_t &larger_page) const { return is_subset (larger_page); }
   bool is_subset (const hb_bit_page_t &larger_page) const
   {
@@ -241,14 +272,10 @@ struct hb_bit_page_t
   }
 
   bool has_population () const { return population != UINT_MAX; }
-  unsigned int get_population () const
+  unsigned get_population () const
   {
     if (has_population ()) return population;
-    population =
-    + hb_iter (v)
-    | hb_reduce ([] (unsigned pop, const elt_t &_) { return pop + hb_popcount (_); }, 0u)
-    ;
-    return population;
+    return population = v;
   }
 
   bool next (hb_codepoint_t *codepoint) const
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-bit-set-invertible.hh b/src/java.desktop/share/native/libharfbuzz/hb-bit-set-invertible.hh
index 2e335549e260..740a2437671a 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-bit-set-invertible.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-bit-set-invertible.hh
@@ -39,10 +39,10 @@ struct hb_bit_set_invertible_t
 
   hb_bit_set_invertible_t () = default;
   hb_bit_set_invertible_t (const hb_bit_set_invertible_t& o) = default;
-  hb_bit_set_invertible_t (hb_bit_set_invertible_t&& other) : hb_bit_set_invertible_t () { hb_swap (*this, other); }
+  hb_bit_set_invertible_t (hb_bit_set_invertible_t&& other)  noexcept : hb_bit_set_invertible_t () { hb_swap (*this, other); }
   hb_bit_set_invertible_t& operator= (const hb_bit_set_invertible_t& o) = default;
-  hb_bit_set_invertible_t& operator= (hb_bit_set_invertible_t&& other) { hb_swap (*this, other); return *this; }
-  friend void swap (hb_bit_set_invertible_t &a, hb_bit_set_invertible_t &b)
+  hb_bit_set_invertible_t& operator= (hb_bit_set_invertible_t&& other)  noexcept { hb_swap (*this, other); return *this; }
+  friend void swap (hb_bit_set_invertible_t &a, hb_bit_set_invertible_t &b) noexcept
   {
     if (likely (!a.s.successful || !b.s.successful))
       return;
@@ -126,6 +126,7 @@ struct hb_bit_set_invertible_t
   { unlikely (inverted) ? (void) s.add_range (a, b) : s.del_range (a, b); }
 
   bool get (hb_codepoint_t g) const { return s.get (g) ^ inverted; }
+  bool may_have (hb_codepoint_t g) const { return get (g); }
 
   /* Has interface. */
   bool operator [] (hb_codepoint_t k) const { return get (k); }
@@ -139,6 +140,9 @@ struct hb_bit_set_invertible_t
   hb_bit_set_invertible_t& operator << (const hb_codepoint_pair_t& range)
   { add_range (range.first, range.second); return *this; }
 
+  bool may_intersect (const hb_bit_set_invertible_t &other) const
+  { return inverted || other.inverted || s.intersects (other.s); }
+
   bool intersects (hb_codepoint_t first, hb_codepoint_t last) const
   {
     hb_codepoint_t c = first - 1;
@@ -359,8 +363,8 @@ struct hb_bit_set_invertible_t
     typedef hb_codepoint_t __item_t__;
     hb_codepoint_t __item__ () const { return v; }
     bool __more__ () const { return v != INVALID; }
-    void __next__ () { s->next (&v); if (l) l--; }
-    void __prev__ () { s->previous (&v); }
+    void __next__ () { s->next (&v); if (likely (l)) l--; }
+    void __prev__ () { s->previous (&v); l++; }
     unsigned __len__ () const { return l; }
     iter_t end () const { return iter_t (*s, false); }
     bool operator != (const iter_t& o) const
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-bit-set.hh b/src/java.desktop/share/native/libharfbuzz/hb-bit-set.hh
index b900711a33a9..c42e617f67a4 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-bit-set.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-bit-set.hh
@@ -38,10 +38,10 @@ struct hb_bit_set_t
   ~hb_bit_set_t () = default;
 
   hb_bit_set_t (const hb_bit_set_t& other) : hb_bit_set_t () { set (other, true); }
-  hb_bit_set_t ( hb_bit_set_t&& other) : hb_bit_set_t () { hb_swap (*this, other); }
+  hb_bit_set_t ( hb_bit_set_t&& other)  noexcept : hb_bit_set_t () { hb_swap (*this, other); }
   hb_bit_set_t& operator= (const hb_bit_set_t& other) { set (other); return *this; }
-  hb_bit_set_t& operator= (hb_bit_set_t&& other) { hb_swap (*this, other); return *this; }
-  friend void swap (hb_bit_set_t &a, hb_bit_set_t &b)
+  hb_bit_set_t& operator= (hb_bit_set_t&& other)  noexcept { hb_swap (*this, other); return *this; }
+  friend void swap (hb_bit_set_t &a, hb_bit_set_t &b) noexcept
   {
     if (likely (!a.successful || !b.successful))
       return;
@@ -88,10 +88,11 @@ struct hb_bit_set_t
   {
     if (unlikely (!successful)) return false;
 
-    if (pages.length == 0 && count == 1)
+    if (pages.length < count && count <= 2)
       exact_size = true; // Most sets are small and local
 
-    if (unlikely (!pages.resize (count, clear, exact_size) || !page_map.resize (count, clear, exact_size)))
+    if (unlikely (!pages.resize (count, clear, exact_size) ||
+        !page_map.resize (count, clear)))
     {
       pages.resize (page_map.length, clear, exact_size);
       successful = false;
@@ -297,9 +298,9 @@ struct hb_bit_set_t
       unsigned int write_index = 0;
       for (unsigned int i = 0; i < page_map.length; i++)
       {
-        int m = (int) page_map[i].major;
+        int m = (int) page_map.arrayZ[i].major;
         if (m < ds || de < m)
-          page_map[write_index++] = page_map[i];
+          page_map.arrayZ[write_index++] = page_map.arrayZ[i];
       }
       compact (compact_workspace, write_index);
       resize (write_index);
@@ -345,6 +346,7 @@ struct hb_bit_set_t
       return false;
     return page->get (g);
   }
+  bool may_have (hb_codepoint_t g) const { return get (g); }
 
   /* Has interface. */
   bool operator [] (hb_codepoint_t k) const { return get (k); }
@@ -358,6 +360,31 @@ struct hb_bit_set_t
   hb_bit_set_t& operator << (const hb_codepoint_pair_t& range)
   { add_range (range.first, range.second); return *this; }
 
+  bool intersects (const hb_bit_set_t &other) const
+  {
+    unsigned int na = pages.length;
+    unsigned int nb = other.pages.length;
+
+    unsigned int a = 0, b = 0;
+    for (; a < na && b < nb; )
+    {
+      if (page_map.arrayZ[a].major == other.page_map.arrayZ[b].major)
+      {
+        if (page_at (a).intersects (other.page_at (b)))
+          return true;
+        a++;
+        b++;
+      }
+      else if (page_map.arrayZ[a].major < other.page_map.arrayZ[b].major)
+        a++;
+      else
+        b++;
+    }
+    return false;
+  }
+  bool may_intersect (const hb_bit_set_t &other) const
+  { return intersects (other); }
+
   bool intersects (hb_codepoint_t first, hb_codepoint_t last) const
   {
     hb_codepoint_t c = first - 1;
@@ -389,7 +416,7 @@ struct hb_bit_set_t
     {
       if (page_at (a).is_empty ()) { a++; continue; }
       if (other.page_at (b).is_empty ()) { b++; continue; }
-      if (page_map[a].major != other.page_map[b].major ||
+      if (page_map.arrayZ[a].major != other.page_map.arrayZ[b].major ||
           !page_at (a).is_equal (other.page_at (b)))
         return false;
       a++;
@@ -412,8 +439,8 @@ struct hb_bit_set_t
     uint32_t spi = 0;
     for (uint32_t lpi = 0; spi < page_map.length && lpi < larger_set.page_map.length; lpi++)
     {
-      uint32_t spm = page_map[spi].major;
-      uint32_t lpm = larger_set.page_map[lpi].major;
+      uint32_t spm = page_map.arrayZ[spi].major;
+      uint32_t lpm = larger_set.page_map.arrayZ[lpi].major;
       auto sp = page_at (spi);
 
       if (spm < lpm && !sp.is_empty ())
@@ -503,7 +530,7 @@ struct hb_bit_set_t
 
     for (; a < na && b < nb; )
     {
-      if (page_map[a].major == other.page_map[b].major)
+      if (page_map.arrayZ[a].major == other.page_map.arrayZ[b].major)
       {
         if (!passthru_left)
         {
@@ -512,7 +539,7 @@ struct hb_bit_set_t
           // passthru_left is set since no left side pages will be removed
           // in that case.
           if (write_index < a)
-            page_map[write_index] = page_map[a];
+            page_map.arrayZ[write_index] = page_map.arrayZ[a];
           write_index++;
         }
 
@@ -520,7 +547,7 @@ struct hb_bit_set_t
         a++;
         b++;
       }
-      else if (page_map[a].major < other.page_map[b].major)
+      else if (page_map.arrayZ[a].major < other.page_map.arrayZ[b].major)
       {
         if (passthru_left)
           count++;
@@ -765,8 +792,8 @@ struct hb_bit_set_t
     unsigned int initial_size = size;
     for (unsigned int i = start_page; i < page_map.length && size; i++)
     {
-      uint32_t base = major_start (page_map[i].major);
-      unsigned int n = pages[page_map[i].index].write (base, start_page_value, out, size);
+      uint32_t base = major_start (page_map.arrayZ[i].major);
+      unsigned int n = pages[page_map.arrayZ[i].index].write (base, start_page_value, out, size);
       out += n;
       size -= n;
       start_page_value = 0;
@@ -814,8 +841,8 @@ struct hb_bit_set_t
     hb_codepoint_t next_value = codepoint + 1;
     for (unsigned int i=start_page; i= 0; i--)
     {
-      const auto& map = page_map[(unsigned) i];
-      const auto& page = pages[map.index];
+      const auto& map = page_map.arrayZ[(unsigned) i];
+      const auto& page = pages.arrayZ[map.index];
 
       if (!page.is_empty ())
         return map.major * page_t::PAGE_BITS + page.get_max ();
@@ -961,7 +988,7 @@ struct hb_bit_set_t
       return nullptr;
 
     last_page_lookup = i;
-    return &pages.arrayZ[page_map[i].index];
+    return &pages.arrayZ[page_map.arrayZ[i].index];
   }
   page_t &page_at (unsigned int i)
   {
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-blob.cc b/src/java.desktop/share/native/libharfbuzz/hb-blob.cc
index 2a43afa1a435..a19599fac09a 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-blob.cc
+++ b/src/java.desktop/share/native/libharfbuzz/hb-blob.cc
@@ -598,6 +598,11 @@ _open_resource_fork (const char *file_name, hb_mapped_file_t *file)
  * Creates a new blob containing the data from the
  * specified binary font file.
  *
+ * The filename is passed directly to the system on all platforms,
+ * except on Windows, where the filename is interpreted as UTF-8.
+ * Only if the filename is not valid UTF-8, it will be interpreted
+ * according to the system codepage.
+ *
  * Returns: An #hb_blob_t pointer with the content of the file,
  * or hb_blob_get_empty() if failed.
  *
@@ -612,10 +617,14 @@ hb_blob_create_from_file (const char *file_name)
 
 /**
  * hb_blob_create_from_file_or_fail:
- * @file_name: A font filename
+ * @file_name: A filename
  *
- * Creates a new blob containing the data from the
- * specified binary font file.
+ * Creates a new blob containing the data from the specified file.
+ *
+ * The filename is passed directly to the system on all platforms,
+ * except on Windows, where the filename is interpreted as UTF-8.
+ * Only if the filename is not valid UTF-8, it will be interpreted
+ * according to the system codepage.
  *
  * Returns: An #hb_blob_t pointer with the content of the file,
  * or `NULL` if failed.
@@ -672,10 +681,19 @@ hb_blob_create_from_file_or_fail (const char *file_name)
   if (unlikely (!file)) return nullptr;
 
   HANDLE fd;
+  int conversion;
   unsigned int size = strlen (file_name) + 1;
   wchar_t * wchar_file_name = (wchar_t *) hb_malloc (sizeof (wchar_t) * size);
   if (unlikely (!wchar_file_name)) goto fail_without_close;
-  mbstowcs (wchar_file_name, file_name, size);
+
+  /* Assume file name is given in UTF-8 encoding */
+  conversion = MultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, file_name, -1, wchar_file_name, size);
+  if (conversion <= 0)
+  {
+    /* Conversion failed due to invalid UTF-8 characters,
+       Repeat conversion based on system code page */
+    mbstowcs(wchar_file_name, file_name, size);
+  }
 #if !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)
   {
     CREATEFILE2_EXTENDED_PARAMETERS ceparams = { 0 };
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-buffer-deserialize-json.hh b/src/java.desktop/share/native/libharfbuzz/hb-buffer-deserialize-json.hh
index 2a90cbfe3eae..69cc16402300 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-buffer-deserialize-json.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-buffer-deserialize-json.hh
@@ -34,36 +34,36 @@
 
 #line 36 "hb-buffer-deserialize-json.hh"
 static const unsigned char _deserialize_json_trans_keys[] = {
-        0u, 0u, 9u, 123u, 9u, 34u, 97u, 117u, 120u, 121u, 34u, 34u, 9u, 58u, 9u, 57u,
-        48u, 57u, 9u, 125u, 9u, 125u, 9u, 93u, 9u, 125u, 34u, 34u, 9u, 58u, 9u, 57u,
+        0u, 0u, 9u, 123u, 9u, 123u, 9u, 34u, 97u, 117u, 120u, 121u, 34u, 34u, 9u, 58u,
+        9u, 57u, 48u, 57u, 9u, 125u, 9u, 125u, 9u, 125u, 34u, 34u, 9u, 58u, 9u, 57u,
         48u, 57u, 9u, 125u, 9u, 125u, 108u, 108u, 34u, 34u, 9u, 58u, 9u, 57u, 9u, 125u,
         9u, 125u, 120u, 121u, 34u, 34u, 9u, 58u, 9u, 57u, 48u, 57u, 9u, 125u, 9u, 125u,
         34u, 34u, 9u, 58u, 9u, 57u, 48u, 57u, 9u, 125u, 9u, 125u, 108u, 108u, 34u, 34u,
         9u, 58u, 9u, 57u, 9u, 125u, 9u, 125u, 34u, 34u, 9u, 58u, 9u, 57u, 34u, 92u,
         9u, 125u, 34u, 92u, 9u, 125u, 9u, 125u, 34u, 34u, 9u, 58u, 9u, 57u, 9u, 125u,
-        9u, 123u, 0u, 0u, 0
+        9u, 93u, 9u, 123u, 0u, 0u, 0
 };
 
 static const char _deserialize_json_key_spans[] = {
-        0, 115, 26, 21, 2, 1, 50, 49,
-        10, 117, 117, 85, 117, 1, 50, 49,
+        0, 115, 115, 26, 21, 2, 1, 50,
+        49, 10, 117, 117, 117, 1, 50, 49,
         10, 117, 117, 1, 1, 50, 49, 117,
         117, 2, 1, 50, 49, 10, 117, 117,
         1, 50, 49, 10, 117, 117, 1, 1,
         50, 49, 117, 117, 1, 50, 49, 59,
         117, 59, 117, 117, 1, 50, 49, 117,
-        115, 0
+        85, 115, 0
 };
 
 static const short _deserialize_json_index_offsets[] = {
-        0, 0, 116, 143, 165, 168, 170, 221,
-        271, 282, 400, 518, 604, 722, 724, 775,
-        825, 836, 954, 1072, 1074, 1076, 1127, 1177,
-        1295, 1413, 1416, 1418, 1469, 1519, 1530, 1648,
-        1766, 1768, 1819, 1869, 1880, 1998, 2116, 2118,
-        2120, 2171, 2221, 2339, 2457, 2459, 2510, 2560,
-        2620, 2738, 2798, 2916, 3034, 3036, 3087, 3137,
-        3255, 3371
+        0, 0, 116, 232, 259, 281, 284, 286,
+        337, 387, 398, 516, 634, 752, 754, 805,
+        855, 866, 984, 1102, 1104, 1106, 1157, 1207,
+        1325, 1443, 1446, 1448, 1499, 1549, 1560, 1678,
+        1796, 1798, 1849, 1899, 1910, 2028, 2146, 2148,
+        2150, 2201, 2251, 2369, 2487, 2489, 2540, 2590,
+        2650, 2768, 2828, 2946, 3064, 3066, 3117, 3167,
+        3285, 3371, 3487
 };
 
 static const char _deserialize_json_indicies[] = {
@@ -77,51 +77,51 @@ static const char _deserialize_json_indicies[] = {
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
+        1, 1, 1, 2, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
+        1, 1, 1, 3, 1, 2, 2, 2,
+        2, 2, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        1, 1, 1, 2, 1, 3, 3, 3,
-        3, 3, 1, 1, 1, 1, 1, 1,
+        1, 1, 1, 1, 2, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        1, 1, 1, 1, 3, 1, 4, 1,
-        5, 1, 6, 7, 1, 8, 9, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        1, 1, 1, 1, 10, 1, 11, 12,
-        1, 13, 1, 13, 13, 13, 13, 13,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        1, 1, 13, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        1, 1, 1, 1, 14, 1, 14, 14,
-        14, 14, 14, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        1, 1, 1, 1, 1, 14, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        1, 1, 15, 1, 1, 16, 17, 17,
-        17, 17, 17, 17, 17, 17, 17, 1,
-        18, 19, 19, 19, 19, 19, 19, 19,
-        19, 19, 1, 20, 20, 20, 20, 20,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        1, 1, 20, 1, 1, 1, 1, 1,
-        1, 1, 1, 1, 1, 1, 21, 1,
+        1, 1, 1, 1, 1, 1, 1, 3,
+        1, 4, 4, 4, 4, 4, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
+        4, 1, 5, 1, 6, 1, 7, 8,
+        1, 9, 10, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
+        11, 1, 12, 13, 1, 14, 1, 14,
+        14, 14, 14, 14, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
+        1, 1, 1, 1, 1, 1, 14, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
+        15, 1, 15, 15, 15, 15, 15, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        1, 1, 1, 1, 1, 1, 1, 22,
-        1, 23, 23, 23, 23, 23, 1, 1,
+        1, 15, 1, 1, 1, 1, 1, 1,
+        1, 1, 1, 1, 1, 1, 16, 1,
+        1, 17, 18, 18, 18, 18, 18, 18,
+        18, 18, 18, 1, 19, 20, 20, 20,
+        20, 20, 20, 20, 20, 20, 1, 21,
+        21, 21, 21, 21, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
+        1, 1, 1, 1, 1, 1, 21, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        23, 1, 1, 1, 1, 1, 1, 1,
-        1, 1, 1, 1, 3, 1, 1, 1,
+        1, 1, 22, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
@@ -131,94 +131,99 @@ static const char _deserialize_json_indicies[] = {
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        1, 1, 1, 1, 1, 24, 1, 25,
-        25, 25, 25, 25, 1, 1, 1, 1,
+        1, 1, 1, 23, 1, 24, 24, 24,
+        24, 24, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        1, 1, 1, 1, 1, 1, 25, 1,
+        1, 1, 1, 1, 24, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        1, 1, 26, 1, 1, 1, 1, 1,
+        4, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        1, 1, 1, 27, 1, 20, 20, 20,
-        20, 20, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        1, 1, 1, 1, 20, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        21, 1, 1, 1, 19, 19, 19, 19,
-        19, 19, 19, 19, 19, 19, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
+        1, 25, 1, 21, 21, 21, 21, 21,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
+        1, 1, 21, 1, 1, 1, 1, 1,
+        1, 1, 1, 1, 1, 1, 22, 1,
+        1, 1, 20, 20, 20, 20, 20, 20,
+        20, 20, 20, 20, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        1, 22, 1, 28, 1, 28, 28, 28,
-        28, 28, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        1, 1, 1, 1, 28, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        1, 1, 1, 1, 1, 1, 29, 1,
-        29, 29, 29, 29, 29, 1, 1, 1,
+        1, 1, 1, 1, 1, 1, 1, 23,
+        1, 26, 1, 26, 26, 26, 26, 26,
         1, 1, 1, 1, 1, 1, 1, 1,
-        1, 1, 1, 1, 1, 1, 1, 29,
         1, 1, 1, 1, 1, 1, 1, 1,
-        1, 1, 1, 1, 30, 1, 1, 31,
-        32, 32, 32, 32, 32, 32, 32, 32,
-        32, 1, 33, 34, 34, 34, 34, 34,
-        34, 34, 34, 34, 1, 35, 35, 35,
-        35, 35, 1, 1, 1, 1, 1, 1,
+        1, 1, 26, 1, 1, 1, 1, 1,
+        1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        1, 1, 1, 1, 35, 1, 1, 1,
+        1, 1, 1, 1, 27, 1, 27, 27,
+        27, 27, 27, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        36, 1, 1, 1, 1, 1, 1, 1,
+        1, 1, 1, 1, 1, 27, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
+        1, 1, 28, 1, 1, 29, 30, 30,
+        30, 30, 30, 30, 30, 30, 30, 1,
+        31, 32, 32, 32, 32, 32, 32, 32,
+        32, 32, 1, 33, 33, 33, 33, 33,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
+        1, 1, 33, 1, 1, 1, 1, 1,
+        1, 1, 1, 1, 1, 1, 34, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        1, 37, 1, 35, 35, 35, 35, 35,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        1, 1, 35, 1, 1, 1, 1, 1,
-        1, 1, 1, 1, 1, 1, 36, 1,
-        1, 1, 34, 34, 34, 34, 34, 34,
-        34, 34, 34, 34, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
+        1, 1, 1, 1, 1, 1, 1, 35,
+        1, 33, 33, 33, 33, 33, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
+        33, 1, 1, 1, 1, 1, 1, 1,
+        1, 1, 1, 1, 34, 1, 1, 1,
+        32, 32, 32, 32, 32, 32, 32, 32,
+        32, 32, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        1, 1, 1, 1, 1, 1, 1, 37,
-        1, 38, 1, 39, 1, 39, 39, 39,
-        39, 39, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        1, 1, 1, 1, 39, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        1, 1, 1, 1, 1, 1, 40, 1,
-        40, 40, 40, 40, 40, 1, 1, 1,
+        1, 1, 1, 1, 1, 35, 1, 36,
+        1, 37, 1, 37, 37, 37, 37, 37,
         1, 1, 1, 1, 1, 1, 1, 1,
-        1, 1, 1, 1, 1, 1, 1, 40,
+        1, 1, 1, 1, 1, 1, 1, 1,
+        1, 1, 37, 1, 1, 1, 1, 1,
+        1, 1, 1, 1, 1, 1, 1, 1,
+        1, 1, 1, 1, 1, 1, 1, 1,
+        1, 1, 1, 1, 38, 1, 38, 38,
+        38, 38, 38, 1, 1, 1, 1, 1,
+        1, 1, 1, 1, 1, 1, 1, 1,
+        1, 1, 1, 1, 1, 38, 1, 1,
+        1, 1, 1, 1, 1, 1, 1, 1,
+        1, 1, 1, 1, 1, 39, 40, 40,
+        40, 40, 40, 40, 40, 40, 40, 1,
+        41, 41, 41, 41, 41, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 41,
-        42, 42, 42, 42, 42, 42, 42, 42,
-        42, 1, 43, 43, 43, 43, 43, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
+        1, 1, 1, 42, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        1, 43, 1, 1, 1, 1, 1, 1,
-        1, 1, 1, 1, 1, 44, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
@@ -227,15 +232,14 @@ static const char _deserialize_json_indicies[] = {
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
+        1, 1, 1, 1, 43, 1, 41, 41,
+        41, 41, 41, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        1, 1, 1, 1, 1, 1, 45, 1,
-        43, 43, 43, 43, 43, 1, 1, 1,
+        1, 1, 1, 1, 1, 41, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        1, 1, 1, 1, 1, 1, 1, 43,
+        1, 42, 1, 1, 1, 44, 44, 44,
+        44, 44, 44, 44, 44, 44, 44, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        1, 1, 1, 44, 1, 1, 1, 46,
-        46, 46, 46, 46, 46, 46, 46, 46,
-        46, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
@@ -243,26 +247,26 @@ static const char _deserialize_json_indicies[] = {
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        1, 1, 1, 1, 45, 1, 47, 48,
-        1, 49, 1, 49, 49, 49, 49, 49,
+        1, 1, 43, 1, 45, 46, 1, 47,
+        1, 47, 47, 47, 47, 47, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        1, 1, 49, 1, 1, 1, 1, 1,
+        47, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        1, 1, 1, 1, 50, 1, 50, 50,
-        50, 50, 50, 1, 1, 1, 1, 1,
+        1, 1, 48, 1, 48, 48, 48, 48,
+        48, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        1, 1, 1, 1, 1, 50, 1, 1,
+        1, 1, 1, 48, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        1, 1, 51, 1, 1, 52, 53, 53,
-        53, 53, 53, 53, 53, 53, 53, 1,
-        54, 55, 55, 55, 55, 55, 55, 55,
-        55, 55, 1, 56, 56, 56, 56, 56,
+        49, 1, 1, 50, 51, 51, 51, 51,
+        51, 51, 51, 51, 51, 1, 52, 53,
+        53, 53, 53, 53, 53, 53, 53, 53,
+        1, 54, 54, 54, 54, 54, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        1, 1, 56, 1, 1, 1, 1, 1,
-        1, 1, 1, 1, 1, 1, 57, 1,
+        54, 1, 1, 1, 1, 1, 1, 1,
+        1, 1, 1, 1, 55, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
@@ -272,14 +276,13 @@ static const char _deserialize_json_indicies[] = {
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        1, 1, 1, 1, 1, 1, 1, 58,
-        1, 56, 56, 56, 56, 56, 1, 1,
+        1, 1, 1, 1, 1, 56, 1, 54,
+        54, 54, 54, 54, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
+        1, 1, 1, 1, 1, 1, 54, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        56, 1, 1, 1, 1, 1, 1, 1,
-        1, 1, 1, 1, 57, 1, 1, 1,
-        55, 55, 55, 55, 55, 55, 55, 55,
-        55, 55, 1, 1, 1, 1, 1, 1,
+        1, 1, 55, 1, 1, 1, 53, 53,
+        53, 53, 53, 53, 53, 53, 53, 53,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
@@ -287,119 +290,120 @@ static const char _deserialize_json_indicies[] = {
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        1, 1, 1, 1, 1, 58, 1, 59,
-        1, 59, 59, 59, 59, 59, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
+        1, 1, 1, 56, 1, 57, 1, 57,
+        57, 57, 57, 57, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        59, 1, 1, 1, 1, 1, 1, 1,
+        1, 1, 1, 1, 1, 1, 57, 1,
+        1, 1, 1, 1, 1, 1, 1, 1,
+        1, 1, 1, 1, 1, 1, 1, 1,
+        1, 1, 1, 1, 1, 1, 1, 1,
+        58, 1, 58, 58, 58, 58, 58, 1,
+        1, 1, 1, 1, 1, 1, 1, 1,
+        1, 1, 1, 1, 1, 1, 1, 1,
+        1, 58, 1, 1, 1, 1, 1, 1,
+        1, 1, 1, 1, 1, 1, 59, 1,
+        1, 60, 61, 61, 61, 61, 61, 61,
+        61, 61, 61, 1, 62, 63, 63, 63,
+        63, 63, 63, 63, 63, 63, 1, 64,
+        64, 64, 64, 64, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
+        1, 1, 1, 1, 1, 1, 64, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        1, 1, 60, 1, 60, 60, 60, 60,
-        60, 1, 1, 1, 1, 1, 1, 1,
+        1, 1, 65, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        1, 1, 1, 60, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        61, 1, 1, 62, 63, 63, 63, 63,
-        63, 63, 63, 63, 63, 1, 64, 65,
-        65, 65, 65, 65, 65, 65, 65, 65,
-        1, 66, 66, 66, 66, 66, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        66, 1, 1, 1, 1, 1, 1, 1,
-        1, 1, 1, 1, 67, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
+        1, 1, 1, 66, 1, 64, 64, 64,
+        64, 64, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
+        1, 1, 1, 1, 64, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
+        65, 1, 1, 1, 63, 63, 63, 63,
+        63, 63, 63, 63, 63, 63, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        1, 1, 1, 1, 1, 68, 1, 66,
-        66, 66, 66, 66, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        1, 1, 1, 1, 1, 1, 66, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        1, 1, 67, 1, 1, 1, 65, 65,
-        65, 65, 65, 65, 65, 65, 65, 65,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
+        1, 66, 1, 67, 1, 68, 1, 68,
+        68, 68, 68, 68, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
+        1, 1, 1, 1, 1, 1, 68, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        1, 1, 1, 68, 1, 69, 1, 70,
-        1, 70, 70, 70, 70, 70, 1, 1,
+        69, 1, 69, 69, 69, 69, 69, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        70, 1, 1, 1, 1, 1, 1, 1,
+        1, 69, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
+        1, 70, 71, 71, 71, 71, 71, 71,
+        71, 71, 71, 1, 72, 72, 72, 72,
+        72, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        1, 1, 71, 1, 71, 71, 71, 71,
-        71, 1, 1, 1, 1, 1, 1, 1,
+        1, 1, 1, 72, 1, 1, 1, 1,
+        1, 1, 1, 1, 1, 1, 1, 73,
         1, 1, 1, 1, 1, 1, 1, 1,
-        1, 1, 1, 71, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        1, 1, 1, 72, 73, 73, 73, 73,
-        73, 73, 73, 73, 73, 1, 74, 74,
-        74, 74, 74, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        1, 1, 1, 1, 1, 74, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        1, 75, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
+        74, 1, 72, 72, 72, 72, 72, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
+        1, 72, 1, 1, 1, 1, 1, 1,
+        1, 1, 1, 1, 1, 73, 1, 1,
+        1, 75, 75, 75, 75, 75, 75, 75,
+        75, 75, 75, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        1, 1, 76, 1, 74, 74, 74, 74,
-        74, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        1, 1, 1, 74, 1, 1, 1, 1,
-        1, 1, 1, 1, 1, 1, 1, 75,
-        1, 1, 1, 77, 77, 77, 77, 77,
-        77, 77, 77, 77, 77, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
+        1, 1, 1, 1, 1, 1, 74, 1,
+        76, 1, 76, 76, 76, 76, 76, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
+        1, 76, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        76, 1, 78, 1, 78, 78, 78, 78,
-        78, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        1, 1, 1, 78, 1, 1, 1, 1,
+        1, 1, 1, 77, 1, 77, 77, 77,
+        77, 77, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
+        1, 1, 1, 1, 77, 1, 78, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        1, 1, 1, 1, 1, 79, 1, 79,
-        79, 79, 79, 79, 1, 1, 1, 1,
+        1, 1, 1, 1, 79, 80, 80, 80,
+        80, 80, 80, 80, 80, 80, 1, 82,
+        81, 81, 81, 81, 81, 81, 81, 81,
+        81, 81, 81, 81, 81, 81, 81, 81,
+        81, 81, 81, 81, 81, 81, 81, 81,
+        81, 81, 81, 81, 81, 81, 81, 81,
+        81, 81, 81, 81, 81, 81, 81, 81,
+        81, 81, 81, 81, 81, 81, 81, 81,
+        81, 81, 81, 81, 81, 81, 81, 81,
+        81, 83, 81, 84, 84, 84, 84, 84,
         1, 1, 1, 1, 1, 1, 1, 1,
-        1, 1, 1, 1, 1, 1, 79, 1,
-        80, 1, 1, 1, 1, 1, 1, 1,
-        1, 1, 1, 1, 1, 1, 81, 82,
-        82, 82, 82, 82, 82, 82, 82, 82,
-        1, 84, 83, 83, 83, 83, 83, 83,
-        83, 83, 83, 83, 83, 83, 83, 83,
-        83, 83, 83, 83, 83, 83, 83, 83,
-        83, 83, 83, 83, 83, 83, 83, 83,
-        83, 83, 83, 83, 83, 83, 83, 83,
-        83, 83, 83, 83, 83, 83, 83, 83,
-        83, 83, 83, 83, 83, 83, 83, 83,
-        83, 83, 83, 85, 83, 86, 86, 86,
-        86, 86, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        1, 1, 1, 1, 86, 1, 1, 1,
+        1, 1, 84, 1, 1, 1, 1, 1,
+        1, 1, 1, 1, 1, 1, 85, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        87, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
@@ -408,20 +412,21 @@ static const char _deserialize_json_indicies[] = {
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
+        1, 1, 1, 1, 1, 1, 1, 86,
+        1, 81, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        1, 88, 1, 83, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
+        1, 1, 1, 81, 1, 87, 87, 87,
+        87, 87, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        1, 1, 1, 1, 1, 83, 1, 89,
-        89, 89, 89, 89, 1, 1, 1, 1,
+        1, 1, 1, 1, 87, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        1, 1, 1, 1, 1, 1, 89, 1,
+        88, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        1, 1, 90, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
@@ -430,97 +435,107 @@ static const char _deserialize_json_indicies[] = {
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
+        1, 89, 1, 87, 87, 87, 87, 87,
         1, 1, 1, 1, 1, 1, 1, 1,
-        1, 1, 1, 91, 1, 89, 89, 89,
-        89, 89, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        1, 1, 1, 1, 89, 1, 1, 1,
+        1, 1, 87, 1, 1, 1, 1, 1,
+        1, 1, 1, 1, 1, 1, 88, 1,
+        1, 1, 90, 90, 90, 90, 90, 90,
+        90, 90, 90, 90, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        90, 1, 1, 1, 92, 92, 92, 92,
-        92, 92, 92, 92, 92, 92, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
+        1, 1, 1, 1, 1, 1, 1, 89,
+        1, 91, 1, 91, 91, 91, 91, 91,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        1, 91, 1, 93, 1, 93, 93, 93,
-        93, 93, 1, 1, 1, 1, 1, 1,
+        1, 1, 91, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        1, 1, 1, 1, 93, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
+        1, 1, 1, 1, 92, 1, 92, 92,
+        92, 92, 92, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        1, 1, 1, 1, 1, 1, 94, 1,
-        94, 94, 94, 94, 94, 1, 1, 1,
+        1, 1, 1, 1, 1, 92, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        1, 1, 1, 1, 1, 1, 1, 94,
+        1, 1, 1, 1, 1, 93, 94, 94,
+        94, 94, 94, 94, 94, 94, 94, 1,
+        87, 87, 87, 87, 87, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        1, 1, 1, 1, 1, 1, 1, 95,
-        96, 96, 96, 96, 96, 96, 96, 96,
-        96, 1, 89, 89, 89, 89, 89, 1,
+        1, 1, 1, 1, 1, 1, 1, 87,
         1, 1, 1, 1, 1, 1, 1, 1,
+        1, 1, 1, 88, 1, 1, 1, 95,
+        95, 95, 95, 95, 95, 95, 95, 95,
+        95, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        1, 89, 1, 1, 1, 1, 1, 1,
-        1, 1, 1, 1, 1, 90, 1, 1,
-        1, 97, 97, 97, 97, 97, 97, 97,
-        97, 97, 97, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
+        1, 1, 1, 1, 89, 1, 96, 96,
+        96, 96, 96, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        1, 1, 1, 1, 1, 1, 91, 1,
-        0, 0, 0, 0, 0, 1, 1, 1,
+        1, 1, 1, 1, 1, 96, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        1, 1, 1, 1, 1, 1, 1, 0,
+        1, 97, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
+        1, 1, 98, 1, 2, 2, 2, 2,
+        2, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
+        1, 1, 1, 2, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
         1, 1, 1, 1, 1, 1, 1, 1,
-        1, 1, 2, 1, 1, 0
+        1, 1, 1, 1, 1, 1, 1, 1,
+        1, 1, 1, 1, 1, 1, 1, 1,
+        1, 1, 1, 1, 1, 1, 1, 1,
+        1, 1, 1, 1, 1, 1, 1, 1,
+        1, 1, 1, 1, 1, 1, 1, 1,
+        1, 1, 1, 1, 1, 1, 3, 1,
+        1, 0
 };
 
 static const char _deserialize_json_trans_targs[] = {
-        1, 0, 2, 2, 3, 4, 19, 25,
-        38, 44, 52, 5, 13, 6, 7, 8,
-        9, 12, 9, 12, 10, 2, 11, 10,
-        11, 11, 56, 57, 14, 15, 16, 17,
-        18, 17, 18, 10, 2, 11, 20, 21,
-        22, 23, 24, 10, 2, 11, 24, 26,
-        32, 27, 28, 29, 30, 31, 30, 31,
-        10, 2, 11, 33, 34, 35, 36, 37,
-        36, 37, 10, 2, 11, 39, 40, 41,
-        42, 43, 10, 2, 11, 43, 45, 46,
-        47, 50, 51, 47, 48, 49, 10, 2,
-        11, 10, 2, 11, 51, 53, 54, 50,
-        55, 55
+        1, 0, 2, 3, 3, 4, 5, 19,
+        25, 38, 44, 52, 6, 13, 7, 8,
+        9, 10, 12, 10, 12, 11, 3, 56,
+        11, 56, 14, 15, 16, 17, 18, 17,
+        18, 11, 3, 56, 20, 21, 22, 23,
+        24, 11, 3, 56, 24, 26, 32, 27,
+        28, 29, 30, 31, 30, 31, 11, 3,
+        56, 33, 34, 35, 36, 37, 36, 37,
+        11, 3, 56, 39, 40, 41, 42, 43,
+        11, 3, 56, 43, 45, 46, 47, 50,
+        51, 47, 48, 49, 11, 3, 56, 11,
+        3, 56, 51, 53, 54, 50, 55, 55,
+        56, 57, 58
 };
 
 static const char _deserialize_json_trans_actions[] = {
-        0, 0, 1, 0, 0, 0, 0, 0,
-        0, 0, 0, 0, 0, 0, 0, 2,
-        2, 2, 0, 0, 3, 3, 4, 0,
-        5, 0, 0, 0, 0, 0, 2, 2,
-        2, 0, 0, 6, 6, 7, 0, 0,
-        0, 2, 2, 8, 8, 9, 0, 0,
-        0, 0, 0, 2, 2, 2, 0, 0,
-        10, 10, 11, 0, 0, 2, 2, 2,
-        0, 0, 12, 12, 13, 0, 0, 0,
-        2, 2, 14, 14, 15, 0, 0, 0,
-        2, 16, 16, 0, 17, 0, 18, 18,
-        19, 20, 20, 21, 17, 0, 0, 22,
-        22, 23
+        0, 0, 0, 1, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        2, 2, 2, 0, 0, 3, 3, 4,
+        0, 5, 0, 0, 2, 2, 2, 0,
+        0, 6, 6, 7, 0, 0, 0, 2,
+        2, 8, 8, 9, 0, 0, 0, 0,
+        0, 2, 2, 2, 0, 0, 10, 10,
+        11, 0, 0, 2, 2, 2, 0, 0,
+        12, 12, 13, 0, 0, 0, 2, 2,
+        14, 14, 15, 0, 0, 0, 2, 16,
+        16, 0, 17, 0, 18, 18, 19, 20,
+        20, 21, 17, 0, 0, 22, 22, 23,
+        0, 0, 0
 };
 
 static const int deserialize_json_start = 1;
@@ -545,22 +560,17 @@ _hb_buffer_deserialize_json (hb_buffer_t *buffer,
   /* Ensure we have positions. */
   (void) hb_buffer_get_glyph_positions (buffer, nullptr);
 
-  while (p < pe && ISSPACE (*p))
-    p++;
-  if (p < pe && *p == (buffer->len ? ',' : '['))
-    *end_ptr = ++p;
-
   const char *tok = nullptr;
   int cs;
   hb_glyph_info_t info = {0};
   hb_glyph_position_t pos = {0};
 
-#line 559 "hb-buffer-deserialize-json.hh"
+#line 569 "hb-buffer-deserialize-json.hh"
         {
         cs = deserialize_json_start;
         }
 
-#line 564 "hb-buffer-deserialize-json.hh"
+#line 574 "hb-buffer-deserialize-json.hh"
         {
         int _slen;
         int _trans;
@@ -772,7 +782,7 @@ _resume:
         *end_ptr = p;
 }
         break;
-#line 776 "hb-buffer-deserialize-json.hh"
+#line 786 "hb-buffer-deserialize-json.hh"
         }
 
 _again:
@@ -784,7 +794,7 @@ _again:
         _out: {}
         }
 
-#line 137 "hb-buffer-deserialize-json.rl"
+#line 132 "hb-buffer-deserialize-json.rl"
 
 
   *end_ptr = p;
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-buffer-verify.cc b/src/java.desktop/share/native/libharfbuzz/hb-buffer-verify.cc
index 3bdea30ed36c..3a4c9c9f3176 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-buffer-verify.cc
+++ b/src/java.desktop/share/native/libharfbuzz/hb-buffer-verify.cc
@@ -149,7 +149,7 @@ buffer_verify_unsafe_to_break (hb_buffer_t  *buffer,
     }
     assert (text_start < text_end);
 
-    if (0)
+    if (false)
       printf("start %u end %u text start %u end %u\n", start, end, text_start, text_end);
 
     hb_buffer_clear_contents (fragment);
@@ -288,7 +288,7 @@ buffer_verify_unsafe_to_concat (hb_buffer_t        *buffer,
       }
       assert (text_start < text_end);
 
-      if (0)
+      if (false)
         printf("start %u end %u text start %u end %u\n", start, end, text_start, text_end);
 
 #if 0
@@ -412,7 +412,7 @@ hb_buffer_t::verify (hb_buffer_t        *text_buffer,
                                    &len,
                                    HB_BUFFER_SERIALIZE_FORMAT_TEXT,
                                    HB_BUFFER_SERIALIZE_FLAG_NO_CLUSTERS);
-      buffer_verify_error (this, font, BUFFER_VERIFY_ERROR "text was: %s.", bytes.arrayZ);
+      buffer_verify_error (this, font, BUFFER_VERIFY_ERROR "text was: %s.", bytes.arrayZ ? bytes.arrayZ : "");
     }
 #endif
   }
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-buffer.cc b/src/java.desktop/share/native/libharfbuzz/hb-buffer.cc
index 5f9329e07edf..72970c9c2f71 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-buffer.cc
+++ b/src/java.desktop/share/native/libharfbuzz/hb-buffer.cc
@@ -271,6 +271,7 @@ hb_buffer_t::similar (const hb_buffer_t &src)
   replacement = src.replacement;
   invisible = src.invisible;
   not_found = src.not_found;
+  not_found_variation_selector = src.not_found_variation_selector;
 }
 
 void
@@ -283,6 +284,7 @@ hb_buffer_t::reset ()
   replacement = HB_BUFFER_REPLACEMENT_CODEPOINT_DEFAULT;
   invisible = 0;
   not_found = 0;
+  not_found_variation_selector = HB_CODEPOINT_INVALID;
 
   clear ();
 }
@@ -309,6 +311,7 @@ hb_buffer_t::clear ()
 
   deallocate_var_all ();
   serial = 0;
+  random_state = 1;
   scratch_flags = HB_BUFFER_SCRATCH_FLAG_DEFAULT;
 }
 
@@ -704,6 +707,7 @@ DEFINE_NULL_INSTANCE (hb_buffer_t) =
   HB_BUFFER_REPLACEMENT_CODEPOINT_DEFAULT,
   0, /* invisible */
   0, /* not_found */
+  HB_CODEPOINT_INVALID, /* not_found_variation_selector */
 
 
   HB_BUFFER_CONTENT_TYPE_INVALID,
@@ -1359,6 +1363,89 @@ hb_buffer_get_not_found_glyph (const hb_buffer_t *buffer)
   return buffer->not_found;
 }
 
+/**
+ * hb_buffer_set_not_found_variation_selector_glyph:
+ * @buffer: An #hb_buffer_t
+ * @not_found_variation_selector: the not-found-variation-selector #hb_codepoint_t
+ *
+ * Sets the #hb_codepoint_t that replaces variation-selector characters not resolved
+ * in the font during shaping.
+ *
+ * The not-found-variation-selector glyph defaults to #HB_CODEPOINT_INVALID,
+ * in which case an unresolved variation-selector will be removed from the glyph
+ * string during shaping. This API allows for changing that and retaining a glyph,
+ * such that the situation can be detected by the client and handled accordingly
+ * (e.g. by using a different font).
+ *
+ * Since: 10.0.0
+ **/
+void
+hb_buffer_set_not_found_variation_selector_glyph (hb_buffer_t    *buffer,
+                                                  hb_codepoint_t  not_found_variation_selector)
+{
+  buffer->not_found_variation_selector = not_found_variation_selector;
+}
+
+/**
+ * hb_buffer_get_not_found_variation_selector_glyph:
+ * @buffer: An #hb_buffer_t
+ *
+ * See hb_buffer_set_not_found_variation_selector_glyph().
+ *
+ * Return value:
+ * The @buffer not-found-variation-selector #hb_codepoint_t
+ *
+ * Since: 10.0.0
+ **/
+hb_codepoint_t
+hb_buffer_get_not_found_variation_selector_glyph (const hb_buffer_t *buffer)
+{
+  return buffer->not_found_variation_selector;
+}
+
+/**
+ * hb_buffer_set_random_state:
+ * @buffer: An #hb_buffer_t
+ * @state: the new random state
+ *
+ * Sets the random state of the buffer. The state changes
+ * every time a glyph uses randomness (eg. the `rand`
+ * OpenType feature). This function together with
+ * hb_buffer_get_random_state() allow for transferring
+ * the current random state to a subsequent buffer, to
+ * get better randomness distribution.
+ *
+ * Defaults to 1 and when buffer contents are cleared.
+ * A value of 0 disables randomness during shaping.
+ *
+ * Since: 8.4.0
+ **/
+void
+hb_buffer_set_random_state (hb_buffer_t    *buffer,
+                            unsigned        state)
+{
+  if (unlikely (hb_object_is_immutable (buffer)))
+    return;
+
+  buffer->random_state = state;
+}
+
+/**
+ * hb_buffer_get_random_state:
+ * @buffer: An #hb_buffer_t
+ *
+ * See hb_buffer_set_random_state().
+ *
+ * Return value:
+ * The @buffer random state
+ *
+ * Since: 8.4.0
+ **/
+unsigned
+hb_buffer_get_random_state (const hb_buffer_t *buffer)
+{
+  return buffer->random_state;
+}
 
 /**
  * hb_buffer_clear_contents:
@@ -1896,7 +1983,7 @@ hb_buffer_add_codepoints (hb_buffer_t          *buffer,
  * @buffer: An #hb_buffer_t
  * @source: source #hb_buffer_t
  * @start: start index into source buffer to copy.  Use 0 to copy from start of buffer.
- * @end: end index into source buffer to copy.  Use @HB_FEATURE_GLOBAL_END to copy to end of buffer.
+ * @end: end index into source buffer to copy.  Use @UINT_MAX (or ((unsigned int) -1)) to copy to end of buffer.
  *
  * Append (part of) contents of another buffer to this buffer.
  *
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-buffer.h b/src/java.desktop/share/native/libharfbuzz/hb-buffer.h
index 6fc215d16277..d2258634ff42 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-buffer.h
+++ b/src/java.desktop/share/native/libharfbuzz/hb-buffer.h
@@ -487,6 +487,19 @@ hb_buffer_set_not_found_glyph (hb_buffer_t    *buffer,
 HB_EXTERN hb_codepoint_t
 hb_buffer_get_not_found_glyph (const hb_buffer_t *buffer);
 
+HB_EXTERN void
+hb_buffer_set_not_found_variation_selector_glyph (hb_buffer_t    *buffer,
+                                                  hb_codepoint_t  not_found_variation_selector);
+
+HB_EXTERN hb_codepoint_t
+hb_buffer_get_not_found_variation_selector_glyph (const hb_buffer_t *buffer);
+
+HB_EXTERN void
+hb_buffer_set_random_state (hb_buffer_t    *buffer,
+                            unsigned        state);
+
+HB_EXTERN unsigned
+hb_buffer_get_random_state (const hb_buffer_t *buffer);
 
 /*
  * Content API.
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-buffer.hh b/src/java.desktop/share/native/libharfbuzz/hb-buffer.hh
index 7f8ce14e90d5..c92e7df320ef 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-buffer.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-buffer.hh
@@ -32,7 +32,6 @@
 
 #include "hb.hh"
 #include "hb-unicode.hh"
-#include "hb-set-digest.hh"
 
 
 static_assert ((sizeof (hb_glyph_info_t) == 20), "");
@@ -52,6 +51,7 @@ enum hb_buffer_scratch_flags_t {
   HB_BUFFER_SCRATCH_FLAG_HAS_CGJ                        = 0x00000010u,
   HB_BUFFER_SCRATCH_FLAG_HAS_GLYPH_FLAGS                = 0x00000020u,
   HB_BUFFER_SCRATCH_FLAG_HAS_BROKEN_SYLLABLE            = 0x00000040u,
+  HB_BUFFER_SCRATCH_FLAG_HAS_VARIATION_SELECTOR_FALLBACK= 0x00000080u,
 
   /* Reserved for shapers' internal use. */
   HB_BUFFER_SCRATCH_FLAG_SHAPER0                        = 0x01000000u,
@@ -80,6 +80,7 @@ struct hb_buffer_t
   hb_codepoint_t replacement; /* U+FFFD or something else. */
   hb_codepoint_t invisible; /* 0 or something else. */
   hb_codepoint_t not_found; /* 0 or something else. */
+  hb_codepoint_t not_found_variation_selector; /* HB_CODEPOINT_INVALID or something else. */
 
   /*
    * Buffer contents
@@ -116,6 +117,7 @@ struct hb_buffer_t
 
   uint8_t allocated_var_bits;
   uint8_t serial;
+  uint32_t random_state;
   hb_buffer_scratch_flags_t scratch_flags; /* Have space-fallback, etc. */
   unsigned int max_len; /* Maximum allowed len. */
   int max_ops; /* Maximum allowed operations. */
@@ -179,22 +181,24 @@ struct hb_buffer_t
     allocated_var_bits = 0;
   }
 
+  HB_ALWAYS_INLINE
   hb_glyph_info_t &cur (unsigned int i = 0) { return info[idx + i]; }
+  HB_ALWAYS_INLINE
   hb_glyph_info_t cur (unsigned int i = 0) const { return info[idx + i]; }
 
+  HB_ALWAYS_INLINE
   hb_glyph_position_t &cur_pos (unsigned int i = 0) { return pos[idx + i]; }
+  HB_ALWAYS_INLINE
   hb_glyph_position_t cur_pos (unsigned int i = 0) const { return pos[idx + i]; }
 
+  HB_ALWAYS_INLINE
   hb_glyph_info_t &prev ()      { return out_info[out_len ? out_len - 1 : 0]; }
+  HB_ALWAYS_INLINE
   hb_glyph_info_t prev () const { return out_info[out_len ? out_len - 1 : 0]; }
 
-  hb_set_digest_t digest () const
-  {
-    hb_set_digest_t d;
-    d.init ();
-    d.add_array (&info[0].codepoint, len, sizeof (info[0]));
-    return d;
-  }
+  template 
+  void collect_codepoints (set_t &d) const
+  { d.clear (); d.add_array (&info[0].codepoint, len, sizeof (info[0])); }
 
   HB_INTERNAL void similar (const hb_buffer_t &src);
   HB_INTERNAL void reset ();
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-cff-interp-common.hh b/src/java.desktop/share/native/libharfbuzz/hb-cff-interp-common.hh
index 8d9ff5faf6d7..79d7c4c7133b 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-cff-interp-common.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-cff-interp-common.hh
@@ -522,7 +522,7 @@ struct parsed_values_t
 
   void alloc (unsigned n)
   {
-    values.alloc (n, true);
+    values.alloc_exact (n);
   }
 
   void add_op (op_code_t op, const byte_str_ref_t& str_ref = byte_str_ref_t (), const VAL &v = VAL ())
@@ -624,7 +624,6 @@ struct opset_t
         } else {
           /* invalid unknown operator */
           env.clear_args ();
-          env.set_error ();
         }
         break;
     }
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-cff-interp-dict-common.hh b/src/java.desktop/share/native/libharfbuzz/hb-cff-interp-dict-common.hh
index 0c0cec9986a8..6a227e5e81ee 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-cff-interp-dict-common.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-cff-interp-dict-common.hh
@@ -54,8 +54,8 @@ struct top_dict_values_t : dict_values_t
   }
   void fini () { dict_values_t::fini (); }
 
-  unsigned int  charStringsOffset;
-  unsigned int  FDArrayOffset;
+  int  charStringsOffset;
+  int  FDArrayOffset;
 };
 
 struct dict_opset_t : opset_t
@@ -84,7 +84,7 @@ struct dict_opset_t : opset_t
 
     enum Nibble { DECIMAL=10, EXP_POS, EXP_NEG, RESERVED, NEG, END };
 
-    char buf[32];
+    char buf[32] = {0};
     unsigned char byte = 0;
     for (unsigned i = 0, count = 0; count < ARRAY_LENGTH (buf); ++i, ++count)
     {
@@ -157,11 +157,11 @@ struct top_dict_opset_t : dict_opset_t
   {
     switch (op) {
       case OpCode_CharStrings:
-        dictval.charStringsOffset = env.argStack.pop_uint ();
+        dictval.charStringsOffset = env.argStack.pop_int ();
         env.clear_args ();
         break;
       case OpCode_FDArray:
-        dictval.FDArrayOffset = env.argStack.pop_uint ();
+        dictval.FDArrayOffset = env.argStack.pop_int ();
         env.clear_args ();
         break;
       case OpCode_FontMatrix:
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-cff2-interp-cs.hh b/src/java.desktop/share/native/libharfbuzz/hb-cff2-interp-cs.hh
index c970633e0641..ab17d68318ba 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-cff2-interp-cs.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-cff2-interp-cs.hh
@@ -76,16 +76,12 @@ struct cff2_cs_interp_env_t : cs_interp_env_t
     coords = coords_;
     num_coords = num_coords_;
     varStore = acc.varStore;
-    seen_blend = false;
-    seen_vsindex_ = false;
-    scalars.init ();
     do_blend = num_coords && coords && varStore->size;
     set_ivs (acc.privateDicts[fd].ivs);
   }
 
   void fini ()
   {
-    scalars.fini ();
     SUPER::fini ();
   }
 
@@ -168,13 +164,13 @@ struct cff2_cs_interp_env_t : cs_interp_env_t
   protected:
   const int     *coords;
   unsigned int  num_coords;
-  const  CFF2VariationStore *varStore;
+  const  CFF2ItemVariationStore *varStore;
   unsigned int  region_count;
   unsigned int  ivs;
   hb_vector_t  scalars;
   bool    do_blend;
-  bool    seen_vsindex_;
-  bool    seen_blend;
+  bool    seen_vsindex_ = false;
+  bool    seen_blend = false;
 
   typedef cs_interp_env_t SUPER;
 };
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-common.cc b/src/java.desktop/share/native/libharfbuzz/hb-common.cc
index 3afab4284e68..bce0d09d20a1 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-common.cc
+++ b/src/java.desktop/share/native/libharfbuzz/hb-common.cc
@@ -625,6 +625,9 @@ hb_script_get_horizontal_direction (hb_script_t script)
     /* Unicode-14.0 additions */
     case HB_SCRIPT_OLD_UYGHUR:
 
+    /* Unicode-16.0 additions */
+    case HB_SCRIPT_GARAY:
+
       return HB_DIRECTION_RTL;
 
 
@@ -996,7 +999,7 @@ hb_feature_to_string (hb_feature_t *feature,
   if (feature->value > 1)
   {
     s[len++] = '=';
-    len += hb_max (0, snprintf (s + len, ARRAY_LENGTH (s) - len, "%u", feature->value));
+    len += hb_max (0, snprintf (s + len, ARRAY_LENGTH (s) - len, "%" PRIu32, feature->value));
   }
   assert (len < ARRAY_LENGTH (s));
   len = hb_min (len, size - 1);
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-common.h b/src/java.desktop/share/native/libharfbuzz/hb-common.h
index 0d7956764cff..a8bae366f7ed 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-common.h
+++ b/src/java.desktop/share/native/libharfbuzz/hb-common.h
@@ -47,14 +47,10 @@
 # endif /* !__cplusplus */
 #endif
 
-#if defined (_SVR4) || defined (SVR4) || defined (__OpenBSD__) || \
-    defined (_sgi) || defined (__sun) || defined (sun) || \
-    defined (__digital__) || defined (__HP_cc)
-#  include 
-#elif defined (_AIX)
+#if defined (_AIX)
 #  include 
 #elif defined (_MSC_VER) && _MSC_VER < 1600
-/* VS 2010 (_MSC_VER 1600) has stdint.h */
+/* VS 2010 (_MSC_VER 1600) has stdint.h   */
 typedef __int8 int8_t;
 typedef unsigned __int8 uint8_t;
 typedef __int16 int16_t;
@@ -63,10 +59,11 @@ typedef __int32 int32_t;
 typedef unsigned __int32 uint32_t;
 typedef __int64 int64_t;
 typedef unsigned __int64 uint64_t;
-#elif defined (__KERNEL__)
-#  include 
-#else
+#elif defined (_MSC_VER) && _MSC_VER < 1800
+/* VS 2013 (_MSC_VER 1800) has inttypes.h */
 #  include 
+#else
+#  include 
 #endif
 
 #if defined(__GNUC__) && ((__GNUC__ > 3) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1))
@@ -507,6 +504,13 @@ hb_language_matches (hb_language_t language,
  * @HB_SCRIPT_MATH: `Zmth`, Since: 3.4.0
  * @HB_SCRIPT_KAWI: `Kawi`, Since: 5.2.0
  * @HB_SCRIPT_NAG_MUNDARI: `Nagm`, Since: 5.2.0
+ * @HB_SCRIPT_GARAY: `Gara`, Since: 10.0.0
+ * @HB_SCRIPT_GURUNG_KHEMA: `Gukh`, Since: 10.0.0
+ * @HB_SCRIPT_KIRAT_RAI: `Krai`, Since: 10.0.0
+ * @HB_SCRIPT_OL_ONAL: `Onao`, Since: 10.0.0
+ * @HB_SCRIPT_SUNUWAR: `Sunu`, Since: 10.0.0
+ * @HB_SCRIPT_TODHRI: `Todr`, Since: 10.0.0
+ * @HB_SCRIPT_TULU_TIGALARI: `Tutg`, Since: 10.0.0
  * @HB_SCRIPT_INVALID: No script set
  *
  * Data type for scripts. Each #hb_script_t's value is an #hb_tag_t corresponding
@@ -734,6 +738,17 @@ typedef enum
   HB_SCRIPT_KAWI                        = HB_TAG ('K','a','w','i'), /*15.0*/
   HB_SCRIPT_NAG_MUNDARI                 = HB_TAG ('N','a','g','m'), /*15.0*/
 
+  /*
+   * Since 10.0.0
+   */
+  HB_SCRIPT_GARAY                       = HB_TAG ('G','a','r','a'), /*16.0*/
+  HB_SCRIPT_GURUNG_KHEMA                = HB_TAG ('G','u','k','h'), /*16.0*/
+  HB_SCRIPT_KIRAT_RAI                   = HB_TAG ('K','r','a','i'), /*16.0*/
+  HB_SCRIPT_OL_ONAL                     = HB_TAG ('O','n','a','o'), /*16.0*/
+  HB_SCRIPT_SUNUWAR                     = HB_TAG ('S','u','n','u'), /*16.0*/
+  HB_SCRIPT_TODHRI                      = HB_TAG ('T','o','d','r'), /*16.0*/
+  HB_SCRIPT_TULU_TIGALARI               = HB_TAG ('T','u','t','g'), /*16.0*/
+
   /* No script set. */
   HB_SCRIPT_INVALID                     = HB_TAG_NONE,
 
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-config.hh b/src/java.desktop/share/native/libharfbuzz/hb-config.hh
index 816c55c7d367..40cc2403c18c 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-config.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-config.hh
@@ -56,7 +56,6 @@
 
 #ifdef HB_LEAN
 #define HB_DISABLE_DEPRECATED
-#define HB_NDEBUG
 #define HB_NO_ATEXIT
 #define HB_NO_BUFFER_MESSAGE
 #define HB_NO_BUFFER_SERIALIZE
@@ -69,8 +68,6 @@
 #define HB_NO_FACE_COLLECT_UNICODES
 #define HB_NO_GETENV
 #define HB_NO_HINTING
-#define HB_NO_LANGUAGE_LONG
-#define HB_NO_LANGUAGE_PRIVATE_SUBTAG
 #define HB_NO_LAYOUT_FEATURE_PARAMS
 #define HB_NO_LAYOUT_COLLECT_GLYPHS
 #define HB_NO_LAYOUT_RARELY_USED
@@ -118,6 +115,10 @@
 #define HB_NO_VAR_COMPOSITES
 #endif
 
+#ifdef HB_NO_VAR
+#define HB_NO_VAR_COMPOSITES
+#endif
+
 #ifdef HB_DISABLE_DEPRECATED
 #define HB_IF_NOT_DEPRECATED(x)
 #else
@@ -156,6 +157,7 @@
 #define HB_NO_FALLBACK_SHAPE
 #define HB_NO_OT_KERN
 #define HB_NO_OT_LAYOUT_BLOCKLIST
+#define HB_NO_AAT_LAYOUT_BLOCKLIST
 #define HB_NO_OT_SHAPE_FALLBACK
 #endif
 
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-cplusplus.hh b/src/java.desktop/share/native/libharfbuzz/hb-cplusplus.hh
index eac4ff03ed5f..82d397415279 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-cplusplus.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-cplusplus.hh
@@ -27,9 +27,6 @@
 
 #include "hb.h"
 
-HB_BEGIN_DECLS
-HB_END_DECLS
-
 #ifdef __cplusplus
 
 #include 
@@ -56,15 +53,15 @@ struct shared_ptr
 
   explicit shared_ptr (T *p = nullptr) : p (p) {}
   shared_ptr (const shared_ptr &o) : p (v::reference (o.p)) {}
-  shared_ptr (shared_ptr &&o) : p (o.p) { o.p = nullptr; }
+  shared_ptr (shared_ptr &&o)  noexcept : p (o.p) { o.p = nullptr; }
   shared_ptr& operator = (const shared_ptr &o) { if (p != o.p) { destroy (); p = o.p; reference (); } return *this; }
-  shared_ptr& operator = (shared_ptr &&o) { v::destroy (p); p = o.p; o.p = nullptr; return *this; }
+  shared_ptr& operator = (shared_ptr &&o)  noexcept { v::destroy (p); p = o.p; o.p = nullptr; return *this; }
   ~shared_ptr () { v::destroy (p); p = nullptr; }
 
   T* get() const { return p; }
 
-  void swap (shared_ptr &o) { std::swap (p, o.p); }
-  friend void swap (shared_ptr &a, shared_ptr &b) { std::swap (a.p, b.p); }
+  void swap (shared_ptr &o)  noexcept { std::swap (p, o.p); }
+  friend void swap (shared_ptr &a, shared_ptr &b)  noexcept { std::swap (a.p, b.p); }
 
   operator T * () const { return p; }
   T& operator * () const { return *get (); }
@@ -98,16 +95,16 @@ struct unique_ptr
 
   explicit unique_ptr (T *p = nullptr) : p (p) {}
   unique_ptr (const unique_ptr &o) = delete;
-  unique_ptr (unique_ptr &&o) : p (o.p) { o.p = nullptr; }
+  unique_ptr (unique_ptr &&o)  noexcept : p (o.p) { o.p = nullptr; }
   unique_ptr& operator = (const unique_ptr &o) = delete;
-  unique_ptr& operator = (unique_ptr &&o) { v::destroy (p); p = o.p; o.p = nullptr; return *this; }
+  unique_ptr& operator = (unique_ptr &&o)  noexcept { v::destroy (p); p = o.p; o.p = nullptr; return *this; }
   ~unique_ptr () { v::destroy (p); p = nullptr; }
 
   T* get() const { return p; }
   T* release () { T* v = p; p = nullptr; return v; }
 
-  void swap (unique_ptr &o) { std::swap (p, o.p); }
-  friend void swap (unique_ptr &a, unique_ptr &b) { std::swap (a.p, b.p); }
+  void swap (unique_ptr &o)  noexcept { std::swap (p, o.p); }
+  friend void swap (unique_ptr &a, unique_ptr &b)  noexcept { std::swap (a.p, b.p); }
 
   operator T * () const { return p; }
   T& operator * () const { return *get (); }
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-decycler.hh b/src/java.desktop/share/native/libharfbuzz/hb-decycler.hh
new file mode 100644
index 000000000000..95b961027bf2
--- /dev/null
+++ b/src/java.desktop/share/native/libharfbuzz/hb-decycler.hh
@@ -0,0 +1,164 @@
+/*
+ * Copyright © 2025 Behdad Esfahbod
+ *
+ *  This is part of HarfBuzz, a text shaping library.
+ *
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, provided that the
+ * above copyright notice and the following two paragraphs appear in
+ * all copies of this software.
+ *
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
+ * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
+ * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ * Author(s): Behdad Esfahbod
+ */
+
+#ifndef HB_DECYCLER_HH
+#define HB_DECYCLER_HH
+
+#include "hb.hh"
+
+/*
+ * hb_decycler_t is an efficient cycle detector for graph traversal.
+ * It's a simple tortoise-and-hare algorithm with a twist: it's
+ * designed to detect cycles while traversing a graph in a DFS manner,
+ * instead of just a linked list.
+ *
+ * For Floyd's tortoise and hare algorithm, see:
+ * https://en.wikipedia.org/wiki/Cycle_detection#Floyd's_tortoise_and_hare
+ *
+ * hb_decycler_t is O(n) in the number of nodes in the DFS traversal
+ * if there are no cycles. Unlike Floyd's algorithm, hb_decycler_t
+ * can be used in a DFS traversal, where the graph is not a simple
+ * linked list, but a tree with possible cycles.  Like Floyd's algorithm,
+ * it is constant-memory (~three  pointers).
+ *
+ * The decycler works by creating an implicit linked-list on the stack,
+ * of the path from the root to the current node, and apply Floyd's
+ * algorithm on that list as it goes.
+ *
+ * The decycler is malloc-free, and as such, much faster to use than a
+ * hb_set_t or hb_map_t equivalent.
+ *
+ * The decycler detects cycles in the graph *eventually*, not *immediately*.
+ * That is, it may not detect a cycle until the cycle is fully traversed,
+ * even multiple times. See Floyd's algorithm analysis for details.
+ *
+ * The implementation saves a pointer storage on the stack by combining
+ * this->u.decycler and this->u.next into a union.  This is possible because
+ * at any point we only need one of those values. The invariant is that
+ * after construction, and before destruction, of a node, the u.decycler
+ * field is always valid. The u.next field is only valid when the node is
+ * in the traversal path, parent to another node.
+ *
+ * There are three method's:
+ *
+ *   - hb_decycler_node_t() constructor: Creates a new node in the traversal.
+ *     The constructor takes a reference to the decycler object and inserts
+ *     itself as the latest node in the traversal path, by advancing the hare
+ *     pointer, and for every other descent, advancing the tortoise pointer.
+ *
+ *   - ~hb_decycler_node_t() destructor: Restores the decycler object to its
+ *      previous state by removing the node from the traversal path.
+ *
+ *   - bool visit(uintptr_t value): Called on every node in the graph.  Returns
+ *     true if the node is not part of a cycle, and false if it is.  The value
+ *     parameter is used to detect cycles.  It's the caller's responsibility
+ *     to ensure that the value is unique for each node in the graph.
+ *     The cycle detection is as simple as comparing the value to the value
+ *     held by the tortoise pointer, which is the Floyd's algorithm.
+ *
+ * For usage examples see test-decycler.cc.
+ */
+
+struct hb_decycler_node_t;
+
+struct hb_decycler_t
+{
+  friend struct hb_decycler_node_t;
+
+  private:
+  bool tortoise_awake = false;
+  hb_decycler_node_t *tortoise = nullptr;
+  hb_decycler_node_t *hare = nullptr;
+};
+
+struct hb_decycler_node_t
+{
+  hb_decycler_node_t (hb_decycler_t &decycler)
+  {
+    u.decycler = &decycler;
+
+    decycler.tortoise_awake = !decycler.tortoise_awake;
+
+    if (!decycler.tortoise)
+    {
+      // First node.
+      assert (decycler.tortoise_awake);
+      assert (!decycler.hare);
+      decycler.tortoise = decycler.hare = this;
+      return;
+    }
+
+    if (decycler.tortoise_awake)
+      decycler.tortoise = decycler.tortoise->u.next; // Time to move.
+
+    this->prev = decycler.hare;
+    decycler.hare->u.next = this;
+    decycler.hare = this;
+  }
+
+  ~hb_decycler_node_t ()
+  {
+    hb_decycler_t &decycler = *u.decycler;
+
+    // Inverse of the constructor.
+
+    assert (decycler.hare == this);
+    decycler.hare = prev;
+    if (prev)
+      prev->u.decycler = &decycler;
+
+    assert (decycler.tortoise);
+    if (decycler.tortoise_awake)
+      decycler.tortoise = decycler.tortoise->prev;
+
+    decycler.tortoise_awake = !decycler.tortoise_awake;
+  }
+
+  bool visit (uintptr_t value_)
+  {
+    value = value_;
+
+    hb_decycler_t &decycler = *u.decycler;
+
+    if (decycler.tortoise == this)
+      return true; // First node; not a cycle.
+
+    if (decycler.tortoise->value == value)
+      return false; // Cycle detected.
+
+    return true;
+  }
+
+  private:
+  union {
+    hb_decycler_t *decycler;
+    hb_decycler_node_t *next;
+  } u = {nullptr};
+  hb_decycler_node_t *prev = nullptr;
+  uintptr_t value = 0;
+};
+
+#endif /* HB_DECYCLER_HH */
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-deprecated.h b/src/java.desktop/share/native/libharfbuzz/hb-deprecated.h
index 200e8ff49288..d854a2b16f5f 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-deprecated.h
+++ b/src/java.desktop/share/native/libharfbuzz/hb-deprecated.h
@@ -56,7 +56,7 @@ HB_BEGIN_DECLS
 /**
  * HB_SCRIPT_CANADIAN_ABORIGINAL:
  *
- * Use #HB_SCRIPT_CANADIAN_SYLLABICS instead:
+ * Use #HB_SCRIPT_CANADIAN_SYLLABICS instead.
  *
  * Deprecated: 0.9.20
  */
@@ -301,6 +301,15 @@ hb_font_get_glyph_shape (hb_font_t *font,
                          hb_draw_funcs_t *dfuncs, void *draw_data);
 
 
+/**
+ * HB_AAT_LAYOUT_FEATURE_TYPE_CURISVE_CONNECTION:
+ *
+ * Use #HB_AAT_LAYOUT_FEATURE_TYPE_CURSIVE_CONNECTION instead.
+ *
+ * Deprecated: 8.3.0
+ */
+#define HB_AAT_LAYOUT_FEATURE_TYPE_CURISVE_CONNECTION HB_AAT_LAYOUT_FEATURE_TYPE_CURSIVE_CONNECTION
+
 #endif
 
 
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-draw.h b/src/java.desktop/share/native/libharfbuzz/hb-draw.h
index eba791d10c08..4556b082d603 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-draw.h
+++ b/src/java.desktop/share/native/libharfbuzz/hb-draw.h
@@ -70,7 +70,7 @@ typedef struct hb_draw_state_t {
  *
  * The default #hb_draw_state_t at the start of glyph drawing.
  */
-#define HB_DRAW_STATE_DEFAULT {0, 0.f, 0.f, 0.f, 0.f, {0.}, {0.}, {0.}}
+#define HB_DRAW_STATE_DEFAULT {0, 0.f, 0.f, 0.f, 0.f, {0.}, {0.}, {0.}, {0.}, {0.}, {0.}, {0.}}
 
 
 /**
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-draw.hh b/src/java.desktop/share/native/libharfbuzz/hb-draw.hh
index e1adf9ddc9f5..2c30843de64f 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-draw.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-draw.hh
@@ -232,7 +232,7 @@ struct hb_draw_session_t
     funcs->close_path (draw_data, st);
   }
 
-  protected:
+  public:
   float slant;
   bool not_slanted;
   hb_draw_funcs_t *funcs;
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-face-builder.cc b/src/java.desktop/share/native/libharfbuzz/hb-face-builder.cc
index ff723ac70004..6b7e1913024b 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-face-builder.cc
+++ b/src/java.desktop/share/native/libharfbuzz/hb-face-builder.cc
@@ -42,7 +42,7 @@
 struct face_table_info_t
 {
   hb_blob_t* data;
-  signed order;
+  unsigned order;
 };
 
 struct hb_face_builder_data_t
@@ -153,6 +153,50 @@ _hb_face_builder_reference_table (hb_face_t *face HB_UNUSED, hb_tag_t tag, void
   return hb_blob_reference (data->tables[tag].data);
 }
 
+static unsigned
+_hb_face_builder_get_table_tags (const hb_face_t *face HB_UNUSED,
+                                 unsigned int start_offset,
+                                 unsigned int *table_count,
+                                 hb_tag_t *table_tags,
+                                 void *user_data)
+{
+  hb_face_builder_data_t *data = (hb_face_builder_data_t *) user_data;
+
+  unsigned population = data->tables.get_population ();
+
+  if (!table_count)
+    return population;
+
+  if (unlikely (start_offset >= population))
+  {
+    if (table_count)
+      *table_count = 0;
+    return population;
+  }
+
+  // Sort the tags.
+  hb_vector_t sorted_tags;
+  data->tables.keys () | hb_sink (sorted_tags);
+  if (unlikely (sorted_tags.in_error ()))
+  {
+    // Not much to do...
+  }
+  sorted_tags.qsort ([] (const void* a, const void* b) {
+    return * (hb_tag_t *) a <  * (hb_tag_t *) b ? -1 :
+           * (hb_tag_t *) a == * (hb_tag_t *) b ?  0 :
+                                                  +1;
+  });
+
+  auto array = sorted_tags.as_array ().sub_array (start_offset, table_count);
+  auto out = hb_array (table_tags, *table_count);
+
+  + array.iter ()
+  | hb_sink (out)
+  ;
+
+  return population;
+}
+
 
 /**
  * hb_face_builder_create:
@@ -171,9 +215,16 @@ hb_face_builder_create ()
   hb_face_builder_data_t *data = _hb_face_builder_data_create ();
   if (unlikely (!data)) return hb_face_get_empty ();
 
-  return hb_face_create_for_tables (_hb_face_builder_reference_table,
-                                    data,
-                                    _hb_face_builder_data_destroy);
+  hb_face_t *face = hb_face_create_for_tables (_hb_face_builder_reference_table,
+                                               data,
+                                               _hb_face_builder_data_destroy);
+
+  hb_face_set_get_table_tags_func (face,
+                                   _hb_face_builder_get_table_tags,
+                                   data,
+                                   nullptr);
+
+  return face;
 }
 
 /**
@@ -199,7 +250,7 @@ hb_face_builder_add_table (hb_face_t *face, hb_tag_t tag, hb_blob_t *blob)
   hb_face_builder_data_t *data = (hb_face_builder_data_t *) face->user_data;
 
   hb_blob_t* previous = data->tables.get (tag).data;
-  if (!data->tables.set (tag, face_table_info_t {hb_blob_reference (blob), -1}))
+  if (!data->tables.set (tag, face_table_info_t {hb_blob_reference (blob), (unsigned) -1}))
   {
     hb_blob_destroy (blob);
     return false;
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-face.cc b/src/java.desktop/share/native/libharfbuzz/hb-face.cc
index bc19bb9d5c97..7967ae3241bd 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-face.cc
+++ b/src/java.desktop/share/native/libharfbuzz/hb-face.cc
@@ -90,10 +90,6 @@ DEFINE_NULL_INSTANCE (hb_face_t) =
 {
   HB_OBJECT_HEADER_STATIC,
 
-  nullptr, /* reference_table_func */
-  nullptr, /* user_data */
-  nullptr, /* destroy */
-
   0,    /* index */
   1000, /* upem */
   0,    /* num_glyphs */
@@ -110,8 +106,9 @@ DEFINE_NULL_INSTANCE (hb_face_t) =
  *
  * Variant of hb_face_create(), built for those cases where it is more
  * convenient to provide data for individual tables instead of the whole font
- * data. With the caveat that hb_face_get_table_tags() does not currently work
- * with faces created this way.
+ * data. With the caveat that hb_face_get_table_tags() would not work
+ * with faces created this way. You can address that by calling the
+ * hb_face_set_get_table_tags_func() function and setting the appropriate callback.
  *
  * Creates a new face object from the specified @user_data and @reference_table_func,
  * with the @destroy callback.
@@ -194,6 +191,22 @@ _hb_face_for_data_reference_table (hb_face_t *face HB_UNUSED, hb_tag_t tag, void
   return blob;
 }
 
+static unsigned
+_hb_face_for_data_get_table_tags (const hb_face_t *face HB_UNUSED,
+                                  unsigned int start_offset,
+                                  unsigned int *table_count,
+                                  hb_tag_t *table_tags,
+                                  void *user_data)
+{
+  hb_face_for_data_closure_t *data = (hb_face_for_data_closure_t *) user_data;
+
+  const OT::OpenTypeFontFile &ot_file = *data->blob->as ();
+  const OT::OpenTypeFontFace &ot_face = ot_file.get_face (data->index);
+
+  return ot_face.get_table_tags (start_offset, table_count, table_tags);
+}
+
+
 /**
  * hb_face_create:
  * @blob: #hb_blob_t to work upon
@@ -240,12 +253,73 @@ hb_face_create (hb_blob_t    *blob,
   face = hb_face_create_for_tables (_hb_face_for_data_reference_table,
                                     closure,
                                     _hb_face_for_data_closure_destroy);
+  hb_face_set_get_table_tags_func (face,
+                                   _hb_face_for_data_get_table_tags,
+                                   closure,
+                                   nullptr);
 
   face->index = index;
 
   return face;
 }
 
+/**
+ * hb_face_create_or_fail:
+ * @blob: #hb_blob_t to work upon
+ * @index: The index of the face within @blob
+ *
+ * Like hb_face_create(), but returns `NULL` if the blob data
+ * contains no usable font face at the specified index.
+ *
+ * Return value: (transfer full): The new face object, or `NULL` if
+ * no face is found at the specified index.
+ *
+ * Since: 10.1.0
+ **/
+hb_face_t *
+hb_face_create_or_fail (hb_blob_t    *blob,
+                        unsigned int  index)
+{
+  unsigned num_faces = hb_face_count (blob);
+  if (index >= num_faces)
+    return nullptr;
+
+  hb_face_t *face = hb_face_create (blob, index);
+  if (hb_object_is_immutable (face))
+    return nullptr;
+
+  return face;
+}
+
+#ifndef HB_NO_OPEN
+/**
+ * hb_face_create_from_file_or_fail:
+ * @file_name: A font filename
+ * @index: The index of the face within the file
+ *
+ * A thin wrapper around hb_blob_create_from_file_or_fail()
+ * followed by hb_face_create_or_fail().
+ *
+ * Return value: (transfer full): The new face object, or `NULL` if
+ * no face is found at the specified index or the file cannot be read.
+ *
+ * Since: 10.1.0
+ **/
+HB_EXTERN hb_face_t *
+hb_face_create_from_file_or_fail (const char   *file_name,
+                                  unsigned int  index)
+{
+  hb_blob_t *blob = hb_blob_create_from_file_or_fail (file_name);
+  if (unlikely (!blob))
+    return nullptr;
+
+  hb_face_t *face = hb_face_create_or_fail (blob, index);
+  hb_blob_destroy (blob);
+
+  return face;
+}
+#endif
+
 /**
  * hb_face_get_empty:
  *
@@ -306,6 +380,9 @@ hb_face_destroy (hb_face_t *face)
   face->data.fini ();
   face->table.fini ();
 
+  if (face->get_table_tags_destroy)
+    face->get_table_tags_destroy (face->get_table_tags_user_data);
+
   if (face->destroy)
     face->destroy (face->user_data);
 
@@ -395,7 +472,8 @@ hb_face_is_immutable (const hb_face_t *face)
  * @tag: The #hb_tag_t of the table to query
  *
  * Fetches a reference to the specified table within
- * the specified face.
+ * the specified face. Returns an empty blob if referencing table data is not
+ * possible.
  *
  * Return value: (transfer full): A pointer to the @tag table within @face
  *
@@ -415,9 +493,10 @@ hb_face_reference_table (const hb_face_t *face,
  * hb_face_reference_blob:
  * @face: A face object
  *
- * Fetches a pointer to the binary blob that contains the
- * specified face. Returns an empty blob if referencing face data is not
- * possible.
+ * Fetches a pointer to the binary blob that contains the specified face.
+ * If referencing the face data is not possible, this function creates a blob
+ * out of individual table blobs if hb_face_get_table_tags() works with this
+ * face, otherwise it returns an empty blob.
  *
  * Return value: (transfer full): A pointer to the blob for @face
  *
@@ -426,7 +505,41 @@ hb_face_reference_table (const hb_face_t *face,
 hb_blob_t *
 hb_face_reference_blob (hb_face_t *face)
 {
-  return face->reference_table (HB_TAG_NONE);
+  hb_blob_t *blob = face->reference_table (HB_TAG_NONE);
+
+  if (blob == hb_blob_get_empty ())
+  {
+    // If referencing the face blob is not possible (e.g. not implemented by the
+    // font functions), use face builder to create a blob out of individual
+    // table blobs.
+    unsigned total_count = hb_face_get_table_tags (face, 0, nullptr, nullptr);
+    if (total_count)
+    {
+      hb_tag_t tags[64];
+      unsigned count = ARRAY_LENGTH (tags);
+      hb_face_t* builder = hb_face_builder_create ();
+
+      for (unsigned offset = 0; offset < total_count; offset += count)
+      {
+        hb_face_get_table_tags (face, offset, &count, tags);
+        if (unlikely (!count))
+          break; // Allocation error
+        for (unsigned i = 0; i < count; i++)
+        {
+          if (unlikely (!tags[i]))
+            continue;
+          hb_blob_t *table = hb_face_reference_table (face, tags[i]);
+          hb_face_builder_add_table (builder, tags[i], table);
+          hb_blob_destroy (table);
+        }
+      }
+
+      blob = hb_face_reference_blob (builder);
+      hb_face_destroy (builder);
+    }
+  }
+
+  return blob;
 }
 
 /**
@@ -547,6 +660,38 @@ hb_face_get_glyph_count (const hb_face_t *face)
   return face->get_num_glyphs ();
 }
 
+/**
+ * hb_face_set_get_table_tags_func:
+ * @face: A face object
+ * @func: (closure user_data) (destroy destroy) (scope notified): The table-tag-fetching function
+ * @user_data: A pointer to the user data, to be destroyed by @destroy when not needed anymore
+ * @destroy: (nullable): A callback to call when @func is not needed anymore
+ *
+ * Sets the table-tag-fetching function for the specified face object.
+ *
+ * Since: 10.0.0
+ */
+HB_EXTERN void
+hb_face_set_get_table_tags_func (hb_face_t *face,
+                                 hb_get_table_tags_func_t func,
+                                 void                    *user_data,
+                                 hb_destroy_func_t        destroy)
+{
+  if (hb_object_is_immutable (face))
+  {
+    if (destroy)
+      destroy (user_data);
+    return;
+  }
+
+  if (face->get_table_tags_destroy)
+    face->get_table_tags_destroy (face->get_table_tags_user_data);
+
+  face->get_table_tags_func = func;
+  face->get_table_tags_user_data = user_data;
+  face->get_table_tags_destroy = destroy;
+}
+
 /**
  * hb_face_get_table_tags:
  * @face: A face object
@@ -568,19 +713,14 @@ hb_face_get_table_tags (const hb_face_t *face,
                         unsigned int *table_count, /* IN/OUT */
                         hb_tag_t     *table_tags /* OUT */)
 {
-  if (face->destroy != (hb_destroy_func_t) _hb_face_for_data_closure_destroy)
+  if (!face->get_table_tags_func)
   {
     if (table_count)
       *table_count = 0;
     return 0;
   }
 
-  hb_face_for_data_closure_t *data = (hb_face_for_data_closure_t *) face->user_data;
-
-  const OT::OpenTypeFontFile &ot_file = *data->blob->as ();
-  const OT::OpenTypeFontFace &ot_face = ot_file.get_face (data->index);
-
-  return ot_face.get_table_tags (start_offset, table_count, table_tags);
+  return face->get_table_tags_func (face, start_offset, table_count, table_tags, face->get_table_tags_user_data);
 }
 
 
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-face.h b/src/java.desktop/share/native/libharfbuzz/hb-face.h
index 2e5fb1509272..953298fa50b4 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-face.h
+++ b/src/java.desktop/share/native/libharfbuzz/hb-face.h
@@ -59,15 +59,28 @@ HB_EXTERN hb_face_t *
 hb_face_create (hb_blob_t    *blob,
                 unsigned int  index);
 
+HB_EXTERN hb_face_t *
+hb_face_create_or_fail (hb_blob_t    *blob,
+                        unsigned int  index);
+
+HB_EXTERN hb_face_t *
+hb_face_create_from_file_or_fail (const char   *file_name,
+                                  unsigned int  index);
+
 /**
  * hb_reference_table_func_t:
  * @face: an #hb_face_t to reference table for
  * @tag: the tag of the table to reference
  * @user_data: User data pointer passed by the caller
  *
- * Callback function for hb_face_create_for_tables().
+ * Callback function for hb_face_create_for_tables(). The @tag is the tag of the
+ * table to reference, and the special tag #HB_TAG_NONE is used to reference the
+ * blob of the face itself. If referencing the face blob is not possible, it is
+ * recommended to set hb_get_table_tags_func_t on the @face to allow
+ * hb_face_reference_blob() to create a face blob out of individual table blobs.
  *
- * Return value: (transfer full): A pointer to the @tag table within @face
+ * Return value: (transfer full): A pointer to the @tag table within @face or
+ * `NULL` if the table is not found or cannot be referenced.
  *
  * Since: 0.9.2
  */
@@ -135,6 +148,34 @@ hb_face_set_glyph_count (hb_face_t    *face,
 HB_EXTERN unsigned int
 hb_face_get_glyph_count (const hb_face_t *face);
 
+
+/**
+ * hb_get_table_tags_func_t:
+ * @face: A face object
+ * @start_offset: The index of first table tag to retrieve
+ * @table_count: (inout): Input = the maximum number of table tags to return;
+ *                Output = the actual number of table tags returned (may be zero)
+ * @table_tags: (out) (array length=table_count): The array of table tags found
+ * @user_data: User data pointer passed by the caller
+ *
+ * Callback function for hb_face_get_table_tags().
+ *
+ * Return value: Total number of tables, or zero if it is not possible to list
+ *
+ * Since: 10.0.0
+ */
+typedef unsigned int (*hb_get_table_tags_func_t) (const hb_face_t *face,
+                                                  unsigned int  start_offset,
+                                                  unsigned int *table_count, /* IN/OUT */
+                                                  hb_tag_t     *table_tags /* OUT */,
+                                                  void         *user_data);
+
+HB_EXTERN void
+hb_face_set_get_table_tags_func (hb_face_t *face,
+                                 hb_get_table_tags_func_t func,
+                                 void                    *user_data,
+                                 hb_destroy_func_t        destroy);
+
 HB_EXTERN unsigned int
 hb_face_get_table_tags (const hb_face_t *face,
                         unsigned int  start_offset,
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-face.hh b/src/java.desktop/share/native/libharfbuzz/hb-face.hh
index 4c6b252e88ea..4d12030f1873 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-face.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-face.hh
@@ -48,13 +48,17 @@ struct hb_face_t
 {
   hb_object_header_t header;
 
+  unsigned int index;                   /* Face index in a collection, zero-based. */
+  mutable hb_atomic_int_t upem;         /* Units-per-EM. */
+  mutable hb_atomic_int_t num_glyphs;   /* Number of glyphs. */
+
   hb_reference_table_func_t  reference_table_func;
   void                      *user_data;
   hb_destroy_func_t          destroy;
 
-  unsigned int index;                   /* Face index in a collection, zero-based. */
-  mutable hb_atomic_int_t upem;         /* Units-per-EM. */
-  mutable hb_atomic_int_t num_glyphs;   /* Number of glyphs. */
+  hb_get_table_tags_func_t   get_table_tags_func;
+  void                      *get_table_tags_user_data;
+  hb_destroy_func_t          get_table_tags_destroy;
 
   hb_shaper_object_dataset_t data;/* Various shaper data. */
   hb_ot_face_t table;                   /* All the face's tables. */
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-font.cc b/src/java.desktop/share/native/libharfbuzz/hb-font.cc
index 9ce55bbeb89f..0c9084c574fe 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-font.cc
+++ b/src/java.desktop/share/native/libharfbuzz/hb-font.cc
@@ -231,7 +231,7 @@ hb_font_get_glyph_v_advance_nil (hb_font_t      *font,
                                  void           *user_data HB_UNUSED)
 {
   /* TODO use font_extents.ascender+descender */
-  return font->y_scale;
+  return -font->y_scale;
 }
 
 static hb_position_t
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-font.hh b/src/java.desktop/share/native/libharfbuzz/hb-font.hh
index c3198830cd33..8273f3475620 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-font.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-font.hh
@@ -651,7 +651,7 @@ struct hb_font_t
   {
     if (get_glyph_name (glyph, s, size)) return;
 
-    if (size && snprintf (s, size, "gid%u", glyph) < 0)
+    if (size && snprintf (s, size, "gid%" PRIu32, glyph) < 0)
       *s = '\0';
   }
 
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ft.cc b/src/java.desktop/share/native/libharfbuzz/hb-ft.cc
index 32f5d3012da8..b126d2022d1e 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-ft.cc
+++ b/src/java.desktop/share/native/libharfbuzz/hb-ft.cc
@@ -37,10 +37,15 @@
 #include "hb-draw.hh"
 #include "hb-font.hh"
 #include "hb-machinery.hh"
+#ifndef HB_NO_AAT
+#include "hb-aat-layout-trak-table.hh"
+#endif
 #include "hb-ot-os2-table.hh"
+#include "hb-ot-stat-table.hh"
 #include "hb-ot-shaper-arabic-pua.hh"
 #include "hb-paint.hh"
 
+#include FT_MODULE_H
 #include FT_ADVANCES_H
 #include FT_MULTIPLE_MASTERS_H
 #include FT_OUTLINE_H
@@ -225,7 +230,7 @@ _hb_ft_hb_font_check_changed (hb_font_t *font,
  * Sets the FT_Load_Glyph load flags for the specified #hb_font_t.
  *
  * For more information, see
- * https://www.freetype.org/freetype2/docs/reference/ft2-base_interface.html#ft_load_xxx
+ * 
  *
  * This function works with #hb_font_t objects created by
  * hb_ft_font_create() or hb_ft_font_create_referenced().
@@ -253,7 +258,7 @@ hb_ft_font_set_load_flags (hb_font_t *font, int load_flags)
  * Fetches the FT_Load_Glyph load flags of the specified #hb_font_t.
  *
  * For more information, see
- * https://www.freetype.org/freetype2/docs/reference/ft2-base_interface.html#ft_load_xxx
+ * 
  *
  * This function works with #hb_font_t objects created by
  * hb_ft_font_create() or hb_ft_font_create_referenced().
@@ -274,7 +279,7 @@ hb_ft_font_get_load_flags (hb_font_t *font)
 }
 
 /**
- * hb_ft_font_get_face: (skip)
+ * hb_ft_font_get_ft_face: (skip)
  * @font: #hb_font_t to work upon
  *
  * Fetches the FT_Face associated with the specified #hb_font_t
@@ -285,10 +290,10 @@ hb_ft_font_get_load_flags (hb_font_t *font)
  *
  * Return value: (nullable): the FT_Face found or `NULL`
  *
- * Since: 0.9.2
+ * Since: 10.4.0
  **/
 FT_Face
-hb_ft_font_get_face (hb_font_t *font)
+hb_ft_font_get_ft_face (hb_font_t *font)
 {
   if (unlikely (font->destroy != (hb_destroy_func_t) _hb_ft_font_destroy))
     return nullptr;
@@ -298,6 +303,31 @@ hb_ft_font_get_face (hb_font_t *font)
   return ft_font->ft_face;
 }
 
+#ifndef HB_DISABLE_DEPRECATED
+
+/**
+ * hb_ft_font_get_face: (skip)
+ * @font: #hb_font_t to work upon
+ *
+ * Fetches the FT_Face associated with the specified #hb_font_t
+ * font object.
+ *
+ * This function works with #hb_font_t objects created by
+ * hb_ft_font_create() or hb_ft_font_create_referenced().
+ *
+ * Return value: (nullable): the FT_Face found or `NULL`
+ *
+ * Since: 0.9.2
+ * Deprecated: 10.4.0: Use hb_ft_font_get_ft_face() instead.
+ **/
+FT_Face
+hb_ft_font_get_face (hb_font_t *font)
+{
+  return hb_ft_font_get_ft_face (font);
+}
+
+#endif
+
 /**
  * hb_ft_font_lock_face: (skip)
  * @font: #hb_font_t to work upon
@@ -501,6 +531,26 @@ hb_ft_get_glyph_h_advances (hb_font_t* font, void* font_data,
       first_advance = &StructAtOffsetUnaligned (first_advance, advance_stride);
     }
   }
+
+#ifndef HB_NO_AAT
+  /* According to Ned, trak is applied by default for "modern fonts", as detected by presence of STAT table. */
+#ifndef HB_NO_STYLE
+  bool apply_trak = font->face->table.STAT->has_data () && font->face->table.trak->has_data ();
+#else
+  bool apply_trak = false;
+#endif
+  if (apply_trak)
+  {
+    hb_position_t tracking = font->face->table.trak->get_h_tracking (font);
+    first_advance = orig_first_advance;
+    for (unsigned int i = 0; i < count; i++)
+    {
+      *first_advance += tracking;
+      first_glyph = &StructAtOffsetUnaligned (first_glyph, glyph_stride);
+      first_advance = &StructAtOffsetUnaligned (first_advance, advance_stride);
+    }
+  }
+#endif
 }
 
 #ifndef HB_NO_VERTICAL
@@ -537,7 +587,20 @@ hb_ft_get_glyph_v_advance (hb_font_t *font,
    * have a Y growing upward.  Hence the extra negation. */
 
   hb_position_t y_strength = font->y_scale >= 0 ? font->y_strength : -font->y_strength;
-  return ((-v + (1<<9)) >> 10) + (font->embolden_in_place ? 0 : y_strength);
+  v = ((-v + (1<<9)) >> 10) + (font->embolden_in_place ? 0 : y_strength);
+
+#ifndef HB_NO_AAT
+  /* According to Ned, trak is applied by default for "modern fonts", as detected by presence of STAT table. */
+#ifndef HB_NO_STYLE
+  bool apply_trak = font->face->table.STAT->has_data () && font->face->table.trak->has_data ();
+#else
+  bool apply_trak = false;
+#endif
+  if (apply_trak)
+    v += font->face->table.trak->get_v_tracking (font);
+#endif
+
+  return v;
 }
 #endif
 
@@ -930,11 +993,15 @@ hb_ft_paint_glyph (hb_font_t *font,
   hb_lock_t lock (ft_font->lock);
   FT_Face ft_face = ft_font->ft_face;
 
+  FT_Long load_flags = ft_font->load_flags | FT_LOAD_NO_BITMAP | FT_LOAD_COLOR;
+#if (FREETYPE_MAJOR*10000 + FREETYPE_MINOR*100 + FREETYPE_PATCH) >= 21301
+  load_flags |= FT_LOAD_NO_SVG;
+#endif
+
   /* We release the lock before calling into glyph callbacks, such that
    * eg. draw API can call back into the face.*/
 
-  if (unlikely (FT_Load_Glyph (ft_face, gid,
-                               ft_font->load_flags | FT_LOAD_COLOR)))
+  if (unlikely (FT_Load_Glyph (ft_face, gid, load_flags)))
     return;
 
   if (ft_face->glyph->format == FT_GLYPH_FORMAT_OUTLINE)
@@ -1104,6 +1171,45 @@ _hb_ft_reference_table (hb_face_t *face HB_UNUSED, hb_tag_t tag, void *user_data
                          buffer, hb_free);
 }
 
+static unsigned
+_hb_ft_get_table_tags (const hb_face_t *face HB_UNUSED,
+                       unsigned int start_offset,
+                       unsigned int *table_count,
+                       hb_tag_t *table_tags,
+                       void *user_data)
+{
+  FT_Face ft_face = (FT_Face) user_data;
+
+  FT_ULong population = 0;
+  FT_Sfnt_Table_Info (ft_face,
+                      0, // table_index; ignored
+                      nullptr,
+                      &population);
+
+  if (!table_count)
+    return population;
+  else
+    *table_count = 0;
+
+  if (unlikely (start_offset >= population))
+    return population;
+
+  unsigned end_offset = hb_min (start_offset + *table_count, (unsigned) population);
+  if (unlikely (end_offset < start_offset))
+    return population;
+
+  *table_count = end_offset - start_offset;
+  for (unsigned i = start_offset; i < end_offset; i++)
+  {
+    FT_ULong tag = 0, length;
+    FT_Sfnt_Table_Info (ft_face, i, &tag, &length);
+    table_tags[i - start_offset] = tag;
+  }
+
+  return population;
+}
+
+
 /**
  * hb_ft_face_create:
  * @ft_face: (destroy destroy) (scope notified): FT_Face to work upon
@@ -1145,6 +1251,7 @@ hb_ft_face_create (FT_Face           ft_face,
     hb_blob_destroy (blob);
   } else {
     face = hb_face_create_for_tables (_hb_ft_reference_table, ft_face, destroy);
+    hb_face_set_get_table_tags_func (face, _hb_ft_get_table_tags, ft_face, nullptr);
   }
 
   hb_face_set_index (face, ft_face->face_index);
@@ -1215,7 +1322,7 @@ hb_ft_face_finalize (void *arg)
 hb_face_t *
 hb_ft_face_create_cached (FT_Face ft_face)
 {
-  if (unlikely (!ft_face->generic.data || ft_face->generic.finalizer != (FT_Generic_Finalizer) hb_ft_face_finalize))
+  if (unlikely (!ft_face->generic.data || ft_face->generic.finalizer != hb_ft_face_finalize))
   {
     if (ft_face->generic.finalizer)
       ft_face->generic.finalizer (ft_face);
@@ -1245,7 +1352,7 @@ hb_ft_face_create_cached (FT_Face ft_face)
  *
  * If you know you have valid reasons not to use hb_ft_font_create_referenced(),
  * then it is the client program's responsibility to destroy @ft_face
- * after the #hb_font_t font object has been destroyed.
+ * only after the #hb_font_t font object has been destroyed.
  *
  * HarfBuzz will use the @destroy callback on the #hb_font_t font object
  * if it is supplied when you use this function. However, even if @destroy
@@ -1392,6 +1499,24 @@ hb_ft_font_create_referenced (FT_Face ft_face)
   return hb_ft_font_create (ft_face, _hb_ft_face_destroy);
 }
 
+
+static void * _hb_ft_alloc (FT_Memory memory, long size)
+{ return hb_malloc (size); }
+
+static void _hb_ft_free (FT_Memory memory, void *block)
+{ hb_free (block); }
+
+static void * _hb_ft_realloc (FT_Memory memory, long cur_size, long new_size, void *block)
+{ return hb_realloc (block, new_size); }
+
+static FT_MemoryRec_ m =
+{
+  nullptr,
+  _hb_ft_alloc,
+  _hb_ft_free,
+  _hb_ft_realloc
+};
+
 static inline void free_static_ft_library ();
 
 static struct hb_ft_library_lazy_loader_t : hb_lazy_loader_t,
@@ -1400,16 +1525,19 @@ static struct hb_ft_library_lazy_loader_t : hb_lazy_loader_tgeneric.data);
+}
+
+static void
+destroy_ft_library (void *arg)
+{
+  FT_Done_Library ((FT_Library) arg);
+}
+
+/**
+ * hb_ft_face_create_from_file_or_fail:
+ * @file_name: A font filename
+ * @index: The index of the face within the file
+ *
+ * Creates an #hb_face_t face object from the specified
+ * font file and face index.
+ *
+ * This is similar in functionality to hb_face_create_from_file_or_fail(),
+ * but uses the FreeType library for loading the font file.
+ *
+ * Return value: (transfer full): The new face object, or `NULL` if
+ * no face is found at the specified index or the file cannot be read.
+ *
+ * Since: 10.1.0
+ */
+hb_face_t *
+hb_ft_face_create_from_file_or_fail (const char   *file_name,
+                                     unsigned int  index)
 {
-  return static_ft_library.get_unconst ();
+  FT_Library ft_library = reference_ft_library ();
+  if (unlikely (!ft_library))
+  {
+    DEBUG_MSG (FT, ft_library, "reference_ft_library failed");
+    return nullptr;
+  }
+
+  FT_Face ft_face;
+  if (unlikely (FT_New_Face (ft_library,
+                             file_name,
+                             index,
+                             &ft_face)))
+    return nullptr;
+
+  hb_face_t *face = hb_ft_face_create_referenced (ft_face);
+  FT_Done_Face (ft_face);
+
+  ft_face->generic.data = ft_library;
+  ft_face->generic.finalizer = finalize_ft_library;
+
+  if (hb_face_is_immutable (face))
+    return nullptr;
+
+  return face;
 }
 
 static void
@@ -1465,32 +1660,47 @@ _release_blob (void *arg)
 void
 hb_ft_font_set_funcs (hb_font_t *font)
 {
+  // In case of failure...
+  hb_font_set_funcs (font,
+                     hb_font_funcs_get_empty (),
+                     nullptr, nullptr);
+
   hb_blob_t *blob = hb_face_reference_blob (font->face);
   unsigned int blob_length;
   const char *blob_data = hb_blob_get_data (blob, &blob_length);
   if (unlikely (!blob_length))
     DEBUG_MSG (FT, font, "Font face has empty blob");
 
-  FT_Face ft_face = nullptr;
-  FT_Error err = FT_New_Memory_Face (get_ft_library (),
-                                     (const FT_Byte *) blob_data,
-                                     blob_length,
-                                     hb_face_get_index (font->face),
-                                     &ft_face);
+  FT_Library ft_library = reference_ft_library ();
+  if (unlikely (!ft_library))
+  {
+    hb_blob_destroy (blob);
+    DEBUG_MSG (FT, font, "reference_ft_library failed");
+    return;
+  }
 
-  if (unlikely (err)) {
+  FT_Face ft_face = nullptr;
+  if (unlikely (FT_New_Memory_Face (ft_library,
+                                    (const FT_Byte *) blob_data,
+                                    blob_length,
+                                    hb_face_get_index (font->face),
+                                    &ft_face)))
+  {
     hb_blob_destroy (blob);
-    DEBUG_MSG (FT, font, "Font face FT_New_Memory_Face() failed");
+    DEBUG_MSG (FT, font, "FT_New_Memory_Face() failed");
     return;
   }
 
   if (FT_Select_Charmap (ft_face, FT_ENCODING_MS_SYMBOL))
     FT_Select_Charmap (ft_face, FT_ENCODING_UNICODE);
 
-
+  // Hook the blob to the FT_Face
   ft_face->generic.data = blob;
   ft_face->generic.finalizer = _release_blob;
 
+  // And the FT_Library to the blob
+  hb_blob_set_user_data (blob, &ft_library_key, ft_library, destroy_ft_library, true);
+
   _hb_ft_font_set_funcs (font, ft_face, true);
   hb_ft_font_set_load_flags (font, FT_LOAD_DEFAULT | FT_LOAD_NO_HINTING);
 
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ft.h b/src/java.desktop/share/native/libharfbuzz/hb-ft.h
index b2d148014c06..94952f48a053 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-ft.h
+++ b/src/java.desktop/share/native/libharfbuzz/hb-ft.h
@@ -84,6 +84,9 @@ hb_ft_face_create_cached (FT_Face ft_face);
 HB_EXTERN hb_face_t *
 hb_ft_face_create_referenced (FT_Face ft_face);
 
+HB_EXTERN hb_face_t *
+hb_ft_face_create_from_file_or_fail (const char   *file_name,
+                                     unsigned int  index);
 
 /*
  * hb-font from ft-face.
@@ -108,7 +111,7 @@ HB_EXTERN hb_font_t *
 hb_ft_font_create_referenced (FT_Face ft_face);
 
 HB_EXTERN FT_Face
-hb_ft_font_get_face (hb_font_t *font);
+hb_ft_font_get_ft_face (hb_font_t *font);
 
 HB_EXTERN FT_Face
 hb_ft_font_lock_face (hb_font_t *font);
@@ -139,6 +142,13 @@ hb_ft_hb_font_changed (hb_font_t *font);
 HB_EXTERN void
 hb_ft_font_set_funcs (hb_font_t *font);
 
+#ifndef HB_DISABLE_DEPRECATED
+
+HB_DEPRECATED_FOR (hb_ft_font_get_ft_face)
+HB_EXTERN FT_Face
+hb_ft_font_get_face (hb_font_t *font);
+
+#endif
 
 HB_END_DECLS
 
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-geometry.hh b/src/java.desktop/share/native/libharfbuzz/hb-geometry.hh
new file mode 100644
index 000000000000..e91e371dc0c2
--- /dev/null
+++ b/src/java.desktop/share/native/libharfbuzz/hb-geometry.hh
@@ -0,0 +1,293 @@
+/*
+ * Copyright © 2022 Behdad Esfahbod
+ *
+ *  This is part of HarfBuzz, a text shaping library.
+ *
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, provided that the
+ * above copyright notice and the following two paragraphs appear in
+ * all copies of this software.
+ *
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
+ * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
+ * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ */
+#ifndef HB_GEOMETRY_HH
+#define HB_GEOMETRY_HH
+
+#include "hb.hh"
+
+
+struct hb_extents_t
+{
+  hb_extents_t () {}
+  hb_extents_t (float xmin, float ymin, float xmax, float ymax) :
+    xmin (xmin), ymin (ymin), xmax (xmax), ymax (ymax) {}
+
+  bool is_empty () const { return xmin >= xmax || ymin >= ymax; }
+  bool is_void () const { return xmin > xmax; }
+
+  void union_ (const hb_extents_t &o)
+  {
+    xmin = hb_min (xmin, o.xmin);
+    ymin = hb_min (ymin, o.ymin);
+    xmax = hb_max (xmax, o.xmax);
+    ymax = hb_max (ymax, o.ymax);
+  }
+
+  void intersect (const hb_extents_t &o)
+  {
+    xmin = hb_max (xmin, o.xmin);
+    ymin = hb_max (ymin, o.ymin);
+    xmax = hb_min (xmax, o.xmax);
+    ymax = hb_min (ymax, o.ymax);
+  }
+
+  void
+  add_point (float x, float y)
+  {
+    if (unlikely (is_void ()))
+    {
+      xmin = xmax = x;
+      ymin = ymax = y;
+    }
+    else
+    {
+      xmin = hb_min (xmin, x);
+      ymin = hb_min (ymin, y);
+      xmax = hb_max (xmax, x);
+      ymax = hb_max (ymax, y);
+    }
+  }
+
+  float xmin = 0.f;
+  float ymin = 0.f;
+  float xmax = -1.f;
+  float ymax = -1.f;
+};
+
+struct hb_transform_t
+{
+  hb_transform_t () {}
+  hb_transform_t (float xx, float yx,
+                  float xy, float yy,
+                  float x0, float y0) :
+    xx (xx), yx (yx), xy (xy), yy (yy), x0 (x0), y0 (y0) {}
+
+  bool is_identity () const
+  {
+    return xx == 1.f && yx == 0.f &&
+           xy == 0.f && yy == 1.f &&
+           x0 == 0.f && y0 == 0.f;
+  }
+
+  void multiply (const hb_transform_t &o)
+  {
+    /* Copied from cairo, with "o" being "a" there and "this" being "b" there. */
+    hb_transform_t r;
+
+    r.xx = o.xx * xx + o.yx * xy;
+    r.yx = o.xx * yx + o.yx * yy;
+
+    r.xy = o.xy * xx + o.yy * xy;
+    r.yy = o.xy * yx + o.yy * yy;
+
+    r.x0 = o.x0 * xx + o.y0 * xy + x0;
+    r.y0 = o.x0 * yx + o.y0 * yy + y0;
+
+    *this = r;
+  }
+
+  void transform_distance (float &dx, float &dy) const
+  {
+    float new_x = xx * dx + xy * dy;
+    float new_y = yx * dx + yy * dy;
+    dx = new_x;
+    dy = new_y;
+  }
+
+  void transform_point (float &x, float &y) const
+  {
+    transform_distance (x, y);
+    x += x0;
+    y += y0;
+  }
+
+  void transform_extents (hb_extents_t &extents) const
+  {
+    float quad_x[4], quad_y[4];
+
+    quad_x[0] = extents.xmin;
+    quad_y[0] = extents.ymin;
+    quad_x[1] = extents.xmin;
+    quad_y[1] = extents.ymax;
+    quad_x[2] = extents.xmax;
+    quad_y[2] = extents.ymin;
+    quad_x[3] = extents.xmax;
+    quad_y[3] = extents.ymax;
+
+    extents = hb_extents_t {};
+    for (unsigned i = 0; i < 4; i++)
+    {
+      transform_point (quad_x[i], quad_y[i]);
+      extents.add_point (quad_x[i], quad_y[i]);
+    }
+  }
+
+  void transform (const hb_transform_t &o) { multiply (o); }
+
+  void translate (float x, float y)
+  {
+    if (x == 0.f && y == 0.f)
+      return;
+
+    x0 += xx * x + xy * y;
+    y0 += yx * x + yy * y;
+  }
+
+  void scale (float scaleX, float scaleY)
+  {
+    if (scaleX == 1.f && scaleY == 1.f)
+      return;
+
+    xx *= scaleX;
+    yx *= scaleX;
+    xy *= scaleY;
+    yy *= scaleY;
+  }
+
+  void rotate (float rotation)
+  {
+    if (rotation == 0.f)
+      return;
+
+    // https://github.com/fonttools/fonttools/blob/f66ee05f71c8b57b5f519ee975e95edcd1466e14/Lib/fontTools/misc/transform.py#L240
+    rotation = rotation * HB_PI;
+    float c;
+    float s;
+#ifdef HAVE_SINCOSF
+    sincosf (rotation, &s, &c);
+#else
+    c = cosf (rotation);
+    s = sinf (rotation);
+#endif
+    auto other = hb_transform_t{c, s, -s, c, 0.f, 0.f};
+    transform (other);
+  }
+
+  void skew (float skewX, float skewY)
+  {
+    if (skewX == 0.f && skewY == 0.f)
+      return;
+
+    // https://github.com/fonttools/fonttools/blob/f66ee05f71c8b57b5f519ee975e95edcd1466e14/Lib/fontTools/misc/transform.py#L255
+    skewX = skewX * HB_PI;
+    skewY = skewY * HB_PI;
+    auto other = hb_transform_t{1.f,
+                                skewY ? tanf (skewY) : 0.f,
+                                skewX ? tanf (skewX) : 0.f,
+                                1.f,
+                                0.f, 0.f};
+    transform (other);
+  }
+
+  float xx = 1.f;
+  float yx = 0.f;
+  float xy = 0.f;
+  float yy = 1.f;
+  float x0 = 0.f;
+  float y0 = 0.f;
+};
+
+#define HB_TRANSFORM_IDENTITY hb_transform_t{1.f, 0.f, 0.f, 1.f, 0.f, 0.f}
+
+struct hb_bounds_t
+{
+  enum status_t {
+    UNBOUNDED,
+    BOUNDED,
+    EMPTY,
+  };
+
+  hb_bounds_t (status_t status) : status (status) {}
+  hb_bounds_t (const hb_extents_t &extents) :
+    status (extents.is_empty () ? EMPTY : BOUNDED), extents (extents) {}
+
+  void union_ (const hb_bounds_t &o)
+  {
+    if (o.status == UNBOUNDED)
+      status = UNBOUNDED;
+    else if (o.status == BOUNDED)
+    {
+      if (status == EMPTY)
+        *this = o;
+      else if (status == BOUNDED)
+        extents.union_ (o.extents);
+    }
+  }
+
+  void intersect (const hb_bounds_t &o)
+  {
+    if (o.status == EMPTY)
+      status = EMPTY;
+    else if (o.status == BOUNDED)
+    {
+      if (status == UNBOUNDED)
+        *this = o;
+      else if (status == BOUNDED)
+      {
+        extents.intersect (o.extents);
+        if (extents.is_empty ())
+          status = EMPTY;
+      }
+    }
+  }
+
+  status_t status;
+  hb_extents_t extents;
+};
+
+struct hb_transform_decomposed_t
+{
+  float translateX = 0;
+  float translateY = 0;
+  float rotation = 0;  // in degrees, counter-clockwise
+  float scaleX = 1;
+  float scaleY = 1;
+  float skewX = 0;  // in degrees, counter-clockwise
+  float skewY = 0;  // in degrees, counter-clockwise
+  float tCenterX = 0;
+  float tCenterY = 0;
+
+  operator bool () const
+  {
+    return translateX || translateY ||
+           rotation ||
+           scaleX != 1 || scaleY != 1 ||
+           skewX || skewY ||
+           tCenterX || tCenterY;
+  }
+
+  hb_transform_t to_transform () const
+  {
+    hb_transform_t t;
+    t.translate (translateX + tCenterX, translateY + tCenterY);
+    t.rotate (rotation);
+    t.scale (scaleX, scaleY);
+    t.skew (-skewX, skewY);
+    t.translate (-tCenterX, -tCenterY);
+    return t;
+  }
+};
+
+
+#endif /* HB_GEOMETRY_HH */
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-iter.hh b/src/java.desktop/share/native/libharfbuzz/hb-iter.hh
index ad45dcf2c1d4..21d9544a74b0 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-iter.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-iter.hh
@@ -324,6 +324,16 @@ struct hb_is_sink_of
         (hb_is_source_of(Iter, Item) && Iter::is_sorted_iterator)
 
 
+struct
+{
+  template 
+  unsigned operator () (const Iterable &_) const { return hb_len (hb_iter (_)); }
+
+  unsigned operator () (unsigned _) const { return _; }
+}
+HB_FUNCOBJ (hb_len_of);
+
 /* Range-based 'for' for iterables. */
 
 template 
 struct hb_hashmap_t
 {
+  static constexpr bool realloc_move = true;
+
   hb_hashmap_t ()  { init (); }
   ~hb_hashmap_t () { fini (); }
 
-  hb_hashmap_t (const hb_hashmap_t& o) : hb_hashmap_t () { alloc (o.population); hb_copy (o, *this); }
-  hb_hashmap_t (hb_hashmap_t&& o) : hb_hashmap_t () { hb_swap (*this, o); }
+  hb_hashmap_t (const hb_hashmap_t& o) : hb_hashmap_t ()
+  {
+    if (unlikely (!o.mask)) return;
+
+    if (item_t::is_trivial)
+    {
+      items = (item_t *) hb_malloc (sizeof (item_t) * (o.mask + 1));
+      if (unlikely (!items))
+      {
+        successful = false;
+        return;
+      }
+      population = o.population;
+      occupancy = o.occupancy;
+      mask = o.mask;
+      prime = o.prime;
+      max_chain_length = o.max_chain_length;
+      memcpy (items, o.items, sizeof (item_t) * (mask + 1));
+      return;
+    }
+
+    alloc (o.population); hb_copy (o, *this);
+  }
+  hb_hashmap_t (hb_hashmap_t&& o)  noexcept : hb_hashmap_t () { hb_swap (*this, o); }
   hb_hashmap_t& operator= (const hb_hashmap_t& o)  { reset (); alloc (o.population); hb_copy (o, *this); return *this; }
-  hb_hashmap_t& operator= (hb_hashmap_t&& o)  { hb_swap (*this, o); return *this; }
+  hb_hashmap_t& operator= (hb_hashmap_t&& o)   noexcept { hb_swap (*this, o); return *this; }
 
   hb_hashmap_t (std::initializer_list> lst) : hb_hashmap_t ()
   {
@@ -113,26 +137,23 @@ struct hb_hashmap_t
   };
 
   hb_object_header_t header;
-  unsigned int successful : 1; /* Allocations successful */
-  unsigned int population : 31; /* Not including tombstones. */
+  bool successful; /* Allocations successful */
+  unsigned short max_chain_length;
+  unsigned int population; /* Not including tombstones. */
   unsigned int occupancy; /* Including tombstones. */
   unsigned int mask;
   unsigned int prime;
-  unsigned int max_chain_length;
   item_t *items;
 
-  friend void swap (hb_hashmap_t& a, hb_hashmap_t& b)
+  friend void swap (hb_hashmap_t& a, hb_hashmap_t& b) noexcept
   {
     if (unlikely (!a.successful || !b.successful))
       return;
-    unsigned tmp = a.population;
-    a.population = b.population;
-    b.population = tmp;
-    //hb_swap (a.population, b.population);
+    hb_swap (a.max_chain_length, b.max_chain_length);
+    hb_swap (a.population, b.population);
     hb_swap (a.occupancy, b.occupancy);
     hb_swap (a.mask, b.mask);
     hb_swap (a.prime, b.prime);
-    hb_swap (a.max_chain_length, b.max_chain_length);
     hb_swap (a.items, b.items);
   }
   void init ()
@@ -140,10 +161,10 @@ struct hb_hashmap_t
     hb_object_init (this);
 
     successful = true;
+    max_chain_length = 0;
     population = occupancy = 0;
     mask = 0;
     prime = 0;
-    max_chain_length = 0;
     items = nullptr;
   }
   void fini ()
@@ -209,9 +230,10 @@ struct hb_hashmap_t
                        old_items[i].hash,
                        std::move (old_items[i].value));
       }
-      if (!item_t::is_trivial)
-        old_items[i].~item_t ();
     }
+    if (!item_t::is_trivial)
+      for (unsigned int i = 0; i < old_size; i++)
+        old_items[i].~item_t ();
 
     hb_free (old_items);
 
@@ -285,7 +307,7 @@ struct hb_hashmap_t
   const V& get_with_hash (const K &key, uint32_t hash) const
   {
     if (!items) return item_t::default_value ();
-    auto *item = fetch_item (key, hb_hash (key));
+    auto *item = fetch_item (key, hash);
     if (item)
       return item->value;
     return item_t::default_value ();
@@ -533,7 +555,7 @@ struct hb_map_t : hb_hashmap_t lst) : hashmap (lst) {}
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-null.hh b/src/java.desktop/share/native/libharfbuzz/hb-null.hh
index 4a5270e34002..63ec9a7c64d0 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-null.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-null.hh
@@ -176,7 +176,7 @@ template 
 static inline Type& Crap () {
   static_assert (hb_null_size (Type) <= HB_NULL_POOL_SIZE, "Increase HB_NULL_POOL_SIZE.");
   Type *obj = reinterpret_cast (_hb_CrapPool);
-  memcpy (obj, std::addressof (Null (Type)), sizeof (*obj));
+  memcpy (reinterpret_cast(obj), std::addressof (Null (Type)), sizeof (*obj));
   return *obj;
 }
 template 
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-object.hh b/src/java.desktop/share/native/libharfbuzz/hb-object.hh
index ef675f835f11..c02ec8bfacf2 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-object.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-object.hh
@@ -325,7 +325,7 @@ retry:
   hb_user_data_array_t *user_data = obj->header.user_data.get_acquire ();
   if (unlikely (!user_data))
   {
-    user_data = (hb_user_data_array_t *) hb_calloc (sizeof (hb_user_data_array_t), 1);
+    user_data = (hb_user_data_array_t *) hb_calloc (1, sizeof (hb_user_data_array_t));
     if (unlikely (!user_data))
       return false;
     user_data->init ();
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-open-file.hh b/src/java.desktop/share/native/libharfbuzz/hb-open-file.hh
index 387b1430ac1e..382ee2ddaf24 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-open-file.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-open-file.hh
@@ -250,7 +250,7 @@ struct TTCHeader
   {
     switch (u.header.version.major) {
     case 2: /* version 2 is compatible with version 1 */
-    case 1: return u.version1.get_face_count ();
+    case 1: hb_barrier (); return u.version1.get_face_count ();
     default:return 0;
     }
   }
@@ -258,7 +258,7 @@ struct TTCHeader
   {
     switch (u.header.version.major) {
     case 2: /* version 2 is compatible with version 1 */
-    case 1: return u.version1.get_face (i);
+    case 1: hb_barrier (); return u.version1.get_face (i);
     default:return Null (OpenTypeFontFace);
     }
   }
@@ -267,9 +267,10 @@ struct TTCHeader
   {
     TRACE_SANITIZE (this);
     if (unlikely (!u.header.version.sanitize (c))) return_trace (false);
+    hb_barrier ();
     switch (u.header.version.major) {
     case 2: /* version 2 is compatible with version 1 */
-    case 1: return_trace (u.version1.sanitize (c));
+    case 1: hb_barrier (); return_trace (u.version1.sanitize (c));
     default:return_trace (true);
     }
   }
@@ -302,6 +303,7 @@ struct ResourceRecord
     TRACE_SANITIZE (this);
     return_trace (c->check_struct (this) &&
                   offset.sanitize (c, data_base) &&
+                  hb_barrier () &&
                   get_face (data_base).sanitize (c));
   }
 
@@ -337,6 +339,7 @@ struct ResourceTypeRecord
   {
     TRACE_SANITIZE (this);
     return_trace (c->check_struct (this) &&
+                  hb_barrier () &&
                   resourcesZ.sanitize (c, type_base,
                                        get_resource_count (),
                                        data_base));
@@ -385,6 +388,7 @@ struct ResourceMap
   {
     TRACE_SANITIZE (this);
     return_trace (c->check_struct (this) &&
+                  hb_barrier () &&
                   typeList.sanitize (c, this,
                                      &(this+typeList),
                                      data_base));
@@ -428,6 +432,7 @@ struct ResourceForkHeader
   {
     TRACE_SANITIZE (this);
     return_trace (c->check_struct (this) &&
+                  hb_barrier () &&
                   data.sanitize (c, this, dataLen) &&
                   map.sanitize (c, this, &(this+data)));
   }
@@ -508,6 +513,7 @@ struct OpenTypeFontFile
   {
     TRACE_SANITIZE (this);
     if (unlikely (!u.tag.sanitize (c))) return_trace (false);
+    hb_barrier ();
     switch (u.tag) {
     case CFFTag:        /* All the non-collection tags */
     case TrueTag:
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-open-type.hh b/src/java.desktop/share/native/libharfbuzz/hb-open-type.hh
index 25142da44a6c..89da9c7bc95c 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-open-type.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-open-type.hh
@@ -86,21 +86,12 @@ struct IntType
 
     return pb->cmp (*pa);
   }
-  template ::value &&
-                          sizeof (Type2) < sizeof (int) &&
-                          sizeof (Type) < sizeof (int))>
-  int cmp (Type2 a) const
-  {
-    Type b = v;
-    return (int) a - (int) b;
-  }
   template 
   int cmp (Type2 a) const
   {
     Type b = v;
-    return a < b ? -1 : a == b ? 0 : +1;
+    return (a > b) - (a < b);
   }
   bool sanitize (hb_sanitize_context_t *c) const
   {
@@ -132,6 +123,89 @@ struct HBUINT15 : HBUINT16
   DEFINE_SIZE_STATIC (2);
 };
 
+/* 32-bit unsigned integer with variable encoding. */
+struct HBUINT32VAR
+{
+  unsigned get_size () const
+  {
+    unsigned b0 = v[0];
+    if (b0 < 0x80)
+      return 1;
+    else if (b0 < 0xC0)
+      return 2;
+    else if (b0 < 0xE0)
+      return 3;
+    else if (b0 < 0xF0)
+      return 4;
+    else
+      return 5;
+  }
+
+  static unsigned get_size (uint32_t v)
+  {
+    if (v < 0x80)
+      return 1;
+    else if (v < 0x4000)
+      return 2;
+    else if (v < 0x200000)
+      return 3;
+    else if (v < 0x10000000)
+      return 4;
+    else
+      return 5;
+  }
+
+  bool sanitize (hb_sanitize_context_t *c) const
+  {
+    TRACE_SANITIZE (this);
+    return_trace (c->check_range (v, 1) &&
+                  hb_barrier () &&
+                  c->check_range (v, get_size ()));
+  }
+
+  operator uint32_t () const
+  {
+    unsigned b0 = v[0];
+    if (b0 < 0x80)
+      return b0;
+    else if (b0 < 0xC0)
+      return ((b0 & 0x3F) << 8) | v[1];
+    else if (b0 < 0xE0)
+      return ((b0 & 0x1F) << 16) | (v[1] << 8) | v[2];
+    else if (b0 < 0xF0)
+      return ((b0 & 0x0F) << 24) | (v[1] << 16) | (v[2] << 8) | v[3];
+    else
+      return (v[1] << 24) | (v[2] << 16) | (v[3] << 8) | v[4];
+  }
+
+  static bool serialize (hb_serialize_context_t *c, uint32_t v)
+  {
+    unsigned len = get_size (v);
+
+    unsigned char *buf = c->allocate_size (len, false);
+    if (unlikely (!buf))
+      return false;
+
+    unsigned char *p = buf + len;
+    for (unsigned i = 0; i < len; i++)
+    {
+      *--p = v & 0xFF;
+      v >>= 8;
+    }
+
+    if (len > 1)
+      buf[0] |= ((1 << (len - 1)) - 1) << (9 - len);
+
+    return true;
+  }
+
+  protected:
+  unsigned char v[5];
+
+  public:
+  DEFINE_SIZE_MIN (1);
+};
+
 /* 16-bit signed integer (HBINT16) that describes a quantity in FUnits. */
 typedef HBINT16 FWORD;
 
@@ -149,6 +223,7 @@ struct HBFixed : Type
 
   operator signed () const = delete;
   operator unsigned () const = delete;
+  explicit operator float () const { return to_float (); }
   typename Type::type to_int () const { return Type::v; }
   void set_int (typename Type::type i ) { Type::v = i; }
   float to_float (float offset = 0) const  { return ((int32_t) Type::v + offset) / shift; }
@@ -215,11 +290,6 @@ typedef Index NameID;
 struct VarIdx : HBUINT32 {
   static constexpr unsigned NO_VARIATION = 0xFFFFFFFFu;
   static_assert (NO_VARIATION == HB_OT_LAYOUT_NO_VARIATIONS_INDEX, "");
-  static uint32_t add (uint32_t i, unsigned short v)
-  {
-    if (i == NO_VARIATION) return i;
-    return i + v;
-  }
   VarIdx& operator = (uint32_t i) { HBUINT32::operator= (i); return *this; }
 };
 DECLARE_NULL_NAMESPACE_BYTES (OT, VarIdx);
@@ -309,7 +379,7 @@ struct _hb_has_null
   static       Type *get_crap () { return &Crap (Type); }
 };
 
-template 
+template 
 struct OffsetTo : Offset
 {
   using target_t = Type;
@@ -335,22 +405,22 @@ struct OffsetTo : Offset
   }
 
   template 
+            hb_enable_if (hb_is_convertible (const Base, const BaseType *))>
   friend const Type& operator + (const Base &base, const OffsetTo &offset) { return offset ((const void *) base); }
   template 
+            hb_enable_if (hb_is_convertible (const Base, const BaseType *))>
   friend const Type& operator + (const OffsetTo &offset, const Base &base) { return offset ((const void *) base); }
   template 
+            hb_enable_if (hb_is_convertible (Base, BaseType *))>
   friend Type& operator + (Base &&base, OffsetTo &offset) { return offset ((void *) base); }
   template 
+            hb_enable_if (hb_is_convertible (Base, BaseType *))>
   friend Type& operator + (OffsetTo &offset, Base &&base) { return offset ((void *) base); }
 
 
-  template 
+  template 
   bool serialize_subset (hb_subset_context_t *c, const OffsetTo& src,
-                         const void *src_base, Ts&&... ds)
+                         const Base *src_base, Ts&&... ds)
   {
     *this = 0;
     if (src.is_null ())
@@ -414,10 +484,11 @@ struct OffsetTo : Offset
                        const void *src_base, unsigned dst_bias = 0)
   { return serialize_copy (c, src, src_base, dst_bias, hb_serialize_context_t::Head); }
 
-  bool sanitize_shallow (hb_sanitize_context_t *c, const void *base) const
+  bool sanitize_shallow (hb_sanitize_context_t *c, const BaseType *base) const
   {
     TRACE_SANITIZE (this);
     if (unlikely (!c->check_struct (this))) return_trace (false);
+    hb_barrier ();
     //if (unlikely (this->is_null ())) return_trace (true);
     if (unlikely ((const char *) base + (unsigned) *this < (const char *) base)) return_trace (false);
     return_trace (true);
@@ -427,10 +498,11 @@ struct OffsetTo : Offset
 #ifndef HB_OPTIMIZE_SIZE
   HB_ALWAYS_INLINE
 #endif
-  bool sanitize (hb_sanitize_context_t *c, const void *base, Ts&&... ds) const
+  bool sanitize (hb_sanitize_context_t *c, const BaseType *base, Ts&&... ds) const
   {
     TRACE_SANITIZE (this);
     return_trace (sanitize_shallow (c, base) &&
+                  hb_barrier () &&
                   (this->is_null () ||
                    c->dispatch (StructAtOffset (base, *this), std::forward (ds)...) ||
                    neuter (c)));
@@ -445,14 +517,14 @@ struct OffsetTo : Offset
   DEFINE_SIZE_STATIC (sizeof (OffsetType));
 };
 /* Partial specializations. */
-template  using Offset16To = OffsetTo;
-template  using Offset24To = OffsetTo;
-template  using Offset32To = OffsetTo;
+template  using Offset16To = OffsetTo;
+template  using Offset24To = OffsetTo;
+template  using Offset32To = OffsetTo;
 
-template  using NNOffsetTo = OffsetTo;
-template  using NNOffset16To = Offset16To;
-template  using NNOffset24To = Offset24To;
-template  using NNOffset32To = Offset32To;
+template  using NNOffsetTo = OffsetTo;
+template  using NNOffset16To = Offset16To;
+template  using NNOffset24To = Offset24To;
+template  using NNOffset32To = Offset32To;
 
 
 /*
@@ -536,6 +608,7 @@ struct UnsizedArrayOf
     TRACE_SANITIZE (this);
     if (unlikely (!sanitize_shallow (c, count))) return_trace (false);
     if (!sizeof... (Ts) && hb_is_trivially_copyable(Type)) return_trace (true);
+    hb_barrier ();
     for (unsigned int i = 0; i < count; i++)
       if (unlikely (!c->dispatch (arrayZ[i], std::forward (ds)...)))
         return_trace (false);
@@ -555,27 +628,27 @@ struct UnsizedArrayOf
 };
 
 /* Unsized array of offset's */
-template 
-using UnsizedArray16OfOffsetTo = UnsizedArrayOf>;
+template 
+using UnsizedArray16OfOffsetTo = UnsizedArrayOf>;
 
 /* Unsized array of offsets relative to the beginning of the array itself. */
-template 
-struct UnsizedListOfOffset16To : UnsizedArray16OfOffsetTo
+template 
+struct UnsizedListOfOffset16To : UnsizedArray16OfOffsetTo
 {
   const Type& operator [] (int i_) const
   {
     unsigned int i = (unsigned int) i_;
-    const OffsetTo *p = &this->arrayZ[i];
+    const OffsetTo *p = &this->arrayZ[i];
     if (unlikely ((const void *) p < (const void *) this->arrayZ)) return Null (Type); /* Overflowed. */
-    _hb_compiler_memory_r_barrier ();
+    hb_barrier ();
     return this+*p;
   }
   Type& operator [] (int i_)
   {
     unsigned int i = (unsigned int) i_;
-    const OffsetTo *p = &this->arrayZ[i];
+    const OffsetTo *p = &this->arrayZ[i];
     if (unlikely ((const void *) p < (const void *) this->arrayZ)) return Crap (Type); /* Overflowed. */
-    _hb_compiler_memory_r_barrier ();
+    hb_barrier ();
     return this+*p;
   }
 
@@ -583,7 +656,7 @@ struct UnsizedListOfOffset16To : UnsizedArray16OfOffsetTo
+    return_trace ((UnsizedArray16OfOffsetTo
                    ::sanitize (c, count, this, std::forward (ds)...)));
   }
 };
@@ -626,14 +699,14 @@ struct ArrayOf
   {
     unsigned int i = (unsigned int) i_;
     if (unlikely (i >= len)) return Null (Type);
-    _hb_compiler_memory_r_barrier ();
+    hb_barrier ();
     return arrayZ[i];
   }
   Type& operator [] (int i_)
   {
     unsigned int i = (unsigned int) i_;
     if (unlikely (i >= len)) return Crap (Type);
-    _hb_compiler_memory_r_barrier ();
+    hb_barrier ();
     return arrayZ[i];
   }
 
@@ -725,6 +798,7 @@ struct ArrayOf
     TRACE_SANITIZE (this);
     if (unlikely (!sanitize_shallow (c))) return_trace (false);
     if (!sizeof... (Ts) && hb_is_trivially_copyable(Type)) return_trace (true);
+    hb_barrier ();
     unsigned int count = len;
     for (unsigned int i = 0; i < count; i++)
       if (unlikely (!c->dispatch (arrayZ[i], std::forward (ds)...)))
@@ -735,7 +809,9 @@ struct ArrayOf
   bool sanitize_shallow (hb_sanitize_context_t *c) const
   {
     TRACE_SANITIZE (this);
-    return_trace (len.sanitize (c) && c->check_array_sized (arrayZ, len, sizeof (LenType)));
+    return_trace (len.sanitize (c) &&
+                  hb_barrier () &&
+                  c->check_array_sized (arrayZ, len, sizeof (LenType)));
   }
 
   public:
@@ -750,6 +826,7 @@ template  using Array32Of = ArrayOf;
 using PString = ArrayOf;
 
 /* Array of Offset's */
+template  using Array8OfOffset24To = ArrayOf, HBUINT8>;
 template  using Array16OfOffset16To = ArrayOf, HBUINT16>;
 template  using Array16OfOffset32To = ArrayOf, HBUINT16>;
 template  using Array32OfOffset32To = ArrayOf, HBUINT32>;
@@ -762,14 +839,14 @@ struct List16OfOffsetTo : ArrayOf, HBUINT16>
   {
     unsigned int i = (unsigned int) i_;
     if (unlikely (i >= this->len)) return Null (Type);
-    _hb_compiler_memory_r_barrier ();
+    hb_barrier ();
     return this+this->arrayZ[i];
   }
   const Type& operator [] (int i_)
   {
     unsigned int i = (unsigned int) i_;
     if (unlikely (i >= this->len)) return Crap (Type);
-    _hb_compiler_memory_r_barrier ();
+    hb_barrier ();
     return this+this->arrayZ[i];
   }
 
@@ -807,14 +884,14 @@ struct HeadlessArrayOf
   {
     unsigned int i = (unsigned int) i_;
     if (unlikely (i >= lenP1 || !i)) return Null (Type);
-    _hb_compiler_memory_r_barrier ();
+    hb_barrier ();
     return arrayZ[i-1];
   }
   Type& operator [] (int i_)
   {
     unsigned int i = (unsigned int) i_;
     if (unlikely (i >= lenP1 || !i)) return Crap (Type);
-    _hb_compiler_memory_r_barrier ();
+    hb_barrier ();
     return arrayZ[i-1];
   }
   unsigned int get_size () const
@@ -866,6 +943,7 @@ struct HeadlessArrayOf
     TRACE_SANITIZE (this);
     if (unlikely (!sanitize_shallow (c))) return_trace (false);
     if (!sizeof... (Ts) && hb_is_trivially_copyable(Type)) return_trace (true);
+    hb_barrier ();
     unsigned int count = get_length ();
     for (unsigned int i = 0; i < count; i++)
       if (unlikely (!c->dispatch (arrayZ[i], std::forward (ds)...)))
@@ -878,6 +956,7 @@ struct HeadlessArrayOf
   {
     TRACE_SANITIZE (this);
     return_trace (lenP1.sanitize (c) &&
+                  hb_barrier () &&
                   (!lenP1 || c->check_array_sized (arrayZ, lenP1 - 1, sizeof (LenType))));
   }
 
@@ -899,14 +978,14 @@ struct ArrayOfM1
   {
     unsigned int i = (unsigned int) i_;
     if (unlikely (i > lenM1)) return Null (Type);
-    _hb_compiler_memory_r_barrier ();
+    hb_barrier ();
     return arrayZ[i];
   }
   Type& operator [] (int i_)
   {
     unsigned int i = (unsigned int) i_;
     if (unlikely (i > lenM1)) return Crap (Type);
-    _hb_compiler_memory_r_barrier ();
+    hb_barrier ();
     return arrayZ[i];
   }
   unsigned int get_size () const
@@ -919,6 +998,7 @@ struct ArrayOfM1
     TRACE_SANITIZE (this);
     if (unlikely (!sanitize_shallow (c))) return_trace (false);
     if (!sizeof... (Ts) && hb_is_trivially_copyable(Type)) return_trace (true);
+    hb_barrier ();
     unsigned int count = lenM1 + 1;
     for (unsigned int i = 0; i < count; i++)
       if (unlikely (!c->dispatch (arrayZ[i], std::forward (ds)...)))
@@ -931,6 +1011,7 @@ struct ArrayOfM1
   {
     TRACE_SANITIZE (this);
     return_trace (lenM1.sanitize (c) &&
+                  hb_barrier () &&
                   (c->check_array_sized (arrayZ, lenM1 + 1, sizeof (LenType))));
   }
 
@@ -975,6 +1056,13 @@ struct SortedArrayOf : ArrayOf
     return_trace (ret);
   }
 
+  SortedArrayOf* copy (hb_serialize_context_t *c) const
+  {
+    TRACE_SERIALIZE (this);
+    SortedArrayOf* out = reinterpret_cast (ArrayOf::copy (c));
+    return_trace (out);
+  }
+
   template 
   Type &bsearch (const T &x, Type ¬_found = Crap (Type))
   { return *as_array ().bsearch (x, ¬_found); }
@@ -1082,14 +1170,14 @@ struct VarSizedBinSearchArrayOf
   {
     unsigned int i = (unsigned int) i_;
     if (unlikely (i >= get_length ())) return Null (Type);
-    _hb_compiler_memory_r_barrier ();
+    hb_barrier ();
     return StructAtOffset (&bytesZ, i * header.unitSize);
   }
   Type& operator [] (int i_)
   {
     unsigned int i = (unsigned int) i_;
     if (unlikely (i >= get_length ())) return Crap (Type);
-    _hb_compiler_memory_r_barrier ();
+    hb_barrier ();
     return StructAtOffset (&bytesZ, i * header.unitSize);
   }
   unsigned int get_length () const
@@ -1104,6 +1192,7 @@ struct VarSizedBinSearchArrayOf
     TRACE_SANITIZE (this);
     if (unlikely (!sanitize_shallow (c))) return_trace (false);
     if (!sizeof... (Ts) && hb_is_trivially_copyable(Type)) return_trace (true);
+    hb_barrier ();
     unsigned int count = get_length ();
     for (unsigned int i = 0; i < count; i++)
       if (unlikely (!(*this)[i].sanitize (c, std::forward (ds)...)))
@@ -1130,6 +1219,7 @@ struct VarSizedBinSearchArrayOf
   {
     TRACE_SANITIZE (this);
     return_trace (header.sanitize (c) &&
+                  hb_barrier () &&
                   Type::static_size <= header.unitSize &&
                   c->check_range (bytesZ.arrayZ,
                                   header.nUnits,
@@ -1144,6 +1234,800 @@ struct VarSizedBinSearchArrayOf
 };
 
 
+/* CFF INDEX */
+
+template 
+struct CFFIndex
+{
+  unsigned int offset_array_size () const
+  { return offSize * (count + 1); }
+
+  template 
+  bool serialize (hb_serialize_context_t *c,
+                  const Iterable &iterable,
+                  const unsigned *p_data_size = nullptr,
+                  unsigned min_off_size = 0)
+  {
+    TRACE_SERIALIZE (this);
+    unsigned data_size;
+    if (p_data_size)
+      data_size = *p_data_size;
+    else
+      total_size (iterable, &data_size);
+
+    auto it = hb_iter (iterable);
+    if (unlikely (!serialize_header (c, +it, data_size, min_off_size))) return_trace (false);
+    unsigned char *ret = c->allocate_size (data_size, false);
+    if (unlikely (!ret)) return_trace (false);
+    for (const auto &_ : +it)
+    {
+      unsigned len = _.length;
+      if (!len)
+        continue;
+      if (len <= 1)
+      {
+        *ret++ = *_.arrayZ;
+        continue;
+      }
+      hb_memcpy (ret, _.arrayZ, len);
+      ret += len;
+    }
+    return_trace (true);
+  }
+
+  template 
+  bool serialize_header (hb_serialize_context_t *c,
+                         Iterator it,
+                         unsigned data_size,
+                         unsigned min_off_size = 0)
+  {
+    TRACE_SERIALIZE (this);
+
+    unsigned off_size = (hb_bit_storage (data_size + 1) + 7) / 8;
+    off_size = hb_max(min_off_size, off_size);
+
+    /* serialize CFFIndex header */
+    if (unlikely (!c->extend_min (this))) return_trace (false);
+    this->count = hb_len (it);
+    if (!this->count) return_trace (true);
+    if (unlikely (!c->extend (this->offSize))) return_trace (false);
+    this->offSize = off_size;
+    if (unlikely (!c->allocate_size (off_size * (this->count + 1), false)))
+      return_trace (false);
+
+    /* serialize indices */
+    unsigned int offset = 1;
+    if (HB_OPTIMIZE_SIZE_VAL)
+    {
+      unsigned int i = 0;
+      for (const auto &_ : +it)
+      {
+        set_offset_at (i++, offset);
+        offset += hb_len_of (_);
+      }
+      set_offset_at (i, offset);
+    }
+    else
+      switch (off_size)
+      {
+        case 1:
+        {
+          HBUINT8 *p = (HBUINT8 *) offsets;
+          for (const auto &_ : +it)
+          {
+            *p++ = offset;
+            offset += hb_len_of (_);
+          }
+          *p = offset;
+        }
+        break;
+        case 2:
+        {
+          HBUINT16 *p = (HBUINT16 *) offsets;
+          for (const auto &_ : +it)
+          {
+            *p++ = offset;
+            offset += hb_len_of (_);
+          }
+          *p = offset;
+        }
+        break;
+        case 3:
+        {
+          HBUINT24 *p = (HBUINT24 *) offsets;
+          for (const auto &_ : +it)
+          {
+            *p++ = offset;
+            offset += hb_len_of (_);
+          }
+          *p = offset;
+        }
+        break;
+        case 4:
+        {
+          HBUINT32 *p = (HBUINT32 *) offsets;
+          for (const auto &_ : +it)
+          {
+            *p++ = offset;
+            offset += hb_len_of (_);
+          }
+          *p = offset;
+        }
+        break;
+        default:
+        break;
+      }
+
+    assert (offset == data_size + 1);
+    return_trace (true);
+  }
+
+  template 
+  static unsigned total_size (const Iterable &iterable, unsigned *data_size = nullptr, unsigned min_off_size = 0)
+  {
+    auto it = + hb_iter (iterable);
+    if (!it)
+    {
+      if (data_size) *data_size = 0;
+      return min_size;
+    }
+
+    unsigned total = 0;
+    for (const auto &_ : +it)
+      total += hb_len_of (_);
+
+    if (data_size) *data_size = total;
+
+    unsigned off_size = (hb_bit_storage (total + 1) + 7) / 8;
+    off_size = hb_max(min_off_size, off_size);
+
+    return min_size + HBUINT8::static_size + (hb_len (it) + 1) * off_size + total;
+  }
+
+  void set_offset_at (unsigned int index, unsigned int offset)
+  {
+    assert (index <= count);
+
+    unsigned int size = offSize;
+    const HBUINT8 *p = offsets;
+    switch (size)
+    {
+      case 1: ((HBUINT8  *) p)[index] = offset; break;
+      case 2: ((HBUINT16 *) p)[index] = offset; break;
+      case 3: ((HBUINT24 *) p)[index] = offset; break;
+      case 4: ((HBUINT32 *) p)[index] = offset; break;
+      default: return;
+    }
+  }
+
+  private:
+  unsigned int offset_at (unsigned int index) const
+  {
+    assert (index <= count);
+
+    unsigned int size = offSize;
+    const HBUINT8 *p = offsets;
+    switch (size)
+    {
+      case 1: return ((HBUINT8  *) p)[index];
+      case 2: return ((HBUINT16 *) p)[index];
+      case 3: return ((HBUINT24 *) p)[index];
+      case 4: return ((HBUINT32 *) p)[index];
+      default: return 0;
+    }
+  }
+
+  const unsigned char *data_base () const
+  { return (const unsigned char *) this + min_size + offSize.static_size - 1 + offset_array_size (); }
+  public:
+
+  hb_ubytes_t operator [] (unsigned int index) const
+  {
+    if (unlikely (index >= count)) return hb_ubytes_t ();
+    hb_barrier ();
+    unsigned offset0 = offset_at (index);
+    unsigned offset1 = offset_at (index + 1);
+    if (unlikely (offset1 < offset0 || offset1 > offset_at (count)))
+      return hb_ubytes_t ();
+    return hb_ubytes_t (data_base () + offset0, offset1 - offset0);
+  }
+
+  unsigned int get_size () const
+  {
+    if (count)
+      return min_size + offSize.static_size + offset_array_size () + (offset_at (count) - 1);
+    return min_size;  /* empty CFFIndex contains count only */
+  }
+
+  bool sanitize (hb_sanitize_context_t *c) const
+  {
+    TRACE_SANITIZE (this);
+    return_trace (likely (c->check_struct (this) &&
+                          hb_barrier () &&
+                          (count == 0 || /* empty INDEX */
+                           (count < count + 1u &&
+                            c->check_struct (&offSize) && offSize >= 1 && offSize <= 4 &&
+                            c->check_array (offsets, offSize, count + 1u) &&
+                            c->check_range (data_base (), offset_at (count))))));
+  }
+
+  public:
+  COUNT         count;          /* Number of object data. Note there are (count+1) offsets */
+  private:
+  HBUINT8       offSize;        /* The byte size of each offset in the offsets array. */
+  HBUINT8       offsets[HB_VAR_ARRAY];
+                                /* The array of (count + 1) offsets into objects array (1-base). */
+  /* HBUINT8 data[HB_VAR_ARRAY];        Object data */
+  public:
+  DEFINE_SIZE_MIN (COUNT::static_size);
+};
+typedef CFFIndex CFF1Index;
+typedef CFFIndex CFF2Index;
+
+
+/* TupleValues */
+struct TupleValues
+{
+  enum packed_value_flag_t
+  {
+    VALUES_ARE_ZEROS     = 0x80,
+    VALUES_ARE_BYTES     = 0x00,
+    VALUES_ARE_WORDS     = 0x40,
+    VALUES_ARE_LONGS     = 0xC0,
+    VALUES_SIZE_MASK     = 0xC0,
+    VALUE_RUN_COUNT_MASK = 0x3F
+  };
+
+  static unsigned compile (hb_array_t values, /* IN */
+                           hb_array_t encoded_bytes /* OUT */)
+  {
+    unsigned num_values = values.length;
+    unsigned encoded_len = 0;
+    unsigned i = 0;
+    while (i < num_values)
+    {
+      int val = values.arrayZ[i];
+      if (val == 0)
+        encoded_len += encode_value_run_as_zeroes (i, encoded_bytes.sub_array (encoded_len), values);
+      else if (val >= -128 && val <= 127)
+        encoded_len += encode_value_run_as_bytes (i, encoded_bytes.sub_array (encoded_len), values);
+      else if (val >= -32768 && val <= 32767)
+        encoded_len += encode_value_run_as_words (i, encoded_bytes.sub_array (encoded_len), values);
+      else
+        encoded_len += encode_value_run_as_longs (i, encoded_bytes.sub_array (encoded_len), values);
+    }
+    return encoded_len;
+  }
+
+  static unsigned encode_value_run_as_zeroes (unsigned& i,
+                                              hb_array_t encoded_bytes,
+                                              hb_array_t values)
+  {
+    unsigned num_values = values.length;
+    unsigned run_length = 0;
+    auto it = encoded_bytes.iter ();
+    unsigned encoded_len = 0;
+    while (i < num_values && values.arrayZ[i] == 0)
+    {
+      i++;
+      run_length++;
+    }
+
+    while (run_length >= 64)
+    {
+      *it++ = char (VALUES_ARE_ZEROS | 63);
+      run_length -= 64;
+      encoded_len++;
+    }
+
+    if (run_length)
+    {
+      *it++ = char (VALUES_ARE_ZEROS | (run_length - 1));
+      encoded_len++;
+    }
+    return encoded_len;
+  }
+
+  static unsigned encode_value_run_as_bytes (unsigned &i,
+                                             hb_array_t encoded_bytes,
+                                             hb_array_t values)
+  {
+    unsigned start = i;
+    unsigned num_values = values.length;
+    while (i < num_values)
+    {
+      int val = values.arrayZ[i];
+      if (val > 127 || val < -128)
+        break;
+
+      /* from fonttools: if there're 2 or more zeros in a sequence,
+       * it is better to start a new run to save bytes. */
+      if (val == 0 && i + 1 < num_values && values.arrayZ[i+1] == 0)
+        break;
+
+      i++;
+    }
+    unsigned run_length = i - start;
+
+    unsigned encoded_len = 0;
+    auto it = encoded_bytes.iter ();
+
+    while (run_length >= 64)
+    {
+      *it++ = (VALUES_ARE_BYTES | 63);
+      encoded_len++;
+
+      for (unsigned j = 0; j < 64; j++)
+      {
+        *it++ = static_cast (values.arrayZ[start + j]);
+        encoded_len++;
+      }
+
+      start += 64;
+      run_length -= 64;
+    }
+
+    if (run_length)
+    {
+      *it++ = (VALUES_ARE_BYTES | (run_length - 1));
+      encoded_len++;
+
+      while (start < i)
+      {
+        *it++ = static_cast (values.arrayZ[start++]);
+        encoded_len++;
+      }
+    }
+
+    return encoded_len;
+  }
+
+  static unsigned encode_value_run_as_words (unsigned &i,
+                                             hb_array_t encoded_bytes,
+                                             hb_array_t values)
+  {
+    unsigned start = i;
+    unsigned num_values = values.length;
+    while (i < num_values)
+    {
+      int val = values.arrayZ[i];
+
+      /* start a new run for a single zero value*/
+      if (val == 0) break;
+
+      /* from fonttools: continue word-encoded run if there's only one
+       * single value in the range [-128, 127] because it is more compact.
+       * Only start a new run when there're 2 continuous such values. */
+      if (val >= -128 && val <= 127 &&
+          i + 1 < num_values &&
+          values.arrayZ[i+1] >= -128 && values.arrayZ[i+1] <= 127)
+        break;
+
+      i++;
+    }
+
+    unsigned run_length = i - start;
+    auto it = encoded_bytes.iter ();
+    unsigned encoded_len = 0;
+    while (run_length >= 64)
+    {
+      *it++ = (VALUES_ARE_WORDS | 63);
+      encoded_len++;
+
+      for (unsigned j = 0; j < 64; j++)
+      {
+        int16_t value_val = values.arrayZ[start + j];
+        *it++ = static_cast (value_val >> 8);
+        *it++ = static_cast (value_val & 0xFF);
+
+        encoded_len += 2;
+      }
+
+      start += 64;
+      run_length -= 64;
+    }
+
+    if (run_length)
+    {
+      *it++ = (VALUES_ARE_WORDS | (run_length - 1));
+      encoded_len++;
+      while (start < i)
+      {
+        int16_t value_val = values.arrayZ[start++];
+        *it++ = static_cast (value_val >> 8);
+        *it++ = static_cast (value_val & 0xFF);
+
+        encoded_len += 2;
+      }
+    }
+    return encoded_len;
+  }
+
+  static unsigned encode_value_run_as_longs (unsigned &i,
+                                             hb_array_t encoded_bytes,
+                                             hb_array_t values)
+  {
+    unsigned start = i;
+    unsigned num_values = values.length;
+    while (i < num_values)
+    {
+      int val = values.arrayZ[i];
+
+      if (val >= -32768 && val <= 32767)
+        break;
+
+      i++;
+    }
+
+    unsigned run_length = i - start;
+    auto it = encoded_bytes.iter ();
+    unsigned encoded_len = 0;
+    while (run_length >= 64)
+    {
+      *it++ = (VALUES_ARE_LONGS | 63);
+      encoded_len++;
+
+      for (unsigned j = 0; j < 64; j++)
+      {
+        int32_t value_val = values.arrayZ[start + j];
+        *it++ = static_cast (value_val >> 24);
+        *it++ = static_cast (value_val >> 16);
+        *it++ = static_cast (value_val >> 8);
+        *it++ = static_cast (value_val & 0xFF);
+
+        encoded_len += 4;
+      }
+
+      start += 64;
+      run_length -= 64;
+    }
+
+    if (run_length)
+    {
+      *it++ = (VALUES_ARE_LONGS | (run_length - 1));
+      encoded_len++;
+      while (start < i)
+      {
+        int32_t value_val = values.arrayZ[start++];
+        *it++ = static_cast (value_val >> 24);
+        *it++ = static_cast (value_val >> 16);
+        *it++ = static_cast (value_val >> 8);
+        *it++ = static_cast (value_val & 0xFF);
+
+        encoded_len += 4;
+      }
+    }
+    return encoded_len;
+  }
+
+  template 
+  static bool decompile (const HBUINT8 *&p /* IN/OUT */,
+                         hb_vector_t &values /* IN/OUT */,
+                         const HBUINT8 *end,
+                         bool consume_all = false)
+  {
+    unsigned i = 0;
+    unsigned count = consume_all ? UINT_MAX : values.length;
+    if (consume_all)
+      values.alloc ((end - p) / 2);
+    while (i < count)
+    {
+      if (unlikely (p + 1 > end)) return consume_all;
+      unsigned control = *p++;
+      unsigned run_count = (control & VALUE_RUN_COUNT_MASK) + 1;
+      if (consume_all)
+      {
+        if (unlikely (!values.resize (values.length + run_count, false)))
+          return false;
+      }
+      unsigned stop = i + run_count;
+      if (unlikely (stop > count)) return false;
+      if ((control & VALUES_SIZE_MASK) == VALUES_ARE_ZEROS)
+      {
+        for (; i < stop; i++)
+          values.arrayZ[i] = 0;
+      }
+      else if ((control & VALUES_SIZE_MASK) ==  VALUES_ARE_WORDS)
+      {
+        if (unlikely (p + run_count * HBINT16::static_size > end)) return false;
+#ifndef HB_OPTIMIZE_SIZE
+        for (; i + 3 < stop; i += 4)
+        {
+          values.arrayZ[i] = * (const HBINT16 *) p;
+          p += HBINT16::static_size;
+          values.arrayZ[i + 1] = * (const HBINT16 *) p;
+          p += HBINT16::static_size;
+          values.arrayZ[i + 2] = * (const HBINT16 *) p;
+          p += HBINT16::static_size;
+          values.arrayZ[i + 3] = * (const HBINT16 *) p;
+          p += HBINT16::static_size;
+        }
+#endif
+        for (; i < stop; i++)
+        {
+          values.arrayZ[i] = * (const HBINT16 *) p;
+          p += HBINT16::static_size;
+        }
+      }
+      else if ((control & VALUES_SIZE_MASK) ==  VALUES_ARE_LONGS)
+      {
+        if (unlikely (p + run_count * HBINT32::static_size > end)) return false;
+        for (; i < stop; i++)
+        {
+          values.arrayZ[i] = * (const HBINT32 *) p;
+          p += HBINT32::static_size;
+        }
+      }
+      else if ((control & VALUES_SIZE_MASK) ==  VALUES_ARE_BYTES)
+      {
+        if (unlikely (p + run_count > end)) return false;
+#ifndef HB_OPTIMIZE_SIZE
+        for (; i + 3 < stop; i += 4)
+        {
+          values.arrayZ[i] = * (const HBINT8 *) p++;
+          values.arrayZ[i + 1] = * (const HBINT8 *) p++;
+          values.arrayZ[i + 2] = * (const HBINT8 *) p++;
+          values.arrayZ[i + 3] = * (const HBINT8 *) p++;
+        }
+#endif
+        for (; i < stop; i++)
+          values.arrayZ[i] = * (const HBINT8 *) p++;
+      }
+    }
+    return true;
+  }
+
+  struct iter_t : hb_iter_with_fallback_t
+  {
+    iter_t (const unsigned char *p_, unsigned len_)
+            : p (p_), endp (p_ + len_)
+    { if (ensure_run ()) read_value (); }
+
+    private:
+    const unsigned char *p;
+    const unsigned char * const endp;
+    int current_value = 0;
+    signed run_count = 0;
+    unsigned width = 0;
+
+    bool ensure_run ()
+    {
+      if (likely (run_count > 0)) return true;
+
+      if (unlikely (p >= endp))
+      {
+        run_count = 0;
+        current_value = 0;
+        return false;
+      }
+
+      unsigned control = *p++;
+      run_count = (control & VALUE_RUN_COUNT_MASK) + 1;
+      width = control & VALUES_SIZE_MASK;
+      switch (width)
+      {
+        case VALUES_ARE_ZEROS: width = 0; break;
+        case VALUES_ARE_BYTES: width = HBINT8::static_size;  break;
+        case VALUES_ARE_WORDS: width = HBINT16::static_size; break;
+        case VALUES_ARE_LONGS: width = HBINT32::static_size; break;
+        default: assert (false);
+      }
+
+      if (unlikely (p + run_count * width > endp))
+      {
+        run_count = 0;
+        current_value = 0;
+        return false;
+      }
+
+      return true;
+    }
+    void read_value ()
+    {
+      switch (width)
+      {
+        case 0: current_value = 0; break;
+        case 1: current_value = * (const HBINT8  *) p; break;
+        case 2: current_value = * (const HBINT16 *) p; break;
+        case 4: current_value = * (const HBINT32 *) p; break;
+      }
+      p += width;
+    }
+
+    public:
+
+    typedef int __item_t__;
+    __item_t__ __item__ () const
+    { return current_value; }
+
+    bool __more__ () const { return run_count || p < endp; }
+    void __next__ ()
+    {
+      run_count--;
+      if (unlikely (!ensure_run ()))
+        return;
+      read_value ();
+    }
+    void __forward__ (unsigned n)
+    {
+      if (unlikely (!ensure_run ()))
+        return;
+      while (n)
+      {
+        unsigned i = hb_min (n, (unsigned) run_count);
+        run_count -= i;
+        n -= i;
+        p += (i - 1) * width;
+        if (unlikely (!ensure_run ()))
+          return;
+        read_value ();
+      }
+    }
+    bool operator != (const iter_t& o) const
+    { return p != o.p || run_count != o.run_count; }
+    iter_t __end__ () const
+    {
+      iter_t it (endp, 0);
+      return it;
+    }
+  };
+
+  struct fetcher_t
+  {
+    fetcher_t (const unsigned char *p_, unsigned len_)
+              : p (p_), end (p_ + len_) {}
+
+    private:
+    const unsigned char *p;
+    const unsigned char * const end;
+    signed run_count = 0;
+    unsigned width = 0;
+
+    bool ensure_run ()
+    {
+      if (likely (run_count > 0)) return true;
+
+      if (unlikely (p >= end))
+      {
+        run_count = 0;
+        return false;
+      }
+
+      unsigned control = *p++;
+      run_count = (control & VALUE_RUN_COUNT_MASK) + 1;
+      width = control & VALUES_SIZE_MASK;
+      switch (width)
+      {
+        case VALUES_ARE_ZEROS: width = 0; break;
+        case VALUES_ARE_BYTES: width = HBINT8::static_size;  break;
+        case VALUES_ARE_WORDS: width = HBINT16::static_size; break;
+        case VALUES_ARE_LONGS: width = HBINT32::static_size; break;
+        default: assert (false);
+      }
+
+      if (unlikely (p + run_count * width > end))
+      {
+        run_count = 0;
+        return false;
+      }
+
+      return true;
+    }
+
+    void skip (unsigned n)
+    {
+      while (n)
+      {
+        if (unlikely (!ensure_run ()))
+          return;
+        unsigned i = hb_min (n, (unsigned) run_count);
+        run_count -= i;
+        n -= i;
+        p += i * width;
+      }
+    }
+
+    template 
+    void _add_to (hb_array_t out, float scale = 1.0f)
+    {
+      unsigned n = out.length;
+      float *arrayZ = out.arrayZ;
+
+      for (unsigned i = 0; i < n;)
+      {
+        if (unlikely (!ensure_run ()))
+          break;
+        unsigned count = hb_min (n - i, (unsigned) run_count);
+        switch (width)
+        {
+          case 1:
+          {
+            const auto *pp = (const HBINT8 *) p;
+            unsigned j = 0;
+#ifndef HB_OPTIMIZE_SIZE
+            for (; j + 3 < count; j += 4)
+            {
+              *arrayZ++ += scaled ? *pp++ * scale : *pp++;
+              *arrayZ++ += scaled ? *pp++ * scale : *pp++;
+              *arrayZ++ += scaled ? *pp++ * scale : *pp++;
+              *arrayZ++ += scaled ? *pp++ * scale : *pp++;
+            }
+#endif
+            for (; j < count; j++)
+              *arrayZ++ += scaled ? *pp++ * scale : *pp++;
+          }
+          break;
+          case 2:
+          {
+            const auto *pp = (const HBINT16 *) p;
+            unsigned j = 0;
+#ifndef HB_OPTIMIZE_SIZE
+            for (; j + 3 < count; j += 4)
+            {
+              *arrayZ++ += scaled ? *pp++ * scale : *pp++;
+              *arrayZ++ += scaled ? *pp++ * scale : *pp++;
+              *arrayZ++ += scaled ? *pp++ * scale : *pp++;
+              *arrayZ++ += scaled ? *pp++ * scale : *pp++;
+            }
+#endif
+            for (; j < count; j++)
+              *arrayZ++ += scaled ? *pp++ * scale : *pp++;
+          }
+          break;
+          case 4:
+          {
+            const auto *pp = (const HBINT32 *) p;
+            for (unsigned j = 0; j < count; j++)
+              *arrayZ++ += scaled ? *pp++ * scale : *pp++;
+          }
+          break;
+        }
+        p += count * width;
+        run_count -= count;
+        i += count;
+      }
+    }
+
+    public:
+    void add_to (hb_array_t out, float scale = 1.0f)
+    {
+      unsigned n = out.length;
+
+      if (scale == 0.0f)
+      {
+        skip (n);
+        return;
+      }
+
+#ifndef HB_OPTIMIZE_SIZE
+      if (scale == 1.0f)
+        _add_to (out);
+      else
+#endif
+        _add_to (out, scale);
+    }
+  };
+};
+
+struct TupleList : CFF2Index
+{
+  TupleValues::iter_t operator [] (unsigned i) const
+  {
+    auto bytes = CFF2Index::operator [] (i);
+    return TupleValues::iter_t (bytes.arrayZ, bytes.length);
+  }
+
+  TupleValues::fetcher_t fetcher (unsigned i) const
+  {
+    auto bytes = CFF2Index::operator [] (i);
+    return TupleValues::fetcher_t (bytes.arrayZ, bytes.length);
+  }
+};
+
+
 } /* namespace OT */
 
 
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-cff-common.hh b/src/java.desktop/share/native/libharfbuzz/hb-ot-cff-common.hh
index 081c333f50f5..1e3e0be51062 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-ot-cff-common.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-cff-common.hh
@@ -41,10 +41,21 @@ using namespace OT;
 using objidx_t = hb_serialize_context_t::objidx_t;
 using whence_t = hb_serialize_context_t::whence_t;
 
-/* utility macro */
-template
-static inline const Type& StructAtOffsetOrNull (const void *P, unsigned int offset)
-{ return offset ? StructAtOffset (P, offset) : Null (Type); }
+/* CFF offsets can technically be negative */
+template
+static inline const Type& StructAtOffsetOrNull (const void *P, int offset, hb_sanitize_context_t &sc, Ts&&... ds)
+{
+  if (!offset) return Null (Type);
+
+  const char *p = (const char *) P + offset;
+  if (!sc.check_point (p)) return Null (Type);
+
+  const Type &obj = *reinterpret_cast (p);
+  if (!obj.sanitize (&sc, std::forward (ds)...)) return Null (Type);
+
+  return obj;
+}
+
 
 struct code_pair_t
 {
@@ -57,241 +68,6 @@ using str_buff_t = hb_vector_t;
 using str_buff_vec_t = hb_vector_t;
 using glyph_to_sid_map_t = hb_vector_t;
 
-struct length_f_t
-{
-  template 
-  unsigned operator () (const Iterable &_) const { return hb_len (hb_iter (_)); }
-
-  unsigned operator () (unsigned _) const { return _; }
-}
-HB_FUNCOBJ (length_f);
-
-/* CFF INDEX */
-template 
-struct CFFIndex
-{
-  unsigned int offset_array_size () const
-  { return offSize * (count + 1); }
-
-  template 
-  bool serialize (hb_serialize_context_t *c,
-                  const Iterable &iterable,
-                  const unsigned *p_data_size = nullptr)
-  {
-    TRACE_SERIALIZE (this);
-    unsigned data_size;
-    if (p_data_size)
-      data_size = *p_data_size;
-    else
-      total_size (iterable, &data_size);
-
-    auto it = hb_iter (iterable);
-    if (unlikely (!serialize_header (c, +it, data_size))) return_trace (false);
-    unsigned char *ret = c->allocate_size (data_size, false);
-    if (unlikely (!ret)) return_trace (false);
-    for (const auto &_ : +it)
-    {
-      unsigned len = _.length;
-      if (!len)
-        continue;
-      if (len <= 1)
-      {
-        *ret++ = *_.arrayZ;
-        continue;
-      }
-      hb_memcpy (ret, _.arrayZ, len);
-      ret += len;
-    }
-    return_trace (true);
-  }
-
-  template 
-  bool serialize_header (hb_serialize_context_t *c,
-                         Iterator it,
-                         unsigned data_size)
-  {
-    TRACE_SERIALIZE (this);
-
-    unsigned off_size = (hb_bit_storage (data_size + 1) + 7) / 8;
-
-    /* serialize CFFIndex header */
-    if (unlikely (!c->extend_min (this))) return_trace (false);
-    this->count = hb_len (it);
-    if (!this->count) return_trace (true);
-    if (unlikely (!c->extend (this->offSize))) return_trace (false);
-    this->offSize = off_size;
-    if (unlikely (!c->allocate_size (off_size * (this->count + 1), false)))
-      return_trace (false);
-
-    /* serialize indices */
-    unsigned int offset = 1;
-    if (HB_OPTIMIZE_SIZE_VAL)
-    {
-      unsigned int i = 0;
-      for (const auto &_ : +it)
-      {
-        set_offset_at (i++, offset);
-        offset += length_f (_);
-      }
-      set_offset_at (i, offset);
-    }
-    else
-      switch (off_size)
-      {
-        case 1:
-        {
-          HBUINT8 *p = (HBUINT8 *) offsets;
-          for (const auto &_ : +it)
-          {
-            *p++ = offset;
-            offset += length_f (_);
-          }
-          *p = offset;
-        }
-        break;
-        case 2:
-        {
-          HBUINT16 *p = (HBUINT16 *) offsets;
-          for (const auto &_ : +it)
-          {
-            *p++ = offset;
-            offset += length_f (_);
-          }
-          *p = offset;
-        }
-        break;
-        case 3:
-        {
-          HBUINT24 *p = (HBUINT24 *) offsets;
-          for (const auto &_ : +it)
-          {
-            *p++ = offset;
-            offset += length_f (_);
-          }
-          *p = offset;
-        }
-        break;
-        case 4:
-        {
-          HBUINT32 *p = (HBUINT32 *) offsets;
-          for (const auto &_ : +it)
-          {
-            *p++ = offset;
-            offset += length_f (_);
-          }
-          *p = offset;
-        }
-        break;
-        default:
-        break;
-      }
-
-    assert (offset == data_size + 1);
-    return_trace (true);
-  }
-
-  template 
-  static unsigned total_size (const Iterable &iterable, unsigned *data_size = nullptr)
-  {
-    auto it = + hb_iter (iterable);
-    if (!it)
-    {
-      if (data_size) *data_size = 0;
-      return min_size;
-    }
-
-    unsigned total = 0;
-    for (const auto &_ : +it)
-      total += length_f (_);
-
-    if (data_size) *data_size = total;
-
-    unsigned off_size = (hb_bit_storage (total + 1) + 7) / 8;
-
-    return min_size + HBUINT8::static_size + (hb_len (it) + 1) * off_size + total;
-  }
-
-  void set_offset_at (unsigned int index, unsigned int offset)
-  {
-    assert (index <= count);
-
-    unsigned int size = offSize;
-    const HBUINT8 *p = offsets;
-    switch (size)
-    {
-      case 1: ((HBUINT8  *) p)[index] = offset; break;
-      case 2: ((HBUINT16 *) p)[index] = offset; break;
-      case 3: ((HBUINT24 *) p)[index] = offset; break;
-      case 4: ((HBUINT32 *) p)[index] = offset; break;
-      default: return;
-    }
-  }
-
-  private:
-  unsigned int offset_at (unsigned int index) const
-  {
-    assert (index <= count);
-
-    unsigned int size = offSize;
-    const HBUINT8 *p = offsets;
-    switch (size)
-    {
-      case 1: return ((HBUINT8  *) p)[index];
-      case 2: return ((HBUINT16 *) p)[index];
-      case 3: return ((HBUINT24 *) p)[index];
-      case 4: return ((HBUINT32 *) p)[index];
-      default: return 0;
-    }
-  }
-
-  const unsigned char *data_base () const
-  { return (const unsigned char *) this + min_size + offSize.static_size - 1 + offset_array_size (); }
-  public:
-
-  hb_ubytes_t operator [] (unsigned int index) const
-  {
-    if (unlikely (index >= count)) return hb_ubytes_t ();
-    _hb_compiler_memory_r_barrier ();
-    unsigned offset0 = offset_at (index);
-    unsigned offset1 = offset_at (index + 1);
-    if (unlikely (offset1 < offset0 || offset1 > offset_at (count)))
-      return hb_ubytes_t ();
-    return hb_ubytes_t (data_base () + offset0, offset1 - offset0);
-  }
-
-  unsigned int get_size () const
-  {
-    if (count)
-      return min_size + offSize.static_size + offset_array_size () + (offset_at (count) - 1);
-    return min_size;  /* empty CFFIndex contains count only */
-  }
-
-  bool sanitize (hb_sanitize_context_t *c) const
-  {
-    TRACE_SANITIZE (this);
-    return_trace (likely (c->check_struct (this) &&
-                          (count == 0 || /* empty INDEX */
-                           (count < count + 1u &&
-                            c->check_struct (&offSize) && offSize >= 1 && offSize <= 4 &&
-                            c->check_array (offsets, offSize, count + 1u) &&
-                            c->check_array ((const HBUINT8*) data_base (), 1, offset_at (count))))));
-  }
-
-  public:
-  COUNT         count;          /* Number of object data. Note there are (count+1) offsets */
-  private:
-  HBUINT8       offSize;        /* The byte size of each offset in the offsets array. */
-  HBUINT8       offsets[HB_VAR_ARRAY];
-                                /* The array of (count + 1) offsets into objects array (1-base). */
-  /* HBUINT8 data[HB_VAR_ARRAY];        Object data */
-  public:
-  DEFINE_SIZE_MIN (COUNT::static_size);
-};
-
 /* Top Dict, Font Dict, Private Dict */
 struct Dict : UnsizedByteStr
 {
@@ -412,6 +188,7 @@ struct FDSelect0 {
     TRACE_SANITIZE (this);
     if (unlikely (!(c->check_struct (this))))
       return_trace (false);
+    hb_barrier ();
     if (unlikely (!c->check_array (fds, c->get_num_glyphs ())))
       return_trace (false);
 
@@ -438,7 +215,9 @@ struct FDSelect3_4_Range
   bool sanitize (hb_sanitize_context_t *c, const void * /*nullptr*/, unsigned int fdcount) const
   {
     TRACE_SANITIZE (this);
-    return_trace (first < c->get_num_glyphs () && (fd < fdcount));
+    return_trace (c->check_struct (this) &&
+                  hb_barrier () &&
+                  first < c->get_num_glyphs () && (fd < fdcount));
   }
 
   GID_TYPE    first;
@@ -456,15 +235,20 @@ struct FDSelect3_4
   bool sanitize (hb_sanitize_context_t *c, unsigned int fdcount) const
   {
     TRACE_SANITIZE (this);
-    if (unlikely (!c->check_struct (this) || !ranges.sanitize (c, nullptr, fdcount) ||
-                  (nRanges () == 0) || ranges[0].first != 0))
+    if (unlikely (!(c->check_struct (this) &&
+                    ranges.sanitize (c, nullptr, fdcount) &&
+                    hb_barrier () &&
+                    (nRanges () != 0) &&
+                    ranges[0].first == 0)))
       return_trace (false);
 
     for (unsigned int i = 1; i < nRanges (); i++)
       if (unlikely (ranges[i - 1].first >= ranges[i].first))
         return_trace (false);
 
-    if (unlikely (!sentinel().sanitize (c) || (sentinel() != c->get_num_glyphs ())))
+    if (unlikely (!(sentinel().sanitize (c) &&
+                   hb_barrier () &&
+                   (sentinel() == c->get_num_glyphs ()))))
       return_trace (false);
 
     return_trace (true);
@@ -524,8 +308,8 @@ struct FDSelect
   {
     switch (format)
     {
-    case 0: return format.static_size + u.format0.get_size (num_glyphs);
-    case 3: return format.static_size + u.format3.get_size ();
+    case 0: hb_barrier (); return format.static_size + u.format0.get_size (num_glyphs);
+    case 3: hb_barrier (); return format.static_size + u.format3.get_size ();
     default:return 0;
     }
   }
@@ -536,8 +320,8 @@ struct FDSelect
 
     switch (format)
     {
-    case 0: return u.format0.get_fd (glyph);
-    case 3: return u.format3.get_fd (glyph);
+    case 0: hb_barrier (); return u.format0.get_fd (glyph);
+    case 3: hb_barrier (); return u.format3.get_fd (glyph);
     default:return 0;
     }
   }
@@ -548,8 +332,8 @@ struct FDSelect
 
     switch (format)
     {
-    case 0: return u.format0.get_fd_range (glyph);
-    case 3: return u.format3.get_fd_range (glyph);
+    case 0: hb_barrier (); return u.format0.get_fd_range (glyph);
+    case 3: hb_barrier (); return u.format3.get_fd_range (glyph);
     default:return {0, 1};
     }
   }
@@ -559,11 +343,12 @@ struct FDSelect
     TRACE_SANITIZE (this);
     if (unlikely (!c->check_struct (this)))
       return_trace (false);
+    hb_barrier ();
 
     switch (format)
     {
-    case 0: return_trace (u.format0.sanitize (c, fdcount));
-    case 3: return_trace (u.format3.sanitize (c, fdcount));
+    case 0: hb_barrier (); return_trace (u.format0.sanitize (c, fdcount));
+    case 3: hb_barrier (); return_trace (u.format3.sanitize (c, fdcount));
     default:return_trace (false);
     }
   }
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-cff1-table.cc b/src/java.desktop/share/native/libharfbuzz/hb-ot-cff1-table.cc
index 6fcc8c465878..b06936f94c89 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-ot-cff1-table.cc
+++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-cff1-table.cc
@@ -553,15 +553,6 @@ bool _get_path (const OT::cff1::accelerator_t *cff, hb_font_t *font, hb_codepoin
   return true;
 }
 
-bool OT::cff1::accelerator_t::paint_glyph (hb_font_t *font, hb_codepoint_t glyph, hb_paint_funcs_t *funcs, void *data, hb_color_t foreground) const
-{
-  funcs->push_clip_glyph (data, glyph, font);
-  funcs->color (data, true, foreground);
-  funcs->pop_clip (data);
-
-  return true;
-}
-
 bool OT::cff1::accelerator_t::get_path (hb_font_t *font, hb_codepoint_t glyph, hb_draw_session_t &draw_session) const
 {
 #ifdef HB_NO_OT_FONT_CFF
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-cff1-table.hh b/src/java.desktop/share/native/libharfbuzz/hb-ot-cff1-table.hh
index d1310c66fde1..0116a0c91923 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-ot-cff1-table.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-cff1-table.hh
@@ -51,9 +51,6 @@ namespace CFF {
 enum EncodingID { StandardEncoding = 0, ExpertEncoding = 1 };
 enum CharsetID { ISOAdobeCharset = 0, ExpertCharset = 1, ExpertSubsetCharset = 2 };
 
-typedef CFFIndex  CFF1Index;
-
-typedef CFFIndex CFF1Index;
 typedef CFF1Index          CFF1CharStrings;
 typedef Subrs    CFF1Subrs;
 
@@ -242,8 +239,8 @@ struct Encoding
     unsigned int size = min_size;
     switch (table_format ())
     {
-    case 0: size += u.format0.get_size (); break;
-    case 1: size += u.format1.get_size (); break;
+    case 0: hb_barrier (); size += u.format0.get_size (); break;
+    case 1: hb_barrier (); size += u.format1.get_size (); break;
     }
     if (has_supplement ())
       size += suppEncData ().get_size ();
@@ -254,8 +251,8 @@ struct Encoding
   {
     switch (table_format ())
     {
-    case 0: return u.format0.get_code (glyph);
-    case 1: return u.format1.get_code (glyph);
+    case 0: hb_barrier (); return u.format0.get_code (glyph);
+    case 1: hb_barrier (); return u.format1.get_code (glyph);
     default:return 0;
     }
   }
@@ -275,11 +272,12 @@ struct Encoding
     TRACE_SANITIZE (this);
     if (unlikely (!c->check_struct (this)))
       return_trace (false);
+    hb_barrier ();
 
     switch (table_format ())
     {
-    case 0: if (unlikely (!u.format0.sanitize (c))) { return_trace (false); } break;
-    case 1: if (unlikely (!u.format1.sanitize (c))) { return_trace (false); } break;
+    case 0: hb_barrier (); if (unlikely (!u.format0.sanitize (c))) { return_trace (false); } break;
+    case 1: hb_barrier (); if (unlikely (!u.format1.sanitize (c))) { return_trace (false); } break;
     default:return_trace (false);
     }
     return_trace (likely (!has_supplement () || suppEncData ().sanitize (c)));
@@ -290,8 +288,8 @@ struct Encoding
   {
     switch (table_format ())
     {
-    case 0: return StructAfter (u.format0.codes[u.format0.nCodes ()-1]);
-    case 1: return StructAfter (u.format1.ranges[u.format1.nRanges ()-1]);
+    case 0: hb_barrier (); return StructAfter (u.format0.codes[u.format0.nCodes ()-1]);
+    case 1: hb_barrier (); return StructAfter (u.format1.ranges[u.format1.nRanges ()-1]);
     default:return Null (CFF1SuppEncData);
     }
   }
@@ -376,13 +374,13 @@ struct Charset1_2 {
   bool sanitize (hb_sanitize_context_t *c, unsigned int num_glyphs, unsigned *num_charset_entries) const
   {
     TRACE_SANITIZE (this);
-    if (unlikely (!c->check_struct (this)))
-      return_trace (false);
     num_glyphs--;
     unsigned i;
     for (i = 0; num_glyphs > 0; i++)
     {
-      if (unlikely (!ranges[i].sanitize (c) || (num_glyphs < ranges[i].nLeft + 1)))
+      if (unlikely (!(ranges[i].sanitize (c) &&
+                      hb_barrier () &&
+                      (num_glyphs >= ranges[i].nLeft + 1))))
         return_trace (false);
       num_glyphs -= (ranges[i].nLeft + 1);
     }
@@ -569,9 +567,9 @@ struct Charset
   {
     switch (format)
     {
-    case 0: return min_size + u.format0.get_size (num_glyphs);
-    case 1: return min_size + u.format1.get_size (num_glyphs);
-    case 2: return min_size + u.format2.get_size (num_glyphs);
+    case 0: hb_barrier (); return min_size + u.format0.get_size (num_glyphs);
+    case 1: hb_barrier (); return min_size + u.format1.get_size (num_glyphs);
+    case 2: hb_barrier (); return min_size + u.format2.get_size (num_glyphs);
     default:return 0;
     }
   }
@@ -581,9 +579,9 @@ struct Charset
   {
     switch (format)
     {
-    case 0: return u.format0.get_sid (glyph, num_glyphs);
-    case 1: return u.format1.get_sid (glyph, num_glyphs, cache);
-    case 2: return u.format2.get_sid (glyph, num_glyphs, cache);
+    case 0: hb_barrier (); return u.format0.get_sid (glyph, num_glyphs);
+    case 1: hb_barrier (); return u.format1.get_sid (glyph, num_glyphs, cache);
+    case 2: hb_barrier (); return u.format2.get_sid (glyph, num_glyphs, cache);
     default:return 0;
     }
   }
@@ -592,9 +590,9 @@ struct Charset
   {
     switch (format)
     {
-    case 0: u.format0.collect_glyph_to_sid_map (mapping, num_glyphs); return;
-    case 1: u.format1.collect_glyph_to_sid_map (mapping, num_glyphs); return;
-    case 2: u.format2.collect_glyph_to_sid_map (mapping, num_glyphs); return;
+    case 0: hb_barrier (); u.format0.collect_glyph_to_sid_map (mapping, num_glyphs); return;
+    case 1: hb_barrier (); u.format1.collect_glyph_to_sid_map (mapping, num_glyphs); return;
+    case 2: hb_barrier (); u.format2.collect_glyph_to_sid_map (mapping, num_glyphs); return;
     default:return;
     }
   }
@@ -603,9 +601,9 @@ struct Charset
   {
     switch (format)
     {
-    case 0: return u.format0.get_glyph (sid, num_glyphs);
-    case 1: return u.format1.get_glyph (sid, num_glyphs);
-    case 2: return u.format2.get_glyph (sid, num_glyphs);
+    case 0: hb_barrier (); return u.format0.get_glyph (sid, num_glyphs);
+    case 1: hb_barrier (); return u.format1.get_glyph (sid, num_glyphs);
+    case 2: hb_barrier (); return u.format2.get_glyph (sid, num_glyphs);
     default:return 0;
     }
   }
@@ -615,12 +613,13 @@ struct Charset
     TRACE_SANITIZE (this);
     if (unlikely (!c->check_struct (this)))
       return_trace (false);
+    hb_barrier ();
 
     switch (format)
     {
-    case 0: return_trace (u.format0.sanitize (c, c->get_num_glyphs (), num_charset_entries));
-    case 1: return_trace (u.format1.sanitize (c, c->get_num_glyphs (), num_charset_entries));
-    case 2: return_trace (u.format2.sanitize (c, c->get_num_glyphs (), num_charset_entries));
+    case 0: hb_barrier (); return_trace (u.format0.sanitize (c, c->get_num_glyphs (), num_charset_entries));
+    case 1: hb_barrier (); return_trace (u.format1.sanitize (c, c->get_num_glyphs (), num_charset_entries));
+    case 2: hb_barrier (); return_trace (u.format2.sanitize (c, c->get_num_glyphs (), num_charset_entries));
     default:return_trace (false);
     }
   }
@@ -761,9 +760,9 @@ struct cff1_top_dict_values_t : top_dict_values_t
   unsigned int    ros_supplement;
   unsigned int    cidCount;
 
-  unsigned int    EncodingOffset;
-  unsigned int    CharsetOffset;
-  unsigned int    FDSelectOffset;
+  int             EncodingOffset;
+  int             CharsetOffset;
+  int             FDSelectOffset;
   table_info_t    privateDictInfo;
 };
 
@@ -819,24 +818,24 @@ struct cff1_top_dict_opset_t : top_dict_opset_t
         break;
 
       case OpCode_Encoding:
-        dictval.EncodingOffset = env.argStack.pop_uint ();
+        dictval.EncodingOffset = env.argStack.pop_int ();
         env.clear_args ();
         if (unlikely (dictval.EncodingOffset == 0)) return;
         break;
 
       case OpCode_charset:
-        dictval.CharsetOffset = env.argStack.pop_uint ();
+        dictval.CharsetOffset = env.argStack.pop_int ();
         env.clear_args ();
         if (unlikely (dictval.CharsetOffset == 0)) return;
         break;
 
       case OpCode_FDSelect:
-        dictval.FDSelectOffset = env.argStack.pop_uint ();
+        dictval.FDSelectOffset = env.argStack.pop_int ();
         env.clear_args ();
         break;
 
       case OpCode_Private:
-        dictval.privateDictInfo.offset = env.argStack.pop_uint ();
+        dictval.privateDictInfo.offset = env.argStack.pop_int ();
         dictval.privateDictInfo.size = env.argStack.pop_uint ();
         env.clear_args ();
         break;
@@ -911,7 +910,7 @@ struct cff1_private_dict_values_base_t : dict_values_t
   }
   void fini () { dict_values_t::fini (); }
 
-  unsigned int      subrsOffset;
+  int                 subrsOffset;
   const CFF1Subrs    *localSubrs;
 };
 
@@ -946,7 +945,7 @@ struct cff1_private_dict_opset_t : dict_opset_t
         env.clear_args ();
         break;
       case OpCode_Subrs:
-        dictval.subrsOffset = env.argStack.pop_uint ();
+        dictval.subrsOffset = env.argStack.pop_int ();
         env.clear_args ();
         break;
 
@@ -988,7 +987,7 @@ struct cff1_private_dict_opset_subset_t : dict_opset_t
         break;
 
       case OpCode_Subrs:
-        dictval.subrsOffset = env.argStack.pop_uint ();
+        dictval.subrsOffset = env.argStack.pop_int ();
         env.clear_args ();
         break;
 
@@ -1055,6 +1054,7 @@ struct cff1
   {
     TRACE_SANITIZE (this);
     return_trace (c->check_struct (this) &&
+                  hb_barrier () &&
                   likely (version.major == 1));
   }
 
@@ -1085,14 +1085,17 @@ struct cff1
       nameIndex = &cff->nameIndex (cff);
       if ((nameIndex == &Null (CFF1NameIndex)) || !nameIndex->sanitize (&sc))
         goto fail;
+      hb_barrier ();
 
-      topDictIndex = &StructAtOffset (nameIndex, nameIndex->get_size ());
-      if ((topDictIndex == &Null (CFF1TopDictIndex)) || !topDictIndex->sanitize (&sc) || (topDictIndex->count == 0))
+      topDictIndex = &StructAtOffsetOrNull (nameIndex, nameIndex->get_size (), sc);
+      if (topDictIndex == &Null (CFF1TopDictIndex) || (topDictIndex->count == 0))
         goto fail;
+      hb_barrier ();
 
       { /* parse top dict */
         const hb_ubytes_t topDictStr = (*topDictIndex)[0];
         if (unlikely (!topDictStr.sanitize (&sc)))   goto fail;
+        hb_barrier ();
         cff1_top_dict_interp_env_t env (topDictStr);
         cff1_top_dict_interpreter_t top_interp (env);
         if (unlikely (!top_interp.interpret (topDict)))   goto fail;
@@ -1102,17 +1105,17 @@ struct cff1
         charset = &Null (Charset);
       else
       {
-        charset = &StructAtOffsetOrNull (cff, topDict.CharsetOffset);
-        if (unlikely ((charset == &Null (Charset)) || !charset->sanitize (&sc, &num_charset_entries)))   goto fail;
+        charset = &StructAtOffsetOrNull (cff, topDict.CharsetOffset, sc, &num_charset_entries);
+        if (unlikely (charset == &Null (Charset)))   goto fail;
       }
 
       fdCount = 1;
       if (is_CID ())
       {
-        fdArray = &StructAtOffsetOrNull (cff, topDict.FDArrayOffset);
-        fdSelect = &StructAtOffsetOrNull (cff, topDict.FDSelectOffset);
-        if (unlikely ((fdArray == &Null (CFF1FDArray)) || !fdArray->sanitize (&sc) ||
-            (fdSelect == &Null (CFF1FDSelect)) || !fdSelect->sanitize (&sc, fdArray->count)))
+        fdArray = &StructAtOffsetOrNull (cff, topDict.FDArrayOffset, sc);
+        fdSelect = &StructAtOffsetOrNull (cff, topDict.FDSelectOffset, sc, fdArray->count);
+        if (unlikely (fdArray == &Null (CFF1FDArray) ||
+                      fdSelect == &Null (CFF1FDSelect)))
           goto fail;
 
         fdCount = fdArray->count;
@@ -1132,22 +1135,18 @@ struct cff1
       {
         if (!is_predef_encoding ())
         {
-          encoding = &StructAtOffsetOrNull (cff, topDict.EncodingOffset);
-          if (unlikely ((encoding == &Null (Encoding)) || !encoding->sanitize (&sc)))   goto fail;
+          encoding = &StructAtOffsetOrNull (cff, topDict.EncodingOffset, sc);
+          if (unlikely (encoding == &Null (Encoding)))   goto fail;
         }
       }
 
-      stringIndex = &StructAtOffset (topDictIndex, topDictIndex->get_size ());
-      if ((stringIndex == &Null (CFF1StringIndex)) || !stringIndex->sanitize (&sc))
+      stringIndex = &StructAtOffsetOrNull (topDictIndex, topDictIndex->get_size (), sc);
+      if (stringIndex == &Null (CFF1StringIndex))
         goto fail;
 
-      globalSubrs = &StructAtOffset (stringIndex, stringIndex->get_size ());
-      if ((globalSubrs != &Null (CFF1Subrs)) && !globalSubrs->sanitize (&sc))
-        goto fail;
-
-      charStrings = &StructAtOffsetOrNull (cff, topDict.charStringsOffset);
-
-      if ((charStrings == &Null (CFF1CharStrings)) || unlikely (!charStrings->sanitize (&sc)))
+      globalSubrs = &StructAtOffsetOrNull (stringIndex, stringIndex->get_size (), sc);
+      charStrings = &StructAtOffsetOrNull (cff, topDict.charStringsOffset, sc);
+      if (charStrings == &Null (CFF1CharStrings))
         goto fail;
 
       num_glyphs = charStrings->count;
@@ -1166,6 +1165,7 @@ struct cff1
         {
           hb_ubytes_t fontDictStr = (*fdArray)[i];
           if (unlikely (!fontDictStr.sanitize (&sc)))   goto fail;
+          hb_barrier ();
           cff1_font_dict_values_t *font;
           cff1_top_dict_interp_env_t env (fontDictStr);
           cff1_font_dict_interpreter_t font_interp (env);
@@ -1175,17 +1175,14 @@ struct cff1
           font->init ();
           if (unlikely (!font_interp.interpret (*font)))   goto fail;
           PRIVDICTVAL *priv = &privateDicts[i];
-          const hb_ubytes_t privDictStr = StructAtOffset (cff, font->privateDictInfo.offset).as_ubytes (font->privateDictInfo.size);
-          if (unlikely (!privDictStr.sanitize (&sc)))   goto fail;
+          const hb_ubytes_t privDictStr = StructAtOffsetOrNull (cff, font->privateDictInfo.offset, sc, font->privateDictInfo.size).as_ubytes (font->privateDictInfo.size);
+          if (unlikely (privDictStr == (const unsigned char *) &Null (UnsizedByteStr))) goto fail;
           num_interp_env_t env2 (privDictStr);
           dict_interpreter_t priv_interp (env2);
           priv->init ();
           if (unlikely (!priv_interp.interpret (*priv)))   goto fail;
 
-          priv->localSubrs = &StructAtOffsetOrNull (&privDictStr, priv->subrsOffset);
-          if (priv->localSubrs != &Null (CFF1Subrs) &&
-              unlikely (!priv->localSubrs->sanitize (&sc)))
-            goto fail;
+          priv->localSubrs = &StructAtOffsetOrNull (&privDictStr, priv->subrsOffset, sc);
         }
       }
       else  /* non-CID */
@@ -1193,17 +1190,15 @@ struct cff1
         cff1_top_dict_values_t *font = &topDict;
         PRIVDICTVAL *priv = &privateDicts[0];
 
-        const hb_ubytes_t privDictStr = StructAtOffset (cff, font->privateDictInfo.offset).as_ubytes (font->privateDictInfo.size);
-        if (unlikely (!privDictStr.sanitize (&sc)))   goto fail;
+        const hb_ubytes_t privDictStr = StructAtOffsetOrNull (cff, font->privateDictInfo.offset, sc, font->privateDictInfo.size).as_ubytes (font->privateDictInfo.size);
+        if (unlikely (privDictStr == (const unsigned char *) &Null (UnsizedByteStr))) goto fail;
         num_interp_env_t env (privDictStr);
         dict_interpreter_t priv_interp (env);
         priv->init ();
         if (unlikely (!priv_interp.interpret (*priv)))   goto fail;
 
-        priv->localSubrs = &StructAtOffsetOrNull (&privDictStr, priv->subrsOffset);
-        if (priv->localSubrs != &Null (CFF1Subrs) &&
-            unlikely (!priv->localSubrs->sanitize (&sc)))
-          goto fail;
+        priv->localSubrs = &StructAtOffsetOrNull (&privDictStr, priv->subrsOffset, sc);
+        hb_barrier ();
       }
 
       return;
@@ -1420,7 +1415,7 @@ struct cff1
       hb_sorted_vector_t *names = glyph_names.get_acquire ();
       if (unlikely (!names))
       {
-        names = (hb_sorted_vector_t *) hb_calloc (sizeof (hb_sorted_vector_t), 1);
+        names = (hb_sorted_vector_t *) hb_calloc (1, sizeof (hb_sorted_vector_t));
         if (likely (names))
         {
           names->init ();
@@ -1467,7 +1462,6 @@ struct cff1
     }
 
     HB_INTERNAL bool get_extents (hb_font_t *font, hb_codepoint_t glyph, hb_glyph_extents_t *extents) const;
-    HB_INTERNAL bool paint_glyph (hb_font_t *font, hb_codepoint_t glyph, hb_paint_funcs_t *funcs, void *data, hb_color_t foreground) const;
     HB_INTERNAL bool get_path (hb_font_t *font, hb_codepoint_t glyph, hb_draw_session_t &draw_session) const;
 
     private:
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-cff2-table.cc b/src/java.desktop/share/native/libharfbuzz/hb-ot-cff2-table.cc
index ed430ee59d56..fce39da21ce3 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-ot-cff2-table.cc
+++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-cff2-table.cc
@@ -143,15 +143,6 @@ bool OT::cff2::accelerator_t::get_extents (hb_font_t *font,
   return true;
 }
 
-bool OT::cff2::accelerator_t::paint_glyph (hb_font_t *font, hb_codepoint_t glyph, hb_paint_funcs_t *funcs, void *data, hb_color_t foreground) const
-{
-  funcs->push_clip_glyph (data, glyph, font);
-  funcs->color (data, true, foreground);
-  funcs->pop_clip (data);
-
-  return true;
-}
-
 struct cff2_path_param_t
 {
   cff2_path_param_t (hb_font_t *font_, hb_draw_session_t &draw_session_)
@@ -202,6 +193,11 @@ struct cff2_path_procs_path_t : path_procs_t {};
 
 bool OT::cff2::accelerator_t::get_path (hb_font_t *font, hb_codepoint_t glyph, hb_draw_session_t &draw_session) const
+{
+  return get_path_at (font, glyph, draw_session, hb_array (font->coords, font->num_coords));
+}
+
+bool OT::cff2::accelerator_t::get_path_at (hb_font_t *font, hb_codepoint_t glyph, hb_draw_session_t &draw_session, hb_array_t coords) const
 {
 #ifdef HB_NO_OT_FONT_CFF
   /* XXX Remove check when this code moves to .hh file. */
@@ -212,7 +208,7 @@ bool OT::cff2::accelerator_t::get_path (hb_font_t *font, hb_codepoint_t glyph, h
 
   unsigned int fd = fdSelect->get_fd (glyph);
   const hb_ubytes_t str = (*charStrings)[glyph];
-  cff2_cs_interp_env_t env (str, *this, fd, font->coords, font->num_coords);
+  cff2_cs_interp_env_t env (str, *this, fd, coords.arrayZ, coords.length);
   cff2_cs_interpreter_t interp (env);
   cff2_path_param_t param (font, draw_session);
   if (unlikely (!interp.interpret (param))) return false;
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-cff2-table.hh b/src/java.desktop/share/native/libharfbuzz/hb-ot-cff2-table.hh
index db10f22ec52e..81d30f57a283 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-ot-cff2-table.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-cff2-table.hh
@@ -40,8 +40,6 @@ namespace CFF {
  */
 #define HB_OT_TAG_CFF2 HB_TAG('C','F','F','2')
 
-typedef CFFIndex  CFF2Index;
-
 typedef CFF2Index         CFF2CharStrings;
 typedef Subrs   CFF2Subrs;
 
@@ -64,9 +62,9 @@ struct CFF2FDSelect
   {
     switch (format)
     {
-    case 0: return format.static_size + u.format0.get_size (num_glyphs);
-    case 3: return format.static_size + u.format3.get_size ();
-    case 4: return format.static_size + u.format4.get_size ();
+    case 0: hb_barrier (); return format.static_size + u.format0.get_size (num_glyphs);
+    case 3: hb_barrier (); return format.static_size + u.format3.get_size ();
+    case 4: hb_barrier (); return format.static_size + u.format4.get_size ();
     default:return 0;
     }
   }
@@ -78,9 +76,9 @@ struct CFF2FDSelect
 
     switch (format)
     {
-    case 0: return u.format0.get_fd (glyph);
-    case 3: return u.format3.get_fd (glyph);
-    case 4: return u.format4.get_fd (glyph);
+    case 0: hb_barrier (); return u.format0.get_fd (glyph);
+    case 3: hb_barrier (); return u.format3.get_fd (glyph);
+    case 4: hb_barrier (); return u.format4.get_fd (glyph);
     default:return 0;
     }
   }
@@ -90,12 +88,13 @@ struct CFF2FDSelect
     TRACE_SANITIZE (this);
     if (unlikely (!c->check_struct (this)))
       return_trace (false);
+    hb_barrier ();
 
     switch (format)
     {
-    case 0: return_trace (u.format0.sanitize (c, fdcount));
-    case 3: return_trace (u.format3.sanitize (c, fdcount));
-    case 4: return_trace (u.format4.sanitize (c, fdcount));
+    case 0: hb_barrier (); return_trace (u.format0.sanitize (c, fdcount));
+    case 3: hb_barrier (); return_trace (u.format3.sanitize (c, fdcount));
+    case 4: hb_barrier (); return_trace (u.format4.sanitize (c, fdcount));
     default:return_trace (false);
     }
   }
@@ -110,19 +109,22 @@ struct CFF2FDSelect
   DEFINE_SIZE_MIN (2);
 };
 
-struct CFF2VariationStore
+struct CFF2ItemVariationStore
 {
   bool sanitize (hb_sanitize_context_t *c) const
   {
     TRACE_SANITIZE (this);
-    return_trace (likely (c->check_struct (this)) && c->check_range (&varStore, size) && varStore.sanitize (c));
+    return_trace (c->check_struct (this) &&
+                  hb_barrier () &&
+                  c->check_range (&varStore, size) &&
+                  varStore.sanitize (c));
   }
 
-  bool serialize (hb_serialize_context_t *c, const CFF2VariationStore *varStore)
+  bool serialize (hb_serialize_context_t *c, const CFF2ItemVariationStore *varStore)
   {
     TRACE_SERIALIZE (this);
     unsigned int size_ = varStore->get_size ();
-    CFF2VariationStore *dest = c->allocate_size (size_);
+    CFF2ItemVariationStore *dest = c->allocate_size (size_);
     if (unlikely (!dest)) return_trace (false);
     hb_memcpy (dest, varStore, size_);
     return_trace (true);
@@ -131,9 +133,9 @@ struct CFF2VariationStore
   unsigned int get_size () const { return HBUINT16::static_size + size; }
 
   HBUINT16      size;
-  VariationStore  varStore;
+  ItemVariationStore  varStore;
 
-  DEFINE_SIZE_MIN (2 + VariationStore::min_size);
+  DEFINE_SIZE_MIN (2 + ItemVariationStore::min_size);
 };
 
 struct cff2_top_dict_values_t : top_dict_values_t<>
@@ -146,8 +148,8 @@ struct cff2_top_dict_values_t : top_dict_values_t<>
   }
   void fini () { top_dict_values_t<>::fini (); }
 
-  unsigned int  vstoreOffset;
-  unsigned int  FDSelectOffset;
+  int  vstoreOffset;
+  int  FDSelectOffset;
 };
 
 struct cff2_top_dict_opset_t : top_dict_opset_t<>
@@ -165,11 +167,11 @@ struct cff2_top_dict_opset_t : top_dict_opset_t<>
         break;
 
       case OpCode_vstore:
-        dictval.vstoreOffset = env.argStack.pop_uint ();
+        dictval.vstoreOffset = env.argStack.pop_int ();
         env.clear_args ();
         break;
       case OpCode_FDSelect:
-        dictval.FDSelectOffset = env.argStack.pop_uint ();
+        dictval.FDSelectOffset = env.argStack.pop_int ();
         env.clear_args ();
         break;
 
@@ -237,7 +239,7 @@ struct cff2_private_dict_values_base_t : dict_values_t
   }
   void fini () { dict_values_t::fini (); }
 
-  unsigned int      subrsOffset;
+  int                subrsOffset;
   const CFF2Subrs   *localSubrs;
   unsigned int      ivs;
 };
@@ -291,7 +293,7 @@ struct cff2_private_dict_opset_t : dict_opset_t
         env.clear_args ();
         break;
       case OpCode_Subrs:
-        dictval.subrsOffset = env.argStack.pop_uint ();
+        dictval.subrsOffset = env.argStack.pop_int ();
         env.clear_args ();
         break;
       case OpCode_vsindexdict:
@@ -340,7 +342,7 @@ struct cff2_private_dict_opset_subset_t : dict_opset_t
         return;
 
       case OpCode_Subrs:
-        dictval.subrsOffset = env.argStack.pop_uint ();
+        dictval.subrsOffset = env.argStack.pop_int ();
         env.clear_args ();
         break;
 
@@ -384,6 +386,7 @@ struct cff2
   {
     TRACE_SANITIZE (this);
     return_trace (c->check_struct (this) &&
+                  hb_barrier () &&
                   likely (version.major == 2));
   }
 
@@ -414,23 +417,22 @@ struct cff2
       { /* parse top dict */
         hb_ubytes_t topDictStr = (cff2 + cff2->topDict).as_ubytes (cff2->topDictSize);
         if (unlikely (!topDictStr.sanitize (&sc))) goto fail;
+        hb_barrier ();
         num_interp_env_t env (topDictStr);
         cff2_top_dict_interpreter_t top_interp (env);
         topDict.init ();
         if (unlikely (!top_interp.interpret (topDict))) goto fail;
       }
 
-      globalSubrs = &StructAtOffset (cff2, cff2->topDict + cff2->topDictSize);
-      varStore = &StructAtOffsetOrNull (cff2, topDict.vstoreOffset);
-      charStrings = &StructAtOffsetOrNull (cff2, topDict.charStringsOffset);
-      fdArray = &StructAtOffsetOrNull (cff2, topDict.FDArrayOffset);
-      fdSelect = &StructAtOffsetOrNull (cff2, topDict.FDSelectOffset);
-
-      if (((varStore != &Null (CFF2VariationStore)) && unlikely (!varStore->sanitize (&sc))) ||
-          (charStrings == &Null (CFF2CharStrings)) || unlikely (!charStrings->sanitize (&sc)) ||
-          (globalSubrs == &Null (CFF2Subrs)) || unlikely (!globalSubrs->sanitize (&sc)) ||
-          (fdArray == &Null (CFF2FDArray)) || unlikely (!fdArray->sanitize (&sc)) ||
-          (((fdSelect != &Null (CFF2FDSelect)) && unlikely (!fdSelect->sanitize (&sc, fdArray->count)))))
+      globalSubrs = &StructAtOffsetOrNull (cff2, cff2->topDict + cff2->topDictSize, sc);
+      varStore = &StructAtOffsetOrNull (cff2, topDict.vstoreOffset, sc);
+      charStrings = &StructAtOffsetOrNull (cff2, topDict.charStringsOffset, sc);
+      fdArray = &StructAtOffsetOrNull (cff2, topDict.FDArrayOffset, sc);
+      fdSelect = &StructAtOffsetOrNull (cff2, topDict.FDSelectOffset, sc, fdArray->count);
+
+      if (charStrings == &Null (CFF2CharStrings) ||
+          globalSubrs == &Null (CFF2Subrs) ||
+          fdArray == &Null (CFF2FDArray))
         goto fail;
 
       num_glyphs = charStrings->count;
@@ -446,6 +448,7 @@ struct cff2
       {
         const hb_ubytes_t fontDictStr = (*fdArray)[i];
         if (unlikely (!fontDictStr.sanitize (&sc))) goto fail;
+        hb_barrier ();
         cff2_font_dict_values_t  *font;
         num_interp_env_t env (fontDictStr);
         cff2_font_dict_interpreter_t font_interp (env);
@@ -454,17 +457,14 @@ struct cff2
         font->init ();
         if (unlikely (!font_interp.interpret (*font))) goto fail;
 
-        const hb_ubytes_t privDictStr = StructAtOffsetOrNull (cff2, font->privateDictInfo.offset).as_ubytes (font->privateDictInfo.size);
-        if (unlikely (!privDictStr.sanitize (&sc))) goto fail;
+        const hb_ubytes_t privDictStr = StructAtOffsetOrNull (cff2, font->privateDictInfo.offset, sc, font->privateDictInfo.size).as_ubytes (font->privateDictInfo.size);
+        if (unlikely (privDictStr == (const unsigned char *) &Null (UnsizedByteStr))) goto fail;
         cff2_priv_dict_interp_env_t env2 (privDictStr);
         dict_interpreter_t priv_interp (env2);
         privateDicts[i].init ();
         if (unlikely (!priv_interp.interpret (privateDicts[i]))) goto fail;
 
-        privateDicts[i].localSubrs = &StructAtOffsetOrNull (&privDictStr[0], privateDicts[i].subrsOffset);
-        if (privateDicts[i].localSubrs != &Null (CFF2Subrs) &&
-          unlikely (!privateDicts[i].localSubrs->sanitize (&sc)))
-          goto fail;
+        privateDicts[i].localSubrs = &StructAtOffsetOrNull (&privDictStr[0], privateDicts[i].subrsOffset, sc);
       }
 
       return;
@@ -499,7 +499,7 @@ struct cff2
     hb_blob_t                   *blob = nullptr;
     cff2_top_dict_values_t      topDict;
     const CFF2Subrs             *globalSubrs = nullptr;
-    const CFF2VariationStore    *varStore = nullptr;
+    const CFF2ItemVariationStore        *varStore = nullptr;
     const CFF2CharStrings       *charStrings = nullptr;
     const CFF2FDArray           *fdArray = nullptr;
     const CFF2FDSelect          *fdSelect = nullptr;
@@ -518,8 +518,8 @@ struct cff2
     HB_INTERNAL bool get_extents (hb_font_t *font,
                                   hb_codepoint_t glyph,
                                   hb_glyph_extents_t *extents) const;
-    HB_INTERNAL bool paint_glyph (hb_font_t *font, hb_codepoint_t glyph, hb_paint_funcs_t *funcs, void *data, hb_color_t foreground) const;
     HB_INTERNAL bool get_path (hb_font_t *font, hb_codepoint_t glyph, hb_draw_session_t &draw_session) const;
+    HB_INTERNAL bool get_path_at (hb_font_t *font, hb_codepoint_t glyph, hb_draw_session_t &draw_session, hb_array_t coords) const;
   };
 
   struct accelerator_subset_t : accelerator_templ_t
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-cmap-table.hh b/src/java.desktop/share/native/libharfbuzz/hb-ot-cmap-table.hh
index 7e6ced3df4c0..249d4cac5db7 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-ot-cmap-table.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-cmap-table.hh
@@ -41,6 +41,148 @@
 
 namespace OT {
 
+static inline uint8_t unicode_to_macroman (hb_codepoint_t u)
+{
+  static const struct unicode_to_macroman_t
+  {
+    uint16_t unicode;
+    uint8_t macroman;
+  }
+  mapping[] =
+  {
+    { 0x00A0, 0xCA },
+    { 0x00A1, 0xC1 },
+    { 0x00A2, 0xA2 },
+    { 0x00A3, 0xA3 },
+    { 0x00A5, 0xB4 },
+    { 0x00A7, 0xA4 },
+    { 0x00A8, 0xAC },
+    { 0x00A9, 0xA9 },
+    { 0x00AA, 0xBB },
+    { 0x00AB, 0xC7 },
+    { 0x00AC, 0xC2 },
+    { 0x00AE, 0xA8 },
+    { 0x00AF, 0xF8 },
+    { 0x00B0, 0xA1 },
+    { 0x00B1, 0xB1 },
+    { 0x00B4, 0xAB },
+    { 0x00B5, 0xB5 },
+    { 0x00B6, 0xA6 },
+    { 0x00B7, 0xE1 },
+    { 0x00B8, 0xFC },
+    { 0x00BA, 0xBC },
+    { 0x00BB, 0xC8 },
+    { 0x00BF, 0xC0 },
+    { 0x00C0, 0xCB },
+    { 0x00C1, 0xE7 },
+    { 0x00C2, 0xE5 },
+    { 0x00C3, 0xCC },
+    { 0x00C4, 0x80 },
+    { 0x00C5, 0x81 },
+    { 0x00C6, 0xAE },
+    { 0x00C7, 0x82 },
+    { 0x00C8, 0xE9 },
+    { 0x00C9, 0x83 },
+    { 0x00CA, 0xE6 },
+    { 0x00CB, 0xE8 },
+    { 0x00CC, 0xED },
+    { 0x00CD, 0xEA },
+    { 0x00CE, 0xEB },
+    { 0x00CF, 0xEC },
+    { 0x00D1, 0x84 },
+    { 0x00D2, 0xF1 },
+    { 0x00D3, 0xEE },
+    { 0x00D4, 0xEF },
+    { 0x00D5, 0xCD },
+    { 0x00D6, 0x85 },
+    { 0x00D8, 0xAF },
+    { 0x00D9, 0xF4 },
+    { 0x00DA, 0xF2 },
+    { 0x00DB, 0xF3 },
+    { 0x00DC, 0x86 },
+    { 0x00DF, 0xA7 },
+    { 0x00E0, 0x88 },
+    { 0x00E1, 0x87 },
+    { 0x00E2, 0x89 },
+    { 0x00E3, 0x8B },
+    { 0x00E4, 0x8A },
+    { 0x00E5, 0x8C },
+    { 0x00E6, 0xBE },
+    { 0x00E7, 0x8D },
+    { 0x00E8, 0x8F },
+    { 0x00E9, 0x8E },
+    { 0x00EA, 0x90 },
+    { 0x00EB, 0x91 },
+    { 0x00EC, 0x93 },
+    { 0x00ED, 0x92 },
+    { 0x00EE, 0x94 },
+    { 0x00EF, 0x95 },
+    { 0x00F1, 0x96 },
+    { 0x00F2, 0x98 },
+    { 0x00F3, 0x97 },
+    { 0x00F4, 0x99 },
+    { 0x00F5, 0x9B },
+    { 0x00F6, 0x9A },
+    { 0x00F7, 0xD6 },
+    { 0x00F8, 0xBF },
+    { 0x00F9, 0x9D },
+    { 0x00FA, 0x9C },
+    { 0x00FB, 0x9E },
+    { 0x00FC, 0x9F },
+    { 0x00FF, 0xD8 },
+    { 0x0131, 0xF5 },
+    { 0x0152, 0xCE },
+    { 0x0153, 0xCF },
+    { 0x0178, 0xD9 },
+    { 0x0192, 0xC4 },
+    { 0x02C6, 0xF6 },
+    { 0x02C7, 0xFF },
+    { 0x02D8, 0xF9 },
+    { 0x02D9, 0xFA },
+    { 0x02DA, 0xFB },
+    { 0x02DB, 0xFE },
+    { 0x02DC, 0xF7 },
+    { 0x02DD, 0xFD },
+    { 0x03A9, 0xBD },
+    { 0x03C0, 0xB9 },
+    { 0x2013, 0xD0 },
+    { 0x2014, 0xD1 },
+    { 0x2018, 0xD4 },
+    { 0x2019, 0xD5 },
+    { 0x201A, 0xE2 },
+    { 0x201C, 0xD2 },
+    { 0x201D, 0xD3 },
+    { 0x201E, 0xE3 },
+    { 0x2020, 0xA0 },
+    { 0x2021, 0xE0 },
+    { 0x2022, 0xA5 },
+    { 0x2026, 0xC9 },
+    { 0x2030, 0xE4 },
+    { 0x2039, 0xDC },
+    { 0x203A, 0xDD },
+    { 0x2044, 0xDA },
+    { 0x20AC, 0xDB },
+    { 0x2122, 0xAA },
+    { 0x2202, 0xB6 },
+    { 0x2206, 0xC6 },
+    { 0x220F, 0xB8 },
+    { 0x2211, 0xB7 },
+    { 0x221A, 0xC3 },
+    { 0x221E, 0xB0 },
+    { 0x222B, 0xBA },
+    { 0x2248, 0xC5 },
+    { 0x2260, 0xAD },
+    { 0x2264, 0xB2 },
+    { 0x2265, 0xB3 },
+    { 0x25CA, 0xD7 },
+    { 0xF8FF, 0xF0 },
+    { 0xFB01, 0xDE },
+    { 0xFB02, 0xDF },
+  };
+  auto *c = hb_bsearch (u, mapping, ARRAY_LENGTH (mapping), sizeof (mapping[0]),
+                        _hb_cmp_operator);
+  return c ? c->macroman : 0;
+}
 
 struct CmapSubtableFormat0
 {
@@ -556,6 +698,7 @@ struct CmapSubtableFormat4
     TRACE_SANITIZE (this);
     if (unlikely (!c->check_struct (this)))
       return_trace (false);
+    hb_barrier ();
 
     if (unlikely (!c->check_range (this, length)))
     {
@@ -742,10 +885,11 @@ struct CmapSubtableLongSegmented
                         unsigned num_glyphs) const
   {
     hb_codepoint_t last_end = 0;
-    for (unsigned i = 0; i < this->groups.len; i++)
+    unsigned count = this->groups.len;
+    for (unsigned i = 0; i < count; i++)
     {
-      hb_codepoint_t start = this->groups[i].startCharCode;
-      hb_codepoint_t end = hb_min ((hb_codepoint_t) this->groups[i].endCharCode,
+      hb_codepoint_t start = this->groups.arrayZ[i].startCharCode;
+      hb_codepoint_t end = hb_min ((hb_codepoint_t) this->groups.arrayZ[i].endCharCode,
                                    (hb_codepoint_t) HB_UNICODE_MAX);
       if (unlikely (start > end || start < last_end)) {
         // Range is not in order and is invalid, skip it.
@@ -754,7 +898,7 @@ struct CmapSubtableLongSegmented
       last_end = end;
 
 
-      hb_codepoint_t gid = this->groups[i].glyphID;
+      hb_codepoint_t gid = this->groups.arrayZ[i].glyphID;
       if (!gid)
       {
         if (T::formatNumber == 13) continue;
@@ -767,9 +911,9 @@ struct CmapSubtableLongSegmented
 
       mapping->alloc (mapping->get_population () + end - start + 1);
 
+      unicodes->add_range (start, end);
       for (unsigned cp = start; cp <= end; cp++)
       {
-        unicodes->add (cp);
         mapping->set (cp, gid);
         gid += T::increment;
       }
@@ -1253,6 +1397,9 @@ struct CmapSubtableFormat14
     hb_vector_t> obj_indices;
     for (int i = src_tbl->record.len - 1; i >= 0; i--)
     {
+      if (!unicodes->has(src_tbl->record[i].varSelector))
+        continue;
+
       hb_pair_t result = src_tbl->record[i].copy (c, unicodes, glyphs_requested, glyph_map, base);
       if (result.first || result.second)
         obj_indices.push (result);
@@ -1309,6 +1456,7 @@ struct CmapSubtableFormat14
   {
     + hb_iter (record)
     | hb_filter (hb_bool, &VariationSelectorRecord::nonDefaultUVS)
+    | hb_filter (unicodes, &VariationSelectorRecord::varSelector)
     | hb_map (&VariationSelectorRecord::nonDefaultUVS)
     | hb_map (hb_add (this))
     | hb_apply ([=] (const NonDefaultUVS& _) { _.closure_glyphs (unicodes, glyphset); })
@@ -1353,12 +1501,12 @@ struct CmapSubtable
                   hb_codepoint_t *glyph) const
   {
     switch (u.format) {
-    case  0: return u.format0 .get_glyph (codepoint, glyph);
-    case  4: return u.format4 .get_glyph (codepoint, glyph);
-    case  6: return u.format6 .get_glyph (codepoint, glyph);
-    case 10: return u.format10.get_glyph (codepoint, glyph);
-    case 12: return u.format12.get_glyph (codepoint, glyph);
-    case 13: return u.format13.get_glyph (codepoint, glyph);
+    case  0: hb_barrier (); return u.format0 .get_glyph (codepoint, glyph);
+    case  4: hb_barrier (); return u.format4 .get_glyph (codepoint, glyph);
+    case  6: hb_barrier (); return u.format6 .get_glyph (codepoint, glyph);
+    case 10: hb_barrier (); return u.format10.get_glyph (codepoint, glyph);
+    case 12: hb_barrier (); return u.format12.get_glyph (codepoint, glyph);
+    case 13: hb_barrier (); return u.format13.get_glyph (codepoint, glyph);
     case 14:
     default: return false;
     }
@@ -1366,12 +1514,12 @@ struct CmapSubtable
   void collect_unicodes (hb_set_t *out, unsigned int num_glyphs = UINT_MAX) const
   {
     switch (u.format) {
-    case  0: u.format0 .collect_unicodes (out); return;
-    case  4: u.format4 .collect_unicodes (out); return;
-    case  6: u.format6 .collect_unicodes (out); return;
-    case 10: u.format10.collect_unicodes (out); return;
-    case 12: u.format12.collect_unicodes (out, num_glyphs); return;
-    case 13: u.format13.collect_unicodes (out, num_glyphs); return;
+    case  0: hb_barrier (); u.format0 .collect_unicodes (out); return;
+    case  4: hb_barrier (); u.format4 .collect_unicodes (out); return;
+    case  6: hb_barrier (); u.format6 .collect_unicodes (out); return;
+    case 10: hb_barrier (); u.format10.collect_unicodes (out); return;
+    case 12: hb_barrier (); u.format12.collect_unicodes (out, num_glyphs); return;
+    case 13: hb_barrier (); u.format13.collect_unicodes (out, num_glyphs); return;
     case 14:
     default: return;
     }
@@ -1382,12 +1530,12 @@ struct CmapSubtable
                         unsigned num_glyphs = UINT_MAX) const
   {
     switch (u.format) {
-    case  0: u.format0 .collect_mapping (unicodes, mapping); return;
-    case  4: u.format4 .collect_mapping (unicodes, mapping); return;
-    case  6: u.format6 .collect_mapping (unicodes, mapping); return;
-    case 10: u.format10.collect_mapping (unicodes, mapping); return;
-    case 12: u.format12.collect_mapping (unicodes, mapping, num_glyphs); return;
-    case 13: u.format13.collect_mapping (unicodes, mapping, num_glyphs); return;
+    case  0: hb_barrier (); u.format0 .collect_mapping (unicodes, mapping); return;
+    case  4: hb_barrier (); u.format4 .collect_mapping (unicodes, mapping); return;
+    case  6: hb_barrier (); u.format6 .collect_mapping (unicodes, mapping); return;
+    case 10: hb_barrier (); u.format10.collect_mapping (unicodes, mapping); return;
+    case 12: hb_barrier (); u.format12.collect_mapping (unicodes, mapping, num_glyphs); return;
+    case 13: hb_barrier (); u.format13.collect_mapping (unicodes, mapping, num_glyphs); return;
     case 14:
     default: return;
     }
@@ -1396,12 +1544,12 @@ struct CmapSubtable
   unsigned get_language () const
   {
     switch (u.format) {
-    case  0: return u.format0 .get_language ();
-    case  4: return u.format4 .get_language ();
-    case  6: return u.format6 .get_language ();
-    case 10: return u.format10.get_language ();
-    case 12: return u.format12.get_language ();
-    case 13: return u.format13.get_language ();
+    case  0: hb_barrier (); return u.format0 .get_language ();
+    case  4: hb_barrier (); return u.format4 .get_language ();
+    case  6: hb_barrier (); return u.format6 .get_language ();
+    case 10: hb_barrier (); return u.format10.get_language ();
+    case 12: hb_barrier (); return u.format12.get_language ();
+    case 13: hb_barrier (); return u.format13.get_language ();
     case 14:
     default: return 0;
     }
@@ -1416,9 +1564,9 @@ struct CmapSubtable
                   const void *base)
   {
     switch (format) {
-    case  4: return u.format4.serialize (c, it);
-    case 12: return u.format12.serialize (c, it);
-    case 14: return u.format14.serialize (c, &plan->unicodes, &plan->glyphs_requested, plan->glyph_map, base);
+    case  4: hb_barrier (); return u.format4.serialize (c, it);
+    case 12: hb_barrier (); return u.format12.serialize (c, it);
+    case 14: hb_barrier (); return u.format14.serialize (c, &plan->unicodes, &plan->glyphs_requested, plan->glyph_map, base);
     default: return;
     }
   }
@@ -1427,14 +1575,15 @@ struct CmapSubtable
   {
     TRACE_SANITIZE (this);
     if (!u.format.sanitize (c)) return_trace (false);
+    hb_barrier ();
     switch (u.format) {
-    case  0: return_trace (u.format0 .sanitize (c));
-    case  4: return_trace (u.format4 .sanitize (c));
-    case  6: return_trace (u.format6 .sanitize (c));
-    case 10: return_trace (u.format10.sanitize (c));
-    case 12: return_trace (u.format12.sanitize (c));
-    case 13: return_trace (u.format13.sanitize (c));
-    case 14: return_trace (u.format14.sanitize (c));
+    case  0: hb_barrier (); return_trace (u.format0 .sanitize (c));
+    case  4: hb_barrier (); return_trace (u.format4 .sanitize (c));
+    case  6: hb_barrier (); return_trace (u.format6 .sanitize (c));
+    case 10: hb_barrier (); return_trace (u.format10.sanitize (c));
+    case 12: hb_barrier (); return_trace (u.format12.sanitize (c));
+    case 13: hb_barrier (); return_trace (u.format13.sanitize (c));
+    case 14: hb_barrier (); return_trace (u.format14.sanitize (c));
     default:return_trace (true);
     }
   }
@@ -1462,8 +1611,11 @@ struct EncodingRecord
     int ret;
     ret = platformID.cmp (other.platformID);
     if (ret) return ret;
-    ret = encodingID.cmp (other.encodingID);
-    if (ret) return ret;
+    if (other.encodingID != 0xFFFF)
+    {
+      ret = encodingID.cmp (other.encodingID);
+      if (ret) return ret;
+    }
     return 0;
   }
 
@@ -1811,9 +1963,13 @@ struct cmap
                                          c->plan));
   }
 
-  const CmapSubtable *find_best_subtable (bool *symbol = nullptr) const
+  const CmapSubtable *find_best_subtable (bool *symbol = nullptr,
+                                          bool *mac = nullptr,
+                                          bool *macroman = nullptr) const
   {
     if (symbol) *symbol = false;
+    if (mac) *mac = false;
+    if (macroman) *macroman = false;
 
     const CmapSubtable *subtable;
 
@@ -1838,6 +1994,20 @@ struct cmap
     if ((subtable = this->find_subtable (0, 1))) return subtable;
     if ((subtable = this->find_subtable (0, 0))) return subtable;
 
+    /* MacRoman subtable. */
+    if ((subtable = this->find_subtable (1, 0)))
+    {
+      if (mac) *mac = true;
+      if (macroman) *macroman = true;
+      return subtable;
+    }
+    /* Any other Mac subtable; we just map ASCII for these. */
+    if ((subtable = this->find_subtable (1, 0xFFFF)))
+    {
+      if (mac) *mac = true;
+      return subtable;
+    }
+
     /* Meh. */
     return &Null (CmapSubtable);
   }
@@ -1849,8 +2019,8 @@ struct cmap
     accelerator_t (hb_face_t *face)
     {
       this->table = hb_sanitize_context_t ().reference_table (face);
-      bool symbol;
-      this->subtable = table->find_best_subtable (&symbol);
+      bool symbol, mac, macroman;
+      this->subtable = table->find_best_subtable (&symbol, &mac, ¯oman);
       this->subtable_uvs = &Null (CmapSubtableFormat14);
       {
         const CmapSubtable *st = table->find_subtable (0, 5);
@@ -1859,6 +2029,7 @@ struct cmap
       }
 
       this->get_glyph_data = subtable;
+#ifndef HB_NO_CMAP_LEGACY_SUBTABLES
       if (unlikely (symbol))
       {
         switch ((unsigned) face->table.OS2->get_font_page ()) {
@@ -1878,7 +2049,16 @@ struct cmap
           break;
         }
       }
+      else if (unlikely (macroman))
+      {
+        this->get_glyph_funcZ = get_glyph_from_macroman;
+      }
+      else if (unlikely (mac))
+      {
+        this->get_glyph_funcZ = get_glyph_from_ascii;
+      }
       else
+#endif
       {
         switch (subtable->u.format) {
         /* Accelerate format 4 and format 12. */
@@ -1921,7 +2101,7 @@ struct cmap
                             hb_codepoint_t *glyph,
                             cache_t *cache = nullptr) const
     {
-      if (unlikely (!this->get_glyph_funcZ)) return 0;
+      if (unlikely (!this->get_glyph_funcZ)) return false;
       return _cached_get (unicode, glyph, cache);
     }
 
@@ -2003,6 +2183,28 @@ struct cmap
       return false;
     }
 
+    template 
+    HB_INTERNAL static bool get_glyph_from_ascii (const void *obj,
+                                                  hb_codepoint_t codepoint,
+                                                  hb_codepoint_t *glyph)
+    {
+      const Type *typed_obj = (const Type *) obj;
+      return codepoint < 0x80 && typed_obj->get_glyph (codepoint, glyph);
+    }
+
+    template 
+    HB_INTERNAL static bool get_glyph_from_macroman (const void *obj,
+                                                     hb_codepoint_t codepoint,
+                                                     hb_codepoint_t *glyph)
+    {
+      if (get_glyph_from_ascii (obj, codepoint, glyph))
+        return true;
+
+      const Type *typed_obj = (const Type *) obj;
+      unsigned c = unicode_to_macroman (codepoint);
+      return c && typed_obj->get_glyph (c, glyph);
+    }
+
     private:
     hb_nonnull_ptr_t subtable;
     hb_nonnull_ptr_t subtable_uvs;
@@ -2032,34 +2234,13 @@ struct cmap
     return &(this+result.subtable);
   }
 
-  const EncodingRecord *find_encodingrec (unsigned int platform_id,
-                                          unsigned int encoding_id) const
-  {
-    EncodingRecord key;
-    key.platformID = platform_id;
-    key.encodingID = encoding_id;
-
-    return encodingRecord.as_array ().bsearch (key);
-  }
-
-  bool find_subtable (unsigned format) const
-  {
-    auto it =
-    + hb_iter (encodingRecord)
-    | hb_map (&EncodingRecord::subtable)
-    | hb_map (hb_add (this))
-    | hb_filter ([&] (const CmapSubtable& _) { return _.u.format == format; })
-    ;
-
-    return it.len ();
-  }
-
   public:
 
   bool sanitize (hb_sanitize_context_t *c) const
   {
     TRACE_SANITIZE (this);
     return_trace (c->check_struct (this) &&
+                  hb_barrier () &&
                   likely (version == 0) &&
                   encodingRecord.sanitize (c, this));
   }
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-face-table-list.hh b/src/java.desktop/share/native/libharfbuzz/hb-ot-face-table-list.hh
index b552dfdd9dae..97825f4d19c7 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-ot-face-table-list.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-face-table-list.hh
@@ -95,12 +95,18 @@ HB_OT_CORE_TABLE (OT, fvar)
 HB_OT_CORE_TABLE (OT, avar)
 HB_OT_CORE_TABLE (OT, cvar)
 HB_OT_ACCELERATOR (OT, gvar)
+#ifndef HB_NO_BEYOND_64K
+HB_OT_ACCELERATOR (OT, GVAR)
+#endif
 HB_OT_CORE_TABLE (OT, MVAR)
+#ifndef HB_NO_VAR_COMPOSITES
+HB_OT_ACCELERATOR (OT, VARC)
+#endif
 #endif
 
 /* Legacy kern. */
 #ifndef HB_NO_OT_KERN
-HB_OT_CORE_TABLE (OT, kern)
+HB_OT_ACCELERATOR (OT, kern)
 #endif
 
 /* OpenType shaping. */
@@ -118,9 +124,9 @@ HB_OT_CORE_TABLE (OT, BASE)
 
 /* AAT shaping. */
 #ifndef HB_NO_AAT
-HB_OT_TABLE (AAT, morx)
-HB_OT_TABLE (AAT, mort)
-HB_OT_TABLE (AAT, kerx)
+HB_OT_ACCELERATOR (AAT, morx)
+HB_OT_ACCELERATOR (AAT, mort)
+HB_OT_ACCELERATOR (AAT, kerx)
 HB_OT_TABLE (AAT, ankr)
 HB_OT_TABLE (AAT, trak)
 HB_OT_TABLE (AAT, ltag)
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-face.cc b/src/java.desktop/share/native/libharfbuzz/hb-ot-face.cc
index 2243ee028741..1cf14f3ebc62 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-ot-face.cc
+++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-face.cc
@@ -41,6 +41,9 @@
 #include "hb-ot-layout-gdef-table.hh"
 #include "hb-ot-layout-gsub-table.hh"
 #include "hb-ot-layout-gpos-table.hh"
+#include "hb-ot-var-varc-table.hh"
+#include "hb-aat-layout-kerx-table.hh"
+#include "hb-aat-layout-morx-table.hh"
 
 
 void hb_ot_face_t::init0 (hb_face_t *face)
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-font.cc b/src/java.desktop/share/native/libharfbuzz/hb-ot-font.cc
index deec909b22e7..2a633c778166 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-ot-font.cc
+++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-font.cc
@@ -36,13 +36,17 @@
 #include "hb-ot-face.hh"
 #include "hb-outline.hh"
 
+#ifndef HB_NO_AAT
+#include "hb-aat-layout-trak-table.hh"
+#endif
 #include "hb-ot-cmap-table.hh"
 #include "hb-ot-glyf-table.hh"
 #include "hb-ot-cff2-table.hh"
 #include "hb-ot-cff1-table.hh"
 #include "hb-ot-hmtx-table.hh"
 #include "hb-ot-post-table.hh"
-#include "hb-ot-stat-table.hh" // Just so we compile it; unused otherwise.
+#include "hb-ot-stat-table.hh"
+#include "hb-ot-var-varc-table.hh"
 #include "hb-ot-vorg-table.hh"
 #include "OT/Color/CBDT/CBDT.hh"
 #include "OT/Color/COLR/COLR.hh"
@@ -72,6 +76,10 @@ struct hb_ot_font_t
 {
   const hb_ot_face_t *ot_face;
 
+#ifndef HB_NO_AAT
+  bool apply_trak;
+#endif
+
 #ifndef HB_NO_OT_FONT_CMAP_CACHE
   hb_ot_font_cmap_cache_t *cmap_cache;
 #endif
@@ -90,6 +98,15 @@ _hb_ot_font_create (hb_font_t *font)
 
   ot_font->ot_face = &font->face->table;
 
+#ifndef HB_NO_AAT
+  /* According to Ned, trak is applied by default for "modern fonts", as detected by presence of STAT table. */
+#ifndef HB_NO_STYLE
+  ot_font->apply_trak = font->face->table.STAT->has_data () && font->face->table.trak->has_data ();
+#else
+  ot_font->apply_trak = false;
+#endif
+#endif
+
 #ifndef HB_NO_OT_FONT_CMAP_CACHE
   // retry:
   auto *cmap_cache  = (hb_ot_font_cmap_cache_t *) hb_face_get_user_data (font->face,
@@ -199,7 +216,6 @@ hb_ot_get_glyph_h_advances (hb_font_t* font, void* font_data,
                             unsigned advance_stride,
                             void *user_data HB_UNUSED)
 {
-
   const hb_ot_font_t *ot_font = (const hb_ot_font_t *) font_data;
   const hb_ot_face_t *ot_face = ot_font->ot_face;
   const OT::hmtx_accelerator_t &hmtx = *ot_face->hmtx;
@@ -208,12 +224,12 @@ hb_ot_get_glyph_h_advances (hb_font_t* font, void* font_data,
 
 #if !defined(HB_NO_VAR) && !defined(HB_NO_OT_FONT_ADVANCE_CACHE)
   const OT::HVAR &HVAR = *hmtx.var_table;
-  const OT::VariationStore &varStore = &HVAR + HVAR.varStore;
-  OT::VariationStore::cache_t *varStore_cache = font->num_coords * count >= 128 ? varStore.create_cache () : nullptr;
+  const OT::ItemVariationStore &varStore = &HVAR + HVAR.varStore;
+  OT::ItemVariationStore::cache_t *varStore_cache = font->num_coords * count >= 128 ? varStore.create_cache () : nullptr;
 
   bool use_cache = font->num_coords;
 #else
-  OT::VariationStore::cache_t *varStore_cache = nullptr;
+  OT::ItemVariationStore::cache_t *varStore_cache = nullptr;
   bool use_cache = false;
 #endif
 
@@ -277,7 +293,7 @@ hb_ot_get_glyph_h_advances (hb_font_t* font, void* font_data,
   }
 
 #if !defined(HB_NO_VAR) && !defined(HB_NO_OT_FONT_ADVANCE_CACHE)
-  OT::VariationStore::destroy_cache (varStore_cache);
+  OT::ItemVariationStore::destroy_cache (varStore_cache);
 #endif
 
   if (font->x_strength && !font->embolden_in_place)
@@ -291,6 +307,20 @@ hb_ot_get_glyph_h_advances (hb_font_t* font, void* font_data,
       first_advance = &StructAtOffsetUnaligned (first_advance, advance_stride);
     }
   }
+
+#ifndef HB_NO_AAT
+  if (ot_font->apply_trak)
+  {
+    hb_position_t tracking = font->face->table.trak->get_h_tracking (font);
+    first_advance = orig_first_advance;
+    for (unsigned int i = 0; i < count; i++)
+    {
+      *first_advance += tracking;
+      first_glyph = &StructAtOffsetUnaligned (first_glyph, glyph_stride);
+      first_advance = &StructAtOffsetUnaligned (first_advance, advance_stride);
+    }
+  }
+#endif
 }
 
 #ifndef HB_NO_VERTICAL
@@ -313,10 +343,10 @@ hb_ot_get_glyph_v_advances (hb_font_t* font, void* font_data,
   {
 #if !defined(HB_NO_VAR) && !defined(HB_NO_OT_FONT_ADVANCE_CACHE)
     const OT::VVAR &VVAR = *vmtx.var_table;
-    const OT::VariationStore &varStore = &VVAR + VVAR.varStore;
-    OT::VariationStore::cache_t *varStore_cache = font->num_coords ? varStore.create_cache () : nullptr;
+    const OT::ItemVariationStore &varStore = &VVAR + VVAR.varStore;
+    OT::ItemVariationStore::cache_t *varStore_cache = font->num_coords ? varStore.create_cache () : nullptr;
 #else
-    OT::VariationStore::cache_t *varStore_cache = nullptr;
+    OT::ItemVariationStore::cache_t *varStore_cache = nullptr;
 #endif
 
     for (unsigned int i = 0; i < count; i++)
@@ -327,7 +357,7 @@ hb_ot_get_glyph_v_advances (hb_font_t* font, void* font_data,
     }
 
 #if !defined(HB_NO_VAR) && !defined(HB_NO_OT_FONT_ADVANCE_CACHE)
-    OT::VariationStore::destroy_cache (varStore_cache);
+    OT::ItemVariationStore::destroy_cache (varStore_cache);
 #endif
   }
   else
@@ -355,6 +385,20 @@ hb_ot_get_glyph_v_advances (hb_font_t* font, void* font_data,
       first_advance = &StructAtOffsetUnaligned (first_advance, advance_stride);
     }
   }
+
+#ifndef HB_NO_AAT
+  if (ot_font->apply_trak)
+  {
+    hb_position_t tracking = font->face->table.trak->get_v_tracking (font);
+    first_advance = orig_first_advance;
+    for (unsigned int i = 0; i < count; i++)
+    {
+      *first_advance += tracking;
+      first_glyph = &StructAtOffsetUnaligned (first_glyph, glyph_stride);
+      first_advance = &StructAtOffsetUnaligned (first_advance, advance_stride);
+    }
+  }
+#endif
 }
 #endif
 
@@ -523,6 +567,10 @@ hb_ot_draw_glyph (hb_font_t *font,
   { // Need draw_session to be destructed before emboldening.
     hb_draw_session_t draw_session (embolden ? hb_outline_recording_pen_get_funcs () : draw_funcs,
                                     embolden ? &outline : draw_data, font->slant_xy);
+#ifndef HB_NO_VAR_COMPOSITES
+    if (!font->face->table.VARC->get_path (font, glyph, draw_session))
+#endif
+    // Keep the following in synch with VARC::get_path_at()
     if (!font->face->table.glyf->get_path (font, glyph, draw_session))
 #ifndef HB_NO_CFF
     if (!font->face->table.cff2->get_path (font, glyph, draw_session))
@@ -563,11 +611,11 @@ hb_ot_paint_glyph (hb_font_t *font,
   if (font->face->table.sbix->paint_glyph (font, glyph, paint_funcs, paint_data)) return;
 #endif
 #endif
-  if (font->face->table.glyf->paint_glyph (font, glyph, paint_funcs, paint_data, foreground)) return;
-#ifndef HB_NO_CFF
-  if (font->face->table.cff2->paint_glyph (font, glyph, paint_funcs, paint_data, foreground)) return;
-  if (font->face->table.cff1->paint_glyph (font, glyph, paint_funcs, paint_data, foreground)) return;
-#endif
+
+  // Outline glyph
+  paint_funcs->push_clip_glyph (paint_data, glyph, font);
+  paint_funcs->color (paint_data, true, foreground);
+  paint_funcs->pop_clip (paint_data);
 }
 #endif
 
@@ -634,7 +682,9 @@ _hb_ot_get_font_funcs ()
  * hb_ot_font_set_funcs:
  * @font: #hb_font_t to work upon
  *
- * Sets the font functions to use when working with @font.
+ * Sets the font functions to use when working with @font to
+ * the HarfBuzz's native implementation. This is the default
+ * for fonts newly created.
  *
  * Since: 0.9.28
  **/
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-hdmx-table.hh b/src/java.desktop/share/native/libharfbuzz/hb-ot-hdmx-table.hh
index 77e68dbca42e..918cf32dcb5f 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-ot-hdmx-table.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-hdmx-table.hh
@@ -71,6 +71,7 @@ struct DeviceRecord
   {
     TRACE_SANITIZE (this);
     return_trace (likely (c->check_struct (this) &&
+                          hb_barrier () &&
                           c->check_range (this, sizeDeviceRecord)));
   }
 
@@ -94,7 +95,7 @@ struct hdmx
   bool serialize (hb_serialize_context_t *c,
                   unsigned version,
                   Iterator it,
-                  const hb_vector_t &new_to_old_gid_list,
+                  hb_array_t new_to_old_gid_list,
                   unsigned num_glyphs)
   {
     TRACE_SERIALIZE (this);
@@ -152,6 +153,7 @@ struct hdmx
   {
     TRACE_SANITIZE (this);
     return_trace (c->check_struct (this) &&
+                  hb_barrier () &&
                   !hb_unsigned_mul_overflows (numRecords, sizeDeviceRecord) &&
                   min_size + numRecords * sizeDeviceRecord > numRecords * sizeDeviceRecord &&
                   sizeDeviceRecord >= DeviceRecord::min_size &&
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-head-table.hh b/src/java.desktop/share/native/libharfbuzz/hb-ot-head-table.hh
index ab057fcfe4f1..34535e2286d8 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-ot-head-table.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-head-table.hh
@@ -103,6 +103,7 @@ struct head
   {
     TRACE_SANITIZE (this);
     return_trace (c->check_struct (this) &&
+                  hb_barrier () &&
                   version.major == 1 &&
                   magicNumber == 0x5F0F3CF5u);
   }
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-hhea-table.hh b/src/java.desktop/share/native/libharfbuzz/hb-ot-hhea-table.hh
index 37ef8744572d..5e3be5be525b 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-ot-hhea-table.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-hhea-table.hh
@@ -50,7 +50,9 @@ struct _hea
   bool sanitize (hb_sanitize_context_t *c) const
   {
     TRACE_SANITIZE (this);
-    return_trace (c->check_struct (this) && likely (version.major == 1));
+    return_trace (c->check_struct (this) &&
+                  hb_barrier () &&
+                  likely (version.major == 1));
   }
 
   public:
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-hmtx-table.hh b/src/java.desktop/share/native/libharfbuzz/hb-ot-hmtx-table.hh
index 39e1f4830a58..f7b4ca721984 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-ot-hmtx-table.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-hmtx-table.hh
@@ -30,6 +30,7 @@
 #include "hb-open-type.hh"
 #include "hb-ot-maxp-table.hh"
 #include "hb-ot-hhea-table.hh"
+#include "hb-ot-os2-table.hh"
 #include "hb-ot-var-hvar-table.hh"
 #include "hb-ot-var-mvar-table.hh"
 #include "hb-ot-metrics.hh"
@@ -145,6 +146,29 @@ struct hmtxvmtx
         table->minTrailingBearing = min_rsb;
         table->maxExtent = max_extent;
       }
+
+      if (T::is_horizontal)
+      {
+        const auto &OS2 = *c->plan->source->table.OS2;
+        if (OS2.has_data () &&
+            table->ascender == OS2.sTypoAscender &&
+            table->descender == OS2.sTypoDescender &&
+            table->lineGap == OS2.sTypoLineGap)
+        {
+          table->ascender = static_cast (roundf (OS2.sTypoAscender +
+                                                      MVAR.get_var (HB_OT_METRICS_TAG_HORIZONTAL_ASCENDER,
+                                                                    c->plan->normalized_coords.arrayZ,
+                                                                    c->plan->normalized_coords.length)));
+          table->descender = static_cast (roundf (OS2.sTypoDescender +
+                                                       MVAR.get_var (HB_OT_METRICS_TAG_HORIZONTAL_DESCENDER,
+                                                                     c->plan->normalized_coords.arrayZ,
+                                                                     c->plan->normalized_coords.length)));
+          table->lineGap = static_cast (roundf (OS2.sTypoLineGap +
+                                                     MVAR.get_var (HB_OT_METRICS_TAG_HORIZONTAL_LINE_GAP,
+                                                                   c->plan->normalized_coords.arrayZ,
+                                                                   c->plan->normalized_coords.length)));
+        }
+      }
     }
 #endif
 
@@ -158,7 +182,7 @@ struct hmtxvmtx
            hb_requires (hb_is_iterator (Iterator))>
   void serialize (hb_serialize_context_t *c,
                   Iterator it,
-                  const hb_vector_t new_to_old_gid_list,
+                  hb_array_t new_to_old_gid_list,
                   unsigned num_long_metrics,
                   unsigned total_num_metrics)
   {
@@ -374,7 +398,7 @@ struct hmtxvmtx
 
     unsigned get_advance_with_var_unscaled (hb_codepoint_t  glyph,
                                             hb_font_t      *font,
-                                            VariationStore::cache_t *store_cache = nullptr) const
+                                            ItemVariationStore::cache_t *store_cache = nullptr) const
     {
       unsigned int advance = get_advance_without_var_unscaled (glyph);
 
@@ -387,7 +411,8 @@ struct hmtxvmtx
                                                                         font->coords, font->num_coords,
                                                                         store_cache));
 
-      return _glyf_get_advance_with_var_unscaled (font, glyph, T::tableTag == HB_OT_TAG_vmtx);
+      unsigned glyf_advance = _glyf_get_advance_with_var_unscaled (font, glyph, T::tableTag == HB_OT_TAG_vmtx);
+      return glyf_advance ? glyf_advance : advance;
 #else
       return advance;
 #endif
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-kern-table.hh b/src/java.desktop/share/native/libharfbuzz/hb-ot-kern-table.hh
index 291683369aa3..bc90c345d055 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-ot-kern-table.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-kern-table.hh
@@ -79,12 +79,23 @@ struct KernSubTableFormat3
   {
     TRACE_SANITIZE (this);
     return_trace (c->check_struct (this) &&
+                  hb_barrier () &&
                   c->check_range (kernValueZ,
                                   kernValueCount * sizeof (FWORD) +
                                   glyphCount * 2 +
                                   leftClassCount * rightClassCount));
   }
 
+  template 
+  void collect_glyphs (set_t &left_set, set_t &right_set, unsigned num_glyphs) const
+  {
+    set_t set;
+    if (likely (glyphCount))
+      set.add_range (0, glyphCount - 1);
+    left_set.union_ (set);
+    right_set.union_ (set);
+  }
+
   protected:
   KernSubTableHeader
                 header;
@@ -121,7 +132,7 @@ struct KernSubTable
   {
     switch (get_type ()) {
     /* This method hooks up to hb_font_t's get_h_kerning.  Only support Format0. */
-    case 0: return u.format0.get_kerning (left, right);
+    case 0: hb_barrier (); return u.format0.get_kerning (left, right);
     default:return 0;
     }
   }
@@ -134,22 +145,36 @@ struct KernSubTable
     switch (subtable_type) {
     case 0:     return_trace (c->dispatch (u.format0));
 #ifndef HB_NO_AAT_SHAPE
-    case 1:     return_trace (u.header.apple ? c->dispatch (u.format1, std::forward (ds)...) : c->default_return_value ());
+    case 1:     return_trace (c->dispatch (u.format1, std::forward (ds)...));
 #endif
     case 2:     return_trace (c->dispatch (u.format2));
 #ifndef HB_NO_AAT_SHAPE
-    case 3:     return_trace (u.header.apple ? c->dispatch (u.format3, std::forward (ds)...) : c->default_return_value ());
+    case 3:     return_trace (c->dispatch (u.format3, std::forward (ds)...));
 #endif
     default:    return_trace (c->default_return_value ());
     }
   }
 
+  template 
+  void collect_glyphs (set_t &left_set, set_t &right_set, unsigned num_glyphs) const
+  {
+    unsigned int subtable_type = get_type ();
+    switch (subtable_type) {
+    case 0:     u.format0.collect_glyphs (left_set, right_set, num_glyphs); return;
+    case 1:     u.format1.collect_glyphs (left_set, right_set, num_glyphs); return;
+    case 2:     u.format2.collect_glyphs (left_set, right_set, num_glyphs); return;
+    case 3:     u.format3.collect_glyphs (left_set, right_set, num_glyphs); return;
+    default:    return;
+    }
+  }
+
   bool sanitize (hb_sanitize_context_t *c) const
   {
     TRACE_SANITIZE (this);
-    if (unlikely (!u.header.sanitize (c) ||
-                  u.header.length < u.header.min_size ||
-                  !c->check_range (this, u.header.length))) return_trace (false);
+    if (unlikely (!(u.header.sanitize (c) &&
+                    hb_barrier () &&
+                    u.header.length >= u.header.min_size &&
+                    c->check_range (this, u.header.length)))) return_trace (false);
 
     return_trace (dispatch (c));
   }
@@ -286,9 +311,9 @@ struct kern
   bool has_state_machine () const
   {
     switch (get_type ()) {
-    case 0: return u.ot.has_state_machine ();
+    case 0: hb_barrier (); return u.ot.has_state_machine ();
 #ifndef HB_NO_AAT_SHAPE
-    case 1: return u.aat.has_state_machine ();
+    case 1: hb_barrier (); return u.aat.has_state_machine ();
 #endif
     default:return false;
     }
@@ -297,9 +322,9 @@ struct kern
   bool has_cross_stream () const
   {
     switch (get_type ()) {
-    case 0: return u.ot.has_cross_stream ();
+    case 0: hb_barrier (); return u.ot.has_cross_stream ();
 #ifndef HB_NO_AAT_SHAPE
-    case 1: return u.aat.has_cross_stream ();
+    case 1: hb_barrier (); return u.aat.has_cross_stream ();
 #endif
     default:return false;
     }
@@ -308,16 +333,17 @@ struct kern
   int get_h_kerning (hb_codepoint_t left, hb_codepoint_t right) const
   {
     switch (get_type ()) {
-    case 0: return u.ot.get_h_kerning (left, right);
+    case 0: hb_barrier (); return u.ot.get_h_kerning (left, right);
 #ifndef HB_NO_AAT_SHAPE
-    case 1: return u.aat.get_h_kerning (left, right);
+    case 1: hb_barrier (); return u.aat.get_h_kerning (left, right);
 #endif
     default:return 0;
     }
   }
 
-  bool apply (AAT::hb_aat_apply_context_t *c) const
-  { return dispatch (c); }
+  bool apply (AAT::hb_aat_apply_context_t *c,
+              const AAT::kern_accelerator_data_t &accel_data) const
+  { return dispatch (c, accel_data); }
 
   template 
   typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const
@@ -337,9 +363,45 @@ struct kern
   {
     TRACE_SANITIZE (this);
     if (!u.version32.sanitize (c)) return_trace (false);
+    hb_barrier ();
     return_trace (dispatch (c));
   }
 
+  AAT::kern_accelerator_data_t create_accelerator_data (unsigned num_glyphs) const
+  {
+    switch (get_type ()) {
+    case 0: hb_barrier (); return u.ot.create_accelerator_data (num_glyphs);
+#ifndef HB_NO_AAT_SHAPE
+    case 1: hb_barrier (); return u.aat.create_accelerator_data (num_glyphs);
+#endif
+    default:return AAT::kern_accelerator_data_t ();
+    }
+  }
+
+  struct accelerator_t
+  {
+    accelerator_t (hb_face_t *face)
+    {
+      hb_sanitize_context_t sc;
+      this->table = sc.reference_table (face);
+      this->accel_data = this->table->create_accelerator_data (face->get_num_glyphs ());
+    }
+    ~accelerator_t ()
+    {
+      this->table.destroy ();
+    }
+
+    hb_blob_t *get_blob () const { return table.get_blob (); }
+
+    bool apply (AAT::hb_aat_apply_context_t *c) const
+    {
+      return table->apply (c, accel_data);
+    }
+
+    hb_blob_ptr_t table;
+    AAT::kern_accelerator_data_t accel_data;
+  };
+
   protected:
   union {
   HBUINT32              version32;
@@ -353,6 +415,10 @@ struct kern
   DEFINE_SIZE_UNION (4, version32);
 };
 
+struct kern_accelerator_t : kern::accelerator_t {
+  kern_accelerator_t (hb_face_t *face) : kern::accelerator_t (face) {}
+};
+
 } /* namespace OT */
 
 
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-layout-base-table.hh b/src/java.desktop/share/native/libharfbuzz/hb-ot-layout-base-table.hh
index 0e57a6c79099..5a3679e4bfa2 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-ot-layout-base-table.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-layout-base-table.hh
@@ -46,6 +46,12 @@ struct BaseCoordFormat1
     return HB_DIRECTION_IS_HORIZONTAL (direction) ? font->em_scale_y (coordinate) : font->em_scale_x (coordinate);
   }
 
+  bool subset (hb_subset_context_t *c) const
+  {
+    TRACE_SUBSET (this);
+    return_trace ((bool) c->serializer->embed (*this));
+  }
+
   bool sanitize (hb_sanitize_context_t *c) const
   {
     TRACE_SANITIZE (this);
@@ -67,6 +73,17 @@ struct BaseCoordFormat2
     return HB_DIRECTION_IS_HORIZONTAL (direction) ? font->em_scale_y (coordinate) : font->em_scale_x (coordinate);
   }
 
+  bool subset (hb_subset_context_t *c) const
+  {
+    TRACE_SUBSET (this);
+    auto *out = c->serializer->embed (*this);
+    if (unlikely (!out)) return_trace (false);
+
+    return_trace (c->serializer->check_assign (out->referenceGlyph,
+                                               c->plan->glyph_map->get (referenceGlyph),
+                                               HB_SERIALIZE_ERROR_INT_OVERFLOW));
+  }
+
   bool sanitize (hb_sanitize_context_t *c) const
   {
     TRACE_SANITIZE (this);
@@ -86,7 +103,7 @@ struct BaseCoordFormat2
 struct BaseCoordFormat3
 {
   hb_position_t get_coord (hb_font_t *font,
-                           const VariationStore &var_store,
+                           const ItemVariationStore &var_store,
                            hb_direction_t direction) const
   {
     const Device &device = this+deviceTable;
@@ -96,6 +113,37 @@ struct BaseCoordFormat3
          : font->em_scale_x (coordinate) + device.get_x_delta (font, var_store);
   }
 
+  void collect_variation_indices (hb_set_t& varidx_set /* OUT */) const
+  {
+    unsigned varidx = (this+deviceTable).get_variation_index ();
+    varidx_set.add (varidx);
+  }
+
+  bool subset (hb_subset_context_t *c) const
+  {
+    TRACE_SUBSET (this);
+    auto *out = c->serializer->embed (*this);
+    if (unlikely (!out)) return_trace (false);
+
+    if (!c->plan->pinned_at_default)
+    {
+      unsigned var_idx = (this+deviceTable).get_variation_index ();
+      if (var_idx != VarIdx::NO_VARIATION)
+      {
+        hb_pair_t *v;
+        if (!c->plan->base_variation_idx_map.has (var_idx, &v))
+          return_trace (false);
+
+        if (unlikely (!c->serializer->check_assign (out->coordinate, coordinate + hb_second (*v),
+                                                    HB_SERIALIZE_ERROR_INT_OVERFLOW)))
+          return_trace (false);
+      }
+    }
+    return_trace (out->deviceTable.serialize_copy (c->serializer, deviceTable,
+                                                   this, 0,
+                                                   hb_serialize_context_t::Head,
+                                                   &c->plan->base_variation_idx_map));
+  }
 
   bool sanitize (hb_sanitize_context_t *c) const
   {
@@ -120,25 +168,47 @@ struct BaseCoord
   bool has_data () const { return u.format; }
 
   hb_position_t get_coord (hb_font_t            *font,
-                           const VariationStore &var_store,
+                           const ItemVariationStore &var_store,
                            hb_direction_t        direction) const
   {
     switch (u.format) {
-    case 1: return u.format1.get_coord (font, direction);
-    case 2: return u.format2.get_coord (font, direction);
-    case 3: return u.format3.get_coord (font, var_store, direction);
+    case 1: hb_barrier (); return u.format1.get_coord (font, direction);
+    case 2: hb_barrier (); return u.format2.get_coord (font, direction);
+    case 3: hb_barrier (); return u.format3.get_coord (font, var_store, direction);
     default:return 0;
     }
   }
 
+  void collect_variation_indices (hb_set_t& varidx_set /* OUT */) const
+  {
+    switch (u.format) {
+    case 3: hb_barrier (); u.format3.collect_variation_indices (varidx_set);
+    default:return;
+    }
+  }
+
+  template 
+  typename context_t::return_t dispatch (context_t *c, Ts&&... ds) const
+  {
+    if (unlikely (!c->may_dispatch (this, &u.format))) return c->no_dispatch_return_value ();
+    TRACE_DISPATCH (this, u.format);
+    switch (u.format) {
+    case 1: hb_barrier (); return_trace (c->dispatch (u.format1, std::forward (ds)...));
+    case 2: hb_barrier (); return_trace (c->dispatch (u.format2, std::forward (ds)...));
+    case 3: hb_barrier (); return_trace (c->dispatch (u.format3, std::forward (ds)...));
+    default:return_trace (c->default_return_value ());
+    }
+  }
+
   bool sanitize (hb_sanitize_context_t *c) const
   {
     TRACE_SANITIZE (this);
     if (unlikely (!u.format.sanitize (c))) return_trace (false);
+    hb_barrier ();
     switch (u.format) {
-    case 1: return_trace (u.format1.sanitize (c));
-    case 2: return_trace (u.format2.sanitize (c));
-    case 3: return_trace (u.format3.sanitize (c));
+    case 1: hb_barrier (); return_trace (u.format1.sanitize (c));
+    case 2: hb_barrier (); return_trace (u.format2.sanitize (c));
+    case 3: hb_barrier (); return_trace (u.format3.sanitize (c));
     default:return_trace (false);
     }
   }
@@ -160,12 +230,37 @@ struct FeatMinMaxRecord
 
   bool has_data () const { return tag; }
 
+  hb_tag_t get_feature_tag () const { return tag; }
+
   void get_min_max (const BaseCoord **min, const BaseCoord **max) const
   {
     if (likely (min)) *min = &(this+minCoord);
     if (likely (max)) *max = &(this+maxCoord);
   }
 
+  void collect_variation_indices (const hb_subset_plan_t* plan,
+                                  const void *base,
+                                  hb_set_t& varidx_set /* OUT */) const
+  {
+    if (!plan->layout_features.has (tag))
+      return;
+
+    (base+minCoord).collect_variation_indices (varidx_set);
+    (base+maxCoord).collect_variation_indices (varidx_set);
+  }
+
+  bool subset (hb_subset_context_t *c,
+               const void *base) const
+  {
+    TRACE_SUBSET (this);
+    auto *out = c->serializer->embed (*this);
+    if (unlikely (!out)) return_trace (false);
+    if (!(out->minCoord.serialize_subset (c, minCoord, base)))
+      return_trace (false);
+
+    return_trace (out->maxCoord.serialize_subset (c, maxCoord, base));
+  }
+
   bool sanitize (hb_sanitize_context_t *c, const void *base) const
   {
     TRACE_SANITIZE (this);
@@ -205,6 +300,39 @@ struct MinMax
     }
   }
 
+  void collect_variation_indices (const hb_subset_plan_t* plan,
+                                  hb_set_t& varidx_set /* OUT */) const
+  {
+    (this+minCoord).collect_variation_indices (varidx_set);
+    (this+maxCoord).collect_variation_indices (varidx_set);
+    for (const FeatMinMaxRecord& record : featMinMaxRecords)
+      record.collect_variation_indices (plan, this, varidx_set);
+  }
+
+  bool subset (hb_subset_context_t *c) const
+  {
+    TRACE_SUBSET (this);
+    auto *out = c->serializer->start_embed (*this);
+    if (unlikely (!out || !c->serializer->extend_min (out))) return_trace (false);
+
+    if (!(out->minCoord.serialize_subset (c, minCoord, this)) ||
+        !(out->maxCoord.serialize_subset (c, maxCoord, this)))
+      return_trace (false);
+
+    unsigned len = 0;
+    for (const FeatMinMaxRecord& _ : featMinMaxRecords)
+    {
+      hb_tag_t feature_tag = _.get_feature_tag ();
+      if (!c->plan->layout_features.has (feature_tag))
+        continue;
+
+      if (!_.subset (c, this)) return false;
+      len++;
+    }
+    return_trace (c->serializer->check_assign (out->featMinMaxRecords.len, len,
+                                               HB_SERIALIZE_ERROR_INT_OVERFLOW));
+  }
+
   bool sanitize (hb_sanitize_context_t *c) const
   {
     TRACE_SANITIZE (this);
@@ -239,6 +367,26 @@ struct BaseValues
     return this+baseCoords[baseline_tag_index];
   }
 
+  void collect_variation_indices (hb_set_t& varidx_set /* OUT */) const
+  {
+    for (const auto& _ : baseCoords)
+      (this+_).collect_variation_indices (varidx_set);
+  }
+
+  bool subset (hb_subset_context_t *c) const
+  {
+    TRACE_SUBSET (this);
+    auto *out = c->serializer->start_embed (*this);
+    if (unlikely (!out || !c->serializer->extend_min (out))) return_trace (false);
+    out->defaultIndex = defaultIndex;
+
+    for (const auto& _ : baseCoords)
+      if (!subset_offset_array (c, out->baseCoords, this) (_))
+        return_trace (false);
+
+    return_trace (bool (out->baseCoords));
+  }
+
   bool sanitize (hb_sanitize_context_t *c) const
   {
     TRACE_SANITIZE (this);
@@ -267,7 +415,22 @@ struct BaseLangSysRecord
 
   bool has_data () const { return baseLangSysTag; }
 
-  const MinMax &get_min_max () const { return this+minMax; }
+  const MinMax &get_min_max (const void* base) const { return base+minMax; }
+
+  void collect_variation_indices (const void* base,
+                                  const hb_subset_plan_t* plan,
+                                  hb_set_t& varidx_set /* OUT */) const
+  { (base+minMax).collect_variation_indices (plan, varidx_set); }
+
+  bool subset (hb_subset_context_t *c,
+               const void *base) const
+  {
+    TRACE_SUBSET (this);
+    auto *out = c->serializer->embed (*this);
+    if (unlikely (!out)) return_trace (false);
+
+    return_trace (out->minMax.serialize_subset (c, minMax, base));
+  }
 
   bool sanitize (hb_sanitize_context_t *c, const void *base) const
   {
@@ -290,14 +453,43 @@ struct BaseScript
   const MinMax &get_min_max (hb_tag_t language_tag) const
   {
     const BaseLangSysRecord& record = baseLangSysRecords.bsearch (language_tag);
-    return record.has_data () ? record.get_min_max () : this+defaultMinMax;
+    return record.has_data () ? record.get_min_max (this) : this+defaultMinMax;
   }
 
   const BaseCoord &get_base_coord (int baseline_tag_index) const
   { return (this+baseValues).get_base_coord (baseline_tag_index); }
 
   bool has_values () const { return baseValues; }
-  bool has_min_max () const { return defaultMinMax; /* TODO What if only per-language is present? */ }
+  bool has_min_max () const { return defaultMinMax || baseLangSysRecords; }
+
+  void collect_variation_indices (const hb_subset_plan_t* plan,
+                                  hb_set_t& varidx_set /* OUT */) const
+  {
+    (this+baseValues).collect_variation_indices (varidx_set);
+    (this+defaultMinMax).collect_variation_indices (plan, varidx_set);
+
+    for (const BaseLangSysRecord& _ : baseLangSysRecords)
+      _.collect_variation_indices (this, plan, varidx_set);
+  }
+
+  bool subset (hb_subset_context_t *c) const
+  {
+    TRACE_SUBSET (this);
+    auto *out = c->serializer->start_embed (*this);
+    if (unlikely (!out || !c->serializer->extend_min (out))) return_trace (false);
+
+    if (baseValues && !out->baseValues.serialize_subset (c, baseValues, this))
+      return_trace (false);
+
+    if (defaultMinMax && !out->defaultMinMax.serialize_subset (c, defaultMinMax, this))
+      return_trace (false);
+
+    for (const auto& _ : baseLangSysRecords)
+      if (!_.subset (c, this)) return_trace (false);
+
+    return_trace (c->serializer->check_assign (out->baseLangSysRecords.len, baseLangSysRecords.len,
+                                               HB_SERIALIZE_ERROR_INT_OVERFLOW));
+  }
 
   bool sanitize (hb_sanitize_context_t *c) const
   {
@@ -331,9 +523,31 @@ struct BaseScriptRecord
 
   bool has_data () const { return baseScriptTag; }
 
+  hb_tag_t get_script_tag () const { return baseScriptTag; }
+
   const BaseScript &get_base_script (const BaseScriptList *list) const
   { return list+baseScript; }
 
+  void collect_variation_indices (const hb_subset_plan_t* plan,
+                                  const void* list,
+                                  hb_set_t& varidx_set /* OUT */) const
+  {
+    if (!plan->layout_scripts.has (baseScriptTag))
+      return;
+
+    (list+baseScript).collect_variation_indices (plan, varidx_set);
+  }
+
+  bool subset (hb_subset_context_t *c,
+               const void *base) const
+  {
+    TRACE_SUBSET (this);
+    auto *out = c->serializer->embed (*this);
+    if (unlikely (!out)) return_trace (false);
+
+    return_trace (out->baseScript.serialize_subset (c, baseScript, base));
+  }
+
   bool sanitize (hb_sanitize_context_t *c, const void *base) const
   {
     TRACE_SANITIZE (this);
@@ -360,6 +574,33 @@ struct BaseScriptList
     return record->has_data () ? record->get_base_script (this) : Null (BaseScript);
   }
 
+  void collect_variation_indices (const hb_subset_plan_t* plan,
+                                  hb_set_t& varidx_set /* OUT */) const
+  {
+    for (const BaseScriptRecord& _ : baseScriptRecords)
+      _.collect_variation_indices (plan, this, varidx_set);
+  }
+
+  bool subset (hb_subset_context_t *c) const
+  {
+    TRACE_SUBSET (this);
+    auto *out = c->serializer->start_embed (*this);
+    if (unlikely (!out || !c->serializer->extend_min (out))) return_trace (false);
+
+    unsigned len = 0;
+    for (const BaseScriptRecord& _ : baseScriptRecords)
+    {
+      hb_tag_t script_tag = _.get_script_tag ();
+      if (!c->plan->layout_scripts.has (script_tag))
+        continue;
+
+      if (!_.subset (c, this)) return false;
+      len++;
+    }
+    return_trace (c->serializer->check_assign (out->baseScriptRecords.len, len,
+                                               HB_SERIALIZE_ERROR_INT_OVERFLOW));
+  }
+
   bool sanitize (hb_sanitize_context_t *c) const
   {
     TRACE_SANITIZE (this);
@@ -421,6 +662,20 @@ struct Axis
     return true;
   }
 
+  void collect_variation_indices (const hb_subset_plan_t* plan,
+                                  hb_set_t& varidx_set /* OUT */) const
+  { (this+baseScriptList).collect_variation_indices (plan, varidx_set); }
+
+  bool subset (hb_subset_context_t *c) const
+  {
+    TRACE_SUBSET (this);
+    auto *out = c->serializer->embed (*this);
+    if (unlikely (!out)) return_trace (false);
+
+    out->baseTagList.serialize_copy (c->serializer, baseTagList, this);
+    return_trace (out->baseScriptList.serialize_subset (c, baseScriptList, this));
+  }
+
   bool sanitize (hb_sanitize_context_t *c) const
   {
     TRACE_SANITIZE (this);
@@ -452,8 +707,77 @@ struct BASE
   const Axis &get_axis (hb_direction_t direction) const
   { return HB_DIRECTION_IS_VERTICAL (direction) ? this+vAxis : this+hAxis; }
 
-  const VariationStore &get_var_store () const
-  { return version.to_int () < 0x00010001u ? Null (VariationStore) : this+varStore; }
+  bool has_var_store () const
+  { return version.to_int () >= 0x00010001u && varStore != 0; }
+
+  const ItemVariationStore &get_var_store () const
+  { return version.to_int () < 0x00010001u ? Null (ItemVariationStore) : this+varStore; }
+
+  void collect_variation_indices (const hb_subset_plan_t* plan,
+                                  hb_set_t& varidx_set /* OUT */) const
+  {
+    (this+hAxis).collect_variation_indices (plan, varidx_set);
+    (this+vAxis).collect_variation_indices (plan, varidx_set);
+  }
+
+  bool subset_varstore (hb_subset_context_t *c,
+                        BASE *out /* OUT */) const
+  {
+    TRACE_SUBSET (this);
+    if (!c->serializer->allocate_size> (Offset32To::static_size))
+        return_trace (false);
+    if (!c->plan->normalized_coords)
+      return_trace (out->varStore.serialize_subset (c, varStore, this, c->plan->base_varstore_inner_maps.as_array ()));
+
+    if (c->plan->all_axes_pinned)
+      return_trace (true);
+
+    item_variations_t item_vars;
+    if (!item_vars.instantiate (this+varStore, c->plan, true, true,
+                                c->plan->base_varstore_inner_maps.as_array ()))
+      return_trace (false);
+
+    if (!out->varStore.serialize_serialize (c->serializer,
+                                            item_vars.has_long_word (),
+                                            c->plan->axis_tags,
+                                            item_vars.get_region_list (),
+                                            item_vars.get_vardata_encodings ()))
+      return_trace (false);
+
+    const hb_map_t &varidx_map = item_vars.get_varidx_map ();
+    /* base_variation_idx_map in the plan is old_varidx->(varidx, delta)
+     * mapping, new varidx is generated for subsetting, we need to remap this
+     * after instancing */
+    for (auto _ : c->plan->base_variation_idx_map.iter_ref ())
+    {
+      uint32_t varidx = _.second.first;
+      uint32_t *new_varidx;
+      if (varidx_map.has (varidx, &new_varidx))
+        _.second.first = *new_varidx;
+      else
+        _.second.first = HB_OT_LAYOUT_NO_VARIATIONS_INDEX;
+    }
+    return_trace (true);
+  }
+
+  bool subset (hb_subset_context_t *c) const
+  {
+    TRACE_SUBSET (this);
+    auto *out = c->serializer->start_embed (*this);
+    if (unlikely (!out || !c->serializer->extend_min (out))) return_trace (false);
+
+    out->version = version;
+    if (has_var_store () && !subset_varstore (c, out))
+        return_trace (false);
+
+    if (hAxis && !out->hAxis.serialize_subset (c, hAxis, this))
+      return_trace (false);
+
+    if (vAxis && !out->vAxis.serialize_subset (c, vAxis, this))
+      return_trace (false);
+
+    return_trace (true);
+  }
 
   bool get_baseline (hb_font_t      *font,
                      hb_tag_t        baseline_tag,
@@ -486,7 +810,7 @@ struct BASE
                                            &min_coord, &max_coord))
       return false;
 
-    const VariationStore &var_store = get_var_store ();
+    const ItemVariationStore &var_store = get_var_store ();
     if (likely (min && min_coord)) *min = min_coord->get_coord (font, var_store, direction);
     if (likely (max && max_coord)) *max = max_coord->get_coord (font, var_store, direction);
     return true;
@@ -496,6 +820,7 @@ struct BASE
   {
     TRACE_SANITIZE (this);
     return_trace (likely (c->check_struct (this) &&
+                          hb_barrier () &&
                           likely (version.major == 1) &&
                           hAxis.sanitize (c, this) &&
                           vAxis.sanitize (c, this) &&
@@ -508,7 +833,7 @@ struct BASE
                                  * of BASE table (may be NULL) */
   Offset16TovAxis;                /* Offset to vertical Axis table, from beginning
                                  * of BASE table (may be NULL) */
-  Offset32To
+  Offset32To
                 varStore;       /* Offset to the table of Item Variation
                                  * Store--from beginning of BASE
                                  * header (may be NULL).  Introduced
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-layout-common.hh b/src/java.desktop/share/native/libharfbuzz/hb-ot-layout-common.hh
index 9216a9a0fe70..f14675295f62 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-ot-layout-common.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-layout-common.hh
@@ -34,6 +34,7 @@
 #include "hb-open-type.hh"
 #include "hb-set.hh"
 #include "hb-bimap.hh"
+#include "hb-cache.hh"
 
 #include "OT/Layout/Common/Coverage.hh"
 #include "OT/Layout/types.hh"
@@ -64,7 +65,7 @@ struct hb_collect_feature_substitutes_with_var_context_t
   const hb_hashmap_t *axes_location;
   hb_hashmap_t> *record_cond_idx_map;
   hb_hashmap_t *feature_substitutes_map;
-  bool& insert_catch_all_feature_variation_record;
+  hb_set_t& catch_all_record_feature_idxes;
 
   // not stored in subset_plan
   hb_set_t *feature_indices;
@@ -142,6 +143,8 @@ struct hb_subset_layout_context_t :
   const hb_map_t *feature_index_map;
   const hb_hashmap_t *feature_substitutes_map;
   hb_hashmap_t> *feature_record_cond_idx_map;
+  const hb_set_t *catch_all_record_feature_idxes;
+  const hb_hashmap_t> *feature_idx_tag_map;
 
   unsigned cur_script_index;
   unsigned cur_feature_var_record_idx;
@@ -164,6 +167,8 @@ struct hb_subset_layout_context_t :
       feature_index_map = &c_->plan->gsub_features;
       feature_substitutes_map = &c_->plan->gsub_feature_substitutes_map;
       feature_record_cond_idx_map = c_->plan->user_axes_location.is_empty () ? nullptr : &c_->plan->gsub_feature_record_cond_idx_map;
+      catch_all_record_feature_idxes = &c_->plan->gsub_old_features;
+      feature_idx_tag_map = &c_->plan->gsub_old_feature_idx_tag_map;
     }
     else
     {
@@ -172,6 +177,8 @@ struct hb_subset_layout_context_t :
       feature_index_map = &c_->plan->gpos_features;
       feature_substitutes_map = &c_->plan->gpos_feature_substitutes_map;
       feature_record_cond_idx_map = c_->plan->user_axes_location.is_empty () ? nullptr : &c_->plan->gpos_feature_record_cond_idx_map;
+      catch_all_record_feature_idxes = &c_->plan->gpos_old_features;
+      feature_idx_tag_map = &c_->plan->gpos_old_feature_idx_tag_map;
     }
   }
 
@@ -182,7 +189,7 @@ struct hb_subset_layout_context_t :
   unsigned lookup_index_count;
 };
 
-struct VariationStore;
+struct ItemVariationStore;
 struct hb_collect_variation_indices_context_t :
        hb_dispatch_context_t
 {
@@ -454,6 +461,7 @@ struct FeatureParamsSize
   {
     TRACE_SANITIZE (this);
     if (unlikely (!c->check_struct (this))) return_trace (false);
+    hb_barrier ();
 
     /* This subtable has some "history", if you will.  Some earlier versions of
      * Adobe tools calculated the offset of the FeatureParams subtable from the
@@ -639,8 +647,7 @@ struct FeatureParamsCharacterVariants
       return;
 
     unsigned last_name_id = (unsigned) firstParamUILabelNameID + (unsigned) numNamedParameters - 1;
-    if (last_name_id >= 256 && last_name_id <= 32767)
-      nameids_to_retain->add_range (firstParamUILabelNameID, last_name_id);
+    nameids_to_retain->add_range (firstParamUILabelNameID, last_name_id);
   }
 
   bool subset (hb_subset_context_t *c) const
@@ -820,6 +827,7 @@ struct Feature
     TRACE_SANITIZE (this);
     if (unlikely (!(c->check_struct (this) && lookupIndex.sanitize (c))))
       return_trace (false);
+    hb_barrier ();
 
     /* Some earlier versions of Adobe tools calculated the offset of the
      * FeatureParams subtable from the beginning of the FeatureList table!
@@ -838,6 +846,7 @@ struct Feature
     unsigned int orig_offset = featureParams;
     if (unlikely (!featureParams.sanitize (c, this, closure ? closure->tag : HB_TAG_NONE)))
       return_trace (false);
+    hb_barrier ();
 
     if (featureParams == 0 && closure &&
         closure->tag == HB_TAG ('s','i','z','e') &&
@@ -900,7 +909,8 @@ struct Record
   {
     TRACE_SANITIZE (this);
     const Record_sanitize_closure_t closure = {tag, base};
-    return_trace (c->check_struct (this) && offset.sanitize (c, base, &closure));
+    return_trace (c->check_struct (this) &&
+                  offset.sanitize (c, base, &closure));
   }
 
   Tag           tag;            /* 4-byte Tag identifier */
@@ -1371,10 +1381,20 @@ struct Lookup
 
     if (lookupFlag & LookupFlag::UseMarkFilteringSet)
     {
-      if (unlikely (!c->serializer->extend (out))) return_trace (false);
       const HBUINT16 &markFilteringSet = StructAfter (subTable);
-      HBUINT16 &outMarkFilteringSet = StructAfter (out->subTable);
-      outMarkFilteringSet = markFilteringSet;
+      hb_codepoint_t *idx;
+      if (!c->plan->used_mark_sets_map.has (markFilteringSet, &idx))
+      {
+        unsigned new_flag = lookupFlag;
+        new_flag &= ~LookupFlag::UseMarkFilteringSet;
+        out->lookupFlag = new_flag;
+      }
+      else
+      {
+        if (unlikely (!c->serializer->extend (out))) return_trace (false);
+        HBUINT16 &outMarkFilteringSet = StructAfter (out->subTable);
+        outMarkFilteringSet = *idx;
+      }
     }
 
     // Always keep the lookup even if it's empty. The rest of layout subsetting depends on lookup
@@ -1391,6 +1411,7 @@ struct Lookup
   {
     TRACE_SANITIZE (this);
     if (!(c->check_struct (this) && subTable.sanitize (c))) return_trace (false);
+    hb_barrier ();
 
     unsigned subtables = get_subtable_count ();
     if (unlikely (!c->visit_subtables (subtables))) return_trace (false);
@@ -1406,6 +1427,8 @@ struct Lookup
 
     if (unlikely (get_type () == TSubTable::Extension && !c->get_edit_count ()))
     {
+      hb_barrier ();
+
       /* The spec says all subtables of an Extension lookup should
        * have the same type, which shall not be the Extension type
        * itself (but we already checked for that).
@@ -2045,24 +2068,33 @@ struct ClassDef
   unsigned int get_class (hb_codepoint_t glyph_id) const
   {
     switch (u.format) {
-    case 1: return u.format1.get_class (glyph_id);
-    case 2: return u.format2.get_class (glyph_id);
+    case 1: hb_barrier (); return u.format1.get_class (glyph_id);
+    case 2: hb_barrier (); return u.format2.get_class (glyph_id);
 #ifndef HB_NO_BEYOND_64K
-    case 3: return u.format3.get_class (glyph_id);
-    case 4: return u.format4.get_class (glyph_id);
+    case 3: hb_barrier (); return u.format3.get_class (glyph_id);
+    case 4: hb_barrier (); return u.format4.get_class (glyph_id);
 #endif
     default:return 0;
     }
   }
+  unsigned int get_class (hb_codepoint_t glyph_id,
+                          hb_ot_lookup_cache_t *cache) const
+  {
+    unsigned klass;
+    if (cache && cache->get (glyph_id, &klass)) return klass;
+    klass = get_class (glyph_id);
+    if (cache) cache->set (glyph_id, klass);
+    return klass;
+  }
 
   unsigned get_population () const
   {
     switch (u.format) {
-    case 1: return u.format1.get_population ();
-    case 2: return u.format2.get_population ();
+    case 1: hb_barrier (); return u.format1.get_population ();
+    case 2: hb_barrier (); return u.format2.get_population ();
 #ifndef HB_NO_BEYOND_64K
-    case 3: return u.format3.get_population ();
-    case 4: return u.format4.get_population ();
+    case 3: hb_barrier (); return u.format3.get_population ();
+    case 4: hb_barrier (); return u.format4.get_population ();
 #endif
     default:return NOT_COVERED;
     }
@@ -2124,11 +2156,11 @@ struct ClassDef
 
     switch (u.format)
     {
-    case 1: return_trace (u.format1.serialize (c, it));
-    case 2: return_trace (u.format2.serialize (c, it));
+    case 1: hb_barrier (); return_trace (u.format1.serialize (c, it));
+    case 2: hb_barrier (); return_trace (u.format2.serialize (c, it));
 #ifndef HB_NO_BEYOND_64K
-    case 3: return_trace (u.format3.serialize (c, it));
-    case 4: return_trace (u.format4.serialize (c, it));
+    case 3: hb_barrier (); return_trace (u.format3.serialize (c, it));
+    case 4: hb_barrier (); return_trace (u.format4.serialize (c, it));
 #endif
     default:return_trace (false);
     }
@@ -2142,11 +2174,11 @@ struct ClassDef
   {
     TRACE_SUBSET (this);
     switch (u.format) {
-    case 1: return_trace (u.format1.subset (c, klass_map, keep_empty_table, use_class_zero, glyph_filter));
-    case 2: return_trace (u.format2.subset (c, klass_map, keep_empty_table, use_class_zero, glyph_filter));
+    case 1: hb_barrier (); return_trace (u.format1.subset (c, klass_map, keep_empty_table, use_class_zero, glyph_filter));
+    case 2: hb_barrier (); return_trace (u.format2.subset (c, klass_map, keep_empty_table, use_class_zero, glyph_filter));
 #ifndef HB_NO_BEYOND_64K
-    case 3: return_trace (u.format3.subset (c, klass_map, keep_empty_table, use_class_zero, glyph_filter));
-    case 4: return_trace (u.format4.subset (c, klass_map, keep_empty_table, use_class_zero, glyph_filter));
+    case 3: hb_barrier (); return_trace (u.format3.subset (c, klass_map, keep_empty_table, use_class_zero, glyph_filter));
+    case 4: hb_barrier (); return_trace (u.format4.subset (c, klass_map, keep_empty_table, use_class_zero, glyph_filter));
 #endif
     default:return_trace (false);
     }
@@ -2156,12 +2188,13 @@ struct ClassDef
   {
     TRACE_SANITIZE (this);
     if (!u.format.sanitize (c)) return_trace (false);
+    hb_barrier ();
     switch (u.format) {
-    case 1: return_trace (u.format1.sanitize (c));
-    case 2: return_trace (u.format2.sanitize (c));
+    case 1: hb_barrier (); return_trace (u.format1.sanitize (c));
+    case 2: hb_barrier (); return_trace (u.format2.sanitize (c));
 #ifndef HB_NO_BEYOND_64K
-    case 3: return_trace (u.format3.sanitize (c));
-    case 4: return_trace (u.format4.sanitize (c));
+    case 3: hb_barrier (); return_trace (u.format3.sanitize (c));
+    case 4: hb_barrier (); return_trace (u.format4.sanitize (c));
 #endif
     default:return_trace (true);
     }
@@ -2170,11 +2203,11 @@ struct ClassDef
   unsigned cost () const
   {
     switch (u.format) {
-    case 1: return u.format1.cost ();
-    case 2: return u.format2.cost ();
+    case 1: hb_barrier (); return u.format1.cost ();
+    case 2: hb_barrier (); return u.format2.cost ();
 #ifndef HB_NO_BEYOND_64K
-    case 3: return u.format3.cost ();
-    case 4: return u.format4.cost ();
+    case 3: hb_barrier (); return u.format3.cost ();
+    case 4: hb_barrier (); return u.format4.cost ();
 #endif
     default:return 0u;
     }
@@ -2186,11 +2219,11 @@ struct ClassDef
   bool collect_coverage (set_t *glyphs) const
   {
     switch (u.format) {
-    case 1: return u.format1.collect_coverage (glyphs);
-    case 2: return u.format2.collect_coverage (glyphs);
+    case 1: hb_barrier (); return u.format1.collect_coverage (glyphs);
+    case 2: hb_barrier (); return u.format2.collect_coverage (glyphs);
 #ifndef HB_NO_BEYOND_64K
-    case 3: return u.format3.collect_coverage (glyphs);
-    case 4: return u.format4.collect_coverage (glyphs);
+    case 3: hb_barrier (); return u.format3.collect_coverage (glyphs);
+    case 4: hb_barrier (); return u.format4.collect_coverage (glyphs);
 #endif
     default:return false;
     }
@@ -2202,11 +2235,11 @@ struct ClassDef
   bool collect_class (set_t *glyphs, unsigned int klass) const
   {
     switch (u.format) {
-    case 1: return u.format1.collect_class (glyphs, klass);
-    case 2: return u.format2.collect_class (glyphs, klass);
+    case 1: hb_barrier (); return u.format1.collect_class (glyphs, klass);
+    case 2: hb_barrier (); return u.format2.collect_class (glyphs, klass);
 #ifndef HB_NO_BEYOND_64K
-    case 3: return u.format3.collect_class (glyphs, klass);
-    case 4: return u.format4.collect_class (glyphs, klass);
+    case 3: hb_barrier (); return u.format3.collect_class (glyphs, klass);
+    case 4: hb_barrier (); return u.format4.collect_class (glyphs, klass);
 #endif
     default:return false;
     }
@@ -2215,11 +2248,11 @@ struct ClassDef
   bool intersects (const hb_set_t *glyphs) const
   {
     switch (u.format) {
-    case 1: return u.format1.intersects (glyphs);
-    case 2: return u.format2.intersects (glyphs);
+    case 1: hb_barrier (); return u.format1.intersects (glyphs);
+    case 2: hb_barrier (); return u.format2.intersects (glyphs);
 #ifndef HB_NO_BEYOND_64K
-    case 3: return u.format3.intersects (glyphs);
-    case 4: return u.format4.intersects (glyphs);
+    case 3: hb_barrier (); return u.format3.intersects (glyphs);
+    case 4: hb_barrier (); return u.format4.intersects (glyphs);
 #endif
     default:return false;
     }
@@ -2227,11 +2260,11 @@ struct ClassDef
   bool intersects_class (const hb_set_t *glyphs, unsigned int klass) const
   {
     switch (u.format) {
-    case 1: return u.format1.intersects_class (glyphs, klass);
-    case 2: return u.format2.intersects_class (glyphs, klass);
+    case 1: hb_barrier (); return u.format1.intersects_class (glyphs, klass);
+    case 2: hb_barrier (); return u.format2.intersects_class (glyphs, klass);
 #ifndef HB_NO_BEYOND_64K
-    case 3: return u.format3.intersects_class (glyphs, klass);
-    case 4: return u.format4.intersects_class (glyphs, klass);
+    case 3: hb_barrier (); return u.format3.intersects_class (glyphs, klass);
+    case 4: hb_barrier (); return u.format4.intersects_class (glyphs, klass);
 #endif
     default:return false;
     }
@@ -2240,11 +2273,11 @@ struct ClassDef
   void intersected_class_glyphs (const hb_set_t *glyphs, unsigned klass, hb_set_t *intersect_glyphs) const
   {
     switch (u.format) {
-    case 1: return u.format1.intersected_class_glyphs (glyphs, klass, intersect_glyphs);
-    case 2: return u.format2.intersected_class_glyphs (glyphs, klass, intersect_glyphs);
+    case 1: hb_barrier (); return u.format1.intersected_class_glyphs (glyphs, klass, intersect_glyphs);
+    case 2: hb_barrier (); return u.format2.intersected_class_glyphs (glyphs, klass, intersect_glyphs);
 #ifndef HB_NO_BEYOND_64K
-    case 3: return u.format3.intersected_class_glyphs (glyphs, klass, intersect_glyphs);
-    case 4: return u.format4.intersected_class_glyphs (glyphs, klass, intersect_glyphs);
+    case 3: hb_barrier (); return u.format3.intersected_class_glyphs (glyphs, klass, intersect_glyphs);
+    case 4: hb_barrier (); return u.format4.intersected_class_glyphs (glyphs, klass, intersect_glyphs);
 #endif
     default:return;
     }
@@ -2253,11 +2286,11 @@ struct ClassDef
   void intersected_classes (const hb_set_t *glyphs, hb_set_t *intersect_classes) const
   {
     switch (u.format) {
-    case 1: return u.format1.intersected_classes (glyphs, intersect_classes);
-    case 2: return u.format2.intersected_classes (glyphs, intersect_classes);
+    case 1: hb_barrier (); return u.format1.intersected_classes (glyphs, intersect_classes);
+    case 2: hb_barrier (); return u.format2.intersected_classes (glyphs, intersect_classes);
 #ifndef HB_NO_BEYOND_64K
-    case 3: return u.format3.intersected_classes (glyphs, intersect_classes);
-    case 4: return u.format4.intersected_classes (glyphs, intersect_classes);
+    case 3: hb_barrier (); return u.format3.intersected_classes (glyphs, intersect_classes);
+    case 4: hb_barrier (); return u.format4.intersected_classes (glyphs, intersect_classes);
 #endif
     default:return;
     }
@@ -2447,6 +2480,8 @@ struct VarRegionAxis
     int peak = peakCoord.to_int ();
     if (peak == 0 || coord == peak)
       return 1.f;
+    else if (coord == 0) // Faster
+      return 0.f;
 
     int start = startCoord.to_int (), end = endCoord.to_int ();
 
@@ -2470,8 +2505,6 @@ struct VarRegionAxis
   {
     TRACE_SANITIZE (this);
     return_trace (c->check_struct (this));
-    /* TODO Handle invalid start/peak/end configs, so we don't
-     * have to do that at runtime. */
   }
 
   bool serialize (hb_serialize_context_t *c) const
@@ -2487,6 +2520,33 @@ struct VarRegionAxis
   public:
   DEFINE_SIZE_STATIC (6);
 };
+struct SparseVarRegionAxis
+{
+  float evaluate (const int *coords, unsigned int coord_len) const
+  {
+    unsigned i = axisIndex;
+    int coord = i < coord_len ? coords[i] : 0;
+    return axis.evaluate (coord);
+  }
+
+  bool sanitize (hb_sanitize_context_t *c) const
+  {
+    TRACE_SANITIZE (this);
+    return_trace (c->check_struct (this));
+  }
+
+  bool serialize (hb_serialize_context_t *c) const
+  {
+    TRACE_SERIALIZE (this);
+    return_trace (c->embed (this));
+  }
+
+  public:
+  HBUINT16 axisIndex;
+  VarRegionAxis axis;
+  public:
+  DEFINE_SIZE_STATIC (8);
+};
 
 #define REGION_CACHE_ITEM_CACHE_INVALID 2.f
 
@@ -2534,7 +2594,9 @@ struct VarRegionList
   bool sanitize (hb_sanitize_context_t *c) const
   {
     TRACE_SANITIZE (this);
-    return_trace (c->check_struct (this) && axesZ.sanitize (c, axisCount * regionCount));
+    return_trace (c->check_struct (this) &&
+                  hb_barrier () &&
+                  axesZ.sanitize (c, axisCount * regionCount));
   }
 
   bool serialize (hb_serialize_context_t *c,
@@ -2615,7 +2677,7 @@ struct VarRegionList
       float max_val = axis_region->endCoord.to_float ();
 
       if (def_val != 0.f)
-        axis_tuples.set (*axis_tag, Triple (min_val, def_val, max_val));
+        axis_tuples.set (*axis_tag, Triple ((double) min_val, (double) def_val, (double) max_val));
       axis_region++;
     }
     return !axis_tuples.in_error ();
@@ -2649,6 +2711,65 @@ struct VarRegionList
   DEFINE_SIZE_ARRAY (4, axesZ);
 };
 
+struct SparseVariationRegion : Array16Of
+{
+  float evaluate (const int *coords, unsigned int coord_len) const
+  {
+    float v = 1.f;
+    unsigned int count = len;
+    for (unsigned int i = 0; i < count; i++)
+    {
+      float factor = arrayZ[i].evaluate (coords, coord_len);
+      if (factor == 0.f)
+        return 0.;
+      v *= factor;
+    }
+    return v;
+  }
+};
+
+struct SparseVarRegionList
+{
+  using cache_t = float;
+
+  float evaluate (unsigned int region_index,
+                  const int *coords, unsigned int coord_len,
+                  cache_t *cache = nullptr) const
+  {
+    if (unlikely (region_index >= regions.len))
+      return 0.;
+
+    float *cached_value = nullptr;
+    if (cache)
+    {
+      cached_value = &(cache[region_index]);
+      if (likely (*cached_value != REGION_CACHE_ITEM_CACHE_INVALID))
+        return *cached_value;
+    }
+
+    const SparseVariationRegion ®ion = this+regions[region_index];
+
+    float v = region.evaluate (coords, coord_len);
+
+    if (cache)
+      *cached_value = v;
+    return v;
+  }
+
+  bool sanitize (hb_sanitize_context_t *c) const
+  {
+    TRACE_SANITIZE (this);
+    return_trace (regions.sanitize (c, this));
+  }
+
+  public:
+  Array16Of>
+                regions;
+  public:
+  DEFINE_SIZE_ARRAY (2, regions);
+};
+
+
 struct VarData
 {
   unsigned int get_item_count () const
@@ -2728,6 +2849,7 @@ struct VarData
     TRACE_SANITIZE (this);
     return_trace (c->check_struct (this) &&
                   regionIndices.sanitize (c) &&
+                  hb_barrier () &&
                   wordCount () <= regionIndices.len &&
                   c->check_range (get_delta_bytes (),
                                   itemCount,
@@ -3009,7 +3131,53 @@ struct VarData
   DEFINE_SIZE_ARRAY (6, regionIndices);
 };
 
-struct VariationStore
+struct MultiVarData
+{
+  unsigned int get_size () const
+  { return min_size
+         - regionIndices.min_size + regionIndices.get_size ()
+         + StructAfter (regionIndices).get_size ();
+  }
+
+  void get_delta (unsigned int inner,
+                  const int *coords, unsigned int coord_count,
+                  const SparseVarRegionList ®ions,
+                  hb_array_t out,
+                  SparseVarRegionList::cache_t *cache = nullptr) const
+  {
+    auto &deltaSets = StructAfter (regionIndices);
+
+    auto values_iter = deltaSets.fetcher (inner);
+    unsigned regionCount = regionIndices.len;
+    for (unsigned regionIndex = 0; regionIndex < regionCount; regionIndex++)
+    {
+      float scalar = regions.evaluate (regionIndices.arrayZ[regionIndex],
+                                       coords, coord_count,
+                                       cache);
+      values_iter.add_to (out, scalar);
+    }
+  }
+
+  bool sanitize (hb_sanitize_context_t *c) const
+  {
+    TRACE_SANITIZE (this);
+    return_trace (format.sanitize (c) &&
+                  hb_barrier () &&
+                  format == 1 &&
+                  regionIndices.sanitize (c) &&
+                  hb_barrier () &&
+                  StructAfter (regionIndices).sanitize (c));
+  }
+
+  protected:
+  HBUINT8             format; // 1
+  Array16Of regionIndices;
+  TupleList           deltaSetsX;
+  public:
+  DEFINE_SIZE_MIN (8);
+};
+
+struct ItemVariationStore
 {
   friend struct item_variations_t;
   using cache_t = VarRegionList::cache_t;
@@ -3061,7 +3229,7 @@ struct VariationStore
     return get_delta (outer, inner, coords, coord_count, cache);
   }
   float get_delta (unsigned int index,
-                   hb_array_t coords,
+                   hb_array_t coords,
                    VarRegionList::cache_t *cache = nullptr) const
   {
     return get_delta (index,
@@ -3077,6 +3245,7 @@ struct VariationStore
 
     TRACE_SANITIZE (this);
     return_trace (c->check_struct (this) &&
+                  hb_barrier () &&
                   format == 1 &&
                   regions.sanitize (c, this) &&
                   dataSets.sanitize (c, this));
@@ -3113,7 +3282,7 @@ struct VariationStore
   }
 
   bool serialize (hb_serialize_context_t *c,
-                  const VariationStore *src,
+                  const ItemVariationStore *src,
                   const hb_array_t  &inner_maps)
   {
     TRACE_SERIALIZE (this);
@@ -3169,7 +3338,7 @@ struct VariationStore
     return_trace (true);
   }
 
-  VariationStore *copy (hb_serialize_context_t *c) const
+  ItemVariationStore *copy (hb_serialize_context_t *c) const
   {
     TRACE_SERIALIZE (this);
     auto *out = c->start_embed (this);
@@ -3180,6 +3349,8 @@ struct VariationStore
     for (unsigned i = 0; i < count; i++)
     {
       hb_inc_bimap_t *map = inner_maps.push ();
+      if (!c->propagate_error(inner_maps))
+        return_trace(nullptr);
       auto &data = this+dataSets[i];
 
       unsigned itemCount = data.get_item_count ();
@@ -3199,7 +3370,7 @@ struct VariationStore
     return_trace (false);
 #endif
 
-    VariationStore *varstore_prime = c->serializer->start_embed ();
+    ItemVariationStore *varstore_prime = c->serializer->start_embed ();
     if (unlikely (!varstore_prime)) return_trace (false);
 
     varstore_prime->serialize (c->serializer, this, inner_maps);
@@ -3265,8 +3436,370 @@ struct VariationStore
   DEFINE_SIZE_ARRAY_SIZED (8, dataSets);
 };
 
+struct MultiItemVariationStore
+{
+  using cache_t = SparseVarRegionList::cache_t;
+
+  cache_t *create_cache (hb_array_t static_cache = hb_array_t ()) const
+  {
+#ifdef HB_NO_VAR
+    return nullptr;
+#endif
+    auto &r = this+regions;
+    unsigned count = r.regions.len;
+
+    float *cache;
+    if (count <= static_cache.length)
+      cache = static_cache.arrayZ;
+    else
+    {
+      cache = (float *) hb_malloc (sizeof (float) * count);
+      if (unlikely (!cache)) return nullptr;
+    }
+
+    for (unsigned i = 0; i < count; i++)
+      cache[i] = REGION_CACHE_ITEM_CACHE_INVALID;
+
+    return cache;
+  }
+
+  static void destroy_cache (cache_t *cache,
+                             hb_array_t static_cache = hb_array_t ())
+  {
+    if (cache != static_cache.arrayZ)
+      hb_free (cache);
+  }
+
+  private:
+  void get_delta (unsigned int outer, unsigned int inner,
+                  const int *coords, unsigned int coord_count,
+                  hb_array_t out,
+                  VarRegionList::cache_t *cache = nullptr) const
+  {
+#ifdef HB_NO_VAR
+    return;
+#endif
+
+    if (unlikely (outer >= dataSets.len))
+      return;
+
+    return (this+dataSets[outer]).get_delta (inner,
+                                             coords, coord_count,
+                                             this+regions,
+                                             out,
+                                             cache);
+  }
+
+  public:
+  void get_delta (unsigned int index,
+                  const int *coords, unsigned int coord_count,
+                  hb_array_t out,
+                  VarRegionList::cache_t *cache = nullptr) const
+  {
+    unsigned int outer = index >> 16;
+    unsigned int inner = index & 0xFFFF;
+    get_delta (outer, inner, coords, coord_count, out, cache);
+  }
+  void get_delta (unsigned int index,
+                  hb_array_t coords,
+                  hb_array_t out,
+                  VarRegionList::cache_t *cache = nullptr) const
+  {
+    return get_delta (index,
+                      coords.arrayZ, coords.length,
+                      out,
+                      cache);
+  }
+
+  bool sanitize (hb_sanitize_context_t *c) const
+  {
+#ifdef HB_NO_VAR
+    return true;
+#endif
+
+    TRACE_SANITIZE (this);
+    return_trace (c->check_struct (this) &&
+                  hb_barrier () &&
+                  format == 1 &&
+                  regions.sanitize (c, this) &&
+                  dataSets.sanitize (c, this));
+  }
+
+  protected:
+  HBUINT16                              format; // 1
+  Offset32To       regions;
+  Array16OfOffset32To     dataSets;
+  public:
+  DEFINE_SIZE_ARRAY_SIZED (8, dataSets);
+};
+
 #undef REGION_CACHE_ITEM_CACHE_INVALID
 
+template 
+struct DeltaSetIndexMapFormat01
+{
+  friend struct DeltaSetIndexMap;
+
+  unsigned get_size () const
+  { return min_size + mapCount * get_width (); }
+
+  private:
+  DeltaSetIndexMapFormat01* copy (hb_serialize_context_t *c) const
+  {
+    TRACE_SERIALIZE (this);
+    return_trace (c->embed (this));
+  }
+
+  template 
+  bool serialize (hb_serialize_context_t *c, const T &plan)
+  {
+    unsigned int width = plan.get_width ();
+    unsigned int inner_bit_count = plan.get_inner_bit_count ();
+    const hb_array_t output_map = plan.get_output_map ();
+
+    TRACE_SERIALIZE (this);
+    if (unlikely (output_map.length && ((((inner_bit_count-1)&~0xF)!=0) || (((width-1)&~0x3)!=0))))
+      return_trace (false);
+    if (unlikely (!c->extend_min (this))) return_trace (false);
+
+    entryFormat = ((width-1)<<4)|(inner_bit_count-1);
+    mapCount = output_map.length;
+    HBUINT8 *p = c->allocate_size (width * output_map.length);
+    if (unlikely (!p)) return_trace (false);
+    for (unsigned int i = 0; i < output_map.length; i++)
+    {
+      unsigned int v = output_map.arrayZ[i];
+      if (v)
+      {
+        unsigned int outer = v >> 16;
+        unsigned int inner = v & 0xFFFF;
+        unsigned int u = (outer << inner_bit_count) | inner;
+        for (unsigned int w = width; w > 0;)
+        {
+          p[--w] = u;
+          u >>= 8;
+        }
+      }
+      p += width;
+    }
+    return_trace (true);
+  }
+
+  uint32_t map (unsigned int v) const /* Returns 16.16 outer.inner. */
+  {
+    /* If count is zero, pass value unchanged.  This takes
+     * care of direct mapping for advance map. */
+    if (!mapCount)
+      return v;
+
+    if (v >= mapCount)
+      v = mapCount - 1;
+
+    unsigned int u = 0;
+    { /* Fetch it. */
+      unsigned int w = get_width ();
+      const HBUINT8 *p = mapDataZ.arrayZ + w * v;
+      for (; w; w--)
+        u = (u << 8) + *p++;
+    }
+
+    { /* Repack it. */
+      unsigned int n = get_inner_bit_count ();
+      unsigned int outer = u >> n;
+      unsigned int inner = u & ((1 << n) - 1);
+      u = (outer<<16) | inner;
+    }
+
+    return u;
+  }
+
+  unsigned get_map_count () const       { return mapCount; }
+  unsigned get_width () const           { return ((entryFormat >> 4) & 3) + 1; }
+  unsigned get_inner_bit_count () const { return (entryFormat & 0xF) + 1; }
+
+
+  bool sanitize (hb_sanitize_context_t *c) const
+  {
+    TRACE_SANITIZE (this);
+    return_trace (c->check_struct (this) &&
+                  hb_barrier () &&
+                  c->check_range (mapDataZ.arrayZ,
+                                  mapCount,
+                                  get_width ()));
+  }
+
+  protected:
+  HBUINT8       format;         /* Format identifier--format = 0 */
+  HBUINT8       entryFormat;    /* A packed field that describes the compressed
+                                 * representation of delta-set indices. */
+  MapCountT     mapCount;       /* The number of mapping entries. */
+  UnsizedArrayOf
+                mapDataZ;       /* The delta-set index mapping data. */
+
+  public:
+  DEFINE_SIZE_ARRAY (2+MapCountT::static_size, mapDataZ);
+};
+
+struct DeltaSetIndexMap
+{
+  template 
+  bool serialize (hb_serialize_context_t *c, const T &plan)
+  {
+    TRACE_SERIALIZE (this);
+    unsigned length = plan.get_output_map ().length;
+    u.format = length <= 0xFFFF ? 0 : 1;
+    switch (u.format) {
+    case 0: hb_barrier (); return_trace (u.format0.serialize (c, plan));
+    case 1: hb_barrier (); return_trace (u.format1.serialize (c, plan));
+    default:return_trace (false);
+    }
+  }
+
+  uint32_t map (unsigned v) const
+  {
+    switch (u.format) {
+    case 0: hb_barrier (); return (u.format0.map (v));
+    case 1: hb_barrier (); return (u.format1.map (v));
+    default:return v;
+    }
+  }
+
+  unsigned get_map_count () const
+  {
+    switch (u.format) {
+    case 0: hb_barrier (); return u.format0.get_map_count ();
+    case 1: hb_barrier (); return u.format1.get_map_count ();
+    default:return 0;
+    }
+  }
+
+  unsigned get_width () const
+  {
+    switch (u.format) {
+    case 0: hb_barrier (); return u.format0.get_width ();
+    case 1: hb_barrier (); return u.format1.get_width ();
+    default:return 0;
+    }
+  }
+
+  unsigned get_inner_bit_count () const
+  {
+    switch (u.format) {
+    case 0: hb_barrier (); return u.format0.get_inner_bit_count ();
+    case 1: hb_barrier (); return u.format1.get_inner_bit_count ();
+    default:return 0;
+    }
+  }
+
+  bool sanitize (hb_sanitize_context_t *c) const
+  {
+    TRACE_SANITIZE (this);
+    if (!u.format.sanitize (c)) return_trace (false);
+    hb_barrier ();
+    switch (u.format) {
+    case 0: hb_barrier (); return_trace (u.format0.sanitize (c));
+    case 1: hb_barrier (); return_trace (u.format1.sanitize (c));
+    default:return_trace (true);
+    }
+  }
+
+  DeltaSetIndexMap* copy (hb_serialize_context_t *c) const
+  {
+    TRACE_SERIALIZE (this);
+    switch (u.format) {
+    case 0: hb_barrier (); return_trace (reinterpret_cast (u.format0.copy (c)));
+    case 1: hb_barrier (); return_trace (reinterpret_cast (u.format1.copy (c)));
+    default:return_trace (nullptr);
+    }
+  }
+
+  protected:
+  union {
+  HBUINT8                            format;         /* Format identifier */
+  DeltaSetIndexMapFormat01 format0;
+  DeltaSetIndexMapFormat01 format1;
+  } u;
+  public:
+  DEFINE_SIZE_UNION (1, format);
+};
+
+
+struct ItemVarStoreInstancer
+{
+  ItemVarStoreInstancer (const ItemVariationStore *varStore_,
+                         const DeltaSetIndexMap *varIdxMap,
+                         hb_array_t coords,
+                         VarRegionList::cache_t *cache = nullptr) :
+    varStore (varStore_), varIdxMap (varIdxMap), coords (coords), cache (cache)
+  {
+    if (!varStore)
+      varStore = &Null(ItemVariationStore);
+  }
+
+  operator bool () const { return varStore && bool (coords); }
+
+  float operator[] (uint32_t varIdx) const
+  { return (*this) (varIdx); }
+
+  float operator() (uint32_t varIdx, unsigned short offset = 0) const
+  {
+   if (!coords || varIdx == VarIdx::NO_VARIATION)
+     return 0.f;
+
+    varIdx += offset;
+    if (varIdxMap)
+      varIdx = varIdxMap->map (varIdx);
+    return varStore->get_delta (varIdx, coords, cache);
+  }
+
+  const ItemVariationStore *varStore;
+  const DeltaSetIndexMap *varIdxMap;
+  hb_array_t coords;
+  VarRegionList::cache_t *cache;
+};
+
+struct MultiItemVarStoreInstancer
+{
+  MultiItemVarStoreInstancer (const MultiItemVariationStore *varStore,
+                              const DeltaSetIndexMap *varIdxMap,
+                              hb_array_t coords,
+                              SparseVarRegionList::cache_t *cache = nullptr) :
+    varStore (varStore), varIdxMap (varIdxMap), coords (coords), cache (cache)
+  {
+    if (!varStore)
+      varStore = &Null(MultiItemVariationStore);
+  }
+
+  operator bool () const { return varStore && bool (coords); }
+
+  float operator[] (uint32_t varIdx) const
+  {
+    float v = 0;
+    (*this) (hb_array (&v, 1), varIdx);
+    return v;
+  }
+
+  void operator() (hb_array_t out, uint32_t varIdx, unsigned short offset = 0) const
+  {
+    if (coords && varIdx != VarIdx::NO_VARIATION)
+    {
+      varIdx += offset;
+      if (varIdxMap)
+        varIdx = varIdxMap->map (varIdx);
+      varStore->get_delta (varIdx, coords, out, cache);
+    }
+    else
+      for (unsigned i = 0; i < out.length; i++)
+        out.arrayZ[i] = 0.f;
+  }
+
+  const MultiItemVariationStore *varStore;
+  const DeltaSetIndexMap *varIdxMap;
+  hb_array_t coords;
+  SparseVarRegionList::cache_t *cache;
+};
+
+
 /*
  * Feature Variations
  */
@@ -3278,7 +3811,16 @@ enum Cond_with_Var_flag_t
   DROP_RECORD_WITH_VAR = 3,
 };
 
-struct ConditionFormat1
+struct Condition;
+
+template 
+static bool
+_hb_recurse_condition_evaluate (const struct Condition &condition,
+                                const int *coords,
+                                unsigned int coord_len,
+                                Instancer *instancer);
+
+struct ConditionAxisRange
 {
   friend struct Condition;
 
@@ -3298,19 +3840,19 @@ struct ConditionFormat1
       return_trace (false);
 
     const hb_hashmap_t& normalized_axes_location = c->plan->axes_location;
-    Triple axis_limit{-1.f, 0.f, 1.f};
+    Triple axis_limit{-1.0, 0.0, 1.0};
     Triple *normalized_limit;
     if (normalized_axes_location.has (*axis_tag, &normalized_limit))
       axis_limit = *normalized_limit;
 
     const hb_hashmap_t& axes_triple_distances = c->plan->axes_triple_distances;
-    TripleDistances axis_triple_distances{1.f, 1.f};
+    TripleDistances axis_triple_distances{1.0, 1.0};
     TripleDistances *triple_dists;
     if (axes_triple_distances.has (*axis_tag, &triple_dists))
       axis_triple_distances = *triple_dists;
 
-    float normalized_min = renormalizeValue (filterRangeMinValue.to_float (), axis_limit, axis_triple_distances, false);
-    float normalized_max = renormalizeValue (filterRangeMaxValue.to_float (), axis_limit, axis_triple_distances, false);
+    float normalized_min = renormalizeValue ((double) filterRangeMinValue.to_float (), axis_limit, axis_triple_distances, false);
+    float normalized_max = renormalizeValue ((double) filterRangeMaxValue.to_float (), axis_limit, axis_triple_distances, false);
     out->filterRangeMinValue.set_float (normalized_min);
     out->filterRangeMaxValue.set_float (normalized_max);
 
@@ -3328,10 +3870,14 @@ struct ConditionFormat1
 
     hb_tag_t axis_tag = c->axes_index_tag_map->get (axisIndex);
 
-    Triple axis_range (-1.f, 0.f, 1.f);
+    Triple axis_range (-1.0, 0.0, 1.0);
     Triple *axis_limit;
+    bool axis_set_by_user = false;
     if (c->axes_location->has (axis_tag, &axis_limit))
+    {
       axis_range = *axis_limit;
+      axis_set_by_user = true;
+    }
 
     float axis_min_val = axis_range.minimum;
     float axis_default_val = axis_range.middle;
@@ -3350,26 +3896,26 @@ struct ConditionFormat1
       return DROP_RECORD_WITH_VAR;
 
     //condition met and axis pinned, drop the condition
-    if (c->axes_location->has (axis_tag) &&
-        c->axes_location->get (axis_tag).is_point ())
+    if (axis_set_by_user && axis_range.is_point ())
       return DROP_COND_WITH_VAR;
 
     if (filter_max_val != axis_max_val || filter_min_val != axis_min_val)
     {
       // add axisIndex->value into the hashmap so we can check if the record is
       // unique with variations
-      int16_t int_filter_max_val = filterRangeMaxValue.to_int ();
-      int16_t int_filter_min_val = filterRangeMinValue.to_int ();
+      uint16_t int_filter_max_val = (uint16_t) filterRangeMaxValue.to_int ();
+      uint16_t int_filter_min_val = (uint16_t) filterRangeMinValue.to_int ();
       hb_codepoint_t val = (int_filter_max_val << 16) + int_filter_min_val;
 
       condition_map->set (axisIndex, val);
       return KEEP_COND_WITH_VAR;
     }
-
     return KEEP_RECORD_WITH_VAR;
   }
 
-  bool evaluate (const int *coords, unsigned int coord_len) const
+  template 
+  bool evaluate (const int *coords, unsigned int coord_len,
+                 Instancer *instancer HB_UNUSED) const
   {
     int coord = axisIndex < coord_len ? coords[axisIndex] : 0;
     return filterRangeMinValue.to_int () <= coord && coord <= filterRangeMaxValue.to_int ();
@@ -3390,12 +3936,199 @@ struct ConditionFormat1
   DEFINE_SIZE_STATIC (8);
 };
 
+struct ConditionValue
+{
+  friend struct Condition;
+
+  bool subset (hb_subset_context_t *c) const
+  {
+    TRACE_SUBSET (this);
+    // TODO(subset)
+    return_trace (false);
+  }
+
+  private:
+  template 
+  bool evaluate (const int *coords, unsigned int coord_len,
+                 Instancer *instancer) const
+  {
+    signed value = defaultValue;
+    value += (*instancer)[varIdx];
+    return value > 0;
+  }
+
+  bool subset (hb_subset_context_t *c,
+               hb_subset_layout_context_t *l,
+               bool insert_catch_all) const
+  {
+    TRACE_SUBSET (this);
+    // TODO(subset)
+    return_trace (false);
+  }
+
+  bool sanitize (hb_sanitize_context_t *c) const
+  {
+    TRACE_SANITIZE (this);
+    return_trace (c->check_struct (this));
+  }
+
+  protected:
+  HBUINT16      format;         /* Format identifier--format = 2 */
+  HBINT16       defaultValue;   /* Value at default instance. */
+  VarIdx        varIdx;         /* Variation index */
+  public:
+  DEFINE_SIZE_STATIC (8);
+};
+
+struct ConditionAnd
+{
+  friend struct Condition;
+
+  bool subset (hb_subset_context_t *c) const
+  {
+    TRACE_SUBSET (this);
+    // TODO(subset)
+    return_trace (false);
+  }
+
+  private:
+  template 
+  bool evaluate (const int *coords, unsigned int coord_len,
+                 Instancer *instancer) const
+  {
+    unsigned int count = conditions.len;
+    for (unsigned int i = 0; i < count; i++)
+      if (!_hb_recurse_condition_evaluate (this+conditions.arrayZ[i],
+                                           coords, coord_len,
+                                           instancer))
+        return false;
+    return true;
+  }
+
+  bool subset (hb_subset_context_t *c,
+               hb_subset_layout_context_t *l,
+               bool insert_catch_all) const
+  {
+    TRACE_SUBSET (this);
+    // TODO(subset)
+    return_trace (false);
+  }
+
+  bool sanitize (hb_sanitize_context_t *c) const
+  {
+    TRACE_SANITIZE (this);
+    return_trace (conditions.sanitize (c, this));
+  }
+
+  protected:
+  HBUINT16      format;         /* Format identifier--format = 3 */
+  Array8OfOffset24To  conditions;
+  public:
+  DEFINE_SIZE_ARRAY (3, conditions);
+};
+
+struct ConditionOr
+{
+  friend struct Condition;
+
+  bool subset (hb_subset_context_t *c) const
+  {
+    TRACE_SUBSET (this);
+    // TODO(subset)
+    return_trace (false);
+  }
+
+  private:
+  template 
+  bool evaluate (const int *coords, unsigned int coord_len,
+                 Instancer *instancer) const
+  {
+    unsigned int count = conditions.len;
+    for (unsigned int i = 0; i < count; i++)
+      if (_hb_recurse_condition_evaluate (this+conditions.arrayZ[i],
+                                          coords, coord_len,
+                                          instancer))
+        return true;
+    return false;
+  }
+
+  bool subset (hb_subset_context_t *c,
+               hb_subset_layout_context_t *l,
+               bool insert_catch_all) const
+  {
+    TRACE_SUBSET (this);
+    // TODO(subset)
+    return_trace (false);
+  }
+
+  bool sanitize (hb_sanitize_context_t *c) const
+  {
+    TRACE_SANITIZE (this);
+    return_trace (conditions.sanitize (c, this));
+  }
+
+  protected:
+  HBUINT16      format;         /* Format identifier--format = 4 */
+  Array8OfOffset24To  conditions;
+  public:
+  DEFINE_SIZE_ARRAY (3, conditions);
+};
+
+struct ConditionNegate
+{
+  friend struct Condition;
+
+  bool subset (hb_subset_context_t *c) const
+  {
+    TRACE_SUBSET (this);
+    // TODO(subset)
+    return_trace (false);
+  }
+
+  private:
+  template 
+  bool evaluate (const int *coords, unsigned int coord_len,
+                 Instancer *instancer) const
+  {
+    return !_hb_recurse_condition_evaluate (this+condition,
+                                            coords, coord_len,
+                                            instancer);
+  }
+
+  bool subset (hb_subset_context_t *c,
+               hb_subset_layout_context_t *l,
+               bool insert_catch_all) const
+  {
+    TRACE_SUBSET (this);
+    // TODO(subset)
+    return_trace (false);
+  }
+
+  bool sanitize (hb_sanitize_context_t *c) const
+  {
+    TRACE_SANITIZE (this);
+    return_trace (condition.sanitize (c, this));
+  }
+
+  protected:
+  HBUINT16      format;         /* Format identifier--format = 5 */
+  Offset24To  condition;
+  public:
+  DEFINE_SIZE_STATIC (5);
+};
+
 struct Condition
 {
-  bool evaluate (const int *coords, unsigned int coord_len) const
+  template 
+  bool evaluate (const int *coords, unsigned int coord_len,
+                 Instancer *instancer) const
   {
     switch (u.format) {
-    case 1: return u.format1.evaluate (coords, coord_len);
+    case 1: hb_barrier (); return u.format1.evaluate (coords, coord_len, instancer);
+    case 2: hb_barrier (); return u.format2.evaluate (coords, coord_len, instancer);
+    case 3: hb_barrier (); return u.format3.evaluate (coords, coord_len, instancer);
+    case 4: hb_barrier (); return u.format4.evaluate (coords, coord_len, instancer);
+    case 5: hb_barrier (); return u.format5.evaluate (coords, coord_len, instancer);
     default:return false;
     }
   }
@@ -3404,7 +4137,8 @@ struct Condition
                                              hb_map_t *condition_map /* OUT */) const
   {
     switch (u.format) {
-    case 1: return u.format1.keep_with_variations (c, condition_map);
+    case 1: hb_barrier (); return u.format1.keep_with_variations (c, condition_map);
+    // TODO(subset)
     default: c->apply = false; return KEEP_COND_WITH_VAR;
     }
   }
@@ -3415,7 +4149,11 @@ struct Condition
     if (unlikely (!c->may_dispatch (this, &u.format))) return c->no_dispatch_return_value ();
     TRACE_DISPATCH (this, u.format);
     switch (u.format) {
-    case 1: return_trace (c->dispatch (u.format1, std::forward (ds)...));
+    case 1: hb_barrier (); return_trace (c->dispatch (u.format1, std::forward (ds)...));
+    case 2: hb_barrier (); return_trace (c->dispatch (u.format2, std::forward (ds)...));
+    case 3: hb_barrier (); return_trace (c->dispatch (u.format3, std::forward (ds)...));
+    case 4: hb_barrier (); return_trace (c->dispatch (u.format4, std::forward (ds)...));
+    case 5: hb_barrier (); return_trace (c->dispatch (u.format5, std::forward (ds)...));
     default:return_trace (c->default_return_value ());
     }
   }
@@ -3424,8 +4162,13 @@ struct Condition
   {
     TRACE_SANITIZE (this);
     if (!u.format.sanitize (c)) return_trace (false);
+    hb_barrier ();
     switch (u.format) {
-    case 1: return_trace (u.format1.sanitize (c));
+    case 1: hb_barrier (); return_trace (u.format1.sanitize (c));
+    case 2: hb_barrier (); return_trace (u.format2.sanitize (c));
+    case 3: hb_barrier (); return_trace (u.format3.sanitize (c));
+    case 4: hb_barrier (); return_trace (u.format4.sanitize (c));
+    case 5: hb_barrier (); return_trace (u.format5.sanitize (c));
     default:return_trace (true);
     }
   }
@@ -3433,19 +4176,51 @@ struct Condition
   protected:
   union {
   HBUINT16              format;         /* Format identifier */
-  ConditionFormat1      format1;
+  ConditionAxisRange    format1;
+  ConditionValue        format2;
+  ConditionAnd          format3;
+  ConditionOr           format4;
+  ConditionNegate       format5;
   } u;
   public:
   DEFINE_SIZE_UNION (2, format);
 };
 
+template 
+bool
+_hb_recurse_condition_evaluate (const struct Condition &condition,
+                                const int *coords,
+                                unsigned int coord_len,
+                                Instancer *instancer)
+{
+  return condition.evaluate (coords, coord_len, instancer);
+}
+
+struct ConditionList
+{
+  const Condition& operator[] (unsigned i) const
+  { return this+conditions[i]; }
+
+  bool sanitize (hb_sanitize_context_t *c) const
+  {
+    TRACE_SANITIZE (this);
+    return_trace (conditions.sanitize (c, this));
+  }
+
+  protected:
+  Array32OfOffset32To conditions;
+  public:
+  DEFINE_SIZE_ARRAY (4, conditions);
+};
+
 struct ConditionSet
 {
-  bool evaluate (const int *coords, unsigned int coord_len) const
+  bool evaluate (const int *coords, unsigned int coord_len,
+                 ItemVarStoreInstancer *instancer) const
   {
     unsigned int count = conditions.len;
     for (unsigned int i = 0; i < count; i++)
-      if (!(this+conditions.arrayZ[i]).evaluate (coords, coord_len))
+      if (!(this+conditions.arrayZ[i]).evaluate (coords, coord_len, instancer))
         return false;
     return true;
   }
@@ -3497,12 +4272,15 @@ struct ConditionSet
   }
 
   bool subset (hb_subset_context_t *c,
-               hb_subset_layout_context_t *l) const
+               hb_subset_layout_context_t *l,
+               bool insert_catch_all) const
   {
     TRACE_SUBSET (this);
     auto *out = c->serializer->start_embed (this);
     if (unlikely (!out || !c->serializer->extend_min (out))) return_trace (false);
 
+    if (insert_catch_all) return_trace (true);
+
     hb_set_t *retained_cond_set = nullptr;
     if (l->feature_record_cond_idx_map != nullptr)
       retained_cond_set = l->feature_record_cond_idx_map->get (l->cur_feature_var_record_idx);
@@ -3548,27 +4326,51 @@ struct FeatureTableSubstitutionRecord
   }
 
   void collect_feature_substitutes_with_variations (hb_hashmap_t *feature_substitutes_map,
+                                                    hb_set_t& catch_all_record_feature_idxes,
                                                     const hb_set_t *feature_indices,
                                                     const void *base) const
   {
     if (feature_indices->has (featureIndex))
+    {
       feature_substitutes_map->set (featureIndex, &(base+feature));
+      catch_all_record_feature_idxes.add (featureIndex);
+    }
+  }
+
+  bool serialize (hb_subset_layout_context_t *c,
+                  unsigned feature_index,
+                  const Feature *f, const Tag *tag)
+  {
+    TRACE_SERIALIZE (this);
+    hb_serialize_context_t *s = c->subset_context->serializer;
+    if (unlikely (!s->extend_min (this))) return_trace (false);
+
+    uint32_t *new_feature_idx;
+    if (!c->feature_index_map->has (feature_index, &new_feature_idx))
+      return_trace (false);
+
+    if (!s->check_assign (featureIndex, *new_feature_idx, HB_SERIALIZE_ERROR_INT_OVERFLOW))
+      return_trace (false);
+
+    s->push ();
+    bool ret = f->subset (c->subset_context, c, tag);
+    if (ret) s->add_link (feature, s->pop_pack ());
+    else s->pop_discard ();
+
+    return_trace (ret);
   }
 
   bool subset (hb_subset_layout_context_t *c, const void *base) const
   {
     TRACE_SUBSET (this);
-    if (!c->feature_index_map->has (featureIndex) ||
-        c->feature_substitutes_map->has (featureIndex)) {
-      // Feature that is being substituted is not being retained, so we don't
-      // need this.
+    uint32_t *new_feature_index;
+    if (!c->feature_index_map->has (featureIndex, &new_feature_index))
       return_trace (false);
-    }
 
     auto *out = c->subset_context->serializer->embed (this);
     if (unlikely (!out)) return_trace (false);
 
-    out->featureIndex = c->feature_index_map->get (featureIndex);
+    out->featureIndex = *new_feature_index;
     return_trace (out->feature.serialize_subset (c->subset_context, feature, base, c));
   }
 
@@ -3600,16 +4402,10 @@ struct FeatureTableSubstitution
   }
 
   void collect_lookups (const hb_set_t *feature_indexes,
-                        const hb_hashmap_t *feature_substitutes_map,
                         hb_set_t       *lookup_indexes /* OUT */) const
   {
     + hb_iter (substitutions)
     | hb_filter (feature_indexes, &FeatureTableSubstitutionRecord::featureIndex)
-    | hb_filter ([feature_substitutes_map] (const FeatureTableSubstitutionRecord& record)
-                 {
-                   if (feature_substitutes_map == nullptr) return true;
-                   return !feature_substitutes_map->has (record.featureIndex);
-                 })
     | hb_apply ([this, lookup_indexes] (const FeatureTableSubstitutionRecord& r)
                 { r.collect_lookups (this, lookup_indexes); })
     ;
@@ -3634,11 +4430,14 @@ struct FeatureTableSubstitution
   void collect_feature_substitutes_with_variations (hb_collect_feature_substitutes_with_var_context_t *c) const
   {
     for (const FeatureTableSubstitutionRecord& record : substitutions)
-      record.collect_feature_substitutes_with_variations (c->feature_substitutes_map, c->feature_indices, this);
+      record.collect_feature_substitutes_with_variations (c->feature_substitutes_map,
+                                                          c->catch_all_record_feature_idxes,
+                                                          c->feature_indices, this);
   }
 
   bool subset (hb_subset_context_t        *c,
-               hb_subset_layout_context_t *l) const
+               hb_subset_layout_context_t *l,
+               bool insert_catch_all) const
   {
     TRACE_SUBSET (this);
     auto *out = c->serializer->start_embed (*this);
@@ -3647,6 +4446,22 @@ struct FeatureTableSubstitution
     out->version.major = version.major;
     out->version.minor = version.minor;
 
+    if (insert_catch_all)
+    {
+      for (unsigned feature_index : *(l->catch_all_record_feature_idxes))
+      {
+        hb_pair_t *p;
+        if (!l->feature_idx_tag_map->has (feature_index, &p))
+          return_trace (false);
+        auto *o = out->substitutions.serialize_append (c->serializer);
+        if (!o->serialize (l, feature_index,
+                           reinterpret_cast (p->first),
+                           reinterpret_cast (p->second)))
+          return_trace (false);
+      }
+      return_trace (true);
+    }
+
     + substitutions.iter ()
     | hb_apply (subset_record_array (l, &(out->substitutions), this))
     ;
@@ -3658,6 +4473,7 @@ struct FeatureTableSubstitution
   {
     TRACE_SANITIZE (this);
     return_trace (version.sanitize (c) &&
+                  hb_barrier () &&
                   likely (version.major == 1) &&
                   substitutions.sanitize (c, this));
   }
@@ -3676,10 +4492,9 @@ struct FeatureVariationRecord
 
   void collect_lookups (const void     *base,
                         const hb_set_t *feature_indexes,
-                        const hb_hashmap_t *feature_substitutes_map,
                         hb_set_t       *lookup_indexes /* OUT */) const
   {
-    return (base+substitutions).collect_lookups (feature_indexes, feature_substitutes_map, lookup_indexes);
+    return (base+substitutions).collect_lookups (feature_indexes, lookup_indexes);
   }
 
   void closure_features (const void     *base,
@@ -3705,14 +4520,15 @@ struct FeatureVariationRecord
     }
   }
 
-  bool subset (hb_subset_layout_context_t *c, const void *base) const
+  bool subset (hb_subset_layout_context_t *c, const void *base,
+               bool insert_catch_all = false) const
   {
     TRACE_SUBSET (this);
     auto *out = c->subset_context->serializer->embed (this);
     if (unlikely (!out)) return_trace (false);
 
-    out->conditions.serialize_subset (c->subset_context, conditions, base, c);
-    out->substitutions.serialize_subset (c->subset_context, substitutions, base, c);
+    out->conditions.serialize_subset (c->subset_context, conditions, base, c, insert_catch_all);
+    out->substitutions.serialize_subset (c->subset_context, substitutions, base, c, insert_catch_all);
 
     return_trace (true);
   }
@@ -3738,13 +4554,14 @@ struct FeatureVariations
   static constexpr unsigned NOT_FOUND_INDEX = 0xFFFFFFFFu;
 
   bool find_index (const int *coords, unsigned int coord_len,
-                   unsigned int *index) const
+                   unsigned int *index,
+                   ItemVarStoreInstancer *instancer) const
   {
     unsigned int count = varRecords.len;
     for (unsigned int i = 0; i < count; i++)
     {
       const FeatureVariationRecord &record = varRecords.arrayZ[i];
-      if ((this+record.conditions).evaluate (coords, coord_len))
+      if ((this+record.conditions).evaluate (coords, coord_len, instancer))
       {
         *index = i;
         return true;
@@ -3771,9 +4588,8 @@ struct FeatureVariations
       if (c->universal)
         break;
     }
-    if (c->variation_applied && !c->universal &&
-        !c->record_cond_idx_map->is_empty ())
-      c->insert_catch_all_feature_variation_record = true;
+    if (c->universal || c->record_cond_idx_map->is_empty ())
+      c->catch_all_record_feature_idxes.reset ();
   }
 
   FeatureVariations* copy (hb_serialize_context_t *c) const
@@ -3783,11 +4599,17 @@ struct FeatureVariations
   }
 
   void collect_lookups (const hb_set_t *feature_indexes,
-                        const hb_hashmap_t *feature_substitutes_map,
+                        const hb_hashmap_t> *feature_record_cond_idx_map,
                         hb_set_t       *lookup_indexes /* OUT */) const
   {
-    for (const FeatureVariationRecord& r : varRecords)
-      r.collect_lookups (this, feature_indexes, feature_substitutes_map, lookup_indexes);
+    unsigned count = varRecords.len;
+    for (unsigned int i = 0; i < count; i++)
+    {
+      if (feature_record_cond_idx_map &&
+          !feature_record_cond_idx_map->has (i))
+        continue;
+      varRecords[i].collect_lookups (this, feature_indexes, lookup_indexes);
+    }
   }
 
   void closure_features (const hb_map_t *lookup_indexes,
@@ -3832,6 +4654,13 @@ struct FeatureVariations
       l->cur_feature_var_record_idx = i;
       subset_record_array (l, &(out->varRecords), this) (varRecords[i]);
     }
+
+    if (out->varRecords.len && !l->catch_all_record_feature_idxes->is_empty ())
+    {
+      bool insert_catch_all_record = true;
+      subset_record_array (l, &(out->varRecords), this, insert_catch_all_record) (varRecords[0]);
+    }
+
     return_trace (bool (out->varRecords));
   }
 
@@ -3839,6 +4668,7 @@ struct FeatureVariations
   {
     TRACE_SANITIZE (this);
     return_trace (version.sanitize (c) &&
+                  hb_barrier () &&
                   likely (version.major == 1) &&
                   varRecords.sanitize (c, this));
   }
@@ -3945,13 +4775,13 @@ struct VariationDevice
   private:
 
   hb_position_t get_x_delta (hb_font_t *font,
-                             const VariationStore &store,
-                             VariationStore::cache_t *store_cache = nullptr) const
+                             const ItemVariationStore &store,
+                             ItemVariationStore::cache_t *store_cache = nullptr) const
   { return font->em_scalef_x (get_delta (font, store, store_cache)); }
 
   hb_position_t get_y_delta (hb_font_t *font,
-                             const VariationStore &store,
-                             VariationStore::cache_t *store_cache = nullptr) const
+                             const ItemVariationStore &store,
+                             ItemVariationStore::cache_t *store_cache = nullptr) const
   { return font->em_scalef_y (get_delta (font, store, store_cache)); }
 
   VariationDevice* copy (hb_serialize_context_t *c,
@@ -3985,14 +4815,14 @@ struct VariationDevice
   private:
 
   float get_delta (hb_font_t *font,
-                   const VariationStore &store,
-                   VariationStore::cache_t *store_cache = nullptr) const
+                   const ItemVariationStore &store,
+                   ItemVariationStore::cache_t *store_cache = nullptr) const
   {
-    return store.get_delta (varIdx, font->coords, font->num_coords, (VariationStore::cache_t *) store_cache);
+    return store.get_delta (varIdx, font->coords, font->num_coords, (ItemVariationStore::cache_t *) store_cache);
   }
 
   protected:
-  VarIdx        varIdx;
+  VarIdx        varIdx;         /* Variation index */
   HBUINT16      deltaFormat;    /* Format identifier for this table: 0x0x8000 */
   public:
   DEFINE_SIZE_STATIC (6);
@@ -4012,8 +4842,8 @@ struct DeviceHeader
 struct Device
 {
   hb_position_t get_x_delta (hb_font_t *font,
-                             const VariationStore &store=Null (VariationStore),
-                             VariationStore::cache_t *store_cache = nullptr) const
+                             const ItemVariationStore &store=Null (ItemVariationStore),
+                             ItemVariationStore::cache_t *store_cache = nullptr) const
   {
     switch (u.b.format)
     {
@@ -4030,8 +4860,8 @@ struct Device
     }
   }
   hb_position_t get_y_delta (hb_font_t *font,
-                             const VariationStore &store=Null (VariationStore),
-                             VariationStore::cache_t *store_cache = nullptr) const
+                             const ItemVariationStore &store=Null (ItemVariationStore),
+                             ItemVariationStore::cache_t *store_cache = nullptr) const
   {
     switch (u.b.format)
     {
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-layout-gsubgpos.hh b/src/java.desktop/share/native/libharfbuzz/hb-ot-layout-gsubgpos.hh
index d5b5a488a263..1a719391b8ef 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-ot-layout-gsubgpos.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-layout-gsubgpos.hh
@@ -406,6 +406,7 @@ struct hb_ot_apply_context_t :
 
     void set_ignore_zwnj (bool ignore_zwnj_) { ignore_zwnj = ignore_zwnj_; }
     void set_ignore_zwj (bool ignore_zwj_) { ignore_zwj = ignore_zwj_; }
+    void set_ignore_hidden (bool ignore_hidden_) { ignore_hidden = ignore_hidden_; }
     void set_lookup_props (unsigned int lookup_props_) { lookup_props = lookup_props_; }
     void set_mask (hb_mask_t mask_) { mask = mask_; }
     void set_per_syllable (bool per_syllable_) { per_syllable = per_syllable_; }
@@ -451,9 +452,10 @@ struct hb_ot_apply_context_t :
       if (!c->check_glyph_property (&info, lookup_props))
         return SKIP_YES;
 
-      if (unlikely (_hb_glyph_info_is_default_ignorable_and_not_hidden (&info) &&
+      if (unlikely (_hb_glyph_info_is_default_ignorable (&info) &&
                     (ignore_zwnj || !_hb_glyph_info_is_zwnj (&info)) &&
-                    (ignore_zwj || !_hb_glyph_info_is_zwj (&info))))
+                    (ignore_zwj || !_hb_glyph_info_is_zwj (&info)) &&
+                    (ignore_hidden || !_hb_glyph_info_is_hidden (&info))))
         return SKIP_MAYBE;
 
       return SKIP_NO;
@@ -464,6 +466,7 @@ struct hb_ot_apply_context_t :
     hb_mask_t mask = -1;
     bool ignore_zwnj = false;
     bool ignore_zwj = false;
+    bool ignore_hidden = false;
     bool per_syllable = false;
     uint8_t syllable = 0;
     match_func_t match_func = nullptr;
@@ -486,6 +489,8 @@ struct hb_ot_apply_context_t :
       matcher.set_ignore_zwnj (c->table_index == 1 || (context_match && c->auto_zwnj));
       /* Ignore ZWJ if we are matching context, or asked to. */
       matcher.set_ignore_zwj  (context_match || c->auto_zwj);
+      /* Ignore hidden glyphs (like CGJ) during GPOS. */
+      matcher.set_ignore_hidden (c->table_index == 1);
       matcher.set_mask (context_match ? -1 : c->lookup_mask);
       /* Per syllable matching is only for GSUB. */
       matcher.set_per_syllable (c->table_index == 0 && c->per_syllable);
@@ -708,8 +713,9 @@ struct hb_ot_apply_context_t :
   recurse_func_t recurse_func = nullptr;
   const GDEF &gdef;
   const GDEF::accelerator_t &gdef_accel;
-  const VariationStore &var_store;
-  VariationStore::cache_t *var_store_cache;
+  const hb_ot_layout_lookup_accelerator_t *lookup_accel = nullptr;
+  const ItemVariationStore &var_store;
+  ItemVariationStore::cache_t *var_store_cache;
   hb_set_digest_t digest;
 
   hb_direction_t direction;
@@ -723,7 +729,6 @@ struct hb_ot_apply_context_t :
   bool auto_zwj = true;
   bool per_syllable = false;
   bool random = false;
-  uint32_t random_state = 1;
   unsigned new_syllables = (unsigned) -1;
 
   signed last_base = -1; // GPOS uses
@@ -758,15 +763,17 @@ struct hb_ot_apply_context_t :
                                          nullptr
 #endif
                                         ),
-                        digest (buffer_->digest ()),
                         direction (buffer_->props.direction),
                         has_glyph_classes (gdef.has_glyph_classes ())
-  { init_iters (); }
+  {
+    init_iters ();
+    buffer->collect_codepoints (digest);
+  }
 
   ~hb_ot_apply_context_t ()
   {
 #ifndef HB_NO_VAR
-    VariationStore::destroy_cache (var_store_cache);
+    ItemVariationStore::destroy_cache (var_store_cache);
 #endif
   }
 
@@ -788,8 +795,8 @@ struct hb_ot_apply_context_t :
   uint32_t random_number ()
   {
     /* http://www.cplusplus.com/reference/random/minstd_rand/ */
-    random_state = random_state * 48271 % 2147483647;
-    return random_state;
+    buffer->random_state = buffer->random_state * 48271 % 2147483647;
+    return buffer->random_state;
   }
 
   bool match_properties_mark (hb_codepoint_t  glyph,
@@ -895,6 +902,13 @@ struct hb_ot_apply_context_t :
   }
 };
 
+enum class hb_ot_lookup_cache_op_t
+{
+  CREATE,
+  ENTER,
+  LEAVE,
+  DESTROY,
+};
 
 struct hb_accelerate_subtables_context_t :
        hb_dispatch_context_t
@@ -919,19 +933,23 @@ struct hb_accelerate_subtables_context_t :
   }
 
   template 
-  static inline auto cache_func_ (const T *obj, hb_ot_apply_context_t *c, bool enter, hb_priority<1>) HB_RETURN (bool, obj->cache_func (c, enter) )
-  template 
-  static inline bool cache_func_ (const T *obj, hb_ot_apply_context_t *c, bool enter, hb_priority<0>) { return false; }
+  static inline auto cache_func_ (void *p,
+                                  hb_ot_lookup_cache_op_t op,
+                                  hb_priority<1>) HB_RETURN (void *, T::cache_func (p, op) )
+  template 
+  static inline void * cache_func_ (void *p,
+                                    hb_ot_lookup_cache_op_t op HB_UNUSED,
+                                    hb_priority<0>) { return (void *) false; }
   template 
-  static inline bool cache_func_to (const void *obj, hb_ot_apply_context_t *c, bool enter)
+  static inline void * cache_func_to (void *p,
+                                      hb_ot_lookup_cache_op_t op)
   {
-    const Type *typed_obj = (const Type *) obj;
-    return cache_func_ (typed_obj, c, enter, hb_prioritize);
+    return cache_func_ (p, op, hb_prioritize);
   }
 #endif
 
   typedef bool (*hb_apply_func_t) (const void *obj, hb_ot_apply_context_t *c);
-  typedef bool (*hb_cache_func_t) (const void *obj, hb_ot_apply_context_t *c, bool enter);
+  typedef void * (*hb_cache_func_t) (void *p, hb_ot_lookup_cache_op_t op);
 
   struct hb_applicable_t
   {
@@ -968,11 +986,11 @@ struct hb_accelerate_subtables_context_t :
     }
     bool cache_enter (hb_ot_apply_context_t *c) const
     {
-      return cache_func (obj, c, true);
+      return (bool) cache_func (c, hb_ot_lookup_cache_op_t::ENTER);
     }
     void cache_leave (hb_ot_apply_context_t *c) const
     {
-      cache_func (obj, c, false);
+      cache_func (c, hb_ot_lookup_cache_op_t::LEAVE);
     }
 #endif
 
@@ -1255,7 +1273,7 @@ static bool match_input (hb_ot_apply_context_t *c,
                          match_func_t match_func,
                          const void *match_data,
                          unsigned int *end_position,
-                         unsigned int match_positions[HB_MAX_CONTEXT_LENGTH],
+                         unsigned int *match_positions,
                          unsigned int *p_total_component_count = nullptr)
 {
   TRACE_APPLY (nullptr);
@@ -1379,7 +1397,7 @@ static bool match_input (hb_ot_apply_context_t *c,
 }
 static inline bool ligate_input (hb_ot_apply_context_t *c,
                                  unsigned int count, /* Including the first glyph */
-                                 const unsigned int match_positions[HB_MAX_CONTEXT_LENGTH], /* Including the first glyph */
+                                 const unsigned int *match_positions, /* Including the first glyph */
                                  unsigned int match_end,
                                  hb_codepoint_t lig_glyph,
                                  unsigned int total_component_count)
@@ -1458,6 +1476,7 @@ static inline bool ligate_input (hb_ot_apply_context_t *c,
         unsigned int this_comp = _hb_glyph_info_get_lig_comp (&buffer->cur());
         if (this_comp == 0)
           this_comp = last_num_components;
+        assert (components_so_far >= last_num_components);
         unsigned int new_lig_comp = components_so_far - last_num_components +
                                     hb_min (this_comp, last_num_components);
           _hb_glyph_info_set_lig_props_for_mark (&buffer->cur(), lig_id, new_lig_comp);
@@ -1483,6 +1502,7 @@ static inline bool ligate_input (hb_ot_apply_context_t *c,
       unsigned this_comp = _hb_glyph_info_get_lig_comp (&buffer->info[i]);
       if (!this_comp) break;
 
+      assert (components_so_far >= last_num_components);
       unsigned new_lig_comp = components_so_far - last_num_components +
                               hb_min (this_comp, last_num_components);
       _hb_glyph_info_set_lig_props_for_mark (&buffer->info[i], lig_id, new_lig_comp);
@@ -1538,6 +1558,7 @@ static bool match_lookahead (hb_ot_apply_context_t *c,
   TRACE_APPLY (nullptr);
 
   hb_ot_apply_context_t::skipping_iterator_t &skippy_iter = c->iter_context;
+  assert (start_index >= 1);
   skippy_iter.reset (start_index - 1);
   skippy_iter.set_match_func (match_func, match_data);
   skippy_iter.set_glyph_data (lookahead);
@@ -1687,7 +1708,7 @@ static inline void recurse_lookups (context_t *c,
 
 static inline void apply_lookup (hb_ot_apply_context_t *c,
                                  unsigned int count, /* Including the first glyph */
-                                 unsigned int match_positions[HB_MAX_CONTEXT_LENGTH], /* Including the first glyph */
+                                 unsigned int *match_positions, /* Including the first glyph */
                                  unsigned int lookupCount,
                                  const LookupRecord lookupRecord[], /* Array of LookupRecords--in design order */
                                  unsigned int match_end)
@@ -1695,6 +1716,9 @@ static inline void apply_lookup (hb_ot_apply_context_t *c,
   hb_buffer_t *buffer = c->buffer;
   int end;
 
+  unsigned int *match_positions_input = match_positions;
+  unsigned int match_positions_count = count;
+
   /* All positions are distance from beginning of *output* buffer.
    * Adjust. */
   {
@@ -1798,6 +1822,27 @@ static inline void apply_lookup (hb_ot_apply_context_t *c,
     {
       if (unlikely (delta + count > HB_MAX_CONTEXT_LENGTH))
         break;
+      if (unlikely (delta + count > match_positions_count))
+      {
+        unsigned new_match_positions_count = hb_max (delta + count, hb_max(match_positions_count, 4u) * 1.5);
+        if (match_positions == match_positions_input)
+        {
+          match_positions = (unsigned int *) hb_malloc (new_match_positions_count * sizeof (match_positions[0]));
+          if (unlikely (!match_positions))
+            break;
+          memcpy (match_positions, match_positions_input, count * sizeof (match_positions[0]));
+          match_positions_count = new_match_positions_count;
+        }
+        else
+        {
+          unsigned int *new_match_positions = (unsigned int *) hb_realloc (match_positions, new_match_positions_count * sizeof (match_positions[0]));
+          if (unlikely (!new_match_positions))
+            break;
+          match_positions = new_match_positions;
+          match_positions_count = new_match_positions_count;
+        }
+      }
+
     }
     else
     {
@@ -1821,6 +1866,10 @@ static inline void apply_lookup (hb_ot_apply_context_t *c,
       match_positions[next] += delta;
   }
 
+  if (match_positions != match_positions_input)
+    hb_free (match_positions);
+
+  assert (end >= 0);
   (void) buffer->move_to (end);
 }
 
@@ -1921,8 +1970,18 @@ static bool context_apply_lookup (hb_ot_apply_context_t *c,
                                   const LookupRecord lookupRecord[],
                                   const ContextApplyLookupContext &lookup_context)
 {
+  if (unlikely (inputCount > HB_MAX_CONTEXT_LENGTH)) return false;
+  unsigned match_positions_stack[4];
+  unsigned *match_positions = match_positions_stack;
+  if (unlikely (inputCount > ARRAY_LENGTH (match_positions_stack)))
+  {
+    match_positions = (unsigned *) hb_malloc (hb_max (inputCount, 1u) * sizeof (match_positions[0]));
+    if (unlikely (!match_positions))
+      return false;
+  }
+
   unsigned match_end = 0;
-  unsigned match_positions[HB_MAX_CONTEXT_LENGTH];
+  bool ret = false;
   if (match_input (c,
                    inputCount, input,
                    lookup_context.funcs.match, lookup_context.match_data,
@@ -1933,13 +1992,18 @@ static bool context_apply_lookup (hb_ot_apply_context_t *c,
                   inputCount, match_positions,
                   lookupCount, lookupRecord,
                   match_end);
-    return true;
+    ret = true;
   }
   else
   {
     c->buffer->unsafe_to_concat (c->buffer->idx, match_end);
-    return false;
+    ret = false;
   }
+
+  if (unlikely (match_positions != match_positions_stack))
+    hb_free (match_positions);
+
+  return ret;
 }
 
 template 
@@ -2051,6 +2115,7 @@ struct Rule
   {
     TRACE_SANITIZE (this);
     return_trace (c->check_struct (this) &&
+                  hb_barrier () &&
                   c->check_range (inputZ.arrayZ,
                                   inputZ.item_size * (inputCount ? inputCount - 1 : 0) +
                                   LookupRecord::static_size * lookupCount));
@@ -2572,25 +2637,35 @@ struct ContextFormat2_5
     unsigned c = (this+classDef).cost () * ruleSet.len;
     return c >= 4 ? c : 0;
   }
-  bool cache_func (hb_ot_apply_context_t *c, bool enter) const
+  static void * cache_func (void *p, hb_ot_lookup_cache_op_t op)
   {
-    if (enter)
-    {
-      if (!HB_BUFFER_TRY_ALLOCATE_VAR (c->buffer, syllable))
-        return false;
-      auto &info = c->buffer->info;
-      unsigned count = c->buffer->len;
-      for (unsigned i = 0; i < count; i++)
-        info[i].syllable() = 255;
-      c->new_syllables = 255;
-      return true;
-    }
-    else
+    switch (op)
     {
-      c->new_syllables = (unsigned) -1;
-      HB_BUFFER_DEALLOCATE_VAR (c->buffer, syllable);
-      return true;
+      case hb_ot_lookup_cache_op_t::CREATE:
+        return (void *) true;
+      case hb_ot_lookup_cache_op_t::ENTER:
+      {
+        hb_ot_apply_context_t *c = (hb_ot_apply_context_t *) p;
+        if (!HB_BUFFER_TRY_ALLOCATE_VAR (c->buffer, syllable))
+          return (void *) false;
+        auto &info = c->buffer->info;
+        unsigned count = c->buffer->len;
+        for (unsigned i = 0; i < count; i++)
+          info[i].syllable() = 255;
+        c->new_syllables = 255;
+        return (void *) true;
+      }
+      case hb_ot_lookup_cache_op_t::LEAVE:
+      {
+        hb_ot_apply_context_t *c = (hb_ot_apply_context_t *) p;
+        c->new_syllables = (unsigned) -1;
+        HB_BUFFER_DEALLOCATE_VAR (c->buffer, syllable);
+        return nullptr;
+      }
+      case hb_ot_lookup_cache_op_t::DESTROY:
+        return nullptr;
     }
+    return nullptr;
   }
 
   bool apply_cached (hb_ot_apply_context_t *c) const { return _apply (c, true); }
@@ -2599,7 +2674,7 @@ struct ContextFormat2_5
   {
     TRACE_APPLY (this);
     unsigned int index = (this+coverage).get_coverage (c->buffer->cur().codepoint);
-    if (likely (index == NOT_COVERED)) return_trace (false);
+    if (index == NOT_COVERED) return_trace (false);
 
     const ClassDef &class_def = this+classDef;
 
@@ -2785,7 +2860,7 @@ struct ContextFormat3
   {
     TRACE_APPLY (this);
     unsigned int index = (this+coverageZ[0]).get_coverage (c->buffer->cur().codepoint);
-    if (likely (index == NOT_COVERED)) return_trace (false);
+    if (index == NOT_COVERED) return_trace (false);
 
     const LookupRecord *lookupRecord = &StructAfter (coverageZ.as_array (glyphCount));
     struct ContextApplyLookupContext lookup_context = {
@@ -2826,6 +2901,7 @@ struct ContextFormat3
   {
     TRACE_SANITIZE (this);
     if (unlikely (!c->check_struct (this))) return_trace (false);
+    hb_barrier ();
     unsigned int count = glyphCount;
     if (unlikely (!count)) return_trace (false); /* We want to access coverageZ[0] freely. */
     if (unlikely (!c->check_array (coverageZ.arrayZ, count))) return_trace (false);
@@ -2858,12 +2934,12 @@ struct Context
     if (unlikely (!c->may_dispatch (this, &u.format))) return c->no_dispatch_return_value ();
     TRACE_DISPATCH (this, u.format);
     switch (u.format) {
-    case 1: return_trace (c->dispatch (u.format1, std::forward (ds)...));
-    case 2: return_trace (c->dispatch (u.format2, std::forward (ds)...));
-    case 3: return_trace (c->dispatch (u.format3, std::forward (ds)...));
+    case 1: hb_barrier (); return_trace (c->dispatch (u.format1, std::forward (ds)...));
+    case 2: hb_barrier (); return_trace (c->dispatch (u.format2, std::forward (ds)...));
+    case 3: hb_barrier (); return_trace (c->dispatch (u.format3, std::forward (ds)...));
 #ifndef HB_NO_BEYOND_64K
-    case 4: return_trace (c->dispatch (u.format4, std::forward (ds)...));
-    case 5: return_trace (c->dispatch (u.format5, std::forward (ds)...));
+    case 4: hb_barrier (); return_trace (c->dispatch (u.format4, std::forward (ds)...));
+    case 5: hb_barrier (); return_trace (c->dispatch (u.format5, std::forward (ds)...));
 #endif
     default:return_trace (c->default_return_value ());
     }
@@ -3017,9 +3093,20 @@ static bool chain_context_apply_lookup (hb_ot_apply_context_t *c,
                                         const LookupRecord lookupRecord[],
                                         const ChainContextApplyLookupContext &lookup_context)
 {
+  if (unlikely (inputCount > HB_MAX_CONTEXT_LENGTH)) return false;
+  unsigned match_positions_stack[4];
+  unsigned *match_positions = match_positions_stack;
+  if (unlikely (inputCount > ARRAY_LENGTH (match_positions_stack)))
+  {
+    match_positions = (unsigned *) hb_malloc (hb_max (inputCount, 1u) * sizeof (match_positions[0]));
+    if (unlikely (!match_positions))
+      return false;
+  }
+
+  unsigned start_index = c->buffer->out_len;
   unsigned end_index = c->buffer->idx;
   unsigned match_end = 0;
-  unsigned match_positions[HB_MAX_CONTEXT_LENGTH];
+  bool ret = true;
   if (!(match_input (c,
                      inputCount, input,
                      lookup_context.funcs.match[1], lookup_context.match_data[1],
@@ -3030,17 +3117,18 @@ static bool chain_context_apply_lookup (hb_ot_apply_context_t *c,
                            match_end, &end_index)))
   {
     c->buffer->unsafe_to_concat (c->buffer->idx, end_index);
-    return false;
+    ret = false;
+    goto done;
   }
 
-  unsigned start_index = c->buffer->out_len;
   if (!match_backtrack (c,
                         backtrackCount, backtrack,
                         lookup_context.funcs.match[0], lookup_context.match_data[0],
                         &start_index))
   {
     c->buffer->unsafe_to_concat_from_outbuffer (start_index, end_index);
-    return false;
+    ret = false;
+    goto done;
   }
 
   c->buffer->unsafe_to_break_from_outbuffer (start_index, end_index);
@@ -3048,7 +3136,12 @@ static bool chain_context_apply_lookup (hb_ot_apply_context_t *c,
                 inputCount, match_positions,
                 lookupCount, lookupRecord,
                 match_end);
-  return true;
+  done:
+
+  if (unlikely (match_positions != match_positions_stack))
+    hb_free (match_positions);
+
+  return ret;
 }
 
 template 
@@ -3219,10 +3312,13 @@ struct ChainRule
     TRACE_SANITIZE (this);
     /* Hyper-optimized sanitized because this is really hot. */
     if (unlikely (!backtrack.len.sanitize (c))) return_trace (false);
+    hb_barrier ();
     const auto &input = StructAfter (backtrack);
     if (unlikely (!input.lenP1.sanitize (c))) return_trace (false);
+    hb_barrier ();
     const auto &lookahead = StructAfter (input);
     if (unlikely (!lookahead.len.sanitize (c))) return_trace (false);
+    hb_barrier ();
     const auto &lookup = StructAfter (lookahead);
     return_trace (likely (lookup.sanitize (c)));
   }
@@ -3327,6 +3423,15 @@ struct ChainRuleSet
      *
      * Replicated from LigatureSet::apply(). */
 
+    /* If the input skippy has non-auto joiners behavior (as in Indic shapers),
+     * skip this fast path, as we don't distinguish between input & lookahead
+     * matching in the fast path.
+     *
+     * https://github.com/harfbuzz/harfbuzz/issues/4813
+     */
+    if (!c->auto_zwnj || !c->auto_zwj)
+      goto slow;
+
     hb_ot_apply_context_t::skipping_iterator_t &skippy_iter = c->iter_input;
     skippy_iter.reset (c->buffer->idx);
     skippy_iter.set_match_func (match_always, nullptr);
@@ -3366,10 +3471,10 @@ struct ChainRuleSet
     }
     matched = skippy_iter.next ();
     if (likely (matched && !skippy_iter.may_skip (c->buffer->info[skippy_iter.idx])))
-     {
+    {
       second = &c->buffer->info[skippy_iter.idx];
       unsafe_to2 = skippy_iter.idx + 1;
-     }
+    }
 
     auto match_input = lookup_context.funcs.match[1];
     auto match_lookahead = lookup_context.funcs.match[2];
@@ -3569,7 +3674,7 @@ struct ChainContextFormat1_4
   {
     TRACE_APPLY (this);
     unsigned int index = (this+coverage).get_coverage (c->buffer->cur().codepoint);
-    if (likely (index == NOT_COVERED)) return_trace (false);
+    if (index == NOT_COVERED) return_trace (false);
 
     const ChainRuleSet &rule_set = this+ruleSet[index];
     struct ChainContextApplyLookupContext lookup_context = {
@@ -3780,28 +3885,37 @@ struct ChainContextFormat2_5
 
   unsigned cache_cost () const
   {
-    unsigned c = (this+lookaheadClassDef).cost () * ruleSet.len;
-    return c >= 4 ? c : 0;
+    return (this+lookaheadClassDef).cost () * ruleSet.len;
   }
-  bool cache_func (hb_ot_apply_context_t *c, bool enter) const
+  static void * cache_func (void *p, hb_ot_lookup_cache_op_t op)
   {
-    if (enter)
+    switch (op)
     {
-      if (!HB_BUFFER_TRY_ALLOCATE_VAR (c->buffer, syllable))
-        return false;
-      auto &info = c->buffer->info;
-      unsigned count = c->buffer->len;
-      for (unsigned i = 0; i < count; i++)
-        info[i].syllable() = 255;
-      c->new_syllables = 255;
-      return true;
-    }
-    else
-    {
-      c->new_syllables = (unsigned) -1;
-      HB_BUFFER_DEALLOCATE_VAR (c->buffer, syllable);
-      return true;
+      case hb_ot_lookup_cache_op_t::CREATE:
+        return (void *) true;
+      case hb_ot_lookup_cache_op_t::ENTER:
+      {
+        hb_ot_apply_context_t *c = (hb_ot_apply_context_t *) p;
+        if (!HB_BUFFER_TRY_ALLOCATE_VAR (c->buffer, syllable))
+          return (void *) false;
+        auto &info = c->buffer->info;
+        unsigned count = c->buffer->len;
+        for (unsigned i = 0; i < count; i++)
+          info[i].syllable() = 255;
+        c->new_syllables = 255;
+        return (void *) true;
+      }
+      case hb_ot_lookup_cache_op_t::LEAVE:
+      {
+        hb_ot_apply_context_t *c = (hb_ot_apply_context_t *) p;
+        c->new_syllables = (unsigned) -1;
+        HB_BUFFER_DEALLOCATE_VAR (c->buffer, syllable);
+        return nullptr;
+      }
+      case hb_ot_lookup_cache_op_t::DESTROY:
+        return nullptr;
     }
+    return nullptr;
   }
 
   bool apply_cached (hb_ot_apply_context_t *c) const { return _apply (c, true); }
@@ -3810,7 +3924,7 @@ struct ChainContextFormat2_5
   {
     TRACE_APPLY (this);
     unsigned int index = (this+coverage).get_coverage (c->buffer->cur().codepoint);
-    if (likely (index == NOT_COVERED)) return_trace (false);
+    if (index == NOT_COVERED) return_trace (false);
 
     const ClassDef &backtrack_class_def = this+backtrackClassDef;
     const ClassDef &input_class_def = this+inputClassDef;
@@ -4056,7 +4170,7 @@ struct ChainContextFormat3
     const auto &input = StructAfter (backtrack);
 
     unsigned int index = (this+input[0]).get_coverage (c->buffer->cur().codepoint);
-    if (likely (index == NOT_COVERED)) return_trace (false);
+    if (index == NOT_COVERED) return_trace (false);
 
     const auto &lookahead = StructAfter (input);
     const auto &lookup = StructAfter (lookahead);
@@ -4121,11 +4235,14 @@ struct ChainContextFormat3
   {
     TRACE_SANITIZE (this);
     if (unlikely (!backtrack.sanitize (c, this))) return_trace (false);
+    hb_barrier ();
     const auto &input = StructAfter (backtrack);
     if (unlikely (!input.sanitize (c, this))) return_trace (false);
+    hb_barrier ();
     if (unlikely (!input.len)) return_trace (false); /* To be consistent with Context. */
     const auto &lookahead = StructAfter (input);
     if (unlikely (!lookahead.sanitize (c, this))) return_trace (false);
+    hb_barrier ();
     const auto &lookup = StructAfter (lookahead);
     return_trace (likely (lookup.sanitize (c)));
   }
@@ -4159,12 +4276,12 @@ struct ChainContext
     if (unlikely (!c->may_dispatch (this, &u.format))) return c->no_dispatch_return_value ();
     TRACE_DISPATCH (this, u.format);
     switch (u.format) {
-    case 1: return_trace (c->dispatch (u.format1, std::forward (ds)...));
-    case 2: return_trace (c->dispatch (u.format2, std::forward (ds)...));
-    case 3: return_trace (c->dispatch (u.format3, std::forward (ds)...));
+    case 1: hb_barrier (); return_trace (c->dispatch (u.format1, std::forward (ds)...));
+    case 2: hb_barrier (); return_trace (c->dispatch (u.format2, std::forward (ds)...));
+    case 3: hb_barrier (); return_trace (c->dispatch (u.format3, std::forward (ds)...));
 #ifndef HB_NO_BEYOND_64K
-    case 4: return_trace (c->dispatch (u.format4, std::forward (ds)...));
-    case 5: return_trace (c->dispatch (u.format5, std::forward (ds)...));
+    case 4: hb_barrier (); return_trace (c->dispatch (u.format4, std::forward (ds)...));
+    case 5: hb_barrier (); return_trace (c->dispatch (u.format5, std::forward (ds)...));
 #endif
     default:return_trace (c->default_return_value ());
     }
@@ -4209,6 +4326,7 @@ struct ExtensionFormat1
   {
     TRACE_SANITIZE (this);
     return_trace (c->check_struct (this) &&
+                  hb_barrier () &&
                   extensionLookupType != T::SubTable::Extension);
   }
 
@@ -4247,7 +4365,7 @@ struct Extension
   unsigned int get_type () const
   {
     switch (u.format) {
-    case 1: return u.format1.get_type ();
+    case 1: hb_barrier (); return u.format1.get_type ();
     default:return 0;
     }
   }
@@ -4255,7 +4373,7 @@ struct Extension
   const X& get_subtable () const
   {
     switch (u.format) {
-    case 1: return u.format1.template get_subtable ();
+    case 1: hb_barrier (); return u.format1.template get_subtable ();
     default:return Null (typename T::SubTable);
     }
   }
@@ -4267,7 +4385,7 @@ struct Extension
   typename hb_subset_context_t::return_t dispatch (hb_subset_context_t *c, Ts&&... ds) const
   {
     switch (u.format) {
-    case 1: return u.format1.subset (c);
+    case 1: hb_barrier (); return u.format1.subset (c);
     default: return c->default_return_value ();
     }
   }
@@ -4278,7 +4396,7 @@ struct Extension
     if (unlikely (!c->may_dispatch (this, &u.format))) return c->no_dispatch_return_value ();
     TRACE_DISPATCH (this, u.format);
     switch (u.format) {
-    case 1: return_trace (u.format1.dispatch (c, std::forward (ds)...));
+    case 1: hb_barrier (); return_trace (u.format1.dispatch (c, std::forward (ds)...));
     default:return_trace (c->default_return_value ());
     }
   }
@@ -4320,10 +4438,21 @@ struct hb_ot_layout_lookup_accelerator_t
 
     thiz->digest.init ();
     for (auto& subtable : hb_iter (thiz->subtables, count))
-      thiz->digest.add (subtable.digest);
+      thiz->digest.union_ (subtable.digest);
 
 #ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
+    if (c_accelerate_subtables.cache_user_cost < 4)
+      c_accelerate_subtables.cache_user_idx = (unsigned) -1;
+
     thiz->cache_user_idx = c_accelerate_subtables.cache_user_idx;
+
+    if (thiz->cache_user_idx != (unsigned) -1)
+    {
+      thiz->cache = thiz->subtables[thiz->cache_user_idx].cache_func (nullptr, hb_ot_lookup_cache_op_t::CREATE);
+      if (!thiz->cache)
+        thiz->cache_user_idx = (unsigned) -1;
+    }
+
     for (unsigned i = 0; i < count; i++)
       if (i != thiz->cache_user_idx)
         thiz->subtables[i].apply_cached_func = thiz->subtables[i].apply_func;
@@ -4332,6 +4461,17 @@ struct hb_ot_layout_lookup_accelerator_t
     return thiz;
   }
 
+  void fini ()
+  {
+#ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
+    if (cache)
+    {
+      assert (cache_user_idx != (unsigned) -1);
+      subtables[cache_user_idx].cache_func (cache, hb_ot_lookup_cache_op_t::DESTROY);
+    }
+#endif
+  }
+
   bool may_have (hb_codepoint_t g) const
   { return digest.may_have (g); }
 
@@ -4340,6 +4480,7 @@ struct hb_ot_layout_lookup_accelerator_t
 #endif
   bool apply (hb_ot_apply_context_t *c, unsigned subtables_count, bool use_cache) const
   {
+    c->lookup_accel = this;
 #ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
     if (use_cache)
     {
@@ -4379,10 +4520,13 @@ struct hb_ot_layout_lookup_accelerator_t
 
 
   hb_set_digest_t digest;
-  private:
 #ifndef HB_NO_OT_LAYOUT_LOOKUP_CACHE
+  public:
+  void *cache = nullptr;
+  private:
   unsigned cache_user_idx = (unsigned) -1;
 #endif
+  private:
   hb_accelerate_subtables_context_t::hb_applicable_t subtables[HB_VAR_ARRAY];
 };
 
@@ -4472,13 +4616,6 @@ struct GSUBGPOSVersion1_2
       if (!c->subset_context->serializer->extend_min (&out->featureVars))
         return_trace (false);
 
-      // TODO(qxliu76): the current implementation doesn't correctly handle feature variations
-      //                that are dropped by instancing when the associated conditions don't trigger.
-      //                Since partial instancing isn't yet supported this isn't an issue yet but will
-      //                need to be fixed for partial instancing.
-
-
-
       // if all axes are pinned all feature vars are dropped.
       bool ret = !c->subset_context->plan->all_axes_pinned
                  && out->featureVars.serialize_subset (c->subset_context, featureVars, this, c);
@@ -4500,9 +4637,9 @@ struct GSUBGPOS
   unsigned int get_size () const
   {
     switch (u.version.major) {
-    case 1: return u.version1.get_size ();
+    case 1: hb_barrier (); return u.version1.get_size ();
 #ifndef HB_NO_BEYOND_64K
-    case 2: return u.version2.get_size ();
+    case 2: hb_barrier (); return u.version2.get_size ();
 #endif
     default: return u.version.static_size;
     }
@@ -4513,10 +4650,11 @@ struct GSUBGPOS
   {
     TRACE_SANITIZE (this);
     if (unlikely (!u.version.sanitize (c))) return_trace (false);
+    hb_barrier ();
     switch (u.version.major) {
-    case 1: return_trace (u.version1.sanitize (c));
+    case 1: hb_barrier (); return_trace (u.version1.sanitize (c));
 #ifndef HB_NO_BEYOND_64K
-    case 2: return_trace (u.version2.sanitize (c));
+    case 2: hb_barrier (); return_trace (u.version2.sanitize (c));
 #endif
     default: return_trace (true);
     }
@@ -4526,9 +4664,9 @@ struct GSUBGPOS
   bool subset (hb_subset_layout_context_t *c) const
   {
     switch (u.version.major) {
-    case 1: return u.version1.subset (c);
+    case 1: hb_barrier (); return u.version1.subset (c);
 #ifndef HB_NO_BEYOND_64K
-    case 2: return u.version2.subset (c);
+    case 2: hb_barrier (); return u.version2.subset (c);
 #endif
     default: return false;
     }
@@ -4537,9 +4675,9 @@ struct GSUBGPOS
   const ScriptList &get_script_list () const
   {
     switch (u.version.major) {
-    case 1: return this+u.version1.scriptList;
+    case 1: hb_barrier (); return this+u.version1.scriptList;
 #ifndef HB_NO_BEYOND_64K
-    case 2: return this+u.version2.scriptList;
+    case 2: hb_barrier (); return this+u.version2.scriptList;
 #endif
     default: return Null (ScriptList);
     }
@@ -4547,9 +4685,9 @@ struct GSUBGPOS
   const FeatureList &get_feature_list () const
   {
     switch (u.version.major) {
-    case 1: return this+u.version1.featureList;
+    case 1: hb_barrier (); return this+u.version1.featureList;
 #ifndef HB_NO_BEYOND_64K
-    case 2: return this+u.version2.featureList;
+    case 2: hb_barrier (); return this+u.version2.featureList;
 #endif
     default: return Null (FeatureList);
     }
@@ -4557,9 +4695,9 @@ struct GSUBGPOS
   unsigned int get_lookup_count () const
   {
     switch (u.version.major) {
-    case 1: return (this+u.version1.lookupList).len;
+    case 1: hb_barrier (); return (this+u.version1.lookupList).len;
 #ifndef HB_NO_BEYOND_64K
-    case 2: return (this+u.version2.lookupList).len;
+    case 2: hb_barrier (); return (this+u.version2.lookupList).len;
 #endif
     default: return 0;
     }
@@ -4567,9 +4705,9 @@ struct GSUBGPOS
   const Lookup& get_lookup (unsigned int i) const
   {
     switch (u.version.major) {
-    case 1: return (this+u.version1.lookupList)[i];
+    case 1: hb_barrier (); return (this+u.version1.lookupList)[i];
 #ifndef HB_NO_BEYOND_64K
-    case 2: return (this+u.version2.lookupList)[i];
+    case 2: hb_barrier (); return (this+u.version2.lookupList)[i];
 #endif
     default: return Null (Lookup);
     }
@@ -4577,9 +4715,9 @@ struct GSUBGPOS
   const FeatureVariations &get_feature_variations () const
   {
     switch (u.version.major) {
-    case 1: return (u.version.to_int () >= 0x00010001u ? this+u.version1.featureVars : Null (FeatureVariations));
+    case 1: hb_barrier (); return (u.version.to_int () >= 0x00010001u && hb_barrier () ? this+u.version1.featureVars : Null (FeatureVariations));
 #ifndef HB_NO_BEYOND_64K
-    case 2: return this+u.version2.featureVars;
+    case 2: hb_barrier (); return this+u.version2.featureVars;
 #endif
     default: return Null (FeatureVariations);
     }
@@ -4613,13 +4751,14 @@ struct GSUBGPOS
   { return get_feature_list ().find_index (tag, index); }
 
   bool find_variations_index (const int *coords, unsigned int num_coords,
-                              unsigned int *index) const
+                              unsigned int *index,
+                              ItemVarStoreInstancer *instancer) const
   {
 #ifdef HB_NO_VAR
     *index = FeatureVariations::NOT_FOUND_INDEX;
     return false;
 #endif
-    return get_feature_variations ().find_index (coords, num_coords, index);
+    return get_feature_variations ().find_index (coords, num_coords, index, instancer);
   }
   const Feature& get_feature_variation (unsigned int feature_index,
                                         unsigned int variations_index) const
@@ -4638,11 +4777,11 @@ struct GSUBGPOS
   }
 
   void feature_variation_collect_lookups (const hb_set_t *feature_indexes,
-                                          const hb_hashmap_t *feature_substitutes_map,
+                                          const hb_hashmap_t> *feature_record_cond_idx_map,
                                           hb_set_t       *lookup_indexes /* OUT */) const
   {
 #ifndef HB_NO_VAR
-    get_feature_variations ().collect_lookups (feature_indexes, feature_substitutes_map, lookup_indexes);
+    get_feature_variations ().collect_lookups (feature_indexes, feature_record_cond_idx_map, lookup_indexes);
 #endif
   }
 
@@ -4772,7 +4911,12 @@ struct GSUBGPOS
     ~accelerator_t ()
     {
       for (unsigned int i = 0; i < this->lookup_count; i++)
-        hb_free (this->accels[i]);
+      {
+        auto *accel = this->accels[i].get_relaxed ();
+        if (accel)
+          accel->fini ();
+        hb_free (accel);
+      }
       hb_free (this->accels);
       this->table.destroy ();
     }
@@ -4793,6 +4937,7 @@ struct GSUBGPOS
 
         if (unlikely (!accels[lookup_index].cmpexch (nullptr, accel)))
         {
+          accel->fini ();
           hb_free (accel);
           goto retry;
         }
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-layout-jstf-table.hh b/src/java.desktop/share/native/libharfbuzz/hb-ot-layout-jstf-table.hh
index 948c88269251..823520f74834 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-ot-layout-jstf-table.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-layout-jstf-table.hh
@@ -214,6 +214,7 @@ struct JSTF
   {
     TRACE_SANITIZE (this);
     return_trace (version.sanitize (c) &&
+                  hb_barrier () &&
                   likely (version.major == 1) &&
                   scriptList.sanitize (c, this));
   }
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-layout.cc b/src/java.desktop/share/native/libharfbuzz/hb-ot-layout.cc
index 49465acb75e2..787119dc62b3 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-ot-layout.cc
+++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-layout.cc
@@ -87,7 +87,7 @@ using OT::Layout::GPOS;
 bool
 hb_ot_layout_has_kerning (hb_face_t *face)
 {
-  return face->table.kern->has_data ();
+  return face->table.kern->table->has_data ();
 }
 
 /**
@@ -103,7 +103,7 @@ hb_ot_layout_has_kerning (hb_face_t *face)
 bool
 hb_ot_layout_has_machine_kerning (hb_face_t *face)
 {
-  return face->table.kern->has_state_machine ();
+  return face->table.kern->table->has_state_machine ();
 }
 
 /**
@@ -123,7 +123,7 @@ hb_ot_layout_has_machine_kerning (hb_face_t *face)
 bool
 hb_ot_layout_has_cross_kerning (hb_face_t *face)
 {
-  return face->table.kern->has_cross_stream ();
+  return face->table.kern->table->has_cross_stream ();
 }
 
 void
@@ -132,7 +132,7 @@ hb_ot_layout_kern (const hb_ot_shape_plan_t *plan,
                    hb_buffer_t  *buffer)
 {
   hb_blob_t *blob = font->face->table.kern.get_blob ();
-  const AAT::kern& kern = *blob->as ();
+  const auto& kern = *font->face->table.kern;
 
   AAT::hb_aat_apply_context_t c (plan, font, buffer, blob);
 
@@ -246,6 +246,18 @@ OT::GDEF::is_blocklisted (hb_blob_t *blob,
     /* sha1sum: c26e41d567ed821bed997e937bc0c41435689e85  Padauk.ttf
      *  "Padauk Regular" "Version 2.5", see https://crbug.com/681813 */
     case HB_CODEPOINT_ENCODE3 (1004, 59092, 14836):
+    /* 88d2006ca084f04af2df1954ed714a8c71e8400f  Courier New.ttf from macOS 15 */
+    case HB_CODEPOINT_ENCODE3 (588, 5078, 14418):
+    /* 608e3ebb6dd1aee521cff08eb07d500a2c59df68  Courier New Bold.ttf from macOS 15 */
+    case HB_CODEPOINT_ENCODE3 (588, 5078, 14238):
+    /* d13221044ff054efd78f1cd8631b853c3ce85676  cour.ttf from Windows 10 */
+    case HB_CODEPOINT_ENCODE3 (894, 17162, 33960):
+    /* 68ed4a22d8067fcf1622ac6f6e2f4d3a2e3ec394  courbd.ttf from Windows 10 */
+    case HB_CODEPOINT_ENCODE3 (894, 17154, 34472):
+    /* 4cdb0259c96b7fd7c103821bb8f08f7cc6b211d7  cour.ttf from Windows 8.1 */
+    case HB_CODEPOINT_ENCODE3 (816, 7868, 17052):
+    /* 920483d8a8ed37f7f0afdabbe7f679aece7c75d8  courbd.ttf from Windows 8.1 */
+    case HB_CODEPOINT_ENCODE3 (816, 7868, 17138):
       return true;
   }
   return false;
@@ -1443,8 +1455,12 @@ hb_ot_layout_table_find_feature_variations (hb_face_t    *face,
                                             unsigned int *variations_index /* out */)
 {
   const OT::GSUBGPOS &g = get_gsubgpos_table (face, table_tag);
+  const OT::GDEF &gdef = *face->table.GDEF->table;
 
-  return g.find_variations_index (coords, num_coords, variations_index);
+  auto instancer = OT::ItemVarStoreInstancer(&gdef.get_var_store(), nullptr,
+                                             hb_array (coords, num_coords));
+
+  return g.find_variations_index (coords, num_coords, variations_index, &instancer);
 }
 
 
@@ -1907,9 +1923,10 @@ apply_forward (OT::hb_ot_apply_context_t *c,
   while (buffer->idx < buffer->len && buffer->successful)
   {
     bool applied = false;
-    if (accel.digest.may_have (buffer->cur().codepoint) &&
-        (buffer->cur().mask & c->lookup_mask) &&
-        c->check_glyph_property (&buffer->cur(), c->lookup_props))
+    auto &cur = buffer->cur();
+    if (accel.digest.may_have (cur.codepoint) &&
+        (cur.mask & c->lookup_mask) &&
+        c->check_glyph_property (&cur, c->lookup_props))
      {
        applied = accel.apply (c, subtable_count, use_cache);
      }
@@ -1935,9 +1952,10 @@ apply_backward (OT::hb_ot_apply_context_t *c,
   hb_buffer_t *buffer = c->buffer;
   do
   {
-    if (accel.digest.may_have (buffer->cur().codepoint) &&
-        (buffer->cur().mask & c->lookup_mask) &&
-        c->check_glyph_property (&buffer->cur(), c->lookup_props))
+    auto &cur = buffer->cur();
+    if (accel.digest.may_have (cur.codepoint) &&
+        (cur.mask & c->lookup_mask) &&
+        c->check_glyph_property (&cur, c->lookup_props))
       ret |= accel.apply (c, subtable_count, false);
 
     /* The reverse lookup doesn't "advance" cursor (for good reason). */
@@ -2017,7 +2035,7 @@ inline void hb_ot_map_t::apply (const Proxy &proxy,
        * (plus some past glyphs).
        *
        * Only try applying the lookup if there is any overlap. */
-      if (accel->digest.may_have (c.digest))
+      if (accel->digest.may_intersect (c.digest))
       {
         c.set_lookup_index (lookup_index);
         c.set_lookup_mask (lookup.mask, false);
@@ -2043,7 +2061,7 @@ inline void hb_ot_map_t::apply (const Proxy &proxy,
       if (stage->pause_func (plan, font, buffer))
       {
         /* Refresh working buffer digest since buffer changed. */
-        c.digest = buffer->digest ();
+        buffer->collect_codepoints (c.digest);
       }
     }
   }
@@ -2127,7 +2145,7 @@ hb_ot_layout_get_font_extents (hb_font_t         *font,
                                hb_tag_t           language_tag,
                                hb_font_extents_t *extents)
 {
-  hb_position_t min, max;
+  hb_position_t min = 0, max = 0;
   if (font->face->table.BASE->get_min_max (font, direction, script_tag, language_tag, HB_TAG_NONE,
                                            &min, &max))
   {
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-layout.hh b/src/java.desktop/share/native/libharfbuzz/hb-ot-layout.hh
index 2d9a184a8933..71074a87401d 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-ot-layout.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-layout.hh
@@ -173,12 +173,12 @@ _hb_next_syllable (hb_buffer_t *buffer, unsigned int start)
 
 /* Design:
  * unicode_props() is a two-byte number.  The low byte includes:
- * - General_Category: 5 bits.
+ * - Modified General_Category: 5 bits.
  * - A bit each for:
  *   * Is it Default_Ignorable(); we have a modified Default_Ignorable().
  *   * Whether it's one of the four Mongolian Free Variation Selectors,
  *     CGJ, or other characters that are hidden but should not be ignored
- *     like most other Default_Ignorable()s do during matching.
+ *     like most other Default_Ignorable()s do during GSUB matching.
  *   * Whether it's a grapheme continuation.
  *
  * The high-byte has different meanings, switched by the Gen-Cat:
@@ -186,17 +186,23 @@ _hb_next_syllable (hb_buffer_t *buffer, unsigned int start)
  * - For Cf: whether it's ZWJ, ZWNJ, or something else.
  * - For Ws: index of which space character this is, if space fallback
  *   is needed, ie. we don't set this by default, only if asked to.
+ *
+ * Above I said "modified" General_Category. This is because we need to
+ * remember Variation Selectors, and we don't have bits left. So we
+ * change their Gen_Cat from Mn to Cf, and use a bit of the high byte to
+ * remember them.
  */
 
 enum hb_unicode_props_flags_t {
   UPROPS_MASK_GEN_CAT   = 0x001Fu,
   UPROPS_MASK_IGNORABLE = 0x0020u,
-  UPROPS_MASK_HIDDEN    = 0x0040u, /* MONGOLIAN FREE VARIATION SELECTOR 1..4, or TAG characters */
+  UPROPS_MASK_HIDDEN    = 0x0040u, /* MONGOLIAN FREE VARIATION SELECTOR 1..4, or TAG characters, or CGJ sometimes */
   UPROPS_MASK_CONTINUATION=0x0080u,
 
   /* If GEN_CAT=FORMAT, top byte masks: */
   UPROPS_MASK_Cf_ZWJ    = 0x0100u,
-  UPROPS_MASK_Cf_ZWNJ   = 0x0200u
+  UPROPS_MASK_Cf_ZWNJ   = 0x0200u,
+  UPROPS_MASK_Cf_VS     = 0x0400u
 };
 HB_MARK_AS_FLAG_T (hb_unicode_props_flags_t);
 
@@ -229,7 +235,7 @@ _hb_glyph_info_set_unicode_props (hb_glyph_info_t *info, hb_buffer_t *buffer)
       /* TAG characters need similar treatment. Fixes:
        * https://github.com/harfbuzz/harfbuzz/issues/463 */
       else if (unlikely (hb_in_range (u, 0xE0020u, 0xE007Fu))) props |= UPROPS_MASK_HIDDEN;
-      /* COMBINING GRAPHEME JOINER should not be skipped; at least some times.
+      /* COMBINING GRAPHEME JOINER should not be skipped during GSUB either.
        * https://github.com/harfbuzz/harfbuzz/issues/554 */
       else if (unlikely (u == 0x034Fu))
       {
@@ -302,6 +308,27 @@ _hb_glyph_info_get_unicode_space_fallback_type (const hb_glyph_info_t *info)
          (hb_unicode_funcs_t::space_t) (info->unicode_props()>>8) :
          hb_unicode_funcs_t::NOT_SPACE;
 }
+static inline bool
+_hb_glyph_info_is_variation_selector (const hb_glyph_info_t *info)
+{
+  return _hb_glyph_info_get_general_category (info) ==
+         HB_UNICODE_GENERAL_CATEGORY_FORMAT &&
+         (info->unicode_props() & UPROPS_MASK_Cf_VS);
+}
+static inline void
+_hb_glyph_info_set_variation_selector (hb_glyph_info_t *info, bool customize)
+{
+  if (customize)
+  {
+    _hb_glyph_info_set_general_category (info, HB_UNICODE_GENERAL_CATEGORY_FORMAT);
+    info->unicode_props() |= UPROPS_MASK_Cf_VS;
+  }
+  else
+  {
+    // Reset to their original condition
+    _hb_glyph_info_set_general_category (info, HB_UNICODE_GENERAL_CATEGORY_NON_SPACING_MARK);
+  }
+}
 
 static inline bool _hb_glyph_info_substituted (const hb_glyph_info_t *info);
 
@@ -311,12 +338,20 @@ _hb_glyph_info_is_default_ignorable (const hb_glyph_info_t *info)
   return (info->unicode_props() & UPROPS_MASK_IGNORABLE) &&
          !_hb_glyph_info_substituted (info);
 }
+static inline void
+_hb_glyph_info_set_default_ignorable (hb_glyph_info_t *info)
+{
+  info->unicode_props() |= UPROPS_MASK_IGNORABLE;
+}
+static inline void
+_hb_glyph_info_clear_default_ignorable (hb_glyph_info_t *info)
+{
+  info->unicode_props() &= ~ UPROPS_MASK_IGNORABLE;
+}
 static inline bool
-_hb_glyph_info_is_default_ignorable_and_not_hidden (const hb_glyph_info_t *info)
+_hb_glyph_info_is_hidden (const hb_glyph_info_t *info)
 {
-  return ((info->unicode_props() & (UPROPS_MASK_IGNORABLE|UPROPS_MASK_HIDDEN))
-          == UPROPS_MASK_IGNORABLE) &&
-         !_hb_glyph_info_substituted (info);
+  return info->unicode_props() & UPROPS_MASK_HIDDEN;
 }
 static inline void
 _hb_glyph_info_unhide (hb_glyph_info_t *info)
@@ -330,7 +365,7 @@ _hb_glyph_info_set_continuation (hb_glyph_info_t *info)
   info->unicode_props() |= UPROPS_MASK_CONTINUATION;
 }
 static inline void
-_hb_glyph_info_reset_continuation (hb_glyph_info_t *info)
+_hb_glyph_info_clear_continuation (hb_glyph_info_t *info)
 {
   info->unicode_props() &= ~ UPROPS_MASK_CONTINUATION;
 }
@@ -603,8 +638,7 @@ _hb_buffer_assert_gsubgpos_vars (hb_buffer_t *buffer)
 }
 
 /* Make sure no one directly touches our props... */
-#undef unicode_props0
-#undef unicode_props1
+#undef unicode_props
 #undef lig_props
 #undef glyph_props
 
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-map.cc b/src/java.desktop/share/native/libharfbuzz/hb-ot-map.cc
index 261ce43049c6..a0cdfddfa632 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-ot-map.cc
+++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-map.cc
@@ -390,5 +390,19 @@ hb_ot_map_builder_t::compile (hb_ot_map_t                  &m,
   }
 }
 
+unsigned int hb_ot_map_t::get_feature_tags (unsigned int start_offset, unsigned int *tag_count, hb_tag_t *tags) const
+{
+  if (tag_count)
+  {
+    auto sub_features = features.as_array ().sub_array (start_offset, tag_count);
+    if (tags)
+    {
+      for (unsigned int i = 0; i < sub_features.length; i++)
+        tags[i] = sub_features[i].tag;
+    }
+  }
+
+  return features.length;
+}
 
 #endif
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-map.hh b/src/java.desktop/share/native/libharfbuzz/hb-ot-map.hh
index 110361552c02..68af9792439f 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-ot-map.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-map.hh
@@ -166,6 +166,9 @@ struct hb_ot_map_t
                           const struct hb_ot_shape_plan_t *plan, hb_font_t *font, hb_buffer_t *buffer) const;
   HB_INTERNAL void substitute (const struct hb_ot_shape_plan_t *plan, hb_font_t *font, hb_buffer_t *buffer) const;
   HB_INTERNAL void position (const struct hb_ot_shape_plan_t *plan, hb_font_t *font, hb_buffer_t *buffer) const;
+  HB_INTERNAL unsigned int get_feature_tags (unsigned int  start_offset,
+                                             unsigned int *tag_count, /* IN/OUT */
+                                             hb_tag_t     *tags /* OUT */) const;
 
   public:
   hb_tag_t chosen_script[2];
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-math-table.hh b/src/java.desktop/share/native/libharfbuzz/hb-ot-math-table.hh
index 63bcd132cf43..c1b2a27b21d6 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-ot-math-table.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-math-table.hh
@@ -333,6 +333,7 @@ struct MathKern
   {
     TRACE_SANITIZE (this);
     return_trace (c->check_struct (this) &&
+                  hb_barrier () &&
                   c->check_array (mathValueRecordsZ.arrayZ, 2 * heightCount + 1) &&
                   sanitize_math_value_records (c));
   }
@@ -343,27 +344,20 @@ struct MathKern
     const MathValueRecord* kernValue = mathValueRecordsZ.arrayZ + heightCount;
     int sign = font->y_scale < 0 ? -1 : +1;
 
-    /* The description of the MathKern table is a ambiguous, but interpreting
-     * "between the two heights found at those indexes" for 0 < i < len as
-     *
-     *   correctionHeight[i-1] < correction_height <= correctionHeight[i]
-     *
-     * makes the result consistent with the limit cases and we can just use the
-     * binary search algorithm of std::upper_bound:
+    /* According to OpenType spec (v1.9), except for the boundary cases, the index
+     * chosen for kern value should be i such that
+     *    correctionHeight[i-1] <= correction_height < correctionHeight[i]
+     * We can use the binary search algorithm of std::upper_bound(). Or, we can
+     * use the internal hb_bsearch_impl.
      */
-    unsigned int i = 0;
-    unsigned int count = heightCount;
-    while (count > 0)
-    {
-      unsigned int half = count / 2;
-      hb_position_t height = correctionHeight[i + half].get_y_value (font, this);
-      if (sign * height < sign * correction_height)
-      {
-        i += half + 1;
-        count -= half + 1;
-      } else
-        count = half;
-    }
+    unsigned int pos;
+    auto cmp = +[](const void* key, const void* p,
+                   int sign, hb_font_t* font, const MathKern* mathKern) -> int {
+      return sign * *(hb_position_t*)key - sign * ((MathValueRecord*)p)->get_y_value(font, mathKern);
+    };
+    unsigned int i = hb_bsearch_impl(&pos, correction_height, correctionHeight,
+                                     heightCount, MathValueRecord::static_size,
+                                     cmp, sign, font, this) ? pos + 1 : pos;
     return kernValue[i].get_x_value (font, this);
   }
 
@@ -984,6 +978,7 @@ struct MathVariants
     return_trace (c->check_struct (this) &&
                   vertGlyphCoverage.sanitize (c, this) &&
                   horizGlyphCoverage.sanitize (c, this) &&
+                  hb_barrier () &&
                   c->check_array (glyphConstruction.arrayZ, vertGlyphCount + horizGlyphCount) &&
                   sanitize_offsets (c));
   }
@@ -1103,6 +1098,7 @@ struct MATH
     TRACE_SANITIZE (this);
     return_trace (version.sanitize (c) &&
                   likely (version.major == 1) &&
+                  hb_barrier () &&
                   mathConstants.sanitize (c, this) &&
                   mathGlyphInfo.sanitize (c, this) &&
                   mathVariants.sanitize (c, this));
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-maxp-table.hh b/src/java.desktop/share/native/libharfbuzz/hb-ot-maxp-table.hh
index f7f2e860e4a9..f6eeda40ed67 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-ot-maxp-table.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-maxp-table.hh
@@ -85,7 +85,7 @@ struct maxp
     TRACE_SANITIZE (this);
     if (unlikely (!c->check_struct (this)))
       return_trace (false);
-
+    hb_barrier ();
     if (version.major == 1)
     {
       const maxpV1Tail &v1 = StructAfter (*this);
@@ -103,6 +103,7 @@ struct maxp
     maxp_prime->numGlyphs = hb_min (c->plan->num_output_glyphs (), 0xFFFFu);
     if (maxp_prime->version.major == 1)
     {
+      hb_barrier ();
       const maxpV1Tail *src_v1 = &StructAfter (*this);
       maxpV1Tail *dest_v1 = c->serializer->embed (src_v1);
       if (unlikely (!dest_v1)) return_trace (false);
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-meta-table.hh b/src/java.desktop/share/native/libharfbuzz/hb-ot-meta-table.hh
index 1f011882807a..20c62b83edbe 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-ot-meta-table.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-meta-table.hh
@@ -51,6 +51,7 @@ struct DataMap
   {
     TRACE_SANITIZE (this);
     return_trace (likely (c->check_struct (this) &&
+                          hb_barrier () &&
                           dataZ.sanitize (c, base, dataLength)));
   }
 
@@ -101,6 +102,7 @@ struct meta
   {
     TRACE_SANITIZE (this);
     return_trace (likely (c->check_struct (this) &&
+                          hb_barrier () &&
                           version == 1 &&
                           dataMaps.sanitize (c, this)));
   }
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-os2-table.hh b/src/java.desktop/share/native/libharfbuzz/hb-ot-os2-table.hh
index 30ae335d703f..24e9c9703531 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-ot-os2-table.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-os2-table.hh
@@ -209,6 +209,23 @@ struct OS2
     return ret;
   }
 
+  static unsigned calc_avg_char_width (const hb_hashmap_t>& hmtx_map)
+  {
+    unsigned num = 0;
+    unsigned total_width = 0;
+    for (const auto& _ : hmtx_map.values_ref ())
+    {
+      unsigned width = _.first;
+      if (width)
+      {
+        total_width += width;
+        num++;
+      }
+    }
+
+    return num ? (unsigned) roundf ((double) total_width / (double) num) : 0;
+  }
+
   bool subset (hb_subset_context_t *c) const
   {
     TRACE_SUBSET (this);
@@ -239,17 +256,23 @@ struct OS2
 
       if (os2_prime->version >= 2)
       {
+        hb_barrier ();
         auto *table = & const_cast (os2_prime->v2 ());
         HB_ADD_MVAR_VAR (HB_OT_METRICS_TAG_X_HEIGHT,                   sxHeight);
         HB_ADD_MVAR_VAR (HB_OT_METRICS_TAG_CAP_HEIGHT,                 sCapHeight);
       }
+
+      unsigned avg_char_width = calc_avg_char_width (c->plan->hmtx_map);
+      if (!c->serializer->check_assign (os2_prime->xAvgCharWidth, avg_char_width,
+                                        HB_SERIALIZE_ERROR_INT_OVERFLOW))
+        return_trace (false);
     }
 #endif
 
     Triple *axis_range;
     if (c->plan->user_axes_location.has (HB_TAG ('w','g','h','t'), &axis_range))
     {
-      unsigned weight_class = static_cast (roundf (hb_clamp (axis_range->middle, 1.0f, 1000.0f)));
+      unsigned weight_class = static_cast (roundf (hb_clamp (axis_range->middle, 1.0, 1000.0)));
       if (os2_prime->usWeightClass != weight_class)
         os2_prime->usWeightClass = weight_class;
     }
@@ -261,12 +284,12 @@ struct OS2
         os2_prime->usWidthClass = width_class;
     }
 
+    os2_prime->usFirstCharIndex = hb_min (0xFFFFu, c->plan->os2_info.min_cmap_codepoint);
+    os2_prime->usLastCharIndex  = hb_min (0xFFFFu, c->plan->os2_info.max_cmap_codepoint);
+
     if (c->plan->flags & HB_SUBSET_FLAGS_NO_PRUNE_UNICODE_RANGES)
       return_trace (true);
 
-    os2_prime->usFirstCharIndex = hb_min (0xFFFFu, c->plan->unicodes.get_min ());
-    os2_prime->usLastCharIndex  = hb_min (0xFFFFu, c->plan->unicodes.get_max ());
-
     _update_unicode_ranges (&c->plan->unicodes, os2_prime->ulUnicodeRange);
 
     return_trace (true);
@@ -334,6 +357,7 @@ struct OS2
   {
     TRACE_SANITIZE (this);
     if (unlikely (!c->check_struct (this))) return_trace (false);
+    hb_barrier ();
     if (unlikely (version >= 1 && !v1X.sanitize (c))) return_trace (false);
     if (unlikely (version >= 2 && !v2X.sanitize (c))) return_trace (false);
     if (unlikely (version >= 5 && !v5X.sanitize (c))) return_trace (false);
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-post-table-v2subset.hh b/src/java.desktop/share/native/libharfbuzz/hb-ot-post-table-v2subset.hh
index d44233610a69..67d1b6aa713a 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-ot-post-table-v2subset.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-post-table-v2subset.hh
@@ -84,9 +84,9 @@ HB_INTERNAL bool postV2Tail::subset (hb_subset_context_t *c) const
   old_gid_new_index_map.alloc (num_glyphs);
   glyph_name_to_new_index.alloc (num_glyphs);
 
-  for (hb_codepoint_t new_gid = 0; new_gid < num_glyphs; new_gid++)
+  for (auto _ : c->plan->new_to_old_gid_list)
   {
-    hb_codepoint_t old_gid = reverse_glyph_map.get (new_gid);
+    hb_codepoint_t old_gid = _.second;
     unsigned old_index = glyphNameIndex[old_gid];
 
     unsigned new_index;
@@ -125,13 +125,22 @@ HB_INTERNAL bool postV2Tail::subset (hb_subset_context_t *c) const
     old_gid_new_index_map.set (old_gid, new_index);
   }
 
+  if (old_gid_new_index_map.in_error())
+    return_trace (false);
+
   auto index_iter =
   + hb_range (num_glyphs)
-  | hb_map (reverse_glyph_map)
-  | hb_map_retains_sorting ([&](hb_codepoint_t old_gid)
+  | hb_map_retains_sorting ([&](hb_codepoint_t new_gid)
                             {
-                              unsigned new_index = old_gid_new_index_map.get (old_gid);
-                              return hb_pair_t (old_gid, new_index);
+                              hb_codepoint_t *old_gid;
+                              /* use 0 for retain-gid holes, which refers to the name .notdef,
+                               * as the glyphNameIndex entry for that glyph ID."*/
+                              unsigned new_index = 0;
+                              if (reverse_glyph_map.has (new_gid, &old_gid)) {
+                                new_index = old_gid_new_index_map.get (*old_gid);
+                                return hb_pair_t (*old_gid, new_index);
+                              }
+                              return hb_pair_t (new_gid, new_index);
                             })
   ;
 
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-post-table.hh b/src/java.desktop/share/native/libharfbuzz/hb-ot-post-table.hh
index d41c86f8bd31..83d310e16a0a 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-ot-post-table.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-post-table.hh
@@ -116,13 +116,16 @@ struct post
     Triple *axis_range;
     if (c->plan->user_axes_location.has (HB_TAG ('s','l','n','t'), &axis_range))
     {
-      float italic_angle = hb_max (-90.f, hb_min (axis_range->middle, 90.f));
+      float italic_angle = hb_max (-90.0, hb_min (axis_range->middle, 90.0));
       if (post_prime->italicAngle.to_float () != italic_angle)
         post_prime->italicAngle.set_float (italic_angle);
     }
 
     if (glyph_names && version.major == 2)
+    {
+      hb_barrier ();
       return_trace (v2X.subset (c));
+    }
 
     return_trace (true);
   }
@@ -138,6 +141,7 @@ struct post
 
       version = table->version.to_int ();
       if (version != 0x00020000) return;
+      hb_barrier ();
 
       const postV2Tail &v2 = table->v2X;
 
@@ -217,10 +221,16 @@ struct post
     unsigned int get_glyph_count () const
     {
       if (version == 0x00010000)
+      {
+        hb_barrier ();
         return format1_names_length;
+      }
 
       if (version == 0x00020000)
+      {
+        hb_barrier ();
         return glyphNameIndex->len;
+      }
 
       return 0;
     }
@@ -245,13 +255,18 @@ struct post
     {
       if (version == 0x00010000)
       {
+        hb_barrier ();
         if (glyph >= format1_names_length)
           return hb_bytes_t ();
 
         return format1_names (glyph);
       }
 
-      if (version != 0x00020000 || glyph >= glyphNameIndex->len)
+      if (version != 0x00020000)
+        return hb_bytes_t ();
+      hb_barrier ();
+
+      if (glyph >= glyphNameIndex->len)
         return hb_bytes_t ();
 
       unsigned int index = glyphNameIndex->arrayZ[glyph];
@@ -284,8 +299,9 @@ struct post
   {
     TRACE_SANITIZE (this);
     return_trace (c->check_struct (this) &&
+                  hb_barrier () &&
                   (version.to_int () == 0x00010000 ||
-                   (version.to_int () == 0x00020000 && v2X.sanitize (c)) ||
+                   (version.to_int () == 0x00020000 && hb_barrier () && v2X.sanitize (c)) ||
                    version.to_int () == 0x00030000));
   }
 
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-shape-normalize.cc b/src/java.desktop/share/native/libharfbuzz/hb-ot-shape-normalize.cc
index b1acc7e7db3c..cb941bc7fbd2 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-ot-shape-normalize.cc
+++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-shape-normalize.cc
@@ -74,23 +74,6 @@
  *     Indic shaper may want to disallow recomposing of two matras.
  */
 
-static bool
-decompose_unicode (const hb_ot_shape_normalize_context_t *c,
-                   hb_codepoint_t  ab,
-                   hb_codepoint_t *a,
-                   hb_codepoint_t *b)
-{
-  return (bool) c->unicode->decompose (ab, a, b);
-}
-
-static bool
-compose_unicode (const hb_ot_shape_normalize_context_t *c,
-                 hb_codepoint_t  a,
-                 hb_codepoint_t  b,
-                 hb_codepoint_t *ab)
-{
-  return (bool) c->unicode->compose (a, b, ab);
-}
 
 static inline void
 set_glyph (hb_glyph_info_t &info, hb_font_t *font)
@@ -170,7 +153,7 @@ decompose_current_character (const hb_ot_shape_normalize_context_t *c, bool shor
   hb_codepoint_t u = buffer->cur().codepoint;
   hb_codepoint_t glyph = 0;
 
-  if (shortest && c->font->get_nominal_glyph (u, &glyph, c->not_found))
+  if (shortest && c->font->get_nominal_glyph (u, &glyph, buffer->not_found))
   {
     next_char (buffer, glyph);
     return;
@@ -182,7 +165,7 @@ decompose_current_character (const hb_ot_shape_normalize_context_t *c, bool shor
     return;
   }
 
-  if (!shortest && c->font->get_nominal_glyph (u, &glyph, c->not_found))
+  if (!shortest && c->font->get_nominal_glyph (u, &glyph, buffer->not_found))
   {
     next_char (buffer, glyph);
     return;
@@ -237,6 +220,12 @@ handle_variation_selector_cluster (const hb_ot_shape_normalize_context_t *c,
         /* Just pass on the two characters separately, let GSUB do its magic. */
         set_glyph (buffer->cur(), font);
         (void) buffer->next_glyph ();
+
+        buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_VARIATION_SELECTOR_FALLBACK;
+        _hb_glyph_info_set_variation_selector (&buffer->cur(), true);
+        if (buffer->not_found_variation_selector != HB_CODEPOINT_INVALID)
+          _hb_glyph_info_clear_default_ignorable (&buffer->cur());
+
         set_glyph (buffer->cur(), font);
         (void) buffer->next_glyph ();
       }
@@ -307,15 +296,15 @@ _hb_ot_shape_normalize (const hb_ot_shape_plan_t *plan,
       mode = HB_OT_SHAPE_NORMALIZATION_MODE_COMPOSED_DIACRITICS;
   }
 
-  const hb_ot_shape_normalize_context_t c = {
+  hb_ot_shape_normalize_context_t c = {
     plan,
     buffer,
     font,
     buffer->unicode,
-    buffer->not_found,
-    plan->shaper->decompose ? plan->shaper->decompose : decompose_unicode,
-    plan->shaper->compose   ? plan->shaper->compose   : compose_unicode
+    plan->shaper->decompose ? plan->shaper->decompose : hb_ot_shape_normalize_context_t::decompose_unicode,
+    plan->shaper->compose   ? plan->shaper->compose   : hb_ot_shape_normalize_context_t::compose_unicode
   };
+  c.override_decompose_and_compose (plan->shaper->decompose, plan->shaper->compose);
 
   bool always_short_circuit = mode == HB_OT_SHAPE_NORMALIZATION_MODE_NONE;
   bool might_short_circuit = always_short_circuit ||
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-shape-normalize.hh b/src/java.desktop/share/native/libharfbuzz/hb-ot-shape-normalize.hh
index afd62dd40726..9f17bdbb2432 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-ot-shape-normalize.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-shape-normalize.hh
@@ -28,6 +28,7 @@
 #define HB_OT_SHAPE_NORMALIZE_HH
 
 #include "hb.hh"
+#include "hb-unicode.hh"
 
 
 /* buffer var allocations, used during the normalization process */
@@ -52,11 +53,42 @@ HB_INTERNAL void _hb_ot_shape_normalize (const hb_ot_shape_plan_t *shaper,
 
 struct hb_ot_shape_normalize_context_t
 {
+  static bool
+  decompose_unicode (const hb_ot_shape_normalize_context_t *c,
+                     hb_codepoint_t  ab,
+                     hb_codepoint_t *a,
+                     hb_codepoint_t *b)
+  {
+    return (bool) c->unicode->decompose (ab, a, b);
+  }
+
+  static bool
+  compose_unicode (const hb_ot_shape_normalize_context_t *c,
+                   hb_codepoint_t  a,
+                   hb_codepoint_t  b,
+                   hb_codepoint_t *ab)
+  {
+    return (bool) c->unicode->compose (a, b, ab);
+  }
+
+  void
+  override_decompose_and_compose (bool (*decompose) (const hb_ot_shape_normalize_context_t *c,
+                                                      hb_codepoint_t  ab,
+                                                      hb_codepoint_t *a,
+                                                      hb_codepoint_t *b),
+                                  bool (*compose) (const hb_ot_shape_normalize_context_t *c,
+                                                   hb_codepoint_t  a,
+                                                   hb_codepoint_t  b,
+                                                   hb_codepoint_t *ab))
+  {
+    this->decompose = decompose ? decompose : decompose_unicode;
+    this->compose = compose ? compose : compose_unicode;
+  }
+
   const hb_ot_shape_plan_t *plan;
   hb_buffer_t *buffer;
   hb_font_t *font;
   hb_unicode_funcs_t *unicode;
-  const hb_codepoint_t not_found;
   bool (*decompose) (const hb_ot_shape_normalize_context_t *c,
                      hb_codepoint_t  ab,
                      hb_codepoint_t *a,
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-shape.cc b/src/java.desktop/share/native/libharfbuzz/hb-ot-shape.cc
index f936ac45f37e..6265f0eb17d6 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-ot-shape.cc
+++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-shape.cc
@@ -46,6 +46,8 @@
 #include "hb-set.hh"
 
 #include "hb-aat-layout.hh"
+#include "hb-ot-stat-table.hh"
+
 
 static inline bool
 _hb_codepoint_is_regional_indicator (hb_codepoint_t u)
@@ -85,7 +87,7 @@ hb_ot_shape_planner_t::hb_ot_shape_planner_t (hb_face_t                     *fac
                                                 , apply_morx (_hb_apply_morx (face, props))
 #endif
 {
-  shaper = hb_ot_shaper_categorize (this);
+  shaper = hb_ot_shaper_categorize (props.script, props.direction, map.chosen_script[0]);
 
   script_zero_marks = shaper->zero_width_marks != HB_OT_SHAPE_ZERO_WIDTH_MARKS_NONE;
   script_fallback_mark_positioning = shaper->fallback_position;
@@ -121,10 +123,6 @@ hb_ot_shape_planner_t::compile (hb_ot_shape_plan_t           &plan,
   plan.kern_mask = plan.map.get_mask (kern_tag);
   plan.requested_kerning = !!plan.kern_mask;
 #endif
-#ifndef HB_NO_AAT_SHAPE
-  plan.trak_mask = plan.map.get_mask (HB_TAG ('t','r','a','k'));
-  plan.requested_tracking = !!plan.trak_mask;
-#endif
 
   bool has_gpos_kern = plan.map.get_feature_index (1, kern_tag) != HB_OT_LAYOUT_NO_FEATURE_INDEX;
   bool disable_gpos = plan.shaper->gpos_tag &&
@@ -155,7 +153,7 @@ hb_ot_shape_planner_t::compile (hb_ot_shape_plan_t           &plan,
 #endif
   bool has_gpos = !disable_gpos && hb_ot_layout_has_positioning (face);
   if (false)
-    ;
+    {}
 #ifndef HB_NO_AAT_SHAPE
   /* Prefer GPOS over kerx if GSUB is present;
    * https://github.com/harfbuzz/harfbuzz/issues/3008 */
@@ -167,15 +165,16 @@ hb_ot_shape_planner_t::compile (hb_ot_shape_plan_t           &plan,
 
   if (!plan.apply_kerx && (!has_gpos_kern || !plan.apply_gpos))
   {
+    if (false) {}
 #ifndef HB_NO_AAT_SHAPE
-    if (has_kerx)
+    else if (has_kerx)
       plan.apply_kerx = true;
-    else
 #endif
 #ifndef HB_NO_OT_KERN
-    if (hb_ot_layout_has_kerning (face))
+    else if (hb_ot_layout_has_kerning (face))
       plan.apply_kern = true;
 #endif
+    else {}
   }
 
   plan.apply_fallback_kern = !(plan.apply_gpos || plan.apply_kerx || plan.apply_kern);
@@ -206,9 +205,6 @@ hb_ot_shape_planner_t::compile (hb_ot_shape_plan_t           &plan,
      https://github.com/harfbuzz/harfbuzz/issues/2967. */
   if (plan.apply_morx)
     plan.adjust_mark_positioning_when_zeroing = false;
-
-  /* Currently we always apply trak. */
-  plan.apply_trak = plan.requested_tracking && hb_aat_layout_has_tracking (face);
 #endif
 }
 
@@ -273,11 +269,6 @@ hb_ot_shape_plan_t::position (hb_font_t   *font,
 #endif
   else if (this->apply_fallback_kern)
     _hb_ot_shape_fallback_kern (this, font, buffer);
-
-#ifndef HB_NO_AAT_SHAPE
-  if (this->apply_trak)
-    hb_aat_layout_track (this, font, buffer);
-#endif
 }
 
 
@@ -345,13 +336,6 @@ hb_ot_shape_collect_features (hb_ot_shape_planner_t *planner,
   /* Random! */
   map->enable_feature (HB_TAG ('r','a','n','d'), F_RANDOM, HB_OT_MAP_MAX_VALUE);
 
-#ifndef HB_NO_AAT_SHAPE
-  /* Tracking.  We enable dummy feature here just to allow disabling
-   * AAT 'trak' table using features.
-   * https://github.com/harfbuzz/harfbuzz/issues/1303 */
-  map->enable_feature (HB_TAG ('t','r','a','k'), F_HAS_FALLBACK);
-#endif
-
   map->enable_feature (HB_TAG ('H','a','r','f')); /* Considered required. */
   map->enable_feature (HB_TAG ('H','A','R','F')); /* Considered discretionary. */
 
@@ -836,6 +820,28 @@ hb_ot_zero_width_default_ignorables (const hb_buffer_t *buffer)
       pos[i].x_advance = pos[i].y_advance = pos[i].x_offset = pos[i].y_offset = 0;
 }
 
+static void
+hb_ot_deal_with_variation_selectors (hb_buffer_t *buffer)
+{
+  if (!(buffer->scratch_flags & HB_BUFFER_SCRATCH_FLAG_HAS_VARIATION_SELECTOR_FALLBACK) ||
+        buffer->not_found_variation_selector == HB_CODEPOINT_INVALID)
+    return;
+
+  unsigned int count = buffer->len;
+  hb_glyph_info_t *info = buffer->info;
+  hb_glyph_position_t *pos = buffer->pos;
+
+  for (unsigned int i = 0; i < count; i++)
+  {
+    if (_hb_glyph_info_is_variation_selector (&info[i]))
+    {
+      info[i].codepoint = buffer->not_found_variation_selector;
+      pos[i].x_advance = pos[i].y_advance = pos[i].x_offset = pos[i].y_offset = 0;
+      _hb_glyph_info_set_variation_selector (&info[i], false);
+    }
+  }
+}
+
 static void
 hb_ot_hide_default_ignorables (hb_buffer_t *buffer,
                                hb_font_t   *font)
@@ -965,6 +971,7 @@ hb_ot_substitute_post (const hb_ot_shape_context_t *c)
     hb_aat_layout_remove_deleted_glyphs (c->buffer);
 #endif
 
+  hb_ot_deal_with_variation_selectors (c->buffer);
   hb_ot_hide_default_ignorables (c->buffer, c->font);
 
   if (c->plan->shaper->postprocess_glyphs &&
@@ -1253,6 +1260,36 @@ hb_ot_shape_plan_collect_lookups (hb_shape_plan_t *shape_plan,
 }
 
 
+/**
+ * hb_ot_shape_plan_get_feature_tags:
+ * @shape_plan: A shaping plan
+ * @start_offset: The index of first feature to retrieve
+ * @tag_count: (inout): Input = the maximum number of features to return;
+ *                      Output = the actual number of features returned (may be zero)
+ * @tags: (out) (array length=tag_count): The array of enabled feature
+ *
+ * Fetches the list of OpenType feature tags enabled for a shaping plan, if possible.
+ *
+ * Return value: Total number of feature tagss.
+ *
+ * Since: 10.3.0
+ */
+unsigned int
+hb_ot_shape_plan_get_feature_tags (hb_shape_plan_t *shape_plan,
+                                   unsigned int     start_offset,
+                                   unsigned int    *tag_count, /* IN/OUT */
+                                   hb_tag_t        *tags /* OUT */)
+{
+#ifndef HB_NO_OT_SHAPE
+  return shape_plan->ot.map.get_feature_tags (start_offset, tag_count, tags);
+#else
+  if (tag_count)
+        *tag_count = 0;
+  return 0;
+#endif
+}
+
+
 /* TODO Move this to hb-ot-shape-normalize, make it do decompose, and make it public. */
 static void
 add_char (hb_font_t          *font,
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-shape.h b/src/java.desktop/share/native/libharfbuzz/hb-ot-shape.h
index 545e2c3f1b4c..1732831b1325 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-ot-shape.h
+++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-shape.h
@@ -48,6 +48,12 @@ hb_ot_shape_plan_collect_lookups (hb_shape_plan_t *shape_plan,
                                   hb_tag_t         table_tag,
                                   hb_set_t        *lookup_indexes /* OUT */);
 
+HB_EXTERN unsigned int
+hb_ot_shape_plan_get_feature_tags (hb_shape_plan_t *shape_plan,
+                                   unsigned int     start_offset,
+                                   unsigned int    *tag_count, /* IN/OUT */
+                                   hb_tag_t        *tags /* OUT */);
+
 HB_END_DECLS
 
 #endif /* HB_OT_SHAPE_H */
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-shape.hh b/src/java.desktop/share/native/libharfbuzz/hb-ot-shape.hh
index 2fa121ced813..d5ee82d4c0be 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-ot-shape.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-shape.hh
@@ -51,7 +51,8 @@ struct hb_ot_shape_plan_key_t
 
   bool equal (const hb_ot_shape_plan_key_t *other)
   {
-    return 0 == hb_memcmp (this, other, sizeof (*this));
+    return variations_index[0] == other->variations_index[0] &&
+           variations_index[1] == other->variations_index[1];
   }
 };
 
@@ -79,22 +80,12 @@ struct hb_ot_shape_plan_t
 #else
   static constexpr hb_mask_t kern_mask = 0;
 #endif
-#ifndef HB_NO_AAT_SHAPE
-  hb_mask_t trak_mask;
-#else
-  static constexpr hb_mask_t trak_mask = 0;
-#endif
 
 #ifndef HB_NO_OT_KERN
   bool requested_kerning : 1;
 #else
   static constexpr bool requested_kerning = false;
 #endif
-#ifndef HB_NO_AAT_SHAPE
-  bool requested_tracking : 1;
-#else
-  static constexpr bool requested_tracking = false;
-#endif
 #ifndef HB_NO_OT_SHAPE_FRACTIONS
   bool has_frac : 1;
 #else
@@ -117,11 +108,9 @@ struct hb_ot_shape_plan_t
 #ifndef HB_NO_AAT_SHAPE
   bool apply_kerx : 1;
   bool apply_morx : 1;
-  bool apply_trak : 1;
 #else
   static constexpr bool apply_kerx = false;
   static constexpr bool apply_morx = false;
-  static constexpr bool apply_trak = false;
 #endif
 
   void collect_lookups (hb_tag_t table_tag, hb_set_t *lookups) const
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-arabic-fallback.hh b/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-arabic-fallback.hh
index 858a9872726b..ff0b2acede1d 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-arabic-fallback.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-arabic-fallback.hh
@@ -355,6 +355,8 @@ arabic_fallback_plan_destroy (arabic_fallback_plan_t *fallback_plan)
   for (unsigned int i = 0; i < fallback_plan->num_lookups; i++)
     if (fallback_plan->lookup_array[i])
     {
+      if (fallback_plan->accel_array[i])
+        fallback_plan->accel_array[i]->fini ();
       hb_free (fallback_plan->accel_array[i]);
       if (fallback_plan->free_lookups)
         hb_free (fallback_plan->lookup_array[i]);
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-arabic-joining-list.hh b/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-arabic-joining-list.hh
index a5a7b84af451..e38686e3ebb7 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-arabic-joining-list.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-arabic-joining-list.hh
@@ -6,10 +6,10 @@
  *
  * on files with these headers:
  *
- * # ArabicShaping-15.1.0.txt
- * # Date: 2023-01-05
- * # Scripts-15.1.0.txt
- * # Date: 2023-07-28, 16:01:07 GMT
+ * # ArabicShaping-16.0.0.txt
+ * # Date: 2024-07-30
+ * # Scripts-16.0.0.txt
+ * # Date: 2024-04-30, 21:48:40 GMT
  */
 
 #ifndef HB_OT_SHAPER_ARABIC_JOINING_LIST_HH
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-arabic-table.hh b/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-arabic-table.hh
index 8c2504438d96..19bd72d42188 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-arabic-table.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-arabic-table.hh
@@ -6,10 +6,10 @@
  *
  * on files with these headers:
  *
- * # ArabicShaping-15.1.0.txt
- * # Date: 2023-01-05
- * # Blocks-15.1.0.txt
- * # Date: 2023-07-28, 15:47:20 GMT
+ * # ArabicShaping-16.0.0.txt
+ * # Date: 2024-07-30
+ * # Blocks-16.0.0.txt
+ * # Date: 2024-02-02
  * UnicodeData.txt does not have a header.
  */
 
@@ -136,7 +136,13 @@ static const uint8_t joining_table[] =
   /* 10D00 */ L,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,
   /* 10D20 */ D,D,R,D,
 
-#define joining_offset_0x10f30u 1182
+#define joining_offset_0x10ec2u 1182
+
+  /* Arabic Extended-C */
+
+  /* 10EC0 */     R,D,D,
+
+#define joining_offset_0x10f30u 1185
 
   /* Sogdian */
 
@@ -155,14 +161,14 @@ static const uint8_t joining_table[] =
   /* 10FA0 */                                 D,U,D,D,R,R,R,U,D,R,R,D,D,R,D,D,
   /* 10FC0 */ U,D,R,R,D,U,U,U,U,R,D,L,
 
-#define joining_offset_0x110bdu 1338
+#define joining_offset_0x110bdu 1341
 
   /* Kaithi */
 
   /* 110A0 */                                                           U,X,X,
   /* 110C0 */ X,X,X,X,X,X,X,X,X,X,X,X,X,U,
 
-#define joining_offset_0x1e900u 1355
+#define joining_offset_0x1e900u 1358
 
   /* Adlam */
 
@@ -170,7 +176,7 @@ static const uint8_t joining_table[] =
   /* 1E920 */ D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,D,
   /* 1E940 */ D,D,D,D,X,X,X,X,X,X,X,T,
 
-}; /* Table items: 1431; occupancy: 57% */
+}; /* Table items: 1434; occupancy: 57% */
 
 
 static unsigned int
@@ -198,6 +204,7 @@ joining_type (hb_codepoint_t u)
       if (hb_in_range (u, 0x10AC0u, 0x10AEFu)) return joining_table[u - 0x10AC0u + joining_offset_0x10ac0u];
       if (hb_in_range (u, 0x10B80u, 0x10BAFu)) return joining_table[u - 0x10B80u + joining_offset_0x10b80u];
       if (hb_in_range (u, 0x10D00u, 0x10D23u)) return joining_table[u - 0x10D00u + joining_offset_0x10d00u];
+      if (hb_in_range (u, 0x10EC2u, 0x10EC4u)) return joining_table[u - 0x10EC2u + joining_offset_0x10ec2u];
       if (hb_in_range (u, 0x10F30u, 0x10FCBu)) return joining_table[u - 0x10F30u + joining_offset_0x10f30u];
       break;
 
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-arabic.cc b/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-arabic.cc
index 87d76e1a1013..67db6cb26c42 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-arabic.cc
+++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-arabic.cc
@@ -233,10 +233,7 @@ collect_features_arabic (hb_ot_shape_planner_t *plan)
    map->enable_feature (HB_TAG('c','a','l','t'), F_MANUAL_ZWJ);
    /* https://github.com/harfbuzz/harfbuzz/issues/1573 */
    if (!map->has_feature (HB_TAG('r','c','l','t')))
-   {
      map->add_gsub_pause (nullptr);
-     map->enable_feature (HB_TAG('r','c','l','t'), F_MANUAL_ZWJ);
-   }
 
    map->enable_feature (HB_TAG('l','i','g','a'), F_MANUAL_ZWJ);
    map->enable_feature (HB_TAG('c','l','i','g'), F_MANUAL_ZWJ);
@@ -560,9 +557,9 @@ apply_stch (const hb_ot_shape_plan_t *plan HB_UNUSED,
 
       DEBUG_MSG (ARABIC, nullptr, "%s stretch at (%u,%u,%u)",
                  step == MEASURE ? "measuring" : "cutting", context, start, end);
-      DEBUG_MSG (ARABIC, nullptr, "rest of word:    count=%u width %d", start - context, w_total);
-      DEBUG_MSG (ARABIC, nullptr, "fixed tiles:     count=%d width=%d", n_fixed, w_fixed);
-      DEBUG_MSG (ARABIC, nullptr, "repeating tiles: count=%d width=%d", n_repeating, w_repeating);
+      DEBUG_MSG (ARABIC, nullptr, "rest of word:    count=%u width %" PRId32, start - context, w_total);
+      DEBUG_MSG (ARABIC, nullptr, "fixed tiles:     count=%d width=%" PRId32, n_fixed, w_fixed);
+      DEBUG_MSG (ARABIC, nullptr, "repeating tiles: count=%d width=%" PRId32, n_repeating, w_repeating);
 
       /* Number of additional times to repeat each repeating tile. */
       int n_copies = 0;
@@ -602,7 +599,7 @@ apply_stch (const hb_ot_shape_plan_t *plan HB_UNUSED,
           if (info[k - 1].arabic_shaping_action() == STCH_REPEATING)
             repeat += n_copies;
 
-          DEBUG_MSG (ARABIC, nullptr, "appending %u copies of glyph %u; j=%u",
+          DEBUG_MSG (ARABIC, nullptr, "appending %u copies of glyph %" PRIu32 "; j=%u",
                      repeat, info[k - 1].codepoint, j);
           pos[k - 1].x_advance = 0;
           for (unsigned int n = 0; n < repeat; n++)
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-hebrew.cc b/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-hebrew.cc
index bb9950d02d28..0ad1cea95325 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-hebrew.cc
+++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-hebrew.cc
@@ -78,7 +78,7 @@ compose_hebrew (const hb_ot_shape_normalize_context_t *c,
   return found;
 #endif
 
-  if (!found && !c->plan->has_gpos_mark)
+  if (!found && (c->plan && !c->plan->has_gpos_mark))
   {
       /* Special-case Hebrew presentation forms that are excluded from
        * standard normalization, but wanted for old fonts. */
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-indic-machine.hh b/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-indic-machine.hh
index 6a6db44840ea..25e6d85ef804 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-indic-machine.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-indic-machine.hh
@@ -68,6 +68,7 @@ enum indic_syllable_type_t {
 #define indic_syllable_machine_ex_Ra 15u
 #define indic_syllable_machine_ex_Repha 14u
 #define indic_syllable_machine_ex_SM 8u
+#define indic_syllable_machine_ex_SMPst 57u
 #define indic_syllable_machine_ex_Symbol 17u
 #define indic_syllable_machine_ex_V 2u
 #define indic_syllable_machine_ex_VD 9u
@@ -76,251 +77,916 @@ enum indic_syllable_type_t {
 #define indic_syllable_machine_ex_ZWNJ 5u
 
 
-#line 80 "hb-ot-shaper-indic-machine.hh"
+#line 81 "hb-ot-shaper-indic-machine.hh"
 static const unsigned char _indic_syllable_machine_trans_keys[] = {
-        8u, 8u, 4u, 13u, 5u, 13u, 5u, 13u, 13u, 13u, 4u, 13u, 4u, 13u, 4u, 13u,
-        8u, 8u, 5u, 13u, 5u, 13u, 13u, 13u, 4u, 13u, 4u, 13u, 4u, 13u, 4u, 13u,
-        8u, 8u, 5u, 13u, 5u, 13u, 13u, 13u, 4u, 13u, 4u, 13u, 4u, 13u, 8u, 8u,
-        5u, 13u, 5u, 13u, 13u, 13u, 4u, 13u, 4u, 13u, 5u, 13u, 8u, 8u, 1u, 18u,
-        3u, 16u, 3u, 16u, 4u, 16u, 1u, 15u, 5u, 9u, 5u, 9u, 9u, 9u, 5u, 9u,
-        1u, 15u, 1u, 15u, 1u, 15u, 3u, 13u, 4u, 13u, 5u, 13u, 5u, 13u, 4u, 13u,
-        5u, 9u, 3u, 9u, 5u, 9u, 3u, 16u, 3u, 16u, 3u, 16u, 3u, 16u, 4u, 16u,
-        1u, 15u, 3u, 16u, 3u, 16u, 4u, 16u, 1u, 15u, 5u, 9u, 9u, 9u, 5u, 9u,
-        1u, 15u, 1u, 15u, 3u, 13u, 4u, 13u, 5u, 13u, 5u, 13u, 4u, 13u, 5u, 9u,
-        5u, 9u, 3u, 9u, 5u, 9u, 3u, 16u, 3u, 16u, 4u, 13u, 3u, 16u, 3u, 16u,
-        4u, 16u, 1u, 15u, 3u, 16u, 1u, 15u, 5u, 9u, 9u, 9u, 5u, 9u, 1u, 15u,
-        1u, 15u, 3u, 13u, 4u, 13u, 5u, 13u, 5u, 13u, 3u, 16u, 4u, 13u, 5u, 9u,
-        5u, 9u, 3u, 9u, 5u, 9u, 3u, 16u, 4u, 13u, 4u, 13u, 3u, 16u, 3u, 16u,
-        4u, 16u, 1u, 15u, 3u, 16u, 1u, 15u, 5u, 9u, 9u, 9u, 5u, 9u, 1u, 15u,
-        1u, 15u, 3u, 13u, 4u, 13u, 5u, 13u, 5u, 13u, 3u, 16u, 4u, 13u, 5u, 9u,
-        5u, 9u, 3u, 9u, 5u, 9u, 1u, 16u, 3u, 16u, 1u, 16u, 4u, 13u, 5u, 13u,
-        5u, 13u, 9u, 9u, 5u, 9u, 1u, 15u, 3u, 9u, 5u, 9u, 5u, 9u, 9u, 9u,
+        8u, 57u, 4u, 57u, 5u, 57u, 5u, 57u, 13u, 13u, 4u, 57u, 4u, 57u, 4u, 57u,
+        8u, 57u, 5u, 57u, 5u, 57u, 13u, 13u, 4u, 57u, 4u, 57u, 4u, 57u, 4u, 57u,
+        8u, 57u, 5u, 57u, 5u, 57u, 13u, 13u, 4u, 57u, 4u, 57u, 4u, 57u, 8u, 57u,
+        5u, 57u, 5u, 57u, 13u, 13u, 4u, 57u, 4u, 57u, 5u, 57u, 8u, 57u, 1u, 57u,
+        3u, 57u, 3u, 57u, 4u, 57u, 1u, 57u, 5u, 57u, 5u, 57u, 9u, 9u, 5u, 9u,
+        1u, 57u, 1u, 57u, 1u, 57u, 3u, 57u, 4u, 57u, 5u, 57u, 5u, 57u, 4u, 57u,
+        5u, 57u, 3u, 57u, 5u, 57u, 3u, 57u, 3u, 57u, 3u, 57u, 3u, 57u, 4u, 57u,
+        1u, 57u, 3u, 57u, 3u, 57u, 4u, 57u, 1u, 57u, 5u, 57u, 9u, 9u, 5u, 9u,
+        1u, 57u, 1u, 57u, 3u, 57u, 4u, 57u, 5u, 57u, 5u, 57u, 4u, 57u, 5u, 57u,
+        5u, 57u, 3u, 57u, 5u, 57u, 3u, 57u, 3u, 57u, 4u, 57u, 3u, 57u, 3u, 57u,
+        4u, 57u, 1u, 57u, 3u, 57u, 1u, 57u, 5u, 57u, 9u, 9u, 5u, 9u, 1u, 57u,
+        1u, 57u, 3u, 57u, 4u, 57u, 5u, 57u, 5u, 57u, 3u, 57u, 4u, 57u, 5u, 57u,
+        5u, 57u, 3u, 57u, 5u, 57u, 3u, 57u, 4u, 57u, 4u, 57u, 3u, 57u, 3u, 57u,
+        4u, 57u, 1u, 57u, 3u, 57u, 1u, 57u, 5u, 57u, 9u, 9u, 5u, 9u, 1u, 57u,
+        1u, 57u, 3u, 57u, 4u, 57u, 5u, 57u, 5u, 57u, 3u, 57u, 4u, 57u, 5u, 57u,
+        5u, 57u, 3u, 57u, 5u, 57u, 1u, 57u, 3u, 57u, 1u, 57u, 4u, 57u, 5u, 57u,
+        5u, 57u, 9u, 9u, 5u, 9u, 1u, 57u, 3u, 57u, 5u, 57u, 5u, 57u, 9u, 9u,
         5u, 9u, 1u, 15u, 0
 };
 
 static const char _indic_syllable_machine_key_spans[] = {
-        1, 10, 9, 9, 1, 10, 10, 10,
-        1, 9, 9, 1, 10, 10, 10, 10,
-        1, 9, 9, 1, 10, 10, 10, 1,
-        9, 9, 1, 10, 10, 9, 1, 18,
-        14, 14, 13, 15, 5, 5, 1, 5,
-        15, 15, 15, 11, 10, 9, 9, 10,
-        5, 7, 5, 14, 14, 14, 14, 13,
-        15, 14, 14, 13, 15, 5, 1, 5,
-        15, 15, 11, 10, 9, 9, 10, 5,
-        5, 7, 5, 14, 14, 10, 14, 14,
-        13, 15, 14, 15, 5, 1, 5, 15,
-        15, 11, 10, 9, 9, 14, 10, 5,
-        5, 7, 5, 14, 10, 10, 14, 14,
-        13, 15, 14, 15, 5, 1, 5, 15,
-        15, 11, 10, 9, 9, 14, 10, 5,
-        5, 7, 5, 16, 14, 16, 10, 9,
-        9, 1, 5, 15, 7, 5, 5, 1,
+        50, 54, 53, 53, 1, 54, 54, 54,
+        50, 53, 53, 1, 54, 54, 54, 54,
+        50, 53, 53, 1, 54, 54, 54, 50,
+        53, 53, 1, 54, 54, 53, 50, 57,
+        55, 55, 54, 57, 53, 53, 1, 5,
+        57, 57, 57, 55, 54, 53, 53, 54,
+        53, 55, 53, 55, 55, 55, 55, 54,
+        57, 55, 55, 54, 57, 53, 1, 5,
+        57, 57, 55, 54, 53, 53, 54, 53,
+        53, 55, 53, 55, 55, 54, 55, 55,
+        54, 57, 55, 57, 53, 1, 5, 57,
+        57, 55, 54, 53, 53, 55, 54, 53,
+        53, 55, 53, 55, 54, 54, 55, 55,
+        54, 57, 55, 57, 53, 1, 5, 57,
+        57, 55, 54, 53, 53, 55, 54, 53,
+        53, 55, 53, 57, 55, 57, 54, 53,
+        53, 1, 5, 57, 55, 53, 53, 1,
         5, 15
 };
 
 static const short _indic_syllable_machine_index_offsets[] = {
-        0, 2, 13, 23, 33, 35, 46, 57,
-        68, 70, 80, 90, 92, 103, 114, 125,
-        136, 138, 148, 158, 160, 171, 182, 193,
-        195, 205, 215, 217, 228, 239, 249, 251,
-        270, 285, 300, 314, 330, 336, 342, 344,
-        350, 366, 382, 398, 410, 421, 431, 441,
-        452, 458, 466, 472, 487, 502, 517, 532,
-        546, 562, 577, 592, 606, 622, 628, 630,
-        636, 652, 668, 680, 691, 701, 711, 722,
-        728, 734, 742, 748, 763, 778, 789, 804,
-        819, 833, 849, 864, 880, 886, 888, 894,
-        910, 926, 938, 949, 959, 969, 984, 995,
-        1001, 1007, 1015, 1021, 1036, 1047, 1058, 1073,
-        1088, 1102, 1118, 1133, 1149, 1155, 1157, 1163,
-        1179, 1195, 1207, 1218, 1228, 1238, 1253, 1264,
-        1270, 1276, 1284, 1290, 1307, 1322, 1339, 1350,
-        1360, 1370, 1372, 1378, 1394, 1402, 1408, 1414,
-        1416, 1422
+        0, 51, 106, 160, 214, 216, 271, 326,
+        381, 432, 486, 540, 542, 597, 652, 707,
+        762, 813, 867, 921, 923, 978, 1033, 1088,
+        1139, 1193, 1247, 1249, 1304, 1359, 1413, 1464,
+        1522, 1578, 1634, 1689, 1747, 1801, 1855, 1857,
+        1863, 1921, 1979, 2037, 2093, 2148, 2202, 2256,
+        2311, 2365, 2421, 2475, 2531, 2587, 2643, 2699,
+        2754, 2812, 2868, 2924, 2979, 3037, 3091, 3093,
+        3099, 3157, 3215, 3271, 3326, 3380, 3434, 3489,
+        3543, 3597, 3653, 3707, 3763, 3819, 3874, 3930,
+        3986, 4041, 4099, 4155, 4213, 4267, 4269, 4275,
+        4333, 4391, 4447, 4502, 4556, 4610, 4666, 4721,
+        4775, 4829, 4885, 4939, 4995, 5050, 5105, 5161,
+        5217, 5272, 5330, 5386, 5444, 5498, 5500, 5506,
+        5564, 5622, 5678, 5733, 5787, 5841, 5897, 5952,
+        6006, 6060, 6116, 6170, 6228, 6284, 6342, 6397,
+        6451, 6505, 6507, 6513, 6571, 6627, 6681, 6735,
+        6737, 6743
 };
 
 static const unsigned char _indic_syllable_machine_indicies[] = {
-        1, 0, 2, 3, 3, 4, 5, 0,
-        0, 0, 0, 4, 0, 3, 3, 4,
-        6, 0, 0, 0, 0, 4, 0, 3,
-        3, 4, 5, 0, 0, 0, 0, 4,
-        0, 4, 0, 7, 3, 3, 4, 5,
-        0, 0, 0, 0, 4, 0, 2, 3,
-        3, 4, 5, 0, 0, 0, 8, 4,
-        0, 10, 11, 11, 12, 13, 9, 9,
-        9, 9, 12, 9, 14, 9, 11, 11,
-        12, 15, 9, 9, 9, 9, 12, 9,
-        11, 11, 12, 13, 9, 9, 9, 9,
-        12, 9, 12, 9, 16, 11, 11, 12,
-        13, 9, 9, 9, 9, 12, 9, 10,
-        11, 11, 12, 13, 9, 9, 9, 17,
-        12, 9, 10, 11, 11, 12, 13, 9,
-        9, 9, 18, 12, 9, 20, 21, 21,
-        22, 23, 19, 19, 19, 24, 22, 19,
-        25, 19, 21, 21, 22, 27, 26, 26,
-        26, 26, 22, 26, 21, 21, 22, 23,
-        19, 19, 19, 19, 22, 19, 22, 26,
-        20, 21, 21, 22, 23, 19, 19, 19,
-        19, 22, 19, 28, 21, 21, 22, 23,
-        19, 19, 19, 19, 22, 19, 30, 31,
-        31, 32, 33, 29, 29, 29, 34, 32,
+        1, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 1, 0, 2, 3, 3, 4, 5,
+        0, 0, 0, 0, 4, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        5, 0, 3, 3, 4, 6, 0, 0,
+        0, 0, 4, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 6, 0,
+        3, 3, 4, 5, 0, 0, 0, 0,
+        4, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 5, 0, 4, 0,
+        7, 3, 3, 4, 5, 0, 0, 0,
+        0, 4, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 5, 0, 2,
+        3, 3, 4, 5, 0, 0, 0, 8,
+        4, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 5, 0, 10, 11,
+        11, 12, 13, 9, 9, 9, 9, 12,
+        9, 9, 9, 9, 9, 9, 9, 9,
+        9, 9, 9, 9, 9, 9, 9, 9,
+        9, 9, 9, 9, 9, 9, 9, 9,
+        9, 9, 9, 9, 9, 9, 9, 9,
+        9, 9, 9, 9, 9, 9, 9, 9,
+        9, 9, 9, 13, 9, 14, 9, 9,
+        9, 9, 9, 9, 9, 9, 9, 9,
+        9, 9, 9, 9, 9, 9, 9, 9,
+        9, 9, 9, 9, 9, 9, 9, 9,
+        9, 9, 9, 9, 9, 9, 9, 9,
+        9, 9, 9, 9, 9, 9, 9, 9,
+        9, 9, 9, 9, 9, 9, 14, 9,
+        11, 11, 12, 15, 9, 9, 9, 9,
+        12, 9, 9, 9, 9, 9, 9, 9,
+        9, 9, 9, 9, 9, 9, 9, 9,
+        9, 9, 9, 9, 9, 9, 9, 9,
+        9, 9, 9, 9, 9, 9, 9, 9,
+        9, 9, 9, 9, 9, 9, 9, 9,
+        9, 9, 9, 9, 15, 9, 11, 11,
+        12, 13, 9, 9, 9, 9, 12, 9,
+        9, 9, 9, 9, 9, 9, 9, 9,
+        9, 9, 9, 9, 9, 9, 9, 9,
+        9, 9, 9, 9, 9, 9, 9, 9,
+        9, 9, 9, 9, 9, 9, 9, 9,
+        9, 9, 9, 9, 9, 9, 9, 9,
+        9, 9, 13, 9, 12, 9, 16, 11,
+        11, 12, 13, 9, 9, 9, 9, 12,
+        9, 9, 9, 9, 9, 9, 9, 9,
+        9, 9, 9, 9, 9, 9, 9, 9,
+        9, 9, 9, 9, 9, 9, 9, 9,
+        9, 9, 9, 9, 9, 9, 9, 9,
+        9, 9, 9, 9, 9, 9, 9, 9,
+        9, 9, 9, 13, 9, 10, 11, 11,
+        12, 13, 9, 9, 9, 17, 12, 9,
+        9, 9, 9, 9, 9, 9, 9, 9,
+        9, 9, 9, 9, 9, 9, 9, 9,
+        9, 9, 9, 9, 9, 9, 9, 9,
+        9, 9, 9, 9, 9, 9, 9, 9,
+        9, 9, 9, 9, 9, 9, 9, 9,
+        9, 9, 13, 9, 10, 11, 11, 12,
+        13, 9, 9, 9, 18, 12, 9, 9,
+        9, 9, 9, 9, 9, 9, 9, 9,
+        9, 9, 9, 9, 9, 9, 9, 9,
+        9, 9, 9, 9, 9, 9, 9, 9,
+        9, 9, 9, 9, 9, 9, 9, 9,
+        9, 9, 9, 9, 9, 9, 9, 9,
+        9, 13, 9, 20, 21, 21, 22, 23,
+        19, 19, 19, 24, 22, 19, 19, 19,
+        19, 19, 19, 19, 19, 19, 19, 19,
+        19, 19, 19, 19, 19, 19, 19, 19,
+        19, 19, 19, 19, 19, 19, 19, 19,
+        19, 19, 19, 19, 19, 19, 19, 19,
+        19, 19, 19, 19, 19, 19, 19, 19,
+        23, 19, 25, 19, 19, 19, 19, 19,
+        19, 19, 19, 19, 19, 19, 19, 19,
+        19, 19, 19, 19, 19, 19, 19, 19,
+        19, 19, 19, 19, 19, 19, 19, 19,
+        19, 19, 19, 19, 19, 19, 19, 19,
+        19, 19, 19, 19, 19, 19, 19, 19,
+        19, 19, 19, 25, 19, 21, 21, 22,
+        27, 26, 26, 26, 26, 22, 26, 26,
+        26, 26, 26, 26, 26, 26, 26, 26,
+        26, 26, 26, 26, 26, 26, 26, 26,
+        26, 26, 26, 26, 26, 26, 26, 26,
+        26, 26, 26, 26, 26, 26, 26, 26,
+        26, 26, 26, 26, 26, 26, 26, 26,
+        26, 27, 26, 21, 21, 22, 23, 19,
+        19, 19, 19, 22, 19, 19, 19, 19,
+        19, 19, 19, 19, 19, 19, 19, 19,
+        19, 19, 19, 19, 19, 19, 19, 19,
+        19, 19, 19, 19, 19, 19, 19, 19,
+        19, 19, 19, 19, 19, 19, 19, 19,
+        19, 19, 19, 19, 19, 19, 19, 23,
+        19, 22, 26, 20, 21, 21, 22, 23,
+        19, 19, 19, 19, 22, 19, 19, 19,
+        19, 19, 19, 19, 19, 19, 19, 19,
+        19, 19, 19, 19, 19, 19, 19, 19,
+        19, 19, 19, 19, 19, 19, 19, 19,
+        19, 19, 19, 19, 19, 19, 19, 19,
+        19, 19, 19, 19, 19, 19, 19, 19,
+        23, 19, 28, 21, 21, 22, 23, 19,
+        19, 19, 19, 22, 19, 19, 19, 19,
+        19, 19, 19, 19, 19, 19, 19, 19,
+        19, 19, 19, 19, 19, 19, 19, 19,
+        19, 19, 19, 19, 19, 19, 19, 19,
+        19, 19, 19, 19, 19, 19, 19, 19,
+        19, 19, 19, 19, 19, 19, 19, 23,
+        19, 30, 31, 31, 32, 33, 29, 29,
+        29, 34, 32, 29, 29, 29, 29, 29,
+        29, 29, 29, 29, 29, 29, 29, 29,
+        29, 29, 29, 29, 29, 29, 29, 29,
+        29, 29, 29, 29, 29, 29, 29, 29,
+        29, 29, 29, 29, 29, 29, 29, 29,
+        29, 29, 29, 29, 29, 29, 33, 29,
+        35, 29, 29, 29, 29, 29, 29, 29,
+        29, 29, 29, 29, 29, 29, 29, 29,
+        29, 29, 29, 29, 29, 29, 29, 29,
+        29, 29, 29, 29, 29, 29, 29, 29,
+        29, 29, 29, 29, 29, 29, 29, 29,
+        29, 29, 29, 29, 29, 29, 29, 29,
         29, 35, 29, 31, 31, 32, 36, 29,
-        29, 29, 29, 32, 29, 31, 31, 32,
-        33, 29, 29, 29, 29, 32, 29, 32,
+        29, 29, 29, 32, 29, 29, 29, 29,
+        29, 29, 29, 29, 29, 29, 29, 29,
+        29, 29, 29, 29, 29, 29, 29, 29,
+        29, 29, 29, 29, 29, 29, 29, 29,
+        29, 29, 29, 29, 29, 29, 29, 29,
+        29, 29, 29, 29, 29, 29, 29, 36,
+        29, 31, 31, 32, 33, 29, 29, 29,
+        29, 32, 29, 29, 29, 29, 29, 29,
+        29, 29, 29, 29, 29, 29, 29, 29,
+        29, 29, 29, 29, 29, 29, 29, 29,
+        29, 29, 29, 29, 29, 29, 29, 29,
+        29, 29, 29, 29, 29, 29, 29, 29,
+        29, 29, 29, 29, 29, 33, 29, 32,
         29, 30, 31, 31, 32, 33, 29, 29,
-        29, 29, 32, 29, 37, 31, 31, 32,
-        33, 29, 29, 29, 29, 32, 29, 21,
+        29, 29, 32, 29, 29, 29, 29, 29,
+        29, 29, 29, 29, 29, 29, 29, 29,
+        29, 29, 29, 29, 29, 29, 29, 29,
+        29, 29, 29, 29, 29, 29, 29, 29,
+        29, 29, 29, 29, 29, 29, 29, 29,
+        29, 29, 29, 29, 29, 29, 33, 29,
+        37, 31, 31, 32, 33, 29, 29, 29,
+        29, 32, 29, 29, 29, 29, 29, 29,
+        29, 29, 29, 29, 29, 29, 29, 29,
+        29, 29, 29, 29, 29, 29, 29, 29,
+        29, 29, 29, 29, 29, 29, 29, 29,
+        29, 29, 29, 29, 29, 29, 29, 29,
+        29, 29, 29, 29, 29, 33, 29, 21,
         21, 22, 38, 0, 0, 0, 0, 22,
-        0, 40, 39, 42, 43, 44, 45, 46,
-        47, 22, 23, 48, 49, 49, 24, 22,
-        50, 51, 52, 53, 54, 41, 56, 57,
-        58, 59, 4, 5, 60, 55, 55, 8,
-        4, 55, 55, 61, 55, 62, 57, 63,
-        63, 4, 5, 60, 55, 55, 55, 4,
-        55, 55, 61, 55, 57, 63, 63, 4,
-        5, 60, 55, 55, 55, 4, 55, 55,
-        61, 55, 42, 55, 55, 55, 64, 65,
-        55, 1, 60, 55, 55, 55, 55, 55,
-        42, 55, 66, 66, 55, 1, 60, 55,
-        60, 55, 55, 67, 60, 55, 60, 55,
-        60, 55, 55, 55, 60, 55, 42, 55,
-        68, 55, 66, 66, 55, 1, 60, 55,
-        55, 55, 55, 55, 42, 55, 42, 55,
-        55, 55, 66, 66, 55, 1, 60, 55,
-        55, 55, 55, 55, 42, 55, 42, 55,
-        55, 55, 66, 65, 55, 1, 60, 55,
-        55, 55, 55, 55, 42, 55, 69, 70,
-        71, 71, 4, 5, 60, 55, 55, 55,
-        4, 55, 70, 71, 71, 4, 5, 60,
-        55, 55, 55, 4, 55, 71, 71, 4,
-        5, 60, 55, 55, 55, 4, 55, 60,
-        55, 55, 67, 60, 55, 55, 55, 4,
-        55, 72, 73, 73, 4, 5, 60, 55,
-        55, 55, 4, 55, 64, 74, 55, 1,
-        60, 55, 64, 55, 66, 66, 55, 1,
-        60, 55, 66, 74, 55, 1, 60, 55,
-        56, 57, 63, 63, 4, 5, 60, 55,
-        55, 55, 4, 55, 55, 61, 55, 56,
-        57, 58, 63, 4, 5, 60, 55, 55,
-        8, 4, 55, 55, 61, 55, 76, 77,
-        78, 79, 12, 13, 80, 75, 75, 18,
-        12, 75, 75, 81, 75, 82, 77, 83,
-        79, 12, 13, 80, 75, 75, 75, 12,
-        75, 75, 81, 75, 77, 83, 79, 12,
-        13, 80, 75, 75, 75, 12, 75, 75,
-        81, 75, 84, 75, 75, 75, 85, 86,
-        75, 14, 80, 75, 75, 75, 75, 75,
-        84, 75, 87, 77, 88, 89, 12, 13,
-        80, 75, 75, 17, 12, 75, 75, 81,
-        75, 90, 77, 83, 83, 12, 13, 80,
-        75, 75, 75, 12, 75, 75, 81, 75,
-        77, 83, 83, 12, 13, 80, 75, 75,
-        75, 12, 75, 75, 81, 75, 84, 75,
-        75, 75, 91, 86, 75, 14, 80, 75,
-        75, 75, 75, 75, 84, 75, 80, 75,
-        75, 92, 80, 75, 80, 75, 80, 75,
-        75, 75, 80, 75, 84, 75, 93, 75,
-        91, 91, 75, 14, 80, 75, 75, 75,
-        75, 75, 84, 75, 84, 75, 75, 75,
-        91, 91, 75, 14, 80, 75, 75, 75,
-        75, 75, 84, 75, 94, 95, 96, 96,
-        12, 13, 80, 75, 75, 75, 12, 75,
-        95, 96, 96, 12, 13, 80, 75, 75,
-        75, 12, 75, 96, 96, 12, 13, 80,
-        75, 75, 75, 12, 75, 80, 75, 75,
-        92, 80, 75, 75, 75, 12, 75, 97,
-        98, 98, 12, 13, 80, 75, 75, 75,
-        12, 75, 85, 99, 75, 14, 80, 75,
-        91, 91, 75, 14, 80, 75, 85, 75,
-        91, 91, 75, 14, 80, 75, 91, 99,
-        75, 14, 80, 75, 87, 77, 83, 83,
-        12, 13, 80, 75, 75, 75, 12, 75,
-        75, 81, 75, 87, 77, 88, 83, 12,
-        13, 80, 75, 75, 17, 12, 75, 75,
-        81, 75, 10, 11, 11, 12, 13, 75,
-        75, 75, 75, 12, 75, 76, 77, 83,
-        79, 12, 13, 80, 75, 75, 75, 12,
-        75, 75, 81, 75, 101, 45, 102, 102,
-        22, 23, 48, 100, 100, 100, 22, 100,
-        100, 52, 100, 45, 102, 102, 22, 23,
-        48, 100, 100, 100, 22, 100, 100, 52,
-        100, 103, 100, 100, 100, 104, 105, 100,
-        25, 48, 100, 100, 100, 100, 100, 103,
-        100, 44, 45, 106, 107, 22, 23, 48,
-        100, 100, 24, 22, 100, 100, 52, 100,
-        103, 100, 100, 100, 108, 105, 100, 25,
-        48, 100, 100, 100, 100, 100, 103, 100,
-        48, 100, 100, 109, 48, 100, 48, 100,
-        48, 100, 100, 100, 48, 100, 103, 100,
-        110, 100, 108, 108, 100, 25, 48, 100,
-        100, 100, 100, 100, 103, 100, 103, 100,
-        100, 100, 108, 108, 100, 25, 48, 100,
-        100, 100, 100, 100, 103, 100, 111, 112,
-        113, 113, 22, 23, 48, 100, 100, 100,
-        22, 100, 112, 113, 113, 22, 23, 48,
-        100, 100, 100, 22, 100, 113, 113, 22,
-        23, 48, 100, 100, 100, 22, 100, 48,
-        100, 100, 109, 48, 100, 100, 100, 22,
-        100, 44, 45, 102, 102, 22, 23, 48,
-        100, 100, 100, 22, 100, 100, 52, 100,
-        114, 115, 115, 22, 23, 48, 100, 100,
-        100, 22, 100, 104, 116, 100, 25, 48,
-        100, 108, 108, 100, 25, 48, 100, 104,
-        100, 108, 108, 100, 25, 48, 100, 108,
-        116, 100, 25, 48, 100, 44, 45, 106,
-        102, 22, 23, 48, 100, 100, 24, 22,
-        100, 100, 52, 100, 20, 21, 21, 22,
-        23, 117, 117, 117, 24, 22, 117, 20,
-        21, 21, 22, 23, 117, 117, 117, 117,
-        22, 117, 119, 120, 121, 122, 32, 33,
-        123, 118, 118, 34, 32, 118, 118, 124,
-        118, 125, 120, 122, 122, 32, 33, 123,
-        118, 118, 118, 32, 118, 118, 124, 118,
-        120, 122, 122, 32, 33, 123, 118, 118,
-        118, 32, 118, 118, 124, 118, 126, 118,
-        118, 118, 127, 128, 118, 35, 123, 118,
-        118, 118, 118, 118, 126, 118, 119, 120,
-        121, 49, 32, 33, 123, 118, 118, 34,
-        32, 118, 118, 124, 118, 126, 118, 118,
-        118, 129, 128, 118, 35, 123, 118, 118,
-        118, 118, 118, 126, 118, 123, 118, 118,
-        130, 123, 118, 123, 118, 123, 118, 118,
-        118, 123, 118, 126, 118, 131, 118, 129,
-        129, 118, 35, 123, 118, 118, 118, 118,
-        118, 126, 118, 126, 118, 118, 118, 129,
-        129, 118, 35, 123, 118, 118, 118, 118,
-        118, 126, 118, 132, 133, 134, 134, 32,
-        33, 123, 118, 118, 118, 32, 118, 133,
-        134, 134, 32, 33, 123, 118, 118, 118,
-        32, 118, 134, 134, 32, 33, 123, 118,
-        118, 118, 32, 118, 123, 118, 118, 130,
-        123, 118, 118, 118, 32, 118, 119, 120,
-        122, 122, 32, 33, 123, 118, 118, 118,
-        32, 118, 118, 124, 118, 135, 136, 136,
-        32, 33, 123, 118, 118, 118, 32, 118,
-        127, 137, 118, 35, 123, 118, 129, 129,
-        118, 35, 123, 118, 127, 118, 129, 129,
-        118, 35, 123, 118, 129, 137, 118, 35,
-        123, 118, 42, 43, 44, 45, 106, 102,
-        22, 23, 48, 49, 49, 24, 22, 100,
-        42, 52, 100, 56, 138, 58, 59, 4,
-        5, 60, 55, 55, 8, 4, 55, 55,
-        61, 55, 42, 43, 44, 45, 139, 140,
-        22, 141, 142, 55, 49, 24, 22, 55,
-        42, 52, 55, 20, 143, 143, 22, 141,
-        60, 55, 55, 24, 22, 55, 60, 55,
-        55, 67, 60, 55, 55, 55, 22, 55,
-        142, 55, 55, 144, 142, 55, 55, 55,
-        22, 55, 142, 55, 142, 55, 55, 55,
-        142, 55, 42, 55, 68, 20, 143, 143,
-        22, 141, 60, 55, 55, 55, 22, 55,
-        42, 55, 146, 145, 147, 147, 145, 40,
-        148, 145, 147, 147, 145, 40, 148, 145,
-        148, 145, 145, 149, 148, 145, 148, 145,
-        148, 145, 145, 145, 148, 145, 42, 117,
-        117, 117, 117, 117, 117, 117, 117, 49,
-        117, 117, 117, 117, 42, 117, 0
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 38, 0, 40, 39, 39,
+        39, 39, 39, 39, 39, 39, 39, 39,
+        39, 39, 39, 39, 39, 39, 39, 39,
+        39, 39, 39, 39, 39, 39, 39, 39,
+        39, 39, 39, 39, 39, 39, 39, 39,
+        39, 39, 39, 39, 39, 39, 39, 39,
+        39, 39, 39, 39, 39, 39, 40, 39,
+        42, 43, 44, 45, 46, 47, 22, 23,
+        48, 49, 49, 24, 22, 50, 51, 52,
+        53, 54, 41, 41, 41, 41, 41, 41,
+        41, 41, 41, 41, 41, 41, 41, 41,
+        41, 41, 41, 41, 41, 41, 41, 41,
+        41, 41, 41, 41, 41, 41, 41, 41,
+        41, 41, 41, 41, 41, 41, 41, 41,
+        55, 41, 57, 58, 59, 60, 4, 5,
+        61, 56, 56, 8, 4, 56, 56, 62,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        5, 56, 63, 58, 64, 64, 4, 5,
+        61, 56, 56, 56, 4, 56, 56, 62,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        5, 56, 58, 64, 64, 4, 5, 61,
+        56, 56, 56, 4, 56, 56, 62, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 5,
+        56, 42, 56, 56, 56, 65, 66, 56,
+        1, 61, 56, 56, 56, 56, 56, 42,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 1, 56, 67, 67, 56, 1, 61,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 1,
+        56, 61, 56, 56, 68, 61, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 68, 56, 61,
+        56, 61, 56, 56, 56, 61, 56, 42,
+        56, 69, 56, 67, 67, 56, 1, 61,
+        56, 56, 56, 56, 56, 42, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 1,
+        56, 42, 56, 56, 56, 67, 67, 56,
+        1, 61, 56, 56, 56, 56, 56, 42,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 1, 56, 42, 56, 56, 56, 67,
+        66, 56, 1, 61, 56, 56, 56, 56,
+        56, 42, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 1, 56, 70, 71, 72,
+        72, 4, 5, 61, 56, 56, 56, 4,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 5, 56, 71, 72, 72,
+        4, 5, 61, 56, 56, 56, 4, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 5, 56, 72, 72, 4, 5,
+        61, 56, 56, 56, 4, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        5, 56, 61, 56, 56, 68, 61, 56,
+        56, 56, 4, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 68, 56,
+        73, 74, 74, 4, 5, 61, 56, 56,
+        56, 4, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 5, 56, 65,
+        75, 56, 1, 61, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 1, 56, 65, 56, 67,
+        67, 56, 1, 61, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 1, 56, 67, 75, 56,
+        1, 61, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 1, 56, 57, 58, 64, 64, 4,
+        5, 61, 56, 56, 56, 4, 56, 56,
+        62, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 5, 56, 57, 58, 59, 64, 4,
+        5, 61, 56, 56, 8, 4, 56, 56,
+        62, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 5, 56, 77, 78, 79, 80, 12,
+        13, 81, 76, 76, 18, 12, 76, 76,
+        82, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 13, 76, 83, 78, 84, 80, 12,
+        13, 81, 76, 76, 76, 12, 76, 76,
+        82, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 13, 76, 78, 84, 80, 12, 13,
+        81, 76, 76, 76, 12, 76, 76, 82,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        13, 76, 85, 76, 76, 76, 86, 87,
+        76, 14, 81, 76, 76, 76, 76, 76,
+        85, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 14, 76, 88, 78, 89, 90,
+        12, 13, 81, 76, 76, 17, 12, 76,
+        76, 82, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 13, 76, 91, 78, 84, 84,
+        12, 13, 81, 76, 76, 76, 12, 76,
+        76, 82, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 13, 76, 78, 84, 84, 12,
+        13, 81, 76, 76, 76, 12, 76, 76,
+        82, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 13, 76, 85, 76, 76, 76, 92,
+        87, 76, 14, 81, 76, 76, 76, 76,
+        76, 85, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 14, 76, 81, 76, 76,
+        93, 81, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 93, 76, 81, 76, 81, 76, 76,
+        76, 81, 76, 85, 76, 94, 76, 92,
+        92, 76, 14, 81, 76, 76, 76, 76,
+        76, 85, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 14, 76, 85, 76, 76,
+        76, 92, 92, 76, 14, 81, 76, 76,
+        76, 76, 76, 85, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 14, 76, 95,
+        96, 97, 97, 12, 13, 81, 76, 76,
+        76, 12, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 13, 76, 96,
+        97, 97, 12, 13, 81, 76, 76, 76,
+        12, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 13, 76, 97, 97,
+        12, 13, 81, 76, 76, 76, 12, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 13, 76, 81, 76, 76, 93,
+        81, 76, 76, 76, 12, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        93, 76, 98, 99, 99, 12, 13, 81,
+        76, 76, 76, 12, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 13,
+        76, 86, 100, 76, 14, 81, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 14, 76, 92,
+        92, 76, 14, 81, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 14, 76, 86, 76, 92,
+        92, 76, 14, 81, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 14, 76, 92, 100, 76,
+        14, 81, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 14, 76, 88, 78, 84, 84, 12,
+        13, 81, 76, 76, 76, 12, 76, 76,
+        82, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 13, 76, 88, 78, 89, 84, 12,
+        13, 81, 76, 76, 17, 12, 76, 76,
+        82, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 13, 76, 10, 11, 11, 12, 13,
+        76, 76, 76, 76, 12, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        13, 76, 77, 78, 84, 80, 12, 13,
+        81, 76, 76, 76, 12, 76, 76, 82,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        76, 76, 76, 76, 76, 76, 76, 76,
+        13, 76, 102, 45, 103, 103, 22, 23,
+        48, 101, 101, 101, 22, 101, 101, 52,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        23, 101, 45, 103, 103, 22, 23, 48,
+        101, 101, 101, 22, 101, 101, 52, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 23,
+        101, 104, 101, 101, 101, 105, 106, 101,
+        25, 48, 101, 101, 101, 101, 101, 104,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 25, 101, 44, 45, 107, 108, 22,
+        23, 48, 101, 101, 24, 22, 101, 101,
+        52, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 23, 101, 104, 101, 101, 101, 109,
+        106, 101, 25, 48, 101, 101, 101, 101,
+        101, 104, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 25, 101, 48, 101, 101,
+        110, 48, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 110, 101, 48, 101, 48, 101, 101,
+        101, 48, 101, 104, 101, 111, 101, 109,
+        109, 101, 25, 48, 101, 101, 101, 101,
+        101, 104, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 25, 101, 104, 101, 101,
+        101, 109, 109, 101, 25, 48, 101, 101,
+        101, 101, 101, 104, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 25, 101, 112,
+        113, 114, 114, 22, 23, 48, 101, 101,
+        101, 22, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 23, 101, 113,
+        114, 114, 22, 23, 48, 101, 101, 101,
+        22, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 23, 101, 114, 114,
+        22, 23, 48, 101, 101, 101, 22, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 23, 101, 48, 26, 26, 110,
+        48, 26, 26, 26, 22, 26, 26, 26,
+        26, 26, 26, 26, 26, 26, 26, 26,
+        26, 26, 26, 26, 26, 26, 26, 26,
+        26, 26, 26, 26, 26, 26, 26, 26,
+        26, 26, 26, 26, 26, 26, 26, 26,
+        26, 26, 26, 26, 26, 26, 26, 26,
+        110, 26, 44, 45, 103, 103, 22, 23,
+        48, 101, 101, 101, 22, 101, 101, 52,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        23, 101, 115, 116, 116, 22, 23, 48,
+        101, 101, 101, 22, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 23,
+        101, 105, 117, 101, 25, 48, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 25, 101, 109,
+        109, 101, 25, 48, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 25, 101, 105, 101, 109,
+        109, 101, 25, 48, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 25, 101, 109, 117, 101,
+        25, 48, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 25, 101, 44, 45, 107, 103, 22,
+        23, 48, 101, 101, 24, 22, 101, 101,
+        52, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 23, 101, 20, 21, 21, 22, 23,
+        118, 118, 118, 24, 22, 118, 118, 118,
+        118, 118, 118, 118, 118, 118, 118, 118,
+        118, 118, 118, 118, 118, 118, 118, 118,
+        118, 118, 118, 118, 118, 118, 118, 118,
+        118, 118, 118, 118, 118, 118, 118, 118,
+        118, 118, 118, 118, 118, 118, 118, 118,
+        23, 118, 20, 21, 21, 22, 23, 118,
+        118, 118, 118, 22, 118, 118, 118, 118,
+        118, 118, 118, 118, 118, 118, 118, 118,
+        118, 118, 118, 118, 118, 118, 118, 118,
+        118, 118, 118, 118, 118, 118, 118, 118,
+        118, 118, 118, 118, 118, 118, 118, 118,
+        118, 118, 118, 118, 118, 118, 118, 23,
+        118, 120, 121, 122, 123, 32, 33, 124,
+        119, 119, 34, 32, 119, 119, 125, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 33,
+        119, 126, 121, 123, 123, 32, 33, 124,
+        119, 119, 119, 32, 119, 119, 125, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 33,
+        119, 121, 123, 123, 32, 33, 124, 119,
+        119, 119, 32, 119, 119, 125, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 33, 119,
+        127, 119, 119, 119, 128, 129, 119, 35,
+        124, 119, 119, 119, 119, 119, 127, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        35, 119, 120, 121, 122, 49, 32, 33,
+        124, 119, 119, 34, 32, 119, 119, 125,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        33, 119, 127, 119, 119, 119, 130, 129,
+        119, 35, 124, 119, 119, 119, 119, 119,
+        127, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 35, 119, 124, 119, 119, 131,
+        124, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        131, 119, 124, 119, 124, 119, 119, 119,
+        124, 119, 127, 119, 132, 119, 130, 130,
+        119, 35, 124, 119, 119, 119, 119, 119,
+        127, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 35, 119, 127, 119, 119, 119,
+        130, 130, 119, 35, 124, 119, 119, 119,
+        119, 119, 127, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 35, 119, 133, 134,
+        135, 135, 32, 33, 124, 119, 119, 119,
+        32, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 33, 119, 134, 135,
+        135, 32, 33, 124, 119, 119, 119, 32,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 33, 119, 135, 135, 32,
+        33, 124, 119, 119, 119, 32, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 33, 119, 124, 119, 119, 131, 124,
+        119, 119, 119, 32, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 131,
+        119, 120, 121, 123, 123, 32, 33, 124,
+        119, 119, 119, 32, 119, 119, 125, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 33,
+        119, 136, 137, 137, 32, 33, 124, 119,
+        119, 119, 32, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 33, 119,
+        128, 138, 119, 35, 124, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 35, 119, 130, 130,
+        119, 35, 124, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 35, 119, 128, 119, 130, 130,
+        119, 35, 124, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 35, 119, 130, 138, 119, 35,
+        124, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        119, 119, 119, 119, 119, 119, 119, 119,
+        35, 119, 42, 43, 44, 45, 107, 103,
+        22, 23, 48, 49, 49, 24, 22, 101,
+        42, 52, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 101, 101, 101, 101, 101, 101,
+        101, 101, 23, 101, 57, 139, 59, 60,
+        4, 5, 61, 56, 56, 8, 4, 56,
+        56, 62, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 5, 56, 42, 43, 44, 45,
+        140, 141, 22, 142, 143, 56, 49, 24,
+        22, 56, 42, 52, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 142, 56, 20, 144,
+        144, 22, 142, 61, 56, 56, 24, 22,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 142, 56, 61, 56, 56,
+        68, 61, 56, 56, 56, 22, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 68, 56, 143, 56, 56, 145, 143,
+        56, 56, 56, 22, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 145,
+        56, 143, 56, 143, 56, 56, 56, 143,
+        56, 42, 56, 69, 20, 144, 144, 22,
+        142, 61, 56, 56, 56, 22, 56, 42,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 56, 56, 56, 56, 56, 56, 56,
+        56, 142, 56, 147, 146, 148, 148, 146,
+        40, 149, 146, 146, 146, 146, 146, 146,
+        146, 146, 146, 146, 146, 146, 146, 146,
+        146, 146, 146, 146, 146, 146, 146, 146,
+        146, 146, 146, 146, 146, 146, 146, 146,
+        146, 146, 146, 146, 146, 146, 146, 146,
+        146, 146, 146, 146, 146, 146, 146, 146,
+        146, 40, 146, 148, 148, 146, 40, 149,
+        146, 146, 146, 146, 146, 146, 146, 146,
+        146, 146, 146, 146, 146, 146, 146, 146,
+        146, 146, 146, 146, 146, 146, 146, 146,
+        146, 146, 146, 146, 146, 146, 146, 146,
+        146, 146, 146, 146, 146, 146, 146, 146,
+        146, 146, 146, 146, 146, 146, 146, 40,
+        146, 149, 146, 146, 150, 149, 146, 146,
+        146, 146, 146, 146, 146, 146, 146, 146,
+        146, 146, 146, 146, 146, 146, 146, 146,
+        146, 146, 146, 146, 146, 146, 146, 146,
+        146, 146, 146, 146, 146, 146, 146, 146,
+        146, 146, 146, 146, 146, 146, 146, 146,
+        146, 146, 146, 146, 146, 150, 146, 149,
+        146, 149, 146, 146, 146, 149, 146, 42,
+        118, 118, 118, 118, 118, 118, 118, 118,
+        49, 118, 118, 118, 118, 42, 118, 0
 };
 
 static const unsigned char _indic_syllable_machine_trans_targs[] = {
@@ -330,41 +996,41 @@ static const unsigned char _indic_syllable_machine_trans_targs[] = {
         93, 84, 31, 19, 98, 31, 107, 24,
         113, 116, 117, 108, 26, 122, 127, 31,
         134, 31, 32, 53, 79, 81, 100, 101,
-        85, 102, 123, 124, 94, 132, 137, 31,
-        33, 35, 6, 52, 38, 47, 34, 1,
-        36, 40, 0, 39, 41, 44, 45, 3,
-        48, 5, 49, 31, 54, 56, 14, 77,
-        62, 70, 55, 7, 57, 72, 64, 58,
-        13, 76, 59, 8, 63, 65, 67, 68,
-        10, 71, 12, 73, 31, 80, 20, 82,
-        96, 87, 15, 99, 16, 86, 88, 90,
-        91, 18, 95, 21, 97, 31, 31, 103,
-        105, 22, 27, 109, 118, 104, 106, 120,
-        111, 23, 110, 112, 114, 115, 25, 119,
-        28, 121, 125, 126, 131, 128, 129, 29,
-        130, 31, 133, 30, 135, 136
+        85, 102, 123, 124, 94, 132, 137, 92,
+        31, 33, 35, 6, 52, 38, 47, 34,
+        1, 36, 40, 0, 39, 41, 44, 45,
+        3, 48, 5, 49, 31, 54, 56, 14,
+        77, 62, 70, 55, 7, 57, 72, 64,
+        58, 13, 76, 59, 8, 63, 65, 67,
+        68, 10, 71, 12, 73, 31, 80, 20,
+        82, 96, 87, 15, 99, 16, 86, 88,
+        90, 91, 18, 95, 21, 97, 31, 31,
+        103, 105, 22, 27, 109, 118, 104, 106,
+        120, 111, 23, 110, 112, 114, 115, 25,
+        119, 28, 121, 125, 126, 131, 128, 129,
+        29, 130, 31, 133, 30, 135, 136
 };
 
 static const char _indic_syllable_machine_trans_actions[] = {
         1, 0, 2, 0, 2, 0, 0, 2,
         2, 3, 2, 0, 2, 0, 0, 0,
-        2, 2, 2, 4, 2, 0, 5, 0,
+        2, 2, 2, 4, 2, 0, 5, 5,
         5, 0, 6, 0, 2, 7, 2, 0,
         2, 0, 2, 0, 0, 2, 0, 8,
         0, 11, 2, 2, 5, 0, 12, 12,
         0, 2, 5, 2, 5, 2, 0, 13,
-        2, 0, 0, 2, 0, 2, 2, 0,
-        2, 2, 0, 0, 2, 2, 2, 0,
-        0, 0, 2, 14, 2, 0, 0, 2,
-        0, 2, 2, 0, 2, 2, 2, 2,
+        14, 2, 0, 0, 2, 0, 2, 2,
         0, 2, 2, 0, 0, 2, 2, 2,
-        0, 0, 0, 2, 15, 5, 0, 5,
-        2, 2, 0, 5, 0, 0, 2, 5,
-        5, 0, 0, 0, 2, 16, 17, 2,
-        0, 0, 0, 0, 2, 2, 2, 2,
-        2, 0, 0, 2, 2, 2, 0, 0,
-        0, 2, 0, 18, 18, 0, 0, 0,
-        0, 19, 2, 0, 0, 0
+        0, 0, 0, 2, 15, 2, 0, 0,
+        2, 0, 2, 2, 0, 2, 2, 2,
+        2, 0, 2, 2, 0, 0, 2, 2,
+        2, 0, 0, 0, 2, 16, 5, 0,
+        5, 2, 2, 0, 5, 0, 0, 2,
+        5, 5, 0, 0, 0, 2, 17, 18,
+        2, 0, 0, 0, 0, 2, 2, 2,
+        2, 2, 0, 0, 2, 2, 2, 0,
+        0, 0, 2, 0, 19, 19, 0, 0,
+        0, 0, 20, 2, 0, 0, 0
 };
 
 static const char _indic_syllable_machine_to_state_actions[] = {
@@ -414,20 +1080,20 @@ static const short _indic_syllable_machine_eof_trans[] = {
         10, 10, 10, 10, 10, 10, 10, 20,
         20, 27, 20, 27, 20, 20, 30, 30,
         30, 30, 30, 30, 30, 1, 40, 0,
-        56, 56, 56, 56, 56, 56, 56, 56,
-        56, 56, 56, 56, 56, 56, 56, 56,
-        56, 56, 56, 56, 56, 76, 76, 76,
-        76, 76, 76, 76, 76, 76, 76, 76,
-        76, 76, 76, 76, 76, 76, 76, 76,
-        76, 76, 76, 76, 76, 76, 76, 101,
-        101, 101, 101, 101, 101, 101, 101, 101,
-        101, 101, 101, 101, 101, 101, 101, 101,
-        101, 101, 101, 101, 118, 118, 119, 119,
-        119, 119, 119, 119, 119, 119, 119, 119,
-        119, 119, 119, 119, 119, 119, 119, 119,
-        119, 119, 119, 101, 56, 56, 56, 56,
-        56, 56, 56, 56, 146, 146, 146, 146,
-        146, 118
+        57, 57, 57, 57, 57, 57, 57, 57,
+        57, 57, 57, 57, 57, 57, 57, 57,
+        57, 57, 57, 57, 57, 77, 77, 77,
+        77, 77, 77, 77, 77, 77, 77, 77,
+        77, 77, 77, 77, 77, 77, 77, 77,
+        77, 77, 77, 77, 77, 77, 77, 102,
+        102, 102, 102, 102, 102, 102, 102, 102,
+        102, 102, 102, 102, 27, 102, 102, 102,
+        102, 102, 102, 102, 119, 119, 120, 120,
+        120, 120, 120, 120, 120, 120, 120, 120,
+        120, 120, 120, 120, 120, 120, 120, 120,
+        120, 120, 120, 102, 57, 57, 57, 57,
+        57, 57, 57, 57, 147, 147, 147, 147,
+        147, 119
 };
 
 static const int indic_syllable_machine_start = 31;
@@ -441,7 +1107,7 @@ static const int indic_syllable_machine_en_main = 31;
 
 
 
-#line 118 "hb-ot-shaper-indic-machine.rl"
+#line 121 "hb-ot-shaper-indic-machine.rl"
 
 
 #define found_syllable(syllable_type) \
@@ -460,7 +1126,7 @@ find_syllables_indic (hb_buffer_t *buffer)
   int cs;
   hb_glyph_info_t *info = buffer->info;
 
-#line 464 "hb-ot-shaper-indic-machine.hh"
+#line 1130 "hb-ot-shaper-indic-machine.hh"
         {
         cs = indic_syllable_machine_start;
         ts = 0;
@@ -468,7 +1134,7 @@ find_syllables_indic (hb_buffer_t *buffer)
         act = 0;
         }
 
-#line 138 "hb-ot-shaper-indic-machine.rl"
+#line 141 "hb-ot-shaper-indic-machine.rl"
 
 
   p = 0;
@@ -476,7 +1142,7 @@ find_syllables_indic (hb_buffer_t *buffer)
 
   unsigned int syllable_serial = 1;
 
-#line 480 "hb-ot-shaper-indic-machine.hh"
+#line 1146 "hb-ot-shaper-indic-machine.hh"
         {
         int _slen;
         int _trans;
@@ -490,7 +1156,7 @@ _resume:
 #line 1 "NONE"
         {ts = p;}
         break;
-#line 494 "hb-ot-shaper-indic-machine.hh"
+#line 1160 "hb-ot-shaper-indic-machine.hh"
         }
 
         _keys = _indic_syllable_machine_trans_keys + (cs<<1);
@@ -513,51 +1179,51 @@ _eof_trans:
         {te = p+1;}
         break;
         case 11:
-#line 114 "hb-ot-shaper-indic-machine.rl"
+#line 117 "hb-ot-shaper-indic-machine.rl"
         {te = p+1;{ found_syllable (indic_non_indic_cluster); }}
         break;
-        case 13:
-#line 109 "hb-ot-shaper-indic-machine.rl"
+        case 14:
+#line 111 "hb-ot-shaper-indic-machine.rl"
         {te = p;p--;{ found_syllable (indic_consonant_syllable); }}
         break;
-        case 14:
-#line 110 "hb-ot-shaper-indic-machine.rl"
+        case 15:
+#line 112 "hb-ot-shaper-indic-machine.rl"
         {te = p;p--;{ found_syllable (indic_vowel_syllable); }}
         break;
-        case 17:
-#line 111 "hb-ot-shaper-indic-machine.rl"
+        case 18:
+#line 113 "hb-ot-shaper-indic-machine.rl"
         {te = p;p--;{ found_syllable (indic_standalone_cluster); }}
         break;
-        case 19:
-#line 112 "hb-ot-shaper-indic-machine.rl"
+        case 20:
+#line 114 "hb-ot-shaper-indic-machine.rl"
         {te = p;p--;{ found_syllable (indic_symbol_cluster); }}
         break;
-        case 15:
-#line 113 "hb-ot-shaper-indic-machine.rl"
+        case 16:
+#line 116 "hb-ot-shaper-indic-machine.rl"
         {te = p;p--;{ found_syllable (indic_broken_cluster); buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_BROKEN_SYLLABLE; }}
         break;
-        case 16:
-#line 114 "hb-ot-shaper-indic-machine.rl"
+        case 17:
+#line 117 "hb-ot-shaper-indic-machine.rl"
         {te = p;p--;{ found_syllable (indic_non_indic_cluster); }}
         break;
         case 1:
-#line 109 "hb-ot-shaper-indic-machine.rl"
+#line 111 "hb-ot-shaper-indic-machine.rl"
         {{p = ((te))-1;}{ found_syllable (indic_consonant_syllable); }}
         break;
         case 3:
-#line 110 "hb-ot-shaper-indic-machine.rl"
+#line 112 "hb-ot-shaper-indic-machine.rl"
         {{p = ((te))-1;}{ found_syllable (indic_vowel_syllable); }}
         break;
         case 7:
-#line 111 "hb-ot-shaper-indic-machine.rl"
+#line 113 "hb-ot-shaper-indic-machine.rl"
         {{p = ((te))-1;}{ found_syllable (indic_standalone_cluster); }}
         break;
         case 8:
-#line 112 "hb-ot-shaper-indic-machine.rl"
+#line 114 "hb-ot-shaper-indic-machine.rl"
         {{p = ((te))-1;}{ found_syllable (indic_symbol_cluster); }}
         break;
         case 4:
-#line 113 "hb-ot-shaper-indic-machine.rl"
+#line 116 "hb-ot-shaper-indic-machine.rl"
         {{p = ((te))-1;}{ found_syllable (indic_broken_cluster); buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_BROKEN_SYLLABLE; }}
         break;
         case 6:
@@ -567,33 +1233,42 @@ _eof_trans:
         {{p = ((te))-1;} found_syllable (indic_consonant_syllable); }
         break;
         case 5:
-        {{p = ((te))-1;} found_syllable (indic_broken_cluster); buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_BROKEN_SYLLABLE; }
+        {{p = ((te))-1;} found_syllable (indic_non_indic_cluster); }
         break;
         case 6:
+        {{p = ((te))-1;} found_syllable (indic_broken_cluster); buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_BROKEN_SYLLABLE; }
+        break;
+        case 7:
         {{p = ((te))-1;} found_syllable (indic_non_indic_cluster); }
         break;
         }
         }
         break;
-        case 18:
+        case 19:
 #line 1 "NONE"
         {te = p+1;}
-#line 109 "hb-ot-shaper-indic-machine.rl"
+#line 111 "hb-ot-shaper-indic-machine.rl"
         {act = 1;}
         break;
-        case 5:
+        case 13:
 #line 1 "NONE"
         {te = p+1;}
-#line 113 "hb-ot-shaper-indic-machine.rl"
+#line 115 "hb-ot-shaper-indic-machine.rl"
         {act = 5;}
         break;
-        case 12:
+        case 5:
 #line 1 "NONE"
         {te = p+1;}
-#line 114 "hb-ot-shaper-indic-machine.rl"
+#line 116 "hb-ot-shaper-indic-machine.rl"
         {act = 6;}
         break;
-#line 597 "hb-ot-shaper-indic-machine.hh"
+        case 12:
+#line 1 "NONE"
+        {te = p+1;}
+#line 117 "hb-ot-shaper-indic-machine.rl"
+        {act = 7;}
+        break;
+#line 1272 "hb-ot-shaper-indic-machine.hh"
         }
 
 _again:
@@ -602,7 +1277,7 @@ _again:
 #line 1 "NONE"
         {ts = 0;}
         break;
-#line 606 "hb-ot-shaper-indic-machine.hh"
+#line 1281 "hb-ot-shaper-indic-machine.hh"
         }
 
         if ( ++p != pe )
@@ -618,7 +1293,7 @@ _again:
 
         }
 
-#line 146 "hb-ot-shaper-indic-machine.rl"
+#line 149 "hb-ot-shaper-indic-machine.rl"
 
 }
 
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-indic-table.cc b/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-indic-table.cc
index d9899a633c18..b87c530853bf 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-indic-table.cc
+++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-indic-table.cc
@@ -6,12 +6,12 @@
  *
  * on files with these headers:
  *
- * # IndicSyllabicCategory-15.1.0.txt
- * # Date: 2023-01-05
- * # IndicPositionalCategory-15.1.0.txt
- * # Date: 2023-01-05
- * # Blocks-15.1.0.txt
- * # Date: 2023-07-28, 15:47:20 GMT
+ * # IndicSyllabicCategory-16.0.0.txt
+ * # Date: 2024-04-30, 21:48:21 GMT
+ * # IndicPositionalCategory-16.0.0.txt
+ * # Date: 2024-04-30, 21:48:21 GMT
+ * # Blocks-16.0.0.txt
+ * # Date: 2024-02-02
  */
 
 #include "hb.hh"
@@ -48,6 +48,7 @@
 #define OT_CM I_Cat(CM)
 #define OT_Symbol I_Cat(Symbol)
 #define OT_CS I_Cat(CS)
+#define OT_SMPst I_Cat(SMPst)
 /* khmer */
 #define OT_VAbv K_Cat(VAbv)
 #define OT_VBlw K_Cat(VBlw)
@@ -89,12 +90,13 @@ static_assert (OT_VPst == M_Cat(VPst), "");
 #define _OT_MW   OT_MW           /*   2 chars; MW */
 #define _OT_MY   OT_MY           /*   3 chars; MY */
 #define _OT_N    OT_N            /*  17 chars; N */
-#define _OT_GB   OT_PLACEHOLDER  /* 165 chars; PLACEHOLDER */
+#define _OT_GB   OT_PLACEHOLDER  /* 185 chars; PLACEHOLDER */
 #define _OT_PT   OT_PT           /*   8 chars; PT */
 #define _OT_R    OT_Ra           /*  14 chars; Ra */
 #define _OT_Rf   OT_Repha        /*   1 chars; Repha */
 #define _OT_Rt   OT_Robatic      /*   3 chars; Robatic */
-#define _OT_SM   OT_SM           /*  56 chars; SM */
+#define _OT_SM   OT_SM           /*  50 chars; SM */
+#define _OT_SP   OT_SMPst        /*   6 chars; SMPst */
 #define _OT_S    OT_Symbol       /*  22 chars; Symbol */
 #define _OT_V    OT_V            /* 172 chars; V */
 #define _OT_VA   OT_VAbv         /*  18 chars; VAbv */
@@ -112,7 +114,7 @@ static_assert (OT_VPst == M_Cat(VPst), "");
 #define _POS_A   POS_AFTER_MAIN  /*   3 chars; AFTER_MAIN */
 #define _POS_AP  POS_AFTER_POST  /*  50 chars; AFTER_POST */
 #define _POS_AS  POS_AFTER_SUB   /*  51 chars; AFTER_SUB */
-#define _POS_C   POS_BASE_C      /* 833 chars; BASE_C */
+#define _POS_C   POS_BASE_C      /* 853 chars; BASE_C */
 #define _POS_BS  POS_BEFORE_SUB  /*  25 chars; BEFORE_SUB */
 #define _POS_B   POS_BELOW_C     /*  13 chars; BELOW_C */
 #define _POS_X   POS_END         /*  71 chars; END */
@@ -145,7 +147,7 @@ static const uint16_t indic_table[] = {
 
   /* Latin-1 Supplement */
 
-  /* 00B0 */  _(X,X),  _(X,X),_(SM,SM),_(SM,SM),  _(X,X),  _(X,X),  _(X,X),  _(X,X),
+  /* 00B0 */  _(X,X),  _(X,X),_(SP,SM),_(SP,SM),  _(X,X),  _(X,X),  _(X,X),  _(X,X),
   /* 00B8 */  _(X,X),  _(X,X),  _(X,X),  _(X,X),  _(X,X),  _(X,X),  _(X,X),  _(X,X),
   /* 00C0 */  _(X,X),  _(X,X),  _(X,X),  _(X,X),  _(X,X),  _(X,X),  _(X,X),  _(X,X),
   /* 00C8 */  _(X,X),  _(X,X),  _(X,X),  _(X,X),  _(X,X),  _(X,X),  _(X,X),  _(X,X),
@@ -398,9 +400,9 @@ static const uint16_t indic_table[] = {
 
   /* Superscripts and Subscripts */
 
-  /* 2070 */  _(X,X),  _(X,X),  _(X,X),  _(X,X),_(SM,SM),  _(X,X),  _(X,X),  _(X,X),
+  /* 2070 */  _(X,X),  _(X,X),  _(X,X),  _(X,X),_(SP,SM),  _(X,X),  _(X,X),  _(X,X),
   /* 2078 */  _(X,X),  _(X,X),  _(X,X),  _(X,X),  _(X,X),  _(X,X),  _(X,X),  _(X,X),
-  /* 2080 */  _(X,X),  _(X,X),_(SM,SM),_(SM,SM),_(SM,SM),  _(X,X),  _(X,X),  _(X,X),
+  /* 2080 */  _(X,X),  _(X,X),_(SP,SM),_(SP,SM),_(SP,SM),  _(X,X),  _(X,X),  _(X,X),
 
 #define indic_offset_0x25f8u 1592
 
@@ -458,7 +460,16 @@ static const uint16_t indic_table[] = {
 
   /* 11338 */  _(X,X),  _(X,X),  _(X,X),  _(N,X),  _(N,X),  _(X,X),  _(X,X),  _(X,X),
 
-}; /* Table items: 1728; occupancy: 71% */
+#define indic_offset_0x116d0u 1728
+
+
+  /* Myanmar Extended-C */
+
+  /* 116D0 */ _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C),
+  /* 116D8 */ _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C), _(GB,C),
+  /* 116E0 */ _(GB,C), _(GB,C), _(GB,C), _(GB,C),  _(X,X),  _(X,X),  _(X,X),  _(X,X),
+
+}; /* Table items: 1752; occupancy: 71% */
 
 uint16_t
 hb_indic_get_categories (hb_codepoint_t u)
@@ -498,6 +509,7 @@ hb_indic_get_categories (hb_codepoint_t u)
     case 0x11u:
       if (hb_in_range (u, 0x11300u, 0x11307u)) return indic_table[u - 0x11300u + indic_offset_0x11300u];
       if (hb_in_range (u, 0x11338u, 0x1133Fu)) return indic_table[u - 0x11338u + indic_offset_0x11338u];
+      if (hb_in_range (u, 0x116D0u, 0x116E7u)) return indic_table[u - 0x116D0u + indic_offset_0x116d0u];
       break;
 
     default:
@@ -530,6 +542,7 @@ hb_indic_get_categories (hb_codepoint_t u)
 #undef _OT_Rf
 #undef _OT_Rt
 #undef _OT_SM
+#undef _OT_SP
 #undef _OT_S
 #undef _OT_V
 #undef _OT_VA
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-myanmar-machine.hh b/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-myanmar-machine.hh
index 3dcf61b938f3..64eb761b4ea9 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-myanmar-machine.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-myanmar-machine.hh
@@ -68,6 +68,7 @@ enum myanmar_syllable_type_t {
 #define myanmar_syllable_machine_ex_PT 39u
 #define myanmar_syllable_machine_ex_Ra 15u
 #define myanmar_syllable_machine_ex_SM 8u
+#define myanmar_syllable_machine_ex_SMPst 57u
 #define myanmar_syllable_machine_ex_VAbv 20u
 #define myanmar_syllable_machine_ex_VBlw 21u
 #define myanmar_syllable_machine_ex_VPre 22u
@@ -77,35 +78,35 @@ enum myanmar_syllable_type_t {
 #define myanmar_syllable_machine_ex_ZWNJ 5u
 
 
-#line 81 "hb-ot-shaper-myanmar-machine.hh"
+#line 82 "hb-ot-shaper-myanmar-machine.hh"
 static const unsigned char _myanmar_syllable_machine_trans_keys[] = {
-        1u, 41u, 3u, 41u, 5u, 39u, 5u, 8u, 3u, 41u, 3u, 39u, 3u, 39u, 5u, 39u,
-        5u, 39u, 3u, 39u, 3u, 39u, 3u, 41u, 5u, 39u, 1u, 15u, 3u, 39u, 3u, 39u,
-        3u, 40u, 3u, 39u, 3u, 41u, 3u, 41u, 3u, 39u, 3u, 41u, 3u, 41u, 3u, 41u,
-        3u, 41u, 3u, 41u, 5u, 39u, 5u, 8u, 3u, 41u, 3u, 39u, 3u, 39u, 5u, 39u,
-        5u, 39u, 3u, 39u, 3u, 39u, 3u, 41u, 5u, 39u, 1u, 15u, 3u, 41u, 3u, 39u,
-        3u, 39u, 3u, 40u, 3u, 39u, 3u, 41u, 3u, 41u, 3u, 39u, 3u, 41u, 3u, 41u,
-        3u, 41u, 3u, 41u, 3u, 41u, 3u, 41u, 3u, 41u, 1u, 41u, 1u, 15u, 0
+        1u, 57u, 3u, 57u, 5u, 57u, 5u, 57u, 3u, 57u, 5u, 57u, 3u, 57u, 3u, 57u,
+        3u, 57u, 3u, 57u, 3u, 57u, 5u, 57u, 1u, 15u, 3u, 57u, 3u, 57u, 3u, 57u,
+        3u, 57u, 3u, 57u, 3u, 57u, 3u, 57u, 3u, 57u, 3u, 57u, 3u, 57u, 3u, 57u,
+        3u, 57u, 5u, 57u, 5u, 57u, 3u, 57u, 5u, 57u, 3u, 57u, 3u, 57u, 3u, 57u,
+        3u, 57u, 3u, 57u, 5u, 57u, 1u, 15u, 3u, 57u, 3u, 57u, 3u, 57u, 3u, 57u,
+        3u, 57u, 3u, 57u, 3u, 57u, 3u, 57u, 3u, 57u, 3u, 57u, 3u, 57u, 3u, 57u,
+        3u, 57u, 3u, 57u, 3u, 57u, 1u, 57u, 1u, 15u, 0
 };
 
 static const char _myanmar_syllable_machine_key_spans[] = {
-        41, 39, 35, 4, 39, 37, 37, 35,
-        35, 37, 37, 39, 35, 15, 37, 37,
-        38, 37, 39, 39, 37, 39, 39, 39,
-        39, 39, 35, 4, 39, 37, 37, 35,
-        35, 37, 37, 39, 35, 15, 39, 37,
-        37, 38, 37, 39, 39, 37, 39, 39,
-        39, 39, 39, 39, 39, 41, 15
+        57, 55, 53, 53, 55, 53, 55, 55,
+        55, 55, 55, 53, 15, 55, 55, 55,
+        55, 55, 55, 55, 55, 55, 55, 55,
+        55, 53, 53, 55, 53, 55, 55, 55,
+        55, 55, 53, 15, 55, 55, 55, 55,
+        55, 55, 55, 55, 55, 55, 55, 55,
+        55, 55, 55, 57, 15
 };
 
 static const short _myanmar_syllable_machine_index_offsets[] = {
-        0, 42, 82, 118, 123, 163, 201, 239,
-        275, 311, 349, 387, 427, 463, 479, 517,
-        555, 594, 632, 672, 712, 750, 790, 830,
-        870, 910, 950, 986, 991, 1031, 1069, 1107,
-        1143, 1179, 1217, 1255, 1295, 1331, 1347, 1387,
-        1425, 1463, 1502, 1540, 1580, 1620, 1658, 1698,
-        1738, 1778, 1818, 1858, 1898, 1938, 1980
+        0, 58, 114, 168, 222, 278, 332, 388,
+        444, 500, 556, 612, 666, 682, 738, 794,
+        850, 906, 962, 1018, 1074, 1130, 1186, 1242,
+        1298, 1354, 1408, 1462, 1518, 1572, 1628, 1684,
+        1740, 1796, 1852, 1906, 1922, 1978, 2034, 2090,
+        2146, 2202, 2258, 2314, 2370, 2426, 2482, 2538,
+        2594, 2650, 2706, 2762, 2820
 };
 
 static const char _myanmar_syllable_machine_indicies[] = {
@@ -114,273 +115,378 @@ static const char _myanmar_syllable_machine_indicies[] = {
         0, 8, 0, 9, 10, 11, 12, 0,
         0, 0, 0, 0, 0, 0, 0, 13,
         0, 0, 14, 15, 16, 17, 18, 19,
-        20, 0, 22, 23, 24, 24, 21, 25,
-        26, 21, 21, 21, 21, 21, 21, 21,
-        21, 21, 21, 27, 28, 29, 30, 21,
-        21, 21, 21, 21, 21, 21, 21, 31,
-        21, 21, 32, 33, 34, 35, 36, 37,
-        38, 21, 24, 24, 21, 25, 21, 21,
-        21, 21, 21, 21, 21, 21, 21, 21,
-        21, 21, 21, 21, 30, 21, 21, 21,
-        21, 21, 21, 21, 21, 39, 21, 21,
-        21, 21, 21, 21, 36, 21, 24, 24,
-        21, 25, 21, 22, 21, 24, 24, 21,
-        25, 26, 21, 21, 21, 21, 21, 21,
-        21, 21, 21, 21, 40, 21, 21, 30,
-        21, 21, 21, 21, 21, 21, 21, 21,
-        41, 21, 21, 42, 21, 21, 21, 36,
-        21, 41, 21, 22, 21, 24, 24, 21,
-        25, 26, 21, 21, 21, 21, 21, 21,
-        21, 21, 21, 21, 21, 21, 21, 30,
-        21, 21, 21, 21, 21, 21, 21, 21,
-        21, 21, 21, 21, 21, 21, 21, 36,
-        21, 43, 21, 24, 24, 21, 25, 36,
-        21, 21, 21, 21, 21, 21, 21, 21,
-        21, 21, 21, 21, 21, 21, 21, 21,
-        21, 21, 21, 21, 21, 21, 44, 21,
-        21, 21, 21, 21, 21, 36, 21, 24,
-        24, 21, 25, 21, 21, 21, 21, 21,
-        21, 21, 21, 21, 21, 21, 21, 21,
-        21, 21, 21, 21, 21, 21, 21, 21,
-        21, 21, 44, 21, 21, 21, 21, 21,
-        21, 36, 21, 24, 24, 21, 25, 21,
-        21, 21, 21, 21, 21, 21, 21, 21,
-        21, 21, 21, 21, 21, 21, 21, 21,
-        21, 21, 21, 21, 21, 21, 21, 21,
-        21, 21, 21, 21, 21, 36, 21, 22,
-        21, 24, 24, 21, 25, 26, 21, 21,
-        21, 21, 21, 21, 21, 21, 21, 21,
-        40, 21, 21, 30, 21, 21, 21, 21,
-        21, 21, 21, 21, 21, 21, 21, 21,
-        21, 21, 21, 36, 21, 22, 21, 24,
-        24, 21, 25, 26, 21, 21, 21, 21,
-        21, 21, 21, 21, 21, 21, 40, 21,
-        21, 30, 21, 21, 21, 21, 21, 21,
-        21, 21, 41, 21, 21, 21, 21, 21,
-        21, 36, 21, 22, 21, 24, 24, 21,
-        25, 26, 21, 21, 21, 21, 21, 21,
-        21, 21, 21, 21, 40, 21, 21, 30,
-        21, 21, 21, 21, 21, 21, 21, 21,
-        41, 21, 21, 21, 21, 21, 21, 36,
-        21, 41, 21, 24, 24, 21, 25, 21,
-        21, 21, 21, 21, 21, 21, 21, 21,
-        21, 21, 21, 21, 21, 30, 21, 21,
-        21, 21, 21, 21, 21, 21, 21, 21,
-        21, 21, 21, 21, 21, 36, 21, 1,
-        1, 21, 21, 21, 21, 21, 21, 21,
-        21, 21, 21, 21, 21, 1, 21, 22,
-        21, 24, 24, 21, 25, 26, 21, 21,
-        21, 21, 21, 21, 21, 21, 21, 21,
-        27, 28, 21, 30, 21, 21, 21, 21,
-        21, 21, 21, 21, 21, 21, 21, 21,
-        21, 21, 21, 36, 21, 22, 21, 24,
-        24, 21, 25, 26, 21, 21, 21, 21,
-        21, 21, 21, 21, 21, 21, 21, 28,
-        21, 30, 21, 21, 21, 21, 21, 21,
-        21, 21, 21, 21, 21, 21, 21, 21,
-        21, 36, 21, 22, 21, 24, 24, 21,
-        25, 26, 21, 21, 21, 21, 21, 21,
-        21, 21, 21, 21, 27, 28, 29, 30,
-        21, 21, 21, 21, 21, 21, 21, 21,
-        21, 21, 21, 21, 21, 21, 21, 36,
-        45, 21, 22, 21, 24, 24, 21, 25,
-        26, 21, 21, 21, 21, 21, 21, 21,
-        21, 21, 21, 27, 28, 29, 30, 21,
-        21, 21, 21, 21, 21, 21, 21, 21,
-        21, 21, 21, 21, 21, 21, 36, 21,
-        22, 21, 24, 24, 21, 25, 26, 21,
-        21, 21, 21, 21, 21, 21, 21, 21,
-        21, 27, 28, 29, 30, 21, 21, 21,
-        21, 21, 21, 21, 21, 31, 21, 21,
-        32, 33, 34, 35, 36, 21, 38, 21,
-        22, 21, 24, 24, 21, 25, 26, 21,
-        21, 21, 21, 21, 21, 21, 21, 21,
-        21, 27, 28, 29, 30, 21, 21, 21,
-        21, 21, 21, 21, 21, 45, 21, 21,
-        21, 21, 21, 21, 36, 21, 38, 21,
-        22, 21, 24, 24, 21, 25, 26, 21,
-        21, 21, 21, 21, 21, 21, 21, 21,
-        21, 27, 28, 29, 30, 21, 21, 21,
-        21, 21, 21, 21, 21, 45, 21, 21,
-        21, 21, 21, 21, 36, 21, 22, 21,
-        24, 24, 21, 25, 26, 21, 21, 21,
-        21, 21, 21, 21, 21, 21, 21, 27,
-        28, 29, 30, 21, 21, 21, 21, 21,
-        21, 21, 21, 21, 21, 21, 32, 21,
-        34, 21, 36, 21, 38, 21, 22, 21,
-        24, 24, 21, 25, 26, 21, 21, 21,
-        21, 21, 21, 21, 21, 21, 21, 27,
-        28, 29, 30, 21, 21, 21, 21, 21,
-        21, 21, 21, 45, 21, 21, 32, 21,
-        21, 21, 36, 21, 38, 21, 22, 21,
-        24, 24, 21, 25, 26, 21, 21, 21,
-        21, 21, 21, 21, 21, 21, 21, 27,
-        28, 29, 30, 21, 21, 21, 21, 21,
-        21, 21, 21, 46, 21, 21, 32, 33,
-        34, 21, 36, 21, 38, 21, 22, 21,
-        24, 24, 21, 25, 26, 21, 21, 21,
-        21, 21, 21, 21, 21, 21, 21, 27,
-        28, 29, 30, 21, 21, 21, 21, 21,
-        21, 21, 21, 21, 21, 21, 32, 33,
-        34, 21, 36, 21, 38, 21, 22, 23,
-        24, 24, 21, 25, 26, 21, 21, 21,
-        21, 21, 21, 21, 21, 21, 21, 27,
-        28, 29, 30, 21, 21, 21, 21, 21,
-        21, 21, 21, 31, 21, 21, 32, 33,
-        34, 35, 36, 21, 38, 21, 48, 48,
+        20, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 0,
+        21, 0, 23, 24, 25, 25, 22, 26,
+        27, 22, 22, 22, 22, 22, 22, 22,
+        22, 22, 22, 28, 29, 30, 31, 22,
+        22, 22, 22, 22, 22, 22, 22, 32,
+        22, 22, 33, 34, 35, 36, 37, 38,
+        39, 22, 22, 22, 22, 22, 22, 22,
+        22, 22, 22, 22, 22, 22, 22, 22,
+        26, 22, 25, 25, 22, 26, 22, 22,
+        22, 22, 22, 22, 22, 22, 22, 22,
+        22, 22, 22, 22, 31, 22, 22, 22,
+        22, 22, 22, 22, 22, 40, 22, 22,
+        22, 22, 22, 22, 37, 22, 22, 22,
+        22, 22, 22, 22, 22, 22, 22, 22,
+        22, 22, 22, 22, 22, 22, 26, 22,
+        25, 25, 22, 26, 22, 22, 22, 22,
+        22, 22, 22, 22, 22, 22, 22, 22,
+        22, 22, 22, 22, 22, 22, 22, 22,
+        22, 22, 22, 22, 22, 22, 22, 22,
+        22, 22, 37, 22, 22, 22, 22, 22,
+        22, 22, 22, 22, 22, 22, 22, 22,
+        22, 22, 22, 22, 26, 22, 41, 22,
+        25, 25, 22, 26, 37, 22, 22, 22,
+        22, 22, 22, 22, 22, 22, 22, 22,
+        22, 22, 22, 22, 22, 22, 22, 22,
+        22, 22, 22, 26, 22, 22, 22, 22,
+        22, 22, 37, 22, 22, 22, 22, 22,
+        22, 22, 22, 22, 22, 22, 22, 22,
+        22, 22, 22, 22, 26, 22, 25, 25,
+        22, 26, 22, 22, 22, 22, 22, 22,
+        22, 22, 22, 22, 22, 22, 22, 22,
+        22, 22, 22, 22, 22, 22, 22, 22,
+        22, 26, 22, 22, 22, 22, 22, 22,
+        37, 22, 22, 22, 22, 22, 22, 22,
+        22, 22, 22, 22, 22, 22, 22, 22,
+        22, 22, 26, 22, 23, 22, 25, 25,
+        22, 26, 27, 22, 22, 22, 22, 22,
+        22, 22, 22, 22, 22, 42, 22, 22,
+        31, 22, 22, 22, 22, 22, 22, 22,
+        22, 43, 22, 22, 44, 22, 22, 22,
+        37, 22, 43, 22, 22, 22, 22, 22,
+        22, 22, 22, 22, 22, 22, 22, 22,
+        22, 22, 26, 22, 23, 22, 25, 25,
+        22, 26, 27, 22, 22, 22, 22, 22,
+        22, 22, 22, 22, 22, 22, 22, 22,
+        31, 22, 22, 22, 22, 22, 22, 22,
+        22, 22, 22, 22, 22, 22, 22, 22,
+        37, 22, 22, 22, 22, 22, 22, 22,
+        22, 22, 22, 22, 22, 22, 22, 22,
+        22, 22, 26, 22, 23, 22, 25, 25,
+        22, 26, 27, 22, 22, 22, 22, 22,
+        22, 22, 22, 22, 22, 42, 22, 22,
+        31, 22, 22, 22, 22, 22, 22, 22,
+        22, 22, 22, 22, 22, 22, 22, 22,
+        37, 22, 22, 22, 22, 22, 22, 22,
+        22, 22, 22, 22, 22, 22, 22, 22,
+        22, 22, 26, 22, 23, 22, 25, 25,
+        22, 26, 27, 22, 22, 22, 22, 22,
+        22, 22, 22, 22, 22, 42, 22, 22,
+        31, 22, 22, 22, 22, 22, 22, 22,
+        22, 43, 22, 22, 22, 22, 22, 22,
+        37, 22, 22, 22, 22, 22, 22, 22,
+        22, 22, 22, 22, 22, 22, 22, 22,
+        22, 22, 26, 22, 23, 22, 25, 25,
+        22, 26, 27, 22, 22, 22, 22, 22,
+        22, 22, 22, 22, 22, 42, 22, 22,
+        31, 22, 22, 22, 22, 22, 22, 22,
+        22, 43, 22, 22, 22, 22, 22, 22,
+        37, 22, 43, 22, 22, 22, 22, 22,
+        22, 22, 22, 22, 22, 22, 22, 22,
+        22, 22, 26, 22, 25, 25, 22, 26,
+        22, 22, 22, 22, 22, 22, 22, 22,
+        22, 22, 22, 22, 22, 22, 31, 22,
+        22, 22, 22, 22, 22, 22, 22, 22,
+        22, 22, 22, 22, 22, 22, 37, 22,
+        22, 22, 22, 22, 22, 22, 22, 22,
+        22, 22, 22, 22, 22, 22, 22, 22,
+        26, 22, 1, 1, 22, 22, 22, 22,
+        22, 22, 22, 22, 22, 22, 22, 22,
+        1, 22, 23, 22, 25, 25, 22, 26,
+        27, 22, 22, 22, 22, 22, 22, 22,
+        22, 22, 22, 28, 29, 22, 31, 22,
+        22, 22, 22, 22, 22, 22, 22, 22,
+        22, 22, 22, 22, 22, 22, 37, 22,
+        22, 22, 22, 22, 22, 22, 22, 22,
+        22, 22, 22, 22, 22, 22, 22, 22,
+        26, 22, 23, 22, 25, 25, 22, 26,
+        27, 22, 22, 22, 22, 22, 22, 22,
+        22, 22, 22, 22, 29, 22, 31, 22,
+        22, 22, 22, 22, 22, 22, 22, 22,
+        22, 22, 22, 22, 22, 22, 37, 22,
+        22, 22, 22, 22, 22, 22, 22, 22,
+        22, 22, 22, 22, 22, 22, 22, 22,
+        26, 22, 23, 22, 25, 25, 22, 26,
+        27, 22, 22, 22, 22, 22, 22, 22,
+        22, 22, 22, 28, 29, 30, 31, 22,
+        22, 22, 22, 22, 22, 22, 22, 22,
+        22, 22, 22, 22, 22, 22, 37, 45,
+        22, 22, 22, 22, 22, 22, 22, 22,
+        22, 22, 22, 22, 22, 22, 22, 22,
+        26, 22, 23, 22, 25, 25, 22, 26,
+        27, 22, 22, 22, 22, 22, 22, 22,
+        22, 22, 22, 28, 29, 30, 31, 22,
+        22, 22, 22, 22, 22, 22, 22, 22,
+        22, 22, 22, 22, 22, 22, 37, 22,
+        22, 22, 22, 22, 22, 22, 22, 22,
+        22, 22, 22, 22, 22, 22, 22, 22,
+        26, 22, 23, 22, 25, 25, 22, 26,
+        27, 22, 22, 22, 22, 22, 22, 22,
+        22, 22, 22, 28, 29, 30, 31, 22,
+        22, 22, 22, 22, 22, 22, 22, 32,
+        22, 22, 33, 34, 35, 36, 37, 22,
+        39, 22, 22, 22, 22, 22, 22, 22,
+        22, 22, 22, 22, 22, 22, 22, 22,
+        26, 22, 23, 22, 25, 25, 22, 26,
+        27, 22, 22, 22, 22, 22, 22, 22,
+        22, 22, 22, 28, 29, 30, 31, 22,
+        22, 22, 22, 22, 22, 22, 22, 45,
+        22, 22, 22, 22, 22, 22, 37, 22,
+        39, 22, 22, 22, 22, 22, 22, 22,
+        22, 22, 22, 22, 22, 22, 22, 22,
+        26, 22, 23, 22, 25, 25, 22, 26,
+        27, 22, 22, 22, 22, 22, 22, 22,
+        22, 22, 22, 28, 29, 30, 31, 22,
+        22, 22, 22, 22, 22, 22, 22, 45,
+        22, 22, 22, 22, 22, 22, 37, 22,
+        22, 22, 22, 22, 22, 22, 22, 22,
+        22, 22, 22, 22, 22, 22, 22, 22,
+        26, 22, 23, 22, 25, 25, 22, 26,
+        27, 22, 22, 22, 22, 22, 22, 22,
+        22, 22, 22, 28, 29, 30, 31, 22,
+        22, 22, 22, 22, 22, 22, 22, 22,
+        22, 22, 33, 22, 35, 22, 37, 22,
+        39, 22, 22, 22, 22, 22, 22, 22,
+        22, 22, 22, 22, 22, 22, 22, 22,
+        26, 22, 23, 22, 25, 25, 22, 26,
+        27, 22, 22, 22, 22, 22, 22, 22,
+        22, 22, 22, 28, 29, 30, 31, 22,
+        22, 22, 22, 22, 22, 22, 22, 45,
+        22, 22, 33, 22, 22, 22, 37, 22,
+        39, 22, 22, 22, 22, 22, 22, 22,
+        22, 22, 22, 22, 22, 22, 22, 22,
+        26, 22, 23, 22, 25, 25, 22, 26,
+        27, 22, 22, 22, 22, 22, 22, 22,
+        22, 22, 22, 28, 29, 30, 31, 22,
+        22, 22, 22, 22, 22, 22, 22, 46,
+        22, 22, 33, 34, 35, 22, 37, 22,
+        39, 22, 22, 22, 22, 22, 22, 22,
+        22, 22, 22, 22, 22, 22, 22, 22,
+        26, 22, 23, 22, 25, 25, 22, 26,
+        27, 22, 22, 22, 22, 22, 22, 22,
+        22, 22, 22, 28, 29, 30, 31, 22,
+        22, 22, 22, 22, 22, 22, 22, 22,
+        22, 22, 33, 34, 35, 22, 37, 22,
+        39, 22, 22, 22, 22, 22, 22, 22,
+        22, 22, 22, 22, 22, 22, 22, 22,
+        26, 22, 23, 24, 25, 25, 22, 26,
+        27, 22, 22, 22, 22, 22, 22, 22,
+        22, 22, 22, 28, 29, 30, 31, 22,
+        22, 22, 22, 22, 22, 22, 22, 32,
+        22, 22, 33, 34, 35, 36, 37, 22,
+        39, 22, 22, 22, 22, 22, 22, 22,
+        22, 22, 22, 22, 22, 22, 22, 22,
+        26, 22, 48, 48, 47, 5, 47, 47,
+        47, 47, 47, 47, 47, 47, 47, 47,
+        47, 47, 47, 47, 12, 47, 47, 47,
+        47, 47, 47, 47, 47, 49, 47, 47,
+        47, 47, 47, 47, 18, 47, 47, 47,
+        47, 47, 47, 47, 47, 47, 47, 47,
+        47, 47, 47, 47, 47, 47, 5, 47,
+        48, 48, 50, 5, 50, 50, 50, 50,
+        50, 50, 50, 50, 50, 50, 50, 50,
+        50, 50, 50, 50, 50, 50, 50, 50,
+        50, 50, 50, 50, 50, 50, 50, 50,
+        50, 50, 18, 50, 50, 50, 50, 50,
+        50, 50, 50, 50, 50, 50, 50, 50,
+        50, 50, 50, 50, 5, 50, 51, 47,
+        48, 48, 47, 5, 18, 47, 47, 47,
+        47, 47, 47, 47, 47, 47, 47, 47,
+        47, 47, 47, 47, 47, 47, 47, 47,
+        47, 47, 47, 5, 47, 47, 47, 47,
+        47, 47, 18, 47, 47, 47, 47, 47,
+        47, 47, 47, 47, 47, 47, 47, 47,
+        47, 47, 47, 47, 5, 47, 48, 48,
         47, 5, 47, 47, 47, 47, 47, 47,
         47, 47, 47, 47, 47, 47, 47, 47,
+        47, 47, 47, 47, 47, 47, 47, 47,
+        47, 5, 47, 47, 47, 47, 47, 47,
+        18, 47, 47, 47, 47, 47, 47, 47,
+        47, 47, 47, 47, 47, 47, 47, 47,
+        47, 47, 5, 47, 2, 47, 48, 48,
+        47, 5, 6, 47, 47, 47, 47, 47,
+        47, 47, 47, 47, 47, 52, 47, 47,
+        12, 47, 47, 47, 47, 47, 47, 47,
+        47, 53, 47, 47, 54, 47, 47, 47,
+        18, 47, 53, 47, 47, 47, 47, 47,
+        47, 47, 47, 47, 47, 47, 47, 47,
+        47, 47, 5, 47, 2, 47, 48, 48,
+        47, 5, 6, 47, 47, 47, 47, 47,
+        47, 47, 47, 47, 47, 47, 47, 47,
+        12, 47, 47, 47, 47, 47, 47, 47,
+        47, 47, 47, 47, 47, 47, 47, 47,
+        18, 47, 47, 47, 47, 47, 47, 47,
+        47, 47, 47, 47, 47, 47, 47, 47,
+        47, 47, 5, 47, 2, 47, 48, 48,
+        47, 5, 6, 47, 47, 47, 47, 47,
+        47, 47, 47, 47, 47, 52, 47, 47,
+        12, 47, 47, 47, 47, 47, 47, 47,
+        47, 47, 47, 47, 47, 47, 47, 47,
+        18, 47, 47, 47, 47, 47, 47, 47,
+        47, 47, 47, 47, 47, 47, 47, 47,
+        47, 47, 5, 47, 2, 47, 48, 48,
+        47, 5, 6, 47, 47, 47, 47, 47,
+        47, 47, 47, 47, 47, 52, 47, 47,
+        12, 47, 47, 47, 47, 47, 47, 47,
+        47, 53, 47, 47, 47, 47, 47, 47,
+        18, 47, 47, 47, 47, 47, 47, 47,
+        47, 47, 47, 47, 47, 47, 47, 47,
+        47, 47, 5, 47, 2, 47, 48, 48,
+        47, 5, 6, 47, 47, 47, 47, 47,
+        47, 47, 47, 47, 47, 52, 47, 47,
         12, 47, 47, 47, 47, 47, 47, 47,
-        47, 49, 47, 47, 47, 47, 47, 47,
-        18, 47, 48, 48, 47, 5, 47, 2,
-        47, 48, 48, 47, 5, 6, 47, 47,
+        47, 53, 47, 47, 47, 47, 47, 47,
+        18, 47, 53, 47, 47, 47, 47, 47,
         47, 47, 47, 47, 47, 47, 47, 47,
-        50, 47, 47, 12, 47, 47, 47, 47,
-        47, 47, 47, 47, 51, 47, 47, 52,
-        47, 47, 47, 18, 47, 51, 47, 2,
-        47, 48, 48, 47, 5, 6, 47, 47,
+        47, 47, 5, 47, 48, 48, 47, 5,
         47, 47, 47, 47, 47, 47, 47, 47,
-        47, 47, 47, 12, 47, 47, 47, 47,
+        47, 47, 47, 47, 47, 47, 12, 47,
         47, 47, 47, 47, 47, 47, 47, 47,
-        47, 47, 47, 18, 47, 53, 47, 48,
-        48, 47, 5, 18, 47, 47, 47, 47,
+        47, 47, 47, 47, 47, 47, 18, 47,
         47, 47, 47, 47, 47, 47, 47, 47,
         47, 47, 47, 47, 47, 47, 47, 47,
-        47, 47, 54, 47, 47, 47, 47, 47,
-        47, 18, 47, 48, 48, 47, 5, 47,
+        5, 47, 55, 55, 47, 47, 47, 47,
         47, 47, 47, 47, 47, 47, 47, 47,
+        55, 47, 2, 3, 48, 48, 47, 5,
+        6, 47, 47, 47, 47, 47, 47, 47,
+        47, 47, 47, 9, 10, 11, 12, 47,
+        47, 47, 47, 47, 47, 47, 47, 13,
+        47, 47, 14, 15, 16, 17, 18, 19,
+        20, 47, 47, 47, 47, 47, 47, 47,
         47, 47, 47, 47, 47, 47, 47, 47,
-        47, 47, 47, 47, 47, 47, 54, 47,
-        47, 47, 47, 47, 47, 18, 47, 48,
-        48, 47, 5, 47, 47, 47, 47, 47,
+        5, 47, 2, 47, 48, 48, 47, 5,
+        6, 47, 47, 47, 47, 47, 47, 47,
+        47, 47, 47, 9, 10, 47, 12, 47,
         47, 47, 47, 47, 47, 47, 47, 47,
+        47, 47, 47, 47, 47, 47, 18, 47,
         47, 47, 47, 47, 47, 47, 47, 47,
         47, 47, 47, 47, 47, 47, 47, 47,
-        47, 18, 47, 2, 47, 48, 48, 47,
-        5, 6, 47, 47, 47, 47, 47, 47,
-        47, 47, 47, 47, 50, 47, 47, 12,
+        5, 47, 2, 47, 48, 48, 47, 5,
+        6, 47, 47, 47, 47, 47, 47, 47,
+        47, 47, 47, 47, 10, 47, 12, 47,
         47, 47, 47, 47, 47, 47, 47, 47,
-        47, 47, 47, 47, 47, 47, 47, 18,
-        47, 2, 47, 48, 48, 47, 5, 6,
+        47, 47, 47, 47, 47, 47, 18, 47,
         47, 47, 47, 47, 47, 47, 47, 47,
-        47, 47, 50, 47, 47, 12, 47, 47,
-        47, 47, 47, 47, 47, 47, 51, 47,
-        47, 47, 47, 47, 47, 18, 47, 2,
-        47, 48, 48, 47, 5, 6, 47, 47,
         47, 47, 47, 47, 47, 47, 47, 47,
-        50, 47, 47, 12, 47, 47, 47, 47,
-        47, 47, 47, 47, 51, 47, 47, 47,
-        47, 47, 47, 18, 47, 51, 47, 48,
-        48, 47, 5, 47, 47, 47, 47, 47,
+        5, 47, 2, 47, 48, 48, 47, 5,
+        6, 47, 47, 47, 47, 47, 47, 47,
+        47, 47, 47, 9, 10, 11, 12, 47,
         47, 47, 47, 47, 47, 47, 47, 47,
-        47, 12, 47, 47, 47, 47, 47, 47,
+        47, 47, 47, 47, 47, 47, 18, 56,
         47, 47, 47, 47, 47, 47, 47, 47,
-        47, 18, 47, 55, 55, 47, 47, 47,
         47, 47, 47, 47, 47, 47, 47, 47,
-        47, 55, 47, 2, 3, 48, 48, 47,
-        5, 6, 47, 47, 47, 47, 47, 47,
-        47, 47, 47, 47, 9, 10, 11, 12,
+        5, 47, 2, 47, 48, 48, 47, 5,
+        6, 47, 47, 47, 47, 47, 47, 47,
+        47, 47, 47, 9, 10, 11, 12, 47,
         47, 47, 47, 47, 47, 47, 47, 47,
-        13, 47, 47, 14, 15, 16, 17, 18,
-        19, 20, 47, 2, 47, 48, 48, 47,
-        5, 6, 47, 47, 47, 47, 47, 47,
-        47, 47, 47, 47, 9, 10, 47, 12,
+        47, 47, 47, 47, 47, 47, 18, 47,
         47, 47, 47, 47, 47, 47, 47, 47,
-        47, 47, 47, 47, 47, 47, 47, 18,
-        47, 2, 47, 48, 48, 47, 5, 6,
         47, 47, 47, 47, 47, 47, 47, 47,
-        47, 47, 47, 10, 47, 12, 47, 47,
+        5, 47, 2, 47, 48, 48, 47, 5,
+        6, 47, 47, 47, 47, 47, 47, 47,
+        47, 47, 47, 9, 10, 11, 12, 47,
+        47, 47, 47, 47, 47, 47, 47, 13,
+        47, 47, 14, 15, 16, 17, 18, 47,
+        20, 47, 47, 47, 47, 47, 47, 47,
         47, 47, 47, 47, 47, 47, 47, 47,
-        47, 47, 47, 47, 47, 18, 47, 2,
-        47, 48, 48, 47, 5, 6, 47, 47,
+        5, 47, 2, 47, 48, 48, 47, 5,
+        6, 47, 47, 47, 47, 47, 47, 47,
+        47, 47, 47, 9, 10, 11, 12, 47,
+        47, 47, 47, 47, 47, 47, 47, 56,
+        47, 47, 47, 47, 47, 47, 18, 47,
+        20, 47, 47, 47, 47, 47, 47, 47,
         47, 47, 47, 47, 47, 47, 47, 47,
-        9, 10, 11, 12, 47, 47, 47, 47,
+        5, 47, 2, 47, 48, 48, 47, 5,
+        6, 47, 47, 47, 47, 47, 47, 47,
+        47, 47, 47, 9, 10, 11, 12, 47,
+        47, 47, 47, 47, 47, 47, 47, 56,
+        47, 47, 47, 47, 47, 47, 18, 47,
         47, 47, 47, 47, 47, 47, 47, 47,
-        47, 47, 47, 18, 56, 47, 2, 47,
-        48, 48, 47, 5, 6, 47, 47, 47,
-        47, 47, 47, 47, 47, 47, 47, 9,
-        10, 11, 12, 47, 47, 47, 47, 47,
         47, 47, 47, 47, 47, 47, 47, 47,
-        47, 47, 18, 47, 2, 47, 48, 48,
-        47, 5, 6, 47, 47, 47, 47, 47,
-        47, 47, 47, 47, 47, 9, 10, 11,
-        12, 47, 47, 47, 47, 47, 47, 47,
-        47, 13, 47, 47, 14, 15, 16, 17,
-        18, 47, 20, 47, 2, 47, 48, 48,
-        47, 5, 6, 47, 47, 47, 47, 47,
-        47, 47, 47, 47, 47, 9, 10, 11,
-        12, 47, 47, 47, 47, 47, 47, 47,
-        47, 56, 47, 47, 47, 47, 47, 47,
-        18, 47, 20, 47, 2, 47, 48, 48,
-        47, 5, 6, 47, 47, 47, 47, 47,
-        47, 47, 47, 47, 47, 9, 10, 11,
-        12, 47, 47, 47, 47, 47, 47, 47,
-        47, 56, 47, 47, 47, 47, 47, 47,
-        18, 47, 2, 47, 48, 48, 47, 5,
+        5, 47, 2, 47, 48, 48, 47, 5,
         6, 47, 47, 47, 47, 47, 47, 47,
         47, 47, 47, 9, 10, 11, 12, 47,
         47, 47, 47, 47, 47, 47, 47, 47,
         47, 47, 14, 47, 16, 47, 18, 47,
-        20, 47, 2, 47, 48, 48, 47, 5,
+        20, 47, 47, 47, 47, 47, 47, 47,
+        47, 47, 47, 47, 47, 47, 47, 47,
+        5, 47, 2, 47, 48, 48, 47, 5,
         6, 47, 47, 47, 47, 47, 47, 47,
         47, 47, 47, 9, 10, 11, 12, 47,
         47, 47, 47, 47, 47, 47, 47, 56,
         47, 47, 14, 47, 47, 47, 18, 47,
-        20, 47, 2, 47, 48, 48, 47, 5,
+        20, 47, 47, 47, 47, 47, 47, 47,
+        47, 47, 47, 47, 47, 47, 47, 47,
+        5, 47, 2, 47, 48, 48, 47, 5,
         6, 47, 47, 47, 47, 47, 47, 47,
         47, 47, 47, 9, 10, 11, 12, 47,
         47, 47, 47, 47, 47, 47, 47, 57,
         47, 47, 14, 15, 16, 47, 18, 47,
-        20, 47, 2, 47, 48, 48, 47, 5,
+        20, 47, 47, 47, 47, 47, 47, 47,
+        47, 47, 47, 47, 47, 47, 47, 47,
+        5, 47, 2, 47, 48, 48, 47, 5,
         6, 47, 47, 47, 47, 47, 47, 47,
         47, 47, 47, 9, 10, 11, 12, 47,
         47, 47, 47, 47, 47, 47, 47, 47,
         47, 47, 14, 15, 16, 47, 18, 47,
-        20, 47, 2, 3, 48, 48, 47, 5,
+        20, 47, 47, 47, 47, 47, 47, 47,
+        47, 47, 47, 47, 47, 47, 47, 47,
+        5, 47, 2, 3, 48, 48, 47, 5,
         6, 47, 47, 47, 47, 47, 47, 47,
         47, 47, 47, 9, 10, 11, 12, 47,
         47, 47, 47, 47, 47, 47, 47, 13,
         47, 47, 14, 15, 16, 17, 18, 47,
-        20, 47, 22, 23, 24, 24, 21, 25,
-        26, 21, 21, 21, 21, 21, 21, 21,
-        21, 21, 21, 27, 28, 29, 30, 21,
-        21, 21, 21, 21, 21, 21, 21, 58,
-        21, 21, 32, 33, 34, 35, 36, 37,
-        38, 21, 22, 59, 24, 24, 21, 25,
-        26, 21, 21, 21, 21, 21, 21, 21,
-        21, 21, 21, 27, 28, 29, 30, 21,
-        21, 21, 21, 21, 21, 21, 21, 31,
-        21, 21, 32, 33, 34, 35, 36, 21,
-        38, 21, 1, 1, 2, 3, 48, 48,
+        20, 47, 47, 47, 47, 47, 47, 47,
+        47, 47, 47, 47, 47, 47, 47, 47,
+        5, 47, 23, 24, 25, 25, 22, 26,
+        27, 22, 22, 22, 22, 22, 22, 22,
+        22, 22, 22, 28, 29, 30, 31, 22,
+        22, 22, 22, 22, 22, 22, 22, 58,
+        22, 22, 33, 34, 35, 36, 37, 38,
+        39, 22, 22, 22, 22, 22, 22, 22,
+        22, 22, 22, 22, 22, 22, 22, 22,
+        26, 22, 23, 59, 25, 25, 22, 26,
+        27, 22, 22, 22, 22, 22, 22, 22,
+        22, 22, 22, 28, 29, 30, 31, 22,
+        22, 22, 22, 22, 22, 22, 22, 32,
+        22, 22, 33, 34, 35, 36, 37, 22,
+        39, 22, 22, 22, 22, 22, 22, 22,
+        22, 22, 22, 22, 22, 22, 22, 22,
+        26, 22, 1, 1, 2, 3, 48, 48,
         47, 5, 6, 1, 1, 47, 47, 47,
         1, 47, 47, 47, 47, 9, 10, 11,
         12, 47, 47, 47, 47, 47, 47, 47,
         47, 13, 47, 47, 14, 15, 16, 17,
-        18, 19, 20, 47, 1, 1, 60, 60,
+        18, 19, 20, 47, 47, 47, 47, 47,
+        47, 47, 47, 47, 47, 47, 47, 47,
+        47, 47, 5, 47, 1, 1, 60, 60,
         60, 60, 60, 60, 60, 1, 1, 60,
         60, 60, 1, 60, 0
 };
 
 static const char _myanmar_syllable_machine_trans_targs[] = {
-        0, 1, 26, 37, 0, 27, 29, 51,
-        54, 39, 40, 41, 28, 43, 44, 46,
-        47, 48, 30, 50, 45, 0, 2, 13,
-        0, 3, 5, 14, 15, 16, 4, 18,
-        19, 21, 22, 23, 6, 25, 20, 12,
-        9, 10, 11, 7, 8, 17, 24, 0,
-        0, 36, 33, 34, 35, 31, 32, 38,
-        42, 49, 52, 53, 0
+        0, 1, 25, 35, 0, 26, 30, 49,
+        52, 37, 38, 39, 29, 41, 42, 44,
+        45, 46, 27, 48, 43, 26, 0, 2,
+        12, 0, 3, 7, 13, 14, 15, 6,
+        17, 18, 20, 21, 22, 4, 24, 19,
+        11, 5, 8, 9, 10, 16, 23, 0,
+        0, 34, 0, 28, 31, 32, 33, 36,
+        40, 47, 50, 51, 0
 };
 
 static const char _myanmar_syllable_machine_trans_actions[] = {
-        3, 0, 0, 0, 4, 0, 0, 0,
+        3, 0, 0, 0, 4, 5, 0, 0,
         0, 0, 0, 0, 0, 0, 0, 0,
-        0, 0, 0, 0, 0, 5, 0, 0,
-        6, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 6, 7, 0,
+        0, 8, 0, 0, 0, 0, 0, 0,
         0, 0, 0, 0, 0, 0, 0, 0,
-        0, 0, 0, 0, 0, 0, 0, 7,
-        8, 0, 0, 0, 0, 0, 0, 0,
-        0, 0, 0, 0, 9
+        0, 0, 0, 0, 0, 0, 0, 9,
+        10, 0, 11, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 12
 };
 
 static const char _myanmar_syllable_machine_to_state_actions[] = {
@@ -390,7 +496,7 @@ static const char _myanmar_syllable_machine_to_state_actions[] = {
         0, 0, 0, 0, 0, 0, 0, 0,
         0, 0, 0, 0, 0, 0, 0, 0,
         0, 0, 0, 0, 0, 0, 0, 0,
-        0, 0, 0, 0, 0, 0, 0
+        0, 0, 0, 0, 0
 };
 
 static const char _myanmar_syllable_machine_from_state_actions[] = {
@@ -400,17 +506,17 @@ static const char _myanmar_syllable_machine_from_state_actions[] = {
         0, 0, 0, 0, 0, 0, 0, 0,
         0, 0, 0, 0, 0, 0, 0, 0,
         0, 0, 0, 0, 0, 0, 0, 0,
-        0, 0, 0, 0, 0, 0, 0
+        0, 0, 0, 0, 0
 };
 
 static const short _myanmar_syllable_machine_eof_trans[] = {
-        0, 22, 22, 22, 22, 22, 22, 22,
-        22, 22, 22, 22, 22, 22, 22, 22,
-        22, 22, 22, 22, 22, 22, 22, 22,
-        22, 22, 48, 48, 48, 48, 48, 48,
+        0, 23, 23, 23, 23, 23, 23, 23,
+        23, 23, 23, 23, 23, 23, 23, 23,
+        23, 23, 23, 23, 23, 23, 23, 23,
+        23, 48, 51, 48, 48, 48, 48, 48,
         48, 48, 48, 48, 48, 48, 48, 48,
         48, 48, 48, 48, 48, 48, 48, 48,
-        48, 48, 48, 22, 22, 48, 61
+        48, 23, 23, 48, 61
 };
 
 static const int myanmar_syllable_machine_start = 0;
@@ -424,7 +530,7 @@ static const int myanmar_syllable_machine_en_main = 0;
 
 
 
-#line 117 "hb-ot-shaper-myanmar-machine.rl"
+#line 118 "hb-ot-shaper-myanmar-machine.rl"
 
 
 #define found_syllable(syllable_type) \
@@ -443,7 +549,7 @@ find_syllables_myanmar (hb_buffer_t *buffer)
   int cs;
   hb_glyph_info_t *info = buffer->info;
 
-#line 447 "hb-ot-shaper-myanmar-machine.hh"
+#line 553 "hb-ot-shaper-myanmar-machine.hh"
         {
         cs = myanmar_syllable_machine_start;
         ts = 0;
@@ -451,7 +557,7 @@ find_syllables_myanmar (hb_buffer_t *buffer)
         act = 0;
         }
 
-#line 137 "hb-ot-shaper-myanmar-machine.rl"
+#line 138 "hb-ot-shaper-myanmar-machine.rl"
 
 
   p = 0;
@@ -459,7 +565,7 @@ find_syllables_myanmar (hb_buffer_t *buffer)
 
   unsigned int syllable_serial = 1;
 
-#line 463 "hb-ot-shaper-myanmar-machine.hh"
+#line 569 "hb-ot-shaper-myanmar-machine.hh"
         {
         int _slen;
         int _trans;
@@ -473,7 +579,7 @@ _resume:
 #line 1 "NONE"
         {ts = p;}
         break;
-#line 477 "hb-ot-shaper-myanmar-machine.hh"
+#line 583 "hb-ot-shaper-myanmar-machine.hh"
         }
 
         _keys = _myanmar_syllable_machine_trans_keys + (cs<<1);
@@ -491,35 +597,59 @@ _eof_trans:
                 goto _again;
 
         switch ( _myanmar_syllable_machine_trans_actions[_trans] ) {
-        case 6:
-#line 110 "hb-ot-shaper-myanmar-machine.rl"
+        case 8:
+#line 111 "hb-ot-shaper-myanmar-machine.rl"
         {te = p+1;{ found_syllable (myanmar_consonant_syllable); }}
         break;
         case 4:
-#line 111 "hb-ot-shaper-myanmar-machine.rl"
+#line 112 "hb-ot-shaper-myanmar-machine.rl"
         {te = p+1;{ found_syllable (myanmar_non_myanmar_cluster); }}
         break;
-        case 8:
-#line 112 "hb-ot-shaper-myanmar-machine.rl"
+        case 10:
+#line 113 "hb-ot-shaper-myanmar-machine.rl"
         {te = p+1;{ found_syllable (myanmar_broken_cluster); buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_BROKEN_SYLLABLE; }}
         break;
         case 3:
-#line 113 "hb-ot-shaper-myanmar-machine.rl"
+#line 114 "hb-ot-shaper-myanmar-machine.rl"
         {te = p+1;{ found_syllable (myanmar_non_myanmar_cluster); }}
         break;
-        case 5:
-#line 110 "hb-ot-shaper-myanmar-machine.rl"
-        {te = p;p--;{ found_syllable (myanmar_consonant_syllable); }}
-        break;
         case 7:
-#line 112 "hb-ot-shaper-myanmar-machine.rl"
-        {te = p;p--;{ found_syllable (myanmar_broken_cluster); buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_BROKEN_SYLLABLE; }}
+#line 111 "hb-ot-shaper-myanmar-machine.rl"
+        {te = p;p--;{ found_syllable (myanmar_consonant_syllable); }}
         break;
         case 9:
 #line 113 "hb-ot-shaper-myanmar-machine.rl"
+        {te = p;p--;{ found_syllable (myanmar_broken_cluster); buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_BROKEN_SYLLABLE; }}
+        break;
+        case 12:
+#line 114 "hb-ot-shaper-myanmar-machine.rl"
         {te = p;p--;{ found_syllable (myanmar_non_myanmar_cluster); }}
         break;
-#line 523 "hb-ot-shaper-myanmar-machine.hh"
+        case 11:
+#line 1 "NONE"
+        {       switch( act ) {
+        case 2:
+        {{p = ((te))-1;} found_syllable (myanmar_non_myanmar_cluster); }
+        break;
+        case 3:
+        {{p = ((te))-1;} found_syllable (myanmar_broken_cluster); buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_BROKEN_SYLLABLE; }
+        break;
+        }
+        }
+        break;
+        case 6:
+#line 1 "NONE"
+        {te = p+1;}
+#line 112 "hb-ot-shaper-myanmar-machine.rl"
+        {act = 2;}
+        break;
+        case 5:
+#line 1 "NONE"
+        {te = p+1;}
+#line 113 "hb-ot-shaper-myanmar-machine.rl"
+        {act = 3;}
+        break;
+#line 653 "hb-ot-shaper-myanmar-machine.hh"
         }
 
 _again:
@@ -528,7 +658,7 @@ _again:
 #line 1 "NONE"
         {ts = 0;}
         break;
-#line 532 "hb-ot-shaper-myanmar-machine.hh"
+#line 662 "hb-ot-shaper-myanmar-machine.hh"
         }
 
         if ( ++p != pe )
@@ -544,7 +674,7 @@ _again:
 
         }
 
-#line 145 "hb-ot-shaper-myanmar-machine.rl"
+#line 146 "hb-ot-shaper-myanmar-machine.rl"
 
 }
 
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-use-machine.hh b/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-use-machine.hh
index 47b0e6bbdcc3..46f66f7d2858 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-use-machine.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-use-machine.hh
@@ -81,6 +81,7 @@ enum use_syllable_type_t {
 #define use_syllable_machine_ex_N 4u
 #define use_syllable_machine_ex_O 0u
 #define use_syllable_machine_ex_R 18u
+#define use_syllable_machine_ex_RK 56u
 #define use_syllable_machine_ex_SB 51u
 #define use_syllable_machine_ex_SE 52u
 #define use_syllable_machine_ex_SMAbv 41u
@@ -99,62 +100,62 @@ enum use_syllable_type_t {
 #define use_syllable_machine_ex_ZWNJ 14u
 
 
-#line 103 "hb-ot-shaper-use-machine.hh"
+#line 104 "hb-ot-shaper-use-machine.hh"
 static const unsigned char _use_syllable_machine_trans_keys[] = {
-        49u, 51u, 0u, 53u, 11u, 53u, 11u, 53u, 1u, 53u, 14u, 48u, 14u, 47u, 14u, 47u,
+        49u, 51u, 0u, 56u, 11u, 56u, 11u, 56u, 1u, 53u, 14u, 48u, 14u, 47u, 14u, 47u,
         14u, 47u, 14u, 46u, 14u, 46u, 14u, 14u, 14u, 48u, 14u, 48u, 14u, 48u, 1u, 14u,
         14u, 48u, 14u, 53u, 14u, 53u, 14u, 53u, 14u, 53u, 12u, 53u, 14u, 53u, 12u, 53u,
-        12u, 53u, 12u, 53u, 11u, 53u, 1u, 14u, 1u, 48u, 14u, 42u, 14u, 42u, 11u, 53u,
+        12u, 53u, 12u, 53u, 11u, 56u, 1u, 14u, 1u, 48u, 14u, 42u, 14u, 42u, 11u, 56u,
         1u, 53u, 14u, 48u, 14u, 47u, 14u, 47u, 14u, 47u, 14u, 46u, 14u, 46u, 14u, 14u,
         14u, 48u, 14u, 48u, 14u, 48u, 1u, 14u, 14u, 48u, 14u, 53u, 14u, 53u, 14u, 53u,
-        14u, 53u, 12u, 53u, 14u, 53u, 12u, 53u, 12u, 53u, 12u, 53u, 11u, 53u, 1u, 14u,
-        1u, 14u, 1u, 48u, 13u, 14u, 4u, 14u, 11u, 53u, 11u, 53u, 1u, 53u, 14u, 48u,
-        14u, 47u, 14u, 47u, 14u, 47u, 14u, 46u, 14u, 46u, 14u, 14u, 14u, 48u, 14u, 48u,
-        14u, 48u, 1u, 14u, 14u, 48u, 14u, 53u, 14u, 53u, 14u, 53u, 14u, 53u, 12u, 53u,
-        14u, 53u, 12u, 53u, 12u, 53u, 12u, 53u, 11u, 53u, 1u, 14u, 1u, 14u, 1u, 48u,
-        11u, 53u, 1u, 53u, 14u, 48u, 14u, 47u, 14u, 47u, 14u, 47u, 14u, 46u, 14u, 46u,
-        14u, 14u, 14u, 48u, 14u, 48u, 14u, 48u, 1u, 14u, 14u, 48u, 14u, 53u, 14u, 53u,
-        14u, 53u, 14u, 53u, 12u, 53u, 14u, 53u, 12u, 53u, 12u, 53u, 12u, 53u, 11u, 53u,
-        1u, 14u, 1u, 48u, 4u, 14u, 13u, 14u, 1u, 53u, 14u, 42u, 14u, 42u, 1u, 5u,
-        14u, 55u, 14u, 51u, 14u, 52u, 14u, 54u, 11u, 53u, 0
+        14u, 53u, 12u, 53u, 14u, 53u, 12u, 53u, 12u, 53u, 12u, 53u, 11u, 56u, 1u, 14u,
+        1u, 14u, 1u, 48u, 14u, 14u, 13u, 14u, 4u, 14u, 11u, 56u, 11u, 56u, 1u, 53u,
+        14u, 48u, 14u, 47u, 14u, 47u, 14u, 47u, 14u, 46u, 14u, 46u, 14u, 14u, 14u, 48u,
+        14u, 48u, 14u, 48u, 1u, 14u, 14u, 48u, 14u, 53u, 14u, 53u, 14u, 53u, 14u, 53u,
+        12u, 53u, 14u, 53u, 12u, 53u, 12u, 53u, 12u, 53u, 11u, 56u, 1u, 14u, 1u, 14u,
+        1u, 48u, 14u, 14u, 11u, 56u, 1u, 53u, 14u, 48u, 14u, 47u, 14u, 47u, 14u, 47u,
+        14u, 46u, 14u, 46u, 14u, 14u, 14u, 48u, 14u, 48u, 14u, 48u, 1u, 14u, 14u, 48u,
+        14u, 53u, 14u, 53u, 14u, 53u, 14u, 53u, 12u, 53u, 14u, 53u, 12u, 53u, 12u, 53u,
+        12u, 53u, 11u, 56u, 1u, 14u, 1u, 48u, 4u, 14u, 13u, 14u, 1u, 56u, 14u, 42u,
+        14u, 42u, 1u, 5u, 14u, 55u, 14u, 51u, 14u, 52u, 14u, 54u, 11u, 56u, 0
 };
 
 static const char _use_syllable_machine_key_spans[] = {
-        3, 54, 43, 43, 53, 35, 34, 34,
+        3, 57, 46, 46, 53, 35, 34, 34,
         34, 33, 33, 1, 35, 35, 35, 14,
         35, 40, 40, 40, 40, 42, 40, 42,
-        42, 42, 43, 14, 48, 29, 29, 43,
+        42, 42, 46, 14, 48, 29, 29, 46,
         53, 35, 34, 34, 34, 33, 33, 1,
         35, 35, 35, 14, 35, 40, 40, 40,
-        40, 42, 40, 42, 42, 42, 43, 14,
-        14, 48, 2, 11, 43, 43, 53, 35,
-        34, 34, 34, 33, 33, 1, 35, 35,
-        35, 14, 35, 40, 40, 40, 40, 42,
-        40, 42, 42, 42, 43, 14, 14, 48,
-        43, 53, 35, 34, 34, 34, 33, 33,
-        1, 35, 35, 35, 14, 35, 40, 40,
-        40, 40, 42, 40, 42, 42, 42, 43,
-        14, 48, 11, 2, 53, 29, 29, 5,
-        42, 38, 39, 41, 43
+        40, 42, 40, 42, 42, 42, 46, 14,
+        14, 48, 1, 2, 11, 46, 46, 53,
+        35, 34, 34, 34, 33, 33, 1, 35,
+        35, 35, 14, 35, 40, 40, 40, 40,
+        42, 40, 42, 42, 42, 46, 14, 14,
+        48, 1, 46, 53, 35, 34, 34, 34,
+        33, 33, 1, 35, 35, 35, 14, 35,
+        40, 40, 40, 40, 42, 40, 42, 42,
+        42, 46, 14, 48, 11, 2, 56, 29,
+        29, 5, 42, 38, 39, 41, 46
 };
 
 static const short _use_syllable_machine_index_offsets[] = {
-        0, 4, 59, 103, 147, 201, 237, 272,
-        307, 342, 376, 410, 412, 448, 484, 520,
-        535, 571, 612, 653, 694, 735, 778, 819,
-        862, 905, 948, 992, 1007, 1056, 1086, 1116,
-        1160, 1214, 1250, 1285, 1320, 1355, 1389, 1423,
-        1425, 1461, 1497, 1533, 1548, 1584, 1625, 1666,
-        1707, 1748, 1791, 1832, 1875, 1918, 1961, 2005,
-        2020, 2035, 2084, 2087, 2099, 2143, 2187, 2241,
-        2277, 2312, 2347, 2382, 2416, 2450, 2452, 2488,
-        2524, 2560, 2575, 2611, 2652, 2693, 2734, 2775,
-        2818, 2859, 2902, 2945, 2988, 3032, 3047, 3062,
-        3111, 3155, 3209, 3245, 3280, 3315, 3350, 3384,
-        3418, 3420, 3456, 3492, 3528, 3543, 3579, 3620,
-        3661, 3702, 3743, 3786, 3827, 3870, 3913, 3956,
-        4000, 4015, 4064, 4076, 4079, 4133, 4163, 4193,
-        4199, 4242, 4281, 4321, 4363
+        0, 4, 62, 109, 156, 210, 246, 281,
+        316, 351, 385, 419, 421, 457, 493, 529,
+        544, 580, 621, 662, 703, 744, 787, 828,
+        871, 914, 957, 1004, 1019, 1068, 1098, 1128,
+        1175, 1229, 1265, 1300, 1335, 1370, 1404, 1438,
+        1440, 1476, 1512, 1548, 1563, 1599, 1640, 1681,
+        1722, 1763, 1806, 1847, 1890, 1933, 1976, 2023,
+        2038, 2053, 2102, 2104, 2107, 2119, 2166, 2213,
+        2267, 2303, 2338, 2373, 2408, 2442, 2476, 2478,
+        2514, 2550, 2586, 2601, 2637, 2678, 2719, 2760,
+        2801, 2844, 2885, 2928, 2971, 3014, 3061, 3076,
+        3091, 3140, 3142, 3189, 3243, 3279, 3314, 3349,
+        3384, 3418, 3452, 3454, 3490, 3526, 3562, 3577,
+        3613, 3654, 3695, 3736, 3777, 3820, 3861, 3904,
+        3947, 3990, 4037, 4052, 4101, 4113, 4116, 4173,
+        4203, 4233, 4239, 4282, 4321, 4361, 4403
 };
 
 static const unsigned char _use_syllable_machine_indicies[] = {
@@ -165,571 +166,578 @@ static const unsigned char _use_syllable_machine_indicies[] = {
         19, 20, 21, 8, 22, 23, 24, 25,
         5, 26, 27, 28, 5, 29, 30, 31,
         32, 33, 34, 35, 32, 1, 5, 36,
-        5, 37, 5, 39, 40, 38, 41, 38,
-        38, 38, 38, 38, 38, 38, 42, 43,
-        44, 45, 46, 47, 48, 49, 50, 39,
-        51, 52, 53, 54, 38, 55, 56, 57,
-        38, 58, 59, 38, 60, 61, 62, 63,
-        60, 38, 38, 38, 38, 64, 38, 39,
-        40, 38, 41, 38, 38, 38, 38, 38,
-        38, 38, 42, 43, 44, 45, 46, 47,
-        48, 49, 50, 39, 51, 52, 53, 54,
-        38, 55, 56, 57, 38, 38, 38, 38,
-        60, 61, 62, 63, 60, 38, 38, 38,
-        38, 64, 38, 39, 38, 38, 38, 38,
-        38, 38, 38, 38, 38, 38, 38, 38,
-        41, 38, 38, 38, 38, 38, 38, 38,
-        38, 43, 44, 45, 46, 38, 38, 38,
-        38, 38, 38, 38, 38, 38, 38, 55,
-        56, 57, 38, 38, 38, 38, 38, 61,
-        62, 63, 65, 38, 38, 38, 38, 43,
-        38, 41, 38, 38, 38, 38, 38, 38,
-        38, 38, 43, 44, 45, 46, 38, 38,
-        38, 38, 38, 38, 38, 38, 38, 38,
-        55, 56, 57, 38, 38, 38, 38, 38,
-        61, 62, 63, 65, 38, 41, 38, 38,
-        38, 38, 38, 38, 38, 38, 38, 44,
-        45, 46, 38, 38, 38, 38, 38, 38,
-        38, 38, 38, 38, 38, 38, 38, 38,
-        38, 38, 38, 38, 61, 62, 63, 38,
-        41, 38, 38, 38, 38, 38, 38, 38,
-        38, 38, 38, 45, 46, 38, 38, 38,
-        38, 38, 38, 38, 38, 38, 38, 38,
-        38, 38, 38, 38, 38, 38, 38, 61,
-        62, 63, 38, 41, 38, 38, 38, 38,
-        38, 38, 38, 38, 38, 38, 38, 46,
-        38, 38, 38, 38, 38, 38, 38, 38,
-        38, 38, 38, 38, 38, 38, 38, 38,
-        38, 38, 61, 62, 63, 38, 41, 38,
-        38, 38, 38, 38, 38, 38, 38, 38,
-        38, 38, 38, 38, 38, 38, 38, 38,
-        38, 38, 38, 38, 38, 38, 38, 38,
-        38, 38, 38, 38, 38, 61, 62, 38,
-        41, 38, 38, 38, 38, 38, 38, 38,
-        38, 38, 38, 38, 38, 38, 38, 38,
-        38, 38, 38, 38, 38, 38, 38, 38,
-        38, 38, 38, 38, 38, 38, 38, 38,
-        62, 38, 41, 38, 41, 38, 38, 38,
-        38, 38, 38, 38, 38, 38, 44, 45,
-        46, 38, 38, 38, 38, 38, 38, 38,
-        38, 38, 38, 55, 56, 57, 38, 38,
-        38, 38, 38, 61, 62, 63, 65, 38,
-        41, 38, 38, 38, 38, 38, 38, 38,
-        38, 38, 44, 45, 46, 38, 38, 38,
-        38, 38, 38, 38, 38, 38, 38, 38,
-        56, 57, 38, 38, 38, 38, 38, 61,
-        62, 63, 65, 38, 41, 38, 38, 38,
-        38, 38, 38, 38, 38, 38, 44, 45,
-        46, 38, 38, 38, 38, 38, 38, 38,
-        38, 38, 38, 38, 38, 57, 38, 38,
-        38, 38, 38, 61, 62, 63, 65, 38,
-        66, 38, 38, 38, 38, 38, 38, 38,
-        38, 38, 38, 38, 38, 41, 38, 41,
-        38, 38, 38, 38, 38, 38, 38, 38,
-        38, 44, 45, 46, 38, 38, 38, 38,
-        38, 38, 38, 38, 38, 38, 38, 38,
-        38, 38, 38, 38, 38, 38, 61, 62,
-        63, 65, 38, 41, 38, 38, 38, 38,
-        38, 38, 38, 42, 43, 44, 45, 46,
-        38, 38, 38, 38, 38, 38, 52, 53,
-        54, 38, 55, 56, 57, 38, 38, 38,
-        38, 38, 61, 62, 63, 65, 38, 38,
-        38, 38, 43, 38, 41, 38, 38, 38,
-        38, 38, 38, 38, 38, 43, 44, 45,
-        46, 38, 38, 38, 38, 38, 38, 52,
-        53, 54, 38, 55, 56, 57, 38, 38,
-        38, 38, 38, 61, 62, 63, 65, 38,
-        38, 38, 38, 43, 38, 41, 38, 38,
-        38, 38, 38, 38, 38, 38, 43, 44,
-        45, 46, 38, 38, 38, 38, 38, 38,
-        38, 53, 54, 38, 55, 56, 57, 38,
-        38, 38, 38, 38, 61, 62, 63, 65,
-        38, 38, 38, 38, 43, 38, 41, 38,
-        38, 38, 38, 38, 38, 38, 38, 43,
-        44, 45, 46, 38, 38, 38, 38, 38,
-        38, 38, 38, 54, 38, 55, 56, 57,
-        38, 38, 38, 38, 38, 61, 62, 63,
-        65, 38, 38, 38, 38, 43, 38, 67,
-        38, 41, 38, 38, 38, 38, 38, 38,
-        38, 42, 43, 44, 45, 46, 38, 48,
-        49, 38, 38, 38, 52, 53, 54, 38,
-        55, 56, 57, 38, 38, 38, 38, 38,
-        61, 62, 63, 65, 38, 38, 38, 38,
-        43, 38, 41, 38, 38, 38, 38, 38,
-        38, 38, 38, 43, 44, 45, 46, 38,
-        38, 38, 38, 38, 38, 38, 38, 38,
-        38, 55, 56, 57, 38, 38, 38, 38,
-        38, 61, 62, 63, 65, 38, 38, 38,
-        38, 43, 38, 67, 38, 41, 38, 38,
-        38, 38, 38, 38, 38, 42, 43, 44,
-        45, 46, 38, 38, 49, 38, 38, 38,
-        52, 53, 54, 38, 55, 56, 57, 38,
-        38, 38, 38, 38, 61, 62, 63, 65,
-        38, 38, 38, 38, 43, 38, 67, 38,
-        41, 38, 38, 38, 38, 38, 38, 38,
-        42, 43, 44, 45, 46, 38, 38, 38,
-        38, 38, 38, 52, 53, 54, 38, 55,
-        56, 57, 38, 38, 38, 38, 38, 61,
-        62, 63, 65, 38, 38, 38, 38, 43,
-        38, 67, 38, 41, 38, 38, 38, 38,
-        38, 38, 38, 42, 43, 44, 45, 46,
-        47, 48, 49, 38, 38, 38, 52, 53,
-        54, 38, 55, 56, 57, 38, 38, 38,
-        38, 38, 61, 62, 63, 65, 38, 38,
-        38, 38, 43, 38, 39, 40, 38, 41,
-        38, 38, 38, 38, 38, 38, 38, 42,
+        5, 37, 5, 5, 38, 5, 40, 41,
+        39, 42, 39, 39, 39, 39, 39, 39,
+        39, 43, 44, 45, 46, 47, 48, 49,
+        50, 51, 40, 52, 53, 54, 55, 39,
+        56, 57, 58, 39, 59, 60, 39, 61,
+        62, 63, 64, 61, 39, 39, 39, 39,
+        65, 39, 39, 64, 39, 40, 41, 39,
+        42, 39, 39, 39, 39, 39, 39, 39,
         43, 44, 45, 46, 47, 48, 49, 50,
-        38, 51, 52, 53, 54, 38, 55, 56,
-        57, 38, 38, 38, 38, 60, 61, 62,
-        63, 60, 38, 38, 38, 38, 64, 38,
-        39, 38, 38, 38, 38, 38, 38, 38,
-        38, 38, 38, 38, 38, 41, 38, 39,
-        38, 38, 38, 38, 38, 38, 38, 38,
-        38, 38, 38, 38, 41, 38, 38, 38,
-        38, 38, 38, 38, 38, 43, 44, 45,
-        46, 38, 38, 38, 38, 38, 38, 38,
-        38, 38, 38, 55, 56, 57, 38, 38,
-        38, 38, 38, 61, 62, 63, 65, 38,
-        41, 38, 38, 38, 38, 38, 38, 38,
-        38, 38, 38, 38, 38, 38, 38, 38,
-        38, 38, 38, 38, 38, 38, 38, 38,
-        38, 38, 38, 58, 59, 38, 41, 38,
-        38, 38, 38, 38, 38, 38, 38, 38,
-        38, 38, 38, 38, 38, 38, 38, 38,
-        38, 38, 38, 38, 38, 38, 38, 38,
-        38, 38, 59, 38, 4, 69, 68, 70,
-        68, 68, 68, 68, 68, 68, 68, 71,
-        72, 73, 74, 75, 76, 77, 78, 79,
-        4, 80, 81, 82, 83, 68, 84, 85,
-        86, 68, 68, 68, 68, 87, 88, 89,
-        90, 91, 68, 68, 68, 68, 92, 68,
-        4, 68, 68, 68, 68, 68, 68, 68,
-        68, 68, 68, 68, 68, 70, 68, 68,
-        68, 68, 68, 68, 68, 68, 72, 73,
-        74, 75, 68, 68, 68, 68, 68, 68,
-        68, 68, 68, 68, 84, 85, 86, 68,
-        68, 68, 68, 68, 88, 89, 90, 93,
-        68, 68, 68, 68, 72, 68, 70, 68,
-        68, 68, 68, 68, 68, 68, 68, 72,
-        73, 74, 75, 68, 68, 68, 68, 68,
-        68, 68, 68, 68, 68, 84, 85, 86,
-        68, 68, 68, 68, 68, 88, 89, 90,
-        93, 68, 70, 68, 68, 68, 68, 68,
-        68, 68, 68, 68, 73, 74, 75, 68,
-        68, 68, 68, 68, 68, 68, 68, 68,
-        68, 68, 68, 68, 68, 68, 68, 68,
-        68, 88, 89, 90, 68, 70, 68, 68,
-        68, 68, 68, 68, 68, 68, 68, 68,
-        74, 75, 68, 68, 68, 68, 68, 68,
-        68, 68, 68, 68, 68, 68, 68, 68,
-        68, 68, 68, 68, 88, 89, 90, 68,
-        70, 68, 68, 68, 68, 68, 68, 68,
-        68, 68, 68, 68, 75, 68, 68, 68,
-        68, 68, 68, 68, 68, 68, 68, 68,
-        68, 68, 68, 68, 68, 68, 68, 88,
-        89, 90, 68, 70, 68, 68, 68, 68,
-        68, 68, 68, 68, 68, 68, 68, 68,
-        68, 68, 68, 68, 68, 68, 68, 68,
-        68, 68, 68, 68, 68, 68, 68, 68,
-        68, 68, 88, 89, 68, 70, 68, 68,
-        68, 68, 68, 68, 68, 68, 68, 68,
-        68, 68, 68, 68, 68, 68, 68, 68,
-        68, 68, 68, 68, 68, 68, 68, 68,
-        68, 68, 68, 68, 68, 89, 68, 70,
-        68, 70, 68, 68, 68, 68, 68, 68,
-        68, 68, 68, 73, 74, 75, 68, 68,
-        68, 68, 68, 68, 68, 68, 68, 68,
-        84, 85, 86, 68, 68, 68, 68, 68,
-        88, 89, 90, 93, 68, 70, 68, 68,
-        68, 68, 68, 68, 68, 68, 68, 73,
-        74, 75, 68, 68, 68, 68, 68, 68,
-        68, 68, 68, 68, 68, 85, 86, 68,
-        68, 68, 68, 68, 88, 89, 90, 93,
-        68, 70, 68, 68, 68, 68, 68, 68,
-        68, 68, 68, 73, 74, 75, 68, 68,
-        68, 68, 68, 68, 68, 68, 68, 68,
-        68, 68, 86, 68, 68, 68, 68, 68,
-        88, 89, 90, 93, 68, 95, 94, 94,
-        94, 94, 94, 94, 94, 94, 94, 94,
-        94, 94, 96, 94, 70, 68, 68, 68,
-        68, 68, 68, 68, 68, 68, 73, 74,
-        75, 68, 68, 68, 68, 68, 68, 68,
-        68, 68, 68, 68, 68, 68, 68, 68,
-        68, 68, 68, 88, 89, 90, 93, 68,
-        70, 68, 68, 68, 68, 68, 68, 68,
-        71, 72, 73, 74, 75, 68, 68, 68,
-        68, 68, 68, 81, 82, 83, 68, 84,
-        85, 86, 68, 68, 68, 68, 68, 88,
-        89, 90, 93, 68, 68, 68, 68, 72,
-        68, 70, 68, 68, 68, 68, 68, 68,
-        68, 68, 72, 73, 74, 75, 68, 68,
-        68, 68, 68, 68, 81, 82, 83, 68,
-        84, 85, 86, 68, 68, 68, 68, 68,
-        88, 89, 90, 93, 68, 68, 68, 68,
-        72, 68, 70, 68, 68, 68, 68, 68,
-        68, 68, 68, 72, 73, 74, 75, 68,
-        68, 68, 68, 68, 68, 68, 82, 83,
-        68, 84, 85, 86, 68, 68, 68, 68,
-        68, 88, 89, 90, 93, 68, 68, 68,
-        68, 72, 68, 70, 68, 68, 68, 68,
-        68, 68, 68, 68, 72, 73, 74, 75,
-        68, 68, 68, 68, 68, 68, 68, 68,
-        83, 68, 84, 85, 86, 68, 68, 68,
-        68, 68, 88, 89, 90, 93, 68, 68,
-        68, 68, 72, 68, 97, 68, 70, 68,
-        68, 68, 68, 68, 68, 68, 71, 72,
-        73, 74, 75, 68, 77, 78, 68, 68,
-        68, 81, 82, 83, 68, 84, 85, 86,
-        68, 68, 68, 68, 68, 88, 89, 90,
-        93, 68, 68, 68, 68, 72, 68, 70,
-        68, 68, 68, 68, 68, 68, 68, 68,
-        72, 73, 74, 75, 68, 68, 68, 68,
-        68, 68, 68, 68, 68, 68, 84, 85,
-        86, 68, 68, 68, 68, 68, 88, 89,
-        90, 93, 68, 68, 68, 68, 72, 68,
-        97, 68, 70, 68, 68, 68, 68, 68,
-        68, 68, 71, 72, 73, 74, 75, 68,
-        68, 78, 68, 68, 68, 81, 82, 83,
-        68, 84, 85, 86, 68, 68, 68, 68,
-        68, 88, 89, 90, 93, 68, 68, 68,
-        68, 72, 68, 97, 68, 70, 68, 68,
-        68, 68, 68, 68, 68, 71, 72, 73,
-        74, 75, 68, 68, 68, 68, 68, 68,
-        81, 82, 83, 68, 84, 85, 86, 68,
-        68, 68, 68, 68, 88, 89, 90, 93,
-        68, 68, 68, 68, 72, 68, 97, 68,
-        70, 68, 68, 68, 68, 68, 68, 68,
-        71, 72, 73, 74, 75, 76, 77, 78,
-        68, 68, 68, 81, 82, 83, 68, 84,
-        85, 86, 68, 68, 68, 68, 68, 88,
-        89, 90, 93, 68, 68, 68, 68, 72,
-        68, 4, 69, 68, 70, 68, 68, 68,
-        68, 68, 68, 68, 71, 72, 73, 74,
-        75, 76, 77, 78, 79, 68, 80, 81,
-        82, 83, 68, 84, 85, 86, 68, 68,
-        68, 68, 87, 88, 89, 90, 91, 68,
-        68, 68, 68, 92, 68, 4, 98, 98,
-        98, 98, 98, 98, 98, 98, 98, 98,
-        98, 98, 99, 98, 4, 94, 94, 94,
-        94, 94, 94, 94, 94, 94, 94, 94,
-        94, 96, 94, 4, 68, 68, 68, 68,
-        68, 68, 68, 68, 68, 68, 68, 68,
-        70, 68, 68, 68, 68, 68, 68, 68,
-        68, 72, 73, 74, 75, 68, 68, 68,
-        68, 68, 68, 68, 68, 68, 68, 84,
-        85, 86, 68, 68, 68, 68, 68, 88,
-        89, 90, 93, 68, 101, 102, 100, 6,
-        103, 103, 103, 103, 103, 103, 103, 103,
-        103, 104, 103, 105, 106, 68, 70, 68,
-        68, 68, 68, 68, 68, 68, 107, 108,
-        109, 110, 111, 112, 113, 114, 115, 105,
-        116, 117, 118, 119, 68, 120, 121, 122,
-        68, 58, 59, 68, 123, 124, 125, 126,
-        127, 68, 68, 68, 68, 128, 68, 105,
-        106, 68, 70, 68, 68, 68, 68, 68,
-        68, 68, 107, 108, 109, 110, 111, 112,
-        113, 114, 115, 105, 116, 117, 118, 119,
-        68, 120, 121, 122, 68, 68, 68, 68,
-        123, 124, 125, 126, 127, 68, 68, 68,
-        68, 128, 68, 105, 68, 68, 68, 68,
-        68, 68, 68, 68, 68, 68, 68, 68,
-        70, 68, 68, 68, 68, 68, 68, 68,
-        68, 108, 109, 110, 111, 68, 68, 68,
-        68, 68, 68, 68, 68, 68, 68, 120,
-        121, 122, 68, 68, 68, 68, 68, 124,
-        125, 126, 129, 68, 68, 68, 68, 108,
-        68, 70, 68, 68, 68, 68, 68, 68,
-        68, 68, 108, 109, 110, 111, 68, 68,
-        68, 68, 68, 68, 68, 68, 68, 68,
-        120, 121, 122, 68, 68, 68, 68, 68,
-        124, 125, 126, 129, 68, 70, 68, 68,
-        68, 68, 68, 68, 68, 68, 68, 109,
-        110, 111, 68, 68, 68, 68, 68, 68,
-        68, 68, 68, 68, 68, 68, 68, 68,
-        68, 68, 68, 68, 124, 125, 126, 68,
-        70, 68, 68, 68, 68, 68, 68, 68,
-        68, 68, 68, 110, 111, 68, 68, 68,
-        68, 68, 68, 68, 68, 68, 68, 68,
-        68, 68, 68, 68, 68, 68, 68, 124,
-        125, 126, 68, 70, 68, 68, 68, 68,
-        68, 68, 68, 68, 68, 68, 68, 111,
-        68, 68, 68, 68, 68, 68, 68, 68,
-        68, 68, 68, 68, 68, 68, 68, 68,
-        68, 68, 124, 125, 126, 68, 70, 68,
-        68, 68, 68, 68, 68, 68, 68, 68,
-        68, 68, 68, 68, 68, 68, 68, 68,
-        68, 68, 68, 68, 68, 68, 68, 68,
-        68, 68, 68, 68, 68, 124, 125, 68,
-        70, 68, 68, 68, 68, 68, 68, 68,
-        68, 68, 68, 68, 68, 68, 68, 68,
-        68, 68, 68, 68, 68, 68, 68, 68,
-        68, 68, 68, 68, 68, 68, 68, 68,
-        125, 68, 70, 68, 70, 68, 68, 68,
-        68, 68, 68, 68, 68, 68, 109, 110,
-        111, 68, 68, 68, 68, 68, 68, 68,
-        68, 68, 68, 120, 121, 122, 68, 68,
-        68, 68, 68, 124, 125, 126, 129, 68,
-        70, 68, 68, 68, 68, 68, 68, 68,
-        68, 68, 109, 110, 111, 68, 68, 68,
-        68, 68, 68, 68, 68, 68, 68, 68,
-        121, 122, 68, 68, 68, 68, 68, 124,
-        125, 126, 129, 68, 70, 68, 68, 68,
-        68, 68, 68, 68, 68, 68, 109, 110,
-        111, 68, 68, 68, 68, 68, 68, 68,
-        68, 68, 68, 68, 68, 122, 68, 68,
-        68, 68, 68, 124, 125, 126, 129, 68,
-        130, 94, 94, 94, 94, 94, 94, 94,
-        94, 94, 94, 94, 94, 96, 94, 70,
-        68, 68, 68, 68, 68, 68, 68, 68,
-        68, 109, 110, 111, 68, 68, 68, 68,
-        68, 68, 68, 68, 68, 68, 68, 68,
-        68, 68, 68, 68, 68, 68, 124, 125,
-        126, 129, 68, 70, 68, 68, 68, 68,
-        68, 68, 68, 107, 108, 109, 110, 111,
-        68, 68, 68, 68, 68, 68, 117, 118,
-        119, 68, 120, 121, 122, 68, 68, 68,
-        68, 68, 124, 125, 126, 129, 68, 68,
-        68, 68, 108, 68, 70, 68, 68, 68,
-        68, 68, 68, 68, 68, 108, 109, 110,
-        111, 68, 68, 68, 68, 68, 68, 117,
-        118, 119, 68, 120, 121, 122, 68, 68,
-        68, 68, 68, 124, 125, 126, 129, 68,
-        68, 68, 68, 108, 68, 70, 68, 68,
-        68, 68, 68, 68, 68, 68, 108, 109,
-        110, 111, 68, 68, 68, 68, 68, 68,
-        68, 118, 119, 68, 120, 121, 122, 68,
-        68, 68, 68, 68, 124, 125, 126, 129,
-        68, 68, 68, 68, 108, 68, 70, 68,
-        68, 68, 68, 68, 68, 68, 68, 108,
-        109, 110, 111, 68, 68, 68, 68, 68,
-        68, 68, 68, 119, 68, 120, 121, 122,
-        68, 68, 68, 68, 68, 124, 125, 126,
-        129, 68, 68, 68, 68, 108, 68, 131,
-        68, 70, 68, 68, 68, 68, 68, 68,
-        68, 107, 108, 109, 110, 111, 68, 113,
-        114, 68, 68, 68, 117, 118, 119, 68,
-        120, 121, 122, 68, 68, 68, 68, 68,
-        124, 125, 126, 129, 68, 68, 68, 68,
-        108, 68, 70, 68, 68, 68, 68, 68,
-        68, 68, 68, 108, 109, 110, 111, 68,
-        68, 68, 68, 68, 68, 68, 68, 68,
-        68, 120, 121, 122, 68, 68, 68, 68,
-        68, 124, 125, 126, 129, 68, 68, 68,
-        68, 108, 68, 131, 68, 70, 68, 68,
-        68, 68, 68, 68, 68, 107, 108, 109,
-        110, 111, 68, 68, 114, 68, 68, 68,
-        117, 118, 119, 68, 120, 121, 122, 68,
-        68, 68, 68, 68, 124, 125, 126, 129,
-        68, 68, 68, 68, 108, 68, 131, 68,
-        70, 68, 68, 68, 68, 68, 68, 68,
-        107, 108, 109, 110, 111, 68, 68, 68,
-        68, 68, 68, 117, 118, 119, 68, 120,
-        121, 122, 68, 68, 68, 68, 68, 124,
-        125, 126, 129, 68, 68, 68, 68, 108,
-        68, 131, 68, 70, 68, 68, 68, 68,
-        68, 68, 68, 107, 108, 109, 110, 111,
-        112, 113, 114, 68, 68, 68, 117, 118,
-        119, 68, 120, 121, 122, 68, 68, 68,
-        68, 68, 124, 125, 126, 129, 68, 68,
-        68, 68, 108, 68, 105, 106, 68, 70,
-        68, 68, 68, 68, 68, 68, 68, 107,
-        108, 109, 110, 111, 112, 113, 114, 115,
-        68, 116, 117, 118, 119, 68, 120, 121,
-        122, 68, 68, 68, 68, 123, 124, 125,
-        126, 127, 68, 68, 68, 68, 128, 68,
-        105, 98, 98, 98, 98, 98, 98, 98,
-        98, 98, 98, 98, 98, 99, 98, 105,
-        94, 94, 94, 94, 94, 94, 94, 94,
-        94, 94, 94, 94, 96, 94, 105, 68,
-        68, 68, 68, 68, 68, 68, 68, 68,
-        68, 68, 68, 70, 68, 68, 68, 68,
-        68, 68, 68, 68, 108, 109, 110, 111,
-        68, 68, 68, 68, 68, 68, 68, 68,
-        68, 68, 120, 121, 122, 68, 68, 68,
-        68, 68, 124, 125, 126, 129, 68, 8,
-        9, 132, 11, 132, 132, 132, 132, 132,
-        132, 132, 13, 14, 15, 16, 17, 18,
-        19, 20, 21, 8, 22, 23, 24, 25,
-        132, 26, 27, 28, 132, 132, 132, 132,
-        32, 33, 34, 35, 32, 132, 132, 132,
-        132, 37, 132, 8, 132, 132, 132, 132,
-        132, 132, 132, 132, 132, 132, 132, 132,
-        11, 132, 132, 132, 132, 132, 132, 132,
-        132, 14, 15, 16, 17, 132, 132, 132,
-        132, 132, 132, 132, 132, 132, 132, 26,
-        27, 28, 132, 132, 132, 132, 132, 33,
-        34, 35, 133, 132, 132, 132, 132, 14,
-        132, 11, 132, 132, 132, 132, 132, 132,
-        132, 132, 14, 15, 16, 17, 132, 132,
-        132, 132, 132, 132, 132, 132, 132, 132,
-        26, 27, 28, 132, 132, 132, 132, 132,
-        33, 34, 35, 133, 132, 11, 132, 132,
-        132, 132, 132, 132, 132, 132, 132, 15,
-        16, 17, 132, 132, 132, 132, 132, 132,
-        132, 132, 132, 132, 132, 132, 132, 132,
-        132, 132, 132, 132, 33, 34, 35, 132,
-        11, 132, 132, 132, 132, 132, 132, 132,
-        132, 132, 132, 16, 17, 132, 132, 132,
-        132, 132, 132, 132, 132, 132, 132, 132,
-        132, 132, 132, 132, 132, 132, 132, 33,
-        34, 35, 132, 11, 132, 132, 132, 132,
-        132, 132, 132, 132, 132, 132, 132, 17,
-        132, 132, 132, 132, 132, 132, 132, 132,
-        132, 132, 132, 132, 132, 132, 132, 132,
-        132, 132, 33, 34, 35, 132, 11, 132,
-        132, 132, 132, 132, 132, 132, 132, 132,
-        132, 132, 132, 132, 132, 132, 132, 132,
-        132, 132, 132, 132, 132, 132, 132, 132,
-        132, 132, 132, 132, 132, 33, 34, 132,
-        11, 132, 132, 132, 132, 132, 132, 132,
-        132, 132, 132, 132, 132, 132, 132, 132,
-        132, 132, 132, 132, 132, 132, 132, 132,
-        132, 132, 132, 132, 132, 132, 132, 132,
-        34, 132, 11, 132, 11, 132, 132, 132,
-        132, 132, 132, 132, 132, 132, 15, 16,
-        17, 132, 132, 132, 132, 132, 132, 132,
-        132, 132, 132, 26, 27, 28, 132, 132,
-        132, 132, 132, 33, 34, 35, 133, 132,
-        11, 132, 132, 132, 132, 132, 132, 132,
-        132, 132, 15, 16, 17, 132, 132, 132,
-        132, 132, 132, 132, 132, 132, 132, 132,
-        27, 28, 132, 132, 132, 132, 132, 33,
-        34, 35, 133, 132, 11, 132, 132, 132,
-        132, 132, 132, 132, 132, 132, 15, 16,
-        17, 132, 132, 132, 132, 132, 132, 132,
-        132, 132, 132, 132, 132, 28, 132, 132,
-        132, 132, 132, 33, 34, 35, 133, 132,
-        134, 132, 132, 132, 132, 132, 132, 132,
-        132, 132, 132, 132, 132, 11, 132, 11,
-        132, 132, 132, 132, 132, 132, 132, 132,
-        132, 15, 16, 17, 132, 132, 132, 132,
-        132, 132, 132, 132, 132, 132, 132, 132,
-        132, 132, 132, 132, 132, 132, 33, 34,
-        35, 133, 132, 11, 132, 132, 132, 132,
-        132, 132, 132, 13, 14, 15, 16, 17,
-        132, 132, 132, 132, 132, 132, 23, 24,
-        25, 132, 26, 27, 28, 132, 132, 132,
-        132, 132, 33, 34, 35, 133, 132, 132,
-        132, 132, 14, 132, 11, 132, 132, 132,
-        132, 132, 132, 132, 132, 14, 15, 16,
-        17, 132, 132, 132, 132, 132, 132, 23,
-        24, 25, 132, 26, 27, 28, 132, 132,
-        132, 132, 132, 33, 34, 35, 133, 132,
-        132, 132, 132, 14, 132, 11, 132, 132,
-        132, 132, 132, 132, 132, 132, 14, 15,
-        16, 17, 132, 132, 132, 132, 132, 132,
-        132, 24, 25, 132, 26, 27, 28, 132,
-        132, 132, 132, 132, 33, 34, 35, 133,
-        132, 132, 132, 132, 14, 132, 11, 132,
-        132, 132, 132, 132, 132, 132, 132, 14,
-        15, 16, 17, 132, 132, 132, 132, 132,
-        132, 132, 132, 25, 132, 26, 27, 28,
-        132, 132, 132, 132, 132, 33, 34, 35,
-        133, 132, 132, 132, 132, 14, 132, 135,
-        132, 11, 132, 132, 132, 132, 132, 132,
-        132, 13, 14, 15, 16, 17, 132, 19,
-        20, 132, 132, 132, 23, 24, 25, 132,
-        26, 27, 28, 132, 132, 132, 132, 132,
-        33, 34, 35, 133, 132, 132, 132, 132,
-        14, 132, 11, 132, 132, 132, 132, 132,
-        132, 132, 132, 14, 15, 16, 17, 132,
-        132, 132, 132, 132, 132, 132, 132, 132,
-        132, 26, 27, 28, 132, 132, 132, 132,
-        132, 33, 34, 35, 133, 132, 132, 132,
-        132, 14, 132, 135, 132, 11, 132, 132,
-        132, 132, 132, 132, 132, 13, 14, 15,
-        16, 17, 132, 132, 20, 132, 132, 132,
-        23, 24, 25, 132, 26, 27, 28, 132,
-        132, 132, 132, 132, 33, 34, 35, 133,
-        132, 132, 132, 132, 14, 132, 135, 132,
-        11, 132, 132, 132, 132, 132, 132, 132,
-        13, 14, 15, 16, 17, 132, 132, 132,
-        132, 132, 132, 23, 24, 25, 132, 26,
-        27, 28, 132, 132, 132, 132, 132, 33,
-        34, 35, 133, 132, 132, 132, 132, 14,
-        132, 135, 132, 11, 132, 132, 132, 132,
-        132, 132, 132, 13, 14, 15, 16, 17,
-        18, 19, 20, 132, 132, 132, 23, 24,
-        25, 132, 26, 27, 28, 132, 132, 132,
-        132, 132, 33, 34, 35, 133, 132, 132,
-        132, 132, 14, 132, 8, 9, 132, 11,
-        132, 132, 132, 132, 132, 132, 132, 13,
-        14, 15, 16, 17, 18, 19, 20, 21,
-        132, 22, 23, 24, 25, 132, 26, 27,
-        28, 132, 132, 132, 132, 32, 33, 34,
-        35, 32, 132, 132, 132, 132, 37, 132,
-        8, 132, 132, 132, 132, 132, 132, 132,
-        132, 132, 132, 132, 132, 11, 132, 8,
-        132, 132, 132, 132, 132, 132, 132, 132,
-        132, 132, 132, 132, 11, 132, 132, 132,
-        132, 132, 132, 132, 132, 14, 15, 16,
-        17, 132, 132, 132, 132, 132, 132, 132,
-        132, 132, 132, 26, 27, 28, 132, 132,
-        132, 132, 132, 33, 34, 35, 133, 132,
-        136, 132, 132, 132, 132, 132, 132, 132,
-        132, 132, 11, 132, 10, 11, 132, 4,
-        132, 132, 132, 4, 132, 132, 132, 132,
-        132, 8, 9, 10, 11, 132, 132, 132,
-        132, 132, 132, 132, 13, 14, 15, 16,
-        17, 18, 19, 20, 21, 8, 22, 23,
-        24, 25, 132, 26, 27, 28, 132, 29,
-        30, 132, 32, 33, 34, 35, 32, 132,
-        132, 132, 132, 37, 132, 11, 132, 132,
-        132, 132, 132, 132, 132, 132, 132, 132,
-        132, 132, 132, 132, 132, 132, 132, 132,
-        132, 132, 132, 132, 132, 132, 132, 132,
-        29, 30, 132, 11, 132, 132, 132, 132,
-        132, 132, 132, 132, 132, 132, 132, 132,
-        132, 132, 132, 132, 132, 132, 132, 132,
-        132, 132, 132, 132, 132, 132, 132, 30,
-        132, 4, 137, 137, 137, 4, 137, 139,
-        138, 138, 138, 138, 138, 138, 138, 138,
-        138, 138, 138, 138, 138, 138, 138, 138,
-        138, 138, 138, 138, 138, 138, 138, 138,
-        138, 138, 138, 138, 138, 138, 138, 138,
-        138, 138, 138, 140, 138, 141, 138, 141,
-        142, 138, 139, 138, 138, 138, 138, 138,
-        138, 138, 138, 138, 138, 138, 138, 138,
-        138, 138, 138, 138, 138, 138, 138, 138,
-        138, 138, 138, 138, 138, 138, 138, 138,
-        138, 138, 138, 138, 138, 1, 140, 140,
-        138, 139, 138, 138, 138, 138, 138, 138,
-        138, 138, 138, 138, 138, 138, 138, 138,
-        138, 138, 138, 138, 138, 138, 138, 138,
-        138, 138, 138, 138, 138, 138, 138, 138,
-        138, 138, 138, 138, 138, 140, 138, 141,
-        138, 139, 138, 138, 138, 138, 138, 138,
-        138, 138, 138, 138, 138, 138, 138, 138,
-        138, 138, 138, 138, 138, 138, 138, 138,
-        138, 138, 138, 138, 138, 138, 138, 138,
-        138, 138, 138, 138, 138, 140, 138, 141,
-        138, 141, 138, 39, 40, 38, 41, 38,
-        38, 38, 38, 38, 38, 38, 42, 43,
-        44, 45, 46, 47, 48, 49, 50, 39,
-        51, 52, 53, 54, 38, 55, 56, 57,
-        38, 58, 59, 38, 60, 61, 62, 63,
-        60, 1, 38, 2, 38, 64, 38, 0
+        51, 40, 52, 53, 54, 55, 39, 56,
+        57, 58, 39, 39, 39, 39, 61, 62,
+        63, 64, 61, 39, 39, 39, 39, 65,
+        39, 39, 64, 39, 40, 39, 39, 39,
+        39, 39, 39, 39, 39, 39, 39, 39,
+        39, 42, 39, 39, 39, 39, 39, 39,
+        39, 39, 44, 45, 46, 47, 39, 39,
+        39, 39, 39, 39, 39, 39, 39, 39,
+        56, 57, 58, 39, 39, 39, 39, 39,
+        62, 63, 64, 66, 39, 39, 39, 39,
+        44, 39, 42, 39, 39, 39, 39, 39,
+        39, 39, 39, 44, 45, 46, 47, 39,
+        39, 39, 39, 39, 39, 39, 39, 39,
+        39, 56, 57, 58, 39, 39, 39, 39,
+        39, 62, 63, 64, 66, 39, 42, 39,
+        39, 39, 39, 39, 39, 39, 39, 39,
+        45, 46, 47, 39, 39, 39, 39, 39,
+        39, 39, 39, 39, 39, 39, 39, 39,
+        39, 39, 39, 39, 39, 62, 63, 64,
+        39, 42, 39, 39, 39, 39, 39, 39,
+        39, 39, 39, 39, 46, 47, 39, 39,
+        39, 39, 39, 39, 39, 39, 39, 39,
+        39, 39, 39, 39, 39, 39, 39, 39,
+        62, 63, 64, 39, 42, 39, 39, 39,
+        39, 39, 39, 39, 39, 39, 39, 39,
+        47, 39, 39, 39, 39, 39, 39, 39,
+        39, 39, 39, 39, 39, 39, 39, 39,
+        39, 39, 39, 62, 63, 64, 39, 42,
+        39, 39, 39, 39, 39, 39, 39, 39,
+        39, 39, 39, 39, 39, 39, 39, 39,
+        39, 39, 39, 39, 39, 39, 39, 39,
+        39, 39, 39, 39, 39, 39, 62, 63,
+        39, 42, 39, 39, 39, 39, 39, 39,
+        39, 39, 39, 39, 39, 39, 39, 39,
+        39, 39, 39, 39, 39, 39, 39, 39,
+        39, 39, 39, 39, 39, 39, 39, 39,
+        39, 63, 39, 42, 39, 42, 39, 39,
+        39, 39, 39, 39, 39, 39, 39, 45,
+        46, 47, 39, 39, 39, 39, 39, 39,
+        39, 39, 39, 39, 56, 57, 58, 39,
+        39, 39, 39, 39, 62, 63, 64, 66,
+        39, 42, 39, 39, 39, 39, 39, 39,
+        39, 39, 39, 45, 46, 47, 39, 39,
+        39, 39, 39, 39, 39, 39, 39, 39,
+        39, 57, 58, 39, 39, 39, 39, 39,
+        62, 63, 64, 66, 39, 42, 39, 39,
+        39, 39, 39, 39, 39, 39, 39, 45,
+        46, 47, 39, 39, 39, 39, 39, 39,
+        39, 39, 39, 39, 39, 39, 58, 39,
+        39, 39, 39, 39, 62, 63, 64, 66,
+        39, 67, 39, 39, 39, 39, 39, 39,
+        39, 39, 39, 39, 39, 39, 42, 39,
+        42, 39, 39, 39, 39, 39, 39, 39,
+        39, 39, 45, 46, 47, 39, 39, 39,
+        39, 39, 39, 39, 39, 39, 39, 39,
+        39, 39, 39, 39, 39, 39, 39, 62,
+        63, 64, 66, 39, 42, 39, 39, 39,
+        39, 39, 39, 39, 43, 44, 45, 46,
+        47, 39, 39, 39, 39, 39, 39, 53,
+        54, 55, 39, 56, 57, 58, 39, 39,
+        39, 39, 39, 62, 63, 64, 66, 39,
+        39, 39, 39, 44, 39, 42, 39, 39,
+        39, 39, 39, 39, 39, 39, 44, 45,
+        46, 47, 39, 39, 39, 39, 39, 39,
+        53, 54, 55, 39, 56, 57, 58, 39,
+        39, 39, 39, 39, 62, 63, 64, 66,
+        39, 39, 39, 39, 44, 39, 42, 39,
+        39, 39, 39, 39, 39, 39, 39, 44,
+        45, 46, 47, 39, 39, 39, 39, 39,
+        39, 39, 54, 55, 39, 56, 57, 58,
+        39, 39, 39, 39, 39, 62, 63, 64,
+        66, 39, 39, 39, 39, 44, 39, 42,
+        39, 39, 39, 39, 39, 39, 39, 39,
+        44, 45, 46, 47, 39, 39, 39, 39,
+        39, 39, 39, 39, 55, 39, 56, 57,
+        58, 39, 39, 39, 39, 39, 62, 63,
+        64, 66, 39, 39, 39, 39, 44, 39,
+        68, 39, 42, 39, 39, 39, 39, 39,
+        39, 39, 43, 44, 45, 46, 47, 39,
+        49, 50, 39, 39, 39, 53, 54, 55,
+        39, 56, 57, 58, 39, 39, 39, 39,
+        39, 62, 63, 64, 66, 39, 39, 39,
+        39, 44, 39, 42, 39, 39, 39, 39,
+        39, 39, 39, 39, 44, 45, 46, 47,
+        39, 39, 39, 39, 39, 39, 39, 39,
+        39, 39, 56, 57, 58, 39, 39, 39,
+        39, 39, 62, 63, 64, 66, 39, 39,
+        39, 39, 44, 39, 68, 39, 42, 39,
+        39, 39, 39, 39, 39, 39, 43, 44,
+        45, 46, 47, 39, 39, 50, 39, 39,
+        39, 53, 54, 55, 39, 56, 57, 58,
+        39, 39, 39, 39, 39, 62, 63, 64,
+        66, 39, 39, 39, 39, 44, 39, 68,
+        39, 42, 39, 39, 39, 39, 39, 39,
+        39, 43, 44, 45, 46, 47, 39, 39,
+        39, 39, 39, 39, 53, 54, 55, 39,
+        56, 57, 58, 39, 39, 39, 39, 39,
+        62, 63, 64, 66, 39, 39, 39, 39,
+        44, 39, 68, 39, 42, 39, 39, 39,
+        39, 39, 39, 39, 43, 44, 45, 46,
+        47, 48, 49, 50, 39, 39, 39, 53,
+        54, 55, 39, 56, 57, 58, 39, 39,
+        39, 39, 39, 62, 63, 64, 66, 39,
+        39, 39, 39, 44, 39, 40, 41, 39,
+        42, 39, 39, 39, 39, 39, 39, 39,
+        43, 44, 45, 46, 47, 48, 49, 50,
+        51, 39, 52, 53, 54, 55, 39, 56,
+        57, 58, 39, 39, 39, 39, 61, 62,
+        63, 64, 61, 39, 39, 39, 39, 65,
+        39, 39, 64, 39, 40, 39, 39, 39,
+        39, 39, 39, 39, 39, 39, 39, 39,
+        39, 42, 39, 40, 39, 39, 39, 39,
+        39, 39, 39, 39, 39, 39, 39, 39,
+        42, 39, 39, 39, 39, 39, 39, 39,
+        39, 44, 45, 46, 47, 39, 39, 39,
+        39, 39, 39, 39, 39, 39, 39, 56,
+        57, 58, 39, 39, 39, 39, 39, 62,
+        63, 64, 66, 39, 42, 39, 39, 39,
+        39, 39, 39, 39, 39, 39, 39, 39,
+        39, 39, 39, 39, 39, 39, 39, 39,
+        39, 39, 39, 39, 39, 39, 39, 59,
+        60, 39, 42, 39, 39, 39, 39, 39,
+        39, 39, 39, 39, 39, 39, 39, 39,
+        39, 39, 39, 39, 39, 39, 39, 39,
+        39, 39, 39, 39, 39, 39, 60, 39,
+        4, 70, 69, 71, 69, 69, 69, 69,
+        69, 69, 69, 72, 73, 74, 75, 76,
+        77, 78, 79, 80, 4, 81, 82, 83,
+        84, 69, 85, 86, 87, 69, 69, 69,
+        69, 88, 89, 90, 91, 92, 69, 69,
+        69, 69, 93, 69, 69, 94, 69, 4,
+        69, 69, 69, 69, 69, 69, 69, 69,
+        69, 69, 69, 69, 71, 69, 69, 69,
+        69, 69, 69, 69, 69, 73, 74, 75,
+        76, 69, 69, 69, 69, 69, 69, 69,
+        69, 69, 69, 85, 86, 87, 69, 69,
+        69, 69, 69, 89, 90, 91, 95, 69,
+        69, 69, 69, 73, 69, 71, 69, 69,
+        69, 69, 69, 69, 69, 69, 73, 74,
+        75, 76, 69, 69, 69, 69, 69, 69,
+        69, 69, 69, 69, 85, 86, 87, 69,
+        69, 69, 69, 69, 89, 90, 91, 95,
+        69, 71, 69, 69, 69, 69, 69, 69,
+        69, 69, 69, 74, 75, 76, 69, 69,
+        69, 69, 69, 69, 69, 69, 69, 69,
+        69, 69, 69, 69, 69, 69, 69, 69,
+        89, 90, 91, 69, 71, 69, 69, 69,
+        69, 69, 69, 69, 69, 69, 69, 75,
+        76, 69, 69, 69, 69, 69, 69, 69,
+        69, 69, 69, 69, 69, 69, 69, 69,
+        69, 69, 69, 89, 90, 91, 69, 71,
+        69, 69, 69, 69, 69, 69, 69, 69,
+        69, 69, 69, 76, 69, 69, 69, 69,
+        69, 69, 69, 69, 69, 69, 69, 69,
+        69, 69, 69, 69, 69, 69, 89, 90,
+        91, 69, 71, 69, 69, 69, 69, 69,
+        69, 69, 69, 69, 69, 69, 69, 69,
+        69, 69, 69, 69, 69, 69, 69, 69,
+        69, 69, 69, 69, 69, 69, 69, 69,
+        69, 89, 90, 69, 71, 69, 69, 69,
+        69, 69, 69, 69, 69, 69, 69, 69,
+        69, 69, 69, 69, 69, 69, 69, 69,
+        69, 69, 69, 69, 69, 69, 69, 69,
+        69, 69, 69, 69, 90, 69, 71, 69,
+        71, 69, 69, 69, 69, 69, 69, 69,
+        69, 69, 74, 75, 76, 69, 69, 69,
+        69, 69, 69, 69, 69, 69, 69, 85,
+        86, 87, 69, 69, 69, 69, 69, 89,
+        90, 91, 95, 69, 71, 69, 69, 69,
+        69, 69, 69, 69, 69, 69, 74, 75,
+        76, 69, 69, 69, 69, 69, 69, 69,
+        69, 69, 69, 69, 86, 87, 69, 69,
+        69, 69, 69, 89, 90, 91, 95, 69,
+        71, 69, 69, 69, 69, 69, 69, 69,
+        69, 69, 74, 75, 76, 69, 69, 69,
+        69, 69, 69, 69, 69, 69, 69, 69,
+        69, 87, 69, 69, 69, 69, 69, 89,
+        90, 91, 95, 69, 97, 96, 96, 96,
+        96, 96, 96, 96, 96, 96, 96, 96,
+        96, 98, 96, 71, 69, 69, 69, 69,
+        69, 69, 69, 69, 69, 74, 75, 76,
+        69, 69, 69, 69, 69, 69, 69, 69,
+        69, 69, 69, 69, 69, 69, 69, 69,
+        69, 69, 89, 90, 91, 95, 69, 71,
+        69, 69, 69, 69, 69, 69, 69, 72,
+        73, 74, 75, 76, 69, 69, 69, 69,
+        69, 69, 82, 83, 84, 69, 85, 86,
+        87, 69, 69, 69, 69, 69, 89, 90,
+        91, 95, 69, 69, 69, 69, 73, 69,
+        71, 69, 69, 69, 69, 69, 69, 69,
+        69, 73, 74, 75, 76, 69, 69, 69,
+        69, 69, 69, 82, 83, 84, 69, 85,
+        86, 87, 69, 69, 69, 69, 69, 89,
+        90, 91, 95, 69, 69, 69, 69, 73,
+        69, 71, 69, 69, 69, 69, 69, 69,
+        69, 69, 73, 74, 75, 76, 69, 69,
+        69, 69, 69, 69, 69, 83, 84, 69,
+        85, 86, 87, 69, 69, 69, 69, 69,
+        89, 90, 91, 95, 69, 69, 69, 69,
+        73, 69, 71, 69, 69, 69, 69, 69,
+        69, 69, 69, 73, 74, 75, 76, 69,
+        69, 69, 69, 69, 69, 69, 69, 84,
+        69, 85, 86, 87, 69, 69, 69, 69,
+        69, 89, 90, 91, 95, 69, 69, 69,
+        69, 73, 69, 99, 69, 71, 69, 69,
+        69, 69, 69, 69, 69, 72, 73, 74,
+        75, 76, 69, 78, 79, 69, 69, 69,
+        82, 83, 84, 69, 85, 86, 87, 69,
+        69, 69, 69, 69, 89, 90, 91, 95,
+        69, 69, 69, 69, 73, 69, 71, 69,
+        69, 69, 69, 69, 69, 69, 69, 73,
+        74, 75, 76, 69, 69, 69, 69, 69,
+        69, 69, 69, 69, 69, 85, 86, 87,
+        69, 69, 69, 69, 69, 89, 90, 91,
+        95, 69, 69, 69, 69, 73, 69, 99,
+        69, 71, 69, 69, 69, 69, 69, 69,
+        69, 72, 73, 74, 75, 76, 69, 69,
+        79, 69, 69, 69, 82, 83, 84, 69,
+        85, 86, 87, 69, 69, 69, 69, 69,
+        89, 90, 91, 95, 69, 69, 69, 69,
+        73, 69, 99, 69, 71, 69, 69, 69,
+        69, 69, 69, 69, 72, 73, 74, 75,
+        76, 69, 69, 69, 69, 69, 69, 82,
+        83, 84, 69, 85, 86, 87, 69, 69,
+        69, 69, 69, 89, 90, 91, 95, 69,
+        69, 69, 69, 73, 69, 99, 69, 71,
+        69, 69, 69, 69, 69, 69, 69, 72,
+        73, 74, 75, 76, 77, 78, 79, 69,
+        69, 69, 82, 83, 84, 69, 85, 86,
+        87, 69, 69, 69, 69, 69, 89, 90,
+        91, 95, 69, 69, 69, 69, 73, 69,
+        4, 70, 69, 71, 69, 69, 69, 69,
+        69, 69, 69, 72, 73, 74, 75, 76,
+        77, 78, 79, 80, 69, 81, 82, 83,
+        84, 69, 85, 86, 87, 69, 69, 69,
+        69, 88, 89, 90, 91, 92, 69, 69,
+        69, 69, 93, 69, 69, 94, 69, 4,
+        100, 100, 100, 100, 100, 100, 100, 100,
+        100, 100, 100, 100, 101, 100, 4, 96,
+        96, 96, 96, 96, 96, 96, 96, 96,
+        96, 96, 96, 98, 96, 4, 69, 69,
+        69, 69, 69, 69, 69, 69, 69, 69,
+        69, 69, 71, 69, 69, 69, 69, 69,
+        69, 69, 69, 73, 74, 75, 76, 69,
+        69, 69, 69, 69, 69, 69, 69, 69,
+        69, 85, 86, 87, 69, 69, 69, 69,
+        69, 89, 90, 91, 95, 69, 101, 100,
+        103, 104, 102, 6, 105, 105, 105, 105,
+        105, 105, 105, 105, 105, 106, 105, 107,
+        108, 69, 71, 69, 69, 69, 69, 69,
+        69, 69, 109, 110, 111, 112, 113, 114,
+        115, 116, 117, 107, 118, 119, 120, 121,
+        69, 122, 123, 124, 69, 59, 60, 69,
+        125, 126, 127, 128, 129, 69, 69, 69,
+        69, 130, 69, 69, 131, 69, 107, 108,
+        69, 71, 69, 69, 69, 69, 69, 69,
+        69, 109, 110, 111, 112, 113, 114, 115,
+        116, 117, 107, 118, 119, 120, 121, 69,
+        122, 123, 124, 69, 69, 69, 69, 125,
+        126, 127, 128, 129, 69, 69, 69, 69,
+        130, 69, 69, 131, 69, 107, 69, 69,
+        69, 69, 69, 69, 69, 69, 69, 69,
+        69, 69, 71, 69, 69, 69, 69, 69,
+        69, 69, 69, 110, 111, 112, 113, 69,
+        69, 69, 69, 69, 69, 69, 69, 69,
+        69, 122, 123, 124, 69, 69, 69, 69,
+        69, 126, 127, 128, 132, 69, 69, 69,
+        69, 110, 69, 71, 69, 69, 69, 69,
+        69, 69, 69, 69, 110, 111, 112, 113,
+        69, 69, 69, 69, 69, 69, 69, 69,
+        69, 69, 122, 123, 124, 69, 69, 69,
+        69, 69, 126, 127, 128, 132, 69, 71,
+        69, 69, 69, 69, 69, 69, 69, 69,
+        69, 111, 112, 113, 69, 69, 69, 69,
+        69, 69, 69, 69, 69, 69, 69, 69,
+        69, 69, 69, 69, 69, 69, 126, 127,
+        128, 69, 71, 69, 69, 69, 69, 69,
+        69, 69, 69, 69, 69, 112, 113, 69,
+        69, 69, 69, 69, 69, 69, 69, 69,
+        69, 69, 69, 69, 69, 69, 69, 69,
+        69, 126, 127, 128, 69, 71, 69, 69,
+        69, 69, 69, 69, 69, 69, 69, 69,
+        69, 113, 69, 69, 69, 69, 69, 69,
+        69, 69, 69, 69, 69, 69, 69, 69,
+        69, 69, 69, 69, 126, 127, 128, 69,
+        71, 69, 69, 69, 69, 69, 69, 69,
+        69, 69, 69, 69, 69, 69, 69, 69,
+        69, 69, 69, 69, 69, 69, 69, 69,
+        69, 69, 69, 69, 69, 69, 69, 126,
+        127, 69, 71, 69, 69, 69, 69, 69,
+        69, 69, 69, 69, 69, 69, 69, 69,
+        69, 69, 69, 69, 69, 69, 69, 69,
+        69, 69, 69, 69, 69, 69, 69, 69,
+        69, 69, 127, 69, 71, 69, 71, 69,
+        69, 69, 69, 69, 69, 69, 69, 69,
+        111, 112, 113, 69, 69, 69, 69, 69,
+        69, 69, 69, 69, 69, 122, 123, 124,
+        69, 69, 69, 69, 69, 126, 127, 128,
+        132, 69, 71, 69, 69, 69, 69, 69,
+        69, 69, 69, 69, 111, 112, 113, 69,
+        69, 69, 69, 69, 69, 69, 69, 69,
+        69, 69, 123, 124, 69, 69, 69, 69,
+        69, 126, 127, 128, 132, 69, 71, 69,
+        69, 69, 69, 69, 69, 69, 69, 69,
+        111, 112, 113, 69, 69, 69, 69, 69,
+        69, 69, 69, 69, 69, 69, 69, 124,
+        69, 69, 69, 69, 69, 126, 127, 128,
+        132, 69, 133, 96, 96, 96, 96, 96,
+        96, 96, 96, 96, 96, 96, 96, 98,
+        96, 71, 69, 69, 69, 69, 69, 69,
+        69, 69, 69, 111, 112, 113, 69, 69,
+        69, 69, 69, 69, 69, 69, 69, 69,
+        69, 69, 69, 69, 69, 69, 69, 69,
+        126, 127, 128, 132, 69, 71, 69, 69,
+        69, 69, 69, 69, 69, 109, 110, 111,
+        112, 113, 69, 69, 69, 69, 69, 69,
+        119, 120, 121, 69, 122, 123, 124, 69,
+        69, 69, 69, 69, 126, 127, 128, 132,
+        69, 69, 69, 69, 110, 69, 71, 69,
+        69, 69, 69, 69, 69, 69, 69, 110,
+        111, 112, 113, 69, 69, 69, 69, 69,
+        69, 119, 120, 121, 69, 122, 123, 124,
+        69, 69, 69, 69, 69, 126, 127, 128,
+        132, 69, 69, 69, 69, 110, 69, 71,
+        69, 69, 69, 69, 69, 69, 69, 69,
+        110, 111, 112, 113, 69, 69, 69, 69,
+        69, 69, 69, 120, 121, 69, 122, 123,
+        124, 69, 69, 69, 69, 69, 126, 127,
+        128, 132, 69, 69, 69, 69, 110, 69,
+        71, 69, 69, 69, 69, 69, 69, 69,
+        69, 110, 111, 112, 113, 69, 69, 69,
+        69, 69, 69, 69, 69, 121, 69, 122,
+        123, 124, 69, 69, 69, 69, 69, 126,
+        127, 128, 132, 69, 69, 69, 69, 110,
+        69, 134, 69, 71, 69, 69, 69, 69,
+        69, 69, 69, 109, 110, 111, 112, 113,
+        69, 115, 116, 69, 69, 69, 119, 120,
+        121, 69, 122, 123, 124, 69, 69, 69,
+        69, 69, 126, 127, 128, 132, 69, 69,
+        69, 69, 110, 69, 71, 69, 69, 69,
+        69, 69, 69, 69, 69, 110, 111, 112,
+        113, 69, 69, 69, 69, 69, 69, 69,
+        69, 69, 69, 122, 123, 124, 69, 69,
+        69, 69, 69, 126, 127, 128, 132, 69,
+        69, 69, 69, 110, 69, 134, 69, 71,
+        69, 69, 69, 69, 69, 69, 69, 109,
+        110, 111, 112, 113, 69, 69, 116, 69,
+        69, 69, 119, 120, 121, 69, 122, 123,
+        124, 69, 69, 69, 69, 69, 126, 127,
+        128, 132, 69, 69, 69, 69, 110, 69,
+        134, 69, 71, 69, 69, 69, 69, 69,
+        69, 69, 109, 110, 111, 112, 113, 69,
+        69, 69, 69, 69, 69, 119, 120, 121,
+        69, 122, 123, 124, 69, 69, 69, 69,
+        69, 126, 127, 128, 132, 69, 69, 69,
+        69, 110, 69, 134, 69, 71, 69, 69,
+        69, 69, 69, 69, 69, 109, 110, 111,
+        112, 113, 114, 115, 116, 69, 69, 69,
+        119, 120, 121, 69, 122, 123, 124, 69,
+        69, 69, 69, 69, 126, 127, 128, 132,
+        69, 69, 69, 69, 110, 69, 107, 108,
+        69, 71, 69, 69, 69, 69, 69, 69,
+        69, 109, 110, 111, 112, 113, 114, 115,
+        116, 117, 69, 118, 119, 120, 121, 69,
+        122, 123, 124, 69, 69, 69, 69, 125,
+        126, 127, 128, 129, 69, 69, 69, 69,
+        130, 69, 69, 131, 69, 107, 100, 100,
+        100, 100, 100, 100, 100, 100, 100, 100,
+        100, 100, 101, 100, 107, 96, 96, 96,
+        96, 96, 96, 96, 96, 96, 96, 96,
+        96, 98, 96, 107, 69, 69, 69, 69,
+        69, 69, 69, 69, 69, 69, 69, 69,
+        71, 69, 69, 69, 69, 69, 69, 69,
+        69, 110, 111, 112, 113, 69, 69, 69,
+        69, 69, 69, 69, 69, 69, 69, 122,
+        123, 124, 69, 69, 69, 69, 69, 126,
+        127, 128, 132, 69, 101, 100, 8, 9,
+        135, 11, 135, 135, 135, 135, 135, 135,
+        135, 13, 14, 15, 16, 17, 18, 19,
+        20, 21, 8, 22, 23, 24, 25, 135,
+        26, 27, 28, 135, 135, 135, 135, 32,
+        33, 34, 38, 32, 135, 135, 135, 135,
+        37, 135, 135, 38, 135, 8, 135, 135,
+        135, 135, 135, 135, 135, 135, 135, 135,
+        135, 135, 11, 135, 135, 135, 135, 135,
+        135, 135, 135, 14, 15, 16, 17, 135,
+        135, 135, 135, 135, 135, 135, 135, 135,
+        135, 26, 27, 28, 135, 135, 135, 135,
+        135, 33, 34, 38, 136, 135, 135, 135,
+        135, 14, 135, 11, 135, 135, 135, 135,
+        135, 135, 135, 135, 14, 15, 16, 17,
+        135, 135, 135, 135, 135, 135, 135, 135,
+        135, 135, 26, 27, 28, 135, 135, 135,
+        135, 135, 33, 34, 38, 136, 135, 11,
+        135, 135, 135, 135, 135, 135, 135, 135,
+        135, 15, 16, 17, 135, 135, 135, 135,
+        135, 135, 135, 135, 135, 135, 135, 135,
+        135, 135, 135, 135, 135, 135, 33, 34,
+        38, 135, 11, 135, 135, 135, 135, 135,
+        135, 135, 135, 135, 135, 16, 17, 135,
+        135, 135, 135, 135, 135, 135, 135, 135,
+        135, 135, 135, 135, 135, 135, 135, 135,
+        135, 33, 34, 38, 135, 11, 135, 135,
+        135, 135, 135, 135, 135, 135, 135, 135,
+        135, 17, 135, 135, 135, 135, 135, 135,
+        135, 135, 135, 135, 135, 135, 135, 135,
+        135, 135, 135, 135, 33, 34, 38, 135,
+        11, 135, 135, 135, 135, 135, 135, 135,
+        135, 135, 135, 135, 135, 135, 135, 135,
+        135, 135, 135, 135, 135, 135, 135, 135,
+        135, 135, 135, 135, 135, 135, 135, 33,
+        34, 135, 11, 135, 135, 135, 135, 135,
+        135, 135, 135, 135, 135, 135, 135, 135,
+        135, 135, 135, 135, 135, 135, 135, 135,
+        135, 135, 135, 135, 135, 135, 135, 135,
+        135, 135, 34, 135, 11, 137, 11, 135,
+        135, 135, 135, 135, 135, 135, 135, 135,
+        15, 16, 17, 135, 135, 135, 135, 135,
+        135, 135, 135, 135, 135, 26, 27, 28,
+        135, 135, 135, 135, 135, 33, 34, 38,
+        136, 135, 11, 135, 135, 135, 135, 135,
+        135, 135, 135, 135, 15, 16, 17, 135,
+        135, 135, 135, 135, 135, 135, 135, 135,
+        135, 135, 27, 28, 135, 135, 135, 135,
+        135, 33, 34, 38, 136, 135, 11, 135,
+        135, 135, 135, 135, 135, 135, 135, 135,
+        15, 16, 17, 135, 135, 135, 135, 135,
+        135, 135, 135, 135, 135, 135, 135, 28,
+        135, 135, 135, 135, 135, 33, 34, 38,
+        136, 135, 138, 135, 135, 135, 135, 135,
+        135, 135, 135, 135, 135, 135, 135, 11,
+        135, 11, 135, 135, 135, 135, 135, 135,
+        135, 135, 135, 15, 16, 17, 135, 135,
+        135, 135, 135, 135, 135, 135, 135, 135,
+        135, 135, 135, 135, 135, 135, 135, 135,
+        33, 34, 38, 136, 135, 11, 135, 135,
+        135, 135, 135, 135, 135, 13, 14, 15,
+        16, 17, 135, 135, 135, 135, 135, 135,
+        23, 24, 25, 135, 26, 27, 28, 135,
+        135, 135, 135, 135, 33, 34, 38, 136,
+        135, 135, 135, 135, 14, 135, 11, 135,
+        135, 135, 135, 135, 135, 135, 135, 14,
+        15, 16, 17, 135, 135, 135, 135, 135,
+        135, 23, 24, 25, 135, 26, 27, 28,
+        135, 135, 135, 135, 135, 33, 34, 38,
+        136, 135, 135, 135, 135, 14, 135, 11,
+        135, 135, 135, 135, 135, 135, 135, 135,
+        14, 15, 16, 17, 135, 135, 135, 135,
+        135, 135, 135, 24, 25, 135, 26, 27,
+        28, 135, 135, 135, 135, 135, 33, 34,
+        38, 136, 135, 135, 135, 135, 14, 135,
+        11, 135, 135, 135, 135, 135, 135, 135,
+        135, 14, 15, 16, 17, 135, 135, 135,
+        135, 135, 135, 135, 135, 25, 135, 26,
+        27, 28, 135, 135, 135, 135, 135, 33,
+        34, 38, 136, 135, 135, 135, 135, 14,
+        135, 139, 135, 11, 135, 135, 135, 135,
+        135, 135, 135, 13, 14, 15, 16, 17,
+        135, 19, 20, 135, 135, 135, 23, 24,
+        25, 135, 26, 27, 28, 135, 135, 135,
+        135, 135, 33, 34, 38, 136, 135, 135,
+        135, 135, 14, 135, 11, 135, 135, 135,
+        135, 135, 135, 135, 135, 14, 15, 16,
+        17, 135, 135, 135, 135, 135, 135, 135,
+        135, 135, 135, 26, 27, 28, 135, 135,
+        135, 135, 135, 33, 34, 38, 136, 135,
+        135, 135, 135, 14, 135, 139, 135, 11,
+        135, 135, 135, 135, 135, 135, 135, 13,
+        14, 15, 16, 17, 135, 135, 20, 135,
+        135, 135, 23, 24, 25, 135, 26, 27,
+        28, 135, 135, 135, 135, 135, 33, 34,
+        38, 136, 135, 135, 135, 135, 14, 135,
+        139, 135, 11, 135, 135, 135, 135, 135,
+        135, 135, 13, 14, 15, 16, 17, 135,
+        135, 135, 135, 135, 135, 23, 24, 25,
+        135, 26, 27, 28, 135, 135, 135, 135,
+        135, 33, 34, 38, 136, 135, 135, 135,
+        135, 14, 135, 139, 135, 11, 135, 135,
+        135, 135, 135, 135, 135, 13, 14, 15,
+        16, 17, 18, 19, 20, 135, 135, 135,
+        23, 24, 25, 135, 26, 27, 28, 135,
+        135, 135, 135, 135, 33, 34, 38, 136,
+        135, 135, 135, 135, 14, 135, 8, 9,
+        135, 11, 135, 135, 135, 135, 135, 135,
+        135, 13, 14, 15, 16, 17, 18, 19,
+        20, 21, 135, 22, 23, 24, 25, 135,
+        26, 27, 28, 135, 135, 135, 135, 32,
+        33, 34, 38, 32, 135, 135, 135, 135,
+        37, 135, 135, 38, 135, 8, 135, 135,
+        135, 135, 135, 135, 135, 135, 135, 135,
+        135, 135, 11, 135, 8, 135, 135, 135,
+        135, 135, 135, 135, 135, 135, 135, 135,
+        135, 11, 135, 135, 135, 135, 135, 135,
+        135, 135, 14, 15, 16, 17, 135, 135,
+        135, 135, 135, 135, 135, 135, 135, 135,
+        26, 27, 28, 135, 135, 135, 135, 135,
+        33, 34, 38, 136, 135, 140, 135, 135,
+        135, 135, 135, 135, 135, 135, 135, 11,
+        135, 10, 11, 135, 4, 135, 135, 135,
+        4, 135, 135, 135, 135, 135, 8, 9,
+        10, 11, 135, 135, 135, 135, 135, 135,
+        135, 13, 14, 15, 16, 17, 18, 19,
+        20, 21, 8, 22, 23, 24, 25, 135,
+        26, 27, 28, 135, 29, 30, 135, 32,
+        33, 34, 38, 32, 135, 135, 135, 135,
+        37, 135, 135, 38, 135, 11, 135, 135,
+        135, 135, 135, 135, 135, 135, 135, 135,
+        135, 135, 135, 135, 135, 135, 135, 135,
+        135, 135, 135, 135, 135, 135, 135, 135,
+        29, 30, 135, 11, 135, 135, 135, 135,
+        135, 135, 135, 135, 135, 135, 135, 135,
+        135, 135, 135, 135, 135, 135, 135, 135,
+        135, 135, 135, 135, 135, 135, 135, 30,
+        135, 4, 141, 141, 141, 4, 141, 143,
+        142, 142, 142, 142, 142, 142, 142, 142,
+        142, 142, 142, 142, 142, 142, 142, 142,
+        142, 142, 142, 142, 142, 142, 142, 142,
+        142, 142, 142, 142, 142, 142, 142, 142,
+        142, 142, 142, 144, 142, 145, 142, 145,
+        146, 142, 143, 142, 142, 142, 142, 142,
+        142, 142, 142, 142, 142, 142, 142, 142,
+        142, 142, 142, 142, 142, 142, 142, 142,
+        142, 142, 142, 142, 142, 142, 142, 142,
+        142, 142, 142, 142, 142, 1, 144, 144,
+        142, 143, 142, 142, 142, 142, 142, 142,
+        142, 142, 142, 142, 142, 142, 142, 142,
+        142, 142, 142, 142, 142, 142, 142, 142,
+        142, 142, 142, 142, 142, 142, 142, 142,
+        142, 142, 142, 142, 142, 144, 142, 145,
+        142, 143, 142, 142, 142, 142, 142, 142,
+        142, 142, 142, 142, 142, 142, 142, 142,
+        142, 142, 142, 142, 142, 142, 142, 142,
+        142, 142, 142, 142, 142, 142, 142, 142,
+        142, 142, 142, 142, 142, 144, 142, 145,
+        142, 145, 142, 40, 41, 39, 42, 39,
+        39, 39, 39, 39, 39, 39, 43, 44,
+        45, 46, 47, 48, 49, 50, 51, 40,
+        52, 53, 54, 55, 39, 56, 57, 58,
+        39, 59, 60, 39, 61, 62, 63, 64,
+        61, 1, 39, 2, 39, 65, 39, 39,
+        64, 39, 0
 };
 
 static const char _use_syllable_machine_trans_targs[] = {
-        1, 120, 0, 2, 31, 1, 58, 60,
-        88, 89, 114, 1, 116, 102, 90, 91,
-        92, 93, 106, 108, 109, 110, 111, 103,
-        104, 105, 97, 98, 99, 117, 118, 119,
-        112, 94, 95, 96, 124, 113, 1, 3,
-        4, 1, 17, 5, 6, 7, 8, 21,
-        23, 24, 25, 26, 18, 19, 20, 12,
-        13, 14, 29, 30, 27, 9, 10, 11,
-        28, 15, 16, 22, 1, 32, 1, 45,
-        33, 34, 35, 36, 49, 51, 52, 53,
-        54, 46, 47, 48, 40, 41, 42, 55,
-        37, 38, 39, 56, 57, 43, 1, 44,
-        1, 50, 1, 1, 1, 59, 1, 1,
-        1, 61, 62, 75, 63, 64, 65, 66,
-        79, 81, 82, 83, 84, 76, 77, 78,
-        70, 71, 72, 85, 67, 68, 69, 86,
-        87, 73, 74, 80, 1, 100, 101, 107,
-        115, 1, 1, 1, 121, 122, 123
+        1, 122, 0, 2, 31, 1, 59, 61,
+        90, 91, 116, 1, 118, 104, 92, 93,
+        94, 95, 108, 110, 111, 112, 113, 105,
+        106, 107, 99, 100, 101, 119, 120, 121,
+        114, 96, 97, 98, 126, 115, 98, 1,
+        3, 4, 1, 17, 5, 6, 7, 8,
+        21, 23, 24, 25, 26, 18, 19, 20,
+        12, 13, 14, 29, 30, 27, 9, 10,
+        11, 28, 15, 16, 22, 1, 32, 1,
+        45, 33, 34, 35, 36, 49, 51, 52,
+        53, 54, 46, 47, 48, 40, 41, 42,
+        55, 37, 38, 39, 56, 57, 58, 43,
+        1, 44, 1, 50, 1, 1, 1, 60,
+        1, 1, 1, 62, 63, 76, 64, 65,
+        66, 67, 80, 82, 83, 84, 85, 77,
+        78, 79, 71, 72, 73, 86, 68, 69,
+        70, 87, 88, 89, 74, 75, 81, 1,
+        102, 1, 103, 109, 117, 1, 1, 1,
+        123, 124, 125
 };
 
 static const char _use_syllable_machine_trans_actions[] = {
@@ -737,20 +745,21 @@ static const char _use_syllable_machine_trans_actions[] = {
         0, 0, 0, 5, 0, 0, 0, 0,
         0, 0, 0, 0, 0, 0, 0, 0,
         0, 0, 0, 0, 0, 0, 0, 0,
-        0, 0, 0, 0, 6, 0, 7, 0,
-        0, 8, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 6, 7, 0, 8, 9,
+        0, 0, 10, 0, 0, 0, 0, 0,
         0, 0, 0, 0, 0, 0, 0, 0,
         0, 0, 0, 0, 0, 0, 0, 0,
-        0, 0, 0, 0, 9, 0, 10, 0,
+        0, 0, 0, 0, 0, 11, 0, 12,
         0, 0, 0, 0, 0, 0, 0, 0,
         0, 0, 0, 0, 0, 0, 0, 0,
-        0, 0, 0, 0, 0, 0, 11, 0,
-        12, 0, 13, 14, 15, 0, 16, 17,
-        18, 0, 0, 0, 0, 0, 0, 0,
         0, 0, 0, 0, 0, 0, 0, 0,
+        13, 0, 14, 0, 15, 16, 17, 0,
+        18, 19, 20, 0, 0, 0, 0, 0,
         0, 0, 0, 0, 0, 0, 0, 0,
-        0, 0, 0, 0, 19, 0, 0, 0,
-        0, 20, 21, 22, 0, 0, 0
+        0, 0, 0, 0, 0, 0, 0, 0,
+        0, 0, 0, 0, 0, 0, 0, 21,
+        0, 22, 0, 0, 0, 23, 24, 25,
+        0, 0, 0
 };
 
 static const char _use_syllable_machine_to_state_actions[] = {
@@ -769,7 +778,7 @@ static const char _use_syllable_machine_to_state_actions[] = {
         0, 0, 0, 0, 0, 0, 0, 0,
         0, 0, 0, 0, 0, 0, 0, 0,
         0, 0, 0, 0, 0, 0, 0, 0,
-        0, 0, 0, 0, 0
+        0, 0, 0, 0, 0, 0, 0
 };
 
 static const char _use_syllable_machine_from_state_actions[] = {
@@ -788,26 +797,26 @@ static const char _use_syllable_machine_from_state_actions[] = {
         0, 0, 0, 0, 0, 0, 0, 0,
         0, 0, 0, 0, 0, 0, 0, 0,
         0, 0, 0, 0, 0, 0, 0, 0,
-        0, 0, 0, 0, 0
+        0, 0, 0, 0, 0, 0, 0
 };
 
 static const short _use_syllable_machine_eof_trans[] = {
-        1, 0, 39, 39, 39, 39, 39, 39,
-        39, 39, 39, 39, 39, 39, 39, 39,
-        39, 39, 39, 39, 39, 39, 39, 39,
-        39, 39, 39, 39, 39, 39, 39, 69,
-        69, 69, 69, 69, 69, 69, 69, 69,
-        69, 69, 69, 95, 69, 69, 69, 69,
-        69, 69, 69, 69, 69, 69, 69, 99,
-        95, 69, 101, 104, 69, 69, 69, 69,
-        69, 69, 69, 69, 69, 69, 69, 69,
-        69, 95, 69, 69, 69, 69, 69, 69,
-        69, 69, 69, 69, 69, 99, 95, 69,
-        133, 133, 133, 133, 133, 133, 133, 133,
-        133, 133, 133, 133, 133, 133, 133, 133,
-        133, 133, 133, 133, 133, 133, 133, 133,
-        133, 133, 133, 133, 133, 133, 133, 138,
-        139, 139, 139, 139, 39
+        1, 0, 40, 40, 40, 40, 40, 40,
+        40, 40, 40, 40, 40, 40, 40, 40,
+        40, 40, 40, 40, 40, 40, 40, 40,
+        40, 40, 40, 40, 40, 40, 40, 70,
+        70, 70, 70, 70, 70, 70, 70, 70,
+        70, 70, 70, 97, 70, 70, 70, 70,
+        70, 70, 70, 70, 70, 70, 70, 101,
+        97, 70, 101, 103, 106, 70, 70, 70,
+        70, 70, 70, 70, 70, 70, 70, 70,
+        70, 70, 97, 70, 70, 70, 70, 70,
+        70, 70, 70, 70, 70, 70, 101, 97,
+        70, 101, 136, 136, 136, 136, 136, 136,
+        136, 136, 138, 136, 136, 136, 136, 136,
+        136, 136, 136, 136, 136, 136, 136, 136,
+        136, 136, 136, 136, 136, 136, 136, 136,
+        136, 142, 143, 143, 143, 143, 40
 };
 
 static const int use_syllable_machine_start = 1;
@@ -821,7 +830,7 @@ static const int use_syllable_machine_en_main = 1;
 
 
 
-#line 184 "hb-ot-shaper-use-machine.rl"
+#line 186 "hb-ot-shaper-use-machine.rl"
 
 
 #define found_syllable(syllable_type) \
@@ -920,7 +929,7 @@ find_syllables_use (hb_buffer_t *buffer)
   unsigned int act HB_UNUSED;
   int cs;
 
-#line 924 "hb-ot-shaper-use-machine.hh"
+#line 933 "hb-ot-shaper-use-machine.hh"
         {
         cs = use_syllable_machine_start;
         ts = 0;
@@ -928,12 +937,12 @@ find_syllables_use (hb_buffer_t *buffer)
         act = 0;
         }
 
-#line 284 "hb-ot-shaper-use-machine.rl"
+#line 286 "hb-ot-shaper-use-machine.rl"
 
 
   unsigned int syllable_serial = 1;
 
-#line 937 "hb-ot-shaper-use-machine.hh"
+#line 946 "hb-ot-shaper-use-machine.hh"
         {
         int _slen;
         int _trans;
@@ -947,7 +956,7 @@ _resume:
 #line 1 "NONE"
         {ts = p;}
         break;
-#line 951 "hb-ot-shaper-use-machine.hh"
+#line 960 "hb-ot-shaper-use-machine.hh"
         }
 
         _keys = _use_syllable_machine_trans_keys + (cs<<1);
@@ -965,87 +974,111 @@ _eof_trans:
                 goto _again;
 
         switch ( _use_syllable_machine_trans_actions[_trans] ) {
-        case 6:
+        case 7:
 #line 1 "NONE"
         {te = p+1;}
         break;
-        case 14:
-#line 172 "hb-ot-shaper-use-machine.rl"
+        case 16:
+#line 173 "hb-ot-shaper-use-machine.rl"
         {te = p+1;{ found_syllable (use_virama_terminated_cluster); }}
         break;
-        case 12:
-#line 173 "hb-ot-shaper-use-machine.rl"
+        case 14:
+#line 174 "hb-ot-shaper-use-machine.rl"
         {te = p+1;{ found_syllable (use_sakot_terminated_cluster); }}
         break;
-        case 10:
-#line 174 "hb-ot-shaper-use-machine.rl"
+        case 12:
+#line 175 "hb-ot-shaper-use-machine.rl"
         {te = p+1;{ found_syllable (use_standard_cluster); }}
         break;
-        case 18:
-#line 175 "hb-ot-shaper-use-machine.rl"
+        case 20:
+#line 176 "hb-ot-shaper-use-machine.rl"
         {te = p+1;{ found_syllable (use_number_joiner_terminated_cluster); }}
         break;
-        case 16:
-#line 176 "hb-ot-shaper-use-machine.rl"
+        case 18:
+#line 177 "hb-ot-shaper-use-machine.rl"
         {te = p+1;{ found_syllable (use_numeral_cluster); }}
         break;
-        case 8:
-#line 177 "hb-ot-shaper-use-machine.rl"
+        case 10:
+#line 178 "hb-ot-shaper-use-machine.rl"
         {te = p+1;{ found_syllable (use_symbol_cluster); }}
         break;
-        case 22:
-#line 178 "hb-ot-shaper-use-machine.rl"
+        case 25:
+#line 179 "hb-ot-shaper-use-machine.rl"
         {te = p+1;{ found_syllable (use_hieroglyph_cluster); }}
         break;
         case 5:
-#line 179 "hb-ot-shaper-use-machine.rl"
+#line 181 "hb-ot-shaper-use-machine.rl"
         {te = p+1;{ found_syllable (use_broken_cluster); buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_BROKEN_SYLLABLE; }}
         break;
         case 4:
-#line 180 "hb-ot-shaper-use-machine.rl"
+#line 182 "hb-ot-shaper-use-machine.rl"
         {te = p+1;{ found_syllable (use_non_cluster); }}
         break;
-        case 13:
-#line 172 "hb-ot-shaper-use-machine.rl"
+        case 15:
+#line 173 "hb-ot-shaper-use-machine.rl"
         {te = p;p--;{ found_syllable (use_virama_terminated_cluster); }}
         break;
-        case 11:
-#line 173 "hb-ot-shaper-use-machine.rl"
+        case 13:
+#line 174 "hb-ot-shaper-use-machine.rl"
         {te = p;p--;{ found_syllable (use_sakot_terminated_cluster); }}
         break;
-        case 9:
-#line 174 "hb-ot-shaper-use-machine.rl"
+        case 11:
+#line 175 "hb-ot-shaper-use-machine.rl"
         {te = p;p--;{ found_syllable (use_standard_cluster); }}
         break;
-        case 17:
-#line 175 "hb-ot-shaper-use-machine.rl"
+        case 19:
+#line 176 "hb-ot-shaper-use-machine.rl"
         {te = p;p--;{ found_syllable (use_number_joiner_terminated_cluster); }}
         break;
-        case 15:
-#line 176 "hb-ot-shaper-use-machine.rl"
+        case 17:
+#line 177 "hb-ot-shaper-use-machine.rl"
         {te = p;p--;{ found_syllable (use_numeral_cluster); }}
         break;
-        case 7:
-#line 177 "hb-ot-shaper-use-machine.rl"
+        case 9:
+#line 178 "hb-ot-shaper-use-machine.rl"
         {te = p;p--;{ found_syllable (use_symbol_cluster); }}
         break;
-        case 21:
-#line 178 "hb-ot-shaper-use-machine.rl"
+        case 24:
+#line 179 "hb-ot-shaper-use-machine.rl"
         {te = p;p--;{ found_syllable (use_hieroglyph_cluster); }}
         break;
-        case 19:
-#line 179 "hb-ot-shaper-use-machine.rl"
+        case 21:
+#line 181 "hb-ot-shaper-use-machine.rl"
         {te = p;p--;{ found_syllable (use_broken_cluster); buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_BROKEN_SYLLABLE; }}
         break;
-        case 20:
-#line 180 "hb-ot-shaper-use-machine.rl"
+        case 23:
+#line 182 "hb-ot-shaper-use-machine.rl"
         {te = p;p--;{ found_syllable (use_non_cluster); }}
         break;
         case 1:
-#line 177 "hb-ot-shaper-use-machine.rl"
+#line 178 "hb-ot-shaper-use-machine.rl"
         {{p = ((te))-1;}{ found_syllable (use_symbol_cluster); }}
         break;
-#line 1049 "hb-ot-shaper-use-machine.hh"
+        case 22:
+#line 1 "NONE"
+        {       switch( act ) {
+        case 8:
+        {{p = ((te))-1;} found_syllable (use_non_cluster); }
+        break;
+        case 9:
+        {{p = ((te))-1;} found_syllable (use_broken_cluster); buffer->scratch_flags |= HB_BUFFER_SCRATCH_FLAG_HAS_BROKEN_SYLLABLE; }
+        break;
+        }
+        }
+        break;
+        case 6:
+#line 1 "NONE"
+        {te = p+1;}
+#line 180 "hb-ot-shaper-use-machine.rl"
+        {act = 8;}
+        break;
+        case 8:
+#line 1 "NONE"
+        {te = p+1;}
+#line 181 "hb-ot-shaper-use-machine.rl"
+        {act = 9;}
+        break;
+#line 1082 "hb-ot-shaper-use-machine.hh"
         }
 
 _again:
@@ -1054,7 +1087,7 @@ _again:
 #line 1 "NONE"
         {ts = 0;}
         break;
-#line 1058 "hb-ot-shaper-use-machine.hh"
+#line 1091 "hb-ot-shaper-use-machine.hh"
         }
 
         if ( ++p != pe )
@@ -1070,7 +1103,7 @@ _again:
 
         }
 
-#line 289 "hb-ot-shaper-use-machine.rl"
+#line 291 "hb-ot-shaper-use-machine.rl"
 
 }
 
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-use-table.hh b/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-use-table.hh
index 491b2f940e1d..d3c49949aa8c 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-use-table.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-use-table.hh
@@ -6,18 +6,18 @@
  *
  * on files with these headers:
  *
- * # IndicSyllabicCategory-15.1.0.txt
- * # Date: 2023-01-05
- * # IndicPositionalCategory-15.1.0.txt
- * # Date: 2023-01-05
- * # ArabicShaping-15.1.0.txt
- * # Date: 2023-01-05
- * # DerivedCoreProperties-15.1.0.txt
- * # Date: 2023-08-07, 15:21:24 GMT
- * # Blocks-15.1.0.txt
- * # Date: 2023-07-28, 15:47:20 GMT
- * # Scripts-15.1.0.txt
- * # Date: 2023-07-28, 16:01:07 GMT
+ * # IndicSyllabicCategory-16.0.0.txt
+ * # Date: 2024-04-30, 21:48:21 GMT
+ * # IndicPositionalCategory-16.0.0.txt
+ * # Date: 2024-04-30, 21:48:21 GMT
+ * # ArabicShaping-16.0.0.txt
+ * # Date: 2024-07-30
+ * # DerivedCoreProperties-16.0.0.txt
+ * # Date: 2024-05-31, 18:09:32 GMT
+ * # Blocks-16.0.0.txt
+ * # Date: 2024-02-02
+ * # Scripts-16.0.0.txt
+ * # Date: 2024-04-30, 21:48:40 GMT
  * # Override values For Indic_Syllabic_Category
  * # Not derivable
  * # Initial version based on Unicode 7.0 by Andrew Glass 2014-03-17
@@ -27,6 +27,7 @@
  * # Updated for Unicode 14.0 by Andrew Glass 2021-09-25
  * # Updated for Unicode 15.0 by Andrew Glass 2022-09-16
  * # Updated for Unicode 15.1 by Andrew Glass 2023-09-14
+ * # Updated for Unicode 16.0 by Andrew Glass 2024-09-11
  * # Override values For Indic_Positional_Category
  * # Not derivable
  * # Initial version based on Unicode 7.0 by Andrew Glass 2014-03-17
@@ -38,6 +39,7 @@
  * # Updated for Unicode 14.0 by Andrew Glass 2021-09-28
  * # Updated for Unicode 15.0 by Andrew Glass 2022-09-16
  * # Updated for Unicode 15.1 by Andrew Glass 2023-09-14
+ * # Updated for Unicode 16.0 by Andrew Glass 2024-09-11
  * UnicodeData.txt does not have a header.
  */
 
@@ -65,6 +67,7 @@
 #define N       USE(N)  /* BASE_NUM */
 #define O       USE(O)  /* OTHER */
 #define R       USE(R)  /* REPHA */
+#define RK      USE(RK) /* REORDERING_KILLER */
 #define SB      USE(SB) /* HIEROGLYPH_SEGMENT_BEGIN */
 #define SE      USE(SE) /* HIEROGLYPH_SEGMENT_END */
 #define SUB     USE(SUB)        /* CONS_SUB */
@@ -99,16 +102,16 @@
 #ifndef HB_OPTIMIZE_SIZE
 
 static const uint8_t
-hb_use_u8[3187] =
+hb_use_u8[3345] =
 {
-     16,   50,   51,   51,   51,   52,   51,   83,  118,  131,   51,   57,   58,  179,  195,   61,
+     16,   50,   51,   51,   51,   52,   51,   83,  118,  131,   57,   58,   59,  195,  211,   62,
      51,   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,
      51,   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,
      51,   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,
      51,   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,
      51,   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,
      51,   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,
-     14,    0,    1,    2,    2,    2,    2,    3,    2,    2,    2,    2,    2,    4,    2,    2,
+     15,    0,    1,    2,    2,    2,    2,    3,    2,    2,    2,    2,    2,    4,    2,    2,
       5,    6,    2,    7,    8,    9,   10,   11,   12,   13,   14,   15,   16,    2,    2,   17,
      18,   19,   20,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,   21,
      22,   23,   24,   25,   26,   27,   28,   29,   30,   31,   32,    2,   33,    2,    2,    2,
@@ -121,24 +124,26 @@ hb_use_u8[3187] =
       2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,
       2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,   47,   48,    2,
      49,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,   50,   51,    2,    2,    2,
-      2,    2,    2,    2,    2,   52,   53,    2,   54,    2,    2,   55,    2,    2,   56,   57,
-     58,   59,   60,   61,   62,   63,   64,   65,    2,   66,   67,    2,   68,   69,   70,   71,
-      2,   72,    2,   73,   74,   75,   76,    2,    2,   77,   78,   79,   80,    2,   81,   82,
-      2,   83,   83,   83,   83,   83,   83,   83,   83,   84,    2,    2,    2,    2,    2,    2,
+      2,    2,    2,    2,    2,   52,   53,    2,   54,    2,    2,   55,   56,    2,   57,   58,
+     59,   60,   61,   62,   63,   64,   65,   66,   67,   68,   69,    2,   70,   71,   72,   73,
+      2,   74,    2,   75,   76,   77,   78,    2,    2,   79,   80,   81,   82,    2,   83,   84,
+      2,   85,   85,   85,   85,   85,   85,   85,   85,   86,   85,   85,   85,   85,   85,   85,
+     85,   85,   85,   85,   85,   85,   85,   85,   85,   85,   85,   85,   85,   85,   85,   85,
+     85,   85,   85,   85,   85,   85,   85,   85,   87,    2,    2,    2,    2,    2,    2,    2,
       2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,
+      2,    2,    2,   88,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,
+      2,    2,    2,    2,    2,    2,   89,   90,    2,    2,    2,   91,    2,    2,    2,   92,
+     93,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,
+      2,    2,    2,    2,    2,    2,    2,   94,   94,   94,   95,    2,    2,    2,    2,    2,
       2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,
-      2,    2,    2,    2,    2,    2,   85,   86,    2,    2,    2,    2,    2,    2,    2,   87,
-     88,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,
-      2,    2,    2,    2,    2,    2,    2,   89,   89,   89,   90,    2,    2,    2,    2,    2,
+      2,    2,    2,    2,    2,    2,    2,    2,    2,   96,   97,    2,    2,    2,    2,    2,
+      2,    2,    2,   98,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,
       2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,
-      2,    2,    2,    2,    2,    2,    2,    2,    2,   91,   92,    2,    2,    2,    2,    2,
-      2,    2,    2,   93,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,
-      2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,
-      2,    2,    2,   94,    2,    2,   95,    2,    2,    2,   96,    2,    2,    2,    2,    2,
-      2,    2,    2,   97,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,
-      2,   98,   98,   99,  100,   98,   98,   98,   98,   98,   98,   98,   98,   98,   98,   98,
-     98,   98,   98,   98,   98,   98,   98,   98,   98,   98,   98,   98,   98,   98,   98,   98,
-     98,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    1,
+      2,    2,    2,   99,    2,    2,  100,    2,    2,    2,  101,    2,  102,    2,    2,    2,
+      2,    2,    2,  103,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,
+      2,  104,  104,  105,  106,  104,  104,  104,  104,  104,  104,  104,  104,  104,  104,  104,
+    104,  104,  104,  104,  104,  104,  104,  104,  104,  104,  104,  104,  104,  104,  104,  104,
+    104,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    1,
       0,    2,    2,    2,    2,    2,    0,    0,    0,    0,    0,    0,    0,    0,    3,    4,
       0,    5,    0,    0,    0,    0,    0,    6,    0,    0,    7,    0,    0,    0,    0,    0,
       0,    0,    0,    0,    1,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
@@ -167,7 +172,7 @@ hb_use_u8[3187] =
       0,    0,    0,   27,   31,    2,    9,    0,    0,   10,   29,   30,    2,    2,    2,    9,
       2,    2,    2,   30,    2,    2,    0,   17,   45,    0,    0,   35,   47,    0,    0,    0,
       9,   50,   51,    0,    0,    0,    0,    0,    0,   11,   29,    2,    2,    2,    2,    9,
-      2,    2,    2,    2,    2,    2,   52,   53,   23,   23,   19,   31,   48,   33,   48,   34,
+      2,    2,    2,    2,    2,    2,   52,   53,   23,   19,   20,   31,   48,   33,   48,   34,
      54,    0,    0,    0,   35,    0,    0,    0,   30,   12,   29,   30,    2,    2,    2,    2,
       2,    2,    2,    2,    9,    0,    2,    2,    2,    2,   30,    2,    2,    2,    2,   30,
       0,    2,    2,    2,    9,    0,   55,    0,   35,   23,   22,   31,   31,   18,   48,   48,
@@ -195,9 +200,9 @@ hb_use_u8[3187] =
       0,    2,    2,  100,  101,  102,  103,   61,   63,  104,   16,   45,   22,   59,   21,   80,
      48,   48,   76,   11,   11,   11,  105,   46,   40,   11,  106,   74,    2,    2,    2,    2,
       2,    2,    2,  107,   22,   20,   20,   22,   48,   48,   22,  108,    2,    2,    2,    9,
-      0,    0,    0,    0,    0,    0,  109,  110,  111,  111,  111,    0,    0,    0,    0,    0,
-      0,  106,   74,    2,    2,    2,    2,    2,    2,   60,   61,   59,   25,   22,  112,   61,
-      2,    2,    2,    2,  107,   22,   23,   45,   45,  102,   14,    0,    0,    0,    0,    0,
+      0,    0,    0,    0,    0,    0,  109,  110,  110,  110,  110,    0,    0,    0,    0,    0,
+      0,  106,   74,    2,    2,    2,    2,    2,    2,   60,   61,   59,   25,   22,  111,   61,
+      2,    2,    2,    2,  107,   22,   23,   45,   45,  102,  112,    0,    0,    0,    0,    0,
       0,    2,    2,   61,   18,   48,   23,  113,  102,  102,  102,  114,  115,    0,    0,    0,
       0,    2,    2,    2,    2,    2,    0,   30,    2,   11,   46,  116,  116,  116,   11,  116,
     116,   15,  116,  116,  116,   26,    0,   40,    0,    0,    0,  117,   51,   11,    5,    0,
@@ -226,6 +231,7 @@ hb_use_u8[3187] =
     146,    2,    2,   30,    2,   30,    2,    2,    2,    2,    2,    2,    0,   14,   37,    0,
     147,    2,    2,   13,   37,    0,   30,    2,    2,    2,    0,    0,    0,    0,    0,    0,
       0,    0,    0,    0,    0,   30,    2,    2,    9,    2,    2,   11,   41,    0,    0,    0,
+      0,    2,    2,    2,    0,   27,   22,   22,   30,    2,    2,    2,    0,    0,    0,    0,
       0,    2,    2,    2,    2,    2,   27,   38,    0,    2,    2,    2,  116,  116,  116,  116,
     116,  148,    2,    9,    0,    0,    0,    0,    0,    2,   14,   14,    0,    0,    0,    0,
       0,    9,    2,    2,    9,    2,    2,    2,    2,   30,    2,    9,    0,   30,    2,    0,
@@ -244,39 +250,45 @@ hb_use_u8[3187] =
       0,   11,   11,   30,    2,    2,    2,    9,   30,    9,    2,   30,    2,    2,   58,   17,
      23,   16,   23,   47,   32,   33,   32,   34,    0,    0,    0,    0,   35,    0,    0,    0,
       2,    2,   23,    0,   11,   11,   11,   46,    0,   11,   11,   46,    0,    0,    0,    0,
-      0,    2,    2,   65,   25,   20,   20,   20,   22,   23,  126,   15,   17,    0,    0,    0,
-      0,    2,    2,    2,    2,    2,    0,    0,  163,  164,    0,    0,    0,    0,    0,    0,
-      0,   18,   19,   20,   20,   66,   99,   25,  160,   11,  165,    9,    0,    0,    0,    0,
-      0,    2,    2,    2,    2,    2,    2,    2,   65,   25,   20,   20,    0,   48,   48,   11,
-    166,   37,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    2,    2,   20,
-      0,   23,   19,   20,   20,   21,   16,   82,  166,   38,    0,    0,    0,    0,    0,    0,
-      0,    2,    2,    2,    2,    2,   10,  167,   25,   20,   22,   22,  165,    9,    0,    0,
-      0,    2,    2,    2,    2,    2,    9,   43,  136,   23,   22,   20,   76,   21,   22,    0,
-      0,    2,    2,    2,    9,    0,    0,    0,    0,    2,    2,    2,    2,    2,    2,   18,
-     19,   20,   21,   22,  105,  166,   37,    0,    0,    2,    2,    2,    9,   30,    0,    2,
-      2,    2,    2,   30,    9,    2,    2,    2,    2,   23,   23,   18,   32,   33,   12,  168,
-    169,  170,  171,    0,    0,    0,    0,    0,    0,    2,    2,    2,    2,    0,    2,    2,
-      2,   65,   25,   20,   20,    0,   22,   23,   29,  108,    0,   33,    0,    0,    0,    0,
-      0,   52,   20,   22,   22,   22,  140,    2,    2,    2,  172,  173,   11,   15,  174,   72,
-    175,    0,    0,    1,  147,    0,    0,    0,    0,   52,   20,   22,   16,   19,   20,    2,
-      2,    2,    2,  158,  158,  158,  176,  176,  176,  176,  176,  176,   15,  177,    0,   30,
-      0,   22,   20,   20,   31,   22,   22,   11,  166,    0,   61,   61,   61,   61,   61,   61,
-     61,   66,   21,   82,   46,    0,    0,    0,    0,    2,    2,    2,    9,    2,   30,    2,
-      2,   52,   22,   22,   31,    0,   38,   22,   27,   11,  159,  178,  174,    0,    0,    0,
-      0,    2,    2,    2,   30,    9,    2,    2,    2,    2,    2,    2,    2,    2,   23,   23,
-     47,   22,   35,   82,   68,    0,    0,    0,    0,    2,  179,   66,   47,    0,    0,    0,
-      0,   11,  180,    2,    2,    2,    2,    2,    2,    2,    2,   23,   22,   20,   31,    0,
-     48,   16,  143,    0,    0,    0,    0,    0,    0,  181,  181,  181,  181,  181,  181,  181,
-    181,  182,  182,  182,  183,  184,  182,  181,  181,  185,  181,  181,  186,  187,  187,  187,
-    187,  187,  187,  187,    0,    0,    0,    0,    0,   11,   11,   11,   46,    0,    0,    0,
-      0,    2,    2,    2,    2,    2,    9,    0,   58,  188,   20,   20,   20,   20,   20,   20,
-     20,   20,   20,   20,   20,   20,   20,   20,   20,   20,   20,   20,   20,    0,    0,    0,
-     40,  116,   26,    0,    0,    0,    0,    0,    0,    0,    0,    9,    0,    0,    0,    0,
-      0,    2,    2,    2,    0,    0,    0,    0,    0,    2,    2,    2,    2,    2,    0,   58,
-     37,    0,    6,  120,  120,  120,  121,    0,    0,   11,   11,   11,   49,    2,    2,    2,
-      0,    2,    2,    2,    2,    2,    0,    0,    2,    2,    2,    2,    2,    2,    2,    2,
-     46,    2,    2,    2,    2,    2,    2,   11,   11,    2,    2,    2,    2,    2,    2,   22,
-     22,    2,    2,   44,   44,   44,   92,    0,    0,    O,    O,    O,   GB,    B,    B,    O,
+      0,    2,    2,    2,    2,    2,   30,    0,    9,    2,    2,    2,   30,   45,   59,   20,
+     20,   31,   33,   32,   32,   25,  163,   29,  164,  165,   37,    0,    0,    0,    0,    0,
+      0,   12,   26,    0,    0,    0,    0,    0,    0,    2,    2,   65,   25,   20,   20,   20,
+     22,   23,  126,   15,   17,    0,    0,    0,    0,    2,    2,    2,    2,    2,    0,    0,
+    166,  167,    0,    0,    0,    0,    0,    0,    0,   18,   19,   20,   20,   66,   99,   25,
+    160,   11,  168,    9,    0,    0,    0,    0,    0,    2,    2,    2,    2,    2,    2,    2,
+     65,   25,   20,   20,    0,   48,   48,   11,  169,   37,    0,    0,    0,    0,    0,    0,
+      0,    0,    0,    0,    0,    2,    2,   20,    0,   23,   19,   20,   20,   21,   16,   82,
+    169,   38,    0,    0,    0,    0,    0,    0,    0,    2,    2,    2,    2,    2,   10,  170,
+     25,   20,   22,   22,  168,    9,    0,    0,    0,    2,    2,    2,    2,    2,    9,   43,
+    136,   23,   22,   20,   76,   21,   22,    0,    0,    2,    2,    2,    9,    0,    0,    0,
+      0,    2,    2,    2,    2,    2,    2,   18,   19,   20,   21,   22,  105,  169,   37,    0,
+      0,    2,    2,    2,    9,   30,    0,    2,    2,    2,    2,   30,    9,    2,    2,    2,
+      2,   23,   23,   18,   32,   33,   12,  171,  165,  172,  173,    0,    0,    0,    0,    0,
+      0,    2,    2,    2,    2,    0,    2,    2,    2,   65,   25,   20,   20,    0,   22,   23,
+     29,  108,    0,   33,    0,    0,    0,    0,    0,   52,   20,   22,   22,   22,  140,    2,
+      2,    2,  174,  175,   11,   15,  176,   61,  177,    0,    0,    1,  147,    0,    0,    0,
+      0,   52,   20,   22,   16,   19,   20,    2,    2,    2,    2,  158,  158,  158,  178,  178,
+    178,  178,  178,  178,   15,  179,    0,   30,    0,   22,   20,   20,   31,   22,   22,   11,
+    169,    0,   61,   61,   61,   61,   61,   61,   61,   66,   21,   82,   46,    0,    0,    0,
+      0,    2,    2,    2,    9,    2,   30,    2,    2,   52,   22,   22,   31,    0,   38,   22,
+     27,   11,  159,  180,  181,    0,    0,    0,    0,    2,    2,    2,   30,    9,    2,    2,
+      2,    2,    2,    2,    2,    2,   23,   23,   47,   22,   35,   82,   68,    0,    0,    0,
+      0,    2,  182,   66,   47,    0,    0,    0,    0,   11,  183,    2,    2,    2,    2,    2,
+      2,    2,    2,   23,   22,   20,   31,    0,   48,   16,  143,    0,    0,    0,    0,    0,
+      0,    2,    2,    2,    2,    2,  156,    0,    0,  184,  184,  184,  184,  184,  184,  184,
+    184,  185,  185,  185,  186,  187,  185,  184,  184,  188,  184,  184,  189,  190,  190,  190,
+    190,  190,  190,  190,    0,    0,    0,    0,    0,  184,  184,  184,  184,  184,  191,    0,
+      0,    2,    2,    2,    2,    2,    2,    2,   22,   22,   22,   22,   22,   22,  192,  193,
+    194,   11,   11,   11,   46,    0,    0,    0,    0,   29,   74,    2,    2,    2,    2,    2,
+      2,    2,    2,    2,    2,    2,   65,   47,    0,    2,    2,    2,    2,    2,    9,    0,
+     58,  195,   20,   20,   20,   20,   20,   20,   20,   20,   20,   20,   20,   20,   20,   20,
+     20,   20,   20,   20,   20,    0,    0,    0,   40,  116,   26,    0,    0,    0,    0,    0,
+      0,    0,    0,    9,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,
+     30,    2,    2,    2,    2,    2,    0,   58,   37,    0,    6,  120,  120,  120,  121,    0,
+      0,   11,   11,   11,   49,    2,    2,    2,    0,    2,    2,    2,    2,    2,    0,    0,
+      2,    2,    2,    2,    2,    2,    2,    2,   46,    2,    2,    2,    2,    2,    2,   11,
+     11,    2,    2,    2,    2,    2,    2,   22,   22,    2,    2,    2,    2,    2,    2,    2,
+     20,    2,    2,   44,   44,   44,   92,    0,    0,    O,    O,    O,   GB,    B,    B,    O,
      SB,    O,   SE,   GB,    O,    O,   WJ,FMPst,FMPst,    O,  CGJ,    B,    O,    B,VMAbv,VMAbv,
   VMAbv,    O,VMAbv,    B,CMBlw,CMBlw,CMBlw,VMAbv,VMPst, VAbv, VPst,CMBlw,    B, VPst, VPre, VPst,
    VBlw, VBlw, VBlw, VBlw, VAbv, VAbv, VAbv, VPst, VPst, VPst,    H, VPre, VPst,VMBlw,    O,    O,
@@ -290,20 +302,21 @@ hb_use_u8[3187] =
   FMAbv, FAbv,CMAbv,FMAbv,VMAbv,FMAbv, VAbv,   IS,FMAbv,    B,FMAbv,    B,  CGJ,   WJ,  CGJ,   GB,
   CMAbv,CMAbv,    B,   GB,    B, VAbv,  SUB, FPst, FPst,VMBlw, FPst, FPst, FBlw,VMAbv,FMBlw, VAbv,
    VPre,    B, MPre, MBlw,  SUB, FAbv, FAbv, MAbv,  SUB,   Sk, VPst, VAbv,VMAbv,VMAbv, FAbv,CMAbv,
-   VPst,    H,    B,    O,SMAbv,SMBlw,SMAbv,SMAbv,SMAbv, VPst,   IS, VBlw, FAbv,VMPre,VMPre,FMAbv,
+   VPst,    H,    B,    O,SMAbv,SMAbv,SMAbv, VPst,   IS,   RK,   RK, VBlw, FAbv,VMPre,VMPre,FMAbv,
   CMBlw,VMBlw,VMBlw,VMAbv,   CS,    O,FMAbv, ZWNJ,  CGJ,   WJ,   WJ,   WJ,    O,FMPst,    O,   SB,
      SE,    O,    H, MPst, VPst,    H,VMAbv, VAbv,VMBlw,    B, VBlw, FPst, VPst, FAbv,VMPst,    B,
   CMAbv, VAbv, MBlw, MPst, MBlw,    H,    O, VBlw, MPst, MPre, MAbv, MBlw,    O,    B, FAbv, FAbv,
    FPst, VBlw,    B,    B, VPre,    O,VMPst,   IS,    O,VMPst, VBlw, VPst,VMBlw,VMBlw,VMAbv,    O,
      IS,VMBlw,    B,VMPst,VMAbv,VMPst,   CS,   CS,    B,    N,    N,    O,   HN, VPre, VBlw, VAbv,
-     IS,CMAbv,    O, VPst,    B,    R,    R,CMBlw, VAbv, VPre,VMAbv,VMAbv,    H, VAbv,CMBlw,FMAbv,
-      B,   CS,   CS,    H,CMBlw,VMPst,    H,VMPst, VAbv,VMAbv, VPst,   IS,    R, MPst,    R, MPst,
-  CMBlw,    B,FMBlw, VBlw,VMAbv,    R, MBlw, MBlw,   GB, FBlw, FBlw,CMAbv,   IS, VBlw,   IS,   GB,
-   VAbv,    R,VMPst,    G,    G,    J,    J,    J,   SB,   SE,    J,   HR,    G,    G,   HM,   HM,
-     HM,    O, VBlw,
+     IS,CMAbv,    O, VPst,    B,    R,    R,CMBlw, VAbv, VPre,VMAbv,VMAbv,    H, VAbv,CMBlw,VMPst,
+      O,VMAbv,CMBlw,   IS,    R,FMAbv,    B,   CS,   CS,    H,CMBlw,VMPst,    H,VMPst, VAbv,VMAbv,
+   VPst, MPst,    R, MPst,CMBlw,    B,FMBlw, VBlw,VMAbv,   CS,  SUB,  SUB,   GB, FBlw, FBlw,CMAbv,
+     IS, VBlw,   IS,    R, MBlw,   GB, VAbv,    R,VMPst,    G,    G,    J,    J,    J,   SB,   SE,
+      J,   HR,    G,    G,   HM,   HM,   HM,    G,    O, MPre, MPre, MPst,VMAbv, MBlw, VBlw,    O,
+   VBlw,
 };
 static const uint16_t
-hb_use_u16[808] =
+hb_use_u16[856] =
 {
     0,  0,  1,  2,  0,  3,  0,  3,  0,  0,  4,  5,  0,  6,  0,  0,
     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  7,  0,  0,  0,
@@ -332,28 +345,31 @@ hb_use_u16[808] =
     0,  0,  0,  0,  0,  0,  0,164,  0,  0,  0,  0,  0,  0,  0,165,
     0,  0,  0,  0,  0,  0,  0,166,166,167, 34,168,  0,  0,  0,  0,
   169,170, 10,171, 95,  0,  0,  0,  0,  0,  0,  0, 70, 10,172,  0,
-   10,173,174,  0,  0,  0,  0,  0, 10, 10,175,  2,  0,  0,  0,  0,
-   10, 10,176,173,  0,  0,  0,  0,  0,  0,  0, 10,177,178,  0, 10,
-  179,  0,  0,180,181,  0,  0,  0,182, 10, 10,183,184,185,186,187,
-  188, 10, 10,189,190,  0,  0,  0,191, 10,192,193,194, 10, 10,195,
-  188, 10, 10,196,197,106,198,103, 10, 34,199,200,201,  0,  0,  0,
-  202,203, 95, 10, 10,204,205,  2,206, 21, 22,207,208,209,210,211,
-   10, 10, 10,212,213,214,215,  0,198, 10, 10,216,217,  2,  0,  0,
-   10, 10,218,219,220,221,  0,  0, 10, 10, 10,222,223,  2,  0,  0,
-   10, 10,224,225,  2,  0,  0,  0, 10,226,227,104,228,  0,  0,  0,
-   10, 10,229,230,  0,  0,  0,  0,231,232, 10,233,234,  2,  0,  0,
-    0,  0,235, 10, 10,236,237,  0,238, 10, 10,239,240,241, 10, 10,
-  242,243,  0,  0,  0,  0,  0,  0, 22, 10,218,244,  8, 10, 71, 19,
-   10,245, 74,246,  0,  0,  0,  0,247, 10, 10,248,249,  2,250, 10,
-  251,252,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 10,253,
-  254, 49, 10,255,256,  2,  0,  0,257,257,257,257,257,257,257,257,
-  257,257,257,258,259,260,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,
-   10, 10, 10,261,  0,  0,  0,  0, 10, 10, 10, 10,262,263,264,264,
-  265,266,  0,  0,  0,  0,267,  0, 10, 10, 10, 10, 10, 10, 10, 10,
-   10, 10, 10, 10, 10,268,  0,  0, 10, 10, 10, 10, 10, 10,106, 71,
-   95,269,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,270,
-   10, 10, 71,271,272,  0,  0,  0,  0, 10,273,  0, 10, 10,274,  2,
-    0,  0,  0,  0,  0, 10,275,  2, 10, 10, 10, 10,276,  2,  0,  0,
+   10,173,174,  0,  0,  0,  0,  0, 10, 10,175,  2,  9, 10,176, 10,
+  177,  0,  0,  0,  0,  0,  0,  0, 10, 10,178,173,  0,  0,  0,  0,
+    0,  0,  0, 10,179,180,  0, 10,181,  0,  0,182,183,  0,  0,  0,
+  184, 10, 10,185,186,187,188,189,190, 10, 10,191,192,  0,  0,  0,
+  193, 10,194,195,196, 10, 10,197,190, 10, 10,198,199,106,200,103,
+   10, 34,201,202,203,  0,  0,  0,204,205, 95, 10, 10,206,207,  2,
+  208, 21, 22,209,210,211,212,213,214, 10, 10,215,216,217,218,  0,
+   10, 10, 10,219,220,221,222,  0,200, 10, 10,223,224,  2,  0,  0,
+   10, 10,225,226,227,228,  0,  0, 10, 10, 10,229,230,  2,  0,  0,
+   10, 10,231,232,  2, 10,141,  0, 10,233,234,104,235,  0,  0,  0,
+   10, 10,236,237,  0,  0,  0,  0,238,239, 10,240,241,  2,  0,  0,
+    0,  0,242, 10, 10,243,244,  0,245, 10, 10,246,247,248, 10, 10,
+  249,250,  0,  0,  0,  0,  0,  0, 22, 10,225,251,  8, 10, 71, 19,
+   10,252, 74,253,  0,  0,  0,  0,254, 10, 10,255,256,  2,257, 10,
+  258,259,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 10,260,
+  261, 49, 10,262,263,264,  0,  0,265,265,265,265,265,265,265,265,
+  265,265,265,266,267,268,265,265,265,265,265,265,265,265,265,269,
+   10,270,271,  2,  0,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,
+   10, 10, 10,272,  0,  0,  0,  0,  0,  0,  0,  0,273, 10,274,  2,
+   10, 10, 10, 10,275,276,277,277,278,279,  0,  0,  0,  0,280,  0,
+   10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,177,  0,281,
+   10, 10, 10, 10, 10, 10,106, 71, 95,282,  0,  0,  0,  0,  0,  0,
+    0,  0,  0,  0,  0,  0,  0,283, 10, 10, 71,284,285,  0,  0,  0,
+    0, 10,286,  0, 10, 10,287,  2,  0,  0,  0,  0,  0, 10,288,  2,
+    0,  0,  0,  0,  0, 10,289,106, 10, 10, 10, 10,290,  2,  0,  0,
   130,130,130,130,130,130,130,130,163,163,163,163,163,163,163,163,
   163,163,163,163,163,163,163,130,
 };
@@ -366,23 +382,23 @@ hb_use_b4 (const uint8_t* a, unsigned i)
 static inline uint_fast8_t
 hb_use_get_category (unsigned u)
 {
-  return u<921600u?hb_use_u8[2809+(((hb_use_u8[593+(((hb_use_u16[((hb_use_u8[113+(((hb_use_b4(hb_use_u8,u>>1>>3>>3>>5))<<5)+((u>>1>>3>>3)&31u))])<<3)+((u>>1>>3)&7u)])<<3)+((u>>1)&7u))])<<1)+((u)&1u))]:O;
+  return u<921600u?hb_use_u8[2953+(((hb_use_u8[625+(((hb_use_u16[((hb_use_u8[113+(((hb_use_b4(hb_use_u8,u>>1>>3>>3>>5))<<5)+((u>>1>>3>>3)&31u))])<<3)+((u>>1>>3)&7u)])<<3)+((u>>1)&7u))])<<1)+((u)&1u))]:O;
 }
 
 
 #else
 
 static const uint8_t
-hb_use_u8[3483] =
+hb_use_u8[3657] =
 {
-     16,   50,   51,   51,   51,   52,   51,   83,  118,  131,   51,   57,   58,  179,  195,   61,
+     16,   50,   51,   51,   51,   52,   51,   83,  118,  131,   57,   58,   59,  195,  211,   62,
      51,   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,
      51,   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,
      51,   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,
      51,   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,
      51,   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,
      51,   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,   51,
-     14,    0,    1,    1,    2,    1,    1,    3,    4,    5,    6,    7,    8,    9,   10,    1,
+     15,    0,    1,    1,    2,    1,    1,    3,    4,    5,    6,    7,    8,    9,   10,    1,
      11,   12,    1,    1,    1,    1,    1,    1,   13,   14,   15,   16,   17,   18,   19,    1,
       1,   20,    1,    1,    1,    1,   21,    1,   22,    1,    1,    1,    1,    1,   23,   24,
       1,    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
@@ -390,14 +406,15 @@ hb_use_u8[3483] =
       1,    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,   29,
      30,    1,    1,    1,    1,    1,   31,    1,    1,    1,    1,   32,   33,    1,   34,   35,
      36,   37,   38,   39,   40,   41,   42,   43,   44,   45,   46,   47,    1,   48,   49,   50,
-     51,   52,   52,   52,   52,   53,    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-      1,    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,   54,   55,    1,    1,    1,
-     56,    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,   57,   58,    1,    1,
-      1,    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,   59,    1,    1,
-      1,    1,   60,    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-      1,    1,   61,   62,    1,   63,    1,    1,    1,    1,   64,    1,    1,    1,    1,    1,
-      1,   65,   66,   65,   65,   65,   65,   65,   65,   65,   65,   65,   65,   65,   65,   65,
-     65,    0,    1,    2,    2,    0,    3,    4,    0,    0,    0,    0,    0,    0,    0,    0,
+     51,   52,   52,   52,   52,   53,   52,   52,   52,   52,   52,   52,   52,   52,   52,   52,
+     52,   52,   52,   52,   54,    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+      1,    1,   55,    1,    1,    1,    1,    1,    1,    1,    1,   56,   57,    1,   58,    1,
+     59,    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,   60,   61,    1,    1,
+      1,    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,   62,    1,    1,
+      1,    1,   63,    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
+      1,    1,   64,   65,    1,   66,   67,    1,    1,    1,   68,    1,    1,    1,    1,    1,
+      1,   69,   70,   69,   69,   69,   69,   69,   69,   69,   69,   69,   69,   69,   69,   69,
+     69,    0,    1,    2,    2,    0,    3,    4,    0,    0,    0,    0,    0,    0,    0,    0,
       0,    0,    0,    5,    0,    0,    0,    0,    0,    0,    0,    6,    0,    0,    0,    0,
       0,    0,    0,    0,    0,    0,    0,    7,    8,    0,    0,    9,    0,    0,    0,    0,
       0,   10,   11,   12,   13,   14,   15,   16,   17,   18,   19,   20,   21,   22,   23,   24,
@@ -414,23 +431,25 @@ hb_use_u8[3483] =
     122,    0,    0,    0,    0,    0,    0,   56,  123,  124,    0,    0,    0,    0,    0,    0,
     125,    0,    0,    0,    0,    0,    0,    0,  126,    0,    0,    0,  127,  128,  129,    0,
       0,  130,  131,  132,    0,    0,    0,   51,  133,    0,    0,    0,    0,  134,  135,    0,
-      0,   56,  136,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,   56,  137,    0,
-      0,    0,  101,  138,  101,  139,  140,  141,    0,  142,  143,  144,  145,  146,  147,  148,
-      0,  149,  150,  151,  152,  146,  153,  154,  155,  156,  157,  158,    0,  159,  160,  161,
-    162,  163,  164,  165,  166,    0,    0,    0,    0,   56,  167,  168,  169,  170,  171,  172,
-      0,    0,    0,    0,    0,   56,  173,  174,    0,   56,  175,  176,    0,   56,  177,   67,
-      0,  178,  179,  180,    0,    0,    0,    0,    0,   56,  181,    0,    0,    0,    0,    0,
-      0,  182,  183,  184,    0,    0,  185,  186,  187,  188,  189,  190,   56,  191,    0,    0,
-      0,  192,  193,  194,  195,  196,  197,    0,    0,  198,  199,  200,  201,  202,   67,    0,
-      0,    0,    0,    0,    0,    0,    0,    0,  203,  204,  205,  206,    0,    0,    0,    0,
-      0,  207,  207,  207,  207,  207,  207,  207,  207,  207,  208,  209,    0,    0,    0,    0,
-      0,    0,    0,    0,    0,    0,    0,   67,    0,   56,  210,    0,    0,    0,    0,    0,
-      0,   56,   56,  211,  212,  213,    0,    0,  214,   56,   56,   56,   56,   56,   56,   56,
-     56,   56,   56,   56,   56,   56,   56,  215,    0,   56,   56,   56,  216,  217,    0,    0,
-      0,    0,    0,    0,  218,    0,    0,    0,    0,   56,  219,  220,    0,    0,    0,    0,
-      0,    0,    0,    0,    0,  101,  221,   56,  222,    0,    0,    0,    0,    0,    0,  101,
-    223,   56,   56,  224,    0,    0,    0,    0,    0,  225,  225,  225,  225,  225,  225,  225,
-    225,  226,  226,  226,  226,  226,  226,  226,  227,    0,    0,    0,    0,    0,    0,    0,
+      0,   56,  136,    7,  137,  138,    0,    0,    0,    0,    0,    0,    0,   56,  139,    0,
+      0,    0,  101,  140,  101,  141,  142,  143,    0,  144,  145,  146,  147,  148,  149,  150,
+      0,  151,  152,  153,  154,  148,  155,  156,  157,  158,  159,  160,    0,  161,  162,  163,
+    164,  165,  166,  167,  168,  169,  170,  171,  172,   56,  173,  174,  175,  176,  177,  178,
+      0,    0,    0,    0,    0,   56,  179,  180,    0,   56,  181,  182,    0,   56,  183,  184,
+    185,  186,  187,  188,    0,    0,    0,    0,    0,   56,  189,    0,    0,    0,    0,    0,
+      0,  190,  191,  192,    0,    0,  193,  194,  195,  196,  197,  198,   56,  199,    0,    0,
+      0,  200,  201,  202,  203,  204,  205,    0,    0,  206,  207,  208,  209,  210,   67,    0,
+      0,    0,    0,    0,    0,    0,    0,    0,  211,  212,  213,  214,    0,    0,    0,    0,
+      0,  215,  215,  215,  215,  215,  215,  215,  215,  215,  216,  217,  215,  215,  215,  215,
+    215,  215,  215,  215,  215,  215,  215,  215,  218,  219,  220,    0,    0,    0,    0,    0,
+      0,    0,    0,    0,    0,    0,    0,   67,    0,   56,  221,    0,    0,    0,    0,    0,
+      0,    0,    0,  222,  223,    0,    0,    0,    0,   56,   56,  224,  225,  226,    0,    0,
+    227,   56,   56,   56,   56,   56,   56,   56,   56,   56,   56,   56,   56,   56,   56,  228,
+    229,   56,   56,   56,  230,  231,    0,    0,    0,    0,    0,    0,  232,    0,    0,    0,
+      0,   56,  233,  234,    0,    0,    0,    0,    0,    0,    0,    0,    0,  101,  235,   56,
+    236,    0,    0,    0,    0,    0,    0,  101,  237,    0,    0,    0,    0,    0,    0,  101,
+    238,   56,   56,  239,    0,    0,    0,    0,    0,  240,  240,  240,  240,  240,  240,  240,
+    240,  241,  241,  241,  241,  241,  241,  241,  242,    0,    0,    0,    0,    0,    0,    0,
       0,    0,    0,    0,    0,    0,    0,    1,    0,    2,    2,    2,    2,    2,    0,    0,
       0,    0,    0,    0,    0,    0,    3,    4,    0,    5,    0,    0,    0,    0,    0,    6,
       0,    0,    7,    0,    0,    0,    0,    0,    0,    0,    0,    0,    1,    0,    0,    0,
@@ -460,7 +479,7 @@ hb_use_u8[3483] =
       0,   10,   29,   30,    2,    2,    2,    9,    2,    2,    2,   30,    2,    2,    0,   17,
      45,    0,    0,   35,   47,    0,    0,    0,    9,   50,   51,    0,    0,    0,    0,    0,
       0,   11,   29,    2,    2,    2,    2,    9,    2,    2,    2,    2,    2,    2,   52,   53,
-     23,   23,   19,   31,   48,   33,   48,   34,   54,    0,    0,    0,   35,    0,    0,    0,
+     23,   19,   20,   31,   48,   33,   48,   34,   54,    0,    0,    0,   35,    0,    0,    0,
      30,   12,   29,   30,    2,    2,    2,    2,    2,    2,    2,    2,    9,    0,    2,    2,
       2,    2,   30,    2,    2,    2,    2,   30,    0,    2,    2,    2,    9,    0,   55,    0,
      35,   23,   22,   31,   31,   18,   48,   48,   25,    0,   23,    0,    0,    0,    0,    0,
@@ -488,9 +507,9 @@ hb_use_u8[3483] =
      63,  104,   16,   45,   22,   59,   21,   80,   48,   48,   76,   11,   11,   11,  105,   46,
      40,   11,  106,   74,    2,    2,    2,    2,    2,    2,    2,  107,   22,   20,   20,   22,
      48,   48,   22,  108,    2,    2,    2,    9,    0,    0,    0,    0,    0,    0,  109,  110,
-    111,  111,  111,    0,    0,    0,    0,    0,    0,  106,   74,    2,    2,    2,    2,    2,
-      2,   60,   61,   59,   25,   22,  112,   61,    2,    2,    2,    2,  107,   22,   23,   45,
-     45,  102,   14,    0,    0,    0,    0,    0,    0,    2,    2,   61,   18,   48,   23,  113,
+    110,  110,  110,    0,    0,    0,    0,    0,    0,  106,   74,    2,    2,    2,    2,    2,
+      2,   60,   61,   59,   25,   22,  111,   61,    2,    2,    2,    2,  107,   22,   23,   45,
+     45,  102,  112,    0,    0,    0,    0,    0,    0,    2,    2,   61,   18,   48,   23,  113,
     102,  102,  102,  114,  115,    0,    0,    0,    0,    2,    2,    2,    2,    2,    0,   30,
       2,   11,   46,  116,  116,  116,   11,  116,  116,   15,  116,  116,  116,   26,    0,   40,
       0,    0,    0,  117,   51,   11,    5,    0,    0,    0,    0,    0,    0,    0,  118,    0,
@@ -518,7 +537,8 @@ hb_use_u8[3483] =
       0,  128,   20,   27,   31,    0,    0,  145,  146,    2,    2,   30,    2,   30,    2,    2,
       2,    2,    2,    2,    0,   14,   37,    0,  147,    2,    2,   13,   37,    0,   30,    2,
       2,    2,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,   30,    2,    2,
-      9,    2,    2,   11,   41,    0,    0,    0,    0,    2,    2,    2,    2,    2,   27,   38,
+      9,    2,    2,   11,   41,    0,    0,    0,    0,    2,    2,    2,    0,   27,   22,   22,
+     30,    2,    2,    2,    0,    0,    0,    0,    0,    2,    2,    2,    2,    2,   27,   38,
       0,    2,    2,    2,  116,  116,  116,  116,  116,  148,    2,    9,    0,    0,    0,    0,
       0,    2,   14,   14,    0,    0,    0,    0,    0,    9,    2,    2,    9,    2,    2,    2,
       2,   30,    2,    9,    0,   30,    2,    0,    0,  149,  150,  151,    2,    2,    2,    2,
@@ -536,39 +556,45 @@ hb_use_u8[3483] =
      10,   18,   19,   21,   22,  162,   31,    0,    0,   11,   11,   30,    2,    2,    2,    9,
      30,    9,    2,   30,    2,    2,   58,   17,   23,   16,   23,   47,   32,   33,   32,   34,
       0,    0,    0,    0,   35,    0,    0,    0,    2,    2,   23,    0,   11,   11,   11,   46,
-      0,   11,   11,   46,    0,    0,    0,    0,    0,    2,    2,   65,   25,   20,   20,   20,
-     22,   23,  126,   15,   17,    0,    0,    0,    0,    2,    2,    2,    2,    2,    0,    0,
-    163,  164,    0,    0,    0,    0,    0,    0,    0,   18,   19,   20,   20,   66,   99,   25,
-    160,   11,  165,    9,    0,    0,    0,    0,    0,    2,    2,    2,    2,    2,    2,    2,
-     65,   25,   20,   20,    0,   48,   48,   11,  166,   37,    0,    0,    0,    0,    0,    0,
-      0,    0,    0,    0,    0,    2,    2,   20,    0,   23,   19,   20,   20,   21,   16,   82,
-    166,   38,    0,    0,    0,    0,    0,    0,    0,    2,    2,    2,    2,    2,   10,  167,
-     25,   20,   22,   22,  165,    9,    0,    0,    0,    2,    2,    2,    2,    2,    9,   43,
-    136,   23,   22,   20,   76,   21,   22,    0,    0,    2,    2,    2,    9,    0,    0,    0,
-      0,    2,    2,    2,    2,    2,    2,   18,   19,   20,   21,   22,  105,  166,   37,    0,
-      0,    2,    2,    2,    9,   30,    0,    2,    2,    2,    2,   30,    9,    2,    2,    2,
-      2,   23,   23,   18,   32,   33,   12,  168,  169,  170,  171,    0,    0,    0,    0,    0,
-      0,    2,    2,    2,    2,    0,    2,    2,    2,   65,   25,   20,   20,    0,   22,   23,
-     29,  108,    0,   33,    0,    0,    0,    0,    0,   52,   20,   22,   22,   22,  140,    2,
-      2,    2,  172,  173,   11,   15,  174,   72,  175,    0,    0,    1,  147,    0,    0,    0,
-      0,   52,   20,   22,   16,   19,   20,    2,    2,    2,    2,  158,  158,  158,  176,  176,
-    176,  176,  176,  176,   15,  177,    0,   30,    0,   22,   20,   20,   31,   22,   22,   11,
-    166,    0,   61,   61,   61,   61,   61,   61,   61,   66,   21,   82,   46,    0,    0,    0,
-      0,    2,    2,    2,    9,    2,   30,    2,    2,   52,   22,   22,   31,    0,   38,   22,
-     27,   11,  159,  178,  174,    0,    0,    0,    0,    2,    2,    2,   30,    9,    2,    2,
-      2,    2,    2,    2,    2,    2,   23,   23,   47,   22,   35,   82,   68,    0,    0,    0,
-      0,    2,  179,   66,   47,    0,    0,    0,    0,   11,  180,    2,    2,    2,    2,    2,
-      2,    2,    2,   23,   22,   20,   31,    0,   48,   16,  143,    0,    0,    0,    0,    0,
-      0,  181,  181,  181,  181,  181,  181,  181,  181,  182,  182,  182,  183,  184,  182,  181,
-    181,  185,  181,  181,  186,  187,  187,  187,  187,  187,  187,  187,    0,    0,    0,    0,
-      0,   11,   11,   11,   46,    0,    0,    0,    0,    2,    2,    2,    2,    2,    9,    0,
-     58,  188,   20,   20,   20,   20,   20,   20,   20,   20,   20,   20,   20,   20,   20,   20,
-     20,   20,   20,   20,   20,    0,    0,    0,   40,  116,   26,    0,    0,    0,    0,    0,
-      0,    0,    0,    9,    0,    0,    0,    0,    0,    2,    2,    2,    0,    0,    0,    0,
-      0,    2,    2,    2,    2,    2,    0,   58,   37,    0,    6,  120,  120,  120,  121,    0,
-      0,   11,   11,   11,   49,    2,    2,    2,    0,    2,    2,    2,    2,    2,    0,    0,
-      2,    2,    2,    2,    2,    2,    2,    2,   46,    2,    2,    2,    2,    2,    2,   11,
-     11,    2,    2,    2,    2,    2,    2,   22,   22,    2,    2,   44,   44,   44,   92,    0,
+      0,   11,   11,   46,    0,    0,    0,    0,    0,    2,    2,    2,    2,    2,   30,    0,
+      9,    2,    2,    2,   30,   45,   59,   20,   20,   31,   33,   32,   32,   25,  163,   29,
+    164,  165,   37,    0,    0,    0,    0,    0,    0,   12,   26,    0,    0,    0,    0,    0,
+      0,    2,    2,   65,   25,   20,   20,   20,   22,   23,  126,   15,   17,    0,    0,    0,
+      0,    2,    2,    2,    2,    2,    0,    0,  166,  167,    0,    0,    0,    0,    0,    0,
+      0,   18,   19,   20,   20,   66,   99,   25,  160,   11,  168,    9,    0,    0,    0,    0,
+      0,    2,    2,    2,    2,    2,    2,    2,   65,   25,   20,   20,    0,   48,   48,   11,
+    169,   37,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    0,    2,    2,   20,
+      0,   23,   19,   20,   20,   21,   16,   82,  169,   38,    0,    0,    0,    0,    0,    0,
+      0,    2,    2,    2,    2,    2,   10,  170,   25,   20,   22,   22,  168,    9,    0,    0,
+      0,    2,    2,    2,    2,    2,    9,   43,  136,   23,   22,   20,   76,   21,   22,    0,
+      0,    2,    2,    2,    9,    0,    0,    0,    0,    2,    2,    2,    2,    2,    2,   18,
+     19,   20,   21,   22,  105,  169,   37,    0,    0,    2,    2,    2,    9,   30,    0,    2,
+      2,    2,    2,   30,    9,    2,    2,    2,    2,   23,   23,   18,   32,   33,   12,  171,
+    165,  172,  173,    0,    0,    0,    0,    0,    0,    2,    2,    2,    2,    0,    2,    2,
+      2,   65,   25,   20,   20,    0,   22,   23,   29,  108,    0,   33,    0,    0,    0,    0,
+      0,   52,   20,   22,   22,   22,  140,    2,    2,    2,  174,  175,   11,   15,  176,   61,
+    177,    0,    0,    1,  147,    0,    0,    0,    0,   52,   20,   22,   16,   19,   20,    2,
+      2,    2,    2,  158,  158,  158,  178,  178,  178,  178,  178,  178,   15,  179,    0,   30,
+      0,   22,   20,   20,   31,   22,   22,   11,  169,    0,   61,   61,   61,   61,   61,   61,
+     61,   66,   21,   82,   46,    0,    0,    0,    0,    2,    2,    2,    9,    2,   30,    2,
+      2,   52,   22,   22,   31,    0,   38,   22,   27,   11,  159,  180,  181,    0,    0,    0,
+      0,    2,    2,    2,   30,    9,    2,    2,    2,    2,    2,    2,    2,    2,   23,   23,
+     47,   22,   35,   82,   68,    0,    0,    0,    0,    2,  182,   66,   47,    0,    0,    0,
+      0,   11,  183,    2,    2,    2,    2,    2,    2,    2,    2,   23,   22,   20,   31,    0,
+     48,   16,  143,    0,    0,    0,    0,    0,    0,    2,    2,    2,    2,    2,  156,    0,
+      0,  184,  184,  184,  184,  184,  184,  184,  184,  185,  185,  185,  186,  187,  185,  184,
+    184,  188,  184,  184,  189,  190,  190,  190,  190,  190,  190,  190,    0,    0,    0,    0,
+      0,  184,  184,  184,  184,  184,  191,    0,    0,    2,    2,    2,    2,    2,    2,    2,
+     22,   22,   22,   22,   22,   22,  192,  193,  194,   11,   11,   11,   46,    0,    0,    0,
+      0,   29,   74,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,    2,   65,   47,
+      0,    2,    2,    2,    2,    2,    9,    0,   58,  195,   20,   20,   20,   20,   20,   20,
+     20,   20,   20,   20,   20,   20,   20,   20,   20,   20,   20,   20,   20,    0,    0,    0,
+     40,  116,   26,    0,    0,    0,    0,    0,    0,    0,    0,    9,    0,    0,    0,    0,
+      0,    0,    0,    0,    0,    0,    0,    0,   30,    2,    2,    2,    2,    2,    0,   58,
+     37,    0,    6,  120,  120,  120,  121,    0,    0,   11,   11,   11,   49,    2,    2,    2,
+      0,    2,    2,    2,    2,    2,    0,    0,    2,    2,    2,    2,    2,    2,    2,    2,
+     46,    2,    2,    2,    2,    2,    2,   11,   11,    2,    2,    2,    2,    2,    2,   22,
+     22,    2,    2,    2,    2,    2,    2,    2,   20,    2,    2,   44,   44,   44,   92,    0,
       0,    O,    O,    O,   GB,    B,    B,    O,   SB,    O,   SE,   GB,    O,    O,   WJ,FMPst,
   FMPst,    O,  CGJ,    B,    O,    B,VMAbv,VMAbv,VMAbv,    O,VMAbv,    B,CMBlw,CMBlw,CMBlw,VMAbv,
   VMPst, VAbv, VPst,CMBlw,    B, VPst, VPre, VPst, VBlw, VBlw, VBlw, VBlw, VAbv, VAbv, VAbv, VPst,
@@ -582,20 +608,21 @@ hb_use_u8[3483] =
   VMPst, VBlw, VPst,  CGJ,  CGJ, VPst,VMAbv,VMAbv,FMAbv, FAbv,CMAbv,FMAbv,VMAbv,FMAbv, VAbv,   IS,
   FMAbv,    B,FMAbv,    B,  CGJ,   WJ,  CGJ,   GB,CMAbv,CMAbv,    B,   GB,    B, VAbv,  SUB, FPst,
    FPst,VMBlw, FPst, FPst, FBlw,VMAbv,FMBlw, VAbv, VPre,    B, MPre, MBlw,  SUB, FAbv, FAbv, MAbv,
-    SUB,   Sk, VPst, VAbv,VMAbv,VMAbv, FAbv,CMAbv, VPst,    H,    B,    O,SMAbv,SMBlw,SMAbv,SMAbv,
-  SMAbv, VPst,   IS, VBlw, FAbv,VMPre,VMPre,FMAbv,CMBlw,VMBlw,VMBlw,VMAbv,   CS,    O,FMAbv, ZWNJ,
+    SUB,   Sk, VPst, VAbv,VMAbv,VMAbv, FAbv,CMAbv, VPst,    H,    B,    O,SMAbv,SMAbv,SMAbv, VPst,
+     IS,   RK,   RK, VBlw, FAbv,VMPre,VMPre,FMAbv,CMBlw,VMBlw,VMBlw,VMAbv,   CS,    O,FMAbv, ZWNJ,
     CGJ,   WJ,   WJ,   WJ,    O,FMPst,    O,   SB,   SE,    O,    H, MPst, VPst,    H,VMAbv, VAbv,
   VMBlw,    B, VBlw, FPst, VPst, FAbv,VMPst,    B,CMAbv, VAbv, MBlw, MPst, MBlw,    H,    O, VBlw,
    MPst, MPre, MAbv, MBlw,    O,    B, FAbv, FAbv, FPst, VBlw,    B,    B, VPre,    O,VMPst,   IS,
       O,VMPst, VBlw, VPst,VMBlw,VMBlw,VMAbv,    O,   IS,VMBlw,    B,VMPst,VMAbv,VMPst,   CS,   CS,
       B,    N,    N,    O,   HN, VPre, VBlw, VAbv,   IS,CMAbv,    O, VPst,    B,    R,    R,CMBlw,
-   VAbv, VPre,VMAbv,VMAbv,    H, VAbv,CMBlw,FMAbv,    B,   CS,   CS,    H,CMBlw,VMPst,    H,VMPst,
-   VAbv,VMAbv, VPst,   IS,    R, MPst,    R, MPst,CMBlw,    B,FMBlw, VBlw,VMAbv,    R, MBlw, MBlw,
-     GB, FBlw, FBlw,CMAbv,   IS, VBlw,   IS,   GB, VAbv,    R,VMPst,    G,    G,    J,    J,    J,
-     SB,   SE,    J,   HR,    G,    G,   HM,   HM,   HM,    O, VBlw,
+   VAbv, VPre,VMAbv,VMAbv,    H, VAbv,CMBlw,VMPst,    O,VMAbv,CMBlw,   IS,    R,FMAbv,    B,   CS,
+     CS,    H,CMBlw,VMPst,    H,VMPst, VAbv,VMAbv, VPst, MPst,    R, MPst,CMBlw,    B,FMBlw, VBlw,
+  VMAbv,   CS,  SUB,  SUB,   GB, FBlw, FBlw,CMAbv,   IS, VBlw,   IS,    R, MBlw,   GB, VAbv,    R,
+  VMPst,    G,    G,    J,    J,    J,   SB,   SE,    J,   HR,    G,    G,   HM,   HM,   HM,    G,
+      O, MPre, MPre, MPst,VMAbv, MBlw, VBlw,    O, VBlw,
 };
 static const uint16_t
-hb_use_u16[456] =
+hb_use_u16[486] =
 {
     0,  0,  1,  2,  0,  3,  4,  5,  0,  6,  7,  0,  8,  0,  9, 10,
    11, 12, 10, 13, 14, 10, 10, 15, 16, 17, 18, 19, 20, 21, 22, 23,
@@ -614,18 +641,20 @@ hb_use_u16[456] =
   148,149,150, 10, 10,151,152,  2,153, 99,154,155,156,  2, 10,157,
    10,158,159,  0,160,161,162,  2,163,  0,  0,164,  0,165,  0,166,
   166,167, 34,168,169,170, 10,171, 95,  0,172,  0, 10,173,174,  0,
-  175,  2,176,173,177,178,179,  0,  0,180,181,  0,182, 10, 10,183,
-  184,185,186,187,188, 10, 10,189,190,  0,191, 10,192,193,194, 10,
-   10,195, 10,196,197,106,198,103, 10, 34,199,200,201,  0,202,203,
-   95, 10, 10,204,205,  2,206, 21, 22,207,208,209,210,211, 10,212,
-  213,214,215,  0,198, 10, 10,216,217,  2,218,219,220,221, 10,222,
-  223,  2,224,225, 10,226,227,104,228,  0,229,230,231,232, 10,233,
-  234,  2,235, 10, 10,236,237,  0,238, 10, 10,239,240,241,242,243,
-   22, 10,218,244,  8, 10, 71, 19, 10,245, 74,246,247, 10, 10,248,
-  249,  2,250, 10,251,252, 10,253,254, 49, 10,255,256,  2,257,257,
-  257,258,259,260, 10,261,262,263,264,264,265,266,267,  0, 10,268,
-  106, 71, 95,269,  0,270, 71,271,272,  0,273,  0,274,  2,275,  2,
-  276,  2,130,130,163,163,163,130,
+  175,  2,176, 10,177,  0,178,173,179,180,181,  0,  0,182,183,  0,
+  184, 10, 10,185,186,187,188,189,190, 10, 10,191,192,  0,193, 10,
+  194,195,196, 10, 10,197, 10,198,199,106,200,103, 10, 34,201,202,
+  203,  0,204,205, 95, 10, 10,206,207,  2,208, 21, 22,209,210,211,
+  212,213,214, 10, 10,215,216,217,218,  0, 10,219,220,221,222,  0,
+  200, 10, 10,223,224,  2,225,226,227,228, 10,229,230,  2,231,232,
+    2, 10,141,  0, 10,233,234,104,235,  0,236,237,238,239, 10,240,
+  241,  2,242, 10, 10,243,244,  0,245, 10, 10,246,247,248,249,250,
+   22, 10,225,251,  8, 10, 71, 19, 10,252, 74,253,254, 10, 10,255,
+  256,  2,257, 10,258,259, 10,260,261, 49, 10,262,263,264,265,265,
+  265,266,267,268,265,269, 10,270,271,  2, 10,272,273, 10,274,  2,
+  275,276,277,277,278,279,280,  0, 10,177,  0,281,106, 71, 95,282,
+    0,283, 71,284,285,  0,286,  0,287,  2,288,  2,289,106,290,  2,
+  130,130,163,163,163,130,
 };
 
 static inline unsigned
@@ -636,7 +665,7 @@ hb_use_b4 (const uint8_t* a, unsigned i)
 static inline uint_fast8_t
 hb_use_get_category (unsigned u)
 {
-  return u<921600u?hb_use_u8[3105+(((hb_use_u8[889+(((hb_use_u16[((hb_use_u8[353+(((hb_use_u8[113+(((hb_use_b4(hb_use_u8,u>>1>>3>>1>>3>>4))<<4)+((u>>1>>3>>1>>3)&15u))])<<3)+((u>>1>>3>>1)&7u))])<<1)+((u>>1>>3)&1u)])<<3)+((u>>1)&7u))])<<1)+((u)&1u))]:O;
+  return u<921600u?hb_use_u8[3265+(((hb_use_u8[937+(((hb_use_u16[((hb_use_u8[369+(((hb_use_u8[113+(((hb_use_b4(hb_use_u8,u>>1>>3>>1>>3>>4))<<4)+((u>>1>>3>>1>>3)&15u))])<<3)+((u>>1>>3>>1)&7u))])<<1)+((u>>1>>3)&1u)])<<3)+((u>>1)&7u))])<<1)+((u)&1u))]:O;
 }
 
 #endif
@@ -656,6 +685,7 @@ hb_use_get_category (unsigned u)
 #undef N
 #undef O
 #undef R
+#undef RK
 #undef SB
 #undef SE
 #undef SUB
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-vowel-constraints.cc b/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-vowel-constraints.cc
index 35693254ec07..4a112e1c2897 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-vowel-constraints.cc
+++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper-vowel-constraints.cc
@@ -10,8 +10,8 @@
  * # Date: 2015-03-12, 21:17:00 GMT [AG]
  * # Date: 2019-11-08, 23:22:00 GMT [AG]
  *
- * # Scripts-15.1.0.txt
- * # Date: 2023-07-28, 16:01:07 GMT
+ * # Scripts-16.0.0.txt
+ * # Date: 2024-04-30, 21:48:40 GMT
  */
 
 #include "hb.hh"
@@ -24,7 +24,7 @@ static void
 _output_dotted_circle (hb_buffer_t *buffer)
 {
   (void) buffer->output_glyph (0x25CCu);
-  _hb_glyph_info_reset_continuation (&buffer->prev());
+  _hb_glyph_info_clear_continuation (&buffer->prev());
 }
 
 static void
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper.hh b/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper.hh
index 39a04ec2348e..48cd5296ffd0 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-shaper.hh
@@ -174,9 +174,11 @@ HB_OT_SHAPERS_IMPLEMENT_SHAPERS
 
 
 static inline const hb_ot_shaper_t *
-hb_ot_shaper_categorize (const hb_ot_shape_planner_t *planner)
+hb_ot_shaper_categorize (hb_script_t script,
+                         hb_direction_t direction,
+                         hb_tag_t gsub_script)
 {
-  switch ((hb_tag_t) planner->props.script)
+  switch ((hb_tag_t) script)
   {
     default:
       return &_hb_ot_shaper_default;
@@ -192,9 +194,8 @@ hb_ot_shaper_categorize (const hb_ot_shape_planner_t *planner)
        * This is because we do fallback shaping for Arabic script (and not others).
        * But note that Arabic shaping is applicable only to horizontal layout; for
        * vertical text, just use the generic shaper instead. */
-      if ((planner->map.chosen_script[0] != HB_OT_TAG_DEFAULT_SCRIPT ||
-           planner->props.script == HB_SCRIPT_ARABIC) &&
-          HB_DIRECTION_IS_HORIZONTAL(planner->props.direction))
+      if ((gsub_script != HB_OT_TAG_DEFAULT_SCRIPT || script == HB_SCRIPT_ARABIC) &&
+          HB_DIRECTION_IS_HORIZONTAL (direction))
         return &_hb_ot_shaper_arabic;
       else
         return &_hb_ot_shaper_default;
@@ -235,10 +236,10 @@ hb_ot_shaper_categorize (const hb_ot_shape_planner_t *planner)
        * Otherwise, use the specific shaper.
        *
        * If it's indy3 tag, send to USE. */
-      if (planner->map.chosen_script[0] == HB_TAG ('D','F','L','T') ||
-          planner->map.chosen_script[0] == HB_TAG ('l','a','t','n'))
+      if (gsub_script == HB_TAG ('D','F','L','T') ||
+          gsub_script == HB_TAG ('l','a','t','n'))
         return &_hb_ot_shaper_default;
-      else if ((planner->map.chosen_script[0] & 0x000000FF) == '3')
+      else if ((gsub_script & 0x000000FF) == '3')
         return &_hb_ot_shaper_use;
       else
         return &_hb_ot_shaper_indic;
@@ -254,9 +255,9 @@ hb_ot_shaper_categorize (const hb_ot_shape_planner_t *planner)
        * If designer designed for 'mymr' tag, also send to default
        * shaper.  That's tag used from before Myanmar shaping spec
        * was developed.  The shaping spec uses 'mym2' tag. */
-      if (planner->map.chosen_script[0] == HB_TAG ('D','F','L','T') ||
-          planner->map.chosen_script[0] == HB_TAG ('l','a','t','n') ||
-          planner->map.chosen_script[0] == HB_TAG ('m','y','m','r'))
+      if (gsub_script == HB_TAG ('D','F','L','T') ||
+          gsub_script == HB_TAG ('l','a','t','n') ||
+          gsub_script == HB_TAG ('m','y','m','r'))
         return &_hb_ot_shaper_default;
       else
         return &_hb_ot_shaper_myanmar;
@@ -386,13 +387,22 @@ hb_ot_shaper_categorize (const hb_ot_shape_planner_t *planner)
     case HB_SCRIPT_KAWI:
     case HB_SCRIPT_NAG_MUNDARI:
 
+    /* Unicode-16.0 additions */
+    case HB_SCRIPT_GARAY:
+    case HB_SCRIPT_GURUNG_KHEMA:
+    case HB_SCRIPT_KIRAT_RAI:
+    case HB_SCRIPT_OL_ONAL:
+    case HB_SCRIPT_SUNUWAR:
+    case HB_SCRIPT_TODHRI:
+    case HB_SCRIPT_TULU_TIGALARI:
+
       /* If the designer designed the font for the 'DFLT' script,
        * (or we ended up arbitrarily pick 'latn'), use the default shaper.
        * Otherwise, use the specific shaper.
        * Note that for some simple scripts, there may not be *any*
        * GSUB/GPOS needed, so there may be no scripts found! */
-      if (planner->map.chosen_script[0] == HB_TAG ('D','F','L','T') ||
-          planner->map.chosen_script[0] == HB_TAG ('l','a','t','n'))
+      if (gsub_script == HB_TAG ('D','F','L','T') ||
+          gsub_script == HB_TAG ('l','a','t','n'))
         return &_hb_ot_shaper_default;
       else
         return &_hb_ot_shaper_use;
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-stat-table.hh b/src/java.desktop/share/native/libharfbuzz/hb-ot-stat-table.hh
index 7f6b52d79775..10165f57b755 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-ot-stat-table.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-stat-table.hh
@@ -63,8 +63,9 @@ static bool axis_value_is_outside_axis_range (hb_tag_t axis_tag, float axis_valu
   if (!user_axes_location->has (axis_tag))
     return false;
 
+  double axis_value_double = static_cast(axis_value);
   Triple axis_range = user_axes_location->get (axis_tag);
-  return (axis_value < axis_range.minimum || axis_value > axis_range.maximum);
+  return (axis_value_double < axis_range.minimum || axis_value_double > axis_range.maximum);
 }
 
 struct StatAxisRecord
@@ -327,6 +328,7 @@ struct AxisValueFormat4
   {
     TRACE_SANITIZE (this);
     return_trace (likely (c->check_struct (this) &&
+                          hb_barrier () &&
                           axisValues.sanitize (c, axisCount)));
   }
 
@@ -348,15 +350,15 @@ struct AxisValueFormat4
 
 struct AxisValue
 {
-  bool get_value (unsigned int axis_index) const
+  float get_value (unsigned int axis_index) const
   {
     switch (u.format)
     {
-    case 1: return u.format1.get_value ();
-    case 2: return u.format2.get_value ();
-    case 3: return u.format3.get_value ();
-    case 4: return u.format4.get_axis_record (axis_index).get_value ();
-    default:return 0;
+    case 1: hb_barrier (); return u.format1.get_value ();
+    case 2: hb_barrier (); return u.format2.get_value ();
+    case 3: hb_barrier (); return u.format3.get_value ();
+    case 4: hb_barrier (); return u.format4.get_axis_record (axis_index).get_value ();
+    default:return 0.f;
     }
   }
 
@@ -364,9 +366,9 @@ struct AxisValue
   {
     switch (u.format)
     {
-    case 1: return u.format1.get_axis_index ();
-    case 2: return u.format2.get_axis_index ();
-    case 3: return u.format3.get_axis_index ();
+    case 1: hb_barrier (); return u.format1.get_axis_index ();
+    case 2: hb_barrier (); return u.format2.get_axis_index ();
+    case 3: hb_barrier (); return u.format3.get_axis_index ();
     /* case 4: Makes more sense for variable fonts which are handled by fvar in hb-style */
     default:return -1;
     }
@@ -376,10 +378,10 @@ struct AxisValue
   {
     switch (u.format)
     {
-    case 1: return u.format1.get_value_name_id ();
-    case 2: return u.format2.get_value_name_id ();
-    case 3: return u.format3.get_value_name_id ();
-    case 4: return u.format4.get_value_name_id ();
+    case 1: hb_barrier (); return u.format1.get_value_name_id ();
+    case 2: hb_barrier (); return u.format2.get_value_name_id ();
+    case 3: hb_barrier (); return u.format3.get_value_name_id ();
+    case 4: hb_barrier (); return u.format4.get_value_name_id ();
     default:return HB_OT_NAME_ID_INVALID;
     }
   }
@@ -390,10 +392,10 @@ struct AxisValue
     if (unlikely (!c->may_dispatch (this, &u.format))) return c->no_dispatch_return_value ();
     TRACE_DISPATCH (this, u.format);
     switch (u.format) {
-    case 1: return_trace (c->dispatch (u.format1, std::forward (ds)...));
-    case 2: return_trace (c->dispatch (u.format2, std::forward (ds)...));
-    case 3: return_trace (c->dispatch (u.format3, std::forward (ds)...));
-    case 4: return_trace (c->dispatch (u.format4, std::forward (ds)...));
+    case 1: hb_barrier (); return_trace (c->dispatch (u.format1, std::forward (ds)...));
+    case 2: hb_barrier (); return_trace (c->dispatch (u.format2, std::forward (ds)...));
+    case 3: hb_barrier (); return_trace (c->dispatch (u.format3, std::forward (ds)...));
+    case 4: hb_barrier (); return_trace (c->dispatch (u.format4, std::forward (ds)...));
     default:return_trace (c->default_return_value ());
     }
   }
@@ -403,10 +405,10 @@ struct AxisValue
   {
     switch (u.format)
     {
-    case 1: return u.format1.keep_axis_value (axis_records, user_axes_location);
-    case 2: return u.format2.keep_axis_value (axis_records, user_axes_location);
-    case 3: return u.format3.keep_axis_value (axis_records, user_axes_location);
-    case 4: return u.format4.keep_axis_value (axis_records, user_axes_location);
+    case 1: hb_barrier (); return u.format1.keep_axis_value (axis_records, user_axes_location);
+    case 2: hb_barrier (); return u.format2.keep_axis_value (axis_records, user_axes_location);
+    case 3: hb_barrier (); return u.format3.keep_axis_value (axis_records, user_axes_location);
+    case 4: hb_barrier (); return u.format4.keep_axis_value (axis_records, user_axes_location);
     default:return false;
     }
   }
@@ -416,13 +418,14 @@ struct AxisValue
     TRACE_SANITIZE (this);
     if (unlikely (!c->check_struct (this)))
       return_trace (false);
+    hb_barrier ();
 
     switch (u.format)
     {
-    case 1: return_trace (u.format1.sanitize (c));
-    case 2: return_trace (u.format2.sanitize (c));
-    case 3: return_trace (u.format3.sanitize (c));
-    case 4: return_trace (u.format4.sanitize (c));
+    case 1: hb_barrier (); return_trace (u.format1.sanitize (c));
+    case 2: hb_barrier (); return_trace (u.format2.sanitize (c));
+    case 3: hb_barrier (); return_trace (u.format3.sanitize (c));
+    case 4: hb_barrier (); return_trace (u.format4.sanitize (c));
     default:return_trace (true);
     }
   }
@@ -483,7 +486,7 @@ struct STAT
     hb_array_t> axis_values = get_axis_value_offsets ();
     for (unsigned int i = 0; i < axis_values.length; i++)
     {
-      const AxisValue& axis_value = this+axis_values[i];
+      const AxisValue& axis_value = this+offsetToAxisValueOffsets+axis_values[i];
       if (axis_value.get_axis_index () == axis_index)
       {
         if (value)
@@ -560,6 +563,7 @@ struct STAT
   {
     TRACE_SANITIZE (this);
     return_trace (likely (c->check_struct (this) &&
+                          hb_barrier () &&
                           version.major == 1 &&
                           version.minor > 0 &&
                           designAxesOffset.sanitize (c, this, designAxisCount) &&
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-tag-table.hh b/src/java.desktop/share/native/libharfbuzz/hb-ot-tag-table.hh
index 8ee42e638e02..50ddf5f69672 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-ot-tag-table.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-tag-table.hh
@@ -6,8 +6,8 @@
  *
  * on files with these headers:
  *
- * 
- * File-Date: 2023-08-02
+ * 
+ * File-Date: 2025-01-21
  */
 
 #ifndef HB_OT_TAG_TABLE_HH
@@ -26,12 +26,12 @@ static const LangTag ot_languages2[] = {
   {HB_TAG('a','y',' ',' '),     HB_TAG('A','Y','M',' ')},       /* Aymara [macrolanguage] */
   {HB_TAG('a','z',' ',' '),     HB_TAG('A','Z','E',' ')},       /* Azerbaijani [macrolanguage] */
   {HB_TAG('b','a',' ',' '),     HB_TAG('B','S','H',' ')},       /* Bashkir */
-  {HB_TAG('b','e',' ',' '),     HB_TAG('B','E','L',' ')},       /* Belarusian -> Belarussian */
+  {HB_TAG('b','e',' ',' '),     HB_TAG('B','E','L',' ')},       /* Belarusian */
   {HB_TAG('b','g',' ',' '),     HB_TAG('B','G','R',' ')},       /* Bulgarian */
   {HB_TAG('b','i',' ',' '),     HB_TAG('B','I','S',' ')},       /* Bislama */
   {HB_TAG('b','i',' ',' '),     HB_TAG('C','P','P',' ')},       /* Bislama -> Creoles */
   {HB_TAG('b','m',' ',' '),     HB_TAG('B','M','B',' ')},       /* Bambara (Bamanankan) */
-  {HB_TAG('b','n',' ',' '),     HB_TAG('B','E','N',' ')},       /* Bengali */
+  {HB_TAG('b','n',' ',' '),     HB_TAG('B','E','N',' ')},       /* Bangla */
   {HB_TAG('b','o',' ',' '),     HB_TAG('T','I','B',' ')},       /* Tibetan */
   {HB_TAG('b','r',' ',' '),     HB_TAG('B','R','E',' ')},       /* Breton */
   {HB_TAG('b','s',' ',' '),     HB_TAG('B','O','S',' ')},       /* Bosnian */
@@ -64,7 +64,8 @@ static const LangTag ot_languages2[] = {
   {HB_TAG('f','r',' ',' '),     HB_TAG('F','R','A',' ')},       /* French */
   {HB_TAG('f','y',' ',' '),     HB_TAG('F','R','I',' ')},       /* Western Frisian -> Frisian */
   {HB_TAG('g','a',' ',' '),     HB_TAG('I','R','I',' ')},       /* Irish */
-  {HB_TAG('g','d',' ',' '),     HB_TAG('G','A','E',' ')},       /* Scottish Gaelic (Gaelic) */
+  {HB_TAG('g','a',' ',' '),     HB_TAG('I','R','T',' ')},       /* Irish -> Irish Traditional */
+  {HB_TAG('g','d',' ',' '),     HB_TAG('G','A','E',' ')},       /* Scottish Gaelic */
   {HB_TAG('g','l',' ',' '),     HB_TAG('G','A','L',' ')},       /* Galician */
   {HB_TAG('g','n',' ',' '),     HB_TAG('G','U','A',' ')},       /* Guarani [macrolanguage] */
   {HB_TAG('g','u',' ',' '),     HB_TAG('G','U','J',' ')},       /* Gujarati */
@@ -153,7 +154,7 @@ static const LangTag ot_languages2[] = {
   {HB_TAG('o','c',' ',' '),     HB_TAG('O','C','I',' ')},       /* Occitan (post 1500) */
   {HB_TAG('o','j',' ',' '),     HB_TAG('O','J','B',' ')},       /* Ojibwa [macrolanguage] -> Ojibway */
   {HB_TAG('o','m',' ',' '),     HB_TAG('O','R','O',' ')},       /* Oromo [macrolanguage] */
-  {HB_TAG('o','r',' ',' '),     HB_TAG('O','R','I',' ')},       /* Odia (formerly Oriya) [macrolanguage] */
+  {HB_TAG('o','r',' ',' '),     HB_TAG('O','R','I',' ')},       /* Odia [macrolanguage] */
   {HB_TAG('o','s',' ',' '),     HB_TAG('O','S','S',' ')},       /* Ossetian */
   {HB_TAG('p','a',' ',' '),     HB_TAG('P','A','N',' ')},       /* Punjabi */
   {HB_TAG('p','i',' ',' '),     HB_TAG('P','A','L',' ')},       /* Pali */
@@ -166,7 +167,7 @@ static const LangTag ot_languages2[] = {
   {HB_TAG('r','o',' ',' '),     HB_TAG('R','O','M',' ')},       /* Romanian */
   {HB_TAG('r','u',' ',' '),     HB_TAG('R','U','S',' ')},       /* Russian */
   {HB_TAG('r','w',' ',' '),     HB_TAG('R','U','A',' ')},       /* Kinyarwanda */
-  {HB_TAG('s','a',' ',' '),     HB_TAG('S','A','N',' ')},       /* Sanskrit */
+  {HB_TAG('s','a',' ',' '),     HB_TAG('S','A','N',' ')},       /* Sanskrit [macrolanguage] */
   {HB_TAG('s','c',' ',' '),     HB_TAG('S','R','D',' ')},       /* Sardinian [macrolanguage] */
   {HB_TAG('s','d',' ',' '),     HB_TAG('S','N','D',' ')},       /* Sindhi */
   {HB_TAG('s','e',' ',' '),     HB_TAG('N','S','M',' ')},       /* Northern Sami */
@@ -223,6 +224,7 @@ static const LangTag ot_languages2[] = {
 static const LangTag ot_languages3[] = {
   {HB_TAG('a','a','e',' '),     HB_TAG('S','Q','I',' ')},       /* Arbëreshë Albanian -> Albanian */
   {HB_TAG('a','a','o',' '),     HB_TAG('A','R','A',' ')},       /* Algerian Saharan Arabic -> Arabic */
+/*{HB_TAG('a','a','q',' '),     HB_TAG('A','A','Q',' ')},*/     /* Eastern Abnaki -> Eastern Abenaki */
   {HB_TAG('a','a','t',' '),     HB_TAG('S','Q','I',' ')},       /* Arvanitika Albanian -> Albanian */
   {HB_TAG('a','b','a',' '),     HB_TAG_NONE            },       /* Abé != Abaza */
   {HB_TAG('a','b','h',' '),     HB_TAG('A','R','A',' ')},       /* Tajiki Arabic -> Arabic */
@@ -238,6 +240,7 @@ static const LangTag ot_languages3[] = {
   {HB_TAG('a','c','r',' '),     HB_TAG('M','Y','N',' ')},       /* Achi -> Mayan */
   {HB_TAG('a','c','w',' '),     HB_TAG('A','R','A',' ')},       /* Hijazi Arabic -> Arabic */
   {HB_TAG('a','c','x',' '),     HB_TAG('A','R','A',' ')},       /* Omani Arabic -> Arabic */
+  {HB_TAG('a','c','y',' '),     HB_TAG('A','C','Y',' ')},       /* Cypriot Arabic */
   {HB_TAG('a','c','y',' '),     HB_TAG('A','R','A',' ')},       /* Cypriot Arabic -> Arabic */
   {HB_TAG('a','d','a',' '),     HB_TAG('D','N','G',' ')},       /* Adangme -> Dangme */
   {HB_TAG('a','d','f',' '),     HB_TAG('A','R','A',' ')},       /* Dhofari Arabic -> Arabic */
@@ -288,6 +291,7 @@ static const LangTag ot_languages3[] = {
 /*{HB_TAG('a','s','t',' '),     HB_TAG('A','S','T',' ')},*/     /* Asturian */
 /*{HB_TAG('a','t','h',' '),     HB_TAG('A','T','H',' ')},*/     /* Athapascan [collection] -> Athapaskan */
   {HB_TAG('a','t','j',' '),     HB_TAG('R','C','R',' ')},       /* Atikamekw -> R-Cree */
+/*{HB_TAG('a','t','s',' '),     HB_TAG('A','T','S',' ')},*/     /* Gros Ventre (Atsina) */
   {HB_TAG('a','t','v',' '),     HB_TAG('A','L','T',' ')},       /* Northern Altai -> Altai */
   {HB_TAG('a','u','j',' '),     HB_TAG('B','B','R',' ')},       /* Awjilah -> Berber */
   {HB_TAG('a','u','z',' '),     HB_TAG('A','R','A',' ')},       /* Uzbeki Arabic -> Arabic */
@@ -326,6 +330,7 @@ static const LangTag ot_languages3[] = {
   {HB_TAG('b','c','l',' '),     HB_TAG('B','I','K',' ')},       /* Central Bikol -> Bikol */
   {HB_TAG('b','c','q',' '),     HB_TAG('B','C','H',' ')},       /* Bench */
   {HB_TAG('b','c','r',' '),     HB_TAG('A','T','H',' ')},       /* Babine -> Athapaskan */
+/*{HB_TAG('b','d','c',' '),     HB_TAG('B','D','C',' ')},*/     /* Emberá-Baudó */
 /*{HB_TAG('b','d','y',' '),     HB_TAG('B','D','Y',' ')},*/     /* Bandjalang */
   {HB_TAG('b','e','a',' '),     HB_TAG('A','T','H',' ')},       /* Beaver -> Athapaskan */
   {HB_TAG('b','e','b',' '),     HB_TAG('B','T','I',' ')},       /* Bebele -> Beti */
@@ -421,6 +426,8 @@ static const LangTag ot_languages3[] = {
   {HB_TAG('c','a','f',' '),     HB_TAG('A','T','H',' ')},       /* Southern Carrier -> Athapaskan */
   {HB_TAG('c','a','k',' '),     HB_TAG('C','A','K',' ')},       /* Kaqchikel */
   {HB_TAG('c','a','k',' '),     HB_TAG('M','Y','N',' ')},       /* Kaqchikel -> Mayan */
+/*{HB_TAG('c','a','y',' '),     HB_TAG('C','A','Y',' ')},*/     /* Cayuga */
+/*{HB_TAG('c','b','g',' '),     HB_TAG('C','B','G',' ')},*/     /* Chimila */
   {HB_TAG('c','b','k',' '),     HB_TAG('C','B','K',' ')},       /* Chavacano -> Zamboanga Chavacano */
   {HB_TAG('c','b','k',' '),     HB_TAG('C','P','P',' ')},       /* Chavacano -> Creoles */
   {HB_TAG('c','b','l',' '),     HB_TAG('Q','I','N',' ')},       /* Bualkhaw Chin -> Chin */
@@ -465,7 +472,9 @@ static const LangTag ot_languages3[] = {
   {HB_TAG('c','l','d',' '),     HB_TAG('S','Y','R',' ')},       /* Chaldean Neo-Aramaic -> Syriac */
   {HB_TAG('c','l','e',' '),     HB_TAG('C','C','H','N')},       /* Lealao Chinantec -> Chinantec */
   {HB_TAG('c','l','j',' '),     HB_TAG('Q','I','N',' ')},       /* Laitu Chin -> Chin */
+  {HB_TAG('c','l','s',' '),     HB_TAG('S','A','N',' ')},       /* Classical Sanskrit -> Sanskrit */
   {HB_TAG('c','l','t',' '),     HB_TAG('Q','I','N',' ')},       /* Lautu Chin -> Chin */
+/*{HB_TAG('c','m','i',' '),     HB_TAG('C','M','I',' ')},*/     /* Emberá-Chamí */
   {HB_TAG('c','m','n',' '),     HB_TAG('Z','H','S',' ')},       /* Mandarin Chinese -> Chinese, Simplified */
   {HB_TAG('c','m','r',' '),     HB_TAG('Q','I','N',' ')},       /* Mro-Khimi Chin -> Chin */
   {HB_TAG('c','n','b',' '),     HB_TAG('Q','I','N',' ')},       /* Chinbon Chin -> Chin */
@@ -479,6 +488,7 @@ static const LangTag ot_languages3[] = {
   {HB_TAG('c','n','w',' '),     HB_TAG('Q','I','N',' ')},       /* Ngawn Chin -> Chin */
   {HB_TAG('c','o','a',' '),     HB_TAG('M','L','Y',' ')},       /* Cocos Islands Malay -> Malay */
   {HB_TAG('c','o','b',' '),     HB_TAG('M','Y','N',' ')},       /* Chicomuceltec -> Mayan */
+/*{HB_TAG('c','o','o',' '),     HB_TAG('C','O','O',' ')},*/     /* Comox */
 /*{HB_TAG('c','o','p',' '),     HB_TAG('C','O','P',' ')},*/     /* Coptic */
   {HB_TAG('c','o','q',' '),     HB_TAG('A','T','H',' ')},       /* Coquille -> Athapaskan */
   {HB_TAG('c','p','a',' '),     HB_TAG('C','C','H','N')},       /* Palantla Chinantec -> Chinantec */
@@ -528,6 +538,7 @@ static const LangTag ot_languages3[] = {
 /*{HB_TAG('c','t','g',' '),     HB_TAG('C','T','G',' ')},*/     /* Chittagonian */
   {HB_TAG('c','t','h',' '),     HB_TAG('Q','I','N',' ')},       /* Thaiphum Chin -> Chin */
   {HB_TAG('c','t','l',' '),     HB_TAG('C','C','H','N')},       /* Tlacoatzintepec Chinantec -> Chinantec */
+/*{HB_TAG('c','t','o',' '),     HB_TAG('C','T','O',' ')},*/     /* Emberá-Catío */
   {HB_TAG('c','t','s',' '),     HB_TAG('B','I','K',' ')},       /* Northern Catanduanes Bikol -> Bikol */
 /*{HB_TAG('c','t','t',' '),     HB_TAG('C','T','T',' ')},*/     /* Wayanad Chetti */
   {HB_TAG('c','t','u',' '),     HB_TAG('M','Y','N',' ')},       /* Chol -> Mayan */
@@ -551,7 +562,7 @@ static const LangTag ot_languages3[] = {
   {HB_TAG('d','e','p',' '),     HB_TAG('C','P','P',' ')},       /* Pidgin Delaware -> Creoles */
   {HB_TAG('d','g','o',' '),     HB_TAG('D','G','O',' ')},       /* Dogri (individual language) */
   {HB_TAG('d','g','o',' '),     HB_TAG('D','G','R',' ')},       /* Dogri (macrolanguage) */
-  {HB_TAG('d','g','r',' '),     HB_TAG('A','T','H',' ')},       /* Dogrib -> Athapaskan */
+  {HB_TAG('d','g','r',' '),     HB_TAG('A','T','H',' ')},       /* Tlicho -> Athapaskan */
   {HB_TAG('d','h','d',' '),     HB_TAG('M','A','W',' ')},       /* Dhundari -> Marwari */
 /*{HB_TAG('d','h','g',' '),     HB_TAG('D','H','G',' ')},*/     /* Dhangu */
   {HB_TAG('d','h','v',' '),     HB_TAG_NONE            },       /* Dehu != Divehi (Dhivehi, Maldivian) (deprecated) */
@@ -590,6 +601,7 @@ static const LangTag ot_languages3[] = {
   {HB_TAG('e','k','y',' '),     HB_TAG('K','R','N',' ')},       /* Eastern Kayah -> Karen */
   {HB_TAG('e','m','k',' '),     HB_TAG('E','M','K',' ')},       /* Eastern Maninkakan */
   {HB_TAG('e','m','k',' '),     HB_TAG('M','N','K',' ')},       /* Eastern Maninkakan -> Maninka */
+/*{HB_TAG('e','m','p',' '),     HB_TAG('E','M','P',' ')},*/     /* Northern Emberá */
   {HB_TAG('e','m','y',' '),     HB_TAG('M','Y','N',' ')},       /* Epigraphic Mayan -> Mayan */
   {HB_TAG('e','n','b',' '),     HB_TAG('K','A','L',' ')},       /* Markweeta -> Kalenjin */
   {HB_TAG('e','n','f',' '),     HB_TAG('F','N','E',' ')},       /* Forest Enets */
@@ -637,7 +649,7 @@ static const LangTag ot_languages3[] = {
   {HB_TAG('g','a','a',' '),     HB_TAG('G','A','D',' ')},       /* Ga */
   {HB_TAG('g','a','c',' '),     HB_TAG('C','P','P',' ')},       /* Mixed Great Andamanese -> Creoles */
   {HB_TAG('g','a','d',' '),     HB_TAG_NONE            },       /* Gaddang != Ga */
-  {HB_TAG('g','a','e',' '),     HB_TAG_NONE            },       /* Guarequena != Scottish Gaelic (Gaelic) */
+  {HB_TAG('g','a','e',' '),     HB_TAG_NONE            },       /* Guarequena != Scottish Gaelic */
 /*{HB_TAG('g','a','g',' '),     HB_TAG('G','A','G',' ')},*/     /* Gagauz */
   {HB_TAG('g','a','l',' '),     HB_TAG_NONE            },       /* Galolen != Galician */
   {HB_TAG('g','a','n',' '),     HB_TAG('Z','H','S',' ')},       /* Gan Chinese -> Chinese, Simplified */
@@ -654,6 +666,7 @@ static const LangTag ot_languages3[] = {
 /*{HB_TAG('g','e','z',' '),     HB_TAG('G','E','Z',' ')},*/     /* Geez */
   {HB_TAG('g','g','o',' '),     HB_TAG('G','O','N',' ')},       /* Southern Gondi (retired code) -> Gondi */
   {HB_TAG('g','h','a',' '),     HB_TAG('B','B','R',' ')},       /* Ghadamès -> Berber */
+  {HB_TAG('g','h','c',' '),     HB_TAG('I','R','T',' ')},       /* Hiberno-Scottish Gaelic -> Irish Traditional */
   {HB_TAG('g','h','k',' '),     HB_TAG('K','R','N',' ')},       /* Geko Karen -> Karen */
   {HB_TAG('g','h','o',' '),     HB_TAG('B','B','R',' ')},       /* Ghomara -> Berber */
   {HB_TAG('g','i','b',' '),     HB_TAG('C','P','P',' ')},       /* Gibanawa -> Creoles */
@@ -732,6 +745,7 @@ static const LangTag ot_languages3[] = {
 /*{HB_TAG('h','n','d',' '),     HB_TAG('H','N','D',' ')},*/     /* Southern Hindko -> Hindko */
   {HB_TAG('h','n','e',' '),     HB_TAG('C','H','H',' ')},       /* Chhattisgarhi -> Chattisgarhi */
   {HB_TAG('h','n','j',' '),     HB_TAG('H','M','N',' ')},       /* Hmong Njua -> Hmong */
+  {HB_TAG('h','n','m',' '),     HB_TAG('Z','H','S',' ')},       /* Hainanese -> Chinese, Simplified */
   {HB_TAG('h','n','o',' '),     HB_TAG('H','N','D',' ')},       /* Northern Hindko -> Hindko */
   {HB_TAG('h','o','c',' '),     HB_TAG('H','O',' ',' ')},       /* Ho */
   {HB_TAG('h','o','i',' '),     HB_TAG('A','T','H',' ')},       /* Holikachuk -> Athapaskan */
@@ -743,6 +757,7 @@ static const LangTag ot_languages3[] = {
   {HB_TAG('h','s','n',' '),     HB_TAG('Z','H','S',' ')},       /* Xiang Chinese -> Chinese, Simplified */
   {HB_TAG('h','u','j',' '),     HB_TAG('H','M','N',' ')},       /* Northern Guiyang Hmong -> Hmong */
   {HB_TAG('h','u','p',' '),     HB_TAG('A','T','H',' ')},       /* Hupa -> Athapaskan */
+/*{HB_TAG('h','u','r',' '),     HB_TAG('H','U','R',' ')},*/     /* Halkomelem */
   {HB_TAG('h','u','s',' '),     HB_TAG('M','Y','N',' ')},       /* Huastec -> Mayan */
   {HB_TAG('h','w','c',' '),     HB_TAG('C','P','P',' ')},       /* Hawai'i Creole English -> Creoles */
   {HB_TAG('h','y','w',' '),     HB_TAG('H','Y','E',' ')},       /* Western Armenian -> Armenian */
@@ -780,6 +795,7 @@ static const LangTag ot_languages3[] = {
   {HB_TAG('j','b','n',' '),     HB_TAG('B','B','R',' ')},       /* Nafusi -> Berber */
 /*{HB_TAG('j','b','o',' '),     HB_TAG('J','B','O',' ')},*/     /* Lojban */
 /*{HB_TAG('j','c','t',' '),     HB_TAG('J','C','T',' ')},*/     /* Krymchak */
+/*{HB_TAG('j','d','t',' '),     HB_TAG('J','D','T',' ')},*/     /* Judeo-Tat */
   {HB_TAG('j','g','o',' '),     HB_TAG('B','M','L',' ')},       /* Ngomba -> Bamileke */
   {HB_TAG('j','i','i',' '),     HB_TAG_NONE            },       /* Jiiddu != Yiddish */
   {HB_TAG('j','k','m',' '),     HB_TAG('K','R','N',' ')},       /* Mobwa Karen -> Karen */
@@ -794,6 +810,7 @@ static const LangTag ot_languages3[] = {
   {HB_TAG('k','a','m',' '),     HB_TAG('K','M','B',' ')},       /* Kamba (Kenya) */
   {HB_TAG('k','a','r',' '),     HB_TAG('K','R','N',' ')},       /* Karen [collection] */
 /*{HB_TAG('k','a','w',' '),     HB_TAG('K','A','W',' ')},*/     /* Kawi (Old Javanese) */
+/*{HB_TAG('k','b','c',' '),     HB_TAG('K','B','C',' ')},*/     /* Kadiwéu */
   {HB_TAG('k','b','d',' '),     HB_TAG('K','A','B',' ')},       /* Kabardian */
   {HB_TAG('k','b','y',' '),     HB_TAG('K','N','R',' ')},       /* Manga Kanuri -> Kanuri */
   {HB_TAG('k','c','a',' '),     HB_TAG('K','H','K',' ')},       /* Khanty -> Khanty-Kazim */
@@ -814,6 +831,7 @@ static const LangTag ot_languages3[] = {
   {HB_TAG('k','f','x',' '),     HB_TAG('K','U','L',' ')},       /* Kullu Pahari -> Kulvi */
   {HB_TAG('k','f','y',' '),     HB_TAG('K','M','N',' ')},       /* Kumaoni */
   {HB_TAG('k','g','e',' '),     HB_TAG_NONE            },       /* Komering != Khutsuri Georgian */
+/*{HB_TAG('k','g','f',' '),     HB_TAG('K','G','F',' ')},*/     /* Kube */
   {HB_TAG('k','h','a',' '),     HB_TAG('K','S','I',' ')},       /* Khasi */
   {HB_TAG('k','h','b',' '),     HB_TAG('X','B','D',' ')},       /* Lü */
   {HB_TAG('k','h','k',' '),     HB_TAG('M','N','G',' ')},       /* Halh Mongolian -> Mongolian */
@@ -829,6 +847,7 @@ static const LangTag ot_languages3[] = {
   {HB_TAG('k','j','b',' '),     HB_TAG('M','Y','N',' ')},       /* Q'anjob'al -> Mayan */
 /*{HB_TAG('k','j','d',' '),     HB_TAG('K','J','D',' ')},*/     /* Southern Kiwai */
   {HB_TAG('k','j','h',' '),     HB_TAG('K','H','A',' ')},       /* Khakas -> Khakass */
+/*{HB_TAG('k','j','j',' '),     HB_TAG('K','J','J',' ')},*/     /* Khinalugh -> Khinalug */
   {HB_TAG('k','j','p',' '),     HB_TAG('K','J','P',' ')},       /* Pwo Eastern Karen -> Eastern Pwo Karen */
   {HB_TAG('k','j','p',' '),     HB_TAG('K','R','N',' ')},       /* Pwo Eastern Karen -> Karen */
   {HB_TAG('k','j','t',' '),     HB_TAG('K','R','N',' ')},       /* Phrae Pwo Karen -> Karen */
@@ -838,6 +857,7 @@ static const LangTag ot_languages3[] = {
   {HB_TAG('k','l','m',' '),     HB_TAG_NONE            },       /* Migum != Kalmyk */
   {HB_TAG('k','l','n',' '),     HB_TAG('K','A','L',' ')},       /* Kalenjin [macrolanguage] */
   {HB_TAG('k','m','b',' '),     HB_TAG('M','B','N',' ')},       /* Kimbundu -> Mbundu */
+/*{HB_TAG('k','m','g',' '),     HB_TAG('K','M','G',' ')},*/     /* Kâte */
   {HB_TAG('k','m','n',' '),     HB_TAG_NONE            },       /* Awtuw != Kumaoni */
   {HB_TAG('k','m','o',' '),     HB_TAG_NONE            },       /* Kwoma != Komo */
   {HB_TAG('k','m','r',' '),     HB_TAG('K','U','R',' ')},       /* Northern Kurdish -> Kurdish */
@@ -881,6 +901,7 @@ static const LangTag ot_languages3[] = {
   {HB_TAG('k','s','i',' '),     HB_TAG_NONE            },       /* Krisa != Khasi */
   {HB_TAG('k','s','m',' '),     HB_TAG_NONE            },       /* Kumba != Kildin Sami */
   {HB_TAG('k','s','s',' '),     HB_TAG('K','I','S',' ')},       /* Southern Kisi -> Kisii */
+/*{HB_TAG('k','s','u',' '),     HB_TAG('K','S','U',' ')},*/     /* Khamyang */
   {HB_TAG('k','s','w',' '),     HB_TAG('K','S','W',' ')},       /* S’gaw Karen */
   {HB_TAG('k','s','w',' '),     HB_TAG('K','R','N',' ')},       /* S'gaw Karen -> Karen */
   {HB_TAG('k','t','b',' '),     HB_TAG('K','E','B',' ')},       /* Kambaata -> Kebena */
@@ -894,6 +915,7 @@ static const LangTag ot_languages3[] = {
   {HB_TAG('k','u','y',' '),     HB_TAG_NONE            },       /* Kuuku-Ya'u != Kuy */
   {HB_TAG('k','v','b',' '),     HB_TAG('M','L','Y',' ')},       /* Kubu -> Malay */
   {HB_TAG('k','v','l',' '),     HB_TAG('K','R','N',' ')},       /* Kayaw -> Karen */
+  {HB_TAG('k','v','q',' '),     HB_TAG('K','V','Q',' ')},       /* Geba Karen */
   {HB_TAG('k','v','q',' '),     HB_TAG('K','R','N',' ')},       /* Geba Karen -> Karen */
   {HB_TAG('k','v','r',' '),     HB_TAG('M','L','Y',' ')},       /* Kerinci -> Malay */
   {HB_TAG('k','v','t',' '),     HB_TAG('K','R','N',' ')},       /* Lahta Karen -> Karen */
@@ -930,6 +952,7 @@ static const LangTag ot_languages3[] = {
 /*{HB_TAG('l','i','j',' '),     HB_TAG('L','I','J',' ')},*/     /* Ligurian */
   {HB_TAG('l','i','r',' '),     HB_TAG('C','P','P',' ')},       /* Liberian English -> Creoles */
 /*{HB_TAG('l','i','s',' '),     HB_TAG('L','I','S',' ')},*/     /* Lisu */
+/*{HB_TAG('l','i','v',' '),     HB_TAG('L','I','V',' ')},*/     /* Liv */
   {HB_TAG('l','i','w',' '),     HB_TAG('M','L','Y',' ')},       /* Col -> Malay */
   {HB_TAG('l','i','y',' '),     HB_TAG('B','A','D','0')},       /* Banda-Bambari -> Banda */
 /*{HB_TAG('l','j','p',' '),     HB_TAG('L','J','P',' ')},*/     /* Lampung Api -> Lampung */
@@ -959,9 +982,11 @@ static const LangTag ot_languages3[] = {
   {HB_TAG('l','t','o',' '),     HB_TAG('L','U','H',' ')},       /* Tsotso -> Luyia */
   {HB_TAG('l','t','s',' '),     HB_TAG('L','U','H',' ')},       /* Tachoni -> Luyia */
 /*{HB_TAG('l','u','a',' '),     HB_TAG('L','U','A',' ')},*/     /* Luba-Lulua */
+  {HB_TAG('l','u','h',' '),     HB_TAG('Z','H','S',' ')},       /* Leizhou Chinese -> Chinese, Simplified */
 /*{HB_TAG('l','u','o',' '),     HB_TAG('L','U','O',' ')},*/     /* Luo (Kenya and Tanzania) */
   {HB_TAG('l','u','s',' '),     HB_TAG('M','I','Z',' ')},       /* Lushai -> Mizo */
   {HB_TAG('l','u','s',' '),     HB_TAG('Q','I','N',' ')},       /* Lushai -> Chin */
+/*{HB_TAG('l','u','t',' '),     HB_TAG('L','U','T',' ')},*/     /* Lushootseed */
   {HB_TAG('l','u','y',' '),     HB_TAG('L','U','H',' ')},       /* Luyia [macrolanguage] */
   {HB_TAG('l','u','z',' '),     HB_TAG('L','R','C',' ')},       /* Southern Luri -> Luri */
   {HB_TAG('l','v','i',' '),     HB_TAG_NONE            },       /* Lavi != Latvian */
@@ -995,12 +1020,14 @@ static const LangTag ot_languages3[] = {
   {HB_TAG('m','e','n',' '),     HB_TAG('M','D','E',' ')},       /* Mende (Sierra Leone) */
   {HB_TAG('m','e','o',' '),     HB_TAG('M','L','Y',' ')},       /* Kedah Malay -> Malay */
 /*{HB_TAG('m','e','r',' '),     HB_TAG('M','E','R',' ')},*/     /* Meru */
+/*{HB_TAG('m','e','v',' '),     HB_TAG('M','E','V',' ')},*/     /* Mano */
   {HB_TAG('m','f','a',' '),     HB_TAG('M','F','A',' ')},       /* Pattani Malay */
   {HB_TAG('m','f','a',' '),     HB_TAG('M','L','Y',' ')},       /* Pattani Malay -> Malay */
   {HB_TAG('m','f','b',' '),     HB_TAG('M','L','Y',' ')},       /* Bangka -> Malay */
   {HB_TAG('m','f','e',' '),     HB_TAG('M','F','E',' ')},       /* Morisyen */
   {HB_TAG('m','f','e',' '),     HB_TAG('C','P','P',' ')},       /* Morisyen -> Creoles */
   {HB_TAG('m','f','p',' '),     HB_TAG('C','P','P',' ')},       /* Makassar Malay -> Creoles */
+  {HB_TAG('m','g','a',' '),     HB_TAG('S','G','A',' ')},       /* Middle Irish (900-1200) -> Old Irish */
   {HB_TAG('m','h','c',' '),     HB_TAG('M','Y','N',' ')},       /* Mocho -> Mayan */
   {HB_TAG('m','h','r',' '),     HB_TAG('L','M','A',' ')},       /* Eastern Mari -> Low Mari */
   {HB_TAG('m','h','v',' '),     HB_TAG('A','R','K',' ')},       /* Arakanese (retired code) -> Rakhine */
@@ -1126,6 +1153,7 @@ static const LangTag ot_languages3[] = {
   {HB_TAG('n','o','d',' '),     HB_TAG('N','T','A',' ')},       /* Northern Thai -> Northern Tai */
 /*{HB_TAG('n','o','e',' '),     HB_TAG('N','O','E',' ')},*/     /* Nimadi */
 /*{HB_TAG('n','o','g',' '),     HB_TAG('N','O','G',' ')},*/     /* Nogai */
+/*{HB_TAG('n','o','p',' '),     HB_TAG('N','O','P',' ')},*/     /* Numanggang */
 /*{HB_TAG('n','o','v',' '),     HB_TAG('N','O','V',' ')},*/     /* Novial */
   {HB_TAG('n','p','i',' '),     HB_TAG('N','E','P',' ')},       /* Nepali */
   {HB_TAG('n','p','l',' '),     HB_TAG('N','A','H',' ')},       /* Southeastern Puebla Nahuatl -> Nahuatl */
@@ -1136,6 +1164,7 @@ static const LangTag ot_languages3[] = {
   {HB_TAG('n','s','u',' '),     HB_TAG('N','A','H',' ')},       /* Sierra Negra Nahuatl -> Nahuatl */
   {HB_TAG('n','t','o',' '),     HB_TAG_NONE            },       /* Ntomba != Esperanto */
   {HB_TAG('n','u','e',' '),     HB_TAG('B','A','D','0')},       /* Ngundu -> Banda */
+/*{HB_TAG('n','u','k',' '),     HB_TAG('N','U','K',' ')},*/     /* Nuu-chah-nulth */
   {HB_TAG('n','u','u',' '),     HB_TAG('B','A','D','0')},       /* Ngbundu -> Banda */
   {HB_TAG('n','u','z',' '),     HB_TAG('N','A','H',' ')},       /* Tlamacazapa Nahuatl -> Nahuatl */
   {HB_TAG('n','w','e',' '),     HB_TAG('B','M','L',' ')},       /* Ngwe -> Bamileke */
@@ -1153,6 +1182,8 @@ static const LangTag ot_languages3[] = {
   {HB_TAG('o','k','i',' '),     HB_TAG('K','A','L',' ')},       /* Okiek -> Kalenjin */
   {HB_TAG('o','k','m',' '),     HB_TAG('K','O','H',' ')},       /* Middle Korean (10th-16th cent.) -> Korean Old Hangul */
   {HB_TAG('o','k','r',' '),     HB_TAG('I','J','O',' ')},       /* Kirike -> Ijo */
+/*{HB_TAG('o','n','e',' '),     HB_TAG('O','N','E',' ')},*/     /* Oneida */
+/*{HB_TAG('o','n','o',' '),     HB_TAG('O','N','O',' ')},*/     /* Onondaga */
   {HB_TAG('o','n','x',' '),     HB_TAG('C','P','P',' ')},       /* Onin Based Pidgin -> Creoles */
   {HB_TAG('o','o','r',' '),     HB_TAG('C','P','P',' ')},       /* Oorlams -> Creoles */
   {HB_TAG('o','r','c',' '),     HB_TAG('O','R','O',' ')},       /* Orma -> Oromo */
@@ -1160,7 +1191,7 @@ static const LangTag ot_languages3[] = {
   {HB_TAG('o','r','o',' '),     HB_TAG_NONE            },       /* Orokolo != Oromo */
   {HB_TAG('o','r','r',' '),     HB_TAG('I','J','O',' ')},       /* Oruma -> Ijo */
   {HB_TAG('o','r','s',' '),     HB_TAG('M','L','Y',' ')},       /* Orang Seletar -> Malay */
-  {HB_TAG('o','r','y',' '),     HB_TAG('O','R','I',' ')},       /* Odia (formerly Oriya) */
+  {HB_TAG('o','r','y',' '),     HB_TAG('O','R','I',' ')},       /* Odia */
   {HB_TAG('o','t','w',' '),     HB_TAG('O','J','B',' ')},       /* Ottawa -> Ojibway */
   {HB_TAG('o','u','a',' '),     HB_TAG('B','B','R',' ')},       /* Tagargrent -> Berber */
   {HB_TAG('p','a','a',' '),     HB_TAG_NONE            },       /* Papuan [collection] != Palestinian Aramaic */
@@ -1193,7 +1224,7 @@ static const LangTag ot_languages3[] = {
   {HB_TAG('p','i','s',' '),     HB_TAG('C','P','P',' ')},       /* Pijin -> Creoles */
   {HB_TAG('p','k','h',' '),     HB_TAG('Q','I','N',' ')},       /* Pankhu -> Chin */
   {HB_TAG('p','k','o',' '),     HB_TAG('K','A','L',' ')},       /* Pökoot -> Kalenjin */
-  {HB_TAG('p','l','g',' '),     HB_TAG_NONE            },       /* Pilagá != Palaung */
+  {HB_TAG('p','l','g',' '),     HB_TAG('P','L','G','0')},       /* Pilagá */
   {HB_TAG('p','l','k',' '),     HB_TAG_NONE            },       /* Kohistani Shina != Polish */
   {HB_TAG('p','l','l',' '),     HB_TAG('P','L','G',' ')},       /* Shwe Palaung -> Palaung */
   {HB_TAG('p','l','n',' '),     HB_TAG('C','P','P',' ')},       /* Palenquero -> Creoles */
@@ -1353,6 +1384,7 @@ static const LangTag ot_languages3[] = {
   {HB_TAG('s','d','h',' '),     HB_TAG('K','U','R',' ')},       /* Southern Kurdish -> Kurdish */
   {HB_TAG('s','d','n',' '),     HB_TAG('S','R','D',' ')},       /* Gallurese Sardinian -> Sardinian */
   {HB_TAG('s','d','s',' '),     HB_TAG('B','B','R',' ')},       /* Sened -> Berber */
+/*{HB_TAG('s','e','e',' '),     HB_TAG('S','E','E',' ')},*/     /* Seneca */
   {HB_TAG('s','e','h',' '),     HB_TAG('S','N','A',' ')},       /* Sena */
   {HB_TAG('s','e','k',' '),     HB_TAG('A','T','H',' ')},       /* Sekani -> Athapaskan */
 /*{HB_TAG('s','e','l',' '),     HB_TAG('S','E','L',' ')},*/     /* Selkup */
@@ -1374,9 +1406,13 @@ static const LangTag ot_languages3[] = {
 /*{HB_TAG('s','i','d',' '),     HB_TAG('S','I','D',' ')},*/     /* Sidamo */
   {HB_TAG('s','i','g',' '),     HB_TAG_NONE            },       /* Paasaal != Silte Gurage */
   {HB_TAG('s','i','z',' '),     HB_TAG('B','B','R',' ')},       /* Siwi -> Berber */
+/*{HB_TAG('s','j','a',' '),     HB_TAG('S','J','A',' ')},*/     /* Epena */
+  {HB_TAG('s','j','c',' '),     HB_TAG('Z','H','S',' ')},       /* Shaojiang Chinese -> Chinese, Simplified */
   {HB_TAG('s','j','d',' '),     HB_TAG('K','S','M',' ')},       /* Kildin Sami */
+/*{HB_TAG('s','j','e',' '),     HB_TAG('S','J','E',' ')},*/     /* Pite Sami */
   {HB_TAG('s','j','o',' '),     HB_TAG('S','I','B',' ')},       /* Xibe -> Sibe */
   {HB_TAG('s','j','s',' '),     HB_TAG('B','B','R',' ')},       /* Senhaja De Srair -> Berber */
+/*{HB_TAG('s','j','u',' '),     HB_TAG('S','J','U',' ')},*/     /* Ume Sami */
   {HB_TAG('s','k','g',' '),     HB_TAG('M','L','G',' ')},       /* Sakalava Malagasy -> Malagasy */
   {HB_TAG('s','k','r',' '),     HB_TAG('S','R','K',' ')},       /* Saraiki */
   {HB_TAG('s','k','s',' '),     HB_TAG_NONE            },       /* Maia != Skolt Sami */
@@ -1395,7 +1431,7 @@ static const LangTag ot_languages3[] = {
 /*{HB_TAG('s','n','k',' '),     HB_TAG('S','N','K',' ')},*/     /* Soninke */
   {HB_TAG('s','o','g',' '),     HB_TAG_NONE            },       /* Sogdian != Sodo Gurage */
 /*{HB_TAG('s','o','p',' '),     HB_TAG('S','O','P',' ')},*/     /* Songe */
-  {HB_TAG('s','p','v',' '),     HB_TAG('O','R','I',' ')},       /* Sambalpuri -> Odia (formerly Oriya) */
+  {HB_TAG('s','p','v',' '),     HB_TAG('O','R','I',' ')},       /* Sambalpuri -> Odia */
   {HB_TAG('s','p','y',' '),     HB_TAG('K','A','L',' ')},       /* Sabaot -> Kalenjin */
   {HB_TAG('s','r','b',' '),     HB_TAG_NONE            },       /* Sora != Serbian */
   {HB_TAG('s','r','c',' '),     HB_TAG('S','R','D',' ')},       /* Logudorese Sardinian -> Sardinian */
@@ -1410,6 +1446,7 @@ static const LangTag ot_languages3[] = {
   {HB_TAG('s','s','m',' '),     HB_TAG_NONE            },       /* Semnam != Southern Sami */
   {HB_TAG('s','t','a',' '),     HB_TAG('C','P','P',' ')},       /* Settla -> Creoles */
 /*{HB_TAG('s','t','q',' '),     HB_TAG('S','T','Q',' ')},*/     /* Saterfriesisch -> Saterland Frisian */
+/*{HB_TAG('s','t','r',' '),     HB_TAG('S','T','R',' ')},*/     /* Straits Salish */
   {HB_TAG('s','t','v',' '),     HB_TAG('S','I','G',' ')},       /* Silt'e -> Silte Gurage */
 /*{HB_TAG('s','u','k',' '),     HB_TAG('S','U','K',' ')},*/     /* Sukuma */
   {HB_TAG('s','u','q',' '),     HB_TAG('S','U','R',' ')},       /* Suri */
@@ -1431,10 +1468,12 @@ static const LangTag ot_languages3[] = {
   {HB_TAG('t','a','a',' '),     HB_TAG('A','T','H',' ')},       /* Lower Tanana -> Athapaskan */
 /*{HB_TAG('t','a','b',' '),     HB_TAG('T','A','B',' ')},*/     /* Tabassaran -> Tabasaran */
   {HB_TAG('t','a','j',' '),     HB_TAG_NONE            },       /* Eastern Tamang != Tajiki */
+  {HB_TAG('t','a','q',' '),     HB_TAG('T','A','Q',' ')},       /* Tamasheq */
   {HB_TAG('t','a','q',' '),     HB_TAG('T','M','H',' ')},       /* Tamasheq -> Tamashek */
   {HB_TAG('t','a','q',' '),     HB_TAG('B','B','R',' ')},       /* Tamasheq -> Berber */
   {HB_TAG('t','a','s',' '),     HB_TAG('C','P','P',' ')},       /* Tay Boi -> Creoles */
   {HB_TAG('t','a','u',' '),     HB_TAG('A','T','H',' ')},       /* Upper Tanana -> Athapaskan */
+/*{HB_TAG('t','b','v',' '),     HB_TAG('T','B','V',' ')},*/     /* Tobo */
   {HB_TAG('t','c','b',' '),     HB_TAG('A','T','H',' ')},       /* Tanacross -> Athapaskan */
   {HB_TAG('t','c','e',' '),     HB_TAG('A','T','H',' ')},       /* Southern Tutchone -> Athapaskan */
   {HB_TAG('t','c','h',' '),     HB_TAG('C','P','P',' ')},       /* Turks And Caicos Creole English -> Creoles */
@@ -1442,6 +1481,7 @@ static const LangTag ot_languages3[] = {
   {HB_TAG('t','c','s',' '),     HB_TAG('C','P','P',' ')},       /* Torres Strait Creole -> Creoles */
   {HB_TAG('t','c','y',' '),     HB_TAG('T','U','L',' ')},       /* Tulu */
   {HB_TAG('t','c','z',' '),     HB_TAG('Q','I','N',' ')},       /* Thado Chin -> Chin */
+/*{HB_TAG('t','d','c',' '),     HB_TAG('T','D','C',' ')},*/     /* Emberá-Tadó */
 /*{HB_TAG('t','d','d',' '),     HB_TAG('T','D','D',' ')},*/     /* Tai Nüa -> Dehong Dai */
   {HB_TAG('t','d','x',' '),     HB_TAG('M','L','G',' ')},       /* Tandroy-Mahafaly Malagasy -> Malagasy */
   {HB_TAG('t','e','c',' '),     HB_TAG('K','A','L',' ')},       /* Terik -> Kalenjin */
@@ -1455,9 +1495,12 @@ static const LangTag ot_languages3[] = {
   {HB_TAG('t','g','r',' '),     HB_TAG_NONE            },       /* Tareng != Tigre */
   {HB_TAG('t','g','x',' '),     HB_TAG('A','T','H',' ')},       /* Tagish -> Athapaskan */
   {HB_TAG('t','g','y',' '),     HB_TAG_NONE            },       /* Togoyo != Tigrinya */
+/*{HB_TAG('t','h','p',' '),     HB_TAG('T','H','P',' ')},*/     /* Thompson */
   {HB_TAG('t','h','t',' '),     HB_TAG('A','T','H',' ')},       /* Tahltan -> Athapaskan */
+  {HB_TAG('t','h','v',' '),     HB_TAG('T','H','V',' ')},       /* Tahaggart Tamahaq */
   {HB_TAG('t','h','v',' '),     HB_TAG('T','M','H',' ')},       /* Tahaggart Tamahaq -> Tamashek */
   {HB_TAG('t','h','v',' '),     HB_TAG('B','B','R',' ')},       /* Tahaggart Tamahaq -> Berber */
+  {HB_TAG('t','h','z',' '),     HB_TAG('T','H','Z',' ')},       /* Tayart Tamajeq */
   {HB_TAG('t','h','z',' '),     HB_TAG('T','M','H',' ')},       /* Tayart Tamajeq -> Tamashek */
   {HB_TAG('t','h','z',' '),     HB_TAG('B','B','R',' ')},       /* Tayart Tamajeq -> Berber */
   {HB_TAG('t','i','a',' '),     HB_TAG('B','B','R',' ')},       /* Tidikelt Tamazight -> Berber */
@@ -1468,6 +1511,7 @@ static const LangTag ot_languages3[] = {
   {HB_TAG('t','k','g',' '),     HB_TAG('M','L','G',' ')},       /* Tesaka Malagasy -> Malagasy */
   {HB_TAG('t','k','m',' '),     HB_TAG_NONE            },       /* Takelma != Turkmen */
 /*{HB_TAG('t','l','i',' '),     HB_TAG('T','L','I',' ')},*/     /* Tlingit */
+/*{HB_TAG('t','l','y',' '),     HB_TAG('T','L','Y',' ')},*/     /* Talysh */
   {HB_TAG('t','m','g',' '),     HB_TAG('C','P','P',' ')},       /* Ternateño -> Creoles */
   {HB_TAG('t','m','h',' '),     HB_TAG('T','M','H',' ')},       /* Tamashek [macrolanguage] */
   {HB_TAG('t','m','h',' '),     HB_TAG('B','B','R',' ')},       /* Tamashek [macrolanguage] -> Berber */
@@ -1493,11 +1537,13 @@ static const LangTag ot_languages3[] = {
 /*{HB_TAG('t','s','j',' '),     HB_TAG('T','S','J',' ')},*/     /* Tshangla */
   {HB_TAG('t','t','c',' '),     HB_TAG('M','Y','N',' ')},       /* Tektiteko -> Mayan */
   {HB_TAG('t','t','m',' '),     HB_TAG('A','T','H',' ')},       /* Northern Tutchone -> Athapaskan */
+  {HB_TAG('t','t','q',' '),     HB_TAG('T','T','Q',' ')},       /* Tawallammat Tamajaq */
   {HB_TAG('t','t','q',' '),     HB_TAG('T','M','H',' ')},       /* Tawallammat Tamajaq -> Tamashek */
   {HB_TAG('t','t','q',' '),     HB_TAG('B','B','R',' ')},       /* Tawallammat Tamajaq -> Berber */
   {HB_TAG('t','u','a',' '),     HB_TAG_NONE            },       /* Wiarumus != Turoyo Aramaic */
   {HB_TAG('t','u','l',' '),     HB_TAG_NONE            },       /* Tula != Tulu */
 /*{HB_TAG('t','u','m',' '),     HB_TAG('T','U','M',' ')},*/     /* Tumbuka */
+/*{HB_TAG('t','u','s',' '),     HB_TAG('T','U','S',' ')},*/     /* Tuscarora */
   {HB_TAG('t','u','u',' '),     HB_TAG('A','T','H',' ')},       /* Tututni -> Athapaskan */
   {HB_TAG('t','u','v',' '),     HB_TAG_NONE            },       /* Turkana != Tuvin */
   {HB_TAG('t','u','y',' '),     HB_TAG('K','A','L',' ')},       /* Tugen -> Kalenjin */
@@ -1514,6 +1560,7 @@ static const LangTag ot_languages3[] = {
   {HB_TAG('t','z','o',' '),     HB_TAG('T','Z','O',' ')},       /* Tzotzil */
   {HB_TAG('t','z','o',' '),     HB_TAG('M','Y','N',' ')},       /* Tzotzil -> Mayan */
   {HB_TAG('u','b','l',' '),     HB_TAG('B','I','K',' ')},       /* Buhi'non Bikol -> Bikol */
+/*{HB_TAG('u','d','i',' '),     HB_TAG('U','D','I',' ')},*/     /* Udi */
 /*{HB_TAG('u','d','m',' '),     HB_TAG('U','D','M',' ')},*/     /* Udmurt */
   {HB_TAG('u','k','i',' '),     HB_TAG('K','U','I',' ')},       /* Kui (India) */
   {HB_TAG('u','l','n',' '),     HB_TAG('C','P','P',' ')},       /* Unserdeutsch -> Creoles */
@@ -1532,13 +1579,17 @@ static const LangTag ot_languages3[] = {
   {HB_TAG('v','k','t',' '),     HB_TAG('M','L','Y',' ')},       /* Tenggarong Kutai Malay -> Malay */
   {HB_TAG('v','l','s',' '),     HB_TAG('F','L','E',' ')},       /* Vlaams -> Dutch (Flemish) */
   {HB_TAG('v','m','w',' '),     HB_TAG('M','A','K',' ')},       /* Makhuwa */
-/*{HB_TAG('v','r','o',' '),     HB_TAG('V','R','O',' ')},*/     /* Võro */
+  {HB_TAG('v','r','o',' '),     HB_TAG('V','R','O',' ')},       /* Võro */
+  {HB_TAG('v','r','o',' '),     HB_TAG('E','T','I',' ')},       /* Võro -> Estonian */
+  {HB_TAG('v','s','n',' '),     HB_TAG('S','A','N',' ')},       /* Vedic Sanskrit -> Sanskrit */
   {HB_TAG('w','a','g',' '),     HB_TAG_NONE            },       /* Wa'ema != Wagdi */
 /*{HB_TAG('w','a','r',' '),     HB_TAG('W','A','R',' ')},*/     /* Waray (Philippines) -> Waray-Waray */
+/*{HB_TAG('w','b','l',' '),     HB_TAG('W','B','L',' ')},*/     /* Wakhi */
   {HB_TAG('w','b','m',' '),     HB_TAG('W','A',' ',' ')},       /* Wa */
   {HB_TAG('w','b','r',' '),     HB_TAG('W','A','G',' ')},       /* Wagdi */
   {HB_TAG('w','b','r',' '),     HB_TAG('R','A','J',' ')},       /* Wagdi -> Rajasthani */
 /*{HB_TAG('w','c','i',' '),     HB_TAG('W','C','I',' ')},*/     /* Waci Gbe */
+/*{HB_TAG('w','d','t',' '),     HB_TAG('W','D','T',' ')},*/     /* Wendat */
   {HB_TAG('w','e','a',' '),     HB_TAG('K','R','N',' ')},       /* Wewaw -> Karen */
   {HB_TAG('w','e','s',' '),     HB_TAG('C','P','P',' ')},       /* Cameroon Pidgin -> Creoles */
   {HB_TAG('w','e','u',' '),     HB_TAG('Q','I','N',' ')},       /* Rawngtu Chin -> Chin */
@@ -1550,6 +1601,9 @@ static const LangTag ot_languages3[] = {
   {HB_TAG('w','s','g',' '),     HB_TAG('G','O','N',' ')},       /* Adilabad Gondi -> Gondi */
 /*{HB_TAG('w','t','m',' '),     HB_TAG('W','T','M',' ')},*/     /* Mewati */
   {HB_TAG('w','u','u',' '),     HB_TAG('Z','H','S',' ')},       /* Wu Chinese -> Chinese, Simplified */
+  {HB_TAG('w','y','a',' '),     HB_TAG('W','D','T',' ')},       /* Wyandot (retired code) -> Wendat */
+  {HB_TAG('w','y','a',' '),     HB_TAG('W','Y','N',' ')},       /* Wyandot (retired code) */
+/*{HB_TAG('w','y','n',' '),     HB_TAG('W','Y','N',' ')},*/     /* Wyandot */
   {HB_TAG('x','a','l',' '),     HB_TAG('K','L','M',' ')},       /* Kalmyk */
   {HB_TAG('x','a','l',' '),     HB_TAG('T','O','D',' ')},       /* Kalmyk -> Todo */
   {HB_TAG('x','a','n',' '),     HB_TAG('S','E','K',' ')},       /* Xamtanga -> Sekota */
@@ -1582,7 +1636,7 @@ static const LangTag ot_languages3[] = {
   {HB_TAG('y','b','a',' '),     HB_TAG_NONE            },       /* Yala != Yoruba */
   {HB_TAG('y','b','b',' '),     HB_TAG('B','M','L',' ')},       /* Yemba -> Bamileke */
   {HB_TAG('y','b','d',' '),     HB_TAG('A','R','K',' ')},       /* Yangbye (retired code) -> Rakhine */
-  {HB_TAG('y','c','r',' '),     HB_TAG_NONE            },       /* Yilan Creole != Y-Cree */
+  {HB_TAG('y','c','r',' '),     HB_TAG('C','P','P',' ')},       /* Yilan Creole -> Creoles */
   {HB_TAG('y','d','d',' '),     HB_TAG('J','I','I',' ')},       /* Eastern Yiddish -> Yiddish */
 /*{HB_TAG('y','g','p',' '),     HB_TAG('Y','G','P',' ')},*/     /* Gepo */
   {HB_TAG('y','i','h',' '),     HB_TAG('J','I','I',' ')},       /* Western Yiddish -> Yiddish */
@@ -1591,6 +1645,7 @@ static const LangTag ot_languages3[] = {
   {HB_TAG('y','o','s',' '),     HB_TAG('Q','I','N',' ')},       /* Yos (retired code) -> Chin */
   {HB_TAG('y','u','a',' '),     HB_TAG('M','Y','N',' ')},       /* Yucateco -> Mayan */
   {HB_TAG('y','u','e',' '),     HB_TAG('Z','H','H',' ')},       /* Yue Chinese -> Chinese, Traditional, Hong Kong SAR */
+/*{HB_TAG('y','u','f',' '),     HB_TAG('Y','U','F',' ')},*/     /* Havasupai-Walapai-Yavapai */
 /*{HB_TAG('y','w','q',' '),     HB_TAG('Y','W','Q',' ')},*/     /* Wuding-Luquan Yi */
   {HB_TAG('z','c','h',' '),     HB_TAG('Z','H','A',' ')},       /* Central Hongshuihe Zhuang -> Zhuang */
   {HB_TAG('z','d','j',' '),     HB_TAG('C','M','R',' ')},       /* Ngazidja Comorian -> Comorian */
@@ -2335,6 +2390,26 @@ out:
       *count = i;
       return true;
     }
+    if (lang_matches (&lang_str[1], limit, "nm-hant-hk", 10))
+    {
+      /* Hainanese; Han (Traditional variant); Hong Kong */
+      tags[0] = HB_TAG('Z','H','H',' ');  /* Chinese, Traditional, Hong Kong SAR */
+      *count = 1;
+      return true;
+    }
+    if (lang_matches (&lang_str[1], limit, "nm-hant-mo", 10))
+    {
+      /* Hainanese; Han (Traditional variant); Macao */
+      unsigned int i;
+      hb_tag_t possible_tags[] = {
+        HB_TAG('Z','H','T','M'),  /* Chinese, Traditional, Macao SAR */
+        HB_TAG('Z','H','H',' '),  /* Chinese, Traditional, Hong Kong SAR */
+      };
+      for (i = 0; i < 2 && i < *count; i++)
+        tags[i] = possible_tags[i];
+      *count = i;
+      return true;
+    }
     if (lang_matches (&lang_str[1], limit, "sn-hant-hk", 10))
     {
       /* Xiang Chinese; Han (Traditional variant); Hong Kong */
@@ -2369,6 +2444,20 @@ out:
       *count = 1;
       return true;
     }
+    if (lang_matches (&lang_str[1], limit, "nm-hans", 7))
+    {
+      /* Hainanese; Han (Simplified variant) */
+      tags[0] = HB_TAG('Z','H','S',' ');  /* Chinese, Simplified */
+      *count = 1;
+      return true;
+    }
+    if (lang_matches (&lang_str[1], limit, "nm-hant", 7))
+    {
+      /* Hainanese; Han (Traditional variant) */
+      tags[0] = HB_TAG('Z','H','T',' ');  /* Chinese, Traditional */
+      *count = 1;
+      return true;
+    }
     if (lang_matches (&lang_str[1], limit, "sn-hans", 7))
     {
       /* Xiang Chinese; Han (Simplified variant) */
@@ -2413,6 +2502,36 @@ out:
       *count = 1;
       return true;
     }
+    if (0 == strncmp (&lang_str[1], "nm-", 3)
+        && subtag_matches (lang_str, limit, "-hk", 3))
+    {
+      /* Hainanese; Hong Kong */
+      tags[0] = HB_TAG('Z','H','H',' ');  /* Chinese, Traditional, Hong Kong SAR */
+      *count = 1;
+      return true;
+    }
+    if (0 == strncmp (&lang_str[1], "nm-", 3)
+        && subtag_matches (lang_str, limit, "-mo", 3))
+    {
+      /* Hainanese; Macao */
+      unsigned int i;
+      hb_tag_t possible_tags[] = {
+        HB_TAG('Z','H','T','M'),  /* Chinese, Traditional, Macao SAR */
+        HB_TAG('Z','H','H',' '),  /* Chinese, Traditional, Hong Kong SAR */
+      };
+      for (i = 0; i < 2 && i < *count; i++)
+        tags[i] = possible_tags[i];
+      *count = i;
+      return true;
+    }
+    if (0 == strncmp (&lang_str[1], "nm-", 3)
+        && subtag_matches (lang_str, limit, "-tw", 3))
+    {
+      /* Hainanese; Taiwan, Province of China */
+      tags[0] = HB_TAG('Z','H','T',' ');  /* Chinese, Traditional */
+      *count = 1;
+      return true;
+    }
     if (0 == strncmp (&lang_str[1], "sn-", 3)
         && subtag_matches (lang_str, limit, "-hk", 3))
     {
@@ -2474,6 +2593,40 @@ out:
     }
     break;
   case 'l':
+    if (lang_matches (&lang_str[1], limit, "uh-hant-hk", 10))
+    {
+      /* Leizhou Chinese; Han (Traditional variant); Hong Kong */
+      tags[0] = HB_TAG('Z','H','H',' ');  /* Chinese, Traditional, Hong Kong SAR */
+      *count = 1;
+      return true;
+    }
+    if (lang_matches (&lang_str[1], limit, "uh-hant-mo", 10))
+    {
+      /* Leizhou Chinese; Han (Traditional variant); Macao */
+      unsigned int i;
+      hb_tag_t possible_tags[] = {
+        HB_TAG('Z','H','T','M'),  /* Chinese, Traditional, Macao SAR */
+        HB_TAG('Z','H','H',' '),  /* Chinese, Traditional, Hong Kong SAR */
+      };
+      for (i = 0; i < 2 && i < *count; i++)
+        tags[i] = possible_tags[i];
+      *count = i;
+      return true;
+    }
+    if (lang_matches (&lang_str[1], limit, "uh-hans", 7))
+    {
+      /* Leizhou Chinese; Han (Simplified variant) */
+      tags[0] = HB_TAG('Z','H','S',' ');  /* Chinese, Simplified */
+      *count = 1;
+      return true;
+    }
+    if (lang_matches (&lang_str[1], limit, "uh-hant", 7))
+    {
+      /* Leizhou Chinese; Han (Traditional variant) */
+      tags[0] = HB_TAG('Z','H','T',' ');  /* Chinese, Traditional */
+      *count = 1;
+      return true;
+    }
     if (lang_matches (&lang_str[1], limit, "zh-hans", 7))
     {
       /* Literary Chinese; Han (Simplified variant) */
@@ -2481,6 +2634,36 @@ out:
       *count = 1;
       return true;
     }
+    if (0 == strncmp (&lang_str[1], "uh-", 3)
+        && subtag_matches (lang_str, limit, "-hk", 3))
+    {
+      /* Leizhou Chinese; Hong Kong */
+      tags[0] = HB_TAG('Z','H','H',' ');  /* Chinese, Traditional, Hong Kong SAR */
+      *count = 1;
+      return true;
+    }
+    if (0 == strncmp (&lang_str[1], "uh-", 3)
+        && subtag_matches (lang_str, limit, "-mo", 3))
+    {
+      /* Leizhou Chinese; Macao */
+      unsigned int i;
+      hb_tag_t possible_tags[] = {
+        HB_TAG('Z','H','T','M'),  /* Chinese, Traditional, Macao SAR */
+        HB_TAG('Z','H','H',' '),  /* Chinese, Traditional, Hong Kong SAR */
+      };
+      for (i = 0; i < 2 && i < *count; i++)
+        tags[i] = possible_tags[i];
+      *count = i;
+      return true;
+    }
+    if (0 == strncmp (&lang_str[1], "uh-", 3)
+        && subtag_matches (lang_str, limit, "-tw", 3))
+    {
+      /* Leizhou Chinese; Taiwan, Province of China */
+      tags[0] = HB_TAG('Z','H','T',' ');  /* Chinese, Traditional */
+      *count = 1;
+      return true;
+    }
     break;
   case 'm':
     if (lang_matches (&lang_str[1], limit, "np-hant-hk", 10))
@@ -2652,6 +2835,72 @@ out:
       return true;
     }
     break;
+  case 's':
+    if (lang_matches (&lang_str[1], limit, "jc-hant-hk", 10))
+    {
+      /* Shaojiang Chinese; Han (Traditional variant); Hong Kong */
+      tags[0] = HB_TAG('Z','H','H',' ');  /* Chinese, Traditional, Hong Kong SAR */
+      *count = 1;
+      return true;
+    }
+    if (lang_matches (&lang_str[1], limit, "jc-hant-mo", 10))
+    {
+      /* Shaojiang Chinese; Han (Traditional variant); Macao */
+      unsigned int i;
+      hb_tag_t possible_tags[] = {
+        HB_TAG('Z','H','T','M'),  /* Chinese, Traditional, Macao SAR */
+        HB_TAG('Z','H','H',' '),  /* Chinese, Traditional, Hong Kong SAR */
+      };
+      for (i = 0; i < 2 && i < *count; i++)
+        tags[i] = possible_tags[i];
+      *count = i;
+      return true;
+    }
+    if (lang_matches (&lang_str[1], limit, "jc-hans", 7))
+    {
+      /* Shaojiang Chinese; Han (Simplified variant) */
+      tags[0] = HB_TAG('Z','H','S',' ');  /* Chinese, Simplified */
+      *count = 1;
+      return true;
+    }
+    if (lang_matches (&lang_str[1], limit, "jc-hant", 7))
+    {
+      /* Shaojiang Chinese; Han (Traditional variant) */
+      tags[0] = HB_TAG('Z','H','T',' ');  /* Chinese, Traditional */
+      *count = 1;
+      return true;
+    }
+    if (0 == strncmp (&lang_str[1], "jc-", 3)
+        && subtag_matches (lang_str, limit, "-hk", 3))
+    {
+      /* Shaojiang Chinese; Hong Kong */
+      tags[0] = HB_TAG('Z','H','H',' ');  /* Chinese, Traditional, Hong Kong SAR */
+      *count = 1;
+      return true;
+    }
+    if (0 == strncmp (&lang_str[1], "jc-", 3)
+        && subtag_matches (lang_str, limit, "-mo", 3))
+    {
+      /* Shaojiang Chinese; Macao */
+      unsigned int i;
+      hb_tag_t possible_tags[] = {
+        HB_TAG('Z','H','T','M'),  /* Chinese, Traditional, Macao SAR */
+        HB_TAG('Z','H','H',' '),  /* Chinese, Traditional, Hong Kong SAR */
+      };
+      for (i = 0; i < 2 && i < *count; i++)
+        tags[i] = possible_tags[i];
+      *count = i;
+      return true;
+    }
+    if (0 == strncmp (&lang_str[1], "jc-", 3)
+        && subtag_matches (lang_str, limit, "-tw", 3))
+    {
+      /* Shaojiang Chinese; Taiwan, Province of China */
+      tags[0] = HB_TAG('Z','H','T',' ');  /* Chinese, Traditional */
+      *count = 1;
+      return true;
+    }
+    break;
   case 'w':
     if (lang_matches (&lang_str[1], limit, "uu-hant-hk", 10))
     {
@@ -2816,9 +3065,10 @@ out:
  * @tag: A language tag.
  *
  * Converts @tag to a BCP 47 language tag if it is ambiguous (it corresponds to
- * many language tags) and the best tag is not the alphabetically first, or if
- * the best tag consists of multiple subtags, or if the best tag does not appear
- * in #ot_languages.
+ * many language tags) and the best tag is not the first (sorted alphabetically,
+ * with two-letter tags having priority over all three-letter tags), or if the
+ * best tag consists of multiple subtags, or if the best tag does not appear in
+ * #ot_languages2 or #ot_languages3.
  *
  * Return value: The #hb_language_t corresponding to the BCP 47 language tag,
  * or #HB_LANGUAGE_INVALID if @tag is not ambiguous.
@@ -2832,8 +3082,6 @@ hb_ot_ambiguous_tag_to_language (hb_tag_t tag)
     return hb_language_from_string ("alt", -1);  /* Southern Altai */
   case HB_TAG('A','P','P','H'):  /* Phonetic transcription—Americanist conventions */
     return hb_language_from_string ("und-fonnapa", -1);  /* Undetermined; North American Phonetic Alphabet */
-  case HB_TAG('A','R','A',' '):  /* Arabic */
-    return hb_language_from_string ("ar", -1);  /* Arabic [macrolanguage] */
   case HB_TAG('A','R','K',' '):  /* Rakhine */
     return hb_language_from_string ("rki", -1);  /* Rakhine */
   case HB_TAG('A','T','H',' '):  /* Athapaskan */
@@ -2854,12 +3102,6 @@ hb_ot_ambiguous_tag_to_language (hb_tag_t tag)
     return hb_language_from_string ("din", -1);  /* Dinka [macrolanguage] */
   case HB_TAG('D','R','I',' '):  /* Dari */
     return hb_language_from_string ("prs", -1);  /* Dari */
-  case HB_TAG('D','Z','N',' '):  /* Dzongkha */
-    return hb_language_from_string ("dz", -1);  /* Dzongkha */
-  case HB_TAG('E','T','I',' '):  /* Estonian */
-    return hb_language_from_string ("et", -1);  /* Estonian [macrolanguage] */
-  case HB_TAG('F','A','R',' '):  /* Persian */
-    return hb_language_from_string ("fa", -1);  /* Persian [macrolanguage] */
   case HB_TAG('G','O','N',' '):  /* Gondi */
     return hb_language_from_string ("gon", -1);  /* Gondi [macrolanguage] */
   case HB_TAG('H','M','A',' '):  /* High Mari */
@@ -2874,50 +3116,34 @@ hb_ot_ambiguous_tag_to_language (hb_tag_t tag)
     return hb_language_from_string ("iba", -1);  /* Iban */
   case HB_TAG('I','J','O',' '):  /* Ijo */
     return hb_language_from_string ("ijo", -1);  /* Ijo [collection] */
-  case HB_TAG('I','N','U',' '):  /* Inuktitut */
-    return hb_language_from_string ("iu", -1);  /* Inuktitut [macrolanguage] */
-  case HB_TAG('I','P','K',' '):  /* Inupiat */
-    return hb_language_from_string ("ik", -1);  /* Inupiaq [macrolanguage] */
   case HB_TAG('I','P','P','H'):  /* Phonetic transcription—IPA conventions */
     return hb_language_from_string ("und-fonipa", -1);  /* Undetermined; International Phonetic Alphabet */
   case HB_TAG('I','R','T',' '):  /* Irish Traditional */
-    return hb_language_from_string ("ga-Latg", -1);  /* Irish; Latin (Gaelic variant) */
+    return hb_language_from_string ("ghc", -1);  /* Hiberno-Scottish Gaelic */
   case HB_TAG('J','I','I',' '):  /* Yiddish */
     return hb_language_from_string ("yi", -1);  /* Yiddish [macrolanguage] */
   case HB_TAG('K','A','L',' '):  /* Kalenjin */
     return hb_language_from_string ("kln", -1);  /* Kalenjin [macrolanguage] */
   case HB_TAG('K','G','E',' '):  /* Khutsuri Georgian */
     return hb_language_from_string ("und-Geok", -1);  /* Undetermined; Khutsuri (Asomtavruli and Nuskhuri) */
-  case HB_TAG('K','N','R',' '):  /* Kanuri */
-    return hb_language_from_string ("kr", -1);  /* Kanuri [macrolanguage] */
   case HB_TAG('K','O','H',' '):  /* Korean Old Hangul */
     return hb_language_from_string ("okm", -1);  /* Middle Korean (10th-16th cent.) */
   case HB_TAG('K','O','K',' '):  /* Konkani */
     return hb_language_from_string ("kok", -1);  /* Konkani [macrolanguage] */
-  case HB_TAG('K','O','M',' '):  /* Komi */
-    return hb_language_from_string ("kv", -1);  /* Komi [macrolanguage] */
   case HB_TAG('K','P','L',' '):  /* Kpelle */
     return hb_language_from_string ("kpe", -1);  /* Kpelle [macrolanguage] */
   case HB_TAG('K','R','N',' '):  /* Karen */
     return hb_language_from_string ("kar", -1);  /* Karen [collection] */
   case HB_TAG('K','U','I',' '):  /* Kui */
     return hb_language_from_string ("uki", -1);  /* Kui (India) */
-  case HB_TAG('K','U','R',' '):  /* Kurdish */
-    return hb_language_from_string ("ku", -1);  /* Kurdish [macrolanguage] */
   case HB_TAG('L','M','A',' '):  /* Low Mari */
     return hb_language_from_string ("mhr", -1);  /* Eastern Mari */
   case HB_TAG('L','U','H',' '):  /* Luyia */
     return hb_language_from_string ("luy", -1);  /* Luyia [macrolanguage] */
-  case HB_TAG('L','V','I',' '):  /* Latvian */
-    return hb_language_from_string ("lv", -1);  /* Latvian [macrolanguage] */
   case HB_TAG('M','A','W',' '):  /* Marwari */
     return hb_language_from_string ("mwr", -1);  /* Marwari [macrolanguage] */
-  case HB_TAG('M','L','G',' '):  /* Malagasy */
-    return hb_language_from_string ("mg", -1);  /* Malagasy [macrolanguage] */
   case HB_TAG('M','L','Y',' '):  /* Malay */
     return hb_language_from_string ("ms", -1);  /* Malay [macrolanguage] */
-  case HB_TAG('M','N','G',' '):  /* Mongolian */
-    return hb_language_from_string ("mn", -1);  /* Mongolian [macrolanguage] */
   case HB_TAG('M','N','K',' '):  /* Maninka */
     return hb_language_from_string ("man", -1);  /* Mandingo [macrolanguage] */
   case HB_TAG('M','O','L',' '):  /* Moldavian */
@@ -2928,26 +3154,16 @@ hb_ot_ambiguous_tag_to_language (hb_tag_t tag)
     return hb_language_from_string ("myn", -1);  /* Mayan [collection] */
   case HB_TAG('N','A','H',' '):  /* Nahuatl */
     return hb_language_from_string ("nah", -1);  /* Nahuatl [collection] */
-  case HB_TAG('N','E','P',' '):  /* Nepali */
-    return hb_language_from_string ("ne", -1);  /* Nepali [macrolanguage] */
   case HB_TAG('N','I','S',' '):  /* Nisi */
     return hb_language_from_string ("njz", -1);  /* Nyishi */
   case HB_TAG('N','O','R',' '):  /* Norwegian */
     return hb_language_from_string ("no", -1);  /* Norwegian [macrolanguage] */
-  case HB_TAG('O','J','B',' '):  /* Ojibway */
-    return hb_language_from_string ("oj", -1);  /* Ojibwa [macrolanguage] */
-  case HB_TAG('O','R','O',' '):  /* Oromo */
-    return hb_language_from_string ("om", -1);  /* Oromo [macrolanguage] */
-  case HB_TAG('P','A','S',' '):  /* Pashto */
-    return hb_language_from_string ("ps", -1);  /* Pashto [macrolanguage] */
   case HB_TAG('P','G','R',' '):  /* Polytonic Greek */
     return hb_language_from_string ("el-polyton", -1);  /* Modern Greek (1453-); Polytonic Greek */
   case HB_TAG('P','R','O',' '):  /* Provençal / Old Provençal */
     return hb_language_from_string ("pro", -1);  /* Old Provençal (to 1500) */
   case HB_TAG('Q','U','H',' '):  /* Quechua (Bolivia) */
     return hb_language_from_string ("quh", -1);  /* South Bolivian Quechua */
-  case HB_TAG('Q','U','Z',' '):  /* Quechua */
-    return hb_language_from_string ("qu", -1);  /* Quechua [macrolanguage] */
   case HB_TAG('Q','V','I',' '):  /* Quechua (Ecuador) */
     return hb_language_from_string ("qvi", -1);  /* Imbabura Highland Quichua */
   case HB_TAG('Q','W','H',' '):  /* Quechua (Peru) */
@@ -2958,8 +3174,8 @@ hb_ot_ambiguous_tag_to_language (hb_tag_t tag)
     return hb_language_from_string ("ro", -1);  /* Romanian */
   case HB_TAG('R','O','Y',' '):  /* Romany */
     return hb_language_from_string ("rom", -1);  /* Romany [macrolanguage] */
-  case HB_TAG('S','Q','I',' '):  /* Albanian */
-    return hb_language_from_string ("sq", -1);  /* Albanian [macrolanguage] */
+  case HB_TAG('S','G','A',' '):  /* Old Irish */
+    return hb_language_from_string ("sga", -1);  /* Old Irish (to 900) */
   case HB_TAG('S','R','B',' '):  /* Serbian */
     return hb_language_from_string ("sr", -1);  /* Serbian */
   case HB_TAG('S','X','T',' '):  /* Sutu */
@@ -2976,6 +3192,10 @@ hb_ot_ambiguous_tag_to_language (hb_tag_t tag)
     return hb_language_from_string ("tmh", -1);  /* Tamashek [macrolanguage] */
   case HB_TAG('T','O','D',' '):  /* Todo */
     return hb_language_from_string ("xwo", -1);  /* Written Oirat */
+  case HB_TAG('W','D','T',' '):  /* Wendat */
+    return hb_language_from_string ("wdt", -1);  /* Wendat */
+  case HB_TAG('W','Y','N',' '):  /* Wyandot */
+    return hb_language_from_string ("wyn", -1);  /* Wyandot */
   case HB_TAG('Z','H','H',' '):  /* Chinese, Traditional, Hong Kong SAR */
     return hb_language_from_string ("zh-HK", -1);  /* Chinese [macrolanguage]; Hong Kong */
   case HB_TAG('Z','H','S',' '):  /* Chinese, Simplified */
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-tag.cc b/src/java.desktop/share/native/libharfbuzz/hb-ot-tag.cc
index 9f0ae3b4dc19..3cdb703203b3 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-ot-tag.cc
+++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-tag.cc
@@ -547,7 +547,7 @@ hb_ot_tag_to_language (hb_tag_t tag)
       buf[3] = '-';
       str += 4;
     }
-    snprintf (str, 16, "x-hbot-%08x", tag);
+    snprintf (str, 16, "x-hbot-%08" PRIx32, tag);
     return hb_language_from_string (&*buf, -1);
   }
 }
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-var-avar-table.hh b/src/java.desktop/share/native/libharfbuzz/hb-ot-var-avar-table.hh
index 0aaf68adb0b1..e26687c34ed1 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-ot-var-avar-table.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-var-avar-table.hh
@@ -57,7 +57,7 @@ struct avarV2Tail
 
   protected:
   Offset32To  varIdxMap;      /* Offset from the beginning of 'avar' table. */
-  Offset32To    varStore;       /* Offset from the beginning of 'avar' table. */
+  Offset32To        varStore;       /* Offset from the beginning of 'avar' table. */
 
   public:
   DEFINE_SIZE_STATIC (8);
@@ -80,7 +80,7 @@ struct AxisValueMap
 
   bool is_outside_axis_range (const Triple& axis_range) const
   {
-    float from_coord = coords[0].to_float ();
+    double from_coord = (double) coords[0].to_float ();
     return !axis_range.contains (from_coord);
   }
 
@@ -100,8 +100,8 @@ struct AxisValueMap
     float from_coord = coords[0].to_float ();
     float to_coord = coords[1].to_float ();
 
-    from_coord = renormalizeValue (from_coord, unmapped_range, triple_distances);
-    to_coord = renormalizeValue (to_coord, axis_range, triple_distances);
+    from_coord = renormalizeValue ((double) from_coord, unmapped_range, triple_distances);
+    to_coord = renormalizeValue ((double) to_coord, axis_range, triple_distances);
 
     coords[0].set_float (from_coord);
     coords[1].set_float (to_coord);
@@ -197,7 +197,7 @@ struct SegmentMaps : Array16Of
     unmapped_val.set_int (unmap (val.to_int ()));
     float unmapped_max = unmapped_val.to_float ();
 
-    return Triple{unmapped_min, unmapped_middle, unmapped_max};
+    return Triple{(double) unmapped_min, (double) unmapped_middle, (double) unmapped_max};
   }
 
   bool subset (hb_subset_context_t *c, hb_tag_t axis_tag) const
@@ -230,7 +230,7 @@ struct SegmentMaps : Array16Of
        * duplicates here */
       if (mapping.must_include ())
         continue;
-      value_mappings.push (std::move (mapping));
+      value_mappings.push (mapping);
     }
 
     AxisValueMap m;
@@ -273,6 +273,7 @@ struct avar
   {
     TRACE_SANITIZE (this);
     if (!(version.sanitize (c) &&
+          hb_barrier () &&
           (version.major == 1
 #ifndef HB_NO_AVAR2
            || version.major == 2
@@ -293,6 +294,7 @@ struct avar
 #ifndef HB_NO_AVAR2
     if (version.major < 2)
       return_trace (true);
+    hb_barrier ();
 
     const auto &v2 = * (const avarV2Tail *) map;
     if (unlikely (!v2.sanitize (c, this)))
@@ -316,6 +318,7 @@ struct avar
 #ifndef HB_NO_AVAR2
     if (version.major < 2)
       return;
+    hb_barrier ();
 
     for (; count < axisCount; count++)
       map = &StructAfter (*map);
@@ -340,7 +343,7 @@ struct avar
     for (unsigned i = 0; i < coords_length; i++)
       coords[i] = out[i];
 
-    OT::VariationStore::destroy_cache (var_store_cache);
+    OT::ItemVariationStore::destroy_cache (var_store_cache);
 #endif
   }
 
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-var-common.hh b/src/java.desktop/share/native/libharfbuzz/hb-ot-var-common.hh
index 271250f91c38..72deddef213d 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-ot-var-common.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-var-common.hh
@@ -28,215 +28,11 @@
 
 #include "hb-ot-layout-common.hh"
 #include "hb-priority-queue.hh"
+#include "hb-subset-instancer-iup.hh"
 
 
 namespace OT {
 
-template 
-struct DeltaSetIndexMapFormat01
-{
-  friend struct DeltaSetIndexMap;
-
-  unsigned get_size () const
-  { return min_size + mapCount * get_width (); }
-
-  private:
-  DeltaSetIndexMapFormat01* copy (hb_serialize_context_t *c) const
-  {
-    TRACE_SERIALIZE (this);
-    return_trace (c->embed (this));
-  }
-
-  template 
-  bool serialize (hb_serialize_context_t *c, const T &plan)
-  {
-    unsigned int width = plan.get_width ();
-    unsigned int inner_bit_count = plan.get_inner_bit_count ();
-    const hb_array_t output_map = plan.get_output_map ();
-
-    TRACE_SERIALIZE (this);
-    if (unlikely (output_map.length && ((((inner_bit_count-1)&~0xF)!=0) || (((width-1)&~0x3)!=0))))
-      return_trace (false);
-    if (unlikely (!c->extend_min (this))) return_trace (false);
-
-    entryFormat = ((width-1)<<4)|(inner_bit_count-1);
-    mapCount = output_map.length;
-    HBUINT8 *p = c->allocate_size (width * output_map.length);
-    if (unlikely (!p)) return_trace (false);
-    for (unsigned int i = 0; i < output_map.length; i++)
-    {
-      unsigned int v = output_map.arrayZ[i];
-      if (v)
-      {
-        unsigned int outer = v >> 16;
-        unsigned int inner = v & 0xFFFF;
-        unsigned int u = (outer << inner_bit_count) | inner;
-        for (unsigned int w = width; w > 0;)
-        {
-          p[--w] = u;
-          u >>= 8;
-        }
-      }
-      p += width;
-    }
-    return_trace (true);
-  }
-
-  uint32_t map (unsigned int v) const /* Returns 16.16 outer.inner. */
-  {
-    /* If count is zero, pass value unchanged.  This takes
-     * care of direct mapping for advance map. */
-    if (!mapCount)
-      return v;
-
-    if (v >= mapCount)
-      v = mapCount - 1;
-
-    unsigned int u = 0;
-    { /* Fetch it. */
-      unsigned int w = get_width ();
-      const HBUINT8 *p = mapDataZ.arrayZ + w * v;
-      for (; w; w--)
-        u = (u << 8) + *p++;
-    }
-
-    { /* Repack it. */
-      unsigned int n = get_inner_bit_count ();
-      unsigned int outer = u >> n;
-      unsigned int inner = u & ((1 << n) - 1);
-      u = (outer<<16) | inner;
-    }
-
-    return u;
-  }
-
-  unsigned get_map_count () const       { return mapCount; }
-  unsigned get_width () const           { return ((entryFormat >> 4) & 3) + 1; }
-  unsigned get_inner_bit_count () const { return (entryFormat & 0xF) + 1; }
-
-
-  bool sanitize (hb_sanitize_context_t *c) const
-  {
-    TRACE_SANITIZE (this);
-    return_trace (c->check_struct (this) &&
-                  c->check_range (mapDataZ.arrayZ,
-                                  mapCount,
-                                  get_width ()));
-  }
-
-  protected:
-  HBUINT8       format;         /* Format identifier--format = 0 */
-  HBUINT8       entryFormat;    /* A packed field that describes the compressed
-                                 * representation of delta-set indices. */
-  MapCountT     mapCount;       /* The number of mapping entries. */
-  UnsizedArrayOf
-                mapDataZ;       /* The delta-set index mapping data. */
-
-  public:
-  DEFINE_SIZE_ARRAY (2+MapCountT::static_size, mapDataZ);
-};
-
-struct DeltaSetIndexMap
-{
-  template 
-  bool serialize (hb_serialize_context_t *c, const T &plan)
-  {
-    TRACE_SERIALIZE (this);
-    unsigned length = plan.get_output_map ().length;
-    u.format = length <= 0xFFFF ? 0 : 1;
-    switch (u.format) {
-    case 0: return_trace (u.format0.serialize (c, plan));
-    case 1: return_trace (u.format1.serialize (c, plan));
-    default:return_trace (false);
-    }
-  }
-
-  uint32_t map (unsigned v) const
-  {
-    switch (u.format) {
-    case 0: return (u.format0.map (v));
-    case 1: return (u.format1.map (v));
-    default:return v;
-    }
-  }
-
-  unsigned get_map_count () const
-  {
-    switch (u.format) {
-    case 0: return u.format0.get_map_count ();
-    case 1: return u.format1.get_map_count ();
-    default:return 0;
-    }
-  }
-
-  unsigned get_width () const
-  {
-    switch (u.format) {
-    case 0: return u.format0.get_width ();
-    case 1: return u.format1.get_width ();
-    default:return 0;
-    }
-  }
-
-  unsigned get_inner_bit_count () const
-  {
-    switch (u.format) {
-    case 0: return u.format0.get_inner_bit_count ();
-    case 1: return u.format1.get_inner_bit_count ();
-    default:return 0;
-    }
-  }
-
-  bool sanitize (hb_sanitize_context_t *c) const
-  {
-    TRACE_SANITIZE (this);
-    if (!u.format.sanitize (c)) return_trace (false);
-    switch (u.format) {
-    case 0: return_trace (u.format0.sanitize (c));
-    case 1: return_trace (u.format1.sanitize (c));
-    default:return_trace (true);
-    }
-  }
-
-  DeltaSetIndexMap* copy (hb_serialize_context_t *c) const
-  {
-    TRACE_SERIALIZE (this);
-    switch (u.format) {
-    case 0: return_trace (reinterpret_cast (u.format0.copy (c)));
-    case 1: return_trace (reinterpret_cast (u.format1.copy (c)));
-    default:return_trace (nullptr);
-    }
-  }
-
-  protected:
-  union {
-  HBUINT8                            format;         /* Format identifier */
-  DeltaSetIndexMapFormat01 format0;
-  DeltaSetIndexMapFormat01 format1;
-  } u;
-  public:
-  DEFINE_SIZE_UNION (1, format);
-};
-
-
-struct VarStoreInstancer
-{
-  VarStoreInstancer (const VariationStore *varStore,
-                     const DeltaSetIndexMap *varIdxMap,
-                     hb_array_t coords) :
-    varStore (varStore), varIdxMap (varIdxMap), coords (coords) {}
-
-  operator bool () const { return varStore && bool (coords); }
-
-  /* according to the spec, if colr table has varStore but does not have
-   * varIdxMap, then an implicit identity mapping is used */
-  float operator() (uint32_t varIdx, unsigned short offset = 0) const
-  { return coords ? varStore->get_delta (varIdxMap ? varIdxMap->map (VarIdx::add (varIdx, offset)) : varIdx + offset, coords) : 0; }
-
-  const VariationStore *varStore;
-  const DeltaSetIndexMap *varIdxMap;
-  hb_array_t coords;
-};
 
 /* https://docs.microsoft.com/en-us/typography/opentype/spec/otvarcommonformats#tuplevariationheader */
 struct TupleVariationHeader
@@ -296,15 +92,15 @@ struct TupleVariationHeader
         start = hb_min (peak, 0.f);
         end = hb_max (peak, 0.f);
       }
-      axis_tuples.set (*axis_tag, Triple (start, peak, end));
+      axis_tuples.set (*axis_tag, Triple ((double) start, (double) peak, (double) end));
     }
 
     return true;
   }
 
-  float calculate_scalar (hb_array_t coords, unsigned int coord_count,
-                          const hb_array_t shared_tuples,
-                          const hb_vector_t> *shared_tuple_active_idx = nullptr) const
+  double calculate_scalar (hb_array_t coords, unsigned int coord_count,
+                           const hb_array_t shared_tuples,
+                           const hb_vector_t> *shared_tuple_active_idx = nullptr) const
   {
     const F2DOT14 *peak_tuple;
 
@@ -318,13 +114,13 @@ struct TupleVariationHeader
     {
       unsigned int index = get_index ();
       if (unlikely ((index + 1) * coord_count > shared_tuples.length))
-        return 0.f;
+        return 0.0;
       peak_tuple = shared_tuples.sub_array (coord_count * index, coord_count).arrayZ;
 
       if (shared_tuple_active_idx)
       {
         if (unlikely (index >= shared_tuple_active_idx->length))
-          return 0.f;
+          return 0.0;
         auto _ = (*shared_tuple_active_idx).arrayZ[index];
         if (_.second != -1)
         {
@@ -349,7 +145,7 @@ struct TupleVariationHeader
       end_tuple = get_end_tuple (coord_count).arrayZ;
     }
 
-    float scalar = 1.f;
+    double scalar = 1.0;
     for (unsigned int i = start_idx; i < end_idx; i += step)
     {
       int peak = peak_tuple[i].to_int ();
@@ -364,15 +160,15 @@ struct TupleVariationHeader
         int end = end_tuple[i].to_int ();
         if (unlikely (start > peak || peak > end ||
                       (start < 0 && end > 0 && peak))) continue;
-        if (v < start || v > end) return 0.f;
+        if (v < start || v > end) return 0.0;
         if (v < peak)
-        { if (peak != start) scalar *= (float) (v - start) / (peak - start); }
+        { if (peak != start) scalar *= (double) (v - start) / (peak - start); }
         else
-        { if (peak != end) scalar *= (float) (end - v) / (end - peak); }
+        { if (peak != end) scalar *= (double) (end - v) / (end - peak); }
       }
-      else if (!v || v < hb_min (0, peak) || v > hb_max (0, peak)) return 0.f;
+      else if (!v || v < hb_min (0, peak) || v > hb_max (0, peak)) return 0.0;
       else
-        scalar *= (float) v / peak;
+        scalar *= (double) v / peak;
     }
     return scalar;
   }
@@ -425,15 +221,10 @@ struct TupleVariationHeader
   DEFINE_SIZE_MIN (4);
 };
 
-enum packed_delta_flag_t
-{
-  DELTAS_ARE_ZERO      = 0x80,
-  DELTAS_ARE_WORDS     = 0x40,
-  DELTA_RUN_COUNT_MASK = 0x3F
-};
-
 struct tuple_delta_t
 {
+  static constexpr bool realloc_move = true;  // Watch out when adding new members!
+
   public:
   hb_hashmap_t axis_tuples;
 
@@ -447,8 +238,8 @@ struct tuple_delta_t
   /* compiled data: header and deltas
    * compiled point data is saved in a hashmap within tuple_variations_t cause
    * some point sets might be reused by different tuple variations */
-  hb_vector_t compiled_tuple_header;
-  hb_vector_t compiled_deltas;
+  hb_vector_t compiled_tuple_header;
+  hb_vector_t compiled_deltas;
 
   /* compiled peak coords, empty for non-gvar tuples */
   hb_vector_t compiled_peak_coords;
@@ -456,7 +247,7 @@ struct tuple_delta_t
   tuple_delta_t () = default;
   tuple_delta_t (const tuple_delta_t& o) = default;
 
-  friend void swap (tuple_delta_t& a, tuple_delta_t& b)
+  friend void swap (tuple_delta_t& a, tuple_delta_t& b) noexcept
   {
     hb_swap (a.axis_tuples, b.axis_tuples);
     hb_swap (a.indices, b.indices);
@@ -467,10 +258,10 @@ struct tuple_delta_t
     hb_swap (a.compiled_peak_coords, b.compiled_peak_coords);
   }
 
-  tuple_delta_t (tuple_delta_t&& o) : tuple_delta_t ()
+  tuple_delta_t (tuple_delta_t&& o)  noexcept : tuple_delta_t ()
   { hb_swap (*this, o); }
 
-  tuple_delta_t& operator = (tuple_delta_t&& o)
+  tuple_delta_t& operator = (tuple_delta_t&& o) noexcept
   {
     hb_swap (*this, o);
     return *this;
@@ -514,14 +305,19 @@ struct tuple_delta_t
       return *this;
 
     unsigned num = indices.length;
-    for (unsigned i = 0; i < num; i++)
-    {
-      if (!indices.arrayZ[i]) continue;
-
-      deltas_x[i] *= scalar;
-      if (deltas_y)
+    if (deltas_y)
+      for (unsigned i = 0; i < num; i++)
+      {
+        if (!indices.arrayZ[i]) continue;
+        deltas_x[i] *= scalar;
         deltas_y[i] *= scalar;
-    }
+      }
+    else
+      for (unsigned i = 0; i < num; i++)
+      {
+        if (!indices.arrayZ[i]) continue;
+        deltas_x[i] *= scalar;
+      }
     return *this;
   }
 
@@ -536,18 +332,18 @@ struct tuple_delta_t
       return out;
     }
 
-    if ((tent->minimum < 0.f && tent->maximum > 0.f) ||
+    if ((tent->minimum < 0.0 && tent->maximum > 0.0) ||
         !(tent->minimum <= tent->middle && tent->middle <= tent->maximum))
       return out;
 
-    if (tent->middle == 0.f)
+    if (tent->middle == 0.0)
     {
       out.push (*this);
       return out;
     }
 
-    result_t solutions = rebase_tent (*tent, axis_limit, axis_triple_distances);
-    for (auto t : solutions)
+    rebase_tent_result_t solutions = rebase_tent (*tent, axis_limit, axis_triple_distances);
+    for (auto &t : solutions)
     {
       tuple_delta_t new_var = *this;
       if (t.second == Triple ())
@@ -600,7 +396,9 @@ struct tuple_delta_t
                                  const hb_map_t& axes_old_index_tag_map,
                                  const hb_hashmap_t*, unsigned>* shared_tuples_idx_map)
   {
-    if (!compiled_deltas) return false;
+    /* compiled_deltas could be empty after iup delta optimization, we can skip
+     * compiling this tuple and return true */
+    if (!compiled_deltas) return true;
 
     unsigned cur_axis_count = axes_index_map.get_population ();
     /* allocate enough memory: 1 peak + 2 intermediate coords + fixed header size */
@@ -714,37 +512,42 @@ struct tuple_delta_t
   }
 
   bool compile_deltas ()
+  { return compile_deltas (indices, deltas_x, deltas_y, compiled_deltas); }
+
+  static bool compile_deltas (hb_array_t point_indices,
+                              hb_array_t x_deltas,
+                              hb_array_t y_deltas,
+                              hb_vector_t &compiled_deltas /* OUT */)
   {
     hb_vector_t rounded_deltas;
-    if (unlikely (!rounded_deltas.alloc (indices.length)))
+    if (unlikely (!rounded_deltas.alloc (point_indices.length)))
       return false;
 
-    for (unsigned i = 0; i < indices.length; i++)
+    for (unsigned i = 0; i < point_indices.length; i++)
     {
-      if (!indices[i]) continue;
-      int rounded_delta = (int) roundf (deltas_x[i]);
+      if (!point_indices[i]) continue;
+      int rounded_delta = (int) roundf (x_deltas.arrayZ[i]);
       rounded_deltas.push (rounded_delta);
     }
 
-    if (!rounded_deltas) return false;
-    /* allocate enough memories 3 * num_deltas */
-    unsigned alloc_len = 3 * rounded_deltas.length;
-    if (deltas_y)
+    if (!rounded_deltas) return true;
+    /* allocate enough memories 5 * num_deltas */
+    unsigned alloc_len = 5 * rounded_deltas.length;
+    if (y_deltas)
       alloc_len *= 2;
 
     if (unlikely (!compiled_deltas.resize (alloc_len))) return false;
 
-    unsigned i = 0;
-    unsigned encoded_len = encode_delta_run (i, compiled_deltas.as_array (), rounded_deltas);
+    unsigned encoded_len = compile_deltas (compiled_deltas, rounded_deltas);
 
-    if (deltas_y)
+    if (y_deltas)
     {
-      /* reuse the rounded_deltas vector, check that deltas_y have the same num of deltas as deltas_x */
+      /* reuse the rounded_deltas vector, check that y_deltas have the same num of deltas as x_deltas */
       unsigned j = 0;
-      for (unsigned idx = 0; idx < indices.length; idx++)
+      for (unsigned idx = 0; idx < point_indices.length; idx++)
       {
-        if (!indices[idx]) continue;
-        int rounded_delta = (int) roundf (deltas_y[idx]);
+        if (!point_indices[idx]) continue;
+        int rounded_delta = (int) roundf (y_deltas.arrayZ[idx]);
 
         if (j >= rounded_deltas.length) return false;
 
@@ -752,174 +555,15 @@ struct tuple_delta_t
       }
 
       if (j != rounded_deltas.length) return false;
-      /* reset i because we reuse rounded_deltas for deltas_y */
-      i = 0;
-      encoded_len += encode_delta_run (i, compiled_deltas.as_array ().sub_array (encoded_len), rounded_deltas);
+      encoded_len += compile_deltas (compiled_deltas.as_array ().sub_array (encoded_len), rounded_deltas);
     }
     return compiled_deltas.resize (encoded_len);
   }
 
-  unsigned encode_delta_run (unsigned& i,
-                             hb_array_t encoded_bytes,
-                             const hb_vector_t& deltas) const
-  {
-    unsigned num_deltas = deltas.length;
-    unsigned encoded_len = 0;
-    while (i < num_deltas)
-    {
-      int val = deltas[i];
-      if (val == 0)
-        encoded_len += encode_delta_run_as_zeroes (i, encoded_bytes.sub_array (encoded_len), deltas);
-      else if (val >= -128 && val <= 127)
-        encoded_len += encode_delta_run_as_bytes (i, encoded_bytes.sub_array (encoded_len), deltas);
-      else
-        encoded_len += encode_delta_run_as_words (i, encoded_bytes.sub_array (encoded_len), deltas);
-    }
-    return encoded_len;
-  }
-
-  unsigned encode_delta_run_as_zeroes (unsigned& i,
-                                       hb_array_t encoded_bytes,
-                                       const hb_vector_t& deltas) const
-  {
-    unsigned num_deltas = deltas.length;
-    unsigned run_length = 0;
-    auto it = encoded_bytes.iter ();
-    unsigned encoded_len = 0;
-    while (i < num_deltas && deltas[i] == 0)
-    {
-      i++;
-      run_length++;
-    }
-
-    while (run_length >= 64)
-    {
-      *it++ = char (DELTAS_ARE_ZERO | 63);
-      run_length -= 64;
-      encoded_len++;
-    }
-
-    if (run_length)
-    {
-      *it++ = char (DELTAS_ARE_ZERO | (run_length - 1));
-      encoded_len++;
-    }
-    return encoded_len;
-  }
-
-  unsigned encode_delta_run_as_bytes (unsigned &i,
-                                      hb_array_t encoded_bytes,
-                                      const hb_vector_t& deltas) const
-  {
-    unsigned start = i;
-    unsigned num_deltas = deltas.length;
-    while (i < num_deltas)
-    {
-      int val = deltas[i];
-      if (val > 127 || val < -128)
-        break;
-
-      /* from fonttools: if there're 2 or more zeros in a sequence,
-       * it is better to start a new run to save bytes. */
-      if (val == 0 && i + 1 < num_deltas && deltas[i+1] == 0)
-        break;
-
-      i++;
-    }
-    unsigned run_length = i - start;
-
-    unsigned encoded_len = 0;
-    auto it = encoded_bytes.iter ();
-
-    while (run_length >= 64)
-    {
-      *it++ = 63;
-      encoded_len++;
-
-      for (unsigned j = 0; j < 64; j++)
-      {
-        *it++ = static_cast (deltas[start + j]);
-        encoded_len++;
-      }
-
-      start += 64;
-      run_length -= 64;
-    }
-
-    if (run_length)
-    {
-      *it++ = run_length - 1;
-      encoded_len++;
-
-      while (start < i)
-      {
-        *it++ = static_cast (deltas[start++]);
-        encoded_len++;
-      }
-    }
-
-    return encoded_len;
-  }
-
-  unsigned encode_delta_run_as_words (unsigned &i,
-                                      hb_array_t encoded_bytes,
-                                      const hb_vector_t& deltas) const
+  static unsigned compile_deltas (hb_array_t encoded_bytes,
+                                  hb_array_t deltas)
   {
-    unsigned start = i;
-    unsigned num_deltas = deltas.length;
-    while (i < num_deltas)
-    {
-      int val = deltas[i];
-
-      /* start a new run for a single zero value*/
-      if (val == 0) break;
-
-      /* from fonttools: continue word-encoded run if there's only one
-       * single value in the range [-128, 127] because it is more compact.
-       * Only start a new run when there're 2 continuous such values. */
-      if (val >= -128 && val <= 127 &&
-          i + 1 < num_deltas &&
-          deltas[i+1] >= -128 && deltas[i+1] <= 127)
-        break;
-
-      i++;
-    }
-
-    unsigned run_length = i - start;
-    auto it = encoded_bytes.iter ();
-    unsigned encoded_len = 0;
-    while (run_length >= 64)
-    {
-      *it++ = (DELTAS_ARE_WORDS | 63);
-      encoded_len++;
-
-      for (unsigned j = 0; j < 64; j++)
-      {
-        int16_t delta_val = deltas[start + j];
-        *it++ = static_cast (delta_val >> 8);
-        *it++ = static_cast (delta_val & 0xFF);
-
-        encoded_len += 2;
-      }
-
-      start += 64;
-      run_length -= 64;
-    }
-
-    if (run_length)
-    {
-      *it++ = (DELTAS_ARE_WORDS | (run_length - 1));
-      encoded_len++;
-      while (start < i)
-      {
-        int16_t delta_val = deltas[start++];
-        *it++ = static_cast (delta_val >> 8);
-        *it++ = static_cast (delta_val & 0xFF);
-
-        encoded_len += 2;
-      }
-    }
-    return encoded_len;
+    return TupleValues::compile (deltas, encoded_bytes);
   }
 
   bool calc_inferred_deltas (const contour_point_vector_t& orig_points)
@@ -982,10 +626,14 @@ struct tuple_delta_t
         {
           i = next_index (i, start_point, end_point);
           if (i == next) break;
-          deltas_x.arrayZ[i] = infer_delta (orig_points.arrayZ[i].x, orig_points.arrayZ[prev].x, orig_points.arrayZ[next].x,
-                                            deltas_x.arrayZ[prev], deltas_x.arrayZ[next]);
-          deltas_y.arrayZ[i] = infer_delta (orig_points.arrayZ[i].y, orig_points.arrayZ[prev].y, orig_points.arrayZ[next].y,
-                                            deltas_y.arrayZ[prev], deltas_y.arrayZ[next]);
+          deltas_x.arrayZ[i] = infer_delta ((double) orig_points.arrayZ[i].x,
+                                            (double) orig_points.arrayZ[prev].x,
+                                            (double) orig_points.arrayZ[next].x,
+                                            (double) deltas_x.arrayZ[prev], (double) deltas_x.arrayZ[next]);
+          deltas_y.arrayZ[i] = infer_delta ((double) orig_points.arrayZ[i].y,
+                                            (double) orig_points.arrayZ[prev].y,
+                                            (double) orig_points.arrayZ[next].y,
+                                            (double) deltas_y.arrayZ[prev], (double) deltas_y.arrayZ[next]);
           inferred_idxes.add (i);
           if (--unref_count == 0) goto no_more_gaps;
         }
@@ -1002,8 +650,8 @@ struct tuple_delta_t
       {
         if (!inferred_idxes.has (i))
         {
-          deltas_x.arrayZ[i] = 0.f;
-          deltas_y.arrayZ[i] = 0.f;
+          deltas_x.arrayZ[i] = 0.0;
+          deltas_y.arrayZ[i] = 0.0;
         }
         indices[i] = true;
       }
@@ -1011,16 +659,181 @@ struct tuple_delta_t
     return true;
   }
 
-  static float infer_delta (float target_val, float prev_val, float next_val, float prev_delta, float next_delta)
+  bool optimize (const contour_point_vector_t& contour_points,
+                 bool is_composite,
+                 double tolerance = 0.5 + 1e-10)
+  {
+    unsigned count = contour_points.length;
+    if (deltas_x.length != count ||
+        deltas_y.length != count)
+      return false;
+
+    hb_vector_t opt_indices;
+    hb_vector_t rounded_x_deltas, rounded_y_deltas;
+
+    if (unlikely (!rounded_x_deltas.alloc (count) ||
+                  !rounded_y_deltas.alloc (count)))
+      return false;
+
+    for (unsigned i = 0; i < count; i++)
+    {
+      int rounded_x_delta = (int) roundf (deltas_x.arrayZ[i]);
+      int rounded_y_delta = (int) roundf (deltas_y.arrayZ[i]);
+      rounded_x_deltas.push (rounded_x_delta);
+      rounded_y_deltas.push (rounded_y_delta);
+    }
+
+    if (!iup_delta_optimize (contour_points, rounded_x_deltas, rounded_y_deltas, opt_indices, tolerance))
+      return false;
+
+    unsigned ref_count = 0;
+    for (bool ref_flag : opt_indices)
+       ref_count += ref_flag;
+
+    if (ref_count == count) return true;
+
+    hb_vector_t opt_deltas_x, opt_deltas_y;
+    bool is_comp_glyph_wo_deltas = (is_composite && ref_count == 0);
+    if (is_comp_glyph_wo_deltas)
+    {
+      if (unlikely (!opt_deltas_x.resize (count) ||
+                    !opt_deltas_y.resize (count)))
+        return false;
+
+      opt_indices.arrayZ[0] = true;
+      for (unsigned i = 1; i < count; i++)
+        opt_indices.arrayZ[i] = false;
+    }
+
+    hb_vector_t opt_point_data;
+    if (!compile_point_set (opt_indices, opt_point_data))
+      return false;
+    hb_vector_t opt_deltas_data;
+    if (!compile_deltas (opt_indices,
+                         is_comp_glyph_wo_deltas ? opt_deltas_x : deltas_x,
+                         is_comp_glyph_wo_deltas ? opt_deltas_y : deltas_y,
+                         opt_deltas_data))
+      return false;
+
+    hb_vector_t point_data;
+    if (!compile_point_set (indices, point_data))
+      return false;
+    hb_vector_t deltas_data;
+    if (!compile_deltas (indices, deltas_x, deltas_y, deltas_data))
+      return false;
+
+    if (opt_point_data.length + opt_deltas_data.length < point_data.length + deltas_data.length)
+    {
+      indices.fini ();
+      indices = std::move (opt_indices);
+
+      if (is_comp_glyph_wo_deltas)
+      {
+        deltas_x.fini ();
+        deltas_x = std::move (opt_deltas_x);
+
+        deltas_y.fini ();
+        deltas_y = std::move (opt_deltas_y);
+      }
+    }
+    return !indices.in_error () && !deltas_x.in_error () && !deltas_y.in_error ();
+  }
+
+  static bool compile_point_set (const hb_vector_t &point_indices,
+                                 hb_vector_t& compiled_points /* OUT */)
+  {
+    unsigned num_points = 0;
+    for (bool i : point_indices)
+      if (i) num_points++;
+
+    /* when iup optimization is enabled, num of referenced points could be 0 */
+    if (!num_points) return true;
+
+    unsigned indices_length = point_indices.length;
+    /* If the points set consists of all points in the glyph, it's encoded with a
+     * single zero byte */
+    if (num_points == indices_length)
+      return compiled_points.resize (1);
+
+    /* allocate enough memories: 2 bytes for count + 3 bytes for each point */
+    unsigned num_bytes = 2 + 3 *num_points;
+    if (unlikely (!compiled_points.resize (num_bytes, false)))
+      return false;
+
+    unsigned pos = 0;
+    /* binary data starts with the total number of reference points */
+    if (num_points < 0x80)
+      compiled_points.arrayZ[pos++] = num_points;
+    else
+    {
+      compiled_points.arrayZ[pos++] = ((num_points >> 8) | 0x80);
+      compiled_points.arrayZ[pos++] = num_points & 0xFF;
+    }
+
+    const unsigned max_run_length = 0x7F;
+    unsigned i = 0;
+    unsigned last_value = 0;
+    unsigned num_encoded = 0;
+    while (i < indices_length && num_encoded < num_points)
+    {
+      unsigned run_length = 0;
+      unsigned header_pos = pos;
+      compiled_points.arrayZ[pos++] = 0;
+
+      bool use_byte_encoding = false;
+      bool new_run = true;
+      while (i < indices_length && num_encoded < num_points &&
+             run_length <= max_run_length)
+      {
+        // find out next referenced point index
+        while (i < indices_length && !point_indices[i])
+          i++;
+
+        if (i >= indices_length) break;
+
+        unsigned cur_value = i;
+        unsigned delta = cur_value - last_value;
+
+        if (new_run)
+        {
+          use_byte_encoding = (delta <= 0xFF);
+          new_run = false;
+        }
+
+        if (use_byte_encoding && delta > 0xFF)
+          break;
+
+        if (use_byte_encoding)
+          compiled_points.arrayZ[pos++] = delta;
+        else
+        {
+          compiled_points.arrayZ[pos++] = delta >> 8;
+          compiled_points.arrayZ[pos++] = delta & 0xFF;
+        }
+        i++;
+        last_value = cur_value;
+        run_length++;
+        num_encoded++;
+      }
+
+      if (use_byte_encoding)
+        compiled_points.arrayZ[header_pos] = run_length - 1;
+      else
+        compiled_points.arrayZ[header_pos] = (run_length - 1) | 0x80;
+    }
+    return compiled_points.resize (pos, false);
+  }
+
+  static double infer_delta (double target_val, double prev_val, double next_val, double prev_delta, double next_delta)
   {
     if (prev_val == next_val)
-      return (prev_delta == next_delta) ? prev_delta : 0.f;
+      return (prev_delta == next_delta) ? prev_delta : 0.0;
     else if (target_val <= hb_min (prev_val, next_val))
       return (prev_val < next_val) ? prev_delta : next_delta;
     else if (target_val >= hb_max (prev_val, next_val))
       return (prev_val > next_val) ? prev_delta : next_delta;
 
-    float r = (target_val - prev_val) / (next_val - prev_val);
+    double r = (target_val - prev_val) / (next_val - prev_val);
     return prev_delta + r * (next_delta - prev_delta);
   }
 
@@ -1028,6 +841,7 @@ struct tuple_delta_t
   { return (i >= end) ? start : (i + 1); }
 };
 
+template 
 struct TupleVariationData
 {
   bool sanitize (hb_sanitize_context_t *c) const
@@ -1062,19 +876,22 @@ struct TupleVariationData
 
     private:
     /* referenced point set->compiled point data map */
-    hb_hashmap_t*, hb_bytes_t> point_data_map;
+    hb_hashmap_t*, hb_vector_t> point_data_map;
     /* referenced point set-> count map, used in finding shared points */
     hb_hashmap_t*, unsigned> point_set_count_map;
 
     /* empty for non-gvar tuples.
-     * shared_points_bytes is just a copy of some value in the point_data_map,
+     * shared_points_bytes is a pointer to some value in the point_data_map,
      * which will be freed during map destruction. Save it for serialization, so
      * no need to do find_shared_points () again */
-    hb_bytes_t shared_points_bytes;
+    hb_vector_t *shared_points_bytes = nullptr;
 
-    /* total compiled byte size as TupleVariationData format, initialized to its
-     * min_size: 4 */
-    unsigned compiled_byte_size = 4;
+    /* total compiled byte size as TupleVariationData format, initialized to 0 */
+    unsigned compiled_byte_size = 0;
+    bool needs_padding = false;
+
+    /* for gvar iup delta optimization: whether this is a composite glyph */
+    bool is_composite = false;
 
     public:
     tuple_variations_t () = default;
@@ -1082,21 +899,18 @@ struct TupleVariationData
     tuple_variations_t& operator=(const tuple_variations_t&) = delete;
     tuple_variations_t (tuple_variations_t&&) = default;
     tuple_variations_t& operator=(tuple_variations_t&&) = default;
-    ~tuple_variations_t () { fini (); }
-    void fini ()
-    {
-      for (auto _ : point_data_map.values ())
-        _.fini ();
-
-      point_set_count_map.fini ();
-      tuple_vars.fini ();
-    }
+    ~tuple_variations_t () = default;
 
     explicit operator bool () const { return bool (tuple_vars); }
     unsigned get_var_count () const
     {
-      unsigned count = tuple_vars.length;
-      if (shared_points_bytes.length)
+      unsigned count = 0;
+      /* when iup delta opt is enabled, compiled_deltas could be empty and we
+       * should skip this tuple */
+      for (auto& tuple: tuple_vars)
+        if (tuple.compiled_deltas) count++;
+
+      if (shared_points_bytes && shared_points_bytes->length)
         count |= TupleVarCount::SharedPointNumbers;
       return count;
     }
@@ -1110,26 +924,27 @@ struct TupleVariationData
                                      bool is_gvar,
                                      const hb_map_t *axes_old_index_tag_map,
                                      const hb_vector_t &shared_indices,
-                                     const hb_array_t shared_tuples)
+                                     const hb_array_t shared_tuples,
+                                     bool is_composite_glyph)
     {
       do
       {
         const HBUINT8 *p = iterator.get_serialized_data ();
         unsigned int length = iterator.current_tuple->get_data_size ();
         if (unlikely (!iterator.var_data_bytes.check_range (p, length)))
-        { fini (); return false; }
+          return false;
 
         hb_hashmap_t axis_tuples;
         if (!iterator.current_tuple->unpack_axis_tuples (iterator.get_axis_count (), shared_tuples, axes_old_index_tag_map, axis_tuples)
             || axis_tuples.is_empty ())
-        { fini (); return false; }
+          return false;
 
         hb_vector_t private_indices;
         bool has_private_points = iterator.current_tuple->has_private_points ();
         const HBUINT8 *end = p + length;
         if (has_private_points &&
-            !TupleVariationData::unpack_points (p, private_indices, end))
-        { fini (); return false; }
+            !TupleVariationData::decompile_points (p, private_indices, end))
+          return false;
 
         const hb_vector_t &indices = has_private_points ? private_indices : shared_indices;
         bool apply_to_all = (indices.length == 0);
@@ -1138,43 +953,46 @@ struct TupleVariationData
         hb_vector_t deltas_x;
 
         if (unlikely (!deltas_x.resize (num_deltas, false) ||
-                      !TupleVariationData::unpack_deltas (p, deltas_x, end)))
-        { fini (); return false; }
+                      !TupleVariationData::decompile_deltas (p, deltas_x, end)))
+          return false;
 
         hb_vector_t deltas_y;
         if (is_gvar)
         {
           if (unlikely (!deltas_y.resize (num_deltas, false) ||
-                        !TupleVariationData::unpack_deltas (p, deltas_y, end)))
-          { fini (); return false; }
+                        !TupleVariationData::decompile_deltas (p, deltas_y, end)))
+            return false;
         }
 
         tuple_delta_t var;
         var.axis_tuples = std::move (axis_tuples);
         if (unlikely (!var.indices.resize (point_count) ||
                       !var.deltas_x.resize (point_count, false)))
-        { fini (); return false; }
+          return false;
 
         if (is_gvar && unlikely (!var.deltas_y.resize (point_count, false)))
-        { fini (); return false; }
+          return false;
 
         for (unsigned i = 0; i < num_deltas; i++)
         {
           unsigned idx = apply_to_all ? i : indices[i];
           if (idx >= point_count) continue;
           var.indices[idx] = true;
-          var.deltas_x[idx] = static_cast (deltas_x[i]);
+          var.deltas_x[idx] = deltas_x[i];
           if (is_gvar)
-            var.deltas_y[idx] = static_cast (deltas_y[i]);
+            var.deltas_y[idx] = deltas_y[i];
         }
         tuple_vars.push (std::move (var));
       } while (iterator.move_to_next ());
+
+      is_composite = is_composite_glyph;
       return true;
     }
 
     bool create_from_item_var_data (const VarData &var_data,
                                     const hb_vector_t>& regions,
                                     const hb_map_t& axes_old_index_tag_map,
+                                    unsigned& item_count,
                                     const hb_inc_bimap_t* inner_map = nullptr)
     {
       /* NULL offset, to keep original varidx valid, just return */
@@ -1184,7 +1002,8 @@ struct TupleVariationData
       unsigned num_regions = var_data.get_region_index_count ();
       if (!tuple_vars.alloc (num_regions)) return false;
 
-      unsigned item_count = inner_map ? inner_map->get_population () : var_data.get_item_count ();
+      item_count = inner_map ? inner_map->get_population () : var_data.get_item_count ();
+      if (!item_count) return true;
       unsigned row_size = var_data.get_row_size ();
       const HBUINT8 *delta_bytes = var_data.get_delta_bytes ();
 
@@ -1237,7 +1056,7 @@ struct TupleVariationData
         Triple *axis_limit;
         if (!normalized_axes_location.has (axis_tag, &axis_limit))
           return false;
-        TripleDistances axis_triple_distances{1.f, 1.f};
+        TripleDistances axis_triple_distances{1.0, 1.0};
         if (axes_triple_distances.has (axis_tag))
           axis_triple_distances = axes_triple_distances.get (axis_tag);
 
@@ -1250,7 +1069,7 @@ struct TupleVariationData
           unsigned new_len = new_vars.length + out.length;
 
           if (unlikely (!new_vars.alloc (new_len, false)))
-          { fini (); return false;}
+            return false;
 
           for (unsigned i = 0; i < out.length; i++)
             new_vars.push (std::move (out[i]));
@@ -1261,8 +1080,9 @@ struct TupleVariationData
       return true;
     }
 
-    /* merge tuple variations with overlapping tents */
-    void merge_tuple_variations ()
+    /* merge tuple variations with overlapping tents, if iup delta optimization
+     * is enabled, add default deltas to contour_points */
+    bool merge_tuple_variations (contour_point_vector_t* contour_points = nullptr)
     {
       hb_vector_t new_vars;
       hb_hashmap_t*, unsigned> m;
@@ -1270,7 +1090,15 @@ struct TupleVariationData
       for (const tuple_delta_t& var : tuple_vars)
       {
         /* if all axes are pinned, drop the tuple variation */
-        if (var.axis_tuples.is_empty ()) continue;
+        if (var.axis_tuples.is_empty ())
+        {
+          /* if iup_delta_optimize is enabled, add deltas to contour coords */
+          if (contour_points && !contour_points->add_deltas (var.deltas_x,
+                                                             var.deltas_y,
+                                                             var.indices))
+            return false;
+          continue;
+        }
 
         unsigned *idx;
         if (m.has (&(var.axis_tuples), &idx))
@@ -1280,98 +1108,14 @@ struct TupleVariationData
         else
         {
           new_vars.push (var);
-          m.set (&(var.axis_tuples), i);
+          if (!m.set (&(var.axis_tuples), i))
+            return false;
           i++;
         }
       }
       tuple_vars.fini ();
       tuple_vars = std::move (new_vars);
-    }
-
-    hb_bytes_t compile_point_set (const hb_vector_t &point_indices)
-    {
-      unsigned num_points = 0;
-      for (bool i : point_indices)
-        if (i) num_points++;
-
-      unsigned indices_length = point_indices.length;
-      /* If the points set consists of all points in the glyph, it's encoded with a
-       * single zero byte */
-      if (num_points == indices_length)
-      {
-        char *p = (char *) hb_calloc (1, sizeof (char));
-        if (unlikely (!p)) return hb_bytes_t ();
-
-        return hb_bytes_t (p, 1);
-      }
-
-      /* allocate enough memories: 2 bytes for count + 3 bytes for each point */
-      unsigned num_bytes = 2 + 3 *num_points;
-      char *p = (char *) hb_calloc (num_bytes, sizeof (char));
-      if (unlikely (!p)) return hb_bytes_t ();
-
-      unsigned pos = 0;
-      /* binary data starts with the total number of reference points */
-      if (num_points < 0x80)
-        p[pos++] = num_points;
-      else
-      {
-        p[pos++] = ((num_points >> 8) | 0x80);
-        p[pos++] = num_points & 0xFF;
-      }
-
-      const unsigned max_run_length = 0x7F;
-      unsigned i = 0;
-      unsigned last_value = 0;
-      unsigned num_encoded = 0;
-      while (i < indices_length && num_encoded < num_points)
-      {
-        unsigned run_length = 0;
-        unsigned header_pos = pos;
-        p[pos++] = 0;
-
-        bool use_byte_encoding = false;
-        bool new_run = true;
-        while (i < indices_length && num_encoded < num_points &&
-               run_length <= max_run_length)
-        {
-          // find out next referenced point index
-          while (i < indices_length && !point_indices[i])
-            i++;
-
-          if (i >= indices_length) break;
-
-          unsigned cur_value = i;
-          unsigned delta = cur_value - last_value;
-
-          if (new_run)
-          {
-            use_byte_encoding = (delta <= 0xFF);
-            new_run = false;
-          }
-
-          if (use_byte_encoding && delta > 0xFF)
-            break;
-
-          if (use_byte_encoding)
-            p[pos++] = delta;
-          else
-          {
-            p[pos++] = delta >> 8;
-            p[pos++] = delta & 0xFF;
-          }
-          i++;
-          last_value = cur_value;
-          run_length++;
-          num_encoded++;
-        }
-
-        if (use_byte_encoding)
-          p[header_pos] = run_length - 1;
-        else
-          p[header_pos] = (run_length - 1) | 0x80;
-      }
-      return hb_bytes_t (p, pos);
+      return true;
     }
 
     /* compile all point set and store byte data in a point_set->hb_bytes_t hashmap,
@@ -1391,11 +1135,11 @@ struct TupleVariationData
           continue;
         }
 
-        hb_bytes_t compiled_data = compile_point_set (*points_set);
-        if (unlikely (compiled_data == hb_bytes_t ()))
+        hb_vector_t compiled_point_data;
+        if (!tuple_delta_t::compile_point_set (*points_set, compiled_point_data))
           return false;
 
-        if (!point_data_map.set (points_set, compiled_data) ||
+        if (!point_data_map.set (points_set, std::move (compiled_point_data)) ||
             !point_set_count_map.set (points_set, 1))
           return false;
       }
@@ -1403,31 +1147,33 @@ struct TupleVariationData
     }
 
     /* find shared points set which saves most bytes */
-    hb_bytes_t find_shared_points ()
+    void find_shared_points ()
     {
       unsigned max_saved_bytes = 0;
-      hb_bytes_t res{};
 
-      for (const auto& _ : point_data_map.iter ())
+      for (const auto& _ : point_data_map.iter_ref ())
       {
         const hb_vector_t* points_set = _.first;
         unsigned data_length = _.second.length;
+        if (!data_length) continue;
         unsigned *count;
         if (unlikely (!point_set_count_map.has (points_set, &count) ||
                       *count <= 1))
-          return hb_bytes_t ();
+        {
+          shared_points_bytes = nullptr;
+          return;
+        }
 
         unsigned saved_bytes = data_length * ((*count) -1);
         if (saved_bytes > max_saved_bytes)
         {
           max_saved_bytes = saved_bytes;
-          res = _.second;
+          shared_points_bytes = &(_.second);
         }
       }
-      return res;
     }
 
-    bool calc_inferred_deltas (contour_point_vector_t& contour_points)
+    bool calc_inferred_deltas (const contour_point_vector_t& contour_points)
     {
       for (tuple_delta_t& var : tuple_vars)
         if (!var.calc_inferred_deltas (contour_points))
@@ -1436,10 +1182,21 @@ struct TupleVariationData
       return true;
     }
 
+    bool iup_optimize (const contour_point_vector_t& contour_points)
+    {
+      for (tuple_delta_t& var : tuple_vars)
+      {
+        if (!var.optimize (contour_points, is_composite))
+          return false;
+      }
+      return true;
+    }
+
     public:
     bool instantiate (const hb_hashmap_t& normalized_axes_location,
                       const hb_hashmap_t& axes_triple_distances,
-                      contour_point_vector_t* contour_points = nullptr)
+                      contour_point_vector_t* contour_points = nullptr,
+                      bool optimize = false)
     {
       if (!tuple_vars) return true;
       if (!change_tuple_variations_axis_limits (normalized_axes_location, axes_triple_distances))
@@ -1449,41 +1206,70 @@ struct TupleVariationData
         if (!calc_inferred_deltas (*contour_points))
           return false;
 
-      merge_tuple_variations ();
+      /* if iup delta opt is on, contour_points can't be null */
+      if (optimize && !contour_points)
+        return false;
+
+      if (!merge_tuple_variations (optimize ? contour_points : nullptr))
+        return false;
+
+      if (optimize && !iup_optimize (*contour_points)) return false;
       return !tuple_vars.in_error ();
     }
 
     bool compile_bytes (const hb_map_t& axes_index_map,
                         const hb_map_t& axes_old_index_tag_map,
                         bool use_shared_points,
+                        bool is_gvar = false,
                         const hb_hashmap_t*, unsigned>* shared_tuples_idx_map = nullptr)
     {
+      // return true for empty glyph
+      if (!tuple_vars)
+        return true;
+
       // compile points set and store data in hashmap
       if (!compile_all_point_sets ())
         return false;
 
+      /* total compiled byte size as TupleVariationData format, initialized to its
+       * min_size: 4 */
+      compiled_byte_size += 4;
+
       if (use_shared_points)
       {
-        shared_points_bytes = find_shared_points ();
-        compiled_byte_size += shared_points_bytes.length;
+        find_shared_points ();
+        if (shared_points_bytes)
+          compiled_byte_size += shared_points_bytes->length;
       }
       // compile delta and tuple var header for each tuple variation
       for (auto& tuple: tuple_vars)
       {
         const hb_vector_t* points_set = &(tuple.indices);
-        hb_bytes_t *points_data;
+        hb_vector_t *points_data;
         if (unlikely (!point_data_map.has (points_set, &points_data)))
           return false;
 
+        /* when iup optimization is enabled, num of referenced points could be 0
+         * and thus the compiled points bytes is empty, we should skip compiling
+         * this tuple */
+        if (!points_data->length)
+          continue;
         if (!tuple.compile_deltas ())
           return false;
 
-        unsigned points_data_length = (*points_data != shared_points_bytes) ? points_data->length : 0;
+        unsigned points_data_length = (points_data != shared_points_bytes) ? points_data->length : 0;
         if (!tuple.compile_tuple_var_header (axes_index_map, points_data_length, axes_old_index_tag_map,
                                              shared_tuples_idx_map))
           return false;
         compiled_byte_size += tuple.compiled_tuple_header.length + points_data_length + tuple.compiled_deltas.length;
       }
+
+      if (is_gvar && (compiled_byte_size % 2))
+      {
+        needs_padding = true;
+        compiled_byte_size += 1;
+      }
+
       return true;
     }
 
@@ -1502,25 +1288,31 @@ struct TupleVariationData
     bool serialize_var_data (hb_serialize_context_t *c, bool is_gvar) const
     {
       TRACE_SERIALIZE (this);
-      if (is_gvar)
-        shared_points_bytes.copy (c);
+      if (is_gvar && shared_points_bytes)
+      {
+        hb_ubytes_t s (shared_points_bytes->arrayZ, shared_points_bytes->length);
+        s.copy (c);
+      }
 
       for (const auto& tuple: tuple_vars)
       {
         const hb_vector_t* points_set = &(tuple.indices);
-        hb_bytes_t *point_data;
+        hb_vector_t *point_data;
         if (!point_data_map.has (points_set, &point_data))
           return_trace (false);
 
-        if (!is_gvar || *point_data != shared_points_bytes)
-          point_data->copy (c);
+        if (!is_gvar || point_data != shared_points_bytes)
+        {
+          hb_ubytes_t s (point_data->arrayZ, point_data->length);
+          s.copy (c);
+        }
 
         tuple.compiled_deltas.as_array ().copy (c);
         if (c->in_error ()) return_trace (false);
       }
 
       /* padding for gvar */
-      if (is_gvar && (compiled_byte_size % 2))
+      if (is_gvar && needs_padding)
       {
         HBUINT8 pad;
         pad = 0;
@@ -1551,7 +1343,7 @@ struct TupleVariationData
       {
         const HBUINT8 *base = &(table_base+var_data->data);
         const HBUINT8 *p = base;
-        if (!unpack_points (p, shared_indices, (const HBUINT8 *) (var_data_bytes.arrayZ + var_data_bytes.length))) return false;
+        if (!decompile_points (p, shared_indices, (const HBUINT8 *) (var_data_bytes.arrayZ + var_data_bytes.length))) return false;
         data_offset = p - base;
       }
       return true;
@@ -1601,9 +1393,9 @@ struct TupleVariationData
 
   bool has_shared_point_numbers () const { return tupleVarCount.has_shared_point_numbers (); }
 
-  static bool unpack_points (const HBUINT8 *&p /* IN/OUT */,
-                             hb_vector_t &points /* OUT */,
-                             const HBUINT8 *end)
+  static bool decompile_points (const HBUINT8 *&p /* IN/OUT */,
+                                hb_vector_t &points /* OUT */,
+                                const HBUINT8 *end)
   {
     enum packed_point_flag_t
     {
@@ -1653,43 +1445,13 @@ struct TupleVariationData
     return true;
   }
 
-  static bool unpack_deltas (const HBUINT8 *&p /* IN/OUT */,
-                             hb_vector_t &deltas /* IN/OUT */,
-                             const HBUINT8 *end)
+  template 
+  static bool decompile_deltas (const HBUINT8 *&p /* IN/OUT */,
+                                hb_vector_t &deltas /* IN/OUT */,
+                                const HBUINT8 *end,
+                                bool consume_all = false)
   {
-    unsigned i = 0;
-    unsigned count = deltas.length;
-    while (i < count)
-    {
-      if (unlikely (p + 1 > end)) return false;
-      unsigned control = *p++;
-      unsigned run_count = (control & DELTA_RUN_COUNT_MASK) + 1;
-      unsigned stop = i + run_count;
-      if (unlikely (stop > count)) return false;
-      if (control & DELTAS_ARE_ZERO)
-      {
-        for (; i < stop; i++)
-          deltas.arrayZ[i] = 0;
-      }
-      else if (control & DELTAS_ARE_WORDS)
-      {
-        if (unlikely (p + run_count * HBUINT16::static_size > end)) return false;
-        for (; i < stop; i++)
-        {
-          deltas.arrayZ[i] = * (const HBINT16 *) p;
-          p += HBUINT16::static_size;
-        }
-      }
-      else
-      {
-        if (unlikely (p + run_count > end)) return false;
-        for (; i < stop; i++)
-        {
-          deltas.arrayZ[i] = * (const HBINT8 *) p++;
-        }
-      }
-    }
-    return true;
+    return TupleValues::decompile (p, deltas, end, consume_all);
   }
 
   bool has_data () const { return tupleVarCount; }
@@ -1700,13 +1462,15 @@ struct TupleVariationData
                                    const hb_map_t *axes_old_index_tag_map,
                                    const hb_vector_t &shared_indices,
                                    const hb_array_t shared_tuples,
-                                   tuple_variations_t& tuple_variations /* OUT */) const
+                                   tuple_variations_t& tuple_variations, /* OUT */
+                                   bool is_composite_glyph = false) const
   {
     return tuple_variations.create_from_tuple_var_data (iterator, tupleVarCount,
                                                         point_count, is_gvar,
                                                         axes_old_index_tag_map,
                                                         shared_indices,
-                                                        shared_tuples);
+                                                        shared_tuples,
+                                                        is_composite_glyph);
   }
 
   bool serialize (hb_serialize_context_t *c,
@@ -1758,15 +1522,16 @@ struct TupleVariationData
                                  * low 12 bits are the number of tuple variation tables
                                  * for this glyph. The number of tuple variation tables
                                  * can be any number between 1 and 4095. */
-  Offset16To
+  OffsetTo
                 data;           /* Offset from the start of the base table
                                  * to the serialized data. */
   /* TupleVariationHeader tupleVariationHeaders[] *//* Array of tuple variation headers. */
   public:
-  DEFINE_SIZE_MIN (4);
+  DEFINE_SIZE_MIN (2 + OffType::static_size);
 };
 
-using tuple_variations_t = TupleVariationData::tuple_variations_t;
+// TODO: Move tuple_variations_t to outside of TupleVariationData
+using tuple_variations_t = TupleVariationData::tuple_variations_t;
 struct item_variations_t
 {
   using region_t = const hb_hashmap_t*;
@@ -1775,6 +1540,14 @@ struct item_variations_t
    * have the same num of deltas (rows) */
   hb_vector_t vars;
 
+  /* num of retained rows for each subtable, there're 2 cases when var_data is empty:
+   * 1. retained item_count is zero
+   * 2. regions is empty and item_count is non-zero.
+   * when converting to tuples, both will be dropped because the tuple is empty,
+   * however, we need to retain 2. as all-zero rows to keep original varidx
+   * valid, so we need a way to remember the num of rows for each subtable */
+  hb_vector_t var_data_num_rows;
+
   /* original region list, decompiled from item varstore, used when rebuilding
    * region list after instantiation */
   hb_vector_t> orig_region_list;
@@ -1812,7 +1585,7 @@ struct item_variations_t
   const hb_map_t& get_varidx_map () const
   { return varidx_map; }
 
-  bool instantiate (const VariationStore& varStore,
+  bool instantiate (const ItemVariationStore& varStore,
                     const hb_subset_plan_t *plan,
                     bool optimize=true,
                     bool use_no_variation_idx=true,
@@ -1826,7 +1599,7 @@ struct item_variations_t
   }
 
   /* keep below APIs public only for unit test: test-item-varstore */
-  bool create_from_item_varstore (const VariationStore& varStore,
+  bool create_from_item_varstore (const ItemVariationStore& varStore,
                                   const hb_map_t& axes_old_index_tag_map,
                                   const hb_array_t  inner_maps = hb_array_t ())
   {
@@ -1836,22 +1609,26 @@ struct item_variations_t
 
     unsigned num_var_data = varStore.get_sub_table_count ();
     if (inner_maps && inner_maps.length != num_var_data) return false;
-    if (!vars.alloc (num_var_data)) return false;
+    if (!vars.alloc (num_var_data) ||
+        !var_data_num_rows.alloc (num_var_data)) return false;
 
     for (unsigned i = 0; i < num_var_data; i++)
     {
       if (inner_maps && !inner_maps.arrayZ[i].get_population ())
           continue;
       tuple_variations_t var_data_tuples;
+      unsigned item_count = 0;
       if (!var_data_tuples.create_from_item_var_data (varStore.get_sub_table (i),
                                                       orig_region_list,
                                                       axes_old_index_tag_map,
+                                                      item_count,
                                                       inner_maps ? &(inner_maps.arrayZ[i]) : nullptr))
         return false;
 
+      var_data_num_rows.push (item_count);
       vars.push (std::move (var_data_tuples));
     }
-    return !vars.in_error ();
+    return !vars.in_error () && !var_data_num_rows.in_error () && vars.length == var_data_num_rows.length;
   }
 
   bool instantiate_tuple_vars (const hb_hashmap_t& normalized_axes_location,
@@ -1904,7 +1681,9 @@ struct item_variations_t
       }
     }
 
-    if (!all_regions || !all_unique_regions) return false;
+    /* regions are empty means no variation data, return true */
+    if (!all_regions || !all_unique_regions) return true;
+
     if (!region_list.alloc (all_regions.get_population ()))
       return false;
 
@@ -1969,16 +1748,13 @@ struct item_variations_t
 
   bool as_item_varstore (bool optimize=true, bool use_no_variation_idx=true)
   {
-    if (!region_list) return false;
+    /* return true if no variation data */
+    if (!region_list) return true;
     unsigned num_cols = region_list.length;
     /* pre-alloc a 2D vector for all sub_table's VarData rows */
     unsigned total_rows = 0;
-    for (unsigned major = 0; major < vars.length; major++)
-    {
-      const tuple_variations_t& tuples = vars[major];
-      /* all tuples in each sub_table should have same num of deltas(num rows) */
-      total_rows += tuples.tuple_vars[0].deltas_x.length;
-    }
+    for (unsigned major = 0; major < var_data_num_rows.length; major++)
+      total_rows += var_data_num_rows[major];
 
     if (!delta_rows.resize (total_rows)) return false;
     /* init all rows to [0]*num_cols */
@@ -1998,7 +1774,7 @@ struct item_variations_t
       /* deltas are stored in tuples(column based), convert them back into items
        * (row based) delta */
       const tuple_variations_t& tuples = vars[major];
-      unsigned num_rows = tuples.tuple_vars[0].deltas_x.length;
+      unsigned num_rows = var_data_num_rows[major];
       for (const tuple_delta_t& tuple: tuples.tuple_vars)
       {
         if (tuple.deltas_x.length != num_rows)
@@ -2223,6 +1999,7 @@ struct item_variations_t
   }
 };
 
+
 } /* namespace OT */
 
 
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-var-cvar-table.hh b/src/java.desktop/share/native/libharfbuzz/hb-ot-var-cvar-table.hh
index a44a8e99998b..3dc4ebaebd82 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-ot-var-cvar-table.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-var-cvar-table.hh
@@ -45,11 +45,12 @@ struct cvar
   {
     TRACE_SANITIZE (this);
     return_trace (c->check_struct (this) &&
-                  version.sanitize (c) && likely (version.major == 1) &&
+                  hb_barrier () &&
+                  likely (version.major == 1) &&
                   tupleVariationData.sanitize (c));
   }
 
-  const TupleVariationData* get_tuple_var_data (void) const
+  const TupleVariationData<>* get_tuple_var_data (void) const
   { return &tupleVariationData; }
 
   bool decompile_tuple_variations (unsigned axis_count,
@@ -57,12 +58,12 @@ struct cvar
                                    hb_blob_t *blob,
                                    bool is_gvar,
                                    const hb_map_t *axes_old_index_tag_map,
-                                   TupleVariationData::tuple_variations_t& tuple_variations /* OUT */) const
+                                   TupleVariationData<>::tuple_variations_t& tuple_variations /* OUT */) const
   {
     hb_vector_t shared_indices;
-    TupleVariationData::tuple_iterator_t iterator;
+    TupleVariationData<>::tuple_iterator_t iterator;
     hb_bytes_t var_data_bytes = blob->as_bytes ().sub_array (4);
-    if (!TupleVariationData::get_tuple_iterator (var_data_bytes, axis_count, this,
+    if (!TupleVariationData<>::get_tuple_iterator (var_data_bytes, axis_count, this,
                                                  shared_indices, &iterator))
       return false;
 
@@ -76,16 +77,16 @@ struct cvar
   static bool calculate_cvt_deltas (unsigned axis_count,
                                     hb_array_t coords,
                                     unsigned num_cvt_item,
-                                    const TupleVariationData *tuple_var_data,
+                                    const TupleVariationData<> *tuple_var_data,
                                     const void *base,
                                     hb_vector_t& cvt_deltas /* OUT */)
   {
     if (!coords) return true;
     hb_vector_t shared_indices;
-    TupleVariationData::tuple_iterator_t iterator;
+    TupleVariationData<>::tuple_iterator_t iterator;
     unsigned var_data_length = tuple_var_data->get_size (axis_count);
     hb_bytes_t var_data_bytes = hb_bytes_t (reinterpret_cast (tuple_var_data), var_data_length);
-    if (!TupleVariationData::get_tuple_iterator (var_data_bytes, axis_count, base,
+    if (!TupleVariationData<>::get_tuple_iterator (var_data_bytes, axis_count, base,
                                                  shared_indices, &iterator))
       return true; /* isn't applied at all */
 
@@ -106,14 +107,14 @@ struct cvar
 
       bool has_private_points = iterator.current_tuple->has_private_points ();
       if (has_private_points &&
-          !TupleVariationData::unpack_points (p, private_indices, end))
+          !TupleVariationData<>::decompile_points (p, private_indices, end))
         return false;
       const hb_vector_t &indices = has_private_points ? private_indices : shared_indices;
 
       bool apply_to_all = (indices.length == 0);
       unsigned num_deltas = apply_to_all ? num_cvt_item : indices.length;
       if (unlikely (!unpacked_deltas.resize (num_deltas, false))) return false;
-      if (unlikely (!TupleVariationData::unpack_deltas (p, unpacked_deltas, end))) return false;
+      if (unlikely (!TupleVariationData<>::decompile_deltas (p, unpacked_deltas, end))) return false;
 
       for (unsigned int i = 0; i < num_deltas; i++)
       {
@@ -128,7 +129,7 @@ struct cvar
   }
 
   bool serialize (hb_serialize_context_t *c,
-                  TupleVariationData::tuple_variations_t& tuple_variations) const
+                  TupleVariationData<>::tuple_variations_t& tuple_variations) const
   {
     TRACE_SERIALIZE (this);
     if (!tuple_variations) return_trace (false);
@@ -143,7 +144,7 @@ struct cvar
     if (c->plan->all_axes_pinned)
       return_trace (false);
 
-    OT::TupleVariationData::tuple_variations_t tuple_variations;
+    OT::TupleVariationData<>::tuple_variations_t tuple_variations;
     unsigned axis_count = c->plan->axes_old_index_tag_map.get_population ();
 
     const hb_tag_t cvt = HB_TAG('c','v','t',' ');
@@ -168,7 +169,7 @@ struct cvar
   }
 
   static bool add_cvt_and_apply_deltas (hb_subset_plan_t *plan,
-                                        const TupleVariationData *tuple_var_data,
+                                        const TupleVariationData<> *tuple_var_data,
                                         const void *base)
   {
     const hb_tag_t cvt = HB_TAG('c','v','t',' ');
@@ -208,7 +209,7 @@ struct cvar
   protected:
   FixedVersion<>version;                /* Version of the CVT variation table
                                          * initially set to 0x00010000u */
-  TupleVariationData tupleVariationData; /* TupleVariationDate for cvar table */
+  TupleVariationData<> tupleVariationData; /* TupleVariationDate for cvar table */
   public:
   DEFINE_SIZE_MIN (8);
 };
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-var-fvar-table.hh b/src/java.desktop/share/native/libharfbuzz/hb-ot-var-fvar-table.hh
index d60c3dbcf4e4..f2725eaa2823 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-ot-var-fvar-table.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-var-fvar-table.hh
@@ -43,7 +43,7 @@ static bool axis_coord_pinned_or_within_axis_range (const hb_array_t(coords[axis_index].to_float ());
   if (axis_limit.is_point ())
   {
     if (axis_limit.minimum != axis_coord)
@@ -131,6 +131,7 @@ struct InstanceRecord
   {
     TRACE_SANITIZE (this);
     return_trace (c->check_struct (this) &&
+                  hb_barrier () &&
                   c->check_array (coordinatesZ.arrayZ, axis_count));
   }
 
@@ -232,7 +233,10 @@ struct AxisRecord
   {
     float min, default_, max;
     get_coordinates (min, default_, max);
-    return TripleDistances (min, default_, max);
+    return TripleDistances (
+      static_cast(min),
+      static_cast(default_),
+      static_cast(max));
   }
 
   bool subset (hb_subset_context_t *c) const
@@ -277,8 +281,10 @@ struct fvar
   {
     TRACE_SANITIZE (this);
     return_trace (version.sanitize (c) &&
+                  hb_barrier () &&
                   likely (version.major == 1) &&
                   c->check_struct (this) &&
+                  hb_barrier () &&
                   axisSize == 20 && /* Assumed in our code. */
                   instanceSize >= axisCount * 4 + 4 &&
                   get_axes ().sanitize (c) &&
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-var-gvar-table.hh b/src/java.desktop/share/native/libharfbuzz/hb-ot-var-gvar-table.hh
index fd32ef03f30d..c3040187f6e7 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-ot-var-gvar-table.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-var-gvar-table.hh
@@ -28,6 +28,7 @@
 #ifndef HB_OT_VAR_GVAR_TABLE_HH
 #define HB_OT_VAR_GVAR_TABLE_HH
 
+#include "hb-decycler.hh"
 #include "hb-open-type.hh"
 #include "hb-ot-var-common.hh"
 
@@ -36,15 +37,37 @@
  * https://docs.microsoft.com/en-us/typography/opentype/spec/gvar
  */
 #define HB_OT_TAG_gvar HB_TAG('g','v','a','r')
+#define HB_OT_TAG_GVAR HB_TAG('G','V','A','R')
 
-namespace OT {
+struct hb_glyf_scratch_t
+{
+  // glyf
+  contour_point_vector_t all_points;
+  contour_point_vector_t comp_points;
+  hb_decycler_t decycler;
+
+  // gvar
+  contour_point_vector_t orig_points;
+  hb_vector_t x_deltas;
+  hb_vector_t y_deltas;
+  contour_point_vector_t deltas;
+  hb_vector_t shared_indices;
+  hb_vector_t private_indices;
+
+  // VARC
+  hb_vector_t axisIndices;
+  hb_vector_t axisValues;
+};
 
-struct GlyphVariationData : TupleVariationData
-{};
+namespace OT {
 
+template 
 struct glyph_variations_t
 {
-  using tuple_variations_t = TupleVariationData::tuple_variations_t;
+  // TODO: Move tuple_variations_t to outside of TupleVariationData
+  using tuple_variations_t = typename TupleVariationData::tuple_variations_t;
+  using GlyphVariationData = TupleVariationData;
+
   hb_vector_t glyph_variations;
 
   hb_vector_t compiled_shared_tuples;
@@ -72,7 +95,7 @@ struct glyph_variations_t
                                     const hb_subset_plan_t *plan,
                                     const hb_hashmap_t& new_gid_var_data_map)
   {
-    if (unlikely (!glyph_variations.alloc (plan->new_to_old_gid_list.length, true)))
+    if (unlikely (!glyph_variations.alloc_exact (plan->new_to_old_gid_list.length)))
       return false;
 
     auto it = hb_iter (plan->new_to_old_gid_list);
@@ -86,10 +109,11 @@ struct glyph_variations_t
       hb_bytes_t var_data = new_gid_var_data_map.get (new_gid);
 
       const GlyphVariationData* p = reinterpret_cast (var_data.arrayZ);
-      hb_vector_t shared_indices;
-      GlyphVariationData::tuple_iterator_t iterator;
+      typename GlyphVariationData::tuple_iterator_t iterator;
       tuple_variations_t tuple_vars;
 
+      hb_vector_t shared_indices;
+
       /* in case variation data is empty, push an empty struct into the vector,
        * keep the vector in sync with the new_to_old_gid_list */
       if (!var_data || ! p->has_data () || !all_contour_points->length ||
@@ -101,10 +125,14 @@ struct glyph_variations_t
         continue;
       }
 
+      bool is_composite_glyph = false;
+      is_composite_glyph = plan->composite_new_gids.has (new_gid);
+
       if (!p->decompile_tuple_variations (all_contour_points->length, true /* is_gvar */,
                                           iterator, &(plan->axes_old_index_tag_map),
                                           shared_indices, shared_tuples,
-                                          tuple_vars /* OUT */))
+                                          tuple_vars, /* OUT */
+                                          is_composite_glyph))
         return false;
       glyph_variations.push (std::move (tuple_vars));
     }
@@ -114,13 +142,15 @@ struct glyph_variations_t
   bool instantiate (const hb_subset_plan_t *plan)
   {
     unsigned count = plan->new_to_old_gid_list.length;
+    bool iup_optimize = false;
+    iup_optimize = plan->flags & HB_SUBSET_FLAGS_OPTIMIZE_IUP_DELTAS;
     for (unsigned i = 0; i < count; i++)
     {
       hb_codepoint_t new_gid = plan->new_to_old_gid_list[i].first;
       contour_point_vector_t *all_points;
       if (!plan->new_gid_contour_points_map.has (new_gid, &all_points))
         return false;
-      if (!glyph_variations[i].instantiate (plan->axes_location, plan->axes_triple_distances, all_points))
+      if (!glyph_variations[i].instantiate (plan->axes_location, plan->axes_triple_distances, all_points, iup_optimize))
         return false;
     }
     return true;
@@ -134,6 +164,7 @@ struct glyph_variations_t
     for (tuple_variations_t& vars: glyph_variations)
       if (!vars.compile_bytes (axes_index_map, axes_old_index_tag_map,
                                true, /* use shared points*/
+                               true,
                                &shared_tuples_idx_map))
         return false;
 
@@ -252,7 +283,7 @@ struct glyph_variations_t
     hb_codepoint_t last_gid = 0;
     unsigned idx = 0;
 
-    TupleVariationData* cur_glyph = c->start_embed ();
+    GlyphVariationData* cur_glyph = c->start_embed ();
     if (!cur_glyph) return_trace (false);
     for (auto &_ : it)
     {
@@ -266,7 +297,7 @@ struct glyph_variations_t
 
       if (idx >= glyph_variations.length) return_trace (false);
       if (!cur_glyph->serialize (c, true, glyph_variations[idx])) return_trace (false);
-      TupleVariationData* next_glyph = c->start_embed ();
+      GlyphVariationData* next_glyph = c->start_embed ();
       glyph_offset += (char *) next_glyph - (char *) cur_glyph;
 
       if (long_offset)
@@ -289,14 +320,21 @@ struct glyph_variations_t
   }
 };
 
-struct gvar
+template 
+struct gvar_GVAR
 {
-  static constexpr hb_tag_t tableTag = HB_OT_TAG_gvar;
+  static constexpr hb_tag_t tableTag = TableTag;
+
+  using GlyphVariationData = TupleVariationData;
+
+  bool has_data () const { return version.to_int () != 0; }
 
   bool sanitize_shallow (hb_sanitize_context_t *c) const
   {
     TRACE_SANITIZE (this);
-    return_trace (c->check_struct (this) && (version.major == 1) &&
+    return_trace (c->check_struct (this) &&
+                  hb_barrier () &&
+                  (version.major == 1) &&
                   sharedTuples.sanitize (c, this, axisCount * sharedTupleCount) &&
                   (is_long_offset () ?
                      c->check_array (get_long_offset_array (), c->get_num_glyphs () + 1) :
@@ -308,7 +346,7 @@ struct gvar
   { return sanitize_shallow (c); }
 
   bool decompile_glyph_variations (hb_subset_context_t *c,
-                                   glyph_variations_t& glyph_vars /* OUT */) const
+                                   glyph_variations_t& glyph_vars /* OUT */) const
   {
     hb_hashmap_t new_gid_var_data_map;
     auto it = hb_iter (c->plan->new_to_old_gid_list);
@@ -335,13 +373,14 @@ struct gvar
   template
   bool serialize (hb_serialize_context_t *c,
-                  const glyph_variations_t& glyph_vars,
+                  const glyph_variations_t& glyph_vars,
                   Iterator it,
                   unsigned axis_count,
-                  unsigned num_glyphs) const
+                  unsigned num_glyphs,
+                  bool force_long_offsets) const
   {
     TRACE_SERIALIZE (this);
-    gvar *out = c->allocate_min ();
+    gvar_GVAR *out = c->allocate_min ();
     if (unlikely (!out)) return_trace (false);
 
     out->version.major = 1;
@@ -350,7 +389,10 @@ struct gvar
     out->glyphCountX = hb_min (0xFFFFu, num_glyphs);
 
     unsigned glyph_var_data_size = glyph_vars.compiled_byte_size ();
-    bool long_offset = glyph_var_data_size & ~0xFFFFu;
+    /* According to the spec: If the short format (Offset16) is used for offsets,
+     * the value stored is the offset divided by 2, so the maximum data size should
+     * be 2 * 0xFFFFu, which is 0x1FFFEu */
+    bool long_offset = glyph_var_data_size > 0x1FFFEu || force_long_offsets;
     out->flags = long_offset ? 1 : 0;
 
     HBUINT8 *glyph_var_data_offsets = c->allocate_size ((long_offset ? 4 : 2) * (num_glyphs + 1), false);
@@ -380,7 +422,7 @@ struct gvar
   bool instantiate (hb_subset_context_t *c) const
   {
     TRACE_SUBSET (this);
-    glyph_variations_t glyph_vars;
+    glyph_variations_t glyph_vars;
     if (!decompile_glyph_variations (c, glyph_vars))
       return_trace (false);
 
@@ -391,7 +433,12 @@ struct gvar
     unsigned axis_count = c->plan->axes_index_map.get_population ();
     unsigned num_glyphs = c->plan->num_output_glyphs ();
     auto it = hb_iter (c->plan->new_to_old_gid_list);
-    return_trace (serialize (c->serializer, glyph_vars, it, axis_count, num_glyphs));
+
+    bool force_long_offsets = false;
+#ifdef HB_EXPERIMENTAL_API
+    force_long_offsets = c->plan->flags & HB_SUBSET_FLAGS_IFTB_REQUIREMENTS;
+#endif
+    return_trace (serialize (c->serializer, glyph_vars, it, axis_count, num_glyphs, force_long_offsets));
   }
 
   bool subset (hb_subset_context_t *c) const
@@ -405,7 +452,7 @@ struct gvar
 
     unsigned glyph_count = version.to_int () ? c->plan->source->get_num_glyphs () : 0;
 
-    gvar *out = c->serializer->allocate_min ();
+    gvar_GVAR *out = c->serializer->allocate_min ();
     if (unlikely (!out)) return_trace (false);
 
     out->version.major = 1;
@@ -426,7 +473,13 @@ struct gvar
       subset_data_size += get_glyph_var_data_bytes (c->source_blob, glyph_count, old_gid).length;
     }
 
-    bool long_offset = subset_data_size & ~0xFFFFu;
+    /* According to the spec: If the short format (Offset16) is used for offsets,
+     * the value stored is the offset divided by 2, so the maximum data size should
+     * be 2 * 0xFFFFu, which is 0x1FFFEu */
+    bool long_offset = subset_data_size > 0x1FFFEu;
+#ifdef HB_EXPERIMENTAL_API
+    long_offset = long_offset || (c->plan->flags & HB_SUBSET_FLAGS_IFTB_REQUIREMENTS);
+#endif
     out->flags = long_offset ? 1 : 0;
 
     HBUINT8 *subset_offsets = c->serializer->allocate_size ((long_offset ? 4 : 2) * (num_glyphs + 1), false);
@@ -444,6 +497,8 @@ struct gvar
       hb_memcpy (tuples, this+sharedTuples, shared_tuple_size);
     }
 
+    /* This ordering relative to the shared tuples array, which puts the glyphVariationData
+       last in the table, is required when HB_SUBSET_FLAGS_IFTB_REQUIREMENTS is set */
     char *subset_data = c->serializer->allocate_size (subset_data_size, false);
     if (!subset_data) return_trace (false);
     out->dataZ = subset_data - (char *) out;
@@ -521,7 +576,7 @@ struct gvar
   unsigned get_offset (unsigned glyph_count, unsigned i) const
   {
     if (unlikely (i > glyph_count)) return 0;
-    _hb_compiler_memory_r_barrier ();
+    hb_barrier ();
     return is_long_offset () ? get_long_offset_array ()[i] : get_short_offset_array ()[i] * 2;
   }
 
@@ -531,9 +586,11 @@ struct gvar
   public:
   struct accelerator_t
   {
+    bool has_data () const { return table->has_data (); }
+
     accelerator_t (hb_face_t *face)
     {
-      table = hb_sanitize_context_t ().reference_table (face);
+      table = hb_sanitize_context_t ().reference_table (face);
       /* If sanitize failed, set glyphCount to 0. */
       glyphCount = table->version.to_int () ? face->get_num_glyphs () : 0;
 
@@ -599,37 +656,42 @@ struct gvar
 
     public:
     bool apply_deltas_to_points (hb_codepoint_t glyph,
-                                 hb_array_t coords,
+                                 hb_array_t coords,
                                  const hb_array_t points,
+                                 hb_glyf_scratch_t &scratch,
                                  bool phantom_only = false) const
     {
       if (unlikely (glyph >= glyphCount)) return true;
 
       hb_bytes_t var_data_bytes = table->get_glyph_var_data_bytes (table.get_blob (), glyphCount, glyph);
       if (!var_data_bytes.as ()->has_data ()) return true;
-      hb_vector_t shared_indices;
-      GlyphVariationData::tuple_iterator_t iterator;
+
+      auto &shared_indices = scratch.shared_indices;
+      shared_indices.clear ();
+
+      typename GlyphVariationData::tuple_iterator_t iterator;
       if (!GlyphVariationData::get_tuple_iterator (var_data_bytes, table->axisCount,
                                                    var_data_bytes.arrayZ,
                                                    shared_indices, &iterator))
         return true; /* so isn't applied at all */
 
       /* Save original points for inferred delta calculation */
-      contour_point_vector_t orig_points_vec; // Populated lazily
+      auto &orig_points_vec = scratch.orig_points;
+      orig_points_vec.clear (); // Populated lazily
       auto orig_points = orig_points_vec.as_array ();
 
       /* flag is used to indicate referenced point */
-      contour_point_vector_t deltas_vec; // Populated lazily
+      auto &deltas_vec = scratch.deltas;
+      deltas_vec.clear (); // Populated lazily
       auto deltas = deltas_vec.as_array ();
 
-      hb_vector_t end_points; // Populated lazily
-
       unsigned num_coords = table->axisCount;
       hb_array_t shared_tuples = (table+table->sharedTuples).as_array (table->sharedTupleCount * num_coords);
 
-      hb_vector_t private_indices;
-      hb_vector_t x_deltas;
-      hb_vector_t y_deltas;
+      auto &private_indices = scratch.private_indices;
+      auto &x_deltas = scratch.x_deltas;
+      auto &y_deltas = scratch.y_deltas;
+
       unsigned count = points.length;
       bool flush = false;
       do
@@ -654,16 +716,16 @@ struct gvar
 
         bool has_private_points = iterator.current_tuple->has_private_points ();
         if (has_private_points &&
-            !GlyphVariationData::unpack_points (p, private_indices, end))
+            !GlyphVariationData::decompile_points (p, private_indices, end))
           return false;
         const hb_array_t &indices = has_private_points ? private_indices : shared_indices;
 
         bool apply_to_all = (indices.length == 0);
         unsigned int num_deltas = apply_to_all ? points.length : indices.length;
         if (unlikely (!x_deltas.resize (num_deltas, false))) return false;
-        if (unlikely (!GlyphVariationData::unpack_deltas (p, x_deltas, end))) return false;
+        if (unlikely (!GlyphVariationData::decompile_deltas (p, x_deltas, end))) return false;
         if (unlikely (!y_deltas.resize (num_deltas, false))) return false;
-        if (unlikely (!GlyphVariationData::unpack_deltas (p, y_deltas, end))) return false;
+        if (unlikely (!GlyphVariationData::decompile_deltas (p, y_deltas, end))) return false;
 
         if (!apply_to_all)
         {
@@ -700,8 +762,8 @@ struct gvar
             if (phantom_only && pt_index < count - 4) continue;
             auto &delta = deltas.arrayZ[pt_index];
             delta.flag = 1;     /* this point is referenced, i.e., explicit deltas specified */
-            delta.x += x_deltas.arrayZ[i] * scalar;
-            delta.y += y_deltas.arrayZ[i] * scalar;
+            delta.add_delta (x_deltas.arrayZ[i] * scalar,
+                             y_deltas.arrayZ[i] * scalar);
           }
         }
         else
@@ -712,10 +774,9 @@ struct gvar
             if (apply_to_all)
               for (unsigned int i = phantom_only ? count - 4 : 0; i < count; i++)
               {
-                unsigned int pt_index = i;
-                auto &delta = deltas.arrayZ[pt_index];
-                delta.x += x_deltas.arrayZ[i] * scalar;
-                delta.y += y_deltas.arrayZ[i] * scalar;
+                auto &delta = deltas.arrayZ[i];
+                delta.add_delta (x_deltas.arrayZ[i] * scalar,
+                                 y_deltas.arrayZ[i] * scalar);
               }
             else
               for (unsigned int i = 0; i < num_deltas; i++)
@@ -725,8 +786,8 @@ struct gvar
                 if (phantom_only && pt_index < count - 4) continue;
                 auto &delta = deltas.arrayZ[pt_index];
                 delta.flag = 1; /* this point is referenced, i.e., explicit deltas specified */
-                delta.x += x_deltas.arrayZ[i] * scalar;
-                delta.y += y_deltas.arrayZ[i] * scalar;
+                delta.add_delta (x_deltas.arrayZ[i] * scalar,
+                                 y_deltas.arrayZ[i] * scalar);
               }
           }
           else
@@ -734,10 +795,9 @@ struct gvar
             if (apply_to_all)
               for (unsigned int i = phantom_only ? count - 4 : 0; i < count; i++)
               {
-                unsigned int pt_index = i;
-                auto &delta = deltas.arrayZ[pt_index];
-                delta.x += x_deltas.arrayZ[i];
-                delta.y += y_deltas.arrayZ[i];
+                auto &delta = deltas.arrayZ[i];
+                delta.add_delta (x_deltas.arrayZ[i],
+                                 y_deltas.arrayZ[i]);
               }
             else
               for (unsigned int i = 0; i < num_deltas; i++)
@@ -747,8 +807,8 @@ struct gvar
                 if (phantom_only && pt_index < count - 4) continue;
                 auto &delta = deltas.arrayZ[pt_index];
                 delta.flag = 1; /* this point is referenced, i.e., explicit deltas specified */
-                delta.x += x_deltas.arrayZ[i];
-                delta.y += y_deltas.arrayZ[i];
+                delta.add_delta (x_deltas.arrayZ[i],
+                                 y_deltas.arrayZ[i]);
               }
           }
         }
@@ -756,17 +816,14 @@ struct gvar
         /* infer deltas for unreferenced points */
         if (!apply_to_all && !phantom_only)
         {
-          if (!end_points)
-          {
-            for (unsigned i = 0; i < count; ++i)
-              if (points.arrayZ[i].is_end_point)
-                end_points.push (i);
-            if (unlikely (end_points.in_error ())) return false;
-          }
-
           unsigned start_point = 0;
-          for (unsigned end_point : end_points)
+          unsigned end_point = 0;
+          while (true)
           {
+            while (end_point < count && !points.arrayZ[end_point].is_end_point)
+              end_point++;
+            if (unlikely (end_point == count)) break;
+
             /* Check the number of unreferenced points in a contour. If no unref points or no ref points, nothing to do. */
             unsigned unref_count = 0;
             for (unsigned i = start_point; i < end_point + 1; i++)
@@ -809,7 +866,7 @@ struct gvar
               }
             }
           no_more_gaps:
-            start_point = end_point + 1;
+            start_point = end_point = end_point + 1;
           }
         }
 
@@ -829,7 +886,7 @@ struct gvar
     unsigned int get_axis_count () const { return table->axisCount; }
 
     private:
-    hb_blob_ptr_t table;
+    hb_blob_ptr_t table;
     unsigned glyphCount;
     hb_vector_t> shared_tuple_active_idx;
   };
@@ -847,7 +904,7 @@ struct gvar
   NNOffset32To>
                 sharedTuples;   /* Offset from the start of this table to the shared tuple records.
                                  * Array of tuple records shared across all glyph variation data tables. */
-  HBUINT16      glyphCountX;    /* The number of glyphs in this font. This must match the number of
+  GidOffsetType glyphCountX;    /* The number of glyphs in this font. This must match the number of
                                  * glyphs stored elsewhere in the font. */
   HBUINT16      flags;          /* Bit-field that gives the format of the offset array that follows.
                                  * If bit 0 is clear, the offsets are uint16; if bit 0 is set, the
@@ -862,9 +919,15 @@ struct gvar
   DEFINE_SIZE_ARRAY (20, offsetZ);
 };
 
+using gvar = gvar_GVAR;
+using GVAR = gvar_GVAR;
+
 struct gvar_accelerator_t : gvar::accelerator_t {
   gvar_accelerator_t (hb_face_t *face) : gvar::accelerator_t (face) {}
 };
+struct GVAR_accelerator_t : GVAR::accelerator_t {
+  GVAR_accelerator_t (hb_face_t *face) : GVAR::accelerator_t (face) {}
+};
 
 } /* namespace OT */
 
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-var-hvar-table.hh b/src/java.desktop/share/native/libharfbuzz/hb-ot-var-hvar-table.hh
index c1b40dcb49d9..40a85a62b788 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-ot-var-hvar-table.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-var-hvar-table.hh
@@ -188,7 +188,7 @@ struct hvarvvar_subset_plan_t
   ~hvarvvar_subset_plan_t() { fini (); }
 
   void init (const hb_array_t &index_maps,
-             const VariationStore &_var_store,
+             const ItemVariationStore &_var_store,
              const hb_subset_plan_t *plan)
   {
     index_map_plans.resize (index_maps.length);
@@ -263,7 +263,7 @@ struct hvarvvar_subset_plan_t
   hb_inc_bimap_t outer_map;
   hb_vector_t inner_maps;
   hb_vector_t index_map_plans;
-  const VariationStore *var_store;
+  const ItemVariationStore *var_store;
 
   protected:
   hb_vector_t inner_sets;
@@ -288,6 +288,7 @@ struct HVARVVAR
   {
     TRACE_SANITIZE (this);
     return_trace (version.sanitize (c) &&
+                  hb_barrier () &&
                   likely (version.major == 1) &&
                   varStore.sanitize (c, this) &&
                   advMap.sanitize (c, this) &&
@@ -295,7 +296,7 @@ struct HVARVVAR
                   rsbMap.sanitize (c, this));
   }
 
-  const VariationStore& get_var_store () const
+  const ItemVariationStore& get_var_store () const
   { return this+varStore; }
 
   void listup_index_maps (hb_vector_t &index_maps) const
@@ -383,7 +384,7 @@ struct HVARVVAR
 
   float get_advance_delta_unscaled (hb_codepoint_t  glyph,
                                     const int *coords, unsigned int coord_count,
-                                    VariationStore::cache_t *store_cache = nullptr) const
+                                    ItemVariationStore::cache_t *store_cache = nullptr) const
   {
     uint32_t varidx = (this+advMap).map (glyph);
     return (this+varStore).get_delta (varidx,
@@ -404,7 +405,7 @@ struct HVARVVAR
   public:
   FixedVersion<>version;        /* Version of the metrics variation table
                                  * initially set to 0x00010000u */
-  Offset32To
+  Offset32To
                 varStore;       /* Offset to item variation store table. */
   Offset32To
                 advMap;         /* Offset to advance var-idx mapping. */
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-var-mvar-table.hh b/src/java.desktop/share/native/libharfbuzz/hb-ot-var-mvar-table.hh
index ced04d89da3c..c5a58d6f6bf9 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-ot-var-mvar-table.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-var-mvar-table.hh
@@ -56,7 +56,7 @@ struct VariationValueRecord
 
   public:
   Tag           valueTag;       /* Four-byte tag identifying a font-wide measure. */
-  VarIdx        varIdx;         /* Outer/inner index into VariationStore item. */
+  VarIdx        varIdx;         /* Outer/inner index into ItemVariationStore item. */
 
   public:
   DEFINE_SIZE_STATIC (8);
@@ -77,8 +77,10 @@ struct MVAR
   {
     TRACE_SANITIZE (this);
     return_trace (version.sanitize (c) &&
+                  hb_barrier () &&
                   likely (version.major == 1) &&
                   c->check_struct (this) &&
+                  hb_barrier () &&
                   valueRecordSize >= VariationValueRecord::static_size &&
                   varStore.sanitize (c, this) &&
                   c->check_range (valuesZ.arrayZ,
@@ -104,7 +106,7 @@ struct MVAR
     out->valueRecordCount = valueRecordCount;
 
     item_variations_t item_vars;
-    const VariationStore& src_var_store = this+varStore;
+    const ItemVariationStore& src_var_store = this+varStore;
 
     if (!item_vars.instantiate (src_var_store, c->plan))
       return_trace (false);
@@ -157,7 +159,7 @@ protected:
   HBUINT16      valueRecordSize;/* The size in bytes of each value record —
                                  * must be greater than zero. */
   HBUINT16      valueRecordCount;/* The number of value records — may be zero. */
-  Offset16To
+  Offset16To
                 varStore;       /* Offset to item variation store table. */
   UnsizedArrayOf
                 valuesZ;        /* Array of value records. The records must be
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-var-varc-table.hh b/src/java.desktop/share/native/libharfbuzz/hb-ot-var-varc-table.hh
new file mode 100644
index 000000000000..603aeb258cf1
--- /dev/null
+++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-var-varc-table.hh
@@ -0,0 +1,32 @@
+/*
+ * Copyright © 2024  Google, Inc.
+ *
+ *  This is part of HarfBuzz, a text shaping library.
+ *
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, provided that the
+ * above copyright notice and the following two paragraphs appear in
+ * all copies of this software.
+ *
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
+ * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
+ * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ * Google Author(s): Behdad Esfahbod
+ */
+
+#ifndef HB_OT_VAR_VARC_TABLE_HH
+#define HB_OT_VAR_VARC_TABLE_HH
+
+#include "OT/Var/VARC/VARC.hh"
+
+#endif /* HB_OT_VAR_VARC_TABLE_HH */
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ot-vorg-table.hh b/src/java.desktop/share/native/libharfbuzz/hb-ot-vorg-table.hh
index dd3039924ef1..b2300a327da2 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-ot-vorg-table.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-ot-vorg-table.hh
@@ -117,6 +117,7 @@ struct VORG
   {
     TRACE_SANITIZE (this);
     return_trace (c->check_struct (this) &&
+                  hb_barrier () &&
                   version.major == 1 &&
                   vertYOrigins.sanitize (c));
   }
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-paint-extents.hh b/src/java.desktop/share/native/libharfbuzz/hb-paint-extents.hh
index 518228c414b5..18aa638c7adf 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-paint-extents.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-paint-extents.hh
@@ -28,169 +28,8 @@
 #include "hb.hh"
 #include "hb-paint.h"
 
+#include "hb-geometry.hh"
 
-typedef struct hb_extents_t
-{
-  hb_extents_t () {}
-  hb_extents_t (float xmin, float ymin, float xmax, float ymax) :
-    xmin (xmin), ymin (ymin), xmax (xmax), ymax (ymax) {}
-
-  bool is_empty () const { return xmin >= xmax || ymin >= ymax; }
-  bool is_void () const { return xmin > xmax; }
-
-  void union_ (const hb_extents_t &o)
-  {
-    xmin = hb_min (xmin, o.xmin);
-    ymin = hb_min (ymin, o.ymin);
-    xmax = hb_max (xmax, o.xmax);
-    ymax = hb_max (ymax, o.ymax);
-  }
-
-  void intersect (const hb_extents_t &o)
-  {
-    xmin = hb_max (xmin, o.xmin);
-    ymin = hb_max (ymin, o.ymin);
-    xmax = hb_min (xmax, o.xmax);
-    ymax = hb_min (ymax, o.ymax);
-  }
-
-  void
-  add_point (float x, float y)
-  {
-    if (unlikely (is_void ()))
-    {
-      xmin = xmax = x;
-      ymin = ymax = y;
-    }
-    else
-    {
-      xmin = hb_min (xmin, x);
-      ymin = hb_min (ymin, y);
-      xmax = hb_max (xmax, x);
-      ymax = hb_max (ymax, y);
-    }
-  }
-
-  float xmin = 0.f;
-  float ymin = 0.f;
-  float xmax = -1.f;
-  float ymax = -1.f;
-} hb_extents_t;
-
-typedef struct hb_transform_t
-{
-  hb_transform_t () {}
-  hb_transform_t (float xx, float yx,
-                  float xy, float yy,
-                  float x0, float y0) :
-    xx (xx), yx (yx), xy (xy), yy (yy), x0 (x0), y0 (y0) {}
-
-  void multiply (const hb_transform_t &o)
-  {
-    /* Copied from cairo, with "o" being "a" there and "this" being "b" there. */
-    hb_transform_t r;
-
-    r.xx = o.xx * xx + o.yx * xy;
-    r.yx = o.xx * yx + o.yx * yy;
-
-    r.xy = o.xy * xx + o.yy * xy;
-    r.yy = o.xy * yx + o.yy * yy;
-
-    r.x0 = o.x0 * xx + o.y0 * xy + x0;
-    r.y0 = o.x0 * yx + o.y0 * yy + y0;
-
-    *this = r;
-  }
-
-  void transform_distance (float &dx, float &dy) const
-  {
-    float new_x = xx * dx + xy * dy;
-    float new_y = yx * dx + yy * dy;
-    dx = new_x;
-    dy = new_y;
-  }
-
-  void transform_point (float &x, float &y) const
-  {
-    transform_distance (x, y);
-    x += x0;
-    y += y0;
-  }
-
-  void transform_extents (hb_extents_t &extents) const
-  {
-    float quad_x[4], quad_y[4];
-
-    quad_x[0] = extents.xmin;
-    quad_y[0] = extents.ymin;
-    quad_x[1] = extents.xmin;
-    quad_y[1] = extents.ymax;
-    quad_x[2] = extents.xmax;
-    quad_y[2] = extents.ymin;
-    quad_x[3] = extents.xmax;
-    quad_y[3] = extents.ymax;
-
-    extents = hb_extents_t {};
-    for (unsigned i = 0; i < 4; i++)
-    {
-      transform_point (quad_x[i], quad_y[i]);
-      extents.add_point (quad_x[i], quad_y[i]);
-    }
-  }
-
-  float xx = 1.f;
-  float yx = 0.f;
-  float xy = 0.f;
-  float yy = 1.f;
-  float x0 = 0.f;
-  float y0 = 0.f;
-} hb_transform_t;
-
-typedef struct hb_bounds_t
-{
-  enum status_t {
-    UNBOUNDED,
-    BOUNDED,
-    EMPTY,
-  };
-
-  hb_bounds_t (status_t status) : status (status) {}
-  hb_bounds_t (const hb_extents_t &extents) :
-    status (extents.is_empty () ? EMPTY : BOUNDED), extents (extents) {}
-
-  void union_ (const hb_bounds_t &o)
-  {
-    if (o.status == UNBOUNDED)
-      status = UNBOUNDED;
-    else if (o.status == BOUNDED)
-    {
-      if (status == EMPTY)
-        *this = o;
-      else if (status == BOUNDED)
-        extents.union_ (o.extents);
-    }
-  }
-
-  void intersect (const hb_bounds_t &o)
-  {
-    if (o.status == EMPTY)
-      status = EMPTY;
-    else if (o.status == BOUNDED)
-    {
-      if (status == UNBOUNDED)
-        *this = o;
-      else if (status == BOUNDED)
-      {
-        extents.intersect (o.extents);
-        if (extents.is_empty ())
-          status = EMPTY;
-      }
-    }
-  }
-
-  status_t status;
-  hb_extents_t extents;
-} hb_bounds_t;
 
 typedef struct  hb_paint_extents_context_t hb_paint_extents_context_t;
 
@@ -231,7 +70,10 @@ struct hb_paint_extents_context_t
     const hb_transform_t &t = transforms.tail ();
     t.transform_extents (extents);
 
-    clips.push (hb_bounds_t {extents});
+    auto bounds = hb_bounds_t {extents};
+    bounds.intersect (clips.tail ());
+
+    clips.push (bounds);
   }
 
   void pop_clip ()
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-paint.h b/src/java.desktop/share/native/libharfbuzz/hb-paint.h
index 6215488e2e7b..f0d9438506d7 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-paint.h
+++ b/src/java.desktop/share/native/libharfbuzz/hb-paint.h
@@ -146,7 +146,7 @@ typedef void (*hb_paint_pop_transform_func_t) (hb_paint_funcs_t *funcs,
  *
  * A virtual method for the #hb_paint_funcs_t to render a color glyph by glyph index.
  *
- * Return value: %true if the glyph was painted, %false otherwise.
+ * Return value: `true` if the glyph was painted, `false` otherwise.
  *
  * Since: 8.2.0
  */
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-priority-queue.hh b/src/java.desktop/share/native/libharfbuzz/hb-priority-queue.hh
index 2c8ccbfb6885..274d5df4c541 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-priority-queue.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-priority-queue.hh
@@ -55,6 +55,9 @@ struct hb_priority_queue_t
 
   bool in_error () const { return heap.in_error (); }
 
+  bool alloc (unsigned size)
+  { return heap.alloc (size); }
+
 #ifndef HB_OPTIMIZE_SIZE
   HB_ALWAYS_INLINE
 #endif
@@ -160,7 +163,7 @@ struct hb_priority_queue_t
     goto repeat;
   }
 
-  void swap (unsigned a, unsigned b)
+  void swap (unsigned a, unsigned b) noexcept
   {
     assert (a < heap.length);
     assert (b < heap.length);
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-repacker.hh b/src/java.desktop/share/native/libharfbuzz/hb-repacker.hh
index e9cd376ad372..cb4fdeead2e1 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-repacker.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-repacker.hh
@@ -238,6 +238,54 @@ bool _try_isolating_subgraphs (const hb_vector_t& over
   return true;
 }
 
+static inline
+bool _resolve_shared_overflow(const hb_vector_t& overflows,
+                              int overflow_index,
+                              graph_t& sorted_graph)
+{
+  const graph::overflow_record_t& r = overflows[overflow_index];
+
+  // Find all of the parents in overflowing links that link to this
+  // same child node. We will then try duplicating the child node and
+  // re-assigning all of these parents to the duplicate.
+  hb_set_t parents;
+  parents.add(r.parent);
+  for (int i = overflow_index - 1; i >= 0; i--) {
+    const graph::overflow_record_t& r2 = overflows[i];
+    if (r2.child == r.child) {
+      parents.add(r2.parent);
+    }
+  }
+
+  unsigned result = sorted_graph.duplicate(&parents, r.child);
+  if (result == (unsigned) -1 && parents.get_population() > 2) {
+    // All links to the child are overflowing, so we can't include all
+    // in the duplication. Remove one parent from the duplication.
+    // Remove the lowest index parent, which will be the closest to the child.
+    parents.del(parents.get_min());
+    result = sorted_graph.duplicate(&parents, r.child);
+  }
+
+  if (result == (unsigned) -1) return result;
+
+  if (parents.get_population() > 1) {
+    // If the duplicated node has more than one parent pre-emptively raise it's priority to the maximum.
+    // This will place it close to the parents. Node's with only one parent, don't need this as normal overflow
+    // resolution will raise priority if needed.
+    //
+    // Reasoning: most of the parents to this child are likely at the same layer in the graph. Duplicating
+    // the child will theoretically allow it to be placed closer to it's parents. However, due to the shortest
+    // distance sort by default it's placement will remain in the same layer, thus it will remain in roughly the
+    // same position (and distance from parents) as the original child node. The overflow resolution will attempt
+    // to move nodes closer, but only for non-shared nodes. Since this node is shared, it will simply be given
+    // further duplication which defeats the attempt to duplicate with multiple parents. To fix this we
+    // pre-emptively raise priority now which allows the duplicated node to pack into the same layer as it's parents.
+    sorted_graph.vertices_[result].give_max_priority();
+  }
+
+  return result;
+}
+
 static inline
 bool _process_overflows (const hb_vector_t& overflows,
                          hb_set_t& priority_bumped_parents,
@@ -254,7 +302,7 @@ bool _process_overflows (const hb_vector_t& overflows,
     {
       // The child object is shared, we may be able to eliminate the overflow
       // by duplicating it.
-      if (sorted_graph.duplicate (r.parent, r.child) == (unsigned) -1) continue;
+      if (!_resolve_shared_overflow(overflows, i, sorted_graph)) continue;
       return true;
     }
 
@@ -289,9 +337,10 @@ bool _process_overflows (const hb_vector_t& overflows,
 inline bool
 hb_resolve_graph_overflows (hb_tag_t table_tag,
                             unsigned max_rounds ,
-                            bool recalculate_extensions,
+                            bool always_recalculate_extensions,
                             graph_t& sorted_graph /* IN/OUT */)
 {
+  DEBUG_MSG (SUBSET_REPACK, nullptr, "Repacking %c%c%c%c.", HB_UNTAG(table_tag));
   sorted_graph.sort_shortest_distance ();
   if (sorted_graph.in_error ())
   {
@@ -303,12 +352,12 @@ hb_resolve_graph_overflows (hb_tag_t table_tag,
   if (!will_overflow)
     return true;
 
+  bool is_gsub_or_gpos = (table_tag == HB_OT_TAG_GPOS ||  table_tag == HB_OT_TAG_GSUB);
   graph::gsubgpos_graph_context_t ext_context (table_tag, sorted_graph);
-  if ((table_tag == HB_OT_TAG_GPOS
-       ||  table_tag == HB_OT_TAG_GSUB)
-      && will_overflow)
+  if (is_gsub_or_gpos && will_overflow)
   {
-    if (recalculate_extensions)
+    DEBUG_MSG (SUBSET_REPACK, nullptr, "Applying GSUB/GPOS repacking specializations.");
+    if (always_recalculate_extensions)
     {
       DEBUG_MSG (SUBSET_REPACK, nullptr, "Splitting subtables if needed.");
       if (!_presplit_subtables_if_needed (ext_context)) {
@@ -364,6 +413,13 @@ hb_resolve_graph_overflows (hb_tag_t table_tag,
 
   if (graph::will_overflow (sorted_graph))
   {
+    if (is_gsub_or_gpos && !always_recalculate_extensions) {
+      // If this a GSUB/GPOS table and we didn't try to extension promotion and table splitting then
+      // as a last ditch effort, re-run the repacker with it enabled.
+      DEBUG_MSG (SUBSET_REPACK, nullptr, "Failed to find a resolution. Re-running with extension promotion and table splitting enabled.");
+      return hb_resolve_graph_overflows (table_tag, max_rounds, true, sorted_graph);
+    }
+
     DEBUG_MSG (SUBSET_REPACK, nullptr, "Offset overflow resolution failed.");
     return false;
   }
@@ -388,7 +444,7 @@ template
 inline hb_blob_t*
 hb_resolve_overflows (const T& packed,
                       hb_tag_t table_tag,
-                      unsigned max_rounds = 20,
+                      unsigned max_rounds = 32,
                       bool recalculate_extensions = false) {
   graph_t sorted_graph (packed);
   if (sorted_graph.in_error ())
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-sanitize.hh b/src/java.desktop/share/native/libharfbuzz/hb-sanitize.hh
index 3a6ec4fed9c0..1f8ba32bae20 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-sanitize.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-sanitize.hh
@@ -72,8 +72,8 @@
  *
  * === The sanitize() contract ===
  *
- * The sanitize() method of each object type shall return true if it's safe to
- * call other methods of the object, and %false otherwise.
+ * The sanitize() method of each object type shall return `true` if it's safe to
+ * call other methods of the object, and `false` otherwise.
  *
  * Note that what sanitize() checks for might align with what the specification
  * describes as valid table data, but does not have to be.  In particular, we
@@ -134,7 +134,10 @@ struct hb_sanitize_context_t :
   const char *get_name () { return "SANITIZE"; }
   template 
   bool may_dispatch (const T *obj HB_UNUSED, const F *format)
-  { return format->sanitize (this); }
+  {
+    return format->sanitize (this) &&
+           hb_barrier ();
+  }
   static return_t default_return_value () { return true; }
   static return_t no_dispatch_return_value () { return false; }
   bool stop_sublookup_iteration (const return_t r) const { return !r; }
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-serialize.hh b/src/java.desktop/share/native/libharfbuzz/hb-serialize.hh
index 675eb03cadf2..704d0ffd12ba 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-serialize.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-serialize.hh
@@ -36,9 +36,7 @@
 #include "hb-map.hh"
 #include "hb-pool.hh"
 
-#ifdef HB_EXPERIMENTAL_API
-#include "hb-subset-repacker.h"
-#endif
+#include "hb-subset-serialize.h"
 
 /*
  * Serialize
@@ -75,23 +73,41 @@ struct hb_serialize_context_t
 
     object_t () = default;
 
-#ifdef HB_EXPERIMENTAL_API
-    object_t (const hb_object_t &o)
+    object_t (const hb_subset_serialize_object_t &o)
     {
       head = o.head;
       tail = o.tail;
       next = nullptr;
-      real_links.alloc (o.num_real_links, true);
+      real_links.alloc_exact (o.num_real_links);
       for (unsigned i = 0 ; i < o.num_real_links; i++)
         real_links.push (o.real_links[i]);
 
-      virtual_links.alloc (o.num_virtual_links, true);
+      virtual_links.alloc_exact (o.num_virtual_links);
       for (unsigned i = 0; i < o.num_virtual_links; i++)
         virtual_links.push (o.virtual_links[i]);
     }
-#endif
 
-    friend void swap (object_t& a, object_t& b)
+    bool add_virtual_link (objidx_t objidx)
+    {
+      if (!objidx)
+        return false;
+
+      auto& link = *virtual_links.push ();
+      if (virtual_links.in_error ())
+        return false;
+
+      link.objidx = objidx;
+      // Remaining fields were previously zero'd by push():
+      // link.width = 0;
+      // link.is_signed = 0;
+      // link.whence = 0;
+      // link.position = 0;
+      // link.bias = 0;
+
+      return true;
+    }
+
+    friend void swap (object_t& a, object_t& b) noexcept
     {
       hb_swap (a.head, b.head);
       hb_swap (a.tail, b.tail);
@@ -128,8 +144,7 @@ struct hb_serialize_context_t
 
       link_t () = default;
 
-#ifdef HB_EXPERIMENTAL_API
-      link_t (const hb_link_t &o)
+      link_t (const hb_subset_serialize_link_t &o)
       {
         width = o.width;
         is_signed = 0;
@@ -138,7 +153,6 @@ struct hb_serialize_context_t
         bias = 0;
         objidx = o.objidx;
       }
-#endif
 
       HB_INTERNAL static int cmp (const void* a, const void* b)
       {
@@ -156,9 +170,9 @@ struct hb_serialize_context_t
     object_t *next;
 
     auto all_links () const HB_AUTO_RETURN
-        (( hb_concat (this->real_links, this->virtual_links) ));
+        (( hb_concat (real_links, virtual_links) ));
     auto all_links_writer () HB_AUTO_RETURN
-        (( hb_concat (this->real_links.writer (), this->virtual_links.writer ()) ));
+        (( hb_concat (real_links.writer (), virtual_links.writer ()) ));
   };
 
   struct snapshot_t
@@ -380,6 +394,7 @@ struct hb_serialize_context_t
       {
         merge_virtual_links (obj, objidx);
         obj->fini ();
+        object_pool.release (obj);
         return objidx;
       }
     }
@@ -443,9 +458,11 @@ struct hb_serialize_context_t
     while (packed.length > 1 &&
            packed.tail ()->head < tail)
     {
-      packed_map.del (packed.tail ());
-      assert (!packed.tail ()->next);
-      packed.tail ()->fini ();
+      object_t *obj = packed.tail ();
+      packed_map.del (obj);
+      assert (!obj->next);
+      obj->fini ();
+      object_pool.release (obj);
       packed.pop ();
     }
     if (packed.length > 1)
@@ -469,16 +486,40 @@ struct hb_serialize_context_t
 
     assert (current);
 
-    auto& link = *current->virtual_links.push ();
-    if (current->virtual_links.in_error ())
+    if (!current->add_virtual_link(objidx))
       err (HB_SERIALIZE_ERROR_OTHER);
+  }
 
-    link.width = 0;
-    link.objidx = objidx;
-    link.is_signed = 0;
-    link.whence = 0;
-    link.position = 0;
-    link.bias = 0;
+  objidx_t last_added_child_index() const {
+    if (unlikely (in_error ())) return (objidx_t) -1;
+
+    assert (current);
+    if (!bool(current->real_links)) {
+      return (objidx_t) -1;
+    }
+
+    return current->real_links[current->real_links.length - 1].objidx;
+  }
+
+  // For the current object ensure that the sub-table bytes for child objidx are always placed
+  // after the subtable bytes for any other existing children. This only ensures that the
+  // repacker will not move the target subtable before the other children
+  // (by adding virtual links). It is up to the caller to ensure the initial serialization
+  // order is correct.
+  void repack_last(objidx_t objidx) {
+    if (unlikely (in_error ())) return;
+
+    if (!objidx)
+      return;
+
+    assert (current);
+    for (auto& l : current->real_links) {
+      if (l.objidx == objidx) {
+        continue;
+      }
+
+      packed[l.objidx]->add_virtual_link(objidx);
+    }
   }
 
   template 
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-set-digest.hh b/src/java.desktop/share/native/libharfbuzz/hb-set-digest.hh
index c1e107b4c298..7bd14a281934 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-set-digest.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-set-digest.hh
@@ -56,7 +56,7 @@
  *   - For each glyph, if it doesn't match the subtable digest,
  *     skip it.
  *
- * The main filter we use is a combination of three bits-pattern
+ * The main filter we use is a combination of four bits-pattern
  * filters. A bits-pattern filter checks a number of bits (5 or 6)
  * of the input number (glyph-id in this case) and checks whether
  * its pattern is amongst the patterns of any of the accepted values.
@@ -64,43 +64,60 @@
  * check is done using four bitwise operations only.
  */
 
-template 
-struct hb_set_digest_bits_pattern_t
+static constexpr unsigned hb_set_digest_shifts[] = {4, 0, 6};
+
+struct hb_set_digest_t
 {
+  // No science in these. Intuition and testing only.
+  using mask_t = uint64_t;
+
+  static constexpr unsigned n = ARRAY_LENGTH_CONST (hb_set_digest_shifts);
   static constexpr unsigned mask_bytes = sizeof (mask_t);
   static constexpr unsigned mask_bits = sizeof (mask_t) * 8;
-  static constexpr unsigned num_bits = 0
-                                     + (mask_bytes >= 1 ? 3 : 0)
-                                     + (mask_bytes >= 2 ? 1 : 0)
-                                     + (mask_bytes >= 4 ? 1 : 0)
-                                     + (mask_bytes >= 8 ? 1 : 0)
-                                     + (mask_bytes >= 16? 1 : 0)
-                                     + 0;
+  static constexpr hb_codepoint_t mb1 = mask_bits - 1;
+  static constexpr mask_t one = 1;
+  static constexpr mask_t all = (mask_t) -1;
 
-  static_assert ((shift < sizeof (hb_codepoint_t) * 8), "");
-  static_assert ((shift + num_bits <= sizeof (hb_codepoint_t) * 8), "");
+  void init ()
+  { for (unsigned i = 0; i < n; i++) masks[i] = 0; }
 
-  void init () { mask = 0; }
+  void clear () { init (); }
 
-  void add (const hb_set_digest_bits_pattern_t &o) { mask |= o.mask; }
+  static hb_set_digest_t full ()
+  {
+    hb_set_digest_t d;
+    for (unsigned i = 0; i < n; i++) d.masks[i] = all;
+    return d;
+  }
 
-  void add (hb_codepoint_t g) { mask |= mask_for (g); }
+  void union_ (const hb_set_digest_t &o)
+  { for (unsigned i = 0; i < n; i++) masks[i] |= o.masks[i]; }
 
   bool add_range (hb_codepoint_t a, hb_codepoint_t b)
   {
-    if (mask == (mask_t) -1) return false;
-    if ((b >> shift) - (a >> shift) >= mask_bits - 1)
-    {
-      mask = (mask_t) -1;
-      return false;
-    }
-    else
+    bool ret;
+
+    ret = false;
+    for (unsigned i = 0; i < n; i++)
+      if (masks[i] != all)
+        ret = true;
+    if (!ret) return false;
+
+    ret = false;
+    for (unsigned i = 0; i < n; i++)
     {
-      mask_t ma = mask_for (a);
-      mask_t mb = mask_for (b);
-      mask |= mb + (mb - ma) - (mb < ma);
-      return true;
+      mask_t shift = hb_set_digest_shifts[i];
+      if ((b >> shift) - (a >> shift) >= mb1)
+        masks[i] = all;
+      else
+      {
+        mask_t ma = one << ((a >> shift) & mb1);
+        mask_t mb = one << ((b >> shift) & mb1);
+        masks[i] |= mb + (mb - ma) - (mb < ma);
+        ret = true;
+      }
     }
+    return ret;
   }
 
   template 
@@ -123,95 +140,37 @@ struct hb_set_digest_bits_pattern_t
   template 
   bool add_sorted_array (const hb_sorted_array_t& arr) { return add_sorted_array (&arr, arr.len ()); }
 
-  bool may_have (const hb_set_digest_bits_pattern_t &o) const
-  { return mask & o.mask; }
-
-  bool may_have (hb_codepoint_t g) const
-  { return mask & mask_for (g); }
-
-  private:
-
-  static mask_t mask_for (hb_codepoint_t g)
-  { return ((mask_t) 1) << ((g >> shift) & (mask_bits - 1)); }
-  mask_t mask;
-};
-
-template 
-struct hb_set_digest_combiner_t
-{
-  void init ()
-  {
-    head.init ();
-    tail.init ();
-  }
+  bool operator [] (hb_codepoint_t g) const
+  { return may_have (g); }
 
-  void add (const hb_set_digest_combiner_t &o)
-  {
-    head.add (o.head);
-    tail.add (o.tail);
-  }
 
   void add (hb_codepoint_t g)
   {
-    head.add (g);
-    tail.add (g);
-  }
-
-  bool add_range (hb_codepoint_t a, hb_codepoint_t b)
-  {
-    return (int) head.add_range (a, b) | (int) tail.add_range (a, b);
-  }
-  template 
-  void add_array (const T *array, unsigned int count, unsigned int stride=sizeof(T))
-  {
-    head.add_array (array, count, stride);
-    tail.add_array (array, count, stride);
-  }
-  template 
-  void add_array (const hb_array_t& arr) { add_array (&arr, arr.len ()); }
-  template 
-  bool add_sorted_array (const T *array, unsigned int count, unsigned int stride=sizeof(T))
-  {
-    return head.add_sorted_array (array, count, stride) &&
-           tail.add_sorted_array (array, count, stride);
+    for (unsigned i = 0; i < n; i++)
+      masks[i] |= one << ((g >> hb_set_digest_shifts[i]) & mb1);
   }
-  template 
-  bool add_sorted_array (const hb_sorted_array_t& arr) { return add_sorted_array (&arr, arr.len ()); }
 
-  bool may_have (const hb_set_digest_combiner_t &o) const
+  HB_ALWAYS_INLINE
+  bool may_have (hb_codepoint_t g) const
   {
-    return head.may_have (o.head) && tail.may_have (o.tail);
+    for (unsigned i = 0; i < n; i++)
+      if (!(masks[i] & (one << ((g >> hb_set_digest_shifts[i]) & mb1))))
+        return false;
+    return true;
   }
 
-  bool may_have (hb_codepoint_t g) const
+  bool may_intersect (const hb_set_digest_t &o) const
   {
-    return head.may_have (g) && tail.may_have (g);
+    for (unsigned i = 0; i < n; i++)
+      if (!(masks[i] & o.masks[i]))
+        return false;
+    return true;
   }
 
   private:
-  head_t head;
-  tail_t tail;
-};
-
 
-/*
- * hb_set_digest_t
- *
- * This is a combination of digests that performs "best".
- * There is not much science to this: it's a result of intuition
- * and testing.
- */
-using hb_set_digest_t =
-  hb_set_digest_combiner_t
-  <
-    hb_set_digest_bits_pattern_t,
-    hb_set_digest_combiner_t
-    <
-      hb_set_digest_bits_pattern_t,
-      hb_set_digest_bits_pattern_t
-    >
-  >
-;
+  mask_t masks[n] = {};
+};
 
 
 #endif /* HB_SET_DIGEST_HH */
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-set.hh b/src/java.desktop/share/native/libharfbuzz/hb-set.hh
index 4aa682616a2d..eaa892ab9f58 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-set.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-set.hh
@@ -35,6 +35,8 @@
 template 
 struct hb_sparseset_t
 {
+  static constexpr bool realloc_move = true;
+
   hb_object_header_t header;
   impl_t s;
 
@@ -42,10 +44,10 @@ struct hb_sparseset_t
   ~hb_sparseset_t () { fini (); }
 
   hb_sparseset_t (const hb_sparseset_t& other) : hb_sparseset_t () { set (other); }
-  hb_sparseset_t (hb_sparseset_t&& other) : hb_sparseset_t () { s = std::move (other.s); }
+  hb_sparseset_t (hb_sparseset_t&& other)  noexcept : hb_sparseset_t () { s = std::move (other.s); }
   hb_sparseset_t& operator = (const hb_sparseset_t& other) { set (other); return *this; }
-  hb_sparseset_t& operator = (hb_sparseset_t&& other) { s = std::move (other.s); return *this; }
-  friend void swap (hb_sparseset_t& a, hb_sparseset_t& b) { hb_swap (a.s, b.s); }
+  hb_sparseset_t& operator = (hb_sparseset_t&& other)  noexcept { s = std::move (other.s); return *this; }
+  friend void swap (hb_sparseset_t& a, hb_sparseset_t& b)  noexcept { hb_swap (a.s, b.s); }
 
   hb_sparseset_t (std::initializer_list lst) : hb_sparseset_t ()
   {
@@ -84,7 +86,7 @@ struct hb_sparseset_t
   uint32_t hash () const { return s.hash (); }
 
   void add (hb_codepoint_t g) { s.add (g); }
-  bool add_range (hb_codepoint_t a, hb_codepoint_t b) { return s.add_range (a, b); }
+  bool add_range (hb_codepoint_t first, hb_codepoint_t last) { return s.add_range (first, last); }
 
   template 
   void add_array (const T *array, unsigned int count, unsigned int stride=sizeof(T))
@@ -104,6 +106,7 @@ struct hb_sparseset_t
   void del_range (hb_codepoint_t a, hb_codepoint_t b) { s.del_range (a, b); }
 
   bool get (hb_codepoint_t g) const { return s.get (g); }
+  bool may_have (hb_codepoint_t g) const { return get (g); }
 
   /* Has interface. */
   bool operator [] (hb_codepoint_t k) const { return get (k); }
@@ -118,6 +121,9 @@ struct hb_sparseset_t
   hb_sparseset_t& operator << (const hb_codepoint_pair_t& range)
   { add_range (range.first, range.second); return *this; }
 
+  bool may_intersect (const hb_sparseset_t &other) const
+  { return s.may_intersect (other.s); }
+
   bool intersects (hb_codepoint_t first, hb_codepoint_t last) const
   { return s.intersects (first, last); }
 
@@ -164,7 +170,7 @@ struct hb_set_t : hb_sparseset_t
   ~hb_set_t () = default;
   hb_set_t () : sparseset () {};
   hb_set_t (const hb_set_t &o) : sparseset ((sparseset &) o) {};
-  hb_set_t (hb_set_t&& o) : sparseset (std::move ((sparseset &) o)) {}
+  hb_set_t (hb_set_t&& o)  noexcept : sparseset (std::move ((sparseset &) o)) {}
   hb_set_t& operator = (const hb_set_t&) = default;
   hb_set_t& operator = (hb_set_t&&) = default;
   hb_set_t (std::initializer_list lst) : sparseset (lst) {}
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-shape-plan.cc b/src/java.desktop/share/native/libharfbuzz/hb-shape-plan.cc
index 970aaa0b40ba..19188f8006a0 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-shape-plan.cc
+++ b/src/java.desktop/share/native/libharfbuzz/hb-shape-plan.cc
@@ -233,7 +233,7 @@ hb_shape_plan_create2 (hb_face_t                     *face,
                   num_coords,
                   shaper_list);
 
-  if (unlikely (props->direction == HB_DIRECTION_INVALID))
+  if (unlikely (!HB_DIRECTION_IS_VALID (props->direction)))
     return hb_shape_plan_get_empty ();
 
   hb_shape_plan_t *shape_plan;
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-shape.h b/src/java.desktop/share/native/libharfbuzz/hb-shape.h
index bf7eafd2b4fe..294105d3cb0a 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-shape.h
+++ b/src/java.desktop/share/native/libharfbuzz/hb-shape.h
@@ -53,6 +53,7 @@ hb_shape_full (hb_font_t          *font,
                unsigned int        num_features,
                const char * const *shaper_list);
 
+#ifdef HB_EXPERIMENTAL_API
 HB_EXTERN hb_bool_t
 hb_shape_justify (hb_font_t          *font,
                   hb_buffer_t        *buffer,
@@ -64,6 +65,7 @@ hb_shape_justify (hb_font_t          *font,
                   float              *advance, /* IN/OUT */
                   hb_tag_t           *var_tag, /* OUT */
                   float              *var_value /* OUT */);
+#endif
 
 HB_EXTERN const char **
 hb_shape_list_shapers (void);
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-style.cc b/src/java.desktop/share/native/libharfbuzz/hb-style.cc
index 20d4696b9262..7378a8895f4f 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-style.cc
+++ b/src/java.desktop/share/native/libharfbuzz/hb-style.cc
@@ -61,8 +61,8 @@ _hb_ratio_to_angle (float r)
  * @style_tag: a style tag.
  *
  * Searches variation axes of a #hb_font_t object for a specific axis first,
- * if not set, then tries to get default style values from different
- * tables of the font.
+ * if not set, first tries to get default style values in `STAT` table
+ * then tries to polyfill from different tables of the font.
  *
  * Returns: Corresponding axis or default value to a style tag.
  *
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-subset-cff-common.hh b/src/java.desktop/share/native/libharfbuzz/hb-subset-cff-common.hh
index 4213f7e71c5c..62206e0f5aab 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-subset-cff-common.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-subset-cff-common.hh
@@ -115,7 +115,7 @@ struct str_encoder_t
       encode_byte (OpCode_BCD);
 
       // Based on:
-      // https://github.com/fonttools/fonttools/blob/97ed3a61cde03e17b8be36f866192fbd56f1d1a7/Lib/fontTools/misc/psCharStrings.py#L265-L294
+      // https://github.com/fonttools/fonttools/blob/0738c41dfbcbc213ab9263f486ef0cccc6eb5ce5/Lib/fontTools/misc/psCharStrings.py#L267-L316
 
       char buf[16];
       /* FontTools has the following comment:
@@ -133,6 +133,10 @@ struct str_encoder_t
       (void) hb_uselocale (((void) freelocale (clocale), oldlocale));
 
       char *s = buf;
+      size_t len;
+      char *comma = strchr (s, ',');
+      if (comma) // Comma for some European locales in case no uselocale available.
+        *comma = '.';
       if (s[0] == '0' && s[1] == '.')
         s++;
       else if (s[0] == '-' && s[1] == '0' && s[2] == '.')
@@ -140,6 +144,45 @@ struct str_encoder_t
         s[1] = '-';
         s++;
       }
+      else if ((len = strlen (s)) > 3 && !strcmp (s + len - 3, "000"))
+      {
+        unsigned exponent = len - 3;
+        char *s2 = s + exponent - 1;
+        while (*s2 == '0' && exponent > 1)
+        {
+          s2--;
+          exponent++;
+        }
+        snprintf (s2 + 1, sizeof (buf) - (s2 + 1 - buf), "E%u", exponent);
+      }
+      else
+      {
+        char *dot = strchr (s, '.');
+        char *e = strchr (s, 'E');
+        if (dot && e)
+        {
+          memmove (dot, dot + 1, e - (dot + 1));
+          int exponent = atoi (e + 1);
+          int new_exponent = exponent - (e - (dot + 1));
+          if (new_exponent == 1)
+          {
+            e[-1] = '0';
+            e[0] = '\0';
+          }
+          else
+            snprintf (e - 1, sizeof (buf) - (e - 1 - buf), "E%d", new_exponent);
+        }
+      }
+      if ((s[0] == '.' && s[1] == '0') || (s[0] == '-' && s[1] == '.' && s[2] == '0'))
+      {
+        int sign = s[0] == '-';
+        char *s2 = s + sign + 1;
+        while (*s2 == '0')
+          s2++;
+        len = strlen (s2);
+        memmove (s + sign, s2, len);
+        snprintf (s + sign + len, sizeof (buf) - (s + sign + len - buf), "E-%u", (unsigned) (strlen (s + sign) - 1));
+      }
       hb_vector_t nibbles;
       while (*s)
       {
@@ -155,20 +198,22 @@ struct str_encoder_t
             {
               s++;
               nibbles.push (0x0C); // E-
-              continue;
+            } else {
+              if (c2 == '+')
+                s++;
+              nibbles.push (0x0B); // E
             }
-            if (c2 == '+')
+            if (*s == '0')
               s++;
-            nibbles.push (0x0B); // E
             continue;
           }
 
-          case '.': case ',': // Comma for some European locales in case no uselocale available.
+          case '.':
             nibbles.push (0x0A); // .
             continue;
 
           case '-':
-            nibbles.push (0x0E); // .
+            nibbles.push (0x0E); // -
             continue;
         }
 
@@ -1083,7 +1128,7 @@ struct subr_subsetter_t
       if (opstr.op == OpCode_callsubr || opstr.op == OpCode_callgsubr)
         size += 3;
     }
-    if (!buff.alloc (buff.length + size, true))
+    if (!buff.alloc_exact (buff.length + size))
       return false;
 
     for (auto &opstr : str.values)
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-subset-cff1.cc b/src/java.desktop/share/native/libharfbuzz/hb-subset-cff1.cc
index 780bf34efaf6..4938c048d6d4 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-subset-cff1.cc
+++ b/src/java.desktop/share/native/libharfbuzz/hb-subset-cff1.cc
@@ -45,7 +45,7 @@ struct remap_sid_t
   void alloc (unsigned size)
   {
     map.alloc (size);
-    vector.alloc (size, true);
+    vector.alloc_exact (size);
   }
 
   bool in_error () const
@@ -620,6 +620,12 @@ struct cff1_subset_plan
     drop_hints = plan->flags & HB_SUBSET_FLAGS_NO_HINTING;
     desubroutinize = plan->flags & HB_SUBSET_FLAGS_DESUBROUTINIZE;
 
+ #ifdef HB_EXPERIMENTAL_API
+    min_charstrings_off_size = (plan->flags & HB_SUBSET_FLAGS_IFTB_REQUIREMENTS) ? 4 : 0;
+ #else
+    min_charstrings_off_size = 0;
+ #endif
+
     subset_charset = !acc.is_predef_charset ();
     if (!subset_charset)
       /* check whether the subset renumbers any glyph IDs */
@@ -778,13 +784,43 @@ struct cff1_subset_plan
   unsigned int  topDictModSIDs[name_dict_values_t::ValCount];
 
   bool          desubroutinize = false;
+
+  unsigned      min_charstrings_off_size = 0;
 };
 } // namespace OT
 
+static bool _serialize_cff1_charstrings (hb_serialize_context_t *c,
+                                         struct OT::cff1_subset_plan &plan,
+                                         const OT::cff1::accelerator_subset_t  &acc)
+{
+  c->push ();
+
+  unsigned data_size = 0;
+  unsigned total_size = CFF1CharStrings::total_size (plan.subset_charstrings, &data_size, plan.min_charstrings_off_size);
+  if (unlikely (!c->start_zerocopy (total_size)))
+    return false;
+
+  auto *cs = c->start_embed ();
+  if (unlikely (!cs->serialize (c, plan.subset_charstrings, &data_size, plan.min_charstrings_off_size))) {
+    c->pop_discard ();
+    return false;
+  }
+
+  plan.info.char_strings_link = c->pop_pack (false);
+  return true;
+}
+
 bool
 OT::cff1::accelerator_subset_t::serialize (hb_serialize_context_t *c,
                                            struct OT::cff1_subset_plan &plan) const
 {
+  /* push charstrings onto the object stack first which will ensure it packs as the last
+     object in the table. Keeping the chastrings last satisfies the requirements for patching
+     via IFTB. If this ordering needs to be changed in the future, charstrings should be left
+     at the end whenever HB_SUBSET_FLAGS_ITFB_REQUIREMENTS is enabled. */
+  if (!_serialize_cff1_charstrings(c, plan, *this))
+    return false;
+
   /* private dicts & local subrs */
   for (int i = (int) privateDicts.length; --i >= 0 ;)
   {
@@ -823,25 +859,6 @@ OT::cff1::accelerator_subset_t::serialize (hb_serialize_context_t *c,
   if (!is_CID ())
     plan.info.privateDictInfo = plan.fontdicts_mod[0].privateDictInfo;
 
-  /* CharStrings */
-  {
-    c->push ();
-
-    unsigned data_size = 0;
-    unsigned total_size = CFF1CharStrings::total_size (plan.subset_charstrings, &data_size);
-    if (unlikely (!c->start_zerocopy (total_size)))
-       return false;
-
-    auto *cs = c->start_embed ();
-    if (likely (cs->serialize (c, plan.subset_charstrings, &data_size)))
-      plan.info.char_strings_link = c->pop_pack (false);
-    else
-    {
-      c->pop_discard ();
-      return false;
-    }
-  }
-
   /* FDArray (FD Index) */
   if (fdArray != &Null (CFF1FDArray))
   {
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-subset-cff2.cc b/src/java.desktop/share/native/libharfbuzz/hb-subset-cff2.cc
index 1f9bc209e88c..1074d2403865 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-subset-cff2.cc
+++ b/src/java.desktop/share/native/libharfbuzz/hb-subset-cff2.cc
@@ -248,7 +248,7 @@ struct cff2_subr_subsetter_t : subr_subsetter_t normalized_coords) :
     c (c), varStore (varStore), normalized_coords (normalized_coords) {}
 
@@ -284,7 +284,7 @@ struct cff2_private_blend_encoder_param_t
   unsigned ivs = 0;
   unsigned region_count = 0;
   hb_vector_t scalars;
-  const  CFF2VariationStore *varStore = nullptr;
+  const  CFF2ItemVariationStore *varStore = nullptr;
   hb_array_t normalized_coords;
 };
 
@@ -378,7 +378,7 @@ struct cff2_private_dict_blend_opset_t : dict_opset_t
 struct cff2_private_dict_op_serializer_t : op_serializer_t
 {
   cff2_private_dict_op_serializer_t (bool desubroutinize_, bool drop_hints_, bool pinned_,
-                                     const CFF::CFF2VariationStore* varStore_,
+                                     const CFF::CFF2ItemVariationStore* varStore_,
                                      hb_array_t normalized_coords_)
     : desubroutinize (desubroutinize_), drop_hints (drop_hints_), pinned (pinned_),
       varStore (varStore_), normalized_coords (normalized_coords_) {}
@@ -416,7 +416,7 @@ struct cff2_private_dict_op_serializer_t : op_serializer_t
   const bool desubroutinize;
   const bool drop_hints;
   const bool pinned;
-  const CFF::CFF2VariationStore* varStore;
+  const CFF::CFF2ItemVariationStore* varStore;
   hb_array_t normalized_coords;
 };
 
@@ -439,6 +439,12 @@ struct cff2_subset_plan
     desubroutinize = plan->flags & HB_SUBSET_FLAGS_DESUBROUTINIZE ||
                      pinned; // For instancing we need this path
 
+ #ifdef HB_EXPERIMENTAL_API
+    min_charstrings_off_size = (plan->flags & HB_SUBSET_FLAGS_IFTB_REQUIREMENTS) ? 4 : 0;
+ #else
+    min_charstrings_off_size = 0;
+ #endif
+
     if (desubroutinize)
     {
       /* Flatten global & local subrs */
@@ -510,14 +516,45 @@ struct cff2_subset_plan
 
   bool      drop_hints = false;
   bool      desubroutinize = false;
+
+  unsigned  min_charstrings_off_size = 0;
 };
 } // namespace OT
 
+static bool _serialize_cff2_charstrings (hb_serialize_context_t *c,
+                             cff2_subset_plan &plan,
+                             const OT::cff2::accelerator_subset_t  &acc)
+{
+  c->push ();
+
+  unsigned data_size = 0;
+  unsigned total_size = CFF2CharStrings::total_size (plan.subset_charstrings, &data_size, plan.min_charstrings_off_size);
+  if (unlikely (!c->start_zerocopy (total_size)))
+    return false;
+
+  auto *cs = c->start_embed ();
+  if (unlikely (!cs->serialize (c, plan.subset_charstrings, &data_size, plan.min_charstrings_off_size)))
+  {
+    c->pop_discard ();
+    return false;
+  }
+
+  plan.info.char_strings_link = c->pop_pack (false);
+  return true;
+}
+
 bool
 OT::cff2::accelerator_subset_t::serialize (hb_serialize_context_t *c,
                                            struct cff2_subset_plan &plan,
                                            hb_array_t normalized_coords) const
 {
+  /* push charstrings onto the object stack first which will ensure it packs as the last
+     object in the table. Keeping the chastrings last satisfies the requirements for patching
+     via IFTB. If this ordering needs to be changed in the future, charstrings should be left
+     at the end whenever HB_SUBSET_FLAGS_ITFB_REQUIREMENTS is enabled. */
+  if (!_serialize_cff2_charstrings(c, plan, *this))
+    return false;
+
   /* private dicts & local subrs */
   hb_vector_t  private_dict_infos;
   if (unlikely (!private_dict_infos.resize (plan.subset_fdcount))) return false;
@@ -556,25 +593,6 @@ OT::cff2::accelerator_subset_t::serialize (hb_serialize_context_t *c,
     }
   }
 
-  /* CharStrings */
-  {
-    c->push ();
-
-    unsigned data_size = 0;
-    unsigned total_size = CFF2CharStrings::total_size (plan.subset_charstrings, &data_size);
-    if (unlikely (!c->start_zerocopy (total_size)))
-       return false;
-
-    auto *cs = c->start_embed ();
-    if (likely (cs->serialize (c, plan.subset_charstrings, &data_size)))
-      plan.info.char_strings_link = c->pop_pack (false);
-    else
-    {
-      c->pop_discard ();
-      return false;
-    }
-  }
-
   /* FDSelect */
   if (fdSelect != &Null (CFF2FDSelect))
   {
@@ -610,10 +628,10 @@ OT::cff2::accelerator_subset_t::serialize (hb_serialize_context_t *c,
   }
 
   /* variation store */
-  if (varStore != &Null (CFF2VariationStore) &&
+  if (varStore != &Null (CFF2ItemVariationStore) &&
       !plan.pinned)
   {
-    auto *dest = c->push ();
+    auto *dest = c->push ();
     if (unlikely (!dest->serialize (c, varStore)))
     {
       c->pop_discard ();
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-subset-input.cc b/src/java.desktop/share/native/libharfbuzz/hb-subset-input.cc
index 8c67f7f23f4d..bbe50b1fb36f 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-subset-input.cc
+++ b/src/java.desktop/share/native/libharfbuzz/hb-subset-input.cc
@@ -24,6 +24,7 @@
  * Google Author(s): Garret Rieger, Rod Sheeter, Behdad Esfahbod
  */
 
+#include "hb-subset-instancer-solver.hh"
 #include "hb-subset.hh"
 #include "hb-set.hh"
 #include "hb-utf.hh"
@@ -50,7 +51,6 @@ hb_subset_input_t::hb_subset_input_t ()
     HB_TAG ('k', 'e', 'r', 'n'),
 
     // Copied from fontTools:
-    HB_TAG ('B', 'A', 'S', 'E'),
     HB_TAG ('J', 'S', 'T', 'F'),
     HB_TAG ('D', 'S', 'I', 'G'),
     HB_TAG ('E', 'B', 'D', 'T'),
@@ -123,6 +123,12 @@ hb_subset_input_t::hb_subset_input_t ()
     //justify
     HB_TAG ('j', 'a', 'l', 't'), // HarfBuzz doesn't use; others might
 
+    //East Asian spacing
+    HB_TAG ('c', 'h', 'w', 's'),
+    HB_TAG ('v', 'c', 'h', 'w'),
+    HB_TAG ('h', 'a', 'l', 't'),
+    HB_TAG ('v', 'h', 'a', 'l'),
+
     //private
     HB_TAG ('H', 'a', 'r', 'f'),
     HB_TAG ('H', 'A', 'R', 'F'),
@@ -406,11 +412,52 @@ hb_subset_input_keep_everything (hb_subset_input_t *input)
   hb_subset_input_set_flags (input,
                              HB_SUBSET_FLAGS_NOTDEF_OUTLINE |
                              HB_SUBSET_FLAGS_GLYPH_NAMES |
+                             HB_SUBSET_FLAGS_NAME_LEGACY |
                              HB_SUBSET_FLAGS_NO_PRUNE_UNICODE_RANGES |
                              HB_SUBSET_FLAGS_PASSTHROUGH_UNRECOGNIZED);
 }
 
 #ifndef HB_NO_VAR
+/**
+ * hb_subset_input_pin_all_axes_to_default: (skip)
+ * @input: a #hb_subset_input_t object.
+ * @face: a #hb_face_t object.
+ *
+ * Pin all axes to default locations in the given subset input object.
+ *
+ * All axes in a font must be pinned. Additionally, `CFF2` table, if present,
+ * will be de-subroutinized.
+ *
+ * Return value: `true` if success, `false` otherwise
+ *
+ * Since: 8.3.1
+ **/
+HB_EXTERN hb_bool_t
+hb_subset_input_pin_all_axes_to_default (hb_subset_input_t  *input,
+                                         hb_face_t          *face)
+{
+  unsigned axis_count = hb_ot_var_get_axis_count (face);
+  if (!axis_count) return false;
+
+  hb_ot_var_axis_info_t *axis_infos = (hb_ot_var_axis_info_t *) hb_calloc (axis_count, sizeof (hb_ot_var_axis_info_t));
+  if (unlikely (!axis_infos)) return false;
+
+  (void) hb_ot_var_get_axis_infos (face, 0, &axis_count, axis_infos);
+
+  for (unsigned i = 0; i < axis_count; i++)
+  {
+    hb_tag_t axis_tag = axis_infos[i].tag;
+    double default_val = (double) axis_infos[i].default_value;
+    if (!input->axes_location.set (axis_tag, Triple (default_val, default_val, default_val)))
+    {
+      hb_free (axis_infos);
+      return false;
+    }
+  }
+  hb_free (axis_infos);
+  return true;
+}
+
 /**
  * hb_subset_input_pin_axis_to_default: (skip)
  * @input: a #hb_subset_input_t object.
@@ -435,7 +482,7 @@ hb_subset_input_pin_axis_to_default (hb_subset_input_t  *input,
   if (!hb_ot_var_find_axis_info (face, axis_tag, &axis_info))
     return false;
 
-  float default_val = axis_info.default_value;
+  double default_val = (double) axis_info.default_value;
   return input->axes_location.set (axis_tag, Triple (default_val, default_val, default_val));
 }
 
@@ -465,37 +512,32 @@ hb_subset_input_pin_axis_location (hb_subset_input_t  *input,
   if (!hb_ot_var_find_axis_info (face, axis_tag, &axis_info))
     return false;
 
-  float val = hb_clamp(axis_value, axis_info.min_value, axis_info.max_value);
+  double val = hb_clamp((double) axis_value, (double) axis_info.min_value, (double) axis_info.max_value);
   return input->axes_location.set (axis_tag, Triple (val, val, val));
 }
 
-#ifdef HB_EXPERIMENTAL_API
 /**
  * hb_subset_input_set_axis_range: (skip)
  * @input: a #hb_subset_input_t object.
  * @face: a #hb_face_t object.
  * @axis_tag: Tag of the axis
- * @axis_min_value: Minimum value of the axis variation range to set
- * @axis_max_value: Maximum value of the axis variation range to set
- * @axis_def_value: Default value of the axis variation range to set, in case of
- * null, it'll be determined automatically
+ * @axis_min_value: Minimum value of the axis variation range to set, if NaN the existing min will be used.
+ * @axis_max_value: Maximum value of the axis variation range to set  if NaN the existing max will be used.
+ * @axis_def_value: Default value of the axis variation range to set, if NaN the existing default will be used.
  *
  * Restricting the range of variation on an axis in the given subset input object.
  * New min/default/max values will be clamped if they're not within the fvar axis range.
- * If the new default value is null:
- * If the fvar axis default value is within the new range, then new default
- * value is the same as original default value.
+ *
  * If the fvar axis default value is not within the new range, the new default
  * value will be changed to the new min or max value, whichever is closer to the fvar
  * axis default.
  *
  * Note: input min value can not be bigger than input max value. If the input
  * default value is not within the new min/max range, it'll be clamped.
- * Note: currently it supports gvar and cvar tables only.
  *
  * Return value: `true` if success, `false` otherwise
  *
- * XSince: EXPERIMENTAL
+ * Since: 8.5.0
  **/
 HB_EXTERN hb_bool_t
 hb_subset_input_set_axis_range (hb_subset_input_t  *input,
@@ -503,22 +545,195 @@ hb_subset_input_set_axis_range (hb_subset_input_t  *input,
                                 hb_tag_t            axis_tag,
                                 float               axis_min_value,
                                 float               axis_max_value,
-                                float              *axis_def_value /* IN, maybe NULL */)
+                                float               axis_def_value)
 {
-  if (axis_min_value > axis_max_value)
-    return false;
-
   hb_ot_var_axis_info_t axis_info;
   if (!hb_ot_var_find_axis_info (face, axis_tag, &axis_info))
     return false;
 
-  float new_min_val = hb_clamp(axis_min_value, axis_info.min_value, axis_info.max_value);
-  float new_max_val = hb_clamp(axis_max_value, axis_info.min_value, axis_info.max_value);
-  float new_default_val = axis_def_value ? *axis_def_value : axis_info.default_value;
-  new_default_val = hb_clamp(new_default_val, new_min_val, new_max_val);
-  return input->axes_location.set (axis_tag, Triple (new_min_val, new_default_val, new_max_val));
+  float min = !std::isnan(axis_min_value) ? axis_min_value : axis_info.min_value;
+  float max = !std::isnan(axis_max_value) ? axis_max_value : axis_info.max_value;
+  float def = !std::isnan(axis_def_value) ? axis_def_value : axis_info.default_value;
+
+  if (min > max)
+    return false;
+
+  float new_min_val = hb_clamp(min, axis_info.min_value, axis_info.max_value);
+  float new_max_val = hb_clamp(max, axis_info.min_value, axis_info.max_value);
+  float new_default_val = hb_clamp(def, new_min_val, new_max_val);
+  return input->axes_location.set (axis_tag, Triple ((double) new_min_val, (double) new_default_val, (double) new_max_val));
+}
+
+/**
+ * hb_subset_input_get_axis_range: (skip)
+ * @input: a #hb_subset_input_t object.
+ * @axis_tag: Tag of the axis
+ * @axis_min_value: Set to the previously configured minimum value of the axis variation range.
+ * @axis_max_value: Set to the previously configured maximum value of the axis variation range.
+ * @axis_def_value: Set to the previously configured default value of the axis variation range.
+ *
+ * Gets the axis range assigned by previous calls to hb_subset_input_set_axis_range.
+ *
+ * Return value: `true` if a range has been set for this axis tag, `false` otherwise.
+ *
+ * Since: 8.5.0
+ **/
+HB_EXTERN hb_bool_t
+hb_subset_input_get_axis_range (hb_subset_input_t  *input,
+                                hb_tag_t            axis_tag,
+                                float              *axis_min_value,
+                                float              *axis_max_value,
+                                float              *axis_def_value)
+
+{
+  Triple* triple;
+  if (!input->axes_location.has(axis_tag, &triple)) {
+    return false;
+  }
+
+  *axis_min_value = triple->minimum;
+  *axis_def_value = triple->middle;
+  *axis_max_value = triple->maximum;
+  return true;
+}
+
+/**
+ * hb_subset_axis_range_from_string:
+ * @str: a string to parse
+ * @len: length of @str, or -1 if str is NULL terminated
+ * @axis_min_value: (out): the axis min value to initialize with the parsed value
+ * @axis_max_value: (out): the axis max value to initialize with the parsed value
+ * @axis_def_value: (out): the axis default value to initialize with the parse
+ * value
+ *
+ * Parses a string into a subset axis range(min, def, max).
+ * Axis positions string is in the format of min:def:max or min:max
+ * When parsing axis positions, empty values as meaning the existing value for that part
+ * E.g: :300:500
+ * Specifies min = existing, def = 300, max = 500
+ * In the output axis_range, if a value should be set to it's default value,
+ * then it will be set to NaN
+ *
+ * Return value:
+ * `true` if @str is successfully parsed, `false` otherwise
+ *
+ * Since: 10.2.0
+ */
+HB_EXTERN hb_bool_t
+hb_subset_axis_range_from_string (const char *str, int len,
+                                  float *axis_min_value,
+                                  float *axis_max_value,
+                                  float *axis_def_value)
+{
+  if (len < 0)
+    len = strlen (str);
+
+  const char *end = str + len;
+  const char* part = strpbrk (str, ":");
+  if (!part)
+  {
+    // Single value.
+    if (strcmp (str, "drop") == 0)
+    {
+      *axis_min_value = NAN;
+      *axis_def_value = NAN;
+      *axis_max_value = NAN;
+      return true;
+    }
+
+    double v;
+    if (!hb_parse_double (&str, end, &v)) return false;
+
+    *axis_min_value = v;
+    *axis_def_value = v;
+    *axis_max_value = v;
+    return true;
+  }
+
+  float values[3];
+  int count = 0;
+  for (int i = 0; i < 3; i++) {
+    count++;
+    if (!*str || part == str)
+    {
+      values[i] = NAN;
+
+      if (part == NULL) break;
+      str = part + 1;
+      part = strpbrk (str, ":");
+      continue;
+    }
+
+    double v;
+    if (!hb_parse_double (&str, part, &v)) return false;
+    values[i] = v;
+
+    if (part == NULL) break;
+    str = part + 1;
+    part = strpbrk (str, ":");
+  }
+
+  if (count == 2)
+  {
+    *axis_min_value = values[0];
+    *axis_def_value = NAN;
+    *axis_max_value = values[1];
+    return true;
+  }
+  else if (count == 3)
+  {
+    *axis_min_value = values[0];
+    *axis_def_value = values[1];
+    *axis_max_value = values[2];
+    return true;
+  }
+  return false;
+}
+
+/**
+ * hb_subset_axis_range_to_string:
+ * @input: a #hb_subset_input_t object.
+ * @axis_tag: an axis to convert
+ * @buf: (array length=size) (out caller-allocates): output string
+ * @size: the allocated size of @buf
+ *
+ * Converts an axis range into a `NULL`-terminated string in the format
+ * understood by hb_subset_axis_range_from_string(). The client in responsible for
+ * allocating big enough size for @buf, 128 bytes is more than enough.
+ *
+ * Since: 10.2.0
+ */
+HB_EXTERN void
+hb_subset_axis_range_to_string (hb_subset_input_t *input,
+                                hb_tag_t axis_tag,
+                                char *buf, unsigned size)
+{
+  if (unlikely (!size)) return;
+  Triple* triple;
+  if (!input->axes_location.has(axis_tag, &triple)) {
+    return;
+  }
+
+  char s[128];
+  unsigned len = 0;
+
+  hb_locale_t clocale HB_UNUSED;
+  hb_locale_t oldlocale HB_UNUSED;
+  oldlocale = hb_uselocale (clocale = newlocale (LC_ALL_MASK, "C", NULL));
+  len += hb_max (0, snprintf (s, ARRAY_LENGTH (s) - len, "%g", (double) triple->minimum));
+  s[len++] = ':';
+
+  len += hb_max (0, snprintf (s + len, ARRAY_LENGTH (s) - len, "%g", (double) triple->middle));
+  s[len++] = ':';
+
+  len += hb_max (0, snprintf (s + len, ARRAY_LENGTH (s) - len, "%g", (double) triple->maximum));
+  (void) hb_uselocale (((void) freelocale (clocale), oldlocale));
+
+  assert (len < ARRAY_LENGTH (s));
+  len = hb_min (len, size - 1);
+  hb_memcpy (buf, s, len);
+  buf[len] = '\0';
 }
-#endif
 #endif
 
 /**
@@ -653,7 +868,7 @@ hb_subset_input_override_name_table (hb_subset_input_t  *input,
         src = hb_utf8_t::next (src, src_end, &unicode, replacement);
         if (unicode >= 0x0080u)
         {
-          printf ("Non-ascii character detected, ignored...This API supports acsii characters only for mac platform\n");
+          printf ("Non-ascii character detected, ignored...This API supports ascii characters only for mac platform\n");
           return false;
         }
       }
@@ -667,5 +882,4 @@ hb_subset_input_override_name_table (hb_subset_input_t  *input,
   input->name_table_overrides.set (hb_ot_name_record_ids_t (platform_id, encoding_id, language_id, name_id), name_bytes);
   return true;
 }
-
 #endif
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-subset-instancer-iup.hh b/src/java.desktop/share/native/libharfbuzz/hb-subset-instancer-iup.hh
new file mode 100644
index 000000000000..01987bd258dd
--- /dev/null
+++ b/src/java.desktop/share/native/libharfbuzz/hb-subset-instancer-iup.hh
@@ -0,0 +1,37 @@
+/*
+ * Copyright © 2024  Google, Inc.
+ *
+ *  This is part of HarfBuzz, a text shaping library.
+ *
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, provided that the
+ * above copyright notice and the following two paragraphs appear in
+ * all copies of this software.
+ *
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
+ * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
+ * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ */
+
+#ifndef HB_SUBSET_INSTANCER_IUP_HH
+#define HB_SUBSET_INSTANCER_IUP_HH
+
+#include "hb-subset-plan.hh"
+/* given contour points and deltas, optimize a set of referenced points within error
+ * tolerance. Returns optimized referenced point indices */
+HB_INTERNAL bool iup_delta_optimize (const contour_point_vector_t& contour_points,
+                                     const hb_vector_t& x_deltas,
+                                     const hb_vector_t& y_deltas,
+                                     hb_vector_t& opt_indices, /* OUT */
+                                     double tolerance = 0.0);
+
+#endif /* HB_SUBSET_INSTANCER_IUP_HH */
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-subset-instancer-solver.cc b/src/java.desktop/share/native/libharfbuzz/hb-subset-instancer-solver.cc
index 8ec36e3e80dc..c67fee421c20 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-subset-instancer-solver.cc
+++ b/src/java.desktop/share/native/libharfbuzz/hb-subset-instancer-solver.cc
@@ -32,17 +32,17 @@
  * This should be safe.
  */
 
-constexpr static float EPSILON = 1.f / (1 << 14);
-constexpr static float MAX_F2DOT14 = float (0x7FFF) / (1 << 14);
+constexpr static double EPSILON = 1.0 / (1 << 14);
+constexpr static double MAX_F2DOT14 = double (0x7FFF) / (1 << 14);
 
 static inline Triple _reverse_negate(const Triple &v)
 { return {-v.maximum, -v.middle, -v.minimum}; }
 
 
-static inline float supportScalar (float coord, const Triple &tent)
+static inline double supportScalar (double coord, const Triple &tent)
 {
   /* Copied from VarRegionAxis::evaluate() */
-  float start = tent.minimum, peak = tent.middle, end = tent.maximum;
+  double start = tent.minimum, peak = tent.middle, end = tent.maximum;
 
   if (unlikely (start > peak || peak > end))
     return 1.;
@@ -62,20 +62,20 @@ static inline float supportScalar (float coord, const Triple &tent)
     return  (end - coord) / (end - peak);
 }
 
-static inline result_t
+static inline rebase_tent_result_t
 _solve (Triple tent, Triple axisLimit, bool negative = false)
 {
-  float axisMin = axisLimit.minimum;
-  float axisDef = axisLimit.middle;
-  float axisMax = axisLimit.maximum;
-  float lower = tent.minimum;
-  float peak  = tent.middle;
-  float upper = tent.maximum;
+  double axisMin = axisLimit.minimum;
+  double axisDef = axisLimit.middle;
+  double axisMax = axisLimit.maximum;
+  double lower = tent.minimum;
+  double peak  = tent.middle;
+  double upper = tent.maximum;
 
   // Mirror the problem such that axisDef <= peak
   if (axisDef > peak)
   {
-    result_t vec = _solve (_reverse_negate (tent),
+    rebase_tent_result_t vec = _solve (_reverse_negate (tent),
                            _reverse_negate (axisLimit),
                            !negative);
 
@@ -98,7 +98,7 @@ _solve (Triple tent, Triple axisLimit, bool negative = false)
    *    axisMin     axisDef    axisMax   lower     upper
    */
   if (axisMax <= lower && axisMax < peak)
-      return result_t{};  // No overlap
+      return rebase_tent_result_t{};  // No overlap
 
   /* case 2: Only the peak and outermost bound fall outside the new limit;
    * we keep the deltaset, update peak and outermost bound and scale deltas
@@ -130,10 +130,10 @@ _solve (Triple tent, Triple axisLimit, bool negative = false)
    */
   if (axisMax < peak)
   {
-    float mult = supportScalar (axisMax, tent);
+    double mult = supportScalar (axisMax, tent);
     tent = Triple{lower, axisMax, axisMax};
 
-    result_t vec = _solve (tent, axisLimit);
+    rebase_tent_result_t vec = _solve (tent, axisLimit);
 
     for (auto &p : vec)
       p = hb_pair (p.first * mult, p.second);
@@ -143,13 +143,13 @@ _solve (Triple tent, Triple axisLimit, bool negative = false)
 
   // lower <= axisDef <= peak <= axisMax
 
-  float gain = supportScalar (axisDef, tent);
-  result_t out {hb_pair (gain, Triple{})};
+  double gain = supportScalar (axisDef, tent);
+  rebase_tent_result_t out {hb_pair (gain, Triple{})};
 
   // First, the positive side
 
   // outGain is the scalar of axisMax at the tent.
-  float outGain = supportScalar (axisMax, tent);
+  double outGain = supportScalar (axisMax, tent);
 
   /* Case 3a: Gain is more than outGain. The tent down-slope crosses
    * the axis into negative. We have to split it into multiples.
@@ -168,13 +168,15 @@ _solve (Triple tent, Triple axisLimit, bool negative = false)
    *                           |
    *                      crossing
    */
-  if (gain > outGain)
+  if (gain >= outGain)
   {
+    // Note that this is the branch taken if both gain and outGain are 0.
+
     // Crossing point on the axis.
-    float crossing = peak + (1 - gain) * (upper - peak);
+    double crossing = peak + (1 - gain) * (upper - peak);
 
-    Triple loc{axisDef, peak, crossing};
-    float scalar = 1.f;
+    Triple loc{hb_max (lower, axisDef), peak, crossing};
+    double scalar = 1.0;
 
     // The part before the crossing point.
     out.push (hb_pair (scalar - gain, loc));
@@ -189,7 +191,7 @@ _solve (Triple tent, Triple axisLimit, bool negative = false)
     if (upper >= axisMax)
     {
       Triple loc {crossing, axisMax, axisMax};
-      float scalar = outGain;
+      double scalar = outGain;
 
       out.push (hb_pair (scalar - gain, loc));
     }
@@ -219,11 +221,11 @@ _solve (Triple tent, Triple axisLimit, bool negative = false)
 
       // Downslope.
       Triple loc1 {crossing, upper, axisMax};
-      float scalar1 = 0.f;
+      double scalar1 = 0.0;
 
       // Eternity justify.
       Triple loc2 {upper, axisMax, axisMax};
-      float scalar2 = 0.f;
+      double scalar2 = 0.0;
 
       out.push (hb_pair (scalar1 - gain, loc1));
       out.push (hb_pair (scalar2 - gain, loc2));
@@ -252,9 +254,12 @@ _solve (Triple tent, Triple axisLimit, bool negative = false)
      *                    |      |  newUpper
      *              axisDef      axisMax
      */
-    float newUpper = peak + (1 - gain) * (upper - peak);
-    assert (axisMax <= newUpper);  // Because outGain >= gain
-    if (newUpper <= axisDef + (axisMax - axisDef) * 2)
+    double newUpper = peak + (1 - gain) * (upper - peak);
+    assert (axisMax <= newUpper);  // Because outGain > gain
+    /* Disabled because ots doesn't like us:
+     * https://github.com/fonttools/fonttools/issues/3350 */
+
+    if (false && (newUpper <= axisDef + (axisMax - axisDef) * 2))
     {
       upper = newUpper;
       if (!negative && axisDef + (axisMax - axisDef) * MAX_F2DOT14 < upper)
@@ -265,7 +270,7 @@ _solve (Triple tent, Triple axisLimit, bool negative = false)
       }
 
       Triple loc {hb_max (axisDef, lower), peak, upper};
-      float scalar = 1.f;
+      double scalar = 1.0;
 
       out.push (hb_pair (scalar - gain, loc));
     }
@@ -289,10 +294,10 @@ _solve (Triple tent, Triple axisLimit, bool negative = false)
     else
     {
       Triple loc1 {hb_max (axisDef, lower), peak, axisMax};
-      float scalar1 = 1.f;
+      double scalar1 = 1.0;
 
       Triple loc2 {peak, axisMax, axisMax};
-      float scalar2 = outGain;
+      double scalar2 = outGain;
 
       out.push (hb_pair (scalar1 - gain, loc1));
       // Don't add a dirac delta!
@@ -320,7 +325,7 @@ _solve (Triple tent, Triple axisLimit, bool negative = false)
   if (lower <= axisMin)
   {
     Triple loc {axisMin, axisMin, axisDef};
-    float scalar = supportScalar (axisMin, tent);
+    double scalar = supportScalar (axisMin, tent);
 
     out.push (hb_pair (scalar - gain, loc));
   }
@@ -348,11 +353,11 @@ _solve (Triple tent, Triple axisLimit, bool negative = false)
 
     // Downslope.
     Triple loc1 {axisMin, lower, axisDef};
-    float scalar1 = 0.f;
+    double scalar1 = 0.0;
 
     // Eternity justify.
     Triple loc2 {axisMin, axisMin, lower};
-    float scalar2 = 0.f;
+    double scalar2 = 0.0;
 
     out.push (hb_pair (scalar1 - gain, loc1));
     out.push (hb_pair (scalar2 - gain, loc2));
@@ -364,19 +369,19 @@ _solve (Triple tent, Triple axisLimit, bool negative = false)
 static inline TripleDistances _reverse_triple_distances (const TripleDistances &v)
 { return TripleDistances (v.positive, v.negative); }
 
-float renormalizeValue (float v, const Triple &triple,
-                        const TripleDistances &triple_distances, bool extrapolate)
+double renormalizeValue (double v, const Triple &triple,
+                         const TripleDistances &triple_distances, bool extrapolate)
 {
-  float lower = triple.minimum, def = triple.middle, upper = triple.maximum;
+  double lower = triple.minimum, def = triple.middle, upper = triple.maximum;
   assert (lower <= def && def <= upper);
 
   if (!extrapolate)
-      v = hb_max (hb_min (v, upper), lower);
+    v = hb_clamp (v, lower, upper);
 
   if (v == def)
-    return 0.f;
+    return 0.0;
 
-  if (def < 0.f)
+  if (def < 0.0)
     return -renormalizeValue (-v, _reverse_negate (triple),
                               _reverse_triple_distances (triple_distances), extrapolate);
 
@@ -385,14 +390,14 @@ float renormalizeValue (float v, const Triple &triple,
     return (v - def) / (upper - def);
 
   /* v < def */
-  if (lower >= 0.f)
+  if (lower >= 0.0)
     return (v - def) / (def - lower);
 
   /* lower < 0 and v < default */
-  float total_distance = triple_distances.negative * (-lower) + triple_distances.positive * def;
+  double total_distance = triple_distances.negative * (-lower) + triple_distances.positive * def;
 
-  float v_distance;
-  if (v >= 0.f)
+  double v_distance;
+  if (v >= 0.0)
     v_distance = (def - v) * triple_distances.positive;
   else
     v_distance = (-v) * triple_distances.negative + triple_distances.positive * def;
@@ -400,18 +405,18 @@ float renormalizeValue (float v, const Triple &triple,
   return (-v_distance) /total_distance;
 }
 
-result_t
+rebase_tent_result_t
 rebase_tent (Triple tent, Triple axisLimit, TripleDistances axis_triple_distances)
 {
-  assert (-1.f <= axisLimit.minimum && axisLimit.minimum <= axisLimit.middle && axisLimit.middle <= axisLimit.maximum && axisLimit.maximum <= +1.f);
-  assert (-2.f <= tent.minimum && tent.minimum <= tent.middle && tent.middle <= tent.maximum && tent.maximum <= +2.f);
-  assert (tent.middle != 0.f);
+  assert (-1.0 <= axisLimit.minimum && axisLimit.minimum <= axisLimit.middle && axisLimit.middle <= axisLimit.maximum && axisLimit.maximum <= +1.0);
+  assert (-2.0 <= tent.minimum && tent.minimum <= tent.middle && tent.middle <= tent.maximum && tent.maximum <= +2.0);
+  assert (tent.middle != 0.0);
 
-  result_t sols = _solve (tent, axisLimit);
+  rebase_tent_result_t sols = _solve (tent, axisLimit);
 
-  auto n = [&axisLimit, &axis_triple_distances] (float v) { return renormalizeValue (v, axisLimit, axis_triple_distances); };
+  auto n = [&axisLimit, &axis_triple_distances] (double v) { return renormalizeValue (v, axisLimit, axis_triple_distances); };
 
-  result_t out;
+  rebase_tent_result_t out;
   for (auto &p : sols)
   {
     if (!p.first) continue;
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-subset-instancer-solver.hh b/src/java.desktop/share/native/libharfbuzz/hb-subset-instancer-solver.hh
index e8ca1dc4e636..9764dcc1725b 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-subset-instancer-solver.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-subset-instancer-solver.hh
@@ -30,24 +30,24 @@
 /* pre-normalized distances */
 struct TripleDistances
 {
-  TripleDistances (): negative (1.f), positive (1.f) {}
-  TripleDistances (float neg_, float pos_): negative (neg_), positive (pos_) {}
-  TripleDistances (float min, float default_, float max)
+  TripleDistances (): negative (1.0), positive (1.0) {}
+  TripleDistances (double neg_, double pos_): negative (neg_), positive (pos_) {}
+  TripleDistances (double min, double default_, double max)
   {
     negative = default_ - min;
     positive = max - default_;
   }
 
-  float negative;
-  float positive;
+  double negative;
+  double positive;
 };
 
 struct Triple {
 
   Triple () :
-    minimum (0.f), middle (0.f), maximum (0.f) {}
+    minimum (0.0), middle (0.0), maximum (0.0) {}
 
-  Triple (float minimum_, float middle_, float maximum_) :
+  Triple (double minimum_, double middle_, double maximum_) :
     minimum (minimum_), middle (middle_), maximum (maximum_) {}
 
   bool operator == (const Triple &o) const
@@ -63,7 +63,7 @@ struct Triple {
   bool is_point () const
   { return minimum == middle && middle == maximum; }
 
-  bool contains (float point) const
+  bool contains (double point) const
   { return minimum <= point && point <= maximum; }
 
   /* from hb_array_t hash ()*/
@@ -82,18 +82,18 @@ struct Triple {
   }
 
 
-  float minimum;
-  float middle;
-  float maximum;
+  double minimum;
+  double middle;
+  double maximum;
 };
 
-using result_item_t = hb_pair_t;
-using result_t = hb_vector_t;
+using rebase_tent_result_item_t = hb_pair_t;
+using rebase_tent_result_t = hb_vector_t;
 
 /* renormalize a normalized value v to the range of an axis,
  * considering the prenormalized distances as well as the new axis limits.
  * Ported from fonttools */
-HB_INTERNAL float renormalizeValue (float v, const Triple &triple,
+HB_INTERNAL double renormalizeValue (double v, const Triple &triple,
                                     const TripleDistances &triple_distances,
                                     bool extrapolate = true);
 /* Given a tuple (lower,peak,upper) "tent" and new axis limits
@@ -107,6 +107,8 @@ HB_INTERNAL float renormalizeValue (float v, const Triple &triple,
  * If tent value is Triple{}, that is a special deltaset that should
  * be always-enabled (called "gain").
  */
-HB_INTERNAL result_t rebase_tent (Triple tent, Triple axisLimit, TripleDistances axis_triple_distances);
+HB_INTERNAL rebase_tent_result_t rebase_tent (Triple tent,
+                                              Triple axisLimit,
+                                              TripleDistances axis_triple_distances);
 
 #endif /* HB_SUBSET_INSTANCER_SOLVER_HH */
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-subset-plan-member-list.hh b/src/java.desktop/share/native/libharfbuzz/hb-subset-plan-member-list.hh
index 8bc1fcb56820..ade8278c40fd 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-subset-plan-member-list.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-subset-plan-member-list.hh
@@ -70,6 +70,9 @@ HB_SUBSET_PLAN_MEMBER (hb_set_t, _glyphset_colred)
 HB_SUBSET_PLAN_MEMBER (hb_map_t, gsub_lookups)
 HB_SUBSET_PLAN_MEMBER (hb_map_t, gpos_lookups)
 
+//use_mark_sets mapping: old->new
+HB_SUBSET_PLAN_MEMBER (hb_map_t, used_mark_sets_map)
+
 //active langsys we'd like to retain
 HB_SUBSET_PLAN_MEMBER (hb_hashmap_t E(>), gsub_langsys)
 HB_SUBSET_PLAN_MEMBER (hb_hashmap_t E(>), gpos_langsys)
@@ -87,9 +90,24 @@ HB_SUBSET_PLAN_MEMBER (hb_hashmap_t E(>), gpo
 HB_SUBSET_PLAN_MEMBER (hb_hashmap_t E(), gsub_feature_substitutes_map)
 HB_SUBSET_PLAN_MEMBER (hb_hashmap_t E(), gpos_feature_substitutes_map)
 
+// old feature_indexes set, used to reinstate the old features
+HB_SUBSET_PLAN_MEMBER (hb_set_t, gsub_old_features)
+HB_SUBSET_PLAN_MEMBER (hb_set_t, gpos_old_features)
+
+//feature_index->pair of (address of old feature, feature tag), used for inserting a catch all record
+//if necessary
+HB_SUBSET_PLAN_MEMBER (hb_hashmap_t E()>), gsub_old_feature_idx_tag_map)
+HB_SUBSET_PLAN_MEMBER (hb_hashmap_t E()>), gpos_old_feature_idx_tag_map)
+
 //active layers/palettes we'd like to retain
 HB_SUBSET_PLAN_MEMBER (hb_map_t, colrv1_layers)
 HB_SUBSET_PLAN_MEMBER (hb_map_t, colr_palettes)
+//colrv1 varstore retained varidx mapping
+HB_SUBSET_PLAN_MEMBER (hb_vector_t, colrv1_varstore_inner_maps)
+//colrv1 retained varidx -> (new varidx, delta) mapping
+HB_SUBSET_PLAN_MEMBER (mutable hb_hashmap_t E()>), colrv1_variation_idx_delta_map)
+//colrv1 retained new delta set index -> new varidx mapping
+HB_SUBSET_PLAN_MEMBER (hb_map_t, colrv1_new_deltaset_idx_varidx_map)
 
 //Old layout item variation index -> (New varidx, delta) mapping
 HB_SUBSET_PLAN_MEMBER (mutable hb_hashmap_t E()>), layout_variation_idx_delta_map)
@@ -128,6 +146,15 @@ HB_SUBSET_PLAN_MEMBER (mutable hb_vector_t, bounds_height_vec)
 //map: new_gid -> contour points vector
 HB_SUBSET_PLAN_MEMBER (mutable hb_hashmap_t E(), new_gid_contour_points_map)
 
+//new gids set for composite glyphs
+HB_SUBSET_PLAN_MEMBER (hb_set_t, composite_new_gids)
+
+//Old BASE item variation index -> (New varidx, 0) mapping
+HB_SUBSET_PLAN_MEMBER (mutable hb_hashmap_t E()>), base_variation_idx_map)
+
+//BASE table varstore retained varidx mapping
+HB_SUBSET_PLAN_MEMBER (hb_vector_t, base_varstore_inner_maps)
+
 #ifdef HB_EXPERIMENTAL_API
 // name table overrides map: hb_ot_name_record_ids_t-> name string new value or
 // None to indicate should remove
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-subset-plan.cc b/src/java.desktop/share/native/libharfbuzz/hb-subset-plan.cc
index b9cc4fd0bcd7..fb5282916b92 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-subset-plan.cc
+++ b/src/java.desktop/share/native/libharfbuzz/hb-subset-plan.cc
@@ -32,6 +32,7 @@
 
 #include "hb-ot-cmap-table.hh"
 #include "hb-ot-glyf-table.hh"
+#include "hb-ot-layout-base-table.hh"
 #include "hb-ot-layout-gdef-table.hh"
 #include "hb-ot-layout-gpos-table.hh"
 #include "hb-ot-layout-gsub-table.hh"
@@ -150,7 +151,8 @@ static void _collect_layout_indices (hb_subset_plan_t     *plan,
                                      hb_set_t             *feature_indices, /* OUT */
                                      hb_hashmap_t> *feature_record_cond_idx_map, /* OUT */
                                      hb_hashmap_t *feature_substitutes_map, /* OUT */
-                                     bool& insert_catch_all_feature_variation_record)
+                                     hb_set_t& catch_all_record_feature_idxes, /* OUT */
+                                     hb_hashmap_t>& catch_all_record_idx_feature_map /* OUT */)
 {
   unsigned num_features = table.get_feature_count ();
   hb_vector_t features;
@@ -186,7 +188,7 @@ static void _collect_layout_indices (hb_subset_plan_t     *plan,
       &plan->axes_location,
       feature_record_cond_idx_map,
       feature_substitutes_map,
-      insert_catch_all_feature_variation_record,
+      catch_all_record_feature_idxes,
       feature_indices,
       false,
       false,
@@ -208,17 +210,25 @@ static void _collect_layout_indices (hb_subset_plan_t     *plan,
     f->add_lookup_indexes_to (lookup_indices);
   }
 
+#ifndef HB_NO_VAR
+  if (catch_all_record_feature_idxes)
+  {
+    for (unsigned feature_index : catch_all_record_feature_idxes)
+    {
+      const OT::Feature& f = table.get_feature (feature_index);
+      f.add_lookup_indexes_to (lookup_indices);
+      const void *tag = reinterpret_cast (&(table.get_feature_list ().get_tag (feature_index)));
+      catch_all_record_idx_feature_map.set (feature_index, hb_pair (&f, tag));
+    }
+  }
+
   // If all axes are pinned then all feature variations will be dropped so there's no need
   // to collect lookups from them.
   if (!plan->all_axes_pinned)
-  {
-    // TODO(qxliu76): this collection doesn't work correctly for feature variations that are dropped
-    //                but not applied. The collection will collect and retain the lookup indices
-    //                associated with those dropped but not activated rules. Since partial instancing
-    //                isn't yet supported this isn't an issue yet but will need to be fixed for
-    //                partial instancing.
-    table.feature_variation_collect_lookups (feature_indices, feature_substitutes_map, lookup_indices);
-  }
+    table.feature_variation_collect_lookups (feature_indices,
+                                             plan->user_axes_location.is_empty () ? nullptr: feature_record_cond_idx_map,
+                                             lookup_indices);
+#endif
 }
 
 
@@ -302,7 +312,8 @@ _closure_glyphs_lookups_features (hb_subset_plan_t   *plan,
                                   script_langsys_map *langsys_map,
                                   hb_hashmap_t> *feature_record_cond_idx_map,
                                   hb_hashmap_t *feature_substitutes_map,
-                                  bool& insert_catch_all_feature_variation_record)
+                                  hb_set_t &catch_all_record_feature_idxes,
+                                  hb_hashmap_t>& catch_all_record_idx_feature_map)
 {
   hb_blob_ptr_t table = plan->source_table ();
   hb_tag_t table_tag = table->tableTag;
@@ -313,7 +324,8 @@ _closure_glyphs_lookups_features (hb_subset_plan_t   *plan,
                               &feature_indices,
                               feature_record_cond_idx_map,
                               feature_substitutes_map,
-                              insert_catch_all_feature_variation_record);
+                              catch_all_record_feature_idxes,
+                              catch_all_record_idx_feature_map);
 
   if (table_tag == HB_OT_TAG_GSUB && !(plan->flags & HB_SUBSET_FLAGS_NO_LAYOUT_CLOSURE))
     hb_ot_layout_lookups_substitute_closure (plan->source,
@@ -386,13 +398,56 @@ _get_hb_font_with_variations (const hb_subset_plan_t *plan)
   return font;
 }
 
+static inline void
+_remap_variation_indices (const OT::ItemVariationStore &var_store,
+                          const hb_set_t &variation_indices,
+                          const hb_vector_t& normalized_coords,
+                          bool calculate_delta, /* not pinned at default */
+                          bool no_variations, /* all axes pinned */
+                          hb_hashmap_t> &variation_idx_delta_map /* OUT */)
+{
+  if (&var_store == &Null (OT::ItemVariationStore)) return;
+  unsigned subtable_count = var_store.get_sub_table_count ();
+  float *store_cache = var_store.create_cache ();
+
+  unsigned new_major = 0, new_minor = 0;
+  unsigned last_major = (variation_indices.get_min ()) >> 16;
+  for (unsigned idx : variation_indices)
+  {
+    int delta = 0;
+    if (calculate_delta)
+      delta = roundf (var_store.get_delta (idx, normalized_coords.arrayZ,
+                                           normalized_coords.length, store_cache));
+
+    if (no_variations)
+    {
+      variation_idx_delta_map.set (idx, hb_pair_t (HB_OT_LAYOUT_NO_VARIATIONS_INDEX, delta));
+      continue;
+    }
+
+    uint16_t major = idx >> 16;
+    if (major >= subtable_count) break;
+    if (major != last_major)
+    {
+      new_minor = 0;
+      ++new_major;
+    }
+
+    unsigned new_idx = (new_major << 16) + new_minor;
+    variation_idx_delta_map.set (idx, hb_pair_t (new_idx, delta));
+    ++new_minor;
+    last_major = major;
+  }
+  var_store.destroy_cache (store_cache);
+}
+
 static inline void
 _collect_layout_variation_indices (hb_subset_plan_t* plan)
 {
   hb_blob_ptr_t gdef = plan->source_table ();
   hb_blob_ptr_t gpos = plan->source_table ();
 
-  if (!gdef->has_data ())
+  if (!gdef->has_data () || !gdef->has_var_store ())
   {
     gdef.destroy ();
     gpos.destroy ();
@@ -408,18 +463,47 @@ _collect_layout_variation_indices (hb_subset_plan_t* plan)
   if (hb_ot_layout_has_positioning (plan->source))
     gpos->collect_variation_indices (&c);
 
-  gdef->remap_layout_variation_indices (&varidx_set,
-                                        plan->normalized_coords,
-                                        !plan->pinned_at_default,
-                                        plan->all_axes_pinned,
-                                        &plan->layout_variation_idx_delta_map);
+  _remap_variation_indices (gdef->get_var_store (),
+                            varidx_set, plan->normalized_coords,
+                            !plan->pinned_at_default,
+                            plan->all_axes_pinned,
+                            plan->layout_variation_idx_delta_map);
 
-  unsigned subtable_count = gdef->has_var_store () ? gdef->get_var_store ().get_sub_table_count () : 0;
+  unsigned subtable_count = gdef->get_var_store ().get_sub_table_count ();
   _generate_varstore_inner_maps (varidx_set, subtable_count, plan->gdef_varstore_inner_maps);
 
   gdef.destroy ();
   gpos.destroy ();
 }
+
+#ifndef HB_NO_BASE
+static inline void
+_collect_base_variation_indices (hb_subset_plan_t* plan)
+{
+  hb_blob_ptr_t base = plan->source_table ();
+  if (!base->has_var_store ())
+  {
+    base.destroy ();
+    return;
+  }
+
+  hb_set_t varidx_set;
+  base->collect_variation_indices (plan, varidx_set);
+  const OT::ItemVariationStore &var_store = base->get_var_store ();
+  unsigned subtable_count = var_store.get_sub_table_count ();
+
+
+  _remap_variation_indices (var_store, varidx_set,
+                            plan->normalized_coords,
+                            !plan->pinned_at_default,
+                            plan->all_axes_pinned,
+                            plan->base_variation_idx_map);
+  _generate_varstore_inner_maps (varidx_set, subtable_count, plan->base_varstore_inner_maps);
+
+  base.destroy ();
+}
+
+#endif
 #endif
 
 static inline void
@@ -431,12 +515,45 @@ _cmap_closure (hb_face_t           *face,
   cmap.table->closure_glyphs (unicodes, glyphset);
 }
 
-static void _colr_closure (hb_face_t *face,
-                           hb_map_t *layers_map,
-                           hb_map_t *palettes_map,
+#ifndef HB_NO_VAR
+static void
+_remap_colrv1_delta_set_index_indices (const OT::DeltaSetIndexMap &index_map,
+                                       const hb_set_t &delta_set_idxes,
+                                       hb_hashmap_t> &variation_idx_delta_map, /* IN/OUT */
+                                       hb_map_t &new_deltaset_idx_varidx_map /* OUT */)
+{
+  if (!index_map.get_map_count ())
+    return;
+
+  hb_hashmap_t> delta_set_idx_delta_map;
+  unsigned new_delta_set_idx = 0;
+  for (unsigned delta_set_idx : delta_set_idxes)
+  {
+    unsigned var_idx = index_map.map (delta_set_idx);
+    unsigned new_varidx = HB_OT_LAYOUT_NO_VARIATIONS_INDEX;
+    int delta = 0;
+
+    if (var_idx != HB_OT_LAYOUT_NO_VARIATIONS_INDEX)
+    {
+      hb_pair_t *new_varidx_delta;
+      if (!variation_idx_delta_map.has (var_idx, &new_varidx_delta)) continue;
+
+      new_varidx = hb_first (*new_varidx_delta);
+      delta = hb_second (*new_varidx_delta);
+    }
+
+    new_deltaset_idx_varidx_map.set (new_delta_set_idx, new_varidx);
+    delta_set_idx_delta_map.set (delta_set_idx, hb_pair_t (new_delta_set_idx, delta));
+    new_delta_set_idx++;
+  }
+  variation_idx_delta_map = std::move (delta_set_idx_delta_map);
+}
+#endif
+
+static void _colr_closure (hb_subset_plan_t* plan,
                            hb_set_t *glyphs_colred)
 {
-  OT::COLR::accelerator_t colr (face);
+  OT::COLR::accelerator_t colr (plan->source);
   if (!colr.is_valid ()) return;
 
   hb_set_t palette_indices, layer_indices;
@@ -448,11 +565,45 @@ static void _colr_closure (hb_face_t *face,
   glyphs_colred->union_ (glyphset_colrv0);
 
   //closure for COLRv1
-  colr.closure_forV1 (glyphs_colred, &layer_indices, &palette_indices);
+  hb_set_t variation_indices, delta_set_indices;
+  colr.closure_forV1 (glyphs_colred, &layer_indices, &palette_indices, &variation_indices, &delta_set_indices);
 
   colr.closure_V0palette_indices (glyphs_colred, &palette_indices);
-  _remap_indexes (&layer_indices, layers_map);
-  _remap_palette_indexes (&palette_indices, palettes_map);
+  _remap_indexes (&layer_indices, &plan->colrv1_layers);
+  _remap_palette_indexes (&palette_indices, &plan->colr_palettes);
+
+#ifndef HB_NO_VAR
+  if (!colr.has_var_store () || !variation_indices) return;
+
+  const OT::ItemVariationStore &var_store = colr.get_var_store ();
+  // generated inner_maps is used by ItemVariationStore serialize(), which is subset only
+  unsigned subtable_count = var_store.get_sub_table_count ();
+  _generate_varstore_inner_maps (variation_indices, subtable_count, plan->colrv1_varstore_inner_maps);
+
+  /* colr variation indices mapping during planning phase:
+   * generate colrv1_variation_idx_delta_map. When delta set index map is not
+   * included, it's a mapping from varIdx-> (new varIdx,delta). Otherwise, it's
+   * a mapping from old delta set idx-> (new delta set idx, delta). Mapping
+   * delta set indices is the same as gid mapping.
+   * Besides, we need to generate a delta set idx-> new var_idx map for updating
+   * delta set index map if exists. This map will be updated again after
+   * instancing. */
+  if (!plan->all_axes_pinned)
+  {
+    _remap_variation_indices (var_store,
+                              variation_indices,
+                              plan->normalized_coords,
+                              false, /* no need to calculate delta for COLR during planning */
+                              plan->all_axes_pinned,
+                              plan->colrv1_variation_idx_delta_map);
+
+    if (colr.has_delta_set_index_map ())
+      _remap_colrv1_delta_set_index_indices (colr.get_delta_set_index_map (),
+                                             delta_set_indices,
+                                             plan->colrv1_variation_idx_delta_map,
+                                             plan->colrv1_new_deltaset_idx_varidx_map);
+  }
+#endif
 }
 
 static inline void
@@ -465,6 +616,24 @@ _math_closure (hb_subset_plan_t *plan,
   math.destroy ();
 }
 
+static inline void
+_remap_used_mark_sets (hb_subset_plan_t *plan,
+                       hb_map_t& used_mark_sets_map)
+{
+  hb_blob_ptr_t gdef = plan->source_table ();
+
+  if (!gdef->has_data () || !gdef->has_mark_glyph_sets ())
+  {
+    gdef.destroy ();
+    return;
+  }
+
+  hb_set_t used_mark_sets;
+  gdef->get_mark_glyph_sets ().collect_used_mark_sets (plan->_glyphset_gsub, used_mark_sets);
+  gdef.destroy ();
+
+  _remap_indexes (&used_mark_sets, &used_mark_sets_map);
+}
 
 static inline void
 _remove_invalid_gids (hb_set_t *glyphs,
@@ -473,6 +642,36 @@ _remove_invalid_gids (hb_set_t *glyphs,
   glyphs->del_range (num_glyphs, HB_SET_VALUE_INVALID);
 }
 
+template
+static void
+_fill_unicode_and_glyph_map(hb_subset_plan_t *plan,
+                            I unicode_iterator,
+                            F unicode_to_gid_for_iterator,
+                            G unicode_to_gid_general)
+{
+  for (hb_codepoint_t cp : unicode_iterator)
+  {
+    hb_codepoint_t gid = unicode_to_gid_for_iterator(cp);
+    if (!GID_ALWAYS_EXISTS && gid == HB_MAP_VALUE_INVALID)
+    {
+      DEBUG_MSG(SUBSET, nullptr, "Drop U+%04X; no gid", cp);
+      continue;
+    }
+
+    plan->codepoint_to_glyph->set (cp, gid);
+    plan->unicode_to_new_gid_list.push (hb_pair (cp, gid));
+  }
+}
+
+template
+static void
+_fill_unicode_and_glyph_map(hb_subset_plan_t *plan,
+                            I unicode_iterator,
+                            F unicode_to_gid_for_iterator)
+{
+  _fill_unicode_and_glyph_map(plan, unicode_iterator, unicode_to_gid_for_iterator, unicode_to_gid_for_iterator);
+}
+
 static void
 _populate_unicodes_to_retain (const hb_set_t *unicodes,
                               const hb_set_t *glyphs,
@@ -480,6 +679,7 @@ _populate_unicodes_to_retain (const hb_set_t *unicodes,
 {
   OT::cmap::accelerator_t cmap (plan->source);
   unsigned size_threshold = plan->source->get_num_glyphs ();
+
   if (glyphs->is_empty () && unicodes->get_population () < size_threshold)
   {
 
@@ -492,35 +692,21 @@ _populate_unicodes_to_retain (const hb_set_t *unicodes,
     // not excessively large (eg. an inverted set).
     plan->unicode_to_new_gid_list.alloc (unicodes->get_population ());
     if (!unicode_to_gid) {
-      for (hb_codepoint_t cp : *unicodes)
-      {
+      _fill_unicode_and_glyph_map(plan, unicodes->iter(), [&] (hb_codepoint_t cp) {
         hb_codepoint_t gid;
-        if (!cmap.get_nominal_glyph (cp, &gid))
-        {
-          DEBUG_MSG(SUBSET, nullptr, "Drop U+%04X; no gid", cp);
-          continue;
+        if (!cmap.get_nominal_glyph (cp, &gid)) {
+          return HB_MAP_VALUE_INVALID;
         }
-
-        plan->codepoint_to_glyph->set (cp, gid);
-        plan->unicode_to_new_gid_list.push (hb_pair (cp, gid));
-      }
+        return gid;
+      });
     } else {
       // Use in memory unicode to gid map it's faster then looking up from
       // the map. This code is mostly duplicated from above to avoid doing
       // conditionals on the presence of the unicode_to_gid map each
       // iteration.
-      for (hb_codepoint_t cp : *unicodes)
-      {
-        hb_codepoint_t gid = unicode_to_gid->get (cp);
-        if (gid == HB_MAP_VALUE_INVALID)
-        {
-          DEBUG_MSG(SUBSET, nullptr, "Drop U+%04X; no gid", cp);
-          continue;
-        }
-
-        plan->codepoint_to_glyph->set (cp, gid);
-        plan->unicode_to_new_gid_list.push (hb_pair (cp, gid));
-      }
+      _fill_unicode_and_glyph_map(plan, unicodes->iter(), [&] (hb_codepoint_t cp) {
+        return unicode_to_gid->get (cp);
+      });
     }
   }
   else
@@ -550,42 +736,46 @@ _populate_unicodes_to_retain (const hb_set_t *unicodes,
       plan->codepoint_to_glyph->alloc (unicodes->get_population () + glyphs->get_population ());
 
       auto &gid_to_unicodes = plan->accelerator->gid_to_unicodes;
+
       for (hb_codepoint_t gid : *glyphs)
       {
         auto unicodes = gid_to_unicodes.get (gid);
-
-        for (hb_codepoint_t cp : unicodes)
-        {
-          plan->codepoint_to_glyph->set (cp, gid);
-          plan->unicode_to_new_gid_list.push (hb_pair (cp, gid));
-        }
+        _fill_unicode_and_glyph_map(plan, unicodes, [&] (hb_codepoint_t cp) {
+          return gid;
+        },
+        [&] (hb_codepoint_t cp) {
+          return unicode_glyphid_map->get(cp);
+        });
       }
-      for (hb_codepoint_t cp : *unicodes)
-      {
-        /* Don't double-add entry. */
+
+      _fill_unicode_and_glyph_map(plan, unicodes->iter(), [&] (hb_codepoint_t cp) {
+          /* Don't double-add entry. */
         if (plan->codepoint_to_glyph->has (cp))
-          continue;
+          return HB_MAP_VALUE_INVALID;
 
-        hb_codepoint_t *gid;
-        if (!unicode_glyphid_map->has(cp, &gid))
-          continue;
+        return unicode_glyphid_map->get(cp);
+      },
+      [&] (hb_codepoint_t cp) {
+          return unicode_glyphid_map->get(cp);
+      });
 
-        plan->codepoint_to_glyph->set (cp, *gid);
-        plan->unicode_to_new_gid_list.push (hb_pair (cp, *gid));
-      }
       plan->unicode_to_new_gid_list.qsort ();
     }
     else
     {
       plan->codepoint_to_glyph->alloc (cmap_unicodes->get_population ());
-      for (hb_codepoint_t cp : *cmap_unicodes)
+      hb_codepoint_t first = HB_SET_VALUE_INVALID, last = HB_SET_VALUE_INVALID;
+      for (; cmap_unicodes->next_range (&first, &last); )
       {
-        hb_codepoint_t gid = (*unicode_glyphid_map)[cp];
-        if (!unicodes->has (cp) && !glyphs->has (gid))
-          continue;
-
-        plan->codepoint_to_glyph->set (cp, gid);
-        plan->unicode_to_new_gid_list.push (hb_pair (cp, gid));
+        _fill_unicode_and_glyph_map(plan, hb_range(first, last + 1), [&] (hb_codepoint_t cp) {
+          hb_codepoint_t gid = (*unicode_glyphid_map)[cp];
+          if (!unicodes->has (cp) && !glyphs->has (gid))
+            return HB_MAP_VALUE_INVALID;
+          return gid;
+        },
+        [&] (hb_codepoint_t cp) {
+          return unicode_glyphid_map->get(cp);
+        });
       }
     }
 
@@ -608,11 +798,22 @@ _populate_unicodes_to_retain (const hb_set_t *unicodes,
     plan->unicodes.add_sorted_array (&arr.arrayZ->first, arr.length, sizeof (*arr.arrayZ));
     plan->_glyphset_gsub.add_array (&arr.arrayZ->second, arr.length, sizeof (*arr.arrayZ));
   }
-}
 
-#ifndef HB_COMPOSITE_OPERATIONS_PER_GLYPH
-#define HB_COMPOSITE_OPERATIONS_PER_GLYPH 64
-#endif
+  // Variation selectors don't have glyphs associated with them in the cmap so they will have been filtered out above
+  // but should still be retained. Add them back here.
+
+  // However, the min and max codepoints for OS/2 should be calculated without considering variation selectors,
+  // so record those first.
+  plan->os2_info.min_cmap_codepoint = plan->unicodes.get_min();
+  plan->os2_info.max_cmap_codepoint = plan->unicodes.get_max();
+
+  hb_set_t variation_selectors_to_retain;
+  cmap.collect_variation_selectors(&variation_selectors_to_retain);
+  + variation_selectors_to_retain.iter()
+  | hb_filter(unicodes)
+  | hb_sink(&plan->unicodes)
+  ;
+}
 
 static unsigned
 _glyf_add_gid_and_children (const OT::glyf_accelerator_t &glyf,
@@ -639,18 +840,6 @@ _glyf_add_gid_and_children (const OT::glyf_accelerator_t &glyf,
                                   operation_count,
                                   depth);
 
-#ifndef HB_NO_VAR_COMPOSITES
-  for (auto &item : glyph.get_var_composite_iterator ())
-   {
-    operation_count =
-      _glyf_add_gid_and_children (glyf,
-                                  item.get_gid (),
-                                  gids_to_retain,
-                                  operation_count,
-                                  depth);
-   }
-#endif
-
   return operation_count;
 }
 
@@ -714,7 +903,8 @@ _populate_gids_to_retain (hb_subset_plan_t* plan,
         &plan->gsub_langsys,
         &plan->gsub_feature_record_cond_idx_map,
         &plan->gsub_feature_substitutes_map,
-        plan->gsub_insert_catch_all_feature_variation_rec);
+        plan->gsub_old_features,
+        plan->gsub_old_feature_idx_tag_map);
 
   if (!drop_tables->has (HB_OT_TAG_GPOS))
     _closure_glyphs_lookups_features (
@@ -725,7 +915,8 @@ _populate_gids_to_retain (hb_subset_plan_t* plan,
         &plan->gpos_langsys,
         &plan->gpos_feature_record_cond_idx_map,
         &plan->gpos_feature_substitutes_map,
-        plan->gpos_insert_catch_all_feature_variation_rec);
+        plan->gpos_old_features,
+        plan->gpos_old_feature_idx_tag_map);
 #endif
   _remove_invalid_gids (&plan->_glyphset_gsub, plan->source->get_num_glyphs ());
 
@@ -739,19 +930,21 @@ _populate_gids_to_retain (hb_subset_plan_t* plan,
   hb_set_t cur_glyphset = plan->_glyphset_mathed;
   if (!drop_tables->has (HB_OT_TAG_COLR))
   {
-    _colr_closure (plan->source, &plan->colrv1_layers, &plan->colr_palettes, &cur_glyphset);
+    _colr_closure (plan, &cur_glyphset);
     _remove_invalid_gids (&cur_glyphset, plan->source->get_num_glyphs ());
   }
 
   plan->_glyphset_colred = cur_glyphset;
 
+  // XXX TODO VARC closure / subset
+
   _nameid_closure (plan, drop_tables);
   /* Populate a full set of glyphs to retain by adding all referenced
    * composite glyphs. */
   if (glyf.has_data ())
     for (hb_codepoint_t gid : cur_glyphset)
       _glyf_add_gid_and_children (glyf, gid, &plan->_glyphset,
-                                  cur_glyphset.get_population () * HB_COMPOSITE_OPERATIONS_PER_GLYPH);
+                                  cur_glyphset.get_population () * HB_MAX_COMPOSITE_OPERATIONS_PER_GLYPH);
   else
     plan->_glyphset.union_ (cur_glyphset);
 #ifndef HB_NO_SUBSET_CFF
@@ -871,9 +1064,11 @@ _create_old_gid_to_new_gid_map (const hb_face_t *face,
     *num_glyphs = max_glyph + 1;
   }
 
+  reverse_glyph_map->alloc (reverse_glyph_map->get_population () + new_to_old_gid_list->length);
   + hb_iter (new_to_old_gid_list)
   | hb_sink (reverse_glyph_map)
   ;
+  glyph_map->alloc (glyph_map->get_population () + new_to_old_gid_list->length);
   + hb_iter (new_to_old_gid_list)
   | hb_map (&hb_codepoint_pair_t::reverse)
   | hb_sink (glyph_map)
@@ -932,9 +1127,9 @@ _normalize_axes_location (hb_face_t *face, hb_subset_plan_t *plan)
         normalized_default = seg_maps->map (normalized_default);
         normalized_max = seg_maps->map (normalized_max);
       }
-      plan->axes_location.set (axis_tag, Triple (static_cast (normalized_min / 16384.f),
-                                                 static_cast (normalized_default / 16384.f),
-                                                 static_cast (normalized_max / 16384.f)));
+      plan->axes_location.set (axis_tag, Triple (static_cast (normalized_min / 16384.0),
+                                                 static_cast (normalized_default / 16384.0),
+                                                 static_cast (normalized_max / 16384.0)));
 
       if (normalized_default != 0)
         plan->pinned_at_default = false;
@@ -957,8 +1152,8 @@ _update_instance_metrics_map_from_cff2 (hb_subset_plan_t *plan)
   OT::cff2::accelerator_t cff2 (plan->source);
   if (!cff2.is_valid ()) return;
 
-  hb_font_t *font = nullptr;
-  if (unlikely (!plan->check_success (font = _get_hb_font_with_variations (plan))))
+  hb_font_t *font = _get_hb_font_with_variations (plan);
+  if (unlikely (!plan->check_success (font != nullptr)))
   {
     hb_font_destroy (font);
     return;
@@ -1036,8 +1231,8 @@ _update_instance_metrics_map_from_cff2 (hb_subset_plan_t *plan)
 static bool
 _get_instance_glyphs_contour_points (hb_subset_plan_t *plan)
 {
-  /* contour_points vector only needed for updating gvar table (infer delta)
-   * during partial instancing */
+  /* contour_points vector only needed for updating gvar table (infer delta and
+   * iup delta optimization) during partial instancing */
   if (plan->user_axes_location.is_empty () || plan->all_axes_pinned)
     return true;
 
@@ -1055,10 +1250,15 @@ _get_instance_glyphs_contour_points (hb_subset_plan_t *plan)
     }
 
     hb_codepoint_t old_gid = _.second;
-    if (unlikely (!glyf.glyph_for_gid (old_gid).get_all_points_without_var (plan->source, all_points)))
+    auto glyph = glyf.glyph_for_gid (old_gid);
+    if (unlikely (!glyph.get_all_points_without_var (plan->source, all_points)))
       return false;
     if (unlikely (!plan->new_gid_contour_points_map.set (new_gid, all_points)))
       return false;
+
+    /* composite new gids are only needed by iup delta optimization */
+    if ((plan->flags & HB_SUBSET_FLAGS_OPTIMIZE_IUP_DELTAS) && glyph.is_composite ())
+      plan->composite_new_gids.add (new_gid);
   }
   return true;
 }
@@ -1093,6 +1293,7 @@ hb_subset_plan_t::hb_subset_plan_t (hb_face_t *face,
   user_axes_location = input->axes_location;
   all_axes_pinned = false;
   pinned_at_default = true;
+  has_gdef_varstore = false;
 
 #ifdef HB_EXPERIMENTAL_API
   for (auto _ : input->name_table_overrides)
@@ -1112,6 +1313,10 @@ hb_subset_plan_t::hb_subset_plan_t (hb_face_t *face,
 
   attach_accelerator_data = input->attach_accelerator_data;
   force_long_loca = input->force_long_loca;
+#ifdef HB_EXPERIMENTAL_API
+  force_long_loca = force_long_loca || (flags & HB_SUBSET_FLAGS_IFTB_REQUIREMENTS);
+#endif
+
   if (accel)
     accelerator = (hb_subset_accelerator_t*) accel;
 
@@ -1160,6 +1365,16 @@ hb_subset_plan_t::hb_subset_plan_t (hb_face_t *face,
   for (auto &v : bounds_height_vec)
     v = 0xFFFFFFFF;
 
+  if (!drop_tables.has (HB_OT_TAG_GDEF))
+    _remap_used_mark_sets (this, used_mark_sets_map);
+
+#ifndef HB_NO_VAR
+#ifndef HB_NO_BASE
+  if (!drop_tables.has (HB_OT_TAG_BASE))
+    _collect_base_variation_indices (this);
+#endif
+#endif
+
   if (unlikely (in_error ()))
     return;
 
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-subset-plan.hh b/src/java.desktop/share/native/libharfbuzz/hb-subset-plan.hh
index 40a6ff112af9..a6bae23966a7 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-subset-plan.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-subset-plan.hh
@@ -41,6 +41,13 @@ namespace OT {
 struct Feature;
 }
 
+struct os2_info_t {
+  hb_codepoint_t min_cmap_codepoint;
+  hb_codepoint_t max_cmap_codepoint;
+};
+
+typedef struct os2_info_t os2_info_t;
+
 struct head_maxp_info_t
 {
   head_maxp_info_t ()
@@ -78,10 +85,16 @@ struct contour_point_t
           y  = x * matrix[1] + y * matrix[3];
     x  = x_;
   }
+
+  void add_delta (float delta_x, float delta_y)
+  {
+    x += delta_x;
+    y += delta_y;
+  }
+
   HB_ALWAYS_INLINE
   void translate (const contour_point_t &p) { x += p.x; y += p.y; }
 
-
   float x;
   float y;
   uint8_t flag;
@@ -90,14 +103,20 @@ struct contour_point_t
 
 struct contour_point_vector_t : hb_vector_t
 {
-  void extend (const hb_array_t &a)
+  bool add_deltas (hb_array_t deltas_x,
+                   hb_array_t deltas_y,
+                   hb_array_t indices)
   {
-    unsigned int old_len = length;
-    if (unlikely (!resize (old_len + a.length, false)))
-      return;
-    auto arrayZ = this->arrayZ + old_len;
-    unsigned count = a.length;
-    hb_memcpy (arrayZ, a.arrayZ, count * sizeof (arrayZ[0]));
+    if (indices.length != deltas_x.length ||
+        indices.length != deltas_y.length)
+      return false;
+
+    for (unsigned i = 0; i < indices.length; i++)
+    {
+      if (!indices.arrayZ[i]) continue;
+      arrayZ[i].add_delta (deltas_x.arrayZ[i], deltas_y.arrayZ[i]);
+    }
+    return true;
   }
 };
 
@@ -147,6 +166,9 @@ struct hb_subset_plan_t
   bool gsub_insert_catch_all_feature_variation_rec;
   bool gpos_insert_catch_all_feature_variation_rec;
 
+  // whether GDEF ItemVariationStore is retained
+  mutable bool has_gdef_varstore;
+
 #define HB_SUBSET_PLAN_MEMBER(Type, Name) Type Name;
 #include "hb-subset-plan-member-list.hh"
 #undef HB_SUBSET_PLAN_MEMBER
@@ -154,6 +176,8 @@ struct hb_subset_plan_t
   //recalculated head/maxp table info after instancing
   mutable head_maxp_info_t head_maxp_info;
 
+  os2_info_t os2_info;
+
   const hb_subset_accelerator_t* accelerator;
   hb_subset_accelerator_t* inprogress_accelerator;
 
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-subset-serialize.h b/src/java.desktop/share/native/libharfbuzz/hb-subset-serialize.h
new file mode 100644
index 000000000000..9035d4ced7a1
--- /dev/null
+++ b/src/java.desktop/share/native/libharfbuzz/hb-subset-serialize.h
@@ -0,0 +1,83 @@
+/*
+ * Copyright © 2022  Google, Inc.
+ *
+ *  This is part of HarfBuzz, a text shaping library.
+ *
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, provided that the
+ * above copyright notice and the following two paragraphs appear in
+ * all copies of this software.
+ *
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR
+ * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES
+ * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN
+ * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ * DAMAGE.
+ *
+ * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING,
+ * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS FOR A PARTICULAR PURPOSE.  THE SOFTWARE PROVIDED HEREUNDER IS
+ * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO
+ * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
+ *
+ */
+
+#ifndef HB_SUBSET_SERIALIZE_H
+#define HB_SUBSET_SERIALIZE_H
+
+#include "hb.h"
+
+HB_BEGIN_DECLS
+
+/**
+ * hb_subset_serialize_link_t:
+ * @width: offsetSize in bytes
+ * @position: position of the offset field in bytes from
+ *            beginning of subtable
+ * @objidx: index of subtable
+ *
+ * Represents a link between two objects in the object graph
+ * to be serialized.
+ *
+ * Since: 10.2.0
+ */
+typedef struct hb_subset_serialize_link_t {
+  unsigned int width;
+  unsigned int position;
+  unsigned int objidx;
+} hb_subset_serialize_link_t;
+
+/**
+ * hb_subset_serialize_object_t:
+ * @head: start of object data
+ * @tail: end of object data
+ * @num_real_links: number of offset field in the object
+ * @real_links: array of offset info
+ * @num_virtual_links: number of objects that must be packed
+ *                     after current object in the final
+ *                     serialized order
+ * @virtual_links: array of virtual link info
+ *
+ * Represents an object in the object graph to be serialized.
+ *
+ * Since: 10.2.0
+ */
+typedef struct hb_subset_serialize_object_t {
+  char *head;
+  char *tail;
+  unsigned int num_real_links;
+  hb_subset_serialize_link_t *real_links;
+  unsigned int num_virtual_links;
+  hb_subset_serialize_link_t *virtual_links;
+} hb_subset_serialize_object_t;
+
+HB_EXTERN hb_blob_t *
+hb_subset_serialize_or_fail (hb_tag_t                      table_tag,
+                             hb_subset_serialize_object_t *hb_objects,
+                             unsigned                      num_hb_objs);
+
+
+HB_END_DECLS
+
+#endif /* HB_SUBSET_SERIALIZE_H */
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-subset.cc b/src/java.desktop/share/native/libharfbuzz/hb-subset.cc
index c125a435b2b7..595cafc283ee 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-subset.cc
+++ b/src/java.desktop/share/native/libharfbuzz/hb-subset.cc
@@ -48,6 +48,7 @@
 #include "hb-ot-cff2-table.hh"
 #include "hb-ot-vorg-table.hh"
 #include "hb-ot-name-table.hh"
+#include "hb-ot-layout-base-table.hh"
 #include "hb-ot-layout-gsub-table.hh"
 #include "hb-ot-layout-gpos-table.hh"
 #include "hb-ot-var-avar-table.hh"
@@ -294,8 +295,8 @@ _try_subset (const TableType *table,
   DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c ran out of room; reallocating to %u bytes.",
              HB_UNTAG (c->table_tag), buf_size);
 
-  if (unlikely (buf_size > c->source_blob->length * 16 ||
-                !buf->alloc (buf_size, true)))
+  if (unlikely (buf_size > c->source_blob->length * 256 ||
+                !buf->alloc_exact (buf_size)))
   {
     DEBUG_MSG (SUBSET, nullptr, "OT::%c%c%c%c failed to reallocate %u bytes.",
                HB_UNTAG (c->table_tag), buf_size);
@@ -460,9 +461,10 @@ _dependencies_satisfied (hb_subset_plan_t *plan, hb_tag_t tag,
   case HB_OT_TAG_hmtx:
   case HB_OT_TAG_vmtx:
   case HB_OT_TAG_maxp:
+  case HB_OT_TAG_OS2:
     return !plan->normalized_coords || !pending_subset_tags.has (HB_OT_TAG_glyf);
   case HB_OT_TAG_GPOS:
-    return !plan->normalized_coords || plan->all_axes_pinned || !pending_subset_tags.has (HB_OT_TAG_GDEF);
+    return plan->all_axes_pinned || !pending_subset_tags.has (HB_OT_TAG_GDEF);
   default:
     return true;
   }
@@ -502,6 +504,7 @@ _subset_table (hb_subset_plan_t *plan,
   case HB_OT_TAG_CBLC: return _subset (plan, buf);
   case HB_OT_TAG_CBDT: return true; /* skip CBDT, handled by CBLC */
   case HB_OT_TAG_MATH: return _subset (plan, buf);
+  case HB_OT_TAG_BASE: return _subset (plan, buf);
 
 #ifndef HB_NO_SUBSET_CFF
   case HB_OT_TAG_CFF1: return _subset (plan, buf);
@@ -547,6 +550,7 @@ _subset_table (hb_subset_plan_t *plan,
     }
 #endif
     return _passthrough (plan, tag);
+
   default:
     if (plan->flags & HB_SUBSET_FLAGS_PASSTHROUGH_UNRECOGNIZED)
       return _passthrough (plan, tag);
@@ -590,14 +594,20 @@ static void _attach_accelerator_data (hb_subset_plan_t* plan,
  * @input: input to use for the subsetting.
  *
  * Subsets a font according to provided input. Returns nullptr
- * if the subset operation fails.
+ * if the subset operation fails or the face has no glyphs.
  *
  * Since: 2.9.0
  **/
 hb_face_t *
 hb_subset_or_fail (hb_face_t *source, const hb_subset_input_t *input)
 {
-  if (unlikely (!input || !source)) return hb_face_get_empty ();
+  if (unlikely (!input || !source)) return nullptr;
+
+  if (unlikely (!source->get_num_glyphs ()))
+  {
+    DEBUG_MSG (SUBSET, nullptr, "No glyphs in source font.");
+    return nullptr;
+  }
 
   hb_subset_plan_t *plan = hb_subset_plan_create_or_fail (source, input);
   if (unlikely (!plan)) {
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-subset.h b/src/java.desktop/share/native/libharfbuzz/hb-subset.h
index 8ea24da41b94..13fcd5332e6b 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-subset.h
+++ b/src/java.desktop/share/native/libharfbuzz/hb-subset.h
@@ -73,6 +73,11 @@ typedef struct hb_subset_plan_t hb_subset_plan_t;
  * OS/2 will not be recalculated.
  * @HB_SUBSET_FLAGS_NO_LAYOUT_CLOSURE: If set don't perform glyph closure on layout
  * substitution rules (GSUB). Since: 7.2.0.
+ * @HB_SUBSET_FLAGS_OPTIMIZE_IUP_DELTAS: If set perform IUP delta optimization on the
+ * remaining gvar table's deltas. Since: 8.5.0
+ * @HB_SUBSET_FLAGS_IFTB_REQUIREMENTS: If set enforce requirements on the output subset
+ * to allow it to be used with incremental font transfer IFTB patches. Primarily,
+ * this forces all outline data to use long (32 bit) offsets. Since: EXPERIMENTAL
  *
  * List of boolean properties that can be configured on the subset input.
  *
@@ -90,6 +95,10 @@ typedef enum { /*< flags >*/
   HB_SUBSET_FLAGS_GLYPH_NAMES =              0x00000080u,
   HB_SUBSET_FLAGS_NO_PRUNE_UNICODE_RANGES =  0x00000100u,
   HB_SUBSET_FLAGS_NO_LAYOUT_CLOSURE =        0x00000200u,
+  HB_SUBSET_FLAGS_OPTIMIZE_IUP_DELTAS     =  0x00000400u,
+#ifdef HB_EXPERIMENTAL_API
+  HB_SUBSET_FLAGS_IFTB_REQUIREMENTS       =  0x00000800u,
+#endif
 } hb_subset_flags_t;
 
 /**
@@ -164,6 +173,10 @@ HB_EXTERN void
 hb_subset_input_set_flags (hb_subset_input_t *input,
                            unsigned value);
 
+HB_EXTERN hb_bool_t
+hb_subset_input_pin_all_axes_to_default (hb_subset_input_t  *input,
+                                         hb_face_t          *face);
+
 HB_EXTERN hb_bool_t
 hb_subset_input_pin_axis_to_default (hb_subset_input_t  *input,
                                      hb_face_t          *face,
@@ -175,15 +188,34 @@ hb_subset_input_pin_axis_location (hb_subset_input_t  *input,
                                    hb_tag_t            axis_tag,
                                    float               axis_value);
 
-#ifdef HB_EXPERIMENTAL_API
+HB_EXTERN hb_bool_t
+hb_subset_input_get_axis_range (hb_subset_input_t  *input,
+                                hb_tag_t            axis_tag,
+                                float              *axis_min_value,
+                                float              *axis_max_value,
+                                float              *axis_def_value);
+
 HB_EXTERN hb_bool_t
 hb_subset_input_set_axis_range (hb_subset_input_t  *input,
                                 hb_face_t          *face,
                                 hb_tag_t            axis_tag,
                                 float               axis_min_value,
                                 float               axis_max_value,
-                                float              *axis_def_value);
+                                float               axis_def_value);
+
+HB_EXTERN hb_bool_t
+hb_subset_axis_range_from_string (const char *str, int len,
+                                  float *axis_min_value,
+                                  float *axis_max_value,
+                                  float *axis_def_value);
 
+HB_EXTERN void
+hb_subset_axis_range_to_string (hb_subset_input_t *input,
+                                hb_tag_t axis_tag,
+                                char *buf,
+                                unsigned size);
+
+#ifdef HB_EXPERIMENTAL_API
 HB_EXTERN hb_bool_t
 hb_subset_input_override_name_table (hb_subset_input_t  *input,
                                      hb_ot_name_id_t     name_id,
@@ -192,7 +224,6 @@ hb_subset_input_override_name_table (hb_subset_input_t  *input,
                                      unsigned            language_id,
                                      const char         *name_str,
                                      int                 str_len);
-
 #endif
 
 HB_EXTERN hb_face_t *
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-ucd-table.hh b/src/java.desktop/share/native/libharfbuzz/hb-ucd-table.hh
index 8d3807a80f0c..8731a0bcf8d7 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-ucd-table.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-ucd-table.hh
@@ -4,7 +4,7 @@
  *
  *   ./gen-ucd-table.py ucd.nounihan.grouped.xml
  *
- * on file with this description: Unicode 15.1.0
+ * on file with this description: Unicode 16.0.0
  */
 
 #ifndef HB_UCD_TABLE_HH
@@ -13,7 +13,7 @@
 #include "hb.hh"
 
 static const hb_script_t
-_hb_ucd_sc_map[165] =
+_hb_ucd_sc_map[172] =
 {
                    HB_SCRIPT_COMMON,              HB_SCRIPT_INHERITED,
                   HB_SCRIPT_UNKNOWN,                 HB_SCRIPT_ARABIC,
@@ -97,7 +97,10 @@ _hb_ucd_sc_map[165] =
                HB_SCRIPT_OLD_UYGHUR,                 HB_SCRIPT_TANGSA,
                      HB_SCRIPT_TOTO,               HB_SCRIPT_VITHKUQI,
                      HB_SCRIPT_MATH,                   HB_SCRIPT_KAWI,
-              HB_SCRIPT_NAG_MUNDARI,
+              HB_SCRIPT_NAG_MUNDARI,                  HB_SCRIPT_GARAY,
+             HB_SCRIPT_GURUNG_KHEMA,              HB_SCRIPT_KIRAT_RAI,
+                  HB_SCRIPT_OL_ONAL,                HB_SCRIPT_SUNUWAR,
+                   HB_SCRIPT_TODHRI,          HB_SCRIPT_TULU_TIGALARI,
 };
 static const uint16_t
 _hb_ucd_dm1_p0_map[825] =
@@ -868,7 +871,7 @@ _hb_ucd_dm2_u32_map[638] =
    HB_CODEPOINT_ENCODE3_11_7_14 (0x04E9u, 0x0308u, 0x04EBu),
 };
 static const uint64_t
-_hb_ucd_dm2_u64_map[388] =
+_hb_ucd_dm2_u64_map[408] =
 {
      HB_CODEPOINT_ENCODE3 (0x05D0u, 0x05B7u, 0x0000u),   HB_CODEPOINT_ENCODE3 (0x05D0u, 0x05B8u, 0x0000u),
      HB_CODEPOINT_ENCODE3 (0x05D0u, 0x05BCu, 0x0000u),   HB_CODEPOINT_ENCODE3 (0x05D1u, 0x05BCu, 0x0000u),
@@ -1051,13 +1054,23 @@ _hb_ucd_dm2_u64_map[388] =
      HB_CODEPOINT_ENCODE3 (0x30F0u, 0x3099u, 0x30F8u),   HB_CODEPOINT_ENCODE3 (0x30F1u, 0x3099u, 0x30F9u),
      HB_CODEPOINT_ENCODE3 (0x30F2u, 0x3099u, 0x30FAu),   HB_CODEPOINT_ENCODE3 (0x30FDu, 0x3099u, 0x30FEu),
      HB_CODEPOINT_ENCODE3 (0xFB49u, 0x05C1u, 0x0000u),   HB_CODEPOINT_ENCODE3 (0xFB49u, 0x05C2u, 0x0000u),
+   HB_CODEPOINT_ENCODE3 (0x105D2u, 0x0307u, 0x105C9u), HB_CODEPOINT_ENCODE3 (0x105DAu, 0x0307u, 0x105E4u),
   HB_CODEPOINT_ENCODE3 (0x11099u, 0x110BAu, 0x1109Au),HB_CODEPOINT_ENCODE3 (0x1109Bu, 0x110BAu, 0x1109Cu),
   HB_CODEPOINT_ENCODE3 (0x110A5u, 0x110BAu, 0x110ABu),HB_CODEPOINT_ENCODE3 (0x11131u, 0x11127u, 0x1112Eu),
   HB_CODEPOINT_ENCODE3 (0x11132u, 0x11127u, 0x1112Fu),HB_CODEPOINT_ENCODE3 (0x11347u, 0x1133Eu, 0x1134Bu),
-  HB_CODEPOINT_ENCODE3 (0x11347u, 0x11357u, 0x1134Cu),HB_CODEPOINT_ENCODE3 (0x114B9u, 0x114B0u, 0x114BCu),
-  HB_CODEPOINT_ENCODE3 (0x114B9u, 0x114BAu, 0x114BBu),HB_CODEPOINT_ENCODE3 (0x114B9u, 0x114BDu, 0x114BEu),
-  HB_CODEPOINT_ENCODE3 (0x115B8u, 0x115AFu, 0x115BAu),HB_CODEPOINT_ENCODE3 (0x115B9u, 0x115AFu, 0x115BBu),
-  HB_CODEPOINT_ENCODE3 (0x11935u, 0x11930u, 0x11938u), HB_CODEPOINT_ENCODE3 (0x1D157u, 0x1D165u, 0x0000u),
+  HB_CODEPOINT_ENCODE3 (0x11347u, 0x11357u, 0x1134Cu),HB_CODEPOINT_ENCODE3 (0x11382u, 0x113C9u, 0x11383u),
+  HB_CODEPOINT_ENCODE3 (0x11384u, 0x113BBu, 0x11385u),HB_CODEPOINT_ENCODE3 (0x1138Bu, 0x113C2u, 0x1138Eu),
+  HB_CODEPOINT_ENCODE3 (0x11390u, 0x113C9u, 0x11391u),HB_CODEPOINT_ENCODE3 (0x113C2u, 0x113B8u, 0x113C7u),
+  HB_CODEPOINT_ENCODE3 (0x113C2u, 0x113C2u, 0x113C5u),HB_CODEPOINT_ENCODE3 (0x113C2u, 0x113C9u, 0x113C8u),
+  HB_CODEPOINT_ENCODE3 (0x114B9u, 0x114B0u, 0x114BCu),HB_CODEPOINT_ENCODE3 (0x114B9u, 0x114BAu, 0x114BBu),
+  HB_CODEPOINT_ENCODE3 (0x114B9u, 0x114BDu, 0x114BEu),HB_CODEPOINT_ENCODE3 (0x115B8u, 0x115AFu, 0x115BAu),
+  HB_CODEPOINT_ENCODE3 (0x115B9u, 0x115AFu, 0x115BBu),HB_CODEPOINT_ENCODE3 (0x11935u, 0x11930u, 0x11938u),
+  HB_CODEPOINT_ENCODE3 (0x1611Eu, 0x1611Eu, 0x16121u),HB_CODEPOINT_ENCODE3 (0x1611Eu, 0x1611Fu, 0x16123u),
+  HB_CODEPOINT_ENCODE3 (0x1611Eu, 0x16120u, 0x16125u),HB_CODEPOINT_ENCODE3 (0x1611Eu, 0x16129u, 0x16122u),
+  HB_CODEPOINT_ENCODE3 (0x16121u, 0x1611Fu, 0x16126u),HB_CODEPOINT_ENCODE3 (0x16121u, 0x16120u, 0x16128u),
+  HB_CODEPOINT_ENCODE3 (0x16122u, 0x1611Fu, 0x16127u),HB_CODEPOINT_ENCODE3 (0x16129u, 0x1611Fu, 0x16124u),
+  HB_CODEPOINT_ENCODE3 (0x16D63u, 0x16D67u, 0x16D69u),HB_CODEPOINT_ENCODE3 (0x16D67u, 0x16D67u, 0x16D68u),
+  HB_CODEPOINT_ENCODE3 (0x16D69u, 0x16D67u, 0x16D6Au), HB_CODEPOINT_ENCODE3 (0x1D157u, 0x1D165u, 0x0000u),
    HB_CODEPOINT_ENCODE3 (0x1D158u, 0x1D165u, 0x0000u), HB_CODEPOINT_ENCODE3 (0x1D15Fu, 0x1D16Eu, 0x0000u),
    HB_CODEPOINT_ENCODE3 (0x1D15Fu, 0x1D16Fu, 0x0000u), HB_CODEPOINT_ENCODE3 (0x1D15Fu, 0x1D170u, 0x0000u),
    HB_CODEPOINT_ENCODE3 (0x1D15Fu, 0x1D171u, 0x0000u), HB_CODEPOINT_ENCODE3 (0x1D15Fu, 0x1D172u, 0x0000u),
@@ -1069,90 +1082,59 @@ _hb_ucd_dm2_u64_map[388] =
 #ifndef HB_OPTIMIZE_SIZE
 
 static const uint8_t
-_hb_ucd_u8[17884] =
+_hb_ucd_u8[17612] =
 {
-    0,  1,  2,  3,  4,  5,  6,  7,  7,  8,  7,  7,  7,  7,  7,  7,
-    7,  7,  7,  7,  9, 10,  7,  7,  7,  7, 11, 12, 13, 13, 13, 14,
-   15, 16, 17, 18, 19, 20, 21, 22, 23, 22, 22, 22, 22, 24,  7,  7,
-   25, 26, 22, 22, 22, 27, 28, 29, 22, 30, 31, 32, 33, 34, 35, 36,
-    7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,
-    7,  7,  7,  7, 37,  7, 38, 39,  7, 40,  7,  7,  7, 41, 22, 42,
-    7,  7, 43,  7, 44, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
-   22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
-   22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
-   22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
-   22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
-   22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
-   22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
-   22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
-   22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
-   22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
-   22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
-   22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
-   22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
-   22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
-   22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
-   22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
-   22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
-   22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
-   22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
-   22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
-   22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
-   22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
-   45, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
-   22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
-   13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
-   13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 46,
-   13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
-   13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 47,
+    0,  1,  2,  3,  4,  5,  5,  5,  5,  5,  6,  5,  5,  7,  8,  9,
+   10, 11, 12, 13, 14, 15, 16,  5, 17, 15, 18, 19, 20, 21, 22, 23,
+    5,  5,  5,  5,  5,  5,  5,  5,  5,  5, 24, 25, 26,  5, 27, 28,
+    5, 29, 30, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
+   15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
+   15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
+   15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
+   15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
+   15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
+   15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
+   15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
+   15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
+   15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
+   15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
+   31, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
+    8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8, 32,
+    8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8, 33,
     0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15,
-   16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
-   32, 33, 34, 34, 35, 36, 37, 38, 39, 34, 34, 34, 40, 41, 42, 43,
-   44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
-   60, 61, 62, 63, 64, 64, 65, 66, 67, 68, 69, 70, 71, 69, 72, 73,
-   69, 69, 64, 74, 64, 64, 75, 76, 77, 78, 79, 80, 81, 82, 69, 83,
-   84, 85, 86, 87, 88, 89, 69, 69, 34, 34, 34, 34, 34, 34, 34, 34,
-   34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
-   34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 90, 34, 34, 34, 34,
-   91, 34, 34, 34, 34, 34, 34, 34, 34, 92, 34, 34, 93, 94, 95, 96,
-   97, 98, 99,100,101,102,103,104, 34, 34, 34, 34, 34, 34, 34, 34,
-   34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,105,
-  106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,
-  107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,
-  107,107, 34, 34,108,109,110,111, 34, 34,112,113,114,115,116,117,
-  118,119,120,121,122,123,124,125,126,127,128,129, 34, 34,130,131,
-  132,133,134,135,136,137,138,139,140,141,142,122,143,144,145,146,
-  147,148,149,150,151,152,153,122,154,155,122,156,157,158,159,122,
-  160,161,162,163,164,165,166,122,167,168,169,170,122,171,172,173,
-   34, 34, 34, 34, 34, 34, 34,174,175, 34,176,122,122,122,122,122,
-  122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,177,
-   34, 34, 34, 34, 34, 34, 34, 34,178,122,122,122,122,122,122,122,
-  122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,
-  122,122,122,122,122,122,122,122, 34, 34, 34, 34,179,122,122,122,
-   34, 34, 34, 34,180,181,182,183,122,122,122,122,184,185,186,187,
-   34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,188,
-   34, 34, 34, 34, 34, 34, 34, 34, 34,189,190,122,122,122,122,122,
-  122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,191,
-   34, 34,192, 34, 34,193,122,122,122,122,122,122,122,122,122,122,
-  122,122,122,122,122,122,122,122,194,195,122,122,122,122,122,122,
-  122,122,122,122,122,122,122,122,122,122,122,122,122,122,196,197,
-   69,198,199,200,201,202,203,122,204,205,206,207,208,209,210,211,
-   69, 69, 69, 69,212,213,122,122,122,122,122,122,122,122,214,122,
-  215,216,217,122,122,218,122,122,122,219,122,122,122,122,122,220,
-   34,221,222,122,122,122,122,122,223,224,225,122,226,227,122,122,
-  228,229,230,231,232,122, 69,233, 69, 69, 69, 69, 69,234,235,236,
-  237,238, 69, 69,239,240, 69,241,122,122,122,122,122,122,122,122,
-   34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,242, 34, 34,
-   34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,243, 34,
-  244, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
-   34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,245, 34, 34,
-   34, 34, 34, 34, 34, 34, 34,246, 34, 34, 34, 34,247,122,122,122,
-   34, 34, 34, 34,248,122,122,122,122,122,122,122,122,122,122,122,
-   34, 34, 34, 34, 34, 34,249, 34, 34, 34, 34, 34, 34, 34, 34, 34,
-   34, 34, 34, 34, 34, 34, 34,250,122,122,122,122,122,122,122,122,
-  251,122,252,253,122,122,122,122,122,122,122,122,122,122,122,122,
-  107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,254,
-  107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,255,
+   16, 17, 18, 19, 20, 17, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
+   31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 33, 41, 42, 43, 44, 45,
+   46, 47, 48, 39, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
+   17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 49, 17, 17,
+   17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
+   50, 17, 17, 17, 51, 17, 52, 53, 54, 55, 56, 57, 17, 17, 17, 17,
+   17, 17, 17, 17, 17, 17, 17, 58, 59, 59, 59, 59, 59, 59, 59, 59,
+   60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
+   60, 60, 60, 60, 60, 60, 60, 60, 60, 17, 61, 62, 17, 63, 64, 65,
+   66, 67, 68, 69, 70, 71, 17, 72, 73, 74, 75, 76, 77, 78, 79, 80,
+   81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96,
+   17, 17, 17, 97, 98, 99,100,100,100,100,100,100,100,100,100,101,
+   17, 17, 17, 17,102, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
+   17, 17, 17,103, 17, 17,104,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,105,100,100,100,100,100,100, 17, 17,106,107,100,108,109,110,
+   17, 17, 17, 17, 17, 17, 17,111, 17, 17, 17, 17,112,113,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,114,
+   17,115,116,100,100,100,100,100,100,100,100,100,117,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,118, 39,119,120,
+  121,122,123,124,125,126,127,128, 39, 39,129,100,100,100,100,130,
+  131,132,133,100,134,135,100,136,137,138,100,100,139,140,141,100,
+  142,143,144,145, 39, 39,146,147,148, 39,149,150,100,100,100,100,
+   17, 17, 17, 17, 17, 17,151, 17, 17, 17, 17, 17, 17, 17, 17, 17,
+   17, 17, 17, 17, 17, 17, 17,152,153, 17, 17, 17, 17, 17, 17, 17,
+   17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,154, 17,
+   17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,155, 17, 17,156,100,
+  100,100,100,100,100,100,100,100, 17, 17,157,100,100,100,100,100,
+   17, 17, 17,158, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
+   17, 17, 17,159,100,100,100,100,100,100,100,100,100,100,100,100,
+  160,161,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+   60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60,162,
+   60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60,163,
     0,  0,  0,  0,  0,  0,  0,  0,  1,  2,  3,  2,  4,  5,  6,  2,
     7,  7,  7,  7,  7,  2,  8,  9, 10, 11, 11, 11, 11, 11, 11, 11,
    11, 11, 11, 11, 11, 12, 13, 14, 15, 16, 16, 16, 16, 16, 16, 16,
@@ -1189,7 +1171,7 @@ _hb_ucd_u8[17884] =
    43, 43, 40, 21,  2, 81, 57, 20, 36, 36, 36, 43, 43, 75, 43, 43,
    43, 43, 75, 43, 75, 43, 43, 44,  2,  2,  2,  2,  2,  2,  2, 64,
    36, 36, 36, 36, 70, 43, 44, 64, 36, 36, 36, 36, 36, 61, 44, 44,
-   36, 36, 36, 36, 82, 36, 36, 61, 65, 44, 44, 44, 43, 43, 43, 43,
+   36, 36, 36, 36, 82, 36, 36, 61, 65, 44, 44, 57, 43, 43, 43, 43,
    36, 36, 36, 36, 83, 43, 43, 43, 43, 84, 43, 43, 43, 43, 43, 43,
    43, 85, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 85, 71, 86,
    87, 43, 43, 43, 85, 86, 87, 86, 70, 43, 43, 43, 36, 36, 36, 36,
@@ -1262,13 +1244,13 @@ _hb_ucd_u8[17884] =
    85, 85, 87, 43, 43, 43, 85, 86, 86, 87, 43, 43, 43, 43, 80, 57,
     2,  2,  2, 88,  2,  2,  2, 44, 43, 43, 43, 43, 43, 43, 43,109,
    43, 43, 43, 43, 43, 43, 43, 80, 43, 43, 98, 36, 36, 36, 36, 36,
-   36, 36, 85, 43, 43, 85, 85, 86, 86, 85, 98, 36, 36, 36, 61, 44,
-   97, 67, 67, 67, 67, 50, 43, 43, 43, 43, 67, 67, 67, 67, 21, 64,
+   36, 36, 85, 43, 43, 85, 85, 86, 86, 85, 98, 36, 36, 36, 61,  2,
+   97, 67, 67, 67, 67, 50, 43, 43, 43, 43, 67, 67, 67, 67, 21,  2,
    43, 98, 36, 36, 36, 36, 36, 36, 94, 43, 43, 86, 43, 87, 43, 36,
    36, 36, 36, 85, 43, 86, 87, 87, 43, 86, 44, 44, 44, 44,  2,  2,
    36, 36, 86, 86, 86, 86, 43, 43, 43, 43, 86, 43, 44, 93,  2,  2,
     7,  7,  7,  7,  7, 44, 62, 36, 36, 36, 36, 36, 40, 40, 40,  2,
-   16, 16, 16, 16,110, 44, 44, 44, 11, 11, 11, 11, 11, 47, 48, 11,
+   16, 16, 16, 16, 34,110, 44, 44, 11, 11, 11, 11, 11, 47, 48, 11,
     2,  2,  2,  2, 44, 44, 44, 44, 43, 60, 43, 43, 43, 43, 43, 43,
    85, 43, 43, 43, 71, 36, 70, 36, 36, 36, 71, 94, 43, 61, 44, 44,
    16, 16, 16, 16, 16, 16, 40, 40, 40, 40, 40, 40, 40, 45, 16, 16,
@@ -1296,33 +1278,33 @@ _hb_ucd_u8[17884] =
    67, 67, 67, 67,  4,  4, 67, 67,  8, 67, 67, 67,145,146, 67, 67,
    67, 67, 67, 67, 67, 67,144, 67, 67, 67, 67, 67, 67, 26,  8,  8,
     8,  8, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67,  8,  8,
-    8, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 92, 44, 44, 44, 44,
-   67, 67, 67, 67, 67, 92, 44, 44, 27, 27, 27, 27, 27, 27, 67, 67,
-   67, 67, 67, 67, 67, 27, 27, 27, 67, 67, 67, 26, 67, 67, 67, 67,
-   26, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67,  8,  8,  8,  8,
-   67, 67, 67, 67, 67, 67, 67, 26, 67, 67, 67, 67,  4,  4,  4,  4,
-    4,  4,  4, 27, 27, 27, 27, 27, 27, 27, 67, 67, 67, 67, 67, 67,
-    8,  8,129,147,  8,  8,  8,  8,  8,  8,  8,  4,  4,  4,  4,  4,
-    8,129,148,148,148,148,148,148,148,148,148,148,147,  8,  8,  8,
-    8,  8,  8,  8,  4,  4,  8,  8,  8,  8,  8,  8,  8,  8,  4,  8,
-    8,  8,144, 26,  8,  8,144, 67, 67, 67, 44, 67, 67, 67, 67, 67,
-   67, 67, 67, 55, 67, 67, 67, 67, 32, 11, 32, 34, 34, 34, 34, 11,
-   32, 32, 34, 16, 16, 16, 40, 11, 32, 32,140, 67, 67,138, 34,149,
-   43, 32, 44, 44, 93,  2, 99,  2, 16, 16, 16,150, 44, 44,150, 44,
-   36, 36, 36, 36, 44, 44, 44, 52, 64, 44, 44, 44, 44, 44, 44, 57,
-   36, 36, 36, 61, 44, 44, 44, 44, 36, 36, 36, 61, 36, 36, 36, 61,
-    2,121,121,  2,125,126,121,  2,  2,  2,  2,  6,  2,108,121,  2,
-  121,  4,  4,  4,  4,  2,  2, 88,  2,  2,  2,  2,  2,120,  2,  2,
-  108,151,  2,  2,  2,  2,  2,  2, 67,  2,152,148,148,148,153, 44,
-   67, 67, 67, 67, 67, 55, 67, 67, 67, 67, 44, 44, 44, 44, 44, 44,
-   67, 67, 67, 44, 44, 44, 44, 44,  1,  2,154,155,  4,  4,  4,  4,
-    4, 67,  4,  4,  4,  4,156,157,158,105,105,105,105, 43, 43, 86,
-  159, 40, 40, 67,105,160, 63, 67, 36, 36, 36, 61, 57,161,162, 69,
-   36, 36, 36, 36, 36, 63, 40, 69, 44, 44, 62, 36, 36, 36, 36, 36,
-   67, 27, 27, 67, 67, 67, 67, 67, 67, 67, 44, 44, 44, 44, 44, 55,
-   67, 67, 67, 67, 67, 67, 67, 92, 27, 27, 27, 27, 27, 67, 67, 67,
-   67, 67, 67, 67, 27, 27, 27, 27,163, 27, 27, 27, 27, 27, 27, 27,
-   36, 36, 83, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,164,  2,
+    8, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 92, 44, 44,
+   27, 27, 27, 27, 27, 27, 67, 67, 67, 67, 67, 67, 67, 27, 27, 27,
+   67, 67, 67, 26, 67, 67, 67, 67, 26, 67, 67, 67, 67, 67, 67, 67,
+   67, 67, 67, 67,  8,  8,  8,  8, 67, 67, 67, 67, 67, 67, 67, 26,
+   67, 67, 67, 67,  4,  4,  4,  4,  4,  4,  4, 27, 27, 27, 27, 27,
+   27, 27, 67, 67, 67, 67, 67, 67,  8,  8,129,147,  8,  8,  8,  8,
+    8,  8,  8,  4,  4,  4,  4,  4,  8,129,148,148,148,148,148,148,
+  148,148,148,148,147,  8,  8,  8,  8,  8,  8,  8,  4,  4,  8,  8,
+    8,  8,  8,  8,  8,  8,  4,  8,  8,  8,144, 26,  8,  8,144, 67,
+   67, 67, 44, 67, 67, 67, 67, 67, 67, 67, 67, 55, 67, 67, 67, 67,
+   32, 11, 32, 34, 34, 34, 34, 11, 32, 32, 34, 16, 16, 16, 40, 11,
+   32, 32,140, 67, 67,138, 34,149, 43, 32, 44, 44, 93,  2, 99,  2,
+   16, 16, 16,150, 44, 44,150, 44, 36, 36, 36, 36, 44, 44, 44, 52,
+   64, 44, 44, 44, 44, 44, 44, 57, 36, 36, 36, 61, 44, 44, 44, 44,
+   36, 36, 36, 61, 36, 36, 36, 61,  2,121,121,  2,125,126,121,  2,
+    2,  2,  2,  6,  2,108,121,  2,121,  4,  4,  4,  4,  2,  2, 88,
+    2,  2,  2,  2,  2,120,  2,  2,108,151,  2,  2,  2,  2,  2,  2,
+   67,  2,152,148,148,148,153, 44, 67, 67, 67, 67, 67, 55, 67, 67,
+   67, 67, 44, 44, 44, 44, 44, 44, 67, 67, 67, 44, 44, 44, 44, 44,
+    1,  2,154,155,  4,  4,  4,  4,  4, 67,  4,  4,  4,  4,156,157,
+  158,105,105,105,105, 43, 43, 86,159, 40, 40, 67,105,160, 63, 67,
+   36, 36, 36, 61, 57,161,162, 69, 36, 36, 36, 36, 36, 63, 40, 69,
+   44, 44, 62, 36, 36, 36, 36, 36, 67, 27, 27, 67, 67, 67, 67, 67,
+   67, 67, 67, 44, 44, 44, 44, 55, 67, 67, 67, 67, 67, 67, 67, 92,
+   27, 27, 27, 27, 27, 67, 67, 67, 67, 67, 67, 67, 27, 27, 27, 27,
+  163, 27, 27, 27, 27, 27, 27, 27, 36, 36, 83, 36, 36, 36, 36, 36,
+   67, 67, 67, 92, 44, 44, 44, 44, 36, 36, 36, 36, 36, 36,164,  2,
     7,  7,  7,  7,  7, 36, 44, 44, 32, 32, 32, 32, 32, 32, 32, 70,
    51,165, 43, 43, 43, 43, 43, 88, 32, 32, 32, 32, 32, 32, 40, 43,
    36, 36, 36,105,105,105,105,105, 43,  2,  2,  2, 44, 44, 44, 44,
@@ -1330,7 +1312,7 @@ _hb_ucd_u8[17884] =
    16, 32, 32, 32, 32, 32, 32, 32, 45, 16, 16, 16, 34, 34, 34, 32,
    32, 32, 32, 32, 42,166, 34, 35, 32, 32, 16, 32, 32, 32, 32, 32,
    32, 32, 32, 32, 32, 11, 11, 32, 11, 11, 32, 32, 32, 32, 32, 32,
-   32, 32, 11, 11, 34,110, 44, 44, 32,150,150, 32, 32, 44, 44, 44,
+   32, 32, 11, 11, 34, 34, 32, 44, 32,150,150, 32, 32, 32, 47, 44,
    44, 40,167, 35, 40, 35, 36, 36, 36, 71, 36, 71, 36, 70, 36, 36,
    36, 94, 87, 85, 67, 67, 80, 44, 27, 27, 27, 67,168, 44, 44, 44,
    36, 36,  2,  2, 44, 44, 44, 44, 86, 36, 36, 36, 36, 36, 36, 36,
@@ -1391,8 +1373,10 @@ _hb_ucd_u8[17884] =
    36, 61, 44, 44, 27, 27, 27, 27, 36, 44, 44, 44, 93,  2, 64, 44,
    44, 44, 44, 44,179, 27, 27, 27, 11, 47, 44, 44, 44, 44, 44, 44,
    16,110, 44, 44, 44, 27, 27, 27, 36, 36, 43, 43, 44, 44, 44, 44,
-   27, 27, 27, 27, 27, 27, 27,100, 36, 36, 36, 36, 36, 57,184, 44,
-   36, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 57, 43,
+    7,  7,  7,  7,  7, 36, 36, 69, 11, 11, 11, 44, 57, 43, 43,159,
+   16, 16, 16, 44, 44, 44, 44,  8, 27, 27, 27, 27, 27, 27, 27,100,
+   36, 36, 36, 36, 36, 57,184, 44, 36, 44, 44, 44, 44, 44, 44, 44,
+   44, 36, 61, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 43, 43,
    27, 27, 27, 95, 44, 44, 44, 44,180, 27, 30,  2,  2, 44, 44, 44,
    36, 43, 43,  2,  2, 44, 44, 44, 36, 36,183, 27, 27, 27, 44, 44,
    87, 98, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 43, 43, 43, 43,
@@ -1410,14 +1394,18 @@ _hb_ucd_u8[17884] =
    86, 87, 43, 43, 43, 80, 44, 44, 43, 86, 62, 36, 36, 36, 61, 62,
    61, 36, 62, 36, 36, 57, 71, 86, 85, 86, 90, 89, 90, 89, 86, 44,
    61, 44, 44, 89, 44, 44, 62, 36, 36, 86, 44, 43, 43, 43, 80, 44,
-   43, 43, 80, 44, 44, 44, 44, 44, 36, 36, 94, 86, 43, 43, 43, 43,
-   86, 43, 85, 71, 36, 63,  2,  2,  7,  7,  7,  7,  7,  2, 93, 71,
-   86, 87, 43, 43, 85, 85, 86, 87, 85, 43, 36, 72, 44, 44, 44, 44,
-   36, 36, 36, 36, 36, 36, 36, 94, 86, 43, 43, 44, 86, 86, 43, 87,
-   60,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2, 36, 36, 43, 44,
-   86, 87, 43, 43, 43, 85, 87, 87, 60,  2, 61, 44, 44, 44, 44, 44,
-    2,  2,  2,  2,  2,  2, 64, 44, 36, 36, 36, 36, 36, 70, 87, 86,
-   43, 43, 43, 87, 63, 44, 44, 44, 86, 43, 43, 87, 43, 43, 44, 44,
+   43, 43, 80, 44, 44, 44, 44, 44, 36, 36, 36, 36, 36, 62, 44, 61,
+   36, 36, 36, 62, 86, 87, 43, 43, 80, 90, 89, 89, 86, 90, 86, 85,
+   71, 71,  2, 93, 64, 44, 44, 44, 57, 80, 44, 44, 44, 44, 44, 44,
+   36, 36, 94, 86, 43, 43, 43, 43, 86, 43, 85, 71, 36, 63,  2,  2,
+    7,  7,  7,  7,  7,  2, 93, 71, 86, 87, 43, 43, 85, 85, 86, 87,
+   85, 43, 36, 72, 44, 44, 44, 44, 36, 36, 36, 36, 36, 36, 36, 94,
+   86, 43, 43, 44, 86, 86, 43, 87, 60,  2,  2,  2,  2,  2,  2,  2,
+    2,  2,  2,  2, 36, 36, 43, 44, 86, 87, 43, 43, 43, 85, 87, 87,
+   60,  2, 61, 44, 44, 44, 44, 44,  2,  2,  2,  2,  2,  2, 64, 44,
+   36, 36, 36, 36, 36, 70, 87, 86, 43, 43, 43, 87, 63, 44, 44, 44,
+    7,  7,  7,  7,  7,  7,  7,  7,  7,  7, 44, 44, 44, 44, 44, 44,
+   36, 36, 36, 36, 36, 61, 57, 87, 86, 43, 43, 87, 43, 43, 44, 44,
     7,  7,  7,  7,  7, 27,  2, 97, 43, 43, 43, 43, 87, 60, 44, 44,
    27,100, 44, 44, 44, 44, 44, 62, 36, 36, 36, 61, 62, 44, 36, 36,
    36, 36, 62, 61, 36, 36, 36, 36, 86, 86, 86, 89, 90, 57, 85, 71,
@@ -1427,49 +1415,52 @@ _hb_ucd_u8[17884] =
     2,  2,  2, 59, 44, 44, 44, 44, 70, 43, 43, 85, 87, 43, 36, 36,
    36, 36, 36, 36, 36, 43, 43, 43, 43, 43, 43, 85, 43,  2, 72,  2,
     2, 64, 44, 44, 44, 44, 44, 44,  2,  2,  2,  2,  2, 44, 44, 44,
-   43, 43, 43, 80, 43, 43, 43, 87, 63,  2,  2, 44, 44, 44, 44, 44,
-    2, 36, 36, 36, 36, 36, 36, 36, 44, 43, 43, 43, 43, 43, 43, 43,
-   43, 43, 43, 43, 89, 43, 43, 43, 85, 43, 87, 80, 44, 44, 44, 44,
-   36, 36, 36, 61, 36, 62, 36, 36, 70, 43, 43, 80, 44, 80, 43, 57,
-   43, 43, 43, 70, 44, 44, 44, 44, 36, 36, 36, 62, 61, 36, 36, 36,
-   36, 36, 36, 36, 36, 86, 86, 90, 43, 89, 87, 87, 61, 44, 44, 44,
-   36, 70, 85,107, 64, 44, 44, 44, 43, 94, 36, 36, 36, 36, 36, 36,
-   36, 36, 86, 43, 43, 80, 44, 86, 85, 60,  2,  2,  2,  2,  2,  2,
+   63, 44, 44, 44, 44, 44, 44, 44, 43, 43, 43, 80, 43, 43, 43, 87,
+   63,  2,  2, 44, 44, 44, 44, 44,  2, 36, 36, 36, 36, 36, 36, 36,
+   44, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 89, 43, 43, 43,
+   85, 43, 87, 80, 44, 44, 44, 44, 36, 36, 36, 61, 36, 62, 36, 36,
+   70, 43, 43, 80, 44, 80, 43, 57, 43, 43, 43, 70, 44, 44, 44, 44,
+   36, 36, 36, 62, 61, 36, 36, 36, 36, 36, 36, 36, 36, 86, 86, 90,
+   43, 89, 87, 87, 61, 44, 44, 44, 36, 70, 85,107, 64, 44, 44, 44,
+   43, 94, 36, 36, 36, 36, 36, 36, 36, 36, 86, 43, 43, 80, 44, 86,
+   85, 60,  2,  2,  2,  2,  2,  2,  7,  7,  7,  7,  7, 80, 44, 44,
    27, 27, 91, 67, 67, 67, 56, 20,168, 67, 67, 67, 67, 67, 67, 67,
    67, 44, 44, 44, 44, 44, 44, 93,105,105,105,105,105,105,105,181,
     2,  2, 64, 44, 44, 44, 44, 44, 63, 64, 44, 44, 44, 44, 44, 44,
    65, 65, 65, 65, 65, 65, 65, 65, 71, 36, 36, 70, 43, 43, 43, 43,
-   43, 43, 43, 44, 44, 44, 44, 44, 43, 43, 60, 44, 44, 44, 44, 44,
+   43, 43, 43, 44, 44, 44, 44, 44, 36, 36, 36, 36, 36, 36, 36, 43,
+   43, 43, 43, 43, 43, 86, 87, 43, 43, 43, 60, 44, 44, 44, 44, 44,
    43, 43, 43, 60,  2,  2, 67, 67, 40, 40, 97, 44, 44, 44, 44, 44,
     7,  7,  7,  7,  7,179, 27, 27, 27, 62, 36, 36, 36, 36, 36, 36,
-   36, 36, 36, 36, 44, 44, 62, 36, 27, 27, 27, 30,  2, 64, 44, 44,
+   36, 36, 36, 36, 44, 44, 62, 36, 40, 69, 36, 36, 36, 36, 36, 36,
+   36, 36, 36, 36, 36, 83,164,  2, 27, 27, 27, 30,  2, 64, 44, 44,
    36, 36, 36, 36, 36, 61, 44, 57, 94, 86, 86, 86, 86, 86, 86, 86,
    86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 44, 44, 44, 57,
    43, 74, 40, 40, 40, 40, 40, 40, 40, 88, 80, 44, 44, 44, 44, 44,
-   86, 44, 44, 44, 44, 44, 44, 44, 40, 40, 52, 40, 40, 40, 52, 81,
-   36, 61, 44, 44, 44, 44, 44, 44, 44, 61, 44, 44, 44, 44, 44, 44,
-   36, 61, 62, 44, 44, 44, 44, 44, 44, 44, 36, 36, 44, 44, 44, 44,
-   36, 36, 36, 36, 36, 44, 50, 60, 65, 65, 44, 44, 44, 44, 44, 44,
-   43, 43, 43, 43, 43, 43, 43, 44, 43, 43, 43, 80, 44, 44, 44, 44,
-   67, 67, 67, 92, 55, 67, 67, 67, 67, 67,186, 87, 43, 67,186, 86,
-   86,187, 65, 65, 65, 84, 43, 43, 43, 76, 50, 43, 43, 43, 67, 67,
-   67, 67, 67, 67, 67, 43, 43, 67, 67, 43, 76, 44, 44, 44, 44, 44,
-   27, 27, 44, 44, 44, 44, 44, 44, 11, 11, 11, 11, 11, 16, 16, 16,
-   16, 16, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 16,
-   16, 16,110, 16, 16, 16, 16, 16, 11, 16, 16, 16, 16, 16, 16, 16,
-   16, 16, 16, 16, 16, 16, 47, 11, 44, 47, 48, 47, 48, 11, 47, 11,
-   11, 11, 11, 16, 16,150,150, 16, 16, 16,150, 16, 16, 16, 16, 16,
-   16, 16, 11, 48, 11, 47, 48, 11, 11, 11, 47, 11, 11, 11, 47, 16,
-   16, 16, 16, 16, 11, 48, 11, 47, 11, 11, 47, 47, 44, 11, 11, 11,
-   47, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 11, 11,
-   11, 11, 11, 16, 16, 16, 16, 16, 16, 16, 16, 44, 11, 11, 11, 11,
-   31, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 33, 16, 16,
-   16, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 31, 16, 16,
-   16, 16, 33, 16, 16, 16, 11, 11, 11, 11, 31, 16, 16, 16, 16, 16,
-   16, 16, 16, 16, 16, 16, 16, 33, 16, 16, 16, 11, 11, 11, 11, 11,
-   11, 11, 11, 11, 11, 11, 11, 31, 16, 16, 16, 16, 33, 16, 16, 16,
-   11, 11, 11, 11, 31, 16, 16, 16, 16, 33, 16, 16, 16, 32, 44,  7,
-    7,  7,  7,  7,  7,  7,  7,  7, 43, 43, 43, 76, 67, 50, 43, 43,
+   86, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 62,
+   40, 40, 52, 40, 40, 40, 52, 81, 36, 61, 44, 44, 44, 44, 44, 44,
+   44, 61, 44, 44, 44, 44, 44, 44, 36, 61, 62, 44, 44, 44, 44, 44,
+   44, 44, 36, 36, 44, 44, 44, 44, 36, 36, 36, 36, 36, 44, 50, 60,
+   65, 65, 44, 44, 44, 44, 44, 44, 43, 43, 43, 43, 43, 43, 43, 44,
+   43, 43, 43, 80, 44, 44, 44, 44, 67, 67, 67, 92, 55, 67, 67, 67,
+   67, 67,186, 87, 43, 67,186, 86, 86,187, 65, 65, 65, 84, 43, 43,
+   43, 76, 50, 43, 43, 43, 67, 67, 67, 67, 67, 67, 67, 43, 43, 67,
+   67, 43, 76, 44, 44, 44, 44, 44, 27, 27, 44, 44, 44, 44, 44, 44,
+   11, 11, 11, 11, 11, 16, 16, 16, 16, 16, 11, 11, 11, 11, 11, 11,
+   11, 11, 11, 11, 11, 11, 11, 16, 16, 16,110, 16, 16, 16, 16, 16,
+   11, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 47, 11,
+   44, 47, 48, 47, 48, 11, 47, 11, 11, 11, 11, 16, 16,150,150, 16,
+   16, 16,150, 16, 16, 16, 16, 16, 16, 16, 11, 48, 11, 47, 48, 11,
+   11, 11, 47, 11, 11, 11, 47, 16, 16, 16, 16, 16, 11, 48, 11, 47,
+   11, 11, 47, 47, 44, 11, 11, 11, 47, 16, 16, 16, 16, 16, 16, 16,
+   16, 16, 16, 16, 16, 16, 11, 11, 11, 11, 11, 16, 16, 16, 16, 16,
+   16, 16, 16, 44, 11, 11, 11, 11, 31, 16, 16, 16, 16, 16, 16, 16,
+   16, 16, 16, 16, 16, 33, 16, 16, 16, 11, 11, 11, 11, 11, 11, 11,
+   11, 11, 11, 11, 11, 31, 16, 16, 16, 16, 33, 16, 16, 16, 11, 11,
+   11, 11, 31, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 33,
+   16, 16, 16, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 31,
+   16, 16, 16, 16, 33, 16, 16, 16, 11, 11, 11, 11, 31, 16, 16, 16,
+   16, 33, 16, 16, 16, 32, 44,  7, 43, 43, 43, 76, 67, 50, 43, 43,
    43, 43, 43, 43, 43, 43, 76, 67, 67, 67, 50, 67, 67, 67, 67, 67,
    67, 67, 76, 21,  2,  2, 44, 44, 44, 44, 44, 44, 44, 57, 43, 43,
    16, 16, 16, 16, 16, 39, 16, 16, 16, 16, 16, 16, 16, 16, 16,110,
@@ -1479,22 +1470,23 @@ _hb_ucd_u8[17884] =
    43, 43, 43, 74, 40, 40, 40, 44,  7,  7,  7,  7,  7, 44, 44, 77,
    36, 36, 36, 36, 36, 36, 36, 80, 36, 36, 36, 36, 36, 36, 43, 43,
     7,  7,  7,  7,  7, 44, 44, 96, 36, 36, 36, 36, 36, 83, 43, 43,
-   36, 36, 36, 61, 36, 36, 62, 61, 36, 36, 61,179, 27, 27, 27, 27,
-   16, 16, 43, 43, 43, 74, 44, 44, 27, 27, 27, 27, 27, 27,163, 27,
-  188, 27,100, 44, 44, 44, 44, 44, 27, 27, 27, 27, 27, 27, 27,163,
-   27, 27, 27, 27, 27, 27, 27, 44, 36, 36, 62, 36, 36, 36, 36, 36,
-   62, 61, 61, 62, 62, 36, 36, 36, 36, 61, 36, 36, 62, 62, 44, 44,
-   44, 61, 44, 62, 62, 62, 62, 36, 62, 61, 61, 62, 62, 62, 62, 62,
-   62, 61, 61, 62, 36, 61, 36, 36, 36, 61, 36, 36, 62, 36, 61, 61,
-   36, 36, 36, 36, 36, 62, 36, 36, 62, 36, 62, 36, 36, 62, 36, 36,
-    8, 44, 44, 44, 44, 44, 44, 44, 67, 67, 67, 67, 67, 67, 44, 44,
-   55, 67, 67, 67, 67, 67, 67, 67, 27, 27, 27, 27, 27, 27, 91, 67,
-   67, 67, 67, 67, 67, 67, 67, 44, 44, 44, 44, 67, 67, 67, 67, 67,
-   67, 92, 44, 44, 44, 44, 44, 44, 67, 67, 67, 67, 92, 44, 44, 44,
-   67, 44, 44, 44, 44, 44, 44, 44, 67, 67, 67, 67, 67, 25, 41, 41,
-   67, 67, 67, 67, 44, 44, 67, 67, 67, 67, 67, 92, 44, 55, 67, 67,
-   67, 67, 67, 67, 44, 44, 44, 44, 67, 67, 67, 67, 67, 67, 67, 55,
-   67, 67, 67, 44, 44, 44, 44, 67, 67, 92, 67, 67, 67, 67, 67, 67,
+  188,  7,  7,  7,  7,189, 44, 93, 36, 36, 36, 61, 36, 36, 62, 61,
+   36, 36, 61,179, 27, 27, 27, 27, 16, 16, 43, 43, 43, 74, 44, 44,
+   27, 27, 27, 27, 27, 27,163, 27,190, 27,100, 44, 44, 44, 44, 44,
+   27, 27, 27, 27, 27, 27, 27,163, 27, 27, 27, 27, 27, 27, 27, 44,
+   36, 36, 62, 36, 36, 36, 36, 36, 62, 61, 61, 62, 62, 36, 36, 36,
+   36, 61, 36, 36, 62, 62, 44, 44, 44, 61, 44, 62, 62, 62, 62, 36,
+   62, 61, 61, 62, 62, 62, 62, 62, 62, 61, 61, 62, 36, 61, 36, 36,
+   36, 61, 36, 36, 62, 36, 61, 61, 36, 36, 36, 36, 36, 62, 36, 36,
+   62, 36, 62, 36, 36, 62, 36, 36,  8, 44, 44, 44, 44, 44, 44, 44,
+   67, 67, 67, 67, 67, 67, 44, 44, 55, 67, 67, 67, 67, 67, 67, 67,
+   27, 27, 27, 27, 27, 27, 91, 67, 67, 67, 67, 67, 67, 67, 67, 44,
+   44, 44, 44, 67, 67, 67, 67, 67, 67, 92, 44, 44, 44, 44, 44, 44,
+   67, 67, 67, 67, 92, 44, 44, 44, 67, 44, 44, 44, 44, 44, 44, 44,
+   67, 67, 67, 67, 67, 25, 41, 41, 67, 67, 67, 67, 44, 44, 67, 67,
+   67, 67, 67, 92, 44, 55, 67, 67, 67, 67, 67, 67, 44, 44, 44, 44,
+   67, 67, 67, 67, 67, 44, 44, 55, 67, 67, 67, 92, 44, 44, 44, 67,
+   67, 67, 67, 67, 67, 67, 92, 55, 67, 92, 67, 67, 67, 67, 67, 67,
    79, 44, 44, 44, 44, 44, 44, 44,171,171,171,171,171,171,171, 44,
   171,171,171,171,171,171,171,  0,  0,  0, 29, 21, 21, 21, 23, 21,
    22, 18, 21, 25, 21, 17, 13, 13, 25, 25, 25, 21, 21,  9,  9,  9,
@@ -1520,366 +1512,350 @@ _hb_ucd_u8[17884] =
     6, 21, 11, 21, 24,  9,  6,  9, 23, 26,  6, 10,  4,  4,  3,  3,
     7, 25, 17, 16, 16, 22, 16, 16, 25, 17, 25,  2, 25, 24,  2, 15,
    12, 15, 14,  2, 21, 14,  7, 15, 12, 17, 21,  1, 26, 10, 10,  1,
-   23, 15,  0,  1,  2,  3,  4,  5,  6,  7,  8,  9,  0, 10, 11, 12,
-   13,  0, 14,  0,  0,  0,  0,  0, 15,  0, 16,  0,  0,  0,  0,  0,
+    7, 13, 13,  2, 23, 15,  0,  1,  2,  3,  4,  5,  6,  7,  8,  9,
+    0, 10, 11, 12, 13,  0, 14,  0,  0,  0,  0,  0, 15,  0, 16,  0,
+    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+    0,  0,  0,  0,  0,  0,  0,  0,  0, 17, 18, 19,  0,  0,  0,  0,
     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-    0,  0,  0,  0,  0, 17, 18, 19,  0,  0,  0,  0,  0,  0,  0,  0,
     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 20,
-    0, 21, 22, 23,  0,  0,  0, 24, 25, 26, 27, 28, 29, 30, 31, 32,
-   33, 34,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+    0,  0,  0, 20,  0, 21, 22, 23,  0,  0,  0, 24, 25, 26, 27, 28,
+   29, 30, 31, 32, 33, 34,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-    0,  0,  0,  0,  0,  0,  0, 35,  0, 36,  0,  0,  0,  0,  0,  0,
+    0,  0,  0,  0,  0,  0, 35,  0,  0,  0,  0, 36,  0, 37,  0,  0,
     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-   37,  0,  0,  0,  0,  0,  0,  0,  0,  0, 38, 39,  0,  0,  0,  0,
-    0,  0, 40, 41, 42,  0, 43,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-    0,  0,  0,  0,  1,  2,  0,  0,  0,  0,  3,  0,  0,  0,  4,  5,
-    6,  7,  0,  8,  9, 10,  0, 11, 12, 13, 14, 15, 16, 17, 16, 18,
-   16, 19, 16, 19, 16, 19,  0, 19, 16, 20, 16, 19, 21, 19,  0, 22,
-   23, 24, 25, 26, 27, 28, 29, 30, 31,  0, 32,  0,  0,  0,  0,  0,
-    0,  0,  0,  0,  0, 33,  0,  0,  0,  0,  0,  0, 34,  0,  0, 35,
-    0,  0, 36,  0, 37,  0,  0,  0, 38, 39, 40, 41, 42, 43, 44, 45,
-   46,  0,  0, 47,  0,  0,  0, 48,  0,  0,  0, 49,  0,  0,  0,  0,
-    0,  0,  0, 50,  0, 51,  0, 52, 53,  0, 54,  0,  0,  0,  0,  0,
-    0, 55, 56, 57,  0,  0,  0,  0, 58,  0,  0, 59, 60, 61, 62, 63,
-    0,  0, 64, 65,  0,  0,  0, 66,  0,  0,  0,  0, 67,  0,  0,  0,
-   68,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 69,
-    0,  0,  0, 70,  0, 71,  0,  0, 72,  0,  0, 73,  0,  0,  0,  0,
-    0,  0,  0,  0, 74,  0,  0,  0,  0,  0, 75, 76,  0, 77, 78,  0,
-    0, 79, 80,  0, 81, 62,  0, 82, 83,  0,  0, 84, 85, 86,  0,  0,
-    0, 87,  0, 88,  0,  0, 51, 89, 51,  0, 90,  0, 91,  0,  0,  0,
-   80,  0,  0,  0, 92, 93,  0, 94, 95, 96, 97,  0,  0,  0,  0,  0,
-   51,  0,  0,  0,  0, 98, 99,  0,  0,  0,  0,  0,  0,100,  0,  0,
-    0,  0,  0,101,102,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,103,
-    0,  0,104,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,105,106,  0,
-    0,107,  0,  0,  0,  0,  0,  0,108,  0,109,  0,102,  0,  0,  0,
-    0,  0,110,111,  0,  0,  0,  0,  0,  0,  0,112,  0,  0,  0,  0,
-    0,  0,  0,113,  0,114,  0,  0,  0,  0,  0,  0,  1,  2,  3,  4,
-    5,  6,  7,  0,  8,  0,  0,  0,  0,  9, 10, 11, 12,  0,  0,  0,
-    0, 13,  0,  0, 14, 15,  0, 16,  0, 17, 18,  0,  0, 19,  0, 20,
-   21,  0,  0,  0,  0,  0, 22, 23,  0, 24, 25,  0,  0, 26,  0,  0,
-    0, 27,  0,  0, 28, 29, 30, 31,  0,  0,  0, 32, 33, 34,  0,  0,
-   33,  0,  0, 35, 33,  0,  0,  0, 33, 36,  0,  0,  0,  0,  0, 37,
-   38,  0,  0,  0,  0,  0,  0, 39, 40,  0,  0,  0,  0,  0,  0, 41,
-   42,  0,  0,  0,  0, 43,  0, 44,  0,  0,  0, 45, 46,  0,  0,  0,
-   47,  0,  0,  0,  0,  0,  0, 48, 49,  0,  0,  0,  0, 50,  0,  0,
-    0, 51,  0, 52,  0, 53,  0,  0,  0,  0, 54,  0,  0,  0,  0, 55,
-    0, 56,  0,  0,  0,  0, 57, 58,  0,  0,  0, 59, 60,  0,  0,  0,
-    0,  0,  0, 61, 52,  0, 62, 63,  0,  0, 64,  0,  0,  0, 65, 66,
-    0,  0,  0, 67,  0, 68, 69, 70, 71, 72,  1, 73,  0, 74, 75, 76,
-    0,  0, 77, 78,  0,  0,  0, 79,  0,  0,  1,  1,  0,  0, 80,  0,
-    0, 81,  0,  0,  0,  0, 77, 82,  0, 83,  0,  0,  0,  0,  0, 78,
-   84,  0, 85,  0, 52,  0,  1, 78,  0,  0, 86,  0,  0, 87,  0,  0,
-    0,  0,  0, 88, 57,  0,  0,  0,  0,  0,  0, 89, 90,  0,  0, 84,
-    0,  0, 33,  0,  0, 91,  0,  0,  0,  0, 92,  0,  0,  0,  0, 49,
-    0,  0, 93,  0,  0,  0,  0, 94, 95,  0,  0, 96,  0,  0, 97,  0,
-    0,  0, 98,  0,  0,  0, 99,  0,  0,  0,  0,100,101, 93,  0,  0,
-  102,  0,  0,  0, 84,  0,  0,103,  0,  0,  0,104,105,  0,  0,106,
-  107,  0,  0,  0,  0,  0,  0,108,  0,  0,109,  0,  0,  0,  0,110,
-   33,  0,111,112,113, 35,  0,  0,114,  0,  0,  0,115,  0,  0,  0,
-    0,  0,  0,116,  0,  0,117,  0,  0,  0,  0,118, 88,  0,  0,  0,
-    0,  0, 57,  0,  0,  0,  0, 52,119,  0,  0,  0,  0,120,  0,  0,
-  121,  0,  0,  0,  0,119,  0,  0,122,  0,  0,  0,  0,  0,  0,123,
-    0,  0,  0,124,  0,  0,  0,125,  0,126,  0,  0,  0,  0,127,128,
-  129,  0,130,  0,131,  0,  0,  0,132,133,134,  0, 77,  0,  0,  0,
-    0,  0, 35,  0,  0,  0,135,  0,  0,  0,136,  0,  0,137,  0,  0,
-  138,  0,  0,  0,  0,  0,  0,  0,  1,  1,  1,  1,  1,  2,  3,  4,
-    5,  6,  7,  4,  4,  8,  9, 10,  1, 11, 12, 13, 14, 15, 16, 17,
-   18,  1,  1,  1, 19,  1,  0,  0, 20, 21, 22,  1, 23,  4, 21, 24,
-   25, 26, 27, 28, 29, 30,  0,  0,  1,  1, 31,  0,  0,  0, 32, 33,
-   34, 35,  1, 36, 37,  0,  0,  0,  0, 38,  1, 39, 14, 39, 40, 41,
-   42,  0,  0,  0, 43, 36, 44, 45, 21, 45, 46,  0,  0,  0, 19,  1,
-   21,  0,  0, 47,  0, 38, 48,  1,  1, 49, 49, 50,  0,  0, 51,  0,
-    0,  0, 52,  1,  0,  0, 38, 14,  4,  1,  1,  1, 53, 21, 43, 52,
-   54, 21, 35,  1,  0,  0,  0, 55,  0,  0,  0, 56, 57, 58,  0,  0,
-    0,  0,  0, 59,  0, 60,  0,  0,  0,  0, 61, 62,  0,  0, 63,  0,
-    0,  0, 64,  0,  0,  0, 65,  0,  0,  0, 66,  0,  0,  0, 67,  0,
-    0,  0, 68,  0,  0, 69, 70,  0, 71, 72, 73, 74, 75, 76,  0,  0,
-    0, 77,  0,  0,  0, 78, 79,  0,  0,  0,  0, 47,  0,  0,  0, 49,
-    0, 80,  0,  0,  0, 62,  0,  0, 63,  0,  0, 81,  0,  0, 82,  0,
-    0,  0, 83,  0,  0, 19, 84,  0, 62,  0,  0,  0,  0, 49,  1, 85,
-    1, 52, 15, 86, 36, 10, 21, 87,  0, 55,  0,  0,  0,  0, 19, 10,
-    1,  0,  0,  0,  0,  0, 88,  0,  0, 89,  0,  0, 88,  0,  0,  0,
-    0, 78,  0,  0, 87,  9, 12,  4, 90,  8, 91, 47,  0, 58, 50,  0,
-   21,  1, 21, 92, 93,  1,  1,  1,  1, 94, 95, 96, 97,  1, 98, 58,
-   81, 99,100,  4, 58,  0,  0,  0,  0,  0,  0, 19, 50,  0,  0,  0,
-    0,  0,  0, 61,  0,  0,101,102,  0,  0,103,  0,  0,  1,  1, 50,
-    0,  0,  0, 38,  0, 63,  0,  0,  0,  0,  0, 62,  0,  0,104, 68,
-   61,  0,  0,  0, 78,  0,  0,  0,105,106, 58, 38, 81,  0,  0,  0,
-    0,  0,  0,107,  1, 14,  4, 12, 84,  0,  0,  0,  0, 38, 87,  0,
-    0,  0,  0,108,  0,  0,109, 61,  0,110,  0,  0,  0,  1,  0,  0,
+    0,  0,  0,  0, 38,  0,  0,  0,  0,  0,  0,  0,  0,  0, 39, 40,
+    0,  0,  0,  0,  0,  0, 41, 42, 43,  0, 44,  0,  0,  0,  0,  0,
+    0,  0,  0,  0,  0,  0,  0,  0,  1,  2,  0,  0,  0,  0,  3,  0,
+    0,  0,  4,  5,  6,  7,  0,  8,  9, 10,  0, 11, 12, 13, 14, 15,
+   16, 17, 16, 18, 16, 19, 16, 19, 16, 19,  0, 19, 16, 20, 16, 19,
+   21, 19,  0, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,  0, 32,  0,
+    0,  0,  0,  0,  0,  0,  0,  0,  0, 33,  0,  0,  0,  0,  0,  0,
+   34,  0,  0, 35,  0,  0, 36,  0, 37,  0,  0,  0, 38, 39, 40, 41,
+   42, 43, 44, 45, 46,  0,  0, 47,  0,  0,  0, 48,  0,  0,  0, 49,
+    0,  0,  0,  0,  0,  0,  0, 50,  0, 51,  0, 52, 53,  0, 54,  0,
+    0,  0,  0,  0,  0, 55, 56, 57,  0,  0,  0,  0, 58,  0,  0, 59,
+   60, 61, 62, 63,  0,  0, 64, 65,  0,  0,  0, 66,  0,  0,  0,  0,
+   67,  0,  0,  0, 68,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+    0,  0,  0, 69,  0,  0,  0, 70,  0, 71,  0,  0, 72,  0,  0, 73,
+    0,  0,  0,  0,  0,  0,  0,  0, 74, 75,  0,  0,  0,  0, 76, 77,
+    0, 78, 79,  0,  0, 80, 81,  0, 82, 62,  0, 83, 84,  0,  0, 85,
+   86, 87,  0, 88,  0, 89,  0, 90,  0,  0, 51, 91, 51,  0, 92,  0,
+   93,  0,  0,  0, 81,  0,  0,  0, 94, 95,  0, 96, 97, 98, 99,  0,
+    0,  0,  0,  0, 51,  0,  0,  0,  0,100,101,  0,  0,  0,  0,  0,
+    0,102,  0,  0,  0,  0,  0,  0,103,  0,  0,  0,  0,  0,  0,104,
+  105,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,106,  0,  0,107,  0,
+    0,  0,  0,  0,  0,  0,  0,  0,  0,108,109,  0,  0,110,  0,  0,
+    0,  0,  0,  0,111,  0,112,  0,105,  0,  0,  0,  0,  0,113,114,
+    0,  0,  0,  0,  0,  0,  0,115,  0,  0,  0,116,  0,  0,  0,117,
+    0,118,  0,  0,  0,  0,  0,  0,  1,  2,  3,  4,  5,  6,  7,  0,
+    8,  0,  0,  0,  0,  9, 10, 11, 12,  0,  0,  0,  0, 13,  0,  0,
+   14, 15,  0, 16,  0, 17, 18,  0,  0, 19,  0, 20, 21,  0,  0,  0,
+    0,  0, 22, 23,  0, 24, 25,  0,  0, 26,  0,  0,  0, 27,  0,  0,
+   28, 29, 30, 31,  0,  0,  0, 32, 33, 34,  0,  0, 33,  0,  0, 35,
+   33,  0,  0,  0, 33, 36,  0,  0,  0,  0,  0, 37, 38,  0,  0,  0,
+    0,  0,  0, 39, 40,  0,  0,  0,  0,  0,  0, 41, 42,  0,  0,  0,
+    0, 43,  0, 44,  0,  0,  0, 45, 46,  0,  0,  0, 47,  0,  0,  0,
+    0,  0,  0, 48, 49,  0,  0,  0,  0, 50,  0,  0,  0, 51,  0, 52,
+    0, 53,  0,  0,  0,  0, 54,  0,  0,  0,  0, 55,  0, 56,  0,  0,
+    0,  0, 57, 58,  0,  0,  0, 59, 60,  0,  0,  0,  0,  0,  0, 61,
+   52,  0, 62, 63,  0,  0, 64,  0,  0,  0, 65, 66,  0,  0,  0, 67,
+    0, 68, 69, 70, 71, 72,  1, 73,  0, 74, 75, 76,  0,  0, 77, 78,
+    0,  0,  0, 79,  0,  0,  1,  1,  0,  0, 80,  0,  0, 81,  0,  0,
+    0,  0, 77, 82,  0, 83,  0,  0,  0,  0,  0, 78, 84,  0, 85,  0,
+   52,  0,  1, 78,  0,  0, 86,  0,  0, 87,  0,  0,  0,  0,  0, 88,
+   57,  0,  0,  0,  0,  0,  0, 89, 90,  0,  0, 84,  0,  0, 33,  0,
+    0, 91,  0,  0,  0,  0, 92,  0,  0,  0,  0, 49,  0,  0, 93,  0,
+    0,  0,  0, 94, 95,  0,  0, 96,  0,  0, 97,  0,  0,  0, 98,  0,
+    0,  0, 99,  0,  0,  0,100,  0,  0,  0,  0,101,102, 93,  0,  0,
+  103,  0,  0,  0, 84,  0,  0,104,  0,  0,  0,105,106,  0,  0,107,
+  108,  0,  0,  0,  0,  0,  0,109,  0,  0,110,  0,  0,  0,  0,111,
+   33,  0,112,113,114, 57,  0,  0,115, 35,  0,  0,116,  0,  0,  0,
+  117,  0,  0,  0,  0,  0,  0,118,  0,  0,119,  0,  0,  0,  0,120,
+   88,  0,  0,  0,  0,  0, 57,  0,  0,  0,  0, 52,121,  0,  0,  0,
+    0,122,  0,  0,123,  0,  0,  0,  0,121,  0,  0,124,  0,  0,  0,
+    0,  0, 79,  0,  0,  0,  0,125,  0,  0,  0,126,  0,  0,  0,127,
+    0,128,  0,  0,  0,  0,129,130,131,  0,132,  0,133,  0,  0,  0,
+  134,135,136,  0, 77,  0,  0,  0,  0,  0, 35,  0,  0,  0,137,  0,
+    0,  0,138,  0,  0,  0,139,  0,  0,140,  0,  0,141,  0,  0,  0,
+    0,  0,  0,  0,  1,  1,  1,  1,  1,  2,  3,  4,  5,  6,  7,  4,
+    4,  8,  9, 10,  1, 11, 12, 13, 14, 15, 16, 17, 18,  1,  1,  1,
+   19,  1,  0,  0, 20, 21, 22,  1, 23,  4, 21, 24, 25, 26, 27, 28,
+   29, 30,  0,  0,  1,  1, 31,  0,  0,  0, 32, 33, 34, 35,  1, 36,
+   37,  0,  0,  0,  0, 38,  1, 39, 14, 39, 40, 41, 42,  0,  0,  0,
+   43, 36, 44, 45, 21, 45, 46,  0,  0,  0, 19,  1, 21,  0,  0, 47,
+    0, 38, 48,  1,  1, 49, 49, 50,  0,  0, 51,  0,  0, 19, 52,  1,
+    0,  0, 38, 14,  4,  1,  1,  1, 53, 21, 43, 52, 54, 21, 35,  1,
+    0,  0,  0, 55,  0,  0,  0, 56, 57, 58,  0,  0,  0,  0,  0, 59,
+    0, 60,  0,  0,  0,  0, 61, 62,  0,  0, 63,  0,  0,  0, 64,  0,
+    0,  0, 65,  0,  0,  0, 66,  0,  0,  0, 67,  0,  0,  0, 68,  0,
+    0, 69, 70,  0, 71, 72, 73, 74, 75, 76,  0,  0,  0, 77,  0,  0,
+    0, 78, 79,  0,  0,  0,  0, 47,  0,  0,  0, 49,  0, 80,  0,  0,
+    0, 62,  0,  0, 63,  0,  0, 81,  0,  0, 82,  0,  0,  0, 83,  0,
+    0, 19, 84,  0, 62,  0,  0,  0,  0, 49,  1, 85,  1, 52, 15, 86,
+   36, 10, 21, 87,  0, 55,  0,  0,  0,  0, 19, 10,  1,  0,  0,  0,
+    0,  0, 88,  0,  0, 89,  0,  0, 88,  0,  0,  0,  0, 78,  0,  0,
+   87,  9, 12,  4, 90,  8, 91, 47,  0, 58, 50,  0, 21,  1, 21, 92,
+   93,  1,  1,  1,  1, 94, 95, 96, 97,  1, 98, 58, 81, 99,100,  4,
+   58,  0,  0,  0,  0,  0,  0, 19, 50,  0,  0,  0,  0,  0,  0, 61,
+    0,  0,101,102,  0,  0,103,  0,  0,  1,  1, 50,  0,  0,  0, 38,
+    0, 63,  0,  0,  0,  0,  0, 62,  0,  0,104, 68, 61,  0,  0,  0,
+   78,  0,  0,  0,105,106, 58, 38, 81,  0,  0,  0,  0,  0,  0,107,
+    1, 14,  4, 12, 84,  0,  0,  0,  0, 38, 87,  0,  0,  0,  0,108,
+    0,  0,109, 61,  0,110,  0,  0,  0,  1,  0,  0,  0,  0, 49, 50,
     0,  0, 19, 58,  0,  0,  0, 51,  0,111, 14, 52,112, 41,  0,  0,
    62,  0,  0, 61,  0,  0,113,  0, 87,  0,  0,  0, 61, 62,  0,  0,
    62,  0, 89,  0,  0,113,  0,  0,  0,  0,114,  0,  0,  0, 78, 55,
-    0, 38,  1, 58,  1, 58,  0,  0, 63, 89,  0,  0,115,  0,  0,  0,
-   55,  0,  0,  0,  0,115,  0,  0,  0,  0, 61,  0,  0,  0,  0, 79,
-    0, 61,  0,  0,  0,  0, 56,  0, 89, 80,  0,  0, 79,  0,  0,  0,
-    8, 91,  0,  0,  1, 87,  0,  0,116,  0,  0,  0,  0,  0,  0,117,
-    0,118,119,120,121,  0,104,  4,122, 49, 23,  0,  0,  0, 38, 50,
-   38, 58,  0,  0,  1, 87,  1,  1,  1,  1, 39,  1, 48,105, 87,  0,
-    0,  0,  0,  1,  0,  0,  0,123,  4,122,  0,  0,  0,  1,124,  0,
-    0,  0,  0,  0,230,230,230,230,230,232,220,220,220,220,232,216,
-  220,220,220,220,220,202,202,220,220,220,220,202,202,220,220,220,
-    1,  1,  1,  1,  1,220,220,220,220,230,230,230,230,240,230,220,
-  220,220,230,230,230,220,220,  0,230,230,230,220,220,220,220,230,
-  232,220,220,230,233,234,234,233,234,234,233,230,  0,  0,  0,230,
-    0,220,230,230,230,230,220,230,230,230,222,220,230,230,220,220,
-  230,222,228,230, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 19, 20,
-   21, 22,  0, 23,  0, 24, 25,  0,230,220,  0, 18, 30, 31, 32,  0,
-    0,  0,  0, 27, 28, 29, 30, 31, 32, 33, 34,230,230,220,220,230,
-  220,230,230,220, 35,  0,  0,  0,  0,  0,230,230,230,  0,  0,230,
-  230,  0,220,230,230,220,  0,  0,  0, 36,  0,  0,230,220,230,230,
-  220,220,230,220,220,230,220,230,220,230,230,  0,  0,220,  0,  0,
-  230,230,  0,230,  0,230,230,230,230,230,  0,  0,  0,220,220,220,
-  230,220,220,220,230,230,  0,220, 27, 28, 29,230,  7,  0,  0,  0,
-    0,  9,  0,  0,  0,230,220,230,230,  0,  0,  0,  0,  0,230,  0,
-    0, 84, 91,  0,  0,  0,  0,  9,  9,  0,  0,  0,  0,  0,  9,  0,
-  103,103,  9,  0,107,107,107,107,118,118,  9,  0,122,122,122,122,
-  220,220,  0,  0,  0,220,  0,220,  0,216,  0,  0,  0,129,130,  0,
-  132,  0,  0,  0,  0,  0,130,130,130,130,  0,  0,130,  0,230,230,
-    9,  0,230,230,  0,  0,220,  0,  0,  0,  0,  7,  0,  9,  9,  0,
-    9,  9,  0,  0,  0,230,  0,  0,  0,228,  0,  0,  0,222,230,220,
-  220,  0,  0,  0,230,  0,  0,220,230,220,  0,220,230,230,230,  0,
-    0,  0,  9,  9,  0,  0,  7,  0,230,  0,  1,  1,  1,  0,  0,  0,
-  230,234,214,220,202,230,230,230,230,230,232,228,228,220,218,230,
-  233,220,230,220,230,230,  1,  1,  1,  1,  1,230,  0,  1,  1,230,
-  220,230,  1,  1,  0,  0,218,228,232,222,224,224,  0,  8,  8,  0,
-    0,  0,  0,220,230,  0,230,230,220,  0,  0,230,  0,  0, 26,  0,
-    0,220,  0,230,230,  1,220,  0,  0,230,220,  0,  0,  0,220,220,
-    0,  0,230,220,  0,  9,  7,  0,  0,  7,  9,  0,  0,  0,  9,  7,
-    6,  6,  0,  0,  0,  0,  1,  0,  0,216,216,  1,  1,  1,  0,  0,
-    0,226,216,216,216,216,216,  0,220,220,220,  0,232,232,220,230,
-  230,230,  7,  0, 16, 17, 17, 17, 17, 17, 17, 33, 17, 17, 17, 19,
-   17, 17, 17, 17, 20,101, 17,113,129,169, 17, 27, 28, 17, 17, 17,
+    0, 38,  1, 58,  1, 58,  0,  0,  0,  0,  0, 88, 63, 89,  0,  0,
+  115,  0,  0,  0, 55,  0,  0,  0,  0,115,  0,  0,  0,  0, 61,  0,
+    0,  0,  0, 79,  0, 61,  0,  0,  0,  0, 56,  0, 89, 80,  0,  0,
+   79,  0,  0,  0,  8, 91,  0,  0,  1, 87,  0,  0,116,  0,  0,  0,
+    0,  0,  0,117,  0,118,119,120,121,  0,104,  4,122, 49, 23,  0,
+    0,  0, 38, 50, 38, 58,  0,  0,  1, 87,  1,  1,  1,  1, 39,  1,
+   48,105, 87,  0,  0,  0,  0,  1,  0,  0,  0,123,  0,  0,  0,112,
+    4,122,  0,  0,  0,  1,124,  0,  0,  0,  0,  0,230,230,230,230,
+  230,232,220,220,220,220,232,216,220,220,220,220,220,202,202,220,
+  220,220,220,202,202,220,220,220,  1,  1,  1,  1,  1,220,220,220,
+  220,230,230,230,230,240,230,220,220,220,230,230,230,220,220,  0,
+  230,230,230,220,220,220,220,230,232,220,220,230,233,234,234,233,
+  234,234,233,230,  0,  0,  0,230,  0,220,230,230,230,230,220,230,
+  230,230,222,220,230,230,220,220,230,222,228,230, 10, 11, 12, 13,
+   14, 15, 16, 17, 18, 19, 19, 20, 21, 22,  0, 23,  0, 24, 25,  0,
+  230,220,  0, 18, 30, 31, 32,  0,  0,  0,  0, 27, 28, 29, 30, 31,
+   32, 33, 34,230,230,220,220,230,220,230,230,220, 35,  0,  0,  0,
+    0,  0,230,230,230,  0,  0,230,230,  0,220,230,230,220,  0,  0,
+    0, 36,  0,  0,230,220,230,230,220,220,230,220,220,230,220,230,
+  220,230,230,  0,  0,220,  0,  0,230,230,  0,230,  0,230,230,230,
+  230,230,  0,  0,  0,220,220,220,230,220,220,220,230,230,  0,220,
+   27, 28, 29,230,  7,  0,  0,  0,  0,  9,  0,  0,  0,230,220,230,
+  230,  0,  0,  0,  0,  0,230,  0,  0, 84, 91,  0,  0,  0,  0,  9,
+    9,  0,  0,  0,  0,  0,  9,  0,103,103,  9,  0,107,107,107,107,
+  118,118,  9,  0,122,122,122,122,220,220,  0,  0,  0,220,  0,220,
+    0,216,  0,  0,  0,129,130,  0,132,  0,  0,  0,  0,  0,130,130,
+  130,130,  0,  0,130,  0,230,230,  9,  0,230,230,  0,  0,220,  0,
+    0,  0,  0,  7,  0,  9,  9,  0,  9,  9,  0,  0,  0,230,  0,  0,
+    0,228,  0,  0,  0,222,230,220,220,  0,  0,  0,230,  0,  0,220,
+  230,220,  0,220,230,230,230,  0,  0,  0,  9,  9,  0,  0,  7,  0,
+  230,  0,  1,  1,  1,  0,  0,  0,230,234,214,220,202,230,230,230,
+  230,230,232,228,228,220,218,230,233,220,230,220,230,230,  1,  1,
+    1,  1,  1,230,  0,  1,  1,230,220,230,  1,  1,  0,  0,218,228,
+  232,222,224,224,  0,  8,  8,  0,  0,  0,  0,220,230,  0,230,230,
+  220,  0,  0,230,  0,  0, 26,  0,  0,220,  0,230,230,  1,220,  0,
+    0,230,220,  0,  0,  0,220,220,  0,  0,230,220,  0,  9,  7,  0,
+    0,  7,  9,  0,  0,  0,  9,  7,  6,  6,  0,  0,  0,  0,  1,  0,
+    0,216,216,  1,  1,  1,  0,  0,  0,226,216,216,216,216,216,  0,
+  220,220,220,  0,232,232,220,230,230,230,  7,  0, 16, 17, 17, 17,
+   17, 17, 17, 33, 17, 17, 17, 19, 17, 17, 17, 17, 20,101, 17,113,
+  129,169, 17, 27, 28, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
    17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
    17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
    17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
    17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
    17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
-   17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
-   17, 17, 17,237,  0,  1,  2,  2,  0,  3,  0,  0,  0,  0,  0,  0,
-    0,  0,  0,  0,  0,  4,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-    5,  0,  0,  0,  0,  6,  7,  8,  9,  0,  0,  0, 10, 11, 12, 13,
-   14, 15, 16, 17, 18, 19,  0,  0,  0,  0,  0,  0,  0,  0,  0, 20,
-    0,  0, 21, 22,  0,  0,  0,  0, 23, 24, 25, 26,  0, 27,  0, 28,
-   29, 30, 31, 32,  0,  0,  0,  0,  0,  0,  0, 33, 34, 35, 36,  0,
-    0,  0,  0,  0, 37,  0,  0,  0,  0,  0,  0,  0,  0,  0, 38, 39,
-    0,  0,  0,  0,  1,  2, 40, 41,  0,  1,  2,  2,  0,  0,  0,  0,
-    0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  2,  0,  0,  0,  0,
-    0,  0,  3,  4,  0,  0,  5,  0,  0,  0,  6,  0,  0,  0,  0,  0,
-    0,  0,  7,  1,  0,  0,  0,  0,  0,  0,  8,  9,  0,  0,  0,  0,
-    0,  0, 10,  0,  0, 10,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-    0,  0,  0, 10,  0,  0,  0, 10,  0,  0,  0,  0,  0,  0, 11, 12,
-    0, 13,  0, 14, 15, 16,  0,  0,  0,  0,  0,  1, 17, 18,  0, 19,
-    7,  1,  0,  0,  0, 20, 20,  7, 20, 20, 20, 20, 20, 20, 20,  8,
-   21,  0, 22,  0,  7, 23, 24,  0, 20, 20, 25,  0,  0,  0, 26, 27,
-    1,  7, 20, 20, 20, 20, 20,  1, 28, 29, 30, 31,  0,  0, 20,  0,
-    0,  0,  0,  0,  0,  0, 10,  0,  0,  0,  0,  0,  0,  0, 20, 20,
-   20,  1,  0,  0,  8, 21, 32,  4,  0, 10,  0, 33,  7, 20, 20, 20,
-    0,  0,  0,  0,  8, 34, 34, 35, 36, 34, 37,  0, 38,  1, 20, 20,
-    0,  0, 39,  0,  1,  1,  0,  8, 21,  1, 20,  0,  0,  0,  1,  0,
-    0, 40,  1,  1,  0,  0,  8, 21,  0,  1,  0,  1,  0,  1,  0,  0,
-    0,  0, 26, 34, 34, 34, 34, 34, 34, 34, 34, 34, 21,  7, 20, 41,
-   34, 34, 34, 34, 34, 34, 34, 34, 34, 21,  0, 42, 43, 44,  0, 45,
-    0,  8, 21,  0,  0,  0,  0,  0,  0,  0,  0, 46,  7,  1, 10,  1,
-    0,  0,  0,  1, 20, 20,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-    0, 26, 34,  9,  0,  0, 20, 20,  1, 20, 20,  0,  0,  0,  0,  0,
-    0,  0, 26, 21,  0,  1,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-    0,  0,  3, 47, 48,  0,  0,  0,  0,  0,  0,  0,  0,  1,  2,  3,
-    4,  5,  6,  7,  7,  8,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,
-    9, 10, 11, 11, 11, 11, 12, 13, 13, 13, 13, 14, 15, 16, 17, 18,
-   19, 20, 21, 13, 22, 13, 13, 13, 13, 23, 24, 24, 25, 26, 13, 13,
-   13, 27, 28, 29, 13, 30, 31, 32, 33, 34, 35, 36,  7,  7,  7,  7,
-    7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,
-   37,  7, 38, 39,  7, 40,  7,  7,  7, 41, 13, 42,  7,  7, 43,  7,
-   44, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
-   13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
-   13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
-   13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
-   13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
-   13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
-   13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
-   13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
-   13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
-   13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+   17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,237,  0,  1,  2,  2,
+    0,  3,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  4,  0,  0,
+    0,  0,  0,  0,  0,  0,  0,  0,  5,  0,  0,  0,  0,  6,  7,  8,
+    9,  0,  0,  0, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,  0,  0,
+    0,  0,  0,  0,  0,  0,  0, 20,  0,  0, 21, 22,  0,  0,  0,  0,
+   23, 24, 25, 26,  0, 27,  0, 28, 29, 30, 31, 32,  0,  0,  0,  0,
+    0,  0,  0, 33, 34, 35, 36,  0,  0,  0,  0,  0, 37,  0,  0,  0,
+    0,  0,  0,  0,  0,  0, 38, 39,  0,  0,  0,  0,  1,  2, 40, 41,
+    0,  1,  2,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  0,
+    0,  0,  0,  2,  0,  0,  0,  0,  0,  0,  3,  4,  0,  0,  5,  0,
+    0,  0,  6,  0,  0,  0,  0,  0,  0,  0,  7,  1,  0,  0,  0,  0,
+    0,  0,  8,  9,  0,  0,  0,  0,  0,  0, 10,  0,  0, 10,  0,  0,
+    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 10,  0,  0,  0, 10,
+    0,  0,  0,  0,  0,  0, 11, 12,  0, 13,  0, 14, 15, 16,  0,  0,
+    0,  0,  0,  1, 17, 18,  0, 19,  7,  1,  0,  0,  0, 20, 20,  7,
+   20, 20, 20, 20, 20, 20, 20,  8, 21,  0, 22,  0,  7, 23, 24,  0,
+   20, 20, 25,  0,  0,  0, 26, 27,  1,  7, 20, 20, 20, 20, 20,  1,
+   28, 29, 30, 31,  0,  0, 20,  0,  0,  0,  0,  0,  0,  0, 10,  0,
+    0,  0,  0,  0,  0,  0, 20, 20, 20,  1,  0,  0,  8, 21, 32,  4,
+    0, 10,  0, 33,  7, 20, 20, 20,  0,  0,  0,  0,  8, 34, 34, 35,
+   36, 34, 37,  0, 38,  1, 20, 20,  0,  0, 39,  0,  1,  1,  0,  8,
+   21,  1, 20,  0,  0,  0,  1,  0,  0, 40,  1,  1,  0,  0,  8, 21,
+    0,  1,  0,  1,  0,  1,  0,  0,  0,  0, 26, 34, 34, 34, 34, 34,
+   34, 34, 34, 34, 21,  7, 20, 41, 34, 34, 34, 34, 34, 34, 34, 34,
+   34, 21,  0, 42, 43, 44,  0, 45,  0,  8, 21,  0,  0,  0,  0,  0,
+    0,  0,  0, 46,  7,  1, 10,  1,  0,  0,  0,  1, 20, 20,  1,  0,
+    0,  0,  0,  0,  0,  0,  0,  0,  0, 26, 34,  9,  0,  0, 20, 20,
+    1, 20, 20,  0,  0,  0,  0,  0,  0,  0, 26, 21,  0,  1,  0,  0,
+    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  3, 47, 48,  0,  0,  0,
+    0,  0,  0,  0,  0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11,
+   12, 13, 13, 13, 13, 13, 13, 14, 13, 13, 13, 13, 13, 13, 13, 13,
+   13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 15, 16, 17, 18,
+   18, 18, 18, 18, 18, 18, 18, 18, 18, 19, 20, 20, 20, 20, 20, 20,
+   20, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 20, 33,
+   34, 35, 34, 34, 36, 37, 20, 20, 20, 20, 20, 20, 38, 20, 39, 40,
+   41, 41, 41, 41, 41, 42, 43, 44, 20, 20, 20, 20, 20, 20, 20, 45,
+   46, 20, 20, 47, 20, 20, 20, 48, 49, 50, 51, 52, 53, 54, 55, 56,
+   57, 58, 59, 20, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
    13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
-   13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
-   13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
-   13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
-   13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
-   13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
-   13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
-   13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
-   13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
-   13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
-   13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
-   13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 45,  0,  0,  1,
-    2,  2,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15,
-   16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
-   32, 32, 33, 34, 35, 36, 37, 37, 37, 37, 37, 38, 39, 40, 41, 42,
-   43, 44, 45, 46, 47, 48, 49, 50, 51, 52,  2,  2, 53, 54, 55, 56,
-   57, 58, 59, 59, 59, 59, 60, 59, 59, 59, 59, 59, 59, 59, 61, 61,
-   59, 59, 59, 59, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73,
-   74, 75, 76, 77, 78, 59, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70,
-   70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70,
-   70, 70, 70, 70, 70, 70, 70, 70, 70, 79, 70, 70, 70, 70, 80, 80,
-   80, 80, 80, 80, 80, 80, 80, 81, 82, 82, 83, 84, 85, 86, 87, 88,
-   89, 90, 91, 92, 93, 94, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
-   32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
-   32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 95, 96, 96,
-   96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
-   70, 70, 97, 98, 99,100,101,101,102,103,104,105,106,107,108,109,
-  110,111, 96,112,113,114,115,116,117,118,119,119,120,121,122,123,
-  124,125,126,127,128,129,130,131,132, 96,133,134,135,136,137,138,
-  139,140,141,142,143, 96,144,145, 96,146,147,148,149, 96,150,151,
-  152,153,154,155,156, 96,157,158,159,160, 96,161,162,163,164,164,
-  164,164,164,164,164,165,166,164,167, 96, 96, 96, 96, 96, 96, 96,
-   96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,168,169,169,
-  169,169,169,169,169,169,170, 96, 96, 96, 96, 96, 96, 96, 96, 96,
-   96, 96, 96, 96, 96, 96,171,171,171,171,172, 96, 96, 96,173,173,
-  173,173,174,175,176,177, 96, 96, 96, 96,178,179,180,181,182,182,
-  182,182,182,182,182,182,182,182,182,182,182,182,182,182,182,182,
-  182,182,182,182,182,182,182,182,182,182,182,182,182,183,182,182,
-  182,182,182,182,184,184,184,185,186, 96, 96, 96, 96, 96, 96, 96,
-   96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,187,188,189,
-  190,191,191,192, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
-   96, 96, 96, 96, 96, 96,193,194, 96, 96, 96, 96, 96, 96, 96, 96,
-   96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,195,196, 59,197,
-  198,199,200,201,202, 96,203,204,205, 59, 59,206, 59,207,208,208,
-  208,208,208,209, 96, 96, 96, 96, 96, 96, 96, 96,210, 96,211,212,
-  213, 96, 96,214, 96, 96, 96,215, 96, 96, 96, 96, 96,216,217,218,
-  219, 96, 96, 96, 96, 96,220,221,222, 96,223,224, 96, 96,225,226,
-   59,227,228, 96, 59, 59, 59, 59, 59, 59, 59,229,230,231,232,233,
-   59, 59,234,235, 59,236, 96, 96, 96, 96, 96, 96, 96, 96, 70, 70,
-   70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70,237, 70, 70, 70, 70,
-   70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70,238, 70,239, 70,
-   70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70,
-   70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70,240, 70, 70, 70, 70,
-   70, 70, 70, 70, 70,241, 70, 70, 70, 70,242, 96, 96, 96, 70, 70,
-   70, 70,243, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 70, 70,
-   70, 70, 70, 70,244, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70,
-   70, 70, 70, 70, 70,245, 96, 96, 96, 96, 96, 96, 96, 96,246, 96,
-  247,248,  0,  1,  2,  2,  0,  1,  2,  2,  2,  3,  4,  5,  0,  0,
-    0,  0,  0,  0,  0,  0,  0, 19, 19, 19, 19, 19, 19, 19, 19, 19,
-   19, 19, 19, 19, 19, 19, 19, 19, 19,  0,  0,  0,  0,  0,  0,  0,
-   19,  0,  0,  0,  0,  0, 19, 19, 19, 19, 19, 19, 19,  0, 19,  0,
-    0,  0,  0,  0,  0,  0, 19, 19, 19, 19, 19,  0,  0,  0,  0,  0,
-   26, 26,  0,  0,  0,  0,  1,  1,  1,  1,  1,  1,  1,  1,  9,  9,
-    9,  9,  0,  9,  9,  9,  2,  2,  9,  9,  9,  9,  0,  9,  2,  2,
-    2,  2,  9,  0,  9,  0,  9,  9,  9,  2,  9,  2,  9,  9,  9,  9,
-    9,  9,  9,  9,  9,  9,  9,  9,  2,  9,  9,  9,  9,  9,  9,  9,
-   55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55,  6,  6,
-    6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  1,  1,  6,  2,  4,
-    4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,
-    4,  4,  4,  4,  4,  2,  4,  4,  4,  2,  2,  4,  4,  4,  2, 14,
-   14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,  2,  2,
-    2,  2,  2,  2,  2,  2, 14, 14, 14,  2,  2,  2,  2, 14, 14, 14,
-   14, 14, 14,  2,  2,  2,  3,  3,  3,  3,  3,  0,  3,  3,  3,  3,
-    3,  3,  0,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,
-    3,  0,  3,  3,  3,  0,  0,  3,  3,  3,  3,  3,  3,  3,  3,  3,
-    3,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  3,  3,  1,  3,
-    3,  3,  3,  3,  3,  3, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
-   37, 37, 37, 37,  2, 37, 37, 37, 37,  2,  2, 37, 37, 37, 38, 38,
-   38, 38, 38, 38, 38, 38, 38, 38,  2,  2,  2,  2,  2,  2, 64, 64,
-   64, 64, 64, 64, 64, 64, 64, 64, 64,  2,  2, 64, 64, 64, 90, 90,
-   90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90,  2,  2, 90, 90,
-   90, 90, 90, 90, 90,  2, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95,
-   95, 95,  2,  2, 95,  2, 37, 37, 37,  2,  2,  2,  2,  2,  3,  3,
-    3,  3,  3,  3,  3,  2,  3,  3,  2,  2,  2,  2,  2,  2,  3,  3,
-    0,  3,  3,  3,  3,  3,  7,  7,  7,  7,  7,  7,  7,  7,  7,  1,
-    1,  1,  1,  7,  7,  7,  7,  7,  7,  7,  0,  0,  7,  7,  5,  5,
-    5,  5,  2,  5,  5,  5,  5,  5,  5,  5,  5,  2,  2,  5,  5,  2,
-    2,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  2,
-    5,  5,  5,  5,  5,  5,  5,  2,  5,  2,  2,  2,  5,  5,  5,  5,
-    2,  2,  5,  5,  5,  5,  5,  2,  2,  5,  5,  5,  5,  2,  2,  2,
-    2,  2,  2,  2,  2,  5,  2,  2,  2,  2,  5,  5,  2,  5,  5,  5,
-    5,  5,  2,  2,  5,  5,  5,  5,  5,  5,  5,  5,  5,  2,  2, 11,
-   11, 11,  2, 11, 11, 11, 11, 11, 11,  2,  2,  2,  2, 11, 11,  2,
-    2, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,  2,
-   11, 11, 11, 11, 11, 11, 11,  2, 11, 11,  2, 11, 11,  2, 11, 11,
-    2,  2, 11,  2, 11, 11, 11,  2,  2, 11, 11, 11,  2,  2,  2, 11,
-    2,  2,  2,  2,  2,  2,  2, 11, 11, 11, 11,  2, 11,  2,  2,  2,
-    2,  2,  2,  2, 11, 11, 11, 11, 11, 11, 11, 11, 11,  2,  2, 10,
-   10, 10,  2, 10, 10, 10, 10, 10, 10, 10, 10, 10,  2, 10, 10, 10,
-    2, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,  2,
-   10, 10, 10, 10, 10, 10, 10,  2, 10, 10,  2, 10, 10, 10, 10, 10,
-    2,  2, 10, 10, 10, 10, 10, 10,  2, 10, 10, 10,  2,  2, 10,  2,
-    2,  2,  2,  2,  2,  2, 10, 10, 10, 10,  2,  2, 10, 10, 10, 10,
-    2,  2,  2,  2,  2,  2,  2, 10, 10, 10, 10, 10, 10, 10,  2, 21,
-   21, 21,  2, 21, 21, 21, 21, 21, 21, 21, 21,  2,  2, 21, 21,  2,
-    2, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,  2,
-   21, 21, 21, 21, 21, 21, 21,  2, 21, 21,  2, 21, 21, 21, 21, 21,
-    2,  2, 21, 21, 21, 21, 21,  2,  2, 21, 21, 21,  2,  2,  2,  2,
-    2,  2,  2, 21, 21, 21,  2,  2,  2,  2, 21, 21,  2, 21, 21, 21,
-   21, 21,  2,  2, 21, 21,  2,  2, 22, 22,  2, 22, 22, 22, 22, 22,
-   22,  2,  2,  2, 22, 22, 22,  2, 22, 22, 22, 22,  2,  2,  2, 22,
-   22,  2, 22,  2, 22, 22,  2,  2,  2, 22, 22,  2,  2,  2, 22, 22,
-   22, 22, 22, 22, 22, 22, 22, 22,  2,  2,  2,  2, 22, 22, 22,  2,
-    2,  2,  2,  2,  2, 22,  2,  2,  2,  2,  2,  2, 22, 22, 22, 22,
-   22,  2,  2,  2,  2,  2, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
-   23, 23, 23,  2, 23, 23, 23,  2, 23, 23, 23, 23, 23, 23, 23, 23,
-    2,  2, 23, 23, 23, 23, 23,  2, 23, 23, 23, 23,  2,  2,  2,  2,
-    2,  2,  2, 23, 23,  2, 23, 23, 23,  2,  2, 23,  2,  2, 23, 23,
-   23, 23,  2,  2, 23, 23,  2,  2,  2,  2,  2,  2,  2, 23, 16, 16,
-   16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,  2, 16, 16, 16,  2,
-   16, 16, 16, 16, 16, 16, 16, 16, 16, 16,  2, 16, 16, 16, 16, 16,
-    2,  2, 16, 16, 16, 16, 16,  2, 16, 16, 16, 16,  2,  2,  2,  2,
-    2,  2,  2, 16, 16,  2, 16, 16, 16, 16,  2,  2, 16, 16,  2, 16,
-   16, 16,  2,  2,  2,  2, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
-   20, 20, 20,  2, 20, 20, 20,  2, 20, 20, 20, 20, 20, 20,  2,  2,
-    2,  2, 20, 20, 20, 20, 20, 20, 20, 20,  2,  2, 20, 20,  2, 36,
-   36, 36,  2, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
-   36, 36, 36, 36, 36,  2,  2,  2, 36, 36, 36, 36, 36, 36, 36, 36,
-    2, 36, 36, 36, 36, 36, 36, 36, 36, 36,  2, 36,  2,  2,  2,  2,
-   36,  2,  2,  2,  2, 36, 36, 36, 36, 36, 36,  2, 36,  2,  2,  2,
-    2,  2,  2,  2, 36, 36,  2,  2, 36, 36, 36,  2,  2,  2,  2, 24,
-   24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
-   24,  2,  2,  2,  2,  0, 24, 24, 24, 24,  2,  2,  2,  2,  2, 18,
-   18,  2, 18,  2, 18, 18, 18, 18, 18,  2, 18, 18, 18, 18, 18, 18,
-   18, 18, 18, 18, 18, 18, 18, 18, 18, 18,  2, 18,  2, 18, 18, 18,
-   18, 18, 18, 18,  2,  2, 18, 18, 18, 18, 18,  2, 18,  2, 18, 18,
-   18, 18, 18, 18, 18,  2, 18, 18,  2,  2, 18, 18, 18, 18, 25, 25,
-   25, 25, 25, 25, 25, 25,  2, 25, 25, 25, 25, 25, 25, 25, 25, 25,
-   25, 25, 25,  2,  2,  2, 25, 25, 25, 25, 25,  2, 25, 25, 25, 25,
-   25, 25, 25,  0,  0,  0,  0, 25, 25,  2,  2,  2,  2,  2, 33, 33,
-   33, 33, 33, 33, 33, 33,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,
-    8,  8,  8,  8,  2,  8,  2,  2,  2,  2,  2,  8,  2,  2,  8,  8,
-    8,  0,  8,  8,  8,  8, 12, 12, 12, 12, 12, 12, 12, 12, 30, 30,
-   30, 30, 30, 30, 30, 30, 30,  2, 30, 30, 30, 30,  2,  2, 30, 30,
-   30, 30, 30, 30, 30,  2, 30, 30, 30,  2,  2, 30, 30, 30, 30, 30,
-   30, 30, 30,  2,  2,  2, 30, 30,  2,  2,  2,  2,  2,  2, 29, 29,
-   29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,  2,  2, 28, 28,
-   28, 28, 28, 28, 28, 28, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
-   34, 34, 34,  2,  2,  2, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
-   35,  0,  0,  0, 35, 35, 35,  2,  2,  2,  2,  2,  2,  2, 45, 45,
-   45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,  2,  2,  2,  2,
-    2,  2,  2,  2,  2, 45, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
-   44, 44, 44,  0,  0,  2, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
-   43, 43,  2,  2,  2,  2, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46,
-   46, 46, 46,  2, 46, 46, 46,  2, 46, 46,  2,  2,  2,  2, 31, 31,
-   31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31,  2,  2, 31, 31,
-    2,  2,  2,  2,  2,  2, 32, 32,  0,  0, 32,  0, 32, 32, 32, 32,
-   32, 32, 32, 32, 32, 32, 32, 32,  2,  2,  2,  2,  2,  2, 32,  2,
-    2,  2,  2,  2,  2,  2, 32, 32, 32,  2,  2,  2,  2,  2, 28, 28,
-   28, 28, 28, 28,  2,  2, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
-   48, 48, 48, 48, 48,  2, 48, 48, 48, 48,  2,  2,  2,  2, 48,  2,
-    2,  2, 48, 48, 48, 48, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
-   52, 52, 52, 52,  2,  2, 52, 52, 52, 52, 52,  2,  2,  2, 58, 58,
-   58, 58, 58, 58, 58, 58, 58, 58, 58, 58,  2,  2,  2,  2, 58, 58,
-    2,  2,  2,  2,  2,  2, 58, 58, 58,  2,  2,  2, 58, 58, 54, 54,
-   54, 54, 54, 54, 54, 54, 54, 54, 54, 54,  2,  2, 54, 54, 91, 91,
-   91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91,  2, 91, 91,
-   91, 91, 91,  2,  2, 91, 91, 91,  2,  2,  2,  2,  2,  2, 91, 91,
-   91, 91, 91, 91,  2,  2,  1,  1,  1,  1,  1,  1,  1,  2, 62, 62,
-   62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62,  2,  2,  2, 62, 62,
-   62, 62, 62, 62, 62,  2, 76, 76, 76, 76, 76, 76, 76, 76, 93, 93,
+   13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 60, 13, 13,
+   13, 61, 62, 13, 13, 13, 13, 63, 13, 13, 13, 13, 13, 13, 64, 65,
+   20, 20, 66, 20, 13, 13, 13, 13, 67, 13, 13, 13, 68, 20, 20, 20,
+   20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+   20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+   20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+   20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+   20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+   20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+   20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+   20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+   20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+   20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+   20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+   20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+   20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+   20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+   20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+   20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+   20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+   20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+   20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+   20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+   20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+   20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+   20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+   20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+   20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+   20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+   20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+   20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+   20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+   20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+   20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+   20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+   20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+   20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+   20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+   20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+   20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+   20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+   20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+   20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+   20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+   20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+   20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+   20, 20, 20, 20, 69,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 19,
+   19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,
+   19,  0,  0,  0,  0,  0,  0,  0, 19,  0,  0,  0,  0,  0, 19, 19,
+   19, 19, 19, 19, 19,  0, 19,  0,  0,  0,  0,  0,  0,  0, 19, 19,
+   19, 19, 19,  0,  0,  0,  0,  0, 26, 26,  0,  0,  0,  0,  1,  1,
+    1,  1,  1,  1,  1,  1,  9,  9,  9,  9,  0,  9,  9,  9,  2,  2,
+    9,  9,  9,  9,  0,  9,  2,  2,  2,  2,  9,  0,  9,  0,  9,  9,
+    9,  2,  9,  2,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
+    2,  9,  9,  9,  9,  9,  9,  9, 55, 55, 55, 55, 55, 55, 55, 55,
+   55, 55, 55, 55, 55, 55,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,
+    6,  6,  6,  1,  1,  6,  2,  4,  4,  4,  4,  4,  4,  4,  4,  4,
+    4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  2,  4,  4,
+    4,  2,  2,  4,  4,  4,  2, 14, 14, 14, 14, 14, 14, 14, 14, 14,
+   14, 14, 14, 14, 14, 14,  2,  2,  2,  2,  2,  2,  2,  2, 14, 14,
+   14,  2,  2,  2,  2, 14, 14, 14, 14, 14, 14,  2,  2,  2,  3,  3,
+    3,  3,  3,  0,  3,  3,  3,  3,  3,  3,  0,  3,  3,  3,  3,  3,
+    3,  3,  3,  3,  3,  3,  3,  3,  3,  0,  3,  3,  3,  0,  0,  3,
+    3,  3,  3,  3,  3,  3,  3,  3,  3,  1,  1,  1,  1,  1,  1,  1,
+    1,  1,  1,  1,  3,  3,  1,  3,  3,  3,  3,  3,  3,  3, 37, 37,
+   37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,  2, 37, 37, 37,
+   37,  2,  2, 37, 37, 37, 38, 38, 38, 38, 38, 38, 38, 38, 38, 38,
+    2,  2,  2,  2,  2,  2, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64,
+   64,  2,  2, 64, 64, 64, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90,
+   90, 90, 90, 90,  2,  2, 90, 90, 90, 90, 90, 90, 90,  2, 95, 95,
+   95, 95, 95, 95, 95, 95, 95, 95, 95, 95,  2,  2, 95,  2, 37, 37,
+   37,  2,  2,  2,  2,  2,  3,  3,  3,  3,  3,  3,  3,  2,  3,  3,
+    2,  2,  2,  2,  2,  3,  3,  3,  0,  3,  3,  3,  3,  3,  7,  7,
+    7,  7,  7,  7,  7,  7,  7,  1,  1,  1,  1,  7,  7,  7,  7,  7,
+    7,  7,  0,  0,  7,  7,  5,  5,  5,  5,  2,  5,  5,  5,  5,  5,
+    5,  5,  5,  2,  2,  5,  5,  2,  2,  5,  5,  5,  5,  5,  5,  5,
+    5,  5,  5,  5,  5,  5,  5,  2,  5,  5,  5,  5,  5,  5,  5,  2,
+    5,  2,  2,  2,  5,  5,  5,  5,  2,  2,  5,  5,  5,  5,  5,  2,
+    2,  5,  5,  5,  5,  2,  2,  2,  2,  2,  2,  2,  2,  5,  2,  2,
+    2,  2,  5,  5,  2,  5,  5,  5,  5,  5,  2,  2,  5,  5,  5,  5,
+    5,  5,  5,  5,  5,  2,  2, 11, 11, 11,  2, 11, 11, 11, 11, 11,
+   11,  2,  2,  2,  2, 11, 11,  2,  2, 11, 11, 11, 11, 11, 11, 11,
+   11, 11, 11, 11, 11, 11, 11,  2, 11, 11, 11, 11, 11, 11, 11,  2,
+   11, 11,  2, 11, 11,  2, 11, 11,  2,  2, 11,  2, 11, 11, 11,  2,
+    2, 11, 11, 11,  2,  2,  2, 11,  2,  2,  2,  2,  2,  2,  2, 11,
+   11, 11, 11,  2, 11,  2,  2,  2,  2,  2,  2,  2, 11, 11, 11, 11,
+   11, 11, 11, 11, 11,  2,  2, 10, 10, 10,  2, 10, 10, 10, 10, 10,
+   10, 10, 10, 10,  2, 10, 10, 10,  2, 10, 10, 10, 10, 10, 10, 10,
+   10, 10, 10, 10, 10, 10, 10,  2, 10, 10, 10, 10, 10, 10, 10,  2,
+   10, 10,  2, 10, 10, 10, 10, 10,  2,  2, 10, 10, 10, 10, 10, 10,
+    2, 10, 10, 10,  2,  2, 10,  2,  2,  2,  2,  2,  2,  2, 10, 10,
+   10, 10,  2,  2, 10, 10, 10, 10,  2,  2,  2,  2,  2,  2,  2, 10,
+   10, 10, 10, 10, 10, 10,  2, 21, 21, 21,  2, 21, 21, 21, 21, 21,
+   21, 21, 21,  2,  2, 21, 21,  2,  2, 21, 21, 21, 21, 21, 21, 21,
+   21, 21, 21, 21, 21, 21, 21,  2, 21, 21, 21, 21, 21, 21, 21,  2,
+   21, 21,  2, 21, 21, 21, 21, 21,  2,  2, 21, 21, 21, 21, 21,  2,
+    2, 21, 21, 21,  2,  2,  2,  2,  2,  2,  2, 21, 21, 21,  2,  2,
+    2,  2, 21, 21,  2, 21, 21, 21, 21, 21,  2,  2, 21, 21,  2,  2,
+   22, 22,  2, 22, 22, 22, 22, 22, 22,  2,  2,  2, 22, 22, 22,  2,
+   22, 22, 22, 22,  2,  2,  2, 22, 22,  2, 22,  2, 22, 22,  2,  2,
+    2, 22, 22,  2,  2,  2, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+    2,  2,  2,  2, 22, 22, 22,  2,  2,  2,  2,  2,  2, 22,  2,  2,
+    2,  2,  2,  2, 22, 22, 22, 22, 22,  2,  2,  2,  2,  2, 23, 23,
+   23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,  2, 23, 23, 23,  2,
+   23, 23, 23, 23, 23, 23, 23, 23,  2,  2, 23, 23, 23, 23, 23,  2,
+   23, 23, 23, 23,  2,  2,  2,  2,  2,  2,  2, 23, 23,  2, 23, 23,
+   23,  2,  2, 23,  2,  2, 23, 23, 23, 23,  2,  2, 23, 23,  2,  2,
+    2,  2,  2,  2,  2, 23, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
+   16, 16, 16,  2, 16, 16, 16,  2, 16, 16, 16, 16, 16, 16, 16, 16,
+   16, 16,  2, 16, 16, 16, 16, 16,  2,  2, 16, 16, 16, 16, 16,  2,
+   16, 16, 16, 16,  2,  2,  2,  2,  2,  2,  2, 16, 16,  2, 16, 16,
+   16, 16,  2,  2, 16, 16,  2, 16, 16, 16,  2,  2,  2,  2, 20, 20,
+   20, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,  2, 20, 20, 20,  2,
+   20, 20, 20, 20, 20, 20,  2,  2,  2,  2, 20, 20, 20, 20, 20, 20,
+   20, 20,  2,  2, 20, 20,  2, 36, 36, 36,  2, 36, 36, 36, 36, 36,
+   36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,  2,  2,  2,
+   36, 36, 36, 36, 36, 36, 36, 36,  2, 36, 36, 36, 36, 36, 36, 36,
+   36, 36,  2, 36,  2,  2,  2,  2, 36,  2,  2,  2,  2, 36, 36, 36,
+   36, 36, 36,  2, 36,  2,  2,  2,  2,  2,  2,  2, 36, 36,  2,  2,
+   36, 36, 36,  2,  2,  2,  2, 24, 24, 24, 24, 24, 24, 24, 24, 24,
+   24, 24, 24, 24, 24, 24, 24, 24, 24,  2,  2,  2,  2,  0, 24, 24,
+   24, 24,  2,  2,  2,  2,  2, 18, 18,  2, 18,  2, 18, 18, 18, 18,
+   18,  2, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18,
+   18, 18,  2, 18,  2, 18, 18, 18, 18, 18, 18, 18,  2,  2, 18, 18,
+   18, 18, 18,  2, 18,  2, 18, 18, 18, 18, 18, 18, 18,  2, 18, 18,
+    2,  2, 18, 18, 18, 18, 25, 25, 25, 25, 25, 25, 25, 25,  2, 25,
+   25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25,  2,  2,  2, 25, 25,
+   25, 25, 25,  2, 25, 25, 25, 25, 25, 25, 25,  0,  0,  0,  0, 25,
+   25,  2,  2,  2,  2,  2, 33, 33, 33, 33, 33, 33, 33, 33,  8,  8,
+    8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  2,  8,  2,  2,
+    2,  2,  2,  8,  2,  2,  8,  8,  8,  0,  8,  8,  8,  8, 12, 12,
+   12, 12, 12, 12, 12, 12, 30, 30, 30, 30, 30, 30, 30, 30, 30,  2,
+   30, 30, 30, 30,  2,  2, 30, 30, 30, 30, 30, 30, 30,  2, 30, 30,
+   30,  2,  2, 30, 30, 30, 30, 30, 30, 30, 30,  2,  2,  2, 30, 30,
+    2,  2,  2,  2,  2,  2, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,
+   29, 29, 29, 29,  2,  2, 28, 28, 28, 28, 28, 28, 28, 28, 34, 34,
+   34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,  2,  2,  2, 35, 35,
+   35, 35, 35, 35, 35, 35, 35, 35, 35,  0,  0,  0, 35, 35, 35,  2,
+    2,  2,  2,  2,  2,  2, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,
+   45, 45, 45, 45,  2,  2,  2,  2,  2,  2,  2,  2,  2, 45, 44, 44,
+   44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44,  0,  0,  2, 43, 43,
+   43, 43, 43, 43, 43, 43, 43, 43, 43, 43,  2,  2,  2,  2, 46, 46,
+   46, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46,  2, 46, 46, 46,  2,
+   46, 46,  2,  2,  2,  2, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31,
+   31, 31, 31, 31,  2,  2, 31, 31,  2,  2,  2,  2,  2,  2, 32, 32,
+    0,  0, 32,  0, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
+    2,  2,  2,  2,  2,  2, 32,  2,  2,  2,  2,  2,  2,  2, 32, 32,
+   32,  2,  2,  2,  2,  2, 28, 28, 28, 28, 28, 28,  2,  2, 48, 48,
+   48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,  2, 48, 48,
+   48, 48,  2,  2,  2,  2, 48,  2,  2,  2, 48, 48, 48, 48, 52, 52,
+   52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,  2,  2, 52, 52,
+   52, 52, 52,  2,  2,  2, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58,
+   58, 58,  2,  2,  2,  2, 58, 58,  2,  2,  2,  2,  2,  2, 58, 58,
+   58,  2,  2,  2, 58, 58, 54, 54, 54, 54, 54, 54, 54, 54, 54, 54,
+   54, 54,  2,  2, 54, 54, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91,
+   91, 91, 91, 91, 91,  2, 91, 91, 91, 91, 91,  2,  2, 91, 91, 91,
+    2,  2,  2,  2,  2,  2, 91, 91, 91, 91, 91, 91,  2,  2,  1,  1,
+    1,  1,  1,  1,  1,  2, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62,
+   62, 62, 62,  2, 62, 62, 76, 76, 76, 76, 76, 76, 76, 76, 93, 93,
    93, 93, 93, 93, 93, 93, 93, 93, 93, 93,  2,  2,  2,  2,  2,  2,
     2,  2, 93, 93, 93, 93, 70, 70, 70, 70, 70, 70, 70, 70,  2,  2,
     2, 70, 70, 70, 70, 70, 70, 70,  2,  2,  2, 70, 70, 70, 73, 73,
-   73, 73, 73, 73, 73, 73,  6,  2,  2,  2,  2,  2,  2,  2,  8,  8,
+   73, 73, 73, 73, 73, 73,  6,  6,  6,  2,  2,  2,  2,  2,  8,  8,
     8,  2,  2,  8,  8,  8,  1,  1,  1,  0,  1,  1,  1,  1,  1,  0,
     1,  1,  1,  1,  1,  1,  1,  0,  0,  0,  0,  1,  0,  0,  0,  0,
     0,  0,  1,  0,  0,  0,  1,  1,  0,  2,  2,  2,  2,  2, 19, 19,
@@ -1896,31 +1872,30 @@ _hb_ucd_u8[17884] =
     2,  2,  2,  2,  2,  2,  1,  2,  2,  2,  2,  2,  2,  2,  0,  0,
     0,  0,  0,  0,  9,  0,  0,  0, 19, 19,  0,  0,  0,  0,  0,  0,
     0,  0,  0,  0, 19,  0, 19,  0,  0,  0,  2,  2,  2,  2,  0,  0,
-    0,  2,  2,  2,  2,  2, 27, 27, 27, 27, 27, 27, 27, 27,  0,  0,
-    0,  0,  2,  2,  0,  0,  0,  0,  0,  0,  0,  0,  2,  0, 56, 56,
-   56, 56, 56, 56, 56, 56, 55, 55, 55, 55,  2,  2,  2,  2,  2, 55,
-   55, 55, 55, 55, 55, 55, 61, 61, 61, 61, 61, 61, 61, 61,  2,  2,
-    2,  2,  2,  2,  2, 61, 61,  2,  2,  2,  2,  2,  2,  2,  0,  0,
-    0,  0,  0,  0,  2,  2, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
-    2, 13, 13, 13, 13, 13, 13, 13, 13, 13,  2,  2,  2,  2, 13, 13,
-   13, 13, 13, 13,  2,  2,  0,  0,  0,  0,  0, 13,  0, 13,  0, 13,
-   13, 13, 13, 13, 13, 13, 13, 13,  1,  1,  1,  1, 12, 12, 13, 13,
-   13, 13,  0,  0,  0,  0,  2, 15, 15, 15, 15, 15, 15, 15, 15, 15,
-   15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,  2,  2,  1,
-    1,  0,  0, 15, 15, 15,  0, 17, 17, 17, 17, 17, 17, 17, 17, 17,
-   17, 17, 17, 17, 17, 17, 17, 17, 17,  0,  0, 17, 17, 17,  2,  2,
-    2,  2,  2, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,  2, 12,
-   12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,  2,  0,  0,
-    0,  0,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  0, 12, 12,
+    2,  2,  2,  2,  2,  2,  0,  0,  0,  2,  2,  2,  2,  2, 27, 27,
+   27, 27, 27, 27, 27, 27,  0,  0,  0,  0,  2,  2,  0,  0,  0,  0,
+    0,  0,  0,  0,  2,  0, 56, 56, 56, 56, 56, 56, 56, 56, 55, 55,
+   55, 55,  2,  2,  2,  2,  2, 55, 55, 55, 55, 55, 55, 55, 61, 61,
+   61, 61, 61, 61, 61, 61,  2,  2,  2,  2,  2,  2,  2, 61, 61,  2,
+    2,  2,  2,  2,  2,  2,  0,  0,  0,  0,  0,  0,  2,  2, 13, 13,
+   13, 13, 13, 13, 13, 13, 13, 13,  2, 13, 13, 13, 13, 13, 13, 13,
+   13, 13,  2,  2,  2,  2, 13, 13, 13, 13, 13, 13,  2,  2,  0,  0,
+    0,  0,  0, 13,  0, 13,  0, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+    1,  1,  1,  1, 12, 12, 13, 13, 13, 13,  0,  0,  0,  0,  2, 15,
+   15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
+   15, 15, 15, 15, 15,  2,  2,  1,  1,  0,  0, 15, 15, 15,  0, 17,
+   17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
+   17,  0,  0, 17, 17, 17,  2,  2,  2,  2,  2, 26, 26, 26, 26, 26,
+   26, 26, 26, 26, 26, 26,  2, 12, 12, 12, 12, 12, 12, 12, 12, 12,
+   12, 12, 12, 12, 12,  2,  2,  2,  2,  2,  2,  2,  2,  0, 12, 12,
    12, 12, 12, 12, 12,  0, 17, 17, 17, 17, 17, 17, 17,  0, 39, 39,
    39, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39,  2,  2,  2, 39, 39,
    39, 39, 39, 39, 39,  2, 86, 86, 86, 86, 86, 86, 86, 86, 77, 77,
    77, 77, 77, 77, 77, 77, 77, 77, 77, 77,  2,  2,  2,  2, 79, 79,
    79, 79, 79, 79, 79, 79,  0,  0, 19, 19, 19, 19, 19, 19,  0,  0,
-    0, 19, 19, 19, 19, 19, 19, 19, 19,  2,  2,  2,  2,  2, 19, 19,
-    2, 19,  2, 19, 19, 19, 19, 19,  2,  2,  2,  2,  2,  2,  2,  2,
-   19, 19, 19, 19, 19, 19, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
-   60, 60, 60,  2,  2,  2,  0,  0,  2,  2,  2,  2,  2,  2, 65, 65,
+    0, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,  2,  2, 19, 19,
+    2, 19,  2, 19, 19, 19,  2,  2, 19, 19, 19, 19, 19, 19, 60, 60,
+   60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60,  2,  2,  2, 65, 65,
    65, 65, 65, 65, 65, 65, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75,
    75, 75, 75, 75,  2,  2,  2,  2,  2,  2,  2,  2, 75, 75, 75, 75,
     2,  2,  2,  2,  2,  2, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69,
@@ -1943,36 +1918,38 @@ _hb_ucd_u8[17884] =
     2, 14, 14,  2, 14, 14,  3,  3,  3,  2,  2,  2,  2,  2,  2,  2,
     2,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  0,  0,  2,  2,
     3,  3,  3,  3,  3,  3,  2,  2,  2,  2,  2,  2,  2,  3,  1,  1,
-    1,  1,  1,  1,  6,  6,  0,  0,  0,  2,  0,  0,  0,  0,  3,  3,
-    3,  3,  3,  2,  3,  3,  3,  3,  3,  3,  3,  2,  2,  0,  2,  0,
-    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 17, 17, 17, 17,
-   17, 17, 17, 17,  0,  0,  2,  2, 12, 12, 12, 12, 12, 12,  2,  2,
-   12, 12, 12,  2,  2,  2,  2,  0,  0,  0,  0,  0,  2,  2, 49, 49,
-   49, 49, 49, 49, 49, 49, 49, 49, 49, 49,  2, 49, 49, 49, 49, 49,
-   49, 49, 49, 49, 49,  2, 49, 49, 49,  2, 49, 49,  2, 49, 49, 49,
-   49, 49, 49, 49,  2,  2, 49, 49, 49,  2,  2,  2,  2,  2,  0,  0,
-    0,  2,  2,  2,  2,  0,  0,  0,  0,  0,  2,  2,  2,  0,  0,  0,
-    0,  0,  0,  2,  2,  2,  9,  2,  2,  2,  2,  2,  2,  2,  0,  0,
-    0,  0,  0,  1,  2,  2, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71,
-   71, 71, 71,  2,  2,  2, 67, 67, 67, 67, 67, 67, 67, 67, 67,  2,
-    2,  2,  2,  2,  2,  2,  1,  0,  0,  0,  0,  0,  0,  0, 42, 42,
-   42, 42, 42, 42, 42, 42, 42, 42, 42, 42,  2,  2,  2,  2,  2,  2,
-    2,  2,  2, 42, 42, 42, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
-   41,  2,  2,  2,  2,  2,118,118,118,118,118,118,118,118,118,118,
-  118,  2,  2,  2,  2,  2, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53,
-   53, 53, 53, 53,  2, 53, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59,
-   59, 59,  2,  2,  2,  2, 59, 59, 59, 59, 59, 59,  2,  2, 40, 40,
-   40, 40, 40, 40, 40, 40, 51, 51, 51, 51, 51, 51, 51, 51, 50, 50,
-   50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,  2,  2, 50, 50,
-    2,  2,  2,  2,  2,  2,135,135,135,135,135,135,135,135,135,135,
-  135,135,  2,  2,  2,  2,106,106,106,106,106,106,106,106,104,104,
-  104,104,104,104,104,104,104,104,104,104,  2,  2,  2,  2,  2,  2,
-    2,  2,  2,  2,  2,104,161,161,161,161,161,161,161,161,161,161,
-  161,  2,161,161,161,161,161,161,161,  2,161,161,  2,161,161,161,
-    2,161,161,161,161,161,161,161,  2,161,161,  2,  2,  2,110,110,
-  110,110,110,110,110,110,110,110,110,110,110,110,110,  2,110,110,
-  110,110,110,110,  2,  2, 19, 19, 19, 19, 19, 19,  2, 19, 19,  2,
-   19, 19, 19, 19, 19, 19, 47, 47, 47, 47, 47, 47,  2,  2, 47,  2,
+    1,  1,  1,  1,  6,  6,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,
+    0,  0,  2,  2,  2,  2,  3,  3,  3,  3,  3,  2,  3,  3,  3,  3,
+    3,  3,  3,  2,  2,  0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+    0,  0,  0,  0, 17, 17, 17, 17, 17, 17, 17, 17,  0,  0,  2,  2,
+   12, 12, 12, 12, 12, 12,  2,  2, 12, 12, 12,  2,  2,  2,  2,  0,
+    0,  0,  0,  0,  2,  2, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,
+   49, 49,  2, 49, 49, 49, 49, 49, 49, 49, 49, 49, 49,  2, 49, 49,
+   49,  2, 49, 49,  2, 49, 49, 49, 49, 49, 49, 49,  2,  2, 49, 49,
+   49,  2,  2,  2,  2,  2,  0,  0,  0,  2,  2,  2,  2,  0,  0,  0,
+    0,  0,  2,  2,  2,  0,  0,  0,  0,  0,  0,  2,  2,  2,  9,  2,
+    2,  2,  2,  2,  2,  2,  0,  0,  0,  0,  0,  1,  2,  2, 71, 71,
+   71, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71,  2,  2,  2, 67, 67,
+   67, 67, 67, 67, 67, 67, 67,  2,  2,  2,  2,  2,  2,  2,  1,  0,
+    0,  0,  0,  0,  0,  0, 42, 42, 42, 42, 42, 42, 42, 42, 42, 42,
+   42, 42,  2,  2,  2,  2,  2,  2,  2,  2,  2, 42, 42, 42, 41, 41,
+   41, 41, 41, 41, 41, 41, 41, 41, 41,  2,  2,  2,  2,  2,118,118,
+  118,118,118,118,118,118,118,118,118,  2,  2,  2,  2,  2, 53, 53,
+   53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53,  2, 53, 59, 59,
+   59, 59, 59, 59, 59, 59, 59, 59, 59, 59,  2,  2,  2,  2, 59, 59,
+   59, 59, 59, 59,  2,  2, 40, 40, 40, 40, 40, 40, 40, 40, 51, 51,
+   51, 51, 51, 51, 51, 51, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,
+   50, 50, 50, 50,  2,  2, 50, 50,  2,  2,  2,  2,  2,  2,135,135,
+  135,135,135,135,135,135,135,135,135,135,  2,  2,  2,  2,106,106,
+  106,106,106,106,106,106,104,104,104,104,104,104,104,104,104,104,
+  104,104,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,104,161,161,
+  161,161,161,161,161,161,161,161,161,  2,161,161,161,161,161,161,
+  161,  2,161,161,  2,161,161,161,  2,161,161,161,161,161,161,161,
+    2,161,161,  2,  2,  2,170,170,170,170,170,170,170,170,170,170,
+  170,170,  2,  2,  2,  2,110,110,110,110,110,110,110,110,110,110,
+  110,110,110,110,110,  2,110,110,110,110,110,110,  2,  2, 19, 19,
+   19, 19, 19, 19,  2, 19, 19,  2, 19, 19, 19, 19, 19, 19, 19, 19,
+   19,  2,  2,  2,  2,  2, 47, 47, 47, 47, 47, 47,  2,  2, 47,  2,
    47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
    47, 47, 47, 47,  2, 47, 47,  2,  2,  2, 47,  2,  2, 47, 81, 81,
    81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81,  2, 81,120,120,
@@ -1998,122 +1975,135 @@ _hb_ucd_u8[17884] =
   122,122,122,122,122,122, 89, 89, 89, 89, 89, 89, 89, 89, 89,  2,
     2,  2,  2,  2,  2,  2,130,130,130,130,130,130,130,130,130,130,
   130,  2,  2,  2,  2,  2,  2,  2,130,130,130,130,130,130,144,144,
-  144,144,144,144,144,144,144,144,  2,  2,  2,  2,  2,  2,156,156,
+  144,144,144,144,144,144,144,144,  2,  2,  2,  2,  2,  2,165,165,
+  165,165,165,165,165,165,165,165,165,165,165,165,  2,  2,  2,165,
+  165,165,165,165,165,165,  2,  2,  2,  2,  2,  2,165,165,156,156,
   156,156,156,156,156,156,156,156,  2,156,156,156,  2,  2,156,156,
-    2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  3,  3,  3,147,147,
-  147,147,147,147,147,147,148,148,148,148,148,148,148,148,148,148,
-    2,  2,  2,  2,  2,  2,158,158,158,158,158,158,158,158,158,158,
-    2,  2,  2,  2,  2,  2,153,153,153,153,153,153,153,153,153,153,
-  153,153,  2,  2,  2,  2,149,149,149,149,149,149,149,149,149,149,
-  149,149,149,149,149,  2, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
-   94, 94, 94, 94,  2,  2,  2,  2, 94, 94, 94, 94, 94, 94,  2,  2,
-    2,  2,  2,  2,  2, 94, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
-   85,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2, 85,  2,  2,101,101,
-  101,101,101,101,101,101,101,  2,  2,  2,  2,  2,  2,  2,101,101,
-    2,  2,  2,  2,  2,  2, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
-   96, 96, 96,  2, 96, 96,111,111,111,111,111,111,111,111,111,111,
-  111,111,111,111,111,  2,100,100,100,100,100,100,100,100,  2, 36,
-   36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,  2,  2,  2,108,108,
-  108,108,108,108,108,108,108,108,  2,108,108,108,108,108,108,108,
-    2,  2,  2,  2,  2,  2,129,129,129,129,129,129,129,  2,129,  2,
-  129,129,129,129,  2,129,129,129,129,129,129,129,129,129,129,129,
-  129,129,129,129,  2,129,129,129,  2,  2,  2,  2,  2,  2,109,109,
-  109,109,109,109,109,109,109,109,109,  2,  2,  2,  2,  2,109,109,
-    2,  2,  2,  2,  2,  2,107,107,107,107,  2,107,107,107,107,107,
-  107,107,107,  2,  2,107,107,  2,  2,107,107,107,107,107,107,107,
-  107,107,107,107,107,107,107,  2,107,107,107,107,107,107,107,  2,
-  107,107,  2,107,107,107,107,107,  2,  1,107,107,107,107,107,  2,
-    2,107,107,107,  2,  2,107,  2,  2,  2,  2,  2,  2,107,  2,  2,
-    2,  2,  2,107,107,107,107,107,107,107,  2,  2,107,107,107,107,
-  107,107,107,  2,  2,  2,137,137,137,137,137,137,137,137,137,137,
+    2,  2,  2,  2,  2,  2,  2,  2,  3,  3,  3,  2,  2,  2,  2,  2,
+    2,  2,  3,  3,  3,  3,147,147,147,147,147,147,147,147,148,148,
+  148,148,148,148,148,148,148,148,  2,  2,  2,  2,  2,  2,158,158,
+  158,158,158,158,158,158,158,158,  2,  2,  2,  2,  2,  2,153,153,
+  153,153,153,153,153,153,153,153,153,153,  2,  2,  2,  2,149,149,
+  149,149,149,149,149,149,149,149,149,149,149,149,149,  2, 94, 94,
+   94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,  2,  2,  2,  2,
+   94, 94, 94, 94, 94, 94,  2,  2,  2,  2,  2,  2,  2, 94, 85, 85,
+   85, 85, 85, 85, 85, 85, 85, 85, 85,  2,  2,  2,  2,  2,  2,  2,
+    2,  2,  2, 85,  2,  2,101,101,101,101,101,101,101,101,101,  2,
+    2,  2,  2,  2,  2,  2,101,101,  2,  2,  2,  2,  2,  2, 96, 96,
+   96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,  2, 96, 96,111,111,
+  111,111,111,111,111,111,111,111,111,111,111,111,111,  2,100,100,
+  100,100,100,100,100,100,  2, 36, 36, 36, 36, 36, 36, 36, 36, 36,
+   36, 36, 36,  2,  2,  2,108,108,108,108,108,108,108,108,108,108,
+    2,108,108,108,108,108,108,108,  2,  2,  2,  2,  2,  2,129,129,
+  129,129,129,129,129,  2,129,  2,129,129,129,129,  2,129,129,129,
+  129,129,129,129,129,129,129,129,129,129,129,129,  2,129,129,129,
+    2,  2,  2,  2,  2,  2,109,109,109,109,109,109,109,109,109,109,
+  109,  2,  2,  2,  2,  2,109,109,  2,  2,  2,  2,  2,  2,107,107,
+  107,107,  2,107,107,107,107,107,107,107,107,  2,  2,107,107,  2,
+    2,107,107,107,107,107,107,107,107,107,107,107,107,107,107,  2,
+  107,107,107,107,107,107,107,  2,107,107,  2,107,107,107,107,107,
+    2,  1,107,107,107,107,107,  2,  2,107,107,107,  2,  2,107,  2,
+    2,  2,  2,  2,  2,107,  2,  2,  2,  2,  2,107,107,107,107,107,
+  107,107,  2,  2,107,107,107,107,107,107,107,  2,  2,  2,171,171,
+  171,171,171,171,171,171,171,171,  2,171,  2,  2,171,  2,171,171,
+  171,171,171,171,  2,171,171,  2,171,  2,  2,171,  2,171,171,171,
+  171,  2,171,171,171,171,171,  2,  2,  2,  2,  2,  2,  2,  2,171,
+  171,  2,  2,  2,  2,  2,137,137,137,137,137,137,137,137,137,137,
   137,137,  2,137,137,137,137,137,  2,  2,  2,  2,  2,  2,124,124,
   124,124,124,124,124,124,124,124,  2,  2,  2,  2,  2,  2,123,123,
   123,123,123,123,123,123,123,123,123,123,123,123,  2,  2,114,114,
   114,114,114,114,114,114,114,114,114,114,114,  2,  2,  2,114,114,
     2,  2,  2,  2,  2,  2, 32, 32, 32, 32, 32,  2,  2,  2,102,102,
-  102,102,102,102,102,102,102,102,  2,  2,  2,  2,  2,  2,126,126,
-  126,126,126,126,126,126,126,126,126,  2,  2,126,126,126,126,126,
-  126,126,  2,  2,  2,  2,126,126,126,126,126,126,126,  2,142,142,
-  142,142,142,142,142,142,142,142,142,142,  2,  2,  2,  2,125,125,
-  125,125,125,125,125,125,125,125,125,  2,  2,  2,  2,  2,  2,  2,
-    2,  2,  2,  2,  2,125,154,154,154,154,154,154,154,  2,  2,154,
-    2,  2,154,154,154,154,154,154,154,154,  2,154,154,  2,154,154,
-  154,154,154,154,154,154,154,154,154,154,154,154,  2,154,154,  2,
-    2,154,154,154,154,154,154,154,  2,  2,  2,  2,  2,  2,150,150,
-  150,150,150,150,150,150,  2,  2,150,150,150,150,150,150,150,150,
-  150,150,150,  2,  2,  2,141,141,141,141,141,141,141,141,140,140,
-  140,140,140,140,140,140,140,140,140,  2,  2,  2,  2,  2,121,121,
-  121,121,121,121,121,121,121,  2,  2,  2,  2,  2,  2,  2,  7,  7,
-    2,  2,  2,  2,  2,  2,133,133,133,133,133,133,133,133,133,  2,
-  133,133,133,133,133,133,133,133,133,133,133,133,133,  2,133,133,
-  133,133,133,133,  2,  2,133,133,133,133,133,  2,  2,  2,134,134,
-  134,134,134,134,134,134,  2,  2,134,134,134,134,134,134,  2,134,
-  134,134,134,134,134,134,134,134,134,134,134,134,134,  2,138,138,
-  138,138,138,138,138,  2,138,138,  2,138,138,138,138,138,138,138,
-  138,138,138,138,138,138,  2,  2,138,  2,138,138,  2,138,138,138,
-    2,  2,  2,  2,  2,  2,143,143,143,143,143,143,  2,143,143,  2,
-  143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,
-  143,143,143,143,143,  2,143,143,  2,143,143,143,143,143,143,  2,
-    2,  2,  2,  2,  2,  2,143,143,  2,  2,  2,  2,  2,  2,145,145,
-  145,145,145,145,145,145,145,  2,  2,  2,  2,  2,  2,  2,163,163,
-  163,163,163,163,163,163,163,  2,163,163,163,163,163,163,163,163,
-  163,  2,  2,  2,163,163,163,163,  2,  2,  2,  2,  2,  2, 86,  2,
-    2,  2,  2,  2,  2,  2, 22, 22,  2,  2,  2,  2,  2,  2,  2,  2,
-    2,  2,  2,  2,  2, 22, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
-    2,  2,  2,  2,  2,  2, 63, 63, 63, 63, 63, 63, 63,  2, 63, 63,
-   63, 63, 63,  2,  2,  2, 63, 63, 63, 63,  2,  2,  2,  2,157,157,
-  157,157,157,157,157,157,157,157,157,  2,  2,  2,  2,  2, 80, 80,
-   80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,  2,  2,127,127,
-  127,127,127,127,127,127,127,127,127,127,127,127,127,  2, 79,  2,
+  102,102,102,102,102,102,102,102,  2,  2,  2,  2,  2,  2, 33, 33,
+   33, 33,  2,  2,  2,  2,126,126,126,126,126,126,126,126,126,126,
+  126,  2,  2,126,126,126,126,126,126,126,  2,  2,  2,  2,126,126,
+  126,126,126,126,126,  2,142,142,142,142,142,142,142,142,142,142,
+  142,142,  2,  2,  2,  2,125,125,125,125,125,125,125,125,125,125,
+  125,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,125,154,154,
+  154,154,154,154,154,  2,  2,154,  2,  2,154,154,154,154,154,154,
+  154,154,  2,154,154,  2,154,154,154,154,154,154,154,154,154,154,
+  154,154,154,154,  2,154,154,  2,  2,154,154,154,154,154,154,154,
+    2,  2,  2,  2,  2,  2,150,150,150,150,150,150,150,150,  2,  2,
+  150,150,150,150,150,150,150,150,150,150,150,  2,  2,  2,141,141,
+  141,141,141,141,141,141,140,140,140,140,140,140,140,140,140,140,
+  140,  2,  2,  2,  2,  2,121,121,121,121,121,121,121,121,121,  2,
+    2,  2,  2,  2,  2,  2,  7,  7,  2,  2,  2,  2,  2,  2,169,169,
+  169,169,169,169,169,169,169,169,  2,  2,  2,  2,  2,  2,133,133,
+  133,133,133,133,133,133,133,  2,133,133,133,133,133,133,133,133,
+  133,133,133,133,133,  2,133,133,133,133,133,133,  2,  2,133,133,
+  133,133,133,  2,  2,  2,134,134,134,134,134,134,134,134,  2,  2,
+  134,134,134,134,134,134,  2,134,134,134,134,134,134,134,134,134,
+  134,134,134,134,134,  2,138,138,138,138,138,138,138,  2,138,138,
+    2,138,138,138,138,138,138,138,138,138,138,138,138,138,  2,  2,
+  138,  2,138,138,  2,138,138,138,  2,  2,  2,  2,  2,  2,143,143,
+  143,143,143,143,  2,143,143,  2,143,143,143,143,143,143,143,143,
+  143,143,143,143,143,143,143,143,143,143,143,143,143,  2,143,143,
+    2,143,143,143,143,143,143,  2,  2,  2,  2,  2,  2,  2,143,143,
+    2,  2,  2,  2,  2,  2,145,145,145,145,145,145,145,145,145,  2,
+    2,  2,  2,  2,  2,  2,163,163,163,163,163,163,163,163,163,  2,
+  163,163,163,163,163,163,163,163,163,  2,  2,  2,163,163,163,163,
+  163,  2,  2,  2,  2,  2, 86,  2,  2,  2,  2,  2,  2,  2, 22, 22,
+    2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2, 22, 63, 63,
+   63, 63, 63, 63, 63, 63, 63, 63,  2,  2,  2,  2,  2,  2, 63, 63,
+   63, 63, 63, 63, 63,  2, 63, 63, 63, 63, 63,  2,  2,  2, 63, 63,
+   63, 63,  2,  2,  2,  2,157,157,157,157,157,157,157,157,157,157,
+  157,  2,  2,  2,  2,  2, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,
+   80, 80, 80, 80,  2,  2, 80, 80, 80,  2,  2,  2,  2,  2,127,127,
+  127,127,127,127,127,127,127,127,127,127,127,127,127,  2,166,166,
+  166,166,166,166,166,166,166,166,  2,  2,  2,  2,  2,  2, 79,  2,
     2,  2,  2,  2,  2,  2,115,115,115,115,115,115,115,115,115,115,
   115,115,115,115,115,  2,115,115,  2,  2,  2,  2,115,115,159,159,
   159,159,159,159,159,159,159,159,159,159,159,159,159,  2,159,159,
     2,  2,  2,  2,  2,  2,103,103,103,103,103,103,103,103,103,103,
   103,103,103,103,  2,  2,119,119,119,119,119,119,119,119,119,119,
   119,119,119,119,  2,  2,119,119,  2,119,119,119,119,119,  2,  2,
-    2,  2,  2,119,119,119,146,146,146,146,146,146,146,146,146,146,
+    2,  2,  2,119,119,119,167,167,167,167,167,167,167,167,167,167,
+    2,  2,  2,  2,  2,  2,146,146,146,146,146,146,146,146,146,146,
   146,  2,  2,  2,  2,  2, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
    99,  2,  2,  2,  2, 99,  2,  2,  2,  2,  2,  2,  2, 99,136,139,
    13, 13,155,  2,  2,  2,136,136,136,136,136,136,136,136,155,155,
-  155,155,155,155,155,155,155,155,155,155,155,155,  2,  2,136,  2,
-    2,  2,  2,  2,  2,  2, 17, 17, 17, 17,  2, 17, 17, 17, 17, 17,
-   17, 17,  2, 17, 17,  2, 17, 15, 15, 15, 15, 15, 15, 15, 17, 17,
-   17,  2,  2,  2,  2,  2,  2,  2, 15,  2,  2,  2,  2,  2, 15, 15,
-   15,  2,  2, 17,  2,  2,  2,  2,  2,  2, 17, 17, 17, 17,139,139,
-  139,139,139,139,139,139,139,139,139,139,  2,  2,  2,  2,105,105,
-  105,105,105,105,105,105,105,105,105,  2,  2,  2,  2,  2,105,105,
-  105,105,105,  2,  2,  2,105,  2,  2,  2,  2,  2,  2,  2,105,105,
-    2,  2,105,105,105,105,  1,  1,  1,  1,  1,  1,  2,  2,  0,  0,
-    0,  0,  0,  0,  0,  1,  1,  1,  0,  0,  0,  0,  0,  0,  0,  0,
-    0,  1,  1,  1,  1,  1,  1,  1,  1,  0,  0,  1,  1,  1,  1,  1,
-    1,  1,  0,  0,  0,  0,  0,  0,  1,  1,  1,  1,  0,  0,  2,  2,
-    0,  2,  2,  0,  0,  2,  2,  0,  0,  0,  0,  2,  0,  0,  0,  0,
-    2,  0,  2,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  0,  0,
-    0,  2,  2,  0,  0,  0,  0,  0,  2,  0,  0,  0,  0,  2,  0,  0,
-    0,  0,  0,  2,  0,  2,  2,  2,  0,  0,  0,  0,  0,  0,  0,  2,
-    0,  0,  0,  0,  0,  0,131,131,131,131,131,131,131,131,131,131,
-  131,131,  2,  2,  2,  2,  2,  2,  2,131,131,131,131,131,  2,131,
-  131,131,131,131,131,131,  2,  2,  2,  2,  2, 19, 19, 19, 56, 56,
-   56, 56, 56, 56, 56,  2, 56,  2,  2, 56, 56, 56, 56, 56, 56, 56,
-    2, 56, 56,  2, 56, 56, 56, 56, 56,  2,  2,  2,  2,  2,  6,  6,
-    6,  6,  6,  6,  2,  2,  2,  2,  2,  2,  2,  2,  2,  6,151,151,
-  151,151,151,151,151,151,151,151,151,151,151,  2,  2,  2,151,151,
-  151,151,151,151,  2,  2,151,151,  2,  2,  2,  2,151,151,160,160,
-  160,160,160,160,160,160,160,160,160,160,160,160,160,  2,152,152,
-  152,152,152,152,152,152,152,152,  2,  2,  2,  2,  2,152,164,164,
-  164,164,164,164,164,164,164,164,  2,  2,  2,  2,  2,  2, 30, 30,
-   30, 30,  2, 30, 30,  2,113,113,113,113,113,113,113,113,113,113,
-  113,113,113,  2,  2,113,113,113,113,113,113,113,113,  2,132,132,
-  132,132,132,132,132,132,132,132,132,132,  2,  2,  2,  2,132,132,
-    2,  2,  2,  2,132,132,  3,  3,  3,  3,  2,  3,  3,  3,  2,  3,
-    3,  2,  3,  2,  2,  3,  2,  3,  3,  3,  3,  3,  3,  3,  3,  3,
-    3,  2,  3,  3,  3,  3,  2,  3,  2,  3,  2,  2,  2,  2,  2,  2,
-    3,  2,  2,  2,  2,  3,  2,  3,  2,  3,  2,  3,  3,  3,  2,  3,
-    2,  3,  2,  3,  2,  3,  2,  3,  3,  3,  3,  2,  3,  2,  3,  3,
-    2,  3,  3,  3,  3,  3,  3,  3,  3,  3,  2,  2,  2,  2,  2,  3,
-    3,  3,  2,  3,  3,  3,  2,  2,  2,  2,  2,  2,  0,  0, 15,  0,
+  155,155,155,155,155,155,155,155,155,155,155,155,  2,  2,  2,  2,
+    2,  2,  2,  2,  2,155,136,  2,  2,  2,  2,  2,  2,  2, 17, 17,
+   17, 17,  2, 17, 17, 17, 17, 17, 17, 17,  2, 17, 17,  2, 17, 15,
+   15, 15, 15, 15, 15, 15, 17, 17, 17,  2,  2,  2,  2,  2,  2,  2,
+   15,  2,  2,  2,  2,  2, 15, 15, 15,  2,  2, 17,  2,  2,  2,  2,
+    2,  2, 17, 17, 17, 17,139,139,139,139,139,139,139,139,139,139,
+  139,139,  2,  2,  2,  2,105,105,105,105,105,105,105,105,105,105,
+  105,  2,  2,  2,  2,  2,105,105,105,105,105,  2,  2,  2,105,  2,
+    2,  2,  2,  2,  2,  2,105,105,  2,  2,105,105,105,105,  1,  1,
+    1,  1,  1,  1,  2,  2,  0,  0,  0,  0,  0,  0,  0,  1,  1,  1,
+    0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  1,  1,  1,  1,  1,  1,
+    1,  0,  0,  1,  1,  1,  1,  1,  1,  1,  0,  0,  0,  0,  0,  0,
+    1,  1,  1,  1,  0,  0,  2,  2,  0,  2,  2,  0,  0,  2,  2,  0,
+    0,  0,  0,  2,  0,  0,  0,  0,  2,  0,  2,  0,  0,  0,  0,  0,
+    0,  0,  2,  0,  0,  0,  0,  0,  0,  2,  2,  0,  0,  0,  0,  0,
+    2,  0,  0,  0,  0,  2,  0,  0,  0,  0,  0,  2,  0,  2,  2,  2,
+    0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  0,  0,  0,131,131,
+  131,131,131,131,131,131,131,131,131,131,  2,  2,  2,  2,  2,  2,
+    2,131,131,131,131,131,  2,131,131,131,131,131,131,131,  2,  2,
+    2,  2,  2, 19, 19, 19, 56, 56, 56, 56, 56, 56, 56,  2, 56,  2,
+    2, 56, 56, 56, 56, 56, 56, 56,  2, 56, 56,  2, 56, 56, 56, 56,
+   56,  2,  2,  2,  2,  2,  6,  6,  6,  6,  6,  6,  2,  2,  2,  2,
+    2,  2,  2,  2,  2,  6,151,151,151,151,151,151,151,151,151,151,
+  151,151,151,  2,  2,  2,151,151,151,151,151,151,  2,  2,151,151,
+    2,  2,  2,  2,151,151,160,160,160,160,160,160,160,160,160,160,
+  160,160,160,160,160,  2,152,152,152,152,152,152,152,152,152,152,
+    2,  2,  2,  2,  2,152,164,164,164,164,164,164,164,164,164,164,
+    2,  2,  2,  2,  2,  2,168,168,168,168,168,168,168,168,168,168,
+  168,  2,  2,  2,  2,168, 30, 30, 30, 30,  2, 30, 30,  2,113,113,
+  113,113,113,113,113,113,113,113,113,113,113,  2,  2,113,113,113,
+  113,113,113,113,113,  2,132,132,132,132,132,132,132,132,132,132,
+  132,132,  2,  2,  2,  2,132,132,  2,  2,  2,  2,132,132,  3,  3,
+    3,  3,  2,  3,  3,  3,  2,  3,  3,  2,  3,  2,  2,  3,  2,  3,
+    3,  3,  3,  3,  3,  3,  3,  3,  3,  2,  3,  3,  3,  3,  2,  3,
+    2,  3,  2,  2,  2,  2,  2,  2,  3,  2,  2,  2,  2,  3,  2,  3,
+    2,  3,  2,  3,  3,  3,  2,  3,  2,  3,  2,  3,  2,  3,  2,  3,
+    3,  3,  3,  2,  3,  2,  3,  3,  2,  3,  3,  3,  3,  3,  3,  3,
+    3,  3,  2,  2,  2,  2,  2,  3,  3,  3,  2,  3,  3,  3,  3,  3,
+    2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  0,  0, 15,  0,
     0,  2,  2,  2,  2,  2,  2,  2,  2,  2,  0,  0,  0,  0,  2,  2,
-    2,  0,  0,  0,  0,  0, 13,  2,  2,  2,  2,  2,  2,  2, 13, 13,
+    2,  0,  0,  0,  0,  0,  0,  0,  2,  2,  2,  2,  2,  0,  0,  0,
+    0,  0,  0,  2,  2,  0, 13,  2,  2,  2,  2,  2,  2,  2, 13, 13,
    13,  2,  2,  2,  2,  2,  2,  0,  2,  2,  2,  2,  2,  2,  0,  1,
     2,  3,  4,  5,  6,  7,  8,  9,  9,  9,  9, 10,  9, 11, 12, 13,
     9,  9,  9, 14,  9,  9, 15,  9,  9,  9,  9,  9,  9,  9,  9,  9,
@@ -2123,13 +2113,14 @@ _hb_ucd_u8[17884] =
     9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
     9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
     9,  9,  9,  9,  9,  9,  9,  9,  9,  9, 16, 17,  9,  9,  9,  9,
-    9,  9,  9,  9,  9,  9, 18, 19, 20,  9, 21,  9,  9,  9,  9,  9,
-    9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
+   18,  9,  9,  9,  9,  9, 19, 20, 21,  9, 22,  9,  9,  9,  9,  9,
     9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
+    9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9, 23,  9,
+    9,  9,  9,  9, 24,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
     9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
     9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
+    9,  9,  9,  9,  9,  9, 25,  9,  9,  9,  9,  9,  9,  9,  9,  9,
     9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
-    9,  9,  9,  9,  9,  9, 22,  9,  9,  9,  9,  9,  9,  9,  9,  9,
     9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
     9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
     9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
@@ -2137,8 +2128,7 @@ _hb_ucd_u8[17884] =
     9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
     9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
     9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
-    9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
-    9,  9,  9,  9,  9,  9,  9,  9,  9,  9, 23, 24,  0,  0,  0,  0,
+    9,  9,  9,  9,  9,  9,  9,  9,  9,  9, 26, 27,  0,  0,  0,  0,
     0,  0,  0,  0,  0,  0,  0,  0,  1,  2,  3,  4,  5,  6,  7,  8,
     9, 10, 11, 12,  0,  0, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
@@ -2175,23 +2165,29 @@ _hb_ucd_u8[17884] =
   132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,
   148,149,150,151,152,153,154,155,156,157,  0,  0,  0,158,159,160,
   161,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-    0,  0,  0,  0,  0,162,163,  0,  0,  0,  0,  0,  0,  0,164,  0,
     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+    0,  0,  0,  0,  0,  0,  0,  0,162,  0,163,  0,  0,  0,  0,  0,
+    0,  0,  0,  0,  0,164,165,  0,  0,  0,  0,  0,  0,  0,166,  0,
+    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+  167,  0,  0,  0,168,169,  0,  0,170,  0,  0,  0,  0,  0,  0,  0,
+    0,  0,  0,  0,  0,  0,  0,171,  0,  0,  0,  0,  0,  0,  0,  0,
+    0,  0,  0,  0,  0,  0,  0,172,  0,  0,  0,  0,  0,  0,  0,  0,
+    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,173,
+    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,174,  0,
     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  165,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-    0,  0,  0,  0,  0,  0,  0,166,  0,  0,  0,  0,  0,  0,  0,  0,
-    0,  0,  0,  0,  0,  0,  0,167,  0,  0,  0,  0,  0,  0,  0,  0,
-    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,168,
     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+    0,  0,175,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-    0,169,170,  0,  0,  0,  0,171,172,  0,  0,  0,173,174,175,176,
-  177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,
-  193,194,195,196,197,198,199,200,201,202,203,204,205,206,  0,  0,
+    0,176,177,  0,  0,  0,  0,178,179,  0,  0,  0,180,181,182,183,
+  184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,
+  200,201,202,203,204,205,206,207,208,209,210,211,212,213,  0,  0,
     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
     0,  0,  0,  0,  0,  0,  0,  0,  1,  2,  3,  4,
 };
 static const uint16_t
-_hb_ucd_u16[9344] =
+_hb_ucd_u16[10400] =
 {
      0,   0,   1,   2,   3,   4,   5,   6,   0,   0,   7,   8,   9,  10,  11,  12,
     13,  13,  13,  14,  15,  13,  13,  16,  17,  18,  19,  20,  21,  22,  13,  23,
@@ -2210,9 +2206,10 @@ _hb_ucd_u16[9344] =
    136,  48,  48, 137, 138, 139, 140, 140, 141,  48, 142, 143, 144, 145, 140, 140,
    146, 147, 148, 149, 150,  48, 151, 152, 153, 154,  32, 155, 156, 157, 140, 140,
     48,  48, 158, 159, 160, 161, 162, 163, 164, 165,   9,   9, 166,  11,  11, 167,
-    48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48, 168, 169,  48,  48,
-   168,  48,  48, 170, 171, 172,  48,  48,  48, 171,  48,  48,  48, 173, 174, 175,
-    48, 176,   9,   9,   9,   9,   9, 177, 178,  48,  48,  48,  48,  48,  48,  48,
+    48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,
+    48,  48,  48,  48, 168, 169,  48,  48, 168,  48,  48, 170, 171, 172,  48,  48,
+    48, 171,  48,  48,  48, 173, 174, 175,  48, 176,   9,   9,   9,   9,   9, 177,
+   178,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,
     48,  48,  48,  48,  48,  48, 179,  48, 180, 181,  48,  48,  48,  48, 182, 183,
     48, 184,  48, 185,  48, 186, 187, 188,  48,  48,  48, 189, 190, 191, 192, 193,
    194, 192,  48,  48, 195,  48,  48, 196, 197,  48, 198,  48,  48,  48,  48, 199,
@@ -2225,28 +2222,34 @@ _hb_ucd_u16[9344] =
    241, 242, 241, 241, 242, 243, 241, 244, 245, 245, 245, 246, 247, 248, 249, 250,
    251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 261, 262, 263, 264, 265,
    266, 267, 268, 269, 270, 271, 272, 272, 273, 274, 275, 209, 276, 277, 209, 278,
-   279, 279, 279, 279, 279, 279, 279, 279, 280, 209, 281, 209, 209, 209, 209, 282,
-   209, 283, 279, 284, 209, 285, 286, 209, 209, 209, 287, 140, 288, 140, 271, 271,
-   271, 289, 209, 209, 209, 209, 290, 271, 209, 209, 209, 209, 209, 209, 209, 209,
-   209, 209, 209, 291, 292, 209, 209, 293, 209, 209, 209, 209, 209, 209, 294, 209,
-   209, 209, 209, 209, 209, 209, 295, 296, 271, 297, 209, 209, 298, 279, 299, 279,
-   300, 301, 279, 279, 279, 302, 279, 303, 209, 209, 209, 279, 304, 209, 209, 305,
-   209, 306, 209, 209, 209, 209, 209, 209,   9,   9,   9,  11,  11,  11, 307, 308,
-    13,  13,  13,  13,  13,  13, 309, 310,  11,  11, 311,  48,  48,  48, 312, 313,
-    48, 314, 315, 315, 315, 315,  32,  32, 316, 317, 318, 319, 320, 321, 140, 140,
-   209, 322, 209, 209, 209, 209, 209, 323, 209, 209, 209, 209, 209, 324, 140, 209,
-   325, 326, 327, 328, 136,  48,  48,  48,  48, 329, 178,  48,  48,  48,  48, 330,
-   331,  48,  48, 136,  48,  48,  48,  48, 200, 332,  48,  48, 209, 209, 333,  48,
-   209, 334, 335, 209, 336, 337, 209, 209, 335, 209, 209, 337, 209, 209, 209, 209,
-    48,  48,  48,  48, 209, 209, 209, 209,  48, 338,  48,  48,  48,  48,  48,  48,
-   151, 209, 209, 209, 287,  48,  48, 229, 339,  48, 340, 140,  13,  13, 341, 342,
-    13, 343,  48,  48,  48,  48, 344, 345,  31, 346, 347, 348,  13,  13,  13, 349,
-   350, 351, 352, 353, 354, 355, 140, 356, 357,  48, 358, 359,  48,  48,  48, 360,
-   361,  48,  48, 362, 363, 192,  32, 364,  64,  48, 365,  48, 366, 367,  48, 151,
-    76,  48,  48, 368, 369, 370, 371, 372,  48,  48, 373, 374, 375, 376,  48, 377,
-    48,  48,  48, 378, 379, 380, 381, 382, 383, 384, 315,  11,  11, 385, 386,  11,
-    11,  11,  11,  11,  48,  48, 387, 192,  48,  48, 388,  48, 389,  48,  48, 206,
-   390, 390, 390, 390, 390, 390, 390, 390, 391, 391, 391, 391, 391, 391, 391, 391,
+   279, 279, 279, 279, 279, 279, 279, 279, 279, 279, 279, 279, 279, 279, 279, 279,
+   280, 209, 281, 209, 209, 209, 209, 282, 209, 283, 279, 284, 209, 285, 286, 209,
+   209, 209, 176, 140, 287, 140, 271, 271, 271, 288, 209, 209, 209, 209, 289, 271,
+   209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 290, 291, 209, 209, 292,
+   209, 209, 209, 209, 209, 209, 293, 209, 209, 209, 209, 209, 209, 209, 209, 209,
+   209, 209, 209, 209, 209, 209, 294, 295, 271, 296, 209, 209, 297, 279, 298, 279,
+   209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209,
+   279, 279, 279, 279, 279, 279, 279, 279, 299, 300, 279, 279, 279, 301, 279, 302,
+   209, 209, 209, 279, 303, 209, 209, 304, 209, 305, 209, 209, 209, 209, 209, 209,
+     9,   9,   9,  11,  11,  11, 306, 307,  13,  13,  13,  13,  13,  13, 308, 309,
+    11,  11, 310,  48,  48,  48, 311, 312,  48, 313, 314, 314, 314, 314,  32,  32,
+   315, 316, 317, 318, 319, 320, 140, 140, 209, 321, 209, 209, 209, 209, 209, 322,
+   209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 323, 140, 209,
+   324, 325, 326, 327, 136,  48,  48,  48,  48, 328, 178,  48,  48,  48,  48, 329,
+   330,  48,  48, 136,  48,  48,  48,  48, 200, 331,  48,  48, 209, 209, 332,  48,
+   209, 333, 334, 209, 335, 336, 209, 209, 334, 209, 209, 336, 209, 209, 209, 209,
+    48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48, 209, 209, 209, 209,
+    48, 337,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,
+    48,  48,  48,  48,  48,  48,  48,  48, 151, 209, 209, 209, 338,  48,  48, 229,
+   339,  48, 340, 140,  13,  13, 341, 342,  13, 343,  48,  48,  48,  48, 344, 345,
+    31, 346, 347, 348,  13,  13,  13, 349, 350, 351, 352, 353, 354, 355, 140, 356,
+   357,  48, 358, 359,  48,  48,  48, 360, 361,  48,  48, 362, 363, 192,  32, 364,
+    64,  48, 365,  48, 366, 367,  48, 151,  76,  48,  48, 368, 369, 370, 371, 372,
+    48,  48, 373, 374, 375, 376,  48, 377,  48,  48,  48, 378, 379, 380, 381, 382,
+   383, 384, 314,  11,  11, 385, 386,  11,  11,  11,  11,  11,  48,  48, 387, 192,
+    48,  48,  48,  48,  48,  48,  48,  48,  48,  48, 388,  48, 389,  48,  48, 206,
+   390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390,
+   391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391,
     48,  48,  48,  48,  48,  48, 204,  48,  48,  48,  48,  48,  48, 207, 140, 140,
    392, 393, 394, 395, 396,  48,  48,  48,  48,  48,  48, 397, 398, 399,  48,  48,
     48,  48,  48, 400, 209,  48,  48,  48,  48, 401,  48,  48, 402, 140, 140, 403,
@@ -2257,108 +2260,204 @@ _hb_ucd_u16[9344] =
    140, 140, 140, 140, 140, 140, 140, 140,  48, 151,  48,  48,  48, 100, 429, 430,
     48,  48, 431,  48, 432,  48,  48, 433,  48, 434,  48,  48, 435, 436, 140, 140,
      9,   9, 437,  11,  11,  48,  48,  48,  48, 204, 192,   9,   9, 438,  11, 439,
-    48,  48, 440,  48,  48,  48, 441, 442, 442, 443, 444, 445, 140, 140, 140, 140,
-    48,  48,  48, 314,  48, 199, 440, 140, 446,  27,  27, 447, 140, 140, 140, 140,
+    48,  48, 440,  48,  48,  48, 441, 442, 442, 443, 444, 445,  48,  48,  48, 388,
+    48,  48,  48, 313,  48, 199, 440, 140, 446,  27,  27, 447, 140, 140, 140, 140,
    448,  48,  48, 449,  48, 450,  48, 451,  48, 200, 452, 140, 140, 140,  48, 453,
     48, 454,  48, 455, 140, 140, 140, 140,  48,  48,  48, 456, 271, 457, 271, 271,
    458, 459,  48, 460, 461, 462,  48, 463,  48, 464, 140, 140, 465,  48, 466, 467,
     48,  48,  48, 468,  48, 469,  48, 470,  48, 471, 472, 140, 140, 140, 140, 140,
     48,  48,  48,  48, 196, 140, 140, 140,   9,   9,   9, 473,  11,  11,  11, 474,
-    48,  48, 475, 192, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 271, 476,
-    48,  48, 477, 478, 140, 140, 140, 479,  48, 464, 480,  48,  62, 481, 140,  48,
-   482, 140, 140,  48, 483, 140,  48, 314, 484,  48,  48, 485, 486, 457, 487, 488,
-   222,  48,  48, 489, 490,  48, 196, 192, 491,  48, 492, 493, 494,  48,  48, 495,
-   222,  48,  48, 496, 497, 498, 499, 500,  48,  97, 501, 502, 503, 140, 140, 140,
-   504, 505, 506,  48,  48, 507, 508, 192, 509,  83,  84, 510, 511, 512, 513, 514,
-    48,  48,  48, 515, 516, 517, 478, 140,  48,  48,  48, 518, 519, 192, 140, 140,
-    48,  48, 520, 521, 522, 523, 140, 140,  48,  48,  48, 524, 525, 192, 526, 140,
-    48,  48, 527, 528, 192, 140, 140, 140,  48, 173, 529, 530, 314, 140, 140, 140,
-    48,  48, 501, 531, 140, 140, 140, 140, 140, 140,   9,   9,  11,  11, 148, 532,
-   533, 534,  48, 535, 536, 192, 140, 140, 140, 140, 537,  48,  48, 538, 539, 140,
-   540,  48,  48, 541, 542, 543,  48,  48, 544, 545, 546,  48,  48,  48,  48, 196,
-   547, 140, 140, 140, 140, 140, 140, 140,  84,  48, 520, 548, 549, 148, 175, 550,
-    48, 551, 552, 553, 140, 140, 140, 140, 554,  48,  48, 555, 556, 192, 557,  48,
-   558, 559, 192, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,  48, 560,
-   561, 115,  48, 562, 563, 192, 140, 140, 140, 140, 140, 100, 271, 564, 565, 566,
-    48, 207, 140, 140, 140, 140, 140, 140, 272, 272, 272, 272, 272, 272, 567, 568,
-    48,  48,  48,  48, 388, 140, 140, 140, 140,  48,  48,  48,  48,  48,  48, 569,
-    48,  48,  48, 570, 571, 572, 140, 140,  48,  48,  48,  48, 314, 140, 140, 140,
-    48,  48,  48, 196,  48, 200, 370,  48,  48,  48,  48, 200, 192,  48, 204, 573,
-    48,  48,  48, 574, 575, 576, 577, 578,  48, 140, 140, 140, 140, 140, 140, 140,
-   140, 140, 140, 140,   9,   9,  11,  11, 271, 579, 140, 140, 140, 140, 140, 140,
-    48,  48,  48,  48, 580, 581, 582, 582, 583, 584, 140, 140, 140, 140, 585, 586,
-    48,  48,  48,  48,  48,  48,  48, 440,  48,  48,  48,  48,  48, 199, 140, 140,
-   196, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 587,
-    48,  48, 588, 589, 140, 590, 591,  48,  48,  48,  48,  48,  48,  48,  48, 206,
-    48,  48,  48,  48,  48,  48,  71, 151, 196, 592, 593, 140, 140, 140, 140, 140,
-    32,  32, 594,  32, 595, 209, 209, 209, 209, 209, 209, 209, 323, 140, 140, 140,
-   209, 209, 209, 209, 209, 209, 209, 324, 209, 209, 596, 209, 209, 209, 597, 598,
-   599, 209, 600, 209, 209, 209, 288, 140, 209, 209, 209, 209, 601, 140, 140, 140,
-   140, 140, 140, 140, 271, 602, 271, 602, 209, 209, 209, 209, 209, 287, 271, 461,
-     9, 603,  11, 604, 605, 606, 241,   9, 607, 608, 609, 610, 611,   9, 603,  11,
-   612, 613,  11, 614, 615, 616, 617,   9, 618,  11,   9, 603,  11, 604, 605,  11,
-   241,   9, 607, 617,   9, 618,  11,   9, 603,  11, 619,   9, 620, 621, 622, 623,
-    11, 624,   9, 625, 626, 627, 628,  11, 629,   9, 630,  11, 631, 632, 632, 632,
-    32,  32,  32, 633,  32,  32, 634, 635, 636, 637,  45, 140, 140, 140, 140, 140,
-   638, 639, 640, 140, 140, 140, 140, 140, 641, 642, 643,  27,  27,  27, 644, 140,
-   645, 140, 140, 140, 140, 140, 140, 140,  48,  48, 151, 646, 647, 140, 140, 140,
-   140,  48, 648, 140,  48,  48, 649, 650, 140, 140, 140, 140, 140,  48, 651, 192,
-   140, 140, 140, 140, 140, 140, 652, 200,  48,  48,  48,  48, 653, 595, 140, 140,
-     9,   9, 607,  11, 654, 370, 140, 140, 140, 140, 140, 140, 140, 140, 140, 499,
-   271, 271, 655, 656, 140, 140, 140, 140, 499, 271, 657, 658, 140, 140, 140, 140,
-   659,  48, 660, 661, 662, 663, 664, 665, 666, 206, 667, 206, 140, 140, 140, 668,
-   209, 209, 669, 209, 209, 209, 209, 209, 209, 323, 334, 670, 670, 670, 209, 324,
-   671, 209, 209, 209, 209, 209, 209, 209, 209, 209, 672, 140, 140, 140, 673, 209,
-   674, 209, 209, 669, 675, 676, 324, 140, 209, 209, 209, 209, 209, 209, 209, 677,
-   209, 209, 209, 209, 209, 678, 426, 426, 209, 209, 209, 209, 209, 209, 209, 679,
-   209, 209, 209, 209, 209, 176, 669, 427, 669, 209, 209, 209, 680, 176, 209, 209,
-   680, 209, 672, 676, 140, 140, 140, 140, 209, 209, 209, 209, 209, 323, 672, 426,
-   675, 209, 209, 681, 682, 669, 675, 675, 209, 683, 209, 209, 288, 140, 140, 192,
-    48,  48,  48,  48,  48,  48, 140, 140,  48,  48,  48, 207,  48,  48,  48,  48,
-    48, 204,  48,  48,  48,  48,  48,  48,  48,  48, 478,  48,  48,  48,  48,  48,
-    48,  48,  48,  48,  48,  48, 100,  48,  48,  48,  48,  48,  48, 204, 140, 140,
-    48, 204, 140, 140, 140, 140, 140, 140,  48,  48,  48,  48,  71,  48,  48,  48,
-    48,  48,  48, 140, 140, 140, 140, 140, 684, 140, 570, 570, 570, 570, 570, 570,
+    48,  48, 475, 192, 476,   9, 477,  11, 478, 140, 140, 140, 140, 140, 140, 140,
+   140, 140, 140, 140, 140, 140, 271, 479,  48,  48, 480, 481, 482, 140, 140, 483,
+    48, 464, 484,  48,  62, 485, 140,  48, 486, 140, 140,  48, 487, 140,  48, 313,
+   488,  48,  48, 489, 490, 457, 491, 492, 222,  48,  48, 493, 494,  48, 196, 192,
+   495,  48, 496, 497, 498,  48,  48, 499, 222,  48,  48, 500, 501, 502, 503, 504,
+    48,  97, 505, 506, 507, 140, 140, 140, 508, 509, 510,  48,  48, 511, 512, 192,
+   513,  83,  84, 514, 515, 516, 517, 518, 519,  48,  48, 520, 521, 522, 523, 140,
+    48,  48,  48, 524, 525, 526, 481, 140,  48,  48,  48, 527, 528, 192, 140, 140,
+   140, 140, 140, 140, 140, 140, 140, 140,  48,  48, 529, 530, 531, 532, 140, 140,
+    48,  48,  48, 533, 534, 192, 535, 140,  48,  48, 536, 537, 192, 538, 539, 140,
+    48, 540, 541, 542, 313, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
+    48,  48, 505, 543, 140, 140, 140, 140, 140, 140,   9,   9,  11,  11, 148, 544,
+   545, 546,  48, 547, 548, 192, 140, 140, 140, 140, 549,  48,  48, 550, 551, 140,
+   552,  48,  48, 553, 554, 555,  48,  48, 556, 557, 558,  48,  48,  48,  48, 196,
+   559, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,  48,  48, 560, 192,
+    84,  48, 529, 561, 562, 148, 175, 563,  48, 564, 565, 566, 140, 140, 140, 140,
+   567,  48,  48, 568, 569, 192, 570,  48, 571, 572, 192, 140, 140, 140, 140, 140,
+   140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,  48, 573,
+   574, 115,  48, 575, 576, 577, 140, 140, 140, 140, 140, 100, 271, 578, 579, 580,
+    48,  48,  48,  48,  48,  48,  48,  48,  48, 207, 140, 140, 140, 140, 140, 140,
+   272, 272, 272, 272, 272, 272, 581, 582,  48,  48,  48,  48,  48,  48,  48,  48,
+    48,  48,  48,  48, 388, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
+   140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
+   140, 140, 140, 140, 140, 140, 140, 140, 140,  48,  48,  48,  48,  48,  48, 583,
+    48,  48,  48, 584, 585, 586,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,
+    48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  71,
+    48,  48,  48,  48, 313, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
+    48, 587, 588, 192, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
+    48,  48,  48, 196,  48, 200, 370,  48,  48,  48,  48, 200, 192,  48, 204, 589,
+    48,  48,  48, 590, 591, 592, 593, 594,  48, 140, 140, 140, 140, 140, 140, 140,
+   140, 140, 140, 140, 595,  48, 596, 192, 140, 140, 140, 140, 140, 140, 140, 140,
+   140, 140, 140, 140,   9,   9,  11,  11, 271, 597, 140, 140, 140, 140, 140, 140,
+    48,  48,  48,  48, 598, 599, 600, 600, 601, 602, 140, 140, 140, 140, 603, 604,
+    48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48, 440,
+    48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48, 199, 140, 605,
+   196, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
+   140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 606,
+    48,  48, 607, 608, 140, 609, 610,  48,  48,  48,  48,  48,  48,  48,  48,  48,
+    48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48, 206,
+    48,  48,  48,  48,  48,  48,  71, 151, 196, 611, 612, 140, 140, 140, 140, 140,
+   209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 192,
+   209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 322, 140, 140, 140, 140,
+    32,  32, 613,  32, 614, 209, 209, 209, 209, 209, 209, 209, 322, 140, 140, 140,
+   209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 323,
+   209, 209, 615, 209, 209, 209, 616, 617, 618, 209, 619, 209, 209, 209, 287, 140,
+   209, 209, 209, 209, 620, 140, 140, 140, 140, 140, 140, 140, 271, 621, 271, 621,
+   209, 209, 209, 209, 209, 338, 271, 461, 140, 140, 140, 140, 140, 140, 140, 140,
+     9, 622,  11, 623, 624, 625, 241,   9, 626, 627, 628, 629, 630,   9, 622,  11,
+   631, 632,  11, 633, 634, 635, 636,   9, 637,  11,   9, 622,  11, 623, 624,  11,
+   241,   9, 626, 636,   9, 637,  11,   9, 622,  11, 638,   9, 639, 640, 641, 642,
+    11, 643,   9, 644, 645, 646, 647,  11, 648,   9, 649,  11, 650, 538, 538, 538,
+    32,  32,  32, 651,  32,  32, 652, 653, 654, 655,  45, 140, 140, 140, 140, 140,
+   656, 657, 658, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
+   659, 660, 661,  27,  27,  27, 662, 140, 663, 140, 140, 140, 140, 140, 140, 140,
+    48,  48, 151, 664, 665, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
+   140, 140, 140, 140, 140, 140, 140, 140, 140,  48, 666, 140,  48,  48, 667, 668,
+   140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,  48, 669, 192,
+   140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,  48, 587, 670,
+   140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 671, 200,
+    48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48, 672, 614, 140, 140,
+     9,   9, 626,  11, 673, 370, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
+   140, 140, 140, 140, 140, 140, 140, 503, 271, 271, 674, 675, 140, 140, 140, 140,
+   503, 271, 676, 677, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
+   678,  48, 679, 680, 681, 682, 683, 684, 685, 206, 686, 206, 140, 140, 140, 687,
+   209, 209, 688, 209, 209, 209, 209, 209, 209, 322, 333, 689, 689, 689, 209, 323,
+   690, 209, 209, 209, 209, 209, 209, 209, 209, 209, 691, 140, 140, 140, 692, 209,
+   693, 209, 209, 688, 694, 695, 323, 140, 140, 140, 140, 140, 140, 140, 140, 140,
+   209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 696,
+   209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 697, 426, 426,
+   209, 209, 209, 209, 209, 209, 209, 698, 209, 209, 209, 209, 209, 176, 688, 427,
+   688, 209, 209, 209, 699, 176, 209, 209, 699, 209, 691, 688, 695, 140, 140, 140,
+   209, 209, 209, 209, 209, 322, 691, 426, 700, 209, 209, 209, 701, 702, 176, 694,
+   209, 209, 209, 209, 209, 209, 209, 209, 209, 703, 209, 209, 209, 209, 209, 192,
+    48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48, 140, 140,
+    48,  48,  48, 207,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,
+    48, 204,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,
+    48,  48,  48,  48,  48,  48,  48,  48,  48,  48, 481,  48,  48,  48,  48,  48,
+    48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48, 100,  48,
+    48,  48,  48,  48,  48, 204, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
+    48, 204, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
+    48,  48,  48,  48,  71,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,
+    48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48, 140, 140, 140, 140, 140,
+   704, 140, 584, 584, 584, 584, 584, 584, 140, 140, 140, 140, 140, 140, 140, 140,
     32,  32,  32,  32,  32,  32,  32,  32,  32,  32,  32,  32,  32,  32,  32, 140,
-   391, 391, 391, 391, 391, 391, 391, 685, 391, 391, 391, 391, 391, 391, 391, 686,
+   391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 705,
+   391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 706,
+     0,   1,   2,   3,   4,   4,   4,   4,   4,   4,   5,   6,   7,   8,   9,  10,
+    11,  11,  12,  11,  13,  14,  15,  16,  17,  18,  19,  20,  21,  22,  23,  24,
+    25,  26,  27,  28,  29,  30,  31,  32,  33,  34,  35,  36,  37,  38,  39,  40,
+    41,  42,  43,  44,  45,  46,  47,  48,  49,  50,  51,  52,  53,  54,  55,  56,
+    57,  57,  58,  59,  60,  60,  60,  60,  61,  62,  63,  64,  65,  66,  67,  68,
+    69,  69,  69,  69,  69,  69,  69,  69,  69,  69,  70,  71,  72,  73,  74,  75,
+    76,  77,  78,  79,  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,  91,
+    92,  93,  94,  95,  96,  97,  98,   7,   4,   4,   4,   4,  99, 100, 101, 102,
+   103, 104, 105, 106, 107, 108, 109,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+   110, 111,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+   112, 112, 112, 112,   0,   0,   0,   0,   0,   0,   0,   0,   0, 113, 114,   0,
+   115, 116, 117, 118, 119, 120, 121, 122,   0, 123, 124, 125, 126, 126, 126, 127,
+   128, 129, 130, 131, 132,  60, 133, 134, 135, 136,   0, 137, 138, 139,   0,   0,
+   126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
+   126, 126, 126, 126, 126, 126, 126,   0, 126, 126, 126, 126, 126, 126, 126, 126,
+   140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
+   140, 140, 141, 142, 143, 143, 143, 143, 144,  11, 145, 146, 147,   4, 148, 149,
+   150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165,
+    60,  60,  60,  60,  60,  60,  60,  60,  60,  60,  60,  60,  60,  60,  60,  60,
+    60,  60,  60,  60,  60,  60,  60,  60,  60,  60,  60,  60,  60,  60, 166, 167,
+   168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168,
+   168, 168, 168, 168, 126, 126, 126, 126, 126, 169, 126, 170, 171, 172,  19, 173,
+    19,  19,  19,  19, 174,  19, 175, 176, 177, 178,  19, 179, 180, 181, 182, 183,
+   184, 185, 186, 187, 188, 189, 190, 191, 168, 168, 192, 193, 194, 195, 196, 197,
+   198, 199, 200, 201, 202, 203, 204, 205, 206, 206, 206, 206, 207, 208, 209, 168,
+   210, 211, 212, 213, 214, 168, 215, 216, 217, 218, 219, 220, 221, 222, 223, 168,
+   224, 225, 226, 227, 228, 229, 230, 168, 168, 231, 232, 233, 234, 235, 236, 237,
+   238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253,
+   254, 255, 256, 257, 168, 168, 258, 259, 260, 261, 262, 263, 264, 265, 168, 168,
+   266, 168, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 168, 168, 278,
+   279, 280, 281, 168, 282, 283, 284, 168, 168, 168, 168, 285, 286, 287, 288, 289,
+   290, 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, 291, 168,
+   290, 292, 290, 290, 290, 293, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168,
+   168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 294, 295,
+   296, 296, 296, 296, 296, 296, 296, 296, 296, 296, 296, 296, 296, 296, 296, 296,
+   296, 297, 296, 296, 296, 296, 296, 296, 296, 296, 296, 296, 296, 296, 296, 296,
+   296, 296, 296, 296, 296, 296, 296, 296, 296, 296, 296, 296, 296, 296, 296, 298,
+   299, 299, 299, 299, 299, 299, 299, 299, 299, 300, 168, 168, 168, 168, 168, 168,
+   168, 168, 168, 168, 301, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168,
+   302, 302, 302, 302, 302, 302, 302, 302, 303, 304, 305, 306, 307, 308, 309, 168,
+   168, 168, 168, 168, 168, 310, 168, 168, 168, 311, 312, 168, 313, 314, 315, 316,
+   317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317,
+   317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 318,
+   317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 317, 319, 319, 319, 319,
+   319, 319, 319, 320, 321, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168,
+   168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 322,
+   323, 324, 324, 324, 325, 326, 327, 327, 327, 327, 327, 328, 168, 168, 168, 168,
+   329, 330, 331, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168,
+     0,   0,   0, 332,   0,   0,   0,   0,   0,   0, 333, 168, 334, 335,   0, 336,
+     0,   0,   0, 337, 338, 339, 340, 341, 189, 342, 168, 343,   0, 344, 168, 168,
+     0, 345, 346, 347, 348, 349,   0,   0,   0,   0, 350,   0,   0,   0,   0, 351,
+   352, 352, 352, 352, 352, 352, 352, 352, 352, 352, 353, 168, 168, 168, 168, 168,
+   168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168, 354, 168, 168, 168,
+   355, 356, 357, 168, 358, 359, 168, 168, 168, 168, 360, 361, 168, 168, 168, 168,
+   168, 168, 168, 362, 168, 168, 168, 363, 168, 168, 168, 168, 168, 168, 168, 364,
+   365, 365, 365, 366, 367, 368, 168, 168, 168, 168, 168, 168, 168, 168, 168, 168,
+   168, 369, 370, 168, 371, 168, 168, 168, 372, 373, 374, 375, 168, 168, 168, 168,
+   376,   0, 377, 378,   0,   0, 379, 380, 381, 382, 168, 168,   0,   0,   0,   0,
+     0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 383,   0, 384,   0, 385,
+   386, 387, 388, 389,   0,   0,   0,   0,   0, 390, 391, 392,   0,   0, 393, 332,
+   126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 394, 126, 126, 126, 126,
+   126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 395, 126, 126, 126,
+   396, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126,
+   126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 397, 126, 126, 126, 126, 126,
+   126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 398,
+   126, 126, 126, 126, 126, 126, 126, 126, 126, 399, 168, 168, 168, 168, 168, 168,
+   126, 126, 126, 126, 126, 126, 126, 126, 399, 168, 168, 168, 168, 168, 168, 168,
+   126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 400, 126, 126,
+   126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 126, 401, 168,
+   402,   0, 168, 168,   7,   7,   7, 403,   0,   1,   2,   3,   4,   4,   4,   4,
      0,   0,   0,   0,   0,   0,   0,   0,   1,   2,   2,   3,   1,   2,   2,   3,
      0,   0,   0,   0,   0,   4,   0,   4,   2,   2,   5,   2,   2,   2,   5,   2,
-     2,   2,   2,   2,   2,   2,   2,   2,   2,   2,   2,   2,   2,   2,   2,   2,
-     2,   2,   2,   2,   2,   2,   2,   6,   0,   0,   0,   0,   7,   8,   0,   0,
-     9,   9,   9,   9,   9,   9,   9,   9,   9,   9,   9,   9,   9,   9,  10,  11,
-    12,  13,  14,  14,  15,  14,  14,  14,  14,  14,  14,  14,  16,  17,  14,  14,
-    18,  18,  18,  18,  18,  18,  18,  18,  18,  18,  18,  18,  18,  18,  18,  18,
-    19,  18,  18,  18,  18,  18,  18,  18,  18,  18,  18,  18,  18,  18,  18,  18,
-    18,  18,  18,  18,  18,  18,  20,  21,  21,  21,  22,  20,  21,  21,  21,  21,
-    21,  23,  24,  25,  25,  25,  25,  25,  25,  26,  25,  25,  25,  27,  28,  26,
-    29,  30,  31,  32,  31,  31,  31,  31,  33,  34,  35,  31,  31,  31,  36,  31,
-    31,  31,  31,  31,  31,  31,  31,  31,  31,  31,  31,  29,  31,  31,  31,  31,
-    37,  38,  37,  37,  37,  37,  37,  37,  37,  39,  31,  31,  31,  31,  31,  31,
-    40,  40,  40,  40,  40,  40,  41,  26,  42,  42,  42,  42,  42,  42,  42,  43,
-    44,  44,  44,  44,  44,  45,  44,  46,  47,  47,  47,  48,  37,  49,  31,  31,
-    31,  50,  51,  31,  31,  31,  31,  31,  31,  31,  31,  31,  52,  31,  31,  31,
-    53,  53,  53,  53,  53,  53,  53,  53,  53,  53,  54,  53,  55,  53,  53,  53,
-    56,  57,  58,  59,  59,  60,  61,  62,  57,  63,  64,  65,  66,  59,  59,  67,
-    68,  69,  70,  71,  71,  72,  73,  74,  69,  75,  76,  77,  78,  71,  79,  26,
-    80,  81,  82,  83,  83,  84,  85,  86,  81,  87,  88,  26,  89,  83,  90,  91,
-    92,  93,  94,  95,  95,  96,  97,  98,  93,  99, 100, 101, 102,  95,  95,  26,
-   103, 104, 105, 106, 107, 104, 108, 109, 104, 105, 110,  26, 111, 108, 108, 112,
-   113, 114, 115, 113, 113, 115, 113, 116, 114, 117, 118, 119, 120, 113, 121, 113,
-   122, 123, 124, 122, 122, 124, 125, 126, 123, 127, 128, 128, 129, 122, 130,  26,
-   131, 132, 133, 131, 131, 131, 131, 131, 132, 133, 134, 131, 135, 131, 131, 131,
-   136, 137, 138, 139, 137, 137, 140, 141, 138, 142, 143, 137, 144, 137, 145,  26,
-   146, 147, 147, 147, 147, 147, 147, 148, 147, 147, 147, 149,  26,  26,  26,  26,
-   150, 151, 152, 152, 153, 152, 152, 154, 155, 156, 152, 157,  26,  26,  26,  26,
-   158, 158, 158, 158, 158, 158, 158, 158, 158, 159, 158, 158, 158, 160, 159, 158,
-   158, 158, 158, 159, 158, 158, 158, 161, 158, 161, 162, 163,  26,  26,  26,  26,
-   164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164, 164,
+     2,   2,   2,   2,   2,   2,   2,   2,   2,   2,   2,   2,   2,   2,   2,   6,
+     0,   0,   0,   0,   7,   8,   0,   0,   9,   9,   9,   9,   9,   9,   9,   9,
+     9,   9,   9,   9,   9,   9,  10,  11,  12,  13,  14,  14,  15,  14,  14,  14,
+    14,  14,  14,  14,  16,  17,  14,  14,  18,  18,  18,  18,  18,  18,  18,  18,
+    19,  18,  18,  18,  18,  18,  18,  18,  18,  18,  18,  18,  18,  18,  20,  21,
+    21,  21,  22,  20,  21,  21,  21,  21,  21,  23,  24,  25,  25,  25,  25,  25,
+    25,  26,  25,  25,  25,  27,  28,  26,  29,  30,  31,  32,  31,  31,  31,  31,
+    33,  34,  35,  31,  31,  31,  36,  31,  31,  31,  31,  31,  31,  31,  31,  31,
+    31,  31,  31,  29,  31,  31,  31,  31,  37,  38,  37,  37,  37,  37,  37,  37,
+    37,  39,  31,  31,  31,  31,  31,  31,  40,  40,  40,  40,  40,  40,  41,  26,
+    42,  42,  42,  42,  42,  42,  42,  43,  44,  44,  44,  44,  44,  45,  44,  46,
+    47,  47,  47,  48,  37,  49,  31,  31,  31,  50,  51,  31,  31,  31,  31,  31,
+    31,  31,  31,  31,  52,  31,  31,  31,  53,  53,  53,  53,  53,  53,  53,  53,
+    53,  53,  54,  53,  55,  53,  53,  53,  56,  57,  58,  59,  59,  60,  61,  62,
+    57,  63,  64,  65,  66,  59,  59,  67,  68,  69,  70,  71,  71,  72,  73,  74,
+    69,  75,  76,  77,  78,  71,  79,  26,  80,  81,  82,  83,  83,  84,  85,  86,
+    81,  87,  88,  26,  89,  83,  90,  91,  92,  93,  94,  95,  95,  96,  97,  98,
+    93,  99, 100, 101, 102,  95,  95,  26, 103, 104, 105, 106, 107, 104, 108, 109,
+   104, 105, 110,  26, 111, 108, 108, 112, 113, 114, 115, 113, 113, 115, 113, 116,
+   114, 117, 118, 119, 120, 113, 121, 113, 122, 123, 124, 122, 122, 124, 125, 126,
+   123, 127, 128, 128, 129, 122, 130,  26, 131, 132, 133, 131, 131, 131, 131, 131,
+   132, 133, 134, 131, 135, 131, 131, 131, 136, 137, 138, 139, 137, 137, 140, 141,
+   138, 142, 143, 137, 144, 137, 145,  26, 146, 147, 147, 147, 147, 147, 147, 148,
+   147, 147, 147, 149,  26,  26,  26,  26, 150, 151, 152, 152, 153, 152, 152, 154,
+   155, 156, 152, 157,  26,  26,  26,  26, 158, 158, 158, 158, 158, 158, 158, 158,
+   158, 159, 158, 158, 158, 160, 159, 158, 158, 158, 158, 159, 158, 158, 158, 161,
+   158, 161, 162, 163,  26,  26,  26,  26, 164, 164, 164, 164, 164, 164, 164, 164,
    164, 164, 164, 164, 165, 165, 165, 165, 166, 167, 165, 165, 165, 165, 165, 168,
-   169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169, 169,
-   170, 170, 170, 170, 170, 170, 170, 170, 170, 171, 172, 171, 170, 170, 170, 170,
-   170, 171, 170, 170, 170, 170, 171, 172, 171, 170, 172, 170, 170, 170, 170, 170,
-   170, 170, 171, 170, 170, 170, 170, 170, 170, 170, 170, 173, 170, 170, 170, 174,
-   170, 170, 170, 175, 176, 176, 176, 176, 176, 176, 176, 176, 176, 176, 177, 177,
-   178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178, 178,
+   169, 169, 169, 169, 169, 169, 169, 169, 170, 170, 170, 170, 170, 170, 170, 170,
+   170, 171, 172, 171, 170, 170, 170, 170, 170, 171, 170, 170, 170, 170, 171, 172,
+   171, 170, 172, 170, 170, 170, 170, 170, 170, 170, 171, 170, 170, 170, 170, 170,
+   170, 170, 170, 173, 170, 170, 170, 174, 170, 170, 170, 175, 176, 176, 176, 176,
+   176, 176, 176, 176, 176, 176, 177, 177, 178, 178, 178, 178, 178, 178, 178, 178,
    179, 179, 179, 180, 181, 181, 181, 181, 181, 181, 181, 181, 181, 182, 181, 183,
    184, 184, 185, 186, 187, 187, 188,  26, 189, 189, 190,  26, 191, 192, 193,  26,
    194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 194, 195, 194, 196, 194, 196,
@@ -2368,208 +2467,164 @@ _hb_ucd_u16[9344] =
    210, 210, 210, 210, 210, 211, 210, 210, 210, 212, 210, 213, 194, 194, 194, 194,
    214, 214, 214, 215, 216, 216, 216, 216, 216, 216, 216, 217, 216, 216, 216, 218,
    216, 219, 216, 219, 216, 220,   9,   9,   9, 221,  26,  26,  26,  26,  26,  26,
-   222, 222, 222, 222, 222, 222, 222, 222, 222, 223, 222, 222, 222, 222, 222, 224,
-   225, 225, 225, 225, 225, 225, 225, 225, 226, 226, 226, 226, 226, 226, 227, 228,
-   229, 229, 229, 229, 229, 229, 229, 230, 229, 231, 232, 232, 232, 232, 232, 232,
-    18, 233, 165, 165, 165, 165, 165, 234, 225,  26, 235,   9, 236, 237, 238, 239,
-     2,   2,   2,   2, 240, 241,   2,   2,   2,   2,   2, 242, 243, 244,   2, 245,
-     2,   2,   2,   2,   2,   2,   2, 246,   9,   9,   9,   9,   9,   9,   9,   9,
-    14,  14, 247, 247,  14,  14,  14,  14, 247, 247,  14, 248,  14,  14,  14, 247,
-    14,  14,  14,  14,  14,  14, 249,  14, 249,  14, 250, 251,  14,  14, 252, 253,
-     0, 254,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 255,   0, 256, 257,
-     0, 258,   2, 259,   0,   0,   0,   0, 260,  26,   9,   9,   9,   9, 261,  26,
-     0,   0,   0,   0, 262, 263,   4,   0,   0, 264,   0,   0,   2,   2,   2,   2,
-     2, 265,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
-     0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
-     0,   0,   0,   0, 258,  26,  26,  26,   0, 266,  26,  26,   0,   0,   0,   0,
-   267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267, 267,
-     0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 268,   0,
-     0,   0, 269,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
-   270, 270, 270, 270, 270, 270, 270, 270, 270, 270, 270, 270,   2,   2,   2,   2,
-    17,  17,  17,  17,  17,  17,  17,  17,  17,  17,  17,  17,  17,  17, 271, 272,
-   165, 165, 165, 165, 166, 167, 273, 273, 273, 273, 273, 273, 273, 274, 275, 274,
-   170, 170, 172,  26, 172, 172, 172, 172, 172, 172, 172, 172,  18,  18,  18,  18,
-     0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 276,  26,  26,  26,  26,
+   222, 222, 222, 222, 222, 222, 222, 222, 222, 223, 222, 222, 222, 222, 222, 222,
+   224, 224, 224, 224, 224, 224, 224, 224, 225, 225, 225, 225, 225, 225, 226, 227,
+   228, 228, 228, 228, 228, 228, 228, 229, 228, 230, 231, 231, 231, 231, 231, 231,
+    18, 232, 165, 165, 165, 165, 165, 233, 224,  26, 234,   9, 235, 236, 237, 238,
+     2,   2,   2,   2, 239, 240,   2,   2,   2,   2,   2, 241, 242, 243,   2, 244,
+     2,   2,   2,   2,   2,   2,   2, 245,  14,  14, 246, 246,  14,  14,  14,  14,
+   246, 246,  14, 247,  14,  14,  14, 246,  14,  14,  14,  14,  14,  14, 248,  14,
+   248,  14, 249, 250,  14,  14, 251, 252,   0, 253,   0,   0,   0,   0,   0,   0,
+     0,   0,   0,   0, 254,   0, 255, 256,   0, 257,   2, 258,   0,   0,   0,   0,
+   259,  26,   9,   9,   9,   9, 260,  26,   0,   0,   0,   0, 261, 262,   4,   0,
+     0, 263,   0,   0,   2,   2,   2,   2,   2, 264,   0,   0,   0,   0,   0,   0,
+     0,   0,   0,   0,   0, 265,  26,  26,   0, 266,  26,  26,   0,   0,   0,   0,
+   267, 267, 267, 267, 267, 267, 267, 267,   0,   0,   0,   0,   0,   0, 268,   0,
+     0,   0, 269,   0,   0,   0,   0,   0, 270, 270, 270, 270, 270, 270, 270, 270,
+   270, 270, 270, 270,   2,   2,   2,   2,  17,  17,  17,  17,  17,  17,  17,  17,
+    17,  17,  17,  17,  17,  17, 271, 272, 165, 165, 165, 165, 166, 167, 273, 273,
+   273, 273, 273, 273, 273, 274, 275, 274, 170, 170, 172,  26, 172, 172, 172, 172,
+   172, 172, 172, 172,  18,  18,  18,  18,   0,   0,   0, 276,  26,  26,  26,  26,
    277, 277, 277, 278, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 279,  26,
-   277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277,
    277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 280,  26,  26,  26,   0,   0,
    281,   0,   0,   0, 282, 283,   0, 284, 285, 286, 286, 286, 286, 286, 286, 286,
    286, 286, 287, 288, 289, 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, 291,
-   292, 293, 293, 293, 293, 293, 294, 169, 169, 169, 169, 169, 169, 169, 169, 169,
-   169, 295,   0,   0, 293, 293, 293, 293,   0,   0,   0,   0, 296, 297, 290, 290,
-   169, 169, 169, 295,   0,   0,   0,   0,   0,   0,   0,   0, 169, 169, 169, 298,
-     0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 290, 290, 290, 290, 290, 299,
+   292, 293, 293, 293, 293, 293, 294, 169, 169, 295,   0,   0, 293, 293, 293, 293,
+     0,   0,   0,   0, 276, 296, 290, 290, 169, 169, 169, 295,   0,   0,   0,   0,
+     0,   0,   0,   0, 169, 169, 169, 297,   0,   0, 290, 290, 290, 290, 290, 298,
    290, 290, 290, 290, 290, 290, 290, 290, 290, 290, 290,   0,   0,   0,   0,   0,
-   277, 277, 277, 277, 277, 277, 277, 277,   0,   0,   0,   0,   0,   0,   0,   0,
-   300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300, 300,
-   300, 301, 300, 300, 300, 300, 300, 300, 302,  26, 303, 303, 303, 303, 303, 303,
-   304, 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, 304, 304,
-   304, 304, 304, 304, 304, 305,  26,  26,  18,  18,  18,  18,  18,  18,  18,  18,
-    18,  18,  18,  18, 306, 306, 306, 306, 306, 306, 306, 306, 306, 306, 306,  26,
-     0,   0,   0,   0, 307,   2,   2,   2,   2,   2,   2,   2,   2,   2,   2,   2,
-     2, 308,   2,   2,   2,   2,   2,   2,   2, 309, 310, 311,  26,  26, 312,   2,
-   313, 313, 313, 313, 313, 314,   0, 315, 316, 316, 316, 316, 316, 316, 316,  26,
-   317, 317, 317, 317, 317, 317, 317, 317, 318, 319, 317, 320,  53,  53,  53,  53,
-   321, 321, 321, 321, 321, 322, 323, 323, 323, 323, 324, 325, 169, 169, 169, 326,
-   327, 327, 327, 327, 327, 327, 327, 327, 327, 328, 327, 329, 164, 164, 164, 330,
-   331, 331, 331, 331, 331, 331, 332,  26, 331, 333, 331, 334, 164, 164, 164, 164,
-   335, 335, 335, 335, 335, 335, 335, 335, 336,  26,  26, 337, 338, 338, 339,  26,
-   340, 340, 340,  26, 172, 172,   2,   2,   2,   2,   2, 341, 342, 343, 176, 176,
-   176, 176, 176, 176, 176, 176, 176, 176, 338, 338, 338, 338, 338, 344, 338, 345,
-   169, 169, 169, 169, 346,  26, 169, 169, 295, 347, 169, 169, 169, 169, 169, 346,
-    26,  26,  26,  26,  26,  26,  26,  26,  26,  26,  26,  26,  26,  26,  26,  26,
-   277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 280, 277, 277,
-   277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 348,  26,  26,  26,  26,
-   349,  26, 350, 351,  25,  25, 352, 353, 354,  25,  31,  31,  31,  31,  31,  31,
-    31,  31,  31,  31,  31,  31,  31,  31, 355,  26, 356,  31,  31,  31,  31,  31,
-    31,  31,  31,  31,  31,  31,  31,  31,  31,  31,  31,  31,  31,  31,  31,  31,
-    31,  31,  31,  31,  31,  31,  31, 357,  31,  31,  31,  31,  31,  31,  31,  31,
-    31,  31, 358,  31,  31,  31,  31,  31,  31, 359,  26,  26,  26,  26,  31,  31,
-     9,   9,   0, 315,   9, 360,   0,   0,   0,   0, 361,   0, 258, 296, 362,  31,
-    31,  31,  31,  31,  31,  31,  31,  31,  31,  31,  31,  31,  31,  31,  31, 363,
-   364,   0,   0,   0,   1,   2,   2,   3,   1,   2,   2,   3, 365, 290, 289, 290,
-   290, 290, 290, 366, 169, 169, 169, 295, 367, 367, 367, 368, 258, 258,  26, 369,
-   370, 371, 370, 370, 372, 370, 370, 373, 370, 374, 370, 374,  26,  26,  26,  26,
-   370, 370, 370, 370, 370, 370, 370, 370, 370, 370, 370, 370, 370, 370, 370, 375,
-   376,   0,   0,   0,   0,   0, 377,   0,  14,  14,  14,  14,  14,  14,  14,  14,
-    14, 253,   0, 378, 379,  26,  26,  26,  26,  26,   0,   0,   0,   0,   0, 380,
-   381, 381, 381, 382, 383, 383, 383, 383, 383, 383, 384,  26, 385,   0,   0, 296,
-   386, 386, 386, 386, 387, 388, 389, 389, 389, 390, 391, 391, 391, 391, 391, 392,
-   393, 393, 393, 394, 395, 395, 395, 395, 396, 395, 397,  26,  26,  26,  26,  26,
-   398, 398, 398, 398, 398, 398, 398, 398, 398, 398, 399, 399, 399, 399, 399, 399,
-   400, 400, 400, 401, 400, 402, 403, 403, 403, 403, 404, 403, 403, 403, 403, 404,
-   405, 405, 405, 405, 405,  26, 406, 406, 406, 406, 406, 406, 407, 408, 409, 410,
-   409, 410, 411, 409, 412, 409, 412, 413,  26,  26,  26,  26,  26,  26,  26,  26,
-   414, 414, 414, 414, 414, 414, 414, 414, 414, 414, 414, 414, 414, 414, 414, 414,
-   414, 414, 414, 414, 414, 414, 415,  26, 414, 414, 416,  26, 414,  26,  26,  26,
-   417,   2,   2,   2,   2,   2, 418, 309,  26,  26,  26,  26,  26,  26,  26,  26,
-   419, 420, 421, 421, 421, 421, 422, 423, 424, 424, 425, 424, 426, 426, 426, 426,
-   427, 427, 427, 428, 429, 427,  26,  26,  26,  26,  26,  26, 430, 430, 431, 432,
-   433, 433, 433, 434, 435, 435, 435, 436,  26,  26,  26,  26,  26,  26,  26,  26,
-   437, 437, 437, 437, 438, 438, 438, 439, 438, 438, 440, 438, 438, 438, 438, 438,
-   441, 442, 443, 444, 445, 445, 446, 447, 445, 448, 445, 448, 449, 449, 449, 449,
-   450, 450, 450, 450,  26,  26,  26,  26, 451, 451, 451, 451, 452, 453, 452,  26,
-   454, 454, 454, 454, 454, 454, 455, 456, 457, 457, 458, 457, 459, 459, 460, 459,
-   461, 461, 462, 463,  26, 464,  26,  26,  26,  26,  26,  26,  26,  26,  26,  26,
-   465, 465, 465, 465, 465, 465, 465, 465, 465, 466,  26,  26,  26,  26,  26,  26,
-   467, 467, 467, 467, 467, 467, 468,  26, 467, 467, 467, 467, 467, 467, 468, 469,
-   470, 470, 470, 470, 470,  26, 470, 471,  26,  26,  26,  26,  26,  26,  26,  26,
-    26,  26,  26,  26,  26,  26,  26,  26,  26,  26,  26,  26,  31,  31,  31,  50,
-   472, 472, 472, 472, 472, 473, 474,  26,  26,  26,  26,  26,  26,  26,  26, 475,
-   476, 476, 476, 476, 476,  26, 477, 477, 477, 477, 477, 478,  26,  26, 479, 479,
-   479, 480,  26,  26,  26,  26, 481, 481, 481, 482,  26,  26, 483, 483, 484,  26,
-   485, 485, 485, 485, 485, 485, 485, 485, 485, 486, 487, 485, 485, 485, 486, 488,
-   489, 489, 489, 489, 489, 489, 489, 489, 490, 491, 492, 492, 492, 493, 492, 494,
-   495, 495, 495, 495, 495, 495, 496, 495, 495,  26, 497, 497, 497, 497, 498,  26,
-   499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 499, 500, 137, 501,  26,
-   502, 502, 503, 502, 502, 502, 502, 502, 504,  26,  26,  26,  26,  26,  26,  26,
-   505, 506, 507, 508, 507, 509, 510, 510, 510, 510, 510, 510, 510, 511, 510, 512,
-   513, 514, 515, 516, 516, 517, 518, 519, 514, 520, 521, 522, 523, 524, 524,  26,
-   525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 525, 526, 527,  26,  26,  26,
-   528, 528, 528, 528, 528, 528, 528, 528, 528,  26, 528, 529,  26,  26,  26,  26,
-   530, 530, 530, 530, 530, 530, 531, 530, 530, 530, 530, 531,  26,  26,  26,  26,
-   532, 532, 532, 532, 532, 532, 532, 532, 533,  26, 532, 534, 198, 535,  26,  26,
-   536, 536, 536, 536, 536, 536, 536, 537, 536, 537,  26,  26,  26,  26,  26,  26,
-   538, 538, 538, 539, 538, 540, 538, 538, 541,  26,  26,  26,  26,  26,  26,  26,
-   542, 542, 542, 542, 542, 542, 542, 543,  26,  26,  26,  26,  26,  26,  26,  26,
-    26,  26,  26,  26, 544, 544, 544, 544, 544, 544, 544, 544, 544, 544, 545, 546,
-   547, 548, 549, 550, 550, 550, 551, 552, 547,  26, 550, 553,  26,  26,  26,  26,
-    26,  26,  26,  26, 554, 555, 554, 554, 554, 554, 554, 555, 556,  26,  26,  26,
-   557, 557, 557, 557, 557, 557, 557, 557, 557,  26, 558, 558, 558, 558, 558, 558,
-   558, 558, 558, 558, 559,  26, 178, 178, 560, 560, 560, 560, 560, 560, 560, 561,
-    53, 562,  26,  26,  26,  26,  26,  26,  26,  26,  26,  26,  26,  26,  26,  26,
-   563, 564, 563, 563, 563, 563, 565, 563, 566,  26, 563, 563, 563, 567, 568, 568,
-   568, 568, 569, 568, 568, 570, 571,  26,  26,  26,  26,  26,  26,  26,  26,  26,
-   572, 573, 574, 574, 574, 574, 572, 575, 574,  26, 574, 576, 577, 578, 579, 579,
-   579, 580, 581, 582, 579, 583,  26,  26,  26,  26,  26,  26,  26,  26,  26,  26,
-    26,  26,  26,  26,  26,  26,  26,  26,  26,  26,  26,  26, 584, 584, 584, 585,
-   586, 586, 587, 586, 586, 586, 586, 588, 586, 586, 586, 589,  26,  26,  26,  26,
-    26,  26,  26,  26,  26,  26, 590,  26, 108, 108, 108, 108, 108, 108, 591, 592,
-   593, 593, 593, 593, 593, 593, 593, 593, 593, 593, 593, 593, 593, 593, 593, 593,
-   593, 593, 593, 594,  26,  26,  26,  26,  26,  26,  26,  26,  26,  26,  26,  26,
-   593, 593, 593, 593, 593, 593, 593, 593, 593, 593, 593, 593, 593, 595, 596,  26,
-   593, 593, 593, 593, 593, 593, 593, 593, 597,  26,  26,  26,  26,  26,  26,  26,
-    26,  26, 598, 598, 598, 598, 598, 598, 598, 598, 598, 598, 598, 598, 599,  26,
-   600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 600,
-   600, 600, 600, 600, 600, 600, 600, 600, 600, 600, 601,  26,  26,  26,  26,  26,
-   602, 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, 602, 602,
-   602, 602, 602, 602, 602, 602, 602, 602, 603,  26,  26,  26,  26,  26,  26,  26,
-   306, 306, 306, 306, 306, 306, 306, 306, 306, 306, 306, 306, 306, 306, 306, 306,
-   306, 306, 306, 306, 306, 306, 306, 604, 605, 605, 605, 606, 605, 607, 608, 608,
-   608, 608, 608, 608, 608, 608, 608, 609, 608, 610, 611, 611, 611, 612, 612,  26,
-   613, 613, 613, 613, 613, 613, 613, 613, 614,  26, 613, 615, 615, 613, 613, 616,
-   613, 613,  26,  26,  26,  26,  26,  26,  26,  26,  26,  26,  26,  26,  26,  26,
-    26,  26,  26,  26,  26,  26,  26,  26, 617, 617, 617, 617, 617, 617, 617, 617,
-   617, 617, 617, 618,  26,  26,  26,  26,  26,  26,  26,  26,  26,  26,  26,  26,
-   619, 619, 619, 619, 619, 619, 619, 619, 619, 620, 619, 619, 619, 619, 619, 619,
-   619, 621, 619, 619,  26,  26,  26,  26,  26,  26,  26,  26, 622,  26, 348,  26,
-   623, 623, 623, 623, 623, 623, 623, 623, 623, 623, 623, 623, 623, 623, 623, 623,
-   623, 623, 623, 623, 623, 623, 623, 623, 623, 623, 623, 623, 623, 623, 623,  26,
-   624, 624, 624, 624, 624, 624, 624, 624, 624, 624, 624, 624, 624, 624, 624, 624,
-   624, 624, 624, 624, 624, 624, 624, 624, 624, 624, 625,  26,  26,  26,  26,  26,
-   623, 626,  26,  26,  26,  26,  26,  26,  26,  26,  26,  26,  26,  26,  26,  26,
-    26,  26,  26,  26,  26,  26,  26,  26,  26,  26,  26,  26,  26,  26, 627, 628,
-   629, 286, 286, 286, 286, 286, 286, 286, 286, 286, 286, 286, 286, 286, 286, 286,
-   286, 286, 286, 286, 286, 286, 286, 286, 286, 286, 286, 286, 286, 286, 286, 286,
-   286, 286, 286, 286, 630,  26, 631,  26,  26,  26, 632,  26, 633,  26, 634, 634,
-   634, 634, 634, 634, 634, 634, 634, 634, 634, 634, 634, 634, 634, 634, 634, 634,
-   634, 634, 634, 634, 634, 634, 634, 634, 634, 634, 634, 634, 634, 634, 634, 635,
-   636, 636, 636, 636, 636, 636, 636, 636, 636, 636, 636, 636, 636, 637, 636, 638,
-   636, 639, 636, 640, 296,  26,  26,  26,  26,  26,  26,  26,  26,  26,  26,  26,
-     9,   9,   9,   9,   9, 641,   9,   9, 221,  26,   0,   0,   0,   0,   0,   0,
-     0,   0,   0,   0,   0,   0,   0,   0, 296,  26,  26,  26,  26,  26,  26,  26,
-     0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 276,  26,
-     0,   0,   0,   0, 258, 364,   0,   0,   0,   0,   0,   0, 642, 643,   0, 644,
-   645, 646,   0,   0,   0, 647,   0,   0,   0,   0,   0,   0,   0, 266,  26,  26,
-    14,  14,  14,  14,  14,  14,  14,  14, 247,  26,  26,  26,  26,  26,  26,  26,
-    26,  26,  26,  26,  26,  26,  26,  26,   0,   0, 296,  26,   0,   0, 296,  26,
-     0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 258,  26,   0,   0,   0, 260,
-     0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 255,   0,   0,   0,   0,   0,
-     0,   0,   0, 255, 648, 649,   0, 650, 651,   0,   0,   0,   0,   0,   0,   0,
-   269, 652, 255, 255,   0,   0,   0, 653, 654, 655, 656,   0,   0,   0,   0,   0,
-     0,   0,   0,   0, 276,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
-     0,   0,   0,   0,   0,   0,   0,   0,   0, 268,   0,   0,   0,   0,   0,   0,
-   657, 657, 657, 657, 657, 657, 657, 657, 657, 657, 657, 657, 657, 657, 657, 657,
-   657, 658,  26, 659, 660, 657,  26,  26,  26,  26,  26,  26,  26,  26,  26,  26,
-     2,   2,   2, 349, 661, 309,  26,  26,  26,  26,  26,  26,  26,  26,  26,  26,
-   662, 270, 270, 663, 664, 665,  18,  18,  18,  18,  18,  18,  18, 666,  26,  26,
-    26, 667,  26,  26,  26,  26,  26,  26,  26,  26,  26,  26,  26,  26,  26,  26,
-   668, 668, 668, 668, 668, 669, 668, 670, 668, 671,  26,  26,  26,  26,  26,  26,
-    26,  26, 672, 672, 672, 673,  26,  26, 674, 674, 674, 674, 674, 674, 674, 675,
-    26,  26,  26,  26,  26,  26,  26,  26,  26,  26, 676, 676, 676, 676, 676, 677,
-    26,  26,  26,  26,  26,  26,  26,  26,  26,  26,  26,  26, 172, 678, 170, 172,
-   679, 679, 679, 679, 679, 679, 679, 679, 679, 679, 679, 679, 679, 679, 679, 679,
-   679, 679, 679, 679, 679, 679, 679, 679, 680, 679, 681,  26,  26,  26,  26,  26,
-   682, 682, 682, 682, 682, 682, 682, 682, 682, 683, 682, 684,  26,  26,  26,  26,
-    26,  26,  26,  26,  26,  26,  26,  26,  26,  26,  26,  26,  26,  26, 364,   0,
-     0,   0,   0,   0,   0,   0, 378,  26,  26,  26,  26,  26,  26,  26,  26,  26,
-   364,   0,   0,   0,   0,   0,   0, 276,  26,  26,  26,  26,  26,  26,  26,  26,
-   685,  31,  31,  31, 686, 687, 688, 689, 690, 691, 686, 692, 686, 688, 688, 693,
-    31, 694,  31, 695, 696, 694,  31, 695,  26,  26,  26,  26,  26,  26,  51,  26,
-     0,   0,   0,   0,   0, 296,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
-     0,   0, 296,  26,   0, 258, 364,   0, 364,   0, 364,   0,   0,   0, 276,  26,
-     0,   0,   0,   0,   0, 276,  26,  26,  26,  26,  26,  26, 697,   0,   0,   0,
-   698,  26,   0,   0,   0,   0,   0, 296,   0, 260, 315,  26, 276,  26,  26,  26,
-     0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 699,   0, 378,   0, 378,
-     0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 258, 700,
-     0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 315,   0, 296, 260,  26,
-     0, 296,   0,   0,   0,   0,   0,   0,   0,  26,   0, 315,   0,   0,   0,   0,
-     0,  26,   0,   0,   0, 276, 315,  26,  26,  26,  26,  26,  26,  26,  26,  26,
-     0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 296,  26,   0, 276,   0, 378,
-     0, 260,   0,   0,   0,   0,   0, 269, 276, 697,   0, 296,   0, 260,   0, 260,
-     0,   0, 361,   0,   0,   0,   0,   0,   0, 266,  26,  26,  26,  26,   0, 315,
-   277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277,  26,  26,  26,  26,
-   277, 277, 277, 277, 277, 277, 277, 348, 277, 277, 277, 277, 277, 277, 277, 277,
-   277, 277, 277, 280, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277,
-   277, 277, 277, 277, 348,  26, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277,
-   277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 701,  26, 277, 277,
-   277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 280,  26,  26,  26,  26,
-   277, 277, 277, 280,  26,  26,  26,  26,  26,  26,  26,  26,  26,  26,  26,  26,
-   277, 277, 277, 277, 277, 277, 277, 277, 277, 702, 277, 277, 277, 277, 277, 277,
-   277, 277, 277, 277, 277, 277,  26,  26,  26,  26,  26,  26,  26,  26,  26,  26,
-   703,  26,  26,  26,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
-     9,   9,   9,   9,   9,   9,   9,   9,   9,   9,   9,   9,   9,   9,   9,   9,
-     9,   9,   9,   9,   9,   9,   9,   9,   9,   9,   9,   9,   9,   9,   0,   0,
+   299, 299, 299, 299, 299, 299, 299, 299, 299, 300, 299, 299, 299, 299, 299, 299,
+   301,  26, 302, 302, 302, 302, 302, 302, 303, 303, 303, 303, 303, 303, 303, 303,
+   303, 303, 303, 303, 303, 304,  26,  26,  18,  18,  18,  18, 305, 305, 305, 305,
+   305, 305, 305, 305, 305, 305, 305,  26,   0,   0,   0,   0, 306,   2,   2,   2,
+     2, 307,   2,   2,   2,   2,   2,   2,   2, 308, 309, 258,  26,  26, 310,   2,
+   311, 311, 311, 311, 311, 312,   0, 265, 313, 313, 313, 313, 313, 313, 313,  26,
+   314, 314, 314, 314, 314, 314, 314, 314, 315, 316, 314, 317,  53,  53,  53,  53,
+   318, 318, 318, 318, 318, 319, 320, 320, 320, 320, 321, 322, 169, 169, 169, 323,
+   324, 324, 324, 324, 324, 324, 324, 324, 324, 325, 324, 326, 164, 164, 164, 327,
+   328, 328, 328, 328, 328, 328, 329,  26, 328, 330, 328, 331, 164, 164, 164, 164,
+   332, 332, 332, 332, 332, 332, 332, 332, 333,  26,  26, 334, 335, 335, 336,  26,
+   337, 337, 337,  26, 172, 172,   2,   2,   2,   2,   2, 338, 339, 340, 176, 176,
+   176, 176, 176, 176, 176, 176, 176, 176, 335, 335, 335, 335, 335, 341, 335, 342,
+   169, 169, 169, 169, 343,  26, 169, 169, 295, 344, 169, 169, 169, 169, 169, 343,
+    26,  26,  26,  26,  26,  26,  26,  26, 277, 277, 277, 277, 277, 280, 277, 277,
+   277, 277, 277, 345,  26,  26,  26,  26, 346,  26, 347, 348,  25,  25, 349, 350,
+   351,  25,  31,  31,  31,  31,  31,  31, 352,  26, 353,  31,  31,  31,  31,  31,
+    31,  31,  31,  31,  31,  31,  31, 354,  31,  31, 355,  31,  31,  31,  31,  31,
+    31, 356,  26,  26,  26,  26,  31,  31,   9,   9,   0, 265,   9, 357,   0,   0,
+     0,   0, 358,   0, 257, 359, 360,  31,  31,  31,  31,  31,  31,  31,  31, 361,
+   362,   0,   0,   0,   1,   2,   2,   3,   1,   2,   2,   3, 363, 290, 289, 290,
+   290, 290, 290, 364, 169, 169, 169, 295, 365, 365, 365, 366, 257, 257,  26, 367,
+   368, 369, 368, 368, 370, 368, 368, 371, 368, 372, 368, 372,  26,  26,  26,  26,
+   368, 368, 368, 368, 368, 368, 368, 368, 368, 368, 368, 368, 368, 368, 368, 373,
+   374,   0,   0,   0,   0,   0, 375,   0,  14,  14,  14,  14,  14,  14,  14,  14,
+    14, 252,   0, 376, 377,  26,  26,  26,  26,  26,   0,   0,   0,   0,   0, 378,
+   379, 379, 379, 380, 381, 381, 381, 381, 381, 381, 382,  26, 383,   0,   0, 359,
+   384, 384, 384, 384, 385, 386, 387, 387, 387, 388, 389, 389, 389, 389, 389, 390,
+   391, 391, 391, 392, 393, 393, 393, 393, 394, 393, 395,  26,  26,  26,  26,  26,
+   396, 396, 396, 396, 396, 396, 396, 396, 396, 396, 397, 397, 397, 397, 397, 397,
+   398, 398, 398, 399, 398, 400, 401, 401, 401, 401, 402, 401, 401, 401, 401, 402,
+   403, 403, 403, 403, 403,  26, 404, 404, 404, 404, 404, 404, 405, 406, 407, 408,
+   407, 408, 409, 407, 410, 407, 410, 411, 412, 412, 412, 412, 412, 412, 413,  26,
+   414, 414, 414, 414, 414, 414, 414, 414, 414, 414, 414, 414, 414, 414, 415,  26,
+   414, 414, 416,  26, 414,  26,  26,  26, 417,   2,   2,   2,   2,   2, 418, 419,
+   420, 421, 422, 422, 422, 422, 423, 424, 425, 425, 426, 425, 427, 427, 427, 427,
+   428, 428, 428, 429, 430, 428,  26,  26,  26,  26,  26,  26, 431, 431, 432, 433,
+   434, 434, 434, 435, 436, 436, 436, 437, 438, 438, 438, 438, 439, 439, 439, 440,
+   439, 439, 441, 439, 439, 439, 439, 439, 442, 443, 444, 445, 446, 446, 447, 448,
+   446, 449, 446, 449, 450, 450, 450, 450, 451, 451, 451, 451,  26,  26,  26,  26,
+   452, 452, 452, 452, 453, 454, 453,  26, 455, 455, 455, 455, 455, 455, 456, 457,
+   458, 458, 459, 458, 460, 460, 461, 460, 462, 462, 463, 464,  26, 465,  26,  26,
+   466, 466, 466, 466, 466, 466, 466, 466, 466, 467,  26,  26,  26,  26,  26,  26,
+   468, 468, 468, 468, 468, 468, 469,  26, 468, 468, 468, 468, 468, 468, 469, 470,
+   471, 471, 471, 471, 471,  26, 471, 472, 473, 473, 473, 473, 474, 475, 473, 473,
+   474, 476,  26,  26,  26,  26,  26,  26,  26,  26,  26,  26,  31,  31,  31,  50,
+   477, 477, 477, 477, 477, 478, 479,  26, 480,  26,  26,  26,  26,  26,  26, 481,
+   482, 482, 482, 482, 482,  26, 483, 483, 483, 483, 483, 484,  26,  26, 485, 485,
+   485, 486,  26,  26,  26,  26, 487, 487, 487, 488,  26,  26, 489, 489, 490,  26,
+   491, 491, 491, 491, 491, 491, 491, 491, 491, 492, 493, 491, 491, 491, 492, 494,
+   495, 495, 495, 495, 495, 495, 495, 495, 496, 497, 498, 498, 498, 499, 498, 500,
+   501, 501, 501, 501, 501, 501, 502, 501, 501,  26, 503, 503, 503, 503, 504,  26,
+   505, 505, 505, 505, 505, 505, 505, 505, 505, 505, 505, 505, 506, 137, 507,  26,
+   508, 508, 509, 508, 508, 508, 508, 508, 510,  26,  26,  26,  26,  26,  26,  26,
+   511, 512, 513, 514, 513, 515, 516, 516, 516, 516, 516, 516, 516, 517, 516, 518,
+   519, 520, 521, 522, 522, 523, 524, 525, 520, 526, 527, 528, 529, 530, 530,  26,
+   531, 532, 531, 531, 531, 531, 533, 531, 534, 535, 533, 536, 537,  26,  26,  26,
+   538, 538, 538, 538, 538, 538, 538, 538, 538, 538, 538, 539, 540,  26,  26,  26,
+   541, 541, 541, 541, 541, 541, 541, 541, 541,  26, 541, 542,  26,  26,  26,  26,
+   543, 543, 543, 543, 543, 543, 544, 543, 543, 543, 543, 544,  26,  26,  26,  26,
+   545, 545, 545, 545, 545, 545, 545, 545, 546,  26, 545, 547, 198, 548,  26,  26,
+   549, 549, 549, 549, 549, 549, 549, 550, 549, 550, 164, 164, 551,  26,  26,  26,
+   552, 552, 552, 553, 552, 554, 552, 552, 555,  26,  26,  26,  26,  26,  26,  26,
+   556, 556, 556, 556, 556, 556, 556, 557,  26,  26,  26,  26, 558, 558, 558, 558,
+   558, 558, 558, 558, 558, 558, 559, 560, 561, 562, 563, 564, 564, 564, 565, 566,
+   561,  26, 564, 567,  26,  26,  26,  26,  26,  26,  26,  26, 568, 569, 568, 568,
+   568, 568, 568, 569, 570,  26,  26,  26, 571, 571, 571, 571, 571, 571, 571, 571,
+   571,  26, 572, 572, 572, 572, 572, 572, 572, 572, 572, 572, 573,  26, 178, 178,
+   574, 574, 574, 574, 574, 574, 574, 575,  53, 576,  26,  26,  26,  26,  26,  26,
+   577, 577, 577, 577, 578,  26, 577, 578, 579, 580, 579, 579, 579, 579, 581, 579,
+   582,  26, 579, 579, 579, 583, 584, 584, 584, 584, 585, 584, 584, 586, 587,  26,
+   588, 589, 590, 590, 590, 590, 588, 591, 590,  26, 590, 592, 593, 594, 595, 595,
+   595, 596, 597, 598, 595, 599,  26,  26,  26,  26,  26,  26, 600, 600, 600, 601,
+   602, 602, 603, 602, 602, 602, 602, 604, 602, 602, 602, 605,  26,  26,  26,  26,
+    26,  26,  26,  26,  26,  26, 606,  26, 108, 108, 108, 108, 108, 108, 607, 608,
+   609, 609, 609, 609, 609, 609, 609, 609, 609, 609, 609, 610,  26,  26,  26,  26,
+   609, 609, 609, 609, 609, 611, 612,  26, 613,  26,  26,  26,  26,  26,  26,  26,
+    26,  26, 614, 614, 614, 614, 614, 614, 614, 614, 614, 614, 614, 614, 615,  26,
+   616, 616, 616, 616, 616, 616, 616, 616, 616, 616, 617,  26, 616, 616, 616, 616,
+   616, 616, 616, 616, 616, 616, 616, 618, 619, 619, 619, 619, 619, 619, 619, 619,
+   620,  26,  26,  26,  26,  26,  26,  26, 621, 621, 621, 621, 621, 621, 621, 622,
+   305, 305, 305, 305, 305, 305, 305, 305, 305, 305, 305, 305, 305, 305, 305, 623,
+   624, 624, 624, 625, 624, 626, 627, 627, 627, 627, 627, 627, 627, 627, 627, 628,
+   627, 629, 630, 630, 630, 631, 631,  26, 632, 632, 632, 632, 632, 632, 632, 632,
+   633,  26, 632, 634, 634, 632, 632, 635, 632, 632,  26,  26,  26,  26,  26,  26,
+   636, 636, 636, 636, 636, 636, 636, 637, 638, 638, 638, 638, 638, 638, 638, 638,
+   638, 638, 638, 639,  26,  26,  26,  26, 640, 640, 640, 640, 640, 640, 640, 640,
+   640, 641, 640, 640, 640, 640, 640, 640, 640, 642, 640, 640,  26,  26,  26,  26,
+    26,  26,  26,  26, 643,  26, 345,  26, 644, 644, 644, 644, 644, 644, 644, 644,
+   644, 644, 644, 644, 644, 644, 644,  26, 645, 645, 645, 645, 645, 645, 645, 645,
+   645, 645, 646,  26,  26,  26,  26, 647, 644, 648,  26,  26,  26,  26,  26,  26,
+    26,  26,  26,  26,  26,  26, 649, 650, 651, 286, 286, 286, 286, 286, 286, 286,
+   286, 286, 286, 286, 286, 286, 286, 286, 286, 286, 286, 286, 652,  26, 653,  26,
+    26,  26, 654,  26, 655,  26, 656, 656, 656, 656, 656, 656, 656, 656, 656, 656,
+   656, 656, 656, 656, 656, 656, 656, 657, 658, 658, 658, 658, 658, 658, 658, 658,
+   658, 658, 658, 658, 658, 659, 658, 660, 658, 661, 658, 662, 359,  26,  26,  26,
+     0,   0,   0,   0,   0,   0,   0, 265,   0,   0,   0,   0,   0,   0, 359,  26,
+     9,   9,   9,   9,   9, 663,   9,   9, 221,  26,   0,   0,   0,   0,   0,   0,
+   359,  26,  26,  26,  26,  26,  26,  26,   0,   0,   0,   0,   0,   0, 276,  26,
+     0,   0,   0,   0, 257, 362,   0,   0,   0,   0,   0,   0, 664, 665,   0, 666,
+   667, 668,   0,   0,   0, 669,   0,   0,   0,   0,   0,   0,   0, 266,  26,  26,
+   246,  26,  26,  26,  26,  26,  26,  26,   0,   0, 359,  26,   0,   0, 359,  26,
+     0,   0, 257,  26,   0,   0,   0, 259,   0,   0, 254,   0,   0,   0,   0,   0,
+     0,   0,   0, 254, 670, 671,   0, 672, 673,   0,   0,   0,   0,   0,   0,   0,
+   269, 674, 254, 254,   0,   0,   0, 675, 676, 677, 678,   0,   0,   0,   0,   0,
+     0,   0,   0,   0, 276,   0,   0,   0,   0, 268,   0,   0,   0,   0,   0,   0,
+   679, 679, 679, 679, 679, 679, 679, 679, 679, 680,  26, 681, 682, 679,  26,  26,
+     2,   2,   2, 346, 683, 419,  26,  26, 684, 270, 270, 685, 686, 687,  18,  18,
+    18,  18,  18,  18,  18, 688,  26,  26,  26, 689,  26,  26,  26,  26,  26,  26,
+   690, 690, 690, 690, 690, 691, 690, 692, 690, 693,  26,  26,  26,  26,  26,  26,
+    26,  26, 694, 694, 694, 695,  26,  26, 696, 696, 696, 696, 696, 696, 696, 697,
+    26,  26, 698, 698, 698, 698, 698, 699,  26,  26, 700, 700, 700, 700, 700, 701,
+    26,  26,  26,  26, 172, 702, 170, 172, 703, 703, 703, 703, 703, 703, 703, 703,
+   704, 703, 705,  26,  26,  26,  26,  26, 706, 706, 706, 706, 706, 706, 706, 706,
+   706, 707, 706, 708,  26,  26,  26,  26,  26,  26,  26,  26,  26,  26, 362,   0,
+     0,   0,   0,   0,   0,   0, 376,  26, 362,   0,   0,   0,   0,   0,   0, 276,
+   709,  31,  31,  31, 710, 711, 712, 713, 714, 715, 710, 716, 710, 712, 712, 717,
+    31, 718,  31, 719, 720, 718,  31, 719,  26,  26,  26,  26,  26,  26, 721,  26,
+     0,   0,   0,   0,   0, 359,   0,   0,   0,   0, 359,  26,   0, 257, 362,   0,
+   362,   0, 362,   0,   0,   0, 276,  26,   0,   0,   0,   0,   0, 276,  26,  26,
+    26,  26,  26,  26, 722,   0,   0,   0, 723,  26,   0,   0,   0,   0,   0, 359,
+     0, 259, 265,  26, 276,  26,  26,  26,   0,   0,   0, 724,   0, 376,   0, 376,
+     0,   0,   0,   0,   0,   0, 257, 725,   0,   0,   0, 265,   0, 359, 259,  26,
+     0, 359,   0,   0,   0,   0,   0,   0,   0,  26,   0, 265,   0,   0,   0,   0,
+     0,  26,   0,   0,   0, 276,   0, 359, 265,  26,  26,  26,  26,  26,  26,  26,
+     0,   0, 359,  26,   0, 276,   0, 376,   0, 726,   0,   0,   0,   0,   0,   0,
+   257, 722,   0, 727,   0, 265,   0, 259,   0,   0, 358,   0,   0,   0,   0,   0,
+   277, 277, 277, 277,  26,  26,  26,  26, 277, 277, 277, 277, 277, 277, 277, 345,
+   277, 277, 277, 280, 277, 277, 277, 277, 277, 277, 277, 277, 345,  26, 277, 277,
+   277, 277, 277, 277, 728,  26, 277, 277, 277, 277, 277, 280,  26,  26,  26,  26,
+   277, 729, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277, 277,  26,  26,
+   730,  26,  26,  26,   0,   0,   0,   0,   9,   9,   9,   9,   9,   9,   0,   0,
      0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
    939, 940, 941, 942, 946, 948,   0, 962, 969, 970, 971, 976,1001,1002,1003,1008,
      0,1033,1040,1041,1042,1043,1047,   0,   0,1080,1081,1082,1086,1110,   0,   0,
@@ -2732,17 +2787,24 @@ _hb_ucd_u16[9344] =
      0,   0,   0,   0,   0,   0,   0,   0,   0,   0,1602,1603,1934,1935,1574,1575,
   1576,1577,1579,1580,1581,1583,1584,   0,1585,1587,1588,1589,1591,   0,1592,   0,
   1593,1594,   0,1595,1596,   0,1598,1599,1600,1601,1604,1582,1578,1590,1597,   0,
-     0,   0,   0,   0,   0,   0,   0,   0,   0,   0,1936,   0,1937,   0,   0,   0,
-     0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,1938,   0,   0,   0,   0,
-     0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,1939,1940,
-     0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,1941,1942,   0,   0,   0,
-     0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,1944,1943,   0,1945,   0,
-     0,   0,   0,   0,   0,   0,   0,   0,   0,   0,1946,1947,   0,   0,   0,   0,
-     0,   0,   0,   0,   0,   0,   0,   0,1948,   0,   0,   0,   0,   0,   0,   0,
-     0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,1949,1950,
-  1951,1952,1953,1954,1955,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
-     0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,1956,1957,1958,1960,1959,
-  1961,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+     0,   0,   0,   0,   0,   0,   0,   0,   0,1936,   0,   0,   0,   0,   0,   0,
+     0,   0,   0,   0,1937,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+     0,   0,   0,   0,   0,   0,   0,   0,   0,   0,1938,   0,1939,   0,   0,   0,
+     0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,1940,   0,   0,   0,   0,
+     0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,1941,1942,
+     0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,1943,1944,   0,   0,   0,
+     0,   0,   0,1945,   0,1946,   0,   0,   0,   0,   0,   0,   0,   0,1947,   0,
+     0,1948,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+     0,   0,   0,   0,   0,1950,   0,1949,1951,   0,   0,   0,   0,   0,   0,   0,
+     0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,1953,1952,   0,1954,   0,
+     0,   0,   0,   0,   0,   0,   0,   0,   0,   0,1955,1956,   0,   0,   0,   0,
+     0,   0,   0,   0,   0,   0,   0,   0,1957,   0,   0,   0,   0,   0,   0,   0,
+     0,1958,1961,1959,1965,1960,1962,1964,1963,   0,   0,   0,   0,   0,   0,   0,
+     0,   0,   0,   0,   0,   0,   0,   0,1967,1966,1968,   0,   0,   0,   0,   0,
+     0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,1969,1970,
+  1971,1972,1973,1974,1975,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+     0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,1976,1977,1978,1980,1979,
+  1981,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
    106, 104, 107, 826, 114, 118, 119, 121, 123, 124, 127, 125,  34, 830, 130, 131,
    132, 137, 827,  35, 133, 139, 829, 142, 143, 112, 144, 145, 924, 151, 152,  37,
    157, 158, 159, 160,  38, 165, 166, 169, 171, 172, 173, 174, 176, 177, 178, 179,
@@ -2799,12 +2861,12 @@ _hb_ucd_i16[196] =
 static inline uint_fast8_t
 _hb_ucd_gc (unsigned u)
 {
-  return u<1114110u?_hb_ucd_u8[6808+(((_hb_ucd_u8[1312+(((_hb_ucd_u16[((_hb_ucd_u8[544+(((_hb_ucd_u8[u>>1>>3>>3>>4])<<4)+((u>>1>>3>>3)&15u))])<<3)+((u>>1>>3)&7u)])<<3)+((u>>1)&7u))])<<1)+((u)&1u))]:2;
+  return u<1114110u?_hb_ucd_u8[6472+(((_hb_ucd_u8[816+(((_hb_ucd_u16[((_hb_ucd_u8[272+(((_hb_ucd_u8[u>>1>>3>>4>>4])<<4)+((u>>1>>3>>4)&15u))])<<4)+((u>>1>>3)&15u)])<<3)+((u>>1)&7u))])<<1)+((u)&1u))]:2;
 }
 static inline uint_fast8_t
 _hb_ucd_ccc (unsigned u)
 {
-  return u<125259u?_hb_ucd_u8[8800+(((_hb_ucd_u8[8244+(((_hb_ucd_u8[7784+(((_hb_ucd_u8[7432+(((_hb_ucd_u8[7186+(u>>2>>2>>2>>3)])<<3)+((u>>2>>2>>2)&7u))])<<2)+((u>>2>>2)&3u))])<<2)+((u>>2)&3u))])<<2)+((u)&3u))]:0;
+  return u<125259u?_hb_ucd_u8[8504+(((_hb_ucd_u8[7936+(((_hb_ucd_u8[7460+(((_hb_ucd_u8[7100+(((_hb_ucd_u8[6854+(u>>2>>2>>2>>3)])<<3)+((u>>2>>2>>2)&7u))])<<2)+((u>>2>>2)&3u))])<<2)+((u>>2)&3u))])<<2)+((u)&3u))]:0;
 }
 static inline unsigned
 _hb_ucd_b4 (const uint8_t* a, unsigned i)
@@ -2814,107 +2876,76 @@ _hb_ucd_b4 (const uint8_t* a, unsigned i)
 static inline int_fast16_t
 _hb_ucd_bmg (unsigned u)
 {
-  return u<65380u?_hb_ucd_i16[((_hb_ucd_u8[9548+(((_hb_ucd_u8[9428+(((_hb_ucd_b4(9300+_hb_ucd_u8,u>>2>>3>>3))<<3)+((u>>2>>3)&7u))])<<3)+((u>>2)&7u))])<<2)+((u)&3u)]:0;
+  return u<65380u?_hb_ucd_i16[((_hb_ucd_u8[9252+(((_hb_ucd_u8[9132+(((_hb_ucd_b4(9004+_hb_ucd_u8,u>>2>>3>>3))<<3)+((u>>2>>3)&7u))])<<3)+((u>>2)&7u))])<<2)+((u)&3u)]:0;
 }
 static inline uint_fast8_t
 _hb_ucd_sc (unsigned u)
 {
-  return u<918000u?_hb_ucd_u8[11070+(((_hb_ucd_u16[2048+(((_hb_ucd_u8[10334+(((_hb_ucd_u8[9884+(u>>3>>4>>4)])<<4)+((u>>3>>4)&15u))])<<4)+((u>>3)&15u))])<<3)+((u)&7u))]:2;
+  return u<918000u?_hb_ucd_u8[10486+(((_hb_ucd_u16[3744+(((_hb_ucd_u16[2624+(((_hb_ucd_u8[9588+(u>>3>>3>>4)])<<4)+((u>>3>>3)&15u))])<<3)+((u>>3)&7u))])<<3)+((u)&7u))]:2;
 }
 static inline uint_fast16_t
 _hb_ucd_dm (unsigned u)
 {
-  return u<195102u?_hb_ucd_u16[6032+(((_hb_ucd_u8[17084+(((_hb_ucd_u8[16702+(u>>4>>5)])<<5)+((u>>4)&31u))])<<4)+((u)&15u))]:0;
+  return u<195102u?_hb_ucd_u16[6976+(((_hb_ucd_u8[16716+(((_hb_ucd_u8[16334+(u>>4>>5)])<<5)+((u>>4)&31u))])<<4)+((u)&15u))]:0;
 }
 
 
 #elif !defined(HB_NO_UCD_UNASSIGNED)
 
 static const uint8_t
-_hb_ucd_u8[14752] =
+_hb_ucd_u8[17524] =
 {
-    0,  1,  2,  3,  4,  5,  6,  7,  7,  8,  7,  7,  7,  7,  7,  7,
-    7,  7,  7,  7,  9, 10,  7,  7,  7,  7, 11, 12, 13, 13, 13, 14,
-   15, 16, 17, 18, 19, 20, 21, 22, 23, 22, 22, 22, 22, 24,  7,  7,
-   25, 26, 22, 22, 22, 27, 28, 29, 22, 30, 31, 32, 33, 34, 35, 36,
-    7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,
-    7,  7,  7,  7, 37,  7, 38, 39,  7, 40,  7,  7,  7, 41, 22, 42,
-    7,  7, 43,  7, 44, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
-   22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
-   22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
-   22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
-   22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
-   22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
-   22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
-   22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
-   22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
-   22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
-   22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
-   22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
-   22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
-   22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
-   22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
-   22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
-   22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
-   22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
-   22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
-   22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
-   22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
-   22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
-   45, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
-   22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
-   13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
-   13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 46,
-   13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
-   13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 47,
+    0,  1,  2,  3,  4,  5,  5,  5,  5,  5,  6,  5,  5,  7,  8,  9,
+   10, 11, 12, 13, 14, 15, 16,  5, 17, 15, 18, 19, 20, 21, 22, 23,
+    5,  5,  5,  5,  5,  5,  5,  5,  5,  5, 24, 25, 26,  5, 27, 28,
+    5, 29, 30, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
+   15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
+   15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
+   15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
+   15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
+   15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
+   15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
+   15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
+   15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
+   15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
+   15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
+   31, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,
+    8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8, 32,
+    8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8, 33,
     0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15,
-   16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,
-   32, 33, 34, 34, 35, 36, 37, 38, 39, 34, 34, 34, 40, 41, 42, 43,
-   44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
-   60, 61, 62, 63, 64, 64, 65, 66, 67, 68, 69, 70, 71, 69, 72, 73,
-   69, 69, 64, 74, 64, 64, 75, 76, 77, 78, 79, 80, 81, 82, 69, 83,
-   84, 85, 86, 87, 88, 89, 69, 69, 34, 34, 34, 34, 34, 34, 34, 34,
-   34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
-   34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 90, 34, 34, 34, 34,
-   91, 34, 34, 34, 34, 34, 34, 34, 34, 92, 34, 34, 93, 94, 95, 96,
-   97, 98, 99,100,101,102,103,104, 34, 34, 34, 34, 34, 34, 34, 34,
-   34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,105,
-  106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,106,
-  107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,
-  107,107, 34, 34,108,109,110,111, 34, 34,112,113,114,115,116,117,
-  118,119,120,121,122,123,124,125,126,127,128,129, 34, 34,130,131,
-  132,133,134,135,136,137,138,139,140,141,142,122,143,144,145,146,
-  147,148,149,150,151,152,153,122,154,155,122,156,157,158,159,122,
-  160,161,162,163,164,165,166,122,167,168,169,170,122,171,172,173,
-   34, 34, 34, 34, 34, 34, 34,174,175, 34,176,122,122,122,122,122,
-  122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,177,
-   34, 34, 34, 34, 34, 34, 34, 34,178,122,122,122,122,122,122,122,
-  122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,
-  122,122,122,122,122,122,122,122, 34, 34, 34, 34,179,122,122,122,
-   34, 34, 34, 34,180,181,182,183,122,122,122,122,184,185,186,187,
-   34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,188,
-   34, 34, 34, 34, 34, 34, 34, 34, 34,189,190,122,122,122,122,122,
-  122,122,122,122,122,122,122,122,122,122,122,122,122,122,122,191,
-   34, 34,192, 34, 34,193,122,122,122,122,122,122,122,122,122,122,
-  122,122,122,122,122,122,122,122,194,195,122,122,122,122,122,122,
-  122,122,122,122,122,122,122,122,122,122,122,122,122,122,196,197,
-   69,198,199,200,201,202,203,122,204,205,206,207,208,209,210,211,
-   69, 69, 69, 69,212,213,122,122,122,122,122,122,122,122,214,122,
-  215,216,217,122,122,218,122,122,122,219,122,122,122,122,122,220,
-   34,221,222,122,122,122,122,122,223,224,225,122,226,227,122,122,
-  228,229,230,231,232,122, 69,233, 69, 69, 69, 69, 69,234,235,236,
-  237,238, 69, 69,239,240, 69,241,122,122,122,122,122,122,122,122,
-   34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,242, 34, 34,
-   34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,243, 34,
-  244, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
-   34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,245, 34, 34,
-   34, 34, 34, 34, 34, 34, 34,246, 34, 34, 34, 34,247,122,122,122,
-   34, 34, 34, 34,248,122,122,122,122,122,122,122,122,122,122,122,
-   34, 34, 34, 34, 34, 34,249, 34, 34, 34, 34, 34, 34, 34, 34, 34,
-   34, 34, 34, 34, 34, 34, 34,250,122,122,122,122,122,122,122,122,
-  251,122,252,253,122,122,122,122,122,122,122,122,122,122,122,122,
-  107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,254,
-  107,107,107,107,107,107,107,107,107,107,107,107,107,107,107,255,
+   16, 17, 18, 19, 20, 17, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30,
+   31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 33, 41, 42, 43, 44, 45,
+   46, 47, 48, 39, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
+   17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 49, 17, 17,
+   17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
+   50, 17, 17, 17, 51, 17, 52, 53, 54, 55, 56, 57, 17, 17, 17, 17,
+   17, 17, 17, 17, 17, 17, 17, 58, 59, 59, 59, 59, 59, 59, 59, 59,
+   60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
+   60, 60, 60, 60, 60, 60, 60, 60, 60, 17, 61, 62, 17, 63, 64, 65,
+   66, 67, 68, 69, 70, 71, 17, 72, 73, 74, 75, 76, 77, 78, 79, 80,
+   81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96,
+   17, 17, 17, 97, 98, 99,100,100,100,100,100,100,100,100,100,101,
+   17, 17, 17, 17,102, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
+   17, 17, 17,103, 17, 17,104,100,100,100,100,100,100,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,105,100,100,100,100,100,100, 17, 17,106,107,100,108,109,110,
+   17, 17, 17, 17, 17, 17, 17,111, 17, 17, 17, 17,112,113,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,114,
+   17,115,116,100,100,100,100,100,100,100,100,100,117,100,100,100,
+  100,100,100,100,100,100,100,100,100,100,100,100,118, 39,119,120,
+  121,122,123,124,125,126,127,128, 39, 39,129,100,100,100,100,130,
+  131,132,133,100,134,135,100,136,137,138,100,100,139,140,141,100,
+  142,143,144,145, 39, 39,146,147,148, 39,149,150,100,100,100,100,
+   17, 17, 17, 17, 17, 17,151, 17, 17, 17, 17, 17, 17, 17, 17, 17,
+   17, 17, 17, 17, 17, 17, 17,152,153, 17, 17, 17, 17, 17, 17, 17,
+   17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,154, 17,
+   17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,155, 17, 17,156,100,
+  100,100,100,100,100,100,100,100, 17, 17,157,100,100,100,100,100,
+   17, 17, 17,158, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
+   17, 17, 17,159,100,100,100,100,100,100,100,100,100,100,100,100,
+  160,161,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
+   60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60,162,
+   60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60,163,
     0,  0,  0,  0,  0,  0,  0,  0,  1,  2,  3,  2,  4,  5,  6,  2,
     7,  7,  7,  7,  7,  2,  8,  9, 10, 11, 11, 11, 11, 11, 11, 11,
    11, 11, 11, 11, 11, 12, 13, 14, 15, 16, 16, 16, 16, 16, 16, 16,
@@ -2951,7 +2982,7 @@ _hb_ucd_u8[14752] =
    43, 43, 40, 21,  2, 81, 57, 20, 36, 36, 36, 43, 43, 75, 43, 43,
    43, 43, 75, 43, 75, 43, 43, 44,  2,  2,  2,  2,  2,  2,  2, 64,
    36, 36, 36, 36, 70, 43, 44, 64, 36, 36, 36, 36, 36, 61, 44, 44,
-   36, 36, 36, 36, 82, 36, 36, 61, 65, 44, 44, 44, 43, 43, 43, 43,
+   36, 36, 36, 36, 82, 36, 36, 61, 65, 44, 44, 57, 43, 43, 43, 43,
    36, 36, 36, 36, 83, 43, 43, 43, 43, 84, 43, 43, 43, 43, 43, 43,
    43, 85, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 85, 71, 86,
    87, 43, 43, 43, 85, 86, 87, 86, 70, 43, 43, 43, 36, 36, 36, 36,
@@ -3024,13 +3055,13 @@ _hb_ucd_u8[14752] =
    85, 85, 87, 43, 43, 43, 85, 86, 86, 87, 43, 43, 43, 43, 80, 57,
     2,  2,  2, 88,  2,  2,  2, 44, 43, 43, 43, 43, 43, 43, 43,109,
    43, 43, 43, 43, 43, 43, 43, 80, 43, 43, 98, 36, 36, 36, 36, 36,
-   36, 36, 85, 43, 43, 85, 85, 86, 86, 85, 98, 36, 36, 36, 61, 44,
-   97, 67, 67, 67, 67, 50, 43, 43, 43, 43, 67, 67, 67, 67, 21, 64,
+   36, 36, 85, 43, 43, 85, 85, 86, 86, 85, 98, 36, 36, 36, 61,  2,
+   97, 67, 67, 67, 67, 50, 43, 43, 43, 43, 67, 67, 67, 67, 21,  2,
    43, 98, 36, 36, 36, 36, 36, 36, 94, 43, 43, 86, 43, 87, 43, 36,
    36, 36, 36, 85, 43, 86, 87, 87, 43, 86, 44, 44, 44, 44,  2,  2,
    36, 36, 86, 86, 86, 86, 43, 43, 43, 43, 86, 43, 44, 93,  2,  2,
     7,  7,  7,  7,  7, 44, 62, 36, 36, 36, 36, 36, 40, 40, 40,  2,
-   16, 16, 16, 16,110, 44, 44, 44, 11, 11, 11, 11, 11, 47, 48, 11,
+   16, 16, 16, 16, 34,110, 44, 44, 11, 11, 11, 11, 11, 47, 48, 11,
     2,  2,  2,  2, 44, 44, 44, 44, 43, 60, 43, 43, 43, 43, 43, 43,
    85, 43, 43, 43, 71, 36, 70, 36, 36, 36, 71, 94, 43, 61, 44, 44,
    16, 16, 16, 16, 16, 16, 40, 40, 40, 40, 40, 40, 40, 45, 16, 16,
@@ -3058,33 +3089,33 @@ _hb_ucd_u8[14752] =
    67, 67, 67, 67,  4,  4, 67, 67,  8, 67, 67, 67,145,146, 67, 67,
    67, 67, 67, 67, 67, 67,144, 67, 67, 67, 67, 67, 67, 26,  8,  8,
     8,  8, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67,  8,  8,
-    8, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 92, 44, 44, 44, 44,
-   67, 67, 67, 67, 67, 92, 44, 44, 27, 27, 27, 27, 27, 27, 67, 67,
-   67, 67, 67, 67, 67, 27, 27, 27, 67, 67, 67, 26, 67, 67, 67, 67,
-   26, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67,  8,  8,  8,  8,
-   67, 67, 67, 67, 67, 67, 67, 26, 67, 67, 67, 67,  4,  4,  4,  4,
-    4,  4,  4, 27, 27, 27, 27, 27, 27, 27, 67, 67, 67, 67, 67, 67,
-    8,  8,129,147,  8,  8,  8,  8,  8,  8,  8,  4,  4,  4,  4,  4,
-    8,129,148,148,148,148,148,148,148,148,148,148,147,  8,  8,  8,
-    8,  8,  8,  8,  4,  4,  8,  8,  8,  8,  8,  8,  8,  8,  4,  8,
-    8,  8,144, 26,  8,  8,144, 67, 67, 67, 44, 67, 67, 67, 67, 67,
-   67, 67, 67, 55, 67, 67, 67, 67, 32, 11, 32, 34, 34, 34, 34, 11,
-   32, 32, 34, 16, 16, 16, 40, 11, 32, 32,140, 67, 67,138, 34,149,
-   43, 32, 44, 44, 93,  2, 99,  2, 16, 16, 16,150, 44, 44,150, 44,
-   36, 36, 36, 36, 44, 44, 44, 52, 64, 44, 44, 44, 44, 44, 44, 57,
-   36, 36, 36, 61, 44, 44, 44, 44, 36, 36, 36, 61, 36, 36, 36, 61,
-    2,121,121,  2,125,126,121,  2,  2,  2,  2,  6,  2,108,121,  2,
-  121,  4,  4,  4,  4,  2,  2, 88,  2,  2,  2,  2,  2,120,  2,  2,
-  108,151,  2,  2,  2,  2,  2,  2, 67,  2,152,148,148,148,153, 44,
-   67, 67, 67, 67, 67, 55, 67, 67, 67, 67, 44, 44, 44, 44, 44, 44,
-   67, 67, 67, 44, 44, 44, 44, 44,  1,  2,154,155,  4,  4,  4,  4,
-    4, 67,  4,  4,  4,  4,156,157,158,105,105,105,105, 43, 43, 86,
-  159, 40, 40, 67,105,160, 63, 67, 36, 36, 36, 61, 57,161,162, 69,
-   36, 36, 36, 36, 36, 63, 40, 69, 44, 44, 62, 36, 36, 36, 36, 36,
-   67, 27, 27, 67, 67, 67, 67, 67, 67, 67, 44, 44, 44, 44, 44, 55,
-   67, 67, 67, 67, 67, 67, 67, 92, 27, 27, 27, 27, 27, 67, 67, 67,
-   67, 67, 67, 67, 27, 27, 27, 27,163, 27, 27, 27, 27, 27, 27, 27,
-   36, 36, 83, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,164,  2,
+    8, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 67, 92, 44, 44,
+   27, 27, 27, 27, 27, 27, 67, 67, 67, 67, 67, 67, 67, 27, 27, 27,
+   67, 67, 67, 26, 67, 67, 67, 67, 26, 67, 67, 67, 67, 67, 67, 67,
+   67, 67, 67, 67,  8,  8,  8,  8, 67, 67, 67, 67, 67, 67, 67, 26,
+   67, 67, 67, 67,  4,  4,  4,  4,  4,  4,  4, 27, 27, 27, 27, 27,
+   27, 27, 67, 67, 67, 67, 67, 67,  8,  8,129,147,  8,  8,  8,  8,
+    8,  8,  8,  4,  4,  4,  4,  4,  8,129,148,148,148,148,148,148,
+  148,148,148,148,147,  8,  8,  8,  8,  8,  8,  8,  4,  4,  8,  8,
+    8,  8,  8,  8,  8,  8,  4,  8,  8,  8,144, 26,  8,  8,144, 67,
+   67, 67, 44, 67, 67, 67, 67, 67, 67, 67, 67, 55, 67, 67, 67, 67,
+   32, 11, 32, 34, 34, 34, 34, 11, 32, 32, 34, 16, 16, 16, 40, 11,
+   32, 32,140, 67, 67,138, 34,149, 43, 32, 44, 44, 93,  2, 99,  2,
+   16, 16, 16,150, 44, 44,150, 44, 36, 36, 36, 36, 44, 44, 44, 52,
+   64, 44, 44, 44, 44, 44, 44, 57, 36, 36, 36, 61, 44, 44, 44, 44,
+   36, 36, 36, 61, 36, 36, 36, 61,  2,121,121,  2,125,126,121,  2,
+    2,  2,  2,  6,  2,108,121,  2,121,  4,  4,  4,  4,  2,  2, 88,
+    2,  2,  2,  2,  2,120,  2,  2,108,151,  2,  2,  2,  2,  2,  2,
+   67,  2,152,148,148,148,153, 44, 67, 67, 67, 67, 67, 55, 67, 67,
+   67, 67, 44, 44, 44, 44, 44, 44, 67, 67, 67, 44, 44, 44, 44, 44,
+    1,  2,154,155,  4,  4,  4,  4,  4, 67,  4,  4,  4,  4,156,157,
+  158,105,105,105,105, 43, 43, 86,159, 40, 40, 67,105,160, 63, 67,
+   36, 36, 36, 61, 57,161,162, 69, 36, 36, 36, 36, 36, 63, 40, 69,
+   44, 44, 62, 36, 36, 36, 36, 36, 67, 27, 27, 67, 67, 67, 67, 67,
+   67, 67, 67, 44, 44, 44, 44, 55, 67, 67, 67, 67, 67, 67, 67, 92,
+   27, 27, 27, 27, 27, 67, 67, 67, 67, 67, 67, 67, 27, 27, 27, 27,
+  163, 27, 27, 27, 27, 27, 27, 27, 36, 36, 83, 36, 36, 36, 36, 36,
+   67, 67, 67, 92, 44, 44, 44, 44, 36, 36, 36, 36, 36, 36,164,  2,
     7,  7,  7,  7,  7, 36, 44, 44, 32, 32, 32, 32, 32, 32, 32, 70,
    51,165, 43, 43, 43, 43, 43, 88, 32, 32, 32, 32, 32, 32, 40, 43,
    36, 36, 36,105,105,105,105,105, 43,  2,  2,  2, 44, 44, 44, 44,
@@ -3092,7 +3123,7 @@ _hb_ucd_u8[14752] =
    16, 32, 32, 32, 32, 32, 32, 32, 45, 16, 16, 16, 34, 34, 34, 32,
    32, 32, 32, 32, 42,166, 34, 35, 32, 32, 16, 32, 32, 32, 32, 32,
    32, 32, 32, 32, 32, 11, 11, 32, 11, 11, 32, 32, 32, 32, 32, 32,
-   32, 32, 11, 11, 34,110, 44, 44, 32,150,150, 32, 32, 44, 44, 44,
+   32, 32, 11, 11, 34, 34, 32, 44, 32,150,150, 32, 32, 32, 47, 44,
    44, 40,167, 35, 40, 35, 36, 36, 36, 71, 36, 71, 36, 70, 36, 36,
    36, 94, 87, 85, 67, 67, 80, 44, 27, 27, 27, 67,168, 44, 44, 44,
    36, 36,  2,  2, 44, 44, 44, 44, 86, 36, 36, 36, 36, 36, 36, 36,
@@ -3153,8 +3184,10 @@ _hb_ucd_u8[14752] =
    36, 61, 44, 44, 27, 27, 27, 27, 36, 44, 44, 44, 93,  2, 64, 44,
    44, 44, 44, 44,179, 27, 27, 27, 11, 47, 44, 44, 44, 44, 44, 44,
    16,110, 44, 44, 44, 27, 27, 27, 36, 36, 43, 43, 44, 44, 44, 44,
-   27, 27, 27, 27, 27, 27, 27,100, 36, 36, 36, 36, 36, 57,184, 44,
-   36, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 57, 43,
+    7,  7,  7,  7,  7, 36, 36, 69, 11, 11, 11, 44, 57, 43, 43,159,
+   16, 16, 16, 44, 44, 44, 44,  8, 27, 27, 27, 27, 27, 27, 27,100,
+   36, 36, 36, 36, 36, 57,184, 44, 36, 44, 44, 44, 44, 44, 44, 44,
+   44, 36, 61, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 43, 43,
    27, 27, 27, 95, 44, 44, 44, 44,180, 27, 30,  2,  2, 44, 44, 44,
    36, 43, 43,  2,  2, 44, 44, 44, 36, 36,183, 27, 27, 27, 44, 44,
    87, 98, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 43, 43, 43, 43,
@@ -3172,14 +3205,18 @@ _hb_ucd_u8[14752] =
    86, 87, 43, 43, 43, 80, 44, 44, 43, 86, 62, 36, 36, 36, 61, 62,
    61, 36, 62, 36, 36, 57, 71, 86, 85, 86, 90, 89, 90, 89, 86, 44,
    61, 44, 44, 89, 44, 44, 62, 36, 36, 86, 44, 43, 43, 43, 80, 44,
-   43, 43, 80, 44, 44, 44, 44, 44, 36, 36, 94, 86, 43, 43, 43, 43,
-   86, 43, 85, 71, 36, 63,  2,  2,  7,  7,  7,  7,  7,  2, 93, 71,
-   86, 87, 43, 43, 85, 85, 86, 87, 85, 43, 36, 72, 44, 44, 44, 44,
-   36, 36, 36, 36, 36, 36, 36, 94, 86, 43, 43, 44, 86, 86, 43, 87,
-   60,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2, 36, 36, 43, 44,
-   86, 87, 43, 43, 43, 85, 87, 87, 60,  2, 61, 44, 44, 44, 44, 44,
-    2,  2,  2,  2,  2,  2, 64, 44, 36, 36, 36, 36, 36, 70, 87, 86,
-   43, 43, 43, 87, 63, 44, 44, 44, 86, 43, 43, 87, 43, 43, 44, 44,
+   43, 43, 80, 44, 44, 44, 44, 44, 36, 36, 36, 36, 36, 62, 44, 61,
+   36, 36, 36, 62, 86, 87, 43, 43, 80, 90, 89, 89, 86, 90, 86, 85,
+   71, 71,  2, 93, 64, 44, 44, 44, 57, 80, 44, 44, 44, 44, 44, 44,
+   36, 36, 94, 86, 43, 43, 43, 43, 86, 43, 85, 71, 36, 63,  2,  2,
+    7,  7,  7,  7,  7,  2, 93, 71, 86, 87, 43, 43, 85, 85, 86, 87,
+   85, 43, 36, 72, 44, 44, 44, 44, 36, 36, 36, 36, 36, 36, 36, 94,
+   86, 43, 43, 44, 86, 86, 43, 87, 60,  2,  2,  2,  2,  2,  2,  2,
+    2,  2,  2,  2, 36, 36, 43, 44, 86, 87, 43, 43, 43, 85, 87, 87,
+   60,  2, 61, 44, 44, 44, 44, 44,  2,  2,  2,  2,  2,  2, 64, 44,
+   36, 36, 36, 36, 36, 70, 87, 86, 43, 43, 43, 87, 63, 44, 44, 44,
+    7,  7,  7,  7,  7,  7,  7,  7,  7,  7, 44, 44, 44, 44, 44, 44,
+   36, 36, 36, 36, 36, 61, 57, 87, 86, 43, 43, 87, 43, 43, 44, 44,
     7,  7,  7,  7,  7, 27,  2, 97, 43, 43, 43, 43, 87, 60, 44, 44,
    27,100, 44, 44, 44, 44, 44, 62, 36, 36, 36, 61, 62, 44, 36, 36,
    36, 36, 62, 61, 36, 36, 36, 36, 86, 86, 86, 89, 90, 57, 85, 71,
@@ -3189,49 +3226,52 @@ _hb_ucd_u8[14752] =
     2,  2,  2, 59, 44, 44, 44, 44, 70, 43, 43, 85, 87, 43, 36, 36,
    36, 36, 36, 36, 36, 43, 43, 43, 43, 43, 43, 85, 43,  2, 72,  2,
     2, 64, 44, 44, 44, 44, 44, 44,  2,  2,  2,  2,  2, 44, 44, 44,
-   43, 43, 43, 80, 43, 43, 43, 87, 63,  2,  2, 44, 44, 44, 44, 44,
-    2, 36, 36, 36, 36, 36, 36, 36, 44, 43, 43, 43, 43, 43, 43, 43,
-   43, 43, 43, 43, 89, 43, 43, 43, 85, 43, 87, 80, 44, 44, 44, 44,
-   36, 36, 36, 61, 36, 62, 36, 36, 70, 43, 43, 80, 44, 80, 43, 57,
-   43, 43, 43, 70, 44, 44, 44, 44, 36, 36, 36, 62, 61, 36, 36, 36,
-   36, 36, 36, 36, 36, 86, 86, 90, 43, 89, 87, 87, 61, 44, 44, 44,
-   36, 70, 85,107, 64, 44, 44, 44, 43, 94, 36, 36, 36, 36, 36, 36,
-   36, 36, 86, 43, 43, 80, 44, 86, 85, 60,  2,  2,  2,  2,  2,  2,
+   63, 44, 44, 44, 44, 44, 44, 44, 43, 43, 43, 80, 43, 43, 43, 87,
+   63,  2,  2, 44, 44, 44, 44, 44,  2, 36, 36, 36, 36, 36, 36, 36,
+   44, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43, 89, 43, 43, 43,
+   85, 43, 87, 80, 44, 44, 44, 44, 36, 36, 36, 61, 36, 62, 36, 36,
+   70, 43, 43, 80, 44, 80, 43, 57, 43, 43, 43, 70, 44, 44, 44, 44,
+   36, 36, 36, 62, 61, 36, 36, 36, 36, 36, 36, 36, 36, 86, 86, 90,
+   43, 89, 87, 87, 61, 44, 44, 44, 36, 70, 85,107, 64, 44, 44, 44,
+   43, 94, 36, 36, 36, 36, 36, 36, 36, 36, 86, 43, 43, 80, 44, 86,
+   85, 60,  2,  2,  2,  2,  2,  2,  7,  7,  7,  7,  7, 80, 44, 44,
    27, 27, 91, 67, 67, 67, 56, 20,168, 67, 67, 67, 67, 67, 67, 67,
    67, 44, 44, 44, 44, 44, 44, 93,105,105,105,105,105,105,105,181,
     2,  2, 64, 44, 44, 44, 44, 44, 63, 64, 44, 44, 44, 44, 44, 44,
    65, 65, 65, 65, 65, 65, 65, 65, 71, 36, 36, 70, 43, 43, 43, 43,
-   43, 43, 43, 44, 44, 44, 44, 44, 43, 43, 60, 44, 44, 44, 44, 44,
+   43, 43, 43, 44, 44, 44, 44, 44, 36, 36, 36, 36, 36, 36, 36, 43,
+   43, 43, 43, 43, 43, 86, 87, 43, 43, 43, 60, 44, 44, 44, 44, 44,
    43, 43, 43, 60,  2,  2, 67, 67, 40, 40, 97, 44, 44, 44, 44, 44,
     7,  7,  7,  7,  7,179, 27, 27, 27, 62, 36, 36, 36, 36, 36, 36,
-   36, 36, 36, 36, 44, 44, 62, 36, 27, 27, 27, 30,  2, 64, 44, 44,
+   36, 36, 36, 36, 44, 44, 62, 36, 40, 69, 36, 36, 36, 36, 36, 36,
+   36, 36, 36, 36, 36, 83,164,  2, 27, 27, 27, 30,  2, 64, 44, 44,
    36, 36, 36, 36, 36, 61, 44, 57, 94, 86, 86, 86, 86, 86, 86, 86,
    86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 86, 44, 44, 44, 57,
    43, 74, 40, 40, 40, 40, 40, 40, 40, 88, 80, 44, 44, 44, 44, 44,
-   86, 44, 44, 44, 44, 44, 44, 44, 40, 40, 52, 40, 40, 40, 52, 81,
-   36, 61, 44, 44, 44, 44, 44, 44, 44, 61, 44, 44, 44, 44, 44, 44,
-   36, 61, 62, 44, 44, 44, 44, 44, 44, 44, 36, 36, 44, 44, 44, 44,
-   36, 36, 36, 36, 36, 44, 50, 60, 65, 65, 44, 44, 44, 44, 44, 44,
-   43, 43, 43, 43, 43, 43, 43, 44, 43, 43, 43, 80, 44, 44, 44, 44,
-   67, 67, 67, 92, 55, 67, 67, 67, 67, 67,186, 87, 43, 67,186, 86,
-   86,187, 65, 65, 65, 84, 43, 43, 43, 76, 50, 43, 43, 43, 67, 67,
-   67, 67, 67, 67, 67, 43, 43, 67, 67, 43, 76, 44, 44, 44, 44, 44,
-   27, 27, 44, 44, 44, 44, 44, 44, 11, 11, 11, 11, 11, 16, 16, 16,
-   16, 16, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 16,
-   16, 16,110, 16, 16, 16, 16, 16, 11, 16, 16, 16, 16, 16, 16, 16,
-   16, 16, 16, 16, 16, 16, 47, 11, 44, 47, 48, 47, 48, 11, 47, 11,
-   11, 11, 11, 16, 16,150,150, 16, 16, 16,150, 16, 16, 16, 16, 16,
-   16, 16, 11, 48, 11, 47, 48, 11, 11, 11, 47, 11, 11, 11, 47, 16,
-   16, 16, 16, 16, 11, 48, 11, 47, 11, 11, 47, 47, 44, 11, 11, 11,
-   47, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 11, 11,
-   11, 11, 11, 16, 16, 16, 16, 16, 16, 16, 16, 44, 11, 11, 11, 11,
-   31, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 33, 16, 16,
-   16, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 31, 16, 16,
-   16, 16, 33, 16, 16, 16, 11, 11, 11, 11, 31, 16, 16, 16, 16, 16,
-   16, 16, 16, 16, 16, 16, 16, 33, 16, 16, 16, 11, 11, 11, 11, 11,
-   11, 11, 11, 11, 11, 11, 11, 31, 16, 16, 16, 16, 33, 16, 16, 16,
-   11, 11, 11, 11, 31, 16, 16, 16, 16, 33, 16, 16, 16, 32, 44,  7,
-    7,  7,  7,  7,  7,  7,  7,  7, 43, 43, 43, 76, 67, 50, 43, 43,
+   86, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 62,
+   40, 40, 52, 40, 40, 40, 52, 81, 36, 61, 44, 44, 44, 44, 44, 44,
+   44, 61, 44, 44, 44, 44, 44, 44, 36, 61, 62, 44, 44, 44, 44, 44,
+   44, 44, 36, 36, 44, 44, 44, 44, 36, 36, 36, 36, 36, 44, 50, 60,
+   65, 65, 44, 44, 44, 44, 44, 44, 43, 43, 43, 43, 43, 43, 43, 44,
+   43, 43, 43, 80, 44, 44, 44, 44, 67, 67, 67, 92, 55, 67, 67, 67,
+   67, 67,186, 87, 43, 67,186, 86, 86,187, 65, 65, 65, 84, 43, 43,
+   43, 76, 50, 43, 43, 43, 67, 67, 67, 67, 67, 67, 67, 43, 43, 67,
+   67, 43, 76, 44, 44, 44, 44, 44, 27, 27, 44, 44, 44, 44, 44, 44,
+   11, 11, 11, 11, 11, 16, 16, 16, 16, 16, 11, 11, 11, 11, 11, 11,
+   11, 11, 11, 11, 11, 11, 11, 16, 16, 16,110, 16, 16, 16, 16, 16,
+   11, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 47, 11,
+   44, 47, 48, 47, 48, 11, 47, 11, 11, 11, 11, 16, 16,150,150, 16,
+   16, 16,150, 16, 16, 16, 16, 16, 16, 16, 11, 48, 11, 47, 48, 11,
+   11, 11, 47, 11, 11, 11, 47, 16, 16, 16, 16, 16, 11, 48, 11, 47,
+   11, 11, 47, 47, 44, 11, 11, 11, 47, 16, 16, 16, 16, 16, 16, 16,
+   16, 16, 16, 16, 16, 16, 11, 11, 11, 11, 11, 16, 16, 16, 16, 16,
+   16, 16, 16, 44, 11, 11, 11, 11, 31, 16, 16, 16, 16, 16, 16, 16,
+   16, 16, 16, 16, 16, 33, 16, 16, 16, 11, 11, 11, 11, 11, 11, 11,
+   11, 11, 11, 11, 11, 31, 16, 16, 16, 16, 33, 16, 16, 16, 11, 11,
+   11, 11, 31, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 33,
+   16, 16, 16, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 31,
+   16, 16, 16, 16, 33, 16, 16, 16, 11, 11, 11, 11, 31, 16, 16, 16,
+   16, 33, 16, 16, 16, 32, 44,  7, 43, 43, 43, 76, 67, 50, 43, 43,
    43, 43, 43, 43, 43, 43, 76, 67, 67, 67, 50, 67, 67, 67, 67, 67,
    67, 67, 76, 21,  2,  2, 44, 44, 44, 44, 44, 44, 44, 57, 43, 43,
    16, 16, 16, 16, 16, 39, 16, 16, 16, 16, 16, 16, 16, 16, 16,110,
@@ -3241,22 +3281,23 @@ _hb_ucd_u8[14752] =
    43, 43, 43, 74, 40, 40, 40, 44,  7,  7,  7,  7,  7, 44, 44, 77,
    36, 36, 36, 36, 36, 36, 36, 80, 36, 36, 36, 36, 36, 36, 43, 43,
     7,  7,  7,  7,  7, 44, 44, 96, 36, 36, 36, 36, 36, 83, 43, 43,
-   36, 36, 36, 61, 36, 36, 62, 61, 36, 36, 61,179, 27, 27, 27, 27,
-   16, 16, 43, 43, 43, 74, 44, 44, 27, 27, 27, 27, 27, 27,163, 27,
-  188, 27,100, 44, 44, 44, 44, 44, 27, 27, 27, 27, 27, 27, 27,163,
-   27, 27, 27, 27, 27, 27, 27, 44, 36, 36, 62, 36, 36, 36, 36, 36,
-   62, 61, 61, 62, 62, 36, 36, 36, 36, 61, 36, 36, 62, 62, 44, 44,
-   44, 61, 44, 62, 62, 62, 62, 36, 62, 61, 61, 62, 62, 62, 62, 62,
-   62, 61, 61, 62, 36, 61, 36, 36, 36, 61, 36, 36, 62, 36, 61, 61,
-   36, 36, 36, 36, 36, 62, 36, 36, 62, 36, 62, 36, 36, 62, 36, 36,
-    8, 44, 44, 44, 44, 44, 44, 44, 67, 67, 67, 67, 67, 67, 44, 44,
-   55, 67, 67, 67, 67, 67, 67, 67, 27, 27, 27, 27, 27, 27, 91, 67,
-   67, 67, 67, 67, 67, 67, 67, 44, 44, 44, 44, 67, 67, 67, 67, 67,
-   67, 92, 44, 44, 44, 44, 44, 44, 67, 67, 67, 67, 92, 44, 44, 44,
-   67, 44, 44, 44, 44, 44, 44, 44, 67, 67, 67, 67, 67, 25, 41, 41,
-   67, 67, 67, 67, 44, 44, 67, 67, 67, 67, 67, 92, 44, 55, 67, 67,
-   67, 67, 67, 67, 44, 44, 44, 44, 67, 67, 67, 67, 67, 67, 67, 55,
-   67, 67, 67, 44, 44, 44, 44, 67, 67, 92, 67, 67, 67, 67, 67, 67,
+  188,  7,  7,  7,  7,189, 44, 93, 36, 36, 36, 61, 36, 36, 62, 61,
+   36, 36, 61,179, 27, 27, 27, 27, 16, 16, 43, 43, 43, 74, 44, 44,
+   27, 27, 27, 27, 27, 27,163, 27,190, 27,100, 44, 44, 44, 44, 44,
+   27, 27, 27, 27, 27, 27, 27,163, 27, 27, 27, 27, 27, 27, 27, 44,
+   36, 36, 62, 36, 36, 36, 36, 36, 62, 61, 61, 62, 62, 36, 36, 36,
+   36, 61, 36, 36, 62, 62, 44, 44, 44, 61, 44, 62, 62, 62, 62, 36,
+   62, 61, 61, 62, 62, 62, 62, 62, 62, 61, 61, 62, 36, 61, 36, 36,
+   36, 61, 36, 36, 62, 36, 61, 61, 36, 36, 36, 36, 36, 62, 36, 36,
+   62, 36, 62, 36, 36, 62, 36, 36,  8, 44, 44, 44, 44, 44, 44, 44,
+   67, 67, 67, 67, 67, 67, 44, 44, 55, 67, 67, 67, 67, 67, 67, 67,
+   27, 27, 27, 27, 27, 27, 91, 67, 67, 67, 67, 67, 67, 67, 67, 44,
+   44, 44, 44, 67, 67, 67, 67, 67, 67, 92, 44, 44, 44, 44, 44, 44,
+   67, 67, 67, 67, 92, 44, 44, 44, 67, 44, 44, 44, 44, 44, 44, 44,
+   67, 67, 67, 67, 67, 25, 41, 41, 67, 67, 67, 67, 44, 44, 67, 67,
+   67, 67, 67, 92, 44, 55, 67, 67, 67, 67, 67, 67, 44, 44, 44, 44,
+   67, 67, 67, 67, 67, 44, 44, 55, 67, 67, 67, 92, 44, 44, 44, 67,
+   67, 67, 67, 67, 67, 67, 92, 55, 67, 92, 67, 67, 67, 67, 67, 67,
    79, 44, 44, 44, 44, 44, 44, 44,171,171,171,171,171,171,171, 44,
   171,171,171,171,171,171,171,  0,  0,  0, 29, 21, 21, 21, 23, 21,
    22, 18, 21, 25, 21, 17, 13, 13, 25, 25, 25, 21, 21,  9,  9,  9,
@@ -3282,420 +3323,609 @@ _hb_ucd_u8[14752] =
     6, 21, 11, 21, 24,  9,  6,  9, 23, 26,  6, 10,  4,  4,  3,  3,
     7, 25, 17, 16, 16, 22, 16, 16, 25, 17, 25,  2, 25, 24,  2, 15,
    12, 15, 14,  2, 21, 14,  7, 15, 12, 17, 21,  1, 26, 10, 10,  1,
-   23, 15,  0,  1,  2,  3,  4,  5,  6,  7,  8,  9,  0, 10, 11, 12,
-   13,  0, 14,  0,  0,  0,  0,  0, 15,  0, 16,  0,  0,  0,  0,  0,
+    7, 13, 13,  2, 23, 15,  0,  1,  2,  3,  4,  5,  6,  7,  8,  9,
+    0, 10, 11, 12, 13,  0, 14,  0,  0,  0,  0,  0, 15,  0, 16,  0,
     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-    0,  0,  0,  0,  0, 17, 18, 19,  0,  0,  0,  0,  0,  0,  0,  0,
+    0,  0,  0,  0,  0,  0,  0,  0,  0, 17, 18, 19,  0,  0,  0,  0,
     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 20,
-    0, 21, 22, 23,  0,  0,  0, 24, 25, 26, 27, 28, 29, 30, 31, 32,
-   33, 34,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-    0,  0,  0,  0,  0,  0,  0, 35,  0, 36,  0,  0,  0,  0,  0,  0,
+    0,  0,  0, 20,  0, 21, 22, 23,  0,  0,  0, 24, 25, 26, 27, 28,
+   29, 30, 31, 32, 33, 34,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+    0,  0,  0,  0,  0,  0, 35,  0,  0,  0,  0, 36,  0, 37,  0,  0,
     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-   37,  0,  0,  0,  0,  0,  0,  0,  0,  0, 38, 39,  0,  0,  0,  0,
-    0,  0, 40, 41, 42,  0, 43,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-    0,  0,  0,  0,  1,  2,  0,  0,  0,  0,  3,  0,  0,  0,  4,  5,
-    6,  7,  0,  8,  9, 10,  0, 11, 12, 13, 14, 15, 16, 17, 16, 18,
-   16, 19, 16, 19, 16, 19,  0, 19, 16, 20, 16, 19, 21, 19,  0, 22,
-   23, 24, 25, 26, 27, 28, 29, 30, 31,  0, 32,  0,  0,  0,  0,  0,
-    0,  0,  0,  0,  0, 33,  0,  0,  0,  0,  0,  0, 34,  0,  0, 35,
-    0,  0, 36,  0, 37,  0,  0,  0, 38, 39, 40, 41, 42, 43, 44, 45,
-   46,  0,  0, 47,  0,  0,  0, 48,  0,  0,  0, 49,  0,  0,  0,  0,
-    0,  0,  0, 50,  0, 51,  0, 52, 53,  0, 54,  0,  0,  0,  0,  0,
-    0, 55, 56, 57,  0,  0,  0,  0, 58,  0,  0, 59, 60, 61, 62, 63,
-    0,  0, 64, 65,  0,  0,  0, 66,  0,  0,  0,  0, 67,  0,  0,  0,
-   68,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 69,
-    0,  0,  0, 70,  0, 71,  0,  0, 72,  0,  0, 73,  0,  0,  0,  0,
-    0,  0,  0,  0, 74,  0,  0,  0,  0,  0, 75, 76,  0, 77, 78,  0,
-    0, 79, 80,  0, 81, 62,  0, 82, 83,  0,  0, 84, 85, 86,  0,  0,
-    0, 87,  0, 88,  0,  0, 51, 89, 51,  0, 90,  0, 91,  0,  0,  0,
-   80,  0,  0,  0, 92, 93,  0, 94, 95, 96, 97,  0,  0,  0,  0,  0,
-   51,  0,  0,  0,  0, 98, 99,  0,  0,  0,  0,  0,  0,100,  0,  0,
-    0,  0,  0,101,102,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,103,
-    0,  0,104,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,105,106,  0,
-    0,107,  0,  0,  0,  0,  0,  0,108,  0,109,  0,102,  0,  0,  0,
-    0,  0,110,111,  0,  0,  0,  0,  0,  0,  0,112,  0,  0,  0,  0,
-    0,  0,  0,113,  0,114,  0,  0,  0,  0,  0,  0,  1,  2,  3,  4,
-    5,  6,  7,  0,  8,  0,  0,  0,  0,  9, 10, 11, 12,  0,  0,  0,
-    0, 13,  0,  0, 14, 15,  0, 16,  0, 17, 18,  0,  0, 19,  0, 20,
-   21,  0,  0,  0,  0,  0, 22, 23,  0, 24, 25,  0,  0, 26,  0,  0,
-    0, 27,  0,  0, 28, 29, 30, 31,  0,  0,  0, 32, 33, 34,  0,  0,
-   33,  0,  0, 35, 33,  0,  0,  0, 33, 36,  0,  0,  0,  0,  0, 37,
-   38,  0,  0,  0,  0,  0,  0, 39, 40,  0,  0,  0,  0,  0,  0, 41,
-   42,  0,  0,  0,  0, 43,  0, 44,  0,  0,  0, 45, 46,  0,  0,  0,
-   47,  0,  0,  0,  0,  0,  0, 48, 49,  0,  0,  0,  0, 50,  0,  0,
-    0, 51,  0, 52,  0, 53,  0,  0,  0,  0, 54,  0,  0,  0,  0, 55,
-    0, 56,  0,  0,  0,  0, 57, 58,  0,  0,  0, 59, 60,  0,  0,  0,
-    0,  0,  0, 61, 52,  0, 62, 63,  0,  0, 64,  0,  0,  0, 65, 66,
-    0,  0,  0, 67,  0, 68, 69, 70, 71, 72,  1, 73,  0, 74, 75, 76,
-    0,  0, 77, 78,  0,  0,  0, 79,  0,  0,  1,  1,  0,  0, 80,  0,
-    0, 81,  0,  0,  0,  0, 77, 82,  0, 83,  0,  0,  0,  0,  0, 78,
-   84,  0, 85,  0, 52,  0,  1, 78,  0,  0, 86,  0,  0, 87,  0,  0,
-    0,  0,  0, 88, 57,  0,  0,  0,  0,  0,  0, 89, 90,  0,  0, 84,
-    0,  0, 33,  0,  0, 91,  0,  0,  0,  0, 92,  0,  0,  0,  0, 49,
-    0,  0, 93,  0,  0,  0,  0, 94, 95,  0,  0, 96,  0,  0, 97,  0,
-    0,  0, 98,  0,  0,  0, 99,  0,  0,  0,  0,100,101, 93,  0,  0,
-  102,  0,  0,  0, 84,  0,  0,103,  0,  0,  0,104,105,  0,  0,106,
-  107,  0,  0,  0,  0,  0,  0,108,  0,  0,109,  0,  0,  0,  0,110,
-   33,  0,111,112,113, 35,  0,  0,114,  0,  0,  0,115,  0,  0,  0,
-    0,  0,  0,116,  0,  0,117,  0,  0,  0,  0,118, 88,  0,  0,  0,
-    0,  0, 57,  0,  0,  0,  0, 52,119,  0,  0,  0,  0,120,  0,  0,
-  121,  0,  0,  0,  0,119,  0,  0,122,  0,  0,  0,  0,  0,  0,123,
-    0,  0,  0,124,  0,  0,  0,125,  0,126,  0,  0,  0,  0,127,128,
-  129,  0,130,  0,131,  0,  0,  0,132,133,134,  0, 77,  0,  0,  0,
-    0,  0, 35,  0,  0,  0,135,  0,  0,  0,136,  0,  0,137,  0,  0,
-  138,  0,  0,  0,  0,  0,  0,  0,  1,  1,  1,  1,  1,  2,  3,  4,
-    5,  6,  7,  4,  4,  8,  9, 10,  1, 11, 12, 13, 14, 15, 16, 17,
-   18,  1,  1,  1, 19,  1,  0,  0, 20, 21, 22,  1, 23,  4, 21, 24,
-   25, 26, 27, 28, 29, 30,  0,  0,  1,  1, 31,  0,  0,  0, 32, 33,
-   34, 35,  1, 36, 37,  0,  0,  0,  0, 38,  1, 39, 14, 39, 40, 41,
-   42,  0,  0,  0, 43, 36, 44, 45, 21, 45, 46,  0,  0,  0, 19,  1,
-   21,  0,  0, 47,  0, 38, 48,  1,  1, 49, 49, 50,  0,  0, 51,  0,
-    0,  0, 52,  1,  0,  0, 38, 14,  4,  1,  1,  1, 53, 21, 43, 52,
-   54, 21, 35,  1,  0,  0,  0, 55,  0,  0,  0, 56, 57, 58,  0,  0,
-    0,  0,  0, 59,  0, 60,  0,  0,  0,  0, 61, 62,  0,  0, 63,  0,
-    0,  0, 64,  0,  0,  0, 65,  0,  0,  0, 66,  0,  0,  0, 67,  0,
-    0,  0, 68,  0,  0, 69, 70,  0, 71, 72, 73, 74, 75, 76,  0,  0,
-    0, 77,  0,  0,  0, 78, 79,  0,  0,  0,  0, 47,  0,  0,  0, 49,
-    0, 80,  0,  0,  0, 62,  0,  0, 63,  0,  0, 81,  0,  0, 82,  0,
-    0,  0, 83,  0,  0, 19, 84,  0, 62,  0,  0,  0,  0, 49,  1, 85,
-    1, 52, 15, 86, 36, 10, 21, 87,  0, 55,  0,  0,  0,  0, 19, 10,
-    1,  0,  0,  0,  0,  0, 88,  0,  0, 89,  0,  0, 88,  0,  0,  0,
-    0, 78,  0,  0, 87,  9, 12,  4, 90,  8, 91, 47,  0, 58, 50,  0,
-   21,  1, 21, 92, 93,  1,  1,  1,  1, 94, 95, 96, 97,  1, 98, 58,
-   81, 99,100,  4, 58,  0,  0,  0,  0,  0,  0, 19, 50,  0,  0,  0,
-    0,  0,  0, 61,  0,  0,101,102,  0,  0,103,  0,  0,  1,  1, 50,
-    0,  0,  0, 38,  0, 63,  0,  0,  0,  0,  0, 62,  0,  0,104, 68,
-   61,  0,  0,  0, 78,  0,  0,  0,105,106, 58, 38, 81,  0,  0,  0,
-    0,  0,  0,107,  1, 14,  4, 12, 84,  0,  0,  0,  0, 38, 87,  0,
-    0,  0,  0,108,  0,  0,109, 61,  0,110,  0,  0,  0,  1,  0,  0,
+    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+    0,  0,  0,  0, 38,  0,  0,  0,  0,  0,  0,  0,  0,  0, 39, 40,
+    0,  0,  0,  0,  0,  0, 41, 42, 43,  0, 44,  0,  0,  0,  0,  0,
+    0,  0,  0,  0,  0,  0,  0,  0,  1,  2,  0,  0,  0,  0,  3,  0,
+    0,  0,  4,  5,  6,  7,  0,  8,  9, 10,  0, 11, 12, 13, 14, 15,
+   16, 17, 16, 18, 16, 19, 16, 19, 16, 19,  0, 19, 16, 20, 16, 19,
+   21, 19,  0, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,  0, 32,  0,
+    0,  0,  0,  0,  0,  0,  0,  0,  0, 33,  0,  0,  0,  0,  0,  0,
+   34,  0,  0, 35,  0,  0, 36,  0, 37,  0,  0,  0, 38, 39, 40, 41,
+   42, 43, 44, 45, 46,  0,  0, 47,  0,  0,  0, 48,  0,  0,  0, 49,
+    0,  0,  0,  0,  0,  0,  0, 50,  0, 51,  0, 52, 53,  0, 54,  0,
+    0,  0,  0,  0,  0, 55, 56, 57,  0,  0,  0,  0, 58,  0,  0, 59,
+   60, 61, 62, 63,  0,  0, 64, 65,  0,  0,  0, 66,  0,  0,  0,  0,
+   67,  0,  0,  0, 68,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+    0,  0,  0, 69,  0,  0,  0, 70,  0, 71,  0,  0, 72,  0,  0, 73,
+    0,  0,  0,  0,  0,  0,  0,  0, 74, 75,  0,  0,  0,  0, 76, 77,
+    0, 78, 79,  0,  0, 80, 81,  0, 82, 62,  0, 83, 84,  0,  0, 85,
+   86, 87,  0, 88,  0, 89,  0, 90,  0,  0, 51, 91, 51,  0, 92,  0,
+   93,  0,  0,  0, 81,  0,  0,  0, 94, 95,  0, 96, 97, 98, 99,  0,
+    0,  0,  0,  0, 51,  0,  0,  0,  0,100,101,  0,  0,  0,  0,  0,
+    0,102,  0,  0,  0,  0,  0,  0,103,  0,  0,  0,  0,  0,  0,104,
+  105,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,106,  0,  0,107,  0,
+    0,  0,  0,  0,  0,  0,  0,  0,  0,108,109,  0,  0,110,  0,  0,
+    0,  0,  0,  0,111,  0,112,  0,105,  0,  0,  0,  0,  0,113,114,
+    0,  0,  0,  0,  0,  0,  0,115,  0,  0,  0,116,  0,  0,  0,117,
+    0,118,  0,  0,  0,  0,  0,  0,  1,  2,  3,  4,  5,  6,  7,  0,
+    8,  0,  0,  0,  0,  9, 10, 11, 12,  0,  0,  0,  0, 13,  0,  0,
+   14, 15,  0, 16,  0, 17, 18,  0,  0, 19,  0, 20, 21,  0,  0,  0,
+    0,  0, 22, 23,  0, 24, 25,  0,  0, 26,  0,  0,  0, 27,  0,  0,
+   28, 29, 30, 31,  0,  0,  0, 32, 33, 34,  0,  0, 33,  0,  0, 35,
+   33,  0,  0,  0, 33, 36,  0,  0,  0,  0,  0, 37, 38,  0,  0,  0,
+    0,  0,  0, 39, 40,  0,  0,  0,  0,  0,  0, 41, 42,  0,  0,  0,
+    0, 43,  0, 44,  0,  0,  0, 45, 46,  0,  0,  0, 47,  0,  0,  0,
+    0,  0,  0, 48, 49,  0,  0,  0,  0, 50,  0,  0,  0, 51,  0, 52,
+    0, 53,  0,  0,  0,  0, 54,  0,  0,  0,  0, 55,  0, 56,  0,  0,
+    0,  0, 57, 58,  0,  0,  0, 59, 60,  0,  0,  0,  0,  0,  0, 61,
+   52,  0, 62, 63,  0,  0, 64,  0,  0,  0, 65, 66,  0,  0,  0, 67,
+    0, 68, 69, 70, 71, 72,  1, 73,  0, 74, 75, 76,  0,  0, 77, 78,
+    0,  0,  0, 79,  0,  0,  1,  1,  0,  0, 80,  0,  0, 81,  0,  0,
+    0,  0, 77, 82,  0, 83,  0,  0,  0,  0,  0, 78, 84,  0, 85,  0,
+   52,  0,  1, 78,  0,  0, 86,  0,  0, 87,  0,  0,  0,  0,  0, 88,
+   57,  0,  0,  0,  0,  0,  0, 89, 90,  0,  0, 84,  0,  0, 33,  0,
+    0, 91,  0,  0,  0,  0, 92,  0,  0,  0,  0, 49,  0,  0, 93,  0,
+    0,  0,  0, 94, 95,  0,  0, 96,  0,  0, 97,  0,  0,  0, 98,  0,
+    0,  0, 99,  0,  0,  0,100,  0,  0,  0,  0,101,102, 93,  0,  0,
+  103,  0,  0,  0, 84,  0,  0,104,  0,  0,  0,105,106,  0,  0,107,
+  108,  0,  0,  0,  0,  0,  0,109,  0,  0,110,  0,  0,  0,  0,111,
+   33,  0,112,113,114, 57,  0,  0,115, 35,  0,  0,116,  0,  0,  0,
+  117,  0,  0,  0,  0,  0,  0,118,  0,  0,119,  0,  0,  0,  0,120,
+   88,  0,  0,  0,  0,  0, 57,  0,  0,  0,  0, 52,121,  0,  0,  0,
+    0,122,  0,  0,123,  0,  0,  0,  0,121,  0,  0,124,  0,  0,  0,
+    0,  0, 79,  0,  0,  0,  0,125,  0,  0,  0,126,  0,  0,  0,127,
+    0,128,  0,  0,  0,  0,129,130,131,  0,132,  0,133,  0,  0,  0,
+  134,135,136,  0, 77,  0,  0,  0,  0,  0, 35,  0,  0,  0,137,  0,
+    0,  0,138,  0,  0,  0,139,  0,  0,140,  0,  0,141,  0,  0,  0,
+    0,  0,  0,  0,  1,  1,  1,  1,  1,  2,  3,  4,  5,  6,  7,  4,
+    4,  8,  9, 10,  1, 11, 12, 13, 14, 15, 16, 17, 18,  1,  1,  1,
+   19,  1,  0,  0, 20, 21, 22,  1, 23,  4, 21, 24, 25, 26, 27, 28,
+   29, 30,  0,  0,  1,  1, 31,  0,  0,  0, 32, 33, 34, 35,  1, 36,
+   37,  0,  0,  0,  0, 38,  1, 39, 14, 39, 40, 41, 42,  0,  0,  0,
+   43, 36, 44, 45, 21, 45, 46,  0,  0,  0, 19,  1, 21,  0,  0, 47,
+    0, 38, 48,  1,  1, 49, 49, 50,  0,  0, 51,  0,  0, 19, 52,  1,
+    0,  0, 38, 14,  4,  1,  1,  1, 53, 21, 43, 52, 54, 21, 35,  1,
+    0,  0,  0, 55,  0,  0,  0, 56, 57, 58,  0,  0,  0,  0,  0, 59,
+    0, 60,  0,  0,  0,  0, 61, 62,  0,  0, 63,  0,  0,  0, 64,  0,
+    0,  0, 65,  0,  0,  0, 66,  0,  0,  0, 67,  0,  0,  0, 68,  0,
+    0, 69, 70,  0, 71, 72, 73, 74, 75, 76,  0,  0,  0, 77,  0,  0,
+    0, 78, 79,  0,  0,  0,  0, 47,  0,  0,  0, 49,  0, 80,  0,  0,
+    0, 62,  0,  0, 63,  0,  0, 81,  0,  0, 82,  0,  0,  0, 83,  0,
+    0, 19, 84,  0, 62,  0,  0,  0,  0, 49,  1, 85,  1, 52, 15, 86,
+   36, 10, 21, 87,  0, 55,  0,  0,  0,  0, 19, 10,  1,  0,  0,  0,
+    0,  0, 88,  0,  0, 89,  0,  0, 88,  0,  0,  0,  0, 78,  0,  0,
+   87,  9, 12,  4, 90,  8, 91, 47,  0, 58, 50,  0, 21,  1, 21, 92,
+   93,  1,  1,  1,  1, 94, 95, 96, 97,  1, 98, 58, 81, 99,100,  4,
+   58,  0,  0,  0,  0,  0,  0, 19, 50,  0,  0,  0,  0,  0,  0, 61,
+    0,  0,101,102,  0,  0,103,  0,  0,  1,  1, 50,  0,  0,  0, 38,
+    0, 63,  0,  0,  0,  0,  0, 62,  0,  0,104, 68, 61,  0,  0,  0,
+   78,  0,  0,  0,105,106, 58, 38, 81,  0,  0,  0,  0,  0,  0,107,
+    1, 14,  4, 12, 84,  0,  0,  0,  0, 38, 87,  0,  0,  0,  0,108,
+    0,  0,109, 61,  0,110,  0,  0,  0,  1,  0,  0,  0,  0, 49, 50,
     0,  0, 19, 58,  0,  0,  0, 51,  0,111, 14, 52,112, 41,  0,  0,
    62,  0,  0, 61,  0,  0,113,  0, 87,  0,  0,  0, 61, 62,  0,  0,
    62,  0, 89,  0,  0,113,  0,  0,  0,  0,114,  0,  0,  0, 78, 55,
-    0, 38,  1, 58,  1, 58,  0,  0, 63, 89,  0,  0,115,  0,  0,  0,
-   55,  0,  0,  0,  0,115,  0,  0,  0,  0, 61,  0,  0,  0,  0, 79,
-    0, 61,  0,  0,  0,  0, 56,  0, 89, 80,  0,  0, 79,  0,  0,  0,
-    8, 91,  0,  0,  1, 87,  0,  0,116,  0,  0,  0,  0,  0,  0,117,
-    0,118,119,120,121,  0,104,  4,122, 49, 23,  0,  0,  0, 38, 50,
-   38, 58,  0,  0,  1, 87,  1,  1,  1,  1, 39,  1, 48,105, 87,  0,
-    0,  0,  0,  1,  0,  0,  0,123,  4,122,  0,  0,  0,  1,124,  0,
-    0,  0,  0,  0,230,230,230,230,230,232,220,220,220,220,232,216,
-  220,220,220,220,220,202,202,220,220,220,220,202,202,220,220,220,
-    1,  1,  1,  1,  1,220,220,220,220,230,230,230,230,240,230,220,
-  220,220,230,230,230,220,220,  0,230,230,230,220,220,220,220,230,
-  232,220,220,230,233,234,234,233,234,234,233,230,  0,  0,  0,230,
-    0,220,230,230,230,230,220,230,230,230,222,220,230,230,220,220,
-  230,222,228,230, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 19, 20,
-   21, 22,  0, 23,  0, 24, 25,  0,230,220,  0, 18, 30, 31, 32,  0,
-    0,  0,  0, 27, 28, 29, 30, 31, 32, 33, 34,230,230,220,220,230,
-  220,230,230,220, 35,  0,  0,  0,  0,  0,230,230,230,  0,  0,230,
-  230,  0,220,230,230,220,  0,  0,  0, 36,  0,  0,230,220,230,230,
-  220,220,230,220,220,230,220,230,220,230,230,  0,  0,220,  0,  0,
-  230,230,  0,230,  0,230,230,230,230,230,  0,  0,  0,220,220,220,
-  230,220,220,220,230,230,  0,220, 27, 28, 29,230,  7,  0,  0,  0,
-    0,  9,  0,  0,  0,230,220,230,230,  0,  0,  0,  0,  0,230,  0,
-    0, 84, 91,  0,  0,  0,  0,  9,  9,  0,  0,  0,  0,  0,  9,  0,
-  103,103,  9,  0,107,107,107,107,118,118,  9,  0,122,122,122,122,
-  220,220,  0,  0,  0,220,  0,220,  0,216,  0,  0,  0,129,130,  0,
-  132,  0,  0,  0,  0,  0,130,130,130,130,  0,  0,130,  0,230,230,
-    9,  0,230,230,  0,  0,220,  0,  0,  0,  0,  7,  0,  9,  9,  0,
-    9,  9,  0,  0,  0,230,  0,  0,  0,228,  0,  0,  0,222,230,220,
-  220,  0,  0,  0,230,  0,  0,220,230,220,  0,220,230,230,230,  0,
-    0,  0,  9,  9,  0,  0,  7,  0,230,  0,  1,  1,  1,  0,  0,  0,
-  230,234,214,220,202,230,230,230,230,230,232,228,228,220,218,230,
-  233,220,230,220,230,230,  1,  1,  1,  1,  1,230,  0,  1,  1,230,
-  220,230,  1,  1,  0,  0,218,228,232,222,224,224,  0,  8,  8,  0,
-    0,  0,  0,220,230,  0,230,230,220,  0,  0,230,  0,  0, 26,  0,
-    0,220,  0,230,230,  1,220,  0,  0,230,220,  0,  0,  0,220,220,
-    0,  0,230,220,  0,  9,  7,  0,  0,  7,  9,  0,  0,  0,  9,  7,
-    6,  6,  0,  0,  0,  0,  1,  0,  0,216,216,  1,  1,  1,  0,  0,
-    0,226,216,216,216,216,216,  0,220,220,220,  0,232,232,220,230,
-  230,230,  7,  0, 16, 17, 17, 33, 17, 49, 17, 17, 84, 97,135,145,
-   26, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
+    0, 38,  1, 58,  1, 58,  0,  0,  0,  0,  0, 88, 63, 89,  0,  0,
+  115,  0,  0,  0, 55,  0,  0,  0,  0,115,  0,  0,  0,  0, 61,  0,
+    0,  0,  0, 79,  0, 61,  0,  0,  0,  0, 56,  0, 89, 80,  0,  0,
+   79,  0,  0,  0,  8, 91,  0,  0,  1, 87,  0,  0,116,  0,  0,  0,
+    0,  0,  0,117,  0,118,119,120,121,  0,104,  4,122, 49, 23,  0,
+    0,  0, 38, 50, 38, 58,  0,  0,  1, 87,  1,  1,  1,  1, 39,  1,
+   48,105, 87,  0,  0,  0,  0,  1,  0,  0,  0,123,  0,  0,  0,112,
+    4,122,  0,  0,  0,  1,124,  0,  0,  0,  0,  0,230,230,230,230,
+  230,232,220,220,220,220,232,216,220,220,220,220,220,202,202,220,
+  220,220,220,202,202,220,220,220,  1,  1,  1,  1,  1,220,220,220,
+  220,230,230,230,230,240,230,220,220,220,230,230,230,220,220,  0,
+  230,230,230,220,220,220,220,230,232,220,220,230,233,234,234,233,
+  234,234,233,230,  0,  0,  0,230,  0,220,230,230,230,230,220,230,
+  230,230,222,220,230,230,220,220,230,222,228,230, 10, 11, 12, 13,
+   14, 15, 16, 17, 18, 19, 19, 20, 21, 22,  0, 23,  0, 24, 25,  0,
+  230,220,  0, 18, 30, 31, 32,  0,  0,  0,  0, 27, 28, 29, 30, 31,
+   32, 33, 34,230,230,220,220,230,220,230,230,220, 35,  0,  0,  0,
+    0,  0,230,230,230,  0,  0,230,230,  0,220,230,230,220,  0,  0,
+    0, 36,  0,  0,230,220,230,230,220,220,230,220,220,230,220,230,
+  220,230,230,  0,  0,220,  0,  0,230,230,  0,230,  0,230,230,230,
+  230,230,  0,  0,  0,220,220,220,230,220,220,220,230,230,  0,220,
+   27, 28, 29,230,  7,  0,  0,  0,  0,  9,  0,  0,  0,230,220,230,
+  230,  0,  0,  0,  0,  0,230,  0,  0, 84, 91,  0,  0,  0,  0,  9,
+    9,  0,  0,  0,  0,  0,  9,  0,103,103,  9,  0,107,107,107,107,
+  118,118,  9,  0,122,122,122,122,220,220,  0,  0,  0,220,  0,220,
+    0,216,  0,  0,  0,129,130,  0,132,  0,  0,  0,  0,  0,130,130,
+  130,130,  0,  0,130,  0,230,230,  9,  0,230,230,  0,  0,220,  0,
+    0,  0,  0,  7,  0,  9,  9,  0,  9,  9,  0,  0,  0,230,  0,  0,
+    0,228,  0,  0,  0,222,230,220,220,  0,  0,  0,230,  0,  0,220,
+  230,220,  0,220,230,230,230,  0,  0,  0,  9,  9,  0,  0,  7,  0,
+  230,  0,  1,  1,  1,  0,  0,  0,230,234,214,220,202,230,230,230,
+  230,230,232,228,228,220,218,230,233,220,230,220,230,230,  1,  1,
+    1,  1,  1,230,  0,  1,  1,230,220,230,  1,  1,  0,  0,218,228,
+  232,222,224,224,  0,  8,  8,  0,  0,  0,  0,220,230,  0,230,230,
+  220,  0,  0,230,  0,  0, 26,  0,  0,220,  0,230,230,  1,220,  0,
+    0,230,220,  0,  0,  0,220,220,  0,  0,230,220,  0,  9,  7,  0,
+    0,  7,  9,  0,  0,  0,  9,  7,  6,  6,  0,  0,  0,  0,  1,  0,
+    0,216,216,  1,  1,  1,  0,  0,  0,226,216,216,216,216,216,  0,
+  220,220,220,  0,232,232,220,230,230,230,  7,  0, 16, 17, 17, 33,
+   17, 49, 17, 17, 84, 97,135,145, 26, 17, 17, 17, 17, 17, 17, 17,
    17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
    17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
-   17, 17, 17,177,  0,  1,  2,  3,  3,  3,  3,  3,  3,  3,  3,  3,
-    3,  3,  3,  3,  3,  3,  3,  3,  4,  3,  3,  3,  3,  3,  5,  3,
-    3,  3,  3,  3,  6,  7,  8,  3,  3,  3,  3,  3,  9, 10, 11, 12,
-   13,  3,  3,  3,  3,  3,  3,  3,  3, 14,  3, 15,  3,  3,  3,  3,
-    3,  3, 16, 17, 18, 19, 20, 21,  3,  3,  3, 22, 23, 24,  3,  3,
-    3,  3,  3,  3, 25,  3,  3,  3,  3,  3,  3,  3,  3, 26,  3,  3,
-   27, 28,  0,  1,  0,  0,  0,  0,  0,  1,  0,  2,  0,  0,  0,  3,
-    0,  0,  0,  3,  0,  0,  0,  0,  0,  4,  0,  5,  0,  0,  0,  0,
-    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  6,  0,  0,  0,  7,
-    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  8,  9,  0,  0,  0,
-    0,  0,  0,  9,  0,  9,  0,  0,  0,  0,  0,  0,  0, 10, 11, 12,
-   13,  0,  0, 14, 15, 16,  6,  0, 17, 18, 19, 19, 19, 20, 21, 22,
-   23, 24, 19, 25,  0, 26, 27, 19, 19, 28, 29, 30,  0, 31,  0,  0,
-    0,  8,  0,  0,  0,  0,  0,  0,  0, 19, 28,  0, 32, 33,  9, 34,
-   35, 19,  0,  0, 36, 37, 38, 39, 40, 19,  0, 41, 42, 43, 44, 31,
-    0,  1, 45, 42,  0,  0,  0,  0,  0, 32, 14, 14,  0,  0,  0,  0,
-   14,  0,  0, 46, 47, 47, 47, 47, 48, 49, 47, 47, 47, 47, 50, 51,
-   52, 53, 43, 21,  0,  0,  0,  0,  0,  0,  0, 54,  6, 55,  0, 14,
-   19,  1,  0,  0,  0,  0, 56, 57,  0,  0,  0,  0,  0, 19, 58, 31,
-    0,  0,  0,  0,  0,  0,  0, 59, 14,  0,  0,  0,  0,  1,  0,  2,
-    0,  0,  0,  3,  0,  0,  0, 60, 61,  0,  0,  0,  0,  0,  0,  0,
-    1,  0,  0,  0,  0,  0,  2,  3,  0,  4,  5,  0,  0,  6,  0,  0,
-    0,  7,  0,  0,  0,  1,  1,  0,  0,  8,  9,  0,  8,  9,  0,  0,
-    0,  0,  8,  9, 10, 11, 12,  0,  0,  0, 13,  0,  0,  0,  0, 14,
-   15, 16, 17,  0,  0,  0,  1,  0,  0, 18, 19,  0,  0,  0, 20,  0,
-    0,  0,  1,  1,  1,  1,  0,  1,  1,  1,  1,  1,  1,  1,  0,  8,
-   21,  9,  0,  0, 22,  0,  0,  0,  0,  1,  0, 23, 24, 25,  0,  0,
-   26,  0,  0,  0,  8, 21, 27,  0,  1,  0,  0,  1,  1,  1,  1,  0,
-    1, 28, 29, 30,  0, 31, 32, 20,  1,  1,  0,  0,  0,  8, 21,  9,
-    1,  4,  5,  0,  0,  0, 33,  9,  0,  1,  1,  1,  0,  8, 21, 21,
-   21, 21, 34,  1, 35, 21, 21, 21,  9, 36,  0,  0, 37, 38,  1,  0,
-   39,  0,  0,  0,  1,  0,  1,  0,  0,  0,  0,  8, 21,  9,  1,  0,
-    0,  0, 40,  0,  8, 21, 21, 21, 21, 21, 21, 21, 21,  9,  0,  1,
-    1,  1,  1,  8, 21, 21, 21,  9,  0,  0,  0, 41,  0, 42, 43,  0,
-    0,  0,  1, 44,  0,  0,  0, 45,  8,  9,  1,  0,  0,  0,  8, 21,
-   21, 21,  9,  0,  1,  0,  1,  1,  8, 21, 21,  9,  0,  4,  5,  8,
-    9,  1,  0,  0,  0,  1,  2,  3,  4,  5,  6,  7,  7,  8,  7,  7,
-    7,  7,  7,  7,  7,  7,  7,  7,  9, 10, 11, 11, 11, 11, 12, 13,
-   13, 13, 13, 14, 15, 16, 17, 18, 19, 20, 21, 13, 22, 13, 13, 13,
-   13, 23, 24, 24, 25, 26, 13, 13, 13, 27, 28, 29, 13, 30, 31, 32,
-   33, 34, 35, 36,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,
-    7,  7,  7,  7,  7,  7,  7,  7, 37,  7, 38, 39,  7, 40,  7,  7,
-    7, 41, 13, 42,  7,  7, 43,  7, 44, 13, 13, 13, 13, 13, 13, 13,
-   13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
-   13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
-   13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
-   13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
-   13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
-   13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
-   13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
-   13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
-   13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
-   13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
-   13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
-   13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
-   13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
-   13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
-   13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
-   13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
-   13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
-   13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
-   13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
-   13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
-   13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
-   13, 13, 13, 13, 45,  0,  0,  1,  2,  2,  2,  3,  4,  5,  6,  7,
-    8,  9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
-   24, 25, 26, 27, 28, 29, 30, 31, 32, 32, 33, 34, 35, 36, 37, 37,
-   37, 37, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
-   51, 52,  2,  2, 53, 54, 55, 56, 57, 58, 59, 59, 59, 59, 60, 59,
-   59, 59, 59, 59, 59, 59, 61, 61, 59, 59, 59, 59, 62, 63, 64, 65,
-   66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 59, 70, 70,
-   70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70,
-   70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70,
-   70, 79, 70, 70, 70, 70, 80, 80, 80, 80, 80, 80, 80, 80, 80, 81,
-   82, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 32, 32,
-   32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
-   32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32,
-   32, 32, 32, 32, 32, 95, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
-   96, 96, 96, 96, 96, 96, 96, 96, 70, 70, 97, 98, 99,100,101,101,
-  102,103,104,105,106,107,108,109,110,111, 96,112,113,114,115,116,
-  117,118,119,119,120,121,122,123,124,125,126,127,128,129,130,131,
-  132, 96,133,134,135,136,137,138,139,140,141,142,143, 96,144,145,
-   96,146,147,148,149, 96,150,151,152,153,154,155,156, 96,157,158,
-  159,160, 96,161,162,163,164,164,164,164,164,164,164,165,166,164,
-  167, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
-   96, 96, 96, 96, 96,168,169,169,169,169,169,169,169,169,170, 96,
-   96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,171,171,
-  171,171,172, 96, 96, 96,173,173,173,173,174,175,176,177, 96, 96,
-   96, 96,178,179,180,181,182,182,182,182,182,182,182,182,182,182,
-  182,182,182,182,182,182,182,182,182,182,182,182,182,182,182,182,
-  182,182,182,182,182,183,182,182,182,182,182,182,184,184,184,185,
-  186, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
-   96, 96, 96, 96, 96,187,188,189,190,191,191,192, 96, 96, 96, 96,
-   96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,193,194,
-   96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
-   96, 96, 96, 96,195,196, 59,197,198,199,200,201,202, 96,203,204,
-  205, 59, 59,206, 59,207,208,208,208,208,208,209, 96, 96, 96, 96,
-   96, 96, 96, 96,210, 96,211,212,213, 96, 96,214, 96, 96, 96,215,
-   96, 96, 96, 96, 96,216,217,218,219, 96, 96, 96, 96, 96,220,221,
-  222, 96,223,224, 96, 96,225,226, 59,227,228, 96, 59, 59, 59, 59,
-   59, 59, 59,229,230,231,232,233, 59, 59,234,235, 59,236, 96, 96,
-   96, 96, 96, 96, 96, 96, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70,
-   70, 70, 70,237, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70,
-   70, 70, 70, 70,238, 70,239, 70, 70, 70, 70, 70, 70, 70, 70, 70,
-   70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70,
-   70, 70, 70,240, 70, 70, 70, 70, 70, 70, 70, 70, 70,241, 70, 70,
-   70, 70,242, 96, 96, 96, 70, 70, 70, 70,243, 96, 96, 96, 96, 96,
-   96, 96, 96, 96, 96, 96, 70, 70, 70, 70, 70, 70,244, 70, 70, 70,
-   70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70, 70,245, 96, 96,
-   96, 96, 96, 96, 96, 96,246, 96,247,248,  0,  1,  2,  2,  0,  1,
-    2,  2,  2,  3,  4,  5,  0,  0,  0,  0,  0, 19, 19, 19, 19, 19,
-   19, 19, 19, 19, 19,  0,  0,  0, 19,  0, 19,  0,  0,  0,  0,  0,
-   26, 26,  1,  1,  1,  1,  9,  9,  9,  9,  0,  9,  9,  9,  2,  2,
-    9,  9,  9,  9,  0,  9,  2,  2,  2,  2,  9,  0,  9,  0,  9,  9,
-    9,  2,  9,  2,  9,  9,  9,  9,  2,  9,  9,  9, 55, 55, 55, 55,
-   55, 55,  6,  6,  6,  6,  6,  1,  1,  6,  2,  4,  4,  4,  4,  4,
-    4,  4,  4,  4,  4,  2,  2, 14, 14, 14, 14, 14, 14, 14, 14, 14,
-   14,  2,  2,  2,  2, 14, 14,  2,  2,  2,  3,  3,  3,  3,  3,  0,
-    3,  3,  0,  3,  3,  3,  3,  3,  3,  0,  3,  3,  3,  1,  1,  1,
-    3,  3,  1,  3,  3,  3, 37, 37, 37, 37, 37, 37,  2, 37, 37, 37,
-   37,  2,  2, 37, 37, 37, 38, 38, 38, 38, 38, 38,  2,  2, 64, 64,
-   64, 64, 64, 64, 64,  2,  2, 64, 64, 64, 90, 90, 90, 90, 90, 90,
-    2,  2, 90, 90, 90,  2, 95, 95, 95, 95,  2,  2, 95,  2,  3,  3,
-    3,  2,  3,  3,  2,  2,  3,  3,  0,  3,  7,  7,  7,  7,  7,  1,
-    1,  1,  1,  7,  7,  7,  0,  0,  7,  7,  5,  5,  5,  5,  2,  5,
-    5,  5,  5,  2,  2,  5,  5,  2,  5,  5,  5,  2,  5,  2,  2,  2,
-    5,  5,  5,  5,  2,  2,  5,  5,  5,  2,  2,  2,  2,  5,  5,  5,
-    2,  5,  2, 11, 11, 11, 11, 11, 11,  2,  2,  2,  2, 11, 11,  2,
-    2, 11, 11, 11, 11, 11, 11,  2, 11, 11,  2, 11, 11,  2, 11, 11,
-    2,  2,  2, 11,  2,  2, 11,  2, 11,  2,  2,  2, 11, 11,  2, 10,
-   10, 10, 10, 10, 10, 10, 10, 10,  2, 10, 10,  2, 10, 10, 10, 10,
-    2,  2, 10,  2,  2,  2,  2,  2, 10, 10,  2, 21, 21, 21, 21, 21,
-   21, 21, 21,  2,  2, 21, 21,  2, 21, 21, 21, 21,  2,  2, 21, 21,
-    2, 21,  2,  2, 21, 21,  2,  2, 22, 22,  2, 22, 22, 22, 22, 22,
-   22,  2, 22,  2, 22, 22, 22, 22,  2,  2,  2, 22, 22,  2,  2,  2,
-    2, 22, 22,  2,  2,  2, 22, 22, 22, 22, 23, 23, 23, 23, 23,  2,
-   23, 23, 23, 23,  2,  2,  2, 23, 23,  2, 23, 23, 23,  2,  2, 23,
-    2,  2,  2,  2, 23, 23,  2,  2,  2, 23, 16, 16, 16, 16, 16,  2,
-   16, 16,  2, 16, 16, 16, 16, 16,  2,  2,  2, 16, 16,  2,  2,  2,
-   16, 16, 20, 20, 20, 20, 20,  2, 20, 20,  2,  2, 20, 20,  2, 36,
-   36, 36, 36, 36, 36, 36, 36, 36, 36,  2,  2,  2, 36, 36, 36, 36,
-    2, 36,  2, 36,  2,  2,  2,  2, 36,  2,  2,  2,  2, 36, 36,  2,
-   36,  2, 36,  2,  2,  2,  2, 24, 24, 24, 24, 24, 24, 24, 24, 24,
-   24,  2,  2,  2,  2,  0,  2, 18, 18,  2, 18,  2, 18, 18, 18, 18,
-   18,  2, 18, 18, 18, 18,  2, 18,  2, 18, 18, 18,  2,  2, 18,  2,
-   18,  2, 25, 25, 25, 25,  2, 25, 25, 25, 25,  2,  2,  2, 25,  2,
-   25, 25, 25,  0,  0,  0,  0, 25, 25,  2, 33, 33, 33, 33,  8,  8,
-    8,  8,  8,  8,  2,  8,  2,  8,  2,  2,  8,  8,  8,  0, 12, 12,
-   12, 12, 30, 30, 30, 30, 30,  2, 30, 30, 30, 30,  2,  2, 30, 30,
-   30,  2,  2, 30, 30, 30, 30,  2,  2,  2, 29, 29, 29, 29, 29, 29,
-    2,  2, 28, 28, 28, 28, 34, 34, 34, 34, 34,  2,  2,  2, 35, 35,
-   35, 35, 35, 35, 35,  0,  0,  0, 35, 35, 35,  2,  2,  2, 45, 45,
-   45, 45, 45, 45,  2,  2,  2,  2,  2, 45, 44, 44, 44, 44, 44,  0,
-    0,  2, 43, 43, 43, 43, 46, 46, 46, 46, 46,  2, 46, 46, 31, 31,
-   31, 31, 31, 31,  2,  2, 32, 32,  0,  0, 32,  0, 32, 32, 32, 32,
-   32, 32, 32, 32,  2,  2, 32,  2,  2,  2, 32, 32, 32,  2, 28, 28,
-    2,  2, 48, 48, 48, 48, 48, 48, 48,  2, 48,  2,  2,  2, 52, 52,
-   52, 52, 52, 52,  2,  2, 52,  2,  2,  2, 58, 58, 58, 58, 58, 58,
-    2,  2, 58, 58, 58,  2,  2,  2, 58, 58, 54, 54, 54, 54,  2,  2,
-   54, 54, 91, 91, 91, 91, 91, 91, 91,  2, 91,  2,  2, 91, 91, 91,
-    2,  2,  1,  1,  1,  2, 62, 62, 62, 62, 62,  2,  2,  2, 62, 62,
-   62,  2, 76, 76, 76, 76, 93, 93, 93, 93, 70, 70, 70, 70,  2,  2,
-    2, 70, 70, 70,  2,  2,  2, 70, 70, 70, 73, 73, 73, 73,  6,  2,
-    2,  2,  8,  8,  8,  2,  2,  8,  8,  8,  1,  1,  1,  0,  1,  0,
-    1,  1,  1,  0,  0,  0,  0,  1,  0,  0,  1,  1,  0,  2, 19, 19,
-    9,  9,  9,  9,  9,  6, 19,  9,  9,  9,  9,  9, 19, 19,  9,  9,
-    9, 19,  6, 19, 19, 19, 19, 19, 19,  9,  9,  9,  2,  2,  2,  9,
-    2,  9,  2,  9,  9,  9,  1,  1,  0,  0,  0,  2,  0,  0,  0, 19,
-    2,  2,  0,  0,  0, 19,  0,  0,  0,  2, 19,  2,  2,  2,  0,  2,
-    2,  2,  1,  2,  2,  2,  0,  0,  9,  0,  0,  0, 19, 19, 27, 27,
-   27, 27,  2,  2,  0,  0,  0,  0,  2,  0, 56, 56, 56, 56,  2, 55,
-   55, 55, 61, 61, 61, 61,  2,  2,  2, 61, 61,  2,  2,  2,  0,  0,
-    2,  2, 13, 13, 13, 13, 13, 13,  2, 13, 13, 13,  2,  2,  0, 13,
-    0, 13,  0, 13, 13, 13, 13, 13,  1,  1,  1,  1, 12, 12,  2, 15,
-   15, 15, 15, 15, 15, 15, 15, 15, 15,  2,  2,  1,  1,  0,  0, 15,
-   15, 15,  0, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,  0,  2, 26,
-   26, 26, 26, 26, 26, 26,  2, 12, 12, 12, 12, 12, 12,  2, 12, 12,
-   12,  0, 39, 39, 39, 39, 39,  2,  2,  2, 39, 39, 39,  2, 86, 86,
-   86, 86, 77, 77, 77, 77, 79, 79, 79, 79, 19, 19, 19,  2, 19, 19,
-    2, 19,  2, 19, 19, 19, 19, 19,  2,  2,  2,  2, 19, 19, 60, 60,
-   60, 60, 60,  2,  2,  2, 65, 65, 65, 65, 75, 75, 75, 75, 75, 75,
-    2,  2,  2,  2, 75, 75, 69, 69, 69, 69, 69, 69,  0, 69, 74, 74,
-   74, 74,  2,  2,  2, 74, 12,  2,  2,  2, 84, 84, 84, 84, 84, 84,
-    2,  0, 84, 84,  2,  2,  2,  2, 84, 84, 33, 33, 33,  2, 68, 68,
-   68, 68, 68, 68, 68,  2, 68, 68,  2,  2, 92, 92, 92, 92, 92, 92,
-   92,  2,  2,  2,  2, 92, 87, 87, 87, 87, 87, 87, 87,  2, 19,  9,
-   19, 19, 19, 19,  0,  0, 87, 87,  2,  2,  2,  2,  2, 12,  2,  2,
-    2,  4, 14,  2, 14,  2, 14, 14,  2, 14, 14,  2, 14, 14,  2,  2,
-    2,  3,  3,  3,  0,  0,  2,  2,  3,  3,  1,  1,  6,  6,  3,  2,
-    3,  3,  3,  2,  2,  0,  2,  0,  0,  0,  0,  0, 17, 17, 17, 17,
-    0,  0,  2,  2, 12, 12, 49, 49, 49, 49,  2, 49, 49, 49, 49, 49,
-   49,  2, 49, 49,  2, 49, 49, 49,  2,  2,  9,  2,  2,  2,  0,  1,
-    2,  2, 71, 71, 71, 71, 71,  2,  2,  2, 67, 67, 67, 67, 67,  2,
-    2,  2, 42, 42, 42, 42,  2, 42, 42, 42, 41, 41, 41, 41, 41, 41,
-   41,  2,118,118,118,118,118,118,118,  2, 53, 53, 53, 53, 53, 53,
-    2, 53, 59, 59, 59, 59, 59, 59,  2,  2, 40, 40, 40, 40, 51, 51,
-   51, 51, 50, 50, 50, 50, 50, 50,  2,  2,135,135,135,135,106,106,
-  106,106,104,104,104,104,  2,  2,  2,104,161,161,161,161,161,161,
-  161,  2,161,161,  2,161,161,  2,  2,  2,110,110,110,110,110,110,
-  110,  2,110,110,  2,  2, 19,  2, 19, 19, 47, 47, 47, 47, 47, 47,
-    2,  2, 47,  2, 47, 47, 47, 47,  2, 47, 47,  2,  2,  2, 47,  2,
-    2, 47, 81, 81, 81, 81, 81, 81,  2, 81,120,120,120,120,116,116,
-  116,116,116,116,116,  2,  2,  2,  2,116,128,128,128,128,128,128,
-  128,  2,128,128,  2,  2,  2,  2,  2,128, 66, 66, 66, 66,  2,  2,
-    2, 66, 72, 72, 72, 72, 72, 72,  2,  2,  2,  2,  2, 72, 98, 98,
-   98, 98, 97, 97, 97, 97,  2,  2, 97, 97, 57, 57, 57, 57,  2, 57,
-   57,  2,  2, 57, 57, 57, 57, 57,  2,  2, 57, 57, 57,  2,  2,  2,
-    2, 57, 57,  2,  2,  2, 88, 88, 88, 88,117,117,117,117,112,112,
-  112,112,112,112,112,  2,  2,  2,  2,112, 78, 78, 78, 78, 78, 78,
-    2,  2,  2, 78, 78, 78, 83, 83, 83, 83, 83, 83,  2,  2, 82, 82,
-   82, 82, 82, 82, 82,  2,122,122,122,122,122,122,  2,  2,  2,122,
-  122,122,122,  2,  2,  2, 89, 89, 89, 89, 89,  2,  2,  2,130,130,
-  130,130,130,130,130,  2,  2,  2,130,130,144,144,144,144,144,144,
-    2,  2,156,156,156,156,156,156,  2,156,156,156,  2,  2,  2,  3,
-    3,  3,147,147,147,147,148,148,148,148,148,148,  2,  2,158,158,
-  158,158,158,158,  2,  2,153,153,153,153,149,149,149,149,149,149,
-  149,  2, 94, 94, 94, 94, 94, 94,  2,  2,  2,  2, 94, 94,  2,  2,
-    2, 94, 85, 85, 85, 85, 85, 85, 85,  2,  2, 85,  2,  2,101,101,
-  101,101,101,  2,  2,  2,101,101,  2,  2, 96, 96, 96, 96, 96,  2,
-   96, 96,111,111,111,111,111,111,111,  2,100,100,100,100,108,108,
-  108,108,108,108,  2,108,108,108,  2,  2,129,129,129,129,129,129,
-  129,  2,129,  2,129,129,129,129,  2,129,129,129,  2,  2,109,109,
-  109,109,109,109,109,  2,109,109,  2,  2,107,107,107,107,  2,107,
-  107,107,107,  2,  2,107,107,  2,107,107,107,107,  2,  1,107,107,
-    2,  2,107,  2,  2,  2,  2,  2,  2,107,  2,  2,107,107,137,137,
-  137,137,  2,137,137,137,137,137,  2,  2,124,124,124,124,124,124,
-    2,  2,123,123,123,123,123,123,  2,  2,114,114,114,114,114,  2,
-    2,  2,114,114,  2,  2,102,102,102,102,102,102,  2,  2,126,126,
-  126,126,126,126,126,  2,  2,126,126,126,142,142,142,142,125,125,
-  125,125,125,125,125,  2,  2,  2,  2,125,154,154,154,154,154,154,
-  154,  2,  2,154,  2,  2,  2,154,154,  2,154,154,  2,154,154,  2,
-    2,154,154,154,  2,  2,150,150,150,150,  2,  2,150,150,150,  2,
-    2,  2,141,141,141,141,140,140,140,140,140,140,140,  2,121,121,
-  121,121,121,  2,  2,  2,  7,  7,  2,  2,133,133,133,133,133,  2,
-  133,133,133,133,133,  2,133,133,  2,  2,133,  2,  2,  2,134,134,
-  134,134,  2,  2,134,134,  2,134,134,134,134,134,134,  2,138,138,
-  138,138,138,138,138,  2,138,138,  2,138,  2,  2,138,  2,138,138,
-    2,  2,143,143,143,143,143,143,  2,143,143,  2,143,143,143,143,
-  143,  2,143,  2,  2,  2,143,143,  2,  2,145,145,145,145,145,  2,
-    2,  2,163,163,163,163,163,  2,163,163,163,163,163,  2,  2,  2,
-  163,163,163,163,  2,  2, 86,  2,  2,  2, 63, 63, 63, 63, 63, 63,
-    2,  2, 63, 63, 63,  2, 63,  2,  2,  2,157,157,157,157,157,157,
-  157,  2, 80, 80, 80, 80, 80, 80,  2,  2,127,127,127,127,127,127,
-  127,  2, 79,  2,  2,  2,115,115,115,115,115,115,115,  2,115,115,
-    2,  2,  2,  2,115,115,159,159,159,159,159,159,159,  2,159,159,
-    2,  2,103,103,103,103,103,103,  2,  2,119,119,119,119,119,119,
-    2,  2,119,119,  2,119,  2,119,119,119,146,146,146,146,146,146,
-  146,  2, 99, 99, 99, 99, 99, 99, 99,  2,  2,  2,  2, 99,136,139,
-   13, 13,155,  2,  2,  2,136,136,136,136,155,155,155,155,155,155,
-    2,  2,136,  2,  2,  2,  2, 17, 17, 17,  2, 17, 17,  2, 17, 15,
-   15, 15, 17, 17, 17,  2,  2,  2, 15,  2,  2, 17,  2,  2,139,139,
-  139,139,105,105,105,105,105,105,105,  2,105,  2,  2,  2,105,105,
-    2,  2,  1,  1,  2,  2,  0,  0,  0,  1,  0,  1,  1,  1,  0,  0,
-    1,  1,  2,  2,  0,  2,  2,  0,  0,  2,  0,  2,  0,  2,131,131,
-  131,131,  2,  2,  2,131,  2,131,131,131, 56, 56, 56,  2, 56,  2,
-    2, 56, 56, 56,  2, 56, 56,  2, 56, 56,  6,  6,  2,  2,  2,  2,
-    2,  6,151,151,151,151,151,  2,  2,  2,151,151,  2,  2,  2,  2,
-  151,151,160,160,160,160,160,160,160,  2,152,152,152,152,152,152,
-    2,  2,  2,  2,  2,152,164,164,164,164,164,164,  2,  2,  2, 30,
-   30,  2,113,113,113,113,113,  2,  2,113,113,113,113,  2,132,132,
-  132,132,132,132,  2,  2,  2,  2,132,132,  2,  3,  3,  2,  3,  2,
-    2,  3,  2,  3,  2,  3,  2,  2,  3,  2,  3,  2,  3,  2,  3,  3,
-    2,  3, 15,  0,  0,  2, 13,  2,  2,  2, 13, 13, 13,  2,  2,  0,
-    2,  2,  0,  1,  2,  3,  4,  5,  6,  7,  8,  9,  9,  9,  9, 10,
-    9, 11, 12, 13,  9,  9,  9, 14,  9,  9, 15,  9,  9,  9,  9,  9,
+   17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,177,  0,  1,  2,  3,
+    3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,
+    4,  3,  3,  3,  3,  3,  5,  3,  3,  3,  3,  3,  6,  7,  8,  3,
+    3,  3,  3,  3,  9, 10, 11, 12, 13,  3,  3,  3,  3,  3,  3,  3,
+    3, 14,  3, 15,  3,  3,  3,  3,  3,  3, 16, 17, 18, 19, 20, 21,
+    3,  3,  3, 22, 23, 24,  3,  3,  3,  3,  3,  3, 25,  3,  3,  3,
+    3,  3,  3,  3,  3, 26,  3,  3, 27, 28,  0,  1,  0,  0,  0,  0,
+    0,  1,  0,  2,  0,  0,  0,  3,  0,  0,  0,  3,  0,  0,  0,  0,
+    0,  4,  0,  5,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+    0,  0,  0,  6,  0,  0,  0,  7,  0,  0,  0,  0,  0,  0,  0,  0,
+    0,  0,  0,  8,  9,  0,  0,  0,  0,  0,  0,  9,  0,  9,  0,  0,
+    0,  0,  0,  0,  0, 10, 11, 12, 13,  0,  0, 14, 15, 16,  6,  0,
+   17, 18, 19, 19, 19, 20, 21, 22, 23, 24, 19, 25,  0, 26, 27, 19,
+   19, 28, 29, 30,  0, 31,  0,  0,  0,  8,  0,  0,  0,  0,  0,  0,
+    0, 19, 28,  0, 32, 33,  9, 34, 35, 19,  0,  0, 36, 37, 38, 39,
+   40, 19,  0, 41, 42, 43, 44, 31,  0,  1, 45, 42,  0,  0,  0,  0,
+    0, 32, 14, 14,  0,  0,  0,  0, 14,  0,  0, 46, 47, 47, 47, 47,
+   48, 49, 47, 47, 47, 47, 50, 51, 52, 53, 43, 21,  0,  0,  0,  0,
+    0,  0,  0, 54,  6, 55,  0, 14, 19,  1,  0,  0,  0,  0, 56, 57,
+    0,  0,  0,  0,  0, 19, 58, 31,  0,  0,  0,  0,  0,  0,  0, 59,
+   14,  0,  0,  0,  0,  1,  0,  2,  0,  0,  0,  3,  0,  0,  0, 60,
+   61,  0,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  2,  3,
+    0,  4,  5,  0,  0,  6,  0,  0,  0,  7,  0,  0,  0,  1,  1,  0,
+    0,  8,  9,  0,  8,  9,  0,  0,  0,  0,  8,  9, 10, 11, 12,  0,
+    0,  0, 13,  0,  0,  0,  0, 14, 15, 16, 17,  0,  0,  0,  1,  0,
+    0, 18, 19,  0,  0,  0, 20,  0,  0,  0,  1,  1,  1,  1,  0,  1,
+    1,  1,  1,  1,  1,  1,  0,  8, 21,  9,  0,  0, 22,  0,  0,  0,
+    0,  1,  0, 23, 24, 25,  0,  0, 26,  0,  0,  0,  8, 21, 27,  0,
+    1,  0,  0,  1,  1,  1,  1,  0,  1, 28, 29, 30,  0, 31, 32, 20,
+    1,  1,  0,  0,  0,  8, 21,  9,  1,  4,  5,  0,  0,  0, 33,  9,
+    0,  1,  1,  1,  0,  8, 21, 21, 21, 21, 34,  1, 35, 21, 21, 21,
+    9, 36,  0,  0, 37, 38,  1,  0, 39,  0,  0,  0,  1,  0,  1,  0,
+    0,  0,  0,  8, 21,  9,  1,  0,  0,  0, 40,  0,  8, 21, 21, 21,
+   21, 21, 21, 21, 21,  9,  0,  1,  1,  1,  1,  8, 21, 21, 21,  9,
+    0,  0,  0, 41,  0, 42, 43,  0,  0,  0,  1, 44,  0,  0,  0, 45,
+    8,  9,  1,  0,  0,  0,  8, 21, 21, 21,  9,  0,  1,  0,  1,  1,
+    8, 21, 21,  9,  0,  4,  5,  8,  9,  1,  0,  0,  0,  1,  2,  3,
+    4,  5,  5,  5,  5,  5,  6,  7,  7,  8,  9, 10, 11, 12, 13, 14,
+   15,  9, 16, 17, 18,  9, 19, 20, 21, 22, 23, 24,  5,  5,  5,  5,
+    5,  5,  5,  5,  5,  5, 25, 26, 27,  5, 28, 29,  5, 30, 31,  9,
+    9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
+    9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
+    9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
+    9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
+    9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
+    9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
+    9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
+    9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
+    9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
+    9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
+    9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9, 32,  0,  0,  1,
+    2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15, 16, 17,
+   18, 19, 20, 20, 21, 22, 23, 24, 25, 26, 27, 28,  1, 29, 30, 31,
+   32, 32, 33, 32, 32, 32, 34, 32, 32, 35, 36, 37, 38, 39, 40, 41,
+   42, 43, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
+   44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 45, 44, 44, 44, 44,
+   44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 46, 46,
+   46, 46, 47, 48, 49, 50, 51, 52, 53, 54, 17, 17, 17, 17, 17, 17,
+   17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
+   17, 17, 17, 17, 17, 55, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
+   56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,
+   56, 56, 56, 56, 56, 56, 56, 44, 57, 58, 59, 60, 61, 62, 63, 64,
+   65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80,
+   81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 95,
+   95, 96, 97, 98, 56, 56, 56, 56, 56, 56, 56, 56, 56, 99,100,100,
+  100,100,101,100,100,100,100,100,100,100,100,100,100,100,100,100,
+  100,102,103,103,104, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,105,
+   56, 56, 56, 56, 56, 56,106,106,107,108, 56,109,110,111,112,112,
+  112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,112,
+  112,112,112,112,112,113,112,112,112,114,115,116, 56, 56, 56, 56,
+   56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,117,118,119,
+  120, 56, 56, 56, 56, 56, 56, 56, 56, 56,121, 56, 56, 56, 56, 56,
+   56, 56, 56, 56, 56, 56, 56, 56, 56, 56,122, 32,123,124,125,126,
+  127,128,129,130,131,132,133,133,134, 56, 56, 56, 56,135,136,137,
+  138, 56,139,140, 56,141,142,143, 56, 56,144,145,146, 56,147,148,
+  149, 32, 32, 32,150,151,152, 32,153,154, 56, 56, 56, 56, 44, 44,
+   44, 44, 44, 44,155, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
+   44, 44, 44, 44, 44,156,157, 44, 44, 44, 44, 44, 44, 44, 44, 44,
+   44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44,158, 44, 44, 44,
+   44, 44, 44, 44, 44, 44, 44, 44, 44,159, 44, 44,160, 56, 56, 56,
+   56, 56, 56, 56, 56, 56, 44, 44,161, 56, 56, 56, 56, 56, 44, 44,
+   44,162, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
+   44,163, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56, 56,164,165,
+    0,  1,  0,  1,  2,  3,  0,  1,  2,  3,  4,  5,  6,  7,  0,  0,
+    0,  0,  0,  0,  0,  0,  0, 19, 19, 19, 19, 19, 19, 19, 19, 19,
+   19, 19, 19, 19, 19, 19, 19, 19, 19,  0,  0,  0,  0,  0,  0,  0,
+   19,  0,  0,  0,  0,  0, 19, 19, 19, 19, 19, 19, 19,  0, 19,  0,
+    0,  0,  0,  0,  0,  0, 19, 19, 19, 19, 19,  0,  0,  0,  0,  0,
+   26, 26,  0,  0,  0,  0,  1,  1,  1,  1,  1,  1,  1,  1,  9,  9,
+    9,  9,  0,  9,  9,  9,  2,  2,  9,  9,  9,  9,  0,  9,  2,  2,
+    2,  2,  9,  0,  9,  0,  9,  9,  9,  2,  9,  2,  9,  9,  9,  9,
+    9,  9,  9,  9,  9,  9,  9,  9,  2,  9,  9,  9,  9,  9,  9,  9,
+   55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55,  6,  6,
+    6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  6,  1,  1,  6,  2,  4,
+    4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,  4,
+    4,  4,  4,  4,  4,  2,  4,  4,  4,  2,  2,  4,  4,  4,  2, 14,
+   14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,  2,  2,
+    2,  2,  2,  2,  2,  2, 14, 14, 14,  2,  2,  2,  2, 14, 14, 14,
+   14, 14, 14,  2,  2,  2,  3,  3,  3,  3,  3,  0,  3,  3,  3,  3,
+    3,  3,  0,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,
+    3,  0,  3,  3,  3,  0,  0,  3,  3,  3,  3,  3,  3,  3,  3,  3,
+    3,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  1,  3,  3,  1,  3,
+    3,  3,  3,  3,  3,  3, 37, 37, 37, 37, 37, 37, 37, 37, 37, 37,
+   37, 37, 37, 37,  2, 37, 37, 37, 37,  2,  2, 37, 37, 37, 38, 38,
+   38, 38, 38, 38, 38, 38, 38, 38,  2,  2,  2,  2,  2,  2, 64, 64,
+   64, 64, 64, 64, 64, 64, 64, 64, 64,  2,  2, 64, 64, 64, 90, 90,
+   90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90,  2,  2, 90, 90,
+   90, 90, 90, 90, 90,  2, 95, 95, 95, 95, 95, 95, 95, 95, 95, 95,
+   95, 95,  2,  2, 95,  2, 37, 37, 37,  2,  2,  2,  2,  2,  3,  3,
+    3,  3,  3,  3,  3,  2,  3,  3,  2,  2,  2,  2,  2,  3,  3,  3,
+    0,  3,  3,  3,  3,  3,  7,  7,  7,  7,  7,  7,  7,  7,  7,  1,
+    1,  1,  1,  7,  7,  7,  7,  7,  7,  7,  0,  0,  7,  7,  5,  5,
+    5,  5,  2,  5,  5,  5,  5,  5,  5,  5,  5,  2,  2,  5,  5,  2,
+    2,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  5,  2,
+    5,  5,  5,  5,  5,  5,  5,  2,  5,  2,  2,  2,  5,  5,  5,  5,
+    2,  2,  5,  5,  5,  5,  5,  2,  2,  5,  5,  5,  5,  2,  2,  2,
+    2,  2,  2,  2,  2,  5,  2,  2,  2,  2,  5,  5,  2,  5,  5,  5,
+    5,  5,  2,  2,  5,  5,  5,  5,  5,  5,  5,  5,  5,  2,  2, 11,
+   11, 11,  2, 11, 11, 11, 11, 11, 11,  2,  2,  2,  2, 11, 11,  2,
+    2, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11,  2,
+   11, 11, 11, 11, 11, 11, 11,  2, 11, 11,  2, 11, 11,  2, 11, 11,
+    2,  2, 11,  2, 11, 11, 11,  2,  2, 11, 11, 11,  2,  2,  2, 11,
+    2,  2,  2,  2,  2,  2,  2, 11, 11, 11, 11,  2, 11,  2,  2,  2,
+    2,  2,  2,  2, 11, 11, 11, 11, 11, 11, 11, 11, 11,  2,  2, 10,
+   10, 10,  2, 10, 10, 10, 10, 10, 10, 10, 10, 10,  2, 10, 10, 10,
+    2, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,  2,
+   10, 10, 10, 10, 10, 10, 10,  2, 10, 10,  2, 10, 10, 10, 10, 10,
+    2,  2, 10, 10, 10, 10, 10, 10,  2, 10, 10, 10,  2,  2, 10,  2,
+    2,  2,  2,  2,  2,  2, 10, 10, 10, 10,  2,  2, 10, 10, 10, 10,
+    2,  2,  2,  2,  2,  2,  2, 10, 10, 10, 10, 10, 10, 10,  2, 21,
+   21, 21,  2, 21, 21, 21, 21, 21, 21, 21, 21,  2,  2, 21, 21,  2,
+    2, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,  2,
+   21, 21, 21, 21, 21, 21, 21,  2, 21, 21,  2, 21, 21, 21, 21, 21,
+    2,  2, 21, 21, 21, 21, 21,  2,  2, 21, 21, 21,  2,  2,  2,  2,
+    2,  2,  2, 21, 21, 21,  2,  2,  2,  2, 21, 21,  2, 21, 21, 21,
+   21, 21,  2,  2, 21, 21,  2,  2, 22, 22,  2, 22, 22, 22, 22, 22,
+   22,  2,  2,  2, 22, 22, 22,  2, 22, 22, 22, 22,  2,  2,  2, 22,
+   22,  2, 22,  2, 22, 22,  2,  2,  2, 22, 22,  2,  2,  2, 22, 22,
+   22, 22, 22, 22, 22, 22, 22, 22,  2,  2,  2,  2, 22, 22, 22,  2,
+    2,  2,  2,  2,  2, 22,  2,  2,  2,  2,  2,  2, 22, 22, 22, 22,
+   22,  2,  2,  2,  2,  2, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
+   23, 23, 23,  2, 23, 23, 23,  2, 23, 23, 23, 23, 23, 23, 23, 23,
+    2,  2, 23, 23, 23, 23, 23,  2, 23, 23, 23, 23,  2,  2,  2,  2,
+    2,  2,  2, 23, 23,  2, 23, 23, 23,  2,  2, 23,  2,  2, 23, 23,
+   23, 23,  2,  2, 23, 23,  2,  2,  2,  2,  2,  2,  2, 23, 16, 16,
+   16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,  2, 16, 16, 16,  2,
+   16, 16, 16, 16, 16, 16, 16, 16, 16, 16,  2, 16, 16, 16, 16, 16,
+    2,  2, 16, 16, 16, 16, 16,  2, 16, 16, 16, 16,  2,  2,  2,  2,
+    2,  2,  2, 16, 16,  2, 16, 16, 16, 16,  2,  2, 16, 16,  2, 16,
+   16, 16,  2,  2,  2,  2, 20, 20, 20, 20, 20, 20, 20, 20, 20, 20,
+   20, 20, 20,  2, 20, 20, 20,  2, 20, 20, 20, 20, 20, 20,  2,  2,
+    2,  2, 20, 20, 20, 20, 20, 20, 20, 20,  2,  2, 20, 20,  2, 36,
+   36, 36,  2, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,
+   36, 36, 36, 36, 36,  2,  2,  2, 36, 36, 36, 36, 36, 36, 36, 36,
+    2, 36, 36, 36, 36, 36, 36, 36, 36, 36,  2, 36,  2,  2,  2,  2,
+   36,  2,  2,  2,  2, 36, 36, 36, 36, 36, 36,  2, 36,  2,  2,  2,
+    2,  2,  2,  2, 36, 36,  2,  2, 36, 36, 36,  2,  2,  2,  2, 24,
+   24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24, 24,
+   24,  2,  2,  2,  2,  0, 24, 24, 24, 24,  2,  2,  2,  2,  2, 18,
+   18,  2, 18,  2, 18, 18, 18, 18, 18,  2, 18, 18, 18, 18, 18, 18,
+   18, 18, 18, 18, 18, 18, 18, 18, 18, 18,  2, 18,  2, 18, 18, 18,
+   18, 18, 18, 18,  2,  2, 18, 18, 18, 18, 18,  2, 18,  2, 18, 18,
+   18, 18, 18, 18, 18,  2, 18, 18,  2,  2, 18, 18, 18, 18, 25, 25,
+   25, 25, 25, 25, 25, 25,  2, 25, 25, 25, 25, 25, 25, 25, 25, 25,
+   25, 25, 25,  2,  2,  2, 25, 25, 25, 25, 25,  2, 25, 25, 25, 25,
+   25, 25, 25,  0,  0,  0,  0, 25, 25,  2,  2,  2,  2,  2, 33, 33,
+   33, 33, 33, 33, 33, 33,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,
+    8,  8,  8,  8,  2,  8,  2,  2,  2,  2,  2,  8,  2,  2,  8,  8,
+    8,  0,  8,  8,  8,  8, 12, 12, 12, 12, 12, 12, 12, 12, 30, 30,
+   30, 30, 30, 30, 30, 30, 30,  2, 30, 30, 30, 30,  2,  2, 30, 30,
+   30, 30, 30, 30, 30,  2, 30, 30, 30,  2,  2, 30, 30, 30, 30, 30,
+   30, 30, 30,  2,  2,  2, 30, 30,  2,  2,  2,  2,  2,  2, 29, 29,
+   29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29, 29,  2,  2, 28, 28,
+   28, 28, 28, 28, 28, 28, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,
+   34, 34, 34,  2,  2,  2, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35,
+   35,  0,  0,  0, 35, 35, 35,  2,  2,  2,  2,  2,  2,  2, 45, 45,
+   45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45, 45,  2,  2,  2,  2,
+    2,  2,  2,  2,  2, 45, 44, 44, 44, 44, 44, 44, 44, 44, 44, 44,
+   44, 44, 44,  0,  0,  2, 43, 43, 43, 43, 43, 43, 43, 43, 43, 43,
+   43, 43,  2,  2,  2,  2, 46, 46, 46, 46, 46, 46, 46, 46, 46, 46,
+   46, 46, 46,  2, 46, 46, 46,  2, 46, 46,  2,  2,  2,  2, 31, 31,
+   31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31,  2,  2, 31, 31,
+    2,  2,  2,  2,  2,  2, 32, 32,  0,  0, 32,  0, 32, 32, 32, 32,
+   32, 32, 32, 32, 32, 32, 32, 32,  2,  2,  2,  2,  2,  2, 32,  2,
+    2,  2,  2,  2,  2,  2, 32, 32, 32,  2,  2,  2,  2,  2, 28, 28,
+   28, 28, 28, 28,  2,  2, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
+   48, 48, 48, 48, 48,  2, 48, 48, 48, 48,  2,  2,  2,  2, 48,  2,
+    2,  2, 48, 48, 48, 48, 52, 52, 52, 52, 52, 52, 52, 52, 52, 52,
+   52, 52, 52, 52,  2,  2, 52, 52, 52, 52, 52,  2,  2,  2, 58, 58,
+   58, 58, 58, 58, 58, 58, 58, 58, 58, 58,  2,  2,  2,  2, 58, 58,
+    2,  2,  2,  2,  2,  2, 58, 58, 58,  2,  2,  2, 58, 58, 54, 54,
+   54, 54, 54, 54, 54, 54, 54, 54, 54, 54,  2,  2, 54, 54, 91, 91,
+   91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91, 91,  2, 91, 91,
+   91, 91, 91,  2,  2, 91, 91, 91,  2,  2,  2,  2,  2,  2, 91, 91,
+   91, 91, 91, 91,  2,  2,  1,  1,  1,  1,  1,  1,  1,  2, 62, 62,
+   62, 62, 62, 62, 62, 62, 62, 62, 62, 62, 62,  2, 62, 62, 76, 76,
+   76, 76, 76, 76, 76, 76, 93, 93, 93, 93, 93, 93, 93, 93, 93, 93,
+   93, 93,  2,  2,  2,  2,  2,  2,  2,  2, 93, 93, 93, 93, 70, 70,
+   70, 70, 70, 70, 70, 70,  2,  2,  2, 70, 70, 70, 70, 70, 70, 70,
+    2,  2,  2, 70, 70, 70, 73, 73, 73, 73, 73, 73, 73, 73,  6,  6,
+    6,  2,  2,  2,  2,  2,  8,  8,  8,  2,  2,  8,  8,  8,  1,  1,
+    1,  0,  1,  1,  1,  1,  1,  0,  1,  1,  1,  1,  1,  1,  1,  0,
+    0,  0,  0,  1,  0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  1,  1,
+    0,  2,  2,  2,  2,  2, 19, 19, 19, 19, 19, 19,  9,  9,  9,  9,
+    9,  6, 19, 19, 19, 19, 19, 19, 19, 19, 19,  9,  9,  9,  9,  9,
+   19, 19, 19, 19,  9,  9,  9,  9,  9, 19, 19, 19, 19, 19,  6, 19,
+   19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,  9,  9,  9,
+    9,  9,  9,  9,  2,  2,  2,  9,  2,  9,  2,  9,  2,  9,  9,  9,
+    9,  9,  9,  2,  9,  9,  9,  9,  9,  9,  2,  2,  9,  9,  9,  9,
+    9,  9,  2,  9,  9,  9,  2,  2,  9,  9,  9,  2,  9,  9,  9,  9,
+    9,  9,  9,  9,  9,  2,  0,  0,  0,  0,  1,  1,  0,  0,  0,  0,
+    0,  0,  0,  2,  0,  0,  0, 19,  2,  2,  0,  0,  0,  0,  0,  0,
+    0,  0,  0,  0,  0, 19,  0,  0,  0,  0,  0,  0,  0,  2, 19, 19,
+   19, 19, 19,  2,  2,  2,  0,  2,  2,  2,  2,  2,  2,  2,  1,  2,
+    2,  2,  2,  2,  2,  2,  0,  0,  0,  0,  0,  0,  9,  0,  0,  0,
+   19, 19,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 19,  0, 19,  0,
+    0,  0,  2,  2,  2,  2,  0,  0,  2,  2,  2,  2,  2,  2,  0,  0,
+    0,  2,  2,  2,  2,  2, 27, 27, 27, 27, 27, 27, 27, 27,  0,  0,
+    0,  0,  2,  2,  0,  0,  0,  0,  0,  0,  0,  0,  2,  0, 56, 56,
+   56, 56, 56, 56, 56, 56, 55, 55, 55, 55,  2,  2,  2,  2,  2, 55,
+   55, 55, 55, 55, 55, 55, 61, 61, 61, 61, 61, 61, 61, 61,  2,  2,
+    2,  2,  2,  2,  2, 61, 61,  2,  2,  2,  2,  2,  2,  2,  0,  0,
+    0,  0,  0,  0,  2,  2, 13, 13, 13, 13, 13, 13, 13, 13, 13, 13,
+    2, 13, 13, 13, 13, 13, 13, 13, 13, 13,  2,  2,  2,  2, 13, 13,
+   13, 13, 13, 13,  2,  2,  0,  0,  0,  0,  0, 13,  0, 13,  0, 13,
+   13, 13, 13, 13, 13, 13, 13, 13,  1,  1,  1,  1, 12, 12, 13, 13,
+   13, 13,  0,  0,  0,  0,  2, 15, 15, 15, 15, 15, 15, 15, 15, 15,
+   15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15, 15,  2,  2,  1,
+    1,  0,  0, 15, 15, 15,  0, 17, 17, 17, 17, 17, 17, 17, 17, 17,
+   17, 17, 17, 17, 17, 17, 17, 17, 17,  0,  0, 17, 17, 17,  2,  2,
+    2,  2,  2, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26, 26,  2, 12,
+   12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,  2,  2,  2,
+    2,  2,  2,  2,  2,  0, 12, 12, 12, 12, 12, 12, 12,  0, 17, 17,
+   17, 17, 17, 17, 17,  0, 39, 39, 39, 39, 39, 39, 39, 39, 39, 39,
+   39, 39, 39,  2,  2,  2, 39, 39, 39, 39, 39, 39, 39,  2, 86, 86,
+   86, 86, 86, 86, 86, 86, 77, 77, 77, 77, 77, 77, 77, 77, 77, 77,
+   77, 77,  2,  2,  2,  2, 79, 79, 79, 79, 79, 79, 79, 79,  0,  0,
+   19, 19, 19, 19, 19, 19,  0,  0,  0, 19, 19, 19, 19, 19, 19, 19,
+   19, 19, 19, 19,  2,  2, 19, 19,  2, 19,  2, 19, 19, 19,  2,  2,
+   19, 19, 19, 19, 19, 19, 60, 60, 60, 60, 60, 60, 60, 60, 60, 60,
+   60, 60, 60,  2,  2,  2, 65, 65, 65, 65, 65, 65, 65, 65, 75, 75,
+   75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75, 75,  2,  2,  2,  2,
+    2,  2,  2,  2, 75, 75, 75, 75,  2,  2,  2,  2,  2,  2, 69, 69,
+   69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69, 69,  0, 69, 74, 74,
+   74, 74, 74, 74, 74, 74, 74, 74, 74, 74,  2,  2,  2,  2,  2,  2,
+    2,  2,  2,  2,  2, 74, 12, 12, 12, 12, 12,  2,  2,  2, 84, 84,
+   84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84, 84,  2,  0, 84, 84,
+    2,  2,  2,  2, 84, 84, 33, 33, 33, 33, 33, 33, 33,  2, 68, 68,
+   68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68,  2, 68, 68,
+   68, 68, 68, 68,  2,  2, 68, 68,  2,  2, 68, 68, 68, 68, 92, 92,
+   92, 92, 92, 92, 92, 92, 92, 92, 92,  2,  2,  2,  2,  2,  2,  2,
+    2, 92, 92, 92, 92, 92, 87, 87, 87, 87, 87, 87, 87, 87, 87, 87,
+   87, 87, 87, 87, 87,  2,  2, 30, 30, 30, 30, 30, 30,  2, 19, 19,
+   19,  0, 19, 19, 19, 19, 19, 19, 19, 19, 19,  9, 19, 19, 19, 19,
+    0,  0,  2,  2,  2,  2, 87, 87, 87, 87, 87, 87,  2,  2, 87, 87,
+    2,  2,  2,  2,  2,  2, 12, 12, 12, 12,  2,  2,  2,  2,  2,  2,
+    2, 12, 12, 12, 12, 12, 13, 13,  2,  2,  2,  2,  2,  2, 19, 19,
+   19, 19, 19, 19, 19,  2,  2,  2,  2,  4,  4,  4,  4,  4,  2,  2,
+    2,  2,  2, 14, 14, 14, 14, 14, 14, 14, 14, 14, 14,  2, 14, 14,
+   14, 14, 14,  2, 14,  2, 14, 14,  2, 14, 14,  2, 14, 14,  3,  3,
+    3,  2,  2,  2,  2,  2,  2,  2,  2,  3,  3,  3,  3,  3,  3,  3,
+    3,  3,  3,  3,  0,  0,  2,  2,  3,  3,  3,  3,  3,  3,  2,  2,
+    2,  2,  2,  2,  2,  3,  1,  1,  1,  1,  1,  1,  6,  6,  0,  0,
+    0,  2,  0,  0,  0,  0,  0,  0,  0,  0,  2,  2,  2,  2,  3,  3,
+    3,  3,  3,  2,  3,  3,  3,  3,  3,  3,  3,  2,  2,  0,  2,  0,
+    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 17, 17, 17, 17,
+   17, 17, 17, 17,  0,  0,  2,  2, 12, 12, 12, 12, 12, 12,  2,  2,
+   12, 12, 12,  2,  2,  2,  2,  0,  0,  0,  0,  0,  2,  2, 49, 49,
+   49, 49, 49, 49, 49, 49, 49, 49, 49, 49,  2, 49, 49, 49, 49, 49,
+   49, 49, 49, 49, 49,  2, 49, 49, 49,  2, 49, 49,  2, 49, 49, 49,
+   49, 49, 49, 49,  2,  2, 49, 49, 49,  2,  2,  2,  2,  2,  0,  0,
+    0,  2,  2,  2,  2,  0,  0,  0,  0,  0,  2,  2,  2,  0,  0,  0,
+    0,  0,  0,  2,  2,  2,  9,  2,  2,  2,  2,  2,  2,  2,  0,  0,
+    0,  0,  0,  1,  2,  2, 71, 71, 71, 71, 71, 71, 71, 71, 71, 71,
+   71, 71, 71,  2,  2,  2, 67, 67, 67, 67, 67, 67, 67, 67, 67,  2,
+    2,  2,  2,  2,  2,  2,  1,  0,  0,  0,  0,  0,  0,  0, 42, 42,
+   42, 42, 42, 42, 42, 42, 42, 42, 42, 42,  2,  2,  2,  2,  2,  2,
+    2,  2,  2, 42, 42, 42, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41,
+   41,  2,  2,  2,  2,  2,118,118,118,118,118,118,118,118,118,118,
+  118,  2,  2,  2,  2,  2, 53, 53, 53, 53, 53, 53, 53, 53, 53, 53,
+   53, 53, 53, 53,  2, 53, 59, 59, 59, 59, 59, 59, 59, 59, 59, 59,
+   59, 59,  2,  2,  2,  2, 59, 59, 59, 59, 59, 59,  2,  2, 40, 40,
+   40, 40, 40, 40, 40, 40, 51, 51, 51, 51, 51, 51, 51, 51, 50, 50,
+   50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50, 50,  2,  2, 50, 50,
+    2,  2,  2,  2,  2,  2,135,135,135,135,135,135,135,135,135,135,
+  135,135,  2,  2,  2,  2,106,106,106,106,106,106,106,106,104,104,
+  104,104,104,104,104,104,104,104,104,104,  2,  2,  2,  2,  2,  2,
+    2,  2,  2,  2,  2,104,161,161,161,161,161,161,161,161,161,161,
+  161,  2,161,161,161,161,161,161,161,  2,161,161,  2,161,161,161,
+    2,161,161,161,161,161,161,161,  2,161,161,  2,  2,  2,170,170,
+  170,170,170,170,170,170,170,170,170,170,  2,  2,  2,  2,110,110,
+  110,110,110,110,110,110,110,110,110,110,110,110,110,  2,110,110,
+  110,110,110,110,  2,  2, 19, 19, 19, 19, 19, 19,  2, 19, 19,  2,
+   19, 19, 19, 19, 19, 19, 19, 19, 19,  2,  2,  2,  2,  2, 47, 47,
+   47, 47, 47, 47,  2,  2, 47,  2, 47, 47, 47, 47, 47, 47, 47, 47,
+   47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47, 47,  2, 47, 47,  2,
+    2,  2, 47,  2,  2, 47, 81, 81, 81, 81, 81, 81, 81, 81, 81, 81,
+   81, 81, 81, 81,  2, 81,120,120,120,120,120,120,120,120,116,116,
+  116,116,116,116,116,116,116,116,116,116,116,116,116,  2,  2,  2,
+    2,  2,  2,  2,  2,116,128,128,128,128,128,128,128,128,128,128,
+  128,  2,128,128,  2,  2,  2,  2,  2,128,128,128,128,128, 66, 66,
+   66, 66, 66, 66, 66, 66, 66, 66, 66, 66,  2,  2,  2, 66, 72, 72,
+   72, 72, 72, 72, 72, 72, 72, 72,  2,  2,  2,  2,  2, 72, 98, 98,
+   98, 98, 98, 98, 98, 98, 97, 97, 97, 97, 97, 97, 97, 97,  2,  2,
+    2,  2, 97, 97, 97, 97,  2,  2, 97, 97, 97, 97, 97, 97, 57, 57,
+   57, 57,  2, 57, 57,  2,  2,  2,  2,  2, 57, 57, 57, 57, 57, 57,
+   57, 57,  2, 57, 57, 57,  2, 57, 57, 57, 57, 57, 57, 57, 57, 57,
+   57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57, 57,  2,  2, 57, 57,
+   57,  2,  2,  2,  2, 57, 57,  2,  2,  2,  2,  2,  2,  2, 88, 88,
+   88, 88, 88, 88, 88, 88,117,117,117,117,117,117,117,117,112,112,
+  112,112,112,112,112,112,112,112,112,112,112,112,112,  2,  2,  2,
+    2,112,112,112,112,112, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78,
+   78, 78, 78, 78,  2,  2,  2, 78, 78, 78, 78, 78, 78, 78, 83, 83,
+   83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83, 83,  2,  2, 82, 82,
+   82, 82, 82, 82, 82, 82, 82, 82, 82,  2,  2,  2,  2,  2,122,122,
+  122,122,122,122,122,122,122,122,  2,  2,  2,  2,  2,  2,  2,122,
+  122,122,122,  2,  2,  2,  2,122,122,122,122,122,122,122, 89, 89,
+   89, 89, 89, 89, 89, 89, 89,  2,  2,  2,  2,  2,  2,  2,130,130,
+  130,130,130,130,130,130,130,130,130,  2,  2,  2,  2,  2,  2,  2,
+  130,130,130,130,130,130,144,144,144,144,144,144,144,144,144,144,
+    2,  2,  2,  2,  2,  2,165,165,165,165,165,165,165,165,165,165,
+  165,165,165,165,  2,  2,  2,165,165,165,165,165,165,165,  2,  2,
+    2,  2,  2,  2,165,165,156,156,156,156,156,156,156,156,156,156,
+    2,156,156,156,  2,  2,156,156,  2,  2,  2,  2,  2,  2,  2,  2,
+    3,  3,  3,  2,  2,  2,  2,  2,  2,  2,  3,  3,  3,  3,147,147,
+  147,147,147,147,147,147,148,148,148,148,148,148,148,148,148,148,
+    2,  2,  2,  2,  2,  2,158,158,158,158,158,158,158,158,158,158,
+    2,  2,  2,  2,  2,  2,153,153,153,153,153,153,153,153,153,153,
+  153,153,  2,  2,  2,  2,149,149,149,149,149,149,149,149,149,149,
+  149,149,149,149,149,  2, 94, 94, 94, 94, 94, 94, 94, 94, 94, 94,
+   94, 94, 94, 94,  2,  2,  2,  2, 94, 94, 94, 94, 94, 94,  2,  2,
+    2,  2,  2,  2,  2, 94, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85,
+   85,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2, 85,  2,  2,101,101,
+  101,101,101,101,101,101,101,  2,  2,  2,  2,  2,  2,  2,101,101,
+    2,  2,  2,  2,  2,  2, 96, 96, 96, 96, 96, 96, 96, 96, 96, 96,
+   96, 96, 96,  2, 96, 96,111,111,111,111,111,111,111,111,111,111,
+  111,111,111,111,111,  2,100,100,100,100,100,100,100,100,  2, 36,
+   36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,  2,  2,  2,108,108,
+  108,108,108,108,108,108,108,108,  2,108,108,108,108,108,108,108,
+    2,  2,  2,  2,  2,  2,129,129,129,129,129,129,129,  2,129,  2,
+  129,129,129,129,  2,129,129,129,129,129,129,129,129,129,129,129,
+  129,129,129,129,  2,129,129,129,  2,  2,  2,  2,  2,  2,109,109,
+  109,109,109,109,109,109,109,109,109,  2,  2,  2,  2,  2,109,109,
+    2,  2,  2,  2,  2,  2,107,107,107,107,  2,107,107,107,107,107,
+  107,107,107,  2,  2,107,107,  2,  2,107,107,107,107,107,107,107,
+  107,107,107,107,107,107,107,  2,107,107,107,107,107,107,107,  2,
+  107,107,  2,107,107,107,107,107,  2,  1,107,107,107,107,107,  2,
+    2,107,107,107,  2,  2,107,  2,  2,  2,  2,  2,  2,107,  2,  2,
+    2,  2,  2,107,107,107,107,107,107,107,  2,  2,107,107,107,107,
+  107,107,107,  2,  2,  2,171,171,171,171,171,171,171,171,171,171,
+    2,171,  2,  2,171,  2,171,171,171,171,171,171,  2,171,171,  2,
+  171,  2,  2,171,  2,171,171,171,171,  2,171,171,171,171,171,  2,
+    2,  2,  2,  2,  2,  2,  2,171,171,  2,  2,  2,  2,  2,137,137,
+  137,137,137,137,137,137,137,137,137,137,  2,137,137,137,137,137,
+    2,  2,  2,  2,  2,  2,124,124,124,124,124,124,124,124,124,124,
+    2,  2,  2,  2,  2,  2,123,123,123,123,123,123,123,123,123,123,
+  123,123,123,123,  2,  2,114,114,114,114,114,114,114,114,114,114,
+  114,114,114,  2,  2,  2,114,114,  2,  2,  2,  2,  2,  2, 32, 32,
+   32, 32, 32,  2,  2,  2,102,102,102,102,102,102,102,102,102,102,
+    2,  2,  2,  2,  2,  2, 33, 33, 33, 33,  2,  2,  2,  2,126,126,
+  126,126,126,126,126,126,126,126,126,  2,  2,126,126,126,126,126,
+  126,126,  2,  2,  2,  2,126,126,126,126,126,126,126,  2,142,142,
+  142,142,142,142,142,142,142,142,142,142,  2,  2,  2,  2,125,125,
+  125,125,125,125,125,125,125,125,125,  2,  2,  2,  2,  2,  2,  2,
+    2,  2,  2,  2,  2,125,154,154,154,154,154,154,154,  2,  2,154,
+    2,  2,154,154,154,154,154,154,154,154,  2,154,154,  2,154,154,
+  154,154,154,154,154,154,154,154,154,154,154,154,  2,154,154,  2,
+    2,154,154,154,154,154,154,154,  2,  2,  2,  2,  2,  2,150,150,
+  150,150,150,150,150,150,  2,  2,150,150,150,150,150,150,150,150,
+  150,150,150,  2,  2,  2,141,141,141,141,141,141,141,141,140,140,
+  140,140,140,140,140,140,140,140,140,  2,  2,  2,  2,  2,121,121,
+  121,121,121,121,121,121,121,  2,  2,  2,  2,  2,  2,  2,  7,  7,
+    2,  2,  2,  2,  2,  2,169,169,169,169,169,169,169,169,169,169,
+    2,  2,  2,  2,  2,  2,133,133,133,133,133,133,133,133,133,  2,
+  133,133,133,133,133,133,133,133,133,133,133,133,133,  2,133,133,
+  133,133,133,133,  2,  2,133,133,133,133,133,  2,  2,  2,134,134,
+  134,134,134,134,134,134,  2,  2,134,134,134,134,134,134,  2,134,
+  134,134,134,134,134,134,134,134,134,134,134,134,134,  2,138,138,
+  138,138,138,138,138,  2,138,138,  2,138,138,138,138,138,138,138,
+  138,138,138,138,138,138,  2,  2,138,  2,138,138,  2,138,138,138,
+    2,  2,  2,  2,  2,  2,143,143,143,143,143,143,  2,143,143,  2,
+  143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,143,
+  143,143,143,143,143,  2,143,143,  2,143,143,143,143,143,143,  2,
+    2,  2,  2,  2,  2,  2,143,143,  2,  2,  2,  2,  2,  2,145,145,
+  145,145,145,145,145,145,145,  2,  2,  2,  2,  2,  2,  2,163,163,
+  163,163,163,163,163,163,163,  2,163,163,163,163,163,163,163,163,
+  163,  2,  2,  2,163,163,163,163,163,  2,  2,  2,  2,  2, 86,  2,
+    2,  2,  2,  2,  2,  2, 22, 22,  2,  2,  2,  2,  2,  2,  2,  2,
+    2,  2,  2,  2,  2, 22, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+    2,  2,  2,  2,  2,  2, 63, 63, 63, 63, 63, 63, 63,  2, 63, 63,
+   63, 63, 63,  2,  2,  2, 63, 63, 63, 63,  2,  2,  2,  2,157,157,
+  157,157,157,157,157,157,157,157,157,  2,  2,  2,  2,  2, 80, 80,
+   80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80, 80,  2,  2, 80, 80,
+   80,  2,  2,  2,  2,  2,127,127,127,127,127,127,127,127,127,127,
+  127,127,127,127,127,  2,166,166,166,166,166,166,166,166,166,166,
+    2,  2,  2,  2,  2,  2, 79,  2,  2,  2,  2,  2,  2,  2,115,115,
+  115,115,115,115,115,115,115,115,115,115,115,115,115,  2,115,115,
+    2,  2,  2,  2,115,115,159,159,159,159,159,159,159,159,159,159,
+  159,159,159,159,159,  2,159,159,  2,  2,  2,  2,  2,  2,103,103,
+  103,103,103,103,103,103,103,103,103,103,103,103,  2,  2,119,119,
+  119,119,119,119,119,119,119,119,119,119,119,119,  2,  2,119,119,
+    2,119,119,119,119,119,  2,  2,  2,  2,  2,119,119,119,167,167,
+  167,167,167,167,167,167,167,167,  2,  2,  2,  2,  2,  2,146,146,
+  146,146,146,146,146,146,146,146,146,  2,  2,  2,  2,  2, 99, 99,
+   99, 99, 99, 99, 99, 99, 99, 99, 99,  2,  2,  2,  2, 99,  2,  2,
+    2,  2,  2,  2,  2, 99,136,139, 13, 13,155,  2,  2,  2,136,136,
+  136,136,136,136,136,136,155,155,155,155,155,155,155,155,155,155,
+  155,155,155,155,  2,  2,  2,  2,  2,  2,  2,  2,  2,155,136,  2,
+    2,  2,  2,  2,  2,  2, 17, 17, 17, 17,  2, 17, 17, 17, 17, 17,
+   17, 17,  2, 17, 17,  2, 17, 15, 15, 15, 15, 15, 15, 15, 17, 17,
+   17,  2,  2,  2,  2,  2,  2,  2, 15,  2,  2,  2,  2,  2, 15, 15,
+   15,  2,  2, 17,  2,  2,  2,  2,  2,  2, 17, 17, 17, 17,139,139,
+  139,139,139,139,139,139,139,139,139,139,  2,  2,  2,  2,105,105,
+  105,105,105,105,105,105,105,105,105,  2,  2,  2,  2,  2,105,105,
+  105,105,105,  2,  2,  2,105,  2,  2,  2,  2,  2,  2,  2,105,105,
+    2,  2,105,105,105,105,  1,  1,  1,  1,  1,  1,  2,  2,  0,  0,
+    0,  0,  0,  0,  0,  1,  1,  1,  0,  0,  0,  0,  0,  0,  0,  0,
+    0,  1,  1,  1,  1,  1,  1,  1,  1,  0,  0,  1,  1,  1,  1,  1,
+    1,  1,  0,  0,  0,  0,  0,  0,  1,  1,  1,  1,  0,  0,  2,  2,
+    0,  2,  2,  0,  0,  2,  2,  0,  0,  0,  0,  2,  0,  0,  0,  0,
+    2,  0,  2,  0,  0,  0,  0,  0,  0,  0,  2,  0,  0,  0,  0,  0,
+    0,  2,  2,  0,  0,  0,  0,  0,  2,  0,  0,  0,  0,  2,  0,  0,
+    0,  0,  0,  2,  0,  2,  2,  2,  0,  0,  0,  0,  0,  0,  0,  2,
+    0,  0,  0,  0,  0,  0,131,131,131,131,131,131,131,131,131,131,
+  131,131,  2,  2,  2,  2,  2,  2,  2,131,131,131,131,131,  2,131,
+  131,131,131,131,131,131,  2,  2,  2,  2,  2, 19, 19, 19, 56, 56,
+   56, 56, 56, 56, 56,  2, 56,  2,  2, 56, 56, 56, 56, 56, 56, 56,
+    2, 56, 56,  2, 56, 56, 56, 56, 56,  2,  2,  2,  2,  2,  6,  6,
+    6,  6,  6,  6,  2,  2,  2,  2,  2,  2,  2,  2,  2,  6,151,151,
+  151,151,151,151,151,151,151,151,151,151,151,  2,  2,  2,151,151,
+  151,151,151,151,  2,  2,151,151,  2,  2,  2,  2,151,151,160,160,
+  160,160,160,160,160,160,160,160,160,160,160,160,160,  2,152,152,
+  152,152,152,152,152,152,152,152,  2,  2,  2,  2,  2,152,164,164,
+  164,164,164,164,164,164,164,164,  2,  2,  2,  2,  2,  2,168,168,
+  168,168,168,168,168,168,168,168,168,  2,  2,  2,  2,168, 30, 30,
+   30, 30,  2, 30, 30,  2,113,113,113,113,113,113,113,113,113,113,
+  113,113,113,  2,  2,113,113,113,113,113,113,113,113,  2,132,132,
+  132,132,132,132,132,132,132,132,132,132,  2,  2,  2,  2,132,132,
+    2,  2,  2,  2,132,132,  3,  3,  3,  3,  2,  3,  3,  3,  2,  3,
+    3,  2,  3,  2,  2,  3,  2,  3,  3,  3,  3,  3,  3,  3,  3,  3,
+    3,  2,  3,  3,  3,  3,  2,  3,  2,  3,  2,  2,  2,  2,  2,  2,
+    3,  2,  2,  2,  2,  3,  2,  3,  2,  3,  2,  3,  3,  3,  2,  3,
+    2,  3,  2,  3,  2,  3,  2,  3,  3,  3,  3,  2,  3,  2,  3,  3,
+    2,  3,  3,  3,  3,  3,  3,  3,  3,  3,  2,  2,  2,  2,  2,  3,
+    3,  3,  2,  3,  3,  3,  3,  3,  2,  2,  2,  2,  2,  2,  2,  2,
+    2,  2,  2,  2,  0,  0, 15,  0,  0,  2,  2,  2,  2,  2,  2,  2,
+    2,  2,  0,  0,  0,  0,  2,  2,  2,  0,  0,  0,  0,  0,  0,  0,
+    2,  2,  2,  2,  2,  0,  0,  0,  0,  0,  0,  2,  2,  0, 13,  2,
+    2,  2,  2,  2,  2,  2, 13, 13, 13,  2,  2,  2,  2,  2,  2,  0,
+    2,  2,  2,  2,  2,  2,  0,  1,  2,  3,  4,  5,  6,  7,  8,  9,
+    9,  9,  9, 10,  9, 11, 12, 13,  9,  9,  9, 14,  9,  9, 15,  9,
     9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
     9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
     9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
     9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
     9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
-    9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9, 16, 17,
-    9,  9,  9,  9,  9,  9,  9,  9,  9,  9, 18, 19, 20,  9, 21,  9,
     9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
+    9,  9, 16, 17,  9,  9,  9,  9, 18,  9,  9,  9,  9,  9, 19, 20,
+   21,  9, 22,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
     9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
+    9,  9,  9,  9,  9,  9, 23,  9,  9,  9,  9,  9, 24,  9,  9,  9,
     9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
     9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
+    9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9, 25,  9,
     9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
-    9,  9,  9,  9,  9,  9,  9,  9,  9,  9, 22,  9,  9,  9,  9,  9,
     9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
     9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
     9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
@@ -3704,60 +3934,66 @@ _hb_ucd_u8[14752] =
     9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
     9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
     9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
-    9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9, 23, 24,
-    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  2,  3,  4,
-    5,  6,  7,  8,  9, 10, 11, 12,  0,  0, 13, 14, 15, 16, 17, 18,
-   19, 20, 21, 22,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-    0,  0,  0,  0, 23,  0,  0, 24, 25, 26, 27, 28, 29, 30,  0,  0,
-   31, 32,  0, 33,  0, 34,  0, 35,  0,  0,  0,  0, 36, 37, 38, 39,
+    9,  9, 26, 27,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+    1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12,  0,  0, 13, 14,
+   15, 16, 17, 18, 19, 20, 21, 22,  0,  0,  0,  0,  0,  0,  0,  0,
+    0,  0,  0,  0,  0,  0,  0,  0, 23,  0,  0, 24, 25, 26, 27, 28,
+   29, 30,  0,  0, 31, 32,  0, 33,  0, 34,  0, 35,  0,  0,  0,  0,
+   36, 37, 38, 39,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+    0,  0,  0,  0,  0,  0, 40,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+   41, 42,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-    0,  0, 40,  0,  0,  0,  0,  0,  0,  0,  0,  0, 41, 42,  0,  0,
+    0,  0,  0,  0,  0,  0, 43, 44,  0, 45,  0,  0,  0,  0,  0,  0,
+   46, 47,  0,  0,  0,  0,  0, 48,  0, 49,  0,  0,  0,  0,  0,  0,
+    0,  0,  0,  0,  0,  0,  0,  0, 50, 51,  0,  0,  0, 52,  0,  0,
+   53,  0,  0,  0,  0,  0,  0,  0, 54,  0,  0,  0,  0,  0,  0,  0,
+   55,  0,  0,  0,  0,  0,  0,  0, 56,  0,  0,  0,  0,  0,  0,  0,
+    0, 57,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+    0,  0,  0,  0,  0,  0,  0,  0, 58, 59, 60, 61, 62, 63, 64, 65,
+    0,  0,  0,  0,  0,  0, 66,  0,  0,  0,  0,  0,  0,  0,  0,  0,
     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-    0,  0, 43, 44,  0, 45,  0,  0,  0,  0,  0,  0, 46, 47,  0,  0,
-    0,  0,  0, 48,  0, 49,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-    0,  0,  0,  0, 50, 51,  0,  0,  0, 52,  0,  0, 53,  0,  0,  0,
-    0,  0,  0,  0, 54,  0,  0,  0,  0,  0,  0,  0, 55,  0,  0,  0,
-    0,  0,  0,  0, 56,  0,  0,  0,  0,  0,  0,  0,  0, 57,  0,  0,
     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-    0,  0,  0,  0, 58, 59, 60, 61, 62, 63, 64, 65,  0,  0,  0,  0,
-    0,  0, 66,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+    0,  0,  0,  0, 67, 68,  0, 69, 70,  0,  0,  0,  0,  0,  0,  0,
+    0,  0,  0,  0, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82,
+   83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98,
+   99,100,101,102,103,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+    0,  0,  0,  0,  0,  0,104,  0,  0,  0,  0,  0,  0,105,106,  0,
+  107,  0,  0,  0,108,  0,109,  0,110,  0,111,112,113,  0,114,  0,
+    0,  0,115,  0,  0,  0,116,  0,  0,  0,  0,  0,  0,  0,  0,  0,
     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+    0,117,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+    0,  0,  0,  0,  0,  0,  0,  0,118,119,120,121,  0,122,123,124,
+  125,126,  0,127,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+    0,  0,  0,  0,128,129,130,131,132,133,134,135,136,137,138,139,
+  140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,
+  156,157,  0,  0,  0,158,159,160,161,  0,  0,  0,  0,  0,  0,  0,
     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-   67, 68,  0, 69, 70,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-   71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
-   87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99,100,101,102,
-  103,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-    0,  0,104,  0,  0,  0,  0,  0,  0,105,106,  0,107,  0,  0,  0,
-  108,  0,109,  0,110,  0,111,112,113,  0,114,  0,  0,  0,115,  0,
-    0,  0,116,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,117,  0,  0,
     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-    0,  0,  0,  0,118,119,120,121,  0,122,123,124,125,126,  0,127,
+  162,  0,163,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,164,165,  0,
+    0,  0,  0,  0,  0,  0,166,  0,  0,  0,  0,  0,  0,  0,  0,  0,
     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+    0,  0,  0,  0,  0,  0,  0,  0,167,  0,  0,  0,168,169,  0,  0,
+  170,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,171,
+    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,172,
     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-  128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,
-  144,145,146,147,148,149,150,151,152,153,154,155,156,157,  0,  0,
-    0,158,159,160,161,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-    0,  0,  0,  0,  0,  0,  0,  0,  0,162,163,  0,  0,  0,  0,  0,
-    0,  0,164,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+    0,  0,  0,  0,  0,  0,  0,173,  0,  0,  0,  0,  0,  0,  0,  0,
     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-    0,  0,  0,  0,165,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,166,  0,  0,  0,  0,
-    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,167,  0,  0,  0,  0,
+    0,  0,  0,  0,  0,  0,174,  0,  0,  0,  0,  0,  0,  0,  0,  0,
     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-    0,  0,  0,168,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,175,  0,  0,  0,  0,  0,
     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-    0,  0,  0,  0,  0,169,170,  0,  0,  0,  0,171,172,  0,  0,  0,
-  173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,
-  189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,
-  205,206,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  2,  3,  4,
+    0,  0,  0,  0,  0,  0,  0,  0,  0,176,177,  0,  0,  0,  0,178,
+  179,  0,  0,  0,180,181,182,183,184,185,186,187,188,189,190,191,
+  192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,
+  208,209,210,211,212,213,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+    1,  2,  3,  4,
 };
 static const uint16_t
-_hb_ucd_u16[10060] =
+_hb_ucd_u16[9668] =
 {
      0,   0,   1,   2,   3,   4,   5,   6,   0,   0,   7,   8,   9,  10,  11,  12,
     13,  13,  13,  14,  15,  13,  13,  16,  17,  18,  19,  20,  21,  22,  13,  23,
@@ -3776,9 +4012,10 @@ _hb_ucd_u16[10060] =
    136,  48,  48, 137, 138, 139, 140, 140, 141,  48, 142, 143, 144, 145, 140, 140,
    146, 147, 148, 149, 150,  48, 151, 152, 153, 154,  32, 155, 156, 157, 140, 140,
     48,  48, 158, 159, 160, 161, 162, 163, 164, 165,   9,   9, 166,  11,  11, 167,
-    48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48, 168, 169,  48,  48,
-   168,  48,  48, 170, 171, 172,  48,  48,  48, 171,  48,  48,  48, 173, 174, 175,
-    48, 176,   9,   9,   9,   9,   9, 177, 178,  48,  48,  48,  48,  48,  48,  48,
+    48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,
+    48,  48,  48,  48, 168, 169,  48,  48, 168,  48,  48, 170, 171, 172,  48,  48,
+    48, 171,  48,  48,  48, 173, 174, 175,  48, 176,   9,   9,   9,   9,   9, 177,
+   178,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,
     48,  48,  48,  48,  48,  48, 179,  48, 180, 181,  48,  48,  48,  48, 182, 183,
     48, 184,  48, 185,  48, 186, 187, 188,  48,  48,  48, 189, 190, 191, 192, 193,
    194, 192,  48,  48, 195,  48,  48, 196, 197,  48, 198,  48,  48,  48,  48, 199,
@@ -3791,28 +4028,34 @@ _hb_ucd_u16[10060] =
    241, 242, 241, 241, 242, 243, 241, 244, 245, 245, 245, 246, 247, 248, 249, 250,
    251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 261, 262, 263, 264, 265,
    266, 267, 268, 269, 270, 271, 272, 272, 273, 274, 275, 209, 276, 277, 209, 278,
-   279, 279, 279, 279, 279, 279, 279, 279, 280, 209, 281, 209, 209, 209, 209, 282,
-   209, 283, 279, 284, 209, 285, 286, 209, 209, 209, 287, 140, 288, 140, 271, 271,
-   271, 289, 209, 209, 209, 209, 290, 271, 209, 209, 209, 209, 209, 209, 209, 209,
-   209, 209, 209, 291, 292, 209, 209, 293, 209, 209, 209, 209, 209, 209, 294, 209,
-   209, 209, 209, 209, 209, 209, 295, 296, 271, 297, 209, 209, 298, 279, 299, 279,
-   300, 301, 279, 279, 279, 302, 279, 303, 209, 209, 209, 279, 304, 209, 209, 305,
-   209, 306, 209, 209, 209, 209, 209, 209,   9,   9,   9,  11,  11,  11, 307, 308,
-    13,  13,  13,  13,  13,  13, 309, 310,  11,  11, 311,  48,  48,  48, 312, 313,
-    48, 314, 315, 315, 315, 315,  32,  32, 316, 317, 318, 319, 320, 321, 140, 140,
-   209, 322, 209, 209, 209, 209, 209, 323, 209, 209, 209, 209, 209, 324, 140, 209,
-   325, 326, 327, 328, 136,  48,  48,  48,  48, 329, 178,  48,  48,  48,  48, 330,
-   331,  48,  48, 136,  48,  48,  48,  48, 200, 332,  48,  48, 209, 209, 333,  48,
-   209, 334, 335, 209, 336, 337, 209, 209, 335, 209, 209, 337, 209, 209, 209, 209,
-    48,  48,  48,  48, 209, 209, 209, 209,  48, 338,  48,  48,  48,  48,  48,  48,
-   151, 209, 209, 209, 287,  48,  48, 229, 339,  48, 340, 140,  13,  13, 341, 342,
-    13, 343,  48,  48,  48,  48, 344, 345,  31, 346, 347, 348,  13,  13,  13, 349,
-   350, 351, 352, 353, 354, 355, 140, 356, 357,  48, 358, 359,  48,  48,  48, 360,
-   361,  48,  48, 362, 363, 192,  32, 364,  64,  48, 365,  48, 366, 367,  48, 151,
-    76,  48,  48, 368, 369, 370, 371, 372,  48,  48, 373, 374, 375, 376,  48, 377,
-    48,  48,  48, 378, 379, 380, 381, 382, 383, 384, 315,  11,  11, 385, 386,  11,
-    11,  11,  11,  11,  48,  48, 387, 192,  48,  48, 388,  48, 389,  48,  48, 206,
-   390, 390, 390, 390, 390, 390, 390, 390, 391, 391, 391, 391, 391, 391, 391, 391,
+   279, 279, 279, 279, 279, 279, 279, 279, 279, 279, 279, 279, 279, 279, 279, 279,
+   280, 209, 281, 209, 209, 209, 209, 282, 209, 283, 279, 284, 209, 285, 286, 209,
+   209, 209, 176, 140, 287, 140, 271, 271, 271, 288, 209, 209, 209, 209, 289, 271,
+   209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 290, 291, 209, 209, 292,
+   209, 209, 209, 209, 209, 209, 293, 209, 209, 209, 209, 209, 209, 209, 209, 209,
+   209, 209, 209, 209, 209, 209, 294, 295, 271, 296, 209, 209, 297, 279, 298, 279,
+   209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209,
+   279, 279, 279, 279, 279, 279, 279, 279, 299, 300, 279, 279, 279, 301, 279, 302,
+   209, 209, 209, 279, 303, 209, 209, 304, 209, 305, 209, 209, 209, 209, 209, 209,
+     9,   9,   9,  11,  11,  11, 306, 307,  13,  13,  13,  13,  13,  13, 308, 309,
+    11,  11, 310,  48,  48,  48, 311, 312,  48, 313, 314, 314, 314, 314,  32,  32,
+   315, 316, 317, 318, 319, 320, 140, 140, 209, 321, 209, 209, 209, 209, 209, 322,
+   209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 323, 140, 209,
+   324, 325, 326, 327, 136,  48,  48,  48,  48, 328, 178,  48,  48,  48,  48, 329,
+   330,  48,  48, 136,  48,  48,  48,  48, 200, 331,  48,  48, 209, 209, 332,  48,
+   209, 333, 334, 209, 335, 336, 209, 209, 334, 209, 209, 336, 209, 209, 209, 209,
+    48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48, 209, 209, 209, 209,
+    48, 337,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,
+    48,  48,  48,  48,  48,  48,  48,  48, 151, 209, 209, 209, 338,  48,  48, 229,
+   339,  48, 340, 140,  13,  13, 341, 342,  13, 343,  48,  48,  48,  48, 344, 345,
+    31, 346, 347, 348,  13,  13,  13, 349, 350, 351, 352, 353, 354, 355, 140, 356,
+   357,  48, 358, 359,  48,  48,  48, 360, 361,  48,  48, 362, 363, 192,  32, 364,
+    64,  48, 365,  48, 366, 367,  48, 151,  76,  48,  48, 368, 369, 370, 371, 372,
+    48,  48, 373, 374, 375, 376,  48, 377,  48,  48,  48, 378, 379, 380, 381, 382,
+   383, 384, 314,  11,  11, 385, 386,  11,  11,  11,  11,  11,  48,  48, 387, 192,
+    48,  48,  48,  48,  48,  48,  48,  48,  48,  48, 388,  48, 389,  48,  48, 206,
+   390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390, 390,
+   391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391,
     48,  48,  48,  48,  48,  48, 204,  48,  48,  48,  48,  48,  48, 207, 140, 140,
    392, 393, 394, 395, 396,  48,  48,  48,  48,  48,  48, 397, 398, 399,  48,  48,
     48,  48,  48, 400, 209,  48,  48,  48,  48, 401,  48,  48, 402, 140, 140, 403,
@@ -3823,571 +4066,540 @@ _hb_ucd_u16[10060] =
    140, 140, 140, 140, 140, 140, 140, 140,  48, 151,  48,  48,  48, 100, 429, 430,
     48,  48, 431,  48, 432,  48,  48, 433,  48, 434,  48,  48, 435, 436, 140, 140,
      9,   9, 437,  11,  11,  48,  48,  48,  48, 204, 192,   9,   9, 438,  11, 439,
-    48,  48, 440,  48,  48,  48, 441, 442, 442, 443, 444, 445, 140, 140, 140, 140,
-    48,  48,  48, 314,  48, 199, 440, 140, 446,  27,  27, 447, 140, 140, 140, 140,
+    48,  48, 440,  48,  48,  48, 441, 442, 442, 443, 444, 445,  48,  48,  48, 388,
+    48,  48,  48, 313,  48, 199, 440, 140, 446,  27,  27, 447, 140, 140, 140, 140,
    448,  48,  48, 449,  48, 450,  48, 451,  48, 200, 452, 140, 140, 140,  48, 453,
     48, 454,  48, 455, 140, 140, 140, 140,  48,  48,  48, 456, 271, 457, 271, 271,
    458, 459,  48, 460, 461, 462,  48, 463,  48, 464, 140, 140, 465,  48, 466, 467,
     48,  48,  48, 468,  48, 469,  48, 470,  48, 471, 472, 140, 140, 140, 140, 140,
     48,  48,  48,  48, 196, 140, 140, 140,   9,   9,   9, 473,  11,  11,  11, 474,
-    48,  48, 475, 192, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 271, 476,
-    48,  48, 477, 478, 140, 140, 140, 479,  48, 464, 480,  48,  62, 481, 140,  48,
-   482, 140, 140,  48, 483, 140,  48, 314, 484,  48,  48, 485, 486, 457, 487, 488,
-   222,  48,  48, 489, 490,  48, 196, 192, 491,  48, 492, 493, 494,  48,  48, 495,
-   222,  48,  48, 496, 497, 498, 499, 500,  48,  97, 501, 502, 503, 140, 140, 140,
-   504, 505, 506,  48,  48, 507, 508, 192, 509,  83,  84, 510, 511, 512, 513, 514,
-    48,  48,  48, 515, 516, 517, 478, 140,  48,  48,  48, 518, 519, 192, 140, 140,
-    48,  48, 520, 521, 522, 523, 140, 140,  48,  48,  48, 524, 525, 192, 526, 140,
-    48,  48, 527, 528, 192, 140, 140, 140,  48, 173, 529, 530, 314, 140, 140, 140,
-    48,  48, 501, 531, 140, 140, 140, 140, 140, 140,   9,   9,  11,  11, 148, 532,
-   533, 534,  48, 535, 536, 192, 140, 140, 140, 140, 537,  48,  48, 538, 539, 140,
-   540,  48,  48, 541, 542, 543,  48,  48, 544, 545, 546,  48,  48,  48,  48, 196,
-   547, 140, 140, 140, 140, 140, 140, 140,  84,  48, 520, 548, 549, 148, 175, 550,
-    48, 551, 552, 553, 140, 140, 140, 140, 554,  48,  48, 555, 556, 192, 557,  48,
-   558, 559, 192, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,  48, 560,
-   561, 115,  48, 562, 563, 192, 140, 140, 140, 140, 140, 100, 271, 564, 565, 566,
-    48, 207, 140, 140, 140, 140, 140, 140, 272, 272, 272, 272, 272, 272, 567, 568,
-    48,  48,  48,  48, 388, 140, 140, 140, 140,  48,  48,  48,  48,  48,  48, 569,
-    48,  48,  48, 570, 571, 572, 140, 140,  48,  48,  48,  48, 314, 140, 140, 140,
-    48,  48,  48, 196,  48, 200, 370,  48,  48,  48,  48, 200, 192,  48, 204, 573,
-    48,  48,  48, 574, 575, 576, 577, 578,  48, 140, 140, 140, 140, 140, 140, 140,
-   140, 140, 140, 140,   9,   9,  11,  11, 271, 579, 140, 140, 140, 140, 140, 140,
-    48,  48,  48,  48, 580, 581, 582, 582, 583, 584, 140, 140, 140, 140, 585, 586,
-    48,  48,  48,  48,  48,  48,  48, 440,  48,  48,  48,  48,  48, 199, 140, 140,
-   196, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 587,
-    48,  48, 588, 589, 140, 590, 591,  48,  48,  48,  48,  48,  48,  48,  48, 206,
-    48,  48,  48,  48,  48,  48,  71, 151, 196, 592, 593, 140, 140, 140, 140, 140,
-    32,  32, 594,  32, 595, 209, 209, 209, 209, 209, 209, 209, 323, 140, 140, 140,
-   209, 209, 209, 209, 209, 209, 209, 324, 209, 209, 596, 209, 209, 209, 597, 598,
-   599, 209, 600, 209, 209, 209, 288, 140, 209, 209, 209, 209, 601, 140, 140, 140,
-   140, 140, 140, 140, 271, 602, 271, 602, 209, 209, 209, 209, 209, 287, 271, 461,
-     9, 603,  11, 604, 605, 606, 241,   9, 607, 608, 609, 610, 611,   9, 603,  11,
-   612, 613,  11, 614, 615, 616, 617,   9, 618,  11,   9, 603,  11, 604, 605,  11,
-   241,   9, 607, 617,   9, 618,  11,   9, 603,  11, 619,   9, 620, 621, 622, 623,
-    11, 624,   9, 625, 626, 627, 628,  11, 629,   9, 630,  11, 631, 632, 632, 632,
-    32,  32,  32, 633,  32,  32, 634, 635, 636, 637,  45, 140, 140, 140, 140, 140,
-   638, 639, 640, 140, 140, 140, 140, 140, 641, 642, 643,  27,  27,  27, 644, 140,
-   645, 140, 140, 140, 140, 140, 140, 140,  48,  48, 151, 646, 647, 140, 140, 140,
-   140,  48, 648, 140,  48,  48, 649, 650, 140, 140, 140, 140, 140,  48, 651, 192,
-   140, 140, 140, 140, 140, 140, 652, 200,  48,  48,  48,  48, 653, 595, 140, 140,
-     9,   9, 607,  11, 654, 370, 140, 140, 140, 140, 140, 140, 140, 140, 140, 499,
-   271, 271, 655, 656, 140, 140, 140, 140, 499, 271, 657, 658, 140, 140, 140, 140,
-   659,  48, 660, 661, 662, 663, 664, 665, 666, 206, 667, 206, 140, 140, 140, 668,
-   209, 209, 669, 209, 209, 209, 209, 209, 209, 323, 334, 670, 670, 670, 209, 324,
-   671, 209, 209, 209, 209, 209, 209, 209, 209, 209, 672, 140, 140, 140, 673, 209,
-   674, 209, 209, 669, 675, 676, 324, 140, 209, 209, 209, 209, 209, 209, 209, 677,
-   209, 209, 209, 209, 209, 678, 426, 426, 209, 209, 209, 209, 209, 209, 209, 679,
-   209, 209, 209, 209, 209, 176, 669, 427, 669, 209, 209, 209, 680, 176, 209, 209,
-   680, 209, 672, 676, 140, 140, 140, 140, 209, 209, 209, 209, 209, 323, 672, 426,
-   675, 209, 209, 681, 682, 669, 675, 675, 209, 683, 209, 209, 288, 140, 140, 192,
-    48,  48,  48,  48,  48,  48, 140, 140,  48,  48,  48, 207,  48,  48,  48,  48,
-    48, 204,  48,  48,  48,  48,  48,  48,  48,  48, 478,  48,  48,  48,  48,  48,
-    48,  48,  48,  48,  48,  48, 100,  48,  48,  48,  48,  48,  48, 204, 140, 140,
-    48, 204, 140, 140, 140, 140, 140, 140,  48,  48,  48,  48,  71,  48,  48,  48,
-    48,  48,  48, 140, 140, 140, 140, 140, 684, 140, 570, 570, 570, 570, 570, 570,
+    48,  48, 475, 192, 476,   9, 477,  11, 478, 140, 140, 140, 140, 140, 140, 140,
+   140, 140, 140, 140, 140, 140, 271, 479,  48,  48, 480, 481, 482, 140, 140, 483,
+    48, 464, 484,  48,  62, 485, 140,  48, 486, 140, 140,  48, 487, 140,  48, 313,
+   488,  48,  48, 489, 490, 457, 491, 492, 222,  48,  48, 493, 494,  48, 196, 192,
+   495,  48, 496, 497, 498,  48,  48, 499, 222,  48,  48, 500, 501, 502, 503, 504,
+    48,  97, 505, 506, 507, 140, 140, 140, 508, 509, 510,  48,  48, 511, 512, 192,
+   513,  83,  84, 514, 515, 516, 517, 518, 519,  48,  48, 520, 521, 522, 523, 140,
+    48,  48,  48, 524, 525, 526, 481, 140,  48,  48,  48, 527, 528, 192, 140, 140,
+   140, 140, 140, 140, 140, 140, 140, 140,  48,  48, 529, 530, 531, 532, 140, 140,
+    48,  48,  48, 533, 534, 192, 535, 140,  48,  48, 536, 537, 192, 538, 539, 140,
+    48, 540, 541, 542, 313, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
+    48,  48, 505, 543, 140, 140, 140, 140, 140, 140,   9,   9,  11,  11, 148, 544,
+   545, 546,  48, 547, 548, 192, 140, 140, 140, 140, 549,  48,  48, 550, 551, 140,
+   552,  48,  48, 553, 554, 555,  48,  48, 556, 557, 558,  48,  48,  48,  48, 196,
+   559, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,  48,  48, 560, 192,
+    84,  48, 529, 561, 562, 148, 175, 563,  48, 564, 565, 566, 140, 140, 140, 140,
+   567,  48,  48, 568, 569, 192, 570,  48, 571, 572, 192, 140, 140, 140, 140, 140,
+   140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,  48, 573,
+   574, 115,  48, 575, 576, 577, 140, 140, 140, 140, 140, 100, 271, 578, 579, 580,
+    48,  48,  48,  48,  48,  48,  48,  48,  48, 207, 140, 140, 140, 140, 140, 140,
+   272, 272, 272, 272, 272, 272, 581, 582,  48,  48,  48,  48,  48,  48,  48,  48,
+    48,  48,  48,  48, 388, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
+   140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
+   140, 140, 140, 140, 140, 140, 140, 140, 140,  48,  48,  48,  48,  48,  48, 583,
+    48,  48,  48, 584, 585, 586,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,
+    48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  71,
+    48,  48,  48,  48, 313, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
+    48, 587, 588, 192, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
+    48,  48,  48, 196,  48, 200, 370,  48,  48,  48,  48, 200, 192,  48, 204, 589,
+    48,  48,  48, 590, 591, 592, 593, 594,  48, 140, 140, 140, 140, 140, 140, 140,
+   140, 140, 140, 140, 595,  48, 596, 192, 140, 140, 140, 140, 140, 140, 140, 140,
+   140, 140, 140, 140,   9,   9,  11,  11, 271, 597, 140, 140, 140, 140, 140, 140,
+    48,  48,  48,  48, 598, 599, 600, 600, 601, 602, 140, 140, 140, 140, 603, 604,
+    48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48, 440,
+    48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48, 199, 140, 605,
+   196, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
+   140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 606,
+    48,  48, 607, 608, 140, 609, 610,  48,  48,  48,  48,  48,  48,  48,  48,  48,
+    48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48, 206,
+    48,  48,  48,  48,  48,  48,  71, 151, 196, 611, 612, 140, 140, 140, 140, 140,
+   209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 192,
+   209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 322, 140, 140, 140, 140,
+    32,  32, 613,  32, 614, 209, 209, 209, 209, 209, 209, 209, 322, 140, 140, 140,
+   209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 323,
+   209, 209, 615, 209, 209, 209, 616, 617, 618, 209, 619, 209, 209, 209, 287, 140,
+   209, 209, 209, 209, 620, 140, 140, 140, 140, 140, 140, 140, 271, 621, 271, 621,
+   209, 209, 209, 209, 209, 338, 271, 461, 140, 140, 140, 140, 140, 140, 140, 140,
+     9, 622,  11, 623, 624, 625, 241,   9, 626, 627, 628, 629, 630,   9, 622,  11,
+   631, 632,  11, 633, 634, 635, 636,   9, 637,  11,   9, 622,  11, 623, 624,  11,
+   241,   9, 626, 636,   9, 637,  11,   9, 622,  11, 638,   9, 639, 640, 641, 642,
+    11, 643,   9, 644, 645, 646, 647,  11, 648,   9, 649,  11, 650, 538, 538, 538,
+    32,  32,  32, 651,  32,  32, 652, 653, 654, 655,  45, 140, 140, 140, 140, 140,
+   656, 657, 658, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
+   659, 660, 661,  27,  27,  27, 662, 140, 663, 140, 140, 140, 140, 140, 140, 140,
+    48,  48, 151, 664, 665, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
+   140, 140, 140, 140, 140, 140, 140, 140, 140,  48, 666, 140,  48,  48, 667, 668,
+   140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,  48, 669, 192,
+   140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,  48, 587, 670,
+   140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 671, 200,
+    48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48, 672, 614, 140, 140,
+     9,   9, 626,  11, 673, 370, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
+   140, 140, 140, 140, 140, 140, 140, 503, 271, 271, 674, 675, 140, 140, 140, 140,
+   503, 271, 676, 677, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
+   678,  48, 679, 680, 681, 682, 683, 684, 685, 206, 686, 206, 140, 140, 140, 687,
+   209, 209, 688, 209, 209, 209, 209, 209, 209, 322, 333, 689, 689, 689, 209, 323,
+   690, 209, 209, 209, 209, 209, 209, 209, 209, 209, 691, 140, 140, 140, 692, 209,
+   693, 209, 209, 688, 694, 695, 323, 140, 140, 140, 140, 140, 140, 140, 140, 140,
+   209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 696,
+   209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 209, 697, 426, 426,
+   209, 209, 209, 209, 209, 209, 209, 698, 209, 209, 209, 209, 209, 176, 688, 427,
+   688, 209, 209, 209, 699, 176, 209, 209, 699, 209, 691, 688, 695, 140, 140, 140,
+   209, 209, 209, 209, 209, 322, 691, 426, 700, 209, 209, 209, 701, 702, 176, 694,
+   209, 209, 209, 209, 209, 209, 209, 209, 209, 703, 209, 209, 209, 209, 209, 192,
+    48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48, 140, 140,
+    48,  48,  48, 207,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,
+    48, 204,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,
+    48,  48,  48,  48,  48,  48,  48,  48,  48,  48, 481,  48,  48,  48,  48,  48,
+    48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48, 100,  48,
+    48,  48,  48,  48,  48, 204, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
+    48, 204, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140, 140,
+    48,  48,  48,  48,  71,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48,
+    48,  48,  48,  48,  48,  48,  48,  48,  48,  48,  48, 140, 140, 140, 140, 140,
+   704, 140, 584, 584, 584, 584, 584, 584, 140, 140, 140, 140, 140, 140, 140, 140,
     32,  32,  32,  32,  32,  32,  32,  32,  32,  32,  32,  32,  32,  32,  32, 140,
-   391, 391, 391, 391, 391, 391, 391, 685, 391, 391, 391, 391, 391, 391, 391, 686,
-     0,   0,   0,   0,   1,   2,   1,   2,   0,   0,   3,   3,   4,   5,   4,   5,
-     4,   4,   4,   4,   4,   4,   4,   4,   4,   4,   4,   6,   0,   0,   7,   0,
-     8,   8,   8,   8,   8,   8,   8,   9,  10,  11,  12,  11,  11,  11,  13,  11,
-    14,  14,  14,  14,  14,  14,  14,  14,  15,  14,  14,  14,  14,  14,  14,  14,
-    14,  14,  14,  16,  17,  18,  17,  17,  19,  20,  21,  21,  22,  21,  23,  24,
-    25,  26,  27,  27,  28,  29,  27,  30,  27,  27,  27,  27,  27,  31,  27,  27,
-    32,  33,  33,  33,  34,  27,  27,  27,  35,  35,  35,  36,  37,  37,  37,  38,
-    39,  39,  40,  41,  42,  43,  44,  27,  45,  46,  27,  27,  27,  27,  47,  27,
-    48,  48,  48,  48,  48,  49,  50,  48,  51,  52,  53,  54,  55,  56,  57,  58,
-    59,  60,  61,  62,  63,  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,
-    75,  76,  77,  78,  79,  80,  81,  82,  83,  84,  85,  86,  87,  88,  89,  90,
-    91,  92,  93,  94,  95,  96,  97,  98,  99, 100, 101, 102, 103, 104, 105, 106,
-   107, 108, 109, 109, 110, 111, 112, 109, 113, 114, 115, 116, 117, 118, 119, 120,
-   121, 122, 122, 123, 122, 124, 125, 125, 126, 127, 128, 129, 130, 131, 125, 125,
-   132, 132, 132, 132, 133, 132, 134, 135, 132, 133, 132, 136, 136, 137, 125, 125,
-   138, 138, 138, 138, 138, 138, 138, 138, 138, 138, 139, 139, 140, 139, 139, 141,
-   142, 142, 142, 142, 142, 142, 142, 142, 143, 143, 143, 143, 144, 145, 143, 143,
-   144, 143, 143, 146, 147, 148, 143, 143, 143, 147, 143, 143, 143, 149, 143, 150,
-   143, 151, 152, 152, 152, 152, 152, 153, 154, 154, 154, 154, 154, 154, 154, 154,
-   155, 156, 157, 157, 157, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167,
-   168, 168, 168, 168, 168, 169, 170, 170, 171, 172, 173, 173, 173, 173, 173, 174,
-   173, 173, 175, 154, 154, 154, 154, 176, 177, 178, 179, 179, 180, 181, 182, 183,
-   184, 184, 185, 184, 186, 187, 168, 168, 188, 189, 190, 190, 190, 191, 190, 192,
-   193, 193, 194,   8, 195, 125, 125, 125, 196, 196, 196, 196, 197, 196, 196, 198,
-   199, 199, 199, 199, 200, 200, 200, 201, 202, 202, 202, 203, 204, 205, 205, 205,
-   206, 139, 139, 207, 208, 209, 210, 211,   4,   4, 212,   4,   4, 213, 214, 215,
-     4,   4,   4, 216,   8,   8,   8,   8,  11, 217,  11,  11, 217, 218,  11, 219,
-    11,  11,  11, 220, 220, 221,  11, 222, 223,   0,   0,   0,   0,   0, 224, 225,
-   226, 227,   0,   0, 228,   8,   8, 229,   0,   0, 230, 231, 232,   0,   4,   4,
-   233,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
-     0,   0, 234, 125, 235, 125,   0,   0, 236, 236, 236, 236, 236, 236, 236, 236,
-     0,   0,   0,   0,   0,   0,   0, 237,   0, 238,   0,   0,   0,   0,   0,   0,
-   239, 239, 239, 239, 239, 239,   4,   4, 240, 240, 240, 240, 240, 240, 240, 241,
-   139, 139, 140, 242, 242, 242, 243, 244, 143, 245, 246, 246, 246, 246,  14,  14,
-     0,   0,   0,   0,   0, 247, 125, 125, 248, 249, 248, 248, 248, 248, 248, 250,
-   248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 251, 125,   0,
-   252,   0, 253, 254, 255, 256, 256, 256, 256, 257, 258, 259, 259, 259, 259, 260,
-   261, 262, 262, 263, 142, 142, 142, 142, 264,   0, 262, 262,   0,   0, 265, 259,
-   142, 264,   0,   0,   0,   0, 142, 266,   0,   0,   0,   0,   0, 259, 259, 267,
-   259, 259, 259, 259, 259, 268,   0,   0, 248, 248, 248, 248,   0,   0,   0,   0,
-   269, 269, 269, 269, 269, 269, 269, 269, 270, 269, 269, 269, 271, 272, 272, 272,
-   273, 273, 273, 273, 273, 273, 273, 273, 273, 273, 274, 125,  14,  14,  14,  14,
-    14,  14, 275, 275, 275, 275, 275, 276,   0,   0, 277,   4,   4,   4,   4,   4,
-   278,   4,   4,   4, 279, 280, 125, 281, 282, 282, 283, 284, 285, 285, 285, 286,
-   287, 287, 287, 287, 288, 289,  48,  48, 290, 290, 291, 292, 292, 293, 142, 294,
-   295, 295, 295, 295, 296, 297, 138, 298, 299, 299, 299, 300, 301, 302, 138, 138,
-   303, 303, 303, 303, 304, 305, 306, 307, 308, 309, 246,   4,   4, 310, 311, 152,
-   152, 152, 152, 152, 306, 306, 312, 313, 142, 142, 314, 142, 315, 142, 142, 316,
-   125, 125, 125, 125, 125, 125, 125, 125, 248, 248, 248, 248, 248, 248, 317, 248,
-   248, 248, 248, 248, 248, 318, 125, 125, 319, 320,  21, 321, 322,  27,  27,  27,
-    27,  27,  27,  27, 323, 324,  27,  27,  27,  27,  27,  27,  27,  27,  27,  27,
-    27,  27,  27, 325,  27,  27,  27,  27,  27, 326,  27,  27, 327, 125, 125,  27,
-     8, 284, 328,   0,   0, 329, 330, 331,  27,  27,  27,  27,  27,  27,  27, 332,
-   333,   0,   1,   2,   1,   2, 334, 258, 259, 335, 142, 264, 336, 337, 338, 339,
-   340, 341, 342, 343, 344, 344, 125, 125, 341, 341, 341, 341, 341, 341, 341, 345,
-   346,   0,   0, 347,  11,  11,  11,  11, 348, 349, 350, 125, 125,   0,   0, 351,
-   352, 353, 354, 354, 354, 355, 356, 357, 358, 358, 359, 360, 361, 362, 362, 363,
-   364, 365, 366, 366, 367, 368, 125, 125, 369, 369, 369, 369, 369, 370, 370, 370,
-   371, 372, 373, 374, 374, 375, 374, 376, 377, 377, 378, 379, 379, 379, 380, 381,
-   381, 382, 383, 384, 125, 125, 125, 125, 385, 385, 385, 385, 385, 385, 385, 385,
-   385, 385, 385, 386, 385, 387, 388, 125, 389,   4,   4, 390, 125, 125, 125, 125,
-   391, 392, 392, 393, 394, 395, 396, 396, 397, 398, 399, 125, 125, 125, 400, 401,
-   402, 403, 404, 405, 125, 125, 125, 125, 406, 406, 407, 408, 407, 409, 407, 407,
-   410, 411, 412, 413, 414, 414, 415, 415, 416, 416, 125, 125, 417, 417, 418, 419,
-   420, 420, 420, 421, 422, 423, 424, 425, 426, 427, 428, 125, 125, 125, 125, 125,
-   429, 429, 429, 429, 430, 125, 125, 125, 431, 431, 431, 432, 431, 431, 431, 433,
-   434, 434, 435, 436, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125,  27,  45,
-   437, 437, 438, 439, 125, 125, 125, 440, 441, 441, 442, 443, 443, 444, 125, 445,
-   446, 125, 125, 447, 448, 125, 449, 450, 451, 451, 451, 451, 452, 453, 451, 454,
-   455, 455, 455, 455, 456, 457, 458, 459, 460, 460, 460, 461, 462, 463, 463, 464,
-   465, 465, 465, 465, 465, 465, 466, 467, 468, 469, 468, 468, 470, 125, 125, 125,
-   471, 472, 473, 474, 474, 474, 475, 476, 477, 478, 479, 480, 481, 482, 483, 484,
-   485, 485, 485, 485, 485, 486, 487, 125, 488, 488, 488, 488, 489, 490, 125, 125,
-   491, 491, 491, 492, 491, 493, 125, 125, 494, 494, 494, 494, 495, 496, 497, 125,
-   498, 498, 498, 499, 499, 125, 125, 125, 500, 501, 502, 500, 503, 125, 125, 125,
-   504, 504, 504, 505, 125, 125, 125, 125, 125, 125, 506, 506, 506, 506, 506, 507,
-   508, 509, 510, 511, 512, 513, 125, 125, 125, 125, 514, 515, 515, 514, 516, 125,
-   517, 517, 517, 517, 518, 519, 519, 519, 519, 519, 520, 154, 521, 521, 521, 522,
-   523, 125, 125, 125, 125, 125, 125, 125, 524, 525, 525, 526, 527, 525, 528, 529,
-   529, 530, 531, 532, 125, 125, 125, 125, 533, 534, 534, 535, 536, 537, 538, 539,
-   540, 541, 542, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 543, 544,
-   545, 546, 545, 547, 545, 548, 125, 125, 125, 125, 125, 549, 550, 550, 550, 551,
-   552, 552, 552, 552, 552, 552, 552, 552, 552, 553, 125, 125, 125, 125, 125, 125,
-   552, 552, 552, 552, 552, 552, 554, 555, 552, 552, 552, 552, 556, 125, 125, 125,
-   125, 557, 557, 557, 557, 557, 557, 558, 559, 559, 559, 559, 559, 559, 559, 559,
-   559, 559, 559, 559, 559, 560, 125, 125, 561, 561, 561, 561, 561, 561, 561, 561,
-   561, 561, 561, 561, 562, 125, 125, 125, 275, 275, 275, 275, 275, 275, 275, 275,
-   275, 275, 275, 563, 564, 565, 566, 567, 567, 567, 567, 568, 569, 570, 571, 572,
-   573, 573, 573, 573, 574, 575, 576, 577, 573, 125, 125, 125, 125, 125, 125, 125,
-   125, 125, 125, 125, 578, 578, 578, 578, 578, 579, 125, 125, 125, 125, 125, 125,
-   580, 580, 580, 580, 581, 580, 580, 580, 582, 580, 125, 125, 125, 125, 583, 584,
-   585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 585, 586,
-   587, 587, 587, 587, 587, 587, 587, 587, 587, 587, 587, 587, 587, 588, 125, 125,
-   589, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 125, 590,
-   591, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256, 256,
-   256, 256, 592, 593, 125, 594, 595, 596, 596, 596, 596, 596, 596, 596, 596, 596,
-   596, 596, 596, 596, 596, 596, 596, 597, 598, 598, 598, 598, 598, 598, 599, 600,
-   601, 602, 603, 125, 125, 125, 125, 125,   8,   8, 604,   8, 605,   0,   0,   0,
-     0,   0,   0,   0, 603, 125, 125, 125,   0,   0,   0,   0,   0,   0,   0, 606,
-     0,   0, 607,   0,   0,   0, 608, 609, 610,   0, 611,   0,   0,   0, 235, 125,
-    11,  11,  11,  11, 612, 125, 125, 125, 125, 125, 125, 125,   0, 603,   0, 603,
-     0,   0,   0,   0,   0, 234,   0, 613,   0,   0,   0,   0,   0, 224,   0,   0,
-     0, 614, 615, 616, 617,   0,   0,   0, 618, 619,   0, 620, 621, 622,   0,   0,
-     0,   0, 623,   0,   0,   0,   0,   0,   0,   0,   0,   0, 624,   0,   0,   0,
-   625, 625, 625, 625, 625, 625, 625, 625, 626, 627, 628, 125, 125, 125, 125, 125,
-     4, 629, 630, 125, 125, 125, 125, 125, 631, 632, 633,  14,  14,  14, 634, 125,
-   635, 125, 125, 125, 125, 125, 125, 125, 636, 636, 637, 638, 639, 125, 125, 125,
-   125, 640, 641, 125, 642, 642, 642, 643, 125, 125, 125, 125, 125, 644, 644, 645,
-   125, 125, 125, 125, 125, 125, 646, 647, 648, 648, 648, 648, 648, 648, 648, 648,
-   648, 648, 648, 648, 649, 650, 125, 125, 651, 651, 651, 651, 652, 653, 125, 125,
-   125, 125, 125, 125, 125, 125, 125, 333,   0,   0,   0, 654, 125, 125, 125, 125,
-   333,   0,   0, 247, 125, 125, 125, 125, 655,  27, 656, 657, 658, 659, 660, 661,
-   662, 663, 664, 663, 125, 125, 125, 665,   0,   0, 357,   0,   0,   0,   0,   0,
-     0, 603, 226, 333, 333, 333,   0, 606,   0,   0, 247, 125, 125, 125, 666,   0,
-   667,   0,   0, 357, 613, 668, 606, 125,   0,   0,   0,   0,   0, 669, 349, 349,
-     0,   0,   0,   0,   0,   0,   0, 670,   0,   0,   0,   0,   0, 284, 357, 228,
-   357,   0,   0,   0, 671, 284,   0,   0, 671,   0, 247, 668, 125, 125, 125, 125,
-     0,   0,   0,   0,   0, 603, 247, 349, 613,   0,   0, 672, 673, 357, 613, 613,
-     0, 329,   0,   0, 235, 125, 125, 284, 248, 248, 248, 248, 248, 248, 125, 125,
-   248, 248, 248, 318, 248, 248, 248, 248, 248, 317, 248, 248, 248, 248, 248, 248,
-   248, 248, 584, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 248, 674, 248,
-   248, 248, 248, 248, 248, 317, 125, 125, 248, 317, 125, 125, 125, 125, 125, 125,
-   248, 248, 248, 248, 675, 248, 248, 248, 248, 248, 248, 125, 125, 125, 125, 125,
-   676, 125,   0,   0,   0,   0,   0,   0,   8,   8,   8,   8,   8,   8,   8,   8,
-     8,   8,   8,   8,   8,   8,   8,   0,   0,   0,   0,   0,   1,   2,   2,   2,
-     2,   2,   3,   0,   0,   0,   4,   0,   2,   2,   2,   2,   2,   3,   2,   2,
-     2,   2,   5,   0,   2,   5,   6,   0,   7,   7,   7,   7,   8,   9,  10,  11,
-    12,  13,  14,  15,   8,   8,   8,   8,  16,   8,   8,   8,  17,  18,  18,  18,
-    19,  19,  19,  19,  19,  20,  19,  19,  21,  22,  22,  22,  22,  22,  22,  22,
-    22,  23,  21,  22,  22,  22,  23,  21,  24,  25,  25,  25,  25,  25,  25,  25,
-    25,  25,  12,  12,  25,  25,  26,  27,  25,  28,  12,  12,  29,  30,  29,  31,
-    29,  29,  32,  32,  29,  29,  29,  29,  31,  29,  33,   7,   7,  34,  29,  29,
-    35,  29,  29,  29,  29,  29,  29,  30,  36,  36,  36,  37,  36,  36,  36,  36,
-    36,  36,  38,  39,  40,  40,  40,  40,  41,  12,  12,  12,  42,  42,  42,  42,
-    42,  42,  43,  44,  45,  45,  45,  45,  45,  45,  45,  46,  45,  45,  45,  47,
-    48,  48,  48,  48,  48,  48,  48,  49,  36,  36,  38,  12,  29,  29,  29,  50,
-    51,  12,  29,  29,  52,  29,  29,  29,  53,  53,  53,  53,  54,  55,  53,  53,
-    53,  56,  53,  53,  57,  58,  57,  59,  59,  57,  57,  57,  57,  57,  60,  57,
-    61,  62,  63,  57,  57,  59,  59,  64,  12,  65,  12,  66,  57,  62,  57,  57,
-    57,  57,  57,  64,  67,  67,  68,  69,  70,  71,  71,  71,  71,  71,  72,  71,
-    72,  73,  74,  72,  68,  69,  70,  74,  75,  12,  67,  76,  12,  77,  71,  71,
-    71,  68,  12,  12,  78,  78,  79,  80,  80,  79,  79,  79,  79,  79,  81,  79,
-    81,  78,  82,  79,  79,  80,  80,  82,  83,  12,  12,  12,  79,  84,  79,  79,
-    82,  12,  78,  79,  85,  85,  86,  87,  87,  86,  86,  86,  86,  86,  88,  86,
-    88,  85,  89,  86,  86,  87,  87,  89,  12,  85,  12,  90,  86,  91,  86,  86,
-    86,  86,  12,  12,  92,  93,  94,  92,  95,  96,  97,  95,  98,  99,  94,  92,
-   100, 100,  96,  92,  94,  92,  95,  96,  99,  98,  12,  12,  12,  92, 100, 100,
-   100, 100,  94,  12, 101, 101, 101, 102, 102, 101, 101, 101, 101, 101, 102, 101,
-   101, 101, 103, 101, 101, 102, 102, 103,  12, 104, 105, 106, 101, 107, 101, 101,
-    12, 108, 101, 101, 109, 109, 109, 110, 110, 109, 109, 109, 109, 109, 110, 109,
-   109, 111, 112, 109, 109, 110, 110, 112,  12, 113,  12, 113, 109, 114, 109, 109,
-   111,  12,  12,  12, 115, 115, 115, 116, 116, 115, 115, 115, 115, 115, 115, 115,
-   115, 116, 116, 115,  12, 115, 115, 115, 115, 117, 115, 115, 118, 118, 119, 119,
-   119, 120, 121, 119, 119, 119, 119, 119, 122, 119, 119, 123, 119, 120, 124, 125,
-   119, 126, 119, 119,  12, 121, 119, 119, 121, 127,  12,  12, 128, 129, 129, 129,
-   129, 129, 129, 129, 129, 129, 130, 131, 129, 129, 129,  12,  12,  12,  12,  12,
-   132, 133, 134, 135, 135, 135, 135, 135, 135, 136, 135, 135, 135, 135, 135, 137,
-   135, 138, 135, 134, 135, 135, 137, 135, 139, 139, 139, 139, 139, 139, 140, 139,
-   139, 139, 139, 141, 140, 139, 139, 139, 139, 139, 139, 142, 139, 143, 144,  12,
-   145, 145, 145, 145, 146, 146, 146, 146, 146, 147,  12, 148, 146, 146, 149, 146,
-   150, 150, 150, 150, 151, 151, 151, 151, 151, 151, 152, 153, 151, 154, 152, 153,
-   152, 153, 151, 154, 152, 153, 151, 151, 151, 154, 151, 151, 151, 151, 154, 155,
-   151, 151, 151, 156, 151, 151, 153,  12, 157, 157, 157, 157, 157, 158, 157, 158,
-   159, 159, 159, 159, 160, 160, 160, 160, 160, 160, 160, 161, 162, 162, 162, 162,
-   162, 162, 163, 164, 162, 162, 165,  12, 166, 166, 166, 166, 166, 167,  12, 168,
-   169, 169, 169, 169, 169, 170,  12,  12, 171, 171, 171, 171, 171,  12,  12,  12,
-   172, 172, 172, 173, 173,  12,  12,  12, 174, 174, 174, 174, 174, 174, 174, 175,
-   174, 174, 175,  12, 176, 177, 178, 178, 178, 178, 179,  12, 178, 178, 178, 178,
-   178, 178, 180,  12, 178, 178, 181,  12, 159, 182,  12,  12, 183, 183, 183, 183,
-   183, 183, 183, 184, 183, 183, 183,  12, 185, 183, 183, 183, 186, 186, 186, 186,
-   186, 186, 186, 187, 186, 188,  12,  12, 189, 189, 189, 189, 189, 189, 189,  12,
-   189, 189, 190,  12, 189, 189, 191, 192, 193, 193, 193, 193, 193, 193, 193, 194,
-   195, 195, 195, 195, 195, 195, 195, 196, 195, 195, 195, 197, 195, 195, 198,  12,
-   195, 195, 195, 198,   7,   7,   7, 199, 200, 200, 200, 200, 200, 200, 200, 201,
-   200, 200, 200, 202, 203, 203, 203, 203, 204, 204, 204, 204, 204,  12,  12, 204,
-   205, 205, 205, 205, 205, 205, 206, 205, 205, 205, 207, 208, 209, 209, 209, 209,
-    19,  19, 210,  12, 146, 146, 211, 212, 203, 203,  12,  12, 213,   7,   7,   7,
-   214,   7, 215, 216,   0, 215, 217,  12,   2, 218, 219,   2,   2,   2,   2, 220,
-   221, 218, 222,   2,   2,   2, 223,   2,   2,   2,   2, 224,   8, 225,   8, 225,
-     8,   8, 226, 226,   8,   8,   8, 225,   8,  15,   8,   8,   8,  10,   8, 227,
-    10,  15,   8,  14,   0,   0,   0, 228,   0, 229,   0,   0, 230,   0,   0, 231,
-     0,   0,   0, 232,   2,   2,   2, 233, 234,  12,  12,  12, 235,  12,  12,  12,
-     0, 236, 237,   0,   4,   0,   0,   0,   0,   0,   0,   4,   2,   2,   5,  12,
-     0, 232,  12,  12,   0,   0, 232,  12, 238, 238, 238, 238,   0, 239,   0,   0,
-     0, 240,   0,   0, 241, 241, 241, 241,  18,  18,  18,  18,  18,  12, 242,  18,
-   243, 243, 243, 243, 243, 243,  12, 244, 245,  12,  12, 244, 151, 154,  12,  12,
-   151, 154, 151, 154,   0,   0,   0, 246, 247, 247, 247, 247, 247, 247, 248, 247,
-   247,  12,  12,  12, 247, 249,  12,  12,   0, 250,   0,   0, 251, 247, 252, 253,
-     0,   0, 247,   0, 254, 255, 255, 255, 255, 255, 255, 255, 255, 256, 257, 258,
-   259, 260, 260, 260, 260, 260, 260, 260, 260, 260, 261, 259,  12, 262, 263, 263,
-   263, 263, 263, 263, 264, 150, 150, 150, 150, 150, 150, 265,   0,  12,  12, 131,
-   150, 150, 150, 266, 260, 260, 260, 261, 260, 260,   0,   0, 267, 267, 267, 267,
-   267, 267, 267, 268, 267, 269,  12,  12, 270, 270, 270, 270, 271, 271, 271, 271,
-   271, 271, 271,  12, 272, 272, 272, 272, 272, 272,  12,  12, 237,   2,   2,   2,
-     2,   2, 231,   2,   2,   2, 273,  12, 274, 275, 276,  12, 277,   2,   2,   2,
-   278, 278, 278, 278, 278, 278, 278, 279,   0,   0, 246,  12, 280, 280, 280, 280,
-   280, 280,  12,  12, 281, 281, 281, 281, 281, 282,  12, 283, 281, 281, 282,  12,
-   284, 284, 284, 284, 284, 284, 284, 285, 286, 286, 286, 286, 286,  12,  12, 287,
-   150, 150, 150, 288, 289, 289, 289, 289, 289, 289, 289, 290, 289, 289, 291, 292,
-   145, 145, 145, 293, 294, 294, 294, 294, 294, 295,  12,  12, 294, 294, 294, 296,
-   294, 294, 296, 294, 297, 297, 297, 297, 298,  12,  12,  12,  12,  12, 299, 297,
-   300, 300, 300, 300, 300, 301,  12,  12, 155, 154, 155, 154, 155, 154,  12,  12,
-     2,   2,   3,   2,   2, 302, 303,  12, 300, 300, 300, 304, 300, 300, 304,  12,
-   150,  12,  12,  12, 150, 265, 305, 150, 150, 150, 150,  12, 247, 247, 247, 249,
-   247, 247, 249,  12,   2, 273,  12,  12, 306,  22,  12,  24,  25,  26,  25, 307,
-   308, 309,  25,  25,  50,  12,  12,  12, 310,  29,  29,  29,  29,  29,  29, 311,
-   312,  29,  29,  29,  29,  29,  12, 310,   7,   7,   7, 313, 232,   0,   0,   0,
-     0, 232,   0,  12,  29, 314,  29,  29,  29,  29,  29, 315, 316,   0,   0,   0,
-     0, 317, 260, 260, 260, 260, 260, 318, 319, 150, 319, 150, 319, 150, 319, 288,
-     0, 232,   0, 232,  12,  12, 316, 246, 320, 320, 320, 321, 320, 320, 320, 320,
-   320, 322, 320, 320, 320, 320, 322, 323, 320, 320, 320, 324, 320, 320, 322,  12,
-   232, 131,   0,   0,   0, 131,   0,   0,   8,   8,   8,  14,   0,   0,   0, 234,
-   325,  12,  12,  12,   0,   0,   0, 326, 327, 327, 327, 327, 327, 327, 327, 328,
-   329, 329, 329, 329, 330,  12,  12,  12, 215,   0,   0,   0,   0,   0,   0,  12,
-   331, 331, 331, 331, 331,  12,  12, 332, 333, 333, 333, 333, 333, 333, 334,  12,
-   335, 335, 335, 335, 335, 335, 336,  12, 337, 337, 337, 337, 337, 337, 337, 338,
-   339, 339, 339, 339, 339,  12, 339, 339, 339, 340,  12,  12, 341, 341, 341, 341,
-   342, 342, 342, 342, 343, 343, 343, 343, 343, 343, 343, 344, 343, 343, 344,  12,
-   345, 345, 345, 345, 345,  12, 345, 345, 345, 345, 345,  12, 346, 346, 346, 346,
-   346, 346,  12,  12, 347, 347, 347, 347, 347,  12,  12, 348, 349, 349, 350, 349,
-   350, 351, 349, 349, 351, 349, 349, 349, 351, 349, 351, 352, 353, 353, 353, 353,
-   353, 354,  12,  12, 353, 355,  12,  12, 353, 353,  12,  12,   2, 274,   2,   2,
-   356,   2, 273,  12, 357, 358, 359, 357, 357, 357, 357, 357, 357, 360, 361, 362,
-   363, 363, 363, 363, 363, 364, 363, 363, 365, 365, 365, 365, 366, 366, 366, 366,
-   366, 366, 366, 367,  12, 368, 366, 366, 369, 369, 369, 369, 370, 371, 372, 369,
-   373, 373, 373, 373, 373, 373, 373, 374, 375, 375, 375, 375, 375, 375, 376, 377,
-   378, 378, 378, 378, 379, 379, 379, 379, 379, 379,  12, 379, 380, 379, 379, 379,
-   381, 382,  12, 381, 381, 383, 383, 381, 381, 381, 381, 381, 381, 384, 385, 386,
-   381, 381, 387,  12, 388, 388, 388, 388, 389, 389, 389, 389, 390, 390, 390, 390,
-   390, 391, 392, 390, 390, 391,  12,  12, 393, 393, 393, 393, 393, 394, 395, 393,
-   396, 396, 396, 396, 396, 397, 396, 396, 398, 398, 398, 398, 399,  12, 398, 398,
-   400, 400, 400, 400, 401,  12, 402, 403,  12,  12, 402, 400, 404, 404, 404, 404,
-   404, 404, 405,  12, 406, 406, 406, 406, 407,  12,  12,  12, 407,  12, 408, 406,
-   409, 409, 409, 409, 409, 409,  12,  12, 409, 409, 410,  12, 411, 411, 411, 411,
-   411, 411, 412, 413, 413,  12,  12,  12,  12,  12,  12, 414, 415, 415, 415, 415,
-   415, 415,  12,  12, 416, 416, 416, 416, 416, 416, 417,  12, 418, 418, 418, 418,
-   418, 418, 419,  12, 420, 420, 420, 420, 420, 420, 420,  12, 421, 421, 421, 421,
-   421, 422,  12,  12, 423, 423, 423, 423, 423, 423, 423, 424, 425, 423, 423, 423,
-   423, 424,  12, 426, 427, 427, 427, 427, 428,  12,  12, 429, 430, 430, 430, 430,
-   430, 430, 431,  12, 430, 430, 432,  12, 433, 433, 433, 433, 433, 434, 433, 433,
-   433, 433,  12,  12, 435, 435, 435, 435, 435, 436,  12,  12, 437, 437, 437, 437,
-   118, 119, 119, 119, 119, 127,  12,  12, 438, 438, 438, 438, 439, 438, 438, 438,
-   440,  12,  12,  12, 441, 442, 443, 444, 441, 441, 441, 444, 441, 441, 445,  12,
-   446, 446, 446, 446, 446, 446, 447,  12, 446, 446, 448,  12, 449, 450, 449, 451,
-   451, 449, 449, 449, 449, 449, 452, 449, 452, 450, 453, 449, 449, 451, 451, 454,
-   455, 456,  12, 450, 449, 457, 449, 455, 449, 455,  12,  12, 458, 458, 458, 458,
-   458, 458, 458, 459, 460,  12,  12,  12, 461, 461, 461, 461, 461, 461,  12,  12,
-   461, 461, 462,  12, 463, 463, 463, 463, 463, 464, 463, 463, 463, 463, 463, 464,
-   465, 465, 465, 465, 465, 466,  12,  12, 465, 465, 467,  12, 178, 178, 178, 180,
-   468, 468, 468, 468, 468, 468, 469,  12, 470, 470, 470, 470, 470, 470, 471, 472,
-   470, 470, 470,  12, 470, 471,  12,  12, 473, 473, 473, 473, 473, 473, 473,  12,
-   474, 474, 474, 474, 475,  12,  12, 476, 477, 478, 479, 477, 477, 480, 477, 477,
-   477, 477, 477, 477, 477, 481, 482, 477, 477, 478,  12,  12, 477, 477, 483,  12,
-   484, 484, 485, 484, 484, 484, 484, 484, 484, 486,  12,  12, 487, 487, 487, 487,
-   487, 487,  12,  12, 488, 488, 488, 488, 489,  12,  12,  12, 490, 490, 490, 490,
-   490, 490, 491,  12,  53,  53, 492,  12, 493, 493, 494, 493, 493, 493, 493, 493,
-   493, 495, 493, 493, 493, 496,  12,  12, 493, 493, 493, 497, 498, 498, 498, 498,
-   499, 498, 498, 498, 498, 498, 500, 498, 498, 501,  12,  12, 502, 503, 504, 502,
-   502, 502, 502, 502, 502, 503, 505, 504, 502, 502,  12,  12, 502, 502, 506,  12,
-   507, 508, 509, 507, 507, 507, 507, 507, 507, 507, 507, 510, 508, 507, 511,  12,
-   507, 507, 512,  12, 513, 513, 513, 513, 513, 513, 514,  12, 515, 515, 515, 515,
-   516, 515, 515, 515, 515, 515, 517, 518, 515, 515, 519,  12, 520,  12,  12,  12,
-   100, 100, 100, 100,  96,  12,  12,  98, 521, 521, 521, 521, 521, 521, 522,  12,
-   521, 521, 521, 523, 521, 524,  12,  12, 521,  12,  12,  12, 525, 525, 525, 525,
-   526,  12,  12,  12, 527, 527, 527, 527, 527, 528,  12,  12, 529, 529, 529, 529,
-   529, 530,  12,  12, 272, 272, 531,  12, 532, 532, 532, 532, 532, 532, 532, 533,
-   532, 532, 534, 535, 536, 536, 536, 536, 536, 536, 536, 537, 536, 536, 538,  12,
-   539, 539, 539, 539, 539, 539, 539, 540, 539, 540,  12,  12, 541, 541, 541, 541,
-   541, 542,  12,  12, 541, 541, 543, 541, 543, 541, 541, 541, 541, 541,  12, 544,
-   545, 545, 545, 545, 545, 545, 546,  12, 547, 547, 547, 547, 547, 547, 548, 549,
-   547, 547,  12, 549, 550, 551,  12,  12, 249,  12,  12,  12, 552, 552, 552, 552,
-   552, 552,  12,  12, 553, 553, 553, 553, 553, 554,  12,  12, 552, 552, 555,  12,
-   260, 556, 260, 557, 558, 255, 255, 255, 559,  12,  12,  12, 560,  12,  12,  12,
-   256, 561,  12,  12,  12, 260,  12,  12, 562, 562, 562, 562, 562, 562, 562,  12,
-   563, 563, 563, 563, 563, 563, 564,  12, 563, 563, 563, 565, 563, 563, 565,  12,
-   563, 563, 566, 563,   0,  12,  12,  12,   7,   7,   7, 567,   7, 199,  12,  12,
-     0, 246,  12,  12,   0, 232, 316,   0,   0, 568, 228,   0,   0,   0, 568,   7,
-   213, 569,   7,   0,   0,   0, 570, 228,   8, 225,  12,  12,   0,   0, 234,  12,
-     0,   0,   0, 229, 571, 572, 316, 229,   0,   0, 240, 316,   0, 316,   0,   0,
-     0, 240, 232, 316,   0, 229,   0, 229,   0,   0, 240, 232,   0, 573, 239,   0,
-   229,   0,   0,   0,   0, 246,   0,   0,   0,   0,   0, 239, 574, 574, 574, 574,
-   574, 574, 574,  12,  12,  12, 575, 574, 576, 574, 574, 574,   2,   2,   2, 273,
-    12, 275, 273,  12, 241, 577, 241, 241, 241, 241, 578, 241, 579, 580, 577,  12,
-    19,  19,  19, 581,  12,  12,  12, 582, 583, 583, 583, 583, 583, 583, 583, 584,
-   583, 583, 583, 585, 583, 583, 585, 586, 587, 587, 587, 587, 587, 587, 587, 588,
-   589, 589, 589, 589, 589, 589, 590, 591, 592, 592, 592, 592, 592, 592, 593,  12,
-   151, 154, 151, 594, 151, 151, 151, 154, 595, 595, 595, 595, 595, 596, 595, 595,
-   595, 597,  12,  12, 598, 598, 598, 598, 598, 598, 598,  12, 598, 598, 599, 600,
-     0, 234,  12,  12,  29, 414,  29,  29, 601, 602, 414,  29,  50,  29, 603,  12,
-   604, 310, 603, 414, 601, 602, 603, 603, 601, 602,  50,  29,  50,  29, 414, 605,
-    29,  29, 606,  29,  29,  29,  29,  12, 414, 414, 606,  29,  51,  12,  12,  12,
-    12, 239,   0,   0, 607,  12,  12,  12, 246,  12,  12,  12,   0,   0,  12,   0,
-     0, 232, 131,   0,   0,   0,  12,  12,   0,   0,   0, 240,   0, 246,  12, 239,
-   608,  12,  12,  12, 247, 247, 609,  12, 610,  12,  12,  12,   0,   0,   0,   0,
-     0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 939, 940, 941, 942,
-   946, 948,   0, 962, 969, 970, 971, 976,1001,1002,1003,1008,   0,1033,1040,1041,
-  1042,1043,1047,   0,   0,1080,1081,1082,1086,1110,   0,   0,1124,1125,1126,1127,
-  1131,1133,   0,1147,1154,1155,1156,1161,1187,1188,1189,1193,   0,1219,1226,1227,
-  1228,1229,1233,   0,   0,1267,1268,1269,1273,1298,   0,1303, 943,1128, 944,1129,
-   954,1139, 958,1143, 959,1144, 960,1145, 961,1146, 964,1149,   0,   0, 973,1158,
-   974,1159, 975,1160, 983,1168, 978,1163, 988,1173, 990,1175, 991,1176, 993,1178,
-   994,1179,   0,   0,1004,1190,1005,1191,1006,1192,1014,1199,1007,   0,   0,   0,
-  1016,1201,1020,1206,   0,1022,1208,1025,1211,1023,1209,   0,   0,   0,   0,1032,
-  1218,1037,1223,1035,1221,   0,   0,   0,1044,1230,1045,1231,1049,1235,   0,   0,
-  1058,1244,1064,1250,1060,1246,1066,1252,1067,1253,1072,1258,1069,1255,1077,1264,
-  1074,1261,   0,   0,1083,1270,1084,1271,1085,1272,1088,1275,1089,1276,1096,1283,
-  1103,1290,1111,1299,1115,1118,1307,1120,1309,1121,1310,   0,1053,1239,   0,   0,
-     0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,1093,1280,   0,   0,   0,
+   391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 705,
+   391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 391, 706,
+     0,   0,   1,   1,   0,   2,   3,   3,   4,   4,   4,   4,   4,   4,   4,   4,
+     4,   4,   4,   4,   4,   5,   0,   6,   7,   7,   7,   8,   9,  10,  11,  12,
+    13,  13,  13,  13,  14,  13,  13,  13,  13,  15,  16,  17,  18,  19,  20,  21,
+    22,  23,  24,  25,  23,  23,  26,  23,  27,  28,  29,  23,  30,  31,  32,  33,
+    34,  35,  36,  37,  38,  23,  23,  39,  40,  40,  41,  42,  43,  44,  45,  46,
+    47,  48,  49,  50,  51,  52,  53,  54,  55,  56,  57,  58,  59,  60,  61,  62,
+    63,  64,  65,  66,  67,  68,  69,  70,  71,  72,  73,  74,  75,  76,  77,  78,
+    79,  80,  81,  82,  83,  84,  85,  82,  86,  86,  87,  88,  89,  90,  91,  82,
+    92,  92,  92,  92,  92,  93,  94,  95,  96,  96,  96,  96,  96,  96,  96,  96,
+    97,  97,  98,  97,  99, 100, 101,  97, 102,  97, 103, 104, 105, 106, 106, 107,
+   108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 108, 109, 110, 110, 111,
+   112, 113, 114, 115, 116, 116, 117, 118, 119, 120, 120, 121, 120, 122, 108, 123,
+   124, 125, 126, 127, 128, 129, 130, 116, 131, 132, 133, 134, 135, 136, 137,  82,
+   138, 138, 139, 138, 140, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150,
+     4, 151, 152, 153,   4, 154,   7,   7, 155,  11, 156, 157,  11, 158, 159, 160,
+   161,   0,   0, 162, 163,   0, 164, 165,   0, 166, 167,   4, 168,   0,   0,   0,
+     0,   0,   0,   0,   0,   0,   0,   0,   0, 169, 170,   0,   0,   0,   0,   0,
+   171, 171, 171, 171, 171, 171, 171, 171,   0,   0,   0, 172, 173,   0,   0,   0,
+   174, 174, 174,   4, 175, 175, 175, 176,  93, 177, 178, 179, 180, 181, 181,  13,
+     0,   0, 182,  82, 183, 184, 184, 185, 184, 184, 184, 184, 184, 184, 186, 187,
+   188, 189, 190, 191, 192, 193, 194, 195, 196, 197,  96,  96, 198, 199,   0, 200,
+   201,   0,   0, 202,   0,   0, 203, 204, 194, 194, 205,   0,   0,   0,   0,   0,
+   184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184,   0,   0,
+   206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 206, 207, 206, 208, 209,
+   210, 210, 210, 210, 210, 210, 210, 210, 210, 211,  13,  13,  13, 212, 212, 213,
+     0, 214,   4,   4, 215,   4, 216, 217, 218, 219, 220, 221, 222, 222, 223,  40,
+   224, 225, 226, 227, 228, 228, 229, 230, 231, 232, 233,  92, 234, 234, 235, 236,
+   237, 238, 239, 240, 106, 106, 241, 242,  96,  96,  96,  96,  96, 243, 244, 245,
+    82,  82,  82,  82,  82,  82,  82,  82, 184, 184, 184, 246, 184, 184, 247,  82,
+   248, 249, 250,  23,  23,  23, 251,  23,  23,  23,  23,  23,  23,  23,  23,  23,
+    23, 252,  23,  23, 253,  23, 254, 255, 256, 257, 258, 259,  23,  23,  23, 260,
+   261,   1,   1, 262, 263, 201, 264, 265, 266, 267, 268,  82, 269, 269, 269, 270,
+   271, 272,  11,  11, 273, 274, 187, 275,  82,  82,  82,  82, 276, 277, 278, 279,
+   280, 281, 282, 283, 284, 285, 286,  82, 287, 287, 288, 289, 290, 291, 292, 293,
+   294, 295, 296, 297, 298, 299, 300, 301, 302, 302, 302, 302, 302, 302, 302, 302,
+   302, 303, 304, 305, 306, 307,  82,  82, 308, 309, 310, 311, 312, 313,  82, 314,
+   315, 316,  82,  82, 317, 318, 319, 320, 321, 322, 323, 324, 325,  82, 326, 327,
+   328, 329, 330, 331, 332, 333,  82,  82, 334, 334, 335,  82, 336, 337, 336, 338,
+   339, 340, 341, 342, 343,  82,  82,  82,  82,  82,  82, 344, 345, 346, 347, 348,
+   349, 350, 351, 352, 353, 354, 355, 356, 357, 357, 358, 359, 360, 360, 361, 362,
+   363, 364, 365, 366, 367, 367, 367, 368, 369, 370, 371,  82, 372, 373, 374, 375,
+   376, 377, 378, 379, 380, 381, 382, 383, 384, 384, 385, 386, 387, 387, 388,  82,
+    82,  82,  82,  82, 389, 390, 391,  82, 392, 392, 393, 394, 395, 396, 397, 398,
+   399, 400, 401,  82,  82,  82,  82,  82, 402, 403,  82,  82,  82, 404, 404, 405,
+   406, 407, 408,  82,  82, 409, 410, 411, 412, 412, 413, 414, 414, 415, 416, 417,
+   418,  82,  82,  82,  82,  82, 419, 420, 421, 422, 423, 424, 425, 426,  82,  82,
+   427, 428, 429, 430, 431, 432,  82,  82,  82,  82,  82,  82,  82,  82,  82, 433,
+   434, 435, 436,  82,  82, 437, 438, 439, 440, 440, 440, 440, 440, 440, 440, 440,
+   440, 440, 440, 440, 441,  82,  82,  82, 440, 440, 440, 442, 440, 440, 440, 440,
+   440, 440, 443,  82,  82,  82,  82,  82,  82,  82,  82,  82, 444, 445, 445, 446,
+   447, 447, 447, 447, 447, 447, 447, 447, 447, 447, 448, 447, 447, 447, 447, 447,
+   447, 447, 447, 447, 447, 447, 447, 449, 450, 450, 450, 450, 450, 450, 450, 450,
+   450, 450, 451,  82,  82,  82,  82,  82, 452, 453,  82,  82,  82,  82,  82,  82,
+   212, 212, 212, 212, 212, 212, 212, 212, 212, 454, 455, 456, 457, 458, 459, 460,
+   461, 461, 462, 463, 464,  82,  82,  82,  82,  82, 465, 466,  82,  82,  82,  82,
+    82,  82, 467, 467, 468,  82,  82,  82, 469, 469, 470, 469, 471,  82,  82, 472,
+   473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 473, 474,
+   475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 475, 476, 477,
+   478,  82,  82,  82,  82,  82,  82,  82,  82,  82,  82,  82,  82,  82,  82, 479,
+   480, 191, 191, 191, 191, 191, 191, 191, 191, 481, 482, 483, 484, 484, 484, 484,
+   484, 484, 484, 484, 484, 484, 484, 485, 486, 486, 486, 487, 488, 489,  82,  82,
+     0,   0,   0,   0,   0,   0,   0, 490,   0,   0,   0,   0,   0, 491,  82,  82,
+     7, 492, 493,   0,   0,   0, 489,  82,   0,   0,   0,   0,   0,   0,   0, 494,
+     0, 495,   0, 496, 497, 498,   0, 170,  11,  11, 499,  82,  82,  82, 491, 491,
+     0,   0, 500, 501,  82,  82,  82,  82,   0,   0, 502,   0, 503, 504, 505,   0,
+   506, 507, 508,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 509,   0,   0,
+     0,   0,   0,   0,   0,   0, 510,   0, 511, 511, 511, 511, 511, 511, 511, 511,
+   511, 511, 511, 511, 512, 513,  82,  82, 514, 515,  82,  82,  82,  82,  82,  82,
+   516, 517,  13, 518, 519,  82,  82,  82, 520, 521, 522,  82,  82,  82,  82,  82,
+    82,  82,  82,  82, 523, 524, 525, 526,  82,  82,  82,  82,  82,  82, 527, 528,
+    82,  82,  82,  82,  82,  82, 529, 530,  82,  82,  82,  82,  82,  82,  82, 531,
+   532, 532, 532, 532, 532, 532, 533,  82, 534, 534, 535,  82,  82,  82,  82,  82,
+    82,  82,  82, 536,   0, 537,  82,  82, 261, 182,  82,  82,  82,  82,  82,  82,
+   538, 539, 540, 541, 542, 543,  82, 544,   0, 545,   0,   0, 491, 546, 547, 494,
+     0,   0,   0,   0,   0, 548,  82, 549, 550, 551, 552, 553,  82,  82,  82,  82,
+     0,   0,   0,   0,   0,   0, 554, 555,   0,   0,   0, 556,   0,   0, 490, 557,
+   545,   0, 558,   0, 559, 560, 561,  82,   0,   0, 491, 562, 563,   0, 564, 565,
+     0,   0,   0,   0, 258,   0,   0, 490, 184, 184, 184, 184, 184, 184, 184,  82,
+   184, 247, 184, 184, 184, 184, 184, 184, 566, 184, 184, 184, 184, 184, 184, 184,
+   184, 184, 184, 184, 184, 567, 184, 184, 184, 184, 184, 184, 184, 184, 184, 568,
+   184, 184, 566,  82,  82,  82,  82,  82, 566,  82,  82,  82,  82,  82,  82,  82,
+   184, 184, 569, 184, 184, 184, 184, 184, 184, 184, 184, 184, 184, 570,  82,  82,
+   571,   0,   0,   0,  82,  82,  82,  82,   7,   7,   7,   7,   7,   7,   7, 572,
+     0,   0,   0,   0,   1,   2,   2,   3,   0,   4,   0,   4,   2,   2,   5,   2,
+     2,   2,   2,   2,   2,   2,   2,   6,   7,   8,   0,   0,   9,   9,   9,   9,
+     9,   9,  10,  11,  12,  13,  14,  14,  15,  14,  14,  14,  14,  14,  14,  14,
+    16,  17,  14,  14,  18,  18,  18,  18,  19,  18,  18,  18,  18,  18,  20,  21,
+    21,  21,  22,  20,  21,  21,  21,  21,  21,  23,  24,  25,  25,  25,  25,  25,
+    25,  26,  25,  25,  25,  27,  28,  26,  29,  30,  31,  32,  31,  31,  31,  31,
+    33,  34,  35,  31,  31,  31,  36,  31,  31,  31,  31,  29,  37,  38,  37,  37,
+    37,  37,  37,  37,  37,  39,  31,  31,  40,  40,  40,  40,  40,  40,  41,  26,
+    42,  42,  42,  42,  42,  42,  42,  43,  44,  44,  44,  44,  44,  45,  44,  46,
+    47,  47,  47,  48,  37,  49,  31,  31,  31,  50,  51,  31,  52,  31,  31,  31,
+    53,  53,  53,  53,  53,  53,  54,  53,  55,  53,  53,  53,  56,  57,  58,  59,
+    59,  60,  61,  62,  57,  63,  64,  65,  66,  59,  59,  67,  68,  69,  70,  71,
+    71,  72,  73,  74,  69,  75,  76,  77,  78,  71,  79,  26,  80,  81,  82,  83,
+    83,  84,  85,  86,  81,  87,  88,  26,  89,  83,  90,  91,  92,  93,  94,  95,
+    95,  96,  97,  98,  93,  99, 100, 101, 102,  95,  95,  26, 103, 104, 105, 106,
+   107, 104, 108, 109, 104, 105, 110,  26, 111, 108, 108, 112, 113, 114, 115, 113,
+   113, 115, 113, 116, 114, 117, 118, 119, 120, 113, 121, 113, 122, 123, 124, 122,
+   122, 124, 125, 126, 123, 127, 128, 128, 129, 122, 130,  26, 131, 132, 133, 131,
+   131, 131, 131, 131, 132, 133, 134, 131, 135, 131, 131, 131, 136, 137, 138, 139,
+   137, 137, 140, 141, 138, 142, 143, 137, 144, 137, 145,  26, 146, 147, 147, 147,
+   147, 147, 147, 148, 147, 147, 147, 149,  26,  26,  26,  26, 150, 151, 152, 152,
+   153, 152, 152, 154, 155, 156, 152, 157, 158, 158, 158, 158, 158, 159, 158, 158,
+   158, 160, 159, 158, 158, 158, 158, 159, 158, 158, 158, 161, 158, 161, 162, 163,
+   164, 164, 164, 164, 165, 165, 165, 165, 166, 167, 165, 165, 165, 165, 165, 168,
+   169, 169, 169, 169, 170, 170, 170, 170, 170, 171, 172, 171, 170, 171, 170, 170,
+   170, 170, 171, 172, 171, 170, 172, 170, 170, 170, 171, 170, 170, 170, 170, 173,
+   170, 170, 170, 174, 170, 170, 170, 175, 176, 176, 176, 176, 176, 176, 177, 177,
+   178, 178, 178, 178, 179, 179, 179, 180, 181, 181, 181, 181, 181, 182, 181, 183,
+   184, 184, 185, 186, 187, 187, 188,  26, 189, 189, 190,  26, 191, 192, 193,  26,
+   194, 194, 194, 194, 194, 194, 194, 195, 194, 196, 194, 196, 197, 198, 198, 199,
+   198, 198, 198, 198, 198, 198, 198, 200, 198, 201, 178, 178, 178, 178, 202,  26,
+   203, 203, 203, 204, 203, 205, 203, 205, 206, 203, 207, 207, 207, 208, 209,  26,
+   210, 210, 210, 210, 210, 211, 210, 210, 210, 212, 210, 213, 214, 214, 214, 215,
+   216, 216, 216, 216, 216, 216, 216, 217, 216, 216, 216, 218, 216, 219, 216, 219,
+   216, 220,   9,   9,   9, 221,  26,  26, 222, 222, 222, 222, 222, 223, 222, 222,
+   224, 224, 224, 224, 225, 225, 225, 225, 225, 225, 226, 227, 228, 228, 228, 228,
+   228, 228, 228, 229, 228, 230, 231, 231, 231, 231, 231, 231,  18, 232, 165, 165,
+   165, 165, 165, 233, 224,  26, 234,   9, 235, 236, 237, 238, 239, 240,   2,   2,
+     2,   2,   2, 241, 242, 243,   2, 244,   2,   2,   2, 245,  14,  14, 246, 246,
+   246, 246,  14, 247,  14,  14,  14, 246,  14,  14, 248,  14, 248,  14, 249, 250,
+    14,  14, 251, 252,   0, 253,   0,   0, 254,   0, 255, 256,   0, 257,   2, 258,
+   259,  26,   9,   9,   9,   9, 260,  26, 261, 262,   4,   0,   0, 263,   0,   0,
+     2, 264,   0,   0,   0, 265,  26,  26,   0, 266,  26,  26, 267, 267, 267, 267,
+     0,   0, 268,   0,   0,   0, 269,   0, 270, 270, 270, 270,  17,  17,  17,  17,
+    17,  17, 271, 272, 166, 167, 273, 273, 273, 273, 273, 273, 273, 274, 275, 274,
+   170, 170, 172,  26, 172, 172, 172, 172,   0,   0,   0, 276, 277, 277, 277, 278,
+   277, 277, 277, 277, 277, 277, 279,  26, 277, 277, 280,  26,  26,  26,   0,   0,
+   281,   0,   0,   0, 282, 283,   0, 284, 285, 286, 286, 286, 286, 286, 286, 286,
+   286, 286, 287, 288, 289, 290, 290, 290, 290, 290, 290, 290, 290, 290, 290, 291,
+   292, 293, 293, 293, 293, 293, 294, 169, 169, 295,   0,   0, 293, 293, 293, 293,
+   276, 296, 290, 290, 169, 169, 169, 295, 169, 169, 169, 297,   0,   0, 290, 290,
+   290, 290, 290, 298, 290, 290, 290,   0, 299, 299, 299, 299, 299, 300, 299, 299,
+   301,  26, 302, 302, 302, 302, 302, 302, 303, 303, 303, 303, 303, 304,  26,  26,
+   305, 305, 305, 305, 305, 305, 305,  26, 306,   2,   2,   2,   2, 307,   2,   2,
+     2, 308, 309, 258,  26,  26, 310,   2, 311, 311, 311, 311, 311, 312,   0, 265,
+   313, 313, 313, 313, 313, 313, 313,  26, 314, 314, 314, 314, 315, 316, 314, 317,
+   318, 318, 318, 318, 318, 319, 320, 320, 320, 320, 321, 322, 169, 169, 169, 323,
+   324, 324, 324, 324, 324, 325, 324, 326, 164, 164, 164, 327, 328, 328, 328, 328,
+   328, 328, 329,  26, 328, 330, 328, 331, 332, 332, 332, 332, 333,  26,  26, 334,
+   335, 335, 336,  26, 337, 337, 337,  26, 172, 172,   2,   2,   2,   2,   2, 338,
+   339, 340, 176, 176, 335, 335, 335, 335, 335, 341, 335, 342, 343,  26, 169, 169,
+   295, 344, 169, 169, 169, 169, 169, 343, 277, 280, 277, 277, 277, 277, 277, 345,
+   346,  26, 347, 348,  25,  25, 349, 350, 351,  25,  31,  31, 352,  26, 353,  31,
+    31,  31,  31, 354,  31,  31, 355,  31,  31, 356,  26,  26,  26,  26,  31,  31,
+     9,   9,   0, 265,   9, 357,   0,   0,   0,   0, 358,   0, 257, 359, 360,  31,
+    31,  31,  31, 361, 362,   0,   0,   0, 363, 290, 289, 290, 290, 290, 290, 364,
+   365, 365, 365, 366, 257, 257,  26, 367, 368, 369, 368, 368, 370, 368, 368, 371,
+   368, 372, 368, 372, 368, 368, 368, 368, 368, 368, 368, 373, 374,   0,   0,   0,
+     0,   0, 375,   0,  14, 252,   0, 376, 377,  26,  26,  26,   0,   0,   0, 378,
+   379, 379, 379, 380, 381, 381, 381, 381, 381, 381, 382,  26, 383,   0,   0, 359,
+   384, 384, 384, 384, 385, 386, 387, 387, 387, 388, 389, 389, 389, 389, 389, 390,
+   391, 391, 391, 392, 393, 393, 393, 393, 394, 393, 395,  26, 396, 396, 396, 396,
+   396, 396, 397, 397, 397, 397, 397, 397, 398, 398, 398, 399, 398, 400, 401, 401,
+   401, 401, 402, 401, 401, 401, 401, 402, 403, 403, 403, 403, 403,  26, 404, 404,
+   404, 404, 404, 404, 405, 406, 407, 408, 407, 408, 409, 407, 410, 407, 410, 411,
+   412, 412, 412, 412, 412, 412, 413,  26, 414, 414, 414, 414, 414, 414, 415,  26,
+   414, 414, 416,  26, 414,  26,  26,  26, 417,   2,   2,   2,   2,   2, 418, 419,
+   420, 421, 422, 422, 422, 422, 423, 424, 425, 425, 426, 425, 427, 427, 427, 427,
+   428, 428, 428, 429, 430, 428,  26,  26, 431, 431, 432, 433, 434, 434, 434, 435,
+   436, 436, 436, 437, 438, 438, 438, 438, 439, 439, 439, 440, 439, 439, 441, 439,
+   439, 439, 439, 439, 442, 443, 444, 445, 446, 446, 447, 448, 446, 449, 446, 449,
+   450, 450, 450, 450, 451, 451, 451, 451, 452, 452, 452, 452, 453, 454, 453,  26,
+   455, 455, 455, 455, 455, 455, 456, 457, 458, 458, 459, 458, 460, 460, 461, 460,
+   462, 462, 463, 464,  26, 465,  26,  26, 466, 466, 466, 466, 466, 467,  26,  26,
+   468, 468, 468, 468, 468, 468, 469,  26, 468, 468, 469, 470, 471, 471, 471, 471,
+   471,  26, 471, 472, 473, 473, 473, 473, 474, 475, 473, 473, 474, 476,  26,  26,
+    31,  31,  31,  50, 477, 477, 477, 477, 477, 478, 479,  26, 480,  26,  26,  26,
+    26,  26,  26, 481, 482, 482, 482, 482, 482,  26, 483, 483, 483, 483, 483, 484,
+    26,  26, 485, 485, 485, 486,  26,  26,  26,  26, 487, 487, 487, 488,  26,  26,
+   489, 489, 490,  26, 491, 491, 491, 491, 491, 492, 493, 491, 491, 491, 492, 494,
+   495, 495, 495, 495, 496, 497, 498, 498, 498, 499, 498, 500, 501, 501, 501, 501,
+   501, 501, 502, 501, 501,  26, 503, 503, 503, 503, 504,  26, 505, 505, 505, 505,
+   506, 137, 507,  26, 508, 508, 509, 508, 508, 508, 508, 508, 510,  26,  26,  26,
+   511, 512, 513, 514, 513, 515, 516, 516, 516, 516, 516, 516, 516, 517, 516, 518,
+   519, 520, 521, 522, 522, 523, 524, 525, 520, 526, 527, 528, 529, 530, 530,  26,
+   531, 532, 531, 531, 531, 531, 533, 531, 534, 535, 533, 536, 537,  26,  26,  26,
+   538, 538, 538, 538, 538, 538, 538, 539, 540,  26,  26,  26, 541, 541, 541, 541,
+   541,  26, 541, 542, 543, 543, 543, 543, 543, 543, 544, 543, 543, 543, 543, 544,
+   545, 545, 545, 545, 546,  26, 545, 547, 198, 548,  26,  26, 549, 549, 549, 549,
+   549, 549, 549, 550, 549, 550, 164, 164, 551,  26,  26,  26, 552, 552, 552, 553,
+   552, 554, 552, 552, 555,  26,  26,  26, 556, 556, 556, 556, 556, 556, 556, 557,
+   558, 558, 558, 558, 558, 558, 559, 560, 561, 562, 563, 564, 564, 564, 565, 566,
+   561,  26, 564, 567, 568, 569, 568, 568, 568, 568, 568, 569, 570,  26,  26,  26,
+   571, 571, 571, 571, 571,  26, 572, 572, 572, 572, 572, 572, 573,  26, 178, 178,
+   574, 574, 574, 574, 574, 574, 574, 575,  53, 576,  26,  26, 577, 577, 577, 577,
+   578,  26, 577, 578, 579, 580, 579, 579, 579, 579, 581, 579, 582,  26, 579, 579,
+   579, 583, 584, 584, 584, 584, 585, 584, 584, 586, 587,  26, 588, 589, 590, 590,
+   590, 590, 588, 591, 590,  26, 590, 592, 593, 594, 595, 595, 595, 596, 597, 598,
+   595, 599,  26,  26, 600, 600, 600, 601, 602, 602, 603, 602, 602, 602, 602, 604,
+   602, 602, 602, 605,  26,  26, 606,  26, 108, 108, 108, 108, 108, 108, 607, 608,
+   609, 609, 609, 609, 609, 609, 609, 610, 609, 611, 612,  26, 613,  26,  26,  26,
+    26,  26, 614, 614, 614, 614, 614, 614, 614, 614, 615,  26, 616, 616, 616, 616,
+   616, 616, 617,  26, 616, 616, 616, 618, 619, 619, 619, 619, 620,  26,  26,  26,
+   621, 621, 621, 621, 621, 621, 621, 622, 305, 305, 305, 623, 624, 624, 624, 625,
+   624, 626, 627, 627, 627, 627, 627, 627, 627, 627, 627, 628, 627, 629, 630, 630,
+   630, 631, 631,  26, 632, 632, 632, 632, 633,  26, 632, 634, 634, 632, 632, 635,
+   632, 632,  26,  26, 636, 636, 636, 636, 636, 636, 636, 637, 638, 638, 638, 638,
+   638, 638, 638, 639, 640, 640, 640, 640, 640, 641, 640, 640, 640, 642, 640, 640,
+   643,  26, 345,  26, 644, 644, 644, 644, 644, 644, 644,  26, 645, 645, 645, 645,
+   645, 645, 646,  26,  26,  26,  26, 647, 644, 648,  26,  26,  26,  26, 649, 650,
+   651, 286, 286, 286, 652,  26, 653,  26,  26,  26, 654,  26, 655,  26, 656, 656,
+   656, 656, 656, 656, 656, 656, 656, 657, 658, 658, 658, 658, 658, 659, 658, 660,
+   658, 661, 658, 662, 359,  26,  26,  26,   0,   0,   0, 265,   0,   0, 359,  26,
+     9, 663,   9,   9, 221,  26,   0,   0,   0,   0, 276,  26, 257, 362,   0,   0,
+   664, 665,   0, 666, 667, 668,   0,   0,   0, 669,   0,   0, 246,  26,  26,  26,
+     0,   0, 257,  26,   0,   0,   0, 259,   0,   0, 254,   0,   0,   0,   0, 254,
+   670, 671,   0, 672, 673,   0,   0,   0, 269, 674, 254, 254,   0,   0,   0, 675,
+   676, 677, 678,   0, 276,   0,   0,   0,   0, 268,   0,   0, 679, 679, 679, 679,
+   679, 680,  26, 681, 682, 679,  26,  26,   2,   2,   2, 346, 683, 419,  26,  26,
+   684, 270, 270, 685, 686, 687,  18,  18,  18, 688,  26,  26,  26, 689,  26,  26,
+   690, 690, 690, 690, 690, 691, 690, 692, 690, 693,  26,  26,  26,  26, 694, 694,
+   694, 695,  26,  26, 696, 696, 696, 696, 696, 696, 696, 697,  26,  26, 698, 698,
+   698, 698, 698, 699,  26,  26, 700, 700, 700, 700, 700, 701, 172, 702, 170, 172,
+   703, 703, 703, 703, 704, 703, 705,  26, 706, 706, 706, 706, 706, 707, 706, 708,
+    26,  26, 362,   0,   0,   0, 376,  26, 709,  31,  31,  31, 710, 711, 712, 713,
+   714, 715, 710, 716, 710, 712, 712, 717,  31, 718,  31, 719, 720, 718,  31, 719,
+    26,  26, 721,  26,   0, 359,   0,   0,   0, 257, 362,   0, 362,   0, 362,   0,
+     0, 276,  26,  26, 722,   0,   0,   0, 723,  26,   0,   0,   0,   0,   0, 359,
+     0, 259, 265,  26, 276,  26,  26,  26,   0,   0,   0, 724,   0, 376,   0, 376,
+     0,   0, 257, 725,   0, 359, 259,  26,   0,  26,   0, 265,   0,  26,   0,   0,
+     0, 276,   0, 359, 265,  26,  26,  26,   0, 276,   0, 376,   0, 726,   0,   0,
+   257, 722,   0, 727,   0, 265,   0, 259, 277, 277, 277, 280, 345,  26, 277, 277,
+   728,  26, 277, 277, 277, 729, 277, 277, 277, 277,  26,  26, 730,  26,  26,  26,
+     9,   9,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+     0,   0,   0,   0, 939, 940, 941, 942, 946, 948,   0, 962, 969, 970, 971, 976,
+  1001,1002,1003,1008,   0,1033,1040,1041,1042,1043,1047,   0,   0,1080,1081,1082,
+  1086,1110,   0,   0,1124,1125,1126,1127,1131,1133,   0,1147,1154,1155,1156,1161,
+  1187,1188,1189,1193,   0,1219,1226,1227,1228,1229,1233,   0,   0,1267,1268,1269,
+  1273,1298,   0,1303, 943,1128, 944,1129, 954,1139, 958,1143, 959,1144, 960,1145,
+   961,1146, 964,1149,   0,   0, 973,1158, 974,1159, 975,1160, 983,1168, 978,1163,
+   988,1173, 990,1175, 991,1176, 993,1178, 994,1179,   0,   0,1004,1190,1005,1191,
+  1006,1192,1014,1199,1007,   0,   0,   0,1016,1201,1020,1206,   0,1022,1208,1025,
+  1211,1023,1209,   0,   0,   0,   0,1032,1218,1037,1223,1035,1221,   0,   0,   0,
+  1044,1230,1045,1231,1049,1235,   0,   0,1058,1244,1064,1250,1060,1246,1066,1252,
+  1067,1253,1072,1258,1069,1255,1077,1264,1074,1261,   0,   0,1083,1270,1084,1271,
+  1085,1272,1088,1275,1089,1276,1096,1283,1103,1290,1111,1299,1115,1118,1307,1120,
+  1309,1121,1310,   0,1053,1239,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+     0,   0,   0,1093,1280,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
      0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
-     0,   0,   0,   0,   0,   0,   0,   0,   0, 949,1134,1010,1195,1050,1236,1090,
-  1277,1341,1368,1340,1367,1342,1369,1339,1366,   0,1320,1347,1418,1419,1323,1350,
-     0,   0, 992,1177,1018,1204,1055,1241,1416,1417,1415,1424,1202,   0,   0,   0,
-   987,1172,   0,   0,1031,1217,1321,1348,1322,1349,1338,1365, 950,1135, 951,1136,
-   979,1164, 980,1165,1011,1196,1012,1197,1051,1237,1052,1238,1061,1247,1062,1248,
-  1091,1278,1092,1279,1071,1257,1076,1263,   0,   0, 997,1182,   0,   0,   0,   0,
-     0,   0, 945,1130, 982,1167,1337,1364,1335,1362,1046,1232,1422,1423,1113,1301,
-     0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   8,   9,   0,  10,
-  1425,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
-     7,   0,   0,   0,   0,   0,   0,   0,   0,   0,   1,   0,   0,   0,   0,   0,
-     0,1314,1427,   5,1434,1438,1443,   0,1450,   0,1455,1461,1514,   0,   0,   0,
+     0, 949,1134,1010,1195,1050,1236,1090,1277,1341,1368,1340,1367,1342,1369,1339,
+  1366,   0,1320,1347,1418,1419,1323,1350,   0,   0, 992,1177,1018,1204,1055,1241,
+  1416,1417,1415,1424,1202,   0,   0,   0, 987,1172,   0,   0,1031,1217,1321,1348,
+  1322,1349,1338,1365, 950,1135, 951,1136, 979,1164, 980,1165,1011,1196,1012,1197,
+  1051,1237,1052,1238,1061,1247,1062,1248,1091,1278,1092,1279,1071,1257,1076,1263,
+     0,   0, 997,1182,   0,   0,   0,   0,   0,   0, 945,1130, 982,1167,1337,1364,
+  1335,1362,1046,1232,1422,1423,1113,1301,   0,   0,   0,   0,   0,   0,   0,   0,
+     0,   0,   0,   0,   8,   9,   0,  10,1425,   0,   0,   0,   0,   0,   0,   0,
+     0,   0,   0,   0,   0,   0,   0,   0,   7,   0,   0,   0,   0,   0,   0,   0,
+     0,   0,   1,   0,   0,   0,   0,   0,   0,1314,1427,   5,1434,1438,1443,   0,
+  1450,   0,1455,1461,1514,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+     0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,1446,1458,
+  1468,1476,1480,1486,1517,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+     0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,1489,1503,
+  1494,1500,1508,   0,   0,   0,   0,1520,1521,   0,   0,   0,   0,   0,   0,   0,
+     0,   0,   0,   0,1526,1528,   0,1525,   0,   0,   0,1522,   0,   0,   0,   0,
+  1536,1532,1539,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,1534,   0,   0,
+     0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,1556,   0,   0,
+     0,   0,   0,   0,1548,1550,   0,1547,   0,   0,   0,1567,   0,   0,   0,   0,
+  1558,1554,1561,   0,   0,   0,   0,   0,   0,   0,1568,1569,   0,   0,   0,   0,
+     0,   0,   0,   0,   0,1529,1551,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+     0,   0,   0,   0,1523,1545,1524,1546,   0,   0,1527,1549,   0,   0,1570,1571,
+  1530,1552,1531,1553,   0,   0,1533,1555,1535,1557,1537,1559,   0,   0,1572,1573,
+  1544,1566,1538,1560,1540,1562,1541,1563,1542,1564,   0,   0,1543,1565,   0,   0,
+     0,   0,   0,   0,   0,   0,1606,1607,1609,1608,1610,   0,   0,   0,   0,   0,
+     0,   0,   0,   0,1613,   0,1611,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+     0,   0,   0,   0,   0,   0,   0,1612,   0,   0,   0,   0,   0,   0,   0,   0,
+     0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,1620,   0,   0,
+     0,   0,   0,   0,   0,1623,   0,   0,1624,   0,   0,   0,   0,   0,   0,   0,
+     0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,1614,1615,1616,1617,
+  1618,1619,1621,1622,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,1628,
+  1629,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+  1625,1626,   0,1627,   0,   0,   0,1634,   0,   0,1635,   0,   0,   0,   0,   0,
+     0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,1630,1631,1632,
+     0,   0,1633,   0,   0,   0,   0,   0,   0,   0,   0,   0,1639,   0,   0,1638,
+  1640,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+  1636,1637,   0,   0,   0,   0,   0,   0,1641,   0,   0,   0,   0,   0,   0,   0,
+     0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,1642,1644,
+  1643,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,1645,   0,   0,   0,
+     0,   0,   0,   0,1646,   0,   0,   0,   0,   0,   0,1648,1649,   0,1647,1650,
+     0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,1651,1653,
+  1652,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,1654,   0,
+  1655,1657,1656,   0,   0,   0,   0,1659,   0,   0,   0,   0,   0,   0,   0,   0,
+     0,1660,   0,   0,   0,   0,1661,   0,   0,   0,   0,1662,   0,   0,   0,   0,
+  1663,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,1658,   0,   0,
+     0,   0,   0,   0,   0,   0,   0,1664,   0,1665,1673,   0,1674,   0,   0,   0,
+     0,   0,   0,   0,   0,1666,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+     0,   0,   0,   0,   0,   0,   0,1668,   0,   0,   0,   0,   0,   0,   0,   0,
+     0,1669,   0,   0,   0,   0,1670,   0,   0,   0,   0,1671,   0,   0,   0,   0,
+  1672,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,1667,   0,   0,
+     0,   0,   0,   0,   0,   0,   0,   0,   0,   0,1675,   0,   0,   0,   0,   0,
+     0,   0,   0,   0,   0,   0,   0,   0,   0,   0,1676,   0,1677,   0,1678,   0,
+  1679,   0,1680,   0,   0,   0,1681,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+     0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,1682,
+     0,1683,   0,   0,1684,1685,   0,1686,   0,   0,   0,   0,   0,   0,   0,   0,
+     0,   0,   0,   0, 953,1138, 955,1140, 956,1141, 957,1142,1324,1351, 963,1148,
+   965,1150, 968,1153, 966,1151, 967,1152,1378,1380,1379,1381, 984,1169, 985,1170,
+  1420,1421, 986,1171, 989,1174, 995,1180, 998,1183, 996,1181, 999,1184,1000,1185,
+  1015,1200,1329,1356,1017,1203,1019,1205,1021,1207,1024,1210,1687,1688,1027,1213,
+  1026,1212,1028,1214,1029,1215,1030,1216,1034,1220,1036,1222,1039,1225,1038,1224,
+  1334,1361,1336,1363,1382,1384,1383,1385,1056,1242,1057,1243,1059,1245,1063,1249,
+  1689,1690,1065,1251,1068,1254,1070,1256,1386,1387,1388,1389,1691,1692,1073,1259,
+  1075,1262,1079,1266,1078,1265,1095,1282,1098,1285,1097,1284,1390,1391,1392,1393,
+  1099,1286,1100,1287,1101,1288,1102,1289,1105,1292,1104,1291,1106,1294,1107,1295,
+  1108,1296,1114,1302,1119,1308,1122,1311,1123,1312,1186,1260,1293,1305,   0,1394,
+     0,   0,   0,   0, 952,1137, 947,1132,1317,1344,1316,1343,1319,1346,1318,1345,
+  1693,1695,1371,1375,1370,1374,1373,1377,1372,1376,1694,1696, 981,1166, 977,1162,
+   972,1157,1326,1353,1325,1352,1328,1355,1327,1354,1697,1698,1009,1194,1013,1198,
+  1054,1240,1048,1234,1331,1358,1330,1357,1333,1360,1332,1359,1699,1700,1396,1401,
+  1395,1400,1398,1403,1397,1402,1399,1404,1094,1281,1087,1274,1406,1411,1405,1410,
+  1408,1413,1407,1412,1409,1414,1109,1297,1117,1306,1116,1304,1112,1300,   0,   0,
+     0,   0,   0,   0,1471,1472,1701,1705,1702,1706,1703,1707,1430,1431,1715,1719,
+  1716,1720,1717,1721,1477,1478,1729,1731,1730,1732,   0,   0,1435,1436,1733,1735,
+  1734,1736,   0,   0,1481,1482,1737,1741,1738,1742,1739,1743,1439,1440,1751,1755,
+  1752,1756,1753,1757,1490,1491,1765,1768,1766,1769,1767,1770,1447,1448,1771,1774,
+  1772,1775,1773,1776,1495,1496,1777,1779,1778,1780,   0,   0,1451,1452,1781,1783,
+  1782,1784,   0,   0,1504,1505,1785,1788,1786,1789,1787,1790,   0,1459,   0,1791,
+     0,1792,   0,1793,1509,1510,1794,1798,1795,1799,1796,1800,1462,1463,1808,1812,
+  1809,1813,1810,1814,1467,  21,1475,  22,1479,  23,1485,  24,1493,  27,1499,  28,
+  1507,  29,   0,   0,1704,1708,1709,1710,1711,1712,1713,1714,1718,1722,1723,1724,
+  1725,1726,1727,1728,1740,1744,1745,1746,1747,1748,1749,1750,1754,1758,1759,1760,
+  1761,1762,1763,1764,1797,1801,1802,1803,1804,1805,1806,1807,1811,1815,1816,1817,
+  1818,1819,1820,1821,1470,1469,1822,1474,1465,   0,1473,1825,1429,1428,1426,  12,
+  1432,   0,  26,   0,   0,1315,1823,1484,1466,   0,1483,1829,1433,  13,1437,  14,
+  1441,1826,1827,1828,1488,1487,1513,  19,   0,   0,1492,1515,1445,1444,1442,  15,
+     0,1831,1832,1833,1502,1501,1516,  25,1497,1498,1506,1518,1457,1456,1454,  17,
+  1453,1313,  11,   3,   0,   0,1824,1512,1519,   0,1511,1830,1449,  16,1460,  18,
+  1464,   4,   0,   0,  30,  31,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+     0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  20,   0,   0,   0,   2,   6,
+     0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,1834,1835,
      0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
-     0,   0,   0,   0,   0,   0,1446,1458,1468,1476,1480,1486,1517,   0,   0,   0,
+     0,   0,1836,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+     0,1837,1839,1838,   0,   0,   0,   0,1840,   0,   0,   0,   0,1841,   0,   0,
+  1842,   0,   0,   0,   0,   0,   0,   0,1843,   0,1844,   0,   0,   0,   0,   0,
+     0,   0,   0,   0,   0,1845,   0,   0,1846,   0,   0,1847,   0,1848,   0,   0,
+     0,   0,   0,   0, 937,   0,1850,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+     0,1849, 936, 938,1851,1852,   0,   0,1853,1854,   0,   0,1855,1856,   0,   0,
+     0,   0,   0,   0,1857,1858,   0,   0,1861,1862,   0,   0,1863,1864,   0,   0,
      0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
-     0,   0,   0,   0,   0,   0,1489,1503,1494,1500,1508,   0,   0,   0,   0,1520,
-  1521,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,1526,1528,   0,1525,
-     0,   0,   0,1522,   0,   0,   0,   0,1536,1532,1539,   0,   0,   0,   0,   0,
-     0,   0,   0,   0,   0,1534,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
-     0,   0,   0,   0,   0,1556,   0,   0,   0,   0,   0,   0,1548,1550,   0,1547,
-     0,   0,   0,1567,   0,   0,   0,   0,1558,1554,1561,   0,   0,   0,   0,   0,
-     0,   0,1568,1569,   0,   0,   0,   0,   0,   0,   0,   0,   0,1529,1551,   0,
-     0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,1523,1545,1524,1546,
-     0,   0,1527,1549,   0,   0,1570,1571,1530,1552,1531,1553,   0,   0,1533,1555,
-  1535,1557,1537,1559,   0,   0,1572,1573,1544,1566,1538,1560,1540,1562,1541,1563,
-  1542,1564,   0,   0,1543,1565,   0,   0,   0,   0,   0,   0,   0,   0,1606,1607,
-  1609,1608,1610,   0,   0,   0,   0,   0,   0,   0,   0,   0,1613,   0,1611,   0,
-     0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,1612,
+  1867,1868,1869,1870,1859,1860,1865,1866,   0,   0,   0,   0,   0,   0,1871,1872,
+  1873,1874,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,  32,  33,   0,
      0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
-     0,   0,   0,   0,   0,1620,   0,   0,   0,   0,   0,   0,   0,1623,   0,   0,
-  1624,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
-     0,   0,   0,   0,1614,1615,1616,1617,1618,1619,1621,1622,   0,   0,   0,   0,
-     0,   0,   0,   0,   0,   0,   0,1628,1629,   0,   0,   0,   0,   0,   0,   0,
-     0,   0,   0,   0,   0,   0,   0,   0,1625,1626,   0,1627,   0,   0,   0,1634,
-     0,   0,1635,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
-     0,   0,   0,   0,   0,1630,1631,1632,   0,   0,1633,   0,   0,   0,   0,   0,
-     0,   0,   0,   0,1639,   0,   0,1638,1640,   0,   0,   0,   0,   0,   0,   0,
-     0,   0,   0,   0,   0,   0,   0,   0,1636,1637,   0,   0,   0,   0,   0,   0,
-  1641,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
-     0,   0,   0,   0,   0,   0,1642,1644,1643,   0,   0,   0,   0,   0,   0,   0,
-     0,   0,   0,   0,1645,   0,   0,   0,   0,   0,   0,   0,1646,   0,   0,   0,
-     0,   0,   0,1648,1649,   0,1647,1650,   0,   0,   0,   0,   0,   0,   0,   0,
-     0,   0,   0,   0,   0,   0,1651,1653,1652,   0,   0,   0,   0,   0,   0,   0,
-     0,   0,   0,   0,   0,   0,1654,   0,1655,1657,1656,   0,   0,   0,   0,1659,
-     0,   0,   0,   0,   0,   0,   0,   0,   0,1660,   0,   0,   0,   0,1661,   0,
-     0,   0,   0,1662,   0,   0,   0,   0,1663,   0,   0,   0,   0,   0,   0,   0,
-     0,   0,   0,   0,   0,1658,   0,   0,   0,   0,   0,   0,   0,   0,   0,1664,
-     0,1665,1673,   0,1674,   0,   0,   0,   0,   0,   0,   0,   0,1666,   0,   0,
-     0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,1668,
-     0,   0,   0,   0,   0,   0,   0,   0,   0,1669,   0,   0,   0,   0,1670,   0,
-     0,   0,   0,1671,   0,   0,   0,   0,1672,   0,   0,   0,   0,   0,   0,   0,
-     0,   0,   0,   0,   0,1667,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
-     0,   0,1675,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
-     0,   0,1676,   0,1677,   0,1678,   0,1679,   0,1680,   0,   0,   0,1681,   0,
+  1875,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+  1877,   0,1878,   0,1879,   0,1880,   0,1881,   0,1882,   0,1883,   0,1884,   0,
+  1885,   0,1886,   0,1887,   0,1888,   0,   0,1889,   0,1890,   0,1891,   0,   0,
+     0,   0,   0,   0,1892,1893,   0,1894,1895,   0,1896,1897,   0,1898,1899,   0,
+  1900,1901,   0,   0,   0,   0,   0,   0,1876,   0,   0,   0,   0,   0,   0,   0,
+     0,   0,1902,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+  1904,   0,1905,   0,1906,   0,1907,   0,1908,   0,1909,   0,1910,   0,1911,   0,
+  1912,   0,1913,   0,1914,   0,1915,   0,   0,1916,   0,1917,   0,1918,   0,   0,
+     0,   0,   0,   0,1919,1920,   0,1921,1922,   0,1923,1924,   0,1925,1926,   0,
+  1927,1928,   0,   0,   0,   0,   0,   0,1903,   0,   0,1929,1930,1931,1932,   0,
+     0,   0,1933,   0, 710, 385, 724, 715, 455, 103, 186, 825, 825, 242, 751, 205,
+   241, 336, 524, 601, 663, 676, 688, 738, 411, 434, 474, 500, 649, 746, 799, 108,
+   180, 416, 482, 662, 810, 275, 462, 658, 692, 344, 618, 679, 293, 388, 440, 492,
+   740, 116, 146, 168, 368, 414, 481, 527, 606, 660, 665, 722, 781, 803, 809, 538,
+   553, 588, 642, 758, 811, 701, 233, 299, 573, 612, 487, 540, 714, 779, 232, 267,
+   412, 445, 457, 585, 594, 766, 167, 613, 149, 148, 560, 589, 648, 768, 708, 345,
+   411, 704, 105, 259, 313, 496, 518, 174, 542, 120, 307, 101, 430, 372, 584, 183,
+   228, 529, 650, 697, 424, 732, 428, 349, 632, 355, 517, 110, 135, 147, 403, 580,
+   624, 700, 750, 170, 193, 245, 297, 374, 463, 543, 763, 801, 812, 815, 162, 384,
+   420, 730, 287, 330, 337, 366, 459, 476, 509, 558, 591, 610, 726, 652, 734, 759,
+   154, 163, 198, 473, 683, 697, 292, 311, 353, 423, 572, 494, 113, 217, 259, 280,
+   314, 499, 506, 603, 608, 752, 778, 782, 788, 117, 557, 748, 774, 320, 109, 126,
+   260, 265, 373, 411, 479, 523, 655, 737, 823, 380, 765, 161, 395, 398, 438, 451,
+   502, 516, 537, 583, 791, 136, 340, 769, 122, 273, 446, 727, 305, 322, 400, 496,
+   771, 155, 190, 269, 377, 391, 406, 432, 501, 519, 599, 684, 687, 749, 776, 175,
+   452, 191, 480, 510, 659, 772, 805, 813, 397, 444, 619, 566, 568, 575, 491, 471,
+   707, 111, 636, 156, 153, 288, 346, 578, 256, 435, 383, 729, 680, 767, 694, 295,
+   128, 210,   0,   0, 227,   0, 379,   0,   0, 150, 493, 525, 544, 551, 552, 556,
+   783, 576, 604,   0, 661,   0, 703,   0,   0, 735, 743,   0,   0,   0, 793, 794,
+   795, 808, 741, 773, 118, 127, 130, 166, 169, 177, 207, 213, 215, 226, 229, 268,
+   270, 317, 327, 329, 335, 369, 375, 381, 404, 441, 448, 458, 477, 484, 503, 539,
+   545, 547, 546, 548, 549, 550, 554, 555, 561, 564, 569, 591, 593, 595, 598, 607,
+   620, 625, 625, 651, 690, 695, 705, 706, 716, 717, 733, 735, 777, 786, 790, 315,
+   869, 623,   0,   0, 102, 145, 134, 115, 129, 138, 165, 171, 207, 202, 206, 212,
+   227, 231, 240, 243, 250, 254, 294, 296, 303, 308, 319, 325, 321, 329, 326, 335,
+   341, 357, 360, 362, 370, 379, 388, 389, 393, 421, 424, 438, 456, 454, 458, 465,
+   477, 535, 485, 490, 493, 507, 512, 514, 521, 522, 525, 526, 528, 533, 532, 541,
+   565, 569, 574, 586, 591, 597, 607, 637, 647, 674, 691, 693, 695, 698, 703, 699,
+   705, 704, 702, 706, 709, 717, 728, 736, 747, 754, 770, 777, 783, 784, 786, 787,
+   790, 802, 825, 848, 847, 857,  55,  65,  66, 883, 892, 916, 822, 824,   0,   0,
      0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
-     0,   0,   0,   0,   0,   0,   0,1682,   0,1683,   0,   0,1684,1685,   0,1686,
-     0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 953,1138, 955,1140,
-   956,1141, 957,1142,1324,1351, 963,1148, 965,1150, 968,1153, 966,1151, 967,1152,
-  1378,1380,1379,1381, 984,1169, 985,1170,1420,1421, 986,1171, 989,1174, 995,1180,
-   998,1183, 996,1181, 999,1184,1000,1185,1015,1200,1329,1356,1017,1203,1019,1205,
-  1021,1207,1024,1210,1687,1688,1027,1213,1026,1212,1028,1214,1029,1215,1030,1216,
-  1034,1220,1036,1222,1039,1225,1038,1224,1334,1361,1336,1363,1382,1384,1383,1385,
-  1056,1242,1057,1243,1059,1245,1063,1249,1689,1690,1065,1251,1068,1254,1070,1256,
-  1386,1387,1388,1389,1691,1692,1073,1259,1075,1262,1079,1266,1078,1265,1095,1282,
-  1098,1285,1097,1284,1390,1391,1392,1393,1099,1286,1100,1287,1101,1288,1102,1289,
-  1105,1292,1104,1291,1106,1294,1107,1295,1108,1296,1114,1302,1119,1308,1122,1311,
-  1123,1312,1186,1260,1293,1305,   0,1394,   0,   0,   0,   0, 952,1137, 947,1132,
-  1317,1344,1316,1343,1319,1346,1318,1345,1693,1695,1371,1375,1370,1374,1373,1377,
-  1372,1376,1694,1696, 981,1166, 977,1162, 972,1157,1326,1353,1325,1352,1328,1355,
-  1327,1354,1697,1698,1009,1194,1013,1198,1054,1240,1048,1234,1331,1358,1330,1357,
-  1333,1360,1332,1359,1699,1700,1396,1401,1395,1400,1398,1403,1397,1402,1399,1404,
-  1094,1281,1087,1274,1406,1411,1405,1410,1408,1413,1407,1412,1409,1414,1109,1297,
-  1117,1306,1116,1304,1112,1300,   0,   0,   0,   0,   0,   0,1471,1472,1701,1705,
-  1702,1706,1703,1707,1430,1431,1715,1719,1716,1720,1717,1721,1477,1478,1729,1731,
-  1730,1732,   0,   0,1435,1436,1733,1735,1734,1736,   0,   0,1481,1482,1737,1741,
-  1738,1742,1739,1743,1439,1440,1751,1755,1752,1756,1753,1757,1490,1491,1765,1768,
-  1766,1769,1767,1770,1447,1448,1771,1774,1772,1775,1773,1776,1495,1496,1777,1779,
-  1778,1780,   0,   0,1451,1452,1781,1783,1782,1784,   0,   0,1504,1505,1785,1788,
-  1786,1789,1787,1790,   0,1459,   0,1791,   0,1792,   0,1793,1509,1510,1794,1798,
-  1795,1799,1796,1800,1462,1463,1808,1812,1809,1813,1810,1814,1467,  21,1475,  22,
-  1479,  23,1485,  24,1493,  27,1499,  28,1507,  29,   0,   0,1704,1708,1709,1710,
-  1711,1712,1713,1714,1718,1722,1723,1724,1725,1726,1727,1728,1740,1744,1745,1746,
-  1747,1748,1749,1750,1754,1758,1759,1760,1761,1762,1763,1764,1797,1801,1802,1803,
-  1804,1805,1806,1807,1811,1815,1816,1817,1818,1819,1820,1821,1470,1469,1822,1474,
-  1465,   0,1473,1825,1429,1428,1426,  12,1432,   0,  26,   0,   0,1315,1823,1484,
-  1466,   0,1483,1829,1433,  13,1437,  14,1441,1826,1827,1828,1488,1487,1513,  19,
-     0,   0,1492,1515,1445,1444,1442,  15,   0,1831,1832,1833,1502,1501,1516,  25,
-  1497,1498,1506,1518,1457,1456,1454,  17,1453,1313,  11,   3,   0,   0,1824,1512,
-  1519,   0,1511,1830,1449,  16,1460,  18,1464,   4,   0,   0,  30,  31,   0,   0,
+     0,1586,   0,1605,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,1602,1603,
+  1934,1935,1574,1575,1576,1577,1579,1580,1581,1583,1584,   0,1585,1587,1588,1589,
+  1591,   0,1592,   0,1593,1594,   0,1595,1596,   0,1598,1599,1600,1601,1604,1582,
+  1578,1590,1597,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,1936,   0,   0,
+     0,   0,   0,   0,   0,   0,   0,   0,1937,   0,   0,   0,   0,   0,   0,   0,
+     0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,1938,   0,
+  1939,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,1940,
      0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
-     0,   0,  20,   0,   0,   0,   2,   6,   0,   0,   0,   0,   0,   0,   0,   0,
-     0,   0,   0,   0,   0,   0,1834,1835,   0,   0,   0,   0,   0,   0,   0,   0,
-     0,   0,   0,   0,   0,   0,   0,   0,   0,   0,1836,   0,   0,   0,   0,   0,
-     0,   0,   0,   0,   0,   0,   0,   0,   0,1837,1839,1838,   0,   0,   0,   0,
-  1840,   0,   0,   0,   0,1841,   0,   0,1842,   0,   0,   0,   0,   0,   0,   0,
-  1843,   0,1844,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,1845,   0,   0,
-  1846,   0,   0,1847,   0,1848,   0,   0,   0,   0,   0,   0, 937,   0,1850,   0,
-     0,   0,   0,   0,   0,   0,   0,   0,   0,1849, 936, 938,1851,1852,   0,   0,
-  1853,1854,   0,   0,1855,1856,   0,   0,   0,   0,   0,   0,1857,1858,   0,   0,
-  1861,1862,   0,   0,1863,1864,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
-     0,   0,   0,   0,   0,   0,   0,   0,1867,1868,1869,1870,1859,1860,1865,1866,
-     0,   0,   0,   0,   0,   0,1871,1872,1873,1874,   0,   0,   0,   0,   0,   0,
-     0,   0,   0,   0,   0,  32,  33,   0,   0,   0,   0,   0,   0,   0,   0,   0,
-     0,   0,   0,   0,   0,   0,   0,   0,1875,   0,   0,   0,   0,   0,   0,   0,
-     0,   0,   0,   0,   0,   0,   0,   0,1877,   0,1878,   0,1879,   0,1880,   0,
-  1881,   0,1882,   0,1883,   0,1884,   0,1885,   0,1886,   0,1887,   0,1888,   0,
-     0,1889,   0,1890,   0,1891,   0,   0,   0,   0,   0,   0,1892,1893,   0,1894,
-  1895,   0,1896,1897,   0,1898,1899,   0,1900,1901,   0,   0,   0,   0,   0,   0,
-  1876,   0,   0,   0,   0,   0,   0,   0,   0,   0,1902,   0,   0,   0,   0,   0,
-     0,   0,   0,   0,   0,   0,   0,   0,1904,   0,1905,   0,1906,   0,1907,   0,
-  1908,   0,1909,   0,1910,   0,1911,   0,1912,   0,1913,   0,1914,   0,1915,   0,
-     0,1916,   0,1917,   0,1918,   0,   0,   0,   0,   0,   0,1919,1920,   0,1921,
-  1922,   0,1923,1924,   0,1925,1926,   0,1927,1928,   0,   0,   0,   0,   0,   0,
-  1903,   0,   0,1929,1930,1931,1932,   0,   0,   0,1933,   0, 710, 385, 724, 715,
-   455, 103, 186, 825, 825, 242, 751, 205, 241, 336, 524, 601, 663, 676, 688, 738,
-   411, 434, 474, 500, 649, 746, 799, 108, 180, 416, 482, 662, 810, 275, 462, 658,
-   692, 344, 618, 679, 293, 388, 440, 492, 740, 116, 146, 168, 368, 414, 481, 527,
-   606, 660, 665, 722, 781, 803, 809, 538, 553, 588, 642, 758, 811, 701, 233, 299,
-   573, 612, 487, 540, 714, 779, 232, 267, 412, 445, 457, 585, 594, 766, 167, 613,
-   149, 148, 560, 589, 648, 768, 708, 345, 411, 704, 105, 259, 313, 496, 518, 174,
-   542, 120, 307, 101, 430, 372, 584, 183, 228, 529, 650, 697, 424, 732, 428, 349,
-   632, 355, 517, 110, 135, 147, 403, 580, 624, 700, 750, 170, 193, 245, 297, 374,
-   463, 543, 763, 801, 812, 815, 162, 384, 420, 730, 287, 330, 337, 366, 459, 476,
-   509, 558, 591, 610, 726, 652, 734, 759, 154, 163, 198, 473, 683, 697, 292, 311,
-   353, 423, 572, 494, 113, 217, 259, 280, 314, 499, 506, 603, 608, 752, 778, 782,
-   788, 117, 557, 748, 774, 320, 109, 126, 260, 265, 373, 411, 479, 523, 655, 737,
-   823, 380, 765, 161, 395, 398, 438, 451, 502, 516, 537, 583, 791, 136, 340, 769,
-   122, 273, 446, 727, 305, 322, 400, 496, 771, 155, 190, 269, 377, 391, 406, 432,
-   501, 519, 599, 684, 687, 749, 776, 175, 452, 191, 480, 510, 659, 772, 805, 813,
-   397, 444, 619, 566, 568, 575, 491, 471, 707, 111, 636, 156, 153, 288, 346, 578,
-   256, 435, 383, 729, 680, 767, 694, 295, 128, 210,   0,   0, 227,   0, 379,   0,
-     0, 150, 493, 525, 544, 551, 552, 556, 783, 576, 604,   0, 661,   0, 703,   0,
-     0, 735, 743,   0,   0,   0, 793, 794, 795, 808, 741, 773, 118, 127, 130, 166,
-   169, 177, 207, 213, 215, 226, 229, 268, 270, 317, 327, 329, 335, 369, 375, 381,
-   404, 441, 448, 458, 477, 484, 503, 539, 545, 547, 546, 548, 549, 550, 554, 555,
-   561, 564, 569, 591, 593, 595, 598, 607, 620, 625, 625, 651, 690, 695, 705, 706,
-   716, 717, 733, 735, 777, 786, 790, 315, 869, 623,   0,   0, 102, 145, 134, 115,
-   129, 138, 165, 171, 207, 202, 206, 212, 227, 231, 240, 243, 250, 254, 294, 296,
-   303, 308, 319, 325, 321, 329, 326, 335, 341, 357, 360, 362, 370, 379, 388, 389,
-   393, 421, 424, 438, 456, 454, 458, 465, 477, 535, 485, 490, 493, 507, 512, 514,
-   521, 522, 525, 526, 528, 533, 532, 541, 565, 569, 574, 586, 591, 597, 607, 637,
-   647, 674, 691, 693, 695, 698, 703, 699, 705, 704, 702, 706, 709, 717, 728, 736,
-   747, 754, 770, 777, 783, 784, 786, 787, 790, 802, 825, 848, 847, 857,  55,  65,
-    66, 883, 892, 916, 822, 824,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
-     0,   0,   0,   0,   0,   0,   0,   0,   0,1586,   0,1605,   0,   0,   0,   0,
-     0,   0,   0,   0,   0,   0,1602,1603,1934,1935,1574,1575,1576,1577,1579,1580,
-  1581,1583,1584,   0,1585,1587,1588,1589,1591,   0,1592,   0,1593,1594,   0,1595,
-  1596,   0,1598,1599,1600,1601,1604,1582,1578,1590,1597,   0,   0,   0,   0,   0,
-     0,   0,   0,   0,   0,   0,1936,   0,1937,   0,   0,   0,   0,   0,   0,   0,
-     0,   0,   0,   0,   0,   0,   0,1938,   0,   0,   0,   0,   0,   0,   0,   0,
-     0,   0,   0,   0,   0,   0,   0,   0,   0,   0,1939,1940,   0,   0,   0,   0,
-     0,   0,   0,   0,   0,   0,   0,1941,1942,   0,   0,   0,   0,   0,   0,   0,
-     0,   0,   0,   0,   0,   0,   0,1944,1943,   0,1945,   0,   0,   0,   0,   0,
-     0,   0,   0,   0,   0,   0,1946,1947,   0,   0,   0,   0,   0,   0,   0,   0,
-     0,   0,   0,   0,1948,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
-     0,   0,   0,   0,   0,   0,   0,   0,   0,   0,1949,1950,1951,1952,1953,1954,
-  1955,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
-     0,   0,   0,   0,   0,   0,   0,1956,1957,1958,1960,1959,1961,   0,   0,   0,
-     0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0, 106, 104, 107, 826,
-   114, 118, 119, 121, 123, 124, 127, 125,  34, 830, 130, 131, 132, 137, 827,  35,
-   133, 139, 829, 142, 143, 112, 144, 145, 924, 151, 152,  37, 157, 158, 159, 160,
-    38, 165, 166, 169, 171, 172, 173, 174, 176, 177, 178, 179, 181, 182, 182, 182,
-   833, 468, 184, 185, 834, 187, 188, 189, 196, 192, 194, 195, 197, 199, 200, 201,
-   203, 204, 204, 206, 208, 209, 211, 218, 213, 219, 214, 216, 153, 234, 221, 222,
-   223, 220, 225, 224, 230, 835, 235, 236, 237, 238, 239, 244, 836, 837, 247, 248,
-   249, 246, 251,  39,  40, 253, 255, 255, 838, 257, 258, 259, 261, 839, 262, 263,
-   301, 264,  41, 266, 270, 272, 271, 841, 274, 842, 277, 276, 278, 281, 282,  42,
-   283, 284, 285, 286,  43, 843,  44, 289, 290, 291, 293, 934, 298, 845, 845, 621,
-   300, 300,  45, 852, 894, 302, 304,  46, 306, 309, 310, 312, 316,  48,  47, 317,
-   846, 318, 323, 324, 325, 324, 328, 329, 333, 331, 332, 334, 335, 336, 338, 339,
-   342, 343, 347, 351, 849, 350, 348, 352, 354, 359, 850, 361, 358, 356,  49, 363,
-   365, 367, 364,  50, 369, 371, 851, 376, 386, 378,  53, 381,  52,  51, 140, 141,
-   387, 382, 614,  78, 388, 389, 390, 394, 392, 856,  54, 399, 396, 402, 404, 858,
-   405, 401, 407,  55, 408, 409, 410, 413, 859, 415,  56, 417, 860, 418,  57, 419,
-   422, 424, 425, 861, 840, 862, 426, 863, 429, 431, 427, 433, 437, 441, 438, 439,
-   442, 443, 864, 436, 449, 450,  58, 454, 453, 865, 447, 460, 866, 867, 461, 466,
-   465, 464,  59, 467, 470, 469, 472, 828, 475, 868, 478, 870, 483, 485, 486, 871,
-   488, 489, 872, 873, 495, 497,  60, 498,  61,  61, 504, 505, 507, 508, 511,  62,
-   513, 874, 515, 875, 518, 844, 520, 876, 877, 878,  63,  64, 528, 880, 879, 881,
-   882, 530, 531, 531, 533,  66, 534,  67,  68, 884, 536, 538, 541,  69, 885, 549,
-   886, 887, 556, 559,  70, 561, 562, 563, 888, 889, 889, 567,  71, 890, 570, 571,
-    72, 891, 577,  73, 581, 579, 582, 893, 587,  74, 590, 592, 596,  75, 895, 896,
-    76, 897, 600, 898, 602, 605, 607, 899, 900, 609, 901, 611, 853,  77, 615, 616,
-    79, 617, 252, 902, 903, 854, 855, 621, 622, 731,  80, 627, 626, 628, 164, 629,
-   630, 631, 633, 904, 632, 634, 639, 640, 635, 641, 646, 651, 638, 643, 644, 645,
-   905, 907, 906,  81, 653, 654, 656, 911, 657, 908,  82,  83, 909, 910,  84, 664,
-   665, 666, 667, 669, 668, 671, 670, 674, 672, 673, 675,  85, 677, 678,  86, 681,
-   682, 912, 685, 686,  87, 689,  36, 913, 914,  88,  89, 696, 702, 709, 711, 915,
-   712, 713, 718, 719, 917, 831, 721, 720, 723, 832, 725, 728, 918, 919, 739, 742,
-   744, 920, 745, 753, 756, 757, 755, 760, 761, 921, 762,  90, 764, 922,  91, 775,
-   279, 780, 923, 925,  92,  93, 785, 926,  94, 927, 787, 787, 789, 928, 792,  95,
-   796, 797, 798, 800,  96, 929, 802, 804, 806,  97,  98, 807, 930,  99, 931, 932,
-   933, 814, 100, 816, 817, 818, 819, 820, 821, 935,   0,   0,
+     0,   0,1941,1942,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,1943,
+  1944,   0,   0,   0,   0,   0,   0,1945,   0,1946,   0,   0,   0,   0,   0,   0,
+     0,   0,1947,   0,   0,1948,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+     0,   0,   0,   0,   0,   0,   0,   0,   0,1950,   0,1949,1951,   0,   0,   0,
+     0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,1953,
+  1952,   0,1954,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,1955,1956,
+     0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,1957,   0,   0,   0,
+     0,   0,   0,   0,   0,1958,1961,1959,1965,1960,1962,1964,1963,   0,   0,   0,
+     0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,1967,1966,1968,   0,
+     0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+     0,   0,1969,1970,1971,1972,1973,1974,1975,   0,   0,   0,   0,   0,   0,   0,
+     0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,1976,
+  1977,1978,1980,1979,1981,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+     0,   0,   0,   0, 106, 104, 107, 826, 114, 118, 119, 121, 123, 124, 127, 125,
+    34, 830, 130, 131, 132, 137, 827,  35, 133, 139, 829, 142, 143, 112, 144, 145,
+   924, 151, 152,  37, 157, 158, 159, 160,  38, 165, 166, 169, 171, 172, 173, 174,
+   176, 177, 178, 179, 181, 182, 182, 182, 833, 468, 184, 185, 834, 187, 188, 189,
+   196, 192, 194, 195, 197, 199, 200, 201, 203, 204, 204, 206, 208, 209, 211, 218,
+   213, 219, 214, 216, 153, 234, 221, 222, 223, 220, 225, 224, 230, 835, 235, 236,
+   237, 238, 239, 244, 836, 837, 247, 248, 249, 246, 251,  39,  40, 253, 255, 255,
+   838, 257, 258, 259, 261, 839, 262, 263, 301, 264,  41, 266, 270, 272, 271, 841,
+   274, 842, 277, 276, 278, 281, 282,  42, 283, 284, 285, 286,  43, 843,  44, 289,
+   290, 291, 293, 934, 298, 845, 845, 621, 300, 300,  45, 852, 894, 302, 304,  46,
+   306, 309, 310, 312, 316,  48,  47, 317, 846, 318, 323, 324, 325, 324, 328, 329,
+   333, 331, 332, 334, 335, 336, 338, 339, 342, 343, 347, 351, 849, 350, 348, 352,
+   354, 359, 850, 361, 358, 356,  49, 363, 365, 367, 364,  50, 369, 371, 851, 376,
+   386, 378,  53, 381,  52,  51, 140, 141, 387, 382, 614,  78, 388, 389, 390, 394,
+   392, 856,  54, 399, 396, 402, 404, 858, 405, 401, 407,  55, 408, 409, 410, 413,
+   859, 415,  56, 417, 860, 418,  57, 419, 422, 424, 425, 861, 840, 862, 426, 863,
+   429, 431, 427, 433, 437, 441, 438, 439, 442, 443, 864, 436, 449, 450,  58, 454,
+   453, 865, 447, 460, 866, 867, 461, 466, 465, 464,  59, 467, 470, 469, 472, 828,
+   475, 868, 478, 870, 483, 485, 486, 871, 488, 489, 872, 873, 495, 497,  60, 498,
+    61,  61, 504, 505, 507, 508, 511,  62, 513, 874, 515, 875, 518, 844, 520, 876,
+   877, 878,  63,  64, 528, 880, 879, 881, 882, 530, 531, 531, 533,  66, 534,  67,
+    68, 884, 536, 538, 541,  69, 885, 549, 886, 887, 556, 559,  70, 561, 562, 563,
+   888, 889, 889, 567,  71, 890, 570, 571,  72, 891, 577,  73, 581, 579, 582, 893,
+   587,  74, 590, 592, 596,  75, 895, 896,  76, 897, 600, 898, 602, 605, 607, 899,
+   900, 609, 901, 611, 853,  77, 615, 616,  79, 617, 252, 902, 903, 854, 855, 621,
+   622, 731,  80, 627, 626, 628, 164, 629, 630, 631, 633, 904, 632, 634, 639, 640,
+   635, 641, 646, 651, 638, 643, 644, 645, 905, 907, 906,  81, 653, 654, 656, 911,
+   657, 908,  82,  83, 909, 910,  84, 664, 665, 666, 667, 669, 668, 671, 670, 674,
+   672, 673, 675,  85, 677, 678,  86, 681, 682, 912, 685, 686,  87, 689,  36, 913,
+   914,  88,  89, 696, 702, 709, 711, 915, 712, 713, 718, 719, 917, 831, 721, 720,
+   723, 832, 725, 728, 918, 919, 739, 742, 744, 920, 745, 753, 756, 757, 755, 760,
+   761, 921, 762,  90, 764, 922,  91, 775, 279, 780, 923, 925,  92,  93, 785, 926,
+    94, 927, 787, 787, 789, 928, 792,  95, 796, 797, 798, 800,  96, 929, 802, 804,
+   806,  97,  98, 807, 930,  99, 931, 932, 933, 814, 100, 816, 817, 818, 819, 820,
+   821, 935,   0,   0,
 };
 static const int16_t
 _hb_ucd_i16[92] =
@@ -4403,12 +4615,12 @@ _hb_ucd_i16[92] =
 static inline uint_fast8_t
 _hb_ucd_gc (unsigned u)
 {
-  return u<1114110u?_hb_ucd_u8[6808+(((_hb_ucd_u8[1312+(((_hb_ucd_u16[((_hb_ucd_u8[544+(((_hb_ucd_u8[u>>1>>3>>3>>4])<<4)+((u>>1>>3>>3)&15u))])<<3)+((u>>1>>3)&7u)])<<3)+((u>>1)&7u))])<<1)+((u)&1u))]:2;
+  return u<1114110u?_hb_ucd_u8[6472+(((_hb_ucd_u8[816+(((_hb_ucd_u16[((_hb_ucd_u8[272+(((_hb_ucd_u8[u>>1>>3>>4>>4])<<4)+((u>>1>>3>>4)&15u))])<<4)+((u>>1>>3)&15u)])<<3)+((u>>1)&7u))])<<1)+((u)&1u))]:2;
 }
 static inline uint_fast8_t
 _hb_ucd_ccc (unsigned u)
 {
-  return u<125259u?_hb_ucd_u8[8800+(((_hb_ucd_u8[8244+(((_hb_ucd_u8[7784+(((_hb_ucd_u8[7432+(((_hb_ucd_u8[7186+(u>>2>>2>>2>>3)])<<3)+((u>>2>>2>>2)&7u))])<<2)+((u>>2>>2)&3u))])<<2)+((u>>2)&3u))])<<2)+((u)&3u))]:0;
+  return u<125259u?_hb_ucd_u8[8504+(((_hb_ucd_u8[7936+(((_hb_ucd_u8[7460+(((_hb_ucd_u8[7100+(((_hb_ucd_u8[6854+(u>>2>>2>>2>>3)])<<3)+((u>>2>>2>>2)&7u))])<<2)+((u>>2>>2)&3u))])<<2)+((u>>2)&3u))])<<2)+((u)&3u))]:0;
 }
 static inline unsigned
 _hb_ucd_b4 (const uint8_t* a, unsigned i)
@@ -4418,55 +4630,55 @@ _hb_ucd_b4 (const uint8_t* a, unsigned i)
 static inline int_fast16_t
 _hb_ucd_bmg (unsigned u)
 {
-  return u<65380u?_hb_ucd_i16[((_hb_ucd_u8[9692+(((_hb_ucd_u8[9460+(((_hb_ucd_u8[9364+(((_hb_ucd_b4(9300+_hb_ucd_u8,u>>1>>2>>3>>3))<<3)+((u>>1>>2>>3)&7u))])<<3)+((u>>1>>2)&7u))])<<2)+((u>>1)&3u))])<<1)+((u)&1u)]:0;
+  return u<65380u?_hb_ucd_i16[((_hb_ucd_u8[9396+(((_hb_ucd_u8[9164+(((_hb_ucd_u8[9068+(((_hb_ucd_b4(9004+_hb_ucd_u8,u>>1>>2>>3>>3))<<3)+((u>>1>>2>>3)&7u))])<<3)+((u>>1>>2)&7u))])<<2)+((u>>1)&3u))])<<1)+((u)&1u)]:0;
 }
 static inline uint_fast8_t
 _hb_ucd_sc (unsigned u)
 {
-  return u<918000u?_hb_ucd_u8[11126+(((_hb_ucd_u16[4040+(((_hb_ucd_u16[2048+(((_hb_ucd_u8[10390+(((_hb_ucd_u8[9940+(u>>2>>2>>3>>4)])<<4)+((u>>2>>2>>3)&15u))])<<3)+((u>>2>>2)&7u))])<<2)+((u>>2)&3u))])<<2)+((u)&3u))]:2;
+  return u<918000u?_hb_ucd_u8[10398+(((_hb_ucd_u16[3952+(((_hb_ucd_u16[2624+(((_hb_ucd_u8[9870+(((_hb_ucd_u8[9644+(u>>3>>2>>3>>4)])<<4)+((u>>3>>2>>3)&15u))])<<3)+((u>>3>>2)&7u))])<<2)+((u>>3)&3u))])<<3)+((u)&7u))]:2;
 }
 static inline uint_fast16_t
 _hb_ucd_dm (unsigned u)
 {
-  return u<195102u?_hb_ucd_u16[6748+(((_hb_ucd_u8[13952+(((_hb_ucd_u8[13570+(u>>4>>5)])<<5)+((u>>4)&31u))])<<4)+((u)&15u))]:0;
+  return u<195102u?_hb_ucd_u16[6244+(((_hb_ucd_u8[16628+(((_hb_ucd_u8[16246+(u>>4>>5)])<<5)+((u>>4)&31u))])<<4)+((u)&15u))]:0;
 }
 
 
 #else
 
 static const uint8_t
-_hb_ucd_u8[13386] =
+_hb_ucd_u8[13730] =
 {
     0,  1,  2,  3,  4,  5,  6,  7,  7,  8,  7,  7,  7,  7,  7,  7,
     7,  7,  7,  7,  9, 10,  7,  7,  7,  7,  7, 11, 12, 12, 12, 13,
-   14, 15, 16, 17, 18, 19, 20, 21, 22, 21, 21, 21, 21, 23,  7,  7,
-    7, 24, 21, 21, 21, 25, 26, 27, 21, 28, 29, 30, 31, 32, 33, 34,
+   14, 15, 16, 17, 18, 19, 20,  7, 21, 22, 22, 22, 23, 24,  7,  7,
+    7, 25, 22, 22, 22, 26, 27, 28, 22, 29, 30, 31, 32, 33, 34, 35,
     7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,
-    7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7, 35, 21, 36,
-    7,  7,  7,  7, 37, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
-   21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
-   21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
-   21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
-   21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
-   21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
-   21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
-   21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
-   21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
-   21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
-   21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
-   21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
-   21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
-   21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
-   21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
-   21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
-   21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
-   21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
-   21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
-   21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
-   21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
-   21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
-   38, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
-   21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21,
+    7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7,  7, 21, 22, 36,
+    7,  7,  7,  7, 37, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+   22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+   22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+   22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+   22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+   22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+   22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+   22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+   22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+   22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+   22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+   22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+   22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+   22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+   22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+   22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+   22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+   22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+   22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+   22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+   22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+   22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+   38, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
+   22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22, 22,
    12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
    12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
    12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12,
@@ -4486,30 +4698,30 @@ _hb_ucd_u8[13386] =
   100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,100,
   100,100, 34, 34, 34, 34,101,102, 34, 34,103,104,105,106,107,108,
    34, 34,109,110,111,112,113,114,115,116,117,118, 34, 34, 34,119,
-  120,121,122,123,124,125,126,127, 34,128,129,111,130,131,132,133,
-  134,135,136,137,138,139,140,111,141,142,111,143,144,145,146,111,
-  147,148,149,150,151,152,153,111,154,155,156,157,111,158,159,160,
-   34, 34, 34, 34, 34, 34, 34, 34,161, 34, 34,111,111,111,111,111,
-  111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,162,
-   34, 34, 34, 34, 34, 34, 34, 34,163,111,111,111,111,111,111,111,
+  120,121,122,123,124,125,126,127, 34,128,129,130,131,132,133,134,
+  135,136,137,138,139,140,141,142,143,144,111,145,146,147,148,111,
+  149,150,151,152,153,154,155,156,157,158,159,160,111,161,162,163,
+   34, 34, 34, 34, 34, 34, 34, 34,164, 34, 34,111,111,111,111,111,
+  111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,165,
+   34, 34, 34, 34, 34, 34, 34, 34,166, 34, 34, 34, 34, 34, 34, 34,
+   34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,111,111,111,
   111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,
-  111,111,111,111,111,111,111,111, 34, 34, 34, 34, 34,111,111,111,
-   34, 34, 34, 34,164,165,166, 34,111,111,111,111,167,168,169,170,
+  111,111,167,111,111,111,111,111,111,111,111,111,111,111,111,111,
+   34, 34, 34, 34,168,169,170, 34,111,111,171,111,172,173,174,175,
    34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,111,111,111,111,111,
   111,111,111,111,111,111,111,111,111,111,111,111,111,111,111,119,
    34, 34, 34, 34, 34, 34,111,111,111,111,111,111,111,111,111,111,
-  111,111,111,111,111,111,111,111, 34,171,111,111,111,111,111,111,
-  111,111,111,111,111,111,111,111,111,111,111,111,111,111,172, 67,
-   67, 67,173,174,175,130, 65,111,176,177,178,179,180,181,182,183,
-   67, 67, 67, 67,184,185,111,111,111,111,111,111,111,111,186,111,
-  187,188,189,111,111,190,111,111,111,191,111,111,111,111,111, 34,
-   34,192,193,111,111,111,111,111,130,194,195,111, 34,196,111,111,
-   67, 67,197, 67, 67,111, 67,198, 67, 67, 67, 67, 67, 67, 67, 67,
-   67, 67, 67, 67, 67, 67, 67,199,111,111,111,111,111,111,111,111,
-   34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34, 34,111,111,111,
+  111,111,111,111,111,111,111,111, 34,176,111,111,111,111,111,111,
+  111,111,111,111,111,111,111,111, 67,177, 67, 67, 67, 67,178, 67,
+   67, 67,179,180,181,131, 65,111,182,183,184,185,186,187,188,189,
+   67, 67, 67, 67,190,191,111,111,111,111,111,111,111,111,192,111,
+  193,194,195,111,111,196,111,111,111,197,111,198,111,111,111, 34,
+   34,199,200,111,111,111,111,111,131,201,202,111, 34,203,111,111,
+   67, 67,204, 67, 67,111, 67,205, 67, 67, 67, 67, 67, 67, 67, 67,
+   67, 67, 67, 67, 67, 67, 67,177,111,111,111,111,111,111,111,111,
    34, 34, 34, 34, 34,111,111,111,111,111,111,111,111,111,111,111,
    34, 34, 34, 34, 34, 34, 34, 34,111,111,111,111,111,111,111,111,
-  200,111,188,188,111,111,111,111,111,111,111,111,111,111,111,111,
+  206,111,194,194,111,111,111,111,111,111,111,111,111,111,111,111,
     0,  0,  0,  0,  0,  0,  0,  0,  1,  2,  3,  2,  4,  5,  6,  2,
     7,  7,  7,  7,  7,  2,  8,  9, 10, 11, 11, 11, 11, 11, 11, 11,
    11, 11, 11, 11, 11, 12, 13, 14, 15, 16, 16, 16, 16, 16, 16, 16,
@@ -4544,8 +4756,8 @@ _hb_ucd_u8[13386] =
    36, 36, 36, 36, 36, 64, 43, 43, 43, 43, 40, 21,  2, 40, 69, 20,
    36, 36, 36, 43, 43, 69, 43, 43, 43, 43, 69, 43, 69, 43, 43, 43,
     2,  2,  2,  2,  2,  2,  2,  2, 36, 36, 36, 36, 64, 43, 43,  2,
-   36, 36, 36, 36, 74, 36, 36, 36, 59, 59, 59, 59, 43, 43, 43, 43,
-   36, 36, 36, 36, 75, 43, 43, 43, 43, 76, 43, 43, 43, 43, 43, 43,
+   36, 36, 36, 36, 74, 36, 36, 36, 59, 59, 59, 75, 43, 43, 43, 43,
+   36, 36, 36, 36, 76, 43, 43, 43, 43, 75, 43, 43, 43, 43, 43, 43,
    43, 77, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 77, 65, 78,
    79, 43, 43, 43, 77, 78, 79, 78, 64, 43, 43, 43, 36, 36, 36, 36,
    36, 43,  2,  7,  7,  7,  7,  7, 80, 36, 36, 36, 36, 36, 36, 36,
@@ -4590,130 +4802,135 @@ _hb_ucd_u8[13386] =
    36, 43, 77, 78, 78, 78, 78, 81, 36, 43, 97,  2,  2,  2,  2,  2,
    36, 43, 43, 43, 43, 43, 43, 43, 36, 36, 43, 79, 43, 43, 43, 78,
    78, 78, 78, 77, 79, 43, 43, 43, 43, 43,  2, 80,  2, 60, 64, 43,
-    7,  7,  7,  7,  7,  7,  7,  7,  2,  2,  2, 98,  2, 56, 43, 76,
-   36, 75, 36, 36, 36, 36, 36, 36, 36, 36, 64, 65, 36, 36, 36, 36,
+    7,  7,  7,  7,  7,  7,  7,  7,  2,  2,  2, 98,  2, 56, 43, 75,
+   36, 76, 36, 36, 36, 36, 36, 36, 36, 36, 64, 65, 36, 36, 36, 36,
    36, 36, 36, 36, 64, 36, 36, 36, 43, 77, 78, 79, 77, 78, 78, 78,
    78, 77, 78, 78, 79, 43, 43, 43, 61, 61,  2,  7,  7,  7,  7,  7,
     7,  7,  7,  7,  7, 27, 27, 61, 36, 36, 36, 64, 77, 79, 43,  2,
    36, 36, 82, 77, 43, 43, 43, 43, 77, 77, 79, 43, 43, 43, 77, 78,
    78, 79, 43, 43, 43, 43, 43, 43,  2,  2,  2, 80,  2,  2,  2,  2,
    43, 43, 43, 43, 43, 43, 43, 99, 43, 43, 81, 36, 36, 36, 36, 36,
-   36, 36, 77, 43, 43, 77, 77, 78, 78, 77, 81, 36, 36, 36, 36, 36,
+   36, 36, 77, 43, 43, 77, 77, 78, 78, 77, 81, 36, 36, 36, 36,  2,
    89, 61, 61, 61, 61, 47, 43, 43, 43, 43, 61, 61, 61, 61, 21,  2,
    43, 81, 36, 36, 36, 36, 36, 36, 82, 43, 43, 78, 43, 79, 43, 36,
    36, 36, 36, 77, 43, 78, 79, 79, 43, 78, 78, 78, 78, 78,  2,  2,
    36, 36, 78, 78, 78, 78, 43, 43, 43, 43, 78, 43, 43, 57,  2,  2,
     7,  7,  7,  7,  7,  7, 86, 36, 36, 36, 36, 36, 40, 40, 40,  2,
-   43, 57, 43, 43, 43, 43, 43, 43, 77, 43, 43, 43, 65, 36, 64, 36,
-   36, 36, 65, 82, 43, 36, 36, 36, 16, 16, 16, 16, 16, 16, 40, 40,
-   40, 40, 40, 40, 40, 44, 16, 16, 16, 16, 16, 16, 44, 16, 16, 16,
-   16, 16, 16, 16, 16,100, 40, 40, 32, 32, 32, 16, 16, 16, 16, 32,
-   16, 16, 16, 16, 11, 11, 11, 11, 16, 16, 16, 16, 34, 11, 11, 11,
-   16, 16, 16, 16,101,101,101,101, 16, 16, 16, 16, 11, 11,102,103,
-   41, 16, 16, 16, 11, 11,102, 41, 16, 16, 16, 16, 11, 11,104, 41,
-  105,105,105,105,105,106, 59, 59, 51, 51, 51,  2,107,108,107,108,
-    2,  2,  2,  2,109, 59, 59,110,  2,  2,  2,  2,111,112,  2,113,
-  114,  2,115,116,  2,  2,  2,  2,  2,  9,114,  2,  2,  2,  2,117,
-   59, 59, 59, 59, 59, 59, 59, 59,118, 40, 27, 27, 27,  8,115,119,
-   27, 27, 27, 27, 27,  8,115, 94, 20, 20, 20, 20, 20, 20, 20, 20,
-   43, 43, 43, 43, 43, 43,120, 48, 99, 48, 99, 43, 43, 43, 43, 43,
-   61,121, 61,122, 61, 34, 11, 16, 11, 32,122, 61, 46, 11, 11, 61,
-   61, 61,121,121,121, 11, 11,123, 11, 11, 35, 36, 39, 61, 16, 11,
-    8,  8, 46, 16, 16, 26, 61,124, 95, 95, 95, 95, 95, 95, 95, 95,
-   95,125,126, 95,127, 61, 61, 61,  8,  8,128, 61, 61,  8, 61, 61,
-  128, 26, 61,128, 61, 61, 61,128, 61, 61, 61, 61, 61, 61, 61,  8,
-   61,128,128, 61, 61, 61, 61, 61, 61, 61,  8,  8,  8,  8,  8,  8,
-    8,  8,  8,  8,  8,  8,  8,  8, 61, 61, 61, 61,  4,  4, 61, 61,
-    8, 61, 61, 61,129,130, 61, 61, 61, 61, 61, 61, 61, 61,128, 61,
-   61, 61, 61, 61, 61, 26,  8,  8,  8,  8, 61, 61, 61, 61, 61, 61,
-   61, 61, 61, 61, 61, 61,  8,  8,  8, 61, 61, 61, 61, 61, 61, 61,
-   27, 27, 27, 27, 27, 27, 61, 61, 61, 61, 61, 61, 61, 27, 27, 27,
-   61, 61, 61, 26, 61, 61, 61, 61, 26, 61, 61, 61, 61, 61, 61, 61,
-   61, 61, 61, 61,  8,  8,  8,  8, 61, 61, 61, 61, 61, 61, 61, 26,
-   61, 61, 61, 61,  4,  4,  4,  4,  4,  4,  4, 27, 27, 27, 27, 27,
-   27, 27, 61, 61, 61, 61, 61, 61,  8,  8,115,131,  8,  8,  8,  8,
-    8,  8,  8,  4,  4,  4,  4,  4,  8,115,132,132,132,132,132,132,
-  132,132,132,132,131,  8,  8,  8,  8,  8,  8,  8,  4,  4,  8,  8,
-    8,  8,  8,  8,  8,  8,  4,  8,  8,  8,128, 26,  8,  8,128, 61,
-   32, 11, 32, 34, 34, 34, 34, 11, 32, 32, 34, 16, 16, 16, 40, 11,
-   32, 32,124, 61, 61,122, 34,133, 43, 32, 16, 16, 50,  2, 90,  2,
-   36, 36, 36, 36, 36, 36, 36, 75,  2,  2,  2,  2,  2,  2,  2, 56,
-    2,107,107,  2,111,112,107,  2,  2,  2,  2,  6,  2, 98,107,  2,
-  107,  4,  4,  4,  4,  2,  2, 80,  2,  2,  2,  2,  2, 51,  2,  2,
-   98,134,  2,  2,  2,  2,  2,  2, 61,  2,135,132,132,132,136, 51,
-   51, 51, 51, 51, 51, 51, 51, 51,  1,  2,137,138,  4,  4,  4,  4,
-    4, 61,  4,  4,  4,  4,139, 94,140, 95, 95, 95, 95, 43, 43, 78,
-  141, 40, 40, 61, 95,142, 58, 61, 72, 36, 36, 36, 36, 36, 36, 36,
-   36, 36, 36, 36, 64,143,144, 63, 36, 36, 36, 36, 36, 58, 40, 63,
-   61, 27, 27, 61, 61, 61, 61, 61, 27, 27, 27, 27, 27, 61, 61, 61,
-   61, 61, 61, 61, 27, 27, 27, 27,145, 27, 27, 27, 27, 27, 27, 27,
-   36, 36, 75, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,146,  2,
-   32, 32, 32, 32, 32, 32, 32, 64, 48,147, 43, 43, 43, 43, 43, 80,
-   32, 32, 32, 32, 32, 32, 40, 43, 36, 36, 36, 95, 95, 95, 95, 95,
-   43,  2,  2,  2,  2,  2,  2,  2, 41, 41, 41,144, 40, 40, 40, 40,
-   41, 32, 32, 32, 32, 32, 32, 32, 16, 32, 32, 32, 32, 32, 32, 32,
-   44, 16, 16, 16, 34, 34, 34, 32, 32, 32, 32, 32, 42,148, 34, 35,
-   32, 32, 16, 32, 32, 32, 32, 32, 32, 32, 32, 32, 32, 11, 11, 32,
-   11, 11, 32, 32, 32, 32, 32, 32, 32, 32, 11, 11, 34, 16, 16, 16,
-   32, 16, 16, 32, 32, 16, 16, 16, 16, 40,149, 35, 40, 35, 36, 36,
-   36, 65, 36, 65, 36, 64, 36, 36, 36, 82, 79, 77, 61, 61, 43, 43,
-   27, 27, 27, 61,150, 61, 61, 61, 36, 36,  2,  2,  2,  2,  2,  2,
-   78, 36, 36, 36, 36, 36, 36, 36, 36, 36, 78, 78, 78, 78, 78, 78,
-   78, 78, 43, 43, 43, 43, 43,  2, 43, 36, 36, 36,  2, 66, 66, 64,
-   36, 36, 36, 43, 43, 43, 43,  2, 36, 36, 36, 64, 43, 43, 43, 43,
-   43, 78, 78, 78, 78, 78, 78, 97, 36, 64, 78, 43, 43, 78, 43, 78,
-   97,  2,  2,  2,  2,  2,  2, 80,  7,  7,  7,  7,  7,  7,  7,  2,
-   36, 36, 64, 63, 36, 36, 36, 36, 36, 36, 36, 36, 64, 43, 43, 77,
-   79, 77, 79, 43, 43, 43, 43, 43, 36, 64, 36, 36, 36, 36, 77, 78,
-    7,  7,  7,  7,  7,  7,  2,  2, 63, 36, 36, 71, 61, 82, 77, 36,
-   65, 43, 65, 64, 65, 36, 36, 43, 36, 36, 36, 36, 36, 36, 75,  2,
-   36, 36, 36, 36, 36, 82, 43, 78,  2, 75,151, 43, 43, 43, 43, 43,
-   16, 16, 16, 16, 16,103, 40, 40, 16, 16, 16, 16,100, 41, 41, 41,
-   36, 82, 79, 78, 77, 97, 79, 43,152,152,152,152,152,152,152,152,
-  153,153,153,153,153,153,153,153, 16, 16, 16, 16, 16, 16, 35, 65,
-   36, 36, 36, 36,154, 36, 36, 36, 36, 41, 41, 41, 41, 41, 41, 41,
-   41, 74, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36,132,
-   36, 36, 36, 36, 36, 36, 36, 71, 36, 36, 36, 36, 36, 36,150, 61,
-    2,  2,  2,135,116,  2,  2,  2,  6,155,156,132,132,132,132,132,
-  132,132,116,135,116,  2,113,157,  2,  2,  2,  2,139,132,132,116,
-    2,158,  8,  8, 60,  2,  2,  2, 36, 36, 36, 36, 36, 36, 36,159,
-    2,  2,  3,  2,  4,  5,  6,  2, 16, 16, 16, 16, 16, 17, 18,115,
-  116,  4,  2, 36, 36, 36, 36, 36, 63, 36, 36, 36, 36, 36, 36, 36,
-   36, 36, 36, 36, 36, 36, 36, 40, 20,160, 53, 20, 26,  8,128, 61,
-   61, 61, 61, 61,161, 59, 61, 61,  2,  2,  2, 90, 27, 27, 27, 27,
-   27, 27, 27, 84, 61, 61, 61, 61, 95, 95,127, 27, 84, 61, 61, 61,
-   61, 61, 61, 61, 61, 27, 61, 61, 61, 61, 61, 61, 61, 61, 47, 43,
-  162,162,162,162,162,162,162,162,163, 27, 27, 27, 27, 27, 27, 27,
-   27, 27, 27, 27, 27, 27, 87, 36,138, 36, 36, 36, 36, 95, 95, 95,
-   36, 36, 36, 36, 36, 36, 36, 58,164, 95, 95, 95, 95, 95, 95, 95,
-   11, 11, 11, 32, 16, 16, 16, 16, 36, 36, 36, 58, 27, 27, 27, 27,
-   36, 36, 36, 71,145, 27, 27, 27, 36, 36, 36,165, 27, 27, 27, 27,
-   36, 36, 36, 36, 36,165, 27, 27, 36, 36, 36, 27, 27, 27, 27, 30,
-   36, 36, 36, 36, 36, 36, 27, 36, 64, 43, 43, 43, 43, 43, 43, 43,
-   36, 36, 36, 36, 43, 43, 43, 43, 36, 36, 36, 36, 36, 36,165, 30,
-   36, 36, 36, 36, 36, 36,165, 27, 36, 36, 36, 36, 72, 36, 36, 36,
-   36, 36, 64, 43, 43,163, 27, 27, 36, 36, 36, 36, 58,  2,  2,  2,
-   36, 36, 36, 36, 27, 27, 27, 27, 16, 16, 16, 16, 16, 27, 27, 27,
-   36, 36, 43, 43, 43, 43, 43, 43, 36, 36, 36, 36, 36, 64,166, 51,
-   27, 27, 27, 87, 36, 36, 36, 36,163, 27, 30,  2,  2,  2,  2,  2,
-   36, 43, 43,  2,  2,  2,  2,  2, 36, 36,165, 27, 27, 27, 27, 27,
-   79, 81, 36, 36, 36, 36, 36, 36, 43, 43, 43, 57,  2,  2,  2,  2,
-    2, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27,  7,  7,  7,  7,  7,
-   65, 64, 65, 36, 36, 36, 36, 64, 78, 79, 43, 77, 79, 57, 73,  2,
-    2, 43, 43, 43, 43, 43, 67, 59, 36, 36, 36, 64, 43, 43, 79, 43,
-   43, 43, 43,  7,  7,  7,  7,  7,  2,  2, 82, 81, 36, 36, 36, 36,
-   36, 64,  2, 36, 36, 36, 36, 36, 36, 82, 78, 43, 43, 43, 43, 77,
-   81, 36, 58,  2, 56, 43, 57, 79,  7,  7,  7,  7,  7, 58, 58,  2,
-   90, 27, 27, 27, 27, 27, 27, 27, 36, 36, 36, 36, 36, 36, 78, 79,
-   43, 78, 77, 43,  2,  2,  2, 65, 36, 36, 36, 36, 36, 36, 36, 64,
-   77, 78, 78, 78, 78, 78, 78, 78, 36, 36, 36, 82, 78, 78, 81, 36,
-   36, 78, 78, 43, 43, 43, 43, 43, 36, 36, 82, 78, 43, 43, 43, 43,
-   78, 43, 77, 65, 36, 58,  2,  2,  7,  7,  7,  7,  7,  2,  2, 65,
-   78, 79, 43, 43, 77, 77, 78, 79, 77, 43, 36, 66, 36, 36, 36, 36,
-   36, 36, 36, 36, 36, 36, 36, 82, 78, 43, 43, 43, 78, 78, 43, 79,
-   57,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2,  2, 36, 36, 43, 43,
-   78, 79, 43, 43, 43, 77, 79, 79, 57,  2, 36, 36, 36, 36, 36, 36,
-   36, 36, 36, 36, 36, 64, 79, 78, 43, 43, 43, 79, 58,  2,  2,  2,
+   16, 16, 16, 16, 34, 16, 16, 16, 43, 57, 43, 43, 43, 43, 43, 43,
+   77, 43, 43, 43, 65, 36, 64, 36, 36, 36, 65, 82, 43, 36, 36, 36,
+   16, 16, 16, 16, 16, 16, 40, 40, 40, 40, 40, 40, 40, 44, 16, 16,
+   16, 16, 16, 16, 44, 16, 16, 16, 16, 16, 16, 16, 16,100, 40, 40,
+   32, 32, 32, 16, 16, 16, 16, 32, 16, 16, 16, 16, 11, 11, 11, 11,
+   16, 16, 16, 16, 34, 11, 11, 11, 16, 16, 16, 16,101,101,101,101,
+   16, 16, 16, 16, 11, 11,102,103, 41, 16, 16, 16, 11, 11,102, 41,
+   16, 16, 16, 16, 11, 11,104, 41,105,105,105,105,105,106, 59, 59,
+   51, 51, 51,  2,107,108,107,108,  2,  2,  2,  2,109, 59, 59,110,
+    2,  2,  2,  2,111,112,  2,113,114,  2,115,116,  2,  2,  2,  2,
+    2,  9,114,  2,  2,  2,  2,117, 59, 59, 59, 59, 59, 59, 59, 59,
+  118, 40, 27, 27, 27,  8,115,119, 27, 27, 27, 27, 27,  8,115, 94,
+   20, 20, 20, 20, 20, 20, 20, 20, 43, 43, 43, 43, 43, 43,120, 48,
+   99, 48, 99, 43, 43, 43, 43, 43, 61,121, 61,122, 61, 34, 11, 16,
+   11, 32,122, 61, 46, 11, 11, 61, 61, 61,121,121,121, 11, 11,123,
+   11, 11, 35, 36, 39, 61, 16, 11,  8,  8, 46, 16, 16, 26, 61,124,
+   95, 95, 95, 95, 95, 95, 95, 95, 95,125,126, 95,127, 61, 61, 61,
+    8,  8,128, 61, 61,  8, 61, 61,128, 26, 61,128, 61, 61, 61,128,
+   61, 61, 61, 61, 61, 61, 61,  8, 61,128,128, 61, 61, 61, 61, 61,
+   61, 61,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,  8,
+   61, 61, 61, 61,  4,  4, 61, 61,  8, 61, 61, 61,129,130, 61, 61,
+   61, 61, 61, 61, 61, 61,128, 61, 61, 61, 61, 61, 61, 26,  8,  8,
+    8,  8, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61,  8,  8,
+    8, 61, 61, 61, 61, 61, 61, 61, 27, 27, 27, 27, 27, 27, 61, 61,
+   61, 61, 61, 61, 61, 27, 27, 27, 61, 61, 61, 26, 61, 61, 61, 61,
+   26, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61,  8,  8,  8,  8,
+   61, 61, 61, 61, 61, 61, 61, 26, 61, 61, 61, 61,  4,  4,  4,  4,
+    4,  4,  4, 27, 27, 27, 27, 27, 27, 27, 61, 61, 61, 61, 61, 61,
+    8,  8,115,131,  8,  8,  8,  8,  8,  8,  8,  4,  4,  4,  4,  4,
+    8,115,132,132,132,132,132,132,132,132,132,132,131,  8,  8,  8,
+    8,  8,  8,  8,  4,  4,  8,  8,  8,  8,  8,  8,  8,  8,  4,  8,
+    8,  8,128, 26,  8,  8,128, 61, 32, 11, 32, 34, 34, 34, 34, 11,
+   32, 32, 34, 16, 16, 16, 40, 11, 32, 32,124, 61, 61,122, 34,133,
+   43, 32, 16, 16, 50,  2, 90,  2, 36, 36, 36, 36, 36, 36, 36, 76,
+    2,  2,  2,  2,  2,  2,  2, 56,  2,107,107,  2,111,112,107,  2,
+    2,  2,  2,  6,  2, 98,107,  2,107,  4,  4,  4,  4,  2,  2, 80,
+    2,  2,  2,  2,  2, 51,  2,  2, 98,134,  2,  2,  2,  2,  2,  2,
+   61,  2,135,132,132,132,136, 51, 51, 51, 51, 51, 51, 51, 51, 51,
+    1,  2,137,138,  4,  4,  4,  4,  4, 61,  4,  4,  4,  4,139, 94,
+  140, 95, 95, 95, 95, 43, 43, 78,141, 40, 40, 61, 95,142, 58, 61,
+   72, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 64,143,144, 63,
+   36, 36, 36, 36, 36, 58, 40, 63, 61, 27, 27, 61, 61, 61, 61, 61,
+   27, 27, 27, 27, 27, 61, 61, 61, 61, 61, 61, 61, 27, 27, 27, 27,
+  145, 27, 27, 27, 27, 27, 27, 27, 36, 36, 76, 36, 36, 36, 36, 36,
+   36, 36, 36, 36, 36, 36,146,  2, 32, 32, 32, 32, 32, 32, 32, 64,
+   48,147, 43, 43, 43, 43, 43, 80, 32, 32, 32, 32, 32, 32, 40, 43,
+   36, 36, 36, 95, 95, 95, 95, 95, 43,  2,  2,  2,  2,  2,  2,  2,
+   41, 41, 41,144, 40, 40, 40, 40, 41, 32, 32, 32, 32, 32, 32, 32,
+   16, 32, 32, 32, 32, 32, 32, 32, 44, 16, 16, 16, 34, 34, 34, 32,
+   32, 32, 32, 32, 42,148, 34, 35, 32, 32, 16, 32, 32, 32, 32, 32,
+   32, 32, 32, 32, 32, 11, 11, 32, 11, 11, 32, 32, 32, 32, 32, 32,
+   32, 32, 11, 11, 34, 34, 32, 16, 32, 16, 16, 32, 32, 32, 11, 11,
+   11, 40,149, 35, 40, 35, 36, 36, 36, 65, 36, 65, 36, 64, 36, 36,
+   36, 82, 79, 77, 61, 61, 43, 43, 27, 27, 27, 61,150, 61, 61, 61,
+   36, 36,  2,  2,  2,  2,  2,  2, 78, 36, 36, 36, 36, 36, 36, 36,
+   36, 36, 78, 78, 78, 78, 78, 78, 78, 78, 43, 43, 43, 43, 43,  2,
+   43, 36, 36, 36,  2, 66, 66, 64, 36, 36, 36, 43, 43, 43, 43,  2,
+   36, 36, 36, 64, 43, 43, 43, 43, 43, 78, 78, 78, 78, 78, 78, 97,
+   36, 64, 78, 43, 43, 78, 43, 78, 97,  2,  2,  2,  2,  2,  2, 80,
+    7,  7,  7,  7,  7,  7,  7,  2, 36, 36, 64, 63, 36, 36, 36, 36,
+   36, 36, 36, 36, 64, 43, 43, 77, 79, 77, 79, 43, 43, 43, 43, 43,
+   36, 64, 36, 36, 36, 36, 77, 78,  7,  7,  7,  7,  7,  7,  2,  2,
+   63, 36, 36, 71, 61, 82, 77, 36, 65, 43, 65, 64, 65, 36, 36, 43,
+   36, 36, 36, 36, 36, 36, 76,  2, 36, 36, 36, 36, 36, 82, 43, 78,
+    2, 76,151, 43, 43, 43, 43, 43, 16, 16, 16, 16, 16,103, 40, 40,
+   16, 16, 16, 16,100, 41, 41, 41, 36, 82, 79, 78, 77, 97, 79, 43,
+  152,152,152,152,152,152,152,152,153,153,153,153,153,153,153,153,
+   16, 16, 16, 16, 16, 16, 35, 65, 36, 36, 36, 36,154, 36, 36, 36,
+   36, 41, 41, 41, 41, 41, 41, 41, 41, 74, 36, 36, 36, 36, 36, 36,
+   36, 36, 36, 36, 36, 36, 36,132, 36, 36, 36, 36, 36, 36, 36, 71,
+   36, 36, 36, 36, 36, 36,150, 61,  2,  2,  2,135,116,  2,  2,  2,
+    6,155,156,132,132,132,132,132,132,132,116,135,116,  2,113,157,
+    2,  2,  2,  2,139,132,132,116,  2,158,  8,  8, 60,  2,  2,  2,
+   36, 36, 36, 36, 36, 36, 36,159,  2,  2,  3,  2,  4,  5,  6,  2,
+   16, 16, 16, 16, 16, 17, 18,115,116,  4,  2, 36, 36, 36, 36, 36,
+   63, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 40,
+   20,160, 53, 20, 26,  8,128, 61, 61, 61, 61, 61,161, 59, 61, 61,
+    2,  2,  2, 90, 27, 27, 27, 27, 27, 27, 27, 84, 61, 61, 61, 61,
+   95, 95,127, 27, 84, 61, 61, 61, 61, 61, 61, 61, 61, 27, 61, 61,
+   61, 61, 61, 61, 61, 61, 47, 43,162,162,162,162,162,162,162,162,
+  163, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 27, 87, 36,
+  138, 36, 36, 36, 36, 95, 95, 95, 36, 36, 36, 36, 36, 36, 36, 58,
+  164, 95, 95, 95, 95, 95, 95, 95, 11, 11, 11, 32, 16, 16, 16, 16,
+   36, 36, 36, 58, 27, 27, 27, 27, 36, 36, 36, 71,145, 27, 27, 27,
+   36, 36, 36,165, 27, 27, 27, 27, 36, 36, 36, 36, 36,165, 27, 27,
+   36, 36, 36, 27, 27, 27, 27, 30, 36, 36, 36, 36, 36, 36, 27, 36,
+   64, 43, 43, 43, 43, 43, 43, 43, 36, 36, 36, 36, 43, 43, 43, 43,
+   36, 36, 36, 36, 36, 36,165, 30, 36, 36, 36, 36, 36, 36,165, 27,
+   36, 36, 36, 36, 72, 36, 36, 36, 36, 36, 64, 43, 43,163, 27, 27,
+   36, 36, 36, 36, 58,  2,  2,  2, 36, 36, 36, 36, 27, 27, 27, 27,
+   16, 16, 16, 16, 16, 27, 27, 27, 36, 36, 43, 43, 43, 43, 43, 43,
+    7,  7,  7,  7,  7, 36, 36, 63, 11, 11, 11, 11,166, 43, 43,141,
+   16, 16, 16, 16, 16, 16, 16,  8, 36, 36, 36, 36, 36, 64,167, 51,
+   36, 36, 36, 36, 36, 36, 43, 43, 27, 27, 27, 87, 36, 36, 36, 36,
+  163, 27, 30,  2,  2,  2,  2,  2, 36, 43, 43,  2,  2,  2,  2,  2,
+   36, 36,165, 27, 27, 27, 27, 27, 79, 81, 36, 36, 36, 36, 36, 36,
+   43, 43, 43, 57,  2,  2,  2,  2,  2, 27, 27, 27, 27, 27, 27, 27,
+   27, 27, 27,  7,  7,  7,  7,  7, 65, 64, 65, 36, 36, 36, 36, 64,
+   78, 79, 43, 77, 79, 57, 73,  2,  2, 43, 43, 43, 43, 43, 67, 59,
+   36, 36, 36, 64, 43, 43, 79, 43, 43, 43, 43,  7,  7,  7,  7,  7,
+    2,  2, 82, 81, 36, 36, 36, 36, 36, 64,  2, 36, 36, 36, 36, 36,
+   36, 82, 78, 43, 43, 43, 43, 77, 81, 36, 58,  2, 56, 43, 57, 79,
+    7,  7,  7,  7,  7, 58, 58,  2, 90, 27, 27, 27, 27, 27, 27, 27,
+   36, 36, 36, 36, 36, 36, 78, 79, 43, 78, 77, 43,  2,  2,  2, 65,
+   36, 36, 36, 36, 36, 36, 36, 64, 77, 78, 78, 78, 78, 78, 78, 78,
+   36, 36, 36, 82, 78, 78, 81, 36, 36, 78, 78, 43, 43, 43, 43, 43,
+   36, 36, 36, 36, 78, 79, 43, 43, 43, 78, 78, 78, 78, 78, 78, 77,
+   65, 65,  2,  2,  2,  2,  2,  2, 56, 43, 43, 43, 43, 43, 43, 43,
+   36, 36, 82, 78, 43, 43, 43, 43, 78, 43, 77, 65, 36, 58,  2,  2,
+    7,  7,  7,  7,  7,  2,  2, 65, 78, 79, 43, 43, 77, 77, 78, 79,
+   77, 43, 36, 66, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 82,
+   78, 43, 43, 43, 78, 78, 43, 79, 57,  2,  2,  2,  2,  2,  2,  2,
+    2,  2,  2,  2, 36, 36, 43, 43, 78, 79, 43, 43, 43, 77, 79, 79,
+   57,  2, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 36, 64, 79, 78,
+   43, 43, 43, 79, 58,  2,  2,  2, 36, 36, 36, 36, 36, 36, 64, 79,
    78, 43, 43, 79, 43, 43, 43, 43,  7,  7,  7,  7,  7, 27,  2, 89,
    43, 43, 43, 43, 79, 57,  2,  2, 27, 27, 27, 27, 27, 27, 27, 87,
    78, 78, 78, 78, 78, 79, 77, 65, 81, 79,  2,  2,  2,  2,  2,  2,
@@ -4721,39 +4938,41 @@ _hb_ucd_u8[13386] =
    78, 78, 78, 78, 78, 78, 78, 78, 64, 43, 43, 43, 43, 65, 36, 36,
    36, 64, 43, 43, 77, 64, 43, 57,  2,  2,  2, 56, 43, 43, 43, 43,
    64, 43, 43, 77, 79, 43, 36, 36, 36, 36, 36, 36, 36, 43, 43, 43,
-   43, 43, 43, 77, 43,  2, 66,  2, 43, 43, 43, 43, 43, 43, 43, 79,
-   58,  2,  2,  2,  2,  2,  2,  2,  2, 36, 36, 36, 36, 36, 36, 36,
+   43, 43, 43, 77, 43,  2, 66,  2, 58,  2,  2,  2,  2,  2,  2,  2,
+   43, 43, 43, 43, 43, 43, 43, 79,  2, 36, 36, 36, 36, 36, 36, 36,
    43, 43, 43, 43, 77, 43, 43, 43, 77, 43, 79, 43, 43, 43, 43, 43,
    43, 43, 43, 64, 43, 43, 43, 43, 36, 36, 36, 36, 36, 78, 78, 78,
    43, 77, 79, 79, 36, 36, 36, 36, 36, 64, 77, 97,  2,  2,  2,  2,
    43, 82, 36, 36, 36, 36, 36, 36, 36, 36, 78, 43, 43, 43, 43, 78,
-   77, 57,  2,  2,  2,  2,  2,  2, 27, 27, 84, 61, 61, 61, 53, 20,
-  150, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 61, 21,
-   65, 36, 36, 64, 43, 43, 43, 43, 43, 43, 57,  2,  2,  2,  2,  2,
-   43, 43, 43, 57,  2,  2, 61, 61, 40, 40, 89, 61, 61, 61, 61, 61,
-    7,  7,  7,  7,  7,167, 27, 27, 27, 87, 36, 36, 36, 36, 36, 36,
-   27, 27, 27, 30,  2,  2,  2,  2, 82, 78, 78, 78, 78, 78, 78, 78,
-   78, 78, 78, 78, 78, 78, 78, 79, 43, 68, 40, 40, 40, 40, 40, 40,
-   40, 80, 43, 43, 43, 43, 43, 43, 36, 36, 36, 36, 36, 36, 47, 57,
-   61, 61,168, 79, 43, 61,168, 78, 78,169, 59, 59, 59, 76, 43, 43,
-   43, 70, 47, 43, 43, 43, 61, 61, 61, 61, 61, 61, 61, 43, 43, 61,
-   61, 43, 70, 61, 61, 61, 61, 61, 11, 11, 11, 11, 11, 16, 16, 16,
-   16, 16, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 16,
-   11, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 11, 11,
-   11, 11, 11, 16, 16, 16, 16, 16, 31, 16, 16, 16, 16, 16, 16, 16,
-   16, 16, 16, 16, 16, 33, 16, 16, 16, 11, 11, 11, 11, 11, 11, 11,
-   11, 11, 11, 11, 11, 31, 16, 16, 16, 16, 33, 16, 16, 16, 11, 11,
-   11, 11, 31, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 33,
-   16, 16, 16, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 31,
-   16, 16, 16, 16, 33, 16, 16, 16, 11, 11, 11, 11, 31, 16, 16, 16,
-   16, 33, 16, 16, 16, 32, 16,  7, 43, 43, 43, 70, 61, 47, 43, 43,
-   43, 43, 43, 43, 43, 43, 70, 61, 61, 61, 47, 61, 61, 61, 61, 61,
-   61, 61, 70, 21,  2,  2,  2,  2,  2,  2,  2,  2,  2, 56, 43, 43,
-   16, 16, 16, 16, 16, 39, 16, 16, 43, 43, 43, 68, 40, 40, 40, 40,
-    7,  7,  7,  7,  7,  7,  7, 71, 36, 36, 36, 36, 36, 36, 36, 43,
-   36, 36, 36, 36, 36, 36, 43, 43,  7,  7,  7,  7,  7,  7,  7,170,
-   36, 36, 36, 36, 36, 75, 43, 43, 16, 16, 43, 43, 43, 68, 40, 40,
-   27, 27, 27, 27, 27, 27,145, 27,171, 27, 27, 27, 27, 27, 27, 27,
+   77, 57,  2,  2,  2,  2,  2,  2,  7,  7,  7,  7,  7, 43, 43, 43,
+   27, 27, 84, 61, 61, 61, 53, 20,150, 61, 61, 61, 61, 61, 61, 61,
+   61, 61, 61, 61, 61, 61, 61, 21, 65, 36, 36, 64, 43, 43, 43, 43,
+   36, 36, 36, 36, 36, 36, 36, 43, 43, 43, 43, 43, 43, 78, 79, 43,
+   43, 43, 57,  2,  2,  2,  2,  2, 43, 43, 43, 57,  2,  2, 61, 61,
+   40, 40, 89, 61, 61, 61, 61, 61,  7,  7,  7,  7,  7,168, 27, 27,
+   27, 87, 36, 36, 36, 36, 36, 36, 40, 63, 36, 36, 36, 36, 36, 36,
+   36, 36, 36, 36, 36, 76,146,  2, 27, 27, 27, 30,  2,  2,  2,  2,
+   82, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 78, 79,
+   43, 68, 40, 40, 40, 40, 40, 40, 40, 80, 43, 43, 43, 43, 43, 43,
+   36, 36, 36, 36, 36, 36, 47, 57, 61, 61,169, 79, 43, 61,169, 78,
+   78,170, 59, 59, 59, 75, 43, 43, 43, 70, 47, 43, 43, 43, 61, 61,
+   61, 61, 61, 61, 61, 43, 43, 61, 61, 43, 70, 61, 61, 61, 61, 61,
+   11, 11, 11, 11, 11, 16, 16, 16, 16, 16, 11, 11, 11, 11, 11, 11,
+   11, 11, 11, 11, 11, 11, 11, 16, 11, 16, 16, 16, 16, 16, 16, 16,
+   16, 16, 16, 16, 16, 16, 11, 11, 11, 11, 11, 16, 16, 16, 16, 16,
+   31, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 33, 16, 16,
+   16, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 11, 31, 16, 16,
+   16, 16, 33, 16, 16, 16, 11, 11, 11, 11, 31, 16, 16, 16, 16, 16,
+   16, 16, 16, 16, 16, 16, 16, 33, 16, 16, 16, 11, 11, 11, 11, 11,
+   11, 11, 11, 11, 11, 11, 11, 31, 16, 16, 16, 16, 33, 16, 16, 16,
+   11, 11, 11, 11, 31, 16, 16, 16, 16, 33, 16, 16, 16, 32, 16,  7,
+   43, 43, 43, 70, 61, 47, 43, 43, 43, 43, 43, 43, 43, 43, 70, 61,
+   61, 61, 47, 61, 61, 61, 61, 61, 61, 61, 70, 21,  2,  2,  2,  2,
+    2,  2,  2,  2,  2, 56, 43, 43, 16, 16, 16, 16, 16, 39, 16, 16,
+   43, 43, 43, 68, 40, 40, 40, 40,  7,  7,  7,  7,  7,  7,  7, 71,
+    7,  7,  7,  7,  7,  7,  7,171, 36, 36, 36, 36, 36, 76, 43, 43,
+  172,  7,  7,  7,  7,  7,  7, 85, 16, 16, 43, 43, 43, 68, 40, 40,
+   27, 27, 27, 27, 27, 27,145, 27,173, 27, 27, 27, 27, 27, 27, 27,
    27, 27, 27, 27, 27, 27, 27,145, 27, 27, 27, 27, 27, 27, 84, 61,
    61, 61, 61, 61, 61, 25, 41, 41,  0,  0, 29, 21, 21, 21, 23, 21,
    22, 18, 21, 25, 21, 17, 13, 13, 25, 25, 25, 21, 21,  9,  9,  9,
@@ -4764,8 +4983,8 @@ _hb_ucd_u8[13386] =
     6,  5,  9, 21, 25,  9, 26, 12, 11, 11,  9,  6,  5, 21, 17, 17,
    17, 26, 26, 23, 23, 12, 17, 12, 21, 12, 12, 21,  7, 21,  1,  1,
    21, 23, 26, 26,  1, 21,  6,  7,  7, 12, 12,  7, 21,  7, 12,  1,
-   12,  6,  6, 12, 12, 26,  7, 26, 26,  7, 21,  1, 24,  7,  7,  6,
-    1, 12, 12, 10, 10, 10, 10, 12, 21,  6, 10,  7,  7, 10, 23,  7,
+   12,  6,  6, 12, 12, 26,  7, 26, 26,  7, 21,  1, 24,  7,  1, 12,
+    7,  6, 12, 10, 10, 10, 10, 12, 21,  6, 10,  7,  7, 10, 23,  7,
    15, 26, 13, 21, 13,  7, 15,  7, 12, 23, 21, 26, 21, 15, 17,  7,
    29,  7,  7, 22, 18, 18, 14, 14, 14,  7, 10, 21, 17, 21, 11, 12,
     5,  6,  8,  8,  8, 24,  5, 24,  9, 24, 29, 29, 29,  1, 20, 19,
@@ -4776,247 +4995,250 @@ _hb_ucd_u8[13386] =
    26, 14, 17,  6, 14,  6, 12, 24, 24,  6, 26, 15,  6, 21, 11, 21,
    24,  9,  6,  9, 23, 26,  6, 10,  4,  4,  3,  3,  7, 25, 17, 16,
    16, 22, 16, 16, 25, 17,  7,  1, 25, 24, 26,  1,  2,  2, 12, 15,
-   21, 14,  7, 15, 12, 17, 13, 15, 26, 10, 10,  1, 13, 23, 23, 15,
-    0,  1,  2,  3,  4,  5,  6,  7,  8,  9,  0, 10, 11, 12, 13,  0,
-   14,  0,  0,  0,  0,  0, 15,  0, 16,  0,  0,  0,  0,  0,  0,  0,
+   21, 14,  7, 15,  9, 12, 12, 17, 13, 15, 26, 10, 10,  1, 13, 23,
+    7, 13, 23, 15,  0,  1,  2,  3,  4,  5,  6,  7,  8,  9,  0, 10,
+   11, 12, 13,  0, 14,  0,  0,  0,  0,  0, 15,  0, 16,  0,  0,  0,
+    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+    0,  0,  0,  0,  0,  0,  0, 17, 18, 19,  0,  0,  0,  0,  0,  0,
     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-    0,  0,  0, 17, 18, 19,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 20,  0, 21,
-   22, 23,  0,  0,  0, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
+    0, 20,  0, 21, 22, 23,  0,  0,  0, 24, 25, 26, 27, 28, 29, 30,
+   31, 32, 33, 34,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+    0,  0,  0,  0, 35,  0,  0,  0,  0, 36,  0, 37,  0,  0,  0,  0,
     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-    0,  0,  0,  0,  0, 35,  0, 36,  0,  0,  0,  0,  0,  0,  0,  0,
     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 37,  0,
-    0,  0,  0,  0,  0,  0,  0,  0, 38, 39,  0,  0,  0,  0,  0,  0,
-   40, 41, 42,  0, 43,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-    0,  0,  1,  2,  0,  0,  0,  0,  3,  0,  0,  0,  4,  5,  6,  7,
-    0,  8,  9, 10,  0, 11, 12, 13, 14, 15, 16, 17, 16, 18, 16, 19,
-   16, 19, 16, 19,  0, 19, 16, 20, 16, 19, 21, 19,  0, 22, 23, 24,
-   25, 26, 27, 28, 29, 30, 31,  0, 32,  0,  0,  0,  0,  0,  0,  0,
-    0,  0,  0, 33,  0,  0,  0,  0,  0,  0, 34,  0,  0, 35,  0,  0,
-   36,  0, 37,  0,  0,  0, 38, 39, 40, 41, 42, 43, 44, 45, 46,  0,
-    0, 47,  0,  0,  0, 48,  0,  0,  0, 49,  0,  0,  0,  0,  0,  0,
-    0, 50,  0, 51,  0, 52, 53,  0, 54,  0,  0,  0,  0,  0,  0, 55,
-   56, 57,  0,  0,  0,  0, 58,  0,  0, 59, 60, 61, 62, 63,  0,  0,
-   64, 65,  0,  0,  0, 66,  0,  0,  0,  0, 67,  0,  0,  0, 68,  0,
-    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 69,  0,  0,
-    0, 70,  0, 71,  0,  0, 72,  0,  0, 73,  0,  0,  0,  0,  0,  0,
-    0,  0, 74,  0,  0,  0,  0,  0, 75, 76,  0, 77, 78,  0,  0, 79,
-   80,  0, 81, 62,  0, 82, 83,  0,  0, 84, 85, 86,  0,  0,  0, 87,
-    0, 88,  0,  0, 51, 89, 51,  0, 90,  0, 91,  0,  0,  0, 80,  0,
-    0,  0, 92, 93,  0, 94, 95, 96, 97,  0,  0,  0,  0,  0, 51,  0,
-    0,  0,  0, 98, 99,  0,  0,  0,  0,  0,  0,100,  0,  0,  0,  0,
-    0,101,102,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,103,  0,  0,
-  104,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,105,106,  0,  0,107,
-    0,  0,  0,  0,  0,  0,108,  0,109,  0,102,  0,  0,  0,  0,  0,
-  110,111,  0,  0,  0,  0,  0,  0,  0,112,  0,  0,  0,  0,  0,  0,
-    0,113,  0,114,  0,  0,  0,  0,  0,  0,  1,  2,  3,  4,  5,  6,
-    7,  0,  8,  0,  0,  0,  0,  9, 10, 11, 12,  0,  0,  0,  0, 13,
-    0,  0, 14, 15,  0, 16,  0, 17, 18,  0,  0, 19,  0, 20, 21,  0,
-    0,  0,  0,  0, 22, 23,  0, 24, 25,  0,  0, 26,  0,  0,  0, 27,
-    0,  0, 28, 29, 30, 31,  0,  0,  0, 32, 33, 34,  0,  0, 33,  0,
-    0, 35, 33,  0,  0,  0, 33, 36,  0,  0,  0,  0,  0, 37, 38,  0,
-    0,  0,  0,  0,  0, 39, 40,  0,  0,  0,  0,  0,  0, 41, 42,  0,
-    0,  0,  0, 43,  0, 44,  0,  0,  0, 45, 46,  0,  0,  0, 47,  0,
-    0,  0,  0,  0,  0, 48, 49,  0,  0,  0,  0, 50,  0,  0,  0, 51,
-    0, 52,  0, 53,  0,  0,  0,  0, 54,  0,  0,  0,  0, 55,  0, 56,
-    0,  0,  0,  0, 57, 58,  0,  0,  0, 59, 60,  0,  0,  0,  0,  0,
-    0, 61, 52,  0, 62, 63,  0,  0, 64,  0,  0,  0, 65, 66,  0,  0,
-    0, 67,  0, 68, 69, 70, 71, 72,  1, 73,  0, 74, 75, 76,  0,  0,
-   77, 78,  0,  0,  0, 79,  0,  0,  1,  1,  0,  0, 80,  0,  0, 81,
-    0,  0,  0,  0, 77, 82,  0, 83,  0,  0,  0,  0,  0, 78, 84,  0,
-   85,  0, 52,  0,  1, 78,  0,  0, 86,  0,  0, 87,  0,  0,  0,  0,
-    0, 88, 57,  0,  0,  0,  0,  0,  0, 89, 90,  0,  0, 84,  0,  0,
-   33,  0,  0, 91,  0,  0,  0,  0, 92,  0,  0,  0,  0, 49,  0,  0,
-   93,  0,  0,  0,  0, 94, 95,  0,  0, 96,  0,  0, 97,  0,  0,  0,
-   98,  0,  0,  0, 99,  0,  0,  0,  0,100,101, 93,  0,  0,102,  0,
-    0,  0, 84,  0,  0,103,  0,  0,  0,104,105,  0,  0,106,107,  0,
-    0,  0,  0,  0,  0,108,  0,  0,109,  0,  0,  0,  0,110, 33,  0,
-  111,112,113, 35,  0,  0,114,  0,  0,  0,115,  0,  0,  0,  0,  0,
-    0,116,  0,  0,117,  0,  0,  0,  0,118, 88,  0,  0,  0,  0,  0,
-   57,  0,  0,  0,  0, 52,119,  0,  0,  0,  0,120,  0,  0,121,  0,
-    0,  0,  0,119,  0,  0,122,  0,  0,  0,  0,  0,  0,123,  0,  0,
-    0,124,  0,  0,  0,125,  0,126,  0,  0,  0,  0,127,128,129,  0,
-  130,  0,131,  0,  0,  0,132,133,134,  0, 77,  0,  0,  0,  0,  0,
-   35,  0,  0,  0,135,  0,  0,  0,136,  0,  0,137,  0,  0,138,  0,
-    0,  0,  0,  0,  0,  0,  1,  1,  1,  1,  1,  2,  3,  4,  5,  6,
-    7,  4,  4,  8,  9, 10,  1, 11, 12, 13, 14, 15, 16, 17, 18,  1,
-    1,  1, 19,  1,  0,  0, 20, 21, 22,  1, 23,  4, 21, 24, 25, 26,
-   27, 28, 29, 30,  0,  0,  1,  1, 31,  0,  0,  0, 32, 33, 34, 35,
-    1, 36, 37,  0,  0,  0,  0, 38,  1, 39, 14, 39, 40, 41, 42,  0,
-    0,  0, 43, 36, 44, 45, 21, 45, 46,  0,  0,  0, 19,  1, 21,  0,
-    0, 47,  0, 38, 48,  1,  1, 49, 49, 50,  0,  0, 51,  0,  0,  0,
-   52,  1,  0,  0, 38, 14,  4,  1,  1,  1, 53, 21, 43, 52, 54, 21,
-   35,  1,  0,  0,  0, 55,  0,  0,  0, 56, 57, 58,  0,  0,  0,  0,
-    0, 59,  0, 60,  0,  0,  0,  0, 61, 62,  0,  0, 63,  0,  0,  0,
-   64,  0,  0,  0, 65,  0,  0,  0, 66,  0,  0,  0, 67,  0,  0,  0,
-   68,  0,  0, 69, 70,  0, 71, 72, 73, 74, 75, 76,  0,  0,  0, 77,
-    0,  0,  0, 78, 79,  0,  0,  0,  0, 47,  0,  0,  0, 49,  0, 80,
-    0,  0,  0, 62,  0,  0, 63,  0,  0, 81,  0,  0, 82,  0,  0,  0,
-   83,  0,  0, 19, 84,  0, 62,  0,  0,  0,  0, 49,  1, 85,  1, 52,
-   15, 86, 36, 10, 21, 87,  0, 55,  0,  0,  0,  0, 19, 10,  1,  0,
-    0,  0,  0,  0, 88,  0,  0, 89,  0,  0, 88,  0,  0,  0,  0, 78,
-    0,  0, 87,  9, 12,  4, 90,  8, 91, 47,  0, 58, 50,  0, 21,  1,
-   21, 92, 93,  1,  1,  1,  1, 94, 95, 96, 97,  1, 98, 58, 81, 99,
-  100,  4, 58,  0,  0,  0,  0,  0,  0, 19, 50,  0,  0,  0,  0,  0,
-    0, 61,  0,  0,101,102,  0,  0,103,  0,  0,  1,  1, 50,  0,  0,
-    0, 38,  0, 63,  0,  0,  0,  0,  0, 62,  0,  0,104, 68, 61,  0,
-    0,  0, 78,  0,  0,  0,105,106, 58, 38, 81,  0,  0,  0,  0,  0,
-    0,107,  1, 14,  4, 12, 84,  0,  0,  0,  0, 38, 87,  0,  0,  0,
-    0,108,  0,  0,109, 61,  0,110,  0,  0,  0,  1,  0,  0,  0,  0,
+    0,  0, 38,  0,  0,  0,  0,  0,  0,  0,  0,  0, 39, 40,  0,  0,
+    0,  0,  0,  0, 41, 42, 43,  0, 44,  0,  0,  0,  0,  0,  0,  0,
+    0,  0,  0,  0,  0,  0,  1,  2,  0,  0,  0,  0,  3,  0,  0,  0,
+    4,  5,  6,  7,  0,  8,  9, 10,  0, 11, 12, 13, 14, 15, 16, 17,
+   16, 18, 16, 19, 16, 19, 16, 19,  0, 19, 16, 20, 16, 19, 21, 19,
+    0, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31,  0, 32,  0,  0,  0,
+    0,  0,  0,  0,  0,  0,  0, 33,  0,  0,  0,  0,  0,  0, 34,  0,
+    0, 35,  0,  0, 36,  0, 37,  0,  0,  0, 38, 39, 40, 41, 42, 43,
+   44, 45, 46,  0,  0, 47,  0,  0,  0, 48,  0,  0,  0, 49,  0,  0,
+    0,  0,  0,  0,  0, 50,  0, 51,  0, 52, 53,  0, 54,  0,  0,  0,
+    0,  0,  0, 55, 56, 57,  0,  0,  0,  0, 58,  0,  0, 59, 60, 61,
+   62, 63,  0,  0, 64, 65,  0,  0,  0, 66,  0,  0,  0,  0, 67,  0,
+    0,  0, 68,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+    0, 69,  0,  0,  0, 70,  0, 71,  0,  0, 72,  0,  0, 73,  0,  0,
+    0,  0,  0,  0,  0,  0, 74, 75,  0,  0,  0,  0, 76, 77,  0, 78,
+   79,  0,  0, 80, 81,  0, 82, 62,  0, 83, 84,  0,  0, 85, 86, 87,
+    0, 88,  0, 89,  0, 90,  0,  0, 51, 91, 51,  0, 92,  0, 93,  0,
+    0,  0, 81,  0,  0,  0, 94, 95,  0, 96, 97, 98, 99,  0,  0,  0,
+    0,  0, 51,  0,  0,  0,  0,100,101,  0,  0,  0,  0,  0,  0,102,
+    0,  0,  0,  0,  0,  0,103,  0,  0,  0,  0,  0,  0,104,105,  0,
+    0,  0,  0,  0,  0,  0,  0,  0,  0,106,  0,  0,107,  0,  0,  0,
+    0,  0,  0,  0,  0,  0,  0,108,109,  0,  0,110,  0,  0,  0,  0,
+    0,  0,111,  0,112,  0,105,  0,  0,  0,  0,  0,113,114,  0,  0,
+    0,  0,  0,  0,  0,115,  0,  0,  0,116,  0,  0,  0,117,  0,118,
+    0,  0,  0,  0,  0,  0,  1,  2,  3,  4,  5,  6,  7,  0,  8,  0,
+    0,  0,  0,  9, 10, 11, 12,  0,  0,  0,  0, 13,  0,  0, 14, 15,
+    0, 16,  0, 17, 18,  0,  0, 19,  0, 20, 21,  0,  0,  0,  0,  0,
+   22, 23,  0, 24, 25,  0,  0, 26,  0,  0,  0, 27,  0,  0, 28, 29,
+   30, 31,  0,  0,  0, 32, 33, 34,  0,  0, 33,  0,  0, 35, 33,  0,
+    0,  0, 33, 36,  0,  0,  0,  0,  0, 37, 38,  0,  0,  0,  0,  0,
+    0, 39, 40,  0,  0,  0,  0,  0,  0, 41, 42,  0,  0,  0,  0, 43,
+    0, 44,  0,  0,  0, 45, 46,  0,  0,  0, 47,  0,  0,  0,  0,  0,
+    0, 48, 49,  0,  0,  0,  0, 50,  0,  0,  0, 51,  0, 52,  0, 53,
+    0,  0,  0,  0, 54,  0,  0,  0,  0, 55,  0, 56,  0,  0,  0,  0,
+   57, 58,  0,  0,  0, 59, 60,  0,  0,  0,  0,  0,  0, 61, 52,  0,
+   62, 63,  0,  0, 64,  0,  0,  0, 65, 66,  0,  0,  0, 67,  0, 68,
+   69, 70, 71, 72,  1, 73,  0, 74, 75, 76,  0,  0, 77, 78,  0,  0,
+    0, 79,  0,  0,  1,  1,  0,  0, 80,  0,  0, 81,  0,  0,  0,  0,
+   77, 82,  0, 83,  0,  0,  0,  0,  0, 78, 84,  0, 85,  0, 52,  0,
+    1, 78,  0,  0, 86,  0,  0, 87,  0,  0,  0,  0,  0, 88, 57,  0,
+    0,  0,  0,  0,  0, 89, 90,  0,  0, 84,  0,  0, 33,  0,  0, 91,
+    0,  0,  0,  0, 92,  0,  0,  0,  0, 49,  0,  0, 93,  0,  0,  0,
+    0, 94, 95,  0,  0, 96,  0,  0, 97,  0,  0,  0, 98,  0,  0,  0,
+   99,  0,  0,  0,100,  0,  0,  0,  0,101,102, 93,  0,  0,103,  0,
+    0,  0, 84,  0,  0,104,  0,  0,  0,105,106,  0,  0,107,108,  0,
+    0,  0,  0,  0,  0,109,  0,  0,110,  0,  0,  0,  0,111, 33,  0,
+  112,113,114, 57,  0,  0,115, 35,  0,  0,116,  0,  0,  0,117,  0,
+    0,  0,  0,  0,  0,118,  0,  0,119,  0,  0,  0,  0,120, 88,  0,
+    0,  0,  0,  0, 57,  0,  0,  0,  0, 52,121,  0,  0,  0,  0,122,
+    0,  0,123,  0,  0,  0,  0,121,  0,  0,124,  0,  0,  0,  0,  0,
+   79,  0,  0,  0,  0,125,  0,  0,  0,126,  0,  0,  0,127,  0,128,
+    0,  0,  0,  0,129,130,131,  0,132,  0,133,  0,  0,  0,134,135,
+  136,  0, 77,  0,  0,  0,  0,  0, 35,  0,  0,  0,137,  0,  0,  0,
+  138,  0,  0,  0,139,  0,  0,140,  0,  0,141,  0,  0,  0,  0,  0,
+    0,  0,  1,  1,  1,  1,  1,  2,  3,  4,  5,  6,  7,  4,  4,  8,
+    9, 10,  1, 11, 12, 13, 14, 15, 16, 17, 18,  1,  1,  1, 19,  1,
+    0,  0, 20, 21, 22,  1, 23,  4, 21, 24, 25, 26, 27, 28, 29, 30,
+    0,  0,  1,  1, 31,  0,  0,  0, 32, 33, 34, 35,  1, 36, 37,  0,
+    0,  0,  0, 38,  1, 39, 14, 39, 40, 41, 42,  0,  0,  0, 43, 36,
+   44, 45, 21, 45, 46,  0,  0,  0, 19,  1, 21,  0,  0, 47,  0, 38,
+   48,  1,  1, 49, 49, 50,  0,  0, 51,  0,  0, 19, 52,  1,  0,  0,
+   38, 14,  4,  1,  1,  1, 53, 21, 43, 52, 54, 21, 35,  1,  0,  0,
+    0, 55,  0,  0,  0, 56, 57, 58,  0,  0,  0,  0,  0, 59,  0, 60,
+    0,  0,  0,  0, 61, 62,  0,  0, 63,  0,  0,  0, 64,  0,  0,  0,
+   65,  0,  0,  0, 66,  0,  0,  0, 67,  0,  0,  0, 68,  0,  0, 69,
+   70,  0, 71, 72, 73, 74, 75, 76,  0,  0,  0, 77,  0,  0,  0, 78,
+   79,  0,  0,  0,  0, 47,  0,  0,  0, 49,  0, 80,  0,  0,  0, 62,
+    0,  0, 63,  0,  0, 81,  0,  0, 82,  0,  0,  0, 83,  0,  0, 19,
+   84,  0, 62,  0,  0,  0,  0, 49,  1, 85,  1, 52, 15, 86, 36, 10,
+   21, 87,  0, 55,  0,  0,  0,  0, 19, 10,  1,  0,  0,  0,  0,  0,
+   88,  0,  0, 89,  0,  0, 88,  0,  0,  0,  0, 78,  0,  0, 87,  9,
+   12,  4, 90,  8, 91, 47,  0, 58, 50,  0, 21,  1, 21, 92, 93,  1,
+    1,  1,  1, 94, 95, 96, 97,  1, 98, 58, 81, 99,100,  4, 58,  0,
+    0,  0,  0,  0,  0, 19, 50,  0,  0,  0,  0,  0,  0, 61,  0,  0,
+  101,102,  0,  0,103,  0,  0,  1,  1, 50,  0,  0,  0, 38,  0, 63,
+    0,  0,  0,  0,  0, 62,  0,  0,104, 68, 61,  0,  0,  0, 78,  0,
+    0,  0,105,106, 58, 38, 81,  0,  0,  0,  0,  0,  0,107,  1, 14,
+    4, 12, 84,  0,  0,  0,  0, 38, 87,  0,  0,  0,  0,108,  0,  0,
+  109, 61,  0,110,  0,  0,  0,  1,  0,  0,  0,  0, 49, 50,  0,  0,
    19, 58,  0,  0,  0, 51,  0,111, 14, 52,112, 41,  0,  0, 62,  0,
     0, 61,  0,  0,113,  0, 87,  0,  0,  0, 61, 62,  0,  0, 62,  0,
    89,  0,  0,113,  0,  0,  0,  0,114,  0,  0,  0, 78, 55,  0, 38,
-    1, 58,  1, 58,  0,  0, 63, 89,  0,  0,115,  0,  0,  0, 55,  0,
-    0,  0,  0,115,  0,  0,  0,  0, 61,  0,  0,  0,  0, 79,  0, 61,
-    0,  0,  0,  0, 56,  0, 89, 80,  0,  0, 79,  0,  0,  0,  8, 91,
-    0,  0,  1, 87,  0,  0,116,  0,  0,  0,  0,  0,  0,117,  0,118,
-  119,120,121,  0,104,  4,122, 49, 23,  0,  0,  0, 38, 50, 38, 58,
-    0,  0,  1, 87,  1,  1,  1,  1, 39,  1, 48,105, 87,  0,  0,  0,
-    0,  1,  0,  0,  0,123,  4,122,  0,  0,  0,  1,124,  0,  0,  0,
-    0,  0,230,230,230,230,230,232,220,220,220,220,232,216,220,220,
-  220,220,220,202,202,220,220,220,220,202,202,220,220,220,  1,  1,
-    1,  1,  1,220,220,220,220,230,230,230,230,240,230,220,220,220,
-  230,230,230,220,220,  0,230,230,230,220,220,220,220,230,232,220,
-  220,230,233,234,234,233,234,234,233,230,  0,  0,  0,230,  0,220,
-  230,230,230,230,220,230,230,230,222,220,230,230,220,220,230,222,
-  228,230, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 19, 20, 21, 22,
-    0, 23,  0, 24, 25,  0,230,220,  0, 18, 30, 31, 32,  0,  0,  0,
-    0, 27, 28, 29, 30, 31, 32, 33, 34,230,230,220,220,230,220,230,
-  230,220, 35,  0,  0,  0,  0,  0,230,230,230,  0,  0,230,230,  0,
-  220,230,230,220,  0,  0,  0, 36,  0,  0,230,220,230,230,220,220,
-  230,220,220,230,220,230,220,230,230,  0,  0,220,  0,  0,230,230,
-    0,230,  0,230,230,230,230,230,  0,  0,  0,220,220,220,230,220,
-  220,220,230,230,  0,220, 27, 28, 29,230,  7,  0,  0,  0,  0,  9,
-    0,  0,  0,230,220,230,230,  0,  0,  0,  0,  0,230,  0,  0, 84,
-   91,  0,  0,  0,  0,  9,  9,  0,  0,  0,  0,  0,  9,  0,103,103,
-    9,  0,107,107,107,107,118,118,  9,  0,122,122,122,122,220,220,
-    0,  0,  0,220,  0,220,  0,216,  0,  0,  0,129,130,  0,132,  0,
-    0,  0,  0,  0,130,130,130,130,  0,  0,130,  0,230,230,  9,  0,
-  230,230,  0,  0,220,  0,  0,  0,  0,  7,  0,  9,  9,  0,  9,  9,
-    0,  0,  0,230,  0,  0,  0,228,  0,  0,  0,222,230,220,220,  0,
-    0,  0,230,  0,  0,220,230,220,  0,220,230,230,230,  0,  0,  0,
-    9,  9,  0,  0,  7,  0,230,  0,  1,  1,  1,  0,  0,  0,230,234,
-  214,220,202,230,230,230,230,230,232,228,228,220,218,230,233,220,
-  230,220,230,230,  1,  1,  1,  1,  1,230,  0,  1,  1,230,220,230,
-    1,  1,  0,  0,218,228,232,222,224,224,  0,  8,  8,  0,  0,  0,
-    0,220,230,  0,230,230,220,  0,  0,230,  0,  0, 26,  0,  0,220,
-    0,230,230,  1,220,  0,  0,230,220,  0,  0,  0,220,220,  0,  0,
-  230,220,  0,  9,  7,  0,  0,  7,  9,  0,  0,  0,  9,  7,  6,  6,
-    0,  0,  0,  0,  1,  0,  0,216,216,  1,  1,  1,  0,  0,  0,226,
-  216,216,216,216,216,  0,220,220,220,  0,232,232,220,230,230,230,
-    7,  0, 16, 17, 17, 33, 17, 49, 17, 17, 84, 97,135,145, 26, 17,
+    1, 58,  1, 58,  0,  0,  0,  0,  0, 88, 63, 89,  0,  0,115,  0,
+    0,  0, 55,  0,  0,  0,  0,115,  0,  0,  0,  0, 61,  0,  0,  0,
+    0, 79,  0, 61,  0,  0,  0,  0, 56,  0, 89, 80,  0,  0, 79,  0,
+    0,  0,  8, 91,  0,  0,  1, 87,  0,  0,116,  0,  0,  0,  0,  0,
+    0,117,  0,118,119,120,121,  0,104,  4,122, 49, 23,  0,  0,  0,
+   38, 50, 38, 58,  0,  0,  1, 87,  1,  1,  1,  1, 39,  1, 48,105,
+   87,  0,  0,  0,  0,  1,  0,  0,  0,123,  0,  0,  0,112,  4,122,
+    0,  0,  0,  1,124,  0,  0,  0,  0,  0,230,230,230,230,230,232,
+  220,220,220,220,232,216,220,220,220,220,220,202,202,220,220,220,
+  220,202,202,220,220,220,  1,  1,  1,  1,  1,220,220,220,220,230,
+  230,230,230,240,230,220,220,220,230,230,230,220,220,  0,230,230,
+  230,220,220,220,220,230,232,220,220,230,233,234,234,233,234,234,
+  233,230,  0,  0,  0,230,  0,220,230,230,230,230,220,230,230,230,
+  222,220,230,230,220,220,230,222,228,230, 10, 11, 12, 13, 14, 15,
+   16, 17, 18, 19, 19, 20, 21, 22,  0, 23,  0, 24, 25,  0,230,220,
+    0, 18, 30, 31, 32,  0,  0,  0,  0, 27, 28, 29, 30, 31, 32, 33,
+   34,230,230,220,220,230,220,230,230,220, 35,  0,  0,  0,  0,  0,
+  230,230,230,  0,  0,230,230,  0,220,230,230,220,  0,  0,  0, 36,
+    0,  0,230,220,230,230,220,220,230,220,220,230,220,230,220,230,
+  230,  0,  0,220,  0,  0,230,230,  0,230,  0,230,230,230,230,230,
+    0,  0,  0,220,220,220,230,220,220,220,230,230,  0,220, 27, 28,
+   29,230,  7,  0,  0,  0,  0,  9,  0,  0,  0,230,220,230,230,  0,
+    0,  0,  0,  0,230,  0,  0, 84, 91,  0,  0,  0,  0,  9,  9,  0,
+    0,  0,  0,  0,  9,  0,103,103,  9,  0,107,107,107,107,118,118,
+    9,  0,122,122,122,122,220,220,  0,  0,  0,220,  0,220,  0,216,
+    0,  0,  0,129,130,  0,132,  0,  0,  0,  0,  0,130,130,130,130,
+    0,  0,130,  0,230,230,  9,  0,230,230,  0,  0,220,  0,  0,  0,
+    0,  7,  0,  9,  9,  0,  9,  9,  0,  0,  0,230,  0,  0,  0,228,
+    0,  0,  0,222,230,220,220,  0,  0,  0,230,  0,  0,220,230,220,
+    0,220,230,230,230,  0,  0,  0,  9,  9,  0,  0,  7,  0,230,  0,
+    1,  1,  1,  0,  0,  0,230,234,214,220,202,230,230,230,230,230,
+  232,228,228,220,218,230,233,220,230,220,230,230,  1,  1,  1,  1,
+    1,230,  0,  1,  1,230,220,230,  1,  1,  0,  0,218,228,232,222,
+  224,224,  0,  8,  8,  0,  0,  0,  0,220,230,  0,230,230,220,  0,
+    0,230,  0,  0, 26,  0,  0,220,  0,230,230,  1,220,  0,  0,230,
+  220,  0,  0,  0,220,220,  0,  0,230,220,  0,  9,  7,  0,  0,  7,
+    9,  0,  0,  0,  9,  7,  6,  6,  0,  0,  0,  0,  1,  0,  0,216,
+  216,  1,  1,  1,  0,  0,  0,226,216,216,216,216,216,  0,220,220,
+  220,  0,232,232,220,230,230,230,  7,  0, 16, 17, 17, 33, 17, 49,
+   17, 17, 84, 97,135,145, 26, 17, 17, 17, 17, 17, 17, 17, 17, 17,
    17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
    17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
+   17, 17, 17, 17, 17, 17, 17, 17, 17,177,  0,  1,  2,  3,  3,  3,
+    3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  4,  3,
+    3,  3,  3,  3,  5,  3,  3,  3,  3,  3,  6,  7,  8,  3,  3,  3,
+    3,  3,  9, 10, 11, 12, 13,  3,  3,  3,  3,  3,  3,  3,  3, 14,
+    3, 15,  3,  3,  3,  3,  3,  3, 16, 17, 18, 19, 20, 21,  3,  3,
+    3, 22, 23, 24,  3,  3,  3,  3,  3,  3, 25,  3,  3,  3,  3,  3,
+    3,  3,  3, 26,  3,  3, 27, 28,  0,  1,  0,  0,  0,  0,  0,  1,
+    0,  2,  0,  0,  0,  3,  0,  0,  0,  3,  0,  0,  0,  0,  0,  4,
+    0,  5,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+    0,  6,  0,  0,  0,  7,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+    0,  8,  9,  0,  0,  0,  0,  0,  0,  9,  0,  9,  0,  0,  0,  0,
+    0,  0,  0, 10, 11, 12, 13,  0,  0, 14, 15, 16,  6,  0, 17, 18,
+   19, 19, 19, 20, 21, 22, 23, 24, 19, 25,  0, 26, 27, 19, 19, 28,
+   29, 30,  0, 31,  0,  0,  0,  8,  0,  0,  0,  0,  0,  0,  0, 19,
+   28,  0, 32, 33,  9, 34, 35, 19,  0,  0, 36, 37, 38, 39, 40, 19,
+    0, 41, 42, 43, 44, 31,  0,  1, 45, 42,  0,  0,  0,  0,  0, 32,
+   14, 14,  0,  0,  0,  0, 14,  0,  0, 46, 47, 47, 47, 47, 48, 49,
+   47, 47, 47, 47, 50, 51, 52, 53, 43, 21,  0,  0,  0,  0,  0,  0,
+    0, 54,  6, 55,  0, 14, 19,  1,  0,  0,  0,  0, 56, 57,  0,  0,
+    0,  0,  0, 19, 58, 31,  0,  0,  0,  0,  0,  0,  0, 59, 14,  0,
+    0,  0,  0,  1,  0,  2,  0,  0,  0,  3,  0,  0,  0, 60, 61,  0,
+    0,  0,  0,  0,  0,  0,  1,  0,  0,  0,  0,  0,  2,  3,  0,  4,
+    5,  0,  0,  6,  0,  0,  0,  7,  0,  0,  0,  1,  1,  0,  0,  8,
+    9,  0,  8,  9,  0,  0,  0,  0,  8,  9, 10, 11, 12,  0,  0,  0,
+   13,  0,  0,  0,  0, 14, 15, 16, 17,  0,  0,  0,  1,  0,  0, 18,
+   19,  0,  0,  0, 20,  0,  0,  0,  1,  1,  1,  1,  0,  1,  1,  1,
+    1,  1,  1,  1,  0,  8, 21,  9,  0,  0, 22,  0,  0,  0,  0,  1,
+    0, 23, 24, 25,  0,  0, 26,  0,  0,  0,  8, 21, 27,  0,  1,  0,
+    0,  1,  1,  1,  1,  0,  1, 28, 29, 30,  0, 31, 32, 20,  1,  1,
+    0,  0,  0,  8, 21,  9,  1,  4,  5,  0,  0,  0, 33,  9,  0,  1,
+    1,  1,  0,  8, 21, 21, 21, 21, 34,  1, 35, 21, 21, 21,  9, 36,
+    0,  0, 37, 38,  1,  0, 39,  0,  0,  0,  1,  0,  1,  0,  0,  0,
+    0,  8, 21,  9,  1,  0,  0,  0, 40,  0,  8, 21, 21, 21, 21, 21,
+   21, 21, 21,  9,  0,  1,  1,  1,  1,  8, 21, 21, 21,  9,  0,  0,
+    0, 41,  0, 42, 43,  0,  0,  0,  1, 44,  0,  0,  0, 45,  8,  9,
+    1,  0,  0,  0,  8, 21, 21, 21,  9,  0,  1,  0,  1,  1,  8, 21,
+   21,  9,  0,  4,  5,  8,  9,  1,  0,  0,  0,  1,  2,  3,  3,  4,
+    5,  6,  7,  8,  9, 10, 11, 12, 13, 14,  3,  3,  3,  3,  3,  3,
+    3, 15,  3, 16, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
    17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
-   17,177,  0,  1,  2,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,  3,
-    3,  3,  3,  3,  3,  3,  4,  3,  3,  3,  3,  3,  5,  3,  3,  3,
-    3,  3,  6,  7,  8,  3,  3,  3,  3,  3,  9, 10, 11, 12, 13,  3,
-    3,  3,  3,  3,  3,  3,  3, 14,  3, 15,  3,  3,  3,  3,  3,  3,
-   16, 17, 18, 19, 20, 21,  3,  3,  3, 22, 23, 24,  3,  3,  3,  3,
-    3,  3, 25,  3,  3,  3,  3,  3,  3,  3,  3, 26,  3,  3, 27, 28,
-    0,  1,  0,  0,  0,  0,  0,  1,  0,  2,  0,  0,  0,  3,  0,  0,
-    0,  3,  0,  0,  0,  0,  0,  4,  0,  5,  0,  0,  0,  0,  0,  0,
-    0,  0,  0,  0,  0,  0,  0,  0,  0,  6,  0,  0,  0,  7,  0,  0,
-    0,  0,  0,  0,  0,  0,  0,  0,  0,  8,  9,  0,  0,  0,  0,  0,
-    0,  9,  0,  9,  0,  0,  0,  0,  0,  0,  0, 10, 11, 12, 13,  0,
-    0, 14, 15, 16,  6,  0, 17, 18, 19, 19, 19, 20, 21, 22, 23, 24,
-   19, 25,  0, 26, 27, 19, 19, 28, 29, 30,  0, 31,  0,  0,  0,  8,
-    0,  0,  0,  0,  0,  0,  0, 19, 28,  0, 32, 33,  9, 34, 35, 19,
-    0,  0, 36, 37, 38, 39, 40, 19,  0, 41, 42, 43, 44, 31,  0,  1,
-   45, 42,  0,  0,  0,  0,  0, 32, 14, 14,  0,  0,  0,  0, 14,  0,
-    0, 46, 47, 47, 47, 47, 48, 49, 47, 47, 47, 47, 50, 51, 52, 53,
-   43, 21,  0,  0,  0,  0,  0,  0,  0, 54,  6, 55,  0, 14, 19,  1,
-    0,  0,  0,  0, 56, 57,  0,  0,  0,  0,  0, 19, 58, 31,  0,  0,
-    0,  0,  0,  0,  0, 59, 14,  0,  0,  0,  0,  1,  0,  2,  0,  0,
-    0,  3,  0,  0,  0, 60, 61,  0,  0,  0,  0,  0,  0,  0,  1,  0,
-    0,  0,  0,  0,  2,  3,  0,  4,  5,  0,  0,  6,  0,  0,  0,  7,
-    0,  0,  0,  1,  1,  0,  0,  8,  9,  0,  8,  9,  0,  0,  0,  0,
-    8,  9, 10, 11, 12,  0,  0,  0, 13,  0,  0,  0,  0, 14, 15, 16,
-   17,  0,  0,  0,  1,  0,  0, 18, 19,  0,  0,  0, 20,  0,  0,  0,
-    1,  1,  1,  1,  0,  1,  1,  1,  1,  1,  1,  1,  0,  8, 21,  9,
-    0,  0, 22,  0,  0,  0,  0,  1,  0, 23, 24, 25,  0,  0, 26,  0,
-    0,  0,  8, 21, 27,  0,  1,  0,  0,  1,  1,  1,  1,  0,  1, 28,
-   29, 30,  0, 31, 32, 20,  1,  1,  0,  0,  0,  8, 21,  9,  1,  4,
-    5,  0,  0,  0, 33,  9,  0,  1,  1,  1,  0,  8, 21, 21, 21, 21,
-   34,  1, 35, 21, 21, 21,  9, 36,  0,  0, 37, 38,  1,  0, 39,  0,
-    0,  0,  1,  0,  1,  0,  0,  0,  0,  8, 21,  9,  1,  0,  0,  0,
-   40,  0,  8, 21, 21, 21, 21, 21, 21, 21, 21,  9,  0,  1,  1,  1,
-    1,  8, 21, 21, 21,  9,  0,  0,  0, 41,  0, 42, 43,  0,  0,  0,
-    1, 44,  0,  0,  0, 45,  8,  9,  1,  0,  0,  0,  8, 21, 21, 21,
-    9,  0,  1,  0,  1,  1,  8, 21, 21,  9,  0,  4,  5,  8,  9,  1,
-    0,  0,  0,  1,  2,  3,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12,
-   13, 14,  3,  3,  3,  3,  3,  3,  3, 15,  3, 16, 17, 17, 17, 17,
    17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
    17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
    17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
-   17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
-   17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
-   17, 17, 18,  0,  0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11,
-   12, 13, 14, 15, 16, 17, 17, 17, 18, 17, 19, 20, 21, 22, 23, 23,
-   23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 24, 23, 23, 23, 23, 23,
-   23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
-   23, 23, 23, 23, 25, 25, 26, 27, 28, 29, 30, 30, 30, 30, 30, 30,
-   30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
+   17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 18,  0,  0,  1,  2,  3,
+    4,  5,  6,  7,  8,  9, 10, 11, 12, 13, 14, 15, 16, 17, 17, 17,
+   18, 17, 19, 20, 21, 22, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
+   23, 23, 24, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23,
+   23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 25, 25, 26, 27,
+   28, 29, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30, 30,
+   30, 30, 30, 30, 30, 30, 30, 30, 31, 31, 31, 31, 31, 31, 31, 31,
+   31, 31, 31, 31, 31, 31, 31, 31, 32, 33, 34, 35, 36, 37, 38, 39,
+   40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 52, 53, 31,
+   31, 31, 31, 54, 55, 55, 55, 55, 55, 55, 55, 55, 55, 55, 56, 57,
+   31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 58, 31, 31, 31,
+   59, 60, 61, 62, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63, 63,
+   63, 64, 65, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31,
+   31, 31, 31, 66, 67, 68, 31, 31, 31, 31, 69, 31, 31, 31, 31, 31,
+   31, 31, 17, 70, 71, 72, 17, 17, 73, 74, 31, 75, 76, 77, 78, 79,
+   80, 31, 81, 82, 17, 83, 17, 17, 17, 17, 31, 31, 23, 23, 23, 23,
+   23, 23, 23, 84, 31, 31, 31, 31, 23, 84, 31, 31, 23, 23, 31, 31,
    31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31,
-   32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
-   48, 49, 50, 51, 52, 52, 53, 31, 31, 31, 31, 54, 55, 55, 56, 31,
-   31, 31, 31, 31, 31, 31, 57, 58, 31, 31, 31, 31, 31, 31, 31, 31,
-   31, 31, 31, 31, 31, 31, 31, 31, 59, 60, 31, 61, 62, 62, 62, 62,
-   62, 62, 62, 62, 62, 62, 62, 62, 62, 63, 64, 31, 31, 31, 31, 31,
-   31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 65, 66, 67, 31, 31,
-   31, 31, 68, 31, 31, 31, 31, 31, 31, 31, 31, 69, 70, 71, 17, 17,
-   72, 73, 31, 74, 75, 76, 77, 78, 79, 31, 80, 81, 17, 82, 17, 17,
-   17, 17, 31, 31, 23, 23, 23, 23, 23, 23, 23, 83, 31, 31, 31, 31,
-   23, 83, 31, 31, 23, 23, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31,
-   31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31,
-   31, 31, 31, 31, 84,  0,  0,  1,  0,  1,  2,  3,  0,  1,  2,  3,
-    4,  5,  6,  7,  0,  1,  2,  3,  4,  4,  4,  4,  4,  4,  5,  6,
-    7,  8,  9, 10, 11, 11, 12, 11, 13, 14, 15, 16, 17, 18, 19, 20,
-   21, 22, 23, 24, 25, 26, 19, 27, 28, 29, 30, 30, 31, 31, 32, 32,
-   33, 33, 34, 34, 35, 35, 36, 36, 37, 37, 38, 38, 39, 40, 41, 41,
-   42, 42, 42, 43, 44, 44, 45, 46, 47, 47, 47, 47, 48, 48, 48, 48,
-   48, 48, 49, 50, 51, 51, 51, 51, 51, 51, 51, 51, 51, 51, 52, 53,
-   54, 55, 56, 56, 57, 58, 59, 51, 60, 61, 62, 63, 64, 65, 66,  7,
-   67, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,  7,  4,  4,  4,  4,
-   77, 77, 77, 77, 78, 79, 80, 81, 82, 83, 84,  0,  0,  0,  0,  0,
-    0,  0,  0,  0, 85, 85, 85, 85,  0,  0,  0,  0, 86, 87, 88, 88,
-   89, 90, 48, 91,  0,  0, 92, 92, 92, 92, 92, 93, 94, 95, 96, 97,
-   98, 47, 99,100,101,102,  0,103,104,105,  0,  0, 92, 92, 92, 92,
-   92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92,  0,106,106,106,106,
-  106,106,106,106,106,106,106,107,108,108,108,108,108, 11,109,110,
-  111,  4,112,  4,113,114,115,116,117,118,119,120,121,122,123,124,
-  125,126, 50,127, 47, 47, 47, 47, 47, 47, 47, 47,128,128,128,128,
-  128,128,128,128,128,128,128,128, 92, 92, 92, 92, 92, 92, 92, 92,
-  129,130, 19, 19, 19, 19, 19, 19,131, 19, 19, 19,132,133, 19,134,
-  135,136,137,101,138,138,138,138,  0, 77,139,140,128,128,141,142,
-  143,144,145,146,147,148,149,150,151,152,153,153,154,154,154,154,
-  154,154,  4,  4,155,156,157,158,159,160,161,162,163,164,165,166,
-  167,168,169,169,170,170,171,171,172,172,128,128, 19, 19,173,174,
-  175,176,177,178,179,179,180,181,182,183,184,185,186,186,187,188,
-  189,190,128,128,191,191,192,192,128,128,193,193,194,195,196,196,
-  197,197,128,128,198,198,199,199,200,200,201,201,202,203,204,205,
-   28, 28,128,128,206,207,208,208,209,210,211,211,128,128,212,212,
-  213,213,214, 34,215,215,215,215,215,215,215,215,215,215,215,215,
-  215,215,128,128,128,128,128,128,128,128,216,216,217,217,217,217,
-  217,217,217,217,217,217,128,128,128,128,128,128,218,218,218,218,
-  218,218,218,218,218,218,128,128,128,128,128,128,110,110,110,110,
-  110,110,110,110,110,219,220,221,222,222,222,222,223,223,223,223,
-  224,224,224,225,226,226,226,226,226,226,226,226,226,226,226,226,
-  227,227,227,227,227,227,227,227,226,226,128,128,128,128,128,128,
-  128,128,104,104,228,229,229,229,230,231,232,232,232,232,232,232,
-  128,128,128,128,233,233,234,  0,128,128,128,128,128,128,128,128,
-    7,235,  0,  0,  0,  0,  0,  0,  0,236,237,  0, 77, 77,  0,  0,
-    0,  0,128,128,238,238,238,238,238,238,238,238,238,238,238,238,
-  128,128,128,128,128,128,128,128,  4,  4,128,128,239, 11, 11, 11,
-  240,240,128,128,128,128,241,242,128,128,128,128,128,128,243,243,
-  128,128,128,128,128,128,128,128,128,128, 48, 48,244,244,244,244,
-  245,245,128,128,  0,  0,  0,  0,  0,  0,128,128, 19, 19, 19, 19,
-  128,128,128,128,246,  0,128,128,  0,  0,  0,  0, 92, 92,128,128,
+   31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 31, 85,  0,  0,  1,
+    0,  1,  2,  3,  0,  1,  2,  3,  4,  5,  6,  7,  0,  1,  2,  3,
+    4,  4,  4,  4,  4,  4,  5,  6,  7,  8,  9, 10, 11, 11, 12, 11,
+   13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 19, 27,
+   28, 29, 30, 30, 31, 31, 32, 32, 33, 33, 34, 34, 35, 35, 36, 36,
+   37, 37, 38, 38, 39, 40, 41, 41, 42, 42, 42, 43, 44, 44, 45, 46,
+   47, 47, 47, 47, 48, 48, 48, 48, 48, 48, 49, 50, 51, 51, 51, 51,
+   51, 51, 51, 51, 51, 51, 52, 53, 54, 55, 56, 56, 57, 58, 59, 51,
+   60, 61, 62, 63, 64, 65, 66,  7, 67, 67, 68, 69, 70, 71, 72, 73,
+   74, 75, 76,  7,  4,  4,  4,  4, 77, 77, 77, 77, 78, 79, 80, 81,
+   82, 83, 84,  0,  0,  0,  0,  0,  0,  0,  0,  0, 85, 85, 85, 85,
+    0,  0,  0,  0, 86, 87, 88, 88, 89, 90, 48, 91,  0,  0, 92, 92,
+   92, 92, 92, 93, 94, 95, 96, 97, 98, 47, 99,100,101,102,  0,103,
+  104,105,  0,  0, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92, 92,
+   92, 92, 92,  0,106,106,106,106,106,106,106,106,106,106,106,107,
+  108,108,108,108,108, 11,109,110,111,  4,112,  4,113,114,115,116,
+  117,118,119,120,121,122,123,124,125,126, 50,127, 47, 47, 47, 47,
+   47, 47, 47, 47,128,128,128,128,128,128,128,128,128,128,128,128,
+   92, 92, 92, 92, 92, 92, 92, 92,129,130, 19, 19, 19, 19, 19, 19,
+  131, 19, 19, 19,132,133, 19,134,135,136,137,101,138,138,138,138,
+    0, 77,139,140,128,128,141,142,143,144,145,146,147,148,149,150,
+  151,152,153,154,155,155,155,155,155,155,  4,  4,156,157,158,159,
+  160,161,162,163,164,165,166,167,168,169,170,170,171,171,172,172,
+  173,174,174,174, 19, 19,175,176,177,178,179,180,181,181,182,183,
+  184,185,186,187,188,188,189,190,191,192,193,193,194,194,195,195,
+  128,128,196,196,197,198,199,200,201,201,128,128,202,202,203,203,
+  204,204,205,205,206,207,208,209, 28, 28,210,210,211,212,213,213,
+  214,215,216,216,128,128,217,217,218,218,219, 34,220,220,220,220,
+  220,220,220,220,220,220,220,220,220,220,128,128,128,128,128,128,
+  128,128,221,221,222,222,222,222,222,222,222,222,223,223,223,223,
+  223,223,223,223,223,223,128,128,128,128,128,128,128,128,128,128,
+  224,224,128,128,110,110,110,110,110,110,110,110,110,225,226,227,
+  228,228,228,228,128,128,128,128,229,229,128,128,230,230,230,230,
+  231,231,231,232,233,233,233,233,233,233,233,233,233,233,233,233,
+  234,234,234,234,234,234,234,234,233,233,128,128,128,128,128,128,
+  128,128,104,104,235,236,236,236,237,238,239,239,239,239,239,239,
+  128,128,128,128,240,240,241,  0,128,128,128,128,  0,  0,  0,  0,
+    7,242,  0,  0,  0,  0,  0,  0,  0,243,244,  0, 77, 77,  0,  0,
+    0,  0,128,128,245,245,245,245,245,245,245,245,245,245,245,245,
+  128,128,128,128,128,128,128,128,  4,  4,128,128,246, 11, 11, 11,
+  247,247,128,128,128,128,248,249,128,128,128,128,128,128,250,250,
+  128,128,251,251,128,128,128,128,128,128, 48, 48,252,252,252,252,
+  253,253,128,128,  0,  0,  0,  0,  0,  0,128,128, 19, 19, 19, 19,
+  128,128,128,128,254,  0,128,128,  0,  0,  0,  0, 92, 92,128,128,
   128,128,128,128,  0,  0,128,128,  7,  7,  7,  7,  0,  0,  0,  0,
     1,  2,  1,  2,  0,  0,  3,  3,  4,  5,  4,  5,  4,  4,  4,  4,
     4,  4,  4,  6,  0,  0,  7,  0,  8,  8,  8,  8,  8,  8,  8,  9,
@@ -5056,30 +5278,32 @@ _hb_ucd_u8[13386] =
   137,137,138,138,138,138,139,  0,140,140,140,141,141,142,142,142,
   143,143,144,144,144,144,144,144,145,145,145,145,145,146,146,146,
   147,147,147,148,148,148,148,148,149,149,149,150,150,150,150,151,
-  151,151,151,151,152,152,152,152,153,153,153,153,154,154,155,155,
-  156,156,156,156,156,156,157,157,158,158,159,159,159,159,159,159,
-  160,160,161,161,161,161,161,161,162,162,162,162,162,162,163,163,
-  164,164,164,164,165,165,165,165,166,166,166,166,167,167,168,168,
-  169,169,169,169,170,170,170,170,171,171,171,171,172,172,172,172,
-  173,173,173,173,173,173,173,174,175,175,175,176,176,176,176,177,
-  177,177,177,178,178,178,179,179,180,180,180,180,181,181,181,181,
-  181,182,182,182,183,183,183,183,183,184,184,184,185,185,185,185,
-  185,185,186, 43,187,187,187,187,188,188,188,189,189,189,189,189,
-  190,190,190,191,190,190,190,190,192,192,192,192,193,193,193,193,
-  194,194,194,194,195,195,195,195,195,195, 66, 66,196,196,196,196,
-  197,197,197,197,198,198,198,198,199,199,199,199,200,200,200,200,
-  201,201,201,201,202,202,202,202,202,203,203,203,203,203,203, 55,
-  204,204,204,204,205,205,205,205,205,205,205,206,206,206,206,206,
-  207,207,207,207,207,207,208,208,208,208,208,208,209,209,209,209,
-  210,210,210,210,110,110,110,110,211,211,211,211,212,212,212,212,
-  213,213,213,213,214,214,214,214,215,215,215,216,216,216,216,216,
-  216,217,217,217,218,218,218,218,219,219,219,219,220,220,220,220,
-  220,220,221, 94,222,222,222,222,223,223,223,223,224, 99, 99, 99,
-   99, 99, 99, 99, 99, 99,102,225, 99,226,102,227,227,227,227,227,
-  228,228,228,228,228,228,  0,  0,  8,  0,  0,  0,  0,  0,229,230,
-  231,  0,232,  0,233,233,233,233, 91, 91, 91, 13,234,234,234,234,
-  235,235,235,235,236,236,236,236,237,237,237,237,238,238,238,238,
-  239,239,239,239,240,  0,  0,  0,  0,  0,  0,  0,  1,  2,  2,  2,
+  151,151,151,151,152,152,152,152,153,153,153,153,154,154,154,154,
+  155,155,156,156,157,157,157,157,157,157,158,158,159,159,160,160,
+  160,160,160,160,161,161,162,162,162,162,162,162,163,163,163,163,
+  163,163,164,164,165,165,165,165,166,166,166,166,167,167,167,167,
+  168,168,169,169,170,170,170,170,171,171,171,171,172,172,172,172,
+  173,173,173,173,174,174,174,174,175,175,175,175,176, 21, 21, 21,
+  177,177,177,178,178,178,178,179,179,179,179,180,180,180,181,181,
+  182,182,182,182,183,183,183,183,183,184,184,184,185,185,185,185,
+  185,186,186,186,187,187,187,187,187,187,188, 43,189,189,189,189,
+  190,190,190,191,191,191,191,191,192,192,192,193,192,192,192,192,
+  194,194,194,194,195,195,195,195,196,196,196,196,197,197,197,197,
+  198,198,198,198,198,198, 66, 66,199,199,199,199,199, 49, 49, 49,
+  200,200,200,200,201,201,201,201,202,202,202,202,203,203,203,203,
+  204,204,204,204,205,205,205,205,205,206,206,206,206,206,206, 55,
+  207,207,207,207,208,208,208,208,209,209,209,209,209,209,209,210,
+  210,210,210,210,211,211,211,211,211,211,212,212,212,212,212,212,
+  213,213,213,213,214,214,214,214,110,110,110,110,215,215,215,215,
+  216,216,216,216,217,217,217,217,218,218,218,218,219,219,219,219,
+  220,220,220,221,221,221,221,221,221,222,222,222,223,223,223,223,
+  224,224,224,224,225,225,225,225,226,226,226,226,226,226,227, 94,
+  228,228,228,228,229,229,229,229,230, 99, 99, 99, 99, 99, 99, 99,
+   99, 99,102,231, 99,232,102,233,233,233,233,233,234,234,234,234,
+  234,234,  0,  0,  8,  0,  0,  0,  0,  0,235,236,237,  0,238,  0,
+  239,239,239,239, 91, 91, 91, 13,240,240,240,240,241,241,241,241,
+  242,242,242,242,243,243,243,243,244,244,244,244,245,245,245,245,
+  246,246,246,246,247,  0,  0,  0,  0,  0,  0,  0,  1,  2,  2,  2,
     2,  2,  3,  0,  0,  0,  4,  0,  2,  2,  2,  2,  2,  3,  2,  2,
     2,  2,  5,  0,  2,  5,  6,  0,  7,  7,  7,  7,  8,  9,  8, 10,
     8, 11,  8,  8,  8,  8,  8,  8, 12, 13, 13, 13, 14, 14, 14, 14,
@@ -5123,98 +5347,102 @@ _hb_ucd_u8[13386] =
   163,163,163,163,164,164,164,164,165,165,165,165,166,166,166,166,
   167,167,167,167,168,168,168,168,169,169,169,169,170,170,170,170,
   171,171,171,171,172,172,172,172,173,173,173,173,174,174,174,174,
-  174,174,174,175,176,176,176,176,177,177,177,177,178,178,178,178,
+  175,175,175,175,176,176,176,176,177, 20, 20, 20,178,178,178,178,
   179,179,179,179,180,180,180,180,181,181,181,181,182,182,182,182,
   183,183,183,183,184,184,184,184,185,185,185,185,186,186,186,186,
-  187, 45, 45, 45,188,188,188,188,189,189,189,189,190,190,190,190,
-  191,191,191,191,191,191,192,191,193,193,193,193,194,194,194,194,
+  187,187,187,187,188,188,188,188,189, 45, 45, 45,190,190,190,190,
+  191,191,191,191,192,192,192,192,193,193,193,193,193,193,194,193,
   195,195,195,195,196,196,196,196,197,197,197,197,198,198,198,198,
   199,199,199,199,200,200,200,200,201,201,201,201,202,202,202,202,
   203,203,203,203,204,204,204,204,205,205,205,205,206,206,206,206,
   207,207,207,207,208,208,208,208,209,209,209,209,210,210,210,210,
   211,211,211,211,212,212,212,212,213,213,213,213,214,214,214,214,
   215,215,215,215,216,216,216,216,217,217,217,217,218,218,218,218,
-  219,219,219,219,220,220,220,220,221,221,221,221,222,223,223,223,
-  224,224,224,224,223,223,223,223,225,106,106,106,226,106,106,106,
-  106,227,109,109,228,228,228,228,229,229,229,229,  0,230, 86,  0,
-    0,  0,230,  7, 82,138,  7,  0,  0,  0,231, 86,232,232,232,232,
-  233,233,233,233,234,234,234,234,235,235,235,235,236,236,236,236,
-  237,237,237,237,238,238,238,238,239,  0,  0,  0,  0,  0,  0,  0,
-    0, 19, 19, 19, 19, 19, 19, 19, 19, 19, 19,  0,  0,  0, 19,  0,
-   19,  0,  0,  0,  0,  0, 26, 26,  1,  1,  1,  1,  9,  9,  9,  9,
-    0,  9,  9,  9,  9,  9,  0,  9,  9,  0,  9,  0,  9,  9, 55, 55,
-   55, 55, 55, 55,  6,  6,  6,  6,  6,  1,  1,  6,  6,  4,  4,  4,
-    4,  4,  4,  4,  4, 14, 14, 14, 14, 14, 14, 14,  3,  3,  3,  3,
-    3,  0,  3,  3,  0,  3,  3,  3,  3,  3,  3,  0,  3,  3,  3,  1,
-    1,  1,  3,  3,  1,  3,  3,  3, 37, 37, 37, 37, 38, 38, 38, 38,
-   64, 64, 64, 64, 90, 90, 90, 90, 95, 95, 95, 95,  3,  3,  0,  3,
-    7,  7,  7,  7,  7,  1,  1,  1,  1,  7,  7,  7,  0,  0,  7,  7,
-    5,  5,  5,  5, 11, 11, 11, 11, 10, 10, 10, 10, 21, 21, 21, 21,
-   22, 22, 22, 22, 23, 23, 23, 23, 16, 16, 16, 16, 20, 20, 20, 20,
-   36, 36, 36, 36, 24, 24, 24, 24, 24, 24, 24,  0, 18, 18, 18, 18,
-   25, 25, 25, 25, 25,  0,  0,  0,  0, 25, 25, 25, 33, 33, 33, 33,
-    8,  8,  8,  8,  8,  8,  8,  0, 12, 12, 12, 12, 30, 30, 30, 30,
-   29, 29, 29, 29, 28, 28, 28, 28, 34, 34, 34, 34, 35, 35, 35, 35,
-   35, 35, 35,  0,  0,  0, 35, 35, 45, 45, 45, 45, 44, 44, 44, 44,
-   44,  0,  0,  0, 43, 43, 43, 43, 46, 46, 46, 46, 31, 31, 31, 31,
-   32, 32,  0,  0, 32,  0, 32, 32, 32, 32, 32, 32, 48, 48, 48, 48,
-   52, 52, 52, 52, 58, 58, 58, 58, 54, 54, 54, 54, 91, 91, 91, 91,
-   62, 62, 62, 62, 76, 76, 76, 76, 93, 93, 93, 93, 70, 70, 70, 70,
-   73, 73, 73, 73,  1,  1,  1,  0,  1,  0,  1,  1,  1,  0,  0,  0,
-    0,  1,  0,  0,  1,  1,  0,  0, 19, 19,  9,  9,  9,  9,  9,  6,
-   19,  9,  9,  9,  9,  9, 19, 19,  9,  9,  9, 19,  6, 19, 19, 19,
-   19, 19, 19,  9,  0,  0,  0, 19,  0,  0,  9,  0,  0,  0, 19, 19,
-   27, 27, 27, 27, 56, 56, 56, 56, 61, 61, 61, 61, 13, 13, 13, 13,
-    0, 13,  0, 13,  0, 13, 13, 13, 13, 13,  1,  1,  1,  1, 12, 12,
-    0, 15, 15, 15, 15, 15, 15, 15, 15,  1,  1,  0,  0, 17, 17, 17,
-   17, 17, 17, 17, 17, 17, 17,  0, 26, 26, 26, 26, 26, 12, 12, 12,
-   12, 12, 12,  0, 39, 39, 39, 39, 86, 86, 86, 86, 77, 77, 77, 77,
-   79, 79, 79, 79, 60, 60, 60, 60, 65, 65, 65, 65, 75, 75, 75, 75,
-   69, 69, 69, 69, 69, 69,  0, 69, 74, 74, 74, 74, 84, 84, 84, 84,
-   84, 84, 84,  0, 68, 68, 68, 68, 92, 92, 92, 92, 87, 87, 87, 87,
-   19,  9, 19, 19, 19, 19,  0,  0,  2,  2,  2,  2, 19, 19, 19,  4,
-    3,  3,  0,  0,  1,  1,  6,  6,  0,  0, 17, 17, 17, 17,  0,  0,
-   49, 49, 49, 49,  0,  1,  1,  1, 71, 71, 71, 71, 67, 67, 67, 67,
-   42, 42, 42, 42, 41, 41, 41, 41,118,118,118,118, 53, 53, 53, 53,
-   59, 59, 59, 59, 40, 40, 40, 40, 51, 51, 51, 51, 50, 50, 50, 50,
-  135,135,135,135,106,106,106,106,104,104,104,104,161,161,161,161,
+  219,219,219,219,220,220,220,220,221,221,221,221,222,222,222,222,
+  223,223,223,223,224,224,224,224,225,225,225,225,226,226,226,226,
+  227,227,227,227,228,229,229,229,230,230,230,230,229,229,229,229,
+  231,106,106,106,232,106,106,106,106,233,109,109,234,234,234,234,
+  235,235,235,235,  0,236, 86,  0,  0,  0,236,  7, 82,138,  7,  0,
+    0,  0,237, 86,238,238,238,238,239,239,239,239,240,240,240,240,
+  241,241,241,241,242,242,242,242,243,243,243,243,244,244,244,244,
+  245,245,245,245,246,  0,  0,  0,  0,  0,  0,  0,  0, 19, 19, 19,
+   19, 19, 19, 19, 19, 19, 19,  0,  0,  0, 19,  0, 19,  0,  0,  0,
+    0,  0, 26, 26,  1,  1,  1,  1,  9,  9,  9,  9,  0,  9,  9,  9,
+    9,  9,  0,  9,  9,  0,  9,  0,  9,  9, 55, 55, 55, 55, 55, 55,
+    6,  6,  6,  6,  6,  1,  1,  6,  6,  4,  4,  4,  4,  4,  4,  4,
+    4, 14, 14, 14, 14, 14, 14, 14,  3,  3,  3,  3,  3,  0,  3,  3,
+    0,  3,  3,  3,  3,  3,  3,  0,  3,  3,  3,  1,  1,  1,  3,  3,
+    1,  3,  3,  3, 37, 37, 37, 37, 38, 38, 38, 38, 64, 64, 64, 64,
+   90, 90, 90, 90, 95, 95, 95, 95,  3,  3,  0,  3,  7,  7,  7,  7,
+    7,  1,  1,  1,  1,  7,  7,  7,  0,  0,  7,  7,  5,  5,  5,  5,
+   11, 11, 11, 11, 10, 10, 10, 10, 21, 21, 21, 21, 22, 22, 22, 22,
+   23, 23, 23, 23, 16, 16, 16, 16, 20, 20, 20, 20, 36, 36, 36, 36,
+   24, 24, 24, 24, 24, 24, 24,  0, 18, 18, 18, 18, 25, 25, 25, 25,
+   25,  0,  0,  0,  0, 25, 25, 25, 33, 33, 33, 33,  8,  8,  8,  8,
+    8,  8,  8,  0, 12, 12, 12, 12, 30, 30, 30, 30, 29, 29, 29, 29,
+   28, 28, 28, 28, 34, 34, 34, 34, 35, 35, 35, 35, 35, 35, 35,  0,
+    0,  0, 35, 35, 45, 45, 45, 45, 44, 44, 44, 44, 44,  0,  0,  0,
+   43, 43, 43, 43, 46, 46, 46, 46, 31, 31, 31, 31, 32, 32,  0,  0,
+   32,  0, 32, 32, 32, 32, 32, 32, 48, 48, 48, 48, 52, 52, 52, 52,
+   58, 58, 58, 58, 54, 54, 54, 54, 91, 91, 91, 91, 62, 62, 62, 62,
+   76, 76, 76, 76, 93, 93, 93, 93, 70, 70, 70, 70, 73, 73, 73, 73,
+    1,  1,  1,  0,  1,  0,  1,  1,  1,  0,  0,  0,  0,  1,  0,  0,
+    1,  1,  0,  0, 19, 19,  9,  9,  9,  9,  9,  6, 19,  9,  9,  9,
+    9,  9, 19, 19,  9,  9,  9, 19,  6, 19, 19, 19, 19, 19, 19,  9,
+    0,  0,  0, 19,  0,  0,  9,  0,  0,  0, 19, 19, 27, 27, 27, 27,
+   56, 56, 56, 56, 61, 61, 61, 61, 13, 13, 13, 13,  0, 13,  0, 13,
+    0, 13, 13, 13, 13, 13,  1,  1,  1,  1, 12, 12,  0, 15, 15, 15,
+   15, 15, 15, 15, 15,  1,  1,  0,  0, 17, 17, 17, 17, 17, 17, 17,
+   17, 17, 17,  0, 26, 26, 26, 26, 26, 12, 12, 12, 12, 12, 12,  0,
+   39, 39, 39, 39, 86, 86, 86, 86, 77, 77, 77, 77, 79, 79, 79, 79,
+   60, 60, 60, 60, 65, 65, 65, 65, 75, 75, 75, 75, 69, 69, 69, 69,
+   69, 69,  0, 69, 74, 74, 74, 74, 84, 84, 84, 84, 84, 84, 84,  0,
+   68, 68, 68, 68, 92, 92, 92, 92, 87, 87, 87, 87, 19,  9, 19, 19,
+   19, 19,  0,  0,  2,  2,  2,  2, 19, 19, 19,  4,  3,  3,  0,  0,
+    1,  1,  6,  6,  0,  0, 17, 17, 17, 17,  0,  0, 49, 49, 49, 49,
+    0,  1,  1,  1, 71, 71, 71, 71, 67, 67, 67, 67, 42, 42, 42, 42,
+   41, 41, 41, 41,118,118,118,118, 53, 53, 53, 53, 59, 59, 59, 59,
+   40, 40, 40, 40, 51, 51, 51, 51, 50, 50, 50, 50,135,135,135,135,
+  106,106,106,106,104,104,104,104,161,161,161,161,170,170,170,170,
   110,110,110,110, 47, 47, 47, 47, 81, 81, 81, 81,120,120,120,120,
   116,116,116,116,128,128,128,128, 66, 66, 66, 66, 72, 72, 72, 72,
    98, 98, 98, 98, 97, 97, 97, 97, 57, 57, 57, 57, 88, 88, 88, 88,
   117,117,117,117,112,112,112,112, 78, 78, 78, 78, 83, 83, 83, 83,
    82, 82, 82, 82,122,122,122,122, 89, 89, 89, 89,130,130,130,130,
-  144,144,144,144,156,156,156,156,156,  3,  3,  3,147,147,147,147,
-  148,148,148,148,158,158,158,158,153,153,153,153,149,149,149,149,
-   94, 94, 94, 94, 85, 85, 85, 85,101,101,101,101, 96, 96, 96, 96,
-  111,111,111,111,100,100,100,100,100, 36, 36, 36,108,108,108,108,
-  129,129,129,129,109,109,109,109,107,107,107,107,107,107,107,  1,
-  137,137,137,137,124,124,124,124,123,123,123,123,114,114,114,114,
-  102,102,102,102,126,126,126,126,142,142,142,142,125,125,125,125,
-  154,154,154,154,150,150,150,150,141,141,141,141,140,140,140,140,
-  121,121,121,121,133,133,133,133,134,134,134,134,138,138,138,138,
-  143,143,143,143,145,145,145,145,163,163,163,163, 63, 63, 63, 63,
-  157,157,157,157, 80, 80, 80, 80,127,127,127,127,115,115,115,115,
-  159,159,159,159,103,103,103,103,119,119,119,119,146,146,146,146,
-   99, 99, 99, 99,136,139, 13, 13,155,155,155,155,136,136,136,136,
-   17, 15, 15, 15, 17, 17, 15, 15, 15, 17, 17, 17,139,139,139,139,
-  105,105,105,105,  0,  0,  0,  1,  0,  0,  1,  1,131,131,131,131,
-  151,151,151,151,160,160,160,160,152,152,152,152,164,164,164,164,
-  113,113,113,113,132,132,132,132, 15,  0,  0,  0,  0,  1,  2,  3,
-    4,  5,  6,  7,  8,  9,  9,  9,  9, 10,  9, 11, 12, 13,  9,  9,
-    9, 14,  9,  9, 15,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
+  144,144,144,144,165,165,165,165,156,156,156,156,156,156,  3,  3,
+  147,147,147,147,148,148,148,148,158,158,158,158,153,153,153,153,
+  149,149,149,149, 94, 94, 94, 94, 85, 85, 85, 85,101,101,101,101,
+   96, 96, 96, 96,111,111,111,111,100,100,100,100,100, 36, 36, 36,
+  108,108,108,108,129,129,129,129,109,109,109,109,107,107,107,107,
+  107,107,107,  1,171,171,171,171,137,137,137,137,124,124,124,124,
+  123,123,123,123,114,114,114,114,102,102,102,102,126,126,126,126,
+  142,142,142,142,125,125,125,125,154,154,154,154,150,150,150,150,
+  141,141,141,141,140,140,140,140,121,121,121,121,169,169,169,169,
+  133,133,133,133,134,134,134,134,138,138,138,138,143,143,143,143,
+  145,145,145,145,163,163,163,163, 63, 63, 63, 63,157,157,157,157,
+   80, 80, 80, 80,127,127,127,127,166,166,166,166,115,115,115,115,
+  159,159,159,159,103,103,103,103,119,119,119,119,167,167,167,167,
+  146,146,146,146, 99, 99, 99, 99,136,139, 13, 13,155,155,155,155,
+  136,136,136,136, 17, 15, 15, 15, 17, 17, 15, 15, 15, 17, 17, 17,
+  139,139,139,139,105,105,105,105,  0,  0,  0,  1,  0,  0,  1,  1,
+  131,131,131,131,151,151,151,151,160,160,160,160,152,152,152,152,
+  164,164,164,164,168,168,168,168,113,113,113,113,132,132,132,132,
+   15,  0,  0,  0,  0,  1,  2,  3,  4,  5,  6,  7,  8,  9,  9,  9,
+    9, 10,  9, 11, 12, 13,  9,  9,  9, 14,  9,  9, 15,  9,  9,  9,
     9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
     9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
     9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
     9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
     9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
-    9,  9,  9,  9,  9,  9,  9,  9, 16, 17,  9,  9,  9,  9,  9,  9,
-    9,  9,  9,  9, 18, 19, 20,  9, 21,  9,  9,  9,  9,  9,  9,  9,
     9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
+   16, 17,  9,  9,  9,  9, 18,  9,  9,  9,  9,  9, 19, 20, 21,  9,
+   22,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
     9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
+    9,  9,  9,  9, 23,  9,  9,  9,  9,  9, 24,  9,  9,  9,  9,  9,
     9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
     9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
+    9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9, 25,  9,  9,  9,
     9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
-    9,  9,  9,  9, 22,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
     9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
     9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
     9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
@@ -5223,60 +5451,66 @@ _hb_ucd_u8[13386] =
     9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
     9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
     9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,  9,
-    9,  9,  9,  9,  9,  9,  9,  9, 23, 24,  0,  0,  0,  0,  0,  0,
-    0,  0,  0,  0,  0,  0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10,
-   11, 12,  0,  0, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,  0,  0,
-    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 23,  0,
-    0, 24, 25, 26, 27, 28, 29, 30,  0,  0, 31, 32,  0, 33,  0, 34,
-    0, 35,  0,  0,  0,  0, 36, 37, 38, 39,  0,  0,  0,  0,  0,  0,
-    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 40,  0,  0,  0,
-    0,  0,  0,  0,  0,  0, 41, 42,  0,  0,  0,  0,  0,  0,  0,  0,
+   26, 27,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  2,
+    3,  4,  5,  6,  7,  8,  9, 10, 11, 12,  0,  0, 13, 14, 15, 16,
+   17, 18, 19, 20, 21, 22,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+    0,  0,  0,  0,  0,  0, 23,  0,  0, 24, 25, 26, 27, 28, 29, 30,
+    0,  0, 31, 32,  0, 33,  0, 34,  0, 35,  0,  0,  0,  0, 36, 37,
+   38, 39,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+    0,  0,  0,  0, 40,  0,  0,  0,  0,  0,  0,  0,  0,  0, 41, 42,
     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 43, 44,  0, 45,
-    0,  0,  0,  0,  0,  0, 46, 47,  0,  0,  0,  0,  0, 48,  0, 49,
-    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 50, 51,
-    0,  0,  0, 52,  0,  0, 53,  0,  0,  0,  0,  0,  0,  0, 54,  0,
-    0,  0,  0,  0,  0,  0, 55,  0,  0,  0,  0,  0,  0,  0, 56,  0,
-    0,  0,  0,  0,  0,  0,  0, 57,  0,  0,  0,  0,  0,  0,  0,  0,
-    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 58, 59,
-   60, 61, 62, 63, 64, 65,  0,  0,  0,  0,  0,  0, 66,  0,  0,  0,
     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+    0,  0,  0,  0, 43, 44,  0, 45,  0,  0,  0,  0,  0,  0, 46, 47,
+    0,  0,  0,  0,  0, 48,  0, 49,  0,  0,  0,  0,  0,  0,  0,  0,
+    0,  0,  0,  0,  0,  0, 50, 51,  0,  0,  0, 52,  0,  0, 53,  0,
+    0,  0,  0,  0,  0,  0, 54,  0,  0,  0,  0,  0,  0,  0, 55,  0,
+    0,  0,  0,  0,  0,  0, 56,  0,  0,  0,  0,  0,  0,  0,  0, 57,
     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+    0,  0,  0,  0,  0,  0, 58, 59, 60, 61, 62, 63, 64, 65,  0,  0,
+    0,  0,  0,  0, 66,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-    0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 67, 68,  0, 69, 70,  0,
-    0,  0,  0,  0,  0,  0,  0,  0,  0,  0, 71, 72, 73, 74, 75, 76,
-   77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
-   93, 94, 95, 96, 97, 98, 99,100,101,102,103,  0,  0,  0,  0,  0,
-    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,104,  0,  0,  0,
-    0,  0,  0,105,106,  0,107,  0,  0,  0,108,  0,109,  0,110,  0,
-  111,112,113,  0,114,  0,  0,  0,115,  0,  0,  0,116,  0,  0,  0,
     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-    0,  0,  0,  0,  0,  0,  0,117,  0,  0,  0,  0,  0,  0,  0,  0,
-    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,118,119,
-  120,121,  0,122,123,124,125,126,  0,127,  0,  0,  0,  0,  0,  0,
     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,128,129,130,131,132,133,
-  134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,
-  150,151,152,153,154,155,156,157,  0,  0,  0,158,159,160,161,  0,
+    0,  0, 67, 68,  0, 69, 70,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+    0,  0, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84,
+   85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99,100,
+  101,102,103,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+    0,  0,  0,  0,104,  0,  0,  0,  0,  0,  0,105,106,  0,107,  0,
+    0,  0,108,  0,109,  0,110,  0,111,112,113,  0,114,  0,  0,  0,
+  115,  0,  0,  0,116,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,117,
     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-    0,  0,  0,162,163,  0,  0,  0,  0,  0,  0,  0,164,  0,  0,  0,
+    0,  0,  0,  0,  0,  0,118,119,120,121,  0,122,123,124,125,126,
+    0,127,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,165,  0,
+    0,  0,128,129,130,131,132,133,134,135,136,137,138,139,140,141,
+  142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,
+    0,  0,  0,158,159,160,161,  0,  0,  0,  0,  0,  0,  0,  0,  0,
     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-    0,  0,  0,  0,  0,166,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-    0,  0,  0,  0,  0,167,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,168,  0,  0,
+    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,162,  0,
+  163,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,164,165,  0,  0,  0,
+    0,  0,  0,  0,166,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,169,
-  170,  0,  0,  0,  0,171,172,  0,  0,  0,173,174,175,176,177,178,
-  179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,
-  195,196,197,198,199,200,201,202,203,204,205,206,  0,  0,  0,  0,
+    0,  0,  0,  0,  0,  0,167,  0,  0,  0,168,169,  0,  0,170,  0,
+    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,171,  0,  0,
+    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,172,  0,  0,
     0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
-    0,  0,  0,  0,  0,  0,  1,  2,  3,  4,
+    0,  0,  0,  0,  0,173,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+    0,  0,  0,  0,174,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+    0,  0,  0,  0,  0,  0,  0,  0,175,  0,  0,  0,  0,  0,  0,  0,
+    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+    0,  0,  0,  0,  0,  0,  0,176,177,  0,  0,  0,  0,178,179,  0,
+    0,  0,180,181,182,183,184,185,186,187,188,189,190,191,192,193,
+  194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,
+  210,211,212,213,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,
+    0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  0,  1,  2,
+    3,  4,
 };
 static const uint16_t
-_hb_ucd_u16[4920] =
+_hb_ucd_u16[5080] =
 {
      0,   0,   1,   2,   3,   4,   5,   6,   0,   0,   7,   8,   9,  10,  11,  12,
     13,  13,  13,  14,  15,  13,  13,  16,  17,  18,  19,  20,  21,  22,  13,  23,
@@ -5303,82 +5537,85 @@ _hb_ucd_u16[4920] =
     47,  47, 165, 166, 167,  47,  47,  47,  47,  47,  47,  47,  47, 168, 146, 146,
     47, 169,  47,  47,  47, 170, 171, 172, 160, 160, 173, 174,  32,  32,  32,  32,
    175,  47,  47, 176, 177, 122, 178, 179, 180,  47, 181,  61,  47,  47, 182, 183,
-    47,  47, 184, 185, 186,  61,  47, 187,  11,   9,   9,   9,  66, 188, 189, 190,
-    11,  11, 191,  27,  27,  27, 192, 193,  11, 194,  27,  27,  32,  32,  32,  32,
-    13,  13,  13,  13,  13,  13,  13,  13,  13, 195,  13,  13,  13,  13,  13,  13,
-   196, 196, 196, 196, 196, 197, 196,  11, 198, 198, 198, 199, 200, 201, 201, 200,
-   202, 203, 204, 205, 206, 207, 208, 209, 210,  27, 211, 211, 211, 212, 213,  32,
-   214, 215, 216, 217, 218, 145, 219, 219, 220, 221, 222, 146, 223, 224, 146, 225,
-   226, 226, 226, 226, 226, 226, 226, 226, 227, 146, 228, 146, 146, 146, 146, 229,
-   146, 230, 226, 231, 146, 232, 233, 146, 146, 146, 146, 146, 146, 146, 145, 145,
-   145, 234, 146, 146, 146, 146, 235, 145, 146, 146, 146, 146, 146, 146, 146, 146,
-   146, 146, 146, 236, 237, 146, 146, 238, 146, 146, 146, 146, 146, 146, 239, 146,
-   146, 146, 146, 146, 146, 146, 240, 241, 145, 242, 146, 146, 243, 226, 244, 226,
-   245, 246, 226, 226, 226, 247, 226, 248, 146, 146, 146, 226, 249, 146, 146, 146,
-     9,   9,   9,  11,  11,  11, 250, 251,  13,  13,  13,  13,  13,  13, 252, 253,
-    11,  11,  11,  47,  47,  47, 254, 255,  47,  47,  47,  47,  47,  47,  32,  32,
-   256, 257, 258, 259, 260, 261, 262, 262, 263, 264, 265, 266, 267,  47,  47,  47,
-    47, 268, 148,  47,  47,  47,  47, 269,  47, 270,  47,  47, 146, 146, 146,  47,
-   146, 146, 271, 146, 272, 273, 146, 146, 271, 146, 146, 273, 146, 146, 146, 146,
-    47,  47,  47,  47, 146, 146, 146, 146,  47, 274,  47,  47,  47,  47,  47,  47,
-    47, 146, 146, 146, 146,  47,  47, 187, 275,  47,  61,  47,  13,  13, 276, 277,
-    13, 278,  47,  47,  47,  47, 279, 280,  31, 281, 282, 283,  13,  13,  13, 284,
-   285, 286, 287, 288, 289, 290,  11, 291, 292,  47, 293, 294,  47,  47,  47, 295,
-   296,  47,  47, 297, 298, 160,  32, 299,  61,  47, 300,  47, 301, 302,  47,  47,
-    72,  47,  47, 303, 304, 305, 306,  61,  47,  47, 307, 308, 309, 310,  47, 311,
-    47,  47,  47, 312,  58, 313, 314, 315,  47,  47,  47,  11,  11, 316, 317,  11,
-    11,  11,  11,  11,  47,  47, 318, 160, 319, 319, 319, 319, 319, 319, 319, 319,
-   320, 320, 320, 320, 320, 320, 320, 320,  11, 321, 322,  47,  47,  47,  47,  47,
-    47,  47,  47, 323,  31, 324,  47,  47,  47,  47,  47, 325, 146,  47,  47,  47,
-    47,  47,  47,  47, 326, 146, 146, 327,  32, 328,  32, 329, 330, 331, 332,  47,
-    47,  47,  47,  47,  47,  47,  47, 333, 334,   2,   3,   4,   5, 335, 336, 337,
-    47, 338,  47,  47,  47,  47, 339, 340, 341, 145, 145, 342, 219, 219, 219, 343,
-   344, 146, 146, 146, 146, 146, 146, 345, 346, 346, 346, 346, 346, 346, 346, 346,
-    47,  47,  47,  47,  47,  47, 347, 145,  47,  47, 348,  47, 349,  47,  47,  60,
-    47, 350,  47,  47,  47, 351, 219, 219,   9,   9, 147,  11,  11,  47,  47,  47,
-    47,  47, 160,   9,   9, 147,  11,  11,  47,  47,  47,  47,  47,  47, 350,   9,
-     9, 352,  11,  11,  11,  11,  11,  11,  27,  27,  27,  27,  27,  27,  27,  27,
-    47,  47,  47,  47,  47, 353,  47, 354,  47,  47, 355, 145, 145, 145,  47, 356,
-    47, 357,  47, 350,  66,  66,  66,  66,  47,  47,  47, 358, 145, 145, 145, 145,
-   359,  47,  47, 360, 145,  66,  47, 361,  47, 362, 145, 145, 363,  47, 364,  66,
-    47,  47,  47, 365,  47, 366,  47, 366,  47, 365, 144, 145, 145, 145, 145, 145,
-     9,   9,   9,   9,  11,  11,  11, 367,  47,  47, 368, 160, 160, 160, 160, 160,
-   145, 145, 145, 145, 145, 145, 145, 145,  47,  47, 369,  47,  47,  47,  47, 143,
-    47, 362, 370,  47,  60, 371,  66,  47, 372,  66,  66,  47, 373, 145,  47,  47,
-   374,  47,  47, 360, 375, 376, 377, 378, 180,  47,  47, 379, 380,  47,  47, 160,
-    97,  47, 381, 382, 383,  47,  47, 384, 180,  47,  47, 385, 386, 387, 388, 145,
-    47,  47, 389, 390, 359,  32,  32,  32,  47,  47, 365,  47,  47, 391, 172, 160,
-    92,  47,  47, 113, 392, 393, 394,  32,  47,  47,  47, 395, 396, 397,  47,  47,
-    47,  47,  47, 398, 399, 160, 160, 160,  47,  47, 400, 401, 402, 403,  32,  32,
-    47,  47,  47, 404, 405, 160,  66,  66,  47,  47, 406, 407, 160, 160, 160, 160,
-    47, 143, 408, 409,  47,  47,  47,  47,  47,  47, 389, 410,  66,  66,  66,  66,
-     9,   9,   9,   9,  11,  11, 128, 411,  47,  47,  47, 412, 413, 160, 160, 160,
-    47,  47,  47,  47,  47, 414, 415, 416, 417,  47,  47, 418, 419, 420,  47,  47,
-   421, 422,  66,  47,  47,  47,  47,  47,  66,  66,  66,  66,  66,  66,  66,  66,
-    47,  47, 400, 423, 424, 128, 145, 425,  47, 156, 426, 427,  32,  32,  32,  32,
-    47,  47,  47, 359, 428, 160,  47,  47, 429, 430, 160, 160, 160, 160, 160, 160,
-    47,  47,  47,  47,  47,  47,  47, 431, 432,  47,  47, 433, 434, 160, 160, 160,
-    47,  47,  47,  47, 145, 435, 436, 437, 219, 219, 219, 219, 219, 219, 219,  66,
-    47,  47,  47,  47,  47,  47,  47, 424,  47,  47,  47, 208, 438,  32,  32,  32,
-    47,  47,  47,  47,  47,  47, 305,  47,  47,  47,  47,  47, 160,  47,  47, 439,
-    47,  47,  47, 440, 441, 442, 443,  47,   9,   9,   9,   9,   9,   9,  11,  11,
-   145, 444,  66,  66,  66,  66,  66,  66,  47,  47,  47,  47, 391, 445, 416, 416,
-   446, 447,  27,  27,  27,  27, 448, 416,  47, 449, 208, 208, 208, 208, 208, 208,
-    32,  32,  32,  32,  32, 146, 146, 146, 146, 146, 146, 146, 146, 146, 450, 451,
-   452, 146, 453, 146, 146, 146, 146, 146, 146, 146, 146, 146, 454, 146, 146, 146,
-     9, 455,  11, 456, 457,  11, 196,   9, 458, 459,   9, 460,  11,   9, 455,  11,
-   456, 457,  11, 196,   9, 458, 459,   9, 460,  11,   9, 455,  11, 456, 457,  11,
-   196,   9, 458, 459,   9, 460,  11,   9, 455,  11, 196,   9, 461, 462, 463, 464,
-    11, 465,   9, 466, 467, 468, 469,  11, 470,   9, 471,  11, 472, 160, 160, 160,
-    32,  32,  32, 473,  32,  32, 474, 475, 476, 477,  32,  32,  32,  32,  32,  32,
-   478,  11,  11,  11,  11,  11,  11,  11,  32,  32,  32,  27,  27,  27,  27,  27,
-    32,  32,  32,  32,  32,  32,  32,  32,  47,  47,  47, 479, 480, 146, 146, 146,
-    47,  47, 481,  32,  47,  47, 482, 483,  47,  47,  47,  47,  47,  47, 484, 160,
-    47,  47,  47,  47, 355,  32,  32,  32,   9,   9, 458,  11, 485, 305,  66,  66,
-   145, 145, 486, 487, 145, 145, 145, 145, 145, 145, 488, 145, 145, 145, 145, 145,
-    47,  47,  47,  47,  47,  47,  47, 226, 489, 146, 146, 146, 146, 146, 146, 146,
-   146, 146, 146, 146, 146, 146, 146, 490, 146, 146, 146, 146, 146, 146, 146, 160,
-   208, 208, 208, 208, 208, 208, 208, 208,   0,   0,   0,   0,   0,   0,   0,   0,
+    47,  47, 184, 185, 186,  61,  47, 187, 188,   9,   9,   9,  66, 189, 190, 191,
+    11,  11, 192,  27,  27,  27, 193, 194,  11, 195,  27,  27,  32,  32,  32,  32,
+    13,  13,  13,  13,  13,  13,  13,  13,  13, 196,  13,  13,  13,  13,  13,  13,
+   197, 197, 197, 197, 197, 198, 197,  11, 199, 199, 199, 200, 201, 202, 202, 201,
+   203, 204, 205, 206, 207, 208, 209, 210, 211,  27, 212, 212, 212, 213, 214,  32,
+   215, 216, 217, 218, 219, 145, 220, 220, 221, 222, 223, 146, 224, 225, 146, 226,
+   227, 227, 227, 227, 227, 227, 227, 227, 228, 146, 229, 146, 146, 146, 146, 230,
+   146, 231, 227, 232, 146, 233, 234, 146, 146, 146, 146, 146, 146, 146, 145, 145,
+   145, 235, 146, 146, 146, 146, 236, 145, 146, 146, 146, 146, 146, 146, 146, 146,
+   146, 146, 146, 237, 238, 146, 146, 239, 146, 146, 146, 146, 146, 146, 240, 146,
+   146, 146, 146, 146, 146, 146, 241, 242, 145, 243, 146, 146, 244, 227, 245, 227,
+   246, 247, 227, 227, 227, 248, 227, 249, 146, 146, 146, 227, 250, 146, 146, 146,
+     9,   9,   9,  11,  11,  11, 251, 252,  13,  13,  13,  13,  13,  13, 253, 254,
+    11,  11,  11,  47,  47,  47, 255, 256,  47,  47,  47,  47,  47,  47,  32,  32,
+   257, 258, 259, 260, 261, 262, 263, 263, 264, 265, 266, 267, 268,  47,  47,  47,
+    47, 269, 148,  47,  47,  47,  47, 270,  47, 271,  47,  47, 146, 146, 146,  47,
+   146, 146, 272, 146, 273, 274, 146, 146, 272, 146, 146, 274, 146, 146, 146, 146,
+    47,  47,  47,  47, 146, 146, 146, 146,  47, 275,  47,  47,  47,  47,  47,  47,
+    47, 146, 146, 146, 146,  47,  47, 187, 276,  47,  61,  47,  13,  13, 277, 278,
+    13, 279,  47,  47,  47,  47, 280, 281,  31, 282, 283, 284,  13,  13,  13, 285,
+   286, 287, 288, 289, 290, 291,   9, 292, 293,  47, 294, 295,  47,  47,  47, 296,
+   297,  47,  47, 298, 299, 160,  32, 300,  61,  47, 301,  47, 302, 303,  47,  47,
+    72,  47,  47, 304, 305, 306, 307,  61,  47,  47, 308, 309, 310, 311,  47, 312,
+    47,  47,  47, 313,  58, 314, 315, 316,  47,  47,  47,  11,  11, 317, 318,  11,
+    11,  11,  11,  11,  47,  47, 319, 160, 320, 320, 320, 320, 320, 320, 320, 320,
+   321, 321, 321, 321, 321, 321, 321, 321,  11, 322, 323,  47,  47,  47,  47,  47,
+    47,  47,  47, 324,  31, 325,  47,  47,  47,  47,  47, 326, 146,  47,  47,  47,
+    47,  47,  47,  47, 327, 146, 146, 328,  32, 329,  32, 330, 331, 332, 333,  47,
+    47,  47,  47,  47,  47,  47,  47, 334, 335,   2,   3,   4,   5, 336, 337, 338,
+    47, 339,  47,  47,  47,  47, 340, 341, 342, 145, 145, 343, 220, 220, 220, 344,
+   345, 146, 146, 146, 146, 146, 146, 346, 347, 347, 347, 347, 347, 347, 347, 347,
+    47,  47,  47,  47,  47,  47, 348, 145,  47,  47, 349,  47, 350,  47,  47,  60,
+    47, 351,  47,  47,  47, 352, 220, 220,   9,   9, 147,  11,  11,  47,  47,  47,
+    47,  47, 160,   9,   9, 147,  11,  11,  47,  47,  47,  47,  47,  47, 351,   9,
+     9, 353,  11,  11,  47,  47,  47,  47,  27,  27,  27,  27,  27,  27,  27,  27,
+    47,  47,  47,  47,  47, 354,  47, 355,  47,  47, 356, 145, 145, 145,  47, 357,
+    47, 358,  47, 351,  66,  66,  66,  66,  47,  47,  47, 359, 145, 145, 145, 145,
+   360,  47,  47, 361, 145,  66,  47, 362,  47, 363, 145, 145, 364,  47, 365,  66,
+    47,  47,  47, 366,  47, 367,  47, 367,  47, 366, 144, 145, 145, 145, 145, 145,
+     9,   9,   9,   9,  11,  11,  11, 368,  47,  47, 369, 160, 370,   9, 371,  11,
+   372, 227, 227, 227, 227, 227, 227, 227, 145, 145, 145, 145, 145, 145, 145, 145,
+    47,  47, 373,  47,  47,  47,  47, 374,  47, 363, 375,  47,  60, 376,  66,  47,
+   377,  66,  66,  47, 378, 145,  47,  47, 379,  47,  47, 361, 380, 381, 382, 383,
+   180,  47,  47, 384, 385,  47,  47, 160,  97,  47, 386, 387, 388,  47,  47, 389,
+   180,  47,  47, 390, 391, 392, 393, 145,  47,  47, 394, 395, 360,  32,  32,  32,
+    47,  47, 366,  47,  47, 396, 172, 160,  92,  47,  47, 113, 397, 398, 399,  32,
+    47,  47,  47, 400, 401, 402, 403,  32,  47,  47,  47, 404, 405, 406,  47,  47,
+    47,  47,  47, 407, 408, 160, 160, 160,  47,  47, 409, 410, 411, 412,  32,  32,
+    47,  47,  47, 413, 414, 160,  66,  66,  47,  47, 415, 416, 160, 160, 160, 160,
+    47, 417, 418, 419,  47,  47,  47,  47,  47,  47, 394, 420,  66,  66,  66,  66,
+     9,   9,   9,   9,  11,  11, 128, 421,  47,  47,  47, 422, 423, 160, 160, 160,
+    47,  47,  47,  47,  47, 424, 425, 426, 427,  47,  47, 428, 429, 430,  47,  47,
+   431, 432,  66,  47,  47,  47,  47,  47,  66,  66,  66,  66,  66,  66,  66,  66,
+    47,  47,  47,  47,  47,  47, 433, 160,  47,  47, 409, 434, 433, 128, 145, 435,
+    47, 156, 436, 437,  32,  32,  32,  32,  47,  47,  47, 360, 438, 160,  47,  47,
+   439, 440, 160, 160, 160, 160, 160, 160,  47,  47,  47,  47,  47,  47,  47, 441,
+   442,  47,  47, 443, 444, 445,  32,  32,  47,  47,  47,  47, 145, 446, 447, 448,
+   220, 220, 220, 220, 220, 220, 220,  66,  47,  47,  47,  47,  47,  47,  47, 433,
+    47,  47,  47, 209, 449,  32,  47,  47,  47, 450, 451, 160, 160, 160, 160, 160,
+    47,  47,  47,  47,  47,  47, 306,  47,  47,  47,  47,  47, 160,  47,  47, 452,
+    47,  47,  47, 453, 454, 455, 456,  47,  27,  27,  27,  27, 457,  47, 458, 160,
+     9,   9,   9,   9,   9,   9,  11,  11, 145, 459,  66,  66,  66,  66,  66,  66,
+    47,  47,  47,  47, 396, 460, 426, 426, 461, 462,  27,  27,  27,  27, 463, 426,
+    47, 464, 209, 209, 209, 209, 209, 209, 146, 146, 146, 146, 146, 146, 146, 160,
+    32,  32,  32,  32,  32, 146, 146, 146, 146, 146, 146, 146, 146, 146, 465, 466,
+   467, 146, 468, 146, 146, 146, 146, 146, 146, 146, 146, 146, 469, 146, 146, 146,
+     9, 470,  11, 471, 472,  11, 197,   9, 473, 474,   9, 475,  11,   9, 470,  11,
+   471, 472,  11, 197,   9, 473, 474,   9, 475,  11,   9, 470,  11, 471, 472,  11,
+   197,   9, 473, 474,   9, 475,  11,   9, 470,  11, 197,   9, 476, 477, 478, 479,
+    11, 480,   9, 481, 482, 483, 484,  11, 485,   9, 486,  11, 487, 160, 160, 160,
+    32,  32,  32, 488,  32,  32, 489, 490, 491, 492,  32,  32,  32,  32,  32,  32,
+   493,  11,  11,  11,  11,  11,  11,  11,  32,  32,  32,  27,  27,  27,  27,  27,
+    32,  32,  32,  32,  32,  32,  32,  32,  47,  47,  47, 494, 495, 146, 146, 146,
+    47,  47, 450,  32,  47,  47, 374, 496,  47,  47,  47,  47,  47,  47, 497, 160,
+    47,  47,  47,  47,  47,  47, 450, 498,  47,  47,  47,  47, 356,  32,  32,  32,
+     9,   9, 473,  11, 499, 306,  66,  66, 145, 145, 500, 501, 145, 145, 145, 145,
+   145, 145, 502, 145, 145, 145, 145, 145,  47,  47,  47,  47,  47,  47,  47, 227,
+   503, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 146, 504,
+   209, 209, 209, 209, 209, 209, 209, 209,   0,   0,   0,   0,   0,   0,   0,   0,
      0,   0,   0,   0,   0,   0,   0,   0, 939, 940, 941, 942, 946, 948,   0, 962,
    969, 970, 971, 976,1001,1002,1003,1008,   0,1033,1040,1041,1042,1043,1047,   0,
      0,1080,1081,1082,1086,1110,   0,   0,1124,1125,1126,1127,1131,1133,   0,1147,
@@ -5541,16 +5778,23 @@ _hb_ucd_u16[4920] =
      0,   0,1602,1603,1934,1935,1574,1575,1576,1577,1579,1580,1581,1583,1584,   0,
   1585,1587,1588,1589,1591,   0,1592,   0,1593,1594,   0,1595,1596,   0,1598,1599,
   1600,1601,1604,1582,1578,1590,1597,   0,   0,   0,   0,   0,   0,   0,   0,   0,
-     0,   0,1936,   0,1937,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
-     0,   0,   0,1938,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
-     0,   0,   0,   0,   0,   0,1939,1940,   0,   0,   0,   0,   0,   0,   0,   0,
-     0,   0,   0,1941,1942,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
-     0,   0,   0,1944,1943,   0,1945,   0,   0,   0,   0,   0,   0,   0,   0,   0,
-     0,   0,1946,1947,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
-  1948,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
-     0,   0,   0,   0,   0,   0,1949,1950,1951,1952,1953,1954,1955,   0,   0,   0,
+     0,1936,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,1937,   0,   0,   0,
+     0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+     0,   0,1938,   0,1939,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+     0,   0,   0,1940,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+     0,   0,   0,   0,   0,   0,1941,1942,   0,   0,   0,   0,   0,   0,   0,   0,
+     0,   0,   0,1943,1944,   0,   0,   0,   0,   0,   0,1945,   0,1946,   0,   0,
+     0,   0,   0,   0,   0,   0,1947,   0,   0,1948,   0,   0,   0,   0,   0,   0,
+     0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,1950,   0,1949,
+  1951,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+     0,   0,   0,1953,1952,   0,1954,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+     0,   0,1955,1956,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+  1957,   0,   0,   0,   0,   0,   0,   0,   0,1958,1961,1959,1965,1960,1962,1964,
+  1963,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+  1967,1966,1968,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
+     0,   0,   0,   0,   0,   0,1969,1970,1971,1972,1973,1974,1975,   0,   0,   0,
      0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,   0,
-     0,   0,   0,1956,1957,1958,1960,1959,1961,   0,   0,   0,   0,   0,   0,   0,
+     0,   0,   0,1976,1977,1978,1980,1979,1981,   0,   0,   0,   0,   0,   0,   0,
      0,   0,   0,   0,   0,   0,   0,   0, 106, 104, 107, 826, 114, 118, 119, 121,
    123, 124, 127, 125,  34, 830, 130, 131, 132, 137, 827,  35, 133, 139, 829, 142,
    143, 112, 144, 145, 924, 151, 152,  37, 157, 158, 159, 160,  38, 165, 166, 169,
@@ -5601,12 +5845,12 @@ _hb_ucd_i16[92] =
 static inline uint_fast8_t
 _hb_ucd_gc (unsigned u)
 {
-  return u<1114112u?_hb_ucd_u8[5096+(((_hb_ucd_u8[1168+(((_hb_ucd_u16[((_hb_ucd_u8[544+(((_hb_ucd_u8[u>>1>>3>>3>>4])<<4)+((u>>1>>3>>3)&15u))])<<3)+((u>>1>>3)&7u)])<<3)+((u>>1)&7u))])<<1)+((u)&1u))]:2;
+  return u<1114112u?_hb_ucd_u8[5208+(((_hb_ucd_u8[1168+(((_hb_ucd_u16[((_hb_ucd_u8[544+(((_hb_ucd_u8[u>>1>>3>>3>>4])<<4)+((u>>1>>3>>3)&15u))])<<3)+((u>>1>>3)&7u)])<<3)+((u>>1)&7u))])<<1)+((u)&1u))]:2;
 }
 static inline uint_fast8_t
 _hb_ucd_ccc (unsigned u)
 {
-  return u<125259u?_hb_ucd_u8[7054+(((_hb_ucd_u8[6498+(((_hb_ucd_u8[6038+(((_hb_ucd_u8[5686+(((_hb_ucd_u8[5440+(u>>2>>2>>2>>3)])<<3)+((u>>2>>2>>2)&7u))])<<2)+((u>>2>>2)&3u))])<<2)+((u>>2)&3u))])<<2)+((u)&3u))]:0;
+  return u<125259u?_hb_ucd_u8[7206+(((_hb_ucd_u8[6638+(((_hb_ucd_u8[6162+(((_hb_ucd_u8[5802+(((_hb_ucd_u8[5556+(u>>2>>2>>2>>3)])<<3)+((u>>2>>2>>2)&7u))])<<2)+((u>>2>>2)&3u))])<<2)+((u>>2)&3u))])<<2)+((u)&3u))]:0;
 }
 static inline unsigned
 _hb_ucd_b4 (const uint8_t* a, unsigned i)
@@ -5616,17 +5860,17 @@ _hb_ucd_b4 (const uint8_t* a, unsigned i)
 static inline int_fast16_t
 _hb_ucd_bmg (unsigned u)
 {
-  return u<65380u?_hb_ucd_i16[((_hb_ucd_u8[7946+(((_hb_ucd_u8[7714+(((_hb_ucd_u8[7618+(((_hb_ucd_b4(7554+_hb_ucd_u8,u>>1>>2>>3>>3))<<3)+((u>>1>>2>>3)&7u))])<<3)+((u>>1>>2)&7u))])<<2)+((u>>1)&3u))])<<1)+((u)&1u)]:0;
+  return u<65380u?_hb_ucd_i16[((_hb_ucd_u8[8098+(((_hb_ucd_u8[7866+(((_hb_ucd_u8[7770+(((_hb_ucd_b4(7706+_hb_ucd_u8,u>>1>>2>>3>>3))<<3)+((u>>1>>2>>3)&7u))])<<3)+((u>>1>>2)&7u))])<<2)+((u>>1)&3u))])<<1)+((u)&1u)]:0;
 }
 static inline uint_fast8_t
 _hb_ucd_sc (unsigned u)
 {
-  return u<918016u?_hb_ucd_u8[11244+(((_hb_ucd_u8[10280+(((_hb_ucd_u8[9292+(((_hb_ucd_u8[8612+(((_hb_ucd_u8[8308+(((_hb_ucd_u8[8194+(u>>2>>2>>2>>3>>4)])<<4)+((u>>2>>2>>2>>3)&15u))])<<3)+((u>>2>>2>>2)&7u))])<<2)+((u>>2>>2)&3u))])<<2)+((u>>2)&3u))])<<2)+((u)&3u))]:2;
+  return u<918016u?_hb_ucd_u8[11464+(((_hb_ucd_u8[10472+(((_hb_ucd_u8[9452+(((_hb_ucd_u8[8764+(((_hb_ucd_u8[8460+(((_hb_ucd_u8[8346+(u>>2>>2>>2>>3>>4)])<<4)+((u>>2>>2>>2>>3)&15u))])<<3)+((u>>2>>2>>2)&7u))])<<2)+((u>>2>>2)&3u))])<<2)+((u>>2)&3u))])<<2)+((u)&3u))]:2;
 }
 static inline uint_fast16_t
 _hb_ucd_dm (unsigned u)
 {
-  return u<195102u?_hb_ucd_u16[1608+(((_hb_ucd_u8[12586+(((_hb_ucd_u8[12204+(u>>4>>5)])<<5)+((u>>4)&31u))])<<4)+((u)&15u))]:0;
+  return u<195102u?_hb_ucd_u16[1656+(((_hb_ucd_u8[12834+(((_hb_ucd_u8[12452+(u>>4>>5)])<<5)+((u>>4)&31u))])<<4)+((u)&15u))]:0;
 }
 
 #endif
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-unicode-emoji-table.hh b/src/java.desktop/share/native/libharfbuzz/hb-unicode-emoji-table.hh
index e607e8ca8290..4bc8d64c28f8 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-unicode-emoji-table.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-unicode-emoji-table.hh
@@ -7,13 +7,13 @@
  * on file with this header:
  *
  * # emoji-data.txt
- * # Date: 2023-02-01, 02:22:54 GMT
- * # © 2023 Unicode®, Inc.
+ * # Date: 2024-05-01, 21:25:24 GMT
+ * # © 2024 Unicode®, Inc.
  * # Unicode and the Unicode Logo are registered trademarks of Unicode, Inc. in the U.S. and other countries.
- * # For terms of use, see https://www.unicode.org/terms_of_use.html
+ * # For terms of use and license, see https://www.unicode.org/terms_of_use.html
  * #
  * # Emoji Data for UTS #51
- * # Used with Emoji Version 15.1 and subsequent minor revisions (if any)
+ * # Used with Emoji Version 16.0 and subsequent minor revisions (if any)
  * #
  * # For documentation and usage, see https://www.unicode.org/reports/tr51
  */
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-utf.hh b/src/java.desktop/share/native/libharfbuzz/hb-utf.hh
index 9175df265b9d..7fd3bf8828b2 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-utf.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-utf.hh
@@ -458,19 +458,21 @@ struct hb_ascii_t
 template 
 static inline const typename utf_t::codepoint_t *
 hb_utf_offset_to_pointer (const typename utf_t::codepoint_t *start,
+                          const typename utf_t::codepoint_t *text,
+                          unsigned text_len,
                           signed offset)
 {
   hb_codepoint_t unicode;
 
   while (offset-- > 0)
     start = utf_t::next (start,
-                         start + utf_t::max_len,
+                         text + text_len,
                          &unicode,
                          HB_BUFFER_REPLACEMENT_CODEPOINT_DEFAULT);
 
   while (offset++ < 0)
     start = utf_t::prev (start,
-                         start - utf_t::max_len,
+                         text,
                          &unicode,
                          HB_BUFFER_REPLACEMENT_CODEPOINT_DEFAULT);
 
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-vector.hh b/src/java.desktop/share/native/libharfbuzz/hb-vector.hh
index 001789a3037b..7e755818ddd3 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-vector.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb-vector.hh
@@ -37,6 +37,8 @@ template 
 struct hb_vector_t
 {
+  static constexpr bool realloc_move = true;
+
   typedef Type item_t;
   static constexpr unsigned item_size = hb_static_size (Type);
   using array_t = typename std::conditional, hb_array_t>::type;
@@ -51,32 +53,29 @@ struct hb_vector_t
   }
   template 
-  hb_vector_t (const Iterable &o) : hb_vector_t ()
+  explicit hb_vector_t (const Iterable &o) : hb_vector_t ()
   {
-    auto iter = hb_iter (o);
-    if (iter.is_random_access_iterator || iter.has_fast_len)
-      alloc (hb_len (iter), true);
-    hb_copy (iter, *this);
+    extend (o);
   }
   hb_vector_t (const hb_vector_t &o) : hb_vector_t ()
   {
-    alloc (o.length, true);
+    alloc_exact (o.length);
     if (unlikely (in_error ())) return;
     copy_array (o.as_array ());
   }
   hb_vector_t (array_t o) : hb_vector_t ()
   {
-    alloc (o.length, true);
+    alloc_exact (o.length);
     if (unlikely (in_error ())) return;
     copy_array (o);
   }
   hb_vector_t (c_array_t o) : hb_vector_t ()
   {
-    alloc (o.length, true);
+    alloc_exact (o.length);
     if (unlikely (in_error ())) return;
     copy_array (o);
   }
-  hb_vector_t (hb_vector_t &&o)
+  hb_vector_t (hb_vector_t &&o) noexcept
   {
     allocated = o.allocated;
     length = o.length;
@@ -85,6 +84,35 @@ struct hb_vector_t
   }
   ~hb_vector_t () { fini (); }
 
+  template 
+  void extend (const Iterable &o)
+  {
+    auto iter = hb_iter (o);
+    if (iter.is_random_access_iterator || iter.has_fast_len)
+      alloc (hb_len (iter), true);
+    while (iter)
+    {
+      if (unlikely (!alloc (length + 1)))
+        return;
+      unsigned room = allocated - length;
+      for (unsigned i = 0; i < room && iter; i++)
+        push_has_room (*iter++);
+    }
+  }
+  void extend (array_t o)
+  {
+    alloc (length + o.length);
+    if (unlikely (in_error ())) return;
+    copy_array (o);
+  }
+  void extend (c_array_t o)
+  {
+    alloc (length + o.length);
+    if (unlikely (in_error ())) return;
+    copy_array (o);
+  }
+
   public:
   int allocated = 0; /* < 0 means allocation failed. */
   unsigned int length = 0;
@@ -120,7 +148,7 @@ struct hb_vector_t
     resize (0);
   }
 
-  friend void swap (hb_vector_t& a, hb_vector_t& b)
+  friend void swap (hb_vector_t& a, hb_vector_t& b) noexcept
   {
     hb_swap (a.allocated, b.allocated);
     hb_swap (a.length, b.length);
@@ -130,14 +158,15 @@ struct hb_vector_t
   hb_vector_t& operator = (const hb_vector_t &o)
   {
     reset ();
-    alloc (o.length, true);
+    alloc_exact (o.length);
     if (unlikely (in_error ())) return *this;
 
+    length = 0;
     copy_array (o.as_array ());
 
     return *this;
   }
-  hb_vector_t& operator = (hb_vector_t &&o)
+  hb_vector_t& operator = (hb_vector_t &&o) noexcept
   {
     hb_swap (*this, o);
     return *this;
@@ -216,6 +245,10 @@ struct hb_vector_t
       // reference to it.
       return std::addressof (Crap (Type));
 
+    return push_has_room (std::forward (args)...);
+  }
+  template  Type *push_has_room (Args&&... args)
+  {
     /* Emplace. */
     Type *p = std::addressof (arrayZ[length++]);
     return new (p) Type (std::forward (args)...);
@@ -268,10 +301,9 @@ struct hb_vector_t
     }
     return new_array;
   }
-  /* Specialization for hb_vector_t> to speed up. */
+  /* Specialization for types that can be moved using realloc(). */
   template ) ||
-                          hb_is_same (T, hb_array_t ))>
+            hb_enable_if (T::realloc_move)>
   Type *
   realloc_vector (unsigned new_allocated, hb_priority<1>)
   {
@@ -310,18 +342,23 @@ struct hb_vector_t
     length = size;
   }
 
+  template 
+  void
+  copy_array (hb_array_t other)
+  {
+    assert ((int) (length + other.length) <= allocated);
+    hb_memcpy ((void *) (arrayZ + length), (const void *) other.arrayZ, other.length * item_size);
+    length += other.length;
+  }
   template 
   void
   copy_array (hb_array_t other)
   {
-    length = other.length;
-    if (!HB_OPTIMIZE_SIZE_VAL && sizeof (T) >= sizeof (long long))
-      /* This runs faster because of alignment. */
-      for (unsigned i = 0; i < length; i++)
-        arrayZ[i] = other.arrayZ[i];
-    else
-       hb_memcpy ((void *) arrayZ, (const void *) other.arrayZ, length * item_size);
+    assert ((int) (length + other.length) <= allocated);
+    hb_memcpy ((void *) (arrayZ + length), (const void *) other.arrayZ, other.length * item_size);
+    length += other.length;
   }
   template  other)
   {
-    length = 0;
-    while (length < other.length)
-    {
-      length++;
-      new (std::addressof (arrayZ[length - 1])) Type (other.arrayZ[length - 1]);
-    }
+    assert ((int) (length + other.length) <= allocated);
+    for (unsigned i = 0; i < other.length; i++)
+      new (std::addressof (arrayZ[length + i])) Type (other.arrayZ[i]);
+    length += other.length;
   }
   template  other)
   {
-    length = 0;
-    while (length < other.length)
+    assert ((int) (length + other.length) <= allocated);
+    for (unsigned i = 0; i < other.length; i++)
     {
-      length++;
-      new (std::addressof (arrayZ[length - 1])) Type ();
-      arrayZ[length - 1] = other.arrayZ[length - 1];
+      new (std::addressof (arrayZ[length + i])) Type ();
+      arrayZ[length + i] = other.arrayZ[i];
     }
+    length += other.length;
   }
 
   void
@@ -431,6 +466,15 @@ struct hb_vector_t
 
     return true;
   }
+  bool alloc_exact (unsigned int size)
+  {
+    return alloc (size, true);
+  }
+
+  void clear ()
+  {
+    resize (0);
+  }
 
   bool resize (int size_, bool initialize = true, bool exact = false)
   {
@@ -496,7 +540,7 @@ struct hb_vector_t
     shrink_vector (size);
 
     if (shrink_memory)
-      alloc (size, true); /* To force shrinking memory if needed. */
+      alloc_exact (size); /* To force shrinking memory if needed. */
   }
 
 
diff --git a/src/java.desktop/share/native/libharfbuzz/hb-version.h b/src/java.desktop/share/native/libharfbuzz/hb-version.h
index 3627da3bf0ce..01edf174350b 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb-version.h
+++ b/src/java.desktop/share/native/libharfbuzz/hb-version.h
@@ -41,26 +41,26 @@ HB_BEGIN_DECLS
  *
  * The major component of the library version available at compile-time.
  */
-#define HB_VERSION_MAJOR 8
+#define HB_VERSION_MAJOR 10
 /**
  * HB_VERSION_MINOR:
  *
  * The minor component of the library version available at compile-time.
  */
-#define HB_VERSION_MINOR 2
+#define HB_VERSION_MINOR 4
 /**
  * HB_VERSION_MICRO:
  *
  * The micro component of the library version available at compile-time.
  */
-#define HB_VERSION_MICRO 2
+#define HB_VERSION_MICRO 0
 
 /**
  * HB_VERSION_STRING:
  *
  * A string literal containing the library version available at compile-time.
  */
-#define HB_VERSION_STRING "8.2.2"
+#define HB_VERSION_STRING "10.4.0"
 
 /**
  * HB_VERSION_ATLEAST:
diff --git a/src/java.desktop/share/native/libharfbuzz/hb.hh b/src/java.desktop/share/native/libharfbuzz/hb.hh
index 65d2dd58a203..fee1c9cd663b 100644
--- a/src/java.desktop/share/native/libharfbuzz/hb.hh
+++ b/src/java.desktop/share/native/libharfbuzz/hb.hh
@@ -64,6 +64,7 @@
 #pragma GCC diagnostic error   "-Wbitwise-instead-of-logical"
 #pragma GCC diagnostic error   "-Wcast-align"
 #pragma GCC diagnostic error   "-Wcast-function-type"
+#pragma GCC diagnostic error   "-Wcast-function-type-strict"
 #pragma GCC diagnostic error   "-Wconstant-conversion"
 #pragma GCC diagnostic error   "-Wcomma"
 #pragma GCC diagnostic error   "-Wdelete-non-virtual-dtor"
@@ -83,6 +84,7 @@
 #pragma GCC diagnostic error   "-Wredundant-decls"
 #pragma GCC diagnostic error   "-Wreorder"
 #pragma GCC diagnostic error   "-Wsign-compare"
+#pragma GCC diagnostic error   "-Wstrict-flex-arrays"
 #pragma GCC diagnostic error   "-Wstrict-prototypes"
 #pragma GCC diagnostic error   "-Wstring-conversion"
 #pragma GCC diagnostic error   "-Wswitch-enum"
@@ -129,6 +131,7 @@
 #pragma GCC diagnostic ignored "-Wclass-memaccess"
 #pragma GCC diagnostic ignored "-Wcast-function-type-strict" // https://github.com/harfbuzz/harfbuzz/pull/3859#issuecomment-1295409126
 #pragma GCC diagnostic ignored "-Wdangling-reference" // https://github.com/harfbuzz/harfbuzz/issues/4043
+#pragma GCC diagnostic ignored "-Wdangling-pointer" // Trigerred by hb_decycler_node_t().
 #pragma GCC diagnostic ignored "-Wformat-nonliteral"
 #pragma GCC diagnostic ignored "-Wformat-zero-length"
 #pragma GCC diagnostic ignored "-Wmissing-field-initializers"
@@ -177,6 +180,11 @@
 #define HB_EXTERN __declspec (dllexport) extern
 #endif
 
+// https://github.com/harfbuzz/harfbuzz/pull/4619
+#ifndef __STDC_FORMAT_MACROS
+#define __STDC_FORMAT_MACROS 1
+#endif
+
 #include "hb.h"
 #define HB_H_IN
 #include "hb-ot.h"
@@ -212,6 +220,12 @@
 #include 
 #endif
 
+#ifndef PRId32
+# define PRId32 "d"
+# define PRIu32 "u"
+# define PRIx32 "x"
+#endif
+
 #define HB_PASTE1(a,b) a##b
 #define HB_PASTE(a,b) HB_PASTE1(a,b)
 
@@ -268,7 +282,9 @@ extern "C" void  hb_free_impl(void *ptr);
 #define __attribute__(x)
 #endif
 
-#if defined(__GNUC__) && (__GNUC__ >= 3)
+#if defined(__MINGW32__) && (__GNUC__ >= 3)
+#define HB_PRINTF_FUNC(format_idx, arg_idx) __attribute__((__format__ (gnu_printf, format_idx, arg_idx)))
+#elif defined(__GNUC__) && (__GNUC__ >= 3)
 #define HB_PRINTF_FUNC(format_idx, arg_idx) __attribute__((__format__ (__printf__, format_idx, arg_idx)))
 #else
 #define HB_PRINTF_FUNC(format_idx, arg_idx)
diff --git a/src/java.desktop/share/native/liblcms/cmsalpha.c b/src/java.desktop/share/native/liblcms/cmsalpha.c
index 78d3ca6b6715..2e50b65be24c 100644
--- a/src/java.desktop/share/native/liblcms/cmsalpha.c
+++ b/src/java.desktop/share/native/liblcms/cmsalpha.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2023 Marti Maria Saguer
+//  Copyright (c) 1998-2024 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -612,8 +612,8 @@ void _cmsHandleExtraChannels(_cmsTRANSFORM* p, const void* in,
         cmsUInt8Number* SourcePtr;
         cmsUInt8Number* DestPtr;
 
-        cmsUInt32Number SourceStrideIncrement = 0;
-        cmsUInt32Number DestStrideIncrement = 0;
+        size_t SourceStrideIncrement = 0;
+        size_t DestStrideIncrement = 0;
 
         // The loop itself
         for (i = 0; i < LineCount; i++) {
@@ -640,8 +640,8 @@ void _cmsHandleExtraChannels(_cmsTRANSFORM* p, const void* in,
         cmsUInt8Number* SourcePtr[cmsMAXCHANNELS];
         cmsUInt8Number* DestPtr[cmsMAXCHANNELS];
 
-        cmsUInt32Number SourceStrideIncrements[cmsMAXCHANNELS];
-        cmsUInt32Number DestStrideIncrements[cmsMAXCHANNELS];
+        size_t SourceStrideIncrements[cmsMAXCHANNELS];
+        size_t DestStrideIncrements[cmsMAXCHANNELS];
 
         memset(SourceStrideIncrements, 0, sizeof(SourceStrideIncrements));
         memset(DestStrideIncrements, 0, sizeof(DestStrideIncrements));
diff --git a/src/java.desktop/share/native/liblcms/cmscam02.c b/src/java.desktop/share/native/liblcms/cmscam02.c
index 71a48d43de4a..45ef4eef970c 100644
--- a/src/java.desktop/share/native/liblcms/cmscam02.c
+++ b/src/java.desktop/share/native/liblcms/cmscam02.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2023 Marti Maria Saguer
+//  Copyright (c) 1998-2024 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -117,17 +117,16 @@ cmsFloat64Number computeFL(cmsCIECAM02* pMod)
     return FL;
 }
 
-static
-cmsFloat64Number computeD(cmsCIECAM02* pMod)
+static cmsFloat64Number computeD(cmsCIECAM02* pMod)
 {
-    cmsFloat64Number D;
+    cmsFloat64Number D, temp;
 
-    D = pMod->F - (1.0/3.6)*(exp(((-pMod ->LA-42) / 92.0)));
+    temp = 1.0 - ((1.0 / 3.6) * exp((-pMod->LA - 42) / 92.0));
 
+    D = pMod->F * temp;
     return D;
 }
 
-
 static
 CAM02COLOR XYZtoCAT02(CAM02COLOR clr)
 {
diff --git a/src/java.desktop/share/native/liblcms/cmscgats.c b/src/java.desktop/share/native/liblcms/cmscgats.c
index 57725ae4731a..3e62d064c3f6 100644
--- a/src/java.desktop/share/native/liblcms/cmscgats.c
+++ b/src/java.desktop/share/native/liblcms/cmscgats.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2023 Marti Maria Saguer
+//  Copyright (c) 1998-2024 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -444,10 +444,11 @@ static
 void StringClear(string* s)
 {
     s->len = 0;
+    s->begin[0] = 0;
 }
 
 static
-void StringAppend(string* s, char c)
+cmsBool StringAppend(string* s, char c)
 {
     if (s->len + 1 >= s->max)
     {
@@ -455,6 +456,8 @@ void StringAppend(string* s, char c)
 
         s->max *= 10;
         new_ptr = (char*) AllocChunk(s->it8, s->max);
+        if (new_ptr == NULL) return FALSE;
+
         if (new_ptr != NULL && s->begin != NULL)
             memcpy(new_ptr, s->begin, s->len);
 
@@ -466,6 +469,8 @@ void StringAppend(string* s, char c)
         s->begin[s->len++] = c;
         s->begin[s->len] = 0;
     }
+
+    return TRUE;
 }
 
 static
@@ -475,13 +480,15 @@ char* StringPtr(string* s)
 }
 
 static
-void StringCat(string* s, const char* c)
+cmsBool StringCat(string* s, const char* c)
 {
     while (*c)
     {
-        StringAppend(s, *c);
+        if (!StringAppend(s, *c)) return FALSE;
         c++;
     }
+
+    return TRUE;
 }
 
 
@@ -830,7 +837,12 @@ void InStringSymbol(cmsIT8* it8)
 
             if (it8->ch == '\n' || it8->ch == '\r' || it8->ch == 0) break;
             else {
-                StringAppend(it8->str, (char)it8->ch);
+                if (!StringAppend(it8->str, (char)it8->ch)) {
+
+                    SynError(it8, "Out of memory");
+                    return;
+                }
+
                 NextCh(it8);
             }
         }
@@ -860,7 +872,11 @@ void InSymbol(cmsIT8* it8)
 
             do {
 
-                StringAppend(it8->id, (char) it8->ch);
+                if (!StringAppend(it8->id, (char)it8->ch)) {
+
+                    SynError(it8, "Out of memory");
+                    return;
+                }
 
                 NextCh(it8);
 
@@ -904,7 +920,6 @@ void InSymbol(cmsIT8* it8)
                             if ((cmsFloat64Number) it8->inum * 16.0 + (cmsFloat64Number) j > (cmsFloat64Number)+2147483647.0)
                             {
                                 SynError(it8, "Invalid hexadecimal number");
-                                it8->sy = SEOF;
                                 return;
                             }
 
@@ -926,7 +941,6 @@ void InSymbol(cmsIT8* it8)
                             if ((cmsFloat64Number) it8->inum * 2.0 + j > (cmsFloat64Number)+2147483647.0)
                             {
                                 SynError(it8, "Invalid binary number");
-                                it8->sy = SEOF;
                                 return;
                             }
 
@@ -979,11 +993,19 @@ void InSymbol(cmsIT8* it8)
                     }
 
                     StringClear(it8->id);
-                    StringCat(it8->id, buffer);
+                    if (!StringCat(it8->id, buffer)) {
+
+                        SynError(it8, "Out of memory");
+                        return;
+                    }
 
                     do {
 
-                        StringAppend(it8->id, (char) it8->ch);
+                        if (!StringAppend(it8->id, (char)it8->ch)) {
+
+                            SynError(it8, "Out of memory");
+                            return;
+                        }
 
                         NextCh(it8);
 
@@ -1038,7 +1060,6 @@ void InSymbol(cmsIT8* it8)
 
         default:
             SynError(it8, "Unrecognized character: 0x%x", it8 ->ch);
-            it8->sy = SEOF;
             return;
             }
 
@@ -1053,24 +1074,21 @@ void InSymbol(cmsIT8* it8)
                 if(it8 -> IncludeSP >= (MAXINCLUDE-1)) {
 
                     SynError(it8, "Too many recursion levels");
-                    it8->sy = SEOF;
                     return;
                 }
 
                 InStringSymbol(it8);
                 if (!Check(it8, SSTRING, "Filename expected"))
-                {
-                    it8->sy = SEOF;
                     return;
-                }
+
 
                 FileNest = it8 -> FileStack[it8 -> IncludeSP + 1];
                 if(FileNest == NULL) {
 
                     FileNest = it8 ->FileStack[it8 -> IncludeSP + 1] = (FILECTX*)AllocChunk(it8, sizeof(FILECTX));
                     if (FileNest == NULL) {
+
                         SynError(it8, "Out of memory");
-                        it8->sy = SEOF;
                         return;
                     }
                 }
@@ -1078,8 +1096,8 @@ void InSymbol(cmsIT8* it8)
                 if (BuildAbsolutePath(StringPtr(it8->str),
                                       it8->FileStack[it8->IncludeSP]->FileName,
                                       FileNest->FileName, cmsMAX_PATH-1) == FALSE) {
+
                     SynError(it8, "File path too long");
-                    it8->sy = SEOF;
                     return;
                 }
 
@@ -1087,7 +1105,6 @@ void InSymbol(cmsIT8* it8)
                 if (FileNest->Stream == NULL) {
 
                         SynError(it8, "File %s not found", FileNest->FileName);
-                        it8->sy = SEOF;
                         return;
                 }
                 it8->IncludeSP++;
@@ -1102,10 +1119,10 @@ void InSymbol(cmsIT8* it8)
 static
 cmsBool CheckEOLN(cmsIT8* it8)
 {
-        if (!Check(it8, SEOLN, "Expected separator")) return FALSE;
-        while (it8 -> sy == SEOLN)
-                        InSymbol(it8);
-        return TRUE;
+    if (!Check(it8, SEOLN, "Expected separator")) return FALSE;
+    while (it8->sy == SEOLN)
+        InSymbol(it8);
+    return TRUE;
 
 }
 
@@ -1114,8 +1131,8 @@ cmsBool CheckEOLN(cmsIT8* it8)
 static
 void Skip(cmsIT8* it8, SYMBOL sy)
 {
-        if (it8->sy == sy && it8->sy != SEOF)
-                        InSymbol(it8);
+    if (it8->sy == sy && it8->sy != SEOF && it8->sy != SSYNERROR)
+        InSymbol(it8);
 }
 
 
@@ -1124,7 +1141,7 @@ static
 void SkipEOLN(cmsIT8* it8)
 {
     while (it8->sy == SEOLN) {
-             InSymbol(it8);
+        InSymbol(it8);
     }
 }
 
@@ -1235,9 +1252,12 @@ void* AllocChunk(cmsIT8* it8, cmsUInt32Number size)
     cmsUInt8Number* ptr;
 
     size = _cmsALIGNMEM(size);
+    if (size == 0) return NULL;
 
     if (size > Free) {
 
+        cmsUInt8Number* new_block;
+
         if (it8 -> Allocator.BlockSize == 0)
 
                 it8 -> Allocator.BlockSize = 20*1024;
@@ -1248,7 +1268,11 @@ void* AllocChunk(cmsIT8* it8, cmsUInt32Number size)
                 it8 ->Allocator.BlockSize = size;
 
         it8 ->Allocator.Used = 0;
-        it8 ->Allocator.Block = (cmsUInt8Number*) AllocBigBlock(it8, it8 ->Allocator.BlockSize);
+        new_block = (cmsUInt8Number*)AllocBigBlock(it8, it8->Allocator.BlockSize);
+        if (new_block == NULL)
+            return NULL;
+
+        it8->Allocator.Block = new_block;
     }
 
     if (it8->Allocator.Block == NULL)
@@ -1258,7 +1282,6 @@ void* AllocChunk(cmsIT8* it8, cmsUInt32Number size)
     it8 ->Allocator.Used += size;
 
     return (void*) ptr;
-
 }
 
 
@@ -1266,9 +1289,12 @@ void* AllocChunk(cmsIT8* it8, cmsUInt32Number size)
 static
 char *AllocString(cmsIT8* it8, const char* str)
 {
-    cmsUInt32Number Size = (cmsUInt32Number) strlen(str)+1;
+    cmsUInt32Number Size;
     char *ptr;
 
+    if (str == NULL) return NULL;
+
+    Size = (cmsUInt32Number)strlen(str) + 1;
 
     ptr = (char *) AllocChunk(it8, Size);
     if (ptr) memcpy(ptr, str, Size-1);
@@ -1404,10 +1430,13 @@ KEYVALUE* AddAvailableSampleID(cmsIT8* it8, const char* Key)
 
 
 static
-void AllocTable(cmsIT8* it8)
+cmsBool AllocTable(cmsIT8* it8)
 {
     TABLE* t;
 
+    if (it8->TablesCount >= (MAXTABLES-1))
+        return FALSE;
+
     t = it8 ->Tab + it8 ->TablesCount;
 
     t->HeaderList = NULL;
@@ -1415,6 +1444,7 @@ void AllocTable(cmsIT8* it8)
     t->Data       = NULL;
 
     it8 ->TablesCount++;
+    return TRUE;
 }
 
 
@@ -1426,7 +1456,10 @@ cmsInt32Number CMSEXPORT cmsIT8SetTable(cmsHANDLE  IT8, cmsUInt32Number nTable)
 
          if (nTable == it8 ->TablesCount) {
 
-             AllocTable(it8);
+             if (!AllocTable(it8)) {
+                 SynError(it8, "Too many tables");
+                 return -1;
+             }
          }
          else {
              SynError(it8, "Table %d is out of sequence", nTable);
@@ -1610,8 +1643,8 @@ cmsInt32Number satoi(const char* b)
     if (b == NULL) return 0;
 
     n = atoi(b);
-    if (n > 0x7fffffffL) return 0x7fffffffL;
-    if (n < -0x7ffffffeL) return -0x7ffffffeL;
+    if (n > 0x7ffffff0L) return 0x7ffffff0L;
+    if (n < -0x7ffffff0L) return -0x7ffffff0L;
 
     return (cmsInt32Number)n;
 }
@@ -1620,22 +1653,26 @@ cmsInt32Number satoi(const char* b)
 static
 cmsBool AllocateDataFormat(cmsIT8* it8)
 {
+    cmsUInt32Number size;
+
     TABLE* t = GetTable(it8);
 
-    if (t -> DataFormat) return TRUE;    // Already allocated
+    if (t->DataFormat) return TRUE;    // Already allocated
 
-    t -> nSamples  = satoi(cmsIT8GetProperty(it8, "NUMBER_OF_FIELDS"));
+    t->nSamples = satoi(cmsIT8GetProperty(it8, "NUMBER_OF_FIELDS"));
 
-    if (t -> nSamples <= 0) {
+    if (t->nSamples <= 0 || t->nSamples > 0x7ffe) {
 
-        SynError(it8, "AllocateDataFormat: Unknown NUMBER_OF_FIELDS");
+        SynError(it8, "Wrong NUMBER_OF_FIELDS");
         return FALSE;
-        }
+    }
+
+    size = ((cmsUInt32Number)t->nSamples + 1) * sizeof(char*);
 
-    t -> DataFormat = (char**) AllocChunk (it8, ((cmsUInt32Number) t->nSamples + 1) * sizeof(char *));
+    t->DataFormat = (char**)AllocChunk(it8, size);
     if (t->DataFormat == NULL) {
 
-        SynError(it8, "AllocateDataFormat: Unable to allocate dataFormat array");
+        SynError(it8, "Unable to allocate dataFormat array");
         return FALSE;
     }
 
@@ -1664,7 +1701,7 @@ cmsBool SetDataFormat(cmsIT8* it8, int n, const char *label)
             return FALSE;
     }
 
-    if (n > t -> nSamples) {
+    if (n >= t -> nSamples) {
         SynError(it8, "More than NUMBER_OF_FIELDS fields.");
         return FALSE;
     }
@@ -1713,13 +1750,14 @@ cmsBool AllocateDataSet(cmsIT8* it8)
     t-> nSamples   = satoi(cmsIT8GetProperty(it8, "NUMBER_OF_FIELDS"));
     t-> nPatches   = satoi(cmsIT8GetProperty(it8, "NUMBER_OF_SETS"));
 
-    if (t -> nSamples < 0 || t->nSamples > 0x7ffe || t->nPatches < 0 || t->nPatches > 0x7ffe)
+    if (t -> nSamples < 0 || t->nSamples > 0x7ffe || t->nPatches < 0 || t->nPatches > 0x7ffe ||
+        (t->nPatches * t->nSamples) > 200000)
     {
         SynError(it8, "AllocateDataSet: too much data");
         return FALSE;
     }
     else {
-        // Some dumb analizers warns of possible overflow here, just take a look couple of lines above.
+        // Some dumb analyzers warns of possible overflow here, just take a look couple of lines above.
         t->Data = (char**)AllocChunk(it8, ((cmsUInt32Number)t->nSamples + 1) * ((cmsUInt32Number)t->nPatches + 1) * sizeof(char*));
         if (t->Data == NULL) {
 
@@ -1748,8 +1786,11 @@ char* GetData(cmsIT8* it8, int nSet, int nField)
 static
 cmsBool SetData(cmsIT8* it8, int nSet, int nField, const char *Val)
 {
+    char* ptr;
+
     TABLE* t = GetTable(it8);
 
+
     if (!t->Data) {
         if (!AllocateDataSet(it8)) return FALSE;
     }
@@ -1766,7 +1807,11 @@ cmsBool SetData(cmsIT8* it8, int nSet, int nField, const char *Val)
 
     }
 
-    t->Data [nSet * t -> nSamples + nField] = AllocString(it8, Val);
+    ptr = AllocString(it8, Val);
+    if (ptr == NULL)
+        return FALSE;
+
+    t->Data [nSet * t -> nSamples + nField] = ptr;
     return TRUE;
 }
 
@@ -2121,7 +2166,7 @@ cmsBool DataSection (cmsIT8* it8)
         if (!AllocateDataSet(it8)) return FALSE;
     }
 
-    while (it8->sy != SEND_DATA && it8->sy != SEOF)
+    while (it8->sy != SEND_DATA && it8->sy != SEOF && it8->sy != SSYNERROR)
     {
         if (iField >= t -> nSamples) {
             iField = 0;
@@ -2129,7 +2174,7 @@ cmsBool DataSection (cmsIT8* it8)
 
         }
 
-        if (it8->sy != SEND_DATA && it8->sy != SEOF) {
+        if (it8->sy != SEND_DATA && it8->sy != SEOF && it8->sy != SSYNERROR) {
 
             switch (it8->sy)
             {
@@ -2225,8 +2270,8 @@ cmsBool HeaderSection(cmsIT8* it8)
             if (!GetVal(it8, Buffer, MAXSTR - 1, "Property data expected")) return FALSE;
 
             if (Key->WriteAs != WRITE_PAIR) {
-                AddToList(it8, &GetTable(it8)->HeaderList, VarName, NULL, Buffer,
-                    (it8->sy == SSTRING) ? WRITE_STRINGIFY : WRITE_UNCOOKED);
+                if (AddToList(it8, &GetTable(it8)->HeaderList, VarName, NULL, Buffer,
+                    (it8->sy == SSTRING) ? WRITE_STRINGIFY : WRITE_UNCOOKED) == NULL) return FALSE;
             }
             else {
                 const char *Subkey;
@@ -2332,9 +2377,10 @@ cmsBool ParseIT8(cmsIT8* it8, cmsBool nosheet)
 
                     if (!DataSection(it8)) return FALSE;
 
-                    if (it8 -> sy != SEOF) {
+                    if (it8 -> sy != SEOF && it8->sy != SSYNERROR) {
+
+                            if (!AllocTable(it8)) return FALSE;
 
-                            AllocTable(it8);
                             it8 ->nTable = it8 ->TablesCount - 1;
 
                             // Read sheet type if present. We only support identifier and string.
@@ -3064,7 +3110,8 @@ cmsBool ParseCube(cmsIT8* cube, cmsStage** Shaper, cmsStage** CLUT, char title[]
 
     InSymbol(cube);
 
-    while (cube->sy != SEOF) {
+    while (cube->sy != SEOF && cube->sy != SSYNERROR) {
+
         switch (cube->sy)
         {
         // Set profile description
diff --git a/src/java.desktop/share/native/liblcms/cmscnvrt.c b/src/java.desktop/share/native/liblcms/cmscnvrt.c
index d18865b15b9a..9f8619cb9dac 100644
--- a/src/java.desktop/share/native/liblcms/cmscnvrt.c
+++ b/src/java.desktop/share/native/liblcms/cmscnvrt.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2023 Marti Maria Saguer
+//  Copyright (c) 1998-2024 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -750,7 +750,6 @@ static
 cmsBool is_cmyk_devicelink(cmsHPROFILE hProfile)
 {
     return cmsGetDeviceClass(hProfile) == cmsSigLinkClass &&
-            cmsGetColorSpace(hProfile) == cmsSigCmykData &&
             cmsGetColorSpace(hProfile) == cmsSigCmykData;
 }
 
diff --git a/src/java.desktop/share/native/liblcms/cmserr.c b/src/java.desktop/share/native/liblcms/cmserr.c
index 9fb7db89c9a6..d421c550d32d 100644
--- a/src/java.desktop/share/native/liblcms/cmserr.c
+++ b/src/java.desktop/share/native/liblcms/cmserr.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2023 Marti Maria Saguer
+//  Copyright (c) 1998-2024 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
diff --git a/src/java.desktop/share/native/liblcms/cmsgamma.c b/src/java.desktop/share/native/liblcms/cmsgamma.c
index 8e489a43c553..773858b0c1f0 100644
--- a/src/java.desktop/share/native/liblcms/cmsgamma.c
+++ b/src/java.desktop/share/native/liblcms/cmsgamma.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2023 Marti Maria Saguer
+//  Copyright (c) 1998-2024 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
diff --git a/src/java.desktop/share/native/liblcms/cmsgmt.c b/src/java.desktop/share/native/liblcms/cmsgmt.c
index e9ee73b52cd0..03ac70202a50 100644
--- a/src/java.desktop/share/native/liblcms/cmsgmt.c
+++ b/src/java.desktop/share/native/liblcms/cmsgmt.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2021 Marti Maria Saguer
+//  Copyright (c) 1998-2024 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -327,8 +327,9 @@ cmsPipeline* _cmsCreateGamutCheckPipeline(cmsContext ContextID,
     cmsUInt32Number dwFormat;
     GAMUTCHAIN Chain;
     cmsUInt32Number nGridpoints;
-    cmsInt32Number nChannels;
+    cmsInt32Number nChannels, nInputChannels;
     cmsColorSpaceSignature ColorSpace;
+    cmsColorSpaceSignature InputColorSpace;
     cmsUInt32Number i;
     cmsHPROFILE ProfileList[256];
     cmsBool     BPCList[256];
@@ -374,11 +375,13 @@ cmsPipeline* _cmsCreateGamutCheckPipeline(cmsContext ContextID,
     AdaptationList[nGamutPCSposition] = 1.0;
     IntentList[nGamutPCSposition] = INTENT_RELATIVE_COLORIMETRIC;
 
-
     ColorSpace  = cmsGetColorSpace(hGamut);
     nChannels   = cmsChannelsOfColorSpace(ColorSpace);
     nGridpoints = _cmsReasonableGridpointsByColorspace(ColorSpace, cmsFLAGS_HIGHRESPRECALC);
-    dwFormat    = (CHANNELS_SH(nChannels)|BYTES_SH(2));
+
+    InputColorSpace = cmsGetColorSpace(ProfileList[0]);
+    nInputChannels  = cmsChannelsOfColorSpace(InputColorSpace);
+    dwFormat        = (CHANNELS_SH(nInputChannels)|BYTES_SH(2));
 
     // 16 bits to Lab double
     Chain.hInput = cmsCreateExtendedTransform(ContextID,
diff --git a/src/java.desktop/share/native/liblcms/cmshalf.c b/src/java.desktop/share/native/liblcms/cmshalf.c
index 5babb063eb00..7e5f7a3c7e03 100644
--- a/src/java.desktop/share/native/liblcms/cmshalf.c
+++ b/src/java.desktop/share/native/liblcms/cmshalf.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2023 Marti Maria Saguer
+//  Copyright (c) 1998-2024 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
diff --git a/src/java.desktop/share/native/liblcms/cmsintrp.c b/src/java.desktop/share/native/liblcms/cmsintrp.c
index 9837454df0bb..43c47429c3cd 100644
--- a/src/java.desktop/share/native/liblcms/cmsintrp.c
+++ b/src/java.desktop/share/native/liblcms/cmsintrp.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2023 Marti Maria Saguer
+//  Copyright (c) 1998-2024 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -524,7 +524,7 @@ void TrilinearInterpFloat(const cmsFloat32Number Input[],
     py = fclamp(Input[1]) * p->Domain[1];
     pz = fclamp(Input[2]) * p->Domain[2];
 
-    x0 = (int) floor(px); fx = px - (cmsFloat32Number) x0;  // We need full floor funcionality here
+    x0 = (int) floor(px); fx = px - (cmsFloat32Number) x0;  // We need full floor functionality here
     y0 = (int) floor(py); fy = py - (cmsFloat32Number) y0;
     z0 = (int) floor(pz); fz = pz - (cmsFloat32Number) z0;
 
diff --git a/src/java.desktop/share/native/liblcms/cmsio0.c b/src/java.desktop/share/native/liblcms/cmsio0.c
index 05baa9392e21..5258b7939d2b 100644
--- a/src/java.desktop/share/native/liblcms/cmsio0.c
+++ b/src/java.desktop/share/native/liblcms/cmsio0.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2023 Marti Maria Saguer
+//  Copyright (c) 1998-2024 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -306,6 +306,11 @@ cmsIOHANDLER* CMSEXPORT cmsOpenIOhandlerFromMem(cmsContext ContextID, void *Buff
         fm = (FILEMEM*) _cmsMallocZero(ContextID, sizeof(FILEMEM));
         if (fm == NULL) goto Error;
 
+        if (Buffer == NULL) {
+            cmsSignalError(ContextID, cmsERROR_WRITE, "Couldn't write profile to NULL pointer");
+            goto Error;
+        }
+
         fm ->Block = (cmsUInt8Number*) Buffer;
         fm ->FreeBlockOnClose = FALSE;
         fm ->Size    = size;
diff --git a/src/java.desktop/share/native/liblcms/cmsio1.c b/src/java.desktop/share/native/liblcms/cmsio1.c
index e42d4d389873..48772c7cbde9 100644
--- a/src/java.desktop/share/native/liblcms/cmsio1.c
+++ b/src/java.desktop/share/native/liblcms/cmsio1.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2023 Marti Maria Saguer
+//  Copyright (c) 1998-2024 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
diff --git a/src/java.desktop/share/native/liblcms/cmslut.c b/src/java.desktop/share/native/liblcms/cmslut.c
index b544c9486259..3cf4e8cac5a6 100644
--- a/src/java.desktop/share/native/liblcms/cmslut.c
+++ b/src/java.desktop/share/native/liblcms/cmslut.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2023 Marti Maria Saguer
+//  Copyright (c) 1998-2024 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -1109,7 +1109,7 @@ cmsStage* _cmsStageNormalizeFromLabFloat(cmsContext ContextID)
     return mpe;
 }
 
-// Fom XYZ to floating point PCS
+// From XYZ to floating point PCS
 cmsStage* _cmsStageNormalizeFromXyzFloat(cmsContext ContextID)
 {
 #define n (32768.0/65535.0)
diff --git a/src/java.desktop/share/native/liblcms/cmsmd5.c b/src/java.desktop/share/native/liblcms/cmsmd5.c
index 01aa44de85a0..d9b9a4e52608 100644
--- a/src/java.desktop/share/native/liblcms/cmsmd5.c
+++ b/src/java.desktop/share/native/liblcms/cmsmd5.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2023 Marti Maria Saguer
+//  Copyright (c) 1998-2024 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -280,8 +280,8 @@ void CMSEXPORT cmsMD5finish(cmsProfileID* ProfileID,  cmsHANDLE Handle)
 
 
 // Assuming io points to an ICC profile, compute and store MD5 checksum
-// In the header, rendering intentent, attributes and ID should be set to zero
-// before computing MD5 checksum (per 6.1.13 in ICC spec)
+// In the header, rendering intentent, flags and ID should be set to zero
+// before computing MD5 checksum (per 7.2.18 of ICC spec 4.4)
 
 cmsBool CMSEXPORT cmsMD5computeID(cmsHPROFILE hProfile)
 {
@@ -299,8 +299,8 @@ cmsBool CMSEXPORT cmsMD5computeID(cmsHPROFILE hProfile)
     // Save a copy of the profile header
     memmove(&Keep, Icc, sizeof(_cmsICCPROFILE));
 
-    // Set RI, attributes and ID
-    memset(&Icc ->attributes, 0, sizeof(Icc ->attributes));
+    // Set RI, flags and ID
+    Icc ->flags = 0;
     Icc ->RenderingIntent = 0;
     memset(&Icc ->ProfileID, 0, sizeof(Icc ->ProfileID));
 
diff --git a/src/java.desktop/share/native/liblcms/cmsmtrx.c b/src/java.desktop/share/native/liblcms/cmsmtrx.c
index 599c290bd705..841da662a107 100644
--- a/src/java.desktop/share/native/liblcms/cmsmtrx.c
+++ b/src/java.desktop/share/native/liblcms/cmsmtrx.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2023 Marti Maria Saguer
+//  Copyright (c) 1998-2024 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
diff --git a/src/java.desktop/share/native/liblcms/cmsnamed.c b/src/java.desktop/share/native/liblcms/cmsnamed.c
index d3cd97d4aea5..451bfe9f34d5 100644
--- a/src/java.desktop/share/native/liblcms/cmsnamed.c
+++ b/src/java.desktop/share/native/liblcms/cmsnamed.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2023 Marti Maria Saguer
+//  Copyright (c) 1998-2024 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -598,7 +598,7 @@ cmsUInt32Number CMSEXPORT cmsMLUgetASCII(const cmsMLU* mlu,
     if (BufferSize < ASCIIlen + 1)
         ASCIIlen = BufferSize - 1;
 
-    // Precess each character
+    // Process each character
     for (i=0; i < ASCIIlen; i++) {
 
         wchar_t wc = Wide[i];
diff --git a/src/java.desktop/share/native/liblcms/cmsopt.c b/src/java.desktop/share/native/liblcms/cmsopt.c
index 421a4f4a7019..767008e68c58 100644
--- a/src/java.desktop/share/native/liblcms/cmsopt.c
+++ b/src/java.desktop/share/native/liblcms/cmsopt.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2023 Marti Maria Saguer
+//  Copyright (c) 1998-2024 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
diff --git a/src/java.desktop/share/native/liblcms/cmspack.c b/src/java.desktop/share/native/liblcms/cmspack.c
index fc875995a80c..d430e73051de 100644
--- a/src/java.desktop/share/native/liblcms/cmspack.c
+++ b/src/java.desktop/share/native/liblcms/cmspack.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2023 Marti Maria Saguer
+//  Copyright (c) 1998-2024 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -217,7 +217,7 @@ cmsUInt8Number* UnrollPlanarBytes(CMSREGISTER _cmsTRANSFORM* info,
     else
     {
         if (Premul && Extra)
-            alpha_factor = _cmsToFixedDomain(FROM_8_TO_16(accum[(nChan) * Stride]));
+            alpha_factor = _cmsToFixedDomain(FROM_8_TO_16(accum[nChan * Stride]));
     }
 
     for (i=0; i < nChan; i++) {
@@ -606,8 +606,8 @@ cmsUInt8Number* UnrollAnyWordsPremul(CMSREGISTER _cmsTRANSFORM* info,
    cmsUInt32Number ExtraFirst  = DoSwap ^ SwapFirst;
    cmsUInt32Number i;
 
-   cmsUInt16Number alpha = (ExtraFirst ? accum[0] : accum[nChan - 1]);
-   cmsUInt32Number alpha_factor = _cmsToFixedDomain(FROM_8_TO_16(alpha));
+   cmsUInt16Number alpha = (ExtraFirst ? ((cmsUInt16Number*)accum)[0] : ((cmsUInt16Number*)accum)[nChan]);
+   cmsUInt32Number alpha_factor = _cmsToFixedDomain(alpha);
 
     if (ExtraFirst) {
         accum += sizeof(cmsUInt16Number);
@@ -691,8 +691,8 @@ cmsUInt8Number* UnrollPlanarWordsPremul(CMSREGISTER _cmsTRANSFORM* info,
     cmsUInt32Number ExtraFirst = DoSwap ^ SwapFirst;
     cmsUInt8Number* Init = accum;
 
-    cmsUInt16Number  alpha = (ExtraFirst ? accum[0] : accum[(nChan - 1) * Stride]);
-    cmsUInt32Number alpha_factor = _cmsToFixedDomain(FROM_8_TO_16(alpha));
+    cmsUInt16Number alpha = (ExtraFirst ? ((cmsUInt16Number*)accum)[0] : ((cmsUInt16Number*)accum)[nChan * Stride / 2]);
+    cmsUInt32Number alpha_factor = _cmsToFixedDomain(alpha);
 
     if (ExtraFirst) {
         accum += Stride;
@@ -1107,8 +1107,7 @@ cmsINLINE cmsBool IsInkSpace(cmsUInt32Number Type)
 }
 
 // Return the size in bytes of a given formatter
-static
-cmsUInt32Number PixelSize(cmsUInt32Number Format)
+cmsINLINE cmsUInt32Number PixelSize(cmsUInt32Number Format)
 {
     cmsUInt32Number fmt_bytes = T_BYTES(Format);
 
@@ -1454,7 +1453,7 @@ cmsUInt8Number* UnrollDoublesToFloat(_cmsTRANSFORM* info,
     if (Premul && Extra)
     {
         if (Planar)
-            alpha_factor = (ExtraFirst ? ptr[0] : ptr[(nChan) * Stride]) / maximum;
+            alpha_factor = (ExtraFirst ? ptr[0] : ptr[nChan * Stride]) / maximum;
         else
             alpha_factor = (ExtraFirst ? ptr[0] : ptr[nChan]) / maximum;
     }
@@ -3052,6 +3051,7 @@ cmsUInt8Number* PackWordsFromFloat(_cmsTRANSFORM* info,
     if (ExtraFirst)
         start = Extra;
 
+    Stride /= 2;
     for (i = 0; i < nChan; i++) {
 
         cmsUInt32Number index = DoSwap ? (nChan - i - 1) : i;
@@ -3115,7 +3115,7 @@ cmsUInt8Number* PackFloatsFromFloat(_cmsTRANSFORM* info,
                      v = maximum - v;
 
               if (Planar)
-                     ((cmsFloat32Number*)output)[(i + start)* Stride] = (cmsFloat32Number)v;
+                     ((cmsFloat32Number*)output)[(i + start) * Stride] = (cmsFloat32Number)v;
               else
                      ((cmsFloat32Number*)output)[i + start] = (cmsFloat32Number)v;
        }
@@ -3455,7 +3455,7 @@ cmsUInt8Number* UnrollHalfToFloat(_cmsTRANSFORM* info,
     cmsUInt32Number i, start = 0;
     cmsFloat32Number maximum = IsInkSpace(info ->InputFormat) ? 100.0F : 1.0F;
 
-    Stride /= PixelSize(info->OutputFormat);
+    Stride /= PixelSize(info->InputFormat);
 
     if (ExtraFirst)
             start = Extra;
@@ -4062,6 +4062,9 @@ cmsUInt32Number CMSEXPORT cmsFormatterForColorspaceOfProfile(cmsHPROFILE hProfil
     // Unsupported color space?
     if (nOutputChans < 0) return 0;
 
+    // Fix float spaces
+    nBytes &= 7;
+
     // Create a fake formatter for result
     return FLOAT_SH(Float) | COLORSPACE_SH(ColorSpaceBits) | BYTES_SH(nBytes) | CHANNELS_SH(nOutputChans);
 }
@@ -4079,6 +4082,9 @@ cmsUInt32Number CMSEXPORT cmsFormatterForPCSOfProfile(cmsHPROFILE hProfile, cmsU
     // Unsupported color space?
     if (nOutputChans < 0) return 0;
 
+    // Fix float spaces
+    nBytes &= 7;
+
     // Create a fake formatter for result
     return FLOAT_SH(Float) | COLORSPACE_SH(ColorSpaceBits) | BYTES_SH(nBytes) | CHANNELS_SH(nOutputChans);
 }
diff --git a/src/java.desktop/share/native/liblcms/cmspcs.c b/src/java.desktop/share/native/liblcms/cmspcs.c
index c4739840053b..5f1b1f0d8e6d 100644
--- a/src/java.desktop/share/native/liblcms/cmspcs.c
+++ b/src/java.desktop/share/native/liblcms/cmspcs.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2023 Marti Maria Saguer
+//  Copyright (c) 1998-2024 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
diff --git a/src/java.desktop/share/native/liblcms/cmsplugin.c b/src/java.desktop/share/native/liblcms/cmsplugin.c
index f84e0172c813..aaad39f52b04 100644
--- a/src/java.desktop/share/native/liblcms/cmsplugin.c
+++ b/src/java.desktop/share/native/liblcms/cmsplugin.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2023 Marti Maria Saguer
+//  Copyright (c) 1998-2024 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -935,7 +935,10 @@ cmsContext CMSEXPORT cmsDupContext(cmsContext ContextID, void* NewUserData)
     if (!InitContextMutex()) return NULL;
 
     // Setup default memory allocators
-    memcpy(&ctx->DefaultMemoryManager, &src->DefaultMemoryManager, sizeof(ctx->DefaultMemoryManager));
+    if (ContextID == NULL)
+        _cmsInstallAllocFunctions(NULL, &ctx->DefaultMemoryManager);
+    else
+        memcpy(&ctx->DefaultMemoryManager, &src->DefaultMemoryManager, sizeof(ctx->DefaultMemoryManager));
 
     // Maintain the linked list
     _cmsEnterCriticalSectionPrimitive(&_cmsContextPoolHeadMutex);
diff --git a/src/java.desktop/share/native/liblcms/cmsps2.c b/src/java.desktop/share/native/liblcms/cmsps2.c
index 9a2ab464f315..476817e9c1a2 100644
--- a/src/java.desktop/share/native/liblcms/cmsps2.c
+++ b/src/java.desktop/share/native/liblcms/cmsps2.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2023 Marti Maria Saguer
+//  Copyright (c) 1998-2024 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -494,7 +494,7 @@ void Emit1Gamma(cmsIOHANDLER* m, cmsToneCurve* Table)
     // Bounds check
     EmitRangeCheck(m);
 
-    // Emit intepolation code
+    // Emit interpolation code
 
     // PostScript code                      Stack
     // ===============                      ========================
@@ -618,7 +618,7 @@ int OutputValueSampler(CMSREGISTER const cmsUInt16Number In[], CMSREGISTER cmsUI
     }
 
 
-    // Hadle the parenthesis on rows
+    // Handle the parenthesis on rows
 
     if (In[0] != sc ->FirstComponent) {
 
@@ -694,8 +694,10 @@ void WriteCLUT(cmsIOHANDLER* m, cmsStage* mpe, const char* PreMaj,
 
         _cmsIOPrintf(m, "[");
 
-        for (i = 0; i < sc.Pipeline->Params->nInputs; i++)
-            _cmsIOPrintf(m, " %d ", sc.Pipeline->Params->nSamples[i]);
+        for (i = 0; i < sc.Pipeline->Params->nInputs; i++) {
+            if (i < MAX_INPUT_DIMENSIONS)
+                _cmsIOPrintf(m, " %d ", sc.Pipeline->Params->nSamples[i]);
+        }
 
         _cmsIOPrintf(m, " [\n");
 
@@ -869,13 +871,13 @@ cmsToneCurve* ExtractGray2Y(cmsContext ContextID, cmsHPROFILE hProfile, cmsUInt3
 // a more perceptually uniform space... I do choose Lab.
 
 static
-int WriteInputLUT(cmsIOHANDLER* m, cmsHPROFILE hProfile, cmsUInt32Number Intent, cmsUInt32Number dwFlags)
+cmsBool WriteInputLUT(cmsIOHANDLER* m, cmsHPROFILE hProfile, cmsUInt32Number Intent, cmsUInt32Number dwFlags)
 {
     cmsHPROFILE hLab;
     cmsHTRANSFORM xform;
     cmsUInt32Number nChannels;
     cmsUInt32Number InputFormat;
-    int rc;
+
     cmsHPROFILE Profiles[2];
     cmsCIEXYZ BlackPointAdaptedToD50;
 
@@ -900,7 +902,7 @@ int WriteInputLUT(cmsIOHANDLER* m, cmsHPROFILE hProfile, cmsUInt32Number Intent,
     if (xform == NULL) {
 
         cmsSignalError(m ->ContextID, cmsERROR_COLORSPACE_CHECK, "Cannot create transform Profile -> Lab");
-        return 0;
+        return FALSE;
     }
 
     // Only 1, 3 and 4 channels are allowed
@@ -919,29 +921,35 @@ int WriteInputLUT(cmsIOHANDLER* m, cmsHPROFILE hProfile, cmsUInt32Number Intent,
             cmsUInt32Number OutFrm = TYPE_Lab_16;
             cmsPipeline* DeviceLink;
             _cmsTRANSFORM* v = (_cmsTRANSFORM*) xform;
+            cmsBool rc;
 
             DeviceLink = cmsPipelineDup(v ->Lut);
-            if (DeviceLink == NULL) return 0;
+            if (DeviceLink == NULL) {
+                cmsDeleteTransform(xform);
+                return FALSE;
+            }
 
             dwFlags |= cmsFLAGS_FORCE_CLUT;
             _cmsOptimizePipeline(m->ContextID, &DeviceLink, Intent, &InputFormat, &OutFrm, &dwFlags);
 
             rc = EmitCIEBasedDEF(m, DeviceLink, Intent, &BlackPointAdaptedToD50);
             cmsPipelineFree(DeviceLink);
-            if (rc == 0) return 0;
+            if (!rc) {
+                cmsDeleteTransform(xform);
+                return FALSE;
+            }
             }
             break;
 
     default:
 
+        cmsDeleteTransform(xform);
         cmsSignalError(m ->ContextID, cmsERROR_COLORSPACE_CHECK, "Only 3, 4 channels are supported for CSA. This profile has %d channels.", nChannels);
-        return 0;
+        return FALSE;
     }
 
-
     cmsDeleteTransform(xform);
-
-    return 1;
+    return TRUE;
 }
 
 static
@@ -1284,7 +1292,7 @@ void EmitXYZ2Lab(cmsIOHANDLER* m)
 // 8 bits.
 
 static
-int WriteOutputLUT(cmsIOHANDLER* m, cmsHPROFILE hProfile, cmsUInt32Number Intent, cmsUInt32Number dwFlags)
+cmsBool WriteOutputLUT(cmsIOHANDLER* m, cmsHPROFILE hProfile, cmsUInt32Number Intent, cmsUInt32Number dwFlags)
 {
     cmsHPROFILE hLab;
     cmsHTRANSFORM xform;
@@ -1302,7 +1310,7 @@ int WriteOutputLUT(cmsIOHANDLER* m, cmsHPROFILE hProfile, cmsUInt32Number Intent
     cmsStage* first;
 
     hLab = cmsCreateLab4ProfileTHR(m ->ContextID, NULL);
-    if (hLab == NULL) return 0;
+    if (hLab == NULL) return FALSE;
 
     OutputFormat = cmsFormatterForColorspaceOfProfile(hProfile, 2, FALSE);
     nChannels    = T_CHANNELS(OutputFormat);
@@ -1327,7 +1335,7 @@ int WriteOutputLUT(cmsIOHANDLER* m, cmsHPROFILE hProfile, cmsUInt32Number Intent
 
     if (xform == NULL) {
         cmsSignalError(m ->ContextID, cmsERROR_COLORSPACE_CHECK, "Cannot create transform Lab -> Profile in CRD creation");
-        return 0;
+        return FALSE;
     }
 
     // Get a copy of the internal devicelink
@@ -1335,17 +1343,22 @@ int WriteOutputLUT(cmsIOHANDLER* m, cmsHPROFILE hProfile, cmsUInt32Number Intent
     DeviceLink = cmsPipelineDup(v ->Lut);
     if (DeviceLink == NULL) {
         cmsDeleteTransform(xform);
-        return 0;
+        cmsSignalError(m->ContextID, cmsERROR_CORRUPTION_DETECTED, "Cannot access link for CRD");
+        return FALSE;
     }
 
      // We need a CLUT
     dwFlags |= cmsFLAGS_FORCE_CLUT;
-    _cmsOptimizePipeline(m->ContextID, &DeviceLink, RelativeEncodingIntent, &InFrm, &OutputFormat, &dwFlags);
+    if (!_cmsOptimizePipeline(m->ContextID, &DeviceLink, RelativeEncodingIntent, &InFrm, &OutputFormat, &dwFlags)) {
+        cmsPipelineFree(DeviceLink);
+        cmsDeleteTransform(xform);
+        cmsSignalError(m->ContextID, cmsERROR_CORRUPTION_DETECTED, "Cannot create CLUT table for CRD");
+        return FALSE;
+    }
 
     _cmsIOPrintf(m, "<<\n");
     _cmsIOPrintf(m, "/ColorRenderingType 1\n");
 
-
     cmsDetectBlackPoint(&BlackPointAdaptedToD50, hProfile, Intent, 0);
 
     // Emit headers, etc.
@@ -1367,6 +1380,13 @@ int WriteOutputLUT(cmsIOHANDLER* m, cmsHPROFILE hProfile, cmsUInt32Number Intent
 
     first = cmsPipelineGetPtrToFirstStage(DeviceLink);
     if (first != NULL) {
+        if (first->Type != cmsSigCLutElemType) {
+            cmsPipelineFree(DeviceLink);
+            cmsDeleteTransform(xform);
+            cmsSignalError(m->ContextID, cmsERROR_CORRUPTION_DETECTED, "Cannot create CLUT, revise your flags!");
+            return FALSE;
+        }
+
         WriteCLUT(m, first, "<", ">\n", "", "", lFixWhite, ColorSpace);
     }
 
@@ -1389,7 +1409,7 @@ int WriteOutputLUT(cmsIOHANDLER* m, cmsHPROFILE hProfile, cmsUInt32Number Intent
     cmsPipelineFree(DeviceLink);
     cmsDeleteTransform(xform);
 
-    return 1;
+    return TRUE;
 }
 
 
diff --git a/src/java.desktop/share/native/liblcms/cmssamp.c b/src/java.desktop/share/native/liblcms/cmssamp.c
index 74f5f4bff29b..ca5c4a9d6931 100644
--- a/src/java.desktop/share/native/liblcms/cmssamp.c
+++ b/src/java.desktop/share/native/liblcms/cmssamp.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2023 Marti Maria Saguer
+//  Copyright (c) 1998-2024 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
diff --git a/src/java.desktop/share/native/liblcms/cmssm.c b/src/java.desktop/share/native/liblcms/cmssm.c
index 3e1486ae3ae1..e2a810a26695 100644
--- a/src/java.desktop/share/native/liblcms/cmssm.c
+++ b/src/java.desktop/share/native/liblcms/cmssm.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2023 Marti Maria Saguer
+//  Copyright (c) 1998-2024 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
diff --git a/src/java.desktop/share/native/liblcms/cmstypes.c b/src/java.desktop/share/native/liblcms/cmstypes.c
index 862f393497aa..22514f882268 100644
--- a/src/java.desktop/share/native/liblcms/cmstypes.c
+++ b/src/java.desktop/share/native/liblcms/cmstypes.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2023 Marti Maria Saguer
+//  Copyright (c) 1998-2024 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -599,6 +599,178 @@ void Type_ColorantOrderType_Free(struct _cms_typehandler_struct* self, void* Ptr
     _cmsFree(self ->ContextID, Ptr);
 }
 
+// ********************************************************************************
+// Type cmsSigUInt8ArrayType
+// ********************************************************************************
+// This type represents an array of generic 1-byte/8-bit quantity.
+
+static
+void* Type_UInt8_Read(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, cmsUInt32Number* nItems, cmsUInt32Number SizeOfTag)
+{
+    cmsUInt8Number* array;
+    cmsUInt32Number i, n;
+
+    *nItems = 0;
+    n = SizeOfTag / sizeof(cmsUInt8Number);
+    array = (cmsUInt8Number*)_cmsCalloc(self->ContextID, n, sizeof(cmsUInt8Number));
+    if (array == NULL) return NULL;
+
+    for (i = 0; i < n; i++) {
+
+        if (!_cmsReadUInt8Number(io, &array[i])) {
+
+            _cmsFree(self->ContextID, array);
+            return NULL;
+        }
+    }
+
+    *nItems = n;
+    return (void*)array;
+}
+
+static
+cmsBool Type_UInt8_Write(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, void* Ptr, cmsUInt32Number nItems)
+{
+    cmsUInt8Number* Value = (cmsUInt8Number*)Ptr;
+    cmsUInt32Number i;
+
+    for (i = 0; i < nItems; i++) {
+
+        if (!_cmsWriteUInt8Number(io, Value[i])) return FALSE;
+    }
+
+    return TRUE;
+
+    cmsUNUSED_PARAMETER(self);
+}
+
+static
+void* Type_UInt8_Dup(struct _cms_typehandler_struct* self, const void* Ptr, cmsUInt32Number n)
+{
+    return _cmsDupMem(self->ContextID, Ptr, n * sizeof(cmsUInt8Number));
+}
+
+
+static
+void Type_UInt8_Free(struct _cms_typehandler_struct* self, void* Ptr)
+{
+    _cmsFree(self->ContextID, Ptr);
+}
+
+// ********************************************************************************
+// Type cmsSigUInt32ArrayType
+// ********************************************************************************
+// This type represents an array of generic 4-byte/32-bit quantity.
+static
+void* Type_UInt32_Read(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, cmsUInt32Number* nItems, cmsUInt32Number SizeOfTag)
+{
+    cmsUInt32Number* array;
+    cmsUInt32Number i, n;
+
+    *nItems = 0;
+    n = SizeOfTag / sizeof(cmsUInt32Number);
+    array = (cmsUInt32Number*)_cmsCalloc(self->ContextID, n, sizeof(cmsUInt32Number));
+    if (array == NULL) return NULL;
+
+    for (i = 0; i < n; i++) {
+
+        if (!_cmsReadUInt32Number(io, &array[i])) {
+
+            _cmsFree(self->ContextID, array);
+            return NULL;
+        }
+    }
+
+    *nItems = n;
+    return (void*)array;
+}
+
+static
+cmsBool Type_UInt32_Write(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, void* Ptr, cmsUInt32Number nItems)
+{
+    cmsUInt32Number* Value = (cmsUInt32Number*)Ptr;
+    cmsUInt32Number i;
+
+    for (i = 0; i < nItems; i++) {
+
+        if (!_cmsWriteUInt32Number(io, Value[i])) return FALSE;
+    }
+
+    return TRUE;
+
+    cmsUNUSED_PARAMETER(self);
+}
+
+static
+void* Type_UInt32_Dup(struct _cms_typehandler_struct* self, const void* Ptr, cmsUInt32Number n)
+{
+    return _cmsDupMem(self->ContextID, Ptr, n * sizeof(cmsUInt32Number));
+}
+
+
+static
+void Type_UInt32_Free(struct _cms_typehandler_struct* self, void* Ptr)
+{
+    _cmsFree(self->ContextID, Ptr);
+}
+
+// ********************************************************************************
+// Type cmsSigUInt64ArrayType
+// ********************************************************************************
+// This type represents an array of generic 8-byte/64-bit quantity.
+static
+void* Type_UInt64_Read(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, cmsUInt32Number* nItems, cmsUInt32Number SizeOfTag)
+{
+    cmsUInt64Number* array;
+    cmsUInt32Number i, n;
+
+    *nItems = 0;
+    n = SizeOfTag / sizeof(cmsUInt64Number);
+    array = (cmsUInt64Number*)_cmsCalloc(self->ContextID, n, sizeof(cmsUInt64Number));
+    if (array == NULL) return NULL;
+
+    for (i = 0; i < n; i++) {
+
+        if (!_cmsReadUInt64Number(io, &array[i])) {
+
+            _cmsFree(self->ContextID, array);
+            return NULL;
+        }
+    }
+
+    *nItems = n;
+    return (void*)array;
+}
+
+static
+cmsBool Type_UInt64_Write(struct _cms_typehandler_struct* self, cmsIOHANDLER* io, void* Ptr, cmsUInt32Number nItems)
+{
+    cmsUInt64Number* Value = (cmsUInt64Number*)Ptr;
+    cmsUInt32Number i;
+
+    for (i = 0; i < nItems; i++) {
+
+        if (!_cmsWriteUInt64Number(io, &Value[i])) return FALSE;
+    }
+
+    return TRUE;
+
+    cmsUNUSED_PARAMETER(self);
+}
+
+static
+void* Type_UInt64_Dup(struct _cms_typehandler_struct* self, const void* Ptr, cmsUInt32Number n)
+{
+    return _cmsDupMem(self->ContextID, Ptr, n * sizeof(cmsUInt64Number));
+}
+
+
+static
+void Type_UInt64_Free(struct _cms_typehandler_struct* self, void* Ptr)
+{
+    _cmsFree(self->ContextID, Ptr);
+}
+
 // ********************************************************************************
 // Type cmsSigS15Fixed16ArrayType
 // ********************************************************************************
@@ -968,6 +1140,8 @@ void *Type_Text_Description_Read(struct _cms_typehandler_struct* self, cmsIOHAND
 
     // Read len of ASCII
     if (!_cmsReadUInt32Number(io, &AsciiCount)) return NULL;
+    if (AsciiCount > 0x7ffff) return NULL;
+
     SizeOfTag -= sizeof(cmsUInt32Number);
 
     // Check for size
@@ -999,7 +1173,8 @@ void *Type_Text_Description_Read(struct _cms_typehandler_struct* self, cmsIOHAND
     if (!_cmsReadUInt32Number(io, &UnicodeCount)) goto Done;
     SizeOfTag -= 2* sizeof(cmsUInt32Number);
 
-    if (UnicodeCount == 0 || SizeOfTag < UnicodeCount*sizeof(cmsUInt16Number)) goto Done;
+    if (UnicodeCount == 0 || UnicodeCount > 0x7ffff ||
+        SizeOfTag < UnicodeCount*sizeof(cmsUInt16Number)) goto Done;
 
     UnicodeString = (wchar_t*)_cmsMallocZero(self->ContextID, (UnicodeCount + 1) * sizeof(wchar_t));
     if (UnicodeString == NULL) goto Done;
@@ -1129,7 +1304,7 @@ cmsBool  Type_Text_Description_Write(struct _cms_typehandler_struct* self, cmsIO
     if (!io ->Write(io, 67, Filler)) goto Error;
 
     // possibly add pad at the end of tag
-    if(len_aligned - len_tag_requirement > 0)
+    if (len_aligned > len_tag_requirement)
       if (!io ->Write(io, len_aligned - len_tag_requirement, Filler)) goto Error;
 
     rc = TRUE;
@@ -5191,7 +5366,7 @@ cmsBool ReadOneWChar(cmsIOHANDLER* io,  _cmsDICelem* e, cmsUInt32Number i, wchar
       if (!io -> Seek(io, e -> Offsets[i])) return FALSE;
 
       nChars = e ->Sizes[i] / sizeof(cmsUInt16Number);
-
+      if (nChars > 0x7ffff) return FALSE;
 
       *wcstr = (wchar_t*) _cmsMallocZero(e ->ContextID, (nChars + 1) * sizeof(wchar_t));
       if (*wcstr == NULL) return FALSE;
@@ -5772,7 +5947,10 @@ static const _cmsTagTypeLinkedList SupportedTagTypes[] = {
 {TYPE_HANDLER(cmsSigDictType,                  Dictionary),         (_cmsTagTypeLinkedList*) &SupportedTagTypes[30] },
 {TYPE_HANDLER(cmsSigcicpType,                  VideoSignal),        (_cmsTagTypeLinkedList*) &SupportedTagTypes[31] },
 {TYPE_HANDLER(cmsSigVcgtType,                  vcgt),               (_cmsTagTypeLinkedList*) &SupportedTagTypes[32] },
-{TYPE_HANDLER(cmsSigMHC2Type,                  MHC2),                NULL }
+{TYPE_HANDLER(cmsSigMHC2Type,                  MHC2),               (_cmsTagTypeLinkedList*) &SupportedTagTypes[33] },
+{TYPE_HANDLER(cmsSigUInt8ArrayType,            UInt8),              (_cmsTagTypeLinkedList*) &SupportedTagTypes[34] },
+{TYPE_HANDLER(cmsSigUInt32ArrayType,           UInt32),             (_cmsTagTypeLinkedList*) &SupportedTagTypes[35] },
+{TYPE_HANDLER(cmsSigUInt64ArrayType,           UInt64),             NULL }
 };
 
 
diff --git a/src/java.desktop/share/native/liblcms/cmsvirt.c b/src/java.desktop/share/native/liblcms/cmsvirt.c
index e8d18d4ca9f9..1ef86dae0544 100644
--- a/src/java.desktop/share/native/liblcms/cmsvirt.c
+++ b/src/java.desktop/share/native/liblcms/cmsvirt.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2023 Marti Maria Saguer
+//  Copyright (c) 1998-2024 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -412,7 +412,7 @@ int InkLimitingSampler(CMSREGISTER const cmsUInt16Number In[], CMSREGISTER cmsUI
     Out[1] = _cmsQuickSaturateWord(In[1] * Ratio);     // M
     Out[2] = _cmsQuickSaturateWord(In[2] * Ratio);     // Y
 
-    Out[3] = In[3];                                 // K (untouched)
+    Out[3] = In[3];                                    // K (untouched)
 
     return TRUE;
 }
@@ -433,7 +433,7 @@ cmsHPROFILE CMSEXPORT cmsCreateInkLimitingDeviceLinkTHR(cmsContext ContextID,
         return NULL;
     }
 
-    if (Limit < 0.0 || Limit > 400) {
+    if (Limit < 1.0 || Limit > 400) {
 
         cmsSignalError(ContextID, cmsERROR_RANGE, "InkLimiting: Limit should be between 1..400");
         if (Limit < 1) Limit = 1;
@@ -705,7 +705,7 @@ cmsHPROFILE CMSEXPORT cmsCreate_sRGBProfile(void)
 *
 * This virtual profile cannot be saved as an ICC file
 */
-cmsHPROFILE cmsCreate_OkLabProfile(cmsContext ctx)
+cmsHPROFILE CMSEXPORT cmsCreate_OkLabProfile(cmsContext ctx)
 {
     cmsStage* XYZPCS = _cmsStageNormalizeFromXyzFloat(ctx);
     cmsStage* PCSXYZ = _cmsStageNormalizeToXyzFloat(ctx);
@@ -774,6 +774,8 @@ cmsHPROFILE cmsCreate_OkLabProfile(cmsContext ctx)
     cmsPipeline* BToA = cmsPipelineAlloc(ctx, 3, 3);
 
     cmsHPROFILE hProfile = cmsCreateProfilePlaceholder(ctx);
+    if (!hProfile)            // can't allocate
+        goto error;
 
     cmsSetProfileVersion(hProfile, 4.4);
 
diff --git a/src/java.desktop/share/native/liblcms/cmswtpnt.c b/src/java.desktop/share/native/liblcms/cmswtpnt.c
index 27d718035318..ebba2cd6a978 100644
--- a/src/java.desktop/share/native/liblcms/cmswtpnt.c
+++ b/src/java.desktop/share/native/liblcms/cmswtpnt.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2023 Marti Maria Saguer
+//  Copyright (c) 1998-2024 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
diff --git a/src/java.desktop/share/native/liblcms/cmsxform.c b/src/java.desktop/share/native/liblcms/cmsxform.c
index 86afd7202fdb..1eb3eecbf182 100644
--- a/src/java.desktop/share/native/liblcms/cmsxform.c
+++ b/src/java.desktop/share/native/liblcms/cmsxform.c
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2023 Marti Maria Saguer
+//  Copyright (c) 1998-2024 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -295,7 +295,7 @@ void FloatXFORM(_cmsTRANSFORM* p,
     cmsUInt8Number* output;
     cmsFloat32Number fIn[cmsMAXCHANNELS], fOut[cmsMAXCHANNELS];
     cmsFloat32Number OutOfGamut;
-    cmsUInt32Number i, j, c, strideIn, strideOut;
+    size_t i, j, c, strideIn, strideOut;
 
     _cmsHandleExtraChannels(p, in, out, PixelsPerLine, LineCount, Stride);
 
@@ -322,9 +322,11 @@ void FloatXFORM(_cmsTRANSFORM* p,
                 // Is current color out of gamut?
                 if (OutOfGamut > 0.0) {
 
+                    _cmsAlarmCodesChunkType* ContextAlarmCodes = (_cmsAlarmCodesChunkType*)_cmsContextGetClientChunk(p->ContextID, AlarmCodesContext);
+
                     // Certainly, out of gamut
                     for (c = 0; c < cmsMAXCHANNELS; c++)
-                        fOut[c] = -1.0;
+                        fOut[c] = ContextAlarmCodes->AlarmCodes[c] / 65535.0F;
 
                 }
                 else {
@@ -361,7 +363,7 @@ void NullFloatXFORM(_cmsTRANSFORM* p,
     cmsUInt8Number* accum;
     cmsUInt8Number* output;
     cmsFloat32Number fIn[cmsMAXCHANNELS];
-    cmsUInt32Number i, j, strideIn, strideOut;
+    size_t i, j, strideIn, strideOut;
 
     _cmsHandleExtraChannels(p, in, out, PixelsPerLine, LineCount, Stride);
 
@@ -399,7 +401,7 @@ void NullXFORM(_cmsTRANSFORM* p,
     cmsUInt8Number* accum;
     cmsUInt8Number* output;
     cmsUInt16Number wIn[cmsMAXCHANNELS];
-    cmsUInt32Number i, j, strideIn, strideOut;
+    size_t i, j, strideIn, strideOut;
 
     _cmsHandleExtraChannels(p, in, out, PixelsPerLine, LineCount, Stride);
 
@@ -409,17 +411,17 @@ void NullXFORM(_cmsTRANSFORM* p,
 
     for (i = 0; i < LineCount; i++) {
 
-           accum = (cmsUInt8Number*)in + strideIn;
-           output = (cmsUInt8Number*)out + strideOut;
+        accum = (cmsUInt8Number*)in + strideIn;
+        output = (cmsUInt8Number*)out + strideOut;
 
-           for (j = 0; j < PixelsPerLine; j++) {
+        for (j = 0; j < PixelsPerLine; j++) {
 
-                  accum = p->FromInput(p, wIn, accum, Stride->BytesPerPlaneIn);
-                  output = p->ToOutput(p, wIn, output, Stride->BytesPerPlaneOut);
-    }
+            accum = p->FromInput(p, wIn, accum, Stride->BytesPerPlaneIn);
+            output = p->ToOutput(p, wIn, output, Stride->BytesPerPlaneOut);
+        }
 
-           strideIn += Stride->BytesPerLineIn;
-           strideOut += Stride->BytesPerLineOut;
+        strideIn += Stride->BytesPerLineIn;
+        strideOut += Stride->BytesPerLineOut;
     }
 
 }
@@ -437,7 +439,7 @@ void PrecalculatedXFORM(_cmsTRANSFORM* p,
     CMSREGISTER cmsUInt8Number* accum;
     CMSREGISTER cmsUInt8Number* output;
     cmsUInt16Number wIn[cmsMAXCHANNELS], wOut[cmsMAXCHANNELS];
-    cmsUInt32Number i, j, strideIn, strideOut;
+    size_t i, j, strideIn, strideOut;
 
     _cmsHandleExtraChannels(p, in, out, PixelsPerLine, LineCount, Stride);
 
@@ -500,7 +502,7 @@ void PrecalculatedXFORMGamutCheck(_cmsTRANSFORM* p,
     cmsUInt8Number* accum;
     cmsUInt8Number* output;
     cmsUInt16Number wIn[cmsMAXCHANNELS], wOut[cmsMAXCHANNELS];
-    cmsUInt32Number i, j, strideIn, strideOut;
+    size_t i, j, strideIn, strideOut;
 
     _cmsHandleExtraChannels(p, in, out, PixelsPerLine, LineCount, Stride);
 
@@ -511,18 +513,18 @@ void PrecalculatedXFORMGamutCheck(_cmsTRANSFORM* p,
 
     for (i = 0; i < LineCount; i++) {
 
-           accum = (cmsUInt8Number*)in + strideIn;
-           output = (cmsUInt8Number*)out + strideOut;
+        accum = (cmsUInt8Number*)in + strideIn;
+        output = (cmsUInt8Number*)out + strideOut;
 
-           for (j = 0; j < PixelsPerLine; j++) {
+        for (j = 0; j < PixelsPerLine; j++) {
 
-                  accum = p->FromInput(p, wIn, accum, Stride->BytesPerPlaneIn);
-                  TransformOnePixelWithGamutCheck(p, wIn, wOut);
-                  output = p->ToOutput(p, wOut, output, Stride->BytesPerPlaneOut);
-           }
+            accum = p->FromInput(p, wIn, accum, Stride->BytesPerPlaneIn);
+            TransformOnePixelWithGamutCheck(p, wIn, wOut);
+            output = p->ToOutput(p, wOut, output, Stride->BytesPerPlaneOut);
+        }
 
-           strideIn += Stride->BytesPerLineIn;
-           strideOut += Stride->BytesPerLineOut;
+        strideIn += Stride->BytesPerLineIn;
+        strideOut += Stride->BytesPerLineOut;
     }
 }
 
@@ -540,7 +542,7 @@ void CachedXFORM(_cmsTRANSFORM* p,
     cmsUInt8Number* output;
     cmsUInt16Number wIn[cmsMAXCHANNELS], wOut[cmsMAXCHANNELS];
     _cmsCACHE Cache;
-    cmsUInt32Number i, j, strideIn, strideOut;
+    size_t i, j, strideIn, strideOut;
 
     _cmsHandleExtraChannels(p, in, out, PixelsPerLine, LineCount, Stride);
 
@@ -595,7 +597,7 @@ void CachedXFORMGamutCheck(_cmsTRANSFORM* p,
     cmsUInt8Number* output;
     cmsUInt16Number wIn[cmsMAXCHANNELS], wOut[cmsMAXCHANNELS];
     _cmsCACHE Cache;
-    cmsUInt32Number i, j, strideIn, strideOut;
+    size_t i, j, strideIn, strideOut;
 
     _cmsHandleExtraChannels(p, in, out, PixelsPerLine, LineCount, Stride);
 
@@ -712,7 +714,7 @@ void _cmsTransform2toTransformAdaptor(struct _cmstransform_struct *CMMcargo,
                                       const cmsStride* Stride)
 {
 
-       cmsUInt32Number i, strideIn, strideOut;
+       size_t i, strideIn, strideOut;
 
        _cmsHandleExtraChannels(CMMcargo, InputBuffer, OutputBuffer, PixelsPerLine, LineCount, Stride);
 
@@ -1099,7 +1101,7 @@ cmsBool  IsProperColorSpace(cmsColorSpaceSignature Check, cmsUInt32Number dwForm
     int Space1 = (int) T_COLORSPACE(dwFormat);
     int Space2 = _cmsLCMScolorSpace(Check);
 
-    if (Space1 == PT_ANY) return TRUE;
+    if (Space1 == PT_ANY) return (T_CHANNELS(dwFormat) == cmsChannelsOf(Check));
     if (Space1 == Space2) return TRUE;
 
     if (Space1 == PT_LabV2 && Space2 == PT_Lab) return TRUE;
@@ -1160,7 +1162,15 @@ cmsHTRANSFORM CMSEXPORT cmsCreateExtendedTransform(cmsContext ContextID,
     cmsColorSpaceSignature EntryColorSpace;
     cmsColorSpaceSignature ExitColorSpace;
     cmsPipeline* Lut;
-    cmsUInt32Number LastIntent = Intents[nProfiles-1];
+    cmsUInt32Number LastIntent;
+
+    // Safeguard
+    if (nProfiles <= 0 || nProfiles > 255) {
+        cmsSignalError(ContextID, cmsERROR_RANGE, "Wrong number of profiles. 1..255 expected, %d found.", nProfiles);
+        return NULL;
+    }
+
+    LastIntent = Intents[nProfiles - 1];
 
     // If it is a fake transform
     if (dwFlags & cmsFLAGS_NULLTRANSFORM)
diff --git a/src/java.desktop/share/native/liblcms/lcms2.h b/src/java.desktop/share/native/liblcms/lcms2.h
index 2d9a8b1248f9..5ba096613088 100644
--- a/src/java.desktop/share/native/liblcms/lcms2.h
+++ b/src/java.desktop/share/native/liblcms/lcms2.h
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2023 Marti Maria Saguer
+//  Copyright (c) 1998-2025 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -52,7 +52,7 @@
 //
 //---------------------------------------------------------------------------------
 //
-// Version 2.16
+// Version 2.17
 //
 
 #ifndef _lcms2_H
@@ -93,6 +93,9 @@
 // Uncomment this to remove the "register" storage class
 // #define CMS_NO_REGISTER_KEYWORD 1
 
+// Uncomment this to remove visibility attribute when building shared objects
+// #define CMS_NO_VISIBILITY 1
+
 // ********** End of configuration toggles ******************************
 
 // Needed for streams
@@ -113,7 +116,7 @@ extern "C" {
 #endif
 
 // Version/release
-#define LCMS_VERSION        2160
+#define LCMS_VERSION        2170
 
 // I will give the chance of redefining basic types for compilers that are not fully C99 compliant
 #ifndef CMS_BASIC_TYPES_ALREADY_DEFINED
@@ -277,7 +280,7 @@ typedef int                  cmsBool;
 #     define CMSAPI
 #  endif
 #else  // not Windows
-#  ifdef HAVE_FUNC_ATTRIBUTE_VISIBILITY
+#  if defined(HAVE_FUNC_ATTRIBUTE_VISIBILITY) && !defined(CMS_NO_VISIBILITY)
 #     define CMSEXPORT
 #     define CMSAPI    __attribute__((visibility("default")))
 #  else
@@ -987,7 +990,6 @@ typedef void* cmsHTRANSFORM;
 // IEEE 754-2008 "half"
 #define TYPE_GRAY_HALF_FLT    (FLOAT_SH(1)|COLORSPACE_SH(PT_GRAY)|CHANNELS_SH(1)|BYTES_SH(2))
 #define TYPE_RGB_HALF_FLT     (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|CHANNELS_SH(3)|BYTES_SH(2))
-#define TYPE_RGBA_HALF_FLT    (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2))
 #define TYPE_CMYK_HALF_FLT    (FLOAT_SH(1)|COLORSPACE_SH(PT_CMYK)|CHANNELS_SH(4)|BYTES_SH(2))
 
 #define TYPE_RGBA_HALF_FLT    (FLOAT_SH(1)|COLORSPACE_SH(PT_RGB)|EXTRA_SH(1)|CHANNELS_SH(3)|BYTES_SH(2))
diff --git a/src/java.desktop/share/native/liblcms/lcms2_internal.h b/src/java.desktop/share/native/liblcms/lcms2_internal.h
index 75973edad0d2..d14c0dd823ea 100644
--- a/src/java.desktop/share/native/liblcms/lcms2_internal.h
+++ b/src/java.desktop/share/native/liblcms/lcms2_internal.h
@@ -27,9 +27,10 @@
 // However, the following notice accompanied the original version of this
 // file:
 //
+
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2023 Marti Maria Saguer
+//  Copyright (c) 1998-2024 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
@@ -467,7 +468,7 @@ cmsBool  _cmsRegisterTransformPlugin(cmsContext ContextID, cmsPluginBase* Plugin
 // Mutex
 cmsBool _cmsRegisterMutexPlugin(cmsContext ContextID, cmsPluginBase* Plugin);
 
-// Paralellization
+// Parallelization
 cmsBool _cmsRegisterParallelizationPlugin(cmsContext ContextID, cmsPluginBase* Plugin);
 
 // ---------------------------------------------------------------------------------------------------------
@@ -1000,7 +1001,7 @@ cmsBool           _cmsReadCHAD(cmsMAT3* Dest, cmsHPROFILE hProfile);
 
 // Link several profiles to obtain a single LUT modelling the whole color transform. Intents, Black point
 // compensation and Adaptation parameters may vary across profiles. BPC and Adaptation refers to the PCS
-// after the profile. I.e, BPC[0] refers to connexion between profile(0) and profile(1)
+// after the profile. I.e, BPC[0] refers to connetion between profile(0) and profile(1)
 cmsPipeline* _cmsLinkProfiles(cmsContext         ContextID,
                               cmsUInt32Number    nProfiles,
                               cmsUInt32Number    TheIntents[],
diff --git a/src/java.desktop/share/native/liblcms/lcms2_plugin.h b/src/java.desktop/share/native/liblcms/lcms2_plugin.h
index e7e7bd1f0ce1..bdfc76f6bf5d 100644
--- a/src/java.desktop/share/native/liblcms/lcms2_plugin.h
+++ b/src/java.desktop/share/native/liblcms/lcms2_plugin.h
@@ -30,7 +30,7 @@
 //---------------------------------------------------------------------------------
 //
 //  Little Color Management System
-//  Copyright (c) 1998-2023 Marti Maria Saguer
+//  Copyright (c) 1998-2024 Marti Maria Saguer
 //
 // Permission is hereby granted, free of charge, to any person obtaining
 // a copy of this software and associated documentation files (the "Software"),
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/CHANGES b/src/java.desktop/share/native/libsplashscreen/libpng/CHANGES
index 441b57ecf1ab..834b5e19277a 100644
--- a/src/java.desktop/share/native/libsplashscreen/libpng/CHANGES
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/CHANGES
@@ -6196,6 +6196,61 @@ Version 1.6.43 [February 23, 2024]
     consistency verification and text linting.
   Added version consistency verification to pngtest.c also.
 
+Version 1.6.44 [September 12, 2024]
+  Hardened calculations in chroma handling to prevent overflows, and
+    relaxed a constraint in cHRM validation to accomodate the standard
+    ACES AP1 set of color primaries.
+    (Contributed by John Bowler)
+  Removed the ASM implementation of ARM Neon optimizations and updated
+    the build accordingly. Only the remaining C implementation shall be
+    used from now on, thus ensuring the support of the PAC/BTI security
+    features on ARM64.
+    (Contributed by Ross Burton and John Bowler)
+  Fixed the pickup of the PNG_HARDWARE_OPTIMIZATIONS option in the
+    CMake build on FreeBSD/amd64. This is an important performance fix
+    on this platform.
+  Applied various fixes and improvements to the CMake build.
+    (Contributed by Eric Riff, Benjamin Buch and Erik Scholz)
+  Added fuzzing targets for the simplified read API.
+    (Contributed by Mikhail Khachayants)
+  Fixed a build error involving pngtest.c under a custom config.
+    This was a regression introduced in a code cleanup in libpng-1.6.43.
+    (Contributed by Ben Wagner)
+  Fixed and improved the config files for AppVeyor CI and Travis CI.
+
+Version 1.6.45 [January 7, 2025]
+  Added support for the cICP chunk.
+    (Contributed by Lucas Chollet and John Bowler)
+  Adjusted and improved various checks in colorspace calculations.
+    (Contributed by John Bowler)
+  Rearranged the write order of colorspace chunks for better conformance
+    with the PNG v3 draft specification.
+    (Contributed by John Bowler)
+  Raised the minimum required CMake version from 3.6 to 3.14.
+  Forked off a development branch for libpng version 1.8.
+
+Version 1.6.46 [January 23, 2025]
+  Added support for the mDCV and cLLI chunks.
+    (Contributed by John Bowler)
+  Fixed a build issue affecting C89 compilers.
+    This was a regression introduced in libpng-1.6.45.
+    (Contributed by John Bowler)
+  Added makefile.c89, specifically for testing C89 compilers.
+  Cleaned up contrib/pngminus: corrected an old typo, removed an old
+    workaround, and updated the CMake file.
+
+Version 1.6.47 [February 18, 2025]
+  Modified the behaviour of colorspace chunks in order to adhere
+    to the new precedence rules formulated in the latest draft of
+    the PNG Specification.
+    (Contributed by John Bowler)
+  Fixed a latent bug in `png_write_iCCP`.
+    This would have been a read-beyond-end-of-malloc vulnerability,
+    introduced early in the libpng-1.6.0 development, yet (fortunately!)
+    it was inaccessible before the above-mentioned modification of the
+    colorspace precedence rules, due to pre-existing colorspace checks.
+    (Reported by Bob Friesenhahn; fixed by John Bowler)
+
 Send comments/corrections/commendations to png-mng-implement at lists.sf.net.
 Subscription is required; visit
 https://lists.sourceforge.net/lists/listinfo/png-mng-implement
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/LICENSE b/src/java.desktop/share/native/libsplashscreen/libpng/LICENSE
index 25f298f0fcfd..ea6df986cb6a 100644
--- a/src/java.desktop/share/native/libsplashscreen/libpng/LICENSE
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/LICENSE
@@ -4,8 +4,8 @@ COPYRIGHT NOTICE, DISCLAIMER, and LICENSE
 PNG Reference Library License version 2
 ---------------------------------------
 
- * Copyright (c) 1995-2024 The PNG Reference Library Authors.
- * Copyright (c) 2018-2024 Cosmin Truta.
+ * Copyright (c) 1995-2025 The PNG Reference Library Authors.
+ * Copyright (c) 2018-2025 Cosmin Truta.
  * Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson.
  * Copyright (c) 1996-1997 Andreas Dilger.
  * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/README b/src/java.desktop/share/native/libsplashscreen/libpng/README
index a6ca3ae9f940..57952fb215ae 100644
--- a/src/java.desktop/share/native/libsplashscreen/libpng/README
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/README
@@ -1,4 +1,4 @@
-README for libpng version 1.6.43
+README for libpng version 1.6.47
 ================================
 
 See the note about version numbers near the top of `png.h`.
@@ -157,8 +157,6 @@ Files included in this distribution
                           "PNG: The Definitive Guide" by Greg Roelofs,
                           O'Reilly, 1999
         libtests/     =>  Test programs
-        oss-fuzz/     =>  Files used by the OSS-Fuzz project for fuzz-testing
-                          libpng
         pngexif/      =>  Program to inspect the EXIF information in PNG files
         pngminim/     =>  Minimal decoder, encoder, and progressive decoder
                           programs demonstrating the use of pngusr.dfa
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/png.c b/src/java.desktop/share/native/libsplashscreen/libpng/png.c
index 232dff876c79..7b6de2f8ec3a 100644
--- a/src/java.desktop/share/native/libsplashscreen/libpng/png.c
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/png.c
@@ -29,7 +29,7 @@
  * However, the following notice accompanied the original version of this
  * file and, per its terms, should not be removed:
  *
- * Copyright (c) 2018-2024 Cosmin Truta
+ * Copyright (c) 2018-2025 Cosmin Truta
  * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
  * Copyright (c) 1996-1997 Andreas Dilger
  * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
@@ -42,7 +42,34 @@
 #include "pngpriv.h"
 
 /* Generate a compiler error if there is an old png.h in the search path. */
-typedef png_libpng_version_1_6_43 Your_png_h_is_not_version_1_6_43;
+typedef png_libpng_version_1_6_47 Your_png_h_is_not_version_1_6_47;
+
+/* Sanity check the chunks definitions - PNG_KNOWN_CHUNKS from pngpriv.h and the
+ * corresponding macro definitions.  This causes a compile time failure if
+ * something is wrong but generates no code.
+ *
+ * (1) The first check is that the PNG_CHUNK(cHNK, index) 'index' values must
+ * increment from 0 to the last value.
+ */
+#define PNG_CHUNK(cHNK, index) != (index) || ((index)+1)
+
+#if 0 PNG_KNOWN_CHUNKS < 0
+#  error PNG_KNOWN_CHUNKS chunk definitions are not in order
+#endif
+
+#undef PNG_CHUNK
+
+/* (2) The chunk name macros, png_cHNK, must all be valid and defined.  Since
+ * this is a preprocessor test undefined pp-tokens come out as zero and will
+ * fail this test.
+ */
+#define PNG_CHUNK(cHNK, index) !PNG_CHUNK_NAME_VALID(png_ ## cHNK) ||
+
+#if PNG_KNOWN_CHUNKS 0
+#  error png_cHNK not defined for some known cHNK
+#endif
+
+#undef PNG_CHUNK
 
 /* Tells libpng that we have already handled the first "num_bytes" bytes
  * of the PNG file signature.  If the PNG data is embedded into another
@@ -270,21 +297,23 @@ png_create_png_struct,(png_const_charp user_png_ver, png_voidp error_ptr,
     */
    memset(&create_struct, 0, (sizeof create_struct));
 
-   /* Added at libpng-1.2.6 */
 #  ifdef PNG_USER_LIMITS_SUPPORTED
       create_struct.user_width_max = PNG_USER_WIDTH_MAX;
       create_struct.user_height_max = PNG_USER_HEIGHT_MAX;
 
 #     ifdef PNG_USER_CHUNK_CACHE_MAX
-      /* Added at libpng-1.2.43 and 1.4.0 */
       create_struct.user_chunk_cache_max = PNG_USER_CHUNK_CACHE_MAX;
 #     endif
 
-#     ifdef PNG_USER_CHUNK_MALLOC_MAX
-      /* Added at libpng-1.2.43 and 1.4.1, required only for read but exists
-       * in png_struct regardless.
-       */
+#     if PNG_USER_CHUNK_MALLOC_MAX > 0 /* default to compile-time limit */
       create_struct.user_chunk_malloc_max = PNG_USER_CHUNK_MALLOC_MAX;
+
+      /* No compile-time limit, so initialize to the system limit: */
+#     elif defined PNG_MAX_MALLOC_64K /* legacy system limit */
+      create_struct.user_chunk_malloc_max = 65536U;
+
+#     else /* modern system limit SIZE_MAX (C99) */
+      create_struct.user_chunk_malloc_max = PNG_SIZE_MAX;
 #     endif
 #  endif
 
@@ -626,13 +655,6 @@ png_free_data(png_const_structrp png_ptr, png_inforp info_ptr, png_uint_32 mask,
    /* Free any eXIf entry */
    if (((mask & PNG_FREE_EXIF) & info_ptr->free_me) != 0)
    {
-# ifdef PNG_READ_eXIf_SUPPORTED
-      if (info_ptr->eXIf_buf)
-      {
-         png_free(png_ptr, info_ptr->eXIf_buf);
-         info_ptr->eXIf_buf = NULL;
-      }
-# endif
       if (info_ptr->exif)
       {
          png_free(png_ptr, info_ptr->exif);
@@ -822,8 +844,8 @@ png_get_copyright(png_const_structrp png_ptr)
    return PNG_STRING_COPYRIGHT
 #else
    return PNG_STRING_NEWLINE \
-      "libpng version 1.6.43" PNG_STRING_NEWLINE \
-      "Copyright (c) 2018-2024 Cosmin Truta" PNG_STRING_NEWLINE \
+      "libpng version 1.6.47" PNG_STRING_NEWLINE \
+      "Copyright (c) 2018-2025 Cosmin Truta" PNG_STRING_NEWLINE \
       "Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson" \
       PNG_STRING_NEWLINE \
       "Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
@@ -1067,210 +1089,132 @@ png_zstream_error(png_structrp png_ptr, int ret)
    }
 }
 
-/* png_convert_size: a PNGAPI but no longer in png.h, so deleted
- * at libpng 1.5.5!
- */
-
-/* Added at libpng version 1.2.34 and 1.4.0 (moved from pngset.c) */
-#ifdef PNG_GAMMA_SUPPORTED /* always set if COLORSPACE */
-static int
-png_colorspace_check_gamma(png_const_structrp png_ptr,
-    png_colorspacerp colorspace, png_fixed_point gAMA, int from)
-   /* This is called to check a new gamma value against an existing one.  The
-    * routine returns false if the new gamma value should not be written.
-    *
-    * 'from' says where the new gamma value comes from:
-    *
-    *    0: the new gamma value is the libpng estimate for an ICC profile
-    *    1: the new gamma value comes from a gAMA chunk
-    *    2: the new gamma value comes from an sRGB chunk
-    */
+#ifdef PNG_COLORSPACE_SUPPORTED
+static png_int_32
+png_fp_add(png_int_32 addend0, png_int_32 addend1, int *error)
 {
-   png_fixed_point gtest;
-
-   if ((colorspace->flags & PNG_COLORSPACE_HAVE_GAMMA) != 0 &&
-       (png_muldiv(>est, colorspace->gamma, PNG_FP_1, gAMA) == 0  ||
-      png_gamma_significant(gtest) != 0))
+   /* Safely add two fixed point values setting an error flag and returning 0.5
+    * on overflow.
+    * IMPLEMENTATION NOTE: ANSI requires signed overflow not to occur, therefore
+    * relying on addition of two positive values producing a negative one is not
+    * safe.
+    */
+   if (addend0 > 0)
    {
-      /* Either this is an sRGB image, in which case the calculated gamma
-       * approximation should match, or this is an image with a profile and the
-       * value libpng calculates for the gamma of the profile does not match the
-       * value recorded in the file.  The former, sRGB, case is an error, the
-       * latter is just a warning.
-       */
-      if ((colorspace->flags & PNG_COLORSPACE_FROM_sRGB) != 0 || from == 2)
-      {
-         png_chunk_report(png_ptr, "gamma value does not match sRGB",
-             PNG_CHUNK_ERROR);
-         /* Do not overwrite an sRGB value */
-         return from == 2;
-      }
-
-      else /* sRGB tag not involved */
-      {
-         png_chunk_report(png_ptr, "gamma value does not match libpng estimate",
-             PNG_CHUNK_WARNING);
-         return from == 1;
-      }
+      if (0x7fffffff - addend0 >= addend1)
+         return addend0+addend1;
    }
-
-   return 1;
-}
-
-void /* PRIVATE */
-png_colorspace_set_gamma(png_const_structrp png_ptr,
-    png_colorspacerp colorspace, png_fixed_point gAMA)
-{
-   /* Changed in libpng-1.5.4 to limit the values to ensure overflow can't
-    * occur.  Since the fixed point representation is asymmetrical it is
-    * possible for 1/gamma to overflow the limit of 21474 and this means the
-    * gamma value must be at least 5/100000 and hence at most 20000.0.  For
-    * safety the limits here are a little narrower.  The values are 0.00016 to
-    * 6250.0, which are truly ridiculous gamma values (and will produce
-    * displays that are all black or all white.)
-    *
-    * In 1.6.0 this test replaces the ones in pngrutil.c, in the gAMA chunk
-    * handling code, which only required the value to be >0.
-    */
-   png_const_charp errmsg;
-
-   if (gAMA < 16 || gAMA > 625000000)
-      errmsg = "gamma value out of range";
-
-#  ifdef PNG_READ_gAMA_SUPPORTED
-   /* Allow the application to set the gamma value more than once */
-   else if ((png_ptr->mode & PNG_IS_READ_STRUCT) != 0 &&
-      (colorspace->flags & PNG_COLORSPACE_FROM_gAMA) != 0)
-      errmsg = "duplicate";
-#  endif
-
-   /* Do nothing if the colorspace is already invalid */
-   else if ((colorspace->flags & PNG_COLORSPACE_INVALID) != 0)
-      return;
-
-   else
+   else if (addend0 < 0)
    {
-      if (png_colorspace_check_gamma(png_ptr, colorspace, gAMA,
-          1/*from gAMA*/) != 0)
-      {
-         /* Store this gamma value. */
-         colorspace->gamma = gAMA;
-         colorspace->flags |=
-            (PNG_COLORSPACE_HAVE_GAMMA | PNG_COLORSPACE_FROM_gAMA);
-      }
-
-      /* At present if the check_gamma test fails the gamma of the colorspace is
-       * not updated however the colorspace is not invalidated.  This
-       * corresponds to the case where the existing gamma comes from an sRGB
-       * chunk or profile.  An error message has already been output.
-       */
-      return;
+      if (-0x7fffffff - addend0 <= addend1)
+         return addend0+addend1;
    }
+   else
+      return addend1;
 
-   /* Error exit - errmsg has been set. */
-   colorspace->flags |= PNG_COLORSPACE_INVALID;
-   png_chunk_report(png_ptr, errmsg, PNG_CHUNK_WRITE_ERROR);
+   *error = 1;
+   return PNG_FP_1/2;
 }
 
-void /* PRIVATE */
-png_colorspace_sync_info(png_const_structrp png_ptr, png_inforp info_ptr)
+static png_int_32
+png_fp_sub(png_int_32 addend0, png_int_32 addend1, int *error)
 {
-   if ((info_ptr->colorspace.flags & PNG_COLORSPACE_INVALID) != 0)
+   /* As above but calculate addend0-addend1. */
+   if (addend1 > 0)
    {
-      /* Everything is invalid */
-      info_ptr->valid &= ~(PNG_INFO_gAMA|PNG_INFO_cHRM|PNG_INFO_sRGB|
-         PNG_INFO_iCCP);
-
-#     ifdef PNG_COLORSPACE_SUPPORTED
-      /* Clean up the iCCP profile now if it won't be used. */
-      png_free_data(png_ptr, info_ptr, PNG_FREE_ICCP, -1/*not used*/);
-#     else
-      PNG_UNUSED(png_ptr)
-#     endif
+      if (-0x7fffffff + addend1 <= addend0)
+         return addend0-addend1;
    }
-
-   else
+   else if (addend1 < 0)
    {
-#     ifdef PNG_COLORSPACE_SUPPORTED
-      /* Leave the INFO_iCCP flag set if the pngset.c code has already set
-       * it; this allows a PNG to contain a profile which matches sRGB and
-       * yet still have that profile retrievable by the application.
-       */
-      if ((info_ptr->colorspace.flags & PNG_COLORSPACE_MATCHES_sRGB) != 0)
-         info_ptr->valid |= PNG_INFO_sRGB;
-
-      else
-         info_ptr->valid &= ~PNG_INFO_sRGB;
-
-      if ((info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS) != 0)
-         info_ptr->valid |= PNG_INFO_cHRM;
-
-      else
-         info_ptr->valid &= ~PNG_INFO_cHRM;
-#     endif
-
-      if ((info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_GAMMA) != 0)
-         info_ptr->valid |= PNG_INFO_gAMA;
-
-      else
-         info_ptr->valid &= ~PNG_INFO_gAMA;
+      if (0x7fffffff + addend1 >= addend0)
+         return addend0-addend1;
    }
+   else
+      return addend0;
+
+   *error = 1;
+   return PNG_FP_1/2;
 }
 
-#ifdef PNG_READ_SUPPORTED
-void /* PRIVATE */
-png_colorspace_sync(png_const_structrp png_ptr, png_inforp info_ptr)
+static int
+png_safe_add(png_int_32 *addend0_and_result, png_int_32 addend1,
+      png_int_32 addend2)
 {
-   if (info_ptr == NULL) /* reduce code size; check here not in the caller */
-      return;
-
-   info_ptr->colorspace = png_ptr->colorspace;
-   png_colorspace_sync_info(png_ptr, info_ptr);
+   /* Safely add three integers.  Returns 0 on success, 1 on overflow.  Does not
+    * set the result on overflow.
+    */
+   int error = 0;
+   int result = png_fp_add(*addend0_and_result,
+                           png_fp_add(addend1, addend2, &error),
+                           &error);
+   if (!error) *addend0_and_result = result;
+   return error;
 }
-#endif
-#endif /* GAMMA */
 
-#ifdef PNG_COLORSPACE_SUPPORTED
 /* Added at libpng-1.5.5 to support read and write of true CIEXYZ values for
  * cHRM, as opposed to using chromaticities.  These internal APIs return
  * non-zero on a parameter error.  The X, Y and Z values are required to be
  * positive and less than 1.0.
  */
-static int
+int /* PRIVATE */
 png_xy_from_XYZ(png_xy *xy, const png_XYZ *XYZ)
 {
-   png_int_32 d, dwhite, whiteX, whiteY;
+   /* NOTE: returns 0 on success, 1 means error. */
+   png_int_32 d, dred, dgreen, dblue, dwhite, whiteX, whiteY;
 
-   d = XYZ->red_X + XYZ->red_Y + XYZ->red_Z;
-   if (png_muldiv(&xy->redx, XYZ->red_X, PNG_FP_1, d) == 0)
+   /* 'd' in each of the blocks below is just X+Y+Z for each component,
+    * x, y and z are X,Y,Z/(X+Y+Z).
+    */
+   d = XYZ->red_X;
+   if (png_safe_add(&d, XYZ->red_Y, XYZ->red_Z))
       return 1;
-   if (png_muldiv(&xy->redy, XYZ->red_Y, PNG_FP_1, d) == 0)
+   dred = d;
+   if (png_muldiv(&xy->redx, XYZ->red_X, PNG_FP_1, dred) == 0)
+      return 1;
+   if (png_muldiv(&xy->redy, XYZ->red_Y, PNG_FP_1, dred) == 0)
       return 1;
-   dwhite = d;
-   whiteX = XYZ->red_X;
-   whiteY = XYZ->red_Y;
 
-   d = XYZ->green_X + XYZ->green_Y + XYZ->green_Z;
-   if (png_muldiv(&xy->greenx, XYZ->green_X, PNG_FP_1, d) == 0)
+   d = XYZ->green_X;
+   if (png_safe_add(&d, XYZ->green_Y, XYZ->green_Z))
       return 1;
-   if (png_muldiv(&xy->greeny, XYZ->green_Y, PNG_FP_1, d) == 0)
+   dgreen = d;
+   if (png_muldiv(&xy->greenx, XYZ->green_X, PNG_FP_1, dgreen) == 0)
+      return 1;
+   if (png_muldiv(&xy->greeny, XYZ->green_Y, PNG_FP_1, dgreen) == 0)
       return 1;
-   dwhite += d;
-   whiteX += XYZ->green_X;
-   whiteY += XYZ->green_Y;
 
-   d = XYZ->blue_X + XYZ->blue_Y + XYZ->blue_Z;
-   if (png_muldiv(&xy->bluex, XYZ->blue_X, PNG_FP_1, d) == 0)
+   d = XYZ->blue_X;
+   if (png_safe_add(&d, XYZ->blue_Y, XYZ->blue_Z))
+      return 1;
+   dblue = d;
+   if (png_muldiv(&xy->bluex, XYZ->blue_X, PNG_FP_1, dblue) == 0)
       return 1;
-   if (png_muldiv(&xy->bluey, XYZ->blue_Y, PNG_FP_1, d) == 0)
+   if (png_muldiv(&xy->bluey, XYZ->blue_Y, PNG_FP_1, dblue) == 0)
       return 1;
-   dwhite += d;
-   whiteX += XYZ->blue_X;
-   whiteY += XYZ->blue_Y;
 
-   /* The reference white is simply the sum of the end-point (X,Y,Z) vectors,
-    * thus:
+   /* The reference white is simply the sum of the end-point (X,Y,Z) vectors so
+    * the fillowing calculates (X+Y+Z) of the reference white (media white,
+    * encoding white) itself:
     */
+   d = dblue;
+   if (png_safe_add(&d, dred, dgreen))
+      return 1;
+   dwhite = d;
+
+   /* Find the white X,Y values from the sum of the red, green and blue X,Y
+    * values.
+    */
+   d = XYZ->red_X;
+   if (png_safe_add(&d, XYZ->green_X, XYZ->blue_X))
+      return 1;
+   whiteX = d;
+
+   d = XYZ->red_Y;
+   if (png_safe_add(&d, XYZ->green_Y, XYZ->blue_Y))
+      return 1;
+   whiteY = d;
+
    if (png_muldiv(&xy->whitex, whiteX, PNG_FP_1, dwhite) == 0)
       return 1;
    if (png_muldiv(&xy->whitey, whiteY, PNG_FP_1, dwhite) == 0)
@@ -1279,9 +1223,10 @@ png_xy_from_XYZ(png_xy *xy, const png_XYZ *XYZ)
    return 0;
 }
 
-static int
+int /* PRIVATE */
 png_XYZ_from_xy(png_XYZ *XYZ, const png_xy *xy)
 {
+   /* NOTE: returns 0 on success, 1 means error. */
    png_fixed_point red_inverse, green_inverse, blue_scale;
    png_fixed_point left, right, denominator;
 
@@ -1289,15 +1234,24 @@ png_XYZ_from_xy(png_XYZ *XYZ, const png_xy *xy)
     * have end points with 0 tristimulus values (these are impossible end
     * points, but they are used to cover the possible colors).  We check
     * xy->whitey against 5, not 0, to avoid a possible integer overflow.
+    *
+    * The limits here will *not* accept ACES AP0, where bluey is -7700
+    * (-0.0770) because the PNG spec itself requires the xy values to be
+    * unsigned.  whitey is also required to be 5 or more to avoid overflow.
+    *
+    * Instead the upper limits have been relaxed to accomodate ACES AP1 where
+    * redz ends up as -600 (-0.006).  ProPhotoRGB was already "in range."
+    * The new limit accomodates the AP0 and AP1 ranges for z but not AP0 redy.
     */
-   if (xy->redx   < 0 || xy->redx > PNG_FP_1) return 1;
-   if (xy->redy   < 0 || xy->redy > PNG_FP_1-xy->redx) return 1;
-   if (xy->greenx < 0 || xy->greenx > PNG_FP_1) return 1;
-   if (xy->greeny < 0 || xy->greeny > PNG_FP_1-xy->greenx) return 1;
-   if (xy->bluex  < 0 || xy->bluex > PNG_FP_1) return 1;
-   if (xy->bluey  < 0 || xy->bluey > PNG_FP_1-xy->bluex) return 1;
-   if (xy->whitex < 0 || xy->whitex > PNG_FP_1) return 1;
-   if (xy->whitey < 5 || xy->whitey > PNG_FP_1-xy->whitex) return 1;
+   const png_fixed_point fpLimit = PNG_FP_1+(PNG_FP_1/10);
+   if (xy->redx   < 0 || xy->redx > fpLimit) return 1;
+   if (xy->redy   < 0 || xy->redy > fpLimit-xy->redx) return 1;
+   if (xy->greenx < 0 || xy->greenx > fpLimit) return 1;
+   if (xy->greeny < 0 || xy->greeny > fpLimit-xy->greenx) return 1;
+   if (xy->bluex  < 0 || xy->bluex > fpLimit) return 1;
+   if (xy->bluey  < 0 || xy->bluey > fpLimit-xy->bluex) return 1;
+   if (xy->whitex < 0 || xy->whitex > fpLimit) return 1;
+   if (xy->whitey < 5 || xy->whitey > fpLimit-xy->whitex) return 1;
 
    /* The reverse calculation is more difficult because the original tristimulus
     * value had 9 independent values (red,green,blue)x(X,Y,Z) however only 8
@@ -1442,18 +1396,23 @@ png_XYZ_from_xy(png_XYZ *XYZ, const png_xy *xy)
     *  (green-x - blue-x)*(red-y - blue-y)-(green-y - blue-y)*(red-x - blue-x)
     *
     * Accuracy:
-    * The input values have 5 decimal digits of accuracy.  The values are all in
-    * the range 0 < value < 1, so simple products are in the same range but may
-    * need up to 10 decimal digits to preserve the original precision and avoid
-    * underflow.  Because we are using a 32-bit signed representation we cannot
-    * match this; the best is a little over 9 decimal digits, less than 10.
+    * The input values have 5 decimal digits of accuracy.
+    *
+    * In the previous implementation the values were all in the range 0 < value
+    * < 1, so simple products are in the same range but may need up to 10
+    * decimal digits to preserve the original precision and avoid underflow.
+    * Because we are using a 32-bit signed representation we cannot match this;
+    * the best is a little over 9 decimal digits, less than 10.
+    *
+    * This range has now been extended to allow values up to 1.1, or 110,000 in
+    * fixed point.
     *
     * The approach used here is to preserve the maximum precision within the
     * signed representation.  Because the red-scale calculation above uses the
-    * difference between two products of values that must be in the range -1..+1
-    * it is sufficient to divide the product by 7; ceil(100,000/32767*2).  The
-    * factor is irrelevant in the calculation because it is applied to both
-    * numerator and denominator.
+    * difference between two products of values that must be in the range
+    * -1.1..+1.1 it is sufficient to divide the product by 8;
+    * ceil(121,000/32767*2).  The factor is irrelevant in the calculation
+    * because it is applied to both numerator and denominator.
     *
     * Note that the values of the differences of the products of the
     * chromaticities in the above equations tend to be small, for example for
@@ -1475,49 +1434,64 @@ png_XYZ_from_xy(png_XYZ *XYZ, const png_xy *xy)
     *  Adobe Wide Gamut RGB
     *    0.258728243040113 0.724682314948566 0.016589442011321
     */
-   /* By the argument, above overflow should be impossible here. The return
-    * value of 2 indicates an internal error to the caller.
-    */
-   if (png_muldiv(&left, xy->greenx-xy->bluex, xy->redy - xy->bluey, 7) == 0)
-      return 2;
-   if (png_muldiv(&right, xy->greeny-xy->bluey, xy->redx - xy->bluex, 7) == 0)
-      return 2;
-   denominator = left - right;
-
-   /* Now find the red numerator. */
-   if (png_muldiv(&left, xy->greenx-xy->bluex, xy->whitey-xy->bluey, 7) == 0)
-      return 2;
-   if (png_muldiv(&right, xy->greeny-xy->bluey, xy->whitex-xy->bluex, 7) == 0)
-      return 2;
-
-   /* Overflow is possible here and it indicates an extreme set of PNG cHRM
-    * chunk values.  This calculation actually returns the reciprocal of the
-    * scale value because this allows us to delay the multiplication of white-y
-    * into the denominator, which tends to produce a small number.
-    */
-   if (png_muldiv(&red_inverse, xy->whitey, denominator, left-right) == 0 ||
-       red_inverse <= xy->whitey /* r+g+b scales = white scale */)
-      return 1;
+   {
+      int error = 0;
 
-   /* Similarly for green_inverse: */
-   if (png_muldiv(&left, xy->redy-xy->bluey, xy->whitex-xy->bluex, 7) == 0)
-      return 2;
-   if (png_muldiv(&right, xy->redx-xy->bluex, xy->whitey-xy->bluey, 7) == 0)
-      return 2;
-   if (png_muldiv(&green_inverse, xy->whitey, denominator, left-right) == 0 ||
-       green_inverse <= xy->whitey)
-      return 1;
+      /* By the argument above overflow should be impossible here, however the
+       * code now simply returns a failure code.  The xy subtracts in the
+       * arguments to png_muldiv are *not* checked for overflow because the
+       * checks at the start guarantee they are in the range 0..110000 and
+       * png_fixed_point is a 32-bit signed number.
+       */
+      if (png_muldiv(&left, xy->greenx-xy->bluex, xy->redy - xy->bluey, 8) == 0)
+         return 1;
+      if (png_muldiv(&right, xy->greeny-xy->bluey, xy->redx - xy->bluex, 8) ==
+            0)
+         return 1;
+      denominator = png_fp_sub(left, right, &error);
+      if (error) return 1;
 
-   /* And the blue scale, the checks above guarantee this can't overflow but it
-    * can still produce 0 for extreme cHRM values.
-    */
-   blue_scale = png_reciprocal(xy->whitey) - png_reciprocal(red_inverse) -
-       png_reciprocal(green_inverse);
-   if (blue_scale <= 0)
-      return 1;
+      /* Now find the red numerator. */
+      if (png_muldiv(&left, xy->greenx-xy->bluex, xy->whitey-xy->bluey, 8) == 0)
+         return 1;
+      if (png_muldiv(&right, xy->greeny-xy->bluey, xy->whitex-xy->bluex, 8) ==
+            0)
+         return 1;
 
+      /* Overflow is possible here and it indicates an extreme set of PNG cHRM
+       * chunk values.  This calculation actually returns the reciprocal of the
+       * scale value because this allows us to delay the multiplication of
+       * white-y into the denominator, which tends to produce a small number.
+       */
+      if (png_muldiv(&red_inverse, xy->whitey, denominator,
+                     png_fp_sub(left, right, &error)) == 0 || error ||
+          red_inverse <= xy->whitey /* r+g+b scales = white scale */)
+         return 1;
 
-   /* And fill in the png_XYZ: */
+      /* Similarly for green_inverse: */
+      if (png_muldiv(&left, xy->redy-xy->bluey, xy->whitex-xy->bluex, 8) == 0)
+         return 1;
+      if (png_muldiv(&right, xy->redx-xy->bluex, xy->whitey-xy->bluey, 8) == 0)
+         return 1;
+      if (png_muldiv(&green_inverse, xy->whitey, denominator,
+                     png_fp_sub(left, right, &error)) == 0 || error ||
+          green_inverse <= xy->whitey)
+         return 1;
+
+      /* And the blue scale, the checks above guarantee this can't overflow but
+       * it can still produce 0 for extreme cHRM values.
+       */
+      blue_scale = png_fp_sub(png_fp_sub(png_reciprocal(xy->whitey),
+                                         png_reciprocal(red_inverse), &error),
+                              png_reciprocal(green_inverse), &error);
+      if (error || blue_scale <= 0)
+         return 1;
+   }
+
+   /* And fill in the png_XYZ.  Again the subtracts are safe because of the
+    * checks on the xy values at the start (the subtracts just calculate the
+    * corresponding z values.)
+    */
    if (png_muldiv(&XYZ->red_X, xy->redx, PNG_FP_1, red_inverse) == 0)
       return 1;
    if (png_muldiv(&XYZ->red_Y, xy->redy, PNG_FP_1, red_inverse) == 0)
@@ -1544,250 +1518,9 @@ png_XYZ_from_xy(png_XYZ *XYZ, const png_xy *xy)
 
    return 0; /*success*/
 }
+#endif /* COLORSPACE */
 
-static int
-png_XYZ_normalize(png_XYZ *XYZ)
-{
-   png_int_32 Y;
-
-   if (XYZ->red_Y < 0 || XYZ->green_Y < 0 || XYZ->blue_Y < 0 ||
-      XYZ->red_X < 0 || XYZ->green_X < 0 || XYZ->blue_X < 0 ||
-      XYZ->red_Z < 0 || XYZ->green_Z < 0 || XYZ->blue_Z < 0)
-      return 1;
-
-   /* Normalize by scaling so the sum of the end-point Y values is PNG_FP_1.
-    * IMPLEMENTATION NOTE: ANSI requires signed overflow not to occur, therefore
-    * relying on addition of two positive values producing a negative one is not
-    * safe.
-    */
-   Y = XYZ->red_Y;
-   if (0x7fffffff - Y < XYZ->green_X)
-      return 1;
-   Y += XYZ->green_Y;
-   if (0x7fffffff - Y < XYZ->blue_X)
-      return 1;
-   Y += XYZ->blue_Y;
-
-   if (Y != PNG_FP_1)
-   {
-      if (png_muldiv(&XYZ->red_X, XYZ->red_X, PNG_FP_1, Y) == 0)
-         return 1;
-      if (png_muldiv(&XYZ->red_Y, XYZ->red_Y, PNG_FP_1, Y) == 0)
-         return 1;
-      if (png_muldiv(&XYZ->red_Z, XYZ->red_Z, PNG_FP_1, Y) == 0)
-         return 1;
-
-      if (png_muldiv(&XYZ->green_X, XYZ->green_X, PNG_FP_1, Y) == 0)
-         return 1;
-      if (png_muldiv(&XYZ->green_Y, XYZ->green_Y, PNG_FP_1, Y) == 0)
-         return 1;
-      if (png_muldiv(&XYZ->green_Z, XYZ->green_Z, PNG_FP_1, Y) == 0)
-         return 1;
-
-      if (png_muldiv(&XYZ->blue_X, XYZ->blue_X, PNG_FP_1, Y) == 0)
-         return 1;
-      if (png_muldiv(&XYZ->blue_Y, XYZ->blue_Y, PNG_FP_1, Y) == 0)
-         return 1;
-      if (png_muldiv(&XYZ->blue_Z, XYZ->blue_Z, PNG_FP_1, Y) == 0)
-         return 1;
-   }
-
-   return 0;
-}
-
-static int
-png_colorspace_endpoints_match(const png_xy *xy1, const png_xy *xy2, int delta)
-{
-   /* Allow an error of +/-0.01 (absolute value) on each chromaticity */
-   if (PNG_OUT_OF_RANGE(xy1->whitex, xy2->whitex,delta) ||
-       PNG_OUT_OF_RANGE(xy1->whitey, xy2->whitey,delta) ||
-       PNG_OUT_OF_RANGE(xy1->redx,   xy2->redx,  delta) ||
-       PNG_OUT_OF_RANGE(xy1->redy,   xy2->redy,  delta) ||
-       PNG_OUT_OF_RANGE(xy1->greenx, xy2->greenx,delta) ||
-       PNG_OUT_OF_RANGE(xy1->greeny, xy2->greeny,delta) ||
-       PNG_OUT_OF_RANGE(xy1->bluex,  xy2->bluex, delta) ||
-       PNG_OUT_OF_RANGE(xy1->bluey,  xy2->bluey, delta))
-      return 0;
-   return 1;
-}
-
-/* Added in libpng-1.6.0, a different check for the validity of a set of cHRM
- * chunk chromaticities.  Earlier checks used to simply look for the overflow
- * condition (where the determinant of the matrix to solve for XYZ ends up zero
- * because the chromaticity values are not all distinct.)  Despite this it is
- * theoretically possible to produce chromaticities that are apparently valid
- * but that rapidly degrade to invalid, potentially crashing, sets because of
- * arithmetic inaccuracies when calculations are performed on them.  The new
- * check is to round-trip xy -> XYZ -> xy and then check that the result is
- * within a small percentage of the original.
- */
-static int
-png_colorspace_check_xy(png_XYZ *XYZ, const png_xy *xy)
-{
-   int result;
-   png_xy xy_test;
-
-   /* As a side-effect this routine also returns the XYZ endpoints. */
-   result = png_XYZ_from_xy(XYZ, xy);
-   if (result != 0)
-      return result;
-
-   result = png_xy_from_XYZ(&xy_test, XYZ);
-   if (result != 0)
-      return result;
-
-   if (png_colorspace_endpoints_match(xy, &xy_test,
-       5/*actually, the math is pretty accurate*/) != 0)
-      return 0;
-
-   /* Too much slip */
-   return 1;
-}
-
-/* This is the check going the other way.  The XYZ is modified to normalize it
- * (another side-effect) and the xy chromaticities are returned.
- */
-static int
-png_colorspace_check_XYZ(png_xy *xy, png_XYZ *XYZ)
-{
-   int result;
-   png_XYZ XYZtemp;
-
-   result = png_XYZ_normalize(XYZ);
-   if (result != 0)
-      return result;
-
-   result = png_xy_from_XYZ(xy, XYZ);
-   if (result != 0)
-      return result;
-
-   XYZtemp = *XYZ;
-   return png_colorspace_check_xy(&XYZtemp, xy);
-}
-
-/* Used to check for an endpoint match against sRGB */
-static const png_xy sRGB_xy = /* From ITU-R BT.709-3 */
-{
-   /* color      x       y */
-   /* red   */ 64000, 33000,
-   /* green */ 30000, 60000,
-   /* blue  */ 15000,  6000,
-   /* white */ 31270, 32900
-};
-
-static int
-png_colorspace_set_xy_and_XYZ(png_const_structrp png_ptr,
-    png_colorspacerp colorspace, const png_xy *xy, const png_XYZ *XYZ,
-    int preferred)
-{
-   if ((colorspace->flags & PNG_COLORSPACE_INVALID) != 0)
-      return 0;
-
-   /* The consistency check is performed on the chromaticities; this factors out
-    * variations because of the normalization (or not) of the end point Y
-    * values.
-    */
-   if (preferred < 2 &&
-       (colorspace->flags & PNG_COLORSPACE_HAVE_ENDPOINTS) != 0)
-   {
-      /* The end points must be reasonably close to any we already have.  The
-       * following allows an error of up to +/-.001
-       */
-      if (png_colorspace_endpoints_match(xy, &colorspace->end_points_xy,
-          100) == 0)
-      {
-         colorspace->flags |= PNG_COLORSPACE_INVALID;
-         png_benign_error(png_ptr, "inconsistent chromaticities");
-         return 0; /* failed */
-      }
-
-      /* Only overwrite with preferred values */
-      if (preferred == 0)
-         return 1; /* ok, but no change */
-   }
-
-   colorspace->end_points_xy = *xy;
-   colorspace->end_points_XYZ = *XYZ;
-   colorspace->flags |= PNG_COLORSPACE_HAVE_ENDPOINTS;
-
-   /* The end points are normally quoted to two decimal digits, so allow +/-0.01
-    * on this test.
-    */
-   if (png_colorspace_endpoints_match(xy, &sRGB_xy, 1000) != 0)
-      colorspace->flags |= PNG_COLORSPACE_ENDPOINTS_MATCH_sRGB;
-
-   else
-      colorspace->flags &= PNG_COLORSPACE_CANCEL(
-         PNG_COLORSPACE_ENDPOINTS_MATCH_sRGB);
-
-   return 2; /* ok and changed */
-}
-
-int /* PRIVATE */
-png_colorspace_set_chromaticities(png_const_structrp png_ptr,
-    png_colorspacerp colorspace, const png_xy *xy, int preferred)
-{
-   /* We must check the end points to ensure they are reasonable - in the past
-    * color management systems have crashed as a result of getting bogus
-    * colorant values, while this isn't the fault of libpng it is the
-    * responsibility of libpng because PNG carries the bomb and libpng is in a
-    * position to protect against it.
-    */
-   png_XYZ XYZ;
-
-   switch (png_colorspace_check_xy(&XYZ, xy))
-   {
-      case 0: /* success */
-         return png_colorspace_set_xy_and_XYZ(png_ptr, colorspace, xy, &XYZ,
-             preferred);
-
-      case 1:
-         /* We can't invert the chromaticities so we can't produce value XYZ
-          * values.  Likely as not a color management system will fail too.
-          */
-         colorspace->flags |= PNG_COLORSPACE_INVALID;
-         png_benign_error(png_ptr, "invalid chromaticities");
-         break;
-
-      default:
-         /* libpng is broken; this should be a warning but if it happens we
-          * want error reports so for the moment it is an error.
-          */
-         colorspace->flags |= PNG_COLORSPACE_INVALID;
-         png_error(png_ptr, "internal error checking chromaticities");
-   }
-
-   return 0; /* failed */
-}
-
-int /* PRIVATE */
-png_colorspace_set_endpoints(png_const_structrp png_ptr,
-    png_colorspacerp colorspace, const png_XYZ *XYZ_in, int preferred)
-{
-   png_XYZ XYZ = *XYZ_in;
-   png_xy xy;
-
-   switch (png_colorspace_check_XYZ(&xy, &XYZ))
-   {
-      case 0:
-         return png_colorspace_set_xy_and_XYZ(png_ptr, colorspace, &xy, &XYZ,
-             preferred);
-
-      case 1:
-         /* End points are invalid. */
-         colorspace->flags |= PNG_COLORSPACE_INVALID;
-         png_benign_error(png_ptr, "invalid end points");
-         break;
-
-      default:
-         colorspace->flags |= PNG_COLORSPACE_INVALID;
-         png_error(png_ptr, "internal error checking chromaticities");
-   }
-
-   return 0; /* failed */
-}
-
-#if defined(PNG_sRGB_SUPPORTED) || defined(PNG_iCCP_SUPPORTED)
+#ifdef PNG_iCCP_SUPPORTED
 /* Error message generation */
 static char
 png_icc_tag_char(png_uint_32 byte)
@@ -1827,15 +1560,12 @@ is_ICC_signature(png_alloc_size_t it)
 }
 
 static int
-png_icc_profile_error(png_const_structrp png_ptr, png_colorspacerp colorspace,
-    png_const_charp name, png_alloc_size_t value, png_const_charp reason)
+png_icc_profile_error(png_const_structrp png_ptr, png_const_charp name,
+   png_alloc_size_t value, png_const_charp reason)
 {
    size_t pos;
    char message[196]; /* see below for calculation */
 
-   if (colorspace != NULL)
-      colorspace->flags |= PNG_COLORSPACE_INVALID;
-
    pos = png_safecat(message, (sizeof message), 0, "profile '"); /* 9 chars */
    pos = png_safecat(message, pos+79, pos, name); /* Truncate to 79 chars */
    pos = png_safecat(message, (sizeof message), pos, "': "); /* +2 = 90 */
@@ -1862,109 +1592,13 @@ png_icc_profile_error(png_const_structrp png_ptr, png_colorspacerp colorspace,
    pos = png_safecat(message, (sizeof message), pos, reason);
    PNG_UNUSED(pos)
 
-   /* This is recoverable, but make it unconditionally an app_error on write to
-    * avoid writing invalid ICC profiles into PNG files (i.e., we handle them
-    * on read, with a warning, but on write unless the app turns off
-    * application errors the PNG won't be written.)
-    */
-   png_chunk_report(png_ptr, message,
-       (colorspace != NULL) ? PNG_CHUNK_ERROR : PNG_CHUNK_WRITE_ERROR);
+   png_chunk_benign_error(png_ptr, message);
 
    return 0;
 }
-#endif /* sRGB || iCCP */
-
-#ifdef PNG_sRGB_SUPPORTED
-int /* PRIVATE */
-png_colorspace_set_sRGB(png_const_structrp png_ptr, png_colorspacerp colorspace,
-    int intent)
-{
-   /* sRGB sets known gamma, end points and (from the chunk) intent. */
-   /* IMPORTANT: these are not necessarily the values found in an ICC profile
-    * because ICC profiles store values adapted to a D50 environment; it is
-    * expected that the ICC profile mediaWhitePointTag will be D50; see the
-    * checks and code elsewhere to understand this better.
-    *
-    * These XYZ values, which are accurate to 5dp, produce rgb to gray
-    * coefficients of (6968,23435,2366), which are reduced (because they add up
-    * to 32769 not 32768) to (6968,23434,2366).  These are the values that
-    * libpng has traditionally used (and are the best values given the 15bit
-    * algorithm used by the rgb to gray code.)
-    */
-   static const png_XYZ sRGB_XYZ = /* D65 XYZ (*not* the D50 adapted values!) */
-   {
-      /* color      X      Y      Z */
-      /* red   */ 41239, 21264,  1933,
-      /* green */ 35758, 71517, 11919,
-      /* blue  */ 18048,  7219, 95053
-   };
-
-   /* Do nothing if the colorspace is already invalidated. */
-   if ((colorspace->flags & PNG_COLORSPACE_INVALID) != 0)
-      return 0;
-
-   /* Check the intent, then check for existing settings.  It is valid for the
-    * PNG file to have cHRM or gAMA chunks along with sRGB, but the values must
-    * be consistent with the correct values.  If, however, this function is
-    * called below because an iCCP chunk matches sRGB then it is quite
-    * conceivable that an older app recorded incorrect gAMA and cHRM because of
-    * an incorrect calculation based on the values in the profile - this does
-    * *not* invalidate the profile (though it still produces an error, which can
-    * be ignored.)
-    */
-   if (intent < 0 || intent >= PNG_sRGB_INTENT_LAST)
-      return png_icc_profile_error(png_ptr, colorspace, "sRGB",
-          (png_alloc_size_t)intent, "invalid sRGB rendering intent");
-
-   if ((colorspace->flags & PNG_COLORSPACE_HAVE_INTENT) != 0 &&
-       colorspace->rendering_intent != intent)
-      return png_icc_profile_error(png_ptr, colorspace, "sRGB",
-         (png_alloc_size_t)intent, "inconsistent rendering intents");
-
-   if ((colorspace->flags & PNG_COLORSPACE_FROM_sRGB) != 0)
-   {
-      png_benign_error(png_ptr, "duplicate sRGB information ignored");
-      return 0;
-   }
-
-   /* If the standard sRGB cHRM chunk does not match the one from the PNG file
-    * warn but overwrite the value with the correct one.
-    */
-   if ((colorspace->flags & PNG_COLORSPACE_HAVE_ENDPOINTS) != 0 &&
-       !png_colorspace_endpoints_match(&sRGB_xy, &colorspace->end_points_xy,
-       100))
-      png_chunk_report(png_ptr, "cHRM chunk does not match sRGB",
-         PNG_CHUNK_ERROR);
-
-   /* This check is just done for the error reporting - the routine always
-    * returns true when the 'from' argument corresponds to sRGB (2).
-    */
-   (void)png_colorspace_check_gamma(png_ptr, colorspace, PNG_GAMMA_sRGB_INVERSE,
-       2/*from sRGB*/);
-
-   /* intent: bugs in GCC force 'int' to be used as the parameter type. */
-   colorspace->rendering_intent = (png_uint_16)intent;
-   colorspace->flags |= PNG_COLORSPACE_HAVE_INTENT;
-
-   /* endpoints */
-   colorspace->end_points_xy = sRGB_xy;
-   colorspace->end_points_XYZ = sRGB_XYZ;
-   colorspace->flags |=
-      (PNG_COLORSPACE_HAVE_ENDPOINTS|PNG_COLORSPACE_ENDPOINTS_MATCH_sRGB);
-
-   /* gamma */
-   colorspace->gamma = PNG_GAMMA_sRGB_INVERSE;
-   colorspace->flags |= PNG_COLORSPACE_HAVE_GAMMA;
-
-   /* Finally record that we have an sRGB profile */
-   colorspace->flags |=
-      (PNG_COLORSPACE_MATCHES_sRGB|PNG_COLORSPACE_FROM_sRGB);
-
-   return 1; /* set */
-}
-#endif /* sRGB */
+#endif /* iCCP */
 
-#ifdef PNG_iCCP_SUPPORTED
+#ifdef PNG_READ_iCCP_SUPPORTED
 /* Encoded value of D50 as an ICC XYZNumber.  From the ICC 2010 spec the value
  * is XYZ(0.9642,1.0,0.8249), which scales to:
  *
@@ -1974,21 +1608,19 @@ static const png_byte D50_nCIEXYZ[12] =
    { 0x00, 0x00, 0xf6, 0xd6, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0xd3, 0x2d };
 
 static int /* bool */
-icc_check_length(png_const_structrp png_ptr, png_colorspacerp colorspace,
-    png_const_charp name, png_uint_32 profile_length)
+icc_check_length(png_const_structrp png_ptr, png_const_charp name,
+   png_uint_32 profile_length)
 {
    if (profile_length < 132)
-      return png_icc_profile_error(png_ptr, colorspace, name, profile_length,
-          "too short");
+      return png_icc_profile_error(png_ptr, name, profile_length, "too short");
    return 1;
 }
 
-#ifdef PNG_READ_iCCP_SUPPORTED
 int /* PRIVATE */
-png_icc_check_length(png_const_structrp png_ptr, png_colorspacerp colorspace,
-    png_const_charp name, png_uint_32 profile_length)
+png_icc_check_length(png_const_structrp png_ptr, png_const_charp name,
+   png_uint_32 profile_length)
 {
-   if (!icc_check_length(png_ptr, colorspace, name, profile_length))
+   if (!icc_check_length(png_ptr, name, profile_length))
       return 0;
 
    /* This needs to be here because the 'normal' check is in
@@ -1997,30 +1629,17 @@ png_icc_check_length(png_const_structrp png_ptr, png_colorspacerp colorspace,
     * the caller supplies the profile buffer so libpng doesn't allocate it.  See
     * the call to icc_check_length below (the write case).
     */
-#  ifdef PNG_SET_USER_LIMITS_SUPPORTED
-      else if (png_ptr->user_chunk_malloc_max > 0 &&
-               png_ptr->user_chunk_malloc_max < profile_length)
-         return png_icc_profile_error(png_ptr, colorspace, name, profile_length,
-             "exceeds application limits");
-#  elif PNG_USER_CHUNK_MALLOC_MAX > 0
-      else if (PNG_USER_CHUNK_MALLOC_MAX < profile_length)
-         return png_icc_profile_error(png_ptr, colorspace, name, profile_length,
-             "exceeds libpng limits");
-#  else /* !SET_USER_LIMITS */
-      /* This will get compiled out on all 32-bit and better systems. */
-      else if (PNG_SIZE_MAX < profile_length)
-         return png_icc_profile_error(png_ptr, colorspace, name, profile_length,
-             "exceeds system limits");
-#  endif /* !SET_USER_LIMITS */
+   if (profile_length > png_chunk_max(png_ptr))
+      return png_icc_profile_error(png_ptr, name, profile_length,
+            "profile too long");
 
    return 1;
 }
-#endif /* READ_iCCP */
 
 int /* PRIVATE */
-png_icc_check_header(png_const_structrp png_ptr, png_colorspacerp colorspace,
-    png_const_charp name, png_uint_32 profile_length,
-    png_const_bytep profile/* first 132 bytes only */, int color_type)
+png_icc_check_header(png_const_structrp png_ptr, png_const_charp name,
+   png_uint_32 profile_length,
+   png_const_bytep profile/* first 132 bytes only */, int color_type)
 {
    png_uint_32 temp;
 
@@ -2031,18 +1650,18 @@ png_icc_check_header(png_const_structrp png_ptr, png_colorspacerp colorspace,
     */
    temp = png_get_uint_32(profile);
    if (temp != profile_length)
-      return png_icc_profile_error(png_ptr, colorspace, name, temp,
+      return png_icc_profile_error(png_ptr, name, temp,
           "length does not match profile");
 
    temp = (png_uint_32) (*(profile+8));
    if (temp > 3 && (profile_length & 3))
-      return png_icc_profile_error(png_ptr, colorspace, name, profile_length,
+      return png_icc_profile_error(png_ptr, name, profile_length,
           "invalid length");
 
    temp = png_get_uint_32(profile+128); /* tag count: 12 bytes/tag */
    if (temp > 357913930 || /* (2^32-4-132)/12: maximum possible tag count */
       profile_length < 132+12*temp) /* truncated tag table */
-      return png_icc_profile_error(png_ptr, colorspace, name, temp,
+      return png_icc_profile_error(png_ptr, name, temp,
           "tag count too large");
 
    /* The 'intent' must be valid or we can't store it, ICC limits the intent to
@@ -2050,14 +1669,14 @@ png_icc_check_header(png_const_structrp png_ptr, png_colorspacerp colorspace,
     */
    temp = png_get_uint_32(profile+64);
    if (temp >= 0xffff) /* The ICC limit */
-      return png_icc_profile_error(png_ptr, colorspace, name, temp,
+      return png_icc_profile_error(png_ptr, name, temp,
           "invalid rendering intent");
 
    /* This is just a warning because the profile may be valid in future
     * versions.
     */
    if (temp >= PNG_sRGB_INTENT_LAST)
-      (void)png_icc_profile_error(png_ptr, NULL, name, temp,
+      (void)png_icc_profile_error(png_ptr, name, temp,
           "intent outside defined range");
 
    /* At this point the tag table can't be checked because it hasn't necessarily
@@ -2074,7 +1693,7 @@ png_icc_check_header(png_const_structrp png_ptr, png_colorspacerp colorspace,
     */
    temp = png_get_uint_32(profile+36); /* signature 'ascp' */
    if (temp != 0x61637370)
-      return png_icc_profile_error(png_ptr, colorspace, name, temp,
+      return png_icc_profile_error(png_ptr, name, temp,
           "invalid signature");
 
    /* Currently the PCS illuminant/adopted white point (the computational
@@ -2085,7 +1704,7 @@ png_icc_check_header(png_const_structrp png_ptr, png_colorspacerp colorspace,
     * following is just a warning.
     */
    if (memcmp(profile+68, D50_nCIEXYZ, 12) != 0)
-      (void)png_icc_profile_error(png_ptr, NULL, name, 0/*no tag value*/,
+      (void)png_icc_profile_error(png_ptr, name, 0/*no tag value*/,
           "PCS illuminant is not D50");
 
    /* The PNG spec requires this:
@@ -2113,18 +1732,18 @@ png_icc_check_header(png_const_structrp png_ptr, png_colorspacerp colorspace,
    {
       case 0x52474220: /* 'RGB ' */
          if ((color_type & PNG_COLOR_MASK_COLOR) == 0)
-            return png_icc_profile_error(png_ptr, colorspace, name, temp,
+            return png_icc_profile_error(png_ptr, name, temp,
                 "RGB color space not permitted on grayscale PNG");
          break;
 
       case 0x47524159: /* 'GRAY' */
          if ((color_type & PNG_COLOR_MASK_COLOR) != 0)
-            return png_icc_profile_error(png_ptr, colorspace, name, temp,
+            return png_icc_profile_error(png_ptr, name, temp,
                 "Gray color space not permitted on RGB PNG");
          break;
 
       default:
-         return png_icc_profile_error(png_ptr, colorspace, name, temp,
+         return png_icc_profile_error(png_ptr, name, temp,
              "invalid ICC profile color space");
    }
 
@@ -2149,7 +1768,7 @@ png_icc_check_header(png_const_structrp png_ptr, png_colorspacerp colorspace,
 
       case 0x61627374: /* 'abst' */
          /* May not be embedded in an image */
-         return png_icc_profile_error(png_ptr, colorspace, name, temp,
+         return png_icc_profile_error(png_ptr, name, temp,
              "invalid embedded Abstract ICC profile");
 
       case 0x6c696e6b: /* 'link' */
@@ -2159,7 +1778,7 @@ png_icc_check_header(png_const_structrp png_ptr, png_colorspacerp colorspace,
           * therefore a DeviceLink profile should not be found embedded in a
           * PNG.
           */
-         return png_icc_profile_error(png_ptr, colorspace, name, temp,
+         return png_icc_profile_error(png_ptr, name, temp,
              "unexpected DeviceLink ICC profile class");
 
       case 0x6e6d636c: /* 'nmcl' */
@@ -2167,7 +1786,7 @@ png_icc_check_header(png_const_structrp png_ptr, png_colorspacerp colorspace,
           * contain an AToB0 tag that is open to misinterpretation.  Almost
           * certainly it will fail the tests below.
           */
-         (void)png_icc_profile_error(png_ptr, NULL, name, temp,
+         (void)png_icc_profile_error(png_ptr, name, temp,
              "unexpected NamedColor ICC profile class");
          break;
 
@@ -2177,7 +1796,7 @@ png_icc_check_header(png_const_structrp png_ptr, png_colorspacerp colorspace,
           * tag content to ensure they are backward compatible with one of the
           * understood profiles.
           */
-         (void)png_icc_profile_error(png_ptr, NULL, name, temp,
+         (void)png_icc_profile_error(png_ptr, name, temp,
              "unrecognized ICC profile class");
          break;
    }
@@ -2193,7 +1812,7 @@ png_icc_check_header(png_const_structrp png_ptr, png_colorspacerp colorspace,
          break;
 
       default:
-         return png_icc_profile_error(png_ptr, colorspace, name, temp,
+         return png_icc_profile_error(png_ptr, name, temp,
              "unexpected ICC PCS encoding");
    }
 
@@ -2201,9 +1820,9 @@ png_icc_check_header(png_const_structrp png_ptr, png_colorspacerp colorspace,
 }
 
 int /* PRIVATE */
-png_icc_check_tag_table(png_const_structrp png_ptr, png_colorspacerp colorspace,
-    png_const_charp name, png_uint_32 profile_length,
-    png_const_bytep profile /* header plus whole tag table */)
+png_icc_check_tag_table(png_const_structrp png_ptr, png_const_charp name,
+   png_uint_32 profile_length,
+   png_const_bytep profile /* header plus whole tag table */)
 {
    png_uint_32 tag_count = png_get_uint_32(profile+128);
    png_uint_32 itag;
@@ -2229,7 +1848,7 @@ png_icc_check_tag_table(png_const_structrp png_ptr, png_colorspacerp colorspace,
        * profile.
        */
       if (tag_start > profile_length || tag_length > profile_length - tag_start)
-         return png_icc_profile_error(png_ptr, colorspace, name, tag_id,
+         return png_icc_profile_error(png_ptr, name, tag_id,
              "ICC profile tag outside profile");
 
       if ((tag_start & 3) != 0)
@@ -2238,307 +1857,132 @@ png_icc_check_tag_table(png_const_structrp png_ptr, png_colorspacerp colorspace,
           * only a warning here because libpng does not care about the
           * alignment.
           */
-         (void)png_icc_profile_error(png_ptr, NULL, name, tag_id,
+         (void)png_icc_profile_error(png_ptr, name, tag_id,
              "ICC profile tag start not a multiple of 4");
       }
    }
 
    return 1; /* success, maybe with warnings */
 }
+#endif /* READ_iCCP */
 
-#ifdef PNG_sRGB_SUPPORTED
-#if PNG_sRGB_PROFILE_CHECKS >= 0
-/* Information about the known ICC sRGB profiles */
-static const struct
-{
-   png_uint_32 adler, crc, length;
-   png_uint_32 md5[4];
-   png_byte    have_md5;
-   png_byte    is_broken;
-   png_uint_16 intent;
-
-#  define PNG_MD5(a,b,c,d) { a, b, c, d }, (a!=0)||(b!=0)||(c!=0)||(d!=0)
-#  define PNG_ICC_CHECKSUM(adler, crc, md5, intent, broke, date, length, fname)\
-      { adler, crc, length, md5, broke, intent },
-
-} png_sRGB_checks[] =
-{
-   /* This data comes from contrib/tools/checksum-icc run on downloads of
-    * all four ICC sRGB profiles from www.color.org.
-    */
-   /* adler32, crc32, MD5[4], intent, date, length, file-name */
-   PNG_ICC_CHECKSUM(0x0a3fd9f6, 0x3b8772b9,
-       PNG_MD5(0x29f83dde, 0xaff255ae, 0x7842fae4, 0xca83390d), 0, 0,
-       "2009/03/27 21:36:31", 3048, "sRGB_IEC61966-2-1_black_scaled.icc")
-
-   /* ICC sRGB v2 perceptual no black-compensation: */
-   PNG_ICC_CHECKSUM(0x4909e5e1, 0x427ebb21,
-       PNG_MD5(0xc95bd637, 0xe95d8a3b, 0x0df38f99, 0xc1320389), 1, 0,
-       "2009/03/27 21:37:45", 3052, "sRGB_IEC61966-2-1_no_black_scaling.icc")
-
-   PNG_ICC_CHECKSUM(0xfd2144a1, 0x306fd8ae,
-       PNG_MD5(0xfc663378, 0x37e2886b, 0xfd72e983, 0x8228f1b8), 0, 0,
-       "2009/08/10 17:28:01", 60988, "sRGB_v4_ICC_preference_displayclass.icc")
-
-   /* ICC sRGB v4 perceptual */
-   PNG_ICC_CHECKSUM(0x209c35d2, 0xbbef7812,
-       PNG_MD5(0x34562abf, 0x994ccd06, 0x6d2c5721, 0xd0d68c5d), 0, 0,
-       "2007/07/25 00:05:37", 60960, "sRGB_v4_ICC_preference.icc")
-
-   /* The following profiles have no known MD5 checksum. If there is a match
-    * on the (empty) MD5 the other fields are used to attempt a match and
-    * a warning is produced.  The first two of these profiles have a 'cprt' tag
-    * which suggests that they were also made by Hewlett Packard.
-    */
-   PNG_ICC_CHECKSUM(0xa054d762, 0x5d5129ce,
-       PNG_MD5(0x00000000, 0x00000000, 0x00000000, 0x00000000), 1, 0,
-       "2004/07/21 18:57:42", 3024, "sRGB_IEC61966-2-1_noBPC.icc")
-
-   /* This is a 'mntr' (display) profile with a mediaWhitePointTag that does not
-    * match the D50 PCS illuminant in the header (it is in fact the D65 values,
-    * so the white point is recorded as the un-adapted value.)  The profiles
-    * below only differ in one byte - the intent - and are basically the same as
-    * the previous profile except for the mediaWhitePointTag error and a missing
-    * chromaticAdaptationTag.
-    */
-   PNG_ICC_CHECKSUM(0xf784f3fb, 0x182ea552,
-       PNG_MD5(0x00000000, 0x00000000, 0x00000000, 0x00000000), 0, 1/*broken*/,
-       "1998/02/09 06:49:00", 3144, "HP-Microsoft sRGB v2 perceptual")
-
-   PNG_ICC_CHECKSUM(0x0398f3fc, 0xf29e526d,
-       PNG_MD5(0x00000000, 0x00000000, 0x00000000, 0x00000000), 1, 1/*broken*/,
-       "1998/02/09 06:49:00", 3144, "HP-Microsoft sRGB v2 media-relative")
-};
-
+#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
+#if (defined PNG_READ_mDCV_SUPPORTED) || (defined PNG_READ_cHRM_SUPPORTED)
 static int
-png_compare_ICC_profile_with_sRGB(png_const_structrp png_ptr,
-    png_const_bytep profile, uLong adler)
+have_chromaticities(png_const_structrp png_ptr)
 {
-   /* The quick check is to verify just the MD5 signature and trust the
-    * rest of the data.  Because the profile has already been verified for
-    * correctness this is safe.  png_colorspace_set_sRGB will check the 'intent'
-    * field too, so if the profile has been edited with an intent not defined
-    * by sRGB (but maybe defined by a later ICC specification) the read of
-    * the profile will fail at that point.
+   /* Handle new PNGv3 chunks and the precedence rules to determine whether
+    * png_struct::chromaticities must be processed.  Only required for RGB to
+    * gray.
+    *
+    * mDCV: this is the mastering colour space and it is independent of the
+    *       encoding so it needs to be used regardless of the encoded space.
+    *
+    * cICP: first in priority but not yet implemented - the chromaticities come
+    *       from the 'primaries'.
+    *
+    * iCCP: not supported by libpng (so ignored)
+    *
+    * sRGB: the defaults match sRGB
+    *
+    * cHRM: calculate the coefficients
     */
+#  ifdef PNG_READ_mDCV_SUPPORTED
+      if (png_has_chunk(png_ptr, mDCV))
+         return 1;
+#     define check_chromaticities 1
+#  endif /*mDCV*/
 
-   png_uint_32 length = 0;
-   png_uint_32 intent = 0x10000; /* invalid */
-#if PNG_sRGB_PROFILE_CHECKS > 1
-   uLong crc = 0; /* the value for 0 length data */
-#endif
-   unsigned int i;
-
-#ifdef PNG_SET_OPTION_SUPPORTED
-   /* First see if PNG_SKIP_sRGB_CHECK_PROFILE has been set to "on" */
-   if (((png_ptr->options >> PNG_SKIP_sRGB_CHECK_PROFILE) & 3) ==
-               PNG_OPTION_ON)
-      return 0;
-#endif
-
-   for (i=0; i < (sizeof png_sRGB_checks) / (sizeof png_sRGB_checks[0]); ++i)
-   {
-      if (png_get_uint_32(profile+84) == png_sRGB_checks[i].md5[0] &&
-         png_get_uint_32(profile+88) == png_sRGB_checks[i].md5[1] &&
-         png_get_uint_32(profile+92) == png_sRGB_checks[i].md5[2] &&
-         png_get_uint_32(profile+96) == png_sRGB_checks[i].md5[3])
-      {
-         /* This may be one of the old HP profiles without an MD5, in that
-          * case we can only use the length and Adler32 (note that these
-          * are not used by default if there is an MD5!)
-          */
-#        if PNG_sRGB_PROFILE_CHECKS == 0
-            if (png_sRGB_checks[i].have_md5 != 0)
-               return 1+png_sRGB_checks[i].is_broken;
-#        endif
-
-         /* Profile is unsigned or more checks have been configured in. */
-         if (length == 0)
-         {
-            length = png_get_uint_32(profile);
-            intent = png_get_uint_32(profile+64);
-         }
-
-         /* Length *and* intent must match */
-         if (length == (png_uint_32) png_sRGB_checks[i].length &&
-            intent == (png_uint_32) png_sRGB_checks[i].intent)
-         {
-            /* Now calculate the adler32 if not done already. */
-            if (adler == 0)
-            {
-               adler = adler32(0, NULL, 0);
-               adler = adler32(adler, profile, length);
-            }
-
-            if (adler == png_sRGB_checks[i].adler)
-            {
-               /* These basic checks suggest that the data has not been
-                * modified, but if the check level is more than 1 perform
-                * our own crc32 checksum on the data.
-                */
-#              if PNG_sRGB_PROFILE_CHECKS > 1
-                  if (crc == 0)
-                  {
-                     crc = crc32(0, NULL, 0);
-                     crc = crc32(crc, profile, length);
-                  }
-
-                  /* So this check must pass for the 'return' below to happen.
-                   */
-                  if (crc == png_sRGB_checks[i].crc)
-#              endif
-               {
-                  if (png_sRGB_checks[i].is_broken != 0)
-                  {
-                     /* These profiles are known to have bad data that may cause
-                      * problems if they are used, therefore attempt to
-                      * discourage their use, skip the 'have_md5' warning below,
-                      * which is made irrelevant by this error.
-                      */
-                     png_chunk_report(png_ptr, "known incorrect sRGB profile",
-                         PNG_CHUNK_ERROR);
-                  }
-
-                  /* Warn that this being done; this isn't even an error since
-                   * the profile is perfectly valid, but it would be nice if
-                   * people used the up-to-date ones.
-                   */
-                  else if (png_sRGB_checks[i].have_md5 == 0)
-                  {
-                     png_chunk_report(png_ptr,
-                         "out-of-date sRGB profile with no signature",
-                         PNG_CHUNK_WARNING);
-                  }
+#  ifdef PNG_READ_sRGB_SUPPORTED
+      if (png_has_chunk(png_ptr, sRGB))
+         return 0;
+#  endif /*sRGB*/
 
-                  return 1+png_sRGB_checks[i].is_broken;
-               }
-            }
-
-# if PNG_sRGB_PROFILE_CHECKS > 0
-         /* The signature matched, but the profile had been changed in some
-          * way.  This probably indicates a data error or uninformed hacking.
-          * Fall through to "no match".
-          */
-         png_chunk_report(png_ptr,
-             "Not recognizing known sRGB profile that has been edited",
-             PNG_CHUNK_WARNING);
-         break;
-# endif
-         }
-      }
-   }
+#  ifdef PNG_READ_cHRM_SUPPORTED
+      if (png_has_chunk(png_ptr, cHRM))
+         return 1;
+#     define check_chromaticities 1
+#  endif /*cHRM*/
 
-   return 0; /* no match */
+   return 0; /* sRGB defaults */
 }
+#endif /* READ_mDCV || READ_cHRM */
 
 void /* PRIVATE */
-png_icc_set_sRGB(png_const_structrp png_ptr,
-    png_colorspacerp colorspace, png_const_bytep profile, uLong adler)
+png_set_rgb_coefficients(png_structrp png_ptr)
 {
-   /* Is this profile one of the known ICC sRGB profiles?  If it is, just set
-    * the sRGB information.
+   /* Set the rgb_to_gray coefficients from the colorspace if available.  Note
+    * that '_set' means that png_rgb_to_gray was called **and** it successfully
+    * set up the coefficients.
     */
-   if (png_compare_ICC_profile_with_sRGB(png_ptr, profile, adler) != 0)
-      (void)png_colorspace_set_sRGB(png_ptr, colorspace,
-         (int)/*already checked*/png_get_uint_32(profile+64));
-}
-#endif /* PNG_sRGB_PROFILE_CHECKS >= 0 */
-#endif /* sRGB */
-
-int /* PRIVATE */
-png_colorspace_set_ICC(png_const_structrp png_ptr, png_colorspacerp colorspace,
-    png_const_charp name, png_uint_32 profile_length, png_const_bytep profile,
-    int color_type)
-{
-   if ((colorspace->flags & PNG_COLORSPACE_INVALID) != 0)
-      return 0;
-
-   if (icc_check_length(png_ptr, colorspace, name, profile_length) != 0 &&
-       png_icc_check_header(png_ptr, colorspace, name, profile_length, profile,
-           color_type) != 0 &&
-       png_icc_check_tag_table(png_ptr, colorspace, name, profile_length,
-           profile) != 0)
+   if (png_ptr->rgb_to_gray_coefficients_set == 0)
    {
-#     if defined(PNG_sRGB_SUPPORTED) && PNG_sRGB_PROFILE_CHECKS >= 0
-         /* If no sRGB support, don't try storing sRGB information */
-         png_icc_set_sRGB(png_ptr, colorspace, profile, 0);
-#     endif
-      return 1;
-   }
+#  if check_chromaticities
+      png_XYZ xyz;
 
-   /* Failure case */
-   return 0;
-}
-#endif /* iCCP */
-
-#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
-void /* PRIVATE */
-png_colorspace_set_rgb_coefficients(png_structrp png_ptr)
-{
-   /* Set the rgb_to_gray coefficients from the colorspace. */
-   if (png_ptr->rgb_to_gray_coefficients_set == 0 &&
-      (png_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS) != 0)
-   {
-      /* png_set_background has not been called, get the coefficients from the Y
-       * values of the colorspace colorants.
-       */
-      png_fixed_point r = png_ptr->colorspace.end_points_XYZ.red_Y;
-      png_fixed_point g = png_ptr->colorspace.end_points_XYZ.green_Y;
-      png_fixed_point b = png_ptr->colorspace.end_points_XYZ.blue_Y;
-      png_fixed_point total = r+g+b;
-
-      if (total > 0 &&
-         r >= 0 && png_muldiv(&r, r, 32768, total) && r >= 0 && r <= 32768 &&
-         g >= 0 && png_muldiv(&g, g, 32768, total) && g >= 0 && g <= 32768 &&
-         b >= 0 && png_muldiv(&b, b, 32768, total) && b >= 0 && b <= 32768 &&
-         r+g+b <= 32769)
+      if (have_chromaticities(png_ptr) &&
+          png_XYZ_from_xy(&xyz, &png_ptr->chromaticities) == 0)
       {
-         /* We allow 0 coefficients here.  r+g+b may be 32769 if two or
-          * all of the coefficients were rounded up.  Handle this by
-          * reducing the *largest* coefficient by 1; this matches the
-          * approach used for the default coefficients in pngrtran.c
+         /* png_set_rgb_to_gray has not set the coefficients, get them from the
+          * Y * values of the colorspace colorants.
           */
-         int add = 0;
+         png_fixed_point r = xyz.red_Y;
+         png_fixed_point g = xyz.green_Y;
+         png_fixed_point b = xyz.blue_Y;
+         png_fixed_point total = r+g+b;
+
+         if (total > 0 &&
+            r >= 0 && png_muldiv(&r, r, 32768, total) && r >= 0 && r <= 32768 &&
+            g >= 0 && png_muldiv(&g, g, 32768, total) && g >= 0 && g <= 32768 &&
+            b >= 0 && png_muldiv(&b, b, 32768, total) && b >= 0 && b <= 32768 &&
+            r+g+b <= 32769)
+         {
+            /* We allow 0 coefficients here.  r+g+b may be 32769 if two or
+             * all of the coefficients were rounded up.  Handle this by
+             * reducing the *largest* coefficient by 1; this matches the
+             * approach used for the default coefficients in pngrtran.c
+             */
+            int add = 0;
 
-         if (r+g+b > 32768)
-            add = -1;
-         else if (r+g+b < 32768)
-            add = 1;
+            if (r+g+b > 32768)
+               add = -1;
+            else if (r+g+b < 32768)
+               add = 1;
 
-         if (add != 0)
-         {
-            if (g >= r && g >= b)
-               g += add;
-            else if (r >= g && r >= b)
-               r += add;
-            else
-               b += add;
-         }
+            if (add != 0)
+            {
+               if (g >= r && g >= b)
+                  g += add;
+               else if (r >= g && r >= b)
+                  r += add;
+               else
+                  b += add;
+            }
 
-         /* Check for an internal error. */
-         if (r+g+b != 32768)
-            png_error(png_ptr,
-                "internal error handling cHRM coefficients");
+            /* Check for an internal error. */
+            if (r+g+b != 32768)
+               png_error(png_ptr,
+                   "internal error handling cHRM coefficients");
 
-         else
-         {
-            png_ptr->rgb_to_gray_red_coeff   = (png_uint_16)r;
-            png_ptr->rgb_to_gray_green_coeff = (png_uint_16)g;
+            else
+            {
+               png_ptr->rgb_to_gray_red_coeff   = (png_uint_16)r;
+               png_ptr->rgb_to_gray_green_coeff = (png_uint_16)g;
+            }
          }
       }
-
-      /* This is a png_error at present even though it could be ignored -
-       * it should never happen, but it is important that if it does, the
-       * bug is fixed.
-       */
       else
-         png_error(png_ptr, "internal error handling cHRM->XYZ");
+#  endif /* check_chromaticities */
+      {
+         /* Use the historical REC 709 (etc) values: */
+         png_ptr->rgb_to_gray_red_coeff   = 6968;
+         png_ptr->rgb_to_gray_green_coeff = 23434;
+         /* png_ptr->rgb_to_gray_blue_coeff  = 2366; */
+      }
    }
 }
 #endif /* READ_RGB_TO_GRAY */
 
-#endif /* COLORSPACE */
-
 void /* PRIVATE */
 png_check_IHDR(png_const_structrp png_ptr,
     png_uint_32 width, png_uint_32 height, int bit_depth,
@@ -3320,7 +2764,27 @@ png_fixed(png_const_structrp png_ptr, double fp, png_const_charp text)
 }
 #endif
 
-#if defined(PNG_GAMMA_SUPPORTED) || defined(PNG_COLORSPACE_SUPPORTED) ||\
+#if defined(PNG_FLOATING_POINT_SUPPORTED) && \
+   !defined(PNG_FIXED_POINT_MACRO_SUPPORTED) && \
+   (defined(PNG_cLLI_SUPPORTED) || defined(PNG_mDCV_SUPPORTED))
+png_uint_32
+png_fixed_ITU(png_const_structrp png_ptr, double fp, png_const_charp text)
+{
+   double r = floor(10000 * fp + .5);
+
+   if (r > 2147483647. || r < 0)
+      png_fixed_error(png_ptr, text);
+
+#  ifndef PNG_ERROR_TEXT_SUPPORTED
+   PNG_UNUSED(text)
+#  endif
+
+   return (png_uint_32)r;
+}
+#endif
+
+
+#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_COLORSPACE_SUPPORTED) ||\
     defined(PNG_INCH_CONVERSIONS_SUPPORTED) || defined(PNG_READ_pHYs_SUPPORTED)
 /* muldiv functions */
 /* This API takes signed arguments and rounds the result to the nearest
@@ -3328,7 +2792,7 @@ png_fixed(png_const_structrp png_ptr, double fp, png_const_charp text)
  * the nearest .00001).  Overflow and divide by zero are signalled in
  * the result, a boolean - true on success, false on overflow.
  */
-int
+int /* PRIVATE */
 png_muldiv(png_fixed_point_p res, png_fixed_point a, png_int_32 times,
     png_int_32 divisor)
 {
@@ -3442,27 +2906,7 @@ png_muldiv(png_fixed_point_p res, png_fixed_point a, png_int_32 times,
 
    return 0;
 }
-#endif /* READ_GAMMA || INCH_CONVERSIONS */
-
-#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_INCH_CONVERSIONS_SUPPORTED)
-/* The following is for when the caller doesn't much care about the
- * result.
- */
-png_fixed_point
-png_muldiv_warn(png_const_structrp png_ptr, png_fixed_point a, png_int_32 times,
-    png_int_32 divisor)
-{
-   png_fixed_point result;
-
-   if (png_muldiv(&result, a, times, divisor) != 0)
-      return result;
-
-   png_warning(png_ptr, "fixed point overflow ignored");
-   return 0;
-}
-#endif
 
-#ifdef PNG_GAMMA_SUPPORTED /* more fixed point functions for gamma */
 /* Calculate a reciprocal, return 0 on div-by-zero or overflow. */
 png_fixed_point
 png_reciprocal(png_fixed_point a)
@@ -3481,26 +2925,38 @@ png_reciprocal(png_fixed_point a)
 
    return 0; /* error/overflow */
 }
+#endif /* READ_GAMMA || COLORSPACE || INCH_CONVERSIONS || READ_pHYS */
 
+#ifdef PNG_READ_GAMMA_SUPPORTED
 /* This is the shared test on whether a gamma value is 'significant' - whether
  * it is worth doing gamma correction.
  */
 int /* PRIVATE */
 png_gamma_significant(png_fixed_point gamma_val)
 {
+   /* sRGB:       1/2.2 == 0.4545(45)
+    * AdobeRGB:   1/(2+51/256) ~= 0.45471 5dp
+    *
+    * So the correction from AdobeRGB to sRGB (output) is:
+    *
+    *    2.2/(2+51/256) == 1.00035524
+    *
+    * I.e. vanishly small (<4E-4) but still detectable in 16-bit linear (+/-
+    * 23).  Note that the Adobe choice seems to be something intended to give an
+    * exact number with 8 binary fractional digits - it is the closest to 2.2
+    * that is possible a base 2 .8p representation.
+    */
    return gamma_val < PNG_FP_1 - PNG_GAMMA_THRESHOLD_FIXED ||
        gamma_val > PNG_FP_1 + PNG_GAMMA_THRESHOLD_FIXED;
 }
-#endif
 
-#ifdef PNG_READ_GAMMA_SUPPORTED
-#ifdef PNG_16BIT_SUPPORTED
+#ifndef PNG_FLOATING_ARITHMETIC_SUPPORTED
 /* A local convenience routine. */
 static png_fixed_point
 png_product2(png_fixed_point a, png_fixed_point b)
 {
-   /* The required result is 1/a * 1/b; the following preserves accuracy. */
-#ifdef PNG_FLOATING_ARITHMETIC_SUPPORTED
+   /* The required result is a * b; the following preserves accuracy. */
+#ifdef PNG_FLOATING_ARITHMETIC_SUPPORTED /* Should now be unused */
    double r = a * 1E-5;
    r *= b;
    r = floor(r+.5);
@@ -3516,9 +2972,8 @@ png_product2(png_fixed_point a, png_fixed_point b)
 
    return 0; /* overflow */
 }
-#endif /* 16BIT */
+#endif /* FLOATING_ARITHMETIC */
 
-/* The inverse of the above. */
 png_fixed_point
 png_reciprocal2(png_fixed_point a, png_fixed_point b)
 {
@@ -4171,10 +3626,27 @@ png_destroy_gamma_table(png_structrp png_ptr)
  * tables, we don't make a full table if we are reducing to 8-bit in
  * the future.  Note also how the gamma_16 tables are segmented so that
  * we don't need to allocate > 64K chunks for a full 16-bit table.
+ *
+ * TODO: move this to pngrtran.c and make it static.  Better yet create
+ * pngcolor.c and put all the PNG_COLORSPACE stuff in there.
  */
+#if defined(PNG_READ_BACKGROUND_SUPPORTED) || \
+   defined(PNG_READ_ALPHA_MODE_SUPPORTED) || \
+   defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
+#  define GAMMA_TRANSFORMS 1 /* #ifdef CSE */
+#else
+#  define GAMMA_TRANSFORMS 0
+#endif
+
 void /* PRIVATE */
 png_build_gamma_table(png_structrp png_ptr, int bit_depth)
 {
+   png_fixed_point file_gamma, screen_gamma;
+   png_fixed_point correction;
+#  if GAMMA_TRANSFORMS
+      png_fixed_point file_to_linear, linear_to_screen;
+#  endif
+
    png_debug(1, "in png_build_gamma_table");
 
    /* Remove any existing table; this copes with multiple calls to
@@ -4189,27 +3661,44 @@ png_build_gamma_table(png_structrp png_ptr, int bit_depth)
       png_destroy_gamma_table(png_ptr);
    }
 
+   /* The following fields are set, finally, in png_init_read_transformations.
+    * If file_gamma is 0 (unset) nothing can be done otherwise if screen_gamma
+    * is 0 (unset) there is no gamma correction but to/from linear is possible.
+    */
+   file_gamma = png_ptr->file_gamma;
+   screen_gamma = png_ptr->screen_gamma;
+#  if GAMMA_TRANSFORMS
+      file_to_linear = png_reciprocal(file_gamma);
+#  endif
+
+   if (screen_gamma > 0)
+   {
+#     if GAMMA_TRANSFORMS
+         linear_to_screen = png_reciprocal(screen_gamma);
+#     endif
+      correction = png_reciprocal2(screen_gamma, file_gamma);
+   }
+   else /* screen gamma unknown */
+   {
+#     if GAMMA_TRANSFORMS
+         linear_to_screen = file_gamma;
+#     endif
+      correction = PNG_FP_1;
+   }
+
    if (bit_depth <= 8)
    {
-      png_build_8bit_table(png_ptr, &png_ptr->gamma_table,
-          png_ptr->screen_gamma > 0 ?
-          png_reciprocal2(png_ptr->colorspace.gamma,
-          png_ptr->screen_gamma) : PNG_FP_1);
+      png_build_8bit_table(png_ptr, &png_ptr->gamma_table, correction);
 
-#if defined(PNG_READ_BACKGROUND_SUPPORTED) || \
-   defined(PNG_READ_ALPHA_MODE_SUPPORTED) || \
-   defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
+#if GAMMA_TRANSFORMS
       if ((png_ptr->transformations & (PNG_COMPOSE | PNG_RGB_TO_GRAY)) != 0)
       {
-         png_build_8bit_table(png_ptr, &png_ptr->gamma_to_1,
-             png_reciprocal(png_ptr->colorspace.gamma));
+         png_build_8bit_table(png_ptr, &png_ptr->gamma_to_1, file_to_linear);
 
          png_build_8bit_table(png_ptr, &png_ptr->gamma_from_1,
-             png_ptr->screen_gamma > 0 ?
-             png_reciprocal(png_ptr->screen_gamma) :
-             png_ptr->colorspace.gamma/* Probably doing rgb_to_gray */);
+            linear_to_screen);
       }
-#endif /* READ_BACKGROUND || READ_ALPHA_MODE || RGB_TO_GRAY */
+#endif /* GAMMA_TRANSFORMS */
    }
 #ifdef PNG_16BIT_SUPPORTED
    else
@@ -4275,32 +3764,26 @@ png_build_gamma_table(png_structrp png_ptr, int bit_depth)
        * reduced to 8 bits.
        */
       if ((png_ptr->transformations & (PNG_16_TO_8 | PNG_SCALE_16_TO_8)) != 0)
-          png_build_16to8_table(png_ptr, &png_ptr->gamma_16_table, shift,
-          png_ptr->screen_gamma > 0 ? png_product2(png_ptr->colorspace.gamma,
-          png_ptr->screen_gamma) : PNG_FP_1);
-
+         png_build_16to8_table(png_ptr, &png_ptr->gamma_16_table, shift,
+            png_reciprocal(correction));
       else
-          png_build_16bit_table(png_ptr, &png_ptr->gamma_16_table, shift,
-          png_ptr->screen_gamma > 0 ? png_reciprocal2(png_ptr->colorspace.gamma,
-          png_ptr->screen_gamma) : PNG_FP_1);
+         png_build_16bit_table(png_ptr, &png_ptr->gamma_16_table, shift,
+            correction);
 
-#if defined(PNG_READ_BACKGROUND_SUPPORTED) || \
-   defined(PNG_READ_ALPHA_MODE_SUPPORTED) || \
-   defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
+#  if GAMMA_TRANSFORMS
       if ((png_ptr->transformations & (PNG_COMPOSE | PNG_RGB_TO_GRAY)) != 0)
       {
          png_build_16bit_table(png_ptr, &png_ptr->gamma_16_to_1, shift,
-             png_reciprocal(png_ptr->colorspace.gamma));
+            file_to_linear);
 
          /* Notice that the '16 from 1' table should be full precision, however
           * the lookup on this table still uses gamma_shift, so it can't be.
           * TODO: fix this.
           */
          png_build_16bit_table(png_ptr, &png_ptr->gamma_16_from_1, shift,
-             png_ptr->screen_gamma > 0 ? png_reciprocal(png_ptr->screen_gamma) :
-             png_ptr->colorspace.gamma/* Probably doing rgb_to_gray */);
+            linear_to_screen);
       }
-#endif /* READ_BACKGROUND || READ_ALPHA_MODE || RGB_TO_GRAY */
+#endif /* GAMMA_TRANSFORMS */
    }
 #endif /* 16BIT */
 }
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/png.h b/src/java.desktop/share/native/libsplashscreen/libpng/png.h
index 9f61a773c1dd..ede12c34fe60 100644
--- a/src/java.desktop/share/native/libsplashscreen/libpng/png.h
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/png.h
@@ -29,9 +29,9 @@
  * However, the following notice accompanied the original version of this
  * file and, per its terms, should not be removed:
  *
- * libpng version 1.6.43
+ * libpng version 1.6.47
  *
- * Copyright (c) 2018-2024 Cosmin Truta
+ * Copyright (c) 2018-2025 Cosmin Truta
  * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
  * Copyright (c) 1996-1997 Andreas Dilger
  * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
@@ -43,7 +43,7 @@
  *   libpng versions 0.89, June 1996, through 0.96, May 1997: Andreas Dilger
  *   libpng versions 0.97, January 1998, through 1.6.35, July 2018:
  *     Glenn Randers-Pehrson
- *   libpng versions 1.6.36, December 2018, through 1.6.43, February 2024:
+ *   libpng versions 1.6.36, December 2018, through 1.6.47, February 2025:
  *     Cosmin Truta
  *   See also "Contributing Authors", below.
  */
@@ -55,8 +55,8 @@
  * PNG Reference Library License version 2
  * ---------------------------------------
  *
- *  * Copyright (c) 1995-2024 The PNG Reference Library Authors.
- *  * Copyright (c) 2018-2024 Cosmin Truta.
+ *  * Copyright (c) 1995-2025 The PNG Reference Library Authors.
+ *  * Copyright (c) 2018-2025 Cosmin Truta.
  *  * Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson.
  *  * Copyright (c) 1996-1997 Andreas Dilger.
  *  * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
@@ -267,7 +267,7 @@
  *    ...
  *    1.5.30                  15    10530  15.so.15.30[.0]
  *    ...
- *    1.6.43                  16    10643  16.so.16.43[.0]
+ *    1.6.47                  16    10647  16.so.16.47[.0]
  *
  *    Henceforth the source version will match the shared-library major and
  *    minor numbers; the shared-library major version number will be used for
@@ -303,7 +303,7 @@
  */
 
 /* Version information for png.h - this should match the version in png.c */
-#define PNG_LIBPNG_VER_STRING "1.6.43"
+#define PNG_LIBPNG_VER_STRING "1.6.47"
 #define PNG_HEADER_VERSION_STRING " libpng version " PNG_LIBPNG_VER_STRING "\n"
 
 /* The versions of shared library builds should stay in sync, going forward */
@@ -314,18 +314,18 @@
 /* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
 #define PNG_LIBPNG_VER_MAJOR   1
 #define PNG_LIBPNG_VER_MINOR   6
-#define PNG_LIBPNG_VER_RELEASE 43
+#define PNG_LIBPNG_VER_RELEASE 47
 
 /* This should be zero for a public release, or non-zero for a
  * development version.
  */
-#define PNG_LIBPNG_VER_BUILD  0
+#define PNG_LIBPNG_VER_BUILD 0
 
 /* Release Status */
-#define PNG_LIBPNG_BUILD_ALPHA    1
-#define PNG_LIBPNG_BUILD_BETA     2
-#define PNG_LIBPNG_BUILD_RC       3
-#define PNG_LIBPNG_BUILD_STABLE   4
+#define PNG_LIBPNG_BUILD_ALPHA               1
+#define PNG_LIBPNG_BUILD_BETA                2
+#define PNG_LIBPNG_BUILD_RC                  3
+#define PNG_LIBPNG_BUILD_STABLE              4
 #define PNG_LIBPNG_BUILD_RELEASE_STATUS_MASK 7
 
 /* Release-Specific Flags */
@@ -345,7 +345,7 @@
  * From version 1.0.1 it is:
  * XXYYZZ, where XX=major, YY=minor, ZZ=release
  */
-#define PNG_LIBPNG_VER 10643 /* 1.6.43 */
+#define PNG_LIBPNG_VER 10647 /* 1.6.47 */
 
 /* Library configuration: these options cannot be changed after
  * the library has been built.
@@ -455,7 +455,7 @@ extern "C" {
 /* This triggers a compiler error in png.c, if png.c and png.h
  * do not agree upon the version number.
  */
-typedef char* png_libpng_version_1_6_43;
+typedef char* png_libpng_version_1_6_47;
 
 /* Basic control structions.  Read libpng-manual.txt or libpng.3 for more info.
  *
@@ -773,6 +773,21 @@ typedef png_unknown_chunk * * png_unknown_chunkpp;
 #define PNG_INFO_sCAL 0x4000U  /* ESR, 1.0.6 */
 #define PNG_INFO_IDAT 0x8000U  /* ESR, 1.0.6 */
 #define PNG_INFO_eXIf 0x10000U /* GR-P, 1.6.31 */
+#define PNG_INFO_cICP 0x20000U /* PNGv3: 1.6.45 */
+#define PNG_INFO_cLLI 0x40000U /* PNGv3: 1.6.45 */
+#define PNG_INFO_mDCV 0x80000U /* PNGv3: 1.6.45 */
+/* APNG: these chunks are stored as unknown, these flags are never set
+ * however they are provided as a convenience for implementors of APNG and
+ * avoids any merge conflicts.
+ *
+ * Private chunks: these chunk names violate the chunk name recommendations
+ * because the chunk definitions have no signature and because the private
+ * chunks with these names have been reserved.  Private definitions should
+ * avoid them.
+ */
+#define PNG_INFO_acTL 0x100000U /* PNGv3: 1.6.45: unknown */
+#define PNG_INFO_fcTL 0x200000U /* PNGv3: 1.6.45: unknown */
+#define PNG_INFO_fdAT 0x400000U /* PNGv3: 1.6.45: unknown */
 
 /* This is used for the transformation routines, as some of them
  * change these values for the row.  It also should enable using
@@ -852,7 +867,7 @@ typedef PNG_CALLBACK(int, *png_user_chunk_ptr, (png_structp,
  * your compiler.  This may be very difficult - try using a different compiler
  * to build the library!
  */
-PNG_FUNCTION(void, (PNGCAPI *png_longjmp_ptr), PNGARG((jmp_buf, int)), typedef);
+PNG_FUNCTION(void, (PNGCAPI *png_longjmp_ptr), (jmp_buf, int), typedef);
 #endif
 
 /* Transform masks for the high-level interface */
@@ -2002,6 +2017,46 @@ PNG_FIXED_EXPORT(233, void, png_set_cHRM_XYZ_fixed, (png_const_structrp png_ptr,
     png_fixed_point int_blue_Z))
 #endif
 
+#ifdef PNG_cICP_SUPPORTED
+PNG_EXPORT(250, png_uint_32, png_get_cICP, (png_const_structrp png_ptr,
+    png_const_inforp info_ptr, png_bytep colour_primaries,
+    png_bytep transfer_function, png_bytep matrix_coefficients,
+    png_bytep video_full_range_flag));
+#endif
+
+#ifdef PNG_cICP_SUPPORTED
+PNG_EXPORT(251, void, png_set_cICP, (png_const_structrp png_ptr,
+    png_inforp info_ptr, png_byte colour_primaries,
+    png_byte transfer_function, png_byte matrix_coefficients,
+    png_byte video_full_range_flag));
+#endif
+
+#ifdef PNG_cLLI_SUPPORTED
+PNG_FP_EXPORT(252, png_uint_32, png_get_cLLI, (png_const_structrp png_ptr,
+         png_const_inforp info_ptr, double *maximum_content_light_level,
+         double *maximum_frame_average_light_level))
+PNG_FIXED_EXPORT(253, png_uint_32, png_get_cLLI_fixed,
+    (png_const_structrp png_ptr, png_const_inforp info_ptr,
+    /* The values below are in cd/m2 (nits) and are scaled by 10,000; not
+     * 100,000 as in the case of png_fixed_point.
+     */
+    png_uint_32p maximum_content_light_level_scaled_by_10000,
+    png_uint_32p maximum_frame_average_light_level_scaled_by_10000))
+#endif
+
+#ifdef PNG_cLLI_SUPPORTED
+PNG_FP_EXPORT(254, void, png_set_cLLI, (png_const_structrp png_ptr,
+         png_inforp info_ptr, double maximum_content_light_level,
+         double maximum_frame_average_light_level))
+PNG_FIXED_EXPORT(255, void, png_set_cLLI_fixed, (png_const_structrp png_ptr,
+    png_inforp info_ptr,
+    /* The values below are in cd/m2 (nits) and are scaled by 10,000; not
+     * 100,000 as in the case of png_fixed_point.
+     */
+    png_uint_32 maximum_content_light_level_scaled_by_10000,
+    png_uint_32 maximum_frame_average_light_level_scaled_by_10000))
+#endif
+
 #ifdef PNG_eXIf_SUPPORTED
 PNG_EXPORT(246, png_uint_32, png_get_eXIf, (png_const_structrp png_ptr,
     png_inforp info_ptr, png_bytep *exif));
@@ -2046,6 +2101,60 @@ PNG_EXPORT(144, void, png_set_IHDR, (png_const_structrp png_ptr,
     int color_type, int interlace_method, int compression_method,
     int filter_method));
 
+#ifdef PNG_mDCV_SUPPORTED
+PNG_FP_EXPORT(256, png_uint_32, png_get_mDCV, (png_const_structrp png_ptr,
+    png_const_inforp info_ptr,
+    /* The chromaticities of the mastering display.  As cHRM, but independent of
+     * the encoding endpoints in cHRM, or cICP, or iCCP.  These values will
+     * always be in the range 0 to 1.3107.
+     */
+    double *white_x, double *white_y, double *red_x, double *red_y,
+    double *green_x, double *green_y, double *blue_x, double *blue_y,
+    /* Mastering display luminance in cd/m2 (nits). */
+    double *mastering_display_maximum_luminance,
+    double *mastering_display_minimum_luminance))
+
+PNG_FIXED_EXPORT(257, png_uint_32, png_get_mDCV_fixed,
+    (png_const_structrp png_ptr, png_const_inforp info_ptr,
+    png_fixed_point *int_white_x, png_fixed_point *int_white_y,
+    png_fixed_point *int_red_x, png_fixed_point *int_red_y,
+    png_fixed_point *int_green_x, png_fixed_point *int_green_y,
+    png_fixed_point *int_blue_x, png_fixed_point *int_blue_y,
+    /* Mastering display luminance in cd/m2 (nits) multiplied (scaled) by
+     * 10,000.
+     */
+    png_uint_32p mastering_display_maximum_luminance_scaled_by_10000,
+    png_uint_32p mastering_display_minimum_luminance_scaled_by_10000))
+#endif
+
+#ifdef PNG_mDCV_SUPPORTED
+PNG_FP_EXPORT(258, void, png_set_mDCV, (png_const_structrp png_ptr,
+    png_inforp info_ptr,
+    /* The chromaticities of the mastering display.  As cHRM, but independent of
+     * the encoding endpoints in cHRM, or cICP, or iCCP.
+     */
+    double white_x, double white_y, double red_x, double red_y, double green_x,
+    double green_y, double blue_x, double blue_y,
+    /* Mastering display luminance in cd/m2 (nits). */
+    double mastering_display_maximum_luminance,
+    double mastering_display_minimum_luminance))
+
+PNG_FIXED_EXPORT(259, void, png_set_mDCV_fixed, (png_const_structrp png_ptr,
+    png_inforp info_ptr,
+    /* The admissible range of these values is not the full range of a PNG
+     * fixed point value.  Negative values cannot be encoded and the maximum
+     * value is about 1.3 */
+    png_fixed_point int_white_x, png_fixed_point int_white_y,
+    png_fixed_point int_red_x, png_fixed_point int_red_y,
+    png_fixed_point int_green_x, png_fixed_point int_green_y,
+    png_fixed_point int_blue_x, png_fixed_point int_blue_y,
+    /* These are PNG unsigned 4 byte values: 31-bit unsigned values.  The MSB
+     * must be zero.
+     */
+    png_uint_32 mastering_display_maximum_luminance_scaled_by_10000,
+    png_uint_32 mastering_display_minimum_luminance_scaled_by_10000))
+#endif
+
 #ifdef PNG_oFFs_SUPPORTED
 PNG_EXPORT(145, png_uint_32, png_get_oFFs, (png_const_structrp png_ptr,
    png_const_inforp info_ptr, png_int_32 *offset_x, png_int_32 *offset_y,
@@ -3266,7 +3375,7 @@ PNG_EXPORT(244, int, png_set_option, (png_structrp png_ptr, int option,
  * one to use is one more than this.)
  */
 #ifdef PNG_EXPORT_LAST_ORDINAL
-  PNG_EXPORT_LAST_ORDINAL(249);
+  PNG_EXPORT_LAST_ORDINAL(259);
 #endif
 
 #ifdef __cplusplus
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/pngconf.h b/src/java.desktop/share/native/libsplashscreen/libpng/pngconf.h
index b3b441b1122c..70bca6fa1c90 100644
--- a/src/java.desktop/share/native/libsplashscreen/libpng/pngconf.h
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/pngconf.h
@@ -29,9 +29,9 @@
  * However, the following notice accompanied the original version of this
  * file and, per its terms, should not be removed:
  *
- * libpng version 1.6.43
+ * libpng version 1.6.47
  *
- * Copyright (c) 2018-2024 Cosmin Truta
+ * Copyright (c) 2018-2025 Cosmin Truta
  * Copyright (c) 1998-2002,2004,2006-2016,2018 Glenn Randers-Pehrson
  * Copyright (c) 1996-1997 Andreas Dilger
  * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
@@ -116,7 +116,7 @@
 
 /* The PNGARG macro was used in versions of libpng prior to 1.6.0 to protect
  * against legacy (pre ISOC90) compilers that did not understand function
- * prototypes.  It is not required for modern C compilers.
+ * prototypes.  [Deprecated.]
  */
 #ifndef PNGARG
 #  define PNGARG(arglist) arglist
@@ -326,7 +326,7 @@
 
 #ifndef PNG_EXPORTA
 #  define PNG_EXPORTA(ordinal, type, name, args, attributes) \
-      PNG_FUNCTION(PNG_EXPORT_TYPE(type), (PNGAPI name), PNGARG(args), \
+      PNG_FUNCTION(PNG_EXPORT_TYPE(type), (PNGAPI name), args, \
       PNG_LINKAGE_API attributes)
 #endif
 
@@ -344,7 +344,7 @@
 #endif
 
 #ifndef PNG_CALLBACK
-#  define PNG_CALLBACK(type, name, args) type (PNGCBAPI name) PNGARG(args)
+#  define PNG_CALLBACK(type, name, args) type (PNGCBAPI name) args
 #endif
 
 /* Support for compiler specific function attributes.  These are used
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/pngerror.c b/src/java.desktop/share/native/libsplashscreen/libpng/pngerror.c
index ea8dd1721972..ea0103331d34 100644
--- a/src/java.desktop/share/native/libsplashscreen/libpng/pngerror.c
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/pngerror.c
@@ -48,13 +48,14 @@
 
 #if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
 
-static PNG_FUNCTION(void, png_default_error,PNGARG((png_const_structrp png_ptr,
-    png_const_charp error_message)),PNG_NORETURN);
+static PNG_FUNCTION(void /* PRIVATE */,
+png_default_error,(png_const_structrp png_ptr, png_const_charp error_message),
+    PNG_NORETURN);
 
 #ifdef PNG_WARNINGS_SUPPORTED
 static void /* PRIVATE */
-png_default_warning PNGARG((png_const_structrp png_ptr,
-    png_const_charp warning_message));
+png_default_warning(png_const_structrp png_ptr,
+    png_const_charp warning_message);
 #endif /* WARNINGS */
 
 /* This function is called whenever there is a fatal error.  This function
@@ -963,23 +964,37 @@ png_safe_warning(png_structp png_nonconst_ptr, png_const_charp warning_message)
 int /* PRIVATE */
 png_safe_execute(png_imagep image, int (*function)(png_voidp), png_voidp arg)
 {
-   png_voidp saved_error_buf = image->opaque->error_buf;
+   const png_voidp saved_error_buf = image->opaque->error_buf;
    jmp_buf safe_jmpbuf;
-   int result;
 
    /* Safely execute function(arg), with png_error returning back here. */
    if (setjmp(safe_jmpbuf) == 0)
    {
+      int result;
+
       image->opaque->error_buf = safe_jmpbuf;
       result = function(arg);
       image->opaque->error_buf = saved_error_buf;
-      return result;
+
+      if (result)
+         return 1; /* success */
    }
 
-   /* On png_error, return via longjmp, pop the jmpbuf, and free the image. */
+   /* The function failed either because of a caught png_error and a regular
+    * return of false above or because of an uncaught png_error from the
+    * function itself.  Ensure that the error_buf is always set back to the
+    * value saved above:
+    */
    image->opaque->error_buf = saved_error_buf;
-   png_image_free(image);
-   return 0;
+
+   /* On the final false return, when about to return control to the caller, the
+    * image is freed (png_image_free does this check but it is duplicated here
+    * for clarity:
+    */
+   if (saved_error_buf == NULL)
+      png_image_free(image);
+
+   return 0; /* failure */
 }
 #endif /* SIMPLIFIED READ || SIMPLIFIED_WRITE */
 #endif /* READ || WRITE */
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/pngget.c b/src/java.desktop/share/native/libsplashscreen/libpng/pngget.c
index 41e0a5abc3a8..d67adbae247a 100644
--- a/src/java.desktop/share/native/libsplashscreen/libpng/pngget.c
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/pngget.c
@@ -409,7 +409,13 @@ png_fixed_inches_from_microns(png_const_structrp png_ptr, png_int_32 microns)
     * Notice that this can overflow - a warning is output and 0 is
     * returned.
     */
-   return png_muldiv_warn(png_ptr, microns, 500, 127);
+   png_fixed_point result;
+
+   if (png_muldiv(&result, microns, 500, 127) != 0)
+      return result;
+
+   png_warning(png_ptr, "fixed point overflow ignored");
+   return 0;
 }
 
 png_fixed_point PNGAPI
@@ -419,7 +425,7 @@ png_get_x_offset_inches_fixed(png_const_structrp png_ptr,
    return png_fixed_inches_from_microns(png_ptr,
        png_get_x_offset_microns(png_ptr, info_ptr));
 }
-#endif
+#endif /* FIXED_POINT */
 
 #ifdef PNG_FIXED_POINT_SUPPORTED
 png_fixed_point PNGAPI
@@ -547,44 +553,31 @@ png_get_bKGD(png_const_structrp png_ptr, png_inforp info_ptr,
 #  ifdef PNG_FLOATING_POINT_SUPPORTED
 png_uint_32 PNGAPI
 png_get_cHRM(png_const_structrp png_ptr, png_const_inforp info_ptr,
-    double *white_x, double *white_y, double *red_x, double *red_y,
-    double *green_x, double *green_y, double *blue_x, double *blue_y)
+    double *whitex, double *whitey, double *redx, double *redy,
+    double *greenx, double *greeny, double *bluex, double *bluey)
 {
    png_debug1(1, "in %s retrieval function", "cHRM");
 
-   /* Quiet API change: this code used to only return the end points if a cHRM
-    * chunk was present, but the end points can also come from iCCP or sRGB
-    * chunks, so in 1.6.0 the png_get_ APIs return the end points regardless and
-    * the png_set_ APIs merely check that set end points are mutually
-    * consistent.
-    */
+   /* PNGv3: this just returns the values store from the cHRM, if any. */
    if (png_ptr != NULL && info_ptr != NULL &&
-      (info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS) != 0)
+       (info_ptr->valid & PNG_INFO_cHRM) != 0)
    {
-      if (white_x != NULL)
-         *white_x = png_float(png_ptr,
-             info_ptr->colorspace.end_points_xy.whitex, "cHRM white X");
-      if (white_y != NULL)
-         *white_y = png_float(png_ptr,
-             info_ptr->colorspace.end_points_xy.whitey, "cHRM white Y");
-      if (red_x != NULL)
-         *red_x = png_float(png_ptr, info_ptr->colorspace.end_points_xy.redx,
-             "cHRM red X");
-      if (red_y != NULL)
-         *red_y = png_float(png_ptr, info_ptr->colorspace.end_points_xy.redy,
-             "cHRM red Y");
-      if (green_x != NULL)
-         *green_x = png_float(png_ptr,
-             info_ptr->colorspace.end_points_xy.greenx, "cHRM green X");
-      if (green_y != NULL)
-         *green_y = png_float(png_ptr,
-             info_ptr->colorspace.end_points_xy.greeny, "cHRM green Y");
-      if (blue_x != NULL)
-         *blue_x = png_float(png_ptr, info_ptr->colorspace.end_points_xy.bluex,
-             "cHRM blue X");
-      if (blue_y != NULL)
-         *blue_y = png_float(png_ptr, info_ptr->colorspace.end_points_xy.bluey,
-             "cHRM blue Y");
+      if (whitex != NULL)
+         *whitex = png_float(png_ptr, info_ptr->cHRM.whitex, "cHRM wx");
+      if (whitey != NULL)
+         *whitey = png_float(png_ptr, info_ptr->cHRM.whitey, "cHRM wy");
+      if (redx   != NULL)
+         *redx   = png_float(png_ptr, info_ptr->cHRM.redx,   "cHRM rx");
+      if (redy   != NULL)
+         *redy   = png_float(png_ptr, info_ptr->cHRM.redy,   "cHRM ry");
+      if (greenx != NULL)
+         *greenx = png_float(png_ptr, info_ptr->cHRM.greenx, "cHRM gx");
+      if (greeny != NULL)
+         *greeny = png_float(png_ptr, info_ptr->cHRM.greeny, "cHRM gy");
+      if (bluex  != NULL)
+         *bluex  = png_float(png_ptr, info_ptr->cHRM.bluex,  "cHRM bx");
+      if (bluey  != NULL)
+         *bluey  = png_float(png_ptr, info_ptr->cHRM.bluey,  "cHRM by");
       return PNG_INFO_cHRM;
    }
 
@@ -597,38 +590,31 @@ png_get_cHRM_XYZ(png_const_structrp png_ptr, png_const_inforp info_ptr,
     double *green_Y, double *green_Z, double *blue_X, double *blue_Y,
     double *blue_Z)
 {
+   png_XYZ XYZ;
    png_debug1(1, "in %s retrieval function", "cHRM_XYZ(float)");
 
    if (png_ptr != NULL && info_ptr != NULL &&
-       (info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS) != 0)
+       (info_ptr->valid & PNG_INFO_cHRM) != 0 &&
+       png_XYZ_from_xy(&XYZ, &info_ptr->cHRM) == 0)
    {
       if (red_X != NULL)
-         *red_X = png_float(png_ptr, info_ptr->colorspace.end_points_XYZ.red_X,
-             "cHRM red X");
+         *red_X = png_float(png_ptr, XYZ.red_X, "cHRM red X");
       if (red_Y != NULL)
-         *red_Y = png_float(png_ptr, info_ptr->colorspace.end_points_XYZ.red_Y,
-             "cHRM red Y");
+         *red_Y = png_float(png_ptr, XYZ.red_Y, "cHRM red Y");
       if (red_Z != NULL)
-         *red_Z = png_float(png_ptr, info_ptr->colorspace.end_points_XYZ.red_Z,
-             "cHRM red Z");
+         *red_Z = png_float(png_ptr, XYZ.red_Z, "cHRM red Z");
       if (green_X != NULL)
-         *green_X = png_float(png_ptr,
-             info_ptr->colorspace.end_points_XYZ.green_X, "cHRM green X");
+         *green_X = png_float(png_ptr, XYZ.green_X, "cHRM green X");
       if (green_Y != NULL)
-         *green_Y = png_float(png_ptr,
-             info_ptr->colorspace.end_points_XYZ.green_Y, "cHRM green Y");
+         *green_Y = png_float(png_ptr, XYZ.green_Y, "cHRM green Y");
       if (green_Z != NULL)
-         *green_Z = png_float(png_ptr,
-             info_ptr->colorspace.end_points_XYZ.green_Z, "cHRM green Z");
+         *green_Z = png_float(png_ptr, XYZ.green_Z, "cHRM green Z");
       if (blue_X != NULL)
-         *blue_X = png_float(png_ptr,
-             info_ptr->colorspace.end_points_XYZ.blue_X, "cHRM blue X");
+         *blue_X = png_float(png_ptr, XYZ.blue_X, "cHRM blue X");
       if (blue_Y != NULL)
-         *blue_Y = png_float(png_ptr,
-             info_ptr->colorspace.end_points_XYZ.blue_Y, "cHRM blue Y");
+         *blue_Y = png_float(png_ptr, XYZ.blue_Y, "cHRM blue Y");
       if (blue_Z != NULL)
-         *blue_Z = png_float(png_ptr,
-             info_ptr->colorspace.end_points_XYZ.blue_Z, "cHRM blue Z");
+         *blue_Z = png_float(png_ptr, XYZ.blue_Z, "cHRM blue Z");
       return PNG_INFO_cHRM;
    }
 
@@ -645,29 +631,22 @@ png_get_cHRM_XYZ_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr,
     png_fixed_point *int_blue_X, png_fixed_point *int_blue_Y,
     png_fixed_point *int_blue_Z)
 {
+   png_XYZ XYZ;
    png_debug1(1, "in %s retrieval function", "cHRM_XYZ");
 
    if (png_ptr != NULL && info_ptr != NULL &&
-      (info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS) != 0)
+       (info_ptr->valid & PNG_INFO_cHRM) != 0U &&
+       png_XYZ_from_xy(&XYZ, &info_ptr->cHRM) == 0)
    {
-      if (int_red_X != NULL)
-         *int_red_X = info_ptr->colorspace.end_points_XYZ.red_X;
-      if (int_red_Y != NULL)
-         *int_red_Y = info_ptr->colorspace.end_points_XYZ.red_Y;
-      if (int_red_Z != NULL)
-         *int_red_Z = info_ptr->colorspace.end_points_XYZ.red_Z;
-      if (int_green_X != NULL)
-         *int_green_X = info_ptr->colorspace.end_points_XYZ.green_X;
-      if (int_green_Y != NULL)
-         *int_green_Y = info_ptr->colorspace.end_points_XYZ.green_Y;
-      if (int_green_Z != NULL)
-         *int_green_Z = info_ptr->colorspace.end_points_XYZ.green_Z;
-      if (int_blue_X != NULL)
-         *int_blue_X = info_ptr->colorspace.end_points_XYZ.blue_X;
-      if (int_blue_Y != NULL)
-         *int_blue_Y = info_ptr->colorspace.end_points_XYZ.blue_Y;
-      if (int_blue_Z != NULL)
-         *int_blue_Z = info_ptr->colorspace.end_points_XYZ.blue_Z;
+      if (int_red_X != NULL) *int_red_X = XYZ.red_X;
+      if (int_red_Y != NULL) *int_red_Y = XYZ.red_Y;
+      if (int_red_Z != NULL) *int_red_Z = XYZ.red_Z;
+      if (int_green_X != NULL) *int_green_X = XYZ.green_X;
+      if (int_green_Y != NULL) *int_green_Y = XYZ.green_Y;
+      if (int_green_Z != NULL) *int_green_Z = XYZ.green_Z;
+      if (int_blue_X != NULL) *int_blue_X = XYZ.blue_X;
+      if (int_blue_Y != NULL) *int_blue_Y = XYZ.blue_Y;
+      if (int_blue_Z != NULL) *int_blue_Z = XYZ.blue_Z;
       return PNG_INFO_cHRM;
    }
 
@@ -676,31 +655,24 @@ png_get_cHRM_XYZ_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr,
 
 png_uint_32 PNGAPI
 png_get_cHRM_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr,
-    png_fixed_point *white_x, png_fixed_point *white_y, png_fixed_point *red_x,
-    png_fixed_point *red_y, png_fixed_point *green_x, png_fixed_point *green_y,
-    png_fixed_point *blue_x, png_fixed_point *blue_y)
+    png_fixed_point *whitex, png_fixed_point *whitey, png_fixed_point *redx,
+    png_fixed_point *redy, png_fixed_point *greenx, png_fixed_point *greeny,
+    png_fixed_point *bluex, png_fixed_point *bluey)
 {
    png_debug1(1, "in %s retrieval function", "cHRM");
 
+   /* PNGv3: this just returns the values store from the cHRM, if any. */
    if (png_ptr != NULL && info_ptr != NULL &&
-      (info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_ENDPOINTS) != 0)
+       (info_ptr->valid & PNG_INFO_cHRM) != 0)
    {
-      if (white_x != NULL)
-         *white_x = info_ptr->colorspace.end_points_xy.whitex;
-      if (white_y != NULL)
-         *white_y = info_ptr->colorspace.end_points_xy.whitey;
-      if (red_x != NULL)
-         *red_x = info_ptr->colorspace.end_points_xy.redx;
-      if (red_y != NULL)
-         *red_y = info_ptr->colorspace.end_points_xy.redy;
-      if (green_x != NULL)
-         *green_x = info_ptr->colorspace.end_points_xy.greenx;
-      if (green_y != NULL)
-         *green_y = info_ptr->colorspace.end_points_xy.greeny;
-      if (blue_x != NULL)
-         *blue_x = info_ptr->colorspace.end_points_xy.bluex;
-      if (blue_y != NULL)
-         *blue_y = info_ptr->colorspace.end_points_xy.bluey;
+      if (whitex != NULL) *whitex = info_ptr->cHRM.whitex;
+      if (whitey != NULL) *whitey = info_ptr->cHRM.whitey;
+      if (redx   != NULL) *redx   = info_ptr->cHRM.redx;
+      if (redy   != NULL) *redy   = info_ptr->cHRM.redy;
+      if (greenx != NULL) *greenx = info_ptr->cHRM.greenx;
+      if (greeny != NULL) *greeny = info_ptr->cHRM.greeny;
+      if (bluex  != NULL) *bluex  = info_ptr->cHRM.bluex;
+      if (bluey  != NULL) *bluey  = info_ptr->cHRM.bluey;
       return PNG_INFO_cHRM;
    }
 
@@ -717,11 +689,11 @@ png_get_gAMA_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr,
 {
    png_debug1(1, "in %s retrieval function", "gAMA");
 
+   /* PNGv3 compatibility: only report gAMA if it is really present. */
    if (png_ptr != NULL && info_ptr != NULL &&
-       (info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_GAMMA) != 0 &&
-       file_gamma != NULL)
+       (info_ptr->valid & PNG_INFO_gAMA) != 0)
    {
-      *file_gamma = info_ptr->colorspace.gamma;
+      if (file_gamma != NULL) *file_gamma = info_ptr->gamma;
       return PNG_INFO_gAMA;
    }
 
@@ -736,12 +708,13 @@ png_get_gAMA(png_const_structrp png_ptr, png_const_inforp info_ptr,
 {
    png_debug1(1, "in %s retrieval function", "gAMA(float)");
 
+   /* PNGv3 compatibility: only report gAMA if it is really present. */
    if (png_ptr != NULL && info_ptr != NULL &&
-      (info_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_GAMMA) != 0 &&
-      file_gamma != NULL)
+       (info_ptr->valid & PNG_INFO_gAMA) != 0)
    {
-      *file_gamma = png_float(png_ptr, info_ptr->colorspace.gamma,
-          "png_get_gAMA");
+      if (file_gamma != NULL)
+         *file_gamma = png_float(png_ptr, info_ptr->gamma, "gAMA");
+
       return PNG_INFO_gAMA;
    }
 
@@ -758,9 +731,10 @@ png_get_sRGB(png_const_structrp png_ptr, png_const_inforp info_ptr,
    png_debug1(1, "in %s retrieval function", "sRGB");
 
    if (png_ptr != NULL && info_ptr != NULL &&
-      (info_ptr->valid & PNG_INFO_sRGB) != 0 && file_srgb_intent != NULL)
+      (info_ptr->valid & PNG_INFO_sRGB) != 0)
    {
-      *file_srgb_intent = info_ptr->colorspace.rendering_intent;
+      if (file_srgb_intent != NULL)
+         *file_srgb_intent = info_ptr->rendering_intent;
       return PNG_INFO_sRGB;
    }
 
@@ -813,6 +787,136 @@ png_get_sPLT(png_const_structrp png_ptr, png_inforp info_ptr,
 }
 #endif
 
+#ifdef PNG_cICP_SUPPORTED
+png_uint_32 PNGAPI
+png_get_cICP(png_const_structrp png_ptr,
+             png_const_inforp info_ptr, png_bytep colour_primaries,
+             png_bytep transfer_function, png_bytep matrix_coefficients,
+             png_bytep video_full_range_flag)
+{
+    png_debug1(1, "in %s retrieval function", "cICP");
+
+    if (png_ptr != NULL && info_ptr != NULL &&
+        (info_ptr->valid & PNG_INFO_cICP) != 0 &&
+        colour_primaries != NULL && transfer_function != NULL &&
+        matrix_coefficients != NULL && video_full_range_flag != NULL)
+    {
+        *colour_primaries = info_ptr->cicp_colour_primaries;
+        *transfer_function = info_ptr->cicp_transfer_function;
+        *matrix_coefficients = info_ptr->cicp_matrix_coefficients;
+        *video_full_range_flag = info_ptr->cicp_video_full_range_flag;
+        return (PNG_INFO_cICP);
+    }
+
+    return 0;
+}
+#endif
+
+#ifdef PNG_cLLI_SUPPORTED
+#  ifdef PNG_FIXED_POINT_SUPPORTED
+png_uint_32 PNGAPI
+png_get_cLLI_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr,
+    png_uint_32p maxCLL,
+    png_uint_32p maxFALL)
+{
+   png_debug1(1, "in %s retrieval function", "cLLI");
+
+   if (png_ptr != NULL && info_ptr != NULL &&
+       (info_ptr->valid & PNG_INFO_cLLI) != 0)
+   {
+      if (maxCLL != NULL) *maxCLL = info_ptr->maxCLL;
+      if (maxFALL != NULL) *maxFALL = info_ptr->maxFALL;
+      return PNG_INFO_cLLI;
+   }
+
+   return 0;
+}
+#  endif
+
+#  ifdef PNG_FLOATING_POINT_SUPPORTED
+png_uint_32 PNGAPI
+png_get_cLLI(png_const_structrp png_ptr, png_const_inforp info_ptr,
+      double *maxCLL, double *maxFALL)
+{
+   png_debug1(1, "in %s retrieval function", "cLLI(float)");
+
+   if (png_ptr != NULL && info_ptr != NULL &&
+       (info_ptr->valid & PNG_INFO_cLLI) != 0)
+   {
+      if (maxCLL != NULL) *maxCLL = info_ptr->maxCLL * .0001;
+      if (maxFALL != NULL) *maxFALL = info_ptr->maxFALL * .0001;
+      return PNG_INFO_cLLI;
+   }
+
+   return 0;
+}
+#  endif
+#endif /* cLLI */
+
+#ifdef PNG_mDCV_SUPPORTED
+#  ifdef PNG_FIXED_POINT_SUPPORTED
+png_uint_32 PNGAPI
+png_get_mDCV_fixed(png_const_structrp png_ptr, png_const_inforp info_ptr,
+    png_fixed_point *white_x, png_fixed_point *white_y,
+    png_fixed_point *red_x, png_fixed_point *red_y,
+    png_fixed_point *green_x, png_fixed_point *green_y,
+    png_fixed_point *blue_x, png_fixed_point *blue_y,
+    png_uint_32p mastering_maxDL, png_uint_32p mastering_minDL)
+{
+   png_debug1(1, "in %s retrieval function", "mDCV");
+
+   if (png_ptr != NULL && info_ptr != NULL &&
+       (info_ptr->valid & PNG_INFO_mDCV) != 0)
+   {
+      if (white_x != NULL) *white_x = info_ptr->mastering_white_x * 2;
+      if (white_y != NULL) *white_y = info_ptr->mastering_white_y * 2;
+      if (red_x != NULL) *red_x = info_ptr->mastering_red_x * 2;
+      if (red_y != NULL) *red_y = info_ptr->mastering_red_y * 2;
+      if (green_x != NULL) *green_x = info_ptr->mastering_green_x * 2;
+      if (green_y != NULL) *green_y = info_ptr->mastering_green_y * 2;
+      if (blue_x != NULL) *blue_x = info_ptr->mastering_blue_x * 2;
+      if (blue_y != NULL) *blue_y = info_ptr->mastering_blue_y * 2;
+      if (mastering_maxDL != NULL) *mastering_maxDL = info_ptr->mastering_maxDL;
+      if (mastering_minDL != NULL) *mastering_minDL = info_ptr->mastering_minDL;
+      return PNG_INFO_mDCV;
+   }
+
+   return 0;
+}
+#  endif
+
+#  ifdef PNG_FLOATING_POINT_SUPPORTED
+png_uint_32 PNGAPI
+png_get_mDCV(png_const_structrp png_ptr, png_const_inforp info_ptr,
+    double *white_x, double *white_y, double *red_x, double *red_y,
+    double *green_x, double *green_y, double *blue_x, double *blue_y,
+    double *mastering_maxDL, double *mastering_minDL)
+{
+   png_debug1(1, "in %s retrieval function", "mDCV(float)");
+
+   if (png_ptr != NULL && info_ptr != NULL &&
+       (info_ptr->valid & PNG_INFO_mDCV) != 0)
+   {
+      if (white_x != NULL) *white_x = info_ptr->mastering_white_x * .00002;
+      if (white_y != NULL) *white_y = info_ptr->mastering_white_y * .00002;
+      if (red_x != NULL) *red_x = info_ptr->mastering_red_x * .00002;
+      if (red_y != NULL) *red_y = info_ptr->mastering_red_y * .00002;
+      if (green_x != NULL) *green_x = info_ptr->mastering_green_x * .00002;
+      if (green_y != NULL) *green_y = info_ptr->mastering_green_y * .00002;
+      if (blue_x != NULL) *blue_x = info_ptr->mastering_blue_x * .00002;
+      if (blue_y != NULL) *blue_y = info_ptr->mastering_blue_y * .00002;
+      if (mastering_maxDL != NULL)
+         *mastering_maxDL = info_ptr->mastering_maxDL * .0001;
+      if (mastering_minDL != NULL)
+         *mastering_minDL = info_ptr->mastering_minDL * .0001;
+      return PNG_INFO_mDCV;
+   }
+
+   return 0;
+}
+#  endif /* FLOATING_POINT */
+#endif /* mDCV */
+
 #ifdef PNG_eXIf_SUPPORTED
 png_uint_32 PNGAPI
 png_get_eXIf(png_const_structrp png_ptr, png_inforp info_ptr,
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/pnginfo.h b/src/java.desktop/share/native/libsplashscreen/libpng/pnginfo.h
index d241eaebffbb..bc6ed3d09c97 100644
--- a/src/java.desktop/share/native/libsplashscreen/libpng/pnginfo.h
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/pnginfo.h
@@ -115,18 +115,12 @@ struct png_info_def
     * and initialize the appropriate fields below.
     */
 
-#if defined(PNG_COLORSPACE_SUPPORTED) || defined(PNG_GAMMA_SUPPORTED)
-   /* png_colorspace only contains 'flags' if neither GAMMA or COLORSPACE are
-    * defined.  When COLORSPACE is switched on all the colorspace-defining
-    * chunks should be enabled, when GAMMA is switched on all the gamma-defining
-    * chunks should be enabled.  If this is not done it becomes possible to read
-    * inconsistent PNG files and assign a probably incorrect interpretation to
-    * the information.  (In other words, by carefully choosing which chunks to
-    * recognize the system configuration can select an interpretation for PNG
-    * files containing ambiguous data and this will result in inconsistent
-    * behavior between different libpng builds!)
-    */
-   png_colorspace colorspace;
+#ifdef PNG_cICP_SUPPORTED
+   /* cICP chunk data */
+   png_byte cicp_colour_primaries;
+   png_byte cicp_transfer_function;
+   png_byte cicp_matrix_coefficients;
+   png_byte cicp_video_full_range_flag;
 #endif
 
 #ifdef PNG_iCCP_SUPPORTED
@@ -136,6 +130,24 @@ struct png_info_def
    png_uint_32 iccp_proflen;  /* ICC profile data length */
 #endif
 
+#ifdef PNG_cLLI_SUPPORTED
+   png_uint_32 maxCLL;  /* cd/m2 (nits) * 10,000 */
+   png_uint_32 maxFALL;
+#endif
+
+#ifdef PNG_mDCV_SUPPORTED
+   png_uint_16 mastering_red_x;  /* CIE (xy) x * 50,000 */
+   png_uint_16 mastering_red_y;
+   png_uint_16 mastering_green_x;
+   png_uint_16 mastering_green_y;
+   png_uint_16 mastering_blue_x;
+   png_uint_16 mastering_blue_y;
+   png_uint_16 mastering_white_x;
+   png_uint_16 mastering_white_y;
+   png_uint_32 mastering_maxDL; /* cd/m2 (nits) * 10,000 */
+   png_uint_32 mastering_minDL;
+#endif
+
 #ifdef PNG_TEXT_SUPPORTED
    /* The tEXt, and zTXt chunks contain human-readable textual data in
     * uncompressed, compressed, and optionally compressed forms, respectively.
@@ -214,11 +226,8 @@ defined(PNG_READ_BACKGROUND_SUPPORTED)
 #endif
 
 #ifdef PNG_eXIf_SUPPORTED
-   int num_exif;  /* Added at libpng-1.6.31 */
+   png_uint_32 num_exif;  /* Added at libpng-1.6.31 */
    png_bytep exif;
-# ifdef PNG_READ_eXIf_SUPPORTED
-   png_bytep eXIf_buf;  /* Added at libpng-1.6.32 */
-# endif
 #endif
 
 #ifdef PNG_hIST_SUPPORTED
@@ -291,5 +300,16 @@ defined(PNG_READ_BACKGROUND_SUPPORTED)
    png_bytepp row_pointers;        /* the image bits */
 #endif
 
+#ifdef PNG_cHRM_SUPPORTED
+   png_xy cHRM;
+#endif
+
+#ifdef PNG_gAMA_SUPPORTED
+   png_fixed_point gamma;
+#endif
+
+#ifdef PNG_sRGB_SUPPORTED
+   int rendering_intent;
+#endif
 };
 #endif /* PNGINFO_H */
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/pnglibconf.h b/src/java.desktop/share/native/libsplashscreen/libpng/pnglibconf.h
index e238ccdb9a4d..906f855db0e5 100644
--- a/src/java.desktop/share/native/libsplashscreen/libpng/pnglibconf.h
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/pnglibconf.h
@@ -31,9 +31,9 @@
  * However, the following notice accompanied the original version of this
  * file and, per its terms, should not be removed:
  */
-/* libpng version 1.6.43 */
+/* libpng version 1.6.47 */
 
-/* Copyright (c) 2018-2023 Cosmin Truta */
+/* Copyright (c) 2018-2025 Cosmin Truta */
 /* Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson */
 
 /* This code is released under the libpng license. */
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/pngmem.c b/src/java.desktop/share/native/libsplashscreen/libpng/pngmem.c
index d5ad0735f37b..ba9eb4df402b 100644
--- a/src/java.desktop/share/native/libsplashscreen/libpng/pngmem.c
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/pngmem.c
@@ -101,30 +101,29 @@ png_malloc_base,(png_const_structrp png_ptr, png_alloc_size_t size),
     * to implement a user memory handler.  This checks to be sure it isn't
     * called with big numbers.
     */
-#ifndef PNG_USER_MEM_SUPPORTED
-   PNG_UNUSED(png_ptr)
-#endif
+#  ifdef PNG_MAX_MALLOC_64K
+      /* This is support for legacy systems which had segmented addressing
+       * limiting the maximum allocation size to 65536.  It takes precedence
+       * over PNG_SIZE_MAX which is set to 65535 on true 16-bit systems.
+       *
+       * TODO: libpng-1.8: finally remove both cases.
+       */
+      if (size > 65536U) return NULL;
+#  endif
 
-   /* Some compilers complain that this is always true.  However, it
-    * can be false when integer overflow happens.
+   /* This is checked too because the system malloc call below takes a (size_t).
     */
-   if (size > 0 && size <= PNG_SIZE_MAX
-#     ifdef PNG_MAX_MALLOC_64K
-         && size <= 65536U
-#     endif
-      )
-   {
-#ifdef PNG_USER_MEM_SUPPORTED
+   if (size > PNG_SIZE_MAX) return NULL;
+
+#  ifdef PNG_USER_MEM_SUPPORTED
       if (png_ptr != NULL && png_ptr->malloc_fn != NULL)
          return png_ptr->malloc_fn(png_constcast(png_structrp,png_ptr), size);
+#  else
+      PNG_UNUSED(png_ptr)
+#  endif
 
-      else
-#endif
-         return malloc((size_t)size); /* checked for truncation above */
-   }
-
-   else
-      return NULL;
+   /* Use the system malloc */
+   return malloc((size_t)/*SAFE*/size); /* checked for truncation above */
 }
 
 #if defined(PNG_TEXT_SUPPORTED) || defined(PNG_sPLT_SUPPORTED) ||\
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/pngpread.c b/src/java.desktop/share/native/libsplashscreen/libpng/pngpread.c
index 816631cae189..86d0c7aaa644 100644
--- a/src/java.desktop/share/native/libsplashscreen/libpng/pngpread.c
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/pngpread.c
@@ -60,6 +60,21 @@ if (png_ptr->push_length + 4 > png_ptr->buffer_size) \
 if (png_ptr->buffer_size < N) \
    { png_push_save_buffer(png_ptr); return; }
 
+#ifdef PNG_READ_INTERLACING_SUPPORTED
+/* Arrays to facilitate interlacing - use pass (0 - 6) as index. */
+
+/* Start of interlace block */
+static const png_byte png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};
+/* Offset to next interlace block */
+static const png_byte png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
+/* Start of interlace block in the y direction */
+static const png_byte png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1};
+/* Offset to next interlace block in the y direction */
+static const png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
+
+/* TODO: Move these arrays to a common utility module to avoid duplication. */
+#endif
+
 void PNGAPI
 png_process_data(png_structrp png_ptr, png_inforp info_ptr,
     png_bytep buffer, size_t buffer_size)
@@ -207,17 +222,8 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
     */
    if ((png_ptr->mode & PNG_HAVE_CHUNK_HEADER) == 0)
    {
-      png_byte chunk_length[4];
-      png_byte chunk_tag[4];
-
       PNG_PUSH_SAVE_BUFFER_IF_LT(8)
-      png_push_fill_buffer(png_ptr, chunk_length, 4);
-      png_ptr->push_length = png_get_uint_31(png_ptr, chunk_length);
-      png_reset_crc(png_ptr);
-      png_crc_read(png_ptr, chunk_tag, 4);
-      png_ptr->chunk_name = PNG_CHUNK_FROM_STRING(chunk_tag);
-      png_check_chunk_name(png_ptr, png_ptr->chunk_name);
-      png_check_chunk_length(png_ptr, png_ptr->push_length);
+      png_ptr->push_length = png_read_chunk_header(png_ptr);
       png_ptr->mode |= PNG_HAVE_CHUNK_HEADER;
    }
 
@@ -258,13 +264,13 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
          png_error(png_ptr, "Invalid IHDR length");
 
       PNG_PUSH_SAVE_BUFFER_IF_FULL
-      png_handle_IHDR(png_ptr, info_ptr, png_ptr->push_length);
+      png_handle_chunk(png_ptr, info_ptr, png_ptr->push_length);
    }
 
    else if (chunk_name == png_IEND)
    {
       PNG_PUSH_SAVE_BUFFER_IF_FULL
-      png_handle_IEND(png_ptr, info_ptr, png_ptr->push_length);
+      png_handle_chunk(png_ptr, info_ptr, png_ptr->push_length);
 
       png_ptr->process_mode = PNG_READ_DONE_MODE;
       png_push_have_end(png_ptr, info_ptr);
@@ -281,12 +287,6 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
    }
 #endif
 
-   else if (chunk_name == png_PLTE)
-   {
-      PNG_PUSH_SAVE_BUFFER_IF_FULL
-      png_handle_PLTE(png_ptr, info_ptr, png_ptr->push_length);
-   }
-
    else if (chunk_name == png_IDAT)
    {
       png_ptr->idat_size = png_ptr->push_length;
@@ -299,155 +299,10 @@ png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
       return;
    }
 
-#ifdef PNG_READ_gAMA_SUPPORTED
-   else if (png_ptr->chunk_name == png_gAMA)
-   {
-      PNG_PUSH_SAVE_BUFFER_IF_FULL
-      png_handle_gAMA(png_ptr, info_ptr, png_ptr->push_length);
-   }
-
-#endif
-#ifdef PNG_READ_sBIT_SUPPORTED
-   else if (png_ptr->chunk_name == png_sBIT)
-   {
-      PNG_PUSH_SAVE_BUFFER_IF_FULL
-      png_handle_sBIT(png_ptr, info_ptr, png_ptr->push_length);
-   }
-
-#endif
-#ifdef PNG_READ_cHRM_SUPPORTED
-   else if (png_ptr->chunk_name == png_cHRM)
-   {
-      PNG_PUSH_SAVE_BUFFER_IF_FULL
-      png_handle_cHRM(png_ptr, info_ptr, png_ptr->push_length);
-   }
-
-#endif
-#ifdef PNG_READ_eXIf_SUPPORTED
-   else if (png_ptr->chunk_name == png_eXIf)
-   {
-      PNG_PUSH_SAVE_BUFFER_IF_FULL
-      png_handle_eXIf(png_ptr, info_ptr, png_ptr->push_length);
-   }
-
-#endif
-#ifdef PNG_READ_sRGB_SUPPORTED
-   else if (chunk_name == png_sRGB)
-   {
-      PNG_PUSH_SAVE_BUFFER_IF_FULL
-      png_handle_sRGB(png_ptr, info_ptr, png_ptr->push_length);
-   }
-
-#endif
-#ifdef PNG_READ_iCCP_SUPPORTED
-   else if (png_ptr->chunk_name == png_iCCP)
-   {
-      PNG_PUSH_SAVE_BUFFER_IF_FULL
-      png_handle_iCCP(png_ptr, info_ptr, png_ptr->push_length);
-   }
-
-#endif
-#ifdef PNG_READ_sPLT_SUPPORTED
-   else if (chunk_name == png_sPLT)
-   {
-      PNG_PUSH_SAVE_BUFFER_IF_FULL
-      png_handle_sPLT(png_ptr, info_ptr, png_ptr->push_length);
-   }
-
-#endif
-#ifdef PNG_READ_tRNS_SUPPORTED
-   else if (chunk_name == png_tRNS)
-   {
-      PNG_PUSH_SAVE_BUFFER_IF_FULL
-      png_handle_tRNS(png_ptr, info_ptr, png_ptr->push_length);
-   }
-
-#endif
-#ifdef PNG_READ_bKGD_SUPPORTED
-   else if (chunk_name == png_bKGD)
-   {
-      PNG_PUSH_SAVE_BUFFER_IF_FULL
-      png_handle_bKGD(png_ptr, info_ptr, png_ptr->push_length);
-   }
-
-#endif
-#ifdef PNG_READ_hIST_SUPPORTED
-   else if (chunk_name == png_hIST)
-   {
-      PNG_PUSH_SAVE_BUFFER_IF_FULL
-      png_handle_hIST(png_ptr, info_ptr, png_ptr->push_length);
-   }
-
-#endif
-#ifdef PNG_READ_pHYs_SUPPORTED
-   else if (chunk_name == png_pHYs)
-   {
-      PNG_PUSH_SAVE_BUFFER_IF_FULL
-      png_handle_pHYs(png_ptr, info_ptr, png_ptr->push_length);
-   }
-
-#endif
-#ifdef PNG_READ_oFFs_SUPPORTED
-   else if (chunk_name == png_oFFs)
-   {
-      PNG_PUSH_SAVE_BUFFER_IF_FULL
-      png_handle_oFFs(png_ptr, info_ptr, png_ptr->push_length);
-   }
-#endif
-
-#ifdef PNG_READ_pCAL_SUPPORTED
-   else if (chunk_name == png_pCAL)
-   {
-      PNG_PUSH_SAVE_BUFFER_IF_FULL
-      png_handle_pCAL(png_ptr, info_ptr, png_ptr->push_length);
-   }
-
-#endif
-#ifdef PNG_READ_sCAL_SUPPORTED
-   else if (chunk_name == png_sCAL)
-   {
-      PNG_PUSH_SAVE_BUFFER_IF_FULL
-      png_handle_sCAL(png_ptr, info_ptr, png_ptr->push_length);
-   }
-
-#endif
-#ifdef PNG_READ_tIME_SUPPORTED
-   else if (chunk_name == png_tIME)
-   {
-      PNG_PUSH_SAVE_BUFFER_IF_FULL
-      png_handle_tIME(png_ptr, info_ptr, png_ptr->push_length);
-   }
-
-#endif
-#ifdef PNG_READ_tEXt_SUPPORTED
-   else if (chunk_name == png_tEXt)
-   {
-      PNG_PUSH_SAVE_BUFFER_IF_FULL
-      png_handle_tEXt(png_ptr, info_ptr, png_ptr->push_length);
-   }
-
-#endif
-#ifdef PNG_READ_zTXt_SUPPORTED
-   else if (chunk_name == png_zTXt)
-   {
-      PNG_PUSH_SAVE_BUFFER_IF_FULL
-      png_handle_zTXt(png_ptr, info_ptr, png_ptr->push_length);
-   }
-
-#endif
-#ifdef PNG_READ_iTXt_SUPPORTED
-   else if (chunk_name == png_iTXt)
-   {
-      PNG_PUSH_SAVE_BUFFER_IF_FULL
-      png_handle_iTXt(png_ptr, info_ptr, png_ptr->push_length);
-   }
-#endif
-
    else
    {
       PNG_PUSH_SAVE_BUFFER_IF_FULL
-      png_handle_unknown(png_ptr, info_ptr, png_ptr->push_length,
-          PNG_HANDLE_CHUNK_AS_DEFAULT);
+      png_handle_chunk(png_ptr, info_ptr, png_ptr->push_length);
    }
 
    png_ptr->mode &= ~PNG_HAVE_CHUNK_HEADER;
@@ -1004,27 +859,6 @@ png_push_process_row(png_structrp png_ptr)
 void /* PRIVATE */
 png_read_push_finish_row(png_structrp png_ptr)
 {
-#ifdef PNG_READ_INTERLACING_SUPPORTED
-   /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
-
-   /* Start of interlace block */
-   static const png_byte png_pass_start[] = {0, 4, 0, 2, 0, 1, 0};
-
-   /* Offset to next interlace block */
-   static const png_byte png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1};
-
-   /* Start of interlace block in the y direction */
-   static const png_byte png_pass_ystart[] = {0, 0, 4, 0, 2, 0, 1};
-
-   /* Offset to next interlace block in the y direction */
-   static const png_byte png_pass_yinc[] = {8, 8, 8, 4, 4, 2, 2};
-
-   /* Height of interlace block.  This is not currently used - if you need
-    * it, uncomment it here and in png.h
-   static const png_byte png_pass_height[] = {8, 8, 4, 4, 2, 2, 1};
-   */
-#endif
-
    png_ptr->row_number++;
    if (png_ptr->row_number < png_ptr->num_rows)
       return;
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/pngpriv.h b/src/java.desktop/share/native/libsplashscreen/libpng/pngpriv.h
index 18424542b00b..25bac4b9e69b 100644
--- a/src/java.desktop/share/native/libsplashscreen/libpng/pngpriv.h
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/pngpriv.h
@@ -168,47 +168,6 @@
     * callbacks to do this.
     */
 #  define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_neon
-
-   /* By default the 'intrinsics' code in arm/filter_neon_intrinsics.c is used
-    * if possible - if __ARM_NEON__ is set and the compiler version is not known
-    * to be broken.  This is controlled by PNG_ARM_NEON_IMPLEMENTATION which can
-    * be:
-    *
-    *    1  The intrinsics code (the default with __ARM_NEON__)
-    *    2  The hand coded assembler (the default without __ARM_NEON__)
-    *
-    * It is possible to set PNG_ARM_NEON_IMPLEMENTATION in CPPFLAGS, however
-    * this is *NOT* supported and may cease to work even after a minor revision
-    * to libpng.  It *is* valid to do this for testing purposes, e.g. speed
-    * testing or a new compiler, but the results should be communicated to the
-    * libpng implementation list for incorporation in the next minor release.
-    */
-#  ifndef PNG_ARM_NEON_IMPLEMENTATION
-#     if defined(__ARM_NEON__) || defined(__ARM_NEON)
-#        if defined(__clang__)
-            /* At present it is unknown by the libpng developers which versions
-             * of clang support the intrinsics, however some or perhaps all
-             * versions do not work with the assembler so this may be
-             * irrelevant, so just use the default (do nothing here.)
-             */
-#        elif defined(__GNUC__)
-            /* GCC 4.5.4 NEON support is known to be broken.  4.6.3 is known to
-             * work, so if this *is* GCC, or G++, look for a version >4.5
-             */
-#           if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 6)
-#              define PNG_ARM_NEON_IMPLEMENTATION 2
-#           endif /* no GNUC support */
-#        endif /* __GNUC__ */
-#     else /* !defined __ARM_NEON__ */
-         /* The 'intrinsics' code simply won't compile without this -mfpu=neon:
-          */
-#        if !defined(__aarch64__) && !defined(_M_ARM64)
-            /* The assembler code currently does not work on ARM64 */
-#          define PNG_ARM_NEON_IMPLEMENTATION 2
-#        endif /* __aarch64__ */
-#     endif /* __ARM_NEON__ */
-#  endif /* !PNG_ARM_NEON_IMPLEMENTATION */
-
 #  ifndef PNG_ARM_NEON_IMPLEMENTATION
       /* Use the intrinsics code by default. */
 #     define PNG_ARM_NEON_IMPLEMENTATION 1
@@ -741,7 +700,7 @@
 #define PNG_FLAG_CRC_ANCILLARY_NOWARN     0x0200U
 #define PNG_FLAG_CRC_CRITICAL_USE         0x0400U
 #define PNG_FLAG_CRC_CRITICAL_IGNORE      0x0800U
-#define PNG_FLAG_ASSUME_sRGB              0x1000U /* Added to libpng-1.5.4 */
+/*      PNG_FLAG_ASSUME_sRGB unused       0x1000U  * Added to libpng-1.5.4 */
 #define PNG_FLAG_OPTIMIZE_ALPHA           0x2000U /* Added to libpng-1.5.4 */
 #define PNG_FLAG_DETECT_UNINITIALIZED     0x4000U /* Added to libpng-1.5.4 */
 /* #define PNG_FLAG_KEEP_UNKNOWN_CHUNKS      0x8000U */
@@ -852,6 +811,8 @@
 #ifdef PNG_FIXED_POINT_MACRO_SUPPORTED
 #define png_fixed(png_ptr, fp, s) ((fp) <= 21474 && (fp) >= -21474 ?\
     ((png_fixed_point)(100000 * (fp))) : (png_fixed_error(png_ptr, s),0))
+#define png_fixed_ITU(png_ptr, fp, s) ((fp) <= 214748 && (fp) >= 0 ?\
+    ((png_uint_32)(10000 * (fp))) : (png_fixed_error(png_ptr, s),0))
 #endif
 /* else the corresponding function is defined below, inside the scope of the
  * cplusplus test.
@@ -870,11 +831,31 @@
  *
  * PNG_32b correctly produces a value shifted by up to 24 bits, even on
  * architectures where (int) is only 16 bits.
+ *
+ * 1.6.47: PNG_32b was made into a preprocessor evaluable macro by replacing the
+ * static_cast with a promoting binary operation using a guaranteed 32-bit
+ * (minimum) unsigned value.
  */
-#define PNG_32b(b,s) ((png_uint_32)(b) << (s))
+#define PNG_32b(b,s) (((0xFFFFFFFFU)&(b)) << (s))
 #define PNG_U32(b1,b2,b3,b4) \
    (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
 
+/* Chunk name validation.  When using these macros all the arguments should be
+ * constants, otherwise code bloat may well occur.  The macros are provided
+ * primarily for use in #if checks.
+ *
+ * PNG_32to8 produces a byte value with the right shift; used to extract the
+ * byte value from a chunk name.
+ */
+#define PNG_32to8(cn,s) (((cn) >> (s)) & 0xffU)
+#define PNG_CN_VALID_UPPER(b) ((b) >= 65 && (b) <= 90) /* upper-case ASCII */
+#define PNG_CN_VALID_ASCII(b) PNG_CN_VALID_UPPER((b) & ~32U)
+#define PNG_CHUNK_NAME_VALID(cn) (\
+   PNG_CN_VALID_ASCII(PNG_32to8(cn,24)) && /* critical, !ancillary */\
+   PNG_CN_VALID_ASCII(PNG_32to8(cn,16)) && /* public, !privately defined */\
+   PNG_CN_VALID_UPPER(PNG_32to8(cn, 8)) && /* VALID, !reserved */\
+   PNG_CN_VALID_ASCII(PNG_32to8(cn, 0))   /* data-dependent, !copy ok */)
+
 /* Constants for known chunk types.
  *
  * MAINTAINERS: If you need to add a chunk, define the name here.
@@ -902,9 +883,14 @@
 #define png_IEND PNG_U32( 73,  69,  78,  68)
 #define png_IHDR PNG_U32( 73,  72,  68,  82)
 #define png_PLTE PNG_U32( 80,  76,  84,  69)
+#define png_acTL PNG_U32( 97,  99,  84,  76) /* PNGv3: APNG */
 #define png_bKGD PNG_U32( 98,  75,  71,  68)
 #define png_cHRM PNG_U32( 99,  72,  82,  77)
+#define png_cICP PNG_U32( 99,  73,  67,  80) /* PNGv3 */
+#define png_cLLI PNG_U32( 99,  76,  76,  73) /* PNGv3 */
 #define png_eXIf PNG_U32(101,  88,  73, 102) /* registered July 2017 */
+#define png_fcTL PNG_U32(102,  99,  84,  76) /* PNGv3: APNG */
+#define png_fdAT PNG_U32(102, 100,  65,  84) /* PNGv3: APNG */
 #define png_fRAc PNG_U32(102,  82,  65,  99) /* registered, not defined */
 #define png_gAMA PNG_U32(103,  65,  77,  65)
 #define png_gIFg PNG_U32(103,  73,  70, 103)
@@ -913,6 +899,7 @@
 #define png_hIST PNG_U32(104,  73,  83,  84)
 #define png_iCCP PNG_U32(105,  67,  67,  80)
 #define png_iTXt PNG_U32(105,  84,  88, 116)
+#define png_mDCV PNG_U32(109,  68,  67,  86) /* PNGv3 */
 #define png_oFFs PNG_U32(111,  70,  70, 115)
 #define png_pCAL PNG_U32(112,  67,  65,  76)
 #define png_pHYs PNG_U32(112,  72,  89, 115)
@@ -953,11 +940,74 @@
 #define PNG_CHUNK_RESERVED(c)     (1 & ((c) >> 13))
 #define PNG_CHUNK_SAFE_TO_COPY(c) (1 & ((c) >>  5))
 
+/* Known chunks.  All supported chunks must be listed here.  The macro PNG_CHUNK
+ * contains the four character ASCII name by which the chunk is identified.  The
+ * macro is implemented as required to build tables or switch statements which
+ * require entries for every known chunk.  The macro also contains an index
+ * value which should be in order (this is checked in png.c).
+ *
+ * Notice that "known" does not require "SUPPORTED"; tables should be built in
+ * such a way that chunks unsupported in a build require no more than the table
+ * entry (which should be small.)  In particular function pointers for
+ * unsupported chunks should be NULL.
+ *
+ * At present these index values are not exported (not part of the public API)
+ * so can be changed at will.  For convenience the names are in lexical sort
+ * order but with the critical chunks at the start in the order of occurence in
+ * a PNG.
+ *
+ * PNG_INFO_ values do not exist for every one of these chunk handles; for
+ * example PNG_INFO_{IDAT,IEND,tEXt,iTXt,zTXt} and possibly other chunks in the
+ * future.
+ */
+#define PNG_KNOWN_CHUNKS\
+   PNG_CHUNK(IHDR,  0)\
+   PNG_CHUNK(PLTE,  1)\
+   PNG_CHUNK(IDAT,  2)\
+   PNG_CHUNK(IEND,  3)\
+   PNG_CHUNK(acTL,  4)\
+   PNG_CHUNK(bKGD,  5)\
+   PNG_CHUNK(cHRM,  6)\
+   PNG_CHUNK(cICP,  7)\
+   PNG_CHUNK(cLLI,  8)\
+   PNG_CHUNK(eXIf,  9)\
+   PNG_CHUNK(fcTL, 10)\
+   PNG_CHUNK(fdAT, 11)\
+   PNG_CHUNK(gAMA, 12)\
+   PNG_CHUNK(hIST, 13)\
+   PNG_CHUNK(iCCP, 14)\
+   PNG_CHUNK(iTXt, 15)\
+   PNG_CHUNK(mDCV, 16)\
+   PNG_CHUNK(oFFs, 17)\
+   PNG_CHUNK(pCAL, 18)\
+   PNG_CHUNK(pHYs, 19)\
+   PNG_CHUNK(sBIT, 20)\
+   PNG_CHUNK(sCAL, 21)\
+   PNG_CHUNK(sPLT, 22)\
+   PNG_CHUNK(sRGB, 23)\
+   PNG_CHUNK(tEXt, 24)\
+   PNG_CHUNK(tIME, 25)\
+   PNG_CHUNK(tRNS, 26)\
+   PNG_CHUNK(zTXt, 27)
+
 /* Gamma values (new at libpng-1.5.4): */
 #define PNG_GAMMA_MAC_OLD 151724  /* Assume '1.8' is really 2.2/1.45! */
 #define PNG_GAMMA_MAC_INVERSE 65909
 #define PNG_GAMMA_sRGB_INVERSE 45455
 
+/* gamma sanity check.  libpng cannot implement gamma transforms outside a
+ * certain limit because of its use of 16-bit fixed point intermediate values.
+ * Gamma values that are too large or too small will zap the 16-bit values all
+ * to 0 or 65535 resulting in an obvious 'bad' image.
+ *
+ * In libpng 1.6.0 the limits were changed from 0.07..3 to 0.01..100 to
+ * accommodate the optimal 16-bit gamma of 36 and its reciprocal.
+ *
+ * These are png_fixed_point integral values:
+ */
+#define PNG_LIB_GAMMA_MIN 1000
+#define PNG_LIB_GAMMA_MAX 10000000
+
 /* Almost everything below is C specific; the #defines above can be used in
  * non-C code (so long as it is C-preprocessed) the rest of this stuff cannot.
  */
@@ -1021,7 +1071,6 @@ extern "C" {
  *
  * All of these functions must be declared with PNG_INTERNAL_FUNCTION.
  */
-
 /* Zlib support */
 #define PNG_UNEXPECTED_ZLIB_RETURN (-7)
 PNG_INTERNAL_FUNCTION(void, png_zstream_error,(png_structrp png_ptr, int ret),
@@ -1040,6 +1089,7 @@ PNG_INTERNAL_FUNCTION(void,png_free_buffer_list,(png_structrp png_ptr,
    !defined(PNG_FIXED_POINT_MACRO_SUPPORTED) && \
    (defined(PNG_gAMA_SUPPORTED) || defined(PNG_cHRM_SUPPORTED) || \
    defined(PNG_sCAL_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) || \
+   defined(PNG_mDCV_SUPPORTED) || \
    defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)) || \
    (defined(PNG_sCAL_SUPPORTED) && \
    defined(PNG_FLOATING_ARITHMETIC_SUPPORTED))
@@ -1047,12 +1097,38 @@ PNG_INTERNAL_FUNCTION(png_fixed_point,png_fixed,(png_const_structrp png_ptr,
    double fp, png_const_charp text),PNG_EMPTY);
 #endif
 
+#if defined(PNG_FLOATING_POINT_SUPPORTED) && \
+   !defined(PNG_FIXED_POINT_MACRO_SUPPORTED) && \
+   (defined(PNG_cLLI_SUPPORTED) || defined(PNG_mDCV_SUPPORTED))
+PNG_INTERNAL_FUNCTION(png_uint_32,png_fixed_ITU,(png_const_structrp png_ptr,
+   double fp, png_const_charp text),PNG_EMPTY);
+#endif
+
 /* Check the user version string for compatibility, returns false if the version
  * numbers aren't compatible.
  */
 PNG_INTERNAL_FUNCTION(int,png_user_version_check,(png_structrp png_ptr,
    png_const_charp user_png_ver),PNG_EMPTY);
 
+#ifdef PNG_READ_SUPPORTED /* should only be used on read */
+/* Security: read limits on the largest allocations while reading a PNG.  This
+ * avoids very large allocations caused by PNG files with damaged or altered
+ * chunk 'length' fields.
+ */
+#ifdef PNG_SET_USER_LIMITS_SUPPORTED /* run-time limit */
+#  define png_chunk_max(png_ptr) ((png_ptr)->user_chunk_malloc_max)
+
+#elif PNG_USER_CHUNK_MALLOC_MAX > 0 /* compile-time limit */
+#  define png_chunk_max(png_ptr) ((void)png_ptr, PNG_USER_CHUNK_MALLOC_MAX)
+
+#elif (defined PNG_MAX_MALLOC_64K)  /* legacy system limit */
+#  define png_chunk_max(png_ptr) ((void)png_ptr, 65536U)
+
+#else                               /* modern system limit SIZE_MAX (C99) */
+#  define png_chunk_max(png_ptr) ((void)png_ptr, PNG_SIZE_MAX)
+#endif
+#endif /* READ */
+
 /* Internal base allocator - no messages, NULL on failure to allocate.  This
  * does, however, call the application provided allocator and that could call
  * png_error (although that would be a bug in the application implementation.)
@@ -1152,9 +1228,6 @@ PNG_INTERNAL_FUNCTION(void,png_crc_read,(png_structrp png_ptr, png_bytep buf,
 PNG_INTERNAL_FUNCTION(int,png_crc_finish,(png_structrp png_ptr,
    png_uint_32 skip),PNG_EMPTY);
 
-/* Read the CRC from the file and compare it to the libpng calculated CRC */
-PNG_INTERNAL_FUNCTION(int,png_crc_error,(png_structrp png_ptr),PNG_EMPTY);
-
 /* Calculate the CRC over a section of data.  Note that we are only
  * passing a maximum of 64K on systems that have this as a memory limit,
  * since this is the maximum buffer size we can specify.
@@ -1200,6 +1273,26 @@ PNG_INTERNAL_FUNCTION(void,png_write_cHRM_fixed,(png_structrp png_ptr,
    /* The xy value must have been previously validated */
 #endif
 
+#ifdef PNG_WRITE_cICP_SUPPORTED
+PNG_INTERNAL_FUNCTION(void,png_write_cICP,(png_structrp png_ptr,
+    png_byte colour_primaries, png_byte transfer_function,
+    png_byte matrix_coefficients, png_byte video_full_range_flag), PNG_EMPTY);
+#endif
+
+#ifdef PNG_WRITE_cLLI_SUPPORTED
+PNG_INTERNAL_FUNCTION(void,png_write_cLLI_fixed,(png_structrp png_ptr,
+   png_uint_32 maxCLL, png_uint_32 maxFALL), PNG_EMPTY);
+#endif
+
+#ifdef PNG_WRITE_mDCV_SUPPORTED
+PNG_INTERNAL_FUNCTION(void,png_write_mDCV_fixed,(png_structrp png_ptr,
+   png_uint_16 red_x, png_uint_16 red_y,
+   png_uint_16 green_x, png_uint_16 green_y,
+   png_uint_16 blue_x, png_uint_16 blue_y,
+   png_uint_16 white_x, png_uint_16 white_y,
+   png_uint_32 maxDL, png_uint_32 minDL), PNG_EMPTY);
+#endif
+
 #ifdef PNG_WRITE_sRGB_SUPPORTED
 PNG_INTERNAL_FUNCTION(void,png_write_sRGB,(png_structrp png_ptr,
     int intent),PNG_EMPTY);
@@ -1212,10 +1305,10 @@ PNG_INTERNAL_FUNCTION(void,png_write_eXIf,(png_structrp png_ptr,
 
 #ifdef PNG_WRITE_iCCP_SUPPORTED
 PNG_INTERNAL_FUNCTION(void,png_write_iCCP,(png_structrp png_ptr,
-   png_const_charp name, png_const_bytep profile), PNG_EMPTY);
-   /* The profile must have been previously validated for correctness, the
-    * length comes from the first four bytes.  Only the base, deflate,
-    * compression is supported.
+   png_const_charp name, png_const_bytep profile, png_uint_32 proflen),
+   PNG_EMPTY);
+   /* Writes a previously 'set' profile.  The profile argument is **not**
+    * compressed.
     */
 #endif
 
@@ -1524,119 +1617,36 @@ PNG_INTERNAL_FUNCTION(void,png_do_bgr,(png_row_infop row_info,
 /* The following decodes the appropriate chunks, and does error correction,
  * then calls the appropriate callback for the chunk if it is valid.
  */
-
-/* Decode the IHDR chunk */
-PNG_INTERNAL_FUNCTION(void,png_handle_IHDR,(png_structrp png_ptr,
-    png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_handle_PLTE,(png_structrp png_ptr,
-    png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_handle_IEND,(png_structrp png_ptr,
-    png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
-
-#ifdef PNG_READ_bKGD_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_handle_bKGD,(png_structrp png_ptr,
-    png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
-#endif
-
-#ifdef PNG_READ_cHRM_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_handle_cHRM,(png_structrp png_ptr,
-    png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
-#endif
-
-#ifdef PNG_READ_eXIf_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_handle_eXIf,(png_structrp png_ptr,
-    png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
-#endif
-
-#ifdef PNG_READ_gAMA_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_handle_gAMA,(png_structrp png_ptr,
-    png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
-#endif
-
-#ifdef PNG_READ_hIST_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_handle_hIST,(png_structrp png_ptr,
-    png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
-#endif
-
-#ifdef PNG_READ_iCCP_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_handle_iCCP,(png_structrp png_ptr,
-    png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
-#endif /* READ_iCCP */
-
-#ifdef PNG_READ_iTXt_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_handle_iTXt,(png_structrp png_ptr,
-    png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
-#endif
-
-#ifdef PNG_READ_oFFs_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_handle_oFFs,(png_structrp png_ptr,
-    png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
-#endif
-
-#ifdef PNG_READ_pCAL_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_handle_pCAL,(png_structrp png_ptr,
-    png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
-#endif
-
-#ifdef PNG_READ_pHYs_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_handle_pHYs,(png_structrp png_ptr,
-    png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
-#endif
-
-#ifdef PNG_READ_sBIT_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_handle_sBIT,(png_structrp png_ptr,
-    png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
-#endif
-
-#ifdef PNG_READ_sCAL_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_handle_sCAL,(png_structrp png_ptr,
-    png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
-#endif
-
-#ifdef PNG_READ_sPLT_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_handle_sPLT,(png_structrp png_ptr,
-    png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
-#endif /* READ_sPLT */
-
-#ifdef PNG_READ_sRGB_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_handle_sRGB,(png_structrp png_ptr,
-    png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
-#endif
-
-#ifdef PNG_READ_tEXt_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_handle_tEXt,(png_structrp png_ptr,
-    png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
-#endif
-
-#ifdef PNG_READ_tIME_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_handle_tIME,(png_structrp png_ptr,
-    png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
-#endif
-
-#ifdef PNG_READ_tRNS_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_handle_tRNS,(png_structrp png_ptr,
-    png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
-#endif
-
-#ifdef PNG_READ_zTXt_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_handle_zTXt,(png_structrp png_ptr,
-    png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
-#endif
-
-PNG_INTERNAL_FUNCTION(void,png_check_chunk_name,(png_const_structrp png_ptr,
-    png_uint_32 chunk_name),PNG_EMPTY);
-
-PNG_INTERNAL_FUNCTION(void,png_check_chunk_length,(png_const_structrp png_ptr,
-    png_uint_32 chunk_length),PNG_EMPTY);
-
-PNG_INTERNAL_FUNCTION(void,png_handle_unknown,(png_structrp png_ptr,
-    png_inforp info_ptr, png_uint_32 length, int keep),PNG_EMPTY);
+typedef enum
+{
+   /* Result of a call to png_handle_chunk made to handle the current chunk
+    * png_struct::chunk_name on read.  Always informational, either the stream
+    * is read for the next chunk or the routine will call png_error.
+    *
+    * NOTE: order is important internally.  handled_saved and above are regarded
+    * as handling the chunk.
+    */
+   handled_error = 0,  /* bad crc or known and bad format or too long */
+   handled_discarded,  /* not saved in the unknown chunk list */
+   handled_saved,      /* saved in the unknown chunk list */
+   handled_ok          /* known, supported and handled without error */
+} png_handle_result_code;
+
+PNG_INTERNAL_FUNCTION(png_handle_result_code,png_handle_unknown,
+    (png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length, int keep),
+    PNG_EMPTY);
    /* This is the function that gets called for unknown chunks.  The 'keep'
     * argument is either non-zero for a known chunk that has been set to be
     * handled as unknown or zero for an unknown chunk.  By default the function
     * just skips the chunk or errors out if it is critical.
     */
 
+PNG_INTERNAL_FUNCTION(png_handle_result_code,png_handle_chunk,
+    (png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
+   /* This handles the current chunk png_ptr->chunk_name with unread
+    * data[length] and returns one of the above result codes.
+    */
+
 #if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED) ||\
     defined(PNG_HANDLE_AS_UNKNOWN_SUPPORTED)
 PNG_INTERNAL_FUNCTION(int,png_chunk_unknown_handling,
@@ -1676,8 +1686,6 @@ PNG_INTERNAL_FUNCTION(void,png_process_IDAT_data,(png_structrp png_ptr,
     png_bytep buffer, size_t buffer_length),PNG_EMPTY);
 PNG_INTERNAL_FUNCTION(void,png_push_process_row,(png_structrp png_ptr),
     PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_push_handle_unknown,(png_structrp png_ptr,
-   png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
 PNG_INTERNAL_FUNCTION(void,png_push_have_info,(png_structrp png_ptr,
    png_inforp info_ptr),PNG_EMPTY);
 PNG_INTERNAL_FUNCTION(void,png_push_have_end,(png_structrp png_ptr,
@@ -1690,109 +1698,28 @@ PNG_INTERNAL_FUNCTION(void,png_process_some_data,(png_structrp png_ptr,
     png_inforp info_ptr),PNG_EMPTY);
 PNG_INTERNAL_FUNCTION(void,png_read_push_finish_row,(png_structrp png_ptr),
     PNG_EMPTY);
-#  ifdef PNG_READ_tEXt_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_push_handle_tEXt,(png_structrp png_ptr,
-    png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_push_read_tEXt,(png_structrp png_ptr,
-    png_inforp info_ptr),PNG_EMPTY);
-#  endif
-#  ifdef PNG_READ_zTXt_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_push_handle_zTXt,(png_structrp png_ptr,
-    png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_push_read_zTXt,(png_structrp png_ptr,
-    png_inforp info_ptr),PNG_EMPTY);
-#  endif
-#  ifdef PNG_READ_iTXt_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_push_handle_iTXt,(png_structrp png_ptr,
-    png_inforp info_ptr, png_uint_32 length),PNG_EMPTY);
-PNG_INTERNAL_FUNCTION(void,png_push_read_iTXt,(png_structrp png_ptr,
-    png_inforp info_ptr),PNG_EMPTY);
-#  endif
-
 #endif /* PROGRESSIVE_READ */
 
-/* Added at libpng version 1.6.0 */
-#ifdef PNG_GAMMA_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_colorspace_set_gamma,(png_const_structrp png_ptr,
-    png_colorspacerp colorspace, png_fixed_point gAMA), PNG_EMPTY);
-   /* Set the colorspace gamma with a value provided by the application or by
-    * the gAMA chunk on read.  The value will override anything set by an ICC
-    * profile.
-    */
-
-PNG_INTERNAL_FUNCTION(void,png_colorspace_sync_info,(png_const_structrp png_ptr,
-    png_inforp info_ptr), PNG_EMPTY);
-   /* Synchronize the info 'valid' flags with the colorspace */
-
-PNG_INTERNAL_FUNCTION(void,png_colorspace_sync,(png_const_structrp png_ptr,
-    png_inforp info_ptr), PNG_EMPTY);
-   /* Copy the png_struct colorspace to the info_struct and call the above to
-    * synchronize the flags.  Checks for NULL info_ptr and does nothing.
-    */
-#endif
-
-/* Added at libpng version 1.4.0 */
-#ifdef PNG_COLORSPACE_SUPPORTED
-/* These internal functions are for maintaining the colorspace structure within
- * a png_info or png_struct (or, indeed, both).
- */
-PNG_INTERNAL_FUNCTION(int,png_colorspace_set_chromaticities,
-   (png_const_structrp png_ptr, png_colorspacerp colorspace, const png_xy *xy,
-    int preferred), PNG_EMPTY);
-
-PNG_INTERNAL_FUNCTION(int,png_colorspace_set_endpoints,
-   (png_const_structrp png_ptr, png_colorspacerp colorspace, const png_XYZ *XYZ,
-    int preferred), PNG_EMPTY);
-
-#ifdef PNG_sRGB_SUPPORTED
-PNG_INTERNAL_FUNCTION(int,png_colorspace_set_sRGB,(png_const_structrp png_ptr,
-   png_colorspacerp colorspace, int intent), PNG_EMPTY);
-   /* This does set the colorspace gAMA and cHRM values too, but doesn't set the
-    * flags to write them, if it returns false there was a problem and an error
-    * message has already been output (but the colorspace may still need to be
-    * synced to record the invalid flag).
-    */
-#endif /* sRGB */
-
 #ifdef PNG_iCCP_SUPPORTED
-PNG_INTERNAL_FUNCTION(int,png_colorspace_set_ICC,(png_const_structrp png_ptr,
-   png_colorspacerp colorspace, png_const_charp name,
-   png_uint_32 profile_length, png_const_bytep profile, int color_type),
-   PNG_EMPTY);
-   /* The 'name' is used for information only */
-
 /* Routines for checking parts of an ICC profile. */
 #ifdef PNG_READ_iCCP_SUPPORTED
 PNG_INTERNAL_FUNCTION(int,png_icc_check_length,(png_const_structrp png_ptr,
-   png_colorspacerp colorspace, png_const_charp name,
-   png_uint_32 profile_length), PNG_EMPTY);
+   png_const_charp name, png_uint_32 profile_length), PNG_EMPTY);
 #endif /* READ_iCCP */
 PNG_INTERNAL_FUNCTION(int,png_icc_check_header,(png_const_structrp png_ptr,
-   png_colorspacerp colorspace, png_const_charp name,
-   png_uint_32 profile_length,
+   png_const_charp name, png_uint_32 profile_length,
    png_const_bytep profile /* first 132 bytes only */, int color_type),
    PNG_EMPTY);
 PNG_INTERNAL_FUNCTION(int,png_icc_check_tag_table,(png_const_structrp png_ptr,
-   png_colorspacerp colorspace, png_const_charp name,
-   png_uint_32 profile_length,
+   png_const_charp name, png_uint_32 profile_length,
    png_const_bytep profile /* header plus whole tag table */), PNG_EMPTY);
-#ifdef PNG_sRGB_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_icc_set_sRGB,(
-   png_const_structrp png_ptr, png_colorspacerp colorspace,
-   png_const_bytep profile, uLong adler), PNG_EMPTY);
-   /* 'adler' is the Adler32 checksum of the uncompressed profile data. It may
-    * be zero to indicate that it is not available.  It is used, if provided,
-    * as a fast check on the profile when checking to see if it is sRGB.
-    */
-#endif
 #endif /* iCCP */
 
 #ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
-PNG_INTERNAL_FUNCTION(void,png_colorspace_set_rgb_coefficients,
-   (png_structrp png_ptr), PNG_EMPTY);
-   /* Set the rgb_to_gray coefficients from the colorspace Y values */
+PNG_INTERNAL_FUNCTION(void,png_set_rgb_coefficients, (png_structrp png_ptr),
+   PNG_EMPTY);
+   /* Set the rgb_to_gray coefficients from the cHRM Y values (if unset) */
 #endif /* READ_RGB_TO_GRAY */
-#endif /* COLORSPACE */
 
 /* Added at libpng version 1.4.0 */
 PNG_INTERNAL_FUNCTION(void,png_check_IHDR,(png_const_structrp png_ptr,
@@ -2054,8 +1981,10 @@ PNG_INTERNAL_FUNCTION(int,png_check_fp_string,(png_const_charp string,
    size_t size),PNG_EMPTY);
 #endif /* pCAL || sCAL */
 
-#if defined(PNG_GAMMA_SUPPORTED) ||\
-    defined(PNG_INCH_CONVERSIONS_SUPPORTED) || defined(PNG_READ_pHYs_SUPPORTED)
+#if defined(PNG_READ_GAMMA_SUPPORTED) ||\
+    defined(PNG_COLORSPACE_SUPPORTED) ||\
+    defined(PNG_INCH_CONVERSIONS_SUPPORTED) ||\
+    defined(PNG_READ_pHYs_SUPPORTED)
 /* Added at libpng version 1.5.0 */
 /* This is a utility to provide a*times/div (rounded) and indicate
  * if there is an overflow.  The result is a boolean - false (0)
@@ -2064,22 +1993,14 @@ PNG_INTERNAL_FUNCTION(int,png_check_fp_string,(png_const_charp string,
  */
 PNG_INTERNAL_FUNCTION(int,png_muldiv,(png_fixed_point_p res, png_fixed_point a,
    png_int_32 multiplied_by, png_int_32 divided_by),PNG_EMPTY);
-#endif
-
-#if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_INCH_CONVERSIONS_SUPPORTED)
-/* Same deal, but issue a warning on overflow and return 0. */
-PNG_INTERNAL_FUNCTION(png_fixed_point,png_muldiv_warn,
-   (png_const_structrp png_ptr, png_fixed_point a, png_int_32 multiplied_by,
-   png_int_32 divided_by),PNG_EMPTY);
-#endif
 
-#ifdef PNG_GAMMA_SUPPORTED
 /* Calculate a reciprocal - used for gamma values.  This returns
  * 0 if the argument is 0 in order to maintain an undefined value;
  * there are no warnings.
  */
 PNG_INTERNAL_FUNCTION(png_fixed_point,png_reciprocal,(png_fixed_point a),
    PNG_EMPTY);
+#endif
 
 #ifdef PNG_READ_GAMMA_SUPPORTED
 /* The same but gives a reciprocal of the product of two fixed point
@@ -2088,14 +2009,22 @@ PNG_INTERNAL_FUNCTION(png_fixed_point,png_reciprocal,(png_fixed_point a),
  */
 PNG_INTERNAL_FUNCTION(png_fixed_point,png_reciprocal2,(png_fixed_point a,
    png_fixed_point b),PNG_EMPTY);
-#endif
 
 /* Return true if the gamma value is significantly different from 1.0 */
 PNG_INTERNAL_FUNCTION(int,png_gamma_significant,(png_fixed_point gamma_value),
    PNG_EMPTY);
-#endif
 
-#ifdef PNG_READ_GAMMA_SUPPORTED
+/* PNGv3: 'resolve' the file gamma according to the new PNGv3 rules for colour
+ * space information.
+ *
+ * NOTE: this uses precisely those chunks that libpng supports.  For example it
+ * doesn't use iCCP and it can only use cICP for known and manageable
+ * transforms.  For this reason a gamma specified by png_set_gamma always takes
+ * precedence.
+ */
+PNG_INTERNAL_FUNCTION(png_fixed_point,png_resolve_file_gamma,
+   (png_const_structrp png_ptr),PNG_EMPTY);
+
 /* Internal fixed point gamma correction.  These APIs are called as
  * required to convert single values - they don't need to be fast,
  * they are not used when processing image pixel values.
@@ -2113,6 +2042,22 @@ PNG_INTERNAL_FUNCTION(void,png_destroy_gamma_table,(png_structrp png_ptr),
    PNG_EMPTY);
 PNG_INTERNAL_FUNCTION(void,png_build_gamma_table,(png_structrp png_ptr,
    int bit_depth),PNG_EMPTY);
+#endif /* READ_GAMMA */
+
+#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
+/* Set the RGB coefficients if not already set by png_set_rgb_to_gray */
+PNG_INTERNAL_FUNCTION(void,png_set_rgb_coefficients,(png_structrp png_ptr),
+   PNG_EMPTY);
+#endif
+
+#if defined(PNG_cHRM_SUPPORTED) || defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
+PNG_INTERNAL_FUNCTION(int,png_XYZ_from_xy,(png_XYZ *XYZ, const png_xy *xy),
+   PNG_EMPTY);
+#endif /* cHRM || READ_RGB_TO_GRAY */
+
+#ifdef PNG_COLORSPACE_SUPPORTED
+PNG_INTERNAL_FUNCTION(int,png_xy_from_XYZ,(png_xy *xy, const png_XYZ *XYZ),
+   PNG_EMPTY);
 #endif
 
 /* SIMPLIFIED READ/WRITE SUPPORT */
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/pngread.c b/src/java.desktop/share/native/libsplashscreen/libpng/pngread.c
index e9e944775452..8a6381e1b3e9 100644
--- a/src/java.desktop/share/native/libsplashscreen/libpng/pngread.c
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/pngread.c
@@ -29,7 +29,7 @@
  * However, the following notice accompanied the original version of this
  * file and, per its terms, should not be removed:
  *
- * Copyright (c) 2018-2024 Cosmin Truta
+ * Copyright (c) 2018-2025 Cosmin Truta
  * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
  * Copyright (c) 1996-1997 Andreas Dilger
  * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
@@ -160,14 +160,11 @@ png_read_info(png_structrp png_ptr, png_inforp info_ptr)
          png_ptr->mode |= PNG_AFTER_IDAT;
       }
 
-      /* This should be a binary subdivision search or a hash for
-       * matching the chunk name rather than a linear search.
-       */
       if (chunk_name == png_IHDR)
-         png_handle_IHDR(png_ptr, info_ptr, length);
+         png_handle_chunk(png_ptr, info_ptr, length);
 
       else if (chunk_name == png_IEND)
-         png_handle_IEND(png_ptr, info_ptr, length);
+         png_handle_chunk(png_ptr, info_ptr, length);
 
 #ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
       else if ((keep = png_chunk_unknown_handling(png_ptr, chunk_name)) != 0)
@@ -184,8 +181,6 @@ png_read_info(png_structrp png_ptr, png_inforp info_ptr)
          }
       }
 #endif
-      else if (chunk_name == png_PLTE)
-         png_handle_PLTE(png_ptr, info_ptr, length);
 
       else if (chunk_name == png_IDAT)
       {
@@ -193,99 +188,8 @@ png_read_info(png_structrp png_ptr, png_inforp info_ptr)
          break;
       }
 
-#ifdef PNG_READ_bKGD_SUPPORTED
-      else if (chunk_name == png_bKGD)
-         png_handle_bKGD(png_ptr, info_ptr, length);
-#endif
-
-#ifdef PNG_READ_cHRM_SUPPORTED
-      else if (chunk_name == png_cHRM)
-         png_handle_cHRM(png_ptr, info_ptr, length);
-#endif
-
-#ifdef PNG_READ_eXIf_SUPPORTED
-      else if (chunk_name == png_eXIf)
-         png_handle_eXIf(png_ptr, info_ptr, length);
-#endif
-
-#ifdef PNG_READ_gAMA_SUPPORTED
-      else if (chunk_name == png_gAMA)
-         png_handle_gAMA(png_ptr, info_ptr, length);
-#endif
-
-#ifdef PNG_READ_hIST_SUPPORTED
-      else if (chunk_name == png_hIST)
-         png_handle_hIST(png_ptr, info_ptr, length);
-#endif
-
-#ifdef PNG_READ_oFFs_SUPPORTED
-      else if (chunk_name == png_oFFs)
-         png_handle_oFFs(png_ptr, info_ptr, length);
-#endif
-
-#ifdef PNG_READ_pCAL_SUPPORTED
-      else if (chunk_name == png_pCAL)
-         png_handle_pCAL(png_ptr, info_ptr, length);
-#endif
-
-#ifdef PNG_READ_sCAL_SUPPORTED
-      else if (chunk_name == png_sCAL)
-         png_handle_sCAL(png_ptr, info_ptr, length);
-#endif
-
-#ifdef PNG_READ_pHYs_SUPPORTED
-      else if (chunk_name == png_pHYs)
-         png_handle_pHYs(png_ptr, info_ptr, length);
-#endif
-
-#ifdef PNG_READ_sBIT_SUPPORTED
-      else if (chunk_name == png_sBIT)
-         png_handle_sBIT(png_ptr, info_ptr, length);
-#endif
-
-#ifdef PNG_READ_sRGB_SUPPORTED
-      else if (chunk_name == png_sRGB)
-         png_handle_sRGB(png_ptr, info_ptr, length);
-#endif
-
-#ifdef PNG_READ_iCCP_SUPPORTED
-      else if (chunk_name == png_iCCP)
-         png_handle_iCCP(png_ptr, info_ptr, length);
-#endif
-
-#ifdef PNG_READ_sPLT_SUPPORTED
-      else if (chunk_name == png_sPLT)
-         png_handle_sPLT(png_ptr, info_ptr, length);
-#endif
-
-#ifdef PNG_READ_tEXt_SUPPORTED
-      else if (chunk_name == png_tEXt)
-         png_handle_tEXt(png_ptr, info_ptr, length);
-#endif
-
-#ifdef PNG_READ_tIME_SUPPORTED
-      else if (chunk_name == png_tIME)
-         png_handle_tIME(png_ptr, info_ptr, length);
-#endif
-
-#ifdef PNG_READ_tRNS_SUPPORTED
-      else if (chunk_name == png_tRNS)
-         png_handle_tRNS(png_ptr, info_ptr, length);
-#endif
-
-#ifdef PNG_READ_zTXt_SUPPORTED
-      else if (chunk_name == png_zTXt)
-         png_handle_zTXt(png_ptr, info_ptr, length);
-#endif
-
-#ifdef PNG_READ_iTXt_SUPPORTED
-      else if (chunk_name == png_iTXt)
-         png_handle_iTXt(png_ptr, info_ptr, length);
-#endif
-
       else
-         png_handle_unknown(png_ptr, info_ptr, length,
-             PNG_HANDLE_CHUNK_AS_DEFAULT);
+         png_handle_chunk(png_ptr, info_ptr, length);
    }
 }
 #endif /* SEQUENTIAL_READ */
@@ -830,10 +734,10 @@ png_read_end(png_structrp png_ptr, png_inforp info_ptr)
          png_ptr->mode |= PNG_HAVE_CHUNK_AFTER_IDAT;
 
       if (chunk_name == png_IEND)
-         png_handle_IEND(png_ptr, info_ptr, length);
+         png_handle_chunk(png_ptr, info_ptr, length);
 
       else if (chunk_name == png_IHDR)
-         png_handle_IHDR(png_ptr, info_ptr, length);
+         png_handle_chunk(png_ptr, info_ptr, length);
 
       else if (info_ptr == NULL)
          png_crc_finish(png_ptr, length);
@@ -867,102 +771,9 @@ png_read_end(png_structrp png_ptr, png_inforp info_ptr)
 
          png_crc_finish(png_ptr, length);
       }
-      else if (chunk_name == png_PLTE)
-         png_handle_PLTE(png_ptr, info_ptr, length);
-
-#ifdef PNG_READ_bKGD_SUPPORTED
-      else if (chunk_name == png_bKGD)
-         png_handle_bKGD(png_ptr, info_ptr, length);
-#endif
-
-#ifdef PNG_READ_cHRM_SUPPORTED
-      else if (chunk_name == png_cHRM)
-         png_handle_cHRM(png_ptr, info_ptr, length);
-#endif
-
-#ifdef PNG_READ_eXIf_SUPPORTED
-      else if (chunk_name == png_eXIf)
-         png_handle_eXIf(png_ptr, info_ptr, length);
-#endif
-
-#ifdef PNG_READ_gAMA_SUPPORTED
-      else if (chunk_name == png_gAMA)
-         png_handle_gAMA(png_ptr, info_ptr, length);
-#endif
-
-#ifdef PNG_READ_hIST_SUPPORTED
-      else if (chunk_name == png_hIST)
-         png_handle_hIST(png_ptr, info_ptr, length);
-#endif
-
-#ifdef PNG_READ_oFFs_SUPPORTED
-      else if (chunk_name == png_oFFs)
-         png_handle_oFFs(png_ptr, info_ptr, length);
-#endif
-
-#ifdef PNG_READ_pCAL_SUPPORTED
-      else if (chunk_name == png_pCAL)
-         png_handle_pCAL(png_ptr, info_ptr, length);
-#endif
-
-#ifdef PNG_READ_sCAL_SUPPORTED
-      else if (chunk_name == png_sCAL)
-         png_handle_sCAL(png_ptr, info_ptr, length);
-#endif
-
-#ifdef PNG_READ_pHYs_SUPPORTED
-      else if (chunk_name == png_pHYs)
-         png_handle_pHYs(png_ptr, info_ptr, length);
-#endif
-
-#ifdef PNG_READ_sBIT_SUPPORTED
-      else if (chunk_name == png_sBIT)
-         png_handle_sBIT(png_ptr, info_ptr, length);
-#endif
-
-#ifdef PNG_READ_sRGB_SUPPORTED
-      else if (chunk_name == png_sRGB)
-         png_handle_sRGB(png_ptr, info_ptr, length);
-#endif
-
-#ifdef PNG_READ_iCCP_SUPPORTED
-      else if (chunk_name == png_iCCP)
-         png_handle_iCCP(png_ptr, info_ptr, length);
-#endif
-
-#ifdef PNG_READ_sPLT_SUPPORTED
-      else if (chunk_name == png_sPLT)
-         png_handle_sPLT(png_ptr, info_ptr, length);
-#endif
-
-#ifdef PNG_READ_tEXt_SUPPORTED
-      else if (chunk_name == png_tEXt)
-         png_handle_tEXt(png_ptr, info_ptr, length);
-#endif
-
-#ifdef PNG_READ_tIME_SUPPORTED
-      else if (chunk_name == png_tIME)
-         png_handle_tIME(png_ptr, info_ptr, length);
-#endif
-
-#ifdef PNG_READ_tRNS_SUPPORTED
-      else if (chunk_name == png_tRNS)
-         png_handle_tRNS(png_ptr, info_ptr, length);
-#endif
-
-#ifdef PNG_READ_zTXt_SUPPORTED
-      else if (chunk_name == png_zTXt)
-         png_handle_zTXt(png_ptr, info_ptr, length);
-#endif
-
-#ifdef PNG_READ_iTXt_SUPPORTED
-      else if (chunk_name == png_iTXt)
-         png_handle_iTXt(png_ptr, info_ptr, length);
-#endif
 
       else
-         png_handle_unknown(png_ptr, info_ptr, length,
-             PNG_HANDLE_CHUNK_AS_DEFAULT);
+         png_handle_chunk(png_ptr, info_ptr, length);
    } while ((png_ptr->mode & PNG_HAVE_IEND) == 0);
 }
 #endif /* SEQUENTIAL_READ */
@@ -1413,6 +1224,31 @@ png_image_format(png_structrp png_ptr)
    return format;
 }
 
+static int
+chromaticities_match_sRGB(const png_xy *xy)
+{
+#  define sRGB_TOLERANCE 1000
+   static const png_xy sRGB_xy = /* From ITU-R BT.709-3 */
+   {
+      /* color      x       y */
+      /* red   */ 64000, 33000,
+      /* green */ 30000, 60000,
+      /* blue  */ 15000,  6000,
+      /* white */ 31270, 32900
+   };
+
+   if (PNG_OUT_OF_RANGE(xy->whitex, sRGB_xy.whitex,sRGB_TOLERANCE) ||
+       PNG_OUT_OF_RANGE(xy->whitey, sRGB_xy.whitey,sRGB_TOLERANCE) ||
+       PNG_OUT_OF_RANGE(xy->redx,   sRGB_xy.redx,  sRGB_TOLERANCE) ||
+       PNG_OUT_OF_RANGE(xy->redy,   sRGB_xy.redy,  sRGB_TOLERANCE) ||
+       PNG_OUT_OF_RANGE(xy->greenx, sRGB_xy.greenx,sRGB_TOLERANCE) ||
+       PNG_OUT_OF_RANGE(xy->greeny, sRGB_xy.greeny,sRGB_TOLERANCE) ||
+       PNG_OUT_OF_RANGE(xy->bluex,  sRGB_xy.bluex, sRGB_TOLERANCE) ||
+       PNG_OUT_OF_RANGE(xy->bluey,  sRGB_xy.bluey, sRGB_TOLERANCE))
+      return 0;
+   return 1;
+}
+
 /* Is the given gamma significantly different from sRGB?  The test is the same
  * one used in pngrtran.c when deciding whether to do gamma correction.  The
  * arithmetic optimizes the division by using the fact that the inverse of the
@@ -1421,22 +1257,44 @@ png_image_format(png_structrp png_ptr)
 static int
 png_gamma_not_sRGB(png_fixed_point g)
 {
-   if (g < PNG_FP_1)
-   {
-      /* An uninitialized gamma is assumed to be sRGB for the simplified API. */
-      if (g == 0)
-         return 0;
-
-      return png_gamma_significant((g * 11 + 2)/5 /* i.e. *2.2, rounded */);
-   }
+   /* 1.6.47: use the same sanity checks as used in pngrtran.c */
+   if (g < PNG_LIB_GAMMA_MIN || g > PNG_LIB_GAMMA_MAX)
+      return 0; /* Includes the uninitialized value 0 */
 
-   return 1;
+   return png_gamma_significant((g * 11 + 2)/5 /* i.e. *2.2, rounded */);
 }
 
 /* Do the main body of a 'png_image_begin_read' function; read the PNG file
  * header and fill in all the information.  This is executed in a safe context,
  * unlike the init routine above.
  */
+static int
+png_image_is_not_sRGB(png_const_structrp png_ptr)
+{
+   /* Does the colorspace **not** match sRGB?  The flag is only set if the
+    * answer can be determined reliably.
+    *
+    * png_struct::chromaticities always exists since the simplified API
+    * requires rgb-to-gray.  The mDCV, cICP and cHRM chunks may all set it to
+    * a non-sRGB value, so it needs to be checked but **only** if one of
+    * those chunks occured in the file.
+    */
+   /* Highest priority: check to be safe. */
+   if (png_has_chunk(png_ptr, cICP) || png_has_chunk(png_ptr, mDCV))
+      return !chromaticities_match_sRGB(&png_ptr->chromaticities);
+
+   /* If the image is marked as sRGB then it is... */
+   if (png_has_chunk(png_ptr, sRGB))
+      return 0;
+
+   /* Last stop: cHRM, must check: */
+   if (png_has_chunk(png_ptr, cHRM))
+      return !chromaticities_match_sRGB(&png_ptr->chromaticities);
+
+   /* Else default to sRGB */
+   return 0;
+}
+
 static int
 png_image_read_header(png_voidp argument)
 {
@@ -1458,17 +1316,13 @@ png_image_read_header(png_voidp argument)
 
       image->format = format;
 
-#ifdef PNG_COLORSPACE_SUPPORTED
-      /* Does the colorspace match sRGB?  If there is no color endpoint
-       * (colorant) information assume yes, otherwise require the
-       * 'ENDPOINTS_MATCHP_sRGB' colorspace flag to have been set.  If the
-       * colorspace has been determined to be invalid ignore it.
+      /* Greyscale images don't (typically) have colour space information and
+       * using it is pretty much impossible, so use sRGB for grayscale (it
+       * doesn't matter r==g==b so the transform is irrelevant.)
        */
-      if ((format & PNG_FORMAT_FLAG_COLOR) != 0 && ((png_ptr->colorspace.flags
-         & (PNG_COLORSPACE_HAVE_ENDPOINTS|PNG_COLORSPACE_ENDPOINTS_MATCH_sRGB|
-            PNG_COLORSPACE_INVALID)) == PNG_COLORSPACE_HAVE_ENDPOINTS))
+      if ((format & PNG_FORMAT_FLAG_COLOR) != 0 &&
+          png_image_is_not_sRGB(png_ptr))
          image->flags |= PNG_IMAGE_FLAG_COLORSPACE_NOT_sRGB;
-#endif
    }
 
    /* We need the maximum number of entries regardless of the format the
@@ -1656,21 +1510,18 @@ png_image_skip_unused_chunks(png_structrp png_ptr)
     * potential vulnerability to security problems in the unused chunks.
     *
     * At present the iCCP chunk data isn't used, so iCCP chunk can be ignored
-    * too.  This allows the simplified API to be compiled without iCCP support,
-    * however if the support is there the chunk is still checked to detect
-    * errors (which are unfortunately quite common.)
+    * too.  This allows the simplified API to be compiled without iCCP support.
     */
    {
          static const png_byte chunks_to_process[] = {
             98,  75,  71,  68, '\0',  /* bKGD */
             99,  72,  82,  77, '\0',  /* cHRM */
+            99,  73,  67,  80, '\0',  /* cICP */
            103,  65,  77,  65, '\0',  /* gAMA */
-#        ifdef PNG_READ_iCCP_SUPPORTED
-           105,  67,  67,  80, '\0',  /* iCCP */
-#        endif
+           109,  68,  67,  86, '\0',  /* mDCV */
            115,  66,  73,  84, '\0',  /* sBIT */
            115,  82,  71,  66, '\0',  /* sRGB */
-           };
+         };
 
        /* Ignore unknown chunks and all other chunks except for the
         * IHDR, PLTE, tRNS, IDAT, and IEND chunks.
@@ -1699,7 +1550,15 @@ png_image_skip_unused_chunks(png_structrp png_ptr)
 static void
 set_file_encoding(png_image_read_control *display)
 {
-   png_fixed_point g = display->image->opaque->png_ptr->colorspace.gamma;
+   png_structrp png_ptr = display->image->opaque->png_ptr;
+   png_fixed_point g = png_resolve_file_gamma(png_ptr);
+
+   /* PNGv3: the result may be 0 however the 'default_gamma' should have been
+    * set before this is called so zero is an error:
+    */
+   if (g == 0)
+      png_error(png_ptr, "internal: default gamma not set");
+
    if (png_gamma_significant(g) != 0)
    {
       if (png_gamma_not_sRGB(g) != 0)
@@ -2187,24 +2046,18 @@ png_image_read_colormap(png_voidp argument)
    /* Default the input file gamma if required - this is necessary because
     * libpng assumes that if no gamma information is present the data is in the
     * output format, but the simplified API deduces the gamma from the input
-    * format.
+    * format.  The 'default' gamma value is also set by png_set_alpha_mode, but
+    * this is happening before any such call, so:
+    *
+    * TODO: should be an internal API and all this code should be copied into a
+    * single common gamma+colorspace file.
     */
-   if ((png_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_GAMMA) == 0)
-   {
-      /* Do this directly, not using the png_colorspace functions, to ensure
-       * that it happens even if the colorspace is invalid (though probably if
-       * it is the setting will be ignored)  Note that the same thing can be
-       * achieved at the application interface with png_set_gAMA.
-       */
-      if (png_ptr->bit_depth == 16 &&
-         (image->flags & PNG_IMAGE_FLAG_16BIT_sRGB) == 0)
-         png_ptr->colorspace.gamma = PNG_GAMMA_LINEAR;
-
-      else
-         png_ptr->colorspace.gamma = PNG_GAMMA_sRGB_INVERSE;
+   if (png_ptr->bit_depth == 16 &&
+      (image->flags & PNG_IMAGE_FLAG_16BIT_sRGB) == 0)
+      png_ptr->default_gamma = PNG_GAMMA_LINEAR;
 
-      png_ptr->colorspace.flags |= PNG_COLORSPACE_HAVE_GAMMA;
-   }
+   else
+      png_ptr->default_gamma = PNG_GAMMA_sRGB_INVERSE;
 
    /* Decide what to do based on the PNG color type of the input data.  The
     * utility function png_create_colormap_entry deals with most aspects of the
@@ -2582,6 +2435,8 @@ png_image_read_colormap(png_voidp argument)
 
             else
             {
+               const png_fixed_point gamma = png_resolve_file_gamma(png_ptr);
+
                /* Either the input or the output has no alpha channel, so there
                 * will be no non-opaque pixels in the color-map; it will just be
                 * grayscale.
@@ -2596,10 +2451,13 @@ png_image_read_colormap(png_voidp argument)
                 * this case and doing it in the palette; this will result in
                 * duplicate palette entries, but that's better than the
                 * alternative of double gamma correction.
+                *
+                * NOTE: PNGv3: check the resolved result of all the potentially
+                * different colour space chunks.
                 */
                if ((png_ptr->color_type == PNG_COLOR_TYPE_RGB_ALPHA ||
                   png_ptr->num_trans > 0) &&
-                  png_gamma_not_sRGB(png_ptr->colorspace.gamma) != 0)
+                  png_gamma_not_sRGB(gamma) != 0)
                {
                   cmap_entries = (unsigned int)make_gray_file_colormap(display);
                   data_encoding = P_FILE;
@@ -2631,8 +2489,8 @@ png_image_read_colormap(png_voidp argument)
                      if (output_encoding == P_sRGB)
                         gray = png_sRGB_table[gray]; /* now P_LINEAR */
 
-                     gray = PNG_DIV257(png_gamma_16bit_correct(gray,
-                         png_ptr->colorspace.gamma)); /* now P_FILE */
+                     gray = PNG_DIV257(png_gamma_16bit_correct(gray, gamma));
+                        /* now P_FILE */
 
                      /* And make sure the corresponding palette entry contains
                       * exactly the required sRGB value.
@@ -3763,6 +3621,12 @@ png_image_read_direct(png_voidp argument)
       /* Set the gamma appropriately, linear for 16-bit input, sRGB otherwise.
        */
       {
+         /* This is safe but should no longer be necessary as
+          * png_ptr->default_gamma should have been set after the
+          * info-before-IDAT was read in png_image_read_header.
+          *
+          * TODO: 1.8: remove this and see what happens.
+          */
          png_fixed_point input_gamma_default;
 
          if ((base_format & PNG_FORMAT_FLAG_LINEAR) != 0 &&
@@ -3818,8 +3682,9 @@ png_image_read_direct(png_voidp argument)
           * yet; it's set below.  png_struct::gamma, however, is set to the
           * final value.
           */
-         if (png_muldiv(>est, output_gamma, png_ptr->colorspace.gamma,
-             PNG_FP_1) != 0 && png_gamma_significant(gtest) == 0)
+         if (png_muldiv(>est, output_gamma,
+                  png_resolve_file_gamma(png_ptr), PNG_FP_1) != 0 &&
+             png_gamma_significant(gtest) == 0)
             do_local_background = 0;
 
          else if (mode == PNG_ALPHA_STANDARD)
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/pngrtran.c b/src/java.desktop/share/native/libsplashscreen/libpng/pngrtran.c
index a393de4b79d0..4f31f8f07bc5 100644
--- a/src/java.desktop/share/native/libsplashscreen/libpng/pngrtran.c
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/pngrtran.c
@@ -247,9 +247,59 @@ png_set_strip_alpha(png_structrp png_ptr)
 #endif
 
 #if defined(PNG_READ_ALPHA_MODE_SUPPORTED) || defined(PNG_READ_GAMMA_SUPPORTED)
+/* PNGv3 conformance: this private API exists to resolve the now mandatory error
+ * resolution when multiple conflicting sources of gamma or colour space
+ * information are available.
+ *
+ * Terminology (assuming power law, "gamma", encodings):
+ *    "screen" gamma: a power law imposed by the output device when digital
+ *    samples are converted to visible light output.  The EOTF - volage to
+ *    luminance on output.
+ *
+ *    "file" gamma: a power law used to encode luminance levels from the input
+ *    data (the scene or the mastering display system) into digital voltages.
+ *    The OETF - luminance to voltage on input.
+ *
+ *    gamma "correction": a power law matching the **inverse** of the overall
+ *    transfer function from input luminance levels to output levels.  The
+ *    **inverse** of the OOTF; the correction "corrects" for the OOTF by aiming
+ *    to make the overall OOTF (including the correction) linear.
+ *
+ * It is important to understand this terminology because the defined terms are
+ * scattered throughout the libpng code and it is very easy to end up with the
+ * inverse of the power law required.
+ *
+ * Variable and struct::member names:
+ *    file_gamma        OETF  how the PNG data was encoded
+ *
+ *    screen_gamma      EOTF  how the screen will decode digital levels
+ *
+ *    -- not used --    OOTF  the net effect OETF x EOTF
+ *    gamma_correction        the inverse of OOTF to make the result linear
+ *
+ * All versions of libpng require a call to "png_set_gamma" to establish the
+ * "screen" gamma, the power law representing the EOTF.  png_set_gamma may also
+ * set or default the "file" gamma; the OETF.  gamma_correction is calculated
+ * internally.
+ *
+ * The earliest libpng versions required file_gamma to be supplied to set_gamma.
+ * Later versions started allowing png_set_gamma and, later, png_set_alpha_mode,
+ * to cause defaulting from the file data.
+ *
+ * PNGv3 mandated a particular form for this defaulting, one that is compatible
+ * with what libpng did except that if libpng detected inconsistencies it marked
+ * all the chunks as "invalid".  PNGv3 effectively invalidates this prior code.
+ *
+ * Behaviour implemented below:
+ *    translate_gamma_flags(gamma, is_screen)
+ *       The libpng-1.6 API for the gamma parameters to libpng APIs
+ *       (png_set_gamma and png_set_alpha_mode at present).  This allows the
+ *       'gamma' value to be passed as a png_fixed_point number or as one of a
+ *       set of integral values for specific "well known" examples of transfer
+ *       functions.  This is compatible with PNGv3.
+ */
 static png_fixed_point
-translate_gamma_flags(png_structrp png_ptr, png_fixed_point output_gamma,
-    int is_screen)
+translate_gamma_flags(png_fixed_point output_gamma, int is_screen)
 {
    /* Check for flag values.  The main reason for having the old Mac value as a
     * flag is that it is pretty near impossible to work out what the correct
@@ -259,14 +309,6 @@ translate_gamma_flags(png_structrp png_ptr, png_fixed_point output_gamma,
    if (output_gamma == PNG_DEFAULT_sRGB ||
       output_gamma == PNG_FP_1 / PNG_DEFAULT_sRGB)
    {
-      /* If there is no sRGB support this just sets the gamma to the standard
-       * sRGB value.  (This is a side effect of using this function!)
-       */
-#     ifdef PNG_READ_sRGB_SUPPORTED
-         png_ptr->flags |= PNG_FLAG_ASSUME_sRGB;
-#     else
-         PNG_UNUSED(png_ptr)
-#     endif
       if (is_screen != 0)
          output_gamma = PNG_GAMMA_sRGB;
       else
@@ -308,6 +350,33 @@ convert_gamma_value(png_structrp png_ptr, double output_gamma)
    return (png_fixed_point)output_gamma;
 }
 #  endif
+
+static int
+unsupported_gamma(png_structrp png_ptr, png_fixed_point gamma, int warn)
+{
+   /* Validate a gamma value to ensure it is in a reasonable range.  The value
+    * is expected to be 1 or greater, but this range test allows for some
+    * viewing correction values.  The intent is to weed out the API users
+    * who might use the inverse of the gamma value accidentally!
+    *
+    * 1.6.47: apply the test in png_set_gamma as well but only warn and return
+    * false if it fires.
+    *
+    * TODO: 1.8: make this an app_error in png_set_gamma as well.
+    */
+   if (gamma < PNG_LIB_GAMMA_MIN || gamma > PNG_LIB_GAMMA_MAX)
+   {
+#     define msg "gamma out of supported range"
+      if (warn)
+         png_app_warning(png_ptr, msg);
+      else
+         png_app_error(png_ptr, msg);
+      return 1;
+#     undef msg
+   }
+
+   return 0;
+}
 #endif /* READ_ALPHA_MODE || READ_GAMMA */
 
 #ifdef PNG_READ_ALPHA_MODE_SUPPORTED
@@ -315,31 +384,29 @@ void PNGFAPI
 png_set_alpha_mode_fixed(png_structrp png_ptr, int mode,
     png_fixed_point output_gamma)
 {
-   int compose = 0;
    png_fixed_point file_gamma;
+   int compose = 0;
 
    png_debug(1, "in png_set_alpha_mode_fixed");
 
    if (png_rtran_ok(png_ptr, 0) == 0)
       return;
 
-   output_gamma = translate_gamma_flags(png_ptr, output_gamma, 1/*screen*/);
-
-   /* Validate the value to ensure it is in a reasonable range.  The value
-    * is expected to be 1 or greater, but this range test allows for some
-    * viewing correction values.  The intent is to weed out the API users
-    * who might use the inverse of the gamma value accidentally!
-    *
-    * In libpng 1.6.0, we changed from 0.07..3 to 0.01..100, to accommodate
-    * the optimal 16-bit gamma of 36 and its reciprocal.
-    */
-   if (output_gamma < 1000 || output_gamma > 10000000)
-      png_error(png_ptr, "output gamma out of expected range");
+   output_gamma = translate_gamma_flags(output_gamma, 1/*screen*/);
+   if (unsupported_gamma(png_ptr, output_gamma, 0/*error*/))
+      return;
 
    /* The default file gamma is the inverse of the output gamma; the output
-    * gamma may be changed below so get the file value first:
+    * gamma may be changed below so get the file value first.  The default_gamma
+    * is set here and from the simplified API (which uses a different algorithm)
+    * so don't overwrite a set value:
     */
-   file_gamma = png_reciprocal(output_gamma);
+   file_gamma = png_ptr->default_gamma;
+   if (file_gamma == 0)
+   {
+      file_gamma = png_reciprocal(output_gamma);
+      png_ptr->default_gamma = file_gamma;
+   }
 
    /* There are really 8 possibilities here, composed of any combination
     * of:
@@ -390,17 +457,7 @@ png_set_alpha_mode_fixed(png_structrp png_ptr, int mode,
          png_error(png_ptr, "invalid alpha mode");
    }
 
-   /* Only set the default gamma if the file gamma has not been set (this has
-    * the side effect that the gamma in a second call to png_set_alpha_mode will
-    * be ignored.)
-    */
-   if (png_ptr->colorspace.gamma == 0)
-   {
-      png_ptr->colorspace.gamma = file_gamma;
-      png_ptr->colorspace.flags |= PNG_COLORSPACE_HAVE_GAMMA;
-   }
-
-   /* But always set the output gamma: */
+   /* Set the screen gamma values: */
    png_ptr->screen_gamma = output_gamma;
 
    /* Finally, if pre-multiplying, set the background fields to achieve the
@@ -410,7 +467,7 @@ png_set_alpha_mode_fixed(png_structrp png_ptr, int mode,
    {
       /* And obtain alpha pre-multiplication by composing on black: */
       memset(&png_ptr->background, 0, (sizeof png_ptr->background));
-      png_ptr->background_gamma = png_ptr->colorspace.gamma; /* just in case */
+      png_ptr->background_gamma = file_gamma; /* just in case */
       png_ptr->background_gamma_type = PNG_BACKGROUND_GAMMA_FILE;
       png_ptr->transformations &= ~PNG_BACKGROUND_EXPAND;
 
@@ -848,8 +905,8 @@ png_set_gamma_fixed(png_structrp png_ptr, png_fixed_point scrn_gamma,
       return;
 
    /* New in libpng-1.5.4 - reserve particular negative values as flags. */
-   scrn_gamma = translate_gamma_flags(png_ptr, scrn_gamma, 1/*screen*/);
-   file_gamma = translate_gamma_flags(png_ptr, file_gamma, 0/*file*/);
+   scrn_gamma = translate_gamma_flags(scrn_gamma, 1/*screen*/);
+   file_gamma = translate_gamma_flags(file_gamma, 0/*file*/);
 
    /* Checking the gamma values for being >0 was added in 1.5.4 along with the
     * premultiplied alpha support; this actually hides an undocumented feature
@@ -863,17 +920,19 @@ png_set_gamma_fixed(png_structrp png_ptr, png_fixed_point scrn_gamma,
     * libpng-1.6.0.
     */
    if (file_gamma <= 0)
-      png_error(png_ptr, "invalid file gamma in png_set_gamma");
-
+      png_app_error(png_ptr, "invalid file gamma in png_set_gamma");
    if (scrn_gamma <= 0)
-      png_error(png_ptr, "invalid screen gamma in png_set_gamma");
+      png_app_error(png_ptr, "invalid screen gamma in png_set_gamma");
 
-   /* Set the gamma values unconditionally - this overrides the value in the PNG
-    * file if a gAMA chunk was present.  png_set_alpha_mode provides a
-    * different, easier, way to default the file gamma.
+   if (unsupported_gamma(png_ptr, file_gamma, 1/*warn*/) ||
+       unsupported_gamma(png_ptr, scrn_gamma, 1/*warn*/))
+      return;
+
+   /* 1.6.47: png_struct::file_gamma and png_struct::screen_gamma are now only
+    * written by this API.  This removes dependencies on the order of API calls
+    * and allows the complex gamma checks to be delayed until needed.
     */
-   png_ptr->colorspace.gamma = file_gamma;
-   png_ptr->colorspace.flags |= PNG_COLORSPACE_HAVE_GAMMA;
+   png_ptr->file_gamma = file_gamma;
    png_ptr->screen_gamma = scrn_gamma;
 }
 
@@ -1051,26 +1110,9 @@ png_set_rgb_to_gray_fixed(png_structrp png_ptr, int error_action,
          png_ptr->rgb_to_gray_coefficients_set = 1;
       }
 
-      else
-      {
-         if (red >= 0 && green >= 0)
-            png_app_warning(png_ptr,
-                "ignoring out of range rgb_to_gray coefficients");
-
-         /* Use the defaults, from the cHRM chunk if set, else the historical
-          * values which are close to the sRGB/HDTV/ITU-Rec 709 values.  See
-          * png_do_rgb_to_gray for more discussion of the values.  In this case
-          * the coefficients are not marked as 'set' and are not overwritten if
-          * something has already provided a default.
-          */
-         if (png_ptr->rgb_to_gray_red_coeff == 0 &&
-             png_ptr->rgb_to_gray_green_coeff == 0)
-         {
-            png_ptr->rgb_to_gray_red_coeff   = 6968;
-            png_ptr->rgb_to_gray_green_coeff = 23434;
-            /* png_ptr->rgb_to_gray_blue_coeff  = 2366; */
-         }
-      }
+      else if (red >= 0 && green >= 0)
+         png_app_warning(png_ptr,
+               "ignoring out of range rgb_to_gray coefficients");
    }
 }
 
@@ -1311,6 +1353,80 @@ png_init_rgb_transformations(png_structrp png_ptr)
 #endif /* READ_EXPAND && READ_BACKGROUND */
 }
 
+#ifdef PNG_READ_GAMMA_SUPPORTED
+png_fixed_point /* PRIVATE */
+png_resolve_file_gamma(png_const_structrp png_ptr)
+{
+   png_fixed_point file_gamma;
+
+   /* The file gamma is determined by these precedence rules, in this order
+    * (i.e. use the first value found):
+    *
+    *    png_set_gamma; png_struct::file_gammma if not zero, then:
+    *    png_struct::chunk_gamma if not 0 (determined the PNGv3 rules), then:
+    *    png_set_gamma; 1/png_struct::screen_gamma if not zero
+    *
+    *    0 (i.e. do no gamma handling)
+    */
+   file_gamma = png_ptr->file_gamma;
+   if (file_gamma != 0)
+      return file_gamma;
+
+   file_gamma = png_ptr->chunk_gamma;
+   if (file_gamma != 0)
+      return file_gamma;
+
+   file_gamma = png_ptr->default_gamma;
+   if (file_gamma != 0)
+      return file_gamma;
+
+   /* If png_reciprocal oveflows it returns 0 which indicates to the caller that
+    * there is no usable file gamma.  (The checks added to png_set_gamma and
+    * png_set_alpha_mode should prevent a screen_gamma which would overflow.)
+    */
+   if (png_ptr->screen_gamma != 0)
+      file_gamma = png_reciprocal(png_ptr->screen_gamma);
+
+   return file_gamma;
+}
+
+static int
+png_init_gamma_values(png_structrp png_ptr)
+{
+   /* The following temporary indicates if overall gamma correction is
+    * required.
+    */
+   int gamma_correction = 0;
+   png_fixed_point file_gamma, screen_gamma;
+
+   /* Resolve the file_gamma.  See above: if png_ptr::screen_gamma is set
+    * file_gamma will always be set here:
+    */
+   file_gamma = png_resolve_file_gamma(png_ptr);
+   screen_gamma = png_ptr->screen_gamma;
+
+   if (file_gamma > 0) /* file has been set */
+   {
+      if (screen_gamma > 0) /* screen set too */
+         gamma_correction = png_gamma_threshold(file_gamma, screen_gamma);
+
+      else
+         /* Assume the output matches the input; a long time default behavior
+          * of libpng, although the standard has nothing to say about this.
+          */
+         screen_gamma = png_reciprocal(file_gamma);
+   }
+
+   else /* both unset, prevent corrections: */
+      file_gamma = screen_gamma = PNG_FP_1;
+
+   png_ptr->file_gamma = file_gamma;
+   png_ptr->screen_gamma = screen_gamma;
+   return gamma_correction;
+
+}
+#endif /* READ_GAMMA */
+
 void /* PRIVATE */
 png_init_read_transformations(png_structrp png_ptr)
 {
@@ -1330,59 +1446,22 @@ png_init_read_transformations(png_structrp png_ptr)
     * the test needs to be performed later - here.  In addition prior to 1.5.4
     * the tests were repeated for the PALETTE color type here - this is no
     * longer necessary (and doesn't seem to have been necessary before.)
+    *
+    * PNGv3: the new mandatory precedence/priority rules for colour space chunks
+    * are handled here (by calling the above function).
+    *
+    * Turn the gamma transformation on or off as appropriate.  Notice that
+    * PNG_GAMMA just refers to the file->screen correction.  Alpha composition
+    * may independently cause gamma correction because it needs linear data
+    * (e.g. if the file has a gAMA chunk but the screen gamma hasn't been
+    * specified.)  In any case this flag may get turned off in the code
+    * immediately below if the transform can be handled outside the row loop.
     */
-   {
-      /* The following temporary indicates if overall gamma correction is
-       * required.
-       */
-      int gamma_correction = 0;
+   if (png_init_gamma_values(png_ptr) != 0)
+      png_ptr->transformations |= PNG_GAMMA;
 
-      if (png_ptr->colorspace.gamma != 0) /* has been set */
-      {
-         if (png_ptr->screen_gamma != 0) /* screen set too */
-            gamma_correction = png_gamma_threshold(png_ptr->colorspace.gamma,
-                png_ptr->screen_gamma);
-
-         else
-            /* Assume the output matches the input; a long time default behavior
-             * of libpng, although the standard has nothing to say about this.
-             */
-            png_ptr->screen_gamma = png_reciprocal(png_ptr->colorspace.gamma);
-      }
-
-      else if (png_ptr->screen_gamma != 0)
-         /* The converse - assume the file matches the screen, note that this
-          * perhaps undesirable default can (from 1.5.4) be changed by calling
-          * png_set_alpha_mode (even if the alpha handling mode isn't required
-          * or isn't changed from the default.)
-          */
-         png_ptr->colorspace.gamma = png_reciprocal(png_ptr->screen_gamma);
-
-      else /* neither are set */
-         /* Just in case the following prevents any processing - file and screen
-          * are both assumed to be linear and there is no way to introduce a
-          * third gamma value other than png_set_background with 'UNIQUE', and,
-          * prior to 1.5.4
-          */
-         png_ptr->screen_gamma = png_ptr->colorspace.gamma = PNG_FP_1;
-
-      /* We have a gamma value now. */
-      png_ptr->colorspace.flags |= PNG_COLORSPACE_HAVE_GAMMA;
-
-      /* Now turn the gamma transformation on or off as appropriate.  Notice
-       * that PNG_GAMMA just refers to the file->screen correction.  Alpha
-       * composition may independently cause gamma correction because it needs
-       * linear data (e.g. if the file has a gAMA chunk but the screen gamma
-       * hasn't been specified.)  In any case this flag may get turned off in
-       * the code immediately below if the transform can be handled outside the
-       * row loop.
-       */
-      if (gamma_correction != 0)
-         png_ptr->transformations |= PNG_GAMMA;
-
-      else
-         png_ptr->transformations &= ~PNG_GAMMA;
-   }
+   else
+      png_ptr->transformations &= ~PNG_GAMMA;
 #endif
 
    /* Certain transformations have the effect of preventing other
@@ -1454,7 +1533,7 @@ png_init_read_transformations(png_structrp png_ptr)
     * appropriately.
     */
    if ((png_ptr->transformations & PNG_RGB_TO_GRAY) != 0)
-      png_colorspace_set_rgb_coefficients(png_ptr);
+      png_set_rgb_coefficients(png_ptr);
 #endif
 
 #ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
@@ -1597,10 +1676,10 @@ png_init_read_transformations(png_structrp png_ptr)
     */
    if ((png_ptr->transformations & PNG_GAMMA) != 0 ||
        ((png_ptr->transformations & PNG_RGB_TO_GRAY) != 0 &&
-        (png_gamma_significant(png_ptr->colorspace.gamma) != 0 ||
+        (png_gamma_significant(png_ptr->file_gamma) != 0 ||
          png_gamma_significant(png_ptr->screen_gamma) != 0)) ||
         ((png_ptr->transformations & PNG_COMPOSE) != 0 &&
-         (png_gamma_significant(png_ptr->colorspace.gamma) != 0 ||
+         (png_gamma_significant(png_ptr->file_gamma) != 0 ||
           png_gamma_significant(png_ptr->screen_gamma) != 0
 #  ifdef PNG_READ_BACKGROUND_SUPPORTED
          || (png_ptr->background_gamma_type == PNG_BACKGROUND_GAMMA_UNIQUE &&
@@ -1656,8 +1735,8 @@ png_init_read_transformations(png_structrp png_ptr)
                      break;
 
                   case PNG_BACKGROUND_GAMMA_FILE:
-                     g = png_reciprocal(png_ptr->colorspace.gamma);
-                     gs = png_reciprocal2(png_ptr->colorspace.gamma,
+                     g = png_reciprocal(png_ptr->file_gamma);
+                     gs = png_reciprocal2(png_ptr->file_gamma,
                          png_ptr->screen_gamma);
                      break;
 
@@ -1765,8 +1844,8 @@ png_init_read_transformations(png_structrp png_ptr)
                   break;
 
                case PNG_BACKGROUND_GAMMA_FILE:
-                  g = png_reciprocal(png_ptr->colorspace.gamma);
-                  gs = png_reciprocal2(png_ptr->colorspace.gamma,
+                  g = png_reciprocal(png_ptr->file_gamma);
+                  gs = png_reciprocal2(png_ptr->file_gamma,
                       png_ptr->screen_gamma);
                   break;
 
@@ -2016,11 +2095,11 @@ png_read_transform_info(png_structrp png_ptr, png_inforp info_ptr)
     * been called before this from png_read_update_info->png_read_start_row
     * sometimes does the gamma transform and cancels the flag.
     *
-    * TODO: this looks wrong; the info_ptr should end up with a gamma equal to
-    * the screen_gamma value.  The following probably results in weirdness if
-    * the info_ptr is used by the app after the rows have been read.
+    * TODO: this is confusing.  It only changes the result of png_get_gAMA and,
+    * yes, it does return the value that the transformed data effectively has
+    * but does any app really understand this?
     */
-   info_ptr->colorspace.gamma = png_ptr->colorspace.gamma;
+   info_ptr->gamma = png_ptr->file_gamma;
 #endif
 
    if (info_ptr->bit_depth == 16)
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/pngrutil.c b/src/java.desktop/share/native/libsplashscreen/libpng/pngrutil.c
index 5280140d12bc..6cf466d182ab 100644
--- a/src/java.desktop/share/native/libsplashscreen/libpng/pngrutil.c
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/pngrutil.c
@@ -46,6 +46,26 @@
 
 #ifdef PNG_READ_SUPPORTED
 
+/* The minimum 'zlib' stream is assumed to be just the 2 byte header, 5 bytes
+ * minimum 'deflate' stream, and the 4 byte checksum.
+ */
+#define LZ77Min  (2U+5U+4U)
+
+#ifdef PNG_READ_INTERLACING_SUPPORTED
+/* Arrays to facilitate interlacing - use pass (0 - 6) as index. */
+
+/* Start of interlace block */
+static const png_byte png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};
+/* Offset to next interlace block */
+static const png_byte png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
+/* Start of interlace block in the y direction */
+static const png_byte png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1};
+/* Offset to next interlace block in the y direction */
+static const png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
+
+/* TODO: Move these arrays to a common utility module to avoid duplication. */
+#endif
+
 png_uint_32 PNGAPI
 png_get_uint_31(png_const_structrp png_ptr, png_const_bytep buf)
 {
@@ -57,30 +77,6 @@ png_get_uint_31(png_const_structrp png_ptr, png_const_bytep buf)
    return uval;
 }
 
-#if defined(PNG_READ_gAMA_SUPPORTED) || defined(PNG_READ_cHRM_SUPPORTED)
-/* The following is a variation on the above for use with the fixed
- * point values used for gAMA and cHRM.  Instead of png_error it
- * issues a warning and returns (-1) - an invalid value because both
- * gAMA and cHRM use *unsigned* integers for fixed point values.
- */
-#define PNG_FIXED_ERROR (-1)
-
-static png_fixed_point /* PRIVATE */
-png_get_fixed_point(png_structrp png_ptr, png_const_bytep buf)
-{
-   png_uint_32 uval = png_get_uint_32(buf);
-
-   if (uval <= PNG_UINT_31_MAX)
-      return (png_fixed_point)uval; /* known to be in range */
-
-   /* The caller can turn off the warning by passing NULL. */
-   if (png_ptr != NULL)
-      png_warning(png_ptr, "PNG fixed point integer out of range");
-
-   return PNG_FIXED_ERROR;
-}
-#endif
-
 #ifdef PNG_READ_INT_FUNCTIONS_SUPPORTED
 /* NOTE: the read macros will obscure these definitions, so that if
  * PNG_USE_READ_MACROS is set the library will not use them internally,
@@ -177,6 +173,38 @@ png_read_sig(png_structrp png_ptr, png_inforp info_ptr)
       png_ptr->mode |= PNG_HAVE_PNG_SIGNATURE;
 }
 
+/* This function is called to verify that a chunk name is valid.
+ * Do this using the bit-whacking approach from contrib/tools/pngfix.c
+ *
+ * Copied from libpng 1.7.
+ */
+static int
+check_chunk_name(png_uint_32 name)
+{
+   png_uint_32 t;
+
+   /* Remove bit 5 from all but the reserved byte; this means
+    * every 8-bit unit must be in the range 65-90 to be valid.
+    * So bit 5 must be zero, bit 6 must be set and bit 7 zero.
+    */
+   name &= ~PNG_U32(32,32,0,32);
+   t = (name & ~0x1f1f1f1fU) ^ 0x40404040U;
+
+   /* Subtract 65 for each 8-bit quantity, this must not
+    * overflow and each byte must then be in the range 0-25.
+    */
+   name -= PNG_U32(65,65,65,65);
+   t |= name;
+
+   /* Subtract 26, handling the overflow which should set the
+    * top three bits of each byte.
+    */
+   name -= PNG_U32(25,25,25,26);
+   t |= ~name;
+
+   return (t & 0xe0e0e0e0U) == 0U;
+}
+
 /* Read the chunk header (length + type name).
  * Put the type name into png_ptr->chunk_name, and return the length.
  */
@@ -184,33 +212,36 @@ png_uint_32 /* PRIVATE */
 png_read_chunk_header(png_structrp png_ptr)
 {
    png_byte buf[8];
-   png_uint_32 length;
+   png_uint_32 chunk_name, length;
 
 #ifdef PNG_IO_STATE_SUPPORTED
    png_ptr->io_state = PNG_IO_READING | PNG_IO_CHUNK_HDR;
 #endif
 
-   /* Read the length and the chunk name.
-    * This must be performed in a single I/O call.
+   /* Read the length and the chunk name.  png_struct::chunk_name is immediately
+    * updated even if they are detectably wrong.  This aids error message
+    * handling by allowing png_chunk_error to be used.
     */
    png_read_data(png_ptr, buf, 8);
    length = png_get_uint_31(png_ptr, buf);
+   png_ptr->chunk_name = chunk_name = PNG_CHUNK_FROM_STRING(buf+4);
 
-   /* Put the chunk name into png_ptr->chunk_name. */
-   png_ptr->chunk_name = PNG_CHUNK_FROM_STRING(buf+4);
+   /* Reset the crc and run it over the chunk name. */
+   png_reset_crc(png_ptr);
+   png_calculate_crc(png_ptr, buf + 4, 4);
 
    png_debug2(0, "Reading chunk typeid = 0x%lx, length = %lu",
        (unsigned long)png_ptr->chunk_name, (unsigned long)length);
 
-   /* Reset the crc and run it over the chunk name. */
-   png_reset_crc(png_ptr);
-   png_calculate_crc(png_ptr, buf + 4, 4);
+   /* Sanity check the length (first by <= 0x80) and the chunk name.  An error
+    * here indicates a broken stream and libpng has no recovery from this.
+    */
+   if (buf[0] >= 0x80U)
+      png_chunk_error(png_ptr, "bad header (invalid length)");
 
    /* Check to see if chunk name is valid. */
-   png_check_chunk_name(png_ptr, png_ptr->chunk_name);
-
-   /* Check for too-large chunk length */
-   png_check_chunk_length(png_ptr, length);
+   if (!check_chunk_name(chunk_name))
+      png_chunk_error(png_ptr, "bad header (invalid type)");
 
 #ifdef PNG_IO_STATE_SUPPORTED
    png_ptr->io_state = PNG_IO_READING | PNG_IO_CHUNK_DATA;
@@ -230,13 +261,85 @@ png_crc_read(png_structrp png_ptr, png_bytep buf, png_uint_32 length)
    png_calculate_crc(png_ptr, buf, length);
 }
 
+/* Compare the CRC stored in the PNG file with that calculated by libpng from
+ * the data it has read thus far.
+ */
+static int
+png_crc_error(png_structrp png_ptr, int handle_as_ancillary)
+{
+   png_byte crc_bytes[4];
+   png_uint_32 crc;
+   int need_crc = 1;
+
+   /* There are four flags two for ancillary and two for critical chunks.  The
+    * default setting of these flags is all zero.
+    *
+    * PNG_FLAG_CRC_ANCILLARY_USE
+    * PNG_FLAG_CRC_ANCILLARY_NOWARN
+    *  USE+NOWARN: no CRC calculation (implemented here), else;
+    *  NOWARN:     png_chunk_error on error (implemented in png_crc_finish)
+    *  else:       png_chunk_warning on error (implemented in png_crc_finish)
+    *              This is the default.
+    *
+    *    I.e. NOWARN without USE produces png_chunk_error.  The default setting
+    *    where neither are set does the same thing.
+    *
+    * PNG_FLAG_CRC_CRITICAL_USE
+    * PNG_FLAG_CRC_CRITICAL_IGNORE
+    *  IGNORE: no CRC calculation (implemented here), else;
+    *  USE:    png_chunk_warning on error (implemented in png_crc_finish)
+    *  else:   png_chunk_error on error (implemented in png_crc_finish)
+    *          This is the default.
+    *
+    * This arose because of original mis-implementation and has persisted for
+    * compatibility reasons.
+    *
+    * TODO: the flag names are internal so maybe this can be changed to
+    * something comprehensible.
+    */
+   if (handle_as_ancillary || PNG_CHUNK_ANCILLARY(png_ptr->chunk_name) != 0)
+   {
+      if ((png_ptr->flags & PNG_FLAG_CRC_ANCILLARY_MASK) ==
+          (PNG_FLAG_CRC_ANCILLARY_USE | PNG_FLAG_CRC_ANCILLARY_NOWARN))
+         need_crc = 0;
+   }
+
+   else /* critical */
+   {
+      if ((png_ptr->flags & PNG_FLAG_CRC_CRITICAL_IGNORE) != 0)
+         need_crc = 0;
+   }
+
+#ifdef PNG_IO_STATE_SUPPORTED
+   png_ptr->io_state = PNG_IO_READING | PNG_IO_CHUNK_CRC;
+#endif
+
+   /* The chunk CRC must be serialized in a single I/O call. */
+   png_read_data(png_ptr, crc_bytes, 4);
+
+   if (need_crc != 0)
+   {
+      crc = png_get_uint_32(crc_bytes);
+      return crc != png_ptr->crc;
+   }
+
+   else
+      return 0;
+}
+
 /* Optionally skip data and then check the CRC.  Depending on whether we
  * are reading an ancillary or critical chunk, and how the program has set
  * things up, we may calculate the CRC on the data and print a message.
  * Returns '1' if there was a CRC error, '0' otherwise.
+ *
+ * There is one public version which is used in most places and another which
+ * takes the value for the 'critical' flag to check.  This allows PLTE and IEND
+ * handling code to ignore the CRC error and removes some confusing code
+ * duplication.
  */
-int /* PRIVATE */
-png_crc_finish(png_structrp png_ptr, png_uint_32 skip)
+static int
+png_crc_finish_critical(png_structrp png_ptr, png_uint_32 skip,
+      int handle_as_ancillary)
 {
    /* The size of the local buffer for inflate is a good guess as to a
     * reasonable size to use for buffering reads from the application.
@@ -254,14 +357,24 @@ png_crc_finish(png_structrp png_ptr, png_uint_32 skip)
       png_crc_read(png_ptr, tmpbuf, len);
    }
 
-   if (png_crc_error(png_ptr) != 0)
+   /* If 'handle_as_ancillary' has been requested and this is a critical chunk
+    * but PNG_FLAG_CRC_CRITICAL_IGNORE was set then png_read_crc did not, in
+    * fact, calculate the CRC so the ANCILLARY settings should not be used
+    * instead.
+    */
+   if (handle_as_ancillary &&
+       (png_ptr->flags & PNG_FLAG_CRC_CRITICAL_IGNORE) != 0)
+      handle_as_ancillary = 0;
+
+   /* TODO: this might be more comprehensible if png_crc_error was inlined here.
+    */
+   if (png_crc_error(png_ptr, handle_as_ancillary) != 0)
    {
-      if (PNG_CHUNK_ANCILLARY(png_ptr->chunk_name) != 0 ?
+      /* See above for the explanation of how the flags work. */
+      if (handle_as_ancillary || PNG_CHUNK_ANCILLARY(png_ptr->chunk_name) != 0 ?
           (png_ptr->flags & PNG_FLAG_CRC_ANCILLARY_NOWARN) == 0 :
           (png_ptr->flags & PNG_FLAG_CRC_CRITICAL_USE) != 0)
-      {
          png_chunk_warning(png_ptr, "CRC error");
-      }
 
       else
          png_chunk_error(png_ptr, "CRC error");
@@ -272,61 +385,29 @@ png_crc_finish(png_structrp png_ptr, png_uint_32 skip)
    return 0;
 }
 
-/* Compare the CRC stored in the PNG file with that calculated by libpng from
- * the data it has read thus far.
- */
 int /* PRIVATE */
-png_crc_error(png_structrp png_ptr)
+png_crc_finish(png_structrp png_ptr, png_uint_32 skip)
 {
-   png_byte crc_bytes[4];
-   png_uint_32 crc;
-   int need_crc = 1;
-
-   if (PNG_CHUNK_ANCILLARY(png_ptr->chunk_name) != 0)
-   {
-      if ((png_ptr->flags & PNG_FLAG_CRC_ANCILLARY_MASK) ==
-          (PNG_FLAG_CRC_ANCILLARY_USE | PNG_FLAG_CRC_ANCILLARY_NOWARN))
-         need_crc = 0;
-   }
-
-   else /* critical */
-   {
-      if ((png_ptr->flags & PNG_FLAG_CRC_CRITICAL_IGNORE) != 0)
-         need_crc = 0;
-   }
-
-#ifdef PNG_IO_STATE_SUPPORTED
-   png_ptr->io_state = PNG_IO_READING | PNG_IO_CHUNK_CRC;
-#endif
-
-   /* The chunk CRC must be serialized in a single I/O call. */
-   png_read_data(png_ptr, crc_bytes, 4);
-
-   if (need_crc != 0)
-   {
-      crc = png_get_uint_32(crc_bytes);
-      return crc != png_ptr->crc;
-   }
-
-   else
-      return 0;
+   return png_crc_finish_critical(png_ptr, skip, 0/*critical handling*/);
 }
 
 #if defined(PNG_READ_iCCP_SUPPORTED) || defined(PNG_READ_iTXt_SUPPORTED) ||\
     defined(PNG_READ_pCAL_SUPPORTED) || defined(PNG_READ_sCAL_SUPPORTED) ||\
     defined(PNG_READ_sPLT_SUPPORTED) || defined(PNG_READ_tEXt_SUPPORTED) ||\
-    defined(PNG_READ_zTXt_SUPPORTED) || defined(PNG_SEQUENTIAL_READ_SUPPORTED)
+    defined(PNG_READ_zTXt_SUPPORTED) || defined(PNG_READ_eXIf_SUPPORTED) ||\
+    defined(PNG_SEQUENTIAL_READ_SUPPORTED)
 /* Manage the read buffer; this simply reallocates the buffer if it is not small
  * enough (or if it is not allocated).  The routine returns a pointer to the
  * buffer; if an error occurs and 'warn' is set the routine returns NULL, else
- * it will call png_error (via png_malloc) on failure.  (warn == 2 means
- * 'silent').
+ * it will call png_error on failure.
  */
 static png_bytep
-png_read_buffer(png_structrp png_ptr, png_alloc_size_t new_size, int warn)
+png_read_buffer(png_structrp png_ptr, png_alloc_size_t new_size)
 {
    png_bytep buffer = png_ptr->read_buffer;
 
+   if (new_size > png_chunk_max(png_ptr)) return NULL;
+
    if (buffer != NULL && new_size > png_ptr->read_buffer_size)
    {
       png_ptr->read_buffer = NULL;
@@ -341,24 +422,17 @@ png_read_buffer(png_structrp png_ptr, png_alloc_size_t new_size, int warn)
 
       if (buffer != NULL)
       {
-         memset(buffer, 0, new_size); /* just in case */
+#        ifndef PNG_NO_MEMZERO /* for detecting UIM bugs **only** */
+            memset(buffer, 0, new_size); /* just in case */
+#        endif
          png_ptr->read_buffer = buffer;
          png_ptr->read_buffer_size = new_size;
       }
-
-      else if (warn < 2) /* else silent */
-      {
-         if (warn != 0)
-             png_chunk_warning(png_ptr, "insufficient memory to read chunk");
-
-         else
-             png_chunk_error(png_ptr, "insufficient memory to read chunk");
-      }
    }
 
    return buffer;
 }
-#endif /* READ_iCCP|iTXt|pCAL|sCAL|sPLT|tEXt|zTXt|SEQUENTIAL_READ */
+#endif /* READ_iCCP|iTXt|pCAL|sCAL|sPLT|tEXt|zTXt|eXIf|SEQUENTIAL_READ */
 
 /* png_inflate_claim: claim the zstream for some nefarious purpose that involves
  * decompression.  Returns Z_OK on success, else a zlib error code.  It checks
@@ -645,16 +719,7 @@ png_decompress_chunk(png_structrp png_ptr,
     * maybe a '\0' terminator too.  We have to assume that 'prefix_size' is
     * limited only by the maximum chunk size.
     */
-   png_alloc_size_t limit = PNG_SIZE_MAX;
-
-# ifdef PNG_SET_USER_LIMITS_SUPPORTED
-   if (png_ptr->user_chunk_malloc_max > 0 &&
-       png_ptr->user_chunk_malloc_max < limit)
-      limit = png_ptr->user_chunk_malloc_max;
-# elif PNG_USER_CHUNK_MALLOC_MAX > 0
-   if (PNG_USER_CHUNK_MALLOC_MAX < limit)
-      limit = PNG_USER_CHUNK_MALLOC_MAX;
-# endif
+   png_alloc_size_t limit = png_chunk_max(png_ptr);
 
    if (limit >= prefix_size + (terminate != 0))
    {
@@ -859,9 +924,9 @@ png_inflate_read(png_structrp png_ptr, png_bytep read_buffer, uInt read_size,
 }
 #endif /* READ_iCCP */
 
+/* CHUNK HANDLING */
 /* Read and check the IDHR chunk */
-
-void /* PRIVATE */
+static png_handle_result_code
 png_handle_IHDR(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
 {
    png_byte buf[13];
@@ -871,12 +936,7 @@ png_handle_IHDR(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
 
    png_debug(1, "in png_handle_IHDR");
 
-   if ((png_ptr->mode & PNG_HAVE_IHDR) != 0)
-      png_chunk_error(png_ptr, "out of place");
-
-   /* Check the length */
-   if (length != 13)
-      png_chunk_error(png_ptr, "invalid");
+   /* Length and position are checked by the caller. */
 
    png_ptr->mode |= PNG_HAVE_IHDR;
 
@@ -930,257 +990,196 @@ png_handle_IHDR(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
    png_debug1(3, "bit_depth = %d", png_ptr->bit_depth);
    png_debug1(3, "channels = %d", png_ptr->channels);
    png_debug1(3, "rowbytes = %lu", (unsigned long)png_ptr->rowbytes);
+
+   /* Rely on png_set_IHDR to completely validate the data and call png_error if
+    * it's wrong.
+    */
    png_set_IHDR(png_ptr, info_ptr, width, height, bit_depth,
        color_type, interlace_type, compression_type, filter_type);
+
+   return handled_ok;
+   PNG_UNUSED(length)
 }
 
 /* Read and check the palette */
-void /* PRIVATE */
+/* TODO: there are several obvious errors in this code when handling
+ * out-of-place chunks and there is much over-complexity caused by trying to
+ * patch up the problems.
+ */
+static png_handle_result_code
 png_handle_PLTE(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
 {
-   png_color palette[PNG_MAX_PALETTE_LENGTH];
-   int max_palette_length, num, i;
-#ifdef PNG_POINTER_INDEXING_SUPPORTED
-   png_colorp pal_ptr;
-#endif
+   png_const_charp errmsg = NULL;
 
    png_debug(1, "in png_handle_PLTE");
 
-   if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
-      png_chunk_error(png_ptr, "missing IHDR");
-
-   /* Moved to before the 'after IDAT' check below because otherwise duplicate
-    * PLTE chunks are potentially ignored (the spec says there shall not be more
-    * than one PLTE, the error is not treated as benign, so this check trumps
-    * the requirement that PLTE appears before IDAT.)
+   /* 1.6.47: consistency.  This used to be especially treated as a critical
+    * error even in an image which is not colour mapped, there isn't a good
+    * justification for treating some errors here one way and others another so
+    * everything uses the same logic.
     */
-   else if ((png_ptr->mode & PNG_HAVE_PLTE) != 0)
-      png_chunk_error(png_ptr, "duplicate");
+   if ((png_ptr->mode & PNG_HAVE_PLTE) != 0)
+      errmsg = "duplicate";
 
    else if ((png_ptr->mode & PNG_HAVE_IDAT) != 0)
-   {
-      /* This is benign because the non-benign error happened before, when an
-       * IDAT was encountered in a color-mapped image with no PLTE.
-       */
-      png_crc_finish(png_ptr, length);
-      png_chunk_benign_error(png_ptr, "out of place");
-      return;
-   }
+      errmsg = "out of place";
 
-   png_ptr->mode |= PNG_HAVE_PLTE;
+   else if ((png_ptr->color_type & PNG_COLOR_MASK_COLOR) == 0)
+      errmsg = "ignored in grayscale PNG";
 
-   if ((png_ptr->color_type & PNG_COLOR_MASK_COLOR) == 0)
-   {
-      png_crc_finish(png_ptr, length);
-      png_chunk_benign_error(png_ptr, "ignored in grayscale PNG");
-      return;
-   }
+   else if (length > 3*PNG_MAX_PALETTE_LENGTH || (length % 3) != 0)
+      errmsg = "invalid";
 
-#ifndef PNG_READ_OPT_PLTE_SUPPORTED
-   if (png_ptr->color_type != PNG_COLOR_TYPE_PALETTE)
-   {
-      png_crc_finish(png_ptr, length);
-      return;
-   }
-#endif
+   /* This drops PLTE in favour of tRNS or bKGD because both of those chunks
+    * can have an effect on the rendering of the image whereas PLTE only matters
+    * in the case of an 8-bit display with a decoder which controls the palette.
+    *
+    * The alternative here is to ignore the error and store the palette anyway;
+    * destroying the tRNS will definately cause problems.
+    *
+    * NOTE: the case of PNG_COLOR_TYPE_PALETTE need not be considered because
+    * the png_handle_ routines for the three 'after PLTE' chunks tRNS, bKGD and
+    * hIST all check for a preceding PLTE in these cases.
+    */
+   else if (png_ptr->color_type != PNG_COLOR_TYPE_PALETTE &&
+            (png_has_chunk(png_ptr, tRNS) || png_has_chunk(png_ptr, bKGD)))
+      errmsg = "out of place";
 
-   if (length > 3*PNG_MAX_PALETTE_LENGTH || length % 3)
+   else
    {
-      png_crc_finish(png_ptr, length);
-
-      if (png_ptr->color_type != PNG_COLOR_TYPE_PALETTE)
-         png_chunk_benign_error(png_ptr, "invalid");
-
-      else
-         png_chunk_error(png_ptr, "invalid");
+      /* If the palette has 256 or fewer entries but is too large for the bit
+       * depth we don't issue an error to preserve the behavior of previous
+       * libpng versions. We silently truncate the unused extra palette entries
+       * here.
+       */
+      const unsigned max_palette_length =
+         (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) ?
+            1U << png_ptr->bit_depth : PNG_MAX_PALETTE_LENGTH;
 
-      return;
-   }
+      /* The cast is safe because 'length' is less than
+       * 3*PNG_MAX_PALETTE_LENGTH
+       */
+      const unsigned num = (length > 3U*max_palette_length) ?
+         max_palette_length : (unsigned)length / 3U;
 
-   /* The cast is safe because 'length' is less than 3*PNG_MAX_PALETTE_LENGTH */
-   num = (int)length / 3;
+      unsigned i, j;
+      png_byte buf[3*PNG_MAX_PALETTE_LENGTH];
+      png_color palette[PNG_MAX_PALETTE_LENGTH];
 
-   /* If the palette has 256 or fewer entries but is too large for the bit
-    * depth, we don't issue an error, to preserve the behavior of previous
-    * libpng versions. We silently truncate the unused extra palette entries
-    * here.
-    */
-   if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
-      max_palette_length = (1 << png_ptr->bit_depth);
-   else
-      max_palette_length = PNG_MAX_PALETTE_LENGTH;
+      /* Read the chunk into the buffer then read to the end of the chunk. */
+      png_crc_read(png_ptr, buf, num*3U);
+      png_crc_finish_critical(png_ptr, length - 3U*num,
+            /* Handle as ancillary if PLTE is optional: */
+            png_ptr->color_type != PNG_COLOR_TYPE_PALETTE);
 
-   if (num > max_palette_length)
-      num = max_palette_length;
+      for (i = 0U, j = 0U; i < num; i++)
+      {
+         palette[i].red = buf[j++];
+         palette[i].green = buf[j++];
+         palette[i].blue = buf[j++];
+      }
 
-#ifdef PNG_POINTER_INDEXING_SUPPORTED
-   for (i = 0, pal_ptr = palette; i < num; i++, pal_ptr++)
-   {
-      png_byte buf[3];
+      /* A valid PLTE chunk has been read */
+      png_ptr->mode |= PNG_HAVE_PLTE;
 
-      png_crc_read(png_ptr, buf, 3);
-      pal_ptr->red = buf[0];
-      pal_ptr->green = buf[1];
-      pal_ptr->blue = buf[2];
+      /* TODO: png_set_PLTE has the side effect of setting png_ptr->palette to
+       * its own copy of the palette.  This has the side effect that when
+       * png_start_row is called (this happens after any call to
+       * png_read_update_info) the info_ptr palette gets changed.  This is
+       * extremely unexpected and confusing.
+       *
+       * REVIEW: there have been consistent bugs in the past about gamma and
+       * similar transforms to colour mapped images being useless because the
+       * modified palette cannot be accessed because of the above.
+       *
+       * CONSIDER: Fix this by not sharing the palette in this way.  But does
+       * this completely fix the problem?
+       */
+      png_set_PLTE(png_ptr, info_ptr, palette, num);
+      return handled_ok;
    }
-#else
-   for (i = 0; i < num; i++)
-   {
-      png_byte buf[3];
 
-      png_crc_read(png_ptr, buf, 3);
-      /* Don't depend upon png_color being any order */
-      palette[i].red = buf[0];
-      palette[i].green = buf[1];
-      palette[i].blue = buf[2];
-   }
-#endif
-
-   /* If we actually need the PLTE chunk (ie for a paletted image), we do
-    * whatever the normal CRC configuration tells us.  However, if we
-    * have an RGB image, the PLTE can be considered ancillary, so
-    * we will act as though it is.
-    */
-#ifndef PNG_READ_OPT_PLTE_SUPPORTED
+   /* Here on error: errmsg is non NULL. */
    if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
-#endif
    {
-      png_crc_finish(png_ptr, (png_uint_32) (length - (unsigned int)num * 3));
+      png_crc_finish(png_ptr, length);
+      png_chunk_error(png_ptr, errmsg);
    }
 
-#ifndef PNG_READ_OPT_PLTE_SUPPORTED
-   else if (png_crc_error(png_ptr) != 0)  /* Only if we have a CRC error */
+   else /* not critical to this image */
    {
-      /* If we don't want to use the data from an ancillary chunk,
-       * we have two options: an error abort, or a warning and we
-       * ignore the data in this chunk (which should be OK, since
-       * it's considered ancillary for a RGB or RGBA image).
-       *
-       * IMPLEMENTATION NOTE: this is only here because png_crc_finish uses the
-       * chunk type to determine whether to check the ancillary or the critical
-       * flags.
-       */
-      if ((png_ptr->flags & PNG_FLAG_CRC_ANCILLARY_USE) == 0)
-      {
-         if ((png_ptr->flags & PNG_FLAG_CRC_ANCILLARY_NOWARN) != 0)
-            return;
-
-         else
-            png_chunk_error(png_ptr, "CRC error");
-      }
-
-      /* Otherwise, we (optionally) emit a warning and use the chunk. */
-      else if ((png_ptr->flags & PNG_FLAG_CRC_ANCILLARY_NOWARN) == 0)
-         png_chunk_warning(png_ptr, "CRC error");
+      png_crc_finish_critical(png_ptr, length, 1/*handle as ancillary*/);
+      png_chunk_benign_error(png_ptr, errmsg);
    }
-#endif
 
-   /* TODO: png_set_PLTE has the side effect of setting png_ptr->palette to its
-    * own copy of the palette.  This has the side effect that when png_start_row
-    * is called (this happens after any call to png_read_update_info) the
-    * info_ptr palette gets changed.  This is extremely unexpected and
-    * confusing.
-    *
-    * Fix this by not sharing the palette in this way.
+   /* Because PNG_UNUSED(errmsg) does not work if all the uses are compiled out
+    * (this does happen).
     */
-   png_set_PLTE(png_ptr, info_ptr, palette, num);
-
-   /* The three chunks, bKGD, hIST and tRNS *must* appear after PLTE and before
-    * IDAT.  Prior to 1.6.0 this was not checked; instead the code merely
-    * checked the apparent validity of a tRNS chunk inserted before PLTE on a
-    * palette PNG.  1.6.0 attempts to rigorously follow the standard and
-    * therefore does a benign error if the erroneous condition is detected *and*
-    * cancels the tRNS if the benign error returns.  The alternative is to
-    * amend the standard since it would be rather hypocritical of the standards
-    * maintainers to ignore it.
-    */
-#ifdef PNG_READ_tRNS_SUPPORTED
-   if (png_ptr->num_trans > 0 ||
-       (info_ptr != NULL && (info_ptr->valid & PNG_INFO_tRNS) != 0))
-   {
-      /* Cancel this because otherwise it would be used if the transforms
-       * require it.  Don't cancel the 'valid' flag because this would prevent
-       * detection of duplicate chunks.
-       */
-      png_ptr->num_trans = 0;
-
-      if (info_ptr != NULL)
-         info_ptr->num_trans = 0;
-
-      png_chunk_benign_error(png_ptr, "tRNS must be after");
-   }
-#endif
-
-#ifdef PNG_READ_hIST_SUPPORTED
-   if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_hIST) != 0)
-      png_chunk_benign_error(png_ptr, "hIST must be after");
-#endif
-
-#ifdef PNG_READ_bKGD_SUPPORTED
-   if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_bKGD) != 0)
-      png_chunk_benign_error(png_ptr, "bKGD must be after");
-#endif
+   return errmsg != NULL ? handled_error : handled_error;
 }
 
-void /* PRIVATE */
+/* On read the IDAT chunk is always handled specially, even if marked for
+ * unknown handling (this is allowed), so:
+ */
+#define png_handle_IDAT NULL
+
+static png_handle_result_code
 png_handle_IEND(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
 {
    png_debug(1, "in png_handle_IEND");
 
-   if ((png_ptr->mode & PNG_HAVE_IHDR) == 0 ||
-       (png_ptr->mode & PNG_HAVE_IDAT) == 0)
-      png_chunk_error(png_ptr, "out of place");
-
    png_ptr->mode |= (PNG_AFTER_IDAT | PNG_HAVE_IEND);
 
-   png_crc_finish(png_ptr, length);
-
    if (length != 0)
       png_chunk_benign_error(png_ptr, "invalid");
 
+   png_crc_finish_critical(png_ptr, length, 1/*handle as ancillary*/);
+
+   return handled_ok;
    PNG_UNUSED(info_ptr)
 }
 
 #ifdef PNG_READ_gAMA_SUPPORTED
-void /* PRIVATE */
+static png_handle_result_code
 png_handle_gAMA(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
 {
-   png_fixed_point igamma;
+   png_uint_32 ugamma;
    png_byte buf[4];
 
    png_debug(1, "in png_handle_gAMA");
 
-   if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
-      png_chunk_error(png_ptr, "missing IHDR");
+   png_crc_read(png_ptr, buf, 4);
 
-   else if ((png_ptr->mode & (PNG_HAVE_IDAT|PNG_HAVE_PLTE)) != 0)
-   {
-      png_crc_finish(png_ptr, length);
-      png_chunk_benign_error(png_ptr, "out of place");
-      return;
-   }
+   if (png_crc_finish(png_ptr, 0) != 0)
+      return handled_error;
+
+   ugamma = png_get_uint_32(buf);
 
-   if (length != 4)
+   if (ugamma > PNG_UINT_31_MAX)
    {
-      png_crc_finish(png_ptr, length);
       png_chunk_benign_error(png_ptr, "invalid");
-      return;
+      return handled_error;
    }
 
-   png_crc_read(png_ptr, buf, 4);
-
-   if (png_crc_finish(png_ptr, 0) != 0)
-      return;
+   png_set_gAMA_fixed(png_ptr, info_ptr, (png_fixed_point)/*SAFE*/ugamma);
 
-   igamma = png_get_fixed_point(NULL, buf);
+#ifdef PNG_READ_GAMMA_SUPPORTED
+      /* PNGv3: chunk precedence for gamma is cICP, [iCCP], sRGB, gAMA.  gAMA is
+       * at the end of the chain so simply check for an unset value.
+       */
+      if (png_ptr->chunk_gamma == 0)
+         png_ptr->chunk_gamma = (png_fixed_point)/*SAFE*/ugamma;
+#endif /*READ_GAMMA*/
 
-   png_colorspace_set_gamma(png_ptr, &png_ptr->colorspace, igamma);
-   png_colorspace_sync(png_ptr, info_ptr);
+   return handled_ok;
+   PNG_UNUSED(length)
 }
+#else
+#  define png_handle_gAMA NULL
 #endif
 
 #ifdef PNG_READ_sBIT_SUPPORTED
-void /* PRIVATE */
+static png_handle_result_code /* PRIVATE */
 png_handle_sBIT(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
 {
    unsigned int truelen, i;
@@ -1189,23 +1188,6 @@ png_handle_sBIT(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
 
    png_debug(1, "in png_handle_sBIT");
 
-   if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
-      png_chunk_error(png_ptr, "missing IHDR");
-
-   else if ((png_ptr->mode & (PNG_HAVE_IDAT|PNG_HAVE_PLTE)) != 0)
-   {
-      png_crc_finish(png_ptr, length);
-      png_chunk_benign_error(png_ptr, "out of place");
-      return;
-   }
-
-   if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_sBIT) != 0)
-   {
-      png_crc_finish(png_ptr, length);
-      png_chunk_benign_error(png_ptr, "duplicate");
-      return;
-   }
-
    if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
    {
       truelen = 3;
@@ -1218,25 +1200,25 @@ png_handle_sBIT(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
       sample_depth = png_ptr->bit_depth;
    }
 
-   if (length != truelen || length > 4)
+   if (length != truelen)
    {
-      png_chunk_benign_error(png_ptr, "invalid");
       png_crc_finish(png_ptr, length);
-      return;
+      png_chunk_benign_error(png_ptr, "bad length");
+      return handled_error;
    }
 
    buf[0] = buf[1] = buf[2] = buf[3] = sample_depth;
    png_crc_read(png_ptr, buf, truelen);
 
    if (png_crc_finish(png_ptr, 0) != 0)
-      return;
+      return handled_error;
 
    for (i=0; i sample_depth)
       {
          png_chunk_benign_error(png_ptr, "invalid");
-         return;
+         return handled_error;
       }
    }
 
@@ -1248,7 +1230,7 @@ png_handle_sBIT(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
       png_ptr->sig_bit.alpha = buf[3];
    }
 
-   else
+   else /* grayscale */
    {
       png_ptr->sig_bit.gray = buf[0];
       png_ptr->sig_bit.red = buf[0];
@@ -1258,133 +1240,132 @@ png_handle_sBIT(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
    }
 
    png_set_sBIT(png_ptr, info_ptr, &(png_ptr->sig_bit));
+   return handled_ok;
 }
+#else
+#  define png_handle_sBIT NULL
 #endif
 
 #ifdef PNG_READ_cHRM_SUPPORTED
-void /* PRIVATE */
-png_handle_cHRM(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
+static png_int_32
+png_get_int_32_checked(png_const_bytep buf, int *error)
 {
-   png_byte buf[32];
-   png_xy xy;
+   png_uint_32 uval = png_get_uint_32(buf);
+   if ((uval & 0x80000000) == 0) /* non-negative */
+      return (png_int_32)uval;
 
-   png_debug(1, "in png_handle_cHRM");
+   uval = (uval ^ 0xffffffff) + 1;  /* 2's complement: -x = ~x+1 */
+   if ((uval & 0x80000000) == 0) /* no overflow */
+      return -(png_int_32)uval;
 
-   if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
-      png_chunk_error(png_ptr, "missing IHDR");
+   /* This version of png_get_int_32 has a way of returning the error to the
+    * caller, so:
+    */
+   *error = 1;
+   return 0; /* Safe */
+}
 
-   else if ((png_ptr->mode & (PNG_HAVE_IDAT|PNG_HAVE_PLTE)) != 0)
-   {
-      png_crc_finish(png_ptr, length);
-      png_chunk_benign_error(png_ptr, "out of place");
-      return;
-   }
+static png_handle_result_code /* PRIVATE */
+png_handle_cHRM(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
+{
+   int error = 0;
+   png_xy xy;
+   png_byte buf[32];
 
-   if (length != 32)
-   {
-      png_crc_finish(png_ptr, length);
-      png_chunk_benign_error(png_ptr, "invalid");
-      return;
-   }
+   png_debug(1, "in png_handle_cHRM");
 
    png_crc_read(png_ptr, buf, 32);
 
    if (png_crc_finish(png_ptr, 0) != 0)
-      return;
+      return handled_error;
+
+   xy.whitex = png_get_int_32_checked(buf +  0, &error);
+   xy.whitey = png_get_int_32_checked(buf +  4, &error);
+   xy.redx   = png_get_int_32_checked(buf +  8, &error);
+   xy.redy   = png_get_int_32_checked(buf + 12, &error);
+   xy.greenx = png_get_int_32_checked(buf + 16, &error);
+   xy.greeny = png_get_int_32_checked(buf + 20, &error);
+   xy.bluex  = png_get_int_32_checked(buf + 24, &error);
+   xy.bluey  = png_get_int_32_checked(buf + 28, &error);
 
-   xy.whitex = png_get_fixed_point(NULL, buf);
-   xy.whitey = png_get_fixed_point(NULL, buf + 4);
-   xy.redx   = png_get_fixed_point(NULL, buf + 8);
-   xy.redy   = png_get_fixed_point(NULL, buf + 12);
-   xy.greenx = png_get_fixed_point(NULL, buf + 16);
-   xy.greeny = png_get_fixed_point(NULL, buf + 20);
-   xy.bluex  = png_get_fixed_point(NULL, buf + 24);
-   xy.bluey  = png_get_fixed_point(NULL, buf + 28);
-
-   if (xy.whitex == PNG_FIXED_ERROR ||
-       xy.whitey == PNG_FIXED_ERROR ||
-       xy.redx   == PNG_FIXED_ERROR ||
-       xy.redy   == PNG_FIXED_ERROR ||
-       xy.greenx == PNG_FIXED_ERROR ||
-       xy.greeny == PNG_FIXED_ERROR ||
-       xy.bluex  == PNG_FIXED_ERROR ||
-       xy.bluey  == PNG_FIXED_ERROR)
+   if (error)
    {
-      png_chunk_benign_error(png_ptr, "invalid values");
-      return;
+      png_chunk_benign_error(png_ptr, "invalid");
+      return handled_error;
    }
 
-   /* If a colorspace error has already been output skip this chunk */
-   if ((png_ptr->colorspace.flags & PNG_COLORSPACE_INVALID) != 0)
-      return;
+   /* png_set_cHRM may complain about some of the values but this doesn't matter
+    * because it was a cHRM and it did have vaguely (if, perhaps, ridiculous)
+    * values.  Ridiculousity will be checked if the values are used later.
+    */
+   png_set_cHRM_fixed(png_ptr, info_ptr, xy.whitex, xy.whitey, xy.redx, xy.redy,
+         xy.greenx, xy.greeny, xy.bluex, xy.bluey);
 
-   if ((png_ptr->colorspace.flags & PNG_COLORSPACE_FROM_cHRM) != 0)
-   {
-      png_ptr->colorspace.flags |= PNG_COLORSPACE_INVALID;
-      png_colorspace_sync(png_ptr, info_ptr);
-      png_chunk_benign_error(png_ptr, "duplicate");
-      return;
-   }
+   /* We only use 'chromaticities' for RGB to gray */
+#  ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
+      /* There is no need to check sRGB here, cICP is NYI and iCCP is not
+       * supported so just check mDCV.
+       */
+      if (!png_has_chunk(png_ptr, mDCV))
+      {
+         png_ptr->chromaticities = xy;
+      }
+#  endif /* READ_RGB_TO_GRAY */
 
-   png_ptr->colorspace.flags |= PNG_COLORSPACE_FROM_cHRM;
-   (void)png_colorspace_set_chromaticities(png_ptr, &png_ptr->colorspace, &xy,
-       1/*prefer cHRM values*/);
-   png_colorspace_sync(png_ptr, info_ptr);
+   return handled_ok;
+   PNG_UNUSED(length)
 }
+#else
+#  define png_handle_cHRM NULL
 #endif
 
 #ifdef PNG_READ_sRGB_SUPPORTED
-void /* PRIVATE */
+static png_handle_result_code /* PRIVATE */
 png_handle_sRGB(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
 {
    png_byte intent;
 
    png_debug(1, "in png_handle_sRGB");
 
-   if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
-      png_chunk_error(png_ptr, "missing IHDR");
-
-   else if ((png_ptr->mode & (PNG_HAVE_IDAT|PNG_HAVE_PLTE)) != 0)
-   {
-      png_crc_finish(png_ptr, length);
-      png_chunk_benign_error(png_ptr, "out of place");
-      return;
-   }
-
-   if (length != 1)
-   {
-      png_crc_finish(png_ptr, length);
-      png_chunk_benign_error(png_ptr, "invalid");
-      return;
-   }
-
    png_crc_read(png_ptr, &intent, 1);
 
    if (png_crc_finish(png_ptr, 0) != 0)
-      return;
+      return handled_error;
 
-   /* If a colorspace error has already been output skip this chunk */
-   if ((png_ptr->colorspace.flags & PNG_COLORSPACE_INVALID) != 0)
-      return;
-
-   /* Only one sRGB or iCCP chunk is allowed, use the HAVE_INTENT flag to detect
-    * this.
+   /* This checks the range of the "rendering intent" because it is specified in
+    * the PNG spec itself; the "reserved" values will result in the chunk not
+    * being accepted, just as they do with the various "reserved" values in
+    * IHDR.
     */
-   if ((png_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_INTENT) != 0)
+   if (intent > 3/*PNGv3 spec*/)
    {
-      png_ptr->colorspace.flags |= PNG_COLORSPACE_INVALID;
-      png_colorspace_sync(png_ptr, info_ptr);
-      png_chunk_benign_error(png_ptr, "too many profiles");
-      return;
+      png_chunk_benign_error(png_ptr, "invalid");
+      return handled_error;
    }
 
-   (void)png_colorspace_set_sRGB(png_ptr, &png_ptr->colorspace, intent);
-   png_colorspace_sync(png_ptr, info_ptr);
+   png_set_sRGB(png_ptr, info_ptr, intent);
+   /* NOTE: png_struct::chromaticities is not set here because the RGB to gray
+    * coefficients are known without a need for the chromaticities.
+    */
+
+#ifdef PNG_READ_GAMMA_SUPPORTED
+      /* PNGv3: chunk precedence for gamma is cICP, [iCCP], sRGB, gAMA.  iCCP is
+       * not supported by libpng so the only requirement is to check for cICP
+       * setting the gamma (this is NYI, but this check is safe.)
+       */
+      if (!png_has_chunk(png_ptr, cICP) || png_ptr->chunk_gamma == 0)
+         png_ptr->chunk_gamma = PNG_GAMMA_sRGB_INVERSE;
+#endif /*READ_GAMMA*/
+
+   return handled_ok;
+   PNG_UNUSED(length)
 }
+#else
+#  define png_handle_sRGB NULL
 #endif /* READ_sRGB */
 
 #ifdef PNG_READ_iCCP_SUPPORTED
-void /* PRIVATE */
+static png_handle_result_code /* PRIVATE */
 png_handle_iCCP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
 /* Note: this does not properly handle profiles that are > 64K under DOS */
 {
@@ -1393,44 +1374,10 @@ png_handle_iCCP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
 
    png_debug(1, "in png_handle_iCCP");
 
-   if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
-      png_chunk_error(png_ptr, "missing IHDR");
-
-   else if ((png_ptr->mode & (PNG_HAVE_IDAT|PNG_HAVE_PLTE)) != 0)
-   {
-      png_crc_finish(png_ptr, length);
-      png_chunk_benign_error(png_ptr, "out of place");
-      return;
-   }
-
-   /* Consistent with all the above colorspace handling an obviously *invalid*
-    * chunk is just ignored, so does not invalidate the color space.  An
-    * alternative is to set the 'invalid' flags at the start of this routine
-    * and only clear them in they were not set before and all the tests pass.
+   /* PNGv3: allow PNG files with both sRGB and iCCP because the PNG spec only
+    * ever said that there "should" be only one, not "shall" and the PNGv3
+    * colour chunk precedence rules give a handling for this case anyway.
     */
-
-   /* The keyword must be at least one character and there is a
-    * terminator (0) byte and the compression method byte, and the
-    * 'zlib' datastream is at least 11 bytes.
-    */
-   if (length < 14)
-   {
-      png_crc_finish(png_ptr, length);
-      png_chunk_benign_error(png_ptr, "too short");
-      return;
-   }
-
-   /* If a colorspace error has already been output skip this chunk */
-   if ((png_ptr->colorspace.flags & PNG_COLORSPACE_INVALID) != 0)
-   {
-      png_crc_finish(png_ptr, length);
-      return;
-   }
-
-   /* Only one sRGB or iCCP chunk is allowed, use the HAVE_INTENT flag to detect
-    * this.
-    */
-   if ((png_ptr->colorspace.flags & PNG_COLORSPACE_HAVE_INTENT) == 0)
    {
       uInt read_length, keyword_length;
       char keyword[81];
@@ -1440,19 +1387,16 @@ png_handle_iCCP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
        */
       read_length = 81; /* maximum */
       if (read_length > length)
-         read_length = (uInt)length;
+         read_length = (uInt)/*SAFE*/length;
 
       png_crc_read(png_ptr, (png_bytep)keyword, read_length);
       length -= read_length;
 
-      /* The minimum 'zlib' stream is assumed to be just the 2 byte header,
-       * 5 bytes minimum 'deflate' stream, and the 4 byte checksum.
-       */
-      if (length < 11)
+      if (length < LZ77Min)
       {
          png_crc_finish(png_ptr, length);
          png_chunk_benign_error(png_ptr, "too short");
-         return;
+         return handled_error;
       }
 
       keyword_length = 0;
@@ -1489,15 +1433,14 @@ png_handle_iCCP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
                    */
                   png_uint_32 profile_length = png_get_uint_32(profile_header);
 
-                  if (png_icc_check_length(png_ptr, &png_ptr->colorspace,
-                      keyword, profile_length) != 0)
+                  if (png_icc_check_length(png_ptr, keyword, profile_length) !=
+                      0)
                   {
                      /* The length is apparently ok, so we can check the 132
                       * byte header.
                       */
-                     if (png_icc_check_header(png_ptr, &png_ptr->colorspace,
-                         keyword, profile_length, profile_header,
-                         png_ptr->color_type) != 0)
+                     if (png_icc_check_header(png_ptr, keyword, profile_length,
+                              profile_header, png_ptr->color_type) != 0)
                      {
                         /* Now read the tag table; a variable size buffer is
                          * needed at this point, allocate one for the whole
@@ -1507,7 +1450,7 @@ png_handle_iCCP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
                         png_uint_32 tag_count =
                            png_get_uint_32(profile_header + 128);
                         png_bytep profile = png_read_buffer(png_ptr,
-                            profile_length, 2/*silent*/);
+                              profile_length);
 
                         if (profile != NULL)
                         {
@@ -1526,8 +1469,7 @@ png_handle_iCCP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
                            if (size == 0)
                            {
                               if (png_icc_check_tag_table(png_ptr,
-                                  &png_ptr->colorspace, keyword, profile_length,
-                                  profile) != 0)
+                                       keyword, profile_length, profile) != 0)
                               {
                                  /* The profile has been validated for basic
                                   * security issues, so read the whole thing in.
@@ -1559,13 +1501,6 @@ png_handle_iCCP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
                                     png_crc_finish(png_ptr, length);
                                     finished = 1;
 
-# if defined(PNG_sRGB_SUPPORTED) && PNG_sRGB_PROFILE_CHECKS >= 0
-                                    /* Check for a match against sRGB */
-                                    png_icc_set_sRGB(png_ptr,
-                                        &png_ptr->colorspace, profile,
-                                        png_ptr->zstream.adler);
-# endif
-
                                     /* Steal the profile for info_ptr. */
                                     if (info_ptr != NULL)
                                     {
@@ -1588,11 +1523,7 @@ png_handle_iCCP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
                                        }
 
                                        else
-                                       {
-                                          png_ptr->colorspace.flags |=
-                                             PNG_COLORSPACE_INVALID;
                                           errmsg = "out of memory";
-                                       }
                                     }
 
                                     /* else the profile remains in the read
@@ -1600,13 +1531,10 @@ png_handle_iCCP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
                                      * chunks.
                                      */
 
-                                    if (info_ptr != NULL)
-                                       png_colorspace_sync(png_ptr, info_ptr);
-
                                     if (errmsg == NULL)
                                     {
                                        png_ptr->zowner = 0;
-                                       return;
+                                       return handled_ok;
                                     }
                                  }
                                  if (errmsg == NULL)
@@ -1647,22 +1575,21 @@ png_handle_iCCP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
          errmsg = "bad keyword";
    }
 
-   else
-      errmsg = "too many profiles";
-
    /* Failure: the reason is in 'errmsg' */
    if (finished == 0)
       png_crc_finish(png_ptr, length);
 
-   png_ptr->colorspace.flags |= PNG_COLORSPACE_INVALID;
-   png_colorspace_sync(png_ptr, info_ptr);
    if (errmsg != NULL) /* else already output */
       png_chunk_benign_error(png_ptr, errmsg);
+
+   return handled_error;
 }
+#else
+#  define png_handle_iCCP NULL
 #endif /* READ_iCCP */
 
 #ifdef PNG_READ_sPLT_SUPPORTED
-void /* PRIVATE */
+static png_handle_result_code /* PRIVATE */
 png_handle_sPLT(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
 /* Note: this does not properly handle chunks that are > 64K under DOS */
 {
@@ -1683,43 +1610,24 @@ png_handle_sPLT(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
       if (png_ptr->user_chunk_cache_max == 1)
       {
          png_crc_finish(png_ptr, length);
-         return;
+         return handled_error;
       }
 
       if (--png_ptr->user_chunk_cache_max == 1)
       {
          png_warning(png_ptr, "No space in chunk cache for sPLT");
          png_crc_finish(png_ptr, length);
-         return;
+         return handled_error;
       }
    }
 #endif
 
-   if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
-      png_chunk_error(png_ptr, "missing IHDR");
-
-   else if ((png_ptr->mode & PNG_HAVE_IDAT) != 0)
-   {
-      png_crc_finish(png_ptr, length);
-      png_chunk_benign_error(png_ptr, "out of place");
-      return;
-   }
-
-#ifdef PNG_MAX_MALLOC_64K
-   if (length > 65535U)
-   {
-      png_crc_finish(png_ptr, length);
-      png_chunk_benign_error(png_ptr, "too large to fit in memory");
-      return;
-   }
-#endif
-
-   buffer = png_read_buffer(png_ptr, length+1, 2/*silent*/);
+   buffer = png_read_buffer(png_ptr, length+1);
    if (buffer == NULL)
    {
       png_crc_finish(png_ptr, length);
       png_chunk_benign_error(png_ptr, "out of memory");
-      return;
+      return handled_error;
    }
 
 
@@ -1730,7 +1638,7 @@ png_handle_sPLT(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
    png_crc_read(png_ptr, buffer, length);
 
    if (png_crc_finish(png_ptr, skip) != 0)
-      return;
+      return handled_error;
 
    buffer[length] = 0;
 
@@ -1743,7 +1651,7 @@ png_handle_sPLT(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
    if (length < 2U || entry_start > buffer + (length - 2U))
    {
       png_warning(png_ptr, "malformed sPLT chunk");
-      return;
+      return handled_error;
    }
 
    new_palette.depth = *entry_start++;
@@ -1757,7 +1665,7 @@ png_handle_sPLT(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
    if ((data_length % (unsigned int)entry_size) != 0)
    {
       png_warning(png_ptr, "sPLT chunk has bad length");
-      return;
+      return handled_error;
    }
 
    dl = (png_uint_32)(data_length / (unsigned int)entry_size);
@@ -1766,7 +1674,7 @@ png_handle_sPLT(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
    if (dl > max_dl)
    {
       png_warning(png_ptr, "sPLT chunk too long");
-      return;
+      return handled_error;
    }
 
    new_palette.nentries = (png_int_32)(data_length / (unsigned int)entry_size);
@@ -1777,10 +1685,9 @@ png_handle_sPLT(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
    if (new_palette.entries == NULL)
    {
       png_warning(png_ptr, "sPLT chunk requires too much memory");
-      return;
+      return handled_error;
    }
 
-#ifdef PNG_POINTER_INDEXING_SUPPORTED
    for (i = 0; i < new_palette.nentries; i++)
    {
       pp = new_palette.entries + i;
@@ -1803,31 +1710,6 @@ png_handle_sPLT(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
 
       pp->frequency = png_get_uint_16(entry_start); entry_start += 2;
    }
-#else
-   pp = new_palette.entries;
-
-   for (i = 0; i < new_palette.nentries; i++)
-   {
-
-      if (new_palette.depth == 8)
-      {
-         pp[i].red   = *entry_start++;
-         pp[i].green = *entry_start++;
-         pp[i].blue  = *entry_start++;
-         pp[i].alpha = *entry_start++;
-      }
-
-      else
-      {
-         pp[i].red   = png_get_uint_16(entry_start); entry_start += 2;
-         pp[i].green = png_get_uint_16(entry_start); entry_start += 2;
-         pp[i].blue  = png_get_uint_16(entry_start); entry_start += 2;
-         pp[i].alpha = png_get_uint_16(entry_start); entry_start += 2;
-      }
-
-      pp[i].frequency = png_get_uint_16(entry_start); entry_start += 2;
-   }
-#endif
 
    /* Discard all chunk data except the name and stash that */
    new_palette.name = (png_charp)buffer;
@@ -1835,34 +1717,20 @@ png_handle_sPLT(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
    png_set_sPLT(png_ptr, info_ptr, &new_palette, 1);
 
    png_free(png_ptr, new_palette.entries);
+   return handled_ok;
 }
+#else
+#  define png_handle_sPLT NULL
 #endif /* READ_sPLT */
 
 #ifdef PNG_READ_tRNS_SUPPORTED
-void /* PRIVATE */
+static png_handle_result_code /* PRIVATE */
 png_handle_tRNS(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
 {
    png_byte readbuf[PNG_MAX_PALETTE_LENGTH];
 
    png_debug(1, "in png_handle_tRNS");
 
-   if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
-      png_chunk_error(png_ptr, "missing IHDR");
-
-   else if ((png_ptr->mode & PNG_HAVE_IDAT) != 0)
-   {
-      png_crc_finish(png_ptr, length);
-      png_chunk_benign_error(png_ptr, "out of place");
-      return;
-   }
-
-   else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_tRNS) != 0)
-   {
-      png_crc_finish(png_ptr, length);
-      png_chunk_benign_error(png_ptr, "duplicate");
-      return;
-   }
-
    if (png_ptr->color_type == PNG_COLOR_TYPE_GRAY)
    {
       png_byte buf[2];
@@ -1871,7 +1739,7 @@ png_handle_tRNS(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
       {
          png_crc_finish(png_ptr, length);
          png_chunk_benign_error(png_ptr, "invalid");
-         return;
+         return handled_error;
       }
 
       png_crc_read(png_ptr, buf, 2);
@@ -1887,7 +1755,7 @@ png_handle_tRNS(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
       {
          png_crc_finish(png_ptr, length);
          png_chunk_benign_error(png_ptr, "invalid");
-         return;
+         return handled_error;
       }
 
       png_crc_read(png_ptr, buf, length);
@@ -1901,10 +1769,9 @@ png_handle_tRNS(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
    {
       if ((png_ptr->mode & PNG_HAVE_PLTE) == 0)
       {
-         /* TODO: is this actually an error in the ISO spec? */
          png_crc_finish(png_ptr, length);
          png_chunk_benign_error(png_ptr, "out of place");
-         return;
+         return handled_error;
       }
 
       if (length > (unsigned int) png_ptr->num_palette ||
@@ -1913,7 +1780,7 @@ png_handle_tRNS(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
       {
          png_crc_finish(png_ptr, length);
          png_chunk_benign_error(png_ptr, "invalid");
-         return;
+         return handled_error;
       }
 
       png_crc_read(png_ptr, readbuf, length);
@@ -1924,13 +1791,13 @@ png_handle_tRNS(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
    {
       png_crc_finish(png_ptr, length);
       png_chunk_benign_error(png_ptr, "invalid with alpha channel");
-      return;
+      return handled_error;
    }
 
    if (png_crc_finish(png_ptr, 0) != 0)
    {
       png_ptr->num_trans = 0;
-      return;
+      return handled_error;
    }
 
    /* TODO: this is a horrible side effect in the palette case because the
@@ -1939,11 +1806,14 @@ png_handle_tRNS(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
     */
    png_set_tRNS(png_ptr, info_ptr, readbuf, png_ptr->num_trans,
        &(png_ptr->trans_color));
+   return handled_ok;
 }
+#else
+#  define png_handle_tRNS NULL
 #endif
 
 #ifdef PNG_READ_bKGD_SUPPORTED
-void /* PRIVATE */
+static png_handle_result_code /* PRIVATE */
 png_handle_bKGD(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
 {
    unsigned int truelen;
@@ -1952,27 +1822,17 @@ png_handle_bKGD(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
 
    png_debug(1, "in png_handle_bKGD");
 
-   if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
-      png_chunk_error(png_ptr, "missing IHDR");
-
-   else if ((png_ptr->mode & PNG_HAVE_IDAT) != 0 ||
-       (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE &&
-       (png_ptr->mode & PNG_HAVE_PLTE) == 0))
-   {
-      png_crc_finish(png_ptr, length);
-      png_chunk_benign_error(png_ptr, "out of place");
-      return;
-   }
-
-   else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_bKGD) != 0)
+   if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
    {
-      png_crc_finish(png_ptr, length);
-      png_chunk_benign_error(png_ptr, "duplicate");
-      return;
-   }
+      if ((png_ptr->mode & PNG_HAVE_PLTE) == 0)
+      {
+         png_crc_finish(png_ptr, length);
+         png_chunk_benign_error(png_ptr, "out of place");
+         return handled_error;
+      }
 
-   if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE)
       truelen = 1;
+   }
 
    else if ((png_ptr->color_type & PNG_COLOR_MASK_COLOR) != 0)
       truelen = 6;
@@ -1984,13 +1844,13 @@ png_handle_bKGD(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
    {
       png_crc_finish(png_ptr, length);
       png_chunk_benign_error(png_ptr, "invalid");
-      return;
+      return handled_error;
    }
 
    png_crc_read(png_ptr, buf, truelen);
 
    if (png_crc_finish(png_ptr, 0) != 0)
-      return;
+      return handled_error;
 
    /* We convert the index value into RGB components so that we can allow
     * arbitrary RGB values for background when we have transparency, and
@@ -2006,7 +1866,7 @@ png_handle_bKGD(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
          if (buf[0] >= info_ptr->num_palette)
          {
             png_chunk_benign_error(png_ptr, "invalid index");
-            return;
+            return handled_error;
          }
 
          background.red = (png_uint_16)png_ptr->palette[buf[0]].red;
@@ -2027,7 +1887,7 @@ png_handle_bKGD(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
          if (buf[0] != 0 || buf[1] >= (unsigned int)(1 << png_ptr->bit_depth))
          {
             png_chunk_benign_error(png_ptr, "invalid gray level");
-            return;
+            return handled_error;
          }
       }
 
@@ -2045,7 +1905,7 @@ png_handle_bKGD(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
          if (buf[0] != 0 || buf[2] != 0 || buf[4] != 0)
          {
             png_chunk_benign_error(png_ptr, "invalid color");
-            return;
+            return handled_error;
          }
       }
 
@@ -2057,75 +1917,174 @@ png_handle_bKGD(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
    }
 
    png_set_bKGD(png_ptr, info_ptr, &background);
+   return handled_ok;
 }
+#else
+#  define png_handle_bKGD NULL
 #endif
 
-#ifdef PNG_READ_eXIf_SUPPORTED
-void /* PRIVATE */
-png_handle_eXIf(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
+#ifdef PNG_READ_cICP_SUPPORTED
+static png_handle_result_code /* PRIVATE */
+png_handle_cICP(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
 {
-   unsigned int i;
+   png_byte buf[4];
 
-   png_debug(1, "in png_handle_eXIf");
+   png_debug(1, "in png_handle_cICP");
 
-   if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
-      png_chunk_error(png_ptr, "missing IHDR");
+   png_crc_read(png_ptr, buf, 4);
 
-   if (length < 2)
-   {
-      png_crc_finish(png_ptr, length);
-      png_chunk_benign_error(png_ptr, "too short");
-      return;
-   }
+   if (png_crc_finish(png_ptr, 0) != 0)
+      return handled_error;
 
-   else if (info_ptr == NULL || (info_ptr->valid & PNG_INFO_eXIf) != 0)
-   {
-      png_crc_finish(png_ptr, length);
-      png_chunk_benign_error(png_ptr, "duplicate");
-      return;
-   }
+   png_set_cICP(png_ptr, info_ptr, buf[0], buf[1],  buf[2], buf[3]);
 
-   info_ptr->free_me |= PNG_FREE_EXIF;
+   /* We only use 'chromaticities' for RGB to gray */
+#  ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
+      if (!png_has_chunk(png_ptr, mDCV))
+      {
+         /* TODO: png_ptr->chromaticities = chromaticities; */
+      }
+#  endif /* READ_RGB_TO_GRAY */
 
-   info_ptr->eXIf_buf = png_voidcast(png_bytep,
-             png_malloc_warn(png_ptr, length));
+#ifdef PNG_READ_GAMMA_SUPPORTED
+      /* PNGv3: chunk precedence for gamma is cICP, [iCCP], sRGB, gAMA.  cICP is
+       * at the head so simply set the gamma if it can be determined.  If not
+       * chunk_gamma remains unchanged; sRGB and gAMA handling check it for
+       * being zero.
+       */
+      /* TODO: set png_struct::chunk_gamma when possible */
+#endif /*READ_GAMMA*/
+
+   return handled_ok;
+   PNG_UNUSED(length)
+}
+#else
+#  define png_handle_cICP NULL
+#endif
+
+#ifdef PNG_READ_cLLI_SUPPORTED
+static png_handle_result_code /* PRIVATE */
+png_handle_cLLI(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
+{
+   png_byte buf[8];
 
-   if (info_ptr->eXIf_buf == NULL)
+   png_debug(1, "in png_handle_cLLI");
+
+   png_crc_read(png_ptr, buf, 8);
+
+   if (png_crc_finish(png_ptr, 0) != 0)
+      return handled_error;
+
+   /* The error checking happens here, this puts it in just one place: */
+   png_set_cLLI_fixed(png_ptr, info_ptr, png_get_uint_32(buf),
+         png_get_uint_32(buf+4));
+   return handled_ok;
+   PNG_UNUSED(length)
+}
+#else
+#  define png_handle_cLLI NULL
+#endif
+
+#ifdef PNG_READ_mDCV_SUPPORTED
+static png_handle_result_code /* PRIVATE */
+png_handle_mDCV(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
+{
+   png_xy chromaticities;
+   png_byte buf[24];
+
+   png_debug(1, "in png_handle_mDCV");
+
+   png_crc_read(png_ptr, buf, 24);
+
+   if (png_crc_finish(png_ptr, 0) != 0)
+      return handled_error;
+
+   /* The error checking happens here, this puts it in just one place.  The
+    * odd /50000 scaling factor makes it more difficult but the (x.y) values are
+    * only two bytes so a <<1 is safe.
+    *
+    * WARNING: the PNG specification defines the cHRM chunk to **start** with
+    * the white point (x,y).  The W3C PNG v3 specification puts the white point
+    * **after* R,G,B.  The x,y values in mDCV are also scaled by 50,000 and
+    * stored in just two bytes, whereas those in cHRM are scaled by 100,000 and
+    * stored in four bytes.  This is very, very confusing.  These APIs remove
+    * the confusion by copying the existing, well established, API.
+    */
+   chromaticities.redx   = png_get_uint_16(buf+ 0U) << 1; /* red x */
+   chromaticities.redy   = png_get_uint_16(buf+ 2U) << 1; /* red y */
+   chromaticities.greenx = png_get_uint_16(buf+ 4U) << 1; /* green x */
+   chromaticities.greeny = png_get_uint_16(buf+ 6U) << 1; /* green y */
+   chromaticities.bluex  = png_get_uint_16(buf+ 8U) << 1; /* blue x */
+   chromaticities.bluey  = png_get_uint_16(buf+10U) << 1; /* blue y */
+   chromaticities.whitex = png_get_uint_16(buf+12U) << 1; /* white x */
+   chromaticities.whitey = png_get_uint_16(buf+14U) << 1; /* white y */
+
+   png_set_mDCV_fixed(png_ptr, info_ptr,
+         chromaticities.whitex, chromaticities.whitey,
+         chromaticities.redx, chromaticities.redy,
+         chromaticities.greenx, chromaticities.greeny,
+         chromaticities.bluex, chromaticities.bluey,
+         png_get_uint_32(buf+16U), /* peak luminance */
+         png_get_uint_32(buf+20U));/* minimum perceivable luminance */
+
+   /* We only use 'chromaticities' for RGB to gray */
+#  ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
+      png_ptr->chromaticities = chromaticities;
+#  endif /* READ_RGB_TO_GRAY */
+
+   return handled_ok;
+   PNG_UNUSED(length)
+}
+#else
+#  define png_handle_mDCV NULL
+#endif
+
+#ifdef PNG_READ_eXIf_SUPPORTED
+static png_handle_result_code /* PRIVATE */
+png_handle_eXIf(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
+{
+   png_bytep buffer = NULL;
+
+   png_debug(1, "in png_handle_eXIf");
+
+   buffer = png_read_buffer(png_ptr, length);
+
+   if (buffer == NULL)
    {
       png_crc_finish(png_ptr, length);
       png_chunk_benign_error(png_ptr, "out of memory");
-      return;
+      return handled_error;
    }
 
-   for (i = 0; i < length; i++)
+   png_crc_read(png_ptr, buffer, length);
+
+   if (png_crc_finish(png_ptr, 0) != 0)
+      return handled_error;
+
+   /* PNGv3: the code used to check the byte order mark at the start for MM or
+    * II, however PNGv3 states that the the first 4 bytes should be checked.
+    * The caller ensures that there are four bytes available.
+    */
    {
-      png_byte buf[1];
-      png_crc_read(png_ptr, buf, 1);
-      info_ptr->eXIf_buf[i] = buf[0];
-      if (i == 1)
+      png_uint_32 header = png_get_uint_32(buffer);
+
+      /* These numbers are copied from the PNGv3 spec: */
+      if (header != 0x49492A00 && header != 0x4D4D002A)
       {
-         if ((buf[0] != 'M' && buf[0] != 'I') ||
-             (info_ptr->eXIf_buf[0] != buf[0]))
-         {
-            png_crc_finish(png_ptr, length - 2);
-            png_chunk_benign_error(png_ptr, "incorrect byte-order specifier");
-            png_free(png_ptr, info_ptr->eXIf_buf);
-            info_ptr->eXIf_buf = NULL;
-            return;
-         }
+         png_chunk_benign_error(png_ptr, "invalid");
+         return handled_error;
       }
    }
 
-   if (png_crc_finish(png_ptr, 0) == 0)
-      png_set_eXIf_1(png_ptr, info_ptr, length, info_ptr->eXIf_buf);
-
-   png_free(png_ptr, info_ptr->eXIf_buf);
-   info_ptr->eXIf_buf = NULL;
+   png_set_eXIf_1(png_ptr, info_ptr, length, buffer);
+   return handled_ok;
 }
+#else
+#  define png_handle_eXIf NULL
 #endif
 
 #ifdef PNG_READ_hIST_SUPPORTED
-void /* PRIVATE */
+static png_handle_result_code /* PRIVATE */
 png_handle_hIST(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
 {
    unsigned int num, i;
@@ -2133,25 +2092,13 @@ png_handle_hIST(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
 
    png_debug(1, "in png_handle_hIST");
 
-   if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
-      png_chunk_error(png_ptr, "missing IHDR");
-
-   else if ((png_ptr->mode & PNG_HAVE_IDAT) != 0 ||
-       (png_ptr->mode & PNG_HAVE_PLTE) == 0)
-   {
-      png_crc_finish(png_ptr, length);
-      png_chunk_benign_error(png_ptr, "out of place");
-      return;
-   }
-
-   else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_hIST) != 0)
-   {
-      png_crc_finish(png_ptr, length);
-      png_chunk_benign_error(png_ptr, "duplicate");
-      return;
-   }
-
-   num = length / 2 ;
+   /* This cast is safe because the chunk definition limits the length to a
+    * maximum of 1024 bytes.
+    *
+    * TODO: maybe use png_uint_32 anyway, not unsigned int, to reduce the
+    * casts.
+    */
+   num = (unsigned int)length / 2 ;
 
    if (length != num * 2 ||
        num != (unsigned int)png_ptr->num_palette ||
@@ -2159,7 +2106,7 @@ png_handle_hIST(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
    {
       png_crc_finish(png_ptr, length);
       png_chunk_benign_error(png_ptr, "invalid");
-      return;
+      return handled_error;
    }
 
    for (i = 0; i < num; i++)
@@ -2171,14 +2118,17 @@ png_handle_hIST(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
    }
 
    if (png_crc_finish(png_ptr, 0) != 0)
-      return;
+      return handled_error;
 
    png_set_hIST(png_ptr, info_ptr, readbuf);
+   return handled_ok;
 }
+#else
+#  define png_handle_hIST NULL
 #endif
 
 #ifdef PNG_READ_pHYs_SUPPORTED
-void /* PRIVATE */
+static png_handle_result_code /* PRIVATE */
 png_handle_pHYs(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
 {
    png_byte buf[9];
@@ -2187,44 +2137,24 @@ png_handle_pHYs(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
 
    png_debug(1, "in png_handle_pHYs");
 
-   if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
-      png_chunk_error(png_ptr, "missing IHDR");
-
-   else if ((png_ptr->mode & PNG_HAVE_IDAT) != 0)
-   {
-      png_crc_finish(png_ptr, length);
-      png_chunk_benign_error(png_ptr, "out of place");
-      return;
-   }
-
-   else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_pHYs) != 0)
-   {
-      png_crc_finish(png_ptr, length);
-      png_chunk_benign_error(png_ptr, "duplicate");
-      return;
-   }
-
-   if (length != 9)
-   {
-      png_crc_finish(png_ptr, length);
-      png_chunk_benign_error(png_ptr, "invalid");
-      return;
-   }
-
    png_crc_read(png_ptr, buf, 9);
 
    if (png_crc_finish(png_ptr, 0) != 0)
-      return;
+      return handled_error;
 
    res_x = png_get_uint_32(buf);
    res_y = png_get_uint_32(buf + 4);
    unit_type = buf[8];
    png_set_pHYs(png_ptr, info_ptr, res_x, res_y, unit_type);
+   return handled_ok;
+   PNG_UNUSED(length)
 }
+#else
+#  define png_handle_pHYs NULL
 #endif
 
 #ifdef PNG_READ_oFFs_SUPPORTED
-void /* PRIVATE */
+static png_handle_result_code /* PRIVATE */
 png_handle_oFFs(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
 {
    png_byte buf[9];
@@ -2233,45 +2163,25 @@ png_handle_oFFs(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
 
    png_debug(1, "in png_handle_oFFs");
 
-   if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
-      png_chunk_error(png_ptr, "missing IHDR");
-
-   else if ((png_ptr->mode & PNG_HAVE_IDAT) != 0)
-   {
-      png_crc_finish(png_ptr, length);
-      png_chunk_benign_error(png_ptr, "out of place");
-      return;
-   }
-
-   else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_oFFs) != 0)
-   {
-      png_crc_finish(png_ptr, length);
-      png_chunk_benign_error(png_ptr, "duplicate");
-      return;
-   }
-
-   if (length != 9)
-   {
-      png_crc_finish(png_ptr, length);
-      png_chunk_benign_error(png_ptr, "invalid");
-      return;
-   }
-
    png_crc_read(png_ptr, buf, 9);
 
    if (png_crc_finish(png_ptr, 0) != 0)
-      return;
+      return handled_error;
 
    offset_x = png_get_int_32(buf);
    offset_y = png_get_int_32(buf + 4);
    unit_type = buf[8];
    png_set_oFFs(png_ptr, info_ptr, offset_x, offset_y, unit_type);
+   return handled_ok;
+   PNG_UNUSED(length)
 }
+#else
+#  define png_handle_oFFs NULL
 #endif
 
 #ifdef PNG_READ_pCAL_SUPPORTED
 /* Read the pCAL chunk (described in the PNG Extensions document) */
-void /* PRIVATE */
+static png_handle_result_code /* PRIVATE */
 png_handle_pCAL(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
 {
    png_int_32 X0, X1;
@@ -2281,40 +2191,22 @@ png_handle_pCAL(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
    int i;
 
    png_debug(1, "in png_handle_pCAL");
-
-   if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
-      png_chunk_error(png_ptr, "missing IHDR");
-
-   else if ((png_ptr->mode & PNG_HAVE_IDAT) != 0)
-   {
-      png_crc_finish(png_ptr, length);
-      png_chunk_benign_error(png_ptr, "out of place");
-      return;
-   }
-
-   else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_pCAL) != 0)
-   {
-      png_crc_finish(png_ptr, length);
-      png_chunk_benign_error(png_ptr, "duplicate");
-      return;
-   }
-
    png_debug1(2, "Allocating and reading pCAL chunk data (%u bytes)",
        length + 1);
 
-   buffer = png_read_buffer(png_ptr, length+1, 2/*silent*/);
+   buffer = png_read_buffer(png_ptr, length+1);
 
    if (buffer == NULL)
    {
       png_crc_finish(png_ptr, length);
       png_chunk_benign_error(png_ptr, "out of memory");
-      return;
+      return handled_error;
    }
 
    png_crc_read(png_ptr, buffer, length);
 
    if (png_crc_finish(png_ptr, 0) != 0)
-      return;
+      return handled_error;
 
    buffer[length] = 0; /* Null terminate the last string */
 
@@ -2330,7 +2222,7 @@ png_handle_pCAL(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
    if (endptr - buf <= 12)
    {
       png_chunk_benign_error(png_ptr, "invalid");
-      return;
+      return handled_error;
    }
 
    png_debug(3, "Reading pCAL X0, X1, type, nparams, and units");
@@ -2350,7 +2242,7 @@ png_handle_pCAL(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
        (type == PNG_EQUATION_HYPERBOLIC && nparams != 4))
    {
       png_chunk_benign_error(png_ptr, "invalid parameter count");
-      return;
+      return handled_error;
    }
 
    else if (type >= PNG_EQUATION_LAST)
@@ -2369,7 +2261,7 @@ png_handle_pCAL(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
    if (params == NULL)
    {
       png_chunk_benign_error(png_ptr, "out of memory");
-      return;
+      return handled_error;
    }
 
    /* Get pointers to the start of each parameter string. */
@@ -2387,20 +2279,29 @@ png_handle_pCAL(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
       {
          png_free(png_ptr, params);
          png_chunk_benign_error(png_ptr, "invalid data");
-         return;
+         return handled_error;
       }
    }
 
    png_set_pCAL(png_ptr, info_ptr, (png_charp)buffer, X0, X1, type, nparams,
        (png_charp)units, params);
 
+   /* TODO: BUG: png_set_pCAL calls png_chunk_report which, in this case, calls
+    * png_benign_error and that can error out.
+    *
+    * png_read_buffer needs to be allocated with space for both nparams and the
+    * parameter strings.  Not hard to do.
+    */
    png_free(png_ptr, params);
+   return handled_ok;
 }
+#else
+#  define png_handle_pCAL NULL
 #endif
 
 #ifdef PNG_READ_sCAL_SUPPORTED
 /* Read the sCAL chunk */
-void /* PRIVATE */
+static png_handle_result_code /* PRIVATE */
 png_handle_sCAL(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
 {
    png_bytep buffer;
@@ -2408,55 +2309,29 @@ png_handle_sCAL(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
    int state;
 
    png_debug(1, "in png_handle_sCAL");
-
-   if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
-      png_chunk_error(png_ptr, "missing IHDR");
-
-   else if ((png_ptr->mode & PNG_HAVE_IDAT) != 0)
-   {
-      png_crc_finish(png_ptr, length);
-      png_chunk_benign_error(png_ptr, "out of place");
-      return;
-   }
-
-   else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_sCAL) != 0)
-   {
-      png_crc_finish(png_ptr, length);
-      png_chunk_benign_error(png_ptr, "duplicate");
-      return;
-   }
-
-   /* Need unit type, width, \0, height: minimum 4 bytes */
-   else if (length < 4)
-   {
-      png_crc_finish(png_ptr, length);
-      png_chunk_benign_error(png_ptr, "invalid");
-      return;
-   }
-
    png_debug1(2, "Allocating and reading sCAL chunk data (%u bytes)",
        length + 1);
 
-   buffer = png_read_buffer(png_ptr, length+1, 2/*silent*/);
+   buffer = png_read_buffer(png_ptr, length+1);
 
    if (buffer == NULL)
    {
-      png_chunk_benign_error(png_ptr, "out of memory");
       png_crc_finish(png_ptr, length);
-      return;
+      png_chunk_benign_error(png_ptr, "out of memory");
+      return handled_error;
    }
 
    png_crc_read(png_ptr, buffer, length);
    buffer[length] = 0; /* Null terminate the last string */
 
    if (png_crc_finish(png_ptr, 0) != 0)
-      return;
+      return handled_error;
 
    /* Validate the unit. */
    if (buffer[0] != 1 && buffer[0] != 2)
    {
       png_chunk_benign_error(png_ptr, "invalid unit");
-      return;
+      return handled_error;
    }
 
    /* Validate the ASCII numbers, need two ASCII numbers separated by
@@ -2485,15 +2360,22 @@ png_handle_sCAL(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
          png_chunk_benign_error(png_ptr, "non-positive height");
 
       else
+      {
          /* This is the (only) success case. */
          png_set_sCAL_s(png_ptr, info_ptr, buffer[0],
              (png_charp)buffer+1, (png_charp)buffer+heighti);
+         return handled_ok;
+      }
    }
+
+   return handled_error;
 }
+#else
+#  define png_handle_sCAL NULL
 #endif
 
 #ifdef PNG_READ_tIME_SUPPORTED
-void /* PRIVATE */
+static png_handle_result_code /* PRIVATE */
 png_handle_tIME(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
 {
    png_byte buf[7];
@@ -2501,30 +2383,17 @@ png_handle_tIME(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
 
    png_debug(1, "in png_handle_tIME");
 
-   if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
-      png_chunk_error(png_ptr, "missing IHDR");
-
-   else if (info_ptr != NULL && (info_ptr->valid & PNG_INFO_tIME) != 0)
-   {
-      png_crc_finish(png_ptr, length);
-      png_chunk_benign_error(png_ptr, "duplicate");
-      return;
-   }
-
+   /* TODO: what is this doing here?  It should be happened in pngread.c and
+    * pngpread.c, although it could be moved to png_handle_chunk below and
+    * thereby avoid some code duplication.
+    */
    if ((png_ptr->mode & PNG_HAVE_IDAT) != 0)
       png_ptr->mode |= PNG_AFTER_IDAT;
 
-   if (length != 7)
-   {
-      png_crc_finish(png_ptr, length);
-      png_chunk_benign_error(png_ptr, "invalid");
-      return;
-   }
-
    png_crc_read(png_ptr, buf, 7);
 
    if (png_crc_finish(png_ptr, 0) != 0)
-      return;
+      return handled_error;
 
    mod_time.second = buf[6];
    mod_time.minute = buf[5];
@@ -2534,12 +2403,16 @@ png_handle_tIME(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
    mod_time.year = png_get_uint_16(buf);
 
    png_set_tIME(png_ptr, info_ptr, &mod_time);
+   return handled_ok;
+   PNG_UNUSED(length)
 }
+#else
+#  define png_handle_tIME NULL
 #endif
 
 #ifdef PNG_READ_tEXt_SUPPORTED
 /* Note: this does not properly handle chunks that are > 64K under DOS */
-void /* PRIVATE */
+static png_handle_result_code /* PRIVATE */
 png_handle_tEXt(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
 {
    png_text  text_info;
@@ -2556,45 +2429,35 @@ png_handle_tEXt(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
       if (png_ptr->user_chunk_cache_max == 1)
       {
          png_crc_finish(png_ptr, length);
-         return;
+         return handled_error;
       }
 
       if (--png_ptr->user_chunk_cache_max == 1)
       {
          png_crc_finish(png_ptr, length);
          png_chunk_benign_error(png_ptr, "no space in chunk cache");
-         return;
+         return handled_error;
       }
    }
 #endif
 
-   if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
-      png_chunk_error(png_ptr, "missing IHDR");
-
+   /* TODO: this doesn't work and shouldn't be necessary. */
    if ((png_ptr->mode & PNG_HAVE_IDAT) != 0)
       png_ptr->mode |= PNG_AFTER_IDAT;
 
-#ifdef PNG_MAX_MALLOC_64K
-   if (length > 65535U)
-   {
-      png_crc_finish(png_ptr, length);
-      png_chunk_benign_error(png_ptr, "too large to fit in memory");
-      return;
-   }
-#endif
-
-   buffer = png_read_buffer(png_ptr, length+1, 1/*warn*/);
+   buffer = png_read_buffer(png_ptr, length+1);
 
    if (buffer == NULL)
    {
+      png_crc_finish(png_ptr, length);
       png_chunk_benign_error(png_ptr, "out of memory");
-      return;
+      return handled_error;
    }
 
    png_crc_read(png_ptr, buffer, length);
 
    if (png_crc_finish(png_ptr, skip) != 0)
-      return;
+      return handled_error;
 
    key = (png_charp)buffer;
    key[length] = 0;
@@ -2613,14 +2476,19 @@ png_handle_tEXt(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
    text_info.text = text;
    text_info.text_length = strlen(text);
 
-   if (png_set_text_2(png_ptr, info_ptr, &text_info, 1) != 0)
-      png_warning(png_ptr, "Insufficient memory to process text chunk");
+   if (png_set_text_2(png_ptr, info_ptr, &text_info, 1) == 0)
+      return handled_ok;
+
+   png_chunk_benign_error(png_ptr, "out of memory");
+   return handled_error;
 }
+#else
+#  define png_handle_tEXt NULL
 #endif
 
 #ifdef PNG_READ_zTXt_SUPPORTED
 /* Note: this does not correctly handle chunks that are > 64K under DOS */
-void /* PRIVATE */
+static png_handle_result_code /* PRIVATE */
 png_handle_zTXt(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
 {
    png_const_charp errmsg = NULL;
@@ -2635,40 +2503,39 @@ png_handle_zTXt(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
       if (png_ptr->user_chunk_cache_max == 1)
       {
          png_crc_finish(png_ptr, length);
-         return;
+         return handled_error;
       }
 
       if (--png_ptr->user_chunk_cache_max == 1)
       {
          png_crc_finish(png_ptr, length);
          png_chunk_benign_error(png_ptr, "no space in chunk cache");
-         return;
+         return handled_error;
       }
    }
 #endif
 
-   if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
-      png_chunk_error(png_ptr, "missing IHDR");
-
+   /* TODO: should not be necessary. */
    if ((png_ptr->mode & PNG_HAVE_IDAT) != 0)
       png_ptr->mode |= PNG_AFTER_IDAT;
 
    /* Note, "length" is sufficient here; we won't be adding
-    * a null terminator later.
+    * a null terminator later.  The limit check in png_handle_chunk should be
+    * sufficient.
     */
-   buffer = png_read_buffer(png_ptr, length, 2/*silent*/);
+   buffer = png_read_buffer(png_ptr, length);
 
    if (buffer == NULL)
    {
       png_crc_finish(png_ptr, length);
       png_chunk_benign_error(png_ptr, "out of memory");
-      return;
+      return handled_error;
    }
 
    png_crc_read(png_ptr, buffer, length);
 
    if (png_crc_finish(png_ptr, 0) != 0)
-      return;
+      return handled_error;
 
    /* TODO: also check that the keyword contents match the spec! */
    for (keyword_length = 0;
@@ -2721,8 +2588,10 @@ png_handle_zTXt(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
             text.lang = NULL;
             text.lang_key = NULL;
 
-            if (png_set_text_2(png_ptr, info_ptr, &text, 1) != 0)
-               errmsg = "insufficient memory";
+            if (png_set_text_2(png_ptr, info_ptr, &text, 1) == 0)
+               return handled_ok;
+
+            errmsg = "out of memory";
          }
       }
 
@@ -2730,14 +2599,16 @@ png_handle_zTXt(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
          errmsg = png_ptr->zstream.msg;
    }
 
-   if (errmsg != NULL)
-      png_chunk_benign_error(png_ptr, errmsg);
+   png_chunk_benign_error(png_ptr, errmsg);
+   return handled_error;
 }
+#else
+#  define png_handle_zTXt NULL
 #endif
 
 #ifdef PNG_READ_iTXt_SUPPORTED
 /* Note: this does not correctly handle chunks that are > 64K under DOS */
-void /* PRIVATE */
+static png_handle_result_code /* PRIVATE */
 png_handle_iTXt(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
 {
    png_const_charp errmsg = NULL;
@@ -2752,37 +2623,35 @@ png_handle_iTXt(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
       if (png_ptr->user_chunk_cache_max == 1)
       {
          png_crc_finish(png_ptr, length);
-         return;
+         return handled_error;
       }
 
       if (--png_ptr->user_chunk_cache_max == 1)
       {
          png_crc_finish(png_ptr, length);
          png_chunk_benign_error(png_ptr, "no space in chunk cache");
-         return;
+         return handled_error;
       }
    }
 #endif
 
-   if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
-      png_chunk_error(png_ptr, "missing IHDR");
-
+   /* TODO: should not be necessary. */
    if ((png_ptr->mode & PNG_HAVE_IDAT) != 0)
       png_ptr->mode |= PNG_AFTER_IDAT;
 
-   buffer = png_read_buffer(png_ptr, length+1, 1/*warn*/);
+   buffer = png_read_buffer(png_ptr, length+1);
 
    if (buffer == NULL)
    {
       png_crc_finish(png_ptr, length);
       png_chunk_benign_error(png_ptr, "out of memory");
-      return;
+      return handled_error;
    }
 
    png_crc_read(png_ptr, buffer, length);
 
    if (png_crc_finish(png_ptr, 0) != 0)
-      return;
+      return handled_error;
 
    /* First the keyword. */
    for (prefix_length=0;
@@ -2872,8 +2741,10 @@ png_handle_iTXt(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
          text.text_length = 0;
          text.itxt_length = uncompressed_length;
 
-         if (png_set_text_2(png_ptr, info_ptr, &text, 1) != 0)
-            errmsg = "insufficient memory";
+         if (png_set_text_2(png_ptr, info_ptr, &text, 1) == 0)
+            return handled_ok;
+
+         errmsg = "out of memory";
       }
    }
 
@@ -2882,7 +2753,10 @@ png_handle_iTXt(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
 
    if (errmsg != NULL)
       png_chunk_benign_error(png_ptr, errmsg);
+   return handled_error;
 }
+#else
+#  define png_handle_iTXt NULL
 #endif
 
 #ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
@@ -2890,7 +2764,7 @@ png_handle_iTXt(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
 static int
 png_cache_unknown_chunk(png_structrp png_ptr, png_uint_32 length)
 {
-   png_alloc_size_t limit = PNG_SIZE_MAX;
+   const png_alloc_size_t limit = png_chunk_max(png_ptr);
 
    if (png_ptr->unknown_chunk.data != NULL)
    {
@@ -2898,16 +2772,6 @@ png_cache_unknown_chunk(png_structrp png_ptr, png_uint_32 length)
       png_ptr->unknown_chunk.data = NULL;
    }
 
-#  ifdef PNG_SET_USER_LIMITS_SUPPORTED
-   if (png_ptr->user_chunk_malloc_max > 0 &&
-       png_ptr->user_chunk_malloc_max < limit)
-      limit = png_ptr->user_chunk_malloc_max;
-
-#  elif PNG_USER_CHUNK_MALLOC_MAX > 0
-   if (PNG_USER_CHUNK_MALLOC_MAX < limit)
-      limit = PNG_USER_CHUNK_MALLOC_MAX;
-#  endif
-
    if (length <= limit)
    {
       PNG_CSTRING_FROM_CHUNK(png_ptr->unknown_chunk.name, png_ptr->chunk_name);
@@ -2946,11 +2810,11 @@ png_cache_unknown_chunk(png_structrp png_ptr, png_uint_32 length)
 #endif /* READ_UNKNOWN_CHUNKS */
 
 /* Handle an unknown, or known but disabled, chunk */
-void /* PRIVATE */
+png_handle_result_code /*PRIVATE*/
 png_handle_unknown(png_structrp png_ptr, png_inforp info_ptr,
     png_uint_32 length, int keep)
 {
-   int handled = 0; /* the chunk was handled */
+   png_handle_result_code handled = handled_discarded; /* the default */
 
    png_debug(1, "in png_handle_unknown");
 
@@ -2997,7 +2861,7 @@ png_handle_unknown(png_structrp png_ptr, png_inforp info_ptr,
           *           error at this point unless it is to be saved.
           * positive: The chunk was handled, libpng will ignore/discard it.
           */
-         if (ret < 0)
+         if (ret < 0) /* handled_error */
             png_chunk_error(png_ptr, "error in user chunk");
 
          else if (ret == 0)
@@ -3031,7 +2895,7 @@ png_handle_unknown(png_structrp png_ptr, png_inforp info_ptr,
 
          else /* chunk was handled */
          {
-            handled = 1;
+            handled = handled_ok;
             /* Critical chunks can be safely discarded at this point. */
             keep = PNG_HANDLE_CHUNK_NEVER;
          }
@@ -3116,7 +2980,7 @@ png_handle_unknown(png_structrp png_ptr, png_inforp info_ptr,
              */
             png_set_unknown_chunks(png_ptr, info_ptr,
                 &png_ptr->unknown_chunk, 1);
-            handled = 1;
+            handled = handled_saved;
 #  ifdef PNG_USER_LIMITS_SUPPORTED
             break;
       }
@@ -3142,79 +3006,267 @@ png_handle_unknown(png_structrp png_ptr, png_inforp info_ptr,
 #endif /* !READ_UNKNOWN_CHUNKS */
 
    /* Check for unhandled critical chunks */
-   if (handled == 0 && PNG_CHUNK_CRITICAL(png_ptr->chunk_name))
+   if (handled < handled_saved && PNG_CHUNK_CRITICAL(png_ptr->chunk_name))
       png_chunk_error(png_ptr, "unhandled critical chunk");
+
+   return handled;
 }
 
-/* This function is called to verify that a chunk name is valid.
- * This function can't have the "critical chunk check" incorporated
- * into it, since in the future we will need to be able to call user
- * functions to handle unknown critical chunks after we check that
- * the chunk name itself is valid.
+/* APNG handling: the minimal implementation of APNG handling in libpng 1.6
+ * requires that those significant applications which already handle APNG not
+ * get hosed.  To do this ensure the code here will have to ensure than APNG
+ * data by default (at least in 1.6) gets stored in the unknown chunk list.
+ * Maybe this can be relaxed in a few years but at present it's just the only
+ * safe way.
+ *
+ * ATM just cause unknown handling for all three chunks:
  */
+#define png_handle_acTL NULL
+#define png_handle_fcTL NULL
+#define png_handle_fdAT NULL
 
-/* Bit hacking: the test for an invalid byte in the 4 byte chunk name is:
+/*
+ * 1.6.47: This is the new table driven interface to all the chunk handling.
  *
- * ((c) < 65 || (c) > 122 || ((c) > 90 && (c) < 97))
+ * The table describes the PNG standard rules for **reading** known chunks -
+ * every chunk which has an entry in PNG_KNOWN_CHUNKS.  The table contains an
+ * entry for each PNG_INDEX_cHNK describing the rules.
+ *
+ * In this initial version the only information in the entry is the
+ * png_handle_cHNK function for the chunk in question.  When chunk support is
+ * compiled out the entry will be NULL.
  */
-
-void /* PRIVATE */
-png_check_chunk_name(png_const_structrp png_ptr, png_uint_32 chunk_name)
+static const struct
 {
-   int i;
-   png_uint_32 cn=chunk_name;
-
-   png_debug(1, "in png_check_chunk_name");
+   png_handle_result_code (*handler)(
+         png_structrp, png_inforp, png_uint_32 length);
+      /* A chunk-specific 'handler', NULL if the chunk is not supported in this
+       * build.
+       */
 
-   for (i=1; i<=4; ++i)
+   /* Crushing these values helps on modern 32-bit architectures because the
+    * pointer and the following bit fields both end up requiring 32 bits.
+    * Typically this will halve the table size.  On 64-bit architectures the
+    * table entries will typically be 8 bytes.
+    */
+   png_uint_32 max_length :12; /* Length min, max in bytes */
+   png_uint_32 min_length :8;
+      /* Length errors on critical chunks have special handling to preserve the
+       * existing behaviour in libpng 1.6.  Anciallary chunks are checked below
+       * and produce a 'benign' error.
+       */
+   png_uint_32 pos_before :4; /* PNG_HAVE_ values chunk must precede */
+   png_uint_32 pos_after  :4; /* PNG_HAVE_ values chunk must follow */
+      /* NOTE: PLTE, tRNS and bKGD require special handling which depends on
+       * the colour type of the base image.
+       */
+   png_uint_32 multiple   :1; /* Multiple occurences permitted */
+      /* This is enabled for PLTE because PLTE may, in practice, be optional */
+}
+read_chunks[PNG_INDEX_unknown] =
+{
+   /* Definitions as above but done indirectly by #define so that
+    * PNG_KNOWN_CHUNKS can be used safely to build the table in order.
+    *
+    * Each CDcHNK definition lists the values for the parameters **after**
+    * the first, 'handler', function.  'handler' is NULL when the chunk has no
+    * compiled in support.
+    */
+#  define NoCheck 0x801U      /* Do not check the maximum length */
+#  define Limit   0x802U      /* Limit to png_chunk_max bytes */
+#  define LKMin   3U+LZ77Min  /* Minimum length of keyword+LZ77 */
+
+#define hIHDR PNG_HAVE_IHDR
+#define hPLTE PNG_HAVE_PLTE
+#define hIDAT PNG_HAVE_IDAT
+   /* For the two chunks, tRNS and bKGD which can occur in PNGs without a PLTE
+    * but must occur after the PLTE use this and put the check in the handler
+    * routine for colour mapped images were PLTE is required.  Also put a check
+    * in PLTE for other image types to drop the PLTE if tRNS or bKGD have been
+    * seen.
+    */
+#define hCOL  (PNG_HAVE_PLTE|PNG_HAVE_IDAT)
+   /* Used for the decoding chunks which must be before PLTE. */
+#define aIDAT PNG_AFTER_IDAT
+
+   /* Chunks from W3C PNG v3: */
+   /*       cHNK  max_len,   min, before, after, multiple */
+#  define CDIHDR      13U,   13U,  hIHDR,     0,        0
+#  define CDPLTE  NoCheck,    0U,      0, hIHDR,        1
+      /* PLTE errors are only critical for colour-map images, consequently the
+       * hander does all the checks.
+       */
+#  define CDIDAT  NoCheck,    0U,  aIDAT, hIHDR,        1
+#  define CDIEND  NoCheck,    0U,      0, aIDAT,        0
+      /* Historically data was allowed in IEND */
+#  define CDtRNS     256U,    0U,  hIDAT, hIHDR,        0
+#  define CDcHRM      32U,   32U,   hCOL, hIHDR,        0
+#  define CDgAMA       4U,    4U,   hCOL, hIHDR,        0
+#  define CDiCCP  NoCheck, LKMin,   hCOL, hIHDR,        0
+#  define CDsBIT       4U,    1U,   hCOL, hIHDR,        0
+#  define CDsRGB       1U,    1U,   hCOL, hIHDR,        0
+#  define CDcICP       4U,    4U,   hCOL, hIHDR,        0
+#  define CDmDCV      24U,   24U,   hCOL, hIHDR,        0
+#  define CDeXIf    Limit,    4U,      0, hIHDR,        0
+#  define CDcLLI       8U,    8U,   hCOL, hIHDR,        0
+#  define CDtEXt  NoCheck,    2U,      0, hIHDR,        1
+      /* Allocates 'length+1'; checked in the handler */
+#  define CDzTXt    Limit, LKMin,      0, hIHDR,        1
+#  define CDiTXt  NoCheck,    6U,      0, hIHDR,        1
+      /* Allocates 'length+1'; checked in the handler */
+#  define CDbKGD       6U,    1U,  hIDAT, hIHDR,        0
+#  define CDhIST    1024U,    0U,  hPLTE, hIHDR,        0
+#  define CDpHYs       9U,    9U,  hIDAT, hIHDR,        0
+#  define CDsPLT  NoCheck,    3U,  hIDAT, hIHDR,        1
+      /* Allocates 'length+1'; checked in the handler */
+#  define CDtIME       7U,    7U,      0, hIHDR,        0
+#  define CDacTL       8U,    8U,  hIDAT, hIHDR,        0
+#  define CDfcTL      25U,   26U,      0, hIHDR,        1
+#  define CDfdAT    Limit,    4U,  hIDAT, hIHDR,        1
+   /* Supported chunks from PNG extensions 1.5.0, NYI so limit */
+#  define CDoFFs       9U,    9U,  hIDAT, hIHDR,        0
+#  define CDpCAL  NoCheck,   14U,  hIDAT, hIHDR,        0
+      /* Allocates 'length+1'; checked in the handler */
+#  define CDsCAL    Limit,    4U,  hIDAT, hIHDR,        0
+      /* Allocates 'length+1'; checked in the handler */
+
+#  define PNG_CHUNK(cHNK, index) { png_handle_ ## cHNK, CD ## cHNK },
+   PNG_KNOWN_CHUNKS
+#  undef PNG_CHUNK
+};
+
+
+static png_index
+png_chunk_index_from_name(png_uint_32 chunk_name)
+{
+   /* For chunk png_cHNK return PNG_INDEX_cHNK.  Return PNG_INDEX_unknown if
+    * chunk_name is not known.  Notice that in a particular build "known" does
+    * not necessarily mean "supported", although the inverse applies.
+    */
+   switch (chunk_name)
    {
-      int c = cn & 0xff;
+#     define PNG_CHUNK(cHNK, index)\
+         case png_ ## cHNK: return PNG_INDEX_ ## cHNK; /* == index */
+
+      PNG_KNOWN_CHUNKS
 
-      if (c < 65 || c > 122 || (c > 90 && c < 97))
-         png_chunk_error(png_ptr, "invalid chunk type");
+#     undef PNG_CHUNK
 
-      cn >>= 8;
+      default: return PNG_INDEX_unknown;
    }
 }
 
-void /* PRIVATE */
-png_check_chunk_length(png_const_structrp png_ptr, png_uint_32 length)
+png_handle_result_code /*PRIVATE*/
+png_handle_chunk(png_structrp png_ptr, png_inforp info_ptr, png_uint_32 length)
 {
-   png_alloc_size_t limit = PNG_UINT_31_MAX;
-
-# ifdef PNG_SET_USER_LIMITS_SUPPORTED
-   if (png_ptr->user_chunk_malloc_max > 0 &&
-       png_ptr->user_chunk_malloc_max < limit)
-      limit = png_ptr->user_chunk_malloc_max;
-# elif PNG_USER_CHUNK_MALLOC_MAX > 0
-   if (PNG_USER_CHUNK_MALLOC_MAX < limit)
-      limit = PNG_USER_CHUNK_MALLOC_MAX;
-# endif
-   if (png_ptr->chunk_name == png_IDAT)
+   /* CSE: these things don't change, these autos are just to save typing and
+    * make the code more clear.
+    */
+   const png_uint_32 chunk_name = png_ptr->chunk_name;
+   const png_index chunk_index = png_chunk_index_from_name(chunk_name);
+
+   png_handle_result_code handled = handled_error;
+   png_const_charp errmsg = NULL;
+
+   /* Is this a known chunk?  If not there are no checks performed here;
+    * png_handle_unknown does the correct checks.  This means that the values
+    * for known but unsupported chunks in the above table are not used here
+    * however the chunks_seen fields in png_struct are still set.
+    */
+   if (chunk_index == PNG_INDEX_unknown ||
+       read_chunks[chunk_index].handler == NULL)
    {
-      png_alloc_size_t idat_limit = PNG_UINT_31_MAX;
-      size_t row_factor =
-         (size_t)png_ptr->width
-         * (size_t)png_ptr->channels
-         * (png_ptr->bit_depth > 8? 2: 1)
-         + 1
-         + (png_ptr->interlaced? 6: 0);
-      if (png_ptr->height > PNG_UINT_32_MAX/row_factor)
-         idat_limit = PNG_UINT_31_MAX;
-      else
-         idat_limit = png_ptr->height * row_factor;
-      row_factor = row_factor > 32566? 32566 : row_factor;
-      idat_limit += 6 + 5*(idat_limit/row_factor+1); /* zlib+deflate overhead */
-      idat_limit=idat_limit < PNG_UINT_31_MAX? idat_limit : PNG_UINT_31_MAX;
-      limit = limit < idat_limit? idat_limit : limit;
+      handled = png_handle_unknown(
+            png_ptr, info_ptr, length, PNG_HANDLE_CHUNK_AS_DEFAULT);
+   }
+
+   /* First check the position.   The first check is historical; the stream must
+    * start with IHDR and anything else causes libpng to give up immediately.
+    */
+   else if (chunk_index != PNG_INDEX_IHDR &&
+            (png_ptr->mode & PNG_HAVE_IHDR) == 0)
+      png_chunk_error(png_ptr, "missing IHDR"); /* NORETURN */
+
+   /* Before all the pos_before chunks, after all the pos_after chunks. */
+   else if (((png_ptr->mode & read_chunks[chunk_index].pos_before) != 0) ||
+            ((png_ptr->mode & read_chunks[chunk_index].pos_after) !=
+             read_chunks[chunk_index].pos_after))
+   {
+      errmsg = "out of place";
+   }
+
+   /* Now check for duplicates: duplicated critical chunks also produce a
+    * full error.
+    */
+   else if (read_chunks[chunk_index].multiple == 0 &&
+            png_file_has_chunk(png_ptr, chunk_index))
+   {
+      errmsg = "duplicate";
+   }
+
+   else if (length < read_chunks[chunk_index].min_length)
+      errmsg = "too short";
+   else
+   {
+      /* NOTE: apart from IHDR the critical chunks (PLTE, IDAT and IEND) are set
+       * up above not to do any length checks.
+       *
+       * The png_chunk_max check ensures that the variable length chunks are
+       * always checked at this point for being within the system allocation
+       * limits.
+       */
+      unsigned max_length = read_chunks[chunk_index].max_length;
+
+      switch (max_length)
+      {
+         case Limit:
+            /* png_read_chunk_header has already png_error'ed chunks with a
+             * length exceeding the 31-bit PNG limit, so just check the memory
+             * limit:
+             */
+            if (length <= png_chunk_max(png_ptr))
+               goto MeetsLimit;
+
+            errmsg = "length exceeds libpng limit";
+            break;
+
+         default:
+            if (length <= max_length)
+               goto MeetsLimit;
+
+            errmsg = "too long";
+            break;
+
+         case NoCheck:
+         MeetsLimit:
+            handled = read_chunks[chunk_index].handler(
+                  png_ptr, info_ptr, length);
+            break;
+      }
+   }
+
+   /* If there was an error or the chunk was simply skipped it is not counted as
+    * 'seen'.
+    */
+   if (errmsg != NULL)
+   {
+      if (PNG_CHUNK_CRITICAL(chunk_name)) /* stop immediately */
+         png_chunk_error(png_ptr, errmsg);
+      else /* ancillary chunk */
+      {
+         /* The chunk data is skipped: */
+         png_crc_finish(png_ptr, length);
+         png_chunk_benign_error(png_ptr, errmsg);
+      }
    }
 
-   if (length > limit)
+   else if (handled >= handled_saved)
    {
-      png_debug2(0," length = %lu, limit = %lu",
-         (unsigned long)length,(unsigned long)limit);
-      png_benign_error(png_ptr, "chunk data is too large");
+      if (chunk_index != PNG_INDEX_unknown)
+         png_file_add_chunk(png_ptr, chunk_index);
    }
+
+   return handled;
 }
 
 /* Combines the row recently read in with the existing pixels in the row.  This
@@ -3712,10 +3764,6 @@ void /* PRIVATE */
 png_do_read_interlace(png_row_infop row_info, png_bytep row, int pass,
     png_uint_32 transformations /* Because these may affect the byte layout */)
 {
-   /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
-   /* Offset to next interlace block */
-   static const unsigned int png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
-
    png_debug(1, "in png_do_read_interlace");
    if (row != NULL && row_info != NULL)
    {
@@ -4208,6 +4256,9 @@ png_read_IDAT_data(png_structrp png_ptr, png_bytep output,
 
          avail_in = png_ptr->IDAT_read_size;
 
+         if (avail_in > png_chunk_max(png_ptr))
+            avail_in = (uInt)/*SAFE*/png_chunk_max(png_ptr);
+
          if (avail_in > png_ptr->idat_size)
             avail_in = (uInt)png_ptr->idat_size;
 
@@ -4215,8 +4266,13 @@ png_read_IDAT_data(png_structrp png_ptr, png_bytep output,
           * to minimize memory usage by causing lots of re-allocs, but
           * realistically doing IDAT_read_size re-allocs is not likely to be a
           * big problem.
+          *
+          * An error here corresponds to the system being out of memory.
           */
-         buffer = png_read_buffer(png_ptr, avail_in, 0/*error*/);
+         buffer = png_read_buffer(png_ptr, avail_in);
+
+         if (buffer == NULL)
+            png_chunk_error(png_ptr, "out of memory");
 
          png_crc_read(png_ptr, buffer, avail_in);
          png_ptr->idat_size -= avail_in;
@@ -4353,20 +4409,6 @@ png_read_finish_IDAT(png_structrp png_ptr)
 void /* PRIVATE */
 png_read_finish_row(png_structrp png_ptr)
 {
-   /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
-
-   /* Start of interlace block */
-   static const png_byte png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};
-
-   /* Offset to next interlace block */
-   static const png_byte png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
-
-   /* Start of interlace block in the y direction */
-   static const png_byte png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1};
-
-   /* Offset to next interlace block in the y direction */
-   static const png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
-
    png_debug(1, "in png_read_finish_row");
    png_ptr->row_number++;
    if (png_ptr->row_number < png_ptr->num_rows)
@@ -4418,20 +4460,6 @@ png_read_finish_row(png_structrp png_ptr)
 void /* PRIVATE */
 png_read_start_row(png_structrp png_ptr)
 {
-   /* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
-
-   /* Start of interlace block */
-   static const png_byte png_pass_start[7] = {0, 4, 0, 2, 0, 1, 0};
-
-   /* Offset to next interlace block */
-   static const png_byte png_pass_inc[7] = {8, 8, 4, 4, 2, 2, 1};
-
-   /* Start of interlace block in the y direction */
-   static const png_byte png_pass_ystart[7] = {0, 0, 4, 0, 2, 0, 1};
-
-   /* Offset to next interlace block in the y direction */
-   static const png_byte png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2};
-
    unsigned int max_pixel_depth;
    size_t row_bytes;
 
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/pngset.c b/src/java.desktop/share/native/libsplashscreen/libpng/pngset.c
index f53ab6fa1d18..1bfd292bd463 100644
--- a/src/java.desktop/share/native/libsplashscreen/libpng/pngset.c
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/pngset.c
@@ -29,7 +29,7 @@
  * However, the following notice accompanied the original version of this
  * file and, per its terms, should not be removed:
  *
- * Copyright (c) 2018-2024 Cosmin Truta
+ * Copyright (c) 2018-2025 Cosmin Truta
  * Copyright (c) 1998-2018 Glenn Randers-Pehrson
  * Copyright (c) 1996-1997 Andreas Dilger
  * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
@@ -70,27 +70,21 @@ png_set_cHRM_fixed(png_const_structrp png_ptr, png_inforp info_ptr,
     png_fixed_point red_y, png_fixed_point green_x, png_fixed_point green_y,
     png_fixed_point blue_x, png_fixed_point blue_y)
 {
-   png_xy xy;
-
    png_debug1(1, "in %s storage function", "cHRM fixed");
 
    if (png_ptr == NULL || info_ptr == NULL)
       return;
 
-   xy.redx = red_x;
-   xy.redy = red_y;
-   xy.greenx = green_x;
-   xy.greeny = green_y;
-   xy.bluex = blue_x;
-   xy.bluey = blue_y;
-   xy.whitex = white_x;
-   xy.whitey = white_y;
-
-   if (png_colorspace_set_chromaticities(png_ptr, &info_ptr->colorspace, &xy,
-       2/* override with app values*/) != 0)
-      info_ptr->colorspace.flags |= PNG_COLORSPACE_FROM_cHRM;
+   info_ptr->cHRM.redx = red_x;
+   info_ptr->cHRM.redy = red_y;
+   info_ptr->cHRM.greenx = green_x;
+   info_ptr->cHRM.greeny = green_y;
+   info_ptr->cHRM.bluex = blue_x;
+   info_ptr->cHRM.bluey = blue_y;
+   info_ptr->cHRM.whitex = white_x;
+   info_ptr->cHRM.whitey = white_y;
 
-   png_colorspace_sync_info(png_ptr, info_ptr);
+   info_ptr->valid |= PNG_INFO_cHRM;
 }
 
 void PNGFAPI
@@ -102,6 +96,7 @@ png_set_cHRM_XYZ_fixed(png_const_structrp png_ptr, png_inforp info_ptr,
     png_fixed_point int_blue_Z)
 {
    png_XYZ XYZ;
+   png_xy xy;
 
    png_debug1(1, "in %s storage function", "cHRM XYZ fixed");
 
@@ -118,11 +113,14 @@ png_set_cHRM_XYZ_fixed(png_const_structrp png_ptr, png_inforp info_ptr,
    XYZ.blue_Y = int_blue_Y;
    XYZ.blue_Z = int_blue_Z;
 
-   if (png_colorspace_set_endpoints(png_ptr, &info_ptr->colorspace,
-       &XYZ, 2) != 0)
-      info_ptr->colorspace.flags |= PNG_COLORSPACE_FROM_cHRM;
+   if (png_xy_from_XYZ(&xy, &XYZ) == 0)
+   {
+      info_ptr->cHRM = xy;
+      info_ptr->valid |= PNG_INFO_cHRM;
+   }
 
-   png_colorspace_sync_info(png_ptr, info_ptr);
+   else
+      png_app_error(png_ptr, "invalid cHRM XYZ");
 }
 
 #  ifdef PNG_FLOATING_POINT_SUPPORTED
@@ -162,6 +160,192 @@ png_set_cHRM_XYZ(png_const_structrp png_ptr, png_inforp info_ptr, double red_X,
 
 #endif /* cHRM */
 
+#ifdef PNG_cICP_SUPPORTED
+void PNGAPI
+png_set_cICP(png_const_structrp png_ptr, png_inforp info_ptr,
+             png_byte colour_primaries, png_byte transfer_function,
+             png_byte matrix_coefficients, png_byte video_full_range_flag)
+{
+   png_debug1(1, "in %s storage function", "cICP");
+
+   if (png_ptr == NULL || info_ptr == NULL)
+      return;
+
+   info_ptr->cicp_colour_primaries = colour_primaries;
+   info_ptr->cicp_transfer_function = transfer_function;
+   info_ptr->cicp_matrix_coefficients = matrix_coefficients;
+   info_ptr->cicp_video_full_range_flag = video_full_range_flag;
+
+   if (info_ptr->cicp_matrix_coefficients != 0)
+   {
+      png_warning(png_ptr, "Invalid cICP matrix coefficients");
+      return;
+   }
+
+   info_ptr->valid |= PNG_INFO_cICP;
+}
+#endif /* cICP */
+
+#ifdef PNG_cLLI_SUPPORTED
+void PNGFAPI
+png_set_cLLI_fixed(png_const_structrp png_ptr, png_inforp info_ptr,
+    /* The values below are in cd/m2 (nits) and are scaled by 10,000; not
+     * 100,000 as in the case of png_fixed_point.
+     */
+    png_uint_32 maxCLL, png_uint_32 maxFALL)
+{
+   png_debug1(1, "in %s storage function", "cLLI");
+
+   if (png_ptr == NULL || info_ptr == NULL)
+      return;
+
+   /* Check the light level range: */
+   if (maxCLL > 0x7FFFFFFFU || maxFALL > 0x7FFFFFFFU)
+   {
+      /* The limit is 200kcd/m2; somewhat bright but not inconceivable because
+       * human vision is said to run up to 100Mcd/m2.  The sun is about 2Gcd/m2.
+       *
+       * The reference sRGB monitor is 80cd/m2 and the limit of PQ encoding is
+       * 2kcd/m2.
+       */
+      png_chunk_report(png_ptr, "cLLI light level exceeds PNG limit",
+            PNG_CHUNK_WRITE_ERROR);
+      return;
+   }
+
+   info_ptr->maxCLL = maxCLL;
+   info_ptr->maxFALL = maxFALL;
+   info_ptr->valid |= PNG_INFO_cLLI;
+}
+
+#  ifdef PNG_FLOATING_POINT_SUPPORTED
+void PNGAPI
+png_set_cLLI(png_const_structrp png_ptr, png_inforp info_ptr,
+   double maxCLL, double maxFALL)
+{
+   png_set_cLLI_fixed(png_ptr, info_ptr,
+       png_fixed_ITU(png_ptr, maxCLL, "png_set_cLLI(maxCLL)"),
+       png_fixed_ITU(png_ptr, maxFALL, "png_set_cLLI(maxFALL)"));
+}
+#  endif /* FLOATING_POINT */
+#endif /* cLLI */
+
+#ifdef PNG_mDCV_SUPPORTED
+static png_uint_16
+png_ITU_fixed_16(int *error, png_fixed_point v)
+{
+   /* Return a safe uint16_t value scaled according to the ITU H273 rules for
+    * 16-bit display chromaticities.  Functions like the corresponding
+    * png_fixed() internal function with regard to errors: it's an error on
+    * write, a chunk_benign_error on read: See the definition of
+    * png_chunk_report in pngpriv.h.
+    */
+   v /= 2; /* rounds to 0 in C: avoids insignificant arithmetic errors */
+   if (v > 65535 || v < 0)
+   {
+      *error = 1;
+      return 0;
+   }
+
+   return (png_uint_16)/*SAFE*/v;
+}
+
+void PNGAPI
+png_set_mDCV_fixed(png_const_structrp png_ptr, png_inforp info_ptr,
+    png_fixed_point white_x, png_fixed_point white_y,
+    png_fixed_point red_x, png_fixed_point red_y,
+    png_fixed_point green_x, png_fixed_point green_y,
+    png_fixed_point blue_x, png_fixed_point blue_y,
+    png_uint_32 maxDL,
+    png_uint_32 minDL)
+{
+   png_uint_16 rx, ry, gx, gy, bx, by, wx, wy;
+   int error;
+
+   png_debug1(1, "in %s storage function", "mDCV");
+
+   if (png_ptr == NULL || info_ptr == NULL)
+      return;
+
+   /* Check the input values to ensure they are in the expected range: */
+   error = 0;
+   rx = png_ITU_fixed_16(&error, red_x);
+   ry = png_ITU_fixed_16(&error, red_y);
+   gx = png_ITU_fixed_16(&error, green_x);
+   gy = png_ITU_fixed_16(&error, green_y);
+   bx = png_ITU_fixed_16(&error, blue_x);
+   by = png_ITU_fixed_16(&error, blue_y);
+   wx = png_ITU_fixed_16(&error, white_x);
+   wy = png_ITU_fixed_16(&error, white_y);
+
+   if (error)
+   {
+      png_chunk_report(png_ptr,
+         "mDCV chromaticities outside representable range",
+         PNG_CHUNK_WRITE_ERROR);
+      return;
+   }
+
+   /* Check the light level range: */
+   if (maxDL > 0x7FFFFFFFU || minDL > 0x7FFFFFFFU)
+   {
+      /* The limit is 200kcd/m2; somewhat bright but not inconceivable because
+       * human vision is said to run up to 100Mcd/m2.  The sun is about 2Gcd/m2.
+       *
+       * The reference sRGB monitor is 80cd/m2 and the limit of PQ encoding is
+       * 2kcd/m2.
+       */
+      png_chunk_report(png_ptr, "mDCV display light level exceeds PNG limit",
+            PNG_CHUNK_WRITE_ERROR);
+      return;
+   }
+
+   /* All values are safe, the settings are accepted.
+    *
+    * IMPLEMENTATION NOTE: in practice the values can be checked and assigned
+    * but the result is confusing if a writing app calls png_set_mDCV more than
+    * once, the second time with an invalid value.  This approach is more
+    * obviously correct at the cost of typing and a very slight machine
+    * overhead.
+    */
+   info_ptr->mastering_red_x = rx;
+   info_ptr->mastering_red_y = ry;
+   info_ptr->mastering_green_x = gx;
+   info_ptr->mastering_green_y = gy;
+   info_ptr->mastering_blue_x = bx;
+   info_ptr->mastering_blue_y = by;
+   info_ptr->mastering_white_x = wx;
+   info_ptr->mastering_white_y = wy;
+   info_ptr->mastering_maxDL = maxDL;
+   info_ptr->mastering_minDL = minDL;
+   info_ptr->valid |= PNG_INFO_mDCV;
+}
+
+#  ifdef PNG_FLOATING_POINT_SUPPORTED
+void PNGAPI
+png_set_mDCV(png_const_structrp png_ptr, png_inforp info_ptr,
+    double white_x, double white_y, double red_x, double red_y, double green_x,
+    double green_y, double blue_x, double blue_y,
+    double maxDL, double minDL)
+{
+   png_set_mDCV_fixed(png_ptr, info_ptr,
+      /* The ITU approach is to scale by 50,000, not 100,000 so just divide
+       * the input values by 2 and use png_fixed:
+       */
+      png_fixed(png_ptr, white_x / 2, "png_set_mDCV(white(x))"),
+      png_fixed(png_ptr, white_y / 2, "png_set_mDCV(white(y))"),
+      png_fixed(png_ptr, red_x / 2, "png_set_mDCV(red(x))"),
+      png_fixed(png_ptr, red_y / 2, "png_set_mDCV(red(y))"),
+      png_fixed(png_ptr, green_x / 2, "png_set_mDCV(green(x))"),
+      png_fixed(png_ptr, green_y / 2, "png_set_mDCV(green(y))"),
+      png_fixed(png_ptr, blue_x / 2, "png_set_mDCV(blue(x))"),
+      png_fixed(png_ptr, blue_y / 2, "png_set_mDCV(blue(y))"),
+      png_fixed_ITU(png_ptr, maxDL, "png_set_mDCV(maxDL)"),
+      png_fixed_ITU(png_ptr, minDL, "png_set_mDCV(minDL)"));
+}
+#  endif /* FLOATING_POINT */
+#endif /* mDCV */
+
 #ifdef PNG_eXIf_SUPPORTED
 void PNGAPI
 png_set_eXIf(png_const_structrp png_ptr, png_inforp info_ptr,
@@ -213,8 +397,8 @@ png_set_gAMA_fixed(png_const_structrp png_ptr, png_inforp info_ptr,
    if (png_ptr == NULL || info_ptr == NULL)
       return;
 
-   png_colorspace_set_gamma(png_ptr, &info_ptr->colorspace, file_gamma);
-   png_colorspace_sync_info(png_ptr, info_ptr);
+   info_ptr->gamma = file_gamma;
+   info_ptr->valid |= PNG_INFO_gAMA;
 }
 
 #  ifdef PNG_FLOATING_POINT_SUPPORTED
@@ -673,8 +857,8 @@ png_set_sRGB(png_const_structrp png_ptr, png_inforp info_ptr, int srgb_intent)
    if (png_ptr == NULL || info_ptr == NULL)
       return;
 
-   (void)png_colorspace_set_sRGB(png_ptr, &info_ptr->colorspace, srgb_intent);
-   png_colorspace_sync_info(png_ptr, info_ptr);
+   info_ptr->rendering_intent = srgb_intent;
+   info_ptr->valid |= PNG_INFO_sRGB;
 }
 
 void PNGAPI
@@ -686,15 +870,20 @@ png_set_sRGB_gAMA_and_cHRM(png_const_structrp png_ptr, png_inforp info_ptr,
    if (png_ptr == NULL || info_ptr == NULL)
       return;
 
-   if (png_colorspace_set_sRGB(png_ptr, &info_ptr->colorspace,
-       srgb_intent) != 0)
-   {
-      /* This causes the gAMA and cHRM to be written too */
-      info_ptr->colorspace.flags |=
-         PNG_COLORSPACE_FROM_gAMA|PNG_COLORSPACE_FROM_cHRM;
-   }
+   png_set_sRGB(png_ptr, info_ptr, srgb_intent);
+
+#  ifdef PNG_gAMA_SUPPORTED
+      png_set_gAMA_fixed(png_ptr, info_ptr, PNG_GAMMA_sRGB_INVERSE);
+#  endif /* gAMA */
 
-   png_colorspace_sync_info(png_ptr, info_ptr);
+#  ifdef PNG_cHRM_SUPPORTED
+      png_set_cHRM_fixed(png_ptr, info_ptr,
+         /* color      x       y */
+         /* white */ 31270, 32900,
+         /* red   */ 64000, 33000,
+         /* green */ 30000, 60000,
+         /* blue  */ 15000,  6000);
+#  endif /* cHRM */
 }
 #endif /* sRGB */
 
@@ -717,27 +906,6 @@ png_set_iCCP(png_const_structrp png_ptr, png_inforp info_ptr,
    if (compression_type != PNG_COMPRESSION_TYPE_BASE)
       png_app_error(png_ptr, "Invalid iCCP compression method");
 
-   /* Set the colorspace first because this validates the profile; do not
-    * override previously set app cHRM or gAMA here (because likely as not the
-    * application knows better than libpng what the correct values are.)  Pass
-    * the info_ptr color_type field to png_colorspace_set_ICC because in the
-    * write case it has not yet been stored in png_ptr.
-    */
-   {
-      int result = png_colorspace_set_ICC(png_ptr, &info_ptr->colorspace, name,
-          proflen, profile, info_ptr->color_type);
-
-      png_colorspace_sync_info(png_ptr, info_ptr);
-
-      /* Don't do any of the copying if the profile was bad, or inconsistent. */
-      if (result == 0)
-         return;
-
-      /* But do write the gAMA and cHRM chunks from the profile. */
-      info_ptr->colorspace.flags |=
-         PNG_COLORSPACE_FROM_gAMA|PNG_COLORSPACE_FROM_cHRM;
-   }
-
    length = strlen(name)+1;
    new_iccp_name = png_voidcast(png_charp, png_malloc_warn(png_ptr, length));
 
@@ -1423,11 +1591,14 @@ png_set_keep_unknown_chunks(png_structrp png_ptr, int keep,
       static const png_byte chunks_to_ignore[] = {
          98,  75,  71,  68, '\0',  /* bKGD */
          99,  72,  82,  77, '\0',  /* cHRM */
+         99,  73,  67,  80, '\0',  /* cICP */
+         99,  76,  76,  73, '\0',  /* cLLI */
         101,  88,  73, 102, '\0',  /* eXIf */
         103,  65,  77,  65, '\0',  /* gAMA */
         104,  73,  83,  84, '\0',  /* hIST */
         105,  67,  67,  80, '\0',  /* iCCP */
         105,  84,  88, 116, '\0',  /* iTXt */
+        109,  68,  67,  86, '\0',  /* mDCV */
         111,  70,  70, 115, '\0',  /* oFFs */
         112,  67,  65,  76, '\0',  /* pCAL */
         112,  72,  89, 115, '\0',  /* pHYs */
@@ -1689,8 +1860,24 @@ png_set_chunk_malloc_max(png_structrp png_ptr,
 {
    png_debug(1, "in png_set_chunk_malloc_max");
 
+   /* pngstruct::user_chunk_malloc_max is initialized to a non-zero value in
+    * png.c.  This API supports '0' for unlimited, make sure the correct
+    * (unlimited) value is set here to avoid a need to check for 0 everywhere
+    * the parameter is used.
+    */
    if (png_ptr != NULL)
-      png_ptr->user_chunk_malloc_max = user_chunk_malloc_max;
+   {
+      if (user_chunk_malloc_max == 0U) /* unlimited */
+      {
+#        ifdef PNG_MAX_MALLOC_64K
+            png_ptr->user_chunk_malloc_max = 65536U;
+#        else
+            png_ptr->user_chunk_malloc_max = PNG_SIZE_MAX;
+#        endif
+      }
+      else
+         png_ptr->user_chunk_malloc_max = user_chunk_malloc_max;
+   }
 }
 #endif /* ?SET_USER_LIMITS */
 
diff --git a/src/java.desktop/share/native/libsplashscreen/libpng/pngstruct.h b/src/java.desktop/share/native/libsplashscreen/libpng/pngstruct.h
index f153bdec6020..d6c446564d12 100644
--- a/src/java.desktop/share/native/libsplashscreen/libpng/pngstruct.h
+++ b/src/java.desktop/share/native/libsplashscreen/libpng/pngstruct.h
@@ -98,13 +98,7 @@ typedef struct png_compression_buffer
 
 /* Colorspace support; structures used in png_struct, png_info and in internal
  * functions to hold and communicate information about the color space.
- *
- * PNG_COLORSPACE_SUPPORTED is only required if the application will perform
- * colorspace corrections, otherwise all the colorspace information can be
- * skipped and the size of libpng can be reduced (significantly) by compiling
- * out the colorspace support.
  */
-#ifdef PNG_COLORSPACE_SUPPORTED
 /* The chromaticities of the red, green and blue colorants and the chromaticity
  * of the corresponding white point (i.e. of rgb(1.0,1.0,1.0)).
  */
@@ -125,48 +119,36 @@ typedef struct png_XYZ
    png_fixed_point green_X, green_Y, green_Z;
    png_fixed_point blue_X, blue_Y, blue_Z;
 } png_XYZ;
-#endif /* COLORSPACE */
 
-#if defined(PNG_COLORSPACE_SUPPORTED) || defined(PNG_GAMMA_SUPPORTED)
-/* A colorspace is all the above plus, potentially, profile information;
- * however at present libpng does not use the profile internally so it is only
- * stored in the png_info struct (if iCCP is supported.)  The rendering intent
- * is retained here and is checked.
- *
- * The file gamma encoding information is also stored here and gamma correction
- * is done by libpng, whereas color correction must currently be done by the
- * application.
+/* Chunk index values as an enum, PNG_INDEX_unknown is also a count of the
+ * number of chunks.
  */
-typedef struct png_colorspace
+#define PNG_CHUNK(cHNK, i) PNG_INDEX_ ## cHNK = (i),
+typedef enum
 {
-#ifdef PNG_GAMMA_SUPPORTED
-   png_fixed_point gamma;        /* File gamma */
-#endif
+   PNG_KNOWN_CHUNKS
+   PNG_INDEX_unknown
+} png_index;
+#undef PNG_CHUNK
 
-#ifdef PNG_COLORSPACE_SUPPORTED
-   png_xy      end_points_xy;    /* End points as chromaticities */
-   png_XYZ     end_points_XYZ;   /* End points as CIE XYZ colorant values */
-   png_uint_16 rendering_intent; /* Rendering intent of a profile */
-#endif
-
-   /* Flags are always defined to simplify the code. */
-   png_uint_16 flags;            /* As defined below */
-} png_colorspace, * PNG_RESTRICT png_colorspacerp;
+/* Chunk flag values.  These are (png_uint_32 values) with exactly one bit set
+ * and can be combined into a flag set with bitwise 'or'.
+ *
+ * TODO: C23: convert these macros to C23 inlines (which are static).
+ */
+#define png_chunk_flag_from_index(i) (0x80000000U >> (31 - (i)))
+   /* The flag coresponding to the given png_index enum value.  This is defined
+    * for png_unknown as well (until it reaches the value 32) but this should
+    * not be relied on.
+    */
 
-typedef const png_colorspace * PNG_RESTRICT png_const_colorspacerp;
+#define png_file_has_chunk(png_ptr, i)\
+   (((png_ptr)->chunks & png_chunk_flag_from_index(i)) != 0)
+   /* The chunk has been recorded in png_struct */
 
-/* General flags for the 'flags' field */
-#define PNG_COLORSPACE_HAVE_GAMMA           0x0001
-#define PNG_COLORSPACE_HAVE_ENDPOINTS       0x0002
-#define PNG_COLORSPACE_HAVE_INTENT          0x0004
-#define PNG_COLORSPACE_FROM_gAMA            0x0008
-#define PNG_COLORSPACE_FROM_cHRM            0x0010
-#define PNG_COLORSPACE_FROM_sRGB            0x0020
-#define PNG_COLORSPACE_ENDPOINTS_MATCH_sRGB 0x0040
-#define PNG_COLORSPACE_MATCHES_sRGB         0x0080 /* exact match on profile */
-#define PNG_COLORSPACE_INVALID              0x8000
-#define PNG_COLORSPACE_CANCEL(flags)        (0xffff ^ (flags))
-#endif /* COLORSPACE || GAMMA */
+#define png_file_add_chunk(pnt_ptr, i)\
+   ((void)((png_ptr)->chunks |= png_chunk_flag_from_index(i)))
+   /* Record the chunk in the png_struct */
 
 struct png_struct_def
 {
@@ -238,6 +220,11 @@ struct png_struct_def
    int zlib_set_strategy;
 #endif
 
+   png_uint_32 chunks; /* PNG_CF_ for every chunk read or (NYI) written */
+#  define png_has_chunk(png_ptr, cHNK)\
+      png_file_has_chunk(png_ptr, PNG_INDEX_ ## cHNK)
+      /* Convenience accessor - use this to check for a known chunk by name */
+
    png_uint_32 width;         /* width of image in pixels */
    png_uint_32 height;        /* height of image in pixels */
    png_uint_32 num_rows;      /* number of rows in current pass */
@@ -314,9 +301,16 @@ struct png_struct_def
    png_uint_32 flush_rows;    /* number of rows written since last flush */
 #endif
 
+#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
+   png_xy          chromaticities; /* From mDVC, cICP, [iCCP], sRGB or cHRM */
+#endif
+
 #ifdef PNG_READ_GAMMA_SUPPORTED
    int gamma_shift;      /* number of "insignificant" bits in 16-bit gamma */
-   png_fixed_point screen_gamma; /* screen gamma value (display_exponent) */
+   png_fixed_point screen_gamma; /* screen gamma value (display exponent) */
+   png_fixed_point file_gamma;   /* file gamma value (encoding exponent) */
+   png_fixed_point chunk_gamma;  /* from cICP, iCCP, sRGB or gAMA */
+   png_fixed_point default_gamma;/* from png_set_alpha_mode */
 
    png_bytep gamma_table;     /* gamma table for 8-bit depth files */
    png_uint_16pp gamma_16_table; /* gamma table for 16-bit depth files */
@@ -328,7 +322,7 @@ struct png_struct_def
    png_uint_16pp gamma_16_from_1; /* converts from 1.0 to screen */
    png_uint_16pp gamma_16_to_1; /* converts from file to 1.0 */
 #endif /* READ_BACKGROUND || READ_ALPHA_MODE || RGB_TO_GRAY */
-#endif
+#endif /* READ_GAMMA */
 
 #if defined(PNG_READ_GAMMA_SUPPORTED) || defined(PNG_sBIT_SUPPORTED)
    png_color_8 sig_bit;       /* significant bits in each available channel */
@@ -378,8 +372,8 @@ struct png_struct_def
 /* To do: remove this from libpng-1.7 */
 #ifdef PNG_TIME_RFC1123_SUPPORTED
    char time_buffer[29]; /* String to hold RFC 1123 time text */
-#endif
-#endif
+#endif /* TIME_RFC1123 */
+#endif /* LIBPNG_VER < 10700 */
 
 /* New members added in libpng-1.0.6 */
 
@@ -389,8 +383,8 @@ struct png_struct_def
    png_voidp user_chunk_ptr;
 #ifdef PNG_READ_USER_CHUNKS_SUPPORTED
    png_user_chunk_ptr read_user_chunk_fn; /* user read chunk handler */
-#endif
-#endif
+#endif /* READ_USER_CHUNKS */
+#endif /* USER_CHUNKS */
 
 #ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
    int          unknown_default; /* As PNG_HANDLE_* */
@@ -497,11 +491,5 @@ struct png_struct_def
 /* New member added in libpng-1.5.7 */
    void (*read_filter[PNG_FILTER_VALUE_LAST-1])(png_row_infop row_info,
       png_bytep row, png_const_bytep prev_row);
-
-#ifdef PNG_READ_SUPPORTED
-#if defined(PNG_COLORSPACE_SUPPORTED) || defined(PNG_GAMMA_SUPPORTED)
-   png_colorspace   colorspace;
-#endif
-#endif
 };
 #endif /* PNGSTRUCT_H */
diff --git a/src/java.desktop/unix/classes/sun/awt/UNIXToolkit.java b/src/java.desktop/unix/classes/sun/awt/UNIXToolkit.java
index 67ae61cf5dd7..c7d379f21e92 100644
--- a/src/java.desktop/unix/classes/sun/awt/UNIXToolkit.java
+++ b/src/java.desktop/unix/classes/sun/awt/UNIXToolkit.java
@@ -537,7 +537,7 @@ public static boolean isGtkVerbose() {
     private static volatile Boolean isOnXWayland = null;
 
     @SuppressWarnings("removal")
-    private static boolean isOnXWayland() {
+    static boolean isOnXWayland() {
         Boolean result = isOnXWayland;
         if (result == null) {
             synchronized (GTK_LOCK) {
diff --git a/src/java.desktop/unix/classes/sun/awt/X11GraphicsDevice.java b/src/java.desktop/unix/classes/sun/awt/X11GraphicsDevice.java
index 7979172c2107..b3630339af61 100644
--- a/src/java.desktop/unix/classes/sun/awt/X11GraphicsDevice.java
+++ b/src/java.desktop/unix/classes/sun/awt/X11GraphicsDevice.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2025, 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
@@ -84,6 +84,15 @@ public final class X11GraphicsDevice extends GraphicsDevice
     private static final double GDK_DPI_SCALE;
     private static final double GDK_SCALE_MULTIPLIER;
 
+    // Wayland clients are by design not allowed to change the resolution in Wayland.
+    // XRandR in Xwayland is just an emulation, it doesn't actually change the resolution.
+    // This emulation is per window/x11 client, so different clients can have
+    // different emulated resolutions at the same time.
+    // So any request to get the current display mode will always return
+    // the original screen resolution, even if we are in emulated resolution.
+    // To handle this situation, we store the last set display mode in this variable.
+    private volatile DisplayMode xwlCurrentDisplayMode;
+
     public X11GraphicsDevice(int screennum) {
         this.screen = screennum;
         int scaleFactor = initScaleFactor(-1);
@@ -173,6 +182,20 @@ public Point scaleDownChecked(int x, int y) {
 
     private Rectangle getBoundsImpl() {
         Rectangle rect = pGetBounds(getScreen());
+
+        if (UNIXToolkit.isOnXWayland() && xwlCurrentDisplayMode != null) {
+            // XRandR resolution change in Xwayland is an emulation,
+            // and implemented in such a way that multiple display modes
+            // for a device are only available in a single screen scenario,
+            // if we have multiple screens they will each have a single display mode
+            // (no emulated resolution change is available).
+            // So we don't have to worry about x and y for a screen here.
+            rect.setSize(
+                    xwlCurrentDisplayMode.getWidth(),
+                    xwlCurrentDisplayMode.getHeight()
+            );
+        }
+
         if (getScaleFactor() != 1) {
             rect.width = scaleDown(rect.width);
             rect.height = scaleDown(rect.height);
@@ -472,10 +495,19 @@ private DisplayMode getDefaultDisplayMode() {
     @Override
     public synchronized DisplayMode getDisplayMode() {
         if (isFullScreenSupported()) {
+            if (UNIXToolkit.isOnXWayland() && xwlCurrentDisplayMode != null) {
+                return xwlCurrentDisplayMode;
+            }
+
             DisplayMode mode = getCurrentDisplayMode(screen);
             if (mode == null) {
                 mode = getDefaultDisplayMode();
             }
+
+            if (UNIXToolkit.isOnXWayland()) {
+                xwlCurrentDisplayMode = mode;
+            }
+
             return mode;
         } else {
             if (origDisplayMode == null) {
@@ -548,6 +580,10 @@ public synchronized void setDisplayMode(DisplayMode dm) {
                           dm.getWidth(), dm.getHeight(),
                           dm.getRefreshRate());
 
+        if (UNIXToolkit.isOnXWayland()) {
+            xwlCurrentDisplayMode = dm;
+        }
+
         // update bounds of the fullscreen window
         w.setBounds(0, 0, dm.getWidth(), dm.getHeight());
 
diff --git a/src/java.desktop/unix/legal/pipewire.md b/src/java.desktop/unix/legal/pipewire.md
index 88389a74e69d..8275928e2715 100644
--- a/src/java.desktop/unix/legal/pipewire.md
+++ b/src/java.desktop/unix/legal/pipewire.md
@@ -1,4 +1,4 @@
-## PipeWire 0.3.68
+## PipeWire 1.3.81
 
 ### PipeWire license:
 
@@ -39,3 +39,8 @@ spa/include/spa/utils/string.h
 ```
 Copyright © 2021 Red Hat, Inc.
 ```
+
+spa/utils/cleanup.h:
+```
+Copyright © 2023 PipeWire authors
+```
diff --git a/src/java.desktop/unix/native/libpipewire/include/pipewire/context.h b/src/java.desktop/unix/native/libpipewire/include/pipewire/context.h
index b02baf6c4c55..7e1a2b29b949 100644
--- a/src/java.desktop/unix/native/libpipewire/include/pipewire/context.h
+++ b/src/java.desktop/unix/native/libpipewire/include/pipewire/context.h
@@ -43,6 +43,7 @@ struct pw_context;
 
 struct pw_global;
 struct pw_impl_client;
+struct pw_impl_node;
 
 #include 
 #include 
@@ -50,7 +51,7 @@ struct pw_impl_client;
 
 /** context events emitted by the context object added with \ref pw_context_add_listener */
 struct pw_context_events {
-#define PW_VERSION_CONTEXT_EVENTS    0
+#define PW_VERSION_CONTEXT_EVENTS    1
     uint32_t version;
 
     /** The context is being destroyed */
@@ -63,12 +64,24 @@ struct pw_context_events {
     void (*global_added) (void *data, struct pw_global *global);
     /** a global object was removed */
     void (*global_removed) (void *data, struct pw_global *global);
+
+    /** a driver was added, since 0.3.75 version:1 */
+    void (*driver_added) (void *data, struct pw_impl_node *node);
+    /** a driver was removed, since 0.3.75 version:1 */
+    void (*driver_removed) (void *data, struct pw_impl_node *node);
 };
 
-/** Make a new context object for a given main_loop. Ownership of the properties is taken */
-struct pw_context * pw_context_new(struct pw_loop *main_loop,        /**< a main loop to run in */
-                 struct pw_properties *props,    /**< extra properties */
-                 size_t user_data_size        /**< extra user data size */);
+/** Make a new context object for a given main_loop. Ownership of the properties is taken, even
+ * if the function returns NULL.
+ *
+ * \param main_loop A main loop to run in. This must stay alive unil pw_context_destroy() is called.
+ * \param props extra properties
+ * \param user_data_size extra user data size
+ * \return The context object on success, or NULL on failure, in which case errno is set.
+ * */
+struct pw_context * pw_context_new(struct pw_loop *main_loop,
+                 struct pw_properties *props,
+                 size_t user_data_size);
 
 /** destroy a context object, all resources except the main_loop will be destroyed */
 void pw_context_destroy(struct pw_context *context);
@@ -113,15 +126,27 @@ int pw_context_conf_section_match_rules(struct pw_context *context, const char *
 /** Get the context support objects */
 const struct spa_support *pw_context_get_support(struct pw_context *context, uint32_t *n_support);
 
-/** get the context main loop */
+/** Get the context main loop. Returns the value passed to pw_context_new(). */
 struct pw_loop *pw_context_get_main_loop(struct pw_context *context);
 
-/** get the context data loop. Since 0.3.56 */
+/** Get the context data loop. This loop runs on the realtime thread. This
+ * acquires a loop from the generic data.rt class. Use pw_context_acquire_loop() instead.
+ * Since 0.3.56 */
 struct pw_data_loop *pw_context_get_data_loop(struct pw_context *context);
 
+/** Get a data-loop.
+ * Since 1.1.0 */
+struct pw_loop *pw_context_acquire_loop(struct pw_context *context, const struct spa_dict *props);
+/** Release a data-loop.
+ * Since 1.1.0 */
+void pw_context_release_loop(struct pw_context *context, struct pw_loop *loop);
+
 /** Get the work queue from the context: Since 0.3.26 */
 struct pw_work_queue *pw_context_get_work_queue(struct pw_context *context);
 
+/** Get the memory pool from the context: Since 0.3.74 */
+struct pw_mempool *pw_context_get_mempool(struct pw_context *context);
+
 /** Iterate the globals of the context. The callback should return
  * 0 to fetch the next item, any other value stops the iteration and returns
  * the value. When all callbacks return 0, this function returns 0 when all
@@ -130,7 +155,10 @@ int pw_context_for_each_global(struct pw_context *context,
                 int (*callback) (void *data, struct pw_global *global),
                 void *data);
 
-/** Find a context global by id */
+/** Find a context global by id.
+ *
+ * \return The global on success, or NULL on failure. If id is \ref PW_ID_CORE,
+ *         this function will always return a non-NULL value. */
 struct pw_global *pw_context_find_global(struct pw_context *context,    /**< the context */
                       uint32_t id        /**< the global id */);
 
@@ -140,6 +168,7 @@ int pw_context_add_spa_lib(struct pw_context *context, const char *factory_regex
 /** find the library name for a spa factory */
 const char * pw_context_find_spa_lib(struct pw_context *context, const char *factory_name);
 
+/** Load a SPA handle from a context. On failure returns NULL and sets errno. */
 struct spa_handle *pw_context_load_spa_handle(struct pw_context *context,
         const char *factory_name,
         const struct spa_dict *info);
@@ -160,9 +189,21 @@ int pw_context_register_export_type(struct pw_context *context, struct pw_export
 /** find information about registered export type */
 const struct pw_export_type *pw_context_find_export_type(struct pw_context *context, const char *type);
 
-/** add an object to the context */
+/** add an object to the context
+ *
+ * \param context The context.
+ * \param type The type of the object, usually a `TYPE_INTERFACE_` value.
+ * \param value The object value. Must last as long as the context and must
+ *              be of the type corresponding to the type.
+ * \return A negative number on failure (out of memory).
+ * */
 int pw_context_set_object(struct pw_context *context, const char *type, void *value);
-/** get an object from the context */
+/** get an object from the context
+ *
+ * \param context The context.
+ * \param type The string corresponding to the object's interface.
+ * \return The object, or NULL if the object does not exist.
+ * */
 void *pw_context_get_object(struct pw_context *context, const char *type);
 
 /**
diff --git a/src/java.desktop/unix/native/libpipewire/include/pipewire/core.h b/src/java.desktop/unix/native/libpipewire/include/pipewire/core.h
index 23a9e16dfbf8..1acfded4b07a 100644
--- a/src/java.desktop/unix/native/libpipewire/include/pipewire/core.h
+++ b/src/java.desktop/unix/native/libpipewire/include/pipewire/core.h
@@ -14,6 +14,8 @@ extern "C" {
 
 #include 
 
+#include 
+
 /** \defgroup pw_core Core
  *
  * \brief The core global object.
@@ -34,11 +36,20 @@ extern "C" {
 #define PW_TYPE_INTERFACE_Core        PW_TYPE_INFO_INTERFACE_BASE "Core"
 #define PW_TYPE_INTERFACE_Registry    PW_TYPE_INFO_INTERFACE_BASE "Registry"
 
+#define PW_CORE_PERM_MASK        PW_PERM_R|PW_PERM_X|PW_PERM_M
+
 #define PW_VERSION_CORE        4
 struct pw_core;
 #define PW_VERSION_REGISTRY    3
 struct pw_registry;
 
+#ifndef PW_API_CORE_IMPL
+#define PW_API_CORE_IMPL static inline
+#endif
+#ifndef PW_API_REGISTRY_IMPL
+#define PW_API_REGISTRY_IMPL static inline
+#endif
+
 /** The default remote name to connect to */
 #define PW_DEFAULT_REMOTE    "pipewire-0"
 
@@ -67,11 +78,13 @@ struct pw_core_info {
 #include 
 #include 
 
-/** Update an existing \ref pw_core_info with \a update with reset */
+/** Update an existing \ref pw_core_info with \a update with reset. When info is NULL,
+ * a new one will be allocated. Returns NULL on failure. */
 struct pw_core_info *
 pw_core_info_update(struct pw_core_info *info,
         const struct pw_core_info *update);
-/** Update an existing \ref pw_core_info with \a update */
+/** Update an existing \ref pw_core_info with \a update. When info is NULL, a new one
+ * will be allocated. Returns NULL on failure */
 struct pw_core_info *
 pw_core_info_merge(struct pw_core_info *info,
         const struct pw_core_info *update, bool reset);
@@ -162,6 +175,9 @@ struct pw_core_events {
      * global ID. It is emitted before the global becomes visible in the
      * registry.
      *
+     * The bound_props event is an enhanced version of this event that
+     * also contains the extra global properties.
+     *
      * \param id bound object ID
      * \param global_id the global id bound to
      */
@@ -190,6 +206,21 @@ struct pw_core_events {
      */
     void (*remove_mem) (void *data, uint32_t id);
 
+    /**
+     * Notify an object binding
+     *
+     * This event is emitted when a local object ID is bound to a
+     * global ID. It is emitted before the global becomes visible in the
+     * registry.
+     *
+     * This is an enhanced version of the bound_id event.
+     *
+     * \param id bound object ID
+     * \param global_id the global id bound to
+     * \param props The properties of the new global object.
+     *
+     * Since version 4:1
+     */
     void (*bound_props) (void *data, uint32_t id, uint32_t global_id, const struct spa_dict *props);
 };
 
@@ -223,6 +254,8 @@ struct pw_core_methods {
      * Start a conversation with the server. This will send
      * the core info and will destroy all resources for the client
      * (except the core and client resource).
+     *
+     * This requires X permissions on the core.
      */
     int (*hello) (void *object, uint32_t version);
     /**
@@ -235,6 +268,8 @@ struct pw_core_methods {
      * methods and the resulting events have been handled.
      *
      * \param seq the seq number passed to the done event
+     *
+     * This requires X permissions on the core.
      */
     int (*sync) (void *object, uint32_t id, int seq);
     /**
@@ -243,6 +278,8 @@ struct pw_core_methods {
      * Reply to the server ping event with the same seq.
      *
      * \param seq the seq number received in the ping event
+     *
+     * This requires X permissions on the core.
      */
     int (*pong) (void *object, uint32_t id, int seq);
     /**
@@ -257,9 +294,11 @@ struct pw_core_methods {
      * This method is usually also emitted on the resource object with
      * \a id.
      *
-         * \param id object where the error occurred
+         * \param id resource id where the error occurred
          * \param res error code
          * \param message error description
+     *
+     * This requires X permissions on the core.
      */
     int (*error) (void *object, uint32_t id, int seq, int res, const char *message);
     /**
@@ -269,6 +308,8 @@ struct pw_core_methods {
      * the global objects available from the PipeWire server
      * \param version the client version
      * \param user_data_size extra size
+     *
+     * This requires X permissions on the core.
      */
     struct pw_registry * (*get_registry) (void *object, uint32_t version,
             size_t user_data_size);
@@ -281,6 +322,8 @@ struct pw_core_methods {
      * \param version the version of the interface
      * \param props extra properties
      * \param user_data_size extra size
+     *
+     * This requires X permissions on the core.
      */
     void * (*create_object) (void *object,
                    const char *factory_name,
@@ -294,27 +337,57 @@ struct pw_core_methods {
      * Destroy the server resource for the given proxy.
      *
      * \param obj the proxy to destroy
+     *
+     * This requires X permissions on the core.
      */
     int (*destroy) (void *object, void *proxy);
 };
 
-#define pw_core_method(o,method,version,...)            \
-({                                    \
-    int _res = -ENOTSUP;                        \
-    spa_interface_call_res((struct spa_interface*)o,        \
-            struct pw_core_methods, _res,        \
-            method, version, ##__VA_ARGS__);        \
-    _res;                                \
-})
 
-#define pw_core_add_listener(c,...)    pw_core_method(c,add_listener,0,__VA_ARGS__)
-#define pw_core_hello(c,...)        pw_core_method(c,hello,0,__VA_ARGS__)
-#define pw_core_sync(c,...)        pw_core_method(c,sync,0,__VA_ARGS__)
-#define pw_core_pong(c,...)        pw_core_method(c,pong,0,__VA_ARGS__)
-#define pw_core_error(c,...)        pw_core_method(c,error,0,__VA_ARGS__)
-
-
-static inline
+/** \copydoc pw_core_methods.add_listener
+ * \sa pw_core_methods.add_listener */
+PW_API_CORE_IMPL int pw_core_add_listener(struct pw_core *object,
+            struct spa_hook *listener,
+            const struct pw_core_events *events,
+            void *data)
+{
+    return spa_api_method_r(int, -ENOTSUP,
+            pw_core, (struct spa_interface*)object, add_listener, 0,
+            listener, events, data);
+}
+/** \copydoc pw_core_methods.hello
+ * \sa pw_core_methods.hello */
+PW_API_CORE_IMPL int pw_core_hello(struct pw_core *object, uint32_t version)
+{
+    return spa_api_method_r(int, -ENOTSUP,
+            pw_core, (struct spa_interface*)object, hello, 0,
+            version);
+}
+/** \copydoc pw_core_methods.sync
+ * \sa pw_core_methods.sync */
+PW_API_CORE_IMPL int pw_core_sync(struct pw_core *object, uint32_t id, int seq)
+{
+    return spa_api_method_r(int, -ENOTSUP,
+            pw_core, (struct spa_interface*)object, sync, 0,
+            id, seq);
+}
+/** \copydoc pw_core_methods.pong
+ * \sa pw_core_methods.pong */
+PW_API_CORE_IMPL int pw_core_pong(struct pw_core *object, uint32_t id, int seq)
+{
+    return spa_api_method_r(int, -ENOTSUP,
+            pw_core, (struct spa_interface*)object, pong, 0,
+            id, seq);
+}
+/** \copydoc pw_core_methods.error
+ * \sa pw_core_methods.error */
+PW_API_CORE_IMPL int pw_core_error(struct pw_core *object, uint32_t id, int seq, int res, const char *message)
+{
+    return spa_api_method_r(int, -ENOTSUP,
+            pw_core, (struct spa_interface*)object, error, 0,
+            id, seq, res, message);
+}
+PW_API_CORE_IMPL
 SPA_PRINTF_FUNC(5, 0) int
 pw_core_errorv(struct pw_core *core, uint32_t id, int seq,
         int res, const char *message, va_list args)
@@ -325,7 +398,7 @@ pw_core_errorv(struct pw_core *core, uint32_t id, int seq,
     return pw_core_error(core, id, seq, res, buffer);
 }
 
-static inline
+PW_API_CORE_IMPL
 SPA_PRINTF_FUNC(5, 6) int
 pw_core_errorf(struct pw_core *core, uint32_t id, int seq,
         int res, const char *message, ...)
@@ -338,17 +411,18 @@ pw_core_errorf(struct pw_core *core, uint32_t id, int seq,
     return r;
 }
 
-static inline struct pw_registry *
+/** \copydoc pw_core_methods.get_registry
+ * \sa pw_core_methods.get_registry */
+PW_API_CORE_IMPL struct pw_registry *
 pw_core_get_registry(struct pw_core *core, uint32_t version, size_t user_data_size)
 {
-    struct pw_registry *res = NULL;
-    spa_interface_call_res((struct spa_interface*)core,
-            struct pw_core_methods, res,
-            get_registry, 0, version, user_data_size);
-    return res;
+    return spa_api_method_r(struct pw_registry*, NULL,
+            pw_core, (struct spa_interface*)core, get_registry, 0,
+            version, user_data_size);
 }
-
-static inline void *
+/** \copydoc pw_core_methods.create_object
+ * \sa pw_core_methods.create_object */
+PW_API_CORE_IMPL void *
 pw_core_create_object(struct pw_core *core,
                 const char *factory_name,
                 const char *type,
@@ -356,15 +430,18 @@ pw_core_create_object(struct pw_core *core,
                 const struct spa_dict *props,
                 size_t user_data_size)
 {
-    void *res = NULL;
-    spa_interface_call_res((struct spa_interface*)core,
-            struct pw_core_methods, res,
-            create_object, 0, factory_name,
-            type, version, props, user_data_size);
-    return res;
+    return spa_api_method_r(void*, NULL,
+            pw_core, (struct spa_interface*)core, create_object, 0,
+            factory_name, type, version, props, user_data_size);
+}
+/** \copydoc pw_core_methods.destroy
+ * \sa pw_core_methods.destroy */
+PW_API_CORE_IMPL void
+pw_core_destroy(struct pw_core *core, void *proxy)
+{
+    spa_api_method_v(pw_core, (struct spa_interface*)core, destroy, 0,
+            proxy);
 }
-
-#define pw_core_destroy(c,...)        pw_core_method(c,destroy,0,__VA_ARGS__)
 
 /**
  * \}
@@ -474,36 +551,44 @@ struct pw_registry_methods {
      *
      * Try to destroy the global object.
      *
-     * \param id the global id to destroy
+     * \param id the global id to destroy. The client needs X permissions
+     * on the global.
      */
     int (*destroy) (void *object, uint32_t id);
 };
 
-#define pw_registry_method(o,method,version,...)            \
-({                                    \
-    int _res = -ENOTSUP;                        \
-    spa_interface_call_res((struct spa_interface*)o,        \
-            struct pw_registry_methods, _res,        \
-            method, version, ##__VA_ARGS__);        \
-    _res;                                \
-})
 
 /** Registry */
-#define pw_registry_add_listener(p,...)    pw_registry_method(p,add_listener,0,__VA_ARGS__)
-
-static inline void *
+/** \copydoc pw_registry_methods.add_listener
+ * \sa pw_registry_methods.add_listener */
+PW_API_REGISTRY_IMPL int pw_registry_add_listener(struct pw_registry *registry,
+            struct spa_hook *listener,
+            const struct pw_registry_events *events,
+            void *data)
+{
+    return spa_api_method_r(int, -ENOTSUP,
+            pw_registry, (struct spa_interface*)registry, add_listener, 0,
+            listener, events, data);
+}
+/** \copydoc pw_registry_methods.bind
+ * \sa pw_registry_methods.bind */
+PW_API_REGISTRY_IMPL void *
 pw_registry_bind(struct pw_registry *registry,
                uint32_t id, const char *type, uint32_t version,
                size_t user_data_size)
 {
-    void *res = NULL;
-    spa_interface_call_res((struct spa_interface*)registry,
-            struct pw_registry_methods, res,
-            bind, 0, id, type, version, user_data_size);
-    return res;
+    return spa_api_method_r(void*, NULL,
+            pw_registry, (struct spa_interface*)registry, bind, 0,
+            id, type, version, user_data_size);
+}
+/** \copydoc pw_registry_methods.destroy
+ * \sa pw_registry_methods.destroy */
+PW_API_REGISTRY_IMPL int
+pw_registry_destroy(struct pw_registry *registry, uint32_t id)
+{
+    return spa_api_method_r(int, -ENOTSUP,
+            pw_registry, (struct spa_interface*)registry, destroy, 0, id);
 }
-
-#define pw_registry_destroy(p,...)    pw_registry_method(p,destroy,0,__VA_ARGS__)
 
 /**
  * \}
diff --git a/src/java.desktop/unix/native/libpipewire/include/pipewire/keys.h b/src/java.desktop/unix/native/libpipewire/include/pipewire/keys.h
index b7de764657a9..67ea3f9cce22 100644
--- a/src/java.desktop/unix/native/libpipewire/include/pipewire/keys.h
+++ b/src/java.desktop/unix/native/libpipewire/include/pipewire/keys.h
@@ -38,6 +38,14 @@ extern "C" {
 #define PW_KEY_SEC_GID            "pipewire.sec.gid"    /**< client gid, set by protocol*/
 #define PW_KEY_SEC_LABEL        "pipewire.sec.label"    /**< client security label, set by protocol*/
 
+#define PW_KEY_SEC_SOCKET        "pipewire.sec.socket"    /**< client socket name, set by protocol */
+
+#define PW_KEY_SEC_ENGINE        "pipewire.sec.engine"    /**< client secure context engine, set by protocol.
+                                  *  This can also be set by a client when making a
+                                  *  new security context. */
+#define PW_KEY_SEC_APP_ID        "pipewire.sec.app-id"    /**< client secure application id */
+#define PW_KEY_SEC_INSTANCE_ID        "pipewire.sec.instance-id"    /**< client secure instance id */
+
 #define PW_KEY_LIBRARY_NAME_SYSTEM    "library.name.system"    /**< name of the system library to use */
 #define PW_KEY_LIBRARY_NAME_LOOP    "library.name.loop"    /**< name of the loop library to use */
 #define PW_KEY_LIBRARY_NAME_DBUS    "library.name.dbus"    /**< name of the dbus library to use */
@@ -52,7 +60,8 @@ extern "C" {
 #define PW_KEY_OBJECT_LINGER        "object.linger"        /**< the object lives on even after the client
                                   *  that created it has been destroyed */
 #define PW_KEY_OBJECT_REGISTER        "object.register"    /**< If the object should be registered. */
-
+#define PW_KEY_OBJECT_EXPORT        "object.export"        /**< If the object should be exported,
+                                  *  since 0.3.72 */
 
 /* config */
 #define PW_KEY_CONFIG_PREFIX        "config.prefix"        /**< a config prefix directory */
@@ -60,6 +69,12 @@ extern "C" {
 #define PW_KEY_CONFIG_OVERRIDE_PREFIX    "config.override.prefix"    /**< a config override prefix directory */
 #define PW_KEY_CONFIG_OVERRIDE_NAME    "config.override.name"    /**< a config override file name */
 
+/* loop */
+#define PW_KEY_LOOP_NAME        "loop.name"        /**< the name of a loop */
+#define PW_KEY_LOOP_CLASS        "loop.class"        /**< the classes this loop handles, array of strings */
+#define PW_KEY_LOOP_RT_PRIO        "loop.rt-prio"        /**< realtime priority of the loop */
+#define PW_KEY_LOOP_CANCEL        "loop.cancel"        /**< if the loop can be canceled */
+
 /* context */
 #define PW_KEY_CONTEXT_PROFILE_MODULES    "context.profile.modules"    /**< a context profile for modules, deprecated */
 #define PW_KEY_USER_NAME        "context.user-name"    /**< The user name that runs pipewire */
@@ -87,7 +102,9 @@ extern "C" {
 /* remote keys */
 #define PW_KEY_REMOTE_NAME        "remote.name"        /**< The name of the remote to connect to,
                                   *  default pipewire-0, overwritten by
-                                  *  env(PIPEWIRE_REMOTE) */
+                                  *  env(PIPEWIRE_REMOTE). May also be
+                                  *  a SPA-JSON array of sockets, to be tried
+                                  *  in order. */
 #define PW_KEY_REMOTE_INTENTION        "remote.intention"    /**< The intention of the remote connection,
                                   *  "generic", "screencast" */
 
@@ -132,7 +149,14 @@ extern "C" {
 #define PW_KEY_NODE_SESSION        "node.session"        /**< the session id this node is part of */
 #define PW_KEY_NODE_GROUP        "node.group"        /**< the group id this node is part of. Nodes
                                   *  in the same group are always scheduled
-                                  *  with the same driver. */
+                                  *  with the same driver. Can be an array of
+                                  *  group names. */
+#define PW_KEY_NODE_SYNC_GROUP        "node.sync-group"    /**< the sync group this node is part of. Nodes
+                                  *  in the same sync group are always scheduled
+                                  *  together with the same driver when the sync
+                                  *  is active. Can be an array of sync names. */
+#define PW_KEY_NODE_SYNC        "node.sync"        /**< if the sync-group is active or not */
+#define PW_KEY_NODE_TRANSPORT        "node.transport"    /**< if the transport is active or not */
 #define PW_KEY_NODE_EXCLUSIVE        "node.exclusive"    /**< node wants exclusive access to resources */
 #define PW_KEY_NODE_AUTOCONNECT        "node.autoconnect"    /**< node wants to be automatically connected
                                   *  to a compatible node */
@@ -163,7 +187,23 @@ extern "C" {
 #define PW_KEY_NODE_SUSPEND_ON_IDLE    "node.suspend-on-idle"    /**< suspend the node when idle */
 #define PW_KEY_NODE_CACHE_PARAMS    "node.cache-params"    /**< cache the node params */
 #define PW_KEY_NODE_TRANSPORT_SYNC    "node.transport.sync"    /**< the node handles transport sync */
-#define PW_KEY_NODE_DRIVER        "node.driver"        /**< node can drive the graph */
+#define PW_KEY_NODE_DRIVER        "node.driver"        /**< node can drive the graph. When the node is
+                                  *  selected as the driver, it needs to start
+                                  *  the graph periodically. */
+#define PW_KEY_NODE_SUPPORTS_LAZY    "node.supports-lazy"    /**< the node can be a lazy driver. It will listen
+                                  *  to RequestProcess commands and take them into
+                                  *  account when deciding to start the graph.
+                                  *  A value of 0 disables support, a value of > 0
+                                  *  enables with increasing preference. */
+#define PW_KEY_NODE_SUPPORTS_REQUEST    "node.supports-request"    /**< The node supports emiting RequestProcess events
+                                  *  when it wants the graph to be scheduled.
+                                  *  A value of 0 disables support, a value of > 0
+                                  *  enables with increasing preference. */
+#define PW_KEY_NODE_DRIVER_ID        "node.driver-id"    /**< the node id of the node assigned as driver
+                                  *   for this node */
+#define PW_KEY_NODE_ASYNC        "node.async"        /**< the node wants async scheduling */
+#define PW_KEY_NODE_LOOP_NAME        "node.loop.name"    /**< the loop name fnmatch pattern to run in */
+#define PW_KEY_NODE_LOOP_CLASS        "node.loop.class"    /**< the loop class fnmatch pattern to run in */
 #define PW_KEY_NODE_STREAM        "node.stream"        /**< node is a stream, the server side should
                                   *  add a converter */
 #define PW_KEY_NODE_VIRTUAL        "node.virtual"        /**< the node is some sort of virtual
@@ -172,17 +212,20 @@ extern "C" {
                                   *  on output/input/all ports when the value is
                                   *  "out"/"in"/"true" respectively */
 #define PW_KEY_NODE_LINK_GROUP        "node.link-group"    /**< the node is internally linked to
-                                  *  nodes with the same link-group */
+                                  *  nodes with the same link-group. Can be an
+                                  *  array of group names. */
 #define PW_KEY_NODE_NETWORK        "node.network"        /**< the node is on a network */
 #define PW_KEY_NODE_TRIGGER        "node.trigger"        /**< the node is not scheduled automatically
                                   *   based on the dependencies in the graph
                                   *   but it will be triggered explicitly. */
-#define PW_KEY_NODE_CHANNELNAMES        "node.channel-names"        /**< names of node's
-                                    *   channels (unrelated to positions) */
-#define PW_KEY_NODE_DEVICE_PORT_NAME_PREFIX            "node.device-port-name-prefix"        /** override
-                                    *        port name prefix for device ports, like capture and playback
-                                    *        or disable the prefix completely if an empty string is provided */
-
+#define PW_KEY_NODE_CHANNELNAMES    "node.channel-names"    /**< names of node's
+                                *   channels (unrelated to positions) */
+#define PW_KEY_NODE_DEVICE_PORT_NAME_PREFIX    \
+                    "node.device-port-name-prefix"    /**< override port name prefix for
+                                      *  device ports, like capture and
+                                      *  playback or disable the prefix
+                                      *  completely if an empty string
+                                      *  is provided */
 /** Port keys */
 #define PW_KEY_PORT_ID            "port.id"        /**< port id */
 #define PW_KEY_PORT_NAME        "port.name"        /**< port name */
@@ -197,6 +240,8 @@ extern "C" {
 #define PW_KEY_PORT_EXTRA        "port.extra"        /**< api specific extra port info, API name
                                   *  should be prefixed. "jack:flags:56" */
 #define PW_KEY_PORT_PASSIVE        "port.passive"        /**< the ports wants passive links, since 0.3.67 */
+#define PW_KEY_PORT_IGNORE_LATENCY    "port.ignore-latency"    /**< latency ignored by peers, since 0.3.71 */
+#define PW_KEY_PORT_GROUP        "port.group"        /**< the port group of the port 1.2.0 */
 
 /** link properties */
 #define PW_KEY_LINK_ID            "link.id"        /**< a link id */
@@ -210,6 +255,7 @@ extern "C" {
 #define PW_KEY_LINK_FEEDBACK        "link.feedback"        /**< indicate that a link is a feedback
                                   *  link and the target will receive data
                                   *  in the next cycle */
+#define PW_KEY_LINK_ASYNC        "link.async"        /**< the link is using async io */
 
 /** device properties */
 #define PW_KEY_DEVICE_ID        "device.id"        /**< device id */
@@ -260,6 +306,7 @@ extern "C" {
 #define PW_KEY_MODULE_USAGE        "module.usage"        /**< a human readable usage description of
                                   *  the module's arguments. */
 #define PW_KEY_MODULE_VERSION        "module.version"    /**< a version string for the module. */
+#define PW_KEY_MODULE_DEPRECATED    "module.deprecated"    /**< the module is deprecated with this message */
 
 /** Factory properties */
 #define PW_KEY_FACTORY_ID        "factory.id"        /**< the factory id */
@@ -274,7 +321,10 @@ extern "C" {
 #define PW_KEY_STREAM_LATENCY_MAX    "stream.latency.max"    /**< The maximum latency of the stream */
 #define PW_KEY_STREAM_MONITOR        "stream.monitor"    /**< Indicates that the stream is monitoring
                                   *  and might select a less accurate but faster
-                                  *  conversion algorithm. */
+                                  *  conversion algorithm. Monitor streams are also
+                                  *  ignored when calculating the latency of their peer
+                                  *  ports (since 0.3.71).
+                                  */
 #define PW_KEY_STREAM_DONT_REMIX    "stream.dont-remix"    /**< don't remix channels */
 #define PW_KEY_STREAM_CAPTURE_SINK    "stream.capture.sink"    /**< Try to capture the sink output instead of
                                   *  source output */
@@ -292,6 +342,7 @@ extern "C" {
 #define PW_KEY_MEDIA_NAME        "media.name"        /**< media name. Ex: "Pink Floyd: Time" */
 #define PW_KEY_MEDIA_TITLE        "media.title"        /**< title. Ex: "Time" */
 #define PW_KEY_MEDIA_ARTIST        "media.artist"        /**< artist. Ex: "Pink Floyd" */
+#define PW_KEY_MEDIA_ALBUM        "media.album"        /**< album. Ex: "Dark Side of the Moon" */
 #define PW_KEY_MEDIA_COPYRIGHT        "media.copyright"    /**< copyright string */
 #define PW_KEY_MEDIA_SOFTWARE        "media.software"    /**< generator software */
 #define PW_KEY_MEDIA_LANGUAGE        "media.language"    /**< language in POSIX format. Ex: en_GB */
@@ -327,9 +378,11 @@ extern "C" {
 # ifdef PW_ENABLE_DEPRECATED
 #  define PW_KEY_PRIORITY_MASTER    "priority.master"    /**< deprecated, use priority.driver */
 #  define PW_KEY_NODE_TARGET        "node.target"        /**< deprecated since 0.3.64, use target.object. */
+#  define PW_KEY_LOOP_RETRY_TIMEOUT    "loop.retry-timeout"    /**< deprecated since 1.3.0 */
 # else
 #  define PW_KEY_PRIORITY_MASTER    PW_DEPRECATED("priority.master")
 #  define PW_KEY_NODE_TARGET        PW_DEPRECATED("node.target")
+#  define PW_KEY_LOOP_RETRY_TIMEOUT    PW_DEPRECATED("loop.retry-timeout")
 # endif /* PW_ENABLE_DEPRECATED */
 #endif /* PW_REMOVE_DEPRECATED */
 
diff --git a/src/java.desktop/unix/native/libpipewire/include/pipewire/loop.h b/src/java.desktop/unix/native/libpipewire/include/pipewire/loop.h
index b3a5c55b83ed..94b2dc2780b3 100644
--- a/src/java.desktop/unix/native/libpipewire/include/pipewire/loop.h
+++ b/src/java.desktop/unix/native/libpipewire/include/pipewire/loop.h
@@ -17,6 +17,8 @@ extern "C" {
  * PipeWire loop object provides an implementation of
  * the spa loop interfaces. It can be used to implement various
  * event loops.
+ *
+ * The members of \ref pw_loop are read-only.
  */
 
 /**
@@ -29,35 +31,118 @@ struct pw_loop {
     struct spa_loop *loop;            /**< wrapped loop */
     struct spa_loop_control *control;    /**< loop control */
     struct spa_loop_utils *utils;        /**< loop utils */
+    const char *name;
 };
 
+#ifndef PW_API_LOOP_IMPL
+#define PW_API_LOOP_IMPL static inline
+#endif
+
 struct pw_loop *
 pw_loop_new(const struct spa_dict *props);
 
 void
 pw_loop_destroy(struct pw_loop *loop);
 
-#define pw_loop_add_source(l,...)    spa_loop_add_source((l)->loop,__VA_ARGS__)
-#define pw_loop_update_source(l,...)    spa_loop_update_source((l)->loop,__VA_ARGS__)
-#define pw_loop_remove_source(l,...)    spa_loop_remove_source((l)->loop,__VA_ARGS__)
-#define pw_loop_invoke(l,...)        spa_loop_invoke((l)->loop,__VA_ARGS__)
-
-#define pw_loop_get_fd(l)        spa_loop_control_get_fd((l)->control)
-#define pw_loop_add_hook(l,...)        spa_loop_control_add_hook((l)->control,__VA_ARGS__)
-#define pw_loop_enter(l)        spa_loop_control_enter((l)->control)
-#define pw_loop_iterate(l,...)        spa_loop_control_iterate((l)->control,__VA_ARGS__)
-#define pw_loop_leave(l)        spa_loop_control_leave((l)->control)
-
-#define pw_loop_add_io(l,...)        spa_loop_utils_add_io((l)->utils,__VA_ARGS__)
-#define pw_loop_update_io(l,...)    spa_loop_utils_update_io((l)->utils,__VA_ARGS__)
-#define pw_loop_add_idle(l,...)        spa_loop_utils_add_idle((l)->utils,__VA_ARGS__)
-#define pw_loop_enable_idle(l,...)    spa_loop_utils_enable_idle((l)->utils,__VA_ARGS__)
-#define pw_loop_add_event(l,...)    spa_loop_utils_add_event((l)->utils,__VA_ARGS__)
-#define pw_loop_signal_event(l,...)    spa_loop_utils_signal_event((l)->utils,__VA_ARGS__)
-#define pw_loop_add_timer(l,...)    spa_loop_utils_add_timer((l)->utils,__VA_ARGS__)
-#define pw_loop_update_timer(l,...)    spa_loop_utils_update_timer((l)->utils,__VA_ARGS__)
-#define pw_loop_add_signal(l,...)    spa_loop_utils_add_signal((l)->utils,__VA_ARGS__)
-#define pw_loop_destroy_source(l,...)    spa_loop_utils_destroy_source((l)->utils,__VA_ARGS__)
+int pw_loop_set_name(struct pw_loop *loop, const char *name);
+
+PW_API_LOOP_IMPL int pw_loop_add_source(struct pw_loop *object, struct spa_source *source)
+{
+    return spa_loop_add_source(object->loop, source);
+}
+PW_API_LOOP_IMPL int pw_loop_update_source(struct pw_loop *object, struct spa_source *source)
+{
+    return spa_loop_update_source(object->loop, source);
+}
+PW_API_LOOP_IMPL int pw_loop_remove_source(struct pw_loop *object, struct spa_source *source)
+{
+    return spa_loop_remove_source(object->loop, source);
+}
+PW_API_LOOP_IMPL int pw_loop_invoke(struct pw_loop *object,
+                spa_invoke_func_t func, uint32_t seq, const void *data,
+                size_t size, bool block, void *user_data)
+{
+    return spa_loop_invoke(object->loop, func, seq, data, size, block, user_data);
+}
+
+PW_API_LOOP_IMPL int pw_loop_get_fd(struct pw_loop *object)
+{
+    return spa_loop_control_get_fd(object->control);
+}
+PW_API_LOOP_IMPL void pw_loop_add_hook(struct pw_loop *object,
+                struct spa_hook *hook, const struct spa_loop_control_hooks *hooks,
+                void *data)
+{
+    spa_loop_control_add_hook(object->control, hook, hooks, data);
+}
+PW_API_LOOP_IMPL void pw_loop_enter(struct pw_loop *object)
+{
+    spa_loop_control_enter(object->control);
+}
+PW_API_LOOP_IMPL void pw_loop_leave(struct pw_loop *object)
+{
+    spa_loop_control_leave(object->control);
+}
+PW_API_LOOP_IMPL int pw_loop_iterate(struct pw_loop *object,
+                int timeout)
+{
+    return spa_loop_control_iterate_fast(object->control, timeout);
+}
+
+PW_API_LOOP_IMPL struct spa_source *
+pw_loop_add_io(struct pw_loop *object, int fd, uint32_t mask,
+                bool close, spa_source_io_func_t func, void *data)
+{
+    return spa_loop_utils_add_io(object->utils, fd, mask, close, func, data);
+}
+PW_API_LOOP_IMPL int pw_loop_update_io(struct pw_loop *object,
+                struct spa_source *source, uint32_t mask)
+{
+    return spa_loop_utils_update_io(object->utils, source, mask);
+}
+PW_API_LOOP_IMPL struct spa_source *
+pw_loop_add_idle(struct pw_loop *object, bool enabled,
+                spa_source_idle_func_t func, void *data)
+{
+    return spa_loop_utils_add_idle(object->utils, enabled, func, data);
+}
+PW_API_LOOP_IMPL int pw_loop_enable_idle(struct pw_loop *object,
+                struct spa_source *source, bool enabled)
+{
+    return spa_loop_utils_enable_idle(object->utils, source, enabled);
+}
+PW_API_LOOP_IMPL struct spa_source *
+pw_loop_add_event(struct pw_loop *object, spa_source_event_func_t func, void *data)
+{
+    return spa_loop_utils_add_event(object->utils, func, data);
+}
+PW_API_LOOP_IMPL int pw_loop_signal_event(struct pw_loop *object,
+                struct spa_source *source)
+{
+    return spa_loop_utils_signal_event(object->utils, source);
+}
+PW_API_LOOP_IMPL struct spa_source *
+pw_loop_add_timer(struct pw_loop *object, spa_source_timer_func_t func, void *data)
+{
+    return spa_loop_utils_add_timer(object->utils, func, data);
+}
+PW_API_LOOP_IMPL int pw_loop_update_timer(struct pw_loop *object,
+                struct spa_source *source, struct timespec *value,
+                struct timespec *interval, bool absolute)
+{
+    return spa_loop_utils_update_timer(object->utils, source, value, interval, absolute);
+}
+PW_API_LOOP_IMPL struct spa_source *
+pw_loop_add_signal(struct pw_loop *object, int signal_number,
+                spa_source_signal_func_t func, void *data)
+{
+    return spa_loop_utils_add_signal(object->utils, signal_number, func, data);
+}
+PW_API_LOOP_IMPL void pw_loop_destroy_source(struct pw_loop *object,
+                struct spa_source *source)
+{
+    return spa_loop_utils_destroy_source(object->utils, source);
+}
 
 /**
  * \}
diff --git a/src/java.desktop/unix/native/libpipewire/include/pipewire/port.h b/src/java.desktop/unix/native/libpipewire/include/pipewire/port.h
index bb58cab97f53..ef48c67c004d 100644
--- a/src/java.desktop/unix/native/libpipewire/include/pipewire/port.h
+++ b/src/java.desktop/unix/native/libpipewire/include/pipewire/port.h
@@ -29,9 +29,15 @@ extern "C" {
 
 #define PW_TYPE_INTERFACE_Port    PW_TYPE_INFO_INTERFACE_BASE "Port"
 
+#define PW_PORT_PERM_MASK    PW_PERM_R|PW_PERM_X|PW_PERM_M
+
 #define PW_VERSION_PORT        3
 struct pw_port;
 
+#ifndef PW_API_PORT_IMPL
+#define PW_API_PORT_IMPL static inline
+#endif
+
 /** The direction of a port */
 #define pw_direction spa_direction
 #define PW_DIRECTION_INPUT SPA_DIRECTION_INPUT
@@ -115,6 +121,8 @@ struct pw_port_methods {
      *
      * \param ids an array of param ids
      * \param n_ids the number of ids in \a ids
+     *
+     * This requires X permissions on the port.
      */
     int (*subscribe_params) (void *object, uint32_t *ids, uint32_t n_ids);
 
@@ -129,24 +137,43 @@ struct pw_port_methods {
      * \param start the start index or 0 for the first param
      * \param num the maximum number of params to retrieve
      * \param filter a param filter or NULL
+     *
+     * This requires X permissions on the port.
      */
     int (*enum_params) (void *object, int seq,
             uint32_t id, uint32_t start, uint32_t num,
             const struct spa_pod *filter);
 };
 
-#define pw_port_method(o,method,version,...)                \
-({                                    \
-    int _res = -ENOTSUP;                        \
-    spa_interface_call_res((struct spa_interface*)o,        \
-            struct pw_port_methods, _res,            \
-            method, version, ##__VA_ARGS__);        \
-    _res;                                \
-})
-
-#define pw_port_add_listener(c,...)    pw_port_method(c,add_listener,0,__VA_ARGS__)
-#define pw_port_subscribe_params(c,...)    pw_port_method(c,subscribe_params,0,__VA_ARGS__)
-#define pw_port_enum_params(c,...)    pw_port_method(c,enum_params,0,__VA_ARGS__)
+/** \copydoc pw_port_methods.add_listener
+ * \sa pw_port_methods.add_listener */
+PW_API_PORT_IMPL int pw_port_add_listener(struct pw_port *object,
+            struct spa_hook *listener,
+            const struct pw_port_events *events,
+            void *data)
+{
+    return spa_api_method_r(int, -ENOTSUP,
+            pw_port, (struct spa_interface*)object, add_listener, 0,
+            listener, events, data);
+}
+/** \copydoc pw_port_methods.subscribe_params
+ * \sa pw_port_methods.subscribe_params */
+PW_API_PORT_IMPL int pw_port_subscribe_params(struct pw_port *object, uint32_t *ids, uint32_t n_ids)
+{
+    return spa_api_method_r(int, -ENOTSUP,
+            pw_port, (struct spa_interface*)object, subscribe_params, 0,
+            ids, n_ids);
+}
+/** \copydoc pw_port_methods.enum_params
+ * \sa pw_port_methods.enum_params */
+PW_API_PORT_IMPL int pw_port_enum_params(struct pw_port *object,
+        int seq, uint32_t id, uint32_t start, uint32_t num,
+                const struct spa_pod *filter)
+{
+    return spa_api_method_r(int, -ENOTSUP,
+            pw_port, (struct spa_interface*)object, enum_params, 0,
+            seq, id, start, num, filter);
+}
 
 /**
  * \}
diff --git a/src/java.desktop/unix/native/libpipewire/include/pipewire/properties.h b/src/java.desktop/unix/native/libpipewire/include/pipewire/properties.h
index 3966be417bcb..de67f33a5017 100644
--- a/src/java.desktop/unix/native/libpipewire/include/pipewire/properties.h
+++ b/src/java.desktop/unix/native/libpipewire/include/pipewire/properties.h
@@ -11,9 +11,14 @@ extern "C" {
 
 #include 
 
+#include 
 #include 
 #include 
 
+#ifndef PW_API_PROPERTIES
+#define PW_API_PROPERTIES static inline
+#endif
+
 /** \defgroup pw_properties Properties
  *
  * Properties are used to pass around arbitrary key/value pairs.
@@ -40,6 +45,10 @@ pw_properties_new_dict(const struct spa_dict *dict);
 struct pw_properties *
 pw_properties_new_string(const char *args);
 
+struct pw_properties *
+pw_properties_new_string_checked(const char *args, size_t size,
+        struct spa_error_location *loc);
+
 struct pw_properties *
 pw_properties_copy(const struct pw_properties *properties);
 
@@ -51,10 +60,14 @@ int pw_properties_update_ignore(struct pw_properties *props,
 /* Update props with all key/value pairs from dict */
 int pw_properties_update(struct pw_properties *props,
              const struct spa_dict *dict);
+
 /* Update props with all key/value pairs from str */
 int pw_properties_update_string(struct pw_properties *props,
         const char *str, size_t size);
 
+int pw_properties_update_string_checked(struct pw_properties *props,
+        const char *str, size_t size, struct spa_error_location *loc);
+
 int pw_properties_add(struct pw_properties *oldprops,
              const struct spa_dict *dict);
 int pw_properties_add_keys(struct pw_properties *oldprops,
@@ -92,7 +105,7 @@ pw_properties_fetch_int64(const struct pw_properties *properties, const char *ke
 int
 pw_properties_fetch_bool(const struct pw_properties *properties, const char *key, bool *value);
 
-static inline uint32_t
+PW_API_PROPERTIES uint32_t
 pw_properties_get_uint32(const struct pw_properties *properties, const char *key, uint32_t deflt)
 {
     uint32_t val = deflt;
@@ -100,7 +113,7 @@ pw_properties_get_uint32(const struct pw_properties *properties, const char *key
     return val;
 }
 
-static inline int32_t
+PW_API_PROPERTIES int32_t
 pw_properties_get_int32(const struct pw_properties *properties, const char *key, int32_t deflt)
 {
     int32_t val = deflt;
@@ -108,7 +121,7 @@ pw_properties_get_int32(const struct pw_properties *properties, const char *key,
     return val;
 }
 
-static inline uint64_t
+PW_API_PROPERTIES uint64_t
 pw_properties_get_uint64(const struct pw_properties *properties, const char *key, uint64_t deflt)
 {
     uint64_t val = deflt;
@@ -116,7 +129,7 @@ pw_properties_get_uint64(const struct pw_properties *properties, const char *key
     return val;
 }
 
-static inline int64_t
+PW_API_PROPERTIES int64_t
 pw_properties_get_int64(const struct pw_properties *properties, const char *key, int64_t deflt)
 {
     int64_t val = deflt;
@@ -125,7 +138,7 @@ pw_properties_get_int64(const struct pw_properties *properties, const char *key,
 }
 
 
-static inline bool
+PW_API_PROPERTIES bool
 pw_properties_get_bool(const struct pw_properties *properties, const char *key, bool deflt)
 {
     bool val = deflt;
@@ -136,34 +149,38 @@ pw_properties_get_bool(const struct pw_properties *properties, const char *key,
 const char *
 pw_properties_iterate(const struct pw_properties *properties, void **state);
 
-#define PW_PROPERTIES_FLAG_NL    (1<<0)
+#define PW_PROPERTIES_FLAG_NL        (1<<0)
+#define PW_PROPERTIES_FLAG_RECURSE    (1<<1)
+#define PW_PROPERTIES_FLAG_ENCLOSE    (1<<2)
+#define PW_PROPERTIES_FLAG_ARRAY    (1<<3)
+#define PW_PROPERTIES_FLAG_COLORS    (1<<4)
 int pw_properties_serialize_dict(FILE *f, const struct spa_dict *dict, uint32_t flags);
 
-static inline bool pw_properties_parse_bool(const char *value) {
+PW_API_PROPERTIES bool pw_properties_parse_bool(const char *value) {
     return spa_atob(value);
 }
 
-static inline int pw_properties_parse_int(const char *value) {
+PW_API_PROPERTIES int pw_properties_parse_int(const char *value) {
     int v;
     return spa_atoi32(value, &v, 0) ? v: 0;
 }
 
-static inline int64_t pw_properties_parse_int64(const char *value) {
+PW_API_PROPERTIES int64_t pw_properties_parse_int64(const char *value) {
     int64_t v;
     return spa_atoi64(value, &v, 0) ? v : 0;
 }
 
-static inline uint64_t pw_properties_parse_uint64(const char *value) {
+PW_API_PROPERTIES uint64_t pw_properties_parse_uint64(const char *value) {
     uint64_t v;
     return spa_atou64(value, &v, 0) ? v : 0;
 }
 
-static inline float pw_properties_parse_float(const char *value) {
+PW_API_PROPERTIES float pw_properties_parse_float(const char *value) {
     float v;
     return spa_atof(value, &v) ? v : 0.0f;
 }
 
-static inline double pw_properties_parse_double(const char *value) {
+PW_API_PROPERTIES double pw_properties_parse_double(const char *value) {
     double v;
     return spa_atod(value, &v) ? v : 0.0;
 }
@@ -172,6 +189,10 @@ static inline double pw_properties_parse_double(const char *value) {
  * \}
  */
 
+SPA_DEFINE_AUTOPTR_CLEANUP(pw_properties, struct pw_properties, {
+    spa_clear_ptr(*thing, pw_properties_free);
+})
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/src/java.desktop/unix/native/libpipewire/include/pipewire/protocol.h b/src/java.desktop/unix/native/libpipewire/include/pipewire/protocol.h
index f119a31b5db4..f306979877a1 100644
--- a/src/java.desktop/unix/native/libpipewire/include/pipewire/protocol.h
+++ b/src/java.desktop/unix/native/libpipewire/include/pipewire/protocol.h
@@ -81,7 +81,7 @@ struct pw_protocol_marshal {
 };
 
 struct pw_protocol_implementation {
-#define PW_VERSION_PROTOCOL_IMPLEMENTATION    0
+#define PW_VERSION_PROTOCOL_IMPLEMENTATION    1
     uint32_t version;
 
     struct pw_protocol_client * (*new_client) (struct pw_protocol *protocol,
@@ -90,6 +90,10 @@ struct pw_protocol_implementation {
     struct pw_protocol_server * (*add_server) (struct pw_protocol *protocol,
                            struct pw_impl_core *core,
                            const struct spa_dict *props);
+    struct pw_protocol_server * (*add_fd_server) (struct pw_protocol *protocol,
+                           struct pw_impl_core *core,
+                           int listen_fd, int close_fd,
+                           const struct spa_dict *props);
 };
 
 struct pw_protocol_events {
@@ -101,6 +105,7 @@ struct pw_protocol_events {
 
 #define pw_protocol_new_client(p,...)    (pw_protocol_get_implementation(p)->new_client(p,__VA_ARGS__))
 #define pw_protocol_add_server(p,...)    (pw_protocol_get_implementation(p)->add_server(p,__VA_ARGS__))
+#define pw_protocol_add_fd_server(p,...)    (pw_protocol_get_implementation(p)->add_fd_server(p,__VA_ARGS__))
 #define pw_protocol_ext(p,type,method,...)    (((type*)pw_protocol_get_extension(p))->method( __VA_ARGS__))
 
 struct pw_protocol *pw_protocol_new(struct pw_context *context, const char *name, size_t user_data_size);
diff --git a/src/java.desktop/unix/native/libpipewire/include/pipewire/proxy.h b/src/java.desktop/unix/native/libpipewire/include/pipewire/proxy.h
index ecd8038a2c0f..ca7f324c285c 100644
--- a/src/java.desktop/unix/native/libpipewire/include/pipewire/proxy.h
+++ b/src/java.desktop/unix/native/libpipewire/include/pipewire/proxy.h
@@ -12,6 +12,8 @@ extern "C" {
 #include 
 
 /** \page page_proxy Proxy
+ *
+ * \see \ref pw_proxy
  *
  * \section sec_page_proxy_overview Overview
  *
@@ -76,7 +78,7 @@ extern "C" {
  * invoked by the client to PipeWire messages. Events will call the handlers
  * set in listener.
  *
- * See \ref page_proxy
+ * \see \ref page_proxy
  */
 
 /**
diff --git a/src/java.desktop/unix/native/libpipewire/include/pipewire/stream.h b/src/java.desktop/unix/native/libpipewire/include/pipewire/stream.h
index 90096056a0c5..dca13d22669c 100644
--- a/src/java.desktop/unix/native/libpipewire/include/pipewire/stream.h
+++ b/src/java.desktop/unix/native/libpipewire/include/pipewire/stream.h
@@ -10,6 +10,8 @@ extern "C" {
 #endif
 
 /** \page page_streams Streams
+ *
+ * \see \ref pw_stream
  *
  * \section sec_overview Overview
  *
@@ -56,11 +58,15 @@ extern "C" {
 
  * \li PW_DIRECTION_INPUT for a stream that *consumes* data. This can be a
  * stream that captures from a Source or a when the stream is used to
- * implement a Sink.
+ * implement a Sink. An application will use a \ref PW_DIRECTION_INPUT
+ * stream to record data. A virtual sound card will use a
+ * \ref PW_DIRECTION_INPUT stream to implement audio playback.
  *
  * \li PW_DIRECTION_OUTPUT for a stream that *produces* data. This can be a
  * stream that plays to a Sink or when the stream is used to implement
- * a Source.
+ * a Source. An application will use a \ref PW_DIRECTION_OUTPUT
+ * stream to produce data. A virtual sound card or camera will use a
+ * \ref PW_DIRECTION_OUTPUT stream to implement audio or video recording.
  *
  * \subsection ssec_stream_target Stream target
  *
@@ -127,8 +133,25 @@ extern "C" {
  * When the buffer has been processed, call \ref pw_stream_queue_buffer()
  * to let PipeWire reuse the buffer.
  *
+ * Although not strictly required, it is recommended to call \ref
+ * pw_stream_dequeue_buffer() and pw_stream_queue_buffer() from the
+ * process() callback to minimize the amount of buffering and
+ * maximize the amount of buffer reuse in the stream.
+ *
+ * It is also possible to dequeue the buffer from the process event,
+ * then process and queue the buffer from a helper thread. It is also
+ * possible to dequeue, process and queue a buffer from a helper thread
+ * after receiving the process event.
+ *
  * \subsection ssec_produce Produce data
  *
+ * The process event is emitted when a new buffer should be queued.
+ *
+ * When the PW_STREAM_FLAG_RT_PROCESS flag was given, this function will be
+ * called from a realtime thread and it is not safe to call non-reatime
+ * functions such as doing file operations, blocking operations or any of
+ * the PipeWire functions that are not explicitly marked as being RT safe.
+ *
  * \ref pw_stream_dequeue_buffer() gives an empty buffer that can be filled.
  *
  * The buffer is owned by the stream and stays alive until the
@@ -136,8 +159,45 @@ extern "C" {
  *
  * Filled buffers should be queued with \ref pw_stream_queue_buffer().
  *
- * The process event is emitted when PipeWire has emptied a buffer that
- * can now be refilled.
+ * Although not strictly required, it is recommended to call \ref
+ * pw_stream_dequeue_buffer() and pw_stream_queue_buffer() from the
+ * process() callback to minimize the amount of buffering and
+ * maximize the amount of buffer reuse in the stream.
+ *
+ * Buffers that are queued after the process event completes will be delayed
+ * to the next processing cycle.
+ *
+ * \section sec_stream_driving Driving the graph
+ *
+ * Starting in 0.3.34, it is possible for a stream to drive the graph.
+ * This allows interrupt-driven scheduling for drivers implemented as
+ * PipeWire streams, without having to reimplement the stream as a SPA
+ * plugin.
+ *
+ * A stream cannot drive the graph unless it is in the
+ * \ref PW_STREAM_STATE_STREAMING state and \ref pw_stream_is_driving() returns
+ * true. It must then use pw_stream_trigger_process() to start the graph
+ * cycle.
+ *
+ * \ref pw_stream_trigger_process() will result in a process event, where a buffer
+ * should be dequeued, and queued again. This is the recommended behaviour that
+ * minimizes buffering and maximized buffer reuse.
+ *
+ * Producers of data that drive the graph can also dequeue a buffer in a helper
+ * thread, fill it with data and then call \ref pw_stream_trigger_process() to
+ * start the graph cycle. In the process event they will then queue the filled
+ * buffer and dequeue a new empty buffer to fill again in the helper thread,
+ *
+ * Consumers of data that drive the graph (pull based scheduling) will use
+ * \ref pw_stream_trigger_process() to start the graph and will dequeue, process
+ * and queue the buffers in the process event.
+ *
+ * \section sec_stream_process_requests Request processing
+ *
+ * A stream that is not driving the graph can request a new graph cycle by doing
+ * \ref pw_stream_trigger_process(). This will result in a RequestProcess command
+ * in the driver stream. If the driver supports this, it can then perform
+ * \ref pw_stream_trigger_process() to start the actual graph cycle.
  *
  * \section sec_stream_disconnect Disconnect
  *
@@ -151,6 +211,9 @@ extern "C" {
  *
  * \section sec_stream_environment Environment Variables
  *
+ * The environment variable PIPEWIRE_AUTOCONNECT can be used to override the
+ * flag and force apps to autoconnect or not.
+ *
  */
 /** \defgroup pw_stream Stream
  *
@@ -159,7 +222,7 @@ extern "C" {
  * The stream object provides a convenient way to send and
  * receive data streams from/to PipeWire.
  *
- * See also \ref page_streams and \ref api_pw_core
+ * \see \ref page_streams, \ref api_pw_core
  */
 
 /**
@@ -171,6 +234,7 @@ struct pw_stream;
 #include 
 #include 
 #include 
+#include 
 
 /** \enum pw_stream_state The state of a stream */
 enum pw_stream_state {
@@ -182,19 +246,29 @@ enum pw_stream_state {
 };
 
 /** a buffer structure obtained from pw_stream_dequeue_buffer(). The size of this
-  * structure can grow as more field are added in the future */
+  * structure can grow as more fields are added in the future */
 struct pw_buffer {
     struct spa_buffer *buffer;    /**< the spa buffer */
-    void *user_data;        /**< user data attached to the buffer */
+    void *user_data;        /**< user data attached to the buffer. The user of
+                      *  the stream can set custom data associated with the
+                      *  buffer, typically in the add_buffer event. Any
+                      *  cleanup should be performed in the remove_buffer
+                      *  event. The user data is returned unmodified each
+                      *  time a buffer is dequeued. */
     uint64_t size;            /**< This field is set by the user and the sum of
-                      *  all queued buffer is returned in the time info.
+                      *  all queued buffers is returned in the time info.
                       *  For audio, it is advised to use the number of
-                      *  samples in the buffer for this field. */
+                      *  frames in the buffer for this field. */
     uint64_t requested;        /**< For playback streams, this field contains the
                       *  suggested amount of data to provide. For audio
-                      *  streams this will be the amount of samples
+                      *  streams this will be the amount of frames
                       *  required by the resampler. This field is 0
                       *  when no suggestion is provided. Since 0.3.49 */
+    uint64_t time;            /**< For capture streams, this field contains the
+                      *  cycle time in nanoseconds when this buffer was
+                      *  queued in the stream. It can be compared against
+                      *  the pw_time values or pw_stream_get_nsec()
+                      *  Since 1.0.5 */
 };
 
 struct pw_stream_control {
@@ -223,25 +297,33 @@ struct pw_stream_control {
  * value, and pw_time.ticks, were captured at pw_time.now and can be extrapolated
  * to the current time like this:
  *
- *    struct timespec ts;
- *    clock_gettime(CLOCK_MONOTONIC, &ts);
- *    int64_t diff = SPA_TIMESPEC_TO_NSEC(&ts) - pw_time.now;
+ *\code{.c}
+ *    uint64_t now = pw_stream_get_nsec(stream);
+ *    int64_t diff = now - pw_time.now;
  *    int64_t elapsed = (pw_time.rate.denom * diff) / (pw_time.rate.num * SPA_NSEC_PER_SEC);
+ *\endcode
  *
  * pw_time.delay contains the total delay that a signal will travel through the
  * graph. This includes the delay caused by filters in the graph as well as delays
  * caused by the hardware. The delay is usually quite stable and should only change when
  * the topology, quantum or samplerate of the graph changes.
  *
+ * The delay requires the application to send the stream early relative to other synchronized
+ * streams in order to arrive at the edge of the graph in time. This is usually done by
+ * delaying the other streams with the given delay.
+ *
+ * Note that the delay can be negative. A negative delay means that this stream should be
+ * delayed with the (positive) delay relative to other streams.
+ *
  * pw_time.queued and pw_time.buffered is expressed in the time domain of the stream,
  * or the format that is used for the buffers of this stream.
  *
  * pw_time.queued is the sum of all the pw_buffer.size fields of the buffers that are
  * currently queued in the stream but not yet processed. The application can choose
- * the units of this value, for example, time, samples or bytes (below expressed
- * as app.rate).
+ * the units of this value, for example, time, samples, frames or bytes (below
+ * expressed as app.rate).
  *
- * pw_time.buffered is format dependent, for audio/raw it contains the number of samples
+ * pw_time.buffered is format dependent, for audio/raw it contains the number of frames
  * that are buffered inside the resampler/converter.
  *
  * The total delay of data in a stream is the sum of the queued and buffered data
@@ -252,15 +334,21 @@ struct pw_stream_control {
  * in milliseconds for the first sample in the newly queued buffer to be played
  * by the hardware can be calculated as:
  *
+ *\code{.unparsed}
  *  (pw_time.buffered * 1000 / stream.samplerate) +
  *    (pw_time.queued * 1000 / app.rate) +
  *     ((pw_time.delay - elapsed) * 1000 * pw_time.rate.num / pw_time.rate.denom)
+ *\endcode
  *
  * The current extrapolated time (in ms) in the source or sink can be calculated as:
  *
+ *\code{.unparsed}
  *  (pw_time.ticks + elapsed) * 1000 * pw_time.rate.num / pw_time.rate.denom
+ *\endcode
  *
+ * Below is an overview of the different timing values:
  *
+ *\code{.unparsed}
  *           stream time domain           graph time domain
  *         /-----------------------\/-----------------------------\
  *
@@ -272,14 +360,15 @@ struct pw_stream_control {
  *                                    latency             latency
  *         \--------/\-------------/\-----------------------------/
  *           queued      buffered            delay
+ *\endcode
  */
 struct pw_time {
-    int64_t now;            /**< the monotonic time in nanoseconds. This is the time
-                      *  when this time report was updated. It is usually
-                      *  updated every graph cycle. You can use the current
-                      *  monotonic time to calculate the elapsed time between
-                      *  this report and the current state and calculate
-                      *  updated ticks and delay values. */
+    int64_t now;            /**< the time in nanoseconds. This is the time when this
+                      *  time report was updated. It is usually updated every
+                      *  graph cycle. You can use pw_stream_get_nsec() to
+                      *  calculate the elapsed time between this report and
+                      *  the current time and calculate updated ticks and delay
+                      *  values. */
     struct spa_fraction rate;    /**< the rate of \a ticks and delay. This is usually
                       *  expressed in 1/. */
     uint64_t ticks;            /**< the ticks at \a now. This is the current time that
@@ -298,10 +387,14 @@ struct pw_time {
                       *  of the size fields in the pw_buffer that are
                       *  currently queued */
     uint64_t buffered;        /**< for audio/raw streams, this contains the extra
-                      *  number of samples buffered in the resampler.
+                      *  number of frames buffered in the resampler.
                       *  Since 0.3.50. */
-    uint32_t queued_buffers;    /**< The number of buffers that are queued. Since 0.3.50 */
-    uint32_t avail_buffers;        /**< The number of buffers that can be dequeued. Since 0.3.50 */
+    uint32_t queued_buffers;    /**< the number of buffers that are queued. Since 0.3.50 */
+    uint32_t avail_buffers;        /**< the number of buffers that can be dequeued. Since 0.3.50 */
+    uint64_t size;            /**< for audio/raw playback streams, this contains the number of
+                      *  samples requested by the resampler for the current
+                      *  quantum. for audio/raw capture streams this will be the number
+                      *  of samples available for the current quantum. Since 1.1.0 */
 };
 
 #include 
@@ -342,7 +435,10 @@ struct pw_stream_events {
     /** A command notify, Since 0.3.39:1 */
     void (*command) (void *data, const struct spa_command *command);
 
-    /** a trigger_process completed. Since version 0.3.40:2 */
+    /** a trigger_process completed. Since version 0.3.40:2.
+     *  This is normally called from the mainloop but since 1.1.0 it
+     *  can also be called directly from the realtime data
+     *  thread if the user is prepared to deal with this. */
     void (*trigger_done) (void *data);
 };
 
@@ -357,7 +453,8 @@ enum pw_stream_flags {
     PW_STREAM_FLAG_INACTIVE        = (1 << 1),    /**< start the stream inactive,
                               *  pw_stream_set_active() needs to be
                               *  called explicitly */
-    PW_STREAM_FLAG_MAP_BUFFERS    = (1 << 2),    /**< mmap the buffers except DmaBuf */
+    PW_STREAM_FLAG_MAP_BUFFERS    = (1 << 2),    /**< mmap the buffers except DmaBuf that is not
+                              *  explicitly marked as mappable. */
     PW_STREAM_FLAG_DRIVER        = (1 << 3),    /**< be a driver */
     PW_STREAM_FLAG_RT_PROCESS    = (1 << 4),    /**< call process from the realtime
                               *  thread. You MUST use RT safe functions
@@ -375,9 +472,24 @@ enum pw_stream_flags {
                               *  needs to be called. This can be used
                               *  when the output of the stream depends
                               *  on input from other streams. */
+    PW_STREAM_FLAG_ASYNC        = (1 << 10),    /**< Buffers will not be dequeued/queued from
+                              *  the realtime process() function. This is
+                              *  assumed when RT_PROCESS is unset but can
+                              *  also be the case when the process() function
+                              *  does a trigger_process() that will then
+                              *  dequeue/queue a buffer from another process()
+                              *  function. since 0.3.73 */
+    PW_STREAM_FLAG_EARLY_PROCESS    = (1 << 11),    /**< Call process as soon as there is a buffer
+                              *  to dequeue. This is only relevant for
+                              *  playback and when not using RT_PROCESS. It
+                              *  can be used to keep the maximum number of
+                              *  buffers queued. Since 0.3.81 */
+    PW_STREAM_FLAG_RT_TRIGGER_DONE    = (1 << 12),    /**< Call trigger_done from the realtime
+                              *  thread. You MUST use RT safe functions
+                              *  in the trigger_done callback. Since 1.1.0 */
 };
 
-/** Create a new unconneced \ref pw_stream
+/** Create a new unconnected \ref pw_stream
  * \return a newly allocated \ref pw_stream */
 struct pw_stream *
 pw_stream_new(struct pw_core *core,        /**< a \ref pw_core */
@@ -385,7 +497,7 @@ pw_stream_new(struct pw_core *core,        /**< a \ref pw_core */
           struct pw_properties *props    /**< stream properties, ownership is taken */);
 
 struct pw_stream *
-pw_stream_new_simple(struct pw_loop *loop,    /**< a \ref pw_loop to use */
+pw_stream_new_simple(struct pw_loop *loop,    /**< a \ref pw_loop to use as the main loop */
              const char *name,        /**< a stream media name */
              struct pw_properties *props,/**< stream properties, ownership is taken */
              const struct pw_stream_events *events,    /**< stream events */
@@ -447,45 +559,62 @@ int pw_stream_set_error(struct pw_stream *stream,    /**< a \ref pw_stream */
             const char *error,        /**< an error message */
             ...) SPA_PRINTF_FUNC(3, 4);
 
-/** Complete the negotiation process with result code \a res
- *
- * This function should be called after notification of the format.
-
- * When \a res indicates success, \a params contain the parameters for the
- * allocation state.  */
+/** Update the param exposed on the stream. */
 int
 pw_stream_update_params(struct pw_stream *stream,    /**< a \ref pw_stream */
-            const struct spa_pod **params,    /**< an array of params. The params should
-                              *  ideally contain parameters for doing
-                              *  buffer allocation. */
+            const struct spa_pod **params,    /**< an array of params. */
             uint32_t n_params        /**< number of elements in \a params */);
 
+/**
+ * Set a parameter on the stream. This is like pw_stream_set_control() but with
+ * a complete spa_pod param. It can also be called from the param_changed event handler
+ * to intercept and modify the param for the adapter. Since 0.3.70 */
+int pw_stream_set_param(struct pw_stream *stream,    /**< a \ref pw_stream */
+            uint32_t id,            /**< the id of the param */
+            const struct spa_pod *param    /**< the params to set */);
+
 /** Get control values */
 const struct pw_stream_control *pw_stream_get_control(struct pw_stream *stream, uint32_t id);
 
 /** Set control values */
 int pw_stream_set_control(struct pw_stream *stream, uint32_t id, uint32_t n_values, float *values, ...);
 
-/** Query the time on the stream */
+/** Query the time on the stream, RT safe */
 int pw_stream_get_time_n(struct pw_stream *stream, struct pw_time *time, size_t size);
 
+/** Get the current time in nanoseconds. This value can be compared with
+ * the \ref pw_time.now value. RT safe. Since 1.1.0 */
+uint64_t pw_stream_get_nsec(struct pw_stream *stream);
+
+/** Get the data loop that is doing the processing of this stream. This loop
+ * is assigned after pw_stream_connect().  * Since 1.1.0 */
+struct pw_loop *pw_stream_get_data_loop(struct pw_stream *stream);
+
 /** Query the time on the stream, deprecated since 0.3.50,
- * use pw_stream_get_time_n() to get the fields added since 0.3.50. */
+ * use pw_stream_get_time_n() to get the fields added since 0.3.50. RT safe. */
 SPA_DEPRECATED
 int pw_stream_get_time(struct pw_stream *stream, struct pw_time *time);
 
 /** Get a buffer that can be filled for playback streams or consumed
- * for capture streams. */
+ * for capture streams. RT safe. */
 struct pw_buffer *pw_stream_dequeue_buffer(struct pw_stream *stream);
 
-/** Submit a buffer for playback or recycle a buffer for capture. */
+/** Submit a buffer for playback or recycle a buffer for capture. RT safe. */
 int pw_stream_queue_buffer(struct pw_stream *stream, struct pw_buffer *buffer);
 
+/** Return a buffer to the queue without using it. This makes the buffer
+ * immediately available to dequeue again. RT safe. */
+int pw_stream_return_buffer(struct pw_stream *stream, struct pw_buffer *buffer);
+
 /** Activate or deactivate the stream */
 int pw_stream_set_active(struct pw_stream *stream, bool active);
 
 /** Flush a stream. When \a drain is true, the drained callback will
- * be called when all data is played or recorded */
+ * be called when all data is played or recorded. The stream can be resumed
+ * after the drain by setting it active again with
+ * \ref pw_stream_set_active(). A flush without a drain is mostly useful afer
+ * a state change to PAUSED, to flush any remaining data from the queues and
+ * the converters. RT safe. */
 int pw_stream_flush(struct pw_stream *stream, bool drain);
 
 /** Check if the stream is driving. The stream needs to have the
@@ -494,10 +623,64 @@ int pw_stream_flush(struct pw_stream *stream, bool drain);
  * available (output) or needed (input). Since 0.3.34 */
 bool pw_stream_is_driving(struct pw_stream *stream);
 
+/** Check if the graph is using lazy scheduling. If the stream is
+ * driving according to \ref pw_stream_is_driving(), then it should
+ * consider taking into account the RequestProcess commands when
+ * driving the graph.
+ *
+ * If the stream is not driving, it should send out RequestProcess
+ * events with \ref pw_stream_emit_event() or indirectly with
+ * \ref pw_stream_trigger_process() to suggest a new graph cycle
+ * to the driver.
+ *
+ * It is not a requirement that all RequestProcess events/commands
+ * need to start a graph cycle.
+ * Since 1.4.0 */
+bool pw_stream_is_lazy(struct pw_stream *stream);
+
 /** Trigger a push/pull on the stream. One iteration of the graph will
- * scheduled and process() will be called. Since 0.3.34 */
+ * be scheduled when the stream is driving according to
+ * \ref pw_stream_is_driving(). If it successfully finishes, process()
+ * will be called and the trigger_done event will be emitted. It is
+ * possible for the graph iteration to not finish, so
+ * pw_stream_trigger_process() needs to be called again even if process()
+ * and trigger_done is not called.
+ *
+ * If there is a deadline after which the stream will have xrun,
+ * pw_stream_trigger_process() should be called then, whether or not
+ * process()/trigger_done has been called. Sound hardware will xrun if
+ * there is any delay in audio processing, so the ALSA plugin triggers the
+ * graph every quantum to ensure audio keeps flowing. Drivers that
+ * do not have a deadline, such as the freewheel driver, should
+ * use a timeout to ensure that forward progress keeps being made.
+ * A reasonable choice of deadline is three times the quantum: if
+ * the graph is taking 3x longer than normal, it is likely that it
+ * is hung and should be retriggered.
+ *
+ * Streams that are not drivers according to \ref pw_stream_is_driving()
+ * can also call this method. The result is that a RequestProcess event
+ * is sent to the driver. If the graph is lazy scheduling according to
+ * \ref pw_stream_is_lazy(), this might result in a graph cycle by the
+ * driver. If the graph is not lazy scheduling and the stream is not a
+ * driver, this method will have no effect.
+ *
+ * RT safe.
+ *
+ * Since 0.3.34 */
 int pw_stream_trigger_process(struct pw_stream *stream);
 
+/** Emit an event from this stream. RT safe.
+ * Since 1.2.6 */
+int pw_stream_emit_event(struct pw_stream *stream, const struct spa_event *event);
+
+/** Adjust the rate of the stream.
+ * When the stream is using an adaptive resampler, adjust the resampler rate.
+ * When there is no resampler, -ENOTSUP is returned. Activating the adaptive
+ * resampler will add a small amount of delay to the samples, you can deactivate
+ * it again by setting a value <= 0.0. RT safe.
+ * Since 1.4.0 */
+int pw_stream_set_rate(struct pw_stream *stream, double rate);
+
 /**
  * \}
  */
diff --git a/src/java.desktop/unix/native/libpipewire/include/pipewire/type.h b/src/java.desktop/unix/native/libpipewire/include/pipewire/type.h
new file mode 100644
index 000000000000..2035811666ea
--- /dev/null
+++ b/src/java.desktop/unix/native/libpipewire/include/pipewire/type.h
@@ -0,0 +1,45 @@
+/* PipeWire */
+/* SPDX-FileCopyrightText: Copyright © 2018 Wim Taymans */
+/* SPDX-License-Identifier: MIT */
+
+#ifndef PIPEWIRE_TYPE_H
+#define PIPEWIRE_TYPE_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include 
+
+/** \defgroup pw_type Type info
+ * Type information
+ */
+
+/**
+ * \addtogroup pw_type
+ * \{
+ */
+
+enum {
+    PW_TYPE_FIRST = SPA_TYPE_VENDOR_PipeWire,
+};
+
+#define PW_TYPE_INFO_BASE        "PipeWire:"
+
+#define PW_TYPE_INFO_Object        PW_TYPE_INFO_BASE "Object"
+#define PW_TYPE_INFO_OBJECT_BASE    PW_TYPE_INFO_Object ":"
+
+#define PW_TYPE_INFO_Interface        PW_TYPE_INFO_BASE "Interface"
+#define PW_TYPE_INFO_INTERFACE_BASE    PW_TYPE_INFO_Interface ":"
+
+const struct spa_type_info * pw_type_info(void);
+
+/**
+ * \}
+ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* PIPEWIRE_TYPE_H */
diff --git a/src/java.desktop/unix/native/libpipewire/include/pipewire/utils.h b/src/java.desktop/unix/native/libpipewire/include/pipewire/utils.h
index 19110db81a4a..c58432048754 100644
--- a/src/java.desktop/unix/native/libpipewire/include/pipewire/utils.h
+++ b/src/java.desktop/unix/native/libpipewire/include/pipewire/utils.h
@@ -15,11 +15,13 @@ extern "C" {
 #ifndef _POSIX_C_SOURCE
 # include 
 #endif
+#include 
 
 #ifndef ENODATA
 #define ENODATA 9919
 #endif
 
+#include 
 #include 
 #include 
 
@@ -45,6 +47,12 @@ pw_split_strv(const char *str, const char *delimiter, int max_tokens, int *n_tok
 int
 pw_split_ip(char *str, const char *delimiter, int max_tokens, char *tokens[]);
 
+char **pw_strv_parse(const char *val, size_t len, int max_tokens, int *n_tokens);
+
+int pw_strv_find(char **a, const char *b);
+
+int pw_strv_find_common(char **a, char **b);
+
 void
 pw_free_strv(char **str);
 
@@ -92,6 +100,10 @@ void* pw_reallocarray(void *ptr, size_t nmemb, size_t size);
  * \}
  */
 
+SPA_DEFINE_AUTO_CLEANUP(pw_strv, char **, {
+    spa_clear_ptr(*thing, pw_free_strv);
+})
+
 #ifdef __cplusplus
 } /* extern "C" */
 #endif
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/buffer/buffer.h b/src/java.desktop/unix/native/libpipewire/include/spa/buffer/buffer.h
index a5e2ac7ffff4..b287a76dec13 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/buffer/buffer.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/buffer/buffer.h
@@ -12,6 +12,14 @@ extern "C" {
 #include 
 #include 
 
+#ifndef SPA_API_BUFFER
+ #ifdef SPA_API_IMPL
+  #define SPA_API_BUFFER SPA_API_IMPL
+ #else
+  #define SPA_API_BUFFER static inline
+ #endif
+#endif
+
 /** \defgroup spa_buffer Buffers
  *
  * Buffers describe the data and metadata that is exchanged between
@@ -27,9 +35,15 @@ enum spa_data_type {
     SPA_DATA_Invalid,
     SPA_DATA_MemPtr,        /**< pointer to memory, the data field in
                       *  struct spa_data is set. */
-    SPA_DATA_MemFd,            /**< generic fd, mmap to get to memory */
-    SPA_DATA_DmaBuf,        /**< fd to dmabuf memory */
-    SPA_DATA_MemId,            /**< memory is identified with an id */
+    SPA_DATA_MemFd,            /**< memfd, mmap to get to memory. */
+    SPA_DATA_DmaBuf,        /**< fd to dmabuf memory. This might not be readily
+                      *  mappable (unless the MAPPABLE flag is set) and should
+                      *  normally be handled with DMABUF apis. */
+    SPA_DATA_MemId,            /**< memory is identified with an id. The actual memory
+                      *  can be obtained in some other way and can be identified
+                      *  with this id. */
+    SPA_DATA_SyncObj,        /**< a syncobj, usually requires a spa_meta_sync_timeline metadata
+                      *  with timeline points. */
 
     _SPA_DATA_LAST,            /**< not part of ABI */
 };
@@ -65,9 +79,12 @@ struct spa_data {
 #define SPA_DATA_FLAG_WRITABLE    (1u<<1)    /**< data is writable */
 #define SPA_DATA_FLAG_DYNAMIC    (1u<<2)    /**< data pointer can be changed */
 #define SPA_DATA_FLAG_READWRITE    (SPA_DATA_FLAG_READABLE|SPA_DATA_FLAG_WRITABLE)
+#define SPA_DATA_FLAG_MAPPABLE    (1u<<3)    /**< data is mappable with simple mmap/munmap. Some memory
+                      *  types are not simply mappable (DmaBuf) unless explicitly
+                      *  specified with this flag. */
     uint32_t flags;            /**< data flags */
     int64_t fd;            /**< optional fd for data */
-    uint32_t mapoffset;        /**< offset to map fd at */
+    uint32_t mapoffset;        /**< offset to map fd at, this is page aligned */
     uint32_t maxsize;        /**< max size of data */
     void *data;            /**< optional data pointer */
     struct spa_chunk *chunk;    /**< valid chunk of memory */
@@ -82,7 +99,7 @@ struct spa_buffer {
 };
 
 /** Find metadata in a buffer */
-static inline struct spa_meta *spa_buffer_find_meta(const struct spa_buffer *b, uint32_t type)
+SPA_API_BUFFER struct spa_meta *spa_buffer_find_meta(const struct spa_buffer *b, uint32_t type)
 {
     uint32_t i;
 
@@ -93,7 +110,7 @@ static inline struct spa_meta *spa_buffer_find_meta(const struct spa_buffer *b,
     return NULL;
 }
 
-static inline void *spa_buffer_find_meta_data(const struct spa_buffer *b, uint32_t type, size_t size)
+SPA_API_BUFFER void *spa_buffer_find_meta_data(const struct spa_buffer *b, uint32_t type, size_t size)
 {
     struct spa_meta *m;
     if ((m = spa_buffer_find_meta(b, type)) && m->size >= size)
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/buffer/meta.h b/src/java.desktop/unix/native/libpipewire/include/spa/buffer/meta.h
index bf67f12b7f15..dbb452b56d70 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/buffer/meta.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/buffer/meta.h
@@ -12,6 +12,14 @@ extern "C" {
 #include 
 #include 
 
+#ifndef SPA_API_META
+ #ifdef SPA_API_IMPL
+  #define SPA_API_META SPA_API_IMPL
+ #else
+  #define SPA_API_META static inline
+ #endif
+#endif
+
 /**
  * \addtogroup spa_buffer
  * \{
@@ -28,6 +36,7 @@ enum spa_meta_type {
                       *  associated with the data */
     SPA_META_Busy,            /**< don't write to buffer when count > 0 */
     SPA_META_VideoTransform,    /**< struct spa_meta_transform */
+    SPA_META_SyncTimeline,        /**< struct spa_meta_sync_timeline */
 
     _SPA_META_LAST,            /**< not part of ABI/API */
 };
@@ -45,14 +54,13 @@ struct spa_meta {
     void *data;        /**< pointer to metadata */
 };
 
-static inline void *spa_meta_first(const struct spa_meta *m) {
+SPA_API_META void *spa_meta_first(const struct spa_meta *m) {
     return m->data;
 }
-#define spa_meta_first spa_meta_first
-static inline void *spa_meta_end(const struct spa_meta *m) {
+
+SPA_API_META void *spa_meta_end(const struct spa_meta *m) {
     return SPA_PTROFF(m->data,m->size,void);
 }
-#define spa_meta_end spa_meta_end
 #define spa_meta_check(p,m)    (SPA_PTROFF(p,sizeof(*(p)),void) <= spa_meta_end(m))
 
 /**
@@ -79,19 +87,16 @@ struct spa_meta_region {
     struct spa_region region;
 };
 
-static inline bool spa_meta_region_is_valid(const struct spa_meta_region *m) {
+SPA_API_META bool spa_meta_region_is_valid(const struct spa_meta_region *m) {
     return m->region.size.width != 0 && m->region.size.height != 0;
 }
-#define spa_meta_region_is_valid spa_meta_region_is_valid
 
 /** iterate all the items in a metadata */
 #define spa_meta_for_each(pos,meta)                    \
-    for ((pos) = (__typeof(pos))spa_meta_first(meta);            \
+    for ((pos) = (__typeof(pos))spa_meta_first(meta);        \
         spa_meta_check(pos, meta);                    \
             (pos)++)
 
-#define spa_meta_bitmap_is_valid(m)    ((m)->format != 0)
-
 /**
  * Bitmap information
  *
@@ -111,7 +116,9 @@ struct spa_meta_bitmap {
                       *  info. */
 };
 
-#define spa_meta_cursor_is_valid(m)    ((m)->id != 0)
+SPA_API_META bool spa_meta_bitmap_is_valid(const struct spa_meta_bitmap *m) {
+    return m->format != 0;
+}
 
 /**
  * Cursor information
@@ -131,6 +138,10 @@ struct spa_meta_cursor {
                       *  struct spa_meta_bitmap at the offset. */
 };
 
+SPA_API_META bool spa_meta_cursor_is_valid(const struct spa_meta_cursor *m) {
+    return m->id != 0;
+}
+
 /** a timed set of events associated with the buffer */
 struct spa_meta_control {
     struct spa_pod_sequence sequence;
@@ -149,7 +160,7 @@ enum spa_meta_videotransform_value {
     SPA_META_TRANSFORMATION_270,        /**< 270 degree counter-clockwise */
     SPA_META_TRANSFORMATION_Flipped,    /**< 180 degree flipped around the vertical axis. Equivalent
                           * to a reflexion through the vertical line splitting the
-                          * bufffer in two equal sized parts */
+                          * buffer in two equal sized parts */
     SPA_META_TRANSFORMATION_Flipped90,    /**< flip then rotate around 90 degree counter-clockwise */
     SPA_META_TRANSFORMATION_Flipped180,    /**< flip then rotate around 180 degree counter-clockwise */
     SPA_META_TRANSFORMATION_Flipped270,    /**< flip then rotate around 270 degree counter-clockwise */
@@ -161,6 +172,26 @@ struct spa_meta_videotransform {
                           *  one of enum spa_meta_videotransform_value */
 };
 
+/**
+ * A timeline point for explicit sync
+ *
+ * Metadata to describe the time on the timeline when the buffer
+ * can be acquired and when it can be reused.
+ *
+ * This metadata will require negotiation of 2 extra fds for the acquire
+ * and release timelines respectively.  One way to achieve this is to place
+ * this metadata as SPA_PARAM_BUFFERS_metaType when negotiating a buffer
+ * layout with 2 extra fds.
+ */
+struct spa_meta_sync_timeline {
+    uint32_t flags;
+    uint32_t padding;
+    uint64_t acquire_point;            /**< the timeline acquire point, this is when the data
+                          *  can be accessed. */
+    uint64_t release_point;            /**< the timeline release point, this timeline point should
+                          *  be signaled when the data is no longer accessed. */
+};
+
 /**
  * \}
  */
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/buffer/type-info.h b/src/java.desktop/unix/native/libpipewire/include/spa/buffer/type-info.h
index a5208c0b944d..2a9c43c3a421 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/buffer/type-info.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/buffer/type-info.h
@@ -35,6 +35,7 @@ static const struct spa_type_info spa_type_data_type[] = {
     { SPA_DATA_MemFd, SPA_TYPE_Int, SPA_TYPE_INFO_DATA_FD_BASE "MemFd", NULL },
     { SPA_DATA_DmaBuf, SPA_TYPE_Int, SPA_TYPE_INFO_DATA_FD_BASE "DmaBuf", NULL },
     { SPA_DATA_MemId, SPA_TYPE_Int, SPA_TYPE_INFO_DATA_BASE "MemId", NULL },
+    { SPA_DATA_SyncObj, SPA_TYPE_Int, SPA_TYPE_INFO_DATA_BASE "SyncObj", NULL },
     { 0, 0, NULL, NULL },
 };
 
@@ -50,6 +51,22 @@ static const struct spa_type_info spa_type_data_type[] = {
 #define SPA_TYPE_INFO_META_ARRAY_Region        SPA_TYPE_INFO_META_ARRAY_BASE "Region"
 #define SPA_TYPE_INFO_META_ARRAY_REGION_BASE    SPA_TYPE_INFO_META_ARRAY_Region ":"
 
+/* VideoTransform meta */
+#define SPA_TYPE_INFO_META_Transformation    SPA_TYPE_INFO_ENUM_BASE "Meta:Transformation"
+#define SPA_TYPE_INFO_META_TRANSFORMATION_BASE    SPA_TYPE_INFO_META_Transformation ":"
+
+static const struct spa_type_info spa_type_meta_videotransform_type[] = {
+    { SPA_META_TRANSFORMATION_None, SPA_TYPE_Int, SPA_TYPE_INFO_META_TRANSFORMATION_BASE "None", NULL },
+    { SPA_META_TRANSFORMATION_90, SPA_TYPE_Int, SPA_TYPE_INFO_META_TRANSFORMATION_BASE "90", NULL },
+    { SPA_META_TRANSFORMATION_180, SPA_TYPE_Int, SPA_TYPE_INFO_META_TRANSFORMATION_BASE "180", NULL },
+    { SPA_META_TRANSFORMATION_270, SPA_TYPE_Int, SPA_TYPE_INFO_META_TRANSFORMATION_BASE "270", NULL },
+    { SPA_META_TRANSFORMATION_Flipped, SPA_TYPE_Int, SPA_TYPE_INFO_META_TRANSFORMATION_BASE "Flipped", NULL },
+    { SPA_META_TRANSFORMATION_Flipped90, SPA_TYPE_Int, SPA_TYPE_INFO_META_TRANSFORMATION_BASE "Flipped90", NULL },
+    { SPA_META_TRANSFORMATION_Flipped180, SPA_TYPE_Int, SPA_TYPE_INFO_META_TRANSFORMATION_BASE "Flipped180", NULL },
+    { SPA_META_TRANSFORMATION_Flipped270, SPA_TYPE_Int, SPA_TYPE_INFO_META_TRANSFORMATION_BASE "Flipped270", NULL },
+    { 0, 0, NULL, NULL },
+};
+
 static const struct spa_type_info spa_type_meta_type[] = {
     { SPA_META_Invalid, SPA_TYPE_Pointer, SPA_TYPE_INFO_META_BASE "Invalid", NULL },
     { SPA_META_Header, SPA_TYPE_Pointer, SPA_TYPE_INFO_META_BASE "Header", NULL },
@@ -60,6 +77,7 @@ static const struct spa_type_info spa_type_meta_type[] = {
     { SPA_META_Control, SPA_TYPE_Pointer, SPA_TYPE_INFO_META_BASE "Control", NULL },
     { SPA_META_Busy, SPA_TYPE_Pointer, SPA_TYPE_INFO_META_BASE "Busy", NULL },
     { SPA_META_VideoTransform, SPA_TYPE_Pointer, SPA_TYPE_INFO_META_BASE "VideoTransform", NULL },
+    { SPA_META_SyncTimeline, SPA_TYPE_Pointer, SPA_TYPE_INFO_META_BASE "SyncTimeline", NULL },
     { 0, 0, NULL, NULL },
 };
 
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/control/control.h b/src/java.desktop/unix/native/libpipewire/include/spa/control/control.h
index ed04c7e5b968..43877eef9cc0 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/control/control.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/control/control.h
@@ -24,9 +24,12 @@ extern "C" {
 /** Different Control types */
 enum spa_control_type {
     SPA_CONTROL_Invalid,
-    SPA_CONTROL_Properties,        /**< data contains a SPA_TYPE_OBJECT_Props */
-    SPA_CONTROL_Midi,        /**< data contains a spa_pod_bytes with raw midi data */
-    SPA_CONTROL_OSC,        /**< data contains a spa_pod_bytes with an OSC packet */
+    SPA_CONTROL_Properties,        /**< SPA_TYPE_OBJECT_Props */
+    SPA_CONTROL_Midi,        /**< spa_pod_bytes with raw midi data (deprecated, use SPA_CONTROL_UMP) */
+    SPA_CONTROL_OSC,        /**< spa_pod_bytes with an OSC packet */
+    SPA_CONTROL_UMP,        /**< spa_pod_bytes with raw UMP (universal MIDI packet)
+                      *  data. The UMP 32 bit words are stored in native endian
+                      *  format. */
 
     _SPA_CONTROL_LAST,        /**< not part of ABI */
 };
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/control/type-info.h b/src/java.desktop/unix/native/libpipewire/include/spa/control/type-info.h
index a3a61a153c7b..3db937ec616f 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/control/type-info.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/control/type-info.h
@@ -27,6 +27,7 @@ static const struct spa_type_info spa_type_control[] = {
     { SPA_CONTROL_Properties, SPA_TYPE_Int, SPA_TYPE_INFO_CONTROL_BASE "Properties", NULL },
     { SPA_CONTROL_Midi, SPA_TYPE_Int, SPA_TYPE_INFO_CONTROL_BASE "Midi", NULL },
     { SPA_CONTROL_OSC, SPA_TYPE_Int, SPA_TYPE_INFO_CONTROL_BASE "OSC", NULL },
+    { SPA_CONTROL_UMP, SPA_TYPE_Int, SPA_TYPE_INFO_CONTROL_BASE "UMP", NULL },
     { 0, 0, NULL, NULL },
 };
 
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/debug/types.h b/src/java.desktop/unix/native/libpipewire/include/spa/debug/types.h
index dda912e7c04e..b32fd28ed9c7 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/debug/types.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/debug/types.h
@@ -18,7 +18,16 @@ extern "C" {
 
 #include 
 
-static inline const struct spa_type_info *spa_debug_type_find(const struct spa_type_info *info, uint32_t type)
+#ifndef SPA_API_DEBUG_TYPES
+ #ifdef SPA_API_IMPL
+  #define SPA_API_DEBUG_TYPES SPA_API_IMPL
+ #else
+  #define SPA_API_DEBUG_TYPES static inline
+ #endif
+#endif
+
+
+SPA_API_DEBUG_TYPES const struct spa_type_info *spa_debug_type_find(const struct spa_type_info *info, uint32_t type)
 {
     const struct spa_type_info *res;
 
@@ -37,22 +46,19 @@ static inline const struct spa_type_info *spa_debug_type_find(const struct spa_t
     return NULL;
 }
 
-static inline const char *spa_debug_type_short_name(const char *name)
+SPA_API_DEBUG_TYPES const char *spa_debug_type_short_name(const char *name)
 {
-    const char *h;
-    if ((h = strrchr(name, ':')) != NULL)
-        name = h + 1;
-    return name;
+    return spa_type_short_name(name);
 }
 
-static inline const char *spa_debug_type_find_name(const struct spa_type_info *info, uint32_t type)
+SPA_API_DEBUG_TYPES const char *spa_debug_type_find_name(const struct spa_type_info *info, uint32_t type)
 {
     if ((info = spa_debug_type_find(info, type)) == NULL)
         return NULL;
     return info->name;
 }
 
-static inline const char *spa_debug_type_find_short_name(const struct spa_type_info *info, uint32_t type)
+SPA_API_DEBUG_TYPES const char *spa_debug_type_find_short_name(const struct spa_type_info *info, uint32_t type)
 {
     const char *str;
     if ((str = spa_debug_type_find_name(info, type)) == NULL)
@@ -60,7 +66,7 @@ static inline const char *spa_debug_type_find_short_name(const struct spa_type_i
     return spa_debug_type_short_name(str);
 }
 
-static inline uint32_t spa_debug_type_find_type(const struct spa_type_info *info, const char *name)
+SPA_API_DEBUG_TYPES uint32_t spa_debug_type_find_type(const struct spa_type_info *info, const char *name)
 {
     if (info == NULL)
         info = SPA_TYPE_ROOT;
@@ -76,7 +82,7 @@ static inline uint32_t spa_debug_type_find_type(const struct spa_type_info *info
     return SPA_ID_INVALID;
 }
 
-static inline const struct spa_type_info *spa_debug_type_find_short(const struct spa_type_info *info, const char *name)
+SPA_API_DEBUG_TYPES const struct spa_type_info *spa_debug_type_find_short(const struct spa_type_info *info, const char *name)
 {
     while (info && info->name) {
         if (strcmp(spa_debug_type_short_name(info->name), name) == 0)
@@ -90,7 +96,7 @@ static inline const struct spa_type_info *spa_debug_type_find_short(const struct
     return NULL;
 }
 
-static inline uint32_t spa_debug_type_find_type_short(const struct spa_type_info *info, const char *name)
+SPA_API_DEBUG_TYPES uint32_t spa_debug_type_find_type_short(const struct spa_type_info *info, const char *name)
 {
     if ((info = spa_debug_type_find_short(info, name)) == NULL)
         return SPA_ID_INVALID;
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/node/io.h b/src/java.desktop/unix/native/libpipewire/include/spa/node/io.h
index a25c8fd11c5a..fffde5bb27bb 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/node/io.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/node/io.h
@@ -31,14 +31,16 @@ extern "C" {
 enum spa_io_type {
     SPA_IO_Invalid,
     SPA_IO_Buffers,        /**< area to exchange buffers, struct spa_io_buffers */
-    SPA_IO_Range,        /**< expected byte range, struct spa_io_range */
+    SPA_IO_Range,        /**< expected byte range, struct spa_io_range (currently not used in PipeWire) */
     SPA_IO_Clock,        /**< area to update clock information, struct spa_io_clock */
-    SPA_IO_Latency,        /**< latency reporting, struct spa_io_latency */
+    SPA_IO_Latency,        /**< latency reporting, struct spa_io_latency (currently not used in
+                  * PipeWire). \see spa_param_latency */
     SPA_IO_Control,        /**< area for control messages, struct spa_io_sequence */
     SPA_IO_Notify,        /**< area for notify messages, struct spa_io_sequence */
     SPA_IO_Position,    /**< position information in the graph, struct spa_io_position */
     SPA_IO_RateMatch,    /**< rate matching between nodes, struct spa_io_rate_match */
-    SPA_IO_Memory,        /**< memory pointer, struct spa_io_memory */
+    SPA_IO_Memory,        /**< memory pointer, struct spa_io_memory (currently not used in PipeWire) */
+    SPA_IO_AsyncBuffers,    /**< async area to exchange buffers, struct spa_io_async_buffers */
 };
 
 /**
@@ -108,29 +110,52 @@ struct spa_io_range {
  *
  * The clock counts the elapsed time according to the clock provider
  * since the provider was last started.
+ *
+ * Driver nodes are supposed to update the contents of \ref SPA_IO_Clock before
+ * signaling the start of a graph cycle.  These updated clock values become
+ * visible to other nodes in \ref SPA_IO_Position. Non-driver nodes do
+ * not need to update the contents of their \ref SPA_IO_Clock.
+ *
+ * The host generally gives each node a separate \ref spa_io_clock in \ref
+ * SPA_IO_Clock, so that updates made by the driver are not visible in the
+ * contents of \ref SPA_IO_Clock of other nodes. Instead, \ref SPA_IO_Position
+ * is used to look up the current graph time.
+ *
+ * A node is a driver when \ref spa_io_clock.id in \ref SPA_IO_Clock and
+ * \ref spa_io_position.clock.id in \ref SPA_IO_Position are the same.
  */
 struct spa_io_clock {
-#define SPA_IO_CLOCK_FLAG_FREEWHEEL (1u<<0)
-    uint32_t flags;            /**< clock flags */
-    uint32_t id;            /**< unique clock id, set by application */
-    char name[64];            /**< clock name prefixed with API, set by node. The clock name
-                      *  is unique per clock and can be used to check if nodes
-                      *  share the same clock. */
-    uint64_t nsec;            /**< time in nanoseconds against monotonic clock */
-    struct spa_fraction rate;    /**< rate for position/duration/delay */
-    uint64_t position;        /**< current position */
-    uint64_t duration;        /**< duration of current cycle */
-    int64_t delay;            /**< delay between position and hardware,
-                      *  positive for capture, negative for playback */
-    double rate_diff;        /**< rate difference between clock and monotonic time */
-    uint64_t next_nsec;        /**< estimated next wakeup time in nanoseconds */
+#define SPA_IO_CLOCK_FLAG_FREEWHEEL    (1u<<0) /* graph is freewheeling */
+#define SPA_IO_CLOCK_FLAG_XRUN_RECOVER    (1u<<1) /* recovering from xrun */
+#define SPA_IO_CLOCK_FLAG_LAZY        (1u<<2) /* lazy scheduling */
+#define SPA_IO_CLOCK_FLAG_NO_RATE    (1u<<3) /* the rate of the clock is only approximately.
+                         * it is recommended to use the nsec as a clock source.
+                         * The rate_diff contains the measured inaccuracy. */
+    uint32_t flags;            /**< Clock flags */
+    uint32_t id;            /**< Unique clock id, set by host application */
+    char name[64];            /**< Clock name prefixed with API, set by node when it receives
+                      *  \ref SPA_IO_Clock. The clock name is unique per clock and
+                      *  can be used to check if nodes share the same clock. */
+    uint64_t nsec;            /**< Time in nanoseconds against monotonic clock
+                      * (CLOCK_MONOTONIC). This fields reflects a real time instant
+                      * in the past. The value may have jitter. */
+    struct spa_fraction rate;    /**< Rate for position/duration/delay/xrun */
+    uint64_t position;        /**< Current position, in samples @ \ref rate */
+    uint64_t duration;        /**< Duration of current cycle, in samples @ \ref rate */
+    int64_t delay;            /**< Delay between position and hardware, in samples @ \ref rate */
+    double rate_diff;        /**< Rate difference between clock and monotonic time, as a ratio of
+                      *  clock speeds. */
+    uint64_t next_nsec;        /**< Estimated next wakeup time in nanoseconds.
+                      *  This time is a logical start time of the next cycle, and
+                      *  is not necessarily in the future.
+                      */
 
-    struct spa_fraction target_rate;    /**< target rate of next cycle */
-    uint64_t target_duration;        /**< target duration of next cycle */
-    uint32_t target_seq;            /**< seq counter. must be equal at start and
+    struct spa_fraction target_rate;    /**< Target rate of next cycle */
+    uint64_t target_duration;        /**< Target duration of next cycle */
+    uint32_t target_seq;            /**< Seq counter. must be equal at start and
                           *  end of read and lower bit must be 0 */
-
-    uint32_t padding[3];
+    uint32_t cycle;            /**< incremented each time the graph is started */
+    uint64_t xrun;            /**< Estimated accumulated xrun duration */
 };
 
 /* the size of the video in this cycle */
@@ -145,7 +170,11 @@ struct spa_io_video_size {
     uint32_t padding[4];
 };
 
-/** latency reporting */
+/**
+ * Latency reporting
+ *
+ * Currently not used in PipeWire. Instead, \see spa_param_latency
+ */
 struct spa_io_latency {
     struct spa_fraction rate;    /**< rate for min/max */
     uint64_t min;            /**< min latency */
@@ -166,7 +195,9 @@ struct spa_io_segment_bar {
     float signature_denom;        /**< time signature denominator */
     double bpm;            /**< beats per minute */
     double beat;            /**< current beat in segment */
-    uint32_t padding[8];
+    double bar_start_tick;
+    double ticks_per_beat;
+    uint32_t padding[4];
 };
 
 /** video frame segment */
@@ -245,8 +276,13 @@ enum spa_io_position_state {
 /**
  * The position information adds extra meaning to the raw clock times.
  *
- * It is set on all nodes and the clock id will contain the clock of the
- * driving node in the graph.
+ * It is set on all nodes in \ref SPA_IO_Position, and the contents of \ref
+ * spa_io_position.clock contain the clock updates made by the driving node in
+ * the graph in its \ref SPA_IO_Clock.  Also, \ref spa_io_position.clock.id
+ * will contain the clock id of the driving node in the graph.
+ *
+ * The position clock indicates the logical start time of the current graph
+ * cycle.
  *
  * The position information contains 1 or more segments that convert the
  * raw clock times to a stream time. They are sorted based on their
@@ -269,14 +305,56 @@ struct spa_io_position {
     struct spa_io_segment segments[SPA_IO_POSITION_MAX_SEGMENTS];    /**< segments */
 };
 
-/** rate matching */
+/**
+ * Rate matching.
+ *
+ * It is usually set on the nodes that process resampled data, by
+ * the component (audioadapter) that handles resampling between graph
+ * and node rates. The \a flags and \a rate fields may be modified by the node.
+ *
+ * The node can request a correction to the resampling rate in its process(), by setting
+ * \ref SPA_IO_RATE_MATCH_ACTIVE on \a flags, and setting \a rate to the desired rate
+ * correction.  Usually the rate is obtained from DLL or other adaptive mechanism that
+ * e.g. drives the node buffer fill level toward a specific value.
+ *
+ * When resampling to (graph->node) direction, the number of samples produced
+ * by the resampler varies on each cycle, as the rates are not commensurate.
+ *
+ * When resampling to (node->graph) direction, the number of samples consumed by the
+ * resampler varies. Node output ports in process() should produce \a size number of
+ * samples to match what the resampler needs to produce one graph quantum of output
+ * samples.
+ *
+ * Resampling filters introduce processing delay, given by \a delay and \a delay_frac, in
+ * samples at node rate. The delay varies on each cycle e.g. when resampling between
+ * noncommensurate rates.
+ *
+ * The first sample output (graph->node) or consumed (node->graph) by the resampler is
+ * offset by \a delay + \a delay_frac / 1e9 node samples relative to the nominal graph
+ * cycle start position:
+ *
+ * \code{.unparsed}
+ * first_resampled_sample_nsec =
+ *    first_original_sample_nsec
+ *    - (rate_match->delay * SPA_NSEC_PER_SEC + rate_match->delay_frac) / node_rate
+ * \endcode
+ */
 struct spa_io_rate_match {
-    uint32_t delay;            /**< extra delay in samples for resampler */
+    uint32_t delay;            /**< resampling delay, in samples at
+                     * node rate */
     uint32_t size;            /**< requested input size for resampler */
-    double rate;            /**< rate for resampler */
+    double rate;            /**< rate for resampler (set by node) */
 #define SPA_IO_RATE_MATCH_FLAG_ACTIVE    (1 << 0)
-    uint32_t flags;            /**< extra flags */
-    uint32_t padding[7];
+    uint32_t flags;            /**< extra flags (set by node) */
+    int32_t delay_frac;        /**< resampling delay fractional part,
+                     * in units of nanosamples (1/10^9 sample) at node rate */
+    uint32_t padding[6];
+};
+
+/** async buffers */
+struct spa_io_async_buffers {
+    struct spa_io_buffers buffers[2];    /**< async buffers, writers write to current (cycle+1)&1,
+                          *  readers read from (cycle)&1 */
 };
 
 /**
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/node/type-info.h b/src/java.desktop/unix/native/libpipewire/include/spa/node/type-info.h
index 3d3d7908519c..ab4dbdedfb76 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/node/type-info.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/node/type-info.h
@@ -34,6 +34,7 @@ static const struct spa_type_info spa_type_io[] = {
     { SPA_IO_Position, SPA_TYPE_Int, SPA_TYPE_INFO_IO_BASE "Position", NULL },
     { SPA_IO_RateMatch, SPA_TYPE_Int, SPA_TYPE_INFO_IO_BASE "RateMatch", NULL },
     { SPA_IO_Memory, SPA_TYPE_Int, SPA_TYPE_INFO_IO_BASE "Memory", NULL },
+    { SPA_IO_AsyncBuffers, SPA_TYPE_Int, SPA_TYPE_INFO_IO_BASE "AsyncBuffers", NULL },
     { 0, 0, NULL, NULL },
 };
 
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/aac-types.h b/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/aac-types.h
index 26c80bfa9db1..e941250ff96b 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/aac-types.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/aac-types.h
@@ -12,6 +12,11 @@ extern "C" {
 #include 
 #include 
 
+/**
+ * \addtogroup spa_param
+ * \{
+ */
+
 #define SPA_TYPE_INFO_AudioAACStreamFormat        SPA_TYPE_INFO_ENUM_BASE "AudioAACStreamFormat"
 #define SPA_TYPE_INFO_AUDIO_AAC_STREAM_FORMAT_BASE    SPA_TYPE_INFO_AudioAACStreamFormat ":"
 
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/aac.h b/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/aac.h
index dc5257c2dfd3..164eaf7de8bd 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/aac.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/aac.h
@@ -11,6 +11,11 @@ extern "C" {
 
 #include 
 
+/**
+ * \addtogroup spa_param
+ * \{
+ */
+
 enum spa_audio_aac_stream_format {
     SPA_AUDIO_AAC_STREAM_FORMAT_UNKNOWN,
     /* Raw AAC frames */
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/amr-types.h b/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/amr-types.h
index 5e07a784524c..34281c85763a 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/amr-types.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/amr-types.h
@@ -12,6 +12,11 @@ extern "C" {
 #include 
 #include 
 
+/**
+ * \addtogroup spa_param
+ * \{
+ */
+
 #define SPA_TYPE_INFO_AudioAMRBandMode        SPA_TYPE_INFO_ENUM_BASE "AudioAMRBandMode"
 #define SPA_TYPE_INFO_AUDIO_AMR_BAND_MODE_BASE    SPA_TYPE_INFO_AudioAMRBandMode ":"
 
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/amr.h b/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/amr.h
index 88b2c4cbcf3e..aece0ab119ee 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/amr.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/amr.h
@@ -11,6 +11,11 @@ extern "C" {
 
 #include 
 
+/**
+ * \addtogroup spa_param
+ * \{
+ */
+
 enum spa_audio_amr_band_mode {
     SPA_AUDIO_AMR_BAND_MODE_UNKNOWN,
     SPA_AUDIO_AMR_BAND_MODE_NB,
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/iec958-types.h b/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/iec958-types.h
index fc8243a769b7..6e2e3f028a5b 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/iec958-types.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/iec958-types.h
@@ -12,6 +12,19 @@ extern "C" {
 #include 
 #include 
 
+/**
+ * \addtogroup spa_param
+ * \{
+ */
+
+#ifndef SPA_API_AUDIO_IEC958_TYPES
+ #ifdef SPA_API_IMPL
+  #define SPA_API_AUDIO_IEC958_TYPES SPA_API_IMPL
+ #else
+  #define SPA_API_AUDIO_IEC958_TYPES static inline
+ #endif
+#endif
+
 #define SPA_TYPE_INFO_AudioIEC958Codec        SPA_TYPE_INFO_ENUM_BASE "AudioIEC958Codec"
 #define SPA_TYPE_INFO_AUDIO_IEC958_CODEC_BASE    SPA_TYPE_INFO_AudioIEC958Codec ":"
 
@@ -28,6 +41,14 @@ static const struct spa_type_info spa_type_audio_iec958_codec[] = {
     { 0, 0, NULL, NULL },
 };
 
+SPA_API_AUDIO_IEC958_TYPES uint32_t spa_type_audio_iec958_codec_from_short_name(const char *name)
+{
+    return spa_type_from_short_name(name, spa_type_audio_iec958_codec, SPA_AUDIO_IEC958_CODEC_UNKNOWN);
+}
+SPA_API_AUDIO_IEC958_TYPES const char * spa_type_audio_iec958_codec_to_short_name(uint32_t type)
+{
+    return spa_type_to_short_name(type, spa_type_audio_iec958_codec, "UNKNOWN");
+}
 /**
  * \}
  */
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/mp3-types.h b/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/mp3-types.h
index 6907090faaf6..8974f1efb336 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/mp3-types.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/mp3-types.h
@@ -12,6 +12,11 @@ extern "C" {
 #include 
 #include 
 
+/**
+ * \addtogroup spa_param
+ * \{
+ */
+
 #define SPA_TYPE_INFO_AudioMP3ChannelMode        SPA_TYPE_INFO_ENUM_BASE "AudioMP3ChannelMode"
 #define SPA_TYPE_INFO_AUDIO_MP3_CHANNEL_MODE_BASE    SPA_TYPE_INFO_AudioMP3ChannelMode ":"
 
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/mp3.h b/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/mp3.h
index 51f4c2eaf75e..bfe61aaea54a 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/mp3.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/mp3.h
@@ -11,6 +11,11 @@ extern "C" {
 
 #include 
 
+/**
+ * \addtogroup spa_param
+ * \{
+ */
+
 enum spa_audio_mp3_channel_mode {
     SPA_AUDIO_MP3_CHANNEL_MODE_UNKNOWN,
     SPA_AUDIO_MP3_CHANNEL_MODE_MONO,
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/raw-types.h b/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/raw-types.h
index 50a42157602d..06b8cc4a7d38 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/raw-types.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/raw-types.h
@@ -15,8 +15,17 @@ extern "C" {
  */
 
 #include 
+#include 
 #include 
 
+#ifndef SPA_API_AUDIO_RAW_TYPES
+ #ifdef SPA_API_IMPL
+  #define SPA_API_AUDIO_RAW_TYPES SPA_API_IMPL
+ #else
+  #define SPA_API_AUDIO_RAW_TYPES static inline
+ #endif
+#endif
+
 #define SPA_TYPE_INFO_AudioFormat        SPA_TYPE_INFO_ENUM_BASE "AudioFormat"
 #define SPA_TYPE_INFO_AUDIO_FORMAT_BASE        SPA_TYPE_INFO_AudioFormat ":"
 
@@ -128,6 +137,15 @@ static const struct spa_type_info spa_type_audio_format[] = {
     { 0, 0, NULL, NULL },
 };
 
+SPA_API_AUDIO_RAW_TYPES uint32_t spa_type_audio_format_from_short_name(const char *name)
+{
+    return spa_type_from_short_name(name, spa_type_audio_format, SPA_AUDIO_FORMAT_UNKNOWN);
+}
+SPA_API_AUDIO_RAW_TYPES const char * spa_type_audio_format_to_short_name(uint32_t type)
+{
+    return spa_type_to_short_name(type, spa_type_audio_format, "UNKNOWN");
+}
+
 #define SPA_TYPE_INFO_AudioFlags    SPA_TYPE_INFO_FLAGS_BASE "AudioFlags"
 #define SPA_TYPE_INFO_AUDIO_FLAGS_BASE    SPA_TYPE_INFO_AudioFlags ":"
 
@@ -247,6 +265,16 @@ static const struct spa_type_info spa_type_audio_channel[] = {
     { 0, 0, NULL, NULL },
 };
 
+SPA_API_AUDIO_RAW_TYPES uint32_t spa_type_audio_channel_from_short_name(const char *name)
+{
+    return spa_type_from_short_name(name, spa_type_audio_channel, SPA_AUDIO_CHANNEL_UNKNOWN);
+}
+SPA_API_AUDIO_RAW_TYPES const char * spa_type_audio_channel_to_short_name(uint32_t type)
+{
+    return spa_type_to_short_name(type, spa_type_audio_channel, "UNK");
+}
+
+
 /**
  * \}
  */
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/raw.h b/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/raw.h
index 54052f75311a..462cf58a13ca 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/raw.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/raw.h
@@ -11,15 +11,7 @@ extern "C" {
 
 #include 
 
-#if !defined(__FreeBSD__) && !defined(__MidnightBSD__) && !defined(AIX)
-#include 
-#endif
-
-#if defined(AIX)
-#include 
-#define __BIG_ENDIAN      BIG_ENDIAN
-#define __BYTE_ORDER      BIG_ENDIAN
-#endif
+#include 
 
 /**
  * \addtogroup spa_param
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/wma-types.h b/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/wma-types.h
index 0309223ac700..78ce1b987738 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/wma-types.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/wma-types.h
@@ -12,6 +12,11 @@ extern "C" {
 #include 
 #include 
 
+/**
+ * \addtogroup spa_param
+ * \{
+ */
+
 #define SPA_TYPE_INFO_AudioWMAProfile        SPA_TYPE_INFO_ENUM_BASE "AudioWMAProfile"
 #define SPA_TYPE_INFO_AUDIO_WMA_PROFILE_BASE    SPA_TYPE_INFO_AudioWMAProfile ":"
 
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/wma.h b/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/wma.h
index 84a78a7e12d0..4f86efe84b70 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/wma.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/param/audio/wma.h
@@ -11,6 +11,11 @@ extern "C" {
 
 #include 
 
+/**
+ * \addtogroup spa_param
+ * \{
+ */
+
 enum spa_audio_wma_profile {
     SPA_AUDIO_WMA_PROFILE_UNKNOWN,
 
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/param/bluetooth/audio.h b/src/java.desktop/unix/native/libpipewire/include/spa/param/bluetooth/audio.h
index 8561a00aebdb..13590545ed73 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/param/bluetooth/audio.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/param/bluetooth/audio.h
@@ -21,6 +21,7 @@ enum spa_bluetooth_audio_codec {
     SPA_BLUETOOTH_AUDIO_CODEC_SBC_XQ,
     SPA_BLUETOOTH_AUDIO_CODEC_MPEG,
     SPA_BLUETOOTH_AUDIO_CODEC_AAC,
+    SPA_BLUETOOTH_AUDIO_CODEC_AAC_ELD,
     SPA_BLUETOOTH_AUDIO_CODEC_APTX,
     SPA_BLUETOOTH_AUDIO_CODEC_APTX_HD,
     SPA_BLUETOOTH_AUDIO_CODEC_LDAC,
@@ -34,13 +35,18 @@ enum spa_bluetooth_audio_codec {
     SPA_BLUETOOTH_AUDIO_CODEC_OPUS_05_71,
     SPA_BLUETOOTH_AUDIO_CODEC_OPUS_05_DUPLEX,
     SPA_BLUETOOTH_AUDIO_CODEC_OPUS_05_PRO,
+    SPA_BLUETOOTH_AUDIO_CODEC_OPUS_G,
 
     /* HFP */
     SPA_BLUETOOTH_AUDIO_CODEC_CVSD = 0x100,
     SPA_BLUETOOTH_AUDIO_CODEC_MSBC,
+    SPA_BLUETOOTH_AUDIO_CODEC_LC3_SWB,
 
     /* BAP */
     SPA_BLUETOOTH_AUDIO_CODEC_LC3 = 0x200,
+
+    /* ASHA */
+    SPA_BLUETOOTH_AUDIO_CODEC_G722 = 0x300,
 };
 
 /**
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/param/bluetooth/type-info.h b/src/java.desktop/unix/native/libpipewire/include/spa/param/bluetooth/type-info.h
index a7ce08246c27..2affa465b458 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/param/bluetooth/type-info.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/param/bluetooth/type-info.h
@@ -25,6 +25,7 @@ static const struct spa_type_info spa_type_bluetooth_audio_codec[] = {
     { SPA_BLUETOOTH_AUDIO_CODEC_SBC_XQ, SPA_TYPE_Int, SPA_TYPE_INFO_BLUETOOTH_AUDIO_CODEC_BASE "sbc_xq", NULL },
     { SPA_BLUETOOTH_AUDIO_CODEC_MPEG, SPA_TYPE_Int, SPA_TYPE_INFO_BLUETOOTH_AUDIO_CODEC_BASE "mpeg", NULL },
     { SPA_BLUETOOTH_AUDIO_CODEC_AAC, SPA_TYPE_Int, SPA_TYPE_INFO_BLUETOOTH_AUDIO_CODEC_BASE "aac", NULL },
+    { SPA_BLUETOOTH_AUDIO_CODEC_AAC_ELD, SPA_TYPE_Int, SPA_TYPE_INFO_BLUETOOTH_AUDIO_CODEC_BASE "aac_eld", NULL },
     { SPA_BLUETOOTH_AUDIO_CODEC_APTX, SPA_TYPE_Int, SPA_TYPE_INFO_BLUETOOTH_AUDIO_CODEC_BASE "aptx", NULL },
     { SPA_BLUETOOTH_AUDIO_CODEC_APTX_HD, SPA_TYPE_Int, SPA_TYPE_INFO_BLUETOOTH_AUDIO_CODEC_BASE "aptx_hd", NULL },
     { SPA_BLUETOOTH_AUDIO_CODEC_LDAC, SPA_TYPE_Int, SPA_TYPE_INFO_BLUETOOTH_AUDIO_CODEC_BASE "ldac", NULL },
@@ -38,12 +39,16 @@ static const struct spa_type_info spa_type_bluetooth_audio_codec[] = {
     { SPA_BLUETOOTH_AUDIO_CODEC_OPUS_05_71, SPA_TYPE_Int, SPA_TYPE_INFO_BLUETOOTH_AUDIO_CODEC_BASE "opus_05_71", NULL },
     { SPA_BLUETOOTH_AUDIO_CODEC_OPUS_05_DUPLEX, SPA_TYPE_Int, SPA_TYPE_INFO_BLUETOOTH_AUDIO_CODEC_BASE "opus_05_duplex", NULL },
     { SPA_BLUETOOTH_AUDIO_CODEC_OPUS_05_PRO, SPA_TYPE_Int, SPA_TYPE_INFO_BLUETOOTH_AUDIO_CODEC_BASE "opus_05_pro", NULL },
+    { SPA_BLUETOOTH_AUDIO_CODEC_OPUS_G, SPA_TYPE_Int, SPA_TYPE_INFO_BLUETOOTH_AUDIO_CODEC_BASE "opus_g", NULL },
 
     { SPA_BLUETOOTH_AUDIO_CODEC_CVSD, SPA_TYPE_Int, SPA_TYPE_INFO_BLUETOOTH_AUDIO_CODEC_BASE "cvsd", NULL },
     { SPA_BLUETOOTH_AUDIO_CODEC_MSBC, SPA_TYPE_Int, SPA_TYPE_INFO_BLUETOOTH_AUDIO_CODEC_BASE "msbc", NULL },
+    { SPA_BLUETOOTH_AUDIO_CODEC_LC3_SWB, SPA_TYPE_Int, SPA_TYPE_INFO_BLUETOOTH_AUDIO_CODEC_BASE "lc3_swb", NULL },
 
     { SPA_BLUETOOTH_AUDIO_CODEC_LC3, SPA_TYPE_Int, SPA_TYPE_INFO_BLUETOOTH_AUDIO_CODEC_BASE "lc3", NULL },
 
+    { SPA_BLUETOOTH_AUDIO_CODEC_G722, SPA_TYPE_Int, SPA_TYPE_INFO_BLUETOOTH_AUDIO_CODEC_BASE "g722", NULL },
+
     { 0, 0, NULL, NULL },
 };
 
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/param/buffers-types.h b/src/java.desktop/unix/native/libpipewire/include/spa/param/buffers-types.h
index 987d75a1669f..a963193a60c0 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/param/buffers-types.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/param/buffers-types.h
@@ -56,6 +56,7 @@ static const struct spa_type_info spa_type_param_buffers[] = {
     { SPA_PARAM_BUFFERS_stride,   SPA_TYPE_Int, SPA_TYPE_INFO_PARAM_BLOCK_INFO_BASE "stride", NULL },
     { SPA_PARAM_BUFFERS_align,    SPA_TYPE_Int, SPA_TYPE_INFO_PARAM_BLOCK_INFO_BASE "align", NULL },
     { SPA_PARAM_BUFFERS_dataType, SPA_TYPE_Int, SPA_TYPE_INFO_PARAM_BLOCK_INFO_BASE "dataType", NULL },
+    { SPA_PARAM_BUFFERS_metaType, SPA_TYPE_Int, SPA_TYPE_INFO_PARAM_BLOCK_INFO_BASE "metaType", NULL },
     { 0, 0, NULL, NULL },
 };
 
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/param/buffers.h b/src/java.desktop/unix/native/libpipewire/include/spa/param/buffers.h
index 6834c6e5e390..eb8c107337eb 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/param/buffers.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/param/buffers.h
@@ -24,14 +24,15 @@ enum spa_param_buffers {
     SPA_PARAM_BUFFERS_size,        /**< size of a data block memory (Int)*/
     SPA_PARAM_BUFFERS_stride,    /**< stride of data block memory (Int) */
     SPA_PARAM_BUFFERS_align,    /**< alignment of data block memory (Int) */
-    SPA_PARAM_BUFFERS_dataType,    /**< possible memory types (Int, mask of enum spa_data_type) */
+    SPA_PARAM_BUFFERS_dataType,    /**< possible memory types (flags choice Int, mask of enum spa_data_type) */
+    SPA_PARAM_BUFFERS_metaType,    /**< required meta data types (Int, mask of enum spa_meta_type) */
 };
 
 /** properties for SPA_TYPE_OBJECT_ParamMeta */
 enum spa_param_meta {
     SPA_PARAM_META_START,
-    SPA_PARAM_META_type,    /**< the metadata, one of enum spa_meta_type (Id enum spa_meta_type) */
-    SPA_PARAM_META_size,    /**< the expected maximum size the meta (Int) */
+    SPA_PARAM_META_type,        /**< the metadata, one of enum spa_meta_type (Id enum spa_meta_type) */
+    SPA_PARAM_META_size,        /**< the expected maximum size the meta (Int) */
 };
 
 /** properties for SPA_TYPE_OBJECT_ParamIO */
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/param/format-utils.h b/src/java.desktop/unix/native/libpipewire/include/spa/param/format-utils.h
index b4edb6f6efe4..b829209351d1 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/param/format-utils.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/param/format-utils.h
@@ -18,7 +18,15 @@ extern "C" {
 #include 
 #include 
 
-static inline int
+#ifndef SPA_API_FORMAT_UTILS
+ #ifdef SPA_API_IMPL
+  #define SPA_API_FORMAT_UTILS SPA_API_IMPL
+ #else
+  #define SPA_API_FORMAT_UTILS static inline
+ #endif
+#endif
+
+SPA_API_FORMAT_UTILS int
 spa_format_parse(const struct spa_pod *format, uint32_t *media_type, uint32_t *media_subtype)
 {
     return spa_pod_parse_object(format,
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/param/format.h b/src/java.desktop/unix/native/libpipewire/include/spa/param/format.h
index a7b425465239..7de2775ca441 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/param/format.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/param/format.h
@@ -141,6 +141,8 @@ enum spa_format {
     SPA_FORMAT_START_Stream = 0x50000,
     /* Application Format keys */
     SPA_FORMAT_START_Application = 0x60000,
+    SPA_FORMAT_CONTROL_types,        /**< possible control types (flags choice Int,
+                          *  mask of enum spa_control_type) */
 };
 
 #define SPA_KEY_FORMAT_DSP        "format.dsp"        /**< a predefined DSP format,
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/param/latency.h b/src/java.desktop/unix/native/libpipewire/include/spa/param/latency.h
index 5fa40b59b9f6..2d567f79eb21 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/param/latency.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/param/latency.h
@@ -16,14 +16,31 @@ extern "C" {
 
 #include 
 
-/** properties for SPA_TYPE_OBJECT_ParamLatency */
+/**
+ * Properties for SPA_TYPE_OBJECT_ParamLatency
+ *
+ * The latency indicates:
+ *
+ * - for playback: time delay between start of a graph cycle, and the rendering of
+ *   the first sample of that cycle in audio output.
+ *
+ * - for capture: time delay between start of a graph cycle, and the first sample
+ *   of that cycle having occurred in audio input.
+ *
+ * For physical output/input, the latency is intended to correspond to the
+ * rendering/capture of physical audio, including hardware internal rendering delay.
+ *
+ * The latency values are adjusted by \ref SPA_PROP_latencyOffsetNsec or
+ * SPA_PARAM_ProcessLatency, if present. (e.g. for ALSA this is used to adjust for
+ * the internal hardware latency).
+ */
 enum spa_param_latency {
     SPA_PARAM_LATENCY_START,
     SPA_PARAM_LATENCY_direction,        /**< direction, input/output (Id enum spa_direction) */
     SPA_PARAM_LATENCY_minQuantum,        /**< min latency relative to quantum (Float) */
     SPA_PARAM_LATENCY_maxQuantum,        /**< max latency relative to quantum (Float) */
-    SPA_PARAM_LATENCY_minRate,        /**< min latency (Int) relative to rate */
-    SPA_PARAM_LATENCY_maxRate,        /**< max latency (Int) relative to rate */
+    SPA_PARAM_LATENCY_minRate,        /**< min latency (Int) relative to graph rate */
+    SPA_PARAM_LATENCY_maxRate,        /**< max latency (Int) relative to graph rate */
     SPA_PARAM_LATENCY_minNs,        /**< min latency (Long) in nanoseconds */
     SPA_PARAM_LATENCY_maxNs,        /**< max latency (Long) in nanoseconds */
 };
@@ -33,27 +50,32 @@ struct spa_latency_info {
     enum spa_direction direction;
     float min_quantum;
     float max_quantum;
-    uint32_t min_rate;
-    uint32_t max_rate;
-    uint64_t min_ns;
-    uint64_t max_ns;
+    int32_t min_rate;
+    int32_t max_rate;
+    int64_t min_ns;
+    int64_t max_ns;
 };
 
 #define SPA_LATENCY_INFO(dir,...) ((struct spa_latency_info) { .direction = (dir), ## __VA_ARGS__ })
 
-/** properties for SPA_TYPE_OBJECT_ParamProcessLatency */
+/**
+ * Properties for SPA_TYPE_OBJECT_ParamProcessLatency
+ *
+ * The processing latency indicates logical time delay between a sample in an input port,
+ * and a corresponding sample in an output port, relative to the graph time.
+ */
 enum spa_param_process_latency {
     SPA_PARAM_PROCESS_LATENCY_START,
     SPA_PARAM_PROCESS_LATENCY_quantum,    /**< latency relative to quantum (Float) */
-    SPA_PARAM_PROCESS_LATENCY_rate,        /**< latency (Int) relative to rate */
+    SPA_PARAM_PROCESS_LATENCY_rate,        /**< latency (Int) relative to graph rate */
     SPA_PARAM_PROCESS_LATENCY_ns,        /**< latency (Long) in nanoseconds */
 };
 
 /** Helper structure for managing process latency objects */
 struct spa_process_latency_info {
     float quantum;
-    uint32_t rate;
-    uint64_t ns;
+    int32_t rate;
+    int64_t ns;
 };
 
 #define SPA_PROCESS_LATENCY_INFO_INIT(...)    ((struct spa_process_latency_info) { __VA_ARGS__ })
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/param/param-types.h b/src/java.desktop/unix/native/libpipewire/include/spa/param/param-types.h
index ff2ddde1cd95..b996666d2b2c 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/param/param-types.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/param/param-types.h
@@ -40,6 +40,7 @@ static const struct spa_type_info spa_type_param[] = {
     { SPA_PARAM_Control, SPA_TYPE_Sequence, SPA_TYPE_INFO_PARAM_ID_BASE "Control", NULL },
     { SPA_PARAM_Latency, SPA_TYPE_OBJECT_ParamLatency, SPA_TYPE_INFO_PARAM_ID_BASE "Latency", NULL },
     { SPA_PARAM_ProcessLatency, SPA_TYPE_OBJECT_ParamProcessLatency, SPA_TYPE_INFO_PARAM_ID_BASE "ProcessLatency", NULL },
+    { SPA_PARAM_Tag, SPA_TYPE_OBJECT_ParamTag, SPA_TYPE_INFO_PARAM_ID_BASE "Tag", NULL },
     { 0, 0, NULL, NULL },
 };
 
@@ -54,6 +55,11 @@ static const struct spa_type_info spa_type_prop_float_array[] = {
     { 0, 0, NULL, NULL },
 };
 
+static const struct spa_type_info spa_type_prop_int_array[] = {
+    { SPA_PROP_START, SPA_TYPE_Int, SPA_TYPE_INFO_BASE "intArray", NULL, },
+    { 0, 0, NULL, NULL },
+};
+
 static const struct spa_type_info spa_type_prop_channel_map[] = {
     { SPA_PROP_START, SPA_TYPE_Id, SPA_TYPE_INFO_BASE "channelMap", spa_type_audio_channel, },
     { 0, 0, NULL, NULL },
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/param/param.h b/src/java.desktop/unix/native/libpipewire/include/spa/param/param.h
index 48e7d9349d58..aac55b735916 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/param/param.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/param/param.h
@@ -39,6 +39,7 @@ enum spa_param_type {
     SPA_PARAM_Control,        /**< Control parameter, a SPA_TYPE_Sequence */
     SPA_PARAM_Latency,        /**< latency reporting, a SPA_TYPE_OBJECT_ParamLatency */
     SPA_PARAM_ProcessLatency,    /**< processing latency, a SPA_TYPE_OBJECT_ParamProcessLatency */
+    SPA_PARAM_Tag,            /**< tag reporting, a SPA_TYPE_OBJECT_ParamTag. Since 0.3.79 */
 };
 
 /** information about a parameter */
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/param/profiler-types.h b/src/java.desktop/unix/native/libpipewire/include/spa/param/profiler-types.h
index a1abc02a130c..b87a125a4169 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/param/profiler-types.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/param/profiler-types.h
@@ -26,6 +26,7 @@ static const struct spa_type_info spa_type_profiler[] = {
     { SPA_PROFILER_clock, SPA_TYPE_Struct, SPA_TYPE_INFO_PROFILER_BASE "clock", NULL, },
     { SPA_PROFILER_driverBlock, SPA_TYPE_Struct, SPA_TYPE_INFO_PROFILER_BASE "driverBlock", NULL, },
     { SPA_PROFILER_followerBlock, SPA_TYPE_Struct, SPA_TYPE_INFO_PROFILER_BASE "followerBlock", NULL, },
+    { SPA_PROFILER_followerClock, SPA_TYPE_Struct, SPA_TYPE_INFO_PROFILER_BASE "followerClock", NULL, },
     { 0, 0, NULL, NULL },
 };
 
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/param/profiler.h b/src/java.desktop/unix/native/libpipewire/include/spa/param/profiler.h
index e65835a1a852..97e5431a7de5 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/param/profiler.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/param/profiler.h
@@ -39,7 +39,10 @@ enum spa_profiler {
                               *      Long : clock duration,
                               *      Long : clock delay,
                               *      Double : clock rate_diff,
-                              *      Long : clock next_nsec)) */
+                              *      Long : clock next_nsec,
+                              *      Int : transport_state,
+                              *      Int : clock cycle,
+                              *      Long : xrun duration)) */
     SPA_PROFILER_driverBlock,            /**< generic driver info block
                               *  (Struct(
                               *      Int : driver_id,
@@ -48,8 +51,9 @@ enum spa_profiler {
                               *      Long : driver signal,
                               *      Long : driver awake,
                               *      Long : driver finish,
-                              *      Int : driver status),
-                              *      Fraction : latency))  */
+                              *      Int : driver status,
+                              *      Fraction : latency,
+                              *      Int : xrun_count))  */
 
     SPA_PROFILER_START_Follower    = 0x20000,    /**< follower related profiler properties */
     SPA_PROFILER_followerBlock,            /**< generic follower info block
@@ -61,8 +65,20 @@ enum spa_profiler {
                               *      Long : awake,
                               *      Long : finish,
                               *      Int : status,
-                              *      Fraction : latency))  */
-
+                              *      Fraction : latency,
+                              *      Int : xrun_count))  */
+    SPA_PROFILER_followerClock,            /**< follower clock information
+                              *  (Struct(
+                              *      Int : clock id,
+                              *      String: clock name,
+                              *      Long : clock nsec,
+                              *      Fraction : clock rate,
+                              *      Long : clock position,
+                              *      Long : clock duration,
+                              *      Long : clock delay,
+                              *      Double : clock rate_diff,
+                              *      Long : clock next_nsec,
+                              *      Long : xrun duration)) */
     SPA_PROFILER_START_CUSTOM    = 0x1000000,
 };
 
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/param/props-types.h b/src/java.desktop/unix/native/libpipewire/include/spa/param/props-types.h
index 5e4e0a0c9d6f..e52f6c9a228e 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/param/props-types.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/param/props-types.h
@@ -64,14 +64,14 @@ static const struct spa_type_info spa_type_props[] = {
     { SPA_PROP_volumeRampStepTime, SPA_TYPE_Int, SPA_TYPE_INFO_PROPS_BASE "volumeRampStepTime", NULL },
     { SPA_PROP_volumeRampScale, SPA_TYPE_Id, SPA_TYPE_INFO_PROPS_BASE "volumeRampScale", NULL },
 
-    { SPA_PROP_brightness, SPA_TYPE_Int, SPA_TYPE_INFO_PROPS_BASE "brightness", NULL },
-    { SPA_PROP_contrast, SPA_TYPE_Int, SPA_TYPE_INFO_PROPS_BASE "contrast", NULL },
-    { SPA_PROP_saturation, SPA_TYPE_Int, SPA_TYPE_INFO_PROPS_BASE "saturation", NULL },
+    { SPA_PROP_brightness, SPA_TYPE_Float, SPA_TYPE_INFO_PROPS_BASE "brightness", NULL },
+    { SPA_PROP_contrast, SPA_TYPE_Float, SPA_TYPE_INFO_PROPS_BASE "contrast", NULL },
+    { SPA_PROP_saturation, SPA_TYPE_Float, SPA_TYPE_INFO_PROPS_BASE "saturation", NULL },
     { SPA_PROP_hue, SPA_TYPE_Int, SPA_TYPE_INFO_PROPS_BASE "hue", NULL },
     { SPA_PROP_gamma, SPA_TYPE_Int, SPA_TYPE_INFO_PROPS_BASE "gamma", NULL },
     { SPA_PROP_exposure, SPA_TYPE_Int, SPA_TYPE_INFO_PROPS_BASE "exposure", NULL },
-    { SPA_PROP_gain, SPA_TYPE_Int, SPA_TYPE_INFO_PROPS_BASE "gain", NULL },
-    { SPA_PROP_sharpness, SPA_TYPE_Int, SPA_TYPE_INFO_PROPS_BASE "sharpness", NULL },
+    { SPA_PROP_gain, SPA_TYPE_Float, SPA_TYPE_INFO_PROPS_BASE "gain", NULL },
+    { SPA_PROP_sharpness, SPA_TYPE_Float, SPA_TYPE_INFO_PROPS_BASE "sharpness", NULL },
 
     { SPA_PROP_params, SPA_TYPE_Struct, SPA_TYPE_INFO_PROPS_BASE "params", NULL },
     { 0, 0, NULL, NULL },
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/param/props.h b/src/java.desktop/unix/native/libpipewire/include/spa/param/props.h
index 8ecf6f69bc49..2656c1087c7d 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/param/props.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/param/props.h
@@ -59,24 +59,31 @@ enum spa_prop {
     SPA_PROP_START_Audio    = 0x10000,    /**< audio related properties */
     SPA_PROP_waveType,
     SPA_PROP_frequency,
-    SPA_PROP_volume,                /**< a volume (Float), 0.0 silence, 1.0 normal */
+    SPA_PROP_volume,            /**< a volume (Float), 0.0 silence, 1.0 no attenutation */
     SPA_PROP_mute,                /**< mute (Bool) */
     SPA_PROP_patternType,
     SPA_PROP_ditherType,
     SPA_PROP_truncate,
-    SPA_PROP_channelVolumes,        /**< a volume array, one volume per
-                          *  channel (Array of Float) */
+    SPA_PROP_channelVolumes,        /**< a volume array, one (linear) volume per channel
+                          * (Array of Float). 0.0 is silence, 1.0 is
+                          *  without attenuation. This is the effective
+                          *  volume that is applied. It can result
+                          *  in a hardware volume and software volume
+                          *  (see softVolumes) */
     SPA_PROP_volumeBase,            /**< a volume base (Float) */
     SPA_PROP_volumeStep,            /**< a volume step (Float) */
     SPA_PROP_channelMap,            /**< a channelmap array
                           * (Array (Id enum spa_audio_channel)) */
     SPA_PROP_monitorMute,            /**< mute (Bool) */
-    SPA_PROP_monitorVolumes,        /**< a volume array, one volume per
+    SPA_PROP_monitorVolumes,        /**< a volume array, one (linear) volume per
                           *  channel (Array of Float) */
     SPA_PROP_latencyOffsetNsec,        /**< delay adjustment */
-    SPA_PROP_softMute,            /**< mute (Bool) */
-    SPA_PROP_softVolumes,            /**< a volume array, one volume per
-                          *  channel (Array of Float) */
+    SPA_PROP_softMute,            /**< mute (Bool) applied in software */
+    SPA_PROP_softVolumes,            /**< a volume array, one (linear) volume per channel
+                          * (Array of Float). 0.0 is silence, 1.0 is without
+                          * attenuation. This is the volume applied in
+                          * software, there might be a part applied in
+                          * hardware. */
 
     SPA_PROP_iec958Codecs,            /**< enabled IEC958 (S/PDIF) codecs,
                           *  (Array (Id enum spa_audio_iec958_codec) */
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/param/route-types.h b/src/java.desktop/unix/native/libpipewire/include/spa/param/route-types.h
index 8eb839d3f7b5..d7f2bf96b47e 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/param/route-types.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/param/route-types.h
@@ -32,9 +32,9 @@ static const struct spa_type_info spa_type_param_route[] = {
     { SPA_PARAM_ROUTE_priority, SPA_TYPE_Int, SPA_TYPE_INFO_PARAM_ROUTE_BASE "priority", NULL, },
     { SPA_PARAM_ROUTE_available, SPA_TYPE_Id, SPA_TYPE_INFO_PARAM_ROUTE_BASE "available", spa_type_param_availability, },
     { SPA_PARAM_ROUTE_info, SPA_TYPE_Struct, SPA_TYPE_INFO_PARAM_ROUTE_BASE "info", NULL, },
-    { SPA_PARAM_ROUTE_profiles, SPA_TYPE_Int, SPA_TYPE_INFO_PARAM_ROUTE_BASE "profiles", NULL, },
+    { SPA_PARAM_ROUTE_profiles, SPA_TYPE_Array, SPA_TYPE_INFO_PARAM_ROUTE_BASE "profiles", spa_type_prop_int_array, },
     { SPA_PARAM_ROUTE_props, SPA_TYPE_OBJECT_Props, SPA_TYPE_INFO_PARAM_ROUTE_BASE "props", NULL, },
-    { SPA_PARAM_ROUTE_devices, SPA_TYPE_Int, SPA_TYPE_INFO_PARAM_ROUTE_BASE "devices", NULL, },
+    { SPA_PARAM_ROUTE_devices, SPA_TYPE_Array, SPA_TYPE_INFO_PARAM_ROUTE_BASE "devices", spa_type_prop_int_array, },
     { SPA_PARAM_ROUTE_profile, SPA_TYPE_Int, SPA_TYPE_INFO_PARAM_ROUTE_BASE "profile", NULL, },
     { SPA_PARAM_ROUTE_save, SPA_TYPE_Bool, SPA_TYPE_INFO_PARAM_ROUTE_BASE "save", NULL, },
     { 0, 0, NULL, NULL },
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/param/tag-types.h b/src/java.desktop/unix/native/libpipewire/include/spa/param/tag-types.h
new file mode 100644
index 000000000000..0a473ef90996
--- /dev/null
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/param/tag-types.h
@@ -0,0 +1,39 @@
+/* Simple Plugin API */
+/* SPDX-FileCopyrightText: Copyright © 2018 Wim Taymans */
+/* SPDX-License-Identifier: MIT */
+
+#ifndef SPA_PARAM_TAG_TYPES_H
+#define SPA_PARAM_TAG_TYPES_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \addtogroup spa_param
+ * \{
+ */
+
+#include 
+#include 
+#include 
+
+#define SPA_TYPE_INFO_PARAM_Tag        SPA_TYPE_INFO_PARAM_BASE "Tag"
+#define SPA_TYPE_INFO_PARAM_TAG_BASE    SPA_TYPE_INFO_PARAM_Tag ":"
+
+static const struct spa_type_info spa_type_param_tag[] = {
+    { SPA_PARAM_TAG_START, SPA_TYPE_Id, SPA_TYPE_INFO_PARAM_TAG_BASE, spa_type_param, },
+    { SPA_PARAM_TAG_direction, SPA_TYPE_Id, SPA_TYPE_INFO_PARAM_TAG_BASE "direction", spa_type_direction, },
+    { SPA_PARAM_TAG_info, SPA_TYPE_Struct, SPA_TYPE_INFO_PARAM_TAG_BASE "info", NULL, },
+    { 0, 0, NULL, NULL },
+};
+
+/**
+ * \}
+ */
+
+#ifdef __cplusplus
+}  /* extern "C" */
+#endif
+
+#endif /* SPA_PARAM_TAG_TYPES_H */
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/param/tag.h b/src/java.desktop/unix/native/libpipewire/include/spa/param/tag.h
new file mode 100644
index 000000000000..558da087dc7a
--- /dev/null
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/param/tag.h
@@ -0,0 +1,46 @@
+/* Simple Plugin API */
+/* SPDX-FileCopyrightText: Copyright © 2023 Wim Taymans */
+/* SPDX-License-Identifier: MIT */
+
+#ifndef SPA_PARAM_TAG_H
+#define SPA_PARAM_TAG_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**
+ * \addtogroup spa_param
+ * \{
+ */
+
+#include 
+
+/** properties for SPA_TYPE_OBJECT_ParamTag */
+enum spa_param_tag {
+    SPA_PARAM_TAG_START,
+    SPA_PARAM_TAG_direction,        /**< direction, input/output (Id enum spa_direction) */
+    SPA_PARAM_TAG_info,            /**< Struct(
+                          *      Int: n_items
+                          *      (String: key
+                          *       String: value)*
+                          *  ) */
+};
+
+/** helper structure for managing tag objects */
+struct spa_tag_info {
+    enum spa_direction direction;
+    const struct spa_pod *info;
+};
+
+#define SPA_TAG_INFO(dir,...) ((struct spa_tag_info) { .direction = (dir), ## __VA_ARGS__ })
+
+/**
+ * \}
+ */
+
+#ifdef __cplusplus
+}  /* extern "C" */
+#endif
+
+#endif /* SPA_PARAM_TAG_H */
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/param/type-info.h b/src/java.desktop/unix/native/libpipewire/include/spa/param/type-info.h
index 730a1f53607f..fee2d030a0a4 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/param/type-info.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/param/type-info.h
@@ -14,5 +14,6 @@
 #include 
 #include 
 #include 
+#include 
 
 #endif /* SPA_PARAM_TYPE_INFO_H */
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/param/video/dsp-utils.h b/src/java.desktop/unix/native/libpipewire/include/spa/param/video/dsp-utils.h
index 2d4a83c2928b..d8f075901e34 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/param/video/dsp-utils.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/param/video/dsp-utils.h
@@ -18,13 +18,24 @@ extern "C" {
 #include 
 #include 
 
-static inline int
+#ifndef SPA_API_VIDEO_DSP_UTILS
+ #ifdef SPA_API_IMPL
+  #define SPA_API_VIDEO_DSP_UTILS SPA_API_IMPL
+ #else
+  #define SPA_API_VIDEO_DSP_UTILS static inline
+ #endif
+#endif
+
+SPA_API_VIDEO_DSP_UTILS int
 spa_format_video_dsp_parse(const struct spa_pod *format,
                struct spa_video_info_dsp *info)
 {
     info->flags = SPA_VIDEO_FLAG_NONE;
-    if (spa_pod_find_prop (format, NULL, SPA_FORMAT_VIDEO_modifier)) {
+    const struct spa_pod_prop *mod_prop;
+    if ((mod_prop = spa_pod_find_prop (format, NULL, SPA_FORMAT_VIDEO_modifier)) != NULL) {
         info->flags |= SPA_VIDEO_FLAG_MODIFIER;
+        if ((mod_prop->flags & SPA_POD_PROP_FLAG_DONT_FIXATE) == SPA_POD_PROP_FLAG_DONT_FIXATE)
+            info->flags |= SPA_VIDEO_FLAG_MODIFIER_FIXATION_REQUIRED;
     }
 
     return spa_pod_parse_object(format,
@@ -33,9 +44,9 @@ spa_format_video_dsp_parse(const struct spa_pod *format,
         SPA_FORMAT_VIDEO_modifier,        SPA_POD_OPT_Long(&info->modifier));
 }
 
-static inline struct spa_pod *
+SPA_API_VIDEO_DSP_UTILS struct spa_pod *
 spa_format_video_dsp_build(struct spa_pod_builder *builder, uint32_t id,
-               struct spa_video_info_dsp *info)
+               const struct spa_video_info_dsp *info)
 {
     struct spa_pod_frame f;
     spa_pod_builder_push_object(builder, &f, SPA_TYPE_OBJECT_Format, id);
@@ -46,9 +57,11 @@ spa_format_video_dsp_build(struct spa_pod_builder *builder, uint32_t id,
     if (info->format != SPA_VIDEO_FORMAT_UNKNOWN)
         spa_pod_builder_add(builder,
             SPA_FORMAT_VIDEO_format,    SPA_POD_Id(info->format), 0);
-    if (info->modifier != 0 || info->flags & SPA_VIDEO_FLAG_MODIFIER)
-        spa_pod_builder_add(builder,
-            SPA_FORMAT_VIDEO_modifier,    SPA_POD_Long(info->modifier), 0);
+    if (info->modifier != 0 || info->flags & SPA_VIDEO_FLAG_MODIFIER) {
+        spa_pod_builder_prop(builder,
+            SPA_FORMAT_VIDEO_modifier,    SPA_POD_PROP_FLAG_MANDATORY);
+        spa_pod_builder_long(builder,           info->modifier);
+    }
     return (struct spa_pod*)spa_pod_builder_pop(builder, &f);
 }
 
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/param/video/format-utils.h b/src/java.desktop/unix/native/libpipewire/include/spa/param/video/format-utils.h
index 31d33101774b..13495a473a33 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/param/video/format-utils.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/param/video/format-utils.h
@@ -16,7 +16,15 @@ extern "C" {
 #include 
 #include 
 
-static inline int
+#ifndef SPA_API_VIDEO_FORMAT_UTILS
+ #ifdef SPA_API_IMPL
+  #define SPA_API_VIDEO_FORMAT_UTILS SPA_API_IMPL
+ #else
+  #define SPA_API_VIDEO_FORMAT_UTILS static inline
+ #endif
+#endif
+
+SPA_API_VIDEO_FORMAT_UTILS int
 spa_format_video_parse(const struct spa_pod *format, struct spa_video_info *info)
 {
     int res;
@@ -40,8 +48,9 @@ spa_format_video_parse(const struct spa_pod *format, struct spa_video_info *info
     return -ENOTSUP;
 }
 
-static inline struct spa_pod *
-spa_format_video_build(struct spa_pod_builder *builder, uint32_t id, struct spa_video_info *info)
+SPA_API_VIDEO_FORMAT_UTILS struct spa_pod *
+spa_format_video_build(struct spa_pod_builder *builder, uint32_t id,
+               const struct spa_video_info *info)
 {
     switch (info->media_subtype) {
     case SPA_MEDIA_SUBTYPE_raw:
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/param/video/h264-utils.h b/src/java.desktop/unix/native/libpipewire/include/spa/param/video/h264-utils.h
index 89c73c98f7ef..d15b4a0ee68d 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/param/video/h264-utils.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/param/video/h264-utils.h
@@ -18,7 +18,15 @@ extern "C" {
 #include 
 #include 
 
-static inline int
+#ifndef SPA_API_VIDEO_H264_UTILS
+ #ifdef SPA_API_IMPL
+  #define SPA_API_VIDEO_H264_UTILS SPA_API_IMPL
+ #else
+  #define SPA_API_VIDEO_H264_UTILS static inline
+ #endif
+#endif
+
+SPA_API_VIDEO_H264_UTILS int
 spa_format_video_h264_parse(const struct spa_pod *format,
                 struct spa_video_info_h264 *info)
 {
@@ -31,9 +39,9 @@ spa_format_video_h264_parse(const struct spa_pod *format,
             SPA_FORMAT_VIDEO_H264_alignment,    SPA_POD_OPT_Id(&info->alignment));
 }
 
-static inline struct spa_pod *
+SPA_API_VIDEO_H264_UTILS struct spa_pod *
 spa_format_video_h264_build(struct spa_pod_builder *builder, uint32_t id,
-               struct spa_video_info_h264 *info)
+                const struct spa_video_info_h264 *info)
 {
     struct spa_pod_frame f;
     spa_pod_builder_push_object(builder, &f, SPA_TYPE_OBJECT_Format, id);
@@ -49,7 +57,7 @@ spa_format_video_h264_build(struct spa_pod_builder *builder, uint32_t id,
             SPA_FORMAT_VIDEO_framerate,    SPA_POD_Fraction(&info->framerate), 0);
     if (info->max_framerate.denom != 0)
         spa_pod_builder_add(builder,
-            SPA_FORMAT_VIDEO_maxFramerate,    SPA_POD_Fraction(info->max_framerate), 0);
+            SPA_FORMAT_VIDEO_maxFramerate,    SPA_POD_Fraction(&info->max_framerate), 0);
     if (info->stream_format != 0)
         spa_pod_builder_add(builder,
             SPA_FORMAT_VIDEO_H264_streamFormat, SPA_POD_Id(info->stream_format), 0);
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/param/video/mjpg-utils.h b/src/java.desktop/unix/native/libpipewire/include/spa/param/video/mjpg-utils.h
index 5cb323e8077d..af362360755c 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/param/video/mjpg-utils.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/param/video/mjpg-utils.h
@@ -18,7 +18,15 @@ extern "C" {
 #include 
 #include 
 
-static inline int
+#ifndef SPA_API_VIDEO_MJPG_UTILS
+ #ifdef SPA_API_IMPL
+  #define SPA_API_VIDEO_MJPG_UTILS SPA_API_IMPL
+ #else
+  #define SPA_API_VIDEO_MJPG_UTILS static inline
+ #endif
+#endif
+
+SPA_API_VIDEO_MJPG_UTILS int
 spa_format_video_mjpg_parse(const struct spa_pod *format,
                 struct spa_video_info_mjpg *info)
 {
@@ -29,9 +37,9 @@ spa_format_video_mjpg_parse(const struct spa_pod *format,
             SPA_FORMAT_VIDEO_maxFramerate,    SPA_POD_OPT_Fraction(&info->max_framerate));
 }
 
-static inline struct spa_pod *
+SPA_API_VIDEO_MJPG_UTILS struct spa_pod *
 spa_format_video_mjpg_build(struct spa_pod_builder *builder, uint32_t id,
-               struct spa_video_info_mjpg *info)
+                const struct spa_video_info_mjpg *info)
 {
     struct spa_pod_frame f;
     spa_pod_builder_push_object(builder, &f, SPA_TYPE_OBJECT_Format, id);
@@ -47,7 +55,7 @@ spa_format_video_mjpg_build(struct spa_pod_builder *builder, uint32_t id,
             SPA_FORMAT_VIDEO_framerate,    SPA_POD_Fraction(&info->framerate), 0);
     if (info->max_framerate.denom != 0)
         spa_pod_builder_add(builder,
-            SPA_FORMAT_VIDEO_maxFramerate,    SPA_POD_Fraction(info->max_framerate), 0);
+            SPA_FORMAT_VIDEO_maxFramerate,    SPA_POD_Fraction(&info->max_framerate), 0);
     return (struct spa_pod*)spa_pod_builder_pop(builder, &f);
 }
 
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/param/video/multiview.h b/src/java.desktop/unix/native/libpipewire/include/spa/param/video/multiview.h
index 10a19323f440..7ee6a152f64c 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/param/video/multiview.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/param/video/multiview.h
@@ -59,12 +59,11 @@ enum spa_video_multiview_mode {
                                 *   sequence. This method only applies to
                                 *   raw video buffers at the moment.
                                 *   Specific view identification is via
-                                *   \ref spa_video_multiview_meta on raw
-                                *   video buffers. */
+                                *   metadata on raw video buffers. */
     SPA_VIDEO_MULTIVIEW_MODE_SEPARATED,        /**< Multiple views are provided as separate
                              *   \ref spa_data framebuffers attached
                              *   to each \ref spa_buffer, described
-                             *   by the \ref spa_video_multiview_meta */
+                             *   by the metadata */
     /* future expansion for annotated modes */
 };
 
@@ -97,9 +96,7 @@ enum spa_video_multiview_flags {
     SPA_VIDEO_MULTIVIEW_FLAGS_MIXED_MONO = (1 << 15),    /**< The video stream contains both
                                  *   mono and multiview portions,
                                  *   signalled on each buffer by the
-                                 *   absence or presence of the
-                                 *   \ref SPA_VIDEO_BUFFER_FLAG_MULTIPLE_VIEW
-                                 *   buffer flag. */
+                                 *   absence or presence of a buffer flag. */
 };
 
 
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/param/video/raw-types.h b/src/java.desktop/unix/native/libpipewire/include/spa/param/video/raw-types.h
index 743dd4cd1a5c..b216250eda6b 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/param/video/raw-types.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/param/video/raw-types.h
@@ -16,11 +16,20 @@ extern "C" {
 #include 
 #include 
 
+#ifndef SPA_API_VIDEO_RAW_TYPES
+ #ifdef SPA_API_IMPL
+  #define SPA_API_VIDEO_RAW_TYPES SPA_API_IMPL
+ #else
+  #define SPA_API_VIDEO_RAW_TYPES static inline
+ #endif
+#endif
+
 #define SPA_TYPE_INFO_VideoFormat        SPA_TYPE_INFO_ENUM_BASE "VideoFormat"
 #define SPA_TYPE_INFO_VIDEO_FORMAT_BASE        SPA_TYPE_INFO_VideoFormat ":"
 
 static const struct spa_type_info spa_type_video_format[] = {
-    { SPA_VIDEO_FORMAT_ENCODED,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "encoded", NULL },
+    { SPA_VIDEO_FORMAT_UNKNOWN,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "UNKNOWN", NULL },
+    { SPA_VIDEO_FORMAT_ENCODED,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "ENCODED", NULL },
     { SPA_VIDEO_FORMAT_I420,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "I420", NULL },
     { SPA_VIDEO_FORMAT_YV12,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "YV12", NULL },
     { SPA_VIDEO_FORMAT_YUY2,    SPA_TYPE_Int, SPA_TYPE_INFO_VIDEO_FORMAT_BASE "YUY2", NULL },
@@ -110,6 +119,15 @@ static const struct spa_type_info spa_type_video_format[] = {
     { 0, 0, NULL, NULL },
 };
 
+SPA_API_VIDEO_RAW_TYPES uint32_t spa_type_video_format_from_short_name(const char *name)
+{
+    return spa_type_from_short_name(name, spa_type_video_format, SPA_VIDEO_FORMAT_UNKNOWN);
+}
+SPA_API_VIDEO_RAW_TYPES const char * spa_type_video_format_to_short_name(uint32_t type)
+{
+    return spa_type_to_short_name(type, spa_type_video_format, "UNKNOWN");
+}
+
 #define SPA_TYPE_INFO_VideoFlags    SPA_TYPE_INFO_FLAGS_BASE "VideoFlags"
 #define SPA_TYPE_INFO_VIDEO_FLAGS_BASE    SPA_TYPE_INFO_VideoFlags ":"
 
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/param/video/raw-utils.h b/src/java.desktop/unix/native/libpipewire/include/spa/param/video/raw-utils.h
index e39c430136d1..424c04004cc0 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/param/video/raw-utils.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/param/video/raw-utils.h
@@ -18,13 +18,24 @@ extern "C" {
 #include 
 #include 
 
-static inline int
+#ifndef SPA_API_VIDEO_RAW_UTILS
+ #ifdef SPA_API_IMPL
+  #define SPA_API_VIDEO_RAW_UTILS SPA_API_IMPL
+ #else
+  #define SPA_API_VIDEO_RAW_UTILS static inline
+ #endif
+#endif
+
+SPA_API_VIDEO_RAW_UTILS int
 spa_format_video_raw_parse(const struct spa_pod *format,
                struct spa_video_info_raw *info)
 {
     info->flags = SPA_VIDEO_FLAG_NONE;
-    if (spa_pod_find_prop (format, NULL, SPA_FORMAT_VIDEO_modifier)) {
+    const struct spa_pod_prop *mod_prop;
+    if ((mod_prop = spa_pod_find_prop (format, NULL, SPA_FORMAT_VIDEO_modifier)) != NULL) {
         info->flags |= SPA_VIDEO_FLAG_MODIFIER;
+        if ((mod_prop->flags & SPA_POD_PROP_FLAG_DONT_FIXATE) == SPA_POD_PROP_FLAG_DONT_FIXATE)
+            info->flags |= SPA_VIDEO_FLAG_MODIFIER_FIXATION_REQUIRED;
     }
 
     return spa_pod_parse_object(format,
@@ -46,9 +57,9 @@ spa_format_video_raw_parse(const struct spa_pod *format,
         SPA_FORMAT_VIDEO_colorPrimaries,    SPA_POD_OPT_Id(&info->color_primaries));
 }
 
-static inline struct spa_pod *
+SPA_API_VIDEO_RAW_UTILS struct spa_pod *
 spa_format_video_raw_build(struct spa_pod_builder *builder, uint32_t id,
-               struct spa_video_info_raw *info)
+               const struct spa_video_info_raw *info)
 {
     struct spa_pod_frame f;
     spa_pod_builder_push_object(builder, &f, SPA_TYPE_OBJECT_Format, id);
@@ -65,12 +76,14 @@ spa_format_video_raw_build(struct spa_pod_builder *builder, uint32_t id,
     if (info->framerate.denom != 0)
         spa_pod_builder_add(builder,
             SPA_FORMAT_VIDEO_framerate,    SPA_POD_Fraction(&info->framerate), 0);
-    if (info->modifier != 0 || info->flags & SPA_VIDEO_FLAG_MODIFIER)
-        spa_pod_builder_add(builder,
-            SPA_FORMAT_VIDEO_modifier,    SPA_POD_Long(info->modifier), 0);
+    if (info->modifier != 0 || info->flags & SPA_VIDEO_FLAG_MODIFIER) {
+        spa_pod_builder_prop(builder,
+            SPA_FORMAT_VIDEO_modifier,    SPA_POD_PROP_FLAG_MANDATORY);
+        spa_pod_builder_long(builder,           info->modifier);
+    }
     if (info->max_framerate.denom != 0)
         spa_pod_builder_add(builder,
-            SPA_FORMAT_VIDEO_maxFramerate,    SPA_POD_Fraction(info->max_framerate), 0);
+            SPA_FORMAT_VIDEO_maxFramerate,    SPA_POD_Fraction(&info->max_framerate), 0);
     if (info->views != 0)
         spa_pod_builder_add(builder,
             SPA_FORMAT_VIDEO_views,        SPA_POD_Int(info->views), 0);
@@ -79,7 +92,7 @@ spa_format_video_raw_build(struct spa_pod_builder *builder, uint32_t id,
             SPA_FORMAT_VIDEO_interlaceMode,    SPA_POD_Id(info->interlace_mode), 0);
     if (info->pixel_aspect_ratio.denom != 0)
         spa_pod_builder_add(builder,
-            SPA_FORMAT_VIDEO_pixelAspectRatio,SPA_POD_Fraction(info->pixel_aspect_ratio), 0);
+            SPA_FORMAT_VIDEO_pixelAspectRatio, SPA_POD_Fraction(&info->pixel_aspect_ratio), 0);
     if (info->multiview_mode != 0)
         spa_pod_builder_add(builder,
             SPA_FORMAT_VIDEO_multiviewMode,    SPA_POD_Id(info->multiview_mode), 0);
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/param/video/raw.h b/src/java.desktop/unix/native/libpipewire/include/spa/param/video/raw.h
index 5f5a5b64a519..c2d369569d88 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/param/video/raw.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/param/video/raw.h
@@ -134,11 +134,12 @@ enum spa_video_format {
  * Extra video flags
  */
 enum spa_video_flags {
-    SPA_VIDEO_FLAG_NONE = 0,            /**< no flags */
-    SPA_VIDEO_FLAG_VARIABLE_FPS = (1 << 0),        /**< a variable fps is selected, fps_n and fps_d
-                             *   denote the maximum fps of the video */
-    SPA_VIDEO_FLAG_PREMULTIPLIED_ALPHA = (1 << 1),  /**< Each color has been scaled by the alpha value. */
-    SPA_VIDEO_FLAG_MODIFIER = (1 << 2),        /**< use the format modifier */
+    SPA_VIDEO_FLAG_NONE = 0,                /**< no flags */
+    SPA_VIDEO_FLAG_VARIABLE_FPS = (1 << 0),            /**< a variable fps is selected, fps_n and fps_d
+                                 *   denote the maximum fps of the video */
+    SPA_VIDEO_FLAG_PREMULTIPLIED_ALPHA = (1 << 1),        /**< Each color has been scaled by the alpha value. */
+    SPA_VIDEO_FLAG_MODIFIER = (1 << 2),            /**< use the format modifier */
+    SPA_VIDEO_FLAG_MODIFIER_FIXATION_REQUIRED = (1 << 3),    /**< format modifier was not fixated yet */
 };
 
 /**
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/pod/builder.h b/src/java.desktop/unix/native/libpipewire/include/spa/pod/builder.h
index d9283baa036c..745e0d671a56 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/pod/builder.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/pod/builder.h
@@ -24,6 +24,14 @@ extern "C" {
 #include 
 #include 
 
+#ifndef SPA_API_POD_BUILDER
+ #ifdef SPA_API_IMPL
+  #define SPA_API_POD_BUILDER SPA_API_IMPL
+ #else
+  #define SPA_API_POD_BUILDER static inline
+ #endif
+#endif
+
 struct spa_pod_builder_state {
     uint32_t offset;
 #define SPA_POD_BUILDER_FLAG_BODY    (1<<0)
@@ -49,22 +57,22 @@ struct spa_pod_builder {
     struct spa_callbacks callbacks;
 };
 
-#define SPA_POD_BUILDER_INIT(buffer,size)  ((struct spa_pod_builder){ (buffer), (size), 0, {}, {} })
+#define SPA_POD_BUILDER_INIT(buffer,size)  ((struct spa_pod_builder){ (buffer), (size), 0, {0,0,NULL},{NULL,NULL}})
 
-static inline void
+SPA_API_POD_BUILDER void
 spa_pod_builder_get_state(struct spa_pod_builder *builder, struct spa_pod_builder_state *state)
 {
     *state = builder->state;
 }
 
-static inline void
+SPA_API_POD_BUILDER void
 spa_pod_builder_set_callbacks(struct spa_pod_builder *builder,
         const struct spa_pod_builder_callbacks *callbacks, void *data)
 {
     builder->callbacks = SPA_CALLBACKS_INIT(callbacks, data);
 }
 
-static inline void
+SPA_API_POD_BUILDER void
 spa_pod_builder_reset(struct spa_pod_builder *builder, struct spa_pod_builder_state *state)
 {
     struct spa_pod_frame *f;
@@ -74,12 +82,12 @@ spa_pod_builder_reset(struct spa_pod_builder *builder, struct spa_pod_builder_st
         f->pod.size -= size;
 }
 
-static inline void spa_pod_builder_init(struct spa_pod_builder *builder, void *data, uint32_t size)
+SPA_API_POD_BUILDER void spa_pod_builder_init(struct spa_pod_builder *builder, void *data, uint32_t size)
 {
     *builder = SPA_POD_BUILDER_INIT(data, size);
 }
 
-static inline struct spa_pod *
+SPA_API_POD_BUILDER struct spa_pod *
 spa_pod_builder_deref(struct spa_pod_builder *builder, uint32_t offset)
 {
     uint32_t size = builder->size;
@@ -91,7 +99,7 @@ spa_pod_builder_deref(struct spa_pod_builder *builder, uint32_t offset)
     return NULL;
 }
 
-static inline struct spa_pod *
+SPA_API_POD_BUILDER struct spa_pod *
 spa_pod_builder_frame(struct spa_pod_builder *builder, struct spa_pod_frame *frame)
 {
     if (frame->offset + SPA_POD_SIZE(&frame->pod) <= builder->size)
@@ -99,7 +107,7 @@ spa_pod_builder_frame(struct spa_pod_builder *builder, struct spa_pod_frame *fra
     return NULL;
 }
 
-static inline void
+SPA_API_POD_BUILDER void
 spa_pod_builder_push(struct spa_pod_builder *builder,
              struct spa_pod_frame *frame,
              const struct spa_pod *pod,
@@ -115,7 +123,7 @@ spa_pod_builder_push(struct spa_pod_builder *builder,
         builder->state.flags = SPA_POD_BUILDER_FLAG_FIRST | SPA_POD_BUILDER_FLAG_BODY;
 }
 
-static inline int spa_pod_builder_raw(struct spa_pod_builder *builder, const void *data, uint32_t size)
+SPA_API_POD_BUILDER int spa_pod_builder_raw(struct spa_pod_builder *builder, const void *data, uint32_t size)
 {
     int res = 0;
     struct spa_pod_frame *f;
@@ -139,14 +147,14 @@ static inline int spa_pod_builder_raw(struct spa_pod_builder *builder, const voi
     return res;
 }
 
-static inline int spa_pod_builder_pad(struct spa_pod_builder *builder, uint32_t size)
+SPA_API_POD_BUILDER int spa_pod_builder_pad(struct spa_pod_builder *builder, uint32_t size)
 {
     uint64_t zeroes = 0;
     size = SPA_ROUND_UP_N(size, 8) - size;
     return size ? spa_pod_builder_raw(builder, &zeroes, size) : 0;
 }
 
-static inline int
+SPA_API_POD_BUILDER int
 spa_pod_builder_raw_padded(struct spa_pod_builder *builder, const void *data, uint32_t size)
 {
     int r, res = spa_pod_builder_raw(builder, data, size);
@@ -155,7 +163,7 @@ spa_pod_builder_raw_padded(struct spa_pod_builder *builder, const void *data, ui
     return res;
 }
 
-static inline void *spa_pod_builder_pop(struct spa_pod_builder *builder, struct spa_pod_frame *frame)
+SPA_API_POD_BUILDER void *spa_pod_builder_pop(struct spa_pod_builder *builder, struct spa_pod_frame *frame)
 {
     struct spa_pod *pod;
 
@@ -172,7 +180,7 @@ static inline void *spa_pod_builder_pop(struct spa_pod_builder *builder, struct
     return pod;
 }
 
-static inline int
+SPA_API_POD_BUILDER int
 spa_pod_builder_primitive(struct spa_pod_builder *builder, const struct spa_pod *p)
 {
     const void *data;
@@ -198,13 +206,13 @@ spa_pod_builder_primitive(struct spa_pod_builder *builder, const struct spa_pod
 
 #define SPA_POD_INIT_None() SPA_POD_INIT(0, SPA_TYPE_None)
 
-static inline int spa_pod_builder_none(struct spa_pod_builder *builder)
+SPA_API_POD_BUILDER int spa_pod_builder_none(struct spa_pod_builder *builder)
 {
     const struct spa_pod p = SPA_POD_INIT_None();
     return spa_pod_builder_primitive(builder, &p);
 }
 
-static inline int spa_pod_builder_child(struct spa_pod_builder *builder, uint32_t size, uint32_t type)
+SPA_API_POD_BUILDER int spa_pod_builder_child(struct spa_pod_builder *builder, uint32_t size, uint32_t type)
 {
     const struct spa_pod p = SPA_POD_INIT(size,type);
     SPA_FLAG_CLEAR(builder->state.flags, SPA_POD_BUILDER_FLAG_FIRST);
@@ -213,7 +221,7 @@ static inline int spa_pod_builder_child(struct spa_pod_builder *builder, uint32_
 
 #define SPA_POD_INIT_Bool(val) ((struct spa_pod_bool){ { sizeof(uint32_t), SPA_TYPE_Bool }, (val) ? 1 : 0, 0 })
 
-static inline int spa_pod_builder_bool(struct spa_pod_builder *builder, bool val)
+SPA_API_POD_BUILDER int spa_pod_builder_bool(struct spa_pod_builder *builder, bool val)
 {
     const struct spa_pod_bool p = SPA_POD_INIT_Bool(val);
     return spa_pod_builder_primitive(builder, &p.pod);
@@ -221,7 +229,7 @@ static inline int spa_pod_builder_bool(struct spa_pod_builder *builder, bool val
 
 #define SPA_POD_INIT_Id(val) ((struct spa_pod_id){ { sizeof(uint32_t), SPA_TYPE_Id }, (val), 0 })
 
-static inline int spa_pod_builder_id(struct spa_pod_builder *builder, uint32_t val)
+SPA_API_POD_BUILDER int spa_pod_builder_id(struct spa_pod_builder *builder, uint32_t val)
 {
     const struct spa_pod_id p = SPA_POD_INIT_Id(val);
     return spa_pod_builder_primitive(builder, &p.pod);
@@ -229,7 +237,7 @@ static inline int spa_pod_builder_id(struct spa_pod_builder *builder, uint32_t v
 
 #define SPA_POD_INIT_Int(val) ((struct spa_pod_int){ { sizeof(int32_t), SPA_TYPE_Int }, (val), 0 })
 
-static inline int spa_pod_builder_int(struct spa_pod_builder *builder, int32_t val)
+SPA_API_POD_BUILDER int spa_pod_builder_int(struct spa_pod_builder *builder, int32_t val)
 {
     const struct spa_pod_int p = SPA_POD_INIT_Int(val);
     return spa_pod_builder_primitive(builder, &p.pod);
@@ -237,7 +245,7 @@ static inline int spa_pod_builder_int(struct spa_pod_builder *builder, int32_t v
 
 #define SPA_POD_INIT_Long(val) ((struct spa_pod_long){ { sizeof(int64_t), SPA_TYPE_Long }, (val) })
 
-static inline int spa_pod_builder_long(struct spa_pod_builder *builder, int64_t val)
+SPA_API_POD_BUILDER int spa_pod_builder_long(struct spa_pod_builder *builder, int64_t val)
 {
     const struct spa_pod_long p = SPA_POD_INIT_Long(val);
     return spa_pod_builder_primitive(builder, &p.pod);
@@ -245,7 +253,7 @@ static inline int spa_pod_builder_long(struct spa_pod_builder *builder, int64_t
 
 #define SPA_POD_INIT_Float(val) ((struct spa_pod_float){ { sizeof(float), SPA_TYPE_Float }, (val), 0 })
 
-static inline int spa_pod_builder_float(struct spa_pod_builder *builder, float val)
+SPA_API_POD_BUILDER int spa_pod_builder_float(struct spa_pod_builder *builder, float val)
 {
     const struct spa_pod_float p = SPA_POD_INIT_Float(val);
     return spa_pod_builder_primitive(builder, &p.pod);
@@ -253,7 +261,7 @@ static inline int spa_pod_builder_float(struct spa_pod_builder *builder, float v
 
 #define SPA_POD_INIT_Double(val) ((struct spa_pod_double){ { sizeof(double), SPA_TYPE_Double }, (val) })
 
-static inline int spa_pod_builder_double(struct spa_pod_builder *builder, double val)
+SPA_API_POD_BUILDER int spa_pod_builder_double(struct spa_pod_builder *builder, double val)
 {
     const struct spa_pod_double p = SPA_POD_INIT_Double(val);
     return spa_pod_builder_primitive(builder, &p.pod);
@@ -261,7 +269,7 @@ static inline int spa_pod_builder_double(struct spa_pod_builder *builder, double
 
 #define SPA_POD_INIT_String(len) ((struct spa_pod_string){ { (len), SPA_TYPE_String } })
 
-static inline int
+SPA_API_POD_BUILDER int
 spa_pod_builder_write_string(struct spa_pod_builder *builder, const char *str, uint32_t len)
 {
     int r, res;
@@ -273,7 +281,7 @@ spa_pod_builder_write_string(struct spa_pod_builder *builder, const char *str, u
     return res;
 }
 
-static inline int
+SPA_API_POD_BUILDER int
 spa_pod_builder_string_len(struct spa_pod_builder *builder, const char *str, uint32_t len)
 {
     const struct spa_pod_string p = SPA_POD_INIT_String(len+1);
@@ -283,7 +291,7 @@ spa_pod_builder_string_len(struct spa_pod_builder *builder, const char *str, uin
     return res;
 }
 
-static inline int spa_pod_builder_string(struct spa_pod_builder *builder, const char *str)
+SPA_API_POD_BUILDER int spa_pod_builder_string(struct spa_pod_builder *builder, const char *str)
 {
     uint32_t len = str ? strlen(str) : 0;
     return spa_pod_builder_string_len(builder, str ? str : "", len);
@@ -291,7 +299,7 @@ static inline int spa_pod_builder_string(struct spa_pod_builder *builder, const
 
 #define SPA_POD_INIT_Bytes(len) ((struct spa_pod_bytes){ { (len), SPA_TYPE_Bytes } })
 
-static inline int
+SPA_API_POD_BUILDER int
 spa_pod_builder_bytes(struct spa_pod_builder *builder, const void *bytes, uint32_t len)
 {
     const struct spa_pod_bytes p = SPA_POD_INIT_Bytes(len);
@@ -300,7 +308,7 @@ spa_pod_builder_bytes(struct spa_pod_builder *builder, const void *bytes, uint32
         res = r;
     return res;
 }
-static inline void *
+SPA_API_POD_BUILDER void *
 spa_pod_builder_reserve_bytes(struct spa_pod_builder *builder, uint32_t len)
 {
     uint32_t offset = builder->state.offset;
@@ -311,7 +319,7 @@ spa_pod_builder_reserve_bytes(struct spa_pod_builder *builder, uint32_t len)
 
 #define SPA_POD_INIT_Pointer(type,value) ((struct spa_pod_pointer){ { sizeof(struct spa_pod_pointer_body), SPA_TYPE_Pointer }, { (type), 0, (value) } })
 
-static inline int
+SPA_API_POD_BUILDER int
 spa_pod_builder_pointer(struct spa_pod_builder *builder, uint32_t type, const void *val)
 {
     const struct spa_pod_pointer p = SPA_POD_INIT_Pointer(type, val);
@@ -320,7 +328,7 @@ spa_pod_builder_pointer(struct spa_pod_builder *builder, uint32_t type, const vo
 
 #define SPA_POD_INIT_Fd(fd) ((struct spa_pod_fd){ { sizeof(int64_t), SPA_TYPE_Fd }, (fd) })
 
-static inline int spa_pod_builder_fd(struct spa_pod_builder *builder, int64_t fd)
+SPA_API_POD_BUILDER int spa_pod_builder_fd(struct spa_pod_builder *builder, int64_t fd)
 {
     const struct spa_pod_fd p = SPA_POD_INIT_Fd(fd);
     return spa_pod_builder_primitive(builder, &p.pod);
@@ -328,7 +336,7 @@ static inline int spa_pod_builder_fd(struct spa_pod_builder *builder, int64_t fd
 
 #define SPA_POD_INIT_Rectangle(val) ((struct spa_pod_rectangle){ { sizeof(struct spa_rectangle), SPA_TYPE_Rectangle }, (val) })
 
-static inline int
+SPA_API_POD_BUILDER int
 spa_pod_builder_rectangle(struct spa_pod_builder *builder, uint32_t width, uint32_t height)
 {
     const struct spa_pod_rectangle p = SPA_POD_INIT_Rectangle(SPA_RECTANGLE(width, height));
@@ -337,14 +345,14 @@ spa_pod_builder_rectangle(struct spa_pod_builder *builder, uint32_t width, uint3
 
 #define SPA_POD_INIT_Fraction(val) ((struct spa_pod_fraction){ { sizeof(struct spa_fraction), SPA_TYPE_Fraction }, (val) })
 
-static inline int
+SPA_API_POD_BUILDER int
 spa_pod_builder_fraction(struct spa_pod_builder *builder, uint32_t num, uint32_t denom)
 {
     const struct spa_pod_fraction p = SPA_POD_INIT_Fraction(SPA_FRACTION(num, denom));
     return spa_pod_builder_primitive(builder, &p.pod);
 }
 
-static inline int
+SPA_API_POD_BUILDER int
 spa_pod_builder_push_array(struct spa_pod_builder *builder, struct spa_pod_frame *frame)
 {
     const struct spa_pod_array p =
@@ -356,7 +364,7 @@ spa_pod_builder_push_array(struct spa_pod_builder *builder, struct spa_pod_frame
     return res;
 }
 
-static inline int
+SPA_API_POD_BUILDER int
 spa_pod_builder_array(struct spa_pod_builder *builder,
               uint32_t child_size, uint32_t child_type, uint32_t n_elems, const void *elems)
 {
@@ -378,7 +386,7 @@ spa_pod_builder_array(struct spa_pod_builder *builder,
     { { { (n_vals) * sizeof(ctype) + sizeof(struct spa_pod_choice_body), SPA_TYPE_Choice },    \
         { (type), 0, { sizeof(ctype), (child_type) } } }, { __VA_ARGS__ } })
 
-static inline int
+SPA_API_POD_BUILDER int
 spa_pod_builder_push_choice(struct spa_pod_builder *builder, struct spa_pod_frame *frame,
         uint32_t type, uint32_t flags)
 {
@@ -393,7 +401,7 @@ spa_pod_builder_push_choice(struct spa_pod_builder *builder, struct spa_pod_fram
 
 #define SPA_POD_INIT_Struct(size) ((struct spa_pod_struct){ { (size), SPA_TYPE_Struct } })
 
-static inline int
+SPA_API_POD_BUILDER int
 spa_pod_builder_push_struct(struct spa_pod_builder *builder, struct spa_pod_frame *frame)
 {
     const struct spa_pod_struct p = SPA_POD_INIT_Struct(0);
@@ -405,7 +413,7 @@ spa_pod_builder_push_struct(struct spa_pod_builder *builder, struct spa_pod_fram
 
 #define SPA_POD_INIT_Object(size,type,id,...)    ((struct spa_pod_object){ { (size), SPA_TYPE_Object }, { (type), (id) }, ##__VA_ARGS__ })
 
-static inline int
+SPA_API_POD_BUILDER int
 spa_pod_builder_push_object(struct spa_pod_builder *builder, struct spa_pod_frame *frame,
         uint32_t type, uint32_t id)
 {
@@ -420,7 +428,7 @@ spa_pod_builder_push_object(struct spa_pod_builder *builder, struct spa_pod_fram
 #define SPA_POD_INIT_Prop(key,flags,size,type)    \
     ((struct spa_pod_prop){ (key), (flags), { (size), (type) } })
 
-static inline int
+SPA_API_POD_BUILDER int
 spa_pod_builder_prop(struct spa_pod_builder *builder, uint32_t key, uint32_t flags)
 {
     const struct { uint32_t key; uint32_t flags; } p = { key, flags };
@@ -430,7 +438,7 @@ spa_pod_builder_prop(struct spa_pod_builder *builder, uint32_t key, uint32_t fla
 #define SPA_POD_INIT_Sequence(size,unit)    \
     ((struct spa_pod_sequence){ { (size), SPA_TYPE_Sequence}, {(unit), 0 } })
 
-static inline int
+SPA_API_POD_BUILDER int
 spa_pod_builder_push_sequence(struct spa_pod_builder *builder, struct spa_pod_frame *frame, uint32_t unit)
 {
     const struct spa_pod_sequence p =
@@ -441,14 +449,14 @@ spa_pod_builder_push_sequence(struct spa_pod_builder *builder, struct spa_pod_fr
     return res;
 }
 
-static inline uint32_t
+SPA_API_POD_BUILDER int
 spa_pod_builder_control(struct spa_pod_builder *builder, uint32_t offset, uint32_t type)
 {
     const struct { uint32_t offset; uint32_t type; } p = { offset, type };
     return spa_pod_builder_raw(builder, &p, sizeof(p));
 }
 
-static inline uint32_t spa_choice_from_id(char id)
+SPA_API_POD_BUILDER uint32_t spa_choice_from_id(char id)
 {
     switch (id) {
     case 'r':
@@ -481,7 +489,7 @@ do {                                        \
         spa_pod_builder_long(builder, va_arg(args, int64_t));        \
         break;                                \
     case 'f':                                \
-        spa_pod_builder_float(builder, va_arg(args, double));        \
+        spa_pod_builder_float(builder, (float)va_arg(args, double));    \
         break;                                \
     case 'd':                                \
         spa_pod_builder_double(builder, va_arg(args, double));        \
@@ -560,7 +568,7 @@ do {                                        \
     }                                    \
 } while(false)
 
-static inline int
+SPA_API_POD_BUILDER int
 spa_pod_builder_addv(struct spa_pod_builder *builder, va_list args)
 {
     int res = 0;
@@ -618,7 +626,7 @@ spa_pod_builder_addv(struct spa_pod_builder *builder, va_list args)
     return res;
 }
 
-static inline int spa_pod_builder_add(struct spa_pod_builder *builder, ...)
+SPA_API_POD_BUILDER int spa_pod_builder_add(struct spa_pod_builder *builder, ...)
 {
     int res;
     va_list args;
@@ -658,7 +666,7 @@ static inline int spa_pod_builder_add(struct spa_pod_builder *builder, ...)
 })
 
 /** Copy a pod structure */
-static inline struct spa_pod *
+SPA_API_POD_BUILDER struct spa_pod *
 spa_pod_copy(const struct spa_pod *pod)
 {
     size_t size;
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/pod/event.h b/src/java.desktop/unix/native/libpipewire/include/spa/pod/event.h
index 23a75a2fd439..0fa02f698f57 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/pod/event.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/pod/event.h
@@ -30,7 +30,7 @@ struct spa_event {
                     (ev)->body.body.id : SPA_ID_INVALID)
 
 #define SPA_EVENT_INIT_FULL(t,size,type,id,...) ((t)            \
-    { { (size), SPA_TYPE_OBJECT },                    \
+    { { (size), SPA_TYPE_Object },                    \
       { { (type), (id) }, ##__VA_ARGS__ } })            \
 
 #define SPA_EVENT_INIT(type,id)                        \
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/pod/iter.h b/src/java.desktop/unix/native/libpipewire/include/spa/pod/iter.h
index 3dd24a8eb442..cb9b7b898848 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/pod/iter.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/pod/iter.h
@@ -14,6 +14,14 @@ extern "C" {
 
 #include 
 
+#ifndef SPA_API_POD_ITER
+ #ifdef SPA_API_IMPL
+  #define SPA_API_POD_ITER SPA_API_IMPL
+ #else
+  #define SPA_API_POD_ITER static inline
+ #endif
+#endif
+
 /**
  * \addtogroup spa_pod
  * \{
@@ -26,54 +34,60 @@ struct spa_pod_frame {
     uint32_t flags;
 };
 
-static inline bool spa_pod_is_inside(const void *pod, uint32_t size, const void *iter)
+SPA_API_POD_ITER bool spa_pod_is_inside(const void *pod, uint32_t size, const void *iter)
 {
-    return SPA_POD_BODY(iter) <= SPA_PTROFF(pod, size, void) &&
-        SPA_PTROFF(iter, SPA_POD_SIZE(iter), void) <= SPA_PTROFF(pod, size, void);
+    size_t remaining;
+
+    return spa_ptr_type_inside(pod, size, iter, struct spa_pod, &remaining) &&
+           remaining >= SPA_POD_BODY_SIZE(iter);
 }
 
-static inline void *spa_pod_next(const void *iter)
+SPA_API_POD_ITER void *spa_pod_next(const void *iter)
 {
     return SPA_PTROFF(iter, SPA_ROUND_UP_N(SPA_POD_SIZE(iter), 8), void);
 }
 
-static inline struct spa_pod_prop *spa_pod_prop_first(const struct spa_pod_object_body *body)
+SPA_API_POD_ITER struct spa_pod_prop *spa_pod_prop_first(const struct spa_pod_object_body *body)
 {
     return SPA_PTROFF(body, sizeof(struct spa_pod_object_body), struct spa_pod_prop);
 }
 
-static inline bool spa_pod_prop_is_inside(const struct spa_pod_object_body *body,
+SPA_API_POD_ITER bool spa_pod_prop_is_inside(const struct spa_pod_object_body *body,
         uint32_t size, const struct spa_pod_prop *iter)
 {
-    return SPA_POD_CONTENTS(struct spa_pod_prop, iter) <= SPA_PTROFF(body, size, void) &&
-        SPA_PTROFF(iter, SPA_POD_PROP_SIZE(iter), void) <= SPA_PTROFF(body, size, void);
+    size_t remaining;
+
+    return spa_ptr_type_inside(body, size, iter, struct spa_pod_prop, &remaining) &&
+           remaining >= iter->value.size;
 }
 
-static inline struct spa_pod_prop *spa_pod_prop_next(const struct spa_pod_prop *iter)
+SPA_API_POD_ITER struct spa_pod_prop *spa_pod_prop_next(const struct spa_pod_prop *iter)
 {
     return SPA_PTROFF(iter, SPA_ROUND_UP_N(SPA_POD_PROP_SIZE(iter), 8), struct spa_pod_prop);
 }
 
-static inline struct spa_pod_control *spa_pod_control_first(const struct spa_pod_sequence_body *body)
+SPA_API_POD_ITER struct spa_pod_control *spa_pod_control_first(const struct spa_pod_sequence_body *body)
 {
     return SPA_PTROFF(body, sizeof(struct spa_pod_sequence_body), struct spa_pod_control);
 }
 
-static inline bool spa_pod_control_is_inside(const struct spa_pod_sequence_body *body,
+SPA_API_POD_ITER bool spa_pod_control_is_inside(const struct spa_pod_sequence_body *body,
         uint32_t size, const struct spa_pod_control *iter)
 {
-    return SPA_POD_CONTENTS(struct spa_pod_control, iter) <= SPA_PTROFF(body, size, void) &&
-        SPA_PTROFF(iter, SPA_POD_CONTROL_SIZE(iter), void) <= SPA_PTROFF(body, size, void);
+    size_t remaining;
+
+    return spa_ptr_type_inside(body, size, iter, struct spa_pod_control, &remaining) &&
+           remaining >= iter->value.size;
 }
 
-static inline struct spa_pod_control *spa_pod_control_next(const struct spa_pod_control *iter)
+SPA_API_POD_ITER struct spa_pod_control *spa_pod_control_next(const struct spa_pod_control *iter)
 {
     return SPA_PTROFF(iter, SPA_ROUND_UP_N(SPA_POD_CONTROL_SIZE(iter), 8), struct spa_pod_control);
 }
 
 #define SPA_POD_ARRAY_BODY_FOREACH(body, _size, iter)                            \
     for ((iter) = (__typeof__(iter))SPA_PTROFF((body), sizeof(struct spa_pod_array_body), void);    \
-         (iter) < (__typeof__(iter))SPA_PTROFF((body), (_size), void);                \
+         (body)->child.size > 0 && spa_ptrinside(body, _size, iter, (body)->child.size, NULL);    \
          (iter) = (__typeof__(iter))SPA_PTROFF((iter), (body)->child.size, void))
 
 #define SPA_POD_ARRAY_FOREACH(obj, iter)                            \
@@ -81,7 +95,7 @@ static inline struct spa_pod_control *spa_pod_control_next(const struct spa_pod_
 
 #define SPA_POD_CHOICE_BODY_FOREACH(body, _size, iter)                            \
     for ((iter) = (__typeof__(iter))SPA_PTROFF((body), sizeof(struct spa_pod_choice_body), void);    \
-         (iter) < (__typeof__(iter))SPA_PTROFF((body), (_size), void);                \
+         (body)->child.size > 0 && spa_ptrinside(body, _size, iter, (body)->child.size, NULL);    \
          (iter) = (__typeof__(iter))SPA_PTROFF((iter), (body)->child.size, void))
 
 #define SPA_POD_CHOICE_FOREACH(obj, iter)                            \
@@ -112,7 +126,7 @@ static inline struct spa_pod_control *spa_pod_control_next(const struct spa_pod_
     SPA_POD_SEQUENCE_BODY_FOREACH(&(seq)->body, SPA_POD_BODY_SIZE(seq), iter)
 
 
-static inline void *spa_pod_from_data(void *data, size_t maxsize, off_t offset, size_t size)
+SPA_API_POD_ITER void *spa_pod_from_data(void *data, size_t maxsize, off_t offset, size_t size)
 {
     void *pod;
     if (size < sizeof(struct spa_pod) || offset + size > maxsize)
@@ -123,17 +137,17 @@ static inline void *spa_pod_from_data(void *data, size_t maxsize, off_t offset,
     return pod;
 }
 
-static inline int spa_pod_is_none(const struct spa_pod *pod)
+SPA_API_POD_ITER int spa_pod_is_none(const struct spa_pod *pod)
 {
     return (SPA_POD_TYPE(pod) == SPA_TYPE_None);
 }
 
-static inline int spa_pod_is_bool(const struct spa_pod *pod)
+SPA_API_POD_ITER int spa_pod_is_bool(const struct spa_pod *pod)
 {
     return (SPA_POD_TYPE(pod) == SPA_TYPE_Bool && SPA_POD_BODY_SIZE(pod) >= sizeof(int32_t));
 }
 
-static inline int spa_pod_get_bool(const struct spa_pod *pod, bool *value)
+SPA_API_POD_ITER int spa_pod_get_bool(const struct spa_pod *pod, bool *value)
 {
     if (!spa_pod_is_bool(pod))
         return -EINVAL;
@@ -141,12 +155,12 @@ static inline int spa_pod_get_bool(const struct spa_pod *pod, bool *value)
     return 0;
 }
 
-static inline int spa_pod_is_id(const struct spa_pod *pod)
+SPA_API_POD_ITER int spa_pod_is_id(const struct spa_pod *pod)
 {
     return (SPA_POD_TYPE(pod) == SPA_TYPE_Id && SPA_POD_BODY_SIZE(pod) >= sizeof(uint32_t));
 }
 
-static inline int spa_pod_get_id(const struct spa_pod *pod, uint32_t *value)
+SPA_API_POD_ITER int spa_pod_get_id(const struct spa_pod *pod, uint32_t *value)
 {
     if (!spa_pod_is_id(pod))
         return -EINVAL;
@@ -154,12 +168,12 @@ static inline int spa_pod_get_id(const struct spa_pod *pod, uint32_t *value)
     return 0;
 }
 
-static inline int spa_pod_is_int(const struct spa_pod *pod)
+SPA_API_POD_ITER int spa_pod_is_int(const struct spa_pod *pod)
 {
     return (SPA_POD_TYPE(pod) == SPA_TYPE_Int && SPA_POD_BODY_SIZE(pod) >= sizeof(int32_t));
 }
 
-static inline int spa_pod_get_int(const struct spa_pod *pod, int32_t *value)
+SPA_API_POD_ITER int spa_pod_get_int(const struct spa_pod *pod, int32_t *value)
 {
     if (!spa_pod_is_int(pod))
         return -EINVAL;
@@ -167,12 +181,12 @@ static inline int spa_pod_get_int(const struct spa_pod *pod, int32_t *value)
     return 0;
 }
 
-static inline int spa_pod_is_long(const struct spa_pod *pod)
+SPA_API_POD_ITER int spa_pod_is_long(const struct spa_pod *pod)
 {
     return (SPA_POD_TYPE(pod) == SPA_TYPE_Long && SPA_POD_BODY_SIZE(pod) >= sizeof(int64_t));
 }
 
-static inline int spa_pod_get_long(const struct spa_pod *pod, int64_t *value)
+SPA_API_POD_ITER int spa_pod_get_long(const struct spa_pod *pod, int64_t *value)
 {
     if (!spa_pod_is_long(pod))
         return -EINVAL;
@@ -180,12 +194,12 @@ static inline int spa_pod_get_long(const struct spa_pod *pod, int64_t *value)
     return 0;
 }
 
-static inline int spa_pod_is_float(const struct spa_pod *pod)
+SPA_API_POD_ITER int spa_pod_is_float(const struct spa_pod *pod)
 {
     return (SPA_POD_TYPE(pod) == SPA_TYPE_Float && SPA_POD_BODY_SIZE(pod) >= sizeof(float));
 }
 
-static inline int spa_pod_get_float(const struct spa_pod *pod, float *value)
+SPA_API_POD_ITER int spa_pod_get_float(const struct spa_pod *pod, float *value)
 {
     if (!spa_pod_is_float(pod))
         return -EINVAL;
@@ -193,12 +207,12 @@ static inline int spa_pod_get_float(const struct spa_pod *pod, float *value)
     return 0;
 }
 
-static inline int spa_pod_is_double(const struct spa_pod *pod)
+SPA_API_POD_ITER int spa_pod_is_double(const struct spa_pod *pod)
 {
     return (SPA_POD_TYPE(pod) == SPA_TYPE_Double && SPA_POD_BODY_SIZE(pod) >= sizeof(double));
 }
 
-static inline int spa_pod_get_double(const struct spa_pod *pod, double *value)
+SPA_API_POD_ITER int spa_pod_get_double(const struct spa_pod *pod, double *value)
 {
     if (!spa_pod_is_double(pod))
         return -EINVAL;
@@ -206,7 +220,7 @@ static inline int spa_pod_get_double(const struct spa_pod *pod, double *value)
     return 0;
 }
 
-static inline int spa_pod_is_string(const struct spa_pod *pod)
+SPA_API_POD_ITER int spa_pod_is_string(const struct spa_pod *pod)
 {
     const char *s = (const char *)SPA_POD_CONTENTS(struct spa_pod_string, pod);
     return (SPA_POD_TYPE(pod) == SPA_TYPE_String &&
@@ -214,7 +228,7 @@ static inline int spa_pod_is_string(const struct spa_pod *pod)
             s[SPA_POD_BODY_SIZE(pod)-1] == '\0');
 }
 
-static inline int spa_pod_get_string(const struct spa_pod *pod, const char **value)
+SPA_API_POD_ITER int spa_pod_get_string(const struct spa_pod *pod, const char **value)
 {
     if (!spa_pod_is_string(pod))
         return -EINVAL;
@@ -222,7 +236,7 @@ static inline int spa_pod_get_string(const struct spa_pod *pod, const char **val
     return 0;
 }
 
-static inline int spa_pod_copy_string(const struct spa_pod *pod, size_t maxlen, char *dest)
+SPA_API_POD_ITER int spa_pod_copy_string(const struct spa_pod *pod, size_t maxlen, char *dest)
 {
     const char *s = (const char *)SPA_POD_CONTENTS(struct spa_pod_string, pod);
     if (!spa_pod_is_string(pod) || maxlen < 1)
@@ -232,12 +246,12 @@ static inline int spa_pod_copy_string(const struct spa_pod *pod, size_t maxlen,
     return 0;
 }
 
-static inline int spa_pod_is_bytes(const struct spa_pod *pod)
+SPA_API_POD_ITER int spa_pod_is_bytes(const struct spa_pod *pod)
 {
     return SPA_POD_TYPE(pod) == SPA_TYPE_Bytes;
 }
 
-static inline int spa_pod_get_bytes(const struct spa_pod *pod, const void **value, uint32_t *len)
+SPA_API_POD_ITER int spa_pod_get_bytes(const struct spa_pod *pod, const void **value, uint32_t *len)
 {
     if (!spa_pod_is_bytes(pod))
         return -EINVAL;
@@ -246,13 +260,13 @@ static inline int spa_pod_get_bytes(const struct spa_pod *pod, const void **valu
     return 0;
 }
 
-static inline int spa_pod_is_pointer(const struct spa_pod *pod)
+SPA_API_POD_ITER int spa_pod_is_pointer(const struct spa_pod *pod)
 {
     return (SPA_POD_TYPE(pod) == SPA_TYPE_Pointer &&
             SPA_POD_BODY_SIZE(pod) >= sizeof(struct spa_pod_pointer_body));
 }
 
-static inline int spa_pod_get_pointer(const struct spa_pod *pod, uint32_t *type, const void **value)
+SPA_API_POD_ITER int spa_pod_get_pointer(const struct spa_pod *pod, uint32_t *type, const void **value)
 {
     if (!spa_pod_is_pointer(pod))
         return -EINVAL;
@@ -261,13 +275,13 @@ static inline int spa_pod_get_pointer(const struct spa_pod *pod, uint32_t *type,
     return 0;
 }
 
-static inline int spa_pod_is_fd(const struct spa_pod *pod)
+SPA_API_POD_ITER int spa_pod_is_fd(const struct spa_pod *pod)
 {
     return (SPA_POD_TYPE(pod) == SPA_TYPE_Fd &&
             SPA_POD_BODY_SIZE(pod) >= sizeof(int64_t));
 }
 
-static inline int spa_pod_get_fd(const struct spa_pod *pod, int64_t *value)
+SPA_API_POD_ITER int spa_pod_get_fd(const struct spa_pod *pod, int64_t *value)
 {
     if (!spa_pod_is_fd(pod))
         return -EINVAL;
@@ -275,13 +289,13 @@ static inline int spa_pod_get_fd(const struct spa_pod *pod, int64_t *value)
     return 0;
 }
 
-static inline int spa_pod_is_rectangle(const struct spa_pod *pod)
+SPA_API_POD_ITER int spa_pod_is_rectangle(const struct spa_pod *pod)
 {
     return (SPA_POD_TYPE(pod) == SPA_TYPE_Rectangle &&
             SPA_POD_BODY_SIZE(pod) >= sizeof(struct spa_rectangle));
 }
 
-static inline int spa_pod_get_rectangle(const struct spa_pod *pod, struct spa_rectangle *value)
+SPA_API_POD_ITER int spa_pod_get_rectangle(const struct spa_pod *pod, struct spa_rectangle *value)
 {
     if (!spa_pod_is_rectangle(pod))
         return -EINVAL;
@@ -289,39 +303,39 @@ static inline int spa_pod_get_rectangle(const struct spa_pod *pod, struct spa_re
     return 0;
 }
 
-static inline int spa_pod_is_fraction(const struct spa_pod *pod)
+SPA_API_POD_ITER int spa_pod_is_fraction(const struct spa_pod *pod)
 {
     return (SPA_POD_TYPE(pod) == SPA_TYPE_Fraction &&
             SPA_POD_BODY_SIZE(pod) >= sizeof(struct spa_fraction));
 }
 
-static inline int spa_pod_get_fraction(const struct spa_pod *pod, struct spa_fraction *value)
+SPA_API_POD_ITER int spa_pod_get_fraction(const struct spa_pod *pod, struct spa_fraction *value)
 {
     spa_return_val_if_fail(spa_pod_is_fraction(pod), -EINVAL);
     *value = SPA_POD_VALUE(struct spa_pod_fraction, pod);
     return 0;
 }
 
-static inline int spa_pod_is_bitmap(const struct spa_pod *pod)
+SPA_API_POD_ITER int spa_pod_is_bitmap(const struct spa_pod *pod)
 {
     return (SPA_POD_TYPE(pod) == SPA_TYPE_Bitmap &&
             SPA_POD_BODY_SIZE(pod) >= sizeof(uint8_t));
 }
 
-static inline int spa_pod_is_array(const struct spa_pod *pod)
+SPA_API_POD_ITER int spa_pod_is_array(const struct spa_pod *pod)
 {
     return (SPA_POD_TYPE(pod) == SPA_TYPE_Array &&
             SPA_POD_BODY_SIZE(pod) >= sizeof(struct spa_pod_array_body));
 }
 
-static inline void *spa_pod_get_array(const struct spa_pod *pod, uint32_t *n_values)
+SPA_API_POD_ITER void *spa_pod_get_array(const struct spa_pod *pod, uint32_t *n_values)
 {
     spa_return_val_if_fail(spa_pod_is_array(pod), NULL);
     *n_values = SPA_POD_ARRAY_N_VALUES(pod);
     return SPA_POD_ARRAY_VALUES(pod);
 }
 
-static inline uint32_t spa_pod_copy_array(const struct spa_pod *pod, uint32_t type,
+SPA_API_POD_ITER uint32_t spa_pod_copy_array(const struct spa_pod *pod, uint32_t type,
         void *values, uint32_t max_values)
 {
     uint32_t n_values;
@@ -333,13 +347,13 @@ static inline uint32_t spa_pod_copy_array(const struct spa_pod *pod, uint32_t ty
     return n_values;
 }
 
-static inline int spa_pod_is_choice(const struct spa_pod *pod)
+SPA_API_POD_ITER int spa_pod_is_choice(const struct spa_pod *pod)
 {
     return (SPA_POD_TYPE(pod) == SPA_TYPE_Choice &&
             SPA_POD_BODY_SIZE(pod) >= sizeof(struct spa_pod_choice_body));
 }
 
-static inline struct spa_pod *spa_pod_get_values(const struct spa_pod *pod, uint32_t *n_vals, uint32_t *choice)
+SPA_API_POD_ITER struct spa_pod *spa_pod_get_values(const struct spa_pod *pod, uint32_t *n_vals, uint32_t *choice)
 {
     if (pod->type == SPA_TYPE_Choice) {
         *n_vals = SPA_POD_CHOICE_N_VALUES(pod);
@@ -353,34 +367,34 @@ static inline struct spa_pod *spa_pod_get_values(const struct spa_pod *pod, uint
     }
 }
 
-static inline int spa_pod_is_struct(const struct spa_pod *pod)
+SPA_API_POD_ITER int spa_pod_is_struct(const struct spa_pod *pod)
 {
     return (SPA_POD_TYPE(pod) == SPA_TYPE_Struct);
 }
 
-static inline int spa_pod_is_object(const struct spa_pod *pod)
+SPA_API_POD_ITER int spa_pod_is_object(const struct spa_pod *pod)
 {
     return (SPA_POD_TYPE(pod) == SPA_TYPE_Object &&
             SPA_POD_BODY_SIZE(pod) >= sizeof(struct spa_pod_object_body));
 }
 
-static inline bool spa_pod_is_object_type(const struct spa_pod *pod, uint32_t type)
+SPA_API_POD_ITER bool spa_pod_is_object_type(const struct spa_pod *pod, uint32_t type)
 {
     return (pod && spa_pod_is_object(pod) && SPA_POD_OBJECT_TYPE(pod) == type);
 }
 
-static inline bool spa_pod_is_object_id(const struct spa_pod *pod, uint32_t id)
+SPA_API_POD_ITER bool spa_pod_is_object_id(const struct spa_pod *pod, uint32_t id)
 {
     return (pod && spa_pod_is_object(pod) && SPA_POD_OBJECT_ID(pod) == id);
 }
 
-static inline int spa_pod_is_sequence(const struct spa_pod *pod)
+SPA_API_POD_ITER int spa_pod_is_sequence(const struct spa_pod *pod)
 {
     return (SPA_POD_TYPE(pod) == SPA_TYPE_Sequence &&
             SPA_POD_BODY_SIZE(pod) >= sizeof(struct spa_pod_sequence_body));
 }
 
-static inline const struct spa_pod_prop *spa_pod_object_find_prop(const struct spa_pod_object *pod,
+SPA_API_POD_ITER const struct spa_pod_prop *spa_pod_object_find_prop(const struct spa_pod_object *pod,
         const struct spa_pod_prop *start, uint32_t key)
 {
     const struct spa_pod_prop *first, *res;
@@ -400,7 +414,7 @@ static inline const struct spa_pod_prop *spa_pod_object_find_prop(const struct s
     return NULL;
 }
 
-static inline const struct spa_pod_prop *spa_pod_find_prop(const struct spa_pod *pod,
+SPA_API_POD_ITER const struct spa_pod_prop *spa_pod_find_prop(const struct spa_pod *pod,
         const struct spa_pod_prop *start, uint32_t key)
 {
     if (!spa_pod_is_object(pod))
@@ -408,7 +422,7 @@ static inline const struct spa_pod_prop *spa_pod_find_prop(const struct spa_pod
     return spa_pod_object_find_prop((const struct spa_pod_object *)pod, start, key);
 }
 
-static inline int spa_pod_object_fixate(struct spa_pod_object *pod)
+SPA_API_POD_ITER int spa_pod_object_fixate(struct spa_pod_object *pod)
 {
     struct spa_pod_prop *res;
     SPA_POD_OBJECT_FOREACH(pod, res) {
@@ -419,14 +433,14 @@ static inline int spa_pod_object_fixate(struct spa_pod_object *pod)
     return 0;
 }
 
-static inline int spa_pod_fixate(struct spa_pod *pod)
+SPA_API_POD_ITER int spa_pod_fixate(struct spa_pod *pod)
 {
     if (!spa_pod_is_object(pod))
         return -EINVAL;
     return spa_pod_object_fixate((struct spa_pod_object *)pod);
 }
 
-static inline int spa_pod_object_is_fixated(const struct spa_pod_object *pod)
+SPA_API_POD_ITER int spa_pod_object_is_fixated(const struct spa_pod_object *pod)
 {
     struct spa_pod_prop *res;
     SPA_POD_OBJECT_FOREACH(pod, res) {
@@ -437,7 +451,15 @@ static inline int spa_pod_object_is_fixated(const struct spa_pod_object *pod)
     return 1;
 }
 
-static inline int spa_pod_is_fixated(const struct spa_pod *pod)
+SPA_API_POD_ITER int spa_pod_object_has_props(const struct spa_pod_object *pod)
+{
+    struct spa_pod_prop *res;
+    SPA_POD_OBJECT_FOREACH(pod, res)
+        return 1;
+    return 0;
+}
+
+SPA_API_POD_ITER int spa_pod_is_fixated(const struct spa_pod *pod)
 {
     if (!spa_pod_is_object(pod))
         return -EINVAL;
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/pod/parser.h b/src/java.desktop/unix/native/libpipewire/include/spa/pod/parser.h
index 76c73e2e6cae..bfec7b88c805 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/pod/parser.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/pod/parser.h
@@ -15,6 +15,14 @@ extern "C" {
 #include 
 #include 
 
+#ifndef SPA_API_POD_PARSER
+ #ifdef SPA_API_IMPL
+  #define SPA_API_POD_PARSER SPA_API_IMPL
+ #else
+  #define SPA_API_POD_PARSER static inline
+ #endif
+#endif
+
 /**
  * \addtogroup spa_pod
  * \{
@@ -33,33 +41,33 @@ struct spa_pod_parser {
     struct spa_pod_parser_state state;
 };
 
-#define SPA_POD_PARSER_INIT(buffer,size)  ((struct spa_pod_parser){ (buffer), (size), 0, {} })
+#define SPA_POD_PARSER_INIT(buffer,size)  ((struct spa_pod_parser){ (buffer), (size), 0, {0,0,NULL}})
 
-static inline void spa_pod_parser_init(struct spa_pod_parser *parser,
+SPA_API_POD_PARSER void spa_pod_parser_init(struct spa_pod_parser *parser,
                        const void *data, uint32_t size)
 {
     *parser = SPA_POD_PARSER_INIT(data, size);
 }
 
-static inline void spa_pod_parser_pod(struct spa_pod_parser *parser,
+SPA_API_POD_PARSER void spa_pod_parser_pod(struct spa_pod_parser *parser,
                       const struct spa_pod *pod)
 {
     spa_pod_parser_init(parser, pod, SPA_POD_SIZE(pod));
 }
 
-static inline void
+SPA_API_POD_PARSER void
 spa_pod_parser_get_state(struct spa_pod_parser *parser, struct spa_pod_parser_state *state)
 {
     *state = parser->state;
 }
 
-static inline void
+SPA_API_POD_PARSER void
 spa_pod_parser_reset(struct spa_pod_parser *parser, struct spa_pod_parser_state *state)
 {
     parser->state = *state;
 }
 
-static inline struct spa_pod *
+SPA_API_POD_PARSER struct spa_pod *
 spa_pod_parser_deref(struct spa_pod_parser *parser, uint32_t offset, uint32_t size)
 {
     /* Cast to uint64_t to avoid wraparound.  Add 8 for the pod itself. */
@@ -78,12 +86,12 @@ spa_pod_parser_deref(struct spa_pod_parser *parser, uint32_t offset, uint32_t si
     return NULL;
 }
 
-static inline struct spa_pod *spa_pod_parser_frame(struct spa_pod_parser *parser, struct spa_pod_frame *frame)
+SPA_API_POD_PARSER struct spa_pod *spa_pod_parser_frame(struct spa_pod_parser *parser, struct spa_pod_frame *frame)
 {
     return SPA_PTROFF(parser->data, frame->offset, struct spa_pod);
 }
 
-static inline void spa_pod_parser_push(struct spa_pod_parser *parser,
+SPA_API_POD_PARSER void spa_pod_parser_push(struct spa_pod_parser *parser,
               struct spa_pod_frame *frame, const struct spa_pod *pod, uint32_t offset)
 {
     frame->pod = *pod;
@@ -93,19 +101,19 @@ static inline void spa_pod_parser_push(struct spa_pod_parser *parser,
     parser->state.frame = frame;
 }
 
-static inline struct spa_pod *spa_pod_parser_current(struct spa_pod_parser *parser)
+SPA_API_POD_PARSER struct spa_pod *spa_pod_parser_current(struct spa_pod_parser *parser)
 {
     struct spa_pod_frame *f = parser->state.frame;
     uint32_t size = f ? f->offset + SPA_POD_SIZE(&f->pod) : parser->size;
     return spa_pod_parser_deref(parser, parser->state.offset, size);
 }
 
-static inline void spa_pod_parser_advance(struct spa_pod_parser *parser, const struct spa_pod *pod)
+SPA_API_POD_PARSER void spa_pod_parser_advance(struct spa_pod_parser *parser, const struct spa_pod *pod)
 {
     parser->state.offset += SPA_ROUND_UP_N(SPA_POD_SIZE(pod), 8);
 }
 
-static inline struct spa_pod *spa_pod_parser_next(struct spa_pod_parser *parser)
+SPA_API_POD_PARSER struct spa_pod *spa_pod_parser_next(struct spa_pod_parser *parser)
 {
     struct spa_pod *pod = spa_pod_parser_current(parser);
     if (pod)
@@ -113,7 +121,7 @@ static inline struct spa_pod *spa_pod_parser_next(struct spa_pod_parser *parser)
     return pod;
 }
 
-static inline int spa_pod_parser_pop(struct spa_pod_parser *parser,
+SPA_API_POD_PARSER int spa_pod_parser_pop(struct spa_pod_parser *parser,
               struct spa_pod_frame *frame)
 {
     parser->state.frame = frame->parent;
@@ -121,7 +129,7 @@ static inline int spa_pod_parser_pop(struct spa_pod_parser *parser,
     return 0;
 }
 
-static inline int spa_pod_parser_get_bool(struct spa_pod_parser *parser, bool *value)
+SPA_API_POD_PARSER int spa_pod_parser_get_bool(struct spa_pod_parser *parser, bool *value)
 {
     int res = -EPIPE;
     const struct spa_pod *pod = spa_pod_parser_current(parser);
@@ -130,7 +138,7 @@ static inline int spa_pod_parser_get_bool(struct spa_pod_parser *parser, bool *v
     return res;
 }
 
-static inline int spa_pod_parser_get_id(struct spa_pod_parser *parser, uint32_t *value)
+SPA_API_POD_PARSER int spa_pod_parser_get_id(struct spa_pod_parser *parser, uint32_t *value)
 {
     int res = -EPIPE;
     const struct spa_pod *pod = spa_pod_parser_current(parser);
@@ -139,7 +147,7 @@ static inline int spa_pod_parser_get_id(struct spa_pod_parser *parser, uint32_t
     return res;
 }
 
-static inline int spa_pod_parser_get_int(struct spa_pod_parser *parser, int32_t *value)
+SPA_API_POD_PARSER int spa_pod_parser_get_int(struct spa_pod_parser *parser, int32_t *value)
 {
     int res = -EPIPE;
     const struct spa_pod *pod = spa_pod_parser_current(parser);
@@ -148,7 +156,7 @@ static inline int spa_pod_parser_get_int(struct spa_pod_parser *parser, int32_t
     return res;
 }
 
-static inline int spa_pod_parser_get_long(struct spa_pod_parser *parser, int64_t *value)
+SPA_API_POD_PARSER int spa_pod_parser_get_long(struct spa_pod_parser *parser, int64_t *value)
 {
     int res = -EPIPE;
     const struct spa_pod *pod = spa_pod_parser_current(parser);
@@ -157,7 +165,7 @@ static inline int spa_pod_parser_get_long(struct spa_pod_parser *parser, int64_t
     return res;
 }
 
-static inline int spa_pod_parser_get_float(struct spa_pod_parser *parser, float *value)
+SPA_API_POD_PARSER int spa_pod_parser_get_float(struct spa_pod_parser *parser, float *value)
 {
     int res = -EPIPE;
     const struct spa_pod *pod = spa_pod_parser_current(parser);
@@ -166,7 +174,7 @@ static inline int spa_pod_parser_get_float(struct spa_pod_parser *parser, float
     return res;
 }
 
-static inline int spa_pod_parser_get_double(struct spa_pod_parser *parser, double *value)
+SPA_API_POD_PARSER int spa_pod_parser_get_double(struct spa_pod_parser *parser, double *value)
 {
     int res = -EPIPE;
     const struct spa_pod *pod = spa_pod_parser_current(parser);
@@ -175,7 +183,7 @@ static inline int spa_pod_parser_get_double(struct spa_pod_parser *parser, doubl
     return res;
 }
 
-static inline int spa_pod_parser_get_string(struct spa_pod_parser *parser, const char **value)
+SPA_API_POD_PARSER int spa_pod_parser_get_string(struct spa_pod_parser *parser, const char **value)
 {
     int res = -EPIPE;
     const struct spa_pod *pod = spa_pod_parser_current(parser);
@@ -184,7 +192,7 @@ static inline int spa_pod_parser_get_string(struct spa_pod_parser *parser, const
     return res;
 }
 
-static inline int spa_pod_parser_get_bytes(struct spa_pod_parser *parser, const void **value, uint32_t *len)
+SPA_API_POD_PARSER int spa_pod_parser_get_bytes(struct spa_pod_parser *parser, const void **value, uint32_t *len)
 {
     int res = -EPIPE;
     const struct spa_pod *pod = spa_pod_parser_current(parser);
@@ -193,7 +201,7 @@ static inline int spa_pod_parser_get_bytes(struct spa_pod_parser *parser, const
     return res;
 }
 
-static inline int spa_pod_parser_get_pointer(struct spa_pod_parser *parser, uint32_t *type, const void **value)
+SPA_API_POD_PARSER int spa_pod_parser_get_pointer(struct spa_pod_parser *parser, uint32_t *type, const void **value)
 {
     int res = -EPIPE;
     const struct spa_pod *pod = spa_pod_parser_current(parser);
@@ -202,7 +210,7 @@ static inline int spa_pod_parser_get_pointer(struct spa_pod_parser *parser, uint
     return res;
 }
 
-static inline int spa_pod_parser_get_fd(struct spa_pod_parser *parser, int64_t *value)
+SPA_API_POD_PARSER int spa_pod_parser_get_fd(struct spa_pod_parser *parser, int64_t *value)
 {
     int res = -EPIPE;
     const struct spa_pod *pod = spa_pod_parser_current(parser);
@@ -211,7 +219,7 @@ static inline int spa_pod_parser_get_fd(struct spa_pod_parser *parser, int64_t *
     return res;
 }
 
-static inline int spa_pod_parser_get_rectangle(struct spa_pod_parser *parser, struct spa_rectangle *value)
+SPA_API_POD_PARSER int spa_pod_parser_get_rectangle(struct spa_pod_parser *parser, struct spa_rectangle *value)
 {
     int res = -EPIPE;
     const struct spa_pod *pod = spa_pod_parser_current(parser);
@@ -220,7 +228,7 @@ static inline int spa_pod_parser_get_rectangle(struct spa_pod_parser *parser, st
     return res;
 }
 
-static inline int spa_pod_parser_get_fraction(struct spa_pod_parser *parser, struct spa_fraction *value)
+SPA_API_POD_PARSER int spa_pod_parser_get_fraction(struct spa_pod_parser *parser, struct spa_fraction *value)
 {
     int res = -EPIPE;
     const struct spa_pod *pod = spa_pod_parser_current(parser);
@@ -229,7 +237,7 @@ static inline int spa_pod_parser_get_fraction(struct spa_pod_parser *parser, str
     return res;
 }
 
-static inline int spa_pod_parser_get_pod(struct spa_pod_parser *parser, struct spa_pod **value)
+SPA_API_POD_PARSER int spa_pod_parser_get_pod(struct spa_pod_parser *parser, struct spa_pod **value)
 {
     struct spa_pod *pod = spa_pod_parser_current(parser);
     if (pod == NULL)
@@ -238,7 +246,7 @@ static inline int spa_pod_parser_get_pod(struct spa_pod_parser *parser, struct s
     spa_pod_parser_advance(parser, pod);
     return 0;
 }
-static inline int spa_pod_parser_push_struct(struct spa_pod_parser *parser,
+SPA_API_POD_PARSER int spa_pod_parser_push_struct(struct spa_pod_parser *parser,
         struct spa_pod_frame *frame)
 {
     const struct spa_pod *pod = spa_pod_parser_current(parser);
@@ -251,7 +259,7 @@ static inline int spa_pod_parser_push_struct(struct spa_pod_parser *parser,
     return 0;
 }
 
-static inline int spa_pod_parser_push_object(struct spa_pod_parser *parser,
+SPA_API_POD_PARSER int spa_pod_parser_push_object(struct spa_pod_parser *parser,
         struct spa_pod_frame *frame, uint32_t type, uint32_t *id)
 {
     const struct spa_pod *pod = spa_pod_parser_current(parser);
@@ -268,7 +276,7 @@ static inline int spa_pod_parser_push_object(struct spa_pod_parser *parser,
     return 0;
 }
 
-static inline bool spa_pod_parser_can_collect(const struct spa_pod *pod, char type)
+SPA_API_POD_PARSER bool spa_pod_parser_can_collect(const struct spa_pod *pod, char type)
 {
     if (pod == NULL)
         return false;
@@ -443,7 +451,7 @@ do {                                            \
     }                                        \
 } while(false)
 
-static inline int spa_pod_parser_getv(struct spa_pod_parser *parser, va_list args)
+SPA_API_POD_PARSER int spa_pod_parser_getv(struct spa_pod_parser *parser, va_list args)
 {
     struct spa_pod_frame *f = parser->state.frame;
         uint32_t ftype = f ? f->pod.type : (uint32_t)SPA_TYPE_Struct;
@@ -455,7 +463,7 @@ static inline int spa_pod_parser_getv(struct spa_pod_parser *parser, va_list arg
         const struct spa_pod *pod = NULL;
         const char *format;
 
-        if (ftype == SPA_TYPE_Object) {
+        if (f && ftype == SPA_TYPE_Object) {
             uint32_t key = va_arg(args, uint32_t);
             const struct spa_pod_object *object;
 
@@ -496,7 +504,7 @@ static inline int spa_pod_parser_getv(struct spa_pod_parser *parser, va_list arg
     return count;
 }
 
-static inline int spa_pod_parser_get(struct spa_pod_parser *parser, ...)
+SPA_API_POD_PARSER int spa_pod_parser_get(struct spa_pod_parser *parser, ...)
 {
     int res;
     va_list args;
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/support/loop.h b/src/java.desktop/unix/native/libpipewire/include/spa/support/loop.h
index 4beac560b250..376ab559de31 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/support/loop.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/support/loop.h
@@ -9,10 +9,20 @@
 extern "C" {
 #endif
 
+#include 
+
 #include 
 #include 
 #include 
 
+#ifndef SPA_API_LOOP
+ #ifdef SPA_API_IMPL
+  #define SPA_API_LOOP SPA_API_IMPL
+ #else
+  #define SPA_API_LOOP static inline
+ #endif
+#endif
+
 /** \defgroup spa_loop Loop
  * Event loop interface
  */
@@ -66,19 +76,56 @@ struct spa_loop_methods {
 #define SPA_VERSION_LOOP_METHODS    0
     uint32_t version;
 
-    /** add a source to the loop */
+    /** Add a source to the loop. Must be called from the loop's own thread.
+     *
+     * \param[in] object The callbacks data.
+     * \param[in] source The source.
+     * \return 0 on success, negative errno-style value on failure.
+     */
     int (*add_source) (void *object,
                struct spa_source *source);
 
-    /** update the source io mask */
+    /** Update the source io mask. Must be called from the loop's own thread.
+     *
+     * \param[in] object The callbacks data.
+     * \param[in] source The source.
+     * \return 0 on success, negative errno-style value on failure.
+     */
     int (*update_source) (void *object,
             struct spa_source *source);
 
-    /** remove a source from the loop */
+    /** Remove a source from the loop. Must be called from the loop's own thread.
+     *
+     * \param[in] object The callbacks data.
+     * \param[in] source The source.
+     * \return 0 on success, negative errno-style value on failure.
+     */
     int (*remove_source) (void *object,
             struct spa_source *source);
 
-    /** invoke a function in the context of this loop */
+    /** Invoke a function in the context of this loop.
+     * May be called from any thread and multiple threads at the same time.
+     * If called from the loop's thread, all callbacks previously queued with
+     * invoke() will be run synchronously, which might cause unexpected
+     * reentrancy problems.
+     *
+     * \param[in] object The callbacks data.
+     * \param func The function to be invoked.
+     * \param seq An opaque sequence number. This will be made
+     *            available to func.
+     * \param[in] data Data that will be copied into the internal ring buffer and made
+     *             available to func. Because this data is copied, it is okay to
+     *             pass a pointer to a local variable, but do not pass a pointer to
+     *             an object that has identity.
+     * \param size The size of data to copy.
+     * \param block If \true, do not return until func has been called. Otherwise,
+     *              returns immediately. Passing \true does not risk a deadlock because
+     *              the data thread is never allowed to wait on any other thread.
+     * \param user_data An opaque pointer passed to func.
+     * \return `-EPIPE` if the internal ring buffer filled up,
+     *         if block is \false, 0 if seq was SPA_ID_INVALID or
+     *         seq with the ASYNC flag set
+     *         or the return value of func otherwise. */
     int (*invoke) (void *object,
                spa_invoke_func_t func,
                uint32_t seq,
@@ -88,21 +135,29 @@ struct spa_loop_methods {
                void *user_data);
 };
 
-#define spa_loop_method(o,method,version,...)                \
-({                                    \
-    int _res = -ENOTSUP;                        \
-    struct spa_loop *_o = o;                    \
-    spa_interface_call_res(&_o->iface,                \
-            struct spa_loop_methods, _res,            \
-            method, version, ##__VA_ARGS__);        \
-    _res;                                \
-})
-
-#define spa_loop_add_source(l,...)    spa_loop_method(l,add_source,0,##__VA_ARGS__)
-#define spa_loop_update_source(l,...)    spa_loop_method(l,update_source,0,##__VA_ARGS__)
-#define spa_loop_remove_source(l,...)    spa_loop_method(l,remove_source,0,##__VA_ARGS__)
-#define spa_loop_invoke(l,...)        spa_loop_method(l,invoke,0,##__VA_ARGS__)
-
+SPA_API_LOOP int spa_loop_add_source(struct spa_loop *object, struct spa_source *source)
+{
+    return spa_api_method_r(int, -ENOTSUP,
+            spa_loop, &object->iface, add_source, 0, source);
+}
+SPA_API_LOOP int spa_loop_update_source(struct spa_loop *object, struct spa_source *source)
+{
+    return spa_api_method_r(int, -ENOTSUP,
+            spa_loop, &object->iface, update_source, 0, source);
+}
+SPA_API_LOOP int spa_loop_remove_source(struct spa_loop *object, struct spa_source *source)
+{
+    return spa_api_method_r(int, -ENOTSUP,
+            spa_loop, &object->iface, remove_source, 0, source);
+}
+SPA_API_LOOP int spa_loop_invoke(struct spa_loop *object,
+        spa_invoke_func_t func, uint32_t seq, const void *data,
+        size_t size, bool block, void *user_data)
+{
+    return spa_api_method_r(int, -ENOTSUP,
+            spa_loop, &object->iface, invoke, 0, func, seq, data,
+            size, block, user_data);
+}
 
 /** Control hooks. These hooks can't be removed from their
  *  callbacks and must be removed from a safe place (when the loop
@@ -118,24 +173,42 @@ struct spa_loop_control_hooks {
     void (*after) (void *data);
 };
 
-#define spa_loop_control_hook_before(l)                            \
-({                                            \
-    struct spa_hook_list *_l = l;                            \
-    struct spa_hook *_h;                                \
-    spa_list_for_each_reverse(_h, &_l->list, link)                    \
-        spa_callbacks_call(&_h->cb, struct spa_loop_control_hooks, before, 0);    \
-})
-
-#define spa_loop_control_hook_after(l)                            \
-({                                            \
-    struct spa_hook_list *_l = l;                            \
-    struct spa_hook *_h;                                \
-    spa_list_for_each(_h, &_l->list, link)                        \
-        spa_callbacks_call(&_h->cb, struct spa_loop_control_hooks, after, 0);    \
-})
+SPA_API_LOOP void spa_loop_control_hook_before(struct spa_hook_list *l)
+{
+    struct spa_hook *h;
+    spa_list_for_each_reverse(h, &l->list, link)
+        spa_callbacks_call_fast(&h->cb, struct spa_loop_control_hooks, before, 0);
+}
+
+SPA_API_LOOP void spa_loop_control_hook_after(struct spa_hook_list *l)
+{
+    struct spa_hook *h;
+    spa_list_for_each(h, &l->list, link)
+        spa_callbacks_call_fast(&h->cb, struct spa_loop_control_hooks, after, 0);
+}
 
 /**
  * Control an event loop
+ *
+ * The event loop control function provide API to run the event loop.
+ *
+ * The below (pseudo)code is a minimal example outlining the use of the loop
+ * control:
+ * \code{.c}
+ * spa_loop_control_enter(loop);
+ * while (running) {
+ *   spa_loop_control_iterate(loop, -1);
+ * }
+ * spa_loop_control_leave(loop);
+ * \endcode
+ *
+ * It is also possible to add the loop to an existing event loop by using the
+ * spa_loop_control_get_fd() call. This fd will become readable when activity
+ * has been detected on the sources in the loop. spa_loop_control_iterate() with
+ * a 0 timeout should be called to process the pending sources.
+ *
+ * spa_loop_control_enter() and spa_loop_control_leave() should be called once
+ * from the thread that will run the iterate() function.
  */
 struct spa_loop_control_methods {
     /* the version of this structure. This can be used to expand this
@@ -143,10 +216,19 @@ struct spa_loop_control_methods {
 #define SPA_VERSION_LOOP_CONTROL_METHODS    1
     uint32_t version;
 
+    /** get the loop fd
+     * \param object the control to query
+     *
+     * Get the fd of this loop control. This fd will be readable when a
+     * source in the loop has activity. The user should call iterate()
+     * with a 0 timeout to schedule one iteration of the loop and dispatch
+     * the sources.
+     * \return the fd of the loop
+     */
     int (*get_fd) (void *object);
 
     /** Add a hook
-     * \param ctrl the control to change
+     * \param object the control to change
      * \param hooks the hooks to add
      *
      * Adds hooks to the loop controlled by \a ctrl.
@@ -157,18 +239,19 @@ struct spa_loop_control_methods {
               void *data);
 
     /** Enter a loop
-     * \param ctrl the control
+     * \param object the control
      *
-     * Start an iteration of the loop. This function should be called
-     * before calling iterate and is typically used to capture the thread
-     * that this loop will run in.
+     * This function should be called before calling iterate and is
+     * typically used to capture the thread that this loop will run in.
+     * It should ideally be called once from the thread that will run
+     * the loop.
      */
     void (*enter) (void *object);
     /** Leave a loop
-     * \param ctrl the control
+     * \param object the control
      *
-     * Ends the iteration of a loop. This should be called after calling
-     * iterate.
+     * It should ideally be called once after calling iterate when the loop
+     * will no longer be iterated from the thread that called enter().
      */
     void (*leave) (void *object);
 
@@ -194,30 +277,43 @@ struct spa_loop_control_methods {
     int (*check) (void *object);
 };
 
-#define spa_loop_control_method_v(o,method,version,...)            \
-({                                    \
-    struct spa_loop_control *_o = o;                \
-    spa_interface_call(&_o->iface,                    \
-            struct spa_loop_control_methods,        \
-            method, version, ##__VA_ARGS__);        \
-})
-
-#define spa_loop_control_method_r(o,method,version,...)            \
-({                                    \
-    int _res = -ENOTSUP;                        \
-    struct spa_loop_control *_o = o;                \
-    spa_interface_call_res(&_o->iface,                \
-            struct spa_loop_control_methods, _res,        \
-            method, version, ##__VA_ARGS__);        \
-    _res;                                \
-})
-
-#define spa_loop_control_get_fd(l)        spa_loop_control_method_r(l,get_fd,0)
-#define spa_loop_control_add_hook(l,...)    spa_loop_control_method_v(l,add_hook,0,__VA_ARGS__)
-#define spa_loop_control_enter(l)        spa_loop_control_method_v(l,enter,0)
-#define spa_loop_control_leave(l)        spa_loop_control_method_v(l,leave,0)
-#define spa_loop_control_iterate(l,...)        spa_loop_control_method_r(l,iterate,0,__VA_ARGS__)
-#define spa_loop_control_check(l)        spa_loop_control_method_r(l,check,1)
+SPA_API_LOOP int spa_loop_control_get_fd(struct spa_loop_control *object)
+{
+    return spa_api_method_r(int, -ENOTSUP,
+            spa_loop_control, &object->iface, get_fd, 0);
+}
+SPA_API_LOOP void spa_loop_control_add_hook(struct spa_loop_control *object,
+        struct spa_hook *hook, const struct spa_loop_control_hooks *hooks,
+        void *data)
+{
+    spa_api_method_v(spa_loop_control, &object->iface, add_hook, 0,
+            hook, hooks, data);
+}
+SPA_API_LOOP void spa_loop_control_enter(struct spa_loop_control *object)
+{
+    spa_api_method_v(spa_loop_control, &object->iface, enter, 0);
+}
+SPA_API_LOOP void spa_loop_control_leave(struct spa_loop_control *object)
+{
+    spa_api_method_v(spa_loop_control, &object->iface, leave, 0);
+}
+SPA_API_LOOP int spa_loop_control_iterate(struct spa_loop_control *object,
+        int timeout)
+{
+    return spa_api_method_r(int, -ENOTSUP,
+            spa_loop_control, &object->iface, iterate, 0, timeout);
+}
+SPA_API_LOOP int spa_loop_control_iterate_fast(struct spa_loop_control *object,
+        int timeout)
+{
+    return spa_api_method_fast_r(int, -ENOTSUP,
+            spa_loop_control, &object->iface, iterate, 0, timeout);
+}
+SPA_API_LOOP int spa_loop_control_check(struct spa_loop_control *object)
+{
+    return spa_api_method_r(int, -ENOTSUP,
+            spa_loop_control, &object->iface, check, 1);
+}
 
 typedef void (*spa_source_io_func_t) (void *data, int fd, uint32_t mask);
 typedef void (*spa_source_idle_func_t) (void *data);
@@ -268,44 +364,71 @@ struct spa_loop_utils_methods {
     void (*destroy_source) (void *object, struct spa_source *source);
 };
 
-#define spa_loop_utils_method_v(o,method,version,...)            \
-({                                    \
-    struct spa_loop_utils *_o = o;                    \
-    spa_interface_call(&_o->iface,                    \
-            struct spa_loop_utils_methods,            \
-            method, version, ##__VA_ARGS__);        \
-})
-
-#define spa_loop_utils_method_r(o,method,version,...)            \
-({                                    \
-    int _res = -ENOTSUP;                        \
-    struct spa_loop_utils *_o = o;                    \
-    spa_interface_call_res(&_o->iface,                \
-            struct spa_loop_utils_methods, _res,        \
-            method, version, ##__VA_ARGS__);        \
-    _res;                                \
-})
-#define spa_loop_utils_method_s(o,method,version,...)            \
-({                                    \
-    struct spa_source *_res = NULL;                    \
-    struct spa_loop_utils *_o = o;                    \
-    spa_interface_call_res(&_o->iface,                \
-            struct spa_loop_utils_methods, _res,        \
-            method, version, ##__VA_ARGS__);        \
-    _res;                                \
-})
-
-
-#define spa_loop_utils_add_io(l,...)        spa_loop_utils_method_s(l,add_io,0,__VA_ARGS__)
-#define spa_loop_utils_update_io(l,...)        spa_loop_utils_method_r(l,update_io,0,__VA_ARGS__)
-#define spa_loop_utils_add_idle(l,...)        spa_loop_utils_method_s(l,add_idle,0,__VA_ARGS__)
-#define spa_loop_utils_enable_idle(l,...)    spa_loop_utils_method_r(l,enable_idle,0,__VA_ARGS__)
-#define spa_loop_utils_add_event(l,...)        spa_loop_utils_method_s(l,add_event,0,__VA_ARGS__)
-#define spa_loop_utils_signal_event(l,...)    spa_loop_utils_method_r(l,signal_event,0,__VA_ARGS__)
-#define spa_loop_utils_add_timer(l,...)        spa_loop_utils_method_s(l,add_timer,0,__VA_ARGS__)
-#define spa_loop_utils_update_timer(l,...)    spa_loop_utils_method_r(l,update_timer,0,__VA_ARGS__)
-#define spa_loop_utils_add_signal(l,...)    spa_loop_utils_method_s(l,add_signal,0,__VA_ARGS__)
-#define spa_loop_utils_destroy_source(l,...)    spa_loop_utils_method_v(l,destroy_source,0,__VA_ARGS__)
+SPA_API_LOOP struct spa_source *
+spa_loop_utils_add_io(struct spa_loop_utils *object, int fd, uint32_t mask,
+        bool close, spa_source_io_func_t func, void *data)
+{
+    return spa_api_method_r(struct spa_source *, NULL,
+            spa_loop_utils, &object->iface, add_io, 0, fd, mask, close, func, data);
+}
+SPA_API_LOOP int spa_loop_utils_update_io(struct spa_loop_utils *object,
+        struct spa_source *source, uint32_t mask)
+{
+    return spa_api_method_r(int, -ENOTSUP,
+            spa_loop_utils, &object->iface, update_io, 0, source, mask);
+}
+SPA_API_LOOP struct spa_source *
+spa_loop_utils_add_idle(struct spa_loop_utils *object, bool enabled,
+        spa_source_idle_func_t func, void *data)
+{
+    return spa_api_method_r(struct spa_source *, NULL,
+            spa_loop_utils, &object->iface, add_idle, 0, enabled, func, data);
+}
+SPA_API_LOOP int spa_loop_utils_enable_idle(struct spa_loop_utils *object,
+        struct spa_source *source, bool enabled)
+{
+    return spa_api_method_r(int, -ENOTSUP,
+            spa_loop_utils, &object->iface, enable_idle, 0, source, enabled);
+}
+SPA_API_LOOP struct spa_source *
+spa_loop_utils_add_event(struct spa_loop_utils *object, spa_source_event_func_t func, void *data)
+{
+    return spa_api_method_r(struct spa_source *, NULL,
+            spa_loop_utils, &object->iface, add_event, 0, func, data);
+}
+SPA_API_LOOP int spa_loop_utils_signal_event(struct spa_loop_utils *object,
+        struct spa_source *source)
+{
+    return spa_api_method_r(int, -ENOTSUP,
+            spa_loop_utils, &object->iface, signal_event, 0, source);
+}
+SPA_API_LOOP struct spa_source *
+spa_loop_utils_add_timer(struct spa_loop_utils *object, spa_source_timer_func_t func, void *data)
+{
+    return spa_api_method_r(struct spa_source *, NULL,
+            spa_loop_utils, &object->iface, add_timer, 0, func, data);
+}
+SPA_API_LOOP int spa_loop_utils_update_timer(struct spa_loop_utils *object,
+        struct spa_source *source, struct timespec *value,
+        struct timespec *interval, bool absolute)
+{
+    return spa_api_method_r(int, -ENOTSUP,
+            spa_loop_utils, &object->iface, update_timer, 0, source,
+            value, interval, absolute);
+}
+SPA_API_LOOP struct spa_source *
+spa_loop_utils_add_signal(struct spa_loop_utils *object, int signal_number,
+        spa_source_signal_func_t func, void *data)
+{
+    return spa_api_method_r(struct spa_source *, NULL,
+            spa_loop_utils, &object->iface, add_signal, 0,
+            signal_number, func, data);
+}
+SPA_API_LOOP void spa_loop_utils_destroy_source(struct spa_loop_utils *object,
+        struct spa_source *source)
+{
+    spa_api_method_v(spa_loop_utils, &object->iface, destroy_source, 0, source);
+}
 
 /**
  * \}
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/support/system.h b/src/java.desktop/unix/native/libpipewire/include/spa/support/system.h
index 6bd9dcd01598..fb58dc337b63 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/support/system.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/support/system.h
@@ -12,11 +12,20 @@ extern "C" {
 struct itimerspec;
 
 #include 
+#include 
 #include 
 
 #include 
 #include 
 
+#ifndef SPA_API_SYSTEM
+ #ifdef SPA_API_IMPL
+  #define SPA_API_SYSTEM SPA_API_IMPL
+ #else
+  #define SPA_API_SYSTEM static inline
+ #endif
+#endif
+
 /** \defgroup spa_system System
  * I/O, clock, polling, timer, and signal interfaces
  */
@@ -97,42 +106,106 @@ struct spa_system_methods {
     int (*signalfd_read) (void *object, int fd, int *signal);
 };
 
-#define spa_system_method_r(o,method,version,...)            \
-({                                    \
-    volatile int _res = -ENOTSUP;                    \
-    struct spa_system *_o = o;                    \
-    spa_interface_call_res(&_o->iface,                \
-            struct spa_system_methods, _res,        \
-            method, version, ##__VA_ARGS__);        \
-    _res;                                \
-})
-
-
-#define spa_system_read(s,...)            spa_system_method_r(s,read,0,__VA_ARGS__)
-#define spa_system_write(s,...)            spa_system_method_r(s,write,0,__VA_ARGS__)
-#define spa_system_ioctl(s,...)            spa_system_method_r(s,ioctl,0,__VA_ARGS__)
-#define spa_system_close(s,...)            spa_system_method_r(s,close,0,__VA_ARGS__)
-
-#define spa_system_clock_gettime(s,...)        spa_system_method_r(s,clock_gettime,0,__VA_ARGS__)
-#define spa_system_clock_getres(s,...)        spa_system_method_r(s,clock_getres,0,__VA_ARGS__)
-
-#define spa_system_pollfd_create(s,...)        spa_system_method_r(s,pollfd_create,0,__VA_ARGS__)
-#define spa_system_pollfd_add(s,...)        spa_system_method_r(s,pollfd_add,0,__VA_ARGS__)
-#define spa_system_pollfd_mod(s,...)        spa_system_method_r(s,pollfd_mod,0,__VA_ARGS__)
-#define spa_system_pollfd_del(s,...)        spa_system_method_r(s,pollfd_del,0,__VA_ARGS__)
-#define spa_system_pollfd_wait(s,...)        spa_system_method_r(s,pollfd_wait,0,__VA_ARGS__)
-
-#define spa_system_timerfd_create(s,...)    spa_system_method_r(s,timerfd_create,0,__VA_ARGS__)
-#define spa_system_timerfd_settime(s,...)    spa_system_method_r(s,timerfd_settime,0,__VA_ARGS__)
-#define spa_system_timerfd_gettime(s,...)    spa_system_method_r(s,timerfd_gettime,0,__VA_ARGS__)
-#define spa_system_timerfd_read(s,...)        spa_system_method_r(s,timerfd_read,0,__VA_ARGS__)
-
-#define spa_system_eventfd_create(s,...)    spa_system_method_r(s,eventfd_create,0,__VA_ARGS__)
-#define spa_system_eventfd_write(s,...)        spa_system_method_r(s,eventfd_write,0,__VA_ARGS__)
-#define spa_system_eventfd_read(s,...)        spa_system_method_r(s,eventfd_read,0,__VA_ARGS__)
-
-#define spa_system_signalfd_create(s,...)    spa_system_method_r(s,signalfd_create,0,__VA_ARGS__)
-#define spa_system_signalfd_read(s,...)        spa_system_method_r(s,signalfd_read,0,__VA_ARGS__)
+SPA_API_SYSTEM ssize_t spa_system_read(struct spa_system *object, int fd, void *buf, size_t count)
+{
+    return spa_api_method_fast_r(ssize_t, -ENOTSUP, spa_system, &object->iface, read, 0, fd, buf, count);
+}
+SPA_API_SYSTEM ssize_t spa_system_write(struct spa_system *object, int fd, const void *buf, size_t count)
+{
+    return spa_api_method_fast_r(ssize_t, -ENOTSUP, spa_system, &object->iface, write, 0, fd, buf, count);
+}
+#define spa_system_ioctl(object,fd,request,...)    \
+    spa_api_method_fast_r(int, -ENOTSUP, spa_system, &object->iface, ioctl, 0, fd, request, ##__VA_ARGS__)
+
+SPA_API_SYSTEM int spa_system_close(struct spa_system *object, int fd)
+{
+    return spa_api_method_fast_r(int, -ENOTSUP, spa_system, &object->iface, close, 0, fd);
+}
+SPA_API_SYSTEM int spa_system_clock_gettime(struct spa_system *object,
+            int clockid, struct timespec *value)
+{
+    return spa_api_method_fast_r(int, -ENOTSUP, spa_system, &object->iface, clock_gettime, 0, clockid, value);
+}
+SPA_API_SYSTEM int spa_system_clock_getres(struct spa_system *object,
+            int clockid, struct timespec *res)
+{
+    return spa_api_method_fast_r(int, -ENOTSUP, spa_system, &object->iface, clock_getres, 0, clockid, res);
+}
+
+SPA_API_SYSTEM int spa_system_pollfd_create(struct spa_system *object, int flags)
+{
+    return spa_api_method_fast_r(int, -ENOTSUP, spa_system, &object->iface, pollfd_create, 0, flags);
+}
+SPA_API_SYSTEM int spa_system_pollfd_add(struct spa_system *object, int pfd, int fd, uint32_t events, void *data)
+{
+    return spa_api_method_fast_r(int, -ENOTSUP, spa_system, &object->iface, pollfd_add, 0, pfd, fd, events, data);
+}
+SPA_API_SYSTEM int spa_system_pollfd_mod(struct spa_system *object, int pfd, int fd, uint32_t events, void *data)
+{
+    return spa_api_method_fast_r(int, -ENOTSUP, spa_system, &object->iface, pollfd_mod, 0, pfd, fd, events, data);
+}
+SPA_API_SYSTEM int spa_system_pollfd_del(struct spa_system *object, int pfd, int fd)
+{
+    return spa_api_method_fast_r(int, -ENOTSUP, spa_system, &object->iface, pollfd_del, 0, pfd, fd);
+}
+SPA_API_SYSTEM int spa_system_pollfd_wait(struct spa_system *object, int pfd,
+            struct spa_poll_event *ev, int n_ev, int timeout)
+{
+    return spa_api_method_fast_r(int, -ENOTSUP, spa_system, &object->iface, pollfd_wait, 0, pfd, ev, n_ev, timeout);
+}
+
+SPA_API_SYSTEM int spa_system_timerfd_create(struct spa_system *object, int clockid, int flags)
+{
+    return spa_api_method_fast_r(int, -ENOTSUP, spa_system, &object->iface, timerfd_create, 0, clockid, flags);
+}
+
+SPA_API_SYSTEM int spa_system_timerfd_settime(struct spa_system *object,
+            int fd, int flags,
+            const struct itimerspec *new_value,
+            struct itimerspec *old_value)
+{
+    return spa_api_method_fast_r(int, -ENOTSUP, spa_system, &object->iface, timerfd_settime, 0,
+            fd, flags, new_value, old_value);
+}
+
+SPA_API_SYSTEM int spa_system_timerfd_gettime(struct spa_system *object,
+            int fd, struct itimerspec *curr_value)
+{
+    return spa_api_method_fast_r(int, -ENOTSUP, spa_system, &object->iface, timerfd_gettime, 0,
+            fd, curr_value);
+}
+SPA_API_SYSTEM int spa_system_timerfd_read(struct spa_system *object, int fd, uint64_t *expirations)
+{
+    return spa_api_method_fast_r(int, -ENOTSUP, spa_system, &object->iface, timerfd_read, 0,
+            fd, expirations);
+}
+
+SPA_API_SYSTEM int spa_system_eventfd_create(struct spa_system *object, int flags)
+{
+    return spa_api_method_fast_r(int, -ENOTSUP, spa_system, &object->iface, eventfd_create, 0, flags);
+}
+SPA_API_SYSTEM int spa_system_eventfd_write(struct spa_system *object, int fd, uint64_t count)
+{
+    return spa_api_method_fast_r(int, -ENOTSUP, spa_system, &object->iface, eventfd_write, 0,
+            fd, count);
+}
+SPA_API_SYSTEM int spa_system_eventfd_read(struct spa_system *object, int fd, uint64_t *count)
+{
+    return spa_api_method_fast_r(int, -ENOTSUP, spa_system, &object->iface, eventfd_read, 0,
+            fd, count);
+}
+
+SPA_API_SYSTEM int spa_system_signalfd_create(struct spa_system *object, int signal, int flags)
+{
+    return spa_api_method_fast_r(int, -ENOTSUP, spa_system, &object->iface, signalfd_create, 0,
+            signal, flags);
+}
+
+SPA_API_SYSTEM int spa_system_signalfd_read(struct spa_system *object, int fd, int *signal)
+{
+    return spa_api_method_fast_r(int, -ENOTSUP, spa_system, &object->iface, signalfd_read, 0,
+            fd, signal);
+}
 
 /**
  * \}
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/utils/cleanup.h b/src/java.desktop/unix/native/libpipewire/include/spa/utils/cleanup.h
new file mode 100644
index 000000000000..944907ccffbd
--- /dev/null
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/utils/cleanup.h
@@ -0,0 +1,124 @@
+/* Simple Plugin API */
+/* SPDX-FileCopyrightText: Copyright © 2023 PipeWire authors */
+/* SPDX-License-Identifier: MIT */
+
+#ifndef SPA_UTILS_CLEANUP_H
+#define SPA_UTILS_CLEANUP_H
+
+#define spa_exchange(var, new_value) \
+__extension__ ({ \
+    __typeof__(var) *_ptr_ = &(var); \
+    __typeof__(var) _old_value_ = *_ptr_; \
+    *_ptr_ = (new_value); \
+    _old_value_; \
+})
+
+/* ========================================================================== */
+
+#if __GNUC__ >= 10 || defined(__clang__)
+#define spa_steal_ptr(ptr) ((__typeof__(*(ptr)) *) spa_exchange((ptr), NULL))
+#else
+#define spa_steal_ptr(ptr) spa_exchange((ptr), NULL)
+#endif
+
+#define spa_clear_ptr(ptr, destructor) \
+__extension__ ({ \
+    __typeof__(ptr) _old_value = spa_steal_ptr(ptr); \
+    if (_old_value) \
+        destructor(_old_value); \
+    (void) 0; \
+})
+
+/* ========================================================================== */
+
+#include 
+#include 
+
+#define spa_steal_fd(fd) spa_exchange((fd), -1)
+
+#define spa_clear_fd(fd) \
+__extension__ ({ \
+    int _old_value = spa_steal_fd(fd), _res = 0; \
+    if (_old_value >= 0) \
+        _res = close(_old_value); \
+    _res; \
+})
+
+/* ========================================================================== */
+
+#if defined(__has_attribute) && __has_attribute(__cleanup__)
+
+#define spa_cleanup(func) __attribute__((__cleanup__(func)))
+
+#define SPA_DEFINE_AUTO_CLEANUP(name, type, ...) \
+typedef __typeof__(type) _spa_auto_cleanup_type_ ## name; \
+static inline void _spa_auto_cleanup_func_ ## name (__typeof__(type) *thing) \
+{ \
+    int _save_errno = errno; \
+    __VA_ARGS__ \
+    errno = _save_errno; \
+}
+
+#define spa_auto(name) \
+    spa_cleanup(_spa_auto_cleanup_func_ ## name) \
+    _spa_auto_cleanup_type_ ## name
+
+#define SPA_DEFINE_AUTOPTR_CLEANUP(name, type, ...) \
+typedef __typeof__(type) * _spa_autoptr_cleanup_type_ ## name; \
+static inline void _spa_autoptr_cleanup_func_ ## name (__typeof__(type) **thing) \
+{ \
+    int _save_errno = errno; \
+    __VA_ARGS__ \
+    errno = _save_errno; \
+}
+
+#define spa_autoptr(name) \
+    spa_cleanup(_spa_autoptr_cleanup_func_ ## name) \
+    _spa_autoptr_cleanup_type_ ## name
+
+/* ========================================================================== */
+
+#include 
+
+static inline void _spa_autofree_cleanup_func(void *p)
+{
+    int save_errno = errno;
+    free(*(void **) p);
+    errno = save_errno;
+}
+#define spa_autofree spa_cleanup(_spa_autofree_cleanup_func)
+
+/* ========================================================================== */
+
+static inline void _spa_autoclose_cleanup_func(int *fd)
+{
+    int save_errno = errno;
+    spa_clear_fd(*fd);
+    errno = save_errno;
+}
+#define spa_autoclose spa_cleanup(_spa_autoclose_cleanup_func)
+
+/* ========================================================================== */
+
+#include 
+
+SPA_DEFINE_AUTOPTR_CLEANUP(FILE, FILE, {
+    spa_clear_ptr(*thing, fclose);
+})
+
+/* ========================================================================== */
+
+#include 
+
+SPA_DEFINE_AUTOPTR_CLEANUP(DIR, DIR, {
+    spa_clear_ptr(*thing, closedir);
+})
+
+#else
+
+#define SPA_DEFINE_AUTO_CLEANUP(name, type, ...)
+#define SPA_DEFINE_AUTOPTR_CLEANUP(name, type, ...)
+
+#endif
+
+#endif /* SPA_UTILS_CLEANUP_H */
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/utils/defs.h b/src/java.desktop/unix/native/libpipewire/include/spa/utils/defs.h
index 66c238987d0a..ace677015cad 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/utils/defs.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/utils/defs.h
@@ -9,20 +9,31 @@
 extern "C" {
 # if __cplusplus >= 201103L
 #  define SPA_STATIC_ASSERT_IMPL(expr, msg, ...) static_assert(expr, msg)
+#  define SPA_ALIGNOF alignof
 # endif
+#elif __STDC_VERSION__ >= 202311L
+#  define SPA_STATIC_ASSERT_IMPL(expr, msg, ...) static_assert(expr, msg)
+#  define SPA_ALIGNOF alignof
 #else
 # include 
 # if __STDC_VERSION__ >= 201112L
 #  define SPA_STATIC_ASSERT_IMPL(expr, msg, ...) _Static_assert(expr, msg)
+#  define SPA_ALIGNOF _Alignof
 # endif
 #endif
 #ifndef SPA_STATIC_ASSERT_IMPL
 #define SPA_STATIC_ASSERT_IMPL(expr, ...) \
     ((void)sizeof(struct { int spa_static_assertion_failed : 2 * !!(expr) - 1; }))
 #endif
+#ifndef SPA_ALIGNOF
+#define SPA_ALIGNOF __alignof__
+#endif
 
 #define SPA_STATIC_ASSERT(expr, ...) SPA_STATIC_ASSERT_IMPL(expr, ## __VA_ARGS__, "`" #expr "` evaluated to false")
 
+#define SPA_CONCAT_NOEXPAND(a, b) a ## b
+#define SPA_CONCAT(a, b) SPA_CONCAT_NOEXPAND(a, b)
+
 #include 
 #include 
 #include 
@@ -122,10 +133,10 @@ struct spa_fraction {
  * ```
  */
 #define SPA_FOR_EACH_ELEMENT(arr, ptr) \
-    for ((ptr) = arr; (void*)(ptr) < SPA_PTROFF(arr, sizeof(arr), void); (ptr)++)
+    for ((ptr) = arr; (ptr) < (arr) + SPA_N_ELEMENTS(arr); (ptr)++)
 
 #define SPA_FOR_EACH_ELEMENT_VAR(arr, var) \
-    for (__typeof__((arr)[0])* var = arr; (void*)(var) < SPA_PTROFF(arr, sizeof(arr), void); (var)++)
+    for (__typeof__((arr)[0])* var = arr; (var) < (arr) + SPA_N_ELEMENTS(arr); (var)++)
 
 #define SPA_ABS(a)            \
 ({                    \
@@ -156,6 +167,10 @@ struct spa_fraction {
 ({                            \
     fminf(fmaxf(v, low), high);            \
 })
+#define SPA_CLAMPD(v,low,high)                \
+({                            \
+    fmin(fmax(v, low), high);            \
+})
 
 
 #define SPA_SWAP(a,b)                    \
@@ -171,6 +186,16 @@ struct spa_fraction {
     x;                \
 })
 
+/** 3-way comparison. NaN > NaN and NaN > finite numbers */
+#define SPA_CMP(a, b)                    \
+({                            \
+    __typeof__(a) _a = (a);                \
+    __typeof__(b) _b = (b);                \
+    (_a > _b) ? 1 : (_a == _b) ? 0 : (_a < _b) ? -1 \
+        : (_a == _a) ? -1 : (_b == _b) ? 1     \
+        : 1;                    \
+})
+
 /**
  * Return the address (buffer + offset) as pointer of \a type
  */
@@ -178,7 +203,6 @@ struct spa_fraction {
 #define SPA_PTROFF_ALIGN(ptr_,offset_,alignment_,type_) \
    SPA_PTR_ALIGN(SPA_PTROFF(ptr_,offset_,type_),alignment_,type_)
 
-
 /**
  * Deprecated, use SPA_PTROFF and SPA_PTROFF_ALIGN instead
  */
@@ -189,9 +213,6 @@ struct spa_fraction {
 
 #define SPA_PTRDIFF(p1,p2) ((intptr_t)(p1) - (intptr_t)(p2))
 
-#define SPA_PTR_TO_INT(p) ((int) ((intptr_t) (p)))
-#define SPA_INT_TO_PTR(u) ((void*) ((intptr_t) (u)))
-
 #define SPA_PTR_TO_UINT32(p) ((uint32_t) ((uintptr_t) (p)))
 #define SPA_UINT32_TO_PTR(u) ((void*) ((uintptr_t) (u)))
 
@@ -233,6 +254,20 @@ struct spa_fraction {
 #define SPA_WARN_UNUSED_RESULT
 #endif
 
+#ifndef SPA_API_IMPL
+#define SPA_API_PROTO static inline
+#define SPA_API_IMPL static inline
+#endif
+
+#ifndef SPA_API_UTILS_DEFS
+ #ifdef SPA_API_IMPL
+  #define SPA_API_UTILS_DEFS SPA_API_IMPL
+ #else
+  #define SPA_API_UTILS_DEFS static inline
+ #endif
+#endif
+
+
 #if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
 #define SPA_RESTRICT restrict
 #elif defined(__GNUC__) && __GNUC__ >= 4
@@ -265,7 +300,7 @@ struct spa_fraction {
 })
 
 
-#define SPA_PTR_ALIGNMENT(p,align)    ((intptr_t)(p) & ((align)-1))
+#define SPA_PTR_ALIGNMENT(p,align)    ((uintptr_t)(p) & ((align)-1))
 #define SPA_IS_ALIGNED(p,align)        (SPA_PTR_ALIGNMENT(p,align) == 0)
 #define SPA_PTR_ALIGN(p,align,type)    ((type*)SPA_ROUND_UP_N((intptr_t)(p), (intptr_t)(align)))
 
@@ -279,9 +314,51 @@ struct spa_fraction {
 #endif
 #endif
 
+SPA_API_UTILS_DEFS bool spa_ptrinside(const void *p1, size_t s1, const void *p2, size_t s2,
+                                 size_t *remaining)
+{
+    if (SPA_LIKELY((uintptr_t)p1 <= (uintptr_t)p2 && s2 <= s1 &&
+                   (uintptr_t)p2 - (uintptr_t)p1 <= s1 - s2)) {
+        if (remaining != NULL)
+            *remaining = ((uintptr_t)p1 + s1) - ((uintptr_t)p2 + s2);
+        return true;
+    } else {
+        if (remaining != NULL)
+            *remaining = 0;
+        return false;
+    }
+}
+
+SPA_API_UTILS_DEFS bool spa_ptr_inside_and_aligned(const void *p1, size_t s1,
+                                              const void *p2, size_t s2, size_t align,
+                                              size_t *remaining)
+{
+    if (SPA_IS_ALIGNED(p2, align)) {
+        return spa_ptrinside(p1, s1, p2, s2, remaining);
+    } else {
+        if (remaining != NULL)
+            *remaining = 0;
+        return false;
+    }
+}
+
+#define spa_ptr_type_inside(p1, s1, p2, type, remaining) \
+    spa_ptr_inside_and_aligned(p1, s1, p2, sizeof(type), SPA_ALIGNOF(type), remaining)
+
+#define SPA_PTR_TO_INT(p) ((int) ((intptr_t) (p)))
+#define SPA_INT_TO_PTR(u) ((void*) ((intptr_t) (u)))
+
 #define SPA_STRINGIFY_1(...)    #__VA_ARGS__
 #define SPA_STRINGIFY(...)    SPA_STRINGIFY_1(__VA_ARGS__)
 
+struct spa_error_location {
+    int line;
+    int col;
+    size_t len;
+    const char *location;
+    const char *reason;
+};
+
 #define spa_return_if_fail(expr)                    \
     do {                                \
         if (SPA_UNLIKELY(!(expr))) {                \
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/utils/dict.h b/src/java.desktop/unix/native/libpipewire/include/spa/utils/dict.h
index f34cd21f8407..d9258a5fe1c4 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/utils/dict.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/utils/dict.h
@@ -13,6 +13,14 @@ extern "C" {
 
 #include 
 
+#ifndef SPA_API_DICT
+ #ifdef SPA_API_IMPL
+  #define SPA_API_DICT SPA_API_IMPL
+ #else
+  #define SPA_API_DICT static inline
+ #endif
+#endif
+
 /**
  * \defgroup spa_dict Dictionary
  * Dictionary data structure
@@ -28,7 +36,8 @@ struct spa_dict_item {
     const char *value;
 };
 
-#define SPA_DICT_ITEM_INIT(key,value) ((struct spa_dict_item) { (key), (value) })
+#define SPA_DICT_ITEM(key,value) ((struct spa_dict_item) { (key), (value) })
+#define SPA_DICT_ITEM_INIT(key,value) SPA_DICT_ITEM(key,value)
 
 struct spa_dict {
 #define SPA_DICT_FLAG_SORTED    (1<<0)        /**< items are sorted */
@@ -37,22 +46,26 @@ struct spa_dict {
     const struct spa_dict_item *items;
 };
 
-#define SPA_DICT_INIT(items,n_items) ((struct spa_dict) { 0, (n_items), (items) })
-#define SPA_DICT_INIT_ARRAY(items) ((struct spa_dict) { 0, SPA_N_ELEMENTS(items), (items) })
+#define SPA_DICT(items,n_items) ((struct spa_dict) { 0, (n_items), (items) })
+#define SPA_DICT_ARRAY(items) SPA_DICT((items),SPA_N_ELEMENTS(items))
+#define SPA_DICT_ITEMS(...) SPA_DICT_ARRAY(((struct spa_dict_item[]) { __VA_ARGS__}))
+
+#define SPA_DICT_INIT(items,n_items) SPA_DICT(items,n_items)
+#define SPA_DICT_INIT_ARRAY(items) SPA_DICT_ARRAY(items)
 
 #define spa_dict_for_each(item, dict)                \
     for ((item) = (dict)->items;                \
          (item) < &(dict)->items[(dict)->n_items];        \
          (item)++)
 
-static inline int spa_dict_item_compare(const void *i1, const void *i2)
+SPA_API_DICT int spa_dict_item_compare(const void *i1, const void *i2)
 {
     const struct spa_dict_item *it1 = (const struct spa_dict_item *)i1,
           *it2 = (const struct spa_dict_item *)i2;
     return strcmp(it1->key, it2->key);
 }
 
-static inline void spa_dict_qsort(struct spa_dict *dict)
+SPA_API_DICT void spa_dict_qsort(struct spa_dict *dict)
 {
     if (dict->n_items > 0)
         qsort((void*)dict->items, dict->n_items, sizeof(struct spa_dict_item),
@@ -60,7 +73,7 @@ static inline void spa_dict_qsort(struct spa_dict *dict)
     SPA_FLAG_SET(dict->flags, SPA_DICT_FLAG_SORTED);
 }
 
-static inline const struct spa_dict_item *spa_dict_lookup_item(const struct spa_dict *dict,
+SPA_API_DICT const struct spa_dict_item *spa_dict_lookup_item(const struct spa_dict *dict,
                                    const char *key)
 {
     const struct spa_dict_item *item;
@@ -83,7 +96,7 @@ static inline const struct spa_dict_item *spa_dict_lookup_item(const struct spa_
     return NULL;
 }
 
-static inline const char *spa_dict_lookup(const struct spa_dict *dict, const char *key)
+SPA_API_DICT const char *spa_dict_lookup(const struct spa_dict *dict, const char *key)
 {
     const struct spa_dict_item *item = spa_dict_lookup_item(dict, key);
     return item ? item->value : NULL;
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/utils/endian.h b/src/java.desktop/unix/native/libpipewire/include/spa/utils/endian.h
new file mode 100644
index 000000000000..0a8f62c73ce7
--- /dev/null
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/utils/endian.h
@@ -0,0 +1,30 @@
+/* Spa */
+/* SPDX-FileCopyrightText: Copyright © 2019 Wim Taymans */
+/* SPDX-License-Identifier: MIT */
+
+#ifndef SPA_ENDIAN_H
+#define SPA_ENDIAN_H
+
+#if defined(__FreeBSD__) || defined(__MidnightBSD__)
+#include 
+#define bswap_16 bswap16
+#define bswap_32 bswap32
+#define bswap_64 bswap64
+#elif defined(_MSC_VER) && defined(_WIN32)
+#include 
+#define __LITTLE_ENDIAN 1234
+#define __BIG_ENDIAN 4321
+#define __BYTE_ORDER __LITTLE_ENDIAN
+#define bswap_16 _byteswap_ushort
+#define bswap_32 _byteswap_ulong
+#define bswap_64 _byteswap_uint64
+#elif defined(AIX)
+#include 
+#define __BIG_ENDIAN      BIG_ENDIAN
+#define __BYTE_ORDER      BIG_ENDIAN
+#else
+#include 
+#include 
+#endif
+
+#endif /* SPA_ENDIAN_H */
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/utils/enum-types.h b/src/java.desktop/unix/native/libpipewire/include/spa/utils/enum-types.h
index b374995b5cf1..c1313f0390ef 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/utils/enum-types.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/utils/enum-types.h
@@ -10,6 +10,12 @@ extern "C" {
 #endif
 
 #include 
+#include 
+
+/**
+ * \addtogroup spa_types
+ * \{
+ */
 
 #define SPA_TYPE_INFO_Direction            SPA_TYPE_INFO_ENUM_BASE "Direction"
 #define SPA_TYPE_INFO_DIRECTION_BASE        SPA_TYPE_INFO_Direction ":"
@@ -20,8 +26,6 @@ static const struct spa_type_info spa_type_direction[] = {
     { 0, 0, NULL, NULL }
 };
 
-#include 
-
 #define SPA_TYPE_INFO_Choice            SPA_TYPE_INFO_ENUM_BASE "Choice"
 #define SPA_TYPE_INFO_CHOICE_BASE        SPA_TYPE_INFO_Choice ":"
 
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/utils/hook.h b/src/java.desktop/unix/native/libpipewire/include/spa/utils/hook.h
index 81fc07b8a05d..566433bf8de2 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/utils/hook.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/utils/hook.h
@@ -12,6 +12,14 @@ extern "C" {
 #include 
 #include 
 
+#ifndef SPA_API_HOOK
+ #ifdef SPA_API_IMPL
+  #define SPA_API_HOOK SPA_API_IMPL
+ #else
+  #define SPA_API_HOOK static inline
+ #endif
+#endif
+
 /** \defgroup spa_interfaces Interfaces
  *
  * \brief Generic implementation of implementation-independent interfaces
@@ -158,10 +166,18 @@ struct spa_interface {
     const type *_f = (const type *) (callbacks)->funcs;            \
     bool _res = SPA_CALLBACK_CHECK(_f,method,vers);                \
     if (SPA_LIKELY(_res))                            \
-        _f->method((callbacks)->data, ## __VA_ARGS__);            \
+        (_f->method)((callbacks)->data, ## __VA_ARGS__);        \
     _res;                                    \
 })
 
+#define spa_callbacks_call_fast(callbacks,type,method,vers,...)            \
+({                                        \
+    const type *_f = (const type *) (callbacks)->funcs;            \
+    (_f->method)((callbacks)->data, ## __VA_ARGS__);            \
+    true;                                    \
+})
+
+
 /**
  * True if the \a callbacks are of version \a vers, false otherwise
  */
@@ -191,9 +207,14 @@ struct spa_interface {
 ({                                        \
     const type *_f = (const type *) (callbacks)->funcs;            \
     if (SPA_LIKELY(SPA_CALLBACK_CHECK(_f,method,vers)))            \
-        res = _f->method((callbacks)->data, ## __VA_ARGS__);        \
+        res = (_f->method)((callbacks)->data, ## __VA_ARGS__);        \
     res;                                    \
 })
+#define spa_callbacks_call_fast_res(callbacks,type,res,method,vers,...)        \
+({                                        \
+    const type *_f = (const type *) (callbacks)->funcs;            \
+    res = (_f->method)((callbacks)->data, ## __VA_ARGS__);            \
+})
 
 /**
  * True if the \a iface's callbacks are of version \a vers, false otherwise
@@ -216,6 +237,9 @@ struct spa_interface {
 #define spa_interface_call(iface,method_type,method,vers,...)            \
     spa_callbacks_call(&(iface)->cb,method_type,method,vers,##__VA_ARGS__)
 
+#define spa_interface_call_fast(iface,method_type,method,vers,...)        \
+    spa_callbacks_call_fast(&(iface)->cb,method_type,method,vers,##__VA_ARGS__)
+
 /**
  * Invoke method named \a method in the callbacks on the given interface object.
  * The \a method_type defines the type of the method struct, not the interface
@@ -226,6 +250,76 @@ struct spa_interface {
 #define spa_interface_call_res(iface,method_type,res,method,vers,...)            \
     spa_callbacks_call_res(&(iface)->cb,method_type,res,method,vers,##__VA_ARGS__)
 
+#define spa_interface_call_fast_res(iface,method_type,res,method,vers,...)        \
+    spa_callbacks_call_fast_res(&(iface)->cb,method_type,res,method,vers,##__VA_ARGS__)
+
+
+#define spa_api_func_v(o,method,version,...)                \
+({                                    \
+    if (SPA_LIKELY(SPA_CALLBACK_CHECK(o,method,version)))        \
+        ((o)->method)(o, ##__VA_ARGS__);            \
+})
+#define spa_api_func_r(rtype,def,o,method,version,...)            \
+({                                    \
+    rtype _res = def;                        \
+    if (SPA_LIKELY(SPA_CALLBACK_CHECK(o,method,version)))        \
+        _res = ((o)->method)(o, ##__VA_ARGS__);            \
+    _res;                                \
+})
+#define spa_api_func_fast(o,method,...)                    \
+({                                    \
+    ((o)->method)(o, ##__VA_ARGS__);                \
+})
+
+#define spa_api_method_v(type,o,method,version,...)            \
+({                                    \
+    struct spa_interface *_i = o;            \
+    spa_interface_call(_i, struct type ##_methods,            \
+            method, version, ##__VA_ARGS__);        \
+})
+#define spa_api_method_r(rtype,def,type,o,method,version,...)        \
+({                                    \
+    rtype _res = def;                        \
+    struct spa_interface *_i = o;            \
+    spa_interface_call_res(_i, struct type ##_methods,        \
+            _res, method, version, ##__VA_ARGS__);        \
+    _res;                                \
+})
+#define spa_api_method_null_v(type,co,o,method,version,...)        \
+({                                    \
+    struct type *_co = co;                        \
+    if (SPA_LIKELY(_co != NULL)) {                    \
+        struct spa_interface *_i = o;                \
+        spa_interface_call(_i, struct type ##_methods,        \
+            method, version, ##__VA_ARGS__);        \
+    }                                \
+})
+#define spa_api_method_null_r(rtype,def,type,co,o,method,version,...)    \
+({                                    \
+    rtype _res = def;                        \
+    struct type *_co = co;                        \
+    if (SPA_LIKELY(_co != NULL)) {                    \
+        struct spa_interface *_i = o;                \
+        spa_interface_call_res(_i, struct type ##_methods,    \
+                _res, method, version, ##__VA_ARGS__);    \
+    }                                \
+    _res;                                \
+})
+#define spa_api_method_fast_v(type,o,method,version,...)        \
+({                                    \
+    struct spa_interface *_i = o;                    \
+    spa_interface_call_fast(_i, struct type ##_methods,        \
+            method, version, ##__VA_ARGS__);        \
+})
+#define spa_api_method_fast_r(rtype,def,type,o,method,version,...)    \
+({                                    \
+    rtype _res = def;                        \
+    struct spa_interface *_i = o;                    \
+    spa_interface_call_fast_res(_i, struct type ##_methods,        \
+            _res, method, version, ##__VA_ARGS__);        \
+    _res;                                \
+})
+
 /**
  * \}
  */
@@ -329,18 +423,18 @@ struct spa_hook {
 };
 
 /** Initialize a hook list to the empty list*/
-static inline void spa_hook_list_init(struct spa_hook_list *list)
+SPA_API_HOOK void spa_hook_list_init(struct spa_hook_list *list)
 {
     spa_list_init(&list->list);
 }
 
-static inline bool spa_hook_list_is_empty(struct spa_hook_list *list)
+SPA_API_HOOK bool spa_hook_list_is_empty(struct spa_hook_list *list)
 {
     return spa_list_is_empty(&list->list);
 }
 
 /** Append a hook. */
-static inline void spa_hook_list_append(struct spa_hook_list *list,
+SPA_API_HOOK void spa_hook_list_append(struct spa_hook_list *list,
                     struct spa_hook *hook,
                     const void *funcs, void *data)
 {
@@ -350,7 +444,7 @@ static inline void spa_hook_list_append(struct spa_hook_list *list,
 }
 
 /** Prepend a hook */
-static inline void spa_hook_list_prepend(struct spa_hook_list *list,
+SPA_API_HOOK void spa_hook_list_prepend(struct spa_hook_list *list,
                      struct spa_hook *hook,
                      const void *funcs, void *data)
 {
@@ -360,7 +454,7 @@ static inline void spa_hook_list_prepend(struct spa_hook_list *list,
 }
 
 /** Remove a hook */
-static inline void spa_hook_remove(struct spa_hook *hook)
+SPA_API_HOOK void spa_hook_remove(struct spa_hook *hook)
 {
     if (spa_list_is_initialized(&hook->link))
         spa_list_remove(&hook->link);
@@ -369,14 +463,14 @@ static inline void spa_hook_remove(struct spa_hook *hook)
 }
 
 /** Remove all hooks from the list */
-static inline void spa_hook_list_clean(struct spa_hook_list *list)
+SPA_API_HOOK void spa_hook_list_clean(struct spa_hook_list *list)
 {
     struct spa_hook *h;
     spa_list_consume(h, &list->list, link)
         spa_hook_remove(h);
 }
 
-static inline void
+SPA_API_HOOK void
 spa_hook_list_isolate(struct spa_hook_list *list,
         struct spa_hook_list *save,
         struct spa_hook *hook,
@@ -390,7 +484,7 @@ spa_hook_list_isolate(struct spa_hook_list *list,
     spa_hook_list_append(list, hook, funcs, data);
 }
 
-static inline void
+SPA_API_HOOK void
 spa_hook_list_join(struct spa_hook_list *list,
         struct spa_hook_list *save)
 {
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/utils/list.h b/src/java.desktop/unix/native/libpipewire/include/spa/utils/list.h
index 5d4169217b52..6bcc0e2328b5 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/utils/list.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/utils/list.h
@@ -9,6 +9,16 @@
 extern "C" {
 #endif
 
+#include 
+
+#ifndef SPA_API_LIST
+ #ifdef SPA_API_IMPL
+  #define SPA_API_LIST SPA_API_IMPL
+ #else
+  #define SPA_API_LIST static inline
+ #endif
+#endif
+
 /**
  * \defgroup spa_list List
  * Doubly linked list data structure
@@ -26,19 +36,19 @@ struct spa_list {
 
 #define SPA_LIST_INIT(list) ((struct spa_list){ (list), (list) })
 
-static inline void spa_list_init(struct spa_list *list)
+SPA_API_LIST void spa_list_init(struct spa_list *list)
 {
     *list = SPA_LIST_INIT(list);
 }
 
-static inline int spa_list_is_initialized(struct spa_list *list)
+SPA_API_LIST int spa_list_is_initialized(struct spa_list *list)
 {
     return !!list->prev;
 }
 
 #define spa_list_is_empty(l)  ((l)->next == (l))
 
-static inline void spa_list_insert(struct spa_list *list, struct spa_list *elem)
+SPA_API_LIST void spa_list_insert(struct spa_list *list, struct spa_list *elem)
 {
     elem->prev = list;
     elem->next = list->next;
@@ -46,7 +56,7 @@ static inline void spa_list_insert(struct spa_list *list, struct spa_list *elem)
     elem->next->prev = elem;
 }
 
-static inline void spa_list_insert_list(struct spa_list *list, struct spa_list *other)
+SPA_API_LIST void spa_list_insert_list(struct spa_list *list, struct spa_list *other)
 {
     if (spa_list_is_empty(other))
         return;
@@ -56,7 +66,7 @@ static inline void spa_list_insert_list(struct spa_list *list, struct spa_list *
     list->next = other->next;
 }
 
-static inline void spa_list_remove(struct spa_list *elem)
+SPA_API_LIST void spa_list_remove(struct spa_list *elem)
 {
     elem->prev->next = elem->next;
     elem->next->prev = elem->prev;
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/utils/string.h b/src/java.desktop/unix/native/libpipewire/include/spa/utils/string.h
index 529b8fa38cdc..d225a3c87c3d 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/utils/string.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/utils/string.h
@@ -17,6 +17,14 @@ extern "C" {
 
 #include 
 
+#ifndef SPA_API_STRING
+ #ifdef SPA_API_IMPL
+  #define SPA_API_STRING SPA_API_IMPL
+ #else
+  #define SPA_API_STRING static inline
+ #endif
+#endif
+
 /**
  * \defgroup spa_string String handling
  * String handling utilities
@@ -33,7 +41,7 @@ extern "C" {
  * If both \a a and \a b are NULL, the two are considered equal.
  *
  */
-static inline bool spa_streq(const char *s1, const char *s2)
+SPA_API_STRING bool spa_streq(const char *s1, const char *s2)
 {
     return SPA_LIKELY(s1 && s2) ? strcmp(s1, s2) == 0 : s1 == s2;
 }
@@ -43,7 +51,7 @@ static inline bool spa_streq(const char *s1, const char *s2)
  *
  * If both \a a and \a b are NULL, the two are considered equal.
  */
-static inline bool spa_strneq(const char *s1, const char *s2, size_t len)
+SPA_API_STRING bool spa_strneq(const char *s1, const char *s2, size_t len)
 {
     return SPA_LIKELY(s1 && s2) ? strncmp(s1, s2, len) == 0 : s1 == s2;
 }
@@ -54,7 +62,7 @@ static inline bool spa_strneq(const char *s1, const char *s2, size_t len)
  * A \a s is NULL, it never starts with the given \a prefix. A \a prefix of
  * NULL is a bug in the caller.
  */
-static inline bool spa_strstartswith(const char *s, const char *prefix)
+SPA_API_STRING bool spa_strstartswith(const char *s, const char *prefix)
 {
     if (SPA_UNLIKELY(s == NULL))
         return false;
@@ -70,7 +78,7 @@ static inline bool spa_strstartswith(const char *s, const char *prefix)
  * A \a s is NULL, it never ends with the given \a suffix. A \a suffix of
  * NULL is a bug in the caller.
  */
-static inline bool spa_strendswith(const char *s, const char *suffix)
+SPA_API_STRING bool spa_strendswith(const char *s, const char *suffix)
 {
     size_t l1, l2;
 
@@ -92,7 +100,7 @@ static inline bool spa_strendswith(const char *s, const char *suffix)
  *
  * \return true on success, false otherwise
  */
-static inline bool spa_atoi32(const char *str, int32_t *val, int base)
+SPA_API_STRING bool spa_atoi32(const char *str, int32_t *val, int base)
 {
     char *endptr;
     long v;
@@ -120,7 +128,7 @@ static inline bool spa_atoi32(const char *str, int32_t *val, int base)
  *
  * \return true on success, false otherwise
  */
-static inline bool spa_atou32(const char *str, uint32_t *val, int base)
+SPA_API_STRING bool spa_atou32(const char *str, uint32_t *val, int base)
 {
     char *endptr;
     unsigned long long v;
@@ -148,7 +156,7 @@ static inline bool spa_atou32(const char *str, uint32_t *val, int base)
  *
  * \return true on success, false otherwise
  */
-static inline bool spa_atoi64(const char *str, int64_t *val, int base)
+SPA_API_STRING bool spa_atoi64(const char *str, int64_t *val, int base)
 {
     char *endptr;
     long long v;
@@ -173,7 +181,7 @@ static inline bool spa_atoi64(const char *str, int64_t *val, int base)
  *
  * \return true on success, false otherwise
  */
-static inline bool spa_atou64(const char *str, uint64_t *val, int base)
+SPA_API_STRING bool spa_atou64(const char *str, uint64_t *val, int base)
 {
     char *endptr;
     unsigned long long v;
@@ -196,7 +204,7 @@ static inline bool spa_atou64(const char *str, uint64_t *val, int base)
  *
  * \return true on success, false otherwise
  */
-static inline bool spa_atob(const char *str)
+SPA_API_STRING bool spa_atob(const char *str)
 {
     return spa_streq(str, "true") || spa_streq(str, "1");
 }
@@ -210,7 +218,7 @@ static inline bool spa_atob(const char *str)
  * number on error.
  */
 SPA_PRINTF_FUNC(3, 0)
-static inline int spa_vscnprintf(char *buffer, size_t size, const char *format, va_list args)
+SPA_API_STRING int spa_vscnprintf(char *buffer, size_t size, const char *format, va_list args)
 {
     int r;
 
@@ -233,7 +241,7 @@ static inline int spa_vscnprintf(char *buffer, size_t size, const char *format,
  * number on error.
  */
 SPA_PRINTF_FUNC(3, 4)
-static inline int spa_scnprintf(char *buffer, size_t size, const char *format, ...)
+SPA_API_STRING int spa_scnprintf(char *buffer, size_t size, const char *format, ...)
 {
     int r;
     va_list args;
@@ -253,7 +261,7 @@ static inline int spa_scnprintf(char *buffer, size_t size, const char *format, .
  *
  * \return the result float.
  */
-static inline float spa_strtof(const char *str, char **endptr)
+SPA_API_STRING float spa_strtof(const char *str, char **endptr)
 {
 #ifndef __LOCALE_C_ONLY
     static locale_t locale = NULL;
@@ -279,7 +287,7 @@ static inline float spa_strtof(const char *str, char **endptr)
  *
  * \return true on success, false otherwise
  */
-static inline bool spa_atof(const char *str, float *val)
+SPA_API_STRING bool spa_atof(const char *str, float *val)
 {
     char *endptr;
     float v;
@@ -303,7 +311,7 @@ static inline bool spa_atof(const char *str, float *val)
  *
  * \return the result float.
  */
-static inline double spa_strtod(const char *str, char **endptr)
+SPA_API_STRING double spa_strtod(const char *str, char **endptr)
 {
 #ifndef __LOCALE_C_ONLY
     static locale_t locale = NULL;
@@ -329,7 +337,7 @@ static inline double spa_strtod(const char *str, char **endptr)
  *
  * \return true on success, false otherwise
  */
-static inline bool spa_atod(const char *str, double *val)
+SPA_API_STRING bool spa_atod(const char *str, double *val)
 {
     char *endptr;
     double v;
@@ -346,7 +354,7 @@ static inline bool spa_atod(const char *str, double *val)
     return true;
 }
 
-static inline char *spa_dtoa(char *str, size_t size, double val)
+SPA_API_STRING char *spa_dtoa(char *str, size_t size, double val)
 {
     int i, l;
     l = spa_scnprintf(str, size, "%f", val);
@@ -362,15 +370,17 @@ struct spa_strbuf {
     size_t pos;
 };
 
-static inline void spa_strbuf_init(struct spa_strbuf *buf, char *buffer, size_t maxsize)
+SPA_API_STRING void spa_strbuf_init(struct spa_strbuf *buf, char *buffer, size_t maxsize)
 {
     buf->buffer = buffer;
     buf->maxsize = maxsize;
     buf->pos = 0;
+    if (maxsize > 0)
+        buf->buffer[0] = '\0';
 }
 
 SPA_PRINTF_FUNC(2, 3)
-static inline int spa_strbuf_append(struct spa_strbuf *buf, const char *fmt, ...)
+SPA_API_STRING int spa_strbuf_append(struct spa_strbuf *buf, const char *fmt, ...)
 {
     size_t remain = buf->maxsize - buf->pos;
     ssize_t written;
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/utils/type-info.h b/src/java.desktop/unix/native/libpipewire/include/spa/utils/type-info.h
index 86a6b87bc49c..85f831daede1 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/utils/type-info.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/utils/type-info.h
@@ -20,10 +20,6 @@ extern "C" {
 #define SPA_TYPE_ROOT    spa_types
 #endif
 
-static inline bool spa_type_is_a(const char *type, const char *parent)
-{
-    return type != NULL && parent != NULL && strncmp(type, parent, strlen(parent)) == 0;
-}
 
 #include 
 #include 
@@ -83,6 +79,7 @@ static const struct spa_type_info spa_types[] = {
     { SPA_TYPE_OBJECT_Profiler, SPA_TYPE_Object, SPA_TYPE_INFO_Profiler, spa_type_profiler },
     { SPA_TYPE_OBJECT_ParamLatency, SPA_TYPE_Object, SPA_TYPE_INFO_PARAM_Latency, spa_type_param_latency },
     { SPA_TYPE_OBJECT_ParamProcessLatency, SPA_TYPE_Object, SPA_TYPE_INFO_PARAM_ProcessLatency, spa_type_param_process_latency },
+    { SPA_TYPE_OBJECT_ParamTag, SPA_TYPE_Object, SPA_TYPE_INFO_PARAM_Tag, spa_type_param_tag },
 
     { 0, 0, NULL, NULL }
 };
diff --git a/src/java.desktop/unix/native/libpipewire/include/spa/utils/type.h b/src/java.desktop/unix/native/libpipewire/include/spa/utils/type.h
index fcadda93101a..79802d2f07eb 100644
--- a/src/java.desktop/unix/native/libpipewire/include/spa/utils/type.h
+++ b/src/java.desktop/unix/native/libpipewire/include/spa/utils/type.h
@@ -10,6 +10,15 @@ extern "C" {
 #endif
 
 #include 
+#include 
+
+#ifndef SPA_API_TYPE
+ #ifdef SPA_API_IMPL
+  #define SPA_API_TYPE SPA_API_IMPL
+ #else
+  #define SPA_API_TYPE static inline
+ #endif
+#endif
 
 /** \defgroup spa_types Types
  * Data type information enumerations
@@ -78,6 +87,7 @@ enum {
     SPA_TYPE_OBJECT_Profiler,
     SPA_TYPE_OBJECT_ParamLatency,
     SPA_TYPE_OBJECT_ParamProcessLatency,
+    SPA_TYPE_OBJECT_ParamTag,
     _SPA_TYPE_OBJECT_LAST,            /**< not part of ABI */
 
     /* vendor extensions */
@@ -122,6 +132,47 @@ struct spa_type_info {
     const struct spa_type_info *values;
 };
 
+SPA_API_TYPE bool spa_type_is_a(const char *type, const char *parent)
+{
+    return type != NULL && parent != NULL && strncmp(type, parent, strlen(parent)) == 0;
+}
+
+SPA_API_TYPE const char *spa_type_short_name(const char *name)
+{
+    const char *h;
+    if ((h = strrchr(name, ':')) != NULL)
+        name = h + 1;
+    return name;
+}
+
+SPA_API_TYPE uint32_t spa_type_from_short_name(const char *name,
+        const struct spa_type_info *info, uint32_t unknown)
+{
+    int i;
+    for (i = 0; info[i].name; i++) {
+        if (spa_streq(name, spa_type_short_name(info[i].name)))
+            return info[i].type;
+    }
+    return unknown;
+}
+SPA_API_TYPE const char * spa_type_to_name(uint32_t type,
+        const struct spa_type_info *info, const char *unknown)
+{
+    int i;
+    for (i = 0; info[i].name; i++) {
+        if (info[i].type == type)
+            return info[i].name;
+    }
+    return unknown;
+}
+
+SPA_API_TYPE const char * spa_type_to_short_name(uint32_t type,
+        const struct spa_type_info *info, const char *unknown)
+{
+    const char *n = spa_type_to_name(type, info, unknown);
+    return n ? spa_type_short_name(n) : NULL;
+}
+
 /**
  * \}
  */
diff --git a/src/java.desktop/windows/classes/sun/awt/windows/WDesktopPeer.java b/src/java.desktop/windows/classes/sun/awt/windows/WDesktopPeer.java
index 57b5f70ca379..788c1477265a 100644
--- a/src/java.desktop/windows/classes/sun/awt/windows/WDesktopPeer.java
+++ b/src/java.desktop/windows/classes/sun/awt/windows/WDesktopPeer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2023, 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
@@ -40,6 +40,8 @@
 
 import javax.swing.event.EventListenerList;
 
+import sun.awt.shell.ShellFolder;
+
 /**
  * Concrete implementation of the interface {@code DesktopPeer} for
  * the Windows platform.
@@ -102,18 +104,20 @@ public void browse(URI uri) throws IOException {
     }
 
     private void ShellExecute(File file, String verb) throws IOException {
-        String errMsg = ShellExecute(file.getAbsolutePath(), verb);
+        String errMsg = ShellFolder.invoke(
+                () -> ShellExecute(file.getAbsolutePath(), verb));
         if (errMsg != null) {
-            throw new IOException("Failed to " + verb + " " + file + ". Error message: " + errMsg);
+            throw new IOException("Failed to " + verb + " " + file +
+                                  ". Error message: " + errMsg);
         }
     }
 
     private void ShellExecute(URI uri, String verb) throws IOException {
-        String errmsg = ShellExecute(uri.toString(), verb);
-
+        String errmsg = ShellFolder.invoke(
+                () -> ShellExecute(uri.toString(), verb));
         if (errmsg != null) {
-            throw new IOException("Failed to " + verb + " " + uri
-                    + ". Error message: " + errmsg);
+            throw new IOException("Failed to " + verb + " " + uri +
+                                  ". Error message: " + errmsg);
         }
     }
 
diff --git a/src/java.desktop/windows/native/libawt/windows/awt_Desktop.cpp b/src/java.desktop/windows/native/libawt/windows/awt_Desktop.cpp
index 9cf2cea6fabd..ba79523249c3 100644
--- a/src/java.desktop/windows/native/libawt/windows/awt_Desktop.cpp
+++ b/src/java.desktop/windows/native/libawt/windows/awt_Desktop.cpp
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2005, 2022, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2023, 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
@@ -85,24 +85,14 @@ JNIEXPORT jstring JNICALL Java_sun_awt_windows_WDesktopPeer_ShellExecute
 
     // 6457572: ShellExecute possibly changes FPU control word - saving it here
     unsigned oldcontrol87 = _control87(0, 0);
-    HRESULT hr = ::CoInitializeEx(NULL, COINIT_APARTMENTTHREADED |
-                                        COINIT_DISABLE_OLE1DDE);
-    HINSTANCE retval;
-    DWORD error;
-    if (SUCCEEDED(hr)) {
-        retval = ::ShellExecute(NULL, verb_c, fileOrUri_c, NULL, NULL,
-                                SW_SHOWNORMAL);
-        error = ::GetLastError();
-        ::CoUninitialize();
-    }
+    HINSTANCE retval = ::ShellExecute(NULL, verb_c, fileOrUri_c, NULL, NULL,
+                                      SW_SHOWNORMAL);
+    DWORD error = ::GetLastError();
     _control87(oldcontrol87, 0xffffffff);
 
     JNU_ReleaseStringPlatformChars(env, fileOrUri_j, fileOrUri_c);
     JNU_ReleaseStringPlatformChars(env, verb_j, verb_c);
 
-    if (FAILED(hr)) {
-        return JNU_NewStringPlatform(env, L"CoInitializeEx() failed.");
-    }
     if ((int)((intptr_t)retval) <= 32) {
         // ShellExecute failed.
         LPTSTR buffer = NULL;
diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/ExchangeImpl.java b/src/java.net.http/share/classes/jdk/internal/net/http/ExchangeImpl.java
index 852742b6606a..71e669b7ce1a 100644
--- a/src/java.net.http/share/classes/jdk/internal/net/http/ExchangeImpl.java
+++ b/src/java.net.http/share/classes/jdk/internal/net/http/ExchangeImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2024, 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,6 +58,10 @@ abstract class ExchangeImpl {
 
     final Exchange exchange;
 
+    // this will be set to true only when the peer explicitly states (through a GOAWAY frame or
+    // a relevant error code in reset frame) that the corresponding stream (id) wasn't processed
+    private volatile boolean unprocessedByPeer;
+
     ExchangeImpl(Exchange e) {
         // e == null means a http/2 pushed stream
         this.exchange = e;
@@ -264,4 +268,13 @@ void upgraded() { }
     // Called when server returns non 100 response to
     // an Expect-Continue
     void expectContinueFailed(int rcode) { }
+
+    final boolean isUnprocessedByPeer() {
+        return this.unprocessedByPeer;
+    }
+
+    // Marks the exchange as unprocessed by the peer
+    final void markUnprocessedByPeer() {
+        this.unprocessedByPeer = true;
+    }
 }
diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/Http2ClientImpl.java b/src/java.net.http/share/classes/jdk/internal/net/http/Http2ClientImpl.java
index a302006cae3f..6f5ec1016fb8 100644
--- a/src/java.net.http/share/classes/jdk/internal/net/http/Http2ClientImpl.java
+++ b/src/java.net.http/share/classes/jdk/internal/net/http/Http2ClientImpl.java
@@ -40,6 +40,8 @@
 import jdk.internal.net.http.common.MinimalFuture;
 import jdk.internal.net.http.common.Utils;
 import jdk.internal.net.http.frame.SettingsFrame;
+
+import static jdk.internal.net.http.frame.SettingsFrame.INITIAL_CONNECTION_WINDOW_SIZE;
 import static jdk.internal.net.http.frame.SettingsFrame.INITIAL_WINDOW_SIZE;
 import static jdk.internal.net.http.frame.SettingsFrame.ENABLE_PUSH;
 import static jdk.internal.net.http.frame.SettingsFrame.HEADER_TABLE_SIZE;
@@ -289,9 +291,13 @@ int getConnectionWindowSize(SettingsFrame clientSettings) {
         // and the connection window size.
         int defaultValue = Math.max(streamWindow, K*K*32);
 
+        // The min value is the max between the streamWindow and
+        // the initial connection window size
+        int minValue = Math.max(INITIAL_CONNECTION_WINDOW_SIZE, streamWindow);
+
         return getParameter(
                 "jdk.httpclient.connectionWindowSize",
-                streamWindow, Integer.MAX_VALUE, defaultValue);
+                minValue, Integer.MAX_VALUE, defaultValue);
     }
 
     /**
diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/Http2Connection.java b/src/java.net.http/share/classes/jdk/internal/net/http/Http2Connection.java
index 84c09d6bca65..68b96de610b7 100644
--- a/src/java.net.http/share/classes/jdk/internal/net/http/Http2Connection.java
+++ b/src/java.net.http/share/classes/jdk/internal/net/http/Http2Connection.java
@@ -49,6 +49,7 @@
 import java.util.concurrent.ConcurrentLinkedQueue;
 import java.util.concurrent.Flow;
 import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicLong;
 import java.util.concurrent.atomic.AtomicReference;
 import java.util.concurrent.locks.Lock;
 import java.util.concurrent.locks.ReentrantLock;
@@ -396,6 +397,7 @@ private record PushContinuationState(PushPromiseDecoder pushContDecoder, PushPro
     private final String key; // for HttpClientImpl.connections map
     private final FramesDecoder framesDecoder;
     private final FramesEncoder framesEncoder = new FramesEncoder();
+    private final AtomicLong lastProcessedStreamInGoAway = new AtomicLong(-1);
 
     /**
      * Send Window controller for both connection and stream windows.
@@ -802,7 +804,9 @@ final int maxConcurrentServerInitiatedStreams() {
 
     void close() {
         if (markHalfClosedLocal()) {
-            if (connection.channel().isOpen()) {
+            // we send a GOAWAY frame only if the remote side hasn't already indicated
+            // the intention to close the connection by previously sending a GOAWAY of its own
+            if (connection.channel().isOpen() && !isMarked(closedState, HALF_CLOSED_REMOTE)) {
                 Log.logTrace("Closing HTTP/2 connection: to {0}", connection.address());
                 GoAwayFrame f = new GoAwayFrame(0,
                         ErrorFrame.NO_ERROR,
@@ -1064,6 +1068,34 @@ private String checkMaxOrphanedHeadersExceeded(HeaderFrame hf) {
         return null;
     }
 
+    // This method is called when a DataFrame that was added
+    // to a Stream::inputQ is later dropped from the queue
+    // without being consumed.
+    //
+    // Before adding a frame to the queue, the Stream calls
+    // connection.windowUpdater.canBufferUnprocessedBytes(), which
+    // increases the count of unprocessed bytes in the connection.
+    // After consuming the frame, it calls connection.windowUpdater::processed,
+    // which decrements the count of unprocessed bytes, and possibly
+    // sends a window update to the peer.
+    //
+    // This method is called when connection.windowUpdater::processed
+    // will not be called, which can happen when consuming the frame
+    // fails, or when an empty DataFrame terminates the stream,
+    // or when the stream is cancelled while data is still
+    // sitting in its inputQ. In the later case, it is called for
+    // each frame that is dropped from the queue.
+    final void releaseUnconsumed(DataFrame df) {
+        windowUpdater.released(df.payloadLength());
+        dropDataFrame(df);
+    }
+
+    // This method can be called directly when a DataFrame is dropped
+    // before/without having been added to any Stream::inputQ.
+    // In that case, the number of unprocessed bytes hasn't been incremented
+    // by the stream, and does not need to be decremented.
+    // Otherwise, if the frame is dropped after having been added to the
+    // inputQ, releaseUnconsumed above should be called.
     final void dropDataFrame(DataFrame df) {
         if (isMarked(closedState, SHUTDOWN_REQUESTED)) return;
         if (debug.on()) {
@@ -1354,13 +1386,46 @@ private void handlePing(PingFrame frame)
         sendUnorderedFrame(frame);
     }
 
-    private void handleGoAway(GoAwayFrame frame)
-        throws IOException
-    {
-        if (markHalfClosedLRemote()) {
-            shutdown(new IOException(
-                    connection.channel().getLocalAddress()
-                            + ": GOAWAY received"));
+    private void handleGoAway(final GoAwayFrame frame) {
+        final long lastProcessedStream = frame.getLastStream();
+        assert lastProcessedStream >= 0 : "unexpected last stream id: "
+                + lastProcessedStream + " in GOAWAY frame";
+
+        markHalfClosedRemote();
+        setFinalStream(); // don't allow any new streams on this connection
+        if (debug.on()) {
+            debug.log("processing incoming GOAWAY with last processed stream id:%s in frame %s",
+                    lastProcessedStream, frame);
+        }
+        // see if this connection has previously received a GOAWAY from the peer and if yes
+        // then check if this new last processed stream id is lesser than the previous
+        // known last processed stream id. Only update the last processed stream id if the new
+        // one is lesser than the previous one.
+        long prevLastProcessed = lastProcessedStreamInGoAway.get();
+        while (prevLastProcessed == -1 || lastProcessedStream < prevLastProcessed) {
+            if (lastProcessedStreamInGoAway.compareAndSet(prevLastProcessed,
+                    lastProcessedStream)) {
+                break;
+            }
+            prevLastProcessed = lastProcessedStreamInGoAway.get();
+        }
+        handlePeerUnprocessedStreams(lastProcessedStreamInGoAway.get());
+    }
+
+    private void handlePeerUnprocessedStreams(final long lastProcessedStream) {
+        final AtomicInteger numClosed = new AtomicInteger(); // atomic merely to allow usage within lambda
+        streams.forEach((id, exchange) -> {
+            if (id > lastProcessedStream) {
+                // any streams with an stream id higher than the last processed stream
+                // can be retried (on a new connection). we close the exchange as unprocessed
+                // to facilitate the retrying.
+                client2.client().theExecutor().ensureExecutedAsync(exchange::closeAsUnprocessed);
+                numClosed.incrementAndGet();
+            }
+        });
+        if (debug.on()) {
+            debug.log(numClosed.get() + " stream(s), with id greater than " + lastProcessedStream
+                    + ", will be closed as unprocessed");
         }
     }
 
@@ -1416,11 +1481,12 @@ private void sendConnectionPreface() throws IOException {
         // Note that the default initial window size, not to be confused
         // with the initial window size, is defined by RFC 7540 as
         // 64K -1.
-        final int len = windowUpdater.initialWindowSize - DEFAULT_INITIAL_WINDOW_SIZE;
-        if (len != 0) {
+        final int len = windowUpdater.initialWindowSize - INITIAL_CONNECTION_WINDOW_SIZE;
+        assert len >= 0;
+        if (len > 0) {
             if (Log.channel()) {
                 Log.logChannel("Sending initial connection window update frame: {0} ({1} - {2})",
-                        len, windowUpdater.initialWindowSize, DEFAULT_INITIAL_WINDOW_SIZE);
+                        len, windowUpdater.initialWindowSize, INITIAL_CONNECTION_WINDOW_SIZE);
             }
             windowUpdater.sendWindowUpdate(len);
         }
@@ -1874,6 +1940,19 @@ public ConnectionWindowUpdateSender(Http2Connection connection,
         int getStreamId() {
             return 0;
         }
+
+        @Override
+        protected boolean windowSizeExceeded(long received) {
+            if (connection.isOpen()) {
+                try {
+                    connection.protocolError(ErrorFrame.FLOW_CONTROL_ERROR,
+                            "connection window exceeded");
+                } catch (IOException io) {
+                    connection.shutdown(io);
+                }
+            }
+            return true;
+        }
     }
 
     /**
@@ -1911,7 +1990,7 @@ private boolean markHalfClosedLocal() {
         return markClosedState(HALF_CLOSED_LOCAL);
     }
 
-    private boolean markHalfClosedLRemote() {
+    private boolean markHalfClosedRemote() {
         return markClosedState(HALF_CLOSED_REMOTE);
     }
 
diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/HttpClientImpl.java b/src/java.net.http/share/classes/jdk/internal/net/http/HttpClientImpl.java
index 185f100fd1ab..9a8b901df7db 100644
--- a/src/java.net.http/share/classes/jdk/internal/net/http/HttpClientImpl.java
+++ b/src/java.net.http/share/classes/jdk/internal/net/http/HttpClientImpl.java
@@ -282,23 +282,25 @@ public String toString() {
         }
     }
 
-    static void registerPending(PendingRequest pending) {
+    static  CompletableFuture registerPending(PendingRequest pending, CompletableFuture res) {
         // shortcut if cf is already completed: no need to go through the trouble of
         //    registering it
-        if (pending.cf.isDone()) return;
+        if (pending.cf.isDone()) return res;
 
         var client = pending.client;
         var cf = pending.cf;
         var id = pending.id;
         boolean added = client.pendingRequests.add(pending);
         // this may immediately remove `pending` from the set is the cf is already completed
-        pending.ref = cf.whenComplete((r,t) -> client.pendingRequests.remove(pending));
+        var ref = res.whenComplete((r,t) -> client.pendingRequests.remove(pending));
+        pending.ref = ref;
         assert added : "request %d was already added".formatted(id);
         // should not happen, unless the selector manager has already
         // exited abnormally
         if (client.selmgr.isClosed()) {
             pending.abort(client.selmgr.selectorClosedException());
         }
+        return ref;
     }
 
     static void abortPendingRequests(HttpClientImpl client, Throwable reason) {
@@ -931,8 +933,9 @@ private void debugCompleted(String tag, long startNanos, HttpRequest req) {
             cf = sendAsync(req, responseHandler, null, null);
             return cf.get();
         } catch (InterruptedException ie) {
-            if (cf != null )
+            if (cf != null) {
                 cf.cancel(true);
+            }
             throw ie;
         } catch (ExecutionException e) {
             final Throwable throwable = e.getCause();
@@ -1054,19 +1057,23 @@ private void debugCompleted(String tag, long startNanos, HttpRequest req) {
                         (b,t) -> debugCompleted("ClientImpl (async)", start, userRequest));
             }
 
-            // makes sure that any dependent actions happen in the CF default
-            // executor. This is only needed for sendAsync(...), when
-            // exchangeExecutor is non-null.
-            if (exchangeExecutor != null) {
-                res = res.whenCompleteAsync((r, t) -> { /* do nothing */}, ASYNC_POOL);
-            }
-
             // The mexCf is the Cf we need to abort if the SelectorManager thread
             // is aborted.
             PendingRequest pending = new PendingRequest(id, requestImpl, mexCf, mex, this);
-            registerPending(pending);
-            return res;
-        } catch(Throwable t) {
+            res = registerPending(pending, res);
+
+            if (exchangeExecutor != null) {
+                // makes sure that any dependent actions happen in the CF default
+                // executor. This is only needed for sendAsync(...), when
+                // exchangeExecutor is non-null.
+                return res.isDone() ? res
+                        : res.whenCompleteAsync((r, t) -> { /* do nothing */}, ASYNC_POOL);
+            } else {
+                // make a defensive copy that can be safely canceled
+                // by the caller
+                return res.isDone() ? res : res.copy();
+            }
+        } catch (Throwable t) {
             requestUnreference();
             debugCompleted("ClientImpl (async)", start, userRequest);
             throw t;
diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/HttpRequestImpl.java b/src/java.net.http/share/classes/jdk/internal/net/http/HttpRequestImpl.java
index 9ea56ec7a02d..5e89ce6c1fc0 100644
--- a/src/java.net.http/share/classes/jdk/internal/net/http/HttpRequestImpl.java
+++ b/src/java.net.http/share/classes/jdk/internal/net/http/HttpRequestImpl.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, 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
@@ -42,6 +42,7 @@
 import java.net.http.HttpClient;
 import java.net.http.HttpHeaders;
 import java.net.http.HttpRequest;
+import java.util.function.BiPredicate;
 
 import jdk.internal.net.http.common.HttpHeadersBuilder;
 import jdk.internal.net.http.common.Utils;
@@ -51,6 +52,7 @@
 import static java.net.Authenticator.RequestorType.SERVER;
 import static jdk.internal.net.http.common.Utils.ALLOWED_HEADERS;
 import static jdk.internal.net.http.common.Utils.ProxyHeaders;
+import static jdk.internal.net.http.common.Utils.copyProxy;
 
 public class HttpRequestImpl extends HttpRequest implements WebSocketRequest {
 
@@ -133,15 +135,7 @@ public HttpRequestImpl(HttpRequest request, ProxySelector ps) {
             this.systemHeadersBuilder.setHeader("User-Agent", USER_AGENT);
         }
         this.uri = requestURI;
-        if (isWebSocket) {
-            // WebSocket determines and sets the proxy itself
-            this.proxy = ((HttpRequestImpl) request).proxy;
-        } else {
-            if (ps != null)
-                this.proxy = retrieveProxy(ps, uri);
-            else
-                this.proxy = null;
-        }
+        this.proxy = retrieveProxy(request, ps, uri);
         this.expectContinue = request.expectContinue();
         this.secure = uri.getScheme().toLowerCase(Locale.US).equals("https");
         this.requestPublisher = request.bodyPublisher().orElse(null);
@@ -162,7 +156,11 @@ public static HttpRequestImpl newInstanceForRedirection(URI uri,
                                                             String method,
                                                             HttpRequestImpl other,
                                                             boolean mayHaveBody) {
-        return new HttpRequestImpl(uri, method, other, mayHaveBody);
+        if (uri.getScheme().equalsIgnoreCase(other.uri.getScheme()) &&
+                uri.getRawAuthority().equals(other.uri.getRawAuthority())) {
+            return new HttpRequestImpl(uri, method, other, mayHaveBody, Optional.empty());
+        }
+        return new HttpRequestImpl(uri, method, other, mayHaveBody, Optional.of(Utils.ALLOWED_REDIRECT_HEADERS));
     }
 
     /** Returns a new instance suitable for authentication. */
@@ -182,9 +180,19 @@ private HttpRequestImpl(URI uri,
                             String method,
                             HttpRequestImpl other,
                             boolean mayHaveBody) {
+        this(uri, method, other, mayHaveBody, Optional.empty());
+    }
+
+    private HttpRequestImpl(URI uri,
+                            String method,
+                            HttpRequestImpl other,
+                            boolean mayHaveBody,
+                            Optional> redirectHeadersFilter) {
         assert method == null || Utils.isValidName(method);
-        this.method = method == null? "GET" : method;
-        this.userHeaders = other.userHeaders;
+        this.method = method == null ? "GET" : method;
+        HttpHeaders userHeaders = redirectHeadersFilter.isPresent() ?
+                HttpHeaders.of(other.userHeaders.map(), redirectHeadersFilter.get()) : other.userHeaders;
+        this.userHeaders = userHeaders;
         this.isWebSocket = other.isWebSocket;
         this.systemHeadersBuilder = new HttpHeadersBuilder();
         if (userHeaders.firstValue("User-Agent").isEmpty()) {
@@ -300,16 +308,27 @@ void setH2Upgrade(Exchange exchange) {
     @Override
     public boolean expectContinue() { return expectContinue; }
 
-    /** Retrieves the proxy, from the given ProxySelector, if there is one. */
-    private static Proxy retrieveProxy(ProxySelector ps, URI uri) {
-        Proxy proxy = null;
-        List pl = ps.select(uri);
-        if (!pl.isEmpty()) {
-            Proxy p = pl.get(0);
-            if (p.type() == Proxy.Type.HTTP)
-                proxy = p;
+    /** Retrieves a copy of the proxy either from the given {@link HttpRequest} or {@link ProxySelector}, if there is one. */
+    private static Proxy retrieveProxy(HttpRequest request, ProxySelector ps, URI uri) {
+
+        // WebSocket determines and sets the proxy itself
+        if (request instanceof HttpRequestImpl requestImpl && requestImpl.isWebSocket) {
+            return requestImpl.proxy;
         }
-        return proxy;
+
+        // Try to find a matching one from the `ProxySelector`
+        if (ps != null) {
+            List pl = ps.select(uri);
+            if (!pl.isEmpty()) {
+                Proxy p = pl.getFirst();
+                if (p.type() == Proxy.Type.HTTP) {
+                    return copyProxy(p);
+                }
+            }
+        }
+
+        return null;
+
     }
 
     InetSocketAddress proxy() {
@@ -325,7 +344,7 @@ InetSocketAddress proxy() {
     @Override
     public void setProxy(Proxy proxy) {
         assert isWebSocket;
-        this.proxy = proxy;
+        this.proxy = copyProxy(proxy);
     }
 
     @Override
diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/MultiExchange.java b/src/java.net.http/share/classes/jdk/internal/net/http/MultiExchange.java
index 3d1f92555650..dbbcb7da19cb 100644
--- a/src/java.net.http/share/classes/jdk/internal/net/http/MultiExchange.java
+++ b/src/java.net.http/share/classes/jdk/internal/net/http/MultiExchange.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2024, 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
@@ -90,8 +90,8 @@ class MultiExchange implements Cancelable {
     Exchange exchange; // the current exchange
     Exchange previous;
     volatile Throwable retryCause;
-    volatile boolean expiredOnce;
-    volatile HttpResponse response = null;
+    volatile boolean retriedOnce;
+    volatile HttpResponse response;
 
     // Maximum number of times a request will be retried/redirected
     // for any reason
@@ -279,11 +279,19 @@ public void cancel(IOException cause) {
     @Override
     public boolean cancel(boolean mayInterruptIfRunning) {
         boolean cancelled = this.cancelled;
+        boolean firstCancel = false;
         if (!cancelled && mayInterruptIfRunning) {
             if (interrupted.get() == null) {
-                interrupted.compareAndSet(null,
+                firstCancel = interrupted.compareAndSet(null,
                         new CancellationException("Request cancelled"));
             }
+            if (debug.on()) {
+                if (firstCancel) {
+                    debug.log("multi exchange recording: " + interrupted.get());
+                } else {
+                    debug.log("multi exchange recorded: " + interrupted.get());
+                }
+            }
             this.cancelled = true;
             var exchange = getExchange();
             if (exchange != null) {
@@ -365,17 +373,30 @@ private CompletableFuture> handleNoBody(Response r, Exchange
                     }).exceptionallyCompose(this::whenCancelled);
     }
 
+    // returns a CancellationExcpetion that wraps the given cause
+    // if cancel(boolean) was called, the given cause otherwise
+    private Throwable wrapIfCancelled(Throwable cause) {
+        CancellationException interrupt = interrupted.get();
+        if (interrupt == null) return cause;
+
+        var cancel = new CancellationException(interrupt.getMessage());
+        // preserve the stack trace of the original exception to
+        // show where the call to cancel(boolean) came from
+        cancel.setStackTrace(interrupt.getStackTrace());
+        cancel.initCause(Utils.getCancelCause(cause));
+        return cancel;
+    }
+
+    // if the request failed because the multi exchange was cancelled,
+    // make sure the reported exception is wrapped in CancellationException
     private CompletableFuture> whenCancelled(Throwable t) {
-        CancellationException x = interrupted.get();
-        if (x != null) {
-            // make sure to fail with CancellationException if cancel(true)
-            // was called.
-            t = x.initCause(Utils.getCancelCause(t));
+        var x = wrapIfCancelled(t);
+        if (x instanceof CancellationException) {
             if (debug.on()) {
-                debug.log("MultiExchange interrupted with: " + t.getCause());
+                debug.log("MultiExchange interrupted with: " + x.getCause());
             }
         }
-        return MinimalFuture.failedFuture(t);
+        return MinimalFuture.failedFuture(x);
     }
 
     static class NullSubscription implements Flow.Subscription {
@@ -438,7 +459,7 @@ private CompletableFuture responseAsyncImpl() {
                             return exch.ignoreBody().handle((r,t) -> {
                                 previousreq = currentreq;
                                 currentreq = newrequest;
-                                expiredOnce = false;
+                                retriedOnce = false;
                                 setExchange(new Exchange<>(currentreq, this, acc));
                                 return responseAsyncImpl();
                             }).thenCompose(Function.identity());
@@ -451,7 +472,7 @@ private CompletableFuture responseAsyncImpl() {
                             return completedFuture(response);
                         }
                         // all exceptions thrown are handled here
-                        CompletableFuture errorCF = getExceptionalCF(ex);
+                        CompletableFuture errorCF = getExceptionalCF(ex, exch.exchImpl);
                         if (errorCF == null) {
                             return responseAsyncImpl();
                         } else {
@@ -523,34 +544,38 @@ private Throwable retryCause(Throwable t) {
      * Takes a Throwable and returns a suitable CompletableFuture that is
      * completed exceptionally, or null.
      */
-    private CompletableFuture getExceptionalCF(Throwable t) {
+    private CompletableFuture getExceptionalCF(Throwable t, ExchangeImpl exchImpl) {
         if ((t instanceof CompletionException) || (t instanceof ExecutionException)) {
             if (t.getCause() != null) {
                 t = t.getCause();
             }
         }
+        final boolean retryAsUnprocessed = exchImpl != null && exchImpl.isUnprocessedByPeer();
         if (cancelled && !requestCancelled() && t instanceof IOException) {
             if (!(t instanceof HttpTimeoutException)) {
                 t = toTimeoutException((IOException)t);
             }
-        } else if (retryOnFailure(t)) {
+        } else if (retryAsUnprocessed || retryOnFailure(t)) {
             Throwable cause = retryCause(t);
 
             if (!(t instanceof ConnectException)) {
                 // we may need to start a new connection, and if so
                 // we want to start with a fresh connect timeout again.
                 if (connectTimeout != null) connectTimeout.reset();
-                if (!canRetryRequest(currentreq)) {
-                    return failedFuture(cause); // fails with original cause
+                if (!retryAsUnprocessed && !canRetryRequest(currentreq)) {
+                    // a (peer) processed request which cannot be retried, fail with
+                    // the original cause
+                    return failedFuture(cause);
                 }
             } // ConnectException: retry, but don't reset the connectTimeout.
 
             // allow the retry mechanism to do its work
             retryCause = cause;
-            if (!expiredOnce) {
+            if (!retriedOnce) {
                 if (debug.on())
-                    debug.log(t.getClass().getSimpleName() + " (async): retrying...", t);
-                expiredOnce = true;
+                    debug.log(t.getClass().getSimpleName()
+                            + " (async): retrying " + currentreq + " due to: ", t);
+                retriedOnce = true;
                 // The connection was abruptly closed.
                 // We return null to retry the same request a second time.
                 // The request filters have already been applied to the
@@ -561,7 +586,7 @@ private CompletableFuture getExceptionalCF(Throwable t) {
             } else {
                 if (debug.on()) {
                     debug.log(t.getClass().getSimpleName()
-                            + " (async): already retried once.", t);
+                            + " (async): already retried once " + currentreq, t);
                 }
                 t = cause;
             }
diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/Stream.java b/src/java.net.http/share/classes/jdk/internal/net/http/Stream.java
index 9cc599845738..bf266cc8ebee 100644
--- a/src/java.net.http/share/classes/jdk/internal/net/http/Stream.java
+++ b/src/java.net.http/share/classes/jdk/internal/net/http/Stream.java
@@ -160,6 +160,9 @@ class Stream extends ExchangeImpl {
     // send lock: prevent sending DataFrames after reset occurred.
     private final Lock sendLock = new ReentrantLock();
     private final Lock stateLock = new ReentrantLock();
+    // inputQ lock: methods that take from the inputQ
+    //      must not run concurrently.
+    private final Lock inputQLock = new ReentrantLock();
 
     /**
      * A reference to this Stream's connection Send Window controller. The
@@ -167,7 +170,7 @@ class Stream extends ExchangeImpl {
      * sending any data. Will be null for PushStreams, as they cannot send data.
      */
     private final WindowController windowController;
-    private final WindowUpdateSender windowUpdater;
+    private final WindowUpdateSender streamWindowUpdater;
 
     @Override
     HttpConnection connection() {
@@ -181,6 +184,8 @@ HttpConnection connection() {
     private void schedule() {
         boolean onCompleteCalled = false;
         HttpResponse.BodySubscriber subscriber = responseSubscriber;
+        // prevents drainInputQueue() from running concurrently
+        inputQLock.lock();
         try {
             if (subscriber == null) {
                 subscriber = responseSubscriber = pendingResponseSubscriber;
@@ -198,7 +203,7 @@ private void schedule() {
                     handleReset(rf, subscriber);
                     return;
                 }
-                DataFrame df = (DataFrame)frame;
+                DataFrame df = (DataFrame) frame;
                 boolean finished = df.getFlag(DataFrame.END_STREAM);
 
                 List buffers = df.getData();
@@ -206,7 +211,8 @@ private void schedule() {
                 int size = Utils.remaining(dsts, Integer.MAX_VALUE);
                 if (size == 0 && finished) {
                     inputQ.remove();
-                    connection.ensureWindowUpdated(df); // must update connection window
+                    // consumed will not be called
+                    connection.releaseUnconsumed(df); // must update connection window
                     Log.logTrace("responseSubscriber.onComplete");
                     if (debug.on()) debug.log("incoming: onComplete");
                     sched.stop();
@@ -222,7 +228,11 @@ private void schedule() {
                     try {
                         subscriber.onNext(dsts);
                     } catch (Throwable t) {
-                        connection.dropDataFrame(df); // must update connection window
+                        // Data frames that have been added to the inputQ
+                        // must be released using releaseUnconsumed() to
+                        // account for the amount of unprocessed bytes
+                        // tracked by the connection.windowUpdater.
+                        connection.releaseUnconsumed(df);
                         throw t;
                     }
                     if (consumed(df)) {
@@ -243,6 +253,7 @@ private void schedule() {
         } catch (Throwable throwable) {
             errorRef.compareAndSet(null, throwable);
         } finally {
+            inputQLock.unlock();
             if (sched.isStopped()) drainInputQueue();
         }
 
@@ -261,22 +272,36 @@ private void schedule() {
             } catch (Throwable x) {
                 Log.logError("Subscriber::onError threw exception: {0}", t);
             } finally {
+                // cancelImpl will eventually call drainInputQueue();
                 cancelImpl(t);
-                drainInputQueue();
             }
         }
     }
 
-    // must only be called from the scheduler schedule() loop.
-    // ensure that all received data frames are accounted for
+    // Called from the scheduler schedule() loop,
+    // or after resetting the stream.
+    // Ensures that all received data frames are accounted for
     // in the connection window flow control if the scheduler
     // is stopped before all the data is consumed.
+    // The inputQLock is used to prevent concurrently taking
+    // from the queue.
     private void drainInputQueue() {
         Http2Frame frame;
-        while ((frame = inputQ.poll()) != null) {
-            if (frame instanceof DataFrame) {
-                connection.dropDataFrame((DataFrame)frame);
+        // will wait until schedule() has finished taking
+        // from the queue, if needed.
+        inputQLock.lock();
+        try {
+            while ((frame = inputQ.poll()) != null) {
+                if (frame instanceof DataFrame df) {
+                    // Data frames that have been added to the inputQ
+                    // must be released using releaseUnconsumed() to
+                    // account for the amount of unprocessed bytes
+                    // tracked by the connection.windowUpdater.
+                    connection.releaseUnconsumed(df);
+                }
             }
+        } finally {
+            inputQLock.unlock();
         }
     }
 
@@ -301,12 +326,13 @@ private boolean consumed(DataFrame df) {
         boolean endStream = df.getFlag(DataFrame.END_STREAM);
         if (len == 0) return endStream;
 
-        connection.windowUpdater.update(len);
-
+        connection.windowUpdater.processed(len);
         if (!endStream) {
+            streamWindowUpdater.processed(len);
+        } else {
             // Don't send window update on a stream which is
             // closed or half closed.
-            windowUpdater.update(len);
+            streamWindowUpdater.released(len);
         }
 
         // true: end of stream; false: more data coming
@@ -376,8 +402,47 @@ public String toString() {
     }
 
     private void receiveDataFrame(DataFrame df) {
-        inputQ.add(df);
-        sched.runOrSchedule();
+        try {
+            int len = df.payloadLength();
+            if (len > 0) {
+                // we return from here if the connection is being closed.
+                if (!connection.windowUpdater.canBufferUnprocessedBytes(len)) return;
+                // we return from here if the stream is being closed.
+                if (closed || !streamWindowUpdater.canBufferUnprocessedBytes(len)) {
+                    connection.releaseUnconsumed(df);
+                    return;
+                }
+            }
+           pushDataFrame(len, df);
+        } finally {
+            sched.runOrSchedule();
+        }
+    }
+
+    // Ensures that no data frame is pushed on the inputQ
+    // after the stream is closed.
+    // Changes to the `closed` boolean are guarded by the
+    // stateLock. Contention should be low as only one
+    // thread at a time adds to the inputQ, and
+    // we can only contend when closing the stream.
+    // Note that this method can run concurrently with
+    // methods holding the inputQLock: that is OK.
+    // The inputQLock is there to ensure that methods
+    // taking from the queue are not running concurrently
+    // with each others, but concurrently adding at the
+    // end of the queue while peeking/polling at the head
+    // is OK.
+    private void pushDataFrame(int len, DataFrame df) {
+        boolean closed = false;
+        stateLock.lock();
+        try {
+            if (!(closed = this.closed)) {
+                inputQ.add(df);
+            }
+        } finally {
+            stateLock.unlock();
+        }
+        if (closed && len > 0) connection.releaseUnconsumed(df);
     }
 
     /** Handles a RESET frame. RESET is always handled inline in the queue. */
@@ -461,7 +526,7 @@ CompletableFuture> sendBodyAsync() {
         this.responseHeadersBuilder = new HttpHeadersBuilder();
         this.rspHeadersConsumer = new HeadersConsumer();
         this.requestPseudoHeaders = createPseudoHeaders(request);
-        this.windowUpdater = new StreamWindowUpdateSender(connection);
+        this.streamWindowUpdater = new StreamWindowUpdateSender(connection);
     }
 
     private boolean checkRequestCancelled() {
@@ -495,6 +560,8 @@ void incoming(Http2Frame frame) throws IOException {
                 if (debug.on()) {
                     debug.log("request cancelled or stream closed: dropping data frame");
                 }
+                // Data frames that have not been added to the inputQ
+                // can be released using dropDataFrame
                 connection.dropDataFrame(df);
             } else {
                 receiveDataFrame(df);
@@ -673,20 +740,39 @@ void handleReset(ResetFrame frame, Flow.Subscriber subscriber) {
                 stateLock.unlock();
             }
             try {
-                int error = frame.getErrorCode();
-                IOException e = new IOException("Received RST_STREAM: "
-                        + ErrorFrame.stringForCode(error));
-                if (errorRef.compareAndSet(null, e)) {
-                    if (subscriber != null) {
-                        subscriber.onError(e);
+                final int error = frame.getErrorCode();
+                // A REFUSED_STREAM error code implies that the stream wasn't processed by the
+                // peer and the client is free to retry the request afresh.
+                if (error == ErrorFrame.REFUSED_STREAM) {
+                    // Here we arrange for the request to be retried. Note that we don't call
+                    // closeAsUnprocessed() method here because the "closed" state is already set
+                    // to true a few lines above and calling close() from within
+                    // closeAsUnprocessed() will end up being a no-op. We instead do the additional
+                    // bookkeeping here.
+                    markUnprocessedByPeer();
+                    errorRef.compareAndSet(null, new IOException("request not processed by peer"));
+                    if (debug.on()) {
+                        debug.log("request unprocessed by peer (REFUSED_STREAM) " + this.request);
+                    }
+                } else {
+                    final String reason = ErrorFrame.stringForCode(error);
+                    final IOException failureCause = new IOException("Received RST_STREAM: " + reason);
+                    if (debug.on()) {
+                        debug.log(streamid + " received RST_STREAM with code: " + reason);
+                    }
+                    if (errorRef.compareAndSet(null, failureCause)) {
+                        if (subscriber != null) {
+                            subscriber.onError(failureCause);
+                        }
                     }
                 }
-                completeResponseExceptionally(e);
+                final Throwable failureCause = errorRef.get();
+                completeResponseExceptionally(failureCause);
                 if (!requestBodyCF.isDone()) {
-                    requestBodyCF.completeExceptionally(errorRef.get()); // we may be sending the body..
+                    requestBodyCF.completeExceptionally(failureCause); // we may be sending the body..
                 }
                 if (responseBodyCF != null) {
-                    responseBodyCF.completeExceptionally(errorRef.get());
+                    responseBodyCF.completeExceptionally(failureCause);
                 }
             } finally {
                 connection.decrementStreamsCount(streamid);
@@ -1379,12 +1465,18 @@ void cancel(IOException cause) {
 
     @Override
     void onProtocolError(final IOException cause) {
+        onProtocolError(cause, ResetFrame.PROTOCOL_ERROR);
+    }
+
+    void onProtocolError(final IOException cause, int code) {
         if (debug.on()) {
-            debug.log("cancelling exchange on stream %d due to protocol error: %s", streamid, cause.getMessage());
+            debug.log("cancelling exchange on stream %d due to protocol error [%s]: %s",
+                    streamid, ErrorFrame.stringForCode(code),
+                    cause.getMessage());
         }
         Log.logError("cancelling exchange on stream {0} due to protocol error: {1}\n", streamid, cause);
         // send a RESET frame and close the stream
-        cancelImpl(cause, ResetFrame.PROTOCOL_ERROR);
+        cancelImpl(cause, code);
     }
 
     void connectionClosing(Throwable cause) {
@@ -1462,6 +1554,8 @@ void cancelImpl(final Throwable e, final int resetFrameErrCode) {
             }
         } catch (Throwable ex) {
             Log.logError(ex);
+        } finally {
+            drainInputQueue();
         }
     }
 
@@ -1681,6 +1775,13 @@ String dbgString() {
                 return dbgString = dbg;
             }
         }
+
+        @Override
+        protected boolean windowSizeExceeded(long received) {
+            onProtocolError(new ProtocolException("stream %s flow control window exceeded"
+                        .formatted(streamid)), ResetFrame.FLOW_CONTROL_ERROR);
+            return true;
+        }
     }
 
     /**
@@ -1700,7 +1801,35 @@ Throwable getCancelCause() {
     }
 
     final String dbgString() {
-        return connection.dbgString() + "/Stream("+streamid+")";
+        final int id = streamid;
+        final String sid = id == 0 ? "?" : String.valueOf(id);
+        return connection.dbgString() + "/Stream(" + sid + ")";
+    }
+
+    /**
+     * An unprocessed exchange is one that hasn't been processed by a peer. The local end of the
+     * connection would be notified about such exchanges when it receives a GOAWAY frame with
+     * a stream id that tells which exchanges have been unprocessed.
+     * This method is called on such unprocessed exchanges and the implementation of this method
+     * will arrange for the request, corresponding to this exchange, to be retried afresh on a
+     * new connection.
+     */
+    void closeAsUnprocessed() {
+        try {
+            // We arrange for the request to be retried on a new connection as allowed by the RFC-9113
+            markUnprocessedByPeer();
+            this.errorRef.compareAndSet(null, new IOException("request not processed by peer"));
+            if (debug.on()) {
+                debug.log("closing " + this.request + " as unprocessed by peer");
+            }
+            // close the exchange and complete the response CF exceptionally
+            close();
+            completeResponseExceptionally(this.errorRef.get());
+        } finally {
+            // decrementStreamsCount isn't really needed but we do it to make sure
+            // the log messages, where these counts/states get reported, show the accurate state.
+            connection.decrementStreamsCount(streamid);
+        }
     }
 
     private class HeadersConsumer extends ValidatingHeadersConsumer implements DecodingCallback {
diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/WindowController.java b/src/java.net.http/share/classes/jdk/internal/net/http/WindowController.java
index 1df81640345f..a30c21a7a7d0 100644
--- a/src/java.net.http/share/classes/jdk/internal/net/http/WindowController.java
+++ b/src/java.net.http/share/classes/jdk/internal/net/http/WindowController.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2024, 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,13 +100,16 @@ void removeStream(int streamid) {
         controllerLock.lock();
         try {
             Integer old = streams.remove(streamid);
-            // Odd stream numbers (client streams) should have been registered.
+            // A client initiated stream might be closed (as unprocessed, due to a
+            // GOAWAY received on the connection) even before the stream is
+            // registered with this WindowController instance (when sending out request headers).
+            // Thus, for client initiated streams, we don't enforce the presence of the
+            // stream in the registered "streams" map.
+
             // Even stream numbers (server streams - aka Push Streams) should
             // not be registered
             final boolean isClientStream = (streamid & 0x1) == 1;
-            if (old == null && isClientStream) {
-                throw new InternalError("Expected entry for streamid: " + streamid);
-            } else if (old != null && !isClientStream) {
+            if (old != null && !isClientStream) {
                 throw new InternalError("Unexpected entry for streamid: " + streamid);
             }
         } finally {
diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/WindowUpdateSender.java b/src/java.net.http/share/classes/jdk/internal/net/http/WindowUpdateSender.java
index 0bccc24e498f..2da472bfbc3d 100644
--- a/src/java.net.http/share/classes/jdk/internal/net/http/WindowUpdateSender.java
+++ b/src/java.net.http/share/classes/jdk/internal/net/http/WindowUpdateSender.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -31,16 +31,31 @@
 import jdk.internal.net.http.frame.WindowUpdateFrame;
 import jdk.internal.net.http.common.Utils;
 import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicLong;
 import java.util.concurrent.locks.ReentrantLock;
 
+/**
+ * A class that tracks the amount of flow controlled
+ * data received on an HTTP/2 connection
+ */
 abstract class WindowUpdateSender {
 
     final Logger debug =
             Utils.getDebugLogger(this::dbgString, Utils.DEBUG);
 
+    // The threshold at which window updates are sent in bytes
     final int limit;
+    // The flow control window in bytes
+    final int windowSize;
     final Http2Connection connection;
-    final AtomicInteger received = new AtomicInteger();
+    // The amount of flow controlled data received and processed, in bytes,
+    // since the start of the window.
+    // The window is exhausted when received + unprocessed >= windowSize
+    final AtomicLong received = new AtomicLong();
+    // The amount of flow controlled data received and unprocessed, in bytes,
+    // since the start of the window.
+    // The window is exhausted when received + unprocessed >= windowSize
+    final AtomicLong unprocessed = new AtomicLong();
     final ReentrantLock sendLock = new ReentrantLock();
 
     WindowUpdateSender(Http2Connection connection) {
@@ -53,6 +68,7 @@ abstract class WindowUpdateSender {
 
     WindowUpdateSender(Http2Connection connection, int maxFrameSize, int initWindowSize) {
         this.connection = connection;
+        this.windowSize = initWindowSize;
         int v0 = Math.max(0, initWindowSize - maxFrameSize);
         int v1 = (initWindowSize + (maxFrameSize - 1)) / maxFrameSize;
         v1 = v1 * maxFrameSize / 2;
@@ -66,17 +82,128 @@ abstract class WindowUpdateSender {
                       maxFrameSize, initWindowSize, limit);
     }
 
+    // O for the connection window, > 0 for a stream window
     abstract int getStreamId();
 
+
+    /**
+     * {@return {@code true} if buffering the given amount of
+     * flow controlled data would not exceed the flow control
+     * window}
+     * 

+ * This method is called before buffering and processing + * a DataFrame. The count of unprocessed bytes is incremented + * by the given amount, and checked against the number of + * available bytes in the flow control window. + *

+ * This method returns {@code true} if the bytes can be buffered + * without exceeding the flow control window, {@code false} + * if the flow control window is exceeded and corrective + * action (close/reset) has been taken. + *

+ * When this method returns true, either {@link #processed(int)} + * or {@link #released(int)} must eventually be called to release + * the bytes from the flow control window. + * + * @implSpec + * an HTTP/2 endpoint may disable its own flow control + * (see + * RFC 9113, section 5.2.1), in which case this + * method may return true even if the flow control window would + * be exceeded: that is, the flow control window is exceeded but + * the endpoint decided to take no corrective action. + * + * @param len a number of unprocessed bytes, which + * the caller wants to buffer. + */ + boolean canBufferUnprocessedBytes(int len) { + long buffered, processed; + // get received before unprocessed in order to avoid counting + // unprocessed bytes that might get unbuffered asynchronously + // twice. + processed = received.get(); + buffered = unprocessed.addAndGet(len); + return !checkWindowSizeExceeded(processed, buffered); + } + + // adds the provided amount to the amount of already + // processed and processed bytes and checks whether the + // flow control window is exceeded. If so, take + // corrective actions and return true. + private boolean checkWindowSizeExceeded(long processed, long len) { + // because windowSize is bound by Integer.MAX_VALUE + // we will never reach the point where received.get() + len + // could overflow + long rcv = processed + len; + return rcv > windowSize && windowSizeExceeded(rcv); + } + + /** + * Called after unprocessed buffered bytes have been + * processed, to release part of the flow control window + * + * @apiNote this method is called only when releasing bytes + * that where buffered after calling + * {@link #canBufferUnprocessedBytes(int)}. + * + * @param delta the amount of processed bytes to release + */ + void processed(int delta) { + assert delta >= 0 : delta; + long rest = unprocessed.addAndGet(-delta); + assert rest >= 0; + update(delta); + } + + /** + * Called when it is desired to release unprocessed bytes + * without processing them, or without triggering the + * sending of a window update. This method can be called + * instead of calling {@link #processed(int)}. + * When this method is called instead of calling {@link #processed(int)}, + * it should generally be followed by a call to {@link #update(int)}, + * unless the stream or connection is being closed. + * + * @apiNote this method should only be called to release bytes that + * have been buffered after calling {@link + * #canBufferUnprocessedBytes(int)}. + * + * @param delta the amount of bytes to release from the window + * + * @return the amount of remaining unprocessed bytes + */ + long released(int delta) { + assert delta >= 0 : delta; + long rest = unprocessed.addAndGet(-delta); + assert rest >= 0; + return rest; + } + + /** + * This method is called to update the flow control window, + * and possibly send a window update + * + * @apiNote this method can be called directly if a frame is + * dropped before calling {@link #canBufferUnprocessedBytes(int)}. + * Otherwise, either {@link #processed(int)} or {@link #released(int)} + * should be called, depending on whether sending a window update + * is desired or not. It is typically not desired to send an update + * if the stream or connection is being closed. + * + * @param delta the amount of bytes released from the window. + */ void update(int delta) { - int rcv = received.addAndGet(delta); + long rcv = received.addAndGet(delta); if (debug.on()) debug.log("update: %d, received: %d, limit: %d", delta, rcv, limit); + if (rcv > windowSize && windowSizeExceeded(rcv)) { + return; + } if (rcv > limit) { sendLock.lock(); try { - int tosend = received.get(); - if( tosend > limit) { - received.getAndAdd(-tosend); + int tosend = (int)Math.min(received.get(), Integer.MAX_VALUE); + if (tosend > limit) { + received.addAndGet(-tosend); sendWindowUpdate(tosend); } } finally { @@ -87,6 +214,7 @@ void update(int delta) { void sendWindowUpdate(int delta) { if (debug.on()) debug.log("sending window update: %d", delta); + assert delta > 0 : "illegal window update delta: " + delta; connection.sendUnorderedFrame(new WindowUpdateFrame(getStreamId(), delta)); } @@ -104,4 +232,16 @@ String dbgString() { } } + /** + * Called when the flow control window size is exceeded + * This method may return false if flow control is disabled + * in this endpoint. + * + * @param received the amount of data received, which is greater + * than {@code windowSize} + * @return {@code true} if the error was reported to the peer + * and no further window update should be sent. + */ + protected abstract boolean windowSizeExceeded(long received); + } diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/common/Utils.java b/src/java.net.http/share/classes/jdk/internal/net/http/common/Utils.java index 222044d1da08..a1759fcd40c1 100644 --- a/src/java.net.http/share/classes/jdk/internal/net/http/common/Utils.java +++ b/src/java.net.http/share/classes/jdk/internal/net/http/common/Utils.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, 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,6 +38,7 @@ import java.lang.System.Logger.Level; import java.net.ConnectException; import java.net.InetSocketAddress; +import java.net.Proxy; import java.net.URI; import java.net.URLPermission; import java.net.http.HttpClient; @@ -193,6 +194,18 @@ private static Set getDisallowedHeaders() { public static final BiPredicate ALLOWED_HEADERS = (header, unused) -> !DISALLOWED_HEADERS_SET.contains(header); + private static final Set DISALLOWED_REDIRECT_HEADERS_SET = getDisallowedRedirectHeaders(); + + private static Set getDisallowedRedirectHeaders() { + Set headers = new TreeSet<>(String.CASE_INSENSITIVE_ORDER); + headers.addAll(Set.of("Authorization", "Cookie", "Origin", "Referer", "Host")); + + return Collections.unmodifiableSet(headers); + } + + public static final BiPredicate + ALLOWED_REDIRECT_HEADERS = (header, unused) -> !DISALLOWED_REDIRECT_HEADERS_SET.contains(header); + public static final BiPredicate VALIDATE_USER_HEADER = (name, value) -> { assert name != null : "null header name"; @@ -314,6 +327,17 @@ public static boolean proxyHasDisabledSchemes(boolean tunnel) { : ! PROXY_AUTH_DISABLED_SCHEMES.isEmpty(); } + /** + * Creates a new {@link Proxy} instance for the given proxy iff it is + * neither null, {@link Proxy#NO_PROXY Proxy.NO_PROXY}, nor already a + * {@code Proxy} instance. + */ + public static Proxy copyProxy(Proxy proxy) { + return proxy == null || proxy.getClass() == Proxy.class + ? proxy + : new Proxy(proxy.type(), proxy.address()); + } + // WebSocket connection Upgrade headers private static final String HEADER_CONNECTION = "Connection"; private static final String HEADER_UPGRADE = "Upgrade"; diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/frame/FramesDecoder.java b/src/java.net.http/share/classes/jdk/internal/net/http/frame/FramesDecoder.java index 72c7750eb43c..7ebfa0908302 100644 --- a/src/java.net.http/share/classes/jdk/internal/net/http/frame/FramesDecoder.java +++ b/src/java.net.http/share/classes/jdk/internal/net/http/frame/FramesDecoder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, 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 @@ -463,6 +463,16 @@ private Http2Frame parseSettingsFrame(int frameLength, int streamid, int flags) int val = getInt(); if (id > 0 && id <= SettingsFrame.MAX_PARAM) { // a known parameter. Ignore otherwise + if (id == SettingsFrame.INITIAL_WINDOW_SIZE && val < 0) { + return new MalformedFrame(ErrorFrame.FLOW_CONTROL_ERROR, + "SettingsFrame with INITIAL_WINDOW_SIZE > 2^31 -1: " + + (val & 0xffffffffL)); + } + if (id == SettingsFrame.MAX_FRAME_SIZE && (val < 16384 || val > 16777215)) { + return new MalformedFrame(ErrorFrame.PROTOCOL_ERROR, + "SettingsFrame with MAX_FRAME_SIZE out of range: " + + (val & 0xffffffffL)); + } sf.setParameter(id, val); // TODO parameters validation } } @@ -530,7 +540,12 @@ private Http2Frame parseWindowUpdateFrame(int frameLength, int streamid, int fla return new MalformedFrame(ErrorFrame.FRAME_SIZE_ERROR, "WindowUpdateFrame length is "+ frameLength+", expected 4"); } - return new WindowUpdateFrame(streamid, getInt() & 0x7fffffff); + int update = getInt(); + if (update < 0) { + return new MalformedFrame(ErrorFrame.FLOW_CONTROL_ERROR, + "WindowUpdateFrame with value > 2^31 -1 " + (update & 0xffffffffL)); + } + return new WindowUpdateFrame(streamid, update & 0x7fffffff); } private Http2Frame parseContinuationFrame(int frameLength, int streamid, int flags) { diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/frame/GoAwayFrame.java b/src/java.net.http/share/classes/jdk/internal/net/http/frame/GoAwayFrame.java index 45ec7553f5af..662e5dd98b30 100644 --- a/src/java.net.http/share/classes/jdk/internal/net/http/frame/GoAwayFrame.java +++ b/src/java.net.http/share/classes/jdk/internal/net/http/frame/GoAwayFrame.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, 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 @@ -57,7 +57,9 @@ int length() { @Override public String toString() { - return super.toString() + " Debugdata: " + new String(debugData, UTF_8); + return super.toString() + + " lastStreamId=" + lastStream + + ", Debugdata: " + new String(debugData, UTF_8); } public int getLastStream() { diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/frame/SettingsFrame.java b/src/java.net.http/share/classes/jdk/internal/net/http/frame/SettingsFrame.java index 8a0119594176..b3b8164598fc 100644 --- a/src/java.net.http/share/classes/jdk/internal/net/http/frame/SettingsFrame.java +++ b/src/java.net.http/share/classes/jdk/internal/net/http/frame/SettingsFrame.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, 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 @@ -166,6 +166,11 @@ public synchronized void update(SettingsFrame updated) { // The initial value is 2^14 (16,384) octets. public static final int DEFAULT_MAX_FRAME_SIZE = 16 * K; + // Initial connection window size. This cannot be updated using the + // SETTINGS frame. + public static final int INITIAL_CONNECTION_WINDOW_SIZE = DEFAULT_INITIAL_WINDOW_SIZE; + + public static SettingsFrame defaultRFCSettings() { SettingsFrame f = new SettingsFrame(); f.setParameter(ENABLE_PUSH, DEFAULT_ENABLE_PUSH); diff --git a/src/java.net.http/share/classes/jdk/internal/net/http/websocket/OpeningHandshake.java b/src/java.net.http/share/classes/jdk/internal/net/http/websocket/OpeningHandshake.java index f88ec774dc0e..cc3887693ed7 100644 --- a/src/java.net.http/share/classes/jdk/internal/net/http/websocket/OpeningHandshake.java +++ b/src/java.net.http/share/classes/jdk/internal/net/http/websocket/OpeningHandshake.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, 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 @@ -64,6 +64,7 @@ import java.util.stream.Stream; import static java.lang.String.format; +import static jdk.internal.net.http.common.Utils.copyProxy; import static jdk.internal.net.http.common.Utils.isValidName; import static jdk.internal.net.http.common.Utils.permissionForProxy; import static jdk.internal.net.http.common.Utils.stringOf; @@ -373,7 +374,7 @@ private static Proxy proxyFor(Optional selector, URI uri) { if (proxy.type() != Proxy.Type.HTTP) { return null; } - return proxy; + return copyProxy(proxy); } /** diff --git a/src/java.net.http/share/classes/module-info.java b/src/java.net.http/share/classes/module-info.java index df0c6fe20f87..5bd49792e38b 100644 --- a/src/java.net.http/share/classes/module-info.java +++ b/src/java.net.http/share/classes/module-info.java @@ -55,9 +55,11 @@ * means that the cache is unbounded. * *

  • {@systemProperty jdk.httpclient.connectionWindowSize} (default: 2^26)
    - * The HTTP/2 client connection window size in bytes. The maximum size is 2^31-1. This value - * cannot be smaller than the stream window size, which can be configured through the - * {@code jdk.httpclient.windowsize} system property. + * The HTTP/2 client connection window size in bytes. Valid values are in the range + * [2^16-1, 2^31-1]. If an invalid value is provided, the default value is used. + * The implementation guarantees that the actual value will be no smaller than the stream + * window size, which can be configured through the {@code jdk.httpclient.windowsize} + * system property. *

  • *
  • {@systemProperty jdk.httpclient.disableRetryConnect} (default: false)
    * Whether automatic retry of connection failures is disabled. If false, then retries are @@ -148,7 +150,8 @@ * or 16kB)
    The buffer size used by the web socket implementation for socket writes. *

  • *
  • {@systemProperty jdk.httpclient.windowsize} (default: 16777216 or 16 MB)
    - * The HTTP/2 client stream window size in bytes. + * The HTTP/2 client stream window size in bytes. Valid values are in the range [2^14, 2^31-1]. + * If an invalid value is provided, the default value is used. *

  • *
  • {@systemProperty jdk.httpclient.auth.retrylimit} (default: 3)
    * The number of attempts the Basic authentication filter will attempt to retry a failed diff --git a/src/java.security.jgss/share/native/libj2gss/GSSLibStub.c b/src/java.security.jgss/share/native/libj2gss/GSSLibStub.c index b801edddfc56..da8e75f80eb9 100644 --- a/src/java.security.jgss/share/native/libj2gss/GSSLibStub.c +++ b/src/java.security.jgss/share/native/libj2gss/GSSLibStub.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2024, 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 @@ -196,7 +196,10 @@ gss_channel_bindings_t newGSSCB(JNIEnv *env, jobject jcb) { return GSS_C_NO_CHANNEL_BINDINGS; } - cb = malloc(sizeof(struct gss_channel_bindings_struct)); + // initialize cb as zeroes to avoid uninitialized pointer being + // freed when deleteGSSCB is called at cleanup. + cb = calloc(1, sizeof(struct gss_channel_bindings_struct)); + if (cb == NULL) { gssThrowOutOfMemoryError(env, NULL); return NULL; @@ -216,9 +219,6 @@ gss_channel_bindings_t newGSSCB(JNIEnv *env, jobject jcb) { cb->initiator_addrtype = GSS_C_AF_NULLADDR; cb->acceptor_addrtype = GSS_C_AF_NULLADDR; } - // addresses needs to be initialized to empty - memset(&cb->initiator_address, 0, sizeof(cb->initiator_address)); - memset(&cb->acceptor_address, 0, sizeof(cb->acceptor_address)); /* set up initiator address */ jinetAddr = (*env)->CallObjectMethod(env, jcb, diff --git a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/XSLTC.java b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/XSLTC.java index 9a256efc5a1f..644bc4d28fc6 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/XSLTC.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/compiler/XSLTC.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -57,7 +57,7 @@ * @author G. Todd Miller * @author Morten Jorgensen * @author John Howard (johnh@schemasoft.com) - * @LastModified: Jan 2022 + * @LastModified: Feb 2025 */ public final class XSLTC { @@ -730,7 +730,6 @@ public boolean setDestDirectory(String dstDirName) { */ public void setPackageName(String packageName) { _packageName = Objects.requireNonNull(packageName); - if (_className != null) setClassName(_className); } /** diff --git a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerFactoryImpl.java b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerFactoryImpl.java index a93c76b41f47..91a4fb080c9f 100644 --- a/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerFactoryImpl.java +++ b/src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerFactoryImpl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2025, Oracle and/or its affiliates. All rights reserved. */ /* * Licensed to the Apache Software Foundation (ASF) under one or more @@ -88,7 +88,7 @@ * @author G. Todd Miller * @author Morten Jorgensen * @author Santiago Pericas-Geertsen - * @LastModified: Jan 2022 + * @LastModified: Feb 2025 */ public class TransformerFactoryImpl extends SAXTransformerFactory implements SourceLoader @@ -1004,9 +1004,6 @@ public Templates newTemplates(Source source) // Set the attributes for translet generation int outputType = XSLTC.BYTEARRAY_OUTPUT; if (_generateTranslet || _autoTranslet) { - // Set the translet name - xsltc.setClassName(getTransletBaseName(source)); - if (_destinationDirectory != null) xsltc.setDestDirectory(_destinationDirectory); else { @@ -1020,8 +1017,11 @@ public Templates newTemplates(Source source) } } + // set package name if (_packageName != null) xsltc.setPackageName(_packageName); + // Set the translet name + xsltc.setClassName(getTransletBaseName(source)); if (_jarFileName != null) { xsltc.setJarFileName(_jarFileName); diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/DeferredAttr.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/DeferredAttr.java index bc43c427a347..56249fefad98 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/DeferredAttr.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/DeferredAttr.java @@ -1089,7 +1089,10 @@ private Type recover(DeferredType dt, Type pt) { boolean isLambdaOrMemberRef = dt.tree.hasTag(REFERENCE) || dt.tree.hasTag(LAMBDA); boolean needsRecoveryType = - pt == null || (isLambdaOrMemberRef && !types.isFunctionalInterface(pt)); + pt == null || + ((dt instanceof ArgumentAttr.ArgumentType at) && + at.speculativeTypes.values().stream().allMatch(type -> type.hasTag(ERROR))) || + (isLambdaOrMemberRef && !types.isFunctionalInterface(pt)); Type ptRecovery = needsRecoveryType ? Type.recoveryType: pt; dt.check(attr.new RecoveryInfo(deferredAttrContext, ptRecovery) { @Override diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java index ac24377997d3..1371323531ef 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/jvm/ClassReader.java @@ -37,6 +37,8 @@ import java.util.Map; import java.util.Set; import java.util.function.IntFunction; +import java.util.function.Predicate; +import java.util.stream.IntStream; import javax.lang.model.element.Modifier; import javax.lang.model.element.NestingKind; @@ -60,6 +62,7 @@ import com.sun.tools.javac.jvm.ClassFile.Version; import com.sun.tools.javac.jvm.PoolConstant.NameAndType; import com.sun.tools.javac.main.Option; +import com.sun.tools.javac.resources.CompilerProperties.Errors; import com.sun.tools.javac.resources.CompilerProperties.Fragments; import com.sun.tools.javac.resources.CompilerProperties.Warnings; import com.sun.tools.javac.util.*; @@ -128,6 +131,8 @@ public class ClassReader { */ public boolean saveParameterNames; + private final boolean addTypeAnnotationsToSymbol; + /** * The currently selected profile. */ @@ -294,6 +299,8 @@ protected ClassReader(Context context) { lintClassfile = Lint.instance(context).isEnabled(LintCategory.CLASSFILE); + addTypeAnnotationsToSymbol = options.getBoolean("addTypeAnnotationsToSymbol", false); + initAttributeReaders(); } @@ -2255,12 +2262,309 @@ public void run() { currentClassFile = classFile; List newList = deproxyTypeCompoundList(proxies); sym.setTypeAttributes(newList.prependList(sym.getRawTypeAttributes())); + if (addTypeAnnotationsToSymbol) { + addTypeAnnotationsToSymbol(sym, newList); + } } finally { currentClassFile = previousClassFile; } } } + /** + * Rewrites types in the given symbol to include type annotations. + * + *

    The list of type annotations includes annotations for all types in the signature of the + * symbol. Associating the annotations with the correct type requires interpreting the JVMS + * 4.7.20-A target_type to locate the correct type to rewrite, and then interpreting the JVMS + * 4.7.20.2 type_path to associate the annotation with the correct contained type. + */ + private void addTypeAnnotationsToSymbol(Symbol s, List attributes) { + try { + new TypeAnnotationSymbolVisitor(attributes).visit(s, null); + } catch (CompletionFailure ex) { + JavaFileObject prev = log.useSource(currentClassFile); + try { + log.error(Errors.CantAttachTypeAnnotations(attributes, s.owner, s.name, ex.getDetailValue())); + } finally { + log.useSource(prev); + } + } + } + + private static class TypeAnnotationSymbolVisitor + extends Types.DefaultSymbolVisitor { + + private final List attributes; + + private TypeAnnotationSymbolVisitor(List attributes) { + this.attributes = attributes; + } + + /** + * A supertype_index value of 65535 specifies that the annotation appears on the superclass + * in an extends clause of a class declaration, see JVMS 4.7.20.1 + */ + public static final int SUPERCLASS_INDEX = 65535; + + @Override + public Void visitClassSymbol(Symbol.ClassSymbol s, Void unused) { + ClassType t = (ClassType) s.type; + int i = 0; + ListBuffer interfaces = new ListBuffer<>(); + for (Type itf : t.interfaces_field) { + interfaces.add(addTypeAnnotations(itf, classExtends(i++))); + } + t.interfaces_field = interfaces.toList(); + t.supertype_field = addTypeAnnotations(t.supertype_field, classExtends(SUPERCLASS_INDEX)); + if (t.typarams_field != null) { + t.typarams_field = + rewriteTypeParameters( + t.typarams_field, TargetType.CLASS_TYPE_PARAMETER_BOUND); + } + return null; + } + + @Override + public Void visitMethodSymbol(Symbol.MethodSymbol s, Void unused) { + Type t = s.type; + if (t.hasTag(TypeTag.FORALL)) { + Type.ForAll fa = (Type.ForAll) t; + fa.tvars = rewriteTypeParameters(fa.tvars, TargetType.METHOD_TYPE_PARAMETER_BOUND); + t = fa.qtype; + } + MethodType mt = (MethodType) t; + ListBuffer argtypes = new ListBuffer<>(); + int i = 0; + for (Symbol.VarSymbol param : s.params) { + param.type = addTypeAnnotations(param.type, methodFormalParameter(i++)); + argtypes.add(param.type); + } + mt.argtypes = argtypes.toList(); + ListBuffer thrown = new ListBuffer<>(); + i = 0; + for (Type thrownType : mt.thrown) { + thrown.add(addTypeAnnotations(thrownType, thrownType(i++))); + } + mt.thrown = thrown.toList(); + /* possible information loss if the type of the method is void then we can't add type + * annotations to it + */ + if (!mt.restype.hasTag(TypeTag.VOID)) { + mt.restype = addTypeAnnotations(mt.restype, TargetType.METHOD_RETURN); + } + if (mt.recvtype != null) { + mt.recvtype = addTypeAnnotations(mt.recvtype, TargetType.METHOD_RECEIVER); + } + return null; + } + + @Override + public Void visitVarSymbol(Symbol.VarSymbol s, Void unused) { + s.type = addTypeAnnotations(s.type, TargetType.FIELD); + return null; + } + + @Override + public Void visitSymbol(Symbol s, Void unused) { + return null; + } + + private List rewriteTypeParameters(List tvars, TargetType boundType) { + ListBuffer tvarbuf = new ListBuffer<>(); + int typeVariableIndex = 0; + for (Type tvar : tvars) { + Type bound = tvar.getUpperBound(); + if (bound.isCompound()) { + ClassType ct = (ClassType) bound; + int boundIndex = 0; + if (ct.supertype_field != null) { + ct.supertype_field = + addTypeAnnotations( + ct.supertype_field, + typeParameterBound( + boundType, typeVariableIndex, boundIndex++)); + } + ListBuffer itfbuf = new ListBuffer<>(); + for (Type itf : ct.interfaces_field) { + itfbuf.add( + addTypeAnnotations( + itf, + typeParameterBound( + boundType, typeVariableIndex, boundIndex++))); + } + ct.interfaces_field = itfbuf.toList(); + } else { + bound = + addTypeAnnotations( + bound, + typeParameterBound( + boundType, + typeVariableIndex, + bound.isInterface() ? 1 : 0)); + } + ((TypeVar) tvar).setUpperBound(bound); + tvarbuf.add(tvar); + typeVariableIndex++; + } + return tvarbuf.toList(); + } + + private Type addTypeAnnotations(Type type, TargetType targetType) { + return addTypeAnnotations(type, pos -> pos.type == targetType); + } + + private Type addTypeAnnotations(Type type, Predicate filter) { + Assert.checkNonNull(type); + + // Find type annotations that match the given target type + ListBuffer filtered = new ListBuffer<>(); + for (Attribute.TypeCompound attribute : this.attributes) { + if (filter.test(attribute.position)) { + filtered.add(attribute); + } + } + if (filtered.isEmpty()) { + return type; + } + + // Group the matching annotations by their type path. Each group of annotations will be + // added to a type at that location. + Map, ListBuffer> + attributesByPath = new HashMap<>(); + for (Attribute.TypeCompound attribute : filtered.toList()) { + attributesByPath + .computeIfAbsent(attribute.position.location, k -> new ListBuffer<>()) + .add(attribute); + } + + // Rewrite the type and add the annotations + type = new TypeAnnotationStructuralTypeMapping(attributesByPath).visit(type, List.nil()); + + return type; + } + + private static Predicate typeParameterBound( + TargetType targetType, int parameterIndex, int boundIndex) { + return pos -> + pos.type == targetType + && pos.parameter_index == parameterIndex + && pos.bound_index == boundIndex; + } + + private static Predicate methodFormalParameter(int index) { + return pos -> + pos.type == TargetType.METHOD_FORMAL_PARAMETER && pos.parameter_index == index; + } + + private static Predicate thrownType(int index) { + return pos -> pos.type == TargetType.THROWS && pos.type_index == index; + } + + private static Predicate classExtends(int index) { + return pos -> pos.type == TargetType.CLASS_EXTENDS && pos.type_index == index; + } + } + + /** + * A type mapping that rewrites the type to include type annotations. + * + *

    This logic is similar to {@link Type.StructuralTypeMapping}, but also tracks the path to + * the contained types being rewritten, and so cannot easily share the existing logic. + */ + private static final class TypeAnnotationStructuralTypeMapping + extends Types.TypeMapping> { + + private final Map, + ListBuffer> attributesByPath; + + private TypeAnnotationStructuralTypeMapping( + Map, ListBuffer> + attributesByPath) { + this.attributesByPath = attributesByPath; + } + + + @Override + public Type visitClassType(ClassType t, List path) { + // As described in JVMS 4.7.20.2, type annotations on nested types are located with + // 'left-to-right' steps starting on 'the outermost part of the type for which a type + // annotation is admissible'. So the current path represents the outermost containing + // type of the type being visited, and we add type path steps for every contained nested + // type. + Type outer = t.getEnclosingType(); + Type outer1 = outer != Type.noType ? visit(outer, path) : outer; + for (Type curr = t.getEnclosingType(); + curr != Type.noType; + curr = curr.getEnclosingType()) { + path = path.append(TypeAnnotationPosition.TypePathEntry.INNER_TYPE); + } + List typarams = t.getTypeArguments(); + List typarams1 = rewriteTypeParams(path, typarams); + if (outer1 != outer || typarams != typarams1) { + t = new ClassType(outer1, typarams1, t.tsym, t.getMetadata()); + } + return reannotate(t, path); + } + + private List rewriteTypeParams( + List path, List typarams) { + var i = IntStream.iterate(0, x -> x + 1).iterator(); + return typarams.map(typaram -> visit(typaram, + path.append(new TypeAnnotationPosition.TypePathEntry( + TypeAnnotationPosition.TypePathEntryKind.TYPE_ARGUMENT, i.nextInt())))); + } + + @Override + public Type visitWildcardType( + WildcardType wt, List path) { + Type t = wt.type; + if (t != null) { + t = visit(t, path.append(TypeAnnotationPosition.TypePathEntry.WILDCARD)); + } + if (t != wt.type) { + wt = new WildcardType(t, wt.kind, wt.tsym, wt.bound, wt.getMetadata()); + } + return reannotate(wt, path); + } + + @Override + public Type visitArrayType(ArrayType t, List path) { + Type elemtype = t.elemtype; + Type elemtype1 = + visit(elemtype, path.append(TypeAnnotationPosition.TypePathEntry.ARRAY)); + if (elemtype1 != elemtype) { + t = new ArrayType(elemtype1, t.tsym, t.getMetadata()); + } + return reannotate(t, path); + } + + @Override + public Type visitType(Type t, List path) { + return reannotate(t, path); + } + + Type reannotate(Type type, List path) { + List attributes = attributesForPath(path); + if (attributes.isEmpty()) { + return type; + } + // Runtime-visible and -invisible annotations are completed separately, so if the same + // type has annotations from both it will get annotated twice. + TypeMetadata.Annotations existing = type.getMetadata(TypeMetadata.Annotations.class); + if (existing != null) { + existing.annotationBuffer().addAll(attributes); + return type; + } + return type.annotatedType(attributes); + } + + List attributesForPath( + List path) { + ListBuffer attributes = attributesByPath.remove(path); + return attributes != null ? attributes.toList() : List.nil(); + } + } /************************************************************************ * Reading Symbols diff --git a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties index c53b5356d674..e54c27beff85 100644 --- a/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties +++ b/src/jdk.compiler/share/classes/com/sun/tools/javac/resources/compiler.properties @@ -2304,6 +2304,11 @@ compiler.warn.annotation.method.not.found=\ compiler.warn.annotation.method.not.found.reason=\ Cannot find annotation method ''{1}()'' in type ''{0}'': {2} +# 0: list of annotation, 1: symbol, 2: name, 3: message segment +compiler.err.cant.attach.type.annotations=\ + Cannot attach type annotations {0} to {1}.{2}:\n\ + {3} + # 0: file object, 1: symbol, 2: name compiler.warn.unknown.enum.constant=\ unknown enum constant {1}.{2} diff --git a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11Key.java b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11Key.java index 01fc06ae2837..f8dd5a71c2cf 100644 --- a/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11Key.java +++ b/src/jdk.crypto.cryptoki/share/classes/sun/security/pkcs11/P11Key.java @@ -580,47 +580,73 @@ static class P11RSAPrivateKeyInternal extends P11PrivateKey { static P11RSAPrivateKeyInternal of(Session session, long keyID, String algorithm, int keyLength, CK_ATTRIBUTE[] attrs, boolean keySensitive) { - if (keySensitive) { - return new P11RSAPrivateKeyInternal(session, keyID, algorithm, + P11RSAPrivateKeyInternal p11Key = null; + if (!keySensitive) { + // Key is not sensitive: try to interpret as CRT or non-CRT. + p11Key = asCRT(session, keyID, algorithm, keyLength, attrs); + if (p11Key == null) { + p11Key = asNonCRT(session, keyID, algorithm, keyLength, + attrs); + } + } + if (p11Key == null) { + // Key is sensitive or there was a failure while querying its + // attributes: handle as opaque. + p11Key = new P11RSAPrivateKeyInternal(session, keyID, algorithm, keyLength, attrs); - } else { - CK_ATTRIBUTE[] rsaAttrs = new CK_ATTRIBUTE[] { - new CK_ATTRIBUTE(CKA_MODULUS), - new CK_ATTRIBUTE(CKA_PRIVATE_EXPONENT), - new CK_ATTRIBUTE(CKA_PUBLIC_EXPONENT), - new CK_ATTRIBUTE(CKA_PRIME_1), - new CK_ATTRIBUTE(CKA_PRIME_2), - new CK_ATTRIBUTE(CKA_EXPONENT_1), - new CK_ATTRIBUTE(CKA_EXPONENT_2), - new CK_ATTRIBUTE(CKA_COEFFICIENT), - }; - boolean isCRT = true; - Session tempSession = null; - try { - tempSession = session.token.getOpSession(); - session.token.p11.C_GetAttributeValue(tempSession.id(), - keyID, rsaAttrs); - for (CK_ATTRIBUTE attr : rsaAttrs) { - isCRT &= (attr.pValue instanceof byte[]); - if (!isCRT) break; + } + return p11Key; + } + + private static CK_ATTRIBUTE[] tryFetchAttributes(Session session, + long keyID, long... attrTypes) { + int i = 0; + CK_ATTRIBUTE[] attrs = new CK_ATTRIBUTE[attrTypes.length]; + for (long attrType : attrTypes) { + attrs[i++] = new CK_ATTRIBUTE(attrType); + } + try { + session.token.p11.C_GetAttributeValue(session.id(), keyID, + attrs); + for (CK_ATTRIBUTE attr : attrs) { + if (!(attr.pValue instanceof byte[])) { + return null; } - } catch (PKCS11Exception e) { - // ignore, assume not available - isCRT = false; - } finally { - session.token.releaseSession(tempSession); - } - BigInteger n = rsaAttrs[0].getBigInteger(); - BigInteger d = rsaAttrs[1].getBigInteger(); - if (isCRT) { - return new P11RSAPrivateKey(session, keyID, algorithm, - keyLength, attrs, n, d, - Arrays.copyOfRange(rsaAttrs, 2, rsaAttrs.length)); - } else { - return new P11RSAPrivateNonCRTKey(session, keyID, - algorithm, keyLength, attrs, n, d); } + return attrs; + } catch (PKCS11Exception ignored) { + // ignore, assume not available + return null; + } + } + + private static P11RSAPrivateKeyInternal asCRT(Session session, + long keyID, String algorithm, int keyLength, + CK_ATTRIBUTE[] attrs) { + CK_ATTRIBUTE[] rsaCRTAttrs = tryFetchAttributes(session, keyID, + CKA_MODULUS, CKA_PRIVATE_EXPONENT, CKA_PUBLIC_EXPONENT, + CKA_PRIME_1, CKA_PRIME_2, CKA_EXPONENT_1, CKA_EXPONENT_2, + CKA_COEFFICIENT); + if (rsaCRTAttrs == null) { + return null; + } + return new P11RSAPrivateKey(session, keyID, algorithm, keyLength, + attrs, rsaCRTAttrs[0].getBigInteger(), + rsaCRTAttrs[1].getBigInteger(), + Arrays.copyOfRange(rsaCRTAttrs, 2, rsaCRTAttrs.length)); + } + + private static P11RSAPrivateKeyInternal asNonCRT(Session session, + long keyID, String algorithm, int keyLength, + CK_ATTRIBUTE[] attrs) { + CK_ATTRIBUTE[] rsaNonCRTAttrs = tryFetchAttributes(session, keyID, + CKA_MODULUS, CKA_PRIVATE_EXPONENT); + if (rsaNonCRTAttrs == null) { + return null; } + return new P11RSAPrivateNonCRTKey(session, keyID, algorithm, + keyLength, attrs, rsaNonCRTAttrs[0].getBigInteger(), + rsaNonCRTAttrs[1].getBigInteger()); } protected transient BigInteger n; diff --git a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/HSDB.java b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/HSDB.java index 9cc51934d08c..dd813197bc05 100644 --- a/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/HSDB.java +++ b/src/jdk.hotspot.agent/share/classes/sun/jvm/hotspot/HSDB.java @@ -1096,7 +1096,9 @@ public void addAnnotation(Address addr, OopHandle handle) { G1CollectedHeap heap = (G1CollectedHeap)collHeap; HeapRegion region = heap.hrm().getByAddress(handle); - if (region.isFree()) { + if (region == null) { + // intentionally skip + } else if (region.isFree()) { anno = "Free "; bad = false; } else if (region.isYoung()) { diff --git a/src/jdk.internal.jvmstat/share/classes/sun/jvmstat/monitor/MonitoredHost.java b/src/jdk.internal.jvmstat/share/classes/sun/jvmstat/monitor/MonitoredHost.java index 12969fa670ed..b2ead4ffd145 100644 --- a/src/jdk.internal.jvmstat/share/classes/sun/jvmstat/monitor/MonitoredHost.java +++ b/src/jdk.internal.jvmstat/share/classes/sun/jvmstat/monitor/MonitoredHost.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2023, 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 @@ -50,7 +50,7 @@ * @see HostListener */ public abstract class MonitoredHost { - private static Map monitoredHosts = + private static final Map monitoredHosts = new HashMap(); /* @@ -133,13 +133,6 @@ public static MonitoredHost getMonitoredHost(VmIdentifier vmid) return getMonitoredHost(hostId); } - - /* - * Load the MonitoredHostServices - */ - private static ServiceLoader monitoredHostServiceLoader = - ServiceLoader.load(MonitoredHostService.class, MonitoredHostService.class.getClassLoader()); - /** * Factory method to construct a MonitoredHost instance to manage the * connection to the host indicated by {@code hostId}. @@ -167,9 +160,12 @@ public static MonitoredHost getMonitoredHost(HostIdentifier hostId) hostId = resolveHostId(hostId); - for (MonitoredHostService mhs : monitoredHostServiceLoader) { + ServiceLoader services = ServiceLoader.load( + MonitoredHostService.class, MonitoredHostService.class.getClassLoader()); + for (MonitoredHostService mhs : services) { if (mhs.getScheme().equals(hostId.getScheme())) { mh = mhs.getMonitoredHost(hostId); + break; } } diff --git a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/JdkConsoleProviderImpl.java b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/JdkConsoleProviderImpl.java index f89467631109..542578ff6094 100644 --- a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/JdkConsoleProviderImpl.java +++ b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/JdkConsoleProviderImpl.java @@ -51,7 +51,9 @@ public class JdkConsoleProviderImpl implements JdkConsoleProvider { public JdkConsole console(boolean isTTY, Charset charset) { try { Terminal terminal = TerminalBuilder.builder().encoding(charset) - .exec(false).build(); + .exec(false) + .nativeSignals(false) + .build(); return new JdkConsoleImpl(terminal); } catch (IllegalStateException ise) { //cannot create a non-dumb, non-exec terminal, diff --git a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/utils/PumpReader.java b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/utils/PumpReader.java index ce68fa5f84e9..12e9795c6f51 100644 --- a/src/jdk.internal.le/share/classes/jdk/internal/org/jline/utils/PumpReader.java +++ b/src/jdk.internal.le/share/classes/jdk/internal/org/jline/utils/PumpReader.java @@ -413,7 +413,7 @@ public int read() throws IOException { return EOF; } - return buffer.get(); + return buffer.get() & 0xFF; } private boolean readUsingBuffer() throws IOException { diff --git a/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/ConsoleIOContext.java b/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/ConsoleIOContext.java index fde9b6cadb71..71b5ebb93c06 100644 --- a/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/ConsoleIOContext.java +++ b/src/jdk.jshell/share/classes/jdk/internal/jshell/tool/ConsoleIOContext.java @@ -158,7 +158,7 @@ public int readBuffered(byte[] b) throws IOException { terminal = TerminalBuilder.builder().inputStreamWrapper(in -> { input.setInputStream(in); return nonBlockingInput; - }).build(); + }).nativeSignals(false).build(); useComplexDeprecationHighlight = !OSUtils.IS_WINDOWS; } this.allowIncompleteInputs = allowIncompleteInputs; diff --git a/src/jdk.naming.dns/share/classes/com/sun/jndi/dns/DnsClient.java b/src/jdk.naming.dns/share/classes/com/sun/jndi/dns/DnsClient.java index 0d5ca39c6f74..23ea00635fd1 100644 --- a/src/jdk.naming.dns/share/classes/com/sun/jndi/dns/DnsClient.java +++ b/src/jdk.naming.dns/share/classes/com/sun/jndi/dns/DnsClient.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2024, 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 @@ -46,11 +46,15 @@ import javax.naming.OperationNotSupportedException; import javax.naming.ServiceUnavailableException; +import java.time.Duration; import java.util.Arrays; import java.util.Collections; import java.util.Map; import java.util.HashMap; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.locks.ReentrantLock; +import java.util.stream.IntStream; import jdk.internal.ref.CleanerFactory; import sun.security.jca.JCAUtil; @@ -95,7 +99,7 @@ public class DnsClient { private static final int DEFAULT_PORT = 53; private static final int TRANSACTION_ID_BOUND = 0x10000; - private static final int MIN_TIMEOUT = 50; // msec after which there are no retries. + private static final int MIN_TIMEOUT = 0; // msec after which there are no retries. private static final SecureRandom random = JCAUtil.getSecureRandom(); private InetAddress[] servers; private int[] serverPorts; @@ -223,20 +227,28 @@ ResourceRecords query(DnsName fqdn, int qclass, int qtype, Exception caughtException = null; boolean[] doNotRetry = new boolean[servers.length]; - + // Holder for unfulfilled timeouts left for each server + AtomicLong[] unfulfilledUdpTimeouts = IntStream.range(0, servers.length) + .mapToObj(AtomicLong::new) + .toArray(AtomicLong[]::new); try { // // The UDP retry strategy is to try the 1st server, and then // each server in order. If no answer, double the timeout // and try each server again. // - for (int retry = 0; retry < retries; retry++) { - + for (int retry = 0; retry <= retries; retry++) { + boolean isLastRetry = retry == retries; // Try each name server. for (int i = 0; i < servers.length; i++) { if (doNotRetry[i]) { continue; } + // unfulfilledServerTimeout is always >= 0 + AtomicLong unfulfilledServerTimeout = unfulfilledUdpTimeouts[i]; + if (isLastRetry && unfulfilledServerTimeout.get() == 0) { + continue; + } // send the request packet and wait for a response. try { @@ -245,7 +257,7 @@ ResourceRecords query(DnsName fqdn, int qclass, int qtype, } byte[] msg = doUdpQuery(pkt, servers[i], serverPorts[i], - retry, xid); + retry, xid, unfulfilledServerTimeout, isLastRetry); assert msg != null; Header hdr = new Header(msg, msg.length); @@ -259,7 +271,12 @@ ResourceRecords query(DnsName fqdn, int qclass, int qtype, // Try each server, starting with the one that just // provided the truncated message. - int retryTimeout = (timeout * (1 << retry)); + long retryTimeout = Math.clamp( + timeout * (1L << (isLastRetry + ? retry - 1 + : retry)), + 0L, Integer.MAX_VALUE); + ; for (int j = 0; j < servers.length; j++) { int ij = (i + j) % servers.length; if (doNotRetry[ij]) { @@ -301,15 +318,23 @@ ResourceRecords query(DnsName fqdn, int qclass, int qtype, if (debug) { dprint("Caught Exception:" + ex); } - if (caughtException == null) { + if (caughtException == null || servers.length == 1) { + // If there are several servers we continue trying with other + // servers, otherwise this exception will be reported caughtException = ex; + } else { + // Best reporting effort + caughtException.addSuppressed(ex); } doNotRetry[i] = true; } catch (IOException e) { if (debug) { dprint("Caught IOException:" + e); } - if (caughtException == null) { + if (caughtException instanceof CommunicationException ce) { + e.addSuppressed(ce); + caughtException = e; + } else if (caughtException == null) { caughtException = e; } } catch (ClosedSelectorException e) { @@ -327,8 +352,13 @@ ResourceRecords query(DnsName fqdn, int qclass, int qtype, caughtException = e; } } catch (NamingException e) { - if (caughtException == null) { + if (caughtException == null || servers.length == 1) { + // If there are several servers we continue trying with other + // servers, otherwise this exception will be reported caughtException = e; + } else { + // Best reporting effort + caughtException.addSuppressed(e); } doNotRetry[i] = true; } @@ -339,8 +369,8 @@ ResourceRecords query(DnsName fqdn, int qclass, int qtype, reqs.remove(xid); // cleanup } - if (caughtException instanceof NamingException) { - throw (NamingException) caughtException; + if (caughtException instanceof NamingException ne) { + throw ne; } // A network timeout or other error occurred. NamingException ne = new CommunicationException("DNS error"); @@ -424,10 +454,32 @@ ResourceRecords queryZone(DnsName zone, int qclass, boolean recursion) * is enqueued with the corresponding xid in 'resps'. */ private byte[] doUdpQuery(Packet pkt, InetAddress server, - int port, int retry, int xid) + int port, int retry, int xid, + AtomicLong unfulfilledTimeout, + boolean unfulfilledOnly) throws IOException, NamingException { udpChannelLock.lock(); + + + // use 1L below to ensure conversion to long and avoid potential + // integer overflow (timeout is an int). + // no point in supporting timeout > Integer.MAX_VALUE, clamp if needed + // timeout remaining after successive 'blockingReceive()'. + long thisIterationTimeout = unfulfilledOnly + ? 0L + : Math.clamp(timeout * (1L << retry), 0L, Integer.MAX_VALUE); + + // Compensate with server's positive unfulfilled timeout. + // Calling method never supplies zero 'unfulfilledTimeout' when + // 'unfulfilledOnly' is 'true', therefore 'thisIterationTimeout' + // will always be a positive number, ie infinite timeout + // is not possible. + thisIterationTimeout += unfulfilledTimeout.get(); + + // Track left timeout for the current retry + long timeoutLeft = thisIterationTimeout; + long start = 0; try { try (DatagramChannel udpChannel = getDatagramChannel()) { ByteBuffer opkt = ByteBuffer.wrap(pkt.getData(), 0, pkt.length()); @@ -436,13 +488,11 @@ private byte[] doUdpQuery(Packet pkt, InetAddress server, // Packets may only be sent to or received from this server address InetSocketAddress target = new InetSocketAddress(server, port); udpChannel.connect(target); - int pktTimeout = (timeout * (1 << retry)); udpChannel.write(opkt); - // timeout remaining after successive 'blockingReceive()' - int timeoutLeft = pktTimeout; int cnt = 0; boolean gotData = false; + start = System.nanoTime(); do { // prepare for retry if (gotData) { @@ -456,9 +506,7 @@ private byte[] doUdpQuery(Packet pkt, InetAddress server, ") for:" + xid + " sock-timeout:" + timeoutLeft + " ms."); } - long start = System.currentTimeMillis(); - gotData = blockingReceive(udpChannel, ipkt, timeoutLeft); - long end = System.currentTimeMillis(); + gotData = blockingReceive(udpChannel, target, ipkt, timeoutLeft); assert gotData || ipkt.position() == 0; if (gotData && isMatchResponse(data, xid)) { return data; @@ -471,17 +519,23 @@ private byte[] doUdpQuery(Packet pkt, InetAddress server, return cachedMsg; } } - timeoutLeft = pktTimeout - ((int) (end - start)); + long elapsedMillis = TimeUnit.NANOSECONDS + .toMillis(System.nanoTime() - start); + timeoutLeft = thisIterationTimeout - elapsedMillis; } while (timeoutLeft > MIN_TIMEOUT); // no matching packets received within the timeout throw new SocketTimeoutException(); } } finally { + long carryoverTimeout = thisIterationTimeout - + TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - start); + unfulfilledTimeout.set(Math.max(0, carryoverTimeout)); udpChannelLock.unlock(); } } - boolean blockingReceive(DatagramChannel dc, ByteBuffer buffer, long timeout) throws IOException { + boolean blockingReceive(DatagramChannel dc, InetSocketAddress target, + ByteBuffer buffer, long timeout) throws IOException { boolean dataReceived = false; // The provided datagram channel will be used by the caller only to receive data after // it is put to non-blocking mode @@ -491,10 +545,15 @@ boolean blockingReceive(DatagramChannel dc, ByteBuffer buffer, long timeout) thr udpChannelSelector.select(timeout); var keys = udpChannelSelector.selectedKeys(); if (keys.contains(selectionKey) && selectionKey.isReadable()) { - dc.receive(buffer); - dataReceived = true; + int before = buffer.position(); + var senderAddress = dc.receive(buffer); + // Empty packets are ignored + dataReceived = target.equals(senderAddress) && buffer.position() > before; + } + // Avoid contention with Selector.close() if called by a clean-up thread + synchronized (keys) { + keys.clear(); } - keys.clear(); } finally { selectionKey.cancel(); // Flush the canceled key out of the selected key set @@ -750,14 +809,19 @@ class Tcp { private final Socket sock; private final java.io.InputStream in; final java.io.OutputStream out; - private int timeoutLeft; + private long timeoutLeft; - Tcp(InetAddress server, int port, int timeout) throws IOException { + Tcp(InetAddress server, int port, long timeout) throws IOException { sock = new Socket(); try { - long start = System.currentTimeMillis(); - sock.connect(new InetSocketAddress(server, port), timeout); - timeoutLeft = (int) (timeout - (System.currentTimeMillis() - start)); + long start = System.nanoTime(); + // It is safe to cast to int since the value is + // clamped by the caller + int intTimeout = (int) timeout; + sock.connect(new InetSocketAddress(server, port), intTimeout); + timeoutLeft = Duration.ofMillis(timeout) + .minus(Duration.ofNanos((System.nanoTime() - start))) + .toMillis(); if (timeoutLeft <= 0) throw new SocketTimeoutException(); @@ -785,14 +849,16 @@ private interface SocketReadOp { private int readWithTimeout(SocketReadOp reader) throws IOException { if (timeoutLeft <= 0) throw new SocketTimeoutException(); - - sock.setSoTimeout(timeoutLeft); - long start = System.currentTimeMillis(); + // It is safe to cast to int since the value is clamped + int intTimeout = (int) timeoutLeft; + sock.setSoTimeout(intTimeout); + long start = System.nanoTime(); try { return reader.read(); } finally { - timeoutLeft -= (int) (System.currentTimeMillis() - start); + timeoutLeft -= TimeUnit.NANOSECONDS.toMillis( + System.nanoTime() - start); } } diff --git a/src/jdk.naming.dns/share/classes/com/sun/jndi/dns/DnsContext.java b/src/jdk.naming.dns/share/classes/com/sun/jndi/dns/DnsContext.java index 028108494af8..fe35a4979cc3 100644 --- a/src/jdk.naming.dns/share/classes/com/sun/jndi/dns/DnsContext.java +++ b/src/jdk.naming.dns/share/classes/com/sun/jndi/dns/DnsContext.java @@ -176,13 +176,13 @@ public Object addToEnvironment(String propName, Object propVal) } else if (propName.equals(INIT_TIMEOUT)) { int val = Integer.parseInt((String) propVal); if (timeout != val) { - timeout = val; + timeout = Math.max(val, 0); resolver = null; } } else if (propName.equals(RETRIES)) { int val = Integer.parseInt((String) propVal); if (retries != val) { - retries = val; + retries = Math.clamp(val, 1, 30); resolver = null; } } @@ -257,11 +257,11 @@ private void initFromEnvironment() val = (String) environment.get(INIT_TIMEOUT); timeout = (val == null) ? DEFAULT_INIT_TIMEOUT - : Integer.parseInt(val); + : Math.max(Integer.parseInt(val), 0); val = (String) environment.get(RETRIES); retries = (val == null) ? DEFAULT_RETRIES - : Integer.parseInt(val); + : Math.clamp(Integer.parseInt(val), 1, 30); } private CT getLookupCT(String attrId) diff --git a/src/utils/LogCompilation/src/main/java/com/sun/hotspot/tools/compiler/LogParser.java b/src/utils/LogCompilation/src/main/java/com/sun/hotspot/tools/compiler/LogParser.java index 09a852d05c76..e1e305abe109 100644 --- a/src/utils/LogCompilation/src/main/java/com/sun/hotspot/tools/compiler/LogParser.java +++ b/src/utils/LogCompilation/src/main/java/com/sun/hotspot/tools/compiler/LogParser.java @@ -1082,6 +1082,7 @@ public void startElement(String uri, String localName, String qname, Attributes site.setReason("succeed: " + search(atts, "reason")); } else if (qname.equals("failure")) { failureReason = search(atts, "reason"); + lateInlining = false; } else if (qname.equals("task_done")) { compile.setEnd(Double.parseDouble(search(atts, "stamp"))); if (Integer.parseInt(search(atts, "success")) == 0) { diff --git a/src/utils/LogCompilation/src/test/java/com/sun/hotspot/tools/compiler/TestPrebuiltLogs.java b/src/utils/LogCompilation/src/test/java/com/sun/hotspot/tools/compiler/TestPrebuiltLogs.java new file mode 100644 index 000000000000..b7c587b98f95 --- /dev/null +++ b/src/utils/LogCompilation/src/test/java/com/sun/hotspot/tools/compiler/TestPrebuiltLogs.java @@ -0,0 +1,87 @@ +/* + * Copyright Amazon.com Inc. 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.sun.hotspot.tools.compiler; + +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; + +import java.io.File; +import java.io.FilenameFilter; +import java.util.ArrayList; +import java.util.Collection; +import java.util.List; + +@RunWith(value = Parameterized.class) +public class TestPrebuiltLogs { + private String logFile; + static List tests = new ArrayList(); + + // BeforeClass is invoked after @Parameters, so we use static block to evaluate tests first. + static { + File file = new File("src/test/resources"); + File[] testData = file.listFiles(new FilenameFilter() { + @Override + public boolean accept(File dir, String name) { + return name.endsWith(".xml"); + } + }); + + for (File f: testData) { + tests.add(f.toString()); + } + } + + @Parameters + public static Collection data() { + return tests; + } + + public TestPrebuiltLogs(String logFile) { + this.logFile = logFile; + } + + void doItOrFail(String[] args) { + try { + LogCompilation.main(args); + } catch (Throwable e) { + e.printStackTrace(); + Assert.fail(e.getMessage()); + } + } + + @Test + public void testDashi() throws Exception { + String[] args = {"-i", logFile}; + doItOrFail(args); + } + + @Test + public void testNone() throws Exception { + String[] args = {logFile}; + doItOrFail(args); + } +} diff --git a/src/utils/LogCompilation/src/test/resources/8314319.xml b/src/utils/LogCompilation/src/test/resources/8314319.xml new file mode 100644 index 000000000000..789025c790e2 --- /dev/null +++ b/src/utils/LogCompilation/src/test/resources/8314319.xml @@ -0,0 +1,526 @@ + + + + +OpenJDK 64-Bit Server VM + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/test/failure_handler/src/share/conf/mac.properties b/test/failure_handler/src/share/conf/mac.properties index 1a5d48f2bdc9..6a1c9fb4e777 100644 --- a/test/failure_handler/src/share/conf/mac.properties +++ b/test/failure_handler/src/share/conf/mac.properties @@ -1,5 +1,5 @@ # -# Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2015, 2024, 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 @@ -71,6 +71,9 @@ native.core.timeout=600000 cores=native.lldb native.lldb.app=lldb native.lldb.delimiter=\0 +# Core files can be very big and take a long time to load on macosx-aarch64. +# The 20 seconds default timeout is not nearly enough. +native.lldb.timeout=120000 # Assume that java standard laucher has been used native.lldb.args=--core\0%p\0%java\0-o\0thread backtrace all\0-o\0quit diff --git a/test/hotspot/gtest/compiler/test_directivesParser.cpp b/test/hotspot/gtest/compiler/test_directivesParser.cpp index 35f1855e5ccf..7b78186316e6 100644 --- a/test/hotspot/gtest/compiler/test_directivesParser.cpp +++ b/test/hotspot/gtest/compiler/test_directivesParser.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2024, 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 diff --git a/test/hotspot/gtest/gc/g1/test_freeRegionList.cpp b/test/hotspot/gtest/gc/g1/test_freeRegionList.cpp index a32fcdea938d..1ad21b0d9a0c 100644 --- a/test/hotspot/gtest/gc/g1/test_freeRegionList.cpp +++ b/test/hotspot/gtest/gc/g1/test_freeRegionList.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -44,7 +44,7 @@ TEST_VM(FreeRegionList, length) { // Create a fake heap. It does not need to be valid, as the HeapRegion constructor // does not access it. - MemRegion heap(NULL, num_regions_in_test * HeapRegion::GrainWords); + MemRegion heap(nullptr, num_regions_in_test * HeapRegion::GrainWords); // Allocate a fake BOT because the HeapRegion constructor initializes // the BOT. diff --git a/test/hotspot/gtest/gc/g1/test_g1CardSet.cpp b/test/hotspot/gtest/gc/g1/test_g1CardSet.cpp index f788ba996da7..c455deacb26c 100644 --- a/test/hotspot/gtest/gc/g1/test_g1CardSet.cpp +++ b/test/hotspot/gtest/gc/g1/test_g1CardSet.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2024, 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 @@ -50,7 +50,7 @@ class G1CardSetTest : public ::testing::Test { static uint _max_workers; static WorkerThreads* workers() { - if (_workers == NULL) { + if (_workers == nullptr) { _max_workers = os::processor_count(); _workers = new WorkerThreads("G1CardSetTest Workers", _max_workers); _workers->initialize_workers(); @@ -87,7 +87,7 @@ class G1CardSetTest : public ::testing::Test { static void iterate_cards(G1CardSet* card_set, G1CardSet::CardClosure* cl); }; -WorkerThreads* G1CardSetTest::_workers = NULL; +WorkerThreads* G1CardSetTest::_workers = nullptr; uint G1CardSetTest::_max_workers = 0; void G1CardSetTest::add_cards(G1CardSet* card_set, uint cards_per_region, uint* cards, uint num_cards, G1AddCardResult* results) { @@ -97,7 +97,7 @@ void G1CardSetTest::add_cards(G1CardSet* card_set, uint cards_per_region, uint* uint card_idx = cards[i] % cards_per_region; G1AddCardResult res = card_set->add_card(region_idx, card_idx); - if (results != NULL) { + if (results != nullptr) { ASSERT_TRUE(res == results[i]); } } @@ -269,7 +269,7 @@ void G1CardSetTest::cardset_basic_test() { translate_cards(CardsPerRegion, 100, &cards1[0], 4); translate_cards(CardsPerRegion, 990, &cards1[4], 4); - add_cards(&card_set, CardsPerRegion, cards1, ARRAY_SIZE(cards1), NULL); + add_cards(&card_set, CardsPerRegion, cards1, ARRAY_SIZE(cards1), nullptr); contains_cards(&card_set, CardsPerRegion, cards1, ARRAY_SIZE(cards1)); ASSERT_TRUE(card_set.occupied() == ARRAY_SIZE(cards1)); @@ -291,7 +291,7 @@ void G1CardSetTest::cardset_basic_test() { cards1[i] = i + 3; translate_cards(CardsPerRegion, i, &cards1[i], 1); } - add_cards(&card_set, CardsPerRegion, cards1, ARRAY_SIZE(cards1), NULL); + add_cards(&card_set, CardsPerRegion, cards1, ARRAY_SIZE(cards1), nullptr); contains_cards(&card_set, CardsPerRegion, cards1, ARRAY_SIZE(cards1)); ASSERT_TRUE(card_set.num_containers() == ARRAY_SIZE(cards1)); diff --git a/test/hotspot/gtest/gc/g1/test_stressCommitUncommit.cpp b/test/hotspot/gtest/gc/g1/test_stressCommitUncommit.cpp index 1366ec0c34ca..8ce98827ab2e 100644 --- a/test/hotspot/gtest/gc/g1/test_stressCommitUncommit.cpp +++ b/test/hotspot/gtest/gc/g1/test_stressCommitUncommit.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,7 +34,7 @@ class G1MapperWorkers : AllStatic { static WorkerThreads* _workers; static WorkerThreads* workers() { - if (_workers == NULL) { + if (_workers == nullptr) { _workers = new WorkerThreads("G1 Small Workers", MaxWorkers); _workers->initialize_workers(); _workers->set_active_workers(MaxWorkers); @@ -48,7 +48,7 @@ class G1MapperWorkers : AllStatic { workers()->run_task(task); } }; -WorkerThreads* G1MapperWorkers::_workers = NULL; +WorkerThreads* G1MapperWorkers::_workers = nullptr; class G1TestCommitUncommit : public WorkerTask { G1RegionToSpaceMapper* _mapper; diff --git a/test/hotspot/gtest/gc/shared/test_ptrQueueBufferAllocator.cpp b/test/hotspot/gtest/gc/shared/test_bufferNodeAllocator.cpp similarity index 96% rename from test/hotspot/gtest/gc/shared/test_ptrQueueBufferAllocator.cpp rename to test/hotspot/gtest/gc/shared/test_bufferNodeAllocator.cpp index e5741eeb914d..843831c198dd 100644 --- a/test/hotspot/gtest/gc/shared/test_ptrQueueBufferAllocator.cpp +++ b/test/hotspot/gtest/gc/shared/test_bufferNodeAllocator.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2024, 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 @@ */ #include "precompiled.hpp" -#include "gc/shared/ptrQueue.hpp" +#include "gc/shared/bufferNode.hpp" #include "memory/allocation.hpp" #include "runtime/atomic.hpp" #include "runtime/interfaceSupport.inline.hpp" @@ -51,7 +51,7 @@ typedef BufferNode::TestSupport::AllocatorThread AllocatorThread; typedef BufferNode::TestSupport::ProcessorThread ProcessorThread; // Some basic testing of BufferNode::Allocator. -TEST_VM(PtrQueueBufferAllocatorTest, test) { +TEST_VM(BufferNodeAllocatorTest, test) { const size_t buffer_size = 256; BufferNode::Allocator allocator("Test Buffer Allocator", buffer_size); ASSERT_EQ(buffer_size, allocator.buffer_size()); @@ -62,7 +62,7 @@ TEST_VM(PtrQueueBufferAllocatorTest, test) { for (size_t i = 0; i < node_count; ++i) { ASSERT_EQ(0u, allocator.free_count()); nodes[i] = allocator.allocate(); - ASSERT_EQ((BufferNode*)NULL, nodes[i]->next()); + ASSERT_EQ(nullptr, nodes[i]->next()); } // Release the nodes, adding them to the allocator's free list. @@ -102,7 +102,7 @@ class BufferNode::TestSupport::CompletedList { } void push(BufferNode* node) { - assert(node != NULL, "precondition"); + assert(node != nullptr, "precondition"); _completed_list.push(*node); } @@ -169,7 +169,7 @@ class BufferNode::TestSupport::ProcessorThread : public JavaTestThread { bool shutdown_requested = false; while (true) { BufferNode* node = _cbl->pop(); - if (node != NULL) { + if (node != nullptr) { _allocator->release(node); } else if (shutdown_requested) { return; @@ -235,7 +235,7 @@ static void run_test(BufferNode::Allocator* allocator, CompletedList* cbl) { const size_t buffer_size = 1024; -TEST_VM(PtrQueueBufferAllocatorTest, stress_free_list_allocator) { +TEST_VM(BufferNodeAllocatorTest, stress_free_list_allocator) { BufferNode::Allocator allocator("Test Allocator", buffer_size); CompletedList completed; run_test(&allocator, &completed); diff --git a/test/hotspot/gtest/gc/shared/test_collectedHeap.cpp b/test/hotspot/gtest/gc/shared/test_collectedHeap.cpp index a308907a0a47..081eb351fc6a 100644 --- a/test/hotspot/gtest/gc/shared/test_collectedHeap.cpp +++ b/test/hotspot/gtest/gc/shared/test_collectedHeap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,8 +32,8 @@ TEST_VM(CollectedHeap, is_in) { uintptr_t epsilon = (uintptr_t) MinObjAlignment; uintptr_t outside_heap = (uintptr_t) ε - // Test that NULL is not in the heap. - ASSERT_FALSE(heap->is_in(NULL)) << "NULL is unexpectedly in the heap"; + // Test that nullptr is not in the heap. + ASSERT_FALSE(heap->is_in(nullptr)) << "null is unexpectedly in the heap"; // Test that a pointer to outside the heap start is reported as outside the heap. ASSERT_FALSE(heap->is_in((void*)outside_heap)) << "outside_heap: " << outside_heap diff --git a/test/hotspot/gtest/gc/shared/test_collectorPolicy.cpp b/test/hotspot/gtest/gc/shared/test_collectorPolicy.cpp index dfe096248c77..e0120c0351f3 100644 --- a/test/hotspot/gtest/gc/shared/test_collectorPolicy.cpp +++ b/test/hotspot/gtest/gc/shared/test_collectorPolicy.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2024, 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,18 +69,18 @@ class TestGenCollectorPolicy { FLAG_SET_ERGO(InitialHeapSize, 100 * M); FLAG_SET_ERGO(OldSize, 4 * M); FLAG_SET_ERGO(NewSize, 1 * M); - FLAG_SET_ERGO(MaxNewSize, 80 * M); + FLAG_SET_ERGO(MaxNewSize, 50 * M); ASSERT_NO_FATAL_FAILURE(setter1->execute()); - if (setter2 != NULL) { + if (setter2 != nullptr) { ASSERT_NO_FATAL_FAILURE(setter2->execute()); } ASSERT_NO_FATAL_FAILURE(checker->execute()); } static void test(Executor* setter, Executor* checker) { - test(setter, NULL, checker); + test(setter, nullptr, checker); } }; @@ -212,6 +212,9 @@ class TestGenCollectorPolicy { // depends on so many other configurable variables. These tests only try to // verify that there are some basic rules for NewSize honored by the policies. +// Tests require at least 128M of MaxHeap +// otherwise ergonomic is different and generation sizes might be changed. + // If NewSize has been ergonomically set, the collector policy // should use it for min TEST_VM(CollectorPolicy, young_min_ergo) { @@ -225,6 +228,9 @@ TEST_VM(CollectorPolicy, young_min_ergo) { // should use it for min but calculate the initial young size // using NewRatio. TEST_VM(CollectorPolicy, young_scaled_initial_ergo) { + if (MaxHeapSize < 128 * M) { + return; + } TestGenCollectorPolicy::SetNewSizeErgo setter(20 * M); TestGenCollectorPolicy::CheckScaledYoungInitial checker; @@ -237,6 +243,9 @@ TEST_VM(CollectorPolicy, young_scaled_initial_ergo) { // the rest of the VM lifetime. This is an irreversible change and // could impact other tests so we use TEST_OTHER_VM TEST_OTHER_VM(CollectorPolicy, young_cmd) { + if (MaxHeapSize < 128 * M) { + return; + } // If NewSize is set on the command line, it should be used // for both min and initial young size if less than min heap. TestGenCollectorPolicy::SetNewSizeCmd setter(20 * M); @@ -249,8 +258,8 @@ TEST_OTHER_VM(CollectorPolicy, young_cmd) { // If NewSize is set on command line, but is larger than the min // heap size, it should only be used for initial young size. - TestGenCollectorPolicy::SetNewSizeCmd setter_large(80 * M); - TestGenCollectorPolicy::CheckYoungInitial checker_large(80 * M); + TestGenCollectorPolicy::SetNewSizeCmd setter_large(50 * M); + TestGenCollectorPolicy::CheckYoungInitial checker_large(50 * M); TestGenCollectorPolicy::TestWrapper::test(&setter_large, &checker_large); } diff --git a/test/hotspot/gtest/gc/shared/test_oopStorage.cpp b/test/hotspot/gtest/gc/shared/test_oopStorage.cpp index 30e39888e0a5..6758c61325a2 100644 --- a/test/hotspot/gtest/gc/shared/test_oopStorage.cpp +++ b/test/hotspot/gtest/gc/shared/test_oopStorage.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -104,13 +104,13 @@ typedef TestAccess::Block OopBlock; typedef TestAccess::AllocationList AllocationList; typedef TestAccess::ActiveArray ActiveArray; -// Using EXPECT_EQ can't use NULL directly. Otherwise AIX build breaks. -const OopBlock* const NULL_BLOCK = NULL; +// Using EXPECT_EQ can't use nullptr directly. Otherwise AIX build breaks. +const OopBlock* const NULL_BLOCK = nullptr; static size_t list_length(const AllocationList& list) { size_t result = 0; for (const OopBlock* block = list.chead(); - block != NULL; + block != nullptr; block = list.next(*block)) { ++result; } @@ -119,14 +119,14 @@ static size_t list_length(const AllocationList& list) { static void clear_list(AllocationList& list) { OopBlock* next; - for (OopBlock* block = list.head(); block != NULL; block = next) { + for (OopBlock* block = list.head(); block != nullptr; block = next) { next = list.next(*block); list.unlink(*block); } } static bool is_list_empty(const AllocationList& list) { - return list.chead() == NULL; + return list.chead() == nullptr; } static bool process_deferred_updates(OopStorage& storage) { @@ -139,7 +139,7 @@ static bool process_deferred_updates(OopStorage& storage) { } static void release_entry(OopStorage& storage, oop* entry, bool process_deferred = true) { - *entry = NULL; + *entry = nullptr; storage.release(entry); if (process_deferred) { process_deferred_updates(storage); @@ -150,7 +150,7 @@ static size_t empty_block_count(const OopStorage& storage) { const AllocationList& list = TestAccess::allocation_list(storage); size_t count = 0; for (const OopBlock* block = list.ctail(); - (block != NULL) && block->is_empty(); + (block != nullptr) && block->is_empty(); ++count, block = list.prev(*block)) {} return count; @@ -164,7 +164,7 @@ static OopBlock* active_head(const OopStorage& storage) { ActiveArray& ba = TestAccess::active_array(storage); size_t count = ba.block_count(); if (count == 0) { - return NULL; + return nullptr; } else { return ba.at(count - 1); } @@ -203,7 +203,7 @@ class OopStorageTestWithAllocation : public OopStorageTest { OopStorageTestWithAllocation::OopStorageTestWithAllocation() { for (size_t i = 0; i < _max_entries; ++i) { _entries[i] = storage().allocate(); - EXPECT_TRUE(_entries[i] != NULL); + EXPECT_TRUE(_entries[i] != nullptr); EXPECT_EQ(i + 1, storage().allocation_count()); } }; @@ -215,8 +215,8 @@ static bool is_allocation_list_sorted(const OopStorage& storage) { // blocks are segregated to the end of the list. const AllocationList& list = TestAccess::allocation_list(storage); const OopBlock* block = list.ctail(); - for ( ; (block != NULL) && block->is_empty(); block = list.prev(*block)) {} - for ( ; block != NULL; block = list.prev(*block)) { + for ( ; (block != nullptr) && block->is_empty(); block = list.prev(*block)) {} + for ( ; block != nullptr; block = list.prev(*block)) { if (block->is_empty()) { return false; } @@ -239,7 +239,7 @@ TEST_VM_F(OopStorageTest, allocate_one) { EXPECT_TRUE(is_list_empty(TestAccess::allocation_list(storage()))); oop* ptr = storage().allocate(); - EXPECT_TRUE(ptr != NULL); + EXPECT_TRUE(ptr != nullptr); EXPECT_EQ(1u, storage().allocation_count()); EXPECT_EQ(1u, active_count(storage())); @@ -249,7 +249,7 @@ TEST_VM_F(OopStorageTest, allocate_one) { EXPECT_EQ(0u, empty_block_count(storage())); const OopBlock* block = TestAccess::allocation_list(storage()).chead(); - EXPECT_NE(block, (OopBlock*)NULL); + EXPECT_NE(block, (OopBlock*)nullptr); EXPECT_EQ(block, active_head(storage())); EXPECT_FALSE(TestAccess::block_is_empty(*block)); EXPECT_FALSE(TestAccess::block_is_full(*block)); @@ -326,7 +326,7 @@ TEST_VM_F(OopStorageTest, allocate_many) { EXPECT_EQ(0u, empty_block_count(storage())); entries[0] = storage().allocate(); - ASSERT_TRUE(entries[0] != NULL); + ASSERT_TRUE(entries[0] != nullptr); EXPECT_EQ(1u, active_count(storage())); EXPECT_EQ(1u, storage().block_count()); EXPECT_EQ(1u, list_length(allocation_list)); @@ -339,10 +339,10 @@ TEST_VM_F(OopStorageTest, allocate_many) { for (size_t i = 1; i < max_entries; ++i) { entries[i] = storage().allocate(); EXPECT_EQ(i + 1, storage().allocation_count()); - ASSERT_TRUE(entries[i] != NULL); + ASSERT_TRUE(entries[i] != nullptr); EXPECT_EQ(0u, empty_block_count(storage())); - if (block == NULL) { + if (block == nullptr) { ASSERT_FALSE(is_list_empty(allocation_list)); EXPECT_EQ(1u, list_length(allocation_list)); block = allocation_list.chead(); @@ -350,7 +350,7 @@ TEST_VM_F(OopStorageTest, allocate_many) { EXPECT_EQ(block, active_head(storage())); } else if (TestAccess::block_is_full(*block)) { EXPECT_TRUE(is_list_empty(allocation_list)); - block = NULL; + block = nullptr; } else { EXPECT_FALSE(is_list_empty(allocation_list)); EXPECT_EQ(block, allocation_list.chead()); @@ -358,7 +358,7 @@ TEST_VM_F(OopStorageTest, allocate_many) { } } - if (block != NULL) { + if (block != nullptr) { EXPECT_NE(0u, TestAccess::block_allocation_count(*block)); EXPECT_FALSE(is_list_empty(allocation_list)); EXPECT_EQ(block, allocation_list.chead()); @@ -375,7 +375,7 @@ TEST_VM_F(OopStorageTest, allocate_many) { EXPECT_EQ(active_count(storage()), storage().block_count()); EXPECT_EQ(active_count(storage()), empty_block_count(storage())); for (const OopBlock* block = allocation_list.chead(); - block != NULL; + block != nullptr; block = allocation_list.next(*block)) { EXPECT_TRUE(TestAccess::block_is_empty(*block)); } @@ -395,9 +395,9 @@ TEST_VM_F(OopStorageTestWithAllocation, random_release) { // Release all entries in "random" order. size_t released = 0; for (size_t i = 0; released < _max_entries; i = (i + step) % _max_entries) { - if (_entries[i] != NULL) { + if (_entries[i] != nullptr) { release_entry(storage(), _entries[i]); - _entries[i] = NULL; + _entries[i] = nullptr; ++released; EXPECT_EQ(_max_entries - released, total_allocation_count(storage())); EXPECT_TRUE(is_allocation_list_sorted(storage())); @@ -427,9 +427,9 @@ TEST_VM_F(OopStorageTestWithAllocation, random_allocate_release) { size_t released = 0; size_t total_released = 0; for (size_t i = 0; released < _max_entries; i = (i + release_step) % _max_entries) { - if (_entries[i] != NULL) { + if (_entries[i] != nullptr) { release_entry(storage(), _entries[i]); - _entries[i] = NULL; + _entries[i] = nullptr; ++released; ++total_released; EXPECT_EQ(_max_entries - released, total_allocation_count(storage())); @@ -458,7 +458,7 @@ class OopStorageTestBlockRelease : public OopStorageTestWithAllocation { for (size_t i = 0; i < nrelease; ++i) { to_release[i] = _entries[2 * i]; - *to_release[i] = NULL; + *to_release[i] = nullptr; } if (sorted) { QuickSort::sort(to_release, nrelease, PointerCompare(), false); @@ -509,7 +509,7 @@ TEST_VM_F(OopStorageTest, bulk_allocation) { EXPECT_EQ(OopStorage::ALLOCATED_ENTRY, storage().allocation_status(entries[i])); } for (size_t i = allocated; i < max_entries; ++i) { - EXPECT_EQ(NULL, entries[i]); + EXPECT_EQ(nullptr, entries[i]); } storage().release(entries, allocated); EXPECT_EQ(0u, storage().allocation_count()); @@ -546,14 +546,14 @@ class OopStorageTest::CountingIterateClosure { void do_oop(const oop* ptr) { ++_const_count; - if (*ptr != NULL) { + if (*ptr != nullptr) { ++_const_non_null; } } void do_oop(oop* ptr) { ++_non_const_count; - if (*ptr != NULL) { + if (*ptr != nullptr) { ++_non_const_non_null; } } @@ -595,7 +595,7 @@ TEST_VM_F(OopStorageTest, simple_iterate) { for (size_t i = 0; i < max_entries; i += 10) { for ( ; allocated < i; ++allocated) { entries[allocated] = storage().allocate(); - ASSERT_TRUE(entries[allocated] != NULL); + ASSERT_TRUE(entries[allocated] != nullptr); if ((allocated % 3) != 0) { *entries[allocated] = dummy_oop; ++entries_with_values; @@ -872,10 +872,10 @@ class OopStorageTestParIteration : public OopStorageTestIteration { static WorkerThreads* _workers; }; -WorkerThreads* OopStorageTestParIteration::_workers = NULL; +WorkerThreads* OopStorageTestParIteration::_workers = nullptr; WorkerThreads* OopStorageTestParIteration::workers() { - if (_workers == NULL) { + if (_workers == nullptr) { _workers = new WorkerThreads("OopStorageTestParIteration workers", _max_workers); _workers->initialize_workers(); _workers->set_active_workers(_max_workers); @@ -1074,7 +1074,7 @@ TEST_VM_F(OopStorageTest, usage_info) { while (storage().block_count() == this_count) { ASSERT_GT(ARRAY_SIZE(entries), allocated); entries[allocated] = storage().allocate(); - ASSERT_TRUE(entries[allocated] != NULL); + ASSERT_TRUE(entries[allocated] != nullptr); ++allocated; } EXPECT_NE(0u, storage().block_count()); @@ -1092,13 +1092,13 @@ TEST_VM_F(OopStorageTestWithAllocation, print_storage) { for (size_t i = 0; i < (_max_entries / 2); ++i) { // Deferred updates don't affect print output. release_entry(storage(), _entries[i], false); - _entries[i] = NULL; + _entries[i] = nullptr; } // Release every other remaining for (size_t i = _max_entries / 2; i < _max_entries; i += 2) { // Deferred updates don't affect print output. release_entry(storage(), _entries[i], false); - _entries[i] = NULL; + _entries[i] = nullptr; } size_t expected_entries = _max_entries / 4; diff --git a/test/hotspot/gtest/gc/shared/test_oopStorage_parperf.cpp b/test/hotspot/gtest/gc/shared/test_oopStorage_parperf.cpp index 905859af80bc..8df179eaac3e 100644 --- a/test/hotspot/gtest/gc/shared/test_oopStorage_parperf.cpp +++ b/test/hotspot/gtest/gc/shared/test_oopStorage_parperf.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2024, 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 @@ -74,10 +74,10 @@ class OopStorageParIterPerf : public ::testing::Test { oop* _entries[_storage_entries]; }; -WorkerThreads* OopStorageParIterPerf::_workers = NULL; +WorkerThreads* OopStorageParIterPerf::_workers = nullptr; WorkerThreads* OopStorageParIterPerf::workers() const { - if (_workers == NULL) { + if (_workers == nullptr) { WorkerThreads* wg = new WorkerThreads("OopStorageParIterPerf workers", _num_workers); wg->initialize_workers(); wg->set_active_workers(_num_workers); @@ -126,7 +126,7 @@ class OopStorageParIterPerf::Task : public WorkerTask { public: Task(OopStorage* storage, OopClosure* closure, uint nthreads) : WorkerTask("OopStorageParIterPerf::Task"), - _worker_times(NULL), + _worker_times(nullptr), _state(storage, nthreads), _closure(closure) { @@ -152,7 +152,7 @@ class OopStorageParIterPerf::Task : public WorkerTask { class OopStorageParIterPerf::Closure : public OopClosure { public: - virtual void do_oop(oop* p) { guarantee(*p == NULL, "expected NULL"); } + virtual void do_oop(oop* p) { guarantee(*p == nullptr, "expected null"); } virtual void do_oop(narrowOop* p) { ShouldNotReachHere(); } }; diff --git a/test/hotspot/gtest/gc/shared/test_workerDataArray.cpp b/test/hotspot/gtest/gc/shared/test_workerDataArray.cpp index 0c52dae6b7db..65ce88523ae5 100644 --- a/test/hotspot/gtest/gc/shared/test_workerDataArray.cpp +++ b/test/hotspot/gtest/gc/shared/test_workerDataArray.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,7 +34,7 @@ class WorkerDataArrayTest : public ::testing::Test { protected: WorkerDataArrayTest() : title("Test array"), - array(NULL, title, 3), + array(nullptr, title, 3), sub_item_title("Sub item array") { array.create_thread_work_items(sub_item_title); diff --git a/test/hotspot/gtest/gc/x/test_xAddress.cpp b/test/hotspot/gtest/gc/x/test_xAddress.cpp index 4307cc53b3bf..3f769dc7eead 100644 --- a/test/hotspot/gtest/gc/x/test_xAddress.cpp +++ b/test/hotspot/gtest/gc/x/test_xAddress.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, 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 @@ -123,7 +123,7 @@ TEST_F(XAddressTest, is_weak_good_or_null) { << " is_remaped: " << XAddress::is_remapped(value) \ << " is_good_or_null_or_remapped: " << XAddress::is_weak_good_or_null(value) - check_is_weak_good_or_null((uintptr_t)NULL); + check_is_weak_good_or_null((uintptr_t)nullptr); check_is_weak_good_or_null(XAddressMetadataMarked0); check_is_weak_good_or_null(XAddressMetadataMarked1); check_is_weak_good_or_null(XAddressMetadataRemapped); diff --git a/test/hotspot/gtest/gtestMain.cpp b/test/hotspot/gtest/gtestMain.cpp index 248ffdaa3ac7..0bd251e8094b 100644 --- a/test/hotspot/gtest/gtestMain.cpp +++ b/test/hotspot/gtest/gtestMain.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2024, 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 @@ -130,7 +130,7 @@ class JVMInitializerListener : public ::testing::EmptyTestEventListener { } void destroy_jvm() { - if (_jvm != NULL) { + if (_jvm != nullptr) { int ret = _jvm->DestroyJavaVM(); if (ret != 0) { fprintf(stderr, "Warning: DestroyJavaVM error %d\n", ret); @@ -151,7 +151,7 @@ static char* get_java_home_arg(int argc, char** argv) { return argv[i] + strlen("-jdk:"); } } - return NULL; + return nullptr; } static bool get_spawn_new_main_thread_arg(int argc, char** argv) { @@ -244,7 +244,7 @@ static void runUnitTestsInner(int argc, char** argv) { } char* java_home = get_java_home_arg(argc, argv); - if (java_home == NULL) { + if (java_home == nullptr) { fprintf(stderr, "ERROR: You must specify a JDK (-jdk , --jdk= or -jdk:) to use for running the unit tests.\n"); os::exit(1); } @@ -270,10 +270,10 @@ static void runUnitTestsInner(int argc, char** argv) { argv = remove_test_runner_arguments(&argc, argv); - JVMInitializerListener* jvm_listener = NULL; + JVMInitializerListener* jvm_listener = nullptr; if (is_vmassert_test || is_othervm_test) { - JavaVM* jvm = NULL; + JavaVM* jvm = nullptr; // both vmassert and other vm tests require inited jvm // but only vmassert tests disable hs_err and core file generation int ret; @@ -300,7 +300,7 @@ static void runUnitTestsInner(int argc, char** argv) { os::exit(2); } - if (jvm_listener != NULL) { + if (jvm_listener != nullptr) { jvm_listener->destroy_jvm(); } } @@ -323,8 +323,8 @@ static DWORD WINAPI thread_wrapper(void* p) { static void run_in_new_thread(const args_t* args) { HANDLE hdl; - hdl = CreateThread(NULL, STACK_SIZE, thread_wrapper, (void*)args, 0, NULL); - if (hdl == NULL) { + hdl = CreateThread(nullptr, STACK_SIZE, thread_wrapper, (void*)args, 0, nullptr); + if (hdl == nullptr) { fprintf(stderr, "Failed to create main thread\n"); os::exit(2); } @@ -336,7 +336,7 @@ static void run_in_new_thread(const args_t* args) { extern "C" void* thread_wrapper(void* p) { const args_t* const p_args = (const args_t*) p; runUnitTestsInner(p_args->argc, p_args->argv); - return 0; + return nullptr; } static void run_in_new_thread(const args_t* args) { @@ -351,7 +351,7 @@ static void run_in_new_thread(const args_t* args) { os::exit(2); } - if (pthread_join(tid, NULL) != 0) { + if (pthread_join(tid, nullptr) != 0) { fprintf(stderr, "Failed to join main thread\n"); os::exit(2); } diff --git a/test/hotspot/gtest/jfr/test_adaptiveSampler.cpp b/test/hotspot/gtest/jfr/test_adaptiveSampler.cpp index 35ae0eda9978..324037f4934f 100644 --- a/test/hotspot/gtest/jfr/test_adaptiveSampler.cpp +++ b/test/hotspot/gtest/jfr/test_adaptiveSampler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020, Datadog, Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -200,7 +200,7 @@ class JfrGTestAdaptiveSampling : public ::testing::Test { }; void JfrGTestAdaptiveSampling::test(JfrGTestAdaptiveSampling::incoming inc, size_t sample_points_per_window, double error_factor, const char* const description) { - assert(description != NULL, "invariant"); + assert(description != nullptr, "invariant"); char output[1024] = "Adaptive sampling: "; strcat(output, description); fprintf(stdout, "=== %s\n", output); diff --git a/test/hotspot/gtest/jfr/test_networkUtilization.cpp b/test/hotspot/gtest/jfr/test_networkUtilization.cpp index 1fcfcf351a6c..f4d8c81b3fd6 100644 --- a/test/hotspot/gtest/jfr/test_networkUtilization.cpp +++ b/test/hotspot/gtest/jfr/test_networkUtilization.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2024, 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 @@ -123,7 +123,7 @@ namespace { public: MockJfrOSInterface() {} static int network_utilization(NetworkInterface** network_interfaces) { - *network_interfaces = NULL; + *network_interfaces = nullptr; for (std::list::const_iterator i = _interfaces.begin(); i != _interfaces.end(); ++i) { diff --git a/test/hotspot/gtest/jfr/test_threadCpuLoad.cpp b/test/hotspot/gtest/jfr/test_threadCpuLoad.cpp index b8bad0d699b6..65b16270a4cb 100644 --- a/test/hotspot/gtest/jfr/test_threadCpuLoad.cpp +++ b/test/hotspot/gtest/jfr/test_threadCpuLoad.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -82,14 +82,14 @@ namespace { class MockJfrJavaThreadIterator { public: - MockJavaThread* next() { return NULL; } + MockJavaThread* next() { return nullptr; } bool has_next() const { return false; } }; class MockJfrJavaThreadIteratorAdapter { public: - MockJavaThread* next() { return NULL; } + MockJavaThread* next() { return nullptr; } bool has_next() const { return false; } }; diff --git a/test/hotspot/gtest/logging/logTestFixture.cpp b/test/hotspot/gtest/logging/logTestFixture.cpp index 843e13144b99..ce64e6936e95 100644 --- a/test/hotspot/gtest/logging/logTestFixture.cpp +++ b/test/hotspot/gtest/logging/logTestFixture.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,7 +32,7 @@ #include "unittest.hpp" #include "utilities/ostream.hpp" -LogTestFixture::LogTestFixture() : _n_snapshots(0), _configuration_snapshot(NULL) { +LogTestFixture::LogTestFixture() : _n_snapshots(0), _configuration_snapshot(nullptr) { // Set up TestLogFileName to include temp_dir, PID, testcase name and test name. const testing::TestInfo* test_info = ::testing::UnitTest::GetInstance()->current_test_info(); @@ -98,19 +98,19 @@ void LogTestFixture::restore_config() { char* decorators = str; str = strchr(str, ' '); - if (str != NULL) { + if (str != nullptr) { // This output has options. However, UL doesn't allow the options of any // output to be changed, so they cannot be modified by the tests, // and also we cannot change them here. So just mark the end of the // decorators. *str++ = '\0'; } - set_log_config(name, selection, decorators, /* options = */ NULL); + set_log_config(name, selection, decorators, /* options = */ nullptr); } } void LogTestFixture::clear_snapshot() { - if (_configuration_snapshot == NULL) { + if (_configuration_snapshot == nullptr) { return; } ASSERT_GT(_n_snapshots, size_t(0)) << "non-null array should have at least 1 element"; @@ -118,6 +118,6 @@ void LogTestFixture::clear_snapshot() { os::free(_configuration_snapshot[i]); } FREE_C_HEAP_ARRAY(char*, _configuration_snapshot); - _configuration_snapshot = NULL; + _configuration_snapshot = nullptr; _n_snapshots = 0; } diff --git a/test/hotspot/gtest/logging/logTestUtils.inline.hpp b/test/hotspot/gtest/logging/logTestUtils.inline.hpp index 7b36b80f46e1..93cace9c689d 100644 --- a/test/hotspot/gtest/logging/logTestUtils.inline.hpp +++ b/test/hotspot/gtest/logging/logTestUtils.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2024, 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,7 +38,7 @@ static const char* invalid_selection_substr[] = { }; static inline bool string_contains_substring(const char* haystack, const char* needle) { - return strstr(haystack, needle) != NULL; + return strstr(haystack, needle) != nullptr; } static inline bool file_exists(const char* filename) { @@ -60,7 +60,7 @@ static inline void create_directory(const char* name) { ASSERT_FALSE(file_exists(name)) << "can't create directory: " << name << " already exists"; bool failed; #ifdef _WINDOWS - failed = !CreateDirectory(name, NULL); + failed = !CreateDirectory(name, nullptr); #else failed = mkdir(name, 0777); #endif @@ -115,16 +115,16 @@ static inline char* prepend_prefix_temp_dir(const char* prefix, const char* file } // Read a complete line from fp and return it as a resource allocated string. -// Returns NULL on EOF. +// Returns nullptr on EOF. static inline char* read_line(FILE* fp) { - assert(fp != NULL, "invalid fp"); + assert(fp != nullptr, "invalid fp"); int buflen = 512; char* buf = NEW_RESOURCE_ARRAY(char, buflen); long pos = ftell(fp); - if (pos < 0) return NULL; + if (pos < 0) return nullptr; char* ret = fgets(buf, buflen, fp); - while (ret != NULL && buf[strlen(buf) - 1] != '\n' && !feof(fp)) { + while (ret != nullptr && buf[strlen(buf) - 1] != '\n' && !feof(fp)) { // retry with a larger buffer buf = REALLOC_RESOURCE_ARRAY(char, buf, buflen, buflen * 2); buflen *= 2; @@ -139,19 +139,19 @@ static inline char* read_line(FILE* fp) { static bool file_contains_substrings_in_order(const char* filename, const char* substrs[]) { AsyncLogWriter::flush(); FILE* fp = os::fopen(filename, "r"); - assert(fp != NULL, "error opening file %s: %s", filename, os::strerror(errno)); + assert(fp != nullptr, "error opening file %s: %s", filename, os::strerror(errno)); size_t idx = 0; - while (substrs[idx] != NULL) { + while (substrs[idx] != nullptr) { ResourceMark rm; char* line = read_line(fp); - if (line == NULL) { + if (line == nullptr) { break; } - for (char* match = strstr(line, substrs[idx]); match != NULL;) { + for (char* match = strstr(line, substrs[idx]); match != nullptr;) { size_t match_len = strlen(substrs[idx]); idx++; - if (substrs[idx] == NULL) { + if (substrs[idx] == nullptr) { break; } match = strstr(match + match_len, substrs[idx]); @@ -159,10 +159,10 @@ static bool file_contains_substrings_in_order(const char* filename, const char* } fclose(fp); - return substrs[idx] == NULL; + return substrs[idx] == nullptr; } static inline bool file_contains_substring(const char* filename, const char* substr) { - const char* strs[] = {substr, NULL}; + const char* strs[] = {substr, nullptr}; return file_contains_substrings_in_order(filename, strs); } diff --git a/test/hotspot/gtest/logging/test_asynclog.cpp b/test/hotspot/gtest/logging/test_asynclog.cpp index 994c4df6fa60..9f4aa05089b3 100644 --- a/test/hotspot/gtest/logging/test_asynclog.cpp +++ b/test/hotspot/gtest/logging/test_asynclog.cpp @@ -1,6 +1,6 @@ /* * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, 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 @@ -91,7 +91,7 @@ LOG_LEVEL_LIST bool write_to_file(const std::string& output) { FILE* f = os::fopen(TestLogFileName, "w"); - if (f != NULL) { + if (f != nullptr) { size_t sz = output.size(); size_t written = fwrite(output.c_str(), sizeof(char), output.size(), f); return fclose(f) == 0 && sz == written; @@ -146,7 +146,7 @@ TEST_VM_F(AsyncLogTest, logMessage) { ResourceMark rm; LogMessageBuffer buffer; const char* strs[MULTI_LINES + 1]; - strs[MULTI_LINES] = NULL; + strs[MULTI_LINES] = nullptr; for (int i = 0; i < MULTI_LINES; ++i) { stringStream ss; ss.print_cr("nonbreakable log message line-%02d", i); diff --git a/test/hotspot/gtest/logging/test_gcTraceTime.cpp b/test/hotspot/gtest/logging/test_gcTraceTime.cpp index 3493ff821806..1b4c76a49873 100644 --- a/test/hotspot/gtest/logging/test_gcTraceTime.cpp +++ b/test/hotspot/gtest/logging/test_gcTraceTime.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, 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 @@ -45,13 +45,13 @@ TEST_VM_F(GCTraceTimeTest, full) { { ThreadInVMfromNative tvn(JavaThread::current()); MutexLocker lock(Heap_lock); // Needed to read heap usage - GCTraceTime(Debug, gc) timer("Test GC", NULL, GCCause::_allocation_failure, true); + GCTraceTime(Debug, gc) timer("Test GC", nullptr, GCCause::_allocation_failure, true); } const char* expected[] = { "[gc,start", "] Test GC (Allocation Failure)", "[gc", "] Test GC (Allocation Failure) ", "M) ", "ms", - NULL + nullptr }; EXPECT_TRUE(file_contains_substrings_in_order(TestLogFileName, expected)); } @@ -68,13 +68,13 @@ TEST_VM_F(GCTraceTimeTest, full_multitag) { { ThreadInVMfromNative tvn(JavaThread::current()); MutexLocker lock(Heap_lock); // Needed to read heap usage - GCTraceTime(Debug, gc, ref) timer("Test GC", NULL, GCCause::_allocation_failure, true); + GCTraceTime(Debug, gc, ref) timer("Test GC", nullptr, GCCause::_allocation_failure, true); } const char* expected[] = { "[gc,ref,start", "] Test GC (Allocation Failure)", "[gc,ref", "] Test GC (Allocation Failure) ", "M) ", "ms", - NULL + nullptr }; EXPECT_TRUE(file_contains_substrings_in_order(TestLogFileName, expected)); } @@ -89,7 +89,7 @@ TEST_VM_F(GCTraceTimeTest, no_heap) { EXPECT_TRUE(gc_start_debug.is_enabled()); { - GCTraceTime(Debug, gc) timer("Test GC", NULL, GCCause::_allocation_failure, false); + GCTraceTime(Debug, gc) timer("Test GC", nullptr, GCCause::_allocation_failure, false); } const char* expected[] = { @@ -97,7 +97,7 @@ TEST_VM_F(GCTraceTimeTest, no_heap) { "[gc,start", "] Test GC (Allocation Failure)", // [2.975s][debug][gc ] Test GC (Allocation Failure) 0.026ms "[gc", "] Test GC (Allocation Failure) ", "ms", - NULL + nullptr }; EXPECT_TRUE(file_contains_substrings_in_order(TestLogFileName, expected)); @@ -120,7 +120,7 @@ TEST_VM_F(GCTraceTimeTest, no_cause) { { ThreadInVMfromNative tvn(JavaThread::current()); MutexLocker lock(Heap_lock); // Needed to read heap usage - GCTraceTime(Debug, gc) timer("Test GC", NULL, GCCause::_no_gc, true); + GCTraceTime(Debug, gc) timer("Test GC", nullptr, GCCause::_no_gc, true); } const char* expected[] = { @@ -128,7 +128,7 @@ TEST_VM_F(GCTraceTimeTest, no_cause) { "[gc,start", "] Test GC", // [2.975s][debug][gc ] Test GC 59M->59M(502M) 0.026ms "[gc", "] Test GC ", "M) ", "ms", - NULL + nullptr }; EXPECT_TRUE(file_contains_substrings_in_order(TestLogFileName, expected)); } @@ -143,7 +143,7 @@ TEST_VM_F(GCTraceTimeTest, no_heap_no_cause) { EXPECT_TRUE(gc_start_debug.is_enabled()); { - GCTraceTime(Debug, gc) timer("Test GC", NULL, GCCause::_no_gc, false); + GCTraceTime(Debug, gc) timer("Test GC", nullptr, GCCause::_no_gc, false); } const char* expected[] = { @@ -151,7 +151,7 @@ TEST_VM_F(GCTraceTimeTest, no_heap_no_cause) { "[gc,start", "] Test GC", // [2.975s][debug][gc ] Test GC 0.026ms "[gc", "] Test GC ", "ms", - NULL + nullptr }; EXPECT_TRUE(file_contains_substrings_in_order(TestLogFileName, expected)); diff --git a/test/hotspot/gtest/logging/test_log.cpp b/test/hotspot/gtest/logging/test_log.cpp index 2b534fd7f33e..d05254f10f79 100644 --- a/test/hotspot/gtest/logging/test_log.cpp +++ b/test/hotspot/gtest/logging/test_log.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,7 +61,7 @@ TEST_VM_F(LogTest, large_message) { AsyncLogWriter::flush(); ResourceMark rm; FILE* fp = os::fopen(TestLogFileName, "r"); - ASSERT_NE((void*)NULL, fp); + ASSERT_NE(nullptr, fp); char* output = read_line(fp); fclose(fp); @@ -91,7 +91,7 @@ TEST_VM_F(LogTest, disabled_logtarget) { // Try to log, but expect this to be filtered out. log.print(LOG_TEST_STRING_LITERAL); - // Log a dummy line so that fgets doesn't return NULL because the file is empty. + // Log a dummy line so that fgets doesn't return nullptr because the file is empty. log_info(gc)("Dummy line"); EXPECT_FALSE(file_contains_substring(TestLogFileName, LOG_TEST_STRING_LITERAL)); @@ -122,7 +122,7 @@ TEST_VM_F(LogTest, disabled_loghandle) { // Try to log through a LogHandle. log_handle.debug("%d workers", 3); - // Log a dummy line so that fgets doesn't return NULL because the file is empty. + // Log a dummy line so that fgets doesn't return nullptr because the file is empty. log_info(gc)("Dummy line"); EXPECT_FALSE(file_contains_substring(TestLogFileName, "3 workers")); @@ -153,7 +153,7 @@ TEST_VM_F(LogTest, disabled_logtargethandle) { // Try to log through a LogHandle. log_handle.print("%d workers", 3); - // Log a dummy line so that fgets doesn't return NULL because the file is empty. + // Log a dummy line so that fgets doesn't return nullptr because the file is empty. log_info(gc)("Dummy line"); EXPECT_FALSE(file_contains_substring(TestLogFileName, "3 workers")); diff --git a/test/hotspot/gtest/logging/test_logConfiguration.cpp b/test/hotspot/gtest/logging/test_logConfiguration.cpp index f56926a45855..0d655c2f8d4c 100644 --- a/test/hotspot/gtest/logging/test_logConfiguration.cpp +++ b/test/hotspot/gtest/logging/test_logConfiguration.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2024, 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 @@ -132,7 +132,7 @@ TEST_VM_F(LogConfigurationTest, update_output) { // Verify by iterating over tagsets LogOutput* o = StdoutLog; - for (LogTagSet* ts = LogTagSet::first(); ts != NULL; ts = ts->next()) { + for (LogTagSet* ts = LogTagSet::first(); ts != nullptr; ts = ts->next()) { EXPECT_TRUE(ts->has_output(o)); EXPECT_TRUE(ts->is_level(LogLevel::Info)); EXPECT_FALSE(ts->is_level(LogLevel::Debug)); @@ -140,7 +140,7 @@ TEST_VM_F(LogConfigurationTest, update_output) { // Now change the level and verify the change propagated set_log_config(test_outputs[i], "all=debug"); - for (LogTagSet* ts = LogTagSet::first(); ts != NULL; ts = ts->next()) { + for (LogTagSet* ts = LogTagSet::first(); ts != nullptr; ts = ts->next()) { EXPECT_TRUE(ts->has_output(o)); EXPECT_TRUE(ts->is_level(LogLevel::Debug)); EXPECT_FALSE(ts->is_level(LogLevel::Trace)); @@ -160,7 +160,7 @@ TEST_VM_F(LogConfigurationTest, add_new_output) { EXPECT_TRUE(is_described("all=trace")); // Also verify by iterating over tagsets, checking levels on tagsets - for (LogTagSet* ts = LogTagSet::first(); ts != NULL; ts = ts->next()) { + for (LogTagSet* ts = LogTagSet::first(); ts != nullptr; ts = ts->next()) { EXPECT_TRUE(ts->is_level(LogLevel::Trace)); } } @@ -182,7 +182,7 @@ TEST_VM_F(LogConfigurationTest, disable_logging) { delete_file(other_file_name); // Verify that no tagset has logging enabled - for (LogTagSet* ts = LogTagSet::first(); ts != NULL; ts = ts->next()) { + for (LogTagSet* ts = LogTagSet::first(); ts != nullptr; ts = ts->next()) { EXPECT_FALSE(ts->has_output(StdoutLog)); EXPECT_FALSE(ts->has_output(StderrLog)); EXPECT_FALSE(ts->is_level(LogLevel::Error)); @@ -199,7 +199,7 @@ TEST_VM_F(LogConfigurationTest, disable_output) { // Verify by iterating over tagsets LogOutput* o = StdoutLog; - for (LogTagSet* ts = LogTagSet::first(); ts != NULL; ts = ts->next()) { + for (LogTagSet* ts = LogTagSet::first(); ts != nullptr; ts = ts->next()) { EXPECT_FALSE(ts->has_output(o)); EXPECT_FALSE(ts->is_level(LogLevel::Error)); } @@ -212,7 +212,7 @@ TEST_VM_F(LogConfigurationTest, disable_output) { // Now disable it, verifying it is removed completely set_log_config(TestLogFileName, "all=off"); EXPECT_FALSE(is_described(TestLogFileName)); - for (LogTagSet* ts = LogTagSet::first(); ts != NULL; ts = ts->next()) { + for (LogTagSet* ts = LogTagSet::first(); ts != nullptr; ts = ts->next()) { EXPECT_FALSE(ts->is_level(LogLevel::Error)); } } @@ -337,7 +337,7 @@ TEST_VM_F(LogConfigurationTest, parse_empty_command_line_arguments) { const char* cmdline = empty_variations[i]; bool ret = LogConfiguration::parse_command_line_arguments(cmdline); EXPECT_TRUE(ret) << "Error parsing command line arguments '" << cmdline << "'"; - for (LogTagSet* ts = LogTagSet::first(); ts != NULL; ts = ts->next()) { + for (LogTagSet* ts = LogTagSet::first(); ts != nullptr; ts = ts->next()) { EXPECT_EQ(LogLevel::Unspecified, ts->level_for(StdoutLog)); } } @@ -427,7 +427,7 @@ TEST_VM_F(LogConfigurationTest, configure_stdout) { EXPECT_TRUE(log_is_enabled(Debug, gc)); EXPECT_TRUE(log_is_enabled(Info, logging)); EXPECT_FALSE(log_is_enabled(Debug, gc, heap)); - for (LogTagSet* ts = LogTagSet::first(); ts != NULL; ts = ts->next()) { + for (LogTagSet* ts = LogTagSet::first(); ts != nullptr; ts = ts->next()) { if (ts->contains(PREFIX_LOG_TAG(gc))) { if (ts->ntags() == 1) { EXPECT_EQ(LogLevel::Debug, ts->level_for(StdoutLog)); @@ -441,7 +441,7 @@ TEST_VM_F(LogConfigurationTest, configure_stdout) { LogConfiguration::configure_stdout(LogLevel::Trace, false, LOG_TAGS(gc)); EXPECT_TRUE(log_is_enabled(Trace, gc)); EXPECT_TRUE(log_is_enabled(Trace, gc, heap)); - for (LogTagSet* ts = LogTagSet::first(); ts != NULL; ts = ts->next()) { + for (LogTagSet* ts = LogTagSet::first(); ts != nullptr; ts = ts->next()) { if (ts->contains(PREFIX_LOG_TAG(gc))) { EXPECT_EQ(LogLevel::Trace, ts->level_for(StdoutLog)); } else if (ts == logging_ts) { @@ -458,7 +458,7 @@ TEST_VM_F(LogConfigurationTest, configure_stdout) { LogConfiguration::configure_stdout(LogLevel::Off, false, LOG_TAGS(gc)); EXPECT_FALSE(log_is_enabled(Error, gc)); EXPECT_FALSE(log_is_enabled(Error, gc, heap)); - for (LogTagSet* ts = LogTagSet::first(); ts != NULL; ts = ts->next()) { + for (LogTagSet* ts = LogTagSet::first(); ts != nullptr; ts = ts->next()) { EXPECT_EQ(LogLevel::Off, ts->level_for(StdoutLog)); } } @@ -476,7 +476,7 @@ TEST_VM_F(LogConfigurationTest, subscribe) { LogConfiguration::register_update_listener(&Test_logconfiguration_subscribe_helper); LogStream ls(log.error()); - LogConfiguration::parse_log_arguments("stdout", "logging=trace", NULL, NULL, &ls); + LogConfiguration::parse_log_arguments("stdout", "logging=trace", nullptr, nullptr, &ls); ASSERT_EQ(1, Test_logconfiguration_subscribe_triggered); LogConfiguration::configure_stdout(LogLevel::Debug, true, LOG_TAGS(gc)); @@ -492,7 +492,7 @@ TEST_VM_F(LogConfigurationTest, parse_invalid_tagset) { // Make sure warning is produced if one or more configured tagsets are invalid ResourceMark rm; stringStream ss; - bool success = LogConfiguration::parse_log_arguments("stdout", invalid_tagset, NULL, NULL, &ss); + bool success = LogConfiguration::parse_log_arguments("stdout", invalid_tagset, nullptr, nullptr, &ss); const char* msg = ss.as_string(); EXPECT_TRUE(success) << "Should only cause a warning, not an error"; EXPECT_THAT(msg, HasSubstr("No tag set matches selection:")); @@ -527,7 +527,7 @@ TEST_VM_F(LogConfigurationTest, output_name_normalization) { static size_t count_occurrences(const char* haystack, const char* needle) { size_t count = 0; - for (const char* p = strstr(haystack, needle); p != NULL; p = strstr(p + 1, needle)) { + for (const char* p = strstr(haystack, needle); p != nullptr; p = strstr(p + 1, needle)) { count++; } return count; @@ -539,7 +539,7 @@ TEST_OTHER_VM(LogConfiguration, output_reconfigured) { EXPECT_FALSE(is_described("(reconfigured)")); - bool success = LogConfiguration::parse_log_arguments("#1", "all=warning", NULL, NULL, &ss); + bool success = LogConfiguration::parse_log_arguments("#1", "all=warning", nullptr, nullptr, &ss); ASSERT_TRUE(success); EXPECT_EQ(0u, ss.size()); @@ -557,7 +557,7 @@ TEST_VM_F(LogConfigurationTest, suggest_similar_selection) { ResourceMark rm; stringStream ss; - LogConfiguration::parse_log_arguments("stdout", nonexisting_tagset, NULL, NULL, &ss); + LogConfiguration::parse_log_arguments("stdout", nonexisting_tagset, nullptr, nullptr, &ss); const char* suggestion = ss.as_string(); SCOPED_TRACE(suggestion); diff --git a/test/hotspot/gtest/logging/test_logDecorations.cpp b/test/hotspot/gtest/logging/test_logDecorations.cpp index f2aa35df1b66..9dc962da1cbb 100644 --- a/test/hotspot/gtest/logging/test_logDecorations.cpp +++ b/test/hotspot/gtest/logging/test_logDecorations.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2024, 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 @@ TEST_VM(LogDecorations, uptime) { for (int i = 0; i < 3; i++) { os::naked_short_sleep(10); LogDecorations d(LogLevel::Info, tagset, default_decorators); - double cur = strtod(d.decoration(LogDecorators::uptime_decorator, buf, sizeof(buf)), NULL); + double cur = strtod(d.decoration(LogDecorators::uptime_decorator, buf, sizeof(buf)), nullptr); ASSERT_LT(prev, cur); prev = cur; } @@ -123,7 +123,7 @@ TEST_VM(LogDecorations, timestamps) { // at 15-16ms, so we use 20. os::naked_short_sleep(20); LogDecorations d(LogLevel::Info, tagset, decorator_selection); - julong val = strtoull(d.decoration(decorator, buf, sizeof(buf)), NULL, 10); + julong val = strtoull(d.decoration(decorator, buf, sizeof(buf)), nullptr, 10); tty->print_cr("Read value: " UINT64_FORMAT, val); ASSERT_LT(prev, val); prev = val; @@ -139,7 +139,7 @@ TEST(LogDecorations, iso8601_time) { LogDecorations decorations(LogLevel::Info, tagset, decorator_selection); const char *timestr = decorations.decoration(LogDecorators::time_decorator, buf, sizeof(buf)); - time_t expected_ts = time(NULL); + time_t expected_ts = time(nullptr); // Verify format int y, M, d, h, m, s, ms; @@ -174,7 +174,7 @@ TEST(LogDecorations, iso8601_utctime) { LogDecorations decorations(LogLevel::Info, tagset, decorator_selection); const char *timestr = decorations.decoration(LogDecorators::utctime_decorator, buf, sizeof(buf)); - time_t expected_ts = time(NULL); + time_t expected_ts = time(nullptr); // Verify format char trailing_character; @@ -234,6 +234,6 @@ TEST(LogDecorations, identifiers) { EXPECT_EQ('\0', *str) << "Should only contain digits"; // Verify value - EXPECT_EQ(ids[i].expected, strtol(reported, NULL, 10)); + EXPECT_EQ(ids[i].expected, strtol(reported, nullptr, 10)); } } diff --git a/test/hotspot/gtest/logging/test_logMessageTest.cpp b/test/hotspot/gtest/logging/test_logMessageTest.cpp index d71a528e2eda..962cca8786f2 100644 --- a/test/hotspot/gtest/logging/test_logMessageTest.cpp +++ b/test/hotspot/gtest/logging/test_logMessageTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, 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 @@ -42,7 +42,7 @@ class LogMessageTest : public LogTestFixture { Log(logging) LogMessageTest::_log; const char* LogMessageTest::_level_filename[] = { - NULL, // LogLevel::Off + nullptr, // LogLevel::Off #define LOG_LEVEL(name, printname) "multiline-" #printname ".log", LOG_LEVEL_LIST #undef LOG_LEVEL @@ -132,7 +132,7 @@ TEST_VM_F(LogMessageTest, line_order) { _log.write(msg); const char* expected[] = { "info line", "error line", "trace line", - "another error", "warning line", "debug line", NULL }; + "another error", "warning line", "debug line", nullptr }; EXPECT_TRUE(file_contains_substrings_in_order(_level_filename[LogLevel::Trace], expected)) << "output missing or in incorrect order"; } @@ -156,7 +156,7 @@ TEST_VM_F(LogMessageTest, long_message) { msg.trace("%s", data); // Adds a newline, making the message exactly 10K in length. _log.write(msg); - const char* expected[] = { start_marker, "0123456789", end_marker, NULL }; + const char* expected[] = { start_marker, "0123456789", end_marker, nullptr }; EXPECT_TRUE(file_contains_substrings_in_order(_level_filename[LogLevel::Trace], expected)) << "unable to print long line"; FREE_C_HEAP_ARRAY(char, data); @@ -178,7 +178,7 @@ TEST_VM_F(LogMessageTest, message_with_many_lines) { jio_snprintf(&expected_lines_data[i][0], line_length, "Line #" SIZE_FORMAT, i); expected_lines[i] = expected_lines_data[i]; } - expected_lines[lines] = NULL; + expected_lines[lines] = nullptr; EXPECT_TRUE(file_contains_substrings_in_order(_level_filename[LogLevel::Trace], expected_lines)) << "couldn't find all lines in multiline message"; @@ -201,7 +201,7 @@ TEST_VM_F(LogMessageTest, prefixing) { for (int i = 0; i < 3; i++) { msg.info("test %d", i); } - msg.set_prefix(NULL); + msg.set_prefix(nullptr); msg.info("test 3"); _log.write(msg); @@ -210,7 +210,7 @@ TEST_VM_F(LogMessageTest, prefixing) { "] some prefix: test 1", "] some prefix: test 2", "] test 3", - NULL + nullptr }; EXPECT_TRUE(file_contains_substrings_in_order(_level_filename[LogLevel::Trace], expected)) << "error in prefixed output"; @@ -238,7 +238,7 @@ TEST_VM_F(LogMessageTest, scoped_flushing) { EXPECT_TRUE(file_contains_substring(_level_filename[LogLevel::Info], "manual flush info")) << "missing output from manually flushed scoped log message"; } - const char* tmp[] = {"manual flush info", "manual flush info", NULL}; + const char* tmp[] = {"manual flush info", "manual flush info", nullptr}; EXPECT_FALSE(file_contains_substrings_in_order(_level_filename[LogLevel::Info], tmp)) << "log file contains duplicate lines from single scoped log message"; } diff --git a/test/hotspot/gtest/logging/test_logSelectionList.cpp b/test/hotspot/gtest/logging/test_logSelectionList.cpp index cce4ffaccec2..8f6978233f28 100644 --- a/test/hotspot/gtest/logging/test_logSelectionList.cpp +++ b/test/hotspot/gtest/logging/test_logSelectionList.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2024, 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 @@ -83,7 +83,7 @@ TEST(LogSelectionList, level_for_empty) { LogSelectionList emptyexpr; ASSERT_TRUE(emptyexpr.parse("")); // All tagsets should be unspecified since the expression doesn't involve any tagset - for (LogTagSet* ts = LogTagSet::first(); ts != NULL; ts = ts->next()) { + for (LogTagSet* ts = LogTagSet::first(); ts != nullptr; ts = ts->next()) { EXPECT_EQ(LogLevel::Unspecified, emptyexpr.level_for(*ts)); } } @@ -93,7 +93,7 @@ TEST(LogSelectionList, level_for_overlap) { LogSelectionList overlapexpr; // The all=warning will be overridden with gc=info and/or logging+safepoint*=trace ASSERT_TRUE(overlapexpr.parse("all=warning,gc=info,logging+safepoint*=trace")); - for (LogTagSet* ts = LogTagSet::first(); ts != NULL; ts = ts->next()) { + for (LogTagSet* ts = LogTagSet::first(); ts != nullptr; ts = ts->next()) { if (ts->contains(PREFIX_LOG_TAG(gc)) && ts->ntags() == 1) { EXPECT_EQ(LogLevel::Info, overlapexpr.level_for(*ts)); } else if (ts->contains(PREFIX_LOG_TAG(logging)) && ts->contains(PREFIX_LOG_TAG(safepoint))) { diff --git a/test/hotspot/gtest/logging/test_logStream.cpp b/test/hotspot/gtest/logging/test_logStream.cpp index 0782af676792..d153601fc9cc 100644 --- a/test/hotspot/gtest/logging/test_logStream.cpp +++ b/test/hotspot/gtest/logging/test_logStream.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2024, 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 @@ -96,7 +96,7 @@ TEST_VM_F(LogStreamTest, TestLineBufferAllocation) { // Compare this to NonInterLeavingLogStreamTest_NonInterleavingStream TEST_VM_F(LogStreamTest, InterleavingStream) { set_log_config(TestLogFileName, "gc=info"); - const char* message_order[] = {"1", "I am one line", "2", "but", "3", "I am not", NULL}; + const char* message_order[] = {"1", "I am one line", "2", "but", "3", "I am not", nullptr}; { LogStream foo(Log(gc)::info()); if (foo.is_enabled()) { @@ -116,7 +116,7 @@ TEST_VM_F(LogStreamTest, InterleavingStream) { // Compare this to LogStreamTest_InterleavingStream TEST_VM_F(LogStreamTest, NonInterleavingStream) { set_log_config(TestLogFileName, "gc=info"); - const char* message_order[] = {"1", "2" , "3", "I am one line", "but", "I am not", NULL}; + const char* message_order[] = {"1", "2" , "3", "I am one line", "but", "I am not", nullptr}; { LogMessage(gc) lm ; NonInterleavingLogStream foo{LogLevelType::Info, lm}; diff --git a/test/hotspot/gtest/logging/test_logTag.cpp b/test/hotspot/gtest/logging/test_logTag.cpp index 79d2745c35e9..9d610ca70727 100644 --- a/test/hotspot/gtest/logging/test_logTag.cpp +++ b/test/hotspot/gtest/logging/test_logTag.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2024, 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 @@ -72,16 +72,16 @@ TEST(LogTag, list_tags) { bool listed_tags[LogTag::Count] = { false }; - char* last_tag = NULL; + char* last_tag = nullptr; for (char* tag = buf; *tag != '\0';) { char* end = strpbrk(tag, ",\n"); - ASSERT_TRUE(end != NULL) << "line should end with newline"; + ASSERT_TRUE(end != nullptr) << "line should end with newline"; *end = '\0'; if (*tag == ' ') { tag++; } - EXPECT_TRUE(last_tag == NULL || strcmp(last_tag, tag) < 0) << tag << " should be listed before " << last_tag; + EXPECT_TRUE(last_tag == nullptr || strcmp(last_tag, tag) < 0) << tag << " should be listed before " << last_tag; listed_tags[LogTag::from_string(tag)] = true; last_tag = tag; diff --git a/test/hotspot/gtest/logging/test_logTagSet.cpp b/test/hotspot/gtest/logging/test_logTagSet.cpp index f79e3ee89433..a0ed01889349 100644 --- a/test/hotspot/gtest/logging/test_logTagSet.cpp +++ b/test/hotspot/gtest/logging/test_logTagSet.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,7 +32,7 @@ // Test the default level for each tagset TEST_VM(LogTagSet, defaults) { - for (LogTagSet* ts = LogTagSet::first(); ts != NULL; ts = ts->next()) { + for (LogTagSet* ts = LogTagSet::first(); ts != nullptr; ts = ts->next()) { char buf[256]; ts->label(buf, sizeof(buf)); SCOPED_TRACE(buf); @@ -48,7 +48,7 @@ TEST_VM(LogTagSet, has_output) { LogTagSet& ts = LogTagSetMapping::tagset(); ts.set_output_level(StderrLog, LogLevel::Trace); EXPECT_TRUE(ts.has_output(StderrLog)); - EXPECT_FALSE(ts.has_output(NULL)); + EXPECT_FALSE(ts.has_output(nullptr)); ts.set_output_level(StderrLog, LogLevel::Off); EXPECT_FALSE(ts.has_output(StderrLog)); } @@ -139,7 +139,7 @@ TEST_VM(LogTagSet, label) { } TEST_VM(LogTagSet, duplicates) { - for (LogTagSet* ts = LogTagSet::first(); ts != NULL; ts = ts->next()) { + for (LogTagSet* ts = LogTagSet::first(); ts != nullptr; ts = ts->next()) { char ts_name[512]; ts->label(ts_name, sizeof(ts_name), ","); @@ -154,7 +154,7 @@ TEST_VM(LogTagSet, duplicates) { } // verify that there are no duplicate tagsets (same tags in different order) - for (LogTagSet* other = ts->next(); other != NULL; other = other->next()) { + for (LogTagSet* other = ts->next(); other != nullptr; other = other->next()) { if (ts->ntags() != other->ntags()) { continue; } diff --git a/test/hotspot/gtest/logging/test_logTagSetDescriptions.cpp b/test/hotspot/gtest/logging/test_logTagSetDescriptions.cpp index 069e6877e32a..5cedddef73bd 100644 --- a/test/hotspot/gtest/logging/test_logTagSetDescriptions.cpp +++ b/test/hotspot/gtest/logging/test_logTagSetDescriptions.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,7 +32,7 @@ #include "utilities/ostream.hpp" TEST_VM(LogTagSetDescriptions, describe) { - for (LogTagSetDescription* d = tagset_descriptions; d->tagset != NULL; d++) { + for (LogTagSetDescription* d = tagset_descriptions; d->tagset != nullptr; d++) { char expected[1 * K]; d->tagset->label(expected, sizeof(expected), "+"); jio_snprintf(expected + strlen(expected), @@ -51,12 +51,12 @@ TEST_VM(LogTagSetDescriptions, command_line_help) { ResourceMark rm; const char* filename = prepend_temp_dir("logtagset_descriptions"); FILE* fp = os::fopen(filename, "w+"); - ASSERT_NE((void*)NULL, fp); + ASSERT_NE((void*)nullptr, fp); fileStream stream(fp); LogConfiguration::print_command_line_help(&stream); fclose(fp); - for (LogTagSetDescription* d = tagset_descriptions; d->tagset != NULL; d++) { + for (LogTagSetDescription* d = tagset_descriptions; d->tagset != nullptr; d++) { char expected[1 * K]; d->tagset->label(expected, sizeof(expected), "+"); jio_snprintf(expected + strlen(expected), diff --git a/test/hotspot/gtest/memory/test_arena.cpp b/test/hotspot/gtest/memory/test_arena.cpp index 35a85508d680..28f7e74f1ae2 100644 --- a/test/hotspot/gtest/memory/test_arena.cpp +++ b/test/hotspot/gtest/memory/test_arena.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2021 SAP SE. All rights reserved. * * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. @@ -94,15 +94,15 @@ TEST_VM(Arena, realloc_same_size) { ASSERT_RANGE_IS_MARKED(p2, 0x200); } -// Test behavior for Afree(NULL) and Arealloc(NULL, x) +// Test behavior for Afree(nullptr) and Arealloc(nullptr, x) TEST_VM(Arena, free_null) { Arena ar(mtTest); - ar.Afree(NULL, 10); // should just be ignored + ar.Afree(nullptr, 10); // should just be ignored } TEST_VM(Arena, realloc_null) { Arena ar(mtTest); - void* p = ar.Arealloc(NULL, 0, 20); // equivalent to Amalloc(20) + void* p = ar.Arealloc(nullptr, 0, 20); // equivalent to Amalloc(20) ASSERT_AMALLOC(ar, p); } @@ -238,7 +238,7 @@ TEST_VM(Arena, random_allocs) { for (int i = 0; i < num_allocs; i ++) { size_t size = os::random() % (avg_alloc_size * 2); // Note: size==0 is okay; we want to test that too size_t alignment = 0; - void* p = NULL; + void* p = nullptr; if (os::random() % 2) { // randomly switch between Amalloc and AmallocWords p = ar.Amalloc(size); alignment = BytesPerLong; @@ -297,7 +297,7 @@ TEST_VM(Arena, random_allocs) { ar.Afree(ptrs[i], sizes[i]); // In debug builds the freed space should be filled the space with badResourceValue DEBUG_ONLY(ASSERT_RANGE_IS_MARKED_WITH(ptrs[i], sizes[i], badResourceValue)); - ptrs[i] = NULL; + ptrs[i] = nullptr; } } diff --git a/test/hotspot/gtest/memory/test_guardedMemory.cpp b/test/hotspot/gtest/memory/test_guardedMemory.cpp index 9e1d1754d3e8..a86982db15fc 100644 --- a/test/hotspot/gtest/memory/test_guardedMemory.cpp +++ b/test/hotspot/gtest/memory/test_guardedMemory.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,7 +30,7 @@ #define GEN_PURPOSE_TAG ((void *) ((uintptr_t)0xf000f000)) static void guarded_memory_test_check(void* p, size_t sz, void* tag) { - ASSERT_TRUE(p != NULL) << "NULL pointer given to check"; + ASSERT_TRUE(p != nullptr) << "nullptr pointer given to check"; u_char* c = (u_char*) p; GuardedMemory guarded(c); EXPECT_EQ(guarded.get_tag(), tag) << "Tag is not the same as supplied"; @@ -130,19 +130,19 @@ TEST(GuardedMemory, buffer_overrun_tail) { // Test wrap_copy/wrap_free TEST(GuardedMemory, wrap) { - EXPECT_TRUE(GuardedMemory::free_copy(NULL)) << "Expected free NULL to be OK"; + EXPECT_TRUE(GuardedMemory::free_copy(nullptr)) << "Expected free nullptr to be OK"; const char* str = "Check my bounds out"; size_t str_sz = strlen(str) + 1; char* str_copy = (char*) GuardedMemory::wrap_copy(str, str_sz); - guarded_memory_test_check(str_copy, str_sz, NULL); + guarded_memory_test_check(str_copy, str_sz, nullptr); if (HasFatalFailure()) { return; } EXPECT_STREQ(str, str_copy) << "Not identical copy"; EXPECT_TRUE(GuardedMemory::free_copy(str_copy)) << "Free copy failed to verify"; - void* no_data = NULL; + void* no_data = nullptr; void* no_data_copy = GuardedMemory::wrap_copy(no_data, 0); EXPECT_TRUE(GuardedMemory::free_copy(no_data_copy)) << "Expected valid guards even for no data copy"; diff --git a/test/hotspot/gtest/memory/test_virtualspace.cpp b/test/hotspot/gtest/memory/test_virtualspace.cpp index 2391ff00df4f..2240f0f4cb37 100644 --- a/test/hotspot/gtest/memory/test_virtualspace.cpp +++ b/test/hotspot/gtest/memory/test_virtualspace.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2024, 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 @@ -67,7 +67,7 @@ namespace { ReservedSpace rs(size); MemoryReleaser releaser(&rs); - EXPECT_TRUE(rs.base() != NULL) << "rs.special: " << rs.special(); + EXPECT_TRUE(rs.base() != nullptr) << "rs.special: " << rs.special(); EXPECT_EQ(size, rs.size()) << "rs.special: " << rs.special(); if (rs.special()) { @@ -78,9 +78,9 @@ namespace { static void test_reserved_size_alignment(size_t size, size_t alignment) { ASSERT_PRED2(is_size_aligned, size, alignment) << "Incorrect input parameters"; size_t page_size = UseLargePages ? os::large_page_size() : os::vm_page_size(); - ReservedSpace rs(size, alignment, page_size, (char *) NULL); + ReservedSpace rs(size, alignment, page_size, (char *) nullptr); - ASSERT_TRUE(rs.base() != NULL) << "rs.special = " << rs.special(); + ASSERT_TRUE(rs.base() != nullptr) << "rs.special = " << rs.special(); ASSERT_EQ(size, rs.size()) << "rs.special = " << rs.special(); EXPECT_PRED2(is_ptr_aligned, rs.base(), alignment) @@ -109,7 +109,7 @@ namespace { ReservedSpace rs(size, alignment, page_size); MemoryReleaser releaser(&rs); - EXPECT_TRUE(rs.base() != NULL) << "rs.special: " << rs.special(); + EXPECT_TRUE(rs.base() != nullptr) << "rs.special: " << rs.special(); EXPECT_EQ(size, rs.size()) << "rs.special: " << rs.special(); if (rs.special()) { @@ -369,9 +369,9 @@ class TestReservedSpace : AllStatic { ReservedSpace rs(size, // size alignment, // alignment page_size, // page size - (char *)NULL); // requested_address + (char *)nullptr); // requested_address - EXPECT_TRUE(rs.base() != NULL); + EXPECT_TRUE(rs.base() != nullptr); EXPECT_EQ(rs.size(), size) << "rs.size: " << rs.size(); EXPECT_TRUE(is_aligned(rs.base(), alignment)) << "aligned sizes should always give aligned addresses"; @@ -389,7 +389,7 @@ class TestReservedSpace : AllStatic { ReservedSpace rs(size); - EXPECT_TRUE(rs.base() != NULL); + EXPECT_TRUE(rs.base() != nullptr); EXPECT_EQ(rs.size(), size) << "rs.size: " << rs.size(); if (rs.special()) { @@ -414,7 +414,7 @@ class TestReservedSpace : AllStatic { ReservedSpace rs(size, alignment, page_size); - EXPECT_TRUE(rs.base() != NULL); + EXPECT_TRUE(rs.base() != nullptr); EXPECT_EQ(rs.size(), size) << "rs.size: " << rs.size(); if (rs.special()) { diff --git a/test/hotspot/gtest/metaspace/metaspaceGtestCommon.cpp b/test/hotspot/gtest/metaspace/metaspaceGtestCommon.cpp index f39ce2c1d13d..fe3964562b40 100644 --- a/test/hotspot/gtest/metaspace/metaspaceGtestCommon.cpp +++ b/test/hotspot/gtest/metaspace/metaspaceGtestCommon.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -54,14 +54,14 @@ void check_marked_address(const MetaWord* p, uintx pattern) { // The filled range can be checked with check_range_for_pattern. One also can only check // a sub range of the original range. void fill_range_with_pattern(MetaWord* p, size_t word_size, uintx pattern) { - assert(word_size > 0 && p != NULL, "sanity"); + assert(word_size > 0 && p != nullptr, "sanity"); for (MetaWord* p2 = p; p2 < p + word_size; p2++) { mark_address(p2, pattern); } } void check_range_for_pattern(const MetaWord* p, size_t word_size, uintx pattern) { - assert(p != NULL, "sanity"); + assert(p != nullptr, "sanity"); const MetaWord* p2 = p; while (p2 < p + word_size) { check_marked_address(p2, pattern); @@ -74,19 +74,19 @@ void check_range_for_pattern(const MetaWord* p, size_t word_size, uintx pattern) // Use check_marked_range to check the range. In contrast to check_range_for_pattern, only the original // range can be checked. void mark_range(MetaWord* p, size_t word_size, uintx pattern) { - assert(word_size > 0 && p != NULL, "sanity"); + assert(word_size > 0 && p != nullptr, "sanity"); mark_address(p, pattern); mark_address(p + word_size - 1, pattern); } void check_marked_range(const MetaWord* p, size_t word_size, uintx pattern) { - assert(word_size > 0 && p != NULL, "sanity"); + assert(word_size > 0 && p != nullptr, "sanity"); check_marked_address(p, pattern); check_marked_address(p + word_size - 1, pattern); } void mark_range(MetaWord* p, size_t word_size) { - assert(word_size > 0 && p != NULL, "sanity"); + assert(word_size > 0 && p != nullptr, "sanity"); uintx pattern = (uintx)p2i(p); mark_range(p, word_size, pattern); } diff --git a/test/hotspot/gtest/metaspace/metaspaceGtestCommon.hpp b/test/hotspot/gtest/metaspace/metaspaceGtestCommon.hpp index 26c5d51e9c66..4c9bf67997b4 100644 --- a/test/hotspot/gtest/metaspace/metaspaceGtestCommon.hpp +++ b/test/hotspot/gtest/metaspace/metaspaceGtestCommon.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -38,7 +38,7 @@ class TestMap { const size_t _len; char* _arr; public: - TestMap(size_t len) : _len(len), _arr(NULL) { + TestMap(size_t len) : _len(len), _arr(nullptr) { _arr = NEW_C_HEAP_ARRAY(char, len, mtInternal); memset(_arr, 0, _len); } @@ -145,12 +145,12 @@ void mark_range(MetaWord* p, size_t word_size); void check_marked_range(const MetaWord* p, size_t word_size); ////////////////////////////////////////////////////////// -// Some helpers to avoid typing out those annoying casts for NULL +// Some helpers to avoid typing out those annoying casts for nullptr -#define ASSERT_NOT_NULL(ptr) ASSERT_NE((void*)NULL, (void*)ptr) -#define ASSERT_NULL(ptr) ASSERT_EQ((void*)NULL, (void*)ptr) -#define EXPECT_NOT_NULL(ptr) EXPECT_NE((void*)NULL, (void*)ptr) -#define EXPECT_NULL(ptr) EXPECT_EQ((void*)NULL, (void*)ptr) +#define ASSERT_NOT_NULL(ptr) ASSERT_NE(nullptr, (void*)ptr) +#define ASSERT_NULL(ptr) ASSERT_EQ(nullptr, (void*)ptr) +#define EXPECT_NOT_NULL(ptr) EXPECT_NE(nullptr, (void*)ptr) +#define EXPECT_NULL(ptr) EXPECT_EQ(nullptr, (void*)ptr) #define ASSERT_0(v) ASSERT_EQ((intptr_t)0, (intptr_t)v) #define ASSERT_NOT_0(v) ASSERT_NE((intptr_t)0, (intptr_t)v) @@ -188,7 +188,7 @@ class FeederBuffer { public: - FeederBuffer(size_t size) : _buf(NULL), _cap(size), _used(0) { + FeederBuffer(size_t size) : _buf(nullptr), _cap(size), _used(0) { _buf = NEW_C_HEAP_ARRAY(MetaWord, _cap, mtInternal); } @@ -198,7 +198,7 @@ class FeederBuffer { MetaWord* get(size_t word_size) { if (_used + word_size > _cap) { - return NULL; + return nullptr; } MetaWord* p = _buf + _used; _used += word_size; diff --git a/test/hotspot/gtest/metaspace/metaspaceGtestContexts.cpp b/test/hotspot/gtest/metaspace/metaspaceGtestContexts.cpp index f3801f591a29..3e9ef4c46d78 100644 --- a/test/hotspot/gtest/metaspace/metaspaceGtestContexts.cpp +++ b/test/hotspot/gtest/metaspace/metaspaceGtestContexts.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020, 2023 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -34,11 +34,11 @@ using metaspace::Settings; void ChunkGtestContext::checked_alloc_chunk_0(Metachunk** p_return_value, chunklevel_t preferred_level, chunklevel_t max_level, size_t min_committed_size) { - *p_return_value = NULL; + *p_return_value = nullptr; Metachunk* c = cm().get_chunk(preferred_level, max_level, min_committed_size); - if (c != NULL) { + if (c != nullptr) { ASSERT_LE(c->level(), max_level); ASSERT_GE(c->level(), preferred_level); diff --git a/test/hotspot/gtest/metaspace/metaspaceGtestContexts.hpp b/test/hotspot/gtest/metaspace/metaspaceGtestContexts.hpp index 7d2f0074fccb..f1a3ac0141ac 100644 --- a/test/hotspot/gtest/metaspace/metaspaceGtestContexts.hpp +++ b/test/hotspot/gtest/metaspace/metaspaceGtestContexts.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -89,7 +89,7 @@ class ChunkGtestContext : public MetaspaceGtestContext { // Allocate a chunk but expect it to fail. void alloc_chunk_expect_failure(chunklevel_t preferred_level, chunklevel_t max_level, size_t min_committed_size) { - Metachunk* c = NULL; + Metachunk* c = nullptr; checked_alloc_chunk_0(&c, preferred_level, max_level, min_committed_size); ASSERT_NULL(c); } diff --git a/test/hotspot/gtest/metaspace/metaspaceGtestSparseArray.hpp b/test/hotspot/gtest/metaspace/metaspaceGtestSparseArray.hpp index 4c8ad944d45e..6ca6b68baa3c 100644 --- a/test/hotspot/gtest/metaspace/metaspaceGtestSparseArray.hpp +++ b/test/hotspot/gtest/metaspace/metaspaceGtestSparseArray.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -68,8 +68,8 @@ class SparseArray : public StackObj { // Helper for next_matching_slot bool slot_matches(int slot, condition_t c) const { switch(c) { - case cond_null: return _slots[slot] == NULL; - case cond_non_null: return _slots[slot] != NULL; + case cond_null: return _slots[slot] == nullptr; + case cond_non_null: return _slots[slot] != nullptr; case cond_dontcare: return true; } ShouldNotReachHere(); @@ -95,7 +95,7 @@ class SparseArray : public StackObj { _index_range(num) { for (int i = 0; i < _num; i++) { - _slots[i] = NULL; + _slots[i] = nullptr; } } @@ -109,7 +109,7 @@ class SparseArray : public StackObj { int size() const { return _num; } - bool slot_is_null(int i) const { check_index(i); return _slots[i] == NULL; } + bool slot_is_null(int i) const { check_index(i); return _slots[i] == nullptr; } DEBUG_ONLY(void check_slot_is_null(int i) const { assert(slot_is_null(i), "Slot %d is not null", i); }) DEBUG_ONLY(void check_slot_is_not_null(int i) const { assert(!slot_is_null(i), "Slot %d is null", i); }) diff --git a/test/hotspot/gtest/metaspace/test_binlist.cpp b/test/hotspot/gtest/metaspace/test_binlist.cpp index c526d4cd492b..86cc22f69e4d 100644 --- a/test/hotspot/gtest/metaspace/test_binlist.cpp +++ b/test/hotspot/gtest/metaspace/test_binlist.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -62,7 +62,7 @@ struct BinListBasicTest { // Try to get a block from an empty list. size_t real_size = 4711; MetaWord* p = bl.remove_block(innocous_size, &real_size); - EXPECT_EQ(p, (MetaWord*)NULL); + EXPECT_EQ(p, (MetaWord*)nullptr); EXPECT_EQ((size_t)0, real_size); // Add a block... @@ -103,7 +103,7 @@ struct BinListBasicTest { CHECK_BL_CONTENT(bl, 0, 0); DEBUG_ONLY(bl.verify();) } else { - EXPECT_EQ(p, (MetaWord*)NULL); + EXPECT_EQ(p, (MetaWord*)nullptr); EXPECT_EQ((size_t)0, real_size); CHECK_BL_CONTENT(bl, 1, s1); DEBUG_ONLY(bl.verify();) @@ -136,7 +136,7 @@ struct BinListBasicTest { for (;;) { size_t s = rgen.get(); MetaWord* p = fb.get(s); - if (p != NULL) { + if (p != nullptr) { bl[which].add_block(p, s); cnt[which].add(s); which = which == 0 ? 1 : 0; @@ -157,7 +157,7 @@ struct BinListBasicTest { size_t real_size = 4711; MetaWord* p = bl[giver].remove_block(s, &real_size); - if (p != NULL) { + if (p != nullptr) { ASSERT_TRUE(fb.is_valid_range(p, real_size)); ASSERT_GE(real_size, s); @@ -167,7 +167,7 @@ struct BinListBasicTest { cnt[taker].add(real_size); } else { - ASSERT_EQ(real_size, (size_t)NULL); + ASSERT_EQ(real_size, (size_t)nullptr); } CHECK_COUNTERS; @@ -186,7 +186,7 @@ struct BinListBasicTest { size_t real_size = 4711; MetaWord* p = bl[which].remove_block(minws, &real_size); - ASSERT_NE(p, (MetaWord*) NULL); + ASSERT_NE(p, (MetaWord*) nullptr); ASSERT_GE(real_size, minws); ASSERT_TRUE(fb.is_valid_range(p, real_size)); diff --git a/test/hotspot/gtest/metaspace/test_blocktree.cpp b/test/hotspot/gtest/metaspace/test_blocktree.cpp index e149e9777fe9..50ec021ec112 100644 --- a/test/hotspot/gtest/metaspace/test_blocktree.cpp +++ b/test/hotspot/gtest/metaspace/test_blocktree.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -59,7 +59,7 @@ TEST_VM(metaspace, BlockTree_basic) { CHECK_BT_CONTENT(bt, 0, 0); size_t real_size = 0; - MetaWord* p = NULL; + MetaWord* p = nullptr; MetaWord arr[10000]; ASSERT_LE(BlockTree::MinWordSize, (size_t)6); // Sanity check. Adjust if Node is changed. @@ -278,7 +278,7 @@ class BlockTreeTest { // Feed the whole feeder buffer to the trees, according to feeding_pattern. void feed_all(feeding_pattern_t feeding_pattern) { - MetaWord* p = NULL; + MetaWord* p = nullptr; unsigned added = 0; // If we feed in small graining, we cap the number of blocks to limit test duration. @@ -306,14 +306,14 @@ class BlockTreeTest { // Get a block from the feeder buffer; feed it alternatingly to either tree. p = _fb.get(s); - if (p != NULL) { + if (p != nullptr) { int which = added % 2; added++; _bt[which].add_block(p, s); _cnt[which].add(s); CHECK_COUNTERS } - } while (p != NULL && added < max_blocks); + } while (p != nullptr && added < max_blocks); DEBUG_ONLY(verify_trees();) @@ -335,7 +335,7 @@ class BlockTreeTest { size_t s =_rgen.get(); size_t real_size = 0; MetaWord* p = _bt[giver].remove_block(s, &real_size); - if (p != NULL) { + if (p != nullptr) { ASSERT_TRUE(_fb.is_valid_range(p, real_size)); ASSERT_GE(real_size, s); _bt[taker].add_block(p, real_size); diff --git a/test/hotspot/gtest/metaspace/test_chunkManager_stress.cpp b/test/hotspot/gtest/metaspace/test_chunkManager_stress.cpp index 6c4b8e757938..cdcd9c1fdab9 100644 --- a/test/hotspot/gtest/metaspace/test_chunkManager_stress.cpp +++ b/test/hotspot/gtest/metaspace/test_chunkManager_stress.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2020, 2023 SAP SE. All rights reserved. - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, 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 @@ -116,9 +116,9 @@ class ChunkManagerRandomChunkAllocTest { const chunklevel_t max_level = r.highest(); const size_t min_committed = random_committed_words(max_level, _commit_factor); - Metachunk* c = NULL; + Metachunk* c = nullptr; _context.alloc_chunk(&c, r.lowest(), r.highest(), min_committed); - if (c == NULL) { + if (c == nullptr) { EXPECT_TRUE(could_be_reserve_error() || could_be_commit_error(min_committed)); LOG("Alloc chunk at %d failed.", slot); @@ -162,7 +162,7 @@ class ChunkManagerRandomChunkAllocTest { Metachunk* c = _chunks.at(slot); LOG("Returning chunk at %d: " METACHUNK_FORMAT ".", slot, METACHUNK_FORMAT_ARGS(c)); _context.return_chunk(c); - _chunks.set_at(slot, NULL); + _chunks.set_at(slot, nullptr); } // return a random number of chunks (at most a quarter of the full slot range) diff --git a/test/hotspot/gtest/metaspace/test_chunkheaderpool.cpp b/test/hotspot/gtest/metaspace/test_chunkheaderpool.cpp index 226df7e10294..c6c0a773aed6 100644 --- a/test/hotspot/gtest/metaspace/test_chunkheaderpool.cpp +++ b/test/hotspot/gtest/metaspace/test_chunkheaderpool.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -48,12 +48,12 @@ class ChunkHeaderPoolTest { LOG("attempt_free_at " SIZE_FORMAT ".", index); - if (_elems[index] == NULL) { + if (_elems[index] == nullptr) { return; } _pool.return_chunk_header(_elems[index]); - _elems[index] = NULL; + _elems[index] = nullptr; _num_allocated.decrement(); DEBUG_ONLY(_num_allocated.check(_pool.used());) @@ -66,7 +66,7 @@ class ChunkHeaderPoolTest { LOG("attempt_allocate_at " SIZE_FORMAT ".", index); - if (_elems[index] != NULL) { + if (_elems[index] != nullptr) { return; } @@ -82,7 +82,7 @@ class ChunkHeaderPoolTest { } void attempt_allocate_or_free_at(size_t index) { - if (_elems[index] == NULL) { + if (_elems[index] == nullptr) { attempt_allocate_at(index); } else { attempt_free_at(index); diff --git a/test/hotspot/gtest/metaspace/test_freeblocks.cpp b/test/hotspot/gtest/metaspace/test_freeblocks.cpp index 6ca5fb8b05fc..fbf2e822c113 100644 --- a/test/hotspot/gtest/metaspace/test_freeblocks.cpp +++ b/test/hotspot/gtest/metaspace/test_freeblocks.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -72,7 +72,7 @@ class FreeBlocksTest { bool feed_some() { size_t word_size = _rgen_feeding.get(); MetaWord* p = _fb.get(word_size); - if (p != NULL) { + if (p != nullptr) { _freeblocks.add_block(p, word_size); return true; } @@ -82,7 +82,7 @@ class FreeBlocksTest { bool deallocate_top() { allocation_t* a = _allocations; - if (a != NULL) { + if (a != nullptr) { _allocations = a->next; check_marked_range(a->p, a->word_size); _freeblocks.add_block(a->p, a->word_size); @@ -101,7 +101,7 @@ class FreeBlocksTest { size_t word_size = MAX2(_rgen_allocations.get(), _freeblocks.MinWordSize); MetaWord* p = _freeblocks.remove_block(word_size); - if (p != NULL) { + if (p != nullptr) { _allocated_words.increment_by(word_size); allocation_t* a = new allocation_t; a->p = p; a->word_size = word_size; @@ -115,7 +115,7 @@ class FreeBlocksTest { } void test_all_marked_ranges() { - for (allocation_t* a = _allocations; a != NULL; a = a->next) { + for (allocation_t* a = _allocations; a != nullptr; a = a->next) { check_marked_range(a->p, a->word_size); } } @@ -177,7 +177,7 @@ class FreeBlocksTest { _fb(512 * K), _freeblocks(), _rgen_feeding(128, 4096), _rgen_allocations(avg_alloc_size / 4, avg_alloc_size * 2, 0.01f, avg_alloc_size / 3, avg_alloc_size * 30), - _allocations(NULL), + _allocations(nullptr), _num_allocs(0), _num_deallocs(0), _num_feeds(0) diff --git a/test/hotspot/gtest/metaspace/test_is_metaspace_obj.cpp b/test/hotspot/gtest/metaspace/test_is_metaspace_obj.cpp index 820ad1fd3d16..0304cca7374d 100644 --- a/test/hotspot/gtest/metaspace/test_is_metaspace_obj.cpp +++ b/test/hotspot/gtest/metaspace/test_is_metaspace_obj.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -42,7 +42,7 @@ class MetaspaceIsMetaspaceObjTest { public: - MetaspaceIsMetaspaceObjTest() : _lock(NULL), _ms(NULL) {} + MetaspaceIsMetaspaceObjTest() : _lock(nullptr), _ms(nullptr) {} ~MetaspaceIsMetaspaceObjTest() { delete _ms; delete _lock; @@ -75,7 +75,7 @@ class MetaspaceIsMetaspaceObjTest { ASSERT_TRUE(vslist->contains((MetaWord*)((address)p) + 1)); // Now for some bogus values - ASSERT_FALSE(MetaspaceObj::is_valid((MetaspaceObj*)NULL)); + ASSERT_FALSE(MetaspaceObj::is_valid((MetaspaceObj*)nullptr)); // Should exercise various paths in MetaspaceObj::is_valid() ASSERT_FALSE(MetaspaceObj::is_valid((MetaspaceObj*)1024)); @@ -93,9 +93,9 @@ class MetaspaceIsMetaspaceObjTest { ASSERT_TRUE(Metaspace::contains_non_shared(p)); delete _ms; - _ms = NULL; + _ms = nullptr; delete _lock; - _lock = NULL; + _lock = nullptr; } }; diff --git a/test/hotspot/gtest/metaspace/test_metachunk.cpp b/test/hotspot/gtest/metaspace/test_metachunk.cpp index 5e6a8c1c1b22..d60bdab7bfa7 100644 --- a/test/hotspot/gtest/metaspace/test_metachunk.cpp +++ b/test/hotspot/gtest/metaspace/test_metachunk.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2020, 2023 SAP SE. All rights reserved. - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -44,7 +44,7 @@ using namespace metaspace::chunklevel; TEST_VM(metaspace, get_chunk) { ChunkGtestContext context(8 * M); - Metachunk* c = NULL; + Metachunk* c = nullptr; for (chunklevel_t pref_lvl = LOWEST_CHUNK_LEVEL; pref_lvl <= HIGHEST_CHUNK_LEVEL; pref_lvl++) { @@ -70,7 +70,7 @@ TEST_VM(metaspace, get_chunk_with_commit_limit) { commit_limit_words < MAX_CHUNK_WORD_SIZE * 2; commit_limit_words *= 2) { ChunkGtestContext context(commit_limit_words); - Metachunk* c = NULL; + Metachunk* c = nullptr; for (chunklevel_t pref_lvl = LOWEST_CHUNK_LEVEL; pref_lvl <= HIGHEST_CHUNK_LEVEL; pref_lvl++) { @@ -103,7 +103,7 @@ TEST_VM(metaspace, get_chunk_with_commit_limit) { TEST_VM(metaspace, get_chunk_recommit) { ChunkGtestContext context; - Metachunk* c = NULL; + Metachunk* c = nullptr; context.alloc_chunk_expect_success(&c, ROOT_CHUNK_LEVEL, ROOT_CHUNK_LEVEL, 0); context.uncommit_chunk_with_test(c); @@ -136,7 +136,7 @@ TEST_VM(metaspace, get_chunk_with_reserve_limit) { // root chunk. // Cause allocation of the firstone root chunk, should still work: - Metachunk* c = NULL; + Metachunk* c = nullptr; context.alloc_chunk_expect_success(&c, HIGHEST_CHUNK_LEVEL); // and this should need a new root chunk and hence fail: @@ -152,7 +152,7 @@ TEST_VM(metaspace, chunk_allocate_full) { ChunkGtestContext context; for (chunklevel_t lvl = LOWEST_CHUNK_LEVEL; lvl <= HIGHEST_CHUNK_LEVEL; lvl++) { - Metachunk* c = NULL; + Metachunk* c = nullptr; context.alloc_chunk_expect_success(&c, lvl); context.allocate_from_chunk(c, c->word_size()); context.return_chunk(c); @@ -167,7 +167,7 @@ TEST_VM(metaspace, chunk_allocate_random) { for (chunklevel_t lvl = LOWEST_CHUNK_LEVEL; lvl <= HIGHEST_CHUNK_LEVEL; lvl++) { - Metachunk* c = NULL; + Metachunk* c = nullptr; context.alloc_chunk_expect_success(&c, lvl); context.uncommit_chunk_with_test(c); // start out fully uncommitted @@ -202,11 +202,11 @@ TEST_VM(metaspace, chunk_buddy_stuff) { // (Note: strictly speaking the ChunkManager does not promise any placement but // we know how the placement works so these tests make sense). - Metachunk* c1 = NULL; + Metachunk* c1 = nullptr; context.alloc_chunk(&c1, CHUNK_LEVEL_1K); EXPECT_TRUE(c1->is_leader()); - Metachunk* c2 = NULL; + Metachunk* c2 = nullptr; context.alloc_chunk(&c2, CHUNK_LEVEL_1K); EXPECT_FALSE(c2->is_leader()); @@ -234,7 +234,7 @@ TEST_VM(metaspace, chunk_allocate_with_commit_limit) { ChunkGtestContext context(commit_limit); // A big chunk, but uncommitted. - Metachunk* c = NULL; + Metachunk* c = nullptr; context.alloc_chunk_expect_success(&c, ROOT_CHUNK_LEVEL, ROOT_CHUNK_LEVEL, 0); context.uncommit_chunk_with_test(c); // ... just to make sure. @@ -310,7 +310,7 @@ TEST_VM(metaspace, chunk_split_and_merge) { // Split a fully committed chunk. The resulting chunk should be fully // committed as well, and have its content preserved. - Metachunk* c = NULL; + Metachunk* c = nullptr; context.alloc_chunk_expect_success(&c, orig_lvl); // We allocate from this chunk to be able to completely paint the payload. @@ -387,7 +387,7 @@ TEST_VM(metaspace, chunk_enlarge_in_place) { // Starting with the smallest chunk size, attempt to enlarge the chunk in place until we arrive // at root chunk size. Since the state is clean, this should work. - Metachunk* c = NULL; + Metachunk* c = nullptr; context.alloc_chunk_expect_success(&c, HIGHEST_CHUNK_LEVEL); chunklevel_t l = c->level(); diff --git a/test/hotspot/gtest/metaspace/test_metachunklist.cpp b/test/hotspot/gtest/metaspace/test_metachunklist.cpp index ef4cb17e4326..59f0959c9974 100644 --- a/test/hotspot/gtest/metaspace/test_metachunklist.cpp +++ b/test/hotspot/gtest/metaspace/test_metachunklist.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2020, 2023 SAP SE. All rights reserved. - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, 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 @@ -49,7 +49,7 @@ TEST_VM(metaspace, metachunklist) { size_t total_size = 0; for (int i = 0; i < 10; i++) { - Metachunk* c = NULL; + Metachunk* c = nullptr; context.alloc_chunk_expect_success(&c, ChunkLevelRanges::all_chunks().random_value()); chunks[i] = c; total_size += c->committed_words(); @@ -95,7 +95,7 @@ TEST_VM(metaspace, freechunklist) { // Make every other chunk randomly uncommitted, and later we check that committed chunks are sorted in at the front // of the lists. for (int i = 0; i < 100; i++) { - Metachunk* c = NULL; + Metachunk* c = nullptr; context.alloc_chunk_expect_success(&c, ChunkLevelRanges::all_chunks().random_value()); bool uncommitted_chunk = i % 3; if (uncommitted_chunk) { @@ -122,7 +122,7 @@ TEST_VM(metaspace, freechunklist) { for (chunklevel_t lvl = LOWEST_CHUNK_LEVEL; lvl <= HIGHEST_CHUNK_LEVEL; lvl++) { Metachunk* c = lst.remove_first(lvl); bool found_uncommitted = false; - while (c != NULL) { + while (c != nullptr) { LOG("<-" METACHUNK_FULL_FORMAT, METACHUNK_FULL_FORMAT_ARGS(c)); @@ -153,7 +153,7 @@ TEST_VM(metaspace, freechunklist_retrieval) { ChunkGtestContext context; FreeChunkList fcl; - Metachunk* c = NULL; + Metachunk* c = nullptr; // For a chunk level which allows us to have partially committed chunks... const size_t chunk_word_size = Settings::commit_granule_words() * 4; @@ -162,19 +162,19 @@ TEST_VM(metaspace, freechunklist_retrieval) { // get some chunks: // ...a completely uncommitted one ... - Metachunk* c_0 = NULL; + Metachunk* c_0 = nullptr; context.alloc_chunk_expect_success(&c_0, lvl, lvl, 0); // ... a fully committed one ... - Metachunk* c_full = NULL; + Metachunk* c_full = nullptr; context.alloc_chunk_expect_success(&c_full, lvl); // ... a chunk with one commit granule committed ... - Metachunk* c_1g = NULL; + Metachunk* c_1g = nullptr; context.alloc_chunk_expect_success(&c_1g, lvl, lvl, Settings::commit_granule_words()); // ... a chunk with two commit granules committed. - Metachunk* c_2g = NULL; + Metachunk* c_2g = nullptr; context.alloc_chunk_expect_success(&c_2g, lvl, lvl, Settings::commit_granule_words() * 2); LOG("c_0: " METACHUNK_FULL_FORMAT, METACHUNK_FULL_FORMAT_ARGS(c_0)); diff --git a/test/hotspot/gtest/metaspace/test_metaspacearena.cpp b/test/hotspot/gtest/metaspace/test_metaspacearena.cpp index 8c1a21cf6dde..2c05e1f51f0a 100644 --- a/test/hotspot/gtest/metaspace/test_metaspacearena.cpp +++ b/test/hotspot/gtest/metaspace/test_metaspacearena.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020, 2023 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -109,12 +109,12 @@ class MetaspaceArenaTestHelper { // in non-void returning tests. void delete_arena_with_tests() { - if (_arena != NULL) { + if (_arena != nullptr) { size_t used_words_before = _used_words_counter.get(); size_t committed_words_before = limiter().committed_words(); DEBUG_ONLY(_arena->verify()); delete _arena; - _arena = NULL; + _arena = nullptr; size_t used_words_after = _used_words_counter.get(); size_t committed_words_after = limiter().committed_words(); ASSERT_0(used_words_after); @@ -124,14 +124,14 @@ class MetaspaceArenaTestHelper { void usage_numbers_with_test(size_t* p_used, size_t* p_committed, size_t* p_capacity) const { _arena->usage_numbers(p_used, p_committed, p_capacity); - if (p_used != NULL) { - if (p_committed != NULL) { + if (p_used != nullptr) { + if (p_committed != nullptr) { ASSERT_GE(*p_committed, *p_used); } // Since we own the used words counter, it should reflect our usage number 1:1 ASSERT_EQ(_used_words_counter.get(), *p_used); } - if (p_committed != NULL && p_capacity != NULL) { + if (p_committed != nullptr && p_capacity != nullptr) { ASSERT_GE(*p_capacity, *p_committed); } } @@ -144,13 +144,13 @@ class MetaspaceArenaTestHelper { // Allocate; caller expects success but is not interested in return value void allocate_from_arena_with_tests_expect_success(size_t word_size) { - MetaWord* dummy = NULL; + MetaWord* dummy = nullptr; allocate_from_arena_with_tests_expect_success(&dummy, word_size); } // Allocate; caller expects failure void allocate_from_arena_with_tests_expect_failure(size_t word_size) { - MetaWord* dummy = NULL; + MetaWord* dummy = nullptr; allocate_from_arena_with_tests(&dummy, word_size); ASSERT_NULL(dummy); } @@ -171,7 +171,7 @@ class MetaspaceArenaTestHelper { size_t used2 = 0, committed2 = 0, capacity2 = 0; usage_numbers_with_test(&used2, &committed2, &capacity2); - if (p == NULL) { + if (p == nullptr) { // Allocation failed. ASSERT_LT(possible_expansion, word_size); ASSERT_EQ(used, used2); @@ -194,7 +194,7 @@ class MetaspaceArenaTestHelper { // Allocate; it may or may not work; but caller does not care for the result value void allocate_from_arena_with_tests(size_t word_size) { - MetaWord* dummy = NULL; + MetaWord* dummy = nullptr; allocate_from_arena_with_tests(&dummy, word_size); } @@ -419,25 +419,25 @@ TEST_VM(metaspace, MetaspaceArena_deallocate) { MetaspaceGtestContext context; MetaspaceArenaTestHelper helper(context, Metaspace::StandardMetaspaceType, false); - MetaWord* p1 = NULL; + MetaWord* p1 = nullptr; helper.allocate_from_arena_with_tests_expect_success(&p1, s); size_t used1 = 0, capacity1 = 0; - helper.usage_numbers_with_test(&used1, NULL, &capacity1); + helper.usage_numbers_with_test(&used1, nullptr, &capacity1); ASSERT_EQ(used1, s); helper.deallocate_with_tests(p1, s); size_t used2 = 0, capacity2 = 0; - helper.usage_numbers_with_test(&used2, NULL, &capacity2); + helper.usage_numbers_with_test(&used2, nullptr, &capacity2); ASSERT_EQ(used1, used2); ASSERT_EQ(capacity2, capacity2); - MetaWord* p2 = NULL; + MetaWord* p2 = nullptr; helper.allocate_from_arena_with_tests_expect_success(&p2, s); size_t used3 = 0, capacity3 = 0; - helper.usage_numbers_with_test(&used3, NULL, &capacity3); + helper.usage_numbers_with_test(&used3, nullptr, &capacity3); ASSERT_EQ(used3, used2); ASSERT_EQ(capacity3, capacity2); @@ -484,8 +484,8 @@ static void test_recover_from_commit_limit_hit() { // Now, allocating from helper3, creep up on the limit size_t allocated_from_3 = 0; - MetaWord* p = NULL; - while ( (helper3.allocate_from_arena_with_tests(&p, 1), p != NULL) && + MetaWord* p = nullptr; + while ( (helper3.allocate_from_arena_with_tests(&p, 1), p != nullptr) && ++allocated_from_3 < Settings::commit_granule_words() * 2); EXPECT_LE(allocated_from_3, Settings::commit_granule_words() * 2); @@ -745,7 +745,7 @@ static void test_repeatedly_allocate_and_deallocate(bool is_topmost) { // Test various sizes, including (important) the max. possible block size = 1 root chunk for (size_t blocksize = Metaspace::max_allocation_word_size(); blocksize >= 1; blocksize /= 2) { size_t used1 = 0, used2 = 0, committed1 = 0, committed2 = 0; - MetaWord* p = NULL, *p2 = NULL; + MetaWord* p = nullptr, *p2 = nullptr; MetaspaceGtestContext context; MetaspaceArenaTestHelper helper(context, Metaspace::StandardMetaspaceType, false); @@ -758,7 +758,7 @@ static void test_repeatedly_allocate_and_deallocate(bool is_topmost) { } // Measure - helper.usage_numbers_with_test(&used1, &committed1, NULL); + helper.usage_numbers_with_test(&used1, &committed1, nullptr); // Dealloc, alloc several times with the same size. for (int i = 0; i < 5; i ++) { @@ -769,7 +769,7 @@ static void test_repeatedly_allocate_and_deallocate(bool is_topmost) { } // Measure again - helper.usage_numbers_with_test(&used2, &committed2, NULL); + helper.usage_numbers_with_test(&used2, &committed2, nullptr); EXPECT_EQ(used2, used1); EXPECT_EQ(committed1, committed2); } diff --git a/test/hotspot/gtest/metaspace/test_metaspacearena_stress.cpp b/test/hotspot/gtest/metaspace/test_metaspacearena_stress.cpp index 3099fc4ee9ec..3a7bc9dba635 100644 --- a/test/hotspot/gtest/metaspace/test_metaspacearena_stress.cpp +++ b/test/hotspot/gtest/metaspace/test_metaspacearena_stress.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -72,13 +72,13 @@ class MetaspaceArenaTestBed : public CHeapObj { // later check for overwriters. struct allocation_t { allocation_t* next; - MetaWord* p; // NULL if deallocated + MetaWord* p; // nullptr if deallocated size_t word_size; void mark() { mark_range(p, word_size); } void verify() const { - if (p != NULL) { + if (p != nullptr) { check_marked_range(p, word_size); } } @@ -134,11 +134,11 @@ class MetaspaceArenaTestBed : public CHeapObj { MetaspaceArenaTestBed(ChunkManager* cm, const ArenaGrowthPolicy* alloc_sequence, SizeAtomicCounter* used_words_counter, SizeRange allocation_range) : - _arena(NULL), - _lock(NULL), + _arena(nullptr), + _lock(nullptr), _allocation_range(allocation_range), _size_of_last_failed_allocation(0), - _allocations(NULL), + _allocations(nullptr), _alloc_count(), _dealloc_count() { @@ -154,7 +154,7 @@ class MetaspaceArenaTestBed : public CHeapObj { verify_arena_statistics(); allocation_t* a = _allocations; - while (a != NULL) { + while (a != nullptr) { allocation_t* b = a->next; a->verify(); FREE_C_HEAP_OBJ(a); @@ -178,7 +178,7 @@ class MetaspaceArenaTestBed : public CHeapObj { bool checked_random_allocate() { size_t word_size = 1 + _allocation_range.random_value(); MetaWord* p = _arena->allocate(word_size); - if (p != NULL) { + if (p != nullptr) { EXPECT_TRUE(is_aligned(p, sizeof(MetaWord))); allocation_t* a = NEW_C_HEAP_OBJ(allocation_t, mtInternal); a->word_size = word_size; @@ -201,14 +201,14 @@ class MetaspaceArenaTestBed : public CHeapObj { // Deallocate a random allocation void checked_random_deallocate() { allocation_t* a = _allocations; - while (a && a->p != NULL && os::random() % 10 != 0) { + while (a && a->p != nullptr && os::random() % 10 != 0) { a = a->next; } - if (a != NULL && a->p != NULL) { + if (a != nullptr && a->p != nullptr) { a->verify(); _arena->deallocate(a->p, a->word_size); _dealloc_count.add(a->word_size); - a->p = NULL; a->word_size = 0; + a->p = nullptr; a->word_size = 0; if ((_dealloc_count.count() % 20) == 0) { verify_arena_statistics(); DEBUG_ONLY(_arena->verify();) @@ -268,7 +268,7 @@ class MetaspaceArenaTest { DEBUG_ONLY(_testbeds.check_slot_is_not_null(slotindex)); MetaspaceArenaTestBed* bed = _testbeds.at(slotindex); delete bed; // This will return all its memory to the chunk manager - _testbeds.set_at(slotindex, NULL); + _testbeds.set_at(slotindex, nullptr); _num_beds.decrement(); } diff --git a/test/hotspot/gtest/metaspace/test_virtualspacenode.cpp b/test/hotspot/gtest/metaspace/test_virtualspacenode.cpp index 6d21dbf76788..52ebd7ba8b59 100644 --- a/test/hotspot/gtest/metaspace/test_virtualspacenode.cpp +++ b/test/hotspot/gtest/metaspace/test_virtualspacenode.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020, 2021 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -92,7 +92,7 @@ class VirtualSpaceNodeTest { verify(); const bool node_is_full = _node->used_words() == _node->word_size(); - Metachunk* c = NULL; + Metachunk* c = nullptr; { MutexLocker fcl(Metaspace_lock, Mutex::_no_safepoint_check_flag); c = _node->allocate_root_chunk(); @@ -264,7 +264,7 @@ class VirtualSpaceNodeTest { //freelist->print_on(tty); - Metachunk* result = NULL; + Metachunk* result = nullptr; { MutexLocker fcl(Metaspace_lock, Mutex::_no_safepoint_check_flag); result = _node->merge(c, freelist); @@ -299,7 +299,7 @@ class VirtualSpaceNodeTest { _counter_reserved_words(), _counter_committed_words(), _commit_limiter(commit_limit), - _node(NULL), + _node(nullptr), _vs_word_size(vs_word_size), _commit_limit(commit_limit) { @@ -333,14 +333,14 @@ class VirtualSpaceNodeTest { } void test_exhaust_node() { - Metachunk* c = NULL; + Metachunk* c = nullptr; bool rc = true; do { c = alloc_root_chunk(); - if (c != NULL) { + if (c != nullptr) { rc = commit_root_chunk(c, c->word_size()); } - } while (c != NULL && rc); + } while (c != nullptr && rc); } void test_arbitrary_commits() { diff --git a/test/hotspot/gtest/nmt/test_nmt_buffer_overflow_detection.cpp b/test/hotspot/gtest/nmt/test_nmt_buffer_overflow_detection.cpp index fe9dbb1f5da0..9a26e61869c0 100644 --- a/test/hotspot/gtest/nmt/test_nmt_buffer_overflow_detection.cpp +++ b/test/hotspot/gtest/nmt/test_nmt_buffer_overflow_detection.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2022 SAP SE. All rights reserved. - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, 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 @@ -112,7 +112,7 @@ DEFINE_TEST(test_double_free, "header canary") /////// static void test_invalid_block_address() { - // very low, like the result of an overflow or of accessing a NULL this pointer + // very low, like the result of an overflow or of accessing a null this pointer os::free((void*)0x100); } DEFINE_TEST(test_invalid_block_address, "invalid block address") diff --git a/test/hotspot/gtest/nmt/test_nmtpreinit.cpp b/test/hotspot/gtest/nmt/test_nmtpreinit.cpp index 9befda97bdc5..55c12f83e4be 100644 --- a/test/hotspot/gtest/nmt/test_nmtpreinit.cpp +++ b/test/hotspot/gtest/nmt/test_nmtpreinit.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2021, 2022 SAP SE. All rights reserved. - * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2024, 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 @@ -84,11 +84,11 @@ class TestAllocations { os::free(os_malloc(0)); // 0-sized allocation, should be free-able p2 = os_realloc(os_malloc(10), 20); // realloc, growing p3 = os_realloc(os_malloc(20), 10); // realloc, shrinking - p4 = os_realloc(NULL, 10); // realloc with NULL pointer + p4 = os_realloc(nullptr, 10); // realloc with null pointer os_realloc(os_realloc(os_malloc(20), 0), 30); // realloc to size 0 and back up again os::free(os_malloc(20)); // malloc, free os::free(os_realloc(os_malloc(20), 30)); // malloc, realloc, free - os::free(NULL); // free(null) + os::free(nullptr); // free(null) DEBUG_ONLY(NMTPreInit::verify();) // This should result in a fatal native oom error from NMT preinit with a clear error message. diff --git a/test/hotspot/gtest/nmt/test_nmtpreinitmap.cpp b/test/hotspot/gtest/nmt/test_nmtpreinitmap.cpp index cf4a77c39761..f83ee3e883a3 100644 --- a/test/hotspot/gtest/nmt/test_nmtpreinitmap.cpp +++ b/test/hotspot/gtest/nmt/test_nmtpreinitmap.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2021, 2022 SAP SE. All rights reserved. - * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2024, 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 @@ -106,7 +106,7 @@ TEST_VM(NMTPreInit, stress_test_map) { NMTPreInitAllocation* a = table.find_and_remove(allocations[i]->payload); ASSERT_EQ(a, allocations[i]); NMTPreInitAllocation::do_free(a); - allocations[i] = NULL; + allocations[i] = nullptr; } print_and_check_table(table, 0); diff --git a/test/hotspot/gtest/os/linux/test_cgroupSubsystem_linux.cpp b/test/hotspot/gtest/os/linux/test_cgroupSubsystem_linux.cpp index cfac19185a39..475b6eadb740 100644 --- a/test/hotspot/gtest/os/linux/test_cgroupSubsystem_linux.cpp +++ b/test/hotspot/gtest/os/linux/test_cgroupSubsystem_linux.cpp @@ -61,7 +61,7 @@ void delete_file(const char* filename) { class TestController : public CgroupController { public: char* subsystem_path() override { - // The real subsystem is in /tmp/, generaed by temp_file() + // The real subsystem is in /tmp/, generated by temp_file() return (char*)"/"; }; }; @@ -99,6 +99,9 @@ TEST(cgroupTest, SubSystemFileLineContentsMultipleLinesErrorCases) { fill_file(test_file, "foof bar"); err = subsystem_file_line_contents(&my_controller, test_file, "foo", "%s", &s); EXPECT_NE(err, 0) << "Key must be exact match"; + + // Cleanup + delete_file(test_file); } TEST(cgroupTest, SubSystemFileLineContentsMultipleLinesSuccessCases) { @@ -149,6 +152,9 @@ TEST(cgroupTest, SubSystemFileLineContentsMultipleLinesSuccessCases) { err = subsystem_file_line_contents(&my_controller, test_file, nullptr, "%*s %d", &x); EXPECT_EQ(err, 0); EXPECT_EQ(x, 10001); + + // Cleanup + delete_file(test_file); } TEST(cgroupTest, SubSystemFileLineContentsSingleLine) { @@ -190,6 +196,9 @@ TEST(cgroupTest, SubSystemFileLineContentsSingleLine) { err = subsystem_file_line_contents(&my_controller, test_file, nullptr, JULONG_FORMAT, &z); EXPECT_EQ(err, 0); EXPECT_EQ(z, (julong)1337) << "Wrong value for z"; + + // Cleanup + delete_file(test_file); } #endif // LINUX diff --git a/test/hotspot/gtest/runtime/test_ThreadsListHandle.cpp b/test/hotspot/gtest/runtime/test_ThreadsListHandle.cpp index 0403ef37d301..81d36670c9a8 100644 --- a/test/hotspot/gtest/runtime/test_ThreadsListHandle.cpp +++ b/test/hotspot/gtest/runtime/test_ThreadsListHandle.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, 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 @@ -83,10 +83,10 @@ TEST_VM(ThreadsListHandle, sanity) { // // Verify the current thread refers to no ThreadsListHandle: - EXPECT_EQ(ThreadsListHandleTest::get_Thread_threads_hazard_ptr(thr), (ThreadsList*)NULL) - << "thr->_threads_hazard_ptr must be NULL"; - EXPECT_EQ(ThreadsListHandleTest::get_Thread_threads_list_ptr(thr), (SafeThreadsListPtr*) NULL) - << "thr->_threads_list_ptr must be NULL"; + EXPECT_EQ(ThreadsListHandleTest::get_Thread_threads_hazard_ptr(thr), (ThreadsList*)nullptr) + << "thr->_threads_hazard_ptr must be null"; + EXPECT_EQ(ThreadsListHandleTest::get_Thread_threads_list_ptr(thr), (SafeThreadsListPtr*) nullptr) + << "thr->_threads_list_ptr must be null"; EXPECT_EQ(ThreadsListHandleTest::get_Thread_nested_threads_hazard_ptr_cnt(thr), (uint)0) << "thr->_nested_threads_hazard_ptr_cnt must be 0"; @@ -105,8 +105,8 @@ TEST_VM(ThreadsListHandle, sanity) { << "thr->_nested_threads_hazard_ptr_cnt must be 0"; // Verify tlh1 has the right field values: - EXPECT_EQ(list_ptr1->previous(), (SafeThreadsListPtr*)NULL) - << "list_ptr1->previous() must be NULL"; + EXPECT_EQ(list_ptr1->previous(), (SafeThreadsListPtr*)nullptr) + << "list_ptr1->previous() must be null"; EXPECT_EQ(ThreadsListHandleTest::get_STLP_thread(list_ptr1), thr) << "list_ptr1->_thread must match current thread"; EXPECT_EQ(list_ptr1->list(), tlh1.list()) @@ -125,10 +125,10 @@ TEST_VM(ThreadsListHandle, sanity) { // // Verify the current thread refers to no ThreadsListHandle: - EXPECT_EQ(ThreadsListHandleTest::get_Thread_threads_hazard_ptr(thr), (ThreadsList*)NULL) - << "thr->_threads_hazard_ptr must match be NULL"; - EXPECT_EQ(ThreadsListHandleTest::get_Thread_threads_list_ptr(thr), (SafeThreadsListPtr*) NULL) - << "thr->_threads_list_ptr must be NULL"; + EXPECT_EQ(ThreadsListHandleTest::get_Thread_threads_hazard_ptr(thr), (ThreadsList*)nullptr) + << "thr->_threads_hazard_ptr must match be null"; + EXPECT_EQ(ThreadsListHandleTest::get_Thread_threads_list_ptr(thr), (SafeThreadsListPtr*) nullptr) + << "thr->_threads_list_ptr must be null"; EXPECT_EQ(ThreadsListHandleTest::get_Thread_nested_threads_hazard_ptr_cnt(thr), (uint)0) << "thr->_nested_threads_hazard_ptr_cnt must be 0"; @@ -147,8 +147,8 @@ TEST_VM(ThreadsListHandle, sanity) { << "thr->_nested_threads_hazard_ptr_cnt must be 0"; // Verify tlh1 has the right field values: - EXPECT_EQ(list_ptr1->previous(), (SafeThreadsListPtr*)NULL) - << "list_ptr1->previous() must be NULL"; + EXPECT_EQ(list_ptr1->previous(), (SafeThreadsListPtr*)nullptr) + << "list_ptr1->previous() must be null"; EXPECT_EQ(ThreadsListHandleTest::get_STLP_thread(list_ptr1), thr) << "list_ptr1->_thread must match current thread"; EXPECT_EQ(list_ptr1->list(), tlh1.list()) @@ -195,8 +195,8 @@ TEST_VM(ThreadsListHandle, sanity) { << "list_ptr2->_needs_release must be true"; // Verify tlh1 has the right field values: - EXPECT_EQ(list_ptr1->previous(), (SafeThreadsListPtr*)NULL) - << "list_ptr1->previous() must be NULL"; + EXPECT_EQ(list_ptr1->previous(), (SafeThreadsListPtr*)nullptr) + << "list_ptr1->previous() must be null"; EXPECT_EQ(ThreadsListHandleTest::get_STLP_thread(list_ptr1), thr) << "list_ptr1->_thread must match current thread"; EXPECT_EQ(list_ptr1->list(), tlh1.list()) @@ -215,9 +215,9 @@ TEST_VM(ThreadsListHandle, sanity) { // Test case: after first nested ThreadsListHandle (tlh2) has been destroyed - // Verify the current thread's hazard ptr is NULL: - EXPECT_EQ(ThreadsListHandleTest::get_Thread_threads_hazard_ptr(thr), (ThreadsList*)NULL) - << "thr->_threads_hazard_ptr must be NULL"; + // Verify the current thread's hazard ptr is null: + EXPECT_EQ(ThreadsListHandleTest::get_Thread_threads_hazard_ptr(thr), (ThreadsList*)nullptr) + << "thr->_threads_hazard_ptr must be null"; // Verify the current thread's threads list ptr refers to tlh1: EXPECT_EQ(ThreadsListHandleTest::get_Thread_threads_list_ptr(thr), list_ptr1) << "thr->_threads_list_ptr must match list_ptr1"; @@ -225,8 +225,8 @@ TEST_VM(ThreadsListHandle, sanity) { << "thr->_nested_threads_hazard_ptr_cnt must be 0"; // Verify tlh1 has the right field values: - EXPECT_EQ(list_ptr1->previous(), (SafeThreadsListPtr*)NULL) - << "list_ptr1->previous() must be NULL"; + EXPECT_EQ(list_ptr1->previous(), (SafeThreadsListPtr*)nullptr) + << "list_ptr1->previous() must be null"; EXPECT_EQ(ThreadsListHandleTest::get_STLP_thread(list_ptr1), thr) << "list_ptr1->_thread must match current thread"; EXPECT_EQ(list_ptr1->list(), tlh1.list()) @@ -247,10 +247,10 @@ TEST_VM(ThreadsListHandle, sanity) { // // Verify the current thread refers to no ThreadsListHandle: - EXPECT_EQ(ThreadsListHandleTest::get_Thread_threads_hazard_ptr(thr), (ThreadsList*)NULL) - << "thr->_threads_hazard_ptr must match be NULL"; - EXPECT_EQ(ThreadsListHandleTest::get_Thread_threads_list_ptr(thr), (SafeThreadsListPtr*) NULL) - << "thr->_threads_list_ptr must be NULL"; + EXPECT_EQ(ThreadsListHandleTest::get_Thread_threads_hazard_ptr(thr), (ThreadsList*)nullptr) + << "thr->_threads_hazard_ptr must match be null"; + EXPECT_EQ(ThreadsListHandleTest::get_Thread_threads_list_ptr(thr), (SafeThreadsListPtr*) nullptr) + << "thr->_threads_list_ptr must be null"; EXPECT_EQ(ThreadsListHandleTest::get_Thread_nested_threads_hazard_ptr_cnt(thr), (uint)0) << "thr->_nested_threads_hazard_ptr_cnt must be 0"; @@ -269,8 +269,8 @@ TEST_VM(ThreadsListHandle, sanity) { << "thr->_nested_threads_hazard_ptr_cnt must be 0"; // Verify tlh1 has the right field values: - EXPECT_EQ(list_ptr1->previous(), (SafeThreadsListPtr*)NULL) - << "list_ptr1->previous() must be NULL"; + EXPECT_EQ(list_ptr1->previous(), (SafeThreadsListPtr*)nullptr) + << "list_ptr1->previous() must be null"; EXPECT_EQ(ThreadsListHandleTest::get_STLP_thread(list_ptr1), thr) << "list_ptr1->_thread must match current thread"; EXPECT_EQ(list_ptr1->list(), tlh1.list()) @@ -317,8 +317,8 @@ TEST_VM(ThreadsListHandle, sanity) { << "list_ptr2->_needs_release must be true"; // Verify tlh1 has the right field values: - EXPECT_EQ(list_ptr1->previous(), (SafeThreadsListPtr*)NULL) - << "list_ptr1->previous() must be NULL"; + EXPECT_EQ(list_ptr1->previous(), (SafeThreadsListPtr*)nullptr) + << "list_ptr1->previous() must be null"; EXPECT_EQ(ThreadsListHandleTest::get_STLP_thread(list_ptr1), thr) << "list_ptr1->_thread must match current thread"; EXPECT_EQ(list_ptr1->list(), tlh1.list()) @@ -383,8 +383,8 @@ TEST_VM(ThreadsListHandle, sanity) { << "list_ptr2->_needs_release must be true"; // Verify tlh1 has the right field values: - EXPECT_EQ(list_ptr1->previous(), (SafeThreadsListPtr*)NULL) - << "list_ptr1->previous() must be NULL"; + EXPECT_EQ(list_ptr1->previous(), (SafeThreadsListPtr*)nullptr) + << "list_ptr1->previous() must be null"; EXPECT_EQ(ThreadsListHandleTest::get_STLP_thread(list_ptr1), thr) << "list_ptr1->_thread must match current thread"; EXPECT_EQ(list_ptr1->list(), tlh1.list()) @@ -403,9 +403,9 @@ TEST_VM(ThreadsListHandle, sanity) { // Test case: after double nested ThreadsListHandle (tlh3) has been destroyed - // Verify the current thread's hazard ptr is NULL: - EXPECT_EQ(ThreadsListHandleTest::get_Thread_threads_hazard_ptr(thr), (ThreadsList*)NULL) - << "thr->_threads_hazard_ptr must be NULL"; + // Verify the current thread's hazard ptr is null: + EXPECT_EQ(ThreadsListHandleTest::get_Thread_threads_hazard_ptr(thr), (ThreadsList*)nullptr) + << "thr->_threads_hazard_ptr must be null"; // Verify the current thread's threads list ptr refers to tlh2: EXPECT_EQ(tlh1.list(), tlh2.list()) << "tlh1.list() must match tlh2.list()"; @@ -431,8 +431,8 @@ TEST_VM(ThreadsListHandle, sanity) { << "list_ptr2->_needs_release must be true"; // Verify tlh1 has the right field values: - EXPECT_EQ(list_ptr1->previous(), (SafeThreadsListPtr*)NULL) - << "list_ptr1->previous() must be NULL"; + EXPECT_EQ(list_ptr1->previous(), (SafeThreadsListPtr*)nullptr) + << "list_ptr1->previous() must be null"; EXPECT_EQ(ThreadsListHandleTest::get_STLP_thread(list_ptr1), thr) << "list_ptr1->_thread must match current thread"; EXPECT_EQ(list_ptr1->list(), tlh1.list()) @@ -451,9 +451,9 @@ TEST_VM(ThreadsListHandle, sanity) { // Test case: after first nested ThreadsListHandle (tlh2) has been destroyed - // Verify the current thread's hazard ptr is NULL: - EXPECT_EQ(ThreadsListHandleTest::get_Thread_threads_hazard_ptr(thr), (ThreadsList*)NULL) - << "thr->_threads_hazard_ptr must be NULL"; + // Verify the current thread's hazard ptr is null: + EXPECT_EQ(ThreadsListHandleTest::get_Thread_threads_hazard_ptr(thr), (ThreadsList*)nullptr) + << "thr->_threads_hazard_ptr must be null"; // Verify the current thread's threads list ptr refers to tlh1: EXPECT_EQ(ThreadsListHandleTest::get_Thread_threads_list_ptr(thr), list_ptr1) << "thr->_threads_list_ptr must match list_ptr1"; @@ -461,8 +461,8 @@ TEST_VM(ThreadsListHandle, sanity) { << "thr->_nested_threads_hazard_ptr_cnt must be 0"; // Verify tlh1 has the right field values: - EXPECT_EQ(list_ptr1->previous(), (SafeThreadsListPtr*)NULL) - << "list_ptr1->previous() must be NULL"; + EXPECT_EQ(list_ptr1->previous(), (SafeThreadsListPtr*)nullptr) + << "list_ptr1->previous() must be null"; EXPECT_EQ(ThreadsListHandleTest::get_STLP_thread(list_ptr1), thr) << "list_ptr1->_thread must match current thread"; EXPECT_EQ(list_ptr1->list(), tlh1.list()) @@ -483,10 +483,10 @@ TEST_VM(ThreadsListHandle, sanity) { // // Verify the current thread refers to no ThreadsListHandle: - EXPECT_EQ(ThreadsListHandleTest::get_Thread_threads_hazard_ptr(thr), (ThreadsList*)NULL) - << "thr->_threads_hazard_ptr must match be NULL"; - EXPECT_EQ(ThreadsListHandleTest::get_Thread_threads_list_ptr(thr), (SafeThreadsListPtr*) NULL) - << "thr->_threads_list_ptr must be NULL"; + EXPECT_EQ(ThreadsListHandleTest::get_Thread_threads_hazard_ptr(thr), (ThreadsList*)nullptr) + << "thr->_threads_hazard_ptr must match be null"; + EXPECT_EQ(ThreadsListHandleTest::get_Thread_threads_list_ptr(thr), (SafeThreadsListPtr*) nullptr) + << "thr->_threads_list_ptr must be null"; EXPECT_EQ(ThreadsListHandleTest::get_Thread_nested_threads_hazard_ptr_cnt(thr), (uint)0) << "thr->_nested_threads_hazard_ptr_cnt must be 0"; @@ -505,8 +505,8 @@ TEST_VM(ThreadsListHandle, sanity) { << "thr->_nested_threads_hazard_ptr_cnt must be 0"; // Verify tlh1 has the right field values: - EXPECT_EQ(list_ptr1->previous(), (SafeThreadsListPtr*)NULL) - << "list_ptr1->previous() must be NULL"; + EXPECT_EQ(list_ptr1->previous(), (SafeThreadsListPtr*)nullptr) + << "list_ptr1->previous() must be null"; EXPECT_EQ(ThreadsListHandleTest::get_STLP_thread(list_ptr1), thr) << "list_ptr1->_thread must match current thread"; EXPECT_EQ(list_ptr1->list(), tlh1.list()) @@ -553,8 +553,8 @@ TEST_VM(ThreadsListHandle, sanity) { << "list_ptr2a->_needs_release must be true"; // Verify tlh1 has the right field values: - EXPECT_EQ(list_ptr1->previous(), (SafeThreadsListPtr*)NULL) - << "list_ptr1->previous() must be NULL"; + EXPECT_EQ(list_ptr1->previous(), (SafeThreadsListPtr*)nullptr) + << "list_ptr1->previous() must be null"; EXPECT_EQ(ThreadsListHandleTest::get_STLP_thread(list_ptr1), thr) << "list_ptr1->_thread must match current thread"; EXPECT_EQ(list_ptr1->list(), tlh1.list()) @@ -573,9 +573,9 @@ TEST_VM(ThreadsListHandle, sanity) { // Test case: after first back-to-back nested ThreadsListHandle (tlh2a) has been destroyed - // Verify the current thread's hazard ptr is NULL: - EXPECT_EQ(ThreadsListHandleTest::get_Thread_threads_hazard_ptr(thr), (ThreadsList*)NULL) - << "thr->_threads_hazard_ptr must be NULL"; + // Verify the current thread's hazard ptr is null: + EXPECT_EQ(ThreadsListHandleTest::get_Thread_threads_hazard_ptr(thr), (ThreadsList*)nullptr) + << "thr->_threads_hazard_ptr must be null"; // Verify the current thread's threads list ptr refers to tlh1: EXPECT_EQ(ThreadsListHandleTest::get_Thread_threads_list_ptr(thr), list_ptr1) << "thr->_threads_list_ptr must match list_ptr1"; @@ -583,8 +583,8 @@ TEST_VM(ThreadsListHandle, sanity) { << "thr->_nested_threads_hazard_ptr_cnt must be 0"; // Verify tlh1 has the right field values: - EXPECT_EQ(list_ptr1->previous(), (SafeThreadsListPtr*)NULL) - << "list_ptr1->previous() must be NULL"; + EXPECT_EQ(list_ptr1->previous(), (SafeThreadsListPtr*)nullptr) + << "list_ptr1->previous() must be null"; EXPECT_EQ(ThreadsListHandleTest::get_STLP_thread(list_ptr1), thr) << "list_ptr1->_thread must match current thread"; EXPECT_EQ(list_ptr1->list(), tlh1.list()) @@ -633,8 +633,8 @@ TEST_VM(ThreadsListHandle, sanity) { << "list_ptr2b->_needs_release must be true"; // Verify tlh1 has the right field values: - EXPECT_EQ(list_ptr1->previous(), (SafeThreadsListPtr*)NULL) - << "list_ptr1->previous() must be NULL"; + EXPECT_EQ(list_ptr1->previous(), (SafeThreadsListPtr*)nullptr) + << "list_ptr1->previous() must be null"; EXPECT_EQ(ThreadsListHandleTest::get_STLP_thread(list_ptr1), thr) << "list_ptr1->_thread must match current thread"; EXPECT_EQ(list_ptr1->list(), tlh1.list()) @@ -653,9 +653,9 @@ TEST_VM(ThreadsListHandle, sanity) { // Test case: after second back-to-back nested ThreadsListHandle (tlh2b) has been destroyed - // Verify the current thread's hazard ptr is NULL: - EXPECT_EQ(ThreadsListHandleTest::get_Thread_threads_hazard_ptr(thr), (ThreadsList*)NULL) - << "thr->_threads_hazard_ptr must be NULL"; + // Verify the current thread's hazard ptr is null: + EXPECT_EQ(ThreadsListHandleTest::get_Thread_threads_hazard_ptr(thr), (ThreadsList*)nullptr) + << "thr->_threads_hazard_ptr must be null"; // Verify the current thread's threads list ptr refers to tlh1: EXPECT_EQ(ThreadsListHandleTest::get_Thread_threads_list_ptr(thr), list_ptr1) << "thr->_threads_list_ptr must match list_ptr1"; @@ -663,8 +663,8 @@ TEST_VM(ThreadsListHandle, sanity) { << "thr->_nested_threads_hazard_ptr_cnt must be 0"; // Verify tlh1 has the right field values: - EXPECT_EQ(list_ptr1->previous(), (SafeThreadsListPtr*)NULL) - << "list_ptr1->previous() must be NULL"; + EXPECT_EQ(list_ptr1->previous(), (SafeThreadsListPtr*)nullptr) + << "list_ptr1->previous() must be null"; EXPECT_EQ(ThreadsListHandleTest::get_STLP_thread(list_ptr1), thr) << "list_ptr1->_thread must match current thread"; EXPECT_EQ(list_ptr1->list(), tlh1.list()) @@ -685,10 +685,10 @@ TEST_VM(ThreadsListHandle, sanity) { // // Verify the current thread refers to no ThreadsListHandle: - EXPECT_EQ(ThreadsListHandleTest::get_Thread_threads_hazard_ptr(thr), (ThreadsList*)NULL) - << "thr->_threads_hazard_ptr must match be NULL"; - EXPECT_EQ(ThreadsListHandleTest::get_Thread_threads_list_ptr(thr), (SafeThreadsListPtr*) NULL) - << "thr->_threads_list_ptr must be NULL"; + EXPECT_EQ(ThreadsListHandleTest::get_Thread_threads_hazard_ptr(thr), (ThreadsList*)nullptr) + << "thr->_threads_hazard_ptr must match be null"; + EXPECT_EQ(ThreadsListHandleTest::get_Thread_threads_list_ptr(thr), (SafeThreadsListPtr*) nullptr) + << "thr->_threads_list_ptr must be null"; EXPECT_EQ(ThreadsListHandleTest::get_Thread_nested_threads_hazard_ptr_cnt(thr), (uint)0) << "thr->_nested_threads_hazard_ptr_cnt must be 0"; diff --git a/test/hotspot/gtest/runtime/test_arguments.cpp b/test/hotspot/gtest/runtime/test_arguments.cpp index 8d312d4c913a..a85183f3a5ef 100644 --- a/test/hotspot/gtest/runtime/test_arguments.cpp +++ b/test/hotspot/gtest/runtime/test_arguments.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2024, 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 @@ -154,7 +154,7 @@ static const intx no_value = 4711; inline intx ArgumentsTest::parse_xss_inner_annotated(const char* str, jint expected_err, const char* file, int line_number) { intx value = no_value; - jint err = parse_xss(NULL /* Silence error messages */, str, &value); + jint err = parse_xss(nullptr /* Silence error messages */, str, &value); EXPECT_EQ(err, expected_err) << "Failure from: " << file << ":" << line_number; return value; } @@ -231,7 +231,7 @@ struct NumericArgument { static void check_invalid_numeric_string(JVMFlag* flag, const char** invalid_strings) { for (uint i = 0; ; i++) { const char* str = invalid_strings[i]; - if (str == NULL) { + if (str == nullptr) { return; } ASSERT_FALSE(ArgumentsTest::parse_argument(flag->name(), str)) @@ -273,7 +273,7 @@ void check_numeric_flag(JVMFlag* flag, T getvalue(JVMFlag* flag), "0x800000000000m", "0x800000000000000k", "-0x8000000t", "-0x800000000g", "-0x800000000000m", "-0x800000000000000k", - NULL, + nullptr, }; check_invalid_numeric_string(flag, invalid_strings); } @@ -283,7 +283,7 @@ void check_numeric_flag(JVMFlag* flag, T getvalue(JVMFlag* flag), "INF", "Inf", "Infinity", "INFINITY", "-INF", "-Inf", "-Infinity", "-INFINITY", "nan", "NAN", "NaN", - NULL, + nullptr, }; check_invalid_numeric_string(flag, invalid_strings_for_double); } else { @@ -293,7 +293,7 @@ void check_numeric_flag(JVMFlag* flag, T getvalue(JVMFlag* flag), "0x10000000000000000", "18446744073709551616", "-0x10000000000000000", "-18446744073709551616", "-0x8000000000000001", "-9223372036854775809", - NULL, + nullptr, }; check_invalid_numeric_string(flag, invalid_strings_for_integers); } @@ -449,7 +449,7 @@ void check_numeric_flag(JVMFlag* flag, T getvalue(JVMFlag* flag), template ::value), ENABLE_IF(sizeof(T) == 4)> void check_flag(const char* f, T getvalue(JVMFlag* flag)) { JVMFlag* flag = JVMFlag::find_flag(f); - if (flag == NULL) { // not available in product builds + if (flag == nullptr) { // not available in product builds return; } @@ -464,7 +464,7 @@ void check_flag(const char* f, T getvalue(JVMFlag* flag)) { template ::value), ENABLE_IF(sizeof(T) == 4)> void check_flag(const char* f, T getvalue(JVMFlag* flag)) { JVMFlag* flag = JVMFlag::find_flag(f); - if (flag == NULL) { // not available in product builds + if (flag == nullptr) { // not available in product builds return; } @@ -479,7 +479,7 @@ void check_flag(const char* f, T getvalue(JVMFlag* flag)) { template ::value), ENABLE_IF(sizeof(T) == 8)> void check_flag(const char* f, T getvalue(JVMFlag* flag)) { JVMFlag* flag = JVMFlag::find_flag(f); - if (flag == NULL) { // not available in product builds + if (flag == nullptr) { // not available in product builds return; } @@ -495,7 +495,7 @@ void check_flag(const char* f, T getvalue(JVMFlag* flag)) { template ::value), ENABLE_IF(sizeof(T) == 8)> void check_flag(const char* f, T getvalue(JVMFlag* flag)) { JVMFlag* flag = JVMFlag::find_flag(f); - if (flag == NULL) { // not available in product builds + if (flag == nullptr) { // not available in product builds return; } @@ -555,7 +555,7 @@ TEST_VM_F(ArgumentsTest, set_numeric_flag_size_t) { TEST_VM_F(ArgumentsTest, set_numeric_flag_double) { JVMFlag* flag = JVMFlag::find_flag("TestFlagFor_double"); - if (flag == NULL) { // not available in product builds + if (flag == nullptr) { // not available in product builds return; } @@ -597,7 +597,7 @@ TEST_VM_F(ArgumentsTest, set_numeric_flag_double) { char* end; errno = 0; double expected = strtod(str, &end); - if (errno == 0 && end != NULL && *end == '\0') { + if (errno == 0 && end != nullptr && *end == '\0') { ASSERT_TRUE(ArgumentsTest::parse_argument(flag->name(), str)) << "Test string '" << str << "' did not parse for type " << flag->type_string() << ". (Expected value = " << expected << ")"; diff --git a/test/hotspot/gtest/runtime/test_classLoader.cpp b/test/hotspot/gtest/runtime/test_classLoader.cpp index b25358ab0454..856a561ade2b 100644 --- a/test/hotspot/gtest/runtime/test_classLoader.cpp +++ b/test/hotspot/gtest/runtime/test_classLoader.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -30,16 +30,16 @@ // Tests ClassLoader::package_from_class_name() TEST_VM(ClassLoader, null_class_name) { bool bad_class_name = false; - TempNewSymbol retval = ClassLoader::package_from_class_name(NULL, &bad_class_name); - ASSERT_TRUE(bad_class_name) << "Function did not set bad_class_name with NULL class name"; - ASSERT_TRUE(retval == NULL) << "Wrong package for NULL class name pointer"; + TempNewSymbol retval = ClassLoader::package_from_class_name(nullptr, &bad_class_name); + ASSERT_TRUE(bad_class_name) << "Function did not set bad_class_name with null class name"; + ASSERT_TRUE(retval == nullptr) << "Wrong package for null class name pointer"; } TEST_VM(ClassLoader, empty_class_name) { bool bad_class_name = false; TempNewSymbol name = SymbolTable::new_symbol(""); TempNewSymbol retval = ClassLoader::package_from_class_name(name, &bad_class_name); - ASSERT_TRUE(retval == NULL) << "Wrong package for empty string"; + ASSERT_TRUE(retval == nullptr) << "Wrong package for empty string"; } TEST_VM(ClassLoader, no_slash) { @@ -47,7 +47,7 @@ TEST_VM(ClassLoader, no_slash) { TempNewSymbol name = SymbolTable::new_symbol("L"); TempNewSymbol retval = ClassLoader::package_from_class_name(name, &bad_class_name); ASSERT_FALSE(bad_class_name) << "Function set bad_class_name with empty package"; - ASSERT_TRUE(retval == NULL) << "Wrong package for class with no slashes"; + ASSERT_TRUE(retval == nullptr) << "Wrong package for class with no slashes"; } TEST_VM(ClassLoader, just_slash) { @@ -55,7 +55,7 @@ TEST_VM(ClassLoader, just_slash) { TempNewSymbol name = SymbolTable::new_symbol("/"); TempNewSymbol retval = ClassLoader::package_from_class_name(name, &bad_class_name); ASSERT_TRUE(bad_class_name) << "Function did not set bad_class_name with package of length 0"; - ASSERT_TRUE(retval == NULL) << "Wrong package for class with just slash"; + ASSERT_TRUE(retval == nullptr) << "Wrong package for class with just slash"; } TEST_VM(ClassLoader, multiple_slashes) { @@ -103,5 +103,5 @@ TEST_VM(ClassLoader, class_object_array) { TempNewSymbol name = SymbolTable::new_symbol("[Lpackage/class"); TempNewSymbol retval = ClassLoader::package_from_class_name(name, &bad_class_name); ASSERT_TRUE(bad_class_name) << "Function did not set bad_class_name with array of class objects"; - ASSERT_TRUE(retval == NULL) << "Wrong package for class with leading '[L'"; + ASSERT_TRUE(retval == nullptr) << "Wrong package for class with leading '[L'"; } diff --git a/test/hotspot/gtest/runtime/test_committed_virtualmemory.cpp b/test/hotspot/gtest/runtime/test_committed_virtualmemory.cpp index 98353e5ea500..a2ecb3830008 100644 --- a/test/hotspot/gtest/runtime/test_committed_virtualmemory.cpp +++ b/test/hotspot/gtest/runtime/test_committed_virtualmemory.cpp @@ -46,7 +46,7 @@ class CommittedVirtualMemoryTest { VirtualMemoryTracker::snapshot_thread_stacks(); ReservedMemoryRegion* rmr = VirtualMemoryTracker::_reserved_regions->find(ReservedMemoryRegion(stack_end, stack_size)); - ASSERT_TRUE(rmr != NULL); + ASSERT_TRUE(rmr != nullptr); ASSERT_EQ(rmr->base(), stack_end); ASSERT_EQ(rmr->size(), stack_size); @@ -60,7 +60,7 @@ class CommittedVirtualMemoryTest { address stack_top = stack_end + stack_size; bool found_stack_top = false; - for (const CommittedMemoryRegion* region = iter.next(); region != NULL; region = iter.next()) { + for (const CommittedMemoryRegion* region = iter.next(); region != nullptr; region = iter.next()) { if (region->base() + region->size() == stack_top) { ASSERT_TRUE(region->size() <= stack_size); found_stack_top = true; @@ -98,7 +98,7 @@ class CommittedVirtualMemoryTest { char* base = os::reserve_memory(size, !ExecMem, mtThreadStack); bool result = os::commit_memory(base, size, !ExecMem); size_t index; - ASSERT_NE(base, (char*)NULL); + ASSERT_NE(base, (char*)nullptr); for (index = 0; index < touch_pages; index ++) { char* touch_addr = base + page_sz * page_num[index]; *touch_addr = 'a'; @@ -112,14 +112,14 @@ class CommittedVirtualMemoryTest { VirtualMemoryTracker::snapshot_thread_stacks(); ReservedMemoryRegion* rmr = VirtualMemoryTracker::_reserved_regions->find(ReservedMemoryRegion((address)base, size)); - ASSERT_TRUE(rmr != NULL); + ASSERT_TRUE(rmr != nullptr); bool precise_tracking_supported = false; CommittedRegionIterator iter = rmr->iterate_committed_regions(); - for (const CommittedMemoryRegion* region = iter.next(); region != NULL; region = iter.next()) { + for (const CommittedMemoryRegion* region = iter.next(); region != nullptr; region = iter.next()) { if (region->size() == size) { // platforms that do not support precise tracking. - ASSERT_TRUE(iter.next() == NULL); + ASSERT_TRUE(iter.next() == nullptr); break; } else { precise_tracking_supported = true; @@ -139,7 +139,7 @@ class CommittedVirtualMemoryTest { VirtualMemoryTracker::remove_released_region((address)base, size); rmr = VirtualMemoryTracker::_reserved_regions->find(ReservedMemoryRegion((address)base, size)); - ASSERT_TRUE(rmr == NULL); + ASSERT_TRUE(rmr == nullptr); } static void test_committed_region() { @@ -164,7 +164,7 @@ class CommittedVirtualMemoryTest { const size_t num_pages = 4; const size_t size = num_pages * page_sz; char* base = os::reserve_memory(size, !ExecMem, mtTest); - ASSERT_NE(base, (char*)NULL); + ASSERT_NE(base, (char*)nullptr); result = os::commit_memory(base, size, !ExecMem); ASSERT_TRUE(result); diff --git a/test/hotspot/gtest/runtime/test_globals.cpp b/test/hotspot/gtest/runtime/test_globals.cpp index 1b0d58f8fb4a..7ee2f940d1b8 100644 --- a/test/hotspot/gtest/runtime/test_globals.cpp +++ b/test/hotspot/gtest/runtime/test_globals.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2024, 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 @@ -94,14 +94,14 @@ TEST_VM(FlagAccess, ccstr_flag) { template static JVMFlag::Error get_flag(const char* name) { - JVMFlag* flag = (name == NULL) ? NULL : JVMFlag::find_flag(name); + JVMFlag* flag = (name == nullptr) ? nullptr : JVMFlag::find_flag(name); T val; return JVMFlagAccess::get(flag, &val); } TEST_VM(FlagAccess, wrong_format) { - ASSERT_EQ((get_flag(NULL)), JVMFlag::INVALID_FLAG); + ASSERT_EQ((get_flag(nullptr)), JVMFlag::INVALID_FLAG); // MaxRAMPercentage is a double flag ASSERT_EQ((get_flag ("MaxRAMPercentage")), JVMFlag::WRONG_FORMAT); diff --git a/test/hotspot/gtest/runtime/test_os.cpp b/test/hotspot/gtest/runtime/test_os.cpp index d5f7b23f4753..fb33cf9c4f93 100644 --- a/test/hotspot/gtest/runtime/test_os.cpp +++ b/test/hotspot/gtest/runtime/test_os.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2024, 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 @@ -312,8 +312,8 @@ static void test_snprintf(PrintFn pf, bool expect_count) { } // Special case of 0-length buffer with empty (except for terminator) output. - check_snprintf_result(0, 0, pf(NULL, 0, "%s", ""), expect_count); - check_snprintf_result(0, 0, pf(NULL, 0, ""), expect_count); + check_snprintf_result(0, 0, pf(nullptr, 0, "%s", ""), expect_count); + check_snprintf_result(0, 0, pf(nullptr, 0, ""), expect_count); } // This is probably equivalent to os::snprintf, but we're being @@ -367,7 +367,7 @@ static inline bool can_reserve_executable_memory(void) { bool executable = true; size_t len = 128; char* p = os::reserve_memory(len, executable); - bool exec_supported = (p != NULL); + bool exec_supported = (p != nullptr); if (exec_supported) { os::release_memory(p, len); } @@ -400,12 +400,12 @@ static address reserve_multiple(int num_stripes, size_t stripe_len) { const bool exec_supported = can_reserve_executable_memory(); #endif - address p = NULL; - for (int tries = 0; tries < 256 && p == NULL; tries ++) { + address p = nullptr; + for (int tries = 0; tries < 256 && p == nullptr; tries ++) { size_t total_range_len = num_stripes * stripe_len; // Reserve a large contiguous area to get the address space... p = (address)os::reserve_memory(total_range_len); - EXPECT_NE(p, (address)NULL); + EXPECT_NE(p, (address)nullptr); // .. release it... EXPECT_TRUE(os::release_memory((char*)p, total_range_len)); // ... re-reserve in the same spot multiple areas... @@ -419,11 +419,11 @@ static address reserve_multiple(int num_stripes, size_t stripe_len) { const bool executable = stripe % 2 == 0; #endif q = (address)os::attempt_reserve_memory_at((char*)q, stripe_len, executable); - if (q == NULL) { + if (q == nullptr) { // Someone grabbed that area concurrently. Cleanup, then retry. tty->print_cr("reserve_multiple: retry (%d)...", stripe); carefully_release_multiple(p, stripe, stripe_len); - p = NULL; + p = nullptr; } else { EXPECT_TRUE(os::commit_memory((char*)q, stripe_len, executable)); } @@ -439,7 +439,7 @@ static address reserve_one_commit_multiple(int num_stripes, size_t stripe_len) { assert(is_aligned(stripe_len, os::vm_allocation_granularity()), "Sanity"); size_t total_range_len = num_stripes * stripe_len; address p = (address)os::reserve_memory(total_range_len); - EXPECT_NE(p, (address)NULL); + EXPECT_NE(p, (address)nullptr); for (int stripe = 0; stripe < num_stripes; stripe++) { address q = p + (stripe * stripe_len); if (stripe % 2 == 0) { @@ -490,7 +490,7 @@ TEST_VM(os, release_multi_mappings) { // reserve address space... address p = reserve_multiple(num_stripes, stripe_len); - ASSERT_NE(p, (address)NULL); + ASSERT_NE(p, (address)nullptr); PRINT_MAPPINGS("A"); // .. release the middle stripes... @@ -529,7 +529,7 @@ TEST_VM_ASSERT_MSG(os, release_bad_ranges, ".*bad release") { TEST_VM(os, release_bad_ranges) { #endif char* p = os::reserve_memory(4 * M); - ASSERT_NE(p, (char*)NULL); + ASSERT_NE(p, (char*)nullptr); // Release part of range ASSERT_FALSE(os::release_memory(p, M)); // Release part of range @@ -623,13 +623,13 @@ TEST_VM(os, find_mapping_simple) { os::win32::mapping_info_t mapping_info; // Some obvious negatives - ASSERT_FALSE(os::win32::find_mapping((address)NULL, &mapping_info)); + ASSERT_FALSE(os::win32::find_mapping((address)nullptr, &mapping_info)); ASSERT_FALSE(os::win32::find_mapping((address)4711, &mapping_info)); // A simple allocation { address p = (address)os::reserve_memory(total_range_len); - ASSERT_NE(p, (address)NULL); + ASSERT_NE(p, (address)nullptr); PRINT_MAPPINGS("A"); for (size_t offset = 0; offset < total_range_len; offset += 4711) { ASSERT_TRUE(os::win32::find_mapping(p + offset, &mapping_info)); @@ -658,7 +658,7 @@ TEST_VM(os, find_mapping_2) { const size_t stripe_len = total_range_len / 4; address p = reserve_one_commit_multiple(4, stripe_len); - ASSERT_NE(p, (address)NULL); + ASSERT_NE(p, (address)nullptr); PRINT_MAPPINGS("A"); for (size_t offset = 0; offset < total_range_len; offset += 4711) { ASSERT_TRUE(os::win32::find_mapping(p + offset, &mapping_info)); @@ -687,7 +687,7 @@ TEST_VM(os, find_mapping_3) { { const size_t stripe_len = total_range_len / 4; address p = reserve_multiple(4, stripe_len); - ASSERT_NE(p, (address)NULL); + ASSERT_NE(p, (address)nullptr); PRINT_MAPPINGS("E"); for (int stripe = 0; stripe < 4; stripe++) { ASSERT_TRUE(os::win32::find_mapping(p + (stripe * stripe_len), &mapping_info)); @@ -794,8 +794,8 @@ TEST_VM(os, dll_address_to_function_and_library_name) { LOG("os::print_function_and_library_name(st, -1) expects FALSE."); address addr = (address)(intptr_t)-1; EXPECT_FALSE(os::print_function_and_library_name(&st, addr)); - LOG("os::print_function_and_library_name(st, NULL) expects FALSE."); - addr = NULL; + LOG("os::print_function_and_library_name(st, nullptr) expects FALSE."); + addr = nullptr; EXPECT_FALSE(os::print_function_and_library_name(&st, addr)); // Valid addresses @@ -812,7 +812,7 @@ TEST_VM(os, dll_address_to_function_and_library_name) { addr = CAST_FROM_FN_PTR(address, Threads::create_vm); st.reset(); EXPECT_TRUE(os::print_function_and_library_name(&st, addr, - provide_scratch_buffer ? tmp : NULL, + provide_scratch_buffer ? tmp : nullptr, sizeof(tmp), shorten_paths, demangle, strip_arguments)); @@ -858,7 +858,7 @@ static bool very_simple_string_matcher(const char* pattern, const char* s) { TEST_VM(os, iso8601_time) { char buffer[os::iso8601_timestamp_size + 1]; // + space for canary buffer[os::iso8601_timestamp_size] = 'X'; // canary - const char* result = NULL; + const char* result = nullptr; // YYYY-MM-DDThh:mm:ss.mmm+zzzz const char* const pattern_utc = "dddd-dd-dd.dd:dd:dd.ddd.0000"; const char* const pattern_local = "dddd-dd-dd.dd:dd:dd.ddd.dddd"; diff --git a/test/hotspot/gtest/runtime/test_os_linux.cpp b/test/hotspot/gtest/runtime/test_os_linux.cpp index bd019c68c2c1..67a1515165a6 100644 --- a/test/hotspot/gtest/runtime/test_os_linux.cpp +++ b/test/hotspot/gtest/runtime/test_os_linux.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2024, 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 @@ -57,7 +57,7 @@ namespace { } HugeTlbfsMemory(char* const ptr, size_t size) : _ptr(ptr), _size(size) { } ~HugeTlbfsMemory() { - if (_ptr != NULL) { + if (_ptr != nullptr) { os::Linux::release_memory_special_huge_tlbfs(_ptr, _size); } } @@ -87,8 +87,8 @@ namespace { static void test_reserve_memory_special_shm(size_t size, size_t alignment) { ASSERT_TRUE(UseSHM) << "must be used only when UseSHM is true"; - char* addr = ShmMemory::reserve_memory_special_shm(size, alignment, NULL, false); - if (addr != NULL) { + char* addr = ShmMemory::reserve_memory_special_shm(size, alignment, nullptr, false); + if (addr != nullptr) { ShmMemory mr(addr, size); EXPECT_PRED2(is_ptr_aligned, addr, alignment); EXPECT_PRED2(is_ptr_aligned, addr, os::large_page_size()); @@ -105,9 +105,9 @@ TEST_VM(os_linux, reserve_memory_special_huge_tlbfs_size_aligned) { size_t lp = os::large_page_size(); for (size_t size = lp; size <= lp * 10; size += lp) { - char* addr = HugeTlbfsMemory::reserve_memory_special_huge_tlbfs(size, lp, lp, NULL, false); + char* addr = HugeTlbfsMemory::reserve_memory_special_huge_tlbfs(size, lp, lp, nullptr, false); - if (addr != NULL) { + if (addr != nullptr) { HugeTlbfsMemory mr(addr, size); small_page_write(addr, size); } @@ -131,8 +131,8 @@ TEST_VM(os_linux, reserve_memory_special_huge_tlbfs_size_not_aligned_without_add for (int i = 0; i < num_sizes; i++) { const size_t size = sizes[i]; for (size_t alignment = ag; is_size_aligned(size, alignment); alignment *= 2) { - char* p = HugeTlbfsMemory::reserve_memory_special_huge_tlbfs(size, alignment, lp, NULL, false); - if (p != NULL) { + char* p = HugeTlbfsMemory::reserve_memory_special_huge_tlbfs(size, alignment, lp, nullptr, false); + if (p != nullptr) { HugeTlbfsMemory mr(p, size); EXPECT_PRED2(is_ptr_aligned, p, alignment) << " size = " << size; small_page_write(p, size); @@ -159,7 +159,7 @@ TEST_VM(os_linux, reserve_memory_special_huge_tlbfs_size_not_aligned_with_good_r // Pre-allocate an area as large as the largest allocation // and aligned to the largest alignment we will be testing. const size_t mapping_size = sizes[num_sizes - 1] * 2; - char* const mapping = (char*) ::mmap(NULL, mapping_size, + char* const mapping = (char*) ::mmap(nullptr, mapping_size, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0); ASSERT_TRUE(mapping != MAP_FAILED) << " mmap failed, mapping_size = " << mapping_size; @@ -172,7 +172,7 @@ TEST_VM(os_linux, reserve_memory_special_huge_tlbfs_size_not_aligned_with_good_r // req_addr must be at least large page aligned. char* const req_addr = align_up(mapping, MAX2(alignment, lp)); char* p = HugeTlbfsMemory::reserve_memory_special_huge_tlbfs(size, alignment, lp, req_addr, false); - if (p != NULL) { + if (p != nullptr) { HugeTlbfsMemory mr(p, size); ASSERT_EQ(req_addr, p) << " size = " << size << ", alignment = " << alignment; small_page_write(p, size); @@ -200,7 +200,7 @@ TEST_VM(os_linux, reserve_memory_special_huge_tlbfs_size_not_aligned_with_bad_re // Pre-allocate an area as large as the largest allocation // and aligned to the largest alignment we will be testing. const size_t mapping_size = sizes[num_sizes - 1] * 2; - char* const mapping = (char*) ::mmap(NULL, mapping_size, + char* const mapping = (char*) ::mmap(nullptr, mapping_size, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0); ASSERT_TRUE(mapping != MAP_FAILED) << " mmap failed, mapping_size = " << mapping_size; @@ -224,8 +224,8 @@ TEST_VM(os_linux, reserve_memory_special_huge_tlbfs_size_not_aligned_with_bad_re char* p = HugeTlbfsMemory::reserve_memory_special_huge_tlbfs(size, alignment, lp, req_addr, false); HugeTlbfsMemory mr(p, size); // as the area around req_addr contains already existing mappings, the API should always - // return NULL (as per contract, it cannot return another address) - EXPECT_TRUE(p == NULL) << " size = " << size + // return null (as per contract, it cannot return another address) + EXPECT_TRUE(p == nullptr) << " size = " << size << ", alignment = " << alignment << ", req_addr = " << req_addr << ", p = " << p; @@ -263,9 +263,9 @@ class TestReserveMemorySpecial : AllStatic { return; } - char* addr = os::Linux::reserve_memory_special_huge_tlbfs(size, alignment, page_size, NULL, false); + char* addr = os::Linux::reserve_memory_special_huge_tlbfs(size, alignment, page_size, nullptr, false); - if (addr != NULL) { + if (addr != nullptr) { small_page_write(addr, size); os::Linux::release_memory_special_huge_tlbfs(addr, size); @@ -297,7 +297,7 @@ class TestReserveMemorySpecial : AllStatic { const int num_sizes = sizeof(sizes) / sizeof(size_t); // For each size/alignment combination, we test three scenarios: - // 1) with req_addr == NULL + // 1) with req_addr == nullptr // 2) with a non-null req_addr at which we expect to successfully allocate // 3) with a non-null req_addr which contains a pre-existing mapping, at which we // expect the allocation to either fail or to ignore req_addr @@ -305,12 +305,12 @@ class TestReserveMemorySpecial : AllStatic { // Pre-allocate two areas; they shall be as large as the largest allocation // and aligned to the largest alignment we will be testing. const size_t mapping_size = sizes[num_sizes - 1] * 2; - char* const mapping1 = (char*) ::mmap(NULL, mapping_size, + char* const mapping1 = (char*) ::mmap(nullptr, mapping_size, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0); EXPECT_NE(mapping1, MAP_FAILED); - char* const mapping2 = (char*) ::mmap(NULL, mapping_size, + char* const mapping2 = (char*) ::mmap(nullptr, mapping_size, PROT_NONE, MAP_PRIVATE|MAP_ANONYMOUS|MAP_NORESERVE, -1, 0); EXPECT_NE(mapping2, MAP_FAILED); @@ -324,8 +324,8 @@ class TestReserveMemorySpecial : AllStatic { for (int i = 0; i < num_sizes; i++) { const size_t size = sizes[i]; for (size_t alignment = ag; is_aligned(size, alignment); alignment *= 2) { - char* p = os::Linux::reserve_memory_special_huge_tlbfs(size, alignment, lp, NULL, false); - if (p != NULL) { + char* p = os::Linux::reserve_memory_special_huge_tlbfs(size, alignment, lp, nullptr, false); + if (p != nullptr) { EXPECT_TRUE(is_aligned(p, alignment)); small_page_write(p, size); os::Linux::release_memory_special_huge_tlbfs(p, size); @@ -340,7 +340,7 @@ class TestReserveMemorySpecial : AllStatic { // req_addr must be at least large page aligned. char* const req_addr = align_up(mapping1, MAX2(alignment, lp)); char* p = os::Linux::reserve_memory_special_huge_tlbfs(size, alignment, lp, req_addr, false); - if (p != NULL) { + if (p != nullptr) { EXPECT_EQ(p, req_addr); small_page_write(p, size); os::Linux::release_memory_special_huge_tlbfs(p, size); @@ -356,8 +356,8 @@ class TestReserveMemorySpecial : AllStatic { char* const req_addr = align_up(mapping2, MAX2(alignment, lp)); char* p = os::Linux::reserve_memory_special_huge_tlbfs(size, alignment, lp, req_addr, false); // as the area around req_addr contains already existing mappings, the API should always - // return NULL (as per contract, it cannot return another address) - EXPECT_TRUE(p == NULL); + // return nullptr (as per contract, it cannot return another address) + EXPECT_TRUE(p == nullptr); } } @@ -379,9 +379,9 @@ class TestReserveMemorySpecial : AllStatic { return; } - char* addr = os::Linux::reserve_memory_special_shm(size, alignment, NULL, false); + char* addr = os::Linux::reserve_memory_special_shm(size, alignment, nullptr, false); - if (addr != NULL) { + if (addr != nullptr) { EXPECT_TRUE(is_aligned(addr, alignment)); EXPECT_TRUE(is_aligned(addr, os::large_page_size())); @@ -522,26 +522,28 @@ TEST_VM(os_linux, decoder_get_source_info_valid_overflow_minimal) { #endif // clang #ifdef __GLIBC__ +#ifndef ADDRESS_SANITIZER TEST_VM(os_linux, glibc_mallinfo_wrapper) { // Very basic test. Call it. That proves that resolution and invocation works. os::Linux::glibc_mallinfo mi; bool did_wrap = false; - os::Linux::get_mallinfo(&mi, &did_wrap); - void* p = os::malloc(2 * K, mtTest); ASSERT_NOT_NULL(p); + os::Linux::get_mallinfo(&mi, &did_wrap); + // We should see total allocation values > 0 ASSERT_GE((mi.uordblks + mi.hblkhd), 2 * K); - // These values also should exceed some reasonable size. + // These values also should less than some reasonable size. ASSERT_LT(mi.fordblks, 2 * G); ASSERT_LT(mi.uordblks, 2 * G); ASSERT_LT(mi.hblkhd, 2 * G); os::free(p); } +#endif // ADDRESS_SANITIZER #endif // __GLIBC__ #endif // LINUX diff --git a/test/hotspot/gtest/runtime/test_os_linux_cgroups.cpp b/test/hotspot/gtest/runtime/test_os_linux_cgroups.cpp index 917dd8bc40cd..21e0152a43d4 100644 --- a/test/hotspot/gtest/runtime/test_os_linux_cgroups.cpp +++ b/test/hotspot/gtest/runtime/test_os_linux_cgroups.cpp @@ -63,13 +63,13 @@ TEST(cgroupTest, set_cgroupv1_subsystem_path) { TEST(cgroupTest, set_cgroupv2_subsystem_path) { TestCase at_mount_root = { "/sys/fs/cgroup", // mount_path - NULL, // root_path, ignored + nullptr, // root_path, ignored "/", // cgroup_path "/sys/fs/cgroup" // expected_path }; TestCase sub_path = { "/sys/fs/cgroup", // mount_path - NULL, // root_path, ignored + nullptr, // root_path, ignored "/foobar", // cgroup_path "/sys/fs/cgroup/foobar" // expected_path }; diff --git a/test/hotspot/gtest/runtime/test_os_windows.cpp b/test/hotspot/gtest/runtime/test_os_windows.cpp index 3c1860a89016..c7e99bcdbc5d 100644 --- a/test/hotspot/gtest/runtime/test_os_windows.cpp +++ b/test/hotspot/gtest/runtime/test_os_windows.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2024, 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 @@ -39,7 +39,7 @@ namespace { public: MemoryReleaser(char* ptr, size_t size) : _ptr(ptr), _size(size) { } ~MemoryReleaser() { - if (_ptr != NULL) { + if (_ptr != nullptr) { os::release_memory_special(_ptr, _size); } } @@ -53,7 +53,7 @@ namespace { // This is of course only some dodgy assumption, there is no guarantee that the vicinity of // the previously allocated memory is available for allocation. The only actual failure // that is reported is when the test tries to allocate at a particular location but gets a -// different valid one. A NULL return value at this point is not considered an error but may +// different valid one. A nullptr return value at this point is not considered an error but may // be legitimate. void TestReserveMemorySpecial_test() { if (!UseLargePages) { @@ -67,8 +67,8 @@ void TestReserveMemorySpecial_test() { FLAG_SET_CMDLINE(UseNUMAInterleaving, false); const size_t large_allocation_size = os::large_page_size() * 4; - char* result = os::reserve_memory_special(large_allocation_size, os::large_page_size(), os::large_page_size(), NULL, false); - if (result == NULL) { + char* result = os::reserve_memory_special(large_allocation_size, os::large_page_size(), os::large_page_size(), nullptr, false); + if (result == nullptr) { // failed to allocate memory, skipping the test return; } @@ -78,20 +78,20 @@ void TestReserveMemorySpecial_test() { const size_t expected_allocation_size = os::large_page_size(); char* expected_location = result + os::large_page_size(); char* actual_location = os::reserve_memory_special(expected_allocation_size, os::large_page_size(), os::large_page_size(), expected_location, false); - EXPECT_TRUE(actual_location == NULL) << "Should not be allowed to reserve within present reservation"; + EXPECT_TRUE(actual_location == nullptr) << "Should not be allowed to reserve within present reservation"; // Instead try reserving after the first reservation. expected_location = result + large_allocation_size; actual_location = os::reserve_memory_special(expected_allocation_size, os::large_page_size(), os::large_page_size(), expected_location, false); - EXPECT_TRUE(actual_location != NULL) << "Unexpected reservation failure, can’t verify correct location"; + EXPECT_TRUE(actual_location != nullptr) << "Unexpected reservation failure, can’t verify correct location"; EXPECT_TRUE(actual_location == expected_location) << "Reservation must be at requested location"; MemoryReleaser m2(actual_location, os::large_page_size()); // Now try to do a reservation with a larger alignment. const size_t alignment = os::large_page_size() * 2; const size_t new_large_size = alignment * 4; - char* aligned_request = os::reserve_memory_special(new_large_size, alignment, os::large_page_size(), NULL, false); - EXPECT_TRUE(aligned_request != NULL) << "Unexpected reservation failure, can’t verify correct alignment"; + char* aligned_request = os::reserve_memory_special(new_large_size, alignment, os::large_page_size(), nullptr, false); + EXPECT_TRUE(aligned_request != nullptr) << "Unexpected reservation failure, can’t verify correct alignment"; EXPECT_TRUE(is_aligned(aligned_request, alignment)) << "Returned address must be aligned"; MemoryReleaser m3(aligned_request, new_large_size); } @@ -139,7 +139,7 @@ static bool file_exists_w(const wchar_t* path) { static void create_rel_directory_w(const wchar_t* path) { WITH_ABS_PATH(path); EXPECT_FALSE(file_exists_w(abs_path)) << "Can't create directory: \"" << path << "\" already exists"; - BOOL result = CreateDirectoryW(abs_path, NULL); + BOOL result = CreateDirectoryW(abs_path, nullptr); EXPECT_TRUE(result) << "Failed to create directory \"" << path << "\" " << GetLastError(); } @@ -165,7 +165,7 @@ static void delete_empty_rel_directory_w(const wchar_t* path) { static void create_rel_file_w(const wchar_t* path) { WITH_ABS_PATH(path); EXPECT_FALSE(file_exists_w(abs_path)) << "Can't create file: \"" << path << "\" already exists"; - HANDLE h = CreateFileW(abs_path, 0, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL); + HANDLE h = CreateFileW(abs_path, 0, 0, nullptr, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, nullptr); EXPECT_NE(h, INVALID_HANDLE_VALUE) << "Failed to create file \"" << path << "\": " << GetLastError(); CloseHandle(h); } @@ -218,7 +218,7 @@ static bool unnormalize_path(wchar_t* result, size_t size, bool is_dir, const wc } else if (wcsncmp(src, L"\\\\", 2) == 0) { path_start = wcschr(src + 2, L'?'); - if (path_start == NULL) { + if (path_start == nullptr) { path_start = wcschr(src + 2, L'\\'); } else { path_start = wcschr(path_start, L'\\'); @@ -245,7 +245,7 @@ static bool unnormalize_path(wchar_t* result, size_t size, bool is_dir, const wc const wchar_t* replacement = sep_replacements[i]; dest = my_wcscpy_s(dest - 1, size, result, replacement); } - } else if (path_start != NULL) { + } else if (path_start != nullptr) { if (allow_dotdot_change && (src > path_start + 1) && ((os::random() & 7) == 7)) { wchar_t const* last_sep = src - 2; @@ -397,7 +397,7 @@ static void bench_path(wchar_t* path) { size_t buf_len = strlen(buf); wchar_t* w_path = (wchar_t*) os::malloc(sizeof(wchar_t) * (buf_len + 1), mtInternal); - if (w_path != NULL) { + if (w_path != nullptr) { size_t converted_chars; if (::mbstowcs_s(&converted_chars, w_path, buf_len + 1, buf, buf_len) == ERROR_SUCCESS) { if (t == 1) { @@ -417,7 +417,7 @@ static void bench_path(wchar_t* path) { } succ = false; } - HANDLE h = ::CreateFileW(w_path, 0, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL); + HANDLE h = ::CreateFileW(w_path, 0, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, nullptr); if (h != INVALID_HANDLE_VALUE) { ::CloseHandle(h); @@ -439,7 +439,7 @@ static void bench_path(wchar_t* path) { jlong ctime = os::javaTimeNanos(); for (int i = 0; i < reps; ++i) { - HANDLE h = ::CreateFileA(buf, 0, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, NULL); + HANDLE h = ::CreateFileA(buf, 0, FILE_SHARE_READ, nullptr, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, nullptr); if (h == INVALID_HANDLE_VALUE) { return; @@ -722,6 +722,114 @@ TEST_VM(os_windows, processor_count) { } } +TEST_VM(os_windows, large_page_init_multiple_sizes) { + // Call request_lock_memory_privilege() and check the result + if (!os::win32::request_lock_memory_privilege()) { + GTEST_SKIP() << "Skipping test because lock memory privilege is not granted."; + } + // Set globals to make sure we hit the correct code path + AutoSaveRestore guardUseLargePages(UseLargePages); + AutoSaveRestore guardEnableAllLargePageSizesForWindows(EnableAllLargePageSizesForWindows); + AutoSaveRestore guardLargePageSizeInBytes(LargePageSizeInBytes); + FLAG_SET_CMDLINE(UseLargePages, true); + FLAG_SET_CMDLINE(EnableAllLargePageSizesForWindows, true); + + // Determine the minimum page size + const size_t min_size = GetLargePageMinimum(); + + // End the test if GetLargePageMinimum returns 0 + if (min_size == 0) { + GTEST_SKIP() << "Large pages are not supported on this system."; + return; + } + + // Set LargePageSizeInBytes to 4 times the minimum page size + FLAG_SET_CMDLINE(LargePageSizeInBytes, 4 * min_size); // Set a value for multiple page sizes + + // Initialize large page settings + os::large_page_init(); + + // Verify that large pages are enabled + EXPECT_TRUE(UseLargePages) << "UseLargePages should be true after initialization for LargePageSizeInBytes = 4 * min_size"; + + // Verify that decided_large_page_size is greater than the default page size + const size_t default_page_size = os::vm_page_size(); + size_t decided_large_page_size = os::win32::large_page_init_decide_size(); + EXPECT_GT(decided_large_page_size, default_page_size) << "Large page size should be greater than the default page size for LargePageSizeInBytes = 4 * min_size"; + +#if !defined(IA32) + size_t page_size_count = 0; + size_t page_size = os::page_sizes().largest(); + + do { + ++page_size_count; + page_size = os::page_sizes().next_smaller(page_size); + } while (page_size >= os::page_sizes().smallest()); + + EXPECT_GT(page_size_count, 1u) << "There should be multiple large page sizes available."; + + size_t large_page_size = decided_large_page_size; + + for (size_t page_size = os::page_sizes().largest(); page_size >= min_size; page_size = os::page_sizes().next_smaller(page_size)) { + EXPECT_TRUE(page_size % min_size == 0) << "Each page size should be a multiple of the minimum large page size."; + EXPECT_LE(page_size, large_page_size) << "Page size should not exceed the determined large page size."; + } +#endif +} + +TEST_VM(os_windows, large_page_init_decide_size) { + // Initial setup + // Call request_lock_memory_privilege() and check the result + if (!os::win32::request_lock_memory_privilege()) { + GTEST_SKIP() << "Skipping test because lock memory privilege is not granted."; + } + AutoSaveRestore guardUseLargePages(UseLargePages); + AutoSaveRestore guardLargePageSizeInBytes(LargePageSizeInBytes); + FLAG_SET_CMDLINE(UseLargePages, true); + FLAG_SET_CMDLINE(LargePageSizeInBytes, 0); // Reset to default + + // Test for large page support + size_t decided_size = os::win32::large_page_init_decide_size(); + size_t min_size = GetLargePageMinimum(); + if (min_size == 0) { + EXPECT_EQ(decided_size, 0) << "Expected decided size to be 0 when large page is not supported by the processor"; + return; + } + + // Scenario 1: Test with 2MB large page size + if (min_size == 2 * M) { + FLAG_SET_CMDLINE(LargePageSizeInBytes, 2 * M); // Set large page size to 2MB + decided_size = os::win32::large_page_init_decide_size(); // Recalculate decided size + EXPECT_EQ(decided_size, 2 * M) << "Expected decided size to be 2M when large page and OS reported size are both 2M"; + } + + // Scenario 2: Test with 1MB large page size + if (min_size == 2 * M) { + FLAG_SET_CMDLINE(LargePageSizeInBytes, 1 * M); // Set large page size to 1MB + decided_size = os::win32::large_page_init_decide_size(); // Recalculate decided size + EXPECT_EQ(decided_size, 2 * M) << "Expected decided size to be 2M when large page is 1M and OS reported size is 2M"; + } + +#if defined(IA32) || defined(AMD64) + FLAG_SET_CMDLINE(LargePageSizeInBytes, 5 * M); // Set large page size to 5MB + if (!EnableAllLargePageSizesForWindows) { + decided_size = os::win32::large_page_init_decide_size(); // Recalculate decided size + EXPECT_EQ(decided_size, 0) << "Expected decided size to be 0 for large pages bigger than 4mb on IA32 or AMD64"; + } +#endif + + // Additional check for non-multiple of minimum size + // Set an arbitrary large page size which is not a multiple of min_size + FLAG_SET_CMDLINE(LargePageSizeInBytes, 5 * min_size + 1); + + // Recalculate decided size + decided_size = os::win32::large_page_init_decide_size(); + + // Assert that the decided size defaults to minimum page size when LargePageSizeInBytes + // is not a multiple of the minimum size, assuming conditions are always met + EXPECT_EQ(decided_size, 0) << "Expected decided size to default to 0 when LargePageSizeInBytes is not a multiple of minimum size"; +} + class ReserveMemorySpecialRunnable : public TestRunnable { public: void runUnitTest() const { diff --git a/test/hotspot/gtest/runtime/test_perfdata.cpp b/test/hotspot/gtest/runtime/test_perfdata.cpp index d1a5db39e9c9..781964a39b40 100644 --- a/test/hotspot/gtest/runtime/test_perfdata.cpp +++ b/test/hotspot/gtest/runtime/test_perfdata.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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,10 +34,10 @@ class PerfMemoryTest : public ::testing::Test { TEST_VM_F(PerfMemoryTest, destroy) { PerfMemory::destroy(); - ASSERT_NE(PerfMemory::start(), (char*)NULL) << "PerfMemory::_start should not be NULL"; - ASSERT_NE(PerfMemory::end(), (char*)NULL) << "PerfMemory::_end should not be NULL"; - ASSERT_NE(PerfMemoryTest::top(), (char*)NULL) << "PerfMemory::_top should not be NULL"; - ASSERT_NE(PerfMemoryTest::prologue(), (PerfDataPrologue*)NULL) << "PerfMemory::_prologue should not be NULL"; + ASSERT_NE(PerfMemory::start(), (char*)nullptr) << "PerfMemory::_start should not be null"; + ASSERT_NE(PerfMemory::end(), (char*)nullptr) << "PerfMemory::_end should not be null"; + ASSERT_NE(PerfMemoryTest::top(), (char*)nullptr) << "PerfMemory::_top should not be null"; + ASSERT_NE(PerfMemoryTest::prologue(), (PerfDataPrologue*)nullptr) << "PerfMemory::_prologue should not be null"; ASSERT_NE(PerfMemory::capacity(), (size_t)0) << "PerfMemory::_capacity should not be 0"; } diff --git a/test/hotspot/gtest/runtime/test_safefetch.cpp b/test/hotspot/gtest/runtime/test_safefetch.cpp index 6d7b3f2feb1c..3e217cc63dab 100644 --- a/test/hotspot/gtest/runtime/test_safefetch.cpp +++ b/test/hotspot/gtest/runtime/test_safefetch.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -64,11 +64,11 @@ static void test_safefetchN_negative() { ASSERT_EQ(-1, a); a = SafeFetchN(bad_addressN, ~patternN); ASSERT_EQ(~patternN, a); - // Also test NULL, but not on AIX, where NULL is readable + // Also test nullptr, but not on AIX, where nullptr is readable #ifndef AIX - a = SafeFetchN(NULL, 0); + a = SafeFetchN(nullptr, 0); ASSERT_EQ(0, a); - a = SafeFetchN(NULL, ~patternN); + a = SafeFetchN(nullptr, ~patternN); ASSERT_EQ(~patternN, a); #endif } @@ -80,11 +80,11 @@ static void test_safefetch32_negative() { ASSERT_EQ(-1, a); a = SafeFetch32(bad_address32, ~pattern32); ASSERT_EQ(~pattern32, a); - // Also test NULL, but not on AIX, where NULL is readable + // Also test nullptr, but not on AIX, where nullptr is readable #ifndef AIX - a = SafeFetch32(NULL, 0); + a = SafeFetch32(nullptr, 0); ASSERT_EQ(0, a); - a = SafeFetch32(NULL, ~pattern32); + a = SafeFetch32(nullptr, ~pattern32); ASSERT_EQ(~pattern32, a); #endif } @@ -105,7 +105,7 @@ TEST_VM(os, safefetch32_negative) { test_safefetch32_negative(); } -// Try with Thread::current being NULL. SafeFetch should work then too. +// Try with Thread::current being nullptr. SafeFetch should work then too. // See JDK-8282475 class ThreadCurrentNullMark : public StackObj { diff --git a/test/hotspot/gtest/runtime/test_threads.cpp b/test/hotspot/gtest/runtime/test_threads.cpp index 8e62a4502a85..758903346464 100644 --- a/test/hotspot/gtest/runtime/test_threads.cpp +++ b/test/hotspot/gtest/runtime/test_threads.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2024, 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 @@ -185,7 +185,7 @@ TEST_VM(ThreadsTest, fast_jni_in_vm) { // DirectByteBuffer is an easy way to trigger GetIntField, // see JDK-8262896 jlong capacity = 0x10000; - jobject buffer = env->NewDirectByteBuffer(NULL, (jlong)capacity); - ASSERT_NE((void*)NULL, buffer); + jobject buffer = env->NewDirectByteBuffer(nullptr, (jlong)capacity); + ASSERT_NE((void*)nullptr, buffer); ASSERT_EQ(capacity, env->GetDirectBufferCapacity(buffer)); } diff --git a/test/hotspot/gtest/runtime/test_virtualMemoryTracker.cpp b/test/hotspot/gtest/runtime/test_virtualMemoryTracker.cpp index 4aa058dc160e..e453bb56ee50 100644 --- a/test/hotspot/gtest/runtime/test_virtualMemoryTracker.cpp +++ b/test/hotspot/gtest/runtime/test_virtualMemoryTracker.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2024, 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 @@ -55,13 +55,13 @@ namespace { #define check_empty(rmr) \ do { \ - check_inner((rmr), NULL, 0, __FILE__, __LINE__); \ + check_inner((rmr), nullptr, 0, __FILE__, __LINE__); \ } while (false) static void diagnostic_print(ReservedMemoryRegion* rmr) { CommittedRegionIterator iter = rmr->iterate_committed_regions(); LOG("In reserved region " PTR_FORMAT ", size " SIZE_FORMAT_HEX ":", p2i(rmr->base()), rmr->size()); - for (const CommittedMemoryRegion* region = iter.next(); region != NULL; region = iter.next()) { + for (const CommittedMemoryRegion* region = iter.next(); region != nullptr; region = iter.next()) { LOG(" committed region: " PTR_FORMAT ", size " SIZE_FORMAT_HEX, p2i(region->base()), region->size()); } } @@ -76,7 +76,7 @@ static void check_inner(ReservedMemoryRegion* rmr, R* regions, size_t regions_si #define WHERE " from " << file << ":" << line - for (const CommittedMemoryRegion* region = iter.next(); region != NULL; region = iter.next()) { + for (const CommittedMemoryRegion* region = iter.next(); region != nullptr; region = iter.next()) { EXPECT_LT(i, regions_size) << WHERE; EXPECT_EQ(region->base(), regions[i]._addr) << WHERE; EXPECT_EQ(region->size(), regions[i]._size) << WHERE; diff --git a/test/hotspot/gtest/runtime/test_vmStructs.cpp b/test/hotspot/gtest/runtime/test_vmStructs.cpp index de9182e5f4d9..8339318cfec6 100644 --- a/test/hotspot/gtest/runtime/test_vmStructs.cpp +++ b/test/hotspot/gtest/runtime/test_vmStructs.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2024, 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 @@ -55,8 +55,8 @@ TEST(VMStructs, last_entries) { TEST(VMStructs, VMTypes_duplicates) { // Check for duplicate entries in type array - for (int i = 0; VMStructs::localHotSpotVMTypes[i].typeName != NULL; i++) { - for (int j = i + 1; VMStructs::localHotSpotVMTypes[j].typeName != NULL; j++) { + for (int i = 0; VMStructs::localHotSpotVMTypes[i].typeName != nullptr; i++) { + for (int j = i + 1; VMStructs::localHotSpotVMTypes[j].typeName != nullptr; j++) { EXPECT_STRNE(VMStructs::localHotSpotVMTypes[i].typeName, VMStructs::localHotSpotVMTypes[j].typeName) << "Duplicate entries on indexes " << i << " and " << j << " : " << VMStructs::localHotSpotVMTypes[i].typeName; } diff --git a/test/hotspot/gtest/testutils.cpp b/test/hotspot/gtest/testutils.cpp index cefa33b08ddd..1da4bd2534d7 100644 --- a/test/hotspot/gtest/testutils.cpp +++ b/test/hotspot/gtest/testutils.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2021, 2023 SAP SE. All rights reserved. - * Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2024, 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,17 +35,17 @@ // Note: these could be made more suitable for covering large ranges (e.g. just mark one byte per page). void GtestUtils::mark_range_with(void* p, size_t s, uint8_t mark) { - if (p != NULL && s > 0) { + if (p != nullptr && s > 0) { ::memset(p, mark, s); } } bool GtestUtils::is_range_marked(const void* p, size_t s, uint8_t expected) { - if (p == NULL || s == 0) { + if (p == nullptr || s == 0) { return true; } - const char* first_wrong = NULL; + const char* first_wrong = nullptr; char* p2 = (char*)p; const char* const end = p2 + s; while (p2 < end) { @@ -56,7 +56,7 @@ bool GtestUtils::is_range_marked(const void* p, size_t s, uint8_t expected) { p2 ++; } - if (first_wrong != NULL) { + if (first_wrong != nullptr) { tty->print_cr("check_range [" PTR_FORMAT ".." PTR_FORMAT "), 0x%X, : wrong pattern around " PTR_FORMAT, p2i(p), p2i(p) + s, expected, p2i(first_wrong)); // Note: We deliberately print the surroundings too without bounds check. Might be interesting, @@ -65,5 +65,5 @@ bool GtestUtils::is_range_marked(const void* p, size_t s, uint8_t expected) { (address)(align_up(end, 0x10) + 0x10), 1); } - return first_wrong == NULL; + return first_wrong == nullptr; } diff --git a/test/hotspot/gtest/testutils.hpp b/test/hotspot/gtest/testutils.hpp index 6b3d42f1127a..4c226b1d643f 100644 --- a/test/hotspot/gtest/testutils.hpp +++ b/test/hotspot/gtest/testutils.hpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2021, 2023 SAP SE. All rights reserved. - * Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2024, 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 @@ -33,12 +33,12 @@ class GtestUtils : public AllStatic { public: // Fill range with a byte mark. - // Tolerates p == NULL or s == 0. + // Tolerates p == nullptr or s == 0. static void mark_range_with(void* p, size_t s, uint8_t mark); // Given a memory range, check that the whole range is filled with the expected byte. // If not, hex dump around first non-matching address and return false. - // If p == NULL or size == 0, returns true. + // If p == nullptr or size == 0, returns true. static bool is_range_marked(const void* p, size_t s, uint8_t expected); // Convenience method with a predefined byte mark. @@ -53,8 +53,8 @@ class GtestUtils : public AllStatic { #define EXPECT_RANGE_IS_MARKED(p, size) EXPECT_TRUE(GtestUtils::is_range_marked(p, size)) // Mimicking the official ASSERT_xx and EXPECT_xx counterparts of the googletest suite. -// (ASSERT|EXPECT)_NOT_NULL: check that the given pointer is not NULL -// (ASSERT|EXPECT)_NULL: check that the given pointer is NULL +// (ASSERT|EXPECT)_NOT_NULL: check that the given pointer is not null +// (ASSERT|EXPECT)_NULL: check that the given pointer is null #define ASSERT_NOT_NULL(p) ASSERT_NE(p2i(p), 0) #define ASSERT_NULL(p) ASSERT_EQ(p2i(p), 0) #define EXPECT_NOT_NULL(p) EXPECT_NE(p2i(p), 0) diff --git a/test/hotspot/gtest/utilities/test_concurrentHashtable.cpp b/test/hotspot/gtest/utilities/test_concurrentHashtable.cpp index 277b2c37b61a..426e8cb9bfd3 100644 --- a/test/hotspot/gtest/utilities/test_concurrentHashtable.cpp +++ b/test/hotspot/gtest/utilities/test_concurrentHashtable.cpp @@ -105,7 +105,7 @@ struct SimpleTestLookup { uintptr_t _val; SimpleTestLookup(uintptr_t val) : _val(val) {} uintx get_hash() { - return Pointer::get_hash(_val, NULL); + return Pointer::get_hash(_val, nullptr); } bool equals(const uintptr_t* value) { return _val == *value; @@ -119,7 +119,7 @@ struct ValueGet { uintptr_t _return; ValueGet() : _return(0) {} void operator()(uintptr_t* value) { - EXPECT_NE(value, (uintptr_t*)NULL) << "expected valid value"; + EXPECT_NE(value, (uintptr_t*)nullptr) << "expected valid value"; _return = *value; } uintptr_t get_value() const { @@ -562,7 +562,7 @@ struct TestLookup { uintptr_t _val; TestLookup(uintptr_t val) : _val(val) {} uintx get_hash() { - return TestInterface::get_hash(_val, NULL); + return TestInterface::get_hash(_val, nullptr); } bool equals(const uintptr_t* value) { return _val == *value; @@ -684,7 +684,7 @@ class RunnerSimpleInserterThread : public CHTTestThread { public: Semaphore _done; - RunnerSimpleInserterThread(Semaphore* post) : CHTTestThread(0, 0, NULL, post) { + RunnerSimpleInserterThread(Semaphore* post) : CHTTestThread(0, 0, nullptr, post) { _cht = new TestTable(SIZE_32, SIZE_32); }; virtual ~RunnerSimpleInserterThread(){} @@ -768,7 +768,7 @@ class RunnerDeleteInserterThread : public CHTTestThread { public: Semaphore _done; - RunnerDeleteInserterThread(Semaphore* post) : CHTTestThread(0, 0, NULL, post) { + RunnerDeleteInserterThread(Semaphore* post) : CHTTestThread(0, 0, nullptr, post) { _cht = new TestTable(SIZE_32, SIZE_32); }; virtual ~RunnerDeleteInserterThread(){} @@ -795,7 +795,7 @@ class RunnerDeleteInserterThread : public CHTTestThread { TestLookup tl(v); TestGetHandle value_handle(this, _cht); uintptr_t* tmp = value_handle.get(tl); - tv = tmp != NULL ? *tmp : 0; + tv = tmp != nullptr ? *tmp : 0; } EXPECT_TRUE(tv == 0 || tv == v) << "Got unknown value."; } @@ -894,7 +894,7 @@ class RunnerGSInserterThread : public CHTTestThread { uintptr_t _range; Semaphore _done; - RunnerGSInserterThread(Semaphore* post) : CHTTestThread(0, 0, NULL, post) { + RunnerGSInserterThread(Semaphore* post) : CHTTestThread(0, 0, nullptr, post) { _cht = new TestTable(START_SIZE, END_SIZE, 2); }; virtual ~RunnerGSInserterThread(){} @@ -1036,7 +1036,7 @@ class RunnerGI_BD_InserterThread : public CHTTestThread { Semaphore _done; uintptr_t _start; uintptr_t _range; - RunnerGI_BD_InserterThread(Semaphore* post) : CHTTestThread(0, 0, NULL, post) { + RunnerGI_BD_InserterThread(Semaphore* post) : CHTTestThread(0, 0, nullptr, post) { _cht = new TestTable(GI_BD_GI_BD_START_SIZE, GI_BD_END_SIZE, 2); }; virtual ~RunnerGI_BD_InserterThread(){} diff --git a/test/hotspot/gtest/utilities/test_linkedlist.cpp b/test/hotspot/gtest/utilities/test_linkedlist.cpp index 702ab9f6bb34..38bdcb342efc 100644 --- a/test/hotspot/gtest/utilities/test_linkedlist.cpp +++ b/test/hotspot/gtest/utilities/test_linkedlist.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2024, 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 @@ -50,7 +50,7 @@ class Integer : public StackObj { static void check_list_values(const int* expected, const LinkedList* list) { LinkedListNode* head = list->head(); int index = 0; - while (head != NULL) { + while (head != nullptr) { ASSERT_EQ(expected[index], head->peek()->value()) << "Unexpected value at index " << index; head = head->next(); @@ -70,14 +70,14 @@ TEST(LinkedList, simple) { ASSERT_TRUE(!ll.is_empty()) << "Should not be empty"; Integer* i = ll.find(six); - ASSERT_TRUE(i != NULL) << "Should find it"; + ASSERT_TRUE(i != nullptr) << "Should find it"; ASSERT_EQ(six.value(), i->value()) << "Should be 6"; i = ll.find(three); - ASSERT_TRUE(i == NULL) << "Not in the list"; + ASSERT_TRUE(i == nullptr) << "Not in the list"; LinkedListNode* node = ll.find_node(six); - ASSERT_TRUE(node != NULL) << "6 is in the list"; + ASSERT_TRUE(node != nullptr) << "6 is in the list"; ll.insert_after(three, node); ll.insert_before(one, node); @@ -136,7 +136,7 @@ TEST(LinkedList, generic) { LinkedListIterator it2(dummy.head()); EXPECT_TRUE(it2.is_empty()); - EXPECT_EQ(it2.next(), (Integer* )NULL); + EXPECT_EQ(it2.next(), (Integer* )nullptr); } TEST(LinkedList, algorithm) { @@ -145,7 +145,7 @@ TEST(LinkedList, algorithm) { il.add(2); il.add(3); EXPECT_EQ(*il.find(1), 1); - EXPECT_EQ(il.find(404), (int* )NULL); + EXPECT_EQ(il.find(404), (int* )nullptr); EXPECT_TRUE(il.remove(1)); EXPECT_FALSE(il.remove(404)); @@ -189,7 +189,7 @@ TEST(SortedLinkedList, simple) { } LinkedListNode* node = sl.find_node(four); - ASSERT_TRUE(node != NULL) << "4 is in the list"; + ASSERT_TRUE(node != nullptr) << "4 is in the list"; sl.remove_before(node); sl.remove_after(node); int remains[] = {1, 2, 4, 6}; diff --git a/test/hotspot/gtest/utilities/test_lockFreeStack.cpp b/test/hotspot/gtest/utilities/test_lockFreeStack.cpp index d19c078e3e65..50a61657f870 100644 --- a/test/hotspot/gtest/utilities/test_lockFreeStack.cpp +++ b/test/hotspot/gtest/utilities/test_lockFreeStack.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2024, 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 @@ -82,8 +82,8 @@ LockFreeStackTestBasics::LockFreeStackTestBasics() : stack() { void LockFreeStackTestBasics::initialize() { ASSERT_TRUE(stack.empty()); ASSERT_EQ(0u, stack.length()); - ASSERT_TRUE(stack.pop() == NULL); - ASSERT_TRUE(stack.top() == NULL); + ASSERT_TRUE(stack.pop() == nullptr); + ASSERT_TRUE(stack.top() == nullptr); for (size_t id = 0; id < nelements; ++id) { ASSERT_EQ(id, stack.length()); @@ -101,48 +101,48 @@ TEST_F(LockFreeStackTestBasics, push_pop) { ASSERT_EQ(i, stack.length()); --i; Element* e = stack.pop(); - ASSERT_TRUE(e != NULL); + ASSERT_TRUE(e != nullptr); ASSERT_EQ(&elements[i], e); ASSERT_EQ(i, e->id()); } ASSERT_TRUE(stack.empty()); ASSERT_EQ(0u, stack.length()); - ASSERT_TRUE(stack.pop() == NULL); + ASSERT_TRUE(stack.pop() == nullptr); } TEST_F(LockFreeStackTestBasics, prepend_one) { TestStack other_stack; ASSERT_TRUE(other_stack.empty()); - ASSERT_TRUE(other_stack.pop() == NULL); + ASSERT_TRUE(other_stack.pop() == nullptr); ASSERT_EQ(0u, other_stack.length()); - ASSERT_TRUE(other_stack.top() == NULL); - ASSERT_TRUE(other_stack.pop() == NULL); + ASSERT_TRUE(other_stack.top() == nullptr); + ASSERT_TRUE(other_stack.pop() == nullptr); other_stack.prepend(*stack.pop_all()); ASSERT_EQ(nelements, other_stack.length()); ASSERT_TRUE(stack.empty()); ASSERT_EQ(0u, stack.length()); - ASSERT_TRUE(stack.pop() == NULL); - ASSERT_TRUE(stack.top() == NULL); + ASSERT_TRUE(stack.pop() == nullptr); + ASSERT_TRUE(stack.top() == nullptr); for (size_t i = nelements; i > 0; ) { ASSERT_EQ(i, other_stack.length()); --i; Element* e = other_stack.pop(); - ASSERT_TRUE(e != NULL); + ASSERT_TRUE(e != nullptr); ASSERT_EQ(&elements[i], e); ASSERT_EQ(i, e->id()); } ASSERT_EQ(0u, other_stack.length()); - ASSERT_TRUE(other_stack.pop() == NULL); + ASSERT_TRUE(other_stack.pop() == nullptr); } TEST_F(LockFreeStackTestBasics, prepend_two) { TestStack other_stack; ASSERT_TRUE(other_stack.empty()); ASSERT_EQ(0u, other_stack.length()); - ASSERT_TRUE(other_stack.top() == NULL); - ASSERT_TRUE(other_stack.pop() == NULL); + ASSERT_TRUE(other_stack.top() == nullptr); + ASSERT_TRUE(other_stack.pop() == nullptr); Element* top = stack.pop_all(); ASSERT_EQ(top, &elements[nelements - 1]); @@ -152,17 +152,17 @@ TEST_F(LockFreeStackTestBasics, prepend_two) { ASSERT_EQ(i, other_stack.length()); --i; Element* e = other_stack.pop(); - ASSERT_TRUE(e != NULL); + ASSERT_TRUE(e != nullptr); ASSERT_EQ(&elements[i], e); ASSERT_EQ(i, e->id()); } ASSERT_EQ(0u, other_stack.length()); - ASSERT_TRUE(other_stack.pop() == NULL); + ASSERT_TRUE(other_stack.pop() == nullptr); } TEST_F(LockFreeStackTestBasics, two_stacks) { TestStack1 stack1; - ASSERT_TRUE(stack1.pop() == NULL); + ASSERT_TRUE(stack1.pop() == nullptr); for (size_t id = 0; id < nelements; ++id) { stack1.push(elements[id]); @@ -172,7 +172,7 @@ TEST_F(LockFreeStackTestBasics, two_stacks) { Element* e1 = stack1.top(); while (true) { ASSERT_EQ(e0, e1); - if (e0 == NULL) break; + if (e0 == nullptr) break; e0 = stack.next(*e0); e1 = stack1.next(*e1); } @@ -182,12 +182,12 @@ TEST_F(LockFreeStackTestBasics, two_stacks) { ASSERT_EQ(i, stack1.length()); --i; Element* e = stack.pop(); - ASSERT_TRUE(e != NULL); + ASSERT_TRUE(e != nullptr); ASSERT_EQ(&elements[i], e); ASSERT_EQ(i, e->id()); Element* e1 = stack1.pop(); - ASSERT_TRUE(e1 != NULL); + ASSERT_TRUE(e1 != nullptr); ASSERT_EQ(&elements[i], e1); ASSERT_EQ(i, e1->id()); @@ -195,8 +195,8 @@ TEST_F(LockFreeStackTestBasics, two_stacks) { } ASSERT_EQ(0u, stack.length()); ASSERT_EQ(0u, stack1.length()); - ASSERT_TRUE(stack.pop() == NULL); - ASSERT_TRUE(stack1.pop() == NULL); + ASSERT_TRUE(stack.pop() == nullptr); + ASSERT_TRUE(stack1.pop() == nullptr); } class LockFreeStackTestThread : public JavaTestThread { @@ -229,7 +229,7 @@ class LockFreeStackTestThread : public JavaTestThread { Atomic::release_store_fence(&_ready, true); while (true) { Element* e = _from->pop(); - if (e != NULL) { + if (e != nullptr) { _to->push(*e); Atomic::inc(_processed); ++_local_processed; @@ -300,7 +300,7 @@ TEST_VM(LockFreeStackTest, stress) { ASSERT_EQ(0u, start_stack.length()); ASSERT_EQ(0u, middle_stack.length()); ASSERT_EQ(nelements, final_stack.length()); - while (final_stack.pop() != NULL) {} + while (final_stack.pop() != nullptr) {} FREE_C_HEAP_ARRAY(Element, elements); } diff --git a/test/hotspot/gtest/utilities/test_metaspaceClosure.cpp b/test/hotspot/gtest/utilities/test_metaspaceClosure.cpp index 7760c3cfe12d..f52308987602 100644 --- a/test/hotspot/gtest/utilities/test_metaspaceClosure.cpp +++ b/test/hotspot/gtest/utilities/test_metaspaceClosure.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2024, 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,7 +35,7 @@ class MyMetaData : public MetaspaceObj { MyMetaData* _a; MyMetaData* _b; - MyMetaData() : _a(NULL), _b(NULL) {} + MyMetaData() : _a(nullptr), _b(nullptr) {} MetaspaceObj::Type type() const { return MetaspaceObj::SymbolType; // Just lie. It doesn't matter in this test @@ -64,7 +64,7 @@ class MyUniqueMetaspaceClosure : public MetaspaceClosure { public: MyUniqueMetaspaceClosure() { for (int i = 0; i < SIZE; i++) { - _visited[i] = NULL; + _visited[i] = nullptr; } _count = 0; } @@ -92,7 +92,7 @@ TEST_VM(MetaspaceClosure, MSOPointerArrayRef) { ClassLoaderData* cld = ClassLoaderData::the_null_class_loader_data(); Array* array = MetadataFactory::new_array(cld, 4, THREAD); for (int i = 0; i < array->length(); i++) { - EXPECT_TRUE(array->at(i) == NULL) << "should be initialized to null"; + EXPECT_TRUE(array->at(i) == nullptr) << "should be initialized to null"; } MyMetaData x; @@ -117,8 +117,8 @@ TEST_VM(MetaspaceClosure, MSOArrayRef) { ClassLoaderData* cld = ClassLoaderData::the_null_class_loader_data(); Array* array = MetadataFactory::new_array(cld, 4, THREAD); for (int i = 0; i < array->length(); i++) { - EXPECT_TRUE(array->at(i)._a == NULL) << "should be initialized to null"; - EXPECT_TRUE(array->at(i)._b == NULL) << "should be initialized to null"; + EXPECT_TRUE(array->at(i)._a == nullptr) << "should be initialized to null"; + EXPECT_TRUE(array->at(i)._b == nullptr) << "should be initialized to null"; } MyMetaData x; diff --git a/test/hotspot/gtest/utilities/test_nonblockingQueue.cpp b/test/hotspot/gtest/utilities/test_nonblockingQueue.cpp index 367c57318cc8..3aac1a7d2730 100644 --- a/test/hotspot/gtest/utilities/test_nonblockingQueue.cpp +++ b/test/hotspot/gtest/utilities/test_nonblockingQueue.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2024, 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 @@ -64,7 +64,7 @@ static void initialize(Element* elements, size_t size, TestQueue* queue) { ASSERT_TRUE(queue->empty()); ASSERT_EQ(0u, queue->length()); ASSERT_TRUE(queue->is_end(queue->first())); - ASSERT_TRUE(queue->pop() == NULL); + ASSERT_TRUE(queue->pop() == nullptr); for (size_t id = 0; id < size; ++id) { ASSERT_EQ(id, queue->length()); @@ -97,13 +97,13 @@ TEST_F(NonblockingQueueTestBasics, pop) { ASSERT_FALSE(queue.empty()); ASSERT_EQ(nelements - i, queue.length()); Element* e = queue.pop(); - ASSERT_TRUE(e != NULL); + ASSERT_TRUE(e != nullptr); ASSERT_EQ(&elements[i], e); ASSERT_EQ(i, e->id()); } ASSERT_TRUE(queue.empty()); ASSERT_EQ(0u, queue.length()); - ASSERT_TRUE(queue.pop() == NULL); + ASSERT_TRUE(queue.pop() == nullptr); } TEST_F(NonblockingQueueTestBasics, append) { @@ -111,7 +111,7 @@ TEST_F(NonblockingQueueTestBasics, append) { ASSERT_TRUE(other_queue.empty()); ASSERT_EQ(0u, other_queue.length()); ASSERT_TRUE(other_queue.is_end(other_queue.first())); - ASSERT_TRUE(other_queue.pop() == NULL); + ASSERT_TRUE(other_queue.pop() == nullptr); Pair pair = queue.take_all(); other_queue.append(*pair.first, *pair.second); @@ -119,22 +119,22 @@ TEST_F(NonblockingQueueTestBasics, append) { ASSERT_TRUE(queue.empty()); ASSERT_EQ(0u, queue.length()); ASSERT_TRUE(queue.is_end(queue.first())); - ASSERT_TRUE(queue.pop() == NULL); + ASSERT_TRUE(queue.pop() == nullptr); for (size_t i = 0; i < nelements; ++i) { ASSERT_EQ(nelements - i, other_queue.length()); Element* e = other_queue.pop(); - ASSERT_TRUE(e != NULL); + ASSERT_TRUE(e != nullptr); ASSERT_EQ(&elements[i], e); ASSERT_EQ(i, e->id()); } ASSERT_EQ(0u, other_queue.length()); - ASSERT_TRUE(other_queue.pop() == NULL); + ASSERT_TRUE(other_queue.pop() == nullptr); } TEST_F(NonblockingQueueTestBasics, two_queues) { TestQueue1 queue1; - ASSERT_TRUE(queue1.pop() == NULL); + ASSERT_TRUE(queue1.pop() == nullptr); for (size_t id = 0; id < nelements; ++id) { queue1.push(elements[id]); @@ -142,8 +142,8 @@ TEST_F(NonblockingQueueTestBasics, two_queues) { ASSERT_EQ(nelements, queue1.length()); Element* e0 = queue.first(); Element* e1 = queue1.first(); - ASSERT_TRUE(e0 != NULL); - ASSERT_TRUE(e1 != NULL); + ASSERT_TRUE(e0 != nullptr); + ASSERT_TRUE(e1 != nullptr); ASSERT_FALSE(queue.is_end(e0)); ASSERT_FALSE(queue1.is_end(e1)); while (!queue.is_end(e0) && !queue1.is_end(e1)) { @@ -159,12 +159,12 @@ TEST_F(NonblockingQueueTestBasics, two_queues) { ASSERT_EQ(nelements - i, queue1.length()); Element* e = queue.pop(); - ASSERT_TRUE(e != NULL); + ASSERT_TRUE(e != nullptr); ASSERT_EQ(&elements[i], e); ASSERT_EQ(i, e->id()); Element* e1 = queue1.pop(); - ASSERT_TRUE(e1 != NULL); + ASSERT_TRUE(e1 != nullptr); ASSERT_EQ(&elements[i], e1); ASSERT_EQ(i, e1->id()); @@ -172,8 +172,8 @@ TEST_F(NonblockingQueueTestBasics, two_queues) { } ASSERT_EQ(0u, queue.length()); ASSERT_EQ(0u, queue1.length()); - ASSERT_TRUE(queue.pop() == NULL); - ASSERT_TRUE(queue1.pop() == NULL); + ASSERT_TRUE(queue.pop() == nullptr); + ASSERT_TRUE(queue1.pop() == nullptr); } class NonblockingQueueTestThread : public JavaTestThread { @@ -206,7 +206,7 @@ class NonblockingQueueTestThread : public JavaTestThread { Atomic::release_store_fence(&_ready, true); while (true) { Element* e = _from->pop(); - if (e != NULL) { + if (e != nullptr) { _to->push(*e); Atomic::inc(_processed); ++_local_processed; @@ -278,7 +278,7 @@ TEST_VM(NonblockingQueueTest, stress) { ASSERT_EQ(0u, start_queue.length()); ASSERT_EQ(0u, middle_queue.length()); ASSERT_EQ(nelements, final_queue.length()); - while (final_queue.pop() != NULL) {} + while (final_queue.pop() != nullptr) {} FREE_C_HEAP_ARRAY(Element, elements); } diff --git a/test/hotspot/gtest/utilities/test_objectBitSet.cpp b/test/hotspot/gtest/utilities/test_objectBitSet.cpp index a3425e4bfdac..8b954ad2a75e 100644 --- a/test/hotspot/gtest/utilities/test_objectBitSet.cpp +++ b/test/hotspot/gtest/utilities/test_objectBitSet.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,15 +32,15 @@ TEST_VM(ObjectBitSet, empty) { ASSERT_FALSE(obs.is_marked(&obj1)); } -// NOTE: This is a little weird. NULL is not treated any special: ObjectBitSet will happily -// allocate a fragement for the memory range starting at 0 and mark the first bit when passing NULL. +// NOTE: This is a little weird. nullptr is not treated any special: ObjectBitSet will happily +// allocate a fragement for the memory range starting at 0 and mark the first bit when passing nullptr. // In the absense of any error handling, I am not sure what would possibly be a reasonable better // way to do it, though. TEST_VM(ObjectBitSet, null) { ObjectBitSet obs; - ASSERT_FALSE(obs.is_marked((oop)NULL)); - obs.mark_obj((oop) NULL); - ASSERT_TRUE(obs.is_marked((oop)NULL)); + ASSERT_FALSE(obs.is_marked((oop)nullptr)); + obs.mark_obj((oop) nullptr); + ASSERT_TRUE(obs.is_marked((oop)nullptr)); } TEST_VM(ObjectBitSet, mark_single) { diff --git a/test/hotspot/gtest/utilities/test_quicksort.cpp b/test/hotspot/gtest/utilities/test_quicksort.cpp index 5e909b73531f..2ce18486e3e2 100644 --- a/test/hotspot/gtest/utilities/test_quicksort.cpp +++ b/test/hotspot/gtest/utilities/test_quicksort.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2024, 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 @@ -81,8 +81,8 @@ extern "C" { TEST(QuickSort, quicksort) { { - int* test_array = NULL; - int* expected_array = NULL; + int* test_array = nullptr; + int* expected_array = nullptr; EXPECT_TRUE(sort_and_compare(test_array, expected_array, 0, test_comparator)); } { diff --git a/test/hotspot/gtest/utilities/test_vmerror.cpp b/test/hotspot/gtest/utilities/test_vmerror.cpp index 46d475dd5b67..5c00fe407f04 100644 --- a/test/hotspot/gtest/utilities/test_vmerror.cpp +++ b/test/hotspot/gtest/utilities/test_vmerror.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -43,8 +43,8 @@ TEST_VM_ASSERT_MSG(vmErrorTest, resourceMark, const char* const str = "hello"; const size_t num = 500; -TEST_VM_ASSERT_MSG(vmErrorTest, assert1, "assert.str == NULL. failed: expected null") { - vmassert(str == NULL, "expected null"); +TEST_VM_ASSERT_MSG(vmErrorTest, assert1, "assert.str == nullptr. failed: expected null") { + vmassert(str == nullptr, "expected null"); } TEST_VM_ASSERT_MSG(vmErrorTest, assert2, "assert.num == 1023 && .str == 'X'. failed: num=500 str=\"hello\"") { @@ -52,8 +52,8 @@ TEST_VM_ASSERT_MSG(vmErrorTest, assert2, "assert.num == 1023 && .str == 'X'. fai "num=" SIZE_FORMAT " str=\"%s\"", num, str); } -TEST_VM_ASSERT_MSG(vmErrorTest, guarantee1, "guarantee.str == NULL. failed: expected null") { - guarantee(str == NULL, "expected null"); +TEST_VM_ASSERT_MSG(vmErrorTest, guarantee1, "guarantee.str == nullptr. failed: expected null") { + guarantee(str == nullptr, "expected null"); } TEST_VM_ASSERT_MSG(vmErrorTest, guarantee2, "guarantee.num == 1023 && .str == 'X'. failed: num=500 str=\"hello\"") { diff --git a/test/hotspot/jtreg/ProblemList-Virtual.txt b/test/hotspot/jtreg/ProblemList-Virtual.txt index 378d67402d89..73b90128e20c 100644 --- a/test/hotspot/jtreg/ProblemList-Virtual.txt +++ b/test/hotspot/jtreg/ProblemList-Virtual.txt @@ -1,5 +1,5 @@ # -# Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2022, 2024, 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,10 +27,6 @@ serviceability/AsyncGetCallTrace/MyPackage/ASGCTBaseTest.java 8308026 generic-all serviceability/jvmti/GetThreadListStackTraces/OneGetThreadListStackTraces.java 8308027 generic-all serviceability/jvmti/Heap/IterateHeapWithEscapeAnalysisEnabled.java 8264699 generic-all -serviceability/dcmd/thread/PrintConcurrentLocksTest.java 8308033 generic-all -serviceability/dcmd/thread/PrintTest.java 8308033 generic-all -serviceability/dcmd/thread/ThreadDumpToFileTest.java 8308033 generic-all -serviceability/tmtools/jstack/DaemonThreadTest.java 8308033 generic-all #### ## Classes not unloaded as expected (TODO, need to check if FJ keeps a reference) @@ -60,12 +56,6 @@ vmTestbase/nsk/jvmti/scenarios/allocation/AP11/ap11t001/TestDescription.java 830 ## assert in src/hotspot/share/oops/instanceStackChunkKlass.cpp:1042 vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage006/TestDescription.java 8300709 generic-all -#### -## NSK JDWP Tests failing with wrapper - -vmTestbase/nsk/jdwp/ThreadReference/ForceEarlyReturn/forceEarlyReturn002/forceEarlyReturn002.java 8286789 generic-all - - ########## ## NSK JDB Tests failing with wrapper diff --git a/test/hotspot/jtreg/ProblemList-Xcomp.txt b/test/hotspot/jtreg/ProblemList-Xcomp.txt index 1a1eb1fd9c6a..4842b3fbcc5c 100644 --- a/test/hotspot/jtreg/ProblemList-Xcomp.txt +++ b/test/hotspot/jtreg/ProblemList-Xcomp.txt @@ -50,3 +50,5 @@ vmTestbase/vm/mlvm/indy/func/jvmti/redefineClassInTarget/TestDescription.java 83 vmTestbase/nsk/jvmti/scenarios/capability/CM03/cm03t001/TestDescription.java 8299493 macosx-x64 gc/arguments/TestNewSizeFlags.java 8299116 macosx-aarch64 + +runtime/condy/escapeAnalysis/TestEscapeCondy.java 8339694 generic-all diff --git a/test/hotspot/jtreg/ProblemList.txt b/test/hotspot/jtreg/ProblemList.txt index 2380e3a2cc9c..3a77a2bfb2f4 100644 --- a/test/hotspot/jtreg/ProblemList.txt +++ b/test/hotspot/jtreg/ProblemList.txt @@ -92,9 +92,12 @@ gc/TestAllocHumongousFragment.java#aggressive 8298781 generic-all gc/TestAllocHumongousFragment.java#iu-aggressive 8298781 generic-all gc/TestAllocHumongousFragment.java#g1 8298781 generic-all gc/TestAllocHumongousFragment.java#static 8298781 generic-all +gc/shenandoah/TestAllocIntArrays.java#aggressive 8309622 generic-all +gc/shenandoah/TestAllocIntArrays.java#iu-aggressive 8309622 generic-all gc/stress/gclocker/TestExcessGCLockerCollections.java 8229120 generic-all gc/stress/gclocker/TestGCLockerWithParallel.java 8180622 generic-all gc/stress/gclocker/TestGCLockerWithG1.java 8180622 generic-all +gc/stress/gcold/TestGCOldWithShenandoah.java#iu-aggressive 8309622 generic-all gc/stress/TestJNIBlockFullGC/TestJNIBlockFullGC.java 8192647 generic-all gc/stress/TestStressG1Humongous.java 8286554 windows-x64 diff --git a/test/hotspot/jtreg/compiler/c1/TestOSRLotsOfLocals.java b/test/hotspot/jtreg/compiler/c1/TestOSRLotsOfLocals.java new file mode 100644 index 000000000000..c6e111fabad5 --- /dev/null +++ b/test/hotspot/jtreg/compiler/c1/TestOSRLotsOfLocals.java @@ -0,0 +1,102 @@ +/* + * Copyright (c) 2024, 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 + * @summary Test that OSR correctly handles method with large number of locals + * @bug 8335662 + * @library /test/lib / + * @modules java.base/jdk.internal.misc + * + * @build jdk.test.whitebox.WhiteBox + * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox + * + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI + * compiler.c1.TestOSRLotsOfLocals + */ +package compiler.c1; + +import java.lang.reflect.Method; + +import jdk.test.whitebox.WhiteBox; + +import static compiler.whitebox.CompilerWhiteBoxTest.COMP_LEVEL_SIMPLE; + +public class TestOSRLotsOfLocals { + + private static WhiteBox wb = WhiteBox.getWhiteBox(); + + public static void main(String... args) throws Exception { + Method method = TestOSRLotsOfLocals.class.getDeclaredMethod("lotsOfLocals"); + + wb.enqueueMethodForCompilation(method, COMP_LEVEL_SIMPLE, 0); + while (wb.isMethodQueuedForCompilation(method)) { + Thread.onSpinWait(); + } + } + + private static synchronized void lotsOfLocals() { + boolean b0, b1, b2, b3, b4, b5, b6, b7, b8, b9, b10, b11, b12, b13, b14, b15, b16, b17, b18, b19, b20, b21, b22, b23, b24, b25, b26, b27, b28, b29, b30, b31, b32, b33, b34, b35, b36, b37, b38, b39, b40, b41, b42, b43, b44, b45, b46, b47, b48, b49, b50, b51, b52, b53, b54, b55, b56, b57, b58, b59, b60, b61, b62, b63, b64, b65, b66, b67, b68, b69, b70, b71, b72, b73, b74, b75, b76, b77, b78, b79, b80, b81, b82, b83, b84, b85, b86, b87, b88, b89, b90, b91, b92, b93, b94, b95, b96, b97, b98, b99, + b100, b101, b102, b103, b104, b105, b106, b107, b108, b109, b110, b111, b112, b113, b114, b115, b116, b117, b118, b119, b120, b121, b122, b123, b124, b125, b126, b127, b128, b129, b130, b131, b132, b133, b134, b135, b136, b137, b138, b139, b140, b141, b142, b143, b144, b145, b146, b147, b148, b149, b150, b151, b152, b153, b154, b155, b156, b157, b158, b159, b160, b161, b162, b163, b164, b165, b166, b167, b168, b169, b170, b171, b172, b173, b174, b175, b176, b177, b178, b179, b180, b181, b182, b183, b184, b185, b186, b187, b188, b189, b190, b191, b192, b193, b194, b195, b196, b197, b198, b199, + b200, b201, b202, b203, b204, b205, b206, b207, b208, b209, b210, b211, b212, b213, b214, b215, b216, b217, b218, b219, b220, b221, b222, b223, b224, b225, b226, b227, b228, b229, b230, b231, b232, b233, b234, b235, b236, b237, b238, b239, b240, b241, b242, b243, b244, b245, b246, b247, b248, b249, b250, b251, b252, b253, b254, b255, b256, b257, b258, b259, b260, b261, b262, b263, b264, b265, b266, b267, b268, b269, b270, b271, b272, b273, b274, b275, b276, b277, b278, b279, b280, b281, b282, b283, b284, b285, b286, b287, b288, b289, b290, b291, b292, b293, b294, b295, b296, b297, b298, b299, + b300, b301, b302, b303, b304, b305, b306, b307, b308, b309, b310, b311, b312, b313, b314, b315, b316, b317, b318, b319, b320, b321, b322, b323, b324, b325, b326, b327, b328, b329, b330, b331, b332, b333, b334, b335, b336, b337, b338, b339, b340, b341, b342, b343, b344, b345, b346, b347, b348, b349, b350, b351, b352, b353, b354, b355, b356, b357, b358, b359, b360, b361, b362, b363, b364, b365, b366, b367, b368, b369, b370, b371, b372, b373, b374, b375, b376, b377, b378, b379, b380, b381, b382, b383, b384, b385, b386, b387, b388, b389, b390, b391, b392, b393, b394, b395, b396, b397, b398, b399, + b400, b401, b402, b403, b404, b405, b406, b407, b408, b409, b410, b411, b412, b413, b414, b415, b416, b417, b418, b419, b420, b421, b422, b423, b424, b425, b426, b427, b428, b429, b430, b431, b432, b433, b434, b435, b436, b437, b438, b439, b440, b441, b442, b443, b444, b445, b446, b447, b448, b449, b450, b451, b452, b453, b454, b455, b456, b457, b458, b459, b460, b461, b462, b463, b464, b465, b466, b467, b468, b469, b470, b471, b472, b473, b474, b475, b476, b477, b478, b479, b480, b481, b482, b483, b484, b485, b486, b487, b488, b489, b490, b491, b492, b493, b494, b495, b496, b497, b498, b499, + b500, b501, b502, b503, b504, b505, b506, b507, b508, b509, b510, b511, b512, b513, b514, b515, b516, b517, b518, b519, b520, b521, b522, b523, b524, b525, b526, b527, b528, b529, b530, b531, b532, b533, b534, b535, b536, b537, b538, b539, b540, b541, b542, b543, b544, b545, b546, b547, b548, b549, b550, b551, b552, b553, b554, b555, b556, b557, b558, b559, b560, b561, b562, b563, b564, b565, b566, b567, b568, b569, b570, b571, b572, b573, b574, b575, b576, b577, b578, b579, b580, b581, b582, b583, b584, b585, b586, b587, b588, b589, b590, b591, b592, b593, b594, b595, b596, b597, b598, b599, + b600, b601, b602, b603, b604, b605, b606, b607, b608, b609, b610, b611, b612, b613, b614, b615, b616, b617, b618, b619, b620, b621, b622, b623, b624, b625, b626, b627, b628, b629, b630, b631, b632, b633, b634, b635, b636, b637, b638, b639, b640, b641, b642, b643, b644, b645, b646, b647, b648, b649, b650, b651, b652, b653, b654, b655, b656, b657, b658, b659, b660, b661, b662, b663, b664, b665, b666, b667, b668, b669, b670, b671, b672, b673, b674, b675, b676, b677, b678, b679, b680, b681, b682, b683, b684, b685, b686, b687, b688, b689, b690, b691, b692, b693, b694, b695, b696, b697, b698, b699, + b700, b701, b702, b703, b704, b705, b706, b707, b708, b709, b710, b711, b712, b713, b714, b715, b716, b717, b718, b719, b720, b721, b722, b723, b724, b725, b726, b727, b728, b729, b730, b731, b732, b733, b734, b735, b736, b737, b738, b739, b740, b741, b742, b743, b744, b745, b746, b747, b748, b749, b750, b751, b752, b753, b754, b755, b756, b757, b758, b759, b760, b761, b762, b763, b764, b765, b766, b767, b768, b769, b770, b771, b772, b773, b774, b775, b776, b777, b778, b779, b780, b781, b782, b783, b784, b785, b786, b787, b788, b789, b790, b791, b792, b793, b794, b795, b796, b797, b798, b799, + b800, b801, b802, b803, b804, b805, b806, b807, b808, b809, b810, b811, b812, b813, b814, b815, b816, b817, b818, b819, b820, b821, b822, b823, b824, b825, b826, b827, b828, b829, b830, b831, b832, b833, b834, b835, b836, b837, b838, b839, b840, b841, b842, b843, b844, b845, b846, b847, b848, b849, b850, b851, b852, b853, b854, b855, b856, b857, b858, b859, b860, b861, b862, b863, b864, b865, b866, b867, b868, b869, b870, b871, b872, b873, b874, b875, b876, b877, b878, b879, b880, b881, b882, b883, b884, b885, b886, b887, b888, b889, b890, b891, b892, b893, b894, b895, b896, b897, b898, b899, + b900, b901, b902, b903, b904, b905, b906, b907, b908, b909, b910, b911, b912, b913, b914, b915, b916, b917, b918, b919, b920, b921, b922, b923, b924, b925, b926, b927, b928, b929, b930, b931, b932, b933, b934, b935, b936, b937, b938, b939, b940, b941, b942, b943, b944, b945, b946, b947, b948, b949, b950, b951, b952, b953, b954, b955, b956, b957, b958, b959, b960, b961, b962, b963, b964, b965, b966, b967, b968, b969, b970, b971, b972, b973, b974, b975, b976, b977, b978, b979, b980, b981, b982, b983, b984, b985, b986, b987, b988, b989, b990, b991, b992, b993, b994, b995, b996, b997, b998, b999, + b1000, b1001, b1002, b1003, b1004, b1005, b1006, b1007, b1008, b1009, b1010, b1011, b1012, b1013, b1014, b1015, b1016, b1017, b1018, b1019, b1020, b1021, b1022, b1023, b1024, b1025, b1026, b1027, b1028, b1029, b1030, b1031, b1032, b1033, b1034, b1035, b1036, b1037, b1038, b1039, b1040, b1041, b1042, b1043, b1044, b1045, b1046, b1047, b1048, b1049, b1050, b1051, b1052, b1053, b1054, b1055, b1056, b1057, b1058, b1059, b1060, b1061, b1062, b1063, b1064, b1065, b1066, b1067, b1068, b1069, b1070, b1071, b1072, b1073, b1074, b1075, b1076, b1077, b1078, b1079, b1080, b1081, b1082, b1083, b1084, b1085, b1086, b1087, b1088, b1089, b1090, b1091, b1092, b1093, b1094, b1095, b1096, b1097, b1098, b1099, + b1100, b1101, b1102, b1103, b1104, b1105, b1106, b1107, b1108, b1109, b1110, b1111, b1112, b1113, b1114, b1115, b1116, b1117, b1118, b1119, b1120, b1121, b1122, b1123, b1124, b1125, b1126, b1127, b1128, b1129, b1130, b1131, b1132, b1133, b1134, b1135, b1136, b1137, b1138, b1139, b1140, b1141, b1142, b1143, b1144, b1145, b1146, b1147, b1148, b1149, b1150, b1151, b1152, b1153, b1154, b1155, b1156, b1157, b1158, b1159, b1160, b1161, b1162, b1163, b1164, b1165, b1166, b1167, b1168, b1169, b1170, b1171, b1172, b1173, b1174, b1175, b1176, b1177, b1178, b1179, b1180, b1181, b1182, b1183, b1184, b1185, b1186, b1187, b1188, b1189, b1190, b1191, b1192, b1193, b1194, b1195, b1196, b1197, b1198, b1199, + b1200, b1201, b1202, b1203, b1204, b1205, b1206, b1207, b1208, b1209, b1210, b1211, b1212, b1213, b1214, b1215, b1216, b1217, b1218, b1219, b1220, b1221, b1222, b1223, b1224, b1225, b1226, b1227, b1228, b1229, b1230, b1231, b1232, b1233, b1234, b1235, b1236, b1237, b1238, b1239, b1240, b1241, b1242, b1243, b1244, b1245, b1246, b1247, b1248, b1249, b1250, b1251, b1252, b1253, b1254, b1255, b1256, b1257, b1258, b1259, b1260, b1261, b1262, b1263, b1264, b1265, b1266, b1267, b1268, b1269, b1270, b1271, b1272, b1273, b1274, b1275, b1276, b1277, b1278, b1279, b1280, b1281, b1282, b1283, b1284, b1285, b1286, b1287, b1288, b1289, b1290, b1291, b1292, b1293, b1294, b1295, b1296, b1297, b1298, b1299, + b1300, b1301, b1302, b1303, b1304, b1305, b1306, b1307, b1308, b1309, b1310, b1311, b1312, b1313, b1314, b1315, b1316, b1317, b1318, b1319, b1320, b1321, b1322, b1323, b1324, b1325, b1326, b1327, b1328, b1329, b1330, b1331, b1332, b1333, b1334, b1335, b1336, b1337, b1338, b1339, b1340, b1341, b1342, b1343, b1344, b1345, b1346, b1347, b1348, b1349, b1350, b1351, b1352, b1353, b1354, b1355, b1356, b1357, b1358, b1359, b1360, b1361, b1362, b1363, b1364, b1365, b1366, b1367, b1368, b1369, b1370, b1371, b1372, b1373, b1374, b1375, b1376, b1377, b1378, b1379, b1380, b1381, b1382, b1383, b1384, b1385, b1386, b1387, b1388, b1389, b1390, b1391, b1392, b1393, b1394, b1395, b1396, b1397, b1398, b1399, + b1400, b1401, b1402, b1403, b1404, b1405, b1406, b1407, b1408, b1409, b1410, b1411, b1412, b1413, b1414, b1415, b1416, b1417, b1418, b1419, b1420, b1421, b1422, b1423, b1424, b1425, b1426, b1427, b1428, b1429, b1430, b1431, b1432, b1433, b1434, b1435, b1436, b1437, b1438, b1439, b1440, b1441, b1442, b1443, b1444, b1445, b1446, b1447, b1448, b1449, b1450, b1451, b1452, b1453, b1454, b1455, b1456, b1457, b1458, b1459, b1460, b1461, b1462, b1463, b1464, b1465, b1466, b1467, b1468, b1469, b1470, b1471, b1472, b1473, b1474, b1475, b1476, b1477, b1478, b1479, b1480, b1481, b1482, b1483, b1484, b1485, b1486, b1487, b1488, b1489, b1490, b1491, b1492, b1493, b1494, b1495, b1496, b1497, b1498, b1499, + b1500, b1501, b1502, b1503, b1504, b1505, b1506, b1507, b1508, b1509, b1510, b1511, b1512, b1513, b1514, b1515, b1516, b1517, b1518, b1519, b1520, b1521, b1522, b1523, b1524, b1525, b1526, b1527, b1528, b1529, b1530, b1531, b1532, b1533, b1534, b1535, b1536, b1537, b1538, b1539, b1540, b1541, b1542, b1543, b1544, b1545, b1546, b1547, b1548, b1549, b1550, b1551, b1552, b1553, b1554, b1555, b1556, b1557, b1558, b1559, b1560, b1561, b1562, b1563, b1564, b1565, b1566, b1567, b1568, b1569, b1570, b1571, b1572, b1573, b1574, b1575, b1576, b1577, b1578, b1579, b1580, b1581, b1582, b1583, b1584, b1585, b1586, b1587, b1588, b1589, b1590, b1591, b1592, b1593, b1594, b1595, b1596, b1597, b1598, b1599, + b1600, b1601, b1602, b1603, b1604, b1605, b1606, b1607, b1608, b1609, b1610, b1611, b1612, b1613, b1614, b1615, b1616, b1617, b1618, b1619, b1620, b1621, b1622, b1623, b1624, b1625, b1626, b1627, b1628, b1629, b1630, b1631, b1632, b1633, b1634, b1635, b1636, b1637, b1638, b1639, b1640, b1641, b1642, b1643, b1644, b1645, b1646, b1647, b1648, b1649, b1650, b1651, b1652, b1653, b1654, b1655, b1656, b1657, b1658, b1659, b1660, b1661, b1662, b1663, b1664, b1665, b1666, b1667, b1668, b1669, b1670, b1671, b1672, b1673, b1674, b1675, b1676, b1677, b1678, b1679, b1680, b1681, b1682, b1683, b1684, b1685, b1686, b1687, b1688, b1689, b1690, b1691, b1692, b1693, b1694, b1695, b1696, b1697, b1698, b1699, + b1700, b1701, b1702, b1703, b1704, b1705, b1706, b1707, b1708, b1709, b1710, b1711, b1712, b1713, b1714, b1715, b1716, b1717, b1718, b1719, b1720, b1721, b1722, b1723, b1724, b1725, b1726, b1727, b1728, b1729, b1730, b1731, b1732, b1733, b1734, b1735, b1736, b1737, b1738, b1739, b1740, b1741, b1742, b1743, b1744, b1745, b1746, b1747, b1748, b1749, b1750, b1751, b1752, b1753, b1754, b1755, b1756, b1757, b1758, b1759, b1760, b1761, b1762, b1763, b1764, b1765, b1766, b1767, b1768, b1769, b1770, b1771, b1772, b1773, b1774, b1775, b1776, b1777, b1778, b1779, b1780, b1781, b1782, b1783, b1784, b1785, b1786, b1787, b1788, b1789, b1790, b1791, b1792, b1793, b1794, b1795, b1796, b1797, b1798, b1799, + b1800, b1801, b1802, b1803, b1804, b1805, b1806, b1807, b1808, b1809, b1810, b1811, b1812, b1813, b1814, b1815, b1816, b1817, b1818, b1819, b1820, b1821, b1822, b1823, b1824, b1825, b1826, b1827, b1828, b1829, b1830, b1831, b1832, b1833, b1834, b1835, b1836, b1837, b1838, b1839, b1840, b1841, b1842, b1843, b1844, b1845, b1846, b1847, b1848, b1849, b1850, b1851, b1852, b1853, b1854, b1855, b1856, b1857, b1858, b1859, b1860, b1861, b1862, b1863, b1864, b1865, b1866, b1867, b1868, b1869, b1870, b1871, b1872, b1873, b1874, b1875, b1876, b1877, b1878, b1879, b1880, b1881, b1882, b1883, b1884, b1885, b1886, b1887, b1888, b1889, b1890, b1891, b1892, b1893, b1894, b1895, b1896, b1897, b1898, b1899, + b1900, b1901, b1902, b1903, b1904, b1905, b1906, b1907, b1908, b1909, b1910, b1911, b1912, b1913, b1914, b1915, b1916, b1917, b1918, b1919, b1920, b1921, b1922, b1923, b1924, b1925, b1926, b1927, b1928, b1929, b1930, b1931, b1932, b1933, b1934, b1935, b1936, b1937, b1938, b1939, b1940, b1941, b1942, b1943, b1944, b1945, b1946, b1947, b1948, b1949, b1950, b1951, b1952, b1953, b1954, b1955, b1956, b1957, b1958, b1959, b1960, b1961, b1962, b1963, b1964, b1965, b1966, b1967, b1968, b1969, b1970, b1971, b1972, b1973, b1974, b1975, b1976, b1977, b1978, b1979, b1980, b1981, b1982, b1983, b1984, b1985, b1986, b1987, b1988, b1989, b1990, b1991, b1992, b1993, b1994, b1995, b1996, b1997, b1998, b1999, + b2000, b2001, b2002, b2003, b2004, b2005, b2006, b2007, b2008, b2009, b2010, b2011, b2012, b2013, b2014, b2015, b2016, b2017, b2018, b2019, b2020, b2021, b2022, b2023, b2024, b2025, b2026, b2027, b2028, b2029, b2030, b2031, b2032, b2033, b2034, b2035, b2036, b2037, b2038, b2039, b2040, b2041, b2042, b2043, b2044, b2045, b2046, b2047, b2048, b2049, b2050, b2051, b2052, b2053, b2054, b2055, b2056, b2057, b2058, b2059, b2060, b2061, b2062, b2063, b2064, b2065, b2066, b2067, b2068, b2069, b2070, b2071, b2072, b2073, b2074, b2075, b2076, b2077, b2078, b2079, b2080, b2081, b2082, b2083, b2084, b2085, b2086, b2087, b2088, b2089, b2090, b2091, b2092, b2093, b2094, b2095, b2096, b2097, b2098, b2099, + b2100, b2101, b2102, b2103, b2104, b2105, b2106, b2107, b2108, b2109, b2110, b2111, b2112, b2113, b2114, b2115, b2116, b2117, b2118, b2119, b2120, b2121, b2122, b2123, b2124, b2125, b2126, b2127, b2128, b2129, b2130, b2131, b2132, b2133, b2134, b2135, b2136, b2137, b2138, b2139, b2140, b2141, b2142, b2143, b2144, b2145, b2146, b2147, b2148, b2149, b2150, b2151, b2152, b2153, b2154, b2155, b2156, b2157, b2158, b2159, b2160, b2161, b2162, b2163, b2164, b2165, b2166, b2167, b2168, b2169, b2170, b2171, b2172, b2173, b2174, b2175, b2176, b2177, b2178, b2179, b2180, b2181, b2182, b2183, b2184, b2185, b2186, b2187, b2188, b2189, b2190, b2191, b2192, b2193, b2194, b2195, b2196, b2197, b2198, b2199, + b2200, b2201, b2202, b2203, b2204, b2205, b2206, b2207, b2208, b2209, b2210, b2211, b2212, b2213, b2214, b2215, b2216, b2217, b2218, b2219, b2220, b2221, b2222, b2223, b2224, b2225, b2226, b2227, b2228, b2229, b2230, b2231, b2232, b2233, b2234, b2235, b2236, b2237, b2238, b2239, b2240, b2241, b2242, b2243, b2244, b2245, b2246, b2247, b2248, b2249, b2250, b2251, b2252, b2253, b2254, b2255, b2256, b2257, b2258, b2259, b2260, b2261, b2262, b2263, b2264, b2265, b2266, b2267, b2268, b2269, b2270, b2271, b2272, b2273, b2274, b2275, b2276, b2277, b2278, b2279, b2280, b2281, b2282, b2283, b2284, b2285, b2286, b2287, b2288, b2289, b2290, b2291, b2292, b2293, b2294, b2295, b2296, b2297, b2298, b2299, + b2300, b2301, b2302, b2303, b2304, b2305, b2306, b2307, b2308, b2309, b2310, b2311, b2312, b2313, b2314, b2315, b2316, b2317, b2318, b2319, b2320, b2321, b2322, b2323, b2324, b2325, b2326, b2327, b2328, b2329, b2330, b2331, b2332, b2333, b2334, b2335, b2336, b2337, b2338, b2339, b2340, b2341, b2342, b2343, b2344, b2345, b2346, b2347, b2348, b2349, b2350, b2351, b2352, b2353, b2354, b2355, b2356, b2357, b2358, b2359, b2360, b2361, b2362, b2363, b2364, b2365, b2366, b2367, b2368, b2369, b2370, b2371, b2372, b2373, b2374, b2375, b2376, b2377, b2378, b2379, b2380, b2381, b2382, b2383, b2384, b2385, b2386, b2387, b2388, b2389, b2390, b2391, b2392, b2393, b2394, b2395, b2396, b2397, b2398, b2399, + b2400, b2401, b2402, b2403, b2404, b2405, b2406, b2407, b2408, b2409, b2410, b2411, b2412, b2413, b2414, b2415, b2416, b2417, b2418, b2419, b2420, b2421, b2422, b2423, b2424, b2425, b2426, b2427, b2428, b2429, b2430, b2431, b2432, b2433, b2434, b2435, b2436, b2437, b2438, b2439, b2440, b2441, b2442, b2443, b2444, b2445, b2446, b2447, b2448, b2449, b2450, b2451, b2452, b2453, b2454, b2455, b2456, b2457, b2458, b2459, b2460, b2461, b2462, b2463, b2464, b2465, b2466, b2467, b2468, b2469, b2470, b2471, b2472, b2473, b2474, b2475, b2476, b2477, b2478, b2479, b2480, b2481, b2482, b2483, b2484, b2485, b2486, b2487, b2488, b2489, b2490, b2491, b2492, b2493, b2494, b2495, b2496, b2497, b2498, b2499, + b2500, b2501, b2502, b2503, b2504, b2505, b2506, b2507, b2508, b2509, b2510, b2511, b2512, b2513, b2514, b2515, b2516, b2517, b2518, b2519, b2520, b2521, b2522, b2523, b2524, b2525, b2526, b2527, b2528, b2529, b2530, b2531, b2532, b2533, b2534, b2535, b2536, b2537, b2538, b2539, b2540, b2541, b2542, b2543, b2544, b2545, b2546, b2547, b2548, b2549, b2550, b2551, b2552, b2553, b2554, b2555, b2556, b2557, b2558, b2559, b2560, b2561, b2562, b2563, b2564, b2565, b2566, b2567, b2568, b2569, b2570, b2571, b2572, b2573, b2574, b2575, b2576, b2577, b2578, b2579, b2580, b2581, b2582, b2583, b2584, b2585, b2586, b2587, b2588, b2589, b2590, b2591, b2592, b2593, b2594, b2595, b2596, b2597, b2598, b2599, + b2600, b2601, b2602, b2603, b2604, b2605, b2606, b2607, b2608, b2609, b2610, b2611, b2612, b2613, b2614, b2615, b2616, b2617, b2618, b2619, b2620, b2621, b2622, b2623, b2624, b2625, b2626, b2627, b2628, b2629, b2630, b2631, b2632, b2633, b2634, b2635, b2636, b2637, b2638, b2639, b2640, b2641, b2642, b2643, b2644, b2645, b2646, b2647, b2648, b2649, b2650, b2651, b2652, b2653, b2654, b2655, b2656, b2657, b2658, b2659, b2660, b2661, b2662, b2663, b2664, b2665, b2666, b2667, b2668, b2669, b2670, b2671, b2672, b2673, b2674, b2675, b2676, b2677, b2678, b2679, b2680, b2681, b2682, b2683, b2684, b2685, b2686, b2687, b2688, b2689, b2690, b2691, b2692, b2693, b2694, b2695, b2696, b2697, b2698, b2699, + b2700, b2701, b2702, b2703, b2704, b2705, b2706, b2707, b2708, b2709, b2710, b2711, b2712, b2713, b2714, b2715, b2716, b2717, b2718, b2719, b2720, b2721, b2722, b2723, b2724, b2725, b2726, b2727, b2728, b2729, b2730, b2731, b2732, b2733, b2734, b2735, b2736, b2737, b2738, b2739, b2740, b2741, b2742, b2743, b2744, b2745, b2746, b2747, b2748, b2749, b2750, b2751, b2752, b2753, b2754, b2755, b2756, b2757, b2758, b2759, b2760, b2761, b2762, b2763, b2764, b2765, b2766, b2767, b2768, b2769, b2770, b2771, b2772, b2773, b2774, b2775, b2776, b2777, b2778, b2779, b2780, b2781, b2782, b2783, b2784, b2785, b2786, b2787, b2788, b2789, b2790, b2791, b2792, b2793, b2794, b2795, b2796, b2797, b2798, b2799, + b2800, b2801, b2802, b2803, b2804, b2805, b2806, b2807, b2808, b2809, b2810, b2811, b2812, b2813, b2814, b2815, b2816, b2817, b2818, b2819, b2820, b2821, b2822, b2823, b2824, b2825, b2826, b2827, b2828, b2829, b2830, b2831, b2832, b2833, b2834, b2835, b2836, b2837, b2838, b2839, b2840, b2841, b2842, b2843, b2844, b2845, b2846, b2847, b2848, b2849, b2850, b2851, b2852, b2853, b2854, b2855, b2856, b2857, b2858, b2859, b2860, b2861, b2862, b2863, b2864, b2865, b2866, b2867, b2868, b2869, b2870, b2871, b2872, b2873, b2874, b2875, b2876, b2877, b2878, b2879, b2880, b2881, b2882, b2883, b2884, b2885, b2886, b2887, b2888, b2889, b2890, b2891, b2892, b2893, b2894, b2895, b2896, b2897, b2898, b2899, + b2900, b2901, b2902, b2903, b2904, b2905, b2906, b2907, b2908, b2909, b2910, b2911, b2912, b2913, b2914, b2915, b2916, b2917, b2918, b2919, b2920, b2921, b2922, b2923, b2924, b2925, b2926, b2927, b2928, b2929, b2930, b2931, b2932, b2933, b2934, b2935, b2936, b2937, b2938, b2939, b2940, b2941, b2942, b2943, b2944, b2945, b2946, b2947, b2948, b2949, b2950, b2951, b2952, b2953, b2954, b2955, b2956, b2957, b2958, b2959, b2960, b2961, b2962, b2963, b2964, b2965, b2966, b2967, b2968, b2969, b2970, b2971, b2972, b2973, b2974, b2975, b2976, b2977, b2978, b2979, b2980, b2981, b2982, b2983, b2984, b2985, b2986, b2987, b2988, b2989, b2990, b2991, b2992, b2993, b2994, b2995, b2996, b2997, b2998, b2999, + b3000, b3001, b3002, b3003, b3004, b3005, b3006, b3007, b3008, b3009, b3010, b3011, b3012, b3013, b3014, b3015, b3016, b3017, b3018, b3019, b3020, b3021, b3022, b3023, b3024, b3025, b3026, b3027, b3028, b3029, b3030, b3031, b3032, b3033, b3034, b3035, b3036, b3037, b3038, b3039, b3040, b3041, b3042, b3043, b3044, b3045, b3046, b3047, b3048, b3049, b3050, b3051, b3052, b3053, b3054, b3055, b3056, b3057, b3058, b3059, b3060, b3061, b3062, b3063, b3064, b3065, b3066, b3067, b3068, b3069, b3070, b3071, b3072, b3073, b3074, b3075, b3076, b3077, b3078, b3079, b3080, b3081, b3082, b3083, b3084, b3085, b3086, b3087, b3088, b3089, b3090, b3091, b3092, b3093, b3094, b3095, b3096, b3097, b3098, b3099, + b3100, b3101, b3102, b3103, b3104, b3105, b3106, b3107, b3108, b3109, b3110, b3111, b3112, b3113, b3114, b3115, b3116, b3117, b3118, b3119, b3120, b3121, b3122, b3123, b3124, b3125, b3126, b3127, b3128, b3129, b3130, b3131, b3132, b3133, b3134, b3135, b3136, b3137, b3138, b3139, b3140, b3141, b3142, b3143, b3144, b3145, b3146, b3147, b3148, b3149, b3150, b3151, b3152, b3153, b3154, b3155, b3156, b3157, b3158, b3159, b3160, b3161, b3162, b3163, b3164, b3165, b3166, b3167, b3168, b3169, b3170, b3171, b3172, b3173, b3174, b3175, b3176, b3177, b3178, b3179, b3180, b3181, b3182, b3183, b3184, b3185, b3186, b3187, b3188, b3189, b3190, b3191, b3192, b3193, b3194, b3195, b3196, b3197, b3198, b3199, + b3200, b3201, b3202, b3203, b3204, b3205, b3206, b3207, b3208, b3209, b3210, b3211, b3212, b3213, b3214, b3215, b3216, b3217, b3218, b3219, b3220, b3221, b3222, b3223, b3224, b3225, b3226, b3227, b3228, b3229, b3230, b3231, b3232, b3233, b3234, b3235, b3236, b3237, b3238, b3239, b3240, b3241, b3242, b3243, b3244, b3245, b3246, b3247, b3248, b3249, b3250, b3251, b3252, b3253, b3254, b3255, b3256, b3257, b3258, b3259, b3260, b3261, b3262, b3263, b3264, b3265, b3266, b3267, b3268, b3269, b3270, b3271, b3272, b3273, b3274, b3275, b3276, b3277, b3278, b3279, b3280, b3281, b3282, b3283, b3284, b3285, b3286, b3287, b3288, b3289, b3290, b3291, b3292, b3293, b3294, b3295, b3296, b3297, b3298, b3299, + b3300, b3301, b3302, b3303, b3304, b3305, b3306, b3307, b3308, b3309, b3310, b3311, b3312, b3313, b3314, b3315, b3316, b3317, b3318, b3319, b3320, b3321, b3322, b3323, b3324, b3325, b3326, b3327, b3328, b3329, b3330, b3331, b3332, b3333, b3334, b3335, b3336, b3337, b3338, b3339, b3340, b3341, b3342, b3343, b3344, b3345, b3346, b3347, b3348, b3349, b3350, b3351, b3352, b3353, b3354, b3355, b3356, b3357, b3358, b3359, b3360, b3361, b3362, b3363, b3364, b3365, b3366, b3367, b3368, b3369, b3370, b3371, b3372, b3373, b3374, b3375, b3376, b3377, b3378, b3379, b3380, b3381, b3382, b3383, b3384, b3385, b3386, b3387, b3388, b3389, b3390, b3391, b3392, b3393, b3394, b3395, b3396, b3397, b3398, b3399, + b3400, b3401, b3402, b3403, b3404, b3405, b3406, b3407, b3408, b3409, b3410, b3411, b3412, b3413, b3414, b3415, b3416, b3417, b3418, b3419, b3420, b3421, b3422, b3423, b3424, b3425, b3426, b3427, b3428, b3429, b3430, b3431, b3432, b3433, b3434, b3435, b3436, b3437, b3438, b3439, b3440, b3441, b3442, b3443, b3444, b3445, b3446, b3447, b3448, b3449, b3450, b3451, b3452, b3453, b3454, b3455, b3456, b3457, b3458, b3459, b3460, b3461, b3462, b3463, b3464, b3465, b3466, b3467, b3468, b3469, b3470, b3471, b3472, b3473, b3474, b3475, b3476, b3477, b3478, b3479, b3480, b3481, b3482, b3483, b3484, b3485, b3486, b3487, b3488, b3489, b3490, b3491, b3492, b3493, b3494, b3495, b3496, b3497, b3498, b3499, + b3500, b3501, b3502, b3503, b3504, b3505, b3506, b3507, b3508, b3509, b3510, b3511, b3512, b3513, b3514, b3515, b3516, b3517, b3518, b3519, b3520, b3521, b3522, b3523, b3524, b3525, b3526, b3527, b3528, b3529, b3530, b3531, b3532, b3533, b3534, b3535, b3536, b3537, b3538, b3539, b3540, b3541, b3542, b3543, b3544, b3545, b3546, b3547, b3548, b3549, b3550, b3551, b3552, b3553, b3554, b3555, b3556, b3557, b3558, b3559, b3560, b3561, b3562, b3563, b3564, b3565, b3566, b3567, b3568, b3569, b3570, b3571, b3572, b3573, b3574, b3575, b3576, b3577, b3578, b3579, b3580, b3581, b3582, b3583, b3584, b3585, b3586, b3587, b3588, b3589, b3590, b3591, b3592, b3593, b3594, b3595, b3596, b3597, b3598, b3599, + b3600, b3601, b3602, b3603, b3604, b3605, b3606, b3607, b3608, b3609, b3610, b3611, b3612, b3613, b3614, b3615, b3616, b3617, b3618, b3619, b3620, b3621, b3622, b3623, b3624, b3625, b3626, b3627, b3628, b3629, b3630, b3631, b3632, b3633, b3634, b3635, b3636, b3637, b3638, b3639, b3640, b3641, b3642, b3643, b3644, b3645, b3646, b3647, b3648, b3649, b3650, b3651, b3652, b3653, b3654, b3655, b3656, b3657, b3658, b3659, b3660, b3661, b3662, b3663, b3664, b3665, b3666, b3667, b3668, b3669, b3670, b3671, b3672, b3673, b3674, b3675, b3676, b3677, b3678, b3679, b3680, b3681, b3682, b3683, b3684, b3685, b3686, b3687, b3688, b3689, b3690, b3691, b3692, b3693, b3694, b3695, b3696, b3697, b3698, b3699, + b3700, b3701, b3702, b3703, b3704, b3705, b3706, b3707, b3708, b3709, b3710, b3711, b3712, b3713, b3714, b3715, b3716, b3717, b3718, b3719, b3720, b3721, b3722, b3723, b3724, b3725, b3726, b3727, b3728, b3729, b3730, b3731, b3732, b3733, b3734, b3735, b3736, b3737, b3738, b3739, b3740, b3741, b3742, b3743, b3744, b3745, b3746, b3747, b3748, b3749, b3750, b3751, b3752, b3753, b3754, b3755, b3756, b3757, b3758, b3759, b3760, b3761, b3762, b3763, b3764, b3765, b3766, b3767, b3768, b3769, b3770, b3771, b3772, b3773, b3774, b3775, b3776, b3777, b3778, b3779, b3780, b3781, b3782, b3783, b3784, b3785, b3786, b3787, b3788, b3789, b3790, b3791, b3792, b3793, b3794, b3795, b3796, b3797, b3798, b3799, + b3800, b3801, b3802, b3803, b3804, b3805, b3806, b3807, b3808, b3809, b3810, b3811, b3812, b3813, b3814, b3815, b3816, b3817, b3818, b3819, b3820, b3821, b3822, b3823, b3824, b3825, b3826, b3827, b3828, b3829, b3830, b3831, b3832, b3833, b3834, b3835, b3836, b3837, b3838, b3839, b3840, b3841, b3842, b3843, b3844, b3845, b3846, b3847, b3848, b3849, b3850, b3851, b3852, b3853, b3854, b3855, b3856, b3857, b3858, b3859, b3860, b3861, b3862, b3863, b3864, b3865, b3866, b3867, b3868, b3869, b3870, b3871, b3872, b3873, b3874, b3875, b3876, b3877, b3878, b3879, b3880, b3881, b3882, b3883, b3884, b3885, b3886, b3887, b3888, b3889, b3890, b3891, b3892, b3893, b3894, b3895, b3896, b3897, b3898, b3899, + b3900, b3901, b3902, b3903, b3904, b3905, b3906, b3907, b3908, b3909, b3910, b3911, b3912, b3913, b3914, b3915, b3916, b3917, b3918, b3919, b3920, b3921, b3922, b3923, b3924, b3925, b3926, b3927, b3928, b3929, b3930, b3931, b3932, b3933, b3934, b3935, b3936, b3937, b3938, b3939, b3940, b3941, b3942, b3943, b3944, b3945, b3946, b3947, b3948, b3949, b3950, b3951, b3952, b3953, b3954, b3955, b3956, b3957, b3958, b3959, b3960, b3961, b3962, b3963, b3964, b3965, b3966, b3967, b3968, b3969, b3970, b3971, b3972, b3973, b3974, b3975, b3976, b3977, b3978, b3979, b3980, b3981, b3982, b3983, b3984, b3985, b3986, b3987, b3988, b3989, b3990, b3991, b3992, b3993, b3994, b3995, b3996, b3997, b3998, b3999, + b4000, b4001, b4002, b4003, b4004, b4005, b4006, b4007, b4008, b4009, b4010, b4011, b4012, b4013, b4014, b4015, b4016, b4017, b4018, b4019, b4020, b4021, b4022, b4023, b4024, b4025, b4026, b4027, b4028, b4029, b4030, b4031, b4032, b4033, b4034, b4035, b4036, b4037, b4038, b4039, b4040, b4041, b4042, b4043, b4044, b4045, b4046, b4047, b4048, b4049, b4050, b4051, b4052, b4053, b4054, b4055, b4056, b4057, b4058, b4059, b4060, b4061, b4062, b4063, b4064, b4065, b4066, b4067, b4068, b4069, b4070, b4071, b4072, b4073, b4074, b4075, b4076, b4077, b4078, b4079, b4080, b4081, b4082, b4083, b4084, b4085, b4086, b4087, b4088, b4089, b4090, b4091, b4092, b4093, b4094, b4095, b4096, b4097, b4098, b4099; + } + +} diff --git a/test/hotspot/jtreg/compiler/c2/TestUnalignedAccess.java b/test/hotspot/jtreg/compiler/c2/TestUnalignedAccess.java new file mode 100644 index 000000000000..d05dbad4a73b --- /dev/null +++ b/test/hotspot/jtreg/compiler/c2/TestUnalignedAccess.java @@ -0,0 +1,172 @@ +/* + * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, Arm Limited. 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 compiler.c2; + +import jdk.internal.misc.Unsafe; +import jdk.test.lib.Asserts; + +/** + * @test TestUnalignedAccess + * @summary AArch64: C2 compilation hits offset_ok_for_immed: assert "c2 compiler bug". + * @bug 8319690 + * @library /test/lib + * @modules java.base/jdk.internal.misc + * @run main/othervm compiler.c2.TestUnalignedAccess + * @run main/othervm -Xcomp -XX:-TieredCompilation -Xmx1g + * -XX:CompileCommand=compileonly,compiler.c2.TestUnalignedAccess*:: + * compiler.c2.TestUnalignedAccess + */ + +public class TestUnalignedAccess { + + public static final int LEN = 2040; + + static final Unsafe UNSAFE = Unsafe.getUnsafe(); + static void sink(int x) {} + + public static long lseed = 1; + public static int iseed = 2; + public static short sseed = 3; + public static byte bseed = 4; + public static long lres = lseed; + public static int ires = iseed; + public static short sres = sseed; + public static byte bres = bseed; + + public static class TestLong { + + private static final byte[] BYTES = new byte[LEN]; + private static final long rawdata = 0xbeef; + private static final long data; + + static { + sink(2); + // Signed immediate byte offset: range -256 to 255 + // Positive immediate byte offset: a multiple of 8 in the range 0 to 32760 + // Other immediate byte offsets can't be encoded in the instruction field. + + // 1030 can't be encoded as "base + offset" mode into the instruction field. + UNSAFE.putLongUnaligned(BYTES, 1030, rawdata); + lres += UNSAFE.getLongUnaligned(BYTES, 1030); + // 127 can be encoded into simm9 field. + UNSAFE.putLongUnaligned(BYTES, 127, lres); + lres += UNSAFE.getLongUnaligned(BYTES, 127); + // 1096 can be encoded into uimm12 field. + UNSAFE.putLongUnaligned(BYTES, 1096, lres); + data = UNSAFE.getLongUnaligned(BYTES, 1096); + } + + } + + public static class TestInt { + + private static final byte[] BYTES = new byte[LEN]; + private static final int rawdata = 0xbeef; + private static final int data; + static { + sink(2); + // Signed immediate byte offset: range -256 to 255 + // Positive immediate byte offset, a multiple of 4 in the range 0 to 16380 + // Other immediate byte offsets can't be encoded in the instruction field. + + // 274 can't be encoded as "base + offset" mode into the instruction field. + UNSAFE.putIntUnaligned(BYTES, 274, rawdata); + ires += UNSAFE.getIntUnaligned(BYTES, 274); + // 255 can be encoded into simm9 field. + UNSAFE.putIntUnaligned(BYTES, 255, ires); + ires += UNSAFE.getIntUnaligned(BYTES, 255); + // 528 can be encoded into uimm12 field. + UNSAFE.putIntUnaligned(BYTES, 528, ires); + data = UNSAFE.getIntUnaligned(BYTES, 528); + } + + } + + public static class TestShort { + + private static final byte[] BYTES = new byte[LEN]; + private static final short rawdata = (short)0xbeef; + private static final short data; + static { + sink(2); + // Signed immediate byte offset: range -256 to 255 + // Positive immediate byte offset: a multiple of 2 in the range 0 to 8190 + // Other immediate byte offsets can't be encoded in the instruction field. + + // 257 can't be encoded as "base + offset" mode into the instruction field. + UNSAFE.putShortUnaligned(BYTES, 257, rawdata); + sres = (short) (sres + UNSAFE.getShortUnaligned(BYTES, 257)); + // 253 can be encoded into simm9 field. + UNSAFE.putShortUnaligned(BYTES, 253, sres); + sres = (short) (sres + UNSAFE.getShortUnaligned(BYTES, 253)); + // 272 can be encoded into uimm12 field. + UNSAFE.putShortUnaligned(BYTES, 272, sres); + data = UNSAFE.getShortUnaligned(BYTES, 272); + } + + } + + public static class TestByte { + + private static final byte[] BYTES = new byte[LEN]; + private static final byte rawdata = (byte)0x3f; + private static final byte data; + static { + sink(2); + // Signed immediate byte offset: range -256 to 255 + // Positive immediate byte offset: range 0 to 4095 + // Other immediate byte offsets can't be encoded in the instruction field. + + // 272 can be encoded into simm9 field. + UNSAFE.putByte(BYTES, 272, rawdata); + bres = (byte) (bres + UNSAFE.getByte(BYTES, 272)); + // 53 can be encoded into simm9 field. + UNSAFE.putByte(BYTES, 53, bres); + bres = (byte) (bres + UNSAFE.getByte(BYTES, 53)); + // 1027 can be encoded into uimm12 field. + UNSAFE.putByte(BYTES, 1027, bres); + data = UNSAFE.getByte(BYTES, 1027); + } + + } + + static void test() { + TestLong ta = new TestLong(); + Asserts.assertEquals(ta.data, (ta.rawdata + lseed) * 2, "putUnaligned long failed!"); + + TestInt tb = new TestInt(); + Asserts.assertEquals(tb.data, (tb.rawdata + iseed) * 2, "putUnaligned int failed!"); + + TestShort tc = new TestShort(); + Asserts.assertEquals(tc.data, (short) (((short) (tc.rawdata + sseed)) * 2), "putUnaligned short failed!"); + + TestByte td = new TestByte(); + Asserts.assertEquals(td.data, (byte) (((byte) (td.rawdata + bseed)) * 2), "put byte failed!"); + } + + public static void main(String[] strArr) { + test(); + } +} diff --git a/test/hotspot/jtreg/compiler/c2/irTests/TestPadding.java b/test/hotspot/jtreg/compiler/c2/irTests/TestPadding.java new file mode 100644 index 000000000000..25225e86b284 --- /dev/null +++ b/test/hotspot/jtreg/compiler/c2/irTests/TestPadding.java @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2023, 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 compiler.c2.irTests; + +import compiler.lib.ir_framework.*; + +/* + * @test + * @bug 8309978 + * @summary [x64] Fix useless padding + * @library /test/lib / + * @requires vm.compiler2.enabled + * @requires (os.simpleArch == "x64") + * @run driver compiler.c2.irTests.TestPadding + */ + +public class TestPadding { + public static void main(String[] args) { + TestFramework.runWithFlags("-XX:+IntelJccErratumMitigation"); + } + + @Run(test = "test") + public static void test_runner() { + test(42); + tpf.b1++; // to take both branches in test() + } + + @Test + @IR(counts = { IRNode.NOP, "1" }) + static int test(int i) { + TestPadding tp = tpf; + if (tp.b1 > 42) { // Big 'cmpb' instruction at offset 0x30 + tp.i1 = i; + } + return i; + } + + static TestPadding t1; + static TestPadding t2; + static TestPadding t3; + static TestPadding t4; + + static TestPadding tpf = new TestPadding(); // Static field offset > 128 + + int i1; + + long l1; + long l2; + long l3; + long l4; + long l5; + long l6; + long l7; + long l8; + long l9; + long l10; + long l11; + long l12; + long l13; + long l14; + long l15; + long l16; + + byte b1 = 1; // Field offset > 128 +} diff --git a/test/hotspot/jtreg/compiler/ciReplay/TestNullStaticField.java b/test/hotspot/jtreg/compiler/ciReplay/TestNullStaticField.java new file mode 100644 index 000000000000..47a78ad5e446 --- /dev/null +++ b/test/hotspot/jtreg/compiler/ciReplay/TestNullStaticField.java @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2024, 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 + * @bug 8333805 + * @library / /test/lib + * @summary Replaying compilation with null static final fields results in a crash + * @requires vm.flightRecorder != true & vm.compMode != "Xint" & vm.compMode != "Xcomp" & vm.debug == true & vm.compiler2.enabled + * @modules java.base/jdk.internal.misc + * @build jdk.test.whitebox.WhiteBox + * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI + * compiler.ciReplay.TestNullStaticField + */ + +package compiler.ciReplay; + +public class TestNullStaticField extends DumpReplayBase { + + public static void main(String[] args) { + new TestNullStaticField().runTest(TIERED_DISABLED_VM_OPTION); + } + + @Override + public void testAction() { + positiveTest(TIERED_DISABLED_VM_OPTION, "-XX:+ReplayIgnoreInitErrors"); + } + + @Override + public String getTestClass() { + return TestClassNullStaticField.class.getName(); + } + +} + +class TestClassNullStaticField { + + static final Object[] staticNullArrayField = null; + static final Object[][] staticNullMultiArrayField = null; + static final Object staticNullObjectField = null; + static final String staticNullStringField = null; + static final int[] staticNullIntArrayField = null; + static final Object[] staticNotNullArrayField = new A[10]; + static final Object[][] staticNotNullMultiArrayField = new A[10][10]; + static final Object staticNotNullObjectField = new A(); + static final String staticNotNullStringField = "Not null"; + static final int[] staticNotNullIntArrayField = new int[10]; + + public static void main(String[] args) { + for (int i = 0; i < 20_000; i++) { + test(); + } + } + public static void test() { + + } + + private static class A { + } +} + diff --git a/test/hotspot/jtreg/compiler/compilercontrol/parser/DirectiveParserTest.java b/test/hotspot/jtreg/compiler/compilercontrol/parser/DirectiveParserTest.java index b230b1d72ab7..5401714b0f4d 100644 --- a/test/hotspot/jtreg/compiler/compilercontrol/parser/DirectiveParserTest.java +++ b/test/hotspot/jtreg/compiler/compilercontrol/parser/DirectiveParserTest.java @@ -33,6 +33,9 @@ package compiler.compilercontrol.parser; +import java.io.FileNotFoundException; +import java.io.PrintStream; + import compiler.compilercontrol.share.JSONFile; import jdk.test.lib.Asserts; import jdk.test.lib.process.OutputAnalyzer; @@ -52,6 +55,7 @@ public static void main(String[] args) { emptyFile(); noFile(); directory(); + lineCommentTest(); } private static void simpleTest() { @@ -145,4 +149,20 @@ private static void directory() { Asserts.assertNE(output.getExitValue(), 0, ERROR_MSG + "directory as " + "a name"); } + + private static void lineCommentTest() { + String fileName = "lineComment.json"; + try { + PrintStream out = new PrintStream(fileName); + out.println("[{"); + out.println(" match: \"*::*\","); + out.println(" c2: { Exclude: true } // c1 only for startup"); + out.println("}]"); + out.close(); + } catch (FileNotFoundException e) { + throw new Error("TESTBUG: can't open/create file " + fileName, e); + } + OutputAnalyzer output = HugeDirectiveUtil.execute(fileName); + output.shouldHaveExitValue(0); + } } diff --git a/test/hotspot/jtreg/compiler/escapeAnalysis/TestFindInstMemRecursion.java b/test/hotspot/jtreg/compiler/escapeAnalysis/TestFindInstMemRecursion.java new file mode 100644 index 000000000000..90a5ff92cd3a --- /dev/null +++ b/test/hotspot/jtreg/compiler/escapeAnalysis/TestFindInstMemRecursion.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2024, 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 8324345 + * @summary Ensure that ConnectionGraph::find_inst_mem does not cause a stack + * overflow. + * + * @run main/othervm -Xcomp -XX:CompileThreshold=10 -XX:-TieredCompilation + * -XX:CompileCommand=CompileOnly,javax.swing.plaf.basic.BasicLookAndFeel::initComponentDefaults + * -XX:CompileCommand=MemLimit,*.*,0 + * compiler.escapeAnalysis.TestFindInstMemRecursion + * + */ + +package compiler.escapeAnalysis; + +import javax.swing.*; +import javax.swing.plaf.metal.*; + +public class TestFindInstMemRecursion { + public static void main(String[] args) throws Exception { + LookAndFeel lookAndFeel = new MetalLookAndFeel(); + for (int i = 0; i < 20; ++i) { + UIManager.setLookAndFeel(lookAndFeel); + } + } +} diff --git a/test/hotspot/jtreg/compiler/floatingpoint/DmodTest.java b/test/hotspot/jtreg/compiler/floatingpoint/DmodTest.java new file mode 100644 index 000000000000..4f386a42de43 --- /dev/null +++ b/test/hotspot/jtreg/compiler/floatingpoint/DmodTest.java @@ -0,0 +1,131 @@ +/* + * Copyright (c) 2023, Intel Corporation. All rights reserved. + * Intel Math Library (LIBM) Source Code + * + * 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 8308966 + * @summary Add intrinsic for float/double modulo for x86 AVX2 and AVX512 + * @run main compiler.floatingpoint.DmodTest + */ + + package compiler.floatingpoint; + + import java.lang.Double; + + public class DmodTest { + static double [] op1 = { 1.2345d, 0.0d, -0.0d, 1.0d/0.0d, -1.0d/0.0d, 0.0d/0.0d }; + static double [] op2 = { 1.2345d, 0.0d, -0.0d, 1.0d/0.0d, -1.0d/0.0d, 0.0d/0.0d }; + static double [][] res = { + { + 0.0d, + Double.NaN, + Double.NaN, + 1.2345d, + 1.2345d, + Double.NaN, + }, + { + 0.0d, + Double.NaN, + Double.NaN, + 0.0d, + 0.0d, + Double.NaN, + }, + { + -0.0d, + Double.NaN, + Double.NaN, + -0.0d, + -0.0d, + Double.NaN, + }, + { + Double.NaN, + Double.NaN, + Double.NaN, + Double.NaN, + Double.NaN, + Double.NaN, + }, + { + Double.NaN, + Double.NaN, + Double.NaN, + Double.NaN, + Double.NaN, + Double.NaN, + }, + { + Double.NaN, + Double.NaN, + Double.NaN, + Double.NaN, + Double.NaN, + Double.NaN, + }, + }; + public static void main(String[] args) throws Exception { + double f1, f2, f3; + boolean failure = false; + boolean print_failure = false; + for (int i = 0; i < 100_000; i++) { + for (int j = 0; j < op1.length; j++) { + for (int k = 0; k < op2.length; k++) { + f1 = op1[j]; + f2 = op2[k]; + f3 = f1 % f2; + + if (Double.isNaN(res[j][k])) { + if (!Double.isNaN(f3)) { + failure = true; + print_failure = true; + } + } else if (Double.isNaN(f3)) { + failure = true; + print_failure = true; + } else if (f3 != res[j][k]) { + failure = true; + print_failure = true; + } + + if (print_failure) { + System.out.println( "Actual " + f1 + " % " + f2 + " = " + f3); + System.out.println( "Expected " + f1 + " % " + f2 + " = " + res[j][k]); + print_failure = false; + } + } + } + } + + if (failure) { + throw new RuntimeException("Test Failed"); + } else { + System.out.println("Test passed."); + } + } +} + diff --git a/test/hotspot/jtreg/compiler/floatingpoint/FmodTest.java b/test/hotspot/jtreg/compiler/floatingpoint/FmodTest.java new file mode 100644 index 000000000000..859fd34650a5 --- /dev/null +++ b/test/hotspot/jtreg/compiler/floatingpoint/FmodTest.java @@ -0,0 +1,130 @@ +/* + * Copyright (c) 2023, Intel Corporation. All rights reserved. + * Intel Math Library (LIBM) Source Code + * + * 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 8308966 + * @summary Add intrinsic for float/double modulo for x86 AVX2 and AVX512 + * @run main compiler.floatingpoint.FmodTest + */ + + package compiler.floatingpoint; + + import java.lang.Float; + + public class FmodTest { + static float [] op1 = { 1.2345f, 0.0f, -0.0f, 1.0f/0.0f, -1.0f/0.0f, 0.0f/0.0f }; + static float [] op2 = { 1.2345f, 0.0f, -0.0f, 1.0f/0.0f, -1.0f/0.0f, 0.0f/0.0f }; + static float [][] res = { + { + 0.0f, + Float.NaN, + Float.NaN, + 1.2345f, + 1.2345f, + Float.NaN, + }, + { + 0.0f, + Float.NaN, + Float.NaN, + 0.0f, + 0.0f, + Float.NaN, + }, + { + -0.0f, + Float.NaN, + Float.NaN, + -0.0f, + -0.0f, + Float.NaN, + }, + { + Float.NaN, + Float.NaN, + Float.NaN, + Float.NaN, + Float.NaN, + Float.NaN, + }, + { + Float.NaN, + Float.NaN, + Float.NaN, + Float.NaN, + Float.NaN, + Float.NaN, + }, + { + Float.NaN, + Float.NaN, + Float.NaN, + Float.NaN, + Float.NaN, + Float.NaN, + }, + }; + public static void main(String[] args) throws Exception { + float f1, f2, f3; + boolean failure = false; + boolean print_failure = false; + for (int i = 0; i < 100_000; i++) { + for (int j = 0; j < op1.length; j++) { + for (int k = 0; k < op2.length; k++) { + f1 = op1[j]; + f2 = op2[k]; + f3 = f1 % f2; + + if (Float.isNaN(res[j][k])) { + if (!Float.isNaN(f3)) { + failure = true; + print_failure = true; + } + } else if (Float.isNaN(f3)) { + failure = true; + print_failure = true; + } else if (f3 != res[j][k]) { + failure = true; + print_failure = true; + } + + if (print_failure) { + System.out.println( "Actual " + f1 + " % " + f2 + " = " + f3); + System.out.println( "Expected " + f1 + " % " + f2 + " = " + res[j][k]); + print_failure = false; + } + } + } + } + + if (failure) { + throw new RuntimeException("Test Failed"); + } else { + System.out.println("Test passed."); + } + } + } diff --git a/test/hotspot/jtreg/compiler/intrinsics/float16/Binary16Conversion.java b/test/hotspot/jtreg/compiler/intrinsics/float16/Binary16Conversion.java index 0541121c127c..eed42c714b05 100644 --- a/test/hotspot/jtreg/compiler/intrinsics/float16/Binary16Conversion.java +++ b/test/hotspot/jtreg/compiler/intrinsics/float16/Binary16Conversion.java @@ -26,6 +26,7 @@ * @bug 8289551 8302976 * @summary Verify conversion between float and the binary16 format * @requires (vm.cpu.features ~= ".*avx512vl.*" | vm.cpu.features ~= ".*f16c.*") | os.arch=="aarch64" + * | ((os.arch == "ppc64" | os.arch == "ppc64le") & vm.cpu.features ~= ".*darn.*") * @requires vm.compiler1.enabled & vm.compiler2.enabled * @requires vm.compMode != "Xcomp" * @comment default run diff --git a/test/hotspot/jtreg/compiler/intrinsics/float16/Binary16ConversionNaN.java b/test/hotspot/jtreg/compiler/intrinsics/float16/Binary16ConversionNaN.java index 38060dfb5043..1051600ab760 100644 --- a/test/hotspot/jtreg/compiler/intrinsics/float16/Binary16ConversionNaN.java +++ b/test/hotspot/jtreg/compiler/intrinsics/float16/Binary16ConversionNaN.java @@ -26,6 +26,7 @@ * @bug 8289551 8302976 * @summary Verify NaN sign and significand bits are preserved across conversions * @requires (vm.cpu.features ~= ".*avx512vl.*" | vm.cpu.features ~= ".*f16c.*") | os.arch=="aarch64" + * | ((os.arch == "ppc64" | os.arch == "ppc64le") & vm.cpu.features ~= ".*darn.*") * @requires vm.compiler1.enabled & vm.compiler2.enabled * @requires vm.compMode != "Xcomp" * @library /test/lib / diff --git a/test/hotspot/jtreg/compiler/intrinsics/float16/TestAllFloat16ToFloat.java b/test/hotspot/jtreg/compiler/intrinsics/float16/TestAllFloat16ToFloat.java index 492901f0046f..5352d20c5195 100644 --- a/test/hotspot/jtreg/compiler/intrinsics/float16/TestAllFloat16ToFloat.java +++ b/test/hotspot/jtreg/compiler/intrinsics/float16/TestAllFloat16ToFloat.java @@ -26,6 +26,7 @@ * @bug 8302976 * @summary Verify conversion between float and the binary16 format * @requires (vm.cpu.features ~= ".*avx512vl.*" | vm.cpu.features ~= ".*f16c.*") | os.arch == "aarch64" + * | ((os.arch == "ppc64" | os.arch == "ppc64le") & vm.cpu.features ~= ".*darn.*") * @requires vm.compiler1.enabled & vm.compiler2.enabled * @requires vm.compMode != "Xcomp" * @comment default run: diff --git a/test/hotspot/jtreg/compiler/intrinsics/float16/TestConstFloat16ToFloat.java b/test/hotspot/jtreg/compiler/intrinsics/float16/TestConstFloat16ToFloat.java index b4ba578c9f26..c8a03cade5b3 100644 --- a/test/hotspot/jtreg/compiler/intrinsics/float16/TestConstFloat16ToFloat.java +++ b/test/hotspot/jtreg/compiler/intrinsics/float16/TestConstFloat16ToFloat.java @@ -26,6 +26,7 @@ * @bug 8302976 * @summary Verify conversion cons between float and the binary16 format * @requires (vm.cpu.features ~= ".*avx512vl.*" | vm.cpu.features ~= ".*f16c.*") | os.arch=="aarch64" + * | ((os.arch == "ppc64" | os.arch == "ppc64le") & vm.cpu.features ~= ".*darn.*") * @requires vm.compiler1.enabled & vm.compiler2.enabled * @requires vm.compMode != "Xcomp" * @comment default run: diff --git a/test/hotspot/jtreg/compiler/intrinsics/string/TestCopyValueOf.java b/test/hotspot/jtreg/compiler/intrinsics/string/TestCopyValueOf.java index b466b4f7b194..a44624cbfdac 100644 --- a/test/hotspot/jtreg/compiler/intrinsics/string/TestCopyValueOf.java +++ b/test/hotspot/jtreg/compiler/intrinsics/string/TestCopyValueOf.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/hotspot/jtreg/compiler/intrinsics/string/TestCountPositives.java b/test/hotspot/jtreg/compiler/intrinsics/string/TestCountPositives.java index afc308c37dd7..76ef47661592 100644 --- a/test/hotspot/jtreg/compiler/intrinsics/string/TestCountPositives.java +++ b/test/hotspot/jtreg/compiler/intrinsics/string/TestCountPositives.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,88 +21,121 @@ * questions. */ -package compiler.intrinsics.string; - /* * @test - * @bug 8999999 + * @bug 8281146 * @summary Validates StringCoding.countPositives intrinsic with a small range of tests. + * @key randomness * @library /compiler/patches + * @library /test/lib * * @build java.base/java.lang.Helper * @run main compiler.intrinsics.string.TestCountPositives */ +/* + * @test + * @bug 8281146 8318509 + * @summary Validates StringCoding.countPositives intrinsic for AVX3 works with and without + * AVX3Threshold=0 + * @key randomness + * @library /compiler/patches + * @library /test/lib + * + * @build java.base/java.lang.Helper + * @requires vm.cpu.features ~= ".*avx512.*" + * @run main/othervm/timeout=1200 -XX:UseAVX=3 compiler.intrinsics.string.TestCountPositives + * @run main/othervm/timeout=1200 -XX:UseAVX=3 -XX:+UnlockDiagnosticVMOptions -XX:AVX3Threshold=0 compiler.intrinsics.string.TestCountPositives + */ +/** + * This test was derived from compiler.intrinsics.string.TestHasNegatives + */ +package compiler.intrinsics.string; + +import java.lang.Helper; +import java.util.Random; +import java.util.stream.IntStream; + +import jdk.test.lib.Utils; public class TestCountPositives { - private static byte[] tBa = new byte[4096 + 16]; + private static byte[] bytes = new byte[4096 + 32]; + + private static final Random RANDOM = Utils.getRandomInstance(); /** * Completely initialize the test array, preparing it for tests of the * StringCoding.hasNegatives method with a given array segment offset, - * length, and number of negative bytes. + * length, and number of negative bytes. The lowest index that will be + * negative is marked by negOffset */ - public static void initialize(int off, int len, int neg) { - assert (len + off <= tBa.length); + public static void initialize(int off, int len, int neg, int negOffset) { + assert (len + off <= bytes.length); // insert "canary" (negative) values before offset for (int i = 0; i < off; ++i) { - tBa[i] = (byte) (((i + 15) & 0x7F) | 0x80); + bytes[i] = (byte) (((i + 15) & 0x7F) | 0x80); } // fill the array segment for (int i = off; i < len + off; ++i) { - tBa[i] = (byte) (((i - off + 15) & 0x7F)); + bytes[i] = (byte) (((i - off + 15) & 0x7F)); } if (neg != 0) { // modify a number (neg) disparate array bytes inside // segment to be negative. - int div = (neg > 1) ? (len - 1) / (neg - 1) : 0; - int idx; - for (int i = 0; i < neg; ++i) { - idx = off + (len - 1) - div * i; - tBa[idx] = (byte) (0x80 | tBa[idx]); + for (int i = 0; i < neg; i++) { + int idx = off + RANDOM.nextInt(len - negOffset) + negOffset; + bytes[idx] = (byte) (0x80 | bytes[idx]); } } // insert "canary" negative values after array segment - for (int i = len + off; i < tBa.length; ++i) { - tBa[i] = (byte) (((i + 15) & 0x7F) | 0x80); + for (int i = len + off; i < bytes.length; ++i) { + bytes[i] = (byte) (((i + 15) & 0x7F) | 0x80); } } - /** Sizes of array segments to test. */ - private static int sizes[] = { 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 13, 17, 19, 23, 37, 61, 131, - 4099 }; - /** * Test different array segment sizes, offsets, and number of negative * bytes. */ public static void test_countPositives() throws Exception { - int len, off; - int ng; + for (int off = 0; off < 16; off++) { // starting offset of array segment + // Test all array segment sizes 1-63 + for (int len = 1; len < 64; len++) { + test_countPositives(off, len, 0, 0); + test_countPositives(off, len, 1, 0); + test_countPositives(off, len, RANDOM.nextInt(30) + 2, 0); + } + // Test a random selection of sizes between 64 and 4099, inclusive + for (int i = 0; i < 20; i++) { + int len = 64 + RANDOM.nextInt(4100 - 64); + test_countPositives(off, len, 0, 0); + test_countPositives(off, len, 1, 0); + test_countPositives(off, len, RANDOM.nextInt(len) + 2, 0); + } + for (int len : new int[] { 128, 2048 }) { + // test with negatives only in a 1-63 byte tail + int tail = RANDOM.nextInt(63) + 1; + int ng = RANDOM.nextInt(tail) + 1; + test_countPositives(off, len + tail, ng, len); + } + } + } - for (ng = 0; ng < 57; ++ng) { // number of negatives in array segment - for (off = 0; off < 8; ++off) { // starting offset of array segment - for (int i = 0; i < sizes.length; ++i) { // array segment size - // choice - len = sizes[i]; - if (len + off > tBa.length) - continue; - initialize(off, len, ng); - int calculated = Helper.StringCodingCountPositives(tBa, off, len); - int expected = countPositives(tBa, off, len); - if (calculated != expected) { - if (expected != len && calculated >= 0 && calculated < expected) { - // allow intrinsics to return early with a lower value, - // but only if we're not expecting the full length (no - // negative bytes) - continue; - } - throw new Exception("Failed test countPositives " + "offset: " + off + " " - + "length: " + len + " " + "return: " + calculated + " expected: " + expected + " negatives: " - + ng); - } - } + private static void test_countPositives(int off, int len, int ng, int ngOffset) throws Exception { + assert (len + off < bytes.length); + initialize(off, len, ng, ngOffset); + int calculated = Helper.StringCodingCountPositives(bytes, off, len); + int expected = countPositives(bytes, off, len); + if (calculated != expected) { + if (expected != len && ng >= 0 && calculated >= 0 && calculated < expected) { + // allow intrinsics to return early with a lower value, + // but only if we're not expecting the full length (no + // negative bytes) + return; } + throw new Exception("Failed test countPositives " + "offset: " + off + " " + + "length: " + len + " " + "return: " + calculated + " expected: " + expected + " negatives: " + + ng + " offset: " + ngOffset); } } diff --git a/test/hotspot/jtreg/compiler/intrinsics/string/TestHasNegatives.java b/test/hotspot/jtreg/compiler/intrinsics/string/TestHasNegatives.java index d73ea3f0139d..6edf2dc2e567 100644 --- a/test/hotspot/jtreg/compiler/intrinsics/string/TestHasNegatives.java +++ b/test/hotspot/jtreg/compiler/intrinsics/string/TestHasNegatives.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,20 +26,39 @@ * @bug 8054307 * @summary Validates StringCoding.hasNegatives intrinsic with a small range of tests. * @library /compiler/patches + * @library /test/lib * * @build java.base/java.lang.Helper * @run main compiler.intrinsics.string.TestHasNegatives */ +/* + * @test + * @bug 8054307 8318509 + * @summary Validates StringCoding.hasNegatives intrinsic for AVX3 works with and without + * AVX3Threshold=0 + * @key randomness + * @library /compiler/patches + * @library /test/lib + * + * @build java.base/java.lang.Helper + * @requires vm.cpu.features ~= ".*avx512.*" + * @run main/othervm/timeout=1200 -XX:UseAVX=3 compiler.intrinsics.string.TestHasNegatives + * @run main/othervm/timeout=1200 -XX:UseAVX=3 -XX:+UnlockDiagnosticVMOptions -XX:AVX3Threshold=0 compiler.intrinsics.string.TestHasNegatives + */ package compiler.intrinsics.string; -/* - * @summary Validates StringCoding.hasNegatives intrinsic with a small - * range of tests. - */ +import java.lang.Helper; +import java.util.Random; +import java.util.stream.IntStream; + +import jdk.test.lib.Utils; + public class TestHasNegatives { - private static byte[] tBa = new byte[4096 + 16]; + private static byte[] bytes = new byte[4096 + 32]; + + private static final Random RANDOM = Utils.getRandomInstance(); /** * Completely initialize the test array, preparing it for tests of the @@ -47,60 +66,60 @@ public class TestHasNegatives { * length, and number of negative bytes. */ public static void initialize(int off, int len, int neg) { - assert (len + off <= tBa.length); + assert (len + off <= bytes.length); // insert "canary" (negative) values before offset for (int i = 0; i < off; ++i) { - tBa[i] = (byte) (((i + 15) & 0x7F) | 0x80); + bytes[i] = (byte) (((i + 15) & 0x7F) | 0x80); } // fill the array segment for (int i = off; i < len + off; ++i) { - tBa[i] = (byte) (((i - off + 15) & 0x7F)); + bytes[i] = (byte) (((i - off + 15) & 0x7F)); } if (neg != 0) { // modify a number (neg) disparate array bytes inside // segment to be negative. - int div = (neg > 1) ? (len - 1) / (neg - 1) : 0; - int idx; - for (int i = 0; i < neg; ++i) { - idx = off + (len - 1) - div * i; - tBa[idx] = (byte) (0x80 | tBa[idx]); + for (int i = 0; i < neg; i++) { + int idx = off + RANDOM.nextInt(len); + bytes[idx] = (byte) (0x80 | bytes[idx]); } } // insert "canary" negative values after array segment - for (int i = len + off; i < tBa.length; ++i) { - tBa[i] = (byte) (((i + 15) & 0x7F) | 0x80); + for (int i = len + off; i < bytes.length; ++i) { + bytes[i] = (byte) (((i + 15) & 0x7F) | 0x80); } } - /** Sizes of array segments to test. */ - private static int sizes[] = { 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 13, 17, 19, 23, 37, 61, 131, - 4099 }; - /** * Test different array segment sizes, offsets, and number of negative * bytes. */ public static void test_hasNegatives() throws Exception { - int len, off; - int ng; - boolean r; - - for (ng = 0; ng < 57; ++ng) { // number of negatives in array segment - for (off = 0; off < 8; ++off) { // starting offset of array segment - for (int i = 0; i < sizes.length; ++i) { // array segment size - // choice - len = sizes[i]; - if (len + off > tBa.length) - continue; - initialize(off, len, ng); - r = Helper.StringCodingHasNegatives(tBa, off, len); - if (r ^ ((ng == 0) ? false : true)) { - throw new Exception("Failed test hasNegatives " + "offset: " + off + " " - + "length: " + len + " " + "return: " + r + " " + "negatives: " - + ng); - } - } + for (int off = 0; off < 16; off++) { // starting offset of array segment + // Test all array segment sizes 1-63 + for (int len = 1; len < 64; len++) { + test_hasNegatives(off, len, 0); + test_hasNegatives(off, len, 1); + test_hasNegatives(off, len, RANDOM.nextInt(30) + 2); } + // Test a random selection of sizes between 64 and 4099, inclusive + for (int i = 0; i < 20; i++) { + int len = 64 + RANDOM.nextInt(4100 - 64); + test_hasNegatives(off, len, 0); + test_hasNegatives(off, len, 1); + test_hasNegatives(off, len, RANDOM.nextInt(len) + 2); + } + } + } + + private static void test_hasNegatives(int off, int len, int maxNegatives) throws Exception { + assert (len + off < bytes.length); + initialize(off, len, maxNegatives); + boolean expected = (maxNegatives > 0); + boolean actual = Helper.StringCodingHasNegatives(bytes, off, len); + if (actual != expected) { + throw new Exception("Failed test hasNegatives " + "offset: " + off + " " + + "length: " + len + " " + "return: " + actual + " " + "negatives: " + + maxNegatives); } } diff --git a/test/hotspot/jtreg/compiler/intrinsics/string/TestStringIndexOfCharIntrinsics.java b/test/hotspot/jtreg/compiler/intrinsics/string/TestStringIndexOfCharIntrinsics.java index a02b49181408..23a10c77ee4d 100644 --- a/test/hotspot/jtreg/compiler/intrinsics/string/TestStringIndexOfCharIntrinsics.java +++ b/test/hotspot/jtreg/compiler/intrinsics/string/TestStringIndexOfCharIntrinsics.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/hotspot/jtreg/compiler/intrinsics/string/TestStringIntrinsics.java b/test/hotspot/jtreg/compiler/intrinsics/string/TestStringIntrinsics.java index 659840293975..062866d657f9 100644 --- a/test/hotspot/jtreg/compiler/intrinsics/string/TestStringIntrinsics.java +++ b/test/hotspot/jtreg/compiler/intrinsics/string/TestStringIntrinsics.java @@ -155,6 +155,7 @@ private void checkIntrinsics(Operation op, Method m, String latin1, String utf16 char cL = latin1.charAt(indexL); char cU = utf16.charAt(indexU); invokeAndCheck(m, cL - cU, latin1, latin1.replace(cL, cU)); + invokeAndCheck(m, cU - cL, latin1.replace(cL, cU), latin1); invokeAndCheck(m, cU - cL, utf16, utf16.replace(cU, cL)); // Different lengths diff --git a/test/hotspot/jtreg/compiler/jsr292/MHDeoptTest.java b/test/hotspot/jtreg/compiler/jsr292/MHDeoptTest.java new file mode 100644 index 000000000000..61dd330cfdd7 --- /dev/null +++ b/test/hotspot/jtreg/compiler/jsr292/MHDeoptTest.java @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2025, 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 compiler.jsr292; + +import java.lang.invoke.MethodHandle; +import java.lang.invoke.MethodHandles; +import java.lang.invoke.MethodHandles.Lookup; +import java.lang.invoke.MethodType; +import java.lang.reflect.Method; + +/* + * @test + * @bug 8336042 + * @library /test/lib / + * + * @run main/bootclasspath/othervm -Xbatch -XX:-TieredCompilation compiler.jsr292.MHDeoptTest + * + */ +public class MHDeoptTest { + + static int xx = 0; + + public static void main(String[] args) throws Throwable { + MethodHandle mh1 = MethodHandles.lookup().findStatic(MHDeoptTest.class, "body1", MethodType.methodType(int.class)); + MethodHandle mh2 = MethodHandles.lookup().findStatic(MHDeoptTest.class, "body2", MethodType.methodType(int.class)); + MethodHandle[] arr = new MethodHandle[] {mh2, mh1}; + + for (MethodHandle mh : arr) { + for (int i = 1; i < 50_000; i++) { + xx = i; + mainLink(mh); + } + } + + } + + static int mainLink(MethodHandle mh) throws Throwable { + return (int)mh.invokeExact(); + } + + static int cnt = 1000; + + static int body1() { + int limit = 0x7fff; + // uncommon trap + if (xx == limit) { + // OSR + for (int i = 0; i < 50_000; i++) { + } + ++cnt; + ++xx; + } + if (xx == limit + 1) { + return cnt + 1; + } + return cnt; + } + + static int body2() { + int limit = 0x7fff; + int dummy = 0; + // uncommon trap + if (xx == limit) { + // OSR + for (int i = 0; i < 50_000; i++) { + } + ++cnt; + ++xx; + } + if (xx == limit + 1) { + return cnt + 1; + } + return cnt; + } + +} diff --git a/test/hotspot/jtreg/compiler/lib/compile_framework/ClassLoaderBuilder.java b/test/hotspot/jtreg/compiler/lib/compile_framework/ClassLoaderBuilder.java new file mode 100644 index 000000000000..2f14cfb0f048 --- /dev/null +++ b/test/hotspot/jtreg/compiler/lib/compile_framework/ClassLoaderBuilder.java @@ -0,0 +1,64 @@ +/* + * Copyright (c) 2024, 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 compiler.lib.compile_framework; + +import java.io.File; +import java.io.IOException; +import java.net.URL; +import java.net.URLClassLoader; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.List; + +/** + * Build a ClassLoader that loads from classpath and {@code classesDir}. + * Helper class that generates a ClassLoader which allows loading classes + * from the classpath (see {@link Utils#getClassPaths()}) and {@code classesDir}. + *

    + * The CompileFramework compiles all its classes to a specific {@code classesDir}, + * and this generated ClassLoader thus can be used to load those classes. + */ +class ClassLoaderBuilder { + + /** + * Build a ClassLoader that loads from classpath and {@code classesDir}. + */ + public static ClassLoader build(Path classesDir) { + ClassLoader sysLoader = ClassLoader.getSystemClassLoader(); + + try { + // Classpath for all included classes (e.g. IR Framework). + // Get all class paths, convert to URLs. + List urls = new ArrayList<>(); + for (String path : Utils.getClassPaths()) { + urls.add(new File(path).toURI().toURL()); + } + // And add in the compiled classes from this instance of CompileFramework. + urls.add(new File(classesDir.toString()).toURI().toURL()); + return URLClassLoader.newInstance(urls.toArray(URL[]::new), sysLoader); + } catch (IOException e) { + throw new CompileFrameworkException("IOException while creating ClassLoader", e); + } + } +} diff --git a/test/hotspot/jtreg/compiler/lib/compile_framework/Compile.java b/test/hotspot/jtreg/compiler/lib/compile_framework/Compile.java new file mode 100644 index 000000000000..0f45d982af6d --- /dev/null +++ b/test/hotspot/jtreg/compiler/lib/compile_framework/Compile.java @@ -0,0 +1,202 @@ +/* + * Copyright (c) 2024, 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 compiler.lib.compile_framework; + +import java.io.BufferedWriter; +import java.io.File; +import java.io.IOException; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.concurrent.TimeUnit; +import java.util.List; +import jdk.test.lib.JDKToolFinder; + +/** + * Helper class for compilation of Java and Jasm {@link SourceCode}. + */ +class Compile { + private static final int COMPILE_TIMEOUT = 60; + + private static final String JAVA_PATH = JDKToolFinder.getJDKTool("java"); + private static final String JAVAC_PATH = JDKToolFinder.getJDKTool("javac"); + + /** + * Compile all sources in {@code javaSources}. First write them to the {@code sourceDir}, + * then compile them to class-files which are stored in {@code classesDir}. + */ + public static void compileJavaSources(List javaSources, Path sourceDir, Path classesDir) { + if (javaSources.isEmpty()) { + Utils.printlnVerbose("No java sources to compile."); + return; + } + Utils.printlnVerbose("Compiling Java sources: " + javaSources.size()); + + List javaFilePaths = writeSourcesToFiles(javaSources, sourceDir); + compileJavaFiles(javaFilePaths, classesDir); + Utils.printlnVerbose("Java sources compiled."); + } + + /** + * Compile a list of files (i.e. {@code paths}) using javac and store + * them in {@code classesDir}. + */ + private static void compileJavaFiles(List paths, Path classesDir) { + List command = new ArrayList<>(); + + command.add(JAVAC_PATH); + command.add("-classpath"); + // Note: the backslashes from windows paths must be escaped! + command.add(Utils.getEscapedClassPathAndClassesDir(classesDir)); + command.add("-d"); + command.add(classesDir.toString()); + for (Path path : paths) { + command.add(path.toAbsolutePath().toString()); + } + + executeCompileCommand(command); + } + + /** + * Compile all sources in {@code jasmSources}. First write them to the {@code sourceDir}, + * then compile them to class-files which are stored in {@code classesDir}. + */ + public static void compileJasmSources(List jasmSources, Path sourceDir, Path classesDir) { + if (jasmSources.isEmpty()) { + Utils.printlnVerbose("No jasm sources to compile."); + return; + } + Utils.printlnVerbose("Compiling jasm sources: " + jasmSources.size()); + + List jasmFilePaths = writeSourcesToFiles(jasmSources, sourceDir); + compileJasmFiles(jasmFilePaths, classesDir); + Utils.printlnVerbose("Jasm sources compiled."); + } + + /** + * Compile a list of files (i.e. {@code paths}) using asmtools jasm and store + * them in {@code classesDir}. + */ + private static void compileJasmFiles(List paths, Path classesDir) { + List command = new ArrayList<>(); + + command.add(JAVA_PATH); + command.add("-classpath"); + command.add(getAsmToolsPath()); + command.add("org.openjdk.asmtools.jasm.Main"); + command.add("-d"); + command.add(classesDir.toString()); + for (Path path : paths) { + command.add(path.toAbsolutePath().toString()); + } + + executeCompileCommand(command); + } + + /** + * Get the path of asmtools, which is shipped with JTREG. + */ + private static String getAsmToolsPath() { + for (String path : Utils.getClassPaths()) { + if (path.endsWith("jtreg.jar")) { + File jtreg = new File(path); + File dir = jtreg.getAbsoluteFile().getParentFile(); + File asmtools = new File(dir, "asmtools.jar"); + if (!asmtools.exists()) { + throw new InternalCompileFrameworkException("Found jtreg.jar in classpath, but could not find asmtools.jar"); + } + return asmtools.getAbsolutePath(); + } + } + throw new InternalCompileFrameworkException("Could not find asmtools because could not find jtreg.jar in classpath"); + } + + private static void writeCodeToFile(String code, Path path) { + Utils.printlnVerbose("File: " + path); + + // Ensure directory of the file exists. + Path dir = path.getParent(); + try { + Files.createDirectories(dir); + } catch (Exception e) { + throw new CompileFrameworkException("Could not create directory: " + dir, e); + } + + // Write to file. + try (BufferedWriter writer = Files.newBufferedWriter(path)) { + writer.write(code); + } catch (Exception e) { + throw new CompileFrameworkException("Could not write file: " + path, e); + } + } + + /** + * Write each source in {@code sources} to a file inside {@code sourceDir}. + */ + private static List writeSourcesToFiles(List sources, Path sourceDir) { + List storedFiles = new ArrayList<>(); + for (SourceCode sourceCode : sources) { + Path path = sourceDir.resolve(sourceCode.filePathName()); + writeCodeToFile(sourceCode.code(), path); + storedFiles.add(path); + } + return storedFiles; + } + + /** + * Execute a given compilation, given as a {@code command}. + */ + private static void executeCompileCommand(List command) { + Utils.printlnVerbose("Compile command: " + String.join(" ", command)); + + ProcessBuilder builder = new ProcessBuilder(command); + builder.redirectErrorStream(true); + + String output; + int exitCode; + try { + Process process = builder.start(); + boolean exited = process.waitFor(COMPILE_TIMEOUT, TimeUnit.SECONDS); + if (!exited) { + process.destroyForcibly(); + System.out.println("Timeout: compile command: " + String.join(" ", command)); + throw new InternalCompileFrameworkException("Process timeout: compilation took too long."); + } + output = new String(process.getInputStream().readAllBytes(), StandardCharsets.UTF_8); + exitCode = process.exitValue(); + } catch (IOException e) { + throw new InternalCompileFrameworkException("IOException during compilation", e); + } catch (InterruptedException e) { + throw new CompileFrameworkException("InterruptedException during compilation", e); + } + + if (exitCode != 0 || !output.isEmpty()) { + System.err.println("Compilation failed."); + System.err.println("Exit code: " + exitCode); + System.err.println("Output: '" + output + "'"); + throw new CompileFrameworkException("Compilation failed."); + } + } +} diff --git a/test/hotspot/jtreg/compiler/lib/compile_framework/CompileFramework.java b/test/hotspot/jtreg/compiler/lib/compile_framework/CompileFramework.java new file mode 100644 index 000000000000..fe23d596f3c6 --- /dev/null +++ b/test/hotspot/jtreg/compiler/lib/compile_framework/CompileFramework.java @@ -0,0 +1,169 @@ +/* + * Copyright (c) 2024, 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 compiler.lib.compile_framework; + +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.List; + +/** + * This is the entry-point for the Compile Framework. Its purpose it to allow + * compilation and execution of Java and Jasm sources generated at runtime. + * + *

    Please reference the README.md for more details and examples. + */ +public class CompileFramework { + private final List javaSources = new ArrayList<>(); + private final List jasmSources = new ArrayList<>(); + private final Path sourceDir = Utils.makeUniqueDir("compile-framework-sources-"); + private final Path classesDir = Utils.makeUniqueDir("compile-framework-classes-"); + private ClassLoader classLoader; + + /** + * Set up a new Compile Framework instance, for a new compilation unit. + */ + public CompileFramework() {} + + /** + * Add a Java source to the compilation. + * + * @param className Class name of the class (e.g. "{@code p.xyz.YXZ}"). + * @param code Java code for the class, in the form of a {@link String}. + */ + public void addJavaSourceCode(String className, String code) { + javaSources.add(new SourceCode(className, "java", code)); + } + + /** + * Add a Jasm source to the compilation. + * + * @param className Class name of the class (e.g. "{@code p.xyz.YXZ}"). + * @param code Jasm code for the class, in the form of a {@link String}. + */ + public void addJasmSourceCode(String className, String code) { + jasmSources.add(new SourceCode(className, "jasm", code)); + } + + /** + * Compile all sources: store the sources to the {@link sourceDir} directory, compile + * Java and Jasm sources and store the generated class-files in the {@link classesDir} + * directory. + */ + public void compile() { + if (classLoader != null) { + throw new CompileFrameworkException("Cannot compile twice!"); + } + + Utils.printlnVerbose("------------------ CompileFramework: SourceCode -------------------"); + Utils.printlnVerbose(sourceCodesAsString(jasmSources)); + Utils.printlnVerbose(sourceCodesAsString(javaSources)); + + System.out.println("------------------ CompileFramework: Compilation ------------------"); + System.out.println("Source directory: " + sourceDir); + System.out.println("Classes directory: " + classesDir); + + Compile.compileJasmSources(jasmSources, sourceDir, classesDir); + Compile.compileJavaSources(javaSources, sourceDir, classesDir); + classLoader = ClassLoaderBuilder.build(classesDir); + } + + private static String sourceCodesAsString(List sourceCodes) { + StringBuilder builder = new StringBuilder(); + for (SourceCode sourceCode : sourceCodes) { + builder.append("SourceCode: ").append(sourceCode.filePathName()).append(System.lineSeparator()); + builder.append(sourceCode.code()).append(System.lineSeparator()); + } + return builder.toString(); + } + + /** + * Access a class from the compiled code. + * + * @param name Name of the class to be retrieved. + * @return The class corresponding to the {@code name}. + */ + public Class getClass(String name) { + try { + return Class.forName(name, true, classLoader); + } catch (ClassNotFoundException e) { + throw new CompileFrameworkException("Class not found:", e); + } + } + + /** + * Invoke a static method from the compiled code. + * + * @param className Class name of a compiled class. + * @param methodName Method name of the class. + * @param args List of arguments for the method invocation. + * @return Return value from the invocation. + */ + public Object invoke(String className, String methodName, Object[] args) { + Method method = findMethod(className, methodName); + + try { + return method.invoke(null, args); + } catch (IllegalAccessException e) { + throw new CompileFrameworkException("Illegal access:", e); + } catch (InvocationTargetException e) { + throw new CompileFrameworkException("Invocation target:", e); + } + } + + private Method findMethod(String className, String methodName) { + Class c = getClass(className); + Method[] methods = c.getDeclaredMethods(); + Method method = null; + + for (Method m : methods) { + if (m.getName().equals(methodName)) { + if (method != null) { + throw new CompileFrameworkException("Method name \"" + methodName + "\" not unique in class \n" + className + "\"."); + } + method = m; + } + } + + if (method == null) { + throw new CompileFrameworkException("Method \"" + methodName + "\" not found in class \n" + className + "\"."); + } + + return method; + } + + /** + * Returns the classpath appended with the {@link classesDir}, where + * the compiled classes are stored. This enables another VM to load + * the compiled classes. Note, the string is already backslash escaped, + * so that Windows paths which use backslashes can be used directly + * as strings. + * + * @return Classpath appended with the path to the compiled classes. + */ + public String getEscapedClassPathOfCompiledClasses() { + return Utils.getEscapedClassPathAndClassesDir(classesDir); + } +} diff --git a/test/hotspot/jtreg/compiler/lib/compile_framework/CompileFrameworkException.java b/test/hotspot/jtreg/compiler/lib/compile_framework/CompileFrameworkException.java new file mode 100644 index 000000000000..5c71a33a533f --- /dev/null +++ b/test/hotspot/jtreg/compiler/lib/compile_framework/CompileFrameworkException.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2024, 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 compiler.lib.compile_framework; + +/** + * Exception thrown in the Compilation Framework. Most likely, the user is responsible for the failure. + */ +public class CompileFrameworkException extends RuntimeException { + public CompileFrameworkException(String message) { + super("Exception in Compile Framework:" + System.lineSeparator() + message); + } + + public CompileFrameworkException(String message, Throwable e) { + super("Exception in Compile Framework:" + System.lineSeparator() + message, e); + } +} diff --git a/test/hotspot/jtreg/compiler/lib/compile_framework/InternalCompileFrameworkException.java b/test/hotspot/jtreg/compiler/lib/compile_framework/InternalCompileFrameworkException.java new file mode 100644 index 000000000000..0cfed80ce1cd --- /dev/null +++ b/test/hotspot/jtreg/compiler/lib/compile_framework/InternalCompileFrameworkException.java @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2024, 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 compiler.lib.compile_framework; + +/** + * Internal exception thrown in Compilation Framework. Most likely, this is due to a bug in the CompileFramework. + */ +public class InternalCompileFrameworkException extends RuntimeException { + public InternalCompileFrameworkException(String message) { + super("Internal exception in Compile Framework, please file a bug:" + System.lineSeparator() + message); + } + + public InternalCompileFrameworkException(String message, Throwable e) { + super("Internal exception in Compile Framework, please file a bug:" + System.lineSeparator() + message, e); + } +} diff --git a/test/hotspot/jtreg/compiler/lib/compile_framework/README.md b/test/hotspot/jtreg/compiler/lib/compile_framework/README.md new file mode 100644 index 000000000000..76ddf677811c --- /dev/null +++ b/test/hotspot/jtreg/compiler/lib/compile_framework/README.md @@ -0,0 +1,57 @@ +# Compile Framework +The Compile Framework allows the compilation and execution of Java and Jasm sources, which are generated at runtime. + +## Motivation +We want to be able to generate Java and Jasm source code in the form of Strings at runtime, then compile them, load the classes and invoke some methods. This allows us to write more elaborate tests. For example small dedicated fuzzers that are targetted at some specific compiler optimization. + +This is more powerful than hand-written tests, as we can generalize tests and cover more examples. It can also be better than a script-generated test: those are static and often the script is not integrated with the generated test. Another limitation of a generator script is that it is only run once, creating fixed static tests. Compilation at runtime allows us to randomly generate tests each time. + +Of course we could compile at runtime without this framework, but it abstracts away the complexity of compilation, and allows the test-writer to focus on the generation of the source code. + +## How to Use the Compile Framework + +Please reference the examples found in [examples](../../../testlibrary_tests/compile_framework/examples/). Some basic tests can be found in [tests](../../../testlibrary_tests/compile_framework/tests/). + +Here a very simple example: + + // Create a new CompileFramework instance. + CompileFramework compileFramework = new CompileFramework(); + + // Add a java source file. + compileFramework.addJavaSourceCode("XYZ", ""); + + // Compile the source file. + compileFramework.compile(); + + // Object returnValue = XYZ.test(5); + Object returnValue = compileFramework.invoke("XYZ", "test", new Object[] {5}); + +### Creating a new Compile Framework Instance + +First, one must create a `new CompileFramework()`, which creates two directories: a sources and a classes directory (see `sourcesDir` and `classesDir` in [CompileFramework](./CompileFramework.java)). The sources directory is where all the sources are placed by the Compile Framework, and the classes directory is where all the compiled classes are placed by the Compile Framework. + +The Compile Framework prints the names of the directories, they are subdirectories of the JTREG scratch directory `JTWork/scratch`. + +### Adding Sources to the Compilation + +Java and Jasm sources can be added to the compilation using `compileFramework.addJavaSourceCode()` and `compileFramework.addJasmSourceCode()`. The source classes can depend on each other, and they can also use the IR Framework ([IRFrameworkJavaExample](../../../testlibrary_tests/compile_framework/examples/IRFrameworkJavaExample.java)). + +When using the IR Framework, or any other library that needs to be compiled, it can be necessary to explicitly let JTREG compile that library. For example with `@compile ../../../compiler/lib/ir_framework/TestFramework.java`. Otherwise, the corresponding class files may not be available, and a corresponding failure will be encounter at class loading. + +### Compiling + +All sources are compiled with `compileFramework.compile()`. First, the sources are stored to the sources directory, then compiled, and then the class-files stored in the classes directory. The respective directory names are printed, so that the user can easily access the generated files for debugging. + +### Interacting with the Compiled Code + +The compiled code is then loaded with a `ClassLoader`. The classes can be accessed directly with `compileFramework.getClass(name)`. Specific methods can also directly be invoked with `compileFramework.invoke()`. + +Should one require the modified classpath that includes the compiled classes, this is available with `compileFramework.getEscapedClassPathOfCompiledClasses()`. This can be necessary if the test launches any other VMs that also access the compiled classes. This is for example necessary when using the IR Framework. + +### Running the Compiled Code in a New VM + +One can also run the compiled code in a new VM. For this, one has to set the classpath with `compileFramework.getEscapedClassPathOfCompiledClasses()` ([RunWithFlagsExample](../../../testlibrary_tests/compile_framework/examples/RunWithFlagsExample.java)) + +### Verbose Printing + +For debugging purposes, one can enable verbose printing, with `-DCompileFrameworkVerbose=true`. diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/FinalizableObject.java b/test/hotspot/jtreg/compiler/lib/compile_framework/SourceCode.java similarity index 68% rename from test/hotspot/jtreg/vmTestbase/nsk/share/FinalizableObject.java rename to test/hotspot/jtreg/compiler/lib/compile_framework/SourceCode.java index 7ffee4a43fe9..df38e420758e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/FinalizableObject.java +++ b/test/hotspot/jtreg/compiler/lib/compile_framework/SourceCode.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,20 +21,15 @@ * questions. */ -package nsk.share; - +package compiler.lib.compile_framework; /** - * This class is a simple example of finalizable object, that - * implements interface Finalizable. - * - * @see Finalizable - * @see Finalizer + * This class represents the source code of a specific class. */ -public class FinalizableObject implements Finalizable { - /** - * Subclasses should override this method to provide the specific - * cleanup actions that they need. - */ - public void cleanup() {} +record SourceCode(String className, String extension, String code) { + public String filePathName() { + StringBuilder builder = new StringBuilder(); + builder.append(className.replace('.','/')).append(".").append(extension); + return builder.toString(); + } } diff --git a/test/hotspot/jtreg/compiler/lib/compile_framework/Utils.java b/test/hotspot/jtreg/compiler/lib/compile_framework/Utils.java new file mode 100644 index 000000000000..0ac2720f33b1 --- /dev/null +++ b/test/hotspot/jtreg/compiler/lib/compile_framework/Utils.java @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2024, 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 compiler.lib.compile_framework; + +import java.nio.file.Files; +import java.nio.file.Paths; +import java.nio.file.Path; +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +/** + * Utility class, with many helper methods for the Compile Framework. + */ +class Utils { + private static final boolean VERBOSE = Boolean.getBoolean("CompileFrameworkVerbose"); + + /** + * Verbose printing, enabled with {@code -DCompileFrameworkVerbose=true}. + */ + public static void printlnVerbose(String s) { + if (VERBOSE) { + System.out.println(s); + } + } + + /** + * Create a temporary directory with a unique name to avoid collisions + * with multi-threading. Used to create the sources and classes directories. Since they + * are unique even across threads, the Compile Framework is multi-threading safe, i.e. + * it does not have collisions if two instances generate classes with the same name. + */ + public static Path makeUniqueDir(String prefix) { + try { + return Files.createTempDirectory(Paths.get("."), prefix); + } catch (Exception e) { + throw new InternalCompileFrameworkException("Could not set up temporary directory", e); + } + } + + /** + * Get all paths in the classpath. + */ + public static String[] getClassPaths() { + String separator = File.pathSeparator; + return System.getProperty("java.class.path").split(separator); + } + + /** + * Return the classpath, appended with the {@code classesDir}. + */ + public static String getEscapedClassPathAndClassesDir(Path classesDir) { + String cp = System.getProperty("java.class.path") + + File.pathSeparator + + classesDir.toAbsolutePath(); + // Escape the backslash for Windows paths. We are using the path in the + // command-line and Java code, so we always want it to be escaped. + return cp.replace("\\", "\\\\"); + } +} diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/IRNode.java b/test/hotspot/jtreg/compiler/lib/ir_framework/IRNode.java index 8eb1af01d5aa..91213cb263a3 100644 --- a/test/hotspot/jtreg/compiler/lib/ir_framework/IRNode.java +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/IRNode.java @@ -1002,6 +1002,11 @@ public class IRNode { vectorNode(NEG_VD, "NegVD", TYPE_DOUBLE); } + public static final String NOP = PREFIX + "NOP" + POSTFIX; + static { + machOnlyNameRegex(NOP, "Nop"); + } + public static final String NULL_ASSERT_TRAP = PREFIX + "NULL_ASSERT_TRAP" + POSTFIX; static { trapNodes(NULL_ASSERT_TRAP,"null_assert"); diff --git a/test/hotspot/jtreg/compiler/lib/ir_framework/test/IREncodingPrinter.java b/test/hotspot/jtreg/compiler/lib/ir_framework/test/IREncodingPrinter.java index a6927469d0e3..bf07881657eb 100644 --- a/test/hotspot/jtreg/compiler/lib/ir_framework/test/IREncodingPrinter.java +++ b/test/hotspot/jtreg/compiler/lib/ir_framework/test/IREncodingPrinter.java @@ -83,6 +83,7 @@ public class IREncodingPrinter { private static final List verifiedCPUFeatures = new ArrayList( Arrays.asList( // x86 "fma", + "f16c", // Intel SSE "sse", "sse2", diff --git a/test/hotspot/jtreg/compiler/stringopts/TestStackedConcatsAppendUncommonTrap.java b/test/hotspot/jtreg/compiler/stringopts/TestStackedConcatsAppendUncommonTrap.java new file mode 100644 index 000000000000..2b72796836f6 --- /dev/null +++ b/test/hotspot/jtreg/compiler/stringopts/TestStackedConcatsAppendUncommonTrap.java @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2025, 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 8357105 + * @summary Test stacked string concatenations where the toString result + * of the first StringBuilder chain is wired into an uncommon trap + * located in the second one. + * @run main/othervm compiler.stringopts.TestStackedConcatsAppendUncommonTrap + * @run main/othervm -XX:-TieredCompilation -Xbatch + * -XX:CompileOnly=compiler.stringopts.TestStackedConcatsAppendUncommonTrap::* + * compiler.stringopts.TestStackedConcatsAppendUncommonTrap + */ + +package compiler.stringopts; + +public class TestStackedConcatsAppendUncommonTrap { + + public static void main (String... args) { + for (int i = 0; i < 10000; i++) { + String s = f(" "); + if (!s.equals(" ")) { + throw new RuntimeException("wrong result."); + } + } + } + + static String f(String c) { + String s = " "; + s = new StringBuilder().append(s).append(s).toString(); + s = new StringBuilder().append(s).append(s == c ? s : " ").toString(); + return s; + } +} diff --git a/test/hotspot/jtreg/compiler/vectorapi/VectorReplicateLongSpecialImmTest.java b/test/hotspot/jtreg/compiler/vectorapi/VectorReplicateLongSpecialImmTest.java index e2ad716d1fa9..b885abb632a4 100644 --- a/test/hotspot/jtreg/compiler/vectorapi/VectorReplicateLongSpecialImmTest.java +++ b/test/hotspot/jtreg/compiler/vectorapi/VectorReplicateLongSpecialImmTest.java @@ -36,7 +36,7 @@ * @library /test/lib * @requires os.arch == "aarch64" * @modules jdk.incubator.vector - * @run testng/othervm -XX:UseSVE=0 -XX:-TieredCompilation -XX:CompileThreshold=100 compiler.vectorapi.VectorReplicateLongSpecialImmTest + * @run testng/othervm -XX:UseSVE=0 -XX:-TieredCompilation -XX:CompileThreshold=100 -XX:+IgnoreUnrecognizedVMOptions -XX:CompileCommand=MemLimit,*.*,0 compiler.vectorapi.VectorReplicateLongSpecialImmTest */ public class VectorReplicateLongSpecialImmTest { diff --git a/test/hotspot/jtreg/compiler/vectorization/TestFloat16VectorConvChain.java b/test/hotspot/jtreg/compiler/vectorization/TestFloat16VectorConvChain.java new file mode 100644 index 000000000000..7c0ebc50e42f --- /dev/null +++ b/test/hotspot/jtreg/compiler/vectorization/TestFloat16VectorConvChain.java @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2024, 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 +* @summary Test Float16 vector conversion chain. +* @requires (vm.cpu.features ~= ".*avx512vl.*" | vm.cpu.features ~= ".*f16c.*") | os.arch == "aarch64" +* | (os.arch == "riscv64" & vm.cpu.features ~= ".*zfh.*") +* | ((os.arch == "ppc64" | os.arch == "ppc64le") & vm.cpu.features ~= ".*darn.*") +* @library /test/lib / +* @run driver compiler.vectorization.TestFloat16VectorConvChain +*/ + +package compiler.vectorization; + +import compiler.lib.ir_framework.*; +import java.util.Random; +import java.util.Arrays; + + +public class TestFloat16VectorConvChain { + + @Test + @IR(applyIfCPUFeatureOr = {"f16c", "true", "avx512vl", "true"}, counts = {IRNode.VECTOR_CAST_HF2F, IRNode.VECTOR_SIZE_ANY, ">= 1", IRNode.VECTOR_CAST_F2HF, IRNode.VECTOR_SIZE_ANY, " >= 1"}) + public static void test(short [] res, short [] src1, short [] src2) { + for (int i = 0; i < res.length; i++) { + res[i] = (short)Float.float16ToFloat(Float.floatToFloat16(Float.float16ToFloat(src1[i]) + Float.float16ToFloat(src2[i]))); + } + } + + @Run(test = {"test"}) + @Warmup(1000) + public static void micro() { + short [] res = new short[1024]; + short [] src1 = new short[1024]; + short [] src2 = new short[1024]; + Arrays.fill(src1, (short)Float.floatToFloat16(1.0f)); + Arrays.fill(src2, (short)Float.floatToFloat16(2.0f)); + for (int i = 0; i < 1000; i++) { + test(res, src1, src2); + } + } + + public static void main(String [] args) { + TestFramework.run(TestFloat16VectorConvChain.class); + } +} diff --git a/test/hotspot/jtreg/compiler/vectorization/TestNumberOfContinuousZeros.java b/test/hotspot/jtreg/compiler/vectorization/TestNumberOfContinuousZeros.java index d7ce03f1dc10..01fd80748946 100644 --- a/test/hotspot/jtreg/compiler/vectorization/TestNumberOfContinuousZeros.java +++ b/test/hotspot/jtreg/compiler/vectorization/TestNumberOfContinuousZeros.java @@ -1,5 +1,6 @@ /* * Copyright (c) 2022, Arm Limited. All rights reserved. + * Copyright (c) 2025, 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,22 +24,27 @@ /** * @test +* @bug 8297172 8331993 8349637 * @key randomness * @summary Test vectorization of numberOfTrailingZeros/numberOfLeadingZeros for Long * @requires vm.compiler2.enabled * @requires (os.simpleArch == "x64" & vm.cpu.features ~= ".*avx2.*") | * (os.simpleArch == "aarch64" & vm.cpu.features ~= ".*sve.*" & (vm.opt.UseSVE == "null" | vm.opt.UseSVE > 0)) * @library /test/lib / +* @modules jdk.incubator.vector * @run driver compiler.vectorization.TestNumberOfContinuousZeros */ package compiler.vectorization; +import jdk.incubator.vector.*; import compiler.lib.ir_framework.*; import java.util.Random; import jdk.test.lib.Asserts; +import jdk.test.lib.Utils; public class TestNumberOfContinuousZeros { + private static final int[] SPECIAL = { 0x01FFFFFF, 0x03FFFFFE, 0x07FFFFFC, 0x0FFFFFF8, 0x1FFFFFF0, 0x3FFFFFE0, 0xFFFFFFFF }; private long[] inputLong; private int[] outputLong; private int[] inputInt; @@ -46,8 +52,8 @@ public class TestNumberOfContinuousZeros { private static final int LEN = 1024; private Random rng; - public static void main(String args[]) { - TestFramework.run(); + public static void main(String[] args) { + TestFramework.runWithFlags("--add-modules=jdk.incubator.vector"); } public TestNumberOfContinuousZeros() { @@ -55,7 +61,7 @@ public TestNumberOfContinuousZeros() { outputLong = new int[LEN]; inputInt = new int[LEN]; outputInt = new int[LEN]; - rng = new Random(42); + rng = Utils.getRandomInstance(); for (int i = 0; i < LEN; ++i) { inputLong[i] = rng.nextLong(); inputInt[i] = rng.nextInt(); @@ -118,5 +124,80 @@ public void checkResultInt() { Asserts.assertEquals(outputInt[i], Integer.numberOfLeadingZeros(inputInt[i])); } } + + @Setup + static Object[] setupSpecialIntArray() { + int[] res = new int[LEN]; + + for (int i = 0; i < LEN; i++) { + res[i] = SPECIAL[i % SPECIAL.length]; + } + + return new Object[] { res }; + } + + @Test + @IR(counts = {IRNode.COUNT_LEADING_ZEROS_VI, "> 0"}) + @Arguments(setup = "setupSpecialIntArray") + public Object[] testSpecialIntLeadingZeros(int[] ints) { + int[] res = new int[LEN]; + + for (int i = 0; i < LEN; ++i) { + res[i] = Integer.numberOfLeadingZeros(ints[i]); + } + + return new Object[] { ints, res }; + } + + @Check(test = "testSpecialIntLeadingZeros") + public void checkSpecialIntLeadingZeros(Object[] vals) { + int[] in = (int[]) vals[0]; + int[] out = (int[]) vals[1]; + + for (int i = 0; i < LEN; ++i) { + int value = Integer.numberOfLeadingZeros(in[i]); + + if (out[i] != value) { + throw new IllegalStateException("Expected lzcnt(" + in[i] + ") to be " + value + " but got " + out[i]); + } + } + } + + private static final VectorSpecies SPECIES = IntVector.SPECIES_PREFERRED; + + @Test + @IR(counts = {IRNode.COUNT_LEADING_ZEROS_VI, "> 0"}) + @Arguments(setup = "setupSpecialIntArray") + public Object[] checkSpecialIntLeadingZerosVector(int[] ints) { + int[] res = new int[LEN]; + + for (int i = 0; i < ints.length; i += SPECIES.length()) { + IntVector av = IntVector.fromArray(SPECIES, ints, i); + av.lanewise(VectorOperators.LEADING_ZEROS_COUNT).intoArray(res, i); + } + + return new Object[] { ints, res }; + } + + @Check(test = "checkSpecialIntLeadingZerosVector") + public void checkSpecialIntLeadingZerosVector(Object[] vals) { + int[] ints = (int[]) vals[0]; + int[] res = (int[]) vals[1]; + + // Verification + + int[] check = new int[LEN]; + + for (int i = 0; i < ints.length; i += SPECIES.length()) { + IntVector av = IntVector.fromArray(SPECIES, ints, i); + av.lanewise(VectorOperators.LEADING_ZEROS_COUNT).intoArray(check, i); + } + + for (int i = 0; i < LEN; i++) { + if (res[i] != check[i]) { + throw new IllegalStateException("Expected " + check[i] + " but got " + res[i]); + } + } + } } diff --git a/test/hotspot/jtreg/compiler/vectorization/TestVectorZeroCount.java b/test/hotspot/jtreg/compiler/vectorization/TestVectorZeroCount.java new file mode 100644 index 000000000000..03a7beb35c00 --- /dev/null +++ b/test/hotspot/jtreg/compiler/vectorization/TestVectorZeroCount.java @@ -0,0 +1,135 @@ +/* + * Copyright (c) 2025, 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 8349637 + * @summary Ensure that vectorization of numberOfLeadingZeros and numberOfTrailingZeros outputs correct values + * @library /test/lib / + * @run main/othervm compiler.vectorization.TestVectorZeroCount + */ + +package compiler.vectorization; + +import java.util.Random; + +import jdk.test.lib.Utils; + +public class TestVectorZeroCount { + private static final int SIZE = 1024; + private static final Random RANDOM = Utils.getRandomInstance(); + + private static final int[] INT_VALUES = new int[SIZE]; + private static final int[] INT_EXPECTED_LEADING = new int[SIZE]; + private static final int[] INT_RESULT_LEADING = new int[SIZE]; + private static final int[] INT_EXPECTED_TRAILING = new int[SIZE]; + private static final int[] INT_RESULT_TRAILING = new int[SIZE]; + + private static final long[] LONG_VALUES = new long[SIZE]; + private static final long[] LONG_EXPECTED_LEADING = new long[SIZE]; + private static final long[] LONG_RESULT_LEADING = new long[SIZE]; + private static final long[] LONG_EXPECTED_TRAILING = new long[SIZE]; + private static final long[] LONG_RESULT_TRAILING = new long[SIZE]; + + private static final int INT_START_INDEX = Integer.MIN_VALUE; + private static final int INT_END_INDEX = Integer.MAX_VALUE; + private static final int LONG_START_INDEX = 0; + private static final int LONG_END_INDEX = 100_000_000; + + private static int intCounter; + private static int longCounter; + + public static boolean testInt() { + boolean done = false; + + // Non-vectorized loop as baseline (not vectorized because source array is initialized) + for (int i = 0; i < SIZE; ++i) { + INT_VALUES[i] = intCounter++; + if (intCounter == INT_END_INDEX) { + done = true; + } + INT_EXPECTED_LEADING[i] = Integer.numberOfLeadingZeros(INT_VALUES[i]); + INT_EXPECTED_TRAILING[i] = Integer.numberOfTrailingZeros(INT_VALUES[i]); + } + // Vectorized loop + for (int i = 0; i < SIZE; ++i) { + INT_RESULT_LEADING[i] = Integer.numberOfLeadingZeros(INT_VALUES[i]); + } + for (int i = 0; i < SIZE; ++i) { + INT_RESULT_TRAILING[i] = Integer.numberOfTrailingZeros(INT_VALUES[i]); + } + + // Compare results + for (int i = 0; i < SIZE; ++i) { + if (INT_RESULT_LEADING[i] != INT_EXPECTED_LEADING[i]) { + throw new RuntimeException("Unexpected result for Integer.numberOfLeadingZeros(" + INT_VALUES[i] + "): " + INT_RESULT_LEADING[i] + ", expected " + INT_EXPECTED_LEADING[i]); + } + if (INT_RESULT_TRAILING[i] != INT_EXPECTED_TRAILING[i]) { + throw new RuntimeException("Unexpected result for Integer.numberOfTrailingZeros(" + INT_VALUES[i] + "): " + INT_RESULT_TRAILING[i] + ", expected " + INT_EXPECTED_TRAILING[i]); + } + } + return done; + } + + public static boolean testLong() { + boolean done = false; + + // Non-vectorized loop as baseline (not vectorized because source array is initialized) + for (int i = 0; i < SIZE; ++i) { + // Use random values because the long range is too large to iterate over it + LONG_VALUES[i] = RANDOM.nextLong(); + if (longCounter++ == LONG_END_INDEX) { + done = true; + } + LONG_EXPECTED_LEADING[i] = Long.numberOfLeadingZeros(LONG_VALUES[i]); + LONG_EXPECTED_TRAILING[i] = Long.numberOfTrailingZeros(LONG_VALUES[i]); + } + // Vectorized loop + for (int i = 0; i < SIZE; ++i) { + LONG_RESULT_LEADING[i] = Long.numberOfLeadingZeros(LONG_VALUES[i]); + } + for (int i = 0; i < SIZE; ++i) { + LONG_RESULT_TRAILING[i] = Long.numberOfTrailingZeros(LONG_VALUES[i]); + } + + // Compare results + for (int i = 0; i < SIZE; ++i) { + if (LONG_RESULT_LEADING[i] != LONG_EXPECTED_LEADING[i]) { + throw new RuntimeException("Unexpected result for Long.numberOfLeadingZeros(" + LONG_VALUES[i] + "): " + LONG_RESULT_LEADING[i] + ", expected " + LONG_EXPECTED_LEADING[i]); + } + if (LONG_RESULT_TRAILING[i] != LONG_EXPECTED_TRAILING[i]) { + throw new RuntimeException("Unexpected result for Long.numberOfTrailingZeros(" + LONG_VALUES[i] + "): " + LONG_RESULT_TRAILING[i] + ", expected " + LONG_EXPECTED_TRAILING[i]); + } + } + return done; + } + + public static void main(String[] args) { + // Run twice to make sure compiled code is used from the beginning + for (int i = 0; i < 2; ++i) { + intCounter = INT_START_INDEX; + longCounter = LONG_START_INDEX; + while (!testLong()) ; + while (!testInt()) ; + } + } +} diff --git a/test/hotspot/jtreg/containers/docker/JfrNetwork.java b/test/hotspot/jtreg/containers/docker/JfrNetwork.java index bdb2f3b7d2e3..f0a3f654e533 100644 --- a/test/hotspot/jtreg/containers/docker/JfrNetwork.java +++ b/test/hotspot/jtreg/containers/docker/JfrNetwork.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/hotspot/jtreg/containers/docker/JfrReporter.java b/test/hotspot/jtreg/containers/docker/JfrReporter.java index d660415cecbf..ffb416f7336b 100644 --- a/test/hotspot/jtreg/containers/docker/JfrReporter.java +++ b/test/hotspot/jtreg/containers/docker/JfrReporter.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/hotspot/jtreg/containers/docker/TestContainerInfo.java b/test/hotspot/jtreg/containers/docker/TestContainerInfo.java new file mode 100644 index 000000000000..dadc262cd5a4 --- /dev/null +++ b/test/hotspot/jtreg/containers/docker/TestContainerInfo.java @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, Red Hat, Inc. + * 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 + * @summary Test container info for cgroup v2 + * @requires docker.support + * @library /test/lib + * @modules java.base/jdk.internal.misc + * java.management + * jdk.jartool/sun.tools.jar + * @build CheckContainerized jdk.test.whitebox.WhiteBox PrintContainerInfo + * @run driver jdk.test.lib.helpers.ClassFileInstaller -jar whitebox.jar jdk.test.whitebox.WhiteBox + * @run driver TestContainerInfo + */ +import jtreg.SkippedException; +import jdk.test.lib.containers.docker.Common; +import jdk.test.lib.containers.docker.DockerTestUtils; +import jdk.test.lib.containers.docker.DockerRunOptions; +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; + + +public class TestContainerInfo { + private static final String imageName = Common.imageName("container-info"); + + public static void main(String[] args) throws Exception { + if (!DockerTestUtils.canTestDocker()) { + return; + } + + Common.prepareWhiteBox(); + DockerTestUtils.buildJdkContainerImage(imageName); + + try { + testPrintContainerInfoWithoutSwap(); + } finally { + DockerTestUtils.removeDockerImage(imageName); + } + } + + private static void testPrintContainerInfoWithoutSwap() throws Exception { + Common.logNewTestCase("Test print_container_info() - without swap"); + + DockerRunOptions opts = Common.newOpts(imageName, "PrintContainerInfo") + .addDockerOpts("--memory=500m") + .addDockerOpts("--memory-swap=500m"); // no swap + Common.addWhiteBoxOpts(opts); + + OutputAnalyzer out = Common.run(opts); + checkContainerInfo(out); + } + + private static void shouldMatchWithValue(OutputAnalyzer output, String match, String value) { + output.shouldContain(match); + String str = output.getOutput(); + for (String s : str.split(System.lineSeparator())) { + if (s.contains(match)) { + if (!s.contains(value)) { + throw new RuntimeException("memory_swap_current_in_bytes NOT " + value + "! Line was : " + s); + } + } + } + } + + private static void checkContainerInfo(OutputAnalyzer out) throws Exception { + String str = out.getOutput(); + if (str.contains("cgroupv2")) { + shouldMatchWithValue(out, "memory_swap_max_limit_in_bytes", "0"); + shouldMatchWithValue(out, "memory_swap_current_in_bytes", "0"); + } else { + throw new SkippedException("This test is cgroups v2 specific, skipped on cgroups v1"); + } + } +} diff --git a/test/hotspot/jtreg/gc/epsilon/TestDieDefault.java b/test/hotspot/jtreg/gc/epsilon/TestDieDefault.java index 016bb517c3c5..8c393ceb1784 100644 --- a/test/hotspot/jtreg/gc/epsilon/TestDieDefault.java +++ b/test/hotspot/jtreg/gc/epsilon/TestDieDefault.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2018, Red Hat, Inc. All rights reserved. + * Copyright (c) 2017, 2025, 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 @@ -37,13 +37,13 @@ public class TestDieDefault { public static void passWith(String... args) throws Exception { - OutputAnalyzer out = ProcessTools.executeLimitedTestJava(args); + OutputAnalyzer out = ProcessTools.executeTestJava(args); out.shouldNotContain("OutOfMemoryError"); out.shouldHaveExitValue(0); } public static void failWith(String... args) throws Exception { - OutputAnalyzer out = ProcessTools.executeLimitedTestJava(args); + OutputAnalyzer out = ProcessTools.executeTestJava(args); out.shouldContain("OutOfMemoryError"); if (out.getExitValue() == 0) { throw new IllegalStateException("Should have failed with non-zero exit code"); diff --git a/test/hotspot/jtreg/gc/epsilon/TestDieWithHeapDump.java b/test/hotspot/jtreg/gc/epsilon/TestDieWithHeapDump.java index 8f6e9a36d772..e9f94f47f0c5 100644 --- a/test/hotspot/jtreg/gc/epsilon/TestDieWithHeapDump.java +++ b/test/hotspot/jtreg/gc/epsilon/TestDieWithHeapDump.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2018, Red Hat, Inc. All rights reserved. + * Copyright (c) 2017, 2025, 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 @@ -38,13 +38,13 @@ public class TestDieWithHeapDump { public static void passWith(String... args) throws Exception { - OutputAnalyzer out = ProcessTools.executeLimitedTestJava(args); + OutputAnalyzer out = ProcessTools.executeTestJava(args); out.shouldNotContain("OutOfMemoryError"); out.shouldHaveExitValue(0); } public static void failWith(String... args) throws Exception { - ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder(args); + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder(args); Process p = pb.start(); OutputAnalyzer out = new OutputAnalyzer(p); out.shouldContain("OutOfMemoryError"); diff --git a/test/hotspot/jtreg/gc/epsilon/TestDieWithOnError.java b/test/hotspot/jtreg/gc/epsilon/TestDieWithOnError.java index 7be60c59595d..9212cac807fd 100644 --- a/test/hotspot/jtreg/gc/epsilon/TestDieWithOnError.java +++ b/test/hotspot/jtreg/gc/epsilon/TestDieWithOnError.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2018, Red Hat, Inc. All rights reserved. + * Copyright (c) 2017, 2025, 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 @@ -39,14 +39,14 @@ public class TestDieWithOnError { static String ON_ERR_MSG = "Epsilon error handler message"; public static void passWith(String... args) throws Exception { - OutputAnalyzer out = ProcessTools.executeLimitedTestJava(args); + OutputAnalyzer out = ProcessTools.executeTestJava(args); out.shouldNotContain("OutOfMemoryError"); out.stdoutShouldNotMatch("^" + ON_ERR_MSG); out.shouldHaveExitValue(0); } public static void failWith(String... args) throws Exception { - OutputAnalyzer out = ProcessTools.executeLimitedTestJava(args); + OutputAnalyzer out = ProcessTools.executeTestJava(args); out.shouldContain("OutOfMemoryError"); if (out.getExitValue() == 0) { throw new IllegalStateException("Should have failed with non-zero exit code"); diff --git a/test/hotspot/jtreg/gc/shenandoah/compiler/TestBarrierOnLoopBackedge.java b/test/hotspot/jtreg/gc/shenandoah/compiler/TestBarrierOnLoopBackedge.java new file mode 100644 index 000000000000..a72c7d69d7f6 --- /dev/null +++ b/test/hotspot/jtreg/gc/shenandoah/compiler/TestBarrierOnLoopBackedge.java @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2024, 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 + * @bug 8328107 + * @summary Barrier expanded on backedge break loop verification code + * @requires vm.gc.Shenandoah + * + * @run main/othervm -XX:+UseShenandoahGC -XX:-BackgroundCompilation -XX:CompileCommand=dontinline,TestBarrierOnLoopBackedge::notInlined + * -XX:+IgnoreUnrecognizedVMOptions -XX:+VerifyLoopOptimizations TestBarrierOnLoopBackedge + * @run main/othervm -XX:+UseShenandoahGC -XX:-BackgroundCompilation -XX:CompileCommand=dontinline,TestBarrierOnLoopBackedge::notInlined + * -XX:+IgnoreUnrecognizedVMOptions -XX:+VerifyLoopOptimizations -XX:-UseCountedLoopSafepoints TestBarrierOnLoopBackedge + */ + +public class TestBarrierOnLoopBackedge { + private static A field = new A(); + private static final A finalField = new A(); + private static float floatField; + + public static void main(String[] args) { + A[] array = new A[1]; + array[0] = finalField; + for (int i = 0; i < 20_000; i++) { + test1(); + test2(); + } + } + + private static void test1() { + floatField = field.f; + for (int i = 0; i < 1000; i++) { + notInlined(field); // load barrier split thru phi and ends up on back edge + if (i % 2 == 0) { + field = finalField; + } + } + } + + private static void test2() { + A[] array = new A[1]; + notInlined(array); + int i = 0; + A a = array[0]; + for (;;) { + synchronized (new Object()) { + } + notInlined(a); + i++; + if (i >= 1000) { + break; + } + a = array[0]; // load barrier pinned on backedge + } + } + + private static void notInlined(Object a) { + + } + + private static class A { + float f; + } +} diff --git a/test/hotspot/jtreg/gc/stress/TestStressG1Uncommit.java b/test/hotspot/jtreg/gc/stress/TestStressG1Uncommit.java index d3575e8cd4bd..2040e078ee79 100644 --- a/test/hotspot/jtreg/gc/stress/TestStressG1Uncommit.java +++ b/test/hotspot/jtreg/gc/stress/TestStressG1Uncommit.java @@ -57,6 +57,7 @@ public static void main(String[] args) throws Exception { Collections.addAll(options, "-Xlog:gc,gc+heap+region=debug", "-XX:+UseG1GC", + "-Xmx1g", StressUncommit.class.getName() ); OutputAnalyzer output = ProcessTools.executeLimitedTestJava(options); @@ -79,9 +80,9 @@ public static void main(String args[]) throws InterruptedException { // Leave 20% head room to try to avoid Full GCs. long allocationSize = (long) (Runtime.getRuntime().maxMemory() * 0.8); - // Figure out suitable number of workers (~1 per gig). - int gigsOfAllocation = (int) Math.ceil((double) allocationSize / G); - int numWorkers = Math.min(gigsOfAllocation, Runtime.getRuntime().availableProcessors()); + // Figure out suitable number of workers (~1 per 100M). + int allocationChunks = (int) Math.ceil((double) allocationSize / (100 * M)); + int numWorkers = Math.min(allocationChunks, Runtime.getRuntime().availableProcessors()); long workerAllocation = allocationSize / numWorkers; log("Using " + numWorkers + " workers, each allocating: ~" + (workerAllocation / M) + "M"); diff --git a/test/hotspot/jtreg/gc/stress/jfr/TestStressAllocationGCEventsWithDefNew.java b/test/hotspot/jtreg/gc/stress/jfr/TestStressAllocationGCEventsWithDefNew.java index 9a6af825fe11..a63b6110f0e7 100644 --- a/test/hotspot/jtreg/gc/stress/jfr/TestStressAllocationGCEventsWithDefNew.java +++ b/test/hotspot/jtreg/gc/stress/jfr/TestStressAllocationGCEventsWithDefNew.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/hotspot/jtreg/gc/stress/jfr/TestStressAllocationGCEventsWithG1.java b/test/hotspot/jtreg/gc/stress/jfr/TestStressAllocationGCEventsWithG1.java index a4132e573d52..d8a3ba9636b8 100644 --- a/test/hotspot/jtreg/gc/stress/jfr/TestStressAllocationGCEventsWithG1.java +++ b/test/hotspot/jtreg/gc/stress/jfr/TestStressAllocationGCEventsWithG1.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/hotspot/jtreg/gc/stress/jfr/TestStressAllocationGCEventsWithParallel.java b/test/hotspot/jtreg/gc/stress/jfr/TestStressAllocationGCEventsWithParallel.java index 362ae1f9951d..4a8abeff2172 100644 --- a/test/hotspot/jtreg/gc/stress/jfr/TestStressAllocationGCEventsWithParallel.java +++ b/test/hotspot/jtreg/gc/stress/jfr/TestStressAllocationGCEventsWithParallel.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/hotspot/jtreg/gc/stress/jfr/TestStressBigAllocationGCEventsWithDefNew.java b/test/hotspot/jtreg/gc/stress/jfr/TestStressBigAllocationGCEventsWithDefNew.java index f95669582b88..e0e6b24d196f 100644 --- a/test/hotspot/jtreg/gc/stress/jfr/TestStressBigAllocationGCEventsWithDefNew.java +++ b/test/hotspot/jtreg/gc/stress/jfr/TestStressBigAllocationGCEventsWithDefNew.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/hotspot/jtreg/gc/stress/jfr/TestStressBigAllocationGCEventsWithParallel.java b/test/hotspot/jtreg/gc/stress/jfr/TestStressBigAllocationGCEventsWithParallel.java index cbfc39557d72..01063347781c 100644 --- a/test/hotspot/jtreg/gc/stress/jfr/TestStressBigAllocationGCEventsWithParallel.java +++ b/test/hotspot/jtreg/gc/stress/jfr/TestStressBigAllocationGCEventsWithParallel.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/hotspot/jtreg/gc/x/TestAllocateHeapAt.java b/test/hotspot/jtreg/gc/x/TestAllocateHeapAt.java index 3bf83d907686..6a9768de7e6e 100644 --- a/test/hotspot/jtreg/gc/x/TestAllocateHeapAt.java +++ b/test/hotspot/jtreg/gc/x/TestAllocateHeapAt.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,7 @@ /* * @test TestAllocateHeapAt * @requires vm.gc.ZSinglegen & os.family == "linux" + * @requires !vm.opt.final.UseLargePages * @summary Test ZGC with -XX:AllocateHeapAt * @library /test/lib * @run main/othervm gc.x.TestAllocateHeapAt . true @@ -41,7 +42,7 @@ public static void main(String[] args) throws Exception { final String heapBackingFile = "Heap Backing File: " + directory; final String failedToCreateFile = "Failed to create file " + directory; - ProcessTools.executeLimitedTestJava( + ProcessTools.executeTestJava( "-XX:+UseZGC", "-XX:-ZGenerational", "-Xlog:gc*", diff --git a/test/hotspot/jtreg/gc/x/TestPageCacheFlush.java b/test/hotspot/jtreg/gc/x/TestPageCacheFlush.java index cb8685d0d090..a48b6f77e17e 100644 --- a/test/hotspot/jtreg/gc/x/TestPageCacheFlush.java +++ b/test/hotspot/jtreg/gc/x/TestPageCacheFlush.java @@ -68,7 +68,7 @@ public static void main(String[] args) throws Exception { } public static void main(String[] args) throws Exception { - ProcessTools.executeLimitedTestJava( + ProcessTools.executeTestJava( "-XX:+UseZGC", "-XX:-ZGenerational", "-Xms128M", diff --git a/test/hotspot/jtreg/gc/x/TestSmallHeap.java b/test/hotspot/jtreg/gc/x/TestSmallHeap.java index 8fc6f07be398..a7e8042f9247 100644 --- a/test/hotspot/jtreg/gc/x/TestSmallHeap.java +++ b/test/hotspot/jtreg/gc/x/TestSmallHeap.java @@ -53,7 +53,7 @@ public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception { for (var maxCapacity: args) { - ProcessTools.executeLimitedTestJava( + ProcessTools.executeTestJava( "-XX:+UseZGC", "-XX:-ZGenerational", "-Xlog:gc,gc+init,gc+reloc,gc+heap", diff --git a/test/hotspot/jtreg/gc/z/TestAllocateHeapAt.java b/test/hotspot/jtreg/gc/z/TestAllocateHeapAt.java index 9f47c4b60d3c..2fb040840b4d 100644 --- a/test/hotspot/jtreg/gc/z/TestAllocateHeapAt.java +++ b/test/hotspot/jtreg/gc/z/TestAllocateHeapAt.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,7 @@ /* * @test TestAllocateHeapAt * @requires vm.gc.ZGenerational & os.family == "linux" + * @requires !vm.opt.final.UseLargePages * @summary Test ZGC with -XX:AllocateHeapAt * @library /test/lib * @run main/othervm gc.z.TestAllocateHeapAt . true @@ -41,7 +42,7 @@ public static void main(String[] args) throws Exception { final String heapBackingFile = "Heap Backing File: " + directory; final String failedToCreateFile = "Failed to create file " + directory; - ProcessTools.executeLimitedTestJava( + ProcessTools.executeTestJava( "-XX:+UseZGC", "-XX:+ZGenerational", "-Xlog:gc*", diff --git a/test/hotspot/jtreg/gc/z/TestPageCacheFlush.java b/test/hotspot/jtreg/gc/z/TestPageCacheFlush.java index 387053b580ad..3b666ddc2c8a 100644 --- a/test/hotspot/jtreg/gc/z/TestPageCacheFlush.java +++ b/test/hotspot/jtreg/gc/z/TestPageCacheFlush.java @@ -68,7 +68,7 @@ public static void main(String[] args) throws Exception { } public static void main(String[] args) throws Exception { - ProcessTools.executeLimitedTestJava( + ProcessTools.executeTestJava( "-XX:+UseZGC", "-XX:+ZGenerational", "-Xms128M", diff --git a/test/hotspot/jtreg/gc/z/TestSmallHeap.java b/test/hotspot/jtreg/gc/z/TestSmallHeap.java index 354cd4164f1f..67d9d33d2815 100644 --- a/test/hotspot/jtreg/gc/z/TestSmallHeap.java +++ b/test/hotspot/jtreg/gc/z/TestSmallHeap.java @@ -53,7 +53,7 @@ public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception { for (var maxCapacity: args) { - ProcessTools.executeLimitedTestJava( + ProcessTools.executeTestJava( "-XX:+UseZGC", "-XX:+ZGenerational", "-Xlog:gc,gc+init,gc+reloc,gc+heap", diff --git a/test/hotspot/jtreg/runtime/CommandLine/UnrecognizedProperty.java b/test/hotspot/jtreg/runtime/CommandLine/UnrecognizedProperty.java new file mode 100644 index 000000000000..4b1d4fa38673 --- /dev/null +++ b/test/hotspot/jtreg/runtime/CommandLine/UnrecognizedProperty.java @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2023, 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 8321479 + * @summary VM should not crash with property "-D-D" + * @requires vm.flagless + * @library /test/lib + * @run driver UnrecognizedProperty + */ + +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; + +public class UnrecognizedProperty { + public static void main(String[] args) throws Exception { + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( + "-D-D"); + + OutputAnalyzer output = new OutputAnalyzer(pb.start()); + output.shouldContain("Usage: java"); + output.shouldHaveExitValue(1); + } +} diff --git a/test/hotspot/jtreg/runtime/Thread/libAsyncExceptionOnMonitorEnter.cpp b/test/hotspot/jtreg/runtime/Thread/libAsyncExceptionOnMonitorEnter.cpp index 1b5833d8042b..0249235bc188 100644 --- a/test/hotspot/jtreg/runtime/Thread/libAsyncExceptionOnMonitorEnter.cpp +++ b/test/hotspot/jtreg/runtime/Thread/libAsyncExceptionOnMonitorEnter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,7 @@ extern "C" { -static jvmtiEnv* jvmti = NULL; +static jvmtiEnv* jvmti = nullptr; static jrawMonitorID monitor; JNIEXPORT jint JNICALL diff --git a/test/hotspot/jtreg/runtime/Thread/libStopAtExit.cpp b/test/hotspot/jtreg/runtime/Thread/libStopAtExit.cpp index 1204915050b2..8432912876bf 100644 --- a/test/hotspot/jtreg/runtime/Thread/libStopAtExit.cpp +++ b/test/hotspot/jtreg/runtime/Thread/libStopAtExit.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,7 @@ extern "C" { -static jvmtiEnv* jvmti = NULL; +static jvmtiEnv* jvmti = nullptr; #define LOG(...) \ do { \ diff --git a/test/hotspot/jtreg/runtime/Thread/libSuspendAtExit.cpp b/test/hotspot/jtreg/runtime/Thread/libSuspendAtExit.cpp index 2a64e1a249fa..b49cbf2c924c 100644 --- a/test/hotspot/jtreg/runtime/Thread/libSuspendAtExit.cpp +++ b/test/hotspot/jtreg/runtime/Thread/libSuspendAtExit.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,7 @@ extern "C" { -static jvmtiEnv* jvmti = NULL; +static jvmtiEnv* jvmti = nullptr; #define LOG(...) \ do { \ diff --git a/test/hotspot/jtreg/runtime/cds/DeterministicDump.java b/test/hotspot/jtreg/runtime/cds/DeterministicDump.java index 128caadc1d3d..0c2966512d0f 100644 --- a/test/hotspot/jtreg/runtime/cds/DeterministicDump.java +++ b/test/hotspot/jtreg/runtime/cds/DeterministicDump.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, 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,17 +27,32 @@ * @summary The same JDK build should always generate the same archive file (no randomness). * @requires vm.cds & vm.flagless * @library /test/lib - * @run driver DeterministicDump + * @build jdk.test.whitebox.WhiteBox + * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox + * @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions + * -XX:+WhiteBoxAPI DeterministicDump */ +import jdk.test.lib.cds.CDSArchiveUtils; import jdk.test.lib.cds.CDSOptions; import jdk.test.lib.cds.CDSTestUtils; import jdk.test.lib.Platform; +import java.io.BufferedReader; +import java.io.File; import java.io.FileInputStream; +import java.io.FileReader; import java.io.IOException; +import java.util.ArrayDeque; import java.util.ArrayList; public class DeterministicDump { + + static long HEADER_SIZE; // Size of header in bytes + static int HEADER_LEN = 106; // Number of lines in CDS map file header + static int LINE_OFFSET = 22; // Offset from address to first word of data + static int NUM_LINES = 5; // Number of lines to be printed + static int WORD_LEN = 16 + 1; // Length of word in map file + public static void main(String[] args) throws Exception { doTest(false); @@ -61,17 +76,19 @@ public static void doTest(boolean compressed) throws Exception { } String baseArchive = dump(baseArgs); + File baseArchiveFile = new File(baseArchive + ".jsa"); + HEADER_SIZE = CDSArchiveUtils.fileHeaderSize(baseArchiveFile); // (1) Dump with the same args. Should produce the same archive. String baseArchive2 = dump(baseArgs); - compare(baseArchive, baseArchive2); + compare(baseArchive, baseArchive2, baseArchiveFile); // (2) This will cause the archive to be relocated during dump time. We should // still get the same bits. This simulates relocation that happens when // Address Space Layout Randomization prevents the archive space to // be mapped at the default location. String relocatedArchive = dump(baseArgs, "-XX:+UnlockDiagnosticVMOptions", "-XX:ArchiveRelocationMode=1"); - compare(baseArchive, relocatedArchive); + compare(baseArchive, relocatedArchive, baseArchiveFile); } static int id = 0; @@ -87,14 +104,14 @@ static String dump(ArrayList args, String... more) throws Exception { .addSuffix(more); CDSTestUtils.createArchiveAndCheck(opts); - return archiveName; + return logName; } - static void compare(String file0, String file1) throws Exception { + static void compare(String file0, String file1, File archiveFile) throws Exception { byte[] buff0 = new byte[4096]; byte[] buff1 = new byte[4096]; - try (FileInputStream in0 = new FileInputStream(file0); - FileInputStream in1 = new FileInputStream(file1)) { + try (FileInputStream in0 = new FileInputStream(file0 + ".jsa"); + FileInputStream in1 = new FileInputStream(file1 + ".jsa")) { int total = 0; while (true) { int n0 = read(in0, buff0); @@ -111,7 +128,12 @@ static void compare(String file0, String file1) throws Exception { byte b0 = buff0[i]; byte b1 = buff1[i]; if (b0 != b1) { - throw new RuntimeException("File content different at byte #" + (total + i) + ", b0 = " + b0 + ", b1 = " + b1); + // The checksums are stored in the header so it should be skipped + // since we want to see the first meaningful diff between the archives + if (total + i > HEADER_SIZE) { + print_diff(file0 + ".map", file1 + ".map", archiveFile, total + i); + throw new RuntimeException("File content different at byte #" + (total + i) + ", b0 = " + b0 + ", b1 = " + b1); + } } } total += n0; @@ -131,4 +153,115 @@ static int read(FileInputStream in, byte[] buff) throws IOException { return total; } + + // CDS map file doesn't print the alignment bytes so they need to be considered + // when mapping the byte number in the archive to the word in the map file + static int archiveByteToMapWord(File archiveFile, int location) throws Exception { + int totalSize = 0; + int word = location; + + long len = HEADER_SIZE; + long aligned = CDSArchiveUtils.fileHeaderSizeAligned(archiveFile); + for (int i = 0; i < CDSArchiveUtils.num_regions(); i++) { + if (i != 0) { + len = CDSArchiveUtils.usedRegionSize(archiveFile, i); + aligned = CDSArchiveUtils.usedRegionSizeAligned(archiveFile, i); + } + totalSize += len; + if (location > totalSize) { + word -= (aligned - len - 16); + } + } + return word/8; + } + + // Read the mapfile and print out the lines associated with the location + static void print_diff(String mapName0, String mapName1, File archiveFile, int location) throws Exception { + FileReader f0 = new FileReader(mapName0); + BufferedReader b0 = new BufferedReader(f0); + + FileReader f1 = new FileReader(mapName1); + BufferedReader b1 = new BufferedReader(f1); + + int word = archiveByteToMapWord(archiveFile, location); + int wordOffset = word % 4; // Each line in the map file prints four words + String region = ""; + + // Skip header text and go to first line + for (int i = 0; i < HEADER_LEN; i++) { + b0.readLine(); + b1.readLine(); + } + + int line_num = HEADER_LEN; + String s0 = ""; + String s1 = ""; + int count = 0; + + // Store lines before and including the diff + ArrayDeque prefix0 = new ArrayDeque(); + ArrayDeque prefix1 = new ArrayDeque(); + + // A line may contain 1-4 words so we iterate by word + do { + s0 = b0.readLine(); + s1 = b1.readLine(); + line_num++; + + if (prefix0.size() >= NUM_LINES / 2 + 1) { + prefix0.removeFirst(); + prefix1.removeFirst(); + } + prefix0.addLast(s0); + prefix1.addLast(s1); + + // Skip lines with headers when counting words e.g. + // [rw region 0x0000000800000000 - 0x00000008005a1f88 5906312 bytes] + // or + // 0x0000000800000b28: @@ TypeArrayU1 16 + if (!s0.contains(": @@") && !s0.contains("bytes]")) { + int words = (s0.length() - LINE_OFFSET - 70) / 8; + count += words; + } else if (s0.contains("bytes]")) { + region = s0; + } + } while (count < word); + + // Print the diff with the region name above it + System.out.println("[First diff: map file #1 (" + mapName0 + ")]"); + System.out.println(region); + String diff0 = print_diff_helper(b0, wordOffset, prefix0); + + System.out.println("\n[First diff: map file #2 (" + mapName1 + ")]"); + System.out.println(region); + String diff1 = print_diff_helper(b1, wordOffset, prefix1); + + System.out.printf("\nByte #%d at line #%d word #%d:\n", location, line_num, wordOffset); + System.out.printf("%s: %s\n%s: %s\n", mapName0, diff0, mapName1, diff1); + + f0.close(); + f1.close(); + } + + static String print_diff_helper(BufferedReader b, int wordOffset, ArrayDeque prefix) throws Exception { + int start = LINE_OFFSET + WORD_LEN * wordOffset; + int end = start + WORD_LEN; + String line = prefix.getLast(); + String diff = line.substring(start, end); + + // Print previous lines + for (String s : prefix) { + if (s.equals(line)) { + System.out.println(">" + s); + } else { + System.out.println(" " + s); + } + } + + // Print extra lines + for (int i = 0; i < NUM_LINES / 2; i++) { + System.out.println(" " + b.readLine()); + } + return diff; + } } diff --git a/test/hotspot/jtreg/runtime/cds/appcds/cacheObject/ArchivedIntegerCacheTest.java b/test/hotspot/jtreg/runtime/cds/appcds/cacheObject/ArchivedIntegerCacheTest.java index 43d8568fac51..8bf3f9fcd270 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/cacheObject/ArchivedIntegerCacheTest.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/cacheObject/ArchivedIntegerCacheTest.java @@ -27,8 +27,9 @@ * @summary Test primitive box caches integrity in various scenarios (IntegerCache etc) * @requires vm.cds.write.archived.java.heap * @library /test/jdk/lib/testlibrary /test/lib /test/hotspot/jtreg/runtime/cds/appcds - * @compile CheckIntegerCacheApp.java + * @compile --add-exports java.base/jdk.internal.misc=ALL-UNNAMED CheckIntegerCacheApp.java ArchivedIntegerHolder.java * @run driver jdk.test.lib.helpers.ClassFileInstaller -jar boxCache.jar CheckIntegerCacheApp + * @run driver jdk.test.lib.helpers.ClassFileInstaller -jar boxCache-boot.jar ArchivedIntegerHolder * @run driver ArchivedIntegerCacheTest */ @@ -41,6 +42,19 @@ public class ArchivedIntegerCacheTest { + public static String[] mixArgs(String... args) { + String bootJar = ClassFileInstaller.getJarPath("boxCache-boot.jar"); + + String[] newArgs = new String[args.length + 5]; + newArgs[0] = "--add-exports"; + newArgs[1] = "java.base/jdk.internal.misc=ALL-UNNAMED"; + newArgs[2] = "-Xbootclasspath/a:" + bootJar; + newArgs[3] = "-XX:+IgnoreUnrecognizedVMOptions"; + newArgs[4] = "-XX:ArchiveHeapTestClass=ArchivedIntegerHolder"; + System.arraycopy(args, 0, newArgs, 5, args.length); + return newArgs; + } + public static void main(String[] args) throws Exception { String appJar = ClassFileInstaller.getJarPath("boxCache.jar"); @@ -51,15 +65,15 @@ public static void main(String[] args) throws Exception { // Dump default archive // OutputAnalyzer output = TestCommon.dump(appJar, - TestCommon.list("CheckIntegerCacheApp")); + TestCommon.list("CheckIntegerCacheApp"), + mixArgs()); TestCommon.checkDump(output); // Test case 1) // - Default options System.out.println("----------------------- Test case 1 ----------------------"); output = TestCommon.exec(appJar, - "CheckIntegerCacheApp", - "127"); + mixArgs("CheckIntegerCacheApp", "127")); TestCommon.checkExec(output); // Test case 2) @@ -67,9 +81,8 @@ public static void main(String[] args) throws Exception { // - Larger -XX:AutoBoxCacheMax System.out.println("----------------------- Test case 2 ----------------------"); output = TestCommon.exec(appJar, - "-XX:AutoBoxCacheMax=20000", - "CheckIntegerCacheApp", - "20000"); + mixArgs("-XX:AutoBoxCacheMax=20000", + "CheckIntegerCacheApp", "20000")); TestCommon.checkExec(output); // @@ -77,7 +90,7 @@ public static void main(String[] args) throws Exception { // output = TestCommon.dump(appJar, TestCommon.list("CheckIntegerCacheApp"), - "-XX:AutoBoxCacheMax=20000"); + mixArgs("-XX:AutoBoxCacheMax=20000")); TestCommon.checkDump(output); // Test case 3) @@ -85,10 +98,8 @@ public static void main(String[] args) throws Exception { // - Default options System.out.println("----------------------- Test case 3 ----------------------"); output = TestCommon.exec(appJar, - "--module-path", - moduleDir.toString(), - "CheckIntegerCacheApp", - "127"); + mixArgs("--module-path", moduleDir.toString(), + "CheckIntegerCacheApp", "127")); TestCommon.checkExec(output); @@ -97,11 +108,9 @@ public static void main(String[] args) throws Exception { // - Matching options System.out.println("----------------------- Test case 4 ----------------------"); output = TestCommon.exec(appJar, - "--module-path", - moduleDir.toString(), - "-XX:AutoBoxCacheMax=20000", - "CheckIntegerCacheApp", - "20000"); + mixArgs("--module-path", moduleDir.toString(), + "-XX:AutoBoxCacheMax=20000", + "CheckIntegerCacheApp", "20000")); TestCommon.checkExec(output); // Test case 5) @@ -109,23 +118,21 @@ public static void main(String[] args) throws Exception { // - Larger requested cache System.out.println("----------------------- Test case 5 ----------------------"); output = TestCommon.exec(appJar, - "--module-path", - moduleDir.toString(), - "-XX:AutoBoxCacheMax=30000", - "CheckIntegerCacheApp", - "30000"); + mixArgs("--module-path", moduleDir.toString(), + "-XX:AutoBoxCacheMax=30000", + "CheckIntegerCacheApp", "30000")); TestCommon.checkExec(output); // Test case 6) // - Cache is too large to archive output = TestCommon.dump(appJar, TestCommon.list("CheckIntegerCacheApp"), - "-XX:AutoBoxCacheMax=2000000", - "-Xmx1g", - "-XX:NewSize=1g", - "-Xlog:cds+heap=info", - "-Xlog:gc+region+cds", - "-Xlog:gc+region=trace"); + mixArgs("-XX:AutoBoxCacheMax=2000000", + "-Xmx1g", + "-XX:NewSize=1g", + "-Xlog:cds+heap=info", + "-Xlog:gc+region+cds", + "-Xlog:gc+region=trace")); TestCommon.checkDump(output, "Cannot archive the sub-graph referenced from [Ljava.lang.Integer; object"); } diff --git a/test/hotspot/jtreg/runtime/cds/appcds/cacheObject/ArchivedIntegerHolder.java b/test/hotspot/jtreg/runtime/cds/appcds/cacheObject/ArchivedIntegerHolder.java new file mode 100644 index 000000000000..c8ab0db7d34d --- /dev/null +++ b/test/hotspot/jtreg/runtime/cds/appcds/cacheObject/ArchivedIntegerHolder.java @@ -0,0 +1,38 @@ +/* + * Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +import jdk.internal.misc.CDS; + +public class ArchivedIntegerHolder { + public static Object[] archivedObjects; + static { + CDS.initializeFromArchive(ArchivedIntegerHolder.class); + if (archivedObjects == null) { + archivedObjects = new Object[256]; + for (int i = -128; i <= 127; i++) { + archivedObjects[i + 128] = Integer.valueOf(i); + } + } + } +} diff --git a/test/hotspot/jtreg/runtime/cds/appcds/cacheObject/CheckIntegerCacheApp.java b/test/hotspot/jtreg/runtime/cds/appcds/cacheObject/CheckIntegerCacheApp.java index a1d1655b32f6..7f66b2339a27 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/cacheObject/CheckIntegerCacheApp.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/cacheObject/CheckIntegerCacheApp.java @@ -62,6 +62,14 @@ public static void main(String[] args) throws Exception { } } + // Check that archived integer cache agrees with runtime integer cache. + for (int i = -128; i <= 127; i++) { + if (ArchivedIntegerHolder.archivedObjects[i + 128] != Integer.valueOf(i)) { + throw new RuntimeException( + "FAILED. Archived and runtime caches disagree for " + i); + } + } + int high = Integer.parseInt(args[0]); if (Integer.valueOf(high) != Integer.valueOf(high)) { throw new RuntimeException( diff --git a/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/LambdaProxyCallerIsHidden.java b/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/LambdaProxyCallerIsHidden.java index 583f6cf55e23..0c8cad0b3a60 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/LambdaProxyCallerIsHidden.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/LambdaProxyCallerIsHidden.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, 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 @@ -37,7 +37,8 @@ * jdk/test/lib/compiler/InMemoryJavaCompiler * jdk/test/lib/compiler/InMemoryJavaCompiler$FileManagerWrapper$1 * jdk/test/lib/compiler/InMemoryJavaCompiler$FileManagerWrapper - * jdk/test/lib/compiler/InMemoryJavaCompiler$MemoryJavaFileObject + * jdk/test/lib/compiler/InMemoryJavaCompiler$SourceFile + * jdk/test/lib/compiler/InMemoryJavaCompiler$ClassFile * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. LambdaProxyCallerIsHidden */ diff --git a/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/RedefineCallerClassTest.java b/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/RedefineCallerClassTest.java index 3d6813479690..90d403bc3802 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/RedefineCallerClassTest.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/RedefineCallerClassTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2024, 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 @@ -52,7 +52,8 @@ public class RedefineCallerClassTest extends DynamicArchiveTestBase { "jdk/test/lib/compiler/InMemoryJavaCompiler", "jdk/test/lib/compiler/InMemoryJavaCompiler$FileManagerWrapper", "jdk/test/lib/compiler/InMemoryJavaCompiler$FileManagerWrapper$1", - "jdk/test/lib/compiler/InMemoryJavaCompiler$MemoryJavaFileObject" + "jdk/test/lib/compiler/InMemoryJavaCompiler$SourceFile", + "jdk/test/lib/compiler/InMemoryJavaCompiler$ClassFile" }; public static void main(String[] args) throws Exception { diff --git a/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/RegularHiddenClass.java b/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/RegularHiddenClass.java index 3ceec349f5d7..957e4cb64797 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/RegularHiddenClass.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/dynamicArchive/RegularHiddenClass.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, 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,7 +35,8 @@ * jdk/test/lib/compiler/InMemoryJavaCompiler * jdk/test/lib/compiler/InMemoryJavaCompiler$FileManagerWrapper$1 * jdk/test/lib/compiler/InMemoryJavaCompiler$FileManagerWrapper - * jdk/test/lib/compiler/InMemoryJavaCompiler$MemoryJavaFileObject + * jdk/test/lib/compiler/InMemoryJavaCompiler$SourceFile + * jdk/test/lib/compiler/InMemoryJavaCompiler$ClassFile * @run driver jdk.test.lib.helpers.ClassFileInstaller jdk.test.whitebox.WhiteBox * @run main/othervm -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI -Xbootclasspath/a:. RegularHiddenClass */ diff --git a/test/hotspot/jtreg/runtime/cds/appcds/javaldr/AnonVmClassesDuringDump.java b/test/hotspot/jtreg/runtime/cds/appcds/javaldr/AnonVmClassesDuringDump.java deleted file mode 100644 index 4b603224a7f6..000000000000 --- a/test/hotspot/jtreg/runtime/cds/appcds/javaldr/AnonVmClassesDuringDump.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2018, 2023, 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 - * @summary When dumping the CDS archive, try to load VM anonymous classes to make sure they - * are handled properly. Note: these are not "anonymous inner classes" in the Java source code, - * but rather classes that are not recorded in any ClassLoaderData::dictionary(), - * such as classes that are generated for Lambda expressions. - * See https://blogs.oracle.com/jrose/anonymous-classes-in-the-vm. - * @library /test/lib /test/hotspot/jtreg/runtime/cds/appcds /test/hotspot/jtreg/runtime/cds/appcds/test-classes - * @requires vm.cds - * @requires vm.jvmti - * @run driver AnonVmClassesDuringDump - */ - -import jdk.test.lib.helpers.ClassFileInstaller; - -public class AnonVmClassesDuringDump { - public static String appClasses[] = { - Hello.class.getName(), - }; - public static String agentClasses[] = { - AnonVmClassesDuringDumpTransformer.class.getName(), - }; - - public static String cdsDiagnosticOption = "-XX:+AllowArchivingWithJavaAgent"; - - public static final boolean dynamicMode = - Boolean.getBoolean(System.getProperty("test.dynamic.cds.archive", "false")); - - public static void main(String[] args) throws Throwable { - String agentJar = - ClassFileInstaller.writeJar("AnonVmClassesDuringDumpTransformer.jar", - ClassFileInstaller.Manifest.fromSourceFile("AnonVmClassesDuringDumpTransformer.mf"), - agentClasses); - - String appJar = - ClassFileInstaller.writeJar("AnonVmClassesDuringDumpApp.jar", appClasses); - - TestCommon.testDump(appJar, TestCommon.list(Hello.class.getName()), - "-javaagent:" + agentJar, - "-XX:+UnlockDiagnosticVMOptions", cdsDiagnosticOption, - // Set the following property to see logs for dynamically generated classes - // in STDOUT - "-Djava.lang.invoke.MethodHandle.DUMP_CLASS_FILES=true"); - - String prefix = ".class.load. "; - // class name pattern like the following: - // jdk.internal.loader.BuiltinClassLoader$$Lambda/1816757085 - // java.lang.invoke.LambdaForm$MH/1585787493 - String class_pattern = ".*Lambda/([0-9]+).*"; - String suffix = ".*source: shared objects file.*"; - String pattern = prefix + class_pattern + suffix; - // during run time, anonymous classes shouldn't be loaded from the archive - TestCommon.run("-cp", appJar, - "-XX:+UnlockDiagnosticVMOptions", cdsDiagnosticOption, Hello.class.getName()) - .assertNormalExit(dynamicMode ? - output -> output.shouldMatch(pattern) : - output -> output.shouldNotMatch(pattern)); - - // inspect the archive and make sure no anonymous class is in there - TestCommon.run("-cp", appJar, - "-XX:+UnlockDiagnosticVMOptions", cdsDiagnosticOption, - "-XX:+PrintSharedArchiveAndExit", Hello.class.getName()) - .assertNormalExit(dynamicMode ? - output -> output.shouldMatch(pattern) : - output -> output.shouldNotMatch(pattern)); - } -} - diff --git a/test/hotspot/jtreg/runtime/cds/appcds/javaldr/AnonVmClassesDuringDumpTransformer.java b/test/hotspot/jtreg/runtime/cds/appcds/javaldr/AnonVmClassesDuringDumpTransformer.java deleted file mode 100644 index 056111ee3284..000000000000 --- a/test/hotspot/jtreg/runtime/cds/appcds/javaldr/AnonVmClassesDuringDumpTransformer.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - * - */ - -import java.lang.instrument.ClassFileTransformer; -import java.lang.instrument.Instrumentation; -import java.lang.instrument.IllegalClassFormatException; -import java.security.ProtectionDomain; - -public class AnonVmClassesDuringDumpTransformer implements ClassFileTransformer { - public byte[] transform(ClassLoader loader, String name, Class classBeingRedefined, - ProtectionDomain pd, byte[] buffer) throws IllegalClassFormatException { - return null; - } - - private static Instrumentation savedInstrumentation; - - public static void premain(String agentArguments, Instrumentation instrumentation) { - System.out.println("ClassFileTransformer.premain() is called"); - instrumentation.addTransformer(new AnonVmClassesDuringDumpTransformer(), /*canRetransform=*/true); - savedInstrumentation = instrumentation; - - // This will create a Lambda, which will result in some Anonymous VM Classes - // being generated. - // - // Look for something like these in the STDOUT: - // ---------------- - // ClassFileTransformer.premain() is called - // Dumping class files to DUMP_CLASS_FILES/... - // dump: DUMP_CLASS_FILES/java/lang/invoke/LambdaForm$MH000.class - // dump: DUMP_CLASS_FILES/java/lang/invoke/LambdaForm$MH001.class - // Invoked inside a Lambda - // ---------------- - Runnable r = () -> { - System.out.println("Invoked inside a Lambda"); - }; - r.run(); - } - - public static Instrumentation getInstrumentation() { - return savedInstrumentation; - } - - public static void agentmain(String args, Instrumentation inst) throws Exception { - premain(args, inst); - } -} diff --git a/test/hotspot/jtreg/runtime/cds/appcds/javaldr/AnonVmClassesDuringDumpTransformer.mf b/test/hotspot/jtreg/runtime/cds/appcds/javaldr/AnonVmClassesDuringDumpTransformer.mf deleted file mode 100644 index a2140595dba6..000000000000 --- a/test/hotspot/jtreg/runtime/cds/appcds/javaldr/AnonVmClassesDuringDumpTransformer.mf +++ /dev/null @@ -1,5 +0,0 @@ -Manifest-Version: 1.0 -Premain-Class: AnonVmClassesDuringDumpTransformer -Agent-Class: AnonVmClassesDuringDumpTransformer -Can-Retransform-Classes: true -Can-Redefine-Classes: true diff --git a/test/hotspot/jtreg/runtime/cds/appcds/javaldr/GCDuringDumpTransformer.java b/test/hotspot/jtreg/runtime/cds/appcds/javaldr/GCDuringDumpTransformer.java index f50be0cedb25..76a7ddd9e8e4 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/javaldr/GCDuringDumpTransformer.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/javaldr/GCDuringDumpTransformer.java @@ -34,7 +34,10 @@ public class GCDuringDumpTransformer implements ClassFileTransformer { static boolean TEST_WITH_CLEANER = Boolean.getBoolean("test.with.cleaner"); static boolean TEST_WITH_EXCEPTION = Boolean.getBoolean("test.with.exception"); static boolean TEST_WITH_OOM = Boolean.getBoolean("test.with.oom"); + + static final int WASTE_SIZE = 1024; static List waste = new ArrayList(); + static Object sink; static Cleaner cleaner; static Thread thread; @@ -59,10 +62,13 @@ public byte[] transform(ClassLoader loader, String name, Class classBeingRede return new byte[] {1, 2, 3, 4, 5, 6, 7, 8}; } if (TEST_WITH_OOM) { - // fill until OOM + // Fill until OOM and fail. This sets up heap for secondary OOM + // later on, which should be caught by CDS code. The size of waste + // array defines how much max free space would be left for later + // code to run with. System.out.println("Fill objects until OOM"); - for (;;) { - waste.add(new byte[64*1024]); + while (true) { + waste.add(new byte[WASTE_SIZE]); } } } @@ -104,8 +110,8 @@ public static void agentmain(String args, Instrumentation inst) throws Exception } public static void makeGarbage() { - for (int x=0; x<10; x++) { - Object[] a = new Object[10000]; + for (int x = 0; x < 10; x++) { + sink = new byte[WASTE_SIZE]; } } @@ -115,7 +121,7 @@ static class MyCleaner implements Runnable { public void run() { // Allocate something. This will cause G1 to allocate an EDEN region. // See JDK-8245925 - Object o = new Object(); + sink = new Object(); System.out.println("cleaning " + i); } } diff --git a/test/hotspot/jtreg/runtime/cds/appcds/redefineClass/RedefineBasicTest.java b/test/hotspot/jtreg/runtime/cds/appcds/redefineClass/RedefineBasicTest.java index 81d6e20321ec..acbd0c948bef 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/redefineClass/RedefineBasicTest.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/redefineClass/RedefineBasicTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -47,7 +47,8 @@ public class RedefineBasicTest { "jdk/test/lib/compiler/InMemoryJavaCompiler", "jdk/test/lib/compiler/InMemoryJavaCompiler$FileManagerWrapper", "jdk/test/lib/compiler/InMemoryJavaCompiler$FileManagerWrapper$1", - "jdk/test/lib/compiler/InMemoryJavaCompiler$MemoryJavaFileObject" + "jdk/test/lib/compiler/InMemoryJavaCompiler$SourceFile", + "jdk/test/lib/compiler/InMemoryJavaCompiler$ClassFile" }; public static void main(String[] args) throws Exception { diff --git a/test/hotspot/jtreg/runtime/cds/appcds/redefineClass/RedefineRunningMethods_Shared.java b/test/hotspot/jtreg/runtime/cds/appcds/redefineClass/RedefineRunningMethods_Shared.java index d84593596043..039aaef11cd1 100644 --- a/test/hotspot/jtreg/runtime/cds/appcds/redefineClass/RedefineRunningMethods_Shared.java +++ b/test/hotspot/jtreg/runtime/cds/appcds/redefineClass/RedefineRunningMethods_Shared.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2024, 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 @@ -48,7 +48,8 @@ public class RedefineRunningMethods_Shared { "jdk/test/lib/compiler/InMemoryJavaCompiler", "jdk/test/lib/compiler/InMemoryJavaCompiler$FileManagerWrapper", "jdk/test/lib/compiler/InMemoryJavaCompiler$FileManagerWrapper$1", - "jdk/test/lib/compiler/InMemoryJavaCompiler$MemoryJavaFileObject" + "jdk/test/lib/compiler/InMemoryJavaCompiler$SourceFile", + "jdk/test/lib/compiler/InMemoryJavaCompiler$ClassFile" }; public static void main(String[] args) throws Exception { diff --git a/test/hotspot/jtreg/runtime/clinit/libClassInitBarrier.cpp b/test/hotspot/jtreg/runtime/clinit/libClassInitBarrier.cpp index 521c51ce6afc..dce5c1057a8f 100644 --- a/test/hotspot/jtreg/runtime/clinit/libClassInitBarrier.cpp +++ b/test/hotspot/jtreg/runtime/clinit/libClassInitBarrier.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2024, 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 @@ -39,38 +39,38 @@ static jfieldID test_A_f_id; extern "C" { JNIEXPORT jboolean JNICALL Java_ClassInitBarrier_init(JNIEnv* env, jclass cls) { jclass runnable = env->FindClass("java/lang/Runnable"); - if (runnable == NULL) return JNI_FALSE; + if (runnable == nullptr) return JNI_FALSE; methodId = env->GetMethodID(runnable, "run", "()V"); - if (methodId == NULL) return JNI_FALSE; + if (methodId == nullptr) return JNI_FALSE; return JNI_TRUE; } JNIEXPORT jboolean JNICALL Java_ClassInitBarrier_00024Test_00024A_init(JNIEnv* env, jclass cls, jclass arg1) { test_class_A = (jclass)env->NewGlobalRef(cls); - if (test_class_A == NULL) return JNI_FALSE; + if (test_class_A == nullptr) return JNI_FALSE; test_class_B = (jclass)env->NewGlobalRef(arg1); - if (test_class_B == NULL) return JNI_FALSE; + if (test_class_B == nullptr) return JNI_FALSE; test_staticM_id = env->GetStaticMethodID(test_class_A, "staticM", "(Ljava/lang/Runnable;)V"); - if (test_staticM_id == NULL) return JNI_FALSE; + if (test_staticM_id == nullptr) return JNI_FALSE; test_staticS_id = env->GetStaticMethodID(test_class_A, "staticS", "(Ljava/lang/Runnable;)V"); - if (test_staticS_id == NULL) return JNI_FALSE; + if (test_staticS_id == nullptr) return JNI_FALSE; test_staticN_id = env->GetStaticMethodID(test_class_A, "staticN", "(Ljava/lang/Runnable;)V"); - if (test_staticN_id == NULL) return JNI_FALSE; + if (test_staticN_id == nullptr) return JNI_FALSE; test_A_m_id = env->GetMethodID(test_class_A, "m", "()V"); - if (test_A_m_id == NULL) return JNI_FALSE; + if (test_A_m_id == nullptr) return JNI_FALSE; test_staticF_id = env->GetStaticFieldID(test_class_A, "staticF", "I"); - if (test_staticF_id == NULL) return JNI_FALSE; + if (test_staticF_id == nullptr) return JNI_FALSE; test_A_f_id = env->GetFieldID(test_class_A, "f", "I"); - if (test_A_f_id == NULL) return JNI_FALSE; + if (test_A_f_id == nullptr) return JNI_FALSE; return JNI_TRUE; } @@ -105,11 +105,11 @@ extern "C" { JNIEXPORT jobject JNICALL Java_ClassInitBarrier_00024Test_testNewInstanceAJNI(JNIEnv* env, jclass cls, jobject action) { jobject obj = env->AllocObject(test_class_A); // A obj = new A(); if (env->ExceptionOccurred()) { - return NULL; - } else if (obj == NULL) { + return nullptr; + } else if (obj == nullptr) { jclass errorClass = env->FindClass("java/lang/AssertionError"); int ret = env->ThrowNew(errorClass, "JNI: AllocObject: allocation failed, but no exception thrown"); - return NULL; + return nullptr; } env->CallVoidMethod(action, methodId); // action.run(); return obj; @@ -118,11 +118,11 @@ extern "C" { JNIEXPORT jobject JNICALL Java_ClassInitBarrier_00024Test_testNewInstanceBJNI(JNIEnv* env, jclass cls, jobject action) { jobject obj = env->AllocObject(test_class_B); // B obj = new B(); if (env->ExceptionOccurred()) { - return NULL; - } else if (obj == NULL) { + return nullptr; + } else if (obj == nullptr) { jclass errorClass = env->FindClass("java/lang/AssertionError"); int ret = env->ThrowNew(errorClass, "JNI: AllocObject: allocation failed, but no exception thrown"); - return NULL; + return nullptr; } env->CallVoidMethod(action, methodId); // action.run(); return obj; diff --git a/test/hotspot/jtreg/runtime/condy/BadBSMUseTest.java b/test/hotspot/jtreg/runtime/condy/BadBSMUseTest.java index a07c98caa663..3e36d1aebd9c 100644 --- a/test/hotspot/jtreg/runtime/condy/BadBSMUseTest.java +++ b/test/hotspot/jtreg/runtime/condy/BadBSMUseTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,6 @@ * @test * @bug 8186211 * @summary CONSTANT_Dynamic_info structure's tries to use a BSM index whose signature is for an invokedynamic and vice versa. - * @requires vm.flagless * @modules java.base/jdk.internal.misc * @library /test/lib * @compile CondyUsesIndyBSM.jcod @@ -42,7 +41,7 @@ public class BadBSMUseTest { public static void main(String args[]) throws Throwable { // 1. Test a CONSTANT_Dynamic_info's bootstrap_method_attr_index points // at a BSM meant for a CONSTANT_InvokeDynamic_info - ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("CondyUsesIndyBSM"); + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder("CondyUsesIndyBSM"); OutputAnalyzer oa = new OutputAnalyzer(pb.start()); oa.shouldContain("In Indybsm target CallSite method foo"); oa.shouldContain("BootstrapMethodError: bootstrap method initialization exception"); @@ -50,7 +49,7 @@ public static void main(String args[]) throws Throwable { // 2. Test a CONSTANT_InvokeDynamic_info's bootstrap_method_attr_index points // at a BSM meant for a CONSTANT_Dynamic_info - pb = ProcessTools.createLimitedTestJavaProcessBuilder("IndyUsesCondyBSM"); + pb = ProcessTools.createTestJavaProcessBuilder("IndyUsesCondyBSM"); oa = new OutputAnalyzer(pb.start()); oa.shouldContain("In Condybsm"); oa.shouldContain("BootstrapMethodError: bootstrap method initialization exception"); diff --git a/test/hotspot/jtreg/runtime/condy/CondyLDCTest.java b/test/hotspot/jtreg/runtime/condy/CondyLDCTest.java index 22cfb727eb8b..1b045d1e36e7 100644 --- a/test/hotspot/jtreg/runtime/condy/CondyLDCTest.java +++ b/test/hotspot/jtreg/runtime/condy/CondyLDCTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,6 @@ * @test * @bug 8186211 * @summary Tests various ldc, ldc_w, ldc2_w instructions of CONSTANT_Dynamic. - * @requires vm.flagless * @modules java.base/jdk.internal.misc * @library /test/lib * @compile CondyUseLDC_W.jasm @@ -42,7 +41,7 @@ public class CondyLDCTest { public static void main(String args[]) throws Throwable { // 1. Test a ldc_w instruction can be used with condy's which generate // loadable constants of the following types: byte, char, short, float, integer, boolean. - ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xverify:all", + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder("-Xverify:all", "CondyUseLDC_W"); OutputAnalyzer oa = new OutputAnalyzer(pb.start()); oa.shouldNotContain("VerifyError"); @@ -50,7 +49,7 @@ public static void main(String args[]) throws Throwable { // 2. Test ldc2_w of a condy which returns a dynamically generated // float constant, generates a VerifyError. - pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xverify:all", + pb = ProcessTools.createTestJavaProcessBuilder("-Xverify:all", "CondyBadLDC2_W"); oa = new OutputAnalyzer(pb.start()); oa.shouldContain("java.lang.VerifyError: Illegal type at constant pool entry"); @@ -59,7 +58,7 @@ public static void main(String args[]) throws Throwable { // 3. Test a ldc of a condy which returns a dynamically generated // double constant, generates a VerifyError. - pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xverify:all", + pb = ProcessTools.createTestJavaProcessBuilder("-Xverify:all", "CondyBadLDC"); oa = new OutputAnalyzer(pb.start()); oa.shouldContain("java.lang.VerifyError: Illegal type at constant pool entry"); diff --git a/test/hotspot/jtreg/runtime/condy/CondyNewInvokeSpecialTest.java b/test/hotspot/jtreg/runtime/condy/CondyNewInvokeSpecialTest.java index 6e810d0d3b88..ddada0edbf7b 100644 --- a/test/hotspot/jtreg/runtime/condy/CondyNewInvokeSpecialTest.java +++ b/test/hotspot/jtreg/runtime/condy/CondyNewInvokeSpecialTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,6 @@ * @test * @bug 8186211 * @summary Test CONSTANT_Dynamic where the BSM is invoked via a REF_newInvokeSpecial. - * @requires vm.flagless * @modules java.base/jdk.internal.misc * @library /test/lib * @compile CondyNewInvokeSpecial.jasm @@ -38,7 +37,7 @@ public class CondyNewInvokeSpecialTest { public static void main(String args[]) throws Throwable { - ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("-Xverify:all", + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder("-Xverify:all", "CondyNewInvokeSpecial"); OutputAnalyzer oa = new OutputAnalyzer(pb.start()); oa.shouldContain("In CondyNewInvokeSpecial method"); diff --git a/test/hotspot/jtreg/runtime/condy/escapeAnalysis/TestEscapeCondy.java b/test/hotspot/jtreg/runtime/condy/escapeAnalysis/TestEscapeCondy.java index 877a805c445f..a90b987db146 100644 --- a/test/hotspot/jtreg/runtime/condy/escapeAnalysis/TestEscapeCondy.java +++ b/test/hotspot/jtreg/runtime/condy/escapeAnalysis/TestEscapeCondy.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,6 @@ * @bug 8216970 * @summary Ensure escape analysis can handle an ldc of a dynamic * constant whose return type is an array of boolean. - * @requires vm.flagless * @modules java.base/jdk.internal.misc * @library /test/lib * @compile TestEscapeThroughInvokeWithCondy$A.jasm @@ -43,7 +42,7 @@ public class TestEscapeCondy { public static void main(String args[]) throws Throwable { // 1. Test escape analysis of a method that contains // a ldc instruction of a condy whose return type is an array of boolean - ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder( + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder( "-XX:CompileCommand=dontinline,runtime.condy.TestEscapeThroughInvokeWithCondy::create", "runtime.condy.TestEscapeThroughInvokeWithCondy"); OutputAnalyzer oa = new OutputAnalyzer(pb.start()); diff --git a/test/hotspot/jtreg/runtime/condy/staticInit/TestInitException.java b/test/hotspot/jtreg/runtime/condy/staticInit/TestInitException.java index 2b572edb66fe..412a1639e69c 100644 --- a/test/hotspot/jtreg/runtime/condy/staticInit/TestInitException.java +++ b/test/hotspot/jtreg/runtime/condy/staticInit/TestInitException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,6 @@ * @test * @bug 8228485 * @summary Correctly handle initialization error for Condy BSM. - * @requires vm.flagless * @modules java.base/jdk.internal.misc * @library /test/lib * @compile Example.jasm @@ -38,7 +37,7 @@ public class TestInitException { public static void main(java.lang.String[] unused) throws Exception { - ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("Example"); + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder("Example"); OutputAnalyzer oa = new OutputAnalyzer(pb.start()); // First call stack trace // shouldMatch is used to workaround CODETOOLS-7902686 @@ -52,4 +51,3 @@ public static void main(java.lang.String[] unused) throws Exception { oa.shouldHaveExitValue(1); } } - diff --git a/test/hotspot/jtreg/runtime/exceptionMsgs/LongExceptionMessageTest.java b/test/hotspot/jtreg/runtime/exceptionMsgs/LongExceptionMessageTest.java index 24342a4ccf80..8684ffb0614d 100644 --- a/test/hotspot/jtreg/runtime/exceptionMsgs/LongExceptionMessageTest.java +++ b/test/hotspot/jtreg/runtime/exceptionMsgs/LongExceptionMessageTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/hotspot/jtreg/runtime/modules/ModulesSymLink.java b/test/hotspot/jtreg/runtime/modules/ModulesSymLink.java index 5dcbc3154660..f19897f96388 100644 --- a/test/hotspot/jtreg/runtime/modules/ModulesSymLink.java +++ b/test/hotspot/jtreg/runtime/modules/ModulesSymLink.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/hotspot/jtreg/runtime/os/windows/TestAvailableProcessors.java b/test/hotspot/jtreg/runtime/os/windows/TestAvailableProcessors.java index f7dc237d07df..795b3d76e545 100644 --- a/test/hotspot/jtreg/runtime/os/windows/TestAvailableProcessors.java +++ b/test/hotspot/jtreg/runtime/os/windows/TestAvailableProcessors.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,18 +31,14 @@ * @requires vm.flagless * @library /test/lib * @compile GetAvailableProcessors.java - * @run testng TestAvailableProcessors + * @run testng/othervm/native TestAvailableProcessors */ import java.io.IOException; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.ArrayList; import java.util.List; import java.util.HashSet; import java.util.Set; -import jdk.test.lib.Utils; import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.process.ProcessTools; @@ -172,12 +168,8 @@ private static void verifyAvailableProcessorsWithEnabledProductFlag(boolean sche @Test private static void testProcessorAvailability() throws IOException { - // Launch GetProcessorInfo.exe to gather processor counts - Path nativeGetProcessorInfo = Paths.get(Utils.TEST_NATIVE_PATH) - .resolve("GetProcessorInfo.exe") - .toAbsolutePath(); - - var processBuilder = new ProcessBuilder(nativeGetProcessorInfo.toString()); + // Launch "/GetProcessorInfo.exe" to gather processor counts + var processBuilder = new ProcessBuilder("GetProcessorInfo.exe"); var outputAnalyzer= new OutputAnalyzer(processBuilder.start()); outputAnalyzer.shouldHaveExitValue(0); outputAnalyzer.shouldContain(totalProcessorCountMessage); diff --git a/test/hotspot/jtreg/runtime/stringtable/StringTableCorruptionTest.java b/test/hotspot/jtreg/runtime/stringtable/StringTableCorruptionTest.java new file mode 100644 index 000000000000..e4d6a2e5d0f9 --- /dev/null +++ b/test/hotspot/jtreg/runtime/stringtable/StringTableCorruptionTest.java @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2024, 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 8333356 + * @summary Verify new error message for corrupting string table contents. + * @requires vm.flagless + * @modules java.base/java.lang:open + * @library /test/lib + * @modules java.base/jdk.internal.misc + * @run driver StringTableCorruptionTest test + */ + +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; + +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; + +public class StringTableCorruptionTest { + public static void main(String[] args) throws Exception { + if (args.length > 0) { + ProcessBuilder pb = ProcessTools.createLimitedTestJavaProcessBuilder("--add-opens", "java.base/java.lang=ALL-UNNAMED", + "-XX:-CreateCoredumpOnCrash", "StringTableCorruptionTest"); + OutputAnalyzer output = new OutputAnalyzer(pb.start()); + output.shouldContain("Node hash code has changed possibly due to corruption of the contents."); + output.shouldNotHaveExitValue(0); + return; + } + + Field f = String.class.getDeclaredField("value"); + f.setAccessible(true); + f.set("s1".intern(), f.get("s2")); + for (int i = 0; i < 4_000_000; i++) { + ("s_" + i).intern(); + } + } +} diff --git a/test/hotspot/jtreg/serviceability/AsyncGetCallTrace/libAsyncGetCallTraceTest.cpp b/test/hotspot/jtreg/serviceability/AsyncGetCallTrace/libAsyncGetCallTraceTest.cpp index e8886f4bb678..ccdaf985d579 100644 --- a/test/hotspot/jtreg/serviceability/AsyncGetCallTrace/libAsyncGetCallTraceTest.cpp +++ b/test/hotspot/jtreg/serviceability/AsyncGetCallTrace/libAsyncGetCallTraceTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2019, Google and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -35,7 +35,7 @@ template class JvmtiDeallocator { public: JvmtiDeallocator() { - elem_ = NULL; + elem_ = nullptr; } ~JvmtiDeallocator() { @@ -100,7 +100,7 @@ extern "C" { static jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { fprintf(stderr, "Error: wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -129,13 +129,13 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, nullptr); if (err != JVMTI_ERROR_NONE) { fprintf(stderr, "AgentInitialize: Error in SetEventNotificationMode for CLASS_LOAD: %d\n", err); return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_PREPARE, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_PREPARE, nullptr); if (err != JVMTI_ERROR_NONE) { fprintf(stderr, "AgentInitialize: Error in SetEventNotificationMode for CLASS_PREPARE: %d\n", @@ -143,7 +143,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, nullptr); if (err != JVMTI_ERROR_NONE) { fprintf( stderr, "AgentInitialize: Error in SetEventNotificationMode for VM_INIT: %d\n", @@ -194,12 +194,12 @@ Java_MyPackage_ASGCTBaseTest_checkAsyncGetCallTraceCall(JNIEnv* env, jclass cls) trace.env_id = env; trace.num_frames = 0; - if (agct == NULL) { + if (agct == nullptr) { fprintf(stderr, "AsyncGetCallTrace not found.\n"); return false; } - agct(&trace, MAX_DEPTH, NULL); + agct(&trace, MAX_DEPTH, nullptr); // For now, just check that the first frame is (-3, checkAsyncGetCallTraceCall). if (trace.num_frames <= 0) { @@ -214,19 +214,19 @@ Java_MyPackage_ASGCTBaseTest_checkAsyncGetCallTraceCall(JNIEnv* env, jclass cls) } JvmtiDeallocator name; - if (trace.frames[0].method_id == NULL) { - fprintf(stderr, "First frame method_id is NULL\n"); + if (trace.frames[0].method_id == nullptr) { + fprintf(stderr, "First frame method_id is null\n"); return false; } - jvmtiError err = jvmti->GetMethodName(trace.frames[0].method_id, name.get_addr(), NULL, NULL); + jvmtiError err = jvmti->GetMethodName(trace.frames[0].method_id, name.get_addr(), nullptr, nullptr); if (err != JVMTI_ERROR_NONE) { fprintf(stderr, "checkAsyncGetCallTrace: Error in GetMethodName: %d\n", err); return false; } - if (name.get() == NULL) { - fprintf(stderr, "Name is NULL\n"); + if (name.get() == nullptr) { + fprintf(stderr, "Name is null\n"); return false; } diff --git a/test/hotspot/jtreg/serviceability/dcmd/compiler/CodeCacheTest.java b/test/hotspot/jtreg/serviceability/dcmd/compiler/CodeCacheTest.java index 8b3a8d8a47d1..885cfd55be49 100644 --- a/test/hotspot/jtreg/serviceability/dcmd/compiler/CodeCacheTest.java +++ b/test/hotspot/jtreg/serviceability/dcmd/compiler/CodeCacheTest.java @@ -55,27 +55,28 @@ public class CodeCacheTest { * * Expected output without code cache segmentation: * - * CodeCache: size=245760Kb used=4680Kb max_used=4680Kb free=241079Kb - * bounds [0x00007f5bd9000000, 0x00007f5bd94a0000, 0x00007f5be8000000] - * total_blobs=575 nmethods=69 adapters=423 - * compilation: enabled + * CodeCache: size=245760Kb used=1366Kb max_used=1935Kb free=244393Kb + * bounds [0x00007ff4d89f2000, 0x00007ff4d8c62000, 0x00007ff4e79f2000] + * total_blobs=474, nmethods=87, adapters=293, full_count=0 + * Compilation: enabled, stopped_count=0, restarted_count=0 * * Expected output with code cache segmentation (number of segments may change): * - * CodeHeap 'non-nmethods': size=5696Kb used=2236Kb max_used=2238Kb free=3459Kb - * bounds [0x00007fa0f0ffe000, 0x00007fa0f126e000, 0x00007fa0f158e000] - * CodeHeap 'profiled nmethods': size=120036Kb used=8Kb max_used=8Kb free=120027Kb - * bounds [0x00007fa0f158e000, 0x00007fa0f17fe000, 0x00007fa0f8ac7000] - * CodeHeap 'non-profiled nmethods': size=120036Kb used=2Kb max_used=2Kb free=120034Kb - * bounds [0x00007fa0f8ac7000, 0x00007fa0f8d37000, 0x00007fa100000000] - * total_blobs=486 nmethods=8 adapters=399 - * compilation: enabled + * CodeHeap 'non-profiled nmethods': size=118592Kb used=29Kb max_used=29Kb free=118562Kb + * bounds [0x00007f09f8622000, 0x00007f09f8892000, 0x00007f09ff9f2000] + * CodeHeap 'profiled nmethods': size=118588Kb used=80Kb max_used=80Kb free=118507Kb + * bounds [0x00007f09f09f2000, 0x00007f09f0c62000, 0x00007f09f7dc1000] + * CodeHeap 'non-nmethods': size=8580Kb used=1257Kb max_used=1833Kb free=7323Kb + * bounds [0x00007f09f7dc1000, 0x00007f09f8031000, 0x00007f09f8622000] + * CodeCache: size=245760Kb, used=1366Kb, max_used=1942Kb, free=244392Kb + * total_blobs=474, nmethods=87, adapters=293, full_count=0 + * Compilation: enabled, stopped_count=0, restarted_count=0 */ static Pattern line1 = Pattern.compile("(CodeCache|CodeHeap.*): size=(\\p{Digit}*)Kb used=(\\p{Digit}*)Kb max_used=(\\p{Digit}*)Kb free=(\\p{Digit}*)Kb"); static Pattern line2 = Pattern.compile(" bounds \\[0x(\\p{XDigit}*), 0x(\\p{XDigit}*), 0x(\\p{XDigit}*)\\]"); - static Pattern line3 = Pattern.compile(" total_blobs=(\\p{Digit}*) nmethods=(\\p{Digit}*) adapters=(\\p{Digit}*)"); - static Pattern line4 = Pattern.compile(" compilation: (.*)"); + static Pattern line3 = Pattern.compile(" total_blobs=(\\p{Digit}*), nmethods=(\\p{Digit}*), adapters=(\\p{Digit}*), full_count=(\\p{Digit}*)"); + static Pattern line4 = Pattern.compile("Compilation: (.*?), stopped_count=(\\p{Digit}*), restarted_count=(\\p{Digit}*)"); private static boolean getFlagBool(String flag, String where) { Matcher m = Pattern.compile(flag + "\\s+:?= (true|false)").matcher(where); @@ -157,6 +158,10 @@ public void run(CommandExecutor executor) { Assert.fail("Fewer segments matched (" + matchedCount + ") than expected (" + segmentsCount + ")"); } + if (segmentsCount != 1) { + // Skip this line CodeCache: size=245760Kb, used=5698Kb, max_used=5735Kb, free=240059Kb + line = lines.next(); + } // Validate third line m = line3.matcher(line); if (m.matches()) { @@ -182,7 +187,19 @@ public void run(CommandExecutor executor) { // Validate fourth line line = lines.next(); m = line4.matcher(line); - if (!m.matches()) { + if (m.matches()) { + if (!m.group(1).contains("enabled") && !m.group(1).contains("disabled")) { + Assert.fail("Failed parsing dcmd codecache output"); + } + int stopped = Integer.parseInt(m.group(2)); + if (stopped < 0) { + Assert.fail("Failed parsing dcmd codecache output"); + } + int restarted = Integer.parseInt(m.group(3)); + if (restarted < 0) { + Assert.fail("Failed parsing dcmd codecache output"); + } + } else { Assert.fail("Regexp 4 failed to match line: " + line); } } diff --git a/test/hotspot/jtreg/serviceability/dcmd/thread/PrintTest.java b/test/hotspot/jtreg/serviceability/dcmd/thread/PrintTest.java index e4af11c32615..29c462a56b39 100644 --- a/test/hotspot/jtreg/serviceability/dcmd/thread/PrintTest.java +++ b/test/hotspot/jtreg/serviceability/dcmd/thread/PrintTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,6 +21,7 @@ * questions. */ +import org.testng.SkipException; import org.testng.annotations.Test; import org.testng.Assert; @@ -171,6 +172,9 @@ public void run(CommandExecutor executor) { @Test public void jmx() { + if (Thread.currentThread().isVirtual()) { + throw new SkipException("skipping test since current thread is virtual thread"); + } run(new JMXExecutor()); } } diff --git a/test/hotspot/jtreg/serviceability/dcmd/vm/SystemDumpMapTest.java b/test/hotspot/jtreg/serviceability/dcmd/vm/SystemDumpMapTest.java new file mode 100644 index 000000000000..8b0ba3def4c6 --- /dev/null +++ b/test/hotspot/jtreg/serviceability/dcmd/vm/SystemDumpMapTest.java @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2024, Red Hat, Inc. and/or its affiliates. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import org.testng.annotations.Test; +import jdk.test.lib.dcmd.CommandExecutor; +import jdk.test.lib.dcmd.JMXExecutor; +import jdk.test.lib.process.OutputAnalyzer; + +import java.io.*; +import java.util.HashSet; +import java.util.regex.Pattern; + +/* + * @test + * @summary Test of diagnostic command System.map + * @library /test/lib + * @requires (os.family=="linux") + * @modules java.base/jdk.internal.misc + * java.compiler + * java.management + * jdk.internal.jvmstat/sun.jvmstat.monitor + * @run testng/othervm -XX:+UsePerfData SystemDumpMapTest + */ +public class SystemDumpMapTest extends SystemMapTestBase { + + private void run_test(CommandExecutor executor, boolean useDefaultFileName) { + + String filenameOption = useDefaultFileName ? "" : "-F=test-map.txt"; + + OutputAnalyzer output = executor.execute("System.dump_map " + filenameOption); + output.reportDiagnosticSummary(); + + String filename = useDefaultFileName ? + output.firstMatch("Memory map dumped to \"(\\S*vm_memory_map_\\d+\\.txt)\".*", 1) : + output.firstMatch("Memory map dumped to \"(\\S*test-map.txt)\".*", 1); + + if (filename == null) { + throw new RuntimeException("Did not find dump file in output.\n"); + } + + try (BufferedReader reader = new BufferedReader(new FileReader(filename))) { + boolean NMTOff = output.getOutput().contains("NMT is disabled"); + String regexBase = ".*0x\\p{XDigit}+ - 0x\\p{XDigit}+ +\\d+"; + HashSet patterns = new HashSet<>(); + for (String s: shouldMatchUnconditionally) { + patterns.add(Pattern.compile(s)); + } + if (!NMTOff) { // expect VM annotations if NMT is on + for (String s: shouldMatchIfNMTIsEnabled) { + patterns.add(Pattern.compile(s)); + } + } + + do { + String line = reader.readLine(); + if (line != null) { + System.out.println(" " + line); + for (Pattern pat : patterns) { + if (pat.matcher(line).matches()) { + System.out.println(">>> matches " + pat); + patterns.remove(pat); + break; + } + } + } else { + break; + } + } while (patterns.size() > 0); + + if (patterns.size() > 0) { + System.out.println("Missing patterns in dump:"); + for (Pattern pat : patterns) { + System.out.println(pat); + } + throw new RuntimeException("Missing patterns"); + } + + } catch (Exception e) { + throw new RuntimeException(e); + } + + } + + public void run(CommandExecutor executor) { + run_test(executor, false); + run_test(executor, true); + } + + @Test + public void jmx() { + run(new JMXExecutor()); + } +} diff --git a/test/hotspot/jtreg/serviceability/dcmd/vm/SystemMapTest.java b/test/hotspot/jtreg/serviceability/dcmd/vm/SystemMapTest.java new file mode 100644 index 000000000000..de02e9e9d5c2 --- /dev/null +++ b/test/hotspot/jtreg/serviceability/dcmd/vm/SystemMapTest.java @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2024, Red Hat, Inc. and/or its affiliates. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import org.testng.annotations.Test; +import jdk.test.lib.dcmd.CommandExecutor; +import jdk.test.lib.dcmd.JMXExecutor; +import jdk.test.lib.process.OutputAnalyzer; + +/* + * @test + * @summary Test of diagnostic command System.map + * @library /test/lib + * @requires (os.family=="linux") + * @modules java.base/jdk.internal.misc + * java.compiler + * java.management + * jdk.internal.jvmstat/sun.jvmstat.monitor + * @run testng/othervm -XX:+UsePerfData SystemMapTest + */ +public class SystemMapTest extends SystemMapTestBase { + public void run(CommandExecutor executor) { + OutputAnalyzer output = executor.execute("System.map"); + boolean NMTOff = output.getOutput().contains("NMT is disabled"); + for (String s: shouldMatchUnconditionally) { + output.shouldMatch(s); + } + if (!NMTOff) { // expect VM annotations if NMT is on + for (String s: shouldMatchIfNMTIsEnabled) { + output.shouldMatch(s); + } + } + } + + @Test + public void jmx() { + run(new JMXExecutor()); + } +} diff --git a/test/hotspot/jtreg/serviceability/dcmd/vm/SystemMapTestBase.java b/test/hotspot/jtreg/serviceability/dcmd/vm/SystemMapTestBase.java new file mode 100644 index 000000000000..3d1284b09eee --- /dev/null +++ b/test/hotspot/jtreg/serviceability/dcmd/vm/SystemMapTestBase.java @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, Red Hat, Inc. and/or its affiliates. + * 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. + */ + +public class SystemMapTestBase { + + // e.g. + // 0x00000007ff800000-0x00000007ff91a000 1155072 rw-p 1155072 0 4K com JAVAHEAP /shared/projects/openjdk/jdk-jdk/output-fastdebug/images/jdk/lib/server/classes.jsa + private static final String range = "0x\\p{XDigit}+-0x\\p{XDigit}+"; + private static final String space = " +"; + private static final String someSize = "\\d+"; + private static final String pagesize = "(4K|8K|16K|64K|2M|16M|64M)"; + private static final String prot = "[rwsxp-]+"; + + private static final String regexBase = range + space + + someSize + space + + prot + space + + someSize + space + + someSize + space + + pagesize + space; + + private static final String regexBase_committed = regexBase + "com.*"; + private static final String regexBase_shared_and_committed = regexBase + "shrd,com.*"; + + // java heap is either committed, non-shared, or - in case of ZGC - committed and shared. + private static final String regexBase_java_heap = regexBase + "(shrd,)?com.*"; + protected static final String shouldMatchUnconditionally[] = { + // java launcher + regexBase_committed + "/bin/java", + // libjvm + regexBase_committed + "/lib/.*/libjvm.so", + // heap segment, should be part of all user space apps on all architectures OpenJDK supports. + regexBase_committed + "\\[heap\\]", + // we should see the hs-perf data file, and it should appear as shared as well as committed + regexBase_shared_and_committed + "hsperfdata_.*" + }; + + protected static final String shouldMatchIfNMTIsEnabled[] = { + regexBase_java_heap + "JAVAHEAP.*", + // metaspace + regexBase_committed + "META.*", + // parts of metaspace should be uncommitted + regexBase + "-" + space + "META.*", + // code cache + regexBase_committed + "CODE.*", + // Main thread stack + regexBase_committed + "STACK.*main.*" + }; +} diff --git a/test/hotspot/jtreg/serviceability/jvmti/CompiledMethodLoad/libCompiledZombie.cpp b/test/hotspot/jtreg/serviceability/jvmti/CompiledMethodLoad/libCompiledZombie.cpp index fbff3c847f15..3bf2988dd0fe 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/CompiledMethodLoad/libCompiledZombie.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/CompiledMethodLoad/libCompiledZombie.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2024, 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 @@ -45,7 +45,7 @@ void JNICALL CompiledMethodLoad(jvmtiEnv* jvmti, jmethodID method, // Continuously generate CompiledMethodLoad events for all currently compiled methods void JNICALL GenerateEventsThread(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, NULL); + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, nullptr); int count = 0; while (true) { @@ -64,7 +64,7 @@ void JNICALL VMInit(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { jmethodID thread_constructor = jni->GetMethodID(thread_class, "", "()V"); jthread agent_thread = jni->NewObject(thread_class, thread_constructor); - jvmti->RunAgentThread(agent_thread, GenerateEventsThread, NULL, JVMTI_THREAD_NORM_PRIORITY); + jvmti->RunAgentThread(agent_thread, GenerateEventsThread, nullptr, JVMTI_THREAD_NORM_PRIORITY); } JNIEXPORT @@ -83,7 +83,7 @@ jint JNICALL Agent_OnLoad(JavaVM* vm, char* options, void* reserved) { callbacks.VMInit = VMInit; callbacks.CompiledMethodLoad = CompiledMethodLoad; jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks)); - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL); + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, nullptr); return 0; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/DynamicCodeGenerated/libDynamicCodeGenerated.cpp b/test/hotspot/jtreg/serviceability/jvmti/DynamicCodeGenerated/libDynamicCodeGenerated.cpp index 6ede1fe2eb96..5e8e026dbbac 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/DynamicCodeGenerated/libDynamicCodeGenerated.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/DynamicCodeGenerated/libDynamicCodeGenerated.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2024, 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,9 +23,9 @@ #include #include -#include "jvmti_common.h" +#include "jvmti_common.hpp" -static jvmtiEnv* jvmti = NULL; +static jvmtiEnv* jvmti = nullptr; #ifdef __cplusplus extern "C" { @@ -34,8 +34,8 @@ extern "C" { JNIEXPORT void JNICALL Java_DynamicCodeGeneratedTest_changeEventNotificationMode(JNIEnv* jni, jclass cls) { while (true) { - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_DYNAMIC_CODE_GENERATED, NULL); - jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_DYNAMIC_CODE_GENERATED, NULL); + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_DYNAMIC_CODE_GENERATED, nullptr); + jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_DYNAMIC_CODE_GENERATED, nullptr); } } diff --git a/test/hotspot/jtreg/serviceability/jvmti/FollowReferences/FieldIndices/libFieldIndicesTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/FollowReferences/FieldIndices/libFieldIndicesTest.cpp index 042edbc67922..b8d83eb50853 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/FollowReferences/FieldIndices/libFieldIndicesTest.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/FollowReferences/FieldIndices/libFieldIndicesTest.cpp @@ -24,7 +24,7 @@ #include #include #include "jvmti.h" -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { diff --git a/test/hotspot/jtreg/serviceability/jvmti/GenerateEvents/libGenerateEvents1.cpp b/test/hotspot/jtreg/serviceability/jvmti/GenerateEvents/libGenerateEvents1.cpp index 846ba45d2741..fa60c07f8db4 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/GenerateEvents/libGenerateEvents1.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/GenerateEvents/libGenerateEvents1.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,9 +28,9 @@ extern "C" { #define AGENT_NAME "agent1" -static JavaVM *java_vm = NULL; -static jthread exp_thread = NULL; -static jvmtiEnv *jvmti1 = NULL; +static JavaVM *java_vm = nullptr; +static jthread exp_thread = nullptr; +static jvmtiEnv *jvmti1 = nullptr; static jint agent1_event_count = 0; static bool fail_status = false; @@ -48,10 +48,10 @@ CompiledMethodLoad(jvmtiEnv* jvmti, jmethodID method, jint code_size, const void* code_addr, jint map_length, const jvmtiAddrLocationMap* map, const void* compile_info) { - JNIEnv* env = NULL; - jthread thread = NULL; - char* name = NULL; - char* sign = NULL; + JNIEnv* env = nullptr; + jthread thread = nullptr; + char* name = nullptr; + char* sign = nullptr; jvmtiError err; // Posted on JavaThread's, so it is legal to obtain JNIEnv* @@ -67,7 +67,7 @@ CompiledMethodLoad(jvmtiEnv* jvmti, jmethodID method, } agent1_event_count++; - err = jvmti->GetMethodName(method, &name, &sign, NULL); + err = jvmti->GetMethodName(method, &name, &sign, nullptr); check_jvmti_status(env, err, "CompiledMethodLoad: Error in JVMTI GetMethodName"); printf("%s: CompiledMethodLoad: %s%s\n", AGENT_NAME, name, sign); @@ -111,7 +111,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { JNIEXPORT void JNICALL Java_MyPackage_GenerateEventsTest_agent1GenerateEvents(JNIEnv *env, jclass cls) { - jthread thread = NULL; + jthread thread = nullptr; jvmtiError err; err = jvmti1->GetCurrentThread(&thread); @@ -119,13 +119,13 @@ Java_MyPackage_GenerateEventsTest_agent1GenerateEvents(JNIEnv *env, jclass cls) exp_thread = (jthread)env->NewGlobalRef(thread); - err = jvmti1->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, NULL); + err = jvmti1->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, nullptr); check_jvmti_status(env, err, "generateEvents1: Error in JVMTI SetEventNotificationMode: JVMTI_ENABLE"); err = jvmti1->GenerateEvents(JVMTI_EVENT_COMPILED_METHOD_LOAD); check_jvmti_status(env, err, "generateEvents1: Error in JVMTI GenerateEvents"); - err = jvmti1->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, NULL); + err = jvmti1->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, nullptr); check_jvmti_status(env, err, "generateEvents1: Error in JVMTI SetEventNotificationMode: JVMTI_DISABLE"); } diff --git a/test/hotspot/jtreg/serviceability/jvmti/GenerateEvents/libGenerateEvents2.cpp b/test/hotspot/jtreg/serviceability/jvmti/GenerateEvents/libGenerateEvents2.cpp index 7cec9624cf3f..7af061196a15 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/GenerateEvents/libGenerateEvents2.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/GenerateEvents/libGenerateEvents2.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,9 +28,9 @@ extern "C" { #define AGENT_NAME "agent2" -static JavaVM *java_vm = NULL; -static jthread exp_thread = NULL; -static jvmtiEnv *jvmti2 = NULL; +static JavaVM *java_vm = nullptr; +static jthread exp_thread = nullptr; +static jvmtiEnv *jvmti2 = nullptr; static jint agent2_event_count = 0; static bool fail_status = false; @@ -48,10 +48,10 @@ CompiledMethodLoad(jvmtiEnv* jvmti, jmethodID method, jint code_size, const void* code_addr, jint map_length, const jvmtiAddrLocationMap* map, const void* compile_info) { - JNIEnv* env = NULL; - jthread thread = NULL; - char* name = NULL; - char* sign = NULL; + JNIEnv* env = nullptr; + jthread thread = nullptr; + char* name = nullptr; + char* sign = nullptr; jvmtiError err; // Posted on JavaThread's, so it is legal to obtain JNIEnv* @@ -67,7 +67,7 @@ CompiledMethodLoad(jvmtiEnv* jvmti, jmethodID method, } agent2_event_count++; - err = jvmti->GetMethodName(method, &name, &sign, NULL); + err = jvmti->GetMethodName(method, &name, &sign, nullptr); check_jvmti_status(env, err, "CompiledMethodLoad: Error in JVMTI GetMethodName"); printf("%s: CompiledMethodLoad: %s%s\n", AGENT_NAME, name, sign); @@ -113,7 +113,7 @@ Java_MyPackage_GenerateEventsTest_agent2SetThread(JNIEnv *env, jclass cls, jthre exp_thread = (jthread)env->NewGlobalRef(thread); - err = jvmti2->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, NULL); + err = jvmti2->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, nullptr); check_jvmti_status(env, err, "setThread2: Error in JVMTI SetEventNotificationMode: JVMTI_ENABLE"); } @@ -121,7 +121,7 @@ JNIEXPORT jboolean JNICALL Java_MyPackage_GenerateEventsTest_agent2FailStatus(JNIEnv *env, jclass cls) { jvmtiError err; - err = jvmti2->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, NULL); + err = jvmti2->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, nullptr); check_jvmti_status(env, err, "check2: Error in JVMTI SetEventNotificationMode: JVMTI_DISABLE"); printf("\n"); diff --git a/test/hotspot/jtreg/serviceability/jvmti/GetClassMethods/OverpassMethods.java b/test/hotspot/jtreg/serviceability/jvmti/GetClassMethods/OverpassMethods.java index ec86ac71bbe7..d984240f42bc 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/GetClassMethods/OverpassMethods.java +++ b/test/hotspot/jtreg/serviceability/jvmti/GetClassMethods/OverpassMethods.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/hotspot/jtreg/serviceability/jvmti/GetClassMethods/libOverpassMethods.cpp b/test/hotspot/jtreg/serviceability/jvmti/GetClassMethods/libOverpassMethods.cpp index 0e20b93f4ee4..414c31492981 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/GetClassMethods/libOverpassMethods.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/GetClassMethods/libOverpassMethods.cpp @@ -1,12 +1,10 @@ /* - * Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, 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. + * 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 @@ -33,7 +31,7 @@ extern "C" { #define ACC_STATIC 0x0008 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *jvm, void *reserved) { @@ -43,7 +41,7 @@ jint JNICALL JNI_OnLoad(JavaVM *jvm, void *reserved) { JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *vm, char *options, void *reserved) { vm->GetEnv((void **)&jvmti, JVMTI_VERSION_11); - if (options != NULL && strcmp(options, "maintain_original_method_order") == 0) { + if (options != nullptr && strcmp(options, "maintain_original_method_order") == 0) { printf("Enabled capability: maintain_original_method_order\n"); jvmtiCapabilities caps; memset(&caps, 0, sizeof(caps)); @@ -60,22 +58,22 @@ JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *vm, char *options, void *reserved) { JNIEXPORT jobjectArray JNICALL Java_OverpassMethods_getJVMTIDeclaredMethods(JNIEnv *env, jclass static_klass, jclass klass) { jint method_count = 0; - jmethodID* methods = NULL; + jmethodID* methods = nullptr; jvmtiError err = jvmti->GetClassMethods(klass, &method_count, &methods); if (err != JVMTI_ERROR_NONE) { printf("GetClassMethods failed with error: %d\n", err); - return NULL; + return nullptr; } jclass method_cls = env->FindClass("java/lang/reflect/Method"); - if (method_cls == NULL) { + if (method_cls == nullptr) { printf("FindClass (Method) failed\n"); - return NULL; + return nullptr; } - jobjectArray array = env->NewObjectArray(method_count, method_cls, NULL); - if (array == NULL) { + jobjectArray array = env->NewObjectArray(method_count, method_cls, nullptr); + if (array == nullptr) { printf("NewObjectArray failed\n"); - return NULL; + return nullptr; } for (int i = 0; i < method_count; i++) { @@ -83,13 +81,13 @@ JNIEXPORT jobjectArray JNICALL Java_OverpassMethods_getJVMTIDeclaredMethods(JNIE err = jvmti->GetMethodModifiers(methods[i], &modifiers); if (err != JVMTI_ERROR_NONE) { printf("GetMethodModifiers failed with error: %d\n", err); - return NULL; + return nullptr; } jobject m = env->ToReflectedMethod(klass, methods[i], (modifiers & ACC_STATIC) == ACC_STATIC); - if (array == NULL) { + if (array == nullptr) { printf("ToReflectedMethod failed\n"); - return NULL; + return nullptr; } env->SetObjectArrayElement(array, i, m); diff --git a/test/hotspot/jtreg/serviceability/jvmti/GetLocalVariable/libGetLocalVars.cpp b/test/hotspot/jtreg/serviceability/jvmti/GetLocalVariable/libGetLocalVars.cpp index 08a61427dde5..e0c3e0664d09 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/GetLocalVariable/libGetLocalVars.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/GetLocalVariable/libGetLocalVars.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,7 +34,7 @@ extern "C" { #define TranslateError(err) "JVMTI error" static jint result = STATUS_PASSED; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; #define DECL_TEST_FUNC(type, Type) \ static void \ @@ -167,7 +167,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { static jvmtiCapabilities caps; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_9); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -223,16 +223,16 @@ Java_GetLocalVars_testLocals(JNIEnv *env, jclass cls, jobject thread) { static const int IntSlot = 4; static const int InvalidSlot = 5; - jmethodID mid = NULL; + jmethodID mid = nullptr; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; } mid = env->GetStaticMethodID(cls, METHOD_NAME, METHOD_SIGN); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot find Method ID for %s%s\n", METHOD_NAME, METHOD_SIGN); result = STATUS_FAILED; return; diff --git a/test/hotspot/jtreg/serviceability/jvmti/GetLocalVariable/libGetSetLocalUnsuspended.cpp b/test/hotspot/jtreg/serviceability/jvmti/GetLocalVariable/libGetSetLocalUnsuspended.cpp index 3cb048bda982..79ab3dd0ad8e 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/GetLocalVariable/libGetSetLocalUnsuspended.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/GetLocalVariable/libGetSetLocalUnsuspended.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, 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 @@ #include #include "jvmti.h" -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { @@ -40,7 +40,7 @@ enum Slots { SlotDouble = 6, }; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static void check_jvmti_error_not_suspended(JNIEnv* jni, const char* func_name, jvmtiError err) { @@ -55,7 +55,7 @@ test_GetLocal(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread) { jvmtiError err; const int depth = 0; - jobject msg = NULL; + jobject msg = nullptr; jint ii = 0; jlong ll = 0L; jfloat ff = 0.0; @@ -101,7 +101,7 @@ test_SetLocal(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread) { jvmtiError err; const int depth = 0; - const jobject msg = NULL; + const jobject msg = nullptr; const jint ii = 0; const jlong ll = 0L; const jfloat ff = 0.0; @@ -163,7 +163,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { JNIEXPORT void JNICALL Java_GetSetLocalUnsuspended_testUnsuspendedThread(JNIEnv *jni, jclass klass, jthread thread) { char* tname = get_thread_name(jvmti, jni, thread); - jmethodID method = NULL; + jmethodID method = nullptr; jlocation location = 0; LOG("\ntestUnsuspendedThread: started for thread: %s\n", tname); diff --git a/test/hotspot/jtreg/serviceability/jvmti/GetThreadListStackTraces/libOneGetThreadListStackTraces.cpp b/test/hotspot/jtreg/serviceability/jvmti/GetThreadListStackTraces/libOneGetThreadListStackTraces.cpp index 2c5ec19e93c8..56db0b74797a 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/GetThreadListStackTraces/libOneGetThreadListStackTraces.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/GetThreadListStackTraces/libOneGetThreadListStackTraces.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2020, NTT DATA. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -35,7 +35,7 @@ extern "C" { #endif -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { return jvm->GetEnv(reinterpret_cast(&jvmti), JVMTI_VERSION_11); @@ -103,7 +103,7 @@ JNIEXPORT void JNICALL Java_OneGetThreadListStackTraces_checkCallStacks(JNIEnv * /* Find jvmtiStackInfo for `thread` (in arguments) */ jboolean is_same; - target_info = NULL; + target_info = nullptr; for (jint i = 0; i < num_threads; i++) { is_same = env->IsSameObject(stack_info[i].thread, thread); if (env->ExceptionOccurred()) { @@ -115,7 +115,7 @@ JNIEXPORT void JNICALL Java_OneGetThreadListStackTraces_checkCallStacks(JNIEnv * break; } } - if (target_info == NULL) { + if (target_info == nullptr) { env->FatalError("Target thread not found"); } diff --git a/test/hotspot/jtreg/serviceability/jvmti/Heap/libIterateHeapWithEscapeAnalysisEnabled.cpp b/test/hotspot/jtreg/serviceability/jvmti/Heap/libIterateHeapWithEscapeAnalysisEnabled.cpp index e090bf29709e..9cddba2e89ab 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/Heap/libIterateHeapWithEscapeAnalysisEnabled.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/Heap/libIterateHeapWithEscapeAnalysisEnabled.cpp @@ -64,7 +64,7 @@ JNI_OnLoad(JavaVM *jvm, void *reserved) { JNIEnv *env; res = jvm->GetEnv((void **) &env, JNI_VERSION_9); - if (res != JNI_OK || env == NULL) { + if (res != JNI_OK || env == nullptr) { fprintf(stderr, "Error: GetEnv call failed(%d)!\n", res); return JNI_ERR; } @@ -79,7 +79,7 @@ Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { printf("Agent_OnLoad started\n"); res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_9); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { fprintf(stderr, "Error: wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -257,9 +257,9 @@ Java_IterateHeapWithEscapeAnalysisEnabled_countAndTagInstancesOfClass(JNIEnv *en if (env->IsSameObject(method, method_IterateOverReachableObjects)) { method_found = JNI_TRUE; - err = jvmti->IterateOverReachableObjects(NULL /*jvmtiHeapRootCallback*/, + err = jvmti->IterateOverReachableObjects(nullptr /*jvmtiHeapRootCallback*/, __stackReferenceCallback, - NULL /* jvmtiObjectReferenceCallback */, + nullptr /* jvmtiObjectReferenceCallback */, &data); if (err != JVMTI_ERROR_NONE) { ShowErrorMessage(jvmti, err, @@ -294,8 +294,8 @@ Java_IterateHeapWithEscapeAnalysisEnabled_countAndTagInstancesOfClass(JNIEnv *en method_found = JNI_TRUE; callbacks.heap_reference_callback = __jvmtiHeapReferenceCallback; err = jvmti->FollowReferences(0 /* filter nothing */, - NULL /* no class filter */, - NULL /* no initial object, follow roots */, + nullptr /* no class filter */, + nullptr /* no initial object, follow roots */, &callbacks, &data); if (err != JVMTI_ERROR_NONE) { @@ -308,7 +308,7 @@ Java_IterateHeapWithEscapeAnalysisEnabled_countAndTagInstancesOfClass(JNIEnv *en method_found = JNI_TRUE; callbacks.heap_iteration_callback = __jvmtiHeapIterationCallback; err = jvmti->IterateThroughHeap(0 /* filter nothing */, - NULL /* no class filter */, + nullptr /* no class filter */, &callbacks, &data); if (err != JVMTI_ERROR_NONE) { diff --git a/test/hotspot/jtreg/serviceability/jvmti/HeapMonitor/libHeapMonitorTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/HeapMonitor/libHeapMonitorTest.cpp index a4920688603f..b70f4834f23d 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/HeapMonitor/libHeapMonitorTest.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/HeapMonitor/libHeapMonitorTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018, Google and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -34,8 +34,8 @@ extern "C" { #define FALSE 0 #define PRINT_OUT 0 -static jvmtiEnv *jvmti = NULL; -static jvmtiEnv *second_jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; +static jvmtiEnv *second_jvmti = nullptr; typedef struct _ObjectTrace{ jweak object; @@ -138,7 +138,7 @@ static void print_out_frames(JNIEnv* env, ObjectTrace* trace) { // Get basic information out of the trace. jlocation bci = frames[i].location; jmethodID methodid = frames[i].method; - char *name = NULL, *signature = NULL, *file_name = NULL; + char *name = nullptr, *signature = nullptr, *file_name = nullptr; jclass declaring_class; int line_number; jvmtiError err; @@ -166,18 +166,18 @@ static void print_out_frames(JNIEnv* env, ObjectTrace* trace) { continue; } - // Compare now, none should be NULL. - if (name == NULL) { + // Compare now, none should be null. + if (name == nullptr) { fprintf(stderr, "\tUnknown name\n"); continue; } - if (file_name == NULL) { + if (file_name == nullptr) { fprintf(stderr, "\tUnknown file\n"); continue; } - if (signature == NULL) { + if (signature == nullptr) { fprintf(stderr, "\tUnknown signature\n"); continue; } @@ -204,7 +204,7 @@ static jboolean check_sample_content(JNIEnv* env, // Get basic information out of the trace. jlocation bci = frames[i].location; jmethodID methodid = frames[i].method; - char *name = NULL, *signature = NULL, *file_name = NULL; + char *name = nullptr, *signature = nullptr, *file_name = nullptr; jclass declaring_class; int line_number; jboolean differ; @@ -227,16 +227,16 @@ static jboolean check_sample_content(JNIEnv* env, return FALSE; } - // Compare now, none should be NULL. - if (name == NULL) { + // Compare now, none should be null. + if (name == nullptr) { return FALSE; } - if (file_name == NULL) { + if (file_name == nullptr) { return FALSE; } - if (signature == NULL) { + if (signature == nullptr) { return FALSE; } @@ -267,14 +267,14 @@ static int fill_native_frames(JNIEnv* env, jobjectArray frames, ExpectedContentFrame* native_frames, size_t size) { size_t i; for (i = 0; i < size; i++) { - jclass frame_class = NULL; + jclass frame_class = nullptr; jfieldID line_number_field_id = 0; int line_number = 0; jfieldID string_id = 0; - jstring string_object = NULL; - const char* method = NULL; - const char* file_name = NULL; - const char* signature = NULL; + jstring string_object = nullptr; + const char* method = nullptr; + const char* file_name = nullptr; + const char* signature = nullptr; jobject obj = env->GetObjectArrayElement(frames, (jsize) i); @@ -410,7 +410,7 @@ static void event_storage_add_garbage_collected_object(EventStorage* storage, ObjectTrace* object) { int idx = storage->garbage_history_index; ObjectTrace* old_object = storage->garbage_collected_objects[idx]; - if (old_object != NULL) { + if (old_object != nullptr) { free(old_object->frames); free(storage->garbage_collected_objects[idx]); } @@ -496,7 +496,7 @@ static jboolean event_storage_garbage_contains(JNIEnv* env, for (i = 0; i < storage->garbage_history_size; i++) { ObjectTrace* trace = storage->garbage_collected_objects[i]; - if (trace == NULL) { + if (trace == nullptr) { continue; } @@ -589,14 +589,14 @@ static void event_storage_compact(EventStorage* storage, JNIEnv* jni) { ObjectTrace* live_object = live_objects[i]; jweak object = live_object->object; - if (!jni->IsSameObject(object, NULL)) { + if (!jni->IsSameObject(object, nullptr)) { if (dest != i) { live_objects[dest] = live_object; dest++; } } else { jni->DeleteWeakGlobalRef(object); - live_object->object = NULL; + live_object->object = nullptr; event_storage_add_garbage_collected_object(storage, live_object); } @@ -609,7 +609,7 @@ static void event_storage_compact(EventStorage* storage, JNIEnv* jni) { static void event_storage_free_objects(ObjectTrace** array, int max) { int i; for (i = 0; i < max; i++) { - free(array[i]), array[i] = NULL; + free(array[i]), array[i] = nullptr; } } @@ -622,7 +622,7 @@ static void event_storage_reset(EventStorage* storage) { storage->live_object_additions = 0; storage->live_object_size = 0; storage->live_object_count = 0; - free(storage->live_objects), storage->live_objects = NULL; + free(storage->live_objects), storage->live_objects = nullptr; event_storage_free_objects(storage->garbage_collected_objects, storage->garbage_history_size); @@ -801,13 +801,13 @@ void JNICALL GarbageCollectionFinish(jvmtiEnv *jvmti_env) { static int enable_notifications() { if (check_error(jvmti->SetEventNotificationMode( - JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_FINISH, NULL), + JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_FINISH, nullptr), "Set event notifications")) { return 1; } return check_error(jvmti->SetEventNotificationMode( - JVMTI_ENABLE, JVMTI_EVENT_SAMPLED_OBJECT_ALLOC, NULL), + JVMTI_ENABLE, JVMTI_EVENT_SAMPLED_OBJECT_ALLOC, nullptr), "Set event notifications"); } @@ -818,14 +818,14 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiCapabilities caps; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { fprintf(stderr, "Error: wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } // Get second jvmti environment. res = jvm->GetEnv((void **) &second_jvmti, JVMTI_VERSION); - if (res != JNI_OK || second_jvmti == NULL) { + if (res != JNI_OK || second_jvmti == nullptr) { fprintf(stderr, "Error: wrong result of a valid second call to GetEnv!\n"); return JNI_ERR; } @@ -895,11 +895,11 @@ Java_MyPackage_HeapMonitor_enableSamplingEvents(JNIEnv* env, jclass cls) { JNIEXPORT void JNICALL Java_MyPackage_HeapMonitor_disableSamplingEvents(JNIEnv* env, jclass cls) { check_error(jvmti->SetEventNotificationMode( - JVMTI_DISABLE, JVMTI_EVENT_SAMPLED_OBJECT_ALLOC, NULL), + JVMTI_DISABLE, JVMTI_EVENT_SAMPLED_OBJECT_ALLOC, nullptr), "Set event notifications"); check_error(jvmti->SetEventNotificationMode( - JVMTI_DISABLE, JVMTI_EVENT_GARBAGE_COLLECTION_FINISH, NULL), + JVMTI_DISABLE, JVMTI_EVENT_GARBAGE_COLLECTION_FINISH, nullptr), "Garbage Collection Finish"); } @@ -914,8 +914,8 @@ static ExpectedContentFrame *get_native_frames(JNIEnv* env, jclass cls, native_frames = reinterpret_cast (malloc(size * sizeof(*native_frames))); - if (native_frames == NULL) { - env->FatalError("Error in get_native_frames: malloc returned NULL\n"); + if (native_frames == nullptr) { + env->FatalError("Error in get_native_frames: malloc returned null\n"); } if (fill_native_frames(env, frames, native_frames, size) != 0) { @@ -936,7 +936,7 @@ Java_MyPackage_HeapMonitor_obtainedEvents(JNIEnv* env, jclass cls, result = event_storage_contains(env, &global_event_storage, native_frames, size, check_lines); - free(native_frames), native_frames = NULL; + free(native_frames), native_frames = nullptr; return result; } @@ -951,7 +951,7 @@ Java_MyPackage_HeapMonitor_garbageContains(JNIEnv* env, jclass cls, result = event_storage_garbage_contains(env, &global_event_storage, native_frames, size, check_lines); - free(native_frames), native_frames = NULL; + free(native_frames), native_frames = nullptr; return result; } @@ -966,7 +966,7 @@ Java_MyPackage_HeapMonitor_getSize(JNIEnv* env, jclass cls, result = event_storage_get_size(env, &global_event_storage, native_frames, size, check_lines); - free(native_frames), native_frames = NULL; + free(native_frames), native_frames = nullptr; return result; } @@ -1085,7 +1085,7 @@ Java_MyPackage_HeapMonitorTwoAgentsTest_enablingSamplingInSecondaryAgent( JNIEXPORT void JNICALL Java_MyPackage_HeapMonitor_enableVMEvents(JNIEnv* env, jclass cls) { check_error(jvmti->SetEventNotificationMode( - JVMTI_ENABLE, JVMTI_EVENT_VM_OBJECT_ALLOC, NULL), + JVMTI_ENABLE, JVMTI_EVENT_VM_OBJECT_ALLOC, nullptr), "Set vm event notifications"); } @@ -1105,19 +1105,19 @@ static jobject allocate_object(JNIEnv* env) { jmethodID constructor; jobject result; - if (env->ExceptionOccurred() || cls == NULL) { + if (env->ExceptionOccurred() || cls == nullptr) { env->FatalError("Error in jni FindClass: Cannot find Object class\n"); } constructor = env->GetMethodID(cls, "", "()V"); - if (env->ExceptionOccurred() || constructor == NULL) { + if (env->ExceptionOccurred() || constructor == nullptr) { env->FatalError("Error in jni GetMethodID: Cannot find Object class constructor\n"); } // Call back constructor to allocate a new instance, with an int argument result = env->NewObject(cls, constructor); - if (env->ExceptionOccurred() || result == NULL) { + if (env->ExceptionOccurred() || result == nullptr) { env->FatalError("Error in jni NewObject: Cannot allocate an object\n"); } return result; @@ -1137,8 +1137,8 @@ void JNICALL RecursiveSampledObjectAlloc(jvmtiEnv *jvmti_env, // infinite recursion here. int i; for (i = 0; i < 1000; i++) { - if (allocate_object(jni_env) == NULL) { - jni_env->FatalError("allocate_object returned NULL\n"); + if (allocate_object(jni_env) == nullptr) { + jni_env->FatalError("allocate_object returned null\n"); } } diff --git a/test/hotspot/jtreg/serviceability/jvmti/HiddenClass/libHiddenClassSigTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/HiddenClass/libHiddenClassSigTest.cpp index 5d94a3879fef..ad9da9e5301d 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/HiddenClass/libHiddenClassSigTest.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/HiddenClass/libHiddenClassSigTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,7 +31,7 @@ static const char* SIG_START = "LP/Q/HiddenClassSig"; static const size_t SIG_START_LEN = strlen(SIG_START); static const int ACC_INTERFACE = 0x0200; // Interface class modifiers bit -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint class_load_count = 0; static jint class_prep_count = 0; static bool failed = false; @@ -50,18 +50,18 @@ static bool failed = false; /* Return the jmethodID of j.l.Class.isHidden() method. */ static jmethodID is_hidden_mid(JNIEnv* jni) { - char* csig = NULL; + char* csig = nullptr; jint count = 0; - jmethodID *methods = NULL; + jmethodID *methods = nullptr; jclass clazz = jni->FindClass("java/lang/Class"); - if (clazz == NULL) { - jni->FatalError("is_hidden_mid: Error: FindClass returned NULL for java/lang/Class\n"); - return NULL; + if (clazz == nullptr) { + jni->FatalError("is_hidden_mid: Error: FindClass returned null for java/lang/Class\n"); + return nullptr; } // find the jmethodID of j.l.Class.isHidden() method jmethodID mid = jni->GetMethodID(clazz, "isHidden", "()Z"); - if (mid == NULL) { + if (mid == nullptr) { jni->FatalError("is_hidden_mid: Error in jni GetMethodID: Cannot find j.l.Class.isHidden method\n"); } return mid; @@ -70,9 +70,9 @@ is_hidden_mid(JNIEnv* jni) { /* Return true if the klass is hidden. */ static bool is_hidden(JNIEnv* jni, jclass klass) { - static jmethodID is_hid_mid = NULL; + static jmethodID is_hid_mid = nullptr; - if (is_hid_mid == NULL) { + if (is_hid_mid == nullptr) { is_hid_mid = is_hidden_mid(jni); } // invoke j.l.Class.isHidden() method @@ -88,8 +88,8 @@ is_hidden(JNIEnv* jni, jclass klass) { static void check_class_signature(jvmtiEnv* jvmti, JNIEnv* jni, jclass klass, bool is_hidden, const char* exp_sig) { jint class_modifiers = 0; - char* sig = NULL; - char* gsig = NULL; + char* sig = nullptr; + char* gsig = nullptr; jvmtiError err; // get class signature @@ -103,8 +103,8 @@ check_class_signature(jvmtiEnv* jvmti, JNIEnv* jni, jclass klass, bool is_hidden LOG2("check_class_signature: FAIL: Hidden class signature %s does not match expected: %s\n", sig, exp_sig); failed = true; } - if (is_hidden && gsig == NULL) { - LOG0("check_class_signature: FAIL: unexpected NULL generic signature for hidden class\n"); + if (is_hidden && gsig == nullptr) { + LOG0("check_class_signature: FAIL: unexpected null generic signature for hidden class\n"); failed = true; } } @@ -152,8 +152,8 @@ check_hidden_class_flags(jvmtiEnv* jvmti, JNIEnv* jni, jclass klass) { static void check_hidden_class_loader(jvmtiEnv* jvmti, JNIEnv* jni, jclass klass) { jint count = 0; - jobject loader = NULL; - jclass* loader_classes = NULL; + jobject loader = nullptr; + jclass* loader_classes = nullptr; jboolean found = false; jvmtiError err; @@ -166,7 +166,7 @@ check_hidden_class_loader(jvmtiEnv* jvmti, JNIEnv* jni, jclass klass) { CHECK_JVMTI_ERROR(jni, err, "check_hidden_class_loader: Error in JVMTI GetClassLoaderClasses"); for (int idx = 0; idx < count; idx++) { - char* sig = NULL; + char* sig = nullptr; jclass kls = loader_classes[idx]; // GetClassLoaderClasses should not return any hidden classes @@ -174,7 +174,7 @@ check_hidden_class_loader(jvmtiEnv* jvmti, JNIEnv* jni, jclass klass) { continue; } // get class signature - err = jvmti->GetClassSignature(kls, &sig, NULL); + err = jvmti->GetClassSignature(kls, &sig, nullptr); CHECK_JVMTI_ERROR(jni, err, "check_hidden_class_loader: Error in JVMTI GetClassSignature"); LOG1("check_hidden_class_loader: FAIL: JVMTI GetClassLoaderClasses returned hidden class: %s\n", sig); @@ -187,9 +187,9 @@ check_hidden_class_loader(jvmtiEnv* jvmti, JNIEnv* jni, jclass klass) { /* Test the hidden class implements expected interface. */ static void check_hidden_class_impl_interf(jvmtiEnv* jvmti, JNIEnv* jni, jclass klass) { - char* sig = NULL; + char* sig = nullptr; jint count = 0; - jclass* interfaces = NULL; + jclass* interfaces = nullptr; jvmtiError err; // check that hidden class implements just one interface @@ -201,7 +201,7 @@ check_hidden_class_impl_interf(jvmtiEnv* jvmti, JNIEnv* jni, jclass klass) { return; } // get interface signature - err = jvmti->GetClassSignature(interfaces[0], &sig, NULL); + err = jvmti->GetClassSignature(interfaces[0], &sig, nullptr); CHECK_JVMTI_ERROR(jni, err, "check_hidden_class_impl_interf: Error in JVMTI GetClassSignature for implemented interface"); // check the interface signature is matching the expected @@ -215,7 +215,7 @@ check_hidden_class_impl_interf(jvmtiEnv* jvmti, JNIEnv* jni, jclass klass) { /* Test hidden class. */ static void check_hidden_class(jvmtiEnv* jvmti, JNIEnv* jni, jclass klass, const char* exp_sig) { - char* source_file_name = NULL; + char* source_file_name = nullptr; LOG1("\n### Native agent: check_hidden_class started: class: %s\n", exp_sig); @@ -237,7 +237,7 @@ check_hidden_class(jvmtiEnv* jvmti, JNIEnv* jni, jclass klass, const char* exp_s /* Test hidden class array. */ static void check_hidden_class_array(jvmtiEnv* jvmti, JNIEnv* jni, jclass klass_array, const char* exp_sig) { - char* source_file_name = NULL; + char* source_file_name = nullptr; LOG1("\n### Native agent: check_hidden_class_array started: array: %s\n", exp_sig); @@ -250,8 +250,8 @@ check_hidden_class_array(jvmtiEnv* jvmti, JNIEnv* jni, jclass klass_array, const /* Process a CLASS_LOAD or aClassPrepare event. */ static void process_class_event(jvmtiEnv* jvmti, JNIEnv* jni, jclass klass, jint* event_count_ptr, const char* event_name) { - char* sig = NULL; - char* gsig = NULL; + char* sig = nullptr; + char* gsig = nullptr; jvmtiError err; // get class signature @@ -263,8 +263,8 @@ static void process_class_event(jvmtiEnv* jvmti, JNIEnv* jni, jclass klass, strncmp(sig, SIG_START, SIG_START_LEN) == 0 && is_hidden(jni, klass)) { (*event_count_ptr)++; - if (gsig == NULL) { - LOG1("%s event: FAIL: GetClassSignature returned NULL generic signature for hidden class\n", event_name); + if (gsig == nullptr) { + LOG1("%s event: FAIL: GetClassSignature returned null generic signature for hidden class\n", event_name); failed = true; } LOG2("%s event: hidden class with sig: %s\n", event_name, sig); @@ -293,11 +293,11 @@ VMInit(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { fflush(stdout); // enable ClassLoad event notification mode - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, nullptr); CHECK_JVMTI_ERROR(jni, err, "VMInit event: Error in enabling ClassLoad events notification"); // enable ClassPrepare event notification mode - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_PREPARE, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_PREPARE, nullptr); CHECK_JVMTI_ERROR(jni, err, "VMInit event: Error in enabling ClassPrepare events notification"); } @@ -327,7 +327,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { } // enable VM_INIT event notification mode - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, nullptr); if (err != JVMTI_ERROR_NONE) { LOG1("Agent_OnLoad: Error in JVMTI SetEventNotificationMode: %d\n", err); failed = true; @@ -341,10 +341,10 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { /* Native method: checkHiddenClass(). */ JNIEXPORT void JNICALL Java_P_Q_HiddenClassSigTest_checkHiddenClass(JNIEnv *jni, jclass klass, jclass hidden_klass, jstring exp_sig_str) { - const char* exp_sig = jni->GetStringUTFChars(exp_sig_str, NULL); + const char* exp_sig = jni->GetStringUTFChars(exp_sig_str, nullptr); - if (exp_sig == NULL) { - jni->FatalError("check_hidden_class: Error: JNI GetStringChars returned NULL for jstring\n"); + if (exp_sig == nullptr) { + jni->FatalError("check_hidden_class: Error: JNI GetStringChars returned null for jstring\n"); return; } check_hidden_class(jvmti, jni, hidden_klass, exp_sig); @@ -355,10 +355,10 @@ Java_P_Q_HiddenClassSigTest_checkHiddenClass(JNIEnv *jni, jclass klass, jclass h /* Native method: checkHiddenClassArray(). */ JNIEXPORT void JNICALL Java_P_Q_HiddenClassSigTest_checkHiddenClassArray(JNIEnv *jni, jclass klass, jclass hidden_klass_array, jstring exp_sig_str) { - const char* exp_sig = jni->GetStringUTFChars(exp_sig_str, NULL); + const char* exp_sig = jni->GetStringUTFChars(exp_sig_str, nullptr); - if (exp_sig == NULL) { - jni->FatalError("check_hidden_class_array: Error: JNI GetStringChars returned NULL for jstring\n"); + if (exp_sig == nullptr) { + jni->FatalError("check_hidden_class_array: Error: JNI GetStringChars returned null for jstring\n"); return; } check_hidden_class_array(jvmti, jni, hidden_klass_array, exp_sig); diff --git a/test/hotspot/jtreg/serviceability/jvmti/RedefineClasses/MissedStackMapFrames/libMissedStackMapFrames.cpp b/test/hotspot/jtreg/serviceability/jvmti/RedefineClasses/MissedStackMapFrames/libMissedStackMapFrames.cpp index 18d4a2e5d1da..5cebf608c348 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/RedefineClasses/MissedStackMapFrames/libMissedStackMapFrames.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/RedefineClasses/MissedStackMapFrames/libMissedStackMapFrames.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2024, 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 @@ -62,7 +62,7 @@ struct SavedClassBytes { jbyteArray get(JNIEnv *env) { if (bytes == nullptr) { - _log("SavedClassBytes: NULL\n"); + _log("SavedClassBytes: null\n"); return nullptr; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/RedefineClasses/RedefineRetransform/libRedefineRetransform.cpp b/test/hotspot/jtreg/serviceability/jvmti/RedefineClasses/RedefineRetransform/libRedefineRetransform.cpp index 9ac4f0dfc260..518e147c9427 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/RedefineClasses/RedefineRetransform/libRedefineRetransform.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/RedefineClasses/RedefineRetransform/libRedefineRetransform.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, 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 @@ -152,7 +152,7 @@ class ClassFileLoadHookHelper { jbyteArray getSavedHookClassBytes() { if (savedClassBytes == nullptr) { - _log("%s: savedClassBytes is NULL\n", mode); + _log("%s: savedClassBytes is null\n", mode); return nullptr; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/SetBreakpoint/libTestManyBreakpoints.cpp b/test/hotspot/jtreg/serviceability/jvmti/SetBreakpoint/libTestManyBreakpoints.cpp index dcb8f87ddd75..b9520cc0e1c8 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/SetBreakpoint/libTestManyBreakpoints.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/SetBreakpoint/libTestManyBreakpoints.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,7 +28,7 @@ #define TARGET_CLASS_NAME "LTarget;" -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static void check_jvmti_status(JNIEnv* jni, jvmtiError err, const char* msg) { @@ -42,7 +42,7 @@ void JNICALL classprepare(jvmtiEnv* jvmti_env, JNIEnv* jni_env, jthread thread, char* buf; jvmtiError err; - err = jvmti->GetClassSignature(klass, &buf, NULL); + err = jvmti->GetClassSignature(klass, &buf, nullptr); check_jvmti_status(jni_env, err, "classprepare: GetClassSignature error"); if (strncmp(buf, TARGET_CLASS_NAME, strlen(TARGET_CLASS_NAME)) == 0) { @@ -95,13 +95,13 @@ JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM* vm, char* options, void* reserved) { return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_PREPARE, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_PREPARE, nullptr); if (err != JNI_OK) { printf("Agent_OnLoad: SetEventNotificationMode CLASS_PREPARE error\n"); return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, nullptr); if (err != JNI_OK) { printf("Agent_OnLoad: SetEventNotificationMode BREAKPOINT error\n"); return JNI_ERR; diff --git a/test/hotspot/jtreg/serviceability/jvmti/SetTag/libTagMapTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/SetTag/libTagMapTest.cpp index cb23df824854..488d6a05fed5 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/SetTag/libTagMapTest.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/SetTag/libTagMapTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,7 +27,7 @@ namespace { jlong nextTag = 1; - jvmtiEnv *jvmti = NULL; + jvmtiEnv *jvmti = nullptr; void checkJvmti(int code, const char* message) { if (code != JVMTI_ERROR_NONE) { @@ -55,7 +55,7 @@ extern "C" JNIEXPORT jlong JNICALL Java_TagMapTest_getTag(JNIEnv* jni_env, jclas } extern "C" JNIEXPORT void JNICALL Java_TagMapTest_iterate(JNIEnv* jni_env, jclass clazz, jboolean tagged) { - checkJvmti(jvmti->IterateOverHeap(tagged ? JVMTI_HEAP_OBJECT_TAGGED : JVMTI_HEAP_OBJECT_EITHER, &heapObjectCallback, NULL), "could not iterate"); + checkJvmti(jvmti->IterateOverHeap(tagged ? JVMTI_HEAP_OBJECT_TAGGED : JVMTI_HEAP_OBJECT_EITHER, &heapObjectCallback, nullptr), "could not iterate"); } extern "C" JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *vm, char *options, void *reserved) { diff --git a/test/hotspot/jtreg/serviceability/jvmti/StartPhase/AllowedFunctions/libAllowedFunctions.c b/test/hotspot/jtreg/serviceability/jvmti/StartPhase/AllowedFunctions/libAllowedFunctions.c index 4299a98d7e63..97b5cab341eb 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/StartPhase/AllowedFunctions/libAllowedFunctions.c +++ b/test/hotspot/jtreg/serviceability/jvmti/StartPhase/AllowedFunctions/libAllowedFunctions.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -47,6 +47,8 @@ extern "C" { #define FAILED 2 static jint result = PASSED; +static jrawMonitorID event_mon = NULL; +static jboolean is_vm_dead = JNI_FALSE; static jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved); @@ -68,7 +70,7 @@ jint JNICALL JNI_OnLoad(JavaVM *jvm, void *reserved) { static void check_jvmti_error(jvmtiEnv *jvmti, char* fname, jvmtiError err) { if (err != JVMTI_ERROR_NONE) { printf(" ## %s error: %d\n", fname, err); - exit(err); + abort(); } } @@ -317,7 +319,7 @@ VMStart(jvmtiEnv *jvmti, JNIEnv* jni) { } static void JNICALL -VMInit(jvmtiEnv *jvmti, JNIEnv* jnii, jthread thread) { +VMInit(jvmtiEnv *jvmti, JNIEnv* jni, jthread thread) { jvmtiPhase phase; printf("VMInit event\n"); @@ -329,22 +331,52 @@ VMInit(jvmtiEnv *jvmti, JNIEnv* jnii, jthread thread) { } } +static void JNICALL +VMDeath(jvmtiEnv *jvmti, JNIEnv* jni) { + jvmtiError err; + + // Block ClassPrepare events while this callback is executed. + err = (*jvmti)->RawMonitorEnter(jvmti, event_mon); + check_jvmti_error(jvmti, "VMDeath event: Failed in RawMonitorEnter", err); + + is_vm_dead = JNI_TRUE; + printf("VMDeath event\n"); + + err = (*jvmti)->RawMonitorExit(jvmti, event_mon); + check_jvmti_error(jvmti, "VMDeath event: Failed in RawMonitorExit", err); +} + static void JNICALL ClassPrepare(jvmtiEnv *jvmti, JNIEnv *env, jthread thread, jclass klass) { static const jint EVENTS_LIMIT = 2; static jint event_no = 0; - jthread cur_thread = get_cur_thread(jvmti); jvmtiPhase phase; intptr_t exp_val = 777; intptr_t act_val; + jvmtiError err; + + // Block VMDeath event and other ClassPrepare events while this callback is executed. + // Sync with VMDeath event and check for is_vm_dead guard against JVMTI_ERROR WRONG_PHASE. + err = (*jvmti)->RawMonitorEnter(jvmti, event_mon); + check_jvmti_error(jvmti, "ClassPrepare event: Failed in RawMonitorEnter", err); + if (is_vm_dead) { + printf("\nIgnoring ClassPrepare event during the dead phase\n"); + err = (*jvmti)->RawMonitorExit(jvmti, event_mon); + check_jvmti_error(jvmti, "ClassPrepare event: Failed in RawMonitorExit", err); + return; + } get_phase(jvmti, &phase); if (phase != JVMTI_PHASE_START && phase != JVMTI_PHASE_LIVE) { printf(" ## Error: unexpected phase: %d, expected: %d or %d\n", phase, JVMTI_PHASE_START, JVMTI_PHASE_LIVE); + result = FAILED; + err = (*jvmti)->RawMonitorExit(jvmti, event_mon); + check_jvmti_error(jvmti, "ClassPrepare event: Failed in RawMonitorExit", err); return; } if (phase == JVMTI_PHASE_START && event_no < EVENTS_LIMIT) { + jthread cur_thread = get_cur_thread(jvmti); printf("\nClassPrepare event during the start phase: #%d\n", event_no); // Test the JVMTI class functions during the start phase test_class_functions(jvmti, env, thread, klass); @@ -360,6 +392,8 @@ ClassPrepare(jvmtiEnv *jvmti, JNIEnv *env, jthread thread, jclass klass) { } event_no++; } + err = (*jvmti)->RawMonitorExit(jvmti, event_mon); + check_jvmti_error(jvmti, "ClassPrepare event: Failed in RawMonitorExit", err); } static @@ -400,6 +434,9 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { callbacks.VMInit = VMInit; callbacks.ClassPrepare = ClassPrepare; + err = (*jvmti)->CreateRawMonitor(jvmti, "Events Monitor", &event_mon); + check_jvmti_error(jvmti, "## Agent_Initialize: CreateRawMonitor", err); + err = (*jvmti)->SetEventCallbacks(jvmti, &callbacks, size); check_jvmti_error(jvmti, "## Agent_Initialize: SetEventCallbacks", err); diff --git a/test/hotspot/jtreg/serviceability/jvmti/SuspendWithCurrentThread/libSuspendWithCurrentThread.cpp b/test/hotspot/jtreg/serviceability/jvmti/SuspendWithCurrentThread/libSuspendWithCurrentThread.cpp index f6dfe86a8e9f..7e12be32d217 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/SuspendWithCurrentThread/libSuspendWithCurrentThread.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/SuspendWithCurrentThread/libSuspendWithCurrentThread.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,12 +24,12 @@ #include #include #include "jvmti.h" -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { -static jvmtiEnv* jvmti = NULL; -static jthread* threads = NULL; +static jvmtiEnv* jvmti = nullptr; +static jthread* threads = nullptr; static jsize threads_count = 0; JNIEXPORT void JNICALL @@ -51,9 +51,9 @@ Java_SuspendWithCurrentThread_registerTestedThreads(JNIEnv *jni, jclass cls, job /* This function is executed on the suspender thread which is not Main thread */ JNIEXPORT void JNICALL Java_ThreadToSuspend_suspendTestedThreads(JNIEnv *jni, jclass cls) { - jvmtiError* results = NULL; + jvmtiError* results = nullptr; jvmtiError err; - const char* tname = get_thread_name(jvmti, jni, NULL); // current thread name + const char* tname = get_thread_name(jvmti, jni, nullptr); // current thread name LOG("\nsuspendTestedThreads: started by thread: %s\n", tname); err = jvmti->Allocate((threads_count * sizeof(jvmtiError)), @@ -105,7 +105,7 @@ Java_SuspendWithCurrentThread_checkTestedThreadsSuspended(JNIEnv *jni, jclass cl JNIEXPORT void JNICALL Java_SuspendWithCurrentThread_resumeTestedThreads(JNIEnv *jni, jclass cls) { - jvmtiError* results = NULL; + jvmtiError* results = nullptr; jvmtiError err; LOG("\nresumeTestedThreads: started\n"); @@ -135,7 +135,7 @@ Java_SuspendWithCurrentThread_releaseTestedThreadsInfo(JNIEnv *jni, jclass cls) LOG("\nreleaseTestedThreadsInfo: started\n"); for (int i = 0; i < threads_count; i++) { - if (threads[i] != NULL) { + if (threads[i] != nullptr) { jni->DeleteGlobalRef(threads[i]); } } diff --git a/test/hotspot/jtreg/serviceability/jvmti/SuspendWithObjectMonitorEnter/libSuspendWithObjectMonitorEnter.cpp b/test/hotspot/jtreg/serviceability/jvmti/SuspendWithObjectMonitorEnter/libSuspendWithObjectMonitorEnter.cpp index cfdbed1c6e15..f449a4e6b927 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/SuspendWithObjectMonitorEnter/libSuspendWithObjectMonitorEnter.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/SuspendWithObjectMonitorEnter/libSuspendWithObjectMonitorEnter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,7 @@ extern "C" { -static jvmtiEnv* jvmti = NULL; +static jvmtiEnv* jvmti = nullptr; #define LOG(...) \ do { \ diff --git a/test/hotspot/jtreg/serviceability/jvmti/SuspendWithObjectMonitorWait/libSuspendWithObjectMonitorWait.cpp b/test/hotspot/jtreg/serviceability/jvmti/SuspendWithObjectMonitorWait/libSuspendWithObjectMonitorWait.cpp index 926f0619b591..3706cba76dc1 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/SuspendWithObjectMonitorWait/libSuspendWithObjectMonitorWait.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/SuspendWithObjectMonitorWait/libSuspendWithObjectMonitorWait.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,7 @@ extern "C" { -static jvmtiEnv* jvmti = NULL; +static jvmtiEnv* jvmti = nullptr; #define LOG(...) \ do { \ diff --git a/test/hotspot/jtreg/serviceability/jvmti/SuspendWithRawMonitorEnter/libSuspendWithRawMonitorEnter.cpp b/test/hotspot/jtreg/serviceability/jvmti/SuspendWithRawMonitorEnter/libSuspendWithRawMonitorEnter.cpp index 476d8d67a15d..9b7562d70d47 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/SuspendWithRawMonitorEnter/libSuspendWithRawMonitorEnter.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/SuspendWithRawMonitorEnter/libSuspendWithRawMonitorEnter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,8 +26,8 @@ extern "C" { -static jvmtiEnv* jvmti = NULL; -static jrawMonitorID threadLock = NULL; +static jvmtiEnv* jvmti = nullptr; +static jrawMonitorID threadLock = nullptr; static char threadLockName[] = "threadLock"; #define LOG(...) \ diff --git a/test/hotspot/jtreg/serviceability/jvmti/VMObjectAlloc/libVMObjectAlloc.cpp b/test/hotspot/jtreg/serviceability/jvmti/VMObjectAlloc/libVMObjectAlloc.cpp index fc5113f1aadc..20b06c6648ef 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/VMObjectAlloc/libVMObjectAlloc.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/VMObjectAlloc/libVMObjectAlloc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2024, 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,8 +35,8 @@ VMObjectAlloc(jvmtiEnv *jvmti, jobject object, jclass cls, jlong size) { - char *signature = NULL; - jvmtiError err = jvmti->GetClassSignature(cls, &signature, NULL); + char *signature = nullptr; + jvmtiError err = jvmti->GetClassSignature(cls, &signature, nullptr); if (err != JVMTI_ERROR_NONE) { jni->FatalError("Failed during the GetClassSignature call"); } @@ -80,7 +80,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_OBJECT_ALLOC , NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_OBJECT_ALLOC , nullptr); if (err != JVMTI_ERROR_NONE) { return JNI_ERR; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/Breakpoint/breakpoint01/libbreakpoint01.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/Breakpoint/breakpoint01/libbreakpoint01.cpp index 38f0bbd20753..9f6c4f941de0 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/events/Breakpoint/breakpoint01/libbreakpoint01.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/events/Breakpoint/breakpoint01/libbreakpoint01.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,7 +27,7 @@ #include "jni_md.h" #include "jvmti.h" -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { @@ -52,7 +52,7 @@ static const char *THREAD_NAME = "breakpoint01Thr"; static volatile int bpEvents[METH_NUM]; static volatile jint result = PASSED; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static volatile int callbacksEnabled = JNI_TRUE; @@ -92,7 +92,7 @@ ClassLoad(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, jclass klass) { jni->FatalError("failed to obtain a class signature\n"); } - if (sig != NULL && (strcmp(sig, CLASS_SIG) == 0)) { + if (sig != nullptr && (strcmp(sig, CLASS_SIG) == 0)) { LOG("ClassLoad event received for the class %s setting breakpoints ...\n", sig); setBP(jvmti, jni, klass); } @@ -116,10 +116,10 @@ Breakpoint(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, jmethodID method, jloca return; } - const char* thr_name = thr_info.name == NULL ? "NULL" : thr_info.name; + const char* thr_name = thr_info.name == nullptr ? "null" : thr_info.name; const char* thr_virtual_tag = jni->IsVirtualThread(thread) == JNI_TRUE ? "virtual" : "platform"; const char* thr_daemon_tag = thr_info.is_daemon == JNI_TRUE ? "deamon" : "user"; - if (thr_info.name == NULL || strcmp(thr_info.name, THREAD_NAME) != 0) { + if (thr_info.name == nullptr || strcmp(thr_info.name, THREAD_NAME) != 0) { result = checkStatus = STATUS_FAILED; LOG("TEST FAILED: Breakpoint event with unexpected thread info:\n"); LOG("\tname: \"%s\"\ttype: %s %s thread\n\n", thr_name, thr_virtual_tag, thr_daemon_tag); @@ -148,14 +148,14 @@ Breakpoint(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, jmethodID method, jloca LOG("TEST FAILED: unable to obtain a class signature during Breakpoint callback\n\n"); return; } - if (clsSig == NULL || strcmp(clsSig, CLASS_SIG) != 0) { + if (clsSig == nullptr || strcmp(clsSig, CLASS_SIG) != 0) { result = checkStatus = STATUS_FAILED; - LOG("TEST FAILED: Breakpoint event with unexpected class signature: %s\n\n", (clsSig == NULL) ? "NULL" : clsSig); + LOG("TEST FAILED: Breakpoint event with unexpected class signature: %s\n\n", (clsSig == nullptr) ? "null" : clsSig); } else { LOG("CHECK PASSED: class signature: \"%s\"\n", clsSig); } - err = jvmti->GetMethodName(method, &methNam, &methSig, NULL); + err = jvmti->GetMethodName(method, &methNam, &methSig, nullptr); if (err != JVMTI_ERROR_NONE) { result = checkStatus = STATUS_FAILED; LOG("TEST FAILED: unable to get method name during Breakpoint callback\n\n"); @@ -230,7 +230,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_9); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -268,22 +268,22 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { LOG("setting event callbacks done\nenabling JVMTI events ...\n"); - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_START, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_START, nullptr); if (err != JVMTI_ERROR_NONE) return JNI_ERR; - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, nullptr); if (err != JVMTI_ERROR_NONE) return JNI_ERR; - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, nullptr); if (err != JVMTI_ERROR_NONE) return JNI_ERR; - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, nullptr); if (err != JVMTI_ERROR_NONE) return JNI_ERR; LOG("enabling the events done\n\n"); agent_lock = create_raw_monitor(jvmti, "agent_lock"); - if (agent_lock == NULL) + if (agent_lock == nullptr) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/ClassLoad/classload01/libclassload01.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/ClassLoad/classload01/libclassload01.cpp index 6cff11b9dda7..f8d8af90e9ed 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/events/ClassLoad/classload01/libclassload01.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/events/ClassLoad/classload01/libclassload01.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,7 +27,7 @@ #include -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { @@ -75,7 +75,7 @@ static volatile int clsEvents[EXP_SIG_NUM]; static volatile int primClsEvents[UNEXP_SIG_NUM]; static jint result = PASSED; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jrawMonitorID counter_lock; @@ -91,7 +91,7 @@ static void initCounters() { static int findSig(char *sig, int expected) { for (unsigned int i = 0; i < ((expected == 1) ? EXP_SIG_NUM : UNEXP_SIG_NUM); i++) { - if (sig != NULL && + if (sig != nullptr && strcmp(((expected == 1) ? expSigs[i] : unexpSigs[i]), sig) == 0) { return i; /* the signature found, return index */ } @@ -160,7 +160,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_9); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -197,7 +197,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } LOG("setting event callbacks done\nenabling ClassLoad event ...\n"); - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("Error in SetEventNotificationMode: %d\n", err); return JNI_ERR; diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/ClassPrepare/classprep01/libclassprep01.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/ClassPrepare/classprep01/libclassprep01.cpp index 0933fec1d00c..934ccaf4e3ca 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/events/ClassPrepare/classprep01/libclassprep01.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/events/ClassPrepare/classprep01/libclassprep01.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,7 @@ #include #include "jvmti.h" -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { @@ -45,7 +45,7 @@ typedef struct { jint icount; } class_info; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jint result = PASSED; static size_t eventsCount = 0; @@ -158,7 +158,7 @@ void JNICALL ClassPrepare(jvmtiEnv *jvmti, JNIEnv *jni, jthread thr, jclass cls) LOG(">>> %d methods:", inf.mcount); for (int i = 0; i < inf.mcount; i++) { if (i > 0) LOG(","); - if (methods[i] == NULL) { + if (methods[i] == nullptr) { LOG(" null"); } else { err = jvmti->GetMethodName(methods[i], &name, &sig, &generic); @@ -173,7 +173,7 @@ void JNICALL ClassPrepare(jvmtiEnv *jvmti, JNIEnv *jni, jthread thr, jclass cls) LOG(">>> %d fields:", inf.fcount); for (int i = 0; i < inf.fcount; i++) { if (i > 0) LOG(","); - if (fields[i] == NULL) { + if (fields[i] == nullptr) { LOG(" null"); } else { err = jvmti->GetFieldName(cls, fields[i], &name, &sig, &generic); @@ -188,7 +188,7 @@ void JNICALL ClassPrepare(jvmtiEnv *jvmti, JNIEnv *jni, jthread thr, jclass cls) LOG(">>> %d interfaces:", inf.icount); for (int i = 0; i < inf.icount; i++) { if (i > 0) LOG(","); - if (interfaces[i] == NULL) { + if (interfaces[i] == nullptr) { LOG(" null"); } else { err = jvmti->GetClassSignature(interfaces[i], &sig, &generic); @@ -226,7 +226,7 @@ void JNICALL ClassPrepare(jvmtiEnv *jvmti, JNIEnv *jni, jthread thr, jclass cls) return; } - if (inf.sig == NULL || strcmp(inf.sig, classes[eventsCount].sig) != 0) { + if (inf.sig == nullptr || strcmp(inf.sig, classes[eventsCount].sig) != 0) { LOG("(#%" PRIuPTR ") wrong class: \"%s\"", eventsCount, inf.sig); LOG(", expected: \"%s\"\n", classes[eventsCount].sig); result = STATUS_FAILED; @@ -262,7 +262,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -299,7 +299,7 @@ JNIEXPORT void JNICALL Java_classprep01_getReady(JNIEnv *jni, jclass cls, jthread thread) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { LOG("JVMTI client was not properly loaded!\n"); return; } @@ -327,7 +327,7 @@ JNIEXPORT jint JNICALL Java_classprep01_check(JNIEnv *jni, jclass cls, jthread thread) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { LOG("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/Exception/exception01/libexception01.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/Exception/exception01/libexception01.cpp index a044bc4387be..0910053dfe27 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/events/Exception/exception01/libexception01.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/events/Exception/exception01/libexception01.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ #include #include #include "jvmti.h" -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { @@ -56,7 +56,7 @@ typedef struct { jlocation c_loc; } exceptionInfo; -static jvmtiEnv *jvmti_env = NULL; +static jvmtiEnv *jvmti_env = nullptr; static jvmtiEventCallbacks callbacks; static jint result = PASSED; static exceptionInfo exs[] = { @@ -139,13 +139,13 @@ Exception(jvmtiEnv *jvmti, JNIEnv *jni, jthread thr, bool found = false; for (size_t i = 0; i < sizeof(exs)/sizeof(exceptionInfo); i++) { - if (ex.name != NULL && strcmp(ex.name, exs[i].name) == 0 - && ex.t_cls != NULL && strcmp(ex.t_cls, exs[i].t_cls) == 0 - && ex.t_name != NULL && strcmp(ex.t_name, exs[i].t_name) == 0 - && ex.t_sig != NULL && strcmp(ex.t_sig, exs[i].t_sig) == 0 - && ex.c_cls != NULL && strcmp(ex.c_cls, exs[i].c_cls) == 0 - && ex.c_name != NULL && strcmp(ex.c_name, exs[i].c_name) == 0 - && ex.c_sig != NULL && strcmp(ex.c_sig, exs[i].c_sig) == 0 + if (ex.name != nullptr && strcmp(ex.name, exs[i].name) == 0 + && ex.t_cls != nullptr && strcmp(ex.t_cls, exs[i].t_cls) == 0 + && ex.t_name != nullptr && strcmp(ex.t_name, exs[i].t_name) == 0 + && ex.t_sig != nullptr && strcmp(ex.t_sig, exs[i].t_sig) == 0 + && ex.c_cls != nullptr && strcmp(ex.c_cls, exs[i].c_cls) == 0 + && ex.c_name != nullptr && strcmp(ex.c_name, exs[i].c_name) == 0 + && ex.c_sig != nullptr && strcmp(ex.c_sig, exs[i].c_sig) == 0 && ex.t_loc == exs[i].t_loc && ex.c_loc == exs[i].c_loc) { jboolean isVirtual = jni->IsVirtualThread(thr); if (isVirtualExpected != isVirtual) { @@ -175,7 +175,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiCapabilities caps; res = jvm->GetEnv((void **) &jvmti_env, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti_env == NULL) { + if (res != JNI_OK || jvmti_env == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -217,27 +217,27 @@ Java_exception01_check(JNIEnv *jni, jclass cls) { jclass clz; jmethodID mid; - if (jvmti_env == NULL) { + if (jvmti_env == nullptr) { LOG("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } clz = jni->FindClass("exception01c"); - if (clz == NULL) { + if (clz == nullptr) { LOG("Cannot find exception01c class!\n"); return STATUS_FAILED; } clz = jni->FindClass("exception01b"); - if (clz == NULL) { + if (clz == nullptr) { LOG("Cannot find exception01b class!\n"); return STATUS_FAILED; } clz = jni->FindClass("exception01a"); - if (clz == NULL) { + if (clz == nullptr) { LOG("Cannot find exception01a class!\n"); return STATUS_FAILED; } mid = jni->GetStaticMethodID(clz, "run", "()V"); - if (mid == NULL) { + if (mid == nullptr) { LOG("Cannot find method run!\n"); return STATUS_FAILED; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/ExceptionCatch/excatch01/libexcatch01.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/ExceptionCatch/excatch01/libexcatch01.cpp index bd9d263c1b25..8c600ed61e6b 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/events/ExceptionCatch/excatch01/libexcatch01.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/events/ExceptionCatch/excatch01/libexcatch01.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ #include #include #include "jvmti.h" -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { @@ -48,7 +48,7 @@ typedef struct { jlocation c_loc; } exceptionInfo; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; static jint result = PASSED; @@ -107,10 +107,10 @@ ExceptionCatch(jvmtiEnv *jvmti, JNIEnv *jni, jthread thr, jmethodID method, jloc bool found = false; for (size_t i = 0; i < sizeof(exs)/sizeof(exceptionInfo); i++) { - if (ex.name != NULL && strcmp(ex.name, exs[i].name) == 0 - && ex.c_cls != NULL && strcmp(ex.c_cls, exs[i].c_cls) == 0 - && ex.c_name != NULL && strcmp(ex.c_name, exs[i].c_name) == 0 - && ex.c_sig != NULL && strcmp(ex.c_sig, exs[i].c_sig) == 0 + if (ex.name != nullptr && strcmp(ex.name, exs[i].name) == 0 + && ex.c_cls != nullptr && strcmp(ex.c_cls, exs[i].c_cls) == 0 + && ex.c_name != nullptr && strcmp(ex.c_name, exs[i].c_name) == 0 + && ex.c_sig != nullptr && strcmp(ex.c_sig, exs[i].c_sig) == 0 && ex.c_loc == exs[i].c_loc) { jboolean isVirtual = jni->IsVirtualThread(thr); if (isVirtualExpected != isVirtual) { @@ -138,7 +138,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -180,28 +180,28 @@ Java_excatch01_check(JNIEnv *jni, jclass cls) { jmethodID mid; jthread thread; - if (jvmti == NULL) { + if (jvmti == nullptr) { LOG("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } clz = jni->FindClass("excatch01c"); - if (clz == NULL) { + if (clz == nullptr) { LOG("Cannot find excatch01c class!\n"); return STATUS_FAILED; } clz = jni->FindClass("excatch01b"); - if (clz == NULL) { + if (clz == nullptr) { LOG("Cannot find excatch01b class!\n"); return STATUS_FAILED; } clz = jni->FindClass("excatch01a"); - if (clz == NULL) { + if (clz == nullptr) { LOG("Cannot find excatch01a class!\n"); return STATUS_FAILED; } mid = jni->GetStaticMethodID(clz, "run", "()V"); - if (mid == NULL) { + if (mid == nullptr) { LOG("Cannot find method run!\n"); return STATUS_FAILED; } @@ -213,7 +213,7 @@ Java_excatch01_check(JNIEnv *jni, jclass cls) { return STATUS_FAILED; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_EXCEPTION_CATCH, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_EXCEPTION_CATCH, nullptr); if (err == JVMTI_ERROR_NONE) { eventsExpected = sizeof(exs)/sizeof(exceptionInfo); } else { @@ -224,7 +224,7 @@ Java_excatch01_check(JNIEnv *jni, jclass cls) { eventsCount = 0; isVirtualExpected = jni->IsVirtualThread(thread); jni->CallStaticVoidMethod(clz, mid); - err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_EXCEPTION_CATCH, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_EXCEPTION_CATCH, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("Failed to disable JVMTI_EVENT_EXCEPTION_CATCH: %s (%d)\n", TranslateError(err), err); result = STATUS_FAILED; diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/FieldAccess/fieldacc01/libfieldacc01.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/FieldAccess/fieldacc01/libfieldacc01.cpp index b0ad276a1ce5..2b34dc48e93b 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/events/FieldAccess/fieldacc01/libfieldacc01.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/events/FieldAccess/fieldacc01/libfieldacc01.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ #include #include #include "jvmti.h" -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { @@ -65,45 +65,45 @@ static volatile jboolean isVirtualExpected = JNI_FALSE; static volatile int eventsExpected = 0; static volatile int eventsCount = 0; static watch_info watches[] = { - { NULL, "Lfieldacc01a;", "run", "()I", 2, + { nullptr, "Lfieldacc01a;", "run", "()I", 2, "Lfieldacc01a;", "staticBoolean", "Z", JNI_TRUE }, - { NULL, "Lfieldacc01a;", "run", "()I", 6, + { nullptr, "Lfieldacc01a;", "run", "()I", 6, "Lfieldacc01a;", "instanceBoolean", "Z", JNI_FALSE }, - { NULL, "Lfieldacc01a;", "run", "()I", 15, + { nullptr, "Lfieldacc01a;", "run", "()I", 15, "Lfieldacc01a;", "staticByte", "B", JNI_TRUE }, - { NULL, "Lfieldacc01a;", "run", "()I", 19, + { nullptr, "Lfieldacc01a;", "run", "()I", 19, "Lfieldacc01a;", "instanceByte", "B", JNI_FALSE }, - { NULL, "Lfieldacc01a;", "run", "()I", 28, + { nullptr, "Lfieldacc01a;", "run", "()I", 28, "Lfieldacc01a;", "staticShort", "S", JNI_TRUE }, - { NULL, "Lfieldacc01a;", "run", "()I", 32, + { nullptr, "Lfieldacc01a;", "run", "()I", 32, "Lfieldacc01a;", "instanceShort", "S", JNI_FALSE }, - { NULL, "Lfieldacc01a;", "run", "()I", 41, + { nullptr, "Lfieldacc01a;", "run", "()I", 41, "Lfieldacc01a;", "staticInt", "I", JNI_TRUE }, - { NULL, "Lfieldacc01a;", "run", "()I", 45, + { nullptr, "Lfieldacc01a;", "run", "()I", 45, "Lfieldacc01a;", "instanceInt", "I", JNI_FALSE }, - { NULL, "Lfieldacc01a;", "run", "()I", 54, + { nullptr, "Lfieldacc01a;", "run", "()I", 54, "Lfieldacc01a;", "staticLong", "J", JNI_TRUE }, - { NULL, "Lfieldacc01a;", "run", "()I", 58, + { nullptr, "Lfieldacc01a;", "run", "()I", 58, "Lfieldacc01a;", "instanceLong", "J", JNI_FALSE }, - { NULL, "Lfieldacc01a;", "run", "()I", 68, + { nullptr, "Lfieldacc01a;", "run", "()I", 68, "Lfieldacc01a;", "staticFloat", "F", JNI_TRUE }, - { NULL, "Lfieldacc01a;", "run", "()I", 72, + { nullptr, "Lfieldacc01a;", "run", "()I", 72, "Lfieldacc01a;", "instanceFloat", "F", JNI_FALSE }, - { NULL, "Lfieldacc01a;", "run", "()I", 82, + { nullptr, "Lfieldacc01a;", "run", "()I", 82, "Lfieldacc01a;", "staticDouble", "D", JNI_TRUE }, - { NULL, "Lfieldacc01a;", "run", "()I", 86, + { nullptr, "Lfieldacc01a;", "run", "()I", 86, "Lfieldacc01a;", "instanceDouble", "D", JNI_FALSE }, - { NULL, "Lfieldacc01a;", "run", "()I", 96, + { nullptr, "Lfieldacc01a;", "run", "()I", 96, "Lfieldacc01a;", "staticChar", "C", JNI_TRUE }, - { NULL, "Lfieldacc01a;", "run", "()I", 100, + { nullptr, "Lfieldacc01a;", "run", "()I", 100, "Lfieldacc01a;", "instanceChar", "C", JNI_FALSE }, - { NULL, "Lfieldacc01a;", "run", "()I", 109, + { nullptr, "Lfieldacc01a;", "run", "()I", 109, "Lfieldacc01a;", "staticObject", "Ljava/lang/Object;", JNI_TRUE }, - { NULL, "Lfieldacc01a;", "run", "()I", 113, + { nullptr, "Lfieldacc01a;", "run", "()I", 113, "Lfieldacc01a;", "instanceObject", "Ljava/lang/Object;", JNI_FALSE }, - { NULL, "Lfieldacc01a;", "run", "()I", 122, + { nullptr, "Lfieldacc01a;", "run", "()I", 122, "Lfieldacc01a;", "staticArrInt", "[I", JNI_TRUE }, - { NULL, "Lfieldacc01a;", "run", "()I", 128, + { nullptr, "Lfieldacc01a;", "run", "()I", 128, "Lfieldacc01a;", "instanceArrInt", "[I", JNI_FALSE } }; @@ -121,7 +121,7 @@ void JNICALL FieldAccess(jvmtiEnv *jvmti, JNIEnv *jni, watch.fid = field; watch.loc = location; - watch.is_static = (obj == NULL) ? JNI_TRUE : JNI_FALSE; + watch.is_static = (obj == nullptr) ? JNI_TRUE : JNI_FALSE; err = jvmti->GetMethodDeclaringClass(method, &cls); if (err != JVMTI_ERROR_NONE) { LOG("(GetMethodDeclaringClass) unexpected error: %s (%d)\n", TranslateError(err), err); @@ -163,16 +163,16 @@ void JNICALL FieldAccess(jvmtiEnv *jvmti, JNIEnv *jni, for (size_t i = 0; i < sizeof(watches)/sizeof(watch_info); i++) { if (watch.fid == watches[i].fid) { - if (watch.m_cls == NULL || strcmp(watch.m_cls, watches[i].m_cls) != 0) { + if (watch.m_cls == nullptr || strcmp(watch.m_cls, watches[i].m_cls) != 0) { LOG("(watch#%" PRIuPTR ") wrong class: \"%s\", expected: \"%s\"\n", i, watch.m_cls, watches[i].m_cls); result = STATUS_FAILED; } - if (watch.m_name == NULL || strcmp(watch.m_name, watches[i].m_name) != 0) { + if (watch.m_name == nullptr || strcmp(watch.m_name, watches[i].m_name) != 0) { LOG("(watch#%" PRIuPTR ") wrong method name: \"%s\"", i, watch.m_name); LOG(", expected: \"%s\"\n", watches[i].m_name); result = STATUS_FAILED; } - if (watch.m_sig == NULL || strcmp(watch.m_sig, watches[i].m_sig) != 0) { + if (watch.m_sig == nullptr || strcmp(watch.m_sig, watches[i].m_sig) != 0) { LOG("(watch#%" PRIuPTR ") wrong method sig: \"%s\"", i, watch.m_sig); LOG(", expected: \"%s\"\n", watches[i].m_sig); result = STATUS_FAILED; @@ -182,12 +182,12 @@ void JNICALL FieldAccess(jvmtiEnv *jvmti, JNIEnv *jni, LOG(", expected: 0x%x%08x\n", (jint)(watches[i].loc >> 32), (jint)watches[i].loc); result = STATUS_FAILED; } - if (watch.f_name == NULL || strcmp(watch.f_name, watches[i].f_name) != 0) { + if (watch.f_name == nullptr || strcmp(watch.f_name, watches[i].f_name) != 0) { LOG("(watch#%" PRIuPTR ") wrong field name: \"%s\"", i, watch.f_name); LOG(", expected: \"%s\"\n", watches[i].f_name); result = STATUS_FAILED; } - if (watch.f_sig == NULL || strcmp(watch.f_sig, watches[i].f_sig) != 0) { + if (watch.f_sig == nullptr || strcmp(watch.f_sig, watches[i].f_sig) != 0) { LOG("(watch#%" PRIuPTR ") wrong field sig: \"%s\"", i, watch.f_sig); LOG(", expected: \"%s\"\n", watches[i].f_sig); result = STATUS_FAILED; @@ -216,7 +216,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -245,7 +245,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FIELD_ACCESS, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FIELD_ACCESS, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("Failed to enable JVMTI_EVENT_FIELD_ACCESS: %s (%d)\n", TranslateError(err), err); return JNI_ERR; @@ -267,7 +267,7 @@ Java_fieldacc01_getReady(JNIEnv *jni, jclass klass) { LOG(">>> setting field access watches ...\n"); cls = jni->FindClass("fieldacc01a"); - if (cls == NULL) { + if (cls == nullptr) { LOG("Cannot find fieldacc01a class!\n"); result = STATUS_FAILED; return; @@ -289,7 +289,7 @@ Java_fieldacc01_getReady(JNIEnv *jni, jclass klass) { } else { watches[i].fid = jni->GetFieldID(cls, watches[i].f_name, watches[i].f_sig); } - if (watches[i].fid == NULL) { + if (watches[i].fid == nullptr) { LOG("Cannot find field \"%s\"!\n", watches[i].f_name); result = STATUS_FAILED; return; @@ -317,7 +317,7 @@ Java_fieldacc01_check(JNIEnv *jni, jclass klass) { } cls = jni->FindClass("fieldacc01a"); - if (cls == NULL) { + if (cls == nullptr) { LOG("Cannot find fieldacc01a class!\n"); result = STATUS_FAILED; return result; diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/FieldAccess/fieldacc02/libfieldacc02.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/FieldAccess/fieldacc02/libfieldacc02.cpp index 59d4150e4c23..240f38a81860 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/events/FieldAccess/fieldacc02/libfieldacc02.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/events/FieldAccess/fieldacc02/libfieldacc02.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ #include #include #include "jvmti.h" -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { @@ -65,46 +65,46 @@ static volatile jboolean isVirtualExpected = JNI_FALSE; static int eventsExpected = 0; static int eventsCount = 0; static watch_info watches[] = { - { NULL, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldacc02a;", "staticBoolean", "Z", JNI_TRUE }, - { NULL, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldacc02a;", "staticByte", "B", JNI_TRUE }, - { NULL, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldacc02a;", "staticShort", "S", JNI_TRUE }, - { NULL, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldacc02a;", "staticInt", "I", JNI_TRUE }, - { NULL, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldacc02a;", "staticLong", "J", JNI_TRUE }, - { NULL, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldacc02a;", "staticFloat", "F", JNI_TRUE }, - { NULL, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldacc02a;", "staticDouble", "D", JNI_TRUE }, - { NULL, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldacc02a;", "staticChar", "C", JNI_TRUE }, - { NULL, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldacc02a;", "staticObject", "Ljava/lang/Object;", JNI_TRUE }, - { NULL, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldacc02a;", "staticArrInt", "[I", JNI_TRUE }, - { NULL, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldacc02a;", "instanceBoolean", "Z", JNI_FALSE }, - { NULL, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldacc02a;", "instanceByte", "B", JNI_FALSE }, - { NULL, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldacc02a;", "instanceShort", "S", JNI_FALSE }, - { NULL, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldacc02a;", "instanceInt", "I", JNI_FALSE }, - { NULL, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldacc02a;", "instanceLong", "J", JNI_FALSE }, - { NULL, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldacc02a;", "instanceFloat", "F", JNI_FALSE }, - { NULL, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldacc02a;", "instanceDouble", "D", JNI_FALSE }, - { NULL, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldacc02a;", "instanceChar", "C", JNI_FALSE }, - { NULL, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldacc02a;", "instanceObject", "Ljava/lang/Object;", JNI_FALSE }, - { NULL, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldacc02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldacc02a;", "instanceArrInt", "[I", JNI_FALSE } }; @@ -121,7 +121,7 @@ void JNICALL FieldAccess(jvmtiEnv *jvmti, JNIEnv *jni, watch.fid = field; watch.loc = location; - watch.is_static = (obj == NULL) ? JNI_TRUE : JNI_FALSE; + watch.is_static = (obj == nullptr) ? JNI_TRUE : JNI_FALSE; err = jvmti->GetMethodDeclaringClass(method, &cls); if (err != JVMTI_ERROR_NONE) { LOG("(GetMethodDeclaringClass) unexpected error: %s (%d)\n", TranslateError(err), err); @@ -162,16 +162,16 @@ void JNICALL FieldAccess(jvmtiEnv *jvmti, JNIEnv *jni, for (size_t i = 0; i < sizeof(watches)/sizeof(watch_info); i++) { if (watch.fid == watches[i].fid) { - if (watch.m_cls == NULL || strcmp(watch.m_cls, watches[i].m_cls) != 0) { + if (watch.m_cls == nullptr || strcmp(watch.m_cls, watches[i].m_cls) != 0) { LOG("(watch#%" PRIuPTR ") wrong class: \"%s\", expected: \"%s\"\n", i, watch.m_cls, watches[i].m_cls); result = STATUS_FAILED; } - if (watch.m_name == NULL || strcmp(watch.m_name, watches[i].m_name) != 0) { + if (watch.m_name == nullptr || strcmp(watch.m_name, watches[i].m_name) != 0) { LOG("(watch#%" PRIuPTR ") wrong method name: \"%s\"", i, watch.m_name); LOG(", expected: \"%s\"\n", watches[i].m_name); result = STATUS_FAILED; } - if (watch.m_sig == NULL || strcmp(watch.m_sig, watches[i].m_sig) != 0) { + if (watch.m_sig == nullptr || strcmp(watch.m_sig, watches[i].m_sig) != 0) { LOG("(watch#%" PRIuPTR ") wrong method sig: \"%s\"", i, watch.m_sig); LOG(", expected: \"%s\"\n", watches[i].m_sig); result = STATUS_FAILED; @@ -181,12 +181,12 @@ void JNICALL FieldAccess(jvmtiEnv *jvmti, JNIEnv *jni, LOG(", expected: 0x%x%08x\n", (jint)(watches[i].loc >> 32), (jint)watches[i].loc); result = STATUS_FAILED; } - if (watch.f_name == NULL || strcmp(watch.f_name, watches[i].f_name) != 0) { + if (watch.f_name == nullptr || strcmp(watch.f_name, watches[i].f_name) != 0) { LOG("(watch#%" PRIuPTR ") wrong field name: \"%s\"", i, watch.f_name); LOG(", expected: \"%s\"\n", watches[i].f_name); result = STATUS_FAILED; } - if (watch.f_sig == NULL || strcmp(watch.f_sig, watches[i].f_sig) != 0) { + if (watch.f_sig == nullptr || strcmp(watch.f_sig, watches[i].f_sig) != 0) { LOG("(watch#%" PRIuPTR ") wrong field sig: \"%s\"", i, watch.f_sig); LOG(", expected: \"%s\"\n", watches[i].f_sig); result = STATUS_FAILED; @@ -214,7 +214,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -243,7 +243,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FIELD_ACCESS, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FIELD_ACCESS, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("Failed to enable JVMTI_EVENT_FIELD_ACCESS: %s (%d)\n", TranslateError(err), err); @@ -264,7 +264,7 @@ JNIEXPORT void JNICALL Java_fieldacc02_getReady(JNIEnv *jni, jclass clz) { LOG(">>> setting field access watches ...\n"); cls = jni->FindClass("fieldacc02a"); - if (cls == NULL) { + if (cls == nullptr) { LOG("Cannot find fieldacc02a class!\n"); result = STATUS_FAILED; return; @@ -287,7 +287,7 @@ JNIEXPORT void JNICALL Java_fieldacc02_getReady(JNIEnv *jni, jclass clz) { } else { watches[i].fid = jni->GetFieldID(cls, watches[i].f_name, watches[i].f_sig); } - if (watches[i].fid == NULL) { + if (watches[i].fid == nullptr) { LOG("Cannot find field \"%s\"!\n", watches[i].f_name); result = STATUS_FAILED; return; @@ -313,7 +313,7 @@ Java_fieldacc02_check(JNIEnv *jni, jclass clz, jobject obj) { LOG(">>> accessing fields ...\n"); cls = jni->FindClass("fieldacc02a"); - if (cls == NULL) { + if (cls == nullptr) { LOG("Cannot find fieldacc02a class!\n"); return STATUS_FAILED; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/FieldAccess/fieldacc03/libfieldacc03.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/FieldAccess/fieldacc03/libfieldacc03.cpp index 97c7d145918f..6529adaceacf 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/events/FieldAccess/fieldacc03/libfieldacc03.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/events/FieldAccess/fieldacc03/libfieldacc03.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ #include #include #include "jvmti.h" -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { @@ -65,25 +65,25 @@ static volatile jboolean isVirtualExpected = JNI_FALSE; static int eventsExpected = 0; static int eventsCount = 0; static watch_info watches[] = { - { NULL, "Lfieldacc03a;", "run", "()I", 3, + { nullptr, "Lfieldacc03a;", "run", "()I", 3, "Lfieldacc03a;", "extendsBoolean", "Z", JNI_FALSE }, - { NULL, "Lfieldacc03a;", "run", "()I", 14, + { nullptr, "Lfieldacc03a;", "run", "()I", 14, "Lfieldacc03a;", "extendsByte", "B", JNI_FALSE }, - { NULL, "Lfieldacc03a;", "run", "()I", 25, + { nullptr, "Lfieldacc03a;", "run", "()I", 25, "Lfieldacc03a;", "extendsShort", "S", JNI_FALSE }, - { NULL, "Lfieldacc03a;", "run", "()I", 36, + { nullptr, "Lfieldacc03a;", "run", "()I", 36, "Lfieldacc03a;", "extendsInt", "I", JNI_FALSE }, - { NULL, "Lfieldacc03a;", "run", "()I", 47, + { nullptr, "Lfieldacc03a;", "run", "()I", 47, "Lfieldacc03a;", "extendsLong", "J", JNI_FALSE }, - { NULL, "Lfieldacc03a;", "run", "()I", 61, + { nullptr, "Lfieldacc03a;", "run", "()I", 61, "Lfieldacc03a;", "extendsFloat", "F", JNI_FALSE }, - { NULL, "Lfieldacc03a;", "run", "()I", 74, + { nullptr, "Lfieldacc03a;", "run", "()I", 74, "Lfieldacc03a;", "extendsDouble", "D", JNI_FALSE }, - { NULL, "Lfieldacc03a;", "run", "()I", 88, + { nullptr, "Lfieldacc03a;", "run", "()I", 88, "Lfieldacc03a;", "extendsChar", "C", JNI_FALSE }, - { NULL, "Lfieldacc03a;", "run", "()I", 100, + { nullptr, "Lfieldacc03a;", "run", "()I", 100, "Lfieldacc03a;", "extendsObject", "Ljava/lang/Object;", JNI_FALSE }, - { NULL, "Lfieldacc03a;", "run", "()I", 111, + { nullptr, "Lfieldacc03a;", "run", "()I", 111, "Lfieldacc03a;", "extendsArrInt", "[I", JNI_FALSE } }; @@ -100,7 +100,7 @@ void JNICALL FieldAccess(jvmtiEnv *jvmti, JNIEnv *jni, watch.fid = field; watch.loc = location; - watch.is_static = (obj == NULL) ? JNI_TRUE : JNI_FALSE; + watch.is_static = (obj == nullptr) ? JNI_TRUE : JNI_FALSE; err = jvmti->GetMethodDeclaringClass(method, &cls); if (err != JVMTI_ERROR_NONE) { LOG("(GetMethodDeclaringClass) unexpected error: %s (%d)\n", TranslateError(err), err); @@ -142,16 +142,16 @@ void JNICALL FieldAccess(jvmtiEnv *jvmti, JNIEnv *jni, for (size_t i = 0; i < sizeof(watches)/sizeof(watch_info); i++) { if (watch.fid == watches[i].fid) { - if (watch.m_cls == NULL || strcmp(watch.m_cls, watches[i].m_cls) != 0) { + if (watch.m_cls == nullptr || strcmp(watch.m_cls, watches[i].m_cls) != 0) { LOG("(watch#%" PRIuPTR ") wrong class: \"%s\", expected: \"%s\"\n", i, watch.m_cls, watches[i].m_cls); result = STATUS_FAILED; } - if (watch.m_name == NULL || strcmp(watch.m_name, watches[i].m_name) != 0) { + if (watch.m_name == nullptr || strcmp(watch.m_name, watches[i].m_name) != 0) { LOG("(watch#%" PRIuPTR ") wrong method name: \"%s\"", i, watch.m_name); LOG(", expected: \"%s\"\n", watches[i].m_name); result = STATUS_FAILED; } - if (watch.m_sig == NULL || strcmp(watch.m_sig, watches[i].m_sig) != 0) { + if (watch.m_sig == nullptr || strcmp(watch.m_sig, watches[i].m_sig) != 0) { LOG("(watch#%" PRIuPTR ") wrong method sig: \"%s\"", i, watch.m_sig); LOG(", expected: \"%s\"\n", watches[i].m_sig); result = STATUS_FAILED; @@ -161,12 +161,12 @@ void JNICALL FieldAccess(jvmtiEnv *jvmti, JNIEnv *jni, LOG(", expected: 0x%x%08x\n", (jint)(watches[i].loc >> 32), (jint)watches[i].loc); result = STATUS_FAILED; } - if (watch.f_name == NULL || strcmp(watch.f_name, watches[i].f_name) != 0) { + if (watch.f_name == nullptr || strcmp(watch.f_name, watches[i].f_name) != 0) { LOG("(watch#%" PRIuPTR ") wrong field name: \"%s\"", i, watch.f_name); LOG(", expected: \"%s\"\n", watches[i].f_name); result = STATUS_FAILED; } - if (watch.f_sig == NULL || strcmp(watch.f_sig, watches[i].f_sig) != 0) { + if (watch.f_sig == nullptr || strcmp(watch.f_sig, watches[i].f_sig) != 0) { LOG("(watch#%" PRIuPTR ") wrong field sig: \"%s\"", i, watch.f_sig); LOG(", expected: \"%s\"\n", watches[i].f_sig); result = STATUS_FAILED; @@ -194,7 +194,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -223,7 +223,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FIELD_ACCESS, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FIELD_ACCESS, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("Failed to enable JVMTI_EVENT_FIELD_ACCESS: %s (%d)\n", TranslateError(err), err); return JNI_ERR; @@ -256,7 +256,7 @@ Java_fieldacc03_getReady(JNIEnv *jni, jclass klass) { for (size_t i = 0; i < sizeof(watches)/sizeof(watch_info); i++) { cls = jni->FindClass(watches[i].f_cls); - if (cls == NULL) { + if (cls == nullptr) { LOG("Cannot find %s class!\n", watches[i].f_cls); result = STATUS_FAILED; return; @@ -266,7 +266,7 @@ Java_fieldacc03_getReady(JNIEnv *jni, jclass klass) { } else { watches[i].fid = jni->GetFieldID(cls, watches[i].f_name, watches[i].f_sig); } - if (watches[i].fid == NULL) { + if (watches[i].fid == nullptr) { LOG("Cannot get field ID for \"%s:%s\"\n", watches[i].f_name, watches[i].f_sig); result = STATUS_FAILED; return; @@ -291,7 +291,7 @@ Java_fieldacc03_check(JNIEnv *jni, jclass clz) { } for (size_t i = 0; i < sizeof(watches)/sizeof(watch_info); i++) { jclass cls = jni->FindClass(watches[i].f_cls); - if (cls == NULL) { + if (cls == nullptr) { LOG("Cannot find %s class!\n", watches[i].f_cls); result = STATUS_FAILED; return result; diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/FieldAccess/fieldacc04/libfieldacc04.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/FieldAccess/fieldacc04/libfieldacc04.cpp index 1b1f9df96b70..e699d90671da 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/events/FieldAccess/fieldacc04/libfieldacc04.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/events/FieldAccess/fieldacc04/libfieldacc04.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ #include #include #include "jvmti.h" -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { @@ -65,10 +65,10 @@ static volatile jboolean isVirtualExpected = JNI_FALSE; static int eventsExpected = 0; static int eventsCount = 0; static watch_info watches[] = { - { NULL, "Lfieldacc04a;", "run", "()I", 2, + { nullptr, "Lfieldacc04a;", "run", "()I", 2, "Lfieldacc04a;", "interfaceObject", "Ljava/lang/Object;", JNI_TRUE }, - { NULL, "Lfieldacc04a;", "run", "()I", 12, + { nullptr, "Lfieldacc04a;", "run", "()I", 12, "Lfieldacc04a;", "interfaceArrInt", "[I", JNI_TRUE } }; @@ -87,7 +87,7 @@ void JNICALL FieldAccess(jvmtiEnv *jvmti, JNIEnv *jni, watch.fid = field; watch.loc = location; - watch.is_static = (obj == NULL) ? JNI_TRUE : JNI_FALSE; + watch.is_static = (obj == nullptr) ? JNI_TRUE : JNI_FALSE; err = jvmti->GetMethodDeclaringClass(method, &cls); if (err != JVMTI_ERROR_NONE) { LOG("(GetMethodDeclaringClass) unexpected error: %s (%d)\n", TranslateError(err), err); @@ -129,16 +129,16 @@ void JNICALL FieldAccess(jvmtiEnv *jvmti, JNIEnv *jni, for (size_t i = 0; i < sizeof(watches)/sizeof(watch_info); i++) { if (watch.fid == watches[i].fid) { - if (watch.m_cls == NULL || strcmp(watch.m_cls, watches[i].m_cls) != 0) { + if (watch.m_cls == nullptr || strcmp(watch.m_cls, watches[i].m_cls) != 0) { LOG("(watch#%" PRIuPTR ") wrong class: \"%s\", expected: \"%s\"\n", i, watch.m_cls, watches[i].m_cls); result = STATUS_FAILED; } - if (watch.m_name == NULL || strcmp(watch.m_name, watches[i].m_name) != 0) { + if (watch.m_name == nullptr || strcmp(watch.m_name, watches[i].m_name) != 0) { LOG("(watch#%" PRIuPTR ") wrong method name: \"%s\"", i, watch.m_name); LOG(", expected: \"%s\"\n", watches[i].m_name); result = STATUS_FAILED; } - if (watch.m_sig == NULL || strcmp(watch.m_sig, watches[i].m_sig) != 0) { + if (watch.m_sig == nullptr || strcmp(watch.m_sig, watches[i].m_sig) != 0) { LOG("(watch#%" PRIuPTR ") wrong method sig: \"%s\"", i, watch.m_sig); LOG(", expected: \"%s\"\n", watches[i].m_sig); result = STATUS_FAILED; @@ -148,12 +148,12 @@ void JNICALL FieldAccess(jvmtiEnv *jvmti, JNIEnv *jni, LOG(", expected: 0x%x%08x\n", (jint)(watches[i].loc >> 32), (jint)watches[i].loc); result = STATUS_FAILED; } - if (watch.f_name == NULL || strcmp(watch.f_name, watches[i].f_name) != 0) { + if (watch.f_name == nullptr || strcmp(watch.f_name, watches[i].f_name) != 0) { LOG("(watch#%" PRIuPTR ") wrong field name: \"%s\"", i, watch.f_name); LOG(", expected: \"%s\"\n", watches[i].f_name); result = STATUS_FAILED; } - if (watch.f_sig == NULL || strcmp(watch.f_sig, watches[i].f_sig) != 0) { + if (watch.f_sig == nullptr || strcmp(watch.f_sig, watches[i].f_sig) != 0) { LOG("(watch#%" PRIuPTR ") wrong field sig: \"%s\"", i, watch.f_sig); LOG(", expected: \"%s\"\n", watches[i].f_sig); result = STATUS_FAILED; @@ -181,7 +181,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -210,7 +210,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FIELD_ACCESS, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FIELD_ACCESS, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("Failed to enable JVMTI_EVENT_FIELD_ACCESS: %s (%d)\n", TranslateError(err), err); return JNI_ERR; @@ -243,7 +243,7 @@ Java_fieldacc04_getReady(JNIEnv *jni, jclass klass) { for (size_t i = 0; i < sizeof(watches)/sizeof(watch_info); i++) { cls = jni->FindClass(watches[i].f_cls); - if (cls == NULL) { + if (cls == nullptr) { LOG("Cannot find %s class!\n", watches[i].f_cls); result = STATUS_FAILED; return; @@ -253,7 +253,7 @@ Java_fieldacc04_getReady(JNIEnv *jni, jclass klass) { } else { watches[i].fid = jni->GetFieldID(cls, watches[i].f_name, watches[i].f_sig); } - if (watches[i].fid == NULL) { + if (watches[i].fid == nullptr) { LOG("Cannot get field ID for \"%s:%s\"\n", watches[i].f_name, watches[i].f_sig); result = STATUS_FAILED; return; @@ -279,7 +279,7 @@ Java_fieldacc04_check(JNIEnv *jni, jclass clz) { } for (size_t i = 0; i < sizeof(watches)/sizeof(watch_info); i++) { jclass cls = jni->FindClass(watches[i].f_cls); - if (cls == NULL) { + if (cls == nullptr) { LOG("Cannot find %s class!\n", watches[i].f_cls); result = STATUS_FAILED; return result; diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/FieldModification/fieldmod01/libfieldmod01.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/FieldModification/fieldmod01/libfieldmod01.cpp index cfd53a3f861c..0e8f5c0417e1 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/events/FieldModification/fieldmod01/libfieldmod01.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/events/FieldModification/fieldmod01/libfieldmod01.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ #include #include #include "jvmti.h" -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { @@ -67,46 +67,46 @@ static volatile jboolean isVirtualExpected = JNI_FALSE; static int eventsExpected = 0; static int eventsCount = 0; static watch_info watches[] = { - { NULL, "Lfieldmod01a;", "run", "()V", 1, + { nullptr, "Lfieldmod01a;", "run", "()V", 1, "Lfieldmod01a;", "staticBoolean", "Z", JNI_TRUE, {} }, - { NULL, "Lfieldmod01a;", "run", "()V", 5, + { nullptr, "Lfieldmod01a;", "run", "()V", 5, "Lfieldmod01a;", "staticByte", "B", JNI_TRUE, {} }, - { NULL, "Lfieldmod01a;", "run", "()V", 9, + { nullptr, "Lfieldmod01a;", "run", "()V", 9, "Lfieldmod01a;", "staticShort", "S", JNI_TRUE, {} }, - { NULL, "Lfieldmod01a;", "run", "()V", 13, + { nullptr, "Lfieldmod01a;", "run", "()V", 13, "Lfieldmod01a;", "staticInt", "I", JNI_TRUE, {} }, - { NULL, "Lfieldmod01a;", "run", "()V", 19, + { nullptr, "Lfieldmod01a;", "run", "()V", 19, "Lfieldmod01a;", "staticLong", "J", JNI_TRUE, {} }, - { NULL, "Lfieldmod01a;", "run", "()V", 24, + { nullptr, "Lfieldmod01a;", "run", "()V", 24, "Lfieldmod01a;", "staticFloat", "F", JNI_TRUE, {} }, - { NULL, "Lfieldmod01a;", "run", "()V", 30, + { nullptr, "Lfieldmod01a;", "run", "()V", 30, "Lfieldmod01a;", "staticDouble", "D", JNI_TRUE, {} }, - { NULL, "Lfieldmod01a;", "run", "()V", 35, + { nullptr, "Lfieldmod01a;", "run", "()V", 35, "Lfieldmod01a;", "staticChar", "C", JNI_TRUE, {} }, - { NULL, "Lfieldmod01a;", "run", "()V", 41, + { nullptr, "Lfieldmod01a;", "run", "()V", 41, "Lfieldmod01a;", "staticObject", "Ljava/lang/Object;", JNI_TRUE, {} }, - { NULL, "Lfieldmod01a;", "run", "()V", 47, + { nullptr, "Lfieldmod01a;", "run", "()V", 47, "Lfieldmod01a;", "staticArrInt", "[I", JNI_TRUE, {} }, - { NULL, "Lfieldmod01a;", "run", "()V", 52, + { nullptr, "Lfieldmod01a;", "run", "()V", 52, "Lfieldmod01a;", "instanceBoolean", "Z", JNI_FALSE, {} }, - { NULL, "Lfieldmod01a;", "run", "()V", 58, + { nullptr, "Lfieldmod01a;", "run", "()V", 58, "Lfieldmod01a;", "instanceByte", "B", JNI_FALSE, {} }, - { NULL, "Lfieldmod01a;", "run", "()V", 64, + { nullptr, "Lfieldmod01a;", "run", "()V", 64, "Lfieldmod01a;", "instanceShort", "S", JNI_FALSE, {} }, - { NULL, "Lfieldmod01a;", "run", "()V", 70, + { nullptr, "Lfieldmod01a;", "run", "()V", 70, "Lfieldmod01a;", "instanceInt", "I", JNI_FALSE, {} }, - { NULL, "Lfieldmod01a;", "run", "()V", 77, + { nullptr, "Lfieldmod01a;", "run", "()V", 77, "Lfieldmod01a;", "instanceLong", "J", JNI_FALSE, {} }, - { NULL, "Lfieldmod01a;", "run", "()V", 83, + { nullptr, "Lfieldmod01a;", "run", "()V", 83, "Lfieldmod01a;", "instanceFloat", "F", JNI_FALSE, {} }, - { NULL, "Lfieldmod01a;", "run", "()V", 90, + { nullptr, "Lfieldmod01a;", "run", "()V", 90, "Lfieldmod01a;", "instanceDouble", "D", JNI_FALSE, {} }, - { NULL, "Lfieldmod01a;", "run", "()V", 96, + { nullptr, "Lfieldmod01a;", "run", "()V", 96, "Lfieldmod01a;", "instanceChar", "C", JNI_FALSE, {} }, - { NULL, "Lfieldmod01a;", "run", "()V", 103, + { nullptr, "Lfieldmod01a;", "run", "()V", 103, "Lfieldmod01a;", "instanceObject", "Ljava/lang/Object;", JNI_FALSE, {} }, - { NULL, "Lfieldmod01a;", "run", "()V", 110, + { nullptr, "Lfieldmod01a;", "run", "()V", 110, "Lfieldmod01a;", "instanceArrInt", "[I", JNI_FALSE, {} } }; @@ -187,7 +187,7 @@ void JNICALL FieldModification(jvmtiEnv *jvmti, JNIEnv *jni, watch.fid = field; watch.loc = location; watch.val = new_value; - watch.is_static = (obj == NULL) ? JNI_TRUE : JNI_FALSE; + watch.is_static = (obj == nullptr) ? JNI_TRUE : JNI_FALSE; err = jvmti->GetMethodDeclaringClass(method, &cls); if (err != JVMTI_ERROR_NONE) { LOG("(GetMethodDeclaringClass) unexpected error: %s (%d)\n", TranslateError(err), err); @@ -231,16 +231,16 @@ void JNICALL FieldModification(jvmtiEnv *jvmti, JNIEnv *jni, for (size_t i = 0; i < sizeof(watches)/sizeof(watch_info); i++) { if (watch.fid == watches[i].fid) { - if (watch.m_cls == NULL || strcmp(watch.m_cls, watches[i].m_cls) != 0) { + if (watch.m_cls == nullptr || strcmp(watch.m_cls, watches[i].m_cls) != 0) { LOG("(watch#%" PRIuPTR ") wrong class: \"%s\", expected: \"%s\"\n", i, watch.m_cls, watches[i].m_cls); result = STATUS_FAILED; } - if (watch.m_name == NULL || strcmp(watch.m_name, watches[i].m_name) != 0) { + if (watch.m_name == nullptr || strcmp(watch.m_name, watches[i].m_name) != 0) { LOG("(watch#%" PRIuPTR ") wrong method name: \"%s\"", i, watch.m_name); LOG(", expected: \"%s\"\n", watches[i].m_name); result = STATUS_FAILED; } - if (watch.m_sig == NULL || strcmp(watch.m_sig, watches[i].m_sig) != 0) { + if (watch.m_sig == nullptr || strcmp(watch.m_sig, watches[i].m_sig) != 0) { LOG("(watch#%" PRIuPTR ") wrong method sig: \"%s\"", i, watch.m_sig); LOG(", expected: \"%s\"\n", watches[i].m_sig); result = STATUS_FAILED; @@ -250,12 +250,12 @@ void JNICALL FieldModification(jvmtiEnv *jvmti, JNIEnv *jni, LOG(", expected: 0x%x%08x\n", (jint)(watches[i].loc >> 32), (jint)watches[i].loc); result = STATUS_FAILED; } - if (watch.f_name == NULL || strcmp(watch.f_name, watches[i].f_name) != 0) { + if (watch.f_name == nullptr || strcmp(watch.f_name, watches[i].f_name) != 0) { LOG("(watch#%" PRIuPTR ") wrong field name: \"%s\"", i, watch.f_name); LOG(", expected: \"%s\"\n", watches[i].f_name); result = STATUS_FAILED; } - if (watch.f_sig == NULL || strcmp(watch.f_sig, watches[i].f_sig) != 0) { + if (watch.f_sig == nullptr || strcmp(watch.f_sig, watches[i].f_sig) != 0) { LOG("(watch#%" PRIuPTR ") wrong field sig: \"%s\"", i, watch.f_sig); LOG(", expected: \"%s\"\n", watches[i].f_sig); result = STATUS_FAILED; @@ -291,7 +291,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -321,7 +321,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FIELD_MODIFICATION, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FIELD_MODIFICATION, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("Failed to enable JVMTI_EVENT_FIELD_MODIFICATION: %s (%d)\n", TranslateError(err), err); return JNI_ERR; @@ -353,7 +353,7 @@ Java_fieldmod01_getReady(JNIEnv *jni, jclass klass, jobject obj1, jobject obj2, LOG(">>> setting field modification watches ...\n"); cls = jni->FindClass("fieldmod01a"); - if (cls == NULL) { + if (cls == nullptr) { LOG("Cannot find fieldmod01a class!\n"); result = STATUS_FAILED; return; @@ -364,7 +364,7 @@ Java_fieldmod01_getReady(JNIEnv *jni, jclass klass, jobject obj1, jobject obj2, } else { watches[i].fid = jni->GetFieldID(cls, watches[i].f_name, watches[i].f_sig); } - if (watches[i].fid == NULL) { + if (watches[i].fid == nullptr) { LOG("Cannot get field ID for \"%s:%s\"\n", watches[i].f_name, watches[i].f_sig); result = STATUS_FAILED; return; @@ -412,7 +412,7 @@ Java_fieldmod01_check(JNIEnv *jni, jclass clz) { } jclass cls = jni->FindClass("fieldmod01a"); - if (cls == NULL) { + if (cls == nullptr) { LOG("Cannot find fieldmod01a class!\n"); result = STATUS_FAILED; return result; diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/FieldModification/fieldmod02/libfieldmod02.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/FieldModification/fieldmod02/libfieldmod02.cpp index 7c0dae284eb2..a2c211823915 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/events/FieldModification/fieldmod02/libfieldmod02.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/events/FieldModification/fieldmod02/libfieldmod02.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ #include #include #include "jvmti.h" -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { @@ -67,46 +67,46 @@ static volatile jboolean isVirtualExpected = JNI_FALSE; static int eventsExpected = 0; static int eventsCount = 0; static watch_info watches[] = { - { NULL, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldmod02a;", "staticBoolean", "Z", JNI_TRUE, {} }, - { NULL, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldmod02a;", "staticByte", "B", JNI_TRUE, {} }, - { NULL, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldmod02a;", "staticShort", "S", JNI_TRUE, {} }, - { NULL, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldmod02a;", "staticInt", "I", JNI_TRUE, {} }, - { NULL, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldmod02a;", "staticLong", "J", JNI_TRUE, {} }, - { NULL, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldmod02a;", "staticFloat", "F", JNI_TRUE, {} }, - { NULL, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldmod02a;", "staticDouble", "D", JNI_TRUE, {} }, - { NULL, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldmod02a;", "staticChar", "C", JNI_TRUE, {} }, - { NULL, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldmod02a;", "staticObject", "Ljava/lang/Object;", JNI_TRUE, {} }, - { NULL, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldmod02a;", "staticArrInt", "[I", JNI_TRUE, {} }, - { NULL, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldmod02a;", "instanceBoolean", "Z", JNI_FALSE, {} }, - { NULL, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldmod02a;", "instanceByte", "B", JNI_FALSE, {} }, - { NULL, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldmod02a;", "instanceShort", "S", JNI_FALSE, {} }, - { NULL, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldmod02a;", "instanceInt", "I", JNI_FALSE, {} }, - { NULL, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldmod02a;", "instanceLong", "J", JNI_FALSE, {} }, - { NULL, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldmod02a;", "instanceFloat", "F", JNI_FALSE, {} }, - { NULL, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldmod02a;", "instanceDouble", "D", JNI_FALSE, {} }, - { NULL, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldmod02a;", "instanceChar", "C", JNI_FALSE, {} }, - { NULL, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldmod02a;", "instanceObject", "Ljava/lang/Object;", JNI_FALSE, {} }, - { NULL, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, + { nullptr, "Lfieldmod02;", "check", "(Ljava/lang/Object;)I", 0, "Lfieldmod02a;", "instanceArrInt", "[I", JNI_FALSE, {} } }; @@ -187,7 +187,7 @@ void JNICALL FieldModification(jvmtiEnv *jvmti, JNIEnv *jni, watch.fid = field; watch.loc = location; - watch.is_static = (obj == NULL) ? JNI_TRUE : JNI_FALSE; + watch.is_static = (obj == nullptr) ? JNI_TRUE : JNI_FALSE; watch.val = new_value; err = jvmti->GetMethodDeclaringClass(method, &cls); if (err != JVMTI_ERROR_NONE) { @@ -232,16 +232,16 @@ void JNICALL FieldModification(jvmtiEnv *jvmti, JNIEnv *jni, for (size_t i = 0; i < sizeof(watches)/sizeof(watch_info); i++) { if (watch.fid == watches[i].fid) { - if (watch.m_cls == NULL || strcmp(watch.m_cls, watches[i].m_cls) != 0) { + if (watch.m_cls == nullptr || strcmp(watch.m_cls, watches[i].m_cls) != 0) { LOG("(watch#%" PRIuPTR ") wrong class: \"%s\", expected: \"%s\"\n", i, watch.m_cls, watches[i].m_cls); result = STATUS_FAILED; } - if (watch.m_name == NULL || strcmp(watch.m_name, watches[i].m_name) != 0) { + if (watch.m_name == nullptr || strcmp(watch.m_name, watches[i].m_name) != 0) { LOG("(watch#%" PRIuPTR ") wrong method name: \"%s\"", i, watch.m_name); LOG(", expected: \"%s\"\n", watches[i].m_name); result = STATUS_FAILED; } - if (watch.m_sig == NULL || strcmp(watch.m_sig, watches[i].m_sig) != 0) { + if (watch.m_sig == nullptr || strcmp(watch.m_sig, watches[i].m_sig) != 0) { LOG("(watch#%" PRIuPTR ") wrong method sig: \"%s\"", i, watch.m_sig); LOG(", expected: \"%s\"\n", watches[i].m_sig); result = STATUS_FAILED; @@ -251,12 +251,12 @@ void JNICALL FieldModification(jvmtiEnv *jvmti, JNIEnv *jni, LOG(", expected: 0x%x%08x\n", (jint)(watches[i].loc >> 32), (jint)watches[i].loc); result = STATUS_FAILED; } - if (watch.f_name == NULL || strcmp(watch.f_name, watches[i].f_name) != 0) { + if (watch.f_name == nullptr || strcmp(watch.f_name, watches[i].f_name) != 0) { LOG("(watch#%" PRIuPTR ") wrong field name: \"%s\"", i, watch.f_name); LOG(", expected: \"%s\"\n", watches[i].f_name); result = STATUS_FAILED; } - if (watch.f_sig == NULL || strcmp(watch.f_sig, watches[i].f_sig) != 0) { + if (watch.f_sig == nullptr || strcmp(watch.f_sig, watches[i].f_sig) != 0) { LOG("(watch#%" PRIuPTR ") wrong field sig: \"%s\"", i, watch.f_sig); LOG(", expected: \"%s\"\n", watches[i].f_sig); result = STATUS_FAILED; @@ -292,7 +292,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -321,7 +321,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FIELD_MODIFICATION, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FIELD_MODIFICATION, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("Failed to enable JVMTI_EVENT_FIELD_MODIFICATION: %s (%d)\n", TranslateError(err), err); return JNI_ERR; @@ -356,7 +356,7 @@ Java_fieldmod02_getReady(JNIEnv *jni, jclass clz) { LOG(">>> setting field modification watches ...\n"); cls = jni->FindClass("fieldmod02a"); - if (cls == NULL) { + if (cls == nullptr) { LOG("Cannot find fieldmod02a class!\n"); result = STATUS_FAILED; return; @@ -367,7 +367,7 @@ Java_fieldmod02_getReady(JNIEnv *jni, jclass clz) { } else { watches[i].fid = jni->GetFieldID(cls, watches[i].f_name, watches[i].f_sig); } - if (watches[i].fid == NULL) { + if (watches[i].fid == nullptr) { LOG("Cannot get field ID for \"%s:%s\"\n", watches[i].f_name, watches[i].f_sig); result = STATUS_FAILED; return; @@ -422,7 +422,7 @@ Java_fieldmod02_check(JNIEnv *jni, jclass clz, jobject obj) { cls = jni->FindClass("fieldmod02a"); - if (cls == NULL) { + if (cls == nullptr) { LOG("Cannot find fieldmod02a class!\n"); return STATUS_FAILED; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/FramePop/framepop01/libframepop01.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/FramePop/framepop01/libframepop01.cpp index d757e2eff4c2..8da891b27797 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/events/FramePop/framepop01/libframepop01.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/events/FramePop/framepop01/libframepop01.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ #include #include #include "jvmti.h" -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { @@ -40,7 +40,7 @@ typedef struct { jlocation loc; } pop_info; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jint result = PASSED; static volatile jboolean isVirtualExpected = JNI_FALSE; @@ -111,17 +111,17 @@ void JNICALL FramePop(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread_obj, jmethodI LOG(">>> ... done\n"); if (eventsCount < sizeof(pops)/sizeof(pop_info)) { - if (cls_sig == NULL || strcmp(cls_sig, pops[eventsCount].cls_sig) != 0) { + if (cls_sig == nullptr || strcmp(cls_sig, pops[eventsCount].cls_sig) != 0) { LOG("(pop#%" PRIuPTR ") wrong class: \"%s\"", eventsCount, cls_sig); LOG(", expected: \"%s\"\n", pops[eventsCount].cls_sig); result = STATUS_FAILED; } - if (name == NULL || strcmp(name, pops[eventsCount].name) != 0) { + if (name == nullptr || strcmp(name, pops[eventsCount].name) != 0) { LOG("(pop#%" PRIuPTR ") wrong method name: \"%s\"", eventsCount, name); LOG(", expected: \"%s\"\n", pops[eventsCount].name); result = STATUS_FAILED; } - if (sig == NULL || strcmp(sig, pops[eventsCount].sig) != 0) { + if (sig == nullptr || strcmp(sig, pops[eventsCount].sig) != 0) { LOG("(pop#%" PRIuPTR ") wrong method sig: \"%s\"", eventsCount, sig); LOG(", expected: \"%s\"\n", pops[eventsCount].sig); result = STATUS_FAILED; @@ -152,7 +152,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -203,7 +203,7 @@ Java_framepop01_check(JNIEnv *jni, jclass cls) { return STATUS_FAILED; } - if (jvmti == NULL) { + if (jvmti == nullptr) { LOG("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -218,19 +218,19 @@ Java_framepop01_check(JNIEnv *jni, jclass cls) { LOG("Failed to SetBreakpoint: %s (%d)\n", TranslateError(err), err); return STATUS_FAILED; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FRAME_POP, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FRAME_POP, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("Failed to enable JVMTI_EVENT_FRAME_POP event: %s (%d)\n", TranslateError(err), err); result = STATUS_FAILED; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("Failed to enable BREAKPOINT event: %s (%d)\n", TranslateError(err), err); result = STATUS_FAILED; } clz = jni->FindClass("framepop01a"); - if (clz == NULL) { + if (clz == nullptr) { LOG("Cannot find framepop01a class!\n"); result = STATUS_FAILED; return STATUS_FAILED; diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/FramePop/framepop02/libframepop02.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/FramePop/framepop02/libframepop02.cpp index bc8f36114a21..61c9a91184ba 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/events/FramePop/framepop02/libframepop02.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/events/FramePop/framepop02/libframepop02.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,7 @@ #include #include #include "jvmti.h" -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { @@ -45,7 +45,7 @@ typedef struct thr { item_t tos; } thr; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jrawMonitorID event_lock; static jboolean printdump = JNI_TRUE; @@ -116,7 +116,7 @@ void pop(jvmtiEnv *jvmti, JNIEnv *jni, jthread thr, jmethodID method, int depth) fatal(jni, "Unknown thread:\n"); } - if (threads[i].tos == NULL) { + if (threads[i].tos == nullptr) { watch_events = JNI_FALSE; printInfo(jni, jvmti, thr, method, depth); fatal(jni, "Stack underflow:\n"); @@ -131,7 +131,7 @@ void pop(jvmtiEnv *jvmti, JNIEnv *jni, jthread thr, jmethodID method, int depth) return; } free(old); - } while (threads[i].tos != NULL); + } while (threads[i].tos != nullptr); watch_events = JNI_FALSE; printInfo(jni, jvmti, thr, method, depth); @@ -155,11 +155,11 @@ void push(JNIEnv *jni, jthread thr, jmethodID method, int depth) { fatal(jni, "Out of threads\n"); } threads[i].thread = jni->NewGlobalRef(thr); - threads[i].tos = NULL; + threads[i].tos = nullptr; } new_item = (item_t)malloc(sizeof(item)); - if (new_item == NULL) { + if (new_item == nullptr) { fatal(jni, "Out of memory\n"); } @@ -246,7 +246,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -280,11 +280,11 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { LOG("(SetEventCallbacks) unexpected error: %s (%d)\n", TranslateError(err), err); return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_START, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_START, nullptr); if (err != JVMTI_ERROR_NONE) { return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, nullptr); if (err != JVMTI_ERROR_NONE) { return JNI_ERR; } @@ -295,18 +295,18 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { } JNIEXPORT void JNICALL Java_framepop02_getReady(JNIEnv *jni, jclass cls) { - check_jvmti_status(jni, jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_ENTRY, NULL), + check_jvmti_status(jni, jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_ENTRY, nullptr), "Error in SetEventNotificationMode"); - check_jvmti_status(jni, jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FRAME_POP, NULL), + check_jvmti_status(jni, jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FRAME_POP, nullptr), "Error in SetEventNotificationMode"); watch_events = JNI_TRUE; } JNIEXPORT void JNICALL Java_framepop02_check(JNIEnv *jni, jclass cls) { watch_events = JNI_FALSE; - check_jvmti_status(jni, jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_FRAME_POP, NULL), + check_jvmti_status(jni, jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_FRAME_POP, nullptr), "Error in SetEventNotificationMode"); - check_jvmti_status(jni, jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_METHOD_ENTRY, NULL), + check_jvmti_status(jni, jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_METHOD_ENTRY, nullptr), "Error in SetEventNotificationMode"); if (printdump == JNI_TRUE) { diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/MethodEntry/mentry01/libmentry01.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/MethodEntry/mentry01/libmentry01.cpp index 780438d02f57..8bed8ac6ecb1 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/events/MethodEntry/mentry01/libmentry01.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/events/MethodEntry/mentry01/libmentry01.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ #include #include #include "jvmti.h" -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { @@ -45,7 +45,7 @@ typedef struct { const jlocation loc; } entry_info; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; static jint result = PASSED; @@ -78,7 +78,7 @@ void JNICALL MethodEntry(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread_obj, jmeth result = STATUS_FAILED; return; } - if (cls_sig != NULL && strcmp(cls_sig, "Lmentry01;") == 0) { + if (cls_sig != nullptr && strcmp(cls_sig, "Lmentry01;") == 0) { LOG(">>> retrieving method entry info ...\n"); err = jvmti->GetMethodName(method, &entry.name, &entry.sig, &generic); @@ -100,12 +100,12 @@ void JNICALL MethodEntry(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread_obj, jmeth LOG(">>> ... done\n"); if (eventsCount < sizeof(entries)/sizeof(entry_info)) { - if (entry.name == NULL || strcmp(entry.name, entries[eventsCount].name) != 0) { + if (entry.name == nullptr || strcmp(entry.name, entries[eventsCount].name) != 0) { LOG("(entry#%" PRIuPTR ") wrong method name: \"%s\"", eventsCount, entry.name); LOG(", expected: \"%s\"\n", entries[eventsCount].name); result = STATUS_FAILED; } - if (entry.sig == NULL || strcmp(entry.sig, entries[eventsCount].sig) != 0) { + if (entry.sig == nullptr || strcmp(entry.sig, entries[eventsCount].sig) != 0) { LOG("(entry#%" PRIuPTR ") wrong method sig: \"%s\"", eventsCount, entry.sig); LOG(", expected: \"%s\"\n", entries[eventsCount].sig); result = STATUS_FAILED; @@ -137,7 +137,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -176,7 +176,7 @@ JNIEXPORT void JNICALL Java_mentry01_enable(JNIEnv *jni, jclass cls) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { return; } @@ -188,7 +188,7 @@ Java_mentry01_enable(JNIEnv *jni, jclass cls) { } isVirtualExpected = jni->IsVirtualThread(thread); - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_ENTRY, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_ENTRY, nullptr); if (err == JVMTI_ERROR_NONE) { eventsExpected = sizeof(entries)/sizeof(entry_info); eventsCount = 0; @@ -202,7 +202,7 @@ JNIEXPORT jint JNICALL Java_mentry01_check(JNIEnv *jni, jclass cls) { jmethodID mid = jni->GetStaticMethodID(cls, "dummy", "()V"); - if (mid == NULL) { + if (mid == nullptr) { LOG("Cannot find metod \"dummy()\"!\n"); return STATUS_FAILED; } @@ -219,13 +219,13 @@ JNIEXPORT void JNICALL Java_mentry01_chain(JNIEnv *jni, jclass cls) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { LOG("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; } - err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_METHOD_ENTRY, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_METHOD_ENTRY, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("Failed to disable JVMTI_EVENT_METHOD_ENTRY event: %s (%d)\n", TranslateError(err), err); result = STATUS_FAILED; diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/MethodEntry/mentry02/libmentry02.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/MethodEntry/mentry02/libmentry02.cpp index 90b62dcee7a1..4895771a92e8 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/events/MethodEntry/mentry02/libmentry02.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/events/MethodEntry/mentry02/libmentry02.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ #include #include #include "jvmti.h" -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { @@ -32,7 +32,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jint result = PASSED; static jboolean isVirtualExpected = JNI_FALSE; @@ -40,7 +40,7 @@ static int MethodEntriesExpected = 0; static int MethodExitsExpected = 0; static int MethodEntriesCount = 0; static int MethodExitsCount = 0; -static jmethodID mid = NULL; +static jmethodID mid = nullptr; void JNICALL MethodEntry(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread_obj, jmethodID method) { @@ -75,7 +75,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -116,7 +116,7 @@ JNIEXPORT void JNICALL Java_mentry02_getReady(JNIEnv *jni, jclass cls, jint i) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { LOG("JVMTI client was not properly loaded!\n"); return; } @@ -130,13 +130,13 @@ Java_mentry02_getReady(JNIEnv *jni, jclass cls, jint i) { isVirtualExpected = jni->IsVirtualThread(thread); mid = jni->GetStaticMethodID(cls, "emptyMethod", "()V"); - if (mid == NULL) { + if (mid == nullptr) { LOG("Cannot find Method ID for emptyMethod\n"); result = STATUS_FAILED; return; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_ENTRY, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_ENTRY, nullptr); if (err == JVMTI_ERROR_NONE) { MethodEntriesCount = 0; MethodEntriesExpected = i; @@ -145,7 +145,7 @@ Java_mentry02_getReady(JNIEnv *jni, jclass cls, jint i) { result = STATUS_FAILED; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_EXIT, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_EXIT, nullptr); if (err == JVMTI_ERROR_NONE) { MethodExitsCount = 0; MethodExitsExpected = i; diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/MethodExit/mexit01/libmexit01.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/MethodExit/mexit01/libmexit01.cpp index 616b599a59b4..079b5ec30237 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/events/MethodExit/mexit01/libmexit01.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/events/MethodExit/mexit01/libmexit01.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ #include #include #include "jvmti.h" -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { @@ -40,7 +40,7 @@ typedef struct { jlocation loc; } method_location_info; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jint result = PASSED; static jboolean isVirtualExpected = JNI_FALSE; @@ -73,7 +73,7 @@ void JNICALL MethodExit(jvmtiEnv *jvmti, JNIEnv *jni, result = STATUS_FAILED; return; } - if (cls_sig != NULL && strcmp(cls_sig, "Lmexit01a;") == 0) { + if (cls_sig != nullptr && strcmp(cls_sig, "Lmexit01a;") == 0) { LOG(">>> retrieving method exit info ...\n"); err = jvmti->GetMethodName(method, &name, &sig, &generic); @@ -95,17 +95,17 @@ void JNICALL MethodExit(jvmtiEnv *jvmti, JNIEnv *jni, LOG(">>> ... done\n"); if (eventsCount < sizeof(exits) / sizeof(method_location_info)) { - if (cls_sig == NULL || strcmp(cls_sig, exits[eventsCount].cls_sig) != 0) { + if (cls_sig == nullptr || strcmp(cls_sig, exits[eventsCount].cls_sig) != 0) { LOG("(exit#%" PRIuPTR ") wrong class: \"%s\"", eventsCount, cls_sig); LOG(", expected: \"%s\"\n", exits[eventsCount].cls_sig); result = STATUS_FAILED; } - if (name == NULL || strcmp(name, exits[eventsCount].name) != 0) { + if (name == nullptr || strcmp(name, exits[eventsCount].name) != 0) { LOG("(exit#%" PRIuPTR ") wrong method name: \"%s\"", eventsCount, name); LOG(", expected: \"%s\"\n", exits[eventsCount].name); result = STATUS_FAILED; } - if (sig == NULL || strcmp(sig, exits[eventsCount].sig) != 0) { + if (sig == nullptr || strcmp(sig, exits[eventsCount].sig) != 0) { LOG("(exit#%" PRIuPTR ") wrong method sig: \"%s\"", eventsCount, sig); LOG(", expected: \"%s\"\n", exits[eventsCount].sig); result = STATUS_FAILED; @@ -137,7 +137,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -177,12 +177,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { JNIEXPORT jint JNICALL Java_mexit01_init0(JNIEnv *jni, jclass cls) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { LOG("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_EXIT, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_EXIT, nullptr); if (err == JVMTI_ERROR_NONE) { eventsExpected = sizeof(exits)/sizeof(method_location_info); eventsCount = 0; @@ -200,7 +200,7 @@ Java_mexit01_check(JNIEnv *jni, jclass cls) { jclass clz; jmethodID mid; - if (jvmti == NULL) { + if (jvmti == nullptr) { LOG("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -214,20 +214,20 @@ Java_mexit01_check(JNIEnv *jni, jclass cls) { isVirtualExpected = jni->IsVirtualThread(thread); clz = jni->FindClass("mexit01a"); - if (clz == NULL) { + if (clz == nullptr) { LOG("Cannot find MethodExit.mexit01a class!\n"); return STATUS_FAILED; } mid = jni->GetStaticMethodID(clz, "dummy", "()V"); - if (mid == NULL) { + if (mid == nullptr) { LOG("Cannot find metod \"dummy()\"!\n"); return STATUS_FAILED; } jni->CallStaticVoidMethod(clz, mid); - err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_METHOD_EXIT, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_METHOD_EXIT, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("Failed to disable JVMTI_EVENT_METHOD_EXIT event: %s (%d)\n", TranslateError(err), err); result = STATUS_FAILED; diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/MethodExit/mexit02/libmexit02.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/MethodExit/mexit02/libmexit02.cpp index 140a9932c145..54e4e6ea680c 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/events/MethodExit/mexit02/libmexit02.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/events/MethodExit/mexit02/libmexit02.cpp @@ -1,5 +1,5 @@ /* -* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. +* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ #include #include #include "jvmti.h" -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { @@ -40,7 +40,7 @@ typedef struct { jlocation loc; } method_location_info; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jint result = PASSED; static jboolean isVirtualExpected = JNI_FALSE; @@ -73,7 +73,7 @@ void JNICALL MethodExit(jvmtiEnv *jvmti, JNIEnv *jni, result = STATUS_FAILED; return; } - if (cls_sig != NULL && strcmp(cls_sig, "Lmexit02a;") == 0) { + if (cls_sig != nullptr && strcmp(cls_sig, "Lmexit02a;") == 0) { LOG(">>> retrieving method exit info ...\n"); err = jvmti->GetMethodName(method, &name, &sig, &generic); @@ -100,17 +100,17 @@ void JNICALL MethodExit(jvmtiEnv *jvmti, JNIEnv *jni, } if (eventsCount < sizeof(exits)/sizeof(method_location_info)) { - if (cls_sig == NULL || strcmp(cls_sig, exits[eventsCount].cls_sig) != 0) { + if (cls_sig == nullptr || strcmp(cls_sig, exits[eventsCount].cls_sig) != 0) { LOG("(exit#%" PRIuPTR ") wrong class: \"%s\"", eventsCount, cls_sig); LOG(", expected: \"%s\"\n", exits[eventsCount].cls_sig); result = STATUS_FAILED; } - if (name == NULL || strcmp(name, exits[eventsCount].name) != 0) { + if (name == nullptr || strcmp(name, exits[eventsCount].name) != 0) { LOG("(exit#%" PRIuPTR ") wrong method name: \"%s\"", eventsCount, name); LOG(", expected: \"%s\"\n", exits[eventsCount].name); result = STATUS_FAILED; } - if (sig == NULL || strcmp(sig, exits[eventsCount].sig) != 0) { + if (sig == nullptr || strcmp(sig, exits[eventsCount].sig) != 0) { LOG("(exit#%" PRIuPTR ") wrong method sig: \"%s\"", eventsCount, sig); LOG(", expected: \"%s\"\n", exits[eventsCount].sig); result = STATUS_FAILED; @@ -137,7 +137,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -178,7 +178,7 @@ Java_mexit02_check(JNIEnv *jni, jclass cls) { jclass clz; jmethodID mid; - if (jvmti == NULL) { + if (jvmti == nullptr) { LOG("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -192,18 +192,18 @@ Java_mexit02_check(JNIEnv *jni, jclass cls) { isVirtualExpected = jni->IsVirtualThread(thread); clz = jni->FindClass("mexit02a"); - if (clz == NULL) { + if (clz == nullptr) { LOG("Failed to find class \"mexit02a\"!\n"); return STATUS_FAILED; } mid = jni->GetStaticMethodID(clz, "dummy", "()V"); - if (mid == NULL) { + if (mid == nullptr) { LOG("Failed to get method \"dummy\"!\n"); return STATUS_FAILED; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_EXIT, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_EXIT, nullptr); if (err == JVMTI_ERROR_NONE) { eventsExpected = sizeof(exits)/sizeof(method_location_info); eventsCount = 0; @@ -214,7 +214,7 @@ Java_mexit02_check(JNIEnv *jni, jclass cls) { jni->CallStaticVoidMethod(clz, mid); - err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_METHOD_EXIT, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_METHOD_EXIT, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("Failed to disable JVMTI_EVENT_METHOD_EXIT event: %s (%d)\n", TranslateError(err), err); result = STATUS_FAILED; diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/MonitorContendedEnter/mcontenter01/libmcontenter01.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/MonitorContendedEnter/mcontenter01/libmcontenter01.cpp index 023cb075a882..4dbb9f71969d 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/events/MonitorContendedEnter/mcontenter01/libmcontenter01.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/events/MonitorContendedEnter/mcontenter01/libmcontenter01.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,8 +26,8 @@ #include #include -#include "jvmti_common.h" -#include "jvmti_thread.h" +#include "jvmti_common.hpp" +#include "jvmti_thread.hpp" extern "C" { @@ -35,13 +35,13 @@ extern "C" { /* ========================================================================== */ /* scaffold objects */ -static JNIEnv *jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv *jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* test objects */ -static jthread expected_thread = NULL; -static jobject expected_object = NULL; +static jthread expected_thread = nullptr; +static jobject expected_object = nullptr; static volatile int eventsCount = 0; /* ========================================================================== */ @@ -53,12 +53,12 @@ MonitorContendedEnter(jvmtiEnv *jvmti, JNIEnv *jni, jthread thr, jobject obj) { print_thread_info(jvmti, jni, thr); - if (expected_thread == NULL) { - jni->FatalError("expected_thread is NULL."); + if (expected_thread == nullptr) { + jni->FatalError("expected_thread is null."); } - if (expected_object == NULL) { - jni->FatalError("expected_object is NULL."); + if (expected_object == nullptr) { + jni->FatalError("expected_object is null."); } /* check if event is for tested thread and for tested object */ @@ -72,7 +72,7 @@ MonitorContendedEnter(jvmtiEnv *jvmti, JNIEnv *jni, jthread thr, jobject obj) { /* ========================================================================== */ static int prepare() { - jvmtiError err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTER, NULL); + jvmtiError err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTER, nullptr); if (err != JVMTI_ERROR_NONE) { jni->FatalError("Error enabling JVMTI_EVENT_MONITOR_CONTENDED_ENTER."); } @@ -82,7 +82,7 @@ static int prepare() { static int clean() { LOG("Disabling events\n"); /* disable MonitorContendedEnter event */ - jvmtiError err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTER, NULL); + jvmtiError err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTER, nullptr); if (err != JVMTI_ERROR_NONE) { set_agent_fail_status(); } @@ -139,7 +139,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { LOG("Timeout: %d msc\n", (int) timeout); res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -177,7 +177,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } /* register agent proc and arg */ - set_agent_proc(agentProc, NULL); + set_agent_proc(agentProc, nullptr); return JNI_OK; } @@ -190,13 +190,13 @@ JNIEXPORT void JNICALL Java_mcontenter01_setExpected(JNIEnv *jni, jobject clz, j LOG("Remembering global reference for monitor object is %p\n", obj); /* make object accessible for a long time */ expected_object = jni->NewGlobalRef(obj); - if (expected_object == NULL) { + if (expected_object == nullptr) { jni->FatalError("Error saving global reference to monitor.\n"); } /* make thread accessable for a long time */ expected_thread = jni->NewGlobalRef(thread); - if (thread == NULL) { + if (thread == nullptr) { jni->FatalError("Error saving global reference to thread.\n"); } diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/MonitorContendedEntered/mcontentered01/libmcontentered01.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/MonitorContendedEntered/mcontentered01/libmcontentered01.cpp index 6589f5dabd7a..207ceeb6ac33 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/events/MonitorContendedEntered/mcontentered01/libmcontentered01.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/events/MonitorContendedEntered/mcontentered01/libmcontentered01.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,21 +24,21 @@ #include #include #include -#include "jvmti_common.h" -#include "jvmti_thread.h" +#include "jvmti_common.hpp" +#include "jvmti_thread.hpp" extern "C" { /* ========================================================================== */ /* scaffold objects */ -static JNIEnv *jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv *jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* test objects */ -static jthread expected_thread = NULL; -static jobject expected_object = NULL; +static jthread expected_thread = nullptr; +static jobject expected_object = nullptr; static volatile int eventsCount = 0; @@ -51,12 +51,12 @@ MonitorContendedEntered(jvmtiEnv *jvmti, JNIEnv *jni, jthread thr, jobject obj) print_thread_info(jvmti, jni, thr); - if (expected_thread == NULL) { - jni->FatalError("expected_thread is NULL."); + if (expected_thread == nullptr) { + jni->FatalError("expected_thread is null."); } - if (expected_object == NULL) { - jni->FatalError("expected_object is NULL."); + if (expected_object == nullptr) { + jni->FatalError("expected_object is null."); } /* check if event is for tested thread and for tested object */ @@ -73,12 +73,12 @@ MonitorContendedEnter(jvmtiEnv *jvmti, JNIEnv *jni, jthread thr, jobject obj) { LOG("MonitorContendedEnter event:\n\tthread: %p, object: %p, expected object: %p\n",thr, obj, expected_object); print_thread_info(jvmti, jni, thr); - if (expected_thread == NULL) { - jni->FatalError("expected_thread is NULL."); + if (expected_thread == nullptr) { + jni->FatalError("expected_thread is null."); } - if (expected_object == NULL) { - jni->FatalError("expected_object is NULL."); + if (expected_object == nullptr) { + jni->FatalError("expected_object is null."); } /* check if event is for tested thread and for tested object */ @@ -97,14 +97,14 @@ static int prepare() { LOG("Prepare: find tested thread\n"); /* enable MonitorContendedEntered event */ - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTERED, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTERED, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("Prepare: 11\n"); return JNI_FALSE; } /* enable MonitorContendedEnter event */ - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTER, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTER, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("Prepare: 11\n"); return JNI_FALSE; @@ -116,7 +116,7 @@ static int prepare() { static int clean() { jvmtiError err; /* disable MonitorContendedEntered event */ - err = jvmti->SetEventNotificationMode(JVMTI_DISABLE,JVMTI_EVENT_MONITOR_CONTENDED_ENTERED,NULL); + err = jvmti->SetEventNotificationMode(JVMTI_DISABLE,JVMTI_EVENT_MONITOR_CONTENDED_ENTERED,nullptr); if (err != JVMTI_ERROR_NONE) { set_agent_fail_status(); } @@ -173,7 +173,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { LOG("Timeout: %d msc\n", (int) timeout); res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -214,7 +214,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } /* register agent proc and arg */ - set_agent_proc(agentProc, NULL); + set_agent_proc(agentProc, nullptr); return JNI_OK; } @@ -227,13 +227,13 @@ JNIEXPORT void JNICALL Java_mcontentered01_setExpected(JNIEnv *jni, jobject clz, LOG("Remembering global reference for monitor object is %p\n", obj); /* make object accessible for a long time */ expected_object = jni->NewGlobalRef(obj); - if (expected_object == NULL) { + if (expected_object == nullptr) { jni->FatalError("Error saving global reference to monitor.\n"); } /* make thread accessable for a long time */ expected_thread = jni->NewGlobalRef(thread); - if (thread == NULL) { + if (thread == nullptr) { jni->FatalError("Error saving global reference to thread.\n"); } diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/MonitorWait/monitorwait01/libmonitorwait01.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/MonitorWait/monitorwait01/libmonitorwait01.cpp index 6467a6b3dcb5..6e3b86b941f8 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/events/MonitorWait/monitorwait01/libmonitorwait01.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/events/MonitorWait/monitorwait01/libmonitorwait01.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,20 +24,20 @@ #include #include #include -#include "jvmti_common.h" -#include "jvmti_thread.h" +#include "jvmti_common.hpp" +#include "jvmti_thread.hpp" extern "C" { /* scaffold objects */ -static JNIEnv *jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv *jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* test objects */ -static jthread expected_thread = NULL; -static jobject expected_object = NULL; +static jthread expected_thread = nullptr; +static jobject expected_object = nullptr; static volatile int eventsCount = 0; void JNICALL @@ -47,12 +47,12 @@ MonitorWait(jvmtiEnv *jvmti, JNIEnv *jni, jthread thr, jobject obj, jlong tout) print_thread_info(jvmti, jni, thr); - if (expected_thread == NULL) { - jni->FatalError("expected_thread is NULL."); + if (expected_thread == nullptr) { + jni->FatalError("expected_thread is null."); } - if (expected_object == NULL) { - jni->FatalError("expected_object is NULL."); + if (expected_object == nullptr) { + jni->FatalError("expected_object is null."); } /* check if event is for tested thread and for tested object */ @@ -70,7 +70,7 @@ MonitorWait(jvmtiEnv *jvmti, JNIEnv *jni, jthread thr, jobject obj, jlong tout) static int prepare() { /* enable MonitorWait event */ - jvmtiError err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAIT, NULL); + jvmtiError err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAIT, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("Prepare: 11\n"); return JNI_FALSE; @@ -80,7 +80,7 @@ static int prepare() { static int clean() { /* disable MonitorWait event */ - jvmtiError err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_MONITOR_WAIT, NULL); + jvmtiError err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_MONITOR_WAIT, nullptr); if (err != JVMTI_ERROR_NONE) { set_agent_fail_status(); } @@ -135,7 +135,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { LOG("Timeout: %d msc\n", (int) timeout); res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -173,7 +173,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } /* register agent proc and arg */ - set_agent_proc(agentProc, NULL); + set_agent_proc(agentProc, nullptr); return JNI_OK; } @@ -182,13 +182,13 @@ JNIEXPORT void JNICALL Java_monitorwait01_setExpected(JNIEnv *jni, jobject clz, LOG("Remembering global reference for monitor object is %p\n", obj); /* make object accessible for a long time */ expected_object = jni->NewGlobalRef(obj); - if (expected_object == NULL) { + if (expected_object == nullptr) { jni->FatalError("Error saving global reference to monitor.\n"); } /* make thread accessable for a long time */ expected_thread = jni->NewGlobalRef(thread); - if (thread == NULL) { + if (thread == nullptr) { jni->FatalError("Error saving global reference to thread.\n"); } diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/MonitorWaited/monitorwaited01/libmonitorwaited01.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/MonitorWaited/monitorwaited01/libmonitorwaited01.cpp index 2eaeefce2fcb..8f66851a0848 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/events/MonitorWaited/monitorwaited01/libmonitorwaited01.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/events/MonitorWaited/monitorwaited01/libmonitorwaited01.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,20 +24,20 @@ #include #include #include -#include "jvmti_common.h" -#include "jvmti_thread.h" +#include "jvmti_common.hpp" +#include "jvmti_thread.hpp" extern "C" { /* scaffold objects */ -static JNIEnv *jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv *jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* test objects */ -static jthread expected_thread = NULL; -static jobject expected_object = NULL; +static jthread expected_thread = nullptr; +static jobject expected_object = nullptr; static volatile int eventsCount = 0; void JNICALL @@ -48,12 +48,12 @@ MonitorWaited(jvmtiEnv *jvmti, JNIEnv *jni, jthread thr, jobject obj, jboolean t print_thread_info(jvmti, jni, thr); - if (expected_thread == NULL) { - jni->FatalError("expected_thread is NULL."); + if (expected_thread == nullptr) { + jni->FatalError("expected_thread is null."); } - if (expected_object == NULL) { - jni->FatalError("expected_object is NULL."); + if (expected_object == nullptr) { + jni->FatalError("expected_object is null."); } /* check if event is for tested thread and for tested object */ @@ -71,7 +71,7 @@ MonitorWaited(jvmtiEnv *jvmti, JNIEnv *jni, jthread thr, jobject obj, jboolean t static int prepare() { /* enable MonitorWait event */ - jvmtiError err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAITED, NULL); + jvmtiError err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAITED, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("Prepare: 11\n"); return JNI_FALSE; @@ -81,7 +81,7 @@ static int prepare() { static int clean() { /* disable MonitorWaited event */ - jvmtiError err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_MONITOR_WAITED, NULL); + jvmtiError err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_MONITOR_WAITED, nullptr); if (err != JVMTI_ERROR_NONE) { set_agent_fail_status(); } @@ -136,7 +136,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { LOG("Timeout: %d msc\n", (int) timeout); res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -176,7 +176,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } /* register agent proc and arg */ - set_agent_proc(agentProc, NULL); + set_agent_proc(agentProc, nullptr); return JNI_OK; } @@ -185,13 +185,13 @@ JNIEXPORT void JNICALL Java_monitorwaited01_setExpected(JNIEnv *jni, jobject clz LOG("Remembering global reference for monitor object is %p\n", obj); /* make object accessible for a long time */ expected_object = jni->NewGlobalRef(obj); - if (expected_object == NULL) { + if (expected_object == nullptr) { jni->FatalError("Error saving global reference to monitor.\n"); } /* make thread accessable for a long time */ expected_thread = jni->NewGlobalRef(thread); - if (thread == NULL) { + if (thread == nullptr) { jni->FatalError("Error saving global reference to thread.\n"); } diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/NativeMethodBind/nativemethbind01/libnativemethbind01.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/NativeMethodBind/nativemethbind01/libnativemethbind01.cpp index e363de01b022..09d3ec41334e 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/events/NativeMethodBind/nativemethbind01/libnativemethbind01.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/events/NativeMethodBind/nativemethbind01/libnativemethbind01.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ #include #include #include -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { @@ -49,7 +49,7 @@ static const char *CLASS_SIG = "Lnativemethbind01$TestedClass;"; static volatile jint result = PASSED; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jrawMonitorID counter_lock; @@ -76,7 +76,7 @@ NativeMethodBind(jvmtiEnv *jvmti, JNIEnv* jni, jthread thread, return; } - err = jvmti->GetMethodName(method, &methNam, &methSig, NULL); + err = jvmti->GetMethodName(method, &methNam, &methSig, nullptr); if (err != JVMTI_ERROR_NONE) { result = STATUS_FAILED; LOG("TEST FAILED: unable to get method name during NativeMethodBind callback\n\n"); @@ -118,7 +118,7 @@ anotherNativeMethod(JNIEnv *jni, jobject obj) { /* dummy method used only to provoke NativeMethodBind event */ JNIEXPORT void JNICALL Java_nativemethbind01_nativeMethod(JNIEnv *jni, jobject obj, jboolean registerNative) { - jclass testedCls = NULL; + jclass testedCls = nullptr; JNINativeMethod meth; LOG("Inside the nativeMethod()\n"); @@ -126,7 +126,7 @@ Java_nativemethbind01_nativeMethod(JNIEnv *jni, jobject obj, jboolean registerNa if (registerNative == JNI_TRUE) { LOG("Finding class \"%s\" ...\n", CLASS_SIG); testedCls = jni->FindClass(CLASS_SIG); - if (testedCls == NULL) { + if (testedCls == nullptr) { result = STATUS_FAILED; COMPLAIN("TEST FAILURE: unable to find class \"%s\"\n\n", CLASS_SIG); return; @@ -168,7 +168,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_9); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -203,7 +203,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; LOG("setting event callbacks done\nenabling JVMTI events ...\n"); - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_NATIVE_METHOD_BIND, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_NATIVE_METHOD_BIND, nullptr); if (err != JVMTI_ERROR_NONE){ return JNI_ERR; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/NativeMethodBind/nativemethbind02/libnativemethbind02.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/NativeMethodBind/nativemethbind02/libnativemethbind02.cpp index 2d5dcefe5575..1a8806f0bb94 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/events/NativeMethodBind/nativemethbind02/libnativemethbind02.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/events/NativeMethodBind/nativemethbind02/libnativemethbind02.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ #include #include #include -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { @@ -36,7 +36,7 @@ extern "C" { static volatile int wrongBindEv = 0; static volatile jint result = PASSED; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jrawMonitorID counter_lock; @@ -46,7 +46,7 @@ NativeMethodBind(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, jmethodID method, void *addr, void **new_addr) { jvmtiPhase phase; jvmtiError err; - char *methNam = NULL, *methSig = NULL; + char *methNam = nullptr, *methSig = nullptr; RawMonitorLocker rml(jvmti, jni, counter_lock); err = jvmti->GetPhase(&phase); @@ -60,7 +60,7 @@ NativeMethodBind(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, return; } - err = jvmti->GetMethodName(method, &methNam, &methSig, NULL); + err = jvmti->GetMethodName(method, &methNam, &methSig, nullptr); if (err != JVMTI_ERROR_NONE) { result = STATUS_FAILED; @@ -70,7 +70,7 @@ NativeMethodBind(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, LOG("NativeMethodBind received for \"%s %s\"\n", methNam, methSig); } - if (methNam != NULL) { + if (methNam != nullptr) { err = jvmti->Deallocate((unsigned char *) methNam); if (err != JVMTI_ERROR_NONE) { result = STATUS_FAILED; @@ -78,7 +78,7 @@ NativeMethodBind(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, } } - if (methSig != NULL) { + if (methSig != nullptr) { err = jvmti->Deallocate((unsigned char *) methSig); if (err != JVMTI_ERROR_NONE) { result = STATUS_FAILED; @@ -116,7 +116,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_9); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -150,11 +150,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; LOG("setting event callbacks done\nenabling JVMTI events ...\n"); - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_NATIVE_METHOD_BIND, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_NATIVE_METHOD_BIND, nullptr); if (err != JVMTI_ERROR_NONE) { return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, nullptr); if (err != JVMTI_ERROR_NONE) { return JNI_ERR; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/NativeMethodBind/nativemethbind03/libnativemethbind03.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/NativeMethodBind/nativemethbind03/libnativemethbind03.cpp index 19d94f560c8e..5fd58a3a43b2 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/events/NativeMethodBind/nativemethbind03/libnativemethbind03.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/events/NativeMethodBind/nativemethbind03/libnativemethbind03.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ #include #include #include -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { @@ -46,7 +46,7 @@ static const char *CLASS_SIG = "Lnativemethbind03$TestedClass;"; static volatile jint result = PASSED; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jrawMonitorID counter_lock; @@ -72,7 +72,7 @@ NativeMethodBind(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, jmethodID method, return; } - err = jvmti->GetMethodName(method, &methNam, &methSig, NULL); + err = jvmti->GetMethodName(method, &methNam, &methSig, nullptr); if (err != JVMTI_ERROR_NONE) { result = STATUS_FAILED; COMPLAIN("TEST FAILED: unable to get method name during NativeMethodBind callback\n\n"); @@ -84,7 +84,7 @@ NativeMethodBind(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, jmethodID method, LOG("\tmethod: \"%s %s\"\n", methNam, methSig); } - if (methNam != NULL) { + if (methNam != nullptr) { err = jvmti->Deallocate((unsigned char *) methNam); if (err != JVMTI_ERROR_NONE) { result = STATUS_FAILED; @@ -92,7 +92,7 @@ NativeMethodBind(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, jmethodID method, } } - if (methSig != NULL) { + if (methSig != nullptr) { err = jvmti->Deallocate((unsigned char *) methSig); if (err != JVMTI_ERROR_NONE) { result = STATUS_FAILED; @@ -133,13 +133,13 @@ nativeMethod(JNIEnv *jni, jobject obj) { /* dummy method used only to provoke NativeMethodBind event */ JNIEXPORT void JNICALL Java_nativemethbind03_registerNative(JNIEnv *jni, jobject obj) { - jclass testedCls = NULL; + jclass testedCls = nullptr; JNINativeMethod meth; LOG("Inside the registerNative()\n" "Finding class \"%s\" ...\n", CLASS_SIG); testedCls = jni->FindClass(CLASS_SIG); - if (testedCls == NULL) { + if (testedCls == nullptr) { result = STATUS_FAILED; COMPLAIN("TEST FAILURE: unable to find class \"%s\"\n\n", CLASS_SIG); return; @@ -171,7 +171,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_9); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -207,11 +207,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; LOG("setting event callbacks done\nenabling JVMTI events ...\n"); - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_NATIVE_METHOD_BIND, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_NATIVE_METHOD_BIND, nullptr); if (err != JVMTI_ERROR_NONE) { return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, nullptr); if (err != JVMTI_ERROR_NONE) { return JNI_ERR; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/NativeMethodBind/nativemethbind04/libnativemethbind04.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/NativeMethodBind/nativemethbind04/libnativemethbind04.cpp index 174084d04941..49645af75284 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/events/NativeMethodBind/nativemethbind04/libnativemethbind04.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/events/NativeMethodBind/nativemethbind04/libnativemethbind04.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ #include #include #include -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { @@ -42,7 +42,7 @@ static volatile int origCalls = 0; static volatile int redirCalls = 0; static volatile jint result = PASSED; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jrawMonitorID counter_lock; @@ -84,7 +84,7 @@ NativeMethodBind(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, jmethodID method, return; } - err = jvmti->GetMethodName(method, &methNam, &methSig, NULL); + err = jvmti->GetMethodName(method, &methNam, &methSig, nullptr); if (err != JVMTI_ERROR_NONE) { result = STATUS_FAILED; LOG("TEST FAILED: unable to get method name during NativeMethodBind callback\n\n"); @@ -97,7 +97,7 @@ NativeMethodBind(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, jmethodID method, *new_addr = (void *) redirNativeMethod; } - if (methNam != NULL) { + if (methNam != nullptr) { err = jvmti->Deallocate((unsigned char *) methNam); if (err != JVMTI_ERROR_NONE) { result = STATUS_FAILED; @@ -105,7 +105,7 @@ NativeMethodBind(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, jmethodID method, } } - if (methSig != NULL) { + if (methSig != nullptr) { err = jvmti->Deallocate((unsigned char *) methSig); if (err != JVMTI_ERROR_NONE) { result = STATUS_FAILED; @@ -146,7 +146,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_9); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -179,7 +179,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; LOG("setting event callbacks done\nenabling JVMTI events ...\n"); - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_NATIVE_METHOD_BIND, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_NATIVE_METHOD_BIND, nullptr); if (err != JVMTI_ERROR_NONE) { return JNI_ERR; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/SingleStep/singlestep01/libsinglestep01.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/SingleStep/singlestep01/libsinglestep01.cpp index 003cc55e4256..87da7a6bf223 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/events/SingleStep/singlestep01/libsinglestep01.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/events/SingleStep/singlestep01/libsinglestep01.cpp @@ -1,6 +1,5 @@ /* - * Copyright (c) 200 - * git 3, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +24,7 @@ #include #include #include -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { @@ -50,7 +49,7 @@ static const char *CLASS_SIG = "Lsinglestep01;"; static volatile jint result = PASSED; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static volatile jboolean isVirtualExpected = JNI_FALSE; @@ -62,7 +61,7 @@ static void setBP(jvmtiEnv *jvmti, JNIEnv *jni, jclass klass) { jvmtiError err; mid = jni->GetMethodID(klass, METHODS[0], METHOD_SIGS[0]); - if (mid == NULL) { + if (mid == nullptr) { jni->FatalError("failed to get ID for the java method\n"); } @@ -86,7 +85,7 @@ ClassLoad(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, jclass klass) { if (err != JVMTI_ERROR_NONE) { jni->FatalError("failed to obtain a class signature\n"); } - if (sig != NULL && (strcmp(sig, CLASS_SIG) == 0)) { + if (sig != nullptr && (strcmp(sig, CLASS_SIG) == 0)) { LOG("ClassLoad event received for the class \"%s\"\n" "\tsetting breakpoint ...\n", sig); setBP(jvmti, jni, klass); @@ -117,7 +116,7 @@ Breakpoint(jvmtiEnv *jvmti, JNIEnv *jni, jthread thr, jmethodID method, jlocatio jni->FatalError("Breakpoint: failed to obtain a class signature\n"); } - if (sig != NULL && (strcmp(sig, CLASS_SIG) == 0)) { + if (sig != nullptr && (strcmp(sig, CLASS_SIG) == 0)) { LOG("method declaring class \"%s\"\n\tenabling SingleStep events ...\n", sig); err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_SINGLE_STEP, thr); if (err != JVMTI_ERROR_NONE) { @@ -145,7 +144,7 @@ SingleStep(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, jmethodID method, jloca print_thread_info(jvmti, jni, thread); - err = jvmti->GetMethodName(method, &methNam, &methSig, NULL); + err = jvmti->GetMethodName(method, &methNam, &methSig, nullptr); if (err != JVMTI_ERROR_NONE) { result = STATUS_FAILED; COMPLAIN("TEST FAILED: unable to get method name during SingleStep callback\n\n"); @@ -166,7 +165,7 @@ SingleStep(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, jmethodID method, jloca return; } - if (sig != NULL) { + if (sig != nullptr) { LOG("\tmethod name: \"%s\"\n" "\tsignature: \"%s\"\n" "\tmethod declaring class: \"%s\"\n", @@ -244,7 +243,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -284,19 +283,19 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } LOG("setting event callbacks done\nenabling JVMTI events ...\n"); - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_START, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_START, nullptr); if (err != JVMTI_ERROR_NONE) { return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, nullptr); if (err != JVMTI_ERROR_NONE) { return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, nullptr); if (err != JVMTI_ERROR_NONE) { return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, nullptr); if (err != JVMTI_ERROR_NONE) { return JNI_ERR; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/SingleStep/singlestep02/libsinglestep02.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/SingleStep/singlestep02/libsinglestep02.cpp index e80903ac2438..984454dfbaff 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/events/SingleStep/singlestep02/libsinglestep02.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/events/SingleStep/singlestep02/libsinglestep02.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ #include #include #include -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { @@ -35,7 +35,7 @@ extern "C" { static volatile jint result = PASSED; static volatile long wrongStepEv = 0; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; /** callback functions **/ void JNICALL @@ -78,7 +78,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -113,11 +113,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } LOG("setting event callbacks done\nenabling JVMTI events ...\n"); - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_SINGLE_STEP, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_SINGLE_STEP, nullptr); if (err != JVMTI_ERROR_NONE) { return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, nullptr); if (err != JVMTI_ERROR_NONE) { return JNI_ERR; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/SingleStep/singlestep03/libsinglestep03.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/SingleStep/singlestep03/libsinglestep03.cpp index e8455006590d..ddc1e8f73e50 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/events/SingleStep/singlestep03/libsinglestep03.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/events/SingleStep/singlestep03/libsinglestep03.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ #include #include #include -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { @@ -53,7 +53,7 @@ static const char *CLASS_SIG = "Lsinglestep03;"; static volatile jint result = PASSED; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static volatile int callbacksEnabled = JNI_FALSE; @@ -64,7 +64,7 @@ static void setBP(jvmtiEnv *jvmti, JNIEnv *jni, jclass klass) { jvmtiError err; mid = jni->GetMethodID(klass, METHODS[0][0], METHODS[0][1]); - if (mid == NULL) { + if (mid == nullptr) { jni->FatalError("failed to get ID for the java method\n"); } @@ -91,7 +91,7 @@ ClassLoad(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, jclass klass) { jni->FatalError("failed to obtain a class signature\n"); } - if (sig != NULL && (strcmp(sig, CLASS_SIG) == 0)) { + if (sig != nullptr && (strcmp(sig, CLASS_SIG) == 0)) { LOG("ClassLoad event received for the class \"%s\"\n" "\tsetting breakpoint ...\n", sig); setBP(jvmti, jni, klass); @@ -133,7 +133,7 @@ Breakpoint(jvmtiEnv *jvmti, JNIEnv *jni, jthread thr, jmethodID method, jlocatio jni->FatalError("Breakpoint: failed to obtain a class signature\n"); } - if (sig != NULL && (strcmp(sig, CLASS_SIG) == 0)) { + if (sig != nullptr && (strcmp(sig, CLASS_SIG) == 0)) { LOG("method declaring class \"%s\"\n\tenabling SingleStep events ...\n", sig); err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_SINGLE_STEP, thr); if (err != JVMTI_ERROR_NONE) { @@ -159,7 +159,7 @@ SingleStep(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, jmethodID method, jloca LOG(">>>> SingleStep event received\n"); - err = jvmti->GetMethodName(method, &methNam, &methSig, NULL); + err = jvmti->GetMethodName(method, &methNam, &methSig, nullptr); if (err != JVMTI_ERROR_NONE) { result = STATUS_FAILED; COMPLAIN("TEST FAILED: unable to get method name during SingleStep callback\n\n"); @@ -180,7 +180,7 @@ SingleStep(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, jmethodID method, jloca return; } - if (sig != NULL) { + if (sig != nullptr) { if (stepEv[METH_NUM - 1][0] == 1) { result = STATUS_FAILED; COMPLAIN("TEST FAILED: SingleStep event received after disabling the event generation\n\n"); @@ -272,7 +272,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -310,19 +310,19 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } LOG("setting event callbacks done\nenabling JVMTI events ...\n"); - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_START, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_START, nullptr); if (err != JVMTI_ERROR_NONE) { return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, nullptr); if (err != JVMTI_ERROR_NONE) { return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, nullptr); if (err != JVMTI_ERROR_NONE) { return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, nullptr); if (err != JVMTI_ERROR_NONE) { return JNI_ERR; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/ThreadEnd/threadend01/libthreadend01.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/ThreadEnd/threadend01/libthreadend01.cpp index 6cfb057902b1..69e76d6d92e6 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/events/ThreadEnd/threadend01/libthreadend01.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/events/ThreadEnd/threadend01/libthreadend01.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ #include #include #include -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { @@ -34,12 +34,12 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jint result = PASSED; static int eventsCount = 0; static int eventsExpected = 0; -static const char *prefix = NULL; +static const char *prefix = nullptr; void JNICALL ThreadEnd(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread) { jvmtiError err; @@ -54,10 +54,10 @@ void JNICALL ThreadEnd(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread) { print_thread_info(jvmti, jni, thread); - if (inf.name != NULL && strstr(inf.name, prefix) == inf.name) { + if (inf.name != nullptr && strstr(inf.name, prefix) == inf.name) { eventsCount++; snprintf(name, sizeof(name), "%s%d", prefix, eventsCount); - if (inf.name == NULL || strcmp(name, inf.name) != 0) { + if (inf.name == nullptr || strcmp(name, inf.name) != 0) { LOG("(#%d) wrong thread name: \"%s\"",eventsCount, inf.name); LOG(", expected: \"%s\"\n", name); result = STATUS_FAILED; @@ -70,7 +70,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -89,19 +89,19 @@ JNIEXPORT void JNICALL Java_threadend01_getReady(JNIEnv *jni, jclass cls, jint i, jstring name) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { LOG("JVMTI client was not properly loaded!\n"); return; } - prefix = jni->GetStringUTFChars(name, NULL); - if (prefix == NULL) { + prefix = jni->GetStringUTFChars(name, nullptr); + if (prefix == nullptr) { LOG("Failed to copy UTF-8 string!\n"); result = STATUS_FAILED; return; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_END, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_END, nullptr); if (err == JVMTI_ERROR_NONE) { eventsExpected = i; } else { @@ -112,12 +112,12 @@ Java_threadend01_getReady(JNIEnv *jni, jclass cls, jint i, jstring name) { JNIEXPORT jint JNICALL Java_threadend01_check(JNIEnv *jni, jclass cls) { - if (jvmti == NULL) { + if (jvmti == nullptr) { LOG("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } -jvmtiError err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_THREAD_END, NULL); +jvmtiError err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_THREAD_END, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("Failed to disable JVMTI_EVENT_THREAD_END: %s (%d)\n", TranslateError(err), err); result = STATUS_FAILED; diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/ThreadEnd/threadend02/libthreadend02.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/ThreadEnd/threadend02/libthreadend02.cpp index 1d2cfe36de3c..48f9da3785e2 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/events/ThreadEnd/threadend02/libthreadend02.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/events/ThreadEnd/threadend02/libthreadend02.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,14 +25,14 @@ #include #include #include -#include "jvmti_common.h" -#include "jvmti_thread.h" +#include "jvmti_common.hpp" +#include "jvmti_thread.hpp" extern "C" { /* scaffold objects */ -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; static int eventCount = 0; @@ -52,7 +52,7 @@ enableEvent(jvmtiEventMode enable, jvmtiEvent event) { LOG("disabling %s\n", TranslateEvent(event)); } - err = jvmti->SetEventNotificationMode(enable, event, NULL); + err = jvmti->SetEventNotificationMode(enable, event, nullptr); if (err != JVMTI_ERROR_NONE) { set_agent_fail_status(); return JNI_FALSE; @@ -129,7 +129,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = 60 * 1000; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -150,7 +150,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - set_agent_proc(agentProc, NULL); + set_agent_proc(agentProc, nullptr); return JNI_OK; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/ThreadStart/threadstart01/libthreadstart01.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/ThreadStart/threadstart01/libthreadstart01.cpp index 935f4fc1002c..abf2e0e2bc33 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/events/ThreadStart/threadstart01/libthreadstart01.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/events/ThreadStart/threadstart01/libthreadstart01.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ #include #include #include -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { @@ -34,12 +34,12 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jint result = PASSED; static int eventsCount = 0; static int eventsExpected = 0; -static const char *prefix = NULL; +static const char *prefix = nullptr; void JNICALL ThreadStart(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread) { @@ -54,7 +54,7 @@ ThreadStart(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread) { LOG(">>> %s\n", inf.name); - if (inf.name != NULL && strstr(inf.name, prefix) == inf.name) { + if (inf.name != nullptr && strstr(inf.name, prefix) == inf.name) { snprintf(name, sizeof(name), "%s%d", prefix, eventsCount); if (strcmp(name, inf.name) != 0) { LOG("(#%d) wrong thread name: \"%s\"", eventsCount, inf.name); @@ -70,7 +70,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -89,19 +89,19 @@ JNIEXPORT void JNICALL Java_threadstart01_getReady(JNIEnv *jni, jclass cls, jint i, jstring name) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { LOG("JVMTI client was not properly loaded!\n"); return; } - prefix = jni->GetStringUTFChars(name, NULL); - if (prefix == NULL) { + prefix = jni->GetStringUTFChars(name, nullptr); + if (prefix == nullptr) { LOG("Failed to copy UTF-8 string!\n"); result = STATUS_FAILED; return; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, nullptr); if (err == JVMTI_ERROR_NONE) { eventsExpected = i; } else { @@ -114,12 +114,12 @@ JNIEXPORT jint JNICALL Java_threadstart01_check(JNIEnv *jni, jclass cls) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { LOG("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } - err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_THREAD_START, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_THREAD_START, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("Failed to disable JVMTI_EVENT_THREAD_START: %s (%d)\n", TranslateError(err), err); result = STATUS_FAILED; diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/ThreadStart/threadstart02/libthreadstart02.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/ThreadStart/threadstart02/libthreadstart02.cpp index e5ae8be31076..061d6cf376a6 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/events/ThreadStart/threadstart02/libthreadstart02.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/events/ThreadStart/threadstart02/libthreadstart02.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ #include #include #include -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { @@ -33,16 +33,16 @@ extern "C" { #define STATUS_FAILED 2 #define WAIT_TIME 20000 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; /* volatile variables */ static jrawMonitorID agent_start_lock, thr_start_lock, thr_resume_lock, thr_event_lock; -static volatile jthread agent_thread = NULL; +static volatile jthread agent_thread = nullptr; static volatile jboolean terminate_debug_agent = JNI_FALSE; static volatile jboolean debug_agent_timed_out = JNI_FALSE; static volatile jboolean debug_agent_started = JNI_FALSE; -static volatile jthread next_thread = NULL; +static volatile jthread next_thread = nullptr; static jvmtiThreadInfo inf; static volatile int eventsCount = 0; static volatile jint result = PASSED; @@ -128,12 +128,12 @@ debug_agent(jvmtiEnv *jvmti, JNIEnv *jni, void *p) { RawMonitorLocker thr_start_locker(jvmti, jni, thr_start_lock); while (terminate_debug_agent != JNI_TRUE) { - if (next_thread == NULL) { + if (next_thread == nullptr) { /* wait till new thread will be created and started */ thr_start_locker.wait(); } - if (next_thread != NULL) { + if (next_thread != nullptr) { /* hmm, why NewGlobalRef is called one more time??? * next_thread = env->NewGlobalRef(next_thread); */ @@ -160,7 +160,7 @@ debug_agent(jvmtiEnv *jvmti, JNIEnv *jni, void *p) { } jni->DeleteGlobalRef(next_thread); - next_thread = NULL; + next_thread = nullptr; /* Notify ThreadStart callback that thread has been resumed */ @@ -267,38 +267,38 @@ void JNICALL ThreadStart(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread) { } void JNICALL VMInit(jvmtiEnv *jvmti, JNIEnv *jni, jthread thr) { - jclass cls = NULL; - jmethodID mid = NULL; + jclass cls = nullptr; + jmethodID mid = nullptr; LOG(">>> VMInit event: start\n"); - check_jvmti_status(jni, jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, NULL), + check_jvmti_status(jni, jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, nullptr), "Failed to enable JVMTI_EVENT_THREAD_START"); /* Start agent thread */ cls = jni->FindClass("java/lang/Thread"); - if (cls == NULL) { + if (cls == nullptr) { result = STATUS_FAILED; COMPLAIN("TEST FAILED: Cannot start agent thread: FindClass() failed\n"); return; } mid = jni->GetMethodID(cls, "", "()V"); - if (mid == NULL) { + if (mid == nullptr) { result = STATUS_FAILED; COMPLAIN("TEST FAILED: Cannot start agent thread: GetMethodID() failed\n"); return; } agent_thread = jni->NewObject(cls, mid); - if (agent_thread == NULL) { + if (agent_thread == nullptr) { result = STATUS_FAILED; COMPLAIN("Cannot start agent thread: NewObject() failed\n"); return; } agent_thread = (jthread) jni->NewGlobalRef(agent_thread); - if (agent_thread == NULL) { + if (agent_thread == nullptr) { result = STATUS_FAILED; COMPLAIN("Cannot create global reference for agent_thread\n"); return; @@ -311,7 +311,7 @@ void JNICALL VMInit(jvmtiEnv *jvmti, JNIEnv *jni, jthread thr) { RawMonitorLocker agent_start_locker(jvmti, jni, agent_start_lock); - check_jvmti_status(jni, jvmti->RunAgentThread(agent_thread, debug_agent, NULL, JVMTI_THREAD_NORM_PRIORITY), + check_jvmti_status(jni, jvmti->RunAgentThread(agent_thread, debug_agent, nullptr, JVMTI_THREAD_NORM_PRIORITY), "Failed to RunAgentThread"); agent_start_locker.wait(); LOG(">>> VMInit event: end\n"); @@ -327,7 +327,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -366,14 +366,14 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("Failed to disable JVMTI_EVENT_THREAD_START: %s (%d)\n", TranslateError(err), err); result = STATUS_FAILED; return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("Failed to disable JVMTI_EVENT_THREAD_END: %s (%d)\n", TranslateError(err), err); result = STATUS_FAILED; diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/ThreadStart/threadstart03/libthreadstart03.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/ThreadStart/threadstart03/libthreadstart03.cpp index a14fa1dbdb3f..560a1c77ee22 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/events/ThreadStart/threadstart03/libthreadstart03.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/events/ThreadStart/threadstart03/libthreadstart03.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ #include #include #include -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { @@ -35,11 +35,11 @@ extern "C" { #define STATUS_FAILED 2 #define WAIT_TIME 1000 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jint result = PASSED; static jrawMonitorID wait_lock; -static const char *threadName = NULL; +static const char *threadName = nullptr; static int startsCount = 0; static int startsExpected = 0; static int endsCount = 0; @@ -57,7 +57,7 @@ void JNICALL ThreadStart(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread) { LOG(">>> start: %s\n", inf.name); - if (inf.name != NULL && strcmp(inf.name, threadName) == 0) { + if (inf.name != nullptr && strcmp(inf.name, threadName) == 0) { startsCount++; } } @@ -74,7 +74,7 @@ void JNICALL ThreadEnd(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread) { LOG(">>> end: %s\n", inf.name); - if (inf.name != NULL && strcmp(inf.name, threadName) == 0) { + if (inf.name != nullptr && strcmp(inf.name, threadName) == 0) { endsCount++; } } @@ -84,7 +84,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -110,20 +110,20 @@ JNIEXPORT jint JNICALL Java_threadstart03_check(JNIEnv *jni, jclass cls, jthread thr, jstring name) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { LOG("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } - threadName = jni->GetStringUTFChars(name, NULL); - if (threadName == NULL) { + threadName = jni->GetStringUTFChars(name, nullptr); + if (threadName == nullptr) { LOG("Failed to copy UTF-8 string!\n"); return STATUS_FAILED; } wait_lock = create_raw_monitor(jvmti, "_wait_lock"); - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, nullptr); if (err == JVMTI_ERROR_NONE) { startsExpected = 1; } else { @@ -131,7 +131,7 @@ Java_threadstart03_check(JNIEnv *jni, jclass cls, jthread thr, jstring name) { result = STATUS_FAILED; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_END, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_END, nullptr); if (err == JVMTI_ERROR_NONE) { endsExpected = 1; } else { @@ -143,7 +143,7 @@ Java_threadstart03_check(JNIEnv *jni, jclass cls, jthread thr, jstring name) { { RawMonitorLocker wait_locker(jvmti, jni, wait_lock); - err = jvmti->RunAgentThread(thr, threadProc, NULL, JVMTI_THREAD_MAX_PRIORITY); + err = jvmti->RunAgentThread(thr, threadProc, nullptr, JVMTI_THREAD_MAX_PRIORITY); if (err != JVMTI_ERROR_NONE) { LOG("(RunAgentThread) unexpected error: %s (%d)\n", TranslateError(err), err); result = STATUS_FAILED; @@ -164,13 +164,13 @@ Java_threadstart03_check(JNIEnv *jni, jclass cls, jthread thr, jstring name) { } - err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_THREAD_START, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_THREAD_START, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("Failed to disable JVMTI_EVENT_THREAD_START: %s (%d)\n", TranslateError(err), err); result = STATUS_FAILED; } - err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_THREAD_END, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_THREAD_END, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("Failed to disable JVMTI_EVENT_THREAD_END: %s (%d)\n", TranslateError(err), err); result = STATUS_FAILED; diff --git a/test/hotspot/jtreg/serviceability/jvmti/events/VMObjectAlloc/vmobjalloc01/libvmobjalloc01.cpp b/test/hotspot/jtreg/serviceability/jvmti/events/VMObjectAlloc/vmobjalloc01/libvmobjalloc01.cpp index 24cef0250c52..82c0ac8b54a8 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/events/VMObjectAlloc/vmobjalloc01/libvmobjalloc01.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/events/VMObjectAlloc/vmobjalloc01/libvmobjalloc01.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,8 @@ #include #include "jvmti.h" -#include "jvmti_common.h" -#include "jvmti_thread.h" +#include "jvmti_common.hpp" +#include "jvmti_thread.hpp" extern "C" { @@ -65,10 +65,10 @@ VMObjectAlloc(jvmtiEnv *jvmti, JNIEnv* jni, jthread thread, jobject object, jcla LOG("VMObjectAlloc: \"%s\", size=%ld\n", signature, (long)size); - if (signature != NULL) + if (signature != nullptr) jvmti->Deallocate((unsigned char*)signature); - if (generic != NULL) + if (generic != nullptr) jvmti->Deallocate((unsigned char*)generic); } @@ -92,7 +92,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiCapabilities caps; jvmtiEventCallbacks callbacks; jvmtiError err; @@ -103,7 +103,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_9); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -127,12 +127,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } /* enable VMObjectAlloc event */ - if (jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_OBJECT_ALLOC, NULL) != JVMTI_ERROR_NONE) { + if (jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_OBJECT_ALLOC, nullptr) != JVMTI_ERROR_NONE) { return JNI_ERR; } /* register agent proc and arg */ - set_agent_proc(agentProc, NULL); + set_agent_proc(agentProc, nullptr); return JNI_OK; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/negative/GetAllThreadsNullTest/libGetAllThreadsNullTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/negative/GetAllThreadsNullTest/libGetAllThreadsNullTest.cpp index 2c665df4f27f..1dd9713ce34b 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/negative/GetAllThreadsNullTest/libGetAllThreadsNullTest.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/negative/GetAllThreadsNullTest/libGetAllThreadsNullTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,16 +24,16 @@ #include #include #include "jvmti.h" -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { -static jvmtiEnv *jvmti_env = NULL; +static jvmtiEnv *jvmti_env = nullptr; JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { jint res = jvm->GetEnv((void **) &jvmti_env, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti_env == NULL) { + if (res != JNI_OK || jvmti_env == nullptr) { LOG("Wrong test_passed of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -48,14 +48,14 @@ Java_GetAllThreadsNullTest_check(JNIEnv *env, jclass cls) { jthread *threadsPtr; jboolean test_passed = JNI_TRUE; - if (jvmti_env == NULL) { + if (jvmti_env == nullptr) { LOG("JVMTI client was not properly loaded!\n"); return JNI_FALSE; } LOG(">>> (threadsCountPtr) null pointer check ...\n"); - err = jvmti_env->GetAllThreads(NULL, &threadsPtr); + err = jvmti_env->GetAllThreads(nullptr, &threadsPtr); if (err != JVMTI_ERROR_NULL_POINTER) { LOG("(threadsCountPtr) error expected: JVMTI_ERROR_NULL_POINTER,\n"); LOG(" got: %s (%d)\n", TranslateError(err), err); @@ -64,14 +64,14 @@ Java_GetAllThreadsNullTest_check(JNIEnv *env, jclass cls) { LOG(">>> (threadsPtr) null pointer check ...\n"); - err = jvmti_env->GetAllThreads(&threadsCountPtr, NULL); + err = jvmti_env->GetAllThreads(&threadsCountPtr, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { LOG("(threadsPtr) error expected: JVMTI_ERROR_NULL_POINTER,\n"); LOG(" got: %s (%d)\n", TranslateError(err), err); test_passed = JNI_FALSE; } - err = jvmti_env->GetAllThreads(NULL, NULL); + err = jvmti_env->GetAllThreads(nullptr, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { LOG("(threadsPtr) error expected: JVMTI_ERROR_NULL_POINTER,\n"); LOG(" got: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/serviceability/jvmti/negative/contmon03/libcontmon03.cpp b/test/hotspot/jtreg/serviceability/jvmti/negative/contmon03/libcontmon03.cpp index 35e6f859afd6..b51cb079ae94 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/negative/contmon03/libcontmon03.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/negative/contmon03/libcontmon03.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ #include #include #include "jvmti.h" -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { @@ -32,7 +32,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; JNIEXPORT jint JNICALL @@ -42,7 +42,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { jvmtiCapabilities caps; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -64,7 +64,7 @@ Java_contmon03_check(JNIEnv *env, jclass cls, jthread thread) { jvmtiError err; jobject monitor; - if (jvmti == NULL) { + if (jvmti == nullptr) { LOG("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -80,7 +80,7 @@ Java_contmon03_check(JNIEnv *env, jclass cls, jthread thread) { LOG(">>> null pointer check ...\n"); - err = jvmti->GetCurrentContendedMonitor(thread, NULL); + err = jvmti->GetCurrentContendedMonitor(thread, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { LOG("Error expected: JVMTI_ERROR_NULL_POINTER,\n"); LOG(" got: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/serviceability/jvmti/negative/framecnt02/libframecnt02.cpp b/test/hotspot/jtreg/serviceability/jvmti/negative/framecnt02/libframecnt02.cpp index f8d76a2f882c..7b860ab4d22e 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/negative/framecnt02/libframecnt02.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/negative/framecnt02/libframecnt02.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ #include #include #include "jvmti.h" -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { @@ -32,7 +32,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; JNIEXPORT jint JNICALL @@ -40,7 +40,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } @@ -54,7 +54,7 @@ Java_framecnt02_checkFrames(JNIEnv *env, jclass cls, jthread thr, jint thr_num) jint frameCount; if (thr_num == 0) { - err = jvmti->GetFrameCount(thr, NULL); + err = jvmti->GetFrameCount(thr, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { LOG("Error expected: JVMTI_ERROR_NULL_POINTER, got: %s (%d)\n", TranslateError(err), err); result = STATUS_FAILED; diff --git a/test/hotspot/jtreg/serviceability/jvmti/negative/framecnt03/libframecnt03.cpp b/test/hotspot/jtreg/serviceability/jvmti/negative/framecnt03/libframecnt03.cpp index 74769bb29f51..4747ad3c6924 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/negative/framecnt03/libframecnt03.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/negative/framecnt03/libframecnt03.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ #include #include #include "jvmti.h" -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { @@ -32,7 +32,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; JNIEXPORT jint JNICALL @@ -40,7 +40,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -53,7 +53,7 @@ Java_framecnt03_check(JNIEnv *env, jclass cls) { jvmtiError err; jint countPtr; - if (jvmti == NULL) { + if (jvmti == nullptr) { LOG("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/negative/frameloc03/libframeloc03.cpp b/test/hotspot/jtreg/serviceability/jvmti/negative/frameloc03/libframeloc03.cpp index 631ad8d383f4..e7791751442c 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/negative/frameloc03/libframeloc03.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/negative/frameloc03/libframeloc03.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ #include #include #include "jvmti.h" -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { @@ -32,7 +32,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -43,12 +43,12 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -84,7 +84,7 @@ Java_frameloc03_check(JNIEnv *env, jclass cls, jthread thr) { jmethodID mid; jlocation loc; - if (jvmti == NULL) { + if (jvmti == nullptr) { LOG("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -123,7 +123,7 @@ Java_frameloc03_check(JNIEnv *env, jclass cls, jthread thr) { if (printdump == JNI_TRUE) { LOG(">>> (methodPtr) null pointer check ...\n"); } - err = jvmti->GetFrameLocation(thr, 0, NULL, &loc); + err = jvmti->GetFrameLocation(thr, 0, nullptr, &loc); if (err != JVMTI_ERROR_NULL_POINTER) { LOG("Error expected: JVMTI_ERROR_NULL_POINTER,\n"); LOG(" actual: %s (%d)\n", TranslateError(err), err); @@ -133,7 +133,7 @@ Java_frameloc03_check(JNIEnv *env, jclass cls, jthread thr) { if (printdump == JNI_TRUE) { LOG(">>> (locationPtr) null pointer check ...\n"); } - err = jvmti->GetFrameLocation(thr, 0, &mid, NULL); + err = jvmti->GetFrameLocation(thr, 0, &mid, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { LOG("Error expected: JVMTI_ERROR_NULL_POINTER,\n"); LOG(" actual: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/serviceability/jvmti/negative/getstacktr02/libgetstacktr02.cpp b/test/hotspot/jtreg/serviceability/jvmti/negative/getstacktr02/libgetstacktr02.cpp index 061b717af379..9e98b584a31f 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/negative/getstacktr02/libgetstacktr02.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/negative/getstacktr02/libgetstacktr02.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ #include #include #include "jvmti.h" -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { @@ -32,7 +32,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -40,12 +40,12 @@ JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -59,7 +59,7 @@ Java_getstacktr02_check(JNIEnv *env, jclass cls, jthread thread) { jvmtiFrameInfo frame; jint count; - if (jvmti == NULL) { + if (jvmti == nullptr) { LOG("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -85,7 +85,7 @@ Java_getstacktr02_check(JNIEnv *env, jclass cls, jthread thread) { if (printdump == JNI_TRUE) { LOG(">>> (stack_buffer) null pointer check ...\n"); } - err = jvmti->GetStackTrace(thread, 0, 1, NULL, &count); + err = jvmti->GetStackTrace(thread, 0, 1, nullptr, &count); if (err != JVMTI_ERROR_NULL_POINTER) { LOG("(stack_buffer) error expected: JVMTI_ERROR_NULL_POINTER,"); LOG(" got: %s (%d)\n", TranslateError(err), err); @@ -95,7 +95,7 @@ Java_getstacktr02_check(JNIEnv *env, jclass cls, jthread thread) { if (printdump == JNI_TRUE) { LOG(">>> (count_ptr) null pointer check ...\n"); } - err = jvmti->GetStackTrace(thread, 0, 1, &frame, NULL); + err = jvmti->GetStackTrace(thread, 0, 1, &frame, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { LOG("(count_ptr) error expected: JVMTI_ERROR_NULL_POINTER,"); LOG(" got: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/serviceability/jvmti/negative/getstacktr09/libgetstacktr09.cpp b/test/hotspot/jtreg/serviceability/jvmti/negative/getstacktr09/libgetstacktr09.cpp index f9b6e4dd0779..b8b65cc75461 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/negative/getstacktr09/libgetstacktr09.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/negative/getstacktr09/libgetstacktr09.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ #include #include #include "jvmti.h" -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { @@ -32,7 +32,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -40,12 +40,12 @@ JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -59,7 +59,7 @@ Java_getstacktr09_check(JNIEnv *env, jclass cls, jthread thread1, jthread thread jvmtiFrameInfo frame; jint count; - if (jvmti == NULL) { + if (jvmti == nullptr) { LOG("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/negative/thrinfo02/libthrinfo02.cpp b/test/hotspot/jtreg/serviceability/jvmti/negative/thrinfo02/libthrinfo02.cpp index 8c47aaa7f4b7..7bb8bd861bc2 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/negative/thrinfo02/libthrinfo02.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/negative/thrinfo02/libthrinfo02.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ #include #include #include "jvmti.h" -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { @@ -32,7 +32,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -40,12 +40,12 @@ JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -58,7 +58,7 @@ Java_thrinfo02_check(JNIEnv *env, jclass cls, jthread thr, jthreadGroup group) { jvmtiError err; jvmtiThreadInfo inf; - if (jvmti == NULL) { + if (jvmti == nullptr) { LOG("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -66,14 +66,14 @@ Java_thrinfo02_check(JNIEnv *env, jclass cls, jthread thr, jthreadGroup group) { if (printdump == JNI_TRUE) { LOG(">>> invalid thread check ...\n"); } - err = jvmti->GetThreadInfo(NULL, &inf); + err = jvmti->GetThreadInfo(nullptr, &inf); if (err != JVMTI_ERROR_NONE) { LOG("Error expected: JVMTI_ERROR_NONE,\n"); LOG(" got: %s (%d)\n", TranslateError(err), err); result = STATUS_FAILED; } - if (inf.name == NULL || strcmp(inf.name, "main")) { + if (inf.name == nullptr || strcmp(inf.name, "main")) { LOG("Thread %s: incorrect name: %s\n", "main", inf.name); result = STATUS_FAILED; } @@ -93,7 +93,7 @@ Java_thrinfo02_check(JNIEnv *env, jclass cls, jthread thr, jthreadGroup group) { if (printdump == JNI_TRUE) { LOG(">>> null pointer check ...\n"); } - err = jvmti->GetThreadInfo(thr, NULL); + err = jvmti->GetThreadInfo(thr, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { LOG("Error expected: JVMTI_ERROR_NULL_POINTER,\n"); LOG(" got: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/serviceability/jvmti/negative/thrstat04/libthrstat04.cpp b/test/hotspot/jtreg/serviceability/jvmti/negative/thrstat04/libthrstat04.cpp index 05baab36d51d..ebc957deab26 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/negative/thrstat04/libthrstat04.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/negative/thrstat04/libthrstat04.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ #include #include #include "jvmti.h" -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { @@ -32,7 +32,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -40,12 +40,12 @@ JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -58,7 +58,7 @@ Java_thrstat04_check(JNIEnv *env, jclass cls, jthread thr) { jvmtiError err; jint thrState; - if (jvmti == NULL) { + if (jvmti == nullptr) { LOG("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -66,7 +66,7 @@ Java_thrstat04_check(JNIEnv *env, jclass cls, jthread thr) { if (printdump == JNI_TRUE) { LOG(">>> (threadStatePtr) null pointer check ...\n"); } - err = jvmti->GetThreadState(thr, NULL); + err = jvmti->GetThreadState(thr, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { LOG("(threadStatePtr) error expected: JVMTI_ERROR_NULL_POINTER,\n"); LOG(" got: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/serviceability/jvmti/stress/StackTrace/NotSuspended/libGetStackTraceNotSuspendedStress.cpp b/test/hotspot/jtreg/serviceability/jvmti/stress/StackTrace/NotSuspended/libGetStackTraceNotSuspendedStress.cpp index 12e685b3714e..903a76d4acf3 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/stress/StackTrace/NotSuspended/libGetStackTraceNotSuspendedStress.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/stress/StackTrace/NotSuspended/libGetStackTraceNotSuspendedStress.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2024, 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,8 @@ #include #include "jvmti.h" -#include "jvmti_common.h" -#include "jvmti_thread.h" +#include "jvmti_common.hpp" +#include "jvmti_thread.hpp" #define MAX_FRAME_COUNT 80 @@ -34,7 +34,7 @@ const char CONTINUATION_METHOD_NAME[] = "enter"; static void test_stack_trace(jvmtiEnv *jvmti, JNIEnv *jni, jthread vthread) { jvmtiFrameInfo frames[MAX_FRAME_COUNT]; jint count = -1; - jmethodID method = NULL; + jmethodID method = nullptr; jvmtiError err; err = jvmti->GetStackTrace(vthread, 0, MAX_FRAME_COUNT, frames, &count); @@ -78,7 +78,7 @@ agentProc(jvmtiEnv * jvmti, JNIEnv * jni, void * arg) { LOG("Agent: started\n"); while (true) { - jthread *threads = NULL; + jthread *threads = nullptr; jint count = 0; jvmtiError err; @@ -90,7 +90,7 @@ agentProc(jvmtiEnv * jvmti, JNIEnv * jni, void * arg) { } check_jvmti_status(jni, err, "Error in JVMTI GetAllThreads"); for (int i = 0; i < count; i++) { - jthread tested_thread = NULL; + jthread tested_thread = nullptr; err = GetVirtualThread(jvmti, jni, threads[i], &tested_thread); if (err == JVMTI_ERROR_THREAD_NOT_ALIVE) { @@ -100,7 +100,7 @@ agentProc(jvmtiEnv * jvmti, JNIEnv * jni, void * arg) { return; } check_jvmti_status(jni, err, "Error in JVMTI extension GetVirtualThread"); - if (tested_thread != NULL) { + if (tested_thread != nullptr) { test_stack_trace(jvmti, jni, tested_thread); } } @@ -132,7 +132,7 @@ extern JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *res return JNI_ERR; } - if (set_agent_proc(agentProc, NULL) != JNI_TRUE) { + if (set_agent_proc(agentProc, nullptr) != JNI_TRUE) { return JNI_ERR; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/stress/StackTrace/Suspended/libGetStackTraceSuspendedStress.cpp b/test/hotspot/jtreg/serviceability/jvmti/stress/StackTrace/Suspended/libGetStackTraceSuspendedStress.cpp index 65e79fb33f21..037448a64287 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/stress/StackTrace/Suspended/libGetStackTraceSuspendedStress.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/stress/StackTrace/Suspended/libGetStackTraceSuspendedStress.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2024, 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,21 +23,21 @@ #include #include "jvmti.h" -#include "jvmti_common.h" -#include "jvmti_thread.h" +#include "jvmti_common.hpp" +#include "jvmti_thread.hpp" #define MAX_FRAME_COUNT 80 static const char CONTINUATION_CLASS_NAME[] = "jdk/internal/vm/Continuation"; static const char CONTINUATION_METHOD_NAME[] = "enter"; -static jrawMonitorID event_mon = NULL; +static jrawMonitorID event_mon = nullptr; static void test_stack_trace(jvmtiEnv *jvmti, JNIEnv *jni, jthread vthread) { jvmtiFrameInfo frames[MAX_FRAME_COUNT]; jint count = -1; - jmethodID method = NULL; + jmethodID method = nullptr; jvmtiError err; err = jvmti->GetStackTrace(vthread, 0, MAX_FRAME_COUNT, frames, &count); @@ -93,7 +93,7 @@ check_link_consistency(jvmtiEnv *jvmti, JNIEnv *jni, jthread vthread) { fatal(jni, "Carrier thread is NOT expected to be suspended"); } - if (cthread != NULL) { + if (cthread != nullptr) { jthread cthread_to_vthread = get_virtual_thread(jvmti, jni, cthread); if (!jni->IsSameObject(vthread, cthread_to_vthread)) { @@ -118,12 +118,12 @@ check_vthread_consistency_suspended(jvmtiEnv *jvmti, JNIEnv *jni, jthread vthrea jni->FatalError("Agent: check_vthread_consistency_suspended: vthread is expected to be virtual"); } jthread cthread = get_carrier_thread(jvmti, jni, vthread); - //const char* cname = (cthread == NULL) ? "" : get_thread_name(jvmti, jni, cthread); + //const char* cname = (cthread == nullptr) ? "" : get_thread_name(jvmti, jni, cthread); err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_SINGLE_STEP, vthread); check_jvmti_status(jni, err, "Error in JVMTI SetEventNotificationMode: enable SINGLE_STEP"); - if (cthread != NULL) { // pre-condition for reliable testing + if (cthread != nullptr) { // pre-condition for reliable testing test_stack_trace(jvmti, jni, vthread); check_link_consistency(jvmti, jni, vthread); } @@ -145,7 +145,7 @@ SingleStep(jvmtiEnv *jvmti, JNIEnv* jni, jthread thread, print_stack_trace(jvmti, jni, thread); jthread cthread = get_carrier_thread(jvmti, jni, thread); - if (cthread != NULL) { + if (cthread != nullptr) { print_stack_trace(jvmti, jni, cthread); } @@ -170,7 +170,7 @@ agentProc(jvmtiEnv * jvmti, JNIEnv * jni, void * arg) { int iter = 0; while (true) { - jthread *threads = NULL; + jthread *threads = nullptr; jint count = 0; jvmtiError err; @@ -182,7 +182,7 @@ agentProc(jvmtiEnv * jvmti, JNIEnv * jni, void * arg) { for (int i = 0; i < count; i++) { jthread cthread = threads[i]; - jthread vthread = NULL; + jthread vthread = nullptr; err = GetVirtualThread(jvmti, jni, cthread, &vthread); if (err == JVMTI_ERROR_THREAD_NOT_ALIVE) { @@ -192,7 +192,7 @@ agentProc(jvmtiEnv * jvmti, JNIEnv * jni, void * arg) { return; } check_jvmti_status(jni, err, "Error in GetVirtualThread"); - if (iter > 50 && vthread != NULL) { + if (iter > 50 && vthread != nullptr) { // char* cname = get_thread_name(jvmti, jni, cthread); // char* vname = get_thread_name(jvmti, jni, vthread); @@ -256,7 +256,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (set_agent_proc(agentProc, NULL) != JNI_TRUE) { + if (set_agent_proc(agentProc, nullptr) != JNI_TRUE) { return JNI_ERR; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/stress/ThreadLocalStorage/SetGetThreadLocalStorageStressTest/libSetGetThreadLocalStorageStress.cpp b/test/hotspot/jtreg/serviceability/jvmti/stress/ThreadLocalStorage/SetGetThreadLocalStorageStressTest/libSetGetThreadLocalStorageStress.cpp index 43ddccc84a41..a8faa71970d0 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/stress/ThreadLocalStorage/SetGetThreadLocalStorageStressTest/libSetGetThreadLocalStorageStress.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/stress/ThreadLocalStorage/SetGetThreadLocalStorageStressTest/libSetGetThreadLocalStorageStress.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2024, 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,8 @@ #include #include "jvmti.h" -#include "jvmti_common.h" -#include "jvmti_thread.h" +#include "jvmti_common.hpp" +#include "jvmti_thread.hpp" /* constant names */ @@ -48,15 +48,15 @@ StorageStructure* check_tls(jvmtiEnv * jvmti, JNIEnv * jni, jthread thread, cons jvmtiError err = jvmti->GetThreadLocalStorage(thread, (void **) &storage); if (err == JVMTI_ERROR_THREAD_NOT_ALIVE) { - return NULL; + return nullptr; } check_jvmti_status(jni, err, "Error in GetThreadLocalStorage"); LOG("Check %s with %p in %s\n", thread_info.name, storage, source); - if (storage == NULL) { + if (storage == nullptr) { // Might be not set - return NULL; + return nullptr; } if (storage->self_pointer != storage || (strcmp(thread_info.name, storage->data) != 0)) { @@ -71,12 +71,12 @@ StorageStructure* check_tls(jvmtiEnv * jvmti, JNIEnv * jni, jthread thread, cons void check_delete_tls(jvmtiEnv * jvmti, JNIEnv * jni, jthread thread, const char* source) { StorageStructure *storage = check_tls(jvmti, jni, thread, source); - if (storage == NULL) { + if (storage == nullptr) { return; } check_jvmti_status(jni, jvmti->Deallocate((unsigned char *)storage), "Deallocation failed."); - jvmtiError err = jvmti->SetThreadLocalStorage(thread, NULL); + jvmtiError err = jvmti->SetThreadLocalStorage(thread, nullptr); if (err == JVMTI_ERROR_THREAD_NOT_ALIVE) { return; } @@ -125,7 +125,7 @@ agentProc(jvmtiEnv * jvmti, JNIEnv * jni, void * arg) { LOG("Started.....\n"); while (true) { - jthread *threads = NULL; + jthread *threads = nullptr; jint count = 0; sleep_ms(10); @@ -136,7 +136,7 @@ agentProc(jvmtiEnv * jvmti, JNIEnv * jni, void * arg) { } check_jvmti_status(jni, jvmti->GetAllThreads(&count, &threads), "Error in GetAllThreads"); for (int i = 0; i < count; i++) { - jthread testedThread = NULL; + jthread testedThread = nullptr; jvmtiError err; err = GetVirtualThread(jvmti, jni, threads[i], &testedThread); @@ -145,7 +145,7 @@ agentProc(jvmtiEnv * jvmti, JNIEnv * jni, void * arg) { } check_jvmti_status(jni, err, "Error in GetVirtualThread"); - if (testedThread == NULL) { + if (testedThread == nullptr) { testedThread = threads[i]; continue; } @@ -205,7 +205,7 @@ VirtualThreadEnd(jvmtiEnv *jvmti, JNIEnv *jni, jthread vthread) { JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv * jvmti = NULL; + jvmtiEnv * jvmti = nullptr; jvmtiEventCallbacks callbacks; jvmtiCapabilities caps; @@ -213,7 +213,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -250,19 +250,19 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { if (err != JVMTI_ERROR_NONE) { return JNI_ERR; } - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL); - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL); - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, NULL); - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_END, NULL); - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VIRTUAL_THREAD_START, NULL); - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VIRTUAL_THREAD_END, NULL); + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, nullptr); + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, nullptr); + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, nullptr); + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_END, nullptr); + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VIRTUAL_THREAD_START, nullptr); + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VIRTUAL_THREAD_END, nullptr); err = init_agent_data(jvmti, &agent_data); if (err != JVMTI_ERROR_NONE) { return JNI_ERR; } - if (set_agent_proc(agentProc, NULL) != JNI_TRUE) { + if (set_agent_proc(agentProc, nullptr) != JNI_TRUE) { return JNI_ERR; } return JNI_OK; diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/GetAllThreads/allthr01/liballthr01.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/GetAllThreads/allthr01/liballthr01.cpp index 1b3079c6e30a..9d9275c524d6 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/thread/GetAllThreads/allthr01/liballthr01.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/GetAllThreads/allthr01/liballthr01.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ #include #include #include "jvmti.h" -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { @@ -93,7 +93,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti_env, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti_env == NULL) { + if (res != JNI_OK || jvmti_env == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -162,7 +162,7 @@ JNIEXPORT void Java_allthr01_startAgentThread(JNIEnv *jni) { RawMonitorLocker rml1 = RawMonitorLocker(jvmti_env, jni, starting_agent_thread_lock); jvmtiError err = jvmti_env->RunAgentThread(create_jthread(jni), - sys_thread, NULL,JVMTI_THREAD_NORM_PRIORITY); + sys_thread, nullptr,JVMTI_THREAD_NORM_PRIORITY); check_jvmti_status(jni, err, "Failed to run AgentThread"); rml1.wait(); LOG("Started Agent Thread\n"); diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/GetCurrentContendedMonitor/contmon01/libcontmon01.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/GetCurrentContendedMonitor/contmon01/libcontmon01.cpp index 4e9ef9a9c91b..992fb9a96cc4 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/thread/GetCurrentContendedMonitor/contmon01/libcontmon01.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/GetCurrentContendedMonitor/contmon01/libcontmon01.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,18 +24,18 @@ #include #include #include "jvmti.h" -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { jint res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } @@ -54,7 +54,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { JNIEXPORT void JNICALL Java_contmon01_checkMonitor(JNIEnv *jni, jclass cls, jint point, jthread thread, jobject lock) { - jobject monitor = NULL; + jobject monitor = nullptr; jvmtiError err = jvmti->GetCurrentContendedMonitor(thread, &monitor); if (err == JVMTI_ERROR_THREAD_NOT_ALIVE && point == 5) { diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/GetCurrentContendedMonitor/contmon02/libcontmon02.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/GetCurrentContendedMonitor/contmon02/libcontmon02.cpp index dbbc63c57cda..39190270a303 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/thread/GetCurrentContendedMonitor/contmon02/libcontmon02.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/GetCurrentContendedMonitor/contmon02/libcontmon02.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ #include #include #include "jvmti.h" -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { @@ -34,7 +34,7 @@ JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { jint res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } @@ -56,7 +56,7 @@ Java_contmon02_checkMonitor(JNIEnv *jni, jclass cls, jint point, jthread thread) jobject monitor; jvmtiError err = jvmti->GetCurrentContendedMonitor(thread, &monitor); check_jvmti_status(jni, err, "Error in GetCurrentContendedMonitor"); - if (monitor != NULL) { + if (monitor != nullptr) { LOG("(#%d) unexpected monitor object: 0x%p\n", point, monitor); fatal(jni, "GetCurrentContendedMonitor return unexpected monitor."); } diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/GetFrameCount/framecnt01/libframecnt01.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/GetFrameCount/framecnt01/libframecnt01.cpp index fc5319fa9c7d..ced257caef24 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/thread/GetFrameCount/framecnt01/libframecnt01.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/GetFrameCount/framecnt01/libframecnt01.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,11 +23,11 @@ #include #include "jvmti.h" -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { -static jvmtiEnv *jvmti_env = NULL; +static jvmtiEnv *jvmti_env = nullptr; JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { @@ -35,7 +35,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti_env, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti_env == NULL) { + if (res != JNI_OK || jvmti_env == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/GetFrameLocation/frameloc01/libframeloc01.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/GetFrameLocation/frameloc01/libframeloc01.cpp index bc4a81e8ab17..5922ee0400c2 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/thread/GetFrameLocation/frameloc01/libframeloc01.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/GetFrameLocation/frameloc01/libframeloc01.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,14 +24,14 @@ #include #include #include "jvmti.h" -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti_env = NULL; +static jvmtiEnv *jvmti_env = nullptr; static jint result = PASSED; static jmethodID mid1; @@ -40,7 +40,7 @@ static jmethodID mid1; jboolean checkFrame(jvmtiEnv *jvmti_env, JNIEnv *jni, jthread thr, jmethodID exp_mid, jlocation exp_loc, jlocation exp_loc_alternative, jboolean mustPass) { jvmtiError err; - jmethodID mid = NULL; + jmethodID mid = nullptr; jlocation loc = -1; char *meth, *sig, *generic; jboolean isOk = JNI_FALSE; @@ -88,7 +88,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res = jvm->GetEnv((void **) &jvmti_env, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti_env == NULL) { + if (res != JNI_OK || jvmti_env == nullptr) { LOG("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } @@ -115,13 +115,13 @@ JNIEXPORT void JNICALL Java_frameloc01_getReady(JNIEnv *jni, jclass cls, jclass klass) { jvmtiError err; mid1 = jni->GetMethodID(klass, "meth01", "(I)V"); - if (mid1 == NULL) { + if (mid1 == nullptr) { LOG("Cannot get jmethodID for method \"meth01\"\n"); result = STATUS_FAILED; return; } - err = jvmti_env->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_EXCEPTION_CATCH, NULL); + err = jvmti_env->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_EXCEPTION_CATCH, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("(SetEventNotificationMode) unexpected error: %s (%d)\n", TranslateError(err), err); result = STATUS_FAILED; @@ -134,7 +134,7 @@ Java_frameloc01_checkFrame01(JNIEnv *jni, jclass cls, jthread thr, jclass klass, jboolean isOk = JNI_FALSE; mid = jni->GetMethodID(klass, "run", "()V"); - if (mid == NULL) { + if (mid == nullptr) { LOG("Cannot get jmethodID for method \"run\"\n"); result = STATUS_FAILED; return JNI_TRUE; diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/GetFrameLocation/frameloc02/libframeloc02.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/GetFrameLocation/frameloc02/libframeloc02.cpp index 46724b12e9fb..4fd96984a7b0 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/thread/GetFrameLocation/frameloc02/libframeloc02.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/GetFrameLocation/frameloc02/libframeloc02.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ #include #include #include "jvmti.h" -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { @@ -38,7 +38,7 @@ typedef struct { jlocation loc; } frame_info; -static jvmtiEnv *jvmti_env = NULL; +static jvmtiEnv *jvmti_env = nullptr; static jint result = PASSED; static frame_info fi = {"Lframeloc02;", "check", @@ -47,7 +47,7 @@ static frame_info fi = JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { jint res = jvm->GetEnv((void **) &jvmti_env, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti_env == NULL) { + if (res != JNI_OK || jvmti_env == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -98,17 +98,17 @@ Java_frameloc02_check(JNIEnv *env, jclass cls, jthread thr) { LOG(">>> method: \"%s%s\"\n", name, sig); LOG(">>> location: %s\n", jlong_to_string(loc, buffer)); - if (cls_sig == NULL || strcmp(cls_sig, fi.cls_sig) != 0) { + if (cls_sig == nullptr || strcmp(cls_sig, fi.cls_sig) != 0) { LOG("(GetFrameLocation) wrong class: \"%s\"\n", cls_sig); LOG(", expected: \"%s\"\n", fi.cls_sig); result = STATUS_FAILED; } - if (name == NULL || strcmp(name, fi.name) != 0) { + if (name == nullptr || strcmp(name, fi.name) != 0) { LOG("(GetFrameLocation) wrong method name: \"%s\"", name); LOG(", expected: \"%s\"\n", fi.name); result = STATUS_FAILED; } - if (sig == NULL || strcmp(sig, fi.sig) != 0) { + if (sig == nullptr || strcmp(sig, fi.sig) != 0) { LOG("(GetFrameLocation) wrong method signature: \"%s\"", sig); LOG(", expected: \"%s\"\n", fi.sig); result = STATUS_FAILED; diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/GetStackTraceAndRetransformTest/libGetStackTraceAndRetransformTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/GetStackTraceAndRetransformTest/libGetStackTraceAndRetransformTest.cpp index 3be6dcf824f8..3e7b2fa950d1 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/GetStackTraceAndRetransformTest/libGetStackTraceAndRetransformTest.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/GetStackTraceAndRetransformTest/libGetStackTraceAndRetransformTest.cpp @@ -1,4 +1,5 @@ /* + * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2023, Datadog, Inc. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -24,20 +25,20 @@ #include #include #include "jvmti.h" -#include "jvmti_common.h" -#include "../get_stack_trace.h" +#include "jvmti_common.hpp" +#include "../get_stack_trace.hpp" extern "C" { -static jvmtiEnv *jvmti = NULL; -static jmethodID* ids = NULL; +static jvmtiEnv *jvmti = nullptr; +static jmethodID* ids = nullptr; static int ids_size = 0; JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { jint res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -71,11 +72,11 @@ Java_GetStackTraceAndRetransformTest_check(JNIEnv *jni, jclass cls, jint expecte exit(2); } for (int i = 0; i < ids_size; i++) { - jclass rslt = NULL; - char* class_name = NULL; + jclass rslt = nullptr; + char* class_name = nullptr; jvmti->GetMethodDeclaringClass(ids[i], &rslt); - if (rslt != NULL) { - jvmti->GetClassSignature(rslt, &class_name, NULL); + if (rslt != nullptr) { + jvmti->GetClassSignature(rslt, &class_name, nullptr); } } } diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/GetStackTraceCurrentThreadTest/libGetStackTraceCurrentThreadTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/GetStackTraceCurrentThreadTest/libGetStackTraceCurrentThreadTest.cpp index deb494dd0aae..d58c952fe84a 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/GetStackTraceCurrentThreadTest/libGetStackTraceCurrentThreadTest.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/GetStackTraceCurrentThreadTest/libGetStackTraceCurrentThreadTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,13 +24,13 @@ #include #include #include "jvmti.h" -#include "jvmti_common.h" -#include "../get_stack_trace.h" +#include "jvmti_common.hpp" +#include "../get_stack_trace.hpp" extern "C" { -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static frame_info expected_virtual_frames[] = { {"LGetStackTraceCurrentThreadTest;", "check", "(Ljava/lang/Thread;)V"}, {"LGetStackTraceCurrentThreadTest;", "dummy", "()V"}, @@ -52,7 +52,7 @@ static frame_info expected_platform_frames[] = { JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { jint res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/get_stack_trace.h b/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/get_stack_trace.hpp similarity index 90% rename from test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/get_stack_trace.h rename to test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/get_stack_trace.hpp index 788d3dd123c9..d7c85704275f 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/get_stack_trace.h +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/get_stack_trace.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,8 +21,8 @@ * questions. */ -#ifndef GET_STACK_TRACE_H -#define GET_STACK_TRACE_H +#ifndef GET_STACK_TRACE_HPP +#define GET_STACK_TRACE_HPP #include "jvmti.h" typedef struct { @@ -81,18 +81,18 @@ int compare_stack_trace(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, lambda_idx = lambda - expected_frames[exp_idx].cls; printf("Comparing only first %zu chars in classname.\n", lambda_idx); } - if (class_signature == NULL || strncmp(class_signature, expected_frames[exp_idx].cls, lambda_idx) != 0) { + if (class_signature == nullptr || strncmp(class_signature, expected_frames[exp_idx].cls, lambda_idx) != 0) { printf("(frame#%d) wrong class sig: \"%s\", expected: \"%s\"\n", exp_idx, class_signature, expected_frames[exp_idx].cls); result = JNI_FALSE; } - if (name == NULL || strcmp(name, expected_frames[exp_idx].name) != 0) { + if (name == nullptr || strcmp(name, expected_frames[exp_idx].name) != 0) { printf("(frame#%d) wrong method name: \"%s\", expected: \"%s\"\n", exp_idx, name, expected_frames[exp_idx].name); result = JNI_FALSE; } - if (sig == NULL || strcmp(sig, expected_frames[exp_idx].sig) != 0) { + if (sig == nullptr || strcmp(sig, expected_frames[exp_idx].sig) != 0) { printf("(frame#%d) wrong method sig: \"%s\", expected: \"%s\"\n", exp_idx, sig, expected_frames[exp_idx].sig); result = JNI_FALSE; @@ -103,4 +103,4 @@ int compare_stack_trace(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, } -#endif //GET_STACK_TRACE_H +#endif //GET_STACK_TRACE_HPP diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr03/libgetstacktr03.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr03/libgetstacktr03.cpp index dc4d75be86f6..78224f7f12e2 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr03/libgetstacktr03.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr03/libgetstacktr03.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,12 +24,12 @@ #include #include #include "jvmti.h" -#include "jvmti_common.h" -#include "../get_stack_trace.h" +#include "jvmti_common.hpp" +#include "../get_stack_trace.hpp" extern "C" { -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static frame_info expected_platform_frames[] = { {"Ljava/lang/Object;", "wait", "()V"}, {"Lgetstacktr03;", "dummy", "()V"}, @@ -55,7 +55,7 @@ JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr04/libgetstacktr04.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr04/libgetstacktr04.cpp index 873522ab531c..3a7bb8b1f06a 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr04/libgetstacktr04.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr04/libgetstacktr04.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,12 +24,12 @@ #include #include #include "jvmti.h" -#include "jvmti_common.h" -#include "../get_stack_trace.h" +#include "jvmti_common.hpp" +#include "../get_stack_trace.hpp" extern "C" { -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jmethodID mid; static frame_info expected_platform_frames[] = { {"Lgetstacktr04$TestThread;", "checkPoint", "()V"}, @@ -80,7 +80,7 @@ JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -108,12 +108,12 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { JNIEXPORT void JNICALL Java_getstacktr04_getReady(JNIEnv *jni, jclass cls, jclass clazz) { mid = jni->GetMethodID(clazz, "checkPoint", "()V"); - if (mid == NULL) { + if (mid == nullptr) { jni->FatalError("Cannot find Method ID for method checkPoint\n"); } check_jvmti_status(jni, jvmti->SetBreakpoint(mid, 0), "SetBreakpoint failed."); - set_event_notification_mode(jvmti, jni, JVMTI_ENABLE,JVMTI_EVENT_BREAKPOINT, NULL); + set_event_notification_mode(jvmti, jni, JVMTI_ENABLE,JVMTI_EVENT_BREAKPOINT, nullptr); } } diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr05/libgetstacktr05.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr05/libgetstacktr05.cpp index 0cb2992b646a..094fc6a64c78 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr05/libgetstacktr05.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr05/libgetstacktr05.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,12 +24,12 @@ #include #include #include "jvmti.h" -#include "jvmti_common.h" -#include "../get_stack_trace.h" +#include "jvmti_common.hpp" +#include "../get_stack_trace.hpp" extern "C" { -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; static jmethodID mid; @@ -102,7 +102,7 @@ JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -132,11 +132,11 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { JNIEXPORT void JNICALL Java_getstacktr05_getReady(JNIEnv *jni, jclass cls, jclass clazz) { mid = jni->GetMethodID(clazz, "checkPoint", "()V"); - if (mid == NULL) { + if (mid == nullptr) { jni->FatalError("Cannot find Method ID for method checkPoint\n"); } check_jvmti_status(jni, jvmti->SetBreakpoint(mid, 0), "SetBreakpoint failed."); - set_event_notification_mode(jvmti, jni, JVMTI_ENABLE,JVMTI_EVENT_BREAKPOINT, NULL); + set_event_notification_mode(jvmti, jni, JVMTI_ENABLE,JVMTI_EVENT_BREAKPOINT, nullptr); } } diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr06/libgetstacktr06.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr06/libgetstacktr06.cpp index 0fd52c697f4d..7b687b03ea9e 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr06/libgetstacktr06.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr06/libgetstacktr06.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "jvmti_common.h" -#include "../get_stack_trace.h" +#include "jvmti_common.hpp" +#include "../get_stack_trace.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; static jmethodID mid; @@ -67,7 +67,7 @@ void JNICALL Breakpoint(jvmtiEnv *jvmti_env, JNIEnv *jni, jthread thr, jmethodID } check_jvmti_status(jni, jvmti->ClearBreakpoint(mid, 0), "ClearBreakpoint failed."); - set_event_notification_mode(jvmti, jni, JVMTI_DISABLE,JVMTI_EVENT_BREAKPOINT, NULL); + set_event_notification_mode(jvmti, jni, JVMTI_DISABLE,JVMTI_EVENT_BREAKPOINT, nullptr); set_event_notification_mode(jvmti, jni, JVMTI_ENABLE, JVMTI_EVENT_SINGLE_STEP, thr); LOG(">>> popping frame ...\n"); @@ -92,7 +92,7 @@ JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -128,12 +128,12 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { JNIEXPORT void JNICALL Java_getstacktr06_getReady(JNIEnv *jni, jclass cls, jclass clazz) { mid = jni->GetMethodID(clazz, "checkPoint", "()V"); - if (mid == NULL) { + if (mid == nullptr) { jni->FatalError("Cannot find Method ID for method checkPoint\n"); } check_jvmti_status(jni, jvmti->SetBreakpoint(mid, 0), "SetBreakpoint failed."); - set_event_notification_mode(jvmti, jni, JVMTI_ENABLE,JVMTI_EVENT_BREAKPOINT, NULL); + set_event_notification_mode(jvmti, jni, JVMTI_ENABLE,JVMTI_EVENT_BREAKPOINT, nullptr); } diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr07/libgetstacktr07.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr07/libgetstacktr07.cpp index a422fc0782f1..b7f383ed232e 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr07/libgetstacktr07.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr07/libgetstacktr07.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,15 +24,15 @@ #include #include #include "jvmti.h" -#include "jvmti_common.h" -#include "../get_stack_trace.h" +#include "jvmti_common.hpp" +#include "../get_stack_trace.hpp" extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; static jint result = PASSED; @@ -73,7 +73,7 @@ void JNICALL Breakpoint(jvmtiEnv *jvmti_env, JNIEnv *jni, jthread thread, jmetho jni->FatalError("ERROR: don't know where we get called from"); } - if (classBytes == NULL) { + if (classBytes == nullptr) { jni->FatalError("ERROR: don't have any bytes"); } @@ -83,11 +83,11 @@ void JNICALL Breakpoint(jvmtiEnv *jvmti_env, JNIEnv *jni, jthread thread, jmetho class_def.klass = klass; class_def.class_byte_count = jni->GetArrayLength(classBytes); - class_def.class_bytes = (unsigned char *) jni->GetByteArrayElements(classBytes, NULL); + class_def.class_bytes = (unsigned char *) jni->GetByteArrayElements(classBytes, nullptr); check_jvmti_status(jni, jvmti->RedefineClasses(1, &class_def), "RedefineClasses failed."); jni->DeleteGlobalRef(classBytes); - classBytes = NULL; + classBytes = nullptr; frame_info *expected_frames = jni->IsVirtualThread(thread) ? expected_virtual_frames @@ -105,7 +105,7 @@ JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -137,12 +137,12 @@ Java_getstacktr07_getReady(JNIEnv *jni, jclass cls, jclass clazz, jbyteArray byt classBytes = (jbyteArray) jni->NewGlobalRef(bytes); mid = jni->GetMethodID(clazz, "checkPoint", "()V"); - if (mid == NULL) { + if (mid == nullptr) { jni->FatalError("Cannot find Method ID for method checkPoint\n"); } check_jvmti_status(jni, jvmti->SetBreakpoint(mid, 0), "SetBreakpoint failed."); - set_event_notification_mode(jvmti, jni, JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL); + set_event_notification_mode(jvmti, jni, JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, nullptr); } diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr08/libgetstacktr08.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr08/libgetstacktr08.cpp index 977bbf00b040..2543d1ceaf22 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr08/libgetstacktr08.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/GetStackTrace/getstacktr08/libgetstacktr08.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,13 +24,13 @@ #include #include #include "jvmti.h" -#include "jvmti_common.h" -#include "../get_stack_trace.h" +#include "jvmti_common.hpp" +#include "../get_stack_trace.hpp" extern "C" { -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jboolean wasFramePop = JNI_FALSE; static jmethodID mid_checkPoint, mid_chain4; @@ -116,7 +116,7 @@ void JNICALL SingleStep(jvmtiEnv *jvmti_env, JNIEnv *jni, } - if (classBytes == NULL) { + if (classBytes == nullptr) { jni->FatalError("ERROR: don't have any bytes"); } @@ -125,11 +125,11 @@ void JNICALL SingleStep(jvmtiEnv *jvmti_env, JNIEnv *jni, classDef.klass = klass; classDef.class_byte_count = jni->GetArrayLength(classBytes); - classDef.class_bytes = (unsigned char *) jni->GetByteArrayElements(classBytes, NULL); + classDef.class_bytes = (unsigned char *) jni->GetByteArrayElements(classBytes, nullptr); check_jvmti_status(jni, jvmti_env->RedefineClasses(1, &classDef), "RedefineClasses failed."); jni->DeleteGlobalRef(classBytes); - classBytes = NULL; + classBytes = nullptr; if (!compare_stack_trace(jvmti_env, jni, thread, 2)) { jni->ThrowNew(jni->FindClass("java/lang/RuntimeException"), "Stacktrace differs from expected."); } @@ -140,7 +140,7 @@ JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -176,12 +176,12 @@ Java_getstacktr08_getReady(JNIEnv *jni, jclass cls, jclass clazz, jbyteArray byt mid_chain4 = jni->GetStaticMethodID(clazz, "chain4", "()V"); check_jvmti_status(jni, jvmti->SetBreakpoint(mid_checkPoint, 0), "SetBreakpoint failed."); - set_event_notification_mode(jvmti, jni, JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL); + set_event_notification_mode(jvmti, jni, JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, nullptr); } JNIEXPORT void JNICALL Java_getstacktr08_nativeChain(JNIEnv *jni, jclass cls, jclass clazz) { - if (mid_chain4 != NULL) { + if (mid_chain4 != nullptr) { jni->CallStaticVoidMethod(clazz, mid_chain4); } if (!compare_stack_trace(jvmti, jni, get_current_thread(jvmti, jni), 3)) { diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/GetThreadInfo/thrinfo01/libthrinfo01.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/GetThreadInfo/thrinfo01/libthrinfo01.cpp index 53f10cb7d5c8..1695071929de 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/thread/GetThreadInfo/thrinfo01/libthrinfo01.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/GetThreadInfo/thrinfo01/libthrinfo01.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ #include #include #include "jvmti.h" -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { @@ -35,7 +35,7 @@ typedef struct { jboolean is_daemon; } info; -static jvmtiEnv *jvmti_env = NULL; +static jvmtiEnv *jvmti_env = nullptr; static info expected_info_array[] = { {"main", JNI_TRUE,JVMTI_THREAD_NORM_PRIORITY, JNI_FALSE}, {"thread1",JNI_TRUE,JVMTI_THREAD_MIN_PRIORITY + 2, JNI_TRUE}, @@ -49,7 +49,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { jvmtiCapabilities caps; res = jvm->GetEnv((void **) &jvmti_env, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti_env == NULL) { + if (res != JNI_OK || jvmti_env == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -75,8 +75,8 @@ Java_thrinfo01_checkInfo0(JNIEnv *jni, jclass cls, jthread thread, jthreadGroup info expected_info = expected_info_array[expected_idx]; check_jvmti_status(jni, jvmti_env->GetThreadInfo(thread, &inf), "Error in GetThreadInfo."); - if (inf.name == NULL) { - LOG("Thread %s: incorrect name in NULL\n", expected_info.name); + if (inf.name == nullptr) { + LOG("Thread %s: incorrect name in null\n", expected_info.name); result = JNI_FALSE; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/GetThreadState/thrstat01/libthrstat01.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/GetThreadState/thrstat01/libthrstat01.cpp index 825ac1ffd750..41f9b2a8d662 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/thread/GetThreadState/thrstat01/libthrstat01.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/GetThreadState/thrstat01/libthrstat01.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,18 +24,18 @@ #include #include #include "jvmti.h" -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { #define WAIT_START 100 #define WAIT_TIME (2*60*1000) -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jrawMonitorID access_lock; static jrawMonitorID wait_lock; -static jthread tested_thread_thr1 = NULL; +static jthread tested_thread_thr1 = nullptr; static jint state[] = { JVMTI_THREAD_STATE_RUNNABLE, @@ -45,9 +45,9 @@ static jint state[] = { void JNICALL VMInit(jvmtiEnv *jvmti_env, JNIEnv *jni, jthread thr) { - jvmtiError err = jvmti_env->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, NULL); + jvmtiError err = jvmti_env->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, nullptr); check_jvmti_status(jni, err, "Error in SetEventNotificationMode"); - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VIRTUAL_THREAD_START, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VIRTUAL_THREAD_START, nullptr); check_jvmti_status(jni, err, "Error in SetEventNotificationMode"); } @@ -58,7 +58,7 @@ ThreadStart(jvmtiEnv *jvmti_env, JNIEnv *jni, jthread thread) { jvmtiThreadInfo thread_info = get_thread_info(jvmti, jni, thread); LOG(">>> ThreadStart: \"%s\"\n", thread_info.name); - if (thread_info.name != NULL && strcmp(thread_info.name, "tested_thread_thr1") == 0) { + if (thread_info.name != nullptr && strcmp(thread_info.name, "tested_thread_thr1") == 0) { tested_thread_thr1 = jni->NewGlobalRef(thread); LOG(">>> ThreadStart: \"%s\", 0x%p\n", thread_info.name, tested_thread_thr1); } @@ -72,7 +72,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { LOG("Agent_OnLoad started\n"); res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -101,7 +101,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("(SetEventNotificationMode) unexpected error: %s (%d)\n", TranslateError(err), err); return JNI_ERR; @@ -117,7 +117,7 @@ Java_thrstat01_checkStatus0(JNIEnv *jni, jclass cls, jint stat_ind) { LOG("native method checkStatus started\n"); - if (tested_thread_thr1 == NULL) { + if (tested_thread_thr1 == nullptr) { LOG("Missing thread \"tested_thread_thr1\" start event\n"); return JNI_FALSE; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/GetThreadState/thrstat02/libthrstat02.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/GetThreadState/thrstat02/libthrstat02.cpp index 0de51f8e5cff..3f12a04e82df 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/thread/GetThreadState/thrstat02/libthrstat02.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/GetThreadState/thrstat02/libthrstat02.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,15 +24,15 @@ #include #include #include "jvmti.h" -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { #define WAIT_START 100 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jrawMonitorID access_lock, wait_lock; -static jthread thr_ptr = NULL; +static jthread thr_ptr = nullptr; static jint wait_time = 0; static jint state[] = { JVMTI_THREAD_STATE_RUNNABLE, @@ -55,7 +55,7 @@ void printStateFlags(jint flags) { void JNICALL VMInit(jvmtiEnv *jvmti_env, JNIEnv *jni, jthread thr) { - jvmtiError err = jvmti_env->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, NULL); + jvmtiError err = jvmti_env->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, nullptr); check_jvmti_status(jni, err, "Failed to enable THREAD_START event"); } @@ -63,7 +63,7 @@ void JNICALL ThreadStart(jvmtiEnv *jvmti_env, JNIEnv *jni, jthread thread) { RawMonitorLocker rml = RawMonitorLocker(jvmti, jni, access_lock); jvmtiThreadInfo thread_info = get_thread_info(jvmti_env, jni, thread); - if (thread_info.name != NULL && strcmp(thread_info.name, "tested_thread_thr1") == 0) { + if (thread_info.name != nullptr && strcmp(thread_info.name, "tested_thread_thr1") == 0) { thr_ptr = jni->NewGlobalRef(thread); LOG(">>> ThreadStart: \"%s\", 0x%p\n", thread_info.name, thr_ptr); } @@ -77,7 +77,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -103,7 +103,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("Failed to enable VM_INIT event: %s (%d)\n", TranslateError(err), err); return JNI_ERR; @@ -135,12 +135,12 @@ Java_thrstat02_checkStatus0(JNIEnv *jni, jclass cls, jint statInd, jboolean susp jboolean timeout_is_reached; unsigned int waited_millis; - if (jvmti == NULL) { + if (jvmti == nullptr) { LOG("JVMTI client was not properly loaded!\n"); return JNI_FALSE; } - if (thr_ptr == NULL) { + if (thr_ptr == nullptr) { LOG("Missing thread \"tested_thread_thr1\" start event\n"); return JNI_FALSE; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/GetThreadState/thrstat03/libthrstat03.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/GetThreadState/thrstat03/libthrstat03.cpp index 632d4136e35c..817ae62cc8b8 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/thread/GetThreadState/thrstat03/libthrstat03.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/GetThreadState/thrstat03/libthrstat03.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,13 +24,13 @@ #include #include #include "jvmti.h" -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { #define WAIT_START 100 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint wait_time = 0; static jint state[] = { 0, /* JVMTI_THREAD_STATUS_NOT_STARTED, */ @@ -46,7 +46,7 @@ Java_thrstat03_init(JNIEnv *env, jclass cls, jint waitTime) { JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { jint res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -59,7 +59,7 @@ Java_thrstat03_check(JNIEnv *jni, jclass cls, jthread thread, jint statInd) { jrawMonitorID wait_lock; jint thr_state = 0; - if (jvmti == NULL) { + if (jvmti == nullptr) { LOG("JVMTI client was not properly loaded!\n"); return JNI_FALSE; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/GetThreadState/thrstat05/libthrstat05.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/GetThreadState/thrstat05/libthrstat05.cpp index e96dd665f590..fef814a0a7db 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/thread/GetThreadState/thrstat05/libthrstat05.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/GetThreadState/thrstat05/libthrstat05.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,7 @@ #include #include "jvmti.h" -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { @@ -66,7 +66,7 @@ static int g_ThreadState[] = { | JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT, /* TS_RUN_WAIT_SLEEPING */ }; -static jvmtiEnv *jvmti_env = NULL; +static jvmtiEnv *jvmti_env = nullptr; static int g_wait_time = 1000; jrawMonitorID wait_lock; /* Monitor is used just for sleeping */ @@ -75,7 +75,7 @@ JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { jint res = jvm->GetEnv((void **) &jvmti_env, JVMTI_VERSION_1_1); if (res != JNI_OK || !jvmti_env) { - LOG("Agent_OnLoad: Error: GetEnv returned error or NULL\n"); + LOG("Agent_OnLoad: Error: GetEnv returned error or null\n"); return JNI_ERR; } wait_lock = create_raw_monitor(jvmti_env, "beast"); diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/ResumeThread/resumethrd01/libresumethrd01.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/ResumeThread/resumethrd01/libresumethrd01.cpp index 3e07b2aee4c6..37d52e43d077 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/thread/ResumeThread/resumethrd01/libresumethrd01.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/ResumeThread/resumethrd01/libresumethrd01.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,8 @@ #include #include "jvmti.h" -#include "jvmti_common.h" -#include "jvmti_thread.h" +#include "jvmti_common.hpp" +#include "jvmti_thread.hpp" extern "C" { @@ -48,11 +48,11 @@ agentProc(jvmtiEnv *jvmti, JNIEnv *jni, void *arg) { /* perform testing */ { - jthread testedThread = NULL; + jthread testedThread = nullptr; LOG("Find thread: %s\n", THREAD_NAME); testedThread = find_thread_by_name(jvmti, jni, THREAD_NAME); - if (testedThread == NULL) { + if (testedThread == nullptr) { return; } LOG(" ... found thread: %p\n", (void *) testedThread); @@ -100,13 +100,13 @@ agentProc(jvmtiEnv *jvmti, JNIEnv *jni, void *arg) { JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv *jvmti = NULL; + jvmtiEnv *jvmti = nullptr; timeout = 60 * 1000; LOG("Agent_OnLoad started\n"); jint res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_9); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -122,7 +122,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!set_agent_proc(agentProc, NULL)) { + if (!set_agent_proc(agentProc, nullptr)) { return JNI_ERR; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/ResumeThread/resumethrd02/libresumethrd02.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/ResumeThread/resumethrd02/libresumethrd02.cpp index c9de5e4ee0d3..83ced2ded6a4 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/thread/ResumeThread/resumethrd02/libresumethrd02.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/ResumeThread/resumethrd02/libresumethrd02.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,8 @@ #include #include "jvmti.h" -#include "jvmti_common.h" -#include "jvmti_thread.h" +#include "jvmti_common.hpp" +#include "jvmti_thread.hpp" extern "C" { @@ -43,7 +43,7 @@ static jvmtiEvent eventsList[EVENTS_COUNT] = { }; static volatile int eventsReceived = 0; -static jthread testedThread = NULL; +static jthread testedThread = nullptr; /* ============================================================================= */ @@ -59,14 +59,14 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { { LOG("Find thread: %s\n", THREAD_NAME); testedThread = find_thread_by_name(jvmti, jni,THREAD_NAME); - if (testedThread == NULL) { + if (testedThread == nullptr) { return; } LOG(" ... found thread: %p\n", (void*)testedThread); eventsReceived = 0; LOG("Enable event: %s\n", "THREAD_END"); - enable_events_notifications(jvmti, jni, JVMTI_ENABLE, EVENTS_COUNT, eventsList, NULL); + enable_events_notifications(jvmti, jni, JVMTI_ENABLE, EVENTS_COUNT, eventsList, nullptr); LOG("Suspend thread: %p\n", (void*)testedThread); jvmtiError err = jvmti->SuspendThread(testedThread); @@ -102,7 +102,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } LOG("Disable event: %s\n", "THREAD_END"); - enable_events_notifications(jvmti, jni,JVMTI_DISABLE, EVENTS_COUNT, eventsList, NULL); + enable_events_notifications(jvmti, jni,JVMTI_DISABLE, EVENTS_COUNT, eventsList, nullptr); LOG("Wait for thread to finish\n"); if (!agent_wait_for_sync(timeout)) @@ -123,7 +123,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { JNIEXPORT void JNICALL callbackThreadEnd(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { /* check if event is for tested thread */ - if (thread != NULL && jni->IsSameObject(testedThread, thread)) { + if (thread != nullptr && jni->IsSameObject(testedThread, thread)) { LOG(" ... received THREAD_END event for tested thread: %p\n", (void*)thread); eventsReceived++; } else { @@ -136,12 +136,12 @@ callbackThreadEnd(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { /** Agent library initialization. */ JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; timeout = 60 * 1000; jint res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_9); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -173,7 +173,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { } /* register agent proc and arg */ - if (!set_agent_proc(agentProc, NULL)) { + if (!set_agent_proc(agentProc, nullptr)) { return JNI_ERR; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/ResumeThreadList/resumethrdlst01/libresumethrdlst01.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/ResumeThreadList/resumethrdlst01/libresumethrdlst01.cpp index 5784ae799789..cc1708340a6e 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/thread/ResumeThreadList/resumethrdlst01/libresumethrdlst01.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/ResumeThreadList/resumethrdlst01/libresumethrdlst01.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,8 @@ #include #include "jvmti.h" -#include "jvmti_common.h" -#include "jvmti_thread.h" +#include "jvmti_common.hpp" +#include "jvmti_thread.hpp" @@ -52,8 +52,8 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { /* perform testing */ { - jthread* threads = NULL; - jvmtiError* results = NULL; + jthread* threads = nullptr; + jvmtiError* results = nullptr; LOG("Allocate threads array: %d threads\n", THREADS_COUNT); check_jvmti_status(jni, jvmti->Allocate((THREADS_COUNT * sizeof(jthread)), (unsigned char**)&threads), ""); @@ -123,7 +123,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { LOG("Delete threads references\n"); for (int i = 0; i < THREADS_COUNT; i++) { - if (threads[i] != NULL) + if (threads[i] != nullptr) jni->DeleteGlobalRef(threads[i]); } @@ -143,13 +143,13 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { static int find_threads_by_name(jvmtiEnv* jvmti, JNIEnv* jni, const char name[], int foundCount, jthread foundThreads[]) { jint count = 0; - jthread* threads = NULL; + jthread* threads = nullptr; size_t len = strlen(name); int found = 0; for (int i = 0; i < foundCount; i++) { - foundThreads[i] = NULL; + foundThreads[i] = nullptr; } check_jvmti_status(jni, jvmti->GetAllThreads(&count, &threads), "Error in GetAllThreads"); @@ -159,7 +159,7 @@ static int find_threads_by_name(jvmtiEnv* jvmti, JNIEnv* jni, jvmtiThreadInfo info; check_jvmti_status(jni, jvmti->GetThreadInfo(threads[i], &info), ""); - if (info.name != NULL && strncmp(name, info.name, len) == 0) { + if (info.name != nullptr && strncmp(name, info.name, len) == 0) { LOG(" ... found thread #%d: %p (%s)\n", found, threads[i], info.name); if (found < foundCount) foundThreads[found] = threads[i]; @@ -182,7 +182,7 @@ static int find_threads_by_name(jvmtiEnv* jvmti, JNIEnv* jni, LOG("Make global references for threads: %d threads\n", foundCount); for (int i = 0; i < foundCount; i++) { foundThreads[i] = (jthread) jni->NewGlobalRef(foundThreads[i]); - if ( foundThreads[i] == NULL) { + if ( foundThreads[i] == nullptr) { set_agent_fail_status(); return JNI_FALSE; } @@ -194,12 +194,12 @@ static int find_threads_by_name(jvmtiEnv* jvmti, JNIEnv* jni, JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; timeout = 60 * 1000; jint res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_9); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -219,7 +219,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { } /* register agent proc and arg */ - if (!set_agent_proc(agentProc, NULL)) { + if (!set_agent_proc(agentProc, nullptr)) { return JNI_ERR; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/ResumeThreadList/resumethrdlst02/libresumethrdlst02.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/ResumeThreadList/resumethrdlst02/libresumethrdlst02.cpp index 8345a56d352e..91a0dc79175c 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/thread/ResumeThreadList/resumethrdlst02/libresumethrdlst02.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/ResumeThreadList/resumethrdlst02/libresumethrdlst02.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,8 @@ #include #include "jvmti.h" -#include "jvmti_common.h" -#include "jvmti_thread.h" +#include "jvmti_common.hpp" +#include "jvmti_thread.hpp" @@ -47,7 +47,7 @@ static jvmtiEvent eventsList[EVENTS_COUNT] = { }; static const int THREADS_COUNT = 10; -static jthread* threads = NULL; +static jthread* threads = nullptr; static volatile int eventsReceived = 0; static jrawMonitorID eventsReceivedMtx = 0; @@ -65,7 +65,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { /* perform testing */ { - jvmtiError* results = NULL; + jvmtiError* results = nullptr; LOG("Allocate threads array: %d threads\n", THREADS_COUNT); check_jvmti_status(jni, jvmti->Allocate((THREADS_COUNT * sizeof(jthread)), (unsigned char**)&threads), ""); @@ -98,7 +98,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { eventsReceived = 0; LOG("Enable event: %s\n", "THREAD_END"); - enable_events_notifications(jvmti, jni,JVMTI_ENABLE, EVENTS_COUNT, eventsList, NULL); + enable_events_notifications(jvmti, jni,JVMTI_ENABLE, EVENTS_COUNT, eventsList, nullptr); LOG("Let threads to run and finish\n"); if (!agent_resume_sync()) @@ -136,7 +136,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } LOG("Disable event: %s\n", "THREAD_END"); - enable_events_notifications(jvmti, jni, JVMTI_DISABLE, EVENTS_COUNT, eventsList, NULL); + enable_events_notifications(jvmti, jni, JVMTI_DISABLE, EVENTS_COUNT, eventsList, nullptr); LOG("Wait for thread to finish\n"); if (!agent_wait_for_sync(timeout)) @@ -144,7 +144,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { LOG("Delete threads references\n"); for (int i = 0; i < THREADS_COUNT; i++) { - if (threads[i] != NULL) + if (threads[i] != nullptr) jni->DeleteGlobalRef(threads[i]); } @@ -164,13 +164,13 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { static int find_threads_by_name(jvmtiEnv* jvmti, JNIEnv* jni, const char name[], int foundCount, jthread foundThreads[]) { jint count = 0; - jthread* threads = NULL; + jthread* threads = nullptr; size_t len = strlen(name); int found = 0; for (int i = 0; i < foundCount; i++) { - foundThreads[i] = NULL; + foundThreads[i] = nullptr; } check_jvmti_status(jni, jvmti->GetAllThreads(&count, &threads), "Error in GetAllThreads"); @@ -180,7 +180,7 @@ static int find_threads_by_name(jvmtiEnv* jvmti, JNIEnv* jni, jvmtiThreadInfo info; check_jvmti_status(jni, jvmti->GetThreadInfo(threads[i], &info), ""); - if (info.name != NULL && strncmp(name, info.name, len) == 0) { + if (info.name != nullptr && strncmp(name, info.name, len) == 0) { LOG(" ... found thread #%d: %p (%s)\n", found, threads[i], info.name); if (found < foundCount) foundThreads[found] = threads[i]; @@ -203,7 +203,7 @@ static int find_threads_by_name(jvmtiEnv* jvmti, JNIEnv* jni, LOG("Make global references for threads: %d threads\n", foundCount); for (int i = 0; i < foundCount; i++) { foundThreads[i] = (jthread) jni->NewGlobalRef(foundThreads[i]); - if ( foundThreads[i] == NULL) { + if ( foundThreads[i] == nullptr) { set_agent_fail_status(); return JNI_FALSE; } @@ -221,7 +221,7 @@ callbackThreadEnd(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { /* check if event is for tested thread */ for (int i = 0; i < THREADS_COUNT; i++) { - if (thread != NULL && jni->IsSameObject(threads[i], thread)) { + if (thread != nullptr && jni->IsSameObject(threads[i], thread)) { LOG(" ... received THREAD_END event for thread #%d: %p\n", i, (void*)thread); eventsReceived++; jvmti->RawMonitorExit(eventsReceivedMtx); @@ -234,12 +234,12 @@ callbackThreadEnd(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; timeout = 60 * 1000; jint res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_9); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -273,7 +273,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { } /* register agent proc and arg */ - if (!set_agent_proc(agentProc, NULL)) { + if (!set_agent_proc(agentProc, nullptr)) { return JNI_ERR; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/SuspendThread/suspendthrd01/libsuspendthrd01.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/SuspendThread/suspendthrd01/libsuspendthrd01.cpp index 0df18a09f2dd..053023529cdc 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/thread/SuspendThread/suspendthrd01/libsuspendthrd01.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/SuspendThread/suspendthrd01/libsuspendthrd01.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,8 @@ #include #include "jvmti.h" -#include "jvmti_common.h" -#include "jvmti_thread.h" +#include "jvmti_common.hpp" +#include "jvmti_thread.hpp" extern "C" { @@ -50,7 +50,7 @@ agentProc(jvmtiEnv *jvmti, JNIEnv *jni, void *arg) { { LOG("Find thread: %s\n", THREAD_NAME); jthread tested_thread = find_thread_by_name(jvmti, jni, THREAD_NAME); - if (tested_thread == NULL) { + if (tested_thread == nullptr) { return; } LOG(" ... found thread: %p\n", (void *) tested_thread); @@ -97,12 +97,12 @@ agentProc(jvmtiEnv *jvmti, JNIEnv *jni, void *arg) { JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv *jvmti = NULL; + jvmtiEnv *jvmti = nullptr; timeout = 60 * 1000; jint res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_9); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -122,7 +122,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { } /* register agent proc and arg */ - if (!set_agent_proc(agentProc, NULL)) { + if (!set_agent_proc(agentProc, nullptr)) { return JNI_ERR; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/SuspendThread/suspendthrd02/libsuspendthrd02.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/SuspendThread/suspendthrd02/libsuspendthrd02.cpp index 9f3e59e6a888..0f8316f3c74d 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/thread/SuspendThread/suspendthrd02/libsuspendthrd02.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/SuspendThread/suspendthrd02/libsuspendthrd02.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,8 @@ #include #include "jvmti.h" -#include "jvmti_common.h" -#include "jvmti_thread.h" +#include "jvmti_common.hpp" +#include "jvmti_thread.hpp" extern "C" { @@ -46,7 +46,7 @@ static jvmtiEvent eventsList[EVENTS_COUNT] = { }; static volatile int eventsReceived = 0; -static jthread testedThread = NULL; +static jthread testedThread = nullptr; /** Agent algorithm. */ static void JNICALL @@ -61,14 +61,14 @@ agentProc(jvmtiEnv *jvmti, JNIEnv *jni, void *arg) { { LOG("Find thread: %s\n", THREAD_NAME); testedThread = find_thread_by_name(jvmti, jni, THREAD_NAME); - if (testedThread == NULL) { + if (testedThread == nullptr) { return; } LOG(" ... found thread: %p\n", (void *) testedThread); eventsReceived = 0; LOG("Enable event: %s\n", "THREAD_END"); - enable_events_notifications(jvmti, jni, JVMTI_ENABLE, EVENTS_COUNT, eventsList, NULL); + enable_events_notifications(jvmti, jni, JVMTI_ENABLE, EVENTS_COUNT, eventsList, nullptr); LOG("Suspend thread: %p\n", (void *) testedThread); err = jvmti->SuspendThread(testedThread); @@ -96,7 +96,7 @@ agentProc(jvmtiEnv *jvmti, JNIEnv *jni, void *arg) { } LOG("Disable event: %s\n", "THREAD_END"); - enable_events_notifications(jvmti, jni, JVMTI_DISABLE, EVENTS_COUNT, eventsList, NULL); + enable_events_notifications(jvmti, jni, JVMTI_DISABLE, EVENTS_COUNT, eventsList, nullptr); LOG("Resume thread: %p\n", (void *) testedThread); err = jvmti->ResumeThread(testedThread); @@ -122,7 +122,7 @@ agentProc(jvmtiEnv *jvmti, JNIEnv *jni, void *arg) { JNIEXPORT void JNICALL callbackThreadEnd(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread) { /* check if event is for tested thread */ - if (thread != NULL && jni->IsSameObject(testedThread, thread)) { + if (thread != nullptr && jni->IsSameObject(testedThread, thread)) { LOG(" ... received THREAD_END event for tested thread: %p\n", (void *) thread); eventsReceived++; } else { @@ -132,12 +132,12 @@ callbackThreadEnd(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread) { JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv *jvmti = NULL; + jvmtiEnv *jvmti = nullptr; timeout = 60 * 1000; jint res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_9); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -168,7 +168,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } /* register agent proc and arg */ - if (!set_agent_proc(agentProc, NULL)) { + if (!set_agent_proc(agentProc, nullptr)) { return JNI_ERR; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/SuspendThreadList/suspendthrdlst01/libsuspendthrdlst01.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/SuspendThreadList/suspendthrdlst01/libsuspendthrdlst01.cpp index 19bb8e0cadbc..70cfb81f10f5 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/thread/SuspendThreadList/suspendthrdlst01/libsuspendthrdlst01.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/SuspendThreadList/suspendthrdlst01/libsuspendthrdlst01.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,8 @@ #include #include "jvmti.h" -#include "jvmti_common.h" -#include "jvmti_thread.h" +#include "jvmti_common.hpp" +#include "jvmti_thread.hpp" extern "C" { @@ -54,8 +54,8 @@ agentProc(jvmtiEnv *jvmti, JNIEnv *jni, void *arg) { /* perform testing */ { - jthread *threads = NULL; - jvmtiError *results = NULL; + jthread *threads = nullptr; + jvmtiError *results = nullptr; LOG("Allocate threads array: %d threads\n", THREADS_COUNT); check_jvmti_status(jni, jvmti->Allocate((THREADS_COUNT * sizeof(jthread)), @@ -120,7 +120,7 @@ agentProc(jvmtiEnv *jvmti, JNIEnv *jni, void *arg) { LOG("Delete threads references\n"); for (int i = 0; i < THREADS_COUNT; i++) { - if (threads[i] != NULL) + if (threads[i] != nullptr) jni->DeleteGlobalRef(threads[i]); } @@ -141,13 +141,13 @@ agentProc(jvmtiEnv *jvmti, JNIEnv *jni, void *arg) { /** Find threads whose name starts with specified name prefix. */ static int find_threads_by_name(jvmtiEnv *jvmti, JNIEnv *jni, const char *name, int found_count, jthread *found_threads) { jint count = 0; - jthread *threads = NULL; + jthread *threads = nullptr; size_t len = strlen(name); int found = 0; for (int i = 0; i < found_count; i++) { - found_threads[i] = NULL; + found_threads[i] = nullptr; } check_jvmti_status(jni, jvmti->GetAllThreads(&count, &threads), "Error in GetAllThreads"); @@ -158,7 +158,7 @@ static int find_threads_by_name(jvmtiEnv *jvmti, JNIEnv *jni, const char *name, check_jvmti_status(jni, jvmti->GetThreadInfo(threads[i], &info), ""); - if (info.name != NULL && strncmp(name, info.name, len) == 0) { + if (info.name != nullptr && strncmp(name, info.name, len) == 0) { LOG(" ... found thread #%d: %p (%s)\n", found, threads[i], info.name); if (found < found_count) found_threads[found] = threads[i]; @@ -182,7 +182,7 @@ static int find_threads_by_name(jvmtiEnv *jvmti, JNIEnv *jni, const char *name, LOG("Make global references for threads: %d threads\n", found_count); for (int i = 0; i < found_count; i++) { found_threads[i] = (jthread) jni->NewGlobalRef(found_threads[i]); - if (found_threads[i] == NULL) { + if (found_threads[i] == nullptr) { set_agent_fail_status(); return JNI_FALSE; } @@ -194,12 +194,12 @@ static int find_threads_by_name(jvmtiEnv *jvmti, JNIEnv *jni, const char *name, JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv *jvmti = NULL; + jvmtiEnv *jvmti = nullptr; timeout = 60 * 1000; jint res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_9); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -216,7 +216,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } /* register agent proc and arg */ - if (!set_agent_proc(agentProc, NULL)) { + if (!set_agent_proc(agentProc, nullptr)) { return JNI_ERR; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/thread/SuspendThreadList/suspendthrdlst02/libsuspendthrdlst02.cpp b/test/hotspot/jtreg/serviceability/jvmti/thread/SuspendThreadList/suspendthrdlst02/libsuspendthrdlst02.cpp index 5fb6c80af980..8982b95b514f 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/thread/SuspendThreadList/suspendthrdlst02/libsuspendthrdlst02.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/thread/SuspendThreadList/suspendthrdlst02/libsuspendthrdlst02.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,8 @@ #include #include "jvmti.h" -#include "jvmti_common.h" -#include "jvmti_thread.h" +#include "jvmti_common.hpp" +#include "jvmti_thread.hpp" #include @@ -49,7 +49,7 @@ static jvmtiEvent eventsList[EVENTS_COUNT] = { JVMTI_EVENT_THREAD_END }; -static jthread* threads = NULL; +static jthread* threads = nullptr; static volatile int eventsReceived = 0; @@ -66,7 +66,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { /* perform testing */ { - jvmtiError* results = NULL; + jvmtiError* results = nullptr; LOG("Allocate threads array: %d threads\n", THREADS_COUNT); check_jvmti_status(jni, jvmti->Allocate((THREADS_COUNT * sizeof(jthread)), @@ -100,7 +100,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { eventsReceived = 0; LOG("Enable event: %s\n", "THREAD_END"); - enable_events_notifications(jvmti, jni, JVMTI_ENABLE, EVENTS_COUNT, eventsList, NULL); + enable_events_notifications(jvmti, jni, JVMTI_ENABLE, EVENTS_COUNT, eventsList, nullptr); LOG("Let threads to run and finish\n"); if (!agent_resume_sync()) @@ -121,7 +121,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } LOG("Disable event: %s\n", "THREAD_END"); - enable_events_notifications(jvmti, jni,JVMTI_DISABLE, EVENTS_COUNT, eventsList, NULL); + enable_events_notifications(jvmti, jni,JVMTI_DISABLE, EVENTS_COUNT, eventsList, nullptr); LOG("Resume threads list\n"); err = jvmti->ResumeThreadList(THREADS_COUNT, threads, results); @@ -137,7 +137,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { LOG("Delete threads references\n"); for (int i = 0; i < THREADS_COUNT; i++) { - if (threads[i] != NULL) { + if (threads[i] != nullptr) { jni->DeleteGlobalRef(threads[i]); } } @@ -159,12 +159,12 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { static int find_threads_by_name(jvmtiEnv* jvmti, JNIEnv* jni, const char name[], int foundCount, jthread foundThreads[]) { jint count = 0; - jthread* threads = NULL; + jthread* threads = nullptr; size_t len = strlen(name); int found = 0; for (int i = 0; i < foundCount; i++) { - foundThreads[i] = NULL; + foundThreads[i] = nullptr; } check_jvmti_status(jni, jvmti->GetAllThreads(&count, &threads), ""); @@ -174,7 +174,7 @@ static int find_threads_by_name(jvmtiEnv* jvmti, JNIEnv* jni, jvmtiThreadInfo info; check_jvmti_status(jni, jvmti->GetThreadInfo(threads[i], &info), ""); - if (info.name != NULL && strncmp(name, info.name, len) == 0) { + if (info.name != nullptr && strncmp(name, info.name, len) == 0) { LOG(" ... found thread #%d: %p (%s)\n", found, threads[i], info.name); if (found < foundCount) { foundThreads[found] = threads[i]; @@ -198,7 +198,7 @@ static int find_threads_by_name(jvmtiEnv* jvmti, JNIEnv* jni, LOG("Make global references for threads: %d threads\n", foundCount); for (int i = 0; i < foundCount; i++) { foundThreads[i] = (jthread) jni->NewGlobalRef(foundThreads[i]); - if (foundThreads[i] == NULL) { + if (foundThreads[i] == nullptr) { set_agent_fail_status(); return JNI_FALSE; } @@ -213,7 +213,7 @@ JNIEXPORT void JNICALL callbackThreadEnd(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { /* check if event is for tested thread */ for (int i = 0; i < THREADS_COUNT; i++) { - if (thread != NULL && jni->IsSameObject(threads[i], thread)) { + if (thread != nullptr && jni->IsSameObject(threads[i], thread)) { LOG(" ... received THREAD_END event for thread #%d: %p\n", i, (void*)thread); eventsReceived++; return; @@ -224,12 +224,12 @@ callbackThreadEnd(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; timeout = 60 * 1000; jint res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_9); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -261,7 +261,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { } /* register agent proc and arg */ - if (!set_agent_proc(agentProc, NULL)) { + if (!set_agent_proc(agentProc, nullptr)) { return JNI_ERR; } return JNI_OK; diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/BoundVThreadTest/libBoundVThreadTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/BoundVThreadTest/libBoundVThreadTest.cpp index 0fa0f065ae83..ff332ae454cb 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/BoundVThreadTest/libBoundVThreadTest.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/BoundVThreadTest/libBoundVThreadTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2024, 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 @@ #include #include "jvmti.h" -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/BreakpointInYieldTest/libBreakpointInYieldTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/BreakpointInYieldTest/libBreakpointInYieldTest.cpp index 01b1f2f93dcb..0e647672c216 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/BreakpointInYieldTest/libBreakpointInYieldTest.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/BreakpointInYieldTest/libBreakpointInYieldTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, 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,12 +23,12 @@ #include #include "jvmti.h" -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { -static jvmtiEnv *jvmti = NULL; -static jrawMonitorID event_mon = NULL; +static jvmtiEnv *jvmti = nullptr; +static jrawMonitorID event_mon = nullptr; static int method_entry_count = 0; static int method_exit_count = 0; static int breakpoint_count = 0; @@ -63,7 +63,7 @@ set_breakpoint(JNIEnv *jni, jclass klass, const char *mname) jlocation location = (jlocation)0L; jvmtiError err; - if (method == NULL) { + if (method == nullptr) { jni->FatalError("Error in set_breakpoint: not found method"); } err = jvmti->SetBreakpoint(method, location); @@ -131,13 +131,13 @@ VirtualThreadMount(jvmtiEnv *jvmti, ...) { if (done) { return; // defence against JVMTI_ERROR_WRONG_PHASE failures } - jmethodID method = NULL; + jmethodID method = nullptr; jlocation loc = 0L; jvmtiError err; va_list ap; - JNIEnv* jni = NULL; - jthread thread = NULL; + JNIEnv* jni = nullptr; + jthread thread = nullptr; va_start(ap, jvmti); jni = va_arg(ap, JNIEnv*); @@ -162,13 +162,13 @@ VirtualThreadUnmount(jvmtiEnv *jvmti, ...) { if (done) { return; // defence against JVMTI_ERROR_WRONG_PHASE failures } - jmethodID method = NULL; + jmethodID method = nullptr; jlocation loc = 0L; jvmtiError err; va_list ap; - JNIEnv* jni = NULL; - jthread thread = NULL; + JNIEnv* jni = nullptr; + jthread thread = nullptr; va_start(ap, jvmti); jni = va_arg(ap, JNIEnv*); @@ -239,24 +239,24 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("error in JVMTI SetEventNotificationMode: %d\n", err); return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VIRTUAL_THREAD_START, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VIRTUAL_THREAD_START, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("error in JVMTI SetEventNotificationMode: %d\n", err); } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, EXT_EVENT_VIRTUAL_THREAD_MOUNT, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, EXT_EVENT_VIRTUAL_THREAD_MOUNT, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("error in JVMTI SetEventNotificationMode: %d\n", err); return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, EXT_EVENT_VIRTUAL_THREAD_UNMOUNT, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, EXT_EVENT_VIRTUAL_THREAD_UNMOUNT, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("error in JVMTI SetEventNotificationMode: %d\n", err); return JNI_ERR; @@ -276,16 +276,16 @@ Java_BreakpointInYieldTest_enableEvents(JNIEnv *jni, jclass klass, jthread threa LOG("enableEvents: started\n"); - jclass k1 = find_class(jvmti, jni, NULL, "Ljava/lang/VirtualThread;"); - jclass k2 = find_class(jvmti, jni, NULL, "Ljdk/internal/vm/Continuation;"); - if (k1 == NULL || k2 == NULL) { + jclass k1 = find_class(jvmti, jni, nullptr, "Ljava/lang/VirtualThread;"); + jclass k2 = find_class(jvmti, jni, nullptr, "Ljdk/internal/vm/Continuation;"); + if (k1 == nullptr || k2 == nullptr) { jni->FatalError("Did not find one of the classes by name: VirtualThread or Continuation"); } set_breakpoint(jni, k1, "run"); set_breakpoint(jni, k2, "yield"); // Enable Breakpoint events globally - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, nullptr); check_jvmti_status(jni, err, "enableEvents: error in JVMTI SetEventNotificationMode: enable BREAKPOINT"); LOG("enableEvents: finished\n"); @@ -297,19 +297,19 @@ Java_BreakpointInYieldTest_check(JNIEnv *jni, jclass cls) { jvmtiError err; done = true; // defence against JVMTI_ERROR_WRONG_PHASE failures - err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_THREAD_START, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_THREAD_START, nullptr); check_jvmti_status(jni, err, "check: error in JVMTI SetEventNotificationMode: disable THREAD_START"); - err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_VIRTUAL_THREAD_START, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_VIRTUAL_THREAD_START, nullptr); check_jvmti_status(jni, err, "check: error in JVMTI SetEventNotificationMode: disable VIRTUAL_THREAD_START"); - err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, EXT_EVENT_VIRTUAL_THREAD_MOUNT, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, EXT_EVENT_VIRTUAL_THREAD_MOUNT, nullptr); check_jvmti_status(jni, err, "check: error in JVMTI SetEventNotificationMode: disable VIRTUAL_THREAD_MOUNT"); - err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, EXT_EVENT_VIRTUAL_THREAD_UNMOUNT, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, EXT_EVENT_VIRTUAL_THREAD_UNMOUNT, nullptr); check_jvmti_status(jni, err, "check: error in JVMTI SetEventNotificationMode: disable VIRTUAL_THREAD_UNMOUNT"); - err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_BREAKPOINT, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_BREAKPOINT, nullptr); check_jvmti_status(jni, err, "check: error in JVMTI SetEventNotificationMode: disable BREAKPOINT"); LOG("\n"); diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/ContFramePopTest/libContFramePopTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/ContFramePopTest/libContFramePopTest.cpp index 191d47585e9d..9b8ab8b7af29 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/ContFramePopTest/libContFramePopTest.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/ContFramePopTest/libContFramePopTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2024, 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,15 +23,15 @@ #include #include "jvmti.h" -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { #define MAX_FRAME_COUNT 20 -static jvmtiEnv *jvmti = NULL; -static jthread exp_thread = NULL; -static jrawMonitorID event_mon = NULL; +static jvmtiEnv *jvmti = nullptr; +static jthread exp_thread = nullptr; +static jrawMonitorID event_mon = nullptr; static int method_entry_count = 0; static int method_exit_count = 0; static int frame_pop_count = 0; @@ -40,11 +40,11 @@ static void print_frame_event_info(jvmtiEnv *jvmti, JNIEnv* jni, jthread thread, jmethodID method, const char* event_name) { char* tname = get_thread_name(jvmti, jni, thread); char* cname = get_method_class_name(jvmti, jni, method); - char* mname = NULL; - char* msign = NULL; + char* mname = nullptr; + char* msign = nullptr; jvmtiError err; - err = jvmti->GetMethodName(method, &mname, &msign, NULL); + err = jvmti->GetMethodName(method, &mname, &msign, nullptr); check_jvmti_status(jni, err, "event handler: error in JVMTI GetMethodName call"); if (strcmp(event_name, "MethodEntry") == 0) { diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/ContStackDepthTest/libContStackDepthTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/ContStackDepthTest/libContStackDepthTest.cpp index f0b6fcaa2548..60a3f17fbb01 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/ContStackDepthTest/libContStackDepthTest.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/ContStackDepthTest/libContStackDepthTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2024, 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,14 +23,14 @@ #include #include "jvmti.h" -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { -static jvmtiEnv *jvmti = NULL; -static jthread exp_thread = NULL; -static jrawMonitorID event_mon = NULL; +static jvmtiEnv *jvmti = nullptr; +static jthread exp_thread = nullptr; +static jrawMonitorID event_mon = nullptr; static int breakpoint_count = 0; static int frame_pop_count = 0; static int method_entry_count = 0; @@ -42,11 +42,11 @@ print_frame_event_info(jvmtiEnv *jvmti, JNIEnv* jni, jthread thread, jmethodID m const char* event_name, int event_count) { char* tname = get_thread_name(jvmti, jni, thread); char* cname = get_method_class_name(jvmti, jni, method); - char* mname = NULL; - char* msign = NULL; + char* mname = nullptr; + char* msign = nullptr; jvmtiError err; - err = jvmti->GetMethodName(method, &mname, &msign, NULL); + err = jvmti->GetMethodName(method, &mname, &msign, nullptr); check_jvmti_status(jni, err, "event handler: error in JVMTI GetMethodName call"); LOG("\n%s event #%d: thread: %s, method: %s: %s%s\n", @@ -181,10 +181,10 @@ FramePop(jvmtiEnv *jvmti, JNIEnv* jni, jthread thread, print_frame_event_info(jvmti, jni, thread, method, "FramePop", ++frame_pop_count); - err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_SINGLE_STEP, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_SINGLE_STEP, nullptr); check_jvmti_status(jni, err, "FramePop: error in JVMTI SetEventNotificationMode: disable SINGLE_STEP"); - err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_FRAME_POP, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_FRAME_POP, nullptr); check_jvmti_status(jni, err, "FramePop: error in JVMTI SetEventNotificationMode: disable FRAME_POP"); deallocate(jvmti, jni, (void*)mname); @@ -236,8 +236,8 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { JNIEXPORT void JNICALL Java_ContStackDepthTest_enableEvents(JNIEnv *jni, jclass klass, jthread thread) { jint method_count = 0; - jmethodID* methods = NULL; - jmethodID method = NULL; + jmethodID* methods = nullptr; + jmethodID method = nullptr; jlocation location = (jlocation)0L; jvmtiError err; @@ -259,7 +259,7 @@ Java_ContStackDepthTest_enableEvents(JNIEnv *jni, jclass klass, jthread thread) } deallocate(jvmti, jni, (void*)mname); } - if (method == NULL) { + if (method == nullptr) { jni->FatalError("Error in enableEvents: not found method fibTest()"); } @@ -267,7 +267,7 @@ Java_ContStackDepthTest_enableEvents(JNIEnv *jni, jclass klass, jthread thread) check_jvmti_status(jni, err, "enableEvents: error in JVMTI SetBreakpoint"); // Enable Breakpoint events globally - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, nullptr); check_jvmti_status(jni, err, "enableEvents: error in JVMTI SetEventNotificationMode: enable BREAKPOINT"); LOG("enableEvents: finished\n"); diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/ContYieldBreakPointTest/libContYieldBreakPointTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/ContYieldBreakPointTest/libContYieldBreakPointTest.cpp index b4f3da42e4a9..7a9af14f4782 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/ContYieldBreakPointTest/libContYieldBreakPointTest.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/ContYieldBreakPointTest/libContYieldBreakPointTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2024, 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,14 +23,14 @@ #include #include "jvmti.h" -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { -static jvmtiEnv *jvmti = NULL; -static jthread exp_thread = NULL; -static jrawMonitorID event_mon = NULL; +static jvmtiEnv *jvmti = nullptr; +static jthread exp_thread = nullptr; +static jrawMonitorID event_mon = nullptr; static int breakpoint_count = 0; static int single_step_count = 0; @@ -39,11 +39,11 @@ print_frame_event_info(jvmtiEnv *jvmti, JNIEnv* jni, jthread thread, jmethodID m const char* event_name, int event_count) { char* tname = get_thread_name(jvmti, jni, thread); char* cname = get_method_class_name(jvmti, jni, method); - char* mname = NULL; - char* msign = NULL; + char* mname = nullptr; + char* msign = nullptr; jvmtiError err; - err = jvmti->GetMethodName(method, &mname, &msign, NULL); + err = jvmti->GetMethodName(method, &mname, &msign, nullptr); check_jvmti_status(jni, err, "event handler: error in JVMTI GetMethodName call"); LOG("\n%s event #%d: thread: %s, method: %s: %s%s\n", @@ -150,8 +150,8 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { JNIEXPORT void JNICALL Java_ContYieldBreakPointTest_enableEvents(JNIEnv *jni, jclass klass, jthread thread, jclass contKlass) { jint method_count = 0; - jmethodID* methods = NULL; - jmethodID method = NULL; + jmethodID* methods = nullptr; + jmethodID method = nullptr; jlocation location = (jlocation)0L; jvmtiError err; @@ -172,7 +172,7 @@ Java_ContYieldBreakPointTest_enableEvents(JNIEnv *jni, jclass klass, jthread thr } deallocate(jvmti, jni, (void*)mname); } - if (method == NULL) { + if (method == nullptr) { jni->FatalError("Error in enableEvents: not found method fibTest()"); } @@ -180,7 +180,7 @@ Java_ContYieldBreakPointTest_enableEvents(JNIEnv *jni, jclass klass, jthread thr check_jvmti_status(jni, err, "enableEvents: error in JVMTI SetBreakpoint"); // Enable Breakpoint events globally - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, nullptr); check_jvmti_status(jni, err, "enableEvents: error in JVMTI SetEventNotificationMode: enable BREAKPOINT"); LOG("enableEvents: finished\n"); diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/ContinuationTest/libContinuationTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/ContinuationTest/libContinuationTest.cpp index c2bc14887b06..c647fcfb4697 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/ContinuationTest/libContinuationTest.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/ContinuationTest/libContinuationTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2024, 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,16 +23,16 @@ #include #include "jvmti.h" -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { #define MAX_FRAME_COUNT 20 #define FRAMES_TO_NOTIFY_POP 7 -static jvmtiEnv *jvmti = NULL; -static jthread exp_thread = NULL; -static jrawMonitorID event_mon = NULL; +static jvmtiEnv *jvmti = nullptr; +static jthread exp_thread = nullptr; +static jrawMonitorID event_mon = nullptr; static int method_entry_count = 0; static int frame_pop_count = 0; @@ -40,13 +40,13 @@ static void print_frame_event_info(jvmtiEnv *jvmti, JNIEnv* jni, jthread thread, jmethodID method, const char* event_name) { char* tname = get_thread_name(jvmti, jni, thread); char* cname = get_method_class_name(jvmti, jni, method); - char* mname = NULL; - char* msign = NULL; + char* mname = nullptr; + char* msign = nullptr; jboolean is_virtual = jni->IsVirtualThread(thread); const char* virt = is_virtual ? "virtual" : "carrier"; jvmtiError err; - err = jvmti->GetMethodName(method, &mname, &msign, NULL); + err = jvmti->GetMethodName(method, &mname, &msign, nullptr); check_jvmti_status(jni, err, "event handler: error in JVMTI GetMethodName call"); if (strcmp(event_name, "MethodEntry") == 0) { @@ -78,7 +78,7 @@ MethodEntry(jvmtiEnv *jvmti, JNIEnv* jni, jthread thread, jmethodID method) { // Request FramePop notifications for all continuation frames. // They all are expected to be cleared as a part of yield protocol. for (jint depth = 0; depth < FRAMES_TO_NOTIFY_POP; depth++) { - jmethodID frame_method = NULL; + jmethodID frame_method = nullptr; jlocation location = 0LL; err = jvmti->NotifyFramePop(thread, depth); diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/FollowReferences/libVThreadStackRefTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/FollowReferences/libVThreadStackRefTest.cpp index 3034e9e1475e..9946364deeef 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/FollowReferences/libVThreadStackRefTest.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/FollowReferences/libVThreadStackRefTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2024, 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 @@ #include #include -#include +#include #include #include diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/ForceEarlyReturnTest/libForceEarlyReturnTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/ForceEarlyReturnTest/libForceEarlyReturnTest.cpp index 86cdf781f7f6..e659bd304f8e 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/ForceEarlyReturnTest/libForceEarlyReturnTest.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/ForceEarlyReturnTest/libForceEarlyReturnTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,13 +24,13 @@ #include #include #include "jvmti.h" -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { -static jvmtiEnv *jvmti = NULL; -static jmethodID mid_B = NULL; -static jrawMonitorID monitor = NULL; +static jvmtiEnv *jvmti = nullptr; +static jmethodID mid_B = nullptr; +static jrawMonitorID monitor = nullptr; static volatile bool bp_sync_reached = false; static void JNICALL @@ -55,7 +55,7 @@ Breakpoint(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, check_jvmti_status(jni, err, "Breakpoint: Failed in JVMTI GetLocalInt"); if (force_return != 0) { - jobject ret_obj = NULL; + jobject ret_obj = nullptr; err = jvmti->ClearBreakpoint(mid_B, 0); check_jvmti_status(jni, err, "Breakpoint: Failed in JVMTI ClearBreakpoint"); @@ -79,7 +79,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { LOG("Agent init\n"); res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Agent init: Failed in GetEnv!\n"); return JNI_ERR; } @@ -124,17 +124,17 @@ Java_ForceEarlyReturnTest_prepareAgent(JNIEnv *jni, jclass cls, jclass task_claz LOG("Main: prepareAgent started\n"); - if (jvmti == NULL) { + if (jvmti == nullptr) { fatal(jni, "prepareAgent: Failed as JVMTI client was not properly loaded!\n"); } mid_B = jni->GetStaticMethodID(task_clazz, "B", "(ZLjava/lang/String;)Ljava/lang/String;"); - if (mid_B == NULL) { + if (mid_B == nullptr) { fatal(jni, "prepareAgent: Failed to find Method ID for method: TestTask.B()\n"); } err = jvmti->SetBreakpoint(mid_B, 0); // location: 0 check_jvmti_status(jni, err, "prepareAgent: Failed in JVMTI SetBreakpoint"); - set_event_notification_mode(jvmti, JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL); + set_event_notification_mode(jvmti, JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, nullptr); LOG("Main: prepareAgent finished\n"); } diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/GetSetLocalTest/libGetSetLocalTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/GetSetLocalTest/libGetSetLocalTest.cpp index c127e9fff9b9..46cce443f4d9 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/GetSetLocalTest/libGetSetLocalTest.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/GetSetLocalTest/libGetSetLocalTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, 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 @@ #include #include "jvmti.h" -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { @@ -51,7 +51,7 @@ typedef struct Values { } Values; static const int MAX_EVENTS_TO_PROCESS = 20; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static volatile jboolean completed = JNI_FALSE; static void @@ -60,7 +60,7 @@ set_breakpoint(JNIEnv *jni, jclass klass, const char *mname, jlocation location) jmethodID method = find_method(jvmti, jni, klass, mname); jvmtiError err; - if (method == NULL) { + if (method == nullptr) { LOG("set_breakpoint: Failed to find method %s()\n", mname); fatal(jni, "set_breakpoint: not found method"); } @@ -88,10 +88,10 @@ find_method_depth(jvmtiEnv *jvmti, JNIEnv *jni, jthread vthread, const char *mna for (int depth = 0; depth < count; depth++) { jmethodID method = frames[depth].method; - char* name = NULL; - char* sign = NULL; + char* name = nullptr; + char* sign = nullptr; - err = jvmti->GetMethodName(method, &name, &sign, NULL); + err = jvmti->GetMethodName(method, &name, &sign, nullptr); if (err == JVMTI_ERROR_WRONG_PHASE || err == JVMTI_ERROR_THREAD_NOT_ALIVE) { return -1; // VM or target thread completed its work } @@ -107,15 +107,15 @@ find_method_depth(jvmtiEnv *jvmti, JNIEnv *jni, jthread vthread, const char *mna static void test_GetLocal(jvmtiEnv *jvmti, JNIEnv *jni, jthread cthread, jthread vthread, int depth, int frame_count, Values *exp_values) { - jobject msg = NULL; - jobject tt = NULL; + jobject msg = nullptr; + jobject tt = nullptr; jint ii = 0; jlong ll = 0L; jfloat ff = 0.0; jdouble dd = 0.0; jvmtiError err; - LOG("test_GetLocal: mounted: %d depth: %d fcount: %d\n", cthread != NULL, depth, frame_count); + LOG("test_GetLocal: mounted: %d depth: %d fcount: %d\n", cthread != nullptr, depth, frame_count); int dep = find_method_depth(jvmti, jni, vthread, "producer"); if (dep == -1) { @@ -126,7 +126,7 @@ test_GetLocal(jvmtiEnv *jvmti, JNIEnv *jni, jthread cthread, jthread vthread, } // #0: Test JVMTI GetLocalInstance function for carrier thread - if (cthread != NULL) { + if (cthread != nullptr) { suspend_thread(jvmti, jni, cthread); err = jvmti->GetLocalInstance(cthread, 3, &msg); @@ -165,18 +165,18 @@ test_GetLocal(jvmtiEnv *jvmti, JNIEnv *jni, jthread cthread, jthread vthread, " to return JVMTI_ERROR_INVALID_SLOT or JVMTI_ERROR_TYPE_MISMATCH"); } - // #5: Test JVMTI GetLocalObject function with NULL value_ptr - err = jvmti->GetLocalObject(vthread, depth, SlotString, NULL); + // #5: Test JVMTI GetLocalObject function with nullptr value_ptr + err = jvmti->GetLocalObject(vthread, depth, SlotString, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { - LOG("JVMTI GetLocalObject with NULL value_ptr returned error: %d\n", err); - fatal(jni, "JVMTI GetLocalObject with NULL value_ptr failed to return JVMTI_ERROR_NULL_POINTER"); + LOG("JVMTI GetLocalObject with null value_ptr returned error: %d\n", err); + fatal(jni, "JVMTI GetLocalObject with null value_ptr failed to return JVMTI_ERROR_NULL_POINTER"); } // #6: Test JVMTI GetLocal functions with a good vthread err = jvmti->GetLocalObject(vthread, depth, SlotString, &msg); check_jvmti_status(jni, err, "error in JVMTI GetLocalObject with good vthread"); - const char* str = jni->GetStringUTFChars((jstring)msg, NULL); + const char* str = jni->GetStringUTFChars((jstring)msg, nullptr); LOG(" local String value at slot %d: %s\n", SlotString, str); const char* exp_str = "msg: ..."; if (strncmp(str, exp_str, 5) != 0) { @@ -189,7 +189,7 @@ test_GetLocal(jvmtiEnv *jvmti, JNIEnv *jni, jthread cthread, jthread vthread, check_jvmti_status(jni, err, "error in JVMTI GetLocalObject with good vthread"); LOG(" local Thread value at slot %d: %p\n", SlotThread, (void*)tt); - if (exp_values->tt != NULL && !jni->IsSameObject(tt, exp_values->tt)) { + if (exp_values->tt != nullptr && !jni->IsSameObject(tt, exp_values->tt)) { LOG(" Failed: Expected local Thread value: %p, got: %p\n", exp_values->tt, tt); fatal(jni, "JVMTI GetLocalObject returned unexpected local Thread value"); } @@ -239,7 +239,7 @@ test_SetLocal(jvmtiEnv *jvmti, JNIEnv *jni, jthread cthread, jthread vthread, int depth, int frame_count, Values *values, bool at_event) { jvmtiError err; - LOG("test_SetLocal: mounted: %d depth: %d fcount: %d\n", cthread != NULL, depth, frame_count); + LOG("test_SetLocal: mounted: %d depth: %d fcount: %d\n", cthread != nullptr, depth, frame_count); // #1: Test JVMTI SetLocalObject function with negative frame depth err = jvmti->SetLocalObject(vthread, -1, SlotString, values->tt); @@ -257,7 +257,7 @@ test_SetLocal(jvmtiEnv *jvmti, JNIEnv *jni, jthread cthread, jthread vthread, // #3: Test JVMTI SetLocalObject function with invalid slot -1 err = jvmti->SetLocalObject(vthread, depth, SlotInvalid0, values->tt); - if (depth > 0 || cthread == NULL) { + if (depth > 0 || cthread == nullptr) { // JVMTI_ERROR_OPAQUE_FRAME can be returned for unmouted vthread or depth > 0 if (err != JVMTI_ERROR_OPAQUE_FRAME) { LOG("JVMTI SetLocalObject for unmounted vthread or depth > 0 failed to return JVMTI_ERROR_OPAQUE_FRAME: %d\n", err); @@ -271,14 +271,14 @@ test_SetLocal(jvmtiEnv *jvmti, JNIEnv *jni, jthread cthread, jthread vthread, // #4: Test JVMTI SetLocalObject function with unaligned slot 4 err = jvmti->SetLocalObject(vthread, depth, SlotUnaligned, values->tt); - if (depth > 0 || cthread == NULL) { + if (depth > 0 || cthread == nullptr) { // JVMTI_ERROR_OPAQUE_FRAME can be returned for unmouted vthread or depth > 0 if (err != JVMTI_ERROR_OPAQUE_FRAME) { LOG("JVMTI SetLocalObject for unmounted vthread or depth > 0 failed to return JVMTI_ERROR_OPAQUE_FRAME: %d\n", err); fatal(jni, "JVMTI SetLocalObject for unmounted vthread or depth > 0 failed to return JVMTI_ERROR_OPAQUE_FRAME"); } } - else if (cthread != NULL && err != JVMTI_ERROR_INVALID_SLOT && err != JVMTI_ERROR_TYPE_MISMATCH) { + else if (cthread != nullptr && err != JVMTI_ERROR_INVALID_SLOT && err != JVMTI_ERROR_TYPE_MISMATCH) { LOG("JVMTI SetLocalObject with unaligned slot 4 returned error: %d\n", err); fatal(jni, "JVMTI SetLocalObject with unaligned slot 4 failed" " to return JVMTI_ERROR_INVALID_SLOT or JVMTI_ERROR_TYPE_MISMATCH"); @@ -286,7 +286,7 @@ test_SetLocal(jvmtiEnv *jvmti, JNIEnv *jni, jthread cthread, jthread vthread, // #6: Test JVMTI SetLocal functions with a good vthread err = jvmti->SetLocalObject(vthread, depth, SlotThread, values->tt); - if (depth > 0 || cthread == NULL) { + if (depth > 0 || cthread == nullptr) { if (err != JVMTI_ERROR_OPAQUE_FRAME) { LOG("JVMTI SetLocalObject for unmounted vthread or depth > 0 failed to return JVMTI_ERROR_OPAQUE_FRAME: %d\n", err); fatal(jni, "JVMTI SetLocalObject for unmounted vthread pr depth > 0failed to return JVMTI_ERROR_OPAQUE_FRAME"); @@ -314,8 +314,8 @@ test_SetLocal(jvmtiEnv *jvmti, JNIEnv *jni, jthread cthread, jthread vthread, static void test_GetSetLocal(jvmtiEnv *jvmti, JNIEnv* jni, jthread vthread, int depth, int frame_count, bool at_event) { - Values values0 = { NULL, NULL, 1, 2L, (jfloat)3.2F, (jdouble)4.500000047683716 }; - Values values1 = { NULL, NULL, 2, 3L, (jfloat)4.2F, (jdouble)5.500000047683716 }; + Values values0 = { nullptr, nullptr, 1, 2L, (jfloat)3.2F, (jdouble)4.500000047683716 }; + Values values1 = { nullptr, nullptr, 2, 3L, (jfloat)4.2F, (jdouble)5.500000047683716 }; jthread cthread = get_carrier_thread(jvmti, jni, vthread); values0.tt = vthread; @@ -329,7 +329,7 @@ test_GetSetLocal(jvmtiEnv *jvmti, JNIEnv* jni, jthread vthread, int depth, int f if (!success) { goto End; // skip testing for compiled frame that can't be deoptimized } - if (depth > 0 || cthread == NULL) { + if (depth > 0 || cthread == nullptr) { // No values are expected to be set by SetLocal above as // unmounted virtual thread case is not supported. // So, we expect local values to remain the same. @@ -368,8 +368,8 @@ Breakpoint(jvmtiEnv *jvmti, JNIEnv* jni, jthread vthread, test_GetSetLocal(jvmti, jni, vthread, depth, frame_count, true /* at_event */); // vthread passed to callback has to refer to current thread, - // so we can also test with NULL in place of vthread. - test_GetSetLocal(jvmti, jni, NULL, depth, frame_count, true /* at_event */); + // so we can also test with nullptr in place of vthread. + test_GetSetLocal(jvmti, jni, nullptr, depth, frame_count, true /* at_event */); } deallocate(jvmti, jni, (void*)mname); deallocate(jvmti, jni, (void*)tname); @@ -439,7 +439,7 @@ Java_GetSetLocalTest_testSuspendedVirtualThreads(JNIEnv *jni, jclass klass, jthr // Test each of these cases only once: unmounted, positive depth, frame count 0. while (iter++ < 50 && (!seen_depth_0 || !seen_depth_positive || !seen_unmounted)) { - jmethodID method = NULL; + jmethodID method = nullptr; jlocation location = 0; sleep_ms(1); @@ -460,7 +460,7 @@ Java_GetSetLocalTest_testSuspendedVirtualThreads(JNIEnv *jni, jclass klass, jthr } bool case_0 = !seen_depth_0 && depth == 0 && (int)location >= 30; bool case_1 = !seen_depth_positive && depth > 0 && (int)location >= 30; - bool case_2 = !seen_unmounted && depth >= 0 && cthread == NULL; + bool case_2 = !seen_unmounted && depth >= 0 && cthread == nullptr; if (case_0) { LOG("testSuspendedVirtualThreads: DEPTH == 0\n"); diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/GetThreadStateMountedTest/GetThreadStateMountedTest.java b/test/hotspot/jtreg/serviceability/jvmti/vthread/GetThreadStateMountedTest/GetThreadStateMountedTest.java new file mode 100644 index 000000000000..4b61d0301c33 --- /dev/null +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/GetThreadStateMountedTest/GetThreadStateMountedTest.java @@ -0,0 +1,331 @@ +/* + * Copyright (c) 2023, 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 8309612 8310584 + * @summary The test verifies that JVMTI GetThreadState function reports expected state + * for mounted (pinned) virtual thread and its carrier thread + * @requires vm.jvmti + * @requires vm.continuations + * @run main/othervm/native + * -agentlib:GetThreadStateMountedTest + * GetThreadStateMountedTest + */ + +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.locks.LockSupport; + +/** + * The test implements different scenarios to get desired JVMTI thread states. + * For each scenario the test also checks states after carrier and virtual threads suspend/resume + * and after virtual thread interrupt. + * Special handling is required for WAITING state scenarios: + * Spurious wakeups may cause unexpected thread state change and this causes test failure. + * To avoid this, the test thread should be suspended (i.e. carrier and/or mounted virtual thread is suspended). + */ +public class GetThreadStateMountedTest { + + static final int JVMTI_THREAD_STATE_RUNNABLE = 0x0004; + static final int JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER = 0x0400; + static final int JVMTI_THREAD_STATE_WAITING = 0x0080; + static final int JVMTI_THREAD_STATE_WAITING_INDEFINITELY = 0x0010; + static final int JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT = 0x0020; + static final int JVMTI_THREAD_STATE_IN_OBJECT_WAIT = 0x0100; + static final int JVMTI_THREAD_STATE_SLEEPING = 0x0040; + static final int JVMTI_THREAD_STATE_PARKED = 0x0200; + static final int JVMTI_THREAD_STATE_IN_NATIVE = 0x400000; + + static void runnable() throws Exception { + TestStatus status = new TestStatus("JVMTI_THREAD_STATE_RUNNABLE"); + CountDownLatch ready = new CountDownLatch(1); + final boolean[] stopFlag = new boolean[1]; + Thread vthread = createPinnedVThread(() -> { + ready.countDown(); + int i = 0; + while (!stopFlag[0]) { + if (i < 200) { + i++; + } else { + i = 0; + } + } + }); + vthread.start(); + ready.await(); + testThreadStates(vthread, false, true, JVMTI_THREAD_STATE_RUNNABLE); + stopFlag[0] = true; + status.print(); + } + + static void blockedOnMonitorEnter() throws Exception { + // JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER + // Thread is waiting to enter a synchronized block/method or, + // after an Object.wait(), waiting to re-enter a synchronized block/method. + TestStatus status = new TestStatus("JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER"); + CountDownLatch ready = new CountDownLatch(1); + final Object syncObj = new Object(); + Thread vthread = createPinnedVThread(() -> { + ready.countDown(); + synchronized (syncObj) { + } + }); + synchronized (syncObj) { + vthread.start(); + ready.await(); + Thread.sleep(500); // wait some time to ensure the thread is blocked on monitor + testThreadStates(vthread, false, true, JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER); + } + status.print(); + } + + static void waiting(boolean withTimeout) throws Exception { + // JVMTI_THREAD_STATE_WAITING + // Thread is waiting. + // JVMTI_THREAD_STATE_WAITING_INDEFINITELY + // Thread is waiting without a timeout. For example, Object.wait(). + // JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT + // Thread is waiting with a maximum time to wait specified. For example, Object.wait(long). + TestStatus status = new TestStatus(withTimeout + ? "JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT" + : "JVMTI_THREAD_STATE_WAITING_INDEFINITELY"); + CountDownLatch ready = new CountDownLatch(1); + // Test thread exits by InterruptedException, + // stopFlag is to handle spurious wakeups. + final boolean[] stopFlag = new boolean[1]; + final Object syncObj = new Object(); + Thread vthread = createPinnedVThread(() -> { + synchronized (syncObj) { + try { + ready.countDown(); + while (!stopFlag[0]) { + if (withTimeout) { + syncObj.wait(60000); + } else { + syncObj.wait(); + } + } + } catch (InterruptedException ex) { + // expected after testThreadStates + } + } + }); + vthread.start(); + ready.await(); + + // Suspend test thread in "waiting" state. + suspendWaiting(vthread); + + int expectedState = JVMTI_THREAD_STATE_WAITING + | JVMTI_THREAD_STATE_IN_OBJECT_WAIT + | (withTimeout + ? JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT + : JVMTI_THREAD_STATE_WAITING_INDEFINITELY); + testThreadStates(vthread, true, true, expectedState); + // signal test thread to finish (for safety, Object.wait should throw InterruptedException) + synchronized (syncObj) { + stopFlag[0] = true; + syncObj.notifyAll(); + } + status.print(); + } + + static void sleeping() throws Exception { + // JVMTI_THREAD_STATE_SLEEPING + // Thread is sleeping -- Thread.sleep. + // JVMTI_THREAD_STATE_PARKED + // A virtual thread that is sleeping, in Thread.sleep, + // may have this state flag set instead of JVMTI_THREAD_STATE_SLEEPING. + TestStatus status = new TestStatus("JVMTI_THREAD_STATE_SLEEPING"); + CountDownLatch ready = new CountDownLatch(1); + // Test thread exits by InterruptedException, + // stopFlag is to handle spurious wakeups. + final boolean[] stopFlag = new boolean[1]; + Thread vthread = createPinnedVThread(() -> { + ready.countDown(); + try { + while (!stopFlag[0]) { + Thread.sleep(60000); + } + } catch (InterruptedException ex) { + // expected, ignore + } + }); + vthread.start(); + ready.await(); + + // Suspend test thread in "waiting" state. + suspendWaiting(vthread); + + // vthread is suspended, set stopFlag before testThreadStates + stopFlag[0] = true; + + // don't test interrupt() - it causes thread state change for parked thread + // even if it's suspended + testThreadStates(vthread, true, false, + JVMTI_THREAD_STATE_WAITING | JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT, + JVMTI_THREAD_STATE_SLEEPING | JVMTI_THREAD_STATE_PARKED); + status.print(); + } + + static void parked() throws Exception { + // JVMTI_THREAD_STATE_PARKED + // Thread is parked, for example: LockSupport.park, LockSupport.parkUtil and LockSupport.parkNanos. + TestStatus status = new TestStatus("JVMTI_THREAD_STATE_PARKED"); + CountDownLatch ready = new CountDownLatch(1); + final boolean[] stopFlag = new boolean[1]; + + Thread vthread = createPinnedVThread(() -> { + ready.countDown(); + while (!stopFlag[0]) { + LockSupport.park(Thread.currentThread()); + } + }); + vthread.start(); + ready.await(); + + // Suspend test thread in "waiting" state. + suspendWaiting(vthread); + + // vthread is suspended, set stopFlag before testThreadStates + stopFlag[0] = true; + + // don't test interrupt() - it causes thread state change for parked thread + // even if it's suspended + testThreadStates(vthread, true, false, + JVMTI_THREAD_STATE_WAITING | JVMTI_THREAD_STATE_WAITING_INDEFINITELY | JVMTI_THREAD_STATE_PARKED); + // allow test thread to finish + LockSupport.unpark(vthread); + status.print(); + } + + static void inNative() throws Exception { + TestStatus status = new TestStatus("JVMTI_THREAD_STATE_IN_NATIVE"); + Thread vthread = createPinnedVThread(() -> { + waitInNative(); + }); + vthread.start(); + while (!waitInNativeReady) { + Thread.sleep(50); + } + testThreadStates(vthread, false, true, + JVMTI_THREAD_STATE_RUNNABLE | JVMTI_THREAD_STATE_IN_NATIVE, + 0); + endWait(); + status.print(); + } + + + public static void main(String[] args) throws Exception { + runnable(); + /* "waiting" test cases fail due JDK-8310584 + blockedOnMonitorEnter(); + waiting(false); + waiting(true); + sleeping(); + parked(); + */ + inNative(); + + int errCount = getErrorCount(); + if (errCount > 0) { + throw new RuntimeException("Test failed, " + errCount + " errors"); + } + } + + private static Thread createPinnedVThread(Runnable runnable) { + final Object syncObj = new Object(); + return Thread.ofVirtual().unstarted(() -> { + synchronized (syncObj) { + runnable.run(); + } + }); + } + + // Native implementation of suspendWaiting. + // Returns false if the method is not able to reach the desired state in several tries. + private static native boolean trySuspendInWaitingState(Thread vthread); + + // Suspends virtual thread and ensures it's suspended in "waiting" state + // (to handle possible spurious wakeups). + // throws an exception if the method is not able to reach the desired state in several tries. + private static void suspendWaiting(Thread vthread) { + boolean result = trySuspendInWaitingState(vthread); + if (!result) { + throw new RuntimeException("Failed to suspend thread in WAITING state"); + } + } + + // Tests thread states (vthread and the carrier thread). + // expectedStrong specifies value which must be present in vthreat state; + // expectedWeak is a combination of bits which may be set in vthreat state + // (at least one of the bit must set, but not all). + // Note: Last steps of the testing are interrupt/resume the virtual thread, + // so after the call vthread is interrupted. + private static native void testThread(Thread vthread, boolean isVThreadSuspended, + boolean testInterrupt, + int expectedStrong, int expectedWeak); + private static native int getErrorCount(); + // To retry test case when spurious wakeup detected. + private static native int resetErrorCount(int count); + + private static boolean waitInNativeReady = false; + + // Sets waitInNativeReady static field to true + // and then waits until endWait() method is called. + private static native void waitInNative(); + // Signals waitInNative() to exit. + private static native void endWait(); + + private static void testThreadStates(Thread vthread, boolean isVThreadSuspended, + boolean testInterrupt, + int expectedStrong, int expectedWeak) { + String name = vthread.toString(); + log("Thread " + name); + testThread(vthread, isVThreadSuspended, testInterrupt, expectedStrong, expectedWeak); + } + + private static void testThreadStates(Thread vthread, boolean isVThreadSuspended, + boolean testInterrupt, int expectedState) { + testThreadStates(vthread, isVThreadSuspended, testInterrupt, expectedState, 0); + } + + // helper class to print status of each test + private static class TestStatus { + private final String name; + private final int startErrorCount; + TestStatus(String name) { + this.name = name; + startErrorCount = getErrorCount(); + log(">>" + name); + } + void print() { + log("<<" + name + (startErrorCount == getErrorCount() ? " - OK" : " - FAILED")); + log(""); + } + } + + private static void log(Object s) { + System.out.println(s); + } +} diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/GetThreadStateMountedTest/libGetThreadStateMountedTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/GetThreadStateMountedTest/libGetThreadStateMountedTest.cpp new file mode 100644 index 000000000000..e6ee99eb23f6 --- /dev/null +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/GetThreadStateMountedTest/libGetThreadStateMountedTest.cpp @@ -0,0 +1,212 @@ +/* + * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +#include +#include +#include +#include + +static jvmtiEnv *jvmti = nullptr; +static jint error_count = 0; + +extern "C" JNIEXPORT jint JNICALL +Agent_OnLoad(JavaVM *vm, char *options, void *reserved) { + if (vm->GetEnv((void **)&jvmti, JVMTI_VERSION) != JNI_OK) { + LOG("Could not initialize JVMTI\n"); + return JNI_ERR; + } + jvmtiCapabilities caps; + memset(&caps, 0, sizeof(caps)); + caps.can_support_virtual_threads = 1; + caps.can_suspend = 1; + caps.can_signal_thread = 1; + jvmtiError err = jvmti->AddCapabilities(&caps); + if (err != JVMTI_ERROR_NONE) { + LOG("JVMTI AddCapabilities error: %d\n", err); + return JNI_ERR; + } + + return JNI_OK; +} + + +extern "C" JNIEXPORT jboolean JNICALL +Java_GetThreadStateMountedTest_trySuspendInWaitingState(JNIEnv* jni, jclass clazz, jthread vthread) { + const int max_retries = 10; + for (int i = 0; i < max_retries; i++) { + // wait a bit + sleep_ms(100); + + // suspend the thread + LOG("suspend vthread (%d)\n", i); + suspend_thread(jvmti, jni, vthread); + + jint state = get_thread_state(jvmti, jni, vthread); + if ((state & JVMTI_THREAD_STATE_WAITING) != 0) { + LOG("suspended in WAITING state\n"); + return JNI_TRUE; + } + LOG("suspended vthread is not waiting: state = %x (%s)\n", state, TranslateState(state)); + LOG("resume vthread\n"); + resume_thread(jvmti, jni, vthread); + } + LOG("ERROR: failed to suspend in WAITING state in %d tries\n", max_retries); + return JNI_FALSE; + +} + +static void verify_thread_state(const char *name, JNIEnv* jni, + jthread thread, jint expected_strong, jint expected_weak) +{ + jint state = get_thread_state(jvmti, jni, thread); + LOG("%s state(%x): %s\n", name, state, TranslateState(state)); + bool failed = false; + // check 1: all expected_strong bits are set + jint actual_strong = state & expected_strong; + if (actual_strong != expected_strong) { + failed = true; + jint missed = expected_strong - actual_strong; + LOG(" ERROR: some mandatory bits are not set (%x): %s\n", + missed, TranslateState(missed)); + } + // check 2: no bits other than (expected_strong | expected_weak) are set + jint actual_full = state & (expected_strong | expected_weak); + if (actual_full != state) { + failed = true; + jint unexpected = state - actual_full; + LOG(" ERROR: some unexpected bits are set (%x): %s\n", + unexpected, TranslateState(unexpected)); + } + // check 3: expected_weak checks + if (expected_weak != 0) { + // check 3a: at least 1 bit from expected_weak is set + if ((state & expected_weak) == 0) { + failed = true; + LOG(" ERROR: no expected 'weak' bits are set\n"); + } + // check 3b: not all expected_weak bits are set + if ((state & expected_weak) == expected_weak) { + failed = true; + LOG(" ERROR: all expected 'weak' bits are set\n"); + } + } + + if (failed) { + LOG(" expected 'strong' state (%x): %s\n", expected_strong, TranslateState(expected_strong)); + LOG(" expected 'weak' state (%x): %s\n", expected_weak, TranslateState(expected_weak)); + error_count++; + } +} + +extern "C" JNIEXPORT void JNICALL +Java_GetThreadStateMountedTest_testThread( + JNIEnv* jni, jclass clazz, jthread vthread, jboolean is_vthread_suspended, + jboolean test_interrupt, + jint expected_strong, jint expected_weak) +{ + jint exp_ct_state = JVMTI_THREAD_STATE_ALIVE + | JVMTI_THREAD_STATE_WAITING + | JVMTI_THREAD_STATE_WAITING_INDEFINITELY; + jint exp_vt_state = expected_strong + | JVMTI_THREAD_STATE_ALIVE; + + jthread cthread = get_carrier_thread(jvmti, jni, vthread); + + verify_thread_state("cthread", jni, cthread, + exp_ct_state, 0); + verify_thread_state("vthread", jni, vthread, + exp_vt_state | (is_vthread_suspended ? JVMTI_THREAD_STATE_SUSPENDED : 0), + expected_weak); + + // suspend ctread and verify + LOG("suspend cthread\n"); + suspend_thread(jvmti, jni, cthread); + verify_thread_state("cthread", jni, cthread, + exp_ct_state | JVMTI_THREAD_STATE_SUSPENDED, 0); + verify_thread_state("vthread", jni, vthread, + exp_vt_state | (is_vthread_suspended ? JVMTI_THREAD_STATE_SUSPENDED : 0), + expected_weak); + + // suspend vthread and verify + if (!is_vthread_suspended) { + LOG("suspend vthread\n"); + suspend_thread(jvmti, jni, vthread); + verify_thread_state("cthread", jni, cthread, + exp_ct_state | JVMTI_THREAD_STATE_SUSPENDED, 0); + verify_thread_state("vthread", jni, vthread, + exp_vt_state | JVMTI_THREAD_STATE_SUSPENDED, expected_weak); + } + + // resume cthread and verify + LOG("resume cthread\n"); + resume_thread(jvmti, jni, cthread); + verify_thread_state("cthread", jni, cthread, + exp_ct_state, 0); + verify_thread_state("vthread", jni, vthread, + exp_vt_state | JVMTI_THREAD_STATE_SUSPENDED, expected_weak); + + if (test_interrupt) { + // interrupt vthread (while it's suspended) + LOG("interrupt vthread\n"); + check_jvmti_status(jni, jvmti->InterruptThread(vthread), "error in JVMTI InterruptThread"); + verify_thread_state("cthread", jni, cthread, + exp_ct_state, 0); + verify_thread_state("vthread", jni, vthread, + exp_vt_state | JVMTI_THREAD_STATE_SUSPENDED | JVMTI_THREAD_STATE_INTERRUPTED, + expected_weak); + } + + // resume vthread + LOG("resume vthread\n"); + resume_thread(jvmti, jni, vthread); + + // don't verify thread state after InterruptThread and ResumeThread +} + +extern "C" JNIEXPORT int JNICALL +Java_GetThreadStateMountedTest_getErrorCount(JNIEnv* jni, jclass clazz) { + return error_count; +} + + +static std::atomic time_to_exit(false); + +extern "C" JNIEXPORT void JNICALL +Java_GetThreadStateMountedTest_waitInNative(JNIEnv* jni, jclass clazz) { + // Notify main thread that we are ready + jfieldID fid = jni->GetStaticFieldID(clazz, "waitInNativeReady", "Z"); + if (fid == nullptr) { + jni->FatalError("cannot get waitInNativeReady field"); + return; + } + jni->SetStaticBooleanField(clazz, fid, JNI_TRUE); + + while (!time_to_exit) { + sleep_ms(100); + } +} + +extern "C" JNIEXPORT void JNICALL +Java_GetThreadStateMountedTest_endWait(JNIEnv* jni, jclass clazz) { + time_to_exit = true; +} diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/InterruptThreadTest/libInterruptThreadTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/InterruptThreadTest/libInterruptThreadTest.cpp index f601aa15e3ff..8208e9bb1b42 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/InterruptThreadTest/libInterruptThreadTest.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/InterruptThreadTest/libInterruptThreadTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,11 +25,11 @@ #include #include "jvmti.h" -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static void JNICALL agent_proc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/MethodExitTest/libMethodExitTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/MethodExitTest/libMethodExitTest.cpp index 9676d5832063..78e142233772 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/MethodExitTest/libMethodExitTest.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/MethodExitTest/libMethodExitTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, 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,13 +23,13 @@ #include #include "jvmti.h" -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { -static jvmtiEnv *jvmti = NULL; -static jthread exp_thread = NULL; -static jrawMonitorID event_mon = NULL; +static jvmtiEnv *jvmti = nullptr; +static jthread exp_thread = nullptr; +static jrawMonitorID event_mon = nullptr; static int vthread_mounted_count = 0; static int vthread_unmounted_count = 0; static int breakpoint_count = 0; @@ -41,9 +41,9 @@ static jboolean received_method_exit_event = JNI_FALSE; static jboolean passed = JNI_TRUE; static bool done = false; -static jmethodID *test_methods = NULL; +static jmethodID *test_methods = nullptr; jint test_method_count = 0; -jclass test_class = NULL; +jclass test_class = nullptr; static void print_frame_event_info(jvmtiEnv *jvmti, JNIEnv* jni, jthread thread, jmethodID method, @@ -79,7 +79,7 @@ set_or_clear_breakpoint(JNIEnv *jni, jboolean set, const char *methodName, jclass klass, jmethodID methods[], int method_count) { jlocation location = (jlocation)0L; - jmethodID method = NULL; + jmethodID method = nullptr; jvmtiError err; // Find the jmethodID of the specified method @@ -93,7 +93,7 @@ set_or_clear_breakpoint(JNIEnv *jni, jboolean set, const char *methodName, } deallocate(jvmti, jni, (void*)mname); } - if (method == NULL) { + if (method == nullptr) { LOG("setupBreakpoint: not found method %s() to %s a breakpoint\n", methodName, set ? "set" : "clear"); jni->FatalError("Error in setupBreakpoint: not found method"); @@ -131,7 +131,7 @@ breakpoint_hit1(jvmtiEnv *jvmti, JNIEnv* jni, jthread thread, jthread cthread, jboolean is_virtual, char* mname) { char* tname = get_thread_name(jvmti, jni, cthread); - jthread vthread = NULL; + jthread vthread = nullptr; jvmtiError err; // Test GetVirtualThread for carrier thread. @@ -161,10 +161,10 @@ breakpoint_hit1(jvmtiEnv *jvmti, JNIEnv* jni, LOG("GetThreadLocalStorage for carrier thread returned value %p as expected\n\n", tls_data); } { - jmethodID method = NULL; + jmethodID method = nullptr; jlocation loc = 0L; - char* mname1 = NULL; - char* cname1 = NULL; + char* mname1 = nullptr; + char* cname1 = nullptr; err = jvmti->GetFrameLocation(cthread, 0, &method, &loc); check_jvmti_status(jni, err, "Breakpoint: error in JVMTI GetFrameLocation"); @@ -252,7 +252,7 @@ breakpoint_hit3(jvmtiEnv *jvmti, JNIEnv* jni, // Disable breakpoint events. clear_breakpoint(jni, "brkpt", test_class, test_methods, test_method_count); - set_event_notification_mode(jvmti, jni, JVMTI_DISABLE, JVMTI_EVENT_BREAKPOINT, NULL); + set_event_notification_mode(jvmti, jni, JVMTI_DISABLE, JVMTI_EVENT_BREAKPOINT, nullptr); // Disable METHOD_EXIT events on the vthread. LOG("Hit #3: Breakpoint: %s: disabling MethodExit events on virtual thread: %p\n", mname, (void*)thread); @@ -279,7 +279,7 @@ Breakpoint(jvmtiEnv *jvmti, JNIEnv* jni, jthread thread, if (done) { return; // avoid failures with JVMTI_ERROR_WRONG_PHASE } - jthread cthread = NULL; + jthread cthread = nullptr; char* mname = get_method_name(jvmti, jni, method); jboolean is_virtual = jni->IsVirtualThread(thread); @@ -347,7 +347,7 @@ MethodExit(jvmtiEnv *jvmti, JNIEnv* jni, jthread thread, jmethodID method, } // print_frame_event_info(jvmti, jni, thread, method, "MethodExit", method_exit_count); - if (strstr(mname, "brkpt") != NULL) { // event IS in the "brkpt" method + if (strstr(mname, "brkpt") != nullptr) { // event IS in the "brkpt" method LOG("Hit #%d: MethodExit #%d: method: %s on thread: %p\n", brkptBreakpointHit, method_exit_count, mname, (void*)thread); received_method_exit_event = JNI_TRUE; // set it for brkpt method only if brkptBreakpointHit > 1 @@ -433,15 +433,15 @@ VirtualThreadMount(jvmtiEnv *jvmti, ...) { if (done) { return; // avoid failures with JVMTI_ERROR_WRONG_PHASE } - jmethodID method = NULL; + jmethodID method = nullptr; jlocation loc = 0L; - char* mname = NULL; - char* cname = NULL; + char* mname = nullptr; + char* cname = nullptr; jvmtiError err; va_list ap; - JNIEnv* jni = NULL; - jthread thread = NULL; + JNIEnv* jni = nullptr; + jthread thread = nullptr; va_start(ap, jvmti); jni = va_arg(ap, JNIEnv*); @@ -478,15 +478,15 @@ VirtualThreadUnmount(jvmtiEnv *jvmti, ...) { if (done) { return; // avoid failures with JVMTI_ERROR_WRONG_PHASE } - jmethodID method = NULL; + jmethodID method = nullptr; jlocation loc = 0L; - char* mname = NULL; - char* cname = NULL; + char* mname = nullptr; + char* cname = nullptr; jvmtiError err; va_list ap; - JNIEnv* jni = NULL; - jthread thread = NULL; + JNIEnv* jni = nullptr; + jthread thread = nullptr; va_start(ap, jvmti); jni = va_arg(ap, JNIEnv*); @@ -562,9 +562,9 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { LOG("Agent_OnLoad: Error in JVMTI SetEventCallbacks: %d\n", err); return JNI_ERR; } - set_event_notification_mode(jvmti, JVMTI_ENABLE, JVMTI_EVENT_FRAME_POP, NULL); - set_event_notification_mode(jvmti, JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, NULL); - set_event_notification_mode(jvmti, JVMTI_ENABLE, JVMTI_EVENT_VIRTUAL_THREAD_START, NULL); + set_event_notification_mode(jvmti, JVMTI_ENABLE, JVMTI_EVENT_FRAME_POP, nullptr); + set_event_notification_mode(jvmti, JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, nullptr); + set_event_notification_mode(jvmti, JVMTI_ENABLE, JVMTI_EVENT_VIRTUAL_THREAD_START, nullptr); event_mon = create_raw_monitor(jvmti, "Events Monitor"); @@ -585,7 +585,7 @@ Java_MethodExitTest_enableEvents(JNIEnv *jni, jclass klass, jthread thread, jcla set_breakpoint(jni, "brkpt", testKlass, test_methods, test_method_count); // Enable Breakpoint events globally - set_event_notification_mode(jvmti, jni, JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL); + set_event_notification_mode(jvmti, jni, JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, nullptr); LOG("enableEvents: finished\n"); } diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/NullAsCurrentThreadTest/libNullAsCurrentThreadTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/NullAsCurrentThreadTest/libNullAsCurrentThreadTest.cpp index 140375d4cb55..ec808cfc0589 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/NullAsCurrentThreadTest/libNullAsCurrentThreadTest.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/NullAsCurrentThreadTest/libNullAsCurrentThreadTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, 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,12 +23,12 @@ #include #include "jvmti.h" -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { static const jint MAX_FRAME_CNT = 30; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static int vt_support_enabled = 0; static jboolean failed_status = JNI_FALSE; @@ -49,16 +49,16 @@ checkStackTraces(jvmtiEnv* jvmti, JNIEnv* jni, jvmtiFrameInfo* frames0, jvmtiFra for (int idx = 0; idx < cnt; idx++) { jmethodID method0 = frames0[idx].method; jmethodID method1 = frames1[idx].method; - char* name0 = NULL; - char* name1 = NULL; - char* sign0 = NULL; - char* sign1 = NULL; + char* name0 = nullptr; + char* name1 = nullptr; + char* sign0 = nullptr; + char* sign1 = nullptr; - err = jvmti->GetMethodName(method0, &name0, &sign0, NULL); + err = jvmti->GetMethodName(method0, &name0, &sign0, nullptr); check_jvmti_status(jni, err, "GetMethodName"); if (method0 != method1) { - err = jvmti->GetMethodName(method1, &name1, &sign1, NULL); + err = jvmti->GetMethodName(method1, &name1, &sign1, nullptr); check_jvmti_status(jni, err, "GetMethodName"); failed_status = JNI_TRUE; @@ -80,13 +80,13 @@ testGetThreadInfo(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { jvmtiThreadInfo inf0; jvmtiThreadInfo inf1; - err = jvmti->GetThreadInfo(NULL, &inf0); + err = jvmti->GetThreadInfo(nullptr, &inf0); check(jni, "GetThreadInfo", err); err = jvmti->GetThreadInfo(thread, &inf1); check(jni, "GetThreadInfo", err); - const char* name = (inf0.name == NULL) ? "" : inf0.name; + const char* name = (inf0.name == nullptr) ? "" : inf0.name; LOG("Agent: GetThreadInfo: current thread: %s\n", name); if (strcmp(inf0.name, inf1.name) != 0) { @@ -121,7 +121,7 @@ testGetThreadState(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { jint state0 = 0; jint state1 = 0; - err = jvmti->GetThreadState(NULL, &state0); + err = jvmti->GetThreadState(nullptr, &state0); check_jvmti_status(jni, err, "GetThreadState"); err = jvmti->GetThreadState(thread, &state1); @@ -145,7 +145,7 @@ testGetFrameCount(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { err = jvmti->GetFrameCount(thread, &count0); check_jvmti_status(jni, err,"GetFrameCount"); - err = jvmti->GetFrameCount(NULL, &count1); + err = jvmti->GetFrameCount(nullptr, &count1); check_jvmti_status(jni, err,"GetFrameCount"); if (count0 != count1) { @@ -163,24 +163,24 @@ testGetFrameLocation(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { const jint DEPTH = 1; jlocation loc0 = 0; jlocation loc1 = 0; - jmethodID method0 = NULL; - jmethodID method1 = NULL; - char* name0 = NULL; - char* name1 = NULL; - char* sign0 = NULL; - char* sign1 = NULL; - - err = jvmti->GetFrameLocation(NULL, DEPTH, &method0, &loc0); + jmethodID method0 = nullptr; + jmethodID method1 = nullptr; + char* name0 = nullptr; + char* name1 = nullptr; + char* sign0 = nullptr; + char* sign1 = nullptr; + + err = jvmti->GetFrameLocation(nullptr, DEPTH, &method0, &loc0); check_jvmti_status(jni, err, "GetFrameLocation"); err = jvmti->GetFrameLocation(thread, DEPTH, &method1, &loc1); check_jvmti_status(jni, err, "GetFrameLocation"); - err = jvmti->GetMethodName(method0, &name0, &sign0, NULL); + err = jvmti->GetMethodName(method0, &name0, &sign0, nullptr); check_jvmti_status(jni, err, "GetMethodName"); if (method0 != method1) { - err = jvmti->GetMethodName(method1, &name1, &sign1, NULL); + err = jvmti->GetMethodName(method1, &name1, &sign1, nullptr); check_jvmti_status(jni, err, "GetMethodName"); failed_status = JNI_TRUE; @@ -207,7 +207,7 @@ testGetStackTrace(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { memset(frames0, 0, sizeof(frames0)); memset(frames1, 0, sizeof(frames1)); - err = jvmti->GetStackTrace(NULL, 0, MAX_FRAME_CNT, frames0, &count0); + err = jvmti->GetStackTrace(nullptr, 0, MAX_FRAME_CNT, frames0, &count0); check_jvmti_status(jni, err, "GetStackTrace"); err = jvmti->GetStackTrace(thread, 0, MAX_FRAME_CNT, frames1, &count1); @@ -226,8 +226,8 @@ testGetOwnedMonitorInfo(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { jvmtiError err; jint count0 = 0; jint count1 = 0; - jobject* monitors0 = NULL; - jobject* monitors1 = NULL; + jobject* monitors0 = nullptr; + jobject* monitors1 = nullptr; err = jvmti->GetOwnedMonitorInfo(thread, &count0, &monitors0); check_jvmti_status(jni, err, "GetOwnedMonitorInfo"); @@ -263,10 +263,10 @@ testGetOwnedMonitorStackDepthInfo(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) jvmtiError err; jint count0 = 0; jint count1 = 0; - jvmtiMonitorStackDepthInfo* inf0 = NULL; - jvmtiMonitorStackDepthInfo* inf1 = NULL; + jvmtiMonitorStackDepthInfo* inf0 = nullptr; + jvmtiMonitorStackDepthInfo* inf1 = nullptr; - err = jvmti->GetOwnedMonitorStackDepthInfo(NULL, &count0, &inf0); + err = jvmti->GetOwnedMonitorStackDepthInfo(nullptr, &count0, &inf0); check_jvmti_status(jni, err, "GetOwnedMonitorStackDepthInfo"); err = jvmti->GetOwnedMonitorStackDepthInfo(thread, &count1, &inf1); @@ -302,10 +302,10 @@ testGetOwnedMonitorStackDepthInfo(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) static void testGetCurrentContendedMonitor(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { jvmtiError err; - jobject monitor0 = NULL; - jobject monitor1 = NULL; + jobject monitor0 = nullptr; + jobject monitor1 = nullptr; - err = jvmti->GetCurrentContendedMonitor(NULL, &monitor0); + err = jvmti->GetCurrentContendedMonitor(nullptr, &monitor0); check_jvmti_status(jni, err, "GetCurrentContendedMonitor"); err = jvmti->GetCurrentContendedMonitor(thread, &monitor1); @@ -321,17 +321,17 @@ testGetCurrentContendedMonitor(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { } /* - * Execute JVMTI functions with NULL jthread and check the result is correct. + * Execute JVMTI functions with nullptr jthread and check the result is correct. */ JNIEXPORT void JNICALL Java_NullAsCurrentThreadTest_testJvmtiFunctions(JNIEnv *jni, jclass cls) { jvmtiError err; - jthread cur_thr = NULL; + jthread cur_thr = nullptr; err = jvmti->GetCurrentThread(&cur_thr); check(jni, "GetCurrentThread", err); - LOG("Testing JMTI functions accepting NULL jthread as current thread\n"); + LOG("Testing JMTI functions accepting null jthread as current thread\n"); testGetThreadInfo(jvmti, jni, cur_thr); testGetThreadState(jvmti, jni, cur_thr); @@ -395,7 +395,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { if (err != JVMTI_ERROR_NONE) { LOG("Agent_OnLoad: error in JVMTI SetEventCallbacks: %d\n", err); } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, EXT_EVENT_VIRTUAL_THREAD_MOUNT, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, EXT_EVENT_VIRTUAL_THREAD_MOUNT, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("Agent_OnLoad: error in JVMTI SetEventNotificationMode: %d\n", err); } diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/PinnedTaskTest/libPinnedTaskTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/PinnedTaskTest/libPinnedTaskTest.cpp index f7f740ae9e17..91f5e6fecc2a 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/PinnedTaskTest/libPinnedTaskTest.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/PinnedTaskTest/libPinnedTaskTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,11 +22,11 @@ */ #include "jvmti.h" -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static void JNICALL agent_proc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/PopFrameTest/libPopFrameTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/PopFrameTest/libPopFrameTest.cpp index 749a63c76ead..4118251cf4f7 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/PopFrameTest/libPopFrameTest.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/PopFrameTest/libPopFrameTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ #include #include #include "jvmti.h" -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { @@ -71,7 +71,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { LOG("Agent init\n"); res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Agent init: Failed in GetEnv!\n"); return JNI_ERR; } @@ -116,19 +116,19 @@ Java_PopFrameTest_prepareAgent(JNIEnv *jni, jclass cls, jclass task_clazz, jbool LOG("Main: prepareAgent started\n"); - if (jvmti == NULL) { + if (jvmti == nullptr) { fatal(jni, "prepareAgent: Failed as JVMTI client was not properly loaded!\n"); } do_pop_frame = do_pop; mid_B = jni->GetStaticMethodID(task_clazz, "B", "()V"); - if (mid_B == NULL) { + if (mid_B == nullptr) { fatal(jni, "prepareAgent: Failed to find Method ID for method: TestTask.B()\n"); } err = jvmti->SetBreakpoint(mid_B, 0); check_jvmti_status(jni, err, "prepareAgent: Failed in JVMTI SetBreakpoint"); - set_event_notification_mode(jvmti, JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL); + set_event_notification_mode(jvmti, JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, nullptr); LOG("Main: prepareAgent finished\n"); } diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/RawMonitorTest/libRawMonitorTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/RawMonitorTest/libRawMonitorTest.cpp index 89015fe4bcb1..1903e2563922 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/RawMonitorTest/libRawMonitorTest.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/RawMonitorTest/libRawMonitorTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,11 +25,11 @@ #include #include "jvmti.h" -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jrawMonitorID monitor; JNIEXPORT void JNICALL diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/SelfSuspendDisablerTest/libSelfSuspendDisablerTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/SelfSuspendDisablerTest/libSelfSuspendDisablerTest.cpp index fdb8110aa578..a7d61b90e51f 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/SelfSuspendDisablerTest/libSelfSuspendDisablerTest.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/SelfSuspendDisablerTest/libSelfSuspendDisablerTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2024, 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,9 +23,9 @@ #include #include "jvmti.h" -#include "jvmti_common.h" +#include "jvmti_common.hpp" -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; extern "C" { @@ -50,12 +50,12 @@ Java_SelfSuspendDisablerTest_isSuspended(JNIEnv* jni, jclass cls, jthread thread JNIEXPORT void JNICALL Java_SelfSuspendDisablerTest_suspendAllVirtualThreads(JNIEnv* jni, jclass cls) { - check_jvmti_status(jni, jvmti->SuspendAllVirtualThreads(0, NULL), "Error in SuspendAllVirtualThreads"); + check_jvmti_status(jni, jvmti->SuspendAllVirtualThreads(0, nullptr), "Error in SuspendAllVirtualThreads"); } JNIEXPORT void JNICALL Java_SelfSuspendDisablerTest_resumeAllVirtualThreads(JNIEnv* jni, jclass cls) { - check_jvmti_status(jni, jvmti->ResumeAllVirtualThreads(0, NULL), "Error in ResumeAllVirtualThreads"); + check_jvmti_status(jni, jvmti->ResumeAllVirtualThreads(0, nullptr), "Error in ResumeAllVirtualThreads"); } JNIEXPORT jint JNICALL diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/StopThreadTest/libStopThreadTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/StopThreadTest/libStopThreadTest.cpp index 9cb9bc4c5a45..36f70a971a0c 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/StopThreadTest/libStopThreadTest.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/StopThreadTest/libStopThreadTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,14 +24,14 @@ #include #include #include "jvmti.h" -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { -static jvmtiEnv *jvmti = NULL; -static jmethodID mid_B = NULL; -static jobject exception_obj = NULL; -static jrawMonitorID monitor = NULL; +static jvmtiEnv *jvmti = nullptr; +static jmethodID mid_B = nullptr; +static jobject exception_obj = nullptr; +static jrawMonitorID monitor = nullptr; static volatile bool bp_sync_reached = false; static void JNICALL @@ -73,7 +73,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { LOG("Agent init\n"); res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Agent init: Failed in GetEnv!\n"); return JNI_ERR; } @@ -118,21 +118,21 @@ Java_StopThreadTest_prepareAgent(JNIEnv *jni, jclass cls, jclass task_clazz, job LOG("Main: prepareAgent started\n"); - if (jvmti == NULL) { + if (jvmti == nullptr) { fatal(jni, "prepareAgent: Failed as JVMTI client was not properly loaded!\n"); } exception_obj = jni->NewGlobalRef(exc_obj); - if (exception_obj == NULL) { + if (exception_obj == nullptr) { fatal(jni, "prepareAgent: Failed in JNI NewGlobalRef\n"); } mid_B = jni->GetStaticMethodID(task_clazz, "B", "()V"); - if (mid_B == NULL) { + if (mid_B == nullptr) { fatal(jni, "prepareAgent: Failed to find Method ID for method: TestTask.B()\n"); } err = jvmti->SetBreakpoint(mid_B, 0); check_jvmti_status(jni, err, "prepareAgent: Failed in JVMTI SetBreakpoint"); - set_event_notification_mode(jvmti, JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL); + set_event_notification_mode(jvmti, JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, nullptr); LOG("Main: prepareAgent finished\n"); } diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/SuspendResume1/libSuspendResume1.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/SuspendResume1/libSuspendResume1.cpp index 78f1922f5464..f05e619e0bd7 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/SuspendResume1/libSuspendResume1.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/SuspendResume1/libSuspendResume1.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2024, 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,8 @@ #include #include "jvmti.h" -#include "jvmti_common.h" -#include "jvmti_thread.h" +#include "jvmti_common.hpp" +#include "jvmti_thread.hpp" extern "C" { @@ -35,8 +35,8 @@ extern "C" { static const char* CTHREAD_NAME_START = "ForkJoinPool"; static const int CTHREAD_NAME_START_LEN = (int)strlen("ForkJoinPool"); -static jvmtiEnv *jvmti = NULL; -static jrawMonitorID agent_event_lock = NULL; +static jvmtiEnv *jvmti = nullptr; +static jrawMonitorID agent_event_lock = nullptr; static jthread tested_vthreads[VTHREAD_CNT]; static int vthread_no = 0; @@ -48,7 +48,7 @@ test_get_stack_trace(JNIEnv *jni, jthread thread) { static void test_get_thread_list_stack_traces(JNIEnv *jni, bool is_virt, jint thread_cnt, jthread* thread_list) { - jvmtiStackInfo* stack_info_arr = NULL; + jvmtiStackInfo* stack_info_arr = nullptr; LOG("## Agent: test_get_thread_list_stack_traces started: is virtual: %d, count: %d\n\n", is_virt, thread_cnt); @@ -70,9 +70,9 @@ static void test_get_frame_location(JNIEnv* jni, jthread thread, char* tname) { const jint DEPTH = 1; jlocation loc = 0; - jmethodID method = NULL; - char* name = NULL; - char* sign = NULL; + jmethodID method = nullptr; + char* name = nullptr; + char* sign = nullptr; jboolean is_virtual = jni->IsVirtualThread(thread); jvmtiError err = jvmti->GetFrameLocation(thread, DEPTH, &method, &loc); @@ -84,7 +84,7 @@ test_get_frame_location(JNIEnv* jni, jthread thread, char* tname) { } return; } - err = jvmti->GetMethodName(method, &name, &sign, NULL); + err = jvmti->GetMethodName(method, &name, &sign, nullptr); check_jvmti_status(jni, err, "test_get_frame_location: error in JVMTI GetMethodName"); LOG("Agent: GetFrameLocation: frame for current thread %s: method: %s%s, loc: %lld\n", @@ -93,7 +93,7 @@ test_get_frame_location(JNIEnv* jni, jthread thread, char* tname) { static jint get_cthreads(JNIEnv* jni, jthread** cthreads_p) { - jthread* tested_cthreads = NULL; + jthread* tested_cthreads = nullptr; jint all_cnt = 0; jint ct_cnt = 0; @@ -313,7 +313,7 @@ test_jvmti_functions_for_threads(JNIEnv* jni, bool is_virt, jint thread_cnt, jth JNIEXPORT void JNICALL Java_SuspendResume1_TestSuspendResume(JNIEnv* jni, jclass cls) { - jthread* tested_cthreads = NULL; + jthread* tested_cthreads = nullptr; jint cthread_cnt = 0; LOG("\n## TestSuspendResume: Test carrier threads\n"); @@ -395,7 +395,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_VIRTUAL_THREAD_START, NULL); + JVMTI_EVENT_VIRTUAL_THREAD_START, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("Agent init: error in JVMTI SetEventNotificationMode: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/SuspendResume2/libSuspendResume2.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/SuspendResume2/libSuspendResume2.cpp index 56faa994be5a..68066c04575a 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/SuspendResume2/libSuspendResume2.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/SuspendResume2/libSuspendResume2.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2024, 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,8 @@ #include #include "jvmti.h" -#include "jvmti_common.h" -#include "jvmti_thread.h" +#include "jvmti_common.hpp" +#include "jvmti_thread.hpp" extern "C" { @@ -35,16 +35,16 @@ extern "C" { static const char* CTHREAD_NAME_START = "ForkJoinPool"; static const int CTHREAD_NAME_START_LEN = (int)strlen("ForkJoinPool"); -static jvmtiEnv *jvmti = NULL; -static jrawMonitorID agent_event_lock = NULL; -static volatile jthread agent_thread = NULL; +static jvmtiEnv *jvmti = nullptr; +static jrawMonitorID agent_event_lock = nullptr; +static volatile jthread agent_thread = nullptr; static jthread tested_vthreads[VTHREAD_CNT]; static int vthread_no = 0; static jint get_cthreads(JNIEnv* jni, jthread** cthreads_p) { - jthread* tested_cthreads = NULL; + jthread* tested_cthreads = nullptr; jint all_cnt = 0; jint ct_cnt = 0; @@ -106,7 +106,7 @@ test_vthread_suspend_all(JNIEnv* jni, const jthread* thread_list, int suspend_ma LOG("\n## Agent: test_vthread_suspend_all started\n"); const jint EXCLUDE_CNT = 2; - jthread exclude_list[EXCLUDE_CNT] = { NULL, NULL }; + jthread exclude_list[EXCLUDE_CNT] = { nullptr, nullptr }; for (int idx = 0; idx < EXCLUDE_CNT; idx++) { exclude_list[idx] = thread_list[idx]; } @@ -138,7 +138,7 @@ test_vthread_resume_all(JNIEnv* jni, const jthread* thread_list, int suspend_mas LOG("\n## Agent: test_vthread_resume_all started\n"); const jint EXCLUDE_CNT = 2; - jthread exclude_list[EXCLUDE_CNT] = { NULL, NULL }; + jthread exclude_list[EXCLUDE_CNT] = { nullptr, nullptr }; for (int idx = 0; idx < EXCLUDE_CNT; idx++) { exclude_list[idx] = thread_list[idx]; } @@ -224,7 +224,7 @@ check_threads_resumed_state(JNIEnv* jni, const jthread* thread_list, int thread_ JNIEXPORT void JNICALL Java_SuspendResume2_TestSuspendResume(JNIEnv* jni, jclass cls) { - jthread* tested_cthreads = NULL; + jthread* tested_cthreads = nullptr; LOG("\n## TestSuspendResume: started\n"); @@ -310,7 +310,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_VIRTUAL_THREAD_START, NULL); + JVMTI_EVENT_VIRTUAL_THREAD_START, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("Agent init: error in JVMTI SetEventNotificationMode: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/SuspendResumeAll/libSuspendResumeAll.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/SuspendResumeAll/libSuspendResumeAll.cpp index 7270d237d74c..e53484b575b7 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/SuspendResumeAll/libSuspendResumeAll.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/SuspendResumeAll/libSuspendResumeAll.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2024, 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,8 @@ #include #include "jvmti.h" -#include "jvmti_common.h" -#include "jvmti_thread.h" +#include "jvmti_common.hpp" +#include "jvmti_thread.hpp" extern "C" { @@ -35,21 +35,21 @@ extern "C" { static const char* CTHREAD_NAME_START = "ForkJoinPool"; static const int CTHREAD_NAME_START_LEN = (int)strlen("ForkJoinPool"); -static jvmtiEnv *jvmti = NULL; -static jrawMonitorID agent_event_lock = NULL; -static volatile jthread agent_thread = NULL; +static jvmtiEnv *jvmti = nullptr; +static jrawMonitorID agent_event_lock = nullptr; +static volatile jthread agent_thread = nullptr; static jthread tested_vthreads[VTHREAD_CNT]; static int vthread_no = 0; -static jmethodID *test_methods = NULL; +static jmethodID *test_methods = nullptr; jint test_method_count = 0; -jclass test_class = NULL; +jclass test_class = nullptr; static void set_or_clear_breakpoint(JNIEnv *jni, jboolean set, const char *methodName, jclass klass, jmethodID methods[], int method_count) { jlocation location = (jlocation)0L; - jmethodID method = NULL; + jmethodID method = nullptr; jvmtiError err; // Find the jmethodID of the specified method @@ -63,7 +63,7 @@ set_or_clear_breakpoint(JNIEnv *jni, jboolean set, const char *methodName, } deallocate(jvmti, jni, (void*)mname); } - if (method == NULL) { + if (method == nullptr) { LOG("setupBreakpoint: not found method %s() to %s a breakpoint\n", methodName, set ? "set" : "clear"); jni->FatalError("Error in setupBreakpoint: not found method"); @@ -109,7 +109,7 @@ Java_SuspendResumeAll_setBreakpoint(JNIEnv *jni, jclass klass, jclass testKlass) static jint get_cthreads(JNIEnv* jni, jthread** cthreads_p) { - jthread* tested_cthreads = NULL; + jthread* tested_cthreads = nullptr; jint all_cnt = 0; jint ct_cnt = 0; @@ -171,7 +171,7 @@ test_vthread_suspend_all(JNIEnv* jni, const jthread* thread_list, int suspend_ma LOG("\n## Agent: test_vthread_suspend_all started\n"); const jint EXCLUDE_CNT = 2; - jthread exclude_list[EXCLUDE_CNT] = { NULL, NULL }; + jthread exclude_list[EXCLUDE_CNT] = { nullptr, nullptr }; for (int idx = 0; idx < EXCLUDE_CNT; idx++) { exclude_list[idx] = thread_list[idx]; } @@ -204,7 +204,7 @@ test_vthread_resume_all(JNIEnv* jni, const jthread* thread_list, int suspend_mas LOG("\n## Agent: test_vthread_resume_all started\n"); const jint EXCLUDE_CNT = 2; - jthread exclude_list[EXCLUDE_CNT] = { NULL, NULL }; + jthread exclude_list[EXCLUDE_CNT] = { nullptr, nullptr }; for (int idx = 0; idx < EXCLUDE_CNT; idx++) { exclude_list[idx] = thread_list[idx]; // Enable Breakpoint events on excluded thread @@ -264,7 +264,7 @@ check_threads_resumed_state(JNIEnv* jni, const jthread* thread_list, int thread_ JNIEXPORT void JNICALL Java_SuspendResumeAll_TestSuspendResume(JNIEnv* jni, jclass cls) { - jthread* tested_cthreads = NULL; + jthread* tested_cthreads = nullptr; jint cthread_cnt = get_cthreads(jni, &tested_cthreads); LOG("\n## TestSuspendResume: started\n"); @@ -368,7 +368,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_VIRTUAL_THREAD_START, NULL); + JVMTI_EVENT_VIRTUAL_THREAD_START, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("Agent init: error in JVMTI SetEventNotificationMode: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/ThreadListStackTracesTest/libThreadListStackTracesTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/ThreadListStackTracesTest/libThreadListStackTracesTest.cpp index 7441343ac40e..918f547375b8 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/ThreadListStackTracesTest/libThreadListStackTracesTest.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/ThreadListStackTracesTest/libThreadListStackTracesTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ #include #include #include -#include "jvmti_common.h" +#include "jvmti_common.hpp" static jvmtiEnv* jvmti = nullptr; static const jint MAX_FRAME_COUNT = 32; @@ -34,7 +34,7 @@ extern "C" { JNIEXPORT jint JNICALL Java_ThreadListStackTracesTest_getStateSingle(JNIEnv* jni, jclass clazz, jthread vthread) { - jvmtiStackInfo* info = NULL; + jvmtiStackInfo* info = nullptr; jvmtiError err = jvmti->GetThreadListStackTraces(1, &vthread, MAX_FRAME_COUNT, &info); check_jvmti_status(jni, err, "getStateSingle: error in JVMTI GetThreadListStackTraces"); @@ -45,7 +45,7 @@ Java_ThreadListStackTracesTest_getStateSingle(JNIEnv* jni, jclass clazz, jthread JNIEXPORT jint JNICALL Java_ThreadListStackTracesTest_getStateMultiple(JNIEnv* jni, jclass clazz, jthread vhread, jthread other) { jthread threads[2] = { vhread, other }; - jvmtiStackInfo* info = NULL; + jvmtiStackInfo* info = nullptr; jvmtiError err = jvmti->GetThreadListStackTraces(2, threads, MAX_FRAME_COUNT, &info); check_jvmti_status(jni, err, "getStateMultiple: error in JVMTI GetThreadListStackTraces"); diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/ThreadStateTest/libThreadStateTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/ThreadStateTest/libThreadStateTest.cpp index 895a2ba198e9..10dfdfda3472 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/ThreadStateTest/libThreadStateTest.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/ThreadStateTest/libThreadStateTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ #include #include #include -#include "jvmti_common.h" +#include "jvmti_common.hpp" // set by Agent_OnLoad static jvmtiEnv* jvmti = nullptr; @@ -87,7 +87,7 @@ JNIEXPORT void JNICALL Java_ThreadStateTest_testGetThreadListStackTraces(JNIEnv* jni, jclass klass, jthread vthread) { jthread cthread = get_carrier_thread(jvmti, jni, vthread); jthread threads[2] = { cthread, vthread }; - jvmtiStackInfo* stackInfo = NULL; + jvmtiStackInfo* stackInfo = nullptr; jvmtiError err = jvmti->GetThreadListStackTraces(2, threads, MAX_FRAME_COUNT, &stackInfo); check_jvmti_status(jni, err, "testGetThreadState: error in JVMTI GetThreadListStackTraces"); diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/ToggleNotifyJvmtiTest/libToggleNotifyJvmtiTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/ToggleNotifyJvmtiTest/libToggleNotifyJvmtiTest.cpp index 1cf4a06592cf..b09565f886af 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/ToggleNotifyJvmtiTest/libToggleNotifyJvmtiTest.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/ToggleNotifyJvmtiTest/libToggleNotifyJvmtiTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ #include #include #include -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { @@ -34,13 +34,13 @@ static volatile int vthread_ended_cnt = 0; static volatile int thread_started_cnt = 0; static volatile int thread_ended_cnt = 0; -static jrawMonitorID agent_lock = NULL; +static jrawMonitorID agent_lock = nullptr; static volatile jboolean agent_started = JNI_FALSE; static void check_and_print_thread_names(jvmtiEnv *jvmti, JNIEnv* jni, jthread thread, bool is_virtual, const char* msg) { - jthread cthread = NULL; - jthread vthread = NULL; + jthread cthread = nullptr; + jthread vthread = nullptr; if (is_virtual) { vthread = thread; @@ -52,7 +52,7 @@ static void check_and_print_thread_names(jvmtiEnv *jvmti, JNIEnv* jni, jthread t cthread = thread; } char* ctname = get_thread_name(jvmti, jni, cthread); - char* vtname = vthread == NULL ? NULL : get_thread_name(jvmti, jni, vthread); + char* vtname = vthread == nullptr ? nullptr : get_thread_name(jvmti, jni, vthread); LOG("Event: %s virtual: %d ct: %s vt: %s\n", msg, is_virtual, ctname, vtname); @@ -158,22 +158,22 @@ jint agent_init(JavaVM *jvm, char *options, void *reserved) { LOG("Agent init: error in JVMTI AddCapabilities: %s (%d)\n", TranslateError(err), err); return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VIRTUAL_THREAD_START, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VIRTUAL_THREAD_START, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("Agent init: error in JVMTI SetEventNotificationMode: %s (%d)\n", TranslateError(err), err); return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VIRTUAL_THREAD_END, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VIRTUAL_THREAD_END, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("Agent init: error in JVMTI SetEventNotificationMode: %s (%d)\n", TranslateError(err), err); return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("Agent init: error in JVMTI SetEventNotificationMode: %s (%d)\n", TranslateError(err), err); return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_END, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_END, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("Agent init: error in JVMTI SetEventNotificationMode: %s (%d)\n", TranslateError(err), err); return JNI_ERR; diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/VThreadEventTest/libVThreadEventTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/VThreadEventTest/libVThreadEventTest.cpp index 24b678eb18e9..afd06e66b32c 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/VThreadEventTest/libVThreadEventTest.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/VThreadEventTest/libVThreadEventTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ #include #include #include -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/VThreadMonitorTest/libVThreadMonitorTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/VThreadMonitorTest/libVThreadMonitorTest.cpp index 72be78078bba..af0861ee0318 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/VThreadMonitorTest/libVThreadMonitorTest.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/VThreadMonitorTest/libVThreadMonitorTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ #include #include "jvmti.h" #include "jni.h" -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { @@ -35,13 +35,13 @@ extern "C" { #define TEST_CLASS_0 "MonitorClass0" #define TEST_CLASS_2 "MonitorClass2" -static jvmtiEnv *jvmti = NULL; -static jrawMonitorID agent_monitor = NULL; +static jvmtiEnv *jvmti = nullptr; +static jrawMonitorID agent_monitor = nullptr; static volatile bool was_lock0_contended = false; static volatile bool was_lock2_contended = false; static volatile jint status = STATUS_PASSED; -static volatile jclass test_class_0 = NULL; -static volatile jclass test_class_2 = NULL; +static volatile jclass test_class_0 = nullptr; +static volatile jclass test_class_2 = nullptr; static jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved); @@ -60,7 +60,7 @@ static void ShowErrorMessage(jvmtiEnv *jvmti, jvmtiError errCode, } static jboolean CheckLockObject0(JNIEnv *jni, jobject monitor) { - if (test_class_0 == NULL) { + if (test_class_0 == nullptr) { // JNI_OnLoad has not been called yet, so can't possibly be an instance of TEST_CLASS_0. return JNI_FALSE; } @@ -68,7 +68,7 @@ static jboolean CheckLockObject0(JNIEnv *jni, jobject monitor) { } static jboolean CheckLockObject2(JNIEnv *jni, jobject monitor) { - if (test_class_2 == NULL) { + if (test_class_2 == nullptr) { // JNI_OnLoad has not been called yet, so can't possibly be an instance of TEST_CLASS_2. return JNI_FALSE; } @@ -98,7 +98,7 @@ check_contended_monitor(jvmtiEnv *jvmti, JNIEnv *jni, const char* func, jni->IsSameObject(monitor2, contended_monitor) == JNI_FALSE) { LOG("FAIL: is_vt: %d: unexpected monitor from GetCurrentContendedMonitor\n", is_vt); LOG("stack trace of current thread:\n"); - print_stack_trace(jvmti, jni, NULL); + print_stack_trace(jvmti, jni, nullptr); LOG("stack trace of target thread:\n"); print_stack_trace(jvmti, jni, thread); status = STATUS_FAILED; @@ -123,7 +123,7 @@ check_owned_monitor(jvmtiEnv *jvmti, JNIEnv *jni, const char* func, jvmtiError err; jint state = 0; jint mcount = -1; - jobject *owned_monitors = NULL; + jobject *owned_monitors = nullptr; err = jvmti->GetOwnedMonitorInfo(thread, &mcount, &owned_monitors); if (err != JVMTI_ERROR_NONE) { @@ -182,9 +182,9 @@ MonitorContendedEnter(jvmtiEnv *jvmti, JNIEnv *jni, jthread vthread, jobject mon char* ctname = get_thread_name(jvmti, jni, cthread); check_contended_monitor(jvmti, jni, "MonitorContendedEnter", - vthread, vtname, JNI_TRUE, monitor, NULL); + vthread, vtname, JNI_TRUE, monitor, nullptr); check_contended_monitor(jvmti, jni, "MonitorContendedEnter", - cthread, ctname, JNI_FALSE, NULL, NULL); + cthread, ctname, JNI_FALSE, nullptr, nullptr); check_owned_monitor(jvmti, jni, "MonitorContendedEnter", vthread, vtname, JNI_TRUE, monitor); check_owned_monitor(jvmti, jni, "MonitorContendedEnter", @@ -204,9 +204,9 @@ MonitorContendedEntered(jvmtiEnv *jvmti, JNIEnv *jni, jthread vthread, jobject m char* ctname = get_thread_name(jvmti, jni, cthread); check_contended_monitor(jvmti, jni, "MonitorContendedEntered", - vthread, vtname, JNI_TRUE, NULL, NULL); + vthread, vtname, JNI_TRUE, nullptr, nullptr); check_contended_monitor(jvmti, jni, "MonitorContendedEntered", - cthread, ctname, JNI_FALSE, NULL, NULL); + cthread, ctname, JNI_FALSE, nullptr, nullptr); deallocate(jvmti, jni, (void*)vtname); deallocate(jvmti, jni, (void*)ctname); @@ -226,7 +226,7 @@ static jclass find_test_class(JNIEnv *jni, const char* cname) { jclass k = jni->FindClass(cname); - if (k == NULL) { + if (k == nullptr) { LOG("Error: Could not find class %s!\n", cname); } else { k = (jclass)jni->NewGlobalRef(k); @@ -240,7 +240,7 @@ JNI_OnLoad(JavaVM *jvm, void *reserved) { JNIEnv *jni; res = jvm->GetEnv((void **)&jni, JNI_VERSION_9); - if (res != JNI_OK || jni == NULL) { + if (res != JNI_OK || jni == nullptr) { LOG("Error: GetEnv call failed(%d)!\n", res); return JNI_ERR; } @@ -248,7 +248,7 @@ JNI_OnLoad(JavaVM *jvm, void *reserved) { test_class_0 = find_test_class(jni, TEST_CLASS_0); test_class_2 = find_test_class(jni, TEST_CLASS_2); - if (test_class_0 == NULL || test_class_2 == NULL) { + if (test_class_0 == nullptr || test_class_2 == nullptr) { return JNI_ERR; } return JNI_VERSION_9; @@ -264,7 +264,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { LOG("Agent_OnLoad started\n"); res = jvm->GetEnv((void **)&jvmti, JVMTI_VERSION); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Error: wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -315,14 +315,14 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_MONITOR_CONTENDED_ENTER, NULL); + JVMTI_EVENT_MONITOR_CONTENDED_ENTER, nullptr); if (err != JVMTI_ERROR_NONE) { ShowErrorMessage(jvmti, err, "Agent_OnLoad", "error in JVMTI SetEventNotificationMode #1"); return JNI_ERR; } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_MONITOR_CONTENDED_ENTERED, NULL); + JVMTI_EVENT_MONITOR_CONTENDED_ENTERED, nullptr); if (err != JVMTI_ERROR_NONE) { ShowErrorMessage(jvmti, err, "Agent_OnLoad", "error in JVMTI SetEventNotificationMode #2"); diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/VThreadNotifyFramePopTest/libVThreadNotifyFramePopTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/VThreadNotifyFramePopTest/libVThreadNotifyFramePopTest.cpp index 55803e5abf5b..30382a87ee9b 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/VThreadNotifyFramePopTest/libVThreadNotifyFramePopTest.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/VThreadNotifyFramePopTest/libVThreadNotifyFramePopTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2024, 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,38 +23,38 @@ #include #include "jvmti.h" -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { #define MAX_FRAME_COUNT 20 -static jvmtiEnv *jvmti = NULL; -static jrawMonitorID event_mon = NULL; +static jvmtiEnv *jvmti = nullptr; +static jrawMonitorID event_mon = nullptr; static int breakpoint_count = 0; static int frame_pop_count = 0; static int brkptBreakpointHit = 0; static jboolean received_frame_pop_event = JNI_FALSE; static jboolean passed = JNI_TRUE; -static jmethodID *test_methods = NULL; +static jmethodID *test_methods = nullptr; jint test_method_count = 0; -jclass test_class = NULL; +jclass test_class = nullptr; -static jmethodID *url_methods = NULL; +static jmethodID *url_methods = nullptr; jint url_method_count = 0; -jclass url_class = NULL; +jclass url_class = nullptr; static void print_frame_event_info(jvmtiEnv *jvmti, JNIEnv* jni, jthread thread, jmethodID method, const char* event_name, int event_count) { char* tname = get_thread_name(jvmti, jni, thread); char* cname = get_method_class_name(jvmti, jni, method); - char* mname = NULL; - char* msign = NULL; + char* mname = nullptr; + char* msign = nullptr; jvmtiError err; - err = jvmti->GetMethodName(method, &mname, &msign, NULL); + err = jvmti->GetMethodName(method, &mname, &msign, nullptr); check_jvmti_status(jni, err, "event handler: error in JVMTI GetMethodName call"); LOG("%s #%d: thread: %s, method: %s.%s%s\n", @@ -84,7 +84,7 @@ static void set_or_clear_breakpoint(JNIEnv *jni, jboolean set, const char *methodName, jclass klass, jmethodID methods[], int method_count) { jlocation location = (jlocation)0L; - jmethodID method = NULL; + jmethodID method = nullptr; jvmtiError err; // Find the jmethodID of the specified method @@ -98,7 +98,7 @@ set_or_clear_breakpoint(JNIEnv *jni, jboolean set, const char *methodName, } deallocate(jvmti, jni, (void*)mname); } - if (method == NULL) { + if (method == nullptr) { LOG("setupBreakpoint: not found method %s() to %s a breakpoint\n", methodName, set ? "set" : "clear"); jni->FatalError("Error in setupBreakpoint: not found method"); @@ -237,7 +237,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { LOG("Agent_OnLoad: Error in JVMTI SetEventCallbacks: %d\n", err); } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FRAME_POP, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FRAME_POP, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("error in JVMTI SetEventNotificationMode: %d\n", err); } @@ -268,7 +268,7 @@ Java_VThreadNotifyFramePopTest_enableEvents(JNIEnv *jni, jclass klass, jthread t set_breakpoint(jni, "openStream", urlKlass, url_methods, url_method_count); // Enable Breakpoint events globally - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, nullptr); check_jvmti_status(jni, err, "enableEvents: error in JVMTI SetEventNotificationMode: enable BREAKPOINT"); LOG("enableEvents: finished\n"); diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/VThreadTLSTest/libVThreadTLSTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/VThreadTLSTest/libVThreadTLSTest.cpp index ac4da3a76a75..278f44995032 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/VThreadTLSTest/libVThreadTLSTest.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/VThreadTLSTest/libVThreadTLSTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ #include #include #include -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/VThreadTest/libVThreadTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/VThreadTest/libVThreadTest.cpp index 32037f79f53b..9433a4dcfaf3 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/VThreadTest/libVThreadTest.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/VThreadTest/libVThreadTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2024, 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 @@ #include #include "jvmti.h" -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { @@ -36,8 +36,8 @@ typedef struct Tinfo { } Tinfo; static const int MAX_EVENTS_TO_PROCESS = 20; -static jvmtiEnv *jvmti = NULL; -static jrawMonitorID events_monitor = NULL; +static jvmtiEnv *jvmti = nullptr; +static jrawMonitorID events_monitor = nullptr; static Tinfo tinfo[MAX_WORKER_THREADS]; static int vthread_mount_count = 0; @@ -46,13 +46,13 @@ static jboolean passed = JNI_TRUE; static Tinfo* find_tinfo(JNIEnv* jni, const char* tname) { - Tinfo* inf = NULL; + Tinfo* inf = nullptr; int idx = 0; // Find slot with named worker thread or empty slot for (; idx < MAX_WORKER_THREADS; idx++) { inf = &tinfo[idx]; - if (inf->tname == NULL) { + if (inf->tname == nullptr) { inf->tname = (char*)malloc(strlen(tname) + 1); strcpy(inf->tname, tname); break; @@ -78,10 +78,10 @@ find_method_depth(jvmtiEnv *jvmti, JNIEnv *jni, jthread vthread, const char *mna for (int depth = 0; depth < count; depth++) { jmethodID method = frames[depth].method; - char* name = NULL; - char* sign = NULL; + char* name = nullptr; + char* sign = nullptr; - err = jvmti->GetMethodName(method, &name, &sign, NULL); + err = jvmti->GetMethodName(method, &name, &sign, nullptr); check_jvmti_status(jni, err, "find_method_depth: error in JVMTI GetMethodName"); if (strcmp(name, mname) == 0) { @@ -102,7 +102,7 @@ print_vthread_event_info(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, jthread v inf->just_scheduled = JNI_TRUE; } else { - if (inf->tname == NULL && strcmp(event_name, "VirtualThreadEnd") != 0) { + if (inf->tname == nullptr && strcmp(event_name, "VirtualThreadEnd") != 0) { fatal(jni, "VThread event: worker thread not found!"); } if (strcmp(event_name, "VirtualThreadUnmount") == 0) { @@ -117,19 +117,19 @@ print_vthread_event_info(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, jthread v static void test_GetVirtualThread(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, jthread vthread, const char *event_name) { - jobject thread_vthread = NULL; + jobject thread_vthread = nullptr; jvmtiError err; LOG("\ntest_GetVirtualThread: event: %s\n", event_name); - // #1: Test JVMTI GetVirtualThread extension function NULL thread (current) - err = GetVirtualThread(jvmti, jni, NULL, &thread_vthread); - check_jvmti_status(jni, err, "event handler: error in JVMTI GetVirtualThread with NULL thread (current)"); + // #1: Test JVMTI GetVirtualThread extension function nullptr thread (current) + err = GetVirtualThread(jvmti, jni, nullptr, &thread_vthread); + check_jvmti_status(jni, err, "event handler: error in JVMTI GetVirtualThread with null thread (current)"); - if (thread_vthread == NULL) { - fatal(jni, "event handler: JVMTI GetVirtualThread with NULL thread (current) failed to return non-NULL vthread"); + if (thread_vthread == nullptr) { + fatal(jni, "event handler: JVMTI GetVirtualThread with nullptr thread (current) failed to return non-null vthread"); } - LOG("JVMTI GetVirtualThread with NULL thread (current) returned non-NULL vthread as expected\n"); + LOG("JVMTI GetVirtualThread with nullptr thread (current) returned non-null vthread as expected\n"); // #2: Test JVMTI GetVirtualThread extension function with a bad thread err = GetVirtualThread(jvmti, jni, vthread, &thread_vthread); @@ -141,21 +141,21 @@ test_GetVirtualThread(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, jthread vthr err = GetVirtualThread(jvmti, jni,thread, &thread_vthread); check_jvmti_status(jni, err, "event handler: error in JVMTI GetVirtualThread"); - if (thread_vthread == NULL) { - fatal(jni, "event handler: JVMTI GetVirtualThread with good thread failed to return non-NULL vthread"); + if (thread_vthread == nullptr) { + fatal(jni, "event handler: JVMTI GetVirtualThread with good thread failed to return non-null vthread"); } - LOG("JVMTI GetVirtualThread with good thread returned non-NULL vthread as expected\n"); + LOG("JVMTI GetVirtualThread with good thread returned non-null vthread as expected\n"); } static void test_GetCarrierThread(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, jthread vthread, const char *event_name) { - jthread vthread_thread = NULL; + jthread vthread_thread = nullptr; jvmtiError err; LOG("\ntest_GetCarrierThread: event: %s\n", event_name); - // #1: Test JVMTI GetCarrierThread extension function with NULL vthread - err = GetCarrierThread(jvmti, jni, NULL, &vthread_thread); + // #1: Test JVMTI GetCarrierThread extension function with nullptr vthread + err = GetCarrierThread(jvmti, jni, nullptr, &vthread_thread); check_jvmti_status(jni, err, "event handler: error in JVMTI GetCarrierThread"); // #2: Test JVMTI GetCarrierThread extension function with a bad vthread @@ -168,10 +168,10 @@ test_GetCarrierThread(jvmtiEnv *jvmti, JNIEnv *jni, jthread thread, jthread vthr err = GetCarrierThread(jvmti, jni, vthread, &vthread_thread); check_jvmti_status(jni, err, "event handler: error in JVMTI GetCarrierThread"); - if (vthread_thread == NULL) { - fatal(jni, "event handler: JVMTI GetCarrierThread with good vthread failed to return non-NULL carrier thread"); + if (vthread_thread == nullptr) { + fatal(jni, "event handler: JVMTI GetCarrierThread with good vthread failed to return non-null carrier thread"); } - LOG("JVMTI GetCarrierThread with good vthread returned non-NULL carrier thread as expected\n"); + LOG("JVMTI GetCarrierThread with good vthread returned non-null carrier thread as expected\n"); } static void @@ -180,7 +180,7 @@ test_GetThreadInfo(jvmtiEnv *jvmti, JNIEnv *jni, jthread vthread, const char *ev jvmtiThreadInfo thr_info; jvmtiThreadGroupInfo ginfo; jint class_count = -1; - jclass* classes = NULL; + jclass* classes = nullptr; jboolean found = JNI_FALSE; LOG("test_GetThreadInfo: started\n"); @@ -207,11 +207,11 @@ test_GetThreadInfo(jvmtiEnv *jvmti, JNIEnv *jni, jthread vthread, const char *ev // #4: Test the thr_info.context_class_loader has the VThreadTest class for (int idx = 0; idx < class_count; idx++) { - char* sign = NULL; - err = jvmti->GetClassSignature(classes[idx], &sign, NULL); + char* sign = nullptr; + err = jvmti->GetClassSignature(classes[idx], &sign, nullptr); check_jvmti_status(jni, err, "event handler: error in JVMTI GetClassSignature"); - if (strstr(sign, "VThreadTest") != NULL) { + if (strstr(sign, "VThreadTest") != nullptr) { found = JNI_TRUE; break; } @@ -228,11 +228,11 @@ test_GetFrameCount(jvmtiEnv *jvmti, JNIEnv *jni, jthread vthread, const char *ev jint frame_count = -1; jvmtiError err; - // #1: Test JVMTI GetFrameCount function with NULL count_ptr pointer - err = jvmti->GetFrameCount(vthread, NULL); + // #1: Test JVMTI GetFrameCount function with nullptr count_ptr pointer + err = jvmti->GetFrameCount(vthread, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { - LOG("JVMTI GetFrameCount with NULL count_ptr returned error: %d\n", err); - fatal(jni, "event handler: JVMTI GetFrameCount with NULL count_ptr pointer failed to return JVMTI_ERROR_NULL_POINTER"); + LOG("JVMTI GetFrameCount with null count_ptr returned error: %d\n", err); + fatal(jni, "event handler: JVMTI GetFrameCount with null count_ptr pointer failed to return JVMTI_ERROR_NULL_POINTER"); } // #2: Test JVMTI GetFrameCount function with a good vthread @@ -249,7 +249,7 @@ test_GetFrameCount(jvmtiEnv *jvmti, JNIEnv *jni, jthread vthread, const char *ev static void test_GetFrameLocation(jvmtiEnv *jvmti, JNIEnv *jni, jthread vthread, const char *event_name, jint frame_count) { - jmethodID method = NULL; + jmethodID method = nullptr; jlocation location = -1; jvmtiError err; @@ -260,18 +260,18 @@ test_GetFrameLocation(jvmtiEnv *jvmti, JNIEnv *jni, jthread vthread, const char fatal(jni, "event handler: JVMTI GetFrameLocation with negative frame depth failed to return JVMTI_ERROR_ILLEGAL_ARGUMENT"); } - // #2: Test JVMTI GetFrameLocation function with NULL method_ptr - err = jvmti->GetFrameLocation(vthread, 0, NULL, &location); + // #2: Test JVMTI GetFrameLocation function with nullptr method_ptr + err = jvmti->GetFrameLocation(vthread, 0, nullptr, &location); if (err != JVMTI_ERROR_NULL_POINTER) { - LOG("JVMTI GetFrameLocation with NULL method_ptr returned error: %d\n", err); - fatal(jni, "event handler: JVMTI GetFrameLocation with NULL method_ptr failed to return JVMTI_ERROR_NULL_POINTER"); + LOG("JVMTI GetFrameLocation with null method_ptr returned error: %d\n", err); + fatal(jni, "event handler: JVMTI GetFrameLocation with null method_ptr failed to return JVMTI_ERROR_NULL_POINTER"); } - // #3: Test JVMTI GetFrameLocation function with NULL location_ptr - err = jvmti->GetFrameLocation(vthread, 0, &method, NULL); + // #3: Test JVMTI GetFrameLocation function with nullptr location_ptr + err = jvmti->GetFrameLocation(vthread, 0, &method, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { - LOG("JVMTI GetFrameCount with NULL location_ptr returned error: %d\n", err); - fatal(jni, "event handler: JVMTI GetFrameLocation with NULL location_ptr failed to return JVMTI_ERROR_NULL_POINTER"); + LOG("JVMTI GetFrameCount with null location_ptr returned error: %d\n", err); + fatal(jni, "event handler: JVMTI GetFrameLocation with null location_ptr failed to return JVMTI_ERROR_NULL_POINTER"); } // #4: Test JVMTI GetFrameLocation function with a good vthread @@ -304,7 +304,7 @@ static void test_GetStackTrace(jvmtiEnv *jvmti, JNIEnv *jni, jthread vthread, const char *event_name, jint frame_count) { jvmtiFrameInfo frames[MAX_FRAME_COUNT]; jint count = -1; - jmethodID method = NULL; + jmethodID method = nullptr; jvmtiError err; LOG("\n"); @@ -328,18 +328,18 @@ test_GetStackTrace(jvmtiEnv *jvmti, JNIEnv *jni, jthread vthread, const char *ev fatal(jni, "event handler: JVMTI GetStackTrace with negative max_frame_count failed to return JVMTI_ERROR_ILLEGAL_ARGUMENT"); } - // #3: Test JVMTI GetStackTrace function with NULL frame_buffer pointer - err = jvmti->GetStackTrace(vthread, 0, MAX_FRAME_COUNT, NULL, &count); + // #3: Test JVMTI GetStackTrace function with nullptr frame_buffer pointer + err = jvmti->GetStackTrace(vthread, 0, MAX_FRAME_COUNT, nullptr, &count); if (err != JVMTI_ERROR_NULL_POINTER) { - LOG("JVMTI GetStackTrace with NULL frame_buffer pointer returned error: %d\n", err); - fatal(jni, "event handler: JVMTI GetStackTrace witt NULL frame_buffer pointer failed to return JVMTI_ERROR_NULL_POINTER"); + LOG("JVMTI GetStackTrace with null frame_buffer pointer returned error: %d\n", err); + fatal(jni, "event handler: JVMTI GetStackTrace witt null frame_buffer pointer failed to return JVMTI_ERROR_NULL_POINTER"); } - // #4: Test JVMTI GetStackTrace function with NULL count_ptr pointer - err = jvmti->GetStackTrace(vthread, 0, MAX_FRAME_COUNT, frames, NULL); + // #4: Test JVMTI GetStackTrace function with nullptr count_ptr pointer + err = jvmti->GetStackTrace(vthread, 0, MAX_FRAME_COUNT, frames, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { - LOG("JVMTI GetStackTrace with NULL count_ptr pointer returned error: %d\n", err); - fatal(jni, "event handler: JVMTI GetStackTrace witt NULL count_ptr pointer failed to return JVMTI_ERROR_NULL_POINTER"); + LOG("JVMTI GetStackTrace with null count_ptr pointer returned error: %d\n", err); + fatal(jni, "event handler: JVMTI GetStackTrace witt null count_ptr pointer failed to return JVMTI_ERROR_NULL_POINTER"); } // #5: Test JVMTI GetStackTrace function with a good vthread @@ -364,8 +364,8 @@ enum Slots { SlotInvalid0 = -1, SlotObj = 0, SlotInt = 1, SlotLong = 2, SlotUnal static void test_GetLocal(jvmtiEnv *jvmti, JNIEnv *jni, jthread cthread, jthread vthread, const char *event_name, jint frame_count) { - jmethodID method = NULL; - jobject obj = NULL; + jmethodID method = nullptr; + jobject obj = nullptr; jint ii = 0; jlong ll = 0L; jfloat ff = 0.0; @@ -423,18 +423,18 @@ test_GetLocal(jvmtiEnv *jvmti, JNIEnv *jni, jthread cthread, jthread vthread, co " to return JVMTI_ERROR_INVALID_SLOT or JVMTI_ERROR_TYPE_MISMATCH"); } - // #5: Test JVMTI GetLocalObject function with NULL value_ptr - err = jvmti->GetLocalObject(vthread, depth, SlotObj, NULL); + // #5: Test JVMTI GetLocalObject function with null value_ptr + err = jvmti->GetLocalObject(vthread, depth, SlotObj, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { - LOG("JVMTI GetLocalObject with NULL method_ptr returned error: %d\n", err); - fatal(jni, "JVMTI GetLocalObject with NULL method_ptr failed to return JVMTI_ERROR_NULL_POINTER"); + LOG("JVMTI GetLocalObject with null method_ptr returned error: %d\n", err); + fatal(jni, "JVMTI GetLocalObject with null method_ptr failed to return JVMTI_ERROR_NULL_POINTER"); } // #6: Test JVMTI GetLocal functions with a good vthread err = jvmti->GetLocalObject(vthread, depth, SlotObj, &obj); check_jvmti_status(jni, err, "event handler: error in JVMTI GetLocalObject with good vthread"); - const char* str = jni->GetStringUTFChars((jstring)obj, NULL); + const char* str = jni->GetStringUTFChars((jstring)obj, nullptr); LOG(" local String value at slot %d: %s\n", SlotObj, str); const char* exp_str = "msg: ..."; if (strncmp(str, exp_str, 5) != 0) { @@ -500,7 +500,7 @@ processVThreadEvent(jvmtiEnv *jvmti, JNIEnv *jni, jthread vthread, const char *e deallocate(jvmti, jni, (void*)tname); if (strcmp(event_name, "VirtualThreadEnd") == 0) { - return; // skip further testing as GetVirtualThread can return NULL + return; // skip further testing as GetVirtualThread can return nullptr } test_GetVirtualThread(jvmti, jni, cthread, vthread, event_name); @@ -532,8 +532,8 @@ VirtualThreadEnd(jvmtiEnv *jvmti, JNIEnv *jni, jthread vthread) { static void JNICALL VirtualThreadMount(jvmtiEnv *jvmti, ...) { va_list ap; - JNIEnv* jni = NULL; - jthread thread = NULL; + JNIEnv* jni = nullptr; + jthread thread = nullptr; va_start(ap, jvmti); jni = va_arg(ap, JNIEnv*); @@ -549,8 +549,8 @@ VirtualThreadMount(jvmtiEnv *jvmti, ...) { static void JNICALL VirtualThreadUnmount(jvmtiEnv *jvmti, ...) { va_list ap; - JNIEnv* jni = NULL; - jthread thread = NULL; + JNIEnv* jni = nullptr; + jthread thread = nullptr; va_start(ap, jvmti); jni = va_arg(ap, JNIEnv*); @@ -608,25 +608,25 @@ Agent_OnLoad(JavaVM *jvm, char *options, return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VIRTUAL_THREAD_START, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VIRTUAL_THREAD_START, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("error in JVMTI SetEventNotificationMode: %d\n", err); return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VIRTUAL_THREAD_END, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VIRTUAL_THREAD_END, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("error in JVMTI SetEventNotificationMode: %d\n", err); return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, EXT_EVENT_VIRTUAL_THREAD_MOUNT, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, EXT_EVENT_VIRTUAL_THREAD_MOUNT, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("error in JVMTI SetEventNotificationMode: %d\n", err); return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, EXT_EVENT_VIRTUAL_THREAD_UNMOUNT, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, EXT_EVENT_VIRTUAL_THREAD_UNMOUNT, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("error in JVMTI SetEventNotificationMode: %d\n", err); return JNI_ERR; diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/VThreadUnsupportedTest/libVThreadUnsupportedTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/VThreadUnsupportedTest/libVThreadUnsupportedTest.cpp index 14698b6e5284..eb5ea872b916 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/VThreadUnsupportedTest/libVThreadUnsupportedTest.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/VThreadUnsupportedTest/libVThreadUnsupportedTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,11 +25,11 @@ #include #include "jvmti.h" -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static std::atomic is_completed_test_in_event; @@ -68,7 +68,7 @@ test_unsupported_jvmti_functions(jvmtiEnv *jvmti, JNIEnv *jni, jthread vthread) jvmtiError err; jboolean is_vthread; jvmtiCapabilities caps; - void* local_storage_data = NULL; + void* local_storage_data = nullptr; jlong nanos; LOG("test_unsupported_jvmti_functions: started\n"); @@ -98,7 +98,7 @@ test_unsupported_jvmti_functions(jvmtiEnv *jvmti, JNIEnv *jni, jthread vthread) check_jvmti_error_unsupported_operation(jni, "GetCurrentThreadCpuTime", err); } - err = jvmti->RunAgentThread(vthread, agent_proc, (const void*)NULL, JVMTI_THREAD_NORM_PRIORITY); + err = jvmti->RunAgentThread(vthread, agent_proc, nullptr, JVMTI_THREAD_NORM_PRIORITY); check_jvmti_error_unsupported_operation(jni, "RunAgentThread", err); LOG("test_unsupported_jvmti_functions: finished\n"); @@ -121,8 +121,8 @@ Java_VThreadUnsupportedTest_testJvmtiFunctionsInJNICall(JNIEnv *jni, jobject obj static void JNICALL VirtualThreadMount(jvmtiEnv *jvmti, ...) { va_list ap; - JNIEnv* jni = NULL; - jthread thread = NULL; + JNIEnv* jni = nullptr; + jthread thread = nullptr; va_start(ap, jvmti); jni = va_arg(ap, JNIEnv*); @@ -175,7 +175,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, EXT_EVENT_VIRTUAL_THREAD_MOUNT, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, EXT_EVENT_VIRTUAL_THREAD_MOUNT, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("error in JVMTI SetEventNotificationMode: %d\n", err); return JNI_ERR; diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/VirtualStackTraceTest/libVirtualStackTraceTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/VirtualStackTraceTest/libVirtualStackTraceTest.cpp index eb387a1f8dc0..9e613d5b0f94 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/VirtualStackTraceTest/libVirtualStackTraceTest.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/VirtualStackTraceTest/libVirtualStackTraceTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ #include #include #include -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { @@ -40,21 +40,21 @@ Java_VirtualStackTraceTest_getStackTrace(JNIEnv* jni, jclass clazz) { jobject visibleFrames[MAX_COUNT]; jvmtiFrameInfo frameInfo[MAX_COUNT]; - err = jvmti->GetStackTrace(NULL, 0, MAX_COUNT, frameInfo, &count); + err = jvmti->GetStackTrace(nullptr, 0, MAX_COUNT, frameInfo, &count); check_jvmti_status(jni, err, "event handler: error in JVMTI GetStackTrace call"); for (int idx = 0; idx < count; idx++) { - jclass declaringClass = NULL; - char *clasSignature = NULL; - char *methodName = NULL; + jclass declaringClass = nullptr; + char *clasSignature = nullptr; + char *methodName = nullptr; err = jvmti->GetMethodDeclaringClass(frameInfo[idx].method, &declaringClass); check_jvmti_status(jni, err, "event handler: error in JVMTI GetMethodDeclaringClass call"); - err = jvmti->GetClassSignature(declaringClass, &clasSignature, NULL); + err = jvmti->GetClassSignature(declaringClass, &clasSignature, nullptr); check_jvmti_status(jni, err, "event handler: error in JVMTI GetClassSignature call"); - err = jvmti->GetMethodName(frameInfo[idx].method, &methodName, NULL, NULL); + err = jvmti->GetMethodName(frameInfo[idx].method, &methodName, nullptr, nullptr); check_jvmti_status(jni, err, "event handler: error in JVMTI GetMethodName call"); if (strchr(clasSignature, '.')) { @@ -66,11 +66,11 @@ Java_VirtualStackTraceTest_getStackTrace(JNIEnv* jni, jclass clazz) { jvmti->Deallocate(reinterpret_cast(methodName)); jvmti->Deallocate(reinterpret_cast(clasSignature)); } - jobjectArray methodNames = jni->NewObjectArray(count - skipped, jni->FindClass("java/lang/String"), NULL); + jobjectArray methodNames = jni->NewObjectArray(count - skipped, jni->FindClass("java/lang/String"), nullptr); for (int idx = 0; idx < count - skipped; idx++) { jni->SetObjectArrayElement(methodNames, idx, visibleFrames[idx]); } - print_stack_trace(jvmti, jni, NULL); + print_stack_trace(jvmti, jni, nullptr); return methodNames; } diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/VirtualThreadStartTest/libVirtualThreadStartTest.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/VirtualThreadStartTest/libVirtualThreadStartTest.cpp index b4eefa992eff..711edaff9d33 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/VirtualThreadStartTest/libVirtualThreadStartTest.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/VirtualThreadStartTest/libVirtualThreadStartTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,13 +24,13 @@ #include #include #include -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { static jvmtiEnv *jvmti; static int started_thread_cnt = 0; -static jrawMonitorID agent_event_lock = NULL; +static jrawMonitorID agent_event_lock = nullptr; static const char* TESTED_TNAME_START = "Tested-VT"; static const size_t TESTED_TNAME_START_LEN = strlen(TESTED_TNAME_START); static bool can_support_vt_enabled = false; @@ -40,7 +40,7 @@ void JNICALL ThreadStart(jvmtiEnv *jvmti, JNIEnv* jni, jthread thread) { RawMonitorLocker agent_start_locker(jvmti, jni, agent_event_lock); - if (tname != NULL && strncmp(tname, TESTED_TNAME_START, TESTED_TNAME_START_LEN) == 0) { + if (tname != nullptr && strncmp(tname, TESTED_TNAME_START, TESTED_TNAME_START_LEN) == 0) { jboolean is_virtual = jni->IsVirtualThread(thread); if (!is_virtual) { fatal(jni, "Failed: tested thread expected to be virtual"); @@ -59,7 +59,7 @@ void JNICALL VirtualThreadStart(jvmtiEnv *jvmti, JNIEnv* jni, jthread thread) { RawMonitorLocker agent_start_locker(jvmti, jni, agent_event_lock); - if (tname != NULL && strncmp(tname, TESTED_TNAME_START, TESTED_TNAME_START_LEN) == 0) { + if (tname != nullptr && strncmp(tname, TESTED_TNAME_START, TESTED_TNAME_START_LEN) == 0) { jboolean is_virtual = jni->IsVirtualThread(thread); if (!is_virtual) { fatal(jni, "Failed: tested thread expected to be virtual"); @@ -101,7 +101,7 @@ jint agent_init(JavaVM *jvm, char *options, void *reserved) { callbacks.ThreadStart = &ThreadStart; callbacks.VirtualThreadStart = &VirtualThreadStart; - if (options != NULL && strcmp(options, "can_support_virtual_threads") == 0) { + if (options != nullptr && strcmp(options, "can_support_virtual_threads") == 0) { can_support_vt_enabled = true; caps.can_support_virtual_threads = 1; @@ -110,13 +110,13 @@ jint agent_init(JavaVM *jvm, char *options, void *reserved) { LOG("Agent init: error in JVMTI AddCapabilities: %s (%d)\n", TranslateError(err), err); return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VIRTUAL_THREAD_START, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VIRTUAL_THREAD_START, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("Agent init: error in JVMTI SetEventNotificationMode: %s (%d)\n", TranslateError(err), err); return JNI_ERR; } } else { - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, nullptr); if (err != JVMTI_ERROR_NONE) { LOG("Agent init: error in JVMTI SetEventNotificationMode: %s (%d)\n", TranslateError(err), err); return JNI_ERR; diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/WaitNotifySuspendedVThreadTest/WaitNotifySuspendedVThreadTest.java b/test/hotspot/jtreg/serviceability/jvmti/vthread/WaitNotifySuspendedVThreadTest/WaitNotifySuspendedVThreadTest.java index 341890ba4a02..a7b4b6ff43cc 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/WaitNotifySuspendedVThreadTest/WaitNotifySuspendedVThreadTest.java +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/WaitNotifySuspendedVThreadTest/WaitNotifySuspendedVThreadTest.java @@ -24,20 +24,8 @@ /* * @test * - * @summary Test verifies set/get TLS data and verifies it's consistency. - * Test set TLS with thread name which it belongs to and verify this information when getting test. - * -- cbThreadStart - * -- by AgentThread - * - * Test doesn't verify that TLS is not NULL because for some threads TLS is not initialized initially. - * TODO: - * -- verify that TLS is not NULL (not possible to do with jvmti, ThreadStart might be called too late) - * -- add more events where TLS is set *first time*, it is needed to test lazily jvmtThreadState init - * -- set/get TLS from other JavaThreads (not from agent and current thread) - * -- set/get for suspened (blocked?) threads - * -- split test to "sanity" and "stress" version - * -- update properties to run jvmti stress tests non-concurrently? - * + * @summary Test verifies that JVMTI raw monitor wait/notify works for + * suspended virtual thread. * * @requires vm.continuations * @library /test/lib @@ -64,8 +52,6 @@ public static void main(String argv[]) throws InterruptedException { WaitNotifySuspendedVThreadTask.setBreakpoint(); WaitNotifySuspendedVThreadTask task = new WaitNotifySuspendedVThreadTask(); Thread t = Thread.ofVirtual().start(task); - - Thread.sleep(1000); WaitNotifySuspendedVThreadTask.notifyRawMonitors(t); t.join(); } diff --git a/test/hotspot/jtreg/serviceability/jvmti/vthread/WaitNotifySuspendedVThreadTest/libWaitNotifySuspendedVThread.cpp b/test/hotspot/jtreg/serviceability/jvmti/vthread/WaitNotifySuspendedVThreadTest/libWaitNotifySuspendedVThread.cpp index 41bd21776465..bcaa1d605f7d 100644 --- a/test/hotspot/jtreg/serviceability/jvmti/vthread/WaitNotifySuspendedVThreadTest/libWaitNotifySuspendedVThread.cpp +++ b/test/hotspot/jtreg/serviceability/jvmti/vthread/WaitNotifySuspendedVThreadTest/libWaitNotifySuspendedVThread.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2024, 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,13 +23,15 @@ #include #include "jvmti.h" -#include "jvmti_common.h" +#include "jvmti_common.hpp" jrawMonitorID monitor; jrawMonitorID monitor_completed; jvmtiEnv *jvmti_env; +// Accessed using 'monitor' monitor. +bool is_breakpoint_reached = JNI_FALSE; static void set_breakpoint(JNIEnv *jni, jclass klass, const char *mname) { @@ -37,13 +39,11 @@ set_breakpoint(JNIEnv *jni, jclass klass, const char *mname) { jmethodID method = find_method(jvmti_env, jni, klass, mname); jvmtiError err; - if (method == NULL) { + if (method == nullptr) { jni->FatalError("Error in set_breakpoint: not found method"); } err = jvmti_env->SetBreakpoint(method, location); check_jvmti_status(jni, err, "set_or_clear_breakpoint: error in JVMTI SetBreakpoint"); - - } extern "C" { @@ -56,21 +56,30 @@ Java_WaitNotifySuspendedVThreadTask_setBreakpoint(JNIEnv *jni, jclass klass) { set_breakpoint(jni, klass, "methBreakpoint"); // Enable Breakpoint events globally - err = jvmti_env->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL); + err = jvmti_env->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, nullptr); check_jvmti_status(jni, err, "enableEvents: error in JVMTI SetEventNotificationMode: enable BREAKPOINT"); LOG("setBreakpoint: finished\n"); - } JNIEXPORT void JNICALL Java_WaitNotifySuspendedVThreadTask_notifyRawMonitors(JNIEnv *jni, jclass klass, jthread thread) { + + // Wait until virtual thread reach breakpoint and lock 'montior' monitor + bool is_breakpoint_reached_local = JNI_FALSE; + while (!is_breakpoint_reached_local) { + RawMonitorLocker rml(jvmti_env, jni, monitor); + is_breakpoint_reached_local = is_breakpoint_reached; + } + LOG("Main thread: suspending virtual and carrier threads\n"); check_jvmti_status(jni, jvmti_env->SuspendThread(thread), "SuspendThread thread"); jthread cthread = get_carrier_thread(jvmti_env, jni, thread); check_jvmti_status(jni, jvmti_env->SuspendThread(cthread), "SuspendThread thread"); + RawMonitorLocker completed(jvmti_env, jni, monitor_completed); + { RawMonitorLocker rml(jvmti_env, jni, monitor); @@ -78,8 +87,6 @@ Java_WaitNotifySuspendedVThreadTask_notifyRawMonitors(JNIEnv *jni, jclass klass, rml.notify_all(); } - RawMonitorLocker completed(jvmti_env, jni, monitor_completed); - LOG("Main thread: resuming virtual thread\n"); check_jvmti_status(jni, jvmti_env->ResumeThread(thread), "ResumeThread thread"); @@ -104,6 +111,7 @@ Breakpoint(jvmtiEnv *jvmti, JNIEnv* jni, jthread thread, fatal(jni, "Error in breakpoint"); return; } + char* tname = get_thread_name(jvmti, jni, thread); const char* virt = jni->IsVirtualThread(thread) ? "virtual" : "carrier"; @@ -111,6 +119,7 @@ Breakpoint(jvmtiEnv *jvmti, JNIEnv* jni, jthread thread, RawMonitorLocker rml(jvmti, jni, monitor); LOG("Breakpoint: before monitor.wait(): %s in %s thread\n", mname, virt); + is_breakpoint_reached = JNI_TRUE; rml.wait(); LOG("Breakpoint: after monitor.wait(): %s in %s thread\n", mname, virt); } @@ -128,7 +137,7 @@ Breakpoint(jvmtiEnv *jvmti, JNIEnv* jni, jthread thread, JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv * jvmti = NULL; + jvmtiEnv * jvmti = nullptr; jvmtiEventCallbacks callbacks; jvmtiCapabilities caps; @@ -136,7 +145,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { LOG("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } diff --git a/test/hotspot/jtreg/serviceability/monitoring/ThreadInfo/GetLockOwnerName/libGetLockOwnerName.cpp b/test/hotspot/jtreg/serviceability/monitoring/ThreadInfo/GetLockOwnerName/libGetLockOwnerName.cpp index ee4fb5c6d8ab..cc3776670932 100644 --- a/test/hotspot/jtreg/serviceability/monitoring/ThreadInfo/GetLockOwnerName/libGetLockOwnerName.cpp +++ b/test/hotspot/jtreg/serviceability/monitoring/ThreadInfo/GetLockOwnerName/libGetLockOwnerName.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,7 @@ extern "C" { -static jvmtiEnv* jvmti = NULL; +static jvmtiEnv* jvmti = nullptr; #define LOG(...) \ do { \ @@ -53,7 +53,7 @@ Java_GetLockOwnerName_wait4ContendedEnter(JNIEnv *jni, jclass cls, jthread thr) if (err != JVMTI_ERROR_NONE) { return err; } - if (monitor_ptr != NULL) { + if (monitor_ptr != nullptr) { break; } } diff --git a/test/hotspot/jtreg/serviceability/sa/ClhsdbCDSJstackPrintAll.java b/test/hotspot/jtreg/serviceability/sa/ClhsdbCDSJstackPrintAll.java index 3fe60de23646..4d01f9a26c86 100644 --- a/test/hotspot/jtreg/serviceability/sa/ClhsdbCDSJstackPrintAll.java +++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbCDSJstackPrintAll.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2024, 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 @@ -51,6 +51,10 @@ public static void main(String[] args) throws Exception { CDSTestUtils.createArchiveAndCheck(opts); ClhsdbLauncher test = new ClhsdbLauncher(); + // This test could possibly cause some unexpected SA exceptions because one + // or more threads are active during the stack trace. Ignore them. The threads + // we care about should still be present in the output. + test.ignoreExceptions(); theApp = LingeredApp.startApp( "-XX:+UnlockDiagnosticVMOptions", "-XX:SharedArchiveFile=" + sharedArchiveName, diff --git a/test/hotspot/jtreg/serviceability/sa/ClhsdbLauncher.java b/test/hotspot/jtreg/serviceability/sa/ClhsdbLauncher.java index 961311f5d5b0..ffb95fd9f704 100644 --- a/test/hotspot/jtreg/serviceability/sa/ClhsdbLauncher.java +++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbLauncher.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -41,9 +41,15 @@ public class ClhsdbLauncher { private Process toolProcess; + private boolean ignoreExceptions; public ClhsdbLauncher() { toolProcess = null; + ignoreExceptions = false; + } + + public void ignoreExceptions() { + ignoreExceptions = true; } /** @@ -147,11 +153,13 @@ private String runCmd(List commands, // -Xcheck:jni might be set via TEST_VM_OPTS. Make sure there are no warnings. oa.shouldNotMatch("^WARNING: JNI local refs:.*$"); oa.shouldNotMatch("^WARNING in native method:.*$"); - // This will detect most SA failures, including during the attach. - oa.shouldNotMatch("^sun.jvm.hotspot.debugger.DebuggerException:.*$"); - // This will detect unexpected exceptions, like NPEs and asserts, that are caught - // by sun.jvm.hotspot.CommandProcessor. - oa.shouldNotMatch("^Error: .*$"); + if (!ignoreExceptions) { + // This will detect most SA failures, including during the attach. + oa.shouldNotMatch("^sun.jvm.hotspot.debugger.DebuggerException:.*$"); + // This will detect unexpected exceptions, like NPEs and asserts, that are caught + // by sun.jvm.hotspot.CommandProcessor. + oa.shouldNotMatch("^Error: .*$"); + } String[] parts = output.split("hsdb>"); for (String cmd : commands) { diff --git a/test/hotspot/jtreg/serviceability/sa/ClhsdbWhere.java b/test/hotspot/jtreg/serviceability/sa/ClhsdbWhere.java index f3dab6dd9762..547034463d77 100644 --- a/test/hotspot/jtreg/serviceability/sa/ClhsdbWhere.java +++ b/test/hotspot/jtreg/serviceability/sa/ClhsdbWhere.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -45,6 +45,10 @@ public static void main(String[] args) throws Exception { LingeredApp theApp = null; try { ClhsdbLauncher test = new ClhsdbLauncher(); + // This test could possibly cause some unexpected SA exceptions because one + // or more threads are active during the stack trace. Ignore them. The threads + // we care about should still be present in the output. + test.ignoreExceptions(); theApp = LingeredApp.startApp(); System.out.println("Started LingeredApp with pid " + theApp.getPid()); diff --git a/test/hotspot/jtreg/serviceability/sa/TestJhsdbJstackLineNumbers.java b/test/hotspot/jtreg/serviceability/sa/TestJhsdbJstackLineNumbers.java index 5d9c3982fb64..87e664ef308f 100644 --- a/test/hotspot/jtreg/serviceability/sa/TestJhsdbJstackLineNumbers.java +++ b/test/hotspot/jtreg/serviceability/sa/TestJhsdbJstackLineNumbers.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, 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 @@ /** * @test + * @bug 8214226 8243500 * @requires vm.hasSA * @requires os.arch=="amd64" | os.arch=="x86_64" * @requires os.family=="windows" | os.family == "linux" | os.family == "mac" @@ -53,7 +54,7 @@ * * The test works by spawning a process that sits in a 10 line loop in the busywork() method, * all while the main test does repeated jstacks on the process. The expectation is - * that at least 5 of the lines in the busywork() loop will eventually show up in at + * that at least 4 of the lines in the busywork() loop will eventually show up in at * least one of the jstack runs. */ @@ -94,8 +95,11 @@ public static void main(String... args) { public class TestJhsdbJstackLineNumbers { // This is the number of lines in the busywork main loop static final int TOTAL_BUSYWORK_LOOP_LINES = 10; - // The minimum number of lines that we must at some point see in the jstack output - static final int MIN_BUSYWORK_LOOP_LINES = 5; + // The minimum number of lines that we must see at some point in the jstack output. + // There's always a chance we could see fewer, but the chances are so low that + // it is unlikely to ever happen. We can always decrease the odds by lowering + // the required number of lines or increasing the number of jstack runs. + static final int MIN_BUSYWORK_LOOP_LINES = 4; static final int MAX_NUMBER_OF_JSTACK_RUNS = 25; diff --git a/test/hotspot/jtreg/serviceability/tmtools/jstack/DaemonThreadTest.java b/test/hotspot/jtreg/serviceability/tmtools/jstack/DaemonThreadTest.java index d7915e8901a8..23e9474ad4a0 100644 --- a/test/hotspot/jtreg/serviceability/tmtools/jstack/DaemonThreadTest.java +++ b/test/hotspot/jtreg/serviceability/tmtools/jstack/DaemonThreadTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, 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,6 +38,7 @@ public class DaemonThreadTest { static class NormalThread extends Thread { NormalThread() { + setDaemon(false); } @Override diff --git a/test/hotspot/jtreg/testlibrary/ctw/src/sun/hotspot/tools/ctw/Compiler.java b/test/hotspot/jtreg/testlibrary/ctw/src/sun/hotspot/tools/ctw/Compiler.java index 7b495e46e338..1d70ce0d7f78 100644 --- a/test/hotspot/jtreg/testlibrary/ctw/src/sun/hotspot/tools/ctw/Compiler.java +++ b/test/hotspot/jtreg/testlibrary/ctw/src/sun/hotspot/tools/ctw/Compiler.java @@ -108,17 +108,16 @@ public static void compileClass(Class aClass, long id, Executor executor) { private static void preloadClasses(String className, long id, ConstantPool constantPool) { - try { - for (int i = 0, n = constantPool.getSize(); i < n; ++i) { - try { + for (int i = 0, n = constantPool.getSize(); i < n; ++i) { + try { + if (constantPool.getTagAt(i) == ConstantPool.Tag.CLASS) { constantPool.getClassAt(i); - } catch (IllegalArgumentException ignore) { } + } catch (Throwable t) { + CompileTheWorld.OUT.println(String.format("[%d]\t%s\tWARNING preloading failed : %s", + id, className, t)); + t.printStackTrace(CompileTheWorld.ERR); } - } catch (Throwable t) { - CompileTheWorld.OUT.println(String.format("[%d]\t%s\tWARNING preloading failed : %s", - id, className, t)); - t.printStackTrace(CompileTheWorld.ERR); } } diff --git a/test/hotspot/jtreg/testlibrary/jittester/src/jdk/test/lib/jittester/TempDir.java b/test/hotspot/jtreg/testlibrary/jittester/src/jdk/test/lib/jittester/TempDir.java index b166315a332a..c1e49ad73cb8 100644 --- a/test/hotspot/jtreg/testlibrary/jittester/src/jdk/test/lib/jittester/TempDir.java +++ b/test/hotspot/jtreg/testlibrary/jittester/src/jdk/test/lib/jittester/TempDir.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -47,14 +47,11 @@ public TempDir(String suffix) { } catch (IOException e) { throw new Error("Can't create a tmp dir for " + suffix, e); } - - System.out.println("DBG: Temp folder created: '" + path + "'"); } private void delete() { try { FileUtils.deleteFileTreeWithRetry(path); - System.out.println("DBG: Temp folder deleted: '" + path + "'"); } catch (IOException exc) { throw new Error("Could not deep delete '" + path + "'", exc); } diff --git a/test/hotspot/jtreg/testlibrary/jvmti/libJvmtiUtils.cpp b/test/hotspot/jtreg/testlibrary/jvmti/libJvmtiUtils.cpp index 0e7f1eba3835..a5b2b268ff15 100644 --- a/test/hotspot/jtreg/testlibrary/jvmti/libJvmtiUtils.cpp +++ b/test/hotspot/jtreg/testlibrary/jvmti/libJvmtiUtils.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, 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,11 +23,11 @@ #include #include "jvmti.h" -#include "jvmti_common.h" +#include "jvmti_common.hpp" extern "C" { -static jvmtiEnv* jvmti = NULL; +static jvmtiEnv* jvmti = nullptr; JNIEXPORT jint JNICALL Java_jvmti_JVMTIUtils_init(JNIEnv *jni, jclass cls) { diff --git a/test/hotspot/jtreg/testlibrary_tests/compile_framework/examples/CombinedJavaJasmExample.java b/test/hotspot/jtreg/testlibrary_tests/compile_framework/examples/CombinedJavaJasmExample.java new file mode 100644 index 000000000000..565c92c1b706 --- /dev/null +++ b/test/hotspot/jtreg/testlibrary_tests/compile_framework/examples/CombinedJavaJasmExample.java @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2024, 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 + * @summary Example test to use the Compile Framework. + * @modules java.base/jdk.internal.misc + * @library /test/lib / + * @run driver compile_framework.examples.CombinedJavaJasmExample + */ + +package compile_framework.examples; + +import compiler.lib.compile_framework.*; + +/** + * This test shows a compilation of multiple Java and Jasm source code files. + * In this example, the classes even reference each other. + */ +public class CombinedJavaJasmExample { + + // Generate a source jasm file as String + public static String generateJasm() { + return """ + package p/xyz; + + super public class XYZJasm { + public static Method test:"(I)I" + stack 20 locals 20 + { + iload_0; + iconst_2; + imul; + invokestatic Method p/xyz/XYZJava."mul3":"(I)I"; + ireturn; + } + + public static Method mul5:"(I)I" + stack 20 locals 20 + { + iload_0; + ldc 5; + imul; + ireturn; + } + } + """; + } + + // Generate a source java file as String + public static String generateJava() { + return """ + package p.xyz; + + public class XYZJava { + public static int test(int i) { + return p.xyz.XYZJasm.mul5(i * 7); + } + + public static int mul3(int i) { + return i * 3; + } + } + """; + } + + public static void main(String[] args) { + // Create a new CompileFramework instance. + CompileFramework comp = new CompileFramework(); + + // Generate files. + comp.addJasmSourceCode("p.xyz.XYZJasm", generateJasm()); + comp.addJavaSourceCode("p.xyz.XYZJava", generateJava()); + + // Compile the source files. + comp.compile(); + + test(comp, "p.xyz.XYZJasm", "test", 11, 11 * 2 * 3); + test(comp, "p.xyz.XYZJava", "test", 13, 13 * 7 * 5); + + System.out.println("Success."); + } + + public static void test(CompileFramework comp, String className, String methodName, int input, int expected) { + Object ret = comp.invoke(className, methodName, new Object[] {input}); + + // Extract return value of invocation, verify its value. + int i = (int)ret; + System.out.println("Result of call: " + i + " vs expected: " + expected); + if (i != expected) { + throw new RuntimeException("wrong value: " + i); + } + } +} diff --git a/test/hotspot/jtreg/testlibrary_tests/compile_framework/examples/IRFrameworkJavaExample.java b/test/hotspot/jtreg/testlibrary_tests/compile_framework/examples/IRFrameworkJavaExample.java new file mode 100644 index 000000000000..11b8828d7530 --- /dev/null +++ b/test/hotspot/jtreg/testlibrary_tests/compile_framework/examples/IRFrameworkJavaExample.java @@ -0,0 +1,156 @@ +/* + * Copyright (c) 2024, 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 + * @summary Example test to use the Compile Framework together with the IR Framework (i.e. TestFramework). + * @modules java.base/jdk.internal.misc + * @library /test/lib / + * @compile ../../../compiler/lib/ir_framework/TestFramework.java + * @run driver compile_framework.examples.IRFrameworkJavaExample + */ + +package compile_framework.examples; + +import compiler.lib.compile_framework.*; +import jdk.test.lib.Utils; +import jdk.test.lib.Platform; +import java.lang.reflect.InvocationTargetException; + +/** + * This test shows that the IR verification can be done on code compiled by the Compile Framework. + * The "@compile" command for JTREG is required so that the IRFramework is compiled, other javac + * might not compile it because it is not present in the class, only in the dynamically compiled + * code. + *

    + * Additionally, we must set the classpath for the Test-VM, so that it has access to all compiled + * classes (see {@link CompileFramework#getEscapedClassPathOfCompiledClasses}). + */ +public class IRFrameworkJavaExample { + + public static void main(String[] args) { + testX1(); + testX2(); + } + + // Generate a source java file as String + public static String generateX1(CompileFramework comp) { + return String.format(""" + import compiler.lib.ir_framework.*; + + public class X1 { + public static void main(String args[]) { + TestFramework framework = new TestFramework(X1.class); + framework.addFlags("-classpath", "%s"); + framework.start(); + } + + @Test + @IR(counts = {IRNode.LOAD_VECTOR_F, "> 0"}, + applyIfCPUFeatureOr = {"sse2", "true", "asimd", "true"}) + static float[] test() { + float[] a = new float[1024*8]; + for (int i = 0; i < a.length; i++) { + a[i]++; + } + return a; + } + } + """, comp.getEscapedClassPathOfCompiledClasses()); + } + + static void testX1() { + // Create a new CompileFramework instance. + CompileFramework comp = new CompileFramework(); + + // Add a java source file. + comp.addJavaSourceCode("X1", generateX1(comp)); + + // Compile the source file. + comp.compile(); + + // X1.main(); + comp.invoke("X1", "main", new Object[] {null}); + } + + // Generate a source java file as String + public static String generateX2(CompileFramework comp) { + // Example with conflicting "@IR" rules -> expect a IRViolationException. + return String.format(""" + import compiler.lib.ir_framework.*; + + public class X2 { + public static void main(String args[]) { + TestFramework framework = new TestFramework(X2.class); + framework.addFlags("-classpath", "%s"); + framework.start(); + } + + @Test + @IR(counts = {IRNode.LOAD, "> 0"}) + @IR(failOn = IRNode.LOAD) + static void test() { + } + } + """, comp.getEscapedClassPathOfCompiledClasses()); + } + + static void testX2() { + // Create a new CompileFramework instance. + CompileFramework comp = new CompileFramework(); + + // Add a java source file. + comp.addJavaSourceCode("X2", generateX2(comp)); + + // Compile the source file. + comp.compile(); + + // Load the compiled class. + Class c = comp.getClass("X2"); + + // Invoke the "X2.main" method from the compiled and loaded class. + try { + c.getDeclaredMethod("main", new Class[] { String[].class }).invoke(null, new Object[] { null }); + + // Check if IR framework is expected to execute the IR rules. + if (Utils.getTestJavaOpts().length == 0 && Platform.isDebugBuild() && !Platform.isInt() && !Platform.isComp()) { + throw new RuntimeException("IRViolationException expected."); + } else { + System.out.println("Got no IRViolationException, but was also not expected."); + } + } catch (NoSuchMethodException e) { + throw new RuntimeException("No such method:", e); + } catch (IllegalAccessException e) { + throw new RuntimeException("Illegal access:", e); + } catch (InvocationTargetException e) { + Throwable t = e.getCause(); + if (t == null) { + throw new RuntimeException("IRViolationException expected:", e); + } + if (!t.getClass().getSimpleName().equals("IRViolationException")) { + throw new RuntimeException("IRViolationException expected:", e); + } + System.out.println("Success, we got a IRViolationException."); + } + } +} diff --git a/test/hotspot/jtreg/testlibrary_tests/compile_framework/examples/MultiFileJasmExample.java b/test/hotspot/jtreg/testlibrary_tests/compile_framework/examples/MultiFileJasmExample.java new file mode 100644 index 000000000000..33fe07a53970 --- /dev/null +++ b/test/hotspot/jtreg/testlibrary_tests/compile_framework/examples/MultiFileJasmExample.java @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2024, 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 + * @summary Example test to use the Compile Framework. + * @modules java.base/jdk.internal.misc + * @library /test/lib / + * @run driver comile_framework.examples.MultiFileJasmExample + */ + +package comile_framework.examples; + +import compiler.lib.compile_framework.*; +import java.io.StringWriter; +import java.io.PrintWriter; + +/** + * This test shows a compilation of multiple jasm source code files. + */ +public class MultiFileJasmExample { + + // Generate a source jasm file as String + public static String generate(int i) { + StringWriter writer = new StringWriter(); + PrintWriter out = new PrintWriter(writer); + out.println("package p/xyz;"); + out.println(""); + out.println("super public class XYZ" + i + " {"); + out.println(" public static Method test:\"(I)I\""); + out.println(" stack 20 locals 20"); + out.println(" {"); + out.println(" iload_0;"); + out.println(" iconst_2;"); // every call multiplies by 2, in total 2^10 = 1024 + out.println(" imul;"); + if (i != 0) { + out.println(" invokestatic Method p/xyz/XYZ" + (i-1) + ".\"test\":\"(I)I\";"); + } + out.println(" ireturn;"); + out.println(" }"); + out.println("}"); + return writer.toString(); + } + + public static void main(String[] args) { + // Create a new CompileFramework instance. + CompileFramework comp = new CompileFramework(); + + // Generate 10 files. + for (int i = 0; i < 10; i++) { + comp.addJasmSourceCode("p.xyz.XYZ" + i, generate(i)); + } + + // Compile the source files. + comp.compile(); + + // Object ret = XYZ9.test(5); + Object ret = comp.invoke("p.xyz.XYZ9", "test", new Object[] { 5 }); + + // Extract return value of invocation, verify its value. + int i = (int)ret; + System.out.println("Result of call: " + i); + if (i != 5 * 1024) { + throw new RuntimeException("wrong value: " + i); + } + System.out.println("Success."); + } +} diff --git a/test/hotspot/jtreg/testlibrary_tests/compile_framework/examples/MultiFileJavaExample.java b/test/hotspot/jtreg/testlibrary_tests/compile_framework/examples/MultiFileJavaExample.java new file mode 100644 index 000000000000..e493ebab4e8c --- /dev/null +++ b/test/hotspot/jtreg/testlibrary_tests/compile_framework/examples/MultiFileJavaExample.java @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2024, 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 + * @summary Example test to use the Compile Framework. + * @modules java.base/jdk.internal.misc + * @library /test/lib / + * @run driver compile_framework.examples.MultiFileJavaExample + */ + +package compile_framework.examples; + +import compiler.lib.compile_framework.*; +import java.io.StringWriter; +import java.io.PrintWriter; + +/** + * This test shows a compilation of multiple java source code files. + */ +public class MultiFileJavaExample { + + // Generate a source java file as String + public static String generate(int i) { + StringWriter writer = new StringWriter(); + PrintWriter out = new PrintWriter(writer); + out.println("package p.xyz;"); + out.println(""); + out.println("public class XYZ" + i + " {"); + if (i > 0) { + out.println(" public XYZ" + (i - 1) + " xyz = new XYZ" + (i - 1) + "();"); + } + out.println(""); + out.println(" public static Object test() {"); + out.println(" return new XYZ" + i + "();"); + out.println(" }"); + out.println("}"); + return writer.toString(); + } + + public static void main(String[] args) { + // Create a new CompileFramework instance. + CompileFramework comp = new CompileFramework(); + + // Generate 10 files. + for (int i = 0; i < 10; i++) { + comp.addJavaSourceCode("p.xyz.XYZ" + i, generate(i)); + } + + // Compile the source files. + comp.compile(); + + // Object ret = XYZ9.test(); + Object ret = comp.invoke("p.xyz.XYZ9", "test", new Object[] {}); + + if (!ret.getClass().getSimpleName().equals("XYZ9")) { + throw new RuntimeException("wrong result:" + ret); + } + System.out.println("Success."); + } +} diff --git a/test/hotspot/jtreg/testlibrary_tests/compile_framework/examples/RunWithFlagsExample.java b/test/hotspot/jtreg/testlibrary_tests/compile_framework/examples/RunWithFlagsExample.java new file mode 100644 index 000000000000..a67e6e0eb493 --- /dev/null +++ b/test/hotspot/jtreg/testlibrary_tests/compile_framework/examples/RunWithFlagsExample.java @@ -0,0 +1,99 @@ +/* + * Copyright (c) 2024, 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 + * @summary Example test to use the Compile Framework and run the compiled code with additional flags + * @modules java.base/jdk.internal.misc + * @library /test/lib / + * @run driver compile_framework.examples.RunWithFlagsExample + */ + +package compile_framework.examples; + +import compiler.lib.compile_framework.*; + +import jdk.test.lib.process.ProcessTools; +import jdk.test.lib.process.OutputAnalyzer; + +/** + * This test shows how the generated code can be compiled and invoked in a new VM. This allows + * the execution of the code with additional VM flags and options. + *

    + * The new VM must be able to locate the class files of the newly compiled code. For this we + * set the class path using {@link CompileFramework#getEscapedClassPathOfCompiledClasses}. + */ +public class RunWithFlagsExample { + + private static String generate() { + return """ + package p.xyz; + + public class X { + public static void main(String args[]) { + System.out.println("Hello world!"); + System.out.println(System.getProperty("MyMessage", "fail")); + System.err.println(args[0]); + } + } + """; + } + + public static void main(String[] args) throws Exception { + // Create a new CompileFramework instance. + CompileFramework comp = new CompileFramework(); + + // Add a Java source file. + comp.addJavaSourceCode("p.xyz.X", generate()); + + // Compile the source file. + comp.compile(); + + // Build command line. + String[] command = { + // Set the classpath to include our newly compiled class. + "-classpath", + comp.getEscapedClassPathOfCompiledClasses(), + // Pass additional flags here. + // "-Xbatch" is a harmless VM flag, so this example runs everywhere without issues. + "-Xbatch", + // We can also pass properties like "MyMessage". + "-DMyMessage=hello_world", + "p.xyz.X", + "hello_arg" + }; + + // Execute the command, and capture the output. + // The JTREG Java and VM options are automatically passed to the test VM. + OutputAnalyzer analyzer = ProcessTools.executeTestJava(command); + + // Verify output. + analyzer.shouldHaveExitValue(0); + analyzer.stdoutContains("Hello world!"); + analyzer.stdoutContains("hello_world"); + analyzer.stdoutContains("hello_arg"); + + // Print output to stderr. + analyzer.reportDiagnosticSummary(); + } +} diff --git a/test/hotspot/jtreg/testlibrary_tests/compile_framework/examples/SimpleJasmExample.java b/test/hotspot/jtreg/testlibrary_tests/compile_framework/examples/SimpleJasmExample.java new file mode 100644 index 000000000000..e01b45e74417 --- /dev/null +++ b/test/hotspot/jtreg/testlibrary_tests/compile_framework/examples/SimpleJasmExample.java @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2024, 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 + * @summary Example test to use the Compile Framework. + * @modules java.base/jdk.internal.misc + * @library /test/lib / + * @run driver compile_framework.examples.SimpleJasmExample + */ + +package compile_framework.examples; + +import compiler.lib.compile_framework.*; + +/** + * This test shows a simple compilation of java source code, and its invocation. + */ +public class SimpleJasmExample { + + // Generate a source jasm file as String + public static String generate() { + return """ + super public class XYZ { + public static Method test:"(I)I" + stack 20 locals 20 + { + iload_0; + iconst_2; + imul; + ireturn; + } + } + """; + } + + public static void main(String[] args) { + // Create a new CompileFramework instance. + CompileFramework comp = new CompileFramework(); + + // Add a java source file. + String src = generate(); + comp.addJasmSourceCode("XYZ", src); + + // Compile the source file. + comp.compile(); + + // Object ret = XYZ.test(5); + Object ret = comp.invoke("XYZ", "test", new Object[] {5}); + + // Extract return value of invocation, verify its value. + int i = (int)ret; + System.out.println("Result of call: " + i); + if (i != 10) { + throw new RuntimeException("wrong value: " + i); + } + System.out.println("Success."); + } +} diff --git a/test/hotspot/jtreg/testlibrary_tests/compile_framework/examples/SimpleJavaExample.java b/test/hotspot/jtreg/testlibrary_tests/compile_framework/examples/SimpleJavaExample.java new file mode 100644 index 000000000000..5e54a6e8a08a --- /dev/null +++ b/test/hotspot/jtreg/testlibrary_tests/compile_framework/examples/SimpleJavaExample.java @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2024, 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 + * @summary Example test to use the Compile Framework. + * @modules java.base/jdk.internal.misc + * @library /test/lib / + * @run driver compile_framework.examples.SimpleJavaExample + */ + +package compile_framework.examples; + +import compiler.lib.compile_framework.*; + +/** + * This test shows a simple compilation of java source code, and its invocation. + */ +public class SimpleJavaExample { + + // Generate a source java file as String + public static String generate() { + return """ + public class XYZ { + public static int test(int i) { + System.out.println("Hello from XYZ.test: " + i); + return i * 2; + } + } + """; + } + + public static void main(String[] args) { + // Create a new CompileFramework instance. + CompileFramework comp = new CompileFramework(); + + // Add a java source file. + comp.addJavaSourceCode("XYZ", generate()); + + // Compile the source file. + comp.compile(); + + // Object ret = XYZ.test(5); + Object ret = comp.invoke("XYZ", "test", new Object[] {5}); + + // Extract return value of invocation, verify its value. + int i = (int)ret; + System.out.println("Result of call: " + i); + if (i != 10) { + throw new RuntimeException("wrong value: " + i); + } + } +} diff --git a/test/hotspot/jtreg/testlibrary_tests/compile_framework/tests/TestBadJasmCompilation.java b/test/hotspot/jtreg/testlibrary_tests/compile_framework/tests/TestBadJasmCompilation.java new file mode 100644 index 000000000000..b5b6f3e10409 --- /dev/null +++ b/test/hotspot/jtreg/testlibrary_tests/compile_framework/tests/TestBadJasmCompilation.java @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2024, 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 + * @summary Example test with failing jasm compilation. + * @modules java.base/jdk.internal.misc + * @library /test/lib / + * @run driver compile_framework.tests.TestBadJasmCompilation + */ + +package compile_framework.tests; + +import compiler.lib.compile_framework.*; + +public class TestBadJasmCompilation { + + // Generate a source jasm file as String + public static String generate() { + return """ + super public class XYZ { + some bad code + } + """; + } + + public static void main(String[] args) { + // Create a new CompileFramework instance. + CompileFramework comp = new CompileFramework(); + + // Add a java source file. + comp.addJasmSourceCode("XYZ", generate()); + + try { + // Compile the source file. + comp.compile(); + throw new RuntimeException("Expected compilation to fail."); + } catch (CompileFrameworkException e) { + System.out.println("Success, expected compilation to fail."); + } + } +} diff --git a/test/hotspot/jtreg/testlibrary_tests/compile_framework/tests/TestBadJavaCompilation.java b/test/hotspot/jtreg/testlibrary_tests/compile_framework/tests/TestBadJavaCompilation.java new file mode 100644 index 000000000000..1cb1d79afbcc --- /dev/null +++ b/test/hotspot/jtreg/testlibrary_tests/compile_framework/tests/TestBadJavaCompilation.java @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2024, 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 + * @summary Example test with failing java compilation. + * @modules java.base/jdk.internal.misc + * @library /test/lib / + * @run driver compile_framework.tests.TestBadJavaCompilation + */ + +package compile_framework.tests; + +import compiler.lib.compile_framework.*; + +public class TestBadJavaCompilation { + + // Generate a source java file as String + public static String generate() { + return """ + public class XYZ { + some bad code + } + """; + } + + public static void main(String[] args) { + // Create a new CompileFramework instance. + CompileFramework comp = new CompileFramework(); + + // Add a java source file. + comp.addJavaSourceCode("XYZ", generate()); + + try { + // Compile the source file. + comp.compile(); + throw new RuntimeException("Expected compilation to fail."); + } catch (CompileFrameworkException e) { + System.out.println("Success, expected compilation to fail."); + } + } +} diff --git a/test/hotspot/jtreg/testlibrary_tests/compile_framework/tests/TestConcurrentCompilation.java b/test/hotspot/jtreg/testlibrary_tests/compile_framework/tests/TestConcurrentCompilation.java new file mode 100644 index 000000000000..1cb902d34e4a --- /dev/null +++ b/test/hotspot/jtreg/testlibrary_tests/compile_framework/tests/TestConcurrentCompilation.java @@ -0,0 +1,108 @@ +/* + * Copyright (c) 2024, 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 + * @summary Example test with multi-threaded use of the CompileFramework. + * Tests that the source and class directories are set up correctly. + * @modules java.base/jdk.internal.misc + * @library /test/lib / + * @run driver compile_framework.tests.TestConcurrentCompilation + */ + +package compile_framework.tests; + +import compiler.lib.compile_framework.*; + +import java.util.ArrayList; +import java.util.List; + +public class TestConcurrentCompilation { + + // Generate a source java file as String + public static String generate(int i) { + return String.format(""" + public class XYZ { + public static int test() { + return %d; + } + } + """, i); + } + + public static void test(int i) { + System.out.println("Generate and compile XYZ for " + i); + CompileFramework comp = new CompileFramework(); + comp.addJavaSourceCode("XYZ", generate(i)); + comp.compile(); + + // Now, sleep to give the other threads time to compile and store their class-files. + System.out.println("Sleep for " + i); + try { + Thread.sleep(100); + } catch (InterruptedException e) { + System.out.println("Sleep interrupted for " + i); + } + + // Now, hopefully all threads have compiled and stored their class-files. + // We can check if we get the expected result, i.e. the class-file from the current thread. + System.out.println("Run XYZ.test for " + i); + int j = (int)comp.invoke("XYZ", "test", new Object[] {}); + if (i != j) { + System.out.println("Wrong value: " + i + " vs " + j); + throw new RuntimeException("Wrong value: " + i + " vs " + j); + } + System.out.println("Success for " + i); + } + + public static class MyRunnable implements Runnable { + private int i; + + public MyRunnable(int i) { + this.i = i; + } + + public void run() { + TestConcurrentCompilation.test(i); + } + } + + public static void main(String[] args) { + System.out.println("Generating threads:"); + List threads = new ArrayList(); + for (int i = 0; i < 3; i++) { + Thread thread = new Thread(new MyRunnable(i)); + thread.start(); + threads.add(thread); + } + System.out.println("Waiting to join threads:"); + try { + for (Thread thread : threads) { + thread.join(); + } + } catch (InterruptedException e) { + throw new RuntimeException("interrupted", e); + } + System.out.println("Success."); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/bytecode/BytecodeGeneratorFactory.java b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/bytecode/BytecodeGeneratorFactory.java index cad856f553e2..73f74794394f 100644 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/bytecode/BytecodeGeneratorFactory.java +++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/bytecode/BytecodeGeneratorFactory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,7 @@ import java.util.Map; import java.util.Random; -import vm.share.InMemoryJavaCompiler; +import jdk.test.lib.compiler.InMemoryJavaCompiler; /** * BytecodeFactory that employs in memory compilation. @@ -44,12 +44,10 @@ public BytecodeGeneratorFactory(long seed) { @Override public Bytecode createBytecode(String className) { - Map sources = new HashMap(); - sources.put(className, sourceGenerator.generateSource(className, + byte[] bytecode = InMemoryJavaCompiler.compile(className, sourceGenerator.generateSource(className, "public static void main() { System.out.println(\"From main method in in-mem-compiled code " + random.nextGaussian() + " + str_bytesToReplace0 str_bytesToReplace1\"); }\n " + "public static int methodForCompilation(Object object) { int i = object.hashCode(); i = i * 2000 / 1994 + 153; return i; }\n")); - byte[] bytecode = InMemoryJavaCompiler.compile(sources).values().iterator().next(); return new Bytecode(className, bytecode); } diff --git a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/libdefine.cpp b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/libdefine.cpp index 157ea1f92a70..e1b16107e121 100644 --- a/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/libdefine.cpp +++ b/test/hotspot/jtreg/vmTestbase/gc/g1/unloading/libdefine.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -44,14 +44,14 @@ extern "C" { JNIEXPORT jclass JNICALL Java_gc_g1_unloading_classloaders_JNIClassloader_loadThroughJNI0 (JNIEnv * env, jclass clazz, jstring className, jobject classLoader, jbyteArray bytecode) { - const char * classNameChar = env->GetStringUTFChars(className, NULL); - jbyte * arrayContent = env->GetByteArrayElements(bytecode, NULL); + const char * classNameChar = env->GetStringUTFChars(className, nullptr); + jbyte * arrayContent = env->GetByteArrayElements(bytecode, nullptr); jsize bytecodeLength = env->GetArrayLength(bytecode); jclass returnValue = env->DefineClass(classNameChar, classLoader, arrayContent, bytecodeLength); env->ReleaseByteArrayElements(bytecode, arrayContent, JNI_ABORT); env->ReleaseStringUTFChars(className, classNameChar); if (!returnValue) { - printf("ERROR: DefineClass call returned NULL by some reason. Classloading failed.\n"); + printf("ERROR: DefineClass call returned null by some reason. Classloading failed.\n"); } return returnValue; @@ -101,7 +101,7 @@ JNIEXPORT jint JNICALL Java_gc_g1_unloading_loading_ClassLoadingHelper_makeRede classDef.klass = redefCls; classDef.class_byte_count = env->GetArrayLength(classBytes); - jbyte * class_bytes = env->GetByteArrayElements(classBytes, NULL); + jbyte * class_bytes = env->GetByteArrayElements(classBytes, nullptr); classDef.class_bytes = (unsigned char *)class_bytes; if (fl == 2) { @@ -167,7 +167,7 @@ JNIEXPORT void JNICALL Java_gc_g1_unloading_keepref_JNILocalRefHolder_holdWithJN objectToKeepField = env->GetFieldID(clazz, "objectToKeep", "Ljava/lang/Object;"); objectToKeep = env->GetObjectField(thisObject, objectToKeepField); localRef = env->NewLocalRef(objectToKeep); - env->SetObjectField(thisObject, objectToKeepField, NULL); + env->SetObjectField(thisObject, objectToKeepField, nullptr); objectClazz = env->FindClass("Ljava/lang/Object;"); waitMethod = env->GetMethodID(objectClazz, "wait", "()V"); diff --git a/test/hotspot/jtreg/vmTestbase/gc/gctests/LoadUnloadGC/LoadUnloadGC.java b/test/hotspot/jtreg/vmTestbase/gc/gctests/LoadUnloadGC/LoadUnloadGC.java index 9b79865462d6..1d95426554b6 100644 --- a/test/hotspot/jtreg/vmTestbase/gc/gctests/LoadUnloadGC/LoadUnloadGC.java +++ b/test/hotspot/jtreg/vmTestbase/gc/gctests/LoadUnloadGC/LoadUnloadGC.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2024, 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 @@ -71,12 +71,8 @@ package gc.gctests.LoadUnloadGC; -import nsk.share.test.*; import nsk.share.gc.*; import nsk.share.classload.ClassPathNonDelegatingClassLoader; -import vm.share.monitoring.MemoryPoolFinder; - -import java.io.*; import java.util.*; import java.lang.management.MemoryPoolMXBean; diff --git a/test/hotspot/jtreg/vmTestbase/vm/share/monitoring/MemoryPoolFinder.java b/test/hotspot/jtreg/vmTestbase/gc/gctests/LoadUnloadGC/MemoryPoolFinder.java similarity index 95% rename from test/hotspot/jtreg/vmTestbase/vm/share/monitoring/MemoryPoolFinder.java rename to test/hotspot/jtreg/vmTestbase/gc/gctests/LoadUnloadGC/MemoryPoolFinder.java index ca68beffca64..f7f5e19bd16f 100644 --- a/test/hotspot/jtreg/vmTestbase/vm/share/monitoring/MemoryPoolFinder.java +++ b/test/hotspot/jtreg/vmTestbase/gc/gctests/LoadUnloadGC/MemoryPoolFinder.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, 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,11 +20,11 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package vm.share.monitoring; +package gc.gctests.LoadUnloadGC; import java.lang.management.*; -public enum MemoryPoolFinder { +enum MemoryPoolFinder { CODE_CACHE, EDEN_SPACE, SURVIVOR_SPACE, diff --git a/test/hotspot/jtreg/vmTestbase/gc/gctests/nativeGC03/libnativeGC03.cpp b/test/hotspot/jtreg/vmTestbase/gc/gctests/nativeGC03/libnativeGC03.cpp index e8520a1ad4f2..2c97863db5a9 100644 --- a/test/hotspot/jtreg/vmTestbase/gc/gctests/nativeGC03/libnativeGC03.cpp +++ b/test/hotspot/jtreg/vmTestbase/gc/gctests/nativeGC03/libnativeGC03.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2024, 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,7 +38,7 @@ Java_gc_gctests_nativeGC03_nativeGC03_nativeMethod03 /*Trash all the linked lists */ while (count < 10) { while (i < len) { - env->SetObjectArrayElement(listHolder, i, NULL); + env->SetObjectArrayElement(listHolder, i, nullptr); i++; } diff --git a/test/hotspot/jtreg/vmTestbase/metaspace/gc/HighWaterMarkTest.java b/test/hotspot/jtreg/vmTestbase/metaspace/gc/HighWaterMarkTest.java index f13dae70c919..244431100f7b 100644 --- a/test/hotspot/jtreg/vmTestbase/metaspace/gc/HighWaterMarkTest.java +++ b/test/hotspot/jtreg/vmTestbase/metaspace/gc/HighWaterMarkTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,6 @@ package metaspace.gc; import java.util.Arrays; -import vm.share.VMRuntimeEnvUtils; /** * Test metaspace ergonomic. diff --git a/test/hotspot/jtreg/vmTestbase/vm/share/gc/HeapOOMEException.java b/test/hotspot/jtreg/vmTestbase/metaspace/share/HeapOOMEException.java similarity index 98% rename from test/hotspot/jtreg/vmTestbase/vm/share/gc/HeapOOMEException.java rename to test/hotspot/jtreg/vmTestbase/metaspace/share/HeapOOMEException.java index 534df351169b..493189a58c71 100644 --- a/test/hotspot/jtreg/vmTestbase/vm/share/gc/HeapOOMEException.java +++ b/test/hotspot/jtreg/vmTestbase/metaspace/share/HeapOOMEException.java @@ -20,7 +20,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package vm.share.gc; +package metaspace.share; /** * This class is used to distinguish between OOME in metaspace and OOME in heap when triggering class unloading. diff --git a/test/hotspot/jtreg/vmTestbase/vm/share/gc/TriggerUnloadingByFillingMetaspace.java b/test/hotspot/jtreg/vmTestbase/metaspace/share/TriggerUnloadingByFillingMetaspace.java similarity index 98% rename from test/hotspot/jtreg/vmTestbase/vm/share/gc/TriggerUnloadingByFillingMetaspace.java rename to test/hotspot/jtreg/vmTestbase/metaspace/share/TriggerUnloadingByFillingMetaspace.java index e3f9caf9533e..217abc25c96a 100644 --- a/test/hotspot/jtreg/vmTestbase/vm/share/gc/TriggerUnloadingByFillingMetaspace.java +++ b/test/hotspot/jtreg/vmTestbase/metaspace/share/TriggerUnloadingByFillingMetaspace.java @@ -20,7 +20,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package vm.share.gc; +package metaspace.share; import nsk.share.test.ExecutionController; import nsk.share.gc.gp.classload.GeneratedClassProducer; diff --git a/test/hotspot/jtreg/vmTestbase/vm/share/gc/TriggerUnloadingHelper.java b/test/hotspot/jtreg/vmTestbase/metaspace/share/TriggerUnloadingHelper.java similarity index 97% rename from test/hotspot/jtreg/vmTestbase/vm/share/gc/TriggerUnloadingHelper.java rename to test/hotspot/jtreg/vmTestbase/metaspace/share/TriggerUnloadingHelper.java index b6458f5865e9..7c9e4bec1a61 100644 --- a/test/hotspot/jtreg/vmTestbase/vm/share/gc/TriggerUnloadingHelper.java +++ b/test/hotspot/jtreg/vmTestbase/metaspace/share/TriggerUnloadingHelper.java @@ -20,7 +20,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package vm.share.gc; +package metaspace.share; import nsk.share.test.ExecutionController; diff --git a/test/hotspot/jtreg/vmTestbase/vm/share/gc/TriggerUnloadingWithWhiteBox.java b/test/hotspot/jtreg/vmTestbase/metaspace/share/TriggerUnloadingWithWhiteBox.java similarity index 98% rename from test/hotspot/jtreg/vmTestbase/vm/share/gc/TriggerUnloadingWithWhiteBox.java rename to test/hotspot/jtreg/vmTestbase/metaspace/share/TriggerUnloadingWithWhiteBox.java index dfe4bb73acba..678e9551fa75 100644 --- a/test/hotspot/jtreg/vmTestbase/vm/share/gc/TriggerUnloadingWithWhiteBox.java +++ b/test/hotspot/jtreg/vmTestbase/metaspace/share/TriggerUnloadingWithWhiteBox.java @@ -20,7 +20,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package vm.share.gc; +package metaspace.share; import jdk.test.whitebox.WhiteBox; diff --git a/test/hotspot/jtreg/vmTestbase/metaspace/staticReferences/StaticReferences.java b/test/hotspot/jtreg/vmTestbase/metaspace/staticReferences/StaticReferences.java index 690f2a675170..7ea901abe06f 100644 --- a/test/hotspot/jtreg/vmTestbase/metaspace/staticReferences/StaticReferences.java +++ b/test/hotspot/jtreg/vmTestbase/metaspace/staticReferences/StaticReferences.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, 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,14 +53,14 @@ import java.util.Map; import java.util.Random; -import vm.share.InMemoryJavaCompiler; +import metaspace.share.TriggerUnloadingHelper; +import metaspace.share.TriggerUnloadingWithWhiteBox; import nsk.share.gc.GCTestBase; import nsk.share.test.ExecutionController; import nsk.share.test.Stresser; import nsk.share.test.TestBase; import nsk.share.test.Tests; -import vm.share.gc.TriggerUnloadingHelper; -import vm.share.gc.TriggerUnloadingWithWhiteBox; +import jdk.test.lib.compiler.InMemoryJavaCompiler; /** * Test checks that static fields will be initialized in new loaded class. Test performs in loop the following routine: @@ -210,9 +210,7 @@ private void checkStaticFields(Class clazz) { } private byte[] generateAndCompile(int[] fieldQuantities) { - Map sources = new HashMap(); - sources.put("A", generateSource(fieldQuantities)); - return InMemoryJavaCompiler.compile(sources).values().iterator().next(); + return InMemoryJavaCompiler.compile("A", generateSource(fieldQuantities)); } private StringBuffer generateSource(int[] fieldQuantities) { diff --git a/test/hotspot/jtreg/vmTestbase/metaspace/stressDictionary/StressDictionary.java b/test/hotspot/jtreg/vmTestbase/metaspace/stressDictionary/StressDictionary.java index b4c44a9a0597..0db2d24fa8f9 100644 --- a/test/hotspot/jtreg/vmTestbase/metaspace/stressDictionary/StressDictionary.java +++ b/test/hotspot/jtreg/vmTestbase/metaspace/stressDictionary/StressDictionary.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -43,7 +43,7 @@ import nsk.share.gc.GCTestBase; import nsk.share.test.*; -import vm.share.InMemoryJavaCompiler; +import jdk.test.lib.compiler.InMemoryJavaCompiler; /** * There is a data structure named "dictionary" in class BlockFreelist. It stores @@ -178,10 +178,8 @@ public void run() { } private byte[] generateAndCompile() { - Map sources = new HashMap(); String className = "MyClass" + classesCounter.incrementAndGet(); - sources.put(className, generateSource(className)); - return InMemoryJavaCompiler.compile(sources).values().iterator().next(); + return InMemoryJavaCompiler.compile(className, generateSource(className)); } private CharSequence generateSource(String className) { diff --git a/test/hotspot/jtreg/vmTestbase/metaspace/stressHierarchy/common/PerformChecksHelper.java b/test/hotspot/jtreg/vmTestbase/metaspace/stressHierarchy/common/PerformChecksHelper.java index 476dceb395de..3d57bfb6ea9e 100644 --- a/test/hotspot/jtreg/vmTestbase/metaspace/stressHierarchy/common/PerformChecksHelper.java +++ b/test/hotspot/jtreg/vmTestbase/metaspace/stressHierarchy/common/PerformChecksHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,13 +28,13 @@ import java.lang.reflect.Proxy; import java.util.List; +import jdk.test.whitebox.WhiteBox; +import metaspace.share.TriggerUnloadingHelper; import metaspace.stressHierarchy.common.classloader.tree.Node; import metaspace.stressHierarchy.common.classloader.tree.Tree; import metaspace.stressHierarchy.common.exceptions.ClassNotUnloadedException; import metaspace.stressHierarchy.common.exceptions.TimeIsOverException; import nsk.share.test.ExecutionController; -import jdk.test.whitebox.WhiteBox; -import vm.share.gc.TriggerUnloadingHelper; public class PerformChecksHelper { diff --git a/test/hotspot/jtreg/vmTestbase/metaspace/stressHierarchy/common/StressHierarchyBaseClass.java b/test/hotspot/jtreg/vmTestbase/metaspace/stressHierarchy/common/StressHierarchyBaseClass.java index 61a19baf98e3..20fcdabb13cf 100644 --- a/test/hotspot/jtreg/vmTestbase/metaspace/stressHierarchy/common/StressHierarchyBaseClass.java +++ b/test/hotspot/jtreg/vmTestbase/metaspace/stressHierarchy/common/StressHierarchyBaseClass.java @@ -24,11 +24,10 @@ import java.net.MalformedURLException; -import vm.share.gc.HeapOOMEException; -import vm.share.gc.TriggerUnloadingByFillingMetaspace; -import vm.share.gc.TriggerUnloadingHelper; -import vm.share.gc.TriggerUnloadingWithWhiteBox; - +import metaspace.share.HeapOOMEException; +import metaspace.share.TriggerUnloadingByFillingMetaspace; +import metaspace.share.TriggerUnloadingHelper; +import metaspace.share.TriggerUnloadingWithWhiteBox; import metaspace.stressHierarchy.common.classloader.tree.Node; import metaspace.stressHierarchy.common.classloader.tree.Tree; import metaspace.stressHierarchy.common.exceptions.TimeIsOverException; diff --git a/test/hotspot/jtreg/vmTestbase/metaspace/stressHierarchy/common/generateHierarchy/GenerateHierarchyHelper.java b/test/hotspot/jtreg/vmTestbase/metaspace/stressHierarchy/common/generateHierarchy/GenerateHierarchyHelper.java index daccf6443937..be6f1ebe85f3 100644 --- a/test/hotspot/jtreg/vmTestbase/metaspace/stressHierarchy/common/generateHierarchy/GenerateHierarchyHelper.java +++ b/test/hotspot/jtreg/vmTestbase/metaspace/stressHierarchy/common/generateHierarchy/GenerateHierarchyHelper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ import java.util.*; -import vm.share.InMemoryJavaCompiler; +import jdk.test.lib.compiler.InMemoryJavaCompiler; import jdk.test.lib.Utils; public class GenerateHierarchyHelper { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/agent00.cpp b/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/agent00.cpp index 932d44e6727b..a4c5eafd87f7 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/agent00.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/agent00.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ #include #include #include -#include +#include extern "C" { @@ -37,7 +37,7 @@ JNIEXPORT jint JNICALL Agent_OnAttach(JavaVM *vm, char *optionsString, void *res // can't use NSK_DISPLAY since needed for nsk_ functions initialization isn't done here jni = (JNIEnv*) nsk_aod_createJNIEnv(vm); - if (jni == NULL) + if (jni == nullptr) return JNI_ERR; printf("%s: initialization was done\n", AGENT_NAME); @@ -46,7 +46,7 @@ JNIEXPORT jint JNICALL Agent_OnAttach(JavaVM *vm, char *optionsString, void *res if (!NSK_VERIFY(nsk_aod_agentLoaded(jni, AGENT_NAME))) return JNI_ERR; - if (optionsString == NULL) { + if (optionsString == nullptr) { success = 0; printf("%s: ERROR: unexpected null options\n", AGENT_NAME); fflush(stdout); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/agent01.cpp b/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/agent01.cpp index 04949f4d8617..5209cfd393d2 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/agent01.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/agent01.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ #include #include #include -#include +#include extern "C" { @@ -40,7 +40,7 @@ JNIEXPORT jint JNICALL Agent_OnAttach(JavaVM *vm, char *optionsString, void *res // can't use NSK_DISPLAY since needed for nsk_ functions initialization isn't done here jni = (JNIEnv*) nsk_aod_createJNIEnv(vm); - if (jni == NULL) + if (jni == nullptr) return JNI_ERR; printf("%s: initialization was done\n", AGENT_NAME); @@ -49,7 +49,7 @@ JNIEXPORT jint JNICALL Agent_OnAttach(JavaVM *vm, char *optionsString, void *res if (!NSK_VERIFY(nsk_aod_agentLoaded(jni, AGENT_NAME))) return JNI_ERR; - if (optionsString == NULL) { + if (optionsString == nullptr) { success = 0; printf("%s: ERROR: unexpected null options\n", AGENT_NAME); fflush(stdout); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/agent02.cpp b/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/agent02.cpp index b93f3ba03c0f..f8e5b20c18e0 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/agent02.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/agent02.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ #include #include #include -#include +#include extern "C" { @@ -42,7 +42,7 @@ JNIEXPORT jint JNICALL Agent_OnAttach(JavaVM *vm, char *optionsString, void *res // can't use NSK_DISPLAY since needed for nsk_ functions initialization isn't done here jni = (JNIEnv*) nsk_aod_createJNIEnv(vm); - if (jni == NULL) + if (jni == nullptr) return JNI_ERR; printf("%s: initialization was done\n", AGENT_NAME); @@ -51,7 +51,7 @@ JNIEXPORT jint JNICALL Agent_OnAttach(JavaVM *vm, char *optionsString, void *res if (!NSK_VERIFY(nsk_aod_agentLoaded(jni, AGENT_NAME))) return JNI_ERR; - if (optionsString == NULL) { + if (optionsString == nullptr) { success = 0; printf("%s: ERROR: unexpected null options\n", AGENT_NAME); fflush(stdout); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/agent03.cpp b/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/agent03.cpp index 029057cc4b9e..f2d3586ee6b3 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/agent03.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine07/agent03.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ #include #include #include -#include +#include extern "C" { @@ -39,7 +39,7 @@ JNIEXPORT jint JNICALL Agent_OnAttach(JavaVM *vm, char *optionsString, void *res JNIEnv* jni; jni = (JNIEnv*) nsk_aod_createJNIEnv(vm); - if (jni == NULL) + if (jni == nullptr) return JNI_ERR; // can't use NSK_DISPLAY since needed for nsk_ functions initialization isn't done here diff --git a/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine09/agent00.cpp b/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine09/agent00.cpp index c63187191d99..799a34d26d0d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine09/agent00.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/aod/VirtualMachine/VirtualMachine09/agent00.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ #include #include #include -#include +#include extern "C" { @@ -44,18 +44,18 @@ JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *vm, char *optionsString, void *reser } JNIEXPORT jint JNICALL Agent_OnAttach(JavaVM *vm, char *optionsString, void *reserved) { - JNIEnv* jni = NULL; - Options* options = NULL; + JNIEnv* jni = nullptr; + Options* options = nullptr; const char* agentName; options = (Options*) nsk_aod_createOptions(optionsString); - if (!NSK_VERIFY(options != NULL)) + if (!NSK_VERIFY(options != nullptr)) return JNI_ERR; agentName = nsk_aod_getOptionValue(options, NSK_AOD_AGENT_NAME_OPTION); jni = (JNIEnv*) nsk_aod_createJNIEnv(vm); - if (jni == NULL) + if (jni == nullptr) return JNI_ERR; NSK_DISPLAY1("%s: initialization was done\n", agentName); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdb/stop_at/stop_at002/stop_at002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdb/stop_at/stop_at002/stop_at002.java index 620c50fa2ae2..9dae8c17cfc3 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdb/stop_at/stop_at002/stop_at002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/stop_at/stop_at002/stop_at002.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2024, 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 @@ -82,17 +82,10 @@ public static int run(String argv[], PrintStream out) { static final String DEBUGGEE_CLASS = TEST_CLASS + "a"; static final String FIRST_BREAK = DEBUGGEE_CLASS + ".main"; static final String LAST_BREAK = DEBUGGEE_CLASS + ".lastBreak"; - static final String DEBUGGEE_LOCATION1 = DEBUGGEE_CLASS + "$Nested$DeeperNested$DeepestNested:43"; - static final String DEBUGGEE_LOCATION2 = DEBUGGEE_CLASS + "$Inner$MoreInner:57"; - static final String FAILURE_PATTERN = "Unable to set"; + static final String DEBUGGEE_LOCATION1 = DEBUGGEE_CLASS + "$Nested$DeeperNested$DeepestNested:64"; + static final String DEBUGGEE_LOCATION2 = DEBUGGEE_CLASS + "$Inner$MoreInner:78"; protected void runCases() { - String[] reply; - Paragrep grep; - int count; - Vector v; - String found; - if (!checkStop(DEBUGGEE_LOCATION1)) { success = false; } @@ -101,25 +94,62 @@ protected void runCases() { success = false; } - jdb.contToExit(3); + if (!checkBreakpointHit(DEBUGGEE_LOCATION1)) { + success = false; + } + + if (!checkBreakpointHit(DEBUGGEE_LOCATION2)) { + success = false; + } + + jdb.contToExit(1); } - private boolean checkStop (String location) { + private boolean checkStop(String location) { Paragrep grep; String[] reply; String found; - boolean result = true; log.display("Trying to set breakpoint at line: " + location); reply = jdb.receiveReplyFor(JdbCommand.stop_at + location); grep = new Paragrep(reply); - found = grep.findFirst(FAILURE_PATTERN); + found = grep.findFirst("Deferring breakpoint " + location); + if (found.length() == 0) { + log.complain("jdb failed to setup deferred breakpoint at line: " + location); + return false; + } + + return true; + } + + private boolean checkBreakpointHit(String location) { + Paragrep grep; + String[] reply; + String found; + + log.display("continuing to breakpoint at line: " + location); + reply = jdb.receiveReplyFor(JdbCommand.cont); + grep = new Paragrep(reply); + + found = grep.findFirst("Unable to set deferred breakpoint"); if (found.length() > 0) { - log.complain("jdb failed to set line breakpoint at line: " + found); - result = false; + log.complain("jdb failed to set deferred breakpoint at line: " + location); + return false; + } + + found = grep.findFirst("Set deferred breakpoint " + location); + if (found.length() == 0) { + log.complain("jdb failed to set deferred breakpoint at line: " + location); + return false; + } + + found = grep.findFirst("Breakpoint hit: \"thread=main\", "); + if (found.length() == 0) { + log.complain("jdb failed to hit breakpoint at line: " + location); + return false; } - return result; + return true; } } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdb/stop_at/stop_at002/stop_at002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdb/stop_at/stop_at002/stop_at002a.java index 9195dd269861..d4a40689372d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdb/stop_at/stop_at002/stop_at002a.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdb/stop_at/stop_at002/stop_at002a.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,6 +21,8 @@ * questions. */ +// THIS TEST IS LINE NUMBER SENSITIVE + package nsk.jdb.stop_at.stop_at002; import nsk.share.*; @@ -59,7 +61,7 @@ class Nested { class DeeperNested { class DeepestNested { public void foo(boolean input) { - flag = input; /* <-------- This is line number 43 */ + flag = input; /* <-------- This is line number 64 */ } } } @@ -73,7 +75,7 @@ public MoreInner() { content = ""; } public void foo(String input) { - content += input; /* <-------- This is line number 57 */ + content += input; /* <-------- This is line number 78 */ } } } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/stop/stop002t.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/stop/stop002t.java index 694485e608eb..e82b749c9059 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/stop/stop002t.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/ThreadReference/stop/stop002t.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2024, 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 @@ -180,7 +180,7 @@ private int runIt(String args[]) { log.display("TEST #5: interrupted = " + Thread.interrupted()); // We don't expect the exception to be thrown when in vthread mode. if (!vthreadMode && t instanceof MyThrowable) { - log.display("TEST #5: Caught expected exception while in loop: " + t); + log.display("TEST #5: Caught expected exception while in sleep: " + t); } else { log.complain("TEST #5: Unexpected exception caught: " + t); t.printStackTrace(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMOutOfMemoryException/VMOutOfMemoryException001/VMOutOfMemoryException001t.java b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMOutOfMemoryException/VMOutOfMemoryException001/VMOutOfMemoryException001t.java index 6b41e8f790e2..5f402a5540cd 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMOutOfMemoryException/VMOutOfMemoryException001/VMOutOfMemoryException001t.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdi/VMOutOfMemoryException/VMOutOfMemoryException001/VMOutOfMemoryException001t.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, 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 @@ -33,22 +33,23 @@ */ public class VMOutOfMemoryException001t extends AbstractJDIDebuggee { + public static int[] reserverdMemory = new int[1024 * 1024]; public static void main(String args[]) { new VMOutOfMemoryException001t().doTest(args); } // Just call normal doTest() function, but hide any OutOfMemoryErrors. + @Override public void doTest() { boolean isOutOfMemory = false; try { super.doTest(); } catch (OutOfMemoryError e) { - // Don't log anything. We are out of memory. - // A println is likely to genereate a new OutOfMemoryError isOutOfMemory = true; + reserverdMemory = null; + log.display("Got expected OOME."); } - // Normally the super class handles the return value. // If we got here after an OutOfMemoryError, we consider the test passed. if (isOutOfMemory && callExit) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ArrayReference/GetValues/getvalues001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ArrayReference/GetValues/getvalues001.java index 60ae805703b1..5af71d569f16 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ArrayReference/GetValues/getvalues001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ArrayReference/GetValues/getvalues001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -89,7 +89,10 @@ public class getvalues001 { * Start test from command line. */ public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ArrayReference/GetValues/getvalues001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ArrayReference/GetValues/getvalues001/TestDescription.java index 4fc9630df3c8..04ddee420613 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ArrayReference/GetValues/getvalues001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ArrayReference/GetValues/getvalues001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -58,7 +58,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.ArrayReference.GetValues.getvalues001a - * @run main/othervm + * @run driver * nsk.jdwp.ArrayReference.GetValues.getvalues001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ArrayReference/GetValues/getvalues002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ArrayReference/GetValues/getvalues002.java index 47f4097dae68..d5d44faef48a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ArrayReference/GetValues/getvalues002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ArrayReference/GetValues/getvalues002.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -116,7 +116,10 @@ public class getvalues002 { * Start test from command line. */ public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ArrayReference/GetValues/getvalues002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ArrayReference/GetValues/getvalues002/TestDescription.java index 92b567dccf27..5e1e30ae541c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ArrayReference/GetValues/getvalues002/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ArrayReference/GetValues/getvalues002/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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,7 +60,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.ArrayReference.GetValues.getvalues002a - * @run main/othervm + * @run driver * nsk.jdwp.ArrayReference.GetValues.getvalues002 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ArrayReference/Length/length001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ArrayReference/Length/length001.java index 36324982533e..45acc929bfa2 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ArrayReference/Length/length001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ArrayReference/Length/length001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -85,7 +85,10 @@ public class length001 { * Start test from command line. */ public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ArrayReference/Length/length001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ArrayReference/Length/length001/TestDescription.java index 164d8c8ecab8..2f96d7c3a079 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ArrayReference/Length/length001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ArrayReference/Length/length001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -57,7 +57,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.ArrayReference.Length.length001a - * @run main/othervm + * @run driver * nsk.jdwp.ArrayReference.Length.length001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ArrayReference/SetValues/setvalues001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ArrayReference/SetValues/setvalues001.java index 117d66fe24c4..12c06d8735df 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ArrayReference/SetValues/setvalues001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ArrayReference/SetValues/setvalues001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -92,7 +92,10 @@ public class setvalues001 { * Start test from command line. */ public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ArrayReference/SetValues/setvalues001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ArrayReference/SetValues/setvalues001/TestDescription.java index 380ba4549ef4..bf252a44d43c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ArrayReference/SetValues/setvalues001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ArrayReference/SetValues/setvalues001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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,7 +60,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.ArrayReference.SetValues.setvalues001a - * @run main/othervm + * @run driver * nsk.jdwp.ArrayReference.SetValues.setvalues001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ArrayType/NewInstance/newinstance001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ArrayType/NewInstance/newinstance001.java index c56ccde4c2f6..b29a39fb4c5e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ArrayType/NewInstance/newinstance001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ArrayType/NewInstance/newinstance001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -84,7 +84,10 @@ public class newinstance001 { * Start test from command line. */ public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ArrayType/NewInstance/newinstance001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ArrayType/NewInstance/newinstance001/TestDescription.java index 7376e32c3cc3..66b15f216658 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ArrayType/NewInstance/newinstance001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ArrayType/NewInstance/newinstance001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -55,7 +55,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.ArrayType.NewInstance.newinstance001a - * @run main/othervm + * @run driver * nsk.jdwp.ArrayType.NewInstance.newinstance001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ClassLoaderReference/VisibleClasses/visibclasses001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ClassLoaderReference/VisibleClasses/visibclasses001.java index ba21914994d1..1c02b225e0b3 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ClassLoaderReference/VisibleClasses/visibclasses001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ClassLoaderReference/VisibleClasses/visibclasses001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -81,7 +81,10 @@ public class visibclasses001 { * Start test from command line. */ public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ClassLoaderReference/VisibleClasses/visibclasses001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ClassLoaderReference/VisibleClasses/visibclasses001/TestDescription.java index b298e05d7217..379091615fec 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ClassLoaderReference/VisibleClasses/visibclasses001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ClassLoaderReference/VisibleClasses/visibclasses001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -57,7 +57,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.ClassLoaderReference.VisibleClasses.visibclasses001a - * @run main/othervm + * @run driver * nsk.jdwp.ClassLoaderReference.VisibleClasses.visibclasses001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ClassObjectReference/ReflectedType/reflectype001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ClassObjectReference/ReflectedType/reflectype001.java index b894d10c1b09..a23144b50e6d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ClassObjectReference/ReflectedType/reflectype001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ClassObjectReference/ReflectedType/reflectype001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -45,7 +45,10 @@ public class reflectype001 { static final String TESTED_CLASS_SIGNATURE = "L" + TESTED_CLASS_NAME.replace('.', '/') + ";"; public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } public static int run(String argv[], PrintStream out) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ClassObjectReference/ReflectedType/reflectype001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ClassObjectReference/ReflectedType/reflectype001/TestDescription.java index f476b8df0c80..ea86ce80bcbe 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ClassObjectReference/ReflectedType/reflectype001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ClassObjectReference/ReflectedType/reflectype001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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,7 +60,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.ClassObjectReference.ReflectedType.reflectype001a - * @run main/othervm + * @run driver * nsk.jdwp.ClassObjectReference.ReflectedType.reflectype001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ClassType/InvokeMethod/invokemeth001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ClassType/InvokeMethod/invokemeth001.java index d9f5e31b6531..c5ab5ed56c83 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ClassType/InvokeMethod/invokemeth001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ClassType/InvokeMethod/invokemeth001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -97,7 +97,10 @@ public class invokemeth001 { * Start test from command line. */ public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ClassType/InvokeMethod/invokemeth001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ClassType/InvokeMethod/invokemeth001/TestDescription.java index 9b97c95b32f1..c393e091c56a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ClassType/InvokeMethod/invokemeth001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ClassType/InvokeMethod/invokemeth001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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,7 +60,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.ClassType.InvokeMethod.invokemeth001a - * @run main/othervm + * @run driver * nsk.jdwp.ClassType.InvokeMethod.invokemeth001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ClassType/NewInstance/newinst001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ClassType/NewInstance/newinst001.java index ff23a6420e64..a2323daaf749 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ClassType/NewInstance/newinst001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ClassType/NewInstance/newinst001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -96,8 +96,11 @@ public class newinst001 { /** * Start test from command line. */ - public static void main(String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + public static void main (String argv[]) { + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ClassType/NewInstance/newinst001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ClassType/NewInstance/newinst001/TestDescription.java index 6132dbc6a4d3..2d9abe94b73b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ClassType/NewInstance/newinst001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ClassType/NewInstance/newinst001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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,7 +60,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.ClassType.NewInstance.newinst001a - * @run main/othervm + * @run driver * nsk.jdwp.ClassType.NewInstance.newinst001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ClassType/SetValues/setvalues001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ClassType/SetValues/setvalues001.java index 7931560a853e..e40906c299ae 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ClassType/SetValues/setvalues001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ClassType/SetValues/setvalues001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -88,7 +88,10 @@ public class setvalues001 { * Start test from command line. */ public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ClassType/SetValues/setvalues001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ClassType/SetValues/setvalues001/TestDescription.java index 24b11421e086..015e3377537b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ClassType/SetValues/setvalues001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ClassType/SetValues/setvalues001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.ClassType.SetValues.setvalues001a - * @run main/othervm + * @run driver * nsk.jdwp.ClassType.SetValues.setvalues001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ClassType/Superclass/superclass001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ClassType/Superclass/superclass001.java index 1e46507079e9..4aed67d1f7e3 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ClassType/Superclass/superclass001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ClassType/Superclass/superclass001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -85,7 +85,10 @@ public class superclass001 { * Start test from command line. */ public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ClassType/Superclass/superclass001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ClassType/Superclass/superclass001/TestDescription.java index 02082032398f..6cd1cd940429 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ClassType/Superclass/superclass001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ClassType/Superclass/superclass001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -56,7 +56,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.ClassType.Superclass.superclass001a - * @run main/othervm + * @run driver * nsk.jdwp.ClassType.Superclass.superclass001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/BREAKPOINT/breakpoint001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/BREAKPOINT/breakpoint001.java index 60b926256ada..6518ff5bb06d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/BREAKPOINT/breakpoint001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/BREAKPOINT/breakpoint001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -90,8 +90,11 @@ public class breakpoint001 { /** * Start test from command line. */ - public static void main(String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + public static void main (String argv[]) { + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/BREAKPOINT/breakpoint001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/BREAKPOINT/breakpoint001/TestDescription.java index f4583fc10155..72c5a23c94f3 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/BREAKPOINT/breakpoint001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/BREAKPOINT/breakpoint001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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,7 +60,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.Event.BREAKPOINT.breakpoint001a - * @run main/othervm + * @run driver * nsk.jdwp.Event.BREAKPOINT.breakpoint001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/CLASS_PREPARE/clsprepare001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/CLASS_PREPARE/clsprepare001.java index 4bb0add7c650..3edb73a609c9 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/CLASS_PREPARE/clsprepare001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/CLASS_PREPARE/clsprepare001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -80,8 +80,11 @@ public class clsprepare001 { /** * Start test from command line. */ - public static void main(String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + public static void main (String argv[]) { + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/CLASS_PREPARE/clsprepare001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/CLASS_PREPARE/clsprepare001/TestDescription.java index 8690a9d6125f..563db7224247 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/CLASS_PREPARE/clsprepare001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/CLASS_PREPARE/clsprepare001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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,7 +60,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.Event.CLASS_PREPARE.clsprepare001a - * @run main/othervm + * @run driver * nsk.jdwp.Event.CLASS_PREPARE.clsprepare001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/CLASS_UNLOAD/clsunload001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/CLASS_UNLOAD/clsunload001.java index ba6905a68bde..ccfec8efeb9e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/CLASS_UNLOAD/clsunload001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/CLASS_UNLOAD/clsunload001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -80,8 +80,11 @@ public class clsunload001 { /** * Start test from command line. */ - public static void main(String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + public static void main (String argv[]) { + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/CLASS_UNLOAD/clsunload001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/CLASS_UNLOAD/clsunload001/TestDescription.java index 2d323c719314..354b71a085ed 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/CLASS_UNLOAD/clsunload001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/CLASS_UNLOAD/clsunload001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -62,7 +62,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.Event.CLASS_UNLOAD.clsunload001a - * @run main/othervm + * @run driver * nsk.jdwp.Event.CLASS_UNLOAD.clsunload001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/Composite/composite001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/Composite/composite001.java index 0d6c11c40c81..789402dd37a0 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/Composite/composite001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/Composite/composite001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -75,8 +75,11 @@ public class composite001 { /** * Start test from command line. */ - public static void main(String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + public static void main (String argv[]) { + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/Composite/composite001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/Composite/composite001/TestDescription.java index 5cf8976cb880..ad91d73534c0 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/Composite/composite001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/Composite/composite001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -49,7 +49,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.Event.Composite.composite001a - * @run main/othervm + * @run driver * nsk.jdwp.Event.Composite.composite001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/EXCEPTION/exception001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/EXCEPTION/exception001.java index 2092256ef6c0..0fca4cb44f99 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/EXCEPTION/exception001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/EXCEPTION/exception001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -97,8 +97,11 @@ public class exception001 { /** * Start test from command line. */ - public static void main(String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + public static void main (String argv[]) { + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/EXCEPTION/exception001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/EXCEPTION/exception001/TestDescription.java index 9524d171c4bc..7307c026cf51 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/EXCEPTION/exception001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/EXCEPTION/exception001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -64,7 +64,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.Event.EXCEPTION.exception001a - * @run main/othervm + * @run driver * nsk.jdwp.Event.EXCEPTION.exception001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/FIELD_ACCESS/fldaccess001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/FIELD_ACCESS/fldaccess001.java index c81d901115cd..1c6b5f4a931a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/FIELD_ACCESS/fldaccess001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/FIELD_ACCESS/fldaccess001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -99,8 +99,11 @@ public class fldaccess001 { /** * Start test from command line. */ - public static void main(String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + public static void main (String argv[]) { + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/FIELD_ACCESS/fldaccess001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/FIELD_ACCESS/fldaccess001/TestDescription.java index d0c835009d60..ff74b0849ee2 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/FIELD_ACCESS/fldaccess001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/FIELD_ACCESS/fldaccess001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -63,7 +63,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.Event.FIELD_ACCESS.fldaccess001a - * @run main/othervm + * @run driver * nsk.jdwp.Event.FIELD_ACCESS.fldaccess001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/FIELD_MODIFICATION/fldmodification001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/FIELD_MODIFICATION/fldmodification001.java index 7bcf14c87c3a..840b48428e51 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/FIELD_MODIFICATION/fldmodification001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/FIELD_MODIFICATION/fldmodification001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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,11 @@ public class fldmodification001 { /** * Start test from command line. */ - public static void main(String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + public static void main (String argv[]) { + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/FIELD_MODIFICATION/fldmodification001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/FIELD_MODIFICATION/fldmodification001/TestDescription.java index 5055936173d1..3901a6eaf8c7 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/FIELD_MODIFICATION/fldmodification001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/FIELD_MODIFICATION/fldmodification001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -64,7 +64,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.Event.FIELD_MODIFICATION.fldmodification001a - * @run main/othervm + * @run driver * nsk.jdwp.Event.FIELD_MODIFICATION.fldmodification001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/METHOD_ENTRY/methentry001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/METHOD_ENTRY/methentry001.java index 6d75896e2dfc..b8834e94bcfd 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/METHOD_ENTRY/methentry001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/METHOD_ENTRY/methentry001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -92,8 +92,11 @@ public class methentry001 { /** * Start test from command line. */ - public static void main(String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + public static void main (String argv[]) { + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/METHOD_ENTRY/methentry001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/METHOD_ENTRY/methentry001/TestDescription.java index e41084de6281..106002fdf9d6 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/METHOD_ENTRY/methentry001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/METHOD_ENTRY/methentry001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,7 +61,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.Event.METHOD_ENTRY.methentry001a - * @run main/othervm + * @run driver * nsk.jdwp.Event.METHOD_ENTRY.methentry001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/METHOD_EXIT/methexit001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/METHOD_EXIT/methexit001.java index a113161ca324..6da08d6b8581 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/METHOD_EXIT/methexit001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/METHOD_EXIT/methexit001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -92,8 +92,11 @@ public class methexit001 { /** * Start test from command line. */ - public static void main(String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + public static void main (String argv[]) { + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/METHOD_EXIT/methexit001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/METHOD_EXIT/methexit001/TestDescription.java index bd765e2ea884..e6a74885a13b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/METHOD_EXIT/methexit001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/METHOD_EXIT/methexit001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,7 +61,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.Event.METHOD_EXIT.methexit001a - * @run main/othervm + * @run driver * nsk.jdwp.Event.METHOD_EXIT.methexit001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/SINGLE_STEP/singlestep001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/SINGLE_STEP/singlestep001.java index 25003f018a0a..fef8a0959082 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/SINGLE_STEP/singlestep001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/SINGLE_STEP/singlestep001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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,8 +93,11 @@ public class singlestep001 { /** * Start test from command line. */ - public static void main(String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + public static void main (String argv[]) { + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/SINGLE_STEP/singlestep001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/SINGLE_STEP/singlestep001/TestDescription.java index 7d7afefd4460..661189bcf310 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/SINGLE_STEP/singlestep001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/SINGLE_STEP/singlestep001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -63,7 +63,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.Event.SINGLE_STEP.singlestep001a - * @run main/othervm + * @run driver * nsk.jdwp.Event.SINGLE_STEP.singlestep001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/SINGLE_STEP/singlestep002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/SINGLE_STEP/singlestep002.java index 50e55925d0d4..66c9e65df56e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/SINGLE_STEP/singlestep002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/SINGLE_STEP/singlestep002.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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,11 @@ public class singlestep002 { /** * Start test from command line. */ - public static void main(String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + public static void main (String argv[]) { + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/SINGLE_STEP/singlestep002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/SINGLE_STEP/singlestep002/TestDescription.java index ac11ead1f092..4fe15d10884e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/SINGLE_STEP/singlestep002/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/SINGLE_STEP/singlestep002/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -63,7 +63,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.Event.SINGLE_STEP.singlestep002a - * @run main/othervm + * @run driver * nsk.jdwp.Event.SINGLE_STEP.singlestep002 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/SINGLE_STEP/singlestep003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/SINGLE_STEP/singlestep003.java index ae98242c0eeb..47ef6474536b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/SINGLE_STEP/singlestep003.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/SINGLE_STEP/singlestep003.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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,11 @@ public class singlestep003 { /** * Start test from command line. */ - public static void main(String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + public static void main (String argv[]) { + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/SINGLE_STEP/singlestep003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/SINGLE_STEP/singlestep003/TestDescription.java index 00cf70a223d8..d3c38bcbeb8b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/SINGLE_STEP/singlestep003/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/SINGLE_STEP/singlestep003/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -63,7 +63,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.Event.SINGLE_STEP.singlestep003a - * @run main/othervm + * @run driver * nsk.jdwp.Event.SINGLE_STEP.singlestep003 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/THREAD_DEATH/thrdeath001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/THREAD_DEATH/thrdeath001.java index f5aae7067db5..753e5b494805 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/THREAD_DEATH/thrdeath001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/THREAD_DEATH/thrdeath001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -88,8 +88,11 @@ public class thrdeath001 { /** * Start test from command line. */ - public static void main(String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + public static void main (String argv[]) { + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/THREAD_DEATH/thrdeath001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/THREAD_DEATH/thrdeath001/TestDescription.java index 85dd77be7e9c..8cd28cb2381d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/THREAD_DEATH/thrdeath001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/THREAD_DEATH/thrdeath001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,7 +61,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.Event.THREAD_DEATH.thrdeath001a - * @run main/othervm + * @run driver * nsk.jdwp.Event.THREAD_DEATH.thrdeath001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/THREAD_START/thrstart001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/THREAD_START/thrstart001.java index f525d7d550fa..7936fcbf5cb4 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/THREAD_START/thrstart001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/THREAD_START/thrstart001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -88,8 +88,11 @@ public class thrstart001 { /** * Start test from command line. */ - public static void main(String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + public static void main (String argv[]) { + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/THREAD_START/thrstart001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/THREAD_START/thrstart001/TestDescription.java index a43503248490..7345debf5252 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/THREAD_START/thrstart001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/THREAD_START/thrstart001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,7 +61,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.Event.THREAD_START.thrstart001a - * @run main/othervm + * @run driver * nsk.jdwp.Event.THREAD_START.thrstart001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/VM_DEATH/vmdeath001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/VM_DEATH/vmdeath001.java index 771e121d8cec..8a8526bbeb2e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/VM_DEATH/vmdeath001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/VM_DEATH/vmdeath001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -74,8 +74,11 @@ public class vmdeath001 { /** * Start test from command line. */ - public static void main(String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + public static void main (String argv[]) { + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/VM_DEATH/vmdeath001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/VM_DEATH/vmdeath001/TestDescription.java index e1f3b1053b48..f40ecc66655d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/VM_DEATH/vmdeath001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/VM_DEATH/vmdeath001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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,7 +53,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.Event.VM_DEATH.vmdeath001a - * @run main/othervm + * @run driver * nsk.jdwp.Event.VM_DEATH.vmdeath001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/VM_DEATH/vmdeath002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/VM_DEATH/vmdeath002.java index 20f96d064d1e..6bfb79d2575a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/VM_DEATH/vmdeath002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/VM_DEATH/vmdeath002.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -81,8 +81,11 @@ public class vmdeath002 { /** * Start test from command line. */ - public static void main(String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + public static void main (String argv[]) { + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/VM_DEATH/vmdeath002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/VM_DEATH/vmdeath002/TestDescription.java index f0dbd749a327..cee21042bf57 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/VM_DEATH/vmdeath002/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/VM_DEATH/vmdeath002/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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,7 +60,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.Event.VM_DEATH.vmdeath002a - * @run main/othervm + * @run driver * nsk.jdwp.Event.VM_DEATH.vmdeath002 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/VM_START/vmstart001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/VM_START/vmstart001.java index 58d77cd8901a..eac5ee3efb66 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/VM_START/vmstart001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/VM_START/vmstart001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -74,8 +74,11 @@ public class vmstart001 { /** * Start test from command line. */ - public static void main(String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + public static void main (String argv[]) { + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/VM_START/vmstart001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/VM_START/vmstart001/TestDescription.java index 139db45bef5b..b0d6abd6928f 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/VM_START/vmstart001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Event/VM_START/vmstart001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -51,7 +51,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.Event.VM_START.vmstart001a - * @run main/othervm + * @run driver * nsk.jdwp.Event.VM_START.vmstart001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/EventRequest/Clear/clear001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/EventRequest/Clear/clear001.java index 4973cac34a7a..dccddcf80665 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/EventRequest/Clear/clear001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/EventRequest/Clear/clear001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -88,8 +88,11 @@ public class clear001 { /** * Start test from command line. */ - public static void main(String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + public static void main (String argv[]) { + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/EventRequest/Clear/clear001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/EventRequest/Clear/clear001/TestDescription.java index acc4090eb10e..cc544397bf2c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/EventRequest/Clear/clear001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/EventRequest/Clear/clear001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -58,7 +58,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.EventRequest.Clear.clear001a - * @run main/othervm + * @run driver * nsk.jdwp.EventRequest.Clear.clear001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/EventRequest/ClearAllBreakpoints/clrallbreakp001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/EventRequest/ClearAllBreakpoints/clrallbreakp001.java index b4cbd4f20722..166334be16a5 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/EventRequest/ClearAllBreakpoints/clrallbreakp001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/EventRequest/ClearAllBreakpoints/clrallbreakp001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -88,8 +88,11 @@ public class clrallbreakp001 { /** * Start test from command line. */ - public static void main(String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + public static void main (String argv[]) { + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/EventRequest/ClearAllBreakpoints/clrallbreakp001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/EventRequest/ClearAllBreakpoints/clrallbreakp001/TestDescription.java index 49c6d12afa52..bd251fe9c91a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/EventRequest/ClearAllBreakpoints/clrallbreakp001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/EventRequest/ClearAllBreakpoints/clrallbreakp001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -56,7 +56,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.EventRequest.ClearAllBreakpoints.clrallbreakp001a - * @run main/othervm + * @run driver * nsk.jdwp.EventRequest.ClearAllBreakpoints.clrallbreakp001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/EventRequest/ClearAllBreakpoints/clrallbreakp002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/EventRequest/ClearAllBreakpoints/clrallbreakp002.java index c106daa64ff2..1a881b075f12 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/EventRequest/ClearAllBreakpoints/clrallbreakp002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/EventRequest/ClearAllBreakpoints/clrallbreakp002.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -82,8 +82,11 @@ public class clrallbreakp002 { /** * Start test from command line. */ - public static void main(String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + public static void main (String argv[]) { + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/EventRequest/ClearAllBreakpoints/clrallbreakp002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/EventRequest/ClearAllBreakpoints/clrallbreakp002/TestDescription.java index 981b8fccb5ef..53fa51809db3 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/EventRequest/ClearAllBreakpoints/clrallbreakp002/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/EventRequest/ClearAllBreakpoints/clrallbreakp002/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -50,7 +50,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.EventRequest.ClearAllBreakpoints.clrallbreakp002a - * @run main/othervm + * @run driver * nsk.jdwp.EventRequest.ClearAllBreakpoints.clrallbreakp002 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/EventRequest/ClearAllBreakpoints/clrallbreakp003.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/EventRequest/ClearAllBreakpoints/clrallbreakp003.java index 34a69758774b..ce7c1f6609f9 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/EventRequest/ClearAllBreakpoints/clrallbreakp003.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/EventRequest/ClearAllBreakpoints/clrallbreakp003.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -88,8 +88,11 @@ public class clrallbreakp003 { /** * Start test from command line. */ - public static void main(String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + public static void main (String argv[]) { + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/EventRequest/ClearAllBreakpoints/clrallbreakp003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/EventRequest/ClearAllBreakpoints/clrallbreakp003/TestDescription.java index 15acb91350c3..61c2355c1cb7 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/EventRequest/ClearAllBreakpoints/clrallbreakp003/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/EventRequest/ClearAllBreakpoints/clrallbreakp003/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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,7 +53,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.EventRequest.ClearAllBreakpoints.clrallbreakp003a - * @run main/othervm + * @run driver * nsk.jdwp.EventRequest.ClearAllBreakpoints.clrallbreakp003 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/EventRequest/Set/set001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/EventRequest/Set/set001.java index 522c6096cdfb..55b5d12ee13a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/EventRequest/Set/set001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/EventRequest/Set/set001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -90,8 +90,11 @@ public class set001 { /** * Start test from command line. */ - public static void main(String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + public static void main (String argv[]) { + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/EventRequest/Set/set001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/EventRequest/Set/set001/TestDescription.java index d04dc2f9328d..d982e35850d6 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/EventRequest/Set/set001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/EventRequest/Set/set001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -59,7 +59,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.EventRequest.Set.set001a - * @run main/othervm + * @run driver * nsk.jdwp.EventRequest.Set.set001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/EventRequest/Set/set002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/EventRequest/Set/set002.java index ae25ddc2fe26..86256e706fc8 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/EventRequest/Set/set002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/EventRequest/Set/set002.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -77,8 +77,11 @@ public class set002 { /** * Start test from command line. */ - public static void main(String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + public static void main (String argv[]) { + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/EventRequest/Set/set002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/EventRequest/Set/set002/TestDescription.java index efd3b6669242..38df090783b5 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/EventRequest/Set/set002/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/EventRequest/Set/set002/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,7 +61,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.EventRequest.Set.set002a - * @run main/othervm + * @run driver * nsk.jdwp.EventRequest.Set.set002 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Method/Bytecodes/bytecodes001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Method/Bytecodes/bytecodes001.java index 29a06be58fc4..7a5972860344 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Method/Bytecodes/bytecodes001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Method/Bytecodes/bytecodes001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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,7 +93,10 @@ public class bytecodes001 { * Start test from command line. */ public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Method/Bytecodes/bytecodes001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Method/Bytecodes/bytecodes001/TestDescription.java index b522bbedaa4b..46efecf437e0 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Method/Bytecodes/bytecodes001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Method/Bytecodes/bytecodes001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -54,7 +54,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.Method.Bytecodes.bytecodes001a - * @run main/othervm + * @run driver * nsk.jdwp.Method.Bytecodes.bytecodes001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Method/IsObsolete/isobsolete001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Method/IsObsolete/isobsolete001.java index c9e558363a28..b01e814af1e0 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Method/IsObsolete/isobsolete001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Method/IsObsolete/isobsolete001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -89,7 +89,10 @@ public class isobsolete001 { * Start test from command line. */ public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Method/IsObsolete/isobsolete001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Method/IsObsolete/isobsolete001/TestDescription.java index c3b3b3c049d1..270f5744bac0 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Method/IsObsolete/isobsolete001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Method/IsObsolete/isobsolete001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -57,7 +57,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.Method.IsObsolete.isobsolete001a - * @run main/othervm + * @run driver * nsk.jdwp.Method.IsObsolete.isobsolete001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Method/IsObsolete/isobsolete002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Method/IsObsolete/isobsolete002.java index c3266489f928..c06e62be3164 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Method/IsObsolete/isobsolete002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Method/IsObsolete/isobsolete002.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -96,7 +96,10 @@ public class isobsolete002 { * Start test from command line. */ public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Method/IsObsolete/isobsolete002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Method/IsObsolete/isobsolete002/TestDescription.java index ce9fc223daef..e5b41793291c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Method/IsObsolete/isobsolete002/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Method/IsObsolete/isobsolete002/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -72,7 +72,7 @@ * nsk.jdwp.Method.IsObsolete.isobsolete002b * @run driver nsk.share.ExtraClassesBuilder * newclass - * @run main/othervm + * @run driver * nsk.jdwp.Method.IsObsolete.isobsolete002 * . * -arch=${os.family}-${os.simpleArch} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Method/LineTable/linetable001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Method/LineTable/linetable001.java index ebb306389385..cf1bd6eb79a6 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Method/LineTable/linetable001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Method/LineTable/linetable001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -89,7 +89,10 @@ public class linetable001 { * Start test from command line. */ public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Method/LineTable/linetable001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Method/LineTable/linetable001/TestDescription.java index d5dad5cc9792..7a53a1b3816e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Method/LineTable/linetable001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Method/LineTable/linetable001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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,7 +68,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.Method.LineTable.linetable001a - * @run main/othervm + * @run driver * nsk.jdwp.Method.LineTable.linetable001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Method/VariableTable/vartable001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Method/VariableTable/vartable001.java index 9953dc9c94f5..d6a2dcee264b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Method/VariableTable/vartable001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Method/VariableTable/vartable001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -119,7 +119,10 @@ public class vartable001 { * Start test from command line. */ public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Method/VariableTable/vartable001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Method/VariableTable/vartable001/TestDescription.java index f5633b360f33..f08b09e5079f 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Method/VariableTable/vartable001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Method/VariableTable/vartable001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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,7 +60,7 @@ * @comment debuggee should be compiled w/ debug info * @clean nsk.jdwp.Method.VariableTable.vartable001a * @compile -g:lines,source,vars ../vartable001a.java - * @run main/othervm + * @run driver * nsk.jdwp.Method.VariableTable.vartable001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Method/VariableTableWithGeneric/vartblwithgen001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Method/VariableTableWithGeneric/vartblwithgen001.java index a2e18c4f7599..39890990b8dc 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Method/VariableTableWithGeneric/vartblwithgen001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Method/VariableTableWithGeneric/vartblwithgen001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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 @@ -136,7 +136,10 @@ public class vartblwithgen001 { * Start test from command line. */ public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Method/VariableTableWithGeneric/vartblwithgen001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Method/VariableTableWithGeneric/vartblwithgen001/TestDescription.java index 7741b0226187..0227cae87ea7 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Method/VariableTableWithGeneric/vartblwithgen001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/Method/VariableTableWithGeneric/vartblwithgen001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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,7 +60,7 @@ * @comment debuggee should be compiled w/ debug info * @clean nsk.jdwp.Method.VariableTableWithGeneric.vartblwithgen001a * @compile -g:lines,source,vars ../vartblwithgen001a.java - * @run main/othervm + * @run driver * nsk.jdwp.Method.VariableTableWithGeneric.vartblwithgen001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/DisableCollection/disablecol001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/DisableCollection/disablecol001.java index 419d944398af..6f11394db53e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/DisableCollection/disablecol001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/DisableCollection/disablecol001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -86,7 +86,10 @@ public class disablecol001 { * Start test from command line. */ public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/DisableCollection/disablecol001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/DisableCollection/disablecol001/TestDescription.java index 9e50200593e7..fdcc258523e6 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/DisableCollection/disablecol001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/DisableCollection/disablecol001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -54,7 +54,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.ObjectReference.DisableCollection.disablecol001a - * @run main/othervm + * @run driver * nsk.jdwp.ObjectReference.DisableCollection.disablecol001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/EnableCollection/enablecol001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/EnableCollection/enablecol001.java index 2ab8c28e1c4c..9172b4413d70 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/EnableCollection/enablecol001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/EnableCollection/enablecol001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -86,7 +86,10 @@ public class enablecol001 { * Start test from command line. */ public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/EnableCollection/enablecol001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/EnableCollection/enablecol001/TestDescription.java index d2dd41472e9f..71a849b0c2a5 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/EnableCollection/enablecol001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/EnableCollection/enablecol001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -55,7 +55,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.ObjectReference.EnableCollection.enablecol001a - * @run main/othervm + * @run driver * nsk.jdwp.ObjectReference.EnableCollection.enablecol001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/GetValues/getvalues001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/GetValues/getvalues001.java index 08668e91afab..9702cb7f9e62 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/GetValues/getvalues001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/GetValues/getvalues001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -99,7 +99,10 @@ public class getvalues001 { * Start test from command line. */ public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/GetValues/getvalues001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/GetValues/getvalues001/TestDescription.java index 7ecb552e6c9d..8bfbca6d4489 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/GetValues/getvalues001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/GetValues/getvalues001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -58,7 +58,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.ObjectReference.GetValues.getvalues001a - * @run main/othervm + * @run driver * nsk.jdwp.ObjectReference.GetValues.getvalues001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/InvokeMethod/invokemeth001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/InvokeMethod/invokemeth001.java index 761a5bf19a48..ffc2cc151a99 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/InvokeMethod/invokemeth001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/InvokeMethod/invokemeth001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -99,7 +99,10 @@ public class invokemeth001 { * Start test from command line. */ public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/InvokeMethod/invokemeth001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/InvokeMethod/invokemeth001/TestDescription.java index 71bfafa7718f..3ad6bbf79db1 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/InvokeMethod/invokemeth001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/InvokeMethod/invokemeth001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,7 +61,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.ObjectReference.InvokeMethod.invokemeth001a - * @run main/othervm + * @run driver * nsk.jdwp.ObjectReference.InvokeMethod.invokemeth001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/IsCollected/iscollected001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/IsCollected/iscollected001.java index 284765bd25af..a8d61451f9a9 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/IsCollected/iscollected001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/IsCollected/iscollected001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -86,7 +86,10 @@ public class iscollected001 { * Start test from command line. */ public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/IsCollected/iscollected001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/IsCollected/iscollected001/TestDescription.java index fda668d8b320..f6facbb76092 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/IsCollected/iscollected001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/IsCollected/iscollected001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -57,7 +57,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.ObjectReference.IsCollected.iscollected001a - * @run main/othervm + * @run driver * nsk.jdwp.ObjectReference.IsCollected.iscollected001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/MonitorInfo/monitorinfo001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/MonitorInfo/monitorinfo001.java index 8834b30e21b5..e50dc29b151b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/MonitorInfo/monitorinfo001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/MonitorInfo/monitorinfo001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -101,7 +101,10 @@ public class monitorinfo001 { * Start test from command line. */ public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/MonitorInfo/monitorinfo001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/MonitorInfo/monitorinfo001/TestDescription.java index cf58779b87dd..40be209f16f5 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/MonitorInfo/monitorinfo001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/MonitorInfo/monitorinfo001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.ObjectReference.MonitorInfo.monitorinfo001a - * @run main/othervm + * @run driver * nsk.jdwp.ObjectReference.MonitorInfo.monitorinfo001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/ReferenceType/referencetype001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/ReferenceType/referencetype001.java index cc5530cf82a6..4066c9057689 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/ReferenceType/referencetype001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/ReferenceType/referencetype001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -86,7 +86,10 @@ public class referencetype001 { * Start test from command line. */ public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/ReferenceType/referencetype001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/ReferenceType/referencetype001/TestDescription.java index 0e7e8b9bb6b2..e5b1413f1479 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/ReferenceType/referencetype001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/ReferenceType/referencetype001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -59,7 +59,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.ObjectReference.ReferenceType.referencetype001a - * @run main/othervm + * @run driver * nsk.jdwp.ObjectReference.ReferenceType.referencetype001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/ReferringObjects/referringObjects001/referringObjects001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/ReferringObjects/referringObjects001/referringObjects001.java index c9ee73fa67c9..f578d3be7d43 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/ReferringObjects/referringObjects001/referringObjects001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/ReferringObjects/referringObjects001/referringObjects001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, 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,11 @@ protected String getDebugeeClassName() { return nsk.jdwp.ObjectReference.ReferringObjects.referringObjects001.referringObjects001a.class.getName(); } - public static void main(String[] argv) { - System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + public static void main (String argv[]) { + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } public static int run(String[] argv, PrintStream out) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/ReferringObjects/referringObjects002/referringObjects002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/ReferringObjects/referringObjects002/referringObjects002.java index 4ad6b6ae3288..4591bf093eaa 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/ReferringObjects/referringObjects002/referringObjects002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/ReferringObjects/referringObjects002/referringObjects002.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, 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 @@ -83,8 +83,11 @@ protected String getDebugeeClassName() { return nsk.jdwp.ObjectReference.ReferringObjects.referringObjects002.referringObjects002a.class.getName(); } - public static void main(String[] argv) { - System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + public static void main (String argv[]) { + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } public static int run(String[] argv, PrintStream out) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/SetValues/setvalues001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/SetValues/setvalues001.java index 3d20db7fa7eb..d9a7622ea042 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/SetValues/setvalues001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/SetValues/setvalues001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -95,7 +95,10 @@ public class setvalues001 { * Start test from command line. */ public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/SetValues/setvalues001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/SetValues/setvalues001/TestDescription.java index e3c08d68b022..e35ea5632625 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/SetValues/setvalues001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ObjectReference/SetValues/setvalues001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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,7 +68,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.ObjectReference.SetValues.setvalues001a - * @run main/othervm + * @run driver * nsk.jdwp.ObjectReference.SetValues.setvalues001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/ClassLoader/classloader001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/ClassLoader/classloader001.java index 23b1c3de7eec..0d7961924f9c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/ClassLoader/classloader001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/ClassLoader/classloader001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -45,7 +45,10 @@ public class classloader001 { static final String TESTED_CLASS_SIGNATURE = "L" + TESTED_CLASS_NAME.replace('.', '/') + ";"; public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } public static int run(String argv[], PrintStream out) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/ClassLoader/classloader001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/ClassLoader/classloader001/TestDescription.java index be36b5eccee5..6b818c0a408e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/ClassLoader/classloader001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/ClassLoader/classloader001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -54,7 +54,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.ReferenceType.ClassLoader.classloader001a - * @run main/othervm + * @run driver * nsk.jdwp.ReferenceType.ClassLoader.classloader001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/ClassObject/classobj001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/ClassObject/classobj001.java index b86d17d752fa..5d74b011111d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/ClassObject/classobj001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/ClassObject/classobj001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -45,7 +45,10 @@ public class classobj001 { static final String TESTED_CLASS_SIGNATURE = "L" + TESTED_CLASS_NAME.replace('.', '/') + ";"; public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } public static int run(String argv[], PrintStream out) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/ClassObject/classobj001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/ClassObject/classobj001/TestDescription.java index 12baa51bca2c..ffa15c1a66d8 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/ClassObject/classobj001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/ClassObject/classobj001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -54,7 +54,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.ReferenceType.ClassObject.classobj001a - * @run main/othervm + * @run driver * nsk.jdwp.ReferenceType.ClassObject.classobj001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/Fields/fields001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/Fields/fields001.java index b6f559a5ae03..a4cfd9d9eba3 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/Fields/fields001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/Fields/fields001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,7 +61,10 @@ public class fields001 { static final int FIELD_MODIFIER_FLAGS = JDWP.ModifierFlag.PUBLIC; public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } public static int run(String argv[], PrintStream out) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/Fields/fields001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/Fields/fields001/TestDescription.java index a337e6b7fb5a..7d6b41cc7501 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/Fields/fields001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/Fields/fields001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -56,7 +56,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.ReferenceType.Fields.fields001a - * @run main/othervm + * @run driver * nsk.jdwp.ReferenceType.Fields.fields001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/FieldsWithGeneric/fldwithgeneric001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/FieldsWithGeneric/fldwithgeneric001.java index 24ac7321b9fd..5feafc3c2b3c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/FieldsWithGeneric/fldwithgeneric001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/FieldsWithGeneric/fldwithgeneric001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -101,8 +101,11 @@ public class fldwithgeneric001 { static final int FLDS_NUM = fields.length; - public static void main(String argv[]) { - System.exit(run(argv,System.out) + Consts.JCK_STATUS_BASE); + public static void main (String argv[]) { + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } public static int run(String argv[], PrintStream out) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/FieldsWithGeneric/fldwithgeneric001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/FieldsWithGeneric/fldwithgeneric001/TestDescription.java index c410dabad089..7e9679e10eb4 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/FieldsWithGeneric/fldwithgeneric001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/FieldsWithGeneric/fldwithgeneric001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -45,7 +45,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.ReferenceType.FieldsWithGeneric.fldwithgeneric001t - * @run main/othervm + * @run driver * nsk.jdwp.ReferenceType.FieldsWithGeneric.fldwithgeneric001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/GetValues/getvalues001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/GetValues/getvalues001.java index cafe1ba1d1ae..72c0c679bb80 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/GetValues/getvalues001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/GetValues/getvalues001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -99,7 +99,10 @@ public class getvalues001 { * Start test from command line. */ public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/GetValues/getvalues001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/GetValues/getvalues001/TestDescription.java index 6a0ceb754d8c..e4c850e28a4e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/GetValues/getvalues001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/GetValues/getvalues001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -57,7 +57,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.ReferenceType.GetValues.getvalues001a - * @run main/othervm + * @run driver * nsk.jdwp.ReferenceType.GetValues.getvalues001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/Instances/instances001/instances001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/Instances/instances001/instances001.java index 2312f571822d..5a83ed4435b9 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/Instances/instances001/instances001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/Instances/instances001/instances001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, 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 @@ -89,8 +89,11 @@ protected String getDebugeeClassName() { return nsk.jdwp.ReferenceType.Instances.instances001.instances001a.class.getName(); } - public static void main(String[] argv) { - System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + public static void main (String argv[]) { + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } public static int run(String[] argv, PrintStream out) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/Instances/instances002/instances002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/Instances/instances002/instances002.java index cd90392f3d93..378104a1b746 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/Instances/instances002/instances002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/Instances/instances002/instances002.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, 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 @@ -57,7 +57,7 @@ * * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib - * @run main/othervm + * @run driver * nsk.jdwp.ReferenceType.Instances.instances002.instances002 * -arch=${os.family}-${os.simpleArch} * -verbose @@ -82,8 +82,11 @@ protected String getDebugeeClassName() { return nsk.jdwp.ReferenceType.Instances.instances002.instances002a.class.getName(); } - public static void main(String[] argv) { - System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + public static void main (String argv[]) { + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } public static int run(String[] argv, PrintStream out) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/Interfaces/interfaces001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/Interfaces/interfaces001.java index e7e06473d7b1..d30d63b272bf 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/Interfaces/interfaces001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/Interfaces/interfaces001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -52,7 +52,10 @@ public class interfaces001 { static final long interfaceIDs[] = new long[DECLARED_INTERFACES]; public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } public static int run(String argv[], PrintStream out) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/Interfaces/interfaces001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/Interfaces/interfaces001/TestDescription.java index b67ad06b1c33..bfa503d42b3e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/Interfaces/interfaces001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/Interfaces/interfaces001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -58,7 +58,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.ReferenceType.Interfaces.interfaces001a - * @run main/othervm + * @run driver * nsk.jdwp.ReferenceType.Interfaces.interfaces001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/Methods/methods001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/Methods/methods001.java index 22e656e1f414..247ed13f6686 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/Methods/methods001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/Methods/methods001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -63,7 +63,10 @@ public class methods001 { static final int METHOD_MODIFIER_FLAGS = JDWP.ModifierFlag.PUBLIC; public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } public static int run(String argv[], PrintStream out) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/Methods/methods001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/Methods/methods001/TestDescription.java index f24bcd39b845..28a7ad43a60e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/Methods/methods001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/Methods/methods001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -56,7 +56,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.ReferenceType.Methods.methods001a - * @run main/othervm + * @run driver * nsk.jdwp.ReferenceType.Methods.methods001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/MethodsWithGeneric/methwithgeneric001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/MethodsWithGeneric/methwithgeneric001.java index e2e633222b3f..d15360356252 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/MethodsWithGeneric/methwithgeneric001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/MethodsWithGeneric/methwithgeneric001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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 @@ -110,8 +110,11 @@ public class methwithgeneric001 { static final int CLS_NUM = classes.length; - public static void main(String argv[]) { - System.exit(run(argv,System.out) + Consts.JCK_STATUS_BASE); + public static void main (String argv[]) { + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } public static int run(String argv[], PrintStream out) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/MethodsWithGeneric/methwithgeneric001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/MethodsWithGeneric/methwithgeneric001/TestDescription.java index 648349f887e5..475b7eedb059 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/MethodsWithGeneric/methwithgeneric001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/MethodsWithGeneric/methwithgeneric001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -45,7 +45,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.ReferenceType.MethodsWithGeneric.methwithgeneric001t - * @run main/othervm + * @run driver * nsk.jdwp.ReferenceType.MethodsWithGeneric.methwithgeneric001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/Modifiers/modifiers001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/Modifiers/modifiers001.java index 92e4f6f6b7cb..7695861df3a2 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/Modifiers/modifiers001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/Modifiers/modifiers001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -48,7 +48,10 @@ public class modifiers001 { | JDWP.ModifierFlag.FINAL; public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } public static int run(String argv[], PrintStream out) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/Modifiers/modifiers001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/Modifiers/modifiers001/TestDescription.java index fa26934f1497..907993049a4c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/Modifiers/modifiers001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/Modifiers/modifiers001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -56,7 +56,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.ReferenceType.Modifiers.modifiers001a - * @run main/othervm + * @run driver * nsk.jdwp.ReferenceType.Modifiers.modifiers001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/NestedTypes/nestedtypes001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/NestedTypes/nestedtypes001.java index 33e4727bfe8a..6b4e82dd6b60 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/NestedTypes/nestedtypes001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/NestedTypes/nestedtypes001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -92,7 +92,10 @@ public class nestedtypes001 { * Start test from command line. */ public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/NestedTypes/nestedtypes001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/NestedTypes/nestedtypes001/TestDescription.java index 4436bcccbb60..5da686e4a434 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/NestedTypes/nestedtypes001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/NestedTypes/nestedtypes001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -61,7 +61,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.ReferenceType.NestedTypes.nestedtypes001a - * @run main/othervm + * @run driver * nsk.jdwp.ReferenceType.NestedTypes.nestedtypes001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/Signature/signature001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/Signature/signature001.java index 641079ba7fa3..ddba04e292ab 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/Signature/signature001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/Signature/signature001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -45,7 +45,10 @@ public class signature001 { static final String TESTED_CLASS_SIGNATURE = "L" + TESTED_CLASS_NAME.replace('.', '/') + ";"; public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } public static int run(String argv[], PrintStream out) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/Signature/signature001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/Signature/signature001/TestDescription.java index 27628d13e610..49ac330b5187 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/Signature/signature001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/Signature/signature001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -52,7 +52,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.ReferenceType.Signature.signature001a - * @run main/othervm + * @run driver * nsk.jdwp.ReferenceType.Signature.signature001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/SignatureWithGeneric/sigwithgeneric001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/SignatureWithGeneric/sigwithgeneric001.java index c6bbcd437f8a..8f819a050b9d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/SignatureWithGeneric/sigwithgeneric001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/SignatureWithGeneric/sigwithgeneric001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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 @@ -81,8 +81,11 @@ public class sigwithgeneric001 { static final int CLS_NUM = classes.length; - public static void main(String argv[]) { - System.exit(run(argv,System.out) + Consts.JCK_STATUS_BASE); + public static void main (String argv[]) { + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } public static int run(String argv[], PrintStream out) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/SignatureWithGeneric/sigwithgeneric001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/SignatureWithGeneric/sigwithgeneric001/TestDescription.java index 9dc7275de7d1..9928a55505ea 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/SignatureWithGeneric/sigwithgeneric001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/SignatureWithGeneric/sigwithgeneric001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -44,7 +44,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.ReferenceType.SignatureWithGeneric.sigwithgeneric001t - * @run main/othervm + * @run driver * nsk.jdwp.ReferenceType.SignatureWithGeneric.sigwithgeneric001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/SourceDebugExtension/srcdebugext001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/SourceDebugExtension/srcdebugext001.java index af9d7a26021a..0735246d2395 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/SourceDebugExtension/srcdebugext001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/SourceDebugExtension/srcdebugext001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -56,7 +56,10 @@ public class srcdebugext001 { private Transport transport; public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } public static int run(String argv[], PrintStream out) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/SourceDebugExtension/srcdebugext001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/SourceDebugExtension/srcdebugext001/TestDescription.java index c614604e55d7..f3fbe8830c43 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/SourceDebugExtension/srcdebugext001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/SourceDebugExtension/srcdebugext001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -39,7 +39,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.ReferenceType.SourceDebugExtension.srcdebugext001t - * @run main/othervm + * @run driver * nsk.jdwp.ReferenceType.SourceDebugExtension.srcdebugext001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/SourceFile/srcfile001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/SourceFile/srcfile001.java index fb9d8948ef5d..6ca69c009b22 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/SourceFile/srcfile001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/SourceFile/srcfile001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -46,7 +46,10 @@ public class srcfile001 { static final String TESTED_CLASS_SRCFILENAME = "srcfile001a.java"; public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } public static int run(String argv[], PrintStream out) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/SourceFile/srcfile001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/SourceFile/srcfile001/TestDescription.java index 09608b3757d7..ff56e5c99ccd 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/SourceFile/srcfile001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/SourceFile/srcfile001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -52,7 +52,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.ReferenceType.SourceFile.srcfile001a - * @run main/othervm + * @run driver * nsk.jdwp.ReferenceType.SourceFile.srcfile001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/Status/status001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/Status/status001.java index f0e357b48403..2aa64d3ed4b4 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/Status/status001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/Status/status001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -48,7 +48,10 @@ public class status001 { | JDWP.ClassStatus.INITIALIZED; public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } public static int run(String argv[], PrintStream out) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/Status/status001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/Status/status001/TestDescription.java index aefbb989bf98..5efd81a38962 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/Status/status001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ReferenceType/Status/status001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -54,7 +54,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.ReferenceType.Status.status001a - * @run main/othervm + * @run driver * nsk.jdwp.ReferenceType.Status.status001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/StackFrame/GetValues/getvalues001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/StackFrame/GetValues/getvalues001.java index 656ba90a2503..b9f7a1f0ef32 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/StackFrame/GetValues/getvalues001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/StackFrame/GetValues/getvalues001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -102,7 +102,10 @@ public class getvalues001 { * Start test from command line. */ public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/StackFrame/GetValues/getvalues001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/StackFrame/GetValues/getvalues001/TestDescription.java index 09ee0ba021a9..5d862a12ec3c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/StackFrame/GetValues/getvalues001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/StackFrame/GetValues/getvalues001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -64,7 +64,7 @@ * @comment debuggee should be compiled w/ debug info * @clean nsk.jdwp.StackFrame.GetValues.getvalues001a * @compile -g:lines,source,vars ../getvalues001a.java - * @run main/othervm + * @run driver * nsk.jdwp.StackFrame.GetValues.getvalues001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/StackFrame/PopFrames/popframes001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/StackFrame/PopFrames/popframes001.java index a896d567eb52..b4ad931f0443 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/StackFrame/PopFrames/popframes001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/StackFrame/PopFrames/popframes001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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,7 +93,10 @@ public class popframes001 { * Start test from command line. */ public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/StackFrame/PopFrames/popframes001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/StackFrame/PopFrames/popframes001/TestDescription.java index 2fd126b9fbb2..902cdda31dce 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/StackFrame/PopFrames/popframes001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/StackFrame/PopFrames/popframes001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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,7 +60,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.StackFrame.PopFrames.popframes001a - * @run main/othervm + * @run driver * nsk.jdwp.StackFrame.PopFrames.popframes001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/StackFrame/SetValues/setvalues001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/StackFrame/SetValues/setvalues001.java index 58b9c26fae36..7e7d44ff9682 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/StackFrame/SetValues/setvalues001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/StackFrame/SetValues/setvalues001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -109,7 +109,10 @@ public class setvalues001 { * Start test from command line. */ public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/StackFrame/SetValues/setvalues001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/StackFrame/SetValues/setvalues001/TestDescription.java index 96302cd95925..fec909b40923 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/StackFrame/SetValues/setvalues001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/StackFrame/SetValues/setvalues001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -75,7 +75,7 @@ * @comment debuggee should be compiled w/ debug info * @clean nsk.jdwp.StackFrame.SetValues.setvalues001a * @compile -g:lines,source,vars ../setvalues001a.java - * @run main/othervm + * @run driver * nsk.jdwp.StackFrame.SetValues.setvalues001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/StackFrame/ThisObject/thisobject001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/StackFrame/ThisObject/thisobject001.java index 90ab9f6e06bf..d8302f07c7d8 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/StackFrame/ThisObject/thisobject001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/StackFrame/ThisObject/thisobject001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -87,7 +87,10 @@ public class thisobject001 { * Start test from command line. */ public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/StackFrame/ThisObject/thisobject001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/StackFrame/ThisObject/thisobject001/TestDescription.java index 9216e598b04c..7d00be7f3071 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/StackFrame/ThisObject/thisobject001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/StackFrame/ThisObject/thisobject001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -59,7 +59,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.StackFrame.ThisObject.thisobject001a - * @run main/othervm + * @run driver * nsk.jdwp.StackFrame.ThisObject.thisobject001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/StringReference/Value/value001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/StringReference/Value/value001.java index 6a218281473a..b07413fae93b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/StringReference/Value/value001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/StringReference/Value/value001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -42,7 +42,10 @@ public class value001 { static final int JDWP_COMMAND_ID = JDWP.Command.StringReference.Value; public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } public static int run(String argv[], PrintStream out) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/StringReference/Value/value001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/StringReference/Value/value001/TestDescription.java index ff107802db07..7380eed448de 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/StringReference/Value/value001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/StringReference/Value/value001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -52,7 +52,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.StringReference.Value.value001a - * @run main/othervm + * @run driver * nsk.jdwp.StringReference.Value.value001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadGroupReference/Children/children001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadGroupReference/Children/children001.java index 5bcf5132863c..24e5d1a48d6a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadGroupReference/Children/children001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadGroupReference/Children/children001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -42,7 +42,10 @@ public class children001 { static final int JDWP_COMMAND_ID = JDWP.Command.ThreadGroupReference.Children; public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } public static int run(String argv[], PrintStream out) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadGroupReference/Children/children001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadGroupReference/Children/children001/TestDescription.java index 679af7f78c7a..b77233495fd1 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadGroupReference/Children/children001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadGroupReference/Children/children001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -49,7 +49,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.ThreadGroupReference.Children.children001a - * @run main/othervm + * @run driver * nsk.jdwp.ThreadGroupReference.Children.children001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadGroupReference/Name/name001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadGroupReference/Name/name001.java index abb7ed4a59e9..c33780bfba0e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadGroupReference/Name/name001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadGroupReference/Name/name001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -42,7 +42,10 @@ public class name001 { static final int JDWP_COMMAND_ID = JDWP.Command.ThreadGroupReference.Name; public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } public static int run(String argv[], PrintStream out) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadGroupReference/Name/name001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadGroupReference/Name/name001/TestDescription.java index 14218e86942b..00304ac2b1df 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadGroupReference/Name/name001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadGroupReference/Name/name001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -49,7 +49,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.ThreadGroupReference.Name.name001a - * @run main/othervm + * @run driver * nsk.jdwp.ThreadGroupReference.Name.name001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadGroupReference/Parent/parent001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadGroupReference/Parent/parent001.java index bdcdbc1dd2db..8ebb47b1aea9 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadGroupReference/Parent/parent001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadGroupReference/Parent/parent001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -42,7 +42,10 @@ public class parent001 { static final int JDWP_COMMAND_ID = JDWP.Command.ThreadGroupReference.Parent; public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } public static int run(String argv[], PrintStream out) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadGroupReference/Parent/parent001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadGroupReference/Parent/parent001/TestDescription.java index 4a2ff8684acb..48aeb6e47d28 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadGroupReference/Parent/parent001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadGroupReference/Parent/parent001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -52,7 +52,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.ThreadGroupReference.Parent.parent001a - * @run main/othervm + * @run driver * nsk.jdwp.ThreadGroupReference.Parent.parent001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/CurrentContendedMonitor/curcontmonitor001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/CurrentContendedMonitor/curcontmonitor001.java index 3b8219e63b76..9d74ebcc0819 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/CurrentContendedMonitor/curcontmonitor001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/CurrentContendedMonitor/curcontmonitor001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -92,7 +92,10 @@ public class curcontmonitor001 { * Start test from command line. */ public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/CurrentContendedMonitor/curcontmonitor001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/CurrentContendedMonitor/curcontmonitor001/TestDescription.java index c1310a9c3fbf..fb64f7b22e61 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/CurrentContendedMonitor/curcontmonitor001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/CurrentContendedMonitor/curcontmonitor001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -62,7 +62,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.ThreadReference.CurrentContendedMonitor.curcontmonitor001a - * @run main/othervm + * @run driver * nsk.jdwp.ThreadReference.CurrentContendedMonitor.curcontmonitor001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/ForceEarlyReturn/forceEarlyReturn001/forceEarlyReturn001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/ForceEarlyReturn/forceEarlyReturn001/forceEarlyReturn001.java index 8453e54e2c10..e7dce1525a04 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/ForceEarlyReturn/forceEarlyReturn001/forceEarlyReturn001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/ForceEarlyReturn/forceEarlyReturn001/forceEarlyReturn001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, 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 @@ -74,7 +74,7 @@ * * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib - * @run main/othervm + * @run driver * nsk.jdwp.ThreadReference.ForceEarlyReturn.forceEarlyReturn001.forceEarlyReturn001 * -arch=${os.family}-${os.simpleArch} * -verbose @@ -123,8 +123,11 @@ protected String getDebugeeClassName() { return "nsk.jdwp.ThreadReference.ForceEarlyReturn.forceEarlyReturn001.forceEarlyReturn001a"; } - public static void main(String[] argv) { - System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + public static void main (String argv[]) { + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } public static int run(String[] argv, PrintStream out) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/ForceEarlyReturn/forceEarlyReturn002/forceEarlyReturn002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/ForceEarlyReturn/forceEarlyReturn002/forceEarlyReturn002.java index 3d1fb85f0758..2cb8de8cfa7e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/ForceEarlyReturn/forceEarlyReturn002/forceEarlyReturn002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/ForceEarlyReturn/forceEarlyReturn002/forceEarlyReturn002.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, 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 @@ -55,7 +55,7 @@ * When test thread has finish execution debugger suspends thread and call command for this thread, INVALID_THREAD * error is expected, then, debugger resumes test thread and call command again, INVALID_THREAD error should * be returned in reply. - * - debuggee starts test thread which executes infinite loop in native method, debugger calls command for + * - debuggee starts test thread which executes loop in native method, debugger calls command for * this thread(without suspending) and expects THREAD_NOT_SUSPENDED error. Then, debugger suspends this thread * and calls command again, OPAQUE_FRAME error is expected. * - debugger creates ThreadStartEventRequest with suspend policy 'JDWP.SuspendPolicy.ALL' and forces debuggee start new thread. @@ -95,8 +95,11 @@ protected String getDebugeeClassName() { return "nsk.jdwp.ThreadReference.ForceEarlyReturn.forceEarlyReturn002.forceEarlyReturn002a"; } - public static void main(String[] argv) { - System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + public static void main (String argv[]) { + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } public static int run(String[] argv, PrintStream out) { @@ -248,6 +251,9 @@ public void doTest() { // suspended thread in native, expect OPAQUE_FRAME error sendCommand(threadID, value, true, JDWP.Error.OPAQUE_FRAME); + // signal native method to exit; the thread will be actually suspended + pipe.println(forceEarlyReturn002a.COMMAND_EXIT_THREAD_IN_NATIVE); + // create request for ThreadStart event int requestID = createThreadStartEventRequest(); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/ForceEarlyReturn/forceEarlyReturn002/forceEarlyReturn002a.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/ForceEarlyReturn/forceEarlyReturn002/forceEarlyReturn002a.java index f5a740ec2f17..dc09ffdb7c9e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/ForceEarlyReturn/forceEarlyReturn002/forceEarlyReturn002a.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/ForceEarlyReturn/forceEarlyReturn002/forceEarlyReturn002a.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2023, 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 @@ -40,6 +40,8 @@ public class forceEarlyReturn002a extends AbstractJDWPDebuggee { public final static String COMMAND_STOP_THREAD_IN_NATIVE = "stopInNative"; + public final static String COMMAND_EXIT_THREAD_IN_NATIVE = "exitInNative"; + public final static String COMMAND_START_NEW_THREAD = "startNewThread"; public boolean parseCommand(String command) { @@ -49,6 +51,10 @@ public boolean parseCommand(String command) { if (command.equals(COMMAND_STOP_THREAD_IN_NATIVE)) { stopThreadInNative(); + return true; + } else if (command.equals(COMMAND_EXIT_THREAD_IN_NATIVE)) { + exitThreadInNative(); + return true; } else if (command.equals(COMMAND_START_NEW_THREAD)) { testNewThread.start(); @@ -95,6 +101,8 @@ public void run() { private static native int nativeMethod(Object object); + private static native void exitThreadInNative(); + public static void main(String args[]) { new forceEarlyReturn002a().doTest(args); } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/ForceEarlyReturn/forceEarlyReturn002/libforceEarlyReturn002a.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/ForceEarlyReturn/forceEarlyReturn002/libforceEarlyReturn002a.cpp index 79d46c3095ed..c287de9056b1 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/ForceEarlyReturn/forceEarlyReturn002/libforceEarlyReturn002a.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/ForceEarlyReturn/forceEarlyReturn002/libforceEarlyReturn002a.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2023, 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,23 +23,46 @@ #include "jni.h" +#if defined(_WIN32) +#include +#else +#include +#endif + +#include + extern "C" { +static std::atomic wait_in_native(true); + +static void delay(int seconds) { +#if defined(_WIN32) + Sleep(1000L * seconds); +#else + sleep(seconds); +#endif +} JNIEXPORT jint JNICALL Java_nsk_jdwp_ThreadReference_ForceEarlyReturn_forceEarlyReturn002_forceEarlyReturn002a_nativeMethod(JNIEnv *env, jobject classObject, jobject object) { - static volatile int dummy_counter = 0; // notify another thread that thread in native method jclass klass = env->GetObjectClass(object); jfieldID field = env->GetFieldID(klass, "threadInNative", "Z"); env->SetBooleanField(object, field, 1); // execute infinite loop to be sure that thread in native method - while (dummy_counter == 0) {} + while (wait_in_native) { + delay(1); + } - // Should not reach here return 0; } +JNIEXPORT void JNICALL +Java_nsk_jdwp_ThreadReference_ForceEarlyReturn_forceEarlyReturn002_forceEarlyReturn002a_exitThreadInNative(JNIEnv *env, jobject classObject) +{ + wait_in_native = false; +} + } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/FrameCount/framecnt001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/FrameCount/framecnt001.java index 0a6770fe338e..5bab037024d7 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/FrameCount/framecnt001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/FrameCount/framecnt001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -90,7 +90,10 @@ public class framecnt001 { * Start test from command line. */ public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/FrameCount/framecnt001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/FrameCount/framecnt001/TestDescription.java index 16adec92f82e..77063a5ce2f2 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/FrameCount/framecnt001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/FrameCount/framecnt001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -57,7 +57,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.ThreadReference.FrameCount.framecnt001a - * @run main/othervm + * @run driver * nsk.jdwp.ThreadReference.FrameCount.framecnt001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/Frames/frames001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/Frames/frames001.java index 42ab3aa776e3..0a5028c4a65d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/Frames/frames001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/Frames/frames001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -95,7 +95,10 @@ public class frames001 { * Start test from command line. */ public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/Frames/frames001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/Frames/frames001/TestDescription.java index d742fb39d0eb..b8dad9a09d7e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/Frames/frames001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/Frames/frames001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -62,7 +62,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.ThreadReference.Frames.frames001a - * @run main/othervm + * @run driver * nsk.jdwp.ThreadReference.Frames.frames001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/Interrupt/interrupt001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/Interrupt/interrupt001.java index 722543cf8e10..f0c2914dffca 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/Interrupt/interrupt001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/Interrupt/interrupt001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -90,7 +90,10 @@ public class interrupt001 { * Start test from command line. */ public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/Interrupt/interrupt001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/Interrupt/interrupt001/TestDescription.java index 236ff3140d58..b6284ec0a505 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/Interrupt/interrupt001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/Interrupt/interrupt001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.ThreadReference.Interrupt.interrupt001a - * @run main/othervm + * @run driver * nsk.jdwp.ThreadReference.Interrupt.interrupt001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/Name/name001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/Name/name001.java index 5793eb8dc67f..4633c6f11853 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/Name/name001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/Name/name001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -87,7 +87,10 @@ public class name001 { * Start test from command line. */ public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/Name/name001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/Name/name001/TestDescription.java index afc50298c1c8..ab49aa26e14e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/Name/name001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/Name/name001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -56,7 +56,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.ThreadReference.Name.name001a - * @run main/othervm + * @run driver * nsk.jdwp.ThreadReference.Name.name001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/OwnedMonitors/ownmonitors001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/OwnedMonitors/ownmonitors001.java index 75f1dc408e6b..c9ba5bcc9554 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/OwnedMonitors/ownmonitors001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/OwnedMonitors/ownmonitors001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -98,7 +98,10 @@ public class ownmonitors001 { * Start test from command line. */ public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/OwnedMonitors/ownmonitors001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/OwnedMonitors/ownmonitors001/TestDescription.java index 84c7f627e6d9..a929ce527f58 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/OwnedMonitors/ownmonitors001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/OwnedMonitors/ownmonitors001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -62,7 +62,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.ThreadReference.OwnedMonitors.ownmonitors001a - * @run main/othervm + * @run driver * nsk.jdwp.ThreadReference.OwnedMonitors.ownmonitors001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/OwnedMonitorsStackDepthInfo/ownedMonitorsStackDepthInfo001/ownedMonitorsStackDepthInfo001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/OwnedMonitorsStackDepthInfo/ownedMonitorsStackDepthInfo001/ownedMonitorsStackDepthInfo001.java index f178c88ae147..3b250989a43e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/OwnedMonitorsStackDepthInfo/ownedMonitorsStackDepthInfo001/ownedMonitorsStackDepthInfo001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/OwnedMonitorsStackDepthInfo/ownedMonitorsStackDepthInfo001/ownedMonitorsStackDepthInfo001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, 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 @@ -87,8 +87,11 @@ protected String getDebugeeClassName() { return nsk.jdwp.ThreadReference.OwnedMonitorsStackDepthInfo.ownedMonitorsStackDepthInfo001.ownedMonitorsStackDepthInfo001a.class.getName(); } - public static void main(String[] argv) { - System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + public static void main (String argv[]) { + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } public static int run(String[] argv, PrintStream out) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/OwnedMonitorsStackDepthInfo/ownedMonitorsStackDepthInfo002/ownedMonitorsStackDepthInfo002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/OwnedMonitorsStackDepthInfo/ownedMonitorsStackDepthInfo002/ownedMonitorsStackDepthInfo002.java index cbc5fb63a235..140b249de9cb 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/OwnedMonitorsStackDepthInfo/ownedMonitorsStackDepthInfo002/ownedMonitorsStackDepthInfo002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/OwnedMonitorsStackDepthInfo/ownedMonitorsStackDepthInfo002/ownedMonitorsStackDepthInfo002.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, 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 @@ -50,7 +50,7 @@ * * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib - * @run main/othervm + * @run driver * nsk.jdwp.ThreadReference.OwnedMonitorsStackDepthInfo.ownedMonitorsStackDepthInfo002.ownedMonitorsStackDepthInfo002 * -arch=${os.family}-${os.simpleArch} * -verbose @@ -77,8 +77,11 @@ protected String getDebugeeClassName() { return AbstractJDWPDebuggee.class.getName(); } - public static void main(String[] argv) { - System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + public static void main (String argv[]) { + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } public static int run(String[] argv, PrintStream out) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/Resume/resume001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/Resume/resume001.java index 946974522006..97e270b32ecc 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/Resume/resume001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/Resume/resume001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -87,7 +87,10 @@ public class resume001 { * Start test from command line. */ public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/Resume/resume001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/Resume/resume001/TestDescription.java index e5eb1c510f1a..12af9f769393 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/Resume/resume001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/Resume/resume001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -59,7 +59,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.ThreadReference.Resume.resume001a - * @run main/othervm + * @run driver * nsk.jdwp.ThreadReference.Resume.resume001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/Status/status001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/Status/status001.java index b7c708570f56..f41e3e919a52 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/Status/status001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/Status/status001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -87,7 +87,10 @@ public class status001 { * Start test from command line. */ public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/Status/status001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/Status/status001/TestDescription.java index 14ff02471437..5ae025526ac8 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/Status/status001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/Status/status001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -56,7 +56,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.ThreadReference.Status.status001a - * @run main/othervm + * @run driver * nsk.jdwp.ThreadReference.Status.status001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/Stop/stop001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/Stop/stop001.java index f89d64ae747a..416b3254e0ec 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/Stop/stop001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/Stop/stop001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -91,7 +91,10 @@ public class stop001 { * Start test from command line. */ public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/Stop/stop001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/Stop/stop001/TestDescription.java index 9229392142b7..a9bcab6ef3e2 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/Stop/stop001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/Stop/stop001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -59,7 +59,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.ThreadReference.Stop.stop001a - * @run main/othervm + * @run driver * nsk.jdwp.ThreadReference.Stop.stop001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/Suspend/suspend001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/Suspend/suspend001.java index 9f6ed3db961b..0418fe080d6a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/Suspend/suspend001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/Suspend/suspend001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -87,7 +87,10 @@ public class suspend001 { * Start test from command line. */ public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/Suspend/suspend001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/Suspend/suspend001/TestDescription.java index d1477e477493..1c4bcf62e522 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/Suspend/suspend001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/Suspend/suspend001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -58,7 +58,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.ThreadReference.Suspend.suspend001a - * @run main/othervm + * @run driver * nsk.jdwp.ThreadReference.Suspend.suspend001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/SuspendCount/suspendcnt001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/SuspendCount/suspendcnt001.java index cbfe330774e6..cbdff74e9ccc 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/SuspendCount/suspendcnt001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/SuspendCount/suspendcnt001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -90,7 +90,10 @@ public class suspendcnt001 { * Start test from command line. */ public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/SuspendCount/suspendcnt001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/SuspendCount/suspendcnt001/TestDescription.java index 39e5469173a3..188b5c01ec17 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/SuspendCount/suspendcnt001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/SuspendCount/suspendcnt001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -58,7 +58,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.ThreadReference.SuspendCount.suspendcnt001a - * @run main/othervm + * @run driver * nsk.jdwp.ThreadReference.SuspendCount.suspendcnt001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/ThreadGroup/threadgroup001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/ThreadGroup/threadgroup001.java index c58491cb3d4d..eb66314ebdaa 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/ThreadGroup/threadgroup001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/ThreadGroup/threadgroup001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -42,7 +42,10 @@ public class threadgroup001 { static final int JDWP_COMMAND_ID = JDWP.Command.ThreadReference.ThreadGroup; public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } public static int run(String argv[], PrintStream out) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/ThreadGroup/threadgroup001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/ThreadGroup/threadgroup001/TestDescription.java index f9b503a82fe1..0aa449e92390 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/ThreadGroup/threadgroup001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/ThreadReference/ThreadGroup/threadgroup001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -58,7 +58,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.ThreadReference.ThreadGroup.threadgroup001a - * @run main/othervm + * @run driver * nsk.jdwp.ThreadReference.ThreadGroup.threadgroup001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/AllClasses/allclasses001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/AllClasses/allclasses001.java index 687a56e69fbb..292b2d8eb53e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/AllClasses/allclasses001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/AllClasses/allclasses001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -44,7 +44,10 @@ public class allclasses001 { static final String TESTED_CLASS_NAME = DEBUGEE_CLASS_NAME; public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } public static int run(String argv[], PrintStream out) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/AllClasses/allclasses001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/AllClasses/allclasses001/TestDescription.java index 4f11e1d91bde..85a45c798e63 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/AllClasses/allclasses001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/AllClasses/allclasses001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -49,7 +49,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.VirtualMachine.AllClasses.allclasses001a - * @run main/othervm + * @run driver * nsk.jdwp.VirtualMachine.AllClasses.allclasses001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/AllClassesWithGeneric/allclswithgeneric001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/AllClassesWithGeneric/allclswithgeneric001.java index c5806ce7b540..aee8b353368f 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/AllClassesWithGeneric/allclswithgeneric001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/AllClassesWithGeneric/allclswithgeneric001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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 @@ -87,8 +87,11 @@ public class allclswithgeneric001 { private Log log; - public static void main(String argv[]) { - System.exit(run(argv,System.out) + Consts.JCK_STATUS_BASE); + public static void main (String argv[]) { + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } public static int run(String argv[], PrintStream out) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/AllClassesWithGeneric/allclswithgeneric001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/AllClassesWithGeneric/allclswithgeneric001/TestDescription.java index 980bdb98c893..8c251a0ca4b8 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/AllClassesWithGeneric/allclswithgeneric001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/AllClassesWithGeneric/allclswithgeneric001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -45,7 +45,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.VirtualMachine.AllClassesWithGeneric.allclswithgeneric001t - * @run main/othervm + * @run driver * nsk.jdwp.VirtualMachine.AllClassesWithGeneric.allclswithgeneric001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/AllThreads/allthreads001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/AllThreads/allthreads001.java index e3e291fcdcdd..5fa23569fc48 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/AllThreads/allthreads001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/AllThreads/allthreads001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -44,7 +44,10 @@ public class allthreads001 { static final String TESTED_CLASS_NAME = DEBUGEE_CLASS_NAME; public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } public static int run(String argv[], PrintStream out) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/AllThreads/allthreads001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/AllThreads/allthreads001/TestDescription.java index 782045881ac5..6822e5e7b327 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/AllThreads/allthreads001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/AllThreads/allthreads001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -47,7 +47,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.VirtualMachine.AllThreads.allthreads001a - * @run main/othervm + * @run driver * nsk.jdwp.VirtualMachine.AllThreads.allthreads001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/Capabilities/capabilities001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/Capabilities/capabilities001.java index 5e05f6406f6f..e5b11b3be969 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/Capabilities/capabilities001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/Capabilities/capabilities001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -42,7 +42,10 @@ public class capabilities001 { static final int JDWP_COMMAND_ID = JDWP.Command.VirtualMachine.Capabilities; public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } public static int run(String argv[], PrintStream out) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/Capabilities/capabilities001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/Capabilities/capabilities001/TestDescription.java index bba5b1c30153..30ed332c53ec 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/Capabilities/capabilities001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/Capabilities/capabilities001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -47,7 +47,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.VirtualMachine.Capabilities.capabilities001a - * @run main/othervm + * @run driver * nsk.jdwp.VirtualMachine.Capabilities.capabilities001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/CapabilitiesNew/capabilitiesnew001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/CapabilitiesNew/capabilitiesnew001.java index 00ffc5050348..1fe5df86db8f 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/CapabilitiesNew/capabilitiesnew001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/CapabilitiesNew/capabilitiesnew001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -42,7 +42,10 @@ public class capabilitiesnew001 { static final int JDWP_COMMAND_ID = JDWP.Command.VirtualMachine.CapabilitiesNew; public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } public static int run(String argv[], PrintStream out) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/CapabilitiesNew/capabilitiesnew001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/CapabilitiesNew/capabilitiesnew001/TestDescription.java index 4d4c69cde636..aa0479c819bc 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/CapabilitiesNew/capabilitiesnew001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/CapabilitiesNew/capabilitiesnew001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -49,7 +49,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.VirtualMachine.CapabilitiesNew.capabilitiesnew001a - * @run main/othervm + * @run driver * nsk.jdwp.VirtualMachine.CapabilitiesNew.capabilitiesnew001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/ClassPaths/classpaths001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/ClassPaths/classpaths001.java index da06f738f93e..1882ce814156 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/ClassPaths/classpaths001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/ClassPaths/classpaths001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -42,7 +42,10 @@ public class classpaths001 { static final int JDWP_COMMAND_ID = JDWP.Command.VirtualMachine.ClassPaths; public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } public static int run(String argv[], PrintStream out) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/ClassPaths/classpaths001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/ClassPaths/classpaths001/TestDescription.java index 4f7d685117c9..41e53912f208 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/ClassPaths/classpaths001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/ClassPaths/classpaths001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -40,7 +40,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.VirtualMachine.ClassPaths.classpaths001a - * @run main/othervm + * @run driver * nsk.jdwp.VirtualMachine.ClassPaths.classpaths001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/ClassesBySignature/classbysig001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/ClassesBySignature/classbysig001.java index 03fc0c49dca7..c319372fc90a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/ClassesBySignature/classbysig001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/ClassesBySignature/classbysig001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -45,7 +45,10 @@ public class classbysig001 { // static final String TESTED_CLASS_SIGNATURE = "L" + TESTED_CLASS_NAME + ";"; public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } public static int run(String argv[], PrintStream out) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/ClassesBySignature/classbysig001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/ClassesBySignature/classbysig001/TestDescription.java index 14f40d16e78f..2127c0d3d876 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/ClassesBySignature/classbysig001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/ClassesBySignature/classbysig001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -47,7 +47,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.VirtualMachine.ClassesBySignature.classbysig001a - * @run main/othervm + * @run driver * nsk.jdwp.VirtualMachine.ClassesBySignature.classbysig001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/CreateString/createstr001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/CreateString/createstr001.java index 5e0a4b8427e0..aaa964b4fa39 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/CreateString/createstr001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/CreateString/createstr001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -42,7 +42,10 @@ public class createstr001 { static final int JDWP_COMMAND_ID = JDWP.Command.VirtualMachine.CreateString; public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } public static int run(String argv[], PrintStream out) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/CreateString/createstr001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/CreateString/createstr001/TestDescription.java index 54789071b513..27bab252c023 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/CreateString/createstr001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/CreateString/createstr001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -43,7 +43,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.VirtualMachine.CreateString.createstr001a - * @run main/othervm + * @run driver * nsk.jdwp.VirtualMachine.CreateString.createstr001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/Dispose/dispose001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/Dispose/dispose001.java index e115fa9e6487..89b0f608ff73 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/Dispose/dispose001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/Dispose/dispose001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -42,7 +42,10 @@ public class dispose001 { static final int JDWP_COMMAND_ID = JDWP.Command.VirtualMachine.Dispose; public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } public static int run(String argv[], PrintStream out) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/Dispose/dispose001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/Dispose/dispose001/TestDescription.java index 44b64f614f31..2e3e7d2afcda 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/Dispose/dispose001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/Dispose/dispose001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -51,7 +51,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.VirtualMachine.Dispose.dispose001a - * @run main/othervm + * @run driver * nsk.jdwp.VirtualMachine.Dispose.dispose001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/DisposeObjects/disposeobj001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/DisposeObjects/disposeobj001.java index 901b69de37ae..9c2a0e534785 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/DisposeObjects/disposeobj001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/DisposeObjects/disposeobj001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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,7 +93,10 @@ public class disposeobj001 { * Start test from command line. */ public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/DisposeObjects/disposeobj001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/DisposeObjects/disposeobj001/TestDescription.java index 3782fc59b3fb..5fc151bf339a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/DisposeObjects/disposeobj001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/DisposeObjects/disposeobj001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -55,7 +55,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.VirtualMachine.DisposeObjects.disposeobj001a - * @run main/othervm + * @run driver * nsk.jdwp.VirtualMachine.DisposeObjects.disposeobj001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/Exit/exit001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/Exit/exit001.java index b9313fc838f0..f7fd27b03d53 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/Exit/exit001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/Exit/exit001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -42,7 +42,10 @@ public class exit001 { static final int JDWP_COMMAND_ID = JDWP.Command.VirtualMachine.Exit; public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } public static int run(String argv[], PrintStream out) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/Exit/exit001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/Exit/exit001/TestDescription.java index c1fb69e22281..772184d294ee 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/Exit/exit001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/Exit/exit001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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,7 +53,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.VirtualMachine.Exit.exit001a - * @run main/othervm + * @run driver * nsk.jdwp.VirtualMachine.Exit.exit001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/HoldEvents/holdevents001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/HoldEvents/holdevents001.java index c0b28b905ccc..890b1be77bc0 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/HoldEvents/holdevents001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/HoldEvents/holdevents001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -78,7 +78,10 @@ public class holdevents001 { * Start test from command line. */ public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/HoldEvents/holdevents001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/HoldEvents/holdevents001/TestDescription.java index c562dc2e2a66..4f096ee2f491 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/HoldEvents/holdevents001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/HoldEvents/holdevents001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -52,7 +52,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.VirtualMachine.HoldEvents.holdevents001a - * @run main/othervm + * @run driver * nsk.jdwp.VirtualMachine.HoldEvents.holdevents001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/HoldEvents/holdevents002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/HoldEvents/holdevents002.java index 2995beb7979b..c6e0cc4b014b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/HoldEvents/holdevents002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/HoldEvents/holdevents002.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -87,8 +87,11 @@ public class holdevents002 { /** * Start test from command line. */ - public static void main(String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + public static void main (String argv[]) { + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/IDSizes/idsizes001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/IDSizes/idsizes001.java index 49dbbcd17054..863160e6a1fd 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/IDSizes/idsizes001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/IDSizes/idsizes001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -42,7 +42,10 @@ public class idsizes001 { static final int JDWP_COMMAND_ID = JDWP.Command.VirtualMachine.IDSizes; public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } public static int run(String argv[], PrintStream out) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/IDSizes/idsizes001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/IDSizes/idsizes001/TestDescription.java index 0dcb07c803b4..bf0d6db0f880 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/IDSizes/idsizes001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/IDSizes/idsizes001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -40,7 +40,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.VirtualMachine.IDSizes.idsizes001a - * @run main/othervm + * @run driver * nsk.jdwp.VirtualMachine.IDSizes.idsizes001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/InstanceCounts/instanceCounts001/instanceCounts001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/InstanceCounts/instanceCounts001/instanceCounts001.java index e25d2cc3189f..dc21d1bc9d38 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/InstanceCounts/instanceCounts001/instanceCounts001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/InstanceCounts/instanceCounts001/instanceCounts001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, 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 @@ -91,8 +91,11 @@ protected String getDebugeeClassName() { return "nsk.jdwp.VirtualMachine.InstanceCounts.instanceCounts001.instanceCounts001a"; } - public static void main(String[] argv) { - System.exit(run(argv, System.out) + Consts.JCK_STATUS_BASE); + public static void main (String argv[]) { + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } public static int run(String[] argv, PrintStream out) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/RedefineClasses/redefinecls001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/RedefineClasses/redefinecls001.java index 37cc65ff94eb..bc620c8b59c6 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/RedefineClasses/redefinecls001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/RedefineClasses/redefinecls001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -102,7 +102,10 @@ public class redefinecls001 { * Start test from command line. */ public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/RedefineClasses/redefinecls001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/RedefineClasses/redefinecls001/TestDescription.java index 5ea557b5164f..7707821bc793 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/RedefineClasses/redefinecls001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/RedefineClasses/redefinecls001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -74,7 +74,7 @@ * nsk.jdwp.VirtualMachine.RedefineClasses.redefinecls001b * @run driver nsk.share.ExtraClassesBuilder * newclass - * @run main/othervm + * @run driver * nsk.jdwp.VirtualMachine.RedefineClasses.redefinecls001 * . * -arch=${os.family}-${os.simpleArch} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/ReleaseEvents/releaseevents001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/ReleaseEvents/releaseevents001.java index 95bafeb1aff0..ddca99b03d31 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/ReleaseEvents/releaseevents001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/ReleaseEvents/releaseevents001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -78,7 +78,10 @@ public class releaseevents001 { * Start test from command line. */ public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/ReleaseEvents/releaseevents001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/ReleaseEvents/releaseevents001/TestDescription.java index 589d061373d4..8cbb7a6e15fc 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/ReleaseEvents/releaseevents001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/ReleaseEvents/releaseevents001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -56,7 +56,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.VirtualMachine.ReleaseEvents.releaseevents001a - * @run main/othervm + * @run driver * nsk.jdwp.VirtualMachine.ReleaseEvents.releaseevents001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/ReleaseEvents/releaseevents002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/ReleaseEvents/releaseevents002.java index 64b6ce1547b5..ff278aabcf35 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/ReleaseEvents/releaseevents002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/ReleaseEvents/releaseevents002.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -87,8 +87,11 @@ public class releaseevents002 { /** * Start test from command line. */ - public static void main(String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + public static void main (String argv[]) { + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/ReleaseEvents/releaseevents002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/ReleaseEvents/releaseevents002/TestDescription.java index cb6760f97876..1c94d9d75876 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/ReleaseEvents/releaseevents002/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/ReleaseEvents/releaseevents002/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -56,7 +56,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.VirtualMachine.ReleaseEvents.releaseevents002a - * @run main/othervm + * @run driver * nsk.jdwp.VirtualMachine.ReleaseEvents.releaseevents002 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/Resume/resume001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/Resume/resume001.java index ed427439edc7..cb602d17ba03 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/Resume/resume001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/Resume/resume001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -42,7 +42,10 @@ public class resume001 { static final int JDWP_COMMAND_ID = JDWP.Command.VirtualMachine.Resume; public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } public static int run(String argv[], PrintStream out) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/Resume/resume001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/Resume/resume001/TestDescription.java index 14fcd815f289..90b6db41be0e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/Resume/resume001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/Resume/resume001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -51,7 +51,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.VirtualMachine.Resume.resume001a - * @run main/othervm + * @run driver * nsk.jdwp.VirtualMachine.Resume.resume001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/SetDefaultStratum/setdefstrat001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/SetDefaultStratum/setdefstrat001.java index 51e8a03487bc..b90423e62190 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/SetDefaultStratum/setdefstrat001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/SetDefaultStratum/setdefstrat001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -85,7 +85,10 @@ public class setdefstrat001 { * Start test from command line. */ public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/SetDefaultStratum/setdefstrat001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/SetDefaultStratum/setdefstrat001/TestDescription.java index 94828c43d800..43f0a4037987 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/SetDefaultStratum/setdefstrat001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/SetDefaultStratum/setdefstrat001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -54,7 +54,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.VirtualMachine.SetDefaultStratum.setdefstrat001a - * @run main/othervm + * @run driver * nsk.jdwp.VirtualMachine.SetDefaultStratum.setdefstrat001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/TopLevelThreadGroups/threadgroups001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/TopLevelThreadGroups/threadgroups001.java index e04cb45580c6..daaf39cc5fa2 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/TopLevelThreadGroups/threadgroups001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/TopLevelThreadGroups/threadgroups001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -42,7 +42,10 @@ public class threadgroups001 { static final int JDWP_COMMAND_ID = JDWP.Command.VirtualMachine.TopLevelThreadGroups; public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } public static int run(String argv[], PrintStream out) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/TopLevelThreadGroups/threadgroups001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/TopLevelThreadGroups/threadgroups001/TestDescription.java index ecd37d43e848..ac51bc95011a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/TopLevelThreadGroups/threadgroups001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/TopLevelThreadGroups/threadgroups001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -40,7 +40,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.VirtualMachine.TopLevelThreadGroups.threadgroups001a - * @run main/othervm + * @run driver * nsk.jdwp.VirtualMachine.TopLevelThreadGroups.threadgroups001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/Version/version001.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/Version/version001.java index b89aa3e0ec0b..66575fee4f8e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/Version/version001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/Version/version001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -42,7 +42,10 @@ public class version001 { static final int JDWP_COMMAND_ID = JDWP.Command.VirtualMachine.Version; public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } public static int run(String argv[], PrintStream out) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/Version/version001/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/Version/version001/TestDescription.java index c26171f0dec2..cd1d7123a34a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/Version/version001/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/Version/version001/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -39,7 +39,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.VirtualMachine.Version.version001a - * @run main/othervm + * @run driver * nsk.jdwp.VirtualMachine.Version.version001 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/Version/version002.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/Version/version002.java index 5907a8159ffe..8060922340ce 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/Version/version002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/Version/version002.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -42,7 +42,10 @@ public class version002 { static final int JDWP_COMMAND_ID = JDWP.Command.VirtualMachine.Version; public static void main (String argv[]) { - System.exit(run(argv,System.out) + JCK_STATUS_BASE); + int result = run(argv, System.out); + if (result != 0) { + throw new RuntimeException("Test failed"); + } } public static int run(String argv[], PrintStream out) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/Version/version002/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/Version/version002/TestDescription.java index cfc6ed266c17..d09e4f5176d0 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/Version/version002/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jdwp/VirtualMachine/Version/version002/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -40,7 +40,7 @@ * @library /vmTestbase /test/hotspot/jtreg/vmTestbase * /test/lib * @build nsk.jdwp.VirtualMachine.Version.version002a - * @run main/othervm + * @run driver * nsk.jdwp.VirtualMachine.Version.version002 * -arch=${os.family}-${os.simpleArch} * -verbose diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AddCapabilities/addcaps001/addcaps001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AddCapabilities/addcaps001/addcaps001.cpp index 86626181ea35..711ceda69cc8 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AddCapabilities/addcaps001/addcaps001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AddCapabilities/addcaps001/addcaps001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,9 +24,9 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -268,7 +268,7 @@ callbackVMDeath(jvmtiEnv* jvmti, JNIEnv* jni) { success = checkCapabilities(jvmti, &initCaps, "VM_DEATH callback"); NSK_DISPLAY1("Disable events: %d events\n", EVENTS_COUNT); - if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, NULL)) { + if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, nullptr)) { success = NSK_FALSE; } else { NSK_DISPLAY0(" ... disabled\n"); @@ -295,7 +295,7 @@ JNIEXPORT jint JNI_OnLoad_addcaps001(JavaVM *jvm, char *options, void *reserved) } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -303,7 +303,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; { @@ -318,7 +318,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; NSK_DISPLAY0(">>> Testcase #0: Add empty capabilities list in Agent_OnLoad()\n"); @@ -333,7 +333,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } NSK_DISPLAY1("Enable events: %d events\n", EVENTS_COUNT); - if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, NULL)) { + if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, nullptr)) { NSK_DISPLAY0(" ... enabled\n"); } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AddCapabilities/addcaps002/addcaps002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AddCapabilities/addcaps002/addcaps002.cpp index 54b85588f5c6..b15f99e15d5e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AddCapabilities/addcaps002/addcaps002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AddCapabilities/addcaps002/addcaps002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,9 +24,9 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -287,7 +287,7 @@ callbackVMDeath(jvmtiEnv* jvmti, JNIEnv* jni) { success = checkCapabilities(jvmti, &initCaps, "VM_DEATH callback"); NSK_DISPLAY1("Disable events: %d events\n", EVENTS_COUNT); - if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, NULL)) { + if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, nullptr)) { success = NSK_FALSE; } else { NSK_DISPLAY0(" ... disabled\n"); @@ -314,7 +314,7 @@ JNIEXPORT jint JNI_OnLoad_addcaps002(JavaVM *jvm, char *options, void *reserved) } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -322,7 +322,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; { @@ -337,7 +337,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&initCaps, 0, sizeof(jvmtiCapabilities)); @@ -356,7 +356,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } NSK_DISPLAY1("Enable events: %d events\n", EVENTS_COUNT); - if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, NULL)) { + if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, nullptr)) { NSK_DISPLAY0(" ... enabled\n"); } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AddCapabilities/addcaps003/addcaps003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AddCapabilities/addcaps003/addcaps003.cpp index 0f5476edc1df..bfbb0048ae21 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AddCapabilities/addcaps003/addcaps003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AddCapabilities/addcaps003/addcaps003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, 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,9 +23,9 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -136,7 +136,7 @@ callbackVMDeath(jvmtiEnv* jvmti, JNIEnv* jni) { success = checkCapabilities(jvmti, &initCaps, "VM_DEATH callback"); NSK_DISPLAY1("Disable events: %d events\n", EVENTS_COUNT); - if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, NULL)) { + if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, nullptr)) { success = NSK_FALSE; } else { NSK_DISPLAY0(" ... disabled\n"); @@ -163,7 +163,7 @@ JNIEXPORT jint JNI_OnLoad_addcaps003(JavaVM *jvm, char *options, void *reserved) } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -171,7 +171,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; { @@ -186,7 +186,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&initCaps, 0, sizeof(jvmtiCapabilities)); @@ -205,7 +205,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } NSK_DISPLAY1("Enable events: %d events\n", EVENTS_COUNT); - if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, NULL)) { + if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, nullptr)) { NSK_DISPLAY0(" ... enabled\n"); } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Agent_OnLoad/agentonload001/agentonload001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Agent_OnLoad/agentonload001/agentonload001.cpp index 1aa6e1b66794..68701a3365b8 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Agent_OnLoad/agentonload001/agentonload001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Agent_OnLoad/agentonload001/agentonload001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,8 +22,8 @@ */ #include "jvmti.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -67,13 +67,13 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { NSK_DISPLAY1(" options: \"%s\"\n", nsk_null_string(options)); NSK_DISPLAY1(" reserved: 0x%p\n", (void*)jvm); - if (jvm == NULL) { - NSK_COMPLAIN1("First parameter 'vm' in JVM_OnLoad() is NULL: 0x%p\n", (void*)jvm); + if (jvm == nullptr) { + NSK_COMPLAIN1("First parameter 'vm' in JVM_OnLoad() is null: 0x%p\n", (void*)jvm); status = STATUS_FAILED; } - if (options == NULL) { - NSK_COMPLAIN1("Second parameter 'options' in JVM_OnLoad() is NULL: 0x%p\n", (void*)options); + if (options == nullptr) { + NSK_COMPLAIN1("Second parameter 'options' in JVM_OnLoad() is null: 0x%p\n", (void*)options); status = STATUS_FAILED; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Agent_OnLoad/agentonload002/agentonload002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Agent_OnLoad/agentonload002/agentonload002.cpp index d591cac18a5e..959f3bb4fe65 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Agent_OnLoad/agentonload002/agentonload002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Agent_OnLoad/agentonload002/agentonload002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ #include #include #include "jvmti.h" -#include "agent_common.h" +#include "agent_common.hpp" extern "C" { @@ -48,8 +48,8 @@ JNIEXPORT jint JNI_OnLoad_agentonload002(JavaVM *jvm, char *options, void *reser #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - if (options == NULL) { - printf("# ERROR: Second parameter 'options' in JVM_OnLoad() is NULL: 0x%p\n", + if (options == nullptr) { + printf("# ERROR: Second parameter 'options' in JVM_OnLoad() is null: 0x%p\n", (void*)options); return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Agent_OnLoad/agentonload003/agentonload003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Agent_OnLoad/agentonload003/agentonload003.cpp index 9aa1c4a0e58a..e701b3dbac14 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Agent_OnLoad/agentonload003/agentonload003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Agent_OnLoad/agentonload003/agentonload003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ #include #include #include "jvmti.h" -#include "agent_common.h" +#include "agent_common.hpp" extern "C" { @@ -48,8 +48,8 @@ JNIEXPORT jint JNI_OnLoad_agentonload003(JavaVM *jvm, char *options, void *reser #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - if (options == NULL) { - printf("# ERROR: Second parameter 'options' in JVM_OnLoad() is NULL: 0x%p\n", + if (options == nullptr) { + printf("# ERROR: Second parameter 'options' in JVM_OnLoad() is null: 0x%p\n", (void*)options); return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Agent_OnUnload/agentonunload001/agentonunload001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Agent_OnUnload/agentonunload001/agentonunload001.cpp index 89161f0b677b..27970b4d8ca0 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Agent_OnUnload/agentonunload001/agentonunload001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Agent_OnUnload/agentonunload001/agentonunload001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,8 +22,8 @@ */ #include "jvmti.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" extern "C" { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Allocate/alloc001/alloc001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Allocate/alloc001/alloc001.cpp index d2df97bdea99..9500c40b7473 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Allocate/alloc001/alloc001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Allocate/alloc001/alloc001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -40,7 +40,7 @@ extern "C" { // limit virtual memory (this usually happens on mac). #define MAX_CHUNK_COUNT 8 * 1024 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; #ifdef STATIC_BUILD @@ -59,7 +59,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -71,17 +71,17 @@ JNIEXPORT jint JNICALL Java_nsk_jvmti_Allocate_alloc001_Test_check(JNIEnv *env, jclass cls) { jvmtiError err; size_t size; - void *prev = NULL; + void *prev = nullptr; void **mem; int memCount = 1; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } printf(">>> Null pointer check ...\n"); - err = jvmti->Allocate((jlong)1, NULL); + err = jvmti->Allocate((jlong)1, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { printf("Error expected: JVMTI_ERROR_NULL_POINTER, got: %s\n", TranslateError(err)); @@ -135,7 +135,7 @@ Java_nsk_jvmti_Allocate_alloc001_Test_check(JNIEnv *env, jclass cls) { printf(">>> ... done (%dMb)\n", memCount); printf(">>> Deallocation ...\n"); - while (prev != NULL) { + while (prev != nullptr) { mem = (void**) prev; prev = *mem; err = jvmti->Deallocate((unsigned char *)mem); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach002/attach002Agent00.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach002/attach002Agent00.cpp index de5229e6b6ea..068aab82e45c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach002/attach002Agent00.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach002/attach002Agent00.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,8 @@ #include #include #include -#include -#include +#include +#include #include "ExceptionCheckingJniEnv.hpp" extern "C" { @@ -45,7 +45,7 @@ extern "C" { // class name in the ClassFileLoadHook callback #define REDEFINED_CLASS_NAME_INTERNAL "nsk/jvmti/AttachOnDemand/attach002/ClassToRedefine" -static Options* options = NULL; +static Options* options = nullptr; static const char* agentName; static volatile jboolean agentGotCapabilities = JNI_FALSE; @@ -152,13 +152,13 @@ void JNICALL classFileLoadHoockHandler( jint * new_class_data_len, unsigned char** new_class_data) { - if (name != NULL) { + if (name != nullptr) { NSK_DISPLAY2("%s: ClassFileLoadHook event received for class '%s'\n", agentName, name); if (!strcmp(name, REDEFINED_CLASS_NAME_INTERNAL)) { classFileLoadHookReceived++; } } else { - NSK_DISPLAY1("%s: ClassFileLoadHook event received for class with NULL name\n", agentName); + NSK_DISPLAY1("%s: ClassFileLoadHook event received for class with null name\n", agentName); } } @@ -177,21 +177,21 @@ Agent_OnAttach(JavaVM *vm, char *optionsString, void *reserved) { jvmtiEventCallbacks eventCallbacks; jvmtiCapabilities caps; - jvmtiEnv* jvmti = NULL; - JNIEnv* jni = NULL; + jvmtiEnv* jvmti = nullptr; + JNIEnv* jni = nullptr; options = (Options*) nsk_aod_createOptions(optionsString); - if (!NSK_VERIFY(options != NULL)) + if (!NSK_VERIFY(options != nullptr)) return JNI_ERR; agentName = nsk_aod_getOptionValue(options, NSK_AOD_AGENT_NAME_OPTION); jni = (JNIEnv*) nsk_aod_createJNIEnv(vm); - if (jni == NULL) + if (jni == nullptr) return NSK_FALSE; jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; registerNativeMethods(jni); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach002a/attach002aAgent00.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach002a/attach002aAgent00.cpp index ccc022edd1fd..638189059a2c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach002a/attach002aAgent00.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach002a/attach002aAgent00.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,8 @@ #include #include #include -#include -#include +#include +#include extern "C" { @@ -40,7 +40,7 @@ extern "C" { #define REDEFINED_CLASS_NAME "Ljava/lang/InterruptedException;" #define REDEFINED_CLASS_FILE_NAME "java/lang/InterruptedException" -static Options* options = NULL; +static Options* options = nullptr; static const char* agentName; static jvmtiEvent testEvents[] = { JVMTI_EVENT_VM_OBJECT_ALLOC }; @@ -89,21 +89,21 @@ Agent_OnAttach(JavaVM *vm, char *optionsString, void *reserved) { jvmtiEventCallbacks eventCallbacks; jvmtiCapabilities caps; - jvmtiEnv* jvmti = NULL; - JNIEnv* jni = NULL; + jvmtiEnv* jvmti = nullptr; + JNIEnv* jni = nullptr; options = (Options*) nsk_aod_createOptions(optionsString); - if (!NSK_VERIFY(options != NULL)) + if (!NSK_VERIFY(options != nullptr)) return JNI_ERR; agentName = nsk_aod_getOptionValue(options, NSK_AOD_AGENT_NAME_OPTION); jni = (JNIEnv*) nsk_aod_createJNIEnv(vm); - if (jni == NULL) + if (jni == nullptr) return NSK_FALSE; jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; memset(&caps, 0, sizeof(caps)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach008/attach008Agent00.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach008/attach008Agent00.cpp index c1e9bce3ee39..d3b809707fda 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach008/attach008Agent00.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach008/attach008Agent00.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,8 @@ #include #include #include -#include -#include +#include +#include extern "C" { @@ -38,7 +38,7 @@ extern "C" { #define THREAD_GENERATING_EVENTS_NAME "ThreadGeneratingEvents" -static Options* options = NULL; +static Options* options = nullptr; static const char* agentName; static jvmtiEvent testEvents[] = { JVMTI_EVENT_MONITOR_CONTENDED_ENTER, JVMTI_EVENT_MONITOR_CONTENDED_ENTERED }; @@ -107,21 +107,21 @@ Agent_OnAttach(JavaVM *vm, char *optionsString, void *reserved) { jvmtiEventCallbacks eventCallbacks; jvmtiCapabilities caps; - jvmtiEnv* jvmti = NULL; - JNIEnv* jni = NULL; + jvmtiEnv* jvmti = nullptr; + JNIEnv* jni = nullptr; options = (Options*) nsk_aod_createOptions(optionsString); - if (!NSK_VERIFY(options != NULL)) + if (!NSK_VERIFY(options != nullptr)) return JNI_ERR; agentName = nsk_aod_getOptionValue(options, NSK_AOD_AGENT_NAME_OPTION); jni = (JNIEnv*) nsk_aod_createJNIEnv(vm); - if (jni == NULL) + if (jni == nullptr) return NSK_FALSE; jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; memset(&caps, 0, sizeof(caps)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach009/attach009Agent00.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach009/attach009Agent00.cpp index 3256b62582f9..6df1e963fad6 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach009/attach009Agent00.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach009/attach009Agent00.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,8 @@ #include #include #include -#include -#include +#include +#include extern "C" { @@ -38,7 +38,7 @@ extern "C" { * - receive ClassLoad event for class LastLoadedClass and finish work */ -static Options* options = NULL; +static Options* options = nullptr; static const char* agentName; #define FIRST_LOADED_CLASS "Lnsk/jvmti/AttachOnDemand/attach009/FirstLoadedClass;" @@ -129,17 +129,17 @@ Agent_OnAttach(JavaVM *vm, char *optionsString, void *reserved) JNIEnv* jni; options = (Options*) nsk_aod_createOptions(optionsString); - if (!NSK_VERIFY(options != NULL)) + if (!NSK_VERIFY(options != nullptr)) return JNI_ERR; agentName = nsk_aod_getOptionValue(options, NSK_AOD_AGENT_NAME_OPTION); jni = (JNIEnv*) nsk_aod_createJNIEnv(vm); - if (jni == NULL) + if (jni == nullptr) return NSK_FALSE; jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; memset(&eventCallbacks,0, sizeof(eventCallbacks)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach012/attach012Agent00.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach012/attach012Agent00.cpp index 64ab7c0974b7..202cbd3f7bca 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach012/attach012Agent00.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach012/attach012Agent00.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,8 @@ #include #include #include -#include -#include +#include +#include extern "C" { @@ -49,23 +49,23 @@ Agent_OnAttach(JavaVM *vm, char *optionsString, void *reserved) #endif { jvmtiEnv* jvmti; - JNIEnv* jni = NULL; - Options* options = NULL; + JNIEnv* jni = nullptr; + Options* options = nullptr; const char* agentName; jvmtiCapabilities caps; options = (Options*) nsk_aod_createOptions(optionsString); - if (!NSK_VERIFY(options != NULL)) + if (!NSK_VERIFY(options != nullptr)) return JNI_ERR; agentName = nsk_aod_getOptionValue(options, NSK_AOD_AGENT_NAME_OPTION); jni = (JNIEnv*) nsk_aod_createJNIEnv(vm); - if (jni == NULL) + if (jni == nullptr) return NSK_FALSE; jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->GetPotentialCapabilities(&caps))) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach014/attach014Agent00.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach014/attach014Agent00.cpp index ce3fa29a4e2f..5fcecea31d37 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach014/attach014Agent00.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach014/attach014Agent00.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,8 @@ #include #include #include -#include -#include +#include +#include extern "C" { @@ -39,7 +39,7 @@ extern "C" { * - agent receives ClassLoad event for this class, calls DisposeEnvironment and finishes work */ -static Options* options = NULL; +static Options* options = nullptr; static const char* agentName; void JNICALL @@ -88,21 +88,21 @@ Agent_OnAttach(JavaVM *vm, char *optionsString, void *reserved) #endif { jvmtiEventCallbacks eventCallbacks; - jvmtiEnv* jvmti = NULL; - JNIEnv* jni = NULL; + jvmtiEnv* jvmti = nullptr; + JNIEnv* jni = nullptr; options = (Options*) nsk_aod_createOptions(optionsString); - if (!NSK_VERIFY(options != NULL)) + if (!NSK_VERIFY(options != nullptr)) return JNI_ERR; agentName = nsk_aod_getOptionValue(options, NSK_AOD_AGENT_NAME_OPTION); jni = (JNIEnv*) nsk_aod_createJNIEnv(vm); - if (jni == NULL) + if (jni == nullptr) return NSK_FALSE; jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; memset(&eventCallbacks,0, sizeof(eventCallbacks)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach015/attach015Agent00.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach015/attach015Agent00.cpp index a28c912880c6..64e5a4ae9a46 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach015/attach015Agent00.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach015/attach015Agent00.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,8 @@ #include #include #include -#include -#include +#include +#include extern "C" { @@ -40,7 +40,7 @@ extern "C" { #define CLASS_NAME1 "Lnsk/jvmti/AttachOnDemand/attach015/ClassToLoad1;" #define CLASS_NAME2 "Lnsk/jvmti/AttachOnDemand/attach015/ClassToLoad2;" -static Options* options = NULL; +static Options* options = nullptr; static const char* agentName; static int receivedEventsCount = 0; @@ -81,21 +81,21 @@ Agent_OnAttach(JavaVM *vm, char *optionsString, void *reserved) #endif { jvmtiEventCallbacks eventCallbacks; - jvmtiEnv* jvmti = NULL; - JNIEnv* jni = NULL; + jvmtiEnv* jvmti = nullptr; + JNIEnv* jni = nullptr; options = (Options*) nsk_aod_createOptions(optionsString); - if (!NSK_VERIFY(options != NULL)) + if (!NSK_VERIFY(options != nullptr)) return JNI_ERR; agentName = nsk_aod_getOptionValue(options, NSK_AOD_AGENT_NAME_OPTION); jni = (JNIEnv*) nsk_aod_createJNIEnv(vm); - if (jni == NULL) + if (jni == nullptr) return NSK_FALSE; jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; memset(&eventCallbacks,0, sizeof(eventCallbacks)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach015/attach015Agent01.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach015/attach015Agent01.cpp index 78527c41cc85..3f76856bb228 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach015/attach015Agent01.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach015/attach015Agent01.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,8 @@ #include #include #include -#include -#include +#include +#include extern "C" { @@ -40,7 +40,7 @@ extern "C" { #define CLASS_NAME1 "Lnsk/jvmti/AttachOnDemand/attach015/ClassToLoad1;" #define CLASS_NAME2 "Lnsk/jvmti/AttachOnDemand/attach015/ClassToLoad2;" -static Options* options = NULL; +static Options* options = nullptr; static const char* agentName; static int receivedEventsCount = 0; @@ -81,21 +81,21 @@ Agent_OnAttach(JavaVM *vm, char *optionsString, void *reserved) #endif { jvmtiEventCallbacks eventCallbacks; - jvmtiEnv* jvmti = NULL; - JNIEnv* jni = NULL; + jvmtiEnv* jvmti = nullptr; + JNIEnv* jni = nullptr; options = (Options*) nsk_aod_createOptions(optionsString); - if (!NSK_VERIFY(options != NULL)) + if (!NSK_VERIFY(options != nullptr)) return JNI_ERR; agentName = nsk_aod_getOptionValue(options, NSK_AOD_AGENT_NAME_OPTION); jni = (JNIEnv*) nsk_aod_createJNIEnv(vm); - if (jni == NULL) + if (jni == nullptr) return JNI_ERR; jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; memset(&eventCallbacks,0, sizeof(eventCallbacks)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach015/attach015Target.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach015/attach015Target.cpp index f54427e3607d..1054cc239afb 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach015/attach015Target.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach015/attach015Target.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,8 @@ #include #include #include -#include -#include +#include +#include extern "C" { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach020/attach020Agent00.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach020/attach020Agent00.cpp index 0a229c858a26..c4aad94da9ae 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach020/attach020Agent00.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach020/attach020Agent00.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,8 @@ #include #include #include -#include -#include +#include +#include extern "C" { @@ -41,7 +41,7 @@ extern "C" { * */ -static Options* options = NULL; +static Options* options = nullptr; static const char* agentName; static jvmtiEvent testEvents[] = { JVMTI_EVENT_GARBAGE_COLLECTION_START, JVMTI_EVENT_GARBAGE_COLLECTION_FINISH }; @@ -116,10 +116,10 @@ int startAuxiliaryThread(jvmtiEnv* jvmti, JNIEnv* jni) { jthread thread; thread = nsk_jvmti_aod_createThread(jni); - if (!NSK_VERIFY(thread != NULL)) + if (!NSK_VERIFY(thread != nullptr)) return NSK_FALSE; - if (!NSK_JVMTI_VERIFY(jvmti->RunAgentThread(thread, auxiliaryThreadFunction, NULL, JVMTI_THREAD_NORM_PRIORITY))) { + if (!NSK_JVMTI_VERIFY(jvmti->RunAgentThread(thread, auxiliaryThreadFunction, nullptr, JVMTI_THREAD_NORM_PRIORITY))) { return NSK_FALSE; } @@ -147,17 +147,17 @@ Agent_OnAttach(JavaVM *vm, char *optionsString, void *reserved) JNIEnv* jni; options = (Options*) nsk_aod_createOptions(optionsString); - if (!NSK_VERIFY(options != NULL)) + if (!NSK_VERIFY(options != nullptr)) return JNI_ERR; agentName = nsk_aod_getOptionValue(options, NSK_AOD_AGENT_NAME_OPTION); jni = (JNIEnv*) nsk_aod_createJNIEnv(vm); - if (jni == NULL) + if (jni == nullptr) return JNI_ERR; jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("GCFinishMonitor", &gcFinishMonitor))) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach021/attach021Agent00.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach021/attach021Agent00.cpp index 9a921d36a6fa..77af92fecb80 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach021/attach021Agent00.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach021/attach021Agent00.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,8 @@ #include #include #include -#include -#include +#include +#include #include "ExceptionCheckingJniEnv.hpp" extern "C" { @@ -48,7 +48,7 @@ extern "C" { static jvmtiEnv* jvmti; -static Options* options = NULL; +static Options* options = nullptr; static const char* agentName; // agent should set success status from objectFreeHandler @@ -74,7 +74,7 @@ Java_nsk_jvmti_AttachOnDemand_attach021_attach021Target_shutdownAgent(JNIEnv * j for any pending ObjectFree events. */ if (jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_OBJECT_FREE, - NULL) != JVMTI_ERROR_NONE) { + nullptr) != JVMTI_ERROR_NONE) { success = 0; } @@ -127,17 +127,17 @@ Agent_OnAttach(JavaVM *vm, char *optionsString, void *reserved) JNIEnv* jni; options = (Options*) nsk_aod_createOptions(optionsString); - if (!NSK_VERIFY(options != NULL)) + if (!NSK_VERIFY(options != nullptr)) return JNI_ERR; agentName = nsk_aod_getOptionValue(options, NSK_AOD_AGENT_NAME_OPTION); jni = (JNIEnv*) nsk_aod_createJNIEnv(vm); - if (jni == NULL) + if (jni == nullptr) return JNI_ERR; jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; registerNativeMethods(jni); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach022/attach022Agent00.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach022/attach022Agent00.cpp index dfece015378c..fb6cb99a5551 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach022/attach022Agent00.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach022/attach022Agent00.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,8 @@ #include #include #include -#include -#include +#include +#include #include "ExceptionCheckingJniEnv.hpp" extern "C" { @@ -34,7 +34,7 @@ extern "C" { #define OBJECTS_FOR_ALLOCATION_TEST_CLASS_NAME "Lnsk/jvmti/AttachOnDemand/attach022/ClassForAllocationEventsTest;" static jvmtiEnv* jvmti; -static Options* options = NULL; +static Options* options = nullptr; static const char* agentName; static jvmtiEvent testEvents[] = { JVMTI_EVENT_OBJECT_FREE, JVMTI_EVENT_VM_OBJECT_ALLOC }; @@ -174,17 +174,17 @@ Agent_OnAttach(JavaVM *vm, char *optionsString, void *reserved) JNIEnv* jni; options = (Options*) nsk_aod_createOptions(optionsString); - if (!NSK_VERIFY(options != NULL)) + if (!NSK_VERIFY(options != nullptr)) return JNI_ERR; agentName = nsk_aod_getOptionValue(options, NSK_AOD_AGENT_NAME_OPTION); jni = (JNIEnv*) nsk_aod_createJNIEnv(vm); - if (jni == NULL) + if (jni == nullptr) return JNI_ERR; jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; registerNativeMethods(jni); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach037/attach037Agent00.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach037/attach037Agent00.cpp index c7e22cdd3f0d..a81f6d7f65c8 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach037/attach037Agent00.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach037/attach037Agent00.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,8 @@ #include #include #include -#include -#include +#include +#include extern "C" { @@ -38,7 +38,7 @@ extern "C" { #define THREAD_GENERATING_EVENTS_NAME "ThreadGeneratingEvents" -static Options* options = NULL; +static Options* options = nullptr; static const char* agentName; static jvmtiEvent testEvents[] = { JVMTI_EVENT_MONITOR_WAIT, JVMTI_EVENT_MONITOR_WAITED }; @@ -110,17 +110,17 @@ Agent_OnAttach(JavaVM *vm, char *optionsString, void *reserved) JNIEnv* jni; options = (Options*) nsk_aod_createOptions(optionsString); - if (!NSK_VERIFY(options != NULL)) + if (!NSK_VERIFY(options != nullptr)) return JNI_ERR; agentName = nsk_aod_getOptionValue(options, NSK_AOD_AGENT_NAME_OPTION); jni = (JNIEnv*) nsk_aod_createJNIEnv(vm); - if (jni == NULL) + if (jni == nullptr) return JNI_ERR; jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; memset(&caps, 0, sizeof(caps)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach038/attach038Agent00.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach038/attach038Agent00.cpp index d2f0767a9a43..f6ac93548801 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach038/attach038Agent00.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach038/attach038Agent00.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,8 @@ #include #include #include -#include -#include +#include +#include extern "C" { @@ -38,7 +38,7 @@ extern "C" { #define THREAD_GENERATING_EVENTS_NAME "ThreadGeneratingEvents" -static Options* options = NULL; +static Options* options = nullptr; static const char* agentName; static jvmtiEvent testEvents[] = { JVMTI_EVENT_THREAD_START, JVMTI_EVENT_THREAD_END }; @@ -106,17 +106,17 @@ Agent_OnAttach(JavaVM *vm, char *optionsString, void *reserved) JNIEnv* jni; options = (Options*) nsk_aod_createOptions(optionsString); - if (!NSK_VERIFY(options != NULL)) + if (!NSK_VERIFY(options != nullptr)) return JNI_ERR; agentName = nsk_aod_getOptionValue(options, NSK_AOD_AGENT_NAME_OPTION); jni = (JNIEnv*) nsk_aod_createJNIEnv(vm); - if (jni == NULL) + if (jni == nullptr) return JNI_ERR; jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; memset(&eventCallbacks,0, sizeof(eventCallbacks)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach039/attach039Agent00.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach039/attach039Agent00.cpp index 7fcea1fac3ba..52d86335c113 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach039/attach039Agent00.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach039/attach039Agent00.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,8 @@ #include #include #include -#include -#include +#include +#include extern "C" { @@ -40,7 +40,7 @@ extern "C" { #define STARTED_THREAD_NAME "ThreadStartedByAgent" -static Options* options = NULL; +static Options* options = nullptr; static const char* agentName; static jvmtiEvent testEvents[] = { JVMTI_EVENT_THREAD_START, JVMTI_EVENT_THREAD_END }; @@ -52,7 +52,7 @@ volatile int threadWasExecuted = 0; void JNICALL startedThreadFunction(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { char threadName[MAX_STRING_LENGTH]; - if (!nsk_jvmti_aod_getThreadName(jvmti, NULL, threadName)) { + if (!nsk_jvmti_aod_getThreadName(jvmti, nullptr, threadName)) { nsk_jvmti_aod_disableEventsAndFinish(agentName, testEvents, testEventsNumber, 0, jvmti, jni); return; } @@ -66,10 +66,10 @@ int startNewThread(jvmtiEnv* jvmti, JNIEnv* jni) { jthread thread; thread = nsk_jvmti_aod_createThreadWithName(jni, STARTED_THREAD_NAME); - if (!NSK_VERIFY(thread != NULL)) + if (!NSK_VERIFY(thread != nullptr)) return NSK_FALSE; - if (!NSK_JVMTI_VERIFY(jvmti->RunAgentThread(thread, startedThreadFunction, NULL, JVMTI_THREAD_NORM_PRIORITY))) { + if (!NSK_JVMTI_VERIFY(jvmti->RunAgentThread(thread, startedThreadFunction, nullptr, JVMTI_THREAD_NORM_PRIORITY))) { return NSK_FALSE; } @@ -142,17 +142,17 @@ Agent_OnAttach(JavaVM *vm, char *optionsString, void *reserved) JNIEnv* jni; options = (Options*) nsk_aod_createOptions(optionsString); - if (!NSK_VERIFY(options != NULL)) + if (!NSK_VERIFY(options != nullptr)) return JNI_ERR; agentName = nsk_aod_getOptionValue(options, NSK_AOD_AGENT_NAME_OPTION); jni = (JNIEnv*) nsk_aod_createJNIEnv(vm); - if (jni == NULL) + if (jni == nullptr) return JNI_ERR; jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; memset(&eventCallbacks,0, sizeof(eventCallbacks)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach040/attach040Agent00.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach040/attach040Agent00.cpp index b5ec2fbf8091..cabc1c43b633 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach040/attach040Agent00.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach040/attach040Agent00.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,8 @@ #include #include #include -#include -#include +#include +#include extern "C" { @@ -47,7 +47,7 @@ static jrawMonitorID threadsCounterMonitor; static volatile int testThreadsCounter = 0; -static Options* options = NULL; +static Options* options = nullptr; static const char* agentName; void JNICALL threadStartHandler(jvmtiEnv *jvmti, @@ -134,17 +134,17 @@ Agent_OnAttach(JavaVM *vm, char *optionsString, void *reserved) JNIEnv* jni; options = (Options*) nsk_aod_createOptions(optionsString); - if (!NSK_VERIFY(options != NULL)) + if (!NSK_VERIFY(options != nullptr)) return JNI_ERR; agentName = nsk_aod_getOptionValue(options, NSK_AOD_AGENT_NAME_OPTION); jni = (JNIEnv*) nsk_aod_createJNIEnv(vm); - if (jni == NULL) + if (jni == nullptr) return JNI_ERR; jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("threadsCounterMonitor", &threadsCounterMonitor))) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach041/attach041Agent00.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach041/attach041Agent00.cpp index 6934868d6d3f..db4b44f67511 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach041/attach041Agent00.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach041/attach041Agent00.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,8 @@ #include #include #include -#include -#include +#include +#include extern "C" { @@ -40,14 +40,14 @@ extern "C" { #define STARTED_TEST_THREAD_NAME "attach041-TestThread" -static Options* options = NULL; +static Options* options = nullptr; static const char* agentName; int tryFindThread(jvmtiEnv *jvmti, jthreadGroup group, const char* threadNameToFind) { jint threadsCount = 0; - jthread *threads = NULL; + jthread *threads = nullptr; jint groupsCount = 0; - jthreadGroup* groups = NULL; + jthreadGroup* groups = nullptr; jvmtiThreadGroupInfo groupInfo; int i; char threadGroupName[MAX_STRING_LENGTH]; @@ -160,17 +160,17 @@ Agent_OnAttach(JavaVM *vm, char *optionsString, void *reserved) JNIEnv* jni; options = (Options*) nsk_aod_createOptions(optionsString); - if (!NSK_VERIFY(options != NULL)) + if (!NSK_VERIFY(options != nullptr)) return JNI_ERR; agentName = nsk_aod_getOptionValue(options, NSK_AOD_AGENT_NAME_OPTION); jni = (JNIEnv*) nsk_aod_createJNIEnv(vm); - if (jni == NULL) + if (jni == nullptr) return JNI_ERR; jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; memset(&eventCallbacks,0, sizeof(eventCallbacks)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach042/attach042Agent00.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach042/attach042Agent00.cpp index 0edaf1107ad3..4682f1c40889 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach042/attach042Agent00.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach042/attach042Agent00.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,8 @@ #include #include #include -#include -#include +#include +#include extern "C" { @@ -40,7 +40,7 @@ extern "C" { #define STARTED_TEST_THREAD_NAME "attach042-TestThread" -static Options* options = NULL; +static Options* options = nullptr; static const char* agentName; void JNICALL threadStartHandler(jvmtiEnv *jvmti, @@ -58,7 +58,7 @@ void JNICALL threadStartHandler(jvmtiEnv *jvmti, if (!strcmp(startedThreadName, STARTED_TEST_THREAD_NAME)) { int success = 1; jint threadsCount = 0; - jthread* threads = NULL; + jthread* threads = nullptr; int i; int startedThreadWasFound = 0; @@ -124,17 +124,17 @@ Agent_OnAttach(JavaVM *vm, char *optionsString, void *reserved) JNIEnv* jni; options = (Options*) nsk_aod_createOptions(optionsString); - if (!NSK_VERIFY(options != NULL)) + if (!NSK_VERIFY(options != nullptr)) return JNI_ERR; agentName = nsk_aod_getOptionValue(options, NSK_AOD_AGENT_NAME_OPTION); jni = (JNIEnv*) nsk_aod_createJNIEnv(vm); - if (jni == NULL) + if (jni == nullptr) return JNI_ERR; jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; memset(&eventCallbacks,0, sizeof(eventCallbacks)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent00.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent00.cpp index a196150bc81c..5a486492799b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent00.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent00.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,8 @@ #include #include #include -#include -#include +#include +#include extern "C" { @@ -37,7 +37,7 @@ extern "C" { #define EXPECTED_EVENTS_NUMBER 500 -static Options* options = NULL; +static Options* options = nullptr; static const char* agentName; static jrawMonitorID eventsCounterMonitor; @@ -98,17 +98,17 @@ Agent_OnAttach(JavaVM *vm, char *optionsString, void *reserved) JNIEnv* jni; options = (Options*) nsk_aod_createOptions(optionsString); - if (!NSK_VERIFY(options != NULL)) + if (!NSK_VERIFY(options != nullptr)) return JNI_ERR; agentName = nsk_aod_getOptionValue(options, NSK_AOD_AGENT_NAME_OPTION); jni = (JNIEnv*) nsk_aod_createJNIEnv(vm); - if (jni == NULL) + if (jni == nullptr) return JNI_ERR; jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("attach045-agent00-eventsCounterMonitor", &eventsCounterMonitor))) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent01.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent01.cpp index a7ce1343d9e5..8843c19d3388 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent01.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent01.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,8 @@ #include #include #include -#include -#include +#include +#include extern "C" { @@ -37,7 +37,7 @@ extern "C" { #define EXPECTED_EVENTS_NUMBER 500 -static Options* options = NULL; +static Options* options = nullptr; static const char* agentName; static jrawMonitorID eventsCounterMonitor; @@ -109,17 +109,17 @@ Agent_OnAttach(JavaVM *vm, char *optionsString, void *reserved) JNIEnv* jni; options = (Options*) nsk_aod_createOptions(optionsString); - if (!NSK_VERIFY(options != NULL)) + if (!NSK_VERIFY(options != nullptr)) return JNI_ERR; agentName = nsk_aod_getOptionValue(options, NSK_AOD_AGENT_NAME_OPTION); jni = (JNIEnv*) nsk_aod_createJNIEnv(vm); - if (jni == NULL) + if (jni == nullptr) return JNI_ERR; jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("attach045-agent01-eventsCounterMonitor", &eventsCounterMonitor))) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent02.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent02.cpp index f2f05136e6d0..f0ce8965cdab 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent02.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent02.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,8 @@ #include #include #include -#include -#include +#include +#include extern "C" { @@ -38,7 +38,7 @@ extern "C" { #define EXPECTED_EVENTS_NUMBER 200 -static Options* options = NULL; +static Options* options = nullptr; static const char* agentName; static jvmtiEvent testEvents[] = { JVMTI_EVENT_THREAD_START, JVMTI_EVENT_THREAD_END }; @@ -129,17 +129,17 @@ Agent_OnAttach(JavaVM *vm, char *optionsString, void *reserved) JNIEnv* jni; options = (Options*) nsk_aod_createOptions(optionsString); - if (!NSK_VERIFY(options != NULL)) + if (!NSK_VERIFY(options != nullptr)) return JNI_ERR; agentName = nsk_aod_getOptionValue(options, NSK_AOD_AGENT_NAME_OPTION); jni = (JNIEnv*) nsk_aod_createJNIEnv(vm); - if (jni == NULL) + if (jni == nullptr) return JNI_ERR; jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("attach045-agent02-eventsCounterMonitor", &eventsCounterMonitor))) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent03.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent03.cpp index 65bd1604681f..3834e868a7bf 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent03.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach045/attach045Agent03.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,8 @@ #include #include #include -#include -#include +#include +#include extern "C" { @@ -37,7 +37,7 @@ extern "C" { #define EXPECTED_EVENTS_NUMBER 500 -static Options* options = NULL; +static Options* options = nullptr; static const char* agentName; static jvmtiEvent testEvents[] = { JVMTI_EVENT_VM_OBJECT_ALLOC }; @@ -119,17 +119,17 @@ Agent_OnAttach(JavaVM *vm, char *optionsString, void *reserved) JNIEnv* jni; options = (Options*) nsk_aod_createOptions(optionsString); - if (!NSK_VERIFY(options != NULL)) + if (!NSK_VERIFY(options != nullptr)) return JNI_ERR; agentName = nsk_aod_getOptionValue(options, NSK_AOD_AGENT_NAME_OPTION); jni = (JNIEnv*) nsk_aod_createJNIEnv(vm); - if (jni == NULL) + if (jni == nullptr) return JNI_ERR; jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("attach045-agent03-eventsCounterMonitor", &eventsCounterMonitor))) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach046/attach046Agent00.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach046/attach046Agent00.cpp index 0c1e03cf5f02..4b5c9e7d56f7 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach046/attach046Agent00.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach046/attach046Agent00.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,8 @@ #include #include #include -#include -#include +#include +#include extern "C" { @@ -52,7 +52,7 @@ void JNICALL classLoadHandler( Options* options; options = nsk_jvmti_aod_getMultiagentsOptions(jvmti); - if (!NSK_VERIFY(options != NULL)) { + if (!NSK_VERIFY(options != nullptr)) { NSK_COMPLAIN0("Failed to get agents's options\n"); nsk_jvmti_aod_disableEvent(jvmti, JVMTI_EVENT_CLASS_LOAD); // can't call nsk_aod_agentFinished because of without options can't get agent's name @@ -96,23 +96,23 @@ Agent_OnAttach(JavaVM *vm, char *optionsString, void *reserved) { jvmtiEventCallbacks eventCallbacks; jvmtiCapabilities caps; - jvmtiEnv* jvmti = NULL; - JNIEnv* jni = NULL; + jvmtiEnv* jvmti = nullptr; + JNIEnv* jni = nullptr; Options* options; const char* agentName; options = (Options*) nsk_aod_createOptions(optionsString); - if (!NSK_VERIFY(options != NULL)) + if (!NSK_VERIFY(options != nullptr)) return JNI_ERR; agentName = nsk_aod_getOptionValue(options, NSK_AOD_AGENT_NAME_OPTION); jni = (JNIEnv*) nsk_aod_createJNIEnv(vm); - if (jni == NULL) + if (jni == nullptr) return NSK_FALSE; jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; memset(&caps, 0, sizeof(caps)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach050/attach050Agent00.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach050/attach050Agent00.cpp index 6a7ceeb4c485..e9cc956557b3 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach050/attach050Agent00.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/attach050/attach050Agent00.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,8 @@ #include #include #include -#include -#include +#include +#include #define ON_UNLOAD_MARKER "attach050.on_unload" @@ -54,22 +54,22 @@ Agent_OnAttach(JavaVM *vm, char *optionsString, void *reserved) #endif { jvmtiEnv* jvmti; - JNIEnv* jni = NULL; - Options* options = NULL; + JNIEnv* jni = nullptr; + Options* options = nullptr; const char* agentName; options = (Options*) nsk_aod_createOptions(optionsString); - if (!NSK_VERIFY(options != NULL)) + if (!NSK_VERIFY(options != nullptr)) return JNI_ERR; agentName = nsk_aod_getOptionValue(options, NSK_AOD_AGENT_NAME_OPTION); jni = (JNIEnv*) nsk_aod_createJNIEnv(vm); - if (jni == NULL) + if (jni == nullptr) return JNI_ERR; jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; NSK_DISPLAY1("%s: initialization was done\n", agentName); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/sharedAgents/simpleAgent00.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/sharedAgents/simpleAgent00.cpp index d24922f2bfe0..0c1fc89de011 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/sharedAgents/simpleAgent00.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/AttachOnDemand/sharedAgents/simpleAgent00.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,8 @@ #include #include #include -#include -#include +#include +#include extern "C" { @@ -50,22 +50,22 @@ Agent_OnAttach(JavaVM *vm, char *optionsString, void *reserved) #endif { jvmtiEnv* jvmti; - JNIEnv* jni = NULL; - Options* options = NULL; + JNIEnv* jni = nullptr; + Options* options = nullptr; const char* agentName; options = (Options*) nsk_aod_createOptions(optionsString); - if (!NSK_VERIFY(options != NULL)) + if (!NSK_VERIFY(options != nullptr)) return JNI_ERR; agentName = nsk_aod_getOptionValue(options, NSK_AOD_AGENT_NAME_OPTION); jni = (JNIEnv*) nsk_aod_createJNIEnv(vm); - if (jni == NULL) + if (jni == nullptr) return JNI_ERR; jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; NSK_DISPLAY1("%s: initialization was done\n", agentName); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk001/classfloadhk001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk001/classfloadhk001.cpp index ef6c10fc9fc4..49faf6b32b6d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk001/classfloadhk001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk001/classfloadhk001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,11 +27,11 @@ #include #include -#include "agent_common.h" +#include "agent_common.hpp" -#include "nsk_tools.h" -#include "JVMTITools.h" -#include "jvmti_tools.h" +#include "nsk_tools.hpp" +#include "JVMTITools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -41,7 +41,7 @@ extern "C" { const char* CLASS_NAME = "nsk/jvmti/ClassFileLoadHook/classfloadhk001"; static jint result = STATUS_FAILED; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; /** callback functions **/ @@ -51,7 +51,7 @@ ClassFileLoadHook(jvmtiEnv *jvmti_env, JNIEnv *env, jclass class_beeing_redefine jint class_data_len, const unsigned char* class_data, jint *new_class_data_len, unsigned char** new_class_data) { - if (name != NULL && (strcmp(name, CLASS_NAME) == 0)) { + if (name != nullptr && (strcmp(name, CLASS_NAME) == 0)) { NSK_DISPLAY1("CHECK PASSED: ClassFileLoadHook event received for the class \"%s\" as expected\n", name); result = PASSED; @@ -87,7 +87,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; NSK_DISPLAY0("setting event callbacks ...\n"); @@ -97,7 +97,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; NSK_DISPLAY0("setting event callbacks done\nenabling ClassFileLoadHook event ...\n"); - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, nullptr))) return JNI_ERR; NSK_DISPLAY0("enabling ClassFileLoadHook event done\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk002/classfloadhk002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk002/classfloadhk002.cpp index 520563f459f0..510eddb4b1d5 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk002/classfloadhk002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk002/classfloadhk002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -41,7 +41,7 @@ static jlong timeout = 0; #define BYTECODE_FIELD_SIG "[B" #define ORIG_BYTECODE_FIELD_NAME "origClassBytes" -static unsigned char* origClassBytes = NULL; +static unsigned char* origClassBytes = nullptr; static jint origClassSize = 0; static volatile int eventsCount = 0; @@ -59,8 +59,8 @@ static int checkBytecode(const char kind[], jint size, const unsigned char bytes nsk_printHexBytes(" ", 16, size, bytes); } - if (bytes == NULL) { - NSK_COMPLAIN2("Unexpected NULL pointer to %s bytecode in CLASS_FILE_LOAD_HOOK: 0x%p\n", + if (bytes == nullptr) { + NSK_COMPLAIN2("Unexpected null pointer to %s bytecode in CLASS_FILE_LOAD_HOOK: 0x%p\n", kind, (void*)bytes); return NSK_FALSE; } @@ -115,14 +115,14 @@ static int getBytecode(jvmtiEnv* jvmti, JNIEnv* jni, jclass cls, const char fieldName[], const char fieldSig[], jint* size, unsigned char* *bytes) { - jfieldID fieldID = NULL; - jbyteArray array = NULL; + jfieldID fieldID = nullptr; + jbyteArray array = nullptr; jbyte* elements; int i; NSK_DISPLAY1("Find static field: %s\n", fieldName); if (!NSK_JNI_VERIFY(jni, (fieldID = - jni->GetStaticFieldID(cls, fieldName, fieldSig)) != NULL)) { + jni->GetStaticFieldID(cls, fieldName, fieldSig)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -130,7 +130,7 @@ static int getBytecode(jvmtiEnv* jvmti, JNIEnv* jni, jclass cls, NSK_DISPLAY1("Get classfile bytes array from static field: %s\n", fieldName); if (!NSK_JNI_VERIFY(jni, (array = (jbyteArray) - jni->GetStaticObjectField(cls, fieldID)) != NULL)) { + jni->GetStaticObjectField(cls, fieldID)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -144,7 +144,7 @@ static int getBytecode(jvmtiEnv* jvmti, JNIEnv* jni, jclass cls, { jboolean isCopy; - if (!NSK_JNI_VERIFY(jni, (elements = jni->GetByteArrayElements(array, &isCopy)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (elements = jni->GetByteArrayElements(array, &isCopy)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -182,11 +182,11 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { { NSK_DISPLAY0(">>> Obtain original bytecode of tested class\n"); { - jclass debugeeClass = NULL; + jclass debugeeClass = nullptr; NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME); if (!NSK_JNI_VERIFY(jni, (debugeeClass = - jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) { + jni->FindClass(DEBUGEE_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -204,7 +204,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { jvmtiEvent event = JVMTI_EVENT_CLASS_FILE_LOAD_HOOK; NSK_DISPLAY1("Enable event: %s\n", "CLASS_FILE_LOAD_HOOK"); - if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, NULL))) + if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, nullptr))) return; NSK_DISPLAY0(" ... event enabled\n"); @@ -216,7 +216,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { return; NSK_DISPLAY1("Disable event: %s\n", "CLASS_FILE_LOAD_HOOK"); - if (NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_DISABLE, 1, &event, NULL))) { + if (NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_DISABLE, 1, &event, nullptr))) { NSK_DISPLAY0(" ... event disabled\n"); } @@ -261,13 +261,13 @@ callbackClassFileLoadHook(jvmtiEnv *jvmti_env, JNIEnv *env, nsk_null_string(name), (void*)loader, (void*)class_being_redefined, (void*)class_data, (int)class_data_len); - if (name != NULL && (strcmp(name, TESTED_CLASS_NAME) == 0)) { + if (name != nullptr && (strcmp(name, TESTED_CLASS_NAME) == 0)) { NSK_DISPLAY1("SUCCESS! CLASS_FILE_LOAD_HOOK for tested class: %s\n", TESTED_CLASS_NAME); eventsCount++; NSK_DISPLAY1("Check class_being_redefined: 0x%p\n", (void*)class_being_redefined); - if (class_being_redefined != NULL) { - NSK_COMPLAIN1("Unexpected not NULL class_being_redefined in CLASS_FILE_LOAD_HOOK: 0x%p\n", + if (class_being_redefined != nullptr) { + NSK_COMPLAIN1("Unexpected not null class_being_redefined in CLASS_FILE_LOAD_HOOK: 0x%p\n", (void*)class_being_redefined); nsk_jvmti_setFailStatus(); } @@ -294,7 +294,7 @@ JNIEXPORT jint JNI_OnLoad_classfloadhk002(JavaVM *jvm, char *options, void *rese } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; /* init framework and parse options */ if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) @@ -304,7 +304,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; NSK_DISPLAY1("Add required capability: %s\n", "can_generate_eraly_class_hook_events"); @@ -333,7 +333,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { NSK_DISPLAY0(" ... set\n"); /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk003/classfloadhk003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk003/classfloadhk003.cpp index b9a113987537..96ca8df0d17a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk003/classfloadhk003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk003/classfloadhk003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -45,9 +45,9 @@ static jlong timeout = 0; #define BYTECODE_FIELD_SIG "[B" #define ORIG_BYTECODE_FIELD_NAME "origClassBytes" -static jobject classLoader = NULL; +static jobject classLoader = nullptr; static jint origClassSize = 0; -static unsigned char* origClassBytes = NULL; +static unsigned char* origClassBytes = nullptr; static volatile int eventsCount = 0; @@ -64,8 +64,8 @@ static int checkBytecode(const char kind[], jint size, const unsigned char bytes nsk_printHexBytes(" ", 16, size, bytes); } - if (bytes == NULL) { - NSK_COMPLAIN2("Unexpected NULL pointer to %s bytecode in CLASS_FILE_LOAD_HOOK: 0x%p\n", + if (bytes == nullptr) { + NSK_COMPLAIN2("Unexpected null pointer to %s bytecode in CLASS_FILE_LOAD_HOOK: 0x%p\n", kind, (void*)bytes); return NSK_FALSE; } @@ -120,14 +120,14 @@ static int getBytecode(jvmtiEnv* jvmti, JNIEnv* jni, jclass cls, const char fieldName[], const char fieldSig[], jint* size, unsigned char* *bytes) { - jfieldID fieldID = NULL; - jbyteArray array = NULL; + jfieldID fieldID = nullptr; + jbyteArray array = nullptr; jbyte* elements; int i; NSK_DISPLAY1("Find static field: %s\n", fieldName); if (!NSK_JNI_VERIFY(jni, (fieldID = - jni->GetStaticFieldID(cls, fieldName, fieldSig)) != NULL)) { + jni->GetStaticFieldID(cls, fieldName, fieldSig)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -135,7 +135,7 @@ static int getBytecode(jvmtiEnv* jvmti, JNIEnv* jni, jclass cls, NSK_DISPLAY1("Get classfile bytes array from static field: %s\n", fieldName); if (!NSK_JNI_VERIFY(jni, (array = (jbyteArray) - jni->GetStaticObjectField(cls, fieldID)) != NULL)) { + jni->GetStaticObjectField(cls, fieldID)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -149,7 +149,7 @@ static int getBytecode(jvmtiEnv* jvmti, JNIEnv* jni, jclass cls, { jboolean isCopy; - if (!NSK_JNI_VERIFY(jni, (elements = jni->GetByteArrayElements(array, &isCopy)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (elements = jni->GetByteArrayElements(array, &isCopy)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -178,28 +178,28 @@ static int getBytecode(jvmtiEnv* jvmti, JNIEnv* jni, jclass cls, static jobject getObject(jvmtiEnv* jvmti, JNIEnv* jni, jclass cls, const char fieldName[], const char fieldSig[]) { - jfieldID fieldID = NULL; - jobject obj = NULL; + jfieldID fieldID = nullptr; + jobject obj = nullptr; NSK_DISPLAY1("Find static field: %s\n", fieldName); if (!NSK_JNI_VERIFY(jni, (fieldID = - jni->GetStaticFieldID(cls, fieldName, fieldSig)) != NULL)) { + jni->GetStaticFieldID(cls, fieldName, fieldSig)) != nullptr)) { nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } NSK_DISPLAY1(" ... got fieldID: 0x%p\n", (void*)fieldID); NSK_DISPLAY1("Get object from static field: %s\n", fieldName); - if (!NSK_JNI_VERIFY(jni, (obj = jni->GetStaticObjectField(cls, fieldID)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (obj = jni->GetStaticObjectField(cls, fieldID)) != nullptr)) { nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } NSK_DISPLAY1(" ... got object: 0x%p\n", (void*)obj); NSK_DISPLAY1("Make global reference to object: 0x%p\n", obj); - if (!NSK_JNI_VERIFY(jni, (obj = jni->NewGlobalRef(obj)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (obj = jni->NewGlobalRef(obj)) != nullptr)) { nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } NSK_DISPLAY1(" ... got global ref: 0x%p\n", (void*)obj); @@ -218,12 +218,12 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { /* perform testing */ { { - jclass debugeeClass = NULL; + jclass debugeeClass = nullptr; NSK_DISPLAY0(">>> Obtain debuggee class\n"); NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME); if (!NSK_JNI_VERIFY(jni, (debugeeClass = - jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) { + jni->FindClass(DEBUGEE_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -232,7 +232,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0(">>> Obtain classloader of tested class\n"); if (!NSK_VERIFY((classLoader = getObject(jvmti, jni, debugeeClass, CLASSLOADER_FIELD_NAME, - TESTED_CLASSLOADER_SIG)) != NULL)) + TESTED_CLASSLOADER_SIG)) != nullptr)) return; NSK_DISPLAY0(">>> Obtain original bytecode of tested class\n"); @@ -248,7 +248,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { jvmtiEvent event = JVMTI_EVENT_CLASS_FILE_LOAD_HOOK; NSK_DISPLAY1("Enable event: %s\n", "CLASS_FILE_LOAD_HOOK"); - if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, NULL))) + if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, nullptr))) return; NSK_DISPLAY0(" ... event enabled\n"); @@ -260,7 +260,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { return; NSK_DISPLAY1("Disable event: %s\n", "CLASS_FILE_LOAD_HOOK"); - if (NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_DISABLE, 1, &event, NULL))) { + if (NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_DISABLE, 1, &event, nullptr))) { NSK_DISPLAY0(" ... event disabled\n"); } @@ -308,20 +308,20 @@ callbackClassFileLoadHook(jvmtiEnv *jvmti, JNIEnv *jni, nsk_null_string(name), (void*)loader, (void*)class_being_redefined, (void*)class_data, (int)class_data_len); - if (name != NULL && (strcmp(name, TESTED_CLASS_NAME) == 0)) { + if (name != nullptr && (strcmp(name, TESTED_CLASS_NAME) == 0)) { NSK_DISPLAY1("SUCCESS! CLASS_FILE_LOAD_HOOK for tested class: %s\n", TESTED_CLASS_NAME); eventsCount++; NSK_DISPLAY1("Check class_being_redefined: 0x%p\n", (void*)class_being_redefined); - if (class_being_redefined != NULL) { - NSK_COMPLAIN1("Unexpected not NULL class_being_redefined in CLASS_FILE_LOAD_HOOK: 0x%p\n", + if (class_being_redefined != nullptr) { + NSK_COMPLAIN1("Unexpected not null class_being_redefined in CLASS_FILE_LOAD_HOOK: 0x%p\n", (void*)class_being_redefined); nsk_jvmti_setFailStatus(); } NSK_DISPLAY1("Check classloader: 0x%p\n", (void*)loader); - if (loader == NULL) { - NSK_COMPLAIN1("Unexpected NULL classloader in CLASS_FILE_LOAD_HOOK: 0x%p\n", + if (loader == nullptr) { + NSK_COMPLAIN1("Unexpected null classloader in CLASS_FILE_LOAD_HOOK: 0x%p\n", (void*)loader); nsk_jvmti_setFailStatus(); } else if (!jni->IsSameObject(loader, classLoader)) { @@ -354,7 +354,7 @@ JNIEXPORT jint JNI_OnLoad_classfloadhk003(JavaVM *jvm, char *options, void *rese } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; /* init framework and parse options */ if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) @@ -364,7 +364,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; NSK_DISPLAY1("Add required capability: %s\n", "can_generate_eraly_class_hook_events"); @@ -393,7 +393,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { NSK_DISPLAY0(" ... set\n"); /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk004/classfloadhk004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk004/classfloadhk004.cpp index 7fe5d9b89d17..1c0152913d0a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk004/classfloadhk004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk004/classfloadhk004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -43,7 +43,7 @@ static jlong timeout = 0; #define NEW_BYTECODE_FIELD_NAME "newClassBytes" static jint newClassSize = 0; -static unsigned char* newClassBytes = NULL; +static unsigned char* newClassBytes = nullptr; static volatile int eventsCount = 0; @@ -54,14 +54,14 @@ static int getBytecode(jvmtiEnv* jvmti, JNIEnv* jni, jclass cls, const char fieldName[], const char fieldSig[], jint* size, unsigned char* *bytes) { - jfieldID fieldID = NULL; - jbyteArray array = NULL; + jfieldID fieldID = nullptr; + jbyteArray array = nullptr; jbyte* elements; int i; NSK_DISPLAY1("Find static field: %s\n", fieldName); if (!NSK_JNI_VERIFY(jni, (fieldID = - jni->GetStaticFieldID(cls, fieldName, fieldSig)) != NULL)) { + jni->GetStaticFieldID(cls, fieldName, fieldSig)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -69,7 +69,7 @@ static int getBytecode(jvmtiEnv* jvmti, JNIEnv* jni, jclass cls, NSK_DISPLAY1("Get classfile bytes array from static field: %s\n", fieldName); if (!NSK_JNI_VERIFY(jni, (array = (jbyteArray) - jni->GetStaticObjectField(cls, fieldID)) != NULL)) { + jni->GetStaticObjectField(cls, fieldID)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -83,7 +83,7 @@ static int getBytecode(jvmtiEnv* jvmti, JNIEnv* jni, jclass cls, { jboolean isCopy; - if (!NSK_JNI_VERIFY(jni, (elements = jni->GetByteArrayElements(array, &isCopy)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (elements = jni->GetByteArrayElements(array, &isCopy)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -121,11 +121,11 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { { NSK_DISPLAY0(">>> Obtain classloader and instrumented bytecode of tested class\n"); { - jclass debugeeClass = NULL; + jclass debugeeClass = nullptr; NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME); if (!NSK_JNI_VERIFY(jni, (debugeeClass = - jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) { + jni->FindClass(DEBUGEE_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -143,7 +143,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { jvmtiEvent event = JVMTI_EVENT_CLASS_FILE_LOAD_HOOK; NSK_DISPLAY1("Enable event: %s\n", "CLASS_FILE_LOAD_HOOK"); - if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, NULL))) + if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, nullptr))) return; NSK_DISPLAY0(" ... event enabled\n"); @@ -155,7 +155,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { return; NSK_DISPLAY1("Disable event: %s\n", "CLASS_FILE_LOAD_HOOK"); - if (NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_DISABLE, 1, &event, NULL))) { + if (NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_DISABLE, 1, &event, nullptr))) { NSK_DISPLAY0(" ... event disabled\n"); } @@ -196,7 +196,7 @@ callbackClassFileLoadHook(jvmtiEnv *jvmti, JNIEnv *jni, nsk_null_string(name), (void*)loader, (void*)class_being_redefined, (void*)class_data, (int)class_data_len); - if (name != NULL && (strcmp(name, TESTED_CLASS_NAME) == 0)) { + if (name != nullptr && (strcmp(name, TESTED_CLASS_NAME) == 0)) { NSK_DISPLAY1("SUCCESS! CLASS_FILE_LOAD_HOOK for tested class: %s\n", TESTED_CLASS_NAME); eventsCount++; @@ -207,20 +207,20 @@ callbackClassFileLoadHook(jvmtiEnv *jvmti, JNIEnv *jni, } NSK_DISPLAY1("Check pointer to new_class_data_len: 0x%p\n", (void*)new_class_data_len); - if (new_class_data_len == NULL) { - NSK_COMPLAIN1("NULL new_class_data_len pointer passed to CLASS_FILE_LOAD_HOOK: 0x%p\n", + if (new_class_data_len == nullptr) { + NSK_COMPLAIN1("null new_class_data_len pointer passed to CLASS_FILE_LOAD_HOOK: 0x%p\n", (void*)new_class_data_len); nsk_jvmti_setFailStatus(); } NSK_DISPLAY1("Check pointer to new_class_data: 0x%p\n", (void*)new_class_data); - if (new_class_data == NULL) { - NSK_COMPLAIN1("NULL new_class_data pointer passed to CLASS_FILE_LOAD_HOOK: 0x%p\n", + if (new_class_data == nullptr) { + NSK_COMPLAIN1("null new_class_data pointer passed to CLASS_FILE_LOAD_HOOK: 0x%p\n", (void*)new_class_data); nsk_jvmti_setFailStatus(); } - if (new_class_data_len != NULL && new_class_data != NULL) { + if (new_class_data_len != nullptr && new_class_data != nullptr) { NSK_DISPLAY2("Replace with new bytecode: 0x%p:%d\n", (void*)newClassBytes, (int)newClassSize); if (nsk_getVerboseMode()) { @@ -248,7 +248,7 @@ JNIEXPORT jint JNI_OnLoad_classfloadhk004(JavaVM *jvm, char *options, void *rese } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; /* init framework and parse options */ if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) @@ -258,7 +258,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; NSK_DISPLAY1("Add required capability: %s\n", "can_generate_eraly_class_hook_events"); @@ -287,7 +287,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { NSK_DISPLAY0(" ... set\n"); /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk005/classfloadhk005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk005/classfloadhk005.cpp index 937d8d4a3e28..81b0a68267ea 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk005/classfloadhk005.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk005/classfloadhk005.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -43,7 +43,7 @@ static jlong timeout = 0; #define NEW_BYTECODE_FIELD_NAME "newClassBytes" static jint newClassSize = 0; -static unsigned char* newClassBytes = NULL; +static unsigned char* newClassBytes = nullptr; static volatile int eventsCount = 0; @@ -60,8 +60,8 @@ static int checkBytecode(const char kind[], jint size, const unsigned char bytes nsk_printHexBytes(" ", 16, size, bytes); } - if (bytes == NULL) { - NSK_COMPLAIN2("Unexpected NULL pointer to %s bytecode in CLASS_FILE_LOAD_HOOK: 0x%p\n", + if (bytes == nullptr) { + NSK_COMPLAIN2("Unexpected null pointer to %s bytecode in CLASS_FILE_LOAD_HOOK: 0x%p\n", kind, (void*)bytes); return NSK_FALSE; } @@ -116,14 +116,14 @@ static int getBytecode(jvmtiEnv* jvmti, JNIEnv* jni, jclass cls, const char fieldName[], const char fieldSig[], jint* size, unsigned char* *bytes) { - jfieldID fieldID = NULL; - jbyteArray array = NULL; + jfieldID fieldID = nullptr; + jbyteArray array = nullptr; jbyte* elements; int i; NSK_DISPLAY1("Find static field: %s\n", fieldName); if (!NSK_JNI_VERIFY(jni, (fieldID = - jni->GetStaticFieldID(cls, fieldName, fieldSig)) != NULL)) { + jni->GetStaticFieldID(cls, fieldName, fieldSig)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -131,7 +131,7 @@ static int getBytecode(jvmtiEnv* jvmti, JNIEnv* jni, jclass cls, NSK_DISPLAY1("Get classfile bytes array from static field: %s\n", fieldName); if (!NSK_JNI_VERIFY(jni, (array = (jbyteArray) - jni->GetStaticObjectField(cls, fieldID)) != NULL)) { + jni->GetStaticObjectField(cls, fieldID)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -145,7 +145,7 @@ static int getBytecode(jvmtiEnv* jvmti, JNIEnv* jni, jclass cls, { jboolean isCopy; - if (!NSK_JNI_VERIFY(jni, (elements = jni->GetByteArrayElements(array, &isCopy)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (elements = jni->GetByteArrayElements(array, &isCopy)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -183,11 +183,11 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { { NSK_DISPLAY0(">>> Obtain classloader and instrumented bytecode of tested class\n"); { - jclass debugeeClass = NULL; + jclass debugeeClass = nullptr; NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME); if (!NSK_JNI_VERIFY(jni, (debugeeClass = - jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) { + jni->FindClass(DEBUGEE_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -205,7 +205,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { jvmtiEvent event = JVMTI_EVENT_CLASS_FILE_LOAD_HOOK; NSK_DISPLAY1("Enable event: %s\n", "CLASS_FILE_LOAD_HOOK"); - if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, NULL))) + if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, nullptr))) return; NSK_DISPLAY0(" ... event enabled\n"); @@ -217,7 +217,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { return; NSK_DISPLAY1("Disable event: %s\n", "CLASS_FILE_LOAD_HOOK"); - if (NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_DISABLE, 1, &event, NULL))) { + if (NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_DISABLE, 1, &event, nullptr))) { NSK_DISPLAY0(" ... event disabled\n"); } @@ -258,7 +258,7 @@ callbackClassFileLoadHook(jvmtiEnv *jvmti, JNIEnv *jni, nsk_null_string(name), (void*)loader, (void*)class_being_redefined, (void*)class_data, (int)class_data_len); - if (name != NULL && (strcmp(name, TESTED_CLASS_NAME) == 0)) { + if (name != nullptr && (strcmp(name, TESTED_CLASS_NAME) == 0)) { NSK_DISPLAY1("SUCCESS! CLASS_FILE_LOAD_HOOK for tested class: %s\n", TESTED_CLASS_NAME); eventsCount++; @@ -269,20 +269,20 @@ callbackClassFileLoadHook(jvmtiEnv *jvmti, JNIEnv *jni, } NSK_DISPLAY1("Check pointer to new_class_data_len: 0x%p\n", (void*)new_class_data_len); - if (new_class_data_len == NULL) { - NSK_COMPLAIN1("NULL new_class_data_len pointer passed to CLASS_FILE_LOAD_HOOK: 0x%p\n", + if (new_class_data_len == nullptr) { + NSK_COMPLAIN1("null new_class_data_len pointer passed to CLASS_FILE_LOAD_HOOK: 0x%p\n", (void*)new_class_data_len); nsk_jvmti_setFailStatus(); } NSK_DISPLAY1("Check pointer to new_class_data: 0x%p\n", (void*)new_class_data); - if (new_class_data == NULL) { - NSK_COMPLAIN1("NULL new_class_data pointer passed to CLASS_FILE_LOAD_HOOK: 0x%p\n", + if (new_class_data == nullptr) { + NSK_COMPLAIN1("null new_class_data pointer passed to CLASS_FILE_LOAD_HOOK: 0x%p\n", (void*)new_class_data); nsk_jvmti_setFailStatus(); } - if (new_class_data_len != NULL && new_class_data != NULL) { + if (new_class_data_len != nullptr && new_class_data != nullptr) { NSK_DISPLAY2("Replace with instrumented bytecode: 0x%p:%d\n", (void*)newClassBytes, (int)newClassSize); if (nsk_getVerboseMode()) { @@ -310,7 +310,7 @@ JNIEXPORT jint JNI_OnLoad_classfloadhk005(JavaVM *jvm, char *options, void *rese } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; /* init framework and parse options */ if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) @@ -320,7 +320,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; NSK_DISPLAY1("Add required capability: %s\n", "can_generate_eraly_class_hook_events"); @@ -349,7 +349,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { NSK_DISPLAY0(" ... set\n"); /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk006/classfloadhk006.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk006/classfloadhk006.cpp index 41d48e5a484e..2870eec7f499 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk006/classfloadhk006.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk006/classfloadhk006.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -45,10 +45,10 @@ static jlong timeout = 0; #define TESTED_CLASS_FIELD_NAME "testedClass" #define TESTED_CLASS_FIELD_SIG "Ljava/lang/Class;" -static jclass testedClass = NULL; +static jclass testedClass = nullptr; static jint redefClassSize = 0; -static unsigned char* redefClassBytes = NULL; +static unsigned char* redefClassBytes = nullptr; static volatile int eventsCount = 0; @@ -65,8 +65,8 @@ static int checkBytecode(const char kind[], jint size, const unsigned char bytes nsk_printHexBytes(" ", 16, size, bytes); } - if (bytes == NULL) { - NSK_COMPLAIN2("Unexpected NULL pointer to %s bytecode in CLASS_FILE_LOAD_HOOK: 0x%p\n", + if (bytes == nullptr) { + NSK_COMPLAIN2("Unexpected null pointer to %s bytecode in CLASS_FILE_LOAD_HOOK: 0x%p\n", kind, (void*)bytes); return NSK_FALSE; } @@ -121,14 +121,14 @@ static int getBytecode(jvmtiEnv* jvmti, JNIEnv* jni, jclass cls, const char fieldName[], const char fieldSig[], jint* size, unsigned char* *bytes) { - jfieldID fieldID = NULL; - jbyteArray array = NULL; + jfieldID fieldID = nullptr; + jbyteArray array = nullptr; jbyte* elements; int i; NSK_DISPLAY1("Find static field: %s\n", fieldName); if (!NSK_JNI_VERIFY(jni, (fieldID = - jni->GetStaticFieldID(cls, fieldName, fieldSig)) != NULL)) { + jni->GetStaticFieldID(cls, fieldName, fieldSig)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -136,7 +136,7 @@ static int getBytecode(jvmtiEnv* jvmti, JNIEnv* jni, jclass cls, NSK_DISPLAY1("Get classfile bytes array from static field: %s\n", fieldName); if (!NSK_JNI_VERIFY(jni, (array = (jbyteArray) - jni->GetStaticObjectField(cls, fieldID)) != NULL)) { + jni->GetStaticObjectField(cls, fieldID)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -150,7 +150,7 @@ static int getBytecode(jvmtiEnv* jvmti, JNIEnv* jni, jclass cls, { jboolean isCopy; - if (!NSK_JNI_VERIFY(jni, (elements = jni->GetByteArrayElements(array, &isCopy)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (elements = jni->GetByteArrayElements(array, &isCopy)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -179,28 +179,28 @@ static int getBytecode(jvmtiEnv* jvmti, JNIEnv* jni, jclass cls, static jobject getObject(jvmtiEnv* jvmti, JNIEnv* jni, jclass cls, const char fieldName[], const char fieldSig[]) { - jfieldID fieldID = NULL; - jobject obj = NULL; + jfieldID fieldID = nullptr; + jobject obj = nullptr; NSK_DISPLAY1("Find static field: %s\n", fieldName); if (!NSK_JNI_VERIFY(jni, (fieldID = - jni->GetStaticFieldID(cls, fieldName, fieldSig)) != NULL)) { + jni->GetStaticFieldID(cls, fieldName, fieldSig)) != nullptr)) { nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } NSK_DISPLAY1(" ... got fieldID: 0x%p\n", (void*)fieldID); NSK_DISPLAY1("Get object from static field: %s\n", fieldName); - if (!NSK_JNI_VERIFY(jni, (obj = jni->GetStaticObjectField(cls, fieldID)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (obj = jni->GetStaticObjectField(cls, fieldID)) != nullptr)) { nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } NSK_DISPLAY1(" ... got object: 0x%p\n", (void*)obj); NSK_DISPLAY1("Make global reference to object: 0x%p\n", obj); - if (!NSK_JNI_VERIFY(jni, (obj = jni->NewGlobalRef(obj)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (obj = jni->NewGlobalRef(obj)) != nullptr)) { nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } NSK_DISPLAY1(" ... got global ref: 0x%p\n", (void*)obj); @@ -238,12 +238,12 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { /* perform testing */ { { - jclass debugeeClass = NULL; + jclass debugeeClass = nullptr; NSK_DISPLAY0(">>> Obtain debuggee class\n"); NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME); if (!NSK_JNI_VERIFY(jni, (debugeeClass = - jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) { + jni->FindClass(DEBUGEE_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -252,7 +252,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0(">>> Obtain tested class object\n"); if (!NSK_VERIFY((testedClass = (jclass) getObject(jvmti, jni, debugeeClass, TESTED_CLASS_FIELD_NAME, - TESTED_CLASS_FIELD_SIG)) != NULL)) + TESTED_CLASS_FIELD_SIG)) != nullptr)) return; NSK_DISPLAY0(">>> Obtain redefined bytecode of tested class\n"); @@ -275,7 +275,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { jvmtiEvent event = JVMTI_EVENT_CLASS_FILE_LOAD_HOOK; NSK_DISPLAY1("Enable event: %s\n", "CLASS_FILE_LOAD_HOOK"); - if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, NULL))) + if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, nullptr))) return; NSK_DISPLAY0(" ... event enabled\n"); @@ -283,7 +283,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { redefClassSize, redefClassBytes)); NSK_DISPLAY1("Disable event: %s\n", "CLASS_FILE_LOAD_HOOK"); - if (NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_DISABLE, 1, &event, NULL))) { + if (NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_DISABLE, 1, &event, nullptr))) { NSK_DISPLAY0(" ... event disabled\n"); } @@ -330,13 +330,13 @@ callbackClassFileLoadHook(jvmtiEnv *jvmti, JNIEnv *jni, nsk_null_string(name), (void*)loader, (void*)class_being_redefined, (void*)class_data, (int)class_data_len); - if (name != NULL && (strcmp(name, TESTED_CLASS_NAME) == 0)) { + if (name != nullptr && (strcmp(name, TESTED_CLASS_NAME) == 0)) { NSK_DISPLAY1("SUCCESS! CLASS_FILE_LOAD_HOOK for tested class: %s\n", TESTED_CLASS_NAME); eventsCount++; NSK_DISPLAY1("Check class_being_redefined: 0x%p\n", (void*)class_being_redefined); - if (class_being_redefined == NULL) { - NSK_COMPLAIN1("Unexpected NULL class_being_redefined in CLASS_FILE_LOAD_HOOK: 0x%p\n", + if (class_being_redefined == nullptr) { + NSK_COMPLAIN1("Unexpected null class_being_redefined in CLASS_FILE_LOAD_HOOK: 0x%p\n", (void*)class_being_redefined); nsk_jvmti_setFailStatus(); } else if (!jni->IsSameObject(class_being_redefined, testedClass)) { @@ -369,7 +369,7 @@ JNIEXPORT jint JNI_OnLoad_classfloadhk006(JavaVM *jvm, char *options, void *rese } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; /* init framework and parse options */ if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) @@ -379,7 +379,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; NSK_DISPLAY1("Add required capabilities: %s\n", "can_generate_eraly_class_hook_events, can_redefine_classes"); @@ -409,7 +409,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { NSK_DISPLAY0(" ... set\n"); /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk007/classfloadhk007.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk007/classfloadhk007.cpp index 8c1f686361af..9d2a20d3eb71 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk007/classfloadhk007.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk007/classfloadhk007.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -48,11 +48,11 @@ static jlong timeout = 0; #define TESTED_CLASS_FIELD_NAME "testedClass" #define TESTED_CLASS_FIELD_SIG "Ljava/lang/Class;" -static jobject classLoader = NULL; -static jclass testedClass = NULL; +static jobject classLoader = nullptr; +static jclass testedClass = nullptr; static jint redefClassSize = 0; -static unsigned char* redefClassBytes = NULL; +static unsigned char* redefClassBytes = nullptr; static volatile int eventsCount = 0; @@ -69,8 +69,8 @@ static int checkBytecode(const char kind[], jint size, const unsigned char bytes nsk_printHexBytes(" ", 16, size, bytes); } - if (bytes == NULL) { - NSK_COMPLAIN2("Unexpected NULL pointer to %s bytecode in CLASS_FILE_LOAD_HOOK: 0x%p\n", + if (bytes == nullptr) { + NSK_COMPLAIN2("Unexpected null pointer to %s bytecode in CLASS_FILE_LOAD_HOOK: 0x%p\n", kind, (void*)bytes); return NSK_FALSE; } @@ -125,14 +125,14 @@ static int getBytecode(jvmtiEnv* jvmti, JNIEnv* jni, jclass cls, const char fieldName[], const char fieldSig[], jint* size, unsigned char* *bytes) { - jfieldID fieldID = NULL; - jbyteArray array = NULL; + jfieldID fieldID = nullptr; + jbyteArray array = nullptr; jbyte* elements; int i; NSK_DISPLAY1("Find static field: %s\n", fieldName); if (!NSK_JNI_VERIFY(jni, (fieldID = - jni->GetStaticFieldID(cls, fieldName, fieldSig)) != NULL)) { + jni->GetStaticFieldID(cls, fieldName, fieldSig)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -140,7 +140,7 @@ static int getBytecode(jvmtiEnv* jvmti, JNIEnv* jni, jclass cls, NSK_DISPLAY1("Get classfile bytes array from static field: %s\n", fieldName); if (!NSK_JNI_VERIFY(jni, (array = (jbyteArray) - jni->GetStaticObjectField(cls, fieldID)) != NULL)) { + jni->GetStaticObjectField(cls, fieldID)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -154,7 +154,7 @@ static int getBytecode(jvmtiEnv* jvmti, JNIEnv* jni, jclass cls, { jboolean isCopy; - if (!NSK_JNI_VERIFY(jni, (elements = jni->GetByteArrayElements(array, &isCopy)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (elements = jni->GetByteArrayElements(array, &isCopy)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -183,28 +183,28 @@ static int getBytecode(jvmtiEnv* jvmti, JNIEnv* jni, jclass cls, static jobject getObject(jvmtiEnv* jvmti, JNIEnv* jni, jclass cls, const char fieldName[], const char fieldSig[]) { - jfieldID fieldID = NULL; - jobject obj = NULL; + jfieldID fieldID = nullptr; + jobject obj = nullptr; NSK_DISPLAY1("Find static field: %s\n", fieldName); if (!NSK_JNI_VERIFY(jni, (fieldID = - jni->GetStaticFieldID(cls, fieldName, fieldSig)) != NULL)) { + jni->GetStaticFieldID(cls, fieldName, fieldSig)) != nullptr)) { nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } NSK_DISPLAY1(" ... got fieldID: 0x%p\n", (void*)fieldID); NSK_DISPLAY1("Get object from static field: %s\n", fieldName); - if (!NSK_JNI_VERIFY(jni, (obj = jni->GetStaticObjectField(cls, fieldID)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (obj = jni->GetStaticObjectField(cls, fieldID)) != nullptr)) { nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } NSK_DISPLAY1(" ... got object: 0x%p\n", (void*)obj); NSK_DISPLAY1("Make global reference to object: 0x%p\n", obj); - if (!NSK_JNI_VERIFY(jni, (obj = jni->NewGlobalRef(obj)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (obj = jni->NewGlobalRef(obj)) != nullptr)) { nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } NSK_DISPLAY1(" ... got global ref: 0x%p\n", (void*)obj); @@ -242,12 +242,12 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { /* perform testing */ { { - jclass debugeeClass = NULL; + jclass debugeeClass = nullptr; NSK_DISPLAY0(">>> Obtain debuggee class\n"); NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME); if (!NSK_JNI_VERIFY(jni, (debugeeClass = - jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) { + jni->FindClass(DEBUGEE_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -256,13 +256,13 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0(">>> Obtain tested class object\n"); if (!NSK_VERIFY((testedClass = (jclass) getObject(jvmti, jni, debugeeClass, TESTED_CLASS_FIELD_NAME, - TESTED_CLASS_FIELD_SIG)) != NULL)) + TESTED_CLASS_FIELD_SIG)) != nullptr)) return; NSK_DISPLAY0(">>> Obtain classloader object\n"); if (!NSK_VERIFY((classLoader = getObject(jvmti, jni, debugeeClass, CLASSLOADER_FIELD_NAME, - TESTED_CLASSLOADER_SIG)) != NULL)) + TESTED_CLASSLOADER_SIG)) != nullptr)) return; NSK_DISPLAY0(">>> Obtain redefined bytecode of tested class\n"); @@ -285,7 +285,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { jvmtiEvent event = JVMTI_EVENT_CLASS_FILE_LOAD_HOOK; NSK_DISPLAY1("Enable event: %s\n", "CLASS_FILE_LOAD_HOOK"); - if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, NULL))) + if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, nullptr))) return; NSK_DISPLAY0(" ... event enabled\n"); @@ -293,7 +293,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { redefClassSize, redefClassBytes)); NSK_DISPLAY1("Disable event: %s\n", "CLASS_FILE_LOAD_HOOK"); - if (NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_DISABLE, 1, &event, NULL))) { + if (NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_DISABLE, 1, &event, nullptr))) { NSK_DISPLAY0(" ... event disabled\n"); } @@ -343,13 +343,13 @@ callbackClassFileLoadHook(jvmtiEnv *jvmti, JNIEnv *jni, nsk_null_string(name), (void*)loader, (void*)class_being_redefined, (void*)class_data, (int)class_data_len); - if (name != NULL && (strcmp(name, TESTED_CLASS_NAME) == 0)) { + if (name != nullptr && (strcmp(name, TESTED_CLASS_NAME) == 0)) { NSK_DISPLAY1("SUCCESS! CLASS_FILE_LOAD_HOOK for tested class: %s\n", TESTED_CLASS_NAME); eventsCount++; NSK_DISPLAY1("Check classloader: 0x%p\n", (void*)loader); - if (loader == NULL) { - NSK_COMPLAIN1("Unexpected NULL classloader in CLASS_FILE_LOAD_HOOK: 0x%p\n", + if (loader == nullptr) { + NSK_COMPLAIN1("Unexpected null classloader in CLASS_FILE_LOAD_HOOK: 0x%p\n", (void*)loader); nsk_jvmti_setFailStatus(); } else if (!jni->IsSameObject(loader, classLoader)) { @@ -361,8 +361,8 @@ callbackClassFileLoadHook(jvmtiEnv *jvmti, JNIEnv *jni, } NSK_DISPLAY1("Check class_being_redefined: 0x%p\n", (void*)class_being_redefined); - if (class_being_redefined == NULL) { - NSK_COMPLAIN1("Unexpected NULL class_being_redefined in CLASS_FILE_LOAD_HOOK: 0x%p\n", + if (class_being_redefined == nullptr) { + NSK_COMPLAIN1("Unexpected null class_being_redefined in CLASS_FILE_LOAD_HOOK: 0x%p\n", (void*)class_being_redefined); nsk_jvmti_setFailStatus(); } else if (!jni->IsSameObject(class_being_redefined, testedClass)) { @@ -395,7 +395,7 @@ JNIEXPORT jint JNI_OnLoad_classfloadhk007(JavaVM *jvm, char *options, void *rese } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; /* init framework and parse options */ if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) @@ -405,7 +405,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; NSK_DISPLAY1("Add required capabilities: %s\n", "can_generate_eraly_class_hook_events, can_redefine_classes"); @@ -435,7 +435,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { NSK_DISPLAY0(" ... set\n"); /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk008/classfloadhk008.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk008/classfloadhk008.cpp index 7f18912194d8..fd0de631d3b6 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk008/classfloadhk008.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk008/classfloadhk008.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -46,13 +46,13 @@ static jlong timeout = 0; #define TESTED_CLASS_FIELD_NAME "testedClass" #define TESTED_CLASS_FIELD_SIG "Ljava/lang/Class;" -static jclass testedClass = NULL; +static jclass testedClass = nullptr; static jint redefClassSize = 0; -static unsigned char* redefClassBytes = NULL; +static unsigned char* redefClassBytes = nullptr; static jint newClassSize = 0; -static unsigned char* newClassBytes = NULL; +static unsigned char* newClassBytes = nullptr; static volatile int eventsCount = 0; @@ -63,14 +63,14 @@ static int getBytecode(jvmtiEnv* jvmti, JNIEnv* jni, jclass cls, const char fieldName[], const char fieldSig[], jint* size, unsigned char* *bytes) { - jfieldID fieldID = NULL; - jbyteArray array = NULL; + jfieldID fieldID = nullptr; + jbyteArray array = nullptr; jbyte* elements; int i; NSK_DISPLAY1("Find static field: %s\n", fieldName); if (!NSK_JNI_VERIFY(jni, (fieldID = - jni->GetStaticFieldID(cls, fieldName, fieldSig)) != NULL)) { + jni->GetStaticFieldID(cls, fieldName, fieldSig)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -78,7 +78,7 @@ static int getBytecode(jvmtiEnv* jvmti, JNIEnv* jni, jclass cls, NSK_DISPLAY1("Get classfile bytes array from static field: %s\n", fieldName); if (!NSK_JNI_VERIFY(jni, (array = (jbyteArray) - jni->GetStaticObjectField(cls, fieldID)) != NULL)) { + jni->GetStaticObjectField(cls, fieldID)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -92,7 +92,7 @@ static int getBytecode(jvmtiEnv* jvmti, JNIEnv* jni, jclass cls, { jboolean isCopy; - if (!NSK_JNI_VERIFY(jni, (elements = jni->GetByteArrayElements(array, &isCopy)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (elements = jni->GetByteArrayElements(array, &isCopy)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -121,28 +121,28 @@ static int getBytecode(jvmtiEnv* jvmti, JNIEnv* jni, jclass cls, static jobject getObject(jvmtiEnv* jvmti, JNIEnv* jni, jclass cls, const char fieldName[], const char fieldSig[]) { - jfieldID fieldID = NULL; - jobject obj = NULL; + jfieldID fieldID = nullptr; + jobject obj = nullptr; NSK_DISPLAY1("Find static field: %s\n", fieldName); if (!NSK_JNI_VERIFY(jni, (fieldID = - jni->GetStaticFieldID(cls, fieldName, fieldSig)) != NULL)) { + jni->GetStaticFieldID(cls, fieldName, fieldSig)) != nullptr)) { nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } NSK_DISPLAY1(" ... got fieldID: 0x%p\n", (void*)fieldID); NSK_DISPLAY1("Get object from static field: %s\n", fieldName); - if (!NSK_JNI_VERIFY(jni, (obj = jni->GetStaticObjectField(cls, fieldID)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (obj = jni->GetStaticObjectField(cls, fieldID)) != nullptr)) { nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } NSK_DISPLAY1(" ... got object: 0x%p\n", (void*)obj); NSK_DISPLAY1("Make global reference to object: 0x%p\n", obj); - if (!NSK_JNI_VERIFY(jni, (obj = jni->NewGlobalRef(obj)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (obj = jni->NewGlobalRef(obj)) != nullptr)) { nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } NSK_DISPLAY1(" ... got global ref: 0x%p\n", (void*)obj); @@ -180,12 +180,12 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { /* perform testing */ { { - jclass debugeeClass = NULL; + jclass debugeeClass = nullptr; NSK_DISPLAY0(">>> Obtain debuggee class\n"); NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME); if (!NSK_JNI_VERIFY(jni, (debugeeClass = - jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) { + jni->FindClass(DEBUGEE_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -194,7 +194,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0(">>> Obtain tested class object\n"); if (!NSK_VERIFY((testedClass = (jclass) getObject(jvmti, jni, debugeeClass, TESTED_CLASS_FIELD_NAME, - TESTED_CLASS_FIELD_SIG)) != NULL)) + TESTED_CLASS_FIELD_SIG)) != nullptr)) return; NSK_DISPLAY0(">>> Obtain redefined bytecode of tested class\n"); @@ -224,7 +224,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { jvmtiEvent event = JVMTI_EVENT_CLASS_FILE_LOAD_HOOK; NSK_DISPLAY1("Enable event: %s\n", "CLASS_FILE_LOAD_HOOK"); - if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, NULL))) + if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, nullptr))) return; NSK_DISPLAY0(" ... event enabled\n"); @@ -232,7 +232,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { redefClassSize, redefClassBytes)); NSK_DISPLAY1("Disable event: %s\n", "CLASS_FILE_LOAD_HOOK"); - if (NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_DISABLE, 1, &event, NULL))) { + if (NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_DISABLE, 1, &event, nullptr))) { NSK_DISPLAY0(" ... event disabled\n"); } @@ -279,7 +279,7 @@ callbackClassFileLoadHook(jvmtiEnv *jvmti, JNIEnv *jni, nsk_null_string(name), (void*)loader, (void*)class_being_redefined, (void*)class_data, (int)class_data_len); - if (name != NULL && (strcmp(name, TESTED_CLASS_NAME) == 0)) { + if (name != nullptr && (strcmp(name, TESTED_CLASS_NAME) == 0)) { NSK_DISPLAY1("SUCCESS! CLASS_FILE_LOAD_HOOK for tested class: %s\n", TESTED_CLASS_NAME); eventsCount++; @@ -290,20 +290,20 @@ callbackClassFileLoadHook(jvmtiEnv *jvmti, JNIEnv *jni, } NSK_DISPLAY1("Check pointer to new_class_data_len: 0x%p\n", (void*)new_class_data_len); - if (new_class_data_len == NULL) { - NSK_COMPLAIN1("NULL new_class_data_len pointer passed to CLASS_FILE_LOAD_HOOK: 0x%p\n", + if (new_class_data_len == nullptr) { + NSK_COMPLAIN1("null new_class_data_len pointer passed to CLASS_FILE_LOAD_HOOK: 0x%p\n", (void*)new_class_data_len); nsk_jvmti_setFailStatus(); } NSK_DISPLAY1("Check pointer to new_class_data: 0x%p\n", (void*)new_class_data); - if (new_class_data == NULL) { - NSK_COMPLAIN1("NULL new_class_data pointer passed to CLASS_FILE_LOAD_HOOK: 0x%p\n", + if (new_class_data == nullptr) { + NSK_COMPLAIN1("null new_class_data pointer passed to CLASS_FILE_LOAD_HOOK: 0x%p\n", (void*)new_class_data); nsk_jvmti_setFailStatus(); } - if (new_class_data_len != NULL && new_class_data != NULL) { + if (new_class_data_len != nullptr && new_class_data != nullptr) { NSK_DISPLAY2("Replace with new instrumented bytecode: 0x%p:%d\n", (void*)newClassBytes, (int)newClassSize); if (nsk_getVerboseMode()) { @@ -331,7 +331,7 @@ JNIEXPORT jint JNI_OnLoad_classfloadhk008(JavaVM *jvm, char *options, void *rese } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; /* init framework and parse options */ if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) @@ -341,7 +341,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; NSK_DISPLAY1("Add required capabilities: %s\n", "can_generate_eraly_class_hook_events, can_redefine_classes"); @@ -371,7 +371,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { NSK_DISPLAY0(" ... set\n"); /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk009/classfloadhk009.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk009/classfloadhk009.cpp index e4a2067772c2..4115a078c3a1 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk009/classfloadhk009.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClassFileLoadHook/classfloadhk009/classfloadhk009.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -46,13 +46,13 @@ static jlong timeout = 0; #define TESTED_CLASS_FIELD_NAME "testedClass" #define TESTED_CLASS_FIELD_SIG "Ljava/lang/Class;" -static jclass testedClass = NULL; +static jclass testedClass = nullptr; static jint redefClassSize = 0; -static unsigned char* redefClassBytes = NULL; +static unsigned char* redefClassBytes = nullptr; static jint newClassSize = 0; -static unsigned char* newClassBytes = NULL; +static unsigned char* newClassBytes = nullptr; static volatile int eventsCount = 0; @@ -63,14 +63,14 @@ static int getBytecode(jvmtiEnv* jvmti, JNIEnv* jni, jclass cls, const char fieldName[], const char fieldSig[], jint* size, unsigned char* *bytes) { - jfieldID fieldID = NULL; - jbyteArray array = NULL; + jfieldID fieldID = nullptr; + jbyteArray array = nullptr; jbyte* elements; int i; NSK_DISPLAY1("Find static field: %s\n", fieldName); if (!NSK_JNI_VERIFY(jni, (fieldID = - jni->GetStaticFieldID(cls, fieldName, fieldSig)) != NULL)) { + jni->GetStaticFieldID(cls, fieldName, fieldSig)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -78,7 +78,7 @@ static int getBytecode(jvmtiEnv* jvmti, JNIEnv* jni, jclass cls, NSK_DISPLAY1("Get classfile bytes array from static field: %s\n", fieldName); if (!NSK_JNI_VERIFY(jni, (array = (jbyteArray) - jni->GetStaticObjectField(cls, fieldID)) != NULL)) { + jni->GetStaticObjectField(cls, fieldID)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -92,7 +92,7 @@ static int getBytecode(jvmtiEnv* jvmti, JNIEnv* jni, jclass cls, { jboolean isCopy; - if (!NSK_JNI_VERIFY(jni, (elements = jni->GetByteArrayElements(array, &isCopy)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (elements = jni->GetByteArrayElements(array, &isCopy)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -121,28 +121,28 @@ static int getBytecode(jvmtiEnv* jvmti, JNIEnv* jni, jclass cls, static jobject getObject(jvmtiEnv* jvmti, JNIEnv* jni, jclass cls, const char fieldName[], const char fieldSig[]) { - jfieldID fieldID = NULL; - jobject obj = NULL; + jfieldID fieldID = nullptr; + jobject obj = nullptr; NSK_DISPLAY1("Find static field: %s\n", fieldName); if (!NSK_JNI_VERIFY(jni, (fieldID = - jni->GetStaticFieldID(cls, fieldName, fieldSig)) != NULL)) { + jni->GetStaticFieldID(cls, fieldName, fieldSig)) != nullptr)) { nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } NSK_DISPLAY1(" ... got fieldID: 0x%p\n", (void*)fieldID); NSK_DISPLAY1("Get object from static field: %s\n", fieldName); - if (!NSK_JNI_VERIFY(jni, (obj = jni->GetStaticObjectField(cls, fieldID)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (obj = jni->GetStaticObjectField(cls, fieldID)) != nullptr)) { nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } NSK_DISPLAY1(" ... got object: 0x%p\n", (void*)obj); NSK_DISPLAY1("Make global reference to object: 0x%p\n", obj); - if (!NSK_JNI_VERIFY(jni, (obj = jni->NewGlobalRef(obj)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (obj = jni->NewGlobalRef(obj)) != nullptr)) { nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } NSK_DISPLAY1(" ... got global ref: 0x%p\n", (void*)obj); @@ -180,12 +180,12 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { /* perform testing */ { { - jclass debugeeClass = NULL; + jclass debugeeClass = nullptr; NSK_DISPLAY0(">>> Obtain debuggee class\n"); NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME); if (!NSK_JNI_VERIFY(jni, (debugeeClass = - jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) { + jni->FindClass(DEBUGEE_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -194,7 +194,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0(">>> Obtain tested class object\n"); if (!NSK_VERIFY((testedClass = (jclass) getObject(jvmti, jni, debugeeClass, TESTED_CLASS_FIELD_NAME, - TESTED_CLASS_FIELD_SIG)) != NULL)) + TESTED_CLASS_FIELD_SIG)) != nullptr)) return; NSK_DISPLAY0(">>> Obtain redefined bytecode of tested class\n"); @@ -224,7 +224,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { jvmtiEvent event = JVMTI_EVENT_CLASS_FILE_LOAD_HOOK; NSK_DISPLAY1("Enable event: %s\n", "CLASS_FILE_LOAD_HOOK"); - if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, NULL))) + if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, nullptr))) return; NSK_DISPLAY0(" ... event enabled\n"); @@ -232,7 +232,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { redefClassSize, redefClassBytes)); NSK_DISPLAY1("Disable event: %s\n", "CLASS_FILE_LOAD_HOOK"); - if (NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_DISABLE, 1, &event, NULL))) { + if (NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_DISABLE, 1, &event, nullptr))) { NSK_DISPLAY0(" ... event disabled\n"); } @@ -279,7 +279,7 @@ callbackClassFileLoadHook(jvmtiEnv *jvmti, JNIEnv *jni, nsk_null_string(name), (void*)loader, (void*)class_being_redefined, (void*)class_data, (int)class_data_len); - if (name != NULL && (strcmp(name, TESTED_CLASS_NAME) == 0)) { + if (name != nullptr && (strcmp(name, TESTED_CLASS_NAME) == 0)) { NSK_DISPLAY1("SUCCESS! CLASS_FILE_LOAD_HOOK for tested class: %s\n", TESTED_CLASS_NAME); eventsCount++; @@ -290,20 +290,20 @@ callbackClassFileLoadHook(jvmtiEnv *jvmti, JNIEnv *jni, } NSK_DISPLAY1("Check pointer to new_class_data_len: 0x%p\n", (void*)new_class_data_len); - if (new_class_data_len == NULL) { - NSK_COMPLAIN1("NULL new_class_data_len pointer passed to CLASS_FILE_LOAD_HOOK: 0x%p\n", + if (new_class_data_len == nullptr) { + NSK_COMPLAIN1("null new_class_data_len pointer passed to CLASS_FILE_LOAD_HOOK: 0x%p\n", (void*)new_class_data_len); nsk_jvmti_setFailStatus(); } NSK_DISPLAY1("Check pointer to new_class_data: 0x%p\n", (void*)new_class_data); - if (new_class_data == NULL) { - NSK_COMPLAIN1("NULL new_class_data pointer passed to CLASS_FILE_LOAD_HOOK: 0x%p\n", + if (new_class_data == nullptr) { + NSK_COMPLAIN1("null new_class_data pointer passed to CLASS_FILE_LOAD_HOOK: 0x%p\n", (void*)new_class_data); nsk_jvmti_setFailStatus(); } - if (new_class_data_len != NULL && new_class_data != NULL) { + if (new_class_data_len != nullptr && new_class_data != nullptr) { NSK_DISPLAY2("Replace with new instrumented bytecode: 0x%p:%d\n", (void*)newClassBytes, (int)newClassSize); if (nsk_getVerboseMode()) { @@ -331,7 +331,7 @@ JNIEXPORT jint JNI_OnLoad_classfloadhk009(JavaVM *jvm, char *options, void *rese } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; /* init framework and parse options */ if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) @@ -341,7 +341,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; NSK_DISPLAY1("Add required capabilities: %s\n", "can_generate_eraly_class_hook_events, can_redefine_classes"); @@ -371,7 +371,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { NSK_DISPLAY0(" ... set\n"); /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearBreakpoint/clrbrk001/clrbrk001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearBreakpoint/clrbrk001/clrbrk001.cpp index 07540af5bf0d..21328b3be6d2 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearBreakpoint/clrbrk001/clrbrk001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearBreakpoint/clrbrk001/clrbrk001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; static jint result = PASSED; @@ -62,12 +62,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -102,7 +102,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_BREAKPOINT, NULL); + JVMTI_EVENT_BREAKPOINT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable BREAKPOINT event: %s (%d)\n", TranslateError(err), err); @@ -118,7 +118,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { JNIEXPORT void JNICALL Java_nsk_jvmti_ClearBreakpoint_clrbrk001_getReady(JNIEnv *env, jclass cls, jint i) { mid = env->GetStaticMethodID(cls, "trial", "(I)I"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot find method \"trial(I)I\"\n"); result = STATUS_FAILED; } else { @@ -129,7 +129,7 @@ Java_nsk_jvmti_ClearBreakpoint_clrbrk001_getReady(JNIEnv *env, jclass cls, jint JNIEXPORT void JNICALL Java_nsk_jvmti_ClearBreakpoint_clrbrk001_setBP(JNIEnv *env, jclass cls) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return; } @@ -138,7 +138,7 @@ JNIEXPORT void JNICALL Java_nsk_jvmti_ClearBreakpoint_clrbrk001_setBP(JNIEnv *en return; } - if (mid == NULL) { + if (mid == nullptr) { return; } @@ -153,7 +153,7 @@ JNIEXPORT void JNICALL Java_nsk_jvmti_ClearBreakpoint_clrbrk001_setBP(JNIEnv *en JNIEXPORT void JNICALL Java_nsk_jvmti_ClearBreakpoint_clrbrk001_clearBP(JNIEnv *env, jclass cls) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return; } @@ -162,7 +162,7 @@ JNIEXPORT void JNICALL Java_nsk_jvmti_ClearBreakpoint_clrbrk001_clearBP(JNIEnv * return; } - if (mid == NULL) { + if (mid == nullptr) { return; } @@ -176,7 +176,7 @@ JNIEXPORT void JNICALL Java_nsk_jvmti_ClearBreakpoint_clrbrk001_clearBP(JNIEnv * JNIEXPORT jint JNICALL Java_nsk_jvmti_ClearBreakpoint_clrbrk001_check(JNIEnv *env, jclass cls) { - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearBreakpoint/clrbrk002/clrbrk002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearBreakpoint/clrbrk002/clrbrk002.cpp index 79fde2ad9f27..bd13e4ea6d57 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearBreakpoint/clrbrk002/clrbrk002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearBreakpoint/clrbrk002/clrbrk002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -53,12 +53,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -98,7 +98,7 @@ Java_nsk_jvmti_ClearBreakpoint_clrbrk002_check(JNIEnv *env, jclass cls) { jlocation start; jlocation end; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -108,7 +108,7 @@ Java_nsk_jvmti_ClearBreakpoint_clrbrk002_check(JNIEnv *env, jclass cls) { } mid = env->GetStaticMethodID(cls, "run", "([Ljava/lang/String;Ljava/io/PrintStream;)I"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot find method run\n"); return STATUS_FAILED; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearBreakpoint/clrbrk005/clrbrk005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearBreakpoint/clrbrk005/clrbrk005.cpp index f431e14ef107..8433c0cf3664 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearBreakpoint/clrbrk005/clrbrk005.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearBreakpoint/clrbrk005/clrbrk005.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -53,12 +53,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -96,7 +96,7 @@ Java_nsk_jvmti_ClearBreakpoint_clrbrk005_check(JNIEnv *env, jclass cls) { jvmtiError err; jmethodID mid; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -114,7 +114,7 @@ Java_nsk_jvmti_ClearBreakpoint_clrbrk005_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> invalid method check ...\n"); } - err = jvmti->ClearBreakpoint(NULL, 0); + err = jvmti->ClearBreakpoint(nullptr, 0); if (err != JVMTI_ERROR_INVALID_METHODID) { printf("Error expected: JVMTI_ERROR_INVALID_METHODID,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldAccessWatch/clrfldw001/clrfldw001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldAccessWatch/clrfldw001/clrfldw001.cpp index b40cf1e70fab..c3c70ee070d1 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldAccessWatch/clrfldw001/clrfldw001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldAccessWatch/clrfldw001/clrfldw001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -45,14 +45,14 @@ static jvmtiEnv *jvmti; static jvmtiEventCallbacks callbacks; static jvmtiCapabilities caps; static jint result = PASSED; -static jfieldID thrown_fid = NULL; +static jfieldID thrown_fid = nullptr; static field fields[] = { - { "nsk/jvmti/ClearFieldAccessWatch/clrfldw001", "fld0", "I", 0, NULL }, - { "nsk/jvmti/ClearFieldAccessWatch/clrfldw001", "fld1", "I", 1, NULL }, + { "nsk/jvmti/ClearFieldAccessWatch/clrfldw001", "fld0", "I", 0, nullptr }, + { "nsk/jvmti/ClearFieldAccessWatch/clrfldw001", "fld1", "I", 1, nullptr }, { "nsk/jvmti/ClearFieldAccessWatch/clrfldw001", "fld2", - "Lnsk/jvmti/ClearFieldAccessWatch/clrfldw001a;", 0, NULL }, - { "nsk/jvmti/ClearFieldAccessWatch/clrfldw001a", "fld3", "[I", 0, NULL }, - { "nsk/jvmti/ClearFieldAccessWatch/clrfldw001b", "fld4", "F", 0, NULL }, + "Lnsk/jvmti/ClearFieldAccessWatch/clrfldw001a;", 0, nullptr }, + { "nsk/jvmti/ClearFieldAccessWatch/clrfldw001a", "fld3", "[I", 0, nullptr }, + { "nsk/jvmti/ClearFieldAccessWatch/clrfldw001b", "fld4", "F", 0, nullptr }, }; void switchWatch(JNIEnv *env, jint ind, jboolean on) { @@ -62,7 +62,7 @@ void switchWatch(JNIEnv *env, jint ind, jboolean on) { const char *msg; cls = env->FindClass(fld.klass); - if (fld.fid == NULL) { + if (fld.fid == nullptr) { if (fld.stat) { fields[ind].fid = env->GetStaticFieldID(cls, fld.name, fld.sig); } else { @@ -109,7 +109,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } @@ -145,7 +145,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_FIELD_ACCESS, NULL); + JVMTI_EVENT_FIELD_ACCESS, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable JVMTI_EVENT_FIELD_ACCESS: %s (%d)\n", TranslateError(err), err); @@ -182,7 +182,7 @@ JNIEXPORT void JNICALL Java_nsk_jvmti_ClearFieldAccessWatch_clrfldw001_check(JNIEnv *env, jclass cls, jint fld_ind, jboolean flag) { if (caps.can_generate_field_access_events) { - if (flag == JNI_FALSE && thrown_fid != NULL) { + if (flag == JNI_FALSE && thrown_fid != nullptr) { result = STATUS_FAILED; printf("(Field %d) FIELD_ACCESS event without access watch set\n", fld_ind); @@ -191,7 +191,7 @@ Java_nsk_jvmti_ClearFieldAccessWatch_clrfldw001_check(JNIEnv *env, printf("(Field %d) thrown field ID expected: 0x%p, got: 0x%p\n", fld_ind, fields[fld_ind].fid, thrown_fid); } - thrown_fid = NULL; + thrown_fid = nullptr; } } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldAccessWatch/clrfldw002/clrfldw002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldAccessWatch/clrfldw002/clrfldw002.cpp index 889c2781623c..c3a91f338b7f 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldAccessWatch/clrfldw002/clrfldw002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldAccessWatch/clrfldw002/clrfldw002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -59,7 +59,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } @@ -96,7 +96,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_FIELD_ACCESS, NULL); + JVMTI_EVENT_FIELD_ACCESS, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable JVMTI_EVENT_FIELD_ACCESS: %s (%d)\n", TranslateError(err), err); @@ -125,14 +125,14 @@ Java_nsk_jvmti_ClearFieldAccessWatch_clrfldw002_check(JNIEnv *env, jclass cls) { TranslateError(err), err); } } else { - err = jvmti->ClearFieldAccessWatch(NULL, fid2); + err = jvmti->ClearFieldAccessWatch(nullptr, fid2); if (err != JVMTI_ERROR_INVALID_CLASS) { result = STATUS_FAILED; printf("Failed to return JVMTI_ERROR_INVALID_CLASS: %s (%d)\n", TranslateError(err), err); } - err = jvmti->ClearFieldAccessWatch(cls, NULL); + err = jvmti->ClearFieldAccessWatch(cls, nullptr); if (err != JVMTI_ERROR_INVALID_FIELDID) { result = STATUS_FAILED; printf("Failed to return INVALID_FIELDID: %s (%d)\n", diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldModificationWatch/clrfmodw001/clrfmodw001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldModificationWatch/clrfmodw001/clrfmodw001.cpp index 46e0dffa21ce..c155a06075f4 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldModificationWatch/clrfmodw001/clrfmodw001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldModificationWatch/clrfmodw001/clrfmodw001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -45,14 +45,14 @@ static jvmtiEnv *jvmti; static jvmtiEventCallbacks callbacks; static jvmtiCapabilities caps; static jint result = PASSED; -static jfieldID thrown_fid = NULL; +static jfieldID thrown_fid = nullptr; static field fields[] = { - { "nsk/jvmti/ClearFieldModificationWatch/clrfmodw001", "fld0", "I", 0, NULL }, - { "nsk/jvmti/ClearFieldModificationWatch/clrfmodw001", "fld1", "I", 1, NULL }, + { "nsk/jvmti/ClearFieldModificationWatch/clrfmodw001", "fld0", "I", 0, nullptr }, + { "nsk/jvmti/ClearFieldModificationWatch/clrfmodw001", "fld1", "I", 1, nullptr }, { "nsk/jvmti/ClearFieldModificationWatch/clrfmodw001", "fld2", - "Lnsk/jvmti/ClearFieldModificationWatch/clrfmodw001a;", 0, NULL }, - { "nsk/jvmti/ClearFieldModificationWatch/clrfmodw001a", "fld3", "[I", 0, NULL }, - { "nsk/jvmti/ClearFieldModificationWatch/clrfmodw001b", "fld4", "F", 0, NULL }, + "Lnsk/jvmti/ClearFieldModificationWatch/clrfmodw001a;", 0, nullptr }, + { "nsk/jvmti/ClearFieldModificationWatch/clrfmodw001a", "fld3", "[I", 0, nullptr }, + { "nsk/jvmti/ClearFieldModificationWatch/clrfmodw001b", "fld4", "F", 0, nullptr }, }; void switchWatch(JNIEnv *env, jint ind, jboolean on) { @@ -62,7 +62,7 @@ void switchWatch(JNIEnv *env, jint ind, jboolean on) { const char *msg; cls = env->FindClass(fld.klass); - if (fld.fid == NULL) { + if (fld.fid == nullptr) { if (fld.stat) { fields[ind].fid = env->GetStaticFieldID(cls, fld.name, fld.sig); } else { @@ -109,7 +109,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } @@ -145,7 +145,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_FIELD_MODIFICATION, NULL); + JVMTI_EVENT_FIELD_MODIFICATION, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable JVMTI_EVENT_FIELD_MODIFICATION: %s (%d)\n", TranslateError(err), err); @@ -175,7 +175,7 @@ JNIEXPORT void JNICALL Java_nsk_jvmti_ClearFieldModificationWatch_clrfmodw001_to JNIEXPORT void JNICALL Java_nsk_jvmti_ClearFieldModificationWatch_clrfmodw001_check(JNIEnv *env, jclass cls, jint fld_ind, jboolean flag) { if (caps.can_generate_field_modification_events) { - if (flag == JNI_FALSE && thrown_fid != NULL) { + if (flag == JNI_FALSE && thrown_fid != nullptr) { result = STATUS_FAILED; printf("(Field %d) ", fld_ind); printf("FieldModification event without modification watch set\n"); @@ -184,7 +184,7 @@ Java_nsk_jvmti_ClearFieldModificationWatch_clrfmodw001_check(JNIEnv *env, jclass printf("(Field %d) thrown field ID expected: 0x%p, got: 0x%p\n", fld_ind, fields[fld_ind].fid, thrown_fid); } - thrown_fid = NULL; + thrown_fid = nullptr; } } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldModificationWatch/clrfmodw002/clrfmodw002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldModificationWatch/clrfmodw002/clrfmodw002.cpp index 127653e50101..e35eed1d1e7a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldModificationWatch/clrfmodw002/clrfmodw002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ClearFieldModificationWatch/clrfmodw002/clrfmodw002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -60,7 +60,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } @@ -96,7 +96,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_FIELD_MODIFICATION, NULL); + JVMTI_EVENT_FIELD_MODIFICATION, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable JVMTI_EVENT_FIELD_MODIFICATION: %s (%d)\n", TranslateError(err), err); @@ -127,14 +127,14 @@ Java_nsk_jvmti_ClearFieldModificationWatch_clrfmodw002_check(JNIEnv *env, TranslateError(err), err); } } else { - err = jvmti->ClearFieldModificationWatch(NULL, fid2); + err = jvmti->ClearFieldModificationWatch(nullptr, fid2); if (err != JVMTI_ERROR_INVALID_CLASS) { result = STATUS_FAILED; printf("Failed to return JVMTI_ERROR_INVALID_CLASS: %s (%d)\n", TranslateError(err), err); } - err = jvmti->ClearFieldModificationWatch(cls, NULL); + err = jvmti->ClearFieldModificationWatch(cls, nullptr); if (err != JVMTI_ERROR_INVALID_FIELDID) { result = STATUS_FAILED; printf("Failed to return INVALID_FIELDID: %s (%d)\n", diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/CompiledMethodLoad/compmethload001/compmethload001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/CompiledMethodLoad/compmethload001/compmethload001.cpp index a75546f9bdd8..66e49496316f 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/CompiledMethodLoad/compmethload001/compmethload001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/CompiledMethodLoad/compmethload001/compmethload001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,11 +24,11 @@ #include #include #include -#include "agent_common.h" +#include "agent_common.hpp" -#include "nsk_tools.h" -#include "JVMTITools.h" -#include "jvmti_tools.h" +#include "nsk_tools.hpp" +#include "JVMTITools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -36,7 +36,7 @@ extern "C" { #define PASSED 0 static volatile jint result = PASSED; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jvmtiCapabilities caps; @@ -113,7 +113,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add capability to generate compiled method events */ @@ -137,9 +137,9 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; NSK_DISPLAY0("setting event callbacks done\nenabling VMInit, CompiledMethodLoad event ...\n"); - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, nullptr))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, nullptr))) return JNI_ERR; NSK_DISPLAY0("enabling the events done\n\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/CompiledMethodUnload/compmethunload001/compmethunload001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/CompiledMethodUnload/compmethunload001/compmethunload001.cpp index 7b048a2202f6..28766be6202b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/CompiledMethodUnload/compmethunload001/compmethunload001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/CompiledMethodUnload/compmethunload001/compmethunload001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,11 +24,11 @@ #include #include #include -#include "agent_common.h" +#include "agent_common.hpp" -#include "nsk_tools.h" -#include "JVMTITools.h" -#include "jvmti_tools.h" +#include "nsk_tools.hpp" +#include "JVMTITools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -38,7 +38,7 @@ extern "C" { static volatile jint result = PASSED; static volatile int compunload = 0; static volatile int class_unloaded = 0; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jvmtiCapabilities caps; @@ -88,7 +88,7 @@ CompiledMethodUnload(jvmtiEnv *jvmti_env, jmethodID method, NSK_DISPLAY0("CompiledMethodUnload event received\n"); // Check for the case that the class has been unloaded - err = jvmti_env->GetMethodName(method, &name, &sig, NULL); + err = jvmti_env->GetMethodName(method, &name, &sig, nullptr); if (err == JVMTI_ERROR_NONE) { NSK_DISPLAY3("for: \tmethod: name=\"%s\" signature=\"%s\"\n\tnative address=0x%p\n", name, sig, code_addr); @@ -157,7 +157,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add capability to generate compiled method events */ @@ -182,11 +182,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; NSK_DISPLAY0("setting event callbacks done\nenabling JVMTI events ...\n"); - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, nullptr))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, nullptr))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_UNLOAD, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_UNLOAD, nullptr))) return JNI_ERR; NSK_DISPLAY0("enabling the events done\n\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/CreateRawMonitor/crrawmon001/crrawmon001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/CreateRawMonitor/crrawmon001/crrawmon001.cpp index 4e8af24dc497..d3f37f0c65a8 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/CreateRawMonitor/crrawmon001/crrawmon001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/CreateRawMonitor/crrawmon001/crrawmon001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -34,7 +34,7 @@ extern "C" { #define STATUS_FAILED 2 #define RAW_MONITORS_NUMBER 1024 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -57,7 +57,7 @@ void JNICALL VMInit(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thr) { printf("(CreateRawMonitor#%d) unexpected error: %s (%d)\n", i, TranslateError(err), err); result = STATUS_FAILED; - } else if (monitors[i] == NULL) { + } else if (monitors[i] == nullptr) { printf("(CreateRawMonitor#%d) jrawMonitorID is null\n", i); result = STATUS_FAILED; } @@ -79,12 +79,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -98,7 +98,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_VM_INIT, NULL); + JVMTI_EVENT_VM_INIT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable JVMTI_EVENT_VM_INIT: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/CreateRawMonitor/crrawmon002/crrawmon002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/CreateRawMonitor/crrawmon002/crrawmon002.cpp index 65edf6643426..a0089d51297c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/CreateRawMonitor/crrawmon002/crrawmon002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/CreateRawMonitor/crrawmon002/crrawmon002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_crrawmon002(JavaVM *jvm, char *options, void *reserved jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -69,7 +69,7 @@ Java_nsk_jvmti_CreateRawMonitor_crrawmon002_check(JNIEnv *env, jclass cls) { jvmtiError err; jrawMonitorID monitor; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -77,7 +77,7 @@ Java_nsk_jvmti_CreateRawMonitor_crrawmon002_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> name null pointer check ...\n"); } - err = jvmti->CreateRawMonitor(NULL, &monitor); + err = jvmti->CreateRawMonitor(nullptr, &monitor); if (err != JVMTI_ERROR_NULL_POINTER) { printf("Error expected: JVMTI_ERROR_NULL_POINTER, got: %s\n", TranslateError(err)); @@ -87,7 +87,7 @@ Java_nsk_jvmti_CreateRawMonitor_crrawmon002_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> monitorPtr null pointer check ...\n"); } - err = jvmti->CreateRawMonitor("dummy", NULL); + err = jvmti->CreateRawMonitor("dummy", nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { printf("Error expected: JVMTI_ERROR_NULL_POINTER, got: %s\n", TranslateError(err)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DataDumpRequest/datadumpreq001/datadumpreq001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DataDumpRequest/datadumpreq001/datadumpreq001.cpp index 61994f9b6a61..bce556cbac85 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DataDumpRequest/datadumpreq001/datadumpreq001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DataDumpRequest/datadumpreq001/datadumpreq001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,12 +25,12 @@ #include #include #include -#include "agent_common.h" +#include "agent_common.hpp" -#include "nsk_tools.h" -#include "JVMTITools.h" -#include "jvmti_tools.h" -#include "jni_tools.h" +#include "nsk_tools.hpp" +#include "JVMTITools.hpp" +#include "jvmti_tools.hpp" +#include "jni_tools.hpp" extern "C" { @@ -38,7 +38,7 @@ extern "C" { #define PASSED 0 static jint result = STATUS_FAILED; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jboolean eventReceived = JNI_FALSE; @@ -106,7 +106,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) { + if (!NSK_VERIFY(jvmti != nullptr)) { return JNI_ERR; } @@ -122,7 +122,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; NSK_DISPLAY0("setting event callbacks done\nenabling JVMTI events ...\n"); - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_DATA_DUMP_REQUEST, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_DATA_DUMP_REQUEST, nullptr))) return JNI_ERR; NSK_DISPLAY0("enabling the events done\n\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Deallocate/dealloc001/dealloc001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Deallocate/dealloc001/dealloc001.cpp index 3aac4d41b951..1d6e7a571dbc 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Deallocate/dealloc001/dealloc001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/Deallocate/dealloc001/dealloc001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_dealloc001(JavaVM *jvm, char *options, void *reserved) jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -68,7 +68,7 @@ JNIEXPORT jint JNICALL Java_nsk_jvmti_Deallocate_dealloc001_check(JNIEnv *env, jclass cls) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -76,7 +76,7 @@ Java_nsk_jvmti_Deallocate_dealloc001_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> Null pointer check ...\n"); } - err = jvmti->Deallocate(NULL); + err = jvmti->Deallocate(nullptr); if (err != JVMTI_ERROR_NONE) { printf("Error expected: JVMTI_ERROR_NONE, got: %s\n", TranslateError(err)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DestroyRawMonitor/drrawmon001/drrawmon001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DestroyRawMonitor/drrawmon001/drrawmon001.cpp index 35f2e6557f22..f065e61f086b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DestroyRawMonitor/drrawmon001/drrawmon001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DestroyRawMonitor/drrawmon001/drrawmon001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -34,7 +34,7 @@ extern "C" { #define STATUS_FAILED 2 #define RAW_MONITORS_NUMBER 1024 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -58,7 +58,7 @@ void JNICALL VMInit(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thr) { i, TranslateError(err), err); result = STATUS_FAILED; return; - } else if (monitors[i] == NULL) { + } else if (monitors[i] == nullptr) { printf("(CreateRawMonitor#%d) jrawMonitorID is null\n", i); result = STATUS_FAILED; return; @@ -94,12 +94,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -113,7 +113,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_VM_INIT, NULL); + JVMTI_EVENT_VM_INIT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable JVMTI_EVENT_VM_INIT: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DestroyRawMonitor/drrawmon003/drrawmon003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DestroyRawMonitor/drrawmon003/drrawmon003.cpp index 451be8b3bc80..0a96421133ac 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DestroyRawMonitor/drrawmon003/drrawmon003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DestroyRawMonitor/drrawmon003/drrawmon003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -34,7 +34,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jboolean printdump = JNI_FALSE; #ifdef STATIC_BUILD @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_drrawmon003(JavaVM *jvm, char *options, void *reserved jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -69,7 +69,7 @@ Java_nsk_jvmti_DestroyRawMonitor_drrawmon003_check(JNIEnv *env, jclass cls) { jvmtiError err; jrawMonitorID monitor; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DestroyRawMonitor/drrawmon004/drrawmon004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DestroyRawMonitor/drrawmon004/drrawmon004.cpp index 18e322e24385..61e002b9af7d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DestroyRawMonitor/drrawmon004/drrawmon004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DestroyRawMonitor/drrawmon004/drrawmon004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_drrawmon004(JavaVM *jvm, char *options, void *reserved jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -68,7 +68,7 @@ JNIEXPORT jint JNICALL Java_nsk_jvmti_DestroyRawMonitor_drrawmon004_check(JNIEnv *env, jclass cls) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -77,7 +77,7 @@ Java_nsk_jvmti_DestroyRawMonitor_drrawmon004_check(JNIEnv *env, jclass cls) { printf(">>> invalid monitor check ...\n"); } - err = jvmti->DestroyRawMonitor(NULL); + err = jvmti->DestroyRawMonitor(nullptr); if (err != JVMTI_ERROR_INVALID_MONITOR) { printf("Error expected: JVMTI_ERROR_INVALID_MONITOR,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DisposeEnvironment/disposeenv001/disposeenv001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DisposeEnvironment/disposeenv001/disposeenv001.cpp index 43dc539ab3fc..8b73fd6d6e5e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DisposeEnvironment/disposeenv001/disposeenv001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DisposeEnvironment/disposeenv001/disposeenv001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -44,13 +44,13 @@ JNIEXPORT jint JNI_OnLoad_disposeenv001(JavaVM *jvm, char *options, void *reserv } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; NSK_DISPLAY0(">>> Testcase #1: Dispose JVMTI environment in Agent_OnLoad()\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DisposeEnvironment/disposeenv002/disposeenv002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DisposeEnvironment/disposeenv002/disposeenv002.cpp index c804a2ca64c7..3a57006677bb 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DisposeEnvironment/disposeenv002/disposeenv002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DisposeEnvironment/disposeenv002/disposeenv002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,9 +24,9 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -45,7 +45,7 @@ callbackVMDeath(jvmtiEnv* jvmti, JNIEnv* jni) { NSK_DISPLAY0("Disable VM_DEATH event in VM_DEATH callback\n"); if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_VM_DEATH, NULL))) { + jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_VM_DEATH, nullptr))) { success = NSK_FALSE; } else { NSK_DISPLAY0(" ... disabled\n"); @@ -79,13 +79,13 @@ JNIEXPORT jint JNI_OnLoad_disposeenv002(JavaVM *jvm, char *options, void *reserv } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; { @@ -99,7 +99,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { NSK_DISPLAY0("Enable VM_DEATH event in JVM_OnLoad()\n"); if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL))) { + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, nullptr))) { return JNI_ERR; } NSK_DISPLAY0(" ... enabled\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DynamicCodeGenerated/dyncodgen001/dyncodgen001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DynamicCodeGenerated/dyncodgen001/dyncodgen001.cpp index 9de2b5426332..5c5a6a50b99f 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DynamicCodeGenerated/dyncodgen001/dyncodgen001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/DynamicCodeGenerated/dyncodgen001/dyncodgen001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -99,7 +99,7 @@ JNIEXPORT jint JNI_OnLoad_dyncodgen001(JavaVM *jvm, char *options, void *reserve } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiEventCallbacks callbacks; /* init framework and parse options */ @@ -111,7 +111,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; memset(&callbacks, 0, sizeof(callbacks)); @@ -121,11 +121,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* enable DynamicCodeGenerated event */ if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_DYNAMIC_CODE_GENERATED, NULL))) + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_DYNAMIC_CODE_GENERATED, nullptr))) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ForceEarlyReturn/ForceEarlyReturn001/ForceEarlyReturn001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ForceEarlyReturn/ForceEarlyReturn001/ForceEarlyReturn001.cpp index c3eed7356cc0..6ea09a5cfdae 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ForceEarlyReturn/ForceEarlyReturn001/ForceEarlyReturn001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ForceEarlyReturn/ForceEarlyReturn001/ForceEarlyReturn001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, 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,15 +23,15 @@ #include #include #include "jvmti.h" -#include -#include "JVMTITools.h" -#include "agent_common.h" +#include +#include "JVMTITools.hpp" +#include "agent_common.hpp" extern "C" { /* ============================================================================= */ -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; @@ -178,7 +178,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { jvmtiCapabilities caps; - if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved)) != NULL)) + if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved)) != nullptr)) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps))) diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ForceGarbageCollection/forcegc001/forcegc001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ForceGarbageCollection/forcegc001/forcegc001.cpp index d7d1d7125503..e4c8dc2a3759 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ForceGarbageCollection/forcegc001/forcegc001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ForceGarbageCollection/forcegc001/forcegc001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -72,7 +72,7 @@ JNIEXPORT jint JNI_OnLoad_forcegc001(JavaVM *jvm, char *options, void *reserved) } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -80,10 +80,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ForceGarbageCollection/forcegc002/forcegc002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ForceGarbageCollection/forcegc002/forcegc002.cpp index a069c099e503..1df20dcdecf0 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ForceGarbageCollection/forcegc002/forcegc002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ForceGarbageCollection/forcegc002/forcegc002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -50,7 +50,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { events = 0; NSK_DISPLAY0("Enable event GarbageCollectionStart\n"); - if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, NULL))) + if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, nullptr))) return; NSK_DISPLAY0("Call ForceGarbageCollection()\n"); @@ -60,7 +60,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } NSK_DISPLAY0("Disable event GarbageCollectionStart\n"); - if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_DISABLE, 1, &event, NULL))) + if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_DISABLE, 1, &event, nullptr))) return; NSK_DISPLAY0("Check if expected events received\n"); @@ -98,7 +98,7 @@ JNIEXPORT jint JNI_OnLoad_forcegc002(JavaVM *jvm, char *options, void *reserved) } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -106,7 +106,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; { @@ -125,7 +125,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionFinish/gcfinish001/gcfinish001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionFinish/gcfinish001/gcfinish001.cpp index e247fbdbd004..970e4ff57c13 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionFinish/gcfinish001/gcfinish001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionFinish/gcfinish001/gcfinish001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,11 +25,11 @@ #include #include #include -#include "agent_common.h" +#include "agent_common.hpp" -#include "nsk_tools.h" -#include "JVMTITools.h" -#include "jvmti_tools.h" +#include "nsk_tools.hpp" +#include "JVMTITools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -38,7 +38,7 @@ extern "C" { #define MEM_SIZE 1024 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jvmtiCapabilities caps; @@ -194,7 +194,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add capability to generate compiled method events */ @@ -218,9 +218,9 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; NSK_DISPLAY0("setting event callbacks done\nenabling JVMTI events ...\n"); - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, nullptr))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_FINISH, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_FINISH, nullptr))) return JNI_ERR; NSK_DISPLAY0("enabling the events done\n\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionStart/gcstart001/gcstart001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionStart/gcstart001/gcstart001.cpp index d9dab1b0c7db..9e4d2d7f0f00 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionStart/gcstart001/gcstart001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionStart/gcstart001/gcstart001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,11 +25,11 @@ #include #include #include -#include "agent_common.h" +#include "agent_common.hpp" -#include "nsk_tools.h" -#include "JVMTITools.h" -#include "jvmti_tools.h" +#include "nsk_tools.hpp" +#include "JVMTITools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -39,7 +39,7 @@ extern "C" { static volatile jint result = PASSED; static volatile int gcstart = 0; static volatile int gcfinish = 0; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jvmtiCapabilities caps; @@ -114,7 +114,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add capability to generate compiled method events */ @@ -139,11 +139,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; NSK_DISPLAY0("setting event callbacks done\nenabling JVMTI events ...\n"); - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, nullptr))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_START, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_START, nullptr))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_FINISH, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_FINISH, nullptr))) return JNI_ERR; NSK_DISPLAY0("enabling the events done\n\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionStart/gcstart002/gcstart002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionStart/gcstart002/gcstart002.cpp index fb9d69ddd085..792c326a96a8 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionStart/gcstart002/gcstart002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GarbageCollectionStart/gcstart002/gcstart002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,11 +25,11 @@ #include #include #include -#include "agent_common.h" +#include "agent_common.hpp" -#include "nsk_tools.h" -#include "JVMTITools.h" -#include "jvmti_tools.h" +#include "nsk_tools.hpp" +#include "JVMTITools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -38,7 +38,7 @@ extern "C" { #define MEM_SIZE 1024 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jvmtiCapabilities caps; @@ -195,7 +195,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add capability to generate compiled method events */ @@ -219,9 +219,9 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; NSK_DISPLAY0("setting event callbacks done\nenabling JVMTI events ...\n"); - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, nullptr))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_START, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_START, nullptr))) return JNI_ERR; NSK_DISPLAY0("enabling the events done\n\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GenerateEvents/genevents001/genevents001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GenerateEvents/genevents001/genevents001.cpp index f208bcdfb427..13de99039af9 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GenerateEvents/genevents001/genevents001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GenerateEvents/genevents001/genevents001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -94,7 +94,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } NSK_DISPLAY1("Enable events: %d events\n", EVENTS_COUNT); - if (!nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, eventsList, NULL)) { + if (!nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, eventsList, nullptr)) { nsk_jvmti_setFailStatus(); } @@ -108,7 +108,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } NSK_DISPLAY1("Disable events: %d events\n", EVENTS_COUNT); - if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, eventsList, NULL)) { + if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, eventsList, nullptr)) { nsk_jvmti_setFailStatus(); } @@ -174,7 +174,7 @@ JNIEXPORT jint JNI_OnLoad_genevents001(JavaVM *jvm, char *options, void *reserve } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -182,10 +182,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; /* add required capabilities */ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetArgumentsSize/argsize001/argsize001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetArgumentsSize/argsize001/argsize001.cpp index 38b2612cab8c..3c0afdfb62d6 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetArgumentsSize/argsize001/argsize001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetArgumentsSize/argsize001/argsize001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,8 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -32,12 +32,12 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; void chk(JNIEnv *env, jclass cl, const char *name, const char *sig, int stat, int size) { jvmtiError err; - jmethodID mid = NULL; + jmethodID mid = nullptr; jint ret_size; if (stat) { @@ -45,7 +45,7 @@ void chk(JNIEnv *env, jclass cl, const char *name, const char *sig, int stat, in } else { mid = env->GetMethodID(cl, name, sig); } - if (mid == NULL) { + if (mid == nullptr) { printf("Name = %s, sig = %s: mid = 0\n", name, sig); } err = jvmti->GetArgumentsSize(mid, &ret_size); @@ -76,7 +76,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetArgumentsSize/argsize002/argsize002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetArgumentsSize/argsize002/argsize002.cpp index 5fd7c0d2d048..e957529cc028 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetArgumentsSize/argsize002/argsize002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetArgumentsSize/argsize002/argsize002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_argsize002(JavaVM *jvm, char *options, void *reserved) jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -70,13 +70,13 @@ Java_nsk_jvmti_GetArgumentsSize_argsize002_check(JNIEnv *env, jclass cls) { jmethodID mid; jint size; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } mid = env->GetMethodID(cls, "", "()V"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot get method ID for \"\"!\n"); return STATUS_FAILED; } @@ -84,7 +84,7 @@ Java_nsk_jvmti_GetArgumentsSize_argsize002_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> invalid method check ...\n"); } - err = jvmti->GetArgumentsSize(NULL, &size); + err = jvmti->GetArgumentsSize(nullptr, &size); if (err != JVMTI_ERROR_INVALID_METHODID) { printf("Error expected: JVMTI_ERROR_INVALID_METHODID,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -94,7 +94,7 @@ Java_nsk_jvmti_GetArgumentsSize_argsize002_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> null pointer check ...\n"); } - err = jvmti->GetArgumentsSize(mid, NULL); + err = jvmti->GetArgumentsSize(mid, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { printf("Error expected: JVMTI_ERROR_NULL_POINTER,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -102,7 +102,7 @@ Java_nsk_jvmti_GetArgumentsSize_argsize002_check(JNIEnv *env, jclass cls) { } mid = env->GetStaticMethodID(cls, "check", "()I"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot get method ID for \"check\"!\n"); return STATUS_FAILED; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetAvailableProcessors/getavailproc001/getavailproc001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetAvailableProcessors/getavailproc001/getavailproc001.cpp index 28d4ad2a91af..5b24e64edcc5 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetAvailableProcessors/getavailproc001/getavailproc001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetAvailableProcessors/getavailproc001/getavailproc001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,9 +24,9 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -112,7 +112,7 @@ callbackVMDeath(jvmtiEnv* jvmti, JNIEnv* jni) { success = checkProcessors(jvmti, "VM_DEATH callback"); NSK_DISPLAY1("Disable events: %d events\n", EVENTS_COUNT); - if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, NULL)) { + if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, nullptr)) { success = NSK_FALSE; } else { NSK_DISPLAY0(" ... disabled\n"); @@ -139,7 +139,7 @@ JNIEXPORT jint JNI_OnLoad_getavailproc001(JavaVM *jvm, char *options, void *rese } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -147,7 +147,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; { @@ -162,7 +162,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; NSK_DISPLAY0(">>> Testcase #1: Check available processors in Agent_OnLoad()\n"); @@ -171,7 +171,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } NSK_DISPLAY1("Enable events: %d events\n", EVENTS_COUNT); - if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, NULL)) { + if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, nullptr)) { NSK_DISPLAY0(" ... enabled\n"); } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetBytecodes/bytecodes001/bytecodes001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetBytecodes/bytecodes001/bytecodes001.cpp index ee476a7ce33c..9743c8f762d6 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetBytecodes/bytecodes001/bytecodes001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetBytecodes/bytecodes001/bytecodes001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -41,7 +41,7 @@ typedef struct { unsigned char *codes; } info; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -70,12 +70,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -117,12 +117,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { void checkMeth(JNIEnv *env, jclass cl, int meth_ind) { jvmtiError err; - jmethodID mid = NULL; + jmethodID mid = nullptr; jint count = -1; - unsigned char *codes = NULL; + unsigned char *codes = nullptr; int i; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; @@ -135,7 +135,7 @@ void checkMeth(JNIEnv *env, jclass cl, int meth_ind) { mid = env->GetMethodID(cl, meth_tab[meth_ind].name, meth_tab[meth_ind].sig); } - if (mid == NULL) { + if (mid == nullptr) { printf("\"%s%s\": cannot get method ID!\n", meth_tab[meth_ind].name, meth_tab[meth_ind].sig); result = STATUS_FAILED; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetBytecodes/bytecodes002/bytecodes002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetBytecodes/bytecodes002/bytecodes002.cpp index ad5e5eeacd27..4dfb24d51403 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetBytecodes/bytecodes002/bytecodes002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetBytecodes/bytecodes002/bytecodes002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -53,12 +53,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -105,13 +105,13 @@ Java_nsk_jvmti_GetBytecodes_bytecodes002_check(JNIEnv *env, jclass cls) { jint bytecodeCount; unsigned char *bytecodes; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } mid = env->GetMethodID(cls, "", "()V"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot get method ID for \"\"!\n"); return STATUS_FAILED; } @@ -119,7 +119,7 @@ Java_nsk_jvmti_GetBytecodes_bytecodes002_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> invalid method check ...\n"); } - err = jvmti->GetBytecodes(NULL, &bytecodeCount, &bytecodes); + err = jvmti->GetBytecodes(nullptr, &bytecodeCount, &bytecodes); if (err == JVMTI_ERROR_MUST_POSSESS_CAPABILITY && !caps.can_get_bytecodes) { /* It is OK */ } else if (err != JVMTI_ERROR_INVALID_METHODID) { @@ -131,7 +131,7 @@ Java_nsk_jvmti_GetBytecodes_bytecodes002_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> (bytecodeCountPtr) null pointer check ...\n"); } - err = jvmti->GetBytecodes(mid, NULL, &bytecodes); + err = jvmti->GetBytecodes(mid, nullptr, &bytecodes); if (err == JVMTI_ERROR_MUST_POSSESS_CAPABILITY && !caps.can_get_bytecodes) { /* It is OK */ } else if (err != JVMTI_ERROR_NULL_POINTER) { @@ -143,7 +143,7 @@ Java_nsk_jvmti_GetBytecodes_bytecodes002_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> (bytecodesPtr) null pointer check ...\n"); } - err = jvmti->GetBytecodes(mid, &bytecodeCount, NULL); + err = jvmti->GetBytecodes(mid, &bytecodeCount, nullptr); if (err == JVMTI_ERROR_MUST_POSSESS_CAPABILITY && !caps.can_get_bytecodes) { /* It is OK */ } else if (err != JVMTI_ERROR_NULL_POINTER) { @@ -153,7 +153,7 @@ Java_nsk_jvmti_GetBytecodes_bytecodes002_check(JNIEnv *env, jclass cls) { } mid = env->GetStaticMethodID(cls, "check", "()I"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot get method ID for \"check\"!\n"); return STATUS_FAILED; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetBytecodes/bytecodes003/bytecodes003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetBytecodes/bytecodes003/bytecodes003.cpp index bd8c2e25abe7..7167631a5e43 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetBytecodes/bytecodes003/bytecodes003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetBytecodes/bytecodes003/bytecodes003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -46,7 +46,7 @@ typedef struct { int length; } opcode_info; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; static jint result = PASSED; @@ -324,8 +324,8 @@ void JNICALL ClassPrepare(jvmtiEnv *jvmti_env, JNIEnv *env, unsigned char *bytecodes; jint i; - sig = NULL; - err = jvmti_env->GetClassSignature(cls, &sig, NULL); + sig = nullptr; + err = jvmti_env->GetClassSignature(cls, &sig, nullptr); if (err != JVMTI_ERROR_NONE) { printf("(GetClassSignature#%d) unexpected error: %s (%d)\n", eventsCount, TranslateError(err), err); @@ -347,15 +347,15 @@ void JNICALL ClassPrepare(jvmtiEnv *jvmti_env, JNIEnv *env, } for (i = 0; i < mcount; i++) { - if (methods[i] == NULL) { + if (methods[i] == nullptr) { if (printdump == JNI_TRUE) { printf(" null"); } } else { - name = NULL; - msig = NULL; - bytecodes = NULL; - err = jvmti_env->GetMethodName(methods[i], &name, &msig, NULL); + name = nullptr; + msig = nullptr; + bytecodes = nullptr; + err = jvmti_env->GetMethodName(methods[i], &name, &msig, nullptr); if (err != JVMTI_ERROR_NONE) { printf("(GetMethodName) unexpected error: %s (%d)\n", TranslateError(err), err); @@ -397,22 +397,22 @@ void JNICALL ClassPrepare(jvmtiEnv *jvmti_env, JNIEnv *env, } } } - if (name != NULL) { + if (name != nullptr) { jvmti_env->Deallocate((unsigned char *)name); } - if (msig != NULL) { + if (msig != nullptr) { jvmti_env->Deallocate((unsigned char *)msig); } - if (bytecodes != NULL) { + if (bytecodes != nullptr) { jvmti_env->Deallocate(bytecodes); } } } - if (methods != NULL) { + if (methods != nullptr) { jvmti_env->Deallocate((unsigned char *)methods); } - if (sig != NULL) { + if (sig != nullptr) { jvmti_env->Deallocate((unsigned char *)sig); } eventsCount++; @@ -433,12 +433,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -488,7 +488,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_CLASS_PREPARE, NULL); + JVMTI_EVENT_CLASS_PREPARE, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable ClassPrepare: %s (%d)\n", TranslateError(err), err); @@ -505,14 +505,14 @@ JNIEXPORT jint JNICALL Java_nsk_jvmti_GetBytecodes_bytecodes003_check(JNIEnv *env, jclass cls) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } if (caps.can_get_bytecodes) { err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, - JVMTI_EVENT_CLASS_PREPARE, NULL); + JVMTI_EVENT_CLASS_PREPARE, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to disable JVMTI_EVENT_CLASS_PREPARE: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetCapabilities/getcaps001/getcaps001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetCapabilities/getcaps001/getcaps001.cpp index 33057c64901d..a81afef82759 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetCapabilities/getcaps001/getcaps001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetCapabilities/getcaps001/getcaps001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_getcaps001(JavaVM *jvm, char *options, void *reserved) jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -68,7 +68,7 @@ JNIEXPORT jint JNICALL Java_nsk_jvmti_GetCapabilities_getcaps001_check(JNIEnv *env, jclass cls) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -76,7 +76,7 @@ Java_nsk_jvmti_GetCapabilities_getcaps001_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> null pointer check ...\n"); } - err = jvmti->GetCapabilities(NULL); + err = jvmti->GetCapabilities(nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { printf("Error expected: JVMTI_ERROR_NULL_POINTER,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetCapabilities/getcaps002/getcaps002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetCapabilities/getcaps002/getcaps002.cpp index d3ddec8ad80d..fa03fb1b34f9 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetCapabilities/getcaps002/getcaps002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetCapabilities/getcaps002/getcaps002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,9 +24,9 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -252,7 +252,7 @@ callbackVMDeath(jvmtiEnv* jvmti, JNIEnv* jni) { success = checkCapabilities(jvmti, "VM_DEATH callback"); NSK_DISPLAY1("Disable events: %d events\n", EVENTS_COUNT); - if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, NULL)) { + if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, nullptr)) { success = NSK_FALSE; } else { NSK_DISPLAY0(" ... disabled\n"); @@ -279,7 +279,7 @@ JNIEXPORT jint JNI_OnLoad_getcaps002(JavaVM *jvm, char *options, void *reserved) } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -287,7 +287,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; { @@ -302,7 +302,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; NSK_DISPLAY0(">>> Testcase #1: Check capabilities in Agent_OnLoad()\n"); @@ -311,7 +311,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } NSK_DISPLAY1("Enable events: %d events\n", EVENTS_COUNT); - if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, NULL)) { + if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, nullptr)) { NSK_DISPLAY0(" ... enabled\n"); } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassFields/getclfld005/getclfld005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassFields/getclfld005/getclfld005.cpp index 38264eaa61ae..a41634ea25d1 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassFields/getclfld005/getclfld005.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassFields/getclfld005/getclfld005.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_getclfld005(JavaVM *jvm, char *options, void *reserved jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -70,7 +70,7 @@ Java_nsk_jvmti_GetClassFields_getclfld005_check(JNIEnv *env, jclass cls) { jint fcount; jfieldID *fields; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -78,7 +78,7 @@ Java_nsk_jvmti_GetClassFields_getclfld005_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> invalid class check ...\n"); } - err = jvmti->GetClassFields(NULL, &fcount, &fields); + err = jvmti->GetClassFields(nullptr, &fcount, &fields); if (err != JVMTI_ERROR_INVALID_CLASS) { printf("Error expected: JVMTI_ERROR_INVALID_CLASS,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -88,7 +88,7 @@ Java_nsk_jvmti_GetClassFields_getclfld005_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> (fieldCountPtr) null pointer check ...\n"); } - err = jvmti->GetClassFields(cls, NULL, &fields); + err = jvmti->GetClassFields(cls, nullptr, &fields); if (err != JVMTI_ERROR_NULL_POINTER) { printf("(fieldCountPtr) error expected: JVMTI_ERROR_NULL_POINTER,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -98,7 +98,7 @@ Java_nsk_jvmti_GetClassFields_getclfld005_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> (fieldsPtr) null pointer check ...\n"); } - err = jvmti->GetClassFields(cls, &fcount, NULL); + err = jvmti->GetClassFields(cls, &fcount, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { printf("(fieldsPtr) error expected: JVMTI_ERROR_NULL_POINTER,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassFields/getclfld006/getclfld006.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassFields/getclfld006/getclfld006.cpp index aace1a93e3cd..e1b17bf64206 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassFields/getclfld006/getclfld006.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassFields/getclfld006/getclfld006.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_getclfld006(JavaVM *jvm, char *options, void *reserved jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -70,7 +70,7 @@ Java_nsk_jvmti_GetClassFields_getclfld006_check(JNIEnv *env, jclass cls, jint i, jint fcount; jfieldID *fields; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassFields/getclfld007/getclfld007.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassFields/getclfld007/getclfld007.cpp index 93da371fd548..3cd333843308 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassFields/getclfld007/getclfld007.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassFields/getclfld007/getclfld007.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,16 +33,16 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; // compares 'value' with jobject_arr[index] static bool equals_str(JNIEnv *env, const char *value, jobjectArray jobject_arr, jint index) { jstring jstr = (jstring)env->GetObjectArrayElement(jobject_arr, index); - const char* utf = env->GetStringUTFChars(jstr, NULL); + const char* utf = env->GetStringUTFChars(jstr, nullptr); bool res = false; - if (utf != NULL) { + if (utf != nullptr) { res = strcmp(value, utf) == 0; env->ReleaseStringUTFChars(jstr, utf); } else { @@ -68,7 +68,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -84,7 +84,7 @@ Java_nsk_jvmti_GetClassFields_getclfld007_check(JNIEnv *env, jclass cls, jclass char *name, *sig; int j; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); fflush(0); result = STATUS_FAILED; @@ -109,12 +109,12 @@ Java_nsk_jvmti_GetClassFields_getclfld007_check(JNIEnv *env, jclass cls, jclass result = STATUS_FAILED; } for (j = 0; j < fcount; j++) { - if (fields[j] == NULL) { + if (fields[j] == nullptr) { printf("(%d) fieldID = null\n", j); result = STATUS_FAILED; continue; } - err = jvmti->GetFieldName(clazz, fields[j], &name, &sig, NULL); + err = jvmti->GetFieldName(clazz, fields[j], &name, &sig, nullptr); if (err != JVMTI_ERROR_NONE) { printf("(GetFieldName#%d) unexpected error: %s (%d)\n", j, TranslateError(err), err); @@ -123,7 +123,7 @@ Java_nsk_jvmti_GetClassFields_getclfld007_check(JNIEnv *env, jclass cls, jclass } printf(">>> [%d]: %s, sig = \"%s\"\n", j, name, sig); if ((j < field_count) && - (name == NULL || sig == NULL || + (name == nullptr || sig == nullptr || !equals_str(env, name, fieldArr, j * 2) || !equals_str(env, sig, fieldArr, j * 2 + 1))) { printf("(%d) wrong field: \"%s%s\"", j, name, sig); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassLoader/getclsldr001/getclsldr001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassLoader/getclsldr001/getclsldr001.cpp index f337c203ba7c..90ece1bd2cef 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassLoader/getclsldr001/getclsldr001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassLoader/getclsldr001/getclsldr001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_getclsldr001(JavaVM *jvm, char *options, void *reserve jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -69,7 +69,7 @@ Java_nsk_jvmti_GetClassLoader_getclsldr001_check(JNIEnv *env, jclass cls) { jvmtiError err; jobject classloader; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -77,7 +77,7 @@ Java_nsk_jvmti_GetClassLoader_getclsldr001_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> invalid class check ...\n"); } - err = jvmti->GetClassLoader(NULL, &classloader); + err = jvmti->GetClassLoader(nullptr, &classloader); if (err != JVMTI_ERROR_INVALID_CLASS) { printf("Error expected: JVMTI_ERROR_INVALID_CLASS,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -87,7 +87,7 @@ Java_nsk_jvmti_GetClassLoader_getclsldr001_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> null pointer check ...\n"); } - err = jvmti->GetClassLoader(cls, NULL); + err = jvmti->GetClassLoader(cls, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { printf("Error expected: JVMTI_ERROR_NULL_POINTER,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassLoader/getclsldr002/getclsldr002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassLoader/getclsldr002/getclsldr002.cpp index 04d473fc7c37..f46e0bb13da5 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassLoader/getclsldr002/getclsldr002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassLoader/getclsldr002/getclsldr002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_getclsldr002(JavaVM *jvm, char *options, void *reserve jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -71,7 +71,7 @@ Java_nsk_jvmti_GetClassLoader_getclsldr002_check(JNIEnv *env, jobject classloader; char *sig, *generic; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; @@ -97,8 +97,8 @@ Java_nsk_jvmti_GetClassLoader_getclsldr002_check(JNIEnv *env, printf(">>> %d: %s\n", i, sig); } - if (classloader != NULL) { - printf("(%d:%s) class loader is not NULL: 0x%p\n", + if (classloader != nullptr) { + printf("(%d:%s) class loader is not null: 0x%p\n", i, sig, classloader); result = STATUS_FAILED; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassLoader/getclsldr003/getclsldr003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassLoader/getclsldr003/getclsldr003.cpp index d003074a6299..43961c06bd12 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassLoader/getclsldr003/getclsldr003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassLoader/getclsldr003/getclsldr003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_getclsldr003(JavaVM *jvm, char *options, void *reserve jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -71,7 +71,7 @@ Java_nsk_jvmti_GetClassLoader_getclsldr003_check(JNIEnv *env, jobject classloader; char *sig, *generic; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassLoaderClasses/clsldrclss001/clsldrclss001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassLoaderClasses/clsldrclss001/clsldrclss001.cpp index afe7952ab208..938c50a56066 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassLoaderClasses/clsldrclss001/clsldrclss001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassLoaderClasses/clsldrclss001/clsldrclss001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_clsldrclss001(JavaVM *jvm, char *options, void *reserv jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -71,7 +71,7 @@ Java_nsk_jvmti_GetClassLoaderClasses_clsldrclss001_check(JNIEnv *env, jclass cls jclass *classes; jint classCount; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -87,7 +87,7 @@ Java_nsk_jvmti_GetClassLoaderClasses_clsldrclss001_check(JNIEnv *env, jclass cls if (printdump == JNI_TRUE) { printf(">>> (initiatingLoader) null pointer check ...\n"); } - err = jvmti->GetClassLoaderClasses(NULL, &classCount, &classes); + err = jvmti->GetClassLoaderClasses(nullptr, &classCount, &classes); if (err == JVMTI_ERROR_NULL_POINTER) { printf("Expected: the classes initiated by the bootstrap loader,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -97,7 +97,7 @@ Java_nsk_jvmti_GetClassLoaderClasses_clsldrclss001_check(JNIEnv *env, jclass cls if (printdump == JNI_TRUE) { printf(">>> (classCountPtr) null pointer check ...\n"); } - err = jvmti->GetClassLoaderClasses(classloader, NULL, &classes); + err = jvmti->GetClassLoaderClasses(classloader, nullptr, &classes); if (err != JVMTI_ERROR_NULL_POINTER) { printf("Error expected: JVMTI_ERROR_NULL_POINTER,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -107,7 +107,7 @@ Java_nsk_jvmti_GetClassLoaderClasses_clsldrclss001_check(JNIEnv *env, jclass cls if (printdump == JNI_TRUE) { printf(">>> (classesPtr) null pointer check ...\n"); } - err = jvmti->GetClassLoaderClasses(classloader, &classCount, NULL); + err = jvmti->GetClassLoaderClasses(classloader, &classCount, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { printf("Error expected: JVMTI_ERROR_NULL_POINTER,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassLoaderClasses/clsldrclss002/clsldrclss002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassLoaderClasses/clsldrclss002/clsldrclss002.cpp index 65116a118a33..50e6207e57fa 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassLoaderClasses/clsldrclss002/clsldrclss002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassLoaderClasses/clsldrclss002/clsldrclss002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -35,9 +35,9 @@ extern "C" { static jlong timeout = 0; /* test objects */ -static jobject testedClassLoader = NULL; -static jclass testedClass = NULL; -static jfieldID testedFieldID = NULL; +static jobject testedClassLoader = nullptr; +static jclass testedClass = nullptr; +static jfieldID testedFieldID = nullptr; static const char* CLASS_SIG = "Lnsk/jvmti/GetClassLoaderClasses/clsldrclss002;"; @@ -58,15 +58,15 @@ static int prepare(JNIEnv* jni) { 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 = jni->FindClass(CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (testedClass = jni->FindClass(CLASS_NAME)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (testedClass = (jclass) jni->NewGlobalRef(testedClass)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (testedClass = (jclass) jni->NewGlobalRef(testedClass)) != nullptr)) return NSK_FALSE; NSK_DISPLAY2("Find field: %s:%s\n", FIELD_NAME, FIELD_SIGNATURE); if (!NSK_JNI_VERIFY(jni, (testedFieldID = - jni->GetStaticFieldID(testedClass, FIELD_NAME, FIELD_SIGNATURE)) != NULL)) + jni->GetStaticFieldID(testedClass, FIELD_NAME, FIELD_SIGNATURE)) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -82,15 +82,15 @@ static int lookup(jvmtiEnv* jvmti, if (!NSK_JVMTI_VERIFY(jvmti->GetClassSignature(classes[i], &signature, &generic))) break; - if (signature != NULL && strcmp(signature, exp_sig) == 0) { + if (signature != nullptr && strcmp(signature, exp_sig) == 0) { NSK_DISPLAY1("Expected class found: %s\n", exp_sig); found = NSK_TRUE; } - if (signature != NULL) + if (signature != nullptr) jvmti->Deallocate((unsigned char*)signature); - if (generic != NULL) + if (generic != nullptr) jvmti->Deallocate((unsigned char*)generic); } @@ -115,7 +115,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0("Testcase #1: check on default classloader\n"); if (!NSK_JNI_VERIFY(jni, (testedClassLoader = - jni->GetStaticObjectField(testedClass, testedFieldID)) != NULL)) { + jni->GetStaticObjectField(testedClass, testedFieldID)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -127,7 +127,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { nsk_jvmti_setFailStatus(); return; } - if (!NSK_VERIFY(classes != NULL)) { + if (!NSK_VERIFY(classes != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -136,7 +136,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { nsk_jvmti_setFailStatus(); return; } - if (classes != NULL) + if (classes != nullptr) jvmti->Deallocate((unsigned char*)classes); if (!nsk_jvmti_resumeSync()) @@ -146,7 +146,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0("Testcase #2: check on custom classloader\n"); if (!NSK_JNI_VERIFY(jni, (testedClassLoader = - jni->GetStaticObjectField(testedClass, testedFieldID)) != NULL)) { + jni->GetStaticObjectField(testedClass, testedFieldID)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -158,7 +158,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { nsk_jvmti_setFailStatus(); return; } - if (!NSK_VERIFY(classes != NULL)) { + if (!NSK_VERIFY(classes != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -174,7 +174,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_COMPLAIN1("Cannot find class in the list: %s\n", CLASS_SIG_E); nsk_jvmti_setFailStatus(); } - if (classes != NULL) + if (classes != nullptr) jvmti->Deallocate((unsigned char*)classes); NSK_TRACE(jni->DeleteGlobalRef(testedClass)); @@ -198,7 +198,7 @@ JNIEXPORT jint JNI_OnLoad_clsldrclss002(JavaVM *jvm, char *options, void *reserv } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; NSK_DISPLAY0("Agent_OnLoad\n"); @@ -208,10 +208,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassMethods/getclmthd005/getclmthd005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassMethods/getclmthd005/getclmthd005.cpp index ec8da62bb607..e4327bdb890f 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassMethods/getclmthd005/getclmthd005.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassMethods/getclmthd005/getclmthd005.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_getclmthd005(JavaVM *jvm, char *options, void *reserve jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -70,7 +70,7 @@ Java_nsk_jvmti_GetClassMethods_getclmthd005_check(JNIEnv *env, jclass cls) { jint mcount; jmethodID *methods; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -78,7 +78,7 @@ Java_nsk_jvmti_GetClassMethods_getclmthd005_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> invalid class check ...\n"); } - err = jvmti->GetClassMethods(NULL, &mcount, &methods); + err = jvmti->GetClassMethods(nullptr, &mcount, &methods); if (err != JVMTI_ERROR_INVALID_CLASS) { printf("Error expected: JVMTI_ERROR_INVALID_CLASS,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -88,7 +88,7 @@ Java_nsk_jvmti_GetClassMethods_getclmthd005_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> (methodCountPtr) null pointer check ...\n"); } - err = jvmti->GetClassMethods(cls, NULL, &methods); + err = jvmti->GetClassMethods(cls, nullptr, &methods); if (err != JVMTI_ERROR_NULL_POINTER) { printf("(methodCountPtr) error expected: JVMTI_ERROR_NULL_POINTER,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -98,7 +98,7 @@ Java_nsk_jvmti_GetClassMethods_getclmthd005_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> (methodsPtr) null pointer check ...\n"); } - err = jvmti->GetClassMethods(cls, &mcount, NULL); + err = jvmti->GetClassMethods(cls, &mcount, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { printf("(methodsPtr) error expected: JVMTI_ERROR_NULL_POINTER,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassMethods/getclmthd006/getclmthd006.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassMethods/getclmthd006/getclmthd006.cpp index 03d1152454c4..b0f1add000b5 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassMethods/getclmthd006/getclmthd006.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassMethods/getclmthd006/getclmthd006.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_getclmthd006(JavaVM *jvm, char *options, void *reserve jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -70,7 +70,7 @@ Java_nsk_jvmti_GetClassMethods_getclmthd006_check(JNIEnv *env, jclass cls, jint jint mcount; jmethodID *methods; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassMethods/getclmthd007/getclmthd007.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassMethods/getclmthd007/getclmthd007.cpp index 031f11d03eda..79e5d144d0d4 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassMethods/getclmthd007/getclmthd007.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassMethods/getclmthd007/getclmthd007.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -44,7 +44,7 @@ typedef struct { meth_info *meths; } class_info; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -124,12 +124,12 @@ JNIEXPORT jint JNI_OnLoad_getclmthd007(JavaVM *jvm, char *options, void *reserve jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -147,7 +147,7 @@ Java_nsk_jvmti_GetClassMethods_getclmthd007_check(JNIEnv *env, int j, k; int failed = JNI_FALSE; // enable debugging on failure - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; @@ -173,7 +173,7 @@ Java_nsk_jvmti_GetClassMethods_getclmthd007_check(JNIEnv *env, printf(">>> %s:\n", classes[i].name); } for (k = 0; k < mcount; k++) { - if (methods[k] == NULL) { + if (methods[k] == nullptr) { printf("(%d:%d) methodID = null\n", i, k); result = STATUS_FAILED; } else if (printdump == JNI_TRUE || failed == JNI_TRUE) { @@ -187,7 +187,7 @@ Java_nsk_jvmti_GetClassMethods_getclmthd007_check(JNIEnv *env, for (j = 0; j < classes[i].mcount; j++) { /* search the returned table for each expected entry */ for (k = 0; k < mcount; k++) { - if (methods[k] != NULL) { + if (methods[k] != nullptr) { err = jvmti->GetMethodName(methods[k], &name, &sig, &generic); if (err != JVMTI_ERROR_NONE) { @@ -195,7 +195,7 @@ Java_nsk_jvmti_GetClassMethods_getclmthd007_check(JNIEnv *env, i, k, TranslateError(err), err); result = STATUS_FAILED; } else { - if (name != NULL && sig != NULL && + if (name != nullptr && sig != nullptr && strcmp(name, classes[i].meths[j].name) == 0 && strcmp(sig, classes[i].meths[j].sig) == 0) break; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassModifiers/getclmdf004/getclmdf004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassModifiers/getclmdf004/getclmdf004.cpp index da09f1c5f2c1..21334b3801b3 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassModifiers/getclmdf004/getclmdf004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassModifiers/getclmdf004/getclmdf004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_getclmdf004(JavaVM *jvm, char *options, void *reserved jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -69,7 +69,7 @@ Java_nsk_jvmti_GetClassModifiers_getclmdf004_check(JNIEnv *env, jclass cls) { jvmtiError err; jint modifiers; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -77,7 +77,7 @@ Java_nsk_jvmti_GetClassModifiers_getclmdf004_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> invalid class check ...\n"); } - err = jvmti->GetClassModifiers(NULL, &modifiers); + err = jvmti->GetClassModifiers(nullptr, &modifiers); if (err != JVMTI_ERROR_INVALID_CLASS) { printf("Error expected: JVMTI_ERROR_INVALID_CLASS,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -87,7 +87,7 @@ Java_nsk_jvmti_GetClassModifiers_getclmdf004_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> null pointer check ...\n"); } - err = jvmti->GetClassModifiers(cls, NULL); + err = jvmti->GetClassModifiers(cls, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { printf("Error expected: JVMTI_ERROR_NULL_POINTER,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassModifiers/getclmdf005/getclmdf005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassModifiers/getclmdf005/getclmdf005.cpp index 7a83d1dbd728..3716402cc10b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassModifiers/getclmdf005/getclmdf005.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassModifiers/getclmdf005/getclmdf005.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -39,7 +39,7 @@ extern "C" { #define ACC_FINAL 0x0010 #define ACC_INTERFACE 0x0200 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -57,12 +57,12 @@ JNIEXPORT jint JNI_OnLoad_getclmdf005(JavaVM *jvm, char *options, void *reserved jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -75,7 +75,7 @@ Java_nsk_jvmti_GetClassModifiers_getclmdf005_check(JNIEnv *env, jclass cls, jint jvmtiError err; jint modifiers; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassModifiers/getclmdf006/getclmdf006.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassModifiers/getclmdf006/getclmdf006.cpp index d13e51d5a5da..de562a2a2b99 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassModifiers/getclmdf006/getclmdf006.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassModifiers/getclmdf006/getclmdf006.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -42,7 +42,7 @@ extern "C" { #define ACC_INTERFACE 0x0200 #define ACC_ABSTRACT 0x0400 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -60,12 +60,12 @@ JNIEXPORT jint JNI_OnLoad_getclmdf006(JavaVM *jvm, char *options, void *reserved jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -90,7 +90,7 @@ Java_nsk_jvmti_GetClassModifiers_getclmdf006_check(JNIEnv *env, jclass cls, jcla jvmtiError err; jint modifiers; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassModifiers/getclmdf007/getclmdf007.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassModifiers/getclmdf007/getclmdf007.cpp index f6742e15cd7a..cd698d4af9e2 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassModifiers/getclmdf007/getclmdf007.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassModifiers/getclmdf007/getclmdf007.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -42,7 +42,7 @@ extern "C" { #define ACC_INTERFACE 0x0200 #define ACC_ABSTRACT 0x0400 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -60,12 +60,12 @@ JNIEXPORT jint JNI_OnLoad_getclmdf007(JavaVM *jvm, char *options, void *reserved jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -91,7 +91,7 @@ Java_nsk_jvmti_GetClassModifiers_getclmdf007_check(JNIEnv *env, jclass cls, jint jint ArrayModifiers; jint ComponentModifiers; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassSignature/getclsig004/getclsig004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassSignature/getclsig004/getclsig004.cpp index 782a331729bb..ceb349091aa9 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassSignature/getclsig004/getclsig004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassSignature/getclsig004/getclsig004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; static const char *sigs[] = { @@ -63,12 +63,12 @@ JNIEXPORT jint JNI_OnLoad_getclsig004(JavaVM *jvm, char *options, void *reserved jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -82,7 +82,7 @@ Java_nsk_jvmti_GetClassSignature_getclsig004_check(JNIEnv *env, jvmtiError err; char *sig, *generic; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassSignature/getclsig005/getclsig005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassSignature/getclsig005/getclsig005.cpp index 149ab655a72e..2c60d39dc18a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassSignature/getclsig005/getclsig005.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassSignature/getclsig005/getclsig005.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -34,7 +34,7 @@ extern "C" { #define STATUS_FAILED 2 #define CLASS_SIGNATURE "Lnsk/jvmti/GetClassSignature/getclsig005;" -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -52,12 +52,12 @@ JNIEXPORT jint JNI_OnLoad_getclsig005(JavaVM *jvm, char *options, void *reserved jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -70,7 +70,7 @@ Java_nsk_jvmti_GetClassSignature_getclsig005_check(JNIEnv *env, jclass cls) { jvmtiError err; char *sig, *generic; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -78,7 +78,7 @@ Java_nsk_jvmti_GetClassSignature_getclsig005_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> invalid class check ...\n"); } - err = jvmti->GetClassSignature(NULL, &sig, &generic); + err = jvmti->GetClassSignature(nullptr, &sig, &generic); if (err != JVMTI_ERROR_INVALID_CLASS) { printf("Error expected: JVMTI_ERROR_INVALID_CLASS,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -88,7 +88,7 @@ Java_nsk_jvmti_GetClassSignature_getclsig005_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> (signature_ptr) null pointer check ...\n"); } - err = jvmti->GetClassSignature(cls, NULL, &generic); + err = jvmti->GetClassSignature(cls, nullptr, &generic); if (err != JVMTI_ERROR_NONE) { printf("(signature_ptr) unexpected error: %s (%d)\n", TranslateError(err), err); @@ -102,7 +102,7 @@ Java_nsk_jvmti_GetClassSignature_getclsig005_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> (generic_ptr) null pointer check ...\n"); } - err = jvmti->GetClassSignature(cls, &sig, NULL); + err = jvmti->GetClassSignature(cls, &sig, nullptr); if (err != JVMTI_ERROR_NONE) { printf("(generic_ptr) unexpected error: %s (%d)\n", TranslateError(err), err); @@ -111,7 +111,7 @@ Java_nsk_jvmti_GetClassSignature_getclsig005_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> sig = \"%s\"\n", sig); } - if (sig == NULL || strcmp(sig, CLASS_SIGNATURE) != 0) { + if (sig == nullptr || strcmp(sig, CLASS_SIGNATURE) != 0) { printf("Wrong class sig: \"%s\", expected: \"%s\"\n", CLASS_SIGNATURE, sig); result = STATUS_FAILED; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassSignature/getclsig006/getclsig006.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassSignature/getclsig006/getclsig006.cpp index acd3ed525782..246823d67ea5 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassSignature/getclsig006/getclsig006.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassSignature/getclsig006/getclsig006.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,12 +24,12 @@ #include #include #include -#include "agent_common.h" +#include "agent_common.hpp" -#include "nsk_tools.h" -#include "jni_tools.h" -#include "JVMTITools.h" -#include "jvmti_tools.h" +#include "nsk_tools.hpp" +#include "jni_tools.hpp" +#include "JVMTITools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -40,7 +40,7 @@ extern "C" { /* expected class signatures are below */ static const char *class_sig[][CLS_NUM] = { - { "getclsig006", "Lnsk/jvmti/GetClassSignature/getclsig006;", "NULL" }, + { "getclsig006", "Lnsk/jvmti/GetClassSignature/getclsig006;", "null" }, { "getclsig006b", "Lnsk/jvmti/GetClassSignature/getclsig006b;", "Ljava/lang/Object;" }, { "getclsig006c", "Lnsk/jvmti/GetClassSignature/getclsig006c;", @@ -51,7 +51,7 @@ static const char *class_sig[][CLS_NUM] = { "Ljava/lang/Object;" } }; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static int checkSig(JNIEnv *jni_env, jclass testedCls, int idx) { int totRes = PASSED; @@ -67,7 +67,7 @@ static int checkSig(JNIEnv *jni_env, jclass testedCls, int idx) { class_sig[idx][0]); if (strcmp(class_sig[idx][1], sign) != 0 || - strcmp(class_sig[idx][2], (gen_sign == NULL) ? "NULL" : gen_sign) != 0) { + strcmp(class_sig[idx][2], (gen_sign == nullptr) ? "null" : gen_sign) != 0) { NSK_COMPLAIN5( "TEST FAILED: class: \"%s\" has\n" "\tsignature: \"%s\"\n" @@ -75,19 +75,19 @@ static int checkSig(JNIEnv *jni_env, jclass testedCls, int idx) { "\tExpected: \"%s\"\n" "\t\"%s\"\n\n", class_sig[idx][0], - sign, (gen_sign == NULL) ? "NULL" : gen_sign, + sign, (gen_sign == nullptr) ? "null" : gen_sign, class_sig[idx][1], class_sig[idx][2]); totRes = STATUS_FAILED; } else NSK_DISPLAY2("CHECK PASSED: signature: \"%s\",\n\tgeneric signature: \"%s\"\n", - sign, (gen_sign == NULL) ? "NULL" : gen_sign); + sign, (gen_sign == nullptr) ? "null" : gen_sign); NSK_DISPLAY0("Deallocating the signature array\n"); if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*) sign))) { totRes = STATUS_FAILED; } - if (gen_sign != NULL) + if (gen_sign != nullptr) if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*) gen_sign))) { totRes = STATUS_FAILED; } @@ -105,7 +105,7 @@ Java_nsk_jvmti_GetClassSignature_getclsig006_check( jclass testedCls; for (i=0; iFindClass(class_sig[i][1])) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (testedCls = jni->FindClass(class_sig[i][1])) != nullptr)) { NSK_COMPLAIN1("TEST FAILURE: unable to find class \"%s\"\n\n", class_sig[i][0]); res = STATUS_FAILED; @@ -137,7 +137,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassStatus/getclstat005/getclstat005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassStatus/getclstat005/getclstat005.cpp index f348991f6704..ba6b1a197465 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassStatus/getclstat005/getclstat005.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassStatus/getclstat005/getclstat005.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_getclstat005(JavaVM *jvm, char *options, void *reserve jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -69,7 +69,7 @@ Java_nsk_jvmti_GetClassStatus_getclstat005_check(JNIEnv *env, jclass cls) { jvmtiError err; jint status; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -77,7 +77,7 @@ Java_nsk_jvmti_GetClassStatus_getclstat005_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> invalid class check ...\n"); } - err = jvmti->GetClassStatus(NULL, &status); + err = jvmti->GetClassStatus(nullptr, &status); if (err != JVMTI_ERROR_INVALID_CLASS) { printf("Error expected: JVMTI_ERROR_INVALID_CLASS,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -87,7 +87,7 @@ Java_nsk_jvmti_GetClassStatus_getclstat005_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> null pointer check ...\n"); } - err = jvmti->GetClassStatus(cls, NULL); + err = jvmti->GetClassStatus(cls, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { printf("Error expected: JVMTI_ERROR_NULL_POINTER,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassStatus/getclstat006/getclstat006.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassStatus/getclstat006/getclstat006.cpp index 8f8a5d38820c..666fa3e0db09 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassStatus/getclstat006/getclstat006.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassStatus/getclstat006/getclstat006.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -38,7 +38,7 @@ typedef struct { const char *name; } bit_info; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; static bit_info bits[] = { @@ -60,12 +60,12 @@ JNIEXPORT jint JNI_OnLoad_getclstat006(JavaVM *jvm, char *options, void *reserve jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -78,7 +78,7 @@ Java_nsk_jvmti_GetClassStatus_getclstat006_check(JNIEnv *env, jclass cls, jint i jvmtiError err; jint status; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassStatus/getclstat007/getclstat007.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassStatus/getclstat007/getclstat007.cpp index ed1ce5ace779..4958e015c3a7 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassStatus/getclstat007/getclstat007.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetClassStatus/getclstat007/getclstat007.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_getclstat007(JavaVM *jvm, char *options, void *reserve jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -70,7 +70,7 @@ Java_nsk_jvmti_GetClassStatus_getclstat007_check(JNIEnv *env, jclass cls, jvmtiError err; jint status; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetCurrentThreadCpuTime/curthrcputime001/curthrcputime001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetCurrentThreadCpuTime/curthrcputime001/curthrcputime001.cpp index 3e7fcdd1b17b..7e2d7d6f8f41 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetCurrentThreadCpuTime/curthrcputime001/curthrcputime001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetCurrentThreadCpuTime/curthrcputime001/curthrcputime001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,9 +24,9 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -80,7 +80,7 @@ static int checkCpuTime(jvmtiEnv* jvmti, jthread thread, julong* time, where, julong_to_string(*time, buf)); } - if (prevTime != NULL) { + if (prevTime != nullptr) { julong diff = *time - *prevTime; NSK_DISPLAY1("Compare with previous time: %s\n", @@ -147,7 +147,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0(">>> Testcase #2: Check initial cpu time in agent thread\n"); { - if (!checkCpuTime(jvmti, testAgentThread, &prevAgentThreadTime, NULL, "agent thread")) { + if (!checkCpuTime(jvmti, testAgentThread, &prevAgentThreadTime, nullptr, "agent thread")) { nsk_jvmti_setFailStatus(); } } @@ -157,7 +157,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { runIterations(iterations); NSK_DISPLAY1("Enable thread events: %d events\n", THREAD_EVENTS_COUNT); - if (nsk_jvmti_enableEvents(JVMTI_ENABLE, THREAD_EVENTS_COUNT, threadEvents, NULL)) { + if (nsk_jvmti_enableEvents(JVMTI_ENABLE, THREAD_EVENTS_COUNT, threadEvents, nullptr)) { NSK_DISPLAY0(" ... enabled\n"); } @@ -184,7 +184,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { return; NSK_DISPLAY1("Disable thread events: %d events\n", THREAD_EVENTS_COUNT); - if (nsk_jvmti_enableEvents(JVMTI_DISABLE, THREAD_EVENTS_COUNT, threadEvents, NULL)) { + if (nsk_jvmti_enableEvents(JVMTI_DISABLE, THREAD_EVENTS_COUNT, threadEvents, nullptr)) { NSK_DISPLAY0(" ... disabled\n"); } } @@ -214,7 +214,7 @@ callbackVMInit(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { NSK_DISPLAY0(">>> Testcase #1: Check initial cpu time in VM_INIT callback\n"); { julong time = 0; - if (!checkCpuTime(jvmti, thread, &time, NULL, "VM_INIT callback")) { + if (!checkCpuTime(jvmti, thread, &time, nullptr, "VM_INIT callback")) { nsk_jvmti_setFailStatus(); } } @@ -230,14 +230,14 @@ callbackVMDeath(jvmtiEnv* jvmti, JNIEnv* jni) { NSK_DISPLAY0(">>> Testcase #7: Check initial cpu time in VM_DEATH callback\n"); { julong time = 0; - if (!checkCpuTime(jvmti, NULL, &time, NULL, "VM_DEATH callback")) { + if (!checkCpuTime(jvmti, nullptr, &time, nullptr, "VM_DEATH callback")) { success = NSK_FALSE; nsk_jvmti_setFailStatus(); } } NSK_DISPLAY1("Disable events: %d events\n", EVENTS_COUNT); - if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, NULL)) { + if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, nullptr)) { success = NSK_FALSE; } else { NSK_DISPLAY0(" ... disabled\n"); @@ -266,9 +266,9 @@ callbackThreadStart(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { NSK_DISPLAY1(" for thread: %s\n", nsk_null_string(threadInfo.name)); } - if (threadInfo.name != NULL && strcmp(threadInfo.name, TESTED_THREAD_NAME) == 0) { + if (threadInfo.name != nullptr && strcmp(threadInfo.name, TESTED_THREAD_NAME) == 0) { NSK_DISPLAY0(">>> Testcase #3: Check initial cpu time in THREAD_START callback\n"); - if (!checkCpuTime(jvmti, thread, &prevTestedThreadTime, NULL, "THREAD_START callback")) { + if (!checkCpuTime(jvmti, thread, &prevTestedThreadTime, nullptr, "THREAD_START callback")) { nsk_jvmti_setFailStatus(); } } @@ -289,7 +289,7 @@ callbackThreadEnd(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { NSK_DISPLAY1(" for thread: %s\n", nsk_null_string(threadInfo.name)); } - if (threadInfo.name != NULL && strcmp(threadInfo.name, TESTED_THREAD_NAME) == 0) { + if (threadInfo.name != nullptr && strcmp(threadInfo.name, TESTED_THREAD_NAME) == 0) { julong time = 0; NSK_DISPLAY0(">>> Testcase #5: Check final cpu time in THREAD_END callback\n"); if (!checkCpuTime(jvmti, thread, &time, &prevTestedThreadTime, "THREAD_END callback")) { @@ -313,7 +313,7 @@ JNIEXPORT jint JNI_OnLoad_curthrcputime001(JavaVM *jvm, char *options, void *res } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -325,7 +325,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; NSK_DISPLAY1("Add required capability: %s\n", "can_get_current_thread_cpu_time"); @@ -355,11 +355,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } NSK_DISPLAY0(" ... callbacks set\n"); - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; NSK_DISPLAY1("Enable events: %d events\n", EVENTS_COUNT); - if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, NULL)) { + if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, nullptr)) { NSK_DISPLAY0(" ... enabled\n"); } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetCurrentThreadCpuTimerInfo/curthrtimerinfo001/curthrtimerinfo001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetCurrentThreadCpuTimerInfo/curthrtimerinfo001/curthrtimerinfo001.cpp index cf22a491b082..cbb40a0df06e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetCurrentThreadCpuTimerInfo/curthrtimerinfo001/curthrtimerinfo001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetCurrentThreadCpuTimerInfo/curthrtimerinfo001/curthrtimerinfo001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,9 +24,9 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -76,7 +76,7 @@ static int checkTimerInfo(jvmtiEnv* jvmti, jvmtiTimerInfo* info, NSK_DISPLAY1(" may_skip_forward: %d\n", (int)info->may_skip_forward); NSK_DISPLAY1(" may_skip_backward: %d\n", (int)info->may_skip_backward); - if (initInfo != NULL) { + if (initInfo != nullptr) { NSK_DISPLAY0("Compare with initial timer info\n"); if (info->max_value != initInfo->max_value) { NSK_COMPLAIN4("In %s GetCurrentThreadCpuTimerInfo() returned different info:\n" @@ -132,7 +132,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0(">>> Testcases #3,4: Check timer info in thread events\n"); { NSK_DISPLAY1("Enable thread events: %d events\n", THREAD_EVENTS_COUNT); - if (nsk_jvmti_enableEvents(JVMTI_ENABLE, THREAD_EVENTS_COUNT, threadEvents, NULL)) { + if (nsk_jvmti_enableEvents(JVMTI_ENABLE, THREAD_EVENTS_COUNT, threadEvents, nullptr)) { NSK_DISPLAY0(" ... enabled\n"); } @@ -143,7 +143,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { return; NSK_DISPLAY1("Disable thread events: %d events\n", THREAD_EVENTS_COUNT); - if (nsk_jvmti_enableEvents(JVMTI_DISABLE, THREAD_EVENTS_COUNT, threadEvents, NULL)) { + if (nsk_jvmti_enableEvents(JVMTI_DISABLE, THREAD_EVENTS_COUNT, threadEvents, nullptr)) { NSK_DISPLAY0(" ... disabled\n"); } } @@ -163,7 +163,7 @@ callbackVMInit(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { NSK_DISPLAY0(">>> Testcase #1: Check initial timer info in VM_INIT callback\n"); { - if (!checkTimerInfo(jvmti, &initInfo, NULL, "VM_INIT callback")) { + if (!checkTimerInfo(jvmti, &initInfo, nullptr, "VM_INIT callback")) { nsk_jvmti_setFailStatus(); } } @@ -183,7 +183,7 @@ callbackVMDeath(jvmtiEnv* jvmti, JNIEnv* jni) { } NSK_DISPLAY1("Disable events: %d events\n", EVENTS_COUNT); - if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, NULL)) { + if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, nullptr)) { success = NSK_FALSE; } else { NSK_DISPLAY0(" ... disabled\n"); @@ -242,7 +242,7 @@ JNIEXPORT jint JNI_OnLoad_curthrtimerinfo001(JavaVM *jvm, char *options, void *r } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -250,7 +250,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; NSK_DISPLAY1("Add required capability: %s\n", "can_get_current_thread_cpu_time"); @@ -282,11 +282,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } NSK_DISPLAY0(" ... callbacks set\n"); - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; NSK_DISPLAY1("Enable events: %d events\n", EVENTS_COUNT); - if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, NULL)) { + if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, nullptr)) { NSK_DISPLAY0(" ... enabled\n"); } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetEnv/GetEnv001/GetEnv001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetEnv/GetEnv001/GetEnv001.cpp index 0a6ba80bf703..cad70dfbd13c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetEnv/GetEnv001/GetEnv001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetEnv/GetEnv001/GetEnv001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,9 +25,9 @@ #include #include #include -#include "agent_common.h" -#include -#include "JVMTITools.h" +#include "agent_common.hpp" +#include +#include "JVMTITools.hpp" extern "C" { @@ -87,7 +87,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) return JNI_ERR; } - if (vm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1) != JNI_OK || jvmti == NULL) { + if (vm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1) != JNI_OK || jvmti == nullptr) { NSK_COMPLAIN0("JVMTI_VERSION_1_1 isn't supported."); return JNI_OK; } @@ -109,7 +109,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) return JNI_ERR; // Enable class retransformation - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetEnvironmentLocalStorage/getenvstor001/getenvstor001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetEnvironmentLocalStorage/getenvstor001/getenvstor001.cpp index c196ea89f1d3..b4735fe338c6 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetEnvironmentLocalStorage/getenvstor001/getenvstor001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetEnvironmentLocalStorage/getenvstor001/getenvstor001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,9 +24,9 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -50,7 +50,7 @@ static jvmtiEvent events[EVENTS_COUNT] = { * @returns NSK_FALSE if any error occured. */ static int checkEnvStorage(jvmtiEnv* jvmti, const char where[]) { - void* storage = NULL; + void* storage = nullptr; NSK_DISPLAY0("GetEnvironmentLocalStorage() for current JVMTI env\n"); if (!NSK_JVMTI_VERIFY(jvmti->GetEnvironmentLocalStorage(&storage))) { @@ -58,8 +58,8 @@ static int checkEnvStorage(jvmtiEnv* jvmti, const char where[]) { } NSK_DISPLAY1(" ... got storage: 0x%p\n", (void*)storage); - if (storage != NULL) { - NSK_COMPLAIN2("GetEnvironmentLocalStorage() returned NOT NULL storage in %s:\n" + if (storage != nullptr) { + NSK_COMPLAIN2("GetEnvironmentLocalStorage() returned NOT null storage in %s:\n" "# storage pointer: 0x%p\n", where, (void*)storage); return NSK_FALSE; @@ -113,7 +113,7 @@ callbackVMDeath(jvmtiEnv* jvmti, JNIEnv* jni) { success = checkEnvStorage(jvmti, "VM_DEATH callback"); NSK_DISPLAY1("Disable events: %d events\n", EVENTS_COUNT); - if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, NULL)) { + if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, nullptr)) { success = NSK_FALSE; } else { NSK_DISPLAY0(" ... disabled\n"); @@ -140,7 +140,7 @@ JNIEXPORT jint JNI_OnLoad_getenvstor001(JavaVM *jvm, char *options, void *reserv } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -148,7 +148,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; { @@ -163,7 +163,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; NSK_DISPLAY0(">>> Testcase #1: Check env storage in JVM_OnLoad()\n"); @@ -172,7 +172,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } NSK_DISPLAY1("Enable events: %d events\n", EVENTS_COUNT); - if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, NULL)) { + if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, nullptr)) { NSK_DISPLAY0(" ... enabled\n"); } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetErrorName/geterrname001/geterrname001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetErrorName/geterrname001/geterrname001.cpp index cc0aa8ba792e..d06c4a05339f 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetErrorName/geterrname001/geterrname001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetErrorName/geterrname001/geterrname001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -253,7 +253,7 @@ JNIEXPORT jint JNI_OnLoad_geterrname001(JavaVM *jvm, char *options, void *reserv } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv *jvmti = NULL; + jvmtiEnv *jvmti = nullptr; jvmtiEventCallbacks callbacks; /* init framework and parse options */ @@ -265,7 +265,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* Create data access lock */ @@ -290,16 +290,16 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* enable VMInit event */ if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL))) + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, nullptr))) return JNI_ERR; /* enable ClassFileLoadHook event */ if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL))) + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, nullptr))) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetErrorName/geterrname002/geterrname002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetErrorName/geterrname002/geterrname002.cpp index 05937d628920..6b52d237e76d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetErrorName/geterrname002/geterrname002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetErrorName/geterrname002/geterrname002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,9 +22,9 @@ */ #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -53,7 +53,7 @@ agentProc(jvmtiEnv *jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0("Testcase #2: check on JVMTI_ERROR_NULL_POINTER\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_NULL_POINTER, - jvmti->GetErrorName(JVMTI_ERROR_NONE, NULL))) + jvmti->GetErrorName(JVMTI_ERROR_NONE, nullptr))) nsk_jvmti_setFailStatus(); /* resume debugee after last sync */ @@ -76,7 +76,7 @@ JNIEXPORT jint JNI_OnLoad_geterrname002(JavaVM *jvm, char *options, void *reserv } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv *jvmti = NULL; + jvmtiEnv *jvmti = nullptr; /* init framework and parse options */ if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) @@ -89,11 +89,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetExtensionEvents/extevents001/extevents001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetExtensionEvents/extevents001/extevents001.cpp index 24edbbbd494c..e071724a97bf 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetExtensionEvents/extevents001/extevents001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetExtensionEvents/extevents001/extevents001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -50,7 +50,7 @@ static jlong timeout = 0; static int checkExtensions(jvmtiEnv* jvmti, const char phase[]) { int success = NSK_TRUE; jint extCount = 0; - jvmtiExtensionEventInfo* extList = NULL; + jvmtiExtensionEventInfo* extList = nullptr; int i; NSK_DISPLAY0("Get extension events list\n"); @@ -61,8 +61,8 @@ static int checkExtensions(jvmtiEnv* jvmti, const char phase[]) { NSK_DISPLAY1(" ... got list: 0x%p\n", (void*)extList); if (extCount > 0) { - if (extList == NULL) { - NSK_COMPLAIN3("In %s phase GetExtensionEvents() returned NULL pointer:\n" + if (extList == nullptr) { + NSK_COMPLAIN3("In %s phase GetExtensionEvents() returned null pointer:\n" "# extensions pointer: 0x%p\n" "# extensions count: %d\n", phase, (void*)extList, (int)extCount); @@ -80,7 +80,7 @@ static int checkExtensions(jvmtiEnv* jvmti, const char phase[]) { NSK_DISPLAY1(" param_count: %d\n", (int)extList[i].param_count); NSK_DISPLAY1(" params: 0x%p\n", (void*)extList[i].params); - if (extList[i].params != NULL) { + if (extList[i].params != nullptr) { for (j = 0; j < extList[i].param_count; j++) { NSK_DISPLAY1(" param #%d:\n", j); NSK_DISPLAY1(" name: \"%s\"\n", @@ -94,10 +94,10 @@ static int checkExtensions(jvmtiEnv* jvmti, const char phase[]) { } } - if (extList[i].id == NULL - || extList[i].short_description == NULL - || (extList[i].params == NULL && extList[i].param_count > 0)) { - NSK_COMPLAIN9("In %s phase GetExtensionEvents() returned event #%d with NULL attribute(s):\n" + if (extList[i].id == nullptr + || extList[i].short_description == nullptr + || (extList[i].params == nullptr && extList[i].param_count > 0)) { + NSK_COMPLAIN9("In %s phase GetExtensionEvents() returned event #%d with null attribute(s):\n" "# event_index: %d\n" "# id: 0x%p (%s)\n" "# short_desc: 0x%p (%s)\n" @@ -111,7 +111,7 @@ static int checkExtensions(jvmtiEnv* jvmti, const char phase[]) { success = NSK_FALSE; } - if (extList[i].id != NULL && strlen(extList[i].id) <= 0) { + if (extList[i].id != nullptr && strlen(extList[i].id) <= 0) { NSK_COMPLAIN6("In %s phase GetExtensionEvents() returned event #%d with empty id:\n" "# event_index: %d\n" "# id: \"%s\"\n" @@ -123,7 +123,7 @@ static int checkExtensions(jvmtiEnv* jvmti, const char phase[]) { nsk_null_string(extList[i].short_description), (int)extList[i].param_count); success = NSK_FALSE; - } else if (strstr(extList[i].id, NAME_PREFIX) == NULL) { + } else if (strstr(extList[i].id, NAME_PREFIX) == nullptr) { NSK_COMPLAIN6("In %s phase GetExtensionEvents() returned event #%d with unexpected id:\n" "# event_index: %d\n" "# id: \"%s\"\n" @@ -137,7 +137,7 @@ static int checkExtensions(jvmtiEnv* jvmti, const char phase[]) { success = NSK_FALSE; } - if (extList[i].short_description != NULL && strlen(extList[i].short_description) <= 0) { + if (extList[i].short_description != nullptr && strlen(extList[i].short_description) <= 0) { NSK_COMPLAIN6("In %s phase GetExtensionEvents() returned event #%d with empty desc:\n" "# event_index: %d\n" "# id: \"%s\"\n" @@ -151,9 +151,9 @@ static int checkExtensions(jvmtiEnv* jvmti, const char phase[]) { success = NSK_FALSE; } - if (extList[i].param_count > 0 && extList[i].params != NULL) { + if (extList[i].param_count > 0 && extList[i].params != nullptr) { for (j = 0; j < extList[i].param_count; j++) { - if (extList[i].params[j].name == NULL + if (extList[i].params[j].name == nullptr || strlen(extList[i].params[j].name) <= 0) { NSK_COMPLAIN9("In %s phase GetExtensionEvents() returned event #%d with empty desc:\n" "# event_index: %d\n" @@ -262,7 +262,7 @@ JNIEXPORT jint JNI_OnLoad_extevents001(JavaVM *jvm, char *options, void *reserve } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -270,7 +270,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; NSK_DISPLAY0(">>> Testcase #1: Check extension events in OnLoad phase\n"); @@ -280,7 +280,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetExtensionFunctions/extfuncs001/extfuncs001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetExtensionFunctions/extfuncs001/extfuncs001.cpp index 60f573c2b717..b6fc95128d6b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetExtensionFunctions/extfuncs001/extfuncs001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetExtensionFunctions/extfuncs001/extfuncs001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -49,7 +49,7 @@ static jlong timeout = 0; static int checkExtensions(jvmtiEnv* jvmti, const char phase[]) { int success = NSK_TRUE; jint extCount = 0; - jvmtiExtensionFunctionInfo* extList = NULL; + jvmtiExtensionFunctionInfo* extList = nullptr; int i; NSK_DISPLAY0("Get extension functions list\n"); @@ -60,8 +60,8 @@ static int checkExtensions(jvmtiEnv* jvmti, const char phase[]) { NSK_DISPLAY1(" ... got list: 0x%p\n", (void*)extList); if (extCount > 0) { - if (extList == NULL) { - NSK_COMPLAIN3("In %s phase GetExtensionFunctions() returned NULL pointer:\n" + if (extList == nullptr) { + NSK_COMPLAIN3("In %s phase GetExtensionFunctions() returned null pointer:\n" "# extensions pointer: 0x%p\n" "# extensions count: %d\n", phase, (void*)extList, (int)extCount); @@ -79,7 +79,7 @@ static int checkExtensions(jvmtiEnv* jvmti, const char phase[]) { NSK_DISPLAY1(" param_count: %d\n", (int)extList[i].param_count); NSK_DISPLAY1(" params: 0x%p\n", (void*)extList[i].params); - if (extList[i].params != NULL) { + if (extList[i].params != nullptr) { for (j = 0; j < extList[i].param_count; j++) { NSK_DISPLAY1(" param #%d:\n", j); NSK_DISPLAY1(" name: \"%s\"\n", @@ -96,19 +96,19 @@ static int checkExtensions(jvmtiEnv* jvmti, const char phase[]) { NSK_DISPLAY1(" error_count: %d\n", (int)extList[i].error_count); NSK_DISPLAY1(" errors: 0x%p\n", (void*)extList[i].errors); - if (extList[i].errors != NULL) { + if (extList[i].errors != nullptr) { for (j = 0; j < extList[i].error_count; j++) { NSK_DISPLAY2(" error #%d: %d\n", j, (int)extList[i].errors[j]); } } - if (extList[i].func == NULL - || extList[i].id == NULL - || extList[i].short_description == NULL - || (extList[i].params == NULL && extList[i].param_count > 0) - || (extList[i].errors == NULL && extList[i].error_count > 0)) { - NSK_COMPLAIN9("In %s phase GetExtensionFunctions() returned function #%d with NULL attribute(s):\n" + if (extList[i].func == nullptr + || extList[i].id == nullptr + || extList[i].short_description == nullptr + || (extList[i].params == nullptr && extList[i].param_count > 0) + || (extList[i].errors == nullptr && extList[i].error_count > 0)) { + NSK_COMPLAIN9("In %s phase GetExtensionFunctions() returned function #%d with null attribute(s):\n" "# func: 0x%p\n" "# id: 0x%p (%s)\n" "# short_desc: 0x%p (%s)\n" @@ -122,7 +122,7 @@ static int checkExtensions(jvmtiEnv* jvmti, const char phase[]) { success = NSK_FALSE; } - if (extList[i].id != NULL && strlen(extList[i].id) <= 0) { + if (extList[i].id != nullptr && strlen(extList[i].id) <= 0) { NSK_COMPLAIN6("In %s phase GetExtensionFunctions() returned function #%d with empty id:\n" "# func: 0x%p\n" "# id: \"%s\"\n" @@ -134,7 +134,7 @@ static int checkExtensions(jvmtiEnv* jvmti, const char phase[]) { nsk_null_string(extList[i].short_description), (int)extList[i].param_count); success = NSK_FALSE; - } else if (strstr(extList[i].id, NAME_PREFIX) == NULL) { + } else if (strstr(extList[i].id, NAME_PREFIX) == nullptr) { NSK_COMPLAIN6("In %s phase GetExtensionFunctions() returned function #%d with unexpected id:\n" "# func: 0x%p\n" "# id: \"%s\"\n" @@ -148,7 +148,7 @@ static int checkExtensions(jvmtiEnv* jvmti, const char phase[]) { success = NSK_FALSE; } - if (extList[i].short_description != NULL && strlen(extList[i].short_description) <= 0) { + if (extList[i].short_description != nullptr && strlen(extList[i].short_description) <= 0) { NSK_COMPLAIN6("In %s phase GetExtensionFunctions() returned function #%d with empty desc:\n" "# func: 0x%p\n" "# id: \"%s\"\n" @@ -162,9 +162,9 @@ static int checkExtensions(jvmtiEnv* jvmti, const char phase[]) { success = NSK_FALSE; } - if (extList[i].param_count > 0 && extList[i].params != NULL) { + if (extList[i].param_count > 0 && extList[i].params != nullptr) { for (j = 0; j < extList[i].param_count; j++) { - if (extList[i].params[j].name == NULL + if (extList[i].params[j].name == nullptr || strlen(extList[i].params[j].name) <= 0) { NSK_COMPLAIN9("In %s phase GetExtensionFunctions() returned function #%d with empty desc:\n" "# func: 0x%p\n" @@ -273,7 +273,7 @@ JNIEXPORT jint JNI_OnLoad_extfuncs001(JavaVM *jvm, char *options, void *reserved } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -281,7 +281,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; NSK_DISPLAY0(">>> Testcase #1: Check extension functions in OnLoad phase\n"); @@ -291,7 +291,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldDeclaringClass/getfldecl001/getfldecl001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldDeclaringClass/getfldecl001/getfldecl001.cpp index 9c1e9b050c93..385dbd233542 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldDeclaringClass/getfldecl001/getfldecl001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldDeclaringClass/getfldecl001/getfldecl001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; static const char* fields[] = { "x", "y", "z" }; @@ -52,12 +52,12 @@ JNIEXPORT jint JNI_OnLoad_getfldecl001(JavaVM *jvm, char *options, void *reserve jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -73,7 +73,7 @@ Java_nsk_jvmti_GetFieldDeclaringClass_getfldecl001_check(JNIEnv *env, jclass declaringClass; char *sig, *generic; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; @@ -84,7 +84,7 @@ Java_nsk_jvmti_GetFieldDeclaringClass_getfldecl001_check(JNIEnv *env, } else { fid = env->GetFieldID(cls1, fields[i], "I"); } - if (fid == NULL) { + if (fid == nullptr) { printf("(%d) cannot get field ID for %s:\"I\"\n", i, fields[i]); result = STATUS_FAILED; return; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldDeclaringClass/getfldecl002/getfldecl002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldDeclaringClass/getfldecl002/getfldecl002.cpp index 10ba137744ca..77b926f1383e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldDeclaringClass/getfldecl002/getfldecl002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldDeclaringClass/getfldecl002/getfldecl002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; static const char* fields[] = { "const1", "fld", "xx" }; @@ -52,12 +52,12 @@ JNIEXPORT jint JNI_OnLoad_getfldecl002(JavaVM *jvm, char *options, void *reserve jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -73,7 +73,7 @@ Java_nsk_jvmti_GetFieldDeclaringClass_getfldecl002_check(JNIEnv *env, jclass declaringClass; char *sig, *generic; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; @@ -84,7 +84,7 @@ Java_nsk_jvmti_GetFieldDeclaringClass_getfldecl002_check(JNIEnv *env, } else { fid = env->GetFieldID(cls1, fields[i], "I"); } - if (fid == NULL) { + if (fid == nullptr) { printf("(%d) cannot get field ID for %s:\"I\"\n", i, fields[i]); result = STATUS_FAILED; return; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldDeclaringClass/getfldecl004/getfldecl004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldDeclaringClass/getfldecl004/getfldecl004.cpp index 1661a4dc28ed..cc967123c5cf 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldDeclaringClass/getfldecl004/getfldecl004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldDeclaringClass/getfldecl004/getfldecl004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -39,7 +39,7 @@ typedef struct { jboolean is_static; } field_info; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; static field_info fields[] = { @@ -71,12 +71,12 @@ JNIEXPORT jint JNI_OnLoad_getfldecl004(JavaVM *jvm, char *options, void *reserve jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -92,7 +92,7 @@ Java_nsk_jvmti_GetFieldDeclaringClass_getfldecl004_check(JNIEnv *env, jclass declaringClass; char *sig, *generic; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; @@ -103,7 +103,7 @@ Java_nsk_jvmti_GetFieldDeclaringClass_getfldecl004_check(JNIEnv *env, } else { fid = env->GetFieldID(cls1, fields[i].name, fields[i].sig); } - if (fid == NULL) { + if (fid == nullptr) { printf("(%d) cannot get field ID for %s:\"%s\"\n", i, fields[i].name, fields[i].sig); result = STATUS_FAILED; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldModifiers/getfldmdf003/getfldmdf003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldModifiers/getfldmdf003/getfldmdf003.cpp index e112f59ab600..2ef792ba9a11 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldModifiers/getfldmdf003/getfldmdf003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldModifiers/getfldmdf003/getfldmdf003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_getfldmdf003(JavaVM *jvm, char *options, void *reserve jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -70,13 +70,13 @@ Java_nsk_jvmti_GetFieldModifiers_getfldmdf003_check(JNIEnv *env, jclass cls) { jfieldID fid; jint modifiers; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } fid = env->GetFieldID(cls, "fld", "I"); - if (fid == NULL) { + if (fid == nullptr) { printf("Cannot get field ID!\n"); return STATUS_FAILED; } @@ -84,7 +84,7 @@ Java_nsk_jvmti_GetFieldModifiers_getfldmdf003_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> invalid class check ...\n"); } - err = jvmti->GetFieldModifiers(NULL, fid, &modifiers); + err = jvmti->GetFieldModifiers(nullptr, fid, &modifiers); if (err != JVMTI_ERROR_INVALID_CLASS) { printf("Error expected: JVMTI_ERROR_INVALID_CLASS,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -94,7 +94,7 @@ Java_nsk_jvmti_GetFieldModifiers_getfldmdf003_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> invalid field check ...\n"); } - err = jvmti->GetFieldModifiers(cls, NULL, &modifiers); + err = jvmti->GetFieldModifiers(cls, nullptr, &modifiers); if (err != JVMTI_ERROR_INVALID_FIELDID) { printf("Error expected: JVMTI_ERROR_INVALID_FIELDID,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -104,7 +104,7 @@ Java_nsk_jvmti_GetFieldModifiers_getfldmdf003_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> null pointer check ...\n"); } - err = jvmti->GetFieldModifiers(cls, fid, NULL); + err = jvmti->GetFieldModifiers(cls, fid, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { printf("(namePtr) error expected: JVMTI_ERROR_NULL_POINTER,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldModifiers/getfldmdf004/getfldmdf004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldModifiers/getfldmdf004/getfldmdf004.cpp index ab10f30398ee..672a62b89464 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldModifiers/getfldmdf004/getfldmdf004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldModifiers/getfldmdf004/getfldmdf004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -51,7 +51,7 @@ typedef struct { jboolean is_static; } field_info; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; static field_info fields[] = { @@ -120,12 +120,12 @@ JNIEXPORT jint JNI_OnLoad_getfldmdf004(JavaVM *jvm, char *options, void *reserve jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -155,7 +155,7 @@ Java_nsk_jvmti_GetFieldModifiers_getfldmdf004_check(JNIEnv *env, jfieldID fid; jint modifiers; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; @@ -166,7 +166,7 @@ Java_nsk_jvmti_GetFieldModifiers_getfldmdf004_check(JNIEnv *env, } else { fid = env->GetFieldID(cls, fields[i].name, fields[i].sig); } - if (fid == NULL) { + if (fid == nullptr) { printf("(%d) cannot get field ID for %s:\"%s\"\n", i, fields[i].name, fields[i].sig); result = STATUS_FAILED; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldName/getfldnm003/getfldnm003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldName/getfldnm003/getfldnm003.cpp index 643f0ce376df..9a6fcf21e658 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldName/getfldnm003/getfldnm003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldName/getfldnm003/getfldnm003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_getfldnm003(JavaVM *jvm, char *options, void *reserved jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -70,13 +70,13 @@ Java_nsk_jvmti_GetFieldName_getfldnm003_check(JNIEnv *env, jclass cls) { jfieldID field; char *name, *sig, *generic; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } field = env->GetFieldID(cls, "fld", "I"); - if (field == NULL) { + if (field == nullptr) { printf("Cannot get field ID!\n"); return STATUS_FAILED; } @@ -84,7 +84,7 @@ Java_nsk_jvmti_GetFieldName_getfldnm003_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> invalid class check ...\n"); } - err = jvmti->GetFieldName(NULL, field, &name, &sig, &generic); + err = jvmti->GetFieldName(nullptr, field, &name, &sig, &generic); if (err != JVMTI_ERROR_INVALID_CLASS) { printf("Error expected: JVMTI_ERROR_INVALID_CLASS,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -94,7 +94,7 @@ Java_nsk_jvmti_GetFieldName_getfldnm003_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> invalid field check ...\n"); } - err = jvmti->GetFieldName(cls, NULL, &name, &sig, &generic); + err = jvmti->GetFieldName(cls, nullptr, &name, &sig, &generic); if (err != JVMTI_ERROR_INVALID_FIELDID) { printf("Error expected: JVMTI_ERROR_INVALID_FIELDID,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -104,7 +104,7 @@ Java_nsk_jvmti_GetFieldName_getfldnm003_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> (namePtr) null pointer check ...\n"); } - err = jvmti->GetFieldName(cls, field, NULL, &sig, &generic); + err = jvmti->GetFieldName(cls, field, nullptr, &sig, &generic); if (err != JVMTI_ERROR_NONE) { printf("(name_ptr) unexpected error: %s (%d)\n", TranslateError(err), err); @@ -113,7 +113,7 @@ Java_nsk_jvmti_GetFieldName_getfldnm003_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> sig = \"%s\", generic = \"%s\"\n", sig, generic); } - if (sig == NULL || strcmp(sig, "I") != 0) { + if (sig == nullptr || strcmp(sig, "I") != 0) { printf("Wrong field sig: \"%s\", expected: \"I\"\n", sig); result = STATUS_FAILED; } @@ -122,7 +122,7 @@ Java_nsk_jvmti_GetFieldName_getfldnm003_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> (signature_ptr) null pointer check ...\n"); } - err = jvmti->GetFieldName(cls, field, &name, NULL, &generic); + err = jvmti->GetFieldName(cls, field, &name, nullptr, &generic); if (err != JVMTI_ERROR_NONE) { printf("(signaturePtr) unexpected error: %s (%d)\n", TranslateError(err), err); @@ -131,7 +131,7 @@ Java_nsk_jvmti_GetFieldName_getfldnm003_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> name = \"%s\", generic = \"%s\"\n", name, generic); } - if (name == NULL || strcmp(name, "fld") != 0) { + if (name == nullptr || strcmp(name, "fld") != 0) { printf("Wrong field name: \"%s\", expected: \"fld\"\n", name); result = STATUS_FAILED; } @@ -140,7 +140,7 @@ Java_nsk_jvmti_GetFieldName_getfldnm003_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> (generic_ptr) null pointer check ...\n"); } - err = jvmti->GetFieldName(cls, field, &name, &sig, NULL); + err = jvmti->GetFieldName(cls, field, &name, &sig, nullptr); if (err != JVMTI_ERROR_NONE) { printf("(signaturePtr) unexpected error: %s (%d)\n", TranslateError(err), err); @@ -149,11 +149,11 @@ Java_nsk_jvmti_GetFieldName_getfldnm003_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> name = \"%s\", sig = \"%s\"\n", name, sig); } - if (name == NULL || strcmp(name, "fld") != 0) { + if (name == nullptr || strcmp(name, "fld") != 0) { printf("Wrong field name: \"%s\", expected: \"fld\"\n", name); result = STATUS_FAILED; } - if (sig == NULL || strcmp(sig, "I") != 0) { + if (sig == nullptr || strcmp(sig, "I") != 0) { printf("Wrong field sig: \"%s\", expected: \"I\"\n", sig); result = STATUS_FAILED; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldName/getfldnm004/getfldnm004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldName/getfldnm004/getfldnm004.cpp index 5cb6eca8ddf3..0f035f3a84ca 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldName/getfldnm004/getfldnm004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldName/getfldnm004/getfldnm004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -40,7 +40,7 @@ typedef struct { jboolean is_static; } field_info; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; static field_info fields[] = { @@ -81,12 +81,12 @@ JNIEXPORT jint JNI_OnLoad_getfldnm004(JavaVM *jvm, char *options, void *reserved jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -102,7 +102,7 @@ Java_nsk_jvmti_GetFieldName_getfldnm004_check(JNIEnv *env, char *name, *sig, *generic; size_t i; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -115,7 +115,7 @@ Java_nsk_jvmti_GetFieldName_getfldnm004_check(JNIEnv *env, fid = env->GetFieldID( clazz, fields[i].name, fields[i].sig); } - if (fid == NULL) { + if (fid == nullptr) { printf("(%" PRIuPTR ") cannot get field ID for %s:\"%s\"\n", i, fields[i].name, fields[i].sig); result = STATUS_FAILED; @@ -131,12 +131,12 @@ Java_nsk_jvmti_GetFieldName_getfldnm004_check(JNIEnv *env, if (printdump == JNI_TRUE) { printf(">>> %" PRIuPTR " -- %s:\"%s\"\n", i, name, sig); } - if (name == NULL || strcmp(name, fields[i].name) != 0) { + if (name == nullptr || strcmp(name, fields[i].name) != 0) { printf("(%" PRIuPTR ") wrong field name: \"%s\"", i, name); printf(", expected: \"%s\"\n", fields[i].name); result = STATUS_FAILED; } - if (sig == NULL || strcmp(sig, fields[i].sig) != 0) { + if (sig == nullptr || strcmp(sig, fields[i].sig) != 0) { printf("(%" PRIuPTR ") wrong field sig: \"%s\"", i, sig); printf(", expected: \"%s\"\n", fields[i].sig); result = STATUS_FAILED; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldName/getfldnm005/getfldnm005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldName/getfldnm005/getfldnm005.cpp index 87332b15447d..66945b246f8c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldName/getfldnm005/getfldnm005.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetFieldName/getfldnm005/getfldnm005.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,12 +24,12 @@ #include #include #include -#include "agent_common.h" +#include "agent_common.hpp" -#include "nsk_tools.h" -#include "jni_tools.h" -#include "JVMTITools.h" -#include "jvmti_tools.h" +#include "nsk_tools.hpp" +#include "jni_tools.hpp" +#include "JVMTITools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -41,7 +41,7 @@ extern "C" { /* expected field signatures are below */ static const char *fld_sig[][FLDS_NUM] = { { "_getfldnm005St", "static", - "Lnsk/jvmti/GetFieldName/getfldnm005;", "NULL" }, + "Lnsk/jvmti/GetFieldName/getfldnm005;", "null" }, { "_getfldnm005b", "instance", "Lnsk/jvmti/GetFieldName/getfldnm005b;", @@ -59,10 +59,10 @@ static const char *fld_sig[][FLDS_NUM] = { { "_getfldnm005e", "instance", "Lnsk/jvmti/GetFieldName/getfldnm005e;", - "NULL" }, + "null" }, { "_getfldnm005eSt", "static", "Lnsk/jvmti/GetFieldName/getfldnm005e;", - "NULL" }, + "null" }, { "_getfldnm005if", "instance", "Lnsk/jvmti/GetFieldName/getfldnm005if;", @@ -80,10 +80,10 @@ static const char *fld_sig[][FLDS_NUM] = { { "_getfldnm005gArr", "instance", "[Lnsk/jvmti/GetFieldName/getfldnm005g;", - "NULL" } + "null" } }; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static int checkSig(JNIEnv *jni_env, jclass testedCls, jfieldID testedFld, int instance, int idx) { @@ -101,7 +101,7 @@ static int checkSig(JNIEnv *jni_env, jclass testedCls, name); if (strcmp(fld_sig[idx][2], sign) != 0 || - strcmp(fld_sig[idx][3], (gen_sign == NULL) ? "NULL" : gen_sign) != 0) { + strcmp(fld_sig[idx][3], (gen_sign == nullptr) ? "null" : gen_sign) != 0) { NSK_COMPLAIN6( "TEST FAILED: %s field \"%s\" has\n" "\tsignature: \"%s\"\n" @@ -110,20 +110,20 @@ static int checkSig(JNIEnv *jni_env, jclass testedCls, "\t\t\"%s\"\n\n", (instance == 0) ? "instance" : "static", fld_sig[idx][0], - sign, (gen_sign == NULL) ? "NULL" : gen_sign, + sign, (gen_sign == nullptr) ? "null" : gen_sign, fld_sig[idx][2], fld_sig[idx][3]); totRes = STATUS_FAILED; } else NSK_DISPLAY2("CHECK PASSED: signature: \"%s\",\n\tgeneric signature: \"%s\"\n", - sign, (gen_sign == NULL) ? "NULL" : gen_sign); + sign, (gen_sign == nullptr) ? "null" : gen_sign); NSK_DISPLAY0("Deallocating name & signature arrays\n"); if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*) name))) totRes = STATUS_FAILED; if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*) sign))) totRes = STATUS_FAILED; - if (gen_sign != NULL) + if (gen_sign != nullptr) if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*) gen_sign))) totRes = STATUS_FAILED; } @@ -135,7 +135,7 @@ JNIEXPORT jint JNICALL Java_nsk_jvmti_GetFieldName_getfldnm005_check( JNIEnv *jni, jobject obj) { int res = PASSED, i, instance; - jfieldID testedFld = NULL; + jfieldID testedFld = nullptr; jclass objCls = jni->GetObjectClass(obj); for (i=0; iGetFieldID(objCls, fld_sig[i][0], fld_sig[i][2])) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (testedFld = jni->GetFieldID(objCls, fld_sig[i][0], fld_sig[i][2])) != nullptr)) { NSK_COMPLAIN1("TEST FAILERE: unable to get field ID for \"%s\"\n\n", fld_sig[i][0]); res = STATUS_FAILED; @@ -153,7 +153,7 @@ Java_nsk_jvmti_GetFieldName_getfldnm005_check( } } else - if (!NSK_JNI_VERIFY(jni, (testedFld = jni->GetStaticFieldID(objCls, fld_sig[i][0], fld_sig[i][2])) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (testedFld = jni->GetStaticFieldID(objCls, fld_sig[i][0], fld_sig[i][2])) != nullptr)) { NSK_COMPLAIN1("TEST FAILERE: unable to get field ID for \"%s\"\n\n", fld_sig[i][0]); res = STATUS_FAILED; @@ -189,7 +189,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetImplementedInterfaces/getintrf005/getintrf005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetImplementedInterfaces/getintrf005/getintrf005.cpp index ee7b56923c47..e778581353ce 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetImplementedInterfaces/getintrf005/getintrf005.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetImplementedInterfaces/getintrf005/getintrf005.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_getintrf005(JavaVM *jvm, char *options, void *reserved jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -70,7 +70,7 @@ Java_nsk_jvmti_GetImplementedInterfaces_getintrf005_check(JNIEnv *env, jclass cl jint icount; jclass *interfaces; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -78,7 +78,7 @@ Java_nsk_jvmti_GetImplementedInterfaces_getintrf005_check(JNIEnv *env, jclass cl if (printdump == JNI_TRUE) { printf(">>> invalid class check ...\n"); } - err = jvmti->GetImplementedInterfaces(NULL, &icount, &interfaces); + err = jvmti->GetImplementedInterfaces(nullptr, &icount, &interfaces); if (err != JVMTI_ERROR_INVALID_CLASS) { printf("Error expected: JVMTI_ERROR_INVALID_CLASS,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -88,7 +88,7 @@ Java_nsk_jvmti_GetImplementedInterfaces_getintrf005_check(JNIEnv *env, jclass cl if (printdump == JNI_TRUE) { printf(">>> (interfaceCountPtr) null pointer check ...\n"); } - err = jvmti->GetImplementedInterfaces(cls, NULL, &interfaces); + err = jvmti->GetImplementedInterfaces(cls, nullptr, &interfaces); if (err != JVMTI_ERROR_NULL_POINTER) { printf("(interfaceCountPtr) error expected: JVMTI_ERROR_NULL_POINTER,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -98,7 +98,7 @@ Java_nsk_jvmti_GetImplementedInterfaces_getintrf005_check(JNIEnv *env, jclass cl if (printdump == JNI_TRUE) { printf(">>> (interfacesPtr) null pointer check ...\n"); } - err = jvmti->GetImplementedInterfaces(cls, &icount, NULL); + err = jvmti->GetImplementedInterfaces(cls, &icount, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { printf("(interfacesPtr) error expected: JVMTI_ERROR_NULL_POINTER,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetImplementedInterfaces/getintrf006/getintrf006.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetImplementedInterfaces/getintrf006/getintrf006.cpp index 50b4f30383e2..37e286d44938 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetImplementedInterfaces/getintrf006/getintrf006.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetImplementedInterfaces/getintrf006/getintrf006.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_getintrf006(JavaVM *jvm, char *options, void *reserved jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -70,7 +70,7 @@ Java_nsk_jvmti_GetImplementedInterfaces_getintrf006_check(JNIEnv *env, jclass cl jint icount; jclass *interfaces; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetImplementedInterfaces/getintrf007/getintrf007.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetImplementedInterfaces/getintrf007/getintrf007.cpp index da6fb2acbc49..2193e5dc972f 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetImplementedInterfaces/getintrf007/getintrf007.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetImplementedInterfaces/getintrf007/getintrf007.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -43,7 +43,7 @@ typedef struct { iface_info *ifaces; } class_info; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -68,17 +68,17 @@ static iface_info i9[] = { }; static class_info classes[] = { - { "InnerClass1", 0, NULL }, - { "InnerInterface1", 0, NULL }, + { "InnerClass1", 0, nullptr }, + { "InnerInterface1", 0, nullptr }, { "InnerInterface2", 1, i2 }, { "InnerClass2", 1, i3 }, - { "OuterClass1", 0, NULL }, - { "OuterClass2", 0, NULL }, - { "OuterInterface1", 0, NULL }, + { "OuterClass1", 0, nullptr }, + { "OuterClass2", 0, nullptr }, + { "OuterInterface1", 0, nullptr }, { "OuterClass3", 1, i7 }, { "OuterInterface2", 1, i8 }, { "OuterClass4", 1, i9 }, - { "OuterClass5", 0, NULL } + { "OuterClass5", 0, nullptr } }; #ifdef STATIC_BUILD @@ -95,12 +95,12 @@ JNIEXPORT jint JNI_OnLoad_getintrf007(JavaVM *jvm, char *options, void *reserved jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -116,7 +116,7 @@ Java_nsk_jvmti_GetImplementedInterfaces_getintrf007_check(JNIEnv *env, jclass cl char *sig, *generic; int j; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; @@ -141,7 +141,7 @@ Java_nsk_jvmti_GetImplementedInterfaces_getintrf007_check(JNIEnv *env, jclass cl } for (j = 0; j < icount; j++) { - if (interfaces[j] == NULL) { + if (interfaces[j] == nullptr) { printf("(%d:%d) null reference\n", i, j); } else { err = jvmti->GetClassSignature(interfaces[j], @@ -153,7 +153,7 @@ Java_nsk_jvmti_GetImplementedInterfaces_getintrf007_check(JNIEnv *env, jclass cl if (printdump == JNI_TRUE) { printf(">>> [%d]: %s\n", j, sig); } - if ((j < classes[i].icount) && (sig == NULL || + if ((j < classes[i].icount) && (sig == nullptr || strcmp(sig, classes[i].ifaces[j].sig) != 0)) { printf("(%d:%d) wrong interface: \"%s\"", i, j, sig); printf(", expected: \"%s\"\n", classes[i].ifaces[j].sig); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJLocationFormat/getjlocfmt001/getjlocfmt001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJLocationFormat/getjlocfmt001/getjlocfmt001.cpp index b604af51f8a5..3502af000abe 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJLocationFormat/getjlocfmt001/getjlocfmt001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJLocationFormat/getjlocfmt001/getjlocfmt001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -156,7 +156,7 @@ JNIEXPORT jint JNI_OnLoad_getjlocfmt001(JavaVM *jvm, char *options, void *reserv } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv *jvmti = NULL; + jvmtiEnv *jvmti = nullptr; jvmtiJlocationFormat format; jvmtiEventCallbacks callbacks; @@ -169,7 +169,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* Create data access lock */ @@ -199,16 +199,16 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* enable VMInit event */ if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL))) + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, nullptr))) return JNI_ERR; /* enable ClassFileLoadHook event */ if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL))) + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, nullptr))) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJLocationFormat/getjlocfmt002/getjlocfmt002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJLocationFormat/getjlocfmt002/getjlocfmt002.cpp index b8125340a954..54612f3cb73b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJLocationFormat/getjlocfmt002/getjlocfmt002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJLocationFormat/getjlocfmt002/getjlocfmt002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,9 +22,9 @@ */ #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -45,8 +45,8 @@ agentProc(jvmtiEnv *jvmti, JNIEnv* jni, void* arg) { if (!nsk_jvmti_waitForSync(timeout)) return; - NSK_DISPLAY0("Check if GetJLocationFormat(NULL) returns JVMTI_ERROR_NULL_POINTER\n"); - if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_NULL_POINTER, jvmti->GetJLocationFormat(NULL))) + NSK_DISPLAY0("Check if GetJLocationFormat(null) returns JVMTI_ERROR_NULL_POINTER\n"); + if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_NULL_POINTER, jvmti->GetJLocationFormat(nullptr))) nsk_jvmti_setFailStatus(); /* resume debugee after last sync */ @@ -69,7 +69,7 @@ JNIEXPORT jint JNI_OnLoad_getjlocfmt002(JavaVM *jvm, char *options, void *reserv } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv *jvmti = NULL; + jvmtiEnv *jvmti = nullptr; /* init framework and parse options */ if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) @@ -82,11 +82,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJNIFunctionTable/getjniftab001/getjniftab001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJNIFunctionTable/getjniftab001/getjniftab001.cpp index 213daccd4269..cc320129a989 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJNIFunctionTable/getjniftab001/getjniftab001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJNIFunctionTable/getjniftab001/getjniftab001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,10 +27,10 @@ #include #include -#include "agent_common.h" +#include "agent_common.hpp" -#include "JVMTITools.h" -#include "native_thread.h" +#include "JVMTITools.hpp" +#include "native_thread.hpp" extern "C" { @@ -38,17 +38,17 @@ extern "C" { #define STATUS_FAILED 2 static JavaVM *vm; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static int verbose = 0; static jint result = PASSED; /* the original JNI function table */ -static jniNativeInterface *orig_jni_functions = NULL; +static jniNativeInterface *orig_jni_functions = nullptr; /* the redirected JNI function table */ -static jniNativeInterface *redir_jni_functions = NULL; +static jniNativeInterface *redir_jni_functions = nullptr; /* number of the redirected JNI function calls */ static volatile int redir_calls = 0; @@ -120,7 +120,7 @@ static void doRestore(JNIEnv *env) { } static void checkRedir(JNIEnv *env, int exCalls) { - jniNativeInterface *tested_jni_functions = NULL; + jniNativeInterface *tested_jni_functions = nullptr; jvmtiError err; jint res; @@ -156,7 +156,7 @@ JNIEXPORT jint JNICALL Java_nsk_jvmti_GetJNIFunctionTable_getjniftab001_check(JNIEnv *env, jobject obj) { int exitCode = PASSED; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("(%s,%d): TEST FAILURE: JVMTI client was not properly loaded\n", __FILE__, __LINE__); return STATUS_FAILED; @@ -191,14 +191,14 @@ JNIEXPORT jint JNI_OnLoad_getjniftab001(JavaVM *jvm, char *options, void *reserv jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "-verbose") == 0) + if (options != nullptr && strcmp(options, "-verbose") == 0) verbose = 1; if (verbose) printf("verbose mode on\n"); res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("(%s,%d): Failed to call GetEnv\n", __FILE__, __LINE__); return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJNIFunctionTable/getjniftab002/getjniftab002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJNIFunctionTable/getjniftab002/getjniftab002.cpp index db01fdbe12df..3d06018f5563 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJNIFunctionTable/getjniftab002/getjniftab002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetJNIFunctionTable/getjniftab002/getjniftab002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,8 +33,8 @@ extern "C" { #define STATUS_FAILED 2 static JavaVM *vm; -static jvmtiEnv *jvmti = NULL; -static jniNativeInterface *orig_jni_functions = NULL; +static jvmtiEnv *jvmti = nullptr; +static jniNativeInterface *orig_jni_functions = nullptr; static int verbose = 0; static jint result = PASSED; @@ -46,7 +46,7 @@ void redirect(JNIEnv *env, jvmtiError exError) { printf("\ntrying to get the JNI function table expecting the error %s to be returned ...\n", TranslateError(exError)); - err = jvmti->GetJNIFunctionTable((exError == JVMTI_ERROR_NULL_POINTER) ? NULL : &orig_jni_functions); + err = jvmti->GetJNIFunctionTable((exError == JVMTI_ERROR_NULL_POINTER) ? nullptr : &orig_jni_functions); if (err != exError) { result = STATUS_FAILED; printf("(%s,%d): TEST FAILED: GetJNIFunctionTable() returns %s instead of %s as expected\n", @@ -61,9 +61,9 @@ void redirect(JNIEnv *env, jvmtiError exError) { JNIEXPORT jint JNICALL Java_nsk_jvmti_GetJNIFunctionTable_getjniftab002_check(JNIEnv *env, jobject obj) { jint err; - JNIEnv *nextEnv = NULL; + JNIEnv *nextEnv = nullptr; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("(%s,%d): TEST FAILURE: JVMTI client was not properly loaded\n", __FILE__, __LINE__); return STATUS_FAILED; @@ -115,14 +115,14 @@ JNIEXPORT jint JNI_OnLoad_getjniftab002(JavaVM *jvm, char *options, void *reserv jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "-verbose") == 0) + if (options != nullptr && strcmp(options, "-verbose") == 0) verbose = 1; if (verbose) printf("verbose mode on\n"); res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("(%s,%d): Failed to call GetEnv\n", __FILE__, __LINE__); return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLineNumberTable/linetab001/linetab001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLineNumberTable/linetab001/linetab001.cpp index 17884af74976..b2a03a4a629b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLineNumberTable/linetab001/linetab001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLineNumberTable/linetab001/linetab001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -67,8 +67,8 @@ void checkMeth(JNIEnv *env, jclass cl, const char *name, const char *sig, } else { mid = env->GetMethodID(cl, name, sig); } - if (mid == NULL) { - printf("Name = %s, sig = %s: mid = NULL\n", name, sig); + if (mid == nullptr) { + printf("Name = %s, sig = %s: mid = null\n", name, sig); result = STATUS_FAILED; return; } @@ -132,7 +132,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLineNumberTable/linetab002/linetab002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLineNumberTable/linetab002/linetab002.cpp index a4df264ccbe8..9592167e1cd3 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLineNumberTable/linetab002/linetab002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLineNumberTable/linetab002/linetab002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -53,12 +53,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -98,7 +98,7 @@ Java_nsk_jvmti_GetLineNumberTable_linetab002_check(JNIEnv *env, jclass cls) { jint entryCount; jvmtiLineNumberEntry *table; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -108,7 +108,7 @@ Java_nsk_jvmti_GetLineNumberTable_linetab002_check(JNIEnv *env, jclass cls) { } mid = env->GetMethodID(cls, "", "()V"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot get method ID!\n"); return STATUS_FAILED; } @@ -116,7 +116,7 @@ Java_nsk_jvmti_GetLineNumberTable_linetab002_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> invalid method check ...\n"); } - err = jvmti->GetLineNumberTable(NULL, &entryCount, &table); + err = jvmti->GetLineNumberTable(nullptr, &entryCount, &table); if (err != JVMTI_ERROR_INVALID_METHODID) { printf("Error expected: JVMTI_ERROR_INVALID_METHODID,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -126,7 +126,7 @@ Java_nsk_jvmti_GetLineNumberTable_linetab002_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> (entryCountPtr) null pointer check ...\n"); } - err = jvmti->GetLineNumberTable(mid, NULL, &table); + err = jvmti->GetLineNumberTable(mid, nullptr, &table); if (err != JVMTI_ERROR_NULL_POINTER) { printf("(entryCountPtr) error expected: JVMTI_ERROR_NULL_POINTER,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -136,7 +136,7 @@ Java_nsk_jvmti_GetLineNumberTable_linetab002_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> (tablePtr) null pointer check ...\n"); } - err = jvmti->GetLineNumberTable(mid, &entryCount, NULL); + err = jvmti->GetLineNumberTable(mid, &entryCount, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { printf("(tablePtr) error expected: JVMTI_ERROR_NULL_POINTER,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLineNumberTable/linetab003/linetab003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLineNumberTable/linetab003/linetab003.cpp index 26ba35b84726..340d206a62c8 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLineNumberTable/linetab003/linetab003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLineNumberTable/linetab003/linetab003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -53,12 +53,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -99,7 +99,7 @@ Java_nsk_jvmti_GetLineNumberTable_linetab003_check(JNIEnv *env, jclass cls) { jvmtiLineNumberEntry *table; int i; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -109,7 +109,7 @@ Java_nsk_jvmti_GetLineNumberTable_linetab003_check(JNIEnv *env, jclass cls) { } mid = env->GetMethodID(cls, "meth", "()I"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot get method ID!\n"); return STATUS_FAILED; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLoadedClasses/loadedclss001/loadedclss001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLoadedClasses/loadedclss001/loadedclss001.cpp index 12515f15fcad..43804aaffd57 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLoadedClasses/loadedclss001/loadedclss001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLoadedClasses/loadedclss001/loadedclss001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_loadedclss001(JavaVM *jvm, char *options, void *reserv jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -69,7 +69,7 @@ Java_nsk_jvmti_GetLoadedClasses_loadedclss001_check(JNIEnv *env, jclass cls) { jclass *classes; jint classCount; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -77,7 +77,7 @@ Java_nsk_jvmti_GetLoadedClasses_loadedclss001_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> (classCountPtr) null pointer check ...\n"); } - err = jvmti->GetLoadedClasses(NULL, &classes); + err = jvmti->GetLoadedClasses(nullptr, &classes); if (err != JVMTI_ERROR_NULL_POINTER) { printf("Error expected: JVMTI_ERROR_NULL_POINTER,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -87,7 +87,7 @@ Java_nsk_jvmti_GetLoadedClasses_loadedclss001_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> (classesPtr) null pointer check ...\n"); } - err = jvmti->GetLoadedClasses(&classCount, NULL); + err = jvmti->GetLoadedClasses(&classCount, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { printf("Error expected: JVMTI_ERROR_NULL_POINTER,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLoadedClasses/loadedclss002/loadedclss002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLoadedClasses/loadedclss002/loadedclss002.cpp index 8a65e34cfd4e..813f15e4c3a5 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLoadedClasses/loadedclss002/loadedclss002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLoadedClasses/loadedclss002/loadedclss002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -35,9 +35,9 @@ extern "C" { static jlong timeout = 0; /* test objects */ -static jobject testedClassLoader = NULL; -static jclass testedClass = NULL; -static jfieldID testedFieldID = NULL; +static jobject testedClassLoader = nullptr; +static jclass testedClass = nullptr; +static jfieldID testedFieldID = nullptr; static const char *CLASS_SIG[] = { "Lnsk/jvmti/GetLoadedClasses/loadedclss002;", @@ -63,15 +63,15 @@ static int lookup(jvmtiEnv* jvmti, if (!NSK_JVMTI_VERIFY(jvmti->GetClassSignature(classes[i], &signature, &generic))) break; - if (signature != NULL && strcmp(signature, exp_sig) == 0) { + if (signature != nullptr && strcmp(signature, exp_sig) == 0) { NSK_DISPLAY1("Expected class found: %s\n", exp_sig); found = NSK_TRUE; } - if (signature != NULL) + if (signature != nullptr) jvmti->Deallocate((unsigned char*)signature); - if (generic != NULL) + if (generic != nullptr) jvmti->Deallocate((unsigned char*)generic); } @@ -100,7 +100,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { return; } - if (!NSK_VERIFY(classes != NULL)) { + if (!NSK_VERIFY(classes != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -121,7 +121,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } } - if (classes != NULL) + if (classes != nullptr) jvmti->Deallocate((unsigned char*)classes); if (!nsk_jvmti_resumeSync()) @@ -143,7 +143,7 @@ JNIEXPORT jint JNI_OnLoad_loadedclss002(JavaVM *jvm, char *options, void *reserv } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; NSK_DISPLAY0("Agent_OnLoad\n"); @@ -153,10 +153,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariable/getlocal001/getlocal001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariable/getlocal001/getlocal001.cpp index 42bdfb46cc2e..c5ec07035f83 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariable/getlocal001/getlocal001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariable/getlocal001/getlocal001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -146,7 +146,7 @@ void check2(jvmtiEnv *jvmti_env, jthread thr, jint depth, void check3(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thr, jint depth, jvmtiLocalVariableEntry *table, jint count, jmethodID mid) { jvmtiError err; - jobject ob1 = NULL, ob2 = NULL; + jobject ob1 = nullptr, ob2 = nullptr; jclass cls; jfieldID fid; jint fldVal = 0; @@ -171,7 +171,7 @@ void check3(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thr, jint depth, continue; } fid = env->GetFieldID(cls, "fld", "I"); - if (fid == NULL) { + if (fid == nullptr) { printf("Cannot find ID for \"fld\" field of meth03\n"); env->ExceptionClear(); result = STATUS_FAILED; @@ -284,7 +284,7 @@ void JNICALL MethodExit(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thr, jmethodID mid, jboolean was_poped_by_exception, jvalue return_value) { jvmtiError err; - jvmtiLocalVariableEntry *table = NULL; + jvmtiLocalVariableEntry *table = nullptr; jint entryCount = 0; int i; @@ -307,7 +307,7 @@ void JNICALL MethodExit(jvmtiEnv *jvmti_env, JNIEnv *env, printf(">>> exit: meth02\n"); } check2(jvmti_env, thr, 0, table, entryCount); - mid2 = NULL; + mid2 = nullptr; } else if (mid == mid3) { if (printdump == JNI_TRUE) { printf(">>> exit: meth03\n"); @@ -320,7 +320,7 @@ void JNICALL MethodExit(jvmtiEnv *jvmti_env, JNIEnv *env, check4(jvmti_env, thr, 0, table, entryCount); } } - if (table != NULL) { + if (table != nullptr) { for (i = 0; i < entryCount; i++) { jvmti_env->Deallocate((unsigned char*)table[i].name); jvmti_env->Deallocate((unsigned char*)table[i].signature); @@ -332,7 +332,7 @@ void JNICALL MethodExit(jvmtiEnv *jvmti_env, JNIEnv *env, void JNICALL Breakpoint(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thr, jmethodID method, jlocation location) { jvmtiError err; - jvmtiLocalVariableEntry *table = NULL; + jvmtiLocalVariableEntry *table = nullptr; jint entryCount = 0; jmethodID mid; jlocation loc; @@ -376,7 +376,7 @@ void JNICALL Breakpoint(jvmtiEnv *jvmti_env, JNIEnv *env, printf("ERROR: didn't know where we got called from"); result = STATUS_FAILED; } - if (table != NULL) { + if (table != nullptr) { for (i = 0; i < entryCount; i++) { jvmti_env->Deallocate((unsigned char*)table[i].name); jvmti_env->Deallocate((unsigned char*)table[i].signature); @@ -400,12 +400,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } @@ -474,7 +474,7 @@ Java_nsk_jvmti_GetLocalVariable_getlocal001_getMeth(JNIEnv *env, jclass cls, result = STATUS_FAILED; return; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_EXIT, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_EXIT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable METHOD_EXIT event: %s (%d)\n", TranslateError(err), err); @@ -487,7 +487,7 @@ Java_nsk_jvmti_GetLocalVariable_getlocal001_getMeth(JNIEnv *env, jclass cls, return; } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_BREAKPOINT, NULL); + JVMTI_EVENT_BREAKPOINT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable BREAKPOINT event: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariable/getlocal002/getlocal002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariable/getlocal002/getlocal002.cpp index 6f6081fe24e8..672404c23b18 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariable/getlocal002/getlocal002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariable/getlocal002/getlocal002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,12 +33,12 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; static jint result = PASSED; static jboolean printdump = JNI_FALSE; -static jmethodID mid = NULL; +static jmethodID mid = nullptr; void JNICALL MethodExit(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thr, jmethodID method, @@ -52,7 +52,7 @@ void JNICALL MethodExit(jvmtiEnv *jvmti_env, JNIEnv *env, if (mid == method) { err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, - JVMTI_EVENT_METHOD_EXIT, NULL); + JVMTI_EVENT_METHOD_EXIT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to disable metod exit event: %s (%d)\n", TranslateError(err), err); @@ -98,7 +98,7 @@ void JNICALL MethodExit(jvmtiEnv *jvmti_env, JNIEnv *env, if (printdump == JNI_TRUE) { printf(">>> null pointer check ...\n"); } - err = jvmti->GetLocalFloat(thr, 0, table[i].slot, NULL); + err = jvmti->GetLocalFloat(thr, 0, table[i].slot, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { printf("Error expected: JVMTI_ERROR_NULL_POINTER,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -129,12 +129,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -181,7 +181,7 @@ JNIEXPORT void JNICALL Java_nsk_jvmti_GetLocalVariable_getlocal002_getMeth(JNIEnv *env, jclass cls) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; @@ -191,14 +191,14 @@ Java_nsk_jvmti_GetLocalVariable_getlocal002_getMeth(JNIEnv *env, jclass cls) { !caps.can_generate_method_exit_events) return; mid = env->GetMethodID(cls, "meth01", "()D"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot find Method ID for meth01\n"); result = STATUS_FAILED; return; } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_METHOD_EXIT, NULL); + JVMTI_EVENT_METHOD_EXIT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable metod exit event: %s (%d)\n", TranslateError(err), err); @@ -215,12 +215,12 @@ Java_nsk_jvmti_GetLocalVariable_getlocal002_checkLoc(JNIEnv *env, jmethodID mid; jint i1; - if (jvmti == NULL) { + if (jvmti == nullptr) { return; } mid = env->GetStaticMethodID(cls, "meth02", "()V"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot find Method ID for meth02\n"); result = STATUS_FAILED; return; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariableTable/localtab001/localtab001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariableTable/localtab001/localtab001.cpp index fcc3e5040ba7..8f4750437bd3 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariableTable/localtab001/localtab001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariableTable/localtab001/localtab001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -42,47 +42,47 @@ static jvmtiEnv *jvmti; static jvmtiCapabilities caps; static jint result = PASSED; static jvmtiLocalVariableEntry m1[] = { - { 0, 21, (char*) "this", (char*) "Lnsk/jvmti/GetLocalVariableTable/localtab001;", NULL, 0 }, - { 4, 17, (char*) "l", (char*) "J", NULL, 1 }, - { 7, 14, (char*) "f", (char*) "F", NULL, 2 }, - { 12, 9, (char*) "d", (char*) "D", NULL, 3 } + { 0, 21, (char*) "this", (char*) "Lnsk/jvmti/GetLocalVariableTable/localtab001;", nullptr, 0 }, + { 4, 17, (char*) "l", (char*) "J", nullptr, 1 }, + { 7, 14, (char*) "f", (char*) "F", nullptr, 2 }, + { 12, 9, (char*) "d", (char*) "D", nullptr, 3 } }; static jvmtiLocalVariableEntry m2[] = { - { 0, 32, (char*) "this", (char*) "Lnsk/jvmti/GetLocalVariableTable/localtab001;", NULL, 0 }, - { 0, 32, (char*) "step", (char*) "I", NULL, 1 }, - { 2, 29, (char*) "i2", (char*) "S", NULL, 2 }, - { 4, 27, (char*) "i3", (char*) "C", NULL, 3 }, - { 7, 24, (char*) "i4", (char*) "B", NULL, 4 }, - { 10,21, (char*) "i5", (char*) "Z", NULL, 5 }, - { 13,18, (char*) "i1", (char*) "I", NULL, 6 } + { 0, 32, (char*) "this", (char*) "Lnsk/jvmti/GetLocalVariableTable/localtab001;", nullptr, 0 }, + { 0, 32, (char*) "step", (char*) "I", nullptr, 1 }, + { 2, 29, (char*) "i2", (char*) "S", nullptr, 2 }, + { 4, 27, (char*) "i3", (char*) "C", nullptr, 3 }, + { 7, 24, (char*) "i4", (char*) "B", nullptr, 4 }, + { 10,21, (char*) "i5", (char*) "Z", nullptr, 5 }, + { 13,18, (char*) "i1", (char*) "I", nullptr, 6 } }; static jvmtiLocalVariableEntry m3[] = { - { 0, 70, (char*) "ob", (char*) "Lnsk/jvmti/GetLocalVariableTable/localtab001;", NULL, 0 }, - { 2, 67, (char*) "ob1", (char*) "Lnsk/jvmti/GetLocalVariableTable/localtab001;", NULL, 1 }, - { 56,13, (char*) "ob2", (char*) "[I", NULL, 2 }, - { 61, 0, (char*) "i", (char*) "I", NULL, 3 }, - { 64, 5, (char*) "e", (char*) "Ljava/lang/IndexOutOfBoundsException;", NULL, 4 } + { 0, 70, (char*) "ob", (char*) "Lnsk/jvmti/GetLocalVariableTable/localtab001;", nullptr, 0 }, + { 2, 67, (char*) "ob1", (char*) "Lnsk/jvmti/GetLocalVariableTable/localtab001;", nullptr, 1 }, + { 56,13, (char*) "ob2", (char*) "[I", nullptr, 2 }, + { 61, 0, (char*) "i", (char*) "I", nullptr, 3 }, + { 64, 5, (char*) "e", (char*) "Ljava/lang/IndexOutOfBoundsException;", nullptr, 4 } }; static jvmtiLocalVariableEntry m4[] = { - { 0, 33, (char*) "i1", (char*) "I", NULL, 0 }, - { 0, 33, (char*) "l", (char*) "J", NULL, 1 }, - { 0, 33, (char*) "i2", (char*) "S", NULL, 2 }, - { 0, 33, (char*) "d", (char*) "D", NULL, 3 }, - { 0, 33, (char*) "i3", (char*) "C", NULL, 4 }, - { 0, 33, (char*) "f", (char*) "F", NULL, 5 }, - { 0, 33, (char*) "i4", (char*) "B", NULL, 6 }, - { 0, 33, (char*) "b", (char*) "Z", NULL, 7 } + { 0, 33, (char*) "i1", (char*) "I", nullptr, 0 }, + { 0, 33, (char*) "l", (char*) "J", nullptr, 1 }, + { 0, 33, (char*) "i2", (char*) "S", nullptr, 2 }, + { 0, 33, (char*) "d", (char*) "D", nullptr, 3 }, + { 0, 33, (char*) "i3", (char*) "C", nullptr, 4 }, + { 0, 33, (char*) "f", (char*) "F", nullptr, 5 }, + { 0, 33, (char*) "i4", (char*) "B", nullptr, 6 }, + { 0, 33, (char*) "b", (char*) "Z", nullptr, 7 } }; static jvmtiLocalVariableEntry m5[] = { - { 0, 6, (char*) "this", (char*) "Lnsk/jvmti/GetLocalVariableTable/localtab001;", NULL, 0 }, - { 0, 6, (char*) "i", (char*) "I", NULL, 1 }, - { 2, 4, (char*) "i12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678", (char*) "I", NULL, 2 } + { 0, 6, (char*) "this", (char*) "Lnsk/jvmti/GetLocalVariableTable/localtab001;", nullptr, 0 }, + { 0, 6, (char*) "i", (char*) "I", nullptr, 1 }, + { 2, 4, (char*) "i12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678", (char*) "I", nullptr, 2 } }; static jvmtiLocalVariableEntry m6[] = { - { 0, 5, (char*) "this", (char*) "Lnsk/jvmti/GetLocalVariableTable/localtab001;", NULL, 0 }, + { 0, 5, (char*) "this", (char*) "Lnsk/jvmti/GetLocalVariableTable/localtab001;", nullptr, 0 }, }; static info meth_tab[] = { - { 0, NULL }, + { 0, nullptr }, { 4, m1 }, { 7, m2 }, { 5, m3 }, @@ -106,8 +106,8 @@ void checkMeth(JNIEnv *env, jclass cl, const char *name, const char *sig, } else { mid = env->GetMethodID(cl, name, sig); } - if (mid == NULL) { - printf("Name = %s, sig = %s: mid = NULL\n", name, sig); + if (mid == nullptr) { + printf("Name = %s, sig = %s: mid = null\n", name, sig); result = STATUS_FAILED; return; } @@ -194,7 +194,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariableTable/localtab002/localtab002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariableTable/localtab002/localtab002.cpp index 10ce56626417..649f065ffa5a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariableTable/localtab002/localtab002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariableTable/localtab002/localtab002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -53,12 +53,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -98,7 +98,7 @@ Java_nsk_jvmti_GetLocalVariableTable_localtab002_check(JNIEnv *env, jclass cls) jint entryCount; jvmtiLocalVariableEntry *table; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -106,7 +106,7 @@ Java_nsk_jvmti_GetLocalVariableTable_localtab002_check(JNIEnv *env, jclass cls) if (!caps.can_access_local_variables) return result; mid = env->GetMethodID(cls, "", "()V"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot get method ID for \"\"!\n"); return STATUS_FAILED; } @@ -114,7 +114,7 @@ Java_nsk_jvmti_GetLocalVariableTable_localtab002_check(JNIEnv *env, jclass cls) if (printdump == JNI_TRUE) { printf(">>> invalid method check ...\n"); } - err = jvmti->GetLocalVariableTable(NULL, &entryCount, &table); + err = jvmti->GetLocalVariableTable(nullptr, &entryCount, &table); if (err != JVMTI_ERROR_INVALID_METHODID) { printf("Error expected: JVMTI_ERROR_INVALID_METHODID,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -124,7 +124,7 @@ Java_nsk_jvmti_GetLocalVariableTable_localtab002_check(JNIEnv *env, jclass cls) if (printdump == JNI_TRUE) { printf(">>> (entryCountPtr) null pointer check ...\n"); } - err = jvmti->GetLocalVariableTable(mid, NULL, &table); + err = jvmti->GetLocalVariableTable(mid, nullptr, &table); if (err != JVMTI_ERROR_NULL_POINTER) { printf("Error expected: JVMTI_ERROR_NULL_POINTER,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -134,7 +134,7 @@ Java_nsk_jvmti_GetLocalVariableTable_localtab002_check(JNIEnv *env, jclass cls) if (printdump == JNI_TRUE) { printf(">>> (tablePtr) null pointer check ...\n"); } - err = jvmti->GetLocalVariableTable(mid, &entryCount, NULL); + err = jvmti->GetLocalVariableTable(mid, &entryCount, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { printf("Error expected: JVMTI_ERROR_NULL_POINTER,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -142,7 +142,7 @@ Java_nsk_jvmti_GetLocalVariableTable_localtab002_check(JNIEnv *env, jclass cls) } mid = env->GetStaticMethodID(cls, "check", "()I"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot get method ID for \"check\"!\n"); return STATUS_FAILED; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariableTable/localtab003/localtab003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariableTable/localtab003/localtab003.cpp index f1763f736ea6..74d54ad0b5bd 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariableTable/localtab003/localtab003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariableTable/localtab003/localtab003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -53,12 +53,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -99,7 +99,7 @@ Java_nsk_jvmti_GetLocalVariableTable_localtab003_check(JNIEnv *env, jclass cls) jvmtiLocalVariableEntry *table; int i; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -107,7 +107,7 @@ Java_nsk_jvmti_GetLocalVariableTable_localtab003_check(JNIEnv *env, jclass cls) if (!caps.can_access_local_variables) return result; mid = env->GetMethodID(cls, "meth", "()I"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot get method ID!\n"); return STATUS_FAILED; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariableTable/localtab004/localtab004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariableTable/localtab004/localtab004.cpp index 8f25575e04d2..5b45b23b808e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariableTable/localtab004/localtab004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariableTable/localtab004/localtab004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,11 +24,11 @@ #include #include #include -#include "agent_common.h" +#include "agent_common.hpp" -#include "nsk_tools.h" -#include "JVMTITools.h" -#include "jvmti_tools.h" +#include "nsk_tools.hpp" +#include "JVMTITools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -81,12 +81,12 @@ typedef struct { /* local variables of a method */ /* list of tested methods */ static methodInfo methInfo[] = { - { 1, (char*) "", (char*) "()V", 6, constr_lv, NULL }, - { 1, (char*) "finMethod", (char*) "(CJIJ)V", 7, finMeth_lv, NULL }, - { 0, (char*) "statMethod", (char*) "(III)D", 5, statMeth_lv, NULL } + { 1, (char*) "", (char*) "()V", 6, constr_lv, nullptr }, + { 1, (char*) "finMethod", (char*) "(CJIJ)V", 7, finMeth_lv, nullptr }, + { 0, (char*) "statMethod", (char*) "(III)D", 5, statMeth_lv, nullptr } }; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static int checkAttr(JNIEnv *jni_env, jclass testedCls) { @@ -102,7 +102,7 @@ static int checkAttr(JNIEnv *jni_env, jclass testedCls) { methInfo[i].mid = jni_env->GetMethodID(testedCls, methInfo[i].m_name, methInfo[i].m_sign); else /* a static method */ methInfo[i].mid = jni_env->GetStaticMethodID(testedCls, methInfo[i].m_name, methInfo[i].m_sign); - if (methInfo[i].mid == NULL) { + if (methInfo[i].mid == nullptr) { NSK_COMPLAIN3("TEST FAILURE: unable to get the method ID for the %s method \"%s\", signature \"%s\"\n\n", methInfo[i].inst ? "instance" : "static", methInfo[i].m_name, methInfo[i].m_sign); @@ -196,7 +196,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add capability to access local variables */ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariableTable/localtab005/localtab005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariableTable/localtab005/localtab005.cpp index 3a681654762d..5c1de0b9b0e4 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariableTable/localtab005/localtab005.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetLocalVariableTable/localtab005/localtab005.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,11 +24,11 @@ #include #include #include -#include "agent_common.h" +#include "agent_common.hpp" -#include "nsk_tools.h" -#include "JVMTITools.h" -#include "jvmti_tools.h" +#include "nsk_tools.hpp" +#include "JVMTITools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -45,35 +45,35 @@ typedef struct { /* local variable info */ /* expected local variable info are below */ static localVar constr_lv[] = { /* constructor's local variables */ - { "this", "Lnsk/jvmti/GetLocalVariableTable/localtab005a;", "NULL" }, + { "this", "Lnsk/jvmti/GetLocalVariableTable/localtab005a;", "null" }, { "constr_b", "Lnsk/jvmti/GetLocalVariableTable/localtab005b;", "Lnsk/jvmti/GetLocalVariableTable/localtab005b;" }, - { "constr_i", "I", "NULL" }, + { "constr_i", "I", "null" }, { "constr_c", "Lnsk/jvmti/GetLocalVariableTable/localtab005c;", "Lnsk/jvmti/GetLocalVariableTable/localtab005c;" }, - { "constr_f", "F", "NULL" }, - { "constr_ch", "C", "NULL" }, + { "constr_f", "F", "null" }, + { "constr_ch", "C", "null" }, { "constr_if", "Lnsk/jvmti/GetLocalVariableTable/localtab005if;", "Lnsk/jvmti/GetLocalVariableTable/localtab005if;" } }; static localVar insMeth_lv[] = { /* finMethod()'s local variables */ - { "this", "Lnsk/jvmti/GetLocalVariableTable/localtab005a;", "NULL" }, - { "ins_c", "C", "NULL" }, - { "ins_i", "J", "NULL" }, + { "this", "Lnsk/jvmti/GetLocalVariableTable/localtab005a;", "null" }, + { "ins_c", "C", "null" }, + { "ins_i", "J", "null" }, { "ltab005d", "Lnsk/jvmti/GetLocalVariableTable/localtab005d;", "Lnsk/jvmti/GetLocalVariableTable/localtab005d;" }, - { "ins_k", "J", "NULL" }, - { "ins_l", "J", "NULL" }, + { "ins_k", "J", "null" }, + { "ins_l", "J", "null" }, { "ins_g", "Lnsk/jvmti/GetLocalVariableTable/localtab005g;", "Lnsk/jvmti/GetLocalVariableTable/localtab005g;" } }; static localVar statMeth_lv[] = { /* statMethod()'s local variables */ - { "stat_x", "I", "NULL" }, - { "stat_y", "I", "NULL" }, - { "stat_z", "I", "NULL" }, - { "stat_j", "D", "NULL" }, + { "stat_x", "I", "null" }, + { "stat_y", "I", "null" }, + { "stat_z", "I", "null" }, + { "stat_j", "D", "null" }, { "stat_d", "Lnsk/jvmti/GetLocalVariableTable/localtab005d;", "Lnsk/jvmti/GetLocalVariableTable/localtab005d;" } }; @@ -89,12 +89,12 @@ typedef struct { /* local variables of a method */ /* list of tested methods */ static methodInfo methInfo[] = { - { 1, (char*) "", (char*) "()V", 7, constr_lv, NULL }, - { 1, (char*) "insMethod", (char*) "(CJLnsk/jvmti/GetLocalVariableTable/localtab005d;J)V", 7, insMeth_lv, NULL }, - { 0, (char*) "statMethod", (char*) "(III)D", 5, statMeth_lv, NULL } + { 1, (char*) "", (char*) "()V", 7, constr_lv, nullptr }, + { 1, (char*) "insMethod", (char*) "(CJLnsk/jvmti/GetLocalVariableTable/localtab005d;J)V", 7, insMeth_lv, nullptr }, + { 0, (char*) "statMethod", (char*) "(III)D", 5, statMeth_lv, nullptr } }; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static int checkAttr(JNIEnv *jni_env, jclass testedCls) { @@ -110,7 +110,7 @@ static int checkAttr(JNIEnv *jni_env, jclass testedCls) { methInfo[i].mid = jni_env->GetMethodID(testedCls, methInfo[i].m_name, methInfo[i].m_sign); else /* a static method */ methInfo[i].mid = jni_env->GetStaticMethodID(testedCls, methInfo[i].m_name, methInfo[i].m_sign); - if (methInfo[i].mid == NULL) { + if (methInfo[i].mid == nullptr) { NSK_COMPLAIN3("TEST FAILURE: unable to get the method ID for the %s method \"%s\", signature \"%s\"\n\n", methInfo[i].inst ? "instance" : "static", methInfo[i].m_name, methInfo[i].m_sign); @@ -137,7 +137,7 @@ static int checkAttr(JNIEnv *jni_env, jclass testedCls) { NSK_COMPLAIN4("\t%d) name: \"%s\"\n\tsignature: \"%s\"\n\tgeneric signature: \"%s\"\n", j+1, lv_table[j].name, lv_table[j].signature, - (lv_table[j].generic_signature == NULL) ? "NULL" : lv_table[j].generic_signature); + (lv_table[j].generic_signature == nullptr) ? "null" : lv_table[j].generic_signature); NSK_COMPLAIN0("\n"); continue; @@ -155,7 +155,7 @@ static int checkAttr(JNIEnv *jni_env, jclass testedCls) { for (k=0; k #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,12 +33,12 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; void checkMeth(JNIEnv *env, jclass cl, const char *name, const char *sig, int stat, int max_loc) { jvmtiError err; - jmethodID mid = NULL; + jmethodID mid = nullptr; jint ret_loc; if (stat) { @@ -46,7 +46,7 @@ void checkMeth(JNIEnv *env, jclass cl, const char *name, const char *sig, int st } else { mid = env->GetMethodID(cl, name, sig); } - if (mid == NULL) { + if (mid == nullptr) { printf("Name = %s, sig = %s: mid = 0\n", name, sig); result = STATUS_FAILED; return; @@ -77,7 +77,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMaxLocals/maxloc002/maxloc002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMaxLocals/maxloc002/maxloc002.cpp index 6fbea7d6a5ab..6d8aa8baccf1 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMaxLocals/maxloc002/maxloc002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMaxLocals/maxloc002/maxloc002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_maxloc002(JavaVM *jvm, char *options, void *reserved) jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -70,13 +70,13 @@ Java_nsk_jvmti_GetMaxLocals_maxloc002_check(JNIEnv *env, jclass cls) { jmethodID mid; jint max; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } mid = env->GetMethodID(cls, "", "()V"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot get method ID for \"\"!\n"); return STATUS_FAILED; } @@ -84,7 +84,7 @@ Java_nsk_jvmti_GetMaxLocals_maxloc002_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> invalid method check ...\n"); } - err = jvmti->GetMaxLocals(NULL, &max); + err = jvmti->GetMaxLocals(nullptr, &max); if (err != JVMTI_ERROR_INVALID_METHODID) { printf("Error expected: JVMTI_ERROR_INVALID_METHODID,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -94,7 +94,7 @@ Java_nsk_jvmti_GetMaxLocals_maxloc002_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> null pointer check ...\n"); } - err = jvmti->GetMaxLocals(mid, NULL); + err = jvmti->GetMaxLocals(mid, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { printf("Error expected: JVMTI_ERROR_NULL_POINTER,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -102,7 +102,7 @@ Java_nsk_jvmti_GetMaxLocals_maxloc002_check(JNIEnv *env, jclass cls) { } mid = env->GetStaticMethodID(cls, "check", "()I"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot get method ID for \"check\"!\n"); return STATUS_FAILED; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodDeclaringClass/declcls001/declcls001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodDeclaringClass/declcls001/declcls001.cpp index ec3691af227b..490d63ce6dc9 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodDeclaringClass/declcls001/declcls001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodDeclaringClass/declcls001/declcls001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -49,8 +49,8 @@ void checkMeth(JNIEnv *env, const char *cl_name, const char *name, const char *s } else { mid = env->GetMethodID(cl, name, sig); } - if (mid == NULL) { - printf("%s.%s%s: mid = NULL\n", cl_name, name, sig); + if (mid == nullptr) { + printf("%s.%s%s: mid = null\n", cl_name, name, sig); result = STATUS_FAILED; return; } @@ -95,7 +95,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodDeclaringClass/declcls002/declcls002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodDeclaringClass/declcls002/declcls002.cpp index a923fd4d9505..837ef437bb82 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodDeclaringClass/declcls002/declcls002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodDeclaringClass/declcls002/declcls002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_declcls002(JavaVM *jvm, char *options, void *reserved) jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -70,13 +70,13 @@ Java_nsk_jvmti_GetMethodDeclaringClass_declcls002_check(JNIEnv *env, jclass cls) jmethodID mid; jclass declaringClass; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } mid = env->GetMethodID(cls, "", "()V"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot get method ID!\n"); return STATUS_FAILED; } @@ -84,7 +84,7 @@ Java_nsk_jvmti_GetMethodDeclaringClass_declcls002_check(JNIEnv *env, jclass cls) if (printdump == JNI_TRUE) { printf(">>> invalid method check ...\n"); } - err = jvmti->GetMethodDeclaringClass(NULL, &declaringClass); + err = jvmti->GetMethodDeclaringClass(nullptr, &declaringClass); if (err != JVMTI_ERROR_INVALID_METHODID) { printf("Error expected: JVMTI_ERROR_INVALID_METHODID,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -94,7 +94,7 @@ Java_nsk_jvmti_GetMethodDeclaringClass_declcls002_check(JNIEnv *env, jclass cls) if (printdump == JNI_TRUE) { printf(">>> null pointer check ...\n"); } - err = jvmti->GetMethodDeclaringClass(mid, NULL); + err = jvmti->GetMethodDeclaringClass(mid, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { printf("Error expected: JVMTI_ERROR_NULL_POINTER,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodDeclaringClass/declcls003/declcls003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodDeclaringClass/declcls003/declcls003.cpp index 8f447709770e..833edd6e75ac 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodDeclaringClass/declcls003/declcls003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodDeclaringClass/declcls003/declcls003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; static const char *exp_class_sig = "Ljava/lang/Object;"; @@ -55,8 +55,8 @@ void do_check(JNIEnv *env, const char *name, const char *meth, const char *sig) cl = env->FindClass(name); mid = env->GetMethodID(cl, meth, sig); - if (mid == NULL) { - printf("%s.%s%s: mid = NULL\n", name, meth, sig); + if (mid == nullptr) { + printf("%s.%s%s: mid = null\n", name, meth, sig); result = STATUS_FAILED; return; } @@ -105,12 +105,12 @@ JNIEXPORT jint JNI_OnLoad_declcls003(JavaVM *jvm, char *options, void *reserved) jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodLocation/methloc001/methloc001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodLocation/methloc001/methloc001.cpp index c8e9cd6c730c..a250b1178ca5 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodLocation/methloc001/methloc001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodLocation/methloc001/methloc001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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 @@ #include #include "jvmti.h" -#include "agent_common.h" +#include "agent_common.hpp" extern "C" { @@ -59,8 +59,8 @@ void checkMeth(JNIEnv *env, jclass cl, const char *name, const char *sig, } else { mid = env->GetMethodID(cl, name, sig); } - if (mid == NULL) { - printf("Name = %s, sig = %s: mid = NULL\n", name, sig); + if (mid == nullptr) { + printf("Name = %s, sig = %s: mid = null\n", name, sig); result = STATUS_FAILED; return; } @@ -103,7 +103,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodLocation/methloc002/methloc002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodLocation/methloc002/methloc002.cpp index 858553a7d85e..2dbb504ed129 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodLocation/methloc002/methloc002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodLocation/methloc002/methloc002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_methloc002(JavaVM *jvm, char *options, void *reserved) jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -71,13 +71,13 @@ Java_nsk_jvmti_GetMethodLocation_methloc002_check(JNIEnv *env, jclass cls) { jlocation startLocation; jlocation endLocation; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } mid = env->GetMethodID(cls, "", "()V"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot get method ID for \"\"!\n"); return STATUS_FAILED; } @@ -85,7 +85,7 @@ Java_nsk_jvmti_GetMethodLocation_methloc002_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> invalid method check ...\n"); } - err = jvmti->GetMethodLocation(NULL, &startLocation, &endLocation); + err = jvmti->GetMethodLocation(nullptr, &startLocation, &endLocation); if (err != JVMTI_ERROR_INVALID_METHODID) { printf("Error expected: JVMTI_ERROR_INVALID_METHODID,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -95,7 +95,7 @@ Java_nsk_jvmti_GetMethodLocation_methloc002_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> (startLocationPtr) null pointer check ...\n"); } - err = jvmti->GetMethodLocation(mid, NULL, &endLocation); + err = jvmti->GetMethodLocation(mid, nullptr, &endLocation); if (err != JVMTI_ERROR_NULL_POINTER) { printf("(startLocationPtr) error expected: JVMTI_ERROR_NULL_POINTER,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -105,7 +105,7 @@ Java_nsk_jvmti_GetMethodLocation_methloc002_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> (endLocationPtr) null pointer check ...\n"); } - err = jvmti->GetMethodLocation(mid, &startLocation, NULL); + err = jvmti->GetMethodLocation(mid, &startLocation, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { printf("(endLocationPtr) error expected: JVMTI_ERROR_NULL_POINTER,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -113,7 +113,7 @@ Java_nsk_jvmti_GetMethodLocation_methloc002_check(JNIEnv *env, jclass cls) { } mid = env->GetStaticMethodID(cls, "check", "()I"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot get method ID for \"check\"!\n"); return STATUS_FAILED; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodModifiers/methmod001/methmod001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodModifiers/methmod001/methmod001.cpp index 838adc030191..8572908762b8 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodModifiers/methmod001/methmod001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodModifiers/methmod001/methmod001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -42,7 +42,7 @@ extern "C" { #define ACC_NATIVE 0x100 #define ACC_ABSTRACT 0x400 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -70,7 +70,7 @@ void checkMeth(jvmtiEnv *jvmti_env, JNIEnv *env, jclass cl, } else { mid = env->GetMethodID(cl, name, sig); } - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot find MethodID for \"%s%s\"\n", name, sig); result = STATUS_FAILED; return; @@ -135,12 +135,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -154,7 +154,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_CLASS_LOAD, NULL); + JVMTI_EVENT_CLASS_LOAD, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable event JVMTI_EVENT_CLASS_LOAD: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodModifiers/methmod002/methmod002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodModifiers/methmod002/methmod002.cpp index 5542a3d35fc5..c5545532e441 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodModifiers/methmod002/methmod002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodModifiers/methmod002/methmod002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_methmod002(JavaVM *jvm, char *options, void *reserved) jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -70,13 +70,13 @@ Java_nsk_jvmti_GetMethodModifiers_methmod002_check(JNIEnv *env, jclass cls) { jmethodID mid; jint modifiers; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } mid = env->GetMethodID(cls, "", "()V"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot get method ID!\n"); return STATUS_FAILED; } @@ -84,7 +84,7 @@ Java_nsk_jvmti_GetMethodModifiers_methmod002_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> invalid method check ...\n"); } - err = jvmti->GetMethodModifiers(NULL, &modifiers); + err = jvmti->GetMethodModifiers(nullptr, &modifiers); if (err != JVMTI_ERROR_INVALID_METHODID) { printf("Error expected: JVMTI_ERROR_INVALID_METHODID,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -94,7 +94,7 @@ Java_nsk_jvmti_GetMethodModifiers_methmod002_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> null pointer check ...\n"); } - err = jvmti->GetMethodModifiers(mid, NULL); + err = jvmti->GetMethodModifiers(mid, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { printf("Error expected: JVMTI_ERROR_NULL_POINTER,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodName/methname001/methname001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodName/methname001/methname001.cpp index 79c0db9c6af2..08191498d932 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodName/methname001/methname001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodName/methname001/methname001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -50,7 +50,7 @@ void checkMeth(jvmtiEnv *jvmti_env, JNIEnv *env, jclass cl, } else { mid = env->GetMethodID(cl, name, sig); } - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot find MethodID for \"%s%s\"\n", name, sig); result = STATUS_FAILED; return; @@ -115,12 +115,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -134,7 +134,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_CLASS_LOAD, NULL); + JVMTI_EVENT_CLASS_LOAD, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable event JVMTI_EVENT_CLASS_LOAD: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodName/methname002/methname002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodName/methname002/methname002.cpp index 292d5f2b4be3..5d28fd33a867 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodName/methname002/methname002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodName/methname002/methname002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_methname002(JavaVM *jvm, char *options, void *reserved jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -70,13 +70,13 @@ Java_nsk_jvmti_GetMethodName_methname002_check(JNIEnv *env, jclass cls) { jmethodID mid; char *name, *sig, *generic; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } mid = env->GetMethodID(cls, "", "()V"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot get method ID!\n"); return STATUS_FAILED; } @@ -84,7 +84,7 @@ Java_nsk_jvmti_GetMethodName_methname002_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> invalid method check ...\n"); } - err = jvmti->GetMethodName(NULL, &name, &sig, &generic); + err = jvmti->GetMethodName(nullptr, &name, &sig, &generic); if (err != JVMTI_ERROR_INVALID_METHODID) { printf("Error expected: JVMTI_ERROR_INVALID_METHODID,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -94,7 +94,7 @@ Java_nsk_jvmti_GetMethodName_methname002_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> (namePtr) null pointer check ...\n"); } - err = jvmti->GetMethodName(mid, NULL, &sig, &generic); + err = jvmti->GetMethodName(mid, nullptr, &sig, &generic); if (err != JVMTI_ERROR_NONE) { printf("(namePtr) unexpected error: %s (%d)\n", TranslateError(err), err); @@ -103,7 +103,7 @@ Java_nsk_jvmti_GetMethodName_methname002_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> sig = \"%s\", generic = \"%s\"\n", sig, generic); } - if (sig == NULL || strcmp(sig, "()V") != 0) { + if (sig == nullptr || strcmp(sig, "()V") != 0) { printf("Wrong field sig: \"%s\", expected: \"I\"\n", sig); result = STATUS_FAILED; } @@ -112,7 +112,7 @@ Java_nsk_jvmti_GetMethodName_methname002_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> (signaturePtr) null pointer check ...\n"); } - err = jvmti->GetMethodName(mid, &name, NULL, &generic); + err = jvmti->GetMethodName(mid, &name, nullptr, &generic); if (err != JVMTI_ERROR_NONE) { printf("(signaturePtr) unexpected error: %s (%d)\n", TranslateError(err), err); @@ -121,7 +121,7 @@ Java_nsk_jvmti_GetMethodName_methname002_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> name = \"%s\", generic = \"%s\"\n", name, generic); } - if (name == NULL || strcmp(name, "") != 0) { + if (name == nullptr || strcmp(name, "") != 0) { printf("Wrong field name: \"%s\", expected: \"fld\"\n", name); result = STATUS_FAILED; } @@ -130,7 +130,7 @@ Java_nsk_jvmti_GetMethodName_methname002_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> (genericPtr) null pointer check ...\n"); } - err = jvmti->GetMethodName(mid, &name, &sig, NULL); + err = jvmti->GetMethodName(mid, &name, &sig, nullptr); if (err != JVMTI_ERROR_NONE) { printf("(signaturePtr) unexpected error: %s (%d)\n", TranslateError(err), err); @@ -139,11 +139,11 @@ Java_nsk_jvmti_GetMethodName_methname002_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> name = \"%s\", sig = \"%s\"\n", name, sig); } - if (name == NULL || strcmp(name, "") != 0) { + if (name == nullptr || strcmp(name, "") != 0) { printf("Wrong field name: \"%s\", expected: \"fld\"\n", name); result = STATUS_FAILED; } - if (sig == NULL || strcmp(sig, "()V") != 0) { + if (sig == nullptr || strcmp(sig, "()V") != 0) { printf("Wrong field sig: \"%s\", expected: \"I\"\n", sig); result = STATUS_FAILED; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodName/methname003/methname003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodName/methname003/methname003.cpp index 669500625f1e..e64e7a8007b7 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodName/methname003/methname003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetMethodName/methname003/methname003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,12 +24,12 @@ #include #include #include -#include "agent_common.h" +#include "agent_common.hpp" -#include "nsk_tools.h" -#include "jni_tools.h" -#include "JVMTITools.h" -#include "jvmti_tools.h" +#include "nsk_tools.hpp" +#include "jni_tools.hpp" +#include "JVMTITools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -60,14 +60,14 @@ static const char *meth_sig[][METH_NUM][TOT_NUM] = { { { "methname003eMeth", "instance", "(Lnsk/jvmti/GetMethodName/methname003e;)V", - "NULL" }, + "null" }, { "methname003eMethSt", "static", "(Lnsk/jvmti/GetMethodName/methname003e;)V", - "NULL" } }, + "null" } }, { { "methname003ifMeth", "instance", "()I", - "NULL" }, + "null" }, { "methname003ifMeth2", "instance", "(Ljava/lang/Object;)I", "(TT;)I" } }, @@ -80,7 +80,7 @@ static const char *meth_sig[][METH_NUM][TOT_NUM] = { "(TA;TB;)V" } } }; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static int checkSig(JNIEnv *jni_env, jmethodID testedMeth, int instance, int clsIdx, int methIdx) { @@ -98,17 +98,17 @@ static int checkSig(JNIEnv *jni_env, jmethodID testedMeth, meth_sig[clsIdx][methIdx][0]); if (strcmp(meth_sig[clsIdx][methIdx][2], sign) != 0 || - strcmp(meth_sig[clsIdx][methIdx][3], (gen_sign == NULL) ? "NULL" : gen_sign) != 0) { + strcmp(meth_sig[clsIdx][methIdx][3], (gen_sign == nullptr) ? "null" : gen_sign) != 0) { NSK_COMPLAIN5("TEST FAILED: class: \"%s\" \ has\n\tsignature: \"%s\"\n\tgeneric signature: \"%s\"\n\n\tExpected: \"%s\"\n\t\t\"%s\"\n\n", meth_sig[clsIdx][methIdx][0], - sign, (gen_sign == NULL) ? "NULL" : gen_sign, + sign, (gen_sign == nullptr) ? "null" : gen_sign, meth_sig[clsIdx][methIdx][2], meth_sig[clsIdx][methIdx][3]); totRes = STATUS_FAILED; } else NSK_DISPLAY2("CHECK PASSED: signature: \"%s\",\n\tgeneric signature: \"%s\"\n", - sign, (gen_sign == NULL) ? "NULL" : gen_sign); + sign, (gen_sign == nullptr) ? "null" : gen_sign); NSK_DISPLAY0("Deallocating name & signature arrays\n"); if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*) name))) { @@ -117,7 +117,7 @@ has\n\tsignature: \"%s\"\n\tgeneric signature: \"%s\"\n\n\tExpected: \"%s\"\n\t\ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*) sign))) { totRes = STATUS_FAILED; } - if (gen_sign != NULL) + if (gen_sign != nullptr) if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*) gen_sign))) { totRes = STATUS_FAILED; } @@ -130,7 +130,7 @@ JNIEXPORT jint JNICALL Java_nsk_jvmti_GetMethodName_methname003_check( JNIEnv *jni, jobject obj, jobject testedObj, jint clsIdx) { int res = PASSED, i, instance; - jmethodID testedMeth = NULL; + jmethodID testedMeth = nullptr; jclass objCls = jni->GetObjectClass(testedObj); for (i=0; iGetMethodID(objCls, meth_sig[clsIdx][i][0], meth_sig[clsIdx][i][2])) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (testedMeth = jni->GetMethodID(objCls, meth_sig[clsIdx][i][0], meth_sig[clsIdx][i][2])) != nullptr)) { NSK_COMPLAIN2("TEST FAILERE: unable to get method ID for \"%s\" \"%s\"\n\n", meth_sig[clsIdx][i][0], meth_sig[clsIdx][i][2]); res = STATUS_FAILED; @@ -148,7 +148,7 @@ Java_nsk_jvmti_GetMethodName_methname003_check( } } else - if (!NSK_JNI_VERIFY(jni, (testedMeth = jni->GetStaticMethodID(objCls, meth_sig[clsIdx][i][0], meth_sig[clsIdx][i][2])) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (testedMeth = jni->GetStaticMethodID(objCls, meth_sig[clsIdx][i][0], meth_sig[clsIdx][i][2])) != nullptr)) { NSK_COMPLAIN2("TEST FAILERE: unable to get method ID for \"%s\" \"%s\"\n\n", meth_sig[clsIdx][i][0], meth_sig[clsIdx][i][2]); res = STATUS_FAILED; @@ -184,7 +184,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectHashCode/objhashcode001/objhashcode001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectHashCode/objhashcode001/objhashcode001.cpp index da85ff4c5392..885b354ce254 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectHashCode/objhashcode001/objhashcode001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectHashCode/objhashcode001/objhashcode001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -51,16 +51,16 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { /* perform testing */ { - jobject testedObject = NULL; + jobject testedObject = nullptr; jint objectHashCode = 0; NSK_DISPLAY0(">>> Obtain tested object from a static field of debugee class\n"); { - jclass debugeeClass = NULL; - jfieldID objectField = NULL; + jclass debugeeClass = nullptr; + jfieldID objectField = nullptr; NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME); - if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -68,7 +68,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY1("Find static field: %s\n", OBJECT_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (objectField = - jni->GetStaticFieldID(debugeeClass, OBJECT_FIELD_NAME, OBJECT_CLASS_SIG)) != NULL)) { + jni->GetStaticFieldID(debugeeClass, OBJECT_FIELD_NAME, OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -76,14 +76,14 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY1("Get object from static field: %s\n", OBJECT_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (testedObject = - jni->GetStaticObjectField(debugeeClass, objectField)) != NULL)) { + jni->GetStaticObjectField(debugeeClass, objectField)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY1(" ... got object: %p\n", (void*)testedObject); NSK_DISPLAY1("Create global reference for object: %p\n", (void*)testedObject); - if (!NSK_JNI_VERIFY(jni, (testedObject = jni->NewGlobalRef(testedObject)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (testedObject = jni->NewGlobalRef(testedObject)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -180,7 +180,7 @@ JNIEXPORT jint JNI_OnLoad_objhashcode001(JavaVM *jvm, char *options, void *reser } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; /* init framework and parse options */ if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) @@ -190,11 +190,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage001/objmonusage001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage001/objmonusage001.cpp index de518c2240fb..bb9111d897fd 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage001/objmonusage001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage001/objmonusage001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -53,12 +53,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } @@ -117,7 +117,7 @@ Java_nsk_jvmti_GetObjectMonitorUsage_objmonusage001_check(JNIEnv *env, } if (printdump == JNI_TRUE) { - if (inf.owner == NULL) { + if (inf.owner == nullptr) { printf(">>> [%2d] owner: none (0x0)\n", i); } else { jvmti->GetThreadInfo(inf.owner, &tinf); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage002/objmonusage002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage002/objmonusage002.cpp index dda31c173b10..c92d2802296d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage002/objmonusage002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage002/objmonusage002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -53,12 +53,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -97,7 +97,7 @@ Java_nsk_jvmti_GetObjectMonitorUsage_objmonusage002_check(JNIEnv *env, jvmtiError err; jvmtiMonitorUsage inf; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -105,7 +105,7 @@ Java_nsk_jvmti_GetObjectMonitorUsage_objmonusage002_check(JNIEnv *env, if (printdump == JNI_TRUE) { printf(">>> invalid object check ...\n"); } - err = jvmti->GetObjectMonitorUsage(NULL, &inf); + err = jvmti->GetObjectMonitorUsage(nullptr, &inf); if (err == JVMTI_ERROR_MUST_POSSESS_CAPABILITY && !caps.can_get_monitor_info) { /* Ok, it's expected */ @@ -118,7 +118,7 @@ Java_nsk_jvmti_GetObjectMonitorUsage_objmonusage002_check(JNIEnv *env, if (printdump == JNI_TRUE) { printf(">>> null pointer check ...\n"); } - err = jvmti->GetObjectMonitorUsage(obj, NULL); + err = jvmti->GetObjectMonitorUsage(obj, nullptr); if (err == JVMTI_ERROR_MUST_POSSESS_CAPABILITY && !caps.can_get_monitor_info) { /* Ok, it's expected */ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage003/objmonusage003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage003/objmonusage003.cpp index b9d8346c8794..6e0a7d3b1553 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage003/objmonusage003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage003/objmonusage003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -54,12 +54,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } @@ -116,7 +116,7 @@ Java_nsk_jvmti_GetObjectMonitorUsage_objmonusage003_check(JNIEnv *env, } if (printdump == JNI_TRUE) { - if (inf.owner == NULL) { + if (inf.owner == nullptr) { printf(">>> [%2d] owner: none (0x0)\n", count); } else { err = jvmti->GetThreadInfo(inf.owner, &tinf); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage004/objmonusage004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage004/objmonusage004.cpp index 34e340e1f659..6375403aa95d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage004/objmonusage004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage004/objmonusage004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -54,12 +54,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } @@ -116,7 +116,7 @@ Java_nsk_jvmti_GetObjectMonitorUsage_objmonusage004_check(JNIEnv *env, } if (printdump == JNI_TRUE) { - if (inf.owner == NULL) { + if (inf.owner == nullptr) { printf(">>> [%2d] owner: none (0x0)\n", count); } else { err = jvmti->GetThreadInfo(inf.owner, &tinf); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage005/objmonusage005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage005/objmonusage005.cpp index 881607b46787..eaf5c9668dc8 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage005/objmonusage005.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage005/objmonusage005.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; @@ -53,7 +53,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage006/objmonusage006.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage006/objmonusage006.cpp index 460abfd41c73..252e3e9a9343 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage006/objmonusage006.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectMonitorUsage/objmonusage006/objmonusage006.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; @@ -53,7 +53,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectSize/objsize001/objsize001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectSize/objsize001/objsize001.cpp index 10860792e179..a18c3d8a76e7 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectSize/objsize001/objsize001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectSize/objsize001/objsize001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -48,16 +48,16 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { return; { - jobject testedObject = NULL; + jobject testedObject = nullptr; jlong objectSize = 0; NSK_DISPLAY0(">>> Obtain tested object from a static field of debugee class\n"); { - jclass debugeeClass = NULL; - jfieldID objectField = NULL; + jclass debugeeClass = nullptr; + jfieldID objectField = nullptr; NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME); - if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -65,7 +65,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY1("Find static field: %s\n", OBJECT_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (objectField = - jni->GetStaticFieldID(debugeeClass, OBJECT_FIELD_NAME, OBJECT_CLASS_SIG)) != NULL)) { + jni->GetStaticFieldID(debugeeClass, OBJECT_FIELD_NAME, OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -73,14 +73,14 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY1("Get object from static field: %s\n", OBJECT_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (testedObject = - jni->GetStaticObjectField(debugeeClass, objectField)) != NULL)) { + jni->GetStaticObjectField(debugeeClass, objectField)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY1(" ... got object: 0x%p\n", (void*)testedObject); NSK_DISPLAY1("Create global reference for object: 0x%p\n", (void*)testedObject); - if (!NSK_JNI_VERIFY(jni, (testedObject = jni->NewGlobalRef(testedObject)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (testedObject = jni->NewGlobalRef(testedObject)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -180,7 +180,7 @@ JNIEXPORT jint JNI_OnLoad_objsize001(JavaVM *jvm, char *options, void *reserved) } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -188,10 +188,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectsWithTags/objwithtags001/objwithtags001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectsWithTags/objwithtags001/objwithtags001.cpp index d6ea8445774a..d1cd11294303 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectsWithTags/objwithtags001/objwithtags001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetObjectsWithTags/objwithtags001/objwithtags001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -56,9 +56,9 @@ static int objectsCount = 0; /** Obtain tested objects from static field of debugee class. */ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int tagsCount, int objectsCount, jobject* *objects, jlong* *tags) { - jclass debugeeClass = NULL; - jfieldID objectField = NULL; - jobjectArray arrayObject = NULL; + jclass debugeeClass = nullptr; + jfieldID objectField = nullptr; + jobjectArray arrayObject = nullptr; int size = tagsCount * objectsCount; NSK_DISPLAY2("Allocate memory for lists: %d objects for %d tags\n", @@ -78,7 +78,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int tagsCount, int obj { int i, k; for (k = 0; k < size; k++) { - (*objects)[k] = NULL; + (*objects)[k] = nullptr; } for (i = 0; i < tagsCount; i++) { @@ -87,7 +87,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int tagsCount, int obj } NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME); - if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -95,7 +95,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int tagsCount, int obj NSK_DISPLAY1("Find static field: %s\n", OBJECTS_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (objectField = - jni->GetStaticFieldID(debugeeClass, OBJECTS_FIELD_NAME, OBJECTS_FIELD_SIG)) != NULL)) { + jni->GetStaticFieldID(debugeeClass, OBJECTS_FIELD_NAME, OBJECTS_FIELD_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -103,7 +103,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int tagsCount, int obj NSK_DISPLAY1("Get objects array from static field: %s\n", OBJECTS_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (arrayObject = (jobjectArray) - jni->GetStaticObjectField(debugeeClass, objectField)) != NULL)) { + jni->GetStaticObjectField(debugeeClass, objectField)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -121,13 +121,13 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int tagsCount, int obj NSK_DISPLAY1(" ... got array length: %d\n", (int)size); for (k = 0; k < size; k++) { - jobject object = NULL; + jobject object = nullptr; - if (!NSK_JNI_VERIFY(jni, (object = jni->GetObjectArrayElement(arrayObject, k)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (object = jni->GetObjectArrayElement(arrayObject, k)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } - if (!NSK_JNI_VERIFY(jni, (object = jni->NewGlobalRef(object)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (object = jni->NewGlobalRef(object)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -146,12 +146,12 @@ static int releaseTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int tagsCount, int int size = tagsCount * objectsCount; int k; - if (objects == NULL) + if (objects == nullptr) return NSK_TRUE; NSK_DISPLAY1("Release objects references: %d objects\n", size); for (k = 0; k < size; k++) { - if (objects[k] != NULL) { + if (objects[k] != nullptr) { NSK_TRACE(jni->DeleteGlobalRef(objects[k])); } } @@ -163,7 +163,7 @@ static int releaseTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int tagsCount, int nsk_jvmti_setFailStatus(); } - if (tags == NULL) + if (tags == nullptr) return NSK_FALSE; NSK_DISPLAY1("Deallocate tags list: 0x%p\n", (void*)tags); @@ -180,8 +180,8 @@ static int checkTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int tagsCount, int o jlong tags[], jobject objects[], const char kind[], int expectedCount) { jint taggedObjectsCount = 0; - jobject* taggedObjectsList = NULL; - jlong* taggedObjectsTags = NULL; + jobject* taggedObjectsList = nullptr; + jlong* taggedObjectsTags = nullptr; jlong expectedTag = 0; int k; @@ -201,15 +201,15 @@ static int checkTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int tagsCount, int o nsk_jvmti_setFailStatus(); } - if (taggedObjectsList == NULL && taggedObjectsCount > 0) { - NSK_COMPLAIN2("GetObjectsWithTags() returns NULL list of objects %s: 0x%p\n", + if (taggedObjectsList == nullptr && taggedObjectsCount > 0) { + NSK_COMPLAIN2("GetObjectsWithTags() returns null list of objects %s: 0x%p\n", kind, (void*)taggedObjectsList); nsk_jvmti_setFailStatus(); return NSK_TRUE; } - if (taggedObjectsTags == NULL && taggedObjectsCount > 0) { - NSK_COMPLAIN2("GetObjectsWithTags() returns NULL list of tags for objects %s: 0x%p\n", + if (taggedObjectsTags == nullptr && taggedObjectsCount > 0) { + NSK_COMPLAIN2("GetObjectsWithTags() returns null list of tags for objects %s: 0x%p\n", kind, (void*)taggedObjectsTags); nsk_jvmti_setFailStatus(); return NSK_TRUE; @@ -223,8 +223,8 @@ static int checkTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int tagsCount, int o NSK_DISPLAY3(" #%d: object: 0x%p, tag: %ld\n", k, (void*)object, (long)tag); - if (object == NULL) { - NSK_COMPLAIN3("GetObjectsWithTags() returns NULL for object #%d %s: 0x%p\n", + if (object == nullptr) { + NSK_COMPLAIN3("GetObjectsWithTags() returns null for object #%d %s: 0x%p\n", k, kind, (void*)object); nsk_jvmti_setFailStatus(); continue; @@ -306,8 +306,8 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { /* perform testing */ { int size = tagsCount * objectsCount; - jobject* objects = NULL; - jlong* tags = NULL; + jobject* objects = nullptr; + jlong* tags = nullptr; NSK_DISPLAY0(">>> Obtain tested objects list from a static field of debugee class\n"); { @@ -417,7 +417,7 @@ JNIEXPORT jint JNI_OnLoad_objwithtags001(JavaVM *jvm, char *options, void *reser } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; /* init framework and parse options */ if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) @@ -433,7 +433,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add required capabilities */ @@ -448,7 +448,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetOwnedMonitorInfo/ownmoninf001/ownmoninf001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetOwnedMonitorInfo/ownmoninf001/ownmoninf001.cpp index 3d3045301351..c01b9d694389 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetOwnedMonitorInfo/ownmoninf001/ownmoninf001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetOwnedMonitorInfo/ownmoninf001/ownmoninf001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; @@ -53,7 +53,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } @@ -89,7 +89,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jobject *getInfo(JNIEnv *env, jint point, jthread thr, int count) { jvmtiError err; jint owned_monitor_count; - jobject *owned_monitors = NULL; + jobject *owned_monitors = nullptr; err = jvmti->GetOwnedMonitorInfo(thr, &owned_monitor_count, &owned_monitors); @@ -100,13 +100,13 @@ jobject *getInfo(JNIEnv *env, jint point, jthread thr, int count) { printf("(GetOwnedMonitorInfo#%d) unexpected error: %s (%d)\n", point, TranslateError(err), err); result = STATUS_FAILED; - return NULL; + return nullptr; } else { if (owned_monitor_count != count) { result = STATUS_FAILED; printf("Point %d: number of owned monitors expected: %d, got: %d\n", point, count, owned_monitor_count); - return NULL; + return nullptr; } } return owned_monitors; @@ -123,7 +123,7 @@ Java_nsk_jvmti_GetOwnedMonitorInfo_ownmoninf001_checkMon1(JNIEnv *env, jclass cls, jint point, jthread thr, jobject lock) { jobject *monitors; monitors = getInfo(env, point, thr, 1); - if (monitors == NULL) { + if (monitors == nullptr) { return; } if (!env->IsSameObject(lock, monitors[0])) { @@ -137,7 +137,7 @@ Java_nsk_jvmti_GetOwnedMonitorInfo_ownmoninf001_checkMon2(JNIEnv *env, jclass cls, jint point, jthread thr, jobject lock1, jobject lock2) { jobject *monitors; monitors = getInfo(env, point, thr, 2); - if (monitors == NULL) { + if (monitors == nullptr) { return; } if (!env->IsSameObject(lock1, monitors[0]) && !env->IsSameObject(lock2, monitors[0])) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetOwnedMonitorInfo/ownmoninf002/ownmoninf002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetOwnedMonitorInfo/ownmoninf002/ownmoninf002.cpp index 7ad4e1b0ef3e..3837e255809b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetOwnedMonitorInfo/ownmoninf002/ownmoninf002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetOwnedMonitorInfo/ownmoninf002/ownmoninf002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; @@ -53,7 +53,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetOwnedMonitorInfo/ownmoninf003/ownmoninf003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetOwnedMonitorInfo/ownmoninf003/ownmoninf003.cpp index 83b39f17aaa8..5f7ada614e86 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetOwnedMonitorInfo/ownmoninf003/ownmoninf003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetOwnedMonitorInfo/ownmoninf003/ownmoninf003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -53,12 +53,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } @@ -98,7 +98,7 @@ Java_nsk_jvmti_GetOwnedMonitorInfo_ownmoninf003_check(JNIEnv *env, jint owned_monitor_count; jobject *owned_monitors; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -120,7 +120,7 @@ Java_nsk_jvmti_GetOwnedMonitorInfo_ownmoninf003_check(JNIEnv *env, if (printdump == JNI_TRUE) { printf(">>> (owned_monitor_count_ptr) null pointer check ...\n"); } - err = jvmti->GetOwnedMonitorInfo(thr, NULL, &owned_monitors); + err = jvmti->GetOwnedMonitorInfo(thr, nullptr, &owned_monitors); if (err == JVMTI_ERROR_MUST_POSSESS_CAPABILITY && !caps.can_get_monitor_info) { /* Ok, it's expected */ @@ -133,7 +133,7 @@ Java_nsk_jvmti_GetOwnedMonitorInfo_ownmoninf003_check(JNIEnv *env, if (printdump == JNI_TRUE) { printf(">>> (owned_monitors_ptr) null pointer check ...\n"); } - err = jvmti->GetOwnedMonitorInfo(thr, &owned_monitor_count, NULL); + err = jvmti->GetOwnedMonitorInfo(thr, &owned_monitor_count, nullptr); if (err == JVMTI_ERROR_MUST_POSSESS_CAPABILITY && !caps.can_get_monitor_info) { /* Ok, it's expected */ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetPhase/getphase001/getphase001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetPhase/getphase001/getphase001.cpp index e3c4df42cba7..d1c7566b6afb 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetPhase/getphase001/getphase001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetPhase/getphase001/getphase001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,9 +22,9 @@ */ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -268,7 +268,7 @@ JNIEXPORT jint JNI_OnLoad_getphase001(JavaVM *jvm, char *options, void *reserved } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv *jvmti = NULL; + jvmtiEnv *jvmti = nullptr; jvmtiPhase phase; jvmtiCapabilities caps; jvmtiEventCallbacks callbacks; @@ -284,7 +284,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* Create data access lock */ @@ -319,31 +319,31 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* enable VMStart event */ if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_START, NULL))) + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_START, nullptr))) return JNI_ERR; /* enable VMInit event */ if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL))) + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, nullptr))) return JNI_ERR; /* enable NativeMethodBind event */ if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_NATIVE_METHOD_BIND, NULL))) + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_NATIVE_METHOD_BIND, nullptr))) return JNI_ERR; /* enable ClassFileLoadHook event */ if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL))) + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, nullptr))) return JNI_ERR; /* enable VMDeath event */ if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL))) + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, nullptr))) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetPhase/getphase002/getphase002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetPhase/getphase002/getphase002.cpp index e1d03830f704..d1d8443b921d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetPhase/getphase002/getphase002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetPhase/getphase002/getphase002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,9 +22,9 @@ */ #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -45,9 +45,9 @@ agentProc(jvmtiEnv *jvmti, JNIEnv* jni, void* arg) { if (!nsk_jvmti_waitForSync(timeout)) return; - NSK_DISPLAY0("Check if GetPhase(NULL) returns JVMTI_ERROR_NULL_POINTER\n"); + NSK_DISPLAY0("Check if GetPhase(null) returns JVMTI_ERROR_NULL_POINTER\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_NULL_POINTER, - jvmti->GetPhase(NULL))) + jvmti->GetPhase(nullptr))) nsk_jvmti_setFailStatus(); /* resume debugee after last sync */ @@ -70,7 +70,7 @@ JNIEXPORT jint JNI_OnLoad_getphase002(JavaVM *jvm, char *options, void *reserved } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv *jvmti = NULL; + jvmtiEnv *jvmti = nullptr; /* init framework and parse options */ if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) @@ -83,11 +83,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetPotentialCapabilities/getpotcaps001/getpotcaps001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetPotentialCapabilities/getpotcaps001/getpotcaps001.cpp index 0e5d7159d270..daddc8a20a4e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetPotentialCapabilities/getpotcaps001/getpotcaps001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetPotentialCapabilities/getpotcaps001/getpotcaps001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,9 +24,9 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -188,7 +188,7 @@ callbackVMDeath(jvmtiEnv* jvmti, JNIEnv* jni) { success = checkCapabilities(jvmti, "VM_DEATH callback"); NSK_DISPLAY1("Disable events: %d events\n", EVENTS_COUNT); - if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, NULL)) { + if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, nullptr)) { success = NSK_FALSE; } else { NSK_DISPLAY0(" ... disabled\n"); @@ -215,7 +215,7 @@ JNIEXPORT jint JNI_OnLoad_getpotcaps001(JavaVM *jvm, char *options, void *reserv } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -223,7 +223,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; { @@ -239,7 +239,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; NSK_DISPLAY0(">>> Testcase #1: Check capabilities in Agent_OnLoad()\n"); @@ -248,7 +248,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } NSK_DISPLAY1("Enable events: %d events\n", EVENTS_COUNT); - if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, NULL)) { + if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, nullptr)) { NSK_DISPLAY0(" ... enabled\n"); } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSourceDebugExtension/srcdebugex001/srcdebugex001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSourceDebugExtension/srcdebugex001/srcdebugex001.cpp index 66e4dbdceeb2..58b8a0195ef7 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSourceDebugExtension/srcdebugex001/srcdebugex001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSourceDebugExtension/srcdebugex001/srcdebugex001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -53,7 +53,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } @@ -90,7 +90,7 @@ JNIEXPORT jint JNICALL Java_nsk_jvmti_GetSourceDebugExtension_srcdebugex001_getSrcDebugX(JNIEnv *env, jclass cls, jboolean vrb) { jvmtiError err; - char *srcDebugX = NULL; + char *srcDebugX = nullptr; if (!caps.can_get_source_debug_extension) return result; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSourceDebugExtension/srcdebugex002/srcdebugex002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSourceDebugExtension/srcdebugex002/srcdebugex002.cpp index b05b1b382251..033313e17ebb 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSourceDebugExtension/srcdebugex002/srcdebugex002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSourceDebugExtension/srcdebugex002/srcdebugex002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -53,7 +53,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } @@ -90,18 +90,18 @@ JNIEXPORT jint JNICALL Java_nsk_jvmti_GetSourceDebugExtension_srcdebugex002_getSrcDebugX(JNIEnv *env, jclass cls, jint t_case) { jvmtiError err; - char *srcDebugX = NULL; + char *srcDebugX = nullptr; jobject invalCls; /* used as invalid class */ if (!caps.can_get_source_debug_extension) return result; switch (t_case) { - case 1: /* NULL pointer in test debug mode */ - printf("\nInvoke GetSourceDebugExtension() with NULL pointer...\n"); + case 1: /* nullptr pointer in test debug mode */ + printf("\nInvoke GetSourceDebugExtension() with null pointer...\n"); fflush(stdout); // fallthrough - case 0: /* NULL pointer */ - err = jvmti->GetSourceDebugExtension(cls, NULL); + case 0: /* nullptr pointer */ + err = jvmti->GetSourceDebugExtension(cls, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { printf("TEST FAILED: the function GetSourceDebugExtension() returned the error %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSourceDebugExtension/srcdebugex003/srcdebugex003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSourceDebugExtension/srcdebugex003/srcdebugex003.cpp index e4759cf49df1..5763103ac18f 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSourceDebugExtension/srcdebugex003/srcdebugex003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSourceDebugExtension/srcdebugex003/srcdebugex003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -55,7 +55,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } @@ -92,7 +92,7 @@ JNIEXPORT jint JNICALL Java_nsk_jvmti_GetSourceDebugExtension_srcdebugex003_getSrcDebugX(JNIEnv *env, jclass cls, jboolean vrb) { jvmtiError err; - char *srcDebugX = NULL; + char *srcDebugX = nullptr; if (!caps.can_get_source_debug_extension) return result; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSourceFileName/getsrcfn004/getsrcfn004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSourceFileName/getsrcfn004/getsrcfn004.cpp index 18d967111816..bdaeed82f6d9 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSourceFileName/getsrcfn004/getsrcfn004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSourceFileName/getsrcfn004/getsrcfn004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; static jvmtiCapabilities caps; @@ -53,12 +53,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint code; jvmtiError res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } code = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (code != JNI_OK || jvmti == NULL) { + if (code != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -96,7 +96,7 @@ Java_nsk_jvmti_GetSourceFileName_getsrcfn004_check(JNIEnv *env, jclass cls) { jvmtiError err; char *name; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -104,7 +104,7 @@ Java_nsk_jvmti_GetSourceFileName_getsrcfn004_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> invalid class check ...\n"); } - err = jvmti->GetSourceFileName(NULL, &name); + err = jvmti->GetSourceFileName(nullptr, &name); if (err == JVMTI_ERROR_MUST_POSSESS_CAPABILITY && caps.can_get_source_file_name) { printf("Error expected: JVMTI_ERROR_INVALID_CLASS,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -118,7 +118,7 @@ Java_nsk_jvmti_GetSourceFileName_getsrcfn004_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> null pointer check ...\n"); } - err = jvmti->GetSourceFileName(cls, NULL); + err = jvmti->GetSourceFileName(cls, nullptr); if (err == JVMTI_ERROR_MUST_POSSESS_CAPABILITY && caps.can_get_source_file_name) { printf("Error expected: JVMTI_ERROR_NULL_POINTER,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSourceFileName/getsrcfn005/getsrcfn005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSourceFileName/getsrcfn005/getsrcfn005.cpp index 63676521f852..b5c387546ea5 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSourceFileName/getsrcfn005/getsrcfn005.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSourceFileName/getsrcfn005/getsrcfn005.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; static jvmtiCapabilities caps; @@ -53,12 +53,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError res; jint code; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } code = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (code != JNI_OK || jvmti == NULL) { + if (code != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -96,7 +96,7 @@ Java_nsk_jvmti_GetSourceFileName_getsrcfn005_check(JNIEnv *env, jclass cls, jint jvmtiError err; char *name; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSourceFileName/getsrcfn006/getsrcfn006.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSourceFileName/getsrcfn006/getsrcfn006.cpp index 9edb42aa8363..2f7cbe7a56d4 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSourceFileName/getsrcfn006/getsrcfn006.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSourceFileName/getsrcfn006/getsrcfn006.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; static jvmtiCapabilities caps; @@ -59,12 +59,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError res; jint code; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } code = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (code != JNI_OK || jvmti == NULL) { + if (code != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -102,7 +102,7 @@ Java_nsk_jvmti_GetSourceFileName_getsrcfn006_check(JNIEnv *env, jclass cls, jint jvmtiError err; char *name; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSystemProperties/getsysprops001/getsysprops001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSystemProperties/getsysprops001/getsysprops001.cpp index ec770b75655b..da45f7748d2b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSystemProperties/getsysprops001/getsysprops001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSystemProperties/getsysprops001/getsysprops001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -38,7 +38,7 @@ static jlong timeout = 0; static int checkProperties(jvmtiEnv* jvmti, const char phase[]) { int success = NSK_TRUE; jint count = 0; - char** properties = NULL; + char** properties = nullptr; NSK_DISPLAY0("Invoke GetSystemProperties()\n"); if (!NSK_JVMTI_VERIFY( @@ -56,8 +56,8 @@ static int checkProperties(jvmtiEnv* jvmti, const char phase[]) { success = NSK_FALSE; } - if (properties == NULL) { - NSK_COMPLAIN2("In %s phase GetSystemProperties() returned NULL pointer for properties list: 0x%p\n", + if (properties == nullptr) { + NSK_COMPLAIN2("In %s phase GetSystemProperties() returned null pointer for properties list: 0x%p\n", phase, (void*)properties); success = NSK_FALSE; } else { @@ -66,8 +66,8 @@ static int checkProperties(jvmtiEnv* jvmti, const char phase[]) { NSK_DISPLAY1("Check each property: %d properties\n", (int)count); for (i = 0; i < count; i++) { NSK_DISPLAY2(" property #%d: [%s]\n", i, nsk_null_string(properties[i])); - if (properties[i] == NULL) { - NSK_COMPLAIN3("In %s phase GetSystemProperties() returned NULL for property #%d: 0x%p\n", + if (properties[i] == nullptr) { + NSK_COMPLAIN3("In %s phase GetSystemProperties() returned null for property #%d: 0x%p\n", phase, i, (void*)properties[i]); success = NSK_FALSE; } @@ -118,7 +118,7 @@ JNIEXPORT jint JNI_OnLoad_getsysprops001(JavaVM *jvm, char *options, void *reser } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -126,7 +126,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; NSK_DISPLAY0(">>> Check system properties in OnLoad phase\n"); @@ -134,7 +134,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { nsk_jvmti_setFailStatus(); } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSystemProperties/getsysprops002/getsysprops002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSystemProperties/getsysprops002/getsysprops002.cpp index a48128e2bc6c..fa51345a148d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSystemProperties/getsysprops002/getsysprops002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSystemProperties/getsysprops002/getsysprops002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -52,7 +52,7 @@ static PropertyDesc propDescList[PROPERTIES_COUNT] = { static int checkProperties (jvmtiEnv* jvmti, const char phase[]) { int success = NSK_TRUE; jint count = 0; - char** properties = NULL; + char** properties = nullptr; NSK_DISPLAY0("Get system properties list\n"); if (!NSK_JVMTI_VERIFY( @@ -61,7 +61,7 @@ static int checkProperties (jvmtiEnv* jvmti, const char phase[]) { } NSK_DISPLAY1(" ... got properties: %d\n", (int)count); - if (!NSK_VERIFY(properties != NULL)) { + if (!NSK_VERIFY(properties != nullptr)) { return NSK_FALSE; } @@ -77,7 +77,7 @@ static int checkProperties (jvmtiEnv* jvmti, const char phase[]) { for (i = 0; i < count; i++) { NSK_DISPLAY2(" property #%d: [%s]\n", i, nsk_null_string(properties[i])); - if (properties[i] != NULL) { + if (properties[i] != nullptr) { for (j = 0; j < PROPERTIES_COUNT; j++) { if (strcmp(properties[i], propDescList[j].name) == 0) { NSK_DISPLAY1("SUCCESS: found tested property: %s\n", @@ -150,7 +150,7 @@ JNIEXPORT jint JNI_OnLoad_getsysprops002(JavaVM *jvm, char *options, void *reser } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -158,7 +158,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; NSK_DISPLAY0(">>> Check system properties in OnLoad phase\n"); @@ -166,7 +166,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { nsk_jvmti_setFailStatus(); } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSystemProperty/getsysprop001/getsysprop001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSystemProperty/getsysprop001/getsysprop001.cpp index 126712c66f81..652e04171ffd 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSystemProperty/getsysprop001/getsysprop001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSystemProperty/getsysprop001/getsysprop001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -38,7 +38,7 @@ static jlong timeout = 0; static int checkProperties(jvmtiEnv* jvmti, const char phase[]) { int success = NSK_TRUE; jint count = 0; - char** properties = NULL; + char** properties = nullptr; NSK_DISPLAY0("Get system properties names\n"); if (!NSK_JVMTI_VERIFY( @@ -47,7 +47,7 @@ static int checkProperties(jvmtiEnv* jvmti, const char phase[]) { } NSK_DISPLAY1(" ... got properties: %d\n", (int)count); - if (!NSK_VERIFY(properties != NULL)) { + if (!NSK_VERIFY(properties != nullptr)) { return NSK_FALSE; } @@ -56,10 +56,10 @@ static int checkProperties(jvmtiEnv* jvmti, const char phase[]) { int i; for (i = 0; i < count; i++) { - char* value = NULL; + char* value = nullptr; NSK_DISPLAY2(" property #%d: [%s]:\n", i, nsk_null_string(properties[i])); - if (!NSK_VERIFY(properties[i] != NULL)) { + if (!NSK_VERIFY(properties[i] != nullptr)) { success = NSK_FALSE; continue; } @@ -71,8 +71,8 @@ static int checkProperties(jvmtiEnv* jvmti, const char phase[]) { } NSK_DISPLAY1(" value: \"%s\"\n", nsk_null_string(value)); - if (value == NULL) { - NSK_COMPLAIN4("In %s phase GetSystemProperty() returned NULL for property #%d:\n" + if (value == nullptr) { + NSK_COMPLAIN4("In %s phase GetSystemProperty() returned null for property #%d:\n" "# property name: %s\n" "# got value: 0x%p\n", phase, i, @@ -131,7 +131,7 @@ JNIEXPORT jint JNI_OnLoad_getsysprop001(JavaVM *jvm, char *options, void *reserv } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -139,7 +139,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; NSK_DISPLAY0(">>> Check system properties in OnLoad phase\n"); @@ -147,7 +147,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { nsk_jvmti_setFailStatus(); } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSystemProperty/getsysprop002/getsysprop002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSystemProperty/getsysprop002/getsysprop002.cpp index a9704eed75be..885bb264551f 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSystemProperty/getsysprop002/getsysprop002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetSystemProperty/getsysprop002/getsysprop002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -49,7 +49,7 @@ static PropertyDesc propDescList[PROPERTIES_COUNT] = { static int checkProperty(jvmtiEnv* jvmti, const char phase[], PropertyDesc* desc) { int success = NSK_TRUE; - char* value = NULL; + char* value = nullptr; NSK_DISPLAY1("Get value of tested property: %s\n", desc->name); if (!NSK_JVMTI_VERIFY( @@ -58,8 +58,8 @@ static int checkProperty(jvmtiEnv* jvmti, const char phase[], PropertyDesc* desc } NSK_DISPLAY1(" ... got value: \"%s\"\n", nsk_null_string(value)); - if (value == NULL) { - NSK_COMPLAIN4("In %s phase GetSystemProperty() returned NULL value for property:\n" + if (value == nullptr) { + NSK_COMPLAIN4("In %s phase GetSystemProperty() returned null value for property:\n" "# defined as: -D%s=\"%s\"\n" "# got value: 0x%p\n", phase, desc->name, desc->value, (void*)value); @@ -130,7 +130,7 @@ JNIEXPORT jint JNI_OnLoad_getsysprop002(JavaVM *jvm, char *options, void *reserv } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -138,7 +138,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; NSK_DISPLAY0(">>> Check defined system properties in OnLoad phase\n"); @@ -146,7 +146,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { nsk_jvmti_setFailStatus(); } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTag/gettag001/gettag001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTag/gettag001/gettag001.cpp index 801d210de352..e74f57b3b46d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTag/gettag001/gettag001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTag/gettag001/gettag001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -51,17 +51,17 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { /* perform testing */ { - jobject testedObject = NULL; + jobject testedObject = nullptr; jlong objectTag = 0; NSK_DISPLAY0(">>> Obtain tested object from a static field of debugee class\n"); { - jclass debugeeClass = NULL; - jfieldID objectField = NULL; + jclass debugeeClass = nullptr; + jfieldID objectField = nullptr; NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME); if (!NSK_JNI_VERIFY(jni, (debugeeClass = - jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) { + jni->FindClass(DEBUGEE_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -69,7 +69,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY1("Find static field: %s\n", OBJECT_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (objectField = - jni->GetStaticFieldID(debugeeClass, OBJECT_FIELD_NAME, OBJECT_CLASS_SIG)) != NULL)) { + jni->GetStaticFieldID(debugeeClass, OBJECT_FIELD_NAME, OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -77,7 +77,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY1("Get object from static field: %s\n", OBJECT_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (testedObject = - jni->GetStaticObjectField(debugeeClass, objectField)) != NULL)) { + jni->GetStaticObjectField(debugeeClass, objectField)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -85,7 +85,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY1("Create global reference for object: 0x%p\n", (void*)testedObject); if (!NSK_JNI_VERIFY(jni, (testedObject = - jni->NewGlobalRef(testedObject)) != NULL)) { + jni->NewGlobalRef(testedObject)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -142,7 +142,7 @@ JNIEXPORT jint JNI_OnLoad_gettag001(JavaVM *jvm, char *options, void *reserved) } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; /* init framework and parse options */ if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) @@ -152,7 +152,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add required capabilities */ @@ -168,7 +168,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadCpuTime/thrcputime001/thrcputime001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadCpuTime/thrcputime001/thrcputime001.cpp index 4effa9020722..aa1757f0e3e5 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadCpuTime/thrcputime001/thrcputime001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadCpuTime/thrcputime001/thrcputime001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,9 +24,9 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -69,9 +69,9 @@ static int checkCpuTime(jvmtiEnv* jvmti, jthread thread, julong* time, char buf[64], buf2[64], buf3[64]; int success = NSK_TRUE; - NSK_DISPLAY1("GetThreadCpuTime() for current thread (passing NULL): 0x%p\n", (void*)thread); + NSK_DISPLAY1("GetThreadCpuTime() for current thread (passing null): 0x%p\n", (void*)thread); if (!NSK_JVMTI_VERIFY( - jvmti->GetThreadCpuTime(NULL, (jlong *)time))) { + jvmti->GetThreadCpuTime(nullptr, (jlong *)time))) { return NSK_FALSE; } NSK_DISPLAY1(" ... got cpu time: %s\n", julong_to_string(*time, buf)); @@ -81,7 +81,7 @@ static int checkCpuTime(jvmtiEnv* jvmti, jthread thread, julong* time, where, julong_to_string(*time, buf)); } - if (prevTime != NULL) { + if (prevTime != nullptr) { julong diff = *time - *prevTime; NSK_DISPLAY1("Compare with previous time: %s\n", @@ -148,7 +148,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0(">>> Testcase #2: Check initial cpu time in agent thread\n"); { - if (!checkCpuTime(jvmti, testAgentThread, &prevAgentThreadTime, NULL, "agent thread")) { + if (!checkCpuTime(jvmti, testAgentThread, &prevAgentThreadTime, nullptr, "agent thread")) { nsk_jvmti_setFailStatus(); } } @@ -158,7 +158,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { runIterations(iterations); NSK_DISPLAY1("Enable thread events: %d events\n", THREAD_EVENTS_COUNT); - if (nsk_jvmti_enableEvents(JVMTI_ENABLE, THREAD_EVENTS_COUNT, threadEvents, NULL)) { + if (nsk_jvmti_enableEvents(JVMTI_ENABLE, THREAD_EVENTS_COUNT, threadEvents, nullptr)) { NSK_DISPLAY0(" ... enabled\n"); } @@ -185,7 +185,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { return; NSK_DISPLAY1("Disable thread events: %d events\n", THREAD_EVENTS_COUNT); - if (nsk_jvmti_enableEvents(JVMTI_DISABLE, THREAD_EVENTS_COUNT, threadEvents, NULL)) { + if (nsk_jvmti_enableEvents(JVMTI_DISABLE, THREAD_EVENTS_COUNT, threadEvents, nullptr)) { NSK_DISPLAY0(" ... disabled\n"); } } @@ -215,7 +215,7 @@ callbackVMInit(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { NSK_DISPLAY0(">>> Testcase #1: Check initial cpu time in VM_INIT callback\n"); { julong time = 0; - if (!checkCpuTime(jvmti, thread, &time, NULL, "VM_INIT callback")) { + if (!checkCpuTime(jvmti, thread, &time, nullptr, "VM_INIT callback")) { nsk_jvmti_setFailStatus(); } } @@ -231,14 +231,14 @@ callbackVMDeath(jvmtiEnv* jvmti, JNIEnv* jni) { NSK_DISPLAY0(">>> Testcase #7: Check initial cpu time in VM_DEATH callback\n"); { julong time = 0; - if (!checkCpuTime(jvmti, NULL, &time, NULL, "VM_DEATH callback")) { + if (!checkCpuTime(jvmti, nullptr, &time, nullptr, "VM_DEATH callback")) { success = NSK_FALSE; nsk_jvmti_setFailStatus(); } } NSK_DISPLAY1("Disable events: %d events\n", EVENTS_COUNT); - if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, NULL)) { + if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, nullptr)) { success = NSK_FALSE; } else { NSK_DISPLAY0(" ... disabled\n"); @@ -268,9 +268,9 @@ callbackThreadStart(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { NSK_DISPLAY1(" for thread: %s\n", nsk_null_string(threadInfo.name)); } - if (threadInfo.name != NULL && strcmp(threadInfo.name, TESTED_THREAD_NAME) == 0) { + if (threadInfo.name != nullptr && strcmp(threadInfo.name, TESTED_THREAD_NAME) == 0) { NSK_DISPLAY0(">>> Testcase #3: Check initial cpu time in THREAD_START callback\n"); - if (!checkCpuTime(jvmti, thread, &prevTestedThreadTime, NULL, "THREAD_START callback")) { + if (!checkCpuTime(jvmti, thread, &prevTestedThreadTime, nullptr, "THREAD_START callback")) { nsk_jvmti_setFailStatus(); } } @@ -292,7 +292,7 @@ callbackThreadEnd(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { NSK_DISPLAY1(" for thread: %s\n", nsk_null_string(threadInfo.name)); } - if (threadInfo.name != NULL && strcmp(threadInfo.name, TESTED_THREAD_NAME) == 0) { + if (threadInfo.name != nullptr && strcmp(threadInfo.name, TESTED_THREAD_NAME) == 0) { julong time = 0; NSK_DISPLAY0(">>> Testcase #5: Check final cpu time in THREAD_END callback\n"); if (!checkCpuTime(jvmti, thread, &time, &prevTestedThreadTime, "THREAD_END callback")) { @@ -316,7 +316,7 @@ JNIEXPORT jint JNI_OnLoad_thrcputime001(JavaVM *jvm, char *options, void *reserv } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -328,7 +328,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; NSK_DISPLAY1("Add required capability: %s\n", "can_get_thread_cpu_time"); @@ -360,11 +360,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } NSK_DISPLAY0(" ... callbacks set\n"); - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; NSK_DISPLAY1("Enable events: %d events\n", EVENTS_COUNT); - if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, NULL)) { + if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, nullptr)) { NSK_DISPLAY0(" ... enabled\n"); } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadCpuTime/thrcputime002/thrcputime002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadCpuTime/thrcputime002/thrcputime002.cpp index 2782c0606219..938ae04ceb17 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadCpuTime/thrcputime002/thrcputime002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadCpuTime/thrcputime002/thrcputime002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,9 +24,9 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -55,8 +55,8 @@ static jvmtiEvent threadEvents[THREAD_EVENTS_COUNT] = { static julong prevTestedThreadTime = 0; static julong prevAgentThreadTime = 0; -static jthread testedThread = NULL; -static jthread testAgentThread = NULL; +static jthread testedThread = nullptr; +static jthread testAgentThread = nullptr; static int iterations = 0; @@ -83,7 +83,7 @@ static int checkCpuTime(jvmtiEnv* jvmti, jthread thread, julong* time, where, julong_to_string(*time, buf)); } - if (prevTime != NULL) { + if (prevTime != nullptr) { julong diff = *time - *prevTime; NSK_DISPLAY1("Compare with previous time: %s\n", @@ -150,7 +150,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0(">>> Testcase #2: Check initial cpu time in agent thread\n"); { - if (!checkCpuTime(jvmti, testAgentThread, &prevAgentThreadTime, NULL, "agent thread")) { + if (!checkCpuTime(jvmti, testAgentThread, &prevAgentThreadTime, nullptr, "agent thread")) { nsk_jvmti_setFailStatus(); } } @@ -160,7 +160,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { runIterations(iterations); NSK_DISPLAY1("Enable thread events: %d events\n", THREAD_EVENTS_COUNT); - if (nsk_jvmti_enableEvents(JVMTI_ENABLE, THREAD_EVENTS_COUNT, threadEvents, NULL)) { + if (nsk_jvmti_enableEvents(JVMTI_ENABLE, THREAD_EVENTS_COUNT, threadEvents, nullptr)) { NSK_DISPLAY0(" ... enabled\n"); } @@ -180,7 +180,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } } - if (testedThread != NULL) { + if (testedThread != nullptr) { NSK_DISPLAY0(">>> Testcase #6: Check tested thread cpu time from agent thread\n"); { julong time = 0; @@ -198,7 +198,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { return; NSK_DISPLAY1("Disable thread events: %d events\n", THREAD_EVENTS_COUNT); - if (nsk_jvmti_enableEvents(JVMTI_DISABLE, THREAD_EVENTS_COUNT, threadEvents, NULL)) { + if (nsk_jvmti_enableEvents(JVMTI_DISABLE, THREAD_EVENTS_COUNT, threadEvents, nullptr)) { NSK_DISPLAY0(" ... disabled\n"); } } @@ -228,7 +228,7 @@ callbackVMInit(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { NSK_DISPLAY0(">>> Testcase #1: Check initial cpu time in VM_INIT callback\n"); { julong time = 0; - if (!checkCpuTime(jvmti, thread, &time, NULL, "VM_INIT callback")) { + if (!checkCpuTime(jvmti, thread, &time, nullptr, "VM_INIT callback")) { nsk_jvmti_setFailStatus(); } } @@ -242,7 +242,7 @@ callbackVMDeath(jvmtiEnv* jvmti, JNIEnv* jni) { int success = NSK_TRUE; NSK_DISPLAY1("Disable events: %d events\n", EVENTS_COUNT); - if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, NULL)) { + if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, nullptr)) { success = NSK_FALSE; } else { NSK_DISPLAY0(" ... disabled\n"); @@ -279,13 +279,13 @@ callbackThreadStart(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { } } - if (threadInfo.name != NULL && strcmp(threadInfo.name, TESTED_THREAD_NAME) == 0) { - if (!NSK_JNI_VERIFY(jni, (testedThread = jni->NewGlobalRef(thread)) != NULL)) { + if (threadInfo.name != nullptr && strcmp(threadInfo.name, TESTED_THREAD_NAME) == 0) { + if (!NSK_JNI_VERIFY(jni, (testedThread = jni->NewGlobalRef(thread)) != nullptr)) { nsk_jvmti_setFailStatus(); } NSK_DISPLAY0(">>> Testcase #4: Check initial cpu time in THREAD_START callback\n"); - if (!checkCpuTime(jvmti, thread, &prevTestedThreadTime, NULL, "THREAD_START callback")) { + if (!checkCpuTime(jvmti, thread, &prevTestedThreadTime, nullptr, "THREAD_START callback")) { nsk_jvmti_setFailStatus(); } } @@ -314,14 +314,14 @@ callbackThreadEnd(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { } } - if (threadInfo.name != NULL && strcmp(threadInfo.name, TESTED_THREAD_NAME) == 0) { + if (threadInfo.name != nullptr && strcmp(threadInfo.name, TESTED_THREAD_NAME) == 0) { julong time = 0; NSK_DISPLAY0(">>> Testcase #8: Check final cpu time in THREAD_END callback\n"); if (!checkCpuTime(jvmti, thread, &time, &prevTestedThreadTime, "THREAD_END callback")) { nsk_jvmti_setFailStatus(); } NSK_TRACE(jni->DeleteGlobalRef(testedThread)); - testedThread = NULL; + testedThread = nullptr; } } @@ -340,7 +340,7 @@ JNIEXPORT jint JNI_OnLoad_thrcputime002(JavaVM *jvm, char *options, void *reserv } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -352,7 +352,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; NSK_DISPLAY1("Add required capability: %s\n", "can_get_thread_cpu_time"); @@ -382,11 +382,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } NSK_DISPLAY0(" ... callbacks set\n"); - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; NSK_DISPLAY1("Enable events: %d events\n", EVENTS_COUNT); - if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, NULL)) { + if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, nullptr)) { NSK_DISPLAY0(" ... enabled\n"); } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadCpuTimerInfo/thrtimerinfo001/thrtimerinfo001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadCpuTimerInfo/thrtimerinfo001/thrtimerinfo001.cpp index 81bfb416b581..a7d741c4263b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadCpuTimerInfo/thrtimerinfo001/thrtimerinfo001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadCpuTimerInfo/thrtimerinfo001/thrtimerinfo001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,9 +24,9 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -76,7 +76,7 @@ static int checkTimerInfo(jvmtiEnv* jvmti, jvmtiTimerInfo* info, NSK_DISPLAY1(" may_skip_forward: %d\n", (int)info->may_skip_forward); NSK_DISPLAY1(" may_skip_backward: %d\n", (int)info->may_skip_backward); - if (initInfo != NULL) { + if (initInfo != nullptr) { NSK_DISPLAY0("Compare with initial timer info\n"); if (info->max_value != initInfo->max_value) { NSK_COMPLAIN4("In %s GetThreadCpuTimerInfo() returned different info:\n" @@ -132,7 +132,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0(">>> Testcases #3,4: Check timer info in thread events\n"); { NSK_DISPLAY1("Enable thread events: %d events\n", THREAD_EVENTS_COUNT); - if (nsk_jvmti_enableEvents(JVMTI_ENABLE, THREAD_EVENTS_COUNT, threadEvents, NULL)) { + if (nsk_jvmti_enableEvents(JVMTI_ENABLE, THREAD_EVENTS_COUNT, threadEvents, nullptr)) { NSK_DISPLAY0(" ... enabled\n"); } @@ -143,7 +143,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { return; NSK_DISPLAY1("Disable thread events: %d events\n", THREAD_EVENTS_COUNT); - if (nsk_jvmti_enableEvents(JVMTI_DISABLE, THREAD_EVENTS_COUNT, threadEvents, NULL)) { + if (nsk_jvmti_enableEvents(JVMTI_DISABLE, THREAD_EVENTS_COUNT, threadEvents, nullptr)) { NSK_DISPLAY0(" ... disabled\n"); } } @@ -163,7 +163,7 @@ callbackVMInit(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { NSK_DISPLAY0(">>> Testcase #1: Check initial timer info in VM_INIT callback\n"); { - if (!checkTimerInfo(jvmti, &initInfo, NULL, "VM_INIT callback")) { + if (!checkTimerInfo(jvmti, &initInfo, nullptr, "VM_INIT callback")) { nsk_jvmti_setFailStatus(); } } @@ -183,7 +183,7 @@ callbackVMDeath(jvmtiEnv* jvmti, JNIEnv* jni) { } NSK_DISPLAY1("Disable events: %d events\n", EVENTS_COUNT); - if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, NULL)) { + if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, nullptr)) { success = NSK_FALSE; } else { NSK_DISPLAY0(" ... disabled\n"); @@ -242,7 +242,7 @@ JNIEXPORT jint JNI_OnLoad_thrtimerinfo001(JavaVM *jvm, char *options, void *rese } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -250,7 +250,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; NSK_DISPLAY1("Add required capability: %s\n", "can_get_thread_cpu_time"); @@ -282,11 +282,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } NSK_DISPLAY0(" ... callbacks set\n"); - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; NSK_DISPLAY1("Enable events: %d events\n", EVENTS_COUNT); - if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, NULL)) { + if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, nullptr)) { NSK_DISPLAY0(" ... enabled\n"); } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadGroupChildren/getthrdgrpchld001/getthrdgrpchld001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadGroupChildren/getthrdgrpchld001/getthrdgrpchld001.cpp index 4c04b046d704..6e823d230aa5 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadGroupChildren/getthrdgrpchld001/getthrdgrpchld001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadGroupChildren/getthrdgrpchld001/getthrdgrpchld001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,17 +23,17 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { /* ============================================================================= */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* constant names */ @@ -69,15 +69,15 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { /* perform testing */ { - jthreadGroup rootGroup = NULL; - jthreadGroup runningGroup = NULL; - jthreadGroup notStartedGroup = NULL; - jthreadGroup finishedGroup = NULL; + jthreadGroup rootGroup = nullptr; + jthreadGroup runningGroup = nullptr; + jthreadGroup notStartedGroup = nullptr; + jthreadGroup finishedGroup = nullptr; /* find root thread group */ { jint topGroupsCount = 0; - jthreadGroup* topGroups = NULL; + jthreadGroup* topGroups = nullptr; NSK_DISPLAY0("Get top level thread groups\n"); if (!NSK_JVMTI_VERIFY( @@ -87,13 +87,13 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } NSK_DISPLAY1(" ... got groups: %d\n", (int)topGroupsCount); - if (!NSK_VERIFY(topGroupsCount > 0 && topGroups != NULL)) + if (!NSK_VERIFY(topGroupsCount > 0 && topGroups != nullptr)) return; NSK_DISPLAY1("Find thread group by name: %s\n", ROOT_GROUP_NAME); if (!NSK_VERIFY((rootGroup = findThreadGroupByName(jvmti, jni, ROOT_GROUP_NAME, - topGroupsCount, topGroups)) != NULL)) { + topGroupsCount, topGroups)) != nullptr)) { NSK_COMPLAIN1("No tested root thread group found: %s\n", ROOT_GROUP_NAME); nsk_jvmti_setFailStatus(); return; @@ -105,8 +105,8 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { { jint groupsCount = 0; jint threadsCount = 0; - jthread* threads = NULL; - jthreadGroup* groups = NULL; + jthread* threads = nullptr; + jthreadGroup* groups = nullptr; NSK_DISPLAY1("Get children of root thread group: %p\n", (void*)rootGroup); if (!NSK_JVMTI_VERIFY( @@ -150,7 +150,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { if (strcmp(info.name, RUNNING_GROUP_NAME) == 0) { NSK_DISPLAY2(" ... found runningThreadGroup: %p (%s)\n", groups[i], info.name); - if (runningGroup != NULL) { + if (runningGroup != nullptr) { NSK_COMPLAIN6("Duplicated runningThreadGroup in rootThreadGroup:\n" "# parent group: %p (%s)\n" "# existing group: %p (%s)\n" @@ -168,7 +168,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { if (strcmp(info.name, NOT_STARTED_GROUP_NAME) == 0) { NSK_DISPLAY2(" ... found notStartedThreadGroup: %p (%s)\n", groups[i], info.name); - if (notStartedGroup != NULL) { + if (notStartedGroup != nullptr) { NSK_COMPLAIN6("Duplicated notStartedThreadGroup in rootThreadGroup:\n" "# parent group: %p (%s)\n" "# existing group: %p (%s)\n" @@ -186,7 +186,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { if (strcmp(info.name, FINISHED_GROUP_NAME) == 0) { NSK_DISPLAY2(" ... found finishedThreadGroup: %p (%s)\n", groups[i], info.name); - if (finishedGroup != NULL) { + if (finishedGroup != nullptr) { NSK_COMPLAIN6("Duplicated finishedThreadGroup in rootThreadGroup:\n" "# parent group: %p (%s)\n" "# existing group: %p (%s)\n" @@ -243,7 +243,7 @@ static int checkThreadGroup(jvmtiEnv* jvmti, JNIEnv* jni, jint expectedThreadsCount, const char expectedThreadName[]) { size_t threadNameLen = strlen(expectedThreadName); - if (group == NULL) { + if (group == nullptr) { NSK_COMPLAIN1("No expected group found in rootThreadGroup: %s\n", groupName); nsk_jvmti_setFailStatus(); return NSK_FALSE; @@ -253,8 +253,8 @@ static int checkThreadGroup(jvmtiEnv* jvmti, JNIEnv* jni, { jint threadsCount = 0; jint groupsCount = 0; - jthread* threads = NULL; - jthreadGroup* groups = NULL; + jthread* threads = nullptr; + jthreadGroup* groups = nullptr; if (!NSK_JVMTI_VERIFY( jvmti->GetThreadGroupChildren(group, &threadsCount, &threads, &groupsCount, &groups))) { @@ -296,7 +296,7 @@ static int checkThreadGroup(jvmtiEnv* jvmti, JNIEnv* jni, NSK_DISPLAY2(" ... found thread: %p (%s)\n", (void*)threads[i], nsk_null_string(info.name)); - if (info.name == NULL || + if (info.name == nullptr || strncmp(info.name, expectedThreadName, threadNameLen) != 0) { NSK_COMPLAIN5("Found unexpected thread in thread group:\n" "# thread group: %p (%s)\n" @@ -327,31 +327,31 @@ static int checkThreadGroup(jvmtiEnv* jvmti, JNIEnv* jni, /** Recursively find thread group by its name among given groups and their childrens. */ static jthreadGroup findThreadGroupByName(jvmtiEnv* jvmti, JNIEnv* jni, const char name[], jint count, jthreadGroup groupsList[]) { - jthreadGroup foundGroup = NULL; + jthreadGroup foundGroup = nullptr; int i; - for (i = 0; i < count && foundGroup == NULL; i++) { + for (i = 0; i < count && foundGroup == nullptr; i++) { jint threadsCount = 0; jint groupsCount = 0; - jthread* threads = NULL; - jthreadGroup * groups = NULL; + jthread* threads = nullptr; + jthreadGroup * groups = nullptr; if (!NSK_JVMTI_VERIFY( jvmti->GetThreadGroupChildren(groupsList[i], &threadsCount, &threads, &groupsCount, &groups))) { nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } if (groupsCount > 0) { int j; - if (!NSK_VERIFY(groups != NULL)) - return NULL; + if (!NSK_VERIFY(groups != nullptr)) + return nullptr; for (j = 0; j < groupsCount; j++) { jvmtiThreadGroupInfo info; - if (groups[j] != NULL) { + if (groups[j] != nullptr) { if (!NSK_JVMTI_VERIFY( jvmti->GetThreadGroupInfo(groups[j], &info))) { @@ -366,7 +366,7 @@ static jthreadGroup findThreadGroupByName(jvmtiEnv* jvmti, JNIEnv* jni, const ch } } - if (foundGroup == NULL) { + if (foundGroup == nullptr) { foundGroup = findThreadGroupByName(jvmti, jni, name, groupsCount, groups); } } @@ -400,7 +400,7 @@ JNIEXPORT jint JNI_OnLoad_getthrdgrpchld001(JavaVM *jvm, char *options, void *re } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; /* init framework and parse options */ if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) @@ -415,11 +415,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadGroupInfo/thrgrpinfo001/thrgrpinfo001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadGroupInfo/thrgrpinfo001/thrgrpinfo001.cpp index 92134d1e0ff8..c578a8df9cdd 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadGroupInfo/thrgrpinfo001/thrgrpinfo001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadGroupInfo/thrgrpinfo001/thrgrpinfo001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; static jint stage = 0; @@ -53,12 +53,12 @@ JNIEXPORT jint JNI_OnLoad_thrgrpinfo001(JavaVM *jvm, char *options, void *reserv jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -72,7 +72,7 @@ Java_nsk_jvmti_GetThreadGroupInfo_thrgrpinfo001_check(JNIEnv *env, jclass cls, j jvmtiError err; jvmtiThreadGroupInfo inf; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -97,7 +97,7 @@ Java_nsk_jvmti_GetThreadGroupInfo_thrgrpinfo001_check(JNIEnv *env, jclass cls, j (inf.is_daemon == JNI_TRUE) ? "true" : "false"); } - if (inf.name == NULL || strcmp(inf.name, expName) != 0) { + if (inf.name == nullptr || strcmp(inf.name, expName) != 0) { printf("(%d) unexpected name: \"%s\",", stage, inf.name); printf(" expected: \"%s\"\n", expName); result = STATUS_FAILED; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadGroupInfo/thrgrpinfo002/thrgrpinfo002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadGroupInfo/thrgrpinfo002/thrgrpinfo002.cpp index 0a57ad0ea8f6..7ea27fdee6f8 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadGroupInfo/thrgrpinfo002/thrgrpinfo002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadGroupInfo/thrgrpinfo002/thrgrpinfo002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_thrgrpinfo002(JavaVM *jvm, char *options, void *reserv jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -71,7 +71,7 @@ Java_nsk_jvmti_GetThreadGroupInfo_thrgrpinfo002_check(JNIEnv *env, jclass cls) { jthreadGroup *groups; jvmtiThreadGroupInfo inf; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -89,7 +89,7 @@ Java_nsk_jvmti_GetThreadGroupInfo_thrgrpinfo002_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> invalid group check ...\n"); } - err = jvmti->GetThreadGroupInfo(NULL, &inf); + err = jvmti->GetThreadGroupInfo(nullptr, &inf); if (err != JVMTI_ERROR_INVALID_THREAD_GROUP) { printf("Error expected: JVMTI_ERROR_INVALID_THREAD_GROUP,\n"); printf(" got: %s (%d)\n", TranslateError(err), err); @@ -99,7 +99,7 @@ Java_nsk_jvmti_GetThreadGroupInfo_thrgrpinfo002_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> null pointer check ...\n"); } - err = jvmti->GetThreadGroupInfo(*groups, NULL); + err = jvmti->GetThreadGroupInfo(*groups, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { printf("Error expected: JVMTI_ERROR_NULL_POINTER,\n"); printf(" got: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadLocalStorage/getthrdstor001/getthrdstor001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadLocalStorage/getthrdstor001/getthrdstor001.cpp index a37007735d06..79254fcfe542 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadLocalStorage/getthrdstor001/getthrdstor001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetThreadLocalStorage/getthrdstor001/getthrdstor001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -48,12 +48,12 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { /* perform testing */ { - jthread testedThread = NULL; - void* storage = NULL; + jthread testedThread = nullptr; + void* storage = nullptr; NSK_DISPLAY1("Find thread: %s\n", THREAD_NAME); if (!NSK_VERIFY((testedThread = - nsk_jvmti_threadByName(THREAD_NAME)) != NULL)) + nsk_jvmti_threadByName(THREAD_NAME)) != nullptr)) return; NSK_DISPLAY1(" ... found thread: %p\n", (void*)testedThread); @@ -65,9 +65,9 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } NSK_DISPLAY1(" ... got storage: %p\n", (void*)storage); - NSK_DISPLAY0("Check obtained storage pointer against NULL\n"); - if (storage != NULL) { - NSK_COMPLAIN2("GetThreadLocalStorage() returned NOT NULL storage for tested thread:\n" + NSK_DISPLAY0("Check obtained storage pointer against null\n"); + if (storage != nullptr) { + NSK_COMPLAIN2("GetThreadLocalStorage() returned NOT null storage for tested thread:\n" "# thread: %p\n" "# storage: %p\n", (void*)testedThread, (void*)storage); @@ -76,15 +76,15 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0("GetThreadLocalStorage() for current agent thread\n"); if (!NSK_JVMTI_VERIFY( - jvmti->GetThreadLocalStorage(NULL, &storage))) { + jvmti->GetThreadLocalStorage(nullptr, &storage))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY1(" ... got storage: %p\n", (void*)storage); - NSK_DISPLAY0("Check obtained storage pointer against NULL\n"); - if (storage != NULL) { - NSK_COMPLAIN1("GetThreadLocalStorage() returned NOT NULL storage for current agent thread:\n" + NSK_DISPLAY0("Check obtained storage pointer against null\n"); + if (storage != nullptr) { + NSK_COMPLAIN1("GetThreadLocalStorage() returned NOT null storage for current agent thread:\n" "# storage: %p\n", (void*)storage); nsk_jvmti_setFailStatus(); @@ -114,7 +114,7 @@ JNIEXPORT jint JNI_OnLoad_getthrdstor001(JavaVM *jvm, char *options, void *reser } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; /* init framework and parse options */ if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) @@ -124,11 +124,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTime/gettime001/gettime001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTime/gettime001/gettime001.cpp index 3ed38448feb6..3f50ec721ccc 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTime/gettime001/gettime001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTime/gettime001/gettime001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,9 +24,9 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -64,7 +64,7 @@ static bool checkTime(jvmtiEnv* jvmti, julong* time, } NSK_DISPLAY1(" ... got time: %s\n", julong_to_string(*time, buf)); - if (prevTime != NULL) { + if (prevTime != nullptr) { julong diff = *time - *prevTime; NSK_DISPLAY1("Compare with previous time: %s\n", @@ -141,7 +141,7 @@ callbackVMDeath(jvmtiEnv* jvmti, JNIEnv* jni) { } NSK_DISPLAY1("Disable events: %d events\n", EVENTS_COUNT); - if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, NULL)) { + if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, nullptr)) { success = false; } else { NSK_DISPLAY0(" ... disabled\n"); @@ -168,7 +168,7 @@ JNIEXPORT jint JNI_OnLoad_gettime001(JavaVM *jvm, char *options, void *reserved) } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -176,7 +176,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; { @@ -192,18 +192,18 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; NSK_DISPLAY0(">>> Testcase #1: Check initial time in Agent_OnLoad()\n"); { - if (!checkTime(jvmti, &prevTime, NULL, "Agent_OnLoad()")) { + if (!checkTime(jvmti, &prevTime, nullptr, "Agent_OnLoad()")) { nsk_jvmti_setFailStatus(); } } NSK_DISPLAY1("Enable events: %d events\n", EVENTS_COUNT); - if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, NULL)) { + if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, nullptr)) { NSK_DISPLAY0(" ... enabled\n"); } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTimerInfo/timerinfo001/timerinfo001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTimerInfo/timerinfo001/timerinfo001.cpp index daa5778d1948..9d53767b3ac3 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTimerInfo/timerinfo001/timerinfo001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTimerInfo/timerinfo001/timerinfo001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,9 +24,9 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -69,7 +69,7 @@ static bool checkTimerInfo(jvmtiEnv* jvmti, jvmtiTimerInfo* info, NSK_DISPLAY1(" may_skip_forward: %d\n", (int)info->may_skip_forward); NSK_DISPLAY1(" may_skip_backward: %d\n", (int)info->may_skip_backward); - if (initInfo != NULL) { + if (initInfo != nullptr) { NSK_DISPLAY0("Compare with initial timer info\n"); if (info->max_value != initInfo->max_value) { NSK_COMPLAIN4("In %s GetTimerInfo() returned different info:\n" @@ -158,7 +158,7 @@ callbackVMDeath(jvmtiEnv* jvmti, JNIEnv* jni) { } NSK_DISPLAY1("Disable events: %d events\n", EVENTS_COUNT); - if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, NULL)) { + if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, nullptr)) { success = false; } else { NSK_DISPLAY0(" ... disabled\n"); @@ -185,7 +185,7 @@ JNIEXPORT jint JNI_OnLoad_timerinfo001(JavaVM *jvm, char *options, void *reserve } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -193,7 +193,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; { @@ -209,18 +209,18 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; NSK_DISPLAY0(">>> Testcase #1: Check initial timer info in Agent_OnLoad()\n"); { - if (!checkTimerInfo(jvmti, &initInfo, NULL, "Agent_OnLoad()")) { + if (!checkTimerInfo(jvmti, &initInfo, nullptr, "Agent_OnLoad()")) { nsk_jvmti_setFailStatus(); } } NSK_DISPLAY1("Enable events: %d events\n", EVENTS_COUNT); - if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, NULL)) { + if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, nullptr)) { NSK_DISPLAY0(" ... enabled\n"); } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTopThreadGroups/topthrgrp001/topthrgrp001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTopThreadGroups/topthrgrp001/topthrgrp001.cpp index 748880fee418..624fbdd07910 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTopThreadGroups/topthrgrp001/topthrgrp001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTopThreadGroups/topthrgrp001/topthrgrp001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_topthrgrp001(JavaVM *jvm, char *options, void *reserve jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -68,10 +68,10 @@ JNIEXPORT jint JNICALL Java_nsk_jvmti_GetTopThreadGroups_topthrgrp001_check(JNIEnv *env, jclass cls) { jvmtiError err; jint i, groupCount = 0; - jthreadGroup *groups = NULL; + jthreadGroup *groups = nullptr; jvmtiThreadGroupInfo inf; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -105,7 +105,7 @@ Java_nsk_jvmti_GetTopThreadGroups_topthrgrp001_check(JNIEnv *env, jclass cls) { printf(">>> is daemon: %s\n", (inf.is_daemon == JNI_TRUE) ? "true" : "false"); } - if (inf.parent != NULL) { + if (inf.parent != nullptr) { printf("ERROR: thread group is not parentless!\n"); printf(" group name: %s\n", inf.name); printf(" parent: 0x%p\n", inf.parent); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTopThreadGroups/topthrgrp002/topthrgrp002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTopThreadGroups/topthrgrp002/topthrgrp002.cpp index 50b23125dfa2..2a0ab2e71f59 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTopThreadGroups/topthrgrp002/topthrgrp002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetTopThreadGroups/topthrgrp002/topthrgrp002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_topthrgrp002(JavaVM *jvm, char *options, void *reserve jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -70,7 +70,7 @@ Java_nsk_jvmti_GetTopThreadGroups_topthrgrp002_check(JNIEnv *env, jclass cls) { jint groupCount; jthreadGroup *groups; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -78,7 +78,7 @@ Java_nsk_jvmti_GetTopThreadGroups_topthrgrp002_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> (groupCountPtr) null pointer check ...\n"); } - err = jvmti->GetTopThreadGroups(NULL, &groups); + err = jvmti->GetTopThreadGroups(nullptr, &groups); if (err != JVMTI_ERROR_NULL_POINTER) { printf("(groupCountPtr) error expected: JVMTI_ERROR_NULL_POINTER,\n"); printf(" got: %s (%d)\n", TranslateError(err), err); @@ -88,7 +88,7 @@ Java_nsk_jvmti_GetTopThreadGroups_topthrgrp002_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> (groupsPtr) null pointer check ...\n"); } - err = jvmti->GetTopThreadGroups(&groupCount, NULL); + err = jvmti->GetTopThreadGroups(&groupCount, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { printf("(groupsPtr) error expected: JVMTI_ERROR_NULL_POINTER,\n"); printf(" got: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetVersionNumber/getvern001/getvern001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetVersionNumber/getvern001/getvern001.cpp index 1d8071891fc2..78ac1fa445ac 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetVersionNumber/getvern001/getvern001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/GetVersionNumber/getvern001/getvern001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_getvern001(JavaVM *jvm, char *options, void *reserved) jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -68,7 +68,7 @@ JNIEXPORT jint JNICALL Java_nsk_jvmti_GetVersionNumber_getvern001_check(JNIEnv * jvmtiError err; jint ver = 0; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -90,7 +90,7 @@ JNIEXPORT jint JNICALL Java_nsk_jvmti_GetVersionNumber_getvern001_check(JNIEnv * if (printdump == JNI_TRUE) { printf(">>> null pointer check ...\n"); } - err = jvmti->GetVersionNumber(NULL); + err = jvmti->GetVersionNumber(nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { printf("Error expected: JVMTI_ERROR_NULL_POINTER, got: %s\n", TranslateError(err)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/InterruptThread/intrpthrd001/intrpthrd001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/InterruptThread/intrpthrd001/intrpthrd001.cpp index 2bdfea11a6f2..f413d63bd769 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/InterruptThread/intrpthrd001/intrpthrd001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/InterruptThread/intrpthrd001/intrpthrd001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" #define PASSED 0 #define STATUS_FAILED 2 @@ -38,9 +38,9 @@ extern "C" { static jlong timeout = 0; /* test objects */ -static jthread runningThread = NULL; -static jthread waitingThread = NULL; -static jthread sleepingThread = NULL; +static jthread runningThread = nullptr; +static jthread waitingThread = nullptr; +static jthread sleepingThread = nullptr; /* ========================================================================== */ @@ -49,7 +49,7 @@ static int prepare(jvmtiEnv* jvmti) { const char* WAITING_THREAD_NAME = "DebuggeeWaitingThread"; const char* SLEEPING_THREAD_NAME = "DebuggeeSleepingThread"; jvmtiThreadInfo info; - jthread *threads = NULL; + jthread *threads = nullptr; jint threads_count = 0; int i; @@ -60,12 +60,12 @@ static int prepare(jvmtiEnv* jvmti) { jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -76,7 +76,7 @@ static int prepare(jvmtiEnv* jvmti) { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL) { + if (info.name != nullptr) { if (strcmp(info.name, RUNNING_THREAD_NAME) == 0) { runningThread = threads[i]; } else if (strcmp(info.name, WAITING_THREAD_NAME) == 0) { @@ -109,7 +109,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } NSK_DISPLAY0("Testcase #1: call InterruptThread for runningThread\n"); - if (!NSK_VERIFY(runningThread != NULL)) { + if (!NSK_VERIFY(runningThread != nullptr)) { nsk_jvmti_setFailStatus(); } else { if (!NSK_JVMTI_VERIFY(jvmti->InterruptThread(runningThread))) @@ -117,7 +117,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } NSK_DISPLAY0("Testcase #2: call InterruptThread for waitingThread\n"); - if (!NSK_VERIFY(waitingThread != NULL)) { + if (!NSK_VERIFY(waitingThread != nullptr)) { nsk_jvmti_setFailStatus(); } else { if (!NSK_JVMTI_VERIFY(jvmti->InterruptThread(waitingThread))) @@ -125,7 +125,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } NSK_DISPLAY0("Testcase #3: call InterruptThread for sleepingThread\n"); - if (!NSK_VERIFY(sleepingThread != NULL)) { + if (!NSK_VERIFY(sleepingThread != nullptr)) { nsk_jvmti_setFailStatus(); } else { if (!NSK_JVMTI_VERIFY(jvmti->InterruptThread(sleepingThread))) @@ -151,7 +151,7 @@ JNIEXPORT jint JNI_OnLoad_intrpthrd001(JavaVM *jvm, char *options, void *reserve } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiCapabilities caps; NSK_DISPLAY0("Agent_OnLoad\n"); @@ -162,10 +162,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&caps, 0, sizeof(caps)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/InterruptThread/intrpthrd002/intrpthrd002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/InterruptThread/intrpthrd002/intrpthrd002.cpp index 60c2384b1c1a..9f9affc6722f 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/InterruptThread/intrpthrd002/intrpthrd002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/InterruptThread/intrpthrd002/intrpthrd002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -53,7 +53,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/InterruptThread/intrpthrd003/intrpthrd003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/InterruptThread/intrpthrd003/intrpthrd003.cpp index b05c5d5cd7de..c29d495c1f80 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/InterruptThread/intrpthrd003/intrpthrd003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/InterruptThread/intrpthrd003/intrpthrd003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,9 +24,9 @@ #include #include #include "jvmti.h" -#include "jni_tools.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -55,7 +55,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsArrayClass/isarray004/isarray004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsArrayClass/isarray004/isarray004.cpp index 30277bcc619f..7976427a24ad 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsArrayClass/isarray004/isarray004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsArrayClass/isarray004/isarray004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_isarray004(JavaVM *jvm, char *options, void *reserved) jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -69,7 +69,7 @@ Java_nsk_jvmti_IsArrayClass_isarray004_check(JNIEnv *env, jclass cls) { jvmtiError err; jboolean isArrayClass; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -77,7 +77,7 @@ Java_nsk_jvmti_IsArrayClass_isarray004_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> invalid class check ...\n"); } - err = jvmti->IsArrayClass(NULL, &isArrayClass); + err = jvmti->IsArrayClass(nullptr, &isArrayClass); if (err != JVMTI_ERROR_INVALID_CLASS) { printf("Error expected: JVMTI_ERROR_INVALID_CLASS,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -87,7 +87,7 @@ Java_nsk_jvmti_IsArrayClass_isarray004_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> null pointer check ...\n"); } - err = jvmti->IsArrayClass(cls, NULL); + err = jvmti->IsArrayClass(cls, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { printf("Error expected: JVMTI_ERROR_NULL_POINTER,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsArrayClass/isarray005/isarray005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsArrayClass/isarray005/isarray005.cpp index 4aacc6f21fe1..8cee41638d2b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsArrayClass/isarray005/isarray005.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsArrayClass/isarray005/isarray005.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_isarray005(JavaVM *jvm, char *options, void *reserved) jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -75,7 +75,7 @@ Java_nsk_jvmti_IsArrayClass_isarray005_check(JNIEnv *env, jboolean isArrayClass; char *sig, *generic; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsFieldSynthetic/isfldsin002/isfldsin002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsFieldSynthetic/isfldsin002/isfldsin002.cpp index ca52e5801d2d..5babeef57877 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsFieldSynthetic/isfldsin002/isfldsin002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsFieldSynthetic/isfldsin002/isfldsin002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -53,12 +53,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -97,13 +97,13 @@ Java_nsk_jvmti_IsFieldSynthetic_isfldsin002_check(JNIEnv *env, jclass cls) { jfieldID fid; jboolean isSynthetic; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } fid = env->GetFieldID(cls, "fld", "I"); - if (fid == NULL) { + if (fid == nullptr) { printf("Cannot get field ID!\n"); return STATUS_FAILED; } @@ -111,7 +111,7 @@ Java_nsk_jvmti_IsFieldSynthetic_isfldsin002_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> invalid class check ...\n"); } - err = jvmti->IsFieldSynthetic(NULL, fid, &isSynthetic); + err = jvmti->IsFieldSynthetic(nullptr, fid, &isSynthetic); if (err == JVMTI_ERROR_MUST_POSSESS_CAPABILITY && !caps.can_get_synthetic_attribute) { /* It is OK */ @@ -124,7 +124,7 @@ Java_nsk_jvmti_IsFieldSynthetic_isfldsin002_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> invalid field check ...\n"); } - err = jvmti->IsFieldSynthetic(cls, NULL, &isSynthetic); + err = jvmti->IsFieldSynthetic(cls, nullptr, &isSynthetic); if (err == JVMTI_ERROR_MUST_POSSESS_CAPABILITY && !caps.can_get_synthetic_attribute) { /* It is OK */ @@ -137,7 +137,7 @@ Java_nsk_jvmti_IsFieldSynthetic_isfldsin002_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> null pointer check ...\n"); } - err = jvmti->IsFieldSynthetic(cls, fid, NULL); + err = jvmti->IsFieldSynthetic(cls, fid, nullptr); if (err == JVMTI_ERROR_MUST_POSSESS_CAPABILITY && !caps.can_get_synthetic_attribute) { /* It is OK */ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsFieldSynthetic/isfldsin003/isfldsin003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsFieldSynthetic/isfldsin003/isfldsin003.cpp index a06e1fd1dff3..2ffd6ca0e9a0 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsFieldSynthetic/isfldsin003/isfldsin003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsFieldSynthetic/isfldsin003/isfldsin003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -40,7 +40,7 @@ typedef struct { jboolean is_synthetic; } field_info; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -64,12 +64,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -114,14 +114,14 @@ Java_nsk_jvmti_IsFieldSynthetic_isfldsin003a_check(JNIEnv *env, jboolean isSynthetic; size_t i; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } for (i = 0; i < sizeof(fields) / sizeof(field_info); i++) { fid = env->GetFieldID(clazz, fields[i].name, fields[i].sig); - if (fid == NULL) { + if (fid == nullptr) { printf("(%" PRIuPTR ") cannot get field ID for %s:\"%s\"\n", i, fields[i].name, fields[i].sig); result = STATUS_FAILED; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsInterface/isintrf004/isintrf004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsInterface/isintrf004/isintrf004.cpp index 01c232547f7e..6287e5846a25 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsInterface/isintrf004/isintrf004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsInterface/isintrf004/isintrf004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_isintrf004(JavaVM *jvm, char *options, void *reserved) jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -69,7 +69,7 @@ Java_nsk_jvmti_IsInterface_isintrf004_check(JNIEnv *env, jclass cls) { jvmtiError err; jboolean isInterface; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -77,7 +77,7 @@ Java_nsk_jvmti_IsInterface_isintrf004_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> invalid class check ...\n"); } - err = jvmti->IsInterface(NULL, &isInterface); + err = jvmti->IsInterface(nullptr, &isInterface); if (err != JVMTI_ERROR_INVALID_CLASS) { printf("Error expected: JVMTI_ERROR_INVALID_CLASS,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -87,7 +87,7 @@ Java_nsk_jvmti_IsInterface_isintrf004_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> null pointer check ...\n"); } - err = jvmti->IsInterface(cls, NULL); + err = jvmti->IsInterface(cls, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { printf("Error expected: JVMTI_ERROR_NULL_POINTER,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsInterface/isintrf005/isintrf005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsInterface/isintrf005/isintrf005.cpp index 887cd625052e..c014249ed4dd 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsInterface/isintrf005/isintrf005.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsInterface/isintrf005/isintrf005.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_isintrf005(JavaVM *jvm, char *options, void *reserved) jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -74,7 +74,7 @@ Java_nsk_jvmti_IsInterface_isintrf005_check(JNIEnv *env, jclass cls, jclass claz jboolean isInterface; char *sig, *generic; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodNative/isnative001/isnative001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodNative/isnative001/isnative001.cpp index f4af7621adbd..500d16405e67 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodNative/isnative001/isnative001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodNative/isnative001/isnative001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_isnative001(JavaVM *jvm, char *options, void *reserved jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -79,7 +79,7 @@ void checkMeth(JNIEnv *env, jclass cl, } else { mid = env->GetMethodID(cl, name, sig); } - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot find MethodID for \"%s%s\"\n", name, sig); result = STATUS_FAILED; return; @@ -116,7 +116,7 @@ Java_nsk_jvmti_IsMethodNative_isnative001_check(JNIEnv *env, jclass cls) { checkMeth(env, cls, "check", "()I", 1, JNI_TRUE); clsId = env->FindClass("nsk/jvmti/IsMethodNative/isnative001$Inn"); - if (clsId == NULL) { + if (clsId == nullptr) { printf("Cannot find nsk.jvmti.IsMethodNative.isnative001$Inn class!\n"); return STATUS_FAILED; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodNative/isnative002/isnative002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodNative/isnative002/isnative002.cpp index 995283467664..6c8dd65b0d16 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodNative/isnative002/isnative002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodNative/isnative002/isnative002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_isnative002(JavaVM *jvm, char *options, void *reserved jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -70,13 +70,13 @@ Java_nsk_jvmti_IsMethodNative_isnative002_check(JNIEnv *env, jclass cls) { jmethodID mid; jboolean isNative; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } mid = env->GetMethodID(cls, "", "()V"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot get method ID!\n"); return STATUS_FAILED; } @@ -84,7 +84,7 @@ Java_nsk_jvmti_IsMethodNative_isnative002_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> invalid method check ...\n"); } - err = jvmti->IsMethodNative(NULL, &isNative); + err = jvmti->IsMethodNative(nullptr, &isNative); if (err != JVMTI_ERROR_INVALID_METHODID) { printf("Error expected: JVMTI_ERROR_INVALID_METHODID,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); @@ -94,7 +94,7 @@ Java_nsk_jvmti_IsMethodNative_isnative002_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> null pointer check ...\n"); } - err = jvmti->IsMethodNative(mid, NULL); + err = jvmti->IsMethodNative(mid, nullptr); if (err != JVMTI_ERROR_NULL_POINTER) { printf("Error expected: JVMTI_ERROR_NULL_POINTER,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodObsolete/isobsolete001/isobsolete001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodObsolete/isobsolete001/isobsolete001.cpp index 399d894f9b44..0d7aeb1f4c30 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodObsolete/isobsolete001/isobsolete001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodObsolete/isobsolete001/isobsolete001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -95,10 +95,10 @@ static void checkStackMethodsObsolete(jvmtiEnv* jvmti, jthread thread, int i; for (i = 0; i < frameCount; i++) { - char* name = NULL; - char* signature = NULL; - char* generic = NULL; - char* kind = NULL; + char* name = nullptr; + char* signature = nullptr; + char* generic = nullptr; + char* kind = nullptr; NSK_DISPLAY1(" frame #%i:\n", i); NSK_DISPLAY1(" methodID: %p\n", (void*)frameStack[i].method); @@ -110,7 +110,7 @@ static void checkStackMethodsObsolete(jvmtiEnv* jvmti, jthread thread, NSK_DISPLAY1(" name: %s\n", nsk_null_string(name)); NSK_DISPLAY1(" signature: %s\n", nsk_null_string(signature)); NSK_DISPLAY1(" generic: %s\n", nsk_null_string(generic)); - if (name != NULL + if (name != nullptr && (strcmp(STATIC_METHOD_NAME, name) == 0 || strcmp(INSTANCE_METHOD_NAME, name) == 0)) { found++; @@ -166,15 +166,15 @@ static int redefineClass(jvmtiEnv* jvmti, jclass klass, const char className[], /** Get classfile bytes to redefine. */ static int getClassfileBytes(JNIEnv* jni, jvmtiEnv* jvmti, jint* size, unsigned char* *bytes) { - jclass debugeeClass = NULL; - jfieldID fieldID = NULL; - jbyteArray array = NULL; + jclass debugeeClass = nullptr; + jfieldID fieldID = nullptr; + jbyteArray array = nullptr; jbyte* elements; int i; NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME); if (!NSK_JNI_VERIFY(jni, (debugeeClass = - jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) { + jni->FindClass(DEBUGEE_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -182,7 +182,7 @@ static int getClassfileBytes(JNIEnv* jni, jvmtiEnv* jvmti, NSK_DISPLAY1("Find static field: %s\n", CLASSFILE_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (fieldID = - jni->GetStaticFieldID(debugeeClass, CLASSFILE_FIELD_NAME, CLASSFILE_FIELD_SIG)) != NULL)) { + jni->GetStaticFieldID(debugeeClass, CLASSFILE_FIELD_NAME, CLASSFILE_FIELD_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -190,7 +190,7 @@ static int getClassfileBytes(JNIEnv* jni, jvmtiEnv* jvmti, NSK_DISPLAY1("Get classfile bytes array from static field: %s\n", CLASSFILE_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (array = (jbyteArray) - jni->GetStaticObjectField(debugeeClass, fieldID)) != NULL)) { + jni->GetStaticObjectField(debugeeClass, fieldID)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -206,7 +206,7 @@ static int getClassfileBytes(JNIEnv* jni, jvmtiEnv* jvmti, { jboolean isCopy; if (!NSK_JNI_VERIFY(jni, (elements = - jni->GetByteArrayElements(array, &isCopy)) != NULL)) { + jni->GetByteArrayElements(array, &isCopy)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -242,11 +242,11 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { /* perform testing */ { - jclass testedClass = NULL; - jobject testedThread = NULL; - jmethodID staticMethodID = NULL; - jmethodID instanceMethodID = NULL; - unsigned char* classfileBytes = NULL; + jclass testedClass = nullptr; + jobject testedThread = nullptr; + jmethodID staticMethodID = nullptr; + jmethodID instanceMethodID = nullptr; + unsigned char* classfileBytes = nullptr; jint classfileSize = 0; NSK_DISPLAY0(">>> Obtain bytes for class file redefinition\n"); @@ -259,7 +259,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { { NSK_DISPLAY1("Find tested class: %s\n", TESTED_CLASS_NAME); if (!NSK_JNI_VERIFY(jni, (testedClass = - jni->FindClass(TESTED_CLASS_NAME)) != NULL)) { + jni->FindClass(TESTED_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -267,7 +267,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY1("Make global reference for class object: %p\n", (void*)testedClass); if (!NSK_JNI_VERIFY(jni, (testedClass = (jclass) - jni->NewGlobalRef(testedClass)) != NULL)) { + jni->NewGlobalRef(testedClass)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -275,7 +275,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY1("Get static methodID: %s\n", STATIC_METHOD_NAME); if (!NSK_JNI_VERIFY(jni, (staticMethodID = - jni->GetStaticMethodID(testedClass, STATIC_METHOD_NAME, STATIC_METHOD_SIG)) != NULL)) { + jni->GetStaticMethodID(testedClass, STATIC_METHOD_NAME, STATIC_METHOD_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -283,7 +283,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY1("Get instance methodID: %s\n", INSTANCE_METHOD_NAME); if (!NSK_JNI_VERIFY(jni, (instanceMethodID = - jni->GetMethodID(testedClass, INSTANCE_METHOD_NAME, INSTANCE_METHOD_SIG)) != NULL)) { + jni->GetMethodID(testedClass, INSTANCE_METHOD_NAME, INSTANCE_METHOD_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -291,7 +291,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY1("Find thread with running methods by name: %s\n", TESTED_THREAD_NAME); if (!NSK_VERIFY((testedThread = - nsk_jvmti_threadByName(TESTED_THREAD_NAME)) != NULL)) { + nsk_jvmti_threadByName(TESTED_THREAD_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -367,7 +367,7 @@ JNIEXPORT jint JNI_OnLoad_isobsolete001(JavaVM *jvm, char *options, void *reserv } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; /* init framework and parse options */ if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) @@ -377,7 +377,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add required capabilities */ @@ -393,7 +393,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodSynthetic/issynth001/issynth001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodSynthetic/issynth001/issynth001.cpp index e9088348e02d..e30eb3a0ab31 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodSynthetic/issynth001/issynth001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodSynthetic/issynth001/issynth001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -41,7 +41,7 @@ typedef struct { jboolean is_synthetic; } method_info; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -76,12 +76,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -139,7 +139,7 @@ Java_nsk_jvmti_IsMethodSynthetic_issynth001a_check(JNIEnv *env, } else { mid = env->GetMethodID(cl, methods[i].name, methods[i].signature); } - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot find MethodID for \"%s%s\"\n", methods[i].name, methods[i].signature); result = STATUS_FAILED; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodSynthetic/issynth002/issynth002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodSynthetic/issynth002/issynth002.cpp index 96eb657d238f..ae2c3106344f 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodSynthetic/issynth002/issynth002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IsMethodSynthetic/issynth002/issynth002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -53,12 +53,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -97,13 +97,13 @@ Java_nsk_jvmti_IsMethodSynthetic_issynth002_check(JNIEnv *env, jclass cls) { jmethodID mid; jboolean isSynthetic; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } mid = env->GetMethodID(cls, "", "()V"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot find method \"()V\"!\n"); return STATUS_FAILED; } @@ -111,7 +111,7 @@ Java_nsk_jvmti_IsMethodSynthetic_issynth002_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> invalid method check ...\n"); } - err = jvmti->IsMethodSynthetic(NULL, &isSynthetic); + err = jvmti->IsMethodSynthetic(nullptr, &isSynthetic); if (err == JVMTI_ERROR_MUST_POSSESS_CAPABILITY && !caps.can_get_synthetic_attribute) { /* It is OK */ @@ -124,7 +124,7 @@ Java_nsk_jvmti_IsMethodSynthetic_issynth002_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> null pointer check ...\n"); } - err = jvmti->IsMethodSynthetic(mid, NULL); + err = jvmti->IsMethodSynthetic(mid, nullptr); if (err == JVMTI_ERROR_MUST_POSSESS_CAPABILITY && !caps.can_get_synthetic_attribute) { /* It is OK */ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap001/iterheap001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap001/iterheap001.cpp index 3d54b28b6c8c..dc2a5c3a0ba7 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap001/iterheap001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap001/iterheap001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -65,7 +65,7 @@ typedef struct ObjectDescStruct { static int chainLength = 0; static int objectsCount = 0; -static ObjectDesc* objectDescList = NULL; +static ObjectDesc* objectDescList = nullptr; static volatile int foundUntagged = 0; @@ -82,7 +82,7 @@ static int getChainObjects(jvmtiEnv* jvmti, JNIEnv* jni, jobject firstObject, jlong tag, int reachable) { int success = NSK_TRUE; - jobject obj = NULL; + jobject obj = nullptr; jlong objTag = (!reachable ? -tag : (tag % 2 != 0) ? tag : (jlong)0); if (count <= 0) @@ -92,7 +92,7 @@ static int getChainObjects(jvmtiEnv* jvmti, JNIEnv* jni, jobject firstObject, tag++; if (!NSK_JNI_VERIFY(jni, (obj = - jni->GetObjectField(firstObject, firstField)) != NULL)) { + jni->GetObjectField(firstObject, firstField)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -118,16 +118,16 @@ static int getChainObjects(jvmtiEnv* jvmti, JNIEnv* jni, jobject firstObject, /** Obtain all tested objects from debugee class and tag them recursively. */ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, int *objectsCount, ObjectDesc* *objectDescList) { - jclass debugeeClass = NULL; - jclass rootObjectClass = NULL; - jclass chainObjectClass = NULL; + jclass debugeeClass = nullptr; + jclass rootObjectClass = nullptr; + jclass chainObjectClass = nullptr; - jfieldID objectField = NULL; - jfieldID reachableChainField = NULL; - jfieldID unreachableChainField = NULL; - jfieldID tailField = NULL; + jfieldID objectField = nullptr; + jfieldID reachableChainField = nullptr; + jfieldID unreachableChainField = nullptr; + jfieldID tailField = nullptr; - jobject rootObject = NULL; + jobject rootObject = nullptr; jlong chainObjectTag = 100; @@ -151,7 +151,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME); if (!NSK_JNI_VERIFY(jni, (debugeeClass = - jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) { + jni->FindClass(DEBUGEE_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -159,7 +159,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find root object class: %s\n", ROOT_OBJECT_CLASS_NAME); if (!NSK_JNI_VERIFY(jni, (rootObjectClass = - jni->FindClass(ROOT_OBJECT_CLASS_NAME)) != NULL)) { + jni->FindClass(ROOT_OBJECT_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -167,7 +167,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find chain object class: %s\n", CHAIN_OBJECT_CLASS_NAME); if (!NSK_JNI_VERIFY(jni, (chainObjectClass = - jni->FindClass(CHAIN_OBJECT_CLASS_NAME)) != NULL)) { + jni->FindClass(CHAIN_OBJECT_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -175,7 +175,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find static field in debugee class: %s\n", OBJECT_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (objectField = - jni->GetStaticFieldID(debugeeClass, OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != NULL)) { + jni->GetStaticFieldID(debugeeClass, OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -183,7 +183,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find instance field in root object class: %s\n", REACHABLE_CHAIN_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (reachableChainField = - jni->GetFieldID(rootObjectClass, REACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) { + jni->GetFieldID(rootObjectClass, REACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -191,7 +191,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find instance field in root object class: %s\n", UNREACHABLE_CHAIN_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (unreachableChainField = - jni->GetFieldID(rootObjectClass, UNREACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) { + jni->GetFieldID(rootObjectClass, UNREACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -199,7 +199,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find instance field in chain object class: %s\n", TAIL_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (tailField = - jni->GetFieldID(chainObjectClass, TAIL_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) { + jni->GetFieldID(chainObjectClass, TAIL_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -207,7 +207,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Get root object from static field: %s\n", OBJECT_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (rootObject = - jni->GetStaticObjectField(debugeeClass, objectField)) != NULL)) { + jni->GetStaticObjectField(debugeeClass, objectField)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -302,7 +302,7 @@ static int checkTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, /** Release references to the tested objects and free allocated memory. */ static int releaseTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, ObjectDesc* objectDescList) { - if (objectDescList != NULL) { + if (objectDescList != nullptr) { NSK_DISPLAY1("Deallocate objects list: 0x%p\n", (void*)objectDescList); if (!NSK_JVMTI_VERIFY( jvmti->Deallocate((unsigned char*)objectDescList))) { @@ -322,9 +322,9 @@ heapObjectCallback(jlong class_tag, jlong size, jlong* tag_ptr, void* user_data) if (info & INFO_HEAPOBJ) { NSK_DISPLAY3(" heapObjectCallback: class_tag=%-3ld size=%-3ld *tag_ptr=%-5ld\n", (long)class_tag, (long)size, - (long)(tag_ptr == NULL ? (jlong)0 : *tag_ptr)); + (long)(tag_ptr == nullptr ? (jlong)0 : *tag_ptr)); } else if ((info & INFO_TAGGED) != 0 && - tag_ptr != NULL && *tag_ptr != 0) { + tag_ptr != nullptr && *tag_ptr != 0) { NSK_DISPLAY3(" heapObjectCallback: class_tag=%-3ld size=%-3ld *tag_ptr=%-5ld\n", (long)class_tag, (long)size, (long)*tag_ptr); @@ -341,8 +341,8 @@ heapObjectCallback(jlong class_tag, jlong size, jlong* tag_ptr, void* user_data) nsk_jvmti_setFailStatus(); } - if (tag_ptr == NULL) { - NSK_COMPLAIN3("NULL tag_ptr is passed to heapObjectCallback:\n" + if (tag_ptr == nullptr) { + NSK_COMPLAIN3("null tag_ptr is passed to heapObjectCallback:\n" "# tag_ptr: 0x%p\n" "# class_tag: %ld\n" "# size: %ld\n", @@ -411,7 +411,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0(">>> Enable OBJECT_FREE event and let debugee to clean links to unreachable objects\n"); { jvmtiEvent event = JVMTI_EVENT_OBJECT_FREE; - if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, NULL))) + if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, nullptr))) return; if (!NSK_VERIFY(nsk_jvmti_resumeSync())) @@ -432,7 +432,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0(">>> Disable OBJECT_FREE event and check if tagged/untagged objects were iterated:\n"); { jvmtiEvent event = JVMTI_EVENT_OBJECT_FREE; - if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_DISABLE, 1, &event, NULL))) + if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_DISABLE, 1, &event, nullptr))) return; if (!checkTestedObjects(jvmti, jni, chainLength, objectDescList)) { @@ -487,7 +487,7 @@ JNIEXPORT jint JNI_OnLoad_iterheap001(JavaVM *jvm, char *options, void *reserved } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -496,7 +496,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { { const char* infoOpt = nsk_jvmti_findOptionValue("info"); - if (infoOpt != NULL) { + if (infoOpt != nullptr) { if (strcmp(infoOpt, "none") == 0) info = INFO_NONE; else if (strcmp(infoOpt, "all") == 0) @@ -523,7 +523,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; { @@ -547,7 +547,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap002/iterheap002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap002/iterheap002.cpp index 9d4171ef71cc..975e677bd1d2 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap002/iterheap002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap002/iterheap002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -65,7 +65,7 @@ typedef struct ObjectDescStruct { static int chainLength = 0; static int objectsCount = 0; -static ObjectDesc* objectDescList = NULL; +static ObjectDesc* objectDescList = nullptr; static volatile int foundUntagged = 0; @@ -82,7 +82,7 @@ static int getChainObjects(jvmtiEnv* jvmti, JNIEnv* jni, jobject firstObject, jlong tag, int reachable) { int success = NSK_TRUE; - jobject obj = NULL; + jobject obj = nullptr; jlong objTag = (!reachable ? -tag : (tag % 2 != 0) ? tag : (jlong)0); if (count <= 0) @@ -92,7 +92,7 @@ static int getChainObjects(jvmtiEnv* jvmti, JNIEnv* jni, jobject firstObject, tag++; if (!NSK_JNI_VERIFY(jni, (obj = - jni->GetObjectField(firstObject, firstField)) != NULL)) { + jni->GetObjectField(firstObject, firstField)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -118,16 +118,16 @@ static int getChainObjects(jvmtiEnv* jvmti, JNIEnv* jni, jobject firstObject, /** Obtain all tested objects from debugee class and tag them recursively. */ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, int *objectsCount, ObjectDesc* *objectDescList) { - jclass debugeeClass = NULL; - jclass rootObjectClass = NULL; - jclass chainObjectClass = NULL; + jclass debugeeClass = nullptr; + jclass rootObjectClass = nullptr; + jclass chainObjectClass = nullptr; - jfieldID objectField = NULL; - jfieldID reachableChainField = NULL; - jfieldID unreachableChainField = NULL; - jfieldID tailField = NULL; + jfieldID objectField = nullptr; + jfieldID reachableChainField = nullptr; + jfieldID unreachableChainField = nullptr; + jfieldID tailField = nullptr; - jobject rootObject = NULL; + jobject rootObject = nullptr; jlong chainObjectTag = 100; @@ -151,7 +151,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME); if (!NSK_JNI_VERIFY(jni, (debugeeClass = - jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) { + jni->FindClass(DEBUGEE_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -159,7 +159,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find root object class: %s\n", ROOT_OBJECT_CLASS_NAME); if (!NSK_JNI_VERIFY(jni, (rootObjectClass = - jni->FindClass(ROOT_OBJECT_CLASS_NAME)) != NULL)) { + jni->FindClass(ROOT_OBJECT_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -167,7 +167,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find chain object class: %s\n", CHAIN_OBJECT_CLASS_NAME); if (!NSK_JNI_VERIFY(jni, (chainObjectClass = - jni->FindClass(CHAIN_OBJECT_CLASS_NAME)) != NULL)) { + jni->FindClass(CHAIN_OBJECT_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -175,7 +175,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find static field in debugee class: %s\n", OBJECT_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (objectField = - jni->GetStaticFieldID(debugeeClass, OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != NULL)) { + jni->GetStaticFieldID(debugeeClass, OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -183,7 +183,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find instance field in root object class: %s\n", REACHABLE_CHAIN_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (reachableChainField = - jni->GetFieldID(rootObjectClass, REACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) { + jni->GetFieldID(rootObjectClass, REACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -191,7 +191,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find instance field in root object class: %s\n", UNREACHABLE_CHAIN_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (unreachableChainField = - jni->GetFieldID(rootObjectClass, UNREACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) { + jni->GetFieldID(rootObjectClass, UNREACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -199,7 +199,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find instance field in chain object class: %s\n", TAIL_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (tailField = - jni->GetFieldID(chainObjectClass, TAIL_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) { + jni->GetFieldID(chainObjectClass, TAIL_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -207,7 +207,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Get root object from static field: %s\n", OBJECT_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (rootObject = - jni->GetStaticObjectField(debugeeClass, objectField)) != NULL)) { + jni->GetStaticObjectField(debugeeClass, objectField)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -302,7 +302,7 @@ static int checkTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, /** Release references to the tested objects and free allocated memory. */ static int releaseTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, ObjectDesc* objectDescList) { - if (objectDescList != NULL) { + if (objectDescList != nullptr) { NSK_DISPLAY1("Deallocate objects list: 0x%p\n", (void*)objectDescList); if (!NSK_JVMTI_VERIFY( jvmti->Deallocate((unsigned char*)objectDescList))) { @@ -322,9 +322,9 @@ heapObjectCallback(jlong class_tag, jlong size, jlong* tag_ptr, void* user_data) if (info & INFO_HEAPOBJ) { NSK_DISPLAY3(" heapObjectCallback: class_tag=%-3ld size=%-3ld *tag_ptr=%-5ld\n", (long)class_tag, (long)size, - (long)(tag_ptr == NULL ? (jlong)0 : *tag_ptr)); + (long)(tag_ptr == nullptr ? (jlong)0 : *tag_ptr)); } else if ((info & INFO_TAGGED) != 0 && - tag_ptr != NULL && *tag_ptr != 0) { + tag_ptr != nullptr && *tag_ptr != 0) { NSK_DISPLAY3(" heapObjectCallback: class_tag=%-3ld size=%-3ld *tag_ptr=%-5ld\n", (long)class_tag, (long)size, (long)*tag_ptr); @@ -341,8 +341,8 @@ heapObjectCallback(jlong class_tag, jlong size, jlong* tag_ptr, void* user_data) nsk_jvmti_setFailStatus(); } - if (tag_ptr == NULL) { - NSK_COMPLAIN3("NULL tag_ptr is passed to heapObjectCallback:\n" + if (tag_ptr == nullptr) { + NSK_COMPLAIN3("null tag_ptr is passed to heapObjectCallback:\n" "# tag_ptr: 0x%p\n" "# class_tag: %ld\n" "# size: %ld\n", @@ -419,7 +419,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0(">>> Enable OBJECT_FREE event and let debugee to clean links to unreachable objects\n"); { jvmtiEvent event = JVMTI_EVENT_OBJECT_FREE; - if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, NULL))) + if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, nullptr))) return; if (!NSK_VERIFY(nsk_jvmti_resumeSync())) @@ -440,7 +440,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0(">>> Disable OBJECT_FREE event and check if tagged objects were iterated:\n"); { jvmtiEvent event = JVMTI_EVENT_OBJECT_FREE; - if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_DISABLE, 1, &event, NULL))) + if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_DISABLE, 1, &event, nullptr))) return; if (!checkTestedObjects(jvmti, jni, chainLength, objectDescList)) { @@ -495,7 +495,7 @@ JNIEXPORT jint JNI_OnLoad_iterheap002(JavaVM *jvm, char *options, void *reserved } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -504,7 +504,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { { const char* infoOpt = nsk_jvmti_findOptionValue("info"); - if (infoOpt != NULL) { + if (infoOpt != nullptr) { if (strcmp(infoOpt, "none") == 0) info = INFO_NONE; else if (strcmp(infoOpt, "all") == 0) @@ -531,7 +531,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; { @@ -555,7 +555,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap003/iterheap003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap003/iterheap003.cpp index a485c4bb6eea..6e92cfc8a22d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap003/iterheap003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap003/iterheap003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -65,7 +65,7 @@ typedef struct ObjectDescStruct { static int chainLength = 0; static int objectsCount = 0; -static ObjectDesc* objectDescList = NULL; +static ObjectDesc* objectDescList = nullptr; static volatile int foundUntagged = 0; @@ -82,7 +82,7 @@ static int getChainObjects(jvmtiEnv* jvmti, JNIEnv* jni, jobject firstObject, jlong tag, int reachable) { int success = NSK_TRUE; - jobject obj = NULL; + jobject obj = nullptr; jlong objTag = (!reachable ? -tag : (tag % 2 != 0) ? tag : (jlong)0); if (count <= 0) @@ -92,7 +92,7 @@ static int getChainObjects(jvmtiEnv* jvmti, JNIEnv* jni, jobject firstObject, tag++; if (!NSK_JNI_VERIFY(jni, (obj = - jni->GetObjectField(firstObject, firstField)) != NULL)) { + jni->GetObjectField(firstObject, firstField)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -118,16 +118,16 @@ static int getChainObjects(jvmtiEnv* jvmti, JNIEnv* jni, jobject firstObject, /** Obtain all tested objects from debugee class and tag them recursively. */ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, int *objectsCount, ObjectDesc* *objectDescList) { - jclass debugeeClass = NULL; - jclass rootObjectClass = NULL; - jclass chainObjectClass = NULL; + jclass debugeeClass = nullptr; + jclass rootObjectClass = nullptr; + jclass chainObjectClass = nullptr; - jfieldID objectField = NULL; - jfieldID reachableChainField = NULL; - jfieldID unreachableChainField = NULL; - jfieldID tailField = NULL; + jfieldID objectField = nullptr; + jfieldID reachableChainField = nullptr; + jfieldID unreachableChainField = nullptr; + jfieldID tailField = nullptr; - jobject rootObject = NULL; + jobject rootObject = nullptr; jlong chainObjectTag = 100; @@ -151,7 +151,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME); if (!NSK_JNI_VERIFY(jni, (debugeeClass = - jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) { + jni->FindClass(DEBUGEE_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -159,7 +159,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find root object class: %s\n", ROOT_OBJECT_CLASS_NAME); if (!NSK_JNI_VERIFY(jni, (rootObjectClass = - jni->FindClass(ROOT_OBJECT_CLASS_NAME)) != NULL)) { + jni->FindClass(ROOT_OBJECT_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -167,7 +167,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find chain object class: %s\n", CHAIN_OBJECT_CLASS_NAME); if (!NSK_JNI_VERIFY(jni, (chainObjectClass = - jni->FindClass(CHAIN_OBJECT_CLASS_NAME)) != NULL)) { + jni->FindClass(CHAIN_OBJECT_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -175,7 +175,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find static field in debugee class: %s\n", OBJECT_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (objectField = - jni->GetStaticFieldID(debugeeClass, OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != NULL)) { + jni->GetStaticFieldID(debugeeClass, OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -183,7 +183,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find instance field in root object class: %s\n", REACHABLE_CHAIN_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (reachableChainField = - jni->GetFieldID(rootObjectClass, REACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) { + jni->GetFieldID(rootObjectClass, REACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -191,7 +191,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find instance field in root object class: %s\n", UNREACHABLE_CHAIN_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (unreachableChainField = - jni->GetFieldID(rootObjectClass, UNREACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) { + jni->GetFieldID(rootObjectClass, UNREACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -199,7 +199,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find instance field in chain object class: %s\n", TAIL_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (tailField = - jni->GetFieldID(chainObjectClass, TAIL_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) { + jni->GetFieldID(chainObjectClass, TAIL_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -207,7 +207,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Get root object from static field: %s\n", OBJECT_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (rootObject = - jni->GetStaticObjectField(debugeeClass, objectField)) != NULL)) { + jni->GetStaticObjectField(debugeeClass, objectField)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -302,7 +302,7 @@ static int checkTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, /** Release references to the tested objects and free allocated memory. */ static int releaseTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, ObjectDesc* objectDescList) { - if (objectDescList != NULL) { + if (objectDescList != nullptr) { NSK_DISPLAY1("Deallocate objects list: 0x%p\n", (void*)objectDescList); if (!NSK_JVMTI_VERIFY( jvmti->Deallocate((unsigned char*)objectDescList))) { @@ -322,9 +322,9 @@ heapObjectCallback(jlong class_tag, jlong size, jlong* tag_ptr, void* user_data) if (info & INFO_HEAPOBJ) { NSK_DISPLAY3(" heapObjectCallback: class_tag=%-3ld size=%-3ld *tag_ptr=%-5ld\n", (long)class_tag, (long)size, - (long)(tag_ptr == NULL ? (jlong)0 : *tag_ptr)); + (long)(tag_ptr == nullptr ? (jlong)0 : *tag_ptr)); } else if ((info & INFO_TAGGED) != 0 && - tag_ptr != NULL && *tag_ptr != 0) { + tag_ptr != nullptr && *tag_ptr != 0) { NSK_DISPLAY3(" heapObjectCallback: class_tag=%-3ld size=%-3ld *tag_ptr=%-5ld\n", (long)class_tag, (long)size, (long)*tag_ptr); @@ -341,8 +341,8 @@ heapObjectCallback(jlong class_tag, jlong size, jlong* tag_ptr, void* user_data) nsk_jvmti_setFailStatus(); } - if (tag_ptr == NULL) { - NSK_COMPLAIN3("NULL tag_ptr is passed to heapObjectCallback:\n" + if (tag_ptr == nullptr) { + NSK_COMPLAIN3("null tag_ptr is passed to heapObjectCallback:\n" "# tag_ptr: 0x%p\n" "# class_tag: %ld\n" "# size: %ld\n", @@ -420,7 +420,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0(">>> Enable OBJECT_FREE event and let debugee to clean links to unreachable objects\n"); { jvmtiEvent event = JVMTI_EVENT_OBJECT_FREE; - if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, NULL))) + if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, nullptr))) return; if (!NSK_VERIFY(nsk_jvmti_resumeSync())) @@ -441,7 +441,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0(">>> Disable OBJECT_FREE event and check if untagged objects were iterated:\n"); { jvmtiEvent event = JVMTI_EVENT_OBJECT_FREE; - if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_DISABLE, 1, &event, NULL))) + if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_DISABLE, 1, &event, nullptr))) return; if (!checkTestedObjects(jvmti, jni, chainLength, objectDescList)) { @@ -496,7 +496,7 @@ JNIEXPORT jint JNI_OnLoad_iterheap003(JavaVM *jvm, char *options, void *reserved } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -505,7 +505,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { { const char* infoOpt = nsk_jvmti_findOptionValue("info"); - if (infoOpt != NULL) { + if (infoOpt != nullptr) { if (strcmp(infoOpt, "none") == 0) info = INFO_NONE; else if (strcmp(infoOpt, "all") == 0) @@ -532,7 +532,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; { @@ -556,7 +556,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap004/iterheap004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap004/iterheap004.cpp index 54eb590a9629..d3858cece513 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap004/iterheap004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap004/iterheap004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,14 +23,14 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { -static JNIEnv *jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv *jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jlong timeout = 0; @@ -126,7 +126,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { { do { - objectDescList = NULL; + objectDescList = nullptr; NSK_DISPLAY0("Calling IterateOverHeap with filter JVMTI_HEAP_OBJECT_UNTAGGED\n"); { @@ -170,7 +170,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } /* Verify objectDescCount and objectDescList length in agreement */ - if (!NSK_VERIFY(objectDesc == NULL)) { + if (!NSK_VERIFY(objectDesc == nullptr)) { nsk_jvmti_setFailStatus(); break; } @@ -242,7 +242,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; memset(&caps, 0, sizeof(caps)); @@ -258,7 +258,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!caps.can_tag_objects) NSK_DISPLAY0("Warning: tagging objects is not available\n"); - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap005/iterheap005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap005/iterheap005.cpp index d2ccacfe2d27..d0fda690c144 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap005/iterheap005.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap005/iterheap005.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,9 +23,9 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { static jlong timeout = 0; static int fakeUserData = 0, objCounter = 0; -static jvmtiEnv* st_jvmti = NULL; +static jvmtiEnv* st_jvmti = nullptr; /* ============================================================================= */ @@ -44,7 +44,7 @@ heapObjectCallback(jlong class_tag, void* user_data) { const char* name = "monitorName"; - jrawMonitorID monitor_ptr = NULL; + jrawMonitorID monitor_ptr = nullptr; /* Check RawMonitor functions for first 10 objects */ if (objCounter >= 10) return JVMTI_ITERATION_ABORT; @@ -150,7 +150,7 @@ JNIEXPORT jint JNI_OnLoad_iterheap005(JavaVM *jvm, char *options, void *reserved } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -158,7 +158,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* save pointer to environment to use it in callbacks */ @@ -175,7 +175,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap006/iterheap006.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap006/iterheap006.cpp index 9e387542ca3a..5655bca5ffcf 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap006/iterheap006.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap006/iterheap006.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,18 +23,18 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { /* ============================================================================= */ static jlong timeout = 0; -static jvmtiEnv* st_jvmti = NULL; +static jvmtiEnv* st_jvmti = nullptr; static const char *storage_data = "local_storage_data"; -static void *storage_ptr = NULL; +static void *storage_ptr = nullptr; /* ============================================================================= */ @@ -111,7 +111,7 @@ JNIEXPORT jint JNI_OnLoad_iterheap006(JavaVM *jvm, char *options, void *reserved } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -119,7 +119,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* save pointer to environment to use it in callbacks */ @@ -136,7 +136,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap007/iterheap007.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap007/iterheap007.cpp index 467fd6bc7961..3639386f737c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap007/iterheap007.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverHeap/iterheap007/iterheap007.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,16 +23,16 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { /* ============================================================================= */ static jlong timeout = 0; -static jvmtiEnv* st_jvmti = NULL; +static jvmtiEnv* st_jvmti = nullptr; static jlong nanos = 0; static jvmtiTimerInfo timer_info1, timer_info2; static int *user_data = 0; @@ -135,7 +135,7 @@ JNIEXPORT jint JNI_OnLoad_iterheap007(JavaVM *jvm, char *options, void *reserved } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -143,7 +143,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* save pointer to environment to use it in callbacks */ @@ -160,7 +160,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls001/iterinstcls001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls001/iterinstcls001.cpp index c9a0acc33eea..9f0600104ced 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls001/iterinstcls001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls001/iterinstcls001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -65,7 +65,7 @@ typedef struct ObjectDescStruct { static int chainLength = 0; static int objectsCount = 0; -static ObjectDesc* objectDescList = NULL; +static ObjectDesc* objectDescList = nullptr; static volatile int foundUntagged = 0; @@ -82,7 +82,7 @@ static int getChainObjects(jvmtiEnv* jvmti, JNIEnv* jni, jobject firstObject, jlong tag, int reachable) { int success = NSK_TRUE; - jobject obj = NULL; + jobject obj = nullptr; jlong objTag = (!reachable ? -tag : (tag % 2 != 0) ? tag : (jlong)0); if (count <= 0) @@ -92,7 +92,7 @@ static int getChainObjects(jvmtiEnv* jvmti, JNIEnv* jni, jobject firstObject, tag++; if (!NSK_JNI_VERIFY(jni, (obj = - jni->GetObjectField(firstObject, firstField)) != NULL)) { + jni->GetObjectField(firstObject, firstField)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -119,16 +119,16 @@ static int getChainObjects(jvmtiEnv* jvmti, JNIEnv* jni, jobject firstObject, static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, int *objectsCount, ObjectDesc* *objectDescList, jclass *testedClass) { - jclass debugeeClass = NULL; - jclass rootObjectClass = NULL; - jclass chainObjectClass = NULL; + jclass debugeeClass = nullptr; + jclass rootObjectClass = nullptr; + jclass chainObjectClass = nullptr; - jfieldID objectField = NULL; - jfieldID reachableChainField = NULL; - jfieldID unreachableChainField = NULL; - jfieldID tailField = NULL; + jfieldID objectField = nullptr; + jfieldID reachableChainField = nullptr; + jfieldID unreachableChainField = nullptr; + jfieldID tailField = nullptr; - jobject rootObject = NULL; + jobject rootObject = nullptr; jlong testedClassTag = 1; jlong chainObjectTag = 100; @@ -153,7 +153,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME); if (!NSK_JNI_VERIFY(jni, (debugeeClass = - jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) { + jni->FindClass(DEBUGEE_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -161,7 +161,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find root object class: %s\n", ROOT_OBJECT_CLASS_NAME); if (!NSK_JNI_VERIFY(jni, (rootObjectClass = - jni->FindClass(ROOT_OBJECT_CLASS_NAME)) != NULL)) { + jni->FindClass(ROOT_OBJECT_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -169,7 +169,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find chain object class: %s\n", CHAIN_OBJECT_CLASS_NAME); if (!NSK_JNI_VERIFY(jni, (chainObjectClass = - jni->FindClass(CHAIN_OBJECT_CLASS_NAME)) != NULL)) { + jni->FindClass(CHAIN_OBJECT_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -177,7 +177,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Create global ref to tested class: 0x%p\n", chainObjectClass); if (!NSK_JNI_VERIFY(jni, (*testedClass = (jclass) - jni->NewGlobalRef(chainObjectClass)) != NULL)) { + jni->NewGlobalRef(chainObjectClass)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -185,7 +185,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find static field in debugee class: %s\n", OBJECT_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (objectField = - jni->GetStaticFieldID(debugeeClass, OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != NULL)) { + jni->GetStaticFieldID(debugeeClass, OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -193,7 +193,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find instance field in root object class: %s\n", REACHABLE_CHAIN_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (reachableChainField = - jni->GetFieldID(rootObjectClass, REACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) { + jni->GetFieldID(rootObjectClass, REACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -201,7 +201,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find instance field in root object class: %s\n", UNREACHABLE_CHAIN_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (unreachableChainField = - jni->GetFieldID(rootObjectClass, UNREACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) { + jni->GetFieldID(rootObjectClass, UNREACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -209,7 +209,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find instance field in chain object class: %s\n", TAIL_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (tailField = - jni->GetFieldID(chainObjectClass, TAIL_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) { + jni->GetFieldID(chainObjectClass, TAIL_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -217,7 +217,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Get root object from static field: %s\n", OBJECT_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (rootObject = - jni->GetStaticObjectField(debugeeClass, objectField)) != NULL)) { + jni->GetStaticObjectField(debugeeClass, objectField)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -320,12 +320,12 @@ static int checkTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, /** Release references to the tested objects and free allocated memory. */ static int releaseTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, ObjectDesc* objectDescList, jclass testedClass) { - if (testedClass != NULL) { + if (testedClass != nullptr) { NSK_DISPLAY1("Release object reference to tested class: 0x%p\n", testedClass); NSK_TRACE(jni->DeleteGlobalRef(testedClass)); } - if (objectDescList != NULL) { + if (objectDescList != nullptr) { NSK_DISPLAY1("Deallocate objects list: 0x%p\n", (void*)objectDescList); if (!NSK_JVMTI_VERIFY( jvmti->Deallocate((unsigned char*)objectDescList))) { @@ -345,7 +345,7 @@ heapObjectCallback(jlong class_tag, jlong size, jlong* tag_ptr, void* user_data) if (info & INFO_HEAPOBJ) { NSK_DISPLAY3(" heapObjectCallback: class_tag=%-3ld size=%-3ld *tag_ptr=%-5ld\n", (long)class_tag, (long)size, - (long)(tag_ptr == NULL ? (jlong)0 : *tag_ptr)); + (long)(tag_ptr == nullptr ? (jlong)0 : *tag_ptr)); } if (class_tag != 1) { @@ -359,8 +359,8 @@ heapObjectCallback(jlong class_tag, jlong size, jlong* tag_ptr, void* user_data) nsk_jvmti_setFailStatus(); } - if (tag_ptr == NULL) { - NSK_COMPLAIN3("NULL tag_ptr is passed to heapObjectCallback:\n" + if (tag_ptr == nullptr) { + NSK_COMPLAIN3("null tag_ptr is passed to heapObjectCallback:\n" "# tag_ptr: 0x%p\n" "# class_tag: %ld\n" "# size: %ld\n", @@ -419,7 +419,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { return; { - jclass testedClass = NULL; + jclass testedClass = nullptr; NSK_DISPLAY0(">>> Obtain and tag tested objects from debugee class\n"); { @@ -431,7 +431,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0(">>> Enable OBJECT_FREE event and let debugee to clean links to unreachable objects\n"); { jvmtiEvent event = JVMTI_EVENT_OBJECT_FREE; - if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, NULL))) + if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, nullptr))) return; if (!NSK_VERIFY(nsk_jvmti_resumeSync())) @@ -452,7 +452,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0(">>> Disable OBJECT_FREE event and check if tagged/untagged objects were iterated:\n"); { jvmtiEvent event = JVMTI_EVENT_OBJECT_FREE; - if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_DISABLE, 1, &event, NULL))) + if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_DISABLE, 1, &event, nullptr))) return; if (!checkTestedObjects(jvmti, jni, chainLength, objectDescList)) { @@ -508,7 +508,7 @@ JNIEXPORT jint JNI_OnLoad_iterinstcls001(JavaVM *jvm, char *options, void *reser } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -517,7 +517,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { { const char* infoOpt = nsk_jvmti_findOptionValue("info"); - if (infoOpt != NULL) { + if (infoOpt != nullptr) { if (strcmp(infoOpt, "none") == 0) info = INFO_NONE; else if (strcmp(infoOpt, "all") == 0) @@ -542,7 +542,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; { @@ -566,7 +566,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls002/iterinstcls002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls002/iterinstcls002.cpp index 13288e2fd5eb..1ab2a4c3ba71 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls002/iterinstcls002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls002/iterinstcls002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -65,7 +65,7 @@ typedef struct ObjectDescStruct { static int chainLength = 0; static int objectsCount = 0; -static ObjectDesc* objectDescList = NULL; +static ObjectDesc* objectDescList = nullptr; static volatile int foundUntagged = 0; @@ -82,7 +82,7 @@ static int getChainObjects(jvmtiEnv* jvmti, JNIEnv* jni, jobject firstObject, jlong tag, int reachable) { int success = NSK_TRUE; - jobject obj = NULL; + jobject obj = nullptr; jlong objTag = (!reachable ? -tag : (tag % 2 != 0) ? tag : (jlong)0); if (count <= 0) @@ -92,7 +92,7 @@ static int getChainObjects(jvmtiEnv* jvmti, JNIEnv* jni, jobject firstObject, tag++; if (!NSK_JNI_VERIFY(jni, (obj = - jni->GetObjectField(firstObject, firstField)) != NULL)) { + jni->GetObjectField(firstObject, firstField)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -119,16 +119,16 @@ static int getChainObjects(jvmtiEnv* jvmti, JNIEnv* jni, jobject firstObject, static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, int *objectsCount, ObjectDesc* *objectDescList, jclass *testedClass) { - jclass debugeeClass = NULL; - jclass rootObjectClass = NULL; - jclass chainObjectClass = NULL; + jclass debugeeClass = nullptr; + jclass rootObjectClass = nullptr; + jclass chainObjectClass = nullptr; - jfieldID objectField = NULL; - jfieldID reachableChainField = NULL; - jfieldID unreachableChainField = NULL; - jfieldID tailField = NULL; + jfieldID objectField = nullptr; + jfieldID reachableChainField = nullptr; + jfieldID unreachableChainField = nullptr; + jfieldID tailField = nullptr; - jobject rootObject = NULL; + jobject rootObject = nullptr; jlong testedClassTag = 1; jlong chainObjectTag = 100; @@ -153,7 +153,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME); if (!NSK_JNI_VERIFY(jni, (debugeeClass = - jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) { + jni->FindClass(DEBUGEE_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -161,7 +161,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find root object class: %s\n", ROOT_OBJECT_CLASS_NAME); if (!NSK_JNI_VERIFY(jni, (rootObjectClass = - jni->FindClass(ROOT_OBJECT_CLASS_NAME)) != NULL)) { + jni->FindClass(ROOT_OBJECT_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -169,7 +169,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find chain object class: %s\n", CHAIN_OBJECT_CLASS_NAME); if (!NSK_JNI_VERIFY(jni, (chainObjectClass = - jni->FindClass(CHAIN_OBJECT_CLASS_NAME)) != NULL)) { + jni->FindClass(CHAIN_OBJECT_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -177,7 +177,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Create global ref to tested class: 0x%p\n", chainObjectClass); if (!NSK_JNI_VERIFY(jni, (*testedClass = (jclass) - jni->NewGlobalRef(chainObjectClass)) != NULL)) { + jni->NewGlobalRef(chainObjectClass)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -185,7 +185,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find static field in debugee class: %s\n", OBJECT_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (objectField = - jni->GetStaticFieldID(debugeeClass, OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != NULL)) { + jni->GetStaticFieldID(debugeeClass, OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -193,7 +193,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find instance field in root object class: %s\n", REACHABLE_CHAIN_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (reachableChainField = - jni->GetFieldID(rootObjectClass, REACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) { + jni->GetFieldID(rootObjectClass, REACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -201,7 +201,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find instance field in root object class: %s\n", UNREACHABLE_CHAIN_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (unreachableChainField = - jni->GetFieldID(rootObjectClass, UNREACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) { + jni->GetFieldID(rootObjectClass, UNREACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -209,7 +209,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find instance field in chain object class: %s\n", TAIL_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (tailField = - jni->GetFieldID(chainObjectClass, TAIL_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) { + jni->GetFieldID(chainObjectClass, TAIL_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -217,7 +217,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Get root object from static field: %s\n", OBJECT_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (rootObject = - jni->GetStaticObjectField(debugeeClass, objectField)) != NULL)) { + jni->GetStaticObjectField(debugeeClass, objectField)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -320,12 +320,12 @@ static int checkTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, /** Release references to the tested objects and free allocated memory. */ static int releaseTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, ObjectDesc* objectDescList, jclass testedClass) { - if (testedClass != NULL) { + if (testedClass != nullptr) { NSK_DISPLAY1("Release object reference to tested class: 0x%p\n", testedClass); NSK_TRACE(jni->DeleteGlobalRef(testedClass)); } - if (objectDescList != NULL) { + if (objectDescList != nullptr) { NSK_DISPLAY1("Deallocate objects list: 0x%p\n", (void*)objectDescList); if (!NSK_JVMTI_VERIFY( jvmti->Deallocate((unsigned char*)objectDescList))) { @@ -345,7 +345,7 @@ heapObjectCallback(jlong class_tag, jlong size, jlong* tag_ptr, void* user_data) if (info & INFO_HEAPOBJ) { NSK_DISPLAY3(" heapObjectCallback: class_tag=%-3ld size=%-3ld *tag_ptr=%-5ld\n", (long)class_tag, (long)size, - (long)(tag_ptr == NULL ? (jlong)0 : *tag_ptr)); + (long)(tag_ptr == nullptr ? (jlong)0 : *tag_ptr)); } if (class_tag != 1) { @@ -359,8 +359,8 @@ heapObjectCallback(jlong class_tag, jlong size, jlong* tag_ptr, void* user_data) nsk_jvmti_setFailStatus(); } - if (tag_ptr == NULL) { - NSK_COMPLAIN3("NULL tag_ptr is passed to heapObjectCallback:\n" + if (tag_ptr == nullptr) { + NSK_COMPLAIN3("null tag_ptr is passed to heapObjectCallback:\n" "# tag_ptr: 0x%p\n" "# class_tag: %ld\n" "# size: %ld\n", @@ -427,7 +427,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { return; { - jclass testedClass = NULL; + jclass testedClass = nullptr; NSK_DISPLAY0(">>> Obtain and tag tested objects from debugee class\n"); { @@ -439,7 +439,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0(">>> Enable OBJECT_FREE event and let debugee to clean links to unreachable objects\n"); { jvmtiEvent event = JVMTI_EVENT_OBJECT_FREE; - if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, NULL))) + if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, nullptr))) return; if (!NSK_VERIFY(nsk_jvmti_resumeSync())) @@ -460,7 +460,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0(">>> Disable OBJECT_FREE event and check if tagged objects were iterated:\n"); { jvmtiEvent event = JVMTI_EVENT_OBJECT_FREE; - if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_DISABLE, 1, &event, NULL))) + if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_DISABLE, 1, &event, nullptr))) return; if (!checkTestedObjects(jvmti, jni, chainLength, objectDescList)) { @@ -516,7 +516,7 @@ JNIEXPORT jint JNI_OnLoad_iterinstcls002(JavaVM *jvm, char *options, void *reser } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -525,7 +525,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { { const char* infoOpt = nsk_jvmti_findOptionValue("info"); - if (infoOpt != NULL) { + if (infoOpt != nullptr) { if (strcmp(infoOpt, "none") == 0) info = INFO_NONE; else if (strcmp(infoOpt, "all") == 0) @@ -550,7 +550,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; { @@ -574,7 +574,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls003/iterinstcls003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls003/iterinstcls003.cpp index e552dc0b3b92..5c77f2f52dba 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls003/iterinstcls003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls003/iterinstcls003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -65,7 +65,7 @@ typedef struct ObjectDescStruct { static int chainLength = 0; static int objectsCount = 0; -static ObjectDesc* objectDescList = NULL; +static ObjectDesc* objectDescList = nullptr; static volatile int foundUntagged = 0; @@ -82,7 +82,7 @@ static int getChainObjects(jvmtiEnv* jvmti, JNIEnv* jni, jobject firstObject, jlong tag, int reachable) { int success = NSK_TRUE; - jobject obj = NULL; + jobject obj = nullptr; jlong objTag = (!reachable ? -tag : (tag % 2 != 0) ? tag : (jlong)0); if (count <= 0) @@ -92,7 +92,7 @@ static int getChainObjects(jvmtiEnv* jvmti, JNIEnv* jni, jobject firstObject, tag++; if (!NSK_JNI_VERIFY(jni, (obj = - jni->GetObjectField(firstObject, firstField)) != NULL)) { + jni->GetObjectField(firstObject, firstField)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -119,16 +119,16 @@ static int getChainObjects(jvmtiEnv* jvmti, JNIEnv* jni, jobject firstObject, static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, int *objectsCount, ObjectDesc* *objectDescList, jclass *testedClass) { - jclass debugeeClass = NULL; - jclass rootObjectClass = NULL; - jclass chainObjectClass = NULL; + jclass debugeeClass = nullptr; + jclass rootObjectClass = nullptr; + jclass chainObjectClass = nullptr; - jfieldID objectField = NULL; - jfieldID reachableChainField = NULL; - jfieldID unreachableChainField = NULL; - jfieldID tailField = NULL; + jfieldID objectField = nullptr; + jfieldID reachableChainField = nullptr; + jfieldID unreachableChainField = nullptr; + jfieldID tailField = nullptr; - jobject rootObject = NULL; + jobject rootObject = nullptr; jlong testedClassTag = 1; jlong chainObjectTag = 100; @@ -153,7 +153,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME); if (!NSK_JNI_VERIFY(jni, (debugeeClass = - jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) { + jni->FindClass(DEBUGEE_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -161,7 +161,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find root object class: %s\n", ROOT_OBJECT_CLASS_NAME); if (!NSK_JNI_VERIFY(jni, (rootObjectClass = - jni->FindClass(ROOT_OBJECT_CLASS_NAME)) != NULL)) { + jni->FindClass(ROOT_OBJECT_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -169,7 +169,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find chain object class: %s\n", CHAIN_OBJECT_CLASS_NAME); if (!NSK_JNI_VERIFY(jni, (chainObjectClass = - jni->FindClass(CHAIN_OBJECT_CLASS_NAME)) != NULL)) { + jni->FindClass(CHAIN_OBJECT_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -177,7 +177,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Create global ref to tested class: 0x%p\n", chainObjectClass); if (!NSK_JNI_VERIFY(jni, (*testedClass = (jclass) - jni->NewGlobalRef(chainObjectClass)) != NULL)) { + jni->NewGlobalRef(chainObjectClass)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -185,7 +185,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find static field in debugee class: %s\n", OBJECT_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (objectField = - jni->GetStaticFieldID(debugeeClass, OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != NULL)) { + jni->GetStaticFieldID(debugeeClass, OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -193,7 +193,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find instance field in root object class: %s\n", REACHABLE_CHAIN_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (reachableChainField = - jni->GetFieldID(rootObjectClass, REACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) { + jni->GetFieldID(rootObjectClass, REACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -201,7 +201,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find instance field in root object class: %s\n", UNREACHABLE_CHAIN_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (unreachableChainField = - jni->GetFieldID(rootObjectClass, UNREACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) { + jni->GetFieldID(rootObjectClass, UNREACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -209,7 +209,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find instance field in chain object class: %s\n", TAIL_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (tailField = - jni->GetFieldID(chainObjectClass, TAIL_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) { + jni->GetFieldID(chainObjectClass, TAIL_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -217,7 +217,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Get root object from static field: %s\n", OBJECT_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (rootObject = - jni->GetStaticObjectField(debugeeClass, objectField)) != NULL)) { + jni->GetStaticObjectField(debugeeClass, objectField)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -320,12 +320,12 @@ static int checkTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, /** Release references to the tested objects and free allocated memory. */ static int releaseTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, ObjectDesc* objectDescList, jclass testedClass) { - if (testedClass != NULL) { + if (testedClass != nullptr) { NSK_DISPLAY1("Release object reference to tested class: 0x%p\n", testedClass); NSK_TRACE(jni->DeleteGlobalRef(testedClass)); } - if (objectDescList != NULL) { + if (objectDescList != nullptr) { NSK_DISPLAY1("Deallocate objects list: 0x%p\n", (void*)objectDescList); if (!NSK_JVMTI_VERIFY( jvmti->Deallocate((unsigned char*)objectDescList))) { @@ -345,7 +345,7 @@ heapObjectCallback(jlong class_tag, jlong size, jlong* tag_ptr, void* user_data) if (info & INFO_HEAPOBJ) { NSK_DISPLAY3(" heapObjectCallback: class_tag=%-3ld size=%-3ld *tag_ptr=%-5ld\n", (long)class_tag, (long)size, - (long)(tag_ptr == NULL ? (jlong)0 : *tag_ptr)); + (long)(tag_ptr == nullptr ? (jlong)0 : *tag_ptr)); } if (class_tag != 1) { @@ -359,8 +359,8 @@ heapObjectCallback(jlong class_tag, jlong size, jlong* tag_ptr, void* user_data) nsk_jvmti_setFailStatus(); } - if (tag_ptr == NULL) { - NSK_COMPLAIN3("NULL tag_ptr is passed to heapObjectCallback:\n" + if (tag_ptr == nullptr) { + NSK_COMPLAIN3("null tag_ptr is passed to heapObjectCallback:\n" "# tag_ptr: 0x%p\n" "# class_tag: %ld\n" "# size: %ld\n", @@ -428,7 +428,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { return; { - jclass testedClass = NULL; + jclass testedClass = nullptr; NSK_DISPLAY0(">>> Obtain and tag tested objects from debugee class\n"); { @@ -440,7 +440,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0(">>> Enable OBJECT_FREE event and let debugee to clean links to unreachable objects\n"); { jvmtiEvent event = JVMTI_EVENT_OBJECT_FREE; - if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, NULL))) + if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, nullptr))) return; if (!NSK_VERIFY(nsk_jvmti_resumeSync())) @@ -461,7 +461,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0(">>> Disable OBJECT_FREE event and check if untagged objects were iterated:\n"); { jvmtiEvent event = JVMTI_EVENT_OBJECT_FREE; - if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_DISABLE, 1, &event, NULL))) + if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_DISABLE, 1, &event, nullptr))) return; if (!checkTestedObjects(jvmti, jni, chainLength, objectDescList)) { @@ -517,7 +517,7 @@ JNIEXPORT jint JNI_OnLoad_iterinstcls003(JavaVM *jvm, char *options, void *reser } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -526,7 +526,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { { const char* infoOpt = nsk_jvmti_findOptionValue("info"); - if (infoOpt != NULL) { + if (infoOpt != nullptr) { if (strcmp(infoOpt, "none") == 0) info = INFO_NONE; else if (strcmp(infoOpt, "all") == 0) @@ -551,7 +551,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; { @@ -575,7 +575,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls004/iterinstcls004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls004/iterinstcls004.cpp index 43e378571f4b..b77258c773a6 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls004/iterinstcls004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls004/iterinstcls004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,9 +23,9 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -42,7 +42,7 @@ typedef struct ObjectDescStruct { } ObjectDesc; static ObjectDesc *objectDescBuf; -static jvmtiEnv* st_jvmti = NULL; +static jvmtiEnv* st_jvmti = nullptr; static const char debugeeClassSignature[] = "Lnsk/jvmti/IterateOverInstancesOfClass/iterinstcls004;"; /* ============================================================================= */ @@ -99,12 +99,12 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { return; { - jclass debugeeClass = NULL; + jclass debugeeClass = nullptr; do { NSK_DISPLAY1("Find debugee class: %s\n", debugeeClassSignature); debugeeClass = nsk_jvmti_classBySignature(debugeeClassSignature); - if (debugeeClass == NULL) { + if (debugeeClass == nullptr) { nsk_jvmti_setFailStatus(); break; } @@ -167,7 +167,7 @@ JNIEXPORT jint JNI_OnLoad_iterinstcls004(JavaVM *jvm, char *options, void *reser } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -175,7 +175,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* save pointer to environment to use it in callbacks */ @@ -192,7 +192,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls005/iterinstcls005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls005/iterinstcls005.cpp index 0907650299a6..23da29f1867d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls005/iterinstcls005.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls005/iterinstcls005.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,9 +23,9 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { static jlong timeout = 0; static int fakeUserData = 0, objCounter = 0; -static jvmtiEnv* st_jvmti = NULL; +static jvmtiEnv* st_jvmti = nullptr; static const char debugeeClassSignature[] = "Lnsk/jvmti/IterateOverInstancesOfClass/iterinstcls005;"; /* ============================================================================= */ @@ -45,7 +45,7 @@ heapObjectCallback(jlong class_tag, void* user_data) { const char* name = "monitorName"; - jrawMonitorID monitor_ptr = NULL; + jrawMonitorID monitor_ptr = nullptr; objCounter++; @@ -106,11 +106,11 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { return; do { - jclass debugeeClass = NULL; + jclass debugeeClass = nullptr; NSK_DISPLAY1("Find debugee class: %s\n", debugeeClassSignature); debugeeClass = nsk_jvmti_classBySignature(debugeeClassSignature); - if (debugeeClass == NULL) { + if (debugeeClass == nullptr) { nsk_jvmti_setFailStatus(); break; } @@ -152,7 +152,7 @@ JNIEXPORT jint JNI_OnLoad_iterinstcls005(JavaVM *jvm, char *options, void *reser } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -160,7 +160,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* save pointer to environment to use it in callbacks */ @@ -176,7 +176,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls006/iterinstcls006.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls006/iterinstcls006.cpp index 56868adb9b73..c025d8cbb802 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls006/iterinstcls006.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls006/iterinstcls006.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,18 +23,18 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { /* ============================================================================= */ static jlong timeout = 0; -static jvmtiEnv* st_jvmti = NULL; +static jvmtiEnv* st_jvmti = nullptr; static const char *storage_data = "local_storage_data"; -static void *storage_ptr = NULL; +static void *storage_ptr = nullptr; static const char debugeeClassSignature[] = "Lnsk/jvmti/IterateOverInstancesOfClass/iterinstcls006;"; /* ============================================================================= */ @@ -68,11 +68,11 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { return; do { - jclass debugeeClass = NULL; + jclass debugeeClass = nullptr; NSK_DISPLAY1("Find debugee class: %s\n", debugeeClassSignature); debugeeClass = nsk_jvmti_classBySignature(debugeeClassSignature); - if (debugeeClass == NULL) { + if (debugeeClass == nullptr) { nsk_jvmti_setFailStatus(); break; } @@ -121,7 +121,7 @@ JNIEXPORT jint JNI_OnLoad_iterinstcls006(JavaVM *jvm, char *options, void *reser } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -129,7 +129,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* save pointer to environment to use it in callbacks */ @@ -145,7 +145,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls007/iterinstcls007.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls007/iterinstcls007.cpp index 5e93a8601670..935b64104cb5 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls007/iterinstcls007.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverInstancesOfClass/iterinstcls007/iterinstcls007.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,16 +23,16 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { /* ============================================================================= */ static jlong timeout = 0; -static jvmtiEnv* st_jvmti = NULL; +static jvmtiEnv* st_jvmti = nullptr; static int *user_data = 0; static const char debugeeClassSignature[] = "Lnsk/jvmti/IterateOverInstancesOfClass/iterinstcls007;"; static jlong nanos = 0; @@ -109,11 +109,11 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { do { NSK_DISPLAY0("Calling IterateOverInstancesOfClass with filter JVMTI_HEAP_OBJECT_EITHER\n"); { - jclass debugeeClass = NULL; + jclass debugeeClass = nullptr; NSK_DISPLAY1("Find debugee class: %s\n", debugeeClassSignature); debugeeClass = nsk_jvmti_classBySignature(debugeeClassSignature); - if (debugeeClass == NULL) { + if (debugeeClass == nullptr) { nsk_jvmti_setFailStatus(); break; } @@ -148,7 +148,7 @@ JNIEXPORT jint JNI_OnLoad_iterinstcls007(JavaVM *jvm, char *options, void *reser } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -156,7 +156,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* save pointer to environment to use it in callbacks */ @@ -173,7 +173,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj001/iterobjreachobj001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj001/iterobjreachobj001.cpp index 487ca0fd703c..7ed00c2580ff 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj001/iterobjreachobj001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj001/iterobjreachobj001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -63,7 +63,7 @@ typedef struct ObjectDescStruct { static int chainLength = 0; static int objectsCount = 0; -static ObjectDesc* objectDescList = NULL; +static ObjectDesc* objectDescList = nullptr; static int fakeUserData = 0; static int userDataError = 0; @@ -76,7 +76,7 @@ static int getChainObjects(jvmtiEnv* jvmti, JNIEnv* jni, jobject firstObject, jfieldID nextField, const char nextFieldName[], int count, ObjectDesc objectDescList[], jlong tag, int reachable) { - jobject obj = NULL; + jobject obj = nullptr; jlong objTag = (reachable ? tag : -tag); if (count <= 0) @@ -85,7 +85,7 @@ static int getChainObjects(jvmtiEnv* jvmti, JNIEnv* jni, jobject firstObject, count--; tag++; - if (!NSK_JNI_VERIFY(jni, (obj = jni->GetObjectField(firstObject, firstField)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (obj = jni->GetObjectField(firstObject, firstField)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -110,14 +110,14 @@ static int getChainObjects(jvmtiEnv* jvmti, JNIEnv* jni, jobject firstObject, static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, int *objectsCount, ObjectDesc* *objectDescList, jobject* rootObject) { - jclass debugeeClass = NULL; - jclass rootObjectClass = NULL; - jclass chainObjectClass = NULL; + jclass debugeeClass = nullptr; + jclass rootObjectClass = nullptr; + jclass chainObjectClass = nullptr; - jfieldID objectField = NULL; - jfieldID reachableChainField = NULL; - jfieldID unreachableChainField = NULL; - jfieldID tailField = NULL; + jfieldID objectField = nullptr; + jfieldID reachableChainField = nullptr; + jfieldID unreachableChainField = nullptr; + jfieldID tailField = nullptr; jlong rootObjectTag = 1; jlong chainObjectTag = 100; @@ -141,14 +141,14 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, } NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME); - if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } NSK_DISPLAY1(" ... found class: 0x%p\n", (void*)debugeeClass); NSK_DISPLAY1("Find root object class: %s\n", ROOT_OBJECT_CLASS_NAME); - if (!NSK_JNI_VERIFY(jni, (rootObjectClass = jni->FindClass(ROOT_OBJECT_CLASS_NAME)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (rootObjectClass = jni->FindClass(ROOT_OBJECT_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -156,7 +156,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find chain object class: %s\n", CHAIN_OBJECT_CLASS_NAME); if (!NSK_JNI_VERIFY(jni, (chainObjectClass = - jni->FindClass(CHAIN_OBJECT_CLASS_NAME)) != NULL)) { + jni->FindClass(CHAIN_OBJECT_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -164,7 +164,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find static field in debugee class: %s\n", OBJECT_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (objectField = jni->GetStaticFieldID( - debugeeClass, OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != NULL)) { + debugeeClass, OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -172,7 +172,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find instance field in root object class: %s\n", REACHABLE_CHAIN_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (reachableChainField = jni->GetFieldID( - rootObjectClass, REACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) { + rootObjectClass, REACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -180,7 +180,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find instance field in root object class: %s\n", UNREACHABLE_CHAIN_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (unreachableChainField = jni->GetFieldID( - rootObjectClass, UNREACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) { + rootObjectClass, UNREACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -188,7 +188,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find instance field in chain object class: %s\n", TAIL_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (tailField = - jni->GetFieldID(chainObjectClass, TAIL_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) { + jni->GetFieldID(chainObjectClass, TAIL_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -196,13 +196,13 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Get root object from static field: %s\n", OBJECT_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (*rootObject = - jni->GetStaticObjectField(debugeeClass, objectField)) != NULL)) { + jni->GetStaticObjectField(debugeeClass, objectField)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } NSK_DISPLAY1(" ... got object: 0x%p\n", (void*)*rootObject); - if (!NSK_JNI_VERIFY(jni, (*rootObject = jni->NewGlobalRef(*rootObject)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (*rootObject = jni->NewGlobalRef(*rootObject)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -290,12 +290,12 @@ static int checkTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, /** Release references to the tested objects and free allocated memory. */ static int releaseTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, ObjectDesc* objectDescList, jobject rootObject) { - if (rootObject != NULL) { + if (rootObject != nullptr) { NSK_DISPLAY1("Release object reference to root tested object: 0x%p\n", rootObject); NSK_TRACE(jni->DeleteGlobalRef(rootObject)); } - if (objectDescList != NULL) { + if (objectDescList != nullptr) { NSK_DISPLAY1("Deallocate objects list: 0x%p\n", (void*)objectDescList); if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)objectDescList))) { nsk_jvmti_setFailStatus(); @@ -318,12 +318,12 @@ objectReferenceCallback(jvmtiObjectReferenceKind reference_kind, NSK_DISPLAY6(" objectReferenceCallback: ref_kind=%1d class_tag=%-3ld size=%-3ld" " *tag_ptr=%-5ld ref_tag=%-5ld ref_idx=%d\n", (int)reference_kind, (long)class_tag, (long)size, - (long)(tag_ptr == NULL ? (jlong)0 : *tag_ptr), + (long)(tag_ptr == nullptr ? (jlong)0 : *tag_ptr), (long)refferrer_tag, (int)refferrer_index); } - if (tag_ptr == NULL) { - NSK_COMPLAIN6("NULL tag_ptr is passed to objectReferenceCallback:\n" + if (tag_ptr == nullptr) { + NSK_COMPLAIN6("null tag_ptr is passed to objectReferenceCallback:\n" "# tag_ptr: 0x%p\n" "# reference_kind: %d\n" "# class_tag: %ld\n" @@ -339,7 +339,7 @@ objectReferenceCallback(jvmtiObjectReferenceKind reference_kind, nsk_jvmti_setFailStatus(); } - if (tag_ptr != NULL && *tag_ptr != 0) { + if (tag_ptr != nullptr && *tag_ptr != 0) { int found = 0; int i; @@ -412,7 +412,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { return; { - jobject rootObject = NULL; + jobject rootObject = nullptr; NSK_DISPLAY0(">>> Obtain and tag tested objects from debugee class\n"); { @@ -474,7 +474,7 @@ JNIEXPORT jint JNI_OnLoad_iterobjreachobj001(JavaVM *jvm, char *options, void *r } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -483,7 +483,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { { const char* infoOpt = nsk_jvmti_findOptionValue("info"); - if (infoOpt != NULL) { + if (infoOpt != nullptr) { if (strcmp(infoOpt, "none") == 0) info = INFO_NONE; else if (strcmp(infoOpt, "all") == 0) @@ -508,7 +508,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; { @@ -521,7 +521,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj002/iterobjreachobj002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj002/iterobjreachobj002.cpp index 2bc628d73d2f..3b7595791474 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj002/iterobjreachobj002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj002/iterobjreachobj002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,9 +23,9 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -36,7 +36,7 @@ static jlong timeout = 0; static long objectCount = 0; static int userData = 0, allocationError = 0; -static jvmtiEnv* st_jvmti = NULL; +static jvmtiEnv* st_jvmti = nullptr; static const char* debugeeClassSignature = "Lnsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj002;"; static const char* objectFieldName = "object"; @@ -108,28 +108,28 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { return; { - jclass debugeeClass = NULL; - jfieldID objectField = NULL; - jobject object = NULL; + jclass debugeeClass = nullptr; + jfieldID objectField = nullptr; + jobject object = nullptr; do { NSK_DISPLAY1("Find debugee class: %s\n", debugeeClassSignature); debugeeClass = nsk_jvmti_classBySignature(debugeeClassSignature); - if (debugeeClass == NULL) { + if (debugeeClass == nullptr) { nsk_jvmti_setFailStatus(); break; } NSK_DISPLAY1("Find static field in debugee class: %s\n", objectFieldName); if (!NSK_JNI_VERIFY(jni, (objectField = jni->GetStaticFieldID( - debugeeClass, objectFieldName, debugeeClassSignature)) != NULL)) { + debugeeClass, objectFieldName, debugeeClassSignature)) != nullptr)) { nsk_jvmti_setFailStatus(); break; } NSK_DISPLAY1("Find value of static field in debugee class: %s\n", objectFieldName); if (!NSK_JNI_VERIFY(jni, (object = - jni->GetStaticObjectField(debugeeClass, objectField)) != NULL)) { + jni->GetStaticObjectField(debugeeClass, objectField)) != nullptr)) { nsk_jvmti_setFailStatus(); break; } @@ -190,7 +190,7 @@ JNIEXPORT jint JNI_OnLoad_iterobjreachobj002(JavaVM *jvm, char *options, void *r } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -198,7 +198,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* save pointer to environment to use it in callbacks */ @@ -214,7 +214,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj003/iterobjreachobj003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj003/iterobjreachobj003.cpp index 0bca38f4adae..ccdd97a431ae 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj003/iterobjreachobj003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj003/iterobjreachobj003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,9 +23,9 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { static jlong timeout = 0; static int fakeUserData = 0, objCounter = 0; -static jvmtiEnv* st_jvmti = NULL; +static jvmtiEnv* st_jvmti = nullptr; static const char* debugeeClassSignature = "Lnsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj003;"; static const char* objectFieldName = "object"; @@ -49,7 +49,7 @@ objectReferenceCallback(jvmtiObjectReferenceKind reference_kind, void* user_data) { const char* name = "monitorName"; - jrawMonitorID monitor_ptr = NULL; + jrawMonitorID monitor_ptr = nullptr; objCounter++; @@ -110,27 +110,27 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { return; do { - jclass debugeeClass = NULL; - jfieldID objectField = NULL; - jobject object = NULL; + jclass debugeeClass = nullptr; + jfieldID objectField = nullptr; + jobject object = nullptr; NSK_DISPLAY1("Find debugee class: %s\n", debugeeClassSignature); debugeeClass = nsk_jvmti_classBySignature(debugeeClassSignature); - if (debugeeClass == NULL) { + if (debugeeClass == nullptr) { nsk_jvmti_setFailStatus(); break; } NSK_DISPLAY1("Find static field in debugee class: %s\n", objectFieldName); if (!NSK_JNI_VERIFY(jni, (objectField = jni->GetStaticFieldID( - debugeeClass, objectFieldName, debugeeClassSignature)) != NULL)) { + debugeeClass, objectFieldName, debugeeClassSignature)) != nullptr)) { nsk_jvmti_setFailStatus(); break; } NSK_DISPLAY1("Find value of static field in debugee class: %s\n", objectFieldName); if (!NSK_JNI_VERIFY(jni, (object = - jni->GetStaticObjectField(debugeeClass, objectField)) != NULL)) { + jni->GetStaticObjectField(debugeeClass, objectField)) != nullptr)) { nsk_jvmti_setFailStatus(); break; } @@ -169,7 +169,7 @@ JNIEXPORT jint JNI_OnLoad_iterobjreachobj003(JavaVM *jvm, char *options, void *r } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -177,7 +177,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* save pointer to environment to use it in callbacks */ @@ -193,7 +193,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj004/iterobjreachobj004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj004/iterobjreachobj004.cpp index d363e18c754a..ff90ec1b0bad 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj004/iterobjreachobj004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj004/iterobjreachobj004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,9 +23,9 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -33,9 +33,9 @@ extern "C" { static jlong timeout = 0; static int fakeUserData = 0, objCounter = 0; -static jvmtiEnv* st_jvmti = NULL; +static jvmtiEnv* st_jvmti = nullptr; static const char *storage_data = "local_storage_data"; -static void *storage_ptr = NULL; +static void *storage_ptr = nullptr; static const char* debugeeClassSignature = "Lnsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj004;"; static const char* objectFieldName = "object"; @@ -75,27 +75,27 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { return; do { - jclass debugeeClass = NULL; - jfieldID objectField = NULL; - jobject object = NULL; + jclass debugeeClass = nullptr; + jfieldID objectField = nullptr; + jobject object = nullptr; NSK_DISPLAY1("Find debugee class: %s\n", debugeeClassSignature); debugeeClass = nsk_jvmti_classBySignature(debugeeClassSignature); - if (debugeeClass == NULL) { + if (debugeeClass == nullptr) { nsk_jvmti_setFailStatus(); break; } NSK_DISPLAY1("Find static field in debugee class: %s\n", objectFieldName); if (!NSK_JNI_VERIFY(jni, (objectField = jni->GetStaticFieldID( - debugeeClass, objectFieldName, debugeeClassSignature)) != NULL)) { + debugeeClass, objectFieldName, debugeeClassSignature)) != nullptr)) { nsk_jvmti_setFailStatus(); break; } NSK_DISPLAY1("Find value of static field in debugee class: %s\n", objectFieldName); if (!NSK_JNI_VERIFY(jni, (object = - jni->GetStaticObjectField(debugeeClass, objectField)) != NULL)) { + jni->GetStaticObjectField(debugeeClass, objectField)) != nullptr)) { nsk_jvmti_setFailStatus(); break; } @@ -146,7 +146,7 @@ JNIEXPORT jint JNI_OnLoad_iterobjreachobj004(JavaVM *jvm, char *options, void *r } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -154,7 +154,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* save pointer to environment to use it in callbacks */ @@ -170,7 +170,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj005/iterobjreachobj005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj005/iterobjreachobj005.cpp index cbba7ba29029..5e74b8b607fe 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj005/iterobjreachobj005.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverObjectsReachableFromObject/iterobjreachobj005/iterobjreachobj005.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,16 +23,16 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { /* ============================================================================= */ static jlong timeout = 0; -static jvmtiEnv* st_jvmti = NULL; +static jvmtiEnv* st_jvmti = nullptr; static int *user_data = 0, objCounter = 0; static jlong nanos = 0; static jvmtiTimerInfo timer_info1, timer_info2; @@ -115,27 +115,27 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { do { NSK_DISPLAY0("Calling IterateOverInstancesOfClass with filter JVMTI_HEAP_OBJECT_EITHER\n"); { - jclass debugeeClass = NULL; - jfieldID objectField = NULL; - jobject object = NULL; + jclass debugeeClass = nullptr; + jfieldID objectField = nullptr; + jobject object = nullptr; NSK_DISPLAY1("Find debugee class: %s\n", debugeeClassSignature); debugeeClass = nsk_jvmti_classBySignature(debugeeClassSignature); - if (debugeeClass == NULL) { + if (debugeeClass == nullptr) { nsk_jvmti_setFailStatus(); break; } NSK_DISPLAY1("Find static field in debugee class: %s\n", objectFieldName); if (!NSK_JNI_VERIFY(jni, (objectField = jni->GetStaticFieldID( - debugeeClass, objectFieldName, debugeeClassSignature)) != NULL)) { + debugeeClass, objectFieldName, debugeeClassSignature)) != nullptr)) { nsk_jvmti_setFailStatus(); break; } NSK_DISPLAY1("Find value of static field in debugee class: %s\n", objectFieldName); if (!NSK_JNI_VERIFY(jni, (object = - jni->GetStaticObjectField(debugeeClass, objectField)) != NULL)) { + jni->GetStaticObjectField(debugeeClass, objectField)) != nullptr)) { nsk_jvmti_setFailStatus(); break; } @@ -175,7 +175,7 @@ JNIEXPORT jint JNI_OnLoad_iterobjreachobj005(JavaVM *jvm, char *options, void *r } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -183,7 +183,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* save pointer to environment to use it in callbacks */ @@ -200,7 +200,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj001/iterreachobj001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj001/iterreachobj001.cpp index 9052297cacf6..727b1046245e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj001/iterreachobj001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj001/iterreachobj001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -63,7 +63,7 @@ typedef struct ObjectDescStruct { static int chainLength = 0; static int objectsCount = 0; -static ObjectDesc* objectDescList = NULL; +static ObjectDesc* objectDescList = nullptr; static int fakeUserData = 0; static int userDataError = 0; @@ -78,7 +78,7 @@ static int getChainObjects(jvmtiEnv* jvmti, JNIEnv* jni, jobject firstObject, jlong tag, int reachable) { int success = NSK_TRUE; - jobject obj = NULL; + jobject obj = nullptr; jlong objTag = (reachable ? tag : -tag); if (count <= 0) @@ -87,7 +87,7 @@ static int getChainObjects(jvmtiEnv* jvmti, JNIEnv* jni, jobject firstObject, count--; tag++; - if (!NSK_JNI_VERIFY(jni, (obj = jni->GetObjectField(firstObject, firstField)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (obj = jni->GetObjectField(firstObject, firstField)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -112,16 +112,16 @@ static int getChainObjects(jvmtiEnv* jvmti, JNIEnv* jni, jobject firstObject, /** Obtain all tested objects from debugee class and tag them recursively. */ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, int *objectsCount, ObjectDesc* *objectDescList) { - jclass debugeeClass = NULL; - jclass rootObjectClass = NULL; - jclass chainObjectClass = NULL; + jclass debugeeClass = nullptr; + jclass rootObjectClass = nullptr; + jclass chainObjectClass = nullptr; - jfieldID objectField = NULL; - jfieldID reachableChainField = NULL; - jfieldID unreachableChainField = NULL; - jfieldID tailField = NULL; + jfieldID objectField = nullptr; + jfieldID reachableChainField = nullptr; + jfieldID unreachableChainField = nullptr; + jfieldID tailField = nullptr; - jobject rootObject = NULL; + jobject rootObject = nullptr; jlong rootObjectTag = 1; jlong chainObjectTag = 100; @@ -145,14 +145,14 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, } NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME); - if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } NSK_DISPLAY1(" ... found class: 0x%p\n", (void*)debugeeClass); NSK_DISPLAY1("Find root object class: %s\n", ROOT_OBJECT_CLASS_NAME); - if (!NSK_JNI_VERIFY(jni, (rootObjectClass = jni->FindClass(ROOT_OBJECT_CLASS_NAME)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (rootObjectClass = jni->FindClass(ROOT_OBJECT_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -160,7 +160,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find chain object class: %s\n", CHAIN_OBJECT_CLASS_NAME); if (!NSK_JNI_VERIFY(jni, (chainObjectClass = - jni->FindClass(CHAIN_OBJECT_CLASS_NAME)) != NULL)) { + jni->FindClass(CHAIN_OBJECT_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -168,7 +168,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find static field in debugee class: %s\n", OBJECT_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (objectField = jni->GetStaticFieldID( - debugeeClass, OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != NULL)) { + debugeeClass, OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -176,7 +176,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find instance field in root object class: %s\n", REACHABLE_CHAIN_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (reachableChainField = jni->GetFieldID( - rootObjectClass, REACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) { + rootObjectClass, REACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -184,7 +184,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find instance field in root object class: %s\n", UNREACHABLE_CHAIN_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (unreachableChainField = jni->GetFieldID( - rootObjectClass, UNREACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) { + rootObjectClass, UNREACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -192,7 +192,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Find instance field in chain object class: %s\n", TAIL_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (tailField = - jni->GetFieldID(chainObjectClass, TAIL_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) { + jni->GetFieldID(chainObjectClass, TAIL_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -200,7 +200,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, NSK_DISPLAY1("Get root object from static field: %s\n", OBJECT_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (rootObject = - jni->GetStaticObjectField(debugeeClass, objectField)) != NULL)) { + jni->GetStaticObjectField(debugeeClass, objectField)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -276,7 +276,7 @@ static int checkTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, /** Release references to the tested objects and free allocated memory. */ static int releaseTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, ObjectDesc* objectDescList) { - if (objectDescList != NULL) { + if (objectDescList != nullptr) { NSK_DISPLAY1("Deallocate objects list: 0x%p\n", (void*)objectDescList); if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)objectDescList))) { nsk_jvmti_setFailStatus(); @@ -297,11 +297,11 @@ heapRootCallback(jvmtiHeapRootKind root_kind, if (info & INFO_HEAPROOT) { NSK_DISPLAY4(" heapRootCallback: root_kind=%2d class_tag=%-3ld size=%-3ld *tag_ptr=%-5ld\n", (int)root_kind, (long)class_tag, (long)size, - (long)(tag_ptr == NULL ? (jlong)0 : *tag_ptr)); + (long)(tag_ptr == nullptr ? (jlong)0 : *tag_ptr)); } - if (tag_ptr == NULL) { - NSK_COMPLAIN4("NULL tag_ptr is passed to heapRootCallback:\n" + if (tag_ptr == nullptr) { + NSK_COMPLAIN4("null tag_ptr is passed to heapRootCallback:\n" "# tag_ptr: 0x%p\n" "# root_kind: %d\n" "# class_tag: %ld\n" @@ -313,7 +313,7 @@ heapRootCallback(jvmtiHeapRootKind root_kind, nsk_jvmti_setFailStatus(); } - if (tag_ptr != NULL && *tag_ptr != 0) { + if (tag_ptr != nullptr && *tag_ptr != 0) { int found = 0; int i; @@ -389,12 +389,12 @@ stackReferenceCallback(jvmtiHeapRootKind root_kind, NSK_DISPLAY8(" stackReferenceCallback: root_kind=%1d class_tag=%-3ld size=%-3ld" " *tag_ptr=%-5ld thread_tag=%-3ld depth=%3d method=0x%p slot=%d\n", (int)root_kind, (long)class_tag, (long)size, - (long)(tag_ptr == NULL ? (jlong)0 : *tag_ptr), + (long)(tag_ptr == nullptr ? (jlong)0 : *tag_ptr), (long)thread_tag, (int)depth, (void*)method, (int)slot); } - if (tag_ptr == NULL) { - NSK_COMPLAIN8("NULL tag_ptr is passed to stackReferenceCallback:\n" + if (tag_ptr == nullptr) { + NSK_COMPLAIN8("null tag_ptr is passed to stackReferenceCallback:\n" "# tag_ptr: 0x%p\n" "# root_kind: %d\n" "# class_tag: %ld\n" @@ -414,7 +414,7 @@ stackReferenceCallback(jvmtiHeapRootKind root_kind, nsk_jvmti_setFailStatus(); } - if (tag_ptr != NULL && *tag_ptr != 0) { + if (tag_ptr != nullptr && *tag_ptr != 0) { int found = 0; int i; @@ -514,12 +514,12 @@ objectReferenceCallback(jvmtiObjectReferenceKind reference_kind, NSK_DISPLAY6(" objectReferenceCallback: ref_kind=%1d class_tag=%-3ld size=%-3ld" " *tag_ptr=%-5ld ref_tag=%-5ld ref_idx=%d\n", (int)reference_kind, (long)class_tag, (long)size, - (long)(tag_ptr == NULL ? (jlong)0 : *tag_ptr), + (long)(tag_ptr == nullptr ? (jlong)0 : *tag_ptr), (long)refferrer_tag, (int)refferrer_index); } - if (tag_ptr == NULL) { - NSK_COMPLAIN6("NULL tag_ptr is passed to objectReferenceCallback:\n" + if (tag_ptr == nullptr) { + NSK_COMPLAIN6("null tag_ptr is passed to objectReferenceCallback:\n" "# tag_ptr: 0x%p\n" "# reference_kind: %d\n" "# class_tag: %ld\n" @@ -535,7 +535,7 @@ objectReferenceCallback(jvmtiObjectReferenceKind reference_kind, nsk_jvmti_setFailStatus(); } - if (tag_ptr != NULL && *tag_ptr != 0) { + if (tag_ptr != nullptr && *tag_ptr != 0) { int found = 0; int i; @@ -670,7 +670,7 @@ JNIEXPORT jint JNI_OnLoad_iterreachobj001(JavaVM *jvm, char *options, void *rese } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -679,7 +679,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { { const char* infoOpt = nsk_jvmti_findOptionValue("info"); - if (infoOpt != NULL) { + if (infoOpt != nullptr) { if (strcmp(infoOpt, "none") == 0) info = INFO_NONE; else if (strcmp(infoOpt, "all") == 0) @@ -704,7 +704,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; { @@ -717,7 +717,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj002/iterreachobj002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj002/iterreachobj002.cpp index f732196a7781..236094b50159 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj002/iterreachobj002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj002/iterreachobj002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,14 +23,14 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { -static JNIEnv *jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv *jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jvmtiCapabilities caps; static jlong timeout = 0; @@ -446,7 +446,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; memset(&caps, 0, sizeof(caps)); @@ -477,11 +477,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { NSK_DISPLAY0("enabling JVMTI events ...\n"); if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, - NULL))) + nullptr))) return JNI_ERR; NSK_DISPLAY0("enabling the events done.\n"); - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj003/iterreachobj003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj003/iterreachobj003.cpp index 2f8ba14ad662..d091687f4921 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj003/iterreachobj003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj003/iterreachobj003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,9 +23,9 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -35,7 +35,7 @@ static jlong timeout = 0; static long objCounter = 0; static int userData = 0; -static jvmtiEnv* st_jvmti = NULL; +static jvmtiEnv* st_jvmti = nullptr; /* ============================================================================= */ @@ -50,7 +50,7 @@ heapRootCallback(jvmtiHeapRootKind root_kind, jlong* tag_ptr, void* user_data) { - jrawMonitorID monitor_ptr = NULL; + jrawMonitorID monitor_ptr = nullptr; *tag_ptr = (jlong)++objCounter; @@ -114,7 +114,7 @@ stackReferenceCallback(jvmtiHeapRootKind root_kind, jint slot, void* user_data) { - jrawMonitorID monitor_ptr = NULL; + jrawMonitorID monitor_ptr = nullptr; *tag_ptr = (jlong)++objCounter; @@ -177,7 +177,7 @@ objectReferenceCallback(jvmtiObjectReferenceKind reference_kind, jint referrer_index, void* user_data) { - jrawMonitorID monitor_ptr = NULL; + jrawMonitorID monitor_ptr = nullptr; *tag_ptr = (jlong)++objCounter; @@ -285,7 +285,7 @@ JNIEXPORT jint JNI_OnLoad_iterreachobj003(JavaVM *jvm, char *options, void *rese } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -293,7 +293,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* save pointer to environment to use it in callbacks */ @@ -309,7 +309,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj004/iterreachobj004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj004/iterreachobj004.cpp index 6557dbf9d5b1..9b9d14603a77 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj004/iterreachobj004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj004/iterreachobj004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,9 +23,9 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -35,9 +35,9 @@ static jlong timeout = 0; static long objCounter = 0; static int userData = 0; -static jvmtiEnv* st_jvmti = NULL; +static jvmtiEnv* st_jvmti = nullptr; static const char *storage_data = "local_storage_data"; -static void *storage_ptr = NULL; +static void *storage_ptr = nullptr; /* ============================================================================= */ @@ -226,7 +226,7 @@ JNIEXPORT jint JNI_OnLoad_iterreachobj004(JavaVM *jvm, char *options, void *rese } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -234,7 +234,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* save pointer to environment to use it in callbacks */ @@ -250,7 +250,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj005/iterreachobj005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj005/iterreachobj005.cpp index 27137426b19d..30956305257e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj005/iterreachobj005.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateOverReachableObjects/iterreachobj005/iterreachobj005.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,9 +23,9 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -35,7 +35,7 @@ static jlong timeout = 0; static long objCounter = 0; static int userData = 0; -static jvmtiEnv* st_jvmti = NULL; +static jvmtiEnv* st_jvmti = nullptr; static jlong nanos = 0; static jvmtiTimerInfo timer_info1, timer_info2; @@ -295,7 +295,7 @@ JNIEXPORT jint JNI_OnLoad_iterreachobj005(JavaVM *jvm, char *options, void *rese } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -303,7 +303,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* save pointer to environment to use it in callbacks */ @@ -320,7 +320,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/abort/Abort.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/abort/Abort.cpp index 9e1bd12bcc17..7df6157b375c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/abort/Abort.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/abort/Abort.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,9 +25,9 @@ #include #include "jvmti.h" -#include "jni_tools.h" -#include "jvmti_tools.h" -#include "agent_common.h" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" +#include "agent_common.hpp" extern "C" { @@ -81,7 +81,7 @@ agent(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { int invocations = 0; NSK_DISPLAY0("Waiting debugee.\n"); - if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, NULL))) { + if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, nullptr))) { return; } if (!NSK_VERIFY(nsk_jvmti_waitForSync(timeout))) { @@ -95,7 +95,7 @@ agent(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { primitive_callbacks.heap_iteration_callback = &heap_callback; NSK_DISPLAY0("Iterating over reachable objects.\n"); - if (!NSK_JVMTI_VERIFY(jvmti->IterateThroughHeap(0, NULL, &primitive_callbacks, &invocations))) { + if (!NSK_JVMTI_VERIFY(jvmti->IterateThroughHeap(0, nullptr, &primitive_callbacks, &invocations))) { nsk_jvmti_setFailStatus(); return; } @@ -127,7 +127,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiEventCallbacks event_callbacks; jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) { + if (!NSK_VERIFY(jvmti != nullptr)) { return JNI_ERR; } @@ -148,7 +148,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agent, NULL))) { + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agent, nullptr))) { return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/callbacks/Callbacks.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/callbacks/Callbacks.cpp index 315a07f38e2b..334937d3d04f 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/callbacks/Callbacks.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/callbacks/Callbacks.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,9 +25,9 @@ #include #include "jvmti.h" -#include "jni_tools.h" -#include "jvmti_tools.h" -#include "agent_common.h" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" +#include "agent_common.hpp" extern "C" { @@ -368,13 +368,13 @@ int tag_objects(jvmtiEnv *jvmti, JNIEnv *jni) { jobjectArray testObjects; int object; - if (!NSK_VERIFY(NULL != (debugee = jni->FindClass(className)))) + if (!NSK_VERIFY(nullptr != (debugee = jni->FindClass(className)))) return JNI_ERR; - if (!NSK_VERIFY(NULL != (testObjectsField = jni->GetStaticFieldID(debugee, fieldName, fieldSig)))) + if (!NSK_VERIFY(nullptr != (testObjectsField = jni->GetStaticFieldID(debugee, fieldName, fieldSig)))) return JNI_ERR; - if (!NSK_VERIFY(NULL != (testObjects = (jobjectArray)(jni->GetStaticObjectField( + if (!NSK_VERIFY(nullptr != (testObjects = (jobjectArray)(jni->GetStaticObjectField( debugee, testObjectsField))))) return JNI_ERR; @@ -386,13 +386,13 @@ int tag_objects(jvmtiEnv *jvmti, JNIEnv *jni) { jint field; memset(&objects_info[object],0,sizeof(object_info_t)); - if (!NSK_VERIFY(NULL != (target = jni->GetObjectArrayElement(testObjects, object)))) + if (!NSK_VERIFY(nullptr != (target = jni->GetObjectArrayElement(testObjects, object)))) return JNI_ERR; - if (!NSK_VERIFY(NULL != (targetClass = jni->GetObjectClass(target)))) + if (!NSK_VERIFY(nullptr != (targetClass = jni->GetObjectClass(target)))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->GetClassSignature(targetClass, &(objects_info[object].name), NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->GetClassSignature(targetClass, &(objects_info[object].name), nullptr))) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->GetClassFields( @@ -407,7 +407,7 @@ int tag_objects(jvmtiEnv *jvmti, JNIEnv *jni) { targetFields[field], &objects_info[object].fields[field].name, &objects_info[object].fields[field].signature, - NULL))) + nullptr))) return JNI_ERR; if (is_primitive_type(objects_info[object].fields[field].signature)) { objects_info[object].fields[field].primitive = 1; @@ -420,12 +420,12 @@ int tag_objects(jvmtiEnv *jvmti, JNIEnv *jni) { return JNI_ERR; } if (modifiers & STATIC_FIELD) { - if (!NSK_VERIFY(NULL != (value = jni->GetStaticObjectField(targetClass, + if (!NSK_VERIFY(nullptr != (value = jni->GetStaticObjectField(targetClass, targetFields[field])))) { return JNI_ERR; } } else { - if (!NSK_VERIFY(NULL != (value = jni->GetObjectField(target, targetFields[field])))) { + if (!NSK_VERIFY(nullptr != (value = jni->GetObjectField(target, targetFields[field])))) { return JNI_ERR; } } @@ -515,7 +515,7 @@ agent(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { jvmtiHeapCallbacks primitive_callbacks; NSK_DISPLAY0("Waiting debugee.\n"); - if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, NULL))) { + if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, nullptr))) { return; } if (!NSK_VERIFY(nsk_jvmti_waitForSync(timeout))) { @@ -534,7 +534,7 @@ agent(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { primitive_callbacks.heap_iteration_callback = &heap_callback; NSK_DISPLAY0("Iterating over reachable objects.\n"); - if (!NSK_JVMTI_VERIFY(jvmti->IterateThroughHeap(0, NULL, &primitive_callbacks, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->IterateThroughHeap(0, nullptr, &primitive_callbacks, nullptr))) { nsk_jvmti_setFailStatus(); return; } @@ -551,7 +551,7 @@ agent(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } NSK_DISPLAY0("Iterating over unreachable objects.\n"); - if (!NSK_JVMTI_VERIFY(jvmti->IterateThroughHeap(0, NULL, &primitive_callbacks, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->IterateThroughHeap(0, nullptr, &primitive_callbacks, nullptr))) { nsk_jvmti_setFailStatus(); return; } @@ -559,7 +559,7 @@ agent(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0("Verifying that all filds were found.\n"); verify_objects(); - if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_DISABLE, 1, &event, NULL))) { + if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_DISABLE, 1, &event, nullptr))) { return; } @@ -586,7 +586,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiEventCallbacks event_callbacks; jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) { + if (!NSK_VERIFY(jvmti != nullptr)) { return JNI_ERR; } @@ -608,7 +608,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agent, NULL))) { + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agent, nullptr))) { return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/concrete-klass-filter/ConcreteKlassFilter.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/concrete-klass-filter/ConcreteKlassFilter.cpp index 599f95bc4796..3ab2c7511877 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/concrete-klass-filter/ConcreteKlassFilter.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/concrete-klass-filter/ConcreteKlassFilter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,9 +25,9 @@ #include #include "jvmti.h" -#include "jni_tools.h" -#include "jvmti_tools.h" -#include "agent_common.h" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" +#include "agent_common.hpp" extern "C" { @@ -152,16 +152,16 @@ int tag_objects(jvmtiEnv *jvmti, JNIEnv *jni) { jobject testObject; jclass testObjectClass; - if (!NSK_VERIFY(NULL != (debugee = jni->FindClass(className)))) + if (!NSK_VERIFY(nullptr != (debugee = jni->FindClass(className)))) return JNI_ERR; - if (!NSK_VERIFY(NULL != (testObjectField = jni->GetStaticFieldID(debugee, fieldName, fieldSig)))) + if (!NSK_VERIFY(nullptr != (testObjectField = jni->GetStaticFieldID(debugee, fieldName, fieldSig)))) return JNI_ERR; - if (!NSK_VERIFY(NULL != (testObject = (jni->GetStaticObjectField(debugee, testObjectField))))) + if (!NSK_VERIFY(nullptr != (testObject = (jni->GetStaticObjectField(debugee, testObjectField))))) return JNI_ERR; - if (!NSK_VERIFY(NULL != (testObjectClass = (jni->GetObjectClass(testObject))))) + if (!NSK_VERIFY(nullptr != (testObjectClass = (jni->GetObjectClass(testObject))))) return JNI_ERR; // tag class and it's instance to pass this tag into primitive field callback @@ -197,14 +197,14 @@ agent(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { jvmtiHeapCallbacks primitive_callbacks; jclass klass; - if (!NSK_VERIFY(NULL != (klass = jni->FindClass(testClassName)))) { + if (!NSK_VERIFY(nullptr != (klass = jni->FindClass(testClassName)))) { NSK_COMPLAIN1("Can't find class %s.\n",testClassName); nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY0("Waiting debugee.\n"); - if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, NULL))) { + if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, nullptr))) { return; } if (!NSK_VERIFY(nsk_jvmti_waitForSync(timeout))) { @@ -223,7 +223,7 @@ agent(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { primitive_callbacks.heap_iteration_callback = &heap_callback; NSK_DISPLAY0("Iterating over reachable objects.\n"); - if (!NSK_JVMTI_VERIFY(jvmti->IterateThroughHeap(0, klass, &primitive_callbacks, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->IterateThroughHeap(0, klass, &primitive_callbacks, nullptr))) { nsk_jvmti_setFailStatus(); return; } @@ -240,7 +240,7 @@ agent(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } NSK_DISPLAY0("Iterating over unreachable objects.\n"); - if (!NSK_JVMTI_VERIFY(jvmti->IterateThroughHeap(0, klass, &primitive_callbacks, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->IterateThroughHeap(0, klass, &primitive_callbacks, nullptr))) { nsk_jvmti_setFailStatus(); return; } @@ -269,7 +269,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiEventCallbacks event_callbacks; jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) { + if (!NSK_VERIFY(jvmti != nullptr)) { return JNI_ERR; } @@ -291,7 +291,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agent, NULL))) { + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agent, nullptr))) { return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/filter-tagged/HeapFilter.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/filter-tagged/HeapFilter.cpp index 983aa4a122db..4115c60d228a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/filter-tagged/HeapFilter.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/filter-tagged/HeapFilter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,9 +25,9 @@ #include #include "jvmti.h" -#include "jni_tools.h" -#include "jvmti_tools.h" -#include "agent_common.h" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" +#include "agent_common.hpp" extern "C" { @@ -294,13 +294,13 @@ int tag_objects(jvmtiEnv *jvmti, JNIEnv *jni) { jobjectArray testObjects; int object; - if (!NSK_VERIFY(NULL != (debugee = jni->FindClass(className)))) + if (!NSK_VERIFY(nullptr != (debugee = jni->FindClass(className)))) return JNI_ERR; - if (!NSK_VERIFY(NULL != (testObjectsField = jni->GetStaticFieldID(debugee, fieldName, fieldSig)))) + if (!NSK_VERIFY(nullptr != (testObjectsField = jni->GetStaticFieldID(debugee, fieldName, fieldSig)))) return JNI_ERR; - if (!NSK_VERIFY(NULL != (testObjects = (jobjectArray)(jni->GetStaticObjectField( + if (!NSK_VERIFY(nullptr != (testObjects = (jobjectArray)(jni->GetStaticObjectField( debugee, testObjectsField))))) return JNI_ERR; @@ -313,13 +313,13 @@ int tag_objects(jvmtiEnv *jvmti, JNIEnv *jni) { int tagged = object == 0; memset(&objects_info[object],0,sizeof(object_info_t)); - if (!NSK_VERIFY(NULL != (target = jni->GetObjectArrayElement(testObjects, object)))) + if (!NSK_VERIFY(nullptr != (target = jni->GetObjectArrayElement(testObjects, object)))) return JNI_ERR; - if (!NSK_VERIFY(NULL != (targetClass = jni->GetObjectClass(target)))) + if (!NSK_VERIFY(nullptr != (targetClass = jni->GetObjectClass(target)))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->GetClassSignature(targetClass, &(objects_info[object].name), NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->GetClassSignature(targetClass, &(objects_info[object].name), nullptr))) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->GetClassFields( @@ -337,7 +337,7 @@ int tag_objects(jvmtiEnv *jvmti, JNIEnv *jni) { targetFields[field], &objects_info[object].fields[field].name, &objects_info[object].fields[field].signature, - NULL))) + nullptr))) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->GetFieldModifiers( targetClass, targetFields[field], &modifiers))) { @@ -362,12 +362,12 @@ int tag_objects(jvmtiEnv *jvmti, JNIEnv *jni) { return JNI_ERR; } if (is_static) { - if (!NSK_VERIFY(NULL != (value = jni->GetStaticObjectField( + if (!NSK_VERIFY(nullptr != (value = jni->GetStaticObjectField( targetClass, targetFields[field])))) { return JNI_ERR; } } else { - if (!NSK_VERIFY(NULL != (value = jni->GetObjectField(target, targetFields[field])))) { + if (!NSK_VERIFY(nullptr != (value = jni->GetObjectField(target, targetFields[field])))) { return JNI_ERR; } } @@ -456,7 +456,7 @@ agent(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { jvmtiEventCallbacks event_callbacks; NSK_DISPLAY0("Waiting debugee.\n"); - if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, NULL))) { + if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, nullptr))) { return; } if (!NSK_VERIFY(nsk_jvmti_waitForSync(timeout))) { @@ -475,7 +475,7 @@ agent(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { primitive_callbacks.heap_iteration_callback = &heap_callback; NSK_DISPLAY0("Iterating over reachable objects.\n"); - if (!NSK_JVMTI_VERIFY(jvmti->IterateThroughHeap(filter_type, NULL, &primitive_callbacks, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->IterateThroughHeap(filter_type, nullptr, &primitive_callbacks, nullptr))) { nsk_jvmti_setFailStatus(); return; } @@ -492,7 +492,7 @@ agent(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } NSK_DISPLAY0("Iterating over unreachable objects.\n"); - if (!NSK_JVMTI_VERIFY(jvmti->IterateThroughHeap(filter_type, NULL, &primitive_callbacks, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->IterateThroughHeap(filter_type, nullptr, &primitive_callbacks, nullptr))) { nsk_jvmti_setFailStatus(); return; } @@ -533,14 +533,14 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { const char *type; jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) { + if (!NSK_VERIFY(jvmti != nullptr)) { return JNI_ERR; } nsk_jvmti_parseOptions(options); type = nsk_jvmti_findOptionValue("filter"); - if (type != NULL) { + if (type != nullptr) { if (0 == strcmp(type, "JVMTI_HEAP_FILTER_TAGGED")) { filter_type = JVMTI_HEAP_FILTER_TAGGED; } else if (0 == strcmp(type, "JVMTI_HEAP_FILTER_UNTAGGED")) { @@ -574,7 +574,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agent, NULL))) { + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agent, nullptr))) { return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/non-concrete-klass-filter/NonConcreteKlassFilter.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/non-concrete-klass-filter/NonConcreteKlassFilter.cpp index b0617bce2970..37e3af0c6891 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/non-concrete-klass-filter/NonConcreteKlassFilter.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/IterateThroughHeap/non-concrete-klass-filter/NonConcreteKlassFilter.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,9 +25,9 @@ #include #include "jvmti.h" -#include "jni_tools.h" -#include "jvmti_tools.h" -#include "agent_common.h" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" +#include "agent_common.hpp" extern "C" { @@ -141,7 +141,7 @@ agent(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { int i; NSK_DISPLAY0("Waiting debugee.\n"); - if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, NULL))) { + if (!NSK_VERIFY(nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, &event, nullptr))) { return; } if (!NSK_VERIFY(nsk_jvmti_waitForSync(timeout))) { @@ -156,13 +156,13 @@ agent(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { phase = ZERO_INVOCATIONS_PHASE; for (i = 0; i < FILTER_COUNT; i++) { - if (!NSK_VERIFY(NULL != (klass = jni->FindClass(types[i])))) { + if (!NSK_VERIFY(nullptr != (klass = jni->FindClass(types[i])))) { NSK_COMPLAIN1("Can't find class %s.\n",types[i]); nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY1("Iterating through heap with klass-filter '%s'.\n",types[i]); - if (!NSK_JVMTI_VERIFY(jvmti->IterateThroughHeap(0, klass, &primitive_callbacks, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->IterateThroughHeap(0, klass, &primitive_callbacks, nullptr))) { nsk_jvmti_setFailStatus(); return; } @@ -170,12 +170,12 @@ agent(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { phase = STATIC_FIELDS_FINDING_PHASE; NSK_DISPLAY0("Iterating through heap with klass-filter 'java/lang/Class'.\n"); - if (!NSK_VERIFY(NULL != (klass = jni->FindClass("java/lang/Class")))) { + if (!NSK_VERIFY(nullptr != (klass = jni->FindClass("java/lang/Class")))) { NSK_COMPLAIN0("Can't find class java/lang/Class.\n"); nsk_jvmti_setFailStatus(); return; } - if (!NSK_JVMTI_VERIFY(jvmti->IterateThroughHeap(0, klass, &primitive_callbacks, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->IterateThroughHeap(0, klass, &primitive_callbacks, nullptr))) { nsk_jvmti_setFailStatus(); return; } @@ -209,7 +209,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiEventCallbacks event_callbacks; jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) { + if (!NSK_VERIFY(jvmti != nullptr)) { return JNI_ERR; } @@ -230,7 +230,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agent, NULL))) { + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agent, nullptr))) { return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NotifyFramePop/nframepop001/nframepop001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NotifyFramePop/nframepop001/nframepop001.cpp index 31e569a39aa1..eec81b91cb11 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NotifyFramePop/nframepop001/nframepop001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NotifyFramePop/nframepop001/nframepop001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,15 +33,15 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; static jint result = PASSED; static jmethodID mid1, mid2; -static jthread currThread = NULL, popThread = NULL; -static jclass currClass = NULL, popClass = NULL; -static jmethodID currMethod = NULL, popMethod = NULL; +static jthread currThread = nullptr, popThread = nullptr; +static jclass currClass = nullptr, popClass = nullptr; +static jmethodID currMethod = nullptr, popMethod = nullptr; static jboolean currFlag = JNI_FALSE, popFlag = JNI_FALSE; static jint currLoc = 0, popLoc = 0; @@ -133,7 +133,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -190,7 +190,7 @@ Java_nsk_jvmti_NotifyFramePop_nframepop001_getMethIds(JNIEnv *env, jclass cl) { if (caps.can_generate_frame_pop_events) { err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_FRAME_POP, NULL); + JVMTI_EVENT_FRAME_POP, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable FRAME_POP event: %s (%d)\n", TranslateError(err), err); @@ -200,14 +200,14 @@ Java_nsk_jvmti_NotifyFramePop_nframepop001_getMethIds(JNIEnv *env, jclass cl) { } mid1 = env->GetMethodID(cl, "meth01", "(I)V"); - if (mid1 == NULL) { + if (mid1 == nullptr) { printf("Cannot find method \"meth01\"\n"); result = STATUS_FAILED; return; } mid2 = env->GetMethodID(cl, "meth02", "(I)V"); - if (mid2 == NULL) { + if (mid2 == nullptr) { printf("Cannot find method \"meth02\"\n"); result = STATUS_FAILED; return; @@ -215,7 +215,7 @@ Java_nsk_jvmti_NotifyFramePop_nframepop001_getMethIds(JNIEnv *env, jclass cl) { if (caps.can_generate_exception_events) { err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_EXCEPTION_CATCH, NULL); + JVMTI_EVENT_EXCEPTION_CATCH, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable EXCEPTION_CATCH event: %s (%d)\n", TranslateError(err), err); @@ -245,7 +245,7 @@ Java_nsk_jvmti_NotifyFramePop_nframepop001_setFramePopNotif(JNIEnv *env, currThread = env->NewGlobalRef(thr); currClass = env->FindClass("nsk/jvmti/NotifyFramePop/nframepop001a"); - if (currClass == NULL) { + if (currClass == nullptr) { printf("Cannot find nsk.jvmti.NotifyFramePop.nframepop001a class!\n"); result = STATUS_FAILED; return; @@ -253,7 +253,7 @@ Java_nsk_jvmti_NotifyFramePop_nframepop001_setFramePopNotif(JNIEnv *env, currClass = (jclass) env->NewGlobalRef(currClass); currMethod = env->GetMethodID(currClass, "run", "()V"); - if (currMethod == NULL) { + if (currMethod == nullptr) { printf("Cannot find method \"run\"\n"); result = STATUS_FAILED; } @@ -319,9 +319,9 @@ Java_nsk_jvmti_NotifyFramePop_nframepop001_checkFrame(JNIEnv *env, result = STATUS_FAILED; } - currThread = NULL; popThread = NULL; - currClass = NULL; popClass = NULL; - currMethod = NULL; popMethod = NULL; + currThread = nullptr; popThread = nullptr; + currClass = nullptr; popClass = nullptr; + currMethod = nullptr; popMethod = nullptr; currFlag = JNI_FALSE; popFlag = JNI_FALSE; currLoc = 0; popLoc = 0; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NotifyFramePop/nframepop002/nframepop002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NotifyFramePop/nframepop002/nframepop002.cpp index 8faa9177cb51..333cd0298c44 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NotifyFramePop/nframepop002/nframepop002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NotifyFramePop/nframepop002/nframepop002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; @@ -53,7 +53,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -91,7 +91,7 @@ Java_nsk_jvmti_NotifyFramePop_nframepop002_check(JNIEnv *env, jclass cls, jthread thread) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NotifyFramePop/nframepop003/nframepop003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NotifyFramePop/nframepop003/nframepop003.cpp index 201a7cd26b94..d389b1239877 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NotifyFramePop/nframepop003/nframepop003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/NotifyFramePop/nframepop003/nframepop003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; @@ -53,7 +53,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -91,7 +91,7 @@ Java_nsk_jvmti_NotifyFramePop_nframepop003_check(JNIEnv *env, jclass cls, jthread thread) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ObjectFree/objfree001/objfree001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ObjectFree/objfree001/objfree001.cpp index 2a14eee06292..22a1a2273774 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ObjectFree/objfree001/objfree001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ObjectFree/objfree001/objfree001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,12 +25,12 @@ #include #include #include -#include "agent_common.h" +#include "agent_common.hpp" -#include "nsk_tools.h" -#include "JVMTITools.h" -#include "jvmti_tools.h" -#include "jni_tools.h" +#include "nsk_tools.hpp" +#include "JVMTITools.hpp" +#include "jvmti_tools.hpp" +#include "jni_tools.hpp" extern "C" { @@ -42,7 +42,7 @@ extern "C" { static const char *CLASS_SIG = "Lnsk/jvmti/ObjectFree/objfree001u;"; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static volatile jint result = PASSED; @@ -131,7 +131,7 @@ static void memoryFunc(jvmtiEnv *jvmti_env, const char *msg) { } static void envStorageFunc(jvmtiEnv *jvmti_env, const char *msg) { - LocalStorage* obtainedData = NULL; + LocalStorage* obtainedData = nullptr; LocalStorage* storedData = &stor; NSK_DISPLAY2("%s: setting an environment local storage 0x%p ...\n", @@ -253,7 +253,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add capability to generate compiled method events */ @@ -282,11 +282,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { NSK_DISPLAY0("setting event callbacks done\nenabling JVMTI events ...\n"); if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, - NULL))) + nullptr))) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, - NULL))) + nullptr))) return JNI_ERR; NSK_DISPLAY0("enabling the events done\n\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ObjectFree/objfree002/objfree002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ObjectFree/objfree002/objfree002.cpp index 7e1be9da5376..462feb7b4166 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ObjectFree/objfree002/objfree002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ObjectFree/objfree002/objfree002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,12 +25,12 @@ #include #include #include -#include "agent_common.h" +#include "agent_common.hpp" -#include "nsk_tools.h" -#include "JVMTITools.h" -#include "jvmti_tools.h" -#include "jni_tools.h" +#include "nsk_tools.hpp" +#include "JVMTITools.hpp" +#include "jvmti_tools.hpp" +#include "jni_tools.hpp" extern "C" { @@ -39,7 +39,7 @@ extern "C" { #define MEM_SIZE 1024 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jvmtiCapabilities caps; @@ -161,7 +161,7 @@ static void memoryFunc(jvmtiEnv *jvmti_env, const char *msg) { } static void envStorageFunc(jvmtiEnv *jvmti_env, const char *msg) { - LocalStorage* obtainedData = NULL; + LocalStorage* obtainedData = nullptr; LocalStorage* storedData = &stor; NSK_DISPLAY2("%s: setting an environment local storage 0x%p ...\n", @@ -273,7 +273,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add capability to generate compiled method events */ @@ -302,11 +302,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { NSK_DISPLAY0("setting event callbacks done\nenabling JVMTI events ...\n"); if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, - NULL))) + nullptr))) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, - NULL))) + nullptr))) return JNI_ERR; NSK_DISPLAY0("enabling the events done\n\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe001/popframe001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe001/popframe001.cpp index 4d3332c20796..9b8381e9dcb7 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe001/popframe001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe001/popframe001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define STATUS_FAILED 2 #define PASSED 0 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; static int watch_ev = 0; /* ignore JVMTI events by default */ @@ -175,7 +175,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe002/popframe002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe002/popframe002.cpp index 429af71866a8..401a53d8026d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe002/popframe002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe002/popframe002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -102,12 +102,12 @@ Java_nsk_jvmti_PopFrame_popframe002_doPopFrame(JNIEnv *env, } switch (t_case) { - /* NULL pointer to the thread*/ + /* nullptr pointer to the thread*/ case 1: - printf("\nInvoke PopFrame() with NULL pointer to a thread...\n"); + printf("\nInvoke PopFrame() with null pointer to a thread...\n"); fflush(stdout); set_watch_ev(1); /* watch JVMTI events */ - err = (jvmti->PopFrame(NULL)); /* explode the bomb */ + err = (jvmti->PopFrame(nullptr)); /* explode the bomb */ if (err != JVMTI_ERROR_INVALID_THREAD) { printf("TEST FAILED: the function PopFrame() returned the error %d: %s\n", err, TranslateError(err)); @@ -193,7 +193,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe003/popframe003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe003/popframe003.cpp index f956c01f3aab..7d9726a2dbf7 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe003/popframe003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe003/popframe003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -177,7 +177,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe004/popframe004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe004/popframe004.cpp index 3c8f1743d0dd..642324f87b4f 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe004/popframe004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe004/popframe004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,9 +24,9 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" -#include "jvmti_common.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" +#include "jvmti_common.hpp" extern "C" { @@ -219,7 +219,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -286,10 +286,10 @@ Java_nsk_jvmti_PopFrame_popframe004_getResult(JNIEnv *env, jclass cls) { void nativeMeth2(JNIEnv *env, jobject obj, jobject frameThr) { jclass cls = env->GetObjectClass(frameThr); - jmethodID mid = NULL; + jmethodID mid = nullptr; mid = env->GetMethodID(cls, "activeMethod", "()V"); - if (mid == NULL) { + if (mid == nullptr) { printf("TEST FAILURE: nativeMeth2(): Unable to get method ID\n"); tot_result = STATUS_FAILED; return; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe005/popframe005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe005/popframe005.cpp index ca918df7575e..a4143f14e2a4 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe005/popframe005.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe005/popframe005.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,15 +24,15 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include -#include "JVMTITools.h" +#include "agent_common.hpp" +#include +#include "JVMTITools.hpp" extern "C" { // Deallocate memory region allocated by VM #define DEALLOCATE(p) \ - if (p != NULL) \ + if (p != nullptr) \ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate(p))) \ { \ NSK_COMPLAIN0("Failed to deallocate: ##p##\n"); \ @@ -106,12 +106,12 @@ MethodExit( break; } - if (!NSK_JVMTI_VERIFY(jvmti->GetClassSignature(klass, &class_signature, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->GetClassSignature(klass, &class_signature, nullptr))) { break; } - if (!NSK_JVMTI_VERIFY(jvmti->GetMethodName(method, &entry_name, &entry_sig, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->GetMethodName(method, &entry_name, &entry_sig, nullptr))) { break; } @@ -119,7 +119,7 @@ MethodExit( failure = 0; NSK_COMPLAIN5("#### MethodExit event occurred: (tid: %d), thread: %s, %s %s %s\n" , thread - , thr_info.name == NULL ? "" : thr_info.name + , thr_info.name == nullptr ? "" : thr_info.name , class_signature , entry_name , entry_sig @@ -254,7 +254,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) } if (!NSK_VERIFY( - (jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved)) != NULL + (jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved)) != nullptr )) { return JNI_ERR; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe006/popframe006.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe006/popframe006.cpp index 2c288f29d945..154e70e3c164 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe006/popframe006.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe006/popframe006.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -40,7 +40,7 @@ typedef struct { jlocation loc; } check_info; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; static jint result = PASSED; @@ -109,17 +109,17 @@ void check(jvmtiEnv *jvmti_env, jmethodID mid, jlocation loc, int i) { return; } - if (sigClass == NULL || strcmp(sigClass, checks[i].cls) != 0) { + if (sigClass == nullptr || strcmp(sigClass, checks[i].cls) != 0) { printf("(%s, %d) wrong class sig: \"%s\",\n", note, i, sigClass); printf(" expected: \"%s\"\n", checks[i].cls); result = STATUS_FAILED; } - if (name == NULL || strcmp(name, checks[i].name) != 0) { + if (name == nullptr || strcmp(name, checks[i].name) != 0) { printf("(%s, %d) wrong method name: \"%s\",", note, i, name); printf(" expected: \"%s\"\n", checks[i].name); result = STATUS_FAILED; } - if (sig == NULL || strcmp(sig, checks[i].sig) != 0) { + if (sig == nullptr || strcmp(sig, checks[i].sig) != 0) { printf("(%s, %d) wrong method sig: \"%s\",", note, i, sig); printf(" expected: \"%s\"\n", checks[i].sig); result = STATUS_FAILED; @@ -349,12 +349,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -409,7 +409,7 @@ Java_nsk_jvmti_PopFrame_popframe006_getReady(JNIEnv *env, jvmtiError err; jclass clazz; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; @@ -424,35 +424,35 @@ Java_nsk_jvmti_PopFrame_popframe006_getReady(JNIEnv *env, } clazz = env->GetObjectClass(thr); - if (clazz == NULL) { + if (clazz == nullptr) { printf("Cannot get the class of thread object\n"); result = STATUS_FAILED; return; } mid_run = env->GetMethodID(clazz, "run", "()V"); - if (mid_run == NULL) { + if (mid_run == nullptr) { printf("Cannot find Method ID for method \"run\"\n"); result = STATUS_FAILED; return; } mid_A = env->GetStaticMethodID(clazz, "A", "()V"); - if (mid_A == NULL) { + if (mid_A == nullptr) { printf("Cannot find Method ID for method \"A\"\n"); result = STATUS_FAILED; return; } mid_B = env->GetStaticMethodID(clazz, "B", "()V"); - if (mid_B == NULL) { + if (mid_B == nullptr) { printf("Cannot find Method ID for method \"B\"\n"); result = STATUS_FAILED; return; } mid_C = env->GetStaticMethodID(clazz, "C", "()V"); - if (mid_C == NULL) { + if (mid_C == nullptr) { printf("Cannot find Method ID for method \"C\"\n"); result = STATUS_FAILED; return; @@ -467,7 +467,7 @@ Java_nsk_jvmti_PopFrame_popframe006_getReady(JNIEnv *env, } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_BREAKPOINT, NULL); + JVMTI_EVENT_BREAKPOINT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable BREAKPOINT event: %s (%d)\n", TranslateError(err), err); @@ -481,7 +481,7 @@ Java_nsk_jvmti_PopFrame_popframe006_getReady(JNIEnv *env, } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_FRAME_POP, NULL); + JVMTI_EVENT_FRAME_POP, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable FRAME_POP event: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe007/popframe007.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe007/popframe007.cpp index ca4b90045955..a2e9716a5138 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe007/popframe007.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe007/popframe007.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; static jint result = PASSED; @@ -86,12 +86,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -142,7 +142,7 @@ Java_nsk_jvmti_PopFrame_popframe007_getReady(JNIEnv *env, jvmtiError err; jclass clazz; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; @@ -153,14 +153,14 @@ Java_nsk_jvmti_PopFrame_popframe007_getReady(JNIEnv *env, } clazz = env->GetObjectClass(thr); - if (clazz == NULL) { + if (clazz == nullptr) { printf("Cannot get class of the thread object\n"); result = STATUS_FAILED; return; } mid = env->GetStaticMethodID(clazz, "C", "()V"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot find Method ID for method \"C\"\n"); result = STATUS_FAILED; return; @@ -175,7 +175,7 @@ Java_nsk_jvmti_PopFrame_popframe007_getReady(JNIEnv *env, } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_BREAKPOINT, NULL); + JVMTI_EVENT_BREAKPOINT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable BREAKPOINT event: %s (%d)\n", TranslateError(err), err); @@ -190,7 +190,7 @@ Java_nsk_jvmti_PopFrame_popframe007_getRes(JNIEnv *env, jclass cls) { JNIEXPORT void JNICALL Java_nsk_jvmti_PopFrame_popframe007_B(JNIEnv *env, jclass cls) { - if (mid != NULL) { + if (mid != nullptr) { env->CallStaticVoidMethod(cls, mid); } } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe008/popframe008.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe008/popframe008.cpp index 8c669c203183..209cd2be05e8 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe008/popframe008.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe008/popframe008.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -40,13 +40,13 @@ typedef struct { jlocation loc; } frame_info; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; static jint result = PASSED; static jboolean printdump = JNI_FALSE; -static jmethodID midD = NULL; -static jmethodID midRun = NULL; +static jmethodID midD = nullptr; +static jmethodID midRun = nullptr; static int framesExpected = 0; static int framesCount = 0; static frame_info frames[] = { @@ -83,17 +83,17 @@ void check(jvmtiEnv *jvmti_env, jmethodID mid, jlocation loc, int i) { result = STATUS_FAILED; } - if (sigClass == NULL || strcmp(sigClass, frames[i].cls) != 0) { + if (sigClass == nullptr || strcmp(sigClass, frames[i].cls) != 0) { printf("(%d) wrong class sig: \"%s\",\n", i, sigClass); printf(" expected: \"%s\"\n", frames[i].cls); result = STATUS_FAILED; } - if (name == NULL || strcmp(name, frames[i].name) != 0) { + if (name == nullptr || strcmp(name, frames[i].name) != 0) { printf("(%d) wrong method name: \"%s\",", i, name); printf(" expected: \"%s\"\n", frames[i].name); result = STATUS_FAILED; } - if (sig == NULL || strcmp(sig, frames[i].sig) != 0) { + if (sig == nullptr || strcmp(sig, frames[i].sig) != 0) { printf("(%d) wrong method sig: \"%s\",", i, sig); printf(" expected: \"%s\"\n", frames[i].sig); result = STATUS_FAILED; @@ -195,12 +195,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -253,7 +253,7 @@ Java_nsk_jvmti_PopFrame_popframe008_getReady(JNIEnv *env, jvmtiError err; jclass clazz; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; @@ -266,21 +266,21 @@ Java_nsk_jvmti_PopFrame_popframe008_getReady(JNIEnv *env, } clazz = env->GetObjectClass(thr); - if (clazz == NULL) { + if (clazz == nullptr) { printf("Cannot get class of the thread object\n"); result = STATUS_FAILED; return; } midD = env->GetMethodID(clazz, "D", "()V"); - if (midD == NULL) { + if (midD == nullptr) { printf("Cannot get Method ID for method \"D\"\n"); result = STATUS_FAILED; return; } midRun = env->GetMethodID(clazz, "run", "()V"); - if (midRun == NULL) { + if (midRun == nullptr) { printf("Cannot get Method ID for method \"run\"\n"); result = STATUS_FAILED; return; @@ -295,7 +295,7 @@ Java_nsk_jvmti_PopFrame_popframe008_getReady(JNIEnv *env, } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_BREAKPOINT, NULL); + JVMTI_EVENT_BREAKPOINT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable BREAKPOINT event: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe009/popframe009.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe009/popframe009.cpp index 2e72d3858b3c..faa4318f140a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe009/popframe009.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe009/popframe009.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -34,17 +34,17 @@ extern "C" { #define STATUS_FAILED 2 #define WAIT_FOREVER ((jlong)(3600*1000)) -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; -static jrawMonitorID breakpointLock = NULL; -static jrawMonitorID popFrameLock = NULL; -static jrawMonitorID suspendLock = NULL; +static jrawMonitorID breakpointLock = nullptr; +static jrawMonitorID popFrameLock = nullptr; +static jrawMonitorID suspendLock = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; static jboolean popDone = JNI_FALSE; -static jmethodID midCheckPoint = NULL; -static jmethodID midRun = NULL; +static jmethodID midCheckPoint = nullptr; +static jmethodID midRun = nullptr; static int bpCount = 0; static int framesCount = 0; @@ -165,12 +165,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -225,7 +225,7 @@ JNIEXPORT void JNICALL Java_nsk_jvmti_PopFrame_popframe009_getReady(JNIEnv *env, jclass cls) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; @@ -238,7 +238,7 @@ Java_nsk_jvmti_PopFrame_popframe009_getReady(JNIEnv *env, jclass cls) { } midCheckPoint = env->GetStaticMethodID(cls, "checkPoint", "()V"); - if (midCheckPoint == NULL) { + if (midCheckPoint == nullptr) { printf("Cannot find Method ID for method checkPoint\n"); result = STATUS_FAILED; return; @@ -261,7 +261,7 @@ Java_nsk_jvmti_PopFrame_popframe009_getReady(JNIEnv *env, jclass cls) { } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_BREAKPOINT, NULL); + JVMTI_EVENT_BREAKPOINT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable BREAKPOINT event: %s (%d)\n", TranslateError(err), err); @@ -331,14 +331,14 @@ Java_nsk_jvmti_PopFrame_popframe009_check(JNIEnv *env, jclass cls, jthread thr) jvmtiError err; jmethodID midFibonacci; jclass clazz; - jmethodID method = NULL; + jmethodID method = nullptr; jlocation loc; char *name, *sig, *generic; jlong delayTime = 1; int popCount = 0; int i; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -412,19 +412,19 @@ Java_nsk_jvmti_PopFrame_popframe009_check(JNIEnv *env, jclass cls, jthread thr) } midFibonacci = env->GetStaticMethodID(cls, "fibonacci", "(I)I"); - if (midFibonacci == NULL) { + if (midFibonacci == nullptr) { printf("Cannot get method ID for method \"fibonacci\"\n"); result = STATUS_FAILED; } clazz = env->GetObjectClass(thr); - if (clazz == NULL) { + if (clazz == nullptr) { printf("Cannot get class of thread object\n"); return STATUS_FAILED; } midRun = env->GetMethodID(clazz, "run", "()V"); - if (midRun == NULL) { + if (midRun == nullptr) { printf("Cannot get method ID for \"run\"\n"); return STATUS_FAILED; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe010/popframe010.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe010/popframe010.cpp index c0b3f8924fd3..b9a8b431037b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe010/popframe010.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe010/popframe010.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,13 +33,13 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; static jint result = PASSED; static jboolean printdump = JNI_FALSE; -static jmethodID midCheckPoint = NULL; -static jmethodID midRun = NULL; +static jmethodID midCheckPoint = nullptr; +static jmethodID midRun = nullptr; static jint framesExpected = 0; static jint framesCount = 0; static const char *cls_exp = "Lnsk/jvmti/PopFrame/popframe010$TestThread;"; @@ -52,7 +52,7 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jmethodID mid, jlocation loc, jint jclass cls; jlocation loc_exp = (i == 0) ? 15 : 8; char *sigClass, *name, *sig, *generic; - jvmtiLocalVariableEntry *table = NULL; + jvmtiLocalVariableEntry *table = nullptr; jint entryCount = 0; jint argValue; jint j; @@ -85,7 +85,7 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jmethodID mid, jlocation loc, jint i, TranslateError(err), err); result = STATUS_FAILED; } - if (table != NULL) { + if (table != nullptr) { for (j = 0; j < entryCount; j++) { if (strcmp(table[j].name, argName) == 0) { err = jvmti_env->GetLocalInt(thr, 0, @@ -105,17 +105,17 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jmethodID mid, jlocation loc, jint printf(", arg value: %d\n", argValue); } - if (sigClass == NULL || strcmp(sigClass, cls_exp) != 0) { + if (sigClass == nullptr || strcmp(sigClass, cls_exp) != 0) { printf("(step %d) wrong class sig: \"%s\",\n", i, sigClass); printf(" expected: \"%s\"\n", cls_exp); result = STATUS_FAILED; } - if (name == NULL || strcmp(name, name_exp) != 0) { + if (name == nullptr || strcmp(name, name_exp) != 0) { printf("(step %d) wrong method name: \"%s\",", i, name); printf(" expected: \"%s\"\n", name_exp); result = STATUS_FAILED; } - if (sig == NULL || strcmp(sig, sig_exp) != 0) { + if (sig == nullptr || strcmp(sig, sig_exp) != 0) { printf("(step %d) wrong method sig: \"%s\",", i, sig); printf(" expected: \"%s\"\n", sig_exp); result = STATUS_FAILED; @@ -132,16 +132,16 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jmethodID mid, jlocation loc, jint result = STATUS_FAILED; } - if (sigClass != NULL) { + if (sigClass != nullptr) { jvmti_env->Deallocate((unsigned char*)sigClass); } - if (name != NULL) { + if (name != nullptr) { jvmti_env->Deallocate((unsigned char*)name); } - if (sig != NULL) { + if (sig != nullptr) { jvmti_env->Deallocate((unsigned char*)sig); } - if (table != NULL) { + if (table != nullptr) { for (j = 0; j < entryCount; j++) { jvmti_env->Deallocate((unsigned char*)(table[j].name)); jvmti_env->Deallocate((unsigned char*)(table[j].signature)); @@ -232,12 +232,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -288,7 +288,7 @@ JNIEXPORT void JNICALL Java_nsk_jvmti_PopFrame_popframe010_getReady(JNIEnv *env, jclass c, jclass cls, jint depth) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; @@ -301,14 +301,14 @@ Java_nsk_jvmti_PopFrame_popframe010_getReady(JNIEnv *env, jclass c, jclass cls, } midRun = env->GetMethodID(cls, "run", "()V"); - if (midRun == NULL) { + if (midRun == nullptr) { printf("Cannot find Method ID for method run\n"); result = STATUS_FAILED; return; } midCheckPoint = env->GetMethodID(cls, "checkPoint", "()V"); - if (midCheckPoint == NULL) { + if (midCheckPoint == nullptr) { printf("Cannot find Method ID for method checkPoint\n"); result = STATUS_FAILED; return; @@ -323,7 +323,7 @@ Java_nsk_jvmti_PopFrame_popframe010_getReady(JNIEnv *env, jclass c, jclass cls, } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_BREAKPOINT, NULL); + JVMTI_EVENT_BREAKPOINT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable BREAKPOINT event: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe011/popframe011.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe011/popframe011.cpp index 114f7cd1d71a..0a61c485a659 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe011/popframe011.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/PopFrame/popframe011/popframe011.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -111,15 +111,15 @@ Java_nsk_jvmti_PopFrame_popframe011_doPopFrame(JNIEnv *env, } switch (t_case) { -/* NULL pointer to the thread in debug mode */ +/* nullptr pointer to the thread in debug mode */ case 1: - printf("\nInvoke PopFrame() with NULL pointer to a thread...\n"); + printf("\nInvoke PopFrame() with null pointer to a thread...\n"); fflush(stdout); // fallthrough -/* NULL pointer to the thread */ +/* nullptr pointer to the thread */ case 0: set_watch_ev(1); /* watch JVMTI events */ - popframe_err = (jvmti->PopFrame(NULL)); /* explode the bomb */ + popframe_err = (jvmti->PopFrame(nullptr)); /* explode the bomb */ if (popframe_err != JVMTI_ERROR_INVALID_THREAD) { printf("TEST FAILED: the function PopFrame() returned the error %d: %s\n", popframe_err, TranslateError(popframe_err)); @@ -245,7 +245,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorEnter/rawmonenter001/rawmonenter001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorEnter/rawmonenter001/rawmonenter001.cpp index 337de1e3cc86..4f02bc3fa586 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorEnter/rawmonenter001/rawmonenter001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorEnter/rawmonenter001/rawmonenter001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -34,7 +34,7 @@ extern "C" { #define STATUS_FAILED 2 #define RAW_MONITORS_NUMBER 1024 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -102,12 +102,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -121,7 +121,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_VM_INIT, NULL); + JVMTI_EVENT_VM_INIT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable JVMTI_EVENT_VM_INIT: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorEnter/rawmonenter002/rawmonenter002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorEnter/rawmonenter002/rawmonenter002.cpp index 8588fa656361..3744dd9d4364 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorEnter/rawmonenter002/rawmonenter002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorEnter/rawmonenter002/rawmonenter002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_rawmonenter002(JavaVM *jvm, char *options, void *reser jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -68,7 +68,7 @@ JNIEXPORT jint JNICALL Java_nsk_jvmti_RawMonitorEnter_rawmonenter002_check(JNIEnv *env, jclass cls) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -77,7 +77,7 @@ Java_nsk_jvmti_RawMonitorEnter_rawmonenter002_check(JNIEnv *env, jclass cls) { printf(">>> invalid monitor check ...\n"); } - err = jvmti->RawMonitorEnter(NULL); + err = jvmti->RawMonitorEnter(nullptr); if (err != JVMTI_ERROR_INVALID_MONITOR) { printf("Error expected: JVMTI_ERROR_INVALID_MONITOR,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorEnter/rawmonenter003/rawmonenter003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorEnter/rawmonenter003/rawmonenter003.cpp index 984c73cb0f73..4ebdbf2eb925 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorEnter/rawmonenter003/rawmonenter003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorEnter/rawmonenter003/rawmonenter003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; static char bad_buf[] = "this is a bad raw monitor"; @@ -53,12 +53,12 @@ JNIEXPORT jint JNI_OnLoad_rawmonenter003(JavaVM *jvm, char *options, void *reser jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -70,7 +70,7 @@ JNIEXPORT jint JNICALL Java_nsk_jvmti_RawMonitorEnter_rawmonenter003_check(JNIEnv *env, jclass cls) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorEnter/rawmonenter004/rawmonenter004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorEnter/rawmonenter004/rawmonenter004.cpp index 2c9fdb8f2f0e..8fd60c131211 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorEnter/rawmonenter004/rawmonenter004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorEnter/rawmonenter004/rawmonenter004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -36,7 +36,7 @@ extern "C" { #define INCREMENT_LIMIT 1000 #define DELAY 100 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; static jrawMonitorID monitor; @@ -57,12 +57,12 @@ JNIEXPORT jint JNI_OnLoad_rawmonenter004(JavaVM *jvm, char *options, void *reser jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -104,7 +104,7 @@ Java_nsk_jvmti_RawMonitorEnter_rawmonenter004_check(JNIEnv *env, jclass cls, job jthread thr; jint wait_time = wtime * 60000; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -131,7 +131,7 @@ Java_nsk_jvmti_RawMonitorEnter_rawmonenter004_check(JNIEnv *env, jclass cls, job for (i = 0; i < threads_limit; i++) { thr = env->GetObjectArrayElement(threads, i); - err = jvmti->RunAgentThread(thr, increment_thread, NULL, + err = jvmti->RunAgentThread(thr, increment_thread, nullptr, JVMTI_THREAD_NORM_PRIORITY); if (err != JVMTI_ERROR_NONE) { printf("(RunDebugThread) unexpected error: %s (%d)\n", diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorExit/rawmonexit001/rawmonexit001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorExit/rawmonexit001/rawmonexit001.cpp index 6fcd8db139e2..50f4eeb44775 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorExit/rawmonexit001/rawmonexit001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorExit/rawmonexit001/rawmonexit001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -34,7 +34,7 @@ extern "C" { #define STATUS_FAILED 2 #define RAW_MONITORS_NUMBER 1024 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -115,12 +115,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -134,7 +134,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_VM_INIT, NULL); + JVMTI_EVENT_VM_INIT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable JVMTI_EVENT_VM_INIT: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorExit/rawmonexit002/rawmonexit002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorExit/rawmonexit002/rawmonexit002.cpp index b378bef82df9..12da226126f2 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorExit/rawmonexit002/rawmonexit002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorExit/rawmonexit002/rawmonexit002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_rawmonexit002(JavaVM *jvm, char *options, void *reserv jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -68,7 +68,7 @@ JNIEXPORT jint JNICALL Java_nsk_jvmti_RawMonitorExit_rawmonexit002_check(JNIEnv *env, jclass cls) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -77,7 +77,7 @@ Java_nsk_jvmti_RawMonitorExit_rawmonexit002_check(JNIEnv *env, jclass cls) { printf(">>> invalid monitor check ...\n"); } - err = jvmti->RawMonitorExit(NULL); + err = jvmti->RawMonitorExit(nullptr); if (err != JVMTI_ERROR_INVALID_MONITOR) { printf("Error expected: JVMTI_ERROR_INVALID_MONITOR,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorExit/rawmonexit003/rawmonexit003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorExit/rawmonexit003/rawmonexit003.cpp index 2c9a1847c3b4..70f1f8f2db10 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorExit/rawmonexit003/rawmonexit003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorExit/rawmonexit003/rawmonexit003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; static char bad_buf[] = "this is a bad raw monitor"; @@ -53,12 +53,12 @@ JNIEXPORT jint JNI_OnLoad_rawmonexit003(JavaVM *jvm, char *options, void *reserv jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -70,7 +70,7 @@ JNIEXPORT jint JNICALL Java_nsk_jvmti_RawMonitorExit_rawmonexit003_check(JNIEnv *env, jclass cls) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorExit/rawmonexit005/rawmonexit005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorExit/rawmonexit005/rawmonexit005.cpp index 58c60ca15610..fd056d74efa6 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorExit/rawmonexit005/rawmonexit005.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorExit/rawmonexit005/rawmonexit005.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_rawmonexit005(JavaVM *jvm, char *options, void *reserv jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -69,7 +69,7 @@ Java_nsk_jvmti_RawMonitorExit_rawmonexit005_check(JNIEnv *env, jclass cls) { jvmtiError err; jrawMonitorID monitor; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotify/rawmnntfy001/rawmnntfy001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotify/rawmnntfy001/rawmnntfy001.cpp index f0824faf11c5..e727177607eb 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotify/rawmnntfy001/rawmnntfy001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotify/rawmnntfy001/rawmnntfy001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -34,7 +34,7 @@ extern "C" { #define STATUS_FAILED 2 #define RAW_MONITORS_NUMBER 1024 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -128,12 +128,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -147,7 +147,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_VM_INIT, NULL); + JVMTI_EVENT_VM_INIT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable JVMTI_EVENT_VM_INIT: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotify/rawmnntfy002/rawmnntfy002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotify/rawmnntfy002/rawmnntfy002.cpp index a06fd549572a..f5a5ff41f05c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotify/rawmnntfy002/rawmnntfy002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotify/rawmnntfy002/rawmnntfy002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_rawmnntfy002(JavaVM *jvm, char *options, void *reserve jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -68,7 +68,7 @@ JNIEXPORT jint JNICALL Java_nsk_jvmti_RawMonitorNotify_rawmnntfy002_check(JNIEnv *env, jclass cls) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -77,7 +77,7 @@ Java_nsk_jvmti_RawMonitorNotify_rawmnntfy002_check(JNIEnv *env, jclass cls) { printf(">>> invalid monitor check ...\n"); } - err = jvmti->RawMonitorNotify(NULL); + err = jvmti->RawMonitorNotify(nullptr); if (err != JVMTI_ERROR_INVALID_MONITOR) { printf("Error expected: JVMTI_ERROR_INVALID_MONITOR,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotify/rawmnntfy003/rawmnntfy003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotify/rawmnntfy003/rawmnntfy003.cpp index 0250ed50ae74..65258a6811b4 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotify/rawmnntfy003/rawmnntfy003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotify/rawmnntfy003/rawmnntfy003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; static char bad_buf[] = "this is a bad raw monitor"; @@ -53,12 +53,12 @@ JNIEXPORT jint JNI_OnLoad_rawmnntfy003(JavaVM *jvm, char *options, void *reserve jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -70,7 +70,7 @@ JNIEXPORT jint JNICALL Java_nsk_jvmti_RawMonitorNotify_rawmnntfy003_check(JNIEnv *env, jclass cls) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotify/rawmnntfy004/rawmnntfy004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotify/rawmnntfy004/rawmnntfy004.cpp index 5e2100004075..822fd63dfb66 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotify/rawmnntfy004/rawmnntfy004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotify/rawmnntfy004/rawmnntfy004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_rawmnntfy004(JavaVM *jvm, char *options, void *reserve jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -69,7 +69,7 @@ Java_nsk_jvmti_RawMonitorNotify_rawmnntfy004_check(JNIEnv *env, jclass cls) { jvmtiError err; jrawMonitorID monitor; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotifyAll/rawmnntfyall001/rawmnntfyall001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotifyAll/rawmnntfyall001/rawmnntfyall001.cpp index c669763560d3..0415de825f90 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotifyAll/rawmnntfyall001/rawmnntfyall001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotifyAll/rawmnntfyall001/rawmnntfyall001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -34,7 +34,7 @@ extern "C" { #define STATUS_FAILED 2 #define RAW_MONITORS_NUMBER 1024 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -128,12 +128,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -147,7 +147,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_VM_INIT, NULL); + JVMTI_EVENT_VM_INIT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable JVMTI_EVENT_VM_INIT: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotifyAll/rawmnntfyall002/rawmnntfyall002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotifyAll/rawmnntfyall002/rawmnntfyall002.cpp index 6801be39731b..7da2cd425455 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotifyAll/rawmnntfyall002/rawmnntfyall002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotifyAll/rawmnntfyall002/rawmnntfyall002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_rawmnntfyall002(JavaVM *jvm, char *options, void *rese jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -68,7 +68,7 @@ JNIEXPORT jint JNICALL Java_nsk_jvmti_RawMonitorNotifyAll_rawmnntfyall002_check(JNIEnv *env, jclass cls) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -77,7 +77,7 @@ Java_nsk_jvmti_RawMonitorNotifyAll_rawmnntfyall002_check(JNIEnv *env, jclass cls printf(">>> invalid monitor check ...\n"); } - err = jvmti->RawMonitorNotifyAll(NULL); + err = jvmti->RawMonitorNotifyAll(nullptr); if (err != JVMTI_ERROR_INVALID_MONITOR) { printf("Error expected: JVMTI_ERROR_INVALID_MONITOR,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotifyAll/rawmnntfyall003/rawmnntfyall003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotifyAll/rawmnntfyall003/rawmnntfyall003.cpp index b5bfb6763858..01f5810b3a7c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotifyAll/rawmnntfyall003/rawmnntfyall003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotifyAll/rawmnntfyall003/rawmnntfyall003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; static char bad_buf[] = "this is a bad raw monitor"; @@ -53,12 +53,12 @@ JNIEXPORT jint JNI_OnLoad_rawmnntfyall003(JavaVM *jvm, char *options, void *rese jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -70,7 +70,7 @@ JNIEXPORT jint JNICALL Java_nsk_jvmti_RawMonitorNotifyAll_rawmnntfyall003_check(JNIEnv *env, jclass cls) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotifyAll/rawmnntfyall004/rawmnntfyall004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotifyAll/rawmnntfyall004/rawmnntfyall004.cpp index 96c0a2545d7d..4cce57edcf81 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotifyAll/rawmnntfyall004/rawmnntfyall004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorNotifyAll/rawmnntfyall004/rawmnntfyall004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_rawmnntfyall004(JavaVM *jvm, char *options, void *rese jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -69,7 +69,7 @@ Java_nsk_jvmti_RawMonitorNotifyAll_rawmnntfyall004_check(JNIEnv *env, jclass cls jvmtiError err; jrawMonitorID monitor; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait001/rawmnwait001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait001/rawmnwait001.cpp index 155e4e7e513d..05237468940d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait001/rawmnwait001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait001/rawmnwait001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -35,7 +35,7 @@ extern "C" { #define RAW_MONITORS_NUMBER 1024 #define MONITOR_WAIT_TIMEOUT ((jlong)10) -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -129,12 +129,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -148,7 +148,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_VM_INIT, NULL); + JVMTI_EVENT_VM_INIT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable JVMTI_EVENT_VM_INIT: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait002/rawmnwait002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait002/rawmnwait002.cpp index 2b2ad239c162..37a206965e18 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait002/rawmnwait002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait002/rawmnwait002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -34,7 +34,7 @@ extern "C" { #define STATUS_FAILED 2 #define MONITOR_WAIT_TIMEOUT ((jlong)100) -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -52,12 +52,12 @@ JNIEXPORT jint JNI_OnLoad_rawmnwait002(JavaVM *jvm, char *options, void *reserve jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -69,7 +69,7 @@ JNIEXPORT jint JNICALL Java_nsk_jvmti_RawMonitorWait_rawmnwait002_check(JNIEnv *env, jclass cls) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -78,7 +78,7 @@ Java_nsk_jvmti_RawMonitorWait_rawmnwait002_check(JNIEnv *env, jclass cls) { printf(">>> invalid monitor check ...\n"); } - err = jvmti->RawMonitorWait(NULL, MONITOR_WAIT_TIMEOUT); + err = jvmti->RawMonitorWait(nullptr, MONITOR_WAIT_TIMEOUT); if (err != JVMTI_ERROR_INVALID_MONITOR) { printf("Error expected: JVMTI_ERROR_INVALID_MONITOR,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait003/rawmnwait003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait003/rawmnwait003.cpp index c4d307dbcc7c..e81e7266d232 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait003/rawmnwait003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait003/rawmnwait003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -34,7 +34,7 @@ extern "C" { #define STATUS_FAILED 2 #define MONITOR_WAIT_TIMEOUT ((jlong)100) -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; static char bad_buf[] = "this is a bad raw monitor"; @@ -54,12 +54,12 @@ JNIEXPORT jint JNI_OnLoad_rawmnwait003(JavaVM *jvm, char *options, void *reserve jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -71,7 +71,7 @@ JNIEXPORT jint JNICALL Java_nsk_jvmti_RawMonitorWait_rawmnwait003_check(JNIEnv *env, jclass cls) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait004/rawmnwait004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait004/rawmnwait004.cpp index e1e7db5c7b87..76f273821232 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait004/rawmnwait004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait004/rawmnwait004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -34,7 +34,7 @@ extern "C" { #define STATUS_FAILED 2 #define MONITOR_WAIT_TIMEOUT ((jlong)100) -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -52,12 +52,12 @@ JNIEXPORT jint JNI_OnLoad_rawmnwait004(JavaVM *jvm, char *options, void *reserve jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -70,7 +70,7 @@ Java_nsk_jvmti_RawMonitorWait_rawmnwait004_check(JNIEnv *env, jclass cls) { jvmtiError err; jrawMonitorID monitor; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait005/rawmnwait005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait005/rawmnwait005.cpp index ba861bd9757f..b09490f3fa64 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait005/rawmnwait005.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RawMonitorWait/rawmnwait005/rawmnwait005.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -34,7 +34,7 @@ extern "C" { #define STATUS_FAILED 2 #define MILLIS_PER_MINUTE (60 * 1000) -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_TRUE; @@ -57,12 +57,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -206,7 +206,7 @@ Java_nsk_jvmti_RawMonitorWait_rawmnwait005_check(JNIEnv *env, wait_time = wtime * MILLIS_PER_MINUTE; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -261,7 +261,7 @@ Java_nsk_jvmti_RawMonitorWait_rawmnwait005_check(JNIEnv *env, // before we terminate - else the test will end before it checks // it was interrupted! - err = jvmti->RunAgentThread(thr, test_thread, NULL, + err = jvmti->RunAgentThread(thr, test_thread, nullptr, JVMTI_THREAD_NORM_PRIORITY); if (err != JVMTI_ERROR_NONE) { printf("(RunDebugThread) unexpected error: %s (%d)\n", diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/StressRedefine.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/StressRedefine.java index 1192de03f880..d581cd5693b5 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/StressRedefine.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/StressRedefine.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,6 @@ * questions. */ -//package nsk.jvmti.RedefineClasses.StressRedefine; package nsk.jvmti.RedefineClasses; @@ -41,7 +40,7 @@ import nsk.share.test.Stresser; import nsk.share.test.Tests; -import vm.share.InMemoryJavaCompiler; +import jdk.test.lib.compiler.InMemoryJavaCompiler; /** * There is a data structure named "dictionary" in class BlockFreelist. It stores @@ -203,9 +202,7 @@ private static ThreadFactory virtualThreadFactory() { } private static byte[] generateAndCompile() { - Map sources = new HashMap(); - sources.put(GenerateSourceHelper.CLASS_NAME, GenerateSourceHelper.generateSource()); - return InMemoryJavaCompiler.compile(sources).values().iterator().next(); + return InMemoryJavaCompiler.compile(GenerateSourceHelper.CLASS_NAME, GenerateSourceHelper.generateSource()); } // Auxiliary classloader. Used only once at the beginning. diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/StressRedefine/stressRedefine.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/StressRedefine/stressRedefine.cpp index e186ee1be6a9..0d407dee86c5 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/StressRedefine/stressRedefine.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/StressRedefine/stressRedefine.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define STATUS_FAILED 2 #define PASSED 0 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { @@ -80,7 +80,7 @@ Java_nsk_jvmti_RedefineClasses_StressRedefine_makeRedefinition(JNIEnv *env, jvmtiClassDefinition classDef; jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -92,7 +92,7 @@ Java_nsk_jvmti_RedefineClasses_StressRedefine_makeRedefinition(JNIEnv *env, /* filling the structure jvmtiClassDefinition */ classDef.klass = redefCls; classDef.class_byte_count = env->GetArrayLength(classBytes); - classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(classBytes, NULL); + classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(classBytes, nullptr); if (fl == 2) { printf(">>>>>>>> Invoke RedefineClasses():\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass001/redefclass001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass001/redefclass001.cpp index 0bf04741b57b..54f3d4567849 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass001/redefclass001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass001/redefclass001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define STATUS_FAILED 2 #define PASSED 0 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; #ifdef STATIC_BUILD @@ -91,7 +91,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass001_makeRedefinition(JNIEnv *env, jvmtiClassDefinition classDef; jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -103,7 +103,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass001_makeRedefinition(JNIEnv *env, /* filling the structure jvmtiClassDefinition */ classDef.klass = redefCls; classDef.class_byte_count = env->GetArrayLength(classBytes); - classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(classBytes, NULL); + classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(classBytes, nullptr); if (fl == 2) { printf(">>>>>>>> Invoke RedefineClasses():\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass002/redefclass002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass002/redefclass002.cpp index 2ad16a006bb3..e709de40e0df 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass002/redefclass002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass002/redefclass002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define STATUS_FAILED 2 #define PASSED 0 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; #ifdef STATIC_BUILD @@ -133,7 +133,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass002_makeRedefinition(JNIEnv *env, jclas jvmtiClassDefinition classDef; jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -145,7 +145,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass002_makeRedefinition(JNIEnv *env, jclas /* filling the structure jvmtiClassDefinition */ classDef.klass = redefCls; classDef.class_byte_count = env->GetArrayLength(classBytes); - classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(classBytes, NULL); + classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(classBytes, nullptr); if (vrb == 1) printf(">>>>>>>> Invoke RedefineClasses():\n\tnew class byte count=%d\n", diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass003/redefclass003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass003/redefclass003.cpp index 77fbacb64cd0..d45bea4d043b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass003/redefclass003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass003/redefclass003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,9 +24,9 @@ #include #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -35,7 +35,7 @@ extern "C" { #define PASSED 0 #define NO_RESULTS 3 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; #ifdef STATIC_BUILD @@ -94,7 +94,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass003_makeRedefinition(JNIEnv *env, jclas jvmtiClassDefinition classDef; int no_results = 0; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -106,7 +106,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass003_makeRedefinition(JNIEnv *env, jclas /* filling the structure jvmtiClassDefinition */ classDef.klass = redefCls; classDef.class_byte_count = env->GetArrayLength(classBytes); - classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(classBytes, NULL); + classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(classBytes, nullptr); if (vrb == 1) printf(">>>>>>>> Invoke RedefineClasses():\n\tnew class byte count=%d\n", @@ -140,7 +140,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass003_checkNewFields(JNIEnv *env, jlong longFld; fid = env->GetStaticFieldID(redefCls, "intComplNewFld", "I"); - if (fid == NULL) { + if (fid == nullptr) { printf("%s: Failed to get the field ID for the static field \"intComplNewFld\"\n", __FILE__); return STATUS_FAILED; @@ -148,7 +148,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass003_checkNewFields(JNIEnv *env, intFld = env->GetStaticIntField(redefCls, fid); fid = env->GetStaticFieldID(redefCls, "longComplNewFld", "J"); - if (fid == NULL) { + if (fid == nullptr) { printf("%s: Failed to get the field ID for the static field \"longComplNewFld\"\n", __FILE__); return STATUS_FAILED; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass004/redefclass004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass004/redefclass004.cpp index baef48d901e7..c19fd9113eb2 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass004/redefclass004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass004/redefclass004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,9 +24,9 @@ #include #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -40,7 +40,7 @@ static jint INTFLD = 333; static jlong LONGFLD = 444; #define STRFLD "completely new String field" -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; #ifdef STATIC_BUILD @@ -99,7 +99,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass004_makeRedefinition(JNIEnv *env, jvmtiClassDefinition classDef; int no_results = 0; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -111,7 +111,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass004_makeRedefinition(JNIEnv *env, /* fill the structure jvmtiClassDefinition */ classDef.klass = redefCls; classDef.class_byte_count = env->GetArrayLength(classBytes); - classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(classBytes, NULL); + classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(classBytes, nullptr); if (vrb == 1) printf(">>>>>>>> Invoke RedefineClasses():\n\tnew class byte count=%d\n", @@ -146,11 +146,11 @@ Java_nsk_jvmti_RedefineClasses_redefclass004_checkNewFields(JNIEnv *env, jint intFld; jlong longFld; jstring stringObj; - const char *strFld = NULL; + const char *strFld = nullptr; /* get value of new instance field "intComplNewFld" */ fid = env->GetFieldID(redefCls, "intComplNewFld", "I"); - if (fid == NULL) { + if (fid == nullptr) { printf("%s: Failed to get the field ID for the field \"intComplNewFld\"\n", __FILE__); return STATUS_FAILED; @@ -159,7 +159,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass004_checkNewFields(JNIEnv *env, /* get value of new instance field "longComplNewFld" */ fid = env->GetFieldID(redefCls, "longComplNewFld", "J"); - if (fid == NULL) { + if (fid == nullptr) { printf("%s: Failed to get the field ID for the field \"longComplNewFld\"\n", __FILE__); return STATUS_FAILED; @@ -168,7 +168,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass004_checkNewFields(JNIEnv *env, /* get value of new instance field "stringComplNewFld" */ fid = env->GetFieldID(redefCls, "stringComplNewFld", "Ljava/lang/String;"); - if (fid == NULL) { + if (fid == nullptr) { printf("%s: Failed to get the field ID for the field \"stringComplNewFld\"\n", __FILE__); return STATUS_FAILED; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass005/redefclass005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass005/redefclass005.cpp index 6e932a9551f6..86af7ae9a589 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass005/redefclass005.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass005/redefclass005.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define STATUS_FAILED 2 #define PASSED 0 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; static int watch_ev = 0; /* ignore JVMTI events by default */ @@ -59,7 +59,7 @@ ClassFileLoadHook(jvmtiEnv *jvmti_env, JNIEnv *env, jclass class_being_redefined jvmti->RawMonitorEnter(watch_ev_monitor); - if (watch_ev && class_being_redefined != NULL) { + if (watch_ev && class_being_redefined != nullptr) { printf("#### JVMTI_EVENT_CLASS_FILE_LOAD_HOOK occurred ####\n"); CFLH_gen_ev++; } @@ -164,7 +164,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass005_makeRedefinition(JNIEnv *env, jthread thread; jvmtiClassDefinition classDef; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -180,7 +180,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass005_makeRedefinition(JNIEnv *env, return STATUS_FAILED; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable event JVMTI_EVENT_CLASS_FILE_LOAD_HOOK: %s (%d)\n", TranslateError(err), err); @@ -202,7 +202,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass005_makeRedefinition(JNIEnv *env, /* filling the structure jvmtiClassDefinition */ classDef.klass = redefCls; classDef.class_byte_count = env->GetArrayLength(classBytes); - classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(classBytes, NULL); + classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(classBytes, nullptr); set_watch_ev(1); /* watch JVMTI events */ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass006/redefclass006.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass006/redefclass006.cpp index 7f140b731821..57f12dc83fcc 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass006/redefclass006.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass006/redefclass006.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define STATUS_FAILED 2 #define PASSED 0 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; #ifdef STATIC_BUILD @@ -90,9 +90,9 @@ Java_nsk_jvmti_RedefineClasses_redefclass006_makeRedefinition(JNIEnv *env, jclass cls, jint t_case, jclass redefCls, jbyteArray classBytes) { jvmtiError err; jvmtiClassDefinition classDef; - jvmtiClassDefinition* classDefPtr = NULL; + jvmtiClassDefinition* classDefPtr = nullptr; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -102,25 +102,25 @@ Java_nsk_jvmti_RedefineClasses_redefclass006_makeRedefinition(JNIEnv *env, } switch (t_case) { -/* NULL pointer to the jvmtiClassDefinition */ +/* nullptr pointer to the jvmtiClassDefinition */ case 0: break; -/* NULL pointer to the jvmtiClassDefinition in debug mode */ +/* nullptr pointer to the jvmtiClassDefinition in debug mode */ case 1: - printf("Invoke RedefineClasses() with NULL pointer to the structure jvmtiClassDefinition\n"); + printf("Invoke RedefineClasses() with null pointer to the structure jvmtiClassDefinition\n"); fflush(stdout); break; -/* NULL pointer to the jvmtiClassDefinition->class_bytes in debug mode */ +/* nullptr pointer to the jvmtiClassDefinition->class_bytes in debug mode */ case 3: - printf("Invoke RedefineClasses() with NULL pointer to the field jvmtiClassDefinition->class_bytes\n"); + printf("Invoke RedefineClasses() with null pointer to the field jvmtiClassDefinition->class_bytes\n"); fflush(stdout); // fallthrough -/* NULL pointer to the jvmtiClassDefinition->class_bytes */ +/* nullptr pointer to the jvmtiClassDefinition->class_bytes */ case 2: /* partly fill the structure jvmtiClassDefinition */ classDef.klass = redefCls; classDef.class_byte_count = env->GetArrayLength(classBytes); - classDef.class_bytes = NULL; + classDef.class_bytes = nullptr; classDefPtr = &classDef; break; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass008/redefclass008.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass008/redefclass008.cpp index a5ac03291abe..565b3a02f008 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass008/redefclass008.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass008/redefclass008.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -45,16 +45,16 @@ typedef struct { /* list of breakpoints */ static breakpoint breakpoints[] = { - { 1, (char*) "checkIt", (char*) "(Ljava/io/PrintStream;Z)I", 0, NULL }, - { 1, (char*) "finMethod", (char*) "(JIJ)V", 5, NULL }, - { 1, (char*) "finMethod", (char*) "(JIJ)V", 4, NULL }, - { 1, (char*) "checkIt", (char*) "(Ljava/io/PrintStream;Z)I", 1, NULL }, - { 0, (char*) "statMethod", (char*) "(III)I", 1, NULL } + { 1, (char*) "checkIt", (char*) "(Ljava/io/PrintStream;Z)I", 0, nullptr }, + { 1, (char*) "finMethod", (char*) "(JIJ)V", 5, nullptr }, + { 1, (char*) "finMethod", (char*) "(JIJ)V", 4, nullptr }, + { 1, (char*) "checkIt", (char*) "(Ljava/io/PrintStream;Z)I", 1, nullptr }, + { 0, (char*) "statMethod", (char*) "(III)I", 1, nullptr } }; static jclass redefCls; /* JNI's Java class object */ -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; @@ -141,7 +141,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass008_setBreakpoints(JNIEnv *env, if (breakpoints[i].inst) { /* an instance method */ breakpoints[i].mid = env->GetMethodID( redefCls, breakpoints[i].m_name, breakpoints[i].m_sign); - if (breakpoints[i].mid == NULL) { + if (breakpoints[i].mid == nullptr) { printf( "%s: Failed to get the method ID for the instance method \"%s\" with signature \"%s\"\n", __FILE__, breakpoints[i].m_name, breakpoints[i].m_sign); @@ -150,7 +150,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass008_setBreakpoints(JNIEnv *env, } else { /* a static method */ breakpoints[i].mid = env->GetStaticMethodID( redefCls, breakpoints[i].m_name, breakpoints[i].m_sign); - if (breakpoints[i].mid == NULL) { + if (breakpoints[i].mid == nullptr) { printf( "%s: Failed to get the method ID for the static method \"%s\" with signature \"%s\"\n", __FILE__, breakpoints[i].m_name, breakpoints[i].m_sign); @@ -174,7 +174,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass008_setBreakpoints(JNIEnv *env, return STATUS_FAILED; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable BREAKPOINT event: %s (%d)\n", TranslateError(err), err); @@ -193,7 +193,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass008_makeRedefinition(JNIEnv *env, jvmtiError err; jvmtiClassDefinition classDef; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -205,7 +205,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass008_makeRedefinition(JNIEnv *env, /* fill the structure jvmtiClassDefinition */ classDef.klass = redefCls; classDef.class_byte_count = env->GetArrayLength(classBytes); - classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(classBytes, NULL); + classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(classBytes, nullptr); if (vrb == 1) printf(">>>>>>>> Invoke RedefineClasses():\n\tnew class byte count=%d\n", @@ -243,7 +243,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass008_getResult(JNIEnv *env, if (breakpoints[i].inst) { /* an instance method */ breakpoints[i].mid = env->GetMethodID( redefCls, breakpoints[i].m_name, breakpoints[i].m_sign); - if (breakpoints[i].mid == NULL) { + if (breakpoints[i].mid == nullptr) { printf( "%s: getResult: Failed to get the method ID for the instance method" "\"%s\" with signature \"%s\"\n", @@ -253,7 +253,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass008_getResult(JNIEnv *env, } else { /* a static method */ breakpoints[i].mid = env->GetStaticMethodID( redefCls, breakpoints[i].m_name, breakpoints[i].m_sign); - if (breakpoints[i].mid == NULL) { + if (breakpoints[i].mid == nullptr) { printf( "%s: getResult: Failed to get the method ID for the static method" "\"%s\" with signature \"%s\"\n", diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass009/redefclass009.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass009/redefclass009.cpp index b324acf12fd7..8c03608f480a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass009/redefclass009.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass009/redefclass009.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -80,23 +80,23 @@ typedef struct { /* local variables of a method */ jmethodID mid; /* JNI's method ID */ } methInfo; -/* list of original methods with NULL pointers to localVar */ +/* list of original methods with nullptr pointers to localVar */ static methInfo origMethInfo[] = { - { 1, (char*) "", (char*) "()V", 1, NULL, NULL }, - { 1, (char*) "checkIt", (char*) "(Ljava/io/PrintStream;Z)I", 4, NULL, NULL }, - { 1, (char*) "finMethod", (char*) "(CJIJ)V", 5, NULL, NULL }, - { 0, (char*) "statMethod", (char*) "(III)D", 3, NULL, NULL } + { 1, (char*) "", (char*) "()V", 1, nullptr, nullptr }, + { 1, (char*) "checkIt", (char*) "(Ljava/io/PrintStream;Z)I", 4, nullptr, nullptr }, + { 1, (char*) "finMethod", (char*) "(CJIJ)V", 5, nullptr, nullptr }, + { 0, (char*) "statMethod", (char*) "(III)D", 3, nullptr, nullptr } }; /* list of redefined methods */ static methInfo redefMethInfo[] = { - { 1, (char*) "", (char*) "()V", 6, constr_lv, NULL }, - { 1, (char*) "checkIt", (char*) "(Ljava/io/PrintStream;Z)I", 3, checkIt_lv, NULL }, - { 1, (char*) "finMethod", (char*) "(CJIJ)V", 7, finMeth_lv, NULL }, - { 0, (char*) "statMethod", (char*) "(III)D", 5, statMeth_lv, NULL } + { 1, (char*) "", (char*) "()V", 6, constr_lv, nullptr }, + { 1, (char*) "checkIt", (char*) "(Ljava/io/PrintStream;Z)I", 3, checkIt_lv, nullptr }, + { 1, (char*) "finMethod", (char*) "(CJIJ)V", 7, finMeth_lv, nullptr }, + { 0, (char*) "statMethod", (char*) "(III)D", 5, statMeth_lv, nullptr } }; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; #ifdef STATIC_BUILD @@ -174,7 +174,7 @@ int checkAttr(JNIEnv *env, jclass redefCls, methInfo methodsInfo[], methodsInfo[i].mid = env->GetStaticMethodID(redefCls, methodsInfo[i].m_name, methodsInfo[i].m_sign); } - if (methodsInfo[i].mid == NULL) { + if (methodsInfo[i].mid == nullptr) { printf("%s: Failed to get the method ID for the%s%s method \"%s\", signature \"%s\"\n", __FILE__, full ? " " : " original ", methodsInfo[i].inst ? "instance":"static", methodsInfo[i].m_name, methodsInfo[i].m_sign); @@ -250,7 +250,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass009_makeRedefinition(JNIEnv *env, jvmtiError err; jvmtiClassDefinition classDef; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -262,7 +262,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass009_makeRedefinition(JNIEnv *env, /* fill the structure jvmtiClassDefinition */ classDef.klass = redefCls; classDef.class_byte_count = env->GetArrayLength(classBytes); - classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(classBytes, NULL); + classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(classBytes, nullptr); if (vrb) printf("\n>>>>>>>> Invoke RedefineClasses():\n\tnew class byte count=%d\n", diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass010/redefclass010.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass010/redefclass010.cpp index 91620d38fe9d..a8abe779bba3 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass010/redefclass010.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass010/redefclass010.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -61,21 +61,21 @@ typedef struct { /* line numbers of a method */ /* list of original methods */ static methInfo origMethInfo[] = { - { 1, (char*) "", (char*) "()V", 1, NULL }, - { 1, (char*) "checkIt", (char*) "(Ljava/io/PrintStream;Z)I", 3, NULL }, - { 1, (char*) "finMethod", (char*) "(CJIJ)V", 1, NULL }, - { 0, (char*) "statMethod", (char*) "(III)D", 5, NULL } + { 1, (char*) "", (char*) "()V", 1, nullptr }, + { 1, (char*) "checkIt", (char*) "(Ljava/io/PrintStream;Z)I", 3, nullptr }, + { 1, (char*) "finMethod", (char*) "(CJIJ)V", 1, nullptr }, + { 0, (char*) "statMethod", (char*) "(III)D", 5, nullptr } }; /* list of redefined methods */ static methInfo redefMethInfo[] = { - { 1, (char*) "", (char*) "()V", 8, NULL }, - { 1, (char*) "checkIt", (char*) "(Ljava/io/PrintStream;Z)I", 3, NULL }, - { 1, (char*) "finMethod", (char*) "(CJIJ)V", 7, NULL }, - { 0, (char*) "statMethod", (char*) "(III)D", 1, NULL } + { 1, (char*) "", (char*) "()V", 8, nullptr }, + { 1, (char*) "checkIt", (char*) "(Ljava/io/PrintStream;Z)I", 3, nullptr }, + { 1, (char*) "finMethod", (char*) "(CJIJ)V", 7, nullptr }, + { 0, (char*) "statMethod", (char*) "(III)D", 1, nullptr } }; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; #ifdef STATIC_BUILD @@ -152,7 +152,7 @@ int checkAttr(JNIEnv *env, jclass redefCls, methInfo methodsInfo[], jint vrb) { methodsInfo[i].mid = env->GetStaticMethodID(redefCls, methodsInfo[i].m_name, methodsInfo[i].m_sign); } - if (methodsInfo[i].mid == NULL) { + if (methodsInfo[i].mid == nullptr) { printf("%s: Failed to get the method ID for the%s%s method \"%s\", signature \"%s\"\n", __FILE__, (vrb == 2) ? " original " : " ", methodsInfo[i].inst ? "instance" : "static", @@ -227,7 +227,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass010_makeRedefinition(JNIEnv *env, jvmtiError err; jvmtiClassDefinition classDef; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -239,7 +239,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass010_makeRedefinition(JNIEnv *env, /* fill the structure jvmtiClassDefinition */ classDef.klass = redefCls; classDef.class_byte_count = env->GetArrayLength(classBytes); - classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(classBytes, NULL); + classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(classBytes, nullptr); if (vrb) printf("\n>>>>>>>> Invoke RedefineClasses():\n\tnew class byte count=%d\n", diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass011/redefclass011.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass011/redefclass011.cpp index 2aaef98a0f2d..ed6a20429f5e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass011/redefclass011.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass011/redefclass011.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -53,12 +53,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -97,14 +97,14 @@ Java_nsk_jvmti_RedefineClasses_redefclass011_check(JNIEnv *env, jvmtiError err; jvmtiClassDefinition classDef; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } - classDef.klass = NULL; + classDef.klass = nullptr; classDef.class_byte_count = env->GetArrayLength(bytes); - classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(bytes, NULL); + classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(bytes, nullptr); if (printdump == JNI_TRUE) { printf(">>> invalid class check ...\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass012/redefclass012.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass012/redefclass012.cpp index c1a79e1fef96..45d6bb234afc 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass012/redefclass012.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass012/redefclass012.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -53,12 +53,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -98,14 +98,14 @@ Java_nsk_jvmti_RedefineClasses_redefclass012_check(JNIEnv *env, unsigned char *bytes; jvmtiClassDefinition classDef; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } classDef.klass = cls; classDef.class_byte_count = env->GetArrayLength(jbytes); - bytes = (unsigned char *) env->GetByteArrayElements(jbytes, NULL); + bytes = (unsigned char *) env->GetByteArrayElements(jbytes, nullptr); /* put 0,0 into version fields */ bytes[4] = 0; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass013/redefclass013.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass013/redefclass013.cpp index c525e6c20e34..36396b4c2cfc 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass013/redefclass013.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass013/redefclass013.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -53,12 +53,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -98,14 +98,14 @@ Java_nsk_jvmti_RedefineClasses_redefclass013_check(JNIEnv *env, unsigned char *bytes; jvmtiClassDefinition classDef; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } classDef.klass = cls; classDef.class_byte_count = env->GetArrayLength(jbytes); - bytes = (unsigned char *) env->GetByteArrayElements(jbytes, NULL); + bytes = (unsigned char *) env->GetByteArrayElements(jbytes, nullptr); /* put 0 into magic field */ bytes[0] = 0; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass014/redefclass014.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass014/redefclass014.cpp index 9c6170b69044..e38de4903f30 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass014/redefclass014.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass014/redefclass014.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -53,12 +53,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -96,7 +96,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass014_check(JNIEnv *env, jclass cls, jbyt jvmtiError err; jvmtiClassDefinition classDef; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -111,7 +111,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass014_check(JNIEnv *env, jclass cls, jbyt classDef.klass = cls; classDef.class_byte_count = env->GetArrayLength(bytes); - classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(bytes, NULL); + classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(bytes, nullptr); if (printdump == JNI_TRUE) { printf(">>> circularity error check ...\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass015/redefclass015.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass015/redefclass015.cpp index 1df2cb4a1ebf..7a47e55699ce 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass015/redefclass015.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass015/redefclass015.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -53,12 +53,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -97,14 +97,14 @@ Java_nsk_jvmti_RedefineClasses_redefclass015_check(JNIEnv *env, jclass cls, jvmtiError err; jvmtiClassDefinition classDef; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } classDef.klass = clazz; classDef.class_byte_count = env->GetArrayLength(bytes); - classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(bytes, NULL); + classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(bytes, nullptr); if (printdump == JNI_TRUE) { printf(">>> verify error check ...\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass016/redefclass016.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass016/redefclass016.cpp index 4e266edd3dbf..0682eaea6c53 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass016/redefclass016.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass016/redefclass016.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,12 +33,12 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; static jint result = PASSED; static jboolean printdump = JNI_FALSE; -static jmethodID mid = NULL; +static jmethodID mid = nullptr; static jint bpeakpointsExpected = 0; static jint bpeakpointsCount = 0; static jlocation loc = 0; @@ -48,7 +48,7 @@ static jint magicNumber; void check(jvmtiEnv *jvmti_env, jthread thr, jclass cls, jmethodID mid, jint i) { jvmtiError err; char *sigClass, *name, *sig, *generic; - jvmtiLocalVariableEntry *table = NULL; + jvmtiLocalVariableEntry *table = nullptr; jint entryCount = 0; jint varValue = -1; jint j; @@ -77,7 +77,7 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jclass cls, jmethodID mid, jint i) result = STATUS_FAILED; return; } - if (table != NULL) { + if (table != nullptr) { for (j = 0; j < entryCount; j++) { if (strcmp(table[j].name, "localVar") == 0) { err = jvmti_env->GetLocalInt(thr, 0, @@ -102,16 +102,16 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jclass cls, jmethodID mid, jint i) result = STATUS_FAILED; } - if (sigClass != NULL) { + if (sigClass != nullptr) { jvmti_env->Deallocate((unsigned char*)sigClass); } - if (name != NULL) { + if (name != nullptr) { jvmti_env->Deallocate((unsigned char*)name); } - if (sig != NULL) { + if (sig != nullptr) { jvmti_env->Deallocate((unsigned char*)sig); } - if (table != NULL) { + if (table != nullptr) { for (j = 0; j < entryCount; j++) { jvmti_env->Deallocate((unsigned char*)(table[j].name)); jvmti_env->Deallocate((unsigned char*)(table[j].signature)); @@ -148,7 +148,7 @@ void JNICALL Breakpoint(jvmtiEnv *jvmti_env, JNIEnv *env, classDef.klass = klass; classDef.class_byte_count = env->GetArrayLength(classBytes); - bytes = (unsigned char *) env->GetByteArrayElements(classBytes, NULL); + bytes = (unsigned char *) env->GetByteArrayElements(classBytes, nullptr); for (i = 0; i < classDef.class_byte_count - 3; i++) { if (((jint)bytes[i+3] | @@ -202,12 +202,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -264,10 +264,10 @@ JNIEXPORT void JNICALL Java_nsk_jvmti_RedefineClasses_redefclass016_getReady(JNIEnv *env, jclass cls, jclass clazz, jbyteArray bytes, jint magic, jint line) { jvmtiError err; - jvmtiLineNumberEntry *lines = NULL; + jvmtiLineNumberEntry *lines = nullptr; jint i = 0, entryCount = 0; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; @@ -279,7 +279,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass016_getReady(JNIEnv *env, jclass cls, !caps.can_access_local_variables) return; mid = env->GetMethodID(clazz, "run", "()V"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot find Method ID for method run\n"); result = STATUS_FAILED; return; @@ -295,7 +295,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass016_getReady(JNIEnv *env, jclass cls, return; } - if (lines != NULL && entryCount > 0) { + if (lines != nullptr && entryCount > 0) { for (i = 0; i < entryCount; i++) { if (line == lines[i].line_number) { loc = lines[i].start_location; @@ -318,7 +318,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass016_getReady(JNIEnv *env, jclass cls, } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_BREAKPOINT, NULL); + JVMTI_EVENT_BREAKPOINT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable BREAKPOINT event: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass017/redefclass017.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass017/redefclass017.cpp index cd2076cf9a72..77908ed14997 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass017/redefclass017.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass017/redefclass017.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,12 +33,12 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; static jint result = PASSED; static jboolean printdump = JNI_FALSE; -static jmethodID mid = NULL; +static jmethodID mid = nullptr; static jbyteArray classBytes; void JNICALL Breakpoint(jvmtiEnv *jvmti_env, JNIEnv *env, @@ -64,7 +64,7 @@ void JNICALL Breakpoint(jvmtiEnv *jvmti_env, JNIEnv *env, classDef.klass = klass; classDef.class_byte_count = env->GetArrayLength(classBytes); classDef.class_bytes = (unsigned char *) - env->GetByteArrayElements(classBytes, NULL); + env->GetByteArrayElements(classBytes, nullptr); if (printdump == JNI_TRUE) { printf(">>> bp: about to call RedefineClasses\n"); @@ -93,12 +93,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -148,7 +148,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass017_getReady(JNIEnv *env, jclass cls, jclass clazz, jbyteArray bytes) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; @@ -158,7 +158,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass017_getReady(JNIEnv *env, jclass cls, !caps.can_generate_breakpoint_events) return; mid = env->GetMethodID(clazz, "checkPoint", "()V"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot find Method ID for method run\n"); result = STATUS_FAILED; return; @@ -175,7 +175,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass017_getReady(JNIEnv *env, jclass cls, } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_BREAKPOINT, NULL); + JVMTI_EVENT_BREAKPOINT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable BREAKPOINT event: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass018/redefclass018.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass018/redefclass018.cpp index 68d2ac89263e..044f23c62353 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass018/redefclass018.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass018/redefclass018.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; static jint result = PASSED; @@ -49,7 +49,7 @@ Exception(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thread, jvmtiClassDefinition classDef; err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, - JVMTI_EVENT_EXCEPTION, NULL); + JVMTI_EVENT_EXCEPTION, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to disable JVMTI_EVENT_EXCEPTION: %s (%d)\n", TranslateError(err), err); @@ -66,7 +66,7 @@ Exception(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thread, classDef.klass = klass; classDef.class_byte_count = env->GetArrayLength(classBytes); - classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(classBytes, NULL); + classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(classBytes, nullptr); if (printdump == JNI_TRUE) { printf(">>> about to call RedefineClasses\n"); @@ -95,12 +95,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -151,7 +151,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass018_getReady(JNIEnv *env, jclass cls, jvmtiError err; jthread thread; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass019/redefclass019.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass019/redefclass019.cpp index 414005124eb3..d8ca1cbf4ea9 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass019/redefclass019.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass019/redefclass019.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -48,14 +48,14 @@ typedef struct { var_info *vars; } frame_info; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; static jint result = PASSED; static jboolean printdump = JNI_FALSE; static jbyteArray classBytes; -static jmethodID midCheckPoint = NULL; -static jmethodID midRun = NULL; +static jmethodID midCheckPoint = nullptr; +static jmethodID midRun = nullptr; static jint framesExpected = 0; static jint framesCount = 0; @@ -96,10 +96,10 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jmethodID mid, jint i) { jvmtiError err; jclass cls; jlocation loc; - char *sigClass, *name = NULL, *sig = NULL, *generic; + char *sigClass, *name = nullptr, *sig = nullptr, *generic; jboolean is_obsolete; - jvmtiLineNumberEntry *lines = NULL; - jvmtiLocalVariableEntry *table = NULL; + jvmtiLineNumberEntry *lines = nullptr; + jvmtiLocalVariableEntry *table = nullptr; jint line = -1; jint entryCount = 0; jint varValue = -1; @@ -135,10 +135,10 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jmethodID mid, jint i) { return; } - if (sigClass == NULL || strcmp(sigClass, cls_exp) != 0) { + if (sigClass == nullptr || strcmp(sigClass, cls_exp) != 0) { printf("(pop %d) wrong class sig: \"%s\",", i, sigClass); printf(" expected: \"%s\"\n", cls_exp); - if (sigClass != NULL) { + if (sigClass != nullptr) { jvmti_env->Deallocate((unsigned char*)sigClass); } result = STATUS_FAILED; @@ -167,12 +167,12 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jmethodID mid, jint i) { (is_obsolete == JNI_TRUE) ? "unexpected" : "should be"); result = STATUS_FAILED; } - if (name == NULL || strcmp(name, frames[i].name) != 0) { + if (name == nullptr || strcmp(name, frames[i].name) != 0) { printf("(pop %d) wrong method name: \"%s\",", i, name); printf(" expected: \"%s\"\n", frames[i].name); result = STATUS_FAILED; } - if (sig == NULL || strcmp(sig, frames[i].sig) != 0) { + if (sig == nullptr || strcmp(sig, frames[i].sig) != 0) { printf("(pop %d) wrong method sig: \"%s\",", i, sig); printf(" expected: \"%s\"\n", frames[i].sig); result = STATUS_FAILED; @@ -187,7 +187,7 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jmethodID mid, jint i) { return; } - if (lines != NULL && entryCount > 0) { + if (lines != nullptr && entryCount > 0) { for (k = 0; k < entryCount; k++) { if (loc < lines[k].start_location) { break; @@ -216,7 +216,7 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jmethodID mid, jint i) { result = STATUS_FAILED; } - if (table != NULL) { + if (table != nullptr) { for (k = 0; k < frames[i].count; k++) { for (j = 0; j < entryCount; j++) { if (strcmp(table[j].name, frames[i].vars[k].name) == 0 && @@ -256,19 +256,19 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jmethodID mid, jint i) { } } - if (sigClass != NULL) { + if (sigClass != nullptr) { jvmti_env->Deallocate((unsigned char*)sigClass); } - if (name != NULL) { + if (name != nullptr) { jvmti_env->Deallocate((unsigned char*)name); } - if (sig != NULL) { + if (sig != nullptr) { jvmti_env->Deallocate((unsigned char*)sig); } - if (lines != NULL) { + if (lines != nullptr) { jvmti_env->Deallocate((unsigned char*)lines); } - if (table != NULL) { + if (table != nullptr) { for (j = 0; j < entryCount; j++) { jvmti_env->Deallocate((unsigned char*)(table[j].name)); jvmti_env->Deallocate((unsigned char*)(table[j].signature)); @@ -311,7 +311,7 @@ void JNICALL Breakpoint(jvmtiEnv *jvmti_env, JNIEnv *env, classDef.klass = klass; classDef.class_byte_count = env->GetArrayLength(classBytes); classDef.class_bytes = (unsigned char *) - env->GetByteArrayElements(classBytes, NULL); + env->GetByteArrayElements(classBytes, nullptr); if (printdump == JNI_TRUE) { printf(">>> about to call RedefineClasses\n"); @@ -368,12 +368,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -433,7 +433,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass019_getReady(JNIEnv *env, jclass cls, jclass clazz, jbyteArray bytes, jint depth) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; @@ -448,14 +448,14 @@ Java_nsk_jvmti_RedefineClasses_redefclass019_getReady(JNIEnv *env, jclass cls, classBytes = (jbyteArray) env->NewGlobalRef(bytes); midRun = env->GetMethodID(clazz, "run", "()V"); - if (midRun == NULL) { + if (midRun == nullptr) { printf("Cannot find Method ID for method run\n"); result = STATUS_FAILED; return; } midCheckPoint = env->GetMethodID(clazz, "checkPoint", "()V"); - if (midCheckPoint == NULL) { + if (midCheckPoint == nullptr) { printf("Cannot find Method ID for method checkPoint\n"); result = STATUS_FAILED; return; @@ -470,7 +470,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass019_getReady(JNIEnv *env, jclass cls, } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_BREAKPOINT, NULL); + JVMTI_EVENT_BREAKPOINT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable BREAKPOINT event: %s (%d)\n", TranslateError(err), err); @@ -479,7 +479,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass019_getReady(JNIEnv *env, jclass cls, } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_FRAME_POP, NULL); + JVMTI_EVENT_FRAME_POP, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable FRAME_POP event: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass020/redefclass020.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass020/redefclass020.cpp index 955fd841aaa8..5f431995812d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass020/redefclass020.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass020/redefclass020.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -53,12 +53,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -97,14 +97,14 @@ Java_nsk_jvmti_RedefineClasses_redefclass020_check(JNIEnv *env, jclass cls, jvmtiError err; jvmtiClassDefinition classDef; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } classDef.klass = clazz; classDef.class_byte_count = env->GetArrayLength(bytes); - classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(bytes, NULL); + classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(bytes, nullptr); if (printdump == JNI_TRUE) { printf(">>> add method capability check ...\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass021/redefclass021.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass021/redefclass021.cpp index e44872125f61..233818a21da3 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass021/redefclass021.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass021/redefclass021.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -53,12 +53,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -97,14 +97,14 @@ Java_nsk_jvmti_RedefineClasses_redefclass021_check(JNIEnv *env, jclass cls, jvmtiError err; jvmtiClassDefinition classDef; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } classDef.klass = clazz; classDef.class_byte_count = env->GetArrayLength(bytes); - classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(bytes, NULL); + classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(bytes, nullptr); if (printdump == JNI_TRUE) { printf(">>> delete method capability check ...\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass022/redefclass022.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass022/redefclass022.cpp index e931801f560a..93aa706a9cd7 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass022/redefclass022.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass022/redefclass022.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -53,12 +53,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -97,14 +97,14 @@ Java_nsk_jvmti_RedefineClasses_redefclass022_check(JNIEnv *env, jclass cls, jvmtiError err; jvmtiClassDefinition classDef; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } classDef.klass = clazz; classDef.class_byte_count = env->GetArrayLength(bytes); - classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(bytes, NULL); + classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(bytes, nullptr); if (printdump == JNI_TRUE) { printf(">>> change fields capability check ...\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass023/redefclass023.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass023/redefclass023.cpp index 4d118e726d3e..d9bb42e87566 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass023/redefclass023.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass023/redefclass023.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -53,12 +53,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -97,14 +97,14 @@ Java_nsk_jvmti_RedefineClasses_redefclass023_check(JNIEnv *env, jclass cls, jvmtiError err; jvmtiClassDefinition classDef; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } classDef.klass = clazz; classDef.class_byte_count = env->GetArrayLength(bytes); - classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(bytes, NULL); + classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(bytes, nullptr); if (printdump == JNI_TRUE) { printf(">>> change implemented interface capability check ...\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass024/redefclass024.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass024/redefclass024.cpp index 41c4a849275c..becd61705c66 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass024/redefclass024.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass024/redefclass024.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -53,12 +53,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -97,14 +97,14 @@ Java_nsk_jvmti_RedefineClasses_redefclass024_check(JNIEnv *env, jclass cls, jvmtiError err; jvmtiClassDefinition classDef; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } classDef.klass = clazz; classDef.class_byte_count = env->GetArrayLength(bytes); - classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(bytes, NULL); + classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(bytes, nullptr); if (printdump == JNI_TRUE) { printf(">>> change class modifiers capability check ...\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass025/redefclass025.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass025/redefclass025.cpp index ee5b364dc7ec..a008e284bfdb 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass025/redefclass025.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass025/redefclass025.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -53,12 +53,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -97,14 +97,14 @@ Java_nsk_jvmti_RedefineClasses_redefclass025_check(JNIEnv *env, jclass cls, jvmtiError err; jvmtiClassDefinition classDef; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } classDef.klass = clazz; classDef.class_byte_count = env->GetArrayLength(bytes); - classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(bytes, NULL); + classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(bytes, nullptr); if (printdump == JNI_TRUE) { printf(">>> change method modifiers capability check ...\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass026/redefclass026.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass026/redefclass026.cpp index 68366880a65c..91a61032a774 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass026/redefclass026.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass026/redefclass026.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -53,12 +53,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -97,14 +97,14 @@ Java_nsk_jvmti_RedefineClasses_redefclass026_check(JNIEnv *env, jclass cls, jvmtiError err; jvmtiClassDefinition classDef; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } classDef.klass = clazz; classDef.class_byte_count = env->GetArrayLength(bytes); - classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(bytes, NULL); + classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(bytes, nullptr); if (printdump == JNI_TRUE) { printf(">>> changed class name check ...\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass027/redefclass027.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass027/redefclass027.cpp index cdcf5f4868ef..451480cb7f04 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass027/redefclass027.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass027/redefclass027.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,9 +24,9 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" -#include "jni_tools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" +#include "jni_tools.hpp" extern "C" { @@ -50,17 +50,17 @@ typedef struct { const char *desc; } frame_info; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; static jint result = PASSED; static jboolean printdump = JNI_FALSE; static jbyteArray classBytes; -static jmethodID midRun = NULL; -static jmethodID mid1 = NULL; -static jmethodID mid2 = NULL; -static jfieldID fid1 = NULL; -static jfieldID fid2 = NULL; +static jmethodID midRun = nullptr; +static jmethodID mid1 = nullptr; +static jmethodID mid2 = nullptr; +static jfieldID fid1 = nullptr; +static jfieldID fid2 = nullptr; static jint stepEventsExpected = 0; static jint bpEventsExpected = 0; static jint popEventsExpected = 0; @@ -118,11 +118,11 @@ static frame_info frames[] = { void check(jvmtiEnv *jvmti_env, jthread thr, jclass cls, jmethodID mid, jlocation loc, jint i) { jvmtiError err; - char *sigClass, *name = NULL, *sig = NULL, *generic; + char *sigClass, *name = nullptr, *sig = nullptr, *generic; const char *desc; jboolean is_obsolete; - jvmtiLineNumberEntry *lines = NULL; - jvmtiLocalVariableEntry *table = NULL; + jvmtiLineNumberEntry *lines = nullptr; + jvmtiLocalVariableEntry *table = nullptr; jint line = -1; jint entryCount = 0; jint varValue = -1; @@ -144,10 +144,10 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jclass cls, jmethodID mid, result = STATUS_FAILED; } - if (sigClass == NULL || strcmp(sigClass, cls_exp) != 0) { + if (sigClass == nullptr || strcmp(sigClass, cls_exp) != 0) { printf("(%s) wrong class sig: \"%s\",", desc, sigClass); printf(" expected: \"%s\"\n", cls_exp); - if (sigClass != NULL) { + if (sigClass != nullptr) { jvmti_env->Deallocate((unsigned char *)sigClass); } result = STATUS_FAILED; @@ -176,12 +176,12 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jclass cls, jmethodID mid, (is_obsolete == JNI_TRUE) ? "unexpected" : "should be"); result = STATUS_FAILED; } - if (name == NULL || strcmp(name, frames[i].name) != 0) { + if (name == nullptr || strcmp(name, frames[i].name) != 0) { printf("(%s) wrong method name: \"%s\",", desc, name); printf(" expected: \"%s\"\n", frames[i].name); result = STATUS_FAILED; } - if (sig == NULL || strcmp(sig, frames[i].sig) != 0) { + if (sig == nullptr || strcmp(sig, frames[i].sig) != 0) { printf("(%s) wrong method sig: \"%s\",", desc, sig); printf(" expected: \"%s\"\n", frames[i].sig); result = STATUS_FAILED; @@ -195,7 +195,7 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jclass cls, jmethodID mid, result = STATUS_FAILED; } - if (lines != NULL && entryCount > 0) { + if (lines != nullptr && entryCount > 0) { for (k = 0; k < entryCount; k++) { if (loc < lines[k].start_location) { break; @@ -223,7 +223,7 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jclass cls, jmethodID mid, result = STATUS_FAILED; } - if (table != NULL) { + if (table != nullptr) { for (k = 0; k < frames[i].count; k++) { for (j = 0; j < entryCount; j++) { if (strcmp(table[j].name, frames[i].vars[k].name) == 0 && @@ -272,19 +272,19 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jclass cls, jmethodID mid, } } - if (sigClass != NULL) { + if (sigClass != nullptr) { jvmti_env->Deallocate((unsigned char *)sigClass); } - if (name != NULL) { + if (name != nullptr) { jvmti_env->Deallocate((unsigned char *)name); } - if (sig != NULL) { + if (sig != nullptr) { jvmti_env->Deallocate((unsigned char *)sig); } - if (lines != NULL) { + if (lines != nullptr) { jvmti_env->Deallocate((unsigned char *)lines); } - if (table != NULL) { + if (table != nullptr) { for (j = 0; j < entryCount; j++) { jvmti_env->Deallocate((unsigned char *)(table[j].name)); jvmti_env->Deallocate((unsigned char *)(table[j].signature)); @@ -299,7 +299,7 @@ void redefine(jvmtiEnv *jvmti_env, JNIEnv *env, jclass cls) { classDef.klass = cls; classDef.class_byte_count = env->GetArrayLength(classBytes); - classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(classBytes, NULL); + classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(classBytes, nullptr); if (printdump == JNI_TRUE) { printf(">>> about to call RedefineClasses %d\n", redefinesCount); @@ -531,7 +531,7 @@ void JNICALL ExceptionCatch(jvmtiEnv *jvmti_env, JNIEnv *env, if (caps.can_generate_frame_pop_events) { err = jvmti_env->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_FRAME_POP, NULL); + JVMTI_EVENT_FRAME_POP, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable FRAME_POP event: %s (%d)\n", TranslateError(err), err); @@ -596,12 +596,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -687,7 +687,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass027_getReady(JNIEnv *env, jclass cls, jclass clazz, jbyteArray bytes) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; @@ -700,24 +700,24 @@ Java_nsk_jvmti_RedefineClasses_redefclass027_getReady(JNIEnv *env, jclass cls, classBytes = (jbyteArray) env->NewGlobalRef(bytes); midRun = env->GetMethodID(clazz, "run", "()V"); - if (midRun == NULL) { + if (midRun == nullptr) { printf("Cannot find Method ID for method run\n"); result = STATUS_FAILED; } mid1 = env->GetMethodID(clazz, "method1", "(I)V"); - if (mid1 == NULL) { + if (mid1 == nullptr) { printf("Cannot find Method ID for method1\n"); result = STATUS_FAILED; } mid2 = env->GetMethodID(clazz, "method2", "(I)V"); - if (mid2 == NULL) { + if (mid2 == nullptr) { printf("Cannot find Method ID for method2\n"); result = STATUS_FAILED; } - if (caps.can_generate_breakpoint_events && midRun != NULL) { + if (caps.can_generate_breakpoint_events && midRun != nullptr) { err = jvmti->SetBreakpoint(midRun, 0); if (err != JVMTI_ERROR_NONE) { printf("(SetBreakpoint) unexpected error: %s (%d)\n", @@ -725,7 +725,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass027_getReady(JNIEnv *env, jclass cls, result = STATUS_FAILED; } else { err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_BREAKPOINT, NULL); + JVMTI_EVENT_BREAKPOINT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable BREAKPOINT event: %s (%d)\n", TranslateError(err), err); @@ -737,12 +737,12 @@ Java_nsk_jvmti_RedefineClasses_redefclass027_getReady(JNIEnv *env, jclass cls, } fid1 = env->GetStaticFieldID(clazz, "staticInt", "I"); - if (fid1 == NULL) { + if (fid1 == nullptr) { printf("Cannot find Field ID for staticInt\n"); result = STATUS_FAILED; } - if (caps.can_generate_field_modification_events && fid1 != NULL) { + if (caps.can_generate_field_modification_events && fid1 != nullptr) { err = jvmti->SetFieldModificationWatch(clazz, fid1); if (err != JVMTI_ERROR_NONE) { printf("(SetFieldModificationWatch) unexpected error: %s (%d)\n", @@ -750,7 +750,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass027_getReady(JNIEnv *env, jclass cls, result = STATUS_FAILED; } else { err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_FIELD_MODIFICATION, NULL); + JVMTI_EVENT_FIELD_MODIFICATION, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable FIELD_MODIFICATION event: %s (%d)\n", TranslateError(err), err); @@ -762,12 +762,12 @@ Java_nsk_jvmti_RedefineClasses_redefclass027_getReady(JNIEnv *env, jclass cls, } fid2 = env->GetFieldID(clazz, "instanceInt", "I"); - if (fid2 == NULL) { + if (fid2 == nullptr) { printf("Cannot find Field ID for instanceInt\n"); result = STATUS_FAILED; } - if (caps.can_generate_field_access_events && fid2 != NULL) { + if (caps.can_generate_field_access_events && fid2 != nullptr) { err = jvmti->SetFieldAccessWatch(clazz, fid2); if (err != JVMTI_ERROR_NONE) { printf("(SetFieldAccessWatch) unexpected error: %s (%d)\n", @@ -775,7 +775,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass027_getReady(JNIEnv *env, jclass cls, result = STATUS_FAILED; } else { err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_FIELD_ACCESS, NULL); + JVMTI_EVENT_FIELD_ACCESS, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable FIELD_ACCESS event: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass028/redefclass028.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass028/redefclass028.cpp index 09a8467c355f..934e483da1de 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass028/redefclass028.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass028/redefclass028.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,12 +26,12 @@ #include #include -#include "agent_common.h" +#include "agent_common.hpp" -#include "nsk_tools.h" -#include "native_thread.h" -#include "JVMTITools.h" -#include "jvmti_tools.h" +#include "nsk_tools.hpp" +#include "native_thread.hpp" +#include "JVMTITools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -49,7 +49,7 @@ static jvmtiEvent eventsList[EVENTS_COUNT] = { JVMTI_EVENT_COMPILED_METHOD_UNLOAD }; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; static volatile int fire = 0; /* CompiledMethodLoad received for hotspot method */ static jmethodID hsMethodID; /* hotspot method ID */ @@ -100,7 +100,7 @@ CompiledMethodLoad(jvmtiEnv *jvmti_env, jmethodID method, jint code_size, char *sig; NSK_DISPLAY0("CompiledMethodLoad event received for:\n"); - if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &sig, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &sig, nullptr))) { nsk_jvmti_setFailStatus(); return; } @@ -133,7 +133,7 @@ CompiledMethodUnload(jvmtiEnv* jvmti_env, jmethodID method, NSK_DISPLAY0("CompiledMethodUnload event received\n"); // Check for the case that the class has been unloaded - err = jvmti_env->GetMethodName(method, &name, &sig, NULL); + err = jvmti_env->GetMethodName(method, &name, &sig, nullptr); if (err == JVMTI_ERROR_NONE) { NSK_DISPLAY3("for: \tmethod: name=\"%s\" signature=\"%s\"\n\tnative address=0x%p\n", name, sig, code_addr); @@ -188,7 +188,7 @@ agentProc(jvmtiEnv* jvmti_env, JNIEnv* jni_env, void* arg) { nsk_jvmti_resumeSync(); return; } - if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(decl_cls, &cls_sig, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(decl_cls, &cls_sig, nullptr))) { nsk_jvmti_setFailStatus(); nsk_jvmti_resumeSync(); return; @@ -249,7 +249,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add required capabilities */ @@ -269,12 +269,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { NSK_DISPLAY0("setting event callbacks done\nenabling events ...\n"); if (!nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, - eventsList, NULL)) + eventsList, nullptr)) return JNI_ERR; NSK_DISPLAY0("enabling the events done\n\n"); /* register agent proc */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass029/redefclass029.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass029/redefclass029.cpp index 9f7fc1fc5a5f..d2b4b720c55d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass029/redefclass029.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass029/redefclass029.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,12 +26,12 @@ #include #include -#include "agent_common.h" +#include "agent_common.hpp" -#include "nsk_tools.h" -#include "native_thread.h" -#include "JVMTITools.h" -#include "jvmti_tools.h" +#include "nsk_tools.hpp" +#include "native_thread.hpp" +#include "JVMTITools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -49,7 +49,7 @@ static jvmtiEvent eventsList[EVENTS_COUNT] = { JVMTI_EVENT_COMPILED_METHOD_UNLOAD }; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; static volatile int fire = 0; /* CompiledMethodLoad received for hotspot method */ static jmethodID hsMethodID; /* hotspot method ID */ @@ -99,7 +99,7 @@ CompiledMethodLoad(jvmtiEnv *jvmti_env, jmethodID method, jint code_size, char *sig; NSK_DISPLAY0("CompiledMethodLoad event received for:\n"); - if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &sig, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &sig, nullptr))) { nsk_jvmti_setFailStatus(); return; } @@ -132,7 +132,7 @@ CompiledMethodUnload(jvmtiEnv* jvmti_env, jmethodID method, NSK_DISPLAY0("CompiledMethodUnload event received\n"); // Check for the case that the class has been unloaded - err = jvmti_env->GetMethodName(method, &name, &sig, NULL); + err = jvmti_env->GetMethodName(method, &name, &sig, nullptr); if (err == JVMTI_ERROR_NONE) { NSK_DISPLAY3("for: \tmethod: name=\"%s\" signature=\"%s\"\n\tnative address=0x%p\n", name, sig, code_addr); @@ -187,7 +187,7 @@ agentProc(jvmtiEnv* jvmti_env, JNIEnv* jni_env, void* arg) { nsk_jvmti_resumeSync(); return; } - if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(decl_cls, &cls_sig, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(decl_cls, &cls_sig, nullptr))) { nsk_jvmti_setFailStatus(); nsk_jvmti_resumeSync(); return; @@ -248,7 +248,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add required capabilities */ @@ -268,12 +268,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { NSK_DISPLAY0("setting event callbacks done\nenabling events ...\n"); if (!nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, - eventsList, NULL)) + eventsList, nullptr)) return JNI_ERR; NSK_DISPLAY0("enabling the events done\n\n"); /* register agent proc */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass030/redefclass030.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass030/redefclass030.cpp index b7d6daafbbdb..35505044ef18 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass030/redefclass030.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass030/redefclass030.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,12 +26,12 @@ #include #include -#include "agent_common.h" +#include "agent_common.hpp" -#include "nsk_tools.h" -#include "native_thread.h" -#include "JVMTITools.h" -#include "jvmti_tools.h" +#include "nsk_tools.hpp" +#include "native_thread.hpp" +#include "JVMTITools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -49,7 +49,7 @@ static jvmtiEvent eventsList[EVENTS_COUNT] = { JVMTI_EVENT_COMPILED_METHOD_UNLOAD }; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; static volatile int fire = 0; /* CompiledMethodLoad received for hotspot method */ static jmethodID hsMethodID; /* hotspot method ID */ @@ -100,7 +100,7 @@ CompiledMethodLoad(jvmtiEnv *jvmti_env, jmethodID method, jint code_size, char *sig; NSK_DISPLAY0("CompiledMethodLoad event received for:\n"); - if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &sig, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &sig, nullptr))) { nsk_jvmti_setFailStatus(); return; } @@ -133,7 +133,7 @@ CompiledMethodUnload(jvmtiEnv* jvmti_env, jmethodID method, NSK_DISPLAY0("CompiledMethodUnload event received\n"); // Check for the case that the class has been unloaded - err = jvmti_env->GetMethodName(method, &name, &sig, NULL); + err = jvmti_env->GetMethodName(method, &name, &sig, nullptr); if (err == JVMTI_ERROR_NONE) { NSK_DISPLAY3("for: \tmethod: name=\"%s\" signature=\"%s\"\n\tnative address=0x%p\n", name, sig, code_addr); @@ -188,7 +188,7 @@ agentProc(jvmtiEnv* jvmti_env, JNIEnv* jni_env, void* arg) { nsk_jvmti_resumeSync(); return; } - if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(decl_cls, &cls_sig, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(decl_cls, &cls_sig, nullptr))) { nsk_jvmti_setFailStatus(); nsk_jvmti_resumeSync(); return; @@ -249,7 +249,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add required capabilities */ @@ -269,12 +269,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { NSK_DISPLAY0("setting event callbacks done\nenabling events ...\n"); if (!nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, - eventsList, NULL)) + eventsList, nullptr)) return JNI_ERR; NSK_DISPLAY0("enabling the events done\n\n"); /* register agent proc */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass031/redefclass031.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass031/redefclass031.cpp index 9d242130a0fa..af250e1e40a0 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass031/redefclass031.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RedefineClasses/redefclass031/redefclass031.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,13 +33,13 @@ extern "C" { #define STATUS_FAILED 2 #define PASSED 0 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; static int watch_ev = 0; /* ignore JVMTI events by default */ static int gen_ev = 0; /* number of generated events */ static int result = PASSED; /* total result of the test */ -static jthread test_thread = NULL; +static jthread test_thread = nullptr; static jrawMonitorID watch_ev_monitor; @@ -54,9 +54,9 @@ static void set_watch_ev(JNIEnv *env, int value) { } else { test_thread = env->NewGlobalRef(test_thread); } - } else if (test_thread != NULL) { + } else if (test_thread != nullptr) { env->DeleteGlobalRef(test_thread); - test_thread = NULL; + test_thread = nullptr; } watch_ev = value; @@ -85,10 +85,10 @@ NativeMethodBind(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thr, jmethodID method } else { printf("got JVMTI_EVENT_NATIVE_METHOD_BIND event on thread '%s', ignoring", inf.name); jvmti_env->Deallocate((unsigned char *)inf.name); - if (inf.thread_group != NULL) { + if (inf.thread_group != nullptr) { env->DeleteLocalRef(inf.thread_group); } - if (inf.context_class_loader != NULL) { + if (inf.context_class_loader != nullptr) { env->DeleteLocalRef(inf.context_class_loader); } } @@ -168,7 +168,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass031_makeRedefinition(JNIEnv *env, jvmtiError err; jvmtiClassDefinition classDef; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -177,7 +177,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass031_makeRedefinition(JNIEnv *env, return PASSED; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_NATIVE_METHOD_BIND, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_NATIVE_METHOD_BIND, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable JVMTI_EVENT_NATIVE_METHOD_BIND: %s (%d)\n", TranslateError(err), err); @@ -187,7 +187,7 @@ Java_nsk_jvmti_RedefineClasses_redefclass031_makeRedefinition(JNIEnv *env, /* filling the structure jvmtiClassDefinition */ classDef.klass = redefCls; classDef.class_byte_count = env->GetArrayLength(classBytes); - classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(classBytes, NULL); + classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(classBytes, nullptr); set_watch_ev(env, 1); /* watch JVMTI events */ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RelinquishCapabilities/relcaps001/relcaps001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RelinquishCapabilities/relcaps001/relcaps001.cpp index 736715c2ab65..34cb1e8615c9 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RelinquishCapabilities/relcaps001/relcaps001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RelinquishCapabilities/relcaps001/relcaps001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,9 +24,9 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -302,7 +302,7 @@ callbackVMDeath(jvmtiEnv* jvmti, JNIEnv* jni) { success = checkCapabilities(jvmti, &initCaps, "VM_DEATH callback"); NSK_DISPLAY1("Disable events: %d events\n", EVENTS_COUNT); - if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, NULL)) { + if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, nullptr)) { success = false; } else { NSK_DISPLAY0(" ... disabled\n"); @@ -329,7 +329,7 @@ JNIEXPORT jint JNI_OnLoad_relcaps001(JavaVM *jvm, char *options, void *reserved) } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -337,7 +337,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; { @@ -352,7 +352,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&initCaps, 0, sizeof(jvmtiCapabilities)); @@ -375,7 +375,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } NSK_DISPLAY1("Enable events: %d events\n", EVENTS_COUNT); - if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, NULL)) { + if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, nullptr)) { NSK_DISPLAY0(" ... enabled\n"); } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RelinquishCapabilities/relcaps002/relcaps002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RelinquishCapabilities/relcaps002/relcaps002.cpp index 8ff71c76c7ad..8ed84ee549e9 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RelinquishCapabilities/relcaps002/relcaps002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RelinquishCapabilities/relcaps002/relcaps002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,9 +24,9 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -301,7 +301,7 @@ callbackVMDeath(jvmtiEnv* jvmti, JNIEnv* jni) { success = checkCapabilities(jvmti, &initCaps, "VM_DEATH callback"); NSK_DISPLAY1("Disable events: %d events\n", EVENTS_COUNT); - if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, NULL)) { + if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, nullptr)) { success = false; } else { NSK_DISPLAY0(" ... disabled\n"); @@ -328,7 +328,7 @@ JNIEXPORT jint JNI_OnLoad_relcaps002(JavaVM *jvm, char *options, void *reserved) } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -336,7 +336,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; { @@ -351,7 +351,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&initCaps, 0, sizeof(jvmtiCapabilities)); @@ -364,7 +364,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } NSK_DISPLAY1("Enable events: %d events\n", EVENTS_COUNT); - if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, NULL)) { + if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, nullptr)) { NSK_DISPLAY0(" ... enabled\n"); } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResourceExhausted/resexhausted.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResourceExhausted/resexhausted.cpp index b3c6304ee0c8..43cfad13c643 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResourceExhausted/resexhausted.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResourceExhausted/resexhausted.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,15 +24,15 @@ #include #include #include -#include "jvmti_tools.h" -#include "agent_common.h" +#include "jvmti_tools.hpp" +#include "agent_common.hpp" #define PASSED 0 #define STATUS_FAILED 2 extern "C" { -static jvmtiEnv* gJvmti = NULL; +static jvmtiEnv* gJvmti = nullptr; static volatile jint gEventFlags = 0; void JNICALL @@ -80,7 +80,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; - if (!NSK_VERIFY((gJvmti = nsk_jvmti_createJVMTIEnv(vm, reserved)) != NULL)) + if (!NSK_VERIFY((gJvmti = nsk_jvmti_createJVMTIEnv(vm, reserved)) != nullptr)) return JNI_ERR; memset(&capabilities, 0, sizeof(jvmtiCapabilities)); @@ -96,7 +96,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) if (!NSK_JVMTI_VERIFY(gJvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_RESOURCE_EXHAUSTED, - NULL))) + nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResourceExhausted/resexhausted001.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResourceExhausted/resexhausted001.java index b147757f9e0a..1009f2d35380 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResourceExhausted/resexhausted001.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResourceExhausted/resexhausted001.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2025, 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 @@ -62,7 +62,7 @@ public static int run(String args[], PrintStream out) { makeThread(); } - System.out.println("Can't reproduce OOME due to a limit on iterations/execution time. Test was useless." + System.out.println("Test resexhausted001: Can't reproduce OOME due to a limit on iterations/execution time. Test was useless." + " threadCount=" + threadCount.get()); throw new SkippedException("Test did not get an OutOfMemory error"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResourceExhausted/resexhausted002.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResourceExhausted/resexhausted002.java index 46832df7dc30..c1a6e111c9f8 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResourceExhausted/resexhausted002.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResourceExhausted/resexhausted002.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2025, 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 @@ -55,7 +55,7 @@ public static int run(String args[], PrintStream out) { ++count; } - System.out.println("Can't reproduce OOME due to a limit on iterations/execution time. Test was useless."); + System.out.println("Test resexhausted002: Can't reproduce OOME due to a limit on iterations/execution time. Test was useless."); throw new SkippedException("Test did not get an OutOfMemory error"); } catch (OutOfMemoryError e) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResourceExhausted/resexhausted003.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResourceExhausted/resexhausted003.java index f336c1bf3d57..8cc997fa4ab7 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResourceExhausted/resexhausted003.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResourceExhausted/resexhausted003.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2025, 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 @@ -115,7 +115,7 @@ public static int run(String args[], PrintStream out) { ++count; } - System.out.println("Can't reproduce OOME due to a limit on iterations/execution time. Test was useless."); + System.out.println("Test resexhausted003: Can't reproduce OOME due to a limit on iterations/execution time. Test was useless."); throw new SkippedException("Test did not get an OutOfMemory error"); } catch (OutOfMemoryError e) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResumeThread/resumethrd001/resumethrd001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResumeThread/resumethrd001/resumethrd001.cpp index 97689802db34..435232d367cf 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResumeThread/resumethrd001/resumethrd001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResumeThread/resumethrd001/resumethrd001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -49,11 +49,11 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { /* perform testing */ { - jthread testedThread = NULL; + jthread testedThread = nullptr; NSK_DISPLAY1("Find thread: %s\n", THREAD_NAME); if (!NSK_VERIFY((testedThread = - nsk_jvmti_threadByName(THREAD_NAME)) != NULL)) + nsk_jvmti_threadByName(THREAD_NAME)) != nullptr)) return; NSK_DISPLAY1(" ... found thread: %p\n", (void*)testedThread); @@ -118,7 +118,7 @@ JNIEXPORT jint JNI_OnLoad_resumethrd001(JavaVM *jvm, char *options, void *reserv } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; /* init framework and parse options */ if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) @@ -128,7 +128,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add specific capabilities for suspending thread */ @@ -141,7 +141,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResumeThread/resumethrd002/resumethrd002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResumeThread/resumethrd002/resumethrd002.cpp index 55a06f21bbc3..7bc34d71bdc5 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResumeThread/resumethrd002/resumethrd002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResumeThread/resumethrd002/resumethrd002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -46,7 +46,7 @@ static jvmtiEvent eventsList[EVENTS_COUNT] = { }; static volatile int eventsReceived = 0; -static jthread testedThread = NULL; +static jthread testedThread = nullptr; /* ============================================================================= */ @@ -62,13 +62,13 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { { NSK_DISPLAY1("Find thread: %s\n", THREAD_NAME); if (!NSK_VERIFY((testedThread = - nsk_jvmti_threadByName(THREAD_NAME)) != NULL)) + nsk_jvmti_threadByName(THREAD_NAME)) != nullptr)) return; NSK_DISPLAY1(" ... found thread: %p\n", (void*)testedThread); eventsReceived = 0; NSK_DISPLAY1("Enable event: %s\n", "THREAD_END"); - if (!nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, eventsList, NULL)) + if (!nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, eventsList, nullptr)) return; NSK_DISPLAY1("Suspend thread: %p\n", (void*)testedThread); @@ -102,7 +102,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } NSK_DISPLAY1("Disable event: %s\n", "THREAD_END"); - if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, eventsList, NULL)) + if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, eventsList, nullptr)) return; NSK_DISPLAY0("Wait for thread to finish\n"); @@ -124,7 +124,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { JNIEXPORT void JNICALL callbackThreadEnd(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { /* check if event is for tested thread */ - if (thread != NULL && + if (thread != nullptr && jni->IsSameObject(testedThread, thread)) { NSK_DISPLAY1(" ... received THREAD_END event for tested thread: %p\n", (void*)thread); eventsReceived++; @@ -148,7 +148,7 @@ JNIEXPORT jint JNI_OnLoad_resumethrd002(JavaVM *jvm, char *options, void *reserv } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; /* init framework and parse options */ if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) @@ -158,7 +158,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add specific capabilities for suspending thread */ @@ -180,7 +180,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResumeThreadList/resumethrdlst001/resumethrdlst001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResumeThreadList/resumethrdlst001/resumethrdlst001.cpp index b513fa47ec03..3a2374199d94 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResumeThreadList/resumethrdlst001/resumethrdlst001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResumeThreadList/resumethrdlst001/resumethrdlst001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -57,8 +57,8 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { /* perform testing */ { - jthread* threads = NULL; - jvmtiError* results = NULL; + jthread* threads = nullptr; + jvmtiError* results = nullptr; int i; NSK_DISPLAY1("Allocate threads array: %d threads\n", threadsCount); @@ -138,7 +138,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0("Delete threads references\n"); for (i = 0; i < threadsCount; i++) { - if (threads[i] != NULL) + if (threads[i] != nullptr) NSK_TRACE(jni->DeleteGlobalRef(threads[i])); } @@ -164,14 +164,14 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { static int fillThreadsByName(jvmtiEnv* jvmti, JNIEnv* jni, const char name[], int foundCount, jthread foundThreads[]) { jint count = 0; - jthread* threads = NULL; + jthread* threads = nullptr; size_t len = strlen(name); int found = 0; int i; for (i = 0; i < foundCount; i++) { - foundThreads[i] = NULL; + foundThreads[i] = nullptr; } if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&count, &threads))) { @@ -188,7 +188,7 @@ static int fillThreadsByName(jvmtiEnv* jvmti, JNIEnv* jni, break; } - if (info.name != NULL && strncmp(name, info.name, len) == 0) { + if (info.name != nullptr && strncmp(name, info.name, len) == 0) { NSK_DISPLAY3(" ... found thread #%d: %p (%s)\n", found, threads[i], info.name); if (found < foundCount) @@ -216,7 +216,7 @@ static int fillThreadsByName(jvmtiEnv* jvmti, JNIEnv* jni, NSK_DISPLAY1("Make global references for threads: %d threads\n", foundCount); for (i = 0; i < foundCount; i++) { if (!NSK_JNI_VERIFY(jni, (foundThreads[i] = (jthread) - jni->NewGlobalRef(foundThreads[i])) != NULL)) { + jni->NewGlobalRef(foundThreads[i])) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -241,7 +241,7 @@ JNIEXPORT jint JNI_OnLoad_resumethrdlst001(JavaVM *jvm, char *options, void *res } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; /* init framework and parse options */ if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) @@ -256,7 +256,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add specific capabilities for suspending thread */ @@ -269,7 +269,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResumeThreadList/resumethrdlst002/resumethrdlst002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResumeThreadList/resumethrdlst002/resumethrdlst002.cpp index 36caf52c1470..0461cc52f85a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResumeThreadList/resumethrdlst002/resumethrdlst002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/ResumeThreadList/resumethrdlst002/resumethrdlst002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -47,7 +47,7 @@ static jvmtiEvent eventsList[EVENTS_COUNT] = { }; static int threadsCount = 0; -static jthread* threads = NULL; +static jthread* threads = nullptr; static volatile int eventsReceived = 0; static jrawMonitorID eventsReceivedMtx = 0; @@ -67,7 +67,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { /* perform testing */ { - jvmtiError* results = NULL; + jvmtiError* results = nullptr; int i; NSK_DISPLAY1("Allocate threads array: %d threads\n", threadsCount); @@ -106,7 +106,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { eventsReceived = 0; NSK_DISPLAY1("Enable event: %s\n", "THREAD_END"); - if (!nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, eventsList, NULL)) + if (!nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, eventsList, nullptr)) return; NSK_DISPLAY0("Let threads to run and finish\n"); @@ -145,7 +145,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } NSK_DISPLAY1("Disable event: %s\n", "THREAD_END"); - if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, eventsList, NULL)) + if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, eventsList, nullptr)) return; NSK_DISPLAY0("Wait for thread to finish\n"); @@ -154,7 +154,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0("Delete threads references\n"); for (i = 0; i < threadsCount; i++) { - if (threads[i] != NULL) + if (threads[i] != nullptr) NSK_TRACE(jni->DeleteGlobalRef(threads[i])); } @@ -180,14 +180,14 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { static int fillThreadsByName(jvmtiEnv* jvmti, JNIEnv* jni, const char name[], int foundCount, jthread foundThreads[]) { jint count = 0; - jthread* threads = NULL; + jthread* threads = nullptr; size_t len = strlen(name); int found = 0; int i; for (i = 0; i < foundCount; i++) { - foundThreads[i] = NULL; + foundThreads[i] = nullptr; } if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&count, &threads))) { @@ -204,7 +204,7 @@ static int fillThreadsByName(jvmtiEnv* jvmti, JNIEnv* jni, break; } - if (info.name != NULL && strncmp(name, info.name, len) == 0) { + if (info.name != nullptr && strncmp(name, info.name, len) == 0) { NSK_DISPLAY3(" ... found thread #%d: %p (%s)\n", found, threads[i], info.name); if (found < foundCount) @@ -232,7 +232,7 @@ static int fillThreadsByName(jvmtiEnv* jvmti, JNIEnv* jni, NSK_DISPLAY1("Make global references for threads: %d threads\n", foundCount); for (i = 0; i < foundCount; i++) { if (!NSK_JNI_VERIFY(jni, (foundThreads[i] = (jthread) - jni->NewGlobalRef(foundThreads[i])) != NULL)) { + jni->NewGlobalRef(foundThreads[i])) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -257,7 +257,7 @@ callbackThreadEnd(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { /* check if event is for tested thread */ for (i = 0; i < threadsCount; i++) { - if (thread != NULL && + if (thread != nullptr && jni->IsSameObject(threads[i], thread)) { NSK_DISPLAY2(" ... received THREAD_END event for thread #%d: %p\n", i, (void*)thread); @@ -285,7 +285,7 @@ JNIEXPORT jint JNI_OnLoad_resumethrdlst002(JavaVM *jvm, char *options, void *res } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; /* init framework and parse options */ if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) @@ -300,7 +300,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add specific capabilities for suspending thread */ @@ -329,7 +329,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RetransformClasses/retransform002/retransform002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RetransformClasses/retransform002/retransform002.cpp index c9078ea57845..c5801d24e79f 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RetransformClasses/retransform002/retransform002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RetransformClasses/retransform002/retransform002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,13 +24,13 @@ #include #include #include -#include "agent_common.h" -#include -#include "JVMTITools.h" +#include "agent_common.hpp" +#include +#include "JVMTITools.hpp" extern "C" { -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; /* ============================================================================= */ @@ -101,7 +101,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) return JNI_ERR; if (!NSK_VERIFY( - (jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved)) != NULL + (jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved)) != nullptr ) ) return JNI_ERR; @@ -125,7 +125,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) // Enable class retransformation if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, - NULL))) + nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RetransformClasses/retransform003/retransform003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RetransformClasses/retransform003/retransform003.cpp index 4034dc558f86..cda8481533db 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RetransformClasses/retransform003/retransform003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RetransformClasses/retransform003/retransform003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,15 +25,15 @@ #include #include #include -#include "agent_common.h" -#include -#include "JVMTITools.h" +#include "agent_common.hpp" +#include +#include "JVMTITools.hpp" extern "C" { /* ============================================================================= */ -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; /* Class, which contains the following callback method: * static public void callback(String className, int agentID) */ @@ -93,31 +93,31 @@ ClassFileLoadHook ( jstring class_name_string; // Check whether currently retransformed class belongs to the package we are interested in - if (name == NULL || strncmp(TRIGGER, name,strlen(name) < strlen(TRIGGER) ? strlen(name) : strlen(TRIGGER))) + if (name == nullptr || strncmp(TRIGGER, name,strlen(name) < strlen(TRIGGER) ? strlen(name) : strlen(TRIGGER))) { return; } // Get ant the invoke callback function - if (!NSK_VERIFY((loader_class = jni->GetObjectClass(loader)) != NULL)) + if (!NSK_VERIFY((loader_class = jni->GetObjectClass(loader)) != nullptr)) return; if (!NSK_VERIFY((method_id = jni->GetMethodID( - loader_class, "loadClass", "(Ljava/lang/String;)Ljava/lang/Class;")) != NULL)) + loader_class, "loadClass", "(Ljava/lang/String;)Ljava/lang/Class;")) != nullptr)) return; - if (!NSK_VERIFY((class_name_string = jni->NewStringUTF(CALLBACK_CLASS_NAME)) != NULL)) + if (!NSK_VERIFY((class_name_string = jni->NewStringUTF(CALLBACK_CLASS_NAME)) != nullptr)) return; if (!NSK_VERIFY((callback_class = (jclass) jni->CallObjectMethod( - loader, method_id, class_name_string)) != NULL)) + loader, method_id, class_name_string)) != nullptr)) return; if (!NSK_VERIFY((method_id = jni->GetStaticMethodID( - callback_class, "callback", "(Ljava/lang/String;I)V")) != NULL)) + callback_class, "callback", "(Ljava/lang/String;I)V")) != nullptr)) return; - if (!NSK_VERIFY((class_name_string = jni->NewStringUTF(name)) != NULL)) + if (!NSK_VERIFY((class_name_string = jni->NewStringUTF(name)) != nullptr)) return; jni->CallStaticObjectMethod(callback_class, method_id, class_name_string, agent_id); @@ -151,7 +151,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) agent_id= nsk_jvmti_findOptionIntValue("id", -1); - if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved)) != NULL)) + if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved)) != nullptr)) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->GetCapabilities(&caps))) @@ -179,7 +179,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) if (!NSK_JVMTI_VERIFY( jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, - NULL))) + nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RetransformClasses/retransform004/retransform004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RetransformClasses/retransform004/retransform004.cpp index 78a4b31d36f8..6d400b7df297 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RetransformClasses/retransform004/retransform004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RetransformClasses/retransform004/retransform004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,15 +25,15 @@ #include #include #include -#include "agent_common.h" -#include -#include "JVMTITools.h" +#include "agent_common.hpp" +#include +#include "JVMTITools.hpp" extern "C" { /* ============================================================================= */ -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; /* ============================================================================= */ @@ -106,7 +106,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) jvmtiCapabilities caps; if (!NSK_VERIFY( - (jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved)) != NULL + (jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved)) != nullptr ) ) return JNI_ERR; @@ -131,7 +131,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) if (!NSK_JVMTI_VERIFY( jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, - NULL))) + nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RunAgentThread/agentthr001/agentthr001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RunAgentThread/agentthr001/agentthr001.cpp index 775f564f4658..60248189773b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RunAgentThread/agentthr001/agentthr001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RunAgentThread/agentthr001/agentthr001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -34,7 +34,7 @@ extern "C" { #define STATUS_FAILED 2 #define WAIT_TIME (jlong)100 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -92,7 +92,7 @@ sys_thread_1(jvmtiEnv* jvmti, JNIEnv* jni, void *p) { } count |= 0x01; - err = jvmti->RunAgentThread(jthr(jni), sys_thread_4, NULL, + err = jvmti->RunAgentThread(jthr(jni), sys_thread_4, nullptr, JVMTI_THREAD_MAX_PRIORITY); if (err != JVMTI_ERROR_NONE) { printf("(RunAgentThread#4) unexpected error: %s (%d)\n", @@ -178,7 +178,7 @@ void JNICALL VMInit(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thr) { } err = jvmti_env->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_THREAD_START, NULL); + JVMTI_EVENT_THREAD_START, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable JVMTI_EVENT_THREAD_START: %s (%d)\n", TranslateError(err), err); @@ -206,21 +206,21 @@ ThreadStart(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thread) { if (strcmp(thrInfo.name, "thr1") == 0 && !thr1_was_started) { thr1_was_started = 1; err = jvmti_env->RunAgentThread(jthr((JNIEnv *)env), - sys_thread_1, NULL, JVMTI_THREAD_MAX_PRIORITY); + sys_thread_1, nullptr, JVMTI_THREAD_MAX_PRIORITY); if (err != JVMTI_ERROR_NONE) { printf("(RunAgentThread#1) unexpected error: %s (%d)\n", TranslateError(err), err); result = STATUS_FAILED; } err = jvmti_env->RunAgentThread(jthr((JNIEnv *)env), - sys_thread_2, NULL, JVMTI_THREAD_NORM_PRIORITY); + sys_thread_2, nullptr, JVMTI_THREAD_NORM_PRIORITY); if (err != JVMTI_ERROR_NONE) { printf("(RunAgentThread#2) unexpected error: %s (%d)\n", TranslateError(err), err); result = STATUS_FAILED; } err = jvmti_env->RunAgentThread(jthr((JNIEnv *)env), - sys_thread_3, NULL, JVMTI_THREAD_MIN_PRIORITY); + sys_thread_3, nullptr, JVMTI_THREAD_MIN_PRIORITY); if (err != JVMTI_ERROR_NONE) { printf("(RunAgentThread#3) unexpected error: %s (%d)\n", TranslateError(err), err); @@ -244,12 +244,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -271,7 +271,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_VM_INIT, NULL); + JVMTI_EVENT_VM_INIT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable JVMTI_EVENT_VM_INIT: %s (%d)\n", TranslateError(err), err); @@ -285,7 +285,7 @@ JNIEXPORT void JNICALL Java_nsk_jvmti_RunAgentThread_agentthr001_startSysThr(JNIEnv *env, jclass cls) { jvmtiError err; - err = jvmti->RunAgentThread(jthr(env), sys_thread_5, NULL, + err = jvmti->RunAgentThread(jthr(env), sys_thread_5, nullptr, JVMTI_THREAD_MAX_PRIORITY); if (err != JVMTI_ERROR_NONE) { printf("(RunAgentThread#5) unexpected error: %s (%d)\n", @@ -308,7 +308,7 @@ Java_nsk_jvmti_RunAgentThread_agentthr001_getRes(JNIEnv *env, jclass cls) { } err = jvmti->SetEventNotificationMode(JVMTI_DISABLE, - JVMTI_EVENT_THREAD_START, NULL); + JVMTI_EVENT_THREAD_START, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to disable JVMTI_EVENT_THREAD_START: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RunAgentThread/agentthr002/agentthr002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RunAgentThread/agentthr002/agentthr002.cpp index b66836e8ed3c..8c0ea9be4a06 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RunAgentThread/agentthr002/agentthr002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RunAgentThread/agentthr002/agentthr002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; static jrawMonitorID wait_lock; @@ -52,12 +52,12 @@ JNIEXPORT jint JNI_OnLoad_agentthr002(JavaVM *jvm, char *options, void *reserved jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -94,7 +94,7 @@ Java_nsk_jvmti_RunAgentThread_agentthr002_check(JNIEnv *env, jclass cls, jthread jvmtiError err; jvmtiThreadInfo inf; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -109,7 +109,7 @@ Java_nsk_jvmti_RunAgentThread_agentthr002_check(JNIEnv *env, jclass cls, jthread if (printdump == JNI_TRUE) { printf(">>> starting debug thread ...\n"); } - err = jvmti->RunAgentThread(thr, debug_thread, NULL, + err = jvmti->RunAgentThread(thr, debug_thread, nullptr, JVMTI_THREAD_NORM_PRIORITY); if (err != JVMTI_ERROR_NONE) { printf("(RunAgentThread) unexpected error: %s (%d)\n", diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RunAgentThread/agentthr003/agentthr003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RunAgentThread/agentthr003/agentthr003.cpp index 607b9f00557c..61d1729e542a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RunAgentThread/agentthr003/agentthr003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/RunAgentThread/agentthr003/agentthr003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_agentthr003(JavaVM *jvm, char *options, void *reserved jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -75,7 +75,7 @@ JNIEXPORT jint JNICALL Java_nsk_jvmti_RunAgentThread_agentthr003_check(JNIEnv *env, jclass cls, jthread thr) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -83,7 +83,7 @@ Java_nsk_jvmti_RunAgentThread_agentthr003_check(JNIEnv *env, jclass cls, jthread if (printdump == JNI_TRUE) { printf(">>> invalid thread check ...\n"); } - err = jvmti->RunAgentThread(NULL, agent_thread, NULL, + err = jvmti->RunAgentThread(nullptr, agent_thread, nullptr, JVMTI_THREAD_NORM_PRIORITY); if (err != JVMTI_ERROR_INVALID_THREAD) { printf("Error expected: JVMTI_ERROR_INVALID_THREAD,\n"); @@ -94,7 +94,7 @@ Java_nsk_jvmti_RunAgentThread_agentthr003_check(JNIEnv *env, jclass cls, jthread if (printdump == JNI_TRUE) { printf(">>> null pointer check ...\n"); } - err = jvmti->RunAgentThread(thr, NULL, NULL, + err = jvmti->RunAgentThread(thr, nullptr, nullptr, JVMTI_THREAD_NORM_PRIORITY); if (err != JVMTI_ERROR_NULL_POINTER) { printf("Error expected: JVMTI_ERROR_NULL_POINTER,\n"); @@ -105,7 +105,7 @@ Java_nsk_jvmti_RunAgentThread_agentthr003_check(JNIEnv *env, jclass cls, jthread if (printdump == JNI_TRUE) { printf(">>> less than JVMTI_THREAD_MIN_PRIORITY check ...\n"); } - err = jvmti->RunAgentThread(thr, agent_thread, NULL, + err = jvmti->RunAgentThread(thr, agent_thread, nullptr, JVMTI_THREAD_MIN_PRIORITY - 1); if (err != JVMTI_ERROR_INVALID_PRIORITY) { printf("Error expected: JVMTI_ERROR_INVALID_PRIORITY,\n"); @@ -116,7 +116,7 @@ Java_nsk_jvmti_RunAgentThread_agentthr003_check(JNIEnv *env, jclass cls, jthread if (printdump == JNI_TRUE) { printf(">>> greater than JVMTI_THREAD_MAX_PRIORITY check ...\n"); } - err = jvmti->RunAgentThread(thr, agent_thread, NULL, + err = jvmti->RunAgentThread(thr, agent_thread, nullptr, JVMTI_THREAD_MAX_PRIORITY + 1); if (err != JVMTI_ERROR_INVALID_PRIORITY) { printf("Error expected: JVMTI_ERROR_INVALID_PRIORITY,\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk002/setbrk002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk002/setbrk002.cpp index 5bee61958056..835ae6d9ec08 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk002/setbrk002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk002/setbrk002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -53,12 +53,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -97,7 +97,7 @@ Java_nsk_jvmti_SetBreakpoint_setbrk002_check(JNIEnv *env, jclass cls) { jlocation start; jlocation end; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -107,7 +107,7 @@ Java_nsk_jvmti_SetBreakpoint_setbrk002_check(JNIEnv *env, jclass cls) { } mid = env->GetStaticMethodID(cls, "run", "([Ljava/lang/String;Ljava/io/PrintStream;)I"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot find method run\n"); return STATUS_FAILED; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk003/setbrk003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk003/setbrk003.cpp index b996ed3f021a..117bc4f12e54 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk003/setbrk003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk003/setbrk003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -53,12 +53,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -96,7 +96,7 @@ Java_nsk_jvmti_SetBreakpoint_setbrk003_check(JNIEnv *env, jclass cls) { jvmtiError err; jmethodID mid; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -106,7 +106,7 @@ Java_nsk_jvmti_SetBreakpoint_setbrk003_check(JNIEnv *env, jclass cls) { } mid = env->GetStaticMethodID(cls, "check", "()I"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot find method check\n"); return STATUS_FAILED; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk005/setbrk005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk005/setbrk005.cpp index 462cbe0417b8..ece5a09fea45 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk005/setbrk005.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk005/setbrk005.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -53,12 +53,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -96,7 +96,7 @@ Java_nsk_jvmti_SetBreakpoint_setbrk005_check(JNIEnv *env, jclass cls) { jvmtiError err; jmethodID mid; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -106,7 +106,7 @@ Java_nsk_jvmti_SetBreakpoint_setbrk005_check(JNIEnv *env, jclass cls) { } mid = env->GetStaticMethodID(cls, "trial", "()I"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot find method trial\n"); return STATUS_FAILED; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk007/setbrk007.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk007/setbrk007.cpp index 79b93a9fbf70..1cd65eee9cda 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk007/setbrk007.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk007/setbrk007.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -53,12 +53,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -96,7 +96,7 @@ Java_nsk_jvmti_SetBreakpoint_setbrk007_check(JNIEnv *env, jclass cls) { jvmtiError err; jmethodID mid; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -114,7 +114,7 @@ Java_nsk_jvmti_SetBreakpoint_setbrk007_check(JNIEnv *env, jclass cls) { if (printdump == JNI_TRUE) { printf(">>> invalid method check ...\n"); } - err = jvmti->SetBreakpoint(NULL, 0); + err = jvmti->SetBreakpoint(nullptr, 0); if (err != JVMTI_ERROR_INVALID_METHODID) { printf("Error expected: JVMTI_ERROR_INVALID_METHODID,\n"); printf("\tactual: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk008/setbrk008.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk008/setbrk008.cpp index 7d893b36a50f..db43f5675ff8 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk008/setbrk008.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetBreakpoint/setbrk008/setbrk008.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; static jint result = PASSED; @@ -82,17 +82,17 @@ void JNICALL Breakpoint(jvmtiEnv *jvmti_env, JNIEnv *env, printf(">>> method: \"%s%s\"\n", name, sig); printf(">>> location: 0x%x%08x\n", (jint)(loc >> 32), (jint)loc); } - if (name == NULL || strcmp(cls_sig, exp_csig) != 0) { + if (name == nullptr || strcmp(cls_sig, exp_csig) != 0) { printf("(bp#%d) wrong class: \"%s\"", eventsCount, cls_sig); printf(", expected: \"%s\"\n", exp_csig); result = STATUS_FAILED; } - if (name == NULL || strcmp(name, exp_name) != 0) { + if (name == nullptr || strcmp(name, exp_name) != 0) { printf("(bp#%d) wrong method name: \"%s\"", eventsCount, name); printf(", expected: \"%s\"\n", exp_name); result = STATUS_FAILED; } - if (sig == NULL || strcmp(sig, exp_sig) != 0) { + if (sig == nullptr || strcmp(sig, exp_sig) != 0) { printf("(bp#%d) wrong method sig: \"%s\"", eventsCount, sig); printf(", expected: \"%s\"\n", exp_sig); result = STATUS_FAILED; @@ -119,12 +119,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -171,7 +171,7 @@ Java_nsk_jvmti_SetBreakpoint_setbrk008_getReady(JNIEnv *env, jvmtiError err; jmethodID mid; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; @@ -182,7 +182,7 @@ Java_nsk_jvmti_SetBreakpoint_setbrk008_getReady(JNIEnv *env, } mid = env->GetStaticMethodID(cls, exp_name, exp_sig); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot find Method ID for method checkPoint\n"); result = STATUS_FAILED; return; @@ -201,7 +201,7 @@ Java_nsk_jvmti_SetBreakpoint_setbrk008_getReady(JNIEnv *env, } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_BREAKPOINT, NULL); + JVMTI_EVENT_BREAKPOINT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable BREAKPOINT event: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEnvironmentLocalStorage/setenvstor001/setenvstor001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEnvironmentLocalStorage/setenvstor001/setenvstor001.cpp index 98400d75bf72..6244dec42e55 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEnvironmentLocalStorage/setenvstor001/setenvstor001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEnvironmentLocalStorage/setenvstor001/setenvstor001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,9 +24,9 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -85,7 +85,7 @@ static int setEnvStorage(jvmtiEnv* jvmti, StorageStructure* storage, const char * @returns NSK_FALSE if any error occured. */ static int checkEnvStorage(jvmtiEnv* jvmti, StorageStructure* initialStorage, const char where[]) { - StorageStructure* storage = NULL; + StorageStructure* storage = nullptr; NSK_DISPLAY0("Get local storage for current JVMTI env\n"); if (!NSK_JVMTI_VERIFY(jvmti->GetEnvironmentLocalStorage((void**)&storage))) { @@ -170,7 +170,7 @@ callbackVMDeath(jvmtiEnv* jvmti, JNIEnv* jni) { success = checkEnvStorage(jvmti, initialStorage, "VM_DEATH callback"); NSK_DISPLAY1("Disable events: %d events\n", EVENTS_COUNT); - if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, NULL)) { + if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, nullptr)) { success = NSK_FALSE; } else { NSK_DISPLAY0(" ... disabled\n"); @@ -197,7 +197,7 @@ JNIEXPORT jint JNI_OnLoad_setenvstor001(JavaVM *jvm, char *options, void *reserv } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -205,7 +205,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; { @@ -220,7 +220,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; NSK_DISPLAY1(">>> Prepare storage data at pointer: 0x%p\n", initialStorage); @@ -237,7 +237,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } NSK_DISPLAY1("Enable events: %d events\n", EVENTS_COUNT); - if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, NULL)) { + if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, nullptr)) { NSK_DISPLAY0(" ... enabled\n"); } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEnvironmentLocalStorage/setenvstor002/setenvstor002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEnvironmentLocalStorage/setenvstor002/setenvstor002.cpp index 9d53a2ad37a1..f870c0a0deb6 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEnvironmentLocalStorage/setenvstor002/setenvstor002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEnvironmentLocalStorage/setenvstor002/setenvstor002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,9 +24,9 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -85,7 +85,7 @@ static int setEnvStorage(jvmtiEnv* jvmti, StorageStructure* storage, const char * @returns NSK_FALSE if any error occured. */ static int checkEnvStorage(jvmtiEnv* jvmti, StorageStructure* initialStorage, const char where[]) { - StorageStructure* storage = NULL; + StorageStructure* storage = nullptr; NSK_DISPLAY0("Get local storage for current JVMTI env\n"); if (!NSK_JVMTI_VERIFY(jvmti->GetEnvironmentLocalStorage((void**)&storage))) { @@ -175,7 +175,7 @@ callbackVMDeath(jvmtiEnv* jvmti, JNIEnv* jni) { success = checkEnvStorage(jvmti, initialStorage, "VM_DEATH callback"); NSK_DISPLAY1("Disable events: %d events\n", EVENTS_COUNT); - if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, NULL)) { + if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, nullptr)) { success = NSK_FALSE; } else { NSK_DISPLAY0(" ... disabled\n"); @@ -202,7 +202,7 @@ JNIEXPORT jint JNI_OnLoad_setenvstor002(JavaVM *jvm, char *options, void *reserv } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -210,7 +210,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; { @@ -225,14 +225,14 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; NSK_DISPLAY1(">>> Prepare storage data at pointer: 0x%p\n", initialStorage); fillEnvStorage(initialStorage); NSK_DISPLAY1("Enable events: %d events\n", EVENTS_COUNT); - if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, NULL)) { + if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, nullptr)) { NSK_DISPLAY0(" ... enabled\n"); } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEnvironmentLocalStorage/setenvstor003/setenvstor003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEnvironmentLocalStorage/setenvstor003/setenvstor003.cpp index 6c3ec2145a35..e907967a2fad 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEnvironmentLocalStorage/setenvstor003/setenvstor003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEnvironmentLocalStorage/setenvstor003/setenvstor003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,9 +24,9 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -85,7 +85,7 @@ static int setEnvStorage(jvmtiEnv* jvmti, StorageStructure* storage, const char * @returns NSK_FALSE if any error occured. */ static int checkEnvStorage(jvmtiEnv* jvmti, StorageStructure* initialStorage, const char where[]) { - StorageStructure* storage = NULL; + StorageStructure* storage = nullptr; NSK_DISPLAY0("Get local storage for current JVMTI env\n"); if (!NSK_JVMTI_VERIFY(jvmti->GetEnvironmentLocalStorage((void**)&storage))) { @@ -178,7 +178,7 @@ callbackVMDeath(jvmtiEnv* jvmti, JNIEnv* jni) { success = checkEnvStorage(jvmti, initialStorage, "VM_DEATH callback"); NSK_DISPLAY1("Disable events: %d events\n", EVENTS_COUNT); - if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, NULL)) { + if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, nullptr)) { success = NSK_FALSE; } else { NSK_DISPLAY0(" ... disabled\n"); @@ -205,7 +205,7 @@ JNIEXPORT jint JNI_OnLoad_setenvstor003(JavaVM *jvm, char *options, void *reserv } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -213,7 +213,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; { @@ -228,14 +228,14 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; NSK_DISPLAY1(">>> Prepare storage data at pointer: 0x%p\n", initialStorage); fillEnvStorage(initialStorage); NSK_DISPLAY1("Enable events: %d events\n", EVENTS_COUNT); - if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, NULL)) { + if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, nullptr)) { NSK_DISPLAY0(" ... enabled\n"); } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEventCallbacks/setevntcallb001/setevntcallb001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEventCallbacks/setevntcallb001/setevntcallb001.cpp index 9b15148fe197..1f7e06b04a71 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEventCallbacks/setevntcallb001/setevntcallb001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEventCallbacks/setevntcallb001/setevntcallb001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -101,7 +101,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } NSK_DISPLAY0("Disable events\n"); - nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, eventsList, NULL); + nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, eventsList, nullptr); NSK_DISPLAY0("Let debugee to finish\n"); if (!nsk_jvmti_resumeSync()) @@ -146,7 +146,7 @@ callbackVMInit(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) { nsk_jvmti_setFailStatus(); } else { - nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT - 1, eventsList + 1, NULL); + nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT - 1, eventsList + 1, nullptr); } } } @@ -166,7 +166,7 @@ JNIEXPORT jint JNI_OnLoad_setevntcallb001(JavaVM *jvm, char *options, void *rese } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -174,10 +174,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; NSK_DISPLAY0(">>> Testcase #1: Set callbacks for VM_INIT event\n"); @@ -191,7 +191,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) { nsk_jvmti_setFailStatus(); } else { - nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, eventsList, NULL); + nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, eventsList, nullptr); } } return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEventCallbacks/setevntcallb002/setevntcallb002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEventCallbacks/setevntcallb002/setevntcallb002.cpp index 65f8a2fd3f46..f35f623e66bd 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEventCallbacks/setevntcallb002/setevntcallb002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEventCallbacks/setevntcallb002/setevntcallb002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -83,7 +83,7 @@ static int checkEventCounts() { for (i = 1; i < EVENTS_COUNT; i++) { if (eventsCountList[i] > 0) { - NSK_COMPLAIN2("# %s event callback was invoked after SetEventCallbacks(NULL):\n" + NSK_COMPLAIN2("# %s event callback was invoked after SetEventCallbacks(null):\n" "# invoked: %d times\n", eventsNameList[i], eventsCountList[i]); success = NSK_FALSE; @@ -108,7 +108,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } NSK_DISPLAY0("Disable events\n"); - nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, eventsList, NULL); + nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, eventsList, nullptr); NSK_DISPLAY0("Let debugee to finish\n"); if (!nsk_jvmti_resumeSync()) @@ -143,13 +143,13 @@ callbackVMInit(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { NSK_DISPLAY1(" : thread: 0x%p\n", (void*)thread); eventsCountList[0]++; - NSK_DISPLAY0(">>> Testcase #2: Set NULL for events callbacks\n"); + NSK_DISPLAY0(">>> Testcase #2: Set null for events callbacks\n"); { - if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(NULL, 0))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(nullptr, 0))) { nsk_jvmti_setFailStatus(); } - nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT - 1, eventsList + 1, NULL); + nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT - 1, eventsList + 1, nullptr); } } @@ -168,7 +168,7 @@ JNIEXPORT jint JNI_OnLoad_setevntcallb002(JavaVM *jvm, char *options, void *rese } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -176,10 +176,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; NSK_DISPLAY0(">>> Testcase #1: Set callbacks for all tested events\n"); @@ -195,7 +195,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) { nsk_jvmti_setFailStatus(); } else { - nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, eventsList, NULL); + nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, eventsList, nullptr); } } return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEventCallbacks/setevntcallb003/setevntcallb003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEventCallbacks/setevntcallb003/setevntcallb003.cpp index 72511c6776df..daf2ffdc6fbf 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEventCallbacks/setevntcallb003/setevntcallb003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEventCallbacks/setevntcallb003/setevntcallb003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -108,7 +108,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } NSK_DISPLAY0("Disable events\n"); - nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, eventsList, NULL); + nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, eventsList, nullptr); NSK_DISPLAY0("Let debugee to finish\n"); if (!nsk_jvmti_resumeSync()) @@ -155,7 +155,7 @@ callbackVMInit(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { nsk_jvmti_setFailStatus(); } - nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT - 1, eventsList + 1, NULL); + nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT - 1, eventsList + 1, nullptr); } } @@ -174,7 +174,7 @@ JNIEXPORT jint JNI_OnLoad_setevntcallb003(JavaVM *jvm, char *options, void *rese } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -182,10 +182,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; NSK_DISPLAY0(">>> Testcase #1: Set callbacks for all tested events\n"); @@ -199,7 +199,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) { nsk_jvmti_setFailStatus(); } else { - nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, eventsList, NULL); + nsk_jvmti_enableEvents(JVMTI_ENABLE, 1, eventsList, nullptr); } } return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEventNotificationMode/setnotif001/setnotif001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEventNotificationMode/setnotif001/setnotif001.cpp index 135f51a86f96..fd54a60fe5ab 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEventNotificationMode/setnotif001/setnotif001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetEventNotificationMode/setnotif001/setnotif001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -34,11 +34,11 @@ extern "C" { #define STATUS_FAILED 2 #define SCALE_SIZE (JVMTI_MAX_EVENT_TYPE_VAL + 1) -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; static jrawMonitorID access_lock; -static jobject notifyFramePopThread = NULL; +static jobject notifyFramePopThread = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; static int flag = 0; @@ -78,7 +78,7 @@ void disable(jvmtiEnv *jvmti_env, jvmtiEvent kind) { printf(">>> disabling %s\n", TranslateEvent(kind)); } err = jvmti_env->SetEventNotificationMode( - JVMTI_DISABLE, kind, NULL); + JVMTI_DISABLE, kind, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Fail to disable %s: %s (%d)\n", TranslateEvent(kind), TranslateError(err), err); @@ -99,7 +99,7 @@ void enable(jvmtiEnv *jvmti_env, jvmtiEvent kind) { result = STATUS_FAILED; } err = jvmti_env->SetEventNotificationMode( - JVMTI_ENABLE, kind, NULL); + JVMTI_ENABLE, kind, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Fail to enable %s: %s (%d)\n", TranslateEvent(kind), TranslateError(err), err); @@ -121,8 +121,8 @@ void setWatches(jvmtiEnv *jvmti_env, JNIEnv *env, jclass cls) { jmethodID mid; mid = env->GetStaticMethodID(cls, "meth01", "(I)V"); - if (mid == NULL) { - printf("(GetStaticMethodID) returns NULL"); + if (mid == nullptr) { + printf("(GetStaticMethodID) returns null"); result = STATUS_FAILED; return; } @@ -309,7 +309,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } @@ -317,7 +317,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { memset(ev_scale, 0, SCALE_SIZE); res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetExtensionEventCallback/setextevent001/setextevent001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetExtensionEventCallback/setextevent001/setextevent001.cpp index 9088e6047f28..ec1e3d212769 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetExtensionEventCallback/setextevent001/setextevent001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetExtensionEventCallback/setextevent001/setextevent001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -44,7 +44,7 @@ callbackExtensionEvent(jvmtiEnv* jvmti, ...) { static int checkExtensions(jvmtiEnv* jvmti, const char phase[]) { int success = NSK_TRUE; jint extCount = 0; - jvmtiExtensionEventInfo* extList = NULL; + jvmtiExtensionEventInfo* extList = nullptr; int i; NSK_DISPLAY0("Get extension events list\n"); @@ -58,7 +58,7 @@ static int checkExtensions(jvmtiEnv* jvmti, const char phase[]) { NSK_DISPLAY1("# WARNING: No extension events implemented to check: %d\n", extCount); } else { - if (!NSK_VERIFY(extList != NULL)) + if (!NSK_VERIFY(extList != nullptr)) return NSK_FALSE; NSK_DISPLAY1("Set/clear callback for each extension event: %d events\n", (int)extCount); @@ -76,9 +76,9 @@ static int checkExtensions(jvmtiEnv* jvmti, const char phase[]) { } NSK_DISPLAY0(" ... done\n"); - NSK_DISPLAY1(" ... clearing callback: 0x%p\n", (void*)NULL); + NSK_DISPLAY1(" ... clearing callback: 0x%p\n", nullptr); if (!NSK_JVMTI_VERIFY( - jvmti->SetExtensionEventCallback(extList[i].extension_event_index, NULL))) { + jvmti->SetExtensionEventCallback(extList[i].extension_event_index, nullptr))) { success = NSK_FALSE; } NSK_DISPLAY0(" ... done\n"); @@ -130,7 +130,7 @@ JNIEXPORT jint JNI_OnLoad_setextevent001(JavaVM *jvm, char *options, void *reser } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -138,7 +138,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; NSK_DISPLAY0(">>> Testcase #1: Check setting extension event callbacks in OnLoad phase\n"); @@ -148,7 +148,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw001/setfldw001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw001/setfldw001.cpp index ddd5ed6e82c7..57286ce78a02 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw001/setfldw001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw001/setfldw001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -48,12 +48,12 @@ static jvmtiEventCallbacks callbacks; static jvmtiCapabilities caps; static jint result = PASSED; static field fields[] = { - { "nsk/jvmti/SetFieldAccessWatch/setfldw001", "fld0", "I", 0, NULL, NULL }, - { "nsk/jvmti/SetFieldAccessWatch/setfldw001", "fld1", "I", 1, NULL, NULL }, + { "nsk/jvmti/SetFieldAccessWatch/setfldw001", "fld0", "I", 0, nullptr, nullptr }, + { "nsk/jvmti/SetFieldAccessWatch/setfldw001", "fld1", "I", 1, nullptr, nullptr }, { "nsk/jvmti/SetFieldAccessWatch/setfldw001", "fld2", - "Lnsk/jvmti/SetFieldAccessWatch/setfldw001a;", 0, NULL, NULL }, - { "nsk/jvmti/SetFieldAccessWatch/setfldw001a", "fld3", "[I", 0, NULL, NULL }, - { "nsk/jvmti/SetFieldAccessWatch/setfldw001b", "fld4", "F", 0, NULL, NULL }, + "Lnsk/jvmti/SetFieldAccessWatch/setfldw001a;", 0, nullptr, nullptr }, + { "nsk/jvmti/SetFieldAccessWatch/setfldw001a", "fld3", "[I", 0, nullptr, nullptr }, + { "nsk/jvmti/SetFieldAccessWatch/setfldw001b", "fld4", "F", 0, nullptr, nullptr }, }; void setWatch(JNIEnv *env, jint ind) { @@ -62,12 +62,12 @@ void setWatch(JNIEnv *env, jint ind) { field fld = fields[ind]; cls = env->FindClass(fld.klass); - if (cls == NULL) { + if (cls == nullptr) { printf("Cannot find class \"%s\"\n", fld.klass); result = STATUS_FAILED; return; } - if (fld.fid == NULL) { + if (fld.fid == nullptr) { if (fld.stat) { fields[ind].fid = env->GetStaticFieldID(cls, fld.name, fld.sig); } else { @@ -90,18 +90,18 @@ void JNICALL FieldAccess(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thr, jmethodID method, jlocation location, jclass field_klass, jobject obj, jfieldID field) { - char *fld_name = NULL; + char *fld_name = nullptr; jint fld_ind = 0; size_t len = 0; jvmtiError err = jvmti_env->GetFieldName(field_klass, field, - &fld_name, NULL, NULL); + &fld_name, nullptr, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Error in GetFieldName: %s (%d)\n", TranslateError(err), err); result = STATUS_FAILED; return; } - if (fld_name == NULL) { - printf("GetFieldName returned NULL field name\n"); + if (fld_name == nullptr) { + printf("GetFieldName returned null field name\n"); result = STATUS_FAILED; return; } @@ -133,7 +133,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } @@ -169,7 +169,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_FIELD_ACCESS, NULL); + JVMTI_EVENT_FIELD_ACCESS, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable JVMTI_EVENT_FIELD_ACCESS: %s (%d)\n", TranslateError(err), err); @@ -203,7 +203,7 @@ Java_nsk_jvmti_SetFieldAccessWatch_setfldw001_check(JNIEnv *env, jfieldID thrown_fid = fields[fld_ind].thrown_fid; if (caps.can_generate_field_access_events) { - if (flag == JNI_FALSE && thrown_fid != NULL) { + if (flag == JNI_FALSE && thrown_fid != nullptr) { result = STATUS_FAILED; printf("(Field %d) FIELD_ACCESS event without access watch set\n", fld_ind); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw002/setfldw002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw002/setfldw002.cpp index 11161cffd8a8..557412d70511 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw002/setfldw002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw002/setfldw002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -59,7 +59,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } @@ -95,7 +95,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_FIELD_ACCESS, NULL); + JVMTI_EVENT_FIELD_ACCESS, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable JVMTI_EVENT_FIELD_ACCESS: %s (%d)\n", TranslateError(err), err); @@ -123,14 +123,14 @@ Java_nsk_jvmti_SetFieldAccessWatch_setfldw002_check(JNIEnv *env, jclass cls) { printf(" %s (%d)\n", TranslateError(err), err); } } else { - err = jvmti->SetFieldAccessWatch(NULL, fid); + err = jvmti->SetFieldAccessWatch(nullptr, fid); if (err != JVMTI_ERROR_INVALID_CLASS) { result = STATUS_FAILED; printf("Failed to return JVMTI_ERROR_INVALID_CLASS: %s (%d)\n", TranslateError(err), err); } - err = jvmti->SetFieldAccessWatch(cls, NULL); + err = jvmti->SetFieldAccessWatch(cls, nullptr); if (err != JVMTI_ERROR_INVALID_FIELDID) { result = STATUS_FAILED; printf("Failed to return JVMTI_ERROR_INVALID_FIELDID: %s (%d)\n", diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw003/setfldw003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw003/setfldw003.cpp index 303888a53ccf..f77a95c81d07 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw003/setfldw003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw003/setfldw003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -39,8 +39,8 @@ static jvmtiEventCallbacks callbacks; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; -static jfieldID actual_fid = NULL; -static jfieldID fids[4] = { NULL, NULL, NULL, NULL }; +static jfieldID actual_fid = nullptr; +static jfieldID fids[4] = { nullptr, nullptr, nullptr, nullptr }; void JNICALL FieldAccess(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thr, jmethodID method, @@ -66,12 +66,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } @@ -126,7 +126,7 @@ Java_nsk_jvmti_SetFieldAccessWatch_setfldw003_getReady(JNIEnv *env, jclass cls) fids[2] = env->GetFieldID(cls, "fld2", "I"); fids[3] = env->GetFieldID(cls, "fld3", "I"); for (i = 0; i < sizeof(fids) / sizeof(jfieldID); i++) { - if (fids[i] == NULL) { + if (fids[i] == nullptr) { printf("Unable to set field access watch on fld%" PRIuPTR ", fieldID=0", i); } else { if (printdump == JNI_TRUE) { @@ -142,7 +142,7 @@ Java_nsk_jvmti_SetFieldAccessWatch_setfldw003_getReady(JNIEnv *env, jclass cls) } } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_FIELD_ACCESS, NULL); + JVMTI_EVENT_FIELD_ACCESS, nullptr); if (err != JVMTI_ERROR_NONE) { printf("(SetEventNotificationMode) unexpected error: %s (%d)\n", TranslateError(err), err); @@ -161,7 +161,7 @@ Java_nsk_jvmti_SetFieldAccessWatch_setfldw003_check(JNIEnv *env, printf("Field fld%d: thrown field ID expected=0x%p, actual=0x%p\n", ind, fids[ind], actual_fid); } - actual_fid = NULL; + actual_fid = nullptr; } JNIEXPORT jint JNICALL diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw004/setfldw004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw004/setfldw004.cpp index a09bc425576e..c6f7bc9ddb10 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw004/setfldw004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw004/setfldw004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -39,8 +39,8 @@ static jvmtiEventCallbacks callbacks; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; -static jfieldID actual_fid = NULL; -static jfieldID fids[4] = { NULL, NULL, NULL, NULL }; +static jfieldID actual_fid = nullptr; +static jfieldID fids[4] = { nullptr, nullptr, nullptr, nullptr }; void JNICALL FieldAccess(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thr, jmethodID method, @@ -66,12 +66,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } @@ -133,7 +133,7 @@ Java_nsk_jvmti_SetFieldAccessWatch_setfldw004_getReady(JNIEnv *env, jclass cls) fids[2] = env->GetFieldID(cls, "fld2", "I"); fids[3] = env->GetFieldID(cls, "fld3", "I"); for (i = 0; i < sizeof(fids) / sizeof(jfieldID); i++) { - if (fids[i] == NULL) { + if (fids[i] == nullptr) { printf("Unable to set field access watch on fld%" PRIuPTR ", fieldID=0", i); } else { if (printdump == JNI_TRUE) { @@ -149,7 +149,7 @@ Java_nsk_jvmti_SetFieldAccessWatch_setfldw004_getReady(JNIEnv *env, jclass cls) } } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_FIELD_ACCESS, NULL); + JVMTI_EVENT_FIELD_ACCESS, nullptr); if (err != JVMTI_ERROR_NONE) { printf("(SetEventNotificationMode) unexpected error: %s (%d)\n", TranslateError(err), err); @@ -168,7 +168,7 @@ Java_nsk_jvmti_SetFieldAccessWatch_setfldw004_check(JNIEnv *env, printf("Field %d: thrown field ID expected=0x%p, actual=0x%p\n", ind, fids[ind], actual_fid); } - actual_fid = NULL; + actual_fid = nullptr; } JNIEXPORT jint JNICALL diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw005/setfldw005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw005/setfldw005.cpp index bc7daad4c70e..7222d2a73c6d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw005/setfldw005.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw005/setfldw005.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -47,24 +47,24 @@ static jvmtiEventCallbacks callbacks; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; -static jfieldID actual_fid = NULL; +static jfieldID actual_fid = nullptr; static field fields[] = { - { "fld0", "J", JNI_TRUE, NULL, "static long" }, - { "fld1", "J", JNI_FALSE, NULL, "long" }, - { "fld2", "F", JNI_TRUE, NULL, "static float" }, - { "fld3", "F", JNI_FALSE, NULL, "float" }, - { "fld4", "D", JNI_TRUE, NULL, "static double" }, - { "fld5", "D", JNI_FALSE, NULL, "double" }, - { "fld6", "Ljava/lang/Object;", JNI_TRUE, NULL, "static Object" }, - { "fld7", "Ljava/lang/Object;", JNI_FALSE, NULL, "Object" }, - { "fld8", "Z", JNI_TRUE, NULL, "static boolean" }, - { "fld9", "Z", JNI_FALSE, NULL, "boolean" }, - { "fld10", "B", JNI_TRUE, NULL, "static byte" }, - { "fld11", "B", JNI_FALSE, NULL, "byte" }, - { "fld12", "S", JNI_TRUE, NULL, "static short" }, - { "fld13", "S", JNI_FALSE, NULL, "short" }, - { "fld14", "C", JNI_TRUE, NULL, "static char" }, - { "fld15", "C", JNI_FALSE, NULL, "char" } + { "fld0", "J", JNI_TRUE, nullptr, "static long" }, + { "fld1", "J", JNI_FALSE, nullptr, "long" }, + { "fld2", "F", JNI_TRUE, nullptr, "static float" }, + { "fld3", "F", JNI_FALSE, nullptr, "float" }, + { "fld4", "D", JNI_TRUE, nullptr, "static double" }, + { "fld5", "D", JNI_FALSE, nullptr, "double" }, + { "fld6", "Ljava/lang/Object;", JNI_TRUE, nullptr, "static Object" }, + { "fld7", "Ljava/lang/Object;", JNI_FALSE, nullptr, "Object" }, + { "fld8", "Z", JNI_TRUE, nullptr, "static boolean" }, + { "fld9", "Z", JNI_FALSE, nullptr, "boolean" }, + { "fld10", "B", JNI_TRUE, nullptr, "static byte" }, + { "fld11", "B", JNI_FALSE, nullptr, "byte" }, + { "fld12", "S", JNI_TRUE, nullptr, "static short" }, + { "fld13", "S", JNI_FALSE, nullptr, "short" }, + { "fld14", "C", JNI_TRUE, nullptr, "static char" }, + { "fld15", "C", JNI_FALSE, nullptr, "char" } }; void JNICALL FieldAccess(jvmtiEnv *jvmti_env, JNIEnv *env, @@ -91,12 +91,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } @@ -159,7 +159,7 @@ Java_nsk_jvmti_SetFieldAccessWatch_setfldw005_getReady(JNIEnv *env, jclass cls) } else { fields[i].fid = env->GetFieldID(cls, fields[i].name, fields[i].sig); } - if (fields[i].fid == NULL) { + if (fields[i].fid == nullptr) { printf("Unable to set access watch on %s fld%" PRIuPTR ", fieldID=0", fields[i].descr, i); } else { @@ -176,7 +176,7 @@ Java_nsk_jvmti_SetFieldAccessWatch_setfldw005_getReady(JNIEnv *env, jclass cls) } } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_FIELD_ACCESS, NULL); + JVMTI_EVENT_FIELD_ACCESS, nullptr); if (err != JVMTI_ERROR_NONE) { printf("(SetEventNotificationMode) unexpected error: %s (%d)\n", TranslateError(err), err); @@ -195,7 +195,7 @@ Java_nsk_jvmti_SetFieldAccessWatch_setfldw005_check(JNIEnv *env, printf("Field %s fld%d: thrown field ID expected=0x%p, actual=0x%p\n", fields[ind].descr, ind, fields[ind].fid, actual_fid); } - actual_fid = NULL; + actual_fid = nullptr; } JNIEXPORT jint JNICALL diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw006/setfldw006.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw006/setfldw006.cpp index c70c9176a97f..defe0959f164 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw006/setfldw006.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldAccessWatch/setfldw006/setfldw006.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -43,34 +43,34 @@ typedef struct { jint count; } watch_info; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; static int missesCount = 0; static watch_info watches[] = { - { NULL, "staticBoolean", "Z", JNI_TRUE, 0, 0 }, - { NULL, "staticByte", "B", JNI_TRUE, 0, 0 }, - { NULL, "staticShort", "S", JNI_TRUE, 0, 0 }, - { NULL, "staticInt", "I", JNI_TRUE, 0, 0 }, - { NULL, "staticLong", "J", JNI_TRUE, 0, 0 }, - { NULL, "staticFloat", "F", JNI_TRUE, 0, 0 }, - { NULL, "staticDouble", "D", JNI_TRUE, 0, 0 }, - { NULL, "staticChar", "C", JNI_TRUE, 0, 0 }, - { NULL, "staticObject", "Ljava/lang/Object;", JNI_TRUE, 0, 0 }, - { NULL, "staticArrInt", "[I", JNI_TRUE, 0, 0 }, - - { NULL, "instanceBoolean", "Z", JNI_FALSE, 0, 0 }, - { NULL, "instanceByte", "B", JNI_FALSE, 0, 0 }, - { NULL, "instanceShort", "S", JNI_FALSE, 0, 0 }, - { NULL, "instanceInt", "I", JNI_FALSE, 0, 0 }, - { NULL, "instanceLong", "J", JNI_FALSE, 0, 0 }, - { NULL, "instanceFloat", "F", JNI_FALSE, 0, 0 }, - { NULL, "instanceDouble", "D", JNI_FALSE, 0, 0 }, - { NULL, "instanceChar", "C", JNI_FALSE, 0, 0 }, - { NULL, "instanceObject", "Ljava/lang/Object;", JNI_FALSE, 0, 0 }, - { NULL, "instanceArrInt", "[I", JNI_FALSE, 0, 0 } + { nullptr, "staticBoolean", "Z", JNI_TRUE, 0, 0 }, + { nullptr, "staticByte", "B", JNI_TRUE, 0, 0 }, + { nullptr, "staticShort", "S", JNI_TRUE, 0, 0 }, + { nullptr, "staticInt", "I", JNI_TRUE, 0, 0 }, + { nullptr, "staticLong", "J", JNI_TRUE, 0, 0 }, + { nullptr, "staticFloat", "F", JNI_TRUE, 0, 0 }, + { nullptr, "staticDouble", "D", JNI_TRUE, 0, 0 }, + { nullptr, "staticChar", "C", JNI_TRUE, 0, 0 }, + { nullptr, "staticObject", "Ljava/lang/Object;", JNI_TRUE, 0, 0 }, + { nullptr, "staticArrInt", "[I", JNI_TRUE, 0, 0 }, + + { nullptr, "instanceBoolean", "Z", JNI_FALSE, 0, 0 }, + { nullptr, "instanceByte", "B", JNI_FALSE, 0, 0 }, + { nullptr, "instanceShort", "S", JNI_FALSE, 0, 0 }, + { nullptr, "instanceInt", "I", JNI_FALSE, 0, 0 }, + { nullptr, "instanceLong", "J", JNI_FALSE, 0, 0 }, + { nullptr, "instanceFloat", "F", JNI_FALSE, 0, 0 }, + { nullptr, "instanceDouble", "D", JNI_FALSE, 0, 0 }, + { nullptr, "instanceChar", "C", JNI_FALSE, 0, 0 }, + { nullptr, "instanceObject", "Ljava/lang/Object;", JNI_FALSE, 0, 0 }, + { nullptr, "instanceArrInt", "[I", JNI_FALSE, 0, 0 } }; @@ -103,12 +103,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -162,7 +162,7 @@ Java_nsk_jvmti_SetFieldAccessWatch_setfldw006_getReady(JNIEnv *env, jvmtiError err; size_t i; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; @@ -191,7 +191,7 @@ Java_nsk_jvmti_SetFieldAccessWatch_setfldw006_getReady(JNIEnv *env, } } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_FIELD_ACCESS, NULL); + JVMTI_EVENT_FIELD_ACCESS, nullptr); if (err != JVMTI_ERROR_NONE) { printf("(SetEventNotificationMode) unexpected error: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw001/setfmodw001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw001/setfmodw001.cpp index c7ec0e650354..28851bc68380 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw001/setfmodw001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw001/setfmodw001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -48,12 +48,12 @@ static jvmtiEventCallbacks callbacks; static jvmtiCapabilities caps; static jint result = PASSED; static field fields[] = { - { "nsk/jvmti/SetFieldModificationWatch/setfmodw001", "fld0", "I", 0, NULL, NULL }, - { "nsk/jvmti/SetFieldModificationWatch/setfmodw001", "fld1", "I", 1, NULL, NULL }, + { "nsk/jvmti/SetFieldModificationWatch/setfmodw001", "fld0", "I", 0, nullptr, nullptr }, + { "nsk/jvmti/SetFieldModificationWatch/setfmodw001", "fld1", "I", 1, nullptr, nullptr }, { "nsk/jvmti/SetFieldModificationWatch/setfmodw001", "fld2", - "Lnsk/jvmti/SetFieldModificationWatch/setfmodw001a;", 0, NULL, NULL }, - { "nsk/jvmti/SetFieldModificationWatch/setfmodw001a", "fld3", "[I", 0, NULL, NULL }, - { "nsk/jvmti/SetFieldModificationWatch/setfmodw001b", "fld4", "F", 0, NULL, NULL }, + "Lnsk/jvmti/SetFieldModificationWatch/setfmodw001a;", 0, nullptr, nullptr }, + { "nsk/jvmti/SetFieldModificationWatch/setfmodw001a", "fld3", "[I", 0, nullptr, nullptr }, + { "nsk/jvmti/SetFieldModificationWatch/setfmodw001b", "fld4", "F", 0, nullptr, nullptr }, }; void setWatch(JNIEnv *env, jint ind) { @@ -61,7 +61,7 @@ void setWatch(JNIEnv *env, jint ind) { jvmtiError err; cls = env->FindClass(fields[ind].klass); - if (fields[ind].fid == NULL) { + if (fields[ind].fid == nullptr) { if (fields[ind].stat) { fields[ind].fid = env->GetStaticFieldID(cls, fields[ind].name, fields[ind].sig); } else { @@ -84,18 +84,18 @@ void JNICALL FieldModification(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thr, jmethodID method, jlocation location, jclass field_klass, jobject obj, jfieldID field, char sig, jvalue new_value) { - char *fld_name = NULL; + char *fld_name = nullptr; jint fld_ind = 0; size_t len = 0; jvmtiError err = jvmti_env->GetFieldName(field_klass, field, - &fld_name, NULL, NULL); + &fld_name, nullptr, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Error in GetFieldName: %s (%d)\n", TranslateError(err), err); result = STATUS_FAILED; return; } - if (fld_name == NULL) { - printf("GetFieldName returned NULL field name\n"); + if (fld_name == nullptr) { + printf("GetFieldName returned null field name\n"); result = STATUS_FAILED; return; } @@ -127,7 +127,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } @@ -163,7 +163,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_FIELD_MODIFICATION, NULL); + JVMTI_EVENT_FIELD_MODIFICATION, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable JVMTI_EVENT_FIELD_MODIFICATION: %s (%d)\n", TranslateError(err), err); @@ -195,7 +195,7 @@ Java_nsk_jvmti_SetFieldModificationWatch_setfmodw001_check(JNIEnv *env, jfieldID thrown_fid = fields[fld_ind].thrown_fid; if (caps.can_generate_field_modification_events) { - if (flag == JNI_FALSE && thrown_fid != NULL) { + if (flag == JNI_FALSE && thrown_fid != nullptr) { result = STATUS_FAILED; printf("(Field %d) FieldModification without modification watch set\n", fld_ind); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw002/setfmodw002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw002/setfmodw002.cpp index 3f33f677991e..02ed16ce3470 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw002/setfmodw002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw002/setfmodw002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -59,7 +59,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } @@ -95,7 +95,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_FIELD_MODIFICATION, NULL); + JVMTI_EVENT_FIELD_MODIFICATION, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable JVMTI_EVENT_FIELD_MODIFICATION: %s (%d)\n", TranslateError(err), err); @@ -115,8 +115,8 @@ Java_nsk_jvmti_SetFieldModificationWatch_setfmodw002_check(JNIEnv *env, jfieldID fid; fid = env->GetStaticFieldID(cls, "fld1", "I"); - if (fid == NULL) { - printf("(GetStaticFieldID) returns NULL"); + if (fid == nullptr) { + printf("(GetStaticFieldID) returns null"); result = STATUS_FAILED; return result; } @@ -129,14 +129,14 @@ Java_nsk_jvmti_SetFieldModificationWatch_setfmodw002_check(JNIEnv *env, printf(" %s (%d)\n", TranslateError(err), err); } } else { - err = jvmti->SetFieldModificationWatch(NULL, fid); + err = jvmti->SetFieldModificationWatch(nullptr, fid); if (err != JVMTI_ERROR_INVALID_CLASS) { result = STATUS_FAILED; printf("Failed to return JVMTI_ERROR_INVALID_CLASS: %s (%d)\n", TranslateError(err), err); } - err = jvmti->SetFieldModificationWatch(cls, NULL); + err = jvmti->SetFieldModificationWatch(cls, nullptr); if (err != JVMTI_ERROR_INVALID_FIELDID) { result = STATUS_FAILED; printf("Failed to return JVMTI_ERROR_INVALID_FIELDID: %s (%d)\n", diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw003/setfmodw003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw003/setfmodw003.cpp index 987fb90913a0..5bfcbe73a4e3 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw003/setfmodw003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw003/setfmodw003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -47,14 +47,14 @@ static jvmtiEventCallbacks callbacks; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; -static jfieldID actual_fid = NULL; +static jfieldID actual_fid = nullptr; static char actual_sig = '\0'; static jint actual_val = 0; static field flds[] = { - { "fld0", 'I', JNI_TRUE, 42, NULL }, - { "fld1", 'I', JNI_TRUE, 43, NULL }, - { "fld2", 'I', JNI_FALSE, 44, NULL }, - { "fld3", 'I', JNI_FALSE, 45, NULL } + { "fld0", 'I', JNI_TRUE, 42, nullptr }, + { "fld1", 'I', JNI_TRUE, 43, nullptr }, + { "fld2", 'I', JNI_FALSE, 44, nullptr }, + { "fld3", 'I', JNI_FALSE, 45, nullptr } }; void JNICALL FieldModification(jvmtiEnv *jvmti_env, JNIEnv *env, @@ -84,12 +84,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } @@ -146,7 +146,7 @@ Java_nsk_jvmti_SetFieldModificationWatch_setfmodw003_getReady(JNIEnv *env, } else { flds[i].fid = env->GetFieldID(cls, flds[i].name, "I"); } - if (flds[i].fid == NULL) { + if (flds[i].fid == nullptr) { printf("Unable to set field modif. watch on fld%" PRIuPTR ", fieldID=0", i); } else { if (printdump == JNI_TRUE) { @@ -162,7 +162,7 @@ Java_nsk_jvmti_SetFieldModificationWatch_setfmodw003_getReady(JNIEnv *env, } } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_FIELD_MODIFICATION, NULL); + JVMTI_EVENT_FIELD_MODIFICATION, nullptr); if (err != JVMTI_ERROR_NONE) { printf("(SetEventNotificationMode) unexpected error: %s (%d)\n", TranslateError(err), err); @@ -195,7 +195,7 @@ Java_nsk_jvmti_SetFieldModificationWatch_setfmodw003_check(JNIEnv *env, printf("Field %s: thrown new value expected=%d, actual=%d\n", flds[ind].name, flds[ind].val, actual_val); } - actual_fid = NULL; + actual_fid = nullptr; actual_sig = '\0'; actual_val = 0; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw004/setfmodw004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw004/setfmodw004.cpp index 403e2c1eda81..af545b823b4d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw004/setfmodw004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw004/setfmodw004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -47,14 +47,14 @@ static jvmtiEventCallbacks callbacks; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; -static jfieldID actual_fid = NULL; +static jfieldID actual_fid = nullptr; static char actual_sig = '\0'; static jint actual_val = 0; static field flds[] = { - { "fld0", 'I', JNI_TRUE, 96, NULL }, - { "fld1", 'I', JNI_TRUE, 97, NULL }, - { "fld2", 'I', JNI_FALSE, 98, NULL }, - { "fld3", 'I', JNI_FALSE, 99, NULL } + { "fld0", 'I', JNI_TRUE, 96, nullptr }, + { "fld1", 'I', JNI_TRUE, 97, nullptr }, + { "fld2", 'I', JNI_FALSE, 98, nullptr }, + { "fld3", 'I', JNI_FALSE, 99, nullptr } }; void JNICALL FieldModification(jvmtiEnv *jvmti_env, JNIEnv *env, @@ -84,12 +84,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } @@ -144,7 +144,7 @@ JNIEXPORT void JNICALL Java_nsk_jvmti_SetFieldModificationWatch_setfmodw004_getR } else { flds[i].fid = env->GetFieldID(cls, flds[i].name, "I"); } - if (flds[i].fid == NULL) { + if (flds[i].fid == nullptr) { printf("Unable to set field modif. watch on fld%" PRIuPTR ", fieldID=0", i); } else { if (printdump == JNI_TRUE) { @@ -160,7 +160,7 @@ JNIEXPORT void JNICALL Java_nsk_jvmti_SetFieldModificationWatch_setfmodw004_getR } } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_FIELD_MODIFICATION, NULL); + JVMTI_EVENT_FIELD_MODIFICATION, nullptr); if (err != JVMTI_ERROR_NONE) { printf("(SetEventNotificationMode) unexpected error: %s (%d)\n", TranslateError(err), err); @@ -193,7 +193,7 @@ Java_nsk_jvmti_SetFieldModificationWatch_setfmodw004_check(JNIEnv *env, printf("Field %s: thrown new value expected=%d, actual=%d\n", flds[ind].name, flds[ind].val, actual_val); } - actual_fid = NULL; + actual_fid = nullptr; actual_sig = '\0'; actual_val = 0; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw005/setfmodw005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw005/setfmodw005.cpp index 42e22ede75a8..8a18391a713a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw005/setfmodw005.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw005/setfmodw005.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -48,26 +48,26 @@ static jvmtiEventCallbacks callbacks; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; -static jfieldID actual_fid = NULL; +static jfieldID actual_fid = nullptr; static char actual_sig = '\0'; static jvalue actual_val = {}; static field flds[] = { - { "fld0", "J", JNI_TRUE, "static long", NULL, {} }, - { "fld1", "J", JNI_FALSE, "long", NULL, {} }, - { "fld2", "F", JNI_TRUE, "static float", NULL, {} }, - { "fld3", "F", JNI_FALSE, "float", NULL, {} }, - { "fld4", "D", JNI_TRUE, "static double", NULL, {} }, - { "fld5", "D", JNI_FALSE, "double", NULL, {} }, - { "fld6", "Ljava/lang/Object;", JNI_TRUE, "static Object", NULL, {} }, - { "fld7", "Ljava/lang/Object;", JNI_FALSE, "Object", NULL, {} }, - { "fld8", "Z", JNI_TRUE, "static boolean", NULL, {} }, - { "fld9", "Z", JNI_FALSE, "boolean", NULL, {} }, - { "fld10", "B", JNI_TRUE, "static byte", NULL, {} }, - { "fld11", "B", JNI_FALSE, "byte", NULL, {} }, - { "fld12", "S", JNI_TRUE, "static short", NULL, {} }, - { "fld13", "S", JNI_FALSE, "short", NULL, {} }, - { "fld14", "C", JNI_TRUE, "static char", NULL, {} }, - { "fld15", "C", JNI_FALSE, "char", NULL, {} } + { "fld0", "J", JNI_TRUE, "static long", nullptr, {} }, + { "fld1", "J", JNI_FALSE, "long", nullptr, {} }, + { "fld2", "F", JNI_TRUE, "static float", nullptr, {} }, + { "fld3", "F", JNI_FALSE, "float", nullptr, {} }, + { "fld4", "D", JNI_TRUE, "static double", nullptr, {} }, + { "fld5", "D", JNI_FALSE, "double", nullptr, {} }, + { "fld6", "Ljava/lang/Object;", JNI_TRUE, "static Object", nullptr, {} }, + { "fld7", "Ljava/lang/Object;", JNI_FALSE, "Object", nullptr, {} }, + { "fld8", "Z", JNI_TRUE, "static boolean", nullptr, {} }, + { "fld9", "Z", JNI_FALSE, "boolean", nullptr, {} }, + { "fld10", "B", JNI_TRUE, "static byte", nullptr, {} }, + { "fld11", "B", JNI_FALSE, "byte", nullptr, {} }, + { "fld12", "S", JNI_TRUE, "static short", nullptr, {} }, + { "fld13", "S", JNI_FALSE, "short", nullptr, {} }, + { "fld14", "C", JNI_TRUE, "static char", nullptr, {} }, + { "fld15", "C", JNI_FALSE, "char", nullptr, {} } }; void JNICALL FieldModification(jvmtiEnv *jvmti_env, JNIEnv *env, @@ -133,12 +133,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } @@ -216,7 +216,7 @@ Java_nsk_jvmti_SetFieldModificationWatch_setfmodw005_getReady(JNIEnv *env, } else { flds[i].fid = env->GetFieldID(cls, flds[i].name, flds[i].sig); } - if (flds[i].fid == NULL) { + if (flds[i].fid == nullptr) { printf("Unable to set modification watch on %s fld%" PRIuPTR ", fieldID=0", flds[i].descr, i); } else { @@ -233,7 +233,7 @@ Java_nsk_jvmti_SetFieldModificationWatch_setfmodw005_getReady(JNIEnv *env, } } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_FIELD_MODIFICATION, NULL); + JVMTI_EVENT_FIELD_MODIFICATION, nullptr); if (err != JVMTI_ERROR_NONE) { printf("(SetEventNotificationMode) unexpected error: %s (%d)\n", TranslateError(err), err); @@ -366,7 +366,7 @@ Java_nsk_jvmti_SetFieldModificationWatch_setfmodw005_check(JNIEnv *env, default: break; } - actual_fid = NULL; + actual_fid = nullptr; actual_sig = '\0'; actual_val.j = 0L; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw006/setfmodw006.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw006/setfmodw006.cpp index da74e1a92cad..18191588a47f 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw006/setfmodw006.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetFieldModificationWatch/setfmodw006/setfmodw006.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -43,34 +43,34 @@ typedef struct { jint count; } watch_info; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; static int missesCount = 0; static watch_info watches[] = { - { NULL, "staticBoolean", "Z", JNI_TRUE, 0, 0 }, - { NULL, "staticByte", "B", JNI_TRUE, 0, 0 }, - { NULL, "staticShort", "S", JNI_TRUE, 0, 0 }, - { NULL, "staticInt", "I", JNI_TRUE, 0, 0 }, - { NULL, "staticLong", "J", JNI_TRUE, 0, 0 }, - { NULL, "staticFloat", "F", JNI_TRUE, 0, 0 }, - { NULL, "staticDouble", "D", JNI_TRUE, 0, 0 }, - { NULL, "staticChar", "C", JNI_TRUE, 0, 0 }, - { NULL, "staticObject", "Ljava/lang/Object;", JNI_TRUE, 0, 0 }, - { NULL, "staticArrInt", "[I", JNI_TRUE, 0, 0 }, - - { NULL, "instanceBoolean", "Z", JNI_FALSE, 0, 0 }, - { NULL, "instanceByte", "B", JNI_FALSE, 0, 0 }, - { NULL, "instanceShort", "S", JNI_FALSE, 0, 0 }, - { NULL, "instanceInt", "I", JNI_FALSE, 0, 0 }, - { NULL, "instanceLong", "J", JNI_FALSE, 0, 0 }, - { NULL, "instanceFloat", "F", JNI_FALSE, 0, 0 }, - { NULL, "instanceDouble", "D", JNI_FALSE, 0, 0 }, - { NULL, "instanceChar", "C", JNI_FALSE, 0, 0 }, - { NULL, "instanceObject", "Ljava/lang/Object;", JNI_FALSE, 0, 0 }, - { NULL, "instanceArrInt", "[I", JNI_FALSE, 0, 0 } + { nullptr, "staticBoolean", "Z", JNI_TRUE, 0, 0 }, + { nullptr, "staticByte", "B", JNI_TRUE, 0, 0 }, + { nullptr, "staticShort", "S", JNI_TRUE, 0, 0 }, + { nullptr, "staticInt", "I", JNI_TRUE, 0, 0 }, + { nullptr, "staticLong", "J", JNI_TRUE, 0, 0 }, + { nullptr, "staticFloat", "F", JNI_TRUE, 0, 0 }, + { nullptr, "staticDouble", "D", JNI_TRUE, 0, 0 }, + { nullptr, "staticChar", "C", JNI_TRUE, 0, 0 }, + { nullptr, "staticObject", "Ljava/lang/Object;", JNI_TRUE, 0, 0 }, + { nullptr, "staticArrInt", "[I", JNI_TRUE, 0, 0 }, + + { nullptr, "instanceBoolean", "Z", JNI_FALSE, 0, 0 }, + { nullptr, "instanceByte", "B", JNI_FALSE, 0, 0 }, + { nullptr, "instanceShort", "S", JNI_FALSE, 0, 0 }, + { nullptr, "instanceInt", "I", JNI_FALSE, 0, 0 }, + { nullptr, "instanceLong", "J", JNI_FALSE, 0, 0 }, + { nullptr, "instanceFloat", "F", JNI_FALSE, 0, 0 }, + { nullptr, "instanceDouble", "D", JNI_FALSE, 0, 0 }, + { nullptr, "instanceChar", "C", JNI_FALSE, 0, 0 }, + { nullptr, "instanceObject", "Ljava/lang/Object;", JNI_FALSE, 0, 0 }, + { nullptr, "instanceArrInt", "[I", JNI_FALSE, 0, 0 } }; @@ -103,12 +103,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -155,7 +155,7 @@ Java_nsk_jvmti_SetFieldModificationWatch_setfmodw006_getReady(JNIEnv *env, jvmtiError err; size_t i; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; @@ -185,7 +185,7 @@ Java_nsk_jvmti_SetFieldModificationWatch_setfmodw006_getReady(JNIEnv *env, } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_FIELD_MODIFICATION, NULL); + JVMTI_EVENT_FIELD_MODIFICATION, nullptr); if (err != JVMTI_ERROR_NONE) { printf("(SetEventNotificationMode) unexpected error: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetJNIFunctionTable/setjniftab001/setjniftab001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetJNIFunctionTable/setjniftab001/setjniftab001.cpp index 2e6490e34f72..2fdb6e3193f8 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetJNIFunctionTable/setjniftab001/setjniftab001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetJNIFunctionTable/setjniftab001/setjniftab001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,10 +27,10 @@ #include #include -#include "agent_common.h" +#include "agent_common.hpp" -#include "JVMTITools.h" -#include "native_thread.h" +#include "JVMTITools.hpp" +#include "native_thread.hpp" extern "C" { @@ -46,7 +46,7 @@ static const char *classSig = "Lnsk/jvmti/SetJNIFunctionTable/setjniftab001a;"; static JavaVM *vm; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static volatile int verbose = 0; @@ -59,10 +59,10 @@ static volatile jobject clsObj; static jrawMonitorID countLock; /* the original JNI function table */ -static jniNativeInterface *orig_jni_functions = NULL; +static jniNativeInterface *orig_jni_functions = nullptr; /* the redirected JNI function table */ -static jniNativeInterface *redir_jni_functions = NULL; +static jniNativeInterface *redir_jni_functions = nullptr; /* number of the redirected JNI function calls */ static volatile int monent_calls = 0; @@ -278,7 +278,7 @@ void startThreads() { thrStarted[i] = 0; waitContElem[i] = i+1; waitThr[i] = THREAD_new(waitingThread, &waitContElem[i]); - if (THREAD_start(waitThr[i]) == NULL) { + if (THREAD_start(waitThr[i]) == nullptr) { printf("TEST FAILURE: cannot start waiting thread #%d\n", i+1); result = STATUS_FAILED; @@ -323,16 +323,16 @@ JNIEXPORT jint JNICALL Java_nsk_jvmti_SetJNIFunctionTable_setjniftab001_check(JNIEnv *env, jobject obj) { int exitCode = PASSED; jint res; - JNIEnv *nextEnv = NULL; /* JNI env used to verify the assertion */ + JNIEnv *nextEnv = nullptr; /* JNI env used to verify the assertion */ - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("(%s,%d): TEST FAILURE: JVMTI client was not properly loaded\n", __FILE__, __LINE__); return STATUS_FAILED; } clsObj = env->NewGlobalRef(getObjectFromField(env, obj)); - if (clsObj == NULL) { + if (clsObj == nullptr) { printf("(%s,%d): TEST FAILURE: cannot create a new global reference of class \"%s\"\n", __FILE__, __LINE__, classSig); env->FatalError("failed to create a new global reference"); @@ -382,10 +382,10 @@ Java_nsk_jvmti_SetJNIFunctionTable_setjniftab001_check(JNIEnv *env, jobject obj) and check the assertion with current thread and new threads */ if (verbose) printf("\nc) Checking the restored JNI function table ...\n"); - doRestore((nextEnv == NULL) ? env : nextEnv); + doRestore((nextEnv == nullptr) ? env : nextEnv); zeroCounter(); - doExec((nextEnv == NULL) ? env : nextEnv, 0); + doExec((nextEnv == nullptr) ? env : nextEnv, 0); checkCall(2, 0, "main thread"); zeroCounter(); @@ -413,14 +413,14 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "-verbose") == 0) + if (options != nullptr && strcmp(options, "-verbose") == 0) verbose = 1; if (verbose) printf("verbose mode on\n"); res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("(%s,%d): Failed to call GetEnv\n", __FILE__, __LINE__); return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetJNIFunctionTable/setjniftab002/setjniftab002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetJNIFunctionTable/setjniftab002/setjniftab002.cpp index 467c7abbb1f9..6d296ec531f8 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetJNIFunctionTable/setjniftab002/setjniftab002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetJNIFunctionTable/setjniftab002/setjniftab002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define STATUS_FAILED 2 static JavaVM *vm; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static int verbose = 0; static jint result = PASSED; @@ -45,7 +45,7 @@ void redirect(JNIEnv *env, jvmtiError exError) { printf("\ntrying to overwrite the JNI function table expecting the error %s to be returned ...\n", TranslateError(exError)); - err = jvmti->SetJNIFunctionTable(NULL); + err = jvmti->SetJNIFunctionTable(nullptr); if (err != exError) { result = STATUS_FAILED; printf("(%s,%d): TEST FAILED: SetJNIFunctionTable() returns %s instead of %s as expected\n", @@ -60,9 +60,9 @@ void redirect(JNIEnv *env, jvmtiError exError) { JNIEXPORT jint JNICALL Java_nsk_jvmti_SetJNIFunctionTable_setjniftab002_check(JNIEnv *env, jobject obj) { jint res; - JNIEnv *nextEnv = NULL; + JNIEnv *nextEnv = nullptr; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("(%s,%d): TEST FAILURE: JVMTI client was not properly loaded\n", __FILE__, __LINE__); return STATUS_FAILED; @@ -114,14 +114,14 @@ JNIEXPORT jint JNI_OnLoad_setjniftab002(JavaVM *jvm, char *options, void *reserv jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "-verbose") == 0) + if (options != nullptr && strcmp(options, "-verbose") == 0) verbose = 1; if (verbose) printf("verbose mode on\n"); res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("(%s,%d): Failed to call GetEnv\n", __FILE__, __LINE__); return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal001/setlocal001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal001/setlocal001.cpp index e882233178c0..8193058eba76 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal001/setlocal001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal001/setlocal001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; static jint result = PASSED; @@ -50,7 +50,7 @@ void JNICALL Breakpoint(jvmtiEnv *jvmti_env, JNIEnv *env, jmethodID mid; jlocation loc; jint entryCount; - jvmtiLocalVariableEntry *table = NULL; + jvmtiLocalVariableEntry *table = nullptr; int i; err = jvmti_env->GetFrameLocation(thr, 1, &mid, &loc); @@ -234,7 +234,7 @@ void JNICALL Breakpoint(jvmtiEnv *jvmti_env, JNIEnv *env, result = STATUS_FAILED; } - if (table != NULL) { + if (table != nullptr) { for (i = 0; i < entryCount; i++) { jvmti_env->Deallocate((unsigned char*)table[i].name); jvmti_env->Deallocate((unsigned char*)table[i].signature); @@ -259,7 +259,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv !\n"); return JNI_ERR; } @@ -308,7 +308,7 @@ Java_nsk_jvmti_SetLocalVariable_setlocal001_getMethReady(JNIEnv *env, jvmtiError err; jmethodID mid; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; @@ -338,7 +338,7 @@ Java_nsk_jvmti_SetLocalVariable_setlocal001_getMethReady(JNIEnv *env, } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_BREAKPOINT, NULL); + JVMTI_EVENT_BREAKPOINT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable BREAKPOINT event: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal002/setlocal002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal002/setlocal002.cpp index a2dbb7b9698d..1a7b412061c6 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal002/setlocal002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal002/setlocal002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -53,12 +53,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -99,7 +99,7 @@ Java_nsk_jvmti_SetLocalVariable_setlocal002_check(JNIEnv *env, jclass cls, jthre jvmtiLocalVariableEntry *table; int i; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -109,7 +109,7 @@ Java_nsk_jvmti_SetLocalVariable_setlocal002_check(JNIEnv *env, jclass cls, jthre } mid = env->GetStaticMethodID(cls, "run", "([Ljava/lang/String;Ljava/io/PrintStream;)I"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot find method \"run\"\n"); return STATUS_FAILED; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal003/setlocal003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal003/setlocal003.cpp index 144a6614a9e8..793f22ec40fc 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal003/setlocal003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal003/setlocal003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -34,7 +34,7 @@ extern "C" { #define STATUS_FAILED 2 #define INV_SLOT (-1) -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; static jint result = PASSED; @@ -139,12 +139,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -192,7 +192,7 @@ Java_nsk_jvmti_SetLocalVariable_setlocal003_getReady(JNIEnv *env, jclass cls) { jvmtiError err; jmethodID mid; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; @@ -202,7 +202,7 @@ Java_nsk_jvmti_SetLocalVariable_setlocal003_getReady(JNIEnv *env, jclass cls) { !caps.can_generate_breakpoint_events) return; mid = env->GetStaticMethodID(cls, "checkPoint", "()V"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot find Method ID for method checkPoint\n"); result = STATUS_FAILED; return; @@ -216,7 +216,7 @@ Java_nsk_jvmti_SetLocalVariable_setlocal003_getReady(JNIEnv *env, jclass cls) { } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_BREAKPOINT, NULL); + JVMTI_EVENT_BREAKPOINT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable BREAKPOINT event: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal004/setlocal004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal004/setlocal004.cpp index 397d6e787b4b..37598107c455 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal004/setlocal004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetLocalVariable/setlocal004/setlocal004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -34,7 +34,7 @@ extern "C" { #define STATUS_FAILED 2 #define INV_SLOT (-1) -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; static jint result = PASSED; @@ -145,12 +145,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -198,7 +198,7 @@ Java_nsk_jvmti_SetLocalVariable_setlocal004_getReady(JNIEnv *env, jclass cls) { jvmtiError err; jmethodID mid; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; @@ -222,7 +222,7 @@ Java_nsk_jvmti_SetLocalVariable_setlocal004_getReady(JNIEnv *env, jclass cls) { } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_BREAKPOINT, NULL); + JVMTI_EVENT_BREAKPOINT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable BREAKPOINT event: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetNativeMethodPrefix/SetNativeMethodPrefix001/SetNativeMethodPrefix001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetNativeMethodPrefix/SetNativeMethodPrefix001/SetNativeMethodPrefix001.cpp index d9631096901d..61420296b65f 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetNativeMethodPrefix/SetNativeMethodPrefix001/SetNativeMethodPrefix001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetNativeMethodPrefix/SetNativeMethodPrefix001/SetNativeMethodPrefix001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, 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,12 +23,12 @@ #include #include #include -#include "agent_common.h" +#include "agent_common.hpp" -#include "nsk_tools.h" -#include "JVMTITools.h" -#include "jvmti_tools.h" -#include "jni_tools.h" +#include "nsk_tools.hpp" +#include "JVMTITools.hpp" +#include "jvmti_tools.hpp" +#include "jni_tools.hpp" extern "C" { @@ -108,7 +108,7 @@ static const void *METHODS [METHODS_COUNT] = { /* ============================================================================= */ -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; /* ============================================================================= */ @@ -120,17 +120,17 @@ Java_nsk_jvmti_SetNativeMethodPrefix_Binder_setMethodPrefix ( ) { jboolean result = JNI_TRUE; - char *str = NULL; + char *str = nullptr; - if (prefix != NULL) { - if (!NSK_VERIFY((str = (char *) jni->GetStringUTFChars(prefix, 0)) != NULL)) + if (prefix != nullptr) { + if (!NSK_VERIFY((str = (char *) jni->GetStringUTFChars(prefix, 0)) != nullptr)) { result = JNI_FALSE; goto finally; } } if (!NSK_JVMTI_VERIFY(jvmti->SetNativeMethodPrefix(str))) { result = JNI_FALSE; goto finally; } - if (str != NULL) { + if (str != nullptr) { NSK_DISPLAY1("New PREFIX is set: %s\n" , str ); @@ -139,7 +139,7 @@ Java_nsk_jvmti_SetNativeMethodPrefix_Binder_setMethodPrefix ( } finally: - if (str != NULL) { + if (str != nullptr) { jni->ReleaseStringUTFChars(prefix, str); } @@ -156,10 +156,10 @@ Java_nsk_jvmti_SetNativeMethodPrefix_Binder_setMultiplePrefixes ( ) { jboolean result = JNI_TRUE; - char *str = NULL; + char *str = nullptr; - if (prefix != NULL) { - if (!NSK_VERIFY((str = (char *) jni->GetStringUTFChars(prefix, 0)) != NULL)) + if (prefix != nullptr) { + if (!NSK_VERIFY((str = (char *) jni->GetStringUTFChars(prefix, 0)) != nullptr)) { result = JNI_FALSE; goto finally; } if (!NSK_JVMTI_VERIFY(jvmti->SetNativeMethodPrefixes(1, (char **) &str))) @@ -170,7 +170,7 @@ Java_nsk_jvmti_SetNativeMethodPrefix_Binder_setMultiplePrefixes ( ); } else { char* prefixes[1]; - prefixes[0] = NULL; + prefixes[0] = nullptr; if (!NSK_JVMTI_VERIFY(jvmti->SetNativeMethodPrefixes(0, (char **)&prefixes))) { result = JNI_FALSE; goto finally; } @@ -179,7 +179,7 @@ Java_nsk_jvmti_SetNativeMethodPrefix_Binder_setMultiplePrefixes ( } finally: - if (str != NULL) { + if (str != nullptr) { jni->ReleaseStringUTFChars(prefix, str); } @@ -209,11 +209,11 @@ Java_nsk_jvmti_SetNativeMethodPrefix_Binder_registerMethod ( return JNI_FALSE; } - if (!NSK_VERIFY((method.name = (char *) jni->GetStringUTFChars(method_name_obj, 0)) != NULL)) { + if (!NSK_VERIFY((method.name = (char *) jni->GetStringUTFChars(method_name_obj, 0)) != nullptr)) { goto finally; } - if (!NSK_VERIFY((method.signature = (char *) jni->GetStringUTFChars(method_sig_obj, 0)) != NULL)) { + if (!NSK_VERIFY((method.signature = (char *) jni->GetStringUTFChars(method_sig_obj, 0)) != nullptr)) { goto finally; } @@ -226,7 +226,7 @@ Java_nsk_jvmti_SetNativeMethodPrefix_Binder_registerMethod ( if (jni->RegisterNatives(bound_klass, (const JNINativeMethod*) &method, 1) != 0) { - if (jni->ExceptionOccurred() != NULL) { + if (jni->ExceptionOccurred() != nullptr) { jni->ExceptionClear(); } @@ -237,11 +237,11 @@ Java_nsk_jvmti_SetNativeMethodPrefix_Binder_registerMethod ( result = JNI_TRUE; finally: - if (method.name != NULL) { + if (method.name != nullptr) { jni->ReleaseStringUTFChars(method_name_obj, method.name); } - if (method.signature != NULL) { + if (method.signature != nullptr) { jni->ReleaseStringUTFChars(method_sig_obj, method.signature); } @@ -273,7 +273,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) return JNI_ERR; if (!NSK_VERIFY( - (jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved)) != NULL + (jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved)) != nullptr ) ) return JNI_ERR; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetNativeMethodPrefix/SetNativeMethodPrefix002/SetNativeMethodPrefix002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetNativeMethodPrefix/SetNativeMethodPrefix002/SetNativeMethodPrefix002.cpp index 7addf0cf0520..2749d15d0703 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetNativeMethodPrefix/SetNativeMethodPrefix002/SetNativeMethodPrefix002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetNativeMethodPrefix/SetNativeMethodPrefix002/SetNativeMethodPrefix002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, 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,12 +23,12 @@ #include #include #include -#include "agent_common.h" +#include "agent_common.hpp" -#include "nsk_tools.h" -#include "JVMTITools.h" -#include "jvmti_tools.h" -#include "jni_tools.h" +#include "nsk_tools.hpp" +#include "JVMTITools.hpp" +#include "jvmti_tools.hpp" +#include "jni_tools.hpp" extern "C" { @@ -38,11 +38,11 @@ extern "C" { /* ============================================================================= */ -static char *prefix = NULL; +static char *prefix = nullptr; /* ============================================================================= */ -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; /* ============================================================================= */ @@ -95,7 +95,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) // Specify native method prefix prefix = (char *)nsk_jvmti_findOptionValue("prefix"); - if (prefix != NULL) { + if (prefix != nullptr) { NSK_DISPLAY1("Prefix: %s\n", prefix); } @@ -103,7 +103,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) apply = nsk_jvmti_findOptionIntValue("apply", 1); if (!NSK_VERIFY( - (jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved)) != NULL + (jvmti = nsk_jvmti_createJVMTIEnv(vm, reserved)) != nullptr ) ) return JNI_ERR; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetNativeMethodPrefix/SetNativeMethodPrefix002/SetNativeMethodPrefix002Main.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetNativeMethodPrefix/SetNativeMethodPrefix002/SetNativeMethodPrefix002Main.cpp index e491f439367e..75b4fe2affdf 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetNativeMethodPrefix/SetNativeMethodPrefix002/SetNativeMethodPrefix002Main.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetNativeMethodPrefix/SetNativeMethodPrefix002/SetNativeMethodPrefix002Main.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,10 +24,10 @@ #include #include -#include "nsk_tools.h" -#include "JVMTITools.h" -#include "jvmti_tools.h" -#include "jni_tools.h" +#include "nsk_tools.hpp" +#include "JVMTITools.hpp" +#include "jvmti_tools.hpp" +#include "jni_tools.hpp" extern "C" { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetSystemProperty/setsysprop002/setsysprop002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetSystemProperty/setsysprop002/setsysprop002.cpp index 0026afe9461e..eef3388696e3 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetSystemProperty/setsysprop002/setsysprop002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetSystemProperty/setsysprop002/setsysprop002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -73,7 +73,7 @@ static PropertyDesc propDescList[PROPERTIES_COUNT] = { static int checkPropertyValue(jvmtiEnv* jvmti, const char phase[], const char name[], const char* expectedValue) { int success = NSK_TRUE; - char* value = NULL; + char* value = nullptr; NSK_DISPLAY1(" property: %s\n", name); if (!NSK_JVMTI_VERIFY(jvmti->GetSystemProperty(name, &value))) { @@ -81,7 +81,7 @@ static int checkPropertyValue(jvmtiEnv* jvmti, const char phase[], } NSK_DISPLAY1(" value: \"%s\"\n", nsk_null_string(value)); - if (value == NULL + if (value == nullptr || strcmp(value, expectedValue) != 0) { NSK_COMPLAIN4("In %s phase GetSystemProperty() returned unexpected value for property:\n" "# property name: %s\n" @@ -174,7 +174,7 @@ JNIEXPORT jint JNI_OnLoad_setsysprop002(JavaVM *jvm, char *options, void *reserv } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -182,7 +182,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; NSK_DISPLAY0(">>> Check setting defined system properties in OnLoad phase\n"); @@ -190,7 +190,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { nsk_jvmti_setFailStatus(); } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetSystemProperty/setsysprop003/setsysprop003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetSystemProperty/setsysprop003/setsysprop003.cpp index 841a15c3da92..856e4208ee10 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetSystemProperty/setsysprop003/setsysprop003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetSystemProperty/setsysprop003/setsysprop003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -79,7 +79,7 @@ JNIEXPORT jint JNI_OnLoad_setsysprop003(JavaVM *jvm, char *options, void *reserv } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -87,7 +87,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; NSK_DISPLAY0(">>> Set new values for defined system properties in OnLoad phase\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetTag/settag001/settag001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetTag/settag001/settag001.cpp index 3c19fb28ee95..e5929d5152a7 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetTag/settag001/settag001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetTag/settag001/settag001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -51,17 +51,17 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { /* perform testing */ { - jobject testedObject = NULL; + jobject testedObject = nullptr; jlong objectTag = 111; NSK_DISPLAY0(">>> Obtain tested object from a static field of debugee class\n"); { - jclass debugeeClass = NULL; - jfieldID objectField = NULL; + jclass debugeeClass = nullptr; + jfieldID objectField = nullptr; NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_CLASS_NAME); if (!NSK_JNI_VERIFY(jni, (debugeeClass = - jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) { + jni->FindClass(DEBUGEE_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -69,7 +69,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY1("Find static field: %s\n", OBJECT_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (objectField = - jni->GetStaticFieldID(debugeeClass, OBJECT_FIELD_NAME, OBJECT_CLASS_SIG)) != NULL)) { + jni->GetStaticFieldID(debugeeClass, OBJECT_FIELD_NAME, OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -77,14 +77,14 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY1("Get object from static field: %s\n", OBJECT_FIELD_NAME); if (!NSK_JNI_VERIFY(jni, (testedObject = - jni->GetStaticObjectField(debugeeClass, objectField)) != NULL)) { + jni->GetStaticObjectField(debugeeClass, objectField)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY1(" ... got object: 0x%p\n", (void*)testedObject); NSK_DISPLAY1("Create global reference for object: 0x%p\n", (void*)testedObject); - if (!NSK_JNI_VERIFY(jni, (testedObject = jni->NewGlobalRef(testedObject)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (testedObject = jni->NewGlobalRef(testedObject)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -180,7 +180,7 @@ JNIEXPORT jint JNI_OnLoad_settag001(JavaVM *jvm, char *options, void *reserved) } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; /* init framework and parse options */ if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) @@ -190,7 +190,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add required capabilities */ @@ -205,7 +205,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetThreadLocalStorage/setthrdstor001/setthrdstor001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetThreadLocalStorage/setthrdstor001/setthrdstor001.cpp index c04094a47c6e..83e28a9b1bac 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetThreadLocalStorage/setthrdstor001/setthrdstor001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetThreadLocalStorage/setthrdstor001/setthrdstor001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -58,16 +58,16 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { /* perform testing */ { - jthread testedThread = NULL; + jthread testedThread = nullptr; StorageStructure storageData; StorageStructure* initialStorage = &storageData; - StorageStructure* obtainedStorage = NULL; + StorageStructure* obtainedStorage = nullptr; memset(storageData.data, STORAGE_DATA_CHAR, STORAGE_DATA_SIZE); NSK_DISPLAY1("Find thread: %s\n", THREAD_NAME); if (!NSK_VERIFY((testedThread = - nsk_jvmti_threadByName(THREAD_NAME)) != NULL)) + nsk_jvmti_threadByName(THREAD_NAME)) != nullptr)) return; NSK_DISPLAY1(" ... found thread: %p\n", (void*)testedThread); @@ -148,7 +148,7 @@ JNIEXPORT jint JNI_OnLoad_setthrdstor001(JavaVM *jvm, char *options, void *reser } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; /* init framework and parse options */ if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) @@ -158,11 +158,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetThreadLocalStorage/setthrdstor002/setthrdstor002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetThreadLocalStorage/setthrdstor002/setthrdstor002.cpp index 9528052c9aba..c59b256bb1ad 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetThreadLocalStorage/setthrdstor002/setthrdstor002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetThreadLocalStorage/setthrdstor002/setthrdstor002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -60,13 +60,13 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { { StorageStructure storageData; StorageStructure* initialStorage = &storageData; - StorageStructure* obtainedStorage = NULL; + StorageStructure* obtainedStorage = nullptr; memset(storageData.data, STORAGE_DATA_CHAR, STORAGE_DATA_SIZE); NSK_DISPLAY1("SetThreadLocalStorage() for current agent thread with pointer: %p\n", (void*)initialStorage); - if (!NSK_JVMTI_VERIFY(jvmti->SetThreadLocalStorage(NULL, (void*)initialStorage))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetThreadLocalStorage(nullptr, (void*)initialStorage))) { nsk_jvmti_setFailStatus(); return; } @@ -80,7 +80,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { return; NSK_DISPLAY0("GetThreadLocalStorage() for current agent thread\n"); - if (!NSK_JVMTI_VERIFY(jvmti->GetThreadLocalStorage(NULL, (void**)&obtainedStorage))) { + if (!NSK_JVMTI_VERIFY(jvmti->GetThreadLocalStorage(nullptr, (void**)&obtainedStorage))) { nsk_jvmti_setFailStatus(); return; } @@ -133,7 +133,7 @@ JNIEXPORT jint JNI_OnLoad_setthrdstor002(JavaVM *jvm, char *options, void *reser } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; /* init framework and parse options */ if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) @@ -143,11 +143,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetThreadLocalStorage/setthrdstor003/setthrdstor003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetThreadLocalStorage/setthrdstor003/setthrdstor003.cpp index ff49c9d060aa..375378687e36 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetThreadLocalStorage/setthrdstor003/setthrdstor003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetThreadLocalStorage/setthrdstor003/setthrdstor003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -78,7 +78,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { eventsStart = 0; eventsEnd = 0; NSK_DISPLAY1("Enable events: %d events\n", EVENTS_COUNT); - if (!nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, eventsList, NULL)) + if (!nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, eventsList, nullptr)) return; NSK_DISPLAY0("Let tested thread to run\n"); @@ -90,7 +90,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { return; NSK_DISPLAY1("Disable events: %d events\n", EVENTS_COUNT); - if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, eventsList, NULL)) + if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, eventsList, nullptr)) return; NSK_DISPLAY1("Check if all expected events received for tested thread: %s\n", @@ -117,7 +117,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { JNIEXPORT void JNICALL callbackThreadStart(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { /* check if event is for tested thread */ - if (thread != NULL) { + if (thread != nullptr) { jvmtiThreadInfo info; if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(thread, &info))) { @@ -125,14 +125,14 @@ callbackThreadStart(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { return; } - if (info.name != NULL && strcmp(info.name, THREAD_NAME) == 0) { + if (info.name != nullptr && strcmp(info.name, THREAD_NAME) == 0) { NSK_DISPLAY2(" ... received THREAD_START event for tested thread: %p (%s)\n", (void*)thread, info.name); eventsStart++; NSK_DISPLAY1("SetThreadLocalStorage() for current thread with pointer: %p\n", (void*)initialStorage); - if (!NSK_JVMTI_VERIFY(jvmti->SetThreadLocalStorage(NULL, (void*)initialStorage))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetThreadLocalStorage(nullptr, (void*)initialStorage))) { nsk_jvmti_setFailStatus(); return; } @@ -145,7 +145,7 @@ callbackThreadStart(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { JNIEXPORT void JNICALL callbackThreadEnd(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { /* check if event is for tested thread */ - if (thread != NULL) { + if (thread != nullptr) { jvmtiThreadInfo info; if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(thread, &info))) { @@ -153,18 +153,18 @@ callbackThreadEnd(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { return; } - if (info.name != NULL && strcmp(info.name, THREAD_NAME) == 0) { + if (info.name != nullptr && strcmp(info.name, THREAD_NAME) == 0) { NSK_DISPLAY2(" ... received THREAD_END event for tested thread: %p (%s)\n", (void*)thread, info.name); eventsEnd++; /* get storage data */ { - StorageStructure* obtainedStorage = NULL; + StorageStructure* obtainedStorage = nullptr; NSK_DISPLAY0("GetThreadLocalStorage() for current thread\n"); if (!NSK_JVMTI_VERIFY( - jvmti->GetThreadLocalStorage(NULL, (void**)&obtainedStorage))) { + jvmti->GetThreadLocalStorage(nullptr, (void**)&obtainedStorage))) { nsk_jvmti_setFailStatus(); return; } @@ -219,7 +219,7 @@ JNIEXPORT jint JNI_OnLoad_setthrdstor003(JavaVM *jvm, char *options, void *reser } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; /* init framework and parse options */ if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) @@ -229,7 +229,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* set callbacks for thread events */ @@ -243,7 +243,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetVerboseFlag/setvrbflag001/setvrbflag001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetVerboseFlag/setvrbflag001/setvrbflag001.cpp index bc254115f5da..5582151a2570 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetVerboseFlag/setvrbflag001/setvrbflag001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetVerboseFlag/setvrbflag001/setvrbflag001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -157,7 +157,7 @@ JNIEXPORT jint JNI_OnLoad_setvrbflag001(JavaVM *jvm, char *options, void *reserv } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv *jvmti = NULL; + jvmtiEnv *jvmti = nullptr; jvmtiEventCallbacks callbacks; /* init framework and parse options */ @@ -169,7 +169,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* Create data access lock */ @@ -194,16 +194,16 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* enable VMInit event */ if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL))) + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, nullptr))) return JNI_ERR; /* enable ClassFileLoadHook event */ if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL))) + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, nullptr))) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetVerboseFlag/setvrbflag002/setvrbflag002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetVerboseFlag/setvrbflag002/setvrbflag002.cpp index 8e43f0cb58b4..9d134e0a3c3d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetVerboseFlag/setvrbflag002/setvrbflag002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SetVerboseFlag/setvrbflag002/setvrbflag002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,9 +22,9 @@ */ #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -70,7 +70,7 @@ JNIEXPORT jint JNI_OnLoad_setvrbflag002(JavaVM *jvm, char *options, void *reserv } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv *jvmti = NULL; + jvmtiEnv *jvmti = nullptr; /* init framework and parse options */ if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) @@ -83,11 +83,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/StopThread/stopthrd006/stopthrd006.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/StopThread/stopthrd006/stopthrd006.cpp index 89f43810c1fa..16d88f7b891c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/StopThread/stopthrd006/stopthrd006.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/StopThread/stopthrd006/stopthrd006.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -53,12 +53,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -96,7 +96,7 @@ Java_nsk_jvmti_StopThread_stopthrd006_check(JNIEnv *env, jclass cls, jthread thr, jobject ex) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -104,7 +104,7 @@ Java_nsk_jvmti_StopThread_stopthrd006_check(JNIEnv *env, if (printdump == JNI_TRUE) { printf(">>> invalid thread check ...\n"); } - err = jvmti->StopThread(NULL, ex); + err = jvmti->StopThread(nullptr, ex); if (err == JVMTI_ERROR_MUST_POSSESS_CAPABILITY && !caps.can_signal_thread) { /* It is OK */ @@ -117,7 +117,7 @@ Java_nsk_jvmti_StopThread_stopthrd006_check(JNIEnv *env, if (printdump == JNI_TRUE) { printf(">>> null pointer check ...\n"); } - err = jvmti->StopThread(thr, NULL); + err = jvmti->StopThread(thr, nullptr); if (err == JVMTI_ERROR_MUST_POSSESS_CAPABILITY && !caps.can_signal_thread) { /* It is OK */ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/StopThread/stopthrd007/stopthrd007.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/StopThread/stopthrd007/stopthrd007.cpp index da23414ab5c0..487b1b2f0123 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/StopThread/stopthrd007/stopthrd007.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/StopThread/stopthrd007/stopthrd007.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" #define PASSED 0 #define STATUS_FAILED 2 @@ -38,10 +38,10 @@ extern "C" { static jlong timeout = 0; /* test objects */ -static jobject threadDeath = NULL; -static jthread runningThread = NULL; -static jthread waitingThread = NULL; -static jthread sleepingThread = NULL; +static jobject threadDeath = nullptr; +static jthread runningThread = nullptr; +static jthread waitingThread = nullptr; +static jthread sleepingThread = nullptr; /* ========================================================================== */ @@ -53,10 +53,10 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { const char* THREAD_DEATH_CTOR_NAME = ""; const char* THREAD_DEATH_CTOR_SIGNATURE = "()V"; jvmtiThreadInfo info; - jthread *threads = NULL; + jthread *threads = nullptr; jint threads_count = 0; - jclass cls = NULL; - jmethodID ctor = NULL; + jclass cls = nullptr; + jmethodID ctor = nullptr; int i; NSK_DISPLAY0("Prepare: find tested threads\n"); @@ -65,12 +65,12 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -80,7 +80,7 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL) { + if (info.name != nullptr) { if (strcmp(info.name, RUNNING_THREAD_NAME) == 0) { runningThread = threads[i]; } else if (strcmp(info.name, WAITING_THREAD_NAME) == 0) { @@ -96,14 +96,14 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { NSK_DISPLAY0("Prepare: create new instance of ThreadDeath exception\n"); - if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (ctor = - jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL)) + jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (threadDeath = jni->NewObject(cls, ctor)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (threadDeath = jni->NewObject(cls, ctor)) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -124,7 +124,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } NSK_DISPLAY0("Testcase #1: call StopThread for runningThread\n"); - if (!NSK_VERIFY(runningThread != NULL)) { + if (!NSK_VERIFY(runningThread != nullptr)) { nsk_jvmti_setFailStatus(); } else { if (!NSK_JVMTI_VERIFY(jvmti->StopThread(runningThread, threadDeath))) @@ -132,7 +132,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } NSK_DISPLAY0("Testcase #2: call StopThread for waitingThread\n"); - if (!NSK_VERIFY(waitingThread != NULL)) { + if (!NSK_VERIFY(waitingThread != nullptr)) { nsk_jvmti_setFailStatus(); } else { if (!NSK_JVMTI_VERIFY(jvmti->StopThread(waitingThread, threadDeath))) @@ -140,7 +140,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } NSK_DISPLAY0("Testcase #3: call StopThread for sleepingThread\n"); - if (!NSK_VERIFY(sleepingThread != NULL)) { + if (!NSK_VERIFY(sleepingThread != nullptr)) { nsk_jvmti_setFailStatus(); } else { if (!NSK_JVMTI_VERIFY(jvmti->StopThread(sleepingThread, threadDeath))) @@ -166,7 +166,7 @@ JNIEXPORT jint JNI_OnLoad_stopthrd007(JavaVM *jvm, char *options, void *reserved } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiCapabilities caps; NSK_DISPLAY0("Agent_OnLoad\n"); @@ -177,10 +177,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&caps, 0, sizeof(caps)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThread/suspendthrd001/suspendthrd001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThread/suspendthrd001/suspendthrd001.cpp index 5d346b9bf983..e340c488d628 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThread/suspendthrd001/suspendthrd001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThread/suspendthrd001/suspendthrd001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -49,11 +49,11 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { /* perform testing */ { - jthread testedThread = NULL; + jthread testedThread = nullptr; NSK_DISPLAY1("Find thread: %s\n", THREAD_NAME); if (!NSK_VERIFY((testedThread = - nsk_jvmti_threadByName(THREAD_NAME)) != NULL)) + nsk_jvmti_threadByName(THREAD_NAME)) != nullptr)) return; NSK_DISPLAY1(" ... found thread: %p\n", (void*)testedThread); @@ -118,7 +118,7 @@ JNIEXPORT jint JNI_OnLoad_suspendthrd001(JavaVM *jvm, char *options, void *reser } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; /* init framework and parse options */ if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) @@ -128,7 +128,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add specific capabilities for suspending thread */ @@ -141,7 +141,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThread/suspendthrd002/suspendthrd002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThread/suspendthrd002/suspendthrd002.cpp index 98a415315b41..01145556a954 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThread/suspendthrd002/suspendthrd002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThread/suspendthrd002/suspendthrd002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -49,7 +49,7 @@ static jvmtiEvent eventsList[EVENTS_COUNT] = { }; static volatile int eventsReceived = 0; -static jthread testedThread = NULL; +static jthread testedThread = nullptr; /* ============================================================================= */ @@ -65,13 +65,13 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { { NSK_DISPLAY1("Find thread: %s\n", THREAD_NAME); if (!NSK_VERIFY((testedThread = - nsk_jvmti_threadByName(THREAD_NAME)) != NULL)) + nsk_jvmti_threadByName(THREAD_NAME)) != nullptr)) return; NSK_DISPLAY1(" ... found thread: %p\n", (void*)testedThread); eventsReceived = 0; NSK_DISPLAY1("Enable event: %s\n", "THREAD_END"); - if (!nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, eventsList, NULL)) + if (!nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, eventsList, nullptr)) return; NSK_DISPLAY1("Suspend thread: %p\n", (void*)testedThread); @@ -99,7 +99,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } NSK_DISPLAY1("Disable event: %s\n", "THREAD_END"); - if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, eventsList, NULL)) + if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, eventsList, nullptr)) return; NSK_DISPLAY1("Resume thread: %p\n", (void*)testedThread); @@ -126,7 +126,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { JNIEXPORT void JNICALL callbackThreadEnd(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { /* check if event is for tested thread */ - if (thread != NULL && + if (thread != nullptr && jni->IsSameObject(testedThread, thread)) { NSK_DISPLAY1(" ... received THREAD_END event for tested thread: %p\n", (void*)thread); eventsReceived++; @@ -150,7 +150,7 @@ JNIEXPORT jint JNI_OnLoad_suspendthrd002(JavaVM *jvm, char *options, void *reser } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; /* init framework and parse options */ if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) @@ -160,7 +160,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add specific capabilities for suspending thread */ @@ -182,7 +182,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThread/suspendthrd003/suspendthrd003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThread/suspendthrd003/suspendthrd003.cpp index 265d6b3d3589..bd3226739f75 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThread/suspendthrd003/suspendthrd003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThread/suspendthrd003/suspendthrd003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -52,11 +52,11 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { /* perform testing */ { - jthread testedThread = NULL; + jthread testedThread = nullptr; NSK_DISPLAY1("Find thread: %s\n", THREAD_NAME); if (!NSK_VERIFY((testedThread = - nsk_jvmti_threadByName(THREAD_NAME)) != NULL)) + nsk_jvmti_threadByName(THREAD_NAME)) != nullptr)) return; NSK_DISPLAY1(" ... found thread: %p\n", (void*)testedThread); @@ -150,7 +150,7 @@ JNIEXPORT jint JNI_OnLoad_suspendthrd003(JavaVM *jvm, char *options, void *reser } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; /* init framework and parse options */ if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) @@ -160,7 +160,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add specific capabilities for suspending thread */ @@ -173,7 +173,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThreadList/suspendthrdlst001/suspendthrdlst001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThreadList/suspendthrdlst001/suspendthrdlst001.cpp index bf17ed9a711a..4a5817c25de5 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThreadList/suspendthrdlst001/suspendthrdlst001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThreadList/suspendthrdlst001/suspendthrdlst001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -57,8 +57,8 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { /* perform testing */ { - jthread* threads = NULL; - jvmtiError* results = NULL; + jthread* threads = nullptr; + jvmtiError* results = nullptr; int i; NSK_DISPLAY1("Allocate threads array: %d threads\n", threadsCount); @@ -130,7 +130,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0("Delete threads references\n"); for (i = 0; i < threadsCount; i++) { - if (threads[i] != NULL) + if (threads[i] != nullptr) NSK_TRACE(jni->DeleteGlobalRef(threads[i])); } @@ -156,14 +156,14 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { static int fillThreadsByName(jvmtiEnv* jvmti, JNIEnv* jni, const char name[], int foundCount, jthread foundThreads[]) { jint count = 0; - jthread* threads = NULL; + jthread* threads = nullptr; size_t len = strlen(name); int found = 0; int i; for (i = 0; i < foundCount; i++) { - foundThreads[i] = NULL; + foundThreads[i] = nullptr; } if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&count, &threads))) { @@ -180,7 +180,7 @@ static int fillThreadsByName(jvmtiEnv* jvmti, JNIEnv* jni, break; } - if (info.name != NULL && strncmp(name, info.name, len) == 0) { + if (info.name != nullptr && strncmp(name, info.name, len) == 0) { NSK_DISPLAY3(" ... found thread #%d: %p (%s)\n", found, threads[i], info.name); if (found < foundCount) @@ -208,7 +208,7 @@ static int fillThreadsByName(jvmtiEnv* jvmti, JNIEnv* jni, NSK_DISPLAY1("Make global references for threads: %d threads\n", foundCount); for (i = 0; i < foundCount; i++) { if (!NSK_JNI_VERIFY(jni, (foundThreads[i] = (jthread) - jni->NewGlobalRef(foundThreads[i])) != NULL)) { + jni->NewGlobalRef(foundThreads[i])) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -233,7 +233,7 @@ JNIEXPORT jint JNI_OnLoad_suspendthrdlst001(JavaVM *jvm, char *options, void *re } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; /* init framework and parse options */ if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) @@ -248,7 +248,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add specific capabilities for suspending thread */ @@ -261,7 +261,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThreadList/suspendthrdlst002/suspendthrdlst002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThreadList/suspendthrdlst002/suspendthrdlst002.cpp index 1145bb3c1cb9..2868fbf54396 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThreadList/suspendthrdlst002/suspendthrdlst002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/SuspendThreadList/suspendthrdlst002/suspendthrdlst002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -50,7 +50,7 @@ static jvmtiEvent eventsList[EVENTS_COUNT] = { }; static int threadsCount = 0; -static jthread* threads = NULL; +static jthread* threads = nullptr; static volatile int eventsReceived = 0; @@ -69,7 +69,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { /* perform testing */ { - jvmtiError* results = NULL; + jvmtiError* results = nullptr; int i; NSK_DISPLAY1("Allocate threads array: %d threads\n", threadsCount); @@ -108,7 +108,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { eventsReceived = 0; NSK_DISPLAY1("Enable event: %s\n", "THREAD_END"); - if (!nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, eventsList, NULL)) + if (!nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, eventsList, nullptr)) return; NSK_DISPLAY0("Let threads to run and finish\n"); @@ -131,7 +131,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } NSK_DISPLAY1("Disable event: %s\n", "THREAD_END"); - if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, eventsList, NULL)) + if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, eventsList, nullptr)) return; NSK_DISPLAY0("Resume threads list\n"); @@ -146,7 +146,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0("Delete threads references\n"); for (i = 0; i < threadsCount; i++) { - if (threads[i] != NULL) + if (threads[i] != nullptr) NSK_TRACE(jni->DeleteGlobalRef(threads[i])); } @@ -172,14 +172,14 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { static int fillThreadsByName(jvmtiEnv* jvmti, JNIEnv* jni, const char name[], int foundCount, jthread foundThreads[]) { jint count = 0; - jthread* threads = NULL; + jthread* threads = nullptr; size_t len = strlen(name); int found = 0; int i; for (i = 0; i < foundCount; i++) { - foundThreads[i] = NULL; + foundThreads[i] = nullptr; } if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&count, &threads))) { @@ -196,7 +196,7 @@ static int fillThreadsByName(jvmtiEnv* jvmti, JNIEnv* jni, break; } - if (info.name != NULL && strncmp(name, info.name, len) == 0) { + if (info.name != nullptr && strncmp(name, info.name, len) == 0) { NSK_DISPLAY3(" ... found thread #%d: %p (%s)\n", found, threads[i], info.name); if (found < foundCount) @@ -224,7 +224,7 @@ static int fillThreadsByName(jvmtiEnv* jvmti, JNIEnv* jni, NSK_DISPLAY1("Make global references for threads: %d threads\n", foundCount); for (i = 0; i < foundCount; i++) { if (!NSK_JNI_VERIFY(jni, (foundThreads[i] = (jthread) - jni->NewGlobalRef(foundThreads[i])) != NULL)) { + jni->NewGlobalRef(foundThreads[i])) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -243,7 +243,7 @@ callbackThreadEnd(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { /* check if event is for tested thread */ for (i = 0; i < threadsCount; i++) { - if (thread != NULL && + if (thread != nullptr && jni->IsSameObject(threads[i], thread)) { NSK_DISPLAY2(" ... received THREAD_END event for thread #%d: %p\n", i, (void*)thread); @@ -269,7 +269,7 @@ JNIEXPORT jint JNI_OnLoad_suspendthrdlst002(JavaVM *jvm, char *options, void *re } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; /* init framework and parse options */ if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) @@ -284,7 +284,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add specific capabilities for suspending thread */ @@ -306,7 +306,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/VMDeath/vmdeath001/vmdeath001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/VMDeath/vmdeath001/vmdeath001.cpp index 887b217608d8..9f692a799ac8 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/VMDeath/vmdeath001/vmdeath001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/VMDeath/vmdeath001/vmdeath001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,18 +27,18 @@ #include #include -#include "agent_common.h" +#include "agent_common.hpp" -#include "nsk_tools.h" -#include "JVMTITools.h" -#include "jvmti_tools.h" +#include "nsk_tools.hpp" +#include "JVMTITools.hpp" +#include "jvmti_tools.hpp" extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; /** callback functions **/ @@ -81,7 +81,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; NSK_DISPLAY0("setting event callbacks ...\n"); @@ -91,7 +91,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; NSK_DISPLAY0("setting event callbacks done\nenabling VMDeath event ...\n"); - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, nullptr))) return JNI_ERR; NSK_DISPLAY0("enabling VMDeath event done\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/VMInit/vminit001/vminit001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/VMInit/vminit001/vminit001.cpp index 7480242377a5..4e22da84a5d5 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/VMInit/vminit001/vminit001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/VMInit/vminit001/vminit001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -34,7 +34,7 @@ extern "C" { #define STATUS_FAILED 2 #define WAIT_TIME 1000 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -52,7 +52,7 @@ void JNICALL VMInit(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thr) { } err = jvmti_env->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_THREAD_START, NULL); + JVMTI_EVENT_THREAD_START, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable JVMTI_EVENT_THREAD_START: %s (%d)\n", TranslateError(err), err); @@ -107,7 +107,7 @@ void JNICALL ThreadStart(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thread) { if (printdump == JNI_TRUE) { printf(">>> thread start: %s\n", inf.name); } - if (inf.name != NULL && strcmp(name, inf.name) == 0) { + if (inf.name != nullptr && strcmp(name, inf.name) == 0) { mainStarted++; if (eventsCount == 0) { printf("ThreadStart event for the main thread occurs\n"); @@ -132,12 +132,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -152,7 +152,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_VM_INIT, NULL); + JVMTI_EVENT_VM_INIT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable JVMTI_EVENT_VM_INIT: %s (%d)\n", TranslateError(err), err); @@ -164,7 +164,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { JNIEXPORT jint JNICALL Java_nsk_jvmti_VMInit_vminit001_check(JNIEnv *env, jclass cls) { - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP01/ap01t001/ap01t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP01/ap01t001/ap01t001.cpp index 667396da93e5..b0795077bd2b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP01/ap01t001/ap01t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP01/ap01t001/ap01t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,12 +25,12 @@ #include #include #include -#include "agent_common.h" +#include "agent_common.hpp" -#include "nsk_tools.h" -#include "jni_tools.h" -#include "JVMTITools.h" -#include "jvmti_tools.h" +#include "nsk_tools.hpp" +#include "jni_tools.hpp" +#include "JVMTITools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -39,8 +39,8 @@ extern "C" { #define EXP_OBJ_NUMBER 7 -static JNIEnv *jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv *jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jvmtiCapabilities caps; @@ -146,17 +146,17 @@ Java_nsk_jvmti_scenarios_allocation_AP01_ap01t001_newObject(JNIEnv* jni, jclass jmethodID cid; jobject result; - if (!NSK_JNI_VERIFY(jni, (cid = jni->GetMethodID(cls, "", "()V")) != NULL)) { - NSK_COMPLAIN0("newObject: GetMethodID returned NULL\n\n"); + if (!NSK_JNI_VERIFY(jni, (cid = jni->GetMethodID(cls, "", "()V")) != nullptr)) { + NSK_COMPLAIN0("newObject: GetMethodID returned null\n\n"); nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } - if (!NSK_JNI_VERIFY(jni, (result = jni->NewObject(cls, cid)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (result = jni->NewObject(cls, cid)) != nullptr)) { - NSK_COMPLAIN0("newObject: NewObject returned NULL\n\n"); + NSK_COMPLAIN0("newObject: NewObject returned null\n\n"); nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } return result; @@ -167,25 +167,25 @@ Java_nsk_jvmti_scenarios_allocation_AP01_ap01t001_allocObject(JNIEnv* jni, jclas jmethodID cid; jobject result; - if (!NSK_JNI_VERIFY(jni, (cid = jni->GetMethodID(cls, "", "()V")) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (cid = jni->GetMethodID(cls, "", "()V")) != nullptr)) { - NSK_COMPLAIN0("allocObject: GetMethodID returned NULL\n\n"); + NSK_COMPLAIN0("allocObject: GetMethodID returned null\n\n"); nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } - if (!NSK_JNI_VERIFY(jni, (result = jni->AllocObject(cls)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (result = jni->AllocObject(cls)) != nullptr)) { - NSK_COMPLAIN0("allocObject: AllocObject returned NULL\n\n"); + NSK_COMPLAIN0("allocObject: AllocObject returned null\n\n"); nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } if (!NSK_JNI_VERIFY_VOID(jni,jni->CallNonvirtualVoidMethod(result, cls, cid))) { NSK_COMPLAIN0("newObject: CallNonvirtualVoidMethod failed\n\n"); nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } return result; @@ -196,7 +196,7 @@ Java_nsk_jvmti_scenarios_allocation_AP01_ap01t001_flushObjectFreeEvents(JNIEnv* // Already enabled, but this triggers flush of pending events. if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, - NULL))) { + nullptr))) { nsk_jvmti_setFailStatus(); } } @@ -204,7 +204,7 @@ Java_nsk_jvmti_scenarios_allocation_AP01_ap01t001_flushObjectFreeEvents(JNIEnv* static void JNICALL agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { - jclass debugeeClass = NULL; + jclass debugeeClass = nullptr; NSK_DISPLAY0("Wait for debugee start\n\n"); if (!NSK_VERIFY(nsk_jvmti_waitForSync(timeout))) @@ -212,7 +212,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_SIGNATURE); debugeeClass = nsk_jvmti_classBySignature(DEBUGEE_SIGNATURE); - if (debugeeClass == NULL) { + if (debugeeClass == nullptr) { nsk_jvmti_setFailStatus(); return; } @@ -313,7 +313,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; memset(&caps, 0, sizeof(jvmtiCapabilities)); @@ -343,15 +343,15 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { NSK_DISPLAY0("setting event callbacks done\nenabling JVMTI events ...\n"); if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, - NULL))) + nullptr))) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, - NULL))) + nullptr))) return JNI_ERR; NSK_DISPLAY0("enabling the events done\n\n"); - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; NSK_DISPLAY0("agentProc has been set\n\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP02/ap02t001/ap02t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP02/ap02t001/ap02t001.cpp index 409784d43ea2..11f3f63751e9 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP02/ap02t001/ap02t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP02/ap02t001/ap02t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,12 +24,12 @@ #include #include #include -#include "agent_common.h" +#include "agent_common.hpp" -#include "nsk_tools.h" -#include "jni_tools.h" -#include "JVMTITools.h" -#include "jvmti_tools.h" +#include "nsk_tools.hpp" +#include "jni_tools.hpp" +#include "JVMTITools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -38,8 +38,8 @@ extern "C" { #define TESTED_CLASS "ap02t001Exception" -static JNIEnv *jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv *jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jvmtiCapabilities caps; @@ -50,7 +50,7 @@ static jlong timeout = 0; static int user_data = 0; static const char* TESTED_CLASS_SIGNATURE = "Lnsk/jvmti/scenarios/allocation/AP02/ap02t001Exception;"; static const jlong TESTED_CLASS_TAG = (jlong)1024; -static jclass testedClass = NULL; +static jclass testedClass = nullptr; jvmtiIterationControl JNICALL heapObjectCallback(jlong class_tag, @@ -142,9 +142,9 @@ static void runIterations (jvmtiEnv* jvmti, jclass testedClass, jint exp_count) NSK_DISPLAY0("Calling IterateOverReachableObjects\n"); obj_count = 0; - if (!NSK_JVMTI_VERIFY(jvmti->IterateOverReachableObjects(NULL /*heapRootCallback*/, + if (!NSK_JVMTI_VERIFY(jvmti->IterateOverReachableObjects(nullptr /*heapRootCallback*/, stackReferenceCallback, - NULL /*objectReferenceCallback*/, + nullptr /*objectReferenceCallback*/, &user_data))) { nsk_jvmti_setFailStatus(); return; @@ -173,12 +173,12 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY1("Find tested class: %s\n", TESTED_CLASS_SIGNATURE); testedClass = nsk_jvmti_classBySignature(TESTED_CLASS_SIGNATURE); - if (testedClass == NULL) { + if (testedClass == nullptr) { nsk_jvmti_setFailStatus(); return; } - if (!NSK_JNI_VERIFY(jni, (testedClass = (jclass)jni->NewGlobalRef(testedClass)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (testedClass = (jclass)jni->NewGlobalRef(testedClass)) != nullptr)) return; NSK_DISPLAY0("Set tag for tested class\n\n"); @@ -222,7 +222,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; memset(&caps, 0, sizeof(jvmtiCapabilities)); @@ -236,7 +236,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!caps.can_tag_objects) NSK_DISPLAY0("Warning: tagging objects is not implemented\n"); - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; NSK_DISPLAY0("agentProc has been set\n\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP03/ap03t001/ap03t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP03/ap03t001/ap03t001.cpp index 0ebfdadeafcc..e50e1ff537bc 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP03/ap03t001/ap03t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP03/ap03t001/ap03t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,19 +24,19 @@ #include #include #include -#include "agent_common.h" +#include "agent_common.hpp" -#include "nsk_tools.h" -#include "jni_tools.h" -#include "JVMTITools.h" -#include "jvmti_tools.h" +#include "nsk_tools.hpp" +#include "jni_tools.hpp" +#include "JVMTITools.hpp" +#include "jvmti_tools.hpp" extern "C" { #define EXP_OBJ_NUMBER 1 -static JNIEnv *jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv *jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jvmtiCapabilities caps; @@ -98,7 +98,7 @@ Java_nsk_jvmti_scenarios_allocation_AP03_ap03t001_setTag(JNIEnv* jni, jobject ob static void JNICALL agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { - jclass debugeeClass = NULL; + jclass debugeeClass = nullptr; NSK_DISPLAY0("Wait for debugee start\n\n"); if (!NSK_VERIFY(nsk_jvmti_waitForSync(timeout))) @@ -110,7 +110,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_SIGNATURE); debugeeClass = nsk_jvmti_classBySignature(DEBUGEE_SIGNATURE); - if (debugeeClass == NULL) { + if (debugeeClass == nullptr) { nsk_jvmti_setFailStatus(); break; } @@ -160,14 +160,14 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } if (!NSK_JNI_VERIFY(jni, (fid = - jni->GetStaticFieldID(debugeeClass, "catcher", DEBUGEE_SIGNATURE)) != NULL)) { + jni->GetStaticFieldID(debugeeClass, "catcher", DEBUGEE_SIGNATURE)) != nullptr)) { nsk_jvmti_setFailStatus(); break; } if (!NSK_JNI_VERIFY(jni, (catcher = - jni->GetStaticObjectField(debugeeClass, fid)) != NULL)) { - NSK_COMPLAIN0("GetStaticObjectField returned NULL for 'catcher' field value\n\n"); + jni->GetStaticObjectField(debugeeClass, fid)) != nullptr)) { + NSK_COMPLAIN0("GetStaticObjectField returned null for 'catcher' field value\n\n"); nsk_jvmti_setFailStatus(); break; } @@ -215,7 +215,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; memset(&caps, 0, sizeof(jvmtiCapabilities)); @@ -244,11 +244,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { NSK_DISPLAY0("setting event callbacks done\nenabling JVMTI events ...\n"); if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, - NULL))) + nullptr))) return JNI_ERR; NSK_DISPLAY0("enabling the events done\n\n"); - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; NSK_DISPLAY0("agentProc has been set\n\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP04/ap04t001/ap04t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP04/ap04t001/ap04t001.cpp index cf79fe945a11..e9eaf32a6bc7 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP04/ap04t001/ap04t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP04/ap04t001/ap04t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,19 +24,19 @@ #include #include #include -#include "agent_common.h" +#include "agent_common.hpp" -#include "nsk_tools.h" -#include "jni_tools.h" -#include "JVMTITools.h" -#include "jvmti_tools.h" +#include "nsk_tools.hpp" +#include "jni_tools.hpp" +#include "JVMTITools.hpp" +#include "jvmti_tools.hpp" extern "C" { #define OBJ_MAX_COUNT 100000 -static JNIEnv *jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv *jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jvmtiCapabilities caps; @@ -52,9 +52,9 @@ static jvmtiEvent events[] = { JVMTI_EVENT_GARBAGE_COLLECTION_FINISH }; -static jclass debugeeClass = NULL; -static jfieldID rootFieldID = NULL; -static jmethodID unlockSecondaryID = NULL; +static jclass debugeeClass = nullptr; +static jfieldID rootFieldID = nullptr; +static jmethodID unlockSecondaryID = nullptr; static volatile int eventCount = 0; static volatile int iterationCount = 0; @@ -62,7 +62,7 @@ static volatile int errorCount = 0; /***********************************************************************/ -static jrawMonitorID counterMonitor_ptr = NULL; +static jrawMonitorID counterMonitor_ptr = nullptr; static void increaseCounter(volatile int* counterPtr) { @@ -269,7 +269,7 @@ Java_nsk_jvmti_scenarios_allocation_AP04_ap04t001_runIterateOverHeap(JNIEnv* jni NSK_DISPLAY0("Calling IterateOverHeap...\n"); if (!NSK_JVMTI_VERIFY(jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_TAGGED, heapObjectCallback, - NULL /*user_data*/))) { + nullptr /*user_data*/))) { nsk_jvmti_setFailStatus(); } NSK_DISPLAY0("IterateOverHeap finished.\n"); @@ -298,7 +298,7 @@ Java_nsk_jvmti_scenarios_allocation_AP04_ap04t001_runIterateOverReachableObjects if (!NSK_JVMTI_VERIFY(jvmti->IterateOverReachableObjects(heapRootCallback, stackReferenceCallback, objectReferenceCallback, - NULL /*user_data*/))) { + nullptr /*user_data*/))) { nsk_jvmti_setFailStatus(); } NSK_DISPLAY0("IterateOverReachableObjects finished.\n"); @@ -327,7 +327,7 @@ Java_nsk_jvmti_scenarios_allocation_AP04_ap04t001_runIterateOverInstancesOfClass if (!NSK_JVMTI_VERIFY(jvmti->IterateOverInstancesOfClass(debugeeClass, JVMTI_HEAP_OBJECT_TAGGED, heapObjectCallback, - NULL /*user_data*/))) { + nullptr /*user_data*/))) { nsk_jvmti_setFailStatus(); } NSK_DISPLAY0("IterateOverInstancesOfClass finished.\n"); @@ -347,12 +347,12 @@ JNIEXPORT void JNICALL Java_nsk_jvmti_scenarios_allocation_AP04_ap04t001_runIterateOverObjectsReachableFromObject(JNIEnv* jni, jclass klass) { - jobject root = NULL; + jobject root = nullptr; int count = 0; if (!NSK_JNI_VERIFY(jni, (root = - jni->GetStaticObjectField(debugeeClass, rootFieldID)) != NULL)) { - NSK_COMPLAIN0("GetStaticObjectField returned NULL for 'root' field value\n\n"); + jni->GetStaticObjectField(debugeeClass, rootFieldID)) != nullptr)) { + NSK_COMPLAIN0("GetStaticObjectField returned null for 'root' field value\n\n"); nsk_jvmti_setFailStatus(); return; } @@ -367,7 +367,7 @@ Java_nsk_jvmti_scenarios_allocation_AP04_ap04t001_runIterateOverObjectsReachable NSK_DISPLAY0("Calling IterateOverObjectsReachableFromObject...\n"); if (!NSK_JVMTI_VERIFY(jvmti->IterateOverObjectsReachableFromObject(root, objectReferenceCallback, - NULL /*user_data*/))) { + nullptr /*user_data*/))) { nsk_jvmti_setFailStatus(); } NSK_DISPLAY0("IterateOverObjectsReachableFromObject finished.\n"); @@ -392,24 +392,24 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_SIGNATURE); debugeeClass = nsk_jvmti_classBySignature(DEBUGEE_SIGNATURE); - if (debugeeClass == NULL) { + if (debugeeClass == nullptr) { nsk_jvmti_setFailStatus(); return; } - if (!NSK_JNI_VERIFY(jni, (debugeeClass = (jclass)jni->NewGlobalRef(debugeeClass)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (debugeeClass = (jclass)jni->NewGlobalRef(debugeeClass)) != nullptr)) return; NSK_DISPLAY1("Find ID of 'root' field: %s\n", ROOT_SIGNATURE); if (!NSK_JNI_VERIFY(jni, (rootFieldID = - jni->GetStaticFieldID(debugeeClass, "root", ROOT_SIGNATURE)) != NULL)) { + jni->GetStaticFieldID(debugeeClass, "root", ROOT_SIGNATURE)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY1("Find ID of 'unlockSecondary' method: %s\n", ROOT_SIGNATURE); if (!NSK_JNI_VERIFY(jni, (unlockSecondaryID = - jni->GetStaticMethodID(debugeeClass, "unlockSecondary", "()V")) != NULL)) { + jni->GetStaticMethodID(debugeeClass, "unlockSecondary", "()V")) != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -423,7 +423,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { if (!NSK_VERIFY(nsk_jvmti_waitForSync(timeout))) return; - nsk_jvmti_enableEvents(JVMTI_DISABLE, eventsCount, events, NULL); + nsk_jvmti_enableEvents(JVMTI_DISABLE, eventsCount, events, nullptr); NSK_TRACE(jni->DeleteGlobalRef(debugeeClass)); NSK_TRACE(jvmti->DestroyRawMonitor(counterMonitor_ptr)); @@ -451,7 +451,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("counterMonitor", &counterMonitor_ptr))) { @@ -489,12 +489,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { NSK_DISPLAY0("setting event callbacks done.\n"); NSK_DISPLAY0("enabling JVMTI events ...\n"); - if (!nsk_jvmti_enableEvents(JVMTI_ENABLE, eventsCount, events, NULL)) { + if (!nsk_jvmti_enableEvents(JVMTI_ENABLE, eventsCount, events, nullptr)) { return JNI_ERR; } NSK_DISPLAY0("enabling the events done.\n"); - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; NSK_DISPLAY0("agentProc has been set\n\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP04/ap04t002/ap04t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP04/ap04t002/ap04t002.cpp index f42bb0d8680f..dd983b0e918a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP04/ap04t002/ap04t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP04/ap04t002/ap04t002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,19 +24,19 @@ #include #include #include -#include "agent_common.h" +#include "agent_common.hpp" -#include "nsk_tools.h" -#include "jni_tools.h" -#include "JVMTITools.h" -#include "jvmti_tools.h" +#include "nsk_tools.hpp" +#include "jni_tools.hpp" +#include "JVMTITools.hpp" +#include "jvmti_tools.hpp" extern "C" { #define OBJ_MAX_COUNT 100000 -static JNIEnv *jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv *jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jvmtiCapabilities caps; @@ -49,13 +49,13 @@ static volatile int modificationCount = 0; static volatile int iterationCount = 0; static volatile int errorCount = 0; -static jclass debugeeClass = NULL; +static jclass debugeeClass = nullptr; static jfieldID rootFieldID; static jfieldID modifiedFieldID; /***********************************************************************/ -static jrawMonitorID counterMonitor_ptr = NULL; +static jrawMonitorID counterMonitor_ptr = nullptr; static void increaseCounter(volatile int* counterPtr) { @@ -249,7 +249,7 @@ Java_nsk_jvmti_scenarios_allocation_AP04_ap04t002_runIterateOverHeap(JNIEnv* jni NSK_DISPLAY0("Calling IterateOverHeap...\n"); if (!NSK_JVMTI_VERIFY(jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_TAGGED, heapObjectCallback, - NULL /*user_data*/))) { + nullptr /*user_data*/))) { nsk_jvmti_setFailStatus(); } NSK_DISPLAY0("IterateOverHeap finished.\n"); @@ -279,7 +279,7 @@ Java_nsk_jvmti_scenarios_allocation_AP04_ap04t002_runIterateOverReachableObjects if (!NSK_JVMTI_VERIFY(jvmti->IterateOverReachableObjects(heapRootCallback, stackReferenceCallback, objectReferenceCallback, - NULL /*user_data*/))) { + nullptr /*user_data*/))) { nsk_jvmti_setFailStatus(); } NSK_DISPLAY0("IterateOverReachableObjects finished.\n"); @@ -309,7 +309,7 @@ Java_nsk_jvmti_scenarios_allocation_AP04_ap04t002_runIterateOverInstancesOfClass if (!NSK_JVMTI_VERIFY(jvmti->IterateOverInstancesOfClass(debugeeClass, JVMTI_HEAP_OBJECT_TAGGED, heapObjectCallback, - NULL /*user_data*/))) { + nullptr /*user_data*/))) { nsk_jvmti_setFailStatus(); } NSK_DISPLAY0("IterateOverInstancesOfClass finished.\n"); @@ -329,12 +329,12 @@ Java_nsk_jvmti_scenarios_allocation_AP04_ap04t002_runIterateOverInstancesOfClass JNIEXPORT void JNICALL Java_nsk_jvmti_scenarios_allocation_AP04_ap04t002_runIterateOverObjectsReachableFromObject(JNIEnv* jni, jclass klass) { - jobject root = NULL; + jobject root = nullptr; int count = 0; if (!NSK_JNI_VERIFY(jni, (root = - jni->GetStaticObjectField(debugeeClass, rootFieldID)) != NULL)) { - NSK_COMPLAIN0("GetStaticObjectField returned NULL for 'root' field value\n\n"); + jni->GetStaticObjectField(debugeeClass, rootFieldID)) != nullptr)) { + NSK_COMPLAIN0("GetStaticObjectField returned null for 'root' field value\n\n"); nsk_jvmti_setFailStatus(); return; } @@ -346,7 +346,7 @@ Java_nsk_jvmti_scenarios_allocation_AP04_ap04t002_runIterateOverObjectsReachable NSK_DISPLAY0("Calling IterateOverObjectsReachableFromObject...\n"); if (!NSK_JVMTI_VERIFY(jvmti->IterateOverObjectsReachableFromObject(root, objectReferenceCallback, - NULL /*user_data*/))) { + nullptr /*user_data*/))) { nsk_jvmti_setFailStatus(); } NSK_DISPLAY0("IterateOverObjectsReachableFromObject finished.\n"); @@ -372,24 +372,24 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_SIGNATURE); debugeeClass = nsk_jvmti_classBySignature(DEBUGEE_SIGNATURE); - if (debugeeClass == NULL) { + if (debugeeClass == nullptr) { nsk_jvmti_setFailStatus(); return; } - if (!NSK_JNI_VERIFY(jni, (debugeeClass = (jclass)jni->NewGlobalRef(debugeeClass)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (debugeeClass = (jclass)jni->NewGlobalRef(debugeeClass)) != nullptr)) return; NSK_DISPLAY1("Find ID of 'root' field: %s\n", ROOT_SIGNATURE); if (!NSK_JNI_VERIFY(jni, (rootFieldID = - jni->GetStaticFieldID(debugeeClass, "root", ROOT_SIGNATURE)) != NULL)) { + jni->GetStaticFieldID(debugeeClass, "root", ROOT_SIGNATURE)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY0("Find ID of 'modified' field\n"); if (!NSK_JNI_VERIFY(jni, (modifiedFieldID = - jni->GetStaticFieldID(debugeeClass, "modified", "I")) != NULL)) { + jni->GetStaticFieldID(debugeeClass, "modified", "I")) != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -434,7 +434,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("counterMonitor", &counterMonitor_ptr))) { @@ -469,11 +469,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { NSK_DISPLAY0("enabling JVMTI events ...\n"); if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FIELD_MODIFICATION, - NULL))) + nullptr))) return JNI_ERR; NSK_DISPLAY0("enabling the events done.\n"); - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; NSK_DISPLAY0("agentProc has been set\n\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP04/ap04t003/ap04t003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP04/ap04t003/ap04t003.cpp index 99f4ec370197..b596cdda2d37 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP04/ap04t003/ap04t003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP04/ap04t003/ap04t003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,19 +24,19 @@ #include #include #include -#include "agent_common.h" +#include "agent_common.hpp" #include "ExceptionCheckingJniEnv.hpp" -#include "nsk_tools.h" -#include "jni_tools.h" -#include "JVMTITools.h" -#include "jvmti_tools.h" +#include "nsk_tools.hpp" +#include "jni_tools.hpp" +#include "JVMTITools.hpp" +#include "jvmti_tools.hpp" extern "C" { #define OBJ_MAX_COUNT 100000 -static JNIEnv *jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv *jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jvmtiCapabilities caps; @@ -45,19 +45,19 @@ static jlong timeout = 0; static const char* DEBUGEE_SIGNATURE = "Lnsk/jvmti/scenarios/allocation/AP04/ap04t003;"; static const char* ROOT_SIGNATURE = "[Lnsk/jvmti/scenarios/allocation/AP04/ap04t003;"; -static jclass debugeeClass = NULL; +static jclass debugeeClass = nullptr; static jfieldID rootFieldID; -static jrawMonitorID startLock = NULL; -static jrawMonitorID runLock = NULL; -static jrawMonitorID endLock = NULL; +static jrawMonitorID startLock = nullptr; +static jrawMonitorID runLock = nullptr; +static jrawMonitorID endLock = nullptr; static volatile int iterationCount = 0; static volatile int objectCount = 0; /***********************************************************************/ -static jrawMonitorID counterMonitor_ptr = NULL; +static jrawMonitorID counterMonitor_ptr = nullptr; static void increaseCounter(volatile int* counterPtr) { @@ -210,7 +210,7 @@ objectReferenceCallback(jvmtiObjectReferenceKind reference_kind, void JNICALL agent_start(jvmtiEnv* jvmti, JNIEnv* jni, void *p) { jint taggedObjectsCount = 0; - jobject* taggedObjectsList = NULL; + jobject* taggedObjectsList = nullptr; NSK_DISPLAY0("Agent thread: started.\n"); @@ -219,7 +219,7 @@ void JNICALL agent_start(jvmtiEnv* jvmti, JNIEnv* jni, void *p) { jlong tag = (jlong)1; if (!NSK_JVMTI_VERIFY(jvmti->GetObjectsWithTags( - 1, &tag, &taggedObjectsCount, &taggedObjectsList, NULL))) { + 1, &tag, &taggedObjectsCount, &taggedObjectsList, nullptr))) { nsk_jvmti_setFailStatus(); return; } @@ -315,7 +315,7 @@ static int startThread(jthread threadObj) { /* start thread */ if (!NSK_JVMTI_VERIFY( - jvmti->RunAgentThread(threadObj, agent_start, NULL, JVMTI_THREAD_NORM_PRIORITY))) { + jvmti->RunAgentThread(threadObj, agent_start, nullptr, JVMTI_THREAD_NORM_PRIORITY))) { success = NSK_FALSE; nsk_jvmti_setFailStatus(); } else { @@ -348,7 +348,7 @@ static jthread newThreadObj(JNIEnv* jni_env) { /** Clean counters and start new agent thread with agent_start() body. */ static int prepareToIteration(JNIEnv* jni) { - jthread threadObj = NULL; + jthread threadObj = nullptr; setCounter(&iterationCount, 0); setCounter(&objectCount, 0); @@ -408,7 +408,7 @@ Java_nsk_jvmti_scenarios_allocation_AP04_ap04t003_runIterateOverHeap(JNIEnv* jni NSK_DISPLAY0("Calling IterateOverHeap...\n"); if (!NSK_JVMTI_VERIFY(jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_TAGGED, heapObjectCallback, - NULL /*user_data*/))) { + nullptr /*user_data*/))) { nsk_jvmti_setFailStatus(); } NSK_DISPLAY0("IterateOverHeap finished.\n"); @@ -439,7 +439,7 @@ Java_nsk_jvmti_scenarios_allocation_AP04_ap04t003_runIterateOverReachableObjects if (!NSK_JVMTI_VERIFY(jvmti->IterateOverReachableObjects(heapRootCallback, stackReferenceCallback, objectReferenceCallback, - NULL /*user_data*/))) { + nullptr /*user_data*/))) { nsk_jvmti_setFailStatus(); } NSK_DISPLAY0("IterateOverReachableObjects finished.\n"); @@ -470,7 +470,7 @@ Java_nsk_jvmti_scenarios_allocation_AP04_ap04t003_runIterateOverInstancesOfClass if (!NSK_JVMTI_VERIFY(jvmti->IterateOverInstancesOfClass(debugeeClass, JVMTI_HEAP_OBJECT_TAGGED, heapObjectCallback, - NULL /*user_data*/))) { + nullptr /*user_data*/))) { nsk_jvmti_setFailStatus(); } NSK_DISPLAY0("IterateOverInstancesOfClass finished.\n"); @@ -492,7 +492,7 @@ JNIEXPORT void JNICALL Java_nsk_jvmti_scenarios_allocation_AP04_ap04t003_runIterateOverObjectsReachableFromObject(JNIEnv* jni_env, jclass klass) { ExceptionCheckingJniEnvPtr ec_jni(jni_env); - jobject root = NULL; + jobject root = nullptr; int modified = 0; int found = 0; @@ -504,7 +504,7 @@ Java_nsk_jvmti_scenarios_allocation_AP04_ap04t003_runIterateOverObjectsReachable NSK_DISPLAY0("Calling IterateOverObjectsReachableFromObject...\n"); if (!NSK_JVMTI_VERIFY(jvmti->IterateOverObjectsReachableFromObject(root, objectReferenceCallback, - NULL /*user_data*/))) { + nullptr /*user_data*/))) { nsk_jvmti_setFailStatus(); } NSK_DISPLAY0("IterateOverObjectsReachableFromObject finished.\n"); @@ -531,7 +531,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni_env, void* arg) { NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_SIGNATURE); debugeeClass = nsk_jvmti_classBySignature(DEBUGEE_SIGNATURE); - if (debugeeClass == NULL) { + if (debugeeClass == nullptr) { nsk_jvmti_setFailStatus(); return; } @@ -579,7 +579,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("counterMonitor", &counterMonitor_ptr))) { @@ -608,7 +608,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!caps.can_tag_objects) NSK_DISPLAY0("Warning: tagging objects is not available\n"); - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; NSK_DISPLAY0("agentProc has been set\n\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP05/ap05t001/ap05t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP05/ap05t001/ap05t001.cpp index b2b5f5cbb1ba..4d233dcab4fb 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP05/ap05t001/ap05t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP05/ap05t001/ap05t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,24 +24,24 @@ #include #include #include -#include "agent_common.h" +#include "agent_common.hpp" -#include "nsk_tools.h" -#include "jni_tools.h" -#include "JVMTITools.h" -#include "jvmti_tools.h" +#include "nsk_tools.hpp" +#include "jni_tools.hpp" +#include "JVMTITools.hpp" +#include "jvmti_tools.hpp" extern "C" { #define EXP_OBJ_NUMBER 1 -static JNIEnv *jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv *jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jvmtiCapabilities caps; static jlong timeout = 0; -static jobject referrer = NULL; +static jobject referrer = nullptr; static const char* SUBCLASS_SIGNATURE = "Lnsk/jvmti/scenarios/allocation/AP05/ap05t001Subclass;"; static const int EXPECTED_STATIC_FIELDS_COUNT = 8; /* 8 ones declared in ap05t001Superclass + 8 ones declared in ap05t001Subclass */ @@ -112,14 +112,14 @@ Java_nsk_jvmti_scenarios_allocation_AP05_ap05t001_setTag(JNIEnv* jni, JNIEXPORT void JNICALL Java_nsk_jvmti_scenarios_allocation_AP05_ap05t001_setReferrer(JNIEnv* jni, jclass klass, jobject ref) { - if (!NSK_JNI_VERIFY(jni, (referrer = jni->NewGlobalRef(ref)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (referrer = jni->NewGlobalRef(ref)) != nullptr)) nsk_jvmti_setFailStatus(); } static void JNICALL agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { - jclass debugeeClass = NULL; + jclass debugeeClass = nullptr; NSK_DISPLAY0("Wait for debugee start\n\n"); if (!NSK_VERIFY(nsk_jvmti_waitForSync(timeout))) @@ -132,7 +132,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { if (!NSK_JVMTI_VERIFY(jvmti->IterateOverReachableObjects(heapRootCallback, stackReferenceCallback, objectReferenceCallback, - NULL /*user_data*/))) { + nullptr /*user_data*/))) { nsk_jvmti_setFailStatus(); break; } @@ -154,7 +154,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0("\nCalling IterateOverObjectsReachableFromObject\n"); { if (!NSK_JVMTI_VERIFY(jvmti->IterateOverObjectsReachableFromObject( - referrer, objectReferenceCallback, NULL /*user_data*/))) { + referrer, objectReferenceCallback, nullptr /*user_data*/))) { nsk_jvmti_setFailStatus(); break; } @@ -200,7 +200,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; memset(&caps, 0, sizeof(jvmtiCapabilities)); @@ -215,7 +215,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!caps.can_tag_objects) NSK_DISPLAY0("Warning: tagging objects is not implemented\n"); - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; NSK_DISPLAY0("agentProc has been set\n\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP05/ap05t002/ap05t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP05/ap05t002/ap05t002.cpp index 2d625ee9e960..3378d8368860 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP05/ap05t002/ap05t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP05/ap05t002/ap05t002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,24 +24,24 @@ #include #include #include -#include "agent_common.h" +#include "agent_common.hpp" -#include "nsk_tools.h" -#include "jni_tools.h" -#include "JVMTITools.h" -#include "jvmti_tools.h" +#include "nsk_tools.hpp" +#include "jni_tools.hpp" +#include "JVMTITools.hpp" +#include "jvmti_tools.hpp" extern "C" { #define EXP_OBJ_NUMBER 1 -static JNIEnv *jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv *jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jvmtiCapabilities caps; static jlong timeout = 0; -static jobject referrer = NULL; +static jobject referrer = nullptr; static const char* SUBCLASS_SIGNATURE = "Lnsk/jvmti/scenarios/allocation/AP05/ap05t002Subclass;"; static const long TAG1 = 1l, TAG2 = 2l; static int caseNumber = 0, forthRef = 0, backRef = 0; @@ -111,7 +111,7 @@ Java_nsk_jvmti_scenarios_allocation_AP05_ap05t002_setTag(JNIEnv* jni, JNIEXPORT void JNICALL Java_nsk_jvmti_scenarios_allocation_AP05_ap05t002_setReferrer(JNIEnv* jni, jclass klass, jobject ref, jint caseNum) { caseNumber = caseNum; - if (!NSK_JNI_VERIFY(jni, (referrer = jni->NewGlobalRef(ref)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (referrer = jni->NewGlobalRef(ref)) != nullptr)) nsk_jvmti_setFailStatus(); } @@ -122,7 +122,7 @@ static void runCase() { if (!NSK_JVMTI_VERIFY(jvmti->IterateOverReachableObjects(heapRootCallback, stackReferenceCallback, objectReferenceCallback, - NULL /*user_data*/))) { + nullptr /*user_data*/))) { nsk_jvmti_setFailStatus(); } if (forthRef != 1) { @@ -141,7 +141,7 @@ static void runCase() { backRef = 0; if (!NSK_JVMTI_VERIFY(jvmti->IterateOverObjectsReachableFromObject(referrer, objectReferenceCallback, - NULL /*user_data*/))) { + nullptr /*user_data*/))) { nsk_jvmti_setFailStatus(); } if (forthRef != 1) { @@ -159,7 +159,7 @@ static void runCase() { static void JNICALL agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { - jclass debugeeClass = NULL; + jclass debugeeClass = nullptr; NSK_DISPLAY0("Wait for debugee start\n\n"); if (!NSK_VERIFY(nsk_jvmti_waitForSync(timeout))) @@ -204,7 +204,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; memset(&caps, 0, sizeof(jvmtiCapabilities)); @@ -219,7 +219,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!caps.can_tag_objects) NSK_DISPLAY0("Warning: tagging objects is not implemented\n"); - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; NSK_DISPLAY0("agentProc has been set\n\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP06/ap06t001/ap06t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP06/ap06t001/ap06t001.cpp index b624c673683a..d720267675cf 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP06/ap06t001/ap06t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP06/ap06t001/ap06t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,19 +24,19 @@ #include #include #include -#include "agent_common.h" +#include "agent_common.hpp" -#include "nsk_tools.h" -#include "jni_tools.h" -#include "JVMTITools.h" -#include "jvmti_tools.h" +#include "nsk_tools.hpp" +#include "jni_tools.hpp" +#include "JVMTITools.hpp" +#include "jvmti_tools.hpp" extern "C" { #define EXP_OBJ_NUMBER 1 -static JNIEnv *jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv *jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jvmtiCapabilities caps; @@ -134,7 +134,7 @@ Java_nsk_jvmti_scenarios_allocation_AP06_ap06t001Thread_setTag(JNIEnv* jni, jobj static void JNICALL agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { - jclass debugeeClass = NULL; + jclass debugeeClass = nullptr; NSK_DISPLAY0("Wait for debugee start\n\n"); if (!NSK_VERIFY(nsk_jvmti_waitForSync(timeout))) @@ -147,32 +147,32 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY1("Find debugee class: %s\n", DEBUGEE_SIGNATURE); debugeeClass = nsk_jvmti_classBySignature(DEBUGEE_SIGNATURE); - if (debugeeClass == NULL) { + if (debugeeClass == nullptr) { nsk_jvmti_setFailStatus(); break; } if (!NSK_JNI_VERIFY(jni, (fid = - jni->GetStaticFieldID(debugeeClass, "thread", THREAD_CLS_SIGNATURE)) != NULL)) { + jni->GetStaticFieldID(debugeeClass, "thread", THREAD_CLS_SIGNATURE)) != nullptr)) { nsk_jvmti_setFailStatus(); break; } if (!NSK_JNI_VERIFY(jni, (localRefThread = - jni->GetStaticObjectField(debugeeClass, fid)) != NULL)) { - NSK_COMPLAIN0("GetStaticObjectField returned NULL for 'thread' field value\n\n"); + jni->GetStaticObjectField(debugeeClass, fid)) != nullptr)) { + NSK_COMPLAIN0("GetStaticObjectField returned null for 'thread' field value\n\n"); nsk_jvmti_setFailStatus(); break; } - if (!NSK_JNI_VERIFY(jni, (globalRefThread = jni->NewGlobalRef(localRefThread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (globalRefThread = jni->NewGlobalRef(localRefThread)) != nullptr)) return; NSK_DISPLAY0("Calling IterateOverReachableObjects\n"); if (!NSK_JVMTI_VERIFY(jvmti->IterateOverReachableObjects(heapRootCallback, stackReferenceCallback, objectReferenceCallback, - NULL /*user_data*/))) { + nullptr /*user_data*/))) { nsk_jvmti_setFailStatus(); break; } @@ -220,7 +220,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; memset(&caps, 0, sizeof(jvmtiCapabilities)); @@ -235,7 +235,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!caps.can_tag_objects) NSK_DISPLAY0("Warning: tagging objects is not implemented\n"); - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; NSK_DISPLAY0("agentProc has been set\n\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP07/ap07t001/ap07t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP07/ap07t001/ap07t001.cpp index 52988ac24694..d44092febdd2 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP07/ap07t001/ap07t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP07/ap07t001/ap07t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,24 +24,24 @@ #include #include #include -#include "agent_common.h" +#include "agent_common.hpp" -#include "nsk_tools.h" -#include "jni_tools.h" -#include "JVMTITools.h" -#include "jvmti_tools.h" +#include "nsk_tools.hpp" +#include "jni_tools.hpp" +#include "JVMTITools.hpp" +#include "jvmti_tools.hpp" extern "C" { #define EXP_OBJ_NUMBER 1 -static JNIEnv *jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv *jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jvmtiCapabilities caps; static jlong timeout = 0; -static jobject root = NULL; +static jobject root = nullptr; static const char* DEBUGEE_SIGNATURE = "Lnsk/jvmti/scenarios/allocation/AP07/ap07t001;"; static const jlong IGNORE_TAG = (jlong)10l; @@ -118,14 +118,14 @@ Java_nsk_jvmti_scenarios_allocation_AP07_ap07t001_setTag(JNIEnv* jni, JNIEXPORT void JNICALL Java_nsk_jvmti_scenarios_allocation_AP07_ap07t001_setRoot(JNIEnv* jni, jobject obj) { - if (!NSK_JNI_VERIFY(jni, (root = jni->NewGlobalRef(obj)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (root = jni->NewGlobalRef(obj)) != nullptr)) nsk_jvmti_setFailStatus(); } static void JNICALL agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { - jclass debugeeClass = NULL; + jclass debugeeClass = nullptr; NSK_DISPLAY0("Wait for debugee start\n\n"); if (!NSK_VERIFY(nsk_jvmti_waitForSync(timeout))) @@ -137,7 +137,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { if (!NSK_JVMTI_VERIFY(jvmti->IterateOverReachableObjects(heapRootCallback, stackReferenceCallback, objectReferenceCallback, - NULL /*user_data*/))) { + nullptr /*user_data*/))) { nsk_jvmti_setFailStatus(); break; } @@ -145,7 +145,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0("Calling IterateOverObjectsReachableFromObject\n"); { if (!NSK_JVMTI_VERIFY(jvmti->IterateOverObjectsReachableFromObject( - root, objectReferenceCallback, NULL /*user_data*/))) { + root, objectReferenceCallback, nullptr /*user_data*/))) { nsk_jvmti_setFailStatus(); break; } @@ -178,7 +178,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; memset(&caps, 0, sizeof(jvmtiCapabilities)); @@ -193,7 +193,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!caps.can_tag_objects) NSK_DISPLAY0("Warning: tagging objects is not implemented\n"); - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; NSK_DISPLAY0("agentProc has been set\n\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP07/ap07t002/ap07t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP07/ap07t002/ap07t002.cpp index 4b5e95344f14..9986c6b191ae 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP07/ap07t002/ap07t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP07/ap07t002/ap07t002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,24 +24,24 @@ #include #include #include -#include "agent_common.h" +#include "agent_common.hpp" -#include "nsk_tools.h" -#include "jni_tools.h" -#include "JVMTITools.h" -#include "jvmti_tools.h" +#include "nsk_tools.hpp" +#include "jni_tools.hpp" +#include "JVMTITools.hpp" +#include "jvmti_tools.hpp" extern "C" { #define EXP_OBJ_NUMBER 1 -static JNIEnv *jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv *jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jvmtiCapabilities caps; static jlong timeout = 0; -static jobject root = NULL; +static jobject root = nullptr; static const char* DEBUGEE_SIGNATURE = "Lnsk/jvmti/scenarios/allocation/AP07/ap07t002;"; static const jlong IGNORE_TAG = (jlong)10l; @@ -119,7 +119,7 @@ Java_nsk_jvmti_scenarios_allocation_AP07_ap07t002_setTag(JNIEnv* jni, static void JNICALL agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { - jclass debugeeClass = NULL; + jclass debugeeClass = nullptr; NSK_DISPLAY0("Wait for debugee start\n\n"); if (!NSK_VERIFY(nsk_jvmti_waitForSync(timeout))) @@ -131,7 +131,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { if (!NSK_JVMTI_VERIFY(jvmti->IterateOverReachableObjects(heapRootCallback, stackReferenceCallback, objectReferenceCallback, - NULL /*user_data*/))) { + nullptr /*user_data*/))) { nsk_jvmti_setFailStatus(); break; } @@ -161,7 +161,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; memset(&caps, 0, sizeof(jvmtiCapabilities)); @@ -176,7 +176,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!caps.can_tag_objects) NSK_DISPLAY0("Warning: tagging objects is not implemented\n"); - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; NSK_DISPLAY0("agentProc has been set\n\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP09/ap09t001/ap09t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP09/ap09t001/ap09t001.cpp index 00b866d1e920..aa429f46bafb 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP09/ap09t001/ap09t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP09/ap09t001/ap09t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,24 +24,24 @@ #include #include #include -#include "agent_common.h" +#include "agent_common.hpp" -#include "nsk_tools.h" -#include "jni_tools.h" -#include "JVMTITools.h" -#include "jvmti_tools.h" +#include "nsk_tools.hpp" +#include "jni_tools.hpp" +#include "JVMTITools.hpp" +#include "jvmti_tools.hpp" extern "C" { #define EXP_OBJ_NUMBER 1 -static JNIEnv *jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv *jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jvmtiCapabilities caps; static jlong timeout = 0; -static jobject referrer = NULL; +static jobject referrer = nullptr; static const char* DEBUGEE_SIGNATURE = "Lnsk/jvmti/scenarios/allocation/AP09/ap09t001;"; static const long OBJECT_TAG = 1l; static const long CLASS_TAG = 2l; @@ -139,14 +139,14 @@ Java_nsk_jvmti_scenarios_allocation_AP09_ap09t001_setTag(JNIEnv* jni, JNIEXPORT void JNICALL Java_nsk_jvmti_scenarios_allocation_AP09_ap09t001_setReferrer(JNIEnv* jni, jclass klass, jobject ref) { - if (!NSK_JNI_VERIFY(jni, (referrer = jni->NewGlobalRef(ref)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (referrer = jni->NewGlobalRef(ref)) != nullptr)) nsk_jvmti_setFailStatus(); } static void JNICALL agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { - jclass debugeeClass = NULL; + jclass debugeeClass = nullptr; NSK_DISPLAY0("Wait for debugee start\n\n"); if (!NSK_VERIFY(nsk_jvmti_waitForSync(timeout))) @@ -156,7 +156,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { NSK_DISPLAY0("\nCalling IterateOverObjectsReachableFromObject\n"); if (!NSK_JVMTI_VERIFY(jvmti->IterateOverObjectsReachableFromObject(referrer, objectReferenceCallback, - NULL /*user_data*/))) { + nullptr /*user_data*/))) { nsk_jvmti_setFailStatus(); } if (!classFound) { @@ -214,7 +214,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; memset(&caps, 0, sizeof(jvmtiCapabilities)); @@ -231,7 +231,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; NSK_DISPLAY0("agentProc has been set\n\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP10/ap10t001/ap10t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP10/ap10t001/ap10t001.cpp index d4977a45a266..cfa75bb2f3de 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP10/ap10t001/ap10t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP10/ap10t001/ap10t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,11 +24,11 @@ #include #include #include -#include "agent_common.h" +#include "agent_common.hpp" -#include "nsk_tools.h" -#include "JVMTITools.h" -#include "jvmti_tools.h" +#include "nsk_tools.hpp" +#include "JVMTITools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -37,7 +37,7 @@ extern "C" { #define MAX_SIZE 256 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jvmtiCapabilities caps; @@ -56,7 +56,7 @@ typedef struct _LocalStorage { static LocalStorage stor; static void envStorageFunc(jvmtiEnv *jvmti_env, const char *msg) { - LocalStorage* obtainedData = NULL; + LocalStorage* obtainedData = nullptr; LocalStorage* storedData = &stor; NSK_DISPLAY2("%s: setting an environment local storage 0x%p ...\n", @@ -259,7 +259,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add capability to generate compiled method events */ @@ -296,19 +296,19 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { NSK_DISPLAY0("setting event callbacks done\nenabling JVMTI events ...\n"); if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_START, - NULL))) + nullptr))) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_FINISH, - NULL))) + nullptr))) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, - NULL))) + nullptr))) return JNI_ERR; NSK_DISPLAY0("enabling the events done\n\n"); - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP11/ap11t001/ap11t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP11/ap11t001/ap11t001.cpp index 8f9d67ac6cf7..b47b4c6a76e6 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP11/ap11t001/ap11t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP11/ap11t001/ap11t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,9 +23,9 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -46,14 +46,14 @@ static int lookup(jvmtiEnv* jvmti, if (!NSK_JVMTI_VERIFY(jvmti->GetClassSignature(classes[i], &signature, &generic))) break; - if (signature != NULL && strcmp(signature, exp_sig) == 0) { + if (signature != nullptr && strcmp(signature, exp_sig) == 0) { found = NSK_TRUE; } - if (signature != NULL) + if (signature != nullptr) jvmti->Deallocate((unsigned char*)signature); - if (generic != NULL) + if (generic != nullptr) jvmti->Deallocate((unsigned char*)generic); } @@ -141,7 +141,7 @@ VMObjectAlloc(jvmtiEnv *jvmti, JNIEnv* jni, jthread thread, jobject object, return; } - if (classes != NULL) + if (classes != nullptr) jvmti->Deallocate((unsigned char*)classes); } while (0); @@ -174,10 +174,10 @@ VMObjectAlloc(jvmtiEnv *jvmti, JNIEnv* jni, jthread thread, jobject object, } } while (0); - if (signature != NULL) + if (signature != nullptr) jvmti->Deallocate((unsigned char*)signature); - if (generic != NULL) + if (generic != nullptr) jvmti->Deallocate((unsigned char*)generic); } @@ -210,7 +210,7 @@ JNIEXPORT jint JNI_OnLoad_ap11t001(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiCapabilities caps; jvmtiEventCallbacks callbacks; @@ -223,7 +223,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; memset(&caps, 0, sizeof(caps)); @@ -239,11 +239,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* enable VMObjectAlloc event */ if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_OBJECT_ALLOC, NULL))) + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_OBJECT_ALLOC, nullptr))) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP12/ap12t001/ap12t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP12/ap12t001/ap12t001.cpp index b5236d993c1c..2f5e46f7ec7a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP12/ap12t001/ap12t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/allocation/AP12/ap12t001/ap12t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,12 +25,12 @@ #include #include #include -#include "agent_common.h" +#include "agent_common.hpp" -#include "nsk_tools.h" -#include "jni_tools.h" -#include "JVMTITools.h" -#include "jvmti_tools.h" +#include "nsk_tools.hpp" +#include "jni_tools.hpp" +#include "JVMTITools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -39,8 +39,8 @@ extern "C" { #define EXP_OBJ_FREE 2 -static JNIEnv *jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv *jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jvmtiCapabilities caps; @@ -89,7 +89,7 @@ Java_nsk_jvmti_scenarios_allocation_AP12_ap12t001_flushObjectFreeEvents(JNIEnv* // Already enabled, but this triggers flush of pending events. if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, - NULL))) { + nullptr))) { nsk_jvmti_setFailStatus(); } } @@ -97,7 +97,7 @@ Java_nsk_jvmti_scenarios_allocation_AP12_ap12t001_flushObjectFreeEvents(JNIEnv* static void JNICALL agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { - jclass debugeeClass = NULL; + jclass debugeeClass = nullptr; NSK_DISPLAY0("Wait for debugee start\n\n"); if (!NSK_VERIFY(nsk_jvmti_waitForSync(timeout))) @@ -132,7 +132,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; memset(&caps, 0, sizeof(jvmtiCapabilities)); @@ -162,15 +162,15 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { NSK_DISPLAY0("setting event callbacks done\nenabling JVMTI events ...\n"); if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, - NULL))) + nullptr))) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, - NULL))) + nullptr))) return JNI_ERR; NSK_DISPLAY0("enabling the events done\n\n"); - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; NSK_DISPLAY0("agentProc has been set\n\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI01/bi01t001/bi01t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI01/bi01t001/bi01t001.cpp index 0ba4c3c442d7..6b3df432d5e6 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI01/bi01t001/bi01t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI01/bi01t001/bi01t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,15 +23,15 @@ #include #include "jvmti.h" -#include "agent_common.h" +#include "agent_common.hpp" #include "ExceptionCheckingJniEnv.hpp" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { /* scaffold objects */ -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; #define TESTED_CLASS_NAME "nsk/jvmti/scenarios/bcinstr/BI01/bi01t001a" @@ -106,7 +106,7 @@ cbClassFileLoadHook(jvmtiEnv *jvmti_env, JNIEnv* jni_env, const unsigned char* class_data, jint* new_class_data_len, unsigned char** new_class_data) { - if (name == NULL || strcmp(name, TESTED_CLASS_NAME)) { + if (name == nullptr || strcmp(name, TESTED_CLASS_NAME)) { return; } @@ -175,7 +175,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* agentJNI, void* arg) { NSK_DISPLAY0("Notification disabled for CLASS_FILE_LOAD_HOOK event\n"); if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, - NULL))) { + nullptr))) { nsk_jvmti_setFailStatus(); return; } @@ -240,7 +240,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; { @@ -267,12 +267,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { NSK_DISPLAY0("Set notification enabled for CLASS_FILE_LOAD_HOOK event\n"); if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, - NULL))) { + nullptr))) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI01/bi01t002/bi01t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI01/bi01t002/bi01t002.cpp index ca26caaa89b3..71b8b62e9da2 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI01/bi01t002/bi01t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI01/bi01t002/bi01t002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,15 +23,15 @@ #include #include "jvmti.h" -#include "agent_common.h" +#include "agent_common.hpp" #include "ExceptionCheckingJniEnv.hpp" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { /* scaffold objects */ -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; #define TESTED_CLASS_NAME "nsk/jvmti/scenarios/bcinstr/BI01/bi01t002a" @@ -109,7 +109,7 @@ cbClassFileLoadHook(jvmtiEnv *jvmti_env, JNIEnv* jni_env, const unsigned char* class_data, jint* new_class_data_len, unsigned char** new_class_data) { - if (name == NULL || strcmp(name, TESTED_CLASS_NAME)) { + if (name == nullptr || strcmp(name, TESTED_CLASS_NAME)) { return; } @@ -183,7 +183,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* agentJNI, void* arg) { NSK_DISPLAY0("Notification disabled for CLASS_FILE_LOAD_HOOK event\n"); if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, - NULL))) { + nullptr))) { nsk_jvmti_setFailStatus(); return; } @@ -253,7 +253,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; { @@ -280,12 +280,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { NSK_DISPLAY0("Set notification enabled for CLASS_FILE_LOAD_HOOK event\n"); if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, - NULL))) { + nullptr))) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI02/bi02t001/bi02t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI02/bi02t001/bi02t001.cpp index 66347ffdfef7..ea558bc0cd4e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI02/bi02t001/bi02t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI02/bi02t001/bi02t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" #define PASSED 0 #define STATUS_FAILED 2 @@ -38,8 +38,8 @@ extern "C" { static jlong timeout = 0; /* test objects */ -static jclass debugeeClass = NULL; -static jbyteArray classBytes = NULL; +static jclass debugeeClass = nullptr; +static jbyteArray classBytes = nullptr; static int ClassFileLoadHookEventFlag = NSK_FALSE; const char* CLASS_NAME = "nsk/jvmti/scenarios/bcinstr/BI02/bi02t001a"; @@ -55,11 +55,11 @@ ClassFileLoadHook(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jint class_data_len, const unsigned char* class_data, jint *new_class_data_len, unsigned char** new_class_data) { - if (name != NULL && (strcmp(name, CLASS_NAME) == 0)) { + if (name != nullptr && (strcmp(name, CLASS_NAME) == 0)) { ClassFileLoadHookEventFlag = NSK_TRUE; NSK_DISPLAY0("ClassFileLoadHook event\n"); - if (class_being_redefined == NULL) { + if (class_being_redefined == nullptr) { /* sent by class load */ if (!NSK_JNI_VERIFY(jni_env, (*new_class_data_len = @@ -69,7 +69,7 @@ ClassFileLoadHook(jvmtiEnv *jvmti_env, JNIEnv *jni_env, } if (!NSK_JNI_VERIFY(jni_env, (*new_class_data = (unsigned char*) - jni_env->GetByteArrayElements(classBytes, NULL)) != NULL)) { + jni_env->GetByteArrayElements(classBytes, nullptr)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -82,29 +82,29 @@ ClassFileLoadHook(jvmtiEnv *jvmti_env, JNIEnv *jni_env, static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { const char* DEBUGEE_CLASS_NAME = "nsk/jvmti/scenarios/bcinstr/BI02/bi02t001"; - jfieldID field = NULL; + jfieldID field = nullptr; NSK_DISPLAY1("Find class: %s\n", DEBUGEE_CLASS_NAME); - if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (debugeeClass = (jclass)jni->NewGlobalRef(debugeeClass)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (debugeeClass = (jclass)jni->NewGlobalRef(debugeeClass)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (field = - jni->GetStaticFieldID(debugeeClass, "newClassBytes", "[B")) != NULL)) + jni->GetStaticFieldID(debugeeClass, "newClassBytes", "[B")) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (classBytes = (jbyteArray) - jni->GetStaticObjectField(debugeeClass, field)) != NULL)) + jni->GetStaticObjectField(debugeeClass, field)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (classBytes = (jbyteArray)jni->NewGlobalRef(classBytes)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (classBytes = (jbyteArray)jni->NewGlobalRef(classBytes)) != nullptr)) return NSK_FALSE; if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, - NULL))) + nullptr))) return JNI_ERR; return NSK_TRUE; @@ -137,7 +137,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, - NULL))) + nullptr))) nsk_jvmti_setFailStatus(); NSK_TRACE(jni->DeleteGlobalRef(debugeeClass)); @@ -162,7 +162,7 @@ JNIEXPORT jint JNI_OnLoad_bi02t001(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiEventCallbacks callbacks; jvmtiCapabilities caps; @@ -174,7 +174,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; memset(&caps, 0, sizeof(caps)); @@ -182,7 +182,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&callbacks, 0, sizeof(callbacks)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI02/bi02t002/bi02t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI02/bi02t002/bi02t002.cpp index 2b594da64074..403c199c8d53 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI02/bi02t002/bi02t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI02/bi02t002/bi02t002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" #define PASSED 0 #define STATUS_FAILED 2 @@ -38,9 +38,9 @@ extern "C" { static jlong timeout = 0; /* test objects */ -static jclass debugeeClass = NULL; -static jclass testedClass = NULL; -static jbyteArray classBytes = NULL; +static jclass debugeeClass = nullptr; +static jclass testedClass = nullptr; +static jbyteArray classBytes = nullptr; const char* CLASS_NAME = "nsk/jvmti/scenarios/bcinstr/BI02/bi02t002a"; @@ -49,31 +49,31 @@ const char* CLASS_NAME = "nsk/jvmti/scenarios/bcinstr/BI02/bi02t002a"; static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { const char* DEBUGEE_CLASS_NAME = "nsk/jvmti/scenarios/bcinstr/BI02/bi02t002"; - jfieldID field = NULL; + jfieldID field = nullptr; NSK_DISPLAY1("Find class: %s\n", DEBUGEE_CLASS_NAME); - if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (debugeeClass = (jclass)jni->NewGlobalRef(debugeeClass)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (debugeeClass = (jclass)jni->NewGlobalRef(debugeeClass)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (field = - jni->GetStaticFieldID(debugeeClass, "newClassBytes", "[B")) != NULL)) + jni->GetStaticFieldID(debugeeClass, "newClassBytes", "[B")) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (classBytes = (jbyteArray) - jni->GetStaticObjectField(debugeeClass, field)) != NULL)) + jni->GetStaticObjectField(debugeeClass, field)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (classBytes = (jbyteArray)jni->NewGlobalRef(classBytes)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (classBytes = (jbyteArray)jni->NewGlobalRef(classBytes)) != nullptr)) return NSK_FALSE; NSK_DISPLAY1("Find class: %s\n", CLASS_NAME); - if (!NSK_JNI_VERIFY(jni, (testedClass = jni->FindClass(CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (testedClass = jni->FindClass(CLASS_NAME)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (testedClass = (jclass)jni->NewGlobalRef(testedClass)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (testedClass = (jclass)jni->NewGlobalRef(testedClass)) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -90,7 +90,7 @@ static int redefine(jvmtiEnv* jvmti, JNIEnv* jni) { return NSK_TRUE; if (!NSK_JNI_VERIFY(jni, (class_def.class_bytes = (unsigned char*) - jni->GetByteArrayElements(classBytes, NULL)) != NULL)) + jni->GetByteArrayElements(classBytes, nullptr)) != nullptr)) return NSK_TRUE; class_def.klass = testedClass; @@ -146,7 +146,7 @@ JNIEXPORT jint JNI_OnLoad_bi02t002(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiCapabilities caps; NSK_DISPLAY0("Agent_OnLoad\n"); @@ -157,7 +157,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; memset(&caps, 0, sizeof(caps)); @@ -165,7 +165,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI03/bi03t001/bi03t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI03/bi03t001/bi03t001.cpp index f7e91f623e08..dddc47377caf 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI03/bi03t001/bi03t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI03/bi03t001/bi03t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" #define PASSED 0 #define STATUS_FAILED 2 @@ -38,8 +38,8 @@ extern "C" { static jlong timeout = 0; /* test objects */ -static jclass debugeeClass = NULL; -static jbyteArray classBytes = NULL; +static jclass debugeeClass = nullptr; +static jbyteArray classBytes = nullptr; static int ClassFileLoadHookEventFlag = NSK_FALSE; const char* CLASS_NAME = "nsk/jvmti/scenarios/bcinstr/BI03/bi03t001a"; @@ -55,11 +55,11 @@ ClassFileLoadHook(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jint class_data_len, const unsigned char* class_data, jint *new_class_data_len, unsigned char** new_class_data) { - if (name != NULL && (strcmp(name, CLASS_NAME) == 0)) { + if (name != nullptr && (strcmp(name, CLASS_NAME) == 0)) { ClassFileLoadHookEventFlag = NSK_TRUE; NSK_DISPLAY0("ClassFileLoadHook event\n"); - if (class_being_redefined == NULL) { + if (class_being_redefined == nullptr) { /* sent by class load */ if (!NSK_JNI_VERIFY(jni_env, (*new_class_data_len = @@ -69,7 +69,7 @@ ClassFileLoadHook(jvmtiEnv *jvmti_env, JNIEnv *jni_env, } if (!NSK_JNI_VERIFY(jni_env, (*new_class_data = (unsigned char*) - jni_env->GetByteArrayElements(classBytes, NULL)) != NULL)) { + jni_env->GetByteArrayElements(classBytes, nullptr)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -82,29 +82,29 @@ ClassFileLoadHook(jvmtiEnv *jvmti_env, JNIEnv *jni_env, static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { const char* DEBUGEE_CLASS_NAME = "nsk/jvmti/scenarios/bcinstr/BI03/bi03t001"; - jfieldID field = NULL; + jfieldID field = nullptr; NSK_DISPLAY1("Find class: %s\n", DEBUGEE_CLASS_NAME); - if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (debugeeClass = (jclass)jni->NewGlobalRef(debugeeClass)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (debugeeClass = (jclass)jni->NewGlobalRef(debugeeClass)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (field = - jni->GetStaticFieldID(debugeeClass, "newClassBytes", "[B")) != NULL)) + jni->GetStaticFieldID(debugeeClass, "newClassBytes", "[B")) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (classBytes = (jbyteArray) - jni->GetStaticObjectField(debugeeClass, field)) != NULL)) + jni->GetStaticObjectField(debugeeClass, field)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (classBytes = (jbyteArray)jni->NewGlobalRef(classBytes)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (classBytes = (jbyteArray)jni->NewGlobalRef(classBytes)) != nullptr)) return NSK_FALSE; if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, - NULL))) + nullptr))) return JNI_ERR; return NSK_TRUE; @@ -137,7 +137,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, - NULL))) + nullptr))) nsk_jvmti_setFailStatus(); NSK_TRACE(jni->DeleteGlobalRef(debugeeClass)); @@ -162,7 +162,7 @@ JNIEXPORT jint JNI_OnLoad_bi03t001(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiEventCallbacks callbacks; jvmtiCapabilities caps; @@ -174,7 +174,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; memset(&caps, 0, sizeof(caps)); @@ -182,7 +182,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&callbacks, 0, sizeof(callbacks)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI03/bi03t002/bi03t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI03/bi03t002/bi03t002.cpp index 07adb527a71c..e681eeaab9b8 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI03/bi03t002/bi03t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI03/bi03t002/bi03t002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" #define PASSED 0 #define STATUS_FAILED 2 @@ -38,9 +38,9 @@ extern "C" { static jlong timeout = 0; /* test objects */ -static jclass debugeeClass = NULL; -static jclass testedClass = NULL; -static jbyteArray classBytes = NULL; +static jclass debugeeClass = nullptr; +static jclass testedClass = nullptr; +static jbyteArray classBytes = nullptr; const char* CLASS_NAME = "nsk/jvmti/scenarios/bcinstr/BI03/bi03t002a"; @@ -49,31 +49,31 @@ const char* CLASS_NAME = "nsk/jvmti/scenarios/bcinstr/BI03/bi03t002a"; static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { const char* DEBUGEE_CLASS_NAME = "nsk/jvmti/scenarios/bcinstr/BI03/bi03t002"; - jfieldID field = NULL; + jfieldID field = nullptr; NSK_DISPLAY1("Find class: %s\n", DEBUGEE_CLASS_NAME); - if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (debugeeClass = (jclass)jni->NewGlobalRef(debugeeClass)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (debugeeClass = (jclass)jni->NewGlobalRef(debugeeClass)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (field = - jni->GetStaticFieldID(debugeeClass, "newClassBytes", "[B")) != NULL)) + jni->GetStaticFieldID(debugeeClass, "newClassBytes", "[B")) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (classBytes = (jbyteArray) - jni->GetStaticObjectField(debugeeClass, field)) != NULL)) + jni->GetStaticObjectField(debugeeClass, field)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (classBytes = (jbyteArray)jni->NewGlobalRef(classBytes)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (classBytes = (jbyteArray)jni->NewGlobalRef(classBytes)) != nullptr)) return NSK_FALSE; NSK_DISPLAY1("Find class: %s\n", CLASS_NAME); - if (!NSK_JNI_VERIFY(jni, (testedClass = jni->FindClass(CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (testedClass = jni->FindClass(CLASS_NAME)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (testedClass = (jclass)jni->NewGlobalRef(testedClass)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (testedClass = (jclass)jni->NewGlobalRef(testedClass)) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -90,7 +90,7 @@ static int redefine(jvmtiEnv* jvmti, JNIEnv* jni) { return NSK_TRUE; if (!NSK_JNI_VERIFY(jni, (class_def.class_bytes = (unsigned char*) - jni->GetByteArrayElements(classBytes, NULL)) != NULL)) + jni->GetByteArrayElements(classBytes, nullptr)) != nullptr)) return NSK_TRUE; class_def.klass = testedClass; @@ -146,7 +146,7 @@ JNIEXPORT jint JNI_OnLoad_bi03t002(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiCapabilities caps; NSK_DISPLAY0("Agent_OnLoad\n"); @@ -157,7 +157,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; memset(&caps, 0, sizeof(caps)); @@ -165,7 +165,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI04/bi04t002/bi04t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI04/bi04t002/bi04t002.cpp index c87fc546b90c..17733d4ba54b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI04/bi04t002/bi04t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/bcinstr/BI04/bi04t002/bi04t002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,10 +23,10 @@ #include #include "jvmti.h" -#include "agent_common.h" +#include "agent_common.hpp" #include "ExceptionCheckingJniEnv.hpp" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -61,7 +61,7 @@ int readNewBytecode(jvmtiEnv* jvmti) { filename); bytecode = fopen(filename, "rb"); - if (bytecode == NULL) { + if (bytecode == nullptr) { NSK_COMPLAIN0("error opening file\n"); return NSK_FALSE; } @@ -137,7 +137,7 @@ JNIEXPORT jint JNI_OnLoad_bi04t002(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv *jvmti = NULL; + jvmtiEnv *jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -145,7 +145,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; { @@ -161,7 +161,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_VERIFY(readNewBytecode(jvmti))) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t001/cm01t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t001/cm01t001.cpp index a59b82a5c5c9..7845cac20860 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t001/cm01t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t001/cm01t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -57,22 +57,22 @@ extern "C" { /* ========================================================================== */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* test objects */ -static jthread thread = NULL; -static jclass klass = NULL; -static jmethodID method = NULL; -static jfieldID field = NULL; +static jthread thread = nullptr; +static jclass klass = nullptr; +static jmethodID method = nullptr; +static jfieldID field = nullptr; /* ========================================================================== */ static int prepare() { const char* THREAD_NAME = "Debuggee Thread"; jvmtiThreadInfo info; - jthread *threads = NULL; + jthread *threads = nullptr; jint threads_count = 0; int i; @@ -82,12 +82,12 @@ static int prepare() { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -97,7 +97,7 @@ static int prepare() { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL && (strcmp(info.name, THREAD_NAME) == 0)) { + if (info.name != nullptr && (strcmp(info.name, THREAD_NAME) == 0)) { thread = threads[i]; } } @@ -107,16 +107,16 @@ static int prepare() { return NSK_FALSE; /* get tested thread class */ - if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != nullptr)) return NSK_FALSE; /* get tested thread method 'run' */ - if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != NULL)) + if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != nullptr)) return NSK_FALSE; /* get tested thread field 'waitingMonitor' */ if (!NSK_JNI_VERIFY(jni, (field = - jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != NULL)) + jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -156,18 +156,18 @@ static int checkSignalThread() { const char* THREAD_DEATH_CLASS_NAME = "java/lang/ThreadDeath"; const char* THREAD_DEATH_CTOR_NAME = ""; const char* THREAD_DEATH_CTOR_SIGNATURE = "()V"; - jclass cls = NULL; - jmethodID ctor = NULL; - jobject exception = NULL; + jclass cls = nullptr; + jmethodID ctor = nullptr; + jobject exception = nullptr; - if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (ctor = - jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL)) + jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != nullptr)) return NSK_FALSE; NSK_DISPLAY0("Checking negative: StopThread\n"); @@ -186,7 +186,7 @@ static int checkSignalThread() { */ static int checkGetOwnedMonitorInfo() { jint count; - jobject *monitors = NULL; + jobject *monitors = nullptr; NSK_DISPLAY0("Checking negative: GetOwnedMonitorInfo\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -199,7 +199,7 @@ static int checkGetOwnedMonitorInfo() { /* Check "can_get_current_contended_monitor" function */ static int checkGetCurrentContendedMonitor() { - jobject monitor = NULL; + jobject monitor = nullptr; NSK_DISPLAY0("Checking negative: GetCurrentContendedMonitor\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -251,8 +251,8 @@ static int checkHeapFunctions() { const jlong TAG_VALUE = (123456789L); jlong tag; jint count; - jobject *res_objects = NULL; - jlong *res_tags = NULL; + jobject *res_objects = nullptr; + jlong *res_tags = nullptr; jint dummy_user_data = 0; NSK_DISPLAY0("Checking positive: SetTag\n"); @@ -295,7 +295,7 @@ static int checkHeapFunctions() { */ static int checkLocalVariableFunctions() { jint count; - jvmtiLocalVariableEntry *local_variable_table = NULL; + jvmtiLocalVariableEntry *local_variable_table = nullptr; jobject object_value; jint int_value; jlong long_value; @@ -365,7 +365,7 @@ static int checkLocalVariableFunctions() { static int checkSourceInfoFunctions() { char *name; jint count; - jvmtiLineNumberEntry *line_number_table = NULL; + jvmtiLineNumberEntry *line_number_table = nullptr; NSK_DISPLAY0("Checking negative: GetSourceFileName\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -393,7 +393,7 @@ static int checkRedefineClasses() { NSK_DISPLAY0("Checking negative: RedefineClasses\n"); class_def.klass = klass; class_def.class_byte_count = 0; - class_def.class_bytes = NULL; + class_def.class_bytes = nullptr; if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->RedefineClasses(1, &class_def))) return NSK_FALSE; @@ -565,11 +565,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; /* testcase #1: check GetPotentialCapabilities */ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t002/cm01t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t002/cm01t002.cpp index 63252c7765c1..c45392500e5a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t002/cm01t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t002/cm01t002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -50,22 +50,22 @@ extern "C" { /* ========================================================================== */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* test objects */ -static jthread thread = NULL; -static jclass klass = NULL; -static jmethodID method = NULL; -static jfieldID field = NULL; +static jthread thread = nullptr; +static jclass klass = nullptr; +static jmethodID method = nullptr; +static jfieldID field = nullptr; /* ========================================================================== */ static int prepare() { const char* THREAD_NAME = "Debuggee Thread"; jvmtiThreadInfo info; - jthread *threads = NULL; + jthread *threads = nullptr; jint threads_count = 0; int i; @@ -75,12 +75,12 @@ static int prepare() { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -90,7 +90,7 @@ static int prepare() { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL && (strcmp(info.name, THREAD_NAME) == 0)) { + if (info.name != nullptr && (strcmp(info.name, THREAD_NAME) == 0)) { thread = threads[i]; } } @@ -99,22 +99,22 @@ static int prepare() { if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads))) return NSK_FALSE; - if (thread == NULL) { + if (thread == nullptr) { nsk_lcomplain(__FILE__, __LINE__, "tested thread not found\n"); return NSK_FALSE; } /* get tested thread class */ - if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != nullptr)) return NSK_FALSE; /* get tested thread method 'run' */ - if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != NULL)) + if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != nullptr)) return NSK_FALSE; /* get tested thread field 'waitingMonitor' */ if (!NSK_JNI_VERIFY(jni, (field = - jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != NULL)) + jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -154,18 +154,18 @@ static int checkSignalThread() { const char* THREAD_DEATH_CLASS_NAME = "java/lang/ThreadDeath"; const char* THREAD_DEATH_CTOR_NAME = ""; const char* THREAD_DEATH_CTOR_SIGNATURE = "()V"; - jclass cls = NULL; - jmethodID ctor = NULL; - jobject exception = NULL; + jclass cls = nullptr; + jmethodID ctor = nullptr; + jobject exception = nullptr; - if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (ctor = - jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL)) + jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != nullptr)) return NSK_FALSE; NSK_DISPLAY0("Checking negative: StopThread\n"); @@ -184,7 +184,7 @@ static int checkSignalThread() { */ static int checkGetOwnedMonitorInfo() { jint count; - jobject *monitors = NULL; + jobject *monitors = nullptr; NSK_DISPLAY0("Checking negative: GetOwnedMonitorInfo\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -197,7 +197,7 @@ static int checkGetOwnedMonitorInfo() { /* Check "can_get_current_contended_monitor" function */ static int checkGetCurrentContendedMonitor() { - jobject monitor = NULL; + jobject monitor = nullptr; NSK_DISPLAY0("Checking negative: GetCurrentContendedMonitor\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -249,8 +249,8 @@ static int checkHeapFunctions() { const jlong TAG_VALUE = (123456789L); jlong tag; jint count; - jobject *res_objects = NULL; - jlong *res_tags = NULL; + jobject *res_objects = nullptr; + jlong *res_tags = nullptr; jint dummy_user_data = 0; NSK_DISPLAY0("Checking negative: SetTag\n"); @@ -303,7 +303,7 @@ static int checkHeapFunctions() { */ static int checkLocalVariableFunctions() { jint count; - jvmtiLocalVariableEntry *local_variable_table = NULL; + jvmtiLocalVariableEntry *local_variable_table = nullptr; jobject object_value; jint int_value; jlong long_value; @@ -373,7 +373,7 @@ static int checkLocalVariableFunctions() { static int checkSourceInfoFunctions() { char *name; jint count; - jvmtiLineNumberEntry *line_number_table = NULL; + jvmtiLineNumberEntry *line_number_table = nullptr; NSK_DISPLAY0("Checking negative: GetSourceFileName\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -401,7 +401,7 @@ static int checkRedefineClasses() { NSK_DISPLAY0("Checking negative: RedefineClasses\n"); class_def.klass = klass; class_def.class_byte_count = 0; - class_def.class_bytes = NULL; + class_def.class_bytes = nullptr; if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->RedefineClasses(1, &class_def))) return NSK_FALSE; @@ -574,11 +574,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; /* testcase #1: check GetPotentialCapabilities */ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t003/cm01t003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t003/cm01t003.cpp index f92d0d298053..02d50b4819cd 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t003/cm01t003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t003/cm01t003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -52,22 +52,22 @@ extern "C" { /* ========================================================================== */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* test objects */ -static jthread thread = NULL; -static jclass klass = NULL; -static jmethodID method = NULL; -static jfieldID field = NULL; +static jthread thread = nullptr; +static jclass klass = nullptr; +static jmethodID method = nullptr; +static jfieldID field = nullptr; /* ========================================================================== */ static int prepare() { const char* THREAD_NAME = "Debuggee Thread"; jvmtiThreadInfo info; - jthread *threads = NULL; + jthread *threads = nullptr; jint threads_count = 0; int i; @@ -77,12 +77,12 @@ static int prepare() { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -92,7 +92,7 @@ static int prepare() { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL && (strcmp(info.name, THREAD_NAME) == 0)) { + if (info.name != nullptr && (strcmp(info.name, THREAD_NAME) == 0)) { thread = threads[i]; } } @@ -102,16 +102,16 @@ static int prepare() { return NSK_FALSE; /* get tested thread class */ - if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != nullptr)) return NSK_FALSE; /* get tested thread method 'run' */ - if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != NULL)) + if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != nullptr)) return NSK_FALSE; /* get tested thread field 'waitingMonitor' */ if (!NSK_JNI_VERIFY(jni, (field = - jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != NULL)) + jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -151,18 +151,18 @@ static int checkSignalThread() { const char* THREAD_DEATH_CLASS_NAME = "java/lang/ThreadDeath"; const char* THREAD_DEATH_CTOR_NAME = ""; const char* THREAD_DEATH_CTOR_SIGNATURE = "()V"; - jclass cls = NULL; - jmethodID ctor = NULL; - jobject exception = NULL; + jclass cls = nullptr; + jmethodID ctor = nullptr; + jobject exception = nullptr; - if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (ctor = - jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL)) + jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != nullptr)) return NSK_FALSE; NSK_DISPLAY0("Checking negative: StopThread\n"); @@ -181,7 +181,7 @@ static int checkSignalThread() { */ static int checkGetOwnedMonitorInfo() { jint count; - jobject *monitors = NULL; + jobject *monitors = nullptr; NSK_DISPLAY0("Checking negative: GetOwnedMonitorInfo\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -194,7 +194,7 @@ static int checkGetOwnedMonitorInfo() { /* Check "can_get_current_contended_monitor" function */ static int checkGetCurrentContendedMonitor() { - jobject monitor = NULL; + jobject monitor = nullptr; NSK_DISPLAY0("Checking negative: GetCurrentContendedMonitor\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -246,8 +246,8 @@ static int checkHeapFunctions() { const jlong TAG_VALUE = (123456789L); jlong tag; jint count; - jobject *res_objects = NULL; - jlong *res_tags = NULL; + jobject *res_objects = nullptr; + jlong *res_tags = nullptr; jint dummy_user_data = 0; NSK_DISPLAY0("Checking negative: SetTag\n"); @@ -300,7 +300,7 @@ static int checkHeapFunctions() { */ static int checkLocalVariableFunctions() { jint count; - jvmtiLocalVariableEntry *local_variable_table = NULL; + jvmtiLocalVariableEntry *local_variable_table = nullptr; jobject object_value; jint int_value; jlong long_value; @@ -370,7 +370,7 @@ static int checkLocalVariableFunctions() { static int checkSourceInfoFunctions() { char *name; jint count; - jvmtiLineNumberEntry *line_number_table = NULL; + jvmtiLineNumberEntry *line_number_table = nullptr; NSK_DISPLAY0("Checking negative: GetSourceFileName\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -398,7 +398,7 @@ static int checkRedefineClasses() { NSK_DISPLAY0("Checking negative: RedefineClasses\n"); class_def.klass = klass; class_def.class_byte_count = 0; - class_def.class_bytes = NULL; + class_def.class_bytes = nullptr; if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->RedefineClasses(1, &class_def))) return NSK_FALSE; @@ -568,11 +568,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; /* testcase #1: check GetPotentialCapabilities */ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t004/cm01t004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t004/cm01t004.cpp index 6b52f4c9695a..570c12f70736 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t004/cm01t004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t004/cm01t004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -50,22 +50,22 @@ extern "C" { /* ========================================================================== */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* test objects */ -static jthread thread = NULL; -static jclass klass = NULL; -static jmethodID method = NULL; -static jfieldID field = NULL; +static jthread thread = nullptr; +static jclass klass = nullptr; +static jmethodID method = nullptr; +static jfieldID field = nullptr; /* ========================================================================== */ static int prepare() { const char* THREAD_NAME = "Debuggee Thread"; jvmtiThreadInfo info; - jthread *threads = NULL; + jthread *threads = nullptr; jint threads_count = 0; int i; @@ -75,12 +75,12 @@ static int prepare() { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -90,7 +90,7 @@ static int prepare() { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL && (strcmp(info.name, THREAD_NAME) == 0)) { + if (info.name != nullptr && (strcmp(info.name, THREAD_NAME) == 0)) { thread = threads[i]; } } @@ -100,16 +100,16 @@ static int prepare() { return NSK_FALSE; /* get tested thread class */ - if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != nullptr)) return NSK_FALSE; /* get tested thread method 'run' */ - if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != NULL)) + if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != nullptr)) return NSK_FALSE; /* get tested thread field 'waitingMonitor' */ if (!NSK_JNI_VERIFY(jni, (field = - jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != NULL)) + jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -149,18 +149,18 @@ static int checkSignalThread() { const char* THREAD_DEATH_CLASS_NAME = "java/lang/ThreadDeath"; const char* THREAD_DEATH_CTOR_NAME = ""; const char* THREAD_DEATH_CTOR_SIGNATURE = "()V"; - jclass cls = NULL; - jmethodID ctor = NULL; - jobject exception = NULL; + jclass cls = nullptr; + jmethodID ctor = nullptr; + jobject exception = nullptr; - if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (ctor = - jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL)) + jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != nullptr)) return NSK_FALSE; NSK_DISPLAY0("Checking negative: StopThread\n"); @@ -179,7 +179,7 @@ static int checkSignalThread() { */ static int checkGetOwnedMonitorInfo() { jint count; - jobject *monitors = NULL; + jobject *monitors = nullptr; NSK_DISPLAY0("Checking positive: GetOwnedMonitorInfo\n"); if (!NSK_JVMTI_VERIFY(jvmti->GetOwnedMonitorInfo(thread, &count, &monitors))) @@ -191,7 +191,7 @@ static int checkGetOwnedMonitorInfo() { /* Check "can_get_current_contended_monitor" function */ static int checkGetCurrentContendedMonitor() { - jobject monitor = NULL; + jobject monitor = nullptr; NSK_DISPLAY0("Checking negative: GetCurrentContendedMonitor\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -243,8 +243,8 @@ static int checkHeapFunctions() { const jlong TAG_VALUE = (123456789L); jlong tag; jint count; - jobject *res_objects = NULL; - jlong *res_tags = NULL; + jobject *res_objects = nullptr; + jlong *res_tags = nullptr; jint dummy_user_data = 0; NSK_DISPLAY0("Checking negative: SetTag\n"); @@ -297,7 +297,7 @@ static int checkHeapFunctions() { */ static int checkLocalVariableFunctions() { jint count; - jvmtiLocalVariableEntry *local_variable_table = NULL; + jvmtiLocalVariableEntry *local_variable_table = nullptr; jobject object_value; jint int_value; jlong long_value; @@ -367,7 +367,7 @@ static int checkLocalVariableFunctions() { static int checkSourceInfoFunctions() { char *name; jint count; - jvmtiLineNumberEntry *line_number_table = NULL; + jvmtiLineNumberEntry *line_number_table = nullptr; NSK_DISPLAY0("Checking negative: GetSourceFileName\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -395,7 +395,7 @@ static int checkRedefineClasses() { NSK_DISPLAY0("Checking negative: RedefineClasses\n"); class_def.klass = klass; class_def.class_byte_count = 0; - class_def.class_bytes = NULL; + class_def.class_bytes = nullptr; if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->RedefineClasses(1, &class_def))) return NSK_FALSE; @@ -567,11 +567,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; /* testcase #1: check GetPotentialCapabilities */ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t005/cm01t005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t005/cm01t005.cpp index adbb0d83cba0..ae806ed9cb78 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t005/cm01t005.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t005/cm01t005.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -50,22 +50,22 @@ extern "C" { /* ========================================================================== */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* test objects */ -static jthread thread = NULL; -static jclass klass = NULL; -static jmethodID method = NULL; -static jfieldID field = NULL; +static jthread thread = nullptr; +static jclass klass = nullptr; +static jmethodID method = nullptr; +static jfieldID field = nullptr; /* ========================================================================== */ static int prepare() { const char* THREAD_NAME = "Debuggee Thread"; jvmtiThreadInfo info; - jthread *threads = NULL; + jthread *threads = nullptr; jint threads_count = 0; int i; @@ -75,12 +75,12 @@ static int prepare() { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -90,7 +90,7 @@ static int prepare() { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL && (strcmp(info.name, THREAD_NAME) == 0)) { + if (info.name != nullptr && (strcmp(info.name, THREAD_NAME) == 0)) { thread = threads[i]; } } @@ -100,16 +100,16 @@ static int prepare() { return NSK_FALSE; /* get tested thread class */ - if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != nullptr)) return NSK_FALSE; /* get tested thread method 'run' */ - if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != NULL)) + if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != nullptr)) return NSK_FALSE; /* get tested thread field 'waitingMonitor' */ if (!NSK_JNI_VERIFY(jni, (field = - jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != NULL)) + jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -149,18 +149,18 @@ static int checkSignalThread() { const char* THREAD_DEATH_CLASS_NAME = "java/lang/ThreadDeath"; const char* THREAD_DEATH_CTOR_NAME = ""; const char* THREAD_DEATH_CTOR_SIGNATURE = "()V"; - jclass cls = NULL; - jmethodID ctor = NULL; - jobject exception = NULL; + jclass cls = nullptr; + jmethodID ctor = nullptr; + jobject exception = nullptr; - if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (ctor = - jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL)) + jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != nullptr)) return NSK_FALSE; NSK_DISPLAY0("Checking negative: StopThread\n"); @@ -179,7 +179,7 @@ static int checkSignalThread() { */ static int checkGetOwnedMonitorInfo() { jint count; - jobject *monitors = NULL; + jobject *monitors = nullptr; NSK_DISPLAY0("Checking negative: GetOwnedMonitorInfo\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -192,7 +192,7 @@ static int checkGetOwnedMonitorInfo() { /* Check "can_get_current_contended_monitor" function */ static int checkGetCurrentContendedMonitor() { - jobject monitor = NULL; + jobject monitor = nullptr; NSK_DISPLAY0("Checking positive: GetCurrentContendedMonitor\n"); if (!NSK_JVMTI_VERIFY(jvmti->GetCurrentContendedMonitor(thread, &monitor))) @@ -243,8 +243,8 @@ static int checkHeapFunctions() { const jlong TAG_VALUE = (123456789L); jlong tag; jint count; - jobject *res_objects = NULL; - jlong *res_tags = NULL; + jobject *res_objects = nullptr; + jlong *res_tags = nullptr; jint dummy_user_data = 0; NSK_DISPLAY0("Checking negative: SetTag\n"); @@ -297,7 +297,7 @@ static int checkHeapFunctions() { */ static int checkLocalVariableFunctions() { jint count; - jvmtiLocalVariableEntry *local_variable_table = NULL; + jvmtiLocalVariableEntry *local_variable_table = nullptr; jobject object_value; jint int_value; jlong long_value; @@ -367,7 +367,7 @@ static int checkLocalVariableFunctions() { static int checkSourceInfoFunctions() { char *name; jint count; - jvmtiLineNumberEntry *line_number_table = NULL; + jvmtiLineNumberEntry *line_number_table = nullptr; NSK_DISPLAY0("Checking negative: GetSourceFileName\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -395,7 +395,7 @@ static int checkRedefineClasses() { NSK_DISPLAY0("Checking negative: RedefineClasses\n"); class_def.klass = klass; class_def.class_byte_count = 0; - class_def.class_bytes = NULL; + class_def.class_bytes = nullptr; if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->RedefineClasses(1, &class_def))) return NSK_FALSE; @@ -567,11 +567,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; /* testcase #1: check GetPotentialCapabilities */ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t006/cm01t006.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t006/cm01t006.cpp index 011c53aa0c98..2bd741729022 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t006/cm01t006.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t006/cm01t006.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -50,22 +50,22 @@ extern "C" { /* ========================================================================== */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* test objects */ -static jthread thread = NULL; -static jclass klass = NULL; -static jmethodID method = NULL; -static jfieldID field = NULL; +static jthread thread = nullptr; +static jclass klass = nullptr; +static jmethodID method = nullptr; +static jfieldID field = nullptr; /* ========================================================================== */ static int prepare() { const char* THREAD_NAME = "Debuggee Thread"; jvmtiThreadInfo info; - jthread *threads = NULL; + jthread *threads = nullptr; jint threads_count = 0; int i; @@ -75,12 +75,12 @@ static int prepare() { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -90,7 +90,7 @@ static int prepare() { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL && (strcmp(info.name, THREAD_NAME) == 0)) { + if (info.name != nullptr && (strcmp(info.name, THREAD_NAME) == 0)) { thread = threads[i]; } } @@ -100,16 +100,16 @@ static int prepare() { return NSK_FALSE; /* get tested thread class */ - if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != nullptr)) return NSK_FALSE; /* get tested thread method 'run' */ - if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != NULL)) + if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != nullptr)) return NSK_FALSE; /* get tested thread field 'waitingMonitor' */ if (!NSK_JNI_VERIFY(jni, (field = - jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != NULL)) + jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -149,18 +149,18 @@ static int checkSignalThread() { const char* THREAD_DEATH_CLASS_NAME = "java/lang/ThreadDeath"; const char* THREAD_DEATH_CTOR_NAME = ""; const char* THREAD_DEATH_CTOR_SIGNATURE = "()V"; - jclass cls = NULL; - jmethodID ctor = NULL; - jobject exception = NULL; + jclass cls = nullptr; + jmethodID ctor = nullptr; + jobject exception = nullptr; - if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (ctor = - jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL)) + jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != nullptr)) return NSK_FALSE; NSK_DISPLAY0("Checking negative: StopThread\n"); @@ -179,7 +179,7 @@ static int checkSignalThread() { */ static int checkGetOwnedMonitorInfo() { jint count; - jobject *monitors = NULL; + jobject *monitors = nullptr; NSK_DISPLAY0("Checking negative: GetOwnedMonitorInfo\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -192,7 +192,7 @@ static int checkGetOwnedMonitorInfo() { /* Check "can_get_current_contended_monitor" function */ static int checkGetCurrentContendedMonitor() { - jobject monitor = NULL; + jobject monitor = nullptr; NSK_DISPLAY0("Checking negative: GetCurrentContendedMonitor\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -244,8 +244,8 @@ static int checkHeapFunctions() { const jlong TAG_VALUE = (123456789L); jlong tag; jint count; - jobject *res_objects = NULL; - jlong *res_tags = NULL; + jobject *res_objects = nullptr; + jlong *res_tags = nullptr; jint dummy_user_data = 0; NSK_DISPLAY0("Checking negative: SetTag\n"); @@ -298,7 +298,7 @@ static int checkHeapFunctions() { */ static int checkLocalVariableFunctions() { jint count; - jvmtiLocalVariableEntry *local_variable_table = NULL; + jvmtiLocalVariableEntry *local_variable_table = nullptr; jobject object_value; jint int_value; jlong long_value; @@ -368,7 +368,7 @@ static int checkLocalVariableFunctions() { static int checkSourceInfoFunctions() { char *name; jint count; - jvmtiLineNumberEntry *line_number_table = NULL; + jvmtiLineNumberEntry *line_number_table = nullptr; NSK_DISPLAY0("Checking negative: GetSourceFileName\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -396,7 +396,7 @@ static int checkRedefineClasses() { NSK_DISPLAY0("Checking negative: RedefineClasses\n"); class_def.klass = klass; class_def.class_byte_count = 0; - class_def.class_bytes = NULL; + class_def.class_bytes = nullptr; if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->RedefineClasses(1, &class_def))) return NSK_FALSE; @@ -567,11 +567,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; /* testcase #1: check GetPotentialCapabilities */ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t007/cm01t007.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t007/cm01t007.cpp index b9519d590544..6c6e1b9d7e22 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t007/cm01t007.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t007/cm01t007.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -50,22 +50,22 @@ extern "C" { /* ========================================================================== */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* test objects */ -static jthread thread = NULL; -static jclass klass = NULL; -static jmethodID method = NULL; -static jfieldID field = NULL; +static jthread thread = nullptr; +static jclass klass = nullptr; +static jmethodID method = nullptr; +static jfieldID field = nullptr; /* ========================================================================== */ static int prepare() { const char* THREAD_NAME = "Debuggee Thread"; jvmtiThreadInfo info; - jthread *threads = NULL; + jthread *threads = nullptr; jint threads_count = 0; int i; @@ -75,12 +75,12 @@ static int prepare() { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -90,7 +90,7 @@ static int prepare() { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL && (strcmp(info.name, THREAD_NAME) == 0)) { + if (info.name != nullptr && (strcmp(info.name, THREAD_NAME) == 0)) { thread = threads[i]; } } @@ -100,15 +100,15 @@ static int prepare() { return NSK_FALSE; /* get tested thread class */ - if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != nullptr)) return NSK_FALSE; /* get tested thread method 'run' */ - if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != NULL)) + if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != nullptr)) return NSK_FALSE; /* get tested thread field 'waitingFlag' */ - if (!NSK_JNI_VERIFY(jni, (field = jni->GetFieldID(klass, "waitingFlag", "Z")) != NULL)) + if (!NSK_JNI_VERIFY(jni, (field = jni->GetFieldID(klass, "waitingFlag", "Z")) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -148,18 +148,18 @@ static int checkSignalThread() { const char* THREAD_DEATH_CLASS_NAME = "java/lang/ThreadDeath"; const char* THREAD_DEATH_CTOR_NAME = ""; const char* THREAD_DEATH_CTOR_SIGNATURE = "()V"; - jclass cls = NULL; - jmethodID ctor = NULL; - jobject exception = NULL; + jclass cls = nullptr; + jmethodID ctor = nullptr; + jobject exception = nullptr; - if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (ctor = - jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL)) + jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != nullptr)) return NSK_FALSE; NSK_DISPLAY0("Checking negative: StopThread\n"); @@ -178,7 +178,7 @@ static int checkSignalThread() { */ static int checkGetOwnedMonitorInfo() { jint count; - jobject *monitors = NULL; + jobject *monitors = nullptr; NSK_DISPLAY0("Checking negative: GetOwnedMonitorInfo\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -191,7 +191,7 @@ static int checkGetOwnedMonitorInfo() { /* Check "can_get_current_contended_monitor" function */ static int checkGetCurrentContendedMonitor() { - jobject monitor = NULL; + jobject monitor = nullptr; NSK_DISPLAY0("Checking negative: GetCurrentContendedMonitor\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -265,8 +265,8 @@ static int checkHeapFunctions() { const jlong TAG_VALUE = (123456789L); jlong tag; jint count; - jobject *res_objects = NULL; - jlong *res_tags = NULL; + jobject *res_objects = nullptr; + jlong *res_tags = nullptr; jint dummy_user_data = 0; NSK_DISPLAY0("Checking negative: SetTag\n"); @@ -321,7 +321,7 @@ static int checkHeapFunctions() { */ static int checkLocalVariableFunctions() { jint count; - jvmtiLocalVariableEntry *local_variable_table = NULL; + jvmtiLocalVariableEntry *local_variable_table = nullptr; jobject object_value; jint int_value; jlong long_value; @@ -391,7 +391,7 @@ static int checkLocalVariableFunctions() { static int checkSourceInfoFunctions() { char *name; jint count; - jvmtiLineNumberEntry *line_number_table = NULL; + jvmtiLineNumberEntry *line_number_table = nullptr; NSK_DISPLAY0("Checking negative: GetSourceFileName\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -419,7 +419,7 @@ static int checkRedefineClasses() { NSK_DISPLAY0("Checking negative: RedefineClasses\n"); class_def.klass = klass; class_def.class_byte_count = 0; - class_def.class_bytes = NULL; + class_def.class_bytes = nullptr; if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->RedefineClasses(1, &class_def))) return NSK_FALSE; @@ -591,11 +591,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; /* testcase #1: check GetPotentialCapabilities */ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t008/cm01t008.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t008/cm01t008.cpp index 8f35fd2bf200..8348698b2bbf 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t008/cm01t008.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t008/cm01t008.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -52,24 +52,24 @@ extern "C" { /* ========================================================================== */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* test objects */ -static jthread thread = NULL; -static jclass klass = NULL; -static jmethodID method = NULL; -static jfieldID field = NULL; +static jthread thread = nullptr; +static jclass klass = nullptr; +static jmethodID method = nullptr; +static jfieldID field = nullptr; static jint klass_byte_count = 0; -static unsigned char *klass_bytes = NULL; +static unsigned char *klass_bytes = nullptr; /* ========================================================================== */ static int prepare() { const char* THREAD_NAME = "Debuggee Thread"; jvmtiThreadInfo info; - jthread *threads = NULL; + jthread *threads = nullptr; jint threads_count = 0; int i; @@ -79,12 +79,12 @@ static int prepare() { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -94,7 +94,7 @@ static int prepare() { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL && (strcmp(info.name, THREAD_NAME) == 0)) { + if (info.name != nullptr && (strcmp(info.name, THREAD_NAME) == 0)) { thread = threads[i]; } } @@ -104,16 +104,16 @@ static int prepare() { return NSK_FALSE; /* get tested thread class */ - if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != nullptr)) return NSK_FALSE; /* get tested thread method 'run' */ - if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != NULL)) + if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != nullptr)) return NSK_FALSE; /* get tested thread field 'waitingMonitor' */ if (!NSK_JNI_VERIFY(jni, (field = - jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != NULL)) + jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -153,18 +153,18 @@ static int checkSignalThread() { const char* THREAD_DEATH_CLASS_NAME = "java/lang/ThreadDeath"; const char* THREAD_DEATH_CTOR_NAME = ""; const char* THREAD_DEATH_CTOR_SIGNATURE = "()V"; - jclass cls = NULL; - jmethodID ctor = NULL; - jobject exception = NULL; + jclass cls = nullptr; + jmethodID ctor = nullptr; + jobject exception = nullptr; - if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (ctor = - jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL)) + jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != nullptr)) return NSK_FALSE; NSK_DISPLAY0("Checking negative: StopThread\n"); @@ -183,7 +183,7 @@ static int checkSignalThread() { */ static int checkGetOwnedMonitorInfo() { jint count; - jobject *monitors = NULL; + jobject *monitors = nullptr; NSK_DISPLAY0("Checking negative: GetOwnedMonitorInfo\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -196,7 +196,7 @@ static int checkGetOwnedMonitorInfo() { /* Check "can_get_current_contended_monitor" function */ static int checkGetCurrentContendedMonitor() { - jobject monitor = NULL; + jobject monitor = nullptr; NSK_DISPLAY0("Checking negative: GetCurrentContendedMonitor\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -248,8 +248,8 @@ static int checkHeapFunctions() { const jlong TAG_VALUE = (123456789L); jlong tag; jint count; - jobject *res_objects = NULL; - jlong *res_tags = NULL; + jobject *res_objects = nullptr; + jlong *res_tags = nullptr; jint dummy_user_data = 0; NSK_DISPLAY0("Checking negative: SetTag\n"); @@ -302,7 +302,7 @@ static int checkHeapFunctions() { */ static int checkLocalVariableFunctions() { jint count; - jvmtiLocalVariableEntry *local_variable_table = NULL; + jvmtiLocalVariableEntry *local_variable_table = nullptr; jobject object_value; jint int_value; jlong long_value; @@ -372,7 +372,7 @@ static int checkLocalVariableFunctions() { static int checkSourceInfoFunctions() { char *name; jint count; - jvmtiLineNumberEntry *line_number_table = NULL; + jvmtiLineNumberEntry *line_number_table = nullptr; NSK_DISPLAY0("Checking negative: GetSourceFileName\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -505,7 +505,7 @@ ClassFileLoadHook(jvmtiEnv *jvmti_env, JNIEnv *env, jclass class_beeing_redefine jint class_data_len, const unsigned char* class_data, jint *new_class_data_len, unsigned char** new_class_data) { - if (name != NULL && (strcmp(name, CLASS_NAME) == 0)) { + if (name != nullptr && (strcmp(name, CLASS_NAME) == 0)) { NSK_DISPLAY1("ClassFileLoadHook: %s\n", name); if (!NSK_JVMTI_VERIFY(jvmti->Allocate(class_data_len, &klass_bytes))) nsk_jvmti_setFailStatus(); @@ -514,7 +514,7 @@ ClassFileLoadHook(jvmtiEnv *jvmti_env, JNIEnv *env, jclass class_beeing_redefine klass_byte_count = class_data_len; } NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL)); + jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, nullptr)); } } @@ -600,11 +600,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; /* testcase #1: check GetPotentialCapabilities */ @@ -674,7 +674,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks)))) return JNI_ERR; if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL))) + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t009/cm01t009.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t009/cm01t009.cpp index 535398b2a962..eb843879ceb7 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t009/cm01t009.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t009/cm01t009.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -52,22 +52,22 @@ extern "C" { /* ========================================================================== */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* test objects */ -static jthread thread = NULL; -static jclass klass = NULL; -static jmethodID method = NULL; -static jfieldID field = NULL; +static jthread thread = nullptr; +static jclass klass = nullptr; +static jmethodID method = nullptr; +static jfieldID field = nullptr; /* ========================================================================== */ static int prepare() { const char* THREAD_NAME = "Debuggee Thread"; jvmtiThreadInfo info; - jthread *threads = NULL; + jthread *threads = nullptr; jint threads_count = 0; int i; @@ -77,12 +77,12 @@ static int prepare() { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -92,7 +92,7 @@ static int prepare() { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL && (strcmp(info.name, THREAD_NAME) == 0)) { + if (info.name != nullptr && (strcmp(info.name, THREAD_NAME) == 0)) { thread = threads[i]; } } @@ -102,16 +102,16 @@ static int prepare() { return NSK_FALSE; /* get tested thread class */ - if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != nullptr)) return NSK_FALSE; /* get tested thread method 'run' */ - if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != NULL)) + if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != nullptr)) return NSK_FALSE; /* get tested thread field 'waitingMonitor' */ if (!NSK_JNI_VERIFY(jni, (field = - jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != NULL)) + jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -151,18 +151,18 @@ static int checkSignalThread() { const char* THREAD_DEATH_CLASS_NAME = "java/lang/ThreadDeath"; const char* THREAD_DEATH_CTOR_NAME = ""; const char* THREAD_DEATH_CTOR_SIGNATURE = "()V"; - jclass cls = NULL; - jmethodID ctor = NULL; - jobject exception = NULL; + jclass cls = nullptr; + jmethodID ctor = nullptr; + jobject exception = nullptr; - if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (ctor = - jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL)) + jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != nullptr)) return NSK_FALSE; NSK_DISPLAY0("Checking positive: InterruptThread\n"); @@ -180,7 +180,7 @@ static int checkSignalThread() { */ static int checkGetOwnedMonitorInfo() { jint count; - jobject *monitors = NULL; + jobject *monitors = nullptr; NSK_DISPLAY0("Checking negative: GetOwnedMonitorInfo\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -193,7 +193,7 @@ static int checkGetOwnedMonitorInfo() { /* Check "can_get_current_contended_monitor" function */ static int checkGetCurrentContendedMonitor() { - jobject monitor = NULL; + jobject monitor = nullptr; NSK_DISPLAY0("Checking negative: GetCurrentContendedMonitor\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -245,8 +245,8 @@ static int checkHeapFunctions() { const jlong TAG_VALUE = (123456789L); jlong tag; jint count; - jobject *res_objects = NULL; - jlong *res_tags = NULL; + jobject *res_objects = nullptr; + jlong *res_tags = nullptr; jint dummy_user_data = 0; NSK_DISPLAY0("Checking negative: SetTag\n"); @@ -299,7 +299,7 @@ static int checkHeapFunctions() { */ static int checkLocalVariableFunctions() { jint count; - jvmtiLocalVariableEntry *local_variable_table = NULL; + jvmtiLocalVariableEntry *local_variable_table = nullptr; jobject object_value; jint int_value; jlong long_value; @@ -369,7 +369,7 @@ static int checkLocalVariableFunctions() { static int checkSourceInfoFunctions() { char *name; jint count; - jvmtiLineNumberEntry *line_number_table = NULL; + jvmtiLineNumberEntry *line_number_table = nullptr; NSK_DISPLAY0("Checking negative: GetSourceFileName\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -397,7 +397,7 @@ static int checkRedefineClasses() { NSK_DISPLAY0("Checking negative: RedefineClasses\n"); class_def.klass = klass; class_def.class_byte_count = 0; - class_def.class_bytes = NULL; + class_def.class_bytes = nullptr; if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->RedefineClasses(1, &class_def))) return NSK_FALSE; @@ -569,11 +569,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; /* testcase #1: check GetPotentialCapabilities */ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t010/cm01t010.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t010/cm01t010.cpp index f7e8c0607728..507012417c5d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t010/cm01t010.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t010/cm01t010.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -51,22 +51,22 @@ extern "C" { /* ========================================================================== */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* test objects */ -static jthread thread = NULL; -static jclass klass = NULL; -static jmethodID method = NULL; -static jfieldID field = NULL; +static jthread thread = nullptr; +static jclass klass = nullptr; +static jmethodID method = nullptr; +static jfieldID field = nullptr; /* ========================================================================== */ static int prepare() { const char* THREAD_NAME = "Debuggee Thread"; jvmtiThreadInfo info; - jthread *threads = NULL; + jthread *threads = nullptr; jint threads_count = 0; int i; @@ -76,12 +76,12 @@ static int prepare() { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -91,7 +91,7 @@ static int prepare() { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL && (strcmp(info.name, THREAD_NAME) == 0)) { + if (info.name != nullptr && (strcmp(info.name, THREAD_NAME) == 0)) { thread = threads[i]; } } @@ -101,16 +101,16 @@ static int prepare() { return NSK_FALSE; /* get tested thread class */ - if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != nullptr)) return NSK_FALSE; /* get tested thread method 'run' */ - if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != NULL)) + if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != nullptr)) return NSK_FALSE; /* get tested thread field 'waitingMonitor' */ if (!NSK_JNI_VERIFY(jni, (field = - jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != NULL)) + jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -150,18 +150,18 @@ static int checkSignalThread() { const char* THREAD_DEATH_CLASS_NAME = "java/lang/ThreadDeath"; const char* THREAD_DEATH_CTOR_NAME = ""; const char* THREAD_DEATH_CTOR_SIGNATURE = "()V"; - jclass cls = NULL; - jmethodID ctor = NULL; - jobject exception = NULL; + jclass cls = nullptr; + jmethodID ctor = nullptr; + jobject exception = nullptr; - if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (ctor = - jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL)) + jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != nullptr)) return NSK_FALSE; NSK_DISPLAY0("Checking negative: StopThread\n"); @@ -180,7 +180,7 @@ static int checkSignalThread() { */ static int checkGetOwnedMonitorInfo() { jint count; - jobject *monitors = NULL; + jobject *monitors = nullptr; NSK_DISPLAY0("Checking negative: GetOwnedMonitorInfo\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -193,7 +193,7 @@ static int checkGetOwnedMonitorInfo() { /* Check "can_get_current_contended_monitor" function */ static int checkGetCurrentContendedMonitor() { - jobject monitor = NULL; + jobject monitor = nullptr; NSK_DISPLAY0("Checking negative: GetCurrentContendedMonitor\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -245,8 +245,8 @@ static int checkHeapFunctions() { const jlong TAG_VALUE = (123456789L); jlong tag; jint count; - jobject *res_objects = NULL; - jlong *res_tags = NULL; + jobject *res_objects = nullptr; + jlong *res_tags = nullptr; jint dummy_user_data = 0; NSK_DISPLAY0("Checking negative: SetTag\n"); @@ -299,7 +299,7 @@ static int checkHeapFunctions() { */ static int checkLocalVariableFunctions() { jint count; - jvmtiLocalVariableEntry *local_variable_table = NULL; + jvmtiLocalVariableEntry *local_variable_table = nullptr; jobject object_value; jint int_value; jlong long_value; @@ -369,7 +369,7 @@ static int checkLocalVariableFunctions() { static int checkSourceInfoFunctions() { char *name; jint count; - jvmtiLineNumberEntry *line_number_table = NULL; + jvmtiLineNumberEntry *line_number_table = nullptr; NSK_DISPLAY0("Checking positive: GetSourceFileName\n"); if (!NSK_JVMTI_VERIFY(jvmti->GetSourceFileName(klass, &name))) @@ -396,7 +396,7 @@ static int checkRedefineClasses() { NSK_DISPLAY0("Checking negative: RedefineClasses\n"); class_def.klass = klass; class_def.class_byte_count = 0; - class_def.class_bytes = NULL; + class_def.class_bytes = nullptr; if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->RedefineClasses(1, &class_def))) return NSK_FALSE; @@ -568,11 +568,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; /* testcase #1: check GetPotentialCapabilities */ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t011/cm01t011.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t011/cm01t011.cpp index fdd3e7207dab..d3843d9fbfaf 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t011/cm01t011.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t011/cm01t011.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -61,22 +61,22 @@ extern "C" { /* ========================================================================== */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* test objects */ -static jthread thread = NULL; -static jclass klass = NULL; -static jmethodID method = NULL; -static jfieldID field = NULL; +static jthread thread = nullptr; +static jclass klass = nullptr; +static jmethodID method = nullptr; +static jfieldID field = nullptr; /* ========================================================================== */ static int prepare() { const char* THREAD_NAME = "Debuggee Thread"; jvmtiThreadInfo info; - jthread *threads = NULL; + jthread *threads = nullptr; jint threads_count = 0; int i; @@ -86,12 +86,12 @@ static int prepare() { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -101,7 +101,7 @@ static int prepare() { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL && (strcmp(info.name, THREAD_NAME) == 0)) { + if (info.name != nullptr && (strcmp(info.name, THREAD_NAME) == 0)) { thread = threads[i]; } } @@ -111,16 +111,16 @@ static int prepare() { return NSK_FALSE; /* get tested thread class */ - if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != nullptr)) return NSK_FALSE; /* get tested thread method 'run' */ - if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != NULL)) + if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != nullptr)) return NSK_FALSE; /* get tested thread field 'waitingMonitor' */ if (!NSK_JNI_VERIFY(jni, (field = - jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != NULL)) + jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -160,18 +160,18 @@ static int checkSignalThread() { const char* THREAD_DEATH_CLASS_NAME = "java/lang/ThreadDeath"; const char* THREAD_DEATH_CTOR_NAME = ""; const char* THREAD_DEATH_CTOR_SIGNATURE = "()V"; - jclass cls = NULL; - jmethodID ctor = NULL; - jobject exception = NULL; + jclass cls = nullptr; + jmethodID ctor = nullptr; + jobject exception = nullptr; - if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (ctor = - jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL)) + jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != nullptr)) return NSK_FALSE; NSK_DISPLAY0("Checking negative: StopThread\n"); @@ -190,7 +190,7 @@ static int checkSignalThread() { */ static int checkGetOwnedMonitorInfo() { jint count; - jobject *monitors = NULL; + jobject *monitors = nullptr; NSK_DISPLAY0("Checking negative: GetOwnedMonitorInfo\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -203,7 +203,7 @@ static int checkGetOwnedMonitorInfo() { /* Check "can_get_current_contended_monitor" function */ static int checkGetCurrentContendedMonitor() { - jobject monitor = NULL; + jobject monitor = nullptr; NSK_DISPLAY0("Checking negative: GetCurrentContendedMonitor\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -255,8 +255,8 @@ static int checkHeapFunctions() { const jlong TAG_VALUE = (123456789L); jlong tag; jint count; - jobject *res_objects = NULL; - jlong *res_tags = NULL; + jobject *res_objects = nullptr; + jlong *res_tags = nullptr; jint dummy_user_data = 0; NSK_DISPLAY0("Checking negative: SetTag\n"); @@ -309,7 +309,7 @@ static int checkHeapFunctions() { */ static int checkLocalVariableFunctions() { jint count; - jvmtiLocalVariableEntry *local_variable_table = NULL; + jvmtiLocalVariableEntry *local_variable_table = nullptr; jobject object_value; jint int_value; jlong long_value; @@ -399,7 +399,7 @@ static int checkLocalVariableFunctions() { static int checkSourceInfoFunctions() { char *name; jint count; - jvmtiLineNumberEntry *line_number_table = NULL; + jvmtiLineNumberEntry *line_number_table = nullptr; NSK_DISPLAY0("Checking negative: GetSourceFileName\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -427,7 +427,7 @@ static int checkRedefineClasses() { NSK_DISPLAY0("Checking negative: RedefineClasses\n"); class_def.klass = klass; class_def.class_byte_count = 0; - class_def.class_bytes = NULL; + class_def.class_bytes = nullptr; if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->RedefineClasses(1, &class_def))) return NSK_FALSE; @@ -599,11 +599,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; /* testcase #1: check GetPotentialCapabilities */ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t012/cm01t012.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t012/cm01t012.cpp index 68b6461161c4..c72f4ecacd34 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t012/cm01t012.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t012/cm01t012.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -54,22 +54,22 @@ extern "C" { /* ========================================================================== */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* test objects */ -static jthread thread = NULL; -static jclass klass = NULL; -static jmethodID method = NULL; -static jfieldID field = NULL; +static jthread thread = nullptr; +static jclass klass = nullptr; +static jmethodID method = nullptr; +static jfieldID field = nullptr; /* ========================================================================== */ static int prepare() { const char* THREAD_NAME = "Debuggee Thread"; jvmtiThreadInfo info; - jthread *threads = NULL; + jthread *threads = nullptr; jint threads_count = 0; int i; @@ -79,12 +79,12 @@ static int prepare() { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -94,7 +94,7 @@ static int prepare() { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL && (strcmp(info.name, THREAD_NAME) == 0)) { + if (info.name != nullptr && (strcmp(info.name, THREAD_NAME) == 0)) { thread = threads[i]; } } @@ -104,16 +104,16 @@ static int prepare() { return NSK_FALSE; /* get tested thread class */ - if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != nullptr)) return NSK_FALSE; /* get tested thread method 'run' */ - if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != NULL)) + if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != nullptr)) return NSK_FALSE; /* get tested thread field 'waitingMonitor' */ if (!NSK_JNI_VERIFY(jni, (field = - jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != NULL)) + jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -151,18 +151,18 @@ static int checkSignalThread() { const char* THREAD_DEATH_CLASS_NAME = "java/lang/ThreadDeath"; const char* THREAD_DEATH_CTOR_NAME = ""; const char* THREAD_DEATH_CTOR_SIGNATURE = "()V"; - jclass cls = NULL; - jmethodID ctor = NULL; - jobject exception = NULL; + jclass cls = nullptr; + jmethodID ctor = nullptr; + jobject exception = nullptr; - if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (ctor = - jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL)) + jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != nullptr)) return NSK_FALSE; NSK_DISPLAY0("Checking negative: StopThread\n"); @@ -181,7 +181,7 @@ static int checkSignalThread() { */ static int checkGetOwnedMonitorInfo() { jint count; - jobject *monitors = NULL; + jobject *monitors = nullptr; NSK_DISPLAY0("Checking negative: GetOwnedMonitorInfo\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -194,7 +194,7 @@ static int checkGetOwnedMonitorInfo() { /* Check "can_get_current_contended_monitor" function */ static int checkGetCurrentContendedMonitor() { - jobject monitor = NULL; + jobject monitor = nullptr; NSK_DISPLAY0("Checking negative: GetCurrentContendedMonitor\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -246,8 +246,8 @@ static int checkHeapFunctions() { const jlong TAG_VALUE = (123456789L); jlong tag; jint count; - jobject *res_objects = NULL; - jlong *res_tags = NULL; + jobject *res_objects = nullptr; + jlong *res_tags = nullptr; jint dummy_user_data = 0; NSK_DISPLAY0("Checking negative: SetTag\n"); @@ -300,7 +300,7 @@ static int checkHeapFunctions() { */ static int checkLocalVariableFunctions() { jint count; - jvmtiLocalVariableEntry *local_variable_table = NULL; + jvmtiLocalVariableEntry *local_variable_table = nullptr; jobject object_value; jint int_value; jlong long_value; @@ -370,7 +370,7 @@ static int checkLocalVariableFunctions() { static int checkSourceInfoFunctions() { char *name; jint count; - jvmtiLineNumberEntry *line_number_table = NULL; + jvmtiLineNumberEntry *line_number_table = nullptr; NSK_DISPLAY0("Checking negative: GetSourceFileName\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -398,7 +398,7 @@ static int checkRedefineClasses() { NSK_DISPLAY0("Checking negative: RedefineClasses\n"); class_def.klass = klass; class_def.class_byte_count = 0; - class_def.class_bytes = NULL; + class_def.class_bytes = nullptr; if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->RedefineClasses(1, &class_def))) return NSK_FALSE; @@ -570,11 +570,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; /* testcase #1: check GetPotentialCapabilities */ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t013/cm01t013.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t013/cm01t013.cpp index b6ce11d590e8..7edbd56f4446 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t013/cm01t013.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t013/cm01t013.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -51,22 +51,22 @@ extern "C" { /* ========================================================================== */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* test objects */ -static jthread thread = NULL; -static jclass klass = NULL; -static jmethodID method = NULL; -static jfieldID field = NULL; +static jthread thread = nullptr; +static jclass klass = nullptr; +static jmethodID method = nullptr; +static jfieldID field = nullptr; /* ========================================================================== */ static int prepare() { const char* THREAD_NAME = "Debuggee Thread"; jvmtiThreadInfo info; - jthread *threads = NULL; + jthread *threads = nullptr; jint threads_count = 0; int i; @@ -76,12 +76,12 @@ static int prepare() { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -91,7 +91,7 @@ static int prepare() { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL && (strcmp(info.name, THREAD_NAME) == 0)) { + if (info.name != nullptr && (strcmp(info.name, THREAD_NAME) == 0)) { thread = threads[i]; } } @@ -101,16 +101,16 @@ static int prepare() { return NSK_FALSE; /* get tested thread class */ - if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != nullptr)) return NSK_FALSE; /* get tested thread method 'run' */ - if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != NULL)) + if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != nullptr)) return NSK_FALSE; /* get tested thread field 'waitingMonitor' */ if (!NSK_JNI_VERIFY(jni, (field = - jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != NULL)) + jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -150,18 +150,18 @@ static int checkSignalThread() { const char* THREAD_DEATH_CLASS_NAME = "java/lang/ThreadDeath"; const char* THREAD_DEATH_CTOR_NAME = ""; const char* THREAD_DEATH_CTOR_SIGNATURE = "()V"; - jclass cls = NULL; - jmethodID ctor = NULL; - jobject exception = NULL; + jclass cls = nullptr; + jmethodID ctor = nullptr; + jobject exception = nullptr; - if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (ctor = - jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL)) + jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != nullptr)) return NSK_FALSE; NSK_DISPLAY0("Checking negative: StopThread\n"); @@ -180,7 +180,7 @@ static int checkSignalThread() { */ static int checkGetOwnedMonitorInfo() { jint count; - jobject *monitors = NULL; + jobject *monitors = nullptr; NSK_DISPLAY0("Checking negative: GetOwnedMonitorInfo\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -193,7 +193,7 @@ static int checkGetOwnedMonitorInfo() { /* Check "can_get_current_contended_monitor" function */ static int checkGetCurrentContendedMonitor() { - jobject monitor = NULL; + jobject monitor = nullptr; NSK_DISPLAY0("Checking negative: GetCurrentContendedMonitor\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -245,8 +245,8 @@ static int checkHeapFunctions() { const jlong TAG_VALUE = (123456789L); jlong tag; jint count; - jobject *res_objects = NULL; - jlong *res_tags = NULL; + jobject *res_objects = nullptr; + jlong *res_tags = nullptr; jint dummy_user_data = 0; NSK_DISPLAY0("Checking negative: SetTag\n"); @@ -299,7 +299,7 @@ static int checkHeapFunctions() { */ static int checkLocalVariableFunctions() { jint count; - jvmtiLocalVariableEntry *local_variable_table = NULL; + jvmtiLocalVariableEntry *local_variable_table = nullptr; jobject object_value; jint int_value; jlong long_value; @@ -369,7 +369,7 @@ static int checkLocalVariableFunctions() { static int checkSourceInfoFunctions() { char *name; jint count; - jvmtiLineNumberEntry *line_number_table = NULL; + jvmtiLineNumberEntry *line_number_table = nullptr; NSK_DISPLAY0("Checking negative: GetSourceFileName\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -396,7 +396,7 @@ static int checkRedefineClasses() { NSK_DISPLAY0("Checking negative: RedefineClasses\n"); class_def.klass = klass; class_def.class_byte_count = 0; - class_def.class_bytes = NULL; + class_def.class_bytes = nullptr; if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->RedefineClasses(1, &class_def))) return NSK_FALSE; @@ -568,11 +568,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; /* testcase #1: check GetPotentialCapabilities */ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t014/cm01t014.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t014/cm01t014.cpp index 58d809956144..5abbc391dbb3 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t014/cm01t014.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t014/cm01t014.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -52,22 +52,22 @@ extern "C" { /* ========================================================================== */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* test objects */ -static jthread thread = NULL; -static jclass klass = NULL; -static jmethodID method = NULL; -static jfieldID field = NULL; +static jthread thread = nullptr; +static jclass klass = nullptr; +static jmethodID method = nullptr; +static jfieldID field = nullptr; /* ========================================================================== */ static int prepare() { const char* THREAD_NAME = "Debuggee Thread"; jvmtiThreadInfo info; - jthread *threads = NULL; + jthread *threads = nullptr; jint threads_count = 0; int i; @@ -77,12 +77,12 @@ static int prepare() { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -92,7 +92,7 @@ static int prepare() { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL && (strcmp(info.name, THREAD_NAME) == 0)) { + if (info.name != nullptr && (strcmp(info.name, THREAD_NAME) == 0)) { thread = threads[i]; } } @@ -102,16 +102,16 @@ static int prepare() { return NSK_FALSE; /* get tested thread class */ - if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != nullptr)) return NSK_FALSE; /* get tested thread method 'run' */ - if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != NULL)) + if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != nullptr)) return NSK_FALSE; /* get tested thread field 'waitingMonitor' */ if (!NSK_JNI_VERIFY(jni, (field = - jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != NULL)) + jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -216,18 +216,18 @@ static int checkSignalThread() { const char* THREAD_DEATH_CLASS_NAME = "java/lang/ThreadDeath"; const char* THREAD_DEATH_CTOR_NAME = ""; const char* THREAD_DEATH_CTOR_SIGNATURE = "()V"; - jclass cls = NULL; - jmethodID ctor = NULL; - jobject exception = NULL; + jclass cls = nullptr; + jmethodID ctor = nullptr; + jobject exception = nullptr; - if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (ctor = - jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL)) + jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != nullptr)) return NSK_FALSE; NSK_DISPLAY0("Checking negative: StopThread\n"); @@ -246,7 +246,7 @@ static int checkSignalThread() { */ static int checkGetOwnedMonitorInfo() { jint count; - jobject *monitors = NULL; + jobject *monitors = nullptr; NSK_DISPLAY0("Checking negative: GetOwnedMonitorInfo\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -259,7 +259,7 @@ static int checkGetOwnedMonitorInfo() { /* Check "can_get_current_contended_monitor" function */ static int checkGetCurrentContendedMonitor() { - jobject monitor = NULL; + jobject monitor = nullptr; NSK_DISPLAY0("Checking negative: GetCurrentContendedMonitor\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -311,8 +311,8 @@ static int checkHeapFunctions() { const jlong TAG_VALUE = (123456789L); jlong tag; jint count; - jobject *res_objects = NULL; - jlong *res_tags = NULL; + jobject *res_objects = nullptr; + jlong *res_tags = nullptr; jint dummy_user_data = 0; NSK_DISPLAY0("Checking negative: SetTag\n"); @@ -365,7 +365,7 @@ static int checkHeapFunctions() { */ static int checkLocalVariableFunctions() { jint count; - jvmtiLocalVariableEntry *local_variable_table = NULL; + jvmtiLocalVariableEntry *local_variable_table = nullptr; jobject object_value; jint int_value; jlong long_value; @@ -435,7 +435,7 @@ static int checkLocalVariableFunctions() { static int checkSourceInfoFunctions() { char *name; jint count; - jvmtiLineNumberEntry *line_number_table = NULL; + jvmtiLineNumberEntry *line_number_table = nullptr; NSK_DISPLAY0("Checking negative: GetSourceFileName\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -463,7 +463,7 @@ static int checkRedefineClasses() { NSK_DISPLAY0("Checking negative: RedefineClasses\n"); class_def.klass = klass; class_def.class_byte_count = 0; - class_def.class_bytes = NULL; + class_def.class_bytes = nullptr; if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->RedefineClasses(1, &class_def))) return NSK_FALSE; @@ -694,11 +694,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t015/cm01t015.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t015/cm01t015.cpp index 4919c2874dc0..a1c2d7128922 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t015/cm01t015.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t015/cm01t015.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -54,22 +54,22 @@ extern "C" { /* ========================================================================== */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* test objects */ -static jthread thread = NULL; -static jclass klass = NULL; -static jmethodID method = NULL; -static jfieldID field = NULL; +static jthread thread = nullptr; +static jclass klass = nullptr; +static jmethodID method = nullptr; +static jfieldID field = nullptr; /* ========================================================================== */ static int prepare() { const char* THREAD_NAME = "Debuggee Thread"; jvmtiThreadInfo info; - jthread *threads = NULL; + jthread *threads = nullptr; jint threads_count = 0; int i; @@ -79,12 +79,12 @@ static int prepare() { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -94,7 +94,7 @@ static int prepare() { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL && (strcmp(info.name, THREAD_NAME) == 0)) { + if (info.name != nullptr && (strcmp(info.name, THREAD_NAME) == 0)) { thread = threads[i]; } } @@ -104,16 +104,16 @@ static int prepare() { return NSK_FALSE; /* get tested thread class */ - if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != nullptr)) return NSK_FALSE; /* get tested thread method 'run' */ - if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != NULL)) + if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != nullptr)) return NSK_FALSE; /* get tested thread field 'waitingMonitor' */ if (!NSK_JNI_VERIFY(jni, (field = - jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != NULL)) + jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -218,18 +218,18 @@ static int checkSignalThread() { const char* THREAD_DEATH_CLASS_NAME = "java/lang/ThreadDeath"; const char* THREAD_DEATH_CTOR_NAME = ""; const char* THREAD_DEATH_CTOR_SIGNATURE = "()V"; - jclass cls = NULL; - jmethodID ctor = NULL; - jobject exception = NULL; + jclass cls = nullptr; + jmethodID ctor = nullptr; + jobject exception = nullptr; - if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (ctor = - jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL)) + jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != nullptr)) return NSK_FALSE; NSK_DISPLAY0("Checking negative: StopThread\n"); @@ -248,7 +248,7 @@ static int checkSignalThread() { */ static int checkGetOwnedMonitorInfo() { jint count; - jobject *monitors = NULL; + jobject *monitors = nullptr; NSK_DISPLAY0("Checking negative: GetOwnedMonitorInfo\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -261,7 +261,7 @@ static int checkGetOwnedMonitorInfo() { /* Check "can_get_current_contended_monitor" function */ static int checkGetCurrentContendedMonitor() { - jobject monitor = NULL; + jobject monitor = nullptr; NSK_DISPLAY0("Checking negative: GetCurrentContendedMonitor\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -313,8 +313,8 @@ static int checkHeapFunctions() { const jlong TAG_VALUE = (123456789L); jlong tag; jint count; - jobject *res_objects = NULL; - jlong *res_tags = NULL; + jobject *res_objects = nullptr; + jlong *res_tags = nullptr; jint dummy_user_data = 0; NSK_DISPLAY0("Checking negative: SetTag\n"); @@ -367,7 +367,7 @@ static int checkHeapFunctions() { */ static int checkLocalVariableFunctions() { jint count; - jvmtiLocalVariableEntry *local_variable_table = NULL; + jvmtiLocalVariableEntry *local_variable_table = nullptr; jobject object_value; jint int_value; jlong long_value; @@ -437,7 +437,7 @@ static int checkLocalVariableFunctions() { static int checkSourceInfoFunctions() { char *name; jint count; - jvmtiLineNumberEntry *line_number_table = NULL; + jvmtiLineNumberEntry *line_number_table = nullptr; NSK_DISPLAY0("Checking negative: GetSourceFileName\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -465,7 +465,7 @@ static int checkRedefineClasses() { NSK_DISPLAY0("Checking negative: RedefineClasses\n"); class_def.klass = klass; class_def.class_byte_count = 0; - class_def.class_bytes = NULL; + class_def.class_bytes = nullptr; if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->RedefineClasses(1, &class_def))) return NSK_FALSE; @@ -698,11 +698,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t016/cm01t016.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t016/cm01t016.cpp index 0952ff8d3dc6..40728346f183 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t016/cm01t016.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t016/cm01t016.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -52,22 +52,22 @@ extern "C" { /* ========================================================================== */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* test objects */ -static jthread thread = NULL; -static jclass klass = NULL; -static jmethodID method = NULL; -static jfieldID field = NULL; +static jthread thread = nullptr; +static jclass klass = nullptr; +static jmethodID method = nullptr; +static jfieldID field = nullptr; /* ========================================================================== */ static int prepare() { const char* THREAD_NAME = "Debuggee Thread"; jvmtiThreadInfo info; - jthread *threads = NULL; + jthread *threads = nullptr; jint threads_count = 0; int i; @@ -77,12 +77,12 @@ static int prepare() { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -92,7 +92,7 @@ static int prepare() { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL && (strcmp(info.name, THREAD_NAME) == 0)) { + if (info.name != nullptr && (strcmp(info.name, THREAD_NAME) == 0)) { thread = threads[i]; } } @@ -102,16 +102,16 @@ static int prepare() { return NSK_FALSE; /* get tested thread class */ - if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != nullptr)) return NSK_FALSE; /* get tested thread method 'run' */ - if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != NULL)) + if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != nullptr)) return NSK_FALSE; /* get tested thread field 'waitingMonitor' */ if (!NSK_JNI_VERIFY(jni, (field = - jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != NULL)) + jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -216,18 +216,18 @@ static int checkSignalThread() { const char* THREAD_DEATH_CLASS_NAME = "java/lang/ThreadDeath"; const char* THREAD_DEATH_CTOR_NAME = ""; const char* THREAD_DEATH_CTOR_SIGNATURE = "()V"; - jclass cls = NULL; - jmethodID ctor = NULL; - jobject exception = NULL; + jclass cls = nullptr; + jmethodID ctor = nullptr; + jobject exception = nullptr; - if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (ctor = - jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL)) + jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != nullptr)) return NSK_FALSE; NSK_DISPLAY0("Checking negative: StopThread\n"); @@ -246,7 +246,7 @@ static int checkSignalThread() { */ static int checkGetOwnedMonitorInfo() { jint count; - jobject *monitors = NULL; + jobject *monitors = nullptr; NSK_DISPLAY0("Checking negative: GetOwnedMonitorInfo\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -259,7 +259,7 @@ static int checkGetOwnedMonitorInfo() { /* Check "can_get_current_contended_monitor" function */ static int checkGetCurrentContendedMonitor() { - jobject monitor = NULL; + jobject monitor = nullptr; NSK_DISPLAY0("Checking negative: GetCurrentContendedMonitor\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -311,8 +311,8 @@ static int checkHeapFunctions() { const jlong TAG_VALUE = (123456789L); jlong tag; jint count; - jobject *res_objects = NULL; - jlong *res_tags = NULL; + jobject *res_objects = nullptr; + jlong *res_tags = nullptr; jint dummy_user_data = 0; NSK_DISPLAY0("Checking negative: SetTag\n"); @@ -365,7 +365,7 @@ static int checkHeapFunctions() { */ static int checkLocalVariableFunctions() { jint count; - jvmtiLocalVariableEntry *local_variable_table = NULL; + jvmtiLocalVariableEntry *local_variable_table = nullptr; jobject object_value; jint int_value; jlong long_value; @@ -435,7 +435,7 @@ static int checkLocalVariableFunctions() { static int checkSourceInfoFunctions() { char *name; jint count; - jvmtiLineNumberEntry *line_number_table = NULL; + jvmtiLineNumberEntry *line_number_table = nullptr; NSK_DISPLAY0("Checking negative: GetSourceFileName\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -463,7 +463,7 @@ static int checkRedefineClasses() { NSK_DISPLAY0("Checking negative: RedefineClasses\n"); class_def.klass = klass; class_def.class_byte_count = 0; - class_def.class_bytes = NULL; + class_def.class_bytes = nullptr; if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->RedefineClasses(1, &class_def))) return NSK_FALSE; @@ -692,11 +692,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t017/cm01t017.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t017/cm01t017.cpp index 13804681b1a5..f43dae8772fe 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t017/cm01t017.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t017/cm01t017.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -54,22 +54,22 @@ extern "C" { /* ========================================================================== */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* test objects */ -static jthread thread = NULL; -static jclass klass = NULL; -static jmethodID method = NULL; -static jfieldID field = NULL; +static jthread thread = nullptr; +static jclass klass = nullptr; +static jmethodID method = nullptr; +static jfieldID field = nullptr; /* ========================================================================== */ static int prepare() { const char* THREAD_NAME = "Debuggee Thread"; jvmtiThreadInfo info; - jthread *threads = NULL; + jthread *threads = nullptr; jint threads_count = 0; int i; @@ -79,12 +79,12 @@ static int prepare() { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -94,7 +94,7 @@ static int prepare() { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL && (strcmp(info.name, THREAD_NAME) == 0)) { + if (info.name != nullptr && (strcmp(info.name, THREAD_NAME) == 0)) { thread = threads[i]; } } @@ -104,16 +104,16 @@ static int prepare() { return NSK_FALSE; /* get tested thread class */ - if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != nullptr)) return NSK_FALSE; /* get tested thread method 'run' */ - if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != NULL)) + if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != nullptr)) return NSK_FALSE; /* get tested thread field 'waitingMonitor' */ if (!NSK_JNI_VERIFY(jni, (field = - jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != NULL)) + jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -218,18 +218,18 @@ static int checkSignalThread(int positive) { const char* THREAD_DEATH_CLASS_NAME = "java/lang/ThreadDeath"; const char* THREAD_DEATH_CTOR_NAME = ""; const char* THREAD_DEATH_CTOR_SIGNATURE = "()V"; - jclass cls = NULL; - jmethodID ctor = NULL; - jobject exception = NULL; + jclass cls = nullptr; + jmethodID ctor = nullptr; + jobject exception = nullptr; - if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (ctor = - jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL)) + jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != nullptr)) return NSK_FALSE; if (positive) { @@ -259,7 +259,7 @@ static int checkSignalThread(int positive) { */ static int checkGetOwnedMonitorInfo() { jint count; - jobject *monitors = NULL; + jobject *monitors = nullptr; NSK_DISPLAY0("Checking negative: GetOwnedMonitorInfo\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -272,7 +272,7 @@ static int checkGetOwnedMonitorInfo() { /* Check "can_get_current_contended_monitor" function */ static int checkGetCurrentContendedMonitor() { - jobject monitor = NULL; + jobject monitor = nullptr; NSK_DISPLAY0("Checking negative: GetCurrentContendedMonitor\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -324,8 +324,8 @@ static int checkHeapFunctions() { const jlong TAG_VALUE = (123456789L); jlong tag; jint count; - jobject *res_objects = NULL; - jlong *res_tags = NULL; + jobject *res_objects = nullptr; + jlong *res_tags = nullptr; jint dummy_user_data = 0; NSK_DISPLAY0("Checking negative: SetTag\n"); @@ -378,7 +378,7 @@ static int checkHeapFunctions() { */ static int checkLocalVariableFunctions() { jint count; - jvmtiLocalVariableEntry *local_variable_table = NULL; + jvmtiLocalVariableEntry *local_variable_table = nullptr; jobject object_value; jint int_value; jlong long_value; @@ -448,7 +448,7 @@ static int checkLocalVariableFunctions() { static int checkSourceInfoFunctions() { char *name; jint count; - jvmtiLineNumberEntry *line_number_table = NULL; + jvmtiLineNumberEntry *line_number_table = nullptr; NSK_DISPLAY0("Checking negative: GetSourceFileName\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -476,7 +476,7 @@ static int checkRedefineClasses() { NSK_DISPLAY0("Checking negative: RedefineClasses\n"); class_def.klass = klass; class_def.class_byte_count = 0; - class_def.class_bytes = NULL; + class_def.class_bytes = nullptr; if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->RedefineClasses(1, &class_def))) return NSK_FALSE; @@ -699,11 +699,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t018/cm01t018.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t018/cm01t018.cpp index 7e53745ccacf..380a55162433 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t018/cm01t018.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t018/cm01t018.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -56,22 +56,22 @@ extern "C" { /* ========================================================================== */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* test objects */ -static jthread thread = NULL; -static jclass klass = NULL; -static jmethodID method = NULL; -static jfieldID field = NULL; +static jthread thread = nullptr; +static jclass klass = nullptr; +static jmethodID method = nullptr; +static jfieldID field = nullptr; /* ========================================================================== */ static int prepare() { const char* THREAD_NAME = "Debuggee Thread"; jvmtiThreadInfo info; - jthread *threads = NULL; + jthread *threads = nullptr; jint threads_count = 0; int i; @@ -81,12 +81,12 @@ static int prepare() { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -96,7 +96,7 @@ static int prepare() { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL && (strcmp(info.name, THREAD_NAME) == 0)) { + if (info.name != nullptr && (strcmp(info.name, THREAD_NAME) == 0)) { thread = threads[i]; } } @@ -106,16 +106,16 @@ static int prepare() { return NSK_FALSE; /* get tested thread class */ - if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != nullptr)) return NSK_FALSE; /* get tested thread method 'run' */ - if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != NULL)) + if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != nullptr)) return NSK_FALSE; /* get tested thread field 'waitingMonitor' */ if (!NSK_JNI_VERIFY(jni, (field = - jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != NULL)) + jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -240,18 +240,18 @@ static int checkSignalThread() { const char* THREAD_DEATH_CLASS_NAME = "java/lang/ThreadDeath"; const char* THREAD_DEATH_CTOR_NAME = ""; const char* THREAD_DEATH_CTOR_SIGNATURE = "()V"; - jclass cls = NULL; - jmethodID ctor = NULL; - jobject exception = NULL; + jclass cls = nullptr; + jmethodID ctor = nullptr; + jobject exception = nullptr; - if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (ctor = - jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL)) + jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != nullptr)) return NSK_FALSE; NSK_DISPLAY0("Checking negative: StopThread\n"); @@ -270,7 +270,7 @@ static int checkSignalThread() { */ static int checkGetOwnedMonitorInfo() { jint count; - jobject *monitors = NULL; + jobject *monitors = nullptr; NSK_DISPLAY0("Checking negative: GetOwnedMonitorInfo\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -283,7 +283,7 @@ static int checkGetOwnedMonitorInfo() { /* Check "can_get_current_contended_monitor" function */ static int checkGetCurrentContendedMonitor() { - jobject monitor = NULL; + jobject monitor = nullptr; NSK_DISPLAY0("Checking negative: GetCurrentContendedMonitor\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -335,8 +335,8 @@ static int checkHeapFunctions() { const jlong TAG_VALUE = (123456789L); jlong tag; jint count; - jobject *res_objects = NULL; - jlong *res_tags = NULL; + jobject *res_objects = nullptr; + jlong *res_tags = nullptr; jint dummy_user_data = 0; NSK_DISPLAY0("Checking negative: SetTag\n"); @@ -389,7 +389,7 @@ static int checkHeapFunctions() { */ static int checkLocalVariableFunctions() { jint count; - jvmtiLocalVariableEntry *local_variable_table = NULL; + jvmtiLocalVariableEntry *local_variable_table = nullptr; jobject object_value; jint int_value; jlong long_value; @@ -459,7 +459,7 @@ static int checkLocalVariableFunctions() { static int checkSourceInfoFunctions() { char *name; jint count; - jvmtiLineNumberEntry *line_number_table = NULL; + jvmtiLineNumberEntry *line_number_table = nullptr; NSK_DISPLAY0("Checking negative: GetSourceFileName\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -487,7 +487,7 @@ static int checkRedefineClasses() { NSK_DISPLAY0("Checking negative: RedefineClasses\n"); class_def.klass = klass; class_def.class_byte_count = 0; - class_def.class_bytes = NULL; + class_def.class_bytes = nullptr; if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->RedefineClasses(1, &class_def))) return NSK_FALSE; @@ -710,11 +710,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t019/cm01t019.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t019/cm01t019.cpp index 9fe8b2043877..5e55adfa63d6 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t019/cm01t019.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t019/cm01t019.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -51,22 +51,22 @@ extern "C" { /* ========================================================================== */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* test objects */ -static jthread thread = NULL; -static jclass klass = NULL; -static jmethodID method = NULL; -static jfieldID field = NULL; +static jthread thread = nullptr; +static jclass klass = nullptr; +static jmethodID method = nullptr; +static jfieldID field = nullptr; /* ========================================================================== */ static int prepare() { const char* THREAD_NAME = "Debuggee Thread"; jvmtiThreadInfo info; - jthread *threads = NULL; + jthread *threads = nullptr; jint threads_count = 0; int i; @@ -76,12 +76,12 @@ static int prepare() { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -91,7 +91,7 @@ static int prepare() { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL && (strcmp(info.name, THREAD_NAME) == 0)) { + if (info.name != nullptr && (strcmp(info.name, THREAD_NAME) == 0)) { thread = threads[i]; } } @@ -101,16 +101,16 @@ static int prepare() { return NSK_FALSE; /* get tested thread class */ - if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != nullptr)) return NSK_FALSE; /* get tested thread method 'run' */ - if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != NULL)) + if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != nullptr)) return NSK_FALSE; /* get tested thread field 'waitingMonitor' */ if (!NSK_JNI_VERIFY(jni, (field = - jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != NULL)) + jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -150,18 +150,18 @@ static int checkSignalThread() { const char* THREAD_DEATH_CLASS_NAME = "java/lang/ThreadDeath"; const char* THREAD_DEATH_CTOR_NAME = ""; const char* THREAD_DEATH_CTOR_SIGNATURE = "()V"; - jclass cls = NULL; - jmethodID ctor = NULL; - jobject exception = NULL; + jclass cls = nullptr; + jmethodID ctor = nullptr; + jobject exception = nullptr; - if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (ctor = - jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL)) + jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != nullptr)) return NSK_FALSE; NSK_DISPLAY0("Checking negative: StopThread\n"); @@ -180,7 +180,7 @@ static int checkSignalThread() { */ static int checkGetOwnedMonitorInfo() { jint count; - jobject *monitors = NULL; + jobject *monitors = nullptr; NSK_DISPLAY0("Checking negative: GetOwnedMonitorInfo\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -193,7 +193,7 @@ static int checkGetOwnedMonitorInfo() { /* Check "can_get_current_contended_monitor" function */ static int checkGetCurrentContendedMonitor() { - jobject monitor = NULL; + jobject monitor = nullptr; NSK_DISPLAY0("Checking negative: GetCurrentContendedMonitor\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -245,8 +245,8 @@ static int checkHeapFunctions() { const jlong TAG_VALUE = (123456789L); jlong tag; jint count; - jobject *res_objects = NULL; - jlong *res_tags = NULL; + jobject *res_objects = nullptr; + jlong *res_tags = nullptr; jint dummy_user_data = 0; NSK_DISPLAY0("Checking negative: SetTag\n"); @@ -299,7 +299,7 @@ static int checkHeapFunctions() { */ static int checkLocalVariableFunctions() { jint count; - jvmtiLocalVariableEntry *local_variable_table = NULL; + jvmtiLocalVariableEntry *local_variable_table = nullptr; jobject object_value; jint int_value; jlong long_value; @@ -369,7 +369,7 @@ static int checkLocalVariableFunctions() { static int checkSourceInfoFunctions() { char *name; jint count; - jvmtiLineNumberEntry *line_number_table = NULL; + jvmtiLineNumberEntry *line_number_table = nullptr; NSK_DISPLAY0("Checking negative: GetSourceFileName\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -397,7 +397,7 @@ static int checkRedefineClasses() { NSK_DISPLAY0("Checking negative: RedefineClasses\n"); class_def.klass = klass; class_def.class_byte_count = 0; - class_def.class_bytes = NULL; + class_def.class_bytes = nullptr; if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->RedefineClasses(1, &class_def))) return NSK_FALSE; @@ -569,11 +569,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; /* testcase #1: check GetPotentialCapabilities */ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t020/cm01t020.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t020/cm01t020.cpp index 25d4ed9a06eb..0eea0f25f8f2 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t020/cm01t020.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t020/cm01t020.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -52,22 +52,22 @@ extern "C" { /* ========================================================================== */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* test objects */ -static jthread thread = NULL; -static jclass klass = NULL; -static jmethodID method = NULL; -static jfieldID field = NULL; +static jthread thread = nullptr; +static jclass klass = nullptr; +static jmethodID method = nullptr; +static jfieldID field = nullptr; /* ========================================================================== */ static int prepare() { const char* THREAD_NAME = "Debuggee Thread"; jvmtiThreadInfo info; - jthread *threads = NULL; + jthread *threads = nullptr; jint threads_count = 0; int i; @@ -77,12 +77,12 @@ static int prepare() { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -92,7 +92,7 @@ static int prepare() { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL && (strcmp(info.name, THREAD_NAME) == 0)) { + if (info.name != nullptr && (strcmp(info.name, THREAD_NAME) == 0)) { thread = threads[i]; } } @@ -102,16 +102,16 @@ static int prepare() { return NSK_FALSE; /* get tested thread class */ - if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != nullptr)) return NSK_FALSE; /* get tested thread method 'run' */ - if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != NULL)) + if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != nullptr)) return NSK_FALSE; /* get tested thread field 'waitingMonitor' */ if (!NSK_JNI_VERIFY(jni, (field = - jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != NULL)) + jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -151,18 +151,18 @@ static int checkSignalThread() { const char* THREAD_DEATH_CLASS_NAME = "java/lang/ThreadDeath"; const char* THREAD_DEATH_CTOR_NAME = ""; const char* THREAD_DEATH_CTOR_SIGNATURE = "()V"; - jclass cls = NULL; - jmethodID ctor = NULL; - jobject exception = NULL; + jclass cls = nullptr; + jmethodID ctor = nullptr; + jobject exception = nullptr; - if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (ctor = - jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL)) + jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != nullptr)) return NSK_FALSE; NSK_DISPLAY0("Checking negative: StopThread\n"); @@ -181,7 +181,7 @@ static int checkSignalThread() { */ static int checkGetOwnedMonitorInfo() { jint count; - jobject *monitors = NULL; + jobject *monitors = nullptr; NSK_DISPLAY0("Checking negative: GetOwnedMonitorInfo\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -194,7 +194,7 @@ static int checkGetOwnedMonitorInfo() { /* Check "can_get_current_contended_monitor" function */ static int checkGetCurrentContendedMonitor() { - jobject monitor = NULL; + jobject monitor = nullptr; NSK_DISPLAY0("Checking negative: GetCurrentContendedMonitor\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -246,8 +246,8 @@ static int checkHeapFunctions() { const jlong TAG_VALUE = (123456789L); jlong tag; jint count; - jobject *res_objects = NULL; - jlong *res_tags = NULL; + jobject *res_objects = nullptr; + jlong *res_tags = nullptr; jint dummy_user_data = 0; NSK_DISPLAY0("Checking negative: SetTag\n"); @@ -300,7 +300,7 @@ static int checkHeapFunctions() { */ static int checkLocalVariableFunctions() { jint count; - jvmtiLocalVariableEntry *local_variable_table = NULL; + jvmtiLocalVariableEntry *local_variable_table = nullptr; jobject object_value; jint int_value; jlong long_value; @@ -370,7 +370,7 @@ static int checkLocalVariableFunctions() { static int checkSourceInfoFunctions() { char *name; jint count; - jvmtiLineNumberEntry *line_number_table = NULL; + jvmtiLineNumberEntry *line_number_table = nullptr; NSK_DISPLAY0("Checking negative: GetSourceFileName\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -398,7 +398,7 @@ static int checkRedefineClasses() { NSK_DISPLAY0("Checking negative: RedefineClasses\n"); class_def.klass = klass; class_def.class_byte_count = 0; - class_def.class_bytes = NULL; + class_def.class_bytes = nullptr; if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->RedefineClasses(1, &class_def))) return NSK_FALSE; @@ -568,11 +568,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; /* testcase #1: check GetPotentialCapabilities */ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t021/cm01t021.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t021/cm01t021.cpp index 829a7c8f3ddf..72148eafcc08 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t021/cm01t021.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM01/cm01t021/cm01t021.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -52,22 +52,22 @@ extern "C" { /* ========================================================================== */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* test objects */ -static jthread thread = NULL; -static jclass klass = NULL; -static jmethodID method = NULL; -static jfieldID field = NULL; +static jthread thread = nullptr; +static jclass klass = nullptr; +static jmethodID method = nullptr; +static jfieldID field = nullptr; /* ========================================================================== */ static int prepare() { const char* THREAD_NAME = "Debuggee Thread"; jvmtiThreadInfo info; - jthread *threads = NULL; + jthread *threads = nullptr; jint threads_count = 0; int i; @@ -77,12 +77,12 @@ static int prepare() { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -92,7 +92,7 @@ static int prepare() { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL && (strcmp(info.name, THREAD_NAME) == 0)) { + if (info.name != nullptr && (strcmp(info.name, THREAD_NAME) == 0)) { thread = threads[i]; } } @@ -102,16 +102,16 @@ static int prepare() { return NSK_FALSE; /* get tested thread class */ - if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != nullptr)) return NSK_FALSE; /* get tested thread method 'run' */ - if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != NULL)) + if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "run", "()V")) != nullptr)) return NSK_FALSE; /* get tested thread field 'waitingMonitor' */ if (!NSK_JNI_VERIFY(jni, (field = - jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != NULL)) + jni->GetFieldID(klass, "waitingMonitor", "Ljava/lang/Object;")) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -151,18 +151,18 @@ static int checkSignalThread() { const char* THREAD_DEATH_CLASS_NAME = "java/lang/ThreadDeath"; const char* THREAD_DEATH_CTOR_NAME = ""; const char* THREAD_DEATH_CTOR_SIGNATURE = "()V"; - jclass cls = NULL; - jmethodID ctor = NULL; - jobject exception = NULL; + jclass cls = nullptr; + jmethodID ctor = nullptr; + jobject exception = nullptr; - if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (ctor = - jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL)) + jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != nullptr)) return NSK_FALSE; NSK_DISPLAY0("Checking negative: StopThread\n"); @@ -181,7 +181,7 @@ static int checkSignalThread() { */ static int checkGetOwnedMonitorInfo() { jint count; - jobject *monitors = NULL; + jobject *monitors = nullptr; NSK_DISPLAY0("Checking negative: GetOwnedMonitorInfo\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -194,7 +194,7 @@ static int checkGetOwnedMonitorInfo() { /* Check "can_get_current_contended_monitor" function */ static int checkGetCurrentContendedMonitor() { - jobject monitor = NULL; + jobject monitor = nullptr; NSK_DISPLAY0("Checking negative: GetCurrentContendedMonitor\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -246,8 +246,8 @@ static int checkHeapFunctions() { const jlong TAG_VALUE = (123456789L); jlong tag; jint count; - jobject *res_objects = NULL; - jlong *res_tags = NULL; + jobject *res_objects = nullptr; + jlong *res_tags = nullptr; jint dummy_user_data = 0; NSK_DISPLAY0("Checking negative: SetTag\n"); @@ -300,7 +300,7 @@ static int checkHeapFunctions() { */ static int checkLocalVariableFunctions() { jint count; - jvmtiLocalVariableEntry *local_variable_table = NULL; + jvmtiLocalVariableEntry *local_variable_table = nullptr; jobject object_value; jint int_value; jlong long_value; @@ -370,7 +370,7 @@ static int checkLocalVariableFunctions() { static int checkSourceInfoFunctions() { char *name; jint count; - jvmtiLineNumberEntry *line_number_table = NULL; + jvmtiLineNumberEntry *line_number_table = nullptr; NSK_DISPLAY0("Checking negative: GetSourceFileName\n"); if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, @@ -398,7 +398,7 @@ static int checkRedefineClasses() { NSK_DISPLAY0("Checking negative: RedefineClasses\n"); class_def.klass = klass; class_def.class_byte_count = 0; - class_def.class_bytes = NULL; + class_def.class_bytes = nullptr; if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, jvmti->RedefineClasses(1, &class_def))) return NSK_FALSE; @@ -568,11 +568,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; /* testcase #1: check GetPotentialCapabilities */ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM02/cm02t001/cm02t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM02/cm02t001/cm02t001.cpp index d9037173ae34..f9f5516fd96e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM02/cm02t001/cm02t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM02/cm02t001/cm02t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -58,9 +58,9 @@ extern "C" { static jlong timeout = 0; /* test objects */ -static jthread thread = NULL; -static jclass klass = NULL; -static jobject testedObject = NULL; +static jthread thread = nullptr; +static jclass klass = nullptr; +static jobject testedObject = nullptr; const jlong TESTED_TAG_VALUE = 5555555L; static bool testedObjectNotified = false; @@ -98,34 +98,34 @@ static void JNICALL CompiledMethodLoad(jvmtiEnv *jvmti_env, jmethodID method, jint code_size, const void* code_addr, jint map_length, const jvmtiAddrLocationMap* map, const void* compile_info) { - char *name = NULL; - char *signature = NULL; + char *name = nullptr; + char *signature = nullptr; CompiledMethodLoadEventsCount++; - if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, nullptr))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY3("CompiledMethodLoad event: %s%s (0x%p)\n", name, signature, code_addr); - if (name != NULL) + if (name != nullptr) jvmti_env->Deallocate((unsigned char*)name); - if (signature != NULL) + if (signature != nullptr) jvmti_env->Deallocate((unsigned char*)signature); } static void JNICALL CompiledMethodUnload(jvmtiEnv *jvmti_env, jmethodID method, const void* code_addr) { - char *name = NULL; - char *sig = NULL; + char *name = nullptr; + char *sig = nullptr; jvmtiError err; CompiledMethodUnloadEventsCount++; NSK_DISPLAY0("CompiledMethodUnload event received\n"); // Check for the case that the class has been unloaded - err = jvmti_env->GetMethodName(method, &name, &sig, NULL); + err = jvmti_env->GetMethodName(method, &name, &sig, nullptr); if (err == JVMTI_ERROR_NONE) { NSK_DISPLAY3("for: \tmethod: name=\"%s\" signature=\"%s\"\n\tnative address=0x%p\n", name, sig, code_addr); @@ -206,12 +206,12 @@ VMObjectAlloc(jvmtiEnv *jvmti_env, JNIEnv* jni_env, VMObjectAllocEventsCount++; - if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(object_klass, &signature, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(object_klass, &signature, nullptr))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY2("VMObjectAlloc: \"%s\", size=%d\n", signature, size); - if (signature != NULL) + if (signature != nullptr) jvmti_env->Deallocate((unsigned char*)signature); } @@ -219,8 +219,8 @@ static void JNICALL NativeMethodBind(jvmtiEnv* jvmti_env, JNIEnv *jni_env, jthread thread, jmethodID method, void* func, void** func_ptr) { jvmtiPhase phase; - char *name = NULL; - char *signature = NULL; + char *name = nullptr; + char *signature = nullptr; NativeMethodBindEventsCount++; @@ -232,16 +232,16 @@ NativeMethodBind(jvmtiEnv* jvmti_env, JNIEnv *jni_env, if (phase != JVMTI_PHASE_START && phase != JVMTI_PHASE_LIVE) return; - if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, nullptr))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY2("NativeMethodBind event: %s%s\n", name, signature); - if (name != NULL) + if (name != nullptr) jvmti_env->Deallocate((unsigned char*)name); - if (signature != NULL) + if (signature != nullptr) jvmti_env->Deallocate((unsigned char*)signature); } @@ -274,7 +274,7 @@ ObjectFree(jvmtiEnv *jvmti_env, jlong tag) { static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { const char* THREAD_NAME = "Debuggee Thread"; jvmtiThreadInfo info; - jthread *threads = NULL; + jthread *threads = nullptr; jint threads_count = 0; int i; @@ -284,12 +284,12 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -299,12 +299,12 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL && (strcmp(info.name, THREAD_NAME) == 0)) { + if (info.name != nullptr && (strcmp(info.name, THREAD_NAME) == 0)) { thread = threads[i]; } } - if (!NSK_JNI_VERIFY(jni, (thread = jni->NewGlobalRef(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (thread = jni->NewGlobalRef(thread)) != nullptr)) return NSK_FALSE; /* deallocate threads list */ @@ -312,7 +312,7 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { return NSK_FALSE; /* get tested thread class */ - if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -366,7 +366,7 @@ static int checkGetCapabilities(jvmtiEnv* jvmti) { */ static int checkGetOwnedMonitorInfo(jvmtiEnv* jvmti) { jint count; - jobject *monitors = NULL; + jobject *monitors = nullptr; NSK_DISPLAY0("Checking positive: GetOwnedMonitorInfo\n"); if (!NSK_JVMTI_VERIFY(jvmti->GetOwnedMonitorInfo(thread, &count, &monitors))) @@ -378,7 +378,7 @@ static int checkGetOwnedMonitorInfo(jvmtiEnv* jvmti) { /* Check "can_get_current_contended_monitor" function */ static int checkGetCurrentContendedMonitor(jvmtiEnv* jvmti) { - jobject monitor = NULL; + jobject monitor = nullptr; NSK_DISPLAY0("Checking positive: GetCurrentContendedMonitor\n"); if (!NSK_JVMTI_VERIFY(jvmti->GetCurrentContendedMonitor(thread, &monitor))) @@ -433,20 +433,20 @@ class NewFrame { _jni->PushLocalFrame(16); } ~NewFrame() { - _jni->PopLocalFrame(NULL); + _jni->PopLocalFrame(nullptr); } }; static int checkObjectTagEvent(jvmtiEnv* jvmti, JNIEnv* jni) { jlong tag = TESTED_TAG_VALUE; jint count; - jobject *res_objects = NULL; - jlong *res_tags = NULL; + jobject *res_objects = nullptr; + jlong *res_tags = nullptr; NewFrame local_frame(jni); // Create a tested object to tag. - if (!NSK_JNI_VERIFY(jni, (testedObject = jni->NewStringUTF("abcde")) != NULL)) + if (!NSK_JNI_VERIFY(jni, (testedObject = jni->NewStringUTF("abcde")) != nullptr)) return NSK_FALSE; NSK_DISPLAY0("Checking positive: SetTag\n"); @@ -468,8 +468,8 @@ static int checkObjectTagEvent(jvmtiEnv* jvmti, JNIEnv* jni) { static int checkObjectFreeEvent(jvmtiEnv* jvmti) { jlong tag = TESTED_TAG_VALUE; jint count; - jobject *res_objects = NULL; - jlong *res_tags = NULL; + jobject *res_objects = nullptr; + jlong *res_tags = nullptr; // Make some GCs happen for (int i = 0; i < 5; i++) { @@ -493,8 +493,8 @@ static int checkHeapFunctions(jvmtiEnv* jvmti) { const jlong TAG_VALUE = (123456789L); jlong tag; jint count; - jobject *res_objects = NULL; - jlong *res_tags = NULL; + jobject *res_objects = nullptr; + jlong *res_tags = nullptr; jint dummy_user_data = 0; NSK_DISPLAY0("Checking positive: SetTag\n"); @@ -737,7 +737,7 @@ JNIEXPORT jint JNI_OnLoad_cm02t001(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiCapabilities caps; jvmtiEventCallbacks callbacks; @@ -750,7 +750,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add capabilities */ @@ -791,44 +791,44 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* enable events */ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode( - JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL))) + JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, nullptr))) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode( - JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, NULL))) + JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, nullptr))) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode( - JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_UNLOAD, NULL))) + JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_UNLOAD, nullptr))) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode( - JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTER, NULL))) + JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTER, nullptr))) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode( - JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTERED, NULL))) + JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTERED, nullptr))) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode( - JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAIT, NULL))) + JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAIT, nullptr))) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode( - JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAITED, NULL))) + JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAITED, nullptr))) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode( - JVMTI_ENABLE, JVMTI_EVENT_VM_OBJECT_ALLOC, NULL))) + JVMTI_ENABLE, JVMTI_EVENT_VM_OBJECT_ALLOC, nullptr))) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode( - JVMTI_ENABLE, JVMTI_EVENT_NATIVE_METHOD_BIND, NULL))) + JVMTI_ENABLE, JVMTI_EVENT_NATIVE_METHOD_BIND, nullptr))) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode( - JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_START, NULL))) + JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_START, nullptr))) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode( - JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_FINISH, NULL))) + JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_FINISH, nullptr))) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode( - JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, NULL))) + JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, nullptr))) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM03/cm03t001/cm03t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM03/cm03t001/cm03t001.cpp index 40e03426cc0a..67cd9ddd9761 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM03/cm03t001/cm03t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/capability/CM03/cm03t001/cm03t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -62,12 +62,12 @@ extern "C" { static jlong timeout = 0; /* test objects */ -static jthread thread = NULL; -static jclass klass = NULL; -static jmethodID method = NULL; -static jfieldID field = NULL; +static jthread thread = nullptr; +static jclass klass = nullptr; +static jmethodID method = nullptr; +static jfieldID field = nullptr; static jint klass_byte_count = 0; -static unsigned char *klass_bytes = NULL; +static unsigned char *klass_bytes = nullptr; /* event counts */ static int FieldAccessEventsCount = 0; @@ -93,7 +93,7 @@ ClassFileLoadHook(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jint class_data_len, const unsigned char* class_data, jint *new_class_data_len, unsigned char** new_class_data) { - if (name != NULL && (strcmp(name, CLASS_NAME) == 0)) { + if (name != nullptr && (strcmp(name, CLASS_NAME) == 0)) { NSK_DISPLAY1("ClassFileLoadHook: %s\n", name); if (!NSK_JVMTI_VERIFY(jvmti_env->Allocate(class_data_len, &klass_bytes))) nsk_jvmti_setFailStatus(); @@ -103,7 +103,7 @@ ClassFileLoadHook(jvmtiEnv *jvmti_env, JNIEnv *jni_env, } NSK_JVMTI_VERIFY( jvmti_env->SetEventNotificationMode( - JVMTI_DISABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL)); + JVMTI_DISABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, nullptr)); } } @@ -111,22 +111,22 @@ static void JNICALL FieldAccess(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jthread thread, jmethodID method, jlocation location, jclass field_klass, jobject object, jfieldID field) { - char *name = NULL; - char *signature = NULL; + char *name = nullptr; + char *signature = nullptr; FieldAccessEventsCount++; if (!NSK_JVMTI_VERIFY(jvmti_env->ClearFieldAccessWatch(klass, field))) return; - if (!NSK_JVMTI_VERIFY(jvmti_env->GetFieldName(field_klass, field, &name, &signature, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetFieldName(field_klass, field, &name, &signature, nullptr))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY2("FieldAccess event: %s:%s\n", name, signature); - if (name != NULL) + if (name != nullptr) jvmti_env->Deallocate((unsigned char*)name); - if (signature != NULL) + if (signature != nullptr) jvmti_env->Deallocate((unsigned char*)signature); } @@ -135,42 +135,42 @@ FieldModification(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jthread thread, jmethodID method, jlocation location, jclass field_klass, jobject object, jfieldID field, char sig, jvalue new_value) { - char *name = NULL; - char *signature = NULL; + char *name = nullptr; + char *signature = nullptr; FieldModificationEventsCount++; - if (!NSK_JVMTI_VERIFY(jvmti_env->GetFieldName(field_klass, field, &name, &signature, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetFieldName(field_klass, field, &name, &signature, nullptr))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY2("FieldModification event: %s:%s\n", name, signature); - if (name != NULL) + if (name != nullptr) jvmti_env->Deallocate((unsigned char*)name); - if (signature != NULL) + if (signature != nullptr) jvmti_env->Deallocate((unsigned char*)signature); } static void JNICALL SingleStep(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, jmethodID method, jlocation location) { - char *name = NULL; - char *signature = NULL; + char *name = nullptr; + char *signature = nullptr; SingleStepEventsCount++; NSK_JVMTI_VERIFY( jvmti_env->SetEventNotificationMode( - JVMTI_DISABLE, JVMTI_EVENT_SINGLE_STEP, NULL)); + JVMTI_DISABLE, JVMTI_EVENT_SINGLE_STEP, nullptr)); - if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, nullptr))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY2("SingleStep event: %s%s\n", name, signature); - if (name != NULL) + if (name != nullptr) jvmti_env->Deallocate((unsigned char*)name); - if (signature != NULL) + if (signature != nullptr) jvmti_env->Deallocate((unsigned char*)signature); } @@ -178,60 +178,60 @@ static void JNICALL Exception(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jthread thread, jmethodID method, jlocation location, jobject exception, jmethodID catch_method, jlocation catch_location) { - jclass klass = NULL; - char *signature = NULL; + jclass klass = nullptr; + char *signature = nullptr; ExceptionEventsCount++; - if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(exception)) != NULL)) { + if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(exception)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } - if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &signature, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &signature, nullptr))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY1("Exception event: %s\n", signature); - if (signature != NULL) + if (signature != nullptr) jvmti_env->Deallocate((unsigned char*)signature); } void JNICALL ExceptionCatch(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jthread thread, jmethodID method, jlocation location, jobject exception) { - jclass klass = NULL; - char *signature = NULL; + jclass klass = nullptr; + char *signature = nullptr; ExceptionCatchEventsCount++; - if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(exception)) != NULL)) { + if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(exception)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } - if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &signature, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &signature, nullptr))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY1("ExceptionCatch event: %s\n", signature); - if (signature != NULL) + if (signature != nullptr) jvmti_env->Deallocate((unsigned char*)signature); } static void JNICALL Breakpoint(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jthread thread, jmethodID method, jlocation location) { - char *name = NULL; - char *signature = NULL; + char *name = nullptr; + char *signature = nullptr; BreakpointEventsCount++; - if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, nullptr))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY2("Breakpoint event: %s%s\n", name, signature); - if (name != NULL) + if (name != nullptr) jvmti_env->Deallocate((unsigned char*)name); - if (signature != NULL) + if (signature != nullptr) jvmti_env->Deallocate((unsigned char*)signature); jvmti_env->NotifyFramePop(thread, 0); @@ -241,36 +241,36 @@ static void JNICALL FramePop(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jthread thread, jmethodID method, jboolean wasPopedByException) { - char *name = NULL; - char *signature = NULL; + char *name = nullptr; + char *signature = nullptr; FramePopEventsCount++; - if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, nullptr))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY2("FramePop event: %s%s\n", name, signature); - if (name != NULL) + if (name != nullptr) jvmti_env->Deallocate((unsigned char*)name); - if (signature != NULL) + if (signature != nullptr) jvmti_env->Deallocate((unsigned char*)signature); } static void JNICALL MethodEntry(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jthread thread, jmethodID method) { - char *name = NULL; - char *signature = NULL; + char *name = nullptr; + char *signature = nullptr; MethodEntryEventsCount++; - if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, nullptr))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY2("MethodEntry event: %s%s\n", name, signature); - if (name != NULL) + if (name != nullptr) jvmti_env->Deallocate((unsigned char*)name); - if (signature != NULL) + if (signature != nullptr) jvmti_env->Deallocate((unsigned char*)signature); } @@ -278,18 +278,18 @@ static void JNICALL MethodExit(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jthread thread, jmethodID method, jboolean was_poped_by_exception, jvalue return_value) { - char *name = NULL; - char *signature = NULL; + char *name = nullptr; + char *signature = nullptr; MethodExitEventsCount++; - if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, nullptr))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY2("MethodExit event: %s%s\n", name, signature); - if (name != NULL) + if (name != nullptr) jvmti_env->Deallocate((unsigned char*)name); - if (signature != NULL) + if (signature != nullptr) jvmti_env->Deallocate((unsigned char*)signature); } @@ -298,7 +298,7 @@ MethodExit(jvmtiEnv *jvmti_env, JNIEnv *jni_env, static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { const char* THREAD_NAME = "Debuggee Thread"; jvmtiThreadInfo info; - jthread *threads = NULL; + jthread *threads = nullptr; jint threads_count = 0; int i; @@ -308,12 +308,12 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -323,12 +323,12 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL && (strcmp(info.name, THREAD_NAME) == 0)) { + if (info.name != nullptr && (strcmp(info.name, THREAD_NAME) == 0)) { thread = threads[i]; } } - if (!NSK_JNI_VERIFY(jni, (thread = jni->NewGlobalRef(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (thread = jni->NewGlobalRef(thread)) != nullptr)) return NSK_FALSE; /* deallocate threads list */ @@ -336,19 +336,19 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { return NSK_FALSE; /* get tested thread class */ - if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != nullptr)) return NSK_FALSE; /* klass is used by other threads - convert to global handle */ - if (!NSK_JNI_VERIFY(jni, (klass = (jclass)jni->NewGlobalRef(klass)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (klass = (jclass)jni->NewGlobalRef(klass)) != nullptr)) return NSK_FALSE; /* get tested thread method 'delay' */ - if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "delay", "()V")) != NULL)) + if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "delay", "()V")) != nullptr)) return NSK_FALSE; /* get tested thread field 'waitingFlag' */ - if (!NSK_JNI_VERIFY(jni, (field = jni->GetFieldID(klass, "waitingFlag", "Z")) != NULL)) + if (!NSK_JNI_VERIFY(jni, (field = jni->GetFieldID(klass, "waitingFlag", "Z")) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -358,11 +358,11 @@ static int prepareEvents(jvmtiEnv* jvmti, JNIEnv* jni) { NSK_DISPLAY0("Prepare events ...\n"); /* get tested thread method 'letItGo' */ - if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "letItGo", "()V")) != NULL)) + if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "letItGo", "()V")) != nullptr)) return NSK_FALSE; /* get tested thread field 'waitingFlag' */ - if (!NSK_JNI_VERIFY(jni, (field = jni->GetFieldID(klass, "waitingFlag", "Z")) != NULL)) + if (!NSK_JNI_VERIFY(jni, (field = jni->GetFieldID(klass, "waitingFlag", "Z")) != nullptr)) return NSK_FALSE; if (!NSK_JVMTI_VERIFY(jvmti->SetFieldAccessWatch(klass, field))) @@ -376,13 +376,13 @@ static int prepareEvents(jvmtiEnv* jvmti, JNIEnv* jni) { /* enable events */ if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_SINGLE_STEP, NULL))) + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_SINGLE_STEP, nullptr))) return JNI_ERR; if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_EXCEPTION, NULL))) + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_EXCEPTION, nullptr))) return JNI_ERR; if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_EXCEPTION_CATCH, NULL))) + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_EXCEPTION_CATCH, nullptr))) return JNI_ERR; if (!NSK_JVMTI_VERIFY( jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_ENTRY, thread))) @@ -483,7 +483,7 @@ static int checkRedefineClasses(jvmtiEnv* jvmti) { jvmtiClassDefinition class_def; jboolean is_obsolete; - if (!NSK_VERIFY(klass_byte_count != 0 && klass_bytes != NULL)) + if (!NSK_VERIFY(klass_byte_count != 0 && klass_bytes != nullptr)) return NSK_FALSE; NSK_DISPLAY0("Checking positive: RedefineClasses\n"); @@ -516,7 +516,7 @@ static int checkGetSourceFileName(jvmtiEnv* jvmti) { */ static int checkGetLineNumberTable(jvmtiEnv* jvmti) { jint count; - jvmtiLineNumberEntry *line_number_table = NULL; + jvmtiLineNumberEntry *line_number_table = nullptr; NSK_DISPLAY0("Checking positive: GetLineNumberTable\n"); if (!NSK_JVMTI_VERIFY(jvmti->GetLineNumberTable(method, &count, &line_number_table))) @@ -542,7 +542,7 @@ static int checkGetSourceDebugExtension(jvmtiEnv* jvmti) { */ static int checkLocalVariableFunctions(jvmtiEnv* jvmti) { jint count; - jvmtiLocalVariableEntry *local_variable_table = NULL; + jvmtiLocalVariableEntry *local_variable_table = nullptr; jobject object_value; jint int_value; jlong long_value; @@ -680,18 +680,18 @@ static int checkSignalThread(jvmtiEnv* jvmti, JNIEnv* jni) { const char* THREAD_DEATH_CLASS_NAME = "java/lang/ThreadDeath"; const char* THREAD_DEATH_CTOR_NAME = ""; const char* THREAD_DEATH_CTOR_SIGNATURE = "()V"; - jclass cls = NULL; - jmethodID ctor = NULL; - jobject exception = NULL; + jclass cls = nullptr; + jmethodID ctor = nullptr; + jobject exception = nullptr; - if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (ctor = - jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL)) + jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (exception = jni->NewObject(cls, ctor)) != nullptr)) return NSK_FALSE; NSK_DISPLAY0("Checking positive: InterruptThread\n"); @@ -848,7 +848,7 @@ JNIEXPORT jint JNI_OnLoad_cm03t001(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiCapabilities caps; jvmtiEventCallbacks callbacks; @@ -861,7 +861,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add capabilities */ @@ -904,23 +904,23 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* enable events */ if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL))) + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, nullptr))) return JNI_ERR; if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FIELD_ACCESS, NULL))) + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FIELD_ACCESS, nullptr))) return JNI_ERR; if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FIELD_MODIFICATION, NULL))) + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FIELD_MODIFICATION, nullptr))) return JNI_ERR; if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL))) + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, nullptr))) return JNI_ERR; if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FRAME_POP, NULL))) + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FRAME_POP, nullptr))) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC01/tc01t001/tc01t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC01/tc01t001/tc01t001.cpp index 852c148dc6db..a720b90c1f23 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC01/tc01t001/tc01t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC01/tc01t001/tc01t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -35,9 +35,9 @@ extern "C" { static jlong timeout = 0; /* test objects */ -static jthread thread = NULL; -static jobject object_M1 = NULL; -static jobject object_M2 = NULL; +static jthread thread = nullptr; +static jobject object_M1 = nullptr; +static jobject object_M2 = nullptr; /* ========================================================================== */ @@ -45,10 +45,10 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { const char* THREAD_NAME = "Debuggee Thread"; const char* FIELD_SIG = "Ljava/lang/Object;"; jvmtiThreadInfo info; - jthread *threads = NULL; + jthread *threads = nullptr; jint threads_count = 0; - jfieldID field = NULL; - jclass klass = NULL; + jfieldID field = nullptr; + jclass klass = nullptr; int i; NSK_DISPLAY0("Prepare: find tested thread\n"); @@ -57,12 +57,12 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -72,11 +72,11 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL && (strcmp(info.name, THREAD_NAME) == 0)) { + if (info.name != nullptr && (strcmp(info.name, THREAD_NAME) == 0)) { thread = threads[i]; } - if (info.name != NULL) { + if (info.name != nullptr) { if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)info.name))) return NSK_FALSE; } @@ -87,21 +87,21 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { return NSK_FALSE; /* get tested thread class */ - if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != nullptr)) return NSK_FALSE; /* get tested thread field 'M1' */ - if (!NSK_JNI_VERIFY(jni, (field = jni->GetFieldID(klass, "M1", FIELD_SIG)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (field = jni->GetFieldID(klass, "M1", FIELD_SIG)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (object_M1 = jni->GetObjectField(thread, field)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (object_M1 = jni->GetObjectField(thread, field)) != nullptr)) return NSK_FALSE; /* get tested thread field 'M2' */ - if (!NSK_JNI_VERIFY(jni, (field = jni->GetFieldID(klass, "M2", FIELD_SIG)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (field = jni->GetFieldID(klass, "M2", FIELD_SIG)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (object_M2 = jni->GetObjectField(thread, field)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (object_M2 = jni->GetObjectField(thread, field)) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -121,14 +121,14 @@ static int checkGetObjectMonitorUsage(jvmtiEnv* jvmti, JNIEnv* jni, return NSK_FALSE; if (nsk_getVerboseMode()) { - if (inf.owner == NULL) { + if (inf.owner == nullptr) { NSK_DISPLAY0("\towner: none (0x0)\n"); } else { if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(inf.owner, &tinf))) { result = NSK_FALSE; } else { NSK_DISPLAY2("\towner: %s (0x%p)\n", tinf.name, inf.owner); - if (tinf.name != NULL) { + if (tinf.name != nullptr) { if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)tinf.name))) result = NSK_FALSE; } @@ -145,7 +145,7 @@ static int checkGetObjectMonitorUsage(jvmtiEnv* jvmti, JNIEnv* jni, } else { NSK_DISPLAY3("\t\t%2d: %s (0x%p)\n", i, tinf.name, inf.waiters[i]); - if (tinf.name != NULL) { + if (tinf.name != nullptr) { if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)tinf.name))) result = NSK_FALSE; } @@ -162,7 +162,7 @@ static int checkGetObjectMonitorUsage(jvmtiEnv* jvmti, JNIEnv* jni, } else { NSK_DISPLAY3("\t\t%2d: %s (0x%p)\n", i, tinf.name, inf.notify_waiters[i]); - if (tinf.name != NULL) { + if (tinf.name != nullptr) { if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)tinf.name))) result = NSK_FALSE; } @@ -185,11 +185,11 @@ static int checkGetObjectMonitorUsage(jvmtiEnv* jvmti, JNIEnv* jni, result = NSK_FALSE; /* deallocate monitor waiters arrays */ - if (inf.waiters != NULL) { + if (inf.waiters != nullptr) { if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)inf.waiters))) result = NSK_FALSE; } - if (inf.notify_waiters != NULL) { + if (inf.notify_waiters != nullptr) { if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)inf.notify_waiters))) result = NSK_FALSE; } @@ -242,7 +242,7 @@ JNIEXPORT jint JNI_OnLoad_tc01t001(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiCapabilities caps; /* init framework and parse options */ @@ -254,7 +254,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add capabilities */ @@ -264,7 +264,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC02/tc02t001/tc02t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC02/tc02t001/tc02t001.cpp index 0c3fbf88cb1e..39779183c040 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC02/tc02t001/tc02t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC02/tc02t001/tc02t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -35,8 +35,8 @@ extern "C" { static jlong timeout = 0; /* test objects */ -static jthread thread = NULL; -static jobject object_M = NULL; +static jthread thread = nullptr; +static jobject object_M = nullptr; /* line numbers of "synchronized (M)" clauses in java part of the test */ static jint lines[] = { 48, 53, 58 }; static volatile int enterEventsCount = 0; @@ -45,9 +45,9 @@ static volatile int enteredEventsCount = 0; /* ========================================================================== */ static jint findLineNumber(jvmtiEnv *jvmti, jthread thread) { - jmethodID method = NULL; + jmethodID method = nullptr; jlocation location; - jvmtiLineNumberEntry* table = NULL; + jvmtiLineNumberEntry* table = nullptr; jint count = 0; jint line = 0; int i; @@ -55,7 +55,7 @@ static jint findLineNumber(jvmtiEnv *jvmti, jthread thread) { if (!NSK_JVMTI_VERIFY(jvmti->GetFrameLocation(thread, 0, &method, &location))) return 0; - if (!NSK_VERIFY(method != NULL)) + if (!NSK_VERIFY(method != nullptr)) return 0; if (!NSK_VERIFY(location != -1)) @@ -64,7 +64,7 @@ static jint findLineNumber(jvmtiEnv *jvmti, jthread thread) { if (!NSK_JVMTI_VERIFY(jvmti->GetLineNumberTable(method, &count, &table))) return 0; - if (!NSK_VERIFY(table != NULL)) + if (!NSK_VERIFY(table != nullptr)) return 0; if (!NSK_VERIFY(count > 0)) @@ -78,7 +78,7 @@ static jint findLineNumber(jvmtiEnv *jvmti, jthread thread) { line = table[i-1].line_number; - if (table != NULL) { + if (table != nullptr) { if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)table))) return 0; } @@ -92,13 +92,13 @@ void JNICALL MonitorContendedEnter(jvmtiEnv *jvmti, JNIEnv* jni, jthread thr, jobject obj) { jint line = 0; - if (!NSK_VERIFY(thr != NULL)) { + if (!NSK_VERIFY(thr != nullptr)) { nsk_jvmti_setFailStatus(); NSK_COMPLAIN1("MonitorContendedEnter event: thread=%p\n", thr); return; } - if (!NSK_VERIFY(obj != NULL)) { + if (!NSK_VERIFY(obj != nullptr)) { nsk_jvmti_setFailStatus(); NSK_COMPLAIN1("MonitorContendedEnter event: object=%p\n", obj); return; @@ -137,13 +137,13 @@ void JNICALL MonitorContendedEntered(jvmtiEnv *jvmti, JNIEnv* jni, jthread thr, jobject obj) { jint line = 0; - if (!NSK_VERIFY(thr != NULL)) { + if (!NSK_VERIFY(thr != nullptr)) { nsk_jvmti_setFailStatus(); NSK_COMPLAIN1("MonitorContendedEntered event: thread=%p\n", thr); return; } - if (!NSK_VERIFY(obj != NULL)) { + if (!NSK_VERIFY(obj != nullptr)) { nsk_jvmti_setFailStatus(); NSK_COMPLAIN1("MonitorContendedEntered event: object=%p\n", obj); return; @@ -184,10 +184,10 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { const char* THREAD_NAME = "Debuggee Thread"; const char* FIELD_SIG = "Ljava/lang/Object;"; jvmtiThreadInfo info; - jthread *threads = NULL; + jthread *threads = nullptr; jint threads_count = 0; - jfieldID field = NULL; - jclass klass = NULL; + jfieldID field = nullptr; + jclass klass = nullptr; int i; NSK_DISPLAY0("Prepare: find tested thread\n"); @@ -196,12 +196,12 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -211,11 +211,11 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL && (strcmp(info.name, THREAD_NAME) == 0)) { + if (info.name != nullptr && (strcmp(info.name, THREAD_NAME) == 0)) { thread = threads[i]; } - if (info.name != NULL) { + if (info.name != nullptr) { if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)info.name))) return NSK_FALSE; } @@ -225,40 +225,40 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads))) return NSK_FALSE; - if (thread == NULL) { + if (thread == nullptr) { NSK_COMPLAIN0("Debuggee thread not found"); return NSK_FALSE; } /* make thread accessable for a long time */ - if (!NSK_JNI_VERIFY(jni, (thread = jni->NewGlobalRef(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (thread = jni->NewGlobalRef(thread)) != nullptr)) return NSK_FALSE; /* get tested thread class */ - if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != nullptr)) return NSK_FALSE; /* get tested thread field 'M' */ - if (!NSK_JNI_VERIFY(jni, (field = jni->GetFieldID(klass, "M", FIELD_SIG)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (field = jni->GetFieldID(klass, "M", FIELD_SIG)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (object_M = jni->GetObjectField(thread, field)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (object_M = jni->GetObjectField(thread, field)) != nullptr)) return NSK_FALSE; /* make object accessable for a long time */ - if (!NSK_JNI_VERIFY(jni, (object_M = jni->NewGlobalRef(object_M)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (object_M = jni->NewGlobalRef(object_M)) != nullptr)) return NSK_FALSE; /* enable MonitorContendedEntered event */ if (!NSK_JVMTI_VERIFY( jvmti->SetEventNotificationMode( - JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTER, NULL))) + JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTER, nullptr))) return NSK_FALSE; /* enable MonitorContendedEntered event */ if (!NSK_JVMTI_VERIFY( jvmti->SetEventNotificationMode( - JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTERED, NULL))) + JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTERED, nullptr))) return NSK_FALSE; return NSK_TRUE; @@ -269,7 +269,7 @@ static int clean(jvmtiEnv* jvmti, JNIEnv* jni) { /* disable MonitorContendedEntered event */ if (!NSK_JVMTI_VERIFY( jvmti->SetEventNotificationMode( - JVMTI_DISABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTERED, NULL))) + JVMTI_DISABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTERED, nullptr))) nsk_jvmti_setFailStatus(); return NSK_TRUE; @@ -334,7 +334,7 @@ JNIEXPORT jint JNI_OnLoad_tc02t001(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiCapabilities caps; jvmtiEventCallbacks callbacks; @@ -347,7 +347,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add capabilities */ @@ -364,7 +364,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC03/tc03t001/tc03t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC03/tc03t001/tc03t001.cpp index 9760e0c02078..ff7d346d237a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC03/tc03t001/tc03t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC03/tc03t001/tc03t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -41,15 +41,15 @@ typedef struct { static jlong timeout = 0; /* test objects */ -static threadDesc *threadList = NULL; +static threadDesc *threadList = nullptr; static jint threads_count = 0; static int numberOfDeadlocks = 0; /* ========================================================================== */ static int printDeadlock(jvmtiEnv* jvmti, JNIEnv* jni, int dThread) { - jobject monitor = NULL; - jclass klass = NULL; + jobject monitor = nullptr; + jclass klass = nullptr; jvmtiMonitorUsage usageInfo; int pThread, cThread; char* name; @@ -60,10 +60,10 @@ static int printDeadlock(jvmtiEnv* jvmti, JNIEnv* jni, int dThread) { if (!NSK_JVMTI_VERIFY( jvmti->GetCurrentContendedMonitor(threadList[pThread].thread, &monitor))) return NSK_FALSE; - if (monitor != NULL) { - if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(monitor)) != NULL)) + if (monitor != nullptr) { + if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(monitor)) != nullptr)) return NSK_FALSE; - if (!NSK_JVMTI_VERIFY(jvmti->GetClassSignature(klass, &name, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->GetClassSignature(klass, &name, nullptr))) return NSK_FALSE; NSK_DISPLAY2(" waiting to lock %p (%s),\n", monitor, name); jvmti->Deallocate((unsigned char*)name); @@ -72,16 +72,16 @@ static int printDeadlock(jvmtiEnv* jvmti, JNIEnv* jni, int dThread) { } if (!NSK_JVMTI_VERIFY(jvmti->GetObjectMonitorUsage(monitor, &usageInfo))) return NSK_FALSE; - if (usageInfo.owner == NULL) + if (usageInfo.owner == nullptr) break; for (cThread = 0; cThread < threads_count; cThread++) { if (jni->IsSameObject(threadList[cThread].thread, usageInfo.owner)) break; } - if (usageInfo.waiters != NULL) { + if (usageInfo.waiters != nullptr) { jvmti->Deallocate((unsigned char*)usageInfo.waiters); } - if (usageInfo.notify_waiters != NULL) { + if (usageInfo.notify_waiters != nullptr) { jvmti->Deallocate((unsigned char*)usageInfo.notify_waiters); } if (!NSK_VERIFY(cThread != threads_count)) @@ -97,8 +97,8 @@ static int printDeadlock(jvmtiEnv* jvmti, JNIEnv* jni, int dThread) { static int findDeadlockThreads(jvmtiEnv* jvmti, JNIEnv* jni) { jvmtiThreadInfo info; - jthread *threads = NULL; - jobject monitor = NULL; + jthread *threads = nullptr; + jobject monitor = nullptr; jvmtiMonitorUsage usageInfo; int tDfn = 0, gDfn = 0; int pThread, cThread; @@ -110,7 +110,7 @@ static int findDeadlockThreads(jvmtiEnv* jvmti, JNIEnv* jni) { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; if (!NSK_JVMTI_VERIFY( @@ -118,7 +118,7 @@ static int findDeadlockThreads(jvmtiEnv* jvmti, JNIEnv* jni) { return NSK_FALSE; for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -144,20 +144,20 @@ static int findDeadlockThreads(jvmtiEnv* jvmti, JNIEnv* jni) { if (!NSK_JVMTI_VERIFY( jvmti->GetCurrentContendedMonitor(threadList[pThread].thread, &monitor))) return NSK_FALSE; - if (monitor == NULL) + if (monitor == nullptr) break; if (!NSK_JVMTI_VERIFY(jvmti->GetObjectMonitorUsage(monitor, &usageInfo))) return NSK_FALSE; - if (usageInfo.owner == NULL) + if (usageInfo.owner == nullptr) break; for (cThread = 0; cThread < threads_count; cThread++) { if (jni->IsSameObject(threadList[cThread].thread, usageInfo.owner)) break; } - if (usageInfo.waiters != NULL) { + if (usageInfo.waiters != nullptr) { jvmti->Deallocate((unsigned char*)usageInfo.waiters); } - if (usageInfo.notify_waiters != NULL) { + if (usageInfo.notify_waiters != nullptr) { jvmti->Deallocate((unsigned char*)usageInfo.notify_waiters); } if (!NSK_VERIFY(cThread != threads_count)) @@ -180,7 +180,7 @@ static int findDeadlockThreads(jvmtiEnv* jvmti, JNIEnv* jni) { /* deallocate thread names */ for (i = 0; i < threads_count; i++) { - if (threadList[i].name != NULL) { + if (threadList[i].name != nullptr) { if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threadList[i].name))) return NSK_FALSE; } @@ -228,7 +228,7 @@ JNIEXPORT jint JNI_OnLoad_tc03t001(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiCapabilities caps; /* init framework and parse options */ @@ -240,7 +240,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add capabilities */ @@ -251,7 +251,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC03/tc03t002/tc03t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC03/tc03t002/tc03t002.cpp index f98c80c34c17..11c74e3a9e2c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC03/tc03t002/tc03t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC03/tc03t002/tc03t002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -41,15 +41,15 @@ typedef struct { static jlong timeout = 0; /* test objects */ -static threadDesc *threadList = NULL; +static threadDesc *threadList = nullptr; static jint threads_count = 0; static int numberOfDeadlocks = 0; /* ========================================================================== */ static int printDeadlock(jvmtiEnv* jvmti, JNIEnv* jni, int dThread) { - jobject monitor = NULL; - jclass klass = NULL; + jobject monitor = nullptr; + jclass klass = nullptr; jvmtiMonitorUsage usageInfo; int pThread, cThread; char* name; @@ -60,10 +60,10 @@ static int printDeadlock(jvmtiEnv* jvmti, JNIEnv* jni, int dThread) { if (!NSK_JVMTI_VERIFY( jvmti->GetCurrentContendedMonitor(threadList[pThread].thread, &monitor))) return NSK_FALSE; - if (monitor != NULL) { - if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(monitor)) != NULL)) + if (monitor != nullptr) { + if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(monitor)) != nullptr)) return NSK_FALSE; - if (!NSK_JVMTI_VERIFY(jvmti->GetClassSignature(klass, &name, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->GetClassSignature(klass, &name, nullptr))) return NSK_FALSE; NSK_DISPLAY2(" waiting to lock %p (%s),\n", monitor, name); jvmti->Deallocate((unsigned char*)name); @@ -72,16 +72,16 @@ static int printDeadlock(jvmtiEnv* jvmti, JNIEnv* jni, int dThread) { } if (!NSK_JVMTI_VERIFY(jvmti->GetObjectMonitorUsage(monitor, &usageInfo))) return NSK_FALSE; - if (usageInfo.owner == NULL) + if (usageInfo.owner == nullptr) break; for (cThread = 0; cThread < threads_count; cThread++) { if (jni->IsSameObject(threadList[cThread].thread, usageInfo.owner)) break; } - if (usageInfo.waiters != NULL) { + if (usageInfo.waiters != nullptr) { jvmti->Deallocate((unsigned char*)usageInfo.waiters); } - if (usageInfo.notify_waiters != NULL) { + if (usageInfo.notify_waiters != nullptr) { jvmti->Deallocate((unsigned char*)usageInfo.notify_waiters); } if (!NSK_VERIFY(cThread != threads_count)) @@ -97,8 +97,8 @@ static int printDeadlock(jvmtiEnv* jvmti, JNIEnv* jni, int dThread) { static int findDeadlockThreads(jvmtiEnv* jvmti, JNIEnv* jni) { jvmtiThreadInfo info; - jthread *threads = NULL; - jobject monitor = NULL; + jthread *threads = nullptr; + jobject monitor = nullptr; jvmtiMonitorUsage usageInfo; int tDfn = 0, gDfn = 0; int pThread, cThread; @@ -110,7 +110,7 @@ static int findDeadlockThreads(jvmtiEnv* jvmti, JNIEnv* jni) { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; if (!NSK_JVMTI_VERIFY( @@ -118,7 +118,7 @@ static int findDeadlockThreads(jvmtiEnv* jvmti, JNIEnv* jni) { return NSK_FALSE; for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -144,20 +144,20 @@ static int findDeadlockThreads(jvmtiEnv* jvmti, JNIEnv* jni) { if (!NSK_JVMTI_VERIFY( jvmti->GetCurrentContendedMonitor(threadList[pThread].thread, &monitor))) return NSK_FALSE; - if (monitor == NULL) + if (monitor == nullptr) break; if (!NSK_JVMTI_VERIFY(jvmti->GetObjectMonitorUsage(monitor, &usageInfo))) return NSK_FALSE; - if (usageInfo.owner == NULL) + if (usageInfo.owner == nullptr) break; for (cThread = 0; cThread < threads_count; cThread++) { if (jni->IsSameObject(threadList[cThread].thread, usageInfo.owner)) break; } - if (usageInfo.waiters != NULL) { + if (usageInfo.waiters != nullptr) { jvmti->Deallocate((unsigned char*)usageInfo.waiters); } - if (usageInfo.notify_waiters != NULL) { + if (usageInfo.notify_waiters != nullptr) { jvmti->Deallocate((unsigned char*)usageInfo.notify_waiters); } if (!NSK_VERIFY(cThread != threads_count)) @@ -180,7 +180,7 @@ static int findDeadlockThreads(jvmtiEnv* jvmti, JNIEnv* jni) { /* deallocate thread names */ for (i = 0; i < threads_count; i++) { - if (threadList[i].name != NULL) { + if (threadList[i].name != nullptr) { if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threadList[i].name))) return NSK_FALSE; } @@ -228,7 +228,7 @@ JNIEXPORT jint JNI_OnLoad_tc03t002(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiCapabilities caps; /* init framework and parse options */ @@ -240,7 +240,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add capabilities */ @@ -251,7 +251,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC04/tc04t001/tc04t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC04/tc04t001/tc04t001.cpp index 6000051f1ad9..80117ea70fd9 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC04/tc04t001/tc04t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC04/tc04t001/tc04t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -35,12 +35,12 @@ extern "C" { static jlong timeout = 0; /* test objects */ -static jclass object_M = NULL; +static jclass object_M = nullptr; static volatile int waitEventsCount = 0; static volatile int waitedEventsCount = 0; static volatile int enterEventsCount = 0; static volatile int enteredEventsCount = 0; -static jrawMonitorID syncLock = NULL; +static jrawMonitorID syncLock = nullptr; static jboolean lockSyncLock(jvmtiEnv* jvmti) { @@ -62,12 +62,12 @@ void JNICALL MonitorWait(jvmtiEnv *jvmti, JNIEnv* jni, jthread thr, jobject obj, jlong tout) { - if (!NSK_VERIFY(thr != NULL)) { + if (!NSK_VERIFY(thr != nullptr)) { nsk_jvmti_setFailStatus(); return; } - if (!NSK_VERIFY(obj != NULL)) { + if (!NSK_VERIFY(obj != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -85,12 +85,12 @@ void JNICALL MonitorWaited(jvmtiEnv *jvmti, JNIEnv* jni, jthread thr, jobject obj, jboolean timed_out) { - if (!NSK_VERIFY(thr != NULL)) { + if (!NSK_VERIFY(thr != nullptr)) { nsk_jvmti_setFailStatus(); return; } - if (!NSK_VERIFY(obj != NULL)) { + if (!NSK_VERIFY(obj != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -107,12 +107,12 @@ MonitorWaited(jvmtiEnv *jvmti, JNIEnv* jni, void JNICALL MonitorContendedEnter(jvmtiEnv *jvmti, JNIEnv* jni, jthread thr, jobject obj) { - if (!NSK_VERIFY(thr != NULL)) { + if (!NSK_VERIFY(thr != nullptr)) { nsk_jvmti_setFailStatus(); return; } - if (!NSK_VERIFY(obj != NULL)) { + if (!NSK_VERIFY(obj != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -129,12 +129,12 @@ MonitorContendedEnter(jvmtiEnv *jvmti, JNIEnv* jni, jthread thr, jobject obj) { void JNICALL MonitorContendedEntered(jvmtiEnv *jvmti, JNIEnv* jni, jthread thr, jobject obj) { - if (!NSK_VERIFY(thr != NULL)) { + if (!NSK_VERIFY(thr != nullptr)) { nsk_jvmti_setFailStatus(); return; } - if (!NSK_VERIFY(obj != NULL)) { + if (!NSK_VERIFY(obj != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -155,10 +155,10 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { NSK_DISPLAY0("Obtain tested object from debugee thread class\n"); - if (!NSK_JNI_VERIFY(jni, (object_M = jni->FindClass(CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (object_M = jni->FindClass(CLASS_NAME)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (object_M = (jclass)jni->NewGlobalRef(object_M)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (object_M = (jclass)jni->NewGlobalRef(object_M)) != nullptr)) return NSK_FALSE; if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_syncLock", &syncLock))) @@ -166,24 +166,24 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { /* enable MonitorWait event */ if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAIT, NULL))) + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAIT, nullptr))) nsk_jvmti_setFailStatus(); /* enable MonitorWaited event */ if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAITED, NULL))) + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAITED, nullptr))) nsk_jvmti_setFailStatus(); /* enable MonitorContendedEnter event */ if (!NSK_JVMTI_VERIFY( jvmti->SetEventNotificationMode( - JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTER, NULL))) + JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTER, nullptr))) nsk_jvmti_setFailStatus(); /* enable MonitorContendedEntered event */ if (!NSK_JVMTI_VERIFY( jvmti->SetEventNotificationMode( - JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTERED, NULL))) + JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTERED, nullptr))) nsk_jvmti_setFailStatus(); return NSK_TRUE; @@ -193,24 +193,24 @@ static int clean(jvmtiEnv* jvmti, JNIEnv* jni) { /* disable MonitorWait event */ if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_MONITOR_WAIT, NULL))) + jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_MONITOR_WAIT, nullptr))) nsk_jvmti_setFailStatus(); /* disable MonitorWaited event */ if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_MONITOR_WAITED, NULL))) + jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_MONITOR_WAITED, nullptr))) nsk_jvmti_setFailStatus(); /* disable MonitorContendedEnter event */ if (!NSK_JVMTI_VERIFY( jvmti->SetEventNotificationMode( - JVMTI_DISABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTER, NULL))) + JVMTI_DISABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTER, nullptr))) nsk_jvmti_setFailStatus(); /* disable MonitorContendedEntered event */ if (!NSK_JVMTI_VERIFY( jvmti->SetEventNotificationMode( - JVMTI_DISABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTERED, NULL))) + JVMTI_DISABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTERED, nullptr))) nsk_jvmti_setFailStatus(); if (!NSK_JVMTI_VERIFY(jvmti->DestroyRawMonitor(syncLock))) @@ -296,7 +296,7 @@ JNIEXPORT jint JNI_OnLoad_tc04t001(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiCapabilities caps; jvmtiEventCallbacks callbacks; @@ -309,7 +309,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add capabilities */ @@ -329,7 +329,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC05/tc05t001/tc05t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC05/tc05t001/tc05t001.cpp index aead5a925897..9680d01847ab 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC05/tc05t001/tc05t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/contention/TC05/tc05t001/tc05t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -49,8 +49,8 @@ static const jlong EXPECTED_ACCURACY = 10; // high frequency clock updates expec static jlong timeout = 0; /* test objects */ -static jthread thread = NULL; -static jobject object_M = NULL; +static jthread thread = nullptr; +static jobject object_M = nullptr; static volatile int waitEventsCount = 0; static volatile int waitedEventsCount = 0; static jlong waitTime = 0; @@ -65,12 +65,12 @@ MonitorWait(jvmtiEnv *jvmti, JNIEnv* jni, jthread thr, jobject obj, jlong tout) { char buffer[32]; - if (!NSK_VERIFY(thr != NULL)) { + if (!NSK_VERIFY(thr != nullptr)) { nsk_jvmti_setFailStatus(); return; } - if (!NSK_VERIFY(obj != NULL)) { + if (!NSK_VERIFY(obj != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -104,12 +104,12 @@ MonitorWaited(jvmtiEnv *jvmti, JNIEnv* jni, jthread thr, jobject obj, jboolean timed_out) { char buffer[32]; - if (!NSK_VERIFY(thr != NULL)) { + if (!NSK_VERIFY(thr != nullptr)) { nsk_jvmti_setFailStatus(); return; } - if (!NSK_VERIFY(obj != NULL)) { + if (!NSK_VERIFY(obj != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -140,10 +140,10 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { const char* THREAD_NAME = "Debuggee Thread"; const char* FIELD_SIG = "Ljava/lang/Object;"; jvmtiThreadInfo info; - jthread *threads = NULL; + jthread *threads = nullptr; jint threads_count = 0; - jfieldID field = NULL; - jclass klass = NULL; + jfieldID field = nullptr; + jclass klass = nullptr; int i; NSK_DISPLAY0("Prepare: find tested thread\n"); @@ -152,12 +152,12 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -167,11 +167,11 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL && (strcmp(info.name, THREAD_NAME) == 0)) { + if (info.name != nullptr && (strcmp(info.name, THREAD_NAME) == 0)) { thread = threads[i]; } - if (info.name != NULL) { + if (info.name != nullptr) { if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)info.name))) return NSK_FALSE; } @@ -181,38 +181,38 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads))) return NSK_FALSE; - if (thread == NULL) { + if (thread == nullptr) { NSK_COMPLAIN0("Debuggee thread not found"); return NSK_FALSE; } /* make thread accessable for a long time */ - if (!NSK_JNI_VERIFY(jni, (thread = jni->NewGlobalRef(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (thread = jni->NewGlobalRef(thread)) != nullptr)) return NSK_FALSE; /* get tested thread class */ - if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != nullptr)) return NSK_FALSE; /* get tested thread field 'M' */ - if (!NSK_JNI_VERIFY(jni, (field = jni->GetFieldID(klass, "M", FIELD_SIG)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (field = jni->GetFieldID(klass, "M", FIELD_SIG)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (object_M = jni->GetObjectField(thread, field)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (object_M = jni->GetObjectField(thread, field)) != nullptr)) return NSK_FALSE; /* make object accessable for a long time */ - if (!NSK_JNI_VERIFY(jni, (object_M = jni->NewGlobalRef(object_M)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (object_M = jni->NewGlobalRef(object_M)) != nullptr)) return NSK_FALSE; /* enable MonitorWait event */ if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAIT, NULL))) + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAIT, nullptr))) return NSK_FALSE; /* enable MonitorWaited event */ if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAITED, NULL))) + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAITED, nullptr))) return NSK_FALSE; return NSK_TRUE; @@ -222,12 +222,12 @@ static int clean(jvmtiEnv* jvmti, JNIEnv* jni) { /* disable MonitorWait event */ if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_MONITOR_WAIT, NULL))) + jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_MONITOR_WAIT, nullptr))) nsk_jvmti_setFailStatus(); /* disable MonitorWaited event */ if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_MONITOR_WAITED, NULL))) + jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_MONITOR_WAITED, nullptr))) nsk_jvmti_setFailStatus(); return NSK_TRUE; @@ -310,7 +310,7 @@ JNIEXPORT jint JNI_OnLoad_tc05t001(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiCapabilities caps; jvmtiEventCallbacks callbacks; @@ -323,7 +323,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add capabilities */ @@ -340,7 +340,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM01/em01t001/em01t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM01/em01t001/em01t001.cpp index 500f4ca655f0..cfc70e44e961 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM01/em01t001/em01t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM01/em01t001/em01t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,21 +23,21 @@ #include #include "jvmti.h" -#include "agent_common.h" +#include "agent_common.hpp" #include "ExceptionCheckingJniEnv.hpp" -#include "jni_tools.h" -#include "jvmti_tools.h" -#include "JVMTITools.h" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" +#include "JVMTITools.hpp" extern "C" { /* ============================================================================= */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; -static jrawMonitorID syncLock = NULL; +static jrawMonitorID syncLock = nullptr; /* constant names */ #define JVMTI_EVENT_COUNT (int)(JVMTI_MAX_EVENT_TYPE_VAL - JVMTI_MIN_EVENT_TYPE_VAL + 1) @@ -127,7 +127,7 @@ classEventsHandler(jvmtiEvent event, jvmtiEnv* jvmti_env, JNIEnv* jni_env, if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)className))) { nsk_jvmti_setFailStatus(); } - if (generic != NULL) + if (generic != nullptr) if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)generic))) { nsk_jvmti_setFailStatus(); } @@ -178,7 +178,7 @@ threadEventHandler(jvmtiEvent event, jvmtiEnv* jvmti_env, JNIEnv* jni_env, if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)className))) { nsk_jvmti_setFailStatus(); } - if (generic != NULL) + if (generic != nullptr) if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)generic))) { nsk_jvmti_setFailStatus(); } @@ -282,7 +282,7 @@ cbThreadEnd(jvmtiEnv* jvmti_env, JNIEnv* jni_env, jthread thread) { static int enableEvent(jvmtiEventMode enable, jvmtiEvent event) { NSK_DISPLAY1("enabling %s\n", TranslateEvent(event)); - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(enable, event, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(enable, event, nullptr))) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -427,7 +427,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { classLoaderCount = nsk_jvmti_findOptionIntValue(CLASS_LOADER_COUNT_PARAM, 10); jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_syncLock", &syncLock))) { @@ -452,7 +452,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; currentPhase = JVMTI_PHASE_PRIMORDIAL; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM01/em01t002/em01t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM01/em01t002/em01t002.cpp index d314b16ce2e9..7a65d9f04531 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM01/em01t002/em01t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM01/em01t002/em01t002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,21 +23,21 @@ #include #include "jvmti.h" -#include "agent_common.h" +#include "agent_common.hpp" #include "ExceptionCheckingJniEnv.hpp" -#include "jni_tools.h" -#include "jvmti_tools.h" -#include "JVMTITools.h" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" +#include "JVMTITools.hpp" extern "C" { /* ============================================================================= */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; -static jrawMonitorID syncLock = NULL; +static jrawMonitorID syncLock = nullptr; /* constant names */ #define JVMTI_EVENT_COUNT (int)(JVMTI_MAX_EVENT_TYPE_VAL - JVMTI_MIN_EVENT_TYPE_VAL + 1) @@ -187,7 +187,7 @@ classEventsHandler(jvmtiEvent event, jvmtiEnv* jvmti_env, JNIEnv* jni_env, if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)className))) { nsk_jvmti_setFailStatus(); } - if (generic != NULL) + if (generic != nullptr) if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)generic))) { nsk_jvmti_setFailStatus(); } @@ -239,7 +239,7 @@ threadEventHandler(jvmtiEvent event, jvmtiEnv* jvmti_env, JNIEnv* jni_env, if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)className))) { nsk_jvmti_setFailStatus(); } - if (generic != NULL) + if (generic != nullptr) if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)generic))) { nsk_jvmti_setFailStatus(); } @@ -350,7 +350,7 @@ enableEvent(jvmtiEventMode enable, jvmtiEvent event) { } - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(enable, event, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(enable, event, nullptr))) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -494,7 +494,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { classLoaderCount = nsk_jvmti_findOptionIntValue(CLASS_LOADER_COUNT_PARAM, 10); jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_syncLock", &syncLock))) { @@ -519,7 +519,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; currentPhase = JVMTI_PHASE_PRIMORDIAL; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t001/em02t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t001/em02t001.cpp index 0314850e4f77..06bdd4c66b0f 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t001/em02t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t001/em02t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,21 +23,21 @@ #include #include "jvmti.h" -#include "agent_common.h" +#include "agent_common.hpp" #include "ExceptionCheckingJniEnv.hpp" -#include "jni_tools.h" -#include "jvmti_tools.h" -#include "JVMTITools.h" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" +#include "JVMTITools.hpp" extern "C" { /* ============================================================================= */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; -static jrawMonitorID syncLock = NULL; +static jrawMonitorID syncLock = nullptr; /* constant names */ #define DEBUGEE_CLASS_NAME "nsk/jvmti/scenarios/events/EM02/em02t001" @@ -48,10 +48,10 @@ static jrawMonitorID syncLock = NULL; #define OBJECT_FIELD_SIG "Ljava/lang/Object;" #define THREAD_FIELD_SIG "Ljava/lang/Thread;" -static jthread mainThread = NULL; -static jthread debuggeeThread = NULL; -static jobject startObject = NULL; -static jobject endObject = NULL; +static jthread mainThread = nullptr; +static jthread debuggeeThread = nullptr; +static jobject startObject = nullptr; +static jobject endObject = nullptr; #define STEP_AMOUNT 3 #define JVMTI_EVENT_COUNT (int)(JVMTI_MAX_EVENT_TYPE_VAL - JVMTI_MIN_EVENT_TYPE_VAL + 1) @@ -63,21 +63,21 @@ static int newEventCount[JVMTI_EVENT_COUNT]; static jthread findThread(const char *threadName) { jvmtiThreadInfo info; - jthread *threads = NULL; + jthread *threads = nullptr; jint threads_count = 0; - jthread returnValue = NULL; + jthread returnValue = nullptr; int i; /* get all live threads */ if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) - return NULL; + return nullptr; - if (!NSK_VERIFY(threads != NULL)) - return NULL; + if (!NSK_VERIFY(threads != nullptr)) + return nullptr; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) break; /* get thread information */ @@ -85,14 +85,14 @@ findThread(const char *threadName) { break; /* find by name */ - if (info.name != NULL && (strcmp(info.name, threadName) == 0)) { + if (info.name != nullptr && (strcmp(info.name, threadName) == 0)) { returnValue = threads[i]; } } /* deallocate threads list */ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads))) - return NULL; + return nullptr; return returnValue; } @@ -105,7 +105,7 @@ getStaticObjField(const char* className, const char* objFieldName, ExceptionCheckingJniEnvPtr ec_jni(jni); jfieldID fieldID; - jclass klass = NULL; + jclass klass = nullptr; klass = ec_jni->FindClass(className, TRACE_JNI_CALL); fieldID = ec_jni->GetStaticFieldID(klass, objFieldName, signature, TRACE_JNI_CALL); @@ -118,7 +118,7 @@ static bool prepare() { ExceptionCheckingJniEnvPtr ec_jni(jni); mainThread = findThread(MAIN_THREAD_NAME); - if (!NSK_VERIFY(mainThread != NULL)) { + if (!NSK_VERIFY(mainThread != nullptr)) { NSK_COMPLAIN1("<%s> thread not found\n", MAIN_THREAD_NAME); return false; } @@ -126,14 +126,14 @@ static bool prepare() { /* make thread accessable for a long time */ mainThread = ec_jni->NewGlobalRef(mainThread, TRACE_JNI_CALL); startObject = getStaticObjField(DEBUGEE_CLASS_NAME, START_FIELD_NAME, OBJECT_FIELD_SIG); - if (!NSK_VERIFY(startObject != NULL)) + if (!NSK_VERIFY(startObject != nullptr)) return false; /*make object accessable for a long time*/ startObject = ec_jni->NewGlobalRef(startObject, TRACE_JNI_CALL); endObject = getStaticObjField(DEBUGEE_CLASS_NAME, END_FIELD_NAME, OBJECT_FIELD_SIG); - if (!NSK_VERIFY(endObject != NULL)) + if (!NSK_VERIFY(endObject != nullptr)) return false; /*make object accessable for a long time*/ @@ -142,7 +142,7 @@ static bool prepare() { debuggeeThread = (jthread) getStaticObjField(DEBUGEE_CLASS_NAME, THREAD_FIELD_NAME, THREAD_FIELD_SIG); - if (!NSK_VERIFY(debuggeeThread != NULL)) + if (!NSK_VERIFY(debuggeeThread != nullptr)) return false; /* make thread accessable for a long time */ @@ -158,7 +158,7 @@ static bool clean() { /* disable MonitorContendedEnter event */ if (!NSK_JVMTI_VERIFY( jvmti->SetEventNotificationMode( - JVMTI_DISABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTER, NULL))) + JVMTI_DISABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTER, nullptr))) nsk_jvmti_setFailStatus(); /* dispose global references */ @@ -167,10 +167,10 @@ static bool clean() { ec_jni->DeleteGlobalRef(debuggeeThread, TRACE_JNI_CALL); ec_jni->DeleteGlobalRef(mainThread, TRACE_JNI_CALL); - startObject = NULL; - endObject = NULL; - debuggeeThread = NULL; - mainThread = NULL; + startObject = nullptr; + endObject = nullptr; + debuggeeThread = nullptr; + mainThread = nullptr; return true; } @@ -396,7 +396,7 @@ handlerMC1(jvmtiEvent event, jvmtiEnv* jvmti, JNIEnv* jni_env, jthread expectedThread, jobject expectedObject) { ExceptionCheckingJniEnvPtr ec_jni(jni_env); - if (expectedThread == NULL || expectedObject == NULL) + if (expectedThread == nullptr || expectedObject == nullptr) return; /* check if event is for tested thread and for tested object */ @@ -483,7 +483,7 @@ handlerMC2(jvmtiEvent event, jvmtiEnv* jvmti, JNIEnv* jni_env, jthread expectedThread, jobject expectedObject) { ExceptionCheckingJniEnvPtr ec_jni(jni_env); - if (expectedThread == NULL || expectedObject == NULL) + if (expectedThread == nullptr || expectedObject == nullptr) return; /* check if event is for tested thread and for tested object */ @@ -553,13 +553,13 @@ static bool enableEvent(jvmtiEvent event) { && (event != JVMTI_EVENT_MONITOR_WAIT) && (event != JVMTI_EVENT_MONITOR_WAITED)) { if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, - jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { + jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, nullptr))) { NSK_COMPLAIN1("Unexpected error enabling %s\n", TranslateEvent(event)); return false; } } else { - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, nullptr))) { NSK_COMPLAIN1("Unexpected error enabling %s\n", TranslateEvent(event)); return false; @@ -743,7 +743,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_syncLock", &syncLock))) { @@ -770,7 +770,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t002/em02t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t002/em02t002.cpp index 5f30ac4e1e7c..947d6b9b178a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t002/em02t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t002/em02t002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,19 +23,19 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" +#include "JVMTITools.hpp" extern "C" { /* ============================================================================= */ /* scaffold objects */ -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; -static jrawMonitorID syncLock = NULL; +static jrawMonitorID syncLock = nullptr; /* constant names */ #define STEP_AMOUNT 3 @@ -344,13 +344,13 @@ static bool enableEvent(jvmtiEvent event) { && (event != JVMTI_EVENT_GARBAGE_COLLECTION_START) && (event != JVMTI_EVENT_GARBAGE_COLLECTION_FINISH)) { if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, - jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { + jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, nullptr))) { NSK_COMPLAIN1("Unexpected error enabling %s\n", TranslateEvent(event)); return false; } } else { - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, nullptr))) { NSK_COMPLAIN1("Unexpected error enabling %s\n", TranslateEvent(event)); return false; @@ -509,7 +509,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_syncLock", &syncLock))) { @@ -536,7 +536,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t003/em02t003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t003/em02t003.cpp index d5cae3e3a752..88fb29e9c175 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t003/em02t003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t003/em02t003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,19 +23,19 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" +#include "JVMTITools.hpp" extern "C" { /* ============================================================================= */ /* scaffold objects */ -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; -static jrawMonitorID syncLock = NULL; +static jrawMonitorID syncLock = nullptr; /* constant names */ #define STEP_AMOUNT 3 @@ -280,7 +280,7 @@ handlerMC1(jvmtiEvent event, jvmtiEnv* jvmti, jmethodID method) { if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)sign))) { nsk_jvmti_setFailStatus(); } - if (genc != NULL) + if (genc != nullptr) if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)genc))) { nsk_jvmti_setFailStatus(); } @@ -346,7 +346,7 @@ handlerMC2(jvmtiEvent event, jvmtiEnv* jvmti, jmethodID method) { if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)sign))) { nsk_jvmti_setFailStatus(); } - if (genc != NULL) + if (genc != nullptr) if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)genc))) { nsk_jvmti_setFailStatus(); } @@ -378,13 +378,13 @@ static bool enableEvent(jvmtiEvent event) { && (event != JVMTI_EVENT_COMPILED_METHOD_LOAD) && (event != JVMTI_EVENT_COMPILED_METHOD_UNLOAD)) { if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, - jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { + jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, nullptr))) { NSK_COMPLAIN1("Unexpected error enabling %s\n", TranslateEvent(event)); return false; } } else { - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, nullptr))) { NSK_COMPLAIN1("Unexpected error enabling %s\n", TranslateEvent(event)); return false; @@ -548,7 +548,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_syncLock", &syncLock))) { @@ -575,7 +575,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t004/em02t004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t004/em02t004.cpp index a3ecd17cf1fa..d852ec2df2cf 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t004/em02t004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t004/em02t004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,19 +23,19 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" +#include "JVMTITools.hpp" extern "C" { /* ============================================================================= */ /* scaffold objects */ -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; -static jrawMonitorID syncLock = NULL; +static jrawMonitorID syncLock = nullptr; /* constant names */ #define STEP_AMOUNT 3 @@ -334,7 +334,7 @@ cbNativeMethodBind(jvmtiEnv *jvmti_env, JNIEnv* jni_env,jthread thread, if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)sign))) { nsk_jvmti_setFailStatus(); } - if (genc != NULL) + if (genc != nullptr) if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)genc))) { nsk_jvmti_setFailStatus(); } @@ -374,7 +374,7 @@ cbNewNativeMethodBind(jvmtiEnv *jvmti_env, JNIEnv* jni_env,jthread thread, if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)sign))) { nsk_jvmti_setFailStatus(); } - if (genc != NULL) + if (genc != nullptr) if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)genc))) { nsk_jvmti_setFailStatus(); } @@ -387,13 +387,13 @@ static bool enableEvent(jvmtiEvent event) { if (nsk_jvmti_isOptionalEvent(event) && (event != JVMTI_EVENT_NATIVE_METHOD_BIND)) { if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, - jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { + jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, nullptr))) { NSK_COMPLAIN1("Unexpected error enabling %s\n", TranslateEvent(event)); return false; } } else { - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, nullptr))) { NSK_COMPLAIN1("Unexpected error enabling %s\n", TranslateEvent(event)); return false; @@ -554,7 +554,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_syncLock", &syncLock))) { @@ -581,7 +581,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t005/em02t005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t005/em02t005.cpp index 66d46a31062a..1a502487fba7 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t005/em02t005.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t005/em02t005.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,19 +23,19 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" +#include "JVMTITools.hpp" extern "C" { /* ============================================================================= */ /* scaffold objects */ -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; -static jrawMonitorID syncLock = NULL; +static jrawMonitorID syncLock = nullptr; /* constant names */ #define STEP_NUMBER 3 @@ -326,7 +326,7 @@ cbVMObjectAlloc(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)sign_ptr))) { nsk_jvmti_setFailStatus(); } - if (gen_ptr != NULL) + if (gen_ptr != nullptr) if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)gen_ptr))) { nsk_jvmti_setFailStatus(); } @@ -366,7 +366,7 @@ cbNewVMObjectAlloc(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)sign_ptr))) { nsk_jvmti_setFailStatus(); } - if (gen_ptr != NULL) + if (gen_ptr != nullptr) if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)gen_ptr))) { nsk_jvmti_setFailStatus(); } @@ -379,13 +379,13 @@ static bool enableEvent(jvmtiEvent event) { if (nsk_jvmti_isOptionalEvent(event) && (event != JVMTI_EVENT_VM_OBJECT_ALLOC)) { if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, - jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { + jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, nullptr))) { NSK_COMPLAIN1("Unexpected error enabling %s\n", TranslateEvent(event)); return false; } } else { - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, nullptr))) { NSK_COMPLAIN1("Unexpected error enabling %s\n", TranslateEvent(event)); return false; @@ -534,7 +534,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; @@ -560,7 +560,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t006/em02t006.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t006/em02t006.cpp index 415cbbcc5ed3..1c6ccd985206 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t006/em02t006.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t006/em02t006.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,19 +23,19 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" +#include "JVMTITools.hpp" extern "C" { /* ============================================================================= */ /* scaffold objects */ -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; -static jrawMonitorID syncLock = NULL; +static jrawMonitorID syncLock = nullptr; /* constant names */ #define STEP_NUMBER 3 @@ -328,13 +328,13 @@ static bool enableEvent(jvmtiEvent event) { if (nsk_jvmti_isOptionalEvent(event) && (event != JVMTI_EVENT_OBJECT_FREE)) { if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, - jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { + jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, nullptr))) { NSK_COMPLAIN1("Unexpected error enabling %s\n", TranslateEvent(event)); return false; } } else { - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, nullptr))) { NSK_COMPLAIN1("Unexpected error enabling %s\n", TranslateEvent(event)); return false; @@ -485,7 +485,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_syncLock", &syncLock))) { @@ -511,7 +511,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t007/em02t007.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t007/em02t007.cpp index 0b19c1d0f850..a288a75a5edc 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t007/em02t007.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t007/em02t007.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,19 +23,19 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" +#include "JVMTITools.hpp" extern "C" { /* ============================================================================= */ /* scaffold objects */ -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; -static jrawMonitorID syncLock = NULL; +static jrawMonitorID syncLock = nullptr; /* constant names */ #define STEP_NUMBER 3 @@ -200,7 +200,7 @@ cbSingleStep(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)sign))) { nsk_jvmti_setFailStatus(); } - if (genc != NULL) + if (genc != nullptr) if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)genc))) { nsk_jvmti_setFailStatus(); } @@ -230,7 +230,7 @@ cbNewSingleStep(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)sign))) { nsk_jvmti_setFailStatus(); } - if (genc != NULL) + if (genc != nullptr) if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)genc))) { nsk_jvmti_setFailStatus(); } @@ -357,13 +357,13 @@ static bool enableEvent(jvmtiEvent event) { if (nsk_jvmti_isOptionalEvent(event) && (event != JVMTI_EVENT_SINGLE_STEP)) { if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, - jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { + jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, nullptr))) { NSK_COMPLAIN1("Unexpected error enabling %s\n", TranslateEvent(event)); return false; } } else { - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, nullptr))) { NSK_COMPLAIN1("Unexpected error enabling %s\n", TranslateEvent(event)); return false; @@ -521,7 +521,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_syncLock", &syncLock))) { @@ -546,7 +546,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t008/em02t008.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t008/em02t008.cpp index 5c7edf432d32..4d4b73b12a63 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t008/em02t008.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t008/em02t008.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,19 +23,19 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" +#include "JVMTITools.hpp" extern "C" { /* ============================================================================= */ /* scaffold objects */ -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; -static jrawMonitorID syncLock = NULL; +static jrawMonitorID syncLock = nullptr; /* constant names */ #define STEP_NUMBER 3 @@ -377,13 +377,13 @@ static bool enableEvent(jvmtiEvent event) { && (event != JVMTI_EVENT_EXCEPTION) && (event != JVMTI_EVENT_EXCEPTION_CATCH)) { if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, - jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { + jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, nullptr))) { NSK_COMPLAIN1("Unexpected error enabling %s\n", TranslateEvent(event)); return false; } } else { - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, nullptr))) { NSK_COMPLAIN1("Unexpected error enabling %s\n", TranslateEvent(event)); return false; @@ -533,7 +533,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_syncLock", &syncLock))) { @@ -558,7 +558,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t009/em02t009.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t009/em02t009.cpp index 1ee810210dbb..1e52bd762c5d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t009/em02t009.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t009/em02t009.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,19 +23,19 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" +#include "JVMTITools.hpp" extern "C" { /* ============================================================================= */ /* scaffold objects */ -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; -static jrawMonitorID syncLock = NULL; +static jrawMonitorID syncLock = nullptr; /* constant names */ #define STEP_NUMBER 3 @@ -243,7 +243,7 @@ void handler1(jvmtiEnv *jvmti_env, jvmtiEvent event, jmethodID method) { if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)sign))) { nsk_jvmti_setFailStatus(); } - if (genc != NULL) + if (genc != nullptr) if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)genc))) { nsk_jvmti_setFailStatus(); } @@ -285,7 +285,7 @@ void handler2(jvmtiEnv *jvmti_env, jvmtiEvent event, jmethodID method) { if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)sign))) { nsk_jvmti_setFailStatus(); } - if (genc != NULL) + if (genc != nullptr) if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)genc))) { nsk_jvmti_setFailStatus(); } @@ -384,13 +384,13 @@ static bool enableEvent(jvmtiEvent event) { && (event != JVMTI_EVENT_METHOD_ENTRY) && (event != JVMTI_EVENT_METHOD_EXIT)) { if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, - jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { + jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, nullptr))) { NSK_COMPLAIN1("Unexpected error enabling %s\n", TranslateEvent(event)); return false; } } else { - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, nullptr))) { NSK_COMPLAIN1("Unexpected error enabling %s\n", TranslateEvent(event)); return false; @@ -540,7 +540,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_syncLock", &syncLock))) { @@ -566,7 +566,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t010/em02t010.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t010/em02t010.cpp index 5a181180b866..a1cb6acec4f8 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t010/em02t010.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t010/em02t010.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,20 +23,20 @@ #include #include "jvmti.h" -#include "agent_common.h" +#include "agent_common.hpp" #include "ExceptionCheckingJniEnv.hpp" -#include "jni_tools.h" -#include "jvmti_tools.h" -#include "JVMTITools.h" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" +#include "JVMTITools.hpp" extern "C" { /* ============================================================================= */ /* scaffold objects */ -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; -static jrawMonitorID syncLock = NULL; +static jrawMonitorID syncLock = nullptr; /* constant names */ #define STEP_NUMBER 3 @@ -340,13 +340,13 @@ static bool enableEvent(jvmtiEvent event) { && (event != JVMTI_EVENT_FIELD_MODIFICATION) && (event != JVMTI_EVENT_FIELD_ACCESS)) { if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, - jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { + jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, nullptr))) { NSK_COMPLAIN1("Unexpected error enabling %s\n", TranslateEvent(event)); return false; } } else { - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, nullptr))) { NSK_COMPLAIN1("Unexpected error enabling %s\n", TranslateEvent(event)); return false; @@ -516,7 +516,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_syncLock", &syncLock))) { @@ -542,7 +542,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t011/em02t011.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t011/em02t011.cpp index 626e2500a9a3..24873548a07e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t011/em02t011.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t011/em02t011.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,20 +23,20 @@ #include #include "jvmti.h" -#include "agent_common.h" +#include "agent_common.hpp" #include "ExceptionCheckingJniEnv.hpp" -#include "jni_tools.h" -#include "jvmti_tools.h" -#include "JVMTITools.h" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" +#include "JVMTITools.hpp" extern "C" { /* ============================================================================= */ /* scaffold objects */ -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; -static jrawMonitorID syncLock = NULL; +static jrawMonitorID syncLock = nullptr; /* constant names */ #define STEP_NUMBER 3 @@ -326,13 +326,13 @@ static bool enableEvent(jvmtiEvent event) { if (nsk_jvmti_isOptionalEvent(event) && (event != JVMTI_EVENT_BREAKPOINT)) { if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, - jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { + jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, nullptr))) { NSK_COMPLAIN1("Unexpected error enabling %s\n", TranslateEvent(event)); return false; } } else { - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, nullptr))) { NSK_COMPLAIN1("Unexpected error enabling %s\n", TranslateEvent(event)); return false; @@ -497,7 +497,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_syncLock", &syncLock))) { @@ -522,7 +522,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t012/em02t012.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t012/em02t012.cpp index ad7dfc5e0e84..402ffd638efa 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t012/em02t012.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t012/em02t012.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,21 +23,21 @@ #include #include "jvmti.h" -#include "agent_common.h" +#include "agent_common.hpp" #include "ExceptionCheckingJniEnv.hpp" -#include "jni_tools.h" -#include "jvmti_tools.h" -#include "JVMTITools.h" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" +#include "JVMTITools.hpp" extern "C" { /* ============================================================================= */ /* scaffold objects */ -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jthread testedThread; static jlong timeout = 0; -static jrawMonitorID syncLock = NULL; +static jrawMonitorID syncLock = nullptr; /* constant names */ #define STEP_NUMBER 3 @@ -330,13 +330,13 @@ static bool enableEvent(jvmtiEvent event) { if (nsk_jvmti_isOptionalEvent(event) && (event != JVMTI_EVENT_FRAME_POP)) { if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, - jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { + jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, nullptr))) { NSK_COMPLAIN1("Unexpected error enabling %s\n", TranslateEvent(event)); return false; } } else { - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, nullptr))) { NSK_COMPLAIN1("Unexpected error enabling %s\n", TranslateEvent(event)); return false; @@ -503,7 +503,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_syncLock", &syncLock))) { @@ -529,7 +529,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM04/em04t001/em04t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM04/em04t001/em04t001.cpp index 86ca654d2cdf..a7244db34418 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM04/em04t001/em04t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM04/em04t001/em04t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,20 +24,20 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" -#include "JVMTITools.h" -#include "nsk_list.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" +#include "JVMTITools.hpp" +#include "nsk_list.hpp" extern "C" { /* ============================================================================= */ /* scaffold objects */ -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; -const void *plist = NULL; +const void *plist = nullptr; #define NAME_LENGTH 50 @@ -48,7 +48,7 @@ typedef struct nsk_jvmti_DCG_paramsStruct { int sign; } nsk_jvmti_DCG_params; -static jrawMonitorID syncLock = NULL; +static jrawMonitorID syncLock = nullptr; static volatile int callbacksEnabled = NSK_TRUE; /* ============================================================================= */ @@ -122,7 +122,7 @@ cbDynamicCodeGenerated2(jvmtiEnv *jvmti_env, const char *name, static int enableEvent(jvmtiEventMode enable, jvmtiEvent event) { - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(enable, event, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(enable, event, nullptr))) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -212,7 +212,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved); - if (!NSK_VERIFY(jvmti != NULL)) + if (!NSK_VERIFY(jvmti != nullptr)) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_syncLock", &syncLock))) { @@ -221,7 +221,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } plist = (const void *)nsk_list_create(); - if (!NSK_VERIFY(plist != NULL)) + if (!NSK_VERIFY(plist != nullptr)) return JNI_ERR; NSK_DISPLAY1("plist = 0x%p\n", plist); @@ -236,7 +236,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM05/em05t001/em05t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM05/em05t001/em05t001.cpp index 096462184390..191bdcde9609 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM05/em05t001/em05t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM05/em05t001/em05t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,17 +23,17 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { /* ============================================================================= */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* constant names */ @@ -65,8 +65,8 @@ typedef struct { /* descriptions of tested methods */ static MethodDesc methodsDesc[METHODS_COUNT] = { - { "javaMethod", "(I)I", NULL, 0, 0, 0 }, - { "nativeMethod", "(I)I", NULL, 0, 0, 0 } + { "javaMethod", "(I)I", nullptr, 0, 0, 0 }, + { "nativeMethod", "(I)I", nullptr, 0, 0, 0 } }; /* ============================================================================= */ @@ -127,7 +127,7 @@ static int enableEvents(jvmtiEventMode enable) { int i; for (i = 0; i < EVENTS_COUNT; i++) { - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(enable, eventsList[i], NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(enable, eventsList[i], nullptr))) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -142,43 +142,43 @@ static int enableEvents(jvmtiEventMode enable) { * - enable events */ static int prepare() { - jclass debugeeClass = NULL; - jclass threadClass = NULL; - jfieldID threadFieldID = NULL; - jthread thread = NULL; + jclass debugeeClass = nullptr; + jclass threadClass = nullptr; + jfieldID threadFieldID = nullptr; + jthread thread = nullptr; int i; for (i = 0; i < METHODS_COUNT; i++) { - methodsDesc[i].method = (jmethodID)NULL; + methodsDesc[i].method = (jmethodID)nullptr; methodsDesc[i].loadEvents = 0; methodsDesc[i].unloadEvents = 0; } - if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (threadFieldID = - jni->GetStaticFieldID(debugeeClass, THREAD_FIELD_NAME, THREAD_FIELD_SIG)) != NULL)) + jni->GetStaticFieldID(debugeeClass, THREAD_FIELD_NAME, THREAD_FIELD_SIG)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (thread = (jthread) - jni->GetStaticObjectField(debugeeClass, threadFieldID)) != NULL)) + jni->GetStaticObjectField(debugeeClass, threadFieldID)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (threadClass = jni->GetObjectClass(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (threadClass = jni->GetObjectClass(thread)) != nullptr)) return NSK_FALSE; NSK_DISPLAY0("Find tested methods:\n"); for (i = 0; i < METHODS_COUNT; i++) { if (!NSK_JNI_VERIFY(jni, (methodsDesc[i].method = - jni->GetMethodID(threadClass, methodsDesc[i].methodName, methodsDesc[i].methodSig)) != NULL)) + jni->GetMethodID(threadClass, methodsDesc[i].methodName, methodsDesc[i].methodSig)) != nullptr)) return NSK_FALSE; NSK_DISPLAY3(" method #%d (%s): 0x%p\n", i, methodsDesc[i].methodName, (void*)methodsDesc[i].method); } NSK_DISPLAY0("Enable events\n"); - if (!nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, eventsList, NULL)) + if (!nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, eventsList, nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -220,7 +220,7 @@ static int checkEvents() { */ static int clean() { NSK_DISPLAY0("Disable events\n"); - if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, eventsList, NULL)) + if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, eventsList, nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -314,7 +314,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; { @@ -334,7 +334,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM05/em05t002/em05t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM05/em05t002/em05t002.cpp index 9f1b86471b20..aa4563349c01 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM05/em05t002/em05t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM05/em05t002/em05t002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,17 +23,17 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { /* ============================================================================= */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* constant names */ @@ -71,8 +71,8 @@ typedef struct { /* descriptions of tested methods */ static MethodDesc methodsDesc[METHODS_COUNT] = { - { "javaMethod", "(I)I", NULL, 0, {}, {} }, - { "nativeMethod", "(I)I", NULL, 0, {}, {} } + { "javaMethod", "(I)I", nullptr, 0, {}, {} }, + { "nativeMethod", "(I)I", nullptr, 0, {}, {} } }; /* current compilation moment */ @@ -166,15 +166,15 @@ static int generateEvents() { * - enable events */ static int prepare() { - jclass debugeeClass = NULL; - jclass threadClass = NULL; - jfieldID threadFieldID = NULL; - jthread thread = NULL; + jclass debugeeClass = nullptr; + jclass threadClass = nullptr; + jfieldID threadFieldID = nullptr; + jthread thread = nullptr; int i; for (i = 0; i < METHODS_COUNT; i++) { int j; - methodsDesc[i].method = (jmethodID)NULL; + methodsDesc[i].method = (jmethodID)nullptr; methodsDesc[i].compiled = NSK_FALSE; for (j = 0; j < MOMENTS_COUNT; j++) { methodsDesc[i].loadEvents[j] = 0; @@ -182,31 +182,31 @@ static int prepare() { } } - if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (threadFieldID = - jni->GetStaticFieldID(debugeeClass, THREAD_FIELD_NAME, THREAD_FIELD_SIG)) != NULL)) + jni->GetStaticFieldID(debugeeClass, THREAD_FIELD_NAME, THREAD_FIELD_SIG)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (thread = (jthread) - jni->GetStaticObjectField(debugeeClass, threadFieldID)) != NULL)) + jni->GetStaticObjectField(debugeeClass, threadFieldID)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (threadClass = jni->GetObjectClass(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (threadClass = jni->GetObjectClass(thread)) != nullptr)) return NSK_FALSE; NSK_DISPLAY0("Find tested methods:\n"); for (i = 0; i < METHODS_COUNT; i++) { if (!NSK_JNI_VERIFY(jni, (methodsDesc[i].method = - jni->GetMethodID(threadClass, methodsDesc[i].methodName, methodsDesc[i].methodSig)) != NULL)) + jni->GetMethodID(threadClass, methodsDesc[i].methodName, methodsDesc[i].methodSig)) != nullptr)) return NSK_FALSE; NSK_DISPLAY3(" method #%d (%s): 0x%p\n", i, methodsDesc[i].methodName, (void*)methodsDesc[i].method); } NSK_DISPLAY0("Enable events\n"); - if (!nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, eventsList, NULL)) + if (!nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, eventsList, nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -282,7 +282,7 @@ static int checkEvents() { */ static int clean() { NSK_DISPLAY0("Disable events\n"); - if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, eventsList, NULL)) + if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, eventsList, nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -383,7 +383,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; { @@ -403,7 +403,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM06/em06t001/em06t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM06/em06t001/em06t001.cpp index 87ad1da13f73..c1616e864edc 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM06/em06t001/em06t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM06/em06t001/em06t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,20 +23,20 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" +#include "JVMTITools.hpp" extern "C" { /* ============================================================================= */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; -static jrawMonitorID syncLock = NULL; +static jrawMonitorID syncLock = nullptr; /* constant names */ #define JVMTI_EVENT_COUNT (int)(JVMTI_MAX_EVENT_TYPE_VAL - JVMTI_MIN_EVENT_TYPE_VAL + 1) @@ -60,13 +60,13 @@ handler(jvmtiEvent event, jvmtiEnv* jvmti, JNIEnv* jni_env, jstring jclassName; const char *className; - if (!NSK_JNI_VERIFY(jni_env, (classObject = jni_env->GetObjectClass(klass)) != NULL)) { + if (!NSK_JNI_VERIFY(jni_env, (classObject = jni_env->GetObjectClass(klass)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } if (!NSK_JNI_VERIFY(jni_env, (methodID = - jni_env->GetMethodID(classObject, "getName", "()Ljava/lang/String;")) != NULL)) { + jni_env->GetMethodID(classObject, "getName", "()Ljava/lang/String;")) != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -75,7 +75,7 @@ handler(jvmtiEvent event, jvmtiEnv* jvmti, JNIEnv* jni_env, className = jni_env->GetStringUTFChars(jclassName, 0); - if (className != NULL && (strcmp(className, EXPECTED_CLASS_NAME) == 0)) { + if (className != nullptr && (strcmp(className, EXPECTED_CLASS_NAME) == 0)) { if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(syncLock))) nsk_jvmti_setFailStatus(); @@ -114,7 +114,7 @@ cbClassPrepare(jvmtiEnv* jvmti, JNIEnv* jni_env, jthread thread, jclass klass) { static int enableEvent(jvmtiEventMode enable, jvmtiEvent event) { - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(enable, event, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(enable, event, nullptr))) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -249,10 +249,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; classLoaderCount = nsk_jvmti_findOptionIntValue(CLASS_LOADER_COUNT_PARAM, 100); - if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM07/em07t001/em07t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM07/em07t001/em07t001.cpp index 4aa814611d99..d2f3a2fde3ca 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM07/em07t001/em07t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM07/em07t001/em07t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,10 +23,10 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -34,8 +34,8 @@ extern "C" { /* scaffold objects */ static jlong timeout = 0; -static jvmtiEnv *jvmti = NULL; -static jrawMonitorID syncLock = NULL; +static jvmtiEnv *jvmti = nullptr; +static jrawMonitorID syncLock = nullptr; /* constant names */ #define JVMTI_EVENT_COUNT (int)(JVMTI_MAX_EVENT_TYPE_VAL - JVMTI_MIN_EVENT_TYPE_VAL + 1) @@ -233,7 +233,7 @@ int enableOptionalEvents(jvmtiEnv *jvmti) { jvmtiEvent event = (jvmtiEvent)(i + JVMTI_MIN_EVENT_TYPE_VAL); if (nsk_jvmti_isOptionalEvent(event)) if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY, - jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) { + jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, nullptr))) { NSK_COMPLAIN1("Unexpected error enabling %s\n", TranslateEvent(event)); result = NSK_FALSE; @@ -355,7 +355,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; - if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_syncLock", &syncLock))) { @@ -373,7 +373,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM07/em07t002/em07t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM07/em07t002/em07t002.cpp index 2800ce8116bb..86d5f5de9f74 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM07/em07t002/em07t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM07/em07t002/em07t002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,26 +24,26 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" -#include "JVMTITools.h" -#include "nsk_list.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" +#include "JVMTITools.hpp" +#include "nsk_list.hpp" extern "C" { /* ============================================================================= */ /* scaffold objects */ -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; -static jrawMonitorID syncLock = NULL; +static jrawMonitorID syncLock = nullptr; static int methodLoadCount = 0; static int methodUnloadCount = 0; #define NAME_LENGTH 50 -const void *plist = NULL; +const void *plist = nullptr; static volatile int callbacksEnabled = NSK_TRUE; typedef struct nsk_jvmti_CompiledMethodIDStruct { @@ -109,7 +109,7 @@ cbCompiledMethodLoad(jvmtiEnv *jvmti_env, jmethodID method, jint code_size, if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)sign))) { nsk_jvmti_setFailStatus(); } - if (genc != NULL) + if (genc != nullptr) if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)genc))) { nsk_jvmti_setFailStatus(); } @@ -155,7 +155,7 @@ cbCompiledMethodUnload(jvmtiEnv *jvmti_env, jmethodID method, static int enableEvent(jvmtiEventMode enable, jvmtiEvent event) { - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(enable, event, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(enable, event, nullptr))) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -264,7 +264,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; - if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_syncLock", &syncLock))) { @@ -272,7 +272,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY((plist = (const void *)nsk_list_create()) != NULL)) + if (!NSK_VERIFY((plist = (const void *)nsk_list_create()) != nullptr)) return JNI_ERR; { @@ -293,7 +293,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/extension/EX03/ex03t001/ex03t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/extension/EX03/ex03t001/ex03t001.cpp index 810e1b1f47c8..e9325b6342c4 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/extension/EX03/ex03t001/ex03t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/extension/EX03/ex03t001/ex03t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,14 +23,14 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { -static JNIEnv *jni = NULL; -static jvmtiEnv* jvmti = NULL; +static JNIEnv *jni = nullptr; +static jvmtiEnv* jvmti = nullptr; static jlong timeout = 0; static jboolean eventEnabled = JNI_FALSE; static volatile jboolean eventReceived1 = JNI_FALSE, eventReceived2 = JNI_FALSE; @@ -42,7 +42,7 @@ static jrawMonitorID eventMon; static void JNICALL ClassUnload(jvmtiEnv* jvmti_env, ...) { - JNIEnv *jni_env = NULL; + JNIEnv *jni_env = nullptr; va_list ap; va_start(ap, jvmti_env); @@ -51,9 +51,9 @@ ClassUnload(jvmtiEnv* jvmti_env, ...) { va_end(ap); // The name argument should never be null - if (name == NULL) { + if (name == nullptr) { nsk_jvmti_setFailStatus(); - NSK_COMPLAIN0("ClassUnload: 'name' input parameter is NULL.\n"); + NSK_COMPLAIN0("ClassUnload: 'name' input parameter is null.\n"); } else { NSK_DISPLAY1("Class unloaded %s\n", name); } @@ -152,12 +152,12 @@ jboolean enableClassUnloadEvent (jboolean enable) { if (!NSK_JVMTI_VERIFY( jvmti->SetExtensionEventCallback(extList[i].extension_event_index, - enable ? (jvmtiExtensionEvent)ClassUnload : NULL))) { + enable ? (jvmtiExtensionEvent)ClassUnload : nullptr))) { nsk_jvmti_setFailStatus(); return JNI_FALSE; } if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(mode, (jvmtiEvent)extList[i].extension_event_index, NULL))) { + jvmti->SetEventNotificationMode(mode, (jvmtiEvent)extList[i].extension_event_index, nullptr))) { nsk_jvmti_setFailStatus(); return JNI_FALSE; } @@ -281,14 +281,14 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("eventMon", &eventMon))) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF01/gf01t001/gf01t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF01/gf01t001/gf01t001.cpp index 430f8b27160d..f8549ba4c87d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF01/gf01t001/gf01t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF01/gf01t001/gf01t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,11 +27,11 @@ #include #include -#include "agent_common.h" +#include "agent_common.hpp" -#include "nsk_tools.h" -#include "JVMTITools.h" -#include "jvmti_tools.h" +#include "nsk_tools.hpp" +#include "JVMTITools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -172,7 +172,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; NSK_DISPLAY0("setting event callbacks ...\n"); @@ -185,9 +185,9 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { NSK_DISPLAY0("setting event callbacks done\nenabling events ...\n"); - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, nullptr))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, nullptr))) return JNI_ERR; NSK_DISPLAY0("enabling events done\n\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF04/gf04t001/gf04t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF04/gf04t001/gf04t001.cpp index a2937f861559..2a0116d3e55e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF04/gf04t001/gf04t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF04/gf04t001/gf04t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,9 +24,9 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -36,7 +36,7 @@ extern "C" { /* ============================================================================= */ static jlong timeout = 0; -static const char* segment = NULL; +static const char* segment = nullptr; static const char* EXP_CLASS_SIGNATURE = "Lnsk/jvmti/scenarios/general_functions/GF04/gf04t001;"; static jrawMonitorID countLock; static jboolean classLoadReceived = JNI_FALSE, classPrepareReceived = JNI_FALSE; @@ -49,7 +49,7 @@ static jint result = PASSED; * @returns NSK_FALSE if any error occured. */ static int addSegment(jvmtiEnv* jvmti, const char segment[], const char where[]) { - void* storage = NULL; + void* storage = nullptr; NSK_DISPLAY1("Add segment: %s\n", segment); if (!NSK_JVMTI_VERIFY(jvmti->AddToBootstrapClassLoaderSearch(segment))) { @@ -97,7 +97,7 @@ ClassLoad(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thread, jclass klass) { sig); classLoadReceived = JNI_TRUE; - if (!NSK_JVMTI_VERIFY(jvmti_env->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_CLASS_LOAD, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_CLASS_LOAD, nullptr))) { result = STATUS_FAILED; } else { NSK_DISPLAY0("ClassLoad event disabled\n"); @@ -123,7 +123,7 @@ ClassPrepare(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thread, jclass klass) { sig); classPrepareReceived = JNI_TRUE; - if (!NSK_JVMTI_VERIFY(jvmti_env->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_CLASS_PREPARE, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_CLASS_PREPARE, nullptr))) { result = STATUS_FAILED; } else { NSK_DISPLAY0("ClassPrepare event disabled\n"); @@ -148,19 +148,19 @@ JNIEXPORT jint JNI_OnLoad_gf04t001(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; timeout = nsk_jvmti_getWaitTime() * 60 * 1000; - segment = nsk_jvmti_findOptionStringValue("segment", NULL); - if (!NSK_VERIFY(segment != NULL)) + segment = nsk_jvmti_findOptionStringValue("segment", nullptr); + if (!NSK_VERIFY(segment != nullptr)) return JNI_ERR; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("eventLock", &countLock))) @@ -186,12 +186,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { NSK_DISPLAY0(" ... set\n"); NSK_DISPLAY0("Enabling events: \n"); - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, nullptr))) { return JNI_ERR; } else { NSK_DISPLAY0(" ... ClassLoad enabled\n"); } - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_PREPARE, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_PREPARE, nullptr))) { return JNI_ERR; } else { NSK_DISPLAY0(" ... ClassPrepare enabled\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF06/gf06t001/gf06t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF06/gf06t001/gf06t001.cpp index 355f30c51c6a..55c5fb89816b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF06/gf06t001/gf06t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF06/gf06t001/gf06t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,9 +24,9 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -72,7 +72,7 @@ static void fillEnvStorage(StorageStructure* storage) { * @returns NSK_FALSE if any error occured. */ static int checkEnvStorage(jvmtiEnv* jvmti, const char where[]) { - void* storage = NULL; + void* storage = nullptr; NSK_DISPLAY0("Calling GetEnvironmentLocalStorage():"); if (!NSK_JVMTI_VERIFY(jvmti->GetEnvironmentLocalStorage(&storage))) { @@ -80,8 +80,8 @@ static int checkEnvStorage(jvmtiEnv* jvmti, const char where[]) { } NSK_DISPLAY1(" ... got storage: 0x%p\n", (void*)storage); - if (storage != NULL) { - NSK_COMPLAIN2("GetEnvironmentLocalStorage() returned NOT NULL storage in %s:\n" + if (storage != nullptr) { + NSK_COMPLAIN2("GetEnvironmentLocalStorage() returned NOT null storage in %s:\n" "# storage pointer: 0x%p\n", where, (void*)storage); return NSK_FALSE; @@ -134,7 +134,7 @@ callbackVMInit(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { } NSK_DISPLAY0("Set agentProc for second JVMTI env.\n"); - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) nsk_jvmti_setFailStatus(); } @@ -149,7 +149,7 @@ callbackVMDeath(jvmtiEnv* jvmti, JNIEnv* jni) { success = checkEnvStorage(jvmti, "VM_DEATH callback"); NSK_DISPLAY1("Disable events: %d events\n", EVENTS_COUNT); - if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, NULL)) { + if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, events, nullptr)) { success = NSK_FALSE; } else { NSK_DISPLAY0(" ... disabled\n"); @@ -177,7 +177,7 @@ JNIEXPORT jint JNI_OnLoad_gf06t001(JavaVM *jvm, char *options, void *reserved) { #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - jvmtiEnv* jvmti_1 = NULL; + jvmtiEnv* jvmti_1 = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -199,7 +199,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* Create second environment */ if (!NSK_VERIFY((jvmti_2 = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* Set callbacks for second environment */ @@ -226,7 +226,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } NSK_DISPLAY1("Enable events: %d events\n", EVENTS_COUNT); - if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, NULL)) { + if (nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, events, nullptr)) { NSK_DISPLAY0(" ... enabled\n"); } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF08/gf08t001/gf08t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF08/gf08t001/gf08t001.cpp index d5d830e6d9bb..3d84b69adca5 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF08/gf08t001/gf08t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF08/gf08t001/gf08t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -37,7 +37,7 @@ static jlong timeout = 0; /* test objects */ static jrawMonitorID access_lock; static jvmtiPhase phase; -static const char* setVerboseMode = NULL; +static const char* setVerboseMode = nullptr; /* ========================================================================== */ @@ -54,7 +54,7 @@ JNIEXPORT jint JNI_OnLoad_gf08t001(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv *jvmti = NULL; + jvmtiEnv *jvmti = nullptr; /* init framework and parse options */ if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) @@ -64,10 +64,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - setVerboseMode = nsk_jvmti_findOptionStringValue("setVerboseMode", NULL); + setVerboseMode = nsk_jvmti_findOptionStringValue("setVerboseMode", nullptr); if (strcmp(setVerboseMode, "y") == 0 || strcmp(setVerboseMode, "yes") == 0) { if (!NSK_JVMTI_VERIFY(jvmti->SetVerboseFlag(JVMTI_VERBOSE_GC, JNI_TRUE))) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF08/gf08t002/gf08t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF08/gf08t002/gf08t002.cpp index 4b2455a4f466..db242bd71229 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF08/gf08t002/gf08t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF08/gf08t002/gf08t002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -37,7 +37,7 @@ static jlong timeout = 0; /* test objects */ static jrawMonitorID access_lock; static jvmtiPhase phase; -static const char* setVerboseMode = NULL; +static const char* setVerboseMode = nullptr; /* ========================================================================== */ @@ -54,7 +54,7 @@ JNIEXPORT jint JNI_OnLoad_gf08t002(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv *jvmti = NULL; + jvmtiEnv *jvmti = nullptr; /* init framework and parse options */ if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) @@ -64,10 +64,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - setVerboseMode = nsk_jvmti_findOptionStringValue("setVerboseMode", NULL); + setVerboseMode = nsk_jvmti_findOptionStringValue("setVerboseMode", nullptr); if (strcmp(setVerboseMode, "y") == 0 || strcmp(setVerboseMode, "yes") == 0) { if (!NSK_JVMTI_VERIFY(jvmti->SetVerboseFlag(JVMTI_VERBOSE_CLASS, JNI_TRUE))) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF08/gf08t003/gf08t003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF08/gf08t003/gf08t003.cpp index ee6e7bf9f73d..54b73e891b05 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF08/gf08t003/gf08t003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF08/gf08t003/gf08t003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -37,7 +37,7 @@ static jlong timeout = 0; /* test objects */ static jrawMonitorID access_lock; static jvmtiPhase phase; -static const char* setVerboseMode = NULL; +static const char* setVerboseMode = nullptr; /* ========================================================================== */ @@ -54,7 +54,7 @@ JNIEXPORT jint JNI_OnLoad_gf08t003(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv *jvmti = NULL; + jvmtiEnv *jvmti = nullptr; /* init framework and parse options */ if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) @@ -64,10 +64,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - setVerboseMode = nsk_jvmti_findOptionStringValue("setVerboseMode", NULL); + setVerboseMode = nsk_jvmti_findOptionStringValue("setVerboseMode", nullptr); if (strcmp(setVerboseMode, "y") == 0 || strcmp(setVerboseMode, "yes") == 0) { if (!NSK_JVMTI_VERIFY(jvmti->SetVerboseFlag(JVMTI_VERBOSE_JNI, JNI_TRUE))) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS103/hs103t002/hs103t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS103/hs103t002/hs103t002.cpp index 634a4d351faa..4a5de9ea92ee 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS103/hs103t002/hs103t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS103/hs103t002/hs103t002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, 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,11 +27,11 @@ */ #include #include -#include "agent_common.h" +#include "agent_common.hpp" #include -#include "jni_tools.h" -#include "jvmti_tools.h" -#include "JVMTITools.h" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -57,13 +57,13 @@ JNIEXPORT void JNICALL doRedefineInNativeThread(jvmtiEnv * jvmti, testClass = jni->FindClass(MAIN_CLASS); if (!NSK_JNI_VERIFY(jni, ( - setRedefinitionFailed = jni->GetStaticMethodID(testClass, "setRedefinitionFailed", "()V")) != NULL)) + setRedefinitionFailed = jni->GetStaticMethodID(testClass, "setRedefinitionFailed", "()V")) != nullptr)) { jni->FatalError("TEST FAILED: while getting setRedefinitionFailed()\n"); } if (!NSK_JNI_VERIFY(jni, ( - setRedefinitionDone = jni->GetStaticMethodID(testClass, "setRedefinitionDone", "()V")) != NULL)) + setRedefinitionDone = jni->GetStaticMethodID(testClass, "setRedefinitionDone", "()V")) != nullptr)) { jni->FatalError("TEST FAILED: while getting setRedefinitionDone()\n"); } @@ -142,14 +142,14 @@ Java_nsk_jvmti_scenarios_hotswap_HS103_hs103t002_hs103t002_startAgentThread(JNIE name = jni->NewStringUTF(threadName); clas = jni->FindClass("java/lang/Thread"); - if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(clas, "", "(Ljava/lang/String;)V")) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(clas, "", "(Ljava/lang/String;)V")) != nullptr)) { jni->FatalError("failed to get ID for the java method\n"); } thread = (jthread) jni->NewObject(clas,method,name); testAgentThread = jni->NewGlobalRef(thread); err = JVMTI_ERROR_NONE; - err = jvmti->RunAgentThread(testAgentThread, &doRedefineInNativeThread, NULL, + err = jvmti->RunAgentThread(testAgentThread, &doRedefineInNativeThread, nullptr, JVMTI_THREAD_NORM_PRIORITY); if (err == JVMTI_ERROR_INVALID_PRIORITY) { nsk_printf(" JVMTI_ERROR_INVALID_PRIORITY ..\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS104/hs104t001/hs104t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS104/hs104t001/hs104t001.cpp index 72987808f3ee..1dc0396299a7 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS104/hs104t001/hs104t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS104/hs104t001/hs104t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,10 +22,10 @@ */ #include #include -#include "agent_common.h" +#include "agent_common.hpp" #include -#include "jvmti_tools.h" -#include "JVMTITools.h" +#include "jvmti_tools.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -48,7 +48,7 @@ JNIEXPORT void JNICALL sizeof(fileName)/sizeof(char)); if (nsk_jvmti_redefineClass(jvmti, klass, fileName)) { nsk_printf("Agent:: Successfully redefined.."); - if (nsk_jvmti_disableNotification(jvmti,JVMTI_EVENT_CLASS_PREPARE, NULL)) { + if (nsk_jvmti_disableNotification(jvmti,JVMTI_EVENT_CLASS_PREPARE, nullptr)) { nsk_printf(" Agent :: NOTIFICATIONS ARE DISABLED \n"); } else { nsk_printf(" Agent :: Failed to disabled \n"); @@ -96,7 +96,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { nsk_printf(" Agent:: Error occured while setting event call back \n"); return JNI_ERR; } - if (nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, NULL)) { + if (nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, nullptr)) { nsk_printf("Agent :: NOTIFICATIONS ARE ENABLED \n"); } else { nsk_printf(" Error in Eanableing Notifications.."); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS104/hs104t002/hs104t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS104/hs104t002/hs104t002.cpp index 5f107e31b901..f83a51fa33f4 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS104/hs104t002/hs104t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS104/hs104t002/hs104t002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,11 +22,11 @@ */ #include #include -#include "agent_common.h" +#include "agent_common.hpp" #include -#include "jvmti_tools.h" -#include "JVMTITools.h" -#include "jni_tools.h" +#include "jvmti_tools.hpp" +#include "JVMTITools.hpp" +#include "jni_tools.hpp" extern "C" { @@ -74,7 +74,7 @@ Java_nsk_jvmti_scenarios_hotswap_HS104_hs104t002_hs104t002_redefineClasses( jclass cla; char fileName[512]; - if (!NSK_JNI_VERIFY(jni, (cla = jni->FindClass(SEARCH_NAME)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (cla = jni->FindClass(SEARCH_NAME)) != nullptr)) { nsk_printf(" Agent :: Failed to get class.\n"); nsk_jvmti_agentFailed(); return; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t001/hs201t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t001/hs201t001.cpp index 5883c17f5b47..ee5110638262 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t001/hs201t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t001/hs201t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,17 +23,17 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { /* ============================================================================= */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* constant names */ @@ -64,7 +64,7 @@ void setCurrentStep(JNIEnv* jni_env, int value) { jfieldID fld; if (!NSK_JNI_VERIFY(jni_env, (fld = - jni_env->GetStaticFieldID(testClass, "currentStep", "I")) != NULL)) { + jni_env->GetStaticFieldID(testClass, "currentStep", "I")) != nullptr)) { jni_env->FatalError("TEST FAILED: while getting currentStep fieldID\n"); } @@ -102,7 +102,7 @@ void redefineClass(jvmtiEnv *jvmti_env, jclass klass) { char *className; - if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &className, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &className, nullptr))) { nsk_jvmti_setFailStatus(); return; } @@ -165,7 +165,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* agentJNI, void* arg) { void setBreakPoint(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jclass klass) { jmethodID mid; - if (!NSK_JNI_VERIFY(jni_env, (mid = jni_env->GetMethodID(klass, METHOD_NAME, METHOD_SIG)) != NULL)) + if (!NSK_JNI_VERIFY(jni_env, (mid = jni_env->GetMethodID(klass, METHOD_NAME, METHOD_SIG)) != nullptr)) jni_env->FatalError("[agent] failed to get ID for the java method\n"); if (!NSK_JVMTI_VERIFY(jvmti_env->SetBreakpoint(mid, 1))) @@ -200,7 +200,7 @@ callbackClassLoad(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, nsk_jvmti_setFailStatus(); } - if (generic != NULL) + if (generic != nullptr) if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)generic))) { nsk_jvmti_setFailStatus(); } @@ -232,7 +232,7 @@ callbackSingleStep(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, char *methodName; - if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &methodName, NULL, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &methodName, nullptr, nullptr))) { NSK_COMPLAIN0("TEST FAILED: unable to get method name during Breakpoint callback\n\n"); } @@ -244,7 +244,7 @@ callbackSingleStep(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, NSK_COMPLAIN0("TEST FAILED: unable to get method name during Breakpoint callback\n\n"); } - if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(declaringClass, &declaringClassName, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(declaringClass, &declaringClassName, nullptr))) { NSK_COMPLAIN0("TEST FAILED: unable to get method name during Breakpoint callback\n\n"); } @@ -335,7 +335,7 @@ callbackException(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, className, getThreadName(jni_env, thread)); testStep++; - if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(exception)) != NULL)) { + if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(exception)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -366,7 +366,7 @@ callbackExceptionCatch(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, className, getThreadName(jni_env, thread)); testStep++; - if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(exception)) != NULL)) { + if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(exception)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -397,7 +397,7 @@ int readNewBytecode(jvmtiEnv* jvmti, int testcase) { filename); bytecode = fopen(filename, "rb"); - if (bytecode == NULL) { + if (bytecode == nullptr) { NSK_COMPLAIN0("TEST FAILED: error opening file\n"); return NSK_FALSE; } @@ -430,13 +430,13 @@ const char* getThreadName(JNIEnv* jni_env, jthread thread) { strcpy(chbuffer, ""); - if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(thread)) != NULL)) { + if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(thread)) != nullptr)) { nsk_jvmti_setFailStatus(); return chbuffer; } if (!NSK_JNI_VERIFY(jni_env, (methodID = - jni_env->GetMethodID(klass, "getName", "()Ljava/lang/String;")) != NULL)) { + jni_env->GetMethodID(klass, "getName", "()Ljava/lang/String;")) != nullptr)) { nsk_jvmti_setFailStatus(); return chbuffer; } @@ -462,7 +462,7 @@ const char* getClassName(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jobject object) { strcpy(chbuffer, ""); - if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(object)) != NULL)) { + if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(object)) != nullptr)) { nsk_jvmti_setFailStatus(); return chbuffer; } @@ -478,7 +478,7 @@ const char* getClassName(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jobject object) { nsk_jvmti_setFailStatus(); } - if (generic != NULL) + if (generic != nullptr) if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)generic))) { nsk_jvmti_setFailStatus(); } @@ -491,7 +491,7 @@ const char* getClassName(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jobject object) { int getLocalVariableValue(jvmtiEnv *jvmti_env, jthread thread, jmethodID method) { - jvmtiLocalVariableEntry *table = NULL; + jvmtiLocalVariableEntry *table = nullptr; jint entryCount = 0; int i; jint value = -1; @@ -501,7 +501,7 @@ int getLocalVariableValue(jvmtiEnv *jvmti_env, jthread thread, NSK_COMPLAIN0("TEST FAILED: unable to get local variable table\n\n"); } - if (table != NULL) { + if (table != nullptr) { jvmtiError error; for (i = 0; i < entryCount; i++) { @@ -540,10 +540,10 @@ JNIEXPORT void JNICALL Java_nsk_jvmti_scenarios_hotswap_HS201_hs201t001_setThread(JNIEnv *env, jclass cls, jthread thread) { - if (!NSK_JNI_VERIFY(env, (testClass = (jclass) env->NewGlobalRef(cls)) != NULL)) + if (!NSK_JNI_VERIFY(env, (testClass = (jclass) env->NewGlobalRef(cls)) != nullptr)) nsk_jvmti_setFailStatus(); - if (!NSK_JNI_VERIFY(env, (testedThread = env->NewGlobalRef(thread)) != NULL)) + if (!NSK_JNI_VERIFY(env, (testedThread = env->NewGlobalRef(thread)) != nullptr)) nsk_jvmti_setFailStatus(); } @@ -632,7 +632,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; { @@ -670,7 +670,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { enableEvent(jvmti, JVMTI_EVENT_EXCEPTION, testedThread); enableEvent(jvmti, JVMTI_EVENT_EXCEPTION_CATCH, testedThread); - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t002/hs201t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t002/hs201t002.cpp index 43cd4463139e..62033fde30b4 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t002/hs201t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t002/hs201t002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,17 +23,17 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { /* ============================================================================= */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* constant names */ @@ -66,7 +66,7 @@ void setCurrentStep(JNIEnv* jni_env, int value) { jfieldID fld; if (!NSK_JNI_VERIFY(jni_env, (fld = - jni_env->GetStaticFieldID(testClass, "currentStep", "I")) != NULL)) { + jni_env->GetStaticFieldID(testClass, "currentStep", "I")) != nullptr)) { jni_env->FatalError("TEST FAILED: while getting currentStep fieldID\n"); } @@ -105,7 +105,7 @@ void redefineClass(jvmtiEnv *jvmti_env, jclass klass) { jint newClassSize; unsigned char* newClassBytes; - if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &className, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &className, nullptr))) { nsk_jvmti_setFailStatus(); return; } @@ -170,7 +170,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* agentJNI, void* arg) { void setBreakPoint(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jclass klass) { jmethodID mid; - if (!NSK_JNI_VERIFY(jni_env, (mid = jni_env->GetMethodID(klass, METHOD_NAME, METHOD_SIG)) != NULL)) + if (!NSK_JNI_VERIFY(jni_env, (mid = jni_env->GetMethodID(klass, METHOD_NAME, METHOD_SIG)) != nullptr)) jni_env->FatalError("[agent] failed to get ID for the java method\n"); if (!NSK_JVMTI_VERIFY(jvmti_env->SetBreakpoint(mid, 1))) @@ -189,7 +189,7 @@ callbackClassLoad(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, char *className; - if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &className, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &className, nullptr))) { nsk_jvmti_setFailStatus(); return; } @@ -230,7 +230,7 @@ callbackSingleStep(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, char *methodName; - if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &methodName, NULL, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &methodName, nullptr, nullptr))) { NSK_COMPLAIN0("TEST FAILED: unable to get method name during Breakpoint callback\n\n"); } @@ -242,7 +242,7 @@ callbackSingleStep(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, NSK_COMPLAIN0("TEST FAILED: unable to get method name during Breakpoint callback\n\n"); } - if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(declaringClass, &declaringClassName, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(declaringClass, &declaringClassName, nullptr))) { NSK_COMPLAIN0("TEST FAILED: unable to get method name during Breakpoint callback\n\n"); } @@ -347,19 +347,19 @@ void handleException(bool isCatch, jobject exception) { const char* className = getClassName(jvmti_env, jni_env, exception); - if (className != NULL && strcmp(EXPECTED_CLASS_SIGN, className) == 0) { + if (className != nullptr && strcmp(EXPECTED_CLASS_SIGN, className) == 0) { jclass klass; const char* threadName = getThreadName(jvmti_env, jni_env, thread); NSK_DISPLAY3(">>>> %s %s in thread - %s\n", isCatch ? "Caught exception" : "Exception", - className, threadName != NULL ? threadName : "NULL"); + className, threadName != nullptr ? threadName : "null"); jvmti->Deallocate((unsigned char*)className); - if (threadName != NULL) { + if (threadName != nullptr) { jvmti->Deallocate((unsigned char*)threadName); } testStep++; - if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(exception)) != NULL)) { + if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(exception)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -390,7 +390,7 @@ int readNewBytecode(jvmtiEnv* jvmti, jint *newClassSize, unsigned char* *newClas filename); bytecode = fopen(filename, "rb"); - if (bytecode == NULL) { + if (bytecode == nullptr) { NSK_COMPLAIN0("TEST FAILED: error opening file\n"); return NSK_FALSE; } @@ -408,7 +408,7 @@ int readNewBytecode(jvmtiEnv* jvmti, jint *newClassSize, unsigned char* *newClas if (read_bytes != *newClassSize) { NSK_COMPLAIN0("TEST FAILED: error reading file\n"); jvmti->Deallocate(*newClassBytes); - *newClassBytes = NULL; + *newClassBytes = nullptr; return NSK_FALSE; } @@ -422,18 +422,18 @@ const char* getThreadName(jvmtiEnv* jvmti_env, JNIEnv* jni_env, jthread thread) jclass klass; jstring jthreadName; jsize jthreadNameLen; - unsigned char *result = NULL; + unsigned char *result = nullptr; const char *threadName; - if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(thread)) != NULL)) { + if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(thread)) != nullptr)) { nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } if (!NSK_JNI_VERIFY(jni_env, (methodID = - jni_env->GetMethodID(klass, "getName", "()Ljava/lang/String;")) != NULL)) { + jni_env->GetMethodID(klass, "getName", "()Ljava/lang/String;")) != nullptr)) { nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } jthreadName = (jstring) jni_env->CallObjectMethod(thread, methodID); @@ -442,7 +442,7 @@ const char* getThreadName(jvmtiEnv* jvmti_env, JNIEnv* jni_env, jthread thread) if (!NSK_JVMTI_VERIFY(jvmti_env->Allocate(jthreadNameLen + 1, &result))) { NSK_COMPLAIN0("buffer couldn't be allocated\n"); - return NULL; + return nullptr; } threadName = jni_env->GetStringUTFChars(jthreadName, 0); @@ -461,14 +461,14 @@ const char* getClassName(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jobject object) { char *className; jclass klass; - if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(object)) != NULL)) { + if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(object)) != nullptr)) { nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } - if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &className, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &className, nullptr))) { nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } return className; @@ -479,7 +479,7 @@ const char* getClassName(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jobject object) { int getLocalVariableValue(jvmtiEnv *jvmti_env, jthread thread, jmethodID method) { - jvmtiLocalVariableEntry *table = NULL; + jvmtiLocalVariableEntry *table = nullptr; jint entryCount = 0; int i; jint value = -1; @@ -489,7 +489,7 @@ int getLocalVariableValue(jvmtiEnv *jvmti_env, jthread thread, NSK_COMPLAIN0("TEST FAILED: unable to get local variable table\n\n"); } - if (table != NULL) { + if (table != nullptr) { jvmtiError error; for (i = 0; i < entryCount; i++) { @@ -528,10 +528,10 @@ JNIEXPORT void JNICALL Java_nsk_jvmti_scenarios_hotswap_HS201_hs201t002_setThread(JNIEnv *env, jclass cls, jthread thread) { - if (!NSK_JNI_VERIFY(env, (testClass = (jclass) env->NewGlobalRef(cls)) != NULL)) + if (!NSK_JNI_VERIFY(env, (testClass = (jclass) env->NewGlobalRef(cls)) != nullptr)) nsk_jvmti_setFailStatus(); - if (!NSK_JNI_VERIFY(env, (testedThread = env->NewGlobalRef(thread)) != NULL)) + if (!NSK_JNI_VERIFY(env, (testedThread = env->NewGlobalRef(thread)) != nullptr)) nsk_jvmti_setFailStatus(); enableEvent(jvmti, JVMTI_EVENT_CLASS_LOAD, testedThread); @@ -624,7 +624,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; { @@ -657,7 +657,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { NSK_DISPLAY0("Enable events\n"); - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t003/hs201t003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t003/hs201t003.cpp index 97b247a3d626..6c6caa033c34 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t003/hs201t003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t003/hs201t003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,12 +25,12 @@ #include #include -#include "agent_common.h" +#include "agent_common.hpp" -#include "nsk_tools.h" -#include "native_thread.h" -#include "JVMTITools.h" -#include "jvmti_tools.h" +#include "nsk_tools.hpp" +#include "native_thread.hpp" +#include "JVMTITools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -50,7 +50,7 @@ static jvmtiEvent eventsList[EVENTS_COUNT] = { JVMTI_EVENT_FRAME_POP }; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; static jint bytesCount; /* number of bytes of a redefining class */ @@ -74,7 +74,7 @@ static int expectedMeth(jvmtiEnv *jvmti_env, const char *event, char *sig; int methFound = 0; - if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &sig, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &sig, nullptr))) { nsk_jvmti_setFailStatus(); return 0; } @@ -107,7 +107,7 @@ static void doHotSwap(jvmtiEnv *jvmti_env, nsk_jvmti_setFailStatus(); return; } - if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(decl_cls, &cls_sig, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(decl_cls, &cls_sig, nullptr))) { nsk_jvmti_setFailStatus(); return; } @@ -143,7 +143,7 @@ static void doChecks(jvmtiEnv *jvmti_env, jint methBytesCount; /* number of bytes of a method */ unsigned char *methBytes; /* bytes defining a method */ - if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(tMethodID, &name, &sig, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(tMethodID, &name, &sig, nullptr))) { nsk_jvmti_setFailStatus(); return; } @@ -196,7 +196,7 @@ void JNICALL MethodEntry(jvmtiEnv *jvmti_env, JNIEnv *env, nsk_jvmti_setFailStatus(); } - if (!NSK_JVMTI_VERIFY(jvmti_env->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_METHOD_ENTRY, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti_env->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_METHOD_ENTRY, nullptr))) nsk_jvmti_setFailStatus(); } } @@ -298,7 +298,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add required capabilities */ @@ -324,13 +324,13 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { NSK_DISPLAY0("setting event callbacks done\nenabling events ...\n"); if (!nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, - eventsList, NULL)) + eventsList, nullptr)) return JNI_ERR; NSK_DISPLAY0("enabling the events done\n\n"); /* register agent proc */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS202/hs202t001/hs202t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS202/hs202t001/hs202t001.cpp index 6b284a54bbc6..e3f15e233fb2 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS202/hs202t001/hs202t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS202/hs202t001/hs202t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,10 +22,10 @@ */ #include #include -#include "agent_common.h" +#include "agent_common.hpp" #include -#include "jvmti_tools.h" -#include "JVMTITools.h" +#include "jvmti_tools.hpp" +#include "JVMTITools.hpp" /* hs202t001: 1. Set breakpoints in several methods when Object.wait(), @@ -56,7 +56,7 @@ JNIEXPORT void JNICALL callbackClassPrepare(jvmtiEnv *jvmti, if (strcmp(className,CLASS_NAME) == 0) { jmethodID method; method = jni->GetMethodID(klass, METHOD_NAME, METHOD_SIGN); - if (method == NULL) { + if (method == nullptr) { nsk_printf("Agent:: Method is null "); } else { jlocation start; @@ -73,7 +73,7 @@ JNIEXPORT void JNICALL callbackClassPrepare(jvmtiEnv *jvmti, nsk_printf(" ## Error occured %s \n",TranslateError(err)); } else { nsk_printf(" NO ERRORS "); - if (nsk_jvmti_enableNotification(jvmti,JVMTI_EVENT_BREAKPOINT, NULL)) { + if (nsk_jvmti_enableNotification(jvmti,JVMTI_EVENT_BREAKPOINT, nullptr)) { nsk_printf(" Enabled.. notification event ..\n"); } } @@ -116,11 +116,11 @@ void JNICALL callbackBreakpoint(jvmtiEnv *jvmti_env, jlocation location) { jvmtiError err; err = JVMTI_ERROR_NONE; - if (nsk_jvmti_enableNotification(jvmti,JVMTI_EVENT_SINGLE_STEP, NULL)) { + if (nsk_jvmti_enableNotification(jvmti,JVMTI_EVENT_SINGLE_STEP, nullptr)) { nsk_printf(" Enabled.. notification event .."); } err= jvmti->SetEventNotificationMode(JVMTI_DISABLE, - JVMTI_EVENT_BREAKPOINT, NULL); + JVMTI_EVENT_BREAKPOINT, nullptr); if (err == JVMTI_ERROR_NONE) { nsk_printf(" Disabled notification.."); } @@ -172,7 +172,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { nsk_printf(" ## Error occured %s \n",TranslateError(rc)); return JNI_ERR; } - if (nsk_jvmti_enableNotification(jvmti,JVMTI_EVENT_CLASS_PREPARE, NULL)) { + if (nsk_jvmti_enableNotification(jvmti,JVMTI_EVENT_CLASS_PREPARE, nullptr)) { nsk_printf("Agent :: NOTIFICATIONS ARE ENABLED \n"); } else { nsk_printf(" Error in Eanableing Notifications.."); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS202/hs202t002/hs202t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS202/hs202t002/hs202t002.cpp index 12f4cc3fb4e2..f081ff0f030b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS202/hs202t002/hs202t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS202/hs202t002/hs202t002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,11 +22,11 @@ */ #include #include -#include "agent_common.h" +#include "agent_common.hpp" #include #include -#include "jvmti_tools.h" -#include "JVMTITools.h" +#include "jvmti_tools.hpp" +#include "JVMTITools.hpp" /* hs202t002: @@ -41,7 +41,7 @@ extern "C" { #define METHOD_NAME "display" static jint redefineNumber = 0; -static jvmtiEnv * jvmti = NULL; +static jvmtiEnv * jvmti = nullptr; static volatile bool thread_suspend_error = false; @@ -119,7 +119,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { nsk_printf(" Agent:: Error occured while setting event callbacks \n"); return JNI_ERR; } - if (nsk_jvmti_enableNotification(jvmti,JVMTI_EVENT_METHOD_EXIT, NULL)) { + if (nsk_jvmti_enableNotification(jvmti,JVMTI_EVENT_METHOD_EXIT, nullptr)) { nsk_printf(" Agent :: NOTIFICATIONS ARE ENABLED \n"); } else { nsk_printf(" Agent :: Error Enabling Notifications.."); @@ -160,7 +160,7 @@ Java_nsk_jvmti_scenarios_hotswap_HS202_hs202t002_hs202t002_resumeThread(JNIEnv * // disable notifications before resuming thread // to avoid recursion on PopFrame issued reinvoke - if (nsk_jvmti_disableNotification(jvmti,JVMTI_EVENT_METHOD_EXIT, NULL)) { + if (nsk_jvmti_disableNotification(jvmti,JVMTI_EVENT_METHOD_EXIT, nullptr)) { nsk_printf("Agent :: nsk_jvmti_disabled notifications..\n"); } else { nsk_printf("Agent :: Failed to disable notifications.."); @@ -194,7 +194,7 @@ Java_nsk_jvmti_scenarios_hotswap_HS202_hs202t002_hs202t002_isThreadSuspended(JNI // this again until we see thread_suspend_error is true. jint state = 0; - // No errors possible here: thread is valid, and state is not NULL + // No errors possible here: thread is valid, and state is not nullptr jvmti->GetThreadState(thread, &state); return (state & JVMTI_THREAD_STATE_SUSPENDED) != 0; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t001/hs203t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t001/hs203t001.cpp index 2e95e5e7e70c..467d6cf01cbc 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t001/hs203t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t001/hs203t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, 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,10 +23,10 @@ #include #include #include -#include "agent_common.h" +#include "agent_common.hpp" #include -#include "jvmti_tools.h" -#include "JVMTITools.h" +#include "jvmti_tools.hpp" +#include "JVMTITools.hpp" /* README ****** @@ -63,7 +63,7 @@ JNIEXPORT void JNICALL if (strcmp(className,CLASS_NAME) == 0) { jmethodID method; method = jni->GetMethodID(klass,METHOD_NAME,METHOD_SIGN); - if (method != NULL) { + if (method != nullptr) { jlocation start; jlocation end; jvmtiError err ; @@ -166,8 +166,8 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { nsk_printf(" Agent:: Error occured while setting event call back \n"); return JNI_ERR; } - if (nsk_jvmti_enableNotification(jvmti,JVMTI_EVENT_CLASS_LOAD, NULL) && - nsk_jvmti_enableNotification(jvmti,JVMTI_EVENT_BREAKPOINT,NULL)) { + if (nsk_jvmti_enableNotification(jvmti,JVMTI_EVENT_CLASS_LOAD, nullptr) && + nsk_jvmti_enableNotification(jvmti,JVMTI_EVENT_BREAKPOINT,nullptr)) { nsk_printf("Agent :: NOTIFICATIONS ARE ENABLED \n"); } else { nsk_printf(" Error in Eanableing Notifications.."); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t002/hs203t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t002/hs203t002.cpp index b1b3b42164f4..d263186114ee 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t002/hs203t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t002/hs203t002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,11 +22,11 @@ */ #include #include -#include "agent_common.h" +#include "agent_common.hpp" #include #include -#include "jvmti_tools.h" -#include "JVMTITools.h" +#include "jvmti_tools.hpp" +#include "JVMTITools.hpp" /* T002: @@ -65,7 +65,7 @@ callbackClassLoad(jvmtiEnv *jvmti, if (strcmp(className,CLASS_NAME) == 0) { jmethodID method; method = jni->GetMethodID(klass,METHOD_NAME,METHOD_SIGN); - if (method != NULL) { + if (method != nullptr) { jlocation start; jlocation end; jvmtiError err ; @@ -168,8 +168,8 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { nsk_printf(" Agent:: Error occured while setting event call back \n"); return JNI_ERR; } - if (nsk_jvmti_enableNotification(jvmti,JVMTI_EVENT_CLASS_LOAD, NULL) && - nsk_jvmti_enableNotification(jvmti,JVMTI_EVENT_BREAKPOINT, NULL)) { + if (nsk_jvmti_enableNotification(jvmti,JVMTI_EVENT_CLASS_LOAD, nullptr) && + nsk_jvmti_enableNotification(jvmti,JVMTI_EVENT_BREAKPOINT, nullptr)) { nsk_printf("Agent :: NOTIFICATIONS ARE ENABLED \n"); } else { nsk_printf(" Error in Eanableing Notifications.."); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t003/hs203t003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t003/hs203t003.cpp index a162fa0270c9..7c59a16a5359 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t003/hs203t003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t003/hs203t003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, 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,12 +23,12 @@ #include #include #include -#include "agent_common.h" +#include "agent_common.hpp" #include #include -#include "jvmti_tools.h" -#include "jni_tools.h" -#include "JVMTITools.h" +#include "jvmti_tools.hpp" +#include "jni_tools.hpp" +#include "JVMTITools.hpp" /* hs203T003: 1. Set FieldAccessWatch, FieldModificatoinWatch for a field. @@ -58,8 +58,8 @@ JNIEXPORT void JNICALL callbackClassPrepare(jvmtiEnv *jvmti_env, char * className; char * generic; redefineNumber=0; - className=NULL; - generic=NULL; + className=nullptr; + generic=nullptr; if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &className, &generic))) { nsk_printf("#error Agent :: while getting classname Signature.\n"); nsk_jvmti_agentFailed(); @@ -67,7 +67,7 @@ JNIEXPORT void JNICALL callbackClassPrepare(jvmtiEnv *jvmti_env, if (strcmp(className,CLASS_NAME) == 0) { jfieldID field; /* get the field id and set watch on that .*/ - if (!NSK_JNI_VERIFY(jni, (field = jni->GetFieldID(klass, FIELDNAME, TYPE)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (field = jni->GetFieldID(klass, FIELDNAME, TYPE)) != nullptr)) { nsk_printf(" Agent :: (*JNI)->GetFieldID(jni, ...) returns `null`.\n"); nsk_jvmti_agentFailed(); } else if (!NSK_JVMTI_VERIFY(jvmti_env->SetFieldAccessWatch(klass, field))) { @@ -93,7 +93,7 @@ JNIEXPORT void JNICALL callbackFieldAccess(jvmtiEnv *jvmti_env, return; } redefineNumber=0; - if (!NSK_JNI_VERIFY(jni, (clas = jni->FindClass(SEARCH_NAME)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (clas = jni->FindClass(SEARCH_NAME)) != nullptr)) { nsk_printf(" Agent :: (*JNI)->FindClass(jni, %s) returns `null`.\n",SEARCH_NAME); nsk_jvmti_agentFailed(); } else { @@ -155,8 +155,8 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { nsk_printf("#error Agent :: while setting event callbacks.\n"); return JNI_ERR; } - if (nsk_jvmti_enableNotification(jvmti,JVMTI_EVENT_CLASS_PREPARE, NULL) && - nsk_jvmti_enableNotification(jvmti,JVMTI_EVENT_FIELD_ACCESS, NULL)) { + if (nsk_jvmti_enableNotification(jvmti,JVMTI_EVENT_CLASS_PREPARE, nullptr) && + nsk_jvmti_enableNotification(jvmti,JVMTI_EVENT_FIELD_ACCESS, nullptr)) { nsk_printf(" Agent :: Notifications are enabled.\n"); } else { nsk_printf("#error Agent :: Eanableing Notifications.\n"); @@ -202,7 +202,7 @@ Java_nsk_jvmti_scenarios_hotswap_HS203_hs203t003_hs203t003_popThreadFrame(JNIEnv } else { nsk_printf(" Agent :: poped thread frame.\n"); if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_FIELD_ACCESS, NULL))) { + jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_FIELD_ACCESS, nullptr))) { nsk_printf("#error Agent :: failed to disable notification JVMTI_EVENT_FIELD ACCESS.\n"); nsk_jvmti_agentFailed(); } else { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t004/hs203t004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t004/hs203t004.cpp index e29d7563d434..a2023f7f546c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t004/hs203t004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t004/hs203t004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, 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,12 +23,12 @@ #include #include #include -#include "agent_common.h" +#include "agent_common.hpp" #include #include -#include "jvmti_tools.h" -#include "JVMTITools.h" -#include "jni_tools.h" +#include "jvmti_tools.hpp" +#include "JVMTITools.hpp" +#include "jni_tools.hpp" extern "C" { #define FILE_NAME "nsk/jvmti/scenarios/hotswap/HS203/hs203t004/MyThread" @@ -43,14 +43,14 @@ JNIEXPORT void JNICALL callbackClassPrepare(jvmtiEnv *jvmti_env, jthread thread, jclass klass) { char * className; - className=NULL; + className=nullptr; - if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &className, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &className, nullptr))) { 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)) { + if (nsk_jvmti_enableNotification(jvmti_env, JVMTI_EVENT_COMPILED_METHOD_LOAD, nullptr)) { NSK_DISPLAY0(" Agent :: notification enabled for COMPILED_METHOD_LOAD.\n"); if (!NSK_JVMTI_VERIFY(jvmti_env->GenerateEvents(JVMTI_EVENT_COMPILED_METHOD_LOAD))) { NSK_COMPLAIN0("#error Agent :: occured while enabling compiled method events.\n"); @@ -83,16 +83,16 @@ JNIEXPORT void JNICALL callbackCompiledMethodLoad(jvmtiEnv *jvmti_env, char *className; char *methodName; - className = NULL; - methodName = NULL; + className = nullptr; + methodName = nullptr; - if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(threadClass, &className, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(threadClass, &className, nullptr))) { NSK_COMPLAIN0("#error Agent :: while getting classname.\n"); nsk_jvmti_agentFailed(); return; } - if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &methodName, NULL, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &methodName, nullptr, nullptr))) { NSK_COMPLAIN0("#error Agent :: while getting methodname.\n"); nsk_jvmti_agentFailed(); return; @@ -115,13 +115,13 @@ JNIEXPORT void JNICALL callbackCompiledMethodLoad(jvmtiEnv *jvmti_env, } } - if (className != NULL) { + if (className != nullptr) { 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 (methodName != nullptr) { if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char *)methodName))) { NSK_COMPLAIN1("#error Agent :: failed to Deallocate methodName = %s.", methodName); nsk_jvmti_agentFailed(); @@ -171,7 +171,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { NSK_COMPLAIN0("#error Agent :: occured while setting event callback.\n"); return JNI_ERR; } - if (nsk_jvmti_enableNotification(jvmti,JVMTI_EVENT_CLASS_PREPARE, NULL)) { + if (nsk_jvmti_enableNotification(jvmti,JVMTI_EVENT_CLASS_PREPARE, nullptr)) { NSK_DISPLAY0(" Agent :: Notifications are enabled.\n"); } else { NSK_COMPLAIN0("#error Agent :: Error in enableing Notifications.\n"); @@ -214,7 +214,7 @@ Java_nsk_jvmti_scenarios_hotswap_HS203_hs203t004_hs203t004_popThreadFrame(JNIEnv } else { if (NSK_JVMTI_VERIFY( jvmti->SetEventNotificationMode(JVMTI_DISABLE, - JVMTI_EVENT_COMPILED_METHOD_LOAD, NULL))) { + JVMTI_EVENT_COMPILED_METHOD_LOAD, nullptr))) { NSK_DISPLAY0(" Agent :: Disabled JVMTI_EVENT_COMPILED_METHOD_LOAD.\n"); retvalue = JNI_TRUE; } else { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t004/hs203t004.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t004/hs203t004.java index a694698e2a39..f9f1aa8a2706 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t004/hs203t004.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t004/hs203t004.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, 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 @@ -56,8 +56,6 @@ package nsk.jvmti.scenarios.hotswap.HS203.hs203t004; -import vm.share.VMRuntimeEnvUtils; -import nsk.share.Consts; import nsk.share.jvmti.RedefineAgent; public class hs203t004 extends RedefineAgent { @@ -68,13 +66,6 @@ public hs203t004(String[] arg) { public static void main(String[] arg) { arg = nsk.share.jvmti.JVMTITest.commonInit(arg); - - if (!VMRuntimeEnvUtils.isJITEnabled()) { - System.out.println("WARNING: test isn't valid if JIT compilation is disabled"); - System.out.println("Exiting with 'PASSED' status"); - System.exit(Consts.JCK_STATUS_BASE + Consts.TEST_PASSED); - } - hs203t004 hsCase = new hs203t004(arg); System.exit(hsCase.runAgent()); } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t002/hs204t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t002/hs204t002.cpp index 1f1d3f9db094..3b8be254638e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t002/hs204t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t002/hs204t002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,11 +22,11 @@ */ #include #include -#include "agent_common.h" +#include "agent_common.hpp" #include #include -#include "jvmti_tools.h" -#include "JVMTITools.h" +#include "jvmti_tools.hpp" +#include "JVMTITools.hpp" /* *1. Enable event ClassPrepare. *2. Upon occurrence of ClassPrepare, set a breakpoint in class static @@ -57,12 +57,12 @@ callbackClassPrepare(jvmtiEnv *jvmti, if ((strcmp(className, CLASS_NAME) == 0)) { jclass cls; cls = jni->FindClass(SEARCH_NAME); - if (cls == NULL) { + if (cls == nullptr) { printf("Agent::CLS is null"); } else { jmethodID method; method = jni->GetMethodID(cls, METHOD_NAME,METHOD_SIGNATURE); - if (method == NULL) { + if (method == nullptr) { printf("Agent::Method is null "); } else { jlocation start; @@ -158,8 +158,8 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { return JNI_ERR; } - nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE , NULL); - nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_BREAKPOINT, NULL); + nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE , nullptr); + nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_BREAKPOINT, nullptr); } return JNI_OK; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t003/hs204t003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t003/hs204t003.cpp index 4980cd40473a..46f5f784bddb 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t003/hs204t003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t003/hs204t003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,11 +24,11 @@ #include #include #include -#include "agent_common.h" +#include "agent_common.hpp" #include -#include "jvmti_tools.h" -#include "jni_tools.h" -#include "JVMTITools.h" +#include "jvmti_tools.hpp" +#include "jni_tools.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -48,8 +48,8 @@ JNIEXPORT void JNICALL callbackClassPrepare(jvmtiEnv *jvmti_env, char * className; char * generic; - className = NULL; - generic = NULL; + className = nullptr; + generic = nullptr; redefineNumber=0; if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &className, &generic))) { NSK_DISPLAY0(" Agent :: Failed get class signature.\n"); @@ -57,7 +57,7 @@ JNIEXPORT void JNICALL callbackClassPrepare(jvmtiEnv *jvmti_env, } else { if ((strcmp(className, CLASS_NAME) == 0)) { jfieldID fieldId; - if (!NSK_JNI_VERIFY(jni, (fieldId = jni->GetStaticFieldID(klass, FIELDNAME, TYPE)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (fieldId = jni->GetStaticFieldID(klass, FIELDNAME, TYPE)) != nullptr)) { NSK_DISPLAY0(" Agent :: Failed to get FieldId.\n"); nsk_jvmti_agentFailed(); } else { @@ -65,8 +65,8 @@ JNIEXPORT void JNICALL callbackClassPrepare(jvmtiEnv *jvmti_env, 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) jni->NewGlobalRef(klass)) != NULL)) { + nsk_jvmti_enableNotification(jvmti_env, JVMTI_EVENT_FIELD_ACCESS, nullptr); + if (!NSK_JNI_VERIFY(jni, (watchFieldClass = (jclass) jni->NewGlobalRef(klass)) != nullptr)) { NSK_DISPLAY0(" Agent :: Failed to get global reference for class.\n"); nsk_jvmti_agentFailed(); } @@ -77,14 +77,14 @@ JNIEXPORT void JNICALL callbackClassPrepare(jvmtiEnv *jvmti_env, } } - if (className != NULL) { + if (className != nullptr) { 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 (generic != nullptr) { if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char *)generic))) { NSK_DISPLAY1(" Agent :: #error failed to Deallocate class signature = %s.", generic); nsk_jvmti_agentFailed(); @@ -105,8 +105,8 @@ JNIEXPORT void JNICALL callbackFieldAccess(jvmtiEnv *jvmti_env, char * className; char * generic; - className = NULL; - generic = NULL; + className = nullptr; + generic = nullptr; if (redefineNumber != 0) { return; } @@ -139,14 +139,14 @@ JNIEXPORT void JNICALL callbackFieldAccess(jvmtiEnv *jvmti_env, } } - if (className != NULL) { + if (className != nullptr) { 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 (generic != nullptr) { if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char *)generic))) { NSK_DISPLAY1(" Agent :: #error failed to Deallocate class signature = %s.", generic); nsk_jvmti_agentFailed(); @@ -192,7 +192,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { NSK_DISPLAY0(" Agent :: Error occured while setting event call back \n"); return JNI_ERR; } - nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, NULL); + nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, nullptr); } return JNI_OK; } @@ -219,7 +219,7 @@ Java_nsk_jvmti_scenarios_hotswap_HS204_hs204t003_hs204t003_popFrame(JNIEnv * jni nsk_jvmti_agentFailed(); } else { jfieldID fieldId = jni->GetStaticFieldID(watchFieldClass, FIELDNAME, TYPE); - if (!NSK_JNI_VERIFY(jni, fieldId != NULL)) { + if (!NSK_JNI_VERIFY(jni, fieldId != nullptr)) { NSK_DISPLAY0(" Agent :: Failed to get FieldId before droping watchers.\n"); nsk_jvmti_agentFailed(); } else { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t004/hs204t004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t004/hs204t004.cpp index 09178bac4a14..1db6093dde7a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t004/hs204t004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t004/hs204t004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,11 +22,11 @@ */ #include #include -#include "agent_common.h" +#include "agent_common.hpp" #include #include -#include "jvmti_tools.h" -#include "JVMTITools.h" +#include "jvmti_tools.hpp" +#include "JVMTITools.hpp" /* 1. Enable event ClassPrepare. @@ -55,11 +55,11 @@ callbackClassLoad(jvmtiEnv *jvmti_env, redefineNumber=0; jvmti->GetClassSignature(klass, &className, &generic); if (strcmp(className, CLASS_LOADER_CLASS_NAME) == 0) { - if (klass != NULL) { + if (klass != nullptr) { jmethodID method; cloader = klass; method = jni->GetMethodID(klass,METHOD_NAME,SIGNATURE); - if (method != NULL) { + if (method != nullptr) { jlocation start; jlocation end; jvmtiError err ; @@ -158,8 +158,8 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { nsk_printf(" Agent:: Error occured while setting event call back \n"); return JNI_ERR; } - nsk_jvmti_enableNotification(jvmti,JVMTI_EVENT_CLASS_LOAD, NULL); - nsk_jvmti_enableNotification(jvmti,JVMTI_EVENT_BREAKPOINT, NULL); + nsk_jvmti_enableNotification(jvmti,JVMTI_EVENT_CLASS_LOAD, nullptr); + nsk_jvmti_enableNotification(jvmti,JVMTI_EVENT_BREAKPOINT, nullptr); } return JNI_OK; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t001/hs301t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t001/hs301t001.cpp index c98c93e6702c..3a93a57f2243 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t001/hs301t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t001/hs301t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, 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,10 +23,10 @@ #include #include -#include "agent_common.h" +#include "agent_common.hpp" #include -#include "jvmti_tools.h" -#include "jni_tools.h" +#include "jvmti_tools.hpp" +#include "jni_tools.hpp" extern "C" { #define FILE_NAME "nsk/jvmti/scenarios/hotswap/HS301/hs301t001/MyClass" @@ -84,7 +84,7 @@ Java_nsk_jvmti_scenarios_hotswap_HS301_hs301t001_hs301t001_redefine(JNIEnv * jni redefineNumber=0; cls = jni->FindClass(SEARCH_NAME); - if (!NSK_JNI_VERIFY(jni, cls != NULL)) { + if (!NSK_JNI_VERIFY(jni, cls != nullptr)) { nsk_printf("Agent:: (*JNI)->FindClass(jni, %s) returns `null`.\n",SEARCH_NAME); return NSK_FALSE; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t002/hs301t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t002/hs301t002.cpp index 3684e060946f..135993fa0cf1 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t002/hs301t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t002/hs301t002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,10 +26,10 @@ */ #include #include -#include "agent_common.h" +#include "agent_common.hpp" #include -#include "jvmti_tools.h" -#include "jni_tools.h" +#include "jvmti_tools.hpp" +#include "jni_tools.hpp" extern "C" { #define FILE_NAME "nsk/jvmti/scenarios/hotswap/HS301/hs301t002/MyClass" @@ -84,7 +84,7 @@ Java_nsk_jvmti_scenarios_hotswap_HS301_hs301t002_hs301t002_redefine(JNIEnv * jni redefineNumber=0; ret = JNI_FALSE; - if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(SEARCH_NAME)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(SEARCH_NAME)) != nullptr)) { nsk_printf("Agent:: (*JNI)->FindClass(jni, %s) returns `null`.\n", SEARCH_NAME); return NSK_FALSE; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t003/hs301t003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t003/hs301t003.cpp index a36ddd49fd21..785b53157d7e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t003/hs301t003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t003/hs301t003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,9 +22,9 @@ */ #include #include -#include "agent_common.h" +#include "agent_common.hpp" #include -#include "jvmti_tools.h" +#include "jvmti_tools.hpp" extern "C" { #define FILE_NAME "nsk/jvmti/scenarios/hotswap/HS301/hs301t003/MyClass" @@ -45,7 +45,7 @@ void JNICALL callbackClassPrepare(jvmtiEnv *jvmti_env, nsk_jvmti_getFileName(redefineNumber, FILE_NAME, fileName, sizeof(fileName)/sizeof(char)); nsk_jvmti_disableNotification(jvmti_env, - JVMTI_EVENT_CLASS_LOAD, NULL); + JVMTI_EVENT_CLASS_LOAD, nullptr); if (nsk_jvmti_redefineClass(jvmti_env, klass, fileName)) { nsk_printf("\n Redefine successful.\n"); } else { @@ -92,7 +92,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { nsk_printf(" Agent:: Error occured while setting event call back.\n"); return JNI_ERR; } - if (nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, NULL)) { + if (nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, nullptr)) { nsk_printf(" Agent:: Enabled notification.\n"); } else { nsk_printf(" Agent:: Failed to enable notification.\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t004/hs301t004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t004/hs301t004.cpp index 0a7ab069738d..59c27c244b03 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t004/hs301t004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t004/hs301t004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,9 +22,9 @@ */ #include #include -#include "agent_common.h" +#include "agent_common.hpp" #include -#include "jvmti_tools.h" +#include "jvmti_tools.hpp" extern "C" { #define FILE_NAME "nsk/jvmti/scenarios/hotswap/HS301/hs301t004/MyClass" @@ -44,7 +44,7 @@ void JNICALL callbackClassPrepare(jvmtiEnv *jvmti_env, if (strcmp(className, CLASS_NAME) == 0) { int redefineNumber =0; char fileName[512]; - nsk_jvmti_disableNotification(jvmti_env, JVMTI_EVENT_CLASS_PREPARE, NULL); + nsk_jvmti_disableNotification(jvmti_env, JVMTI_EVENT_CLASS_PREPARE, nullptr); nsk_jvmti_getFileName(redefineNumber, FILE_NAME, fileName, sizeof(fileName)/sizeof(char)); if (nsk_jvmti_redefineClass(jvmti_env, klass, fileName)) { @@ -93,7 +93,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { nsk_printf(" Agent:: Error occured while setting event call back \n"); return JNI_ERR; } - if (nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, NULL)) { + if (nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, nullptr)) { nsk_printf(" Enabled notification.\n"); } else { nsk_printf(" Failed to enable notifications.\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t005/hs301t005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t005/hs301t005.cpp index a6bfbae8bd4a..ff3bbce6a155 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t005/hs301t005.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t005/hs301t005.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,9 +22,9 @@ */ #include #include -#include "agent_common.h" +#include "agent_common.hpp" #include -#include "jvmti_tools.h" +#include "jvmti_tools.hpp" extern "C" { @@ -41,7 +41,7 @@ void JNICALL callbackClassPrepare(jvmtiEnv *jvmti, if (strcmp(className,CLASS_NAME) == 0) { int redefineNumber =0; char fileName[512]; - nsk_jvmti_disableNotification(jvmti, JVMTI_EVENT_CLASS_LOAD, NULL); + nsk_jvmti_disableNotification(jvmti, JVMTI_EVENT_CLASS_LOAD, nullptr); nsk_jvmti_getFileName(redefineNumber, FILE_NAME, fileName, sizeof(fileName)/sizeof(char)); if (nsk_jvmti_redefineClass(jvmti, klass, fileName)) { nsk_printf("\n Redefine successful ..\n"); @@ -88,7 +88,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { nsk_printf(" Agent:: Error occured while setting event call back \n"); return JNI_ERR; } - if (nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, NULL)) { + if (nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, nullptr)) { nsk_printf(" Enabled. noftification.."); } else { nsk_printf(" Failed to Enable .."); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t001/hs302t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t001/hs302t001.cpp index cd474e6a71dd..67a37e4b27f2 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t001/hs302t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t001/hs302t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,9 +22,9 @@ */ #include #include -#include "agent_common.h" +#include "agent_common.hpp" #include -#include "jvmti_tools.h" +#include "jvmti_tools.hpp" extern "C" { @@ -42,7 +42,7 @@ void JNICALL callbackClassPrepare(jvmtiEnv *jvmti_env, if (strcmp(className,CLASS_NAME) == 0) { char fileName[512]; nsk_jvmti_getFileName(redefineNumber, FILE_NAME, fileName, sizeof(fileName)/sizeof(char)); - nsk_jvmti_disableNotification(jvmti_env, JVMTI_EVENT_CLASS_PREPARE, NULL); + nsk_jvmti_disableNotification(jvmti_env, JVMTI_EVENT_CLASS_PREPARE, nullptr); if (nsk_jvmti_redefineClass(jvmti_env, klass, fileName)) { nsk_printf("Redefine successful ..\n"); } else { @@ -88,7 +88,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { nsk_printf(" Agent:: Error occured while setting event call back \n"); return JNI_ERR; } - if (nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, NULL)) { + if (nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, nullptr)) { nsk_printf(" Enabled. noftification.."); } else { nsk_printf(" Failed to Enable .."); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t002/hs302t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t002/hs302t002.cpp index 14fa9aef0710..173f97cd410b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t002/hs302t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t002/hs302t002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,9 +22,9 @@ */ #include #include -#include "agent_common.h" +#include "agent_common.hpp" #include -#include "jvmti_tools.h" +#include "jvmti_tools.hpp" extern "C" { @@ -42,7 +42,7 @@ void JNICALL callbackClassPrepare(jvmtiEnv *jvmti_env, jvmti_env->GetClassSignature(klass, &className, &generic); if (strcmp(className,CLASS_NAME) == 0) { char fileName[512]; - nsk_jvmti_disableNotification(jvmti_env, JVMTI_EVENT_CLASS_PREPARE, NULL); + nsk_jvmti_disableNotification(jvmti_env, JVMTI_EVENT_CLASS_PREPARE, nullptr); nsk_jvmti_getFileName(redefineNumber, FILE_NAME, fileName, sizeof(fileName)/sizeof(char)); if (nsk_jvmti_redefineClass(jvmti_env, klass, fileName)) { nsk_printf("Redefine successful ..\n"); @@ -94,7 +94,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { nsk_printf(" Agent:: Error occured while setting event call back \n"); return JNI_ERR; } - if (nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, NULL)) { + if (nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, nullptr)) { nsk_printf(" Enabled. noftification.."); } else { nsk_printf(" Failed to Enable .."); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t003/hs302t003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t003/hs302t003.cpp index 2625b7fcb4cb..3f9f8cc5c8f6 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t003/hs302t003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t003/hs302t003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,9 +22,9 @@ */ #include #include -#include "agent_common.h" +#include "agent_common.hpp" #include -#include "jvmti_tools.h" +#include "jvmti_tools.hpp" extern "C" { @@ -43,7 +43,7 @@ void JNICALL callbackClassPrepare(jvmtiEnv *jvmti_env, char fileName[512]; nsk_jvmti_getFileName(redefineNumber, FILE_NAME, fileName, sizeof(fileName)/sizeof(char)); - nsk_jvmti_disableNotification(jvmti_env, JVMTI_EVENT_CLASS_PREPARE, NULL); + nsk_jvmti_disableNotification(jvmti_env, JVMTI_EVENT_CLASS_PREPARE, nullptr); if (nsk_jvmti_redefineClass(jvmti_env, klass, fileName)) { nsk_printf("Redefine successful ..\n"); } else { @@ -93,7 +93,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { nsk_printf(" Agent:: Error occured while setting event call back \n"); return JNI_ERR; } - if (nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, NULL)) { + if (nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, nullptr)) { nsk_printf(" Enabled. noftification.."); } else { nsk_printf(" Failed to Enable .."); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t004/hs302t004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t004/hs302t004.cpp index 9c7d26fd5435..e9ab190b9f95 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t004/hs302t004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t004/hs302t004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,9 +22,9 @@ */ #include #include -#include "agent_common.h" +#include "agent_common.hpp" #include -#include "jvmti_tools.h" +#include "jvmti_tools.hpp" extern "C" { #define FILE_NAME "nsk/jvmti/scenarios/hotswap/HS302/hs302t004r/MyClass" @@ -42,7 +42,7 @@ void JNICALL callbackClassPrepare(jvmtiEnv *jvmti_env, char fileName[512]; nsk_jvmti_getFileName(redefineNumber, FILE_NAME, fileName, sizeof(fileName)/sizeof(char)); - nsk_jvmti_disableNotification(jvmti_env, JVMTI_EVENT_CLASS_PREPARE, NULL); + nsk_jvmti_disableNotification(jvmti_env, JVMTI_EVENT_CLASS_PREPARE, nullptr); if (nsk_jvmti_redefineClass(jvmti_env, klass,fileName)) { nsk_printf("Redefine successful ..\n"); } else { @@ -88,7 +88,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { nsk_printf(" Agent:: Error occured while setting event call back \n"); return JNI_ERR; } - if (nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, NULL)) { + if (nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, nullptr)) { nsk_printf(" Enabled. noftification.."); } else { nsk_printf(" Failed to Enable .."); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t005/hs302t005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t005/hs302t005.cpp index ac0b3ca62e12..2e794561cb76 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t005/hs302t005.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t005/hs302t005.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,9 +22,9 @@ */ #include #include -#include "agent_common.h" +#include "agent_common.hpp" #include -#include "jvmti_tools.h" +#include "jvmti_tools.hpp" extern "C" { @@ -42,7 +42,7 @@ void JNICALL callbackClassPrepare(jvmtiEnv *jvmti_env, jvmti_env->GetClassSignature(klass, &className, &generic); if (strcmp(className,CLASS_NAME) == 0) { char fileName[512]; - nsk_jvmti_disableNotification(jvmti_env, JVMTI_EVENT_CLASS_PREPARE, NULL); + nsk_jvmti_disableNotification(jvmti_env, JVMTI_EVENT_CLASS_PREPARE, nullptr); nsk_jvmti_getFileName(redefineNumber, FILE_NAME, fileName, sizeof(fileName)/sizeof(char)); if (nsk_jvmti_redefineClass(jvmti_env, klass,fileName)) { @@ -90,7 +90,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { nsk_printf(" Agent:: Error occured while setting event call back \n"); return JNI_ERR; } - if (nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, NULL)) { + if (nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, nullptr)) { nsk_printf(" Enabled. noftification.."); } else { nsk_printf(" Failed to Enable .."); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t006/hs302t006.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t006/hs302t006.cpp index 4e896c79c5bc..885c2bf29108 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t006/hs302t006.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t006/hs302t006.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,9 +22,9 @@ */ #include #include -#include "agent_common.h" +#include "agent_common.hpp" #include -#include "jvmti_tools.h" +#include "jvmti_tools.hpp" extern "C" { @@ -41,7 +41,7 @@ void JNICALL callbackClassPrepare(jvmtiEnv *jvmti_env, jvmti_env->GetClassSignature(klass, &className, &generic); if (strcmp(className,CLASS_NAME) == 0) { char fileName[512]; - nsk_jvmti_disableNotification(jvmti_env, JVMTI_EVENT_CLASS_PREPARE, NULL); + nsk_jvmti_disableNotification(jvmti_env, JVMTI_EVENT_CLASS_PREPARE, nullptr); nsk_jvmti_getFileName(redefineNumber, FILE_NAME, fileName, sizeof(fileName)/sizeof(char)); if (nsk_jvmti_redefineClass(jvmti_env, klass, fileName)) { @@ -89,7 +89,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { nsk_printf(" Agent:: Error occured while setting event call back \n"); return JNI_ERR; } - if (nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, NULL)) { + if (nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, nullptr)) { nsk_printf(" Enabled. noftification.."); } else { nsk_printf(" Failed to Enable .."); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t007/hs302t007.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t007/hs302t007.cpp index f1dd87206972..036bedcf9ee4 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t007/hs302t007.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t007/hs302t007.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,9 +22,9 @@ */ #include #include -#include "agent_common.h" +#include "agent_common.hpp" #include -#include "jvmti_tools.h" +#include "jvmti_tools.hpp" extern "C" { #define FILE_NAME "nsk/jvmti/scenarios/hotswap/HS302/hs302t007r/MyClass" #define CLASS_NAME "Lnsk/jvmti/scenarios/hotswap/HS302/hs302t007r/MyClass;" @@ -38,7 +38,7 @@ void JNICALL callbackClassPrepare(jvmtiEnv *jvmti_env, jvmti_env->GetClassSignature(klass, &className, &generic); if (strcmp(className,CLASS_NAME) == 0) { char fileName[512]; - nsk_jvmti_disableNotification(jvmti_env, JVMTI_EVENT_CLASS_PREPARE, NULL); + nsk_jvmti_disableNotification(jvmti_env, JVMTI_EVENT_CLASS_PREPARE, nullptr); nsk_jvmti_getFileName(redefineNumber, FILE_NAME, fileName, sizeof(fileName)/sizeof(char)); if (nsk_jvmti_redefineClass(jvmti_env, klass, fileName)) { @@ -86,7 +86,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { nsk_printf(" Agent:: Error occured while setting event call back \n"); return JNI_ERR; } - if (nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, NULL)) { + if (nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, nullptr)) { nsk_printf(" Enabled. noftification.."); } else { nsk_printf(" Failed to Enable .."); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t008/hs302t008.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t008/hs302t008.cpp index 1f11ca27d3bc..d30b767cddcb 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t008/hs302t008.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t008/hs302t008.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,9 +22,9 @@ */ #include #include -#include "agent_common.h" +#include "agent_common.hpp" #include -#include "jvmti_tools.h" +#include "jvmti_tools.hpp" extern "C" { @@ -41,7 +41,7 @@ void JNICALL callbackClassPrepare(jvmtiEnv *jvmti_env, jvmti_env->GetClassSignature(klass, &className, &generic); if (strcmp(className,CLASS_NAME) == 0) { char fileName[512]; - nsk_jvmti_disableNotification(jvmti_env, JVMTI_EVENT_CLASS_PREPARE, NULL); + nsk_jvmti_disableNotification(jvmti_env, JVMTI_EVENT_CLASS_PREPARE, nullptr); nsk_jvmti_getFileName(redefineNumber, FILE_NAME, fileName, sizeof(fileName)/sizeof(char)); if (nsk_jvmti_redefineClass(jvmti_env, klass, fileName)) { @@ -89,7 +89,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { nsk_printf(" Agent:: Error occured while setting event call back \n"); return JNI_ERR; } - if (nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, NULL)) { + if (nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, nullptr)) { nsk_printf(" Enabled. noftification.."); } else { nsk_printf(" Failed to Enable .."); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t009/hs302t009.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t009/hs302t009.cpp index dbcf4290b228..18c51111f423 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t009/hs302t009.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t009/hs302t009.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,9 +22,9 @@ */ #include #include -#include "agent_common.h" +#include "agent_common.hpp" #include -#include "jvmti_tools.h" +#include "jvmti_tools.hpp" extern "C" { #define FILE_NAME "nsk/jvmti/scenarios/hotswap/HS302/hs302t009r/MyClass" @@ -42,7 +42,7 @@ void JNICALL callbackClassPrepare(jvmtiEnv *jvmti_env, if (strcmp(className,CLASS_NAME) == 0) { char fileName[512]; - nsk_jvmti_disableNotification(jvmti_env, JVMTI_EVENT_CLASS_PREPARE, NULL); + nsk_jvmti_disableNotification(jvmti_env, JVMTI_EVENT_CLASS_PREPARE, nullptr); nsk_jvmti_getFileName(redefineNumber, FILE_NAME, fileName, sizeof(fileName)/sizeof(char)); if (nsk_jvmti_redefineClass(jvmti_env, klass,fileName)) { @@ -89,7 +89,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { nsk_printf(" Agent:: Error occured while setting event call back \n"); return JNI_ERR; } - if (nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, NULL)) { + if (nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, nullptr)) { nsk_printf(" Enabled. noftification.."); } else { nsk_printf(" Failed to Enable .."); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t010/hs302t010.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t010/hs302t010.cpp index fd15976ab42e..cab1f02215ef 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t010/hs302t010.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t010/hs302t010.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,9 +22,9 @@ */ #include #include -#include "agent_common.h" +#include "agent_common.hpp" #include -#include "jvmti_tools.h" +#include "jvmti_tools.hpp" extern "C" { @@ -41,7 +41,7 @@ void JNICALL callbackClassPrepare(jvmtiEnv *jvmti_env, jvmti_env->GetClassSignature(klass, &className, &generic); if (strcmp(className,CLASS_NAME) == 0) { char fileName[512]; - nsk_jvmti_disableNotification(jvmti_env, JVMTI_EVENT_CLASS_PREPARE, NULL); + nsk_jvmti_disableNotification(jvmti_env, JVMTI_EVENT_CLASS_PREPARE, nullptr); nsk_jvmti_getFileName(redefineNumber, FILE_NAME, fileName, sizeof(fileName)/sizeof(char)); if (nsk_jvmti_redefineClass(jvmti_env, klass, fileName)) { @@ -88,7 +88,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { nsk_printf(" Agent:: Error occured while setting event call back \n"); return JNI_ERR; } - if (nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, NULL)) { + if (nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, nullptr)) { nsk_printf(" Enabled. noftification.."); } else { nsk_printf(" Failed to Enable .."); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t011/hs302t011.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t011/hs302t011.cpp index eb9a17c1791c..bd3756b14936 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t011/hs302t011.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t011/hs302t011.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,9 +22,9 @@ */ #include #include -#include "agent_common.h" +#include "agent_common.hpp" #include -#include "jvmti_tools.h" +#include "jvmti_tools.hpp" extern "C" { @@ -41,7 +41,7 @@ void JNICALL callbackClassPrepare(jvmtiEnv *jvmti_env, jvmti_env->GetClassSignature(klass, &className, &generic); if (strcmp(className,CLASS_NAME) == 0) { char fileName[512]; - nsk_jvmti_disableNotification(jvmti_env, JVMTI_EVENT_CLASS_PREPARE, NULL); + nsk_jvmti_disableNotification(jvmti_env, JVMTI_EVENT_CLASS_PREPARE, nullptr); nsk_jvmti_getFileName(redefineNumber, FILE_NAME, fileName, sizeof(fileName)/sizeof(char)); if (nsk_jvmti_redefineClass(jvmti_env, klass, fileName)) { @@ -89,7 +89,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { nsk_printf(" Agent:: Error occured while setting event call back \n"); return JNI_ERR; } - if (nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, NULL)) { + if (nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, nullptr)) { nsk_printf(" Enabled. noftification.."); } else { nsk_printf(" Failed to Enable .."); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t012/hs302t012.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t012/hs302t012.cpp index 4324a18dc73e..b384834f022c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t012/hs302t012.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS302/hs302t012/hs302t012.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,9 +22,9 @@ */ #include #include -#include "agent_common.h" +#include "agent_common.hpp" #include -#include "jvmti_tools.h" +#include "jvmti_tools.hpp" extern "C" { @@ -43,7 +43,7 @@ void JNICALL callbackClassPrepare(jvmtiEnv *jvmti_env, jvmti_env->GetClassSignature(klass, &className, &generic); if (strcmp(className,CLASS_NAME) == 0) { char fileName[512]; - nsk_jvmti_disableNotification(jvmti_env, JVMTI_EVENT_CLASS_PREPARE, NULL); + nsk_jvmti_disableNotification(jvmti_env, JVMTI_EVENT_CLASS_PREPARE, nullptr); nsk_jvmti_getFileName(redefineNumber, FILE_NAME, fileName, sizeof(fileName)/sizeof(char)); if (nsk_jvmti_redefineClass(jvmti_env, klass, fileName)) { @@ -91,7 +91,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { nsk_printf(" Agent:: Error occured while setting event call back \n"); return JNI_ERR; } - if (nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, NULL)) { + if (nsk_jvmti_enableNotification(jvmti, JVMTI_EVENT_CLASS_PREPARE, nullptr)) { nsk_printf(" Enabled. noftification.."); } else { nsk_printf(" Failed to Enable .."); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI01/ji01t001/ji01t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI01/ji01t001/ji01t001.cpp index d3d6ea40c8c8..018b1c7d7534 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI01/ji01t001/ji01t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI01/ji01t001/ji01t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,11 +27,11 @@ #include #include -#include "agent_common.h" +#include "agent_common.hpp" -#include "JVMTITools.h" -#include "jvmti_tools.h" -#include "nsk_tools.h" +#include "JVMTITools.hpp" +#include "jvmti_tools.hpp" +#include "nsk_tools.hpp" extern "C" { @@ -40,36 +40,36 @@ extern "C" { static const char *classSig = "Lnsk/jvmti/scenarios/jni_interception/JI01/ji01t001;"; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jrawMonitorID eventLock; static jvmtiEventCallbacks callbacks; static jint result = NSK_STATUS_PASSED; // test thread -static jthread testThread = NULL; +static jthread testThread = nullptr; /* the original JNI function table */ -static jniNativeInterface *orig_jni_functions = NULL; +static jniNativeInterface *orig_jni_functions = nullptr; /* the redirected JNI function table */ -static jniNativeInterface *redir_jni_functions = NULL; +static jniNativeInterface *redir_jni_functions = nullptr; /* number of the redirected JNI function calls */ static volatile int fnd_calls = 0; void setTestThread(JNIEnv *env) { - jthread curThread = NULL; + jthread curThread = nullptr; NSK_JVMTI_VERIFY(jvmti->GetCurrentThread(&curThread)); testThread = env->NewGlobalRef(curThread); } void resetTestThread(JNIEnv *env) { env->DeleteGlobalRef(testThread); - testThread = NULL; + testThread = nullptr; } bool isOnTestThread(JNIEnv *env) { - jthread curThread = NULL; + jthread curThread = nullptr; NSK_JVMTI_VERIFY(jvmti->GetCurrentThread(&curThread)); return env->IsSameObject(testThread, curThread); } @@ -329,7 +329,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; - if (!NSK_VERIFY(jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1) == JNI_OK && jvmti != NULL)) + if (!NSK_VERIFY(jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1) == JNI_OK && jvmti != nullptr)) return JNI_ERR; @@ -354,11 +354,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { NSK_DISPLAY0("Event callbacks are set\nEnabling events...\n"); - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, nullptr))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, nullptr))) return JNI_ERR; NSK_DISPLAY0("Events are enabled\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t001/ji03t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t001/ji03t001.cpp index 1d452892f2ca..927aa19974bc 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t001/ji03t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t001/ji03t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,24 +26,24 @@ #include #include -#include "agent_common.h" +#include "agent_common.hpp" -#include "JVMTITools.h" +#include "JVMTITools.hpp" extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static int verbose = 0; /* the original JNI function table */ -static jniNativeInterface *orig_jni_functions = NULL; +static jniNativeInterface *orig_jni_functions = nullptr; /* the redirected JNI function table */ -static jniNativeInterface *redir_jni_functions = NULL; +static jniNativeInterface *redir_jni_functions = nullptr; /* number of the redirected JNI function calls */ int call_count = 0; @@ -115,7 +115,7 @@ JNIEXPORT jint JNICALL Java_nsk_jvmti_scenarios_jni_1interception_JI03_ji03t001_check(JNIEnv *env, jclass cls) { jint ver; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("(%s,%d): TEST FAILURE: JVMTI client was not properly loaded\n", __FILE__, __LINE__); return STATUS_FAILED; @@ -183,14 +183,14 @@ JNIEXPORT jint JNI_OnLoad_ji03t001(JavaVM *jvm, char *options, void *reserved) { jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "-verbose") == 0) + if (options != nullptr && strcmp(options, "-verbose") == 0) verbose = 1; if (verbose) printf("verbose mode on\n"); res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("(%s,%d): Failed to call GetEnv\n", __FILE__, __LINE__); return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t002/ji03t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t002/ji03t002.cpp index 0ed3d60a31e2..297a94aca8ec 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t002/ji03t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t002/ji03t002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,16 +27,16 @@ #include #include -#include "agent_common.h" +#include "agent_common.hpp" -#include "JVMTITools.h" +#include "JVMTITools.hpp" extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static int verbose = 0; @@ -53,15 +53,15 @@ typedef struct { /* line numbers of a method */ } methInfo; static methInfo meth_info[] = { - { 0, "statMeth", "(I)D", NULL, "statMeth_calls", NULL, 0, 0 }, - { 1, "voidMeth", "()V", NULL, "voidMeth_calls", NULL, 0, 0 } + { 0, "statMeth", "(I)D", nullptr, "statMeth_calls", nullptr, 0, 0 }, + { 1, "voidMeth", "()V", nullptr, "voidMeth_calls", nullptr, 0, 0 } }; /* the original JNI function table */ -static jniNativeInterface *orig_jni_functions = NULL; +static jniNativeInterface *orig_jni_functions = nullptr; /* the redirected JNI function table */ -static jniNativeInterface *redir_jni_functions = NULL; +static jniNativeInterface *redir_jni_functions = nullptr; /** redirected JNI functions **/ jdouble JNICALL MyCallStaticDoubleMethodV(JNIEnv *env, jclass cls, jmethodID mid, va_list args) { @@ -127,7 +127,7 @@ void doRedirect(JNIEnv *env, jclass cls) { meth_info[i].mid = env->GetStaticMethodID( cls, meth_info[i].m_name, meth_info[i].m_sign); } - if (meth_info[i].mid == NULL) { + if (meth_info[i].mid == nullptr) { result = STATUS_FAILED; printf("(%s,%d): TEST FAILURE: failed to get the ID for the method \"%s %s\"\n", __FILE__, __LINE__, meth_info[i].m_name, meth_info[i].m_sign); @@ -270,7 +270,7 @@ JNIEXPORT jint JNICALL Java_nsk_jvmti_scenarios_jni_1interception_JI03_ji03t002_check(JNIEnv *env, jobject obj) { jclass objCls; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("(%s,%d): TEST FAILURE: JVMTI client was not properly loaded\n", __FILE__, __LINE__); return STATUS_FAILED; @@ -309,14 +309,14 @@ JNIEXPORT jint JNI_OnLoad_ji03t002(JavaVM *jvm, char *options, void *reserved) { jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "-verbose") == 0) + if (options != nullptr && strcmp(options, "-verbose") == 0) verbose = 1; if (verbose) printf("verbose mode on\n"); res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("(%s,%d): Failed to call GetEnv\n", __FILE__, __LINE__); return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t003/ji03t003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t003/ji03t003.cpp index 4bb4e45fb073..bab6880c5c01 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t003/ji03t003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t003/ji03t003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,30 +27,30 @@ #include #include -#include "agent_common.h" +#include "agent_common.hpp" -#include "JVMTITools.h" +#include "JVMTITools.hpp" extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static int verbose = 0; // test thread -static jthread testThread = NULL; +static jthread testThread = nullptr; static const char *javaField = "exc"; static const char *excClassSig = "Lnsk/jvmti/scenarios/jni_interception/JI03/ji03t003Exc;"; /* the original JNI function table */ -static jniNativeInterface *orig_jni_functions = NULL; +static jniNativeInterface *orig_jni_functions = nullptr; /* the redirected JNI function table */ -static jniNativeInterface *redir_jni_functions = NULL; +static jniNativeInterface *redir_jni_functions = nullptr; /* number of the redirected JNI function calls */ int throw_calls = 0; @@ -58,18 +58,18 @@ int thrownew_calls = 0; int excoccur_calls = 0; void setTestThread(JNIEnv *env) { - jthread curThread = NULL; + jthread curThread = nullptr; NSK_JVMTI_VERIFY(jvmti->GetCurrentThread(&curThread)); testThread = env->NewGlobalRef(curThread); } void resetTestThread(JNIEnv *env) { env->DeleteGlobalRef(testThread); - testThread = NULL; + testThread = nullptr; } bool isOnTestThread(JNIEnv *env) { - jthread curThread = NULL; + jthread curThread = nullptr; NSK_JVMTI_VERIFY(jvmti->GetCurrentThread(&curThread)); return env->IsSameObject(testThread, curThread); } @@ -290,7 +290,7 @@ Java_nsk_jvmti_scenarios_jni_1interception_JI03_ji03t003_check(JNIEnv *env, jobj jclass thrw; jclass objCls; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("(%s,%d): TEST FAILURE: JVMTI client was not properly loaded\n", __FILE__, __LINE__); return STATUS_FAILED; @@ -357,14 +357,14 @@ JNIEXPORT jint JNI_OnLoad_ji03t003(JavaVM *jvm, char *options, void *reserved) { jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "-verbose") == 0) + if (options != nullptr && strcmp(options, "-verbose") == 0) verbose = 1; if (verbose) printf("verbose mode on\n"); res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("(%s,%d): Failed to call GetEnv\n", __FILE__, __LINE__); return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t004/ji03t004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t004/ji03t004.cpp index ffbe992669e8..94cf69dab515 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t004/ji03t004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI03/ji03t004/ji03t004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,16 +27,16 @@ #include #include -#include "agent_common.h" +#include "agent_common.hpp" -#include "JVMTITools.h" +#include "JVMTITools.hpp" extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static int verbose = 0; @@ -44,10 +44,10 @@ static const char *classSig = "Lnsk/jvmti/scenarios/jni_interception/JI03/ji03t004a;"; /* the original JNI function table */ -static jniNativeInterface *orig_jni_functions = NULL; +static jniNativeInterface *orig_jni_functions = nullptr; /* the redirected JNI function table */ -static jniNativeInterface *redir_jni_functions = NULL; +static jniNativeInterface *redir_jni_functions = nullptr; /* number of the redirected JNI function calls */ int allobj_calls = 0; @@ -134,7 +134,7 @@ void doExec(JNIEnv *env, jclass allCls, jmethodID ctorId, const char *msg, ...) va_list args; va_start(args, msg); allObj = env->AllocObject(allCls); - if (allObj == NULL) { + if (allObj == nullptr) { result = STATUS_FAILED; printf("(%s,%d): TEST FAILED: failed to call %s AllocObject()\n", __FILE__, __LINE__, msg); @@ -150,7 +150,7 @@ void doExec(JNIEnv *env, jclass allCls, jmethodID ctorId, const char *msg, ...) } newObj = env->NewObjectV(allCls, ctorId, args); - if (newObj == NULL) { + if (newObj == nullptr) { result = STATUS_FAILED; printf("(%s,%d): TEST FAILED: failed to call %s NewObjectV()\n", __FILE__, __LINE__, msg); @@ -208,21 +208,21 @@ Java_nsk_jvmti_scenarios_jni_1interception_JI03_ji03t004_check(JNIEnv *env, jobj jmethodID ctorId; jclass objCls; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("(%s,%d): TEST FAILURE: JVMTI client was not properly loaded\n", __FILE__, __LINE__); return STATUS_FAILED; } objCls = env->FindClass(classSig); - if (objCls == NULL) { + if (objCls == nullptr) { printf("(%s,%d): TEST FAILED: failed to call FindClass() for \"%s\"\n", __FILE__, __LINE__, classSig); return STATUS_FAILED; } ctorId = env->GetMethodID(objCls, "", "()V"); - if (ctorId == NULL) { + if (ctorId == nullptr) { printf("(%s,%d): TEST FAILED: failed to call GetMethodID() for a constructor\n", __FILE__, __LINE__); return STATUS_FAILED; @@ -259,14 +259,14 @@ JNIEXPORT jint JNI_OnLoad_ji03t004(JavaVM *jvm, char *options, void *reserved) { jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "-verbose") == 0) + if (options != nullptr && strcmp(options, "-verbose") == 0) verbose = 1; if (verbose) printf("verbose mode on\n"); res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("(%s,%d): Failed to call GetEnv\n", __FILE__, __LINE__); return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI05/ji05t001/ji05t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI05/ji05t001/ji05t001.cpp index a38d73ba8215..550a29158bf4 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI05/ji05t001/ji05t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI05/ji05t001/ji05t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,12 +27,12 @@ #include #include -#include "agent_common.h" +#include "agent_common.hpp" -#include "nsk_tools.h" -#include "JVMTITools.h" -#include "jvmti_tools.h" -#include "native_thread.h" +#include "nsk_tools.hpp" +#include "JVMTITools.hpp" +#include "jvmti_tools.hpp" +#include "native_thread.hpp" extern "C" { @@ -179,7 +179,7 @@ static int initAgent(int indx) { NSK_DISPLAY1("\nagent %s initializer: obtaining the JVMTI env ...\n", (indx == 0) ? "A" : "B"); res = vm->GetEnv((void **) &jvmti[indx], JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti[indx] == NULL) { + if (res != JNI_OK || jvmti[indx] == nullptr) { NSK_COMPLAIN1("TEST FAILURE: failed to call GetEnv for the agent %s\n", (indx == 0) ? "A" : "B"); result = STATUS_FAILED; @@ -207,7 +207,7 @@ static int initAgent(int indx) { NSK_DISPLAY1("\nagent %s initializer: setting event callbacks done\n\tenabling events ...\n", (indx == 0) ? "A" : "B"); - err = jvmti[indx]->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL); + err = jvmti[indx]->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, nullptr); if (err != JVMTI_ERROR_NONE) { /* enable event globally */ NSK_COMPLAIN2("TEST FAILURE: failed to enable JVMTI_EVENT_VM_INIT event for the agent %s: %s\n", (indx == 0) ? "A" : "B", TranslateError(err)); @@ -227,7 +227,7 @@ static void startAgent(int indx) { (indx == 0) ? "A" : "B"); void* context = (void*) ((indx == 0) ? "agent A" : "agent B"); agentThr[indx] = THREAD_new((indx == 0) ? agentA : agentB, context); - if (THREAD_start(agentThr[indx]) == NULL) { + if (THREAD_start(agentThr[indx]) == nullptr) { NSK_COMPLAIN1("TEST FAILURE: cannot start the agent %s thread\n", (indx == 0) ? "A" : "B"); exit(STATUS_FAILED); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI06/ji06t001/ji06t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI06/ji06t001/ji06t001.cpp index d5dfc829d1b9..83a32bb2e4cc 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI06/ji06t001/ji06t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI06/ji06t001/ji06t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,12 +27,12 @@ #include #include -#include "agent_common.h" +#include "agent_common.hpp" -#include "nsk_tools.h" -#include "JVMTITools.h" -#include "jvmti_tools.h" -#include "native_thread.h" +#include "nsk_tools.hpp" +#include "JVMTITools.hpp" +#include "jvmti_tools.hpp" +#include "native_thread.hpp" extern "C" { @@ -59,7 +59,7 @@ static const char *classSig = "Lnsk/jvmti/scenarios/jni_interception/JI06/ji06t001a;"; static JavaVM *vm; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static volatile int verbose = 0; @@ -72,10 +72,10 @@ static volatile jobject clsObj; static jrawMonitorID countLock; /* the original JNI function table */ -static jniNativeInterface *orig_jni_functions = NULL; +static jniNativeInterface *orig_jni_functions = nullptr; /* the redirected JNI function table */ -static jniNativeInterface *redir_jni_functions = NULL; +static jniNativeInterface *redir_jni_functions = nullptr; /* number of the redirected JNI function calls */ static volatile int monent_calls = 0; @@ -315,21 +315,21 @@ Java_nsk_jvmti_scenarios_jni_1interception_JI06_ji06t001_check(JNIEnv *env, jobj char *ownContext = (char*) "ownerThr"; char *redirContext = (char*) "redirectorThr"; int exitCode = PASSED; - void *ownThr = NULL; - void *redirThr = NULL; + void *ownThr = nullptr; + void *redirThr = nullptr; void *waitThr[MAX_THREADS]; int waitContElem[MAX_THREADS]; /* context of a particular waiting thread */ int i; int tries = 0; - if (jvmti == NULL) { + if (jvmti == nullptr) { NSK_COMPLAIN0("TEST FAILURE: JVMTI client was not properly loaded\n"); return STATUS_FAILED; } /* prepare the testing */ clsObj = env->NewGlobalRef(getObjectFromField(env, obj)); - if (clsObj == NULL) { + if (clsObj == nullptr) { NSK_COMPLAIN1("TEST FAILURE: cannot create a new global reference of class \"%s\"\n", classSig); env->FatalError("failed to create a new global reference"); @@ -337,7 +337,7 @@ Java_nsk_jvmti_scenarios_jni_1interception_JI06_ji06t001_check(JNIEnv *env, jobj NSK_DISPLAY0("starting monitor owner thread ...\n"); ownThr = THREAD_new(ownerThread, ownContext); - if (THREAD_start(ownThr) == NULL) { + if (THREAD_start(ownThr) == nullptr) { NSK_COMPLAIN0("TEST FAILURE: cannot start monitor owner thread\n"); exit(STATUS_FAILED); } @@ -360,7 +360,7 @@ Java_nsk_jvmti_scenarios_jni_1interception_JI06_ji06t001_check(JNIEnv *env, jobj waitContElem[i] = i+1; /* 4932877 fix in accordance with ANSI C: thread context of type int -> int* -> void* */ waitThr[i] = THREAD_new(waitingThread, (void *) &(waitContElem[i])); - if (THREAD_start(waitThr[i]) == NULL) { + if (THREAD_start(waitThr[i]) == nullptr) { NSK_COMPLAIN1("TEST FAILURE: cannot start waiting thread #%d\n", i+1); exit(STATUS_FAILED); @@ -384,7 +384,7 @@ Java_nsk_jvmti_scenarios_jni_1interception_JI06_ji06t001_check(JNIEnv *env, jobj NSK_DISPLAY0(">>> TEST CASE a) Trying to redirect the JNI function ...\n\n" "starting redirector thread ...\n"); redirThr = THREAD_new(redirectorThread, redirContext); - if (THREAD_start(redirThr) == NULL) { + if (THREAD_start(redirThr) == nullptr) { NSK_COMPLAIN0("TEST FAILURE: cannot start redirector thread\n"); exit(STATUS_FAILED); } @@ -431,7 +431,7 @@ Java_nsk_jvmti_scenarios_jni_1interception_JI06_ji06t001_check(JNIEnv *env, jobj /* 4932877 fix in accordance with ANSI C: thread context of type int -> int* -> void* */ waitThr[MAX_THREADS-1] = THREAD_new(waitingThread, (void *) &(waitContElem[MAX_THREADS-1])); - if (THREAD_start(waitThr[MAX_THREADS-1]) == NULL) { + if (THREAD_start(waitThr[MAX_THREADS-1]) == nullptr) { NSK_COMPLAIN0("TEST FAILURE: cannot start verification thread\n"); exit(STATUS_FAILED); } @@ -482,7 +482,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; vm = jvm; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA01/ma01t001/ma01t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA01/ma01t001/ma01t001.cpp index 56bf54b2a942..01fd4b40564a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA01/ma01t001/ma01t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA01/ma01t001/ma01t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" #define PASSED 0 #define STATUS_FAILED 2 @@ -69,9 +69,9 @@ JNIEXPORT jint JNI_OnLoad_ma01t001(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiEventCallbacks callbacks; - const char* name = NULL; + const char* name = nullptr; int found = NSK_FALSE; int i, count; @@ -97,10 +97,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&callbacks, 0, sizeof(callbacks)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA01/ma01t001/ma01t001a.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA01/ma01t001/ma01t001a.cpp index 800aebecd874..cc77d601568c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA01/ma01t001/ma01t001a.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA01/ma01t001/ma01t001a.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" #define PASSED 0 #define STATUS_FAILED 2 @@ -69,9 +69,9 @@ JNIEXPORT jint JNI_OnLoad_ma01t001a(JavaVM *jvm, char *options, void *reserved) } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiEventCallbacks callbacks; - const char* name = NULL; + const char* name = nullptr; int found = NSK_FALSE; int i, count; @@ -97,10 +97,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&callbacks, 0, sizeof(callbacks)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA02/ma02t001/ma02t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA02/ma02t001/ma02t001.cpp index 464a8186b515..b4c638460f5d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA02/ma02t001/ma02t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA02/ma02t001/ma02t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" #define PASSED 0 #define STATUS_FAILED 2 @@ -91,7 +91,7 @@ JNIEXPORT jint JNI_OnLoad_ma02t001(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiEventCallbacks callbacks; NSK_DISPLAY0("Agent_OnLoad\n"); @@ -102,10 +102,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&callbacks, 0, sizeof(callbacks)); @@ -114,10 +114,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_VERIFY(nsk_jvmti_init_MA(&callbacks))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, nullptr))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA02/ma02t001/ma02t001a.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA02/ma02t001/ma02t001a.cpp index 2d850db5d8c4..fbe59eb4ba75 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA02/ma02t001/ma02t001a.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA02/ma02t001/ma02t001a.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" #define PASSED 0 #define STATUS_FAILED 2 @@ -91,7 +91,7 @@ JNIEXPORT jint JNI_OnLoad_ma02t001a(JavaVM *jvm, char *options, void *reserved) } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiEventCallbacks callbacks; NSK_DISPLAY0("Agent_OnLoad\n"); @@ -102,10 +102,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&callbacks, 0, sizeof(callbacks)); @@ -114,10 +114,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_VERIFY(nsk_jvmti_init_MA(&callbacks))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, nullptr))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA03/ma03t001/ma03t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA03/ma03t001/ma03t001.cpp index cb10b246b30b..a09722b7b40a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA03/ma03t001/ma03t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA03/ma03t001/ma03t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" #define PASSED 0 #define STATUS_FAILED 2 @@ -102,7 +102,7 @@ JNIEXPORT jint JNI_OnLoad_ma03t001(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiEventCallbacks callbacks; NSK_DISPLAY0("Agent_OnLoad\n"); @@ -113,10 +113,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&callbacks, 0, sizeof(callbacks)); @@ -126,13 +126,13 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_VERIFY(nsk_jvmti_init_MA(&callbacks))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, nullptr))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, nullptr))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA03/ma03t001/ma03t001a.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA03/ma03t001/ma03t001a.cpp index ec744e3bddef..d75b0da0f0cf 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA03/ma03t001/ma03t001a.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA03/ma03t001/ma03t001a.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" #define PASSED 0 #define STATUS_FAILED 2 @@ -103,7 +103,7 @@ JNIEXPORT jint JNI_OnLoad_ma03t001a(JavaVM *jvm, char *options, void *reserved) } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiEventCallbacks callbacks; NSK_DISPLAY0("Agent_OnLoad\n"); @@ -114,10 +114,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&callbacks, 0, sizeof(callbacks)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t001/ma04t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t001/ma04t001.cpp index 937daddbd390..d9cedfaa4fdb 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t001/ma04t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t001/ma04t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" #define PASSED 0 #define STATUS_FAILED 2 @@ -39,7 +39,7 @@ extern "C" { static jlong timeout = 0; /* test objects */ -static jobject testedObject = NULL; +static jobject testedObject = nullptr; /* ========================================================================== */ @@ -47,24 +47,24 @@ static int prepare(JNIEnv* jni) { const char* CLASS_NAME = "nsk/jvmti/scenarios/multienv/MA04/ma04t001"; const char* FIELD_NAME = "testedObject"; const char* FIELD_SIGNATURE = "Ljava/lang/Object;"; - jclass cls = NULL; - jfieldID fid = NULL; + jclass cls = nullptr; + jfieldID fid = nullptr; 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 = jni->FindClass(CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(CLASS_NAME)) != nullptr)) return NSK_FALSE; NSK_DISPLAY2("Find field: %s:%s\n", FIELD_NAME, FIELD_SIGNATURE); if (!NSK_JNI_VERIFY(jni, (fid = - jni->GetStaticFieldID(cls, FIELD_NAME, FIELD_SIGNATURE)) != NULL)) + jni->GetStaticFieldID(cls, FIELD_NAME, FIELD_SIGNATURE)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (testedObject = jni->GetStaticObjectField(cls, fid)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (testedObject = jni->GetStaticObjectField(cls, fid)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (testedObject = jni->NewGlobalRef(testedObject)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (testedObject = jni->NewGlobalRef(testedObject)) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -200,7 +200,7 @@ JNIEXPORT jint JNI_OnLoad_ma04t001(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiEventCallbacks callbacks; jvmtiCapabilities caps; @@ -212,7 +212,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; memset(&caps, 0, sizeof(caps)); @@ -221,7 +221,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&callbacks, 0, sizeof(callbacks)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t001/ma04t001a.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t001/ma04t001a.cpp index cbc5bc9054f4..9b60f2a12582 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t001/ma04t001a.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t001/ma04t001a.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" #define PASSED 0 #define STATUS_FAILED 2 @@ -39,7 +39,7 @@ extern "C" { static jlong timeout = 0; /* test objects */ -static jobject testedObject = NULL; +static jobject testedObject = nullptr; /* ========================================================================== */ @@ -47,24 +47,24 @@ static int prepare(JNIEnv* jni) { const char* CLASS_NAME = "nsk/jvmti/scenarios/multienv/MA04/ma04t001"; const char* FIELD_NAME = "testedObject"; const char* FIELD_SIGNATURE = "Ljava/lang/Object;"; - jclass cls = NULL; - jfieldID fid = NULL; + jclass cls = nullptr; + jfieldID fid = nullptr; 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 = jni->FindClass(CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(CLASS_NAME)) != nullptr)) return NSK_FALSE; NSK_DISPLAY2("Find field: %s:%s\n", FIELD_NAME, FIELD_SIGNATURE); if (!NSK_JNI_VERIFY(jni, (fid = - jni->GetStaticFieldID(cls, FIELD_NAME, FIELD_SIGNATURE)) != NULL)) + jni->GetStaticFieldID(cls, FIELD_NAME, FIELD_SIGNATURE)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (testedObject = jni->GetStaticObjectField(cls, fid)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (testedObject = jni->GetStaticObjectField(cls, fid)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (testedObject = jni->NewGlobalRef(testedObject)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (testedObject = jni->NewGlobalRef(testedObject)) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -200,7 +200,7 @@ JNIEXPORT jint JNI_OnLoad_ma04t001a(JavaVM *jvm, char *options, void *reserved) } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiEventCallbacks callbacks; jvmtiCapabilities caps; @@ -212,7 +212,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; memset(&caps, 0, sizeof(caps)); @@ -221,7 +221,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&callbacks, 0, sizeof(callbacks)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t002/ma04t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t002/ma04t002.cpp index 2091ef57ca6c..52459a7994fc 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t002/ma04t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t002/ma04t002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" #define PASSED 0 #define STATUS_FAILED 2 @@ -39,9 +39,9 @@ extern "C" { static jlong timeout = 0; /* test objects */ -static jobject testedObject = NULL; -static jobject testedInstance = NULL; -static jclass testedClass = NULL; +static jobject testedObject = nullptr; +static jobject testedInstance = nullptr; +static jclass testedClass = nullptr; static int ObjectsCount = 0; /* ========================================================================== */ @@ -76,33 +76,33 @@ static int prepare(JNIEnv* jni) { const char* FIELD_SIGNATURE = "Ljava/lang/Object;"; const char* INSTANCE_NAME = "testedInstance1"; const char* INSTANCE_SIGNATURE = "Lnsk/jvmti/scenarios/multienv/MA04/ma04t002;"; - jfieldID fid = NULL; + jfieldID fid = nullptr; 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 = jni->FindClass(CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (testedClass = jni->FindClass(CLASS_NAME)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (testedClass = (jclass) jni->NewGlobalRef(testedClass)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (testedClass = (jclass) jni->NewGlobalRef(testedClass)) != nullptr)) return NSK_FALSE; NSK_DISPLAY2("Find field: %s:%s\n", FIELD_NAME, FIELD_SIGNATURE); if (!NSK_JNI_VERIFY(jni, (fid = - jni->GetStaticFieldID(testedClass, FIELD_NAME, FIELD_SIGNATURE)) != NULL)) + jni->GetStaticFieldID(testedClass, FIELD_NAME, FIELD_SIGNATURE)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (testedObject = jni->GetStaticObjectField(testedClass, fid)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (testedObject = jni->GetStaticObjectField(testedClass, fid)) != nullptr)) return NSK_FALSE; NSK_DISPLAY2("Find class instance: %s:%s\n", INSTANCE_NAME, INSTANCE_SIGNATURE); if (!NSK_JNI_VERIFY(jni, (fid = - jni->GetStaticFieldID(testedClass, INSTANCE_NAME, INSTANCE_SIGNATURE)) != NULL)) + jni->GetStaticFieldID(testedClass, INSTANCE_NAME, INSTANCE_SIGNATURE)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (testedInstance = - jni->GetStaticObjectField(testedClass, fid)) != NULL)) + jni->GetStaticObjectField(testedClass, fid)) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -305,7 +305,7 @@ JNIEXPORT jint JNI_OnLoad_ma04t002(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiEventCallbacks callbacks; jvmtiCapabilities caps; @@ -317,7 +317,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; memset(&caps, 0, sizeof(caps)); @@ -327,14 +327,14 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&callbacks, 0, sizeof(callbacks)); if (!NSK_VERIFY(nsk_jvmti_init_MA(&callbacks))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t002/ma04t002a.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t002/ma04t002a.cpp index cd639c1fd78e..7f716d009ce8 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t002/ma04t002a.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t002/ma04t002a.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" #define PASSED 0 #define STATUS_FAILED 2 @@ -39,9 +39,9 @@ extern "C" { static jlong timeout = 0; /* test objects */ -static jobject testedObject = NULL; -static jobject testedInstance = NULL; -static jclass testedClass = NULL; +static jobject testedObject = nullptr; +static jobject testedInstance = nullptr; +static jclass testedClass = nullptr; static int ObjectsCount = 0; /* ========================================================================== */ @@ -76,33 +76,33 @@ static int prepare(JNIEnv* jni) { const char* FIELD_SIGNATURE = "Ljava/lang/Object;"; const char* INSTANCE_NAME = "testedInstance2"; const char* INSTANCE_SIGNATURE = "Lnsk/jvmti/scenarios/multienv/MA04/ma04t002;"; - jfieldID fid = NULL; + jfieldID fid = nullptr; 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 = jni->FindClass(CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (testedClass = jni->FindClass(CLASS_NAME)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (testedClass = (jclass) jni->NewGlobalRef(testedClass)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (testedClass = (jclass) jni->NewGlobalRef(testedClass)) != nullptr)) return NSK_FALSE; NSK_DISPLAY2("Find field: %s:%s\n", FIELD_NAME, FIELD_SIGNATURE); if (!NSK_JNI_VERIFY(jni, (fid = - jni->GetStaticFieldID(testedClass, FIELD_NAME, FIELD_SIGNATURE)) != NULL)) + jni->GetStaticFieldID(testedClass, FIELD_NAME, FIELD_SIGNATURE)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (testedObject = jni->GetStaticObjectField(testedClass, fid)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (testedObject = jni->GetStaticObjectField(testedClass, fid)) != nullptr)) return NSK_FALSE; NSK_DISPLAY2("Find class instance: %s:%s\n", INSTANCE_NAME, INSTANCE_SIGNATURE); if (!NSK_JNI_VERIFY(jni, (fid = - jni->GetStaticFieldID(testedClass, INSTANCE_NAME, INSTANCE_SIGNATURE)) != NULL)) + jni->GetStaticFieldID(testedClass, INSTANCE_NAME, INSTANCE_SIGNATURE)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (testedInstance = - jni->GetStaticObjectField(testedClass, fid)) != NULL)) + jni->GetStaticObjectField(testedClass, fid)) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -303,7 +303,7 @@ JNIEXPORT jint JNI_OnLoad_ma04t002a(JavaVM *jvm, char *options, void *reserved) } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiEventCallbacks callbacks; jvmtiCapabilities caps; @@ -315,7 +315,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; memset(&caps, 0, sizeof(caps)); @@ -325,14 +325,14 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&callbacks, 0, sizeof(callbacks)); if (!NSK_VERIFY(nsk_jvmti_init_MA(&callbacks))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t003/ma04t003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t003/ma04t003.cpp index af2922e055b9..cf4a492372d4 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t003/ma04t003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t003/ma04t003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" #define PASSED 0 #define STATUS_FAILED 2 @@ -39,7 +39,7 @@ extern "C" { static jlong timeout = 0; /* test objects */ -static jobject testedObject = NULL; +static jobject testedObject = nullptr; static int ObjectFreeEventsCount = 0; /* ========================================================================== */ @@ -82,24 +82,24 @@ static int prepare(JNIEnv* jni) { const char* CLASS_NAME = "nsk/jvmti/scenarios/multienv/MA04/ma04t003"; const char* FIELD_NAME = "testedObject1"; const char* FIELD_SIGNATURE = "Ljava/lang/Object;"; - jclass cls = NULL; - jfieldID fid = NULL; + jclass cls = nullptr; + jfieldID fid = nullptr; 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 = jni->FindClass(CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(CLASS_NAME)) != nullptr)) return NSK_FALSE; NSK_DISPLAY2("Find field: %s:%s\n", FIELD_NAME, FIELD_SIGNATURE); if (!NSK_JNI_VERIFY(jni, (fid = - jni->GetStaticFieldID(cls, FIELD_NAME, FIELD_SIGNATURE)) != NULL)) + jni->GetStaticFieldID(cls, FIELD_NAME, FIELD_SIGNATURE)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (testedObject = jni->GetStaticObjectField(cls, fid)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (testedObject = jni->GetStaticObjectField(cls, fid)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (testedObject = jni->NewGlobalRef(testedObject)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (testedObject = jni->NewGlobalRef(testedObject)) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -146,7 +146,7 @@ JNIEXPORT jint JNI_OnLoad_ma04t003(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiEventCallbacks callbacks; jvmtiCapabilities caps; @@ -158,7 +158,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; memset(&caps, 0, sizeof(caps)); @@ -168,7 +168,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&callbacks, 0, sizeof(callbacks)); @@ -177,10 +177,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_VERIFY(nsk_jvmti_init_MA(&callbacks))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, nullptr))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t003/ma04t003a.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t003/ma04t003a.cpp index 3df2bf2c0b9d..5345b56cba59 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t003/ma04t003a.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t003/ma04t003a.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" #define PASSED 0 #define STATUS_FAILED 2 @@ -39,7 +39,7 @@ extern "C" { static jlong timeout = 0; /* test objects */ -static jobject testedObject = NULL; +static jobject testedObject = nullptr; static int ObjectFreeEventsCount = 0; /* ========================================================================== */ @@ -82,24 +82,24 @@ static int prepare(JNIEnv* jni) { const char* CLASS_NAME = "nsk/jvmti/scenarios/multienv/MA04/ma04t003"; const char* FIELD_NAME = "testedObject2"; const char* FIELD_SIGNATURE = "Ljava/lang/Object;"; - jclass cls = NULL; - jfieldID fid = NULL; + jclass cls = nullptr; + jfieldID fid = nullptr; 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 = jni->FindClass(CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(CLASS_NAME)) != nullptr)) return NSK_FALSE; NSK_DISPLAY2("Find field: %s:%s\n", FIELD_NAME, FIELD_SIGNATURE); if (!NSK_JNI_VERIFY(jni, (fid = - jni->GetStaticFieldID(cls, FIELD_NAME, FIELD_SIGNATURE)) != NULL)) + jni->GetStaticFieldID(cls, FIELD_NAME, FIELD_SIGNATURE)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (testedObject = jni->GetStaticObjectField(cls, fid)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (testedObject = jni->GetStaticObjectField(cls, fid)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (testedObject = jni->NewGlobalRef(testedObject)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (testedObject = jni->NewGlobalRef(testedObject)) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -146,7 +146,7 @@ JNIEXPORT jint JNI_OnLoad_ma04t003a(JavaVM *jvm, char *options, void *reserved) } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiEventCallbacks callbacks; jvmtiCapabilities caps; @@ -158,7 +158,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; memset(&caps, 0, sizeof(caps)); @@ -168,7 +168,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&callbacks, 0, sizeof(callbacks)); @@ -177,10 +177,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_VERIFY(nsk_jvmti_init_MA(&callbacks))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, nullptr))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA05/ma05t001/ma05t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA05/ma05t001/ma05t001.cpp index 6c07c02a5d1c..45d968d4c7ed 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA05/ma05t001/ma05t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA05/ma05t001/ma05t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" #define PASSED 0 #define STATUS_FAILED 2 @@ -38,8 +38,8 @@ extern "C" { static jlong timeout = 0; /* test objects */ -static jthread thread = NULL; -static jmethodID method = NULL; +static jthread thread = nullptr; +static jmethodID method = nullptr; static int BreakpointEventsCount = 0; static int FramePopEventsCount = 0; @@ -50,19 +50,19 @@ static int FramePopEventsCount = 0; static void JNICALL Breakpoint(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jthread thread, jmethodID method, jlocation location) { - char *name = NULL; - char *signature = NULL; + char *name = nullptr; + char *signature = nullptr; BreakpointEventsCount++; - if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, nullptr))) { nsk_jvmti_setFailStatus(); } NSK_DISPLAY2("Breakpoint event: %s%s\n", name, signature); - if (name != NULL) + if (name != nullptr) jvmti_env->Deallocate((unsigned char*)name); - if (signature != NULL) + if (signature != nullptr) jvmti_env->Deallocate((unsigned char*)signature); switch (BreakpointEventsCount) { @@ -93,20 +93,20 @@ static void JNICALL FramePop(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jthread thread, jmethodID method, jboolean wasPopedByException) { - char *name = NULL; - char *signature = NULL; + char *name = nullptr; + char *signature = nullptr; FramePopEventsCount++; - if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, nullptr))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY2("FramePop event: %s%s\n", name, signature); - if (name != NULL) + if (name != nullptr) jvmti_env->Deallocate((unsigned char*)name); - if (signature != NULL) + if (signature != nullptr) jvmti_env->Deallocate((unsigned char*)signature); } @@ -115,8 +115,8 @@ FramePop(jvmtiEnv *jvmti_env, JNIEnv *jni_env, static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { const char* THREAD_NAME = "Debuggee Thread"; jvmtiThreadInfo info; - jthread *threads = NULL; - jclass klass = NULL; + jthread *threads = nullptr; + jclass klass = nullptr; jint threads_count = 0; int i; @@ -126,12 +126,12 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -141,11 +141,11 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL && (strcmp(info.name, THREAD_NAME) == 0)) { + if (info.name != nullptr && (strcmp(info.name, THREAD_NAME) == 0)) { thread = threads[i]; } - if (info.name != NULL) { + if (info.name != nullptr) { if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)info.name))) return NSK_FALSE; } @@ -155,29 +155,29 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads))) return NSK_FALSE; - if (thread == NULL) { + if (thread == nullptr) { NSK_COMPLAIN0("Debuggee thread not found"); return NSK_FALSE; } - if (!NSK_JNI_VERIFY(jni, (thread = jni->NewGlobalRef(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (thread = jni->NewGlobalRef(thread)) != nullptr)) return NSK_FALSE; /* get tested thread class */ - if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != nullptr)) return NSK_FALSE; /* get tested thread method 'checkPoint' */ - if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "checkPoint", "()V")) != NULL)) + if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "checkPoint", "()V")) != nullptr)) return NSK_FALSE; if (!NSK_JVMTI_VERIFY(jvmti->SetBreakpoint(method, 0))) return NSK_FALSE; /* enable events */ - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, nullptr))) return NSK_FALSE; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FRAME_POP, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FRAME_POP, nullptr))) return NSK_FALSE; return NSK_TRUE; @@ -212,7 +212,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { nsk_jvmti_setFailStatus(); } - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_FRAME_POP, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_FRAME_POP, nullptr))) nsk_jvmti_setFailStatus(); NSK_TRACE(jvmti->ClearBreakpoint(method, 0)); @@ -237,7 +237,7 @@ JNIEXPORT jint JNI_OnLoad_ma05t001(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiEventCallbacks callbacks; jvmtiCapabilities caps; @@ -249,7 +249,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; memset(&caps, 0, sizeof(caps)); @@ -258,7 +258,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&callbacks, 0, sizeof(callbacks)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA05/ma05t001/ma05t001a.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA05/ma05t001/ma05t001a.cpp index 785cdeb6018c..1f4d927eff5f 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA05/ma05t001/ma05t001a.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA05/ma05t001/ma05t001a.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" #define PASSED 0 #define STATUS_FAILED 2 @@ -38,8 +38,8 @@ extern "C" { static jlong timeout = 0; /* test objects */ -static jthread thread = NULL; -static jmethodID midCheckPoint = NULL; +static jthread thread = nullptr; +static jmethodID midCheckPoint = nullptr; static int MethodEntryEventsCount = 0; static int FramePopEventsCount = 0; @@ -50,23 +50,23 @@ static int FramePopEventsCount = 0; static void JNICALL MethodEntry(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jthread thread, jmethodID method) { - char *name = NULL; - char *signature = NULL; + char *name = nullptr; + char *signature = nullptr; if (method != midCheckPoint) return; MethodEntryEventsCount++; - if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, nullptr))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY2("MethodEntry event: %s%s\n", name, signature); - if (name != NULL) + if (name != nullptr) jvmti_env->Deallocate((unsigned char*)name); - if (signature != NULL) + if (signature != nullptr) jvmti_env->Deallocate((unsigned char*)signature); switch (MethodEntryEventsCount) { @@ -82,7 +82,7 @@ MethodEntry(jvmtiEnv *jvmti_env, JNIEnv *jni_env, case 3: NSK_DISPLAY0("Testcase #3: FramePop disabled in 2nd agent\n"); - if (!NSK_JVMTI_VERIFY(jvmti_env->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_FRAME_POP, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti_env->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_FRAME_POP, nullptr))) nsk_jvmti_setFailStatus(); if (!NSK_JVMTI_VERIFY(jvmti_env->NotifyFramePop(thread, 0))) nsk_jvmti_setFailStatus(); @@ -99,20 +99,20 @@ static void JNICALL FramePop(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jthread thread, jmethodID method, jboolean wasPopedByException) { - char *name = NULL; - char *signature = NULL; + char *name = nullptr; + char *signature = nullptr; FramePopEventsCount++; - if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, nullptr))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY2("FramePop event: %s%s\n", name, signature); - if (name != NULL) + if (name != nullptr) jvmti_env->Deallocate((unsigned char*)name); - if (signature != NULL) + if (signature != nullptr) jvmti_env->Deallocate((unsigned char*)signature); switch (MethodEntryEventsCount) { @@ -142,8 +142,8 @@ FramePop(jvmtiEnv *jvmti_env, JNIEnv *jni_env, static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { const char* THREAD_NAME = "Debuggee Thread"; jvmtiThreadInfo info; - jthread *threads = NULL; - jclass klass = NULL; + jthread *threads = nullptr; + jclass klass = nullptr; jint threads_count = 0; int i; @@ -153,12 +153,12 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -168,11 +168,11 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL && (strcmp(info.name, THREAD_NAME) == 0)) { + if (info.name != nullptr && (strcmp(info.name, THREAD_NAME) == 0)) { thread = threads[i]; } - if (info.name != NULL) { + if (info.name != nullptr) { if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)info.name))) return NSK_FALSE; } @@ -182,26 +182,26 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads))) return NSK_FALSE; - if (thread == NULL) { + if (thread == nullptr) { NSK_COMPLAIN0("Debuggee thread not found"); return NSK_FALSE; } - if (!NSK_JNI_VERIFY(jni, (thread = jni->NewGlobalRef(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (thread = jni->NewGlobalRef(thread)) != nullptr)) return NSK_FALSE; /* get tested thread class */ - if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != nullptr)) return NSK_FALSE; /* get tested thread method 'checkPoint' */ - if (!NSK_JNI_VERIFY(jni, (midCheckPoint = jni->GetMethodID(klass, "checkPoint", "()V")) != NULL)) + if (!NSK_JNI_VERIFY(jni, (midCheckPoint = jni->GetMethodID(klass, "checkPoint", "()V")) != nullptr)) return NSK_FALSE; /* enable events */ - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_ENTRY, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_ENTRY, nullptr))) return NSK_FALSE; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FRAME_POP, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FRAME_POP, nullptr))) return NSK_FALSE; return NSK_TRUE; @@ -233,7 +233,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } NSK_TRACE(jni->DeleteGlobalRef(thread)); - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_METHOD_ENTRY, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_METHOD_ENTRY, nullptr))) nsk_jvmti_setFailStatus(); if (!nsk_jvmti_resumeSync()) @@ -255,7 +255,7 @@ JNIEXPORT jint JNI_OnLoad_ma05t001a(JavaVM *jvm, char *options, void *reserved) } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiEventCallbacks callbacks; jvmtiCapabilities caps; @@ -267,7 +267,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; memset(&caps, 0, sizeof(caps)); @@ -276,7 +276,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&callbacks, 0, sizeof(callbacks)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA06/ma06t001/ma06t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA06/ma06t001/ma06t001.cpp index 812d8e09ab9c..75edd25bcbd9 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA06/ma06t001/ma06t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA06/ma06t001/ma06t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" #define PASSED 0 #define STATUS_FAILED 2 @@ -38,9 +38,9 @@ extern "C" { static jlong timeout = 0; /* test objects */ -static jclass testedClass = NULL; +static jclass testedClass = nullptr; static jint klass_byte_count = 0; -static unsigned char *klass_bytes = NULL; +static unsigned char *klass_bytes = nullptr; static int magicIndex = 0; static int ClassFileLoadHookEventFlag = NSK_FALSE; @@ -59,11 +59,11 @@ ClassFileLoadHook(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jint *new_class_data_len, unsigned char** new_class_data) { jint i; - if (name != NULL && (strcmp(name, CLASS_NAME) == 0)) { + if (name != nullptr && (strcmp(name, CLASS_NAME) == 0)) { ClassFileLoadHookEventFlag = NSK_TRUE; NSK_DISPLAY0("ClassFileLoadHook event\n"); - if (class_being_redefined == NULL) { + if (class_being_redefined == nullptr) { /* sent by class load */ if (!NSK_JVMTI_VERIFY(jvmti_env->Allocate(class_data_len, &klass_bytes))) nsk_jvmti_setFailStatus(); @@ -93,10 +93,10 @@ ClassFileLoadHook(jvmtiEnv *jvmti_env, JNIEnv *jni_env, static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { NSK_DISPLAY1("Find class: %s\n", CLASS_NAME); - if (!NSK_JNI_VERIFY(jni, (testedClass = jni->FindClass(CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (testedClass = jni->FindClass(CLASS_NAME)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (testedClass = (jclass) jni->NewGlobalRef(testedClass)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (testedClass = (jclass) jni->NewGlobalRef(testedClass)) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -107,7 +107,7 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { static int redefine(jvmtiEnv* jvmti, jint value) { jvmtiClassDefinition class_def; - if (!NSK_VERIFY(klass_byte_count != 0 && klass_bytes != NULL)) + if (!NSK_VERIFY(klass_byte_count != 0 && klass_bytes != nullptr)) return NSK_FALSE; if (!NSK_VERIFY(magicIndex != 0)) @@ -178,7 +178,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { nsk_jvmti_setFailStatus(); } - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, nullptr))) nsk_jvmti_setFailStatus(); NSK_TRACE(jni->DeleteGlobalRef(testedClass)); @@ -202,7 +202,7 @@ JNIEXPORT jint JNI_OnLoad_ma06t001(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiEventCallbacks callbacks; jvmtiCapabilities caps; @@ -214,7 +214,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; memset(&caps, 0, sizeof(caps)); @@ -222,7 +222,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&callbacks, 0, sizeof(callbacks)); @@ -230,7 +230,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_VERIFY(nsk_jvmti_init_MA(&callbacks))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA06/ma06t001/ma06t001a.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA06/ma06t001/ma06t001a.cpp index 9d97aa5f2cbb..a58f6b414221 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA06/ma06t001/ma06t001a.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA06/ma06t001/ma06t001a.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" #define PASSED 0 #define STATUS_FAILED 2 @@ -38,9 +38,9 @@ extern "C" { static jlong timeout = 0; /* test objects */ -static jclass testedClass = NULL; +static jclass testedClass = nullptr; static jint klass_byte_count = 0; -static unsigned char *klass_bytes = NULL; +static unsigned char *klass_bytes = nullptr; static int magicIndex = 0; static int ClassFileLoadHookEventFlag = NSK_FALSE; @@ -59,11 +59,11 @@ ClassFileLoadHook(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jint *new_class_data_len, unsigned char** new_class_data) { jint i; - if (name != NULL && (strcmp(name, CLASS_NAME) == 0)) { + if (name != nullptr && (strcmp(name, CLASS_NAME) == 0)) { ClassFileLoadHookEventFlag = NSK_TRUE; NSK_DISPLAY0("ClassFileLoadHook event\n"); - if (class_being_redefined == NULL) { + if (class_being_redefined == nullptr) { /* sent by class load */ if (!NSK_JVMTI_VERIFY(jvmti_env->Allocate(class_data_len, &klass_bytes))) nsk_jvmti_setFailStatus(); @@ -93,10 +93,10 @@ ClassFileLoadHook(jvmtiEnv *jvmti_env, JNIEnv *jni_env, static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { NSK_DISPLAY1("Find class: %s\n", CLASS_NAME); - if (!NSK_JNI_VERIFY(jni, (testedClass = jni->FindClass(CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (testedClass = jni->FindClass(CLASS_NAME)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (testedClass = (jclass) jni->NewGlobalRef(testedClass)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (testedClass = (jclass) jni->NewGlobalRef(testedClass)) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -107,7 +107,7 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { static int redefine(jvmtiEnv* jvmti, jint value) { jvmtiClassDefinition class_def; - if (!NSK_VERIFY(klass_byte_count != 0 && klass_bytes != NULL)) + if (!NSK_VERIFY(klass_byte_count != 0 && klass_bytes != nullptr)) return NSK_FALSE; if (!NSK_VERIFY(magicIndex != 0)) @@ -178,7 +178,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { nsk_jvmti_setFailStatus(); } - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, nullptr))) nsk_jvmti_setFailStatus(); NSK_TRACE(jni->DeleteGlobalRef(testedClass)); @@ -202,7 +202,7 @@ JNIEXPORT jint JNI_OnLoad_ma06t001a(JavaVM *jvm, char *options, void *reserved) } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiEventCallbacks callbacks; jvmtiCapabilities caps; @@ -214,7 +214,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; memset(&caps, 0, sizeof(caps)); @@ -222,7 +222,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&callbacks, 0, sizeof(callbacks)); @@ -230,7 +230,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_VERIFY(nsk_jvmti_init_MA(&callbacks))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA07/ma07t001/ma07t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA07/ma07t001/ma07t001.cpp index 0fa045ead943..1d64b011f6c4 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA07/ma07t001/ma07t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA07/ma07t001/ma07t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" #define PASSED 0 #define STATUS_FAILED 2 @@ -39,7 +39,7 @@ static jlong timeout = 0; /* test objects */ static jint klass_byte_count = 0; -static unsigned char *klass_bytes = NULL; +static unsigned char *klass_bytes = nullptr; static int ClassFileLoadHookEventFlag = NSK_FALSE; const char* CLASS_NAME = "nsk/jvmti/scenarios/multienv/MA07/ma07t001a"; @@ -62,11 +62,11 @@ ClassFileLoadHook(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jint magicIndex = 0; jint i; - if (name != NULL && (strcmp(name, CLASS_NAME) == 0)) { + if (name != nullptr && (strcmp(name, CLASS_NAME) == 0)) { ClassFileLoadHookEventFlag = NSK_TRUE; NSK_DISPLAY0("ClassFileLoadHook event\n"); - if (!NSK_VERIFY(class_being_redefined == NULL)) { + if (!NSK_VERIFY(class_being_redefined == nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -151,7 +151,7 @@ JNIEXPORT jint JNI_OnLoad_ma07t001(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiEventCallbacks callbacks; NSK_DISPLAY0("Agent_OnLoad\n"); @@ -162,10 +162,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&callbacks, 0, sizeof(callbacks)); @@ -173,7 +173,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_VERIFY(nsk_jvmti_init_MA(&callbacks))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA07/ma07t001/ma07t001a.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA07/ma07t001/ma07t001a.cpp index fe5965ba627f..0f8a27bd50ed 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA07/ma07t001/ma07t001a.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA07/ma07t001/ma07t001a.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" #define PASSED 0 #define STATUS_FAILED 2 @@ -39,7 +39,7 @@ static jlong timeout = 0; /* test objects */ static jint klass_byte_count = 0; -static unsigned char *klass_bytes = NULL; +static unsigned char *klass_bytes = nullptr; static int ClassFileLoadHookEventFlag = NSK_FALSE; const char* CLASS_NAME = "nsk/jvmti/scenarios/multienv/MA07/ma07t001a"; @@ -62,11 +62,11 @@ ClassFileLoadHook(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jint magicIndex = 0; jint i; - if (name != NULL && (strcmp(name, CLASS_NAME) == 0)) { + if (name != nullptr && (strcmp(name, CLASS_NAME) == 0)) { ClassFileLoadHookEventFlag = NSK_TRUE; NSK_DISPLAY0("ClassFileLoadHook event\n"); - if (!NSK_VERIFY(class_being_redefined == NULL)) { + if (!NSK_VERIFY(class_being_redefined == nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -152,7 +152,7 @@ JNIEXPORT jint JNI_OnLoad_ma07t001a(JavaVM *jvm, char *options, void *reserved) } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiEventCallbacks callbacks; NSK_DISPLAY0("Agent_OnLoad\n"); @@ -163,10 +163,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&callbacks, 0, sizeof(callbacks)); @@ -174,7 +174,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_VERIFY(nsk_jvmti_init_MA(&callbacks))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA08/ma08t001/ma08t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA08/ma08t001/ma08t001.cpp index fd6d56029d30..97a71e18c407 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA08/ma08t001/ma08t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA08/ma08t001/ma08t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" #define PASSED 0 #define STATUS_FAILED 2 @@ -38,9 +38,9 @@ extern "C" { static jlong timeout = 0; /* test objects */ -static jobject threadDeath = NULL; -static jthread threadForStop = NULL; -static jthread threadForInterrupt = NULL; +static jobject threadDeath = nullptr; +static jthread threadForStop = nullptr; +static jthread threadForInterrupt = nullptr; /* ========================================================================== */ @@ -51,10 +51,10 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { const char* THREAD_DEATH_CTOR_NAME = ""; const char* THREAD_DEATH_CTOR_SIGNATURE = "()V"; jvmtiThreadInfo info; - jthread *threads = NULL; + jthread *threads = nullptr; jint threads_count = 0; - jclass cls = NULL; - jmethodID ctor = NULL; + jclass cls = nullptr; + jmethodID ctor = nullptr; int i; NSK_DISPLAY0("Prepare: find tested thread\n"); @@ -63,12 +63,12 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -78,7 +78,7 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL) { + if (info.name != nullptr) { if (strcmp(info.name, STOP_THREAD_NAME) == 0) { threadForStop = threads[i]; } else if (strcmp(info.name, INTERRUPT_THREAD_NAME) == 0) { @@ -91,26 +91,26 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads))) return NSK_FALSE; - if (threadForStop == NULL) { + if (threadForStop == nullptr) { NSK_COMPLAIN0("DebuggeeThreadForStop not found"); return NSK_FALSE; } - if (threadForInterrupt == NULL) { + if (threadForInterrupt == nullptr) { NSK_COMPLAIN0("DebuggeeThreadForInterrupt not found"); return NSK_FALSE; } NSK_DISPLAY0("Prepare: create new instance of ThreadDeath exception\n"); - if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(THREAD_DEATH_CLASS_NAME)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (ctor = - jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != NULL)) + jni->GetMethodID(cls, THREAD_DEATH_CTOR_NAME, THREAD_DEATH_CTOR_SIGNATURE)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (threadDeath = jni->NewObject(cls, ctor)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (threadDeath = jni->NewObject(cls, ctor)) != nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -131,7 +131,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } NSK_DISPLAY0("Testcase #1: call StopThread\n"); - if (!NSK_VERIFY(threadForStop != NULL)) { + if (!NSK_VERIFY(threadForStop != nullptr)) { nsk_jvmti_setFailStatus(); } else { if (!NSK_JVMTI_VERIFY(jvmti->StopThread(threadForStop, threadDeath))) @@ -139,7 +139,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } NSK_DISPLAY0("Testcase #2: call InterruptThread\n"); - if (!NSK_VERIFY(threadForInterrupt != NULL)) { + if (!NSK_VERIFY(threadForInterrupt != nullptr)) { nsk_jvmti_setFailStatus(); } else { if (!NSK_JVMTI_VERIFY(jvmti->InterruptThread(threadForInterrupt))) @@ -171,7 +171,7 @@ JNIEXPORT jint JNI_OnLoad_ma08t001(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiCapabilities caps; jvmtiEventCallbacks callbacks; @@ -183,10 +183,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&caps, 0, sizeof(caps)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA08/ma08t001/ma08t001a.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA08/ma08t001/ma08t001a.cpp index 2253e5a088d5..b2b75ec12db0 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA08/ma08t001/ma08t001a.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA08/ma08t001/ma08t001a.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" #define PASSED 0 #define STATUS_FAILED 2 @@ -38,8 +38,8 @@ extern "C" { static jlong timeout = 0; /* test objects */ -static jthread threadForStop = NULL; -static jthread threadForInterrupt = NULL; +static jthread threadForStop = nullptr; +static jthread threadForInterrupt = nullptr; static int ThreadDeathFlag = 0; static int InterruptedExceptionFlag = 0; @@ -53,20 +53,20 @@ static void JNICALL Exception(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jthread thread, jmethodID method, jlocation location, jobject exception, jmethodID catch_method, jlocation catch_location) { - jclass klass = NULL; - char *signature = NULL; + jclass klass = nullptr; + char *signature = nullptr; - if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(exception)) != NULL)) { + if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(exception)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } - if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &signature, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &signature, nullptr))) { nsk_jvmti_setFailStatus(); return; } - if (!NSK_VERIFY(signature != NULL)) { + if (!NSK_VERIFY(signature != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -100,7 +100,7 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { const char* STOP_THREAD_NAME = "DebuggeeThreadForStop"; const char* INTERRUPT_THREAD_NAME = "DebuggeeThreadForInterrupt"; jvmtiThreadInfo info; - jthread *threads = NULL; + jthread *threads = nullptr; jint threads_count = 0; int i; @@ -110,12 +110,12 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -125,7 +125,7 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL) { + if (info.name != nullptr) { if (strcmp(info.name, STOP_THREAD_NAME) == 0) { threadForStop = threads[i]; } else if (strcmp(info.name, INTERRUPT_THREAD_NAME) == 0) { @@ -138,24 +138,24 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads))) return NSK_FALSE; - if (threadForStop == NULL) { + if (threadForStop == nullptr) { NSK_COMPLAIN0("DebuggeeThreadForStop not found"); return NSK_FALSE; } - if (threadForInterrupt == NULL) { + if (threadForInterrupt == nullptr) { NSK_COMPLAIN0("DebuggeeThreadForInterrupt not found"); return NSK_FALSE; } - if (!NSK_JNI_VERIFY(jni, (threadForStop = jni->NewGlobalRef(threadForStop)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (threadForStop = jni->NewGlobalRef(threadForStop)) != nullptr)) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (threadForInterrupt = jni->NewGlobalRef(threadForInterrupt)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (threadForInterrupt = jni->NewGlobalRef(threadForInterrupt)) != nullptr)) return NSK_FALSE; /* enable event */ - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_EXCEPTION, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_EXCEPTION, nullptr))) return NSK_FALSE; return NSK_TRUE; @@ -191,7 +191,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { nsk_jvmti_setFailStatus(); /* disable event */ - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_EXCEPTION, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_EXCEPTION, nullptr))) nsk_jvmti_setFailStatus(); NSK_TRACE(jni->DeleteGlobalRef(threadForStop)); @@ -216,7 +216,7 @@ JNIEXPORT jint JNI_OnLoad_ma08t001a(JavaVM *jvm, char *options, void *reserved) } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiCapabilities caps; jvmtiEventCallbacks callbacks; @@ -228,10 +228,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&caps, 0, sizeof(caps)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t001/ma10t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t001/ma10t001.cpp index 330b7b713a6a..d20b710a9429 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t001/ma10t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t001/ma10t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" #define PASSED 0 #define STATUS_FAILED 2 @@ -48,10 +48,10 @@ static const char *testThreadName = "Debuggee Thread"; void releaseThreadInfo(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jvmtiThreadInfo *info) { jvmti_env->Deallocate((unsigned char *)info->name); - if (info->thread_group != NULL) { + if (info->thread_group != nullptr) { jni_env->DeleteLocalRef(info->thread_group); } - if (info->context_class_loader != NULL) { + if (info->context_class_loader != nullptr) { jni_env->DeleteLocalRef(info->context_class_loader); } } @@ -80,8 +80,8 @@ static void JNICALL Exception(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jthread thread, jmethodID method, jlocation location, jobject exception, jmethodID catch_method, jlocation catch_location) { - jclass klass = NULL; - char *signature = NULL; + jclass klass = nullptr; + char *signature = nullptr; if (!isTestThread("Exception", jvmti_env, jni_env, thread)) { return; @@ -89,24 +89,24 @@ Exception(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jthread thread, ExceptionEventsCount++; - if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(exception)) != NULL)) { + if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(exception)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } - if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &signature, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &signature, nullptr))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY1("Exception event: %s\n", signature); - if (signature != NULL) + if (signature != nullptr) jvmti_env->Deallocate((unsigned char*)signature); } void JNICALL ExceptionCatch(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jthread thread, jmethodID method, jlocation location, jobject exception) { - jclass klass = NULL; - char *signature = NULL; + jclass klass = nullptr; + char *signature = nullptr; if (!isTestThread("ExceptionCatch", jvmti_env, jni_env, thread)) { return; @@ -114,16 +114,16 @@ ExceptionCatch(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jthread thread, ExceptionCatchEventsCount++; - if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(exception)) != NULL)) { + if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(exception)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } - if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &signature, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &signature, nullptr))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY1("ExceptionCatch event: %s\n", signature); - if (signature != NULL) + if (signature != nullptr) jvmti_env->Deallocate((unsigned char*)signature); } @@ -136,9 +136,9 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { if (!nsk_jvmti_waitForSync(timeout)) return; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_EXCEPTION, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_EXCEPTION, nullptr))) nsk_jvmti_setFailStatus(); - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_EXCEPTION_CATCH, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_EXCEPTION_CATCH, nullptr))) nsk_jvmti_setFailStatus(); /* resume debugee and wait for sync */ @@ -147,9 +147,9 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { if (!nsk_jvmti_waitForSync(timeout)) return; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_EXCEPTION, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_EXCEPTION, nullptr))) nsk_jvmti_setFailStatus(); - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_EXCEPTION_CATCH, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_EXCEPTION_CATCH, nullptr))) nsk_jvmti_setFailStatus(); NSK_DISPLAY1("Exception events received: %d\n", @@ -181,7 +181,7 @@ JNIEXPORT jint JNI_OnLoad_ma10t001(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiCapabilities caps; jvmtiEventCallbacks callbacks; @@ -193,10 +193,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&caps, 0, sizeof(caps)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t001/ma10t001a.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t001/ma10t001a.cpp index 29863b2c2c15..8b0b1d7da03f 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t001/ma10t001a.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t001/ma10t001a.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" #define PASSED 0 #define STATUS_FAILED 2 @@ -49,42 +49,42 @@ static void JNICALL Exception(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jthread thread, jmethodID method, jlocation location, jobject exception, jmethodID catch_method, jlocation catch_location) { - jclass klass = NULL; - char *signature = NULL; + jclass klass = nullptr; + char *signature = nullptr; ExceptionEventsCount++; - if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(exception)) != NULL)) { + if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(exception)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } - if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &signature, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &signature, nullptr))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY1("Exception event: %s\n", signature); - if (signature != NULL) + if (signature != nullptr) jvmti_env->Deallocate((unsigned char*)signature); } void JNICALL ExceptionCatch(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jthread thread, jmethodID method, jlocation location, jobject exception) { - jclass klass = NULL; - char *signature = NULL; + jclass klass = nullptr; + char *signature = nullptr; ExceptionCatchEventsCount++; - if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(exception)) != NULL)) { + if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(exception)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } - if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &signature, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &signature, nullptr))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY1("ExceptionCatch event: %s\n", signature); - if (signature != NULL) + if (signature != nullptr) jvmti_env->Deallocate((unsigned char*)signature); } @@ -132,7 +132,7 @@ JNIEXPORT jint JNI_OnLoad_ma10t001a(JavaVM *jvm, char *options, void *reserved) } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiCapabilities caps; jvmtiEventCallbacks callbacks; @@ -144,10 +144,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&caps, 0, sizeof(caps)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t002/ma10t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t002/ma10t002.cpp index c9b34e0eb497..d5e3316b846c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t002/ma10t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t002/ma10t002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" #define PASSED 0 #define STATUS_FAILED 2 @@ -38,7 +38,7 @@ extern "C" { static jlong timeout = 0; /* test objects */ -static jthread thread = NULL; +static jthread thread = nullptr; /* event counts */ static int MethodEntryEventsCount = 0; @@ -50,18 +50,18 @@ static int MethodEntryEventsCount = 0; static void JNICALL MethodEntry(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jthread thread, jmethodID method) { - char *name = NULL; - char *signature = NULL; + char *name = nullptr; + char *signature = nullptr; MethodEntryEventsCount++; - if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, nullptr))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY2("MethodEntry event: %s%s\n", name, signature); - if (name != NULL) + if (name != nullptr) jvmti_env->Deallocate((unsigned char*)name); - if (signature != NULL) + if (signature != nullptr) jvmti_env->Deallocate((unsigned char*)signature); } @@ -70,7 +70,7 @@ MethodEntry(jvmtiEnv *jvmti_env, JNIEnv *jni_env, static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { const char* THREAD_NAME = "Debuggee Thread"; jvmtiThreadInfo info; - jthread *threads = NULL; + jthread *threads = nullptr; jint threads_count = 0; int i; @@ -80,12 +80,12 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -95,12 +95,12 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL && (strcmp(info.name, THREAD_NAME) == 0)) { + if (info.name != nullptr && (strcmp(info.name, THREAD_NAME) == 0)) { thread = threads[i]; } } - if (!NSK_JNI_VERIFY(jni, (thread = jni->NewGlobalRef(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (thread = jni->NewGlobalRef(thread)) != nullptr)) return NSK_FALSE; /* deallocate threads list */ @@ -159,7 +159,7 @@ JNIEXPORT jint JNI_OnLoad_ma10t002(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiCapabilities caps; jvmtiEventCallbacks callbacks; @@ -171,10 +171,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&caps, 0, sizeof(caps)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t002/ma10t002a.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t002/ma10t002a.cpp index e8256ff6dc14..0ac0b4f3ec02 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t002/ma10t002a.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t002/ma10t002a.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" #define PASSED 0 #define STATUS_FAILED 2 @@ -47,18 +47,18 @@ static int MethodEntryEventsCount = 0; static void JNICALL MethodEntry(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jthread thread, jmethodID method) { - char *name = NULL; - char *signature = NULL; + char *name = nullptr; + char *signature = nullptr; MethodEntryEventsCount++; - if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, nullptr))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY2("MethodEntry event: %s%s\n", name, signature); - if (name != NULL) + if (name != nullptr) jvmti_env->Deallocate((unsigned char*)name); - if (signature != NULL) + if (signature != nullptr) jvmti_env->Deallocate((unsigned char*)signature); } @@ -101,7 +101,7 @@ JNIEXPORT jint JNI_OnLoad_ma10t002a(JavaVM *jvm, char *options, void *reserved) } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiCapabilities caps; jvmtiEventCallbacks callbacks; @@ -113,10 +113,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&caps, 0, sizeof(caps)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t003/ma10t003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t003/ma10t003.cpp index 2b75f45a6ae3..cd1ac4209e64 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t003/ma10t003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t003/ma10t003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" #define PASSED 0 #define STATUS_FAILED 2 @@ -38,7 +38,7 @@ extern "C" { static jlong timeout = 0; /* test objects */ -static jthread thread = NULL; +static jthread thread = nullptr; /* event counts */ static int MethodExitEventsCount = 0; @@ -51,18 +51,18 @@ static void JNICALL MethodExit(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jthread thread, jmethodID method, jboolean was_poped_by_exception, jvalue return_value) { - char *name = NULL; - char *signature = NULL; + char *name = nullptr; + char *signature = nullptr; MethodExitEventsCount++; - if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, nullptr))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY2("MethodExit event: %s%s\n", name, signature); - if (name != NULL) + if (name != nullptr) jvmti_env->Deallocate((unsigned char*)name); - if (signature != NULL) + if (signature != nullptr) jvmti_env->Deallocate((unsigned char*)signature); } @@ -71,7 +71,7 @@ MethodExit(jvmtiEnv *jvmti_env, JNIEnv *jni_env, static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { const char* THREAD_NAME = "Debuggee Thread"; jvmtiThreadInfo info; - jthread *threads = NULL; + jthread *threads = nullptr; jint threads_count = 0; int i; @@ -81,12 +81,12 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -96,12 +96,12 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL && (strcmp(info.name, THREAD_NAME) == 0)) { + if (info.name != nullptr && (strcmp(info.name, THREAD_NAME) == 0)) { thread = threads[i]; } } - if (!NSK_JNI_VERIFY(jni, (thread = jni->NewGlobalRef(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (thread = jni->NewGlobalRef(thread)) != nullptr)) return NSK_FALSE; /* deallocate threads list */ @@ -160,7 +160,7 @@ JNIEXPORT jint JNI_OnLoad_ma10t003(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiCapabilities caps; jvmtiEventCallbacks callbacks; @@ -172,10 +172,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&caps, 0, sizeof(caps)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t003/ma10t003a.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t003/ma10t003a.cpp index 98a8f8287fbb..2bb125adb1b7 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t003/ma10t003a.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t003/ma10t003a.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" #define PASSED 0 #define STATUS_FAILED 2 @@ -48,18 +48,18 @@ static void JNICALL MethodExit(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jthread thread, jmethodID method, jboolean was_poped_by_exception, jvalue return_value) { - char *name = NULL; - char *signature = NULL; + char *name = nullptr; + char *signature = nullptr; MethodExitEventsCount++; - if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, nullptr))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY2("MethodExit event: %s%s\n", name, signature); - if (name != NULL) + if (name != nullptr) jvmti_env->Deallocate((unsigned char*)name); - if (signature != NULL) + if (signature != nullptr) jvmti_env->Deallocate((unsigned char*)signature); } @@ -102,7 +102,7 @@ JNIEXPORT jint JNI_OnLoad_ma10t003a(JavaVM *jvm, char *options, void *reserved) } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiCapabilities caps; jvmtiEventCallbacks callbacks; @@ -114,10 +114,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&caps, 0, sizeof(caps)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t004/ma10t004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t004/ma10t004.cpp index 329da7c919cb..8db5995868e0 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t004/ma10t004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t004/ma10t004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" #define PASSED 0 #define STATUS_FAILED 2 @@ -38,7 +38,7 @@ extern "C" { static jlong timeout = 0; /* test objects */ -static jthread thread = NULL; +static jthread thread = nullptr; /* event counts */ static int SingleStepEventsCount = 0; @@ -50,23 +50,23 @@ static int SingleStepEventsCount = 0; static void JNICALL SingleStep(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, jmethodID method, jlocation location) { - char *name = NULL; - char *signature = NULL; + char *name = nullptr; + char *signature = nullptr; char buffer[32]; SingleStepEventsCount++; - NSK_JVMTI_VERIFY(jvmti_env->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_SINGLE_STEP, NULL)); + NSK_JVMTI_VERIFY(jvmti_env->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_SINGLE_STEP, nullptr)); - if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, nullptr))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY3("SingleStep event: %s%s, location=%s\n", name, signature, jlong_to_string(location, buffer)); - if (name != NULL) + if (name != nullptr) jvmti_env->Deallocate((unsigned char*)name); - if (signature != NULL) + if (signature != nullptr) jvmti_env->Deallocate((unsigned char*)signature); } @@ -75,7 +75,7 @@ SingleStep(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { const char* THREAD_NAME = "Debuggee Thread"; jvmtiThreadInfo info; - jthread *threads = NULL; + jthread *threads = nullptr; jint threads_count = 0; int i; @@ -85,12 +85,12 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -100,12 +100,12 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL && (strcmp(info.name, THREAD_NAME) == 0)) { + if (info.name != nullptr && (strcmp(info.name, THREAD_NAME) == 0)) { thread = threads[i]; } } - if (!NSK_JNI_VERIFY(jni, (thread = jni->NewGlobalRef(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (thread = jni->NewGlobalRef(thread)) != nullptr)) return NSK_FALSE; /* deallocate threads list */ @@ -164,7 +164,7 @@ JNIEXPORT jint JNI_OnLoad_ma10t004(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiCapabilities caps; jvmtiEventCallbacks callbacks; @@ -176,10 +176,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&caps, 0, sizeof(caps)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t004/ma10t004a.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t004/ma10t004a.cpp index 4f97e7c79267..66d16ceeb47c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t004/ma10t004a.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t004/ma10t004a.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" #define PASSED 0 #define STATUS_FAILED 2 @@ -47,23 +47,23 @@ static int SingleStepEventsCount = 0; static void JNICALL SingleStep(jvmtiEnv *jvmti_env, JNIEnv* jni_env, jthread thread, jmethodID method, jlocation location) { - char *name = NULL; - char *signature = NULL; + char *name = nullptr; + char *signature = nullptr; char buffer[32]; SingleStepEventsCount++; - NSK_JVMTI_VERIFY(jvmti_env->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_SINGLE_STEP, NULL)); + NSK_JVMTI_VERIFY(jvmti_env->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_SINGLE_STEP, nullptr)); - if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, nullptr))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY3("SingleStep event: %s%s, location=%s\n", name, signature, jlong_to_string(location, buffer)); - if (name != NULL) + if (name != nullptr) jvmti_env->Deallocate((unsigned char*)name); - if (signature != NULL) + if (signature != nullptr) jvmti_env->Deallocate((unsigned char*)signature); } @@ -106,7 +106,7 @@ JNIEXPORT jint JNI_OnLoad_ma10t004a(JavaVM *jvm, char *options, void *reserved) } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiCapabilities caps; jvmtiEventCallbacks callbacks; @@ -118,10 +118,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&caps, 0, sizeof(caps)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t005/ma10t005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t005/ma10t005.cpp index 2f49fe219f44..ace612850aa6 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t005/ma10t005.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t005/ma10t005.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" #define PASSED 0 #define STATUS_FAILED 2 @@ -52,12 +52,12 @@ VMObjectAlloc(jvmtiEnv *jvmti_env, JNIEnv* jni_env, VMObjectAllocEventsCount++; - if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(object_klass, &signature, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(object_klass, &signature, nullptr))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY2("VMObjectAlloc: \"%s\", size=%d\n", signature, size); - if (signature != NULL) + if (signature != nullptr) jvmti_env->Deallocate((unsigned char*)signature); } @@ -94,7 +94,7 @@ JNIEXPORT jint JNI_OnLoad_ma10t005(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiCapabilities caps; jvmtiEventCallbacks callbacks; @@ -106,10 +106,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&caps, 0, sizeof(caps)); @@ -123,7 +123,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_VERIFY(nsk_jvmti_init_MA(&callbacks))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_OBJECT_ALLOC, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_OBJECT_ALLOC, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t005/ma10t005a.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t005/ma10t005a.cpp index 418f082f2801..1573873a9ff3 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t005/ma10t005a.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t005/ma10t005a.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" #define PASSED 0 #define STATUS_FAILED 2 @@ -52,12 +52,12 @@ VMObjectAlloc(jvmtiEnv *jvmti_env, JNIEnv* jni_env, VMObjectAllocEventsCount++; - if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(object_klass, &signature, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(object_klass, &signature, nullptr))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY2("VMObjectAlloc: \"%s\", size=%d\n", signature, size); - if (signature != NULL) + if (signature != nullptr) jvmti_env->Deallocate((unsigned char*)signature); } @@ -94,7 +94,7 @@ JNIEXPORT jint JNI_OnLoad_ma10t005a(JavaVM *jvm, char *options, void *reserved) } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiCapabilities caps; jvmtiEventCallbacks callbacks; @@ -106,10 +106,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&caps, 0, sizeof(caps)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t006/ma10t006.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t006/ma10t006.cpp index ac2d54a16ab7..2c6a186656e6 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t006/ma10t006.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t006/ma10t006.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" #define PASSED 0 #define STATUS_FAILED 2 @@ -49,34 +49,34 @@ static void JNICALL CompiledMethodLoad(jvmtiEnv *jvmti_env, jmethodID method, jint code_size, const void* code_addr, jint map_length, const jvmtiAddrLocationMap* map, const void* compile_info) { - char *name = NULL; - char *signature = NULL; + char *name = nullptr; + char *signature = nullptr; CompiledMethodLoadEventsCount++; - if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, nullptr))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY3("CompiledMethodLoad event: %s%s (0x%p)\n", name, signature, code_addr); - if (name != NULL) + if (name != nullptr) jvmti_env->Deallocate((unsigned char*)name); - if (signature != NULL) + if (signature != nullptr) jvmti_env->Deallocate((unsigned char*)signature); } static void JNICALL CompiledMethodUnload(jvmtiEnv *jvmti_env, jmethodID method, const void* code_addr) { - char *name = NULL; - char *sig = NULL; + char *name = nullptr; + char *sig = nullptr; jvmtiError err; CompiledMethodUnloadEventsCount++; NSK_DISPLAY0("CompiledMethodUnload event received\n"); // Check for the case that the class has been unloaded - err = jvmti_env->GetMethodName(method, &name, &sig, NULL); + err = jvmti_env->GetMethodName(method, &name, &sig, nullptr); if (err == JVMTI_ERROR_NONE) { NSK_DISPLAY3("for: \tmethod: name=\"%s\" signature=\"%s\"\n\tnative address=0x%p\n", name, sig, code_addr); @@ -127,7 +127,7 @@ JNIEXPORT jint JNI_OnLoad_ma10t006(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiCapabilities caps; jvmtiEventCallbacks callbacks; @@ -139,10 +139,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&caps, 0, sizeof(caps)); @@ -157,9 +157,9 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_VERIFY(nsk_jvmti_init_MA(&callbacks))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, nullptr))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_UNLOAD, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_UNLOAD, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t006/ma10t006a.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t006/ma10t006a.cpp index 2ddf7ec6d9c2..3fca05a0c902 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t006/ma10t006a.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t006/ma10t006a.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" #define PASSED 0 #define STATUS_FAILED 2 @@ -49,35 +49,35 @@ static void JNICALL CompiledMethodLoad(jvmtiEnv *jvmti_env, jmethodID method, jint code_size, const void* code_addr, jint map_length, const jvmtiAddrLocationMap* map, const void* compile_info) { - char *name = NULL; - char *signature = NULL; + char *name = nullptr; + char *signature = nullptr; CompiledMethodLoadEventsCount++; - if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, nullptr))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY3("CompiledMethodLoad event: %s%s (0x%p)\n", name, signature, code_addr); - if (name != NULL) + if (name != nullptr) jvmti_env->Deallocate((unsigned char*)name); - if (signature != NULL) + if (signature != nullptr) jvmti_env->Deallocate((unsigned char*)signature); } static void JNICALL CompiledMethodUnload(jvmtiEnv *jvmti_env, jmethodID method, const void* code_addr) { - char *name = NULL; - char *sig = NULL; + char *name = nullptr; + char *sig = nullptr; jvmtiError err; CompiledMethodUnloadEventsCount++; NSK_DISPLAY0("CompiledMethodUnload event received\n"); // Check for the case that the class has been unloaded - err = jvmti_env->GetMethodName(method, &name, &sig, NULL); + err = jvmti_env->GetMethodName(method, &name, &sig, nullptr); if (err == JVMTI_ERROR_NONE) { NSK_DISPLAY3("for: \tmethod: name=\"%s\" signature=\"%s\"\n\tnative address=0x%p\n", name, sig, code_addr); @@ -124,7 +124,7 @@ JNIEXPORT jint JNI_OnLoad_ma10t006a(JavaVM *jvm, char *options, void *reserved) } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiCapabilities caps; jvmtiEventCallbacks callbacks; @@ -136,10 +136,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&caps, 0, sizeof(caps)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t007/ma10t007.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t007/ma10t007.cpp index cee84708ed64..6df71ba2da93 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t007/ma10t007.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t007/ma10t007.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" #define PASSED 0 #define STATUS_FAILED 2 @@ -95,7 +95,7 @@ JNIEXPORT jint JNI_OnLoad_ma10t007(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiCapabilities caps; jvmtiEventCallbacks callbacks; @@ -107,10 +107,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&caps, 0, sizeof(caps)); @@ -125,9 +125,9 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_VERIFY(nsk_jvmti_init_MA(&callbacks))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_START, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_START, nullptr))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_FINISH, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_FINISH, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t007/ma10t007a.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t007/ma10t007a.cpp index e86e00fbc23c..02945011bedd 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t007/ma10t007a.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t007/ma10t007a.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" #define PASSED 0 #define STATUS_FAILED 2 @@ -95,7 +95,7 @@ JNIEXPORT jint JNI_OnLoad_ma10t007a(JavaVM *jvm, char *options, void *reserved) } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiCapabilities caps; jvmtiEventCallbacks callbacks; @@ -107,10 +107,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&caps, 0, sizeof(caps)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t008/ma10t008.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t008/ma10t008.cpp index 449f94e64b0f..9479471a95a7 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t008/ma10t008.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t008/ma10t008.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" #define PASSED 0 #define STATUS_FAILED 2 @@ -165,7 +165,7 @@ JNIEXPORT jint JNI_OnLoad_ma10t008(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiCapabilities caps; jvmtiEventCallbacks callbacks; @@ -177,10 +177,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&caps, 0, sizeof(caps)); @@ -198,13 +198,13 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; /* enable events */ - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTER, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTER, nullptr))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTERED, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTERED, nullptr))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAIT, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAIT, nullptr))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAITED, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAITED, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t008/ma10t008a.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t008/ma10t008a.cpp index 9d4c0d81c079..45f156675fba 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t008/ma10t008a.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA10/ma10t008/ma10t008a.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" #define PASSED 0 #define STATUS_FAILED 2 @@ -165,7 +165,7 @@ JNIEXPORT jint JNI_OnLoad_ma10t008a(JavaVM *jvm, char *options, void *reserved) } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiCapabilities caps; jvmtiEventCallbacks callbacks; @@ -177,10 +177,10 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; memset(&caps, 0, sizeof(caps)); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP01/sp01t001/sp01t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP01/sp01t001/sp01t001.cpp index f0f3bc4a0a34..40db16504b64 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP01/sp01t001/sp01t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP01/sp01t001/sp01t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -39,8 +39,8 @@ extern "C" { #define THREADS_FIELD_SIG "[L" THREAD_CLASS_NAME ";" /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* number of tested threads */ @@ -114,24 +114,24 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* agentJNI, void* arg) { * - make global refs */ static int prepare() { - jclass debugeeClass = NULL; - jfieldID threadsFieldID = NULL; - jobjectArray threadsArray = NULL; + jclass debugeeClass = nullptr; + jfieldID threadsFieldID = nullptr; + jobjectArray threadsArray = nullptr; jsize threadsArrayLength = 0; jsize i; /* find debugee class */ - if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != nullptr)) return NSK_FALSE; /* find static field with threads array */ if (!NSK_JNI_VERIFY(jni, (threadsFieldID = - jni->GetStaticFieldID(debugeeClass, THREADS_FIELD_NAME, THREADS_FIELD_SIG)) != NULL)) + jni->GetStaticFieldID(debugeeClass, THREADS_FIELD_NAME, THREADS_FIELD_SIG)) != nullptr)) return NSK_FALSE; /* get threads array from static field */ if (!NSK_JNI_VERIFY(jni, (threadsArray = (jobjectArray) - jni->GetStaticObjectField(debugeeClass, threadsFieldID)) != NULL)) + jni->GetStaticObjectField(debugeeClass, threadsFieldID)) != nullptr)) return NSK_FALSE; /* check array length */ @@ -142,14 +142,14 @@ static int prepare() { /* get each thread from array */ for (i = 0; i < THREADS_COUNT; i++) { if (!NSK_JNI_VERIFY(jni, (threadsList[i] = (jthread) - jni->GetObjectArrayElement(threadsArray, i)) != NULL)) + jni->GetObjectArrayElement(threadsArray, i)) != nullptr)) return NSK_FALSE; } /* make global references to threads */ for (i = 0; i < THREADS_COUNT; i++) { if (!NSK_JNI_VERIFY(jni, (threadsList[i] = (jthread) - jni->NewGlobalRef(threadsList[i])) != NULL)) + jni->NewGlobalRef(threadsList[i])) != nullptr)) return NSK_FALSE; } @@ -260,11 +260,11 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP01/sp01t002/sp01t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP01/sp01t002/sp01t002.cpp index 99b3dcc7a383..cb98f6998914 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP01/sp01t002/sp01t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP01/sp01t002/sp01t002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,17 +23,17 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { /* ============================================================================= */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* number of tested threads */ @@ -142,7 +142,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* agentJNI, void* arg) { * - make global refs */ static int prepare() { - jthread *allThreadsList = NULL; + jthread *allThreadsList = nullptr; jint allThreadsCount = 0; int found = 0; int i; @@ -151,21 +151,21 @@ static int prepare() { /* clean threads list */ for (i = 0; i < THREADS_COUNT; i++) { - threadsList[i] = NULL; + threadsList[i] = nullptr; } /* get all live threads */ if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&allThreadsCount, &allThreadsList))) return NSK_FALSE; - if (!NSK_VERIFY(allThreadsCount > 0 && allThreadsList != NULL)) + if (!NSK_VERIFY(allThreadsCount > 0 && allThreadsList != nullptr)) return NSK_FALSE; /* find tested threads */ for (i = 0; i < allThreadsCount; i++) { jvmtiThreadInfo threadInfo; - if (!NSK_VERIFY(allThreadsList[i] != NULL)) + if (!NSK_VERIFY(allThreadsList[i] != nullptr)) return NSK_FALSE; /* get thread name (info) */ @@ -173,7 +173,7 @@ static int prepare() { return NSK_FALSE; /* find by name */ - if (threadInfo.name != NULL) { + if (threadInfo.name != nullptr) { int j; for (j = 0; j < THREADS_COUNT; j++) { @@ -193,7 +193,7 @@ static int prepare() { /* check if all tested threads found */ found = 0; for (i = 0; i < THREADS_COUNT; i++) { - if (threadsList[i] == NULL) { + if (threadsList[i] == nullptr) { NSK_COMPLAIN2("Not found tested thread #%d (%s)\n", i, threadsName[i]); } else { found++; @@ -205,7 +205,7 @@ static int prepare() { /* make global refs */ for (i = 0; i < THREADS_COUNT; i++) { - if (!NSK_JNI_VERIFY(jni, (threadsList[i] = jni->NewGlobalRef(threadsList[i])) != NULL)) + if (!NSK_JNI_VERIFY(jni, (threadsList[i] = jni->NewGlobalRef(threadsList[i])) != nullptr)) return NSK_FALSE; } @@ -434,7 +434,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add specific capabilities for suspending thread */ @@ -447,7 +447,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP01/sp01t003/sp01t003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP01/sp01t003/sp01t003.cpp index 814b4bf3a1ea..5bc99822347c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP01/sp01t003/sp01t003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP01/sp01t003/sp01t003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,17 +23,17 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { /* ============================================================================= */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* number of tested threads */ @@ -142,7 +142,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* agentJNI, void* arg) { * - make global refs */ static int prepare() { - jthread *allThreadsList = NULL; + jthread *allThreadsList = nullptr; jint allThreadsCount = 0; int found = 0; int i; @@ -151,21 +151,21 @@ static int prepare() { /* clean threads list */ for (i = 0; i < THREADS_COUNT; i++) { - threadsList[i] = NULL; + threadsList[i] = nullptr; } /* get all live threads */ if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&allThreadsCount, &allThreadsList))) return NSK_FALSE; - if (!NSK_VERIFY(allThreadsCount > 0 && allThreadsList != NULL)) + if (!NSK_VERIFY(allThreadsCount > 0 && allThreadsList != nullptr)) return NSK_FALSE; /* find tested threads */ for (i = 0; i < allThreadsCount; i++) { jvmtiThreadInfo threadInfo; - if (!NSK_VERIFY(allThreadsList[i] != NULL)) + if (!NSK_VERIFY(allThreadsList[i] != nullptr)) return NSK_FALSE; /* get thread name (info) */ @@ -173,7 +173,7 @@ static int prepare() { return NSK_FALSE; /* find by name */ - if (threadInfo.name != NULL) { + if (threadInfo.name != nullptr) { int j; for (j = 0; j < THREADS_COUNT; j++) { @@ -193,7 +193,7 @@ static int prepare() { /* check if all tested threads found */ found = 0; for (i = 0; i < THREADS_COUNT; i++) { - if (threadsList[i] == NULL) { + if (threadsList[i] == nullptr) { NSK_COMPLAIN2("Not found tested thread #%d (%s)\n", i, threadsName[i]); } else { found++; @@ -205,7 +205,7 @@ static int prepare() { /* make global refs */ for (i = 0; i < THREADS_COUNT; i++) { - if (!NSK_JNI_VERIFY(jni, (threadsList[i] = jni->NewGlobalRef(threadsList[i])) != NULL)) + if (!NSK_JNI_VERIFY(jni, (threadsList[i] = jni->NewGlobalRef(threadsList[i])) != nullptr)) return NSK_FALSE; } @@ -445,7 +445,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add specific capabilities for suspending thread */ @@ -458,7 +458,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP02/sp02t001/sp02t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP02/sp02t001/sp02t001.cpp index 491d7f049281..e727438b67a9 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP02/sp02t001/sp02t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP02/sp02t001/sp02t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,17 +23,17 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { /* ============================================================================= */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* constants */ @@ -50,12 +50,12 @@ typedef struct { /* descriptions of tested threads */ static ThreadDesc threadsDesc[THREADS_COUNT] = { - { "threadRunning", 2, NULL }, - { "threadEntering", 2, NULL }, - { "threadWaiting", 2, NULL }, - { "threadSleeping", 2, NULL }, - { "threadRunningInterrupted", 2, NULL }, - { "threadRunningNative", 2, NULL } + { "threadRunning", 2, nullptr }, + { "threadEntering", 2, nullptr }, + { "threadWaiting", 2, nullptr }, + { "threadSleeping", 2, nullptr }, + { "threadRunningInterrupted", 2, nullptr }, + { "threadRunningNative", 2, nullptr } }; /* ============================================================================= */ @@ -123,7 +123,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* agentJNI, void* arg) { * - make global refs */ static int prepare() { - jthread *allThreadsList = NULL; + jthread *allThreadsList = nullptr; jint allThreadsCount = 0; int found = 0; int i; @@ -132,21 +132,21 @@ static int prepare() { /* clean threads list */ for (i = 0; i < THREADS_COUNT; i++) { - threadsDesc[i].thread = (jthread)NULL; + threadsDesc[i].thread = (jthread)nullptr; } /* get all live threads */ if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&allThreadsCount, &allThreadsList))) return NSK_FALSE; - if (!NSK_VERIFY(allThreadsCount > 0 && allThreadsList != NULL)) + if (!NSK_VERIFY(allThreadsCount > 0 && allThreadsList != nullptr)) return NSK_FALSE; /* find tested threads */ for (i = 0; i < allThreadsCount; i++) { jvmtiThreadInfo threadInfo; - if (!NSK_VERIFY(allThreadsList[i] != NULL)) + if (!NSK_VERIFY(allThreadsList[i] != nullptr)) return NSK_FALSE; /* get thread name (info) */ @@ -154,7 +154,7 @@ static int prepare() { return NSK_FALSE; /* find by name */ - if (threadInfo.name != NULL) { + if (threadInfo.name != nullptr) { int j; for (j = 0; j < THREADS_COUNT; j++) { @@ -174,7 +174,7 @@ static int prepare() { /* check if all tested threads found */ found = 0; for (i = 0; i < THREADS_COUNT; i++) { - if (threadsDesc[i].thread == NULL) { + if (threadsDesc[i].thread == nullptr) { NSK_COMPLAIN2("Not found tested thread #%d (%s)\n", i, threadsDesc[i].threadName); } else { found++; @@ -187,7 +187,7 @@ static int prepare() { /* make global refs */ for (i = 0; i < THREADS_COUNT; i++) { if (!NSK_JNI_VERIFY(jni, (threadsDesc[i].thread = (jthread) - jni->NewGlobalRef(threadsDesc[i].thread)) != NULL)) + jni->NewGlobalRef(threadsDesc[i].thread)) != nullptr)) return NSK_FALSE; } @@ -356,7 +356,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add specific capabilities for suspending thread */ @@ -369,7 +369,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP02/sp02t002/sp02t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP02/sp02t002/sp02t002.cpp index 00aa34f3fdbc..25648754de49 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP02/sp02t002/sp02t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP02/sp02t002/sp02t002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,17 +23,17 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { /* ============================================================================= */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* constants */ @@ -54,12 +54,12 @@ typedef struct { /* descriptions of tested threads */ static ThreadDesc threadsDesc[THREADS_COUNT] = { - { "threadRunning", "testedMethod", "()V", NULL, NULL, NULL, NSK_JVMTI_INVALID_JLOCATION }, - { "threadEntering", "testedMethod", "()V", NULL, NULL, NULL, NSK_JVMTI_INVALID_JLOCATION }, - { "threadWaiting", "testedMethod", "()V", NULL, NULL, NULL, NSK_JVMTI_INVALID_JLOCATION }, - { "threadSleeping", "testedMethod", "()V", NULL, NULL, NULL, NSK_JVMTI_INVALID_JLOCATION }, - { "threadRunningInterrupted", "testedMethod", "()V", NULL, NULL, NULL, NSK_JVMTI_INVALID_JLOCATION }, - { "threadRunningNative", "testedMethod", "()V", NULL, NULL, NULL, NSK_JVMTI_INVALID_JLOCATION } + { "threadRunning", "testedMethod", "()V", nullptr, nullptr, nullptr, NSK_JVMTI_INVALID_JLOCATION }, + { "threadEntering", "testedMethod", "()V", nullptr, nullptr, nullptr, NSK_JVMTI_INVALID_JLOCATION }, + { "threadWaiting", "testedMethod", "()V", nullptr, nullptr, nullptr, NSK_JVMTI_INVALID_JLOCATION }, + { "threadSleeping", "testedMethod", "()V", nullptr, nullptr, nullptr, NSK_JVMTI_INVALID_JLOCATION }, + { "threadRunningInterrupted", "testedMethod", "()V", nullptr, nullptr, nullptr, NSK_JVMTI_INVALID_JLOCATION }, + { "threadRunningNative", "testedMethod", "()V", nullptr, nullptr, nullptr, NSK_JVMTI_INVALID_JLOCATION } }; /* indexes of known threads */ @@ -143,7 +143,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* agentJNI, void* arg) { * - make global refs */ static int prepare() { - jthread *allThreadsList = NULL; + jthread *allThreadsList = nullptr; jint allThreadsCount = 0; int found = 0; int i; @@ -152,8 +152,8 @@ static int prepare() { /* clean threads list */ for (i = 0; i < THREADS_COUNT; i++) { - threadsDesc[i].thread = (jthread)NULL; - threadsDesc[i].method = (jmethodID)NULL; + threadsDesc[i].thread = (jthread)nullptr; + threadsDesc[i].method = (jmethodID)nullptr; threadsDesc[i].location = NSK_JVMTI_INVALID_JLOCATION; } @@ -161,14 +161,14 @@ static int prepare() { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&allThreadsCount, &allThreadsList))) return NSK_FALSE; - if (!NSK_VERIFY(allThreadsCount > 0 && allThreadsList != NULL)) + if (!NSK_VERIFY(allThreadsCount > 0 && allThreadsList != nullptr)) return NSK_FALSE; /* find tested threads */ for (i = 0; i < allThreadsCount; i++) { jvmtiThreadInfo threadInfo; - if (!NSK_VERIFY(allThreadsList[i] != NULL)) + if (!NSK_VERIFY(allThreadsList[i] != nullptr)) return NSK_FALSE; /* get thread name (info) */ @@ -176,7 +176,7 @@ static int prepare() { return NSK_FALSE; /* find by name */ - if (threadInfo.name != NULL) { + if (threadInfo.name != nullptr) { int j; for (j = 0; j < THREADS_COUNT; j++) { @@ -196,7 +196,7 @@ static int prepare() { /* check if all tested threads found */ found = 0; for (i = 0; i < THREADS_COUNT; i++) { - if (threadsDesc[i].thread == NULL) { + if (threadsDesc[i].thread == nullptr) { NSK_COMPLAIN2("Not found tested thread #%d (%s)\n", i, threadsDesc[i].threadName); } else { found++; @@ -211,11 +211,11 @@ static int prepare() { for (i = 0; i < THREADS_COUNT; i++) { /* get thread class */ if (!NSK_JNI_VERIFY(jni, (threadsDesc[i].cls = - jni->GetObjectClass(threadsDesc[i].thread)) != NULL)) + jni->GetObjectClass(threadsDesc[i].thread)) != nullptr)) return NSK_FALSE; /* get frame method */ if (!NSK_JNI_VERIFY(jni, (threadsDesc[i].method = - jni->GetMethodID(threadsDesc[i].cls, threadsDesc[i].methodName, threadsDesc[i].methodSig)) != NULL)) + jni->GetMethodID(threadsDesc[i].cls, threadsDesc[i].methodName, threadsDesc[i].methodSig)) != nullptr)) return NSK_FALSE; NSK_DISPLAY4(" thread #%d (%s): %p (%s)\n", @@ -227,10 +227,10 @@ static int prepare() { /* make global refs */ for (i = 0; i < THREADS_COUNT; i++) { if (!NSK_JNI_VERIFY(jni, (threadsDesc[i].thread = (jthread) - jni->NewGlobalRef(threadsDesc[i].thread)) != NULL)) + jni->NewGlobalRef(threadsDesc[i].thread)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (threadsDesc[i].cls = (jclass) - jni->NewGlobalRef(threadsDesc[i].cls)) != NULL)) + jni->NewGlobalRef(threadsDesc[i].cls)) != nullptr)) return NSK_FALSE; } @@ -313,8 +313,8 @@ static int checkThreads(int suspended, const char* kind) { j, (void*)frameStack[j].method, (long)frameStack[j].location); /* check frame method */ - if (frameStack[j].method == NULL) { - NSK_COMPLAIN3("NULL methodID in stack for %s thread #%d (%s)\n", + if (frameStack[j].method == nullptr) { + NSK_COMPLAIN3("null methodID in stack for %s thread #%d (%s)\n", kind, i, threadsDesc[i].threadName); nsk_jvmti_setFailStatus(); } else if (frameStack[j].method == threadsDesc[i].method) { @@ -419,7 +419,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add specific capabilities for suspending thread */ @@ -432,7 +432,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP02/sp02t003/sp02t003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP02/sp02t003/sp02t003.cpp index 20c758aed6c7..7068025eef01 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP02/sp02t003/sp02t003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP02/sp02t003/sp02t003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,17 +23,17 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { /* ============================================================================= */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* constants */ @@ -54,12 +54,12 @@ typedef struct { /* descriptions of tested threads */ static ThreadDesc threadsDesc[THREADS_COUNT] = { - { "threadRunning", "testedMethod", "()V", NULL, NULL, NULL, NSK_JVMTI_INVALID_JLOCATION }, - { "threadEntering", "testedMethod", "()V", NULL, NULL, NULL, NSK_JVMTI_INVALID_JLOCATION }, - { "threadWaiting", "testedMethod", "()V", NULL, NULL, NULL, NSK_JVMTI_INVALID_JLOCATION }, - { "threadSleeping", "testedMethod", "()V", NULL, NULL, NULL, NSK_JVMTI_INVALID_JLOCATION }, - { "threadRunningInterrupted", "testedMethod", "()V", NULL, NULL, NULL, NSK_JVMTI_INVALID_JLOCATION }, - { "threadRunningNative", "testedMethod", "()V", NULL, NULL, NULL, NSK_JVMTI_INVALID_JLOCATION } + { "threadRunning", "testedMethod", "()V", nullptr, nullptr, nullptr, NSK_JVMTI_INVALID_JLOCATION }, + { "threadEntering", "testedMethod", "()V", nullptr, nullptr, nullptr, NSK_JVMTI_INVALID_JLOCATION }, + { "threadWaiting", "testedMethod", "()V", nullptr, nullptr, nullptr, NSK_JVMTI_INVALID_JLOCATION }, + { "threadSleeping", "testedMethod", "()V", nullptr, nullptr, nullptr, NSK_JVMTI_INVALID_JLOCATION }, + { "threadRunningInterrupted", "testedMethod", "()V", nullptr, nullptr, nullptr, NSK_JVMTI_INVALID_JLOCATION }, + { "threadRunningNative", "testedMethod", "()V", nullptr, nullptr, nullptr, NSK_JVMTI_INVALID_JLOCATION } }; /* indexes of known threads */ @@ -144,7 +144,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* agentJNI, void* arg) { * - make global refs */ static int prepare() { - jthread *allThreadsList = NULL; + jthread *allThreadsList = nullptr; jint allThreadsCount = 0; int found = 0; int i; @@ -153,8 +153,8 @@ static int prepare() { /* clean threads list */ for (i = 0; i < THREADS_COUNT; i++) { - threadsDesc[i].thread = (jthread)NULL; - threadsDesc[i].method = (jmethodID)NULL; + threadsDesc[i].thread = (jthread)nullptr; + threadsDesc[i].method = (jmethodID)nullptr; threadsDesc[i].location = NSK_JVMTI_INVALID_JLOCATION; } @@ -162,14 +162,14 @@ static int prepare() { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&allThreadsCount, &allThreadsList))) return NSK_FALSE; - if (!NSK_VERIFY(allThreadsCount > 0 && allThreadsList != NULL)) + if (!NSK_VERIFY(allThreadsCount > 0 && allThreadsList != nullptr)) return NSK_FALSE; /* find tested threads */ for (i = 0; i < allThreadsCount; i++) { jvmtiThreadInfo threadInfo; - if (!NSK_VERIFY(allThreadsList[i] != NULL)) + if (!NSK_VERIFY(allThreadsList[i] != nullptr)) return NSK_FALSE; /* get thread name (info) */ @@ -177,7 +177,7 @@ static int prepare() { return NSK_FALSE; /* find by name */ - if (threadInfo.name != NULL) { + if (threadInfo.name != nullptr) { int j; for (j = 0; j < THREADS_COUNT; j++) { @@ -197,7 +197,7 @@ static int prepare() { /* check if all tested threads found */ found = 0; for (i = 0; i < THREADS_COUNT; i++) { - if (threadsDesc[i].thread == NULL) { + if (threadsDesc[i].thread == nullptr) { NSK_COMPLAIN2("Not found tested thread #%d (%s)\n", i, threadsDesc[i].threadName); } else { found++; @@ -212,11 +212,11 @@ static int prepare() { for (i = 0; i < THREADS_COUNT; i++) { /* get thread class */ if (!NSK_JNI_VERIFY(jni, (threadsDesc[i].cls = - jni->GetObjectClass(threadsDesc[i].thread)) != NULL)) + jni->GetObjectClass(threadsDesc[i].thread)) != nullptr)) return NSK_FALSE; /* get frame method */ if (!NSK_JNI_VERIFY(jni, (threadsDesc[i].method = - jni->GetMethodID(threadsDesc[i].cls, threadsDesc[i].methodName, threadsDesc[i].methodSig)) != NULL)) + jni->GetMethodID(threadsDesc[i].cls, threadsDesc[i].methodName, threadsDesc[i].methodSig)) != nullptr)) return NSK_FALSE; NSK_DISPLAY4(" thread #%d (%s): %p (%s)\n", @@ -228,10 +228,10 @@ static int prepare() { /* make global refs */ for (i = 0; i < THREADS_COUNT; i++) { if (!NSK_JNI_VERIFY(jni, (threadsDesc[i].thread = (jthread) - jni->NewGlobalRef(threadsDesc[i].thread)) != NULL)) + jni->NewGlobalRef(threadsDesc[i].thread)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (threadsDesc[i].cls = (jclass) - jni->NewGlobalRef(threadsDesc[i].cls)) != NULL)) + jni->NewGlobalRef(threadsDesc[i].cls)) != nullptr)) return NSK_FALSE; } @@ -297,7 +297,7 @@ static int checkThreads(int suspended, const char* kind) { found = 0; for (j = 0; j < frameStackSize; j++) { - jmethodID qMethod = (jmethodID)NULL; + jmethodID qMethod = (jmethodID)nullptr; jlocation qLocation = NSK_JVMTI_INVALID_JLOCATION; NSK_DISPLAY3(" %d frame: method: %p, location: %ld\n", @@ -432,7 +432,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add specific capabilities for suspending thread */ { @@ -444,7 +444,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP03/sp03t001/sp03t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP03/sp03t001/sp03t001.cpp index b0560a13a1f7..d9f1e6faf27f 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP03/sp03t001/sp03t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP03/sp03t001/sp03t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,17 +23,17 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { /* ============================================================================= */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* number of tested threads */ @@ -146,7 +146,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* agentJNI, void* arg) { * - make global refs */ static int prepare() { - jthread *allThreadsList = NULL; + jthread *allThreadsList = nullptr; jint allThreadsCount = 0; int notfound = 0; int i, j; @@ -156,14 +156,14 @@ static int prepare() { /* allocate and clean threads list */ for (i = 0; i < THREADS_KINDS; i++) { threadsCounts[i] = 0; - threadsList[i] = NULL; + threadsList[i] = nullptr; if (!NSK_JVMTI_VERIFY(jvmti->Allocate(threadsCount * sizeof(jthread), (unsigned char**)&threadsList[i]))) return NSK_FALSE; for (j = 0; j < threadsCount; j++) { - threadsList[i][j] = NULL; + threadsList[i][j] = nullptr; } } @@ -171,14 +171,14 @@ static int prepare() { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&allThreadsCount, &allThreadsList))) return NSK_FALSE; - if (!NSK_VERIFY(allThreadsCount > 0 && allThreadsList != NULL)) + if (!NSK_VERIFY(allThreadsCount > 0 && allThreadsList != nullptr)) return NSK_FALSE; /* find tested threads */ for (i = 0; i < allThreadsCount; i++) { jvmtiThreadInfo threadInfo; - if (!NSK_VERIFY(allThreadsList[i] != NULL)) + if (!NSK_VERIFY(allThreadsList[i] != nullptr)) return NSK_FALSE; /* get thread name (info) */ @@ -186,7 +186,7 @@ static int prepare() { return NSK_FALSE; /* find by name */ - if (threadInfo.name != NULL) { + if (threadInfo.name != nullptr) { for (j = 0; j < THREADS_KINDS; j++) { if (strcmp(threadInfo.name, threadsName[j]) == 0) { int k = threadsCounts[j]; @@ -222,7 +222,7 @@ static int prepare() { for (i = 0; i < THREADS_KINDS; i++) { for (j = 0; j < threadsCount; j++) { if (!NSK_JNI_VERIFY(jni, (threadsList[i][j] = - jni->NewGlobalRef(threadsList[i][j])) != NULL)) + jni->NewGlobalRef(threadsList[i][j])) != nullptr)) return NSK_FALSE; } } @@ -235,7 +235,7 @@ static int prepare() { */ static int suspendThreadsList(int suspend) { jlong resultsSize = threadsCount * sizeof(jvmtiError); - jvmtiError* results = NULL; + jvmtiError* results = nullptr; const char* kind = (suspend ? "suspending" : "resuming"); int i, j; @@ -368,7 +368,7 @@ static int clean() { for (i = 0; i < THREADS_KINDS; i++) { if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threadsList[i]))) return NSK_FALSE; - threadsList[i] = NULL; + threadsList[i] = nullptr; } return NSK_TRUE; @@ -443,7 +443,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add specific capabilities for suspending thread */ @@ -456,7 +456,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP03/sp03t002/sp03t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP03/sp03t002/sp03t002.cpp index 986d1113fc68..0445c1992981 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP03/sp03t002/sp03t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP03/sp03t002/sp03t002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,17 +23,17 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { /* ============================================================================= */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* number of tested threads */ @@ -149,7 +149,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* agentJNI, void* arg) { * - make global refs */ static int prepare() { - jthread *allThreadsList = NULL; + jthread *allThreadsList = nullptr; jint allThreadsCount = 0; int notfound = 0; int i, j; @@ -159,14 +159,14 @@ static int prepare() { /* allocate and clean threads list */ for (i = 0; i < THREADS_KINDS; i++) { threadsCounts[i] = 0; - threadsList[i] = NULL; + threadsList[i] = nullptr; if (!NSK_JVMTI_VERIFY(jvmti->Allocate(threadsCount * sizeof(jthread), (unsigned char**)&threadsList[i]))) return NSK_FALSE; for (j = 0; j < threadsCount; j++) { - threadsList[i][j] = NULL; + threadsList[i][j] = nullptr; } } @@ -174,14 +174,14 @@ static int prepare() { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&allThreadsCount, &allThreadsList))) return NSK_FALSE; - if (!NSK_VERIFY(allThreadsCount > 0 && allThreadsList != NULL)) + if (!NSK_VERIFY(allThreadsCount > 0 && allThreadsList != nullptr)) return NSK_FALSE; /* find tested threads */ for (i = 0; i < allThreadsCount; i++) { jvmtiThreadInfo threadInfo; - if (!NSK_VERIFY(allThreadsList[i] != NULL)) + if (!NSK_VERIFY(allThreadsList[i] != nullptr)) return NSK_FALSE; /* get thread name (info) */ @@ -189,7 +189,7 @@ static int prepare() { return NSK_FALSE; /* find by name */ - if (threadInfo.name != NULL) { + if (threadInfo.name != nullptr) { for (j = 0; j < THREADS_KINDS; j++) { if (strcmp(threadInfo.name, threadsName[j]) == 0) { int k = threadsCounts[j]; @@ -225,7 +225,7 @@ static int prepare() { for (i = 0; i < THREADS_KINDS; i++) { for (j = 0; j < threadsCount; j++) { if (!NSK_JNI_VERIFY(jni, (threadsList[i][j] = - jni->NewGlobalRef(threadsList[i][j])) != NULL)) + jni->NewGlobalRef(threadsList[i][j])) != nullptr)) return NSK_FALSE; } } @@ -238,7 +238,7 @@ static int prepare() { */ static int suspendThreadsList(int suspend) { jlong resultsSize = threadsCount * sizeof(jvmtiError); - jvmtiError* results = NULL; + jvmtiError* results = nullptr; const char* kind = (suspend ? "suspending" : "resuming"); int i, j; @@ -371,7 +371,7 @@ static int clean() { for (i = 0; i < THREADS_KINDS; i++) { if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threadsList[i]))) return NSK_FALSE; - threadsList[i] = NULL; + threadsList[i] = nullptr; } return NSK_TRUE; @@ -446,7 +446,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add specific capabilities for suspending thread */ @@ -459,7 +459,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP04/sp04t001/sp04t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP04/sp04t001/sp04t001.cpp index 45657600f9e1..0f7298ff7df0 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP04/sp04t001/sp04t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP04/sp04t001/sp04t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,17 +23,17 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { /* ============================================================================= */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* number of tested threads */ @@ -146,7 +146,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* agentJNI, void* arg) { * - make global refs */ static int prepare() { - jthread *allThreadsList = NULL; + jthread *allThreadsList = nullptr; jint allThreadsCount = 0; int notfound = 0; int i, j; @@ -156,14 +156,14 @@ static int prepare() { /* allocate and clean threads list */ for (i = 0; i < THREADS_KINDS; i++) { threadsCounts[i] = 0; - threadsList[i] = NULL; + threadsList[i] = nullptr; if (!NSK_JVMTI_VERIFY(jvmti->Allocate(threadsCount * sizeof(jthread), (unsigned char**)&threadsList[i]))) return NSK_FALSE; for (j = 0; j < threadsCount; j++) { - threadsList[i][j] = NULL; + threadsList[i][j] = nullptr; } } @@ -171,14 +171,14 @@ static int prepare() { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&allThreadsCount, &allThreadsList))) return NSK_FALSE; - if (!NSK_VERIFY(allThreadsCount > 0 && allThreadsList != NULL)) + if (!NSK_VERIFY(allThreadsCount > 0 && allThreadsList != nullptr)) return NSK_FALSE; /* find tested threads */ for (i = 0; i < allThreadsCount; i++) { jvmtiThreadInfo threadInfo; - if (!NSK_VERIFY(allThreadsList[i] != NULL)) + if (!NSK_VERIFY(allThreadsList[i] != nullptr)) return NSK_FALSE; /* get thread name (info) */ @@ -186,7 +186,7 @@ static int prepare() { return NSK_FALSE; /* find by name */ - if (threadInfo.name != NULL) { + if (threadInfo.name != nullptr) { for (j = 0; j < THREADS_KINDS; j++) { if (strcmp(threadInfo.name, threadsName[j]) == 0) { int k = threadsCounts[j]; @@ -222,7 +222,7 @@ static int prepare() { for (i = 0; i < THREADS_KINDS; i++) { for (j = 0; j < threadsCount; j++) { if (!NSK_JNI_VERIFY(jni, (threadsList[i][j] = - jni->NewGlobalRef(threadsList[i][j])) != NULL)) + jni->NewGlobalRef(threadsList[i][j])) != nullptr)) return NSK_FALSE; } } @@ -235,7 +235,7 @@ static int prepare() { */ static int suspendThreadsList(int suspend) { jlong resultsSize = threadsCount * sizeof(jvmtiError); - jvmtiError* results = NULL; + jvmtiError* results = nullptr; const char* kind = (suspend ? "suspending" : "resuming"); int i, j; @@ -368,7 +368,7 @@ static int clean() { for (i = 0; i < THREADS_KINDS; i++) { if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threadsList[i]))) return NSK_FALSE; - threadsList[i] = NULL; + threadsList[i] = nullptr; } return NSK_TRUE; @@ -443,7 +443,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add specific capabilities for suspending thread */ @@ -456,7 +456,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP04/sp04t002/sp04t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP04/sp04t002/sp04t002.cpp index 5122bd4fe555..410c77ebd263 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP04/sp04t002/sp04t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP04/sp04t002/sp04t002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,17 +23,17 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { /* ============================================================================= */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* number of tested threads */ @@ -146,7 +146,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* agentJNI, void* arg) { * - make global refs */ static int prepare() { - jthread *allThreadsList = NULL; + jthread *allThreadsList = nullptr; jint allThreadsCount = 0; int notfound = 0; int i, j; @@ -156,14 +156,14 @@ static int prepare() { /* allocate and clean threads list */ for (i = 0; i < THREADS_KINDS; i++) { threadsCounts[i] = 0; - threadsList[i] = NULL; + threadsList[i] = nullptr; if (!NSK_JVMTI_VERIFY(jvmti->Allocate(threadsCount * sizeof(jthread), (unsigned char**)&threadsList[i]))) return NSK_FALSE; for (j = 0; j < threadsCount; j++) { - threadsList[i][j] = NULL; + threadsList[i][j] = nullptr; } } @@ -171,14 +171,14 @@ static int prepare() { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&allThreadsCount, &allThreadsList))) return NSK_FALSE; - if (!NSK_VERIFY(allThreadsCount > 0 && allThreadsList != NULL)) + if (!NSK_VERIFY(allThreadsCount > 0 && allThreadsList != nullptr)) return NSK_FALSE; /* find tested threads */ for (i = 0; i < allThreadsCount; i++) { jvmtiThreadInfo threadInfo; - if (!NSK_VERIFY(allThreadsList[i] != NULL)) + if (!NSK_VERIFY(allThreadsList[i] != nullptr)) return NSK_FALSE; /* get thread name (info) */ @@ -186,7 +186,7 @@ static int prepare() { return NSK_FALSE; /* find by name */ - if (threadInfo.name != NULL) { + if (threadInfo.name != nullptr) { for (j = 0; j < THREADS_KINDS; j++) { if (strcmp(threadInfo.name, threadsName[j]) == 0) { int k = threadsCounts[j]; @@ -222,7 +222,7 @@ static int prepare() { for (i = 0; i < THREADS_KINDS; i++) { for (j = 0; j < threadsCount; j++) { if (!NSK_JNI_VERIFY(jni, (threadsList[i][j] = - jni->NewGlobalRef(threadsList[i][j])) != NULL)) + jni->NewGlobalRef(threadsList[i][j])) != nullptr)) return NSK_FALSE; } } @@ -235,7 +235,7 @@ static int prepare() { */ static int suspendThreadsList(int suspend) { jlong resultsSize = threadsCount * sizeof(jvmtiError); - jvmtiError* results = NULL; + jvmtiError* results = nullptr; const char* kind = (suspend ? "suspending" : "resuming"); int i, j; @@ -368,7 +368,7 @@ static int clean() { for (i = 0; i < THREADS_KINDS; i++) { if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threadsList[i]))) return NSK_FALSE; - threadsList[i] = NULL; + threadsList[i] = nullptr; } return NSK_TRUE; @@ -443,7 +443,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add specific capabilities for suspending thread */ @@ -456,7 +456,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP05/sp05t002/sp05t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP05/sp05t002/sp05t002.cpp index 04a3b498e3ff..caadaf294602 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP05/sp05t002/sp05t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP05/sp05t002/sp05t002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -38,8 +38,8 @@ extern "C" { #define THREADS_FIELD_SIG "[L" THREAD_CLASS_NAME ";" /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* number of tested threads and events */ @@ -143,7 +143,7 @@ static int enableEvents(jvmtiEventMode enable) { int i; for (i = 0; i < EVENTS_COUNT; i++) { - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(enable, eventsList[i], NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(enable, eventsList[i], nullptr))) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -159,24 +159,24 @@ static int enableEvents(jvmtiEventMode enable) { * - enable events */ static int prepare() { - jclass debugeeClass = NULL; - jfieldID threadsFieldID = NULL; - jobjectArray threadsArray = NULL; + jclass debugeeClass = nullptr; + jfieldID threadsFieldID = nullptr; + jobjectArray threadsArray = nullptr; jsize threadsArrayLength = 0; jsize i; /* find debugee class */ - if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != nullptr)) return NSK_FALSE; /* find static field with threads array */ if (!NSK_JNI_VERIFY(jni, (threadsFieldID = - jni->GetStaticFieldID(debugeeClass, THREADS_FIELD_NAME, THREADS_FIELD_SIG)) != NULL)) + jni->GetStaticFieldID(debugeeClass, THREADS_FIELD_NAME, THREADS_FIELD_SIG)) != nullptr)) return NSK_FALSE; /* get threads array from static field */ if (!NSK_JNI_VERIFY(jni, (threadsArray = (jobjectArray) - jni->GetStaticObjectField(debugeeClass, threadsFieldID)) != NULL)) + jni->GetStaticObjectField(debugeeClass, threadsFieldID)) != nullptr)) return NSK_FALSE; /* check array length */ @@ -187,14 +187,14 @@ static int prepare() { /* get each thread from array */ for (i = 0; i < THREADS_COUNT; i++) { if (!NSK_JNI_VERIFY(jni, (threadsList[i] = (jthread) - jni->GetObjectArrayElement(threadsArray, i)) != NULL)) + jni->GetObjectArrayElement(threadsArray, i)) != nullptr)) return NSK_FALSE; } /* make global references to threads */ for (i = 0; i < THREADS_COUNT; i++) { if (!NSK_JNI_VERIFY(jni, (threadsList[i] = (jthread) - jni->NewGlobalRef(threadsList[i])) != NULL)) + jni->NewGlobalRef(threadsList[i])) != nullptr)) return NSK_FALSE; } @@ -279,8 +279,8 @@ JNIEXPORT void JNICALL callbackThreadStart(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { int i; - /* check if thread is not NULL */ - if (!NSK_VERIFY(thread != NULL)) { + /* check if thread is not nullptr */ + if (!NSK_VERIFY(thread != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -306,8 +306,8 @@ JNIEXPORT void JNICALL callbackThreadEnd(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { int i; - /* check if thread is not NULL */ - if (!NSK_VERIFY(thread != NULL)) { + /* check if thread is not nullptr */ + if (!NSK_VERIFY(thread != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -388,7 +388,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* set events callbacks */ @@ -402,7 +402,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP05/sp05t003/TestDescription.java b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP05/sp05t003/TestDescription.java index ecb2cfc59e59..1c8ca451c8e8 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP05/sp05t003/TestDescription.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP05/sp05t003/TestDescription.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2024, 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 @@ -50,7 +50,7 @@ * @library /vmTestbase * /test/lib * @run main/othervm/native - * -agentlib:sp05t003=-waittime=5 + * -agentlib:sp05t003=-waittime=5,-verbose * nsk.jvmti.scenarios.sampling.SP05.sp05t003 */ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP05/sp05t003/sp05t003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP05/sp05t003/sp05t003.cpp index 455f88db20c2..0147bfed6084 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP05/sp05t003/sp05t003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP05/sp05t003/sp05t003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +23,9 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -41,8 +41,8 @@ extern "C" { #define TIMEOUT_DELTA 1000 /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* number of tested threads and events */ @@ -74,6 +74,7 @@ static volatile int eventsEnd = 0; /* testcase(s) */ static int prepare(); static int checkThreads(const char* kind); +static int waitSuspended(const char* kind); static int resumeThreads(const char* kind); static int clean(); @@ -100,7 +101,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* agentJNI, void* arg) { { eventsStart = 0; if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, NULL))) { + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, nullptr))) { nsk_jvmti_setFailStatus(); return; } @@ -121,11 +122,11 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* agentJNI, void* arg) { } if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_THREAD_START, NULL))) { + jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_THREAD_START, nullptr))) { nsk_jvmti_setFailStatus(); } - /* check if all threads suspended on THREAD_START events */ + /* check if all THREAD_START events are generated */ if (eventsStart != THREADS_COUNT) { NSK_COMPLAIN2("Unexpected number of THREAD_START events:\n" "# received: %d\n" @@ -133,6 +134,11 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* agentJNI, void* arg) { eventsStart, THREADS_COUNT); } + /* wait until all threads are suspended */ + if (!NSK_VERIFY(waitSuspended("starting"))) { + return; + } + NSK_DISPLAY0("Testcase #1: check threads on THREAD_START\n"); if (!NSK_VERIFY(checkThreads("starting"))) return; @@ -150,7 +156,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* agentJNI, void* arg) { { eventsEnd = 0; if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_END, NULL))) { + jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_END, nullptr))) { nsk_jvmti_setFailStatus(); return; } @@ -171,11 +177,11 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* agentJNI, void* arg) { } if (!NSK_JVMTI_VERIFY( - jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_THREAD_END, NULL))) { + jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_THREAD_END, nullptr))) { nsk_jvmti_setFailStatus(); } - /* check ia all threads suspended on THREAD_END event */ + /* check if all THREAD_END event are generated */ if (eventsEnd != THREADS_COUNT) { NSK_COMPLAIN2("Unexpected number of THREAD_END events:\n" "# received: %d\n" @@ -183,6 +189,11 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* agentJNI, void* arg) { eventsEnd, THREADS_COUNT); } + /* wait until all threads are suspended */ + if (!NSK_VERIFY(waitSuspended("finishing"))) { + return; + } + NSK_DISPLAY0("Testcase #2: check threads on THREAD_END\n"); if (!NSK_VERIFY(checkThreads("finishing"))) return; @@ -210,6 +221,31 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* agentJNI, void* arg) { /* ============================================================================= */ +static int waitSuspended(const char* kind) { + NSK_DISPLAY1("Wait for %s threads to be suspended\n", kind); + for (int i = 0; i < THREADS_COUNT; i++) { + for (int j = 0; j * TIMEOUT_DELTA < timeout; j++) { + jint state = 0; + if (!NSK_JVMTI_VERIFY(jvmti->GetThreadState(threadsList[i], &state))) { + nsk_jvmti_setFailStatus(); + break; + } + if ((state & JVMTI_THREAD_STATE_ALIVE) == 0) { + NSK_COMPLAIN3("%s thread %s is not alive: %x\n", kind, threadsName[i], (int)state); + nsk_jvmti_setFailStatus(); + break; + } + if ((state & JVMTI_THREAD_STATE_SUSPENDED) != 0) { + NSK_DISPLAY2(" OK: %s thread %s is suspended\n", kind, threadsName[i]); + break; + } + NSK_DISPLAY2(" %s thread %s is not suspended, waiting\n", kind, threadsName[i]); + nsk_jvmti_sleep(TIMEOUT_DELTA); + } + } + return NSK_TRUE; // continue execution +} + /** * Resume all threads in given state. */ @@ -231,24 +267,24 @@ static int resumeThreads(const char* kind) { * - make global refs */ static int prepare() { - jclass debugeeClass = NULL; - jfieldID threadsFieldID = NULL; - jobjectArray threadsArray = NULL; + jclass debugeeClass = nullptr; + jfieldID threadsFieldID = nullptr; + jobjectArray threadsArray = nullptr; jsize threadsArrayLength = 0; jsize i; /* find debugee class */ - if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != nullptr)) return NSK_FALSE; /* find static field with threads array */ if (!NSK_JNI_VERIFY(jni, (threadsFieldID = - jni->GetStaticFieldID(debugeeClass, THREADS_FIELD_NAME, THREADS_FIELD_SIG)) != NULL)) + jni->GetStaticFieldID(debugeeClass, THREADS_FIELD_NAME, THREADS_FIELD_SIG)) != nullptr)) return NSK_FALSE; /* get threads array from static field */ if (!NSK_JNI_VERIFY(jni, (threadsArray = (jobjectArray) - jni->GetStaticObjectField(debugeeClass, threadsFieldID)) != NULL)) + jni->GetStaticObjectField(debugeeClass, threadsFieldID)) != nullptr)) return NSK_FALSE; /* check array length */ @@ -259,14 +295,14 @@ static int prepare() { /* get each thread from array */ for (i = 0; i < THREADS_COUNT; i++) { if (!NSK_JNI_VERIFY(jni, (threadsList[i] = (jthread) - jni->GetObjectArrayElement(threadsArray, i)) != NULL)) + jni->GetObjectArrayElement(threadsArray, i)) != nullptr)) return NSK_FALSE; } /* make global references to threads */ for (i = 0; i < THREADS_COUNT; i++) { if (!NSK_JNI_VERIFY(jni, (threadsList[i] = (jthread) - jni->NewGlobalRef(threadsList[i])) != NULL)) + jni->NewGlobalRef(threadsList[i])) != nullptr)) return NSK_FALSE; } @@ -362,8 +398,8 @@ JNIEXPORT void JNICALL callbackThreadStart(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { int i; - /* check if thread is not NULL */ - if (!NSK_VERIFY(thread != NULL)) { + /* check if thread is not nullptr */ + if (!NSK_VERIFY(thread != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -397,8 +433,8 @@ JNIEXPORT void JNICALL callbackThreadEnd(jvmtiEnv* jvmti, JNIEnv* jni, jthread thread) { int i; - /* check if thread is not NULL */ - if (!NSK_VERIFY(thread != NULL)) { + /* check if thread is not nullptr */ + if (!NSK_VERIFY(thread != nullptr)) { nsk_jvmti_setFailStatus(); return; } @@ -487,7 +523,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* add capabilities for suspending thread */ @@ -510,7 +546,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP06/sp06t001/sp06t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP06/sp06t001/sp06t001.cpp index 4f46a0fd08eb..b4a0f2e924ce 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP06/sp06t001/sp06t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP06/sp06t001/sp06t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,17 +23,17 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { /* ============================================================================= */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* constants */ @@ -62,12 +62,12 @@ typedef struct { /* descriptions of tested threads */ static ThreadDesc threadsDesc[THREADS_COUNT] = { - { "threadRunning", "testedMethod", "(ZI)V", 2, NULL, NULL, NULL, NSK_FALSE }, - { "threadEntering", "testedMethod", "(ZI)V", 2, NULL, NULL, NULL, NSK_FALSE }, - { "threadWaiting", "testedMethod", "(ZI)V", 2, NULL, NULL, NULL, NSK_FALSE }, - { "threadSleeping", "testedMethod", "(ZI)V", 2, NULL, NULL, NULL, NSK_FALSE }, - { "threadRunningInterrupted", "testedMethod", "(ZI)V", 2, NULL, NULL, NULL, NSK_FALSE }, - { "threadRunningNative", "testedMethod", "(ZI)V", 2, NULL, NULL, NULL, NSK_FALSE } + { "threadRunning", "testedMethod", "(ZI)V", 2, nullptr, nullptr, nullptr, NSK_FALSE }, + { "threadEntering", "testedMethod", "(ZI)V", 2, nullptr, nullptr, nullptr, NSK_FALSE }, + { "threadWaiting", "testedMethod", "(ZI)V", 2, nullptr, nullptr, nullptr, NSK_FALSE }, + { "threadSleeping", "testedMethod", "(ZI)V", 2, nullptr, nullptr, nullptr, NSK_FALSE }, + { "threadRunningInterrupted", "testedMethod", "(ZI)V", 2, nullptr, nullptr, nullptr, NSK_FALSE }, + { "threadRunningNative", "testedMethod", "(ZI)V", 2, nullptr, nullptr, nullptr, NSK_FALSE } }; /* indexes of known threads */ @@ -152,7 +152,7 @@ static int generateEvents() { * - enable events */ static int prepare() { - jthread *allThreadsList = NULL; + jthread *allThreadsList = nullptr; jint allThreadsCount = 0; int found = 0; int i; @@ -161,8 +161,8 @@ static int prepare() { /* clean threads list */ for (i = 0; i < THREADS_COUNT; i++) { - threadsDesc[i].thread = (jthread)NULL; - threadsDesc[i].method = (jmethodID)NULL; + threadsDesc[i].thread = (jthread)nullptr; + threadsDesc[i].method = (jmethodID)nullptr; threadsDesc[i].methodCompiled = NSK_FALSE; } @@ -170,20 +170,20 @@ static int prepare() { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&allThreadsCount, &allThreadsList))) return NSK_FALSE; - if (!NSK_VERIFY(allThreadsCount > 0 && allThreadsList != NULL)) + if (!NSK_VERIFY(allThreadsCount > 0 && allThreadsList != nullptr)) return NSK_FALSE; /* find tested threads */ for (i = 0; i < allThreadsCount; i++) { jvmtiThreadInfo threadInfo; - if (!NSK_VERIFY(allThreadsList[i] != NULL)) + if (!NSK_VERIFY(allThreadsList[i] != nullptr)) return NSK_FALSE; if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(allThreadsList[i], &threadInfo))) return NSK_FALSE; - if (threadInfo.name != NULL) { + if (threadInfo.name != nullptr) { int j; for (j = 0; j < THREADS_COUNT; j++) { @@ -203,7 +203,7 @@ static int prepare() { /* check if all tested threads found */ found = 0; for (i = 0; i < THREADS_COUNT; i++) { - if (threadsDesc[i].thread == NULL) { + if (threadsDesc[i].thread == nullptr) { NSK_COMPLAIN2("Not found tested thread #%d (%s)\n", i, threadsDesc[i].threadName); } else { found++; @@ -218,11 +218,11 @@ static int prepare() { for (i = 0; i < THREADS_COUNT; i++) { if (!NSK_JNI_VERIFY(jni, (threadsDesc[i].cls = - jni->GetObjectClass(threadsDesc[i].thread)) != NULL)) + jni->GetObjectClass(threadsDesc[i].thread)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (threadsDesc[i].method = - jni->GetMethodID(threadsDesc[i].cls, threadsDesc[i].methodName, threadsDesc[i].methodSig)) != NULL)) + jni->GetMethodID(threadsDesc[i].cls, threadsDesc[i].methodName, threadsDesc[i].methodSig)) != nullptr)) return NSK_FALSE; NSK_DISPLAY4(" thread #%d (%s): 0x%p (%s)\n", @@ -234,15 +234,15 @@ static int prepare() { /* make global refs */ for (i = 0; i < THREADS_COUNT; i++) { if (!NSK_JNI_VERIFY(jni, (threadsDesc[i].thread = (jthread) - jni->NewGlobalRef(threadsDesc[i].thread)) != NULL)) + jni->NewGlobalRef(threadsDesc[i].thread)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (threadsDesc[i].cls = (jclass) - jni->NewGlobalRef(threadsDesc[i].cls)) != NULL)) + jni->NewGlobalRef(threadsDesc[i].cls)) != nullptr)) return NSK_FALSE; } NSK_DISPLAY0("Enable tested events\n"); - if (!nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, eventsList, NULL)) + if (!nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, eventsList, nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -343,7 +343,7 @@ static int clean() { int i; NSK_DISPLAY0("Disable events\n"); - if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, eventsList, NULL)) + if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, eventsList, nullptr)) return NSK_FALSE; NSK_DISPLAY0("Dispose global references to threads\n"); @@ -474,7 +474,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; { @@ -495,7 +495,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP06/sp06t002/sp06t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP06/sp06t002/sp06t002.cpp index d8600af0d673..a84073a595be 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP06/sp06t002/sp06t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP06/sp06t002/sp06t002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,17 +23,17 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { /* ============================================================================= */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* constants */ @@ -62,12 +62,12 @@ typedef struct { /* descriptions of tested threads */ static ThreadDesc threadsDesc[THREADS_COUNT] = { - { "threadRunning", "testedMethod", "(ZI)V", NULL, NULL, NULL, NSK_JVMTI_INVALID_JLOCATION, NSK_FALSE }, - { "threadEntering", "testedMethod", "(ZI)V", NULL, NULL, NULL, NSK_JVMTI_INVALID_JLOCATION, NSK_FALSE }, - { "threadWaiting", "testedMethod", "(ZI)V", NULL, NULL, NULL, NSK_JVMTI_INVALID_JLOCATION, NSK_FALSE }, - { "threadSleeping", "testedMethod", "(ZI)V", NULL, NULL, NULL, NSK_JVMTI_INVALID_JLOCATION, NSK_FALSE }, - { "threadRunningInterrupted", "testedMethod", "(ZI)V", NULL, NULL, NULL, NSK_JVMTI_INVALID_JLOCATION, NSK_FALSE }, - { "threadRunningNative", "testedMethod", "(ZI)V", NULL, NULL, NULL, NSK_JVMTI_INVALID_JLOCATION, NSK_FALSE } + { "threadRunning", "testedMethod", "(ZI)V", nullptr, nullptr, nullptr, NSK_JVMTI_INVALID_JLOCATION, NSK_FALSE }, + { "threadEntering", "testedMethod", "(ZI)V", nullptr, nullptr, nullptr, NSK_JVMTI_INVALID_JLOCATION, NSK_FALSE }, + { "threadWaiting", "testedMethod", "(ZI)V", nullptr, nullptr, nullptr, NSK_JVMTI_INVALID_JLOCATION, NSK_FALSE }, + { "threadSleeping", "testedMethod", "(ZI)V", nullptr, nullptr, nullptr, NSK_JVMTI_INVALID_JLOCATION, NSK_FALSE }, + { "threadRunningInterrupted", "testedMethod", "(ZI)V", nullptr, nullptr, nullptr, NSK_JVMTI_INVALID_JLOCATION, NSK_FALSE }, + { "threadRunningNative", "testedMethod", "(ZI)V", nullptr, nullptr, nullptr, NSK_JVMTI_INVALID_JLOCATION, NSK_FALSE } }; /* indexes of known threads */ @@ -160,7 +160,7 @@ static int generateEvents() { * - enable events */ static int prepare() { - jthread *allThreadsList = NULL; + jthread *allThreadsList = nullptr; jint allThreadsCount = 0; int found = 0; int i; @@ -169,8 +169,8 @@ static int prepare() { /* clean threads list */ for (i = 0; i < THREADS_COUNT; i++) { - threadsDesc[i].thread = (jthread)NULL; - threadsDesc[i].method = (jmethodID)NULL; + threadsDesc[i].thread = (jthread)nullptr; + threadsDesc[i].method = (jmethodID)nullptr; threadsDesc[i].location = NSK_JVMTI_INVALID_JLOCATION; threadsDesc[i].methodCompiled = NSK_FALSE; } @@ -179,20 +179,20 @@ static int prepare() { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&allThreadsCount, &allThreadsList))) return NSK_FALSE; - if (!NSK_VERIFY(allThreadsCount > 0 && allThreadsList != NULL)) + if (!NSK_VERIFY(allThreadsCount > 0 && allThreadsList != nullptr)) return NSK_FALSE; /* find tested threads */ for (i = 0; i < allThreadsCount; i++) { jvmtiThreadInfo threadInfo; - if (!NSK_VERIFY(allThreadsList[i] != NULL)) + if (!NSK_VERIFY(allThreadsList[i] != nullptr)) return NSK_FALSE; if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(allThreadsList[i], &threadInfo))) return NSK_FALSE; - if (threadInfo.name != NULL) { + if (threadInfo.name != nullptr) { int j; for (j = 0; j < THREADS_COUNT; j++) { @@ -212,7 +212,7 @@ static int prepare() { /* check if all tested threads found */ found = 0; for (i = 0; i < THREADS_COUNT; i++) { - if (threadsDesc[i].thread == NULL) { + if (threadsDesc[i].thread == nullptr) { NSK_COMPLAIN2("Not found tested thread #%d (%s)\n", i, threadsDesc[i].threadName); } else { found++; @@ -227,11 +227,11 @@ static int prepare() { for (i = 0; i < THREADS_COUNT; i++) { if (!NSK_JNI_VERIFY(jni, (threadsDesc[i].cls = - jni->GetObjectClass(threadsDesc[i].thread)) != NULL)) + jni->GetObjectClass(threadsDesc[i].thread)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (threadsDesc[i].method = - jni->GetMethodID(threadsDesc[i].cls, threadsDesc[i].methodName, threadsDesc[i].methodSig)) != NULL)) + jni->GetMethodID(threadsDesc[i].cls, threadsDesc[i].methodName, threadsDesc[i].methodSig)) != nullptr)) return NSK_FALSE; NSK_DISPLAY4(" thread #%d (%s): 0x%p (%s)\n", @@ -243,15 +243,15 @@ static int prepare() { /* make global refs */ for (i = 0; i < THREADS_COUNT; i++) { if (!NSK_JNI_VERIFY(jni, (threadsDesc[i].thread = (jthread) - jni->NewGlobalRef(threadsDesc[i].thread)) != NULL)) + jni->NewGlobalRef(threadsDesc[i].thread)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (threadsDesc[i].cls = (jclass) - jni->NewGlobalRef(threadsDesc[i].cls)) != NULL)) + jni->NewGlobalRef(threadsDesc[i].cls)) != nullptr)) return NSK_FALSE; } NSK_DISPLAY0("Enable tested events\n"); - if (!nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, eventsList, NULL)) + if (!nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, eventsList, nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -337,8 +337,8 @@ static int checkThreads(int suspended, const char* kind0) { j, (void*)frameStack[j].method, (long)frameStack[j].location); /* check frame method */ - if (frameStack[j].method == NULL) { - NSK_COMPLAIN3("NULL methodID in stack for %s thread #%d (%s)\n", + if (frameStack[j].method == nullptr) { + NSK_COMPLAIN3("null methodID in stack for %s thread #%d (%s)\n", kind, i, threadsDesc[i].threadName); nsk_jvmti_setFailStatus(); } else if (frameStack[j].method == threadsDesc[i].method) { @@ -372,7 +372,7 @@ static int clean() { int i; NSK_DISPLAY0("Disable events\n"); - if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, eventsList, NULL)) + if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, eventsList, nullptr)) return NSK_FALSE; NSK_DISPLAY0("Dispose global references to threads\n"); @@ -503,7 +503,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; { @@ -524,7 +524,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP06/sp06t003/sp06t003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP06/sp06t003/sp06t003.cpp index 5c06270a9770..cc2811d520dc 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP06/sp06t003/sp06t003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP06/sp06t003/sp06t003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,17 +23,17 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { /* ============================================================================= */ /* scaffold objects */ -static JNIEnv* jni = NULL; -static jvmtiEnv *jvmti = NULL; +static JNIEnv* jni = nullptr; +static jvmtiEnv *jvmti = nullptr; static jlong timeout = 0; /* constants */ @@ -62,12 +62,12 @@ typedef struct { /* descriptions of tested threads */ static ThreadDesc threadsDesc[THREADS_COUNT] = { - { "threadRunning", "testedMethod", "(ZI)V", NULL, NULL, NULL, NSK_JVMTI_INVALID_JLOCATION, NSK_FALSE }, - { "threadEntering", "testedMethod", "(ZI)V", NULL, NULL, NULL, NSK_JVMTI_INVALID_JLOCATION, NSK_FALSE }, - { "threadWaiting", "testedMethod", "(ZI)V", NULL, NULL, NULL, NSK_JVMTI_INVALID_JLOCATION, NSK_FALSE }, - { "threadSleeping", "testedMethod", "(ZI)V", NULL, NULL, NULL, NSK_JVMTI_INVALID_JLOCATION, NSK_FALSE }, - { "threadRunningInterrupted", "testedMethod", "(ZI)V", NULL, NULL, NULL, NSK_JVMTI_INVALID_JLOCATION, NSK_FALSE }, - { "threadRunningNative", "testedMethod", "(ZI)V", NULL, NULL, NULL, NSK_JVMTI_INVALID_JLOCATION, NSK_FALSE } + { "threadRunning", "testedMethod", "(ZI)V", nullptr, nullptr, nullptr, NSK_JVMTI_INVALID_JLOCATION, NSK_FALSE }, + { "threadEntering", "testedMethod", "(ZI)V", nullptr, nullptr, nullptr, NSK_JVMTI_INVALID_JLOCATION, NSK_FALSE }, + { "threadWaiting", "testedMethod", "(ZI)V", nullptr, nullptr, nullptr, NSK_JVMTI_INVALID_JLOCATION, NSK_FALSE }, + { "threadSleeping", "testedMethod", "(ZI)V", nullptr, nullptr, nullptr, NSK_JVMTI_INVALID_JLOCATION, NSK_FALSE }, + { "threadRunningInterrupted", "testedMethod", "(ZI)V", nullptr, nullptr, nullptr, NSK_JVMTI_INVALID_JLOCATION, NSK_FALSE }, + { "threadRunningNative", "testedMethod", "(ZI)V", nullptr, nullptr, nullptr, NSK_JVMTI_INVALID_JLOCATION, NSK_FALSE } }; /* indexes of known threads */ @@ -160,7 +160,7 @@ static int generateEvents() { * - enable events */ static int prepare() { - jthread *allThreadsList = NULL; + jthread *allThreadsList = nullptr; jint allThreadsCount = 0; int found = 0; int i; @@ -169,8 +169,8 @@ static int prepare() { /* clean threads list */ for (i = 0; i < THREADS_COUNT; i++) { - threadsDesc[i].thread = (jthread)NULL; - threadsDesc[i].method = (jmethodID)NULL; + threadsDesc[i].thread = (jthread)nullptr; + threadsDesc[i].method = (jmethodID)nullptr; threadsDesc[i].location = NSK_JVMTI_INVALID_JLOCATION; threadsDesc[i].methodCompiled = NSK_FALSE; } @@ -179,20 +179,20 @@ static int prepare() { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&allThreadsCount, &allThreadsList))) return NSK_FALSE; - if (!NSK_VERIFY(allThreadsCount > 0 && allThreadsList != NULL)) + if (!NSK_VERIFY(allThreadsCount > 0 && allThreadsList != nullptr)) return NSK_FALSE; /* find tested threads */ for (i = 0; i < allThreadsCount; i++) { jvmtiThreadInfo threadInfo; - if (!NSK_VERIFY(allThreadsList[i] != NULL)) + if (!NSK_VERIFY(allThreadsList[i] != nullptr)) return NSK_FALSE; if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(allThreadsList[i], &threadInfo))) return NSK_FALSE; - if (threadInfo.name != NULL) { + if (threadInfo.name != nullptr) { int j; for (j = 0; j < THREADS_COUNT; j++) { @@ -212,7 +212,7 @@ static int prepare() { /* check if all tested threads found */ found = 0; for (i = 0; i < THREADS_COUNT; i++) { - if (threadsDesc[i].thread == NULL) { + if (threadsDesc[i].thread == nullptr) { NSK_COMPLAIN2("Not found tested thread #%d (%s)\n", i, threadsDesc[i].threadName); } else { found++; @@ -227,11 +227,11 @@ static int prepare() { for (i = 0; i < THREADS_COUNT; i++) { if (!NSK_JNI_VERIFY(jni, (threadsDesc[i].cls = - jni->GetObjectClass(threadsDesc[i].thread)) != NULL)) + jni->GetObjectClass(threadsDesc[i].thread)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (threadsDesc[i].method = - jni->GetMethodID(threadsDesc[i].cls, threadsDesc[i].methodName, threadsDesc[i].methodSig)) != NULL)) + jni->GetMethodID(threadsDesc[i].cls, threadsDesc[i].methodName, threadsDesc[i].methodSig)) != nullptr)) return NSK_FALSE; NSK_DISPLAY4(" thread #%d (%s): 0x%p (%s)\n", @@ -243,15 +243,15 @@ static int prepare() { /* make global refs */ for (i = 0; i < THREADS_COUNT; i++) { if (!NSK_JNI_VERIFY(jni, (threadsDesc[i].thread = (jthread) - jni->NewGlobalRef(threadsDesc[i].thread)) != NULL)) + jni->NewGlobalRef(threadsDesc[i].thread)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (threadsDesc[i].cls = (jclass) - jni->NewGlobalRef(threadsDesc[i].cls)) != NULL)) + jni->NewGlobalRef(threadsDesc[i].cls)) != nullptr)) return NSK_FALSE; } NSK_DISPLAY0("Enable tested events\n"); - if (!nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, eventsList, NULL)) + if (!nsk_jvmti_enableEvents(JVMTI_ENABLE, EVENTS_COUNT, eventsList, nullptr)) return NSK_FALSE; return NSK_TRUE; @@ -320,7 +320,7 @@ static int checkThreads(int suspended, const char* kind0) { found = 0; for (j = 0; j < frameStackSize; j++) { - jmethodID qMethod = (jmethodID)NULL; + jmethodID qMethod = (jmethodID)nullptr; jlocation qLocation = NSK_JVMTI_INVALID_JLOCATION; NSK_DISPLAY3(" %d frame: method: 0x%p, location: %ld\n", @@ -384,7 +384,7 @@ static int clean() { int i; NSK_DISPLAY0("Disable events\n"); - if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, eventsList, NULL)) + if (!nsk_jvmti_enableEvents(JVMTI_DISABLE, EVENTS_COUNT, eventsList, nullptr)) return NSK_FALSE; NSK_DISPLAY0("Dispose global references to threads\n"); @@ -515,7 +515,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { timeout = nsk_jvmti_getWaitTime() * 60 * 1000; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; { @@ -536,7 +536,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP07/sp07t001/sp07t001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP07/sp07t001/sp07t001.cpp index 0a9125332e0f..7210f4aef2e6 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP07/sp07t001/sp07t001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP07/sp07t001/sp07t001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -41,9 +41,9 @@ static const jlong SAMPLING_INTERVAL = 10; static jlong timeout = 0; /* test objects */ -static jthread thread = NULL; -static jrawMonitorID waitLock = NULL; -static jrawMonitorID frameLock = NULL; +static jthread thread = nullptr; +static jrawMonitorID waitLock = nullptr; +static jrawMonitorID frameLock = nullptr; static int sampleCount = 0; static volatile int depth = 0; static jvmtiFrameInfo sampleStack[MAX_DEPTH]; @@ -55,7 +55,7 @@ static jvmtiFrameInfo frameBuffer[MAX_DEPTH]; static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { const char* THREAD_NAME = "Debuggee Thread"; jvmtiThreadInfo info; - jthread *threads = NULL; + jthread *threads = nullptr; jint threads_count = 0; int i; @@ -65,12 +65,12 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -80,11 +80,11 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL && (strcmp(info.name, THREAD_NAME) == 0)) { + if (info.name != nullptr && (strcmp(info.name, THREAD_NAME) == 0)) { thread = threads[i]; } - if (info.name != NULL) { + if (info.name != nullptr) { if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)info.name))) return NSK_FALSE; } @@ -94,7 +94,7 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads))) return NSK_FALSE; - if (thread == NULL) { + if (thread == nullptr) { NSK_COMPLAIN0("Debuggee thread not found"); return NSK_FALSE; } @@ -123,27 +123,27 @@ static int wait_for(jvmtiEnv* jvmti, jlong millis) { static int displayFrameInfo(jvmtiEnv* jvmti, jint i) { char buffer[32]; - char *name = NULL; - char *signature = NULL; + char *name = nullptr; + char *signature = nullptr; - if (!NSK_JVMTI_VERIFY(jvmti->GetMethodName(frameBuffer[frameCount-1-i].method, &name, &signature, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->GetMethodName(frameBuffer[frameCount-1-i].method, &name, &signature, nullptr))) return NSK_FALSE; NSK_DISPLAY4(" got[%d] method: %s%s, location: %s\n", i, name, signature, jlong_to_string(frameBuffer[frameCount-1-i].location, buffer)); - if (name != NULL) + if (name != nullptr) jvmti->Deallocate((unsigned char*)name); - if (signature != NULL) + if (signature != nullptr) jvmti->Deallocate((unsigned char*)signature); - if (!NSK_JVMTI_VERIFY(jvmti->GetMethodName(sampleStack[i].method, &name, &signature, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->GetMethodName(sampleStack[i].method, &name, &signature, nullptr))) return NSK_FALSE; NSK_DISPLAY4(" exp[%d] method: %s%s, location: %s\n", i, name, signature, jlong_to_string(sampleStack[i].location, buffer)); - if (name != NULL) + if (name != nullptr) jvmti->Deallocate((unsigned char*)name); - if (signature != NULL) + if (signature != nullptr) jvmti->Deallocate((unsigned char*)signature); return NSK_TRUE; @@ -151,27 +151,27 @@ static int displayFrameInfo(jvmtiEnv* jvmti, jint i) { static int complainFrameInfo(jvmtiEnv* jvmti, jint i) { char buffer[32]; - char *name = NULL; - char *signature = NULL; + char *name = nullptr; + char *signature = nullptr; - if (!NSK_JVMTI_VERIFY(jvmti->GetMethodName(frameBuffer[frameCount-1-i].method, &name, &signature, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->GetMethodName(frameBuffer[frameCount-1-i].method, &name, &signature, nullptr))) return NSK_FALSE; NSK_COMPLAIN3(" got: method=%s%s, location=%s\n", name, signature, jlong_to_string(frameBuffer[frameCount-1-i].location, buffer)); - if (name != NULL) + if (name != nullptr) jvmti->Deallocate((unsigned char*)name); - if (signature != NULL) + if (signature != nullptr) jvmti->Deallocate((unsigned char*)signature); - if (!NSK_JVMTI_VERIFY(jvmti->GetMethodName(sampleStack[i].method, &name, &signature, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->GetMethodName(sampleStack[i].method, &name, &signature, nullptr))) return NSK_FALSE; NSK_COMPLAIN3(" expected: method=%s%s, location=%s\n", name, signature, jlong_to_string(sampleStack[i].location, buffer)); - if (name != NULL) + if (name != nullptr) jvmti->Deallocate((unsigned char*)name); - if (signature != NULL) + if (signature != nullptr) jvmti->Deallocate((unsigned char*)signature); return NSK_TRUE; @@ -257,8 +257,8 @@ JNIEXPORT jint JNICALL Java_nsk_jvmti_scenarios_sampling_SP07_sp07t001Thread_wrapper(JNIEnv* jni, jobject obj, jint i) { jint result = 0; - jclass klass = NULL; - jmethodID method = NULL; + jclass klass = nullptr; + jmethodID method = nullptr; jvmtiEnv* jvmti = nsk_jvmti_getAgentJVMTIEnv(); if (!NSK_VERIFY(depth < MAX_DEPTH)) { @@ -269,14 +269,14 @@ Java_nsk_jvmti_scenarios_sampling_SP07_sp07t001Thread_wrapper(JNIEnv* jni, if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(frameLock))) return NSK_FALSE; - if (!NSK_JVMTI_VERIFY(jvmti->GetFrameLocation(NULL, 1, &sampleStack[depth].method, &sampleStack[depth].location))) { + if (!NSK_JVMTI_VERIFY(jvmti->GetFrameLocation(nullptr, 1, &sampleStack[depth].method, &sampleStack[depth].location))) { nsk_jvmti_setFailStatus(); return 0; } depth++; - if (!NSK_JVMTI_VERIFY(jvmti->GetFrameLocation(NULL, 0, &sampleStack[depth].method, &sampleStack[depth].location))) { + if (!NSK_JVMTI_VERIFY(jvmti->GetFrameLocation(nullptr, 0, &sampleStack[depth].method, &sampleStack[depth].location))) { nsk_jvmti_setFailStatus(); return 0; } @@ -286,12 +286,12 @@ Java_nsk_jvmti_scenarios_sampling_SP07_sp07t001Thread_wrapper(JNIEnv* jni, if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(frameLock))) return NSK_FALSE; - if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(obj)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(obj)) != nullptr)) { nsk_jvmti_setFailStatus(); return 0; } - if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "fibonacci", "(I)I")) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "fibonacci", "(I)I")) != nullptr)) { nsk_jvmti_setFailStatus(); return 0; } @@ -325,7 +325,7 @@ JNIEXPORT jint JNI_OnLoad_sp07t001(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; /* init framework and parse options */ if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) @@ -336,14 +336,14 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("frameLock", &frameLock))) return NSK_FALSE; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP07/sp07t002/sp07t002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP07/sp07t002/sp07t002.cpp index a83af49dc477..0f92263796c9 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP07/sp07t002/sp07t002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/sampling/SP07/sp07t002/sp07t002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "agent_common.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -41,12 +41,12 @@ static const jlong SAMPLING_INTERVAL = 10; static jlong timeout = 0; /* test objects */ -static jthread thread = NULL; -static jrawMonitorID waitLock = NULL; -static jfieldID field = NULL; -static jmethodID methodRun = NULL; -static jmethodID methodCatcher = NULL; -static jmethodID methodThrower = NULL; +static jthread thread = nullptr; +static jrawMonitorID waitLock = nullptr; +static jfieldID field = nullptr; +static jmethodID methodRun = nullptr; +static jmethodID methodCatcher = nullptr; +static jmethodID methodThrower = nullptr; static jint MAX_LADDER = 0; static int sampleCount = 0; static jint frameCount = 0; @@ -57,10 +57,10 @@ static jvmtiFrameInfo frameBuffer[MAX_DEPTH]; static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { const char* THREAD_NAME = "Debuggee Thread"; jvmtiThreadInfo info; - jthread *threads = NULL; + jthread *threads = nullptr; jint threads_count = 0; - jclass klass = NULL; - jfieldID fid = NULL; + jclass klass = nullptr; + jfieldID fid = nullptr; int i; NSK_DISPLAY0("Prepare: find tested thread\n"); @@ -69,12 +69,12 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads))) return NSK_FALSE; - if (!NSK_VERIFY(threads_count > 0 && threads != NULL)) + if (!NSK_VERIFY(threads_count > 0 && threads != nullptr)) return NSK_FALSE; /* find tested thread */ for (i = 0; i < threads_count; i++) { - if (!NSK_VERIFY(threads[i] != NULL)) + if (!NSK_VERIFY(threads[i] != nullptr)) return NSK_FALSE; /* get thread information */ @@ -84,11 +84,11 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]); /* find by name */ - if (info.name != NULL && (strcmp(info.name, THREAD_NAME) == 0)) { + if (info.name != nullptr && (strcmp(info.name, THREAD_NAME) == 0)) { thread = threads[i]; } - if (info.name != NULL) { + if (info.name != nullptr) { if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)info.name))) return NSK_FALSE; } @@ -98,37 +98,37 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads))) return NSK_FALSE; - if (thread == NULL) { + if (thread == nullptr) { NSK_COMPLAIN0("Debuggee thread not found"); return NSK_FALSE; } /* get tested thread class */ - if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != nullptr)) return NSK_FALSE; /* get tested thread field 'MAX_LADDER' */ - if (!NSK_JNI_VERIFY(jni, (fid = jni->GetStaticFieldID(klass, "MAX_LADDER", "I")) != NULL)) + if (!NSK_JNI_VERIFY(jni, (fid = jni->GetStaticFieldID(klass, "MAX_LADDER", "I")) != nullptr)) return NSK_FALSE; MAX_LADDER = jni->GetStaticIntField(klass, fid); NSK_DISPLAY1("MAX_LADDER: %d\n", MAX_LADDER); /* get tested thread field 'depth' */ - if (!NSK_JNI_VERIFY(jni, (field = jni->GetFieldID(klass, "depth", "I")) != NULL)) + if (!NSK_JNI_VERIFY(jni, (field = jni->GetFieldID(klass, "depth", "I")) != nullptr)) return NSK_FALSE; /* get tested thread method 'run' */ - if (!NSK_JNI_VERIFY(jni, (methodRun = jni->GetMethodID(klass, "run", "()V")) != NULL)) + if (!NSK_JNI_VERIFY(jni, (methodRun = jni->GetMethodID(klass, "run", "()V")) != nullptr)) return NSK_FALSE; /* get tested thread method 'catcher' */ if (!NSK_JNI_VERIFY(jni, (methodCatcher = - jni->GetMethodID(klass, "catcher", "(II)V")) != NULL)) + jni->GetMethodID(klass, "catcher", "(II)V")) != nullptr)) return NSK_FALSE; /* get tested thread method 'thrower' */ - if (!NSK_JNI_VERIFY(jni, (methodThrower= jni->GetMethodID(klass, "thrower", "(I)V")) != NULL)) + if (!NSK_JNI_VERIFY(jni, (methodThrower= jni->GetMethodID(klass, "thrower", "(I)V")) != nullptr)) return NSK_FALSE; if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("waitLock", &waitLock))) @@ -155,17 +155,17 @@ static int wait_for(jvmtiEnv* jvmti, jlong millis) { static int displayFrameInfo(jvmtiEnv* jvmti, jint i) { char buffer[32]; - char *name = NULL; - char *signature = NULL; + char *name = nullptr; + char *signature = nullptr; - if (!NSK_JVMTI_VERIFY(jvmti->GetMethodName(frameBuffer[frameCount-1-i].method, &name, &signature, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->GetMethodName(frameBuffer[frameCount-1-i].method, &name, &signature, nullptr))) return NSK_FALSE; NSK_DISPLAY4(" [%d] method: %s%s, location: %s\n", i, name, signature, jlong_to_string(frameBuffer[frameCount-1-i].location, buffer)); - if (name != NULL) + if (name != nullptr) jvmti->Deallocate((unsigned char*)name); - if (signature != NULL) + if (signature != nullptr) jvmti->Deallocate((unsigned char*)signature); return NSK_TRUE; @@ -173,20 +173,20 @@ static int displayFrameInfo(jvmtiEnv* jvmti, jint i) { static int complainFrameInfo(jvmtiEnv* jvmti, jint i, jmethodID method) { char buffer[32]; - char *name = NULL; - char *signature = NULL; + char *name = nullptr; + char *signature = nullptr; - if (!NSK_JVMTI_VERIFY(jvmti->GetMethodName(frameBuffer[frameCount-1-i].method, &name, &signature, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->GetMethodName(frameBuffer[frameCount-1-i].method, &name, &signature, nullptr))) return NSK_FALSE; NSK_COMPLAIN3(" got method: %s%s, location: %s\n", name, signature, jlong_to_string(frameBuffer[frameCount-1-i].location, buffer)); - if (name != NULL) + if (name != nullptr) jvmti->Deallocate((unsigned char*)name); - if (signature != NULL) + if (signature != nullptr) jvmti->Deallocate((unsigned char*)signature); - if (!NSK_JVMTI_VERIFY(jvmti->GetMethodName(method, &name, &signature, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->GetMethodName(method, &name, &signature, nullptr))) return NSK_FALSE; NSK_COMPLAIN2(" expected method: %s%s\n", name, signature); @@ -196,7 +196,7 @@ static int complainFrameInfo(jvmtiEnv* jvmti, jint i, jmethodID method) { static int checkStackTrace(jvmtiEnv* jvmti, JNIEnv* jni) { int res = NSK_TRUE; - jmethodID method = NULL; + jmethodID method = nullptr; jint depth; jint i; int displayFlag = @@ -288,7 +288,7 @@ JNIEXPORT jint JNI_OnLoad_sp07t002(JavaVM *jvm, char *options, void *reserved) { } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiCapabilities caps; /* init framework and parse options */ @@ -300,7 +300,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; memset(&caps, 0, sizeof(caps)); @@ -309,7 +309,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref001/followref001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref001/followref001.cpp index 08661336a143..ff431aa2203e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref001/followref001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref001/followref001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,9 +24,9 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -62,7 +62,7 @@ static int objectsCount = 0; static int fakeUserData = 0; static int userDataError = 0; -static ObjectDesc* objectDescList = NULL; +static ObjectDesc* objectDescList = nullptr; static const jlong ROOT_CLASS_TAG = 9; static const jlong CHAIN_CLASS_TAG = 99; @@ -95,8 +95,6 @@ static const char* ref_kind_str[28] = { "JVMTI_HEAP_REFERENCE_OTHER" }; -#define DEREF(ptr) (((ptr) == NULL ? 0 : *(ptr))) - /* ============================================================================= */ @@ -175,7 +173,7 @@ static bool getAndTagClasses(jvmtiEnv* jvmti, jclass* rootObjectClass, jclass* chainObjectClass) { - if (!NSK_JNI_VERIFY(jni, (*debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (*debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return false; } @@ -184,7 +182,7 @@ static bool getAndTagClasses(jvmtiEnv* jvmti, fflush(0); if (!NSK_JNI_VERIFY(jni, (*rootObjectClass = - jni->FindClass(ROOT_OBJECT_CLASS_NAME)) != NULL)) { + jni->FindClass(ROOT_OBJECT_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return false; } @@ -200,7 +198,7 @@ static bool getAndTagClasses(jvmtiEnv* jvmti, if (!NSK_JNI_VERIFY(jni, (*chainObjectClass = - jni->FindClass(CHAIN_OBJECT_CLASS_NAME)) != NULL)) { + jni->FindClass(CHAIN_OBJECT_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return false; } @@ -227,10 +225,10 @@ static bool getFieldsAndObjects(jvmtiEnv* jvmti, jfieldID* reachableChainField, jfieldID* unreachableChainField, jfieldID* nextField) { - jfieldID rootObjectField = NULL; + jfieldID rootObjectField = nullptr; if (!NSK_JNI_VERIFY(jni, (rootObjectField = - jni->GetStaticFieldID(debugeeClass, OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != NULL)) { + jni->GetStaticFieldID(debugeeClass, OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return false; } @@ -239,7 +237,7 @@ static bool getFieldsAndObjects(jvmtiEnv* jvmti, fflush(0); if (!NSK_JNI_VERIFY(jni, (*reachableChainField = - jni->GetFieldID(rootObjectClass, REACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) { + jni->GetFieldID(rootObjectClass, REACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return false; } @@ -248,7 +246,7 @@ static bool getFieldsAndObjects(jvmtiEnv* jvmti, fflush(0); if (!NSK_JNI_VERIFY(jni, (*unreachableChainField = - jni->GetFieldID(rootObjectClass, UNREACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) { + jni->GetFieldID(rootObjectClass, UNREACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return false; } @@ -258,7 +256,7 @@ static bool getFieldsAndObjects(jvmtiEnv* jvmti, fflush(0); if (!NSK_JNI_VERIFY(jni, (*nextField = - jni->GetFieldID(chainObjectClass, NEXT_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) { + jni->GetFieldID(chainObjectClass, NEXT_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return false; } @@ -267,14 +265,14 @@ static bool getFieldsAndObjects(jvmtiEnv* jvmti, fflush(0); if (!NSK_JNI_VERIFY(jni, (*rootObjectPtr = - jni->GetStaticObjectField(debugeeClass, rootObjectField)) != NULL)) { + jni->GetStaticObjectField(debugeeClass, rootObjectField)) != nullptr)) { nsk_jvmti_setFailStatus(); return false; } printf("\nFound root object: 0x%p\n", (void*) *rootObjectPtr); fflush(0); - if (!NSK_JNI_VERIFY(jni, (*rootObjectPtr = jni->NewGlobalRef(*rootObjectPtr)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (*rootObjectPtr = jni->NewGlobalRef(*rootObjectPtr)) != nullptr)) { nsk_jvmti_setFailStatus(); return false; } @@ -296,7 +294,7 @@ static bool getAndTagChainObjects( ObjectDesc objectDescList[], jlong tag, bool reachable) { - jobject nextObj = NULL; + jobject nextObj = nullptr; jlong objTag = (reachable ? tag : -tag); if (count <= 0) { @@ -306,7 +304,7 @@ static bool getAndTagChainObjects( count--; tag++; - if (!NSK_JNI_VERIFY(jni, (nextObj = jni->GetObjectField(currObj, refField)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (nextObj = jni->GetObjectField(currObj, refField)) != nullptr)) { nsk_jvmti_setFailStatus(); return false; } @@ -350,13 +348,13 @@ static int getAndTagTestedObjects( ObjectDesc** objectDescList, jobject* rootObjectPtr) { - jclass debugeeClass = NULL; - jclass rootObjectClass = NULL; - jclass chainObjectClass = NULL; + jclass debugeeClass = nullptr; + jclass rootObjectClass = nullptr; + jclass chainObjectClass = nullptr; - jfieldID reachableChainField = NULL; - jfieldID unreachableChainField = NULL; - jfieldID nextField = NULL; + jfieldID reachableChainField = nullptr; + jfieldID unreachableChainField = nullptr; + jfieldID nextField = nullptr; if (!initObjectDescList(jvmti, chainLength, @@ -504,12 +502,12 @@ static void releaseTestedObjects(jvmtiEnv* jvmti, ObjectDesc* objectDescList, jobject rootObject) { - if (rootObject != NULL) { + if (rootObject != nullptr) { printf("Release object reference to root tested object: 0x%p\n", rootObject); NSK_TRACE(jni->DeleteGlobalRef(rootObject)); } - if (objectDescList != NULL) { + if (objectDescList != nullptr) { printf("Deallocate objects list: 0x%p\n", (void*)objectDescList); if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)objectDescList))) { nsk_jvmti_setFailStatus(); @@ -577,7 +575,7 @@ jint JNICALL heapReferenceCallback( nsk_jvmti_setFailStatus(); } - if (tag_ptr != NULL && *tag_ptr != 0) { + if (tag_ptr != nullptr && *tag_ptr != 0) { int found = 0; int i; @@ -724,7 +722,7 @@ jint JNICALL stringPrimitiveValueCallback( /** Agent algorithm. */ static void JNICALL agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { - jobject rootObject = NULL; + jobject rootObject = nullptr; printf("Wait for tested objects created\n"); fflush(0); @@ -760,7 +758,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { fflush(0); if (!NSK_JVMTI_VERIFY(jvmti->FollowReferences((jint) 0, /* heap_filter */ - (jclass) NULL, /* class */ + (jclass) nullptr, /* class */ rootObject, /* initial_object */ &heapCallbacks, (const void *) &fakeUserData))) { @@ -803,7 +801,7 @@ JNIEXPORT jint JNI_OnLoad_followref001(JavaVM *jvm, char *options, void *reserve } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) { return JNI_ERR; @@ -814,7 +812,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_VERIFY(chainLength > 0)) return JNI_ERR; - if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) { + if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) { return JNI_ERR; } @@ -829,13 +827,13 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } /* Setting Heap Callbacks */ - heapCallbacks.heap_iteration_callback = NULL; + heapCallbacks.heap_iteration_callback = nullptr; heapCallbacks.heap_reference_callback = heapReferenceCallback; heapCallbacks.primitive_field_callback = primitiveFieldCallback; heapCallbacks.array_primitive_value_callback = arrayPrimitiveValueCallback; heapCallbacks.string_primitive_value_callback = stringPrimitiveValueCallback; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) { + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) { return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref002/followref002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref002/followref002.cpp index ee1eff158d6c..6366b430776c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref002/followref002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref002/followref002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, 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,9 +23,9 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -60,7 +60,7 @@ static int objectsCount = 0; static int fakeUserData = 0; static int userDataError = 0; -static ObjectDesc* objectDescList = NULL; +static ObjectDesc* objectDescList = nullptr; static jlong rootClassTag = 9; static jlong chainClassTag = 99; @@ -92,8 +92,6 @@ static const char* ref_kind_str[28] = { "JVMTI_HEAP_REFERENCE_OTHER" }; -#define DEREF(ptr) (((ptr) == NULL ? 0 : *(ptr))) - /* ============================================================================= */ /** Obtain chain of tested objects and tag them recursively. */ @@ -110,7 +108,7 @@ static int getAndTagChainObjects( jlong tag, int reachable) { - jobject obj = NULL; + jobject obj = nullptr; jlong objTag = (reachable ? tag : -tag); if (count <= 0) @@ -119,7 +117,7 @@ static int getAndTagChainObjects( count--; tag++; - if (!NSK_JNI_VERIFY(jni, (obj = jni->GetObjectField(firstObject, firstField)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (obj = jni->GetObjectField(firstObject, firstField)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -159,14 +157,14 @@ static int getAndTagTestedObjects( ObjectDesc** objectDescList, jobject* rootObject) { - jclass debugeeClass = NULL; - jclass rootObjectClass = NULL; - jclass chainObjectClass = NULL; + jclass debugeeClass = nullptr; + jclass rootObjectClass = nullptr; + jclass chainObjectClass = nullptr; - jfieldID objectField = NULL; - jfieldID reachableChainField = NULL; - jfieldID unreachableChainField = NULL; - jfieldID tailField = NULL; + jfieldID objectField = nullptr; + jfieldID reachableChainField = nullptr; + jfieldID unreachableChainField = nullptr; + jfieldID tailField = nullptr; /* root object + reachable and unreachable object chains */ *objectsCount = 1 + 2 * chainLength; @@ -194,7 +192,7 @@ static int getAndTagTestedObjects( printf("Find debugee class: %s\n", DEBUGEE_CLASS_NAME); fflush(0); - if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -202,7 +200,7 @@ static int getAndTagTestedObjects( printf("Find root object class: %s\n", ROOT_OBJECT_CLASS_NAME); fflush(0); - if (!NSK_JNI_VERIFY(jni, (rootObjectClass = jni->FindClass(ROOT_OBJECT_CLASS_NAME)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (rootObjectClass = jni->FindClass(ROOT_OBJECT_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -216,7 +214,7 @@ static int getAndTagTestedObjects( printf("Find chain object class: %s\n", CHAIN_OBJECT_CLASS_NAME); fflush(0); if (!NSK_JNI_VERIFY(jni, (chainObjectClass = - jni->FindClass(CHAIN_OBJECT_CLASS_NAME)) != NULL)) { + jni->FindClass(CHAIN_OBJECT_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -230,7 +228,7 @@ static int getAndTagTestedObjects( printf("Find static field in debugee class: %s\n", OBJECT_FIELD_NAME); fflush(0); if (!NSK_JNI_VERIFY(jni, (objectField = - jni->GetStaticFieldID(debugeeClass, OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != NULL)) { + jni->GetStaticFieldID(debugeeClass, OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -239,7 +237,7 @@ static int getAndTagTestedObjects( printf("Find instance field in root object class: %s\n", REACHABLE_CHAIN_FIELD_NAME); fflush(0); if (!NSK_JNI_VERIFY(jni, (reachableChainField = - jni->GetFieldID(rootObjectClass, REACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) { + jni->GetFieldID(rootObjectClass, REACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -248,7 +246,7 @@ static int getAndTagTestedObjects( printf("Find instance field in root object class: %s\n", UNREACHABLE_CHAIN_FIELD_NAME); fflush(0); if (!NSK_JNI_VERIFY(jni, (unreachableChainField = - jni->GetFieldID(rootObjectClass, UNREACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) { + jni->GetFieldID(rootObjectClass, UNREACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -257,7 +255,7 @@ static int getAndTagTestedObjects( printf("Find instance field in chain object class: %s\n", TAIL_FIELD_NAME); fflush(0); if (!NSK_JNI_VERIFY(jni, (tailField = - jni->GetFieldID(chainObjectClass, TAIL_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) { + jni->GetFieldID(chainObjectClass, TAIL_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -266,14 +264,14 @@ static int getAndTagTestedObjects( printf("Get root object from static field: %s\n", OBJECT_FIELD_NAME); fflush(0); if (!NSK_JNI_VERIFY(jni, (*rootObject = - jni->GetStaticObjectField(debugeeClass, objectField)) != NULL)) { + jni->GetStaticObjectField(debugeeClass, objectField)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } printf(" ... got object: 0x%p\n", (void*)*rootObject); fflush(0); - if (!NSK_JNI_VERIFY(jni, (*rootObject = jni->NewGlobalRef(*rootObject)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (*rootObject = jni->NewGlobalRef(*rootObject)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -394,12 +392,12 @@ static int checkTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, /** Release references to the tested objects and free allocated memory. */ static int releaseTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, ObjectDesc* objectDescList, jobject rootObject) { - if (rootObject != NULL) { + if (rootObject != nullptr) { printf("Release object reference to root tested object: 0x%p\n", rootObject); NSK_TRACE(jni->DeleteGlobalRef(rootObject)); } - if (objectDescList != NULL) { + if (objectDescList != nullptr) { printf("Deallocate objects list: 0x%p\n", (void*)objectDescList); if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)objectDescList))) { nsk_jvmti_setFailStatus(); @@ -460,13 +458,13 @@ jint JNICALL heapReferenceCallback( (int) referrer_index); fflush(0); - if (tag_ptr == NULL) { - NSK_COMPLAIN1("NULL tag_ptr is passed to heapReferenceCallback:" + if (tag_ptr == nullptr) { + NSK_COMPLAIN1("null tag_ptr is passed to heapReferenceCallback:" " tag_ptr=0x%p\n", (void*)tag_ptr); nsk_jvmti_setFailStatus(); } - if (tag_ptr != NULL && *tag_ptr != 0) { + if (tag_ptr != nullptr && *tag_ptr != 0) { int found = 0; int i; @@ -601,7 +599,7 @@ jint JNICALL stringPrimitiveValueCallback( /** Agent algorithm. */ static void JNICALL agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { - jobject rootObject = NULL; + jobject rootObject = nullptr; printf("Wait for tested objects created\n"); fflush(0); @@ -635,7 +633,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { { jint heap_filter = JVMTI_HEAP_FILTER_UNTAGGED | JVMTI_HEAP_FILTER_CLASS_UNTAGGED; if (!NSK_JVMTI_VERIFY(jvmti->FollowReferences(heap_filter, - (jclass) NULL, /* class */ + (jclass) nullptr, /* class */ rootObject, /* initial_object */ &heapCallbacks, (const void *) &fakeUserData))) { @@ -668,7 +666,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { jint heap_filter = JVMTI_HEAP_FILTER_UNTAGGED | JVMTI_HEAP_FILTER_CLASS_UNTAGGED | JVMTI_HEAP_FILTER_TAGGED | JVMTI_HEAP_FILTER_CLASS_TAGGED; if (!NSK_JVMTI_VERIFY(jvmti->FollowReferences(heap_filter, - (jclass) NULL, /* class */ + (jclass) nullptr, /* class */ rootObject, /* initial_object */ &heapCallbacks, (const void *) &fakeUserData))) { @@ -714,7 +712,7 @@ JNIEXPORT jint JNI_OnLoad_followref002(JavaVM *jvm, char *options, void *reserve } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -726,7 +724,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; { @@ -740,13 +738,13 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } /* Setting Heap Callbacks */ - heapCallbacks.heap_iteration_callback = NULL; + heapCallbacks.heap_iteration_callback = nullptr; heapCallbacks.heap_reference_callback = heapReferenceCallback; heapCallbacks.primitive_field_callback = primitiveFieldCallback; heapCallbacks.array_primitive_value_callback = arrayPrimitiveValueCallback; heapCallbacks.string_primitive_value_callback = stringPrimitiveValueCallback; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref003/followref003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref003/followref003.cpp index 22892f71a366..cb0385ee6535 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref003/followref003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref003/followref003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, 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,9 +23,9 @@ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -71,7 +71,7 @@ static int objectsCount = 0; static int fakeUserData = 0; static int userDataError = 0; -static ObjectDesc* objectDescList = NULL; +static ObjectDesc* objectDescList = nullptr; #define TARG_THREAD_TAG 11 #define FIRST_THREAD_TAG (TARG_THREAD_TAG + 1) @@ -118,9 +118,6 @@ static const char* ref_kind_str[28] = { }; -#define DEREF(ptr) (((ptr) == NULL ? 0 : *(ptr))) - - /* ============================================================================= */ /** Obtain chain of tested objects and tag them recursively. */ @@ -129,7 +126,7 @@ static int getChainObjects(jvmtiEnv* jvmti, JNIEnv* jni, jobject firstObject, jfieldID nextField, const char nextFieldName[], int count, ObjectDesc objectDescList[], jlong tag, int reachable) { - jobject obj = NULL; + jobject obj = nullptr; jlong objTag = (reachable ? tag : -tag); if (count <= 0) @@ -138,7 +135,7 @@ static int getChainObjects(jvmtiEnv* jvmti, JNIEnv* jni, jobject firstObject, count--; tag++; - if (!NSK_JNI_VERIFY(jni, (obj = jni->GetObjectField(firstObject, firstField)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (obj = jni->GetObjectField(firstObject, firstField)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -164,14 +161,14 @@ static int getChainObjects(jvmtiEnv* jvmti, JNIEnv* jni, jobject firstObject, static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, int *objectsCount, ObjectDesc* *objectDescList, jobject* rootObject) { - jclass debugeeClass = NULL; - jclass rootObjectClass = NULL; - jclass chainObjectClass = NULL; + jclass debugeeClass = nullptr; + jclass rootObjectClass = nullptr; + jclass chainObjectClass = nullptr; - jfieldID objectField = NULL; - jfieldID reachableChainField = NULL; - jfieldID unreachableChainField = NULL; - jfieldID tailField = NULL; + jfieldID objectField = nullptr; + jfieldID reachableChainField = nullptr; + jfieldID unreachableChainField = nullptr; + jfieldID tailField = nullptr; *objectsCount = 1 + 2 * chainLength; @@ -198,7 +195,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, printf("Find debugee class: %s\n", DEBUGEE_CLASS_NAME); fflush(0); - if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -206,7 +203,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, printf("Find root object class: %s\n", ROOT_OBJECT_CLASS_NAME); fflush(0); - if (!NSK_JNI_VERIFY(jni, (rootObjectClass = jni->FindClass(ROOT_OBJECT_CLASS_NAME)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (rootObjectClass = jni->FindClass(ROOT_OBJECT_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -221,7 +218,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, printf("Find chain object class: %s\n", CHAIN_OBJECT_CLASS_NAME); fflush(0); if (!NSK_JNI_VERIFY(jni, (chainObjectClass = - jni->FindClass(CHAIN_OBJECT_CLASS_NAME)) != NULL)) { + jni->FindClass(CHAIN_OBJECT_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -237,7 +234,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, printf("Find static field in debugee class: %s\n", OBJECT_FIELD_NAME); fflush(0); if (!NSK_JNI_VERIFY(jni, (objectField = - jni->GetStaticFieldID(debugeeClass, OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != NULL)) { + jni->GetStaticFieldID(debugeeClass, OBJECT_FIELD_NAME, ROOT_OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -246,7 +243,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, printf("Find instance field in root object class: %s\n", REACHABLE_CHAIN_FIELD_NAME); fflush(0); if (!NSK_JNI_VERIFY(jni, (reachableChainField = - jni->GetFieldID(rootObjectClass, REACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) { + jni->GetFieldID(rootObjectClass, REACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -255,7 +252,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, printf("Find instance field in root object class: %s\n", UNREACHABLE_CHAIN_FIELD_NAME); fflush(0); if (!NSK_JNI_VERIFY(jni, (unreachableChainField = - jni->GetFieldID(rootObjectClass, UNREACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) { + jni->GetFieldID(rootObjectClass, UNREACHABLE_CHAIN_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -264,7 +261,7 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, printf("Find instance field in chain object class: %s\n", TAIL_FIELD_NAME); fflush(0); if (!NSK_JNI_VERIFY(jni, (tailField = - jni->GetFieldID(chainObjectClass, TAIL_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != NULL)) { + jni->GetFieldID(chainObjectClass, TAIL_FIELD_NAME, CHAIN_OBJECT_CLASS_SIG)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -273,14 +270,14 @@ static int getTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, printf("Get root object from static field: %s\n", OBJECT_FIELD_NAME); fflush(0); if (!NSK_JNI_VERIFY(jni, (*rootObject = - jni->GetStaticObjectField(debugeeClass, objectField)) != NULL)) { + jni->GetStaticObjectField(debugeeClass, objectField)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } printf(" ... got object: 0x%p\n", (void*)*rootObject); fflush(0); - if (!NSK_JNI_VERIFY(jni, (*rootObject = jni->NewGlobalRef(*rootObject)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (*rootObject = jni->NewGlobalRef(*rootObject)) != nullptr)) { nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -394,12 +391,12 @@ static int checkTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, /** Release references to the tested objects and free allocated memory. */ static int releaseTestedObjects(jvmtiEnv* jvmti, JNIEnv* jni, int chainLength, ObjectDesc* objectDescList, jobject rootObject) { - if (rootObject != NULL) { + if (rootObject != nullptr) { printf("Release object reference to root tested object: 0x%p\n", rootObject); NSK_TRACE(jni->DeleteGlobalRef(rootObject)); } - if (objectDescList != NULL) { + if (objectDescList != nullptr) { printf("Deallocate objects list: 0x%p\n", (void*)objectDescList); if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)objectDescList))) { nsk_jvmti_setFailStatus(); @@ -469,8 +466,8 @@ static int registerFrame(jlong thr_id, jint depth, jmethodID method, * (Do we have to clarify this in the JVMTI spec?) * Do not consider the test as failing in such a case. */ - if (method == NULL && ref_kind != JVMTI_HEAP_REFERENCE_JNI_LOCAL) { - NSK_COMPLAIN0("methodID must not be NULL\n"); + if (method == nullptr && ref_kind != JVMTI_HEAP_REFERENCE_JNI_LOCAL) { + NSK_COMPLAIN0("methodID must not be null\n"); failed = 1; } if (failed) { @@ -590,7 +587,7 @@ jint JNICALL heapReferenceCallback( jint depth = -1; jint slot = -1; jint index = -1; - jmethodID method = (jmethodID) NULL; + jmethodID method = (jmethodID) nullptr; jlocation location = (jlocation)(-1); jlong tag = DEREF(tag_ptr); jlong ref_tag = DEREF(referrer_tag_ptr); @@ -670,13 +667,13 @@ jint JNICALL heapReferenceCallback( (int) index); fflush(0); - if (tag_ptr == NULL) { - NSK_COMPLAIN1("NULL tag_ptr is passed to heapReferenceCallback:" + if (tag_ptr == nullptr) { + NSK_COMPLAIN1("null tag_ptr is passed to heapReferenceCallback:" " tag_ptr=0x%p\n", (void*)tag_ptr); nsk_jvmti_setFailStatus(); } - if (tag_ptr != NULL && tag != 0) { + if (tag_ptr != nullptr && tag != 0) { int found = 0; int i; @@ -878,7 +875,7 @@ static jthread getTargetThread(jvmtiEnv *jvmti) { static const char *target_thread_name = "main"; jint i; jint thread_count = -1; - jthread *threads = NULL; + jthread *threads = nullptr; jvmti->GetAllThreads(&thread_count, &threads); @@ -891,7 +888,7 @@ static jthread getTargetThread(jvmtiEnv *jvmti) { } } - return NULL; + return nullptr; } static jvmtiError setTagForTargetThread(jvmtiEnv *jvmti, jlong tag) { @@ -902,7 +899,7 @@ static jvmtiError setTagForTargetThread(jvmtiEnv *jvmti, jlong tag) { /** Agent algorithm. */ static void JNICALL agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { - jobject rootObject = NULL; + jobject rootObject = nullptr; printf("Wait for tested objects created\n"); fflush(0); @@ -939,8 +936,8 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { fflush(0); { if (!NSK_JVMTI_VERIFY(jvmti->FollowReferences((jint) 0, /* heap_filter */ - (jclass) NULL, /* class */ - (jobject) NULL, /* initial_object */ + (jclass) nullptr, /* class */ + (jobject) nullptr, /* initial_object */ &heapCallbacks, (const void *) &fakeUserData))) { nsk_jvmti_setFailStatus(); @@ -977,8 +974,8 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { jint heap_filter = JVMTI_HEAP_FILTER_UNTAGGED | JVMTI_HEAP_FILTER_CLASS_UNTAGGED; if (!NSK_JVMTI_VERIFY(jvmti->FollowReferences(heap_filter, - (jclass) NULL, /* class */ - (jobject) NULL, /* initial_object */ + (jclass) nullptr, /* class */ + (jobject) nullptr, /* initial_object */ &heapCallbacks, (const void *) &fakeUserData))) { nsk_jvmti_setFailStatus(); @@ -1026,7 +1023,7 @@ JNIEXPORT jint JNI_OnLoad_followref003(JavaVM *jvm, char *options, void *reserve } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; @@ -1035,7 +1032,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { { const char* infoOpt = nsk_jvmti_findOptionValue("info"); - if (infoOpt != NULL) { + if (infoOpt != nullptr) { if (strcmp(infoOpt, "none") == 0) info = INFO_NONE; else if (strcmp(infoOpt, "all") == 0) @@ -1061,7 +1058,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; { @@ -1075,13 +1072,13 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } /* Setting Heap Callbacks */ - heapCallbacks.heap_iteration_callback = NULL; + heapCallbacks.heap_iteration_callback = nullptr; heapCallbacks.heap_reference_callback = heapReferenceCallback; heapCallbacks.primitive_field_callback = primitiveFieldCallback; heapCallbacks.array_primitive_value_callback = arrayPrimitiveValueCallback; heapCallbacks.string_primitive_value_callback = stringPrimitiveValueCallback; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref004/followref004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref004/followref004.cpp index a18310440570..e73534de8b6b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref004/followref004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref004/followref004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, 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,10 +23,10 @@ #include #include -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" -#include "jvmti_FollowRefObjects.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" +#include "jvmti_FollowRefObjects.hpp" extern "C" { @@ -146,16 +146,16 @@ static void createGlobalRefs(JNIEnv * jni) { jclass klass; - if (!NSK_JNI_VERIFY(jni, (klass = jni->FindClass(JAVA_LANG_STRING_CLASS_NAME)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (klass = jni->FindClass(JAVA_LANG_STRING_CLASS_NAME)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } - if (!NSK_JNI_VERIFY(jni, (g_jniGlobalRef = jni->NewGlobalRef(klass)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (g_jniGlobalRef = jni->NewGlobalRef(klass)) != nullptr)) { nsk_jvmti_setFailStatus(); } - if (!NSK_JNI_VERIFY(jni, (g_jniWeakGlobalRef = jni->NewWeakGlobalRef(klass)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (g_jniWeakGlobalRef = jni->NewWeakGlobalRef(klass)) != nullptr)) { nsk_jvmti_setFailStatus(); } @@ -180,8 +180,8 @@ static void JNICALL agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) createGlobalRefs(jni); retCode = jvmti->FollowReferences((jint) 0, /* heap filter */ - NULL, /* class */ - NULL, /* inital object */ + nullptr, /* class */ + nullptr, /* inital object */ &g_heapCallbacks, (const void *) &g_fakeUserData); @@ -218,7 +218,7 @@ JNIEXPORT jint JNI_OnLoad_followref004(JavaVM *jvm, char *options, void *reserve #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) { return JNI_ERR; @@ -226,13 +226,13 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) g_timeout = nsk_jvmti_getWaitTime() * 60 * 1000; - if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) { + if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) { return JNI_ERR; } /* Setting Heap Callbacks */ memset(&g_heapCallbacks, 0, sizeof(g_heapCallbacks)); - g_heapCallbacks.heap_iteration_callback = NULL; + g_heapCallbacks.heap_iteration_callback = nullptr; g_heapCallbacks.heap_reference_callback = heapReferenceCallback; g_heapCallbacks.primitive_field_callback = primitiveFieldCallback; g_heapCallbacks.array_primitive_value_callback = arrayPrimitiveValueCallback; @@ -250,7 +250,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) } } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) { + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) { return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref005/followref005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref005/followref005.cpp index 52b313b51c4a..333ddcccf831 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref005/followref005.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref005/followref005.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,10 +22,10 @@ */ #include #include "jvmti.h" -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" -#include "jvmti_FollowRefObjects.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" +#include "jvmti_FollowRefObjects.hpp" extern "C" { @@ -46,8 +46,8 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { " return an error if env. doesn't possess can_tag_objects capability\n"); retCode = jvmti->FollowReferences((jint) 0, /* heap filter */ - NULL, /* class */ - NULL, /* inital object */ + nullptr, /* class */ + nullptr, /* inital object */ &g_wrongHeapCallbacks, (const void *) &g_fakeUserData); @@ -57,7 +57,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } retCode = jvmti->IterateThroughHeap((jint) 0, /* heap filter */ - NULL, /* class */ + nullptr, /* class */ &g_wrongHeapCallbacks, (const void *) &g_fakeUserData); @@ -115,7 +115,7 @@ JNIEXPORT jint JNI_OnLoad_followref005(JavaVM *jvm, char *options, void *reserve } #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) { return JNI_ERR; @@ -123,7 +123,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { g_timeout = nsk_jvmti_getWaitTime() * 60 * 1000; - if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) { + if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) { return JNI_ERR; } @@ -137,7 +137,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) { + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) { return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref006/followref006.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref006/followref006.cpp index cabd46968278..54485fb809ae 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref006/followref006.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/FollowReferences/followref006/followref006.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, 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,10 +23,10 @@ #include #include -#include "agent_common.h" -#include "jni_tools.h" -#include "jvmti_tools.h" -#include "jvmti_FollowRefObjects.h" +#include "agent_common.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" +#include "jvmti_FollowRefObjects.hpp" extern "C" { @@ -51,7 +51,7 @@ static void verifyReturnCodes(JNIEnv* jni, jvmtiEnv* jvmti) retCode = jvmti->FollowReferences((jint) 0, /* heap filter */ (jclass) &g_wrongHeapCallbacks , /* invalid class, but valid memory address */ - NULL, /* inital object */ + nullptr, /* inital object */ &g_wrongHeapCallbacks, (const void *) &g_fakeUserData); @@ -63,18 +63,18 @@ static void verifyReturnCodes(JNIEnv* jni, jvmtiEnv* jvmti) // When FollowReferences() is called with an invalid initial object // the behaviour according to the jvmti spec is optional. // It may return JVMTI_ERROR_INVALID_OBJECT and not follow any references. - // Or it may treat the object as NULL, and follow all references. + // Or it may treat the object as nullptr, and follow all references. // // We will accept both behaviours. We use empty callbacks since the existing // callback marks the test as failed. - emptyHeapCallbacks.heap_iteration_callback = NULL; - emptyHeapCallbacks.heap_reference_callback = NULL; - emptyHeapCallbacks.primitive_field_callback = NULL; - emptyHeapCallbacks.array_primitive_value_callback = NULL; - emptyHeapCallbacks.string_primitive_value_callback = NULL; + emptyHeapCallbacks.heap_iteration_callback = nullptr; + emptyHeapCallbacks.heap_reference_callback = nullptr; + emptyHeapCallbacks.primitive_field_callback = nullptr; + emptyHeapCallbacks.array_primitive_value_callback = nullptr; + emptyHeapCallbacks.string_primitive_value_callback = nullptr; retCode = jvmti->FollowReferences((jint) 0, // heap filter - NULL, // class + nullptr, // class (jobject) &g_wrongHeapCallbacks, // invalid inital object &emptyHeapCallbacks, // No callbacks (const void *) &g_fakeUserData); @@ -87,9 +87,9 @@ static void verifyReturnCodes(JNIEnv* jni, jvmtiEnv* jvmti) NSK_DISPLAY0("FollowReferences: Invalid callbacks:"); retCode = jvmti->FollowReferences((jint) 0, /* heap filter */ - NULL, /* class */ - NULL, /* inital object */ - NULL, + nullptr, /* class */ + nullptr, /* inital object */ + nullptr, (const void *) &g_fakeUserData); if (!NSK_VERIFY(retCode == JVMTI_ERROR_NULL_POINTER)) { @@ -105,17 +105,17 @@ static void verifyReturnCodes(JNIEnv* jni, jvmtiEnv* jvmti) nsk_jvmti_setFailStatus(); } - NSK_DISPLAY0("GetTag: NULL object pointer:"); + NSK_DISPLAY0("GetTag: null object pointer:"); - retCode = jvmti->GetTag(NULL, &tag); + retCode = jvmti->GetTag(nullptr, &tag); if (!NSK_VERIFY(retCode == JVMTI_ERROR_INVALID_OBJECT)) { nsk_jvmti_setFailStatus(); } - NSK_DISPLAY0("GetTag: NULL tag pointer:"); + NSK_DISPLAY0("GetTag: null tag pointer:"); - retCode = jvmti->GetTag((jobject) &g_wrongHeapCallbacks, NULL); + retCode = jvmti->GetTag((jobject) &g_wrongHeapCallbacks, nullptr); if (!NSK_VERIFY(retCode == JVMTI_ERROR_NULL_POINTER)) { nsk_jvmti_setFailStatus(); @@ -131,15 +131,15 @@ static void verifyReturnCodes(JNIEnv* jni, jvmtiEnv* jvmti) nsk_jvmti_setFailStatus(); } - NSK_DISPLAY0("SetTag: NULL object pointer:"); + NSK_DISPLAY0("SetTag: null object pointer:"); - retCode = jvmti->GetTag(NULL, &tag); + retCode = jvmti->GetTag(nullptr, &tag); if (!NSK_VERIFY(retCode == JVMTI_ERROR_INVALID_OBJECT)) { nsk_jvmti_setFailStatus(); } - NSK_DISPLAY0("GetTag: NULL tag pointer:"); + NSK_DISPLAY0("GetTag: null tag pointer:"); } /* verifyReturnCodes */ @@ -151,14 +151,14 @@ static void checkNoObjIterated(JNIEnv* jni, jvmtiEnv* jvmti, const char * szClas jclass klass; NSK_DISPLAY1("Verify, that no objects are returned if initial object is %s", szClassName); - if (!NSK_JNI_VERIFY(jni, (klass = jni->FindClass(szClassName)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (klass = jni->FindClass(szClassName)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } retCode = jvmti->FollowReferences((jint) 0, /* heap filter */ klass, /* class */ - NULL, /* inital object */ + nullptr, /* inital object */ &g_wrongHeapCallbacks, (const void *) &g_fakeUserData); @@ -211,7 +211,7 @@ JNIEXPORT jint JNI_OnLoad_followref006(JavaVM *jvm, char *options, void *reserve #endif jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) { return JNI_ERR; @@ -219,7 +219,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) g_timeout = nsk_jvmti_getWaitTime() * 60 * 1000; - if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) { + if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) { return JNI_ERR; } @@ -235,7 +235,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) } } - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) { + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) { return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretbase/earlyretbase.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretbase/earlyretbase.cpp index 9bca3a9c004c..47b9618d19c8 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretbase/earlyretbase.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretbase/earlyretbase.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -35,7 +35,7 @@ extern "C" { #define RETURN_FAILED errCode = STATUS_FAILED; fflush(0); return errCode -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; @@ -51,7 +51,7 @@ static int errCode = PASSED; static const char *sig_exp = "()J"; static const char *name_exp = "activeMethod"; -static jmethodID midActiveMethod = NULL; +static jmethodID midActiveMethod = nullptr; void JNICALL MethodExit(jvmtiEnv *jvmti_env, JNIEnv *env, jthread thr, @@ -84,13 +84,13 @@ Java_nsk_jvmti_unit_ForceEarlyReturn_earlyretbase_suspThread(JNIEnv *env, } jclass clazz = env->GetObjectClass(earlyretThr); - if (clazz == NULL) { + if (clazz == nullptr) { printf("Cannot get class of thread object\n"); RETURN_FAILED; } midActiveMethod = env->GetMethodID(clazz, name_exp, sig_exp); - if (midActiveMethod == NULL) { + if (midActiveMethod == nullptr) { printf("Cannot find Method ID for method %s\n", name_exp); RETURN_FAILED; } @@ -137,7 +137,7 @@ Java_nsk_jvmti_unit_ForceEarlyReturn_earlyretbase_doForceEarlyReturn(JNIEnv *env * that ForceEarlyReturn correctly generates them */ err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_METHOD_EXIT, NULL); + JVMTI_EVENT_METHOD_EXIT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable METHOD_EXIT event: %s (%d)\n", TranslateError(err), err); @@ -147,7 +147,7 @@ Java_nsk_jvmti_unit_ForceEarlyReturn_earlyretbase_doForceEarlyReturn(JNIEnv *env } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_FRAME_POP, NULL); + JVMTI_EVENT_FRAME_POP, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable FRAME_POP event: %s (%d)\n", TranslateError(err), err); @@ -197,7 +197,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong error code from a valid call to GetEnv!\n"); return JNI_ERR; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretfp/earlyretfp.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretfp/earlyretfp.cpp index 0feb076932d5..9a0ce3d85508 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretfp/earlyretfp.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretfp/earlyretfp.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -36,15 +36,15 @@ extern "C" { #define RETURN_FAILED errCode = STATUS_FAILED; fflush(0); return #define METHCNT 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; static jint errCode = PASSED; static jboolean printdump = JNI_TRUE; -static jmethodID midCheckPoint = NULL; -static jmethodID midRun = NULL; -static jmethodID midCountDownFloat = NULL; -static jmethodID midCountDownDouble = NULL; +static jmethodID midCheckPoint = nullptr; +static jmethodID midRun = nullptr; +static jmethodID midCountDownFloat = nullptr; +static jmethodID midCountDownDouble = nullptr; /* There is no synchronization for the counters because * they are incremented in single threaded mode. @@ -70,7 +70,7 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jmethodID mid, jclass cls; jlocation loc_exp = (i == 0) ? 0x16 : 0xd; char *sigClass, *name, *sig, *generic; - jvmtiLocalVariableEntry *table = NULL; + jvmtiLocalVariableEntry *table = nullptr; jint entryCount = 0; jint argValue; jint j; @@ -105,7 +105,7 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jmethodID mid, i, TranslateError(err), err); RETURN_FAILED; } - if (table != NULL) { + if (table != nullptr) { for (j = 0; j < entryCount; j++) { if (strcmp(table[j].name, argName) == 0) { err = jvmti_env->GetLocalInt(thr, 0, @@ -125,17 +125,17 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jmethodID mid, printf(", arg value: %d\n", argValue); } - if (sigClass == NULL || strcmp(sigClass, cls_exp) != 0) { + if (sigClass == nullptr || strcmp(sigClass, cls_exp) != 0) { printf("(step %d) wrong class sig: \"%s\",\n", i, sigClass); printf(" expected: \"%s\"\n", cls_exp); RETURN_FAILED; } - if (name == NULL || strcmp(name, name_exp[methidx]) != 0) { + if (name == nullptr || strcmp(name, name_exp[methidx]) != 0) { printf("(step %d) wrong method name: \"%s\",", i, name); printf(" expected: \"%s\"\n", name_exp[methidx]); RETURN_FAILED; } - if (sig == NULL || strcmp(sig, sig_exp[methidx]) != 0) { + if (sig == nullptr || strcmp(sig, sig_exp[methidx]) != 0) { printf("(step %d) wrong method sig: \"%s\",", i, sig); printf(" expected: \"%s\"\n", sig_exp[methidx]); RETURN_FAILED; @@ -153,16 +153,16 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jmethodID mid, RETURN_FAILED; } - if (sigClass != NULL) { + if (sigClass != nullptr) { jvmti_env->Deallocate((unsigned char*)sigClass); } - if (name != NULL) { + if (name != nullptr) { jvmti_env->Deallocate((unsigned char*)name); } - if (sig != NULL) { + if (sig != nullptr) { jvmti_env->Deallocate((unsigned char*)sig); } - if (table != NULL) { + if (table != nullptr) { for (j = 0; j < entryCount; j++) { jvmti_env->Deallocate((unsigned char*)(table[j].name)); jvmti_env->Deallocate((unsigned char*)(table[j].signature)); @@ -307,14 +307,14 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printf("Printdump is turned on!\n"); printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong error code from a valid call to GetEnv!\n"); return JNI_ERR; } @@ -370,7 +370,7 @@ Java_nsk_jvmti_unit_ForceEarlyReturn_earlyretfp_getReady( JNIEnv *env, jclass c, jclass cls, jint depth, jdouble retval) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); RETURN_FAILED; } @@ -383,25 +383,25 @@ Java_nsk_jvmti_unit_ForceEarlyReturn_earlyretfp_getReady( } midRun = env->GetMethodID(cls, "run", "()V"); - if (midRun == NULL) { + if (midRun == nullptr) { printf("Cannot find Method ID for method run\n"); RETURN_FAILED; } midCheckPoint = env->GetMethodID(cls, "checkPoint", "()V"); - if (midCheckPoint == NULL) { + if (midCheckPoint == nullptr) { printf("Cannot find Method ID for method checkPoint\n"); RETURN_FAILED; } midCountDownFloat = env->GetMethodID(cls, "countDownFloat", "(I)F"); - if (midCountDownFloat == NULL) { + if (midCountDownFloat == nullptr) { printf("Cannot find Method ID for method countDownFloat\n"); RETURN_FAILED; } midCountDownDouble = env->GetMethodID(cls, "countDownDouble", "(I)D"); - if (midCountDownDouble == NULL) { + if (midCountDownDouble == nullptr) { printf("Cannot find Method ID for method countDownDouble\n"); RETURN_FAILED; } @@ -414,7 +414,7 @@ Java_nsk_jvmti_unit_ForceEarlyReturn_earlyretfp_getReady( } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_BREAKPOINT, NULL); + JVMTI_EVENT_BREAKPOINT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable BREAKPOINT event: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretint/earlyretint.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretint/earlyretint.cpp index 071aa1db1f33..feb51d5fc407 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretint/earlyretint.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretint/earlyretint.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -35,20 +35,20 @@ extern "C" { #define RETURN_FAILED errCode = STATUS_FAILED; fflush(0); return -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; static jint errCode = PASSED; static jboolean printdump = JNI_TRUE; -static jmethodID midCheckPoint = NULL; -static jmethodID midRun = NULL; +static jmethodID midCheckPoint = nullptr; +static jmethodID midRun = nullptr; -static jmethodID midCountDownInt = NULL; -static jmethodID midCountDownShort = NULL; -static jmethodID midCountDownChar = NULL; -static jmethodID midCountDownByte = NULL; -static jmethodID midCountDownBoolean = NULL; +static jmethodID midCountDownInt = nullptr; +static jmethodID midCountDownShort = nullptr; +static jmethodID midCountDownChar = nullptr; +static jmethodID midCountDownByte = nullptr; +static jmethodID midCountDownBoolean = nullptr; static jint framesExpected = 0; static jint framesCount = 0; @@ -78,7 +78,7 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jmethodID mid, jclass cls; jlocation loc_exp = (i == 0) ? 0x21 : 0xd; char *sigClass, *name, *sig, *generic; - jvmtiLocalVariableEntry *table = NULL; + jvmtiLocalVariableEntry *table = nullptr; jint entryCount = 0; jint argValue = -i; jint j; @@ -106,17 +106,17 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jmethodID mid, RETURN_FAILED; } - if (sigClass == NULL || strcmp(sigClass, cls_exp) != 0) { + if (sigClass == nullptr || strcmp(sigClass, cls_exp) != 0) { printf("(step %d) Wrong class sig: \"%s\",\n", i, sigClass); printf(" expected: \"%s\"\n", cls_exp); RETURN_FAILED; } - if (name == NULL || strcmp(name, name_exp[methidx]) != 0) { + if (name == nullptr || strcmp(name, name_exp[methidx]) != 0) { printf("(step %d) wrong method name: \"%s\",", i, name); printf(" expected: \"%s\"\n", name_exp[methidx]); RETURN_FAILED; } - if (sig == NULL || strcmp(sig, sign_exp[methidx]) != 0) { + if (sig == nullptr || strcmp(sig, sign_exp[methidx]) != 0) { printf("(step %d) wrong method sig: \"%s\",", i, sig); printf(" expected: \"%s\"\n", sign_exp[methidx]); RETURN_FAILED; @@ -136,7 +136,7 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jmethodID mid, i, TranslateError(err), err); RETURN_FAILED; } - if (table != NULL) { + if (table != nullptr) { for (j = 0; j < entryCount; j++) { if (strcmp(table[j].name, argName) == 0) { err = jvmti_env->GetLocalInt(thr, 0, @@ -162,16 +162,16 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jmethodID mid, RETURN_FAILED; } - if (sigClass != NULL) { + if (sigClass != nullptr) { jvmti_env->Deallocate((unsigned char*)sigClass); } - if (name != NULL) { + if (name != nullptr) { jvmti_env->Deallocate((unsigned char*)name); } - if (sig != NULL) { + if (sig != nullptr) { jvmti_env->Deallocate((unsigned char*)sig); } - if (table != NULL) { + if (table != nullptr) { for (j = 0; j < entryCount; j++) { jvmti_env->Deallocate((unsigned char*)(table[j].name)); jvmti_env->Deallocate((unsigned char*)(table[j].signature)); @@ -313,14 +313,14 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printf("Printdump is turned on!\n"); printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong error code from a valid call to GetEnv!\n"); return JNI_ERR; } @@ -375,7 +375,7 @@ Java_nsk_jvmti_unit_ForceEarlyReturn_earlyretint_getReady( JNIEnv *env, jclass c, jclass cls, jint depth) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); RETURN_FAILED; } @@ -388,43 +388,43 @@ Java_nsk_jvmti_unit_ForceEarlyReturn_earlyretint_getReady( } midRun = env->GetMethodID(cls, "run", "()V"); - if (midRun == NULL) { + if (midRun == nullptr) { printf("Cannot find Method ID for method run\n"); RETURN_FAILED; } midCheckPoint = env->GetMethodID(cls, "checkPoint", "()V"); - if (midCheckPoint == NULL) { + if (midCheckPoint == nullptr) { printf("Cannot find Method ID for method checkPoint\n"); RETURN_FAILED; } midCountDownInt = env->GetMethodID(cls, "countDownInt", "(I)I"); - if (midCheckPoint == NULL) { + if (midCheckPoint == nullptr) { printf("Cannot find Method ID for method countDownInt\n"); RETURN_FAILED; } midCountDownShort = env->GetMethodID(cls, "countDownShort", "(I)S"); - if (midCountDownShort == NULL) { + if (midCountDownShort == nullptr) { printf("Cannot find Method ID for method countDownShort\n"); RETURN_FAILED; } midCountDownChar = env->GetMethodID(cls, "countDownChar", "(I)C"); - if (midCountDownChar == NULL) { + if (midCountDownChar == nullptr) { printf("Cannot find Method ID for method countDownChar\n"); RETURN_FAILED; } midCountDownByte = env->GetMethodID(cls, "countDownByte", "(I)B"); - if (midCountDownByte == NULL) { + if (midCountDownByte == nullptr) { printf("Cannot find Method ID for method countDownByte\n"); RETURN_FAILED; } midCountDownBoolean = env->GetMethodID(cls, "countDownBoolean", "(I)Z"); - if (midCountDownBoolean == NULL) { + if (midCountDownBoolean == nullptr) { printf("Cannot find Method ID for method countDownBoolean\n"); RETURN_FAILED; } @@ -437,7 +437,7 @@ Java_nsk_jvmti_unit_ForceEarlyReturn_earlyretint_getReady( } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_BREAKPOINT, NULL); + JVMTI_EVENT_BREAKPOINT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable BREAKPOINT event: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretlong/earlyretlong.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretlong/earlyretlong.cpp index 74f358e924b1..170d6839bef0 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretlong/earlyretlong.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretlong/earlyretlong.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,9 +24,9 @@ #include #include #include "jvmti.h" -#include "jni_tools.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -36,15 +36,15 @@ extern "C" { #define RETURN_FAILED errCode = STATUS_FAILED; fflush(0); return -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; static jint errCode = PASSED; static jboolean printdump = JNI_TRUE; -static jmethodID midRun = NULL; -static jmethodID midCountDownLong = NULL; -static jmethodID midCheckPoint = NULL; +static jmethodID midRun = nullptr; +static jmethodID midCountDownLong = nullptr; +static jmethodID midCheckPoint = nullptr; static jint framesExpected = 0; static jint framesCount = 0; @@ -64,7 +64,7 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jmethodID mid, jclass cls; jlocation loc_exp = (frame_no == 0) ? 0x15 : 0xd; char *sigClass, *name, *sig, *generic; - jvmtiLocalVariableEntry *table = NULL; + jvmtiLocalVariableEntry *table = nullptr; jint entryCount = 0; jint argValue; jint j; @@ -99,7 +99,7 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jmethodID mid, frame_no, TranslateError(err), err); RETURN_FAILED; } - if (table != NULL) { + if (table != nullptr) { for (j = 0; j < entryCount; j++) { if (strcmp(table[j].name, argName) == 0) { err = jvmti_env->GetLocalInt(thr, 0, @@ -119,17 +119,17 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jmethodID mid, printf(", arg value: %d\n", argValue); } - if (sigClass == NULL || strcmp(sigClass, cls_exp) != 0) { + if (sigClass == nullptr || strcmp(sigClass, cls_exp) != 0) { printf("(step %d) Wrong class sig: \"%s\",\n", frame_no, sigClass); printf(" expected: \"%s\"\n", cls_exp); RETURN_FAILED; } - if (name == NULL || strcmp(name, name_exp) != 0) { + if (name == nullptr || strcmp(name, name_exp) != 0) { printf("(step %d) wrong method name: \"%s\",", frame_no, name); printf(" expected: \"%s\"\n", name_exp); RETURN_FAILED; } - if (sig == NULL || strcmp(sig, sig_exp) != 0) { + if (sig == nullptr || strcmp(sig, sig_exp) != 0) { printf("(step %d) wrong method sig: \"%s\",", frame_no, sig); printf(" expected: \"%s\"\n", sig_exp); RETURN_FAILED; @@ -146,16 +146,16 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jmethodID mid, RETURN_FAILED; } - if (sigClass != NULL) { + if (sigClass != nullptr) { jvmti_env->Deallocate((unsigned char*)sigClass); } - if (name != NULL) { + if (name != nullptr) { jvmti_env->Deallocate((unsigned char*)name); } - if (sig != NULL) { + if (sig != nullptr) { jvmti_env->Deallocate((unsigned char*)sig); } - if (table != NULL) { + if (table != nullptr) { for (j = 0; j < entryCount; j++) { jvmti_env->Deallocate((unsigned char*)(table[j].name)); jvmti_env->Deallocate((unsigned char*)(table[j].signature)); @@ -294,14 +294,14 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printf("Printdump is turned on!\n"); printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong error code from a valid call to GetEnv!\n"); return JNI_ERR; } @@ -357,7 +357,7 @@ Java_nsk_jvmti_unit_ForceEarlyReturn_earlyretlong_getReady( jvmtiError err; val_exp = retval_base; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); RETURN_FAILED; } @@ -370,19 +370,19 @@ Java_nsk_jvmti_unit_ForceEarlyReturn_earlyretlong_getReady( } midRun = env->GetMethodID(cls, "run", "()V"); - if (midRun == NULL) { + if (midRun == nullptr) { printf("Cannot find Method ID for method run\n"); RETURN_FAILED; } midCheckPoint = env->GetMethodID(cls, "checkPoint", "()V"); - if (midCheckPoint == NULL) { + if (midCheckPoint == nullptr) { printf("Cannot find Method ID for method checkPoint\n"); RETURN_FAILED; } midCountDownLong = env->GetMethodID(cls, "countDownLong", "(I)J"); - if (midCountDownLong == NULL) { + if (midCountDownLong == nullptr) { printf("Cannot find Method ID for method countDownLong\n"); RETURN_FAILED; } @@ -395,7 +395,7 @@ Java_nsk_jvmti_unit_ForceEarlyReturn_earlyretlong_getReady( } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_BREAKPOINT, NULL); + JVMTI_EVENT_BREAKPOINT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable BREAKPOINT event: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretobj/earlyretobj.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretobj/earlyretobj.cpp index 0cdbcb18029e..6faf82f9ed90 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretobj/earlyretobj.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretobj/earlyretobj.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -36,15 +36,15 @@ extern "C" { #define RETURN_FAILED errCode = STATUS_FAILED; fflush(0); return -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; static jint errCode = PASSED; static jboolean printdump = JNI_TRUE; -static jmethodID midRun = NULL; -static jmethodID midCountDownObject = NULL; -static jmethodID midCheckPoint = NULL; +static jmethodID midRun = nullptr; +static jmethodID midCountDownObject = nullptr; +static jmethodID midCheckPoint = nullptr; static jint framesExpected = 0; static jint framesCount = 0; @@ -52,7 +52,7 @@ static jint methodExitEventCount = 0; static const char *cls_exp = "Lnsk/jvmti/unit/ForceEarlyReturn/earlyretobj$earlyretThread;"; -static jobject val_exp = NULL; +static jobject val_exp = nullptr; static const char *sig_exp = "(I)Lnsk/jvmti/unit/ForceEarlyReturn/earlyretobj$RetObj;"; static const char *name_exp = "countDownObject"; @@ -64,7 +64,7 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jmethodID mid, jclass cls; jlocation loc_exp = (frame_no == 0) ? 0x15 : 0xd; char *sigClass, *name, *sig, *generic; - jvmtiLocalVariableEntry *table = NULL; + jvmtiLocalVariableEntry *table = nullptr; jint entryCount = 0; jint argValue; jint j; @@ -99,7 +99,7 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jmethodID mid, frame_no, TranslateError(err), err); RETURN_FAILED; } - if (table != NULL) { + if (table != nullptr) { for (j = 0; j < entryCount; j++) { if (strcmp(table[j].name, argName) == 0) { err = jvmti_env->GetLocalInt(thr, 0, @@ -119,17 +119,17 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jmethodID mid, printf(", arg value: %d\n", argValue); } - if (sigClass == NULL || strcmp(sigClass, cls_exp) != 0) { + if (sigClass == nullptr || strcmp(sigClass, cls_exp) != 0) { printf("(step %d) Wrong class sig: \"%s\",\n", frame_no, sigClass); printf(" expected: \"%s\"\n", cls_exp); RETURN_FAILED; } - if (name == NULL || strcmp(name, name_exp) != 0) { + if (name == nullptr || strcmp(name, name_exp) != 0) { printf("(step %d) wrong method name: \"%s\",", frame_no, name); printf(" expected: \"%s\"\n", name_exp); RETURN_FAILED; } - if (sig == NULL || strcmp(sig, sig_exp) != 0) { + if (sig == nullptr || strcmp(sig, sig_exp) != 0) { printf("(step %d) wrong method sig: \"%s\",", frame_no, sig); printf(" expected: \"%s\"\n", sig_exp); RETURN_FAILED; @@ -146,16 +146,16 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jmethodID mid, RETURN_FAILED; } - if (sigClass != NULL) { + if (sigClass != nullptr) { jvmti_env->Deallocate((unsigned char*)sigClass); } - if (name != NULL) { + if (name != nullptr) { jvmti_env->Deallocate((unsigned char*)name); } - if (sig != NULL) { + if (sig != nullptr) { jvmti_env->Deallocate((unsigned char*)sig); } - if (table != NULL) { + if (table != nullptr) { for (j = 0; j < entryCount; j++) { jvmti_env->Deallocate((unsigned char*)(table[j].name)); jvmti_env->Deallocate((unsigned char*)(table[j].signature)); @@ -292,14 +292,14 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printf("Printdump is turned on!\n"); printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong error code from a valid call to GetEnv!\n"); return JNI_ERR; } @@ -354,7 +354,7 @@ Java_nsk_jvmti_unit_ForceEarlyReturn_earlyretobj_getReady( JNIEnv *env, jclass c, jclass cls, jint depth, jobject ret_obj) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); RETURN_FAILED; } @@ -367,19 +367,19 @@ Java_nsk_jvmti_unit_ForceEarlyReturn_earlyretobj_getReady( } midRun = env->GetMethodID(cls, "run", "()V"); - if (midRun == NULL) { + if (midRun == nullptr) { printf("Cannot find Method ID for method run\n"); RETURN_FAILED; } midCheckPoint = env->GetMethodID(cls, "checkPoint", "()V"); - if (midCheckPoint == NULL) { + if (midCheckPoint == nullptr) { printf("Cannot find Method ID for method checkPoint\n"); RETURN_FAILED; } midCountDownObject = env->GetMethodID(cls, "countDownObject", sig_exp); - if (midCountDownObject == NULL) { + if (midCountDownObject == nullptr) { printf("Cannot find Method ID for method countDownObject\n"); RETURN_FAILED; } @@ -392,7 +392,7 @@ Java_nsk_jvmti_unit_ForceEarlyReturn_earlyretobj_getReady( } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_BREAKPOINT, NULL); + JVMTI_EVENT_BREAKPOINT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable BREAKPOINT event: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretstr/earlyretstr.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretstr/earlyretstr.cpp index 7622d1065b0a..6ebb50026a34 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretstr/earlyretstr.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretstr/earlyretstr.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -35,15 +35,15 @@ extern "C" { #define RETURN_FAILED errCode = STATUS_FAILED; fflush(0); return -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; static jint errCode = PASSED; static jboolean printdump = JNI_TRUE; -static jmethodID midRun = NULL; -static jmethodID midCountDownString = NULL; -static jmethodID midCheckPoint = NULL; +static jmethodID midRun = nullptr; +static jmethodID midCountDownString = nullptr; +static jmethodID midCheckPoint = nullptr; static jint framesExpected = 0; static jint framesCount = 0; @@ -51,7 +51,7 @@ static jint methodExitEventCount = 0; static const char *cls_exp = "Lnsk/jvmti/unit/ForceEarlyReturn/earlyretstr$earlyretThread;"; -static jstring str_exp = NULL; +static jstring str_exp = nullptr; static const char *sig_exp = "(I)Ljava/lang/String;"; static const char *name_exp = "countDownString"; @@ -63,7 +63,7 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jmethodID mid, jclass cls; jlocation loc_exp = (frame_no == 0) ? 0x15 : 0xd; char *sigClass, *name, *sig, *generic; - jvmtiLocalVariableEntry *table = NULL; + jvmtiLocalVariableEntry *table = nullptr; jint entryCount = 0; jint argValue; jint j; @@ -98,7 +98,7 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jmethodID mid, frame_no, TranslateError(err), err); RETURN_FAILED; } - if (table != NULL) { + if (table != nullptr) { for (j = 0; j < entryCount; j++) { if (strcmp(table[j].name, argName) == 0) { err = jvmti_env->GetLocalInt(thr, 0, @@ -118,17 +118,17 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jmethodID mid, printf(", arg value: %d\n", argValue); } - if (sigClass == NULL || strcmp(sigClass, cls_exp) != 0) { + if (sigClass == nullptr || strcmp(sigClass, cls_exp) != 0) { printf("(step %d) Wrong class sig: \"%s\",\n", frame_no, sigClass); printf(" expected: \"%s\"\n", cls_exp); RETURN_FAILED; } - if (name == NULL || strcmp(name, name_exp) != 0) { + if (name == nullptr || strcmp(name, name_exp) != 0) { printf("(step %d) wrong method name: \"%s\",", frame_no, name); printf(" expected: \"%s\"\n", name_exp); RETURN_FAILED; } - if (sig == NULL || strcmp(sig, sig_exp) != 0) { + if (sig == nullptr || strcmp(sig, sig_exp) != 0) { printf("(step %d) wrong method sig: \"%s\",", frame_no, sig); printf(" expected: \"%s\"\n", sig_exp); RETURN_FAILED; @@ -145,16 +145,16 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jmethodID mid, RETURN_FAILED; } - if (sigClass != NULL) { + if (sigClass != nullptr) { jvmti_env->Deallocate((unsigned char*)sigClass); } - if (name != NULL) { + if (name != nullptr) { jvmti_env->Deallocate((unsigned char*)name); } - if (sig != NULL) { + if (sig != nullptr) { jvmti_env->Deallocate((unsigned char*)sig); } - if (table != NULL) { + if (table != nullptr) { for (j = 0; j < entryCount; j++) { jvmti_env->Deallocate((unsigned char*)(table[j].name)); jvmti_env->Deallocate((unsigned char*)(table[j].signature)); @@ -291,14 +291,14 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printf("Printdump is turned on!\n"); printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong error code of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -353,7 +353,7 @@ Java_nsk_jvmti_unit_ForceEarlyReturn_earlyretstr_getReady( JNIEnv *env, jclass c, jclass cls, jint depth, jstring expected_str) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); RETURN_FAILED; } @@ -366,19 +366,19 @@ Java_nsk_jvmti_unit_ForceEarlyReturn_earlyretstr_getReady( } midRun = env->GetMethodID(cls, "run", "()V"); - if (midRun == NULL) { + if (midRun == nullptr) { printf("Cannot find Method ID for method run\n"); RETURN_FAILED; } midCheckPoint = env->GetMethodID(cls, "checkPoint", "()V"); - if (midCheckPoint == NULL) { + if (midCheckPoint == nullptr) { printf("Cannot find Method ID for method checkPoint\n"); RETURN_FAILED; } midCountDownString = env->GetMethodID(cls, "countDownString", sig_exp); - if (midCountDownString == NULL) { + if (midCountDownString == nullptr) { printf("Cannot find Method ID for method countDownString\n"); RETURN_FAILED; } @@ -391,7 +391,7 @@ Java_nsk_jvmti_unit_ForceEarlyReturn_earlyretstr_getReady( } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_BREAKPOINT, NULL); + JVMTI_EVENT_BREAKPOINT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable BREAKPOINT event: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretvoid/earlyretvoid.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretvoid/earlyretvoid.cpp index 2a50307dc25c..4919d27e9e7c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretvoid/earlyretvoid.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/ForceEarlyReturn/earlyretvoid/earlyretvoid.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -35,13 +35,13 @@ extern "C" { #define RETURN_FAILED errCode = STATUS_FAILED; fflush(0); return -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; static jint errCode = PASSED; static jboolean printdump = JNI_TRUE; -static jmethodID midCheckPoint = NULL; -static jmethodID midRun = NULL; +static jmethodID midCheckPoint = nullptr; +static jmethodID midRun = nullptr; static jint framesExpected = 0; static jint framesCount = 0; @@ -57,7 +57,7 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jmethodID mid, jclass cls; jlocation loc_exp = (frame_no == 0) ? 25 : 11; char *sigClass, *name, *sig, *generic; - jvmtiLocalVariableEntry *table = NULL; + jvmtiLocalVariableEntry *table = nullptr; jint entryCount = 0; jint argValue; jint j; @@ -92,7 +92,7 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jmethodID mid, frame_no, TranslateError(err), err); RETURN_FAILED; } - if (table != NULL) { + if (table != nullptr) { for (j = 0; j < entryCount; j++) { if (strcmp(table[j].name, argName) == 0) { err = jvmti_env->GetLocalInt(thr, 0, @@ -112,17 +112,17 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jmethodID mid, printf(", arg value: %d\n", argValue); } - if (sigClass == NULL || strcmp(sigClass, cls_exp) != 0) { + if (sigClass == nullptr || strcmp(sigClass, cls_exp) != 0) { printf("(step %d) wrong class sig: \"%s\",\n", frame_no, sigClass); printf(" expected: \"%s\"\n", cls_exp); RETURN_FAILED; } - if (name == NULL || strcmp(name, name_exp) != 0) { + if (name == nullptr || strcmp(name, name_exp) != 0) { printf("(step %d) wrong method name: \"%s\",", frame_no, name); printf(" expected: \"%s\"\n", name_exp); RETURN_FAILED; } - if (sig == NULL || strcmp(sig, sig_exp) != 0) { + if (sig == nullptr || strcmp(sig, sig_exp) != 0) { printf("(step %d) wrong method sig: \"%s\",", frame_no, sig); printf(" expected: \"%s\"\n", sig_exp); RETURN_FAILED; @@ -139,16 +139,16 @@ void check(jvmtiEnv *jvmti_env, jthread thr, jmethodID mid, RETURN_FAILED; } - if (sigClass != NULL) { + if (sigClass != nullptr) { jvmti_env->Deallocate((unsigned char*)sigClass); } - if (name != NULL) { + if (name != nullptr) { jvmti_env->Deallocate((unsigned char*)name); } - if (sig != NULL) { + if (sig != nullptr) { jvmti_env->Deallocate((unsigned char*)sig); } - if (table != NULL) { + if (table != nullptr) { for (j = 0; j < entryCount; j++) { jvmti_env->Deallocate((unsigned char*)(table[j].name)); jvmti_env->Deallocate((unsigned char*)(table[j].signature)); @@ -241,14 +241,14 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printf("Printdump is turned on!\n"); printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong error code from a valid call to GetEnv!\n"); return JNI_ERR; } @@ -300,7 +300,7 @@ Java_nsk_jvmti_unit_ForceEarlyReturn_earlyretvoid_getReady( JNIEnv *env, jclass c, jclass cls, jint depth) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); RETURN_FAILED; } @@ -312,13 +312,13 @@ Java_nsk_jvmti_unit_ForceEarlyReturn_earlyretvoid_getReady( } midRun = env->GetMethodID(cls, "run", "()V"); - if (midRun == NULL) { + if (midRun == nullptr) { printf("Cannot find Method ID for method run\n"); RETURN_FAILED; } midCheckPoint = env->GetMethodID(cls, "checkPoint", "()V"); - if (midCheckPoint == NULL) { + if (midCheckPoint == nullptr) { printf("Cannot find Method ID for method checkPoint\n"); RETURN_FAILED; } @@ -331,7 +331,7 @@ Java_nsk_jvmti_unit_ForceEarlyReturn_earlyretvoid_getReady( } err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, - JVMTI_EVENT_BREAKPOINT, NULL); + JVMTI_EVENT_BREAKPOINT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable BREAKPOINT event: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetAllStackTraces/getallstktr001/getallstktr001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetAllStackTraces/getallstktr001/getallstktr001.cpp index 82fa5dfdfa74..c1f0443186f2 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetAllStackTraces/getallstktr001/getallstktr001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetAllStackTraces/getallstktr001/getallstktr001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "jni_tools.h" -#include "agent_common.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" extern "C" { @@ -64,10 +64,10 @@ static jrawMonitorID jraw_monitor; #define MAX_FRAMES_CNT 30 -static jvmtiStackInfo *stack_buf1 = NULL; -static jvmtiStackInfo *stack_buf2 = NULL; -static jthread *thread_list = NULL; -static jvmtiThreadInfo *thread_info = NULL; +static jvmtiStackInfo *stack_buf1 = nullptr; +static jvmtiStackInfo *stack_buf2 = nullptr; +static jthread *thread_list = nullptr; +static jvmtiThreadInfo *thread_info = nullptr; static jint threads_count = 0; @@ -191,10 +191,10 @@ void compare_one_stack_trace(int ti, static const char* TEST_THREAD_NAME_PREFIX = "getallstktr001-"; size_t PFX_LEN = strlen(TEST_THREAD_NAME_PREFIX); - if (thr_info->name != NULL) { + if (thr_info->name != nullptr) { printf("compare stack #%d: thread: %s\n", ti, thr_info->name); } else { - printf("compare stack #%d: thread is NULL\n", ti); + printf("compare stack #%d: thread is null\n", ti); return; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetConstantPool/getcpool001/getcpool001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetConstantPool/getcpool001/getcpool001.cpp index feafa26dde2e..997e6c667e60 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetConstantPool/getcpool001/getcpool001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetConstantPool/getcpool001/getcpool001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -39,8 +39,8 @@ static jvmtiEventCallbacks callbacks; #define RETURN_FAILED errCode = STATUS_FAILED; fflush(0); return static jint errCode = PASSED; -static jvmtiEnv *jvmti = NULL; -static jmethodID midCheckPoint = NULL; +static jvmtiEnv *jvmti = nullptr; +static jmethodID midCheckPoint = nullptr; JNIEXPORT void JNICALL @@ -51,7 +51,7 @@ Java_nsk_jvmti_unit_GetConstantPool_getcpool001_getCP( int rep = 0; jint cp_cnt = 0; jint cp_bytes_cnt = 0; - unsigned char *cp_bytes = NULL; + unsigned char *cp_bytes = nullptr; err = jvmti->GetConstantPool(cls, &cp_cnt, &cp_bytes_cnt, &cp_bytes); if (err != JVMTI_ERROR_NONE) { @@ -102,7 +102,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -151,7 +151,7 @@ Java_nsk_jvmti_unit_GetConstantPool_getcpool001_getReady( JNIEnv *env, jclass c, jclass cls) { jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); RETURN_FAILED; } @@ -163,7 +163,7 @@ Java_nsk_jvmti_unit_GetConstantPool_getcpool001_getReady( } midCheckPoint = env->GetMethodID(cls, "checkPoint", "()V"); - if (midCheckPoint == NULL) { + if (midCheckPoint == nullptr) { printf("Cannot find Method ID for method checkPoint\n"); RETURN_FAILED; } @@ -175,7 +175,7 @@ Java_nsk_jvmti_unit_GetConstantPool_getcpool001_getReady( RETURN_FAILED; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable BREAKPOINT event: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetLineNumberTable/linetab004/linetab004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetLineNumberTable/linetab004/linetab004.cpp index fb3db7f4be71..d54f2d838d6e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetLineNumberTable/linetab004/linetab004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetLineNumberTable/linetab004/linetab004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,8 +27,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -36,7 +36,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -56,12 +56,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -97,7 +97,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { void checkGetLineNumberTable(jmethodID mid, const char *methName, int abstract, jvmtiError exp) { jint entryCount = -1; - jvmtiLineNumberEntry *table = NULL; + jvmtiLineNumberEntry *table = nullptr; jvmtiError err; int i; @@ -132,7 +132,7 @@ Java_nsk_jvmti_unit_GetLineNumberTable_linetab004_check(JNIEnv *env, jclass cls) jclass abstr; jclass interf; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -145,13 +145,13 @@ Java_nsk_jvmti_unit_GetLineNumberTable_linetab004_check(JNIEnv *env, jclass cls) printf("\n Check methods of interface:\n"); } interf = env->FindClass("nsk/jvmti/unit/GetLineNumberTable/Interface004"); - if (interf == NULL) { + if (interf == nullptr) { printf("Cannot get Interface class!\n"); return STATUS_FAILED; } mid = env->GetMethodID(cls, "instanceMeth0", "()I"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot get method ID!\n"); return STATUS_FAILED; } @@ -159,7 +159,7 @@ Java_nsk_jvmti_unit_GetLineNumberTable_linetab004_check(JNIEnv *env, jclass cls) JVMTI_ERROR_ABSENT_INFORMATION); mid = env->GetMethodID(cls, "instanceMeth1", "()I"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot get method ID!\n"); return STATUS_FAILED; } @@ -170,13 +170,13 @@ Java_nsk_jvmti_unit_GetLineNumberTable_linetab004_check(JNIEnv *env, jclass cls) printf("\n Check methods of abstract class:\n"); } abstr = env->GetSuperclass(cls); - if (abstr == NULL) { + if (abstr == nullptr) { printf("Cannot get super class!\n"); return STATUS_FAILED; } mid = env->GetMethodID(abstr, "instanceMeth0", "()I"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot get method ID!\n"); return STATUS_FAILED; } @@ -184,7 +184,7 @@ Java_nsk_jvmti_unit_GetLineNumberTable_linetab004_check(JNIEnv *env, jclass cls) JVMTI_ERROR_ABSENT_INFORMATION); mid = env->GetMethodID(abstr, "instanceMeth1", "()I"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot get method ID!\n"); return STATUS_FAILED; } @@ -195,7 +195,7 @@ Java_nsk_jvmti_unit_GetLineNumberTable_linetab004_check(JNIEnv *env, jclass cls) printf("\n Check methods of regular class:\n"); } mid = env->GetMethodID(cls, "instanceMeth0", "()I"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot get method ID!\n"); return STATUS_FAILED; } @@ -203,7 +203,7 @@ Java_nsk_jvmti_unit_GetLineNumberTable_linetab004_check(JNIEnv *env, jclass cls) JVMTI_ERROR_ABSENT_INFORMATION); mid = env->GetMethodID(cls, "instanceMeth1", "()I"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot get method ID!\n"); return STATUS_FAILED; } @@ -211,7 +211,7 @@ Java_nsk_jvmti_unit_GetLineNumberTable_linetab004_check(JNIEnv *env, jclass cls) JVMTI_ERROR_ABSENT_INFORMATION); mid = env->GetMethodID(cls, "instanceMeth2", "()I"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot get method ID!\n"); return STATUS_FAILED; } @@ -222,7 +222,7 @@ Java_nsk_jvmti_unit_GetLineNumberTable_linetab004_check(JNIEnv *env, jclass cls) printf("\n Check native methods of regular class:\n"); } mid = env->GetMethodID(cls, "instanceNativeMeth", "()I"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot get method ID!\n"); return STATUS_FAILED; } @@ -230,7 +230,7 @@ Java_nsk_jvmti_unit_GetLineNumberTable_linetab004_check(JNIEnv *env, jclass cls) JVMTI_ERROR_NATIVE_METHOD); mid = env->GetStaticMethodID(cls, "staticNativeMeth", "()I"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot get method ID!\n"); return STATUS_FAILED; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetLocalVariable/getlocal003/getlocal003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetLocalVariable/getlocal003/getlocal003.cpp index 1688cd1b723e..684444de335f 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetLocalVariable/getlocal003/getlocal003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetLocalVariable/getlocal003/getlocal003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,9 +24,9 @@ #include #include #include "jvmti.h" -#include "jni_tools.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -34,12 +34,12 @@ extern "C" { #define STATUS_PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jint result = STATUS_PASSED; static jboolean printdump = JNI_FALSE; -static jmethodID mid = NULL; -static jvmtiLocalVariableEntry *table = NULL; +static jmethodID mid = nullptr; +static jvmtiLocalVariableEntry *table = nullptr; static jint entryCount = 0; static jint methodExitCnt = -1; @@ -140,7 +140,7 @@ MethodExit(jvmtiEnv *jvmti_env, jvmtiError err; jlocation location; - jmethodID frame_method = NULL; + jmethodID frame_method = nullptr; if (mid != method) { return; @@ -181,12 +181,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; static jvmtiCapabilities caps; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -233,12 +233,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { JNIEXPORT void JNICALL Java_nsk_jvmti_unit_GetLocalVariable_getlocal003_instMeth(JNIEnv *env, jobject inst) { jvmtiError err; - jobject obj = NULL; + jobject obj = nullptr; printf("\n Native instMeth: started\n"); // Test GetLocalInstance with native instance method instMeth() frame - err = jvmti->GetLocalInstance(NULL, 0, &obj); + err = jvmti->GetLocalInstance(nullptr, 0, &obj); printf(" Native instMeth: GetLocalInstance: %s (%d)\n", TranslateError(err), err); if (err != JVMTI_ERROR_NONE) { printf("FAIL: GetLocalInstance failed to get instance for native instance method frame\n"); @@ -250,7 +250,7 @@ Java_nsk_jvmti_unit_GetLocalVariable_getlocal003_instMeth(JNIEnv *env, jobject i } // Test GetLocalInstance with java instance method meth01() frame - err = jvmti->GetLocalInstance(NULL, 1, &obj); + err = jvmti->GetLocalInstance(nullptr, 1, &obj); printf(" Native instMeth: GetLocalInstance: %s (%d)\n", TranslateError(err), err); if (err != JVMTI_ERROR_NONE) { printf("FAIL: GetLocalInstance failed to get instance for java instance method frame\n"); @@ -266,18 +266,18 @@ Java_nsk_jvmti_unit_GetLocalVariable_getlocal003_instMeth(JNIEnv *env, jobject i JNIEXPORT void JNICALL Java_nsk_jvmti_unit_GetLocalVariable_getlocal003_getMeth(JNIEnv *env, jclass cls) { jvmtiError err; - jobject obj = NULL; + jobject obj = nullptr; printf("\n Native getMeth: started\n"); - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; } mid = env->GetStaticMethodID(cls, "staticMeth", "(I)I"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot find Method ID for staticMeth\n"); result = STATUS_FAILED; return; @@ -291,7 +291,7 @@ Java_nsk_jvmti_unit_GetLocalVariable_getlocal003_getMeth(JNIEnv *env, jclass cls return; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_EXIT, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_EXIT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable metod exit event: %s (%d)\n", TranslateError(err), err); @@ -299,7 +299,7 @@ Java_nsk_jvmti_unit_GetLocalVariable_getlocal003_getMeth(JNIEnv *env, jclass cls } // Test GetLocalInstance with native static method getMeth() frame - err = jvmti->GetLocalInstance(NULL, 0, &obj); + err = jvmti->GetLocalInstance(nullptr, 0, &obj); printf(" Native getMeth: GetLocalInstance: %s (%d)\n", TranslateError(err), err); if (err != JVMTI_ERROR_INVALID_SLOT) { printf("FAIL: GetLocalInstance failed to return JVMTI_ERROR_INVALID_SLOT for native static method frame\n"); @@ -307,7 +307,7 @@ Java_nsk_jvmti_unit_GetLocalVariable_getlocal003_getMeth(JNIEnv *env, jclass cls } // Test GetLocalInstance with java static method run() frame - err = jvmti->GetLocalInstance(NULL, 1, &obj); + err = jvmti->GetLocalInstance(nullptr, 1, &obj); printf(" Native getMeth: GetLocalInstance: %s (%d)\n", TranslateError(err), err); if (err != JVMTI_ERROR_INVALID_SLOT) { printf("FAIL: GetLocalInstance failed to return JVMTI_ERROR_INVALID_SLOT for java static method frame\n"); @@ -329,7 +329,7 @@ Java_nsk_jvmti_unit_GetLocalVariable_getlocal003_checkLoc(JNIEnv *env, jint i, j; int overlap = 0; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; @@ -337,7 +337,7 @@ Java_nsk_jvmti_unit_GetLocalVariable_getlocal003_checkLoc(JNIEnv *env, printf("\n checkLoc: START\n"); mid = env->GetStaticMethodID(cls, "staticMeth", "(I)I"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot find Method ID for staticMeth\n"); result = STATUS_FAILED; return; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetLocalVariable/getlocal004/getlocal004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetLocalVariable/getlocal004/getlocal004.cpp index c63875c7da59..b2d92e6a4448 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetLocalVariable/getlocal004/getlocal004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/GetLocalVariable/getlocal004/getlocal004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,9 +24,9 @@ #include #include #include "jvmti.h" -#include "jni_tools.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -34,7 +34,7 @@ extern "C" { #define STATUS_PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = STATUS_PASSED; static jboolean printdump = JNI_FALSE; @@ -61,12 +61,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; static jvmtiCapabilities caps; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -105,16 +105,16 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { JNIEXPORT void JNICALL Java_nsk_jvmti_unit_GetLocalVariable_getlocal004_getMeth(JNIEnv *env, jclass cls) { - jmethodID mid = NULL; + jmethodID mid = nullptr; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); result = STATUS_FAILED; return; } mid = env->GetStaticMethodID(cls, "staticMeth", "(I)I"); - if (mid == NULL) { + if (mid == nullptr) { printf("Cannot find Method ID for staticMeth\n"); result = STATUS_FAILED; return; @@ -156,7 +156,7 @@ Java_nsk_jvmti_unit_GetLocalVariable_getlocal004_checkLoc(JNIEnv *env, jlong locLong = 0L; jdouble locDouble = 0.0f; - if (jvmti == NULL) { + if (jvmti == nullptr) { return; } printf("\n ----------------- checkLoc: %d -----------------\n\n", scope_no); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/IsSynthetic/issynth001/issynth001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/IsSynthetic/issynth001/issynth001.cpp index 7587d47178b8..f0a3ae3739c9 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/IsSynthetic/issynth001/issynth001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/IsSynthetic/issynth001/issynth001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -34,7 +34,7 @@ extern "C" { #define STATUS_FAILED 2 #define JVM_ACC_SYNTHETIC 0x1000 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -54,12 +54,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -102,9 +102,9 @@ checkClassMethods(jclass klass) { jmethodID mid; jboolean isSynthetic; jint meth_cnt = 0; - jmethodID* methods_ptr = NULL; - char* name_ptr = NULL; - char* sign_ptr = NULL; + jmethodID* methods_ptr = nullptr; + char* name_ptr = nullptr; + char* sign_ptr = nullptr; int i; err = jvmti->GetClassMethods(klass, &meth_cnt, &methods_ptr); @@ -118,7 +118,7 @@ checkClassMethods(jclass klass) { jint mods; mid = methods_ptr[i]; err = jvmti->GetMethodName(mid, &name_ptr, - &sign_ptr, (char **) NULL); + &sign_ptr, nullptr); if (err != JVMTI_ERROR_NONE) { printf("(GetMethodName#%d) unexpected error: %s (%d)\n", i, TranslateError(err), err); @@ -160,12 +160,12 @@ checkClassFields(jclass klass) { jfieldID fid; jboolean isSynthetic; jint fld_cnt = 0; - jfieldID* fields_ptr = NULL; - char* name_ptr = NULL; - char* sign_ptr = NULL; + jfieldID* fields_ptr = nullptr; + char* name_ptr = nullptr; + char* sign_ptr = nullptr; int i; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -181,7 +181,7 @@ checkClassFields(jclass klass) { jint mods; fid = fields_ptr[i]; err = jvmti->GetFieldName(klass, fid, &name_ptr, - &sign_ptr, (char **) NULL); + &sign_ptr, nullptr); if (err != JVMTI_ERROR_NONE) { printf("(GetFieldName#%d) unexpected error: %s (%d)\n", i, TranslateError(err), err); @@ -222,13 +222,13 @@ Java_nsk_jvmti_unit_IsSynthetic_issynth001_check(JNIEnv *env, jclass cls, jclass klass) { jvmtiError err; - char* class_sign = NULL; + char* class_sign = nullptr; if (!caps.can_get_synthetic_attribute) { return result; } - err = jvmti->GetClassSignature(cls, &class_sign, (char **) NULL); + err = jvmti->GetClassSignature(cls, &class_sign, nullptr); if (err != JVMTI_ERROR_NONE) { printf("GetSourceFileName unexpected error: %s (%d)\n", TranslateError(err), err); @@ -249,7 +249,7 @@ Java_nsk_jvmti_unit_IsSynthetic_issynth001_check(JNIEnv *env, return result; } - err = jvmti->GetClassSignature(klass, &class_sign, (char **) NULL); + err = jvmti->GetClassSignature(klass, &class_sign, nullptr); if (err != JVMTI_ERROR_NONE) { printf("GetSourceFileName unexpected error: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/MethodBind/JvmtiTest/JvmtiTest.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/MethodBind/JvmtiTest/JvmtiTest.cpp index a70807450d6c..e194c32ad5b1 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/MethodBind/JvmtiTest/JvmtiTest.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/MethodBind/JvmtiTest/JvmtiTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ #include #include #include "jvmti.h" -#include "agent_common.h" +#include "agent_common.hpp" extern "C" { @@ -77,7 +77,7 @@ findLoadClass_type findLoadedClass_func; JNIEXPORT jclass JNICALL my_findLoadedClass(JNIEnv *env, jobject loader, jstring name) { - const char* sname = env->GetStringUTFChars(name, NULL); + const char* sname = env->GetStringUTFChars(name, nullptr); debug_printf("Intercepted findLoadedClass, name = %s\n", sname); return (*findLoadedClass_func)(env, loader, name); } @@ -102,7 +102,7 @@ void JNICALL testNativeMethodBind(jvmtiEnv* jvmti_env, JNIEnv *jni_env, debug_printf("bind event: \n"); print_method_name(mid); - ret = jvmti_env->GetMethodName(mid, &mname, &signature, NULL); + ret = jvmti_env->GetMethodName(mid, &mname, &signature, nullptr); if (ret == JVMTI_ERROR_NONE) { if (strcmp(mname, "findLoadedClass") == 0) { findLoadedClass_func = (findLoadClass_type)func; @@ -161,13 +161,13 @@ jint Agent_Initialize(JavaVM * jvm, char *options, void *reserved) { res = jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks)); JVMTI_ERROR_CHECK("SetEventCallbacks returned error", res); - res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL); + res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, nullptr); JVMTI_ERROR_CHECK("SetEventNotificationMode for VM_INIT returned error", res); - res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL); + res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, nullptr); JVMTI_ERROR_CHECK("SetEventNotificationMode for vm death event returned error", res); - res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_NATIVE_METHOD_BIND, NULL); + res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_NATIVE_METHOD_BIND, nullptr); JVMTI_ERROR_CHECK("SetEventNotificationMode for native method bind event returned error", res); return JNI_OK; @@ -275,14 +275,14 @@ print_method_name(jmethodID mid) { return; } - ret = jvmti->GetClassSignature(klass, &clname, NULL); + ret = jvmti->GetClassSignature(klass, &clname, nullptr); if (ret != JVMTI_ERROR_NONE) { printf("Error: GetClassSignature %d \n", ret); iGlobalStatus = 2; return; } - ret = jvmti->GetMethodName(mid, &mname, &signature, NULL); + ret = jvmti->GetMethodName(mid, &mname, &signature, nullptr); if (ret != JVMTI_ERROR_NONE) { printf("Error: GetMethodName %d \n", ret); iGlobalStatus = 2; @@ -296,7 +296,7 @@ print_method_name(jmethodID mid) { JNIEXPORT void JNICALL Java_nsk_jvmti_unit_MethodBind_JvmtiTest_GetStackTrace(JNIEnv * env, jclass cls, jobject thr) { jvmtiError ret; - jvmtiFrameInfo *stack_buffer = NULL; + jvmtiFrameInfo *stack_buffer = nullptr; jint max_count = 20; jint count; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/OnUnload/JvmtiTest/JvmtiTest.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/OnUnload/JvmtiTest/JvmtiTest.cpp index 6e871d2f763b..09e7687a613c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/OnUnload/JvmtiTest/JvmtiTest.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/OnUnload/JvmtiTest/JvmtiTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ #include #include #include "jvmti.h" -#include "agent_common.h" +#include "agent_common.hpp" extern "C" { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/StackTrace/JvmtiTest/JvmtiTest.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/StackTrace/JvmtiTest/JvmtiTest.cpp index 572ff53c5efe..5f8cbc532c84 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/StackTrace/JvmtiTest/JvmtiTest.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/StackTrace/JvmtiTest/JvmtiTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,7 +28,7 @@ #include #include #include "jvmti.h" -#include "agent_common.h" +#include "agent_common.hpp" extern "C" { @@ -195,8 +195,8 @@ Java_nsk_jvmti_unit_StackTrace_JvmtiTest_GetFrameCount(JNIEnv * env, jclass cls, JNIEXPORT void JNICALL Java_nsk_jvmti_unit_StackTrace_JvmtiTest_GetStackTrace(JNIEnv * env, jclass cls, jobject thr) { jvmtiError ret; - jvmtiFrameInfo *stack_buffer = NULL; - jvmtiFrameInfo *compare_buffer = NULL; + jvmtiFrameInfo *stack_buffer = nullptr; + jvmtiFrameInfo *compare_buffer = nullptr; jint max_count = 20; jint count; jclass klass; @@ -291,14 +291,14 @@ Java_nsk_jvmti_unit_StackTrace_JvmtiTest_GetStackTrace(JNIEnv * env, jclass cls, return; } - ret = jvmti->GetClassSignature(klass, &clname, NULL); + ret = jvmti->GetClassSignature(klass, &clname, nullptr); if (ret != JVMTI_ERROR_NONE) { printf("Error: GetClassSignature %d \n", ret); iGlobalStatus = 2; return; } - ret = jvmti->GetMethodName(stack_buffer[i].method, &mname, &signature, NULL); + ret = jvmti->GetMethodName(stack_buffer[i].method, &mname, &signature, nullptr); if (ret != JVMTI_ERROR_NONE) { printf("Error: GetMethodName %d \n", ret); iGlobalStatus = 2; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/agentthr/agentthr.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/agentthr/agentthr.cpp index 58e2cfe94983..3fb998ebade6 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/agentthr/agentthr.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/agentthr/agentthr.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -34,7 +34,7 @@ extern "C" { #define STATUS_FAILED 2 static JavaVM *jvm_ins; -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiEventCallbacks callbacks; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -121,13 +121,13 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiError err; jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } jvm_ins = jvm; res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -140,7 +140,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable JVMTI_EVENT_THREAD_START: %s (%d)\n", TranslateError(err), err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/clsldrclss00x/clsldrclss00x.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/clsldrclss00x/clsldrclss00x.cpp index 2efbf1406499..1dc9202a7312 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/clsldrclss00x/clsldrclss00x.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/clsldrclss00x/clsldrclss00x.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; @@ -51,12 +51,12 @@ JNIEXPORT jint JNI_OnLoad_clsldrclss00x(JavaVM *jvm, char *options, void *reserv jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -74,7 +74,7 @@ Java_nsk_jvmti_unit_clsldrclss00x_check(JNIEnv *env, jclass appCls, jclass objCl jboolean found; jint i; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -86,8 +86,8 @@ Java_nsk_jvmti_unit_clsldrclss00x_check(JNIEnv *env, jclass appCls, jclass objCl result = STATUS_FAILED; return result; } - if (appClassloader == NULL) { - printf("(GetClassLoader app) unexpected loader - NULL\n"); + if (appClassloader == nullptr) { + printf("(GetClassLoader app) unexpected loader - null\n"); result = STATUS_FAILED; return result; } @@ -99,8 +99,8 @@ Java_nsk_jvmti_unit_clsldrclss00x_check(JNIEnv *env, jclass appCls, jclass objCl result = STATUS_FAILED; return result; } - if (objClassloader != NULL) { - printf("(GetClassLoader obj) unexpected loader - !NULL\n"); + if (objClassloader != nullptr) { + printf("(GetClassLoader obj) unexpected loader - !null\n"); result = STATUS_FAILED; return result; } @@ -117,7 +117,7 @@ Java_nsk_jvmti_unit_clsldrclss00x_check(JNIEnv *env, jclass appCls, jclass objCl for (i = 0; i < classCount; ++i) { char *classSig; jclass k = classes[i]; - err = jvmti->GetClassSignature(k, &classSig, NULL); + err = jvmti->GetClassSignature(k, &classSig, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Error (getClassSignature): %s (%d)\n", TranslateError(err), err); result = STATUS_FAILED; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/events/redefineCFLH/JvmtiTest/JvmtiTest.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/events/redefineCFLH/JvmtiTest/JvmtiTest.cpp index 37ba70728c14..a0b807e7d1d5 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/events/redefineCFLH/JvmtiTest/JvmtiTest.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/events/redefineCFLH/JvmtiTest/JvmtiTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include -#include "agent_common.h" -#include "JVMTITools.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -33,7 +33,7 @@ extern "C" { #define STATUS_FAILED 2 #define PASSED 0 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jvmtiCapabilities caps; static jvmtiEventCallbacks callbacks; static jint result = PASSED; @@ -63,12 +63,12 @@ ClassFileLoadHook(jvmtiEnv *jvmti_env, JNIEnv *env, char *sig; char *gen; - if (name != NULL && (strcmp(name, CLASS_NAME) == 0)) { + if (name != nullptr && (strcmp(name, CLASS_NAME) == 0)) { if (printdump == JNI_TRUE) { printf("Received class file load hook event for class %s\n", name); } - if (redefined_class != NULL) { + if (redefined_class != nullptr) { err = jvmti->GetClassSignature(redefined_class, &sig, &gen); if (err != JVMTI_ERROR_NONE) { printf("(GetClassSignature) unexpected error: %s (%d)\n", @@ -106,7 +106,7 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } @@ -150,14 +150,14 @@ jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) { return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable event JVMTI_EVENT_VM_INIT: %s (%d)\n", TranslateError(err), err); return JNI_ERR; } - err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Failed to enable event JVMTI_EVENT_CLASS_FILE_LOAD_HOOK: %s (%d)\n", TranslateError(err), err); @@ -173,7 +173,7 @@ Java_nsk_jvmti_unit_events_redefineCFLH_JvmtiTest_makeRedefinition(JNIEnv *env, jvmtiClassDefinition classDef; jvmtiError err; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } @@ -185,7 +185,7 @@ Java_nsk_jvmti_unit_events_redefineCFLH_JvmtiTest_makeRedefinition(JNIEnv *env, /* filling the structure jvmtiClassDefinition */ classDef.klass = redefCls; classDef.class_byte_count = env->GetArrayLength(classBytes); - classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(classBytes, NULL); + classDef.class_bytes = (unsigned char *) env->GetByteArrayElements(classBytes, nullptr); if (fl == 2) { printf(">>>>>>>> Invoke RedefineClasses():\n"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/extmech/extmech.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/extmech/extmech.cpp index 4d7b98686702..7f3c629f5bbf 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/extmech/extmech.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/extmech/extmech.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ #include #include #include "jvmti.h" -#include "agent_common.h" +#include "agent_common.hpp" extern "C" { @@ -100,7 +100,7 @@ Java_nsk_jvmti_unit_extmech_enableClassUnloadEvent if (strcmp(ext_events[i].id, (char*)"com.sun.hotspot.events.ClassUnload") == 0) { err = jvmti->SetExtensionEventCallback(ext_events[i].extension_event_index, - enable ? (jvmtiExtensionEvent)ClassUnload : NULL); + enable ? (jvmtiExtensionEvent)ClassUnload : nullptr); if (err != JVMTI_ERROR_NONE) { fprintf(stderr, "SetExtenionEventCallback failed: %d\n", err); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/AddToBootstrapClassLoaderSearch/JvmtiTest/JvmtiTest.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/AddToBootstrapClassLoaderSearch/JvmtiTest/JvmtiTest.cpp index 4d38e540d87b..6e56e1a18f52 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/AddToBootstrapClassLoaderSearch/JvmtiTest/JvmtiTest.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/AddToBootstrapClassLoaderSearch/JvmtiTest/JvmtiTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ #include #include #include "jvmti.h" -#include "agent_common.h" +#include "agent_common.hpp" extern "C" { @@ -143,13 +143,13 @@ classFileLoadEvent(jvmtiEnv *jvmti_env, JNIEnv *env, jint* new_class_data_len, unsigned char** new_class_data) { - if (name != NULL && (strcmp(name, BOOT_CLASS) == 0)) { + if (name != nullptr && (strcmp(name, BOOT_CLASS) == 0)) { debug_printf("Received class file load hook event for class: \n\t%s\n", name); debug_printf("Received class loader: 0x%p \n", loader); /* Check to make sure Boot class got loaded from bootstrap class path.*/ - if (loader == NULL) { + if (loader == nullptr) { boot_class_count++; } } @@ -192,7 +192,7 @@ jint Agent_Initialize(JavaVM * jvm, char *options, void *reserved) { strncpy(segment, options, (size_t) sizeof(segment)/sizeof(char)); segment[(size_t) sizeof(segment)/sizeof(char) - 1] = 0; idx = strchr(segment, ','); - if (idx != NULL) *idx = 0; + if (idx != nullptr) *idx = 0; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); @@ -214,19 +214,19 @@ jint Agent_Initialize(JavaVM * jvm, char *options, void *reserved) { res = jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks)); JVMTI_ERROR_CHECK("SetEventCallbacks returned error", res); - res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_START, NULL); + res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_START, nullptr); JVMTI_ERROR_CHECK("SetEventNotificationMode for VM_START returned error", res); - res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL); + res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, nullptr); JVMTI_ERROR_CHECK("SetEventNotificationMode for VM_INIT returned error", res); - res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_NATIVE_METHOD_BIND, NULL); + res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_NATIVE_METHOD_BIND, nullptr); JVMTI_ERROR_CHECK("SetEventNotificationMode for NATIVE_METHOD_BIND returned error", res); - res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL); + res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, nullptr); JVMTI_ERROR_CHECK("SetEventNotificationMode for VM_DEATH returned error", res); - res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL); + res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, nullptr); JVMTI_ERROR_CHECK("SetEventNotificationMode CLASS_FILE_LOAD_HOOK returned error", res); strcat(segment, "/newclass"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/Dispose/JvmtiTest/JvmtiTest.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/Dispose/JvmtiTest/JvmtiTest.cpp index f85d438a68ac..61e5a32ad5bc 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/Dispose/JvmtiTest/JvmtiTest.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/Dispose/JvmtiTest/JvmtiTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ #include #include #include "jvmti.h" -#include "agent_common.h" +#include "agent_common.hpp" extern "C" { @@ -115,7 +115,7 @@ jint Agent_Initialize(JavaVM * jvm, char *options, void *reserved) { JVMTI_ERROR_CHECK("GetAddCapabilities returned error", res); - res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL); + res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, nullptr); JVMTI_ERROR_CHECK("SetEventNotificationMode for VM_INIT returned error", res); res = jvmti->GetSystemProperties(&count, &properties); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/ForceGarbageCollection/gc/gc.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/ForceGarbageCollection/gc/gc.cpp index f3ff582ea8db..8545445cdb90 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/ForceGarbageCollection/gc/gc.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/ForceGarbageCollection/gc/gc.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ #include #include #include "jvmti.h" -#include "agent_common.h" +#include "agent_common.hpp" extern "C" { @@ -134,16 +134,16 @@ jint Agent_Initialize(JavaVM * jvm, char *options, void *reserved) { res = jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks)); JVMTI_ERROR_CHECK("SetEventCallbacks returned error", res); - res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL); + res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, nullptr); JVMTI_ERROR_CHECK("SetEventNotificationMode for VM_INIT returned error", res); - res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL); + res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, nullptr); JVMTI_ERROR_CHECK("SetEventNotificationMode for vm death event returned error", res); - res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_START, NULL); + res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_START, nullptr); JVMTI_ERROR_CHECK("SetEventNotificationMode for gc start returned error", res); - res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_FINISH, NULL); + res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_FINISH, nullptr); JVMTI_ERROR_CHECK("SetEventNotificationMode for gc finish returned error", res); return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/environment/JvmtiTest/JvmtiTest.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/environment/JvmtiTest/JvmtiTest.cpp index 9358ce599a20..6177f448c6c6 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/environment/JvmtiTest/JvmtiTest.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/environment/JvmtiTest/JvmtiTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ #include #include #include "jvmti.h" -#include "agent_common.h" +#include "agent_common.hpp" extern "C" { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/nosuspendMonitorInfo/JvmtiTest/JvmtiTest.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/nosuspendMonitorInfo/JvmtiTest/JvmtiTest.cpp index 4c0e6fbbc6b3..64f09edbaa42 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/nosuspendMonitorInfo/JvmtiTest/JvmtiTest.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/nosuspendMonitorInfo/JvmtiTest/JvmtiTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ #include #include #include "jvmti.h" -#include "agent_common.h" +#include "agent_common.hpp" extern "C" { @@ -134,10 +134,10 @@ jint Agent_Initialize(JavaVM * jvm, char *options, void *reserved) { res = jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks)); JVMTI_ERROR_CHECK("SetEventCallbacks returned error", res); - res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL); + res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, nullptr); JVMTI_ERROR_CHECK("SetEventNotificationMode for VM_INIT returned error", res); - res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL); + res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, nullptr); JVMTI_ERROR_CHECK("SetEventNotificationMode for vm death event returned error", res); return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/nosuspendStackTrace/JvmtiTest/JvmtiTest.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/nosuspendStackTrace/JvmtiTest/JvmtiTest.cpp index c3934dd0b90a..b64184ed55cc 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/nosuspendStackTrace/JvmtiTest/JvmtiTest.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/nosuspendStackTrace/JvmtiTest/JvmtiTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ #include #include #include "jvmti.h" -#include "agent_common.h" +#include "agent_common.hpp" extern "C" { @@ -133,10 +133,10 @@ jint Agent_Initialize(JavaVM * jvm, char *options, void *reserved) { res = jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks)); JVMTI_ERROR_CHECK("SetEventCallbacks returned error", res); - res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL); + res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, nullptr); JVMTI_ERROR_CHECK("SetEventNotificationMode for VM_INIT returned error", res); - res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL); + res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, nullptr); JVMTI_ERROR_CHECK("SetEventNotificationMode for vm death event returned error", res); return JNI_OK; @@ -233,7 +233,7 @@ Java_nsk_jvmti_unit_functions_nosuspendStackTrace_JvmtiTest_GetFrameCount(JNIEnv JNIEXPORT void JNICALL Java_nsk_jvmti_unit_functions_nosuspendStackTrace_JvmtiTest_GetStackTrace(JNIEnv * env, jclass cls, jobject thr) { jvmtiError ret; - jvmtiFrameInfo *stack_buffer = NULL; + jvmtiFrameInfo *stack_buffer = nullptr; jint count = 20; jclass klass; char *mname; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/rawmonitor/rawmonitor.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/rawmonitor/rawmonitor.cpp index 330c5551eed9..6ee955ae420d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/rawmonitor/rawmonitor.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/functions/rawmonitor/rawmonitor.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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 @@ -46,7 +46,7 @@ #include #include #include "jvmti.h" -#include "agent_common.h" +#include "agent_common.hpp" extern "C" { @@ -221,13 +221,13 @@ jint Agent_Initialize(JavaVM * jvm, char *options, void *reserved) { res = jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks)); JVMTI_ERROR_CHECK("SetEventCallbacks returned error", res); - res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL); + res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, nullptr); JVMTI_ERROR_CHECK("SetEventNotificationMode for VM_INIT returned error", res); - res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL); + res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, nullptr); JVMTI_ERROR_CHECK("SetEventNotificationMode for vm death event returned error", res); - res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL); + res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, nullptr); JVMTI_ERROR_CHECK("SetEventNotificationMode CLASS_FILE_LOAD_HOOK returned error", res); /* acquire lock in onload */ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/heapref/heapref.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/heapref/heapref.cpp index 640779eb75c9..0772a387a321 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/heapref/heapref.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/heapref/heapref.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,9 +25,9 @@ #include #include #include "jvmti.h" -#include "jni_tools.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -35,7 +35,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; static jvmtiCapabilities jvmti_caps; @@ -70,8 +70,8 @@ typedef struct _refLink { struct _refLink *next; } refLink; -static MyTag *fakeRoot = NULL; -static MyTag *missed = NULL; +static MyTag *fakeRoot = nullptr; +static MyTag *missed = nullptr; static void breakpoint() { printf("Continuing from BREAKPOINT\n"); @@ -82,10 +82,10 @@ static MyTag *newTag(refKind kind, jlong size, const char* name) { static jlong seq_num = 0; - MyTag* new_tag = NULL; + MyTag* new_tag = nullptr; new_tag = (MyTag*) malloc(sizeof(MyTag)); - if (NULL == new_tag) { + if (nullptr == new_tag) { printf("Error (newTag malloc): failed\n"); result = STATUS_FAILED; } @@ -95,7 +95,7 @@ static MyTag *newTag(refKind kind, new_tag->sequence = ++seq_num; new_tag->visited = JNI_FALSE; new_tag->name = name; - new_tag->ref = NULL; + new_tag->ref = nullptr; return new_tag; } @@ -103,11 +103,11 @@ static void setTag(JNIEnv *env, jobject obj, refKind kind, const char* name) { - MyTag *new_tag = NULL; - MyTag *class_tag = NULL; + MyTag *new_tag = nullptr; + MyTag *class_tag = nullptr; jvmtiError err; jlong size = 0; - jclass obj_class = NULL; + jclass obj_class = nullptr; jlong haba = 0; err = jvmti->GetObjectSize(obj, &size); @@ -124,7 +124,7 @@ static void setTag(JNIEnv *env, printf("Error (GetTag): %s (%d)\n", TranslateError(err), err); result = STATUS_FAILED; } - if (class_tag != NULL && class_tag->kind != rclass) { + if (class_tag != nullptr && class_tag->kind != rclass) { printf("Error class tag which is not a class\n"); result = STATUS_FAILED; } @@ -142,7 +142,7 @@ static void addRef(MyTag *from, int reference_kind, MyTag *to) { refLink *new_ref; new_ref = (refLink*) malloc(sizeof(refLink)); - if (NULL == new_ref) { + if (nullptr == new_ref) { printf("Error (addRef malloc): failed\n"); result = STATUS_FAILED; } @@ -215,7 +215,7 @@ static void walk(MyTag* tag, jint depth, const char* ref_label) { const char *indent = spaces + (len - 2 * depth); const MyTag* const ctag = tag->class_tag; - const char* const cname = ctag != NULL ? ctag->name : ""; + const char* const cname = ctag != nullptr ? ctag->name : ""; printf("%s", indent); @@ -258,12 +258,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -281,7 +281,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiIterationControl JNICALL heapMarkCallback(jlong class_tag, jlong size, jlong* tag_ptr, void* user_data) { - const MyTag* const tag = newTag(rmark, (const MyTag*)(intptr_t)class_tag, size, NULL); + const MyTag* const tag = newTag(rmark, (const MyTag*)(intptr_t)class_tag, size, nullptr); *tag_ptr = (intptr_t)tag; if (user_data != &dummy_user_data && user_data_error_flag == JNI_FALSE) { @@ -300,7 +300,7 @@ heapRootCallback(jvmtiHeapRootKind root_kind, if (0 == *tag_ptr) { /* new tag */ - MyTag* tag = newTag(kind, (MyTag*)(intptr_t)class_tag, size, NULL); + MyTag* tag = newTag(kind, (MyTag*)(intptr_t)class_tag, size, nullptr); addRef(fakeRoot, HEAP_ROOT_REF_KIND_BASE+root_kind, tag); *tag_ptr = (intptr_t)tag; } else { @@ -326,7 +326,7 @@ stackReferenceCallback(jvmtiHeapRootKind root_kind, if (0 == *tag_ptr) { /* new tag */ - MyTag* tag = newTag(kind, (MyTag*)(intptr_t)class_tag, size, NULL); + MyTag* tag = newTag(kind, (MyTag*)(intptr_t)class_tag, size, nullptr); addRef(fakeRoot, HEAP_ROOT_REF_KIND_BASE+root_kind, tag); *tag_ptr = (intptr_t)tag; } else { @@ -347,7 +347,7 @@ objectReferenceCallback(jvmtiObjectReferenceKind reference_kind, jlong* tag_ptr, jlong referrer_tag, jint referrer_index, void* user_data) { refKind kind = rother; - MyTag* referrer = NULL; + MyTag* referrer = nullptr; if (0 == referrer_tag) { referrer = missed; @@ -357,7 +357,7 @@ objectReferenceCallback(jvmtiObjectReferenceKind reference_kind, if (0 == *tag_ptr) { /* new tag */ - MyTag* tag = newTag(kind, (MyTag*)(intptr_t)class_tag, size, NULL); + MyTag* tag = newTag(kind, (MyTag*)(intptr_t)class_tag, size, nullptr); addRef(referrer, reference_kind, tag); *tag_ptr = (intptr_t) tag; } else { @@ -382,13 +382,13 @@ Java_nsk_jvmti_unit_heapref_check(JNIEnv *env, jclass cls) { jint threadCount = 0; jint i; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } - fakeRoot = newTag(rother, (const MyTag *)NULL, 0, "FAKE_ROOT"); - missed = newTag(rother, (const MyTag *)NULL, 0, "MISSED"); + fakeRoot = newTag(rother, nullptr, 0, "FAKE_ROOT"); + missed = newTag(rother, nullptr, 0, "MISSED"); if (env->PushLocalFrame(500) != 0) { printf("Error (PushLocalFrame): failed\n"); @@ -404,7 +404,7 @@ Java_nsk_jvmti_unit_heapref_check(JNIEnv *env, jclass cls) { for (i = 0; i < classCount; ++i) { char *classSig; jclass k = classes[i]; - err = jvmti->GetClassSignature(k, &classSig, NULL); + err = jvmti->GetClassSignature(k, &classSig, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Error (getClassSignature): %s (%d)\n", TranslateError(err), err); result = STATUS_FAILED; @@ -414,7 +414,7 @@ Java_nsk_jvmti_unit_heapref_check(JNIEnv *env, jclass cls) { if (classSig[len-1] == ';') { classSig[len-1] = 0; } - if (*classSig == 'L' && slash != NULL) { + if (*classSig == 'L' && slash != nullptr) { classSig = slash + 1; } setTag(env, k, rclass, (const char*)classSig); @@ -439,7 +439,7 @@ Java_nsk_jvmti_unit_heapref_check(JNIEnv *env, jclass cls) { } } - env->PopLocalFrame(NULL); + env->PopLocalFrame(nullptr); user_data_error_flag = JNI_FALSE; err = jvmti->IterateOverHeap( diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/refignore/refignore.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/refignore/refignore.cpp index bdf8f3b368de..b850edd75b07 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/refignore/refignore.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/refignore/refignore.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,9 +25,9 @@ #include #include #include "jvmti.h" -#include "jni_tools.h" -#include "agent_common.h" -#include "JVMTITools.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -35,7 +35,7 @@ extern "C" { #define PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv *jvmti = NULL; +static jvmtiEnv *jvmti = nullptr; static jint result = PASSED; static jboolean printdump = JNI_FALSE; static jvmtiCapabilities jvmti_caps; @@ -70,8 +70,8 @@ typedef struct _refLink { struct _refLink *next; } refLink; -static MyTag *fakeRoot = NULL; -static MyTag *missed = NULL; +static MyTag *fakeRoot = nullptr; +static MyTag *missed = nullptr; static void breakpoint() { printf("Continuing from BREAKPOINT\n"); @@ -82,10 +82,10 @@ static MyTag *newTag(refKind kind, jlong size, const char* name) { static jlong seq_num = 0; - MyTag* new_tag = NULL; + MyTag* new_tag = nullptr; new_tag = (MyTag*) malloc(sizeof(MyTag)); - if (NULL == new_tag) { + if (nullptr == new_tag) { printf("Error (newTag malloc): failed\n"); result = STATUS_FAILED; } @@ -95,7 +95,7 @@ static MyTag *newTag(refKind kind, new_tag->sequence = ++seq_num; new_tag->visited = JNI_FALSE; new_tag->name = name; - new_tag->ref = NULL; + new_tag->ref = nullptr; return new_tag; } @@ -103,11 +103,11 @@ static void setTag(JNIEnv *env, jobject obj, refKind kind, const char* name) { - MyTag *new_tag = NULL; - MyTag *class_tag = NULL; + MyTag *new_tag = nullptr; + MyTag *class_tag = nullptr; jvmtiError err; jlong size = 0; - jclass obj_class = NULL; + jclass obj_class = nullptr; jlong haba = 0; err = jvmti->GetObjectSize(obj, &size); @@ -124,7 +124,7 @@ static void setTag(JNIEnv *env, printf("Error (GetTag): %s (%d)\n", TranslateError(err), err); result = STATUS_FAILED; } - if (class_tag != NULL && class_tag->kind != rclass) { + if (class_tag != nullptr && class_tag->kind != rclass) { printf("Error class tag which is not a class\n"); result = STATUS_FAILED; } @@ -142,7 +142,7 @@ static void addRef(MyTag *from, int reference_kind, MyTag *to) { refLink *new_ref; new_ref = (refLink*) malloc(sizeof(refLink)); - if (NULL == new_ref) { + if (nullptr == new_ref) { printf("Error (addRef malloc): failed\n"); result = STATUS_FAILED; } @@ -215,7 +215,7 @@ static void walk(MyTag* tag, jint depth, const char* ref_label) { const char *indent = spaces + (len - 2 * depth); const MyTag* const ctag = tag->class_tag; - const char* const cname = ctag != NULL ? ctag->name : ""; + const char* const cname = ctag != nullptr ? ctag->name : ""; printf("%s", indent); @@ -256,12 +256,12 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jint res; jvmtiError err; - if (options != NULL && strcmp(options, "printdump") == 0) { + if (options != nullptr && strcmp(options, "printdump") == 0) { printdump = JNI_TRUE; } res = jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1); - if (res != JNI_OK || jvmti == NULL) { + if (res != JNI_OK || jvmti == nullptr) { printf("Wrong result of a valid call to GetEnv!\n"); return JNI_ERR; } @@ -279,7 +279,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiIterationControl JNICALL heapMarkCallback(jlong class_tag, jlong size, jlong* tag_ptr, void* user_data) { - const MyTag* const tag = newTag(rmark, (const MyTag*)(intptr_t)class_tag, size, NULL); + const MyTag* const tag = newTag(rmark, (const MyTag*)(intptr_t)class_tag, size, nullptr); *tag_ptr = (intptr_t)tag; if (user_data != &dummy_user_data && user_data_error_flag == JNI_FALSE) { @@ -298,7 +298,7 @@ heapRootCallback(jvmtiHeapRootKind root_kind, if (0 == *tag_ptr) { /* new tag */ - MyTag* tag = newTag(kind, (MyTag*)(intptr_t)class_tag, size, NULL); + MyTag* tag = newTag(kind, (MyTag*)(intptr_t)class_tag, size, nullptr); addRef(fakeRoot, HEAP_ROOT_REF_KIND_BASE+root_kind, tag); *tag_ptr = (intptr_t)tag; } else { @@ -324,7 +324,7 @@ stackReferenceCallback(jvmtiHeapRootKind root_kind, if (0 == *tag_ptr) { /* new tag */ - MyTag* tag = newTag(kind, (MyTag*)(intptr_t)class_tag, size, NULL); + MyTag* tag = newTag(kind, (MyTag*)(intptr_t)class_tag, size, nullptr); addRef(fakeRoot, HEAP_ROOT_REF_KIND_BASE+root_kind, tag); *tag_ptr = (intptr_t)tag; } else { @@ -345,7 +345,7 @@ objectReferenceCallback(jvmtiObjectReferenceKind reference_kind, jlong* tag_ptr, jlong referrer_tag, jint referrer_index, void* user_data) { refKind kind = rother; - MyTag* referrer = NULL; + MyTag* referrer = nullptr; if (0 == referrer_tag) { referrer = missed; @@ -355,7 +355,7 @@ objectReferenceCallback(jvmtiObjectReferenceKind reference_kind, if (0 == *tag_ptr) { /* new tag */ - MyTag* tag = newTag(kind, (MyTag*)(intptr_t)class_tag, size, NULL); + MyTag* tag = newTag(kind, (MyTag*)(intptr_t)class_tag, size, nullptr); addRef(referrer, reference_kind, tag); *tag_ptr = (intptr_t) tag; } else { @@ -380,13 +380,13 @@ Java_nsk_jvmti_unit_refignore_check(JNIEnv *env, jclass cls) { jint threadCount = 0; jint i; - if (jvmti == NULL) { + if (jvmti == nullptr) { printf("JVMTI client was not properly loaded!\n"); return STATUS_FAILED; } - fakeRoot = newTag(rother, (const MyTag *)NULL, 0, "FAKE_ROOT"); - missed = newTag(rother, (const MyTag *)NULL, 0, "MISSED"); + fakeRoot = newTag(rother, nullptr, 0, "FAKE_ROOT"); + missed = newTag(rother, nullptr, 0, "MISSED"); if (env->PushLocalFrame(500) != 0) { printf("Error (PushLocalFrame): failed\n"); @@ -402,7 +402,7 @@ Java_nsk_jvmti_unit_refignore_check(JNIEnv *env, jclass cls) { for (i = 0; i < classCount; ++i) { char *classSig; jclass k = classes[i]; - err = jvmti->GetClassSignature(k, &classSig, NULL); + err = jvmti->GetClassSignature(k, &classSig, nullptr); if (err != JVMTI_ERROR_NONE) { printf("Error (getClassSignature): %s (%d)\n", TranslateError(err), err); result = STATUS_FAILED; @@ -412,7 +412,7 @@ Java_nsk_jvmti_unit_refignore_check(JNIEnv *env, jclass cls) { if (classSig[len-1] == ';') { classSig[len-1] = 0; } - if (*classSig == 'L' && slash != NULL) { + if (*classSig == 'L' && slash != nullptr) { classSig = slash + 1; } setTag(env, k, rclass, (const char*)classSig); @@ -437,7 +437,7 @@ Java_nsk_jvmti_unit_refignore_check(JNIEnv *env, jclass cls) { } } - env->PopLocalFrame(NULL); + env->PopLocalFrame(nullptr); user_data_error_flag = JNI_FALSE; err = jvmti->IterateOverHeap( diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/setNullVMInit/JvmtiTest/JvmtiTest.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/setNullVMInit/JvmtiTest/JvmtiTest.cpp index f670dfafbb58..8743b6c0ec5b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/setNullVMInit/JvmtiTest/JvmtiTest.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/setNullVMInit/JvmtiTest/JvmtiTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,15 +26,15 @@ VMInit initial thread arg. SetThreadLocalStorage and SetEnvironmentLocalStorage should allow - value to be set to NULL. + value to be set to nullptr. */ #include #include #include #include "jvmti.h" -#include "jni_tools.h" -#include "agent_common.h" +#include "jni_tools.hpp" +#include "agent_common.hpp" extern "C" { @@ -105,13 +105,13 @@ void check_val(intptr_t x, intptr_t y, const char* msg) { void JNICALL vmInit(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jthread thread) { check_val(get_thread_local(thread), 0, "thread initial"); - check_val(get_thread_local(NULL), 0, "thread initial"); + check_val(get_thread_local(nullptr), 0, "thread initial"); set_thread_local(thread, 35); check_val(get_thread_local(thread), 35, "thread set non-zero"); - check_val(get_thread_local(NULL), 35, "thread set non-zero"); - set_thread_local(NULL, 0); + check_val(get_thread_local(nullptr), 35, "thread set non-zero"); + set_thread_local(nullptr, 0); check_val(get_thread_local(thread), 0, "thread set zero"); - check_val(get_thread_local(NULL), 0, "thread set zero"); + check_val(get_thread_local(nullptr), 0, "thread set zero"); check_val(get_env_local(), 14, "env set non-zero"); set_env_local(77); @@ -161,7 +161,7 @@ jint Agent_Initialize(JavaVM * jvm, char *options, void *reserved) { res = jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks)); JVMTI_ERROR_CHECK("SetEventCallbacks returned error", res); - res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT,NULL); + res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT,nullptr); JVMTI_ERROR_CHECK("SetEventNotificationMode for VM_INIT returned error", res); return JNI_OK; @@ -175,7 +175,7 @@ Java_nsk_jvmti_unit_setNullVMInit_JvmtiTest_check(JNIEnv *env, jclass cls) { set_env_local(0); check_val(get_env_local(), 0, "env reset to zero"); - check_val(get_thread_local(NULL), 0, "thread check"); + check_val(get_thread_local(nullptr), 0, "thread check"); return iGlobalStatus; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/timers/JvmtiTest/JvmtiTest.cpp b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/timers/JvmtiTest/JvmtiTest.cpp index d9be94340e7f..6491f3e66862 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/timers/JvmtiTest/JvmtiTest.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/unit/timers/JvmtiTest/JvmtiTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +35,9 @@ #include #include #include "jvmti.h" -#include "agent_common.h" +#include "agent_common.hpp" -#include "jni_tools.h" +#include "jni_tools.hpp" extern "C" { @@ -143,10 +143,10 @@ jint Agent_Initialize(JavaVM * jvm, char *options, void *reserved) { res = jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks)); JVMTI_ERROR_CHECK_DURING_ONLOAD("SetEventCallbacks returned error", res); - res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL); + res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, nullptr); JVMTI_ERROR_CHECK_DURING_ONLOAD("SetEventNotificationMode for VM_INIT returned error", res); - res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL); + res = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, nullptr); JVMTI_ERROR_CHECK_DURING_ONLOAD("SetEventNotificationMode for vm death event returned error", res); return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/StackTraceController.cpp b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/StackTraceController.cpp index 5b907b42a7e2..1f3f3a019bf0 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/StackTraceController.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/StackTraceController.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,13 +23,13 @@ #include #include -#include "jni_tools.h" +#include "jni_tools.hpp" extern "C" { #define GET_OBJECT_CLASS(_class, _obj)\ if (!NSK_JNI_VERIFY(env, (_class = \ - env->GetObjectClass(_obj)) != NULL))\ + env->GetObjectClass(_obj)) != nullptr))\ return 2 #define CALL_STATIC_VOID_NOPARAM(_class, _methodName)\ @@ -39,12 +39,12 @@ extern "C" { #define GET_STATIC_METHOD_ID(_methodID, _class, _methodName, _sig)\ if (!NSK_JNI_VERIFY(env, (_methodID = \ - env->GetStaticMethodID(_class, _methodName, _sig)) != NULL))\ + env->GetStaticMethodID(_class, _methodName, _sig)) != nullptr))\ return 2 #define GET_METHOD_ID(_methodID, _class, _methodName, _sig)\ if (!NSK_JNI_VERIFY(env, (_methodID = \ - env->GetMethodID(_class, _methodName, _sig)) != NULL))\ + env->GetMethodID(_class, _methodName, _sig)) != nullptr))\ return 2 #define CALL_VOID_NOPARAM(_obj, _class, _methodName)\ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/ThreadController.cpp b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/ThreadController.cpp index 3e8530d0ecc1..90fd4df97e6c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/ThreadController.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/ThreadController.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,23 +25,23 @@ #include #include #include -#include "jni_tools.h" +#include "jni_tools.hpp" extern "C" { #define FIND_CLASS(_class, _className)\ if (!NSK_JNI_VERIFY(env, (_class = \ - env->FindClass(_className)) != NULL))\ + env->FindClass(_className)) != nullptr))\ return #define GET_OBJECT_CLASS(_class, _obj)\ if (!NSK_JNI_VERIFY(env, (_class = \ - env->GetObjectClass(_obj)) != NULL))\ + env->GetObjectClass(_obj)) != nullptr))\ return #define GET_STATIC_FIELD_ID(_fieldID, _class, _fieldName, _fieldSig)\ if (!NSK_JNI_VERIFY(env, (_fieldID = \ - env->GetStaticFieldID(_class, _fieldName, _fieldSig)) != NULL))\ + env->GetStaticFieldID(_class, _fieldName, _fieldSig)) != nullptr))\ return #define GET_STATIC_OBJ_FIELD(_value, _class, _fieldName, _fieldSig)\ @@ -54,7 +54,7 @@ extern "C" { #define GET_FIELD_ID(_fieldID, _class, _fieldName, _fieldSig)\ if (!NSK_JNI_VERIFY(env, (_fieldID = \ - env->GetFieldID(_class, _fieldName, _fieldSig)) != NULL))\ + env->GetFieldID(_class, _fieldName, _fieldSig)) != nullptr))\ return #define GET_INT_FIELD(_value, _obj, _class, _fieldName)\ @@ -90,12 +90,12 @@ extern "C" { #define GET_STATIC_METHOD_ID(_methodID, _class, _methodName, _sig)\ if (!NSK_JNI_VERIFY(env, (_methodID = \ - env->GetStaticMethodID(_class, _methodName, _sig)) != NULL))\ + env->GetStaticMethodID(_class, _methodName, _sig)) != nullptr))\ return #define GET_METHOD_ID(_methodID, _class, _methodName, _sig)\ if (!NSK_JNI_VERIFY(env, (_methodID = \ - env->GetMethodID(_class, _methodName, _sig)) != NULL))\ + env->GetMethodID(_class, _methodName, _sig)) != nullptr))\ return #define CALL_STATIC_VOID_NOPARAM(_class, _methodName)\ @@ -134,7 +134,7 @@ extern "C" { #define NEW_OBJ(_obj, _class, _constructorName, _sig, _params)\ GET_METHOD_ID(method, _class, _constructorName, _sig);\ if (!NSK_JNI_VERIFY(env, (_obj = \ - env->NewObject(_class, method, _params)) != NULL))\ + env->NewObject(_class, method, _params)) != nullptr))\ return #define MONITOR_ENTER(x) \ @@ -487,23 +487,23 @@ extern "C" { jint state; if (!NSK_VERIFY(env->GetJavaVM(&vm) == 0)) { - return NULL; + return nullptr; } if (!NSK_VERIFY(vm->GetEnv((void **)&jvmti, JVMTI_VERSION_1) == JNI_OK)) { - return NULL; + return nullptr; } if (!NSK_VERIFY(jvmti->GetThreadState((jthread)thread, &state) == JVMTI_ERROR_NONE)) { - return NULL; + return nullptr; } stateName = getStateName(env, state); - if (!NSK_JNI_VERIFY(env, (ThreadState = env->FindClass("java/lang/Thread$State")) != NULL)) - return NULL; + if (!NSK_JNI_VERIFY(env, (ThreadState = env->FindClass("java/lang/Thread$State")) != nullptr)) + return nullptr; - if (!NSK_JNI_VERIFY(env, (method = env->GetStaticMethodID(ThreadState, "valueOf", "(Ljava/lang/String;)Ljava/lang/Thread$State;")) != NULL)) - return NULL; + if (!NSK_JNI_VERIFY(env, (method = env->GetStaticMethodID(ThreadState, "valueOf", "(Ljava/lang/String;)Ljava/lang/Thread$State;")) != nullptr)) + return nullptr; threadState = env->CallStaticObjectMethod(ThreadState, method, stateName); return threadState; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/Deadlock.cpp b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/Deadlock.cpp index 6e2c066b94e2..c45fee989f70 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/Deadlock.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/Deadlock.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,18 +21,18 @@ * questions. */ #include -#include "jni_tools.h" +#include "jni_tools.hpp" extern "C" { #define FIND_CLASS(_class, _className)\ if (!NSK_JNI_VERIFY(env, (_class = \ - env->FindClass(_className)) != NULL))\ + env->FindClass(_className)) != nullptr))\ return #define GET_OBJECT_CLASS(_class, _obj)\ if (!NSK_JNI_VERIFY(env, (_class = \ - env->GetObjectClass(_obj)) != NULL))\ + env->GetObjectClass(_obj)) != nullptr))\ return #define GET_OBJ_FIELD(_value, _obj, _class, _fieldName, _fieldSig)\ @@ -41,12 +41,12 @@ extern "C" { #define GET_FIELD_ID(_fieldID, _class, _fieldName, _fieldSig)\ if (!NSK_JNI_VERIFY(env, (_fieldID = \ - env->GetFieldID(_class, _fieldName, _fieldSig)) != NULL))\ + env->GetFieldID(_class, _fieldName, _fieldSig)) != nullptr))\ return #define GET_METHOD_ID(_methodID, _class, _methodName, _sig)\ if (!NSK_JNI_VERIFY(env, (_methodID = \ - env->GetMethodID(_class, _methodName, _sig)) != NULL)) \ + env->GetMethodID(_class, _methodName, _sig)) != nullptr)) \ return #define CALL_VOID_NOPARAM(_obj, _class, _methodName)\ @@ -72,23 +72,23 @@ JNIEXPORT void JNICALL Java_nsk_monitoring_share_thread_Deadlock_00024NativeLock FIND_CLASS(testBugClass, "nsk/share/TestBug"); GET_OBJ_FIELD(lock, o, nativeLockerClass, "lock", "Ljava/lang/Object;"); GET_OBJ_FIELD(step1, o, nativeLockerClass, "step1", "Lnsk/share/Wicket;"); - if (step1 == NULL) { + if (step1 == nullptr) { env->ThrowNew(testBugClass, "step1 field is null"); return; } GET_OBJ_FIELD(step2, o, nativeLockerClass, "step2", "Lnsk/share/Wicket;"); - if (step2 == NULL) { + if (step2 == nullptr) { env->ThrowNew(testBugClass, "step2 field is null"); return; } GET_OBJ_FIELD(step3, o, nativeLockerClass, "step3", "Lnsk/share/Wicket;"); - if (step3 == NULL) { + if (step3 == nullptr) { env->ThrowNew(testBugClass, "step3 field is null"); return; } GET_OBJ_FIELD(inner, o, lockerClass, "inner", "Lnsk/monitoring/share/thread/Deadlock$Locker;"); if (env->MonitorEnter(lock) == JNI_OK) { - if (inner == NULL) { + if (inner == nullptr) { env->ThrowNew(testBugClass, "Should not reach here"); } else { CALL_VOID_NOPARAM(step1, wicketClass, "unlock"); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/LockingThreads.cpp b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/LockingThreads.cpp index c8870989fa6e..0b208187d978 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/LockingThreads.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/LockingThreads.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,18 +21,18 @@ * questions. */ #include -#include "jni_tools.h" +#include "jni_tools.hpp" extern "C" { #define FIND_CLASS(_class, _className)\ if (!NSK_JNI_VERIFY(env, (_class = \ - env->FindClass(_className)) != NULL))\ + env->FindClass(_className)) != nullptr))\ return #define GET_OBJECT_CLASS(_class, _obj)\ if (!NSK_JNI_VERIFY(env, (_class = \ - env->GetObjectClass(_obj)) != NULL))\ + env->GetObjectClass(_obj)) != nullptr))\ return #define GET_OBJ_FIELD(_value, _obj, _class, _fieldName, _fieldSig)\ @@ -41,12 +41,12 @@ extern "C" { #define GET_FIELD_ID(_fieldID, _class, _fieldName, _fieldSig)\ if (!NSK_JNI_VERIFY(env, (_fieldID = \ - env->GetFieldID(_class, _fieldName, _fieldSig)) != NULL))\ + env->GetFieldID(_class, _fieldName, _fieldSig)) != nullptr))\ return #define GET_METHOD_ID(_methodID, _class, _methodName, _sig)\ if (!NSK_JNI_VERIFY(env, (_methodID = \ - env->GetMethodID(_class, _methodName, _sig)) != NULL))\ + env->GetMethodID(_class, _methodName, _sig)) != nullptr))\ return #define CALL_VOID_NOPARAM(_obj, _class, _methodName)\ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/RecursiveMonitoringThread.cpp b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/RecursiveMonitoringThread.cpp index d5349b037ffc..5c7a33519432 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/RecursiveMonitoringThread.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/monitoring/share/thread/RecursiveMonitoringThread.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, 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,23 +23,23 @@ #include #include -#include "jni_tools.h" +#include "jni_tools.hpp" extern "C" { #define FIND_CLASS(_class, _className)\ if (!NSK_JNI_VERIFY(env, (_class = \ - env->FindClass(_className)) != NULL))\ + env->FindClass(_className)) != nullptr))\ return #define GET_OBJECT_CLASS(_class, _obj)\ if (!NSK_JNI_VERIFY(env, (_class = \ - env->GetObjectClass(_obj)) != NULL))\ + env->GetObjectClass(_obj)) != nullptr))\ return #define GET_STATIC_FIELD_ID(_fieldID, _class, _fieldName, _fieldSig)\ if (!NSK_JNI_VERIFY(env, (_fieldID = \ - env->GetStaticFieldID(_class, _fieldName, _fieldSig)) != NULL))\ + env->GetStaticFieldID(_class, _fieldName, _fieldSig)) != nullptr))\ return #define GET_STATIC_OBJ_FIELD(_value, _class, _fieldName, _fieldSig)\ @@ -52,7 +52,7 @@ extern "C" { #define GET_FIELD_ID(_fieldID, _class, _fieldName, _fieldSig)\ if (!NSK_JNI_VERIFY(env, (_fieldID = \ - env->GetFieldID(_class, _fieldName, _fieldSig)) != NULL))\ + env->GetFieldID(_class, _fieldName, _fieldSig)) != nullptr))\ return #define GET_INT_FIELD(_value, _obj, _class, _fieldName)\ @@ -84,12 +84,12 @@ extern "C" { #define GET_STATIC_METHOD_ID(_methodID, _class, _methodName, _sig)\ if (!NSK_JNI_VERIFY(env, (_methodID = \ - env->GetStaticMethodID(_class, _methodName, _sig)) != NULL))\ + env->GetStaticMethodID(_class, _methodName, _sig)) != nullptr))\ return #define GET_METHOD_ID(_methodID, _class, _methodName, _sig)\ if (!NSK_JNI_VERIFY(env, (_methodID = \ - env->GetMethodID(_class, _methodName, _sig)) != NULL))\ + env->GetMethodID(_class, _methodName, _sig)) != nullptr))\ return #define CALL_STATIC_VOID_NOPARAM(_class, _methodName)\ @@ -124,7 +124,7 @@ extern "C" { #define NEW_OBJ(_obj, _class, _constructorName, _sig, _params)\ GET_METHOD_ID(method, _class, _constructorName, _sig);\ if (!NSK_JNI_VERIFY(env, (_obj = \ - env->NewObject(_class, method, _params)) != NULL))\ + env->NewObject(_class, method, _params)) != nullptr))\ return #define MONITOR_ENTER(x) \ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/ExceptionCheckingJniEnv/exceptionjni001/exceptionjni001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/ExceptionCheckingJniEnv/exceptionjni001/exceptionjni001.cpp index 342ef4d2ccde..1c70c90388e1 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/ExceptionCheckingJniEnv/exceptionjni001/exceptionjni001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/ExceptionCheckingJniEnv/exceptionjni001/exceptionjni001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018, 2019, Google and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -33,9 +33,9 @@ // methods. static bool is_error_called; static const char* const null_return_expected_message_start = - "JNI method GetFieldID : Return is NULL from exceptionjni001.cpp : "; + "JNI method GetFieldID : Return is null from exceptionjni001.cpp : "; static const char* const null_file_expected_message_start = - "JNI method GetFieldID : Return is NULL from Unknown File : "; + "JNI method GetFieldID : Return is null from Unknown File : "; // Used by the ErrorCheckerMessage and the tests to determine test success. static long expected_line_number; @@ -52,11 +52,11 @@ static bool CheckMessage(JNIEnv* env, const char* message, const char* expected_ size_t len = strlen(expected_message); - char* end_ptr = NULL; + char* end_ptr = nullptr; long actual_line = strtol(message + len, &end_ptr, 0); - if (end_ptr == NULL || *end_ptr != '\0') { - fprintf(stderr, "end_ptr == NULL or *end_ptr terminating from %s\n", message); + if (end_ptr == nullptr || *end_ptr != '\0') { + fprintf(stderr, "end_ptr == null or *end_ptr terminating from %s\n", message); return false; } @@ -101,7 +101,7 @@ static bool checkFailureMessageEmptyFile(JNIEnv* env, jclass cls) { expected_message_start = null_file_expected_message_start; expected_line_number = __LINE__ + 1; - ec_jni->GetFieldID(cls, "whatever", "does not matter", __LINE__, NULL); + ec_jni->GetFieldID(cls, "whatever", "does not matter", __LINE__, nullptr); return is_error_called && error_message_ok; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/Finalizable.java b/test/hotspot/jtreg/vmTestbase/nsk/share/Finalizable.java deleted file mode 100644 index b515721e925f..000000000000 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/Finalizable.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * Copyright (c) 2001, 2023, 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 nsk.share; -import java.lang.ref.Cleaner; - -/** - * Finalizable interface allows Finalizer to perform finalization of an object. - * Each object that requires finalization at VM shutdown time should implement this - * interface and call the registerCleanup to activate a Finalizer hook. - * - * @see Finalizer - */ -public interface Finalizable { - - /** - * This method will be implemented by FinalizableObject and is called in finalizeAtExit. - * - * @see Finalizer - */ - public void cleanup(); - - /** - * This method will be invoked by Finalizer when virtual machine - * shuts down. - * - * @throws Throwable if any throwable exception thrown during finalization - */ - default public void finalizeAtExit() throws Throwable { - cleanup(); - } - - /** - * This method will register a cleanup method and create an instance of Finalizer - * to register the object for finalization at VM exit. - * - * @see Finalizer - */ - default public void registerCleanup() { - Finalizer finalizer = new Finalizer(this); - finalizer.activate(); - - Cleaner.create().register(this, () -> cleanup()); - } -} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/Finalizer.java b/test/hotspot/jtreg/vmTestbase/nsk/share/Finalizer.java deleted file mode 100644 index 1d274c54b2ac..000000000000 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/Finalizer.java +++ /dev/null @@ -1,133 +0,0 @@ -/* - * Copyright (c) 2001, 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 nsk.share; - -import java.util.Stack; - -/** - * Finalizer performs object finalization when virtual mashine shuts down. - * Finalizer is a thread that acts as a VM shutdown hook. - * This thread will be activated as VM shuts down because of - * invocation of exit() or termination. After activation - * Finalizer just calls finalizeAtExit() method of the specified object. - * The finalizable object should implement interface Finalizable. - * - * @see Finalizable - */ -public class Finalizer { - - /** Finalizer thread to register as a VM shutdown hook. */ - private static FinalizerThread finalizerThread = null; - - /** An object to finalize. */ - private Finalizable object; - - /** - * Create finalizer for the specified object. - */ - public Finalizer(Finalizable object) { - this.object = object; - } - - /** - * Register finalizer for finalization at VM shutdown. - */ - public void activate() { - if (finalizerThread == null) { - finalizerThread = new FinalizerThread("FinalizerThread for Finalizable objects"); - finalizerThread.activate(); - } - finalizerThread.add(object); - } - - /** - * Unregister finalizer for finalization at VM shutdown. - */ - public void deactivate() { - if (finalizerThread == null) - return; - finalizerThread.remove(object); - } - - /** - * Static inner thread that is registered as a VM shutdown hook - * and performs finalization of all registered finalizable objects. - */ - private static class FinalizerThread extends Thread { - - /** Stack of objects registered for finalization. */ - private Stack objects = new Stack(); - - /** Make new instance of FinalizerThread with given thread name. */ - public FinalizerThread(String threadName) { - super(threadName); - } - - /** - * Push an object to the stack of registered objects. - */ - public void add(Finalizable object) { - objects.push(object); - } - - /** - * Remove an object from the stack of registered objects. - */ - public void remove(Finalizable object) { - objects.remove(object); - } - - /** - * Register finalizer thread as a VM shutdown hook. - */ - public void activate() { - Runtime.getRuntime().addShutdownHook( this ); - } - - /** - * Unregister finalizer thread as a VM shutdown hook. - */ - public void deactivate() { - Runtime.getRuntime().removeShutdownHook( this ); - } - - /** - * Pop all registered objects from the stack and finalize them. - */ - public void run() { - while (!objects.empty()) { - Finalizable object = (Finalizable)objects.pop(); - try { - object.finalizeAtExit(); - } catch (ThreadDeath e) { - throw e; - } catch (Throwable ex) { - ex.printStackTrace(); - } - } - } - - } // end of FinalizerThread - -} // end of Finalizer diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/JVMTIagent.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/JVMTIagent.cpp index 69dc2da5b573..9c33f5c7797b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/JVMTIagent.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/JVMTIagent.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,14 +34,14 @@ #include #include -#include "nsk_tools.h" -#include "jni_tools.h" -#include "JVMTITools.h" -#include "jvmti_tools.h" +#include "nsk_tools.hpp" +#include "jni_tools.hpp" +#include "JVMTITools.hpp" +#include "jvmti_tools.hpp" extern "C" { -static jvmtiEnv *jvmti = NULL; /* JVMTI env */ +static jvmtiEnv *jvmti = nullptr; /* JVMTI env */ static jvmtiEventCallbacks callbacks; static jrawMonitorID eventLock; /* raw monitor used for exclusive ownership of HotSwap function */ @@ -106,9 +106,9 @@ typedef struct { /* test class info */ } class_info; -static const char *shortTestName = NULL; /* name of the test without package prefix */ +static const char *shortTestName = nullptr; /* name of the test without package prefix */ static jclass rasCls; /* reference to the auxiliary class RASagent used for HotSwap */ -static class_info *clsInfo = NULL, *clsInfoFst = NULL; +static class_info *clsInfo = nullptr, *clsInfoFst = nullptr; static void lock(JNIEnv*); static void unlock(JNIEnv*); @@ -160,11 +160,11 @@ ClassLoad(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jthread thread, jclass klass) { lock(jni_env); display(0, "#### JVMTIagent: ClassLoad: >>>>>>>> entered the raw monitor \"eventLock\" ####\n"); - if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &cls_sig, /*&generic*/NULL))) + if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &cls_sig, /*&generic*/nullptr))) jni_env->FatalError("JVMTIagent: failed to get class signature\n"); else { - if (shortTestName != NULL) { - if (strstr((const char*) cls_sig, shortTestName) != NULL) { + if (shortTestName != nullptr) { + if (strstr((const char*) cls_sig, shortTestName) != nullptr) { display(0, "#### JVMTIagent: found test class matched with \"%s\"\n" "\tsignature=%s\n", @@ -198,7 +198,7 @@ CompiledMethodLoad(jvmtiEnv *jvmti_env, jmethodID method, jint code_size, display(1, "#### JVMTIagent: CompiledMethodLoad occurred ####\n"); - getVerdict(NULL, "CompiledMethodLoad"); + getVerdict(nullptr, "CompiledMethodLoad"); } void JNICALL @@ -207,7 +207,7 @@ CompiledMethodUnload(jvmtiEnv *jvmti_env, jmethodID method, display(1, "#### JVMTIagent: CompiledMethodUnload occurred ####\n"); - getVerdict(NULL, "CompiledMethodUnload"); + getVerdict(nullptr, "CompiledMethodUnload"); } void JNICALL @@ -215,7 +215,7 @@ DataDumpRequest(jvmtiEnv *jvmti_env) { display(1, "#### JVMTIagent: DataDumpRequest occurred ####\n"); - getVerdict(NULL, "DataDumpRequest"); + getVerdict(nullptr, "DataDumpRequest"); } void JNICALL @@ -226,7 +226,7 @@ DynamicCodeGenerated(jvmtiEnv *jvmti_env, display(1, "#### JVMTIagent: DynamicCodeGenerated occurred ####\n"); - getVerdict(NULL, "DynamicCodeGenerated"); + getVerdict(nullptr, "DynamicCodeGenerated"); } void JNICALL @@ -286,7 +286,7 @@ GarbageCollectionFinish(jvmtiEnv *jvmti_env) { display(1, "#### JVMTIagent: GarbageCollectionFinish occurred ####\n"); - getVerdict(NULL, "GarbageCollectionFinish"); + getVerdict(nullptr, "GarbageCollectionFinish"); } void JNICALL @@ -294,7 +294,7 @@ GarbageCollectionStart(jvmtiEnv *jvmti_env) { display(1, "#### JVMTIagent: GarbageCollectionStart occurred ####\n"); - getVerdict(NULL, "GarbageCollectionStart"); + getVerdict(nullptr, "GarbageCollectionStart"); } void JNICALL @@ -347,7 +347,7 @@ ObjectFree(jvmtiEnv *jvmti_env, jlong tag) { display(1, "#### JVMTIagent: ObjectFree occurred ####\n"); - getVerdict(NULL, "ObjectFree"); + getVerdict(nullptr, "ObjectFree"); } void JNICALL @@ -489,10 +489,10 @@ JNIEXPORT jint JNICALL Java_nsk_share_RASagent_setHotSwapMode(JNIEnv *jni_env, jclass cls, jboolean vrb, jint level, jstring shortName) { jvmtiCapabilities capabil; - jmethodID mid = NULL; + jmethodID mid = nullptr; - if (jvmti == NULL) { - printf("ERROR(%s,%d): JVMTIagent was not properly loaded: JVMTI env = NULL\n", + if (jvmti == nullptr) { + printf("ERROR(%s,%d): JVMTIagent was not properly loaded: JVMTI env = null\n", __FILE__, __LINE__); return 1; } @@ -554,14 +554,14 @@ Java_nsk_share_RASagent_setHotSwapMode(JNIEnv *jni_env, jclass cls, return 1; } - if (!NSK_JNI_VERIFY(jni_env, (shortTestName = jni_env->GetStringUTFChars(shortName, NULL)) != NULL)) { + if (!NSK_JNI_VERIFY(jni_env, (shortTestName = jni_env->GetStringUTFChars(shortName, nullptr)) != nullptr)) { printf("ERROR: JVMTIagent: unable to get UTF-8 characters of the string\n"); return 1; } display(0, "#### JVMTIagent: short name of current test is \"%s\"\n", shortTestName); - if (!NSK_JNI_VERIFY(jni_env, (rasCls = jni_env->NewGlobalRef(cls)) != NULL)) { + if (!NSK_JNI_VERIFY(jni_env, (rasCls = jni_env->NewGlobalRef(cls)) != nullptr)) { printf("ERROR JVMTIagent: unable to create a new global reference of the class \"RASagent\"\n"); return 1; } @@ -576,19 +576,19 @@ Java_nsk_share_RASagent_setHotSwapMode(JNIEnv *jni_env, jclass cls, } static jint allocClsInfo(JNIEnv *jni_env, char *cls_sig, jclass clazz) { - class_info *_clsInfo = NULL; - jmethodID mid = NULL; + class_info *_clsInfo = nullptr; + jmethodID mid = nullptr; jbyteArray classBytes; jboolean isCopy; _clsInfo = (class_info*) malloc(sizeof(class_info)); - if (_clsInfo == NULL) + if (_clsInfo == nullptr) jni_env->FatalError("JVMTIagent: cannot allocate memory for class_info\n"); /* fill the structure class_info */ _clsInfo->clazzsig = cls_sig; - if (!NSK_JNI_VERIFY(jni_env, ((*_clsInfo).cls = jni_env->NewGlobalRef(clazz)) != NULL)) { + if (!NSK_JNI_VERIFY(jni_env, ((*_clsInfo).cls = jni_env->NewGlobalRef(clazz)) != nullptr)) { printf("ERROR: JVMTIagent: unable to create a new global reference of class \"%s\"\n", _clsInfo->clazzsig); free(_clsInfo); @@ -597,7 +597,7 @@ static jint allocClsInfo(JNIEnv *jni_env, char *cls_sig, jclass clazz) { } if (!NSK_JNI_VERIFY(jni_env, (mid = - jni_env->GetStaticMethodID(rasCls, "loadFromClassFile", "(Ljava/lang/String;)[B")) != NULL)) + jni_env->GetStaticMethodID(rasCls, "loadFromClassFile", "(Ljava/lang/String;)[B")) != nullptr)) jni_env->FatalError("JVMTIagent: unable to get ID of the method \"loadFromClassFile\"\n"); classBytes = (jbyteArray) jni_env->CallStaticObjectMethod(rasCls, mid, jni_env->NewStringUTF(cls_sig)); @@ -609,9 +609,9 @@ static jint allocClsInfo(JNIEnv *jni_env, char *cls_sig, jclass clazz) { (*_clsInfo).clsBytes = jni_env->GetByteArrayElements(classBytes, &isCopy); - _clsInfo->next = NULL; + _clsInfo->next = nullptr; - if (clsInfo != NULL) { + if (clsInfo != nullptr) { clsInfo->next = (struct class_info*) _clsInfo; } else { @@ -627,7 +627,7 @@ static void deallocClsInfo(JNIEnv *jni_env) { NSK_TRACE(jni_env->DeleteGlobalRef(rasCls)); - while (clsInfoCurr != NULL) { + while (clsInfoCurr != nullptr) { class_info *_clsInfo = clsInfoCurr; if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*) clsInfoCurr->clazzsig))) @@ -640,16 +640,16 @@ static void deallocClsInfo(JNIEnv *jni_env) { free(_clsInfo); } /* fix for 4756585: indicate that stucture class_info is empty now */ - clsInfoFst = NULL; + clsInfoFst = nullptr; } static int findAndHotSwap(JNIEnv *jni_env, jclass clazz) { int ret_code = 0; - char *clazzsig = NULL; + char *clazzsig = nullptr; class_info *clsInfoCurr = clsInfoFst; display(1, "\n#### JVMTIagent: findAndHotSwap: obtaining class signature of class to be hotswap ...\n"); - if (!NSK_JVMTI_VERIFY(jvmti->GetClassSignature(clazz, &clazzsig, /*&generic*/NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->GetClassSignature(clazz, &clazzsig, /*&generic*/nullptr))) jni_env->FatalError("JVMTIagent: findAndHotSwap: failed to get class signature\n"); else { display(1, "#### JVMTIagent: findAndHotSwap: ... class signature obtained: \"%s\"\n", @@ -659,7 +659,7 @@ static int findAndHotSwap(JNIEnv *jni_env, jclass clazz) { lock(jni_env); display(0, "#### JVMTIagent: findAndHotSwap: >>>>>>>> entered the raw monitor \"eventLock\" ####\n"); - while (clsInfoCurr != NULL) { + while (clsInfoCurr != nullptr) { if (hotswap == HOTSWAP_EVERY_METHOD_ENTRY_FOR_EVERY_CLASS || hotswap == HOTSWAP_EVERY_EXCEPTION_FOR_EVERY_CLASS) { display(1, "\n#### JVMTIagent: findAndHotSwap: going to hotswap tested class \"%s\" during execution of class \"%s\" ...\n", @@ -735,7 +735,7 @@ static int addStressEvents() { callbacks.SingleStep = &SingleStep; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_SINGLE_STEP, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_SINGLE_STEP, nullptr))) return JNI_ERR; stepEventSet = JNI_TRUE; @@ -751,7 +751,7 @@ static int addStressEvents() { callbacks.MethodEntry = &MethodEntry; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_ENTRY, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_ENTRY, nullptr))) return JNI_ERR; display(0, "#### JVMTIagent: ... setting MethodEntry events done\n"); @@ -761,7 +761,7 @@ static int addStressEvents() { callbacks.MethodExit = &MethodExit; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_EXIT, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_EXIT, nullptr))) return JNI_ERR; display(0, "#### JVMTIagent: ... setting MethodExit events done\n"); @@ -777,7 +777,7 @@ static int addStressEvents() { callbacks.ExceptionCatch = &ExceptionCatch; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_EXCEPTION_CATCH, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_EXCEPTION_CATCH, nullptr))) return JNI_ERR; excCatchEventSet = JNI_TRUE; @@ -822,7 +822,7 @@ static int enableEventsCaps() { callbacks.Breakpoint = &Breakpoint; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, nullptr))) return JNI_ERR; display(0, "#### JVMTIagent: ... setting Breakpoint events done\n"); @@ -831,7 +831,7 @@ static int enableEventsCaps() { callbacks.ClassFileLoadHook = &ClassFileLoadHook; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, nullptr))) return JNI_ERR; display(0, "#### JVMTIagent: ... setting ClassFileLoadHook events done\n"); @@ -840,7 +840,7 @@ static int enableEventsCaps() { callbacks.ClassLoad = &ClassLoad; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, nullptr))) return JNI_ERR; display(0, "#### JVMTIagent: ... setting ClassLoad events done\n"); @@ -849,7 +849,7 @@ static int enableEventsCaps() { callbacks.ClassPrepare = &ClassPrepare; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_PREPARE, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_PREPARE, nullptr))) return JNI_ERR; display(0, "#### JVMTIagent: ... setting ClassPrepare events done\n"); @@ -858,7 +858,7 @@ static int enableEventsCaps() { callbacks.CompiledMethodLoad = &CompiledMethodLoad; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, nullptr))) return JNI_ERR; display(0, "#### JVMTIagent: ... setting CompiledMethodLoad events done\n"); @@ -867,7 +867,7 @@ static int enableEventsCaps() { callbacks.CompiledMethodUnload = &CompiledMethodUnload; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_UNLOAD, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_UNLOAD, nullptr))) return JNI_ERR; display(0, "#### JVMTIagent: ... setting CompiledMethodUnload events done\n"); @@ -876,7 +876,7 @@ static int enableEventsCaps() { callbacks.DataDumpRequest = &DataDumpRequest; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_DATA_DUMP_REQUEST, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_DATA_DUMP_REQUEST, nullptr))) return JNI_ERR; display(0, "#### JVMTIagent: ... setting DataDumpRequest events done\n"); @@ -885,7 +885,7 @@ static int enableEventsCaps() { callbacks.DynamicCodeGenerated = &DynamicCodeGenerated; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_DYNAMIC_CODE_GENERATED, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_DYNAMIC_CODE_GENERATED, nullptr))) return JNI_ERR; display(0, "#### JVMTIagent: ... setting DynamicCodeGenerated events done\n"); @@ -894,7 +894,7 @@ static int enableEventsCaps() { callbacks.Exception = &Exception; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_EXCEPTION, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_EXCEPTION, nullptr))) return JNI_ERR; display(0, "#### JVMTIagent: ... setting Exception events done\n"); @@ -903,7 +903,7 @@ static int enableEventsCaps() { callbacks.FieldAccess = &FieldAccess; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FIELD_ACCESS, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FIELD_ACCESS, nullptr))) return JNI_ERR; display(0, "#### JVMTIagent: ... setting FieldAccess events done\n"); @@ -912,7 +912,7 @@ static int enableEventsCaps() { callbacks.FieldModification = &FieldModification; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FIELD_MODIFICATION, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FIELD_MODIFICATION, nullptr))) return JNI_ERR; display(0, "#### JVMTIagent: ... setting FieldModification events done\n"); @@ -921,7 +921,7 @@ static int enableEventsCaps() { callbacks.FramePop = &FramePop; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FRAME_POP, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FRAME_POP, nullptr))) return JNI_ERR; display(0, "#### JVMTIagent: ... setting FramePop events done\n"); @@ -930,7 +930,7 @@ static int enableEventsCaps() { callbacks.GarbageCollectionFinish = &GarbageCollectionFinish; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_FINISH, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_FINISH, nullptr))) return JNI_ERR; display(0, "#### JVMTIagent: ... setting GarbageCollectionFinish events done\n"); @@ -939,7 +939,7 @@ static int enableEventsCaps() { callbacks.GarbageCollectionStart = &GarbageCollectionStart; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_START, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_GARBAGE_COLLECTION_START, nullptr))) return JNI_ERR; display(0, "#### JVMTIagent: ... setting GarbageCollectionStart events done\n"); @@ -948,7 +948,7 @@ static int enableEventsCaps() { callbacks.MonitorContendedEnter = &MonitorContendedEnter; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTER, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTER, nullptr))) return JNI_ERR; display(0, "#### JVMTIagent: ... setting MonitorContendedEnter events done\n"); @@ -957,7 +957,7 @@ static int enableEventsCaps() { callbacks.MonitorContendedEntered = &MonitorContendedEntered; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTERED, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_CONTENDED_ENTERED, nullptr))) return JNI_ERR; display(0, "#### JVMTIagent: ... setting MonitorContendedEntered events done\n"); @@ -966,7 +966,7 @@ static int enableEventsCaps() { callbacks.MonitorWait = &MonitorWait; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAIT, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAIT, nullptr))) return JNI_ERR; display(0, "#### JVMTIagent: ... setting MonitorWait events done\n"); @@ -975,7 +975,7 @@ static int enableEventsCaps() { callbacks.MonitorWaited = &MonitorWaited; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAITED, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_MONITOR_WAITED, nullptr))) return JNI_ERR; display(0, "#### JVMTIagent: ... setting MonitorWaited events done\n"); @@ -984,7 +984,7 @@ static int enableEventsCaps() { callbacks.NativeMethodBind = &NativeMethodBind; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_NATIVE_METHOD_BIND, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_NATIVE_METHOD_BIND, nullptr))) return JNI_ERR; display(0, "#### JVMTIagent: ... setting NativeMethodBind events done\n"); @@ -993,7 +993,7 @@ static int enableEventsCaps() { callbacks.ObjectFree = &ObjectFree; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, nullptr))) return JNI_ERR; display(0, "#### JVMTIagent: ... setting ObjectFree events done\n"); @@ -1002,7 +1002,7 @@ static int enableEventsCaps() { callbacks.ThreadEnd = &ThreadEnd; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_END, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_END, nullptr))) return JNI_ERR; display(0, "#### JVMTIagent: ... setting ThreadEnd events done\n"); @@ -1011,7 +1011,7 @@ static int enableEventsCaps() { callbacks.ThreadStart = &ThreadStart; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, nullptr))) return JNI_ERR; display(0, "#### JVMTIagent: ... setting ThreadStart events done\n"); @@ -1020,7 +1020,7 @@ static int enableEventsCaps() { callbacks.VMDeath = &VMDeath; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, nullptr))) return JNI_ERR; display(0, "#### JVMTIagent: ... setting VMDeath events done\n"); @@ -1029,7 +1029,7 @@ static int enableEventsCaps() { callbacks.VMInit = &VMInit; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, nullptr))) return JNI_ERR; display(0, "#### JVMTIagent: ... setting VMInit events done\n"); @@ -1038,7 +1038,7 @@ static int enableEventsCaps() { callbacks.VMStart = &VMStart; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_START, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_START, nullptr))) return JNI_ERR; display(0, "#### JVMTIagent: ... setting VMStart events done\n"); @@ -1047,7 +1047,7 @@ static int enableEventsCaps() { callbacks.VMObjectAlloc = &VMObjectAlloc; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_OBJECT_ALLOC, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_OBJECT_ALLOC, nullptr))) return JNI_ERR; display(0, "#### JVMTIagent: ... setting VMObjectAlloc events done\n"); @@ -1153,7 +1153,7 @@ static void getVerdict(JNIEnv *jni_env, const char *evnt) { snprintf(error_msg, sizeof(error_msg), "JVMTIagent: getVerdict: %s event occured after VMDeath", evnt); - if (jni_env == NULL) { /* some event callbacks have no pointer to jni */ + if (jni_env == nullptr) { /* some event callbacks have no pointer to jni */ printf("ERROR: %s\n", error_msg); exit(97); } @@ -1181,7 +1181,7 @@ JNIEXPORT jint JNICALL Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; doSetup(options); @@ -1198,7 +1198,7 @@ Agent_OnLoad(JavaVM *jvm, char *options, void *reserved) { } /* register agent proc and arg */ - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/MainWrapper.java b/test/hotspot/jtreg/vmTestbase/nsk/share/MainWrapper.java index b84c975ffaaf..784cbd7c9c9d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/MainWrapper.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/MainWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2024, 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 @@ -41,11 +41,6 @@ public static void main(String[] args) throws Throwable { String[] classArgs = new String[args.length - 2]; System.arraycopy(args, 2, classArgs, 0, args.length - 2); - // It is needed to register finalizer thread in default thread group - // So FinalizerThread thread can't be in virtual threads group - FinalizableObject finalizableObject = new FinalizableObject(); - finalizableObject.registerCleanup(); - // Some tests use this property to understand if virtual threads are used System.setProperty("test.thread.factory", wrapperName); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/aod/DummyTargetApplication.java b/test/hotspot/jtreg/vmTestbase/nsk/share/aod/DummyTargetApplication.java index f9df029349a0..c8fb3bf26632 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/aod/DummyTargetApplication.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/aod/DummyTargetApplication.java @@ -54,17 +54,23 @@ protected void targetApplicationActions() { } public void runTargetApplication() { - pipe = SocketIOPipe.createClientIOPipe(log, argParser.getPort(), 0); - log.display("Sending signal '" + AODTestRunner.SIGNAL_READY_FOR_ATTACH + "'"); - pipe.println(AODTestRunner.SIGNAL_READY_FOR_ATTACH); + try { + pipe = SocketIOPipe.createClientIOPipe(log, argParser.getPort(), 0); + log.display("Sending signal '" + AODTestRunner.SIGNAL_READY_FOR_ATTACH + "'"); + pipe.println(AODTestRunner.SIGNAL_READY_FOR_ATTACH); - targetApplicationActions(); + targetApplicationActions(); - String signal = pipe.readln(); - log.display("Signal received: '" + signal + "'"); + String signal = pipe.readln(); + log.display("Signal received: '" + signal + "'"); - if ((signal == null) || !signal.equals(AODTestRunner.SIGNAL_FINISH)) - throw new TestBug("Unexpected signal: '" + signal + "'"); + if ((signal == null) || !signal.equals(AODTestRunner.SIGNAL_FINISH)) + throw new TestBug("Unexpected signal: '" + signal + "'"); + } finally { + if (pipe != null) { + pipe.close(); + } + } } public static void main(String[] args) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/aod/aod.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/aod/aod.cpp index 4219ad9a0f4b..7f622c24f75c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/aod/aod.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/aod/aod.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2024, 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,9 +23,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include extern "C" { @@ -44,13 +44,13 @@ void nsk_aod_internal_error() { } void nsk_free_options(Options* options) { - if (options != NULL) { + if (options != nullptr) { int i; for (i = 0; i < NSK_AOD_MAX_OPTIONS; i++) { - if (options->names[i] != NULL) { + if (options->names[i] != nullptr) { free(options->names[i]); } - if (options->values[i] != NULL) { + if (options->values[i] != nullptr) { free(options->values[i]); } } @@ -71,20 +71,20 @@ static Options* nsk_aod_createOptionsObject(char* optionsString) { char* value; char* sep; - if (optionsString == NULL) { + if (optionsString == nullptr) { NSK_COMPLAIN0("options were not passed to the native agent\n"); - return NULL; + return nullptr; } options = (Options*) malloc(sizeof(Options)); memset(options, 0, sizeof(Options)); options->size = 0; name = optionsString; - while (name != NULL && i < NSK_AOD_MAX_OPTIONS) { + while (name != nullptr && i < NSK_AOD_MAX_OPTIONS) { sep = strchr(name, '='); - if (sep == NULL) { // name not found + if (sep == nullptr) { // name not found NSK_COMPLAIN1("Invalid options format: '%s'\n", optionsString); nsk_free_options(options); - return NULL; + return nullptr; } *sep = '\0'; options->names[i] = strdup(name); @@ -92,10 +92,10 @@ static Options* nsk_aod_createOptionsObject(char* optionsString) { if (*value == '\0') { // value not found NSK_COMPLAIN1("Option '%s' is empty\n", options->names[i]); nsk_free_options(options); - return NULL; + return nullptr; } sep = strchr(value, ' '); - if (sep != NULL) { + if (sep != nullptr) { *sep = '\0'; name = sep + 1; } else { @@ -105,10 +105,10 @@ static Options* nsk_aod_createOptionsObject(char* optionsString) { i++; if (*name == '\0') { - name = NULL; + name = nullptr; } } - if (name != NULL) { + if (name != nullptr) { NSK_COMPLAIN1("WARNING: not all options were parsed, only %d options can be specified\n", NSK_AOD_MAX_OPTIONS); } @@ -119,12 +119,12 @@ static Options* nsk_aod_createOptionsObject(char* optionsString) { Options* nsk_aod_createOptions(char* optionsString) { Options* options; - if (!NSK_VERIFY((options = (Options*) nsk_aod_createOptionsObject(optionsString)) != NULL)) - return NULL; + if (!NSK_VERIFY((options = (Options*) nsk_aod_createOptionsObject(optionsString)) != nullptr)) + return nullptr; if (!NSK_VERIFY(nsk_aod_optionSpecified(options, NSK_AOD_AGENT_NAME_OPTION))) { NSK_COMPLAIN0("Agent name wasn't specified\n"); - return NULL; + return nullptr; } /* @@ -143,9 +143,9 @@ Options* nsk_aod_createOptions(char* optionsString) { const char* nsk_aod_getOptionValue(Options* options, const char* option) { int i; - if (!NSK_VERIFY(options != NULL)) { - NSK_COMPLAIN0("Options NULL\n"); - return NULL; + if (!NSK_VERIFY(options != nullptr)) { + NSK_COMPLAIN0("Options null\n"); + return nullptr; } for (i = 0; i < options->size; i++) { @@ -156,14 +156,14 @@ const char* nsk_aod_getOptionValue(Options* options, const char* option) { NSK_COMPLAIN1("Option '%s' isn't defined\n", option); - return NULL; + return nullptr; } int nsk_aod_optionSpecified(Options* options, const char* option) { int i; - if (!NSK_VERIFY(options != NULL)) { - NSK_COMPLAIN0("Options NULL\n"); + if (!NSK_VERIFY(options != nullptr)) { + NSK_COMPLAIN0("Options null\n"); return NSK_FALSE; } @@ -188,9 +188,9 @@ static const char* AGENT_LOADED_METHOD_SIGNATURE = "(Ljava/lang/String;)V"; static const char* AGENT_FINISHED_METHOD_NAME = "agentFinished"; static const char* AGENT_FINISHED_METHOD_SIGNATURE = "(Ljava/lang/String;Z)V"; -static jclass targetAppClass = NULL; -static jmethodID agentLoadedMethod = NULL; -static jmethodID agentFinishedMethod = NULL; +static jclass targetAppClass = nullptr; +static jmethodID agentLoadedMethod = nullptr; +static jmethodID agentFinishedMethod = nullptr; // this function is used to notify target application that native agent has been loaded int nsk_aod_agentLoaded(JNIEnv* jni, const char* agentName) { @@ -198,31 +198,31 @@ int nsk_aod_agentLoaded(JNIEnv* jni, const char* agentName) { NSK_DISPLAY1("Agent %s is loaded\n", agentName); - if (targetAppClass == NULL) { + if (targetAppClass == nullptr) { /* * FindClass returns local reference, to cache reference to target application class * global reference should be created */ jclass localTargetAppClass; if (!NSK_JNI_VERIFY(jni, (localTargetAppClass = - jni->FindClass(TARGET_APP_CLASS_NAME)) != NULL)) { + jni->FindClass(TARGET_APP_CLASS_NAME)) != nullptr)) { return NSK_FALSE; } if (!NSK_JNI_VERIFY(jni, (targetAppClass = (jclass) - jni->NewGlobalRef(localTargetAppClass)) != NULL)) { + jni->NewGlobalRef(localTargetAppClass)) != nullptr)) { return NSK_FALSE; } } - if (agentLoadedMethod == NULL) { + if (agentLoadedMethod == nullptr) { if (!NSK_JNI_VERIFY(jni, (agentLoadedMethod = - jni->GetStaticMethodID(targetAppClass, AGENT_LOADED_METHOD_NAME, AGENT_LOADED_METHOD_SIGNATURE)) != NULL)) + jni->GetStaticMethodID(targetAppClass, AGENT_LOADED_METHOD_NAME, AGENT_LOADED_METHOD_SIGNATURE)) != nullptr)) return NSK_FALSE; } if (!NSK_JNI_VERIFY(jni, (agentNameString = - jni->NewStringUTF(agentName)) != NULL)) + jni->NewStringUTF(agentName)) != nullptr)) return NSK_FALSE; jni->CallStaticVoidMethod(targetAppClass, agentLoadedMethod, agentNameString); @@ -252,13 +252,13 @@ int nsk_aod_agentFinished(JNIEnv* jni, const char* agentName, int success) { NSK_DISPLAY2("Agent %s finished (success: %d)\n", agentName, success); - if (agentFinishedMethod == NULL) { + if (agentFinishedMethod == nullptr) { if (!NSK_JNI_VERIFY(jni, (agentFinishedMethod = - jni->GetStaticMethodID(targetAppClass, AGENT_FINISHED_METHOD_NAME, AGENT_FINISHED_METHOD_SIGNATURE)) != NULL)) + jni->GetStaticMethodID(targetAppClass, AGENT_FINISHED_METHOD_NAME, AGENT_FINISHED_METHOD_SIGNATURE)) != nullptr)) return NSK_FALSE; } - if (!NSK_JNI_VERIFY(jni, (agentNameString = jni->NewStringUTF(agentName)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (agentNameString = jni->NewStringUTF(agentName)) != nullptr)) return NSK_FALSE; jni->CallStaticVoidMethod(targetAppClass, agentFinishedMethod, agentNameString, success ? JNI_TRUE : JNI_FALSE); @@ -276,7 +276,7 @@ JNIEnv* nsk_aod_createJNIEnv(JavaVM* vm) { JNIEnv* jni; vm->GetEnv((void**)&jni, JNI_VERSION_1_2); - NSK_VERIFY(jni != NULL); + NSK_VERIFY(jni != nullptr); return jni; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/aod/aod.h b/test/hotspot/jtreg/vmTestbase/nsk/share/aod/aod.hpp similarity index 91% rename from test/hotspot/jtreg/vmTestbase/nsk/share/aod/aod.h rename to test/hotspot/jtreg/vmTestbase/nsk/share/aod/aod.hpp index 335720c01b63..f56b0eba757a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/aod/aod.h +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/aod/aod.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2024, 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,12 +20,12 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -#ifndef NSK_SHARE_AOD_H -#define NSK_SHARE_AOD_H +#ifndef NSK_SHARE_AOD_HPP +#define NSK_SHARE_AOD_HPP #include -#include -#include +#include +#include extern "C" { @@ -76,4 +76,4 @@ JNIEnv* nsk_aod_createJNIEnv(JavaVM* vm); } -#endif /* END OF NSK_SHARE_AOD_H */ +#endif /* END OF NSK_SHARE_AOD_HPP */ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/Memory.java b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/Memory.java index f5c70671e5e1..244bcf423c5b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/Memory.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/Memory.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2024, 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 @@ -150,12 +150,9 @@ public static int getReferenceObjectSize() { * @return length of array */ public static int getArrayLength(long memory, long objectSize) { - int referenceSize = getReferenceSize(); int arrayExtraSize = getArrayExtraSize(); - return (int) Math.min( - (memory - arrayExtraSize) / (objectSize + referenceSize), - Integer.MAX_VALUE - ); + return (int) Math.min((memory - arrayExtraSize) / objectSize, + Integer.MAX_VALUE); } /** @@ -166,7 +163,7 @@ public static int getArrayLength(long memory, long objectSize) { * @return size of array */ public static long getArraySize(int length, long objectSize) { - return getObjectExtraSize() + length * (objectSize + getReferenceSize()); + return getArrayExtraSize() + length * objectSize; } /** diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/BooleanArrayCriticalLocker.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/BooleanArrayCriticalLocker.cpp index a64f108222f9..5b3978fe7684 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/BooleanArrayCriticalLocker.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/BooleanArrayCriticalLocker.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,11 +24,11 @@ #include #include #include "ExceptionCheckingJniEnv.hpp" -#include "jni_tools.h" +#include "jni_tools.hpp" extern "C" { -static jfieldID objFieldId = NULL; +static jfieldID objFieldId = nullptr; /* * Class: nsk_share_gc_lock_jni_BooleanArrayCriticalLocker @@ -45,31 +45,31 @@ JNIEXPORT jboolean JNICALL Java_nsk_share_gc_lock_jni_BooleanArrayCriticalLocker jboolean hash = JNI_TRUE; time_t start_time, current_time; - if (objFieldId == NULL) { + if (objFieldId == nullptr) { jclass klass = ec_jni->GetObjectClass(o, TRACE_JNI_CALL); objFieldId = ec_jni->GetFieldID(klass, "obj", "Ljava/lang/Object;", TRACE_JNI_CALL); } arr = (jbooleanArray) ec_jni->GetObjectField(o, objFieldId, TRACE_JNI_CALL); - ec_jni->SetObjectField(o, objFieldId, NULL, TRACE_JNI_CALL); + ec_jni->SetObjectField(o, objFieldId, nullptr, TRACE_JNI_CALL); size = ec_jni->GetArrayLength(arr, TRACE_JNI_CALL); - start_time = time(NULL); + start_time = time(nullptr); enterTime /= 1000; current_time = 0; while (difftime(current_time, start_time) < enterTime) { hash = JNI_TRUE; - pa = (jboolean*) ec_jni->GetPrimitiveArrayCritical(arr, NULL, TRACE_JNI_CALL); - if (pa != NULL) { + pa = (jboolean*) ec_jni->GetPrimitiveArrayCritical(arr, nullptr, TRACE_JNI_CALL); + if (pa != nullptr) { for (i = 0; i < size; ++i) { hash ^= pa[i]; } } else { - jni_env->FatalError("GetPrimitiveArrayCritical returned NULL"); + jni_env->FatalError("GetPrimitiveArrayCritical returned null"); } mssleep((long) sleepTime); ec_jni->ReleasePrimitiveArrayCritical(arr, pa, 0, TRACE_JNI_CALL); mssleep((long) sleepTime); - current_time = time(NULL); + current_time = time(nullptr); } ec_jni->SetObjectField(o, objFieldId, arr, TRACE_JNI_CALL); return hash; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/ByteArrayCriticalLocker.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/ByteArrayCriticalLocker.cpp index ae13774efeef..fa11c9e79c90 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/ByteArrayCriticalLocker.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/ByteArrayCriticalLocker.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,11 +24,11 @@ #include #include #include "ExceptionCheckingJniEnv.hpp" -#include "jni_tools.h" +#include "jni_tools.hpp" extern "C" { -static jfieldID objFieldId = NULL; +static jfieldID objFieldId = nullptr; /* * Class: nsk_share_gc_lock_jni_ByteArrayCriticalLocker @@ -44,31 +44,31 @@ JNIEXPORT jbyte JNICALL Java_nsk_share_gc_lock_jni_ByteArrayCriticalLocker_criti jbyte hash = 0; time_t start_time, current_time; - if (objFieldId == NULL) { + if (objFieldId == nullptr) { jclass klass = ec_jni->GetObjectClass(o, TRACE_JNI_CALL); objFieldId = ec_jni->GetFieldID(klass, "obj", "Ljava/lang/Object;", TRACE_JNI_CALL); } arr = (jbyteArray) ec_jni->GetObjectField(o, objFieldId, TRACE_JNI_CALL); - ec_jni->SetObjectField(o, objFieldId, NULL, TRACE_JNI_CALL); + ec_jni->SetObjectField(o, objFieldId, nullptr, TRACE_JNI_CALL); size = ec_jni->GetArrayLength(arr, TRACE_JNI_CALL); - start_time = time(NULL); + start_time = time(nullptr); enterTime /= 1000; current_time = 0; while (difftime(current_time, start_time) < enterTime) { hash = 0; - pa = (jbyte*) ec_jni->GetPrimitiveArrayCritical(arr, NULL, TRACE_JNI_CALL); - if (pa != NULL) { + pa = (jbyte*) ec_jni->GetPrimitiveArrayCritical(arr, nullptr, TRACE_JNI_CALL); + if (pa != nullptr) { for (i = 0; i < size; ++i) { hash ^= pa[i]; } } else { - jni_env->FatalError("GetPrimitiveArrayCritical returned NULL"); + jni_env->FatalError("GetPrimitiveArrayCritical returned null"); } mssleep((long) sleepTime); ec_jni->ReleasePrimitiveArrayCritical(arr, pa, 0, TRACE_JNI_CALL); mssleep((long) sleepTime); - current_time = time(NULL); + current_time = time(nullptr); } ec_jni->SetObjectField(o, objFieldId, arr, TRACE_JNI_CALL); return hash; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/CharArrayCriticalLocker.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/CharArrayCriticalLocker.cpp index 8c46de5dd42d..28967200f94e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/CharArrayCriticalLocker.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/CharArrayCriticalLocker.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,11 +24,11 @@ #include #include #include "ExceptionCheckingJniEnv.hpp" -#include "jni_tools.h" +#include "jni_tools.hpp" extern "C" { -static jfieldID objFieldId = NULL; +static jfieldID objFieldId = nullptr; /* * Class: nsk_share_gc_lock_jni_CharArrayCriticalLocker @@ -45,31 +45,31 @@ JNIEXPORT jchar JNICALL Java_nsk_share_gc_lock_jni_CharArrayCriticalLocker_criti jchar hash = 0; time_t start_time, current_time; - if (objFieldId == NULL) { + if (objFieldId == nullptr) { jclass klass = ec_jni->GetObjectClass(o, TRACE_JNI_CALL); objFieldId = ec_jni->GetFieldID(klass, "obj", "Ljava/lang/Object;", TRACE_JNI_CALL); } arr = (jcharArray) ec_jni->GetObjectField(o, objFieldId, TRACE_JNI_CALL); - ec_jni->SetObjectField(o, objFieldId, NULL, TRACE_JNI_CALL); + ec_jni->SetObjectField(o, objFieldId, nullptr, TRACE_JNI_CALL); size = ec_jni->GetArrayLength(arr, TRACE_JNI_CALL); - start_time = time(NULL); + start_time = time(nullptr); current_time = 0; enterTime /= 1000; while (difftime(current_time, start_time) < enterTime) { hash = 0; - pa = (jchar*) ec_jni->GetPrimitiveArrayCritical(arr, NULL, TRACE_JNI_CALL); - if (pa != NULL) { + pa = (jchar*) ec_jni->GetPrimitiveArrayCritical(arr, nullptr, TRACE_JNI_CALL); + if (pa != nullptr) { for (i = 0; i < size; ++i) { hash ^= pa[i]; } } else { - jni_env->FatalError("GetPrimitiveArrayCritical returned NULL"); + jni_env->FatalError("GetPrimitiveArrayCritical returned null"); } mssleep((long) sleepTime); ec_jni->ReleasePrimitiveArrayCritical(arr, pa, 0, TRACE_JNI_CALL); mssleep((long) sleepTime); - current_time = time(NULL); + current_time = time(nullptr); } ec_jni->SetObjectField(o, objFieldId, arr, TRACE_JNI_CALL); return hash; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/DoubleArrayCriticalLocker.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/DoubleArrayCriticalLocker.cpp index fd6bba4822bd..2c42700e27ef 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/DoubleArrayCriticalLocker.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/DoubleArrayCriticalLocker.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,11 +24,11 @@ #include #include #include "ExceptionCheckingJniEnv.hpp" -#include "jni_tools.h" +#include "jni_tools.hpp" extern "C" { -static jfieldID objFieldId = NULL; +static jfieldID objFieldId = nullptr; /* * Class: nsk_share_gc_lock_jni_DoubleArrayCriticalLocker @@ -45,31 +45,31 @@ JNIEXPORT jdouble JNICALL Java_nsk_share_gc_lock_jni_DoubleArrayCriticalLocker_c jdouble hash = 0; time_t start_time, current_time; - if (objFieldId == NULL) { + if (objFieldId == nullptr) { jclass klass = ec_jni->GetObjectClass(o, TRACE_JNI_CALL); objFieldId = ec_jni->GetFieldID(klass, "obj", "Ljava/lang/Object;", TRACE_JNI_CALL); } arr = (jdoubleArray) ec_jni->GetObjectField(o, objFieldId, TRACE_JNI_CALL); - ec_jni->SetObjectField(o, objFieldId, NULL, TRACE_JNI_CALL); + ec_jni->SetObjectField(o, objFieldId, nullptr, TRACE_JNI_CALL); size = ec_jni->GetArrayLength(arr, TRACE_JNI_CALL); - start_time = time(NULL); + start_time = time(nullptr); enterTime /= 1000; current_time = 0; while (difftime(current_time, start_time) < enterTime) { hash = 0; - pa = (jdouble*) ec_jni->GetPrimitiveArrayCritical(arr, NULL, TRACE_JNI_CALL); - if (pa != NULL) { + pa = (jdouble*) ec_jni->GetPrimitiveArrayCritical(arr, nullptr, TRACE_JNI_CALL); + if (pa != nullptr) { for (i = 0; i < size; ++i) { hash += pa[i]; } } else { - jni_env->FatalError("GetPrimitiveArrayCritical returned NULL"); + jni_env->FatalError("GetPrimitiveArrayCritical returned null"); } mssleep((long) sleepTime); ec_jni->ReleasePrimitiveArrayCritical(arr, pa, 0, TRACE_JNI_CALL); mssleep((long) sleepTime); - current_time = time(NULL); + current_time = time(nullptr); } ec_jni->SetObjectField(o, objFieldId, arr, TRACE_JNI_CALL); return hash; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/FloatArrayCriticalLocker.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/FloatArrayCriticalLocker.cpp index a82e94253389..1ee47059d614 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/FloatArrayCriticalLocker.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/FloatArrayCriticalLocker.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,11 +24,11 @@ #include #include #include "ExceptionCheckingJniEnv.hpp" -#include "jni_tools.h" +#include "jni_tools.hpp" extern "C" { -static jfieldID objFieldId = NULL; +static jfieldID objFieldId = nullptr; /* * Class: nsk_share_gc_lock_jni_FloatArrayCriticalLocker @@ -45,31 +45,31 @@ JNIEXPORT jfloat JNICALL Java_nsk_share_gc_lock_jni_FloatArrayCriticalLocker_cri jfloat hash = 0; time_t start_time, current_time; - if (objFieldId == NULL) { + if (objFieldId == nullptr) { jclass klass = ec_jni->GetObjectClass(o, TRACE_JNI_CALL); objFieldId = ec_jni->GetFieldID(klass, "obj", "Ljava/lang/Object;", TRACE_JNI_CALL); } arr = (jfloatArray) ec_jni->GetObjectField(o, objFieldId, TRACE_JNI_CALL); - ec_jni->SetObjectField(o, objFieldId, NULL, TRACE_JNI_CALL); + ec_jni->SetObjectField(o, objFieldId, nullptr, TRACE_JNI_CALL); size = ec_jni->GetArrayLength(arr, TRACE_JNI_CALL); - start_time = time(NULL); + start_time = time(nullptr); enterTime /= 1000; current_time = 0; while (difftime(current_time, start_time) < enterTime) { hash = 0; - pa = (jfloat*) ec_jni->GetPrimitiveArrayCritical(arr, NULL, TRACE_JNI_CALL); - if (pa != NULL) { + pa = (jfloat*) ec_jni->GetPrimitiveArrayCritical(arr, nullptr, TRACE_JNI_CALL); + if (pa != nullptr) { for (i = 0; i < size; ++i) { hash += pa[i]; } } else { - jni_env->FatalError("GetPrimitiveArrayCritical returned NULL"); + jni_env->FatalError("GetPrimitiveArrayCritical returned null"); } mssleep((long) sleepTime); ec_jni->ReleasePrimitiveArrayCritical(arr, pa, 0, TRACE_JNI_CALL); mssleep((long) sleepTime); - current_time = time(NULL); + current_time = time(nullptr); } ec_jni->SetObjectField(o, objFieldId, arr, TRACE_JNI_CALL); return hash; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/IntArrayCriticalLocker.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/IntArrayCriticalLocker.cpp index 465e4c56b327..e0efd81f8401 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/IntArrayCriticalLocker.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/IntArrayCriticalLocker.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,11 +24,11 @@ #include #include #include "ExceptionCheckingJniEnv.hpp" -#include "jni_tools.h" +#include "jni_tools.hpp" extern "C" { -static jfieldID objFieldId = NULL; +static jfieldID objFieldId = nullptr; /* * Class: nsk_share_gc_lock_jni_IntArrayCriticalLocker @@ -45,31 +45,31 @@ JNIEXPORT jint JNICALL Java_nsk_share_gc_lock_jni_IntArrayCriticalLocker_critica jint hash = 0; time_t start_time, current_time; - if (objFieldId == NULL) { + if (objFieldId == nullptr) { jclass klass = ec_jni->GetObjectClass(o, TRACE_JNI_CALL); objFieldId = ec_jni->GetFieldID(klass, "obj", "Ljava/lang/Object;", TRACE_JNI_CALL); } arr = (jintArray) ec_jni->GetObjectField(o, objFieldId, TRACE_JNI_CALL); - ec_jni->SetObjectField(o, objFieldId, NULL, TRACE_JNI_CALL); + ec_jni->SetObjectField(o, objFieldId, nullptr, TRACE_JNI_CALL); size = ec_jni->GetArrayLength(arr, TRACE_JNI_CALL); - start_time = time(NULL); + start_time = time(nullptr); enterTime /= 1000; current_time = 0; while (difftime(current_time, start_time) < enterTime) { hash = 0; - pa = (jint*) ec_jni->GetPrimitiveArrayCritical(arr, NULL, TRACE_JNI_CALL); - if (pa != NULL) { + pa = (jint*) ec_jni->GetPrimitiveArrayCritical(arr, nullptr, TRACE_JNI_CALL); + if (pa != nullptr) { for (i = 0; i < size; ++i) { hash ^= pa[i]; } } else { - jni_env->FatalError("GetPrimitiveArrayCritical returned NULL"); + jni_env->FatalError("GetPrimitiveArrayCritical returned null"); } mssleep((long) sleepTime); ec_jni->ReleasePrimitiveArrayCritical(arr, pa, 0, TRACE_JNI_CALL); mssleep((long) sleepTime); - current_time = time(NULL); + current_time = time(nullptr); } ec_jni->SetObjectField(o, objFieldId, arr, TRACE_JNI_CALL); return hash; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/LongArrayCriticalLocker.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/LongArrayCriticalLocker.cpp index 8073e9ed36ea..265a7333ae31 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/LongArrayCriticalLocker.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/LongArrayCriticalLocker.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,11 +24,11 @@ #include #include #include "ExceptionCheckingJniEnv.hpp" -#include "jni_tools.h" +#include "jni_tools.hpp" extern "C" { -static jfieldID objFieldId = NULL; +static jfieldID objFieldId = nullptr; /* * Class: nsk_share_gc_lock_jni_LongArrayCriticalLocker @@ -45,31 +45,31 @@ JNIEXPORT jlong JNICALL Java_nsk_share_gc_lock_jni_LongArrayCriticalLocker_criti jlong hash = 0; time_t start_time, current_time; - if (objFieldId == NULL) { + if (objFieldId == nullptr) { jclass klass = ec_jni->GetObjectClass(o, TRACE_JNI_CALL); objFieldId = ec_jni->GetFieldID(klass, "obj", "Ljava/lang/Object;", TRACE_JNI_CALL); } arr = (jlongArray) ec_jni->GetObjectField(o, objFieldId, TRACE_JNI_CALL); - ec_jni->SetObjectField(o, objFieldId, NULL, TRACE_JNI_CALL); + ec_jni->SetObjectField(o, objFieldId, nullptr, TRACE_JNI_CALL); size = ec_jni->GetArrayLength(arr, TRACE_JNI_CALL); - start_time = time(NULL); + start_time = time(nullptr); enterTime /= 1000; current_time = 0; while (difftime(current_time, start_time) < enterTime) { hash = 0; - pa = (jlong*) ec_jni->GetPrimitiveArrayCritical(arr, NULL, TRACE_JNI_CALL); - if (pa != NULL) { + pa = (jlong*) ec_jni->GetPrimitiveArrayCritical(arr, nullptr, TRACE_JNI_CALL); + if (pa != nullptr) { for (i = 0; i < size; ++i) { hash ^= pa[i]; } } else { - jni_env->FatalError("GetPrimitiveArrayCritical returned NULL"); + jni_env->FatalError("GetPrimitiveArrayCritical returned null"); } mssleep((long) sleepTime); ec_jni->ReleasePrimitiveArrayCritical(arr, pa, 0, TRACE_JNI_CALL); mssleep((long) sleepTime); - current_time = time(NULL); + current_time = time(nullptr); } ec_jni->SetObjectField(o, objFieldId, arr, TRACE_JNI_CALL); return hash; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/ShortArrayCriticalLocker.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/ShortArrayCriticalLocker.cpp index a91a3cc37df9..bbc4cb240648 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/ShortArrayCriticalLocker.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/ShortArrayCriticalLocker.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,11 +24,11 @@ #include #include #include "ExceptionCheckingJniEnv.hpp" -#include "jni_tools.h" +#include "jni_tools.hpp" extern "C" { -static jfieldID objFieldId = NULL; +static jfieldID objFieldId = nullptr; /* * Class: nsk_share_gc_lock_jni_ShortArrayCriticalLocker @@ -45,31 +45,31 @@ JNIEXPORT jshort JNICALL Java_nsk_share_gc_lock_jni_ShortArrayCriticalLocker_cri jshort hash = 0; time_t start_time, current_time; - if (objFieldId == NULL) { + if (objFieldId == nullptr) { jclass klass = ec_jni->GetObjectClass(o, TRACE_JNI_CALL); objFieldId = ec_jni->GetFieldID(klass, "obj", "Ljava/lang/Object;", TRACE_JNI_CALL); } arr = (jshortArray) ec_jni->GetObjectField(o, objFieldId, TRACE_JNI_CALL); - ec_jni->SetObjectField(o, objFieldId, NULL, TRACE_JNI_CALL); + ec_jni->SetObjectField(o, objFieldId, nullptr, TRACE_JNI_CALL); size = ec_jni->GetArrayLength(arr, TRACE_JNI_CALL); - start_time = time(NULL); + start_time = time(nullptr); enterTime /= 1000; current_time = 0; while (current_time - start_time < enterTime) { hash = 0; - pa = (jshort*) ec_jni->GetPrimitiveArrayCritical(arr, NULL, TRACE_JNI_CALL); - if (pa != NULL) { + pa = (jshort*) ec_jni->GetPrimitiveArrayCritical(arr, nullptr, TRACE_JNI_CALL); + if (pa != nullptr) { for (i = 0; i < size; ++i) { hash ^= pa[i]; } } else { - jni_env->FatalError("GetPrimitiveArrayCritical returned NULL"); + jni_env->FatalError("GetPrimitiveArrayCritical returned null"); } mssleep((long) sleepTime); ec_jni->ReleasePrimitiveArrayCritical(arr, pa, 0, TRACE_JNI_CALL); mssleep((long) sleepTime); - current_time = time(NULL); + current_time = time(nullptr); } ec_jni->SetObjectField(o, objFieldId, arr, TRACE_JNI_CALL); return hash; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/StringCriticalLocker.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/StringCriticalLocker.cpp index bbb41cfef964..df3c98f7e31d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/StringCriticalLocker.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jni/StringCriticalLocker.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,11 +24,11 @@ #include #include #include "ExceptionCheckingJniEnv.hpp" -#include "jni_tools.h" +#include "jni_tools.hpp" extern "C" { -static jfieldID objFieldId = NULL; +static jfieldID objFieldId = nullptr; /* * Class: nsk_share_gc_lock_jni_StringCriticalLocker @@ -45,31 +45,31 @@ JNIEXPORT jchar JNICALL Java_nsk_share_gc_lock_jni_StringCriticalLocker_critical jchar hash = 0; time_t start_time, current_time; - if (objFieldId == NULL) { + if (objFieldId == nullptr) { jclass klass = ec_jni->GetObjectClass(o, TRACE_JNI_CALL); objFieldId = ec_jni->GetFieldID(klass, "obj", "Ljava/lang/Object;", TRACE_JNI_CALL); } str = (jstring) ec_jni->GetObjectField(o, objFieldId, TRACE_JNI_CALL); - ec_jni->SetObjectField(o, objFieldId, NULL, TRACE_JNI_CALL); + ec_jni->SetObjectField(o, objFieldId, nullptr, TRACE_JNI_CALL); size = ec_jni->GetStringLength(str, TRACE_JNI_CALL); - start_time = time(NULL); + start_time = time(nullptr); enterTime /= 1000; current_time = 0; while (current_time - start_time < enterTime) { hash = 0; - pa = ec_jni->GetStringCritical(str, NULL, TRACE_JNI_CALL); - if (pa != NULL) { + pa = ec_jni->GetStringCritical(str, nullptr, TRACE_JNI_CALL); + if (pa != nullptr) { for (i = 0; i < size; ++i) { hash ^= pa[i]; } } else { - jni_env->FatalError("GetStringCritical returned NULL"); + jni_env->FatalError("GetStringCritical returned null"); } mssleep((long) sleepTime); ec_jni->ReleaseStringCritical(str, pa, TRACE_JNI_CALL); mssleep((long) sleepTime); - current_time = time(NULL); + current_time = time(nullptr); } ec_jni->SetObjectField(o, objFieldId, str, TRACE_JNI_CALL); return hash; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNIGlobalRefLocker.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNIGlobalRefLocker.cpp index 7cde57969c71..d141f6d85447 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNIGlobalRefLocker.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNIGlobalRefLocker.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,11 +25,11 @@ #include #include #include "ExceptionCheckingJniEnv.hpp" -#include "jni_tools.h" +#include "jni_tools.hpp" extern "C" { -static jfieldID objFieldId = NULL; +static jfieldID objFieldId = nullptr; /* * Class: nsk_share_gc_lock_jniref_JNIGlobalRefLocker @@ -44,13 +44,13 @@ JNIEXPORT void JNICALL Java_nsk_share_gc_lock_jniref_JNIGlobalRefLocker_critical jobject gref; time_t start_time, current_time; - if (objFieldId == NULL) { + if (objFieldId == nullptr) { jclass klass = ec_jni->GetObjectClass(o, TRACE_JNI_CALL); objFieldId = ec_jni->GetFieldID(klass, "obj", "Ljava/lang/Object;", TRACE_JNI_CALL); } obj = ec_jni->GetObjectField(o, objFieldId, TRACE_JNI_CALL); - ec_jni->SetObjectField(o, objFieldId, NULL, TRACE_JNI_CALL); - start_time = time(NULL); + ec_jni->SetObjectField(o, objFieldId, nullptr, TRACE_JNI_CALL); + start_time = time(nullptr); enterTime /= 1000; current_time = 0; while (current_time - start_time < enterTime) { @@ -58,7 +58,7 @@ JNIEXPORT void JNICALL Java_nsk_share_gc_lock_jniref_JNIGlobalRefLocker_critical mssleep((long) sleepTime); ec_jni->DeleteGlobalRef(gref, TRACE_JNI_CALL); mssleep((long) sleepTime); - current_time = time(NULL); + current_time = time(nullptr); } ec_jni->SetObjectField(o, objFieldId, obj, TRACE_JNI_CALL); } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNILocalRefLocker.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNILocalRefLocker.cpp index 200951302708..005954d0fbc4 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNILocalRefLocker.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNILocalRefLocker.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,11 +24,11 @@ #include #include #include "ExceptionCheckingJniEnv.hpp" -#include "jni_tools.h" +#include "jni_tools.hpp" extern "C" { -static jfieldID objFieldId = NULL; +static jfieldID objFieldId = nullptr; /* * Class: nsk_share_gc_lock_jniref_JNILocalRefLocker @@ -43,13 +43,13 @@ JNIEXPORT void JNICALL Java_nsk_share_gc_lock_jniref_JNILocalRefLocker_criticalN jobject gref; time_t start_time, current_time; - if (objFieldId == NULL) { + if (objFieldId == nullptr) { jclass klass = ec_jni->GetObjectClass(o, TRACE_JNI_CALL); objFieldId = ec_jni->GetFieldID(klass, "obj", "Ljava/lang/Object;", TRACE_JNI_CALL); } obj = ec_jni->GetObjectField(o, objFieldId, TRACE_JNI_CALL); - ec_jni->SetObjectField(o, objFieldId, NULL, TRACE_JNI_CALL); - start_time = time(NULL); + ec_jni->SetObjectField(o, objFieldId, nullptr, TRACE_JNI_CALL); + start_time = time(nullptr); enterTime /= 1000; current_time = 0; while (current_time - start_time < enterTime) { @@ -57,7 +57,7 @@ JNIEXPORT void JNICALL Java_nsk_share_gc_lock_jniref_JNILocalRefLocker_criticalN mssleep((long) sleepTime); ec_jni->DeleteLocalRef(gref, TRACE_JNI_CALL); mssleep((long) sleepTime); - current_time = time(NULL); + current_time = time(nullptr); } ec_jni->SetObjectField(o, objFieldId, obj, TRACE_JNI_CALL); } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNIRefLocker.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNIRefLocker.cpp index a15c487cfd3b..9478e72eb436 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNIRefLocker.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNIRefLocker.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,11 +24,11 @@ #include #include #include "ExceptionCheckingJniEnv.hpp" -#include "jni_tools.h" +#include "jni_tools.hpp" extern "C" { -static jfieldID objFieldId = NULL; +static jfieldID objFieldId = nullptr; /* * Class: nsk_share_gc_lock_jniref_JNIRefLocker @@ -43,15 +43,15 @@ JNIEXPORT void JNICALL Java_nsk_share_gc_lock_jniref_JNIRefLocker_criticalNative jobject gref, lref, gwref; time_t start_time, current_time; - if (objFieldId == NULL) { + if (objFieldId == nullptr) { jclass klass = ec_jni->GetObjectClass(o, TRACE_JNI_CALL); objFieldId = ec_jni->GetFieldID(klass, "obj", "Ljava/lang/Object;", TRACE_JNI_CALL); } obj = ec_jni->GetObjectField(o, objFieldId, TRACE_JNI_CALL); - ec_jni->SetObjectField(o, objFieldId, NULL, TRACE_JNI_CALL); + ec_jni->SetObjectField(o, objFieldId, nullptr, TRACE_JNI_CALL); - start_time = time(NULL); + start_time = time(nullptr); enterTime /= 1000; current_time = 0; while (current_time - start_time < enterTime) { @@ -63,7 +63,7 @@ JNIEXPORT void JNICALL Java_nsk_share_gc_lock_jniref_JNIRefLocker_criticalNative ec_jni->DeleteLocalRef(lref, TRACE_JNI_CALL); ec_jni->DeleteWeakGlobalRef(gwref, TRACE_JNI_CALL); mssleep((long) sleepTime); - current_time = time(NULL); + current_time = time(nullptr); } ec_jni->SetObjectField(o, objFieldId, obj, TRACE_JNI_CALL); } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNIWeakGlobalRefLocker.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNIWeakGlobalRefLocker.cpp index d98379998ee3..6d1986f533ef 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNIWeakGlobalRefLocker.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jniref/JNIWeakGlobalRefLocker.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,11 +24,11 @@ #include #include #include "ExceptionCheckingJniEnv.hpp" -#include "jni_tools.h" +#include "jni_tools.hpp" extern "C" { -static jfieldID objFieldId = NULL; +static jfieldID objFieldId = nullptr; /* * Class: nsk_share_gc_lock_jniref_JNIWeakGlobalRefLocker @@ -43,14 +43,14 @@ JNIEXPORT void JNICALL Java_nsk_share_gc_lock_jniref_JNIWeakGlobalRefLocker_crit jobject gref; time_t start_time, current_time; - if (objFieldId == NULL) { + if (objFieldId == nullptr) { jclass klass = ec_jni->GetObjectClass(o, TRACE_JNI_CALL); objFieldId = ec_jni->GetFieldID(klass, "obj", "Ljava/lang/Object;", TRACE_JNI_CALL); } obj = ec_jni->GetObjectField(o, objFieldId, TRACE_JNI_CALL); - ec_jni->SetObjectField(o, objFieldId, NULL, TRACE_JNI_CALL); + ec_jni->SetObjectField(o, objFieldId, nullptr, TRACE_JNI_CALL); - start_time = time(NULL); + start_time = time(nullptr); enterTime /= 1000; current_time = 0; while (current_time - start_time < enterTime) { @@ -58,7 +58,7 @@ JNIEXPORT void JNICALL Java_nsk_share_gc_lock_jniref_JNIWeakGlobalRefLocker_crit mssleep((long) sleepTime); ec_jni->DeleteWeakGlobalRef(gref, TRACE_JNI_CALL); mssleep((long) sleepTime); - current_time = time(NULL); + current_time = time(nullptr); } ec_jni->SetObjectField(o, objFieldId, obj, TRACE_JNI_CALL); } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jvmti/JVMTIAllocLocker.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jvmti/JVMTIAllocLocker.cpp index af69f0660c1b..47ebfb502ba3 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jvmti/JVMTIAllocLocker.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/gc/lock/jvmti/JVMTIAllocLocker.cpp @@ -24,7 +24,7 @@ #include #include #include -#include "jni_tools.h" +#include "jni_tools.hpp" extern "C" { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jdb/Debuggee.java b/test/hotspot/jtreg/vmTestbase/nsk/share/jdb/Debuggee.java index b0467a7e73ce..f7472e2db035 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jdb/Debuggee.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jdb/Debuggee.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2024, 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,55 +30,15 @@ import java.io.*; /** - * Interface defining methods to control mirror of debuggee (i.e. debugged VM). + * Class defining methods to control mirror of debuggee (i.e. debugged VM). */ -public interface Debuggee { +public class Debuggee extends LocalProcess { /** Default prefix for log messages. */ public static final String LOG_PREFIX = "debuggee> "; public static final String DEBUGEE_STDOUT_LOG_PREFIX = "debuggee.stdout> "; public static final String DEBUGEE_STDERR_LOG_PREFIX = "debuggee.stderr> "; - /** - * Launch debuggee. - * - * @throws IOException - */ - public void launch (String[] args) throws IOException; - - /** Return exit status. */ - public int getStatus (); - - /** Check whether the process has been terminated. */ - public boolean terminated(); - - /** Kill the debuggee VM. */ - public void killDebuggee (); - - /** Wait until the debuggee VM shutdown or crash. */ - public int waitForDebuggee () throws InterruptedException; - - /** Get a pipe to write to the debuggee's stdin stream. */ - public OutputStream getInPipe (); - - /** Get a pipe to read the debuggee's stdout stream. */ - public InputStream getOutPipe (); - - /** Get a pipe to read the debuggee's stderr stream. */ - public InputStream getErrPipe (); - - /** Redirect stdout stream to Log */ - public void redirectStdout(Log log, String prefix); - - /** Redirect stderr stream to Log */ - public void redirectStderr(Log log, String prefix); -} - -/** - * Mirror of locally launched debuggee. - */ -final class LocalLaunchedDebuggee extends LocalProcess implements Debuggee { - private IORedirector stdoutRedirector = null; private IORedirector stderrRedirector = null; private IORedirector stdinRedirector = null; @@ -90,7 +50,7 @@ final class LocalLaunchedDebuggee extends LocalProcess implements Debuggee { private Launcher launcher = null; /** Enwrap the existing VM mirror. */ - LocalLaunchedDebuggee (Launcher launcher) { + Debuggee(Launcher launcher) { super(); this.launcher = launcher; } @@ -235,70 +195,3 @@ public void redirectStderr(Log log, String prefix) { } -/** - * Mirror of remotely launched debuggee. - */ -final class RemoteLaunchedDebuggee implements Debuggee { - - /** Launcher that creates this debuggee. */ - private Launcher launcher = null; - - /** Enwrap the existing VM mirror. */ - RemoteLaunchedDebuggee (Launcher launcher) { - super(); - this.launcher = launcher; - } - - /** - * Launch debugee on remote host via Launcher object. - */ - public void launch(String[] args) throws IOException { - String cmdLine = ArgumentHandler.joinArguments(args, "\""); - launcher.display("Starting remote java process:\n" + cmdLine); - launcher.launchRemoteProcess(args); - } - - /** Return exit status of the debuggee VM. */ - public int getStatus () { - return launcher.getRemoteProcessStatus(); - } - - /** Check whether the debuggee VM has been terminated. */ - public boolean terminated () { - return launcher.isRemoteProcessTerminated(); - } - - // ---------------------------------------------- // - - /** Kill the debuggee VM. */ - public void killDebuggee () { - launcher.killRemoteProcess(); - } - - /** Wait until the debuggee VM shutdown or crash. */ - public int waitForDebuggee () { - return launcher.waitForRemoteProcess(); - } - - /** Get a pipe to write to the debuggee's stdin stream. */ - public OutputStream getInPipe () { - return null; - } - - /** Get a pipe to read the debuggee's stdout stream. */ - public InputStream getOutPipe () { - return null; - } - - /** Get a pipe to read the debuggee's stderr stream. */ - public InputStream getErrPipe () { - return null; - } - - public void redirectStdout(Log log, String prefix) { - } - - public void redirectStderr(Log log, String prefix) { - } - -} diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jdb/Jdb.java b/test/hotspot/jtreg/vmTestbase/nsk/share/jdb/Jdb.java index 107f8f2e0d8d..7b3281a7e179 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jdb/Jdb.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jdb/Jdb.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,6 @@ package nsk.share.jdb; import nsk.share.*; -import nsk.share.jpda.*; import java.util.*; import java.io.*; @@ -36,7 +35,7 @@ * This class provides abilities to launch it, to send command, * to read reply on the command, to set breakpoint on entry in debugggee's method. */ -public class Jdb extends LocalProcess implements Finalizable { +public class Jdb extends LocalProcess { /** File to log stdout stream */ static final String JDB_STDOUT_FILE = "jdb.stdout"; /** File to log stderr stream */ @@ -95,11 +94,8 @@ public static Launcher getLauncher() { return launcher; } - public void finalizeAtExit() throws Throwable { - finalize(); - } - public void finalize() throws Throwable { + public void close() { if (fout != null) { // fout.flush(); fout.close(); @@ -116,7 +112,6 @@ public void finalize() throws Throwable { if (jdbStderrReader != null) { jdbStderrReader.close(); } - super.finalize(); } /** Create Jdb object. */ @@ -961,10 +956,10 @@ public static Jdb startAttachingJdb (Launcher launcher, String[] jdbCmdArgs, Str System.out.println("Unsuccessful launch of attaching jdb. Next try..."); try { - jdb.finalize(); + jdb.close(); } catch (Throwable t) { t.printStackTrace(getLauncher().getLog().getOutStream()); - throw new Failure("Caught unexpected error while finalizing jdb: " + t); + throw new Failure("Caught unexpected error while closing jdb streams: " + t); } break; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jdb/JdbTest.java b/test/hotspot/jtreg/vmTestbase/nsk/share/jdb/JdbTest.java index c0edc58993bc..349216f4329c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jdb/JdbTest.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jdb/JdbTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,10 +24,8 @@ package nsk.share.jdb; import nsk.share.*; -import nsk.share.jpda.*; import java.io.*; -import java.util.*; public abstract class JdbTest { public static final int PASSED = 0; // Exit code for passed test @@ -174,6 +172,14 @@ protected int runTest(String argv[], PrintStream out) { } else { failure("jdb abnormally exited with code: " + code); } + + try { + jdb.close(); + } catch (Throwable ex) { + failure("Caught exception/error while closing jdb streams:\n\t" + ex); + ex.printStackTrace(log.getOutStream()); + } + jdb = null; if (debuggee != null @@ -198,27 +204,24 @@ protected int runTest(String argv[], PrintStream out) { } } - } catch (Exception e) { - failure("Caught unexpected exception: " + e); - e.printStackTrace(out); - + } catch (Throwable t) { + failure("Caught unexpected exception: " + t); + t.printStackTrace(out); + } finally { if (jdb != null) { + log.complain("jdb reference is not null, check for exception in the logs."); try { - jdb.finalize(); + jdb.close(); } catch (Throwable ex) { - failure("Caught exception/error while finalization of jdb:\n\t" + ex); + failure("Caught exception/error while closing jdb streams:\n\t" + ex); ex.printStackTrace(log.getOutStream()); } - } else { - log.complain("jdb reference is null, cannot run jdb.finalize() method"); } - if (debuggee != null) { + if (debuggee != null && !debuggee.terminated()) { + log.complain("debuggee is still running, check for exception in the logs."); debuggee.killDebuggee(); - } else { - log.complain("debuggee reference is null, cannot run debuggee.finalize() method"); } - } if (!success) { @@ -226,9 +229,9 @@ protected int runTest(String argv[], PrintStream out) { return FAILED; } - } catch (Exception e) { - out.println("Caught unexpected exception while starting the test: " + e); - e.printStackTrace(out); + } catch (Throwable t) { + out.println("Caught unexpected exception while starting the test: " + t); + t.printStackTrace(out); out.println("TEST FAILED"); return FAILED; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jdb/Launcher.java b/test/hotspot/jtreg/vmTestbase/nsk/share/jdb/Launcher.java index 0db3a6f718ea..35df95b2d6f8 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jdb/Launcher.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jdb/Launcher.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2024, 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 @@ -103,52 +103,21 @@ public void launchJdbAndDebuggee (String classToExecute) throws IOException { String[] jdbCmdArgs = makeJdbCmdLine(classToExecute); - if (argumentHandler.isLaunchedLocally()) { - - if (argumentHandler.isDefaultConnector()) { - - localDefaultLaunch(jdbCmdArgs, classToExecute); - - } else if (argumentHandler.isRawLaunchingConnector()) { - - localRawLaunch(jdbCmdArgs, classToExecute); - - } else if (argumentHandler.isLaunchingConnector()) { - - localLaunch(jdbCmdArgs, classToExecute); - - } else if (argumentHandler.isAttachingConnector()) { - - localLaunchAndAttach(jdbCmdArgs, classToExecute); - - } else if (argumentHandler.isListeningConnector()) { - - localLaunchAndListen(jdbCmdArgs, classToExecute); - - } else { - throw new TestBug("Unexpected connector type for local launch mode" - + argumentHandler.getConnectorType()); - } - - } else if (argumentHandler.isLaunchedRemotely()) { - - connectToBindServer(classToExecute); - - if (argumentHandler.isAttachingConnector()) { - - remoteLaunchAndAttach(jdbCmdArgs, classToExecute); - - } else if (argumentHandler.isListeningConnector()) { - - remoteLaunchAndListen(jdbCmdArgs, classToExecute); - - } else { - throw new TestBug("Unexpected connector type for remote launch mode" - + argumentHandler.getConnectorType()); - } + if (argumentHandler.isDefaultConnector()) { + localDefaultLaunch(jdbCmdArgs, classToExecute); + } else if (argumentHandler.isRawLaunchingConnector()) { + localRawLaunch(jdbCmdArgs, classToExecute); + } else if (argumentHandler.isLaunchingConnector()) { + localLaunch(jdbCmdArgs, classToExecute); + } else if (argumentHandler.isAttachingConnector()) { + localLaunchAndAttach(jdbCmdArgs, classToExecute); + } else if (argumentHandler.isListeningConnector()) { + localLaunchAndListen(jdbCmdArgs, classToExecute); } else { - throw new Failure("Unexpected launching mode: " + argumentHandler.getLaunchMode()); + throw new TestBug("Unexpected connector type for local launch mode" + + argumentHandler.getConnectorType()); } + } /** @@ -198,11 +167,7 @@ private String[] makeJdbCmdLine (String classToExecute) { if (argumentHandler.isRawLaunchingConnector()) { if (argumentHandler.isSocketTransport()) { - if (argumentHandler.isLaunchedLocally()) { - connectorAddress = argumentHandler.getTransportPort(); - } else { - connectorAddress = argumentHandler.getDebugeeHost() + ":" + argumentHandler.getTransportPort(); - } + connectorAddress = argumentHandler.getTransportPort(); } else if (argumentHandler.isShmemTransport() ) { connectorAddress = argumentHandler.getTransportSharedName(); } else { @@ -247,8 +212,6 @@ private String[] makeJdbCmdLine (String classToExecute) { if (argumentHandler.isSocketTransport()) { connect.append("port=" + argumentHandler.getTransportPort().trim()); - if (argumentHandler.isLaunchedRemotely()) - connect.append(",hostname=" + argumentHandler.getDebugeeHost().trim()); } else if (argumentHandler.isShmemTransport()) { connect.append("name=" + argumentHandler.getTransportSharedName().trim()); } else { @@ -324,7 +287,7 @@ private String[] makeJdbCmdLine (String classToExecute) { private void localLaunchAndAttach (String[] jdbCmdArgs, String classToExecute) throws IOException { - debuggee = new LocalLaunchedDebuggee(this); + debuggee = new Debuggee(this); String address = makeTransportAddress(); String[] javaCmdArgs = makeCommandLineArgs(classToExecute, address); debuggee.launch(javaCmdArgs); @@ -346,57 +309,12 @@ private String[] makeJdbCmdLine (String classToExecute) { String address = jdb.waitForListeningJdb(); display("Listening address found: " + address); - debuggee = new LocalLaunchedDebuggee(this); + debuggee = new Debuggee(this); String[] javaCmdArgs = makeCommandLineArgs(classToExecute, address); debuggee.launch(javaCmdArgs); // jdb.waitForPrompt(0, false); } - /** - * Run test in remote mode using attaching connector. - */ - private void remoteLaunchAndAttach - (String[] jdbCmdArgs, String classToExecute) throws IOException { - - debuggee = new RemoteLaunchedDebuggee(this); - String address = makeTransportAddress(); - String[] javaCmdArgs = makeCommandLineArgs(classToExecute, address); - try { - debuggee.launch(javaCmdArgs); - } catch (IOException e) { - throw new Failure("Caught exception while launching debuggee VM process:\n\t" - + e); - }; - - display("Start jdb attaching to remote debuggee"); - jdb = Jdb.startAttachingJdb (this, jdbCmdArgs, JDB_STARTED); -// jdb.waitForPrompt(0, false); - } - - /** - * Run test in remote mode using listening connector. - */ - private void remoteLaunchAndListen - (String[] jdbCmdArgs, String classToExecute) throws IOException { - - jdb = new Jdb(this); - display("Starting jdb listening to remote debuggee"); - jdb.launch(jdbCmdArgs); - String address = jdb.waitForListeningJdb(); - display("Listening address found: " + address); - - debuggee = new RemoteLaunchedDebuggee(this); - String[] javaCmdArgs = makeCommandLineArgs(classToExecute); - try { - debuggee.launch(javaCmdArgs); - } catch (IOException e) { - throw new Failure("Caught exception while launching debuggee VM process:\n\t" - + e); - }; - - jdb.waitForMessage(0, JDB_STARTED); -// jdb.waitForPrompt(0, false); - } } // End of Launcher diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/LocalProcess.java b/test/hotspot/jtreg/vmTestbase/nsk/share/jdb/LocalProcess.java similarity index 89% rename from test/hotspot/jtreg/vmTestbase/nsk/share/LocalProcess.java rename to test/hotspot/jtreg/vmTestbase/nsk/share/jdb/LocalProcess.java index 6ff5c9a39a5c..edb9f78ddc87 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/LocalProcess.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jdb/LocalProcess.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,9 +21,7 @@ * questions. */ -package nsk.share; - -import nsk.share.*; +package nsk.share.jdb; import java.io.*; @@ -33,14 +31,9 @@ * This class provides abilities to launch such process, * redirect standard output streams, wait for process terminates * or kill the process, and so on. - *

    - * This object is finalized with nsk.share.Finalizer. - * - * @see nsk.share.FinalizableObject - * @see nsk.share.Finalizer */ -public class LocalProcess extends FinalizableObject { +class LocalProcess { public final static int PROCESS_IS_ALIVE = 222; @@ -59,16 +52,11 @@ public void launch (String[] args) throws IOException { } process = Runtime.getRuntime().exec(args); - - registerCleanup(); } public void launch (String cmdLine) throws IOException { System.out.println("Launching process by command line: " + cmdLine); - process = Runtime.getRuntime().exec(cmdLine); - - registerCleanup(); } /** Return exit status. */ @@ -163,12 +151,4 @@ protected void kill() { process.destroy(); } - /** - * This method is called at finalization and calls kill(). - * - */ - @Override - public void cleanup() { - kill(); - } } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jdi/ArgumentHandler.java b/test/hotspot/jtreg/vmTestbase/nsk/share/jdi/ArgumentHandler.java index 168631895002..3f924c6ac47b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jdi/ArgumentHandler.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jdi/ArgumentHandler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -457,18 +457,6 @@ protected void checkOptions() { } */ - if (! isLaunchedLocally() && ! isDefaultDebugeeSuspendMode()) { - throw new BadOption("inconsistent options: " - + "-debugee.launch=" + getLaunchMode() - + " and -debugee.suspend=" + getDebugeeSuspendMode()); - } - - if (! isLaunchedLocally() && isLaunchingConnector()) { - throw new BadOption("inconsistent options: " - + "-debugee.launch=" + getLaunchMode() - + " and -connector=" + getConnectorType()); - } - if (isLaunchingConnector() && ! isDefaultTransport()) { throw new BadOption("inconsistent options: " + "-connector=" + getConnectorType() diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jdi/Binder.java b/test/hotspot/jtreg/vmTestbase/nsk/share/jdi/Binder.java index 872b756f08de..7f934c6a44b8 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jdi/Binder.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jdi/Binder.java @@ -127,8 +127,7 @@ public Binder (ArgumentHandler argumentHandler, Log log) { * started with launching connector. */ public Debugee makeLocalDebugee(Process process) { - LocalLaunchedDebugee debugee = new LocalLaunchedDebugee(process, this); - return debugee; + return new Debugee(process, this); } /** @@ -190,51 +189,22 @@ public Debugee bindToDebugeeNoWait(String classToExecute) { prepareForPipeConnection(argumentHandler); - if (argumentHandler.isLaunchedLocally()) { - - if (argumentHandler.isDefaultConnector()) { - debugee = localDefaultLaunchDebugee(vmm, classToExecute, classPath); - } else if (argumentHandler.isRawLaunchingConnector()) { - debugee = localRawLaunchDebugee(vmm, classToExecute, classPath); - } else if (argumentHandler.isLaunchingConnector()) { - debugee = localLaunchDebugee(vmm, classToExecute, classPath); - } else if (argumentHandler.isAttachingConnector()) { - debugee = localLaunchAndAttachDebugee(vmm, classToExecute, classPath); - } else if (argumentHandler.isListeningConnector()) { - debugee = localLaunchAndListenDebugee(vmm, classToExecute, classPath); - } else { - throw new TestBug("Unexpected connector type for local debugee launch mode" - + argumentHandler.getConnectorType()); - } - - } else if (argumentHandler.isLaunchedRemotely()) { - - connectToBindServer(classToExecute); - - if (argumentHandler.isAttachingConnector()) { - debugee = remoteLaunchAndAttachDebugee(vmm, classToExecute, classPath); - } else if (argumentHandler.isListeningConnector()) { - debugee = remoteLaunchAndListenDebugee(vmm, classToExecute, classPath); - } else { - throw new TestBug("Unexpected connector type for remote debugee launch mode" - + argumentHandler.getConnectorType()); - } - - } else if (argumentHandler.isLaunchedManually()) { - - if (argumentHandler.isAttachingConnector()) { - debugee = manualLaunchAndAttachDebugee(vmm, classToExecute, classPath); - } else if (argumentHandler.isListeningConnector()) { - debugee = manualLaunchAndListenDebugee(vmm, classToExecute, classPath); - } else { - throw new TestBug("Unexpected connector type for manual debugee launch mode" - + argumentHandler.getConnectorType()); - } - + if (argumentHandler.isDefaultConnector()) { + debugee = localDefaultLaunchDebugee(vmm, classToExecute, classPath); + } else if (argumentHandler.isRawLaunchingConnector()) { + debugee = localRawLaunchDebugee(vmm, classToExecute, classPath); + } else if (argumentHandler.isLaunchingConnector()) { + debugee = localLaunchDebugee(vmm, classToExecute, classPath); + } else if (argumentHandler.isAttachingConnector()) { + debugee = localLaunchAndAttachDebugee(vmm, classToExecute, classPath); + } else if (argumentHandler.isListeningConnector()) { + debugee = localLaunchAndListenDebugee(vmm, classToExecute, classPath); } else { - throw new Failure("Unexpected debugee launching mode: " + argumentHandler.getLaunchMode()); + throw new TestBug("Unexpected connector type for local debugee launch mode" + + argumentHandler.getConnectorType()); } + return debugee; } @@ -487,194 +457,6 @@ private Debugee localLaunchAndListenDebugee (VirtualMachineManager vmm, // -------------------------------------------------- // - /** - * Launch debugee VM remotely via BindServer and connect to it using - * AttachingConnector. - */ - private Debugee remoteLaunchAndAttachDebugee (VirtualMachineManager vmm, - String classToExecute, - String classPath) { - display("Finding connector: " + argumentHandler.getConnectorName() ); - AttachingConnector connector = - (AttachingConnector) findConnector(argumentHandler.getConnectorName(), - vmm.attachingConnectors()); - - Map arguments = setupAttachingConnector(connector, classToExecute, classPath); - - String address = makeTransportAddress(); - String[] cmdLineArgs = makeCommandLineArgs(classToExecute, address); - String javaCmdLine = makeCommandLineString(classToExecute, address, "\""); - - display("Starting remote java process:\n\t" + javaCmdLine); - Debugee debugee = startRemoteDebugee(cmdLineArgs); - - display("Attaching to debugee"); - VirtualMachine vm; - IOException ioe = null; - for (int i = 0; i < CONNECT_TRIES; i++) { - try { - vm = connector.attach(arguments); - display("Debugee attached"); - debugee.setupVM(vm); - return debugee; - } catch (IOException e) { - display("Attempt #" + i + " to connect to debugee VM failed:\n\t" + e); - ioe = e; - if (debugee.terminated()) { - throw new Failure("Unable to connect to debuggee VM: VM process is terminated"); - } - try { - Thread.currentThread().sleep(CONNECT_TRY_DELAY); - } catch (InterruptedException ie) { - ie.printStackTrace(log.getOutStream()); - throw new Failure("Thread interrupted while pausing connection attempts:\n\t" - + ie); - } - } catch (IllegalConnectorArgumentsException e) { - e.printStackTrace(log.getOutStream()); - throw new TestBug("Wrong connector arguments used to attach to debuggee VM:\n\t" + e); - } - } - throw new Failure("Unable to connect to debugee VM after " + CONNECT_TRIES - + " tries:\n\t" + ioe); - } - - /** - * Launch debugee VM remotely via BindServer and connect to it using - * ListeningConnector. - */ - private Debugee remoteLaunchAndListenDebugee (VirtualMachineManager vmm, - String classToExecute, - String classPath) { - display("Finding connector: " + argumentHandler.getConnectorName() ); - ListeningConnector connector = - (ListeningConnector) findConnector(argumentHandler.getConnectorName(), - vmm.listeningConnectors()); - Map arguments = setupListeningConnector(connector, classToExecute, classPath); - - String address = null; - try { - display("Listening for connection from debugee"); - address = connector.startListening(arguments); - } catch (IllegalConnectorArgumentsException e) { - e.printStackTrace(log.getOutStream()); - throw new TestBug("Wrong connector arguments used to listen debuggee VM:\n\t" + e); - } catch (IOException e) { - e.printStackTrace(log.getOutStream()); - throw new Failure("Caught exception while starting listening debugee VM:\n\t" + e); - }; - - String[] cmdLineArgs = makeCommandLineArgs(classToExecute, address); - String javaCmdLine = makeCommandLineString(classToExecute, address, "\""); - - display("Starting remote java process:\n\t" + javaCmdLine); - Debugee debugee = startRemoteDebugee(cmdLineArgs); - - display("Waiting for connection from debugee"); - VirtualMachine vm; - IOException ioe = null; - for (int i = 0; i < CONNECT_TRIES; i++) { - try { - vm = connector.accept(arguments); - connector.stopListening(arguments); - display("Debugee attached"); - debugee.setupVM(vm); - return debugee; - } catch (IOException e) { - display("Attempt #" + i + " to listen debugee VM failed:\n\t" + e); - ioe = e; - if (debugee.terminated()) { - throw new Failure("Unable to connect to debuggee VM: VM process is terminated"); - } - try { - Thread.currentThread().sleep(CONNECT_TRY_DELAY); - } catch (InterruptedException ie) { - ie.printStackTrace(log.getOutStream()); - throw new Failure("Thread interrupted while pausing connection attempts:\n\t" - + ie); - } - } catch (IllegalConnectorArgumentsException e) { - e.printStackTrace(log.getOutStream()); - throw new TestBug("Wrong connector arguments used to listen debuggee VM:\n\t" + e); - } - } - throw new Failure("Unable to connect to debugee VM after " + CONNECT_TRIES - + " tries:\n\t" + ioe); - } - - // -------------------------------------------------- // - - /** - * Prompt to manually launch debugee VM and connect to it using - * AttachingConnector. - */ - private Debugee manualLaunchAndAttachDebugee (VirtualMachineManager vmm, - String classToExecute, - String classPath) { - display("Finding connector: " + argumentHandler.getConnectorName() ); - AttachingConnector connector = - (AttachingConnector) findConnector(argumentHandler.getConnectorName(), - vmm.attachingConnectors()); - Map arguments = setupAttachingConnector(connector, classToExecute, classPath); - - String address = makeTransportAddress(); - String javaCmdLine = makeCommandLineString(classToExecute, address, "\""); - - display("Starting manual java process:\n\t" + javaCmdLine); - ManualLaunchedDebugee debugee = startManualDebugee(javaCmdLine); - - VirtualMachine vm; - try { - display("Attaching to debugee"); - vm = connector.attach(arguments); - } catch (IllegalConnectorArgumentsException e) { - e.printStackTrace(log.getOutStream()); - throw new TestBug("Wrong connector arguments used to attach to debuggee VM:\n\t" + e); - } catch (IOException e) { - e.printStackTrace(log.getOutStream()); - throw new Failure("Caught exception while attaching to debugee VM:\n\t" + e); - }; - display("Debugee attached"); - - debugee.setupVM(vm); - return debugee; - } - - /** - * Prompt to manually launch debugee VM and connect to it using - * ListeningConnector. - */ - private Debugee manualLaunchAndListenDebugee (VirtualMachineManager vmm, - String classToExecute, - String classPath) { - display("Finding connector: " + argumentHandler.getConnectorName() ); - ListeningConnector connector = - (ListeningConnector) findConnector(argumentHandler.getConnectorName(), - vmm.listeningConnectors()); - Map arguments = setupListeningConnector(connector, classToExecute, classPath); - - VirtualMachine vm; - try { - display("Listening for connection from debugee"); - String address = connector.startListening(arguments); - String javaCmdLine = makeCommandLineString(classToExecute, address, "\""); - display("Starting manual java process:\n\t" + javaCmdLine); - ManualLaunchedDebugee debugee = startManualDebugee(javaCmdLine); - display("Waiting for connection from debugee"); - vm = connector.accept(arguments); - display("Debugee attached"); - connector.stopListening(arguments); - debugee.setupVM(vm); - return debugee; - } catch (IllegalConnectorArgumentsException e) { - e.printStackTrace(log.getOutStream()); - throw new TestBug("Wrong connector arguments used to listen debuggee VM:\n\t" + e); - } catch (IOException e) { - e.printStackTrace(log.getOutStream()); - throw new Failure("Caught exception while listening to debugee VM:\n\t" + e); - } - } - // -------------------------------------------------- // /** @@ -923,33 +705,6 @@ protected Debugee startLocalDebugee(String[] cmdArgs) { return makeLocalDebugee(process); } - /** - * Launch remote debuggee process with specified command line arguments - * and make initial Debugee mirror. - */ - protected RemoteLaunchedDebugee startRemoteDebugee(String[] cmdArgs) { - try { - launchRemoteProcess(cmdArgs); - } catch (IOException e) { - e.printStackTrace(log.getOutStream()); - throw new Failure("Caught exception while launching remote debuggee VM process:\n\t" - + e); - } - - RemoteLaunchedDebugee debugee = new RemoteLaunchedDebugee(this); - return debugee; - } - - /** - * Launch manual debuggee process with specified command line arguments - * and make initial Debugee mirror. - */ - protected ManualLaunchedDebugee startManualDebugee(String cmd) { - ManualLaunchedDebugee debugee = new ManualLaunchedDebugee(this); - debugee.launchDebugee(cmd); - return debugee; - } - public static String readVMStartExceptionOutput(VMStartException e, PrintStream log) { StringBuffer msg = new StringBuffer(); try (InputStream is = e.process().getInputStream()) { @@ -998,287 +753,4 @@ private static byte[] readAllBytes(InputStream is) throws IOException { return (capacity == nread) ? buf : Arrays.copyOf(buf, nread); } -} - - -/** - * Mirror of locally launched debugee. - */ -final class LocalLaunchedDebugee extends Debugee { - - /** Enwrap the locally started VM process. */ - public LocalLaunchedDebugee (Process process, Binder binder) { - super(binder); - this.process = process; - checkTermination = true; - } - - // ---------------------------------------------- // - - /** Return exit status of the debugee VM. */ - public int getStatus () { - return process.exitValue(); - } - - /** Check whether the debugee VM has been terminated. */ - public boolean terminated () { - if (process == null) - return true; - - try { - int value = process.exitValue(); - return true; - } catch (IllegalThreadStateException e) { - return false; - } - } - - // ---------------------------------------------- // - - /** Kill the debugee VM. */ - protected void killDebugee () { - super.killDebugee(); - if (!terminated()) { - log.display("Killing debugee VM process"); - process.destroy(); - } - } - - /** Wait until the debugee VM shutdown or crash. */ - protected int waitForDebugee () throws InterruptedException { - int code = process.waitFor(); - return code; - } - - /** Get a pipe to write to the debugee's stdin stream. */ - protected OutputStream getInPipe () { - return process.getOutputStream(); - } - - /** Get a pipe to read the debugee's stdout stream. */ - protected InputStream getOutPipe () { - return process.getInputStream(); - } - - /** Get a pipe to read the debugee's stderr stream. */ - protected InputStream getErrPipe () { - return process.getErrorStream(); - } -} - - -/** - * Mirror of remotely launched debugee. - */ -final class RemoteLaunchedDebugee extends Debugee { - - /** Enwrap the remotely started VM process. */ - public RemoteLaunchedDebugee (Binder binder) { - super(binder); - } - - // ---------------------------------------------- // - - /** Return exit status of the debugee VM. */ - public int getStatus () { - return binder.getRemoteProcessStatus(); - } - - /** Check whether the debugee VM has been terminated. */ - public boolean terminated () { - return binder.isRemoteProcessTerminated(); - } - - // ---------------------------------------------- // - - /** Kill the debugee VM. */ - protected void killDebugee () { - super.killDebugee(); - if (!terminated()) { - binder.killRemoteProcess(); - } - } - - /** Wait until the debugee VM shutdown or crash. */ - protected int waitForDebugee () { - return binder.waitForRemoteProcess(); - } - - /** Get a pipe to write to the debugee's stdin stream. */ - protected OutputStream getInPipe () { - return null; - } - - /** Get a pipe to read the debugee's stdout stream. */ - protected InputStream getOutPipe () { - return null; - } - - /** Get a pipe to read the debugee's stderr stream. */ - protected InputStream getErrPipe () { - return null; - } - - public void redirectStdout(OutputStream out) { - } - - public void redirectStdout(Log log, String prefix) { - } - - public void redirectStderr(OutputStream out) { - } - - public void redirectStderr(Log log, String prefix) { - } -} - - -/** - * Mirror of manually launched debugee. - */ -final class ManualLaunchedDebugee extends Debugee { - /** Enwrap the manually started VM process. */ - public ManualLaunchedDebugee (Binder binder) { - super(binder); - makeInputReader(); - } - - // ---------------------------------------------- // - - private int exitCode = 0; - private boolean finished = false; - private static BufferedReader bin = null; - - public void launchDebugee(String commandLine) { - makeInputReader(); - - putMessage("Launch target VM using such command line:\n" - + commandLine); - String answer = askQuestion("Has the VM successfully started? (yes/no)", "yes"); - for ( ; ; ) { - if (answer.equals("yes")) - break; - if (answer.equals("no")) - throw new Failure ("Unable to manually launch debugee VM"); - answer = askQuestion("Wrong answer. Please type yes or no", "yes"); - } - } - - private static void makeInputReader() { - if (bin == null) { - bin = new BufferedReader(new InputStreamReader(System.in)); - } - } - - private static void destroyInputReader() { - if (bin != null) { - try { - bin.close(); - } catch (IOException e) { -// e.printStackTrace(log.getOutStream()); - throw new Failure("Caught exception while closing input stream:\n\t" + e); - } - bin = null; - } - } - - private static void putMessage(String msg) { - System.out.println("\n>>> " + msg); - } - - private static String askQuestion(String question, String defaultAnswer) { - try { - System.out.print("\n>>> " + question); - System.out.print(" [" + defaultAnswer + "] "); - System.out.flush(); - String answer = bin.readLine(); - if (answer.equals("")) - return defaultAnswer; - return answer; - } catch (IOException e) { -// e.printStackTrace(log.getOutStream()); - throw new Failure("Caught exception while reading answer:\n\t" + e); - } - } - - /** Return exit status of the debugee VM. */ - public int getStatus () { - if (! finished) { - throw new Failure("Unable to get status of debugee VM: process still alive"); - } - return exitCode; - } - - /** Check whether the debugee VM has been terminated. */ - public boolean terminated () { - return finished; - } - - // ---------------------------------------------- // - - /** Kill the debugee VM. */ - protected void killDebugee () { - super.killDebugee(); - if (!terminated()) { - putMessage("Kill launched VM"); - String answer = askQuestion("Has the VM successfully terminated? (yes/no)", "yes"); - for ( ; ; ) { - if (answer.equals("yes")) { - finished = true; - break; - } - if (answer.equals("no")) - throw new Failure ("Unable to manually kill debugee VM"); - answer = askQuestion("Wrong answer. Please type yes or no", "yes"); - } - } - } - - /** Wait until the debugee VM shutdown or crash. */ - protected int waitForDebugee () { - putMessage("Wait for launched VM to exit."); - String answer = askQuestion("What is VM exit code?", "95"); - for ( ; ; ) { - try { - exitCode = Integer.parseInt(answer); - break; - } catch (NumberFormatException e) { - answer = askQuestion("Wrong answer. Please type integer value", "95"); - } - } - finished = true; - return exitCode; - } - - /** Get a pipe to write to the debugee's stdin stream. */ - protected OutputStream getInPipe () { - return null; - } - - /** Get a pipe to read the debugee's stdout stream. */ - protected InputStream getOutPipe () { - return null; - } - - /** Get a pipe to read the debugee's stderr stream. */ - protected InputStream getErrPipe () { - return null; - } - - public void redirectStdout(OutputStream out) { - } - - public void redirectStdout(Log log, String prefix) { - } - - public void redirectStderr(OutputStream out) { - } - - public void redirectStderr(Log log, String prefix) { - } - - public void close() { - destroyInputReader(); - super.close(); - } -} +} \ No newline at end of file diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jdi/Debugee.java b/test/hotspot/jtreg/vmTestbase/nsk/share/jdi/Debugee.java index dd6c8a1b82dd..6b4f65bc625a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jdi/Debugee.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jdi/Debugee.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -47,7 +47,7 @@ * @see Binder * @see DebugeeProcess */ -abstract public class Debugee extends DebugeeProcess { +public class Debugee extends DebugeeProcess { /** * Mirror of the debugee VM. This must be initialized by every @@ -68,6 +68,13 @@ protected Debugee (Binder binder) { this.argumentHandler = (ArgumentHandler)binder.getArgumentHandler(); } + protected Debugee (Process process, Binder binder) { + super(binder); + this.process = process; + this.binder = binder; + this.argumentHandler = (ArgumentHandler)binder.getArgumentHandler(); + } + /** Setup Debugee object with given VM mirror. */ public void setupVM(VirtualMachine vm) { if (this.vm != null) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jdi/MonitorEnterExecutor.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/jdi/MonitorEnterExecutor.cpp index f85bbeeda187..5988e55ad798 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jdi/MonitorEnterExecutor.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jdi/MonitorEnterExecutor.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. */ #include "jni.h" -#include "nsk_tools.h" +#include "nsk_tools.hpp" extern "C" { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jdwp/Binder.java b/test/hotspot/jtreg/vmTestbase/nsk/share/jdwp/Binder.java index 698ac2cbe890..0a15c23b004a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jdwp/Binder.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jdwp/Binder.java @@ -98,13 +98,8 @@ public Debugee bindToDebugee (String classToExecute) { prepareForPipeConnection(argumentHandler); - if (argumentHandler.isLaunchedRemotely()) { - connectToBindServer(classToExecute); - debugee = launchDebugee(classToExecute); - } else { - debugee = launchDebugee(classToExecute); - debugee.redirectOutput(log); - } + debugee = launchDebugee(classToExecute); + debugee.redirectOutput(log); Transport transport = debugee.connect(); @@ -117,334 +112,16 @@ public Debugee bindToDebugee (String classToExecute) { public Debugee launchDebugee (String classToExecute) { try { - - if (argumentHandler.isLaunchedLocally()) { - LocalLaunchedDebugee debugee = new LocalLaunchedDebugee(this); - String address = debugee.prepareTransport(argumentHandler); - if (address == null) - address = makeTransportAddress(); - String[] argsArray = makeCommandLineArgs(classToExecute, address); - debugee.launch(argsArray); - return debugee; - } - - if (argumentHandler.isLaunchedRemotely()) { - RemoteLaunchedDebugee debugee = new RemoteLaunchedDebugee(this); - String address = debugee.prepareTransport(argumentHandler); - if (address == null) - address = makeTransportAddress(); - String[] argsArray = makeCommandLineArgs(classToExecute, address); - debugee.launch(argsArray); - return debugee; - } - - if (argumentHandler.isLaunchedManually()) { - ManualLaunchedDebugee debugee = new ManualLaunchedDebugee(this); - String address = debugee.prepareTransport(argumentHandler); - if (address == null) - address = makeTransportAddress(); - String cmdLine = makeCommandLineString(classToExecute, address, "\""); - debugee.launch(cmdLine); - return debugee; - } - - throw new TestBug("Unexpected launching mode: " - + argumentHandler.getLaunchMode()); + Debugee debugee = new Debugee(this); + String address = debugee.prepareTransport(argumentHandler); + if (address == null) + address = makeTransportAddress(); + String[] argsArray = makeCommandLineArgs(classToExecute, address); + debugee.launch(argsArray); + return debugee; } catch (IOException e) { e.printStackTrace(log.getOutStream()); throw new Failure("Caught exception while launching debugee:\n\t" + e); } } - -} - -/** - * Mirror of locally launched debugee. - */ -final class LocalLaunchedDebugee extends Debugee { - - /** Enwrap the existing VM mirror. */ - public LocalLaunchedDebugee (Binder binder) { - super(binder); - checkTermination = true; - } - - // ---------------------------------------------- // - - public void launch(String[] args) throws IOException { - String cmdLine = ArgumentHandler.joinArguments(args, "\""); - display("Starting java process:\n" + cmdLine); - process = binder.launchProcess(args); - } - - /** Return exit status of the debugee VM. */ - public int getStatus () { - return process.exitValue(); - } - - /** Check whether the debugee VM has been terminated. */ - public boolean terminated () { - if (process == null) - return true; - - try { - int value = process.exitValue(); - return true; - } catch (IllegalThreadStateException e) { - return false; - } - } - - // ---------------------------------------------- // - - /** Kill the debugee VM. */ - protected void killDebugee () { - super.killDebugee(); - if (!terminated()) { - log.display("Killing debugee VM process"); - process.destroy(); - } - } - - /** Wait until the debugee VM shutdown or crash. */ - protected int waitForDebugee () throws InterruptedException { - return process.waitFor(); - } - - /** Get a pipe to write to the debugee's stdin stream. */ - protected OutputStream getInPipe () { - return process.getOutputStream(); - } - - /** Get a pipe to read the debugee's stdout stream. */ - protected InputStream getOutPipe () { - return process.getInputStream(); - } - - /** Get a pipe to read the debugee's stderr stream. */ - protected InputStream getErrPipe () { - return process.getErrorStream(); - } -} - - -/** - * Mirror of remotely launched debugee. - */ -final class RemoteLaunchedDebugee extends Debugee { - - /** Enwrap the existing VM mirror. */ - public RemoteLaunchedDebugee (Binder binder) { - super(binder); - } - - // ---------------------------------------------- // - - public void launch(String[] args) throws IOException { - String cmdLine = ArgumentHandler.joinArguments(args, "\""); - display("Starting remote java process:\n" + cmdLine); - binder.launchRemoteProcess(args); - } - - /** Return exit status of the debugee VM. */ - public int getStatus () { - return binder.getRemoteProcessStatus(); - } - - /** Check whether the debugee VM has been terminated. */ - public boolean terminated () { - return binder.isRemoteProcessTerminated(); - } - - // ---------------------------------------------- // - - /** Kill the debugee VM. */ - protected void killDebugee () { - super.killDebugee(); - if (!terminated()) { - log.display("Killing debugee VM process"); - binder.killRemoteProcess(); - } - } - - /** Wait until the debugee VM shutdown or crash. */ - protected int waitForDebugee () { - return binder.waitForRemoteProcess(); - } - - /** Get a pipe to write to the debugee's stdin stream. */ - protected OutputStream getInPipe () { - return null; - } - - /** Get a pipe to read the debugee's stdout stream. */ - protected InputStream getOutPipe () { - return null; - } - - /** Get a pipe to read the debugee's stderr stream. */ - protected InputStream getErrPipe () { - return null; - } - - public void redirectStdout(OutputStream out) { - } - - public void redirectStdout(Log log, String prefix) { - } - - public void redirectStderr(OutputStream out) { - } - - public void redirectStderr(Log log, String prefix) { - } -} - - -/** - * Mirror of manually launched debugee. - */ -final class ManualLaunchedDebugee extends Debugee { - - private int exitCode = 0; - private boolean finished = false; - private static BufferedReader bin = new BufferedReader(new InputStreamReader(System.in)); - - /** Enwrap the existing VM mirror. */ - public ManualLaunchedDebugee (Binder binder) { - super(binder); - } - - // ---------------------------------------------- // - - public void launch(String commandLine) throws IOException { - putMessage("Launch target VM using such command line:\n" - + commandLine); - String answer = askQuestion("Has the VM successfully started? (yes/no)", "yes"); - for ( ; ; ) { - if (answer.equals("yes")) - break; - if (answer.equals("no")) - throw new Failure ("Unable to manually launch debugee VM"); - answer = askQuestion("Wrong answer. Please type yes or no", "yes"); - } - } - - private void putMessage(String msg) { - System.out.println("\n>>> " + msg); - } - - private String askQuestion(String question, String defaultAnswer) { - try { - System.out.print("\n>>> " + question); - System.out.print(" [" + defaultAnswer + "] "); - System.out.flush(); - String answer = bin.readLine(); - if (answer.equals("")) - return defaultAnswer; - return answer; - } catch (IOException e) { - e.printStackTrace(log.getOutStream()); - throw new Failure("Caught exception while reading answer:\n\t" + e); - } - } - - /** Return exit status of the debugee VM. */ - public int getStatus () { - if (! terminated()) { - throw new Failure("Unable to get status of debugee VM: process still alive"); - } - return exitCode; - } - - /** Check whether the debugee VM has been terminated. */ - public boolean terminated () { - if(! finished) { - String answer = askQuestion("Has the VM exited?", "no"); - for ( ; ; ) { - if (answer.equals("no")) - return false; - if (answer.equals("yes")) { - finished = true; - waitForDebugee(); - break; - } - answer = askQuestion("Wrong answer. Please type yes or no", "yes"); - } - } - return finished; - } - - // ---------------------------------------------- // - - /** Kill the debugee VM. */ - protected void killDebugee () { - super.killDebugee(); - if (!terminated()) { - putMessage("Kill launched VM"); - String answer = askQuestion("Has the VM successfully terminated? (yes/no)", "yes"); - for ( ; ; ) { - if (answer.equals("yes")) { - finished = true; - break; - } - if (answer.equals("no")) - throw new Failure ("Unable to manually kill debugee VM"); - answer = askQuestion("Wrong answer. Please type yes or no", "yes"); - } - } - } - - /** Wait until the debugee VM shutdown or crash. */ - protected int waitForDebugee () { - putMessage("Wait for launched VM to exit."); - String answer = askQuestion("What is VM exit code?", "95"); - for ( ; ; ) { - try { - exitCode = Integer.parseInt(answer); - break; - } catch (NumberFormatException e) { - answer = askQuestion("Wrong answer. Please type integer value", "95"); - } - } - finished = true; - return exitCode; - } - - /** Get a pipe to write to the debugee's stdin stream. */ - protected OutputStream getInPipe () { - return null; - } - - /** Get a pipe to read the debugee's stdout stream. */ - protected InputStream getOutPipe () { - return null; - } - - /** Get a pipe to read the debugee's stderr stream. */ - protected InputStream getErrPipe () { - return null; - } - - public void redirectStdout(OutputStream out) { - } - - public void redirectStdout(Log log, String prefix) { - } - - public void redirectStderr(OutputStream out) { - } - - public void redirectStderr(Log log, String prefix) { - } - - public void close() { - try { - bin.close(); - } catch (IOException e) { - log.display("WARNING: Caught IOException while closing InputStream"); - } - bin = null; - super.close(); - } -} +} \ No newline at end of file diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jdwp/Debugee.java b/test/hotspot/jtreg/vmTestbase/nsk/share/jdwp/Debugee.java index ba1b4129cc79..ef95ee885604 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jdwp/Debugee.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jdwp/Debugee.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -46,7 +46,7 @@ * @see Transport * @see DebugeeProcess */ -abstract public class Debugee extends DebugeeProcess { +public class Debugee extends DebugeeProcess { /** Binder that creates this debugee. */ protected Binder binder = null; @@ -63,6 +63,12 @@ protected Debugee (Binder binder) { prefix = "Debugee> "; } + public void launch(String[] args) throws IOException { + String cmdLine = ArgumentHandler.joinArguments(args, "\""); + display("Starting java process:\n" + cmdLine); + process = binder.launchProcess(args); + } + /** Return Binder of the debugee object. */ public Binder getBinder() { return binder; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jni/ExceptionCheckingJniEnv.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/jni/ExceptionCheckingJniEnv.cpp index f9a232fd6791..65f087dbcd66 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jni/ExceptionCheckingJniEnv.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jni/ExceptionCheckingJniEnv.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018, 2019, Google and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -27,7 +27,7 @@ #include #include "ExceptionCheckingJniEnv.hpp" -#include "nsk_tools.h" +#include "nsk_tools.hpp" namespace { @@ -35,8 +35,8 @@ static const char* get_dirname(const char* fullname) { const char* p; const char* base = fullname;; - if (fullname == NULL) { - return NULL; + if (fullname == nullptr) { + return nullptr; } for (p = fullname; *p != '\0'; p++) { @@ -52,7 +52,7 @@ class JNIVerifier { public: JNIVerifier(ExceptionCheckingJniEnv *env, const char* base_message, int line, const char* file) - : _env(env), _base_message(base_message), _error_message(NULL), + : _env(env), _base_message(base_message), _error_message(nullptr), _line(line), _file(get_dirname(file)) { } @@ -61,7 +61,7 @@ class JNIVerifier { JNIVerifier(ExceptionCheckingJniEnv *env, const char* base_message, U parameter, int line, const char* file) - : _env(env), _base_message(base_message), _error_message(NULL), + : _env(env), _base_message(base_message), _error_message(nullptr), _line(line), _file(get_dirname(file)) { PrintPreCall(parameter); } @@ -71,7 +71,7 @@ class JNIVerifier { U parameter1, V parameter2, int line, const char* file) - : _env(env), _base_message(base_message), _error_message(NULL), + : _env(env), _base_message(base_message), _error_message(nullptr), _line(line), _file(get_dirname(file)) { PrintPreCall(parameter1, parameter2); } @@ -80,7 +80,7 @@ class JNIVerifier { JNIVerifier(ExceptionCheckingJniEnv *env, const char* base_message, U parameter1, V parameter2, W parameter3, int line, const char* file) - : _env(env), _base_message(base_message), _error_message(NULL), + : _env(env), _base_message(base_message), _error_message(nullptr), _line(line), _file(get_dirname(file)) { PrintPreCall(parameter1, parameter2, parameter3); } @@ -93,7 +93,7 @@ class JNIVerifier { _error_message = "internal error"; } - if (_error_message != NULL) { + if (_error_message != nullptr) { GenerateErrorMessage(); } } @@ -173,7 +173,7 @@ class JNIVerifier { len += MAX_INTEGER_DIGITS + 1; char* full_message = (char*) malloc(len); - if (full_message == NULL) { + if (full_message == nullptr) { _env->HandleError(_error_message); return; } @@ -199,8 +199,8 @@ class JNIVerifier { } T ResultNotNull(T ptr) { - if (ptr == NULL) { - _error_message = "Return is NULL"; + if (ptr == nullptr) { + _error_message = "Return is null"; } return ptr; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jni/ExceptionCheckingJniEnv.hpp b/test/hotspot/jtreg/vmTestbase/nsk/share/jni/ExceptionCheckingJniEnv.hpp index af6c04899915..2db7177c8f7d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jni/ExceptionCheckingJniEnv.hpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jni/ExceptionCheckingJniEnv.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2018, 2019, Google and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * @@ -36,8 +36,8 @@ * * ... JNIEnv* env ... * jclass klass = env->GetObjectClass(o); - * if (klass == NULL) { - * printf("Error: GetObjectClass returned NULL\n"); + * if (klass == nullptr) { + * printf("Error: GetObjectClass returned null\n"); * return; * } * if (env->ExceptionCheck()) { @@ -48,7 +48,7 @@ * ... ExceptionCheckingJniEnv* env ... * jclass klass = env->GetObjectClass(o, TRACE_JNI_CALL); * - * Where now the JNI Exception checking and the NULL return checking are done + * Where now the JNI Exception checking and the null return checking are done * internally and will perform whatever action the ErrorHandler requires. * * Note the TRACE_JNI_CALL parameter that allows to trace where the call is diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jni/JNIreferences.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/jni/JNIreferences.cpp index 7fa0f0d15ab7..21285d328255 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jni/JNIreferences.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jni/JNIreferences.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,13 +22,13 @@ */ #include "jni.h" #include -#include "nsk_tools.h" +#include "nsk_tools.hpp" extern "C" { -static jobject* globalReferences = NULL; -static jweak* weakReferences = NULL; +static jobject* globalReferences = nullptr; +static jweak* weakReferences = nullptr; JNIEXPORT jint JNICALL Java_nsk_share_ReferringObject_createJNIGlobalReferenceNative(JNIEnv *env, @@ -37,19 +37,19 @@ Java_nsk_share_ReferringObject_createJNIGlobalReferenceNative(JNIEnv *env, jint i; jint result = -1; - if (globalReferences == NULL) + if (globalReferences == nullptr) { globalReferences = (jobject*)malloc(sizeof(jobject) * maxJNIGlobalReferences); - if (globalReferences == NULL) + if (globalReferences == nullptr) { - NSK_COMPLAIN0("malloc return NULL\n"); + NSK_COMPLAIN0("malloc return null\n"); return -1; } for (i = 0; i < maxJNIGlobalReferences; i++) { - globalReferences[i] = NULL; + globalReferences[i] = nullptr; } } @@ -57,17 +57,17 @@ Java_nsk_share_ReferringObject_createJNIGlobalReferenceNative(JNIEnv *env, { jobject reference = globalReferences[i]; - if (reference == NULL) + if (reference == nullptr) { reference = env->NewGlobalRef(object); - if (reference == NULL) + if (reference == nullptr) { - NSK_COMPLAIN0("NewGlobalRef return NULL\n"); + NSK_COMPLAIN0("NewGlobalRef return null\n"); env->ThrowNew( env->FindClass("nsk/share/TestJNIError"), - "NewGlobalRef return NULL"); + "NewGlobalRef return null"); } globalReferences[i] = reference; @@ -87,18 +87,18 @@ Java_nsk_share_ReferringObject_deleteJNIGlobalReferenceNative(JNIEnv *env, { jobject reference = globalReferences[index]; - if (reference == NULL) + if (reference == nullptr) { - NSK_COMPLAIN1("globalReferences[%d] = NULL, possible wrong index is passed\n", index); + NSK_COMPLAIN1("globalReferences[%d] = null, possible wrong index is passed\n", index); env->ThrowNew( env->FindClass("nsk/share/TestBug"), - "Requested globalReferences[] element is NULL, possible wrong index is passed"); + "Requested globalReferences[] element is null, possible wrong index is passed"); } env->DeleteGlobalRef(reference); - globalReferences[index] = NULL; + globalReferences[index] = nullptr; } @@ -109,13 +109,13 @@ Java_nsk_share_ReferringObject_createJNILocalReferenceNative(JNIEnv *env, jobject reference = env->NewLocalRef(object); jclass klass; - if (reference == NULL) + if (reference == nullptr) { - NSK_COMPLAIN0("NewLocalRef return NULL\n"); + NSK_COMPLAIN0("NewLocalRef return null\n"); env->ThrowNew( env->FindClass("nsk/share/TestJNIError"), - "NewLocalRef return NULL"); + "NewLocalRef return null"); } klass = env->GetObjectClass(createWicket); @@ -136,20 +136,20 @@ Java_nsk_share_ReferringObject_createJNIWeakReferenceNative(JNIEnv *env, jint i; jint result = -1; - if (weakReferences == NULL) + if (weakReferences == nullptr) { weakReferences = (jweak*)malloc(sizeof(jweak) * maxJNIWeakReferences); - if (weakReferences == NULL) + if (weakReferences == nullptr) { - NSK_COMPLAIN0("malloc return NULL\n"); + NSK_COMPLAIN0("malloc return null\n"); return -1; } for (i = 0; i < maxJNIWeakReferences; i++) { - weakReferences[i] = NULL; + weakReferences[i] = nullptr; } } @@ -157,17 +157,17 @@ Java_nsk_share_ReferringObject_createJNIWeakReferenceNative(JNIEnv *env, { jobject reference = weakReferences[i]; - if (reference == NULL) + if (reference == nullptr) { reference = env->NewWeakGlobalRef(object); - if (reference == NULL) + if (reference == nullptr) { - NSK_COMPLAIN0("NewWeakGlobalRef return NULL\n"); + NSK_COMPLAIN0("NewWeakGlobalRef return null\n"); env->ThrowNew( env->FindClass("nsk/share/TestJNIError"), - "NewWeakGlobalRef return NULL"); + "NewWeakGlobalRef return null"); } weakReferences[i] = reference; @@ -187,16 +187,16 @@ Java_nsk_share_ReferringObject_deleteJNIWeakReferenceNative(JNIEnv *env, { jweak reference = weakReferences[index]; - if (reference == NULL) + if (reference == nullptr) { - NSK_COMPLAIN1("weakReferences[%d] = NULL, possible wrong index is passed\n", index); + NSK_COMPLAIN1("weakReferences[%d] = null, possible wrong index is passed\n", index); env->ThrowNew( env->FindClass("nsk/share/TestBug"), - "Requested weakReferences[] element is NULL, possible wrong index is passed"); + "Requested weakReferences[] element is null, possible wrong index is passed"); } - if (env->IsSameObject(reference, NULL) == JNI_TRUE) + if (env->IsSameObject(reference, nullptr) == JNI_TRUE) { NSK_COMPLAIN0("TEST BUG: Weak reference was collected\n"); @@ -207,7 +207,7 @@ Java_nsk_share_ReferringObject_deleteJNIWeakReferenceNative(JNIEnv *env, env->DeleteWeakGlobalRef(reference); - weakReferences[index] = NULL; + weakReferences[index] = nullptr; } } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jni/README b/test/hotspot/jtreg/vmTestbase/nsk/share/jni/README index 0da5b5704394..ab76d94ab92b 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jni/README +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jni/README @@ -1,4 +1,4 @@ -Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. +Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,8 @@ This directory contains source files of testbase_nsk JNI framework, which provides support for JNI tests and accessing JNI environment. Source files: - jni_tools.h - jni_tools.c + jni_tools.hpp + jni_tools.cpp Naming conventions: macroses: NSK_JNI_* @@ -34,7 +34,7 @@ which provides support for JNI tests and accessing JNI environment. --------------------------------------------------------------------------------- -jni_tools.h +jni_tools.hpp Provides functions and macroses for invocation of JNI functions and checking JNI errors and pending exceptions: diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jni/jni_tools.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/jni/jni_tools.cpp index f8b9df264c97..c6059e18a497 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jni/jni_tools.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jni/jni_tools.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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 @@ -40,8 +40,8 @@ /*************************************************************/ -#include "nsk_tools.h" -#include "jni_tools.h" +#include "nsk_tools.hpp" +#include "jni_tools.hpp" /*************************************************************/ @@ -51,7 +51,7 @@ int nsk_jni_check_exception(JNIEnv* jni, const char file[], int line) jthrowable throwable; NSK_TRACE(throwable = jni->ExceptionOccurred()); - if (throwable != NULL) { + if (throwable != nullptr) { nsk_lcomplain(file, line, "Exception in JNI call (cleared):\n"); NSK_TRACE(jni->ExceptionDescribe()); NSK_TRACE(jni->ExceptionClear()); @@ -107,7 +107,7 @@ void mssleep(long millis) { struct timeval timeout; timeout.tv_sec = millis / 1000; timeout.tv_usec = (millis % 1000) * 1000; - select(0, NULL, NULL, NULL, &timeout); + select(0, nullptr, nullptr, nullptr, &timeout); #endif } @@ -131,7 +131,7 @@ JavaVMOption* jni_create_vmoptions(int size, char *args[], int argsCnt) { int i; - JavaVMOption *options = NULL; + JavaVMOption *options = nullptr; if (size <= 0) return options; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jni/jni_tools.h b/test/hotspot/jtreg/vmTestbase/nsk/share/jni/jni_tools.hpp similarity index 97% rename from test/hotspot/jtreg/vmTestbase/nsk/share/jni/jni_tools.h rename to test/hotspot/jtreg/vmTestbase/nsk/share/jni/jni_tools.hpp index 07153e9cdd44..f8f74d152ade 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jni/jni_tools.h +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jni/jni_tools.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,11 +30,11 @@ /*************************************************************/ -#include "nsk_tools.h" +#include "nsk_tools.hpp" /*************************************************************/ -#include "jvmti_common.h" +#include "jvmti_common.hpp" /* printf format specifier for jlong */ #ifdef _WIN32 diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jpda/BindServer.java b/test/hotspot/jtreg/vmTestbase/nsk/share/jpda/BindServer.java index bd57206302b9..2ed334e03868 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jpda/BindServer.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jpda/BindServer.java @@ -28,7 +28,6 @@ import java.util.*; import nsk.share.*; -import nsk.share.jpda.*; /** * BindServer is an utility to perform JPDA tests @@ -58,7 +57,7 @@ * @see DebugeeBinder * @see DebugeeArgumentHandler */ -public class BindServer implements Finalizable { +public final class BindServer { /** Version of BindServer implementation. */ public static final long VERSION = 2; @@ -88,7 +87,6 @@ public class BindServer implements Finalizable { private static String pathConvertions[][] = null; - private ListeningThread listeningThread = null; private int totalRequests = 0; private int acceptedRequests = 0; @@ -149,8 +147,6 @@ private int runIt(String argv[], PrintStream out) { log = new Log(out, argHandler); logger = new Log.Logger(log, ""); - registerCleanup(); - logger.trace(TRACE_LEVEL_THREADS, "BindServer: starting main thread"); logger.display("Listening to port: " + argHandler.getBindPortNumber()); @@ -178,45 +174,39 @@ private int runIt(String argv[], PrintStream out) { BufferedReader stdIn = new BufferedReader( new InputStreamReader(System.in)); + try (ListeningThread listeningThread = new ListeningThread(this)) { + listeningThread.bind(); + listeningThread.start(); - listeningThread = new ListeningThread(this); - listeningThread.bind(); - listeningThread.start(); - - System.out.println("\n" - + "BindServer started" + "\n" - + "Type \"exit\" to shut down BindServer" - + "\n"); + System.out.println("\n" + + "BindServer started" + "\n" + + "Type \"exit\" to shut down BindServer" + + "\n"); - for (;;) { - try { - String userInput = stdIn.readLine(); - if (userInput == null || userInput.equals("exit") - || userInput.equals("quit")) { - logger.display("Shutting down BindServer"); - stdIn.close(); - stdIn = null; - break; - } else if (userInput.trim().equals("")) { - continue; - } else { - System.out.println("ERROR: Unknown command: " + userInput); + for (; ; ) { + try { + String userInput = stdIn.readLine(); + if (userInput == null || userInput.equals("exit") + || userInput.equals("quit")) { + logger.display("Shutting down BindServer"); + stdIn.close(); + stdIn = null; + break; + } else if (userInput.trim().equals("")) { + continue; + } else { + System.out.println("ERROR: Unknown command: " + userInput); + } + } catch (IOException e) { + e.printStackTrace(log.getOutStream()); + throw new Failure("Caught exception while reading console command:\n\t" + + e); } - } catch(IOException e) { - e.printStackTrace(log.getOutStream()); - throw new Failure("Caught exception while reading console command:\n\t" - + e); } - } - printSummary(System.out); + printSummary(System.out); - logger.trace(TRACE_LEVEL_THREADS, "BindServer: exiting main thread"); - try { - cleanup(); - } catch (Throwable e) { - e.printStackTrace(log.getOutStream()); - logger.complain("Caught exception while finalization of BindServer:\n\t" + e); + logger.trace(TRACE_LEVEL_THREADS, "BindServer: exiting main thread"); } return PASSED; @@ -387,38 +377,6 @@ private static void waitInterruptThread(Thread thr) { waitInterruptThread(thr, THREAD_TIMEOUT); } - /** - * Close BindServer by finishing all threads and closing - * all conections. - */ - public synchronized void close() { - if (listeningThread != null) { - listeningThread.close(); - listeningThread = null; - } - } - - /** - * Make finalization of BindServer object by invoking - * method close(). - * - * @see #close() - */ - @Override - public void cleanup() { - close(); - } - - /** - * Make finalization of BindServer object at program exit - * by invoking method cleanup(). - * - */ - public void finalizeAtExit() throws Throwable { - cleanup(); - logger.trace(TRACE_LEVEL_THREADS, "BindServer: finalization at exit completed"); - } - ///////// Thread listening a TCP/IP socket ////////// /** @@ -427,7 +385,7 @@ public void finalizeAtExit() throws Throwable { * * @see ServingThread */ - private static class ListeningThread extends Thread { + private static class ListeningThread extends Thread implements AutoCloseable { private volatile boolean shouldStop = false; private volatile boolean closed = false; @@ -673,23 +631,29 @@ private void closeConnection() { /** * Close thread by closing all connections and waiting - * foor thread finished. + * for thread to finish. * * @see #closeConnection() */ + @Override public synchronized void close() { if (closed) { return; } - closeHostConnection(); - if (servingThread != null) { - servingThread.close(); - servingThread = null; + try { + closeHostConnection(); + if (servingThread != null) { + servingThread.close(); + servingThread = null; + } + waitForThread(THREAD_TIMEOUT); + closeConnection(); + closed = true; + logger.trace(TRACE_LEVEL_THREADS, "ListeningThread closed"); + } catch (Throwable e) { + e.printStackTrace(log.getOutStream()); + logger.complain("Caught exception while closing ListeningThread:\n\t" + e); } - waitForThread(THREAD_TIMEOUT); - closeConnection(); - closed = true; - logger.trace(TRACE_LEVEL_THREADS, "ListeningThread closed"); } } // ListeningThread diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jpda/DebugeeArgumentHandler.java b/test/hotspot/jtreg/vmTestbase/nsk/share/jpda/DebugeeArgumentHandler.java index 98f11a426eaa..72461a523099 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jpda/DebugeeArgumentHandler.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jpda/DebugeeArgumentHandler.java @@ -57,8 +57,6 @@ * (this works only with -connector=listening and -transport=socket) *

  • -debugee.suspend=[yes|no|default] - * should debugee start in suspend mode or not - *
  • -debugee.launch=[local|remote|manual] - - * launch and bind to debugee VM locally, remotely (via BindSever) or manually *
  • -debugee.vmhome=<path> - * path to JDK used for launching debugee VM *
  • -debugee.vmkind=<name> - @@ -275,11 +273,8 @@ public boolean isDefaultDebugeeSuspendMode() { * @see #isDefaultDebugeeSuspendMode() */ public boolean willDebugeeSuspended() { - if (isLaunchedLocally()) { - String mode = getDebugeeSuspendMode(); - return mode.equals("no"); - } - return true; + String mode = getDebugeeSuspendMode(); + return mode.equals("no"); } private boolean pipePortInited = false; @@ -337,54 +332,6 @@ public void setPipePortNumber(int port) { setOption("-", "pipe.port", value); } - /** - * Return debugee VM launching mode, specified by - * -launch.mode command line option, or - * "local" string by default. - * - * Possible values for this option are: - *
      - *
    • "local" - *
    • "remote" - *
    • "manual" - *
    - * - * @see #isLaunchedLocally() - * @see #isLaunchedRemotely() - * @see #isLaunchedManually() - * @see #setRawArguments(String[]) - */ - public String getLaunchMode() { - return options.getProperty("debugee.launch", "local"); - } - - /** - * Return true if debugee should be launched locally. - * - * @see #getLaunchMode() - */ - public boolean isLaunchedLocally() { - return getLaunchMode().equals("local"); - } - - /** - * Return true if debugee should be launched remotely via - * BindServer. - * - * @see #getLaunchMode() - */ - public boolean isLaunchedRemotely() { - return getLaunchMode().equals("remote"); - } - - /** - * Return true if debugee should be launched manually by user. - * - * @see #getLaunchMode() - */ - public boolean isLaunchedManually() { - return getLaunchMode().equals("manual"); - } /** * Return additional options for launching debugee VM, specified by @@ -710,9 +657,7 @@ protected boolean checkOption(String option, String value) { } // option with any nonempty string value - if (option.equals("test.host") - || option.equals("debugee.host") - || option.equals("debugee.vmkind") + if (option.equals("debugee.vmkind") || option.equals("debugee.vmhome") || option.equals("transport.shname")) { if (value.length() <= 0) { @@ -748,14 +693,10 @@ protected boolean checkOption(String option, String value) { return true; } - if (option.equals("debugee.launch")) { - if ((!value.equals("local")) - && (!value.equals("remote")) - && (!value.equals("manual"))) { - throw new BadOption(option + ": must be one of: " - + "local, remote, manual " + value); - } - return true; + if (option.equals("debugee.launch") + || option.equals("debugee.host") + || option.equals("test.host")) { + throw new RuntimeException("option " + option + " is not supported."); } if (option.equals("jvmdi.strict")) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jpda/DebugeeBinder.java b/test/hotspot/jtreg/vmTestbase/nsk/share/jpda/DebugeeBinder.java index 962f42526844..d36c9d9624f2 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jpda/DebugeeBinder.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jpda/DebugeeBinder.java @@ -35,15 +35,6 @@ * debuggee VM and to make connection to it using JDI connector or * JDWP transport. *

    - * The present version of Binder allows - * to launch debuggee VM either on local machine (local launch mode), - * or on remote host using BindServer utility - * (remote launch mode). Also there is an ability to launch - * debuggee VM manually as a separate process on local or remote machine - * (manual launch mode), which is usefull for debugging. - * All these launching modes are specified by command line option - * -debugee.launch recognized by DebugeeArgumentHandler. - *

    * Binder also makes it possible to establish TCP/IP * connection between debugger and debuggee throw IOPipe * object. This connection allows debugger to communicate with debuggee @@ -66,7 +57,7 @@ * @see nsk.share.jdi.Binder * @see nsk.share.jdwp.Binder */ -public class DebugeeBinder extends Log.Logger implements Finalizable { +public class DebugeeBinder extends Log.Logger { private static final boolean IS_WINDOWS = System.getProperty("os.name") .toLowerCase() @@ -105,8 +96,6 @@ public static String getVersion () { } // -------------------------------------------------- // - - private BindServerListener bindServerListener = null; private ServerSocket pipeServerSocket = null; // -------------------------------------------------- // @@ -118,8 +107,6 @@ public static String getVersion () { public DebugeeBinder (DebugeeArgumentHandler argumentHandler, Log log) { super(log, LOG_PREFIX); this.argumentHandler = argumentHandler; - - registerCleanup(); } /** @@ -322,11 +309,11 @@ public String[] makeCommandLineArgs(String classToExecute, String transportAddre } } -/* - String classPath = System.getProperty("java.class.path"); - args.add("-classpath") + + String classPath = System.getProperty("test.class.path"); + args.add("-classpath"); args.add(classPath); - */ + String server; if (argumentHandler.isAttachingConnector()) { @@ -388,364 +375,12 @@ public String[] makeCommandLineArgs(String classToExecute) { return makeCommandLineArgs(classToExecute, makeTransportAddress()); } - /** - * Make connection to remote BindServer and start BindServerListener thread. - * - * @throws IOException if I/O error occured while connecting - */ - public void connectToBindServer(String taskID) { - if (bindServerListener != null) { - throw new Failure("Connection to BindServer already exists"); - } - try { - bindServerListener = new BindServerListener(this); - bindServerListener.setDaemon(true); - bindServerListener.connect(taskID); - bindServerListener.start(); - } catch (IOException e) { - e.printStackTrace(getOutStream()); - throw new Failure("Caught exception while connecting to BindServer:\n\t" + e); - } - } - - /** - * Split string into list of substrings using specified separator. - */ - private static String[] splitString(String givenString, String separator) { - Vector tmpList = new Vector(); - StringTokenizer tokenizer = new StringTokenizer(givenString, separator); - while(tokenizer.hasMoreTokens()) { - tmpList.add(tokenizer.nextToken()); - } - String[] list = new String[tmpList.size()]; - for (int i = 0; i < tmpList.size(); i++) { - list[i] = tmpList.elementAt(i); - } - return list; - } - - /** - * Send command to remote BindServer and receive reply. - * - * @throws IOException if I/O error occured while launching process - */ - public synchronized Object sendRemoteCommand(Object command) { - try { - bindServerListener.sendCommand(command); - Object reply = bindServerListener.getReply(); - return reply; - } catch (IOException e) { - e.printStackTrace(log.getOutStream()); - throw new Failure("Unexpected exception while sending command to BindServer:\n\t" - + e); - } - } - - /** - * Launch remote process using request to BindServer. - * - * @throws IOException if I/O error occured - */ - public void launchRemoteProcess(String[] args) throws IOException { - String pathSeparator = System.getProperty("path.separator"); - BindServer.LaunchDebugee command = - new BindServer.LaunchDebugee(args, - System.getProperty("file.separator"), - System.getProperty("user.dir"), - splitString(System.getProperty("java.library.path"), pathSeparator), - splitString(System.getProperty("java.class.path"), pathSeparator), - splitString(System.getProperty("java.library.path"), pathSeparator)); - - Object reply = sendRemoteCommand(command); - if (reply instanceof BindServer.OK) { - // do nothing - } else if (reply instanceof BindServer.RequestFailed) { - BindServer.RequestFailed castedReply = (BindServer.RequestFailed)reply; - throw new Failure("BindServer error: " + castedReply.reason); - } else { - throw new Failure("Wrong reply from BindServer: " + reply); - } - } - - /** - * Return exit status of the remotely launched process - * using request to BindServer. - */ - public int getRemoteProcessStatus () { - Object reply = sendRemoteCommand(new BindServer.DebugeeExitCode()); - if (reply instanceof BindServer.OK) { - BindServer.OK castedReply = (BindServer.OK)reply; - return (int)castedReply.info; - } else if (reply instanceof BindServer.CaughtException) { - BindServer.CaughtException castedReply = (BindServer.CaughtException)reply; - throw new IllegalThreadStateException(castedReply.reason); - } else if (reply instanceof BindServer.RequestFailed) { - BindServer.RequestFailed castedReply = (BindServer.RequestFailed)reply; - throw new Failure("BindServer error: " + castedReply.reason); - } else { - throw new Failure("Wrong reply from BindServer: " + reply); - } - } - - /** - * Check whether the remotely launched process has been terminated - * using request to BindServer. - */ - public boolean isRemoteProcessTerminated () { - try { - int value = getRemoteProcessStatus(); - return true; - } catch (IllegalThreadStateException e) { - return false; - } - } - - // ---------------------------------------------- // - - /** - * Kill the remotely launched process - * using request to BindServer. - */ - public void killRemoteProcess () { - Object reply = sendRemoteCommand(new BindServer.KillDebugee()); - if (reply instanceof BindServer.OK) { - return; - } else if (reply instanceof BindServer.RequestFailed) { - BindServer.RequestFailed castedReply = (BindServer.RequestFailed)reply; - throw new Failure("BindServer error: " + castedReply.reason); - } else { - throw new Failure("Wrong reply from BindServer: " + reply); - } - } - - /** - * Wait until the remotely launched process exits or crashes - * using request to BindServer. - */ - public int waitForRemoteProcess () { - - Object reply = sendRemoteCommand(new BindServer.WaitForDebugee(0)); - if (reply instanceof BindServer.OK) { - BindServer.OK castedReply = (BindServer.OK)reply; - return (int)castedReply.info; - } else if (reply instanceof BindServer.RequestFailed) { - BindServer.RequestFailed castedReply = (BindServer.RequestFailed)reply; - throw new Failure("BindServer error: " + castedReply.reason); - } else { - throw new Failure("Wrong reply from BindServer: " + reply); - } - } /** * Close binder by closing all started threads. */ public void close() { - if (bindServerListener != null) { - bindServerListener.close(); - } closePipeServerSocket(); } - /** - * Finalize binder by invoking close(). - * - */ - public void cleanup() { - close(); - } - - /** - * Separate thread for listening connection from BindServer. - */ - private class BindServerListener extends Thread { - private SocketConnection connection = null; - private Log.Logger logger = null; - - /** List of received responses from BindServer. */ - private LinkedList replies = new LinkedList(); - - /** - * Make thread. - */ - public BindServerListener(Log.Logger logger) { - this.logger = logger; - } - - /** - * Establish connection to BindServer. - */ - public void connect(String taskID) throws IOException { - String host = argumentHandler.getDebugeeHost(); - int port = argumentHandler.getBindPortNumber(); - display("Connecting to BindServer: " + host + ":" + port); - connection = new SocketConnection(logger, "BindServer"); -// connection.setPingTimeout(DebugeeBinder.PING_TIMEOUT); - connection.attach(host, port); - handshake(taskID); - } - - /** - * Receive OK(version) from BindServer and check received version number. - */ - private void handshake(String taskID) { - // receive OK(version) - trace(TRACE_LEVEL_ACTIONS, "Waiting for initial OK(version) from BindServer"); - Object reply = connection.readObject(); - trace(TRACE_LEVEL_ACTIONS, "Got initial OK(version) from BindServer: " + reply); - if (reply instanceof BindServer.RequestFailed) { - BindServer.RequestFailed castedReply = (BindServer.RequestFailed)reply; - trace(TRACE_LEVEL_ACTIONS, "Reply is RequestFailed: throw Failure"); - throw new Failure("BindServer error: " + castedReply.reason); - } else if (reply instanceof BindServer.OK) { - BindServer.OK castedReply = (BindServer.OK)reply; - trace(TRACE_LEVEL_ACTIONS, "Reply is OK: check BindServer version"); - if (castedReply.info != BindServer.VERSION) { - throw new Failure("Wrong version of BindServer: " + castedReply.info - + " (expected: " + BindServer.VERSION + ")"); - } - display("Connected to BindServer: version " + castedReply.info); - } else { - trace(TRACE_LEVEL_ACTIONS, "Reply is unknown: throw Failure"); - throw new Failure("Wrong reply from BindServer: " + reply); - } - - // send TaskID(id) - try { - trace(TRACE_LEVEL_ACTIONS, "Sending TaskID(id) to BindServer"); - sendCommand(new BindServer.TaskID(taskID)); - trace(TRACE_LEVEL_ACTIONS, "Sent TaskID(id) to BindServer"); - } catch (IOException e) { - throw new Failure("Caught IOException while sending TaskID(id) to BindServer:\n\t" - + e); - } - } - - /** - * Check if thread is connected to BindServer. - */ - public boolean isConnected() { - return (connection != null && connection.isConnected()); - } - - /** - * Send a command to BindServer. - */ - public synchronized void sendCommand(Object command) throws IOException { - connection.writeObject(command); - } - - /** - * Receive response from BindServer. - */ - public Object getReply() { - synchronized (replies) { - while (replies.isEmpty()) { - if (!isConnected()) { - throw new Failure("No reply from BindServer: connection lost"); - } - try { - replies.wait(TRY_DELAY); - } catch (InterruptedException e) { - e.printStackTrace(getOutStream()); - throw new Failure("Thread interrupted while waiting for reply from BindServer:\n\t" - + e); - } - } - Object reply = replies.removeFirst(); - if (reply == null) { - throw new Failure("No reply from BindServer: connection lost"); - } - return reply; - } - } - - /** - * Add response object to the list of received responses. - */ - private void addReply(BindServer.Response reply) { - synchronized (replies) { - replies.add(reply); - replies.notifyAll(); - } - } - - /** - * Read packets from BindServer connection and - * notify waiting thread if response or IOPipe message received. - * Received lines of redirected streams are put into log. - */ - public void run() { - trace(TRACE_LEVEL_THREADS, "BindServerListener thread started"); - try { - for (;;) { - Object reply = connection.readObject(); - if (reply == null) { - break; - } else if (reply instanceof BindServer.Disconnect) { - reply = null; - trace(TRACE_LEVEL_ACTIONS, "Packet is Disconnect: close connection"); - break; - } else if (reply instanceof BindServer.RedirectedStream) { - BindServer.RedirectedStream castedReply = (BindServer.RedirectedStream)reply; - trace(TRACE_LEVEL_ACTIONS, "Packet is RedirectedStream: put message into log"); - log.println(castedReply.line); - } else if (reply instanceof BindServer.Response) { - BindServer.Response castedReply = (BindServer.Response)reply; - trace(TRACE_LEVEL_ACTIONS, "Packet is reply: notify all threads waiting for reply"); - addReply(castedReply); - } else { - trace(TRACE_LEVEL_ACTIONS, "Packet is unknown: throw Failure"); - throw new Failure("Wrong reply from BindServer: " + reply); - } - } - } catch (Exception e) { - e.printStackTrace(getOutStream()); - complain("Caught exception while reading packets from BindServer:\n\t" + e); - } finally { - closeConnection(); - addReply(null); - trace(TRACE_LEVEL_THREADS, "BindServerListener thread finished"); - } - } - - /** - * Send Disconnect command to BindServer. - */ - public void disconnect() { - if (connection == null) return; - try { - sendCommand(new BindServer.Disconnect()); - } catch (IOException e) { - display("Caught IOException while requesting disconnection with BindServer"); - } - } - - /** - * Close socket connection. - */ - public void closeConnection() { - if (connection != null) { - connection.close(); - } - } - - /** - * Wait for thread finished in the specified timeout or interrupt it. - */ - public void waitForThread(long millis) { - DebugeeBinder.waitForThread(this, millis, logger); - } - - /** - * Close this thread by waiting for it finishes or interrupt it - * and close socket connection. - */ - public void close() { - disconnect(); - waitForThread(DebugeeBinder.THREAD_TIMEOUT); - closeConnection(); - } - - } // BindServerListener - } // DebugeeBinder diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jpda/DebugeeProcess.java b/test/hotspot/jtreg/vmTestbase/nsk/share/jpda/DebugeeProcess.java index 94bca6fd734a..b875911e973d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jpda/DebugeeProcess.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jpda/DebugeeProcess.java @@ -74,8 +74,8 @@ abstract public class DebugeeProcess { /** Argument handler from binder. */ protected DebugeeArgumentHandler argumentHandler = null; - /** Need or not to check debuggee process termination at exit. */ - protected boolean checkTermination = false; + /** Need or not to check debuggee process termination. */ + private boolean checkTermination = true; /** Debugee VM process or null if not available. */ protected Process process = null; @@ -164,26 +164,50 @@ public void sendSignal(String signal) { // --------------------------------------------------- // /** Wait until the debugee VM shutdown or crash. */ - abstract protected int waitForDebugee () throws InterruptedException; + protected int waitForDebugee() throws InterruptedException { + return process.waitFor(); + } /** Kill the debugee VM. */ - abstract protected void killDebugee (); + protected void killDebugee() { + if (!terminated()) { + log.display("Killing debugee VM process"); + process.destroy(); + } + } /** Check whether the debugee VM has been terminated. */ - abstract public boolean terminated (); + public boolean terminated() { + if (process == null) + return true; + + try { + int value = process.exitValue(); + return true; + } catch (IllegalThreadStateException e) { + return false; + } + } /** Return the debugee VM exit status. */ - abstract public int getStatus (); + public int getStatus() { + return process.exitValue(); + } /** Get a pipe to write to the debugee's stdin stream. */ - abstract protected OutputStream getInPipe (); + protected OutputStream getInPipe() { + return process.getOutputStream(); + } /** Get a pipe to read the debugee's stdout stream. */ - abstract protected InputStream getOutPipe (); + protected InputStream getOutPipe() { + return process.getInputStream(); + } /** Get a pipe to read the debugee's stderr stream. */ - abstract protected InputStream getErrPipe (); - + protected InputStream getErrPipe() { + return process.getErrorStream(); + } // --------------------------------------------------- // /** @@ -196,16 +220,26 @@ public void sendSignal(String signal) { */ public int waitFor () { long timeout = binder.getArgumentHandler().getWaitTime() * 60 * 1000; - int exitCode = 0; + int exitCode; try { exitCode = waitForDebugee(); } catch (InterruptedException ie) { ie.printStackTrace(log.getOutStream()); throw new Failure("Caught exception while waiting for debuggee process: \n\t" + ie); - } - waitForRedirectors(timeout); - if (process != null) { - process.destroy(); + } finally { + try { + waitForRedirectors(timeout); + } finally { + if (process != null) { + process.destroy(); + } + if (pipe != null) { + pipe.close(); + } + if (binder != null) { + binder.close(); + } + } } return exitCode; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jpda/IOPipe.java b/test/hotspot/jtreg/vmTestbase/nsk/share/jpda/IOPipe.java index 1a1d6cab6452..74e3a7c3a6d8 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jpda/IOPipe.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jpda/IOPipe.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2024, 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 @@ -72,12 +72,16 @@ public IOPipe(DebugeeProcess debugee) { (long)debugee.getArgumentHandler().getWaitTime() * 60 * 1000, true); setServerSocket(debugee.getPipeServerSocket()); + if (debugee.pipe != null) { + throw new RuntimeException("debugee pipe is already set"); + } + debugee.pipe = this; } /** * Make general IOPipe object with specified parameters. */ - protected IOPipe(Log log, String host, int port, long timeout, boolean listening) { + private IOPipe(Log log, String host, int port, long timeout, boolean listening) { super("IOPipe", log, PIPE_LOG_PREFIX, host, port, timeout, listening); } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jpda/SocketIOPipe.java b/test/hotspot/jtreg/vmTestbase/nsk/share/jpda/SocketIOPipe.java index baee16534e58..15e4d5179705 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jpda/SocketIOPipe.java +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jpda/SocketIOPipe.java @@ -62,7 +62,7 @@ * pipe.println(command); * */ -public class SocketIOPipe extends Log.Logger implements Finalizable { +public class SocketIOPipe extends Log.Logger { public static final int DEFAULT_TIMEOUT_VALUE = 1 * 60 * 1000; @@ -93,8 +93,6 @@ protected SocketIOPipe(String name, Log log, String logPrefix, String host, int this.timeout = timeout; this.listening = listening; this.name = name; - - registerCleanup(); } /** @@ -106,8 +104,6 @@ protected SocketIOPipe(Log log, String logPrefix, String host, int port, long ti this.port = port; this.timeout = timeout; this.listening = listening; - - registerCleanup(); } /** @@ -311,17 +307,6 @@ public long getPingTimeout() { return connection.getPingTimeout(); } - /** - * Perform finalization of the object by invoking close(). - * - * This is replacement of finalize() method and is called - * when this instance becomes unreachable. - * - */ - public void cleanup() { - close(); - } - /** * Field 'pipeCounter' and method 'getNextPipeNumber' are used to construct unique names for SocketIOPipes diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/AddToBootstrapClassLoaderSearch/bootclssearch_agent.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/AddToBootstrapClassLoaderSearch/bootclssearch_agent.cpp index 128b33bbf368..bc20d23041a8 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/AddToBootstrapClassLoaderSearch/bootclssearch_agent.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/AddToBootstrapClassLoaderSearch/bootclssearch_agent.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,9 +24,9 @@ #include #include #include "jvmti.h" -#include "jni_tools.h" -#include "jvmti_tools.h" -#include "agent_common.h" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" +#include "agent_common.hpp" extern "C" { @@ -156,16 +156,16 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiEnv* jvmti; const char *p_segment1, *p_segment2, *phase_to_check; - jvmti = NULL; - p_segment1 = p_segment2 = phase_to_check = NULL; + jvmti = nullptr; + p_segment1 = p_segment2 = phase_to_check = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; timeout = nsk_jvmti_getWaitTime() * 60 * 1000; - p_segment1 = nsk_jvmti_findOptionStringValue("segment1", NULL); - if (!NSK_VERIFY(p_segment1 != NULL)) { + p_segment1 = nsk_jvmti_findOptionStringValue("segment1", nullptr); + if (!NSK_VERIFY(p_segment1 != nullptr)) { return JNI_ERR; } else { strncpy(segment1, p_segment1, (size_t) sizeof(segment1)/sizeof(char)); @@ -173,20 +173,20 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } // 'segment2' parameter is not mandatory - p_segment2 = nsk_jvmti_findOptionStringValue("segment2", NULL); - if (p_segment2 != NULL) { + p_segment2 = nsk_jvmti_findOptionStringValue("segment2", nullptr); + if (p_segment2 != nullptr) { strncpy(segment2, p_segment2, (size_t) sizeof(segment2)/sizeof(char)); segment2[(size_t) sizeof(segment2)/sizeof(char) - 1] = 0; use_segment2 = JNI_TRUE; } if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; // Check what phase(s) we are going to test - phase_to_check = nsk_jvmti_findOptionStringValue("phasetocheck", NULL); - if (!NSK_VERIFY(phase_to_check != NULL)) { + phase_to_check = nsk_jvmti_findOptionStringValue("phasetocheck", nullptr); + if (!NSK_VERIFY(phase_to_check != nullptr)) { return JNI_ERR; } else if (strcmp(phase_to_check, "onload") == 0) { jvmti_phase_to_check = JVMTI_PHASE_ONLOAD; @@ -227,7 +227,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiEvent eventsList[] = { JVMTI_EVENT_VM_INIT, JVMTI_EVENT_VM_DEATH }; if (!NSK_VERIFY(nsk_jvmti_enableEvents( - JVMTI_ENABLE, sizeof(eventsList)/sizeof(jvmtiEvent), eventsList, NULL))) { + JVMTI_ENABLE, sizeof(eventsList)/sizeof(jvmtiEvent), eventsList, nullptr))) { return JNI_ERR; } } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/AddToSystemClassLoaderSearch/systemclssearch_agent.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/AddToSystemClassLoaderSearch/systemclssearch_agent.cpp index 6be44a4f1472..2cf7d1f44ca3 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/AddToSystemClassLoaderSearch/systemclssearch_agent.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/AddToSystemClassLoaderSearch/systemclssearch_agent.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,9 +24,9 @@ #include #include #include "jvmti.h" -#include "jni_tools.h" -#include "jvmti_tools.h" -#include "agent_common.h" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" +#include "agent_common.hpp" extern "C" { @@ -156,16 +156,16 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiEnv* jvmti; const char *p_segment1, *p_segment2, *phase_to_check; - jvmti = NULL; - p_segment1 = p_segment2 = phase_to_check = NULL; + jvmti = nullptr; + p_segment1 = p_segment2 = phase_to_check = nullptr; if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; timeout = nsk_jvmti_getWaitTime() * 60 * 1000; - p_segment1 = nsk_jvmti_findOptionStringValue("segment1", NULL); - if (!NSK_VERIFY(p_segment1 != NULL)) { + p_segment1 = nsk_jvmti_findOptionStringValue("segment1", nullptr); + if (!NSK_VERIFY(p_segment1 != nullptr)) { return JNI_ERR; } else { strncpy(segment1, p_segment1, (size_t) sizeof(segment1)/sizeof(char)); @@ -173,20 +173,20 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } // 'segment2' parameter is not mandatory - p_segment2 = nsk_jvmti_findOptionStringValue("segment2", NULL); - if (p_segment2 != NULL) { + p_segment2 = nsk_jvmti_findOptionStringValue("segment2", nullptr); + if (p_segment2 != nullptr) { strncpy(segment2, p_segment2, (size_t) sizeof(segment2)/sizeof(char)); segment2[(size_t) sizeof(segment2)/sizeof(char) - 1] = 0; use_segment2 = JNI_TRUE; } if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; // Check what phase(s) we are going to test - phase_to_check = nsk_jvmti_findOptionStringValue("phasetocheck", NULL); - if (!NSK_VERIFY(phase_to_check != NULL)) { + phase_to_check = nsk_jvmti_findOptionStringValue("phasetocheck", nullptr); + if (!NSK_VERIFY(phase_to_check != nullptr)) { return JNI_ERR; } else if (strcmp(phase_to_check, "onload") == 0) { jvmti_phase_to_check = JVMTI_PHASE_ONLOAD; @@ -227,7 +227,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { jvmtiEvent eventsList[] = { JVMTI_EVENT_VM_INIT, JVMTI_EVENT_VM_DEATH }; if (!NSK_VERIFY(nsk_jvmti_enableEvents( - JVMTI_ENABLE, sizeof(eventsList)/sizeof(jvmtiEvent), eventsList, NULL))) { + JVMTI_ENABLE, sizeof(eventsList)/sizeof(jvmtiEvent), eventsList, nullptr))) { return JNI_ERR; } } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/Injector.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/Injector.cpp index 6246c6c48849..ee61ed71232e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/Injector.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/Injector.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "jvmti_tools.h" -#include "Injector.h" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" +#include "Injector.hpp" /* ========================================================================== */ @@ -221,7 +221,7 @@ extern "C" { NSK_DISPLAY1("copying ConstantPool: %d\n", constantPoolSize); constantPool = (char**) malloc(constantPoolSize * sizeof(char*)); - if (!NSK_VERIFY(constantPool != NULL)) { + if (!NSK_VERIFY(constantPool != nullptr)) { NSK_COMPLAIN0("out of memory\n"); return NSK_FALSE; } @@ -262,7 +262,7 @@ extern "C" { case CONSTANT_Utf8: len = copy_u2(); utf8 = (char*) malloc(len + 1); - if (!NSK_VERIFY(utf8 != NULL)) { + if (!NSK_VERIFY(utf8 != nullptr)) { NSK_COMPLAIN0("out of memory\n"); return NSK_FALSE; } @@ -295,7 +295,7 @@ extern "C" { u2 i; for (i = 1; i < constantPoolSize; i++) { - if (constantPool[i] != NULL) { + if (constantPool[i] != nullptr) { free(constantPool[i]); } } @@ -1138,7 +1138,7 @@ extern "C" { inputPos = (u1*) orig; endPos = orig + old_length; gen = (u1*) malloc(old_length * GROWTH_FACTOR); - if (!NSK_VERIFY(gen != NULL)) { + if (!NSK_VERIFY(gen != nullptr)) { NSK_COMPLAIN0("out of memory\n"); return NSK_FALSE; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/Injector.h b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/Injector.hpp similarity index 98% rename from test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/Injector.h rename to test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/Injector.hpp index 3dad0b88f7e6..491f203259cc 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/Injector.h +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/Injector.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,8 +21,8 @@ * questions. */ -#ifndef _NSK_SHARE_JVMTI_INJECTOR_H_ -#define _NSK_SHARE_JVMTI_INJECTOR_H_ +#ifndef _NSK_SHARE_JVMTI_INJECTOR_HPP_ +#define _NSK_SHARE_JVMTI_INJECTOR_HPP_ /* Class File Format Constants */ @@ -304,4 +304,4 @@ int Inject(const u1* old_bytes, const jint old_length, } -#endif /* _NSK_SHARE_JVMTI_INJECTOR_H_ */ +#endif /* _NSK_SHARE_JVMTI_INJECTOR_HPP_ */ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/JVMTITools.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/JVMTITools.cpp index 16a02dfc2a4b..e80d70d4f232 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/JVMTITools.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/JVMTITools.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,5 +23,5 @@ #include #include -#include "JVMTITools.h" +#include "JVMTITools.hpp" diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/JVMTITools.h b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/JVMTITools.hpp similarity index 82% rename from test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/JVMTITools.h rename to test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/JVMTITools.hpp index e51d9ab91c1d..b38cb64a36ee 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/JVMTITools.h +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/JVMTITools.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,11 +21,11 @@ * questions. */ -#ifndef _NSK_SHARE_JVMTI_JVMTITOOLS_H_ -#define _NSK_SHARE_JVMTI_JVMTITOOLS_H_ +#ifndef _NSK_SHARE_JVMTI_JVMTITOOLS_HPP_ +#define _NSK_SHARE_JVMTI_JVMTITOOLS_HPP_ #include "jvmti.h" -#include "jvmti_common.h" +#include "jvmti_common.hpp" -#endif /* _NSK_SHARE_JVMTI_JVMTITOOLS_H_ */ +#endif /* _NSK_SHARE_JVMTI_JVMTITOOLS_HPP_ */ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/README b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/README index 9be9bb969cd8..bc8a50afea69 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/README +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/README @@ -1,4 +1,4 @@ -Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. +Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. This code is free software; you can redistribute it and/or modify it @@ -25,13 +25,13 @@ This directory contains source files of testbase_nsk JVMTI framework, which provides support for JVMTI tests and accessing JVMTI environment. Source files: - jvmti_tools.h - jvmti_tools.c - agent_tools.c - Injector.h - Injector.c - JVMTITools.h - JVMTITools.c + jvmti_tools.hpp + jvmti_tools.cpp + agent_tools.cpp + Injector.hpp + Injector.cpp + JVMTITools.hpp + JVMTITools.cpp Naming conventions: macroses: NSK_JVMTI_* @@ -39,7 +39,7 @@ which provides support for JVMTI tests and accessing JVMTI environment. --------------------------------------------------------------------------------- -jvmti_tools.h +jvmti_tools.hpp Provides functions and macroses for invocation of JVMTI functions and checking JVMTI errors: @@ -135,7 +135,7 @@ or with saving error code: --------------------------------------------------------------------------------- -JVMTITools.h +JVMTITools.hpp Provides set of functions which convert JVMTI binary data to a null-terminated character string: @@ -150,7 +150,7 @@ a null-terminated character string: --------------------------------------------------------------------------------- -Injector.h +Injector.hpp Provides class file format constants and the function which inject some profiling bytecodes into Java class files: diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/agent_common/agent_common.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/agent_common/agent_common.cpp index 8ff7895c2aa5..659ac5313a5f 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/agent_common/agent_common.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/agent_common/agent_common.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. */ #include "jvmti.h" -#include "agent_common.h" +#include "agent_common.hpp" extern "C" { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/agent_common/agent_common.h b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/agent_common/agent_common.hpp similarity index 93% rename from test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/agent_common/agent_common.h rename to test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/agent_common/agent_common.hpp index bc55b9eda171..f313b6450ded 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/agent_common/agent_common.h +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/agent_common/agent_common.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ #define NSK_JVMTI_AGENT_COMMON_DEFINED #include "jvmti.h" -#include "../jvmti_tools.h" +#include "../jvmti_tools.hpp" extern "C" { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/agent_tools.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/agent_tools.cpp index b75f237c6a7c..0b43e5ac7828 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/agent_tools.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/agent_tools.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,9 +24,9 @@ #include #include -#include "native_thread.h" -#include "jni_tools.h" -#include "jvmti_tools.h" +#include "native_thread.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" extern "C" { @@ -37,9 +37,9 @@ extern "C" { * Now the same source is used to build different agent libs, so these * variables are not shared between agents */ -static jthread agentThread = NULL; -static jvmtiStartFunction agentThreadProc = NULL; -static void* agentThreadArg = NULL; +static jthread agentThread = nullptr; +static jvmtiStartFunction agentThreadProc = nullptr; +static void* agentThreadArg = nullptr; typedef enum { NEW, RUNNABLE, WAITING, SUSPENDED, TERMINATED } thread_state_t; @@ -52,9 +52,9 @@ typedef struct agent_data_t { static agent_data_t agent_data; -static jvmtiEnv* jvmti_env = NULL; -static JavaVM* jvm = NULL; -static JNIEnv* jni_env = NULL; +static jvmtiEnv* jvmti_env = nullptr; +static JavaVM* jvm = nullptr; +static JNIEnv* jni_env = nullptr; static volatile int currentAgentStatus = NSK_STATUS_PASSED; @@ -101,12 +101,12 @@ jvmtiEnv* nsk_jvmti_createJVMTIEnv(JavaVM* javaVM, void* reserved) { jvm = javaVM; if (!NSK_VERIFY(javaVM->GetEnv((void **)&jvmti_env, JVMTI_VERSION_1_1) == JNI_OK)) { nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } if (!NSK_JVMTI_VERIFY(init_agent_data(jvmti_env, &agent_data))) { nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } return jvmti_env; @@ -114,7 +114,7 @@ jvmtiEnv* nsk_jvmti_createJVMTIEnv(JavaVM* javaVM, void* reserved) { /** Dispose JVMTI environment */ static int nsk_jvmti_disposeJVMTIEnv(jvmtiEnv* jvmti_env) { - if (jvmti_env != NULL) { + if (jvmti_env != nullptr) { if (!NSK_JVMTI_VERIFY(jvmti_env->DisposeEnvironment())) { nsk_jvmti_setFailStatus(); return NSK_FALSE; @@ -153,7 +153,7 @@ agentThreadWrapper(jvmtiEnv* jvmti_env, JNIEnv* agentJNI, void* arg) { rawMonitorEnter(jvmti_env, agent_data.monitor); agent_data.thread_state = TERMINATED; agentJNI->DeleteGlobalRef(agentThread); - agentThread = NULL; + agentThread = nullptr; rawMonitorNotify(jvmti_env, agent_data.monitor); rawMonitorExit(jvmti_env, agent_data.monitor); @@ -167,31 +167,31 @@ static jthread startAgentThreadWrapper(JNIEnv *jni_env, jvmtiEnv* jvmti_env) { const char* THREAD_CTOR_NAME = ""; const char* THREAD_CTOR_SIGNATURE = "(Ljava/lang/String;)V"; - jobject threadName = NULL; - jclass threadClass = NULL; - jmethodID threadCtor = NULL; - jobject threadObject = NULL; - jobject threadGlobalRef = NULL; + jobject threadName = nullptr; + jclass threadClass = nullptr; + jmethodID threadCtor = nullptr; + jobject threadObject = nullptr; + jobject threadGlobalRef = nullptr; - if (!NSK_JNI_VERIFY(jni_env, (threadClass = jni_env->FindClass(THREAD_CLASS_NAME)) != NULL)) { - return NULL; + if (!NSK_JNI_VERIFY(jni_env, (threadClass = jni_env->FindClass(THREAD_CLASS_NAME)) != nullptr)) { + return nullptr; } if (!NSK_JNI_VERIFY(jni_env, (threadCtor = - jni_env->GetMethodID(threadClass, THREAD_CTOR_NAME, THREAD_CTOR_SIGNATURE)) != NULL)) - return NULL; + jni_env->GetMethodID(threadClass, THREAD_CTOR_NAME, THREAD_CTOR_SIGNATURE)) != nullptr)) + return nullptr; - if (!NSK_JNI_VERIFY(jni_env, (threadName = jni_env->NewStringUTF(THREAD_NAME)) != NULL)) - return NULL; + if (!NSK_JNI_VERIFY(jni_env, (threadName = jni_env->NewStringUTF(THREAD_NAME)) != nullptr)) + return nullptr; if (!NSK_JNI_VERIFY(jni_env, (threadObject = - jni_env->NewObject(threadClass, threadCtor, threadName)) != NULL)) - return NULL; + jni_env->NewObject(threadClass, threadCtor, threadName)) != nullptr)) + return nullptr; if (!NSK_JNI_VERIFY(jni_env, (threadGlobalRef = - jni_env->NewGlobalRef(threadObject)) != NULL)) { + jni_env->NewGlobalRef(threadObject)) != nullptr)) { jni_env->DeleteLocalRef(threadObject); - return NULL; + return nullptr; } agentThread = (jthread)threadGlobalRef; @@ -199,7 +199,7 @@ static jthread startAgentThreadWrapper(JNIEnv *jni_env, jvmtiEnv* jvmti_env) { jvmti_env->RunAgentThread(agentThread, &agentThreadWrapper, agentThreadArg, THREAD_PRIORITY))) { jni_env->DeleteGlobalRef(threadGlobalRef); jni_env->DeleteLocalRef(threadObject); - return NULL; + return nullptr; } return agentThread; } @@ -220,9 +220,9 @@ jthread nsk_jvmti_getAgentThread() { static jthread nsk_jvmti_runAgentThread(JNIEnv *jni_env, jvmtiEnv* jvmti_env) { /* start agent thread wrapper */ jthread thread = startAgentThreadWrapper(jni_env, jvmti_env); - if (thread == NULL) { + if (thread == nullptr) { nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } return thread; @@ -247,7 +247,7 @@ static jint syncDebuggeeStatus(JNIEnv* jni_env, jvmtiEnv* jvmti_env, jint debugg /* we don't enter if-stmt in second call */ if (agent_data.thread_state == NEW) { - if (nsk_jvmti_runAgentThread(jni_env, jvmti_env) == NULL) + if (nsk_jvmti_runAgentThread(jni_env, jvmti_env) == nullptr) goto monitor_exit_and_return; /* SP2.2-w - wait for agent thread */ @@ -371,31 +371,31 @@ Java_nsk_share_jvmti_DebugeeClass_resetAgentData(JNIEnv* jni_env, jclass cls) { /** Find loaded class by signature. */ jclass nsk_jvmti_classBySignature(const char signature[]) { - jclass* classes = NULL; + jclass* classes = nullptr; jint count = 0; - jclass foundClass = NULL; + jclass foundClass = nullptr; int i; - if (!NSK_VERIFY(signature != NULL)) { + if (!NSK_VERIFY(signature != nullptr)) { nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } if (!NSK_JVMTI_VERIFY(jvmti_env->GetLoadedClasses(&count, &classes))) { nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } for (i = 0; i < count; i++) { - char* sig = NULL; - char* generic = NULL; + char* sig = nullptr; + char* generic = nullptr; if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(classes[i], &sig, &generic))) { nsk_jvmti_setFailStatus(); break; } - if (sig != NULL && strcmp(signature, sig) == 0) { + if (sig != nullptr && strcmp(signature, sig) == 0) { foundClass = classes[i]; } @@ -405,19 +405,19 @@ jclass nsk_jvmti_classBySignature(const char signature[]) { break; } - if (foundClass != NULL) + if (foundClass != nullptr) break; } if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)classes))) { nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } if (!NSK_JNI_VERIFY(jni_env, (foundClass = (jclass) - jni_env->NewGlobalRef(foundClass)) != NULL)) { + jni_env->NewGlobalRef(foundClass)) != nullptr)) { nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } return foundClass; @@ -425,19 +425,19 @@ jclass nsk_jvmti_classBySignature(const char signature[]) { /** Find alive thread by name. */ jthread nsk_jvmti_threadByName(const char name[]) { - jthread* threads = NULL; + jthread* threads = nullptr; jint count = 0; - jthread foundThread = NULL; + jthread foundThread = nullptr; int i; - if (!NSK_VERIFY(name != NULL)) { + if (!NSK_VERIFY(name != nullptr)) { nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } if (!NSK_JVMTI_VERIFY(jvmti_env->GetAllThreads(&count, &threads))) { nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } for (i = 0; i < count; i++) { @@ -448,27 +448,27 @@ jthread nsk_jvmti_threadByName(const char name[]) { break; } - if (info.name != NULL && strcmp(name, info.name) == 0) { + if (info.name != nullptr && strcmp(name, info.name) == 0) { foundThread = threads[i]; } if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)info.name))) { nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } - if (foundThread != NULL) { + if (foundThread != nullptr) { break; } } if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)threads))) { nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } if (!NSK_JNI_VERIFY(jni_env, (foundThread = (jthread) - jni_env->NewGlobalRef(foundThread)) != NULL)) { + jni_env->NewGlobalRef(foundThread)) != nullptr)) { nsk_jvmti_setFailStatus(); - return NULL; + return nullptr; } return foundThread; @@ -507,7 +507,7 @@ int nsk_jvmti_addBreakpointCapabilities() { /** Find line location. */ jlocation nsk_jvmti_getLineLocation(jclass cls, jmethodID method, int line) { jint count = 0; - jvmtiLineNumberEntry* table = NULL; + jvmtiLineNumberEntry* table = nullptr; jlocation location = NSK_JVMTI_INVALID_JLOCATION; int i; @@ -574,7 +574,7 @@ int nsk_jvmti_enableEvents(jvmtiEventMode enable, int size, jvmtiEvent list[], j typedef jint (JNICALL *checkStatus_type)(JNIEnv* jni_env, jclass cls, jint debuggeeStatus); -static checkStatus_type checkStatus_func = NULL; +static checkStatus_type checkStatus_func = nullptr; /** * Proxy function to gain sequential access to checkStatus of each agent @@ -600,9 +600,9 @@ static void JNICALL nativeMethodBind(jvmtiEnv* jvmti_env, JNIEnv *jni_env, jvmtiPhase phase; jclass cls; - char *class_sig = NULL; - char *name = NULL; - char *sig = NULL; + char *class_sig = nullptr; + char *name = nullptr; + char *sig = nullptr; if (!NSK_JVMTI_VERIFY(jvmti_env->GetPhase(&phase))) { nsk_jvmti_setFailStatus(); @@ -612,12 +612,12 @@ static void JNICALL nativeMethodBind(jvmtiEnv* jvmti_env, JNIEnv *jni_env, if (phase != JVMTI_PHASE_START && phase != JVMTI_PHASE_LIVE) return; - if (NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(mid, &name, &sig, NULL))) { + if (NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(mid, &name, &sig, nullptr))) { if (strcmp(name, BIND_METHOD_NAME) == 0 && strcmp(sig, BIND_METHOD_SIGNATURE) == 0) { if (NSK_JVMTI_VERIFY(jvmti_env->GetMethodDeclaringClass(mid, &cls)) - && NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(cls, &class_sig, NULL)) + && NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(cls, &class_sig, nullptr)) && strcmp(class_sig, BIND_CLASS_NAME) == 0 && address != (void*)Java_nsk_share_jvmti_DebugeeClass_checkStatus) { checkStatus_func = (checkStatus_type)address; @@ -626,13 +626,13 @@ static void JNICALL nativeMethodBind(jvmtiEnv* jvmti_env, JNIEnv *jni_env, } } - if (name != NULL) + if (name != nullptr) jvmti_env->Deallocate((unsigned char*)name); - if (sig != NULL) + if (sig != nullptr) jvmti_env->Deallocate((unsigned char*)sig); - if (class_sig != NULL) + if (class_sig != nullptr) jvmti_env->Deallocate((unsigned char*)class_sig); } @@ -642,14 +642,14 @@ static void JNICALL nativeMethodBind(jvmtiEnv* jvmti_env, JNIEnv *jni_env, */ int nsk_jvmti_init_MA(jvmtiEventCallbacks* callbacks) { - if (callbacks == NULL) { - NSK_COMPLAIN0("callbacks should not be NULL\n"); + if (callbacks == nullptr) { + NSK_COMPLAIN0("callbacks should not be null\n"); nsk_jvmti_setFailStatus(); return NSK_FALSE; } - if (callbacks->NativeMethodBind != NULL) { - NSK_COMPLAIN0("callbacks.NativeMethodBind should be NULL\n"); + if (callbacks->NativeMethodBind != nullptr) { + NSK_COMPLAIN0("callbacks.NativeMethodBind should be null\n"); nsk_jvmti_setFailStatus(); return NSK_FALSE; } @@ -667,7 +667,7 @@ int nsk_jvmti_init_MA(jvmtiEventCallbacks* callbacks) { return NSK_FALSE; if (!NSK_JVMTI_VERIFY( - jvmti_env->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_NATIVE_METHOD_BIND, NULL))) + jvmti_env->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_NATIVE_METHOD_BIND, nullptr))) return NSK_FALSE; return NSK_TRUE; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/aod/jvmti_aod.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/aod/jvmti_aod.cpp index 6269379d8c7b..b6c80ba2d9e7 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/aod/jvmti_aod.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/aod/jvmti_aod.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,7 @@ */ #include #include -#include +#include extern "C" { @@ -79,7 +79,7 @@ Options* nsk_jvmti_aod_getMultiagentsOptions(jvmtiEnv *jvmti) { NSK_COMPLAIN1("Options for jvmtiEnv %p weren't found\n", jvmti); - return NULL; + return nullptr; } /* @@ -101,7 +101,7 @@ void nsk_jvmti_aod_deallocate(jvmtiEnv *jvmti, unsigned char* mem) { int nsk_jvmti_aod_getClassName(jvmtiEnv *jvmti, jclass klass, char classNameBuffer[]) { char* className; - if (!NSK_JVMTI_VERIFY(jvmti->GetClassSignature(klass, &className, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti->GetClassSignature(klass, &className, nullptr))) { NSK_COMPLAIN0("Failed to get class name\n"); classNameBuffer[0] = '\0'; return NSK_FALSE; @@ -161,25 +161,25 @@ jthread nsk_jvmti_aod_createThread(JNIEnv *jni) { jmethodID threadConstructor; jthread thread; - if (!NSK_JNI_VERIFY(jni, (klass = jni->FindClass("java/lang/Thread")) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (klass = jni->FindClass("java/lang/Thread")) != nullptr)) { NSK_COMPLAIN0("Failed to get the java.lang.Thread class\n"); - return NULL; + return nullptr; } if (!NSK_JNI_VERIFY(jni, - (threadConstructor = jni->GetMethodID(klass, "", "()V")) != NULL)) { + (threadConstructor = jni->GetMethodID(klass, "", "()V")) != nullptr)) { NSK_COMPLAIN0("Failed to get java.lang.Thread constructor\n"); - return NULL; + return nullptr; } if (!NSK_JNI_VERIFY (jni, - (thread = jni->NewObject(klass, threadConstructor, NULL)) != NULL)) { + (thread = jni->NewObject(klass, threadConstructor, nullptr)) != nullptr)) { NSK_COMPLAIN0("Failed to create Thread object\n"); - return NULL; + return nullptr; } - if (!NSK_JNI_VERIFY(jni, (thread = jni->NewGlobalRef(thread)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (thread = jni->NewGlobalRef(thread)) != nullptr)) { NSK_COMPLAIN0("Failed to create global reference\n"); - return NULL; + return nullptr; } return thread; @@ -191,28 +191,28 @@ jthread nsk_jvmti_aod_createThreadWithName(JNIEnv *jni, const char* threadName) jthread thread; jstring threadNameString; - if (!NSK_JNI_VERIFY(jni, (threadNameString = jni->NewStringUTF(threadName)) != NULL)) - return NULL; + if (!NSK_JNI_VERIFY(jni, (threadNameString = jni->NewStringUTF(threadName)) != nullptr)) + return nullptr; - if (!NSK_JNI_VERIFY(jni, (klass = jni->FindClass("java/lang/Thread")) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (klass = jni->FindClass("java/lang/Thread")) != nullptr)) { NSK_COMPLAIN0("Failed to get the java.lang.Thread class\n"); - return NULL; + return nullptr; } if (!NSK_JNI_VERIFY(jni, - (threadConstructor = jni->GetMethodID(klass, "", "(Ljava/lang/String;)V")) != NULL)) { + (threadConstructor = jni->GetMethodID(klass, "", "(Ljava/lang/String;)V")) != nullptr)) { NSK_COMPLAIN0("Failed to get java.lang.Thread constructor\n"); - return NULL; + return nullptr; } if (!NSK_JNI_VERIFY(jni, - (thread = jni->NewObject(klass, threadConstructor, threadNameString)) != NULL)) { + (thread = jni->NewObject(klass, threadConstructor, threadNameString)) != nullptr)) { NSK_COMPLAIN0("Failed to create Thread object\n"); - return NULL; + return nullptr; } - if (!NSK_JNI_VERIFY(jni, (thread = jni->NewGlobalRef(thread)) != NULL)) { + if (!NSK_JNI_VERIFY(jni, (thread = jni->NewGlobalRef(thread)) != nullptr)) { NSK_COMPLAIN0("Failed to create global reference\n"); - return NULL; + return nullptr; } return thread; @@ -230,8 +230,8 @@ int nsk_jvmti_aod_redefineClass( NSK_COMPLAIN1("Option '%s' isn't specified\n", PATH_TO_NEW_BYTE_CODE_OPTION); return NSK_FALSE; } - if (fileName == NULL) { - NSK_COMPLAIN0("File name is NULL\n"); + if (fileName == nullptr) { + NSK_COMPLAIN0("File name is null\n"); return NSK_FALSE; } { @@ -250,7 +250,7 @@ int nsk_jvmti_aod_redefineClass( bytecode = fopen(file, "rb"); error= JVMTI_ERROR_NONE; - if (bytecode == NULL) { + if (bytecode == nullptr) { NSK_COMPLAIN1("Error opening file '%s'\n", file); return NSK_FALSE; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/aod/jvmti_aod.h b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/aod/jvmti_aod.hpp similarity index 90% rename from test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/aod/jvmti_aod.h rename to test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/aod/jvmti_aod.hpp index c6ab631c0b9b..d6d090d01b3e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/aod/jvmti_aod.h +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/aod/jvmti_aod.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2024, 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,12 +20,12 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -#ifndef NSK_SHARE_JVMTI_AOD_H -#define NSK_SHARE_JVMTI_AOD_H +#ifndef NSK_SHARE_JVMTI_AOD_HPP +#define NSK_SHARE_JVMTI_AOD_HPP -#include +#include #include -#include +#include extern "C" { @@ -68,8 +68,8 @@ int nsk_jvmti_aod_getThreadName(jvmtiEnv * jvmti, jthread thread, char threadNam // events enabling/disabling -#define nsk_jvmti_aod_enableEvent(X,Y) NSK_JVMTI_VERIFY(X->SetEventNotificationMode(JVMTI_ENABLE, Y, NULL)) -#define nsk_jvmti_aod_disableEvent(X,Y) NSK_JVMTI_VERIFY(X->SetEventNotificationMode(JVMTI_DISABLE, Y, NULL)) +#define nsk_jvmti_aod_enableEvent(X,Y) NSK_JVMTI_VERIFY(X->SetEventNotificationMode(JVMTI_ENABLE, Y, nullptr)) +#define nsk_jvmti_aod_disableEvent(X,Y) NSK_JVMTI_VERIFY(X->SetEventNotificationMode(JVMTI_DISABLE, Y, nullptr)) int nsk_jvmti_aod_enableEvents(jvmtiEnv* jvmti, jvmtiEvent events[], int eventsNumber); int nsk_jvmti_aod_disableEvents(jvmtiEnv* jvmti, jvmtiEvent events[], int eventsNumber); @@ -90,4 +90,4 @@ void printCapabilities(jvmtiCapabilities caps); } -#endif /* END OF NSK_SHARE_JVMTI_AOD_H */ +#endif /* END OF NSK_SHARE_JVMTI_AOD_HPP */ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/hotswap/HotSwap.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/hotswap/HotSwap.cpp index 97f30c106c01..b47be9bb74ac 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/hotswap/HotSwap.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/hotswap/HotSwap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,10 +24,10 @@ #include #include #include -#include "jni_tools.h" -#include "jvmti_tools.h" -#include "Injector.h" -#include "agent_common.h" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" +#include "Injector.hpp" +#include "agent_common.hpp" #define PASSED 0 @@ -59,17 +59,17 @@ static int vm_mode = VM_MODE_COMPILED; static int bci_mode = BCI_MODE_EMCP; static int sync_freq = 0; -static jclass profile_klass = NULL; -static jfieldID count_field = NULL; +static jclass profile_klass = nullptr; +static jfieldID count_field = nullptr; /* test objects */ static int max_classes; -static char** names = NULL; -static jvmtiClassDefinition* old_class_def = NULL; -static jvmtiClassDefinition* new_class_def = NULL; +static char** names = nullptr; +static jvmtiClassDefinition* old_class_def = nullptr; +static jvmtiClassDefinition* new_class_def = nullptr; static int classCount = 0; /* lock to access classCount */ -static jrawMonitorID classLoadLock = NULL; +static jrawMonitorID classLoadLock = nullptr; static int newFlag = NSK_FALSE; /* ========================================================================== */ @@ -99,8 +99,8 @@ ClassFileLoadHook(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jint *new_class_data_len, unsigned char** new_class_data) { jint name_len; - if (name != NULL && - class_being_redefined == NULL && + if (name != nullptr && + class_being_redefined == nullptr && (strcmp(name, PROFILE_CLASS_NAME) != 0) && (strncmp(name, package_name, package_name_length) == 0)) { if (!NSK_JVMTI_VERIFY(jvmti_env->RawMonitorEnter(classLoadLock))) { @@ -139,20 +139,20 @@ static void JNICALL CompiledMethodLoad(jvmtiEnv *jvmti_env, jmethodID method, jint code_size, const void* code_addr, jint map_length, const jvmtiAddrLocationMap* map, const void* compile_info) { - char *name = NULL; - char *signature = NULL; + char *name = nullptr; + char *signature = nullptr; CompiledMethodLoadEventsCount++; - if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, nullptr))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY3("CompiledMethodLoad event: %s%s (0x%p)\n", name, signature, code_addr); - if (name != NULL) + if (name != nullptr) jvmti_env->Deallocate((unsigned char*)name); - if (signature != NULL) + if (signature != nullptr) jvmti_env->Deallocate((unsigned char*)signature); } @@ -175,20 +175,20 @@ Exception(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jthread thread, if (sync_freq && ((ExceptionEventsCount % sync_freq) == 0)) { if (nsk_getVerboseMode()) { - jclass klass = NULL; - char *signature = NULL; + jclass klass = nullptr; + char *signature = nullptr; - if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(exception)) != NULL)) { + if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(exception)) != nullptr)) { nsk_jvmti_setFailStatus(); return; } - if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &signature, NULL))) { + if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &signature, nullptr))) { nsk_jvmti_setFailStatus(); return; } NSK_DISPLAY2("Exception event %d: %s\n", ExceptionEventsCount.load(), signature); - if (signature != NULL) + if (signature != nullptr) jvmti_env->Deallocate((unsigned char*)signature); } @@ -200,7 +200,7 @@ Exception(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jthread thread, if (vm_mode == VM_MODE_MIXED) { if (!NSK_JVMTI_VERIFY(jvmti_env->SetEventNotificationMode( ((newFlag) ? JVMTI_DISABLE : JVMTI_ENABLE), - JVMTI_EVENT_SINGLE_STEP, NULL))) + JVMTI_EVENT_SINGLE_STEP, nullptr))) nsk_jvmti_setFailStatus(); } @@ -217,16 +217,16 @@ Exception(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jthread thread, /* ========================================================================== */ -static jrawMonitorID waitLock = NULL; +static jrawMonitorID waitLock = nullptr; static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { int i; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, nullptr))) return NSK_FALSE; if (vm_mode != VM_MODE_COMPILED) { - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_SINGLE_STEP, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_SINGLE_STEP, nullptr))) return NSK_FALSE; } @@ -235,27 +235,27 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { for (i = 0; i < classCount; i++) { NSK_DISPLAY1("Find class: %s\n", names[i]); - if (!NSK_JNI_VERIFY(jni, (old_class_def[i].klass = jni->FindClass(names[i])) != NULL)) + if (!NSK_JNI_VERIFY(jni, (old_class_def[i].klass = jni->FindClass(names[i])) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (old_class_def[i].klass = (jclass) - jni->NewGlobalRef(old_class_def[i].klass)) != NULL)) + jni->NewGlobalRef(old_class_def[i].klass)) != nullptr)) return NSK_FALSE; } if (bci_mode != BCI_MODE_EMCP) { NSK_DISPLAY1("Find class: %s\n", PROFILE_CLASS_NAME); - if (!NSK_JNI_VERIFY(jni, (profile_klass = jni->FindClass(PROFILE_CLASS_NAME)) != NULL)) + if (!NSK_JNI_VERIFY(jni, (profile_klass = jni->FindClass(PROFILE_CLASS_NAME)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (profile_klass = (jclass) - jni->NewGlobalRef(profile_klass)) != NULL)) + jni->NewGlobalRef(profile_klass)) != nullptr)) return NSK_FALSE; if (!NSK_JNI_VERIFY(jni, (count_field = jni->GetStaticFieldID(profile_klass, (bci_mode == BCI_MODE_CALL) ? "callCount" : "allocCount", - "I")) != NULL)) + "I")) != nullptr)) return NSK_FALSE; if (!NSK_JVMTI_VERIFY(jvmti->Allocate(classCount * sizeof(jvmtiClassDefinition), @@ -273,7 +273,7 @@ static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) { } if (sync_freq) { - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_EXCEPTION, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_EXCEPTION, nullptr))) return NSK_FALSE; } @@ -318,7 +318,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { return; if (sync_freq) { - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_EXCEPTION, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_EXCEPTION, nullptr))) nsk_jvmti_setFailStatus(); } else { @@ -333,7 +333,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { if (vm_mode == VM_MODE_MIXED) { if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode( (((i % 2) == 0) ? JVMTI_DISABLE : JVMTI_ENABLE), - JVMTI_EVENT_SINGLE_STEP, NULL))) + JVMTI_EVENT_SINGLE_STEP, nullptr))) nsk_jvmti_setFailStatus(); } @@ -348,7 +348,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { } if (vm_mode != VM_MODE_COMPILED) { - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_SINGLE_STEP, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_SINGLE_STEP, nullptr))) nsk_jvmti_setFailStatus(); } @@ -360,7 +360,7 @@ agentProc(jvmtiEnv* jvmti, JNIEnv* jni, void* arg) { /** Agent library initialization. */ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { - jvmtiEnv* jvmti = NULL; + jvmtiEnv* jvmti = nullptr; jvmtiCapabilities caps; jvmtiEventCallbacks callbacks; const char* optValue; @@ -388,7 +388,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { package_name = nsk_jvmti_findOptionStringValue("package", DEFAULT_PACKAGE_NAME); - if (!NSK_VERIFY(package_name != NULL)) + if (!NSK_VERIFY(package_name != nullptr)) return JNI_ERR; NSK_DISPLAY1("package: %s\n", package_name); @@ -403,7 +403,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { NSK_DISPLAY1("classes: %d\n", max_classes); optValue = nsk_jvmti_findOptionValue("mode"); - if (optValue != NULL) { + if (optValue != nullptr) { if (strcmp(optValue, "compiled") == 0) vm_mode = VM_MODE_COMPILED; else if (strcmp(optValue, "interpreted") == 0) @@ -417,7 +417,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { } optValue = nsk_jvmti_findOptionValue("bci"); - if (optValue != NULL) { + if (optValue != nullptr) { if (strcmp(optValue, "emcp") == 0) bci_mode = BCI_MODE_EMCP; else if (strcmp(optValue, "call") == 0) @@ -437,7 +437,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; /* allocate tables for classes */ @@ -464,7 +464,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) return JNI_ERR; - if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL))) + if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, nullptr))) return JNI_ERR; /* set event callbacks */ @@ -481,9 +481,9 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { return JNI_ERR; /* enable events */ - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, nullptr))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/jvmti_FollowRefObjects.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/jvmti_FollowRefObjects.cpp index 2a9931971b58..497fd4f91325 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/jvmti_FollowRefObjects.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/jvmti_FollowRefObjects.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2024, 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,9 +23,9 @@ #include #include -#include "jni_tools.h" -#include "jvmti_tools.h" -#include "jvmti_FollowRefObjects.h" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" +#include "jvmti_FollowRefObjects.hpp" extern "C" { @@ -131,13 +131,13 @@ JNIEXPORT jboolean JNICALL Java_nsk_jvmti_unit_FollowReferences_FollowRefObjects jboolean fCopy; const char * s; - if (!NSK_VERIFY((s = jni->GetStringUTFChars(sInfo, &fCopy)) != NULL)) { + if (!NSK_VERIFY((s = jni->GetStringUTFChars(sInfo, &fCopy)) != nullptr)) { NSK_COMPLAIN1("Can't get string at %#p\n", sInfo); return JNI_FALSE; } if (!s) { - NSK_COMPLAIN1("Can't get string at %#p: NULL\n", sInfo); + NSK_COMPLAIN1("Can't get string at %#p: null\n", sInfo); return JNI_FALSE; } @@ -193,7 +193,7 @@ static RefToVerify * findRefToVerify(jlong tagFrom, jlong tagTo, jint refKind) } } - return NULL; + return nullptr; } static jboolean addRefToVerify(jlong tagFrom, jlong tagTo, jint refKind, int expectedCount, int actualCount) @@ -238,7 +238,7 @@ JNIEXPORT jboolean JNICALL Java_nsk_jvmti_unit_FollowReferences_FollowRefObjects } pRefRec = findRefToVerify(tagFrom, tagTo, refKind); - if (pRefRec != NULL) { + if (pRefRec != nullptr) { pRefRec->_expectedCount += count; return JNI_TRUE; } @@ -251,7 +251,7 @@ jboolean markRefToVerify(jlong tagFrom, jlong tagTo, int refKind) RefToVerify * pRefRec; pRefRec = findRefToVerify(tagFrom, tagTo, refKind); - if (pRefRec != NULL) { + if (pRefRec != nullptr) { pRefRec->_actualCount++; return JNI_TRUE; } @@ -380,14 +380,14 @@ jint JNICALL wrongStringPrimitiveValueCallback( void jvmti_FollowRefObject_init() { - g_wrongHeapCallbacks.heap_iteration_callback = NULL; + g_wrongHeapCallbacks.heap_iteration_callback = nullptr; g_wrongHeapCallbacks.heap_reference_callback = wrongHeapReferenceCallback; g_wrongHeapCallbacks.primitive_field_callback = wrongPrimitiveFieldCallback; g_wrongHeapCallbacks.array_primitive_value_callback = wrongArrayPrimitiveValueCallback; g_wrongHeapCallbacks.string_primitive_value_callback = wrongStringPrimitiveValueCallback; - Java_nsk_jvmti_unit_FollowReferences_FollowRefObjects_resetTags(NULL, NULL); - Java_nsk_jvmti_unit_FollowReferences_FollowRefObjects_resetRefsToVerify(NULL, NULL); + Java_nsk_jvmti_unit_FollowReferences_FollowRefObjects_resetTags(nullptr, nullptr); + Java_nsk_jvmti_unit_FollowReferences_FollowRefObjects_resetRefsToVerify(nullptr, nullptr); } /* ============================================================================= */ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/jvmti_FollowRefObjects.h b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/jvmti_FollowRefObjects.hpp similarity index 94% rename from test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/jvmti_FollowRefObjects.h rename to test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/jvmti_FollowRefObjects.hpp index 2c0bb8e2a6bf..abae1af63d8a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/jvmti_FollowRefObjects.h +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/jvmti_FollowRefObjects.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2024, 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,8 +20,8 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -#ifndef __FollowRefObject_h -#define __FollowRefObject_h +#ifndef __FollowRefObject_hpp +#define __FollowRefObject_hpp #include @@ -34,7 +34,7 @@ void jvmti_FollowRefObject_init(); /* ============================================================================= */ #define DBG(x) x -#define DEREF(ptr) (((ptr) == NULL ? 0 : *(ptr))) +#define DEREF(ptr) (((ptr) == nullptr ? 0 : *(ptr))) extern jvmtiHeapCallbacks g_wrongHeapCallbacks; /* Callbacks that blame */ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/jvmti_tools.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/jvmti_tools.cpp index d98d9fa0f3a2..542e286c63cf 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/jvmti_tools.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/jvmti_tools.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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 @@ -33,10 +33,10 @@ /*************************************************************/ -#include "nsk_tools.h" -#include "jni_tools.h" -#include "jvmti_tools.h" -#include "JVMTITools.h" +#include "nsk_tools.hpp" +#include "jni_tools.hpp" +#include "jvmti_tools.hpp" +#include "JVMTITools.hpp" /*************************************************************/ @@ -100,9 +100,9 @@ static int check_option(int dashed, const char name[], const char value[]) { return NSK_FALSE; } { - char* end = NULL; + char* end = nullptr; long n = strtol(value, &end, 10); - if (end == NULL || end == value || *end != '\0') { + if (end == nullptr || end == value || *end != '\0') { nsk_complain("nsk_jvmti_parseOptions(): not integer value in option: %s=%s\n", name, value); return NSK_FALSE; } @@ -140,7 +140,7 @@ static int add_option(const char opt[], int opt_len, const char val[], int val_l name = (char*)malloc(opt_len + 1); value = (char*)malloc(val_len + 1); - if (name == NULL || value == NULL) { + if (name == nullptr || value == nullptr) { nsk_complain("nsk_jvmti_parseOptions(): out of memory\n"); success = NSK_FALSE; } else { @@ -168,9 +168,9 @@ static int add_option(const char opt[], int opt_len, const char val[], int val_l } if (!success) { - if (name != NULL) + if (name != nullptr) free(name); - if (value != NULL) + if (value != nullptr) free(value); } @@ -186,9 +186,9 @@ static void nsk_jvmti_free() { } context.options.count = 0; } - if (context.options.string != NULL) { + if (context.options.string != nullptr) { free(context.options.string); - context.options.string = NULL; + context.options.string = nullptr; } } @@ -200,18 +200,18 @@ static char* token(char **s, const char *delim) { char *p; char *start = *s; - if (s == NULL || *s == NULL) { - return NULL; + if (s == nullptr || *s == nullptr) { + return nullptr; } p = strpbrk(*s, delim); - if (p != NULL) { + if (p != nullptr) { /* Advance to next token. */ *p = '\0'; *s = p + 1; } else { /* End of tokens. */ - *s = NULL; + *s = nullptr; } return start; @@ -220,11 +220,11 @@ static char* token(char **s, const char *delim) { int nsk_jvmti_parseOptions(const char options[]) { int success = NSK_TRUE; - char *str = NULL; - char *name = NULL; - char *value = NULL; + char *str = nullptr; + char *name = nullptr; + char *value = nullptr; const char *delimiters = " ,~"; - if (options == NULL) + if (options == nullptr) return success; /* @@ -235,10 +235,10 @@ int nsk_jvmti_parseOptions(const char options[]) { /* Create a temporary copy of the options string to be tokenized. */ str = strdup(options); - while ((name = token(&str, delimiters)) != NULL) { + while ((name = token(&str, delimiters)) != nullptr) { value = strchr(name, '='); - if (value != NULL) { + if (value != nullptr) { *value++ = '\0'; } if (!add_option(name, (int)strlen(name), value, @@ -250,7 +250,7 @@ int nsk_jvmti_parseOptions(const char options[]) { if (!success) { nsk_jvmti_free(); } - if (str != NULL) { + if (str != nullptr) { free(str); } return success; @@ -259,45 +259,45 @@ int nsk_jvmti_parseOptions(const char options[]) { /*************************************************************/ /** - * Returns value of given option name; or NULL if no such option found. - * If search name is NULL then complains an error and returns NULL. + * Returns value of given option name; or nullptr if no such option found. + * If search name is nullptr then complains an error and returns nullptr. */ const char* nsk_jvmti_findOptionValue(const char name[]) { int i; - if (name == NULL) { - nsk_complain("nsk_jvmti_findOptionValue(): option name is NULL\n"); - return NULL; + if (name == nullptr) { + nsk_complain("nsk_jvmti_findOptionValue(): option name is null\n"); + return nullptr; } for (i = 0; i < context.options.count; i++) { if (strcmp(name, context.options.names[i]) == 0) return context.options.values[i]; } - return NULL; + return nullptr; } /** * Returns string value of given option; or defaultValue if no such option found. - * If options is specified but has empty value then complains an error and returns NULL. + * If options is specified but has empty value then complains an error and returns nullptr. */ const char* nsk_jvmti_findOptionStringValue(const char name[], const char* defaultValue) { const char* value; - if (name == NULL) { - nsk_complain("nsk_jvmti_findOptionStringValue(): option name is NULL\n"); - return NULL; + if (name == nullptr) { + nsk_complain("nsk_jvmti_findOptionStringValue(): option name is null\n"); + return nullptr; } value = nsk_jvmti_findOptionValue(name); - if (value == NULL) { + if (value == nullptr) { return defaultValue; } if (strlen(value) <= 0) { nsk_complain("nsk_jvmti_findOptionStringValue(): empty value of option: %s=%s\n", name, value); - return NULL; + return nullptr; } return value; } @@ -309,13 +309,13 @@ const char* nsk_jvmti_findOptionStringValue(const char name[], const char* defau int nsk_jvmti_findOptionIntValue(const char name[], int defaultValue) { const char* value; - if (name == NULL) { - nsk_complain("nsk_jvmti_findOptionIntValue(): option name is NULL\n"); + if (name == nullptr) { + nsk_complain("nsk_jvmti_findOptionIntValue(): option name is null\n"); return -1; } value = nsk_jvmti_findOptionValue(name); - if (value == NULL) { + if (value == nullptr) { return defaultValue; } @@ -326,10 +326,10 @@ int nsk_jvmti_findOptionIntValue(const char name[], int defaultValue) { } { - char* endptr = NULL; + char* endptr = nullptr; int n = strtol(value, &endptr, 10); - if (endptr == NULL || *endptr != '\0') { + if (endptr == nullptr || *endptr != '\0') { nsk_complain("nsk_jvmti_findOptionIntValue(): not integer value of option: %s=%s\n", name, value); return -1; @@ -347,24 +347,24 @@ int nsk_jvmti_getOptionsCount() { /** * Returns name of i-th parsed option. - * If no such option then complains an error and returns NULL. + * If no such option then complains an error and returns nullptr. */ const char* nsk_jvmti_getOptionName(int i) { if (i < 0 || i >= context.options.count) { nsk_complain("nsk_jvmti_getOptionName(): option index out of bounds: %d\n", i); - return NULL; + return nullptr; } return context.options.names[i]; } /** * Returns value of i-th parsed option. - * If no such option then complains an error and returns NULL. + * If no such option then complains an error and returns nullptr. */ const char* nsk_jvmti_getOptionValue(int i) { if (i < 0 || i >= context.options.count) { nsk_complain("nsk_jvmti_getOptionValue(): option index out of bounds: %d\n", i); - return NULL; + return nullptr; } return context.options.values[i]; } @@ -416,10 +416,10 @@ int nsk_jvmti_lverify(int positive, jvmtiError error, jvmtiError expected, JNIEXPORT jstring JNICALL Java_nsk_share_jvmti_ArgumentHandler_getAgentOptionsString(JNIEnv *jni, jobject obj) { - jstring str_obj = NULL; + jstring str_obj = nullptr; - if (!NSK_JNI_VERIFY(jni, (str_obj = jni->NewStringUTF(context.options.string)) != NULL)) { - return NULL; + if (!NSK_JNI_VERIFY(jni, (str_obj = jni->NewStringUTF(context.options.string)) != nullptr)) { + return nullptr; } return str_obj; } @@ -455,13 +455,13 @@ int nsk_jvmti_redefineClass(jvmtiEnv * jvmti, jclass classToRedefine, const char * fileName) { redefineAttempted = NSK_TRUE; - if (nsk_jvmti_findOptionValue(NSK_JVMTI_OPT_PATH_TO_NEW_BYTE_CODE) == NULL) { + if (nsk_jvmti_findOptionValue(NSK_JVMTI_OPT_PATH_TO_NEW_BYTE_CODE) == nullptr) { nsk_printf("# error expected: %s \n", NSK_JVMTI_OPT_PATH_TO_NEW_BYTE_CODE); nsk_printf("Hint :: missing java -agentlib:agentlib=%s=DirName, ($TESTBASE/bin) \n", NSK_JVMTI_OPT_PATH_TO_NEW_BYTE_CODE); return NSK_FALSE; } - if (fileName == NULL) { + if (fileName == nullptr) { nsk_printf("# error file name expected did not found \n"); return NSK_FALSE; } @@ -481,7 +481,7 @@ int nsk_jvmti_redefineClass(jvmtiEnv * jvmti, bytecode = fopen(file, "rb"); error= JVMTI_ERROR_NONE; - if (bytecode == NULL) { + if (bytecode == nullptr) { nsk_printf("# error **Agent::error opening file %s \n",file); return NSK_FALSE; } @@ -596,7 +596,7 @@ int suspendThreadAtMethod(jvmtiEnv *jvmti, jclass cls, jobject thread, jmethodID } int result = NSK_TRUE; - jmethodID method = NULL; + jmethodID method = nullptr; jlocation loc; // We need to ensure that the thread is suspended at the right place when the top diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/jvmti_tools.h b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/jvmti_tools.hpp similarity index 94% rename from test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/jvmti_tools.h rename to test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/jvmti_tools.hpp index 31eac2861580..4a3d3e7bf4f6 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/jvmti_tools.h +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/jvmti_tools.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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,9 +30,9 @@ /*************************************************************/ -#include "nsk_tools.h" -#include "jni_tools.h" -#include "JVMTITools.h" +#include "nsk_tools.hpp" +#include "jni_tools.hpp" +#include "JVMTITools.hpp" extern "C" { @@ -81,7 +81,7 @@ int nsk_jvmti_parseOptions(const char options[]); /** * Creates JVMTI environment for the JVMTI test. - * If something fails, complains an error and returns NULL. + * If something fails, complains an error and returns null. */ jvmtiEnv* nsk_jvmti_createJVMTIEnv(JavaVM* jvm, void* reserved); @@ -102,19 +102,19 @@ int nsk_jvmti_init_MA(jvmtiEventCallbacks* callbacks); /** * Returns thread object associated with agent thread.. - * If something fails, complains an error and returns NULL. + * If something fails, complains an error and returns null. */ jthread nsk_jvmti_getAgentThread(); /** * Returns JNI environment constructed for agent thread. - * If something fails, complains an error and returns NULL. + * If something fails, complains an error and returns null. */ JNIEnv* nsk_jvmti_getAgentJNIEnv(); /** * Returns JVMTI environment constructed for agent. - * If something fails, complains an error and returns NULL. + * If something fails, complains an error and returns null. */ jvmtiEnv* nsk_jvmti_getAgentJVMTIEnv(); @@ -170,14 +170,14 @@ jint nsk_jvmti_getStatus(); /** * Finds first class with given signatire among loaded classes. - * If no class found or something fails, complains an error and returns NULL. + * If no class found or something fails, complains an error and returns null. * On success creates and returns global reference to the found class. */ jclass nsk_jvmti_classBySignature(const char signature[]); /** * Finds first thread with given name among alive threads. - * If no thread found or something fails, complains an error and returns NULL. + * If no thread found or something fails, complains an error and returns null. * On success creates and returns global reference to the found thread. */ jthread nsk_jvmti_threadByName(const char name[]); @@ -223,7 +223,7 @@ jlocation nsk_jvmti_clearLineBreakpoint(jclass cls, jmethodID method, int line); /********************* Events management *********************/ /** - * Enables or disables all events of given list for given thread or NULL. + * Enables or disables all events of given list for given thread or null. * If something fails, complains an error and returns 0 (NSK_FALSE). */ int nsk_jvmti_enableEvents(jvmtiEventMode enable, int size, @@ -258,14 +258,14 @@ int nsk_jvmti_disableNotification(jvmtiEnv *jvmti, jvmtiEvent event, jthread thr /******************** Access test options ********************/ /** - * Returns value of given option name; or NULL if no such option found. - * If search name is NULL then complains an error and returns NULL. + * Returns value of given option name; or null if no such option found. + * If search name is null then complains an error and returns null. */ const char* nsk_jvmti_findOptionValue(const char name[]); /** * Returns string value of given option; or defaultValue if no such option found. - * If options is specified but has empty value then complains an error and returns NULL. + * If options is specified but has empty value then complains an error and returns null. */ const char* nsk_jvmti_findOptionStringValue(const char name[], const char* defaultValue); @@ -282,13 +282,13 @@ int nsk_jvmti_getOptionsCount(); /** * Returns name of i-th parsed option. - * If no such option then complains an error and returns NULL. + * If no such option then complains an error and returns null. */ const char* nsk_jvmti_getOptionName(int i); /** * Returns value of i-th parsed option. - * If no such option then complains an error and returns NULL. + * If no such option then complains an error and returns null. */ const char* nsk_jvmti_getOptionValue(int i); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/unit/Heap.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/unit/Heap.cpp index fe7f3f16f162..0c0ebc485dc6 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/unit/Heap.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/jvmti/unit/Heap.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,7 +27,7 @@ #include "jni.h" #include "jvmti.h" -#include "agent_common.h" +#include "agent_common.hpp" extern "C" { @@ -42,7 +42,7 @@ static jboolean user_data_error_flag = JNI_FALSE; static jvmtiEventObjectFree object_free_callback; static void JNICALL default_object_free(jvmtiEnv *env, jlong tag) { - if (object_free_callback != NULL) { + if (object_free_callback != nullptr) { (*object_free_callback)(env, tag); } } @@ -58,9 +58,9 @@ static jvmtiIterationControl JNICALL default_heap_object_callback } static jvmtiHeapObjectCallback heap_object_callback = default_heap_object_callback; -static jvmtiHeapRootCallback heap_root_callback = NULL; -static jvmtiStackReferenceCallback stack_ref_callback = NULL; -static jvmtiObjectReferenceCallback object_ref_callback = NULL; +static jvmtiHeapRootCallback heap_root_callback = nullptr; +static jvmtiStackReferenceCallback stack_ref_callback = nullptr; +static jvmtiObjectReferenceCallback object_ref_callback = nullptr; /* * Basic tagging functions @@ -182,13 +182,13 @@ JNIEXPORT jint JNICALL Java_nsk_share_jvmti_unit_Heap_getObjectsWithTags /* get rid of any arrays that we are holding from a previous call */ - if (object_results_ref != NULL) { + if (object_results_ref != nullptr) { env->DeleteGlobalRef(object_results_ref); - object_results_ref = NULL; + object_results_ref = nullptr; } - if (tag_results_ref != NULL) { + if (tag_results_ref != nullptr) { env->DeleteGlobalRef(tag_results_ref); - tag_results_ref = NULL; + tag_results_ref = nullptr; } /* copy input list-of-tags from java into C */ @@ -210,7 +210,7 @@ JNIEXPORT jint JNICALL Java_nsk_share_jvmti_unit_Heap_getObjectsWithTags cls = env->FindClass("java/lang/Object"); - object_array = env->NewObjectArray(count, cls, NULL); + object_array = env->NewObjectArray(count, cls, nullptr); tag_array = env->NewLongArray(count); for (i=0; iSetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, NULL); + err = jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, nullptr); if (err != JVMTI_ERROR_NONE) { fprintf(stderr, "SetEventNotificationMode failed, error=%d\n", err); return -1; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/locks/JNIMonitorLocker.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/locks/JNIMonitorLocker.cpp index a82f4cca5fa5..f54e15ff6cfa 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/locks/JNIMonitorLocker.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/locks/JNIMonitorLocker.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. */ #include "jni.h" -#include "nsk_tools.h" +#include "nsk_tools.hpp" extern "C" { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/locks/LockingThread.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/locks/LockingThread.cpp index 4bb08c1aad3c..908a5cc56c76 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/locks/LockingThread.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/locks/LockingThread.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. */ #include "jni.h" -#include "nsk_tools.h" +#include "nsk_tools.hpp" extern "C" { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/native/README b/test/hotspot/jtreg/vmTestbase/nsk/share/native/README index 2c564c5c1322..42467aa009df 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/native/README +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/native/README @@ -1,4 +1,4 @@ -Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. +Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,8 @@ This directory contains source files of testbase_nsk native framework, which provides support for native tests. Source files: - nsk_tools.h - nsk_tools.c + nsk_tools.hpp + nsk_tools.cpp Naming conventions: macroses: NSK_* @@ -36,8 +36,8 @@ Also this directory provides support for running native threads in a platform independent manner. Source files: - native_thread.h - native_thread.c + native_thread.hpp + native_thread.cpp Naming conventions: functions: THREAD_* @@ -46,15 +46,15 @@ The following source files declares a set of functions which provides support for lists of various objects Source files: - nsk_list.h - nsk_list.c + nsk_list.hpp + nsk_list.cpp Naming conventions: functions: nsk_list_* --------------------------------------------------------------------------------- -nsk_tools.h +nsk_tools.hpp Provides functions and macroses for the most usefull actions: @@ -100,7 +100,7 @@ use special macroses defined in share/jni and share/jvmti frameworks. --------------------------------------------------------------------------------- -native_thread.h +native_thread.hpp Provides platform-independent support for running native threads: @@ -119,7 +119,7 @@ Provides platform-independent support for running native threads: --------------------------------------------------------------------------------- -nsk_list.h +nsk_list.hpp Provides support for lists of various objects: diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/native/native_thread.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/native/native_thread.cpp index c6e95b11f78e..4e8bf729cffb 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/native/native_thread.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/native/native_thread.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ #include /* testbase_nsk threads: */ -#include +#include /***************************************************************/ @@ -73,12 +73,12 @@ typedef /***************************************************************/ /** - * Return a new thread mirror, or NULL if failed. + * Return a new thread mirror, or nullptr if failed. */ void* THREAD_new(PROCEDURE procedure, void* context) { THREAD* thread = (THREAD*)malloc(sizeof(THREAD)); - if (thread == NULL) - return NULL; + if (thread == nullptr) + return nullptr; thread->procedure = procedure; thread->context = context; thread->started = 0; /* No */ @@ -102,30 +102,30 @@ void* procedure(void* t) { } /** - * Return the thread if started OK, or NULL if failed. + * Return the thread if started OK, or nullptr if failed. */ void* THREAD_start(void* t) { THREAD* thread = (THREAD*)t; - if (thread == NULL) - return NULL; + if (thread == nullptr) + return nullptr; if (thread->started != 0) - return NULL; + return nullptr; /* thread->started = 0; -- not yet */ thread->finished = 0; thread->status = 0; { #ifdef windows - uintptr_t result = _beginthreadex(NULL,0,procedure,thread,0,&(thread->id)); + uintptr_t result = _beginthreadex(nullptr,0,procedure,thread,0,&(thread->id)); if (result == 0) { perror("failed to create a native thread"); - return NULL; + return nullptr; } #elif sun - int result = thr_create(NULL,0,procedure,thread,0,&(thread->id)); + int result = thr_create(nullptr,0,procedure,thread,0,&(thread->id)); if (result != 0) { perror("failed to create a native thread"); - return NULL; + return nullptr; } #else // !windows & !sun pthread_attr_t attr; @@ -135,7 +135,7 @@ void* THREAD_start(void* t) { int result = pthread_create(&(thread->id), &attr, procedure, thread); if (result != 0) { perror("failed to create a native thread"); - return NULL; + return nullptr; } pthread_attr_destroy(&attr); #endif // !windows & !sun @@ -147,11 +147,11 @@ void* THREAD_start(void* t) { /** * Return 1 if the thread has been started, or 0 if not, - * or -1 if thread == NULL. + * or -1 if thread == nullptr. */ int THREAD_isStarted(void* t) { THREAD* thread = (THREAD*)t; - if (thread == NULL) + if (thread == nullptr) return -1; return (thread->started == 1); } @@ -159,11 +159,11 @@ int THREAD_isStarted(void* t) { /** * Return 1 if the thread has been started and already has finished, * or 0 if the thread hasn't finish (or even hasn't been started), - * or -1 if thread == NULL. + * or -1 if thread == nullptr. */ int THREAD_hasFinished(void* t) { THREAD* thread = (THREAD*)t; - if (thread == NULL) + if (thread == nullptr) return -1; return (thread->finished == 1); } @@ -171,11 +171,11 @@ int THREAD_hasFinished(void* t) { /** * Return thread->status if thread has finished, * or return 0 if thread hasn't finished, - * or retuen -1 if thread == NULL. + * or retuen -1 if thread == nullptr. */ int THREAD_status(void* t) { THREAD* thread = (THREAD*)t; - if (thread == NULL) + if (thread == nullptr) return -1; return thread->status; } @@ -184,11 +184,11 @@ int THREAD_status(void* t) { /** * Cycle with 1 second sleeps until the thread has finished; - * or return immediately, if thread == NULL. + * or return immediately, if thread == nullptr. */ void THREAD_waitFor(void* t) { THREAD* thread = (THREAD*)t; - if (thread == NULL) + if (thread == nullptr) return; while (thread->finished == 0) THREAD_sleep(1); /* yield for a second */ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/native/native_thread.h b/test/hotspot/jtreg/vmTestbase/nsk/share/native/native_thread.hpp similarity index 82% rename from test/hotspot/jtreg/vmTestbase/nsk/share/native/native_thread.h rename to test/hotspot/jtreg/vmTestbase/nsk/share/native/native_thread.hpp index 4999089ab40d..7efc4e0d7221 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/native/native_thread.h +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/native/native_thread.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,8 +21,8 @@ * questions. */ -#ifndef NSK_SHARE_NATIVE_NATIVE_THREAD_H -#define NSK_SHARE_NATIVE_NATIVE_THREAD_H +#ifndef NSK_SHARE_NATIVE_NATIVE_THREAD_HPP +#define NSK_SHARE_NATIVE_NATIVE_THREAD_HPP extern "C" { @@ -33,38 +33,38 @@ extern "C" { typedef int(*PROCEDURE)(void*); /** - * Return a thread mirror, or NULL if failed. + * Return a thread mirror, or null if failed. */ void* THREAD_new(PROCEDURE procedure, void* context); /** - * Return the thread if started OK, or NULL if failed. + * Return the thread if started OK, or null if failed. */ void* THREAD_start(void* thread); /** * Return 1 if the thread has been started, or 0 if not, - * or -1 if thread==NULL. + * or -1 if thread==nullptr. */ int THREAD_isStarted(void* thread); /** * Return 1 if the thread has been started and already has finished, * or 0 if the thread hasn't finish (or even hasn't been started), - * or -1 if thread==NULL. + * or -1 if thread==nullptr. */ int THREAD_hasFinished(void* thread); /** * Return thread->status if thread has finished, * or return 0 if thread hasn't finished, - * or retuen -1 if thread==NULL. + * or retuen -1 if thread==nullptr. */ int THREAD_status(void* thread); /** * Cycle with 1 second sleeps until the thread has finished; - * or return immediately, if thread==NULL. + * or return immediately, if thread==nullptr. */ void THREAD_waitFor(void* thread); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_list.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_list.cpp index 74f2416dfced..736ddafdfaf0 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_list.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_list.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,8 +24,8 @@ #include #include #include -#include "nsk_list.h" -#include "nsk_tools.h" +#include "nsk_list.hpp" +#include "nsk_tools.hpp" extern "C" { @@ -48,16 +48,16 @@ const void* nsk_list_create() { /* create nsk_list_info */ list_info = (nsk_list_info *)malloc(sizeof(nsk_list_info)); - if (list_info == NULL) { - return NULL; + if (list_info == nullptr) { + return nullptr; } list_info->allocated_count = NSK_LIST_INIT_COUNT; list_info->elements_count = 0; list_info->arr = (const void **)malloc(list_info->allocated_count * nsk_list_size_void); - if (list_info->arr == NULL) { + if (list_info->arr == nullptr) { free(list_info); - return NULL; + return nullptr; } return list_info; @@ -84,7 +84,7 @@ int nsk_list_add(const void *plist, const void *p) { if (list_info->elements_count >= list_info->allocated_count) { list_info->allocated_count += NSK_LIST_INIT_COUNT; list_info->arr = (const void **)realloc((void *)list_info->arr, list_info->allocated_count * nsk_list_size_void); - if (list_info->arr == NULL) { + if (list_info->arr == nullptr) { return NSK_FALSE; } } @@ -131,7 +131,7 @@ const void* nsk_list_get(const void *plist, int i) { return list_info->arr[i]; } - return NULL; + return nullptr; } } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_list.h b/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_list.hpp similarity index 96% rename from test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_list.h rename to test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_list.hpp index 546e1db22bc5..82efc3c909a0 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_list.h +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_list.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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 diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_mutex.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_mutex.cpp index d057e364dea6..a51977b578a4 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_mutex.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_mutex.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,7 @@ */ #include -#include "nsk_mutex.h" +#include "nsk_mutex.hpp" extern "C" { @@ -35,7 +35,7 @@ MUTEX* MUTEX_create() MUTEX* mutex = (MUTEX*)malloc(sizeof(pthread_mutex_t)); if (mutex) { - pthread_mutex_init((pthread_mutex_t*)mutex, NULL); + pthread_mutex_init((pthread_mutex_t*)mutex, nullptr); } return mutex; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_mutex.h b/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_mutex.hpp similarity index 92% rename from test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_mutex.h rename to test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_mutex.hpp index 322b6a54dded..629a4079b70a 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_mutex.h +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_mutex.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,8 +21,8 @@ * questions. */ -#ifndef NSK_MUTEX_H -#define NSK_MUTEX_H +#ifndef NSK_MUTEX_HPP +#define NSK_MUTEX_HPP extern "C" { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_tools.cpp b/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_tools.cpp index 91992159a963..5d41ac31131c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_tools.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_tools.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,7 +31,7 @@ /*************************************************************/ -#include "nsk_tools.h" +#include "nsk_tools.hpp" /*************************************************************/ @@ -67,8 +67,8 @@ static const char* file_basename(const char* fullname) { const char* p; const char* base = fullname;; - if (fullname == NULL) - return NULL; + if (fullname == nullptr) + return nullptr; for (p = fullname; *p != '\0'; p++) { if (*p == '/' || *p == '\\') @@ -82,7 +82,7 @@ static const char* file_basename(const char* fullname) { void nsk_display(const char format[], ...) { va_list ap; va_start(ap,format); - nsk_lvdisplay(NULL,0,format,ap); + nsk_lvdisplay(nullptr,0,format,ap); va_end(ap); } @@ -94,14 +94,14 @@ void nsk_ldisplay(const char file[], int line, const char format[], ...) { } void nsk_vdisplay(const char format[], va_list ap) { - nsk_lvdisplay(NULL,0,format,ap); + nsk_lvdisplay(nullptr,0,format,ap); } void nsk_lvdisplay(const char file[], int line, const char format[], va_list ap) { if (!nsk_context.verbose) return; - if (file != NULL) + if (file != nullptr) (void) nsk_printf("- %s, %d: ",file_basename(file),line); (void) nsk_vprintf(format,ap); } @@ -111,7 +111,7 @@ void nsk_lvdisplay(const char file[], int line, const char format[], va_list ap) void nsk_complain(const char format[], ...) { va_list ap; va_start(ap,format); - nsk_lvcomplain(NULL,0,format,ap); + nsk_lvcomplain(nullptr,0,format,ap); va_end(ap); } @@ -124,7 +124,7 @@ void nsk_lcomplain(const char file[], int line, const char format[], ...) } void nsk_vcomplain(const char format[], va_list ap) { - nsk_lvcomplain(NULL,0,format,ap); + nsk_lvcomplain(nullptr,0,format,ap); } void nsk_lvcomplain(const char file[], int line, @@ -157,7 +157,7 @@ void nsk_lvcomplain(const char file[], int line, strncpy(msg_buf2, msg_buf, sizeof(msg_buf2)); // Only include up to the 1st newline in the exception's error message. nl_ptr = strchr(msg_buf2, '\n'); - if (nl_ptr != NULL) { + if (nl_ptr != nullptr) { nl_ptr++; // Skip past the newline char. *nl_ptr = '\0'; // Terminate the string after the newline char. } else if (strlen(msg_buf2) != 0) { @@ -165,14 +165,14 @@ void nsk_lvcomplain(const char file[], int line, } (void) nsk_printf("The following fake exception stacktrace is for failure analysis. \n"); (void) nsk_printf("nsk.share.Fake_Exception_for_RULE_Creation: "); - if (file != NULL) { + if (file != nullptr) { (void) nsk_printf("(%s:%d) ", file_basename(file), line); } (void) nsk_printf(msg_buf2); (void) nsk_printf("\tat nsk_lvcomplain(%s:%d)\n", file_basename(__FILE__), __LINE__); } - if (file != NULL) { + if (file != nullptr) { (void) nsk_printf("# ERROR: %s, %d: ", file_basename(file), line); } else { (void) nsk_printf("# ERROR: "); @@ -265,7 +265,7 @@ void nsk_printHexBytes(const char indent[], int columns, size_t i; - if (size <= 0 || bytes == NULL) + if (size <= 0 || bytes == nullptr) return; for (i = 0; i < size; i += columns) { @@ -298,7 +298,7 @@ void nsk_printHexBytes(const char indent[], int columns, /*************************************************************/ const char* nsk_null_string(const char* str) { - return (str == NULL)? "" : str; + return (str == nullptr)? "" : str; } /*************************************************************/ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_tools.h b/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_tools.hpp similarity index 98% rename from test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_tools.h rename to test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_tools.hpp index 12760fd458cd..6b262617c5c2 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_tools.h +++ b/test/hotspot/jtreg/vmTestbase/nsk/share/native/nsk_tools.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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 @@ -160,7 +160,7 @@ void nsk_printHexBytes(const char indent[], int columns, /*************************************************************/ /** - * Returns str or "" if str is NULL; useful for printing strings. + * Returns str or "" if str is null; useful for printing strings. */ const char* nsk_null_string(const char* str); diff --git a/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/gclocker/libgcl001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/gclocker/libgcl001.cpp index 54b9e9df6e4c..31951c0c8c4e 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/gclocker/libgcl001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/gclocker/libgcl001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, 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 @@ #include #include -#include "jnihelper.h" +#include "jnihelper.hpp" /* basic routine: provide critical sections and calculations @@ -37,22 +37,22 @@ #define BODY(type) \ int hash = 0; \ jsize i, arraySize, stringSize; \ - jchar *nativeStr = NULL; \ - type *nativeArray = NULL; \ + jchar *nativeStr = nullptr; \ + type *nativeArray = nullptr; \ \ arraySize = env->GetArrayLength(array); CE \ stringSize = env->GetStringLength(str); CE \ \ - nativeArray = (type *)env->GetPrimitiveArrayCritical(array, NULL); CE \ + nativeArray = (type *)env->GetPrimitiveArrayCritical(array, nullptr); CE \ qsort(nativeArray, arraySize, sizeof(type), *type##comp); \ \ - nativeStr = (jchar *)env->GetStringCritical(str, NULL); CE \ + nativeStr = (jchar *)env->GetStringCritical(str, nullptr); CE \ \ for (i = 0; i < stringSize; ++i) \ hash += (int)nativeStr[i]; \ env->ReleaseStringCritical(str, nativeStr); CE \ \ - nativeStr = (jchar *)env->GetStringCritical(str, NULL); CE \ + nativeStr = (jchar *)env->GetStringCritical(str, nullptr); CE \ \ env->ReleasePrimitiveArrayCritical(array, nativeArray, 0); CE \ \ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/jnihelper.h b/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/jnihelper.hpp similarity index 95% rename from test/hotspot/jtreg/vmTestbase/nsk/stress/jni/jnihelper.h rename to test/hotspot/jtreg/vmTestbase/nsk/stress/jni/jnihelper.hpp index 4edbde50cbcd..1f850d019f3c 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/jnihelper.h +++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/jnihelper.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,7 @@ // checked malloc to trap OOM conditions static void* c_malloc(JNIEnv* env, size_t size) { void* ret = malloc(size); - if (ret == NULL) + if (ret == nullptr) env->FatalError("malloc failed"); return ret; } diff --git a/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/libjnistress001.cpp b/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/libjnistress001.cpp index 2e056006824e..2a5c78488c36 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/libjnistress001.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/libjnistress001.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,7 +26,7 @@ /* Changed from strings.h to string.h for Windows. */ #include #include -#include "jnihelper.h" +#include "jnihelper.hpp" extern "C" { @@ -108,8 +108,8 @@ Java_nsk_stress_jni_JNIter001_jnistress (JNIEnv *env, jobject jobj, jstring jstr } if (memcmp(digest, element->checkstr[j], DIGESTLENGTH) == 0) { env->ReleaseStringUTFChars(jstr, element->str[j]); CE - element->str[j] = NULL; - element->checkstr[j] = NULL; + element->str[j] = nullptr; + element->checkstr[j] = nullptr; } else { compared = 0; printf("The element No. %d has been corrupted %s vs %s\n", j, @@ -217,8 +217,8 @@ Java_nsk_stress_jni_JNIter001_jnistress1(JNIEnv *env, jobject jobj, jstring jstr free(elem); if (memcmp(digest, javachars->checkstr[j], javachars->size[j]) == 0) { env->ReleaseStringChars(jstr, javachars->str[j]); CE - javachars->str[j] = NULL; - javachars->checkstr[j] = NULL; + javachars->str[j] = nullptr; + javachars->checkstr[j] = nullptr; javachars->size[j] = 0; } else { equal = 0; diff --git a/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/libjnistress002.cpp b/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/libjnistress002.cpp index 38f2afc67fef..ade5e8224cec 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/libjnistress002.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/libjnistress002.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, 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 @@ #include #include -#include "jnihelper.h" +#include "jnihelper.hpp" extern "C" { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/libjnistress003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/libjnistress003.cpp index 7bccbc95900d..4a261ff6aad3 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/libjnistress003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/libjnistress003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ #include #include #include -#include "jnihelper.h" +#include "jnihelper.hpp" extern "C" { @@ -141,8 +141,8 @@ Java_nsk_stress_jni_JNIter003_jniBodyChangeArray (JNIEnv *env, jobject jobj, jdouble *doubleOrig, *doubleClone; int i; - if ((orig == NULL) || (clone == NULL)) { - fprintf(stderr, "JNI received a NULL array from Java\n"); + if ((orig == nullptr) || (clone == nullptr)) { + fprintf(stderr, "JNI received a null array from Java\n"); return JNI_FALSE; } if (count == limit) { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/libjnistress004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/libjnistress004.cpp index dbe8e2f828b9..8347d00da803 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/libjnistress004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/libjnistress004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ #include #include #include -#include "jnihelper.h" +#include "jnihelper.hpp" extern "C" { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/libjnistress005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/libjnistress005.cpp index 03ace5daa70e..bafd23b4cec8 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/libjnistress005.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/libjnistress005.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ #include #include #include -#include "jnihelper.h" +#include "jnihelper.hpp" extern "C" { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/libjnistress006.cpp b/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/libjnistress006.cpp index b10cb539fdcb..c84685a50fe8 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/libjnistress006.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/libjnistress006.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ #include #include #include -#include "jnihelper.h" +#include "jnihelper.hpp" extern "C" { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/libjnistress007.cpp b/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/libjnistress007.cpp index 6732780bcd21..44c195cfd6b0 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/libjnistress007.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/jni/libjnistress007.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, 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 @@ #include #include -#include "jnihelper.h" +#include "jnihelper.hpp" extern "C" { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/nsk_strace.h b/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/nsk_strace.hpp similarity index 91% rename from test/hotspot/jtreg/vmTestbase/nsk/stress/strace/nsk_strace.h rename to test/hotspot/jtreg/vmTestbase/nsk/stress/strace/nsk_strace.hpp index eb787baddac1..5cc6efdb7a80 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/nsk_strace.h +++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/nsk_strace.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,7 @@ */ #include -#include "jni_tools.h" +#include "jni_tools.hpp" #ifndef _IS_NSK_STRACE_DEFINED_ #define _IS_NSK_STRACE_DEFINED_ @@ -35,7 +35,7 @@ // Check for pending exception of the specified type // If it's present, then clear it #define EXCEPTION_CHECK(exceptionClass, recurDepth) \ - if (EXCEPTION_OCCURRED != NULL) { \ + if (EXCEPTION_OCCURRED != nullptr) { \ jobject exception = EXCEPTION_OCCURRED; \ if (env->IsInstanceOf(exception, exceptionClass) == JNI_TRUE) { \ EXCEPTION_CLEAR; \ @@ -45,22 +45,22 @@ #define FIND_CLASS(_class, _className)\ if (!NSK_JNI_VERIFY(env, (_class = \ - env->FindClass(_className)) != NULL))\ + env->FindClass(_className)) != nullptr))\ exit(1) #define GET_OBJECT_CLASS(_class, _obj)\ if (!NSK_JNI_VERIFY(env, (_class = \ - env->GetObjectClass(_obj)) != NULL))\ + env->GetObjectClass(_obj)) != nullptr))\ exit(1) #define GET_FIELD_ID(_fieldID, _class, _fieldName, _fieldSig)\ if (!NSK_JNI_VERIFY(env, (_fieldID = \ - env->GetFieldID(_class, _fieldName, _fieldSig)) != NULL))\ + env->GetFieldID(_class, _fieldName, _fieldSig)) != nullptr))\ exit(1) #define GET_STATIC_FIELD_ID(_fieldID, _class, _fieldName, _fieldSig)\ if (!NSK_JNI_VERIFY(env, (_fieldID = \ - env->GetStaticFieldID(_class, _fieldName, _fieldSig)) != NULL))\ + env->GetStaticFieldID(_class, _fieldName, _fieldSig)) != nullptr))\ exit(1) #define GET_STATIC_BOOL_FIELD(_value, _class, _fieldName)\ @@ -93,12 +93,12 @@ #define GET_STATIC_METHOD_ID(_methodID, _class, _methodName, _sig)\ if (!NSK_JNI_VERIFY(env, (_methodID = \ - env->GetStaticMethodID(_class, _methodName, _sig)) != NULL))\ + env->GetStaticMethodID(_class, _methodName, _sig)) != nullptr))\ exit(1) #define GET_METHOD_ID(_methodID, _class, _methodName, _sig)\ if (!NSK_JNI_VERIFY(env, (_methodID = \ - env->GetMethodID(_class, _methodName, _sig)) != NULL))\ + env->GetMethodID(_class, _methodName, _sig)) != nullptr))\ exit(1) #define CALL_STATIC_VOID_NOPARAM(_class, _methodName)\ diff --git a/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace003.cpp b/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace003.cpp index 727da0f53246..1c1c91d242bc 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace003.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace003.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,7 @@ */ #include -#include "nsk_strace.h" +#include "nsk_strace.hpp" extern "C" { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace004.cpp b/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace004.cpp index ee278b054be2..031397841ac4 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace004.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace004.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,7 @@ */ #include -#include "nsk_strace.h" +#include "nsk_strace.hpp" extern "C" { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace005.cpp b/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace005.cpp index 4cc89978fd1d..1539727d8fdd 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace005.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace005.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,8 +22,8 @@ */ #include -#include "nsk_strace.h" -#include "nsk_tools.h" +#include "nsk_strace.hpp" +#include "nsk_tools.hpp" extern "C" { @@ -42,7 +42,7 @@ JNI_OnLoad(JavaVM *vm, void *reserved) FIND_CLASS(stackOverflowErrorClass, "java/lang/StackOverflowError"); stackOverflowErrorClass = (jclass) env->NewGlobalRef(stackOverflowErrorClass); - if (stackOverflowErrorClass == NULL) { + if (stackOverflowErrorClass == nullptr) { printf("Can't create global ref for stack overflow class\n"); return 0; } @@ -56,7 +56,7 @@ JNI_OnUnload(JavaVM *vm, void *reserved) JNIEnv *env; if (vm->GetEnv((void **) &env, JNI_VERSION) != JNI_OK) { - if (stackOverflowErrorClass != NULL) { + if (stackOverflowErrorClass != nullptr) { env->DeleteGlobalRef(stackOverflowErrorClass); } } else { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace006.cpp b/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace006.cpp index 9b5329f2cb9b..a6e4cf3b6624 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace006.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace006.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,7 @@ */ #include -#include "nsk_strace.h" +#include "nsk_strace.hpp" extern "C" { @@ -44,7 +44,7 @@ JNI_OnLoad(JavaVM *vm, void *reserved) FIND_CLASS(stackOverflowErrorClass, "java/lang/StackOverflowError"); stackOverflowErrorClass = (jclass) env->NewGlobalRef(stackOverflowErrorClass); - if (stackOverflowErrorClass == NULL) { + if (stackOverflowErrorClass == nullptr) { printf("Can't create global ref for stack overflow class\n"); return 0; } @@ -58,7 +58,7 @@ JNI_OnUnload(JavaVM *vm, void *reserved) JNIEnv *env; if (vm->GetEnv((void **) &env, JNI_VERSION) != JNI_OK) { - if (stackOverflowErrorClass != NULL) { + if (stackOverflowErrorClass != nullptr) { env->DeleteGlobalRef(stackOverflowErrorClass); } } else { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace008.cpp b/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace008.cpp index cca0c1c2d8a4..18c8d76e1883 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace008.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace008.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,7 @@ */ #include -#include "nsk_strace.h" +#include "nsk_strace.hpp" extern "C" { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace009.cpp b/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace009.cpp index 995e06ad1abe..8ff02942b1a6 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace009.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace009.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,7 @@ */ #include -#include "nsk_strace.h" +#include "nsk_strace.hpp" extern "C" { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace011.cpp b/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace011.cpp index c9e699f7bb5b..462d18797097 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace011.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace011.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,7 @@ */ #include -#include "nsk_strace.h" +#include "nsk_strace.hpp" extern "C" { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace012.cpp b/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace012.cpp index 3c58b84eff0d..d58e0eacbf3d 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace012.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace012.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,7 @@ */ #include -#include "nsk_strace.h" +#include "nsk_strace.hpp" extern "C" { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace014.cpp b/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace014.cpp index 4f58b8a59037..2b535c60f483 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace014.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace014.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,7 @@ */ #include -#include "nsk_strace.h" +#include "nsk_strace.hpp" extern "C" { diff --git a/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace015.cpp b/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace015.cpp index e0fd29fbebb8..658561bcc3fd 100644 --- a/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace015.cpp +++ b/test/hotspot/jtreg/vmTestbase/nsk/stress/strace/strace015.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,7 @@ */ #include -#include "nsk_strace.h" +#include "nsk_strace.hpp" extern "C" { diff --git a/test/hotspot/jtreg/vmTestbase/vm/compiler/CodeCacheInfo/Test.java b/test/hotspot/jtreg/vmTestbase/vm/compiler/CodeCacheInfo/Test.java index f63eb21a8938..0c8f59c4fae9 100644 --- a/test/hotspot/jtreg/vmTestbase/vm/compiler/CodeCacheInfo/Test.java +++ b/test/hotspot/jtreg/vmTestbase/vm/compiler/CodeCacheInfo/Test.java @@ -56,14 +56,15 @@ public class Test { static { String p1 = " size=\\d+Kb used=\\d+Kb max_used=\\d+Kb free=\\d+Kb\\n"; String p2 = " bounds \\[0x[0-9a-f]+, 0x[0-9a-f]+, 0x[0-9a-f]+\\]\\n"; - String p3 = " total_blobs=\\d+ nmethods=\\d+ adapters=\\d+\\n"; - String p4 = " compilation: enabled\\n"; + String p3 = "CodeCache:.*\\n"; + String p4 = " total_blobs=\\d+, nmethods=\\d+, adapters=\\d+, full_count=\\d+\\n"; + String p5 = "Compilation: enabled.*\\n"; String segPrefix = "^(CodeHeap '[^']+':" + p1 + p2 + ")+"; String nosegPrefix = "^CodeCache:" + p1 + p2; - SEG_REGEXP = segPrefix + p3 + p4; - NOSEG_REGEXP = nosegPrefix + p3 + p4; + SEG_REGEXP = segPrefix + p3 + p4 + p5; + NOSEG_REGEXP = nosegPrefix + p4 + p5; } public static void main(String[] args) throws Exception { diff --git a/test/hotspot/jtreg/vmTestbase/vm/compiler/complog/share/LogCompilationTest.java b/test/hotspot/jtreg/vmTestbase/vm/compiler/complog/share/LogCompilationTest.java index 0d24be9a16da..0a069d272c00 100644 --- a/test/hotspot/jtreg/vmTestbase/vm/compiler/complog/share/LogCompilationTest.java +++ b/test/hotspot/jtreg/vmTestbase/vm/compiler/complog/share/LogCompilationTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, 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 @@ -29,7 +29,6 @@ import nsk.share.log.LogSupport; import vm.share.options.Option; import vm.share.options.OptionSupport; -import vm.share.process.ProcessExecutor; import java.io.File; import java.io.FileNotFoundException; diff --git a/test/hotspot/jtreg/vmTestbase/vm/share/process/ProcessExecutor.java b/test/hotspot/jtreg/vmTestbase/vm/compiler/complog/share/ProcessExecutor.java similarity index 96% rename from test/hotspot/jtreg/vmTestbase/vm/share/process/ProcessExecutor.java rename to test/hotspot/jtreg/vmTestbase/vm/compiler/complog/share/ProcessExecutor.java index 0d9a0e063296..9ab0a781d1f8 100644 --- a/test/hotspot/jtreg/vmTestbase/vm/share/process/ProcessExecutor.java +++ b/test/hotspot/jtreg/vmTestbase/vm/compiler/complog/share/ProcessExecutor.java @@ -20,23 +20,16 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package vm.share.process; +package vm.compiler.complog.share; import nsk.share.TestBug; import nsk.share.TestFailure; import nsk.share.log.Log; -import vm.share.ProcessUtils; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.BufferedReader; import java.io.OutputStream; import java.io.PrintStream; -import java.io.PipedInputStream; -import java.io.PipedOutputStream; import java.io.IOException; import java.util.*; -import java.lang.reflect.Field; public class ProcessExecutor { private static long CLEANUP_TIMEOUT = 60000; @@ -138,8 +131,8 @@ public int waitFor(long timeout) { return -1; } - public int getPid() { - return ProcessUtils.getPid(process); + public long getPid() { + return process.pid(); } public OutputStream getStdIn() { diff --git a/test/hotspot/jtreg/vmTestbase/vm/share/process/StreamListener.java b/test/hotspot/jtreg/vmTestbase/vm/compiler/complog/share/StreamListener.java similarity index 97% rename from test/hotspot/jtreg/vmTestbase/vm/share/process/StreamListener.java rename to test/hotspot/jtreg/vmTestbase/vm/compiler/complog/share/StreamListener.java index 26c542f9bd00..c2d4e58c5bda 100644 --- a/test/hotspot/jtreg/vmTestbase/vm/share/process/StreamListener.java +++ b/test/hotspot/jtreg/vmTestbase/vm/compiler/complog/share/StreamListener.java @@ -20,7 +20,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package vm.share.process; +package vm.compiler.complog.share; /* * StreamListener listens on events from BufferedInputStream. diff --git a/test/hotspot/jtreg/vmTestbase/vm/share/process/StreamLogger.java b/test/hotspot/jtreg/vmTestbase/vm/compiler/complog/share/StreamLogger.java similarity index 98% rename from test/hotspot/jtreg/vmTestbase/vm/share/process/StreamLogger.java rename to test/hotspot/jtreg/vmTestbase/vm/compiler/complog/share/StreamLogger.java index 5162e4010ff2..690f0bbfbfc5 100644 --- a/test/hotspot/jtreg/vmTestbase/vm/share/process/StreamLogger.java +++ b/test/hotspot/jtreg/vmTestbase/vm/compiler/complog/share/StreamLogger.java @@ -20,7 +20,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package vm.share.process; +package vm.compiler.complog.share; import nsk.share.log.Log; diff --git a/test/hotspot/jtreg/vmTestbase/vm/share/process/StreamReader.java b/test/hotspot/jtreg/vmTestbase/vm/compiler/complog/share/StreamReader.java similarity index 99% rename from test/hotspot/jtreg/vmTestbase/vm/share/process/StreamReader.java rename to test/hotspot/jtreg/vmTestbase/vm/compiler/complog/share/StreamReader.java index a8f56318da5b..d983ae1aebea 100644 --- a/test/hotspot/jtreg/vmTestbase/vm/share/process/StreamReader.java +++ b/test/hotspot/jtreg/vmTestbase/vm/compiler/complog/share/StreamReader.java @@ -20,7 +20,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package vm.share.process; +package vm.compiler.complog.share; import java.io.InputStream; import java.io.InputStreamReader; diff --git a/test/hotspot/jtreg/vmTestbase/vm/mlvm/hiddenloader/func/findByName/Test.java b/test/hotspot/jtreg/vmTestbase/vm/mlvm/hiddenloader/func/findByName/Test.java index f891b980f826..f78c9221dd50 100644 --- a/test/hotspot/jtreg/vmTestbase/vm/mlvm/hiddenloader/func/findByName/Test.java +++ b/test/hotspot/jtreg/vmTestbase/vm/mlvm/hiddenloader/func/findByName/Test.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2024, 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 @@ -50,7 +50,7 @@ import vm.mlvm.hiddenloader.share.HiddenkTestee01; import vm.mlvm.share.MlvmTest; -import vm.share.FileUtils; +import vm.mlvm.share.FileUtils; public class Test extends MlvmTest { private static final Class PARENT = HiddenkTestee01.class; diff --git a/test/hotspot/jtreg/vmTestbase/vm/mlvm/hiddenloader/share/StressClassLoadingTest.java b/test/hotspot/jtreg/vmTestbase/vm/mlvm/hiddenloader/share/StressClassLoadingTest.java index edb91743c44e..b269d7aa57ff 100644 --- a/test/hotspot/jtreg/vmTestbase/vm/mlvm/hiddenloader/share/StressClassLoadingTest.java +++ b/test/hotspot/jtreg/vmTestbase/vm/mlvm/hiddenloader/share/StressClassLoadingTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2024, 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,24 +23,25 @@ package vm.mlvm.hiddenloader.share; -import java.lang.invoke.MethodHandles; -import java.lang.invoke.MethodHandles.Lookup; + import java.io.File; -import java.util.Objects; -import java.util.concurrent.atomic.AtomicBoolean; +import java.lang.invoke.MethodHandles; +import java.lang.invoke.MethodHandles.Lookup; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; +import java.util.Objects; +import java.util.concurrent.atomic.AtomicBoolean; + import nsk.share.test.Stresser; -import vm.share.options.Option; -import vm.share.options.OptionSupport; -import vm.share.options.IgnoreUnknownArgumentsHandler; import vm.mlvm.share.Env; import vm.mlvm.share.MlvmTest; import vm.mlvm.share.CustomClassLoaders; -import vm.share.FileUtils; -import vm.share.UnsafeAccess; +import vm.mlvm.share.FileUtils; +import vm.share.options.Option; +import vm.share.options.OptionSupport; +import vm.share.options.IgnoreUnknownArgumentsHandler; /** * Does stress-testing of class loading subsystem. @@ -164,7 +165,7 @@ public void run() { c = CustomClassLoaders.makeClassBytesLoader(classBytes, className) .loadClass(className); } - UnsafeAccess.unsafe.ensureClassInitialized(c); + MethodHandles.lookup().ensureInitialized(c); } catch (Throwable e) { Env.traceVerbose(e, "parser caught exception"); } diff --git a/test/hotspot/jtreg/vmTestbase/vm/mlvm/hiddenloader/stress/byteMutation/Test.java b/test/hotspot/jtreg/vmTestbase/vm/mlvm/hiddenloader/stress/byteMutation/Test.java index e6a3e8a890d7..e9a49e119c88 100644 --- a/test/hotspot/jtreg/vmTestbase/vm/mlvm/hiddenloader/stress/byteMutation/Test.java +++ b/test/hotspot/jtreg/vmTestbase/vm/mlvm/hiddenloader/stress/byteMutation/Test.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -44,7 +44,7 @@ import vm.mlvm.hiddenloader.share.HiddenkTestee01; import vm.mlvm.hiddenloader.share.StressClassLoadingTest; -import vm.share.FileUtils; +import vm.mlvm.share.FileUtils; import vm.share.options.Option; /** diff --git a/test/hotspot/jtreg/vmTestbase/vm/mlvm/hiddenloader/stress/oome/heap/Test.java b/test/hotspot/jtreg/vmTestbase/vm/mlvm/hiddenloader/stress/oome/heap/Test.java index ea59685dfd3d..47de77729305 100644 --- a/test/hotspot/jtreg/vmTestbase/vm/mlvm/hiddenloader/stress/oome/heap/Test.java +++ b/test/hotspot/jtreg/vmTestbase/vm/mlvm/hiddenloader/stress/oome/heap/Test.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2024, 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 @@ -51,7 +51,7 @@ import vm.mlvm.share.MlvmOOMTest; import vm.mlvm.share.MlvmTestExecutor; import vm.mlvm.share.Env; -import vm.share.FileUtils; +import vm.mlvm.share.FileUtils; /** * This test loads a class using defineHiddenClass, creates instances diff --git a/test/hotspot/jtreg/vmTestbase/vm/mlvm/hiddenloader/stress/oome/metaspace/Test.java b/test/hotspot/jtreg/vmTestbase/vm/mlvm/hiddenloader/stress/oome/metaspace/Test.java index 85bb7c6167ff..886e2e3d5258 100644 --- a/test/hotspot/jtreg/vmTestbase/vm/mlvm/hiddenloader/stress/oome/metaspace/Test.java +++ b/test/hotspot/jtreg/vmTestbase/vm/mlvm/hiddenloader/stress/oome/metaspace/Test.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2024, 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 @@ -51,7 +51,7 @@ import vm.mlvm.share.MlvmOOMTest; import vm.mlvm.share.MlvmTestExecutor; import vm.mlvm.share.Env; -import vm.share.FileUtils; +import vm.mlvm.share.FileUtils; /** * This test loads classes using defineHiddenClass and stores them, diff --git a/test/hotspot/jtreg/vmTestbase/vm/mlvm/hiddenloader/stress/parallelLoad/Test.java b/test/hotspot/jtreg/vmTestbase/vm/mlvm/hiddenloader/stress/parallelLoad/Test.java index fa4dbf3f4eb1..b3e433df9575 100644 --- a/test/hotspot/jtreg/vmTestbase/vm/mlvm/hiddenloader/stress/parallelLoad/Test.java +++ b/test/hotspot/jtreg/vmTestbase/vm/mlvm/hiddenloader/stress/parallelLoad/Test.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2024, 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 @@ -51,7 +51,7 @@ import vm.mlvm.hiddenloader.share.HiddenkTestee01; import vm.mlvm.share.MlvmTestExecutor; import vm.mlvm.share.MultiThreadedTest; -import vm.share.FileUtils; +import vm.mlvm.share.FileUtils; /** * Verifies that loading classes in parallel from several threads using diff --git a/test/hotspot/jtreg/vmTestbase/vm/mlvm/indy/func/jvmti/share/IndyRedefineClass.cpp b/test/hotspot/jtreg/vmTestbase/vm/mlvm/indy/func/jvmti/share/IndyRedefineClass.cpp index 2f4cefd19b52..60c0111d2d41 100644 --- a/test/hotspot/jtreg/vmTestbase/vm/mlvm/indy/func/jvmti/share/IndyRedefineClass.cpp +++ b/test/hotspot/jtreg/vmTestbase/vm/mlvm/indy/func/jvmti/share/IndyRedefineClass.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,14 +25,14 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" -#include "jvmti_tools.h" -#include "mlvmJvmtiUtils.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" +#include "jvmti_tools.hpp" +#include "mlvmJvmtiUtils.hpp" extern "C" { -static jvmtiEnv* gJvmtiEnv = NULL; +static jvmtiEnv* gJvmtiEnv = nullptr; static jboolean gIsMethodEntryWorking = JNI_FALSE; static jboolean gIsSingleStepWorking = JNI_FALSE; @@ -88,13 +88,13 @@ static void popFrameLogic(jvmtiEnv * jvmti_env, jthread thread) { if (tls->countOfFramesToPop <= 0) { NSK_DISPLAY0("Disabling single step\n"); - if (!NSK_JVMTI_VERIFY(jvmti_env->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_SINGLE_STEP, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti_env->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_SINGLE_STEP, nullptr))) gIsErrorOccured = JNI_TRUE; } else { NSK_DISPLAY0("Enabling single step\n"); - if (!NSK_JVMTI_VERIFY(jvmti_env->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_SINGLE_STEP, NULL))) + if (!NSK_JVMTI_VERIFY(jvmti_env->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_SINGLE_STEP, nullptr))) gIsErrorOccured = JNI_TRUE; if (tls->countOfFramesToPop == 1) { @@ -132,7 +132,7 @@ MethodEntry(jvmtiEnv *jvmti_env, } NSK_DISPLAY2("Entering redefine tigger method: %s.%s\n", mn->classSig, mn->methodName); - free(mn); mn = NULL; + free(mn); mn = nullptr; if (gIsClassRedefined) { NSK_DISPLAY0("Class is already redefined.\n"); @@ -168,7 +168,7 @@ SingleStep(jvmtiEnv *jvmti_env, gIsSingleStepWorking = JNI_TRUE; locStr = locationToString(jvmti_env, method, location); - if (locStr == NULL) { + if (locStr == nullptr) { NSK_DISPLAY0("Error in Single step event: locationToString failed\n"); gIsErrorOccured = JNI_TRUE; } else { @@ -186,7 +186,7 @@ jint Agent_Initialize(JavaVM * vm, char * options, void * reserved) { if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; - if (!NSK_VERIFY((gJvmtiEnv = nsk_jvmti_createJVMTIEnv(vm, reserved)) != NULL)) + if (!NSK_VERIFY((gJvmtiEnv = nsk_jvmti_createJVMTIEnv(vm, reserved)) != nullptr)) return JNI_ERR; if (nsk_jvmti_findOptionValue("debuggerCompatible")) { @@ -210,10 +210,10 @@ jint Agent_Initialize(JavaVM * vm, char * options, void * reserved) { if (!NSK_JVMTI_VERIFY(gJvmtiEnv->SetEventCallbacks(&callbacks, sizeof(callbacks)))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(gJvmtiEnv->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_ENTRY, NULL))) + if (!NSK_JVMTI_VERIFY(gJvmtiEnv->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_ENTRY, nullptr))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(gJvmtiEnv->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_SINGLE_STEP, NULL))) + if (!NSK_JVMTI_VERIFY(gJvmtiEnv->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_SINGLE_STEP, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/vm/mlvm/indy/func/jvmti/stepBreakPopReturn/stepBreakPopReturn.cpp b/test/hotspot/jtreg/vmTestbase/vm/mlvm/indy/func/jvmti/stepBreakPopReturn/stepBreakPopReturn.cpp index bcae1379e45e..413450892a5a 100644 --- a/test/hotspot/jtreg/vmTestbase/vm/mlvm/indy/func/jvmti/stepBreakPopReturn/stepBreakPopReturn.cpp +++ b/test/hotspot/jtreg/vmTestbase/vm/mlvm/indy/func/jvmti/stepBreakPopReturn/stepBreakPopReturn.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,14 +25,14 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" -#include "jvmti_tools.h" -#include "mlvmJvmtiUtils.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" +#include "jvmti_tools.hpp" +#include "mlvmJvmtiUtils.hpp" extern "C" { -static jvmtiEnv* gJvmtiEnv = NULL; +static jvmtiEnv* gJvmtiEnv = nullptr; static char * gszDebuggeeMethodName = (char*) "NONE"; static char * gszDebuggeeClassName = (char*) "NONE"; @@ -89,7 +89,7 @@ MethodEntry(jvmtiEnv *jvmti_env, gIsMethodEntryWorking = JNI_TRUE; if (!gIsBreakpointSet) - NSK_JVMTI_VERIFY(jvmti_env->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_SINGLE_STEP, NULL)); + NSK_JVMTI_VERIFY(jvmti_env->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_SINGLE_STEP, nullptr)); } } @@ -108,7 +108,7 @@ SingleStep(jvmtiEnv *jvmti_env, locStr = locationToString(jvmti_env, method, location); - if (locStr == NULL) { + if (locStr == nullptr) { NSK_DISPLAY0("Error: Single step event has no location\n"); gErrorHappened = JNI_TRUE; } else { @@ -116,13 +116,13 @@ SingleStep(jvmtiEnv *jvmti_env, free(locStr); } - NSK_JVMTI_VERIFY(gJvmtiEnv->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_SINGLE_STEP, NULL)); + NSK_JVMTI_VERIFY(gJvmtiEnv->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_SINGLE_STEP, nullptr)); if (!gIsDebuggerCompatible) { if (!NSK_JVMTI_VERIFY(jvmti_env->SetBreakpoint(method, location))) return; - NSK_JVMTI_VERIFY(gJvmtiEnv->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL)); + NSK_JVMTI_VERIFY(gJvmtiEnv->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, nullptr)); gIsBreakpointSet = JNI_TRUE; NSK_DISPLAY0("Pop a frame\n"); @@ -150,7 +150,7 @@ Breakpoint(jvmtiEnv *jvmti_env, gIsBreakpointWorking = JNI_TRUE; locStr = locationToString(jvmti_env, method, location); - if (locStr == NULL) { + if (locStr == nullptr) { NSK_DISPLAY0("Error: Breakpoint event has no location\n"); gErrorHappened = JNI_TRUE; } else { @@ -159,7 +159,7 @@ Breakpoint(jvmtiEnv *jvmti_env, } NSK_JVMTI_VERIFY(jvmti_env->ClearBreakpoint(method, location)); - NSK_JVMTI_VERIFY(gJvmtiEnv->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_BREAKPOINT, NULL)); + NSK_JVMTI_VERIFY(gJvmtiEnv->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_BREAKPOINT, nullptr)); gIsBreakpointSet = JNI_FALSE; NSK_DISPLAY0("Forcing early return.\n"); @@ -173,7 +173,7 @@ jint Agent_Initialize(JavaVM * vm, char * options, void * reserved) { if (!NSK_VERIFY(nsk_jvmti_parseOptions(options))) return JNI_ERR; - if (!NSK_VERIFY((gJvmtiEnv = nsk_jvmti_createJVMTIEnv(vm, reserved)) != NULL)) + if (!NSK_VERIFY((gJvmtiEnv = nsk_jvmti_createJVMTIEnv(vm, reserved)) != nullptr)) return JNI_ERR; if (nsk_jvmti_findOptionValue("debuggerCompatible")) { @@ -198,7 +198,7 @@ jint Agent_Initialize(JavaVM * vm, char * options, void * reserved) { if (!NSK_JVMTI_VERIFY(gJvmtiEnv->SetEventCallbacks(&callbacks, sizeof(callbacks)))) return JNI_ERR; - if (!NSK_JVMTI_VERIFY(gJvmtiEnv->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_ENTRY, NULL))) + if (!NSK_JVMTI_VERIFY(gJvmtiEnv->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_ENTRY, nullptr))) return JNI_ERR; return JNI_OK; diff --git a/test/hotspot/jtreg/vmTestbase/vm/mlvm/indy/stress/gc/lotsOfCallSites/Test.java b/test/hotspot/jtreg/vmTestbase/vm/mlvm/indy/stress/gc/lotsOfCallSites/Test.java index beb77041fdb1..6f2c82923b21 100644 --- a/test/hotspot/jtreg/vmTestbase/vm/mlvm/indy/stress/gc/lotsOfCallSites/Test.java +++ b/test/hotspot/jtreg/vmTestbase/vm/mlvm/indy/stress/gc/lotsOfCallSites/Test.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -47,15 +47,11 @@ package vm.mlvm.indy.stress.gc.lotsOfCallSites; import java.lang.invoke.CallSite; -import java.lang.invoke.MethodHandles; -import java.lang.invoke.MethodHandle; -import java.lang.invoke.MethodType; import java.lang.ref.PhantomReference; import java.lang.ref.Reference; import java.lang.ref.ReferenceQueue; import java.lang.reflect.Field; import java.lang.reflect.Method; -import java.lang.reflect.InvocationTargetException; import java.lang.management.MemoryMXBean; import java.lang.management.MemoryPoolMXBean; import java.lang.management.ManagementFactory; @@ -67,8 +63,8 @@ import nsk.share.test.Stresser; import vm.mlvm.share.CustomClassLoaders; import vm.mlvm.share.Env; +import vm.mlvm.share.FileUtils; import vm.mlvm.share.MlvmTest; -import vm.share.FileUtils; import vm.share.options.Option; /** diff --git a/test/hotspot/jtreg/vmTestbase/vm/mlvm/meth/stress/jni/nativeAndMH/nativeAndMH.cpp b/test/hotspot/jtreg/vmTestbase/vm/mlvm/meth/stress/jni/nativeAndMH/nativeAndMH.cpp index 4124b7fb8e78..7c1f8622e444 100644 --- a/test/hotspot/jtreg/vmTestbase/vm/mlvm/meth/stress/jni/nativeAndMH/nativeAndMH.cpp +++ b/test/hotspot/jtreg/vmTestbase/vm/mlvm/meth/stress/jni/nativeAndMH/nativeAndMH.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,7 @@ #include #include #include "jni.h" -#include "jni_tools.h" +#include "jni_tools.hpp" extern "C" { @@ -48,16 +48,16 @@ Java_vm_mlvm_meth_stress_jni_nativeAndMH_Test_native01( jobjectArray arguments; jobject result; - if (!NSK_JNI_VERIFY(pEnv, (mhClass = pEnv->GetObjectClass(mhToCall)) != NULL)) - return NULL; + if (!NSK_JNI_VERIFY(pEnv, (mhClass = pEnv->GetObjectClass(mhToCall)) != nullptr)) + return nullptr; - if (!NSK_JNI_VERIFY(pEnv, NULL != (mid = pEnv->GetMethodID(mhClass, "invokeWithArguments", "([Ljava/lang/Object;)Ljava/lang/Object;")))) - return NULL; + if (!NSK_JNI_VERIFY(pEnv, nullptr != (mid = pEnv->GetMethodID(mhClass, "invokeWithArguments", "([Ljava/lang/Object;)Ljava/lang/Object;")))) + return nullptr; - NSK_JNI_VERIFY(pEnv, NULL != (objectClass = pEnv->FindClass("java/lang/Object"))); + NSK_JNI_VERIFY(pEnv, nullptr != (objectClass = pEnv->FindClass("java/lang/Object"))); - if (!NSK_JNI_VERIFY(pEnv, NULL != (arguments = pEnv->NewObjectArray(ARGS_COUNT, objectClass, NULL)))) - return NULL; + if (!NSK_JNI_VERIFY(pEnv, nullptr != (arguments = pEnv->NewObjectArray(ARGS_COUNT, objectClass, nullptr)))) + return nullptr; NSK_JNI_VERIFY_VOID(pEnv, pEnv->SetObjectArrayElement(arguments, 0, a1)); NSK_JNI_VERIFY_VOID(pEnv, pEnv->SetObjectArrayElement(arguments, 1, a2)); @@ -67,7 +67,7 @@ Java_vm_mlvm_meth_stress_jni_nativeAndMH_Test_native01( NSK_JNI_VERIFY_VOID(pEnv, pEnv->SetObjectArrayElement(arguments, 5, a6)); // Swap arguments - NSK_JNI_VERIFY(pEnv, NULL != (result = pEnv->CallObjectMethod(mhToCall, mid, arguments))); + NSK_JNI_VERIFY(pEnv, nullptr != (result = pEnv->CallObjectMethod(mhToCall, mid, arguments))); return result; } diff --git a/test/hotspot/jtreg/vmTestbase/vm/mlvm/share/CustomClassLoaders.java b/test/hotspot/jtreg/vmTestbase/vm/mlvm/share/CustomClassLoaders.java index 9596f7b1eab3..6be720088ac5 100644 --- a/test/hotspot/jtreg/vmTestbase/vm/mlvm/share/CustomClassLoaders.java +++ b/test/hotspot/jtreg/vmTestbase/vm/mlvm/share/CustomClassLoaders.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,6 @@ import java.io.IOException; -import vm.share.FileUtils; - public class CustomClassLoaders { public static ClassLoader makeClassBytesLoader(final byte[] classBytes, diff --git a/test/hotspot/jtreg/vmTestbase/vm/share/FileUtils.java b/test/hotspot/jtreg/vmTestbase/vm/mlvm/share/FileUtils.java similarity index 99% rename from test/hotspot/jtreg/vmTestbase/vm/share/FileUtils.java rename to test/hotspot/jtreg/vmTestbase/vm/mlvm/share/FileUtils.java index 1652e75beafa..c749551e85b1 100644 --- a/test/hotspot/jtreg/vmTestbase/vm/share/FileUtils.java +++ b/test/hotspot/jtreg/vmTestbase/vm/mlvm/share/FileUtils.java @@ -20,7 +20,7 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package vm.share; +package vm.mlvm.share; import java.io.File; import java.io.FileInputStream; diff --git a/test/hotspot/jtreg/vmTestbase/vm/mlvm/share/MlvmTestExecutor.java b/test/hotspot/jtreg/vmTestbase/vm/mlvm/share/MlvmTestExecutor.java index 2c219309b634..5ff219e82715 100644 --- a/test/hotspot/jtreg/vmTestbase/vm/mlvm/share/MlvmTestExecutor.java +++ b/test/hotspot/jtreg/vmTestbase/vm/mlvm/share/MlvmTestExecutor.java @@ -23,12 +23,16 @@ package vm.mlvm.share; +import java.io.File; +import java.io.IOException; +import java.lang.management.ManagementFactory; import java.lang.reflect.Constructor; import java.util.List; +import com.sun.management.HotSpotDiagnosticMXBean; + import nsk.share.Consts; import nsk.share.ArgumentParser; -import vm.share.ProcessUtils; import vm.share.options.IgnoreUnknownArgumentsHandler; import vm.share.options.OptionSupport; @@ -261,10 +265,23 @@ public static void launch(Class testClass, Object[] constructorArgs) { } } + private static void dumpHeapWithHotspotDiagnosticMXBean(String fileName) throws IOException { + System.err.println("Dumping heap to " + fileName); + + File f = new File(fileName); + if (f.exists()) + f.delete(); + + HotSpotDiagnosticMXBean b = ManagementFactory.getPlatformMXBeans( + com.sun.management.HotSpotDiagnosticMXBean.class).get(0); + b.dumpHeap(fileName, false); + } + + private static void optionallyDumpHeap() { try { if (MlvmTest.getHeapDumpAfter()) { - ProcessUtils.dumpHeapWithHotspotDiagnosticMXBean(HEAP_DUMP_FILENAME); + dumpHeapWithHotspotDiagnosticMXBean(HEAP_DUMP_FILENAME); } } catch (Exception e) { Env.traceNormal(e, "Error dumping heap: "); diff --git a/test/hotspot/jtreg/vmTestbase/vm/mlvm/share/mlvmJvmtiUtils.cpp b/test/hotspot/jtreg/vmTestbase/vm/mlvm/share/mlvmJvmtiUtils.cpp index 1c0f79dd667a..7f3b149df723 100644 --- a/test/hotspot/jtreg/vmTestbase/vm/mlvm/share/mlvmJvmtiUtils.cpp +++ b/test/hotspot/jtreg/vmTestbase/vm/mlvm/share/mlvmJvmtiUtils.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,10 +25,10 @@ #include #include #include "jvmti.h" -#include "agent_common.h" -#include "JVMTITools.h" -#include "jvmti_tools.h" -#include "mlvmJvmtiUtils.h" +#include "agent_common.hpp" +#include "JVMTITools.hpp" +#include "jvmti_tools.hpp" +#include "mlvmJvmtiUtils.hpp" extern "C" { @@ -36,7 +36,7 @@ void copyFromJString(JNIEnv * pEnv, jstring src, char ** dst) { const char * pStr; jsize len; - if (!NSK_VERIFY((pStr = pEnv->GetStringUTFChars(src, NULL)) != NULL)) { + if (!NSK_VERIFY((pStr = pEnv->GetStringUTFChars(src, nullptr)) != nullptr)) { return; } @@ -70,30 +70,30 @@ struct MethodName * getMethodName(jvmtiEnv * pJvmtiEnv, jmethodID method) { jclass clazz; struct MethodName * mn; - if (!NSK_JVMTI_VERIFY(pJvmtiEnv->GetMethodName(method, &szName, NULL, NULL))) { - return NULL; + if (!NSK_JVMTI_VERIFY(pJvmtiEnv->GetMethodName(method, &szName, nullptr, nullptr))) { + return nullptr; } JvmtiResource szNameResource(pJvmtiEnv, szName); if (!NSK_JVMTI_VERIFY(pJvmtiEnv->GetMethodDeclaringClass(method, &clazz))) { - return NULL; + return nullptr; } - if (!NSK_JVMTI_VERIFY(pJvmtiEnv->GetClassSignature(clazz, &szSignature, NULL))) { - return NULL; + if (!NSK_JVMTI_VERIFY(pJvmtiEnv->GetClassSignature(clazz, &szSignature, nullptr))) { + return nullptr; } JvmtiResource szSignatureResource(pJvmtiEnv, szSignature); if (strlen(szName) + 1 > sizeof(mn->methodName) || strlen(szSignature) + 1 > sizeof(mn->classSig)) { - return NULL; + return nullptr; } mn = (MethodName*) malloc(sizeof(MethodNameStruct)); - if (mn == NULL) { - return NULL; + if (mn == nullptr) { + return nullptr; } strncpy(mn->methodName, szName, sizeof(mn->methodName) - 1); @@ -115,17 +115,17 @@ char * locationToString(jvmtiEnv * pJvmtiEnv, jmethodID method, jlocation locati if (!pMN) return strdup("NONE"); - len = snprintf(NULL, 0, format, pMN->classSig, pMN->methodName, location) + 1; + len = snprintf(nullptr, 0, format, pMN->classSig, pMN->methodName, location) + 1; if (len <= 0) { free(pMN); - return NULL; + return nullptr; } result = (char*) malloc(len); - if (result == NULL) { + if (result == nullptr) { free(pMN); - return NULL; + return nullptr; } snprintf(result, len, format, pMN->classSig, pMN->methodName, location); @@ -137,16 +137,16 @@ char * locationToString(jvmtiEnv * pJvmtiEnv, jmethodID method, jlocation locati void * getTLS(jvmtiEnv * pJvmtiEnv, jthread thread, jsize sizeToAllocate) { void * tls; if (!NSK_JVMTI_VERIFY(pJvmtiEnv->GetThreadLocalStorage(thread, &tls))) - return NULL; + return nullptr; if (!tls) { - if (!NSK_VERIFY((tls = malloc(sizeToAllocate)) != NULL)) - return NULL; + if (!NSK_VERIFY((tls = malloc(sizeToAllocate)) != nullptr)) + return nullptr; memset(tls, 0, sizeToAllocate); if (!NSK_JVMTI_VERIFY(pJvmtiEnv->SetThreadLocalStorage(thread, tls))) - return NULL; + return nullptr; } return tls; diff --git a/test/hotspot/jtreg/vmTestbase/vm/mlvm/share/mlvmJvmtiUtils.h b/test/hotspot/jtreg/vmTestbase/vm/mlvm/share/mlvmJvmtiUtils.hpp similarity index 90% rename from test/hotspot/jtreg/vmTestbase/vm/mlvm/share/mlvmJvmtiUtils.h rename to test/hotspot/jtreg/vmTestbase/vm/mlvm/share/mlvmJvmtiUtils.hpp index f67f45e36946..385c4c221c11 100644 --- a/test/hotspot/jtreg/vmTestbase/vm/mlvm/share/mlvmJvmtiUtils.h +++ b/test/hotspot/jtreg/vmTestbase/vm/mlvm/share/mlvmJvmtiUtils.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,8 +21,8 @@ * questions. */ -#ifndef MLVMJVMTIUTILS_H_ -#define MLVMJVMTIUTILS_H_ +#ifndef MLVMJVMTIUTILS_HPP_ +#define MLVMJVMTIUTILS_HPP_ #include "jvmti.h" @@ -42,4 +42,4 @@ char * locationToString(jvmtiEnv * pJvmtiEnv, jmethodID method, jlocation locati void * getTLS(jvmtiEnv * pJvmtiEnv, jthread thread, jsize sizeToAllocate); } -#endif /* MLVMJVMTIUTILS_H_ */ +#endif /* MLVMJVMTIUTILS_HPP_ */ diff --git a/test/hotspot/jtreg/vmTestbase/vm/runtime/defmeth/shared/redefineClasses.cpp b/test/hotspot/jtreg/vmTestbase/vm/runtime/defmeth/shared/redefineClasses.cpp index 4d5c8af75488..530de16c2d4b 100644 --- a/test/hotspot/jtreg/vmTestbase/vm/runtime/defmeth/shared/redefineClasses.cpp +++ b/test/hotspot/jtreg/vmTestbase/vm/runtime/defmeth/shared/redefineClasses.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,15 +25,15 @@ #include #include -#include "jni_tools.h" -#include "nsk_tools.h" -#include "JVMTITools.h" -#include "jvmti_tools.h" +#include "jni_tools.hpp" +#include "nsk_tools.hpp" +#include "JVMTITools.hpp" +#include "jvmti_tools.hpp" extern "C" { -static jvmtiEnv *test_jvmti = NULL; +static jvmtiEnv *test_jvmti = nullptr; static jvmtiCapabilities caps; /* @@ -50,7 +50,7 @@ Java_vm_runtime_defmeth_shared_Util_redefineClassIntl(JNIEnv *env, jclass clazz, jvmtiClassDefinition classDef; jboolean result = JNI_TRUE; - if (!NSK_VERIFY(env != NULL) || !NSK_VERIFY(clazzToRedefine != NULL) || !NSK_VERIFY(bytecodeArray != NULL)) { + if (!NSK_VERIFY(env != nullptr) || !NSK_VERIFY(clazzToRedefine != nullptr) || !NSK_VERIFY(bytecodeArray != nullptr)) { return JNI_FALSE; } @@ -61,7 +61,7 @@ Java_vm_runtime_defmeth_shared_Util_redefineClassIntl(JNIEnv *env, jclass clazz, } if (!NSK_JNI_VERIFY(env, - (classDef.class_bytes = (const unsigned char *) /* jbyte* */ env->GetByteArrayElements(bytecodeArray, NULL)) != NULL)) { + (classDef.class_bytes = (const unsigned char *) /* jbyte* */ env->GetByteArrayElements(bytecodeArray, nullptr)) != nullptr)) { return JNI_FALSE; } @@ -86,7 +86,7 @@ jint Agent_Initialize(JavaVM *jvm, char *options, void *reserved) { /* create JVMTI environment */ if (!NSK_VERIFY((test_jvmti = - nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL)) + nsk_jvmti_createJVMTIEnv(jvm, reserved)) != nullptr)) return JNI_ERR; memset(&caps, 0, sizeof(jvmtiCapabilities)); diff --git a/test/hotspot/jtreg/vmTestbase/vm/share/CommentedFileReader.java b/test/hotspot/jtreg/vmTestbase/vm/share/CommentedFileReader.java deleted file mode 100644 index 019d237482c7..000000000000 --- a/test/hotspot/jtreg/vmTestbase/vm/share/CommentedFileReader.java +++ /dev/null @@ -1,119 +0,0 @@ -/* - * 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 - * 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 vm.share; - -import java.io.*; -import java.util.LinkedList; - -/** - * Utility class intended to read file line by line and skip comments. - */ -public class CommentedFileReader { - - /** - * Type of comments that should be removed from file. - */ - public static enum CommentStyle { - /** - * Comments started with #. - */ - BASH, - /** - * Comments started with //. - */ - JAVA - } - - /** - * Get lines from specified file and filter out comments. - * Only comments in BASH style will be filtered out. - * - * @param path to file that should be readed - * @return filtered lines from file - */ - public static String[] readFile(String path) throws IOException { - return readFile(new File(path), CommentStyle.BASH); - } - - /** - * Get lines from specified file and filter out comments. - * Only comments in BASH style will be filtered out. - * - * @param file that should be readed - * @return filtered lines from file - */ - public static String[] readFile(File file) throws IOException { - return readFile(file, CommentStyle.BASH); - } - - /** - * Get lines from specified file without comments. - * - * @param path to file that should be readed - * @param commentStyle describes what strings will be treated as comments - * @return filtered lines from file - */ - public static String[] readFile(String path, CommentStyle commentStyle) throws IOException { - return readFile(new File(path), commentStyle); - } - - /** - * Get lines from specified file without comments. - * - * @param file that should be readed - * @param commentStyle describes what strings will be treated as comments - * @return filtered lines from file - */ - public static String[] readFile(File file, CommentStyle commentStyle) throws IOException { - LinkedList entries = new LinkedList(); - BufferedReader reader = new BufferedReader(new FileReader(file)); - String commentBeginning; - - switch (commentStyle) { - case BASH: - commentBeginning = "#"; - break; - case JAVA: - commentBeginning = "//"; - break; - default: - throw new IllegalArgumentException("Unknown comment style"); - } - - while (true) { - String entry = reader.readLine(); - if (entry == null) { - break; - } - - entry = entry.replaceAll(commentBeginning + ".*", "").trim(); - - if (entry.length() > 0) { - entries.add(entry); - } - } - - return entries.toArray(new String[entries.size()]); - } - -} diff --git a/test/hotspot/jtreg/vmTestbase/vm/share/InMemoryJavaCompiler.java b/test/hotspot/jtreg/vmTestbase/vm/share/InMemoryJavaCompiler.java deleted file mode 100644 index 6f5f1c0cbcd9..000000000000 --- a/test/hotspot/jtreg/vmTestbase/vm/share/InMemoryJavaCompiler.java +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (c) 2013, 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 vm.share; - -import javax.tools.FileObject; -import javax.tools.ForwardingJavaFileManager; -import javax.tools.JavaCompiler; -import javax.tools.JavaFileManager; -import javax.tools.JavaFileObject; -import javax.tools.SimpleJavaFileObject; -import javax.tools.ToolProvider; -import java.io.ByteArrayOutputStream; -import java.io.StringWriter; -import java.io.Writer; -import java.net.URI; -import java.util.Collection; -import java.util.HashMap; -import java.util.LinkedList; -import java.util.Map; -import java.util.Map.Entry; - - -public class InMemoryJavaCompiler { - - public static Map compile(Map inputMap) { - Collection sourceFiles = new LinkedList(); - for (Entry entry : inputMap.entrySet()) { - sourceFiles.add(new SourceFile(entry.getKey(), entry.getValue())); - } - - JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); - FileManager fileManager = new FileManager(compiler.getStandardFileManager(null, null, null)); - - Writer writer = new StringWriter(); - Boolean exitCode = compiler.getTask(writer, fileManager, null, null, null, sourceFiles).call(); - if (!exitCode) { - System.out.println("*********** javac output begin ***********"); - System.out.println(writer.toString()); - System.out.println("*********** javac output end ***********"); - if (writer.toString().contains("java.lang.OutOfMemoryError")) { - System.out.println("Got OOME while performing in memory compilation. It happens on weak hosts and there is nothing we can do. "); - throw new OutOfMemoryError("Got OOME while performing in memory compilation."); - } - throw new RuntimeException("Test bug: in memory compilation failed."); - } - return fileManager.getByteCode(); - } - - // Wraper for class file - static class ClassFile extends SimpleJavaFileObject { - - private final ByteArrayOutputStream baos = new ByteArrayOutputStream(); - - protected ClassFile(String name) { - super(URI.create("memo:///" + name.replace('.', '/') + Kind.CLASS.extension), Kind.CLASS); - } - - @Override - public ByteArrayOutputStream openOutputStream() { return this.baos; } - - byte[] toByteArray() { return baos.toByteArray(); } - } - - // File manager which spawns ClassFile instances by demand - static class FileManager extends ForwardingJavaFileManager { - - private Map classesMap = new HashMap(); - - protected FileManager(JavaFileManager fileManager) { - super(fileManager); - } - - @Override - public ClassFile getJavaFileForOutput(Location location, String name, JavaFileObject.Kind kind, FileObject source) { - ClassFile classFile = new ClassFile(name); - classesMap.put(name, classFile); - return classFile; - } - - public Map getByteCode() { - Map result = new HashMap(); - for (Entry entry : classesMap.entrySet()) { - result.put(entry.getKey(), entry.getValue().toByteArray()); - } - return result; - } - } - - // Wrapper for source file - static class SourceFile extends SimpleJavaFileObject { - - private CharSequence sourceCode; - - public SourceFile(String name, CharSequence sourceCode) { - super(URI.create("memo:///" + name.replace('.', '/') + Kind.SOURCE.extension), Kind.SOURCE); - this.sourceCode = sourceCode; - } - - @Override - public CharSequence getCharContent(boolean ignore) { - return this.sourceCode; - } - } - -} diff --git a/test/hotspot/jtreg/vmTestbase/vm/share/ProcessUtils.cpp b/test/hotspot/jtreg/vmTestbase/vm/share/ProcessUtils.cpp index 0388af34e741..1f7305b381c5 100644 --- a/test/hotspot/jtreg/vmTestbase/vm/share/ProcessUtils.cpp +++ b/test/hotspot/jtreg/vmTestbase/vm/share/ProcessUtils.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,54 +21,16 @@ * questions. */ #include "jni.h" -#include "native_thread.h" #ifdef _WIN32 #include -#include -#include -#include #else /* _WIN32 */ #include #include #endif /* _WIN32 */ -#include "jni_tools.h" +#include "jni_tools.hpp" extern "C" { -/* - * Class: vm_share_ProcessUtils - * Method: sendSignal - * Signature: ()Z - */ -JNIEXPORT jboolean JNICALL Java_vm_share_ProcessUtils_sendSignal -(JNIEnv *env, jclass klass, jint signalNum) { -#ifdef _WIN32 -/* TODO TODO TODO - int dw; - LPVOID lpMsgBuf; - if (!GenerateConsoleCtrlEvent(CTRL_BREAK_EVENT, 0)) { - dw = GetLastError(); - FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, - NULL, - dw, - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - (LPTSTR) &lpMsgBuf, - 0, - NULL - ); - printf("%s\n", (LPTSTR)lpMsgBuf); - LocalFree(lpMsgBuf); - return JNI_FALSE; - } - */ - return JNI_TRUE; -#else /* _WIN32 */ - if (kill(getpid(), signalNum) < 0) - return JNI_FALSE; - return JNI_TRUE; -#endif /* _WIN32 */ -} - /* * Class: vm_share_ProcessUtils * Method: sendCtrlBreak @@ -82,12 +44,12 @@ JNIEXPORT jboolean JNICALL Java_vm_share_ProcessUtils_sendCtrlBreak if (!GenerateConsoleCtrlEvent(CTRL_BREAK_EVENT, 0)) { dw = GetLastError(); FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, - NULL, + nullptr, dw, MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), (LPTSTR) &lpMsgBuf, 0, - NULL + nullptr ); printf("%s\n", (LPTSTR)lpMsgBuf); LocalFree(lpMsgBuf); @@ -101,167 +63,4 @@ JNIEXPORT jboolean JNICALL Java_vm_share_ProcessUtils_sendCtrlBreak #endif /* _WIN32 */ } -#ifdef _WIN32 -static BOOL (WINAPI *_MiniDumpWriteDump) (HANDLE, DWORD, HANDLE, MINIDUMP_TYPE, PMINIDUMP_EXCEPTION_INFORMATION, - PMINIDUMP_USER_STREAM_INFORMATION, PMINIDUMP_CALLBACK_INFORMATION); -void reportLastError(const char *msg) { - long errcode = GetLastError(); - if (errcode != 0) { - DWORD len = 0; - char *buf; - size_t n = (size_t)FormatMessage( - FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS|FORMAT_MESSAGE_ALLOCATE_BUFFER, - NULL, - errcode, - 0, - (LPSTR) &buf, - (DWORD)len, - NULL); - if (n > 3) { - /* Drop final '.', CR, LF */ - if (buf[n - 1] == '\n') n--; - if (buf[n - 1] == '\r') n--; - if (buf[n - 1] == '.') n--; - buf[n] = '\0'; - } - printf("%s: %s\n", msg, buf); - LocalFree(buf); - } -} - -#endif /* _WIN32 */ - -jboolean doDumpCore() { -#ifdef _WIN32 - char path[MAX_PATH]; - DWORD size; - DWORD pathLen = (DWORD) sizeof(path); - HINSTANCE dbghelp; - MINIDUMP_EXCEPTION_INFORMATION* pmei; - - HANDLE hProcess = GetCurrentProcess(); - DWORD processId = GetCurrentProcessId(); - HANDLE dumpFile; - MINIDUMP_TYPE dumpType; - static const char* cwd; - static const char* name = "DBGHELP.DLL"; - - printf("# TEST: creating Windows minidump...\n"); - size = GetSystemDirectory(path, pathLen); - if (size > 0) { - strcat(path, "\\"); - strcat(path, name); - dbghelp = LoadLibrary(path); - if (dbghelp == NULL) - reportLastError("Load DBGHELP.DLL from system directory"); - } else { - printf("GetSystemDirectory returned 0\n"); - } - - // try Windows directory - if (dbghelp == NULL) { - size = GetWindowsDirectory(path, pathLen); - if (size > 6) { - strcat(path, "\\"); - strcat(path, name); - dbghelp = LoadLibrary(path); - if (dbghelp == NULL) { - reportLastError("Load DBGHELP.DLL from Windows directory"); - } - } - } - if (dbghelp == NULL) { - printf("Failed to load DBGHELP.DLL\n"); - return JNI_FALSE; - } - - _MiniDumpWriteDump = - (BOOL(WINAPI *)(HANDLE, DWORD, HANDLE, MINIDUMP_TYPE, PMINIDUMP_EXCEPTION_INFORMATION, - PMINIDUMP_USER_STREAM_INFORMATION, PMINIDUMP_CALLBACK_INFORMATION)) - GetProcAddress(dbghelp, "MiniDumpWriteDump"); - - if (_MiniDumpWriteDump == NULL) { - printf("Failed to find MiniDumpWriteDump() in module dbghelp.dll"); - return JNI_FALSE; - } - dumpType = (MINIDUMP_TYPE)(MiniDumpWithFullMemory | MiniDumpWithHandleData); - - // Older versions of dbghelp.h doesn't contain all the dumptypes we want, dbghelp.h with - // API_VERSION_NUMBER 11 or higher contains the ones we want though -#if API_VERSION_NUMBER >= 11 - dumpType = (MINIDUMP_TYPE)(dumpType | MiniDumpWithFullMemoryInfo | MiniDumpWithThreadInfo | - MiniDumpWithUnloadedModules); -#endif - - dumpFile = CreateFile("core.mdmp", GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); - - if (dumpFile == INVALID_HANDLE_VALUE) { - reportLastError("Failed to create file for dumping"); - return JNI_FALSE; - } - pmei = NULL; - - - // Older versions of dbghelp.dll (the one shipped with Win2003 for example) may not support all - // the dump types we really want. If first call fails, lets fall back to just use MiniDumpWithFullMemory then. - if (_MiniDumpWriteDump(hProcess, processId, dumpFile, dumpType, pmei, NULL, NULL) == FALSE && - _MiniDumpWriteDump(hProcess, processId, dumpFile, (MINIDUMP_TYPE)MiniDumpWithFullMemory, pmei, NULL, NULL) == FALSE) { - reportLastError("Call to MiniDumpWriteDump() failed"); - return JNI_FALSE; - } - - CloseHandle(dumpFile); - printf("# TEST: minidump created\n"); - // Emulate Unix behaviour - exit process. - ExitProcess(137); - - return JNI_TRUE; -#else /* _WIN32 */ - if (kill(getpid(), SIGSEGV) < 0) - return JNI_FALSE; - return JNI_TRUE; -#endif /* _WIN32 */ - -} - -/* - * Class: vm_share_ProcessUtils - * Method: dumpCore - * Signature: ()Z - */ -JNIEXPORT jboolean JNICALL Java_vm_share_ProcessUtils_dumpCore - (JNIEnv *env, jclass klass) -{ - return doDumpCore(); -} - -/* - * Class: vm_share_ProcessUtils - * Method: getPid - * Signature: ()I - */ -JNIEXPORT jint JNICALL Java_vm_share_ProcessUtils_getPid - (JNIEnv *env, jclass klass) { -#ifdef _WIN32 - return _getpid(); -#else /* _WIN32 */ - return getpid(); -#endif /* _WIN32 */ -} - - -/* - * Class: vm_share_ProcessUtils - * Method: getPid - * Signature: ()I - */ -JNIEXPORT jint JNICALL Java_vm_share_ProcessUtils_getWindowsPid - (JNIEnv *env, jclass klass, jlong handle) { -#ifdef _WIN32 - return GetProcessId((HANDLE) handle); -#else /* _WIN32 */ - return -1; -#endif /* _WIN32 */ -} - } diff --git a/test/hotspot/jtreg/vmTestbase/vm/share/ProcessUtils.java b/test/hotspot/jtreg/vmTestbase/vm/share/ProcessUtils.java index 2e9174452fdd..3595428d98c2 100644 --- a/test/hotspot/jtreg/vmTestbase/vm/share/ProcessUtils.java +++ b/test/hotspot/jtreg/vmTestbase/vm/share/ProcessUtils.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, 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 @@ -46,67 +46,4 @@ private ProcessUtils() {} * @return true if it was successful */ public static native boolean sendCtrlBreak(); - - /** - * Send any signal to java process on Unix. It currently does nothing on Windows. - * - * @return true if it was successful - */ - public static native boolean sendSignal(int signalNum); - - /** - * Force java process to dump core. - * - * This is done by sending SIGSEGV on unix systems. - * - * @return true if it was successful, false if not (for example on Windows) - */ - public static native boolean dumpCore(); - - /** - * Get PID of java process. - * - * @return PID - */ - public static native int getPid(); - - public static int getPid(Process process) { - Throwable exception; - try { - Field pidField = process.getClass().getDeclaredField("pid"); - pidField.setAccessible(true); - return ((Integer) pidField.get(process)).intValue(); - } catch (NoSuchFieldException e) { - exception = e; - } catch (IllegalAccessException e) { - exception = e; - } - // Try to get Windows handle - try { - Field handleField = process.getClass().getDeclaredField("handle"); - handleField.setAccessible(true); - long handle = ((Long) handleField.get(process)).longValue(); - return getWindowsPid(handle); - } catch (NoSuchFieldException e) { - exception = e; - } catch (IllegalAccessException e) { - exception = e; - } - throw new TestBug("Unable to determine pid from process class " + process.getClass(), exception); - } - - private static native int getWindowsPid(long handle); - - @SuppressWarnings("restriction") - public static void dumpHeapWithHotspotDiagnosticMXBean(String fileName) throws IOException { - System.err.println("Dumping heap to " + fileName); - - File f = new File(fileName); - if (f.exists()) - f.delete(); - - HotSpotDiagnosticMXBean b = ManagementFactory.getPlatformMXBeans( - com.sun.management.HotSpotDiagnosticMXBean.class).get(0); - b.dumpHeap(fileName, false); - } } diff --git a/test/hotspot/jtreg/vmTestbase/vm/share/RandomEx.java b/test/hotspot/jtreg/vmTestbase/vm/share/RandomEx.java deleted file mode 100644 index 8abcfb1ba80e..000000000000 --- a/test/hotspot/jtreg/vmTestbase/vm/share/RandomEx.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright (c) 2013, 2020, 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 vm.share; - -import java.util.HashMap; -import java.util.Map; -import java.util.Random; -import java.util.function.Predicate; -import java.util.function.Supplier; - -import jdk.test.lib.Utils; - -public class RandomEx extends Random { - private final Map, Supplier> map = new HashMap<>(); - - { - map.put(Boolean.class, this::nextBoolean); - map.put(boolean.class, this::nextBoolean); - map.put(Byte.class, this::nextByte); - map.put(byte.class, this::nextByte); - map.put(Short.class, this::nextShort); - map.put(short.class, this::nextShort); - map.put(Character.class, this::nextChar); - map.put(char.class, this::nextChar); - map.put(Integer.class, this::nextInt); - map.put(int.class, this::nextInt); - map.put(Long.class, this::nextLong); - map.put(long.class, this::nextLong); - map.put(Float.class, this::nextFloat); - map.put(float.class, this::nextFloat); - map.put(Double.class, this::nextDouble); - map.put(double.class, this::nextDouble); - } - - public RandomEx() { - super(Utils.getRandomInstance().nextLong()); - } - - public RandomEx(long seed) { - super(seed); - } - - public byte nextByte() { - return (byte) next(Byte.SIZE); - } - - public short nextShort() { - return (short) next(Short.SIZE); - } - - public char nextChar() { - return (char) next(Character.SIZE); - } - - public T next(Predicate p, T dummy) { - T result; - do { - result = next(dummy); - } while (!p.test(result)); - return result; - } - - @SuppressWarnings("unchecked") - public T next(T dummy) { - Supplier supplier = map.get(dummy.getClass()); - if (supplier == null) { - throw new IllegalArgumentException("supplier for <" + - dummy.getClass() + ">is not found"); - } - return (T) supplier.get(); - } -} diff --git a/test/hotspot/jtreg/vmTestbase/vm/share/StringUtils.java b/test/hotspot/jtreg/vmTestbase/vm/share/StringUtils.java deleted file mode 100644 index 564395386933..000000000000 --- a/test/hotspot/jtreg/vmTestbase/vm/share/StringUtils.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * 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 vm.share; - -import java.io.ByteArrayOutputStream; -import java.util.Random; -import java.util.function.Predicate; - -public class StringUtils { - - public static byte[] binaryReplace(final byte[] src, String search, - String replacement) { - if (search.length() == 0) - return src; - - int nReplaced = 0; - - try { - final byte[] bSrch = search.getBytes("ASCII"); - final byte[] bRepl = replacement.getBytes("ASCII"); - - ByteArrayOutputStream out = new ByteArrayOutputStream(); - try { - searching: for (int i = 0; i < src.length; i++) { - if (src[i] == bSrch[0]) { - replacing: do { - for (int ii = 1; ii < Math.min(bSrch.length, - src.length - i); ii++) - if (src[i + ii] != bSrch[ii]) - break replacing; - - out.write(bRepl); - i += bSrch.length - 1; - nReplaced++; - continue searching; - } while (false); - } - - out.write(src[i]); - } - - return out.toByteArray(); - - } finally { - out.close(); - } - } catch (Exception e) { - RuntimeException t = new RuntimeException("Test internal error"); - t.initCause(e); - throw t; - } - } - - public static String generateString(Random rng, int length, - Predicate predicate) { - if (length <= 0) { - throw new IllegalArgumentException("length <= 0"); - } - StringBuilder builder = new StringBuilder(length); - for (int i = 0; i < length; ++i) { - char tmp; - do { - tmp = (char) rng.nextInt(Character.MAX_VALUE); - } while (!predicate.test(tmp)); - builder.append(tmp); - } - return builder.toString(); - } -} diff --git a/test/hotspot/jtreg/vmTestbase/vm/share/VMRuntimeEnvUtils.java b/test/hotspot/jtreg/vmTestbase/vm/share/VMRuntimeEnvUtils.java deleted file mode 100644 index 85cab7a06db7..000000000000 --- a/test/hotspot/jtreg/vmTestbase/vm/share/VMRuntimeEnvUtils.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (c) 2008, 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 vm.share; - -import com.sun.management.HotSpotDiagnosticMXBean; -import com.sun.management.VMOption; - -import java.lang.management.ManagementFactory; -import java.util.Objects; - -public class VMRuntimeEnvUtils { - private static HotSpotDiagnosticMXBean DIAGNOSTIC_BEAN - = ManagementFactory.getPlatformMXBean(HotSpotDiagnosticMXBean.class); - - private VMRuntimeEnvUtils() { - } - - public static boolean isJITEnabled() { - boolean isJITEnabled = ManagementFactory.getCompilationMXBean() != null; - - return isJITEnabled; - } - - /** - * Returns value of VM option. - * - * @param name option's name - * @return value of option or {@code null}, if option doesn't exist - * @throws NullPointerException if name is null - * @see HotSpotDiagnosticMXBean#getVMOption(String) - */ - public static String getVMOption(String name) { - Objects.requireNonNull(name); - VMOption tmp; - try { - tmp = DIAGNOSTIC_BEAN.getVMOption(name); - } catch (IllegalArgumentException e) { - tmp = null; - } - return (tmp == null ? null : tmp.getValue()); - } - - /** - * Returns value of VM option or default value. - * - * @param name option's name - * @param defaultValue default value - * @return value of option or {@code defaultValue}, if option doesn't exist - * @throws NullPointerException if name is null - * @see #getVMOption(String) - */ - public static String getVMOption(String name, String defaultValue) { - String result = getVMOption(name); - return result == null ? defaultValue : result; - } - - /** - * Returns if a boolean VM option is enabled or not. - * - * @param name option's name - * @return true iff enabled - * @throws IllegalArgumentException if naming non-boolean or non-existing option - */ - public static boolean isVMOptionEnabled(String name) { - String isSet = getVMOption(name, "error"); - if (isSet.equals("true")) { - return true; - } else if (isSet.equals("false")) { - return false; - } - throw new IllegalArgumentException(name + " is not a boolean option."); - } - - /** - * Sets a specified value for VM option of given name. - * - * @param name option's name - * @param value new value - * @throws NullPointerException if name is null - * @throws IllegalArgumentException if new value is invalid or if vm option - * is not writable. - * @see HotSpotDiagnosticMXBean#setVMOption(String, String) - */ - public static void setVMOption(String name, String value) { - Objects.requireNonNull(name); - DIAGNOSTIC_BEAN.setVMOption(name, value); - } -} diff --git a/test/hotspot/jtreg/vmTestbase/vm/share/monitoring/data/MemoryManagerData.java b/test/hotspot/jtreg/vmTestbase/vm/share/monitoring/data/MemoryManagerData.java deleted file mode 100644 index ec58d3d43eb8..000000000000 --- a/test/hotspot/jtreg/vmTestbase/vm/share/monitoring/data/MemoryManagerData.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2009, 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 vm.share.monitoring.data; - -import java.lang.management.*; -import javax.management.*; -import java.io.Serializable; - -public class MemoryManagerData implements MemoryManagerMXBean, Serializable { - private String[] memoryPoolNames; - private String name; - private boolean valid; - - public MemoryManagerData(String[] memoryPoolNames, String name, boolean valid) { - this.memoryPoolNames = memoryPoolNames; - this.name = name; - this.valid = valid; - } - - public MemoryManagerData(MemoryManagerMXBean memoryManager) { - this.memoryPoolNames = memoryManager.getMemoryPoolNames(); - this.name = memoryManager.getName(); - this.valid = memoryManager.isValid(); - } - - public String[] getMemoryPoolNames() { - return memoryPoolNames; - } - - public String getName() { - return name; - } - - public boolean isValid() { - return valid; - } - - public ObjectName getObjectName() { - return null; - } -} diff --git a/test/hotspot/jtreg/vmTestbase/vm/share/monitoring/data/MemoryPoolData.java b/test/hotspot/jtreg/vmTestbase/vm/share/monitoring/data/MemoryPoolData.java deleted file mode 100644 index cf2221bf1360..000000000000 --- a/test/hotspot/jtreg/vmTestbase/vm/share/monitoring/data/MemoryPoolData.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (c) 2009, 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 vm.share.monitoring.data; - -import java.lang.management.MemoryPoolMXBean; -import java.io.Serializable; - -public class MemoryPoolData implements Serializable { - private String name; - private boolean valid; - private MemoryUsageData usage; - - public MemoryPoolData(String name, boolean valid, MemoryUsageData usage) { - this.name = name; - this.valid = valid; - } - - public MemoryPoolData(MemoryPoolMXBean memoryManager) { - this.name = memoryManager.getName(); - this.valid = memoryManager.isValid(); - this.usage = new MemoryUsageData(memoryManager.getUsage()); - } - - public String getName() { - return name; - } - - public boolean hasName(String name) { - return this.name.equals(name); - } - - public boolean isValid() { - return valid; - } - - public MemoryUsageData getUsage() { - return usage; - } -} diff --git a/test/hotspot/jtreg/vmTestbase/vm/share/monitoring/data/MemoryUsageData.java b/test/hotspot/jtreg/vmTestbase/vm/share/monitoring/data/MemoryUsageData.java deleted file mode 100644 index 60b9fababe0c..000000000000 --- a/test/hotspot/jtreg/vmTestbase/vm/share/monitoring/data/MemoryUsageData.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2009, 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 vm.share.monitoring.data; - -import java.io.Serializable; -import java.lang.management.MemoryUsage; -import nsk.share.log.Log; - -public class MemoryUsageData implements Serializable { - private long init; - private long used; - private long committed; - private long max; - - public MemoryUsageData(long init, long used, long committed, long max) { - this.init = init; - this.used = used; - this.committed = committed; - this.max = max; - } - - public MemoryUsageData(MemoryUsage usage) { - this.init = usage.getInit(); - this.used = usage.getUsed(); - this.committed = usage.getCommitted(); - this.max = usage.getMax(); - } - - public MemoryUsageData(MemoryUsageData usage, MemoryUsageData usage1) { - this.init = usage.getInit() + usage1.getInit(); - this.used = usage.getUsed() + usage1.getUsed(); - this.committed = usage.getCommitted() + usage1.getCommitted(); - this.max = usage.getMax() + usage1.getMax(); - } - - public long getInit() { - return init; - } - - public long getUsed() { - return used; - } - - public long getMax() { - return max; - } - - public long getFree() { - return committed - used; - } - - public long getCommitted() { - return committed; - } - - public void log(Log log) { - log.info(" Init: " + init); - log.info(" Used: " + used); - log.info(" Committed: " + committed); - log.info(" Max: " + max); - } -} diff --git a/test/hotspot/jtreg/vmTestbase/vm/share/process/MessageInput.java b/test/hotspot/jtreg/vmTestbase/vm/share/process/MessageInput.java deleted file mode 100644 index d684d88f5437..000000000000 --- a/test/hotspot/jtreg/vmTestbase/vm/share/process/MessageInput.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright (c) 2011, 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 vm.share.process; - -import java.util.List; - -public interface MessageInput { - public boolean waitForStart(long timeout) throws InterruptedException; - public boolean waitForMessage(long timeout) throws InterruptedException; - public boolean waitForMessage(String msg, long timeout) throws InterruptedException; - public String getMessage(); - public List getMessages(); - public List getMessages(int to); - public List getMessages(int from, int to); - public boolean waitForFinish(long timeout) throws InterruptedException; - public void reset(); -} diff --git a/test/hotspot/jtreg/vmTestbase/vm/share/process/ProcessHandler.java b/test/hotspot/jtreg/vmTestbase/vm/share/process/ProcessHandler.java deleted file mode 100644 index 4ca3b191993f..000000000000 --- a/test/hotspot/jtreg/vmTestbase/vm/share/process/ProcessHandler.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * Copyright (c) 2011, 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 vm.share.process; - -import java.util.List; - -public class ProcessHandler implements MessageInput, MessageOutput { - private StreamMessageInput stdout = new StreamMessageInput(); - private StreamMessageInput stderr = new StreamMessageInput(); - private StreamMessageOutput stdin = new StreamMessageOutput(); - - public ProcessHandler() { - } - - public ProcessHandler(ProcessExecutor exec) { - bind(exec); - } - - public void bind(ProcessExecutor exec) { - exec.addStdOutListener(stdout.createListener()); - exec.addStdErrListener(stderr.createListener()); - exec.start(); - stdin.bind(exec.getStdIn()); - } - - public boolean waitForStart(long timeout) throws InterruptedException { - return stdout.waitForStart(timeout) && stderr.waitForStart(timeout); - } - - public boolean waitForMessage(long timeout) throws InterruptedException { - return stdout.waitForMessage(timeout); - } - - public boolean waitForMessage(String msg, long timeout) throws InterruptedException { - return stdout.waitForMessage(msg, timeout); - } - - public String getMessage() { - return stdout.getMessage(); - } - - public List getMessages() { - return stdout.getMessages(); - } - - public List getMessages(int to) { - return stdout.getMessages(to); - } - - public List getMessages(int from, int to) { - return stdout.getMessages(from, to); - } - - public boolean waitForStdErrMessage(String msg, long timeout) throws InterruptedException { - return stderr.waitForMessage(msg, timeout); - } - - public String getStdErrMessage() { - return stderr.getMessage(); - } - - public boolean waitForFinish(long timeout) throws InterruptedException { - return stdout.waitForFinish(timeout) && stderr.waitForFinish(timeout); - } - - public void start() { - stdin.start(); - } - - public void send(String msg) { - stdin.send(msg); - } - - public void finish() { - stdin.finish(); - } - - public void reset() { - stdout.reset(); - stderr.reset(); - } -} diff --git a/test/hotspot/jtreg/vmTestbase/vm/share/process/StreamMessageInput.java b/test/hotspot/jtreg/vmTestbase/vm/share/process/StreamMessageInput.java deleted file mode 100644 index 03d9ec6bd3e6..000000000000 --- a/test/hotspot/jtreg/vmTestbase/vm/share/process/StreamMessageInput.java +++ /dev/null @@ -1,187 +0,0 @@ -/* - * Copyright (c) 2011, 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 vm.share.process; - -import java.util.List; -import java.util.ArrayList; -import nsk.share.TestBug; - -public class StreamMessageInput implements MessageInput { - private Object sync = new Object(); - private List lines = new ArrayList(); - private int position = 0; - private volatile boolean active = false; - private volatile Throwable exception; - - public StreamMessageInput() { - } - - public StreamMessageInput(StreamReader sd) { - bind(sd); - } - - public StreamListener createListener() { - return new Listener(); - } - - public void bind(StreamReader sd) { - sd.addListener(createListener()); - } - - public boolean isActive() { - return active; - } - - public boolean isException() { - return exception != null; - } - - public Throwable getException() { - return exception; - } - - public boolean waitForStart(long timeout) throws InterruptedException { - long startTime = System.currentTimeMillis(); - long curTime = startTime; - synchronized (sync) { - while (!active && curTime - startTime < timeout) { - sync.wait(curTime - startTime); - curTime = System.currentTimeMillis(); - } - } - return active; - } - - public boolean waitForFinish(long timeout) throws InterruptedException { - long startTime = System.currentTimeMillis(); - long curTime = startTime; - synchronized (sync) { - while (active && curTime - startTime < timeout) { - sync.wait(curTime - startTime); - curTime = System.currentTimeMillis(); - } - } - return !active; - } - - public boolean waitForMessage(String msg, long timeout) throws InterruptedException { - long startTime = System.currentTimeMillis(); - long curTime = startTime; - int n = position; - synchronized (sync) { - while (curTime - startTime < timeout) { - while (n < lines.size()) { - // System.out.println("Check: " + lines.get(n)); - if (msg == null || lines.get(n++).contains(msg)) { - return true; - } - } - sync.wait(timeout - (curTime - startTime)); - curTime = System.currentTimeMillis(); - } - return false; - } - } - - public boolean waitForMessage(long timeout) throws InterruptedException { - return waitForMessage(null, timeout); - } - - public String getMessage() { - if (position < lines.size()) - return lines.get(position++); - else - return null; - } - - public String getMessage(int index) { - return lines.get(index); - } - - public int getPosition() { - return position; - } - - public void setPosition(int position) { - this.position = position; - } - - public int getMessageCount() { - return lines.size(); - } - - public List getMessages() { - return getMessages(position, lines.size()); - } - - public List getMessages(int to) { - return getMessages(position, to); - } - - public List getMessages(int from, int to) { - synchronized (sync) { - if (to < 0) - to = lines.size() + to; - position = Math.max(position, to); - return new ArrayList(lines.subList(from, to)); - } - } - - public void reset() { - synchronized (sync) { - position = lines.size(); - } - } - - private class Listener implements StreamListener { - @Override - public void onStart() { - synchronized (sync) { - active = true; - sync.notifyAll(); - } - } - - @Override - public void onRead(String line) { - //System.out.println("onRead: " + line); - synchronized (sync) { - lines.add(line); - sync.notifyAll(); - } - } - - @Override - public void onFinish() { - synchronized (sync) { - active = false; - sync.notifyAll(); - } - } - - @Override - public void onException(Throwable e) { - exception = e; - } - } -} diff --git a/test/hotspot/jtreg/vmTestbase/vm/share/transform/AnnotationAppender.java b/test/hotspot/jtreg/vmTestbase/vm/share/transform/AnnotationAppender.java deleted file mode 100644 index b3891fec5e41..000000000000 --- a/test/hotspot/jtreg/vmTestbase/vm/share/transform/AnnotationAppender.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright (c) 2013, 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 vm.share.transform; - -import jdk.internal.org.objectweb.asm.AnnotationVisitor; - -public abstract class AnnotationAppender { - private final String desc; - private final boolean visible; - private boolean annotationPresent; - - public AnnotationAppender(String desc, boolean visible) { - this.desc = desc; - this.visible = visible; - } - - public void checkAnnotation(String desc, boolean isVisible) { - annotationPresent |= visible == isVisible && this.desc.equals(desc); - } - - public void addAnnotation(VisitAnnotation func) { - if (shouldAdd()) { - AnnotationVisitor av = func.visit(desc, true); - if (av != null) { - postCreate(av); - av.visitEnd(); - annotationPresent = true; - } - } - } - - protected boolean shouldAdd() { - return !annotationPresent; - } - - protected abstract void postCreate(AnnotationVisitor av); - - @FunctionalInterface - public static interface VisitAnnotation { - AnnotationVisitor visit(String desc, boolean visible); - } -} diff --git a/test/hotspot/jtreg/vmTestbase/vm/share/transform/TransformingClassLoader.java b/test/hotspot/jtreg/vmTestbase/vm/share/transform/TransformingClassLoader.java deleted file mode 100644 index 5ce3dd02eb65..000000000000 --- a/test/hotspot/jtreg/vmTestbase/vm/share/transform/TransformingClassLoader.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2013, 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 vm.share.transform; - -import vm.share.FileUtils; - -public class TransformingClassLoader extends ClassLoader { - private final AbstractClassFileTransformer transformer; - - protected TransformingClassLoader(ClassLoader parent, - AbstractClassFileTransformer transformer) { - super(parent); - this.transformer = transformer; - } - - @Override - protected Class loadClass(String name, boolean resolve) - throws ClassNotFoundException { - if (!transformer.shouldBeTransformed(name)) { - return super.loadClass(name, resolve); - } - synchronized (getClassLoadingLock(name)) { - // First, check if the class has already been loaded - Class c = findLoadedClass(name); - if (c == null) { - try { - byte[] bytes = FileUtils.readClass(name); - bytes = transformer.transformClass(bytes); - c = defineClass(name, bytes, 0, bytes.length); - } catch (Exception e) { - e.printStackTrace(); - return super.loadClass(name, resolve); - } - } - if (resolve) { - resolveClass(c); - } - return c; - } - } -} diff --git a/test/jaxp/javax/xml/jaxp/libs/jaxp/library/JUnitTestUtil.java b/test/jaxp/javax/xml/jaxp/libs/jaxp/library/JUnitTestUtil.java new file mode 100644 index 000000000000..a31963f21dec --- /dev/null +++ b/test/jaxp/javax/xml/jaxp/libs/jaxp/library/JUnitTestUtil.java @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2025, 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 jaxp.library; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.StandardCopyOption; +import jdk.test.lib.Platform; + +public class JUnitTestUtil { + public static final String CLS_DIR = System.getProperty("test.classes"); + public static final String SRC_DIR = System.getProperty("test.src"); + + /** + * Returns the System identifier (URI) of the source. + * @param path the path to the source + * @return the System identifier + */ + public static String getSystemId(String path) { + if (path == null) return null; + String xmlSysId = "file://" + path; + if (Platform.isWindows()) { + path = path.replace('\\', '/'); + xmlSysId = "file:///" + path; + } + return xmlSysId; + } + + /** + * Copies a file. + * @param src the path of the source file + * @param target the path of the target file + * @throws Exception if the process fails + */ + public static void copyFile(String src, String target) throws Exception { + try { + Files.copy(Path.of(src), Path.of(target), StandardCopyOption.REPLACE_EXISTING); + } catch (IOException x) { + throw new Exception(x.getMessage()); + } + } +} diff --git a/test/jaxp/javax/xml/jaxp/unittest/transform/PropertiesTest.java b/test/jaxp/javax/xml/jaxp/unittest/transform/PropertiesTest.java new file mode 100644 index 000000000000..69c7a9ef543b --- /dev/null +++ b/test/jaxp/javax/xml/jaxp/unittest/transform/PropertiesTest.java @@ -0,0 +1,99 @@ +/* + * Copyright (c) 2025, 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 transform; + +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.stream.StreamSource; +import java.io.*; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.stream.Stream; +import jaxp.library.JUnitTestUtil; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; +import static org.junit.jupiter.api.Assertions.assertTrue; + +/* + * @test + * @bug 8344925 + * @summary Transformer properties tests + * @library /javax/xml/jaxp/libs /javax/xml/jaxp/unittest /test/lib + * @run junit/othervm transform.PropertiesTest + */ +public class PropertiesTest { + private static final String USER_DIR = System.getProperty("user.dir"); + private static final String TEST_DIR = System.getProperty("test.src"); + // Test parameters: + // generate-translet: indicates whether to generate translet + // translet-name: the name of the translet + // package-name: the package name + // destination-directory: the destination + // expected: the class path + private static Stream testData() { + String destination = JUnitTestUtil.CLS_DIR + "/testdir"; + return Stream.of( + Arguments.of(true, "MyTranslet", "org.myorg", destination, "/org/myorg/MyTranslet.class"), + Arguments.of(false, "Translet", "not.generate", destination, "/not/generate/Translet.class"), + // translet named after the stylesheet + Arguments.of(true, null, "org.myorg", destination, "/org/myorg/transform.class"), + // default package name die.verwandlung since JDK 9 + Arguments.of(true, "MyTranslet", null, destination, "/die/verwandlung/MyTranslet.class"), + Arguments.of(true, "MyTranslet", "org.myorg", null, "/org/myorg/MyTranslet.class") + ); + } + + @BeforeAll + public static void setup() throws Exception { + // so that the translet is generated under test.classes + JUnitTestUtil.copyFile(JUnitTestUtil.SRC_DIR + "/transform.xsl", JUnitTestUtil.CLS_DIR + "/transform.xsl"); + } + + @ParameterizedTest + @MethodSource("testData") + public void test(boolean generateTranslet, String name, String packageName, + String destination, String expected) + throws Exception { + TransformerFactory tf = TransformerFactory.newInstance(); + + tf.setAttribute("generate-translet", generateTranslet); + if (name != null) tf.setAttribute("translet-name", name); + if (packageName != null) tf.setAttribute("package-name", packageName); + if (destination != null) tf.setAttribute("destination-directory", destination); + + String xslFile = JUnitTestUtil.CLS_DIR + "/transform.xsl"; + String xslSysId = JUnitTestUtil.getSystemId(xslFile); + StreamSource xsl = new StreamSource(xslSysId); + tf.newTemplates(xsl); + + String path = (destination != null) ? destination + expected : new File(xslFile).getParent() + expected; + + if (generateTranslet) { + assertTrue(Files.exists(Path.of(path)), "Translet is expected at " + expected); + } else { + assertTrue(Files.notExists(Path.of(path)), "Translet is not to be generated."); + } + } +} diff --git a/test/jdk/ProblemList-Virtual.txt b/test/jdk/ProblemList-Virtual.txt index 5260a8327968..fab82f289637 100644 --- a/test/jdk/ProblemList-Virtual.txt +++ b/test/jdk/ProblemList-Virtual.txt @@ -30,9 +30,6 @@ com/sun/jdi/EATests.java#id0 8264699 generic- com/sun/jdi/ExceptionEvents.java 8278470 generic-all com/sun/jdi/RedefineCrossStart.java 8278470 generic-all -sun/tools/jcmd/JcmdOutputEncodingTest.java 8308033 generic-all -sun/tools/jstack/BasicJStackTest.java 8308033 generic-all - javax/management/remote/mandatory/connection/BrokenConnectionTest.java 8308035 windows-x64 javax/management/remote/mandatory/loading/MissingClassTest.java 8145413 windows-x64 diff --git a/test/jdk/ProblemList-shenandoah.txt b/test/jdk/ProblemList-shenandoah.txt new file mode 100644 index 000000000000..063795d69e84 --- /dev/null +++ b/test/jdk/ProblemList-shenandoah.txt @@ -0,0 +1,60 @@ +# +# Copyright Amazon.com Inc. 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. +# + +############################################################################# +# +# List of quarantined tests for testing with Shenandoah. +# +############################################################################# + +# Quiet all LeakProfiler tests + +jdk/jfr/api/consumer/TestRecordingFileWrite.java 8342951 generic-all +jdk/jfr/event/oldobject/TestAllocationTime.java 8342951 generic-all +jdk/jfr/event/oldobject/TestArrayInformation.java 8342951 generic-all +jdk/jfr/event/oldobject/TestCircularReference.java 8342951 generic-all +jdk/jfr/event/oldobject/TestClassLoaderLeak.java 8342951 generic-all +jdk/jfr/event/oldobject/TestFieldInformation.java 8342951 generic-all +jdk/jfr/event/oldobject/TestG1.java 8342951 generic-all +jdk/jfr/event/oldobject/TestHeapDeep.java 8342951 generic-all +jdk/jfr/event/oldobject/TestHeapShallow.java 8342951 generic-all +jdk/jfr/event/oldobject/TestLargeRootSet.java 8342951 generic-all +jdk/jfr/event/oldobject/TestLastKnownHeapUsage.java 8342951 generic-all +jdk/jfr/event/oldobject/TestListenerLeak.java 8342951 generic-all +jdk/jfr/event/oldobject/TestMetadataRetention.java 8342951 generic-all +jdk/jfr/event/oldobject/TestObjectAge.java 8342951 generic-all +jdk/jfr/event/oldobject/TestObjectDescription.java 8342951 generic-all +jdk/jfr/event/oldobject/TestObjectSize.java 8342951 generic-all +jdk/jfr/event/oldobject/TestParallel.java 8342951 generic-all +jdk/jfr/event/oldobject/TestReferenceChainLimit.java 8342951 generic-all +jdk/jfr/event/oldobject/TestSanityDefault.java 8342951 generic-all +jdk/jfr/event/oldobject/TestSerial.java 8342951 generic-all +jdk/jfr/event/oldobject/TestShenandoah.java 8342951 generic-all +jdk/jfr/event/oldobject/TestThreadLocalLeak.java 8342951 generic-all +jdk/jfr/event/oldobject/TestZ.java 8342951 generic-all +jdk/jfr/jcmd/TestJcmdDump.java 8342951 generic-all +jdk/jfr/jcmd/TestJcmdDumpPathToGCRoots.java 8342951 generic-all +jdk/jfr/jcmd/TestJcmdStartPathToGCRoots.java 8342951 generic-all +jdk/jfr/jvm/TestWaste.java 8342951 generic-all +jdk/jfr/startupargs/TestOldObjectQueueSize.java 8342951 generic-all + diff --git a/test/jdk/ProblemList.txt b/test/jdk/ProblemList.txt index b4c31b3763f5..efec47e9c6b2 100644 --- a/test/jdk/ProblemList.txt +++ b/test/jdk/ProblemList.txt @@ -122,10 +122,15 @@ java/awt/Focus/AutoRequestFocusTest/AutoRequestFocusSetVisibleTest.java 6848407 java/awt/Frame/MaximizedToIconified/MaximizedToIconified.java 8296972 macosx-all java/awt/Frame/MaximizedUndecorated/MaximizedUndecorated.java 8022302 generic-all java/awt/Frame/RestoreToOppositeScreen/RestoreToOppositeScreen.java 8286840 linux-all +java/awt/Frame/InitialIconifiedTest.java 7144049,8203920 macosx-all,linux-all +java/awt/Frame/FocusTest.java 8341480 macosx-all java/awt/FileDialog/FileDialogIconTest/FileDialogIconTest.java 8160558 windows-all java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion.java 8060176 windows-all,macosx-all java/awt/event/MouseWheelEvent/InfiniteRecursion/InfiniteRecursion_1.java 8060176 windows-all,macosx-all java/awt/dnd/URIListBetweenJVMsTest/URIListBetweenJVMsTest.java 8171510 macosx-all +java/awt/dnd/DragExitBeforeDropTest.java 8242805 macosx-all +java/awt/dnd/DragThresholdTest.java 8076299 macosx-all +java/awt/dnd/CustomDragCursorTest.java 8242805 macosx-all java/awt/Focus/ChoiceFocus/ChoiceFocus.java 8169103 windows-all,macosx-all java/awt/Focus/ClearLwQueueBreakTest/ClearLwQueueBreakTest.java 8198618 macosx-all java/awt/Focus/ConsumeNextKeyTypedOnModalShowTest/ConsumeNextKeyTypedOnModalShowTest.java 6986252 macosx-all @@ -133,7 +138,12 @@ java/awt/Focus/MouseClickRequestFocusRaceTest/MouseClickRequestFocusRaceTest.jav java/awt/Focus/NoAutotransferToDisabledCompTest/NoAutotransferToDisabledCompTest.java 7152980 macosx-all java/awt/Focus/ToFrontFocusTest/ToFrontFocus.java 7156130 linux-all java/awt/Focus/WrongKeyTypedConsumedTest/WrongKeyTypedConsumedTest.java 8169096 macosx-all +java/awt/Focus/TestDisabledAutoTransfer.java 8159871 macosx-all,windows-all +java/awt/Focus/TestDisabledAutoTransferSwing.java 6962362 windows-all +java/awt/Focus/ActivateOnProperAppContextTest.java 8136516 macosx-all +java/awt/Focus/FocusPolicyTest.java 7160904 linux-all java/awt/EventQueue/6980209/bug6980209.java 8198615 macosx-all +java/awt/EventQueue/PushPopDeadlock/PushPopDeadlock.java 8024034 generic-all java/awt/grab/EmbeddedFrameTest1/EmbeddedFrameTest1.java 7080150 macosx-all java/awt/event/InputEvent/EventWhenTest/EventWhenTest.java 8168646 generic-all java/awt/Mixing/AWT_Mixing/HierarchyBoundsListenerMixingTest.java 8049405 macosx-all @@ -187,6 +197,9 @@ java/awt/event/KeyEvent/ExtendedKeyCode/ExtendedKeyCodeTest.java 8169476 windows java/awt/event/KeyEvent/KeyChar/KeyCharTest.java 8169474,8224055 macosx-all,windows-all java/awt/event/KeyEvent/KeyTyped/CtrlASCII.java 8298910 linux-all +java/awt/dnd/DnDRemoveFocusOwnerCrashTest.java 8242805 macosx-all +java/awt/dnd/DnDCursorCrashTest.java 8242805 macosx-all +java/awt/dnd/DnDClipboardDeadlockTest.java 8079553 linux-all java/awt/dnd/URIListToFileListBetweenJVMsTest/URIListToFileListBetweenJVMsTest.java 8194947 generic-all java/awt/Frame/FramesGC/FramesGC.java 8079069 macosx-all java/awt/TrayIcon/ActionCommand/ActionCommand.java 8150540 windows-all @@ -201,6 +214,9 @@ java/awt/TrayIcon/TrayIconEvents/TrayIconEventsTest.java 8150540,8295300 windows java/awt/TrayIcon/TrayIconMouseTest/TrayIconMouseTest.java 8150540 windows-all java/awt/TrayIcon/TrayIconPopup/TrayIconPopupClickTest.java 8150540 windows-all,macosx-all java/awt/TrayIcon/TrayIconPopup/TrayIconPopupTest.java 8150540 windows-all +java/awt/TrayIcon/MouseMoveTest.java 8203053 linux-all +java/awt/TrayIcon/TrayIconKeySelectTest.java 8341557 windows-all +java/awt/TrayIcon/TrayIconTest.java 8341559 generic-all java/awt/Window/ShapedAndTranslucentWindows/SetShapeAndClick.java 8197936 macosx-all java/awt/Window/ShapedAndTranslucentWindows/SetShapeDynamicallyAndClick.java 8013450 macosx-all @@ -236,6 +252,9 @@ java/awt/print/PrinterJob/GlyphPositions.java 7003378 generic-all java/awt/Choice/ChoiceMouseWheelTest/ChoiceMouseWheelTest.java 6849371 macosx-all,linux-all java/awt/Component/GetScreenLocTest/GetScreenLocTest.java 4753654 generic-all java/awt/Component/SetEnabledPerformance/SetEnabledPerformance.java 8165863 macosx-all +java/awt/Clipboard/PasteNullToTextComponentsTest.java 8234140 macosx-all,windows-all +java/awt/Clipboard/NoOwnerNoTargetsTest.java 8234140 macosx-all +java/awt/Clipboard/LostOwnershipChainTest/SystemClipboard2ProcTest.java 8234140 macosx-all java/awt/Clipboard/HTMLTransferTest/HTMLTransferTest.java 8017454 macosx-all java/awt/Frame/MiscUndecorated/RepaintTest.java 8266244 macosx-aarch64 java/awt/Modal/FileDialog/FileDialogAppModal1Test.java 7186009 macosx-all @@ -424,6 +443,7 @@ java/awt/SplashScreen/MultiResolutionSplash/unix/UnixMultiResolutionSplashTest.j java/awt/Robot/AcceptExtraMouseButtons/AcceptExtraMouseButtons.java 7107528 linux-all,macosx-all java/awt/Mouse/MouseDragEvent/MouseDraggedTest.java 8080676 linux-all java/awt/Mouse/MouseModifiersUnitTest/MouseModifiersInKeyEvent.java 8157147 linux-all,windows-all,macosx-all +java/awt/Mouse/MouseClickCount.java 8017182 macosx-all java/awt/Toolkit/ToolkitPropertyTest/ToolkitPropertyTest_Enable.java 6847163 linux-all java/awt/xembed/server/RunTestXEmbed.java 7034201 linux-all java/awt/Modal/ModalFocusTransferTests/FocusTransferDialogsDocModalTest.java 8164473 linux-all @@ -459,7 +479,15 @@ java/awt/KeyboardFocusmanager/ConsumeNextMnemonicKeyTypedTest/ConsumeNextMnemoni java/awt/Window/GetScreenLocation/GetScreenLocationTest.java 8225787 linux-x64 java/awt/Dialog/MakeWindowAlwaysOnTop/MakeWindowAlwaysOnTop.java 8266243 macosx-aarch64 +java/awt/Dialog/PrintToFileTest/PrintToFileRevoked.java 8029249 macosx-all +java/awt/Dialog/PrintToFileTest/PrintToFileGranted.java 8029249 macosx-all +java/awt/Dialog/ChoiceModalDialogTest.java 8161475 macosx-all +java/awt/Dialog/FileDialogUserFilterTest.java 8001142 generic-all + java/awt/dnd/BadSerializationTest/BadSerializationTest.java 8277817 linux-x64,windows-x64 +java/awt/dnd/DragSourceMotionListenerTest.java 8225131 windows-all +java/awt/dnd/RejectDragTest.java 7124259 macosx-all +java/awt/dnd/DnDHTMLToOutlookTest/DnDHTMLToOutlookTest.java 8027424 generic-all java/awt/GraphicsDevice/DisplayModes/UnknownRefrshRateTest.java 8286436 macosx-aarch64 java/awt/image/multiresolution/MultiresolutionIconTest.java 8291979 linux-x64,windows-all java/awt/event/SequencedEvent/MultipleContextsFunctionalTest.java 8305061 macosx-x64 @@ -476,7 +504,6 @@ java/beans/XMLEncoder/Test6570354.java 8015593 macosx-all # Wayland related -java/awt/FullScreen/FullscreenWindowProps/FullscreenWindowProps.java 8280991 linux-x64 ############################################################################ @@ -522,8 +549,6 @@ sun/management/jdp/JdpOffTest.java 8308807 aix-ppc6 javax/management/MBeanServer/OldMBeanServerTest.java 8030957 aix-all -javax/management/monitor/DerivedGaugeMonitorTest.java 8042211 generic-all - javax/management/remote/mandatory/connection/RMIConnector_NPETest.java 8267887 generic-all javax/management/remote/mandatory/connection/BrokenConnectionTest.java 8262312 linux-all @@ -656,7 +681,6 @@ javax/swing/AbstractButton/6711682/bug6711682.java 8060765 windows-all,macosx-al javax/swing/JFileChooser/6396844/TwentyThousandTest.java 8198003 generic-all javax/swing/JFileChooser/8194044/FileSystemRootTest.java 8327236 windows-all javax/swing/JPopupMenu/6800513/bug6800513.java 7184956 macosx-all -javax/swing/JTabbedPane/8007563/Test8007563.java 8051591 generic-all javax/swing/JTabbedPane/4624207/bug4624207.java 8064922 macosx-all javax/swing/SwingUtilities/TestBadBreak/TestBadBreak.java 8160720 generic-all javax/swing/JFileChooser/6798062/bug6798062.java 8146446 windows-all @@ -754,6 +778,7 @@ jdk/incubator/vector/LoadJsvmlTest.java 8305390 windows- # jdk_jfr jdk/jfr/event/compiler/TestCodeSweeper.java 8225209 generic-all +jdk/jfr/event/oldobject/TestShenandoah.java 8342951 generic-all jdk/jfr/event/runtime/TestResidentSetSizeEvent.java 8309846 aix-ppc64 jdk/jfr/startupargs/TestStartName.java 8214685 windows-x64 jdk/jfr/startupargs/TestStartDuration.java 8214685 windows-x64 @@ -805,3 +830,10 @@ java/awt/event/MouseEvent/SpuriousExitEnter/SpuriousExitEnter.java 8254841 macos java/awt/Focus/AppletInitialFocusTest/AppletInitialFocusTest1.java 8256289 windows-x64 java/awt/FullScreen/TranslucentWindow/TranslucentWindow.java 8258103 linux-all java/awt/Focus/FrameMinimizeTest/FrameMinimizeTest.java 8016266 linux-x64 +java/awt/Frame/SizeMinimizedTest.java 8305915 linux-x64 +java/awt/PopupMenu/PopupHangTest.java 8340022 windows-all +java/awt/Focus/InactiveFocusRace.java 8023263 linux-all +java/awt/Checkbox/CheckboxBoxSizeTest.java 8340870 windows-all +java/awt/Checkbox/CheckboxIndicatorSizeTest.java 8340870 windows-all +java/awt/Checkbox/CheckboxNullLabelTest.java 8340870 windows-all +java/awt/dnd/WinMoveFileToShellTest.java 8341665 windows-all diff --git a/test/jdk/TEST.groups b/test/jdk/TEST.groups index 9ccbbeba9c65..40d6e900a553 100644 --- a/test/jdk/TEST.groups +++ b/test/jdk/TEST.groups @@ -837,7 +837,6 @@ jdk_awt_wayland = \ -java/awt/datatransfer/CustomClassLoaderTransferTest/CustomClassLoaderTransferTest.java \ -java/awt/datatransfer/DataFlavor/DataFlavorRemoteTest.java \ -java/awt/datatransfer/DragImage/MultiResolutionDragImageTest.java \ - -java/awt/datatransfer/HTMLDataFlavors/ManualHTMLDataFlavorTest.html \ -java/awt/datatransfer/ImageTransfer/ImageTransferTest.java \ -java/awt/datatransfer/Independence/IndependenceAWTTest.java \ -java/awt/datatransfer/Independence/IndependenceSwingTest.java \ diff --git a/test/jdk/com/sun/jmx/mbeanserver/introspector/BeanClass.java b/test/jdk/com/sun/jmx/mbeanserver/introspector/BeanClass.java index 06746f649236..f80630ca6ed9 100644 --- a/test/jdk/com/sun/jmx/mbeanserver/introspector/BeanClass.java +++ b/test/jdk/com/sun/jmx/mbeanserver/introspector/BeanClass.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/com/sun/jmx/mbeanserver/introspector/SimpleIntrospectorTest.java b/test/jdk/com/sun/jmx/mbeanserver/introspector/SimpleIntrospectorTest.java index 6a96e9ec2d5b..ca540120629b 100644 --- a/test/jdk/com/sun/jmx/mbeanserver/introspector/SimpleIntrospectorTest.java +++ b/test/jdk/com/sun/jmx/mbeanserver/introspector/SimpleIntrospectorTest.java @@ -5,9 +5,7 @@ * * 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. + * 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 diff --git a/test/jdk/com/sun/jndi/dns/ConfigTests/Timeout.java b/test/jdk/com/sun/jndi/dns/ConfigTests/Timeout.java index 90a2a7b98156..e03923b6c344 100644 --- a/test/jdk/com/sun/jndi/dns/ConfigTests/Timeout.java +++ b/test/jdk/com/sun/jndi/dns/ConfigTests/Timeout.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2024, 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 @@ -29,7 +29,6 @@ import java.net.InetSocketAddress; import java.net.SocketTimeoutException; import java.time.Duration; -import java.time.Instant; import jdk.test.lib.net.URIBuilder; @@ -40,7 +39,7 @@ * number of retries. * @library ../lib/ /test/lib * @modules java.base/sun.security.util - * @run main Timeout + * @run main/othervm Timeout */ public class Timeout extends DNSTestBase { @@ -48,8 +47,12 @@ public class Timeout extends DNSTestBase { private static final int TIMEOUT = 250; // try 5 times per server private static final int RETRIES = 5; + // DnsClient retries again with increased timeout if left + // timeout is less than this value, and max retry attempts + // is not reached + private static final int DNS_CLIENT_MIN_TIMEOUT = 0; - private Instant startTime; + private long startTime; public Timeout() { setLocalServer(false); @@ -81,7 +84,7 @@ public void runTest() throws Exception { setContext(new InitialDirContext(env())); // Any request should fail after timeouts have expired. - startTime = Instant.now(); + startTime = System.nanoTime(); context().getAttributes(""); throw new RuntimeException( @@ -92,28 +95,35 @@ public void runTest() throws Exception { @Override public boolean handleException(Exception e) { if (e instanceof CommunicationException) { - Duration elapsedTime = Duration.between(startTime, Instant.now()); + Duration elapsedTime = Duration.ofNanos(System.nanoTime() - startTime); if (!(((CommunicationException) e) .getRootCause() instanceof SocketTimeoutException)) { return false; } - Duration expectedTime = Duration.ofMillis(TIMEOUT) - .multipliedBy((1 << RETRIES) - 1); + Duration minAllowedTime = Duration.ofMillis(TIMEOUT) + .multipliedBy((1 << RETRIES) - 1) + .minus(Duration.ofMillis(DNS_CLIENT_MIN_TIMEOUT * RETRIES)); + Duration maxAllowedTime = Duration.ofMillis(TIMEOUT) + .multipliedBy((1 << RETRIES) - 1) + // max allowed timeout value is set to 2 * expected timeout + .multipliedBy(2); + DNSTestUtils.debug("Elapsed (ms): " + elapsedTime.toMillis()); - DNSTestUtils.debug("Expected (ms): " + expectedTime.toMillis()); + String expectedRangeMsg = "%s - %s" + .formatted(minAllowedTime.toMillis(), maxAllowedTime.toMillis()); + DNSTestUtils.debug("Expected range (ms): " + expectedRangeMsg); // Check that elapsed time is as long as expected, and - // not more than 50% greater. - if (elapsedTime.compareTo(expectedTime) >= 0 && - elapsedTime.multipliedBy(2) - .compareTo(expectedTime.multipliedBy(3)) <= 0) { + // not more than 2 times greater. + if (elapsedTime.compareTo(minAllowedTime) >= 0 && + elapsedTime.compareTo(maxAllowedTime) <= 0) { System.out.println("elapsed time is as long as expected."); return true; } throw new RuntimeException( - "Failed: timeout in " + elapsedTime.toMillis() - + " ms, expected" + expectedTime.toMillis() + "ms"); + "Failed: timeout in " + elapsedTime.toMillis() + + " ms, expected to be in a range (ms): " + expectedRangeMsg); } return super.handleException(e); diff --git a/test/jdk/com/sun/jndi/dns/ConfigTests/TimeoutWithEmptyDatagrams.java b/test/jdk/com/sun/jndi/dns/ConfigTests/TimeoutWithEmptyDatagrams.java new file mode 100644 index 000000000000..9fb8954c99c5 --- /dev/null +++ b/test/jdk/com/sun/jndi/dns/ConfigTests/TimeoutWithEmptyDatagrams.java @@ -0,0 +1,196 @@ +/* + * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import jdk.test.lib.net.URIBuilder; + +import javax.naming.CommunicationException; +import javax.naming.Context; +import javax.naming.directory.InitialDirContext; +import java.io.IOException; +import java.net.DatagramPacket; +import java.net.DatagramSocket; +import java.net.InetAddress; +import java.net.InetSocketAddress; +import java.net.SocketAddress; +import java.net.SocketTimeoutException; +import java.time.Duration; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.atomic.AtomicReference; + +/* + * @test + * @bug 8339538 + * @summary Tests that DnsClient correctly calculates left timeout in + * presence of empty datagram packets. + * @library ../lib /test/lib + * @modules java.base/sun.security.util + * @run main/othervm TimeoutWithEmptyDatagrams + */ + +public class TimeoutWithEmptyDatagrams extends DNSTestBase { + // initial timeout = 1/4 sec + private static final int TIMEOUT = 250; + // try 5 times per server + private static final int RETRIES = 5; + // DnsClient retries again with increased timeout if left + // timeout is less than this value, and max retry attempts + // is not reached + private static final int DNS_CLIENT_MIN_TIMEOUT = 0; + + public TimeoutWithEmptyDatagrams() { + setLocalServer(false); + } + + public static void main(String[] args) throws Exception { + new TimeoutWithEmptyDatagrams().run(args); + } + + /* + * Tests that we can set the initial UDP timeout interval and the + * number of retries. + */ + @Override + public void runTest() throws Exception { + // Create a DatagramSocket and bind it to the loopback address to simulate + // UDP DNS server that doesn't respond + try (DatagramSocket ds = new DatagramSocket(new InetSocketAddress( + InetAddress.getLoopbackAddress(), 0))) { + CountDownLatch gotClientAddress = new CountDownLatch(1); + AtomicReference clientAddress = new AtomicReference<>(); + AtomicBoolean stopTestThreads = new AtomicBoolean(); + + String allQuietUrl = URIBuilder.newBuilder() + .scheme("dns") + .loopback() + .port(ds.getLocalPort()) + .build() + .toString(); + + // Run a virtual thread that receives client request packets and extracts + // sender address from them. + Thread receiverThread = Thread.ofVirtual().start(() -> { + while (!stopTestThreads.get()) { + try { + DatagramPacket packet = new DatagramPacket(new byte[1024], 1024); + ds.receive(packet); + System.err.println("Got packet from " + packet.getSocketAddress()); + boolean hasClientAddress = clientAddress.get() != null; + clientAddress.set(packet.getSocketAddress()); + if (!hasClientAddress) { + gotClientAddress.countDown(); + } + } catch (IOException e) { + if (!stopTestThreads.get()) { + throw new RuntimeException(e); + } else { + return; + } + } + } + }); + + // Run a virtual thread that will send an empty packets via server socket + // that should wake up the selector on a client side. + Thread wakeupThread = Thread.ofVirtual().start(() -> { + try { + long timeout = Math.max(1, TIMEOUT / 4); + // wait for a first packet on a server socket + gotClientAddress.await(); + + // Now start sending empty packets until we get a notification + // from client part to stop sending + while (!stopTestThreads.get()) { + System.err.println("Server timeout = " + timeout); + TimeUnit.MILLISECONDS.sleep(timeout); + System.err.println("Sending wakeup packet to " + clientAddress.get()); + var wakeupPacket = new DatagramPacket(new byte[0], 0); + wakeupPacket.setSocketAddress(clientAddress.get()); + ds.send(wakeupPacket); + timeout += Math.max(1, timeout / 2); + } + } catch (IOException ioe) { + throw new RuntimeException("Test machinery failure", ioe); + } catch (InterruptedException e) { + throw new RuntimeException("Interrupted during wakeup packets sending"); + } finally { + System.err.println("Server thread exiting"); + } + }); + + long startTime = 0; + try { + env().put(Context.PROVIDER_URL, allQuietUrl); + env().put("com.sun.jndi.dns.timeout.initial", String.valueOf(TIMEOUT)); + env().put("com.sun.jndi.dns.timeout.retries", String.valueOf(RETRIES)); + setContext(new InitialDirContext(env())); + + startTime = System.nanoTime(); + context().getAttributes(""); + + // Any request should fail after timeouts have expired. + throw new RuntimeException("Failed: getAttributes succeeded unexpectedly"); + } catch (CommunicationException ce) { + // We need to catch CommunicationException outside the test framework + // flow because wakeupThread.join() can take some time that could + // increase measured timeout + long endTime = System.nanoTime(); + Duration elapsedTime = Duration.ofNanos(endTime - startTime); + if (ce.getRootCause() instanceof SocketTimeoutException) { + + Duration minAllowedTime = Duration.ofMillis(TIMEOUT) + .multipliedBy((1 << RETRIES) - 1) + .minus(Duration.ofMillis(DNS_CLIENT_MIN_TIMEOUT * RETRIES)); + Duration maxAllowedTime = Duration.ofMillis(TIMEOUT) + .multipliedBy((1 << RETRIES) - 1) + // max allowed timeout value is set to 2 * expected timeout + .multipliedBy(2); + + DNSTestUtils.debug("Elapsed (ms): " + elapsedTime.toMillis()); + String expectedRangeMsg = "%s - %s" + .formatted(minAllowedTime.toMillis(), maxAllowedTime.toMillis()); + DNSTestUtils.debug("Expected range (ms): " + expectedRangeMsg); + + // Check that elapsed time is as long as expected, and + // not more than 2 times greater. + if (elapsedTime.compareTo(minAllowedTime) >= 0 && + elapsedTime.compareTo(maxAllowedTime) <= 0) { + System.out.println("elapsed time is as long as expected."); + } else { + throw new RuntimeException( + "Failed: timeout in " + elapsedTime.toMillis() + + " ms, expected to be in a range (ms): " + expectedRangeMsg); + } + } else { + throw ce; + } + } finally { + stopTestThreads.set(true); + wakeupThread.join(); + ds.close(); + receiverThread.join(); + } + } + } +} diff --git a/test/jdk/com/sun/jndi/ldap/LdapDnsProviderTest.java b/test/jdk/com/sun/jndi/ldap/LdapDnsProviderTest.java index 3acc3d0cae19..f00ac2ecb476 100644 --- a/test/jdk/com/sun/jndi/ldap/LdapDnsProviderTest.java +++ b/test/jdk/com/sun/jndi/ldap/LdapDnsProviderTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/com/sun/net/httpserver/bugs/8300268/MaxIdleConnectionsTest.java b/test/jdk/com/sun/net/httpserver/bugs/8300268/MaxIdleConnectionsTest.java index 015f0773b07b..3394dc3c6a9c 100644 --- a/test/jdk/com/sun/net/httpserver/bugs/8300268/MaxIdleConnectionsTest.java +++ b/test/jdk/com/sun/net/httpserver/bugs/8300268/MaxIdleConnectionsTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/com/sun/net/httpserver/bugs/8300268/jdk.httpserver/sun/net/httpserver/HttpServerAccess.java b/test/jdk/com/sun/net/httpserver/bugs/8300268/jdk.httpserver/sun/net/httpserver/HttpServerAccess.java index 7df9426381c5..e77ef7ce0624 100644 --- a/test/jdk/com/sun/net/httpserver/bugs/8300268/jdk.httpserver/sun/net/httpserver/HttpServerAccess.java +++ b/test/jdk/com/sun/net/httpserver/bugs/8300268/jdk.httpserver/sun/net/httpserver/HttpServerAccess.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/com/sun/net/httpserver/bugs/B6361557.java b/test/jdk/com/sun/net/httpserver/bugs/B6361557.java index 57e831ec693d..66094230d697 100644 --- a/test/jdk/com/sun/net/httpserver/bugs/B6361557.java +++ b/test/jdk/com/sun/net/httpserver/bugs/B6361557.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -65,7 +65,7 @@ public void handle (HttpExchange t) } final static String request = "GET /test/foo.html HTTP/1.1\r\nContent-length: 0\r\n\r\n"; - final static ByteBuffer requestBuf = ByteBuffer.allocate(64).put(request.getBytes()); + final static ByteBuffer requestBuf = ByteBuffer.wrap(request.getBytes()); public static void main (String[] args) throws Exception { Handler handler = new Handler(); diff --git a/test/jdk/com/sun/net/httpserver/bugs/HttpExchange/jdk.httpserver/sun/net/httpserver/HttpExchangeAccess.java b/test/jdk/com/sun/net/httpserver/bugs/HttpExchange/jdk.httpserver/sun/net/httpserver/HttpExchangeAccess.java index 652e4cbecb24..8f89fabd49ee 100644 --- a/test/jdk/com/sun/net/httpserver/bugs/HttpExchange/jdk.httpserver/sun/net/httpserver/HttpExchangeAccess.java +++ b/test/jdk/com/sun/net/httpserver/bugs/HttpExchange/jdk.httpserver/sun/net/httpserver/HttpExchangeAccess.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/com/sun/security/auth/callback/TextCallbackHandler/Default.java b/test/jdk/com/sun/security/auth/callback/TextCallbackHandler/Default.java index 1fb3350c8f7e..5b7b075250e7 100644 --- a/test/jdk/com/sun/security/auth/callback/TextCallbackHandler/Default.java +++ b/test/jdk/com/sun/security/auth/callback/TextCallbackHandler/Default.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 - * @library /test/lib /java/security/testlibrary + * @library /test/lib * @bug 4470717 * @summary fix default handling and other misc * @run main/othervm Default @@ -34,6 +34,7 @@ import javax.security.auth.callback.*; import java.io.*; +import jdk.test.lib.security.HumanInputStream; public class Default { public static void main(String args[]) throws Exception { diff --git a/test/jdk/com/sun/security/auth/callback/TextCallbackHandler/Password.java b/test/jdk/com/sun/security/auth/callback/TextCallbackHandler/Password.java index f9231a0b36ed..297b40109ee5 100644 --- a/test/jdk/com/sun/security/auth/callback/TextCallbackHandler/Password.java +++ b/test/jdk/com/sun/security/auth/callback/TextCallbackHandler/Password.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,35 +25,118 @@ * @test * @bug 6825240 6829785 * @summary Password.readPassword() echos the input when System.Console is null - * @run main/manual Password - */ - -/* - * This scenario cannot be automated because util/Password.java verifies the given input stream is - * equal to the initialSystemIn. This prevents the test from providing a custom input stream. - * - * Steps to run the test: - * 1) Compile the class using the JDK version being tested: '/javac Password.java' - * 2) Run the test using the JDK version being tested: '/java -cp . Password' - * 3) Type in the first password, it should not be visible in the console - * 4) Type in the second password, it should be visible in the console - * 5) The final output line displays the entered passwords, both should be visible + * @library /test/lib + * @run main/manual/othervm Password */ import com.sun.security.auth.callback.TextCallbackHandler; + + import javax.security.auth.callback.*; +import javax.swing.*; + +import jdk.test.lib.UIBuilder; + +import java.util.Arrays; public class Password { - public static void main(String args[]) throws Exception { - TextCallbackHandler h = new TextCallbackHandler(); - PasswordCallback nc = new PasswordCallback("Invisible: ", false); - PasswordCallback nc2 = new PasswordCallback("Visible: ", true); - System.out.println("Two passwords will be prompted for. The first one " + - "should have echo off, the second one on. Otherwise, this test fails"); - Callback[] callbacks = { nc, nc2 }; + private static final int TIMEOUT_MS = 240000; + private volatile boolean failed = false; + private volatile boolean aborted = false; + private Thread currentThread = null; + + public static void password() throws Exception { + + TextCallbackHandler h = new TextCallbackHandler(); + PasswordCallback nc = + new PasswordCallback("Please input something, your input should be VISIBLE: ", true); + PasswordCallback nc2 = + new PasswordCallback("Please input something again, your input should be INVISIBLE: ", false); + Callback[] callbacks = {nc, nc2}; h.handle(callbacks); System.out.println("You input " + new String(nc.getPassword()) + " and " + new String(nc2.getPassword())); - } + } + + public static void main(String[] args) throws Exception { + if (Arrays.asList(args).contains("--password")) { + password(); + } else { + final String instructions = String.format("%s/bin/java -cp \"%s\" Password --password", + System.getProperty("java.home").replace("\\","/"), + System.getProperty("java.class.path").replace("\\","/") + ); + + boolean testFailed = new Password().validate( + "Please copy and execute the following script in the terminal / Windows Command Prompt window. " + + "Two passwords will be prompted for.\n" + + "Enter something at each prompt and press Enter/Return.\n" + + "If the first input is visible and the second is invisible, this test PASSES. Otherwise, this test FAILS.\n" + + "Once the test is complete please select whether the test has passed.\n", + instructions); + + if (testFailed) { + throw new RuntimeException("Test has failed"); + } + } + } + + public boolean validate(String instruction, String message) { + failed = false; + currentThread = Thread.currentThread(); + final JDialog dialog = new UIBuilder.DialogBuilder() + .setTitle("Password") + .setInstruction(instruction) + .setMessage(message) + .setPassAction(e -> pass()) + .setFailAction(e -> fail()) + .setCloseAction(this::abort) + .build(); + + SwingUtilities.invokeLater(() -> { + try { + dialog.setVisible(true); + } catch (Exception e) { + throw new RuntimeException(e); + } + }); + + try { + Thread.sleep(TIMEOUT_MS); + //Timed out, so fail the test + throw new RuntimeException( + "Timed out after " + TIMEOUT_MS / 1000 + " seconds"); + } catch (final InterruptedException e) { + if (aborted) { + throw new RuntimeException("TEST ABORTED"); + } + + if (failed) { + System.out.println("TEST FAILED"); + System.out.println(message); + } else { + System.out.println("TEST PASSED"); + } + } finally { + dialog.dispose(); + } + + return failed; + } + + public void pass() { + failed = false; + currentThread.interrupt(); + } + + public void fail() { + failed = true; + currentThread.interrupt(); + } + + public void abort() { + aborted = true; + currentThread.interrupt(); + } } diff --git a/test/jdk/com/sun/tools/attach/Agent.java b/test/jdk/com/sun/tools/attach/Agent.java index 9090ea735196..510ff787fa76 100644 --- a/test/jdk/com/sun/tools/attach/Agent.java +++ b/test/jdk/com/sun/tools/attach/Agent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,7 @@ * the given port. */ import java.net.Socket; +import java.net.InetAddress; import java.net.InetSocketAddress; import java.io.IOException; @@ -38,7 +39,7 @@ public static void agentmain(String args) throws IOException { int port = Integer.parseInt(args); System.out.println("Agent connecting back to Tool...."); Socket s = new Socket(); - s.connect( new InetSocketAddress(port) ); + s.connect(new InetSocketAddress(InetAddress.getLoopbackAddress(), port)); System.out.println("Agent connected to Tool."); s.close(); } diff --git a/test/jdk/com/sun/tools/attach/BasicTests.java b/test/jdk/com/sun/tools/attach/BasicTests.java index 4dc7065630fa..9ae454368106 100644 --- a/test/jdk/com/sun/tools/attach/BasicTests.java +++ b/test/jdk/com/sun/tools/attach/BasicTests.java @@ -23,6 +23,8 @@ import java.io.File; import java.io.IOException; +import java.net.InetAddress; +import java.net.InetSocketAddress; import java.net.ServerSocket; import java.net.Socket; import java.util.List; @@ -213,7 +215,8 @@ public static void main(String args[]) throws Exception { System.out.println(" - Test: End-to-end connection with agent"); - ServerSocket ss = new ServerSocket(0); + ServerSocket ss = new ServerSocket(); + ss.bind(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0)); int port = ss.getLocalPort(); System.out.println(" - Loading Agent.jar into target VM ..."); @@ -231,7 +234,8 @@ public static void main(String args[]) throws Exception { System.out.println(" - Test: End-to-end connection with RedefineAgent"); - ServerSocket ss2 = new ServerSocket(0); + ServerSocket ss2 = new ServerSocket(); + ss2.bind(new InetSocketAddress(InetAddress.getLoopbackAddress(), 0)); int port2 = ss2.getLocalPort(); System.out.println(" - Loading RedefineAgent.jar into target VM ..."); diff --git a/test/jdk/com/sun/tools/attach/RedefineAgent.java b/test/jdk/com/sun/tools/attach/RedefineAgent.java index af01df427628..cc0e7d269df3 100644 --- a/test/jdk/com/sun/tools/attach/RedefineAgent.java +++ b/test/jdk/com/sun/tools/attach/RedefineAgent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,6 +32,7 @@ * 6446941 java.lang.instrument: multiple agent attach fails (first agent chooses capabilities) */ import java.net.Socket; +import java.net.InetAddress; import java.net.InetSocketAddress; import java.io.IOException; import java.util.Arrays; @@ -104,7 +105,7 @@ public static void agentmain(String args, Instrumentation inst) throws Exception int port = Integer.parseInt(args); System.out.println("RedefineAgent connecting back to Tool...."); Socket s = new Socket(); - s.connect( new InetSocketAddress(port) ); + s.connect(new InetSocketAddress(InetAddress.getLoopbackAddress(), port)); System.out.println("RedefineAgent connected to Tool."); testRedefine(inst); diff --git a/test/jdk/java/awt/Button/BadActionEventTest/BadActionEventTest.java b/test/jdk/java/awt/Button/BadActionEventTest/BadActionEventTest.java new file mode 100644 index 000000000000..53aac7ab7875 --- /dev/null +++ b/test/jdk/java/awt/Button/BadActionEventTest/BadActionEventTest.java @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2001, 2024, 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 4530087 + * @summary Test if double-clicking causes ActionEvent on underlying button + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual BadActionEventTest + */ + +import java.awt.Button; +import java.awt.Color; +import java.awt.FileDialog; +import java.awt.Frame; +import java.awt.GridLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +public class BadActionEventTest implements ActionListener { + private static Button showBtn; + private static Button listBtn; + + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + 1) Click on 'Show File Dialog' to bring up the FileDialog window. + (If necessary, change to a directory with files (not just directories) in it.) + 2) Move the FileDialog so that one of the file names (again, a file, NOT a directory) in the list is + directly over the 'ActionListener' button. + 3) Double-click on the file name over the button. The FileDialog will disappear. + 4) If the 'ActionListener' button receives an ActionEvent, the test fails and a + message to that effect will be printed. + Otherwise, the test passes. + """; + + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .columns(45) + .testUI(BadActionEventTest::createUI) + .logArea(2) + .build() + .awaitAndCheck(); + } + + private static Frame createUI() { + Frame frame = new Frame("BadActionEventTest"); + frame.setLayout(new GridLayout(1, 2)); + frame.setSize(400, 200); + showBtn = new Button("Show File Dialog"); + listBtn = new Button("ActionListener"); + showBtn.setSize(200, 200); + listBtn.setSize(200, 200); + showBtn.addActionListener(new BadActionEventTest()); + listBtn.addActionListener(new BadActionEventTest()); + frame.add(showBtn); + frame.add(listBtn); + return frame; + } + + @Override + public void actionPerformed(ActionEvent e) { + if (e.getSource() == showBtn) { + FileDialog fd = new FileDialog(new Frame()); + fd.setVisible(true); + } else if (e.getSource() == listBtn) { + listBtn.setBackground(Color.red); + listBtn.setLabel("TEST FAILS!"); + PassFailJFrame.log("*TEST FAILS!* ActionListener got ActionEvent! *TEST FAILS!*"); + } + } +} diff --git a/test/jdk/java/awt/Canvas/MultiDitherTest.java b/test/jdk/java/awt/Canvas/MultiDitherTest.java new file mode 100644 index 000000000000..ab592280c80b --- /dev/null +++ b/test/jdk/java/awt/Canvas/MultiDitherTest.java @@ -0,0 +1,422 @@ +/* + * Copyright (c) 1999, 2024, 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 6616089 + * @summary Displays a dithered Canvas on all available GraphicsConfigurations + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual MultiDitherTest + */ + +import java.awt.BorderLayout; +import java.awt.Button; +import java.awt.Canvas; +import java.awt.Choice; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.EventQueue; +import java.awt.FlowLayout; +import java.awt.FontMetrics; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.GraphicsConfiguration; +import java.awt.GraphicsDevice; +import java.awt.GraphicsEnvironment; +import java.awt.Image; +import java.awt.Label; +import java.awt.LayoutManager; +import java.awt.Panel; +import java.awt.TextField; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.awt.image.ColorModel; +import java.awt.image.MemoryImageSource; +import java.util.List; + +public class MultiDitherTest extends Panel implements Runnable { + final static int NOOP = 0; + final static int RED = 1; + final static int GREEN = 2; + final static int BLUE = 3; + final static int ALPHA = 4; + final static int SATURATION = 5; + final static String calcString = "Calculating..."; + static LayoutManager dcLayout = new FlowLayout(FlowLayout.CENTER, 10, 5); + Thread runner; + DitherControls XControls; + DitherControls YControls; + DitherCanvas canvas; + + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + Depending on the GraphicsConfiguration, the dithering may be in + color or in grayscale and/or display at a lower bitdepth. + The number of GraphicsConfigurations will be printed in the + TextArea below as the test is starting up. + Ensure that there are as many Frames created as there are + available GraphicsConfigurations. + Examine each Frame to ensure it displays the dither pattern. + If all Canvases display correctly, the test PASSES. + Otherwise, the test FAILS. + The GC button runs the garbage collector. + This button can be ignored for now. + + """; + PassFailJFrame passFailJFrame = PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(35) + .build(); + + EventQueue.invokeAndWait(() -> { + for (Frame frame : MultiDitherTest.initialize()) { + PassFailJFrame.addTestWindow(frame); + frame.setVisible(true); + } + }); + passFailJFrame.awaitAndCheck(); + } + + public MultiDitherTest(GraphicsConfiguration gc) { + String xSpec, ySpec; + int[] xValues = new int[2]; + int[] yValues = new int[2]; + + xSpec = "red"; + ySpec = "blue"; + int xMethod = colorMethod(xSpec, xValues); + int yMethod = colorMethod(ySpec, yValues); + + setLayout(new BorderLayout()); + XControls = new DitherControls(this, xValues[0], xValues[1], + xMethod, false); + YControls = new DitherControls(this, yValues[0], yValues[1], + yMethod, true); + YControls.addRenderButton(); + YControls.addGCButton(); + add("North", XControls); + add("South", YControls); + add("Center", canvas = new DitherCanvas(gc)); + } + + private static List initialize() { + GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); + GraphicsDevice[] gds = ge.getScreenDevices(); + Frame[] frames = new Frame[0]; + System.out.println(gds.length + " screens detected"); + + for (int j = 0; j < gds.length; j++) { + + GraphicsDevice gd = gds[j]; + GraphicsConfiguration[] gcs = gd.getConfigurations(); + frames = new Frame[gcs.length]; + System.out.println(gcs.length + " GraphicsConfigurations available on screen " + j); + for (int i = 0; i < gcs.length; i++) { + Frame f = new Frame("MultiDitherTest " + (i + 1), gcs[i]); + f.setLayout(new BorderLayout()); + f.setLocation(gcs[i].getBounds().x + 100 + (i * 10), + gcs[i].getBounds().y + 100 + (i * 10)); + MultiDitherTest ditherTest = new MultiDitherTest(gcs[i]); + f.add("Center", ditherTest); + f.pack(); + f.addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent ev) { + ev.getWindow().dispose(); + } + }); + f.setVisible(true); + ditherTest.start(); + frames[i] = f; + } + + } + return List.of(frames); + } + + int colorMethod(String s, int[] values) { + int method = NOOP; + + if (s == null) { + s = ""; + } + + String lower = s.toLowerCase(); + if (lower.startsWith("red")) { + method = RED; + lower = lower.substring(3); + } else if (lower.startsWith("green")) { + method = GREEN; + lower = lower.substring(5); + } else if (lower.startsWith("blue")) { + method = BLUE; + lower = lower.substring(4); + } else if (lower.startsWith("alpha")) { + method = ALPHA; + lower = lower.substring(4); + } else if (lower.startsWith("saturation")) { + method = SATURATION; + lower = lower.substring(10); + } + + if (method == NOOP) { + values[0] = 0; + values[1] = 0; + return method; + } + + int begval = 0; + int endval = 255; + + try { + int dash = lower.indexOf('-'); + if (dash < 0) { + begval = endval = Integer.parseInt(lower); + } else { + begval = Integer.parseInt(lower.substring(0, dash)); + endval = Integer.parseInt(lower.substring(dash + 1)); + } + } catch (Exception e) { + } + + if (begval < 0) { + begval = 0; + } + if (endval < 0) { + endval = 0; + } + if (begval > 255) { + begval = 255; + } + if (endval > 255) { + endval = 255; + } + + values[0] = begval; + values[1] = endval; + + return method; + } + + public void start() { + runner = new Thread(this); + runner.start(); + } + + public void stop() { + runner = null; + } + + public void destroy() { + remove(XControls); + remove(YControls); + remove(canvas); + } + + void applyMethod(int[] c, int method, int step, int total, int[] values) { + if (method == NOOP) { + return; + } + int val = ((total < 2) + ? values[0] + : values[0] + ((values[1] - values[0]) * step / (total - 1))); + switch (method) { + case RED: + c[0] = val; + break; + case GREEN: + c[1] = val; + break; + case BLUE: + c[2] = val; + break; + case ALPHA: + c[3] = val; + break; + case SATURATION: + int max = Math.max(Math.max(c[0], c[1]), c[2]); + int min = max * (255 - val) / 255; + if (c[0] == 0) c[0] = min; + if (c[1] == 0) c[1] = min; + if (c[2] == 0) c[2] = min; + break; + } + } + + public void run() { + canvas.setImage(null); + Image img = calculateImage(); + synchronized (this) { + if (img != null && runner == Thread.currentThread()) { + canvas.setImage(img); + } + } + } + + /** + * Calculates and returns the image. Halts the calculation and returns + * null if the Application is stopped during the calculation. + */ + Image calculateImage() { + Thread me = Thread.currentThread(); + + int width = canvas.getSize().width; + int height = canvas.getSize().height; + int[] xValues = new int[2]; + int[] yValues = new int[2]; + int xMethod = XControls.getParams(xValues); + int yMethod = YControls.getParams(yValues); + int[] pixels = new int[width * height]; + int[] c = new int[4]; + int index = 0; + + for (int j = 0; j < height; j++) { + for (int i = 0; i < width; i++) { + c[0] = c[1] = c[2] = 0; + c[3] = 255; + if (xMethod < yMethod) { + applyMethod(c, xMethod, i, width, xValues); + applyMethod(c, yMethod, j, height, yValues); + } else { + applyMethod(c, yMethod, j, height, yValues); + applyMethod(c, xMethod, i, width, xValues); + } + pixels[index++] = ((c[3] << 24) | + (c[0] << 16) | + (c[1] << 8) | + (c[2] << 0)); + } + // Poll once per row to see if we've been told to stop. + if (runner != me) { + return null; + } + } + + return createImage(new MemoryImageSource(width, height, + ColorModel.getRGBdefault(), pixels, 0, width)); + } + + static class DitherCanvas extends Canvas { + Image img; + GraphicsConfiguration mGC; + + public DitherCanvas(GraphicsConfiguration gc) { + super(gc); + mGC = gc; + } + + public GraphicsConfiguration getGraphicsConfig() { + return mGC; + } + + public void paint(Graphics g) { + int w = getSize().width; + int h = getSize().height; + if (img == null) { + super.paint(g); + g.setColor(Color.black); + FontMetrics fm = g.getFontMetrics(); + int x = (w - fm.stringWidth(calcString)) / 2; + int y = h / 2; + g.drawString(calcString, x, y); + } else { + g.drawImage(img, 0, 0, w, h, this); + } + } + + public void update(Graphics g) { + paint(g); + } + + public Dimension getMinimumSize() { + return new Dimension(20, 20); + } + + public Dimension getPreferredSize() { + return new Dimension(200, 200); + } + + public Image getImage() { + return img; + } + + public void setImage(Image img) { + this.img = img; + paint(getGraphics()); + } + } + + static class DitherControls extends Panel implements ActionListener { + TextField start; + TextField end; + Button button; + Choice choice; + MultiDitherTest panel; + Button gc; + + public DitherControls(MultiDitherTest app, int s, int e, int type, + boolean vertical) { + panel = app; + setLayout(dcLayout); + add(new Label(vertical ? "Vertical" : "Horizontal")); + add(choice = new Choice()); + choice.addItem("Noop"); + choice.addItem("Red"); + choice.addItem("Green"); + choice.addItem("Blue"); + choice.addItem("Alpha"); + choice.addItem("Saturation"); + choice.select(type); + add(start = new TextField(Integer.toString(s), 4)); + add(end = new TextField(Integer.toString(e), 4)); + } + + public void addRenderButton() { + add(button = new Button("New Image")); + button.addActionListener(this); + } + + public void addGCButton() { + add(gc = new Button("GC")); + gc.addActionListener(this); + } + + public int getParams(int[] values) { + values[0] = Integer.parseInt(start.getText()); + values[1] = Integer.parseInt(end.getText()); + return choice.getSelectedIndex(); + } + + public void actionPerformed(ActionEvent e) { + if (e.getSource() == button) { + panel.start(); + } else if (e.getSource() == gc) { + System.gc(); + } + } + } +} \ No newline at end of file diff --git a/test/jdk/java/awt/Canvas/MultiGraphicsTest.java b/test/jdk/java/awt/Canvas/MultiGraphicsTest.java new file mode 100644 index 000000000000..c38d6041c2b7 --- /dev/null +++ b/test/jdk/java/awt/Canvas/MultiGraphicsTest.java @@ -0,0 +1,139 @@ +/* + * Copyright (c) 1999, 2024, 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 6616089 + * @summary Display an image in all available GraphicsConfigurations + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual MultiGraphicsTest + */ + +import java.awt.BorderLayout; +import java.awt.Canvas; +import java.awt.Dimension; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.GraphicsConfiguration; +import java.awt.GraphicsDevice; +import java.awt.GraphicsEnvironment; +import java.awt.Image; +import java.awt.MediaTracker; +import java.awt.Toolkit; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.net.URL; +import java.util.List; + +public class MultiGraphicsTest extends Canvas { + final static String IMAGEFILE = "duke_404.gif"; + static Image jim; + MediaTracker tracker; + int w, h; + + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + This test displays several Windows containing an image, + one Window for each available GraphicsConfiguration. + Depending on the GraphicsConfiguration, images may be + displayed in color or in grayscale and/or displayed at a + lower bitdepth. + The number of GraphicsConfigurations will be printed below + as the test is starting up. + Ensure that there are as many Windows created as there are + available GraphicsConfigurations. + Examine each Window to ensure it displays Duke_404. + If all Canvases display correctly, the test PASSES. + Otherwise, the test FAILS." + """; + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(35) + .testUI(initialize()) + .build() + .awaitAndCheck(); + } + + public MultiGraphicsTest(GraphicsConfiguration gc) { + super(gc); + tracker = new MediaTracker(this); + tracker.addImage(jim, 0); + try { + tracker.waitForAll(); + } catch (java.lang.InterruptedException e) { + System.err.println(e); + } + w = jim.getWidth(this); + h = jim.getHeight(this); + } + + private static List initialize() { + URL imgURL; + imgURL = MultiGraphicsTest.class.getResource(IMAGEFILE); + if (imgURL == null) { + System.err.println("Unable to locate " + IMAGEFILE); + return null; + } + jim = Toolkit.getDefaultToolkit().getImage(imgURL); + + GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); + GraphicsDevice gd = ge.getDefaultScreenDevice(); + GraphicsConfiguration[] gc = gd.getConfigurations(); + Frame[] frames = new Frame[gc.length]; + System.out.println(gc.length + " available GraphicsConfigurations"); + for (int i = 0; i < gc.length; i++) { + Frame f = new Frame("GraphicsTest " + (i + 1)); + f.setLayout(new BorderLayout()); + f.setLocation(100 + (i * 10), 100 + (i * 10)); + MultiGraphicsTest gcTest = new MultiGraphicsTest(gc[i]); + f.add("Center", gcTest); + f.pack(); + f.addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent ev) { + ev.getWindow().setVisible(false); + } + }); + frames[i] = f; + } + return List.of(frames); + } + + public void paint(Graphics g) { + g.drawImage(jim, 0, 0, w, h, this); + } + + public void update(Graphics g) { + paint(g); + } + + public Dimension getMinimumSize() { + return new Dimension(w, h); + } + + public Dimension getPreferredSize() { + return new Dimension(w, h); + } +} diff --git a/test/jdk/java/awt/Canvas/NoEventsLeakTest.java b/test/jdk/java/awt/Canvas/NoEventsLeakTest.java new file mode 100644 index 000000000000..4768775224a5 --- /dev/null +++ b/test/jdk/java/awt/Canvas/NoEventsLeakTest.java @@ -0,0 +1,96 @@ +/* + * Copyright (c) 1999, 2024, 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 4250354 + * @key headful + * @summary tests that JNI global refs are cleaned up correctly + * @run main/timeout=600 NoEventsLeakTest + */ + +import java.awt.Canvas; +import java.awt.EventQueue; +import java.awt.Frame; + +public class NoEventsLeakTest extends Frame { + static final int nLoopCount = 1000; + + private static void initialize() { + NoEventsLeakTest app = new NoEventsLeakTest(); + boolean result = app.run(); + if (result) { + throw new RuntimeException("Memory leak in Component"); + } + System.out.println("Test Passed"); + } + + public boolean run() { + setSize(10, 10); + addNotify(); + for (int i = 0; i < nLoopCount; i++) { + Canvas panel = new TestCanvas(); + add(panel, 0); + remove(0); + panel = null; + System.gc(); + } + try { + Thread.currentThread().sleep(1000); + } catch (InterruptedException e) { + } + System.gc(); + System.out.println("Checking"); + return ((TestCanvas.created - TestCanvas.finalized) > 800); + } + + public static void main(String[] args) throws Exception { + EventQueue.invokeAndWait(NoEventsLeakTest::initialize); + } +} + +class TestCanvas extends Canvas { + static int finalized = 0; + static int created = 0; + static final int nLoopPrint = 100; + + public TestCanvas() { + if (created % nLoopPrint == 0) { + System.out.println("Created " + getClass() + " " + created); + } + created++; + } + + @SuppressWarnings("removal") + protected void finalize() { + try { + super.finalize(); + if (finalized % nLoopPrint == 0) { + System.out.println("Finalized " + getClass() + " " + finalized); + } + finalized++; + } catch (Throwable t) { + System.out.println("Exception in " + getClass() + ": " + t); + } + } +} diff --git a/test/jdk/java/awt/Canvas/duke_404.gif b/test/jdk/java/awt/Canvas/duke_404.gif new file mode 100644 index 000000000000..4958e0d0dfa8 Binary files /dev/null and b/test/jdk/java/awt/Canvas/duke_404.gif differ diff --git a/test/jdk/java/awt/CardLayout/RemoveComponentTest/RemoveComponentTest.java b/test/jdk/java/awt/CardLayout/RemoveComponentTest/RemoveComponentTest.java new file mode 100644 index 000000000000..0a23a9895330 --- /dev/null +++ b/test/jdk/java/awt/CardLayout/RemoveComponentTest/RemoveComponentTest.java @@ -0,0 +1,166 @@ +/* + * Copyright (c) 2002, 2024, 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 4546123 + * @summary CardLayout becomes unusable after deleting an element + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual RemoveComponentTest + */ + +import java.awt.BorderLayout; +import java.awt.CardLayout; +import java.awt.Color; +import java.awt.Frame; +import java.awt.Insets; +import java.awt.Menu; +import java.awt.MenuBar; +import java.awt.MenuItem; +import java.awt.Panel; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +import javax.swing.JLabel; +import javax.swing.JPanel; + +public class RemoveComponentTest { + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + You should see a frame titled "Test Frame For + RemoveComponentTest". Try to select a few different panels from + the second menu. Make sure your last choice is the red panel. + Then click close (in first menu). After that you should be able + to select any panels except red one. + If that is the case, the test passes. Otherwise, the test failed. + """; + + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .columns(35) + .testUI(RemoveComponentTest::createUI) + .logArea(5) + .build() + .awaitAndCheck(); + } + + public static Frame createUI() { + TestFrame frame = new TestFrame(); + frame.setSize(200, 200); + return frame; + } +} + +class TestFrame extends Frame implements ActionListener { + public Panel aPanel; + public TestPanel pageRed; + public TestPanel pageGreen; + public TestPanel pageBlue; + public String currentSelection = ""; + + public MenuItem mi; + public CardLayout theCardLayout; + + + public TestFrame() { + super("Test Frame For RemoveComponentTest"); + + setBackground(Color.black); + setLayout(new BorderLayout(5, 5)); + + MenuBar mb = new MenuBar(); + + Menu fileMenu = new Menu("File"); + Menu pageMenu = new Menu("Pages"); + + mi = new MenuItem("Close"); + mi.addActionListener(this); + fileMenu.add(mi); + + mi = new MenuItem("Red"); + mi.addActionListener(this); + pageMenu.add(mi); + + mi = new MenuItem("Green"); + mi.addActionListener(this); + pageMenu.add(mi); + + mi = new MenuItem("Blue"); + mi.addActionListener(this); + pageMenu.add(mi); + + mb.add(fileMenu); + mb.add(pageMenu); + + setMenuBar(mb); + + aPanel = new Panel(); + theCardLayout = new CardLayout(); + + aPanel.setLayout(theCardLayout); + + pageRed = new TestPanel("PageRed", Color.red); + pageGreen = new TestPanel("PageGreen", Color.green); + pageBlue = new TestPanel("PageBlue", Color.blue); + + aPanel.add("PageRed", pageRed); + aPanel.add("PageGreen", pageGreen); + aPanel.add("PageBlue", pageBlue); + + add("Center", aPanel); + setSize(getPreferredSize()); + } + + public Insets getInsets() { + return new Insets(47, 9, 9, 9); + } + + public void actionPerformed(ActionEvent e) { + if (e.getActionCommand().equals("Red")) { + theCardLayout.show(aPanel, "PageRed"); + currentSelection = "PageRed"; + } else if (e.getActionCommand().equals("Green")) { + theCardLayout.show(aPanel, "PageGreen"); + } else if (e.getActionCommand().equals("Blue")) { + theCardLayout.show(aPanel, "PageBlue"); + } else if (e.getActionCommand().equals("Close")) { + PassFailJFrame.log("Closing"); + + if (currentSelection.equals("PageRed")) { + PassFailJFrame.log("Remove page red"); + theCardLayout.removeLayoutComponent(pageRed); + } + } + } +} + +class TestPanel extends JPanel { + private String pageName; + + TestPanel(String pageName, Color color) { + setBackground(color); + add(new JLabel(pageName)); + } +} diff --git a/test/jdk/java/awt/Checkbox/CheckboxBoxSizeTest.java b/test/jdk/java/awt/Checkbox/CheckboxBoxSizeTest.java new file mode 100644 index 000000000000..0d500e5daa16 --- /dev/null +++ b/test/jdk/java/awt/Checkbox/CheckboxBoxSizeTest.java @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Checkbox; +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.Panel; + +/* + * @test + * @bug 4410522 + * @requires (os.family == "windows") + * @summary The box size of the Checkbox control should be the same as + * in Windows native applications. + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual CheckboxBoxSizeTest + */ + +public class CheckboxBoxSizeTest { + private static final String INSTRUCTIONS = """ + This test must be run at UI Scale of 100% AND + 150% or greater. + Compare the size of box to any of native apps on Windows + (Eg. Font Dialog Settings on Word). + They should be the same. + + If the sizes are same Press PASS, else Press FAIL. + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("CheckboxBoxSizeTest Instructions") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(35) + .testUI(CheckboxBoxSizeTest::createTestUI) + .build() + .awaitAndCheck(); + } + + private static Frame createTestUI() { + Frame frame = new Frame("CheckboxBoxSizeTest"); + Panel panel = new Panel(new FlowLayout()); + Checkbox checkbox = new Checkbox("Compare the box size"); + panel.add(checkbox); + frame.add(panel); + frame.pack(); + return frame; + } +} diff --git a/test/jdk/java/awt/Checkbox/CheckboxIndicatorSizeTest.java b/test/jdk/java/awt/Checkbox/CheckboxIndicatorSizeTest.java new file mode 100644 index 000000000000..3456e7e040d1 --- /dev/null +++ b/test/jdk/java/awt/Checkbox/CheckboxIndicatorSizeTest.java @@ -0,0 +1,168 @@ +/* + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Checkbox; +import java.awt.CheckboxGroup; +import java.awt.Color; +import java.awt.Font; +import java.awt.Frame; +import java.awt.GridLayout; +import java.awt.Label; +import java.awt.Menu; +import java.awt.MenuBar; +import java.awt.MenuItem; +import java.awt.Panel; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +/* + * @test + * @bug 4090493 + * @summary Test for Checkbox indicator size + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual CheckboxIndicatorSizeTest + */ + +public class CheckboxIndicatorSizeTest implements ActionListener { + private static final String INSTRUCTIONS = """ + Indicator size of Checkbox depends + on the platform font used to render the label. + + In the frame you can see a group of checkboxes + and radio buttons. + Verify that all checkboxes and radio buttons have + indicators of the same size and proportional to + the uiScale and/or font-size. + + Use menu to change the font size and the indicators + should scale proportionally. + + If there is a bug, the checkbox/radiobutton with + dingbats label will have a smaller indicator. + + Press PASS if the above conditions are true else Press FAIL. + """; + private static Frame frame; + private static Panel testPanel; + + public static void main(String[] args) throws Exception { + + CheckboxIndicatorSizeTest obj = new CheckboxIndicatorSizeTest(); + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 3) + .columns(60) + .testUI(obj::createAndShowUI) + .build() + .awaitAndCheck(); + } + + private Frame createAndShowUI() { + frame = new Frame("CheckboxIndicatorSizeTest"); + + testPanel = new Panel(new GridLayout(0, 1)); + testPanel.setFont(new Font("Dialog", Font.PLAIN, 12)); + frame.add(testPanel); + + MenuBar menuBar = new MenuBar(); + Menu fontSizeMenu = new Menu("FontSize"); + + MenuItem size10 = new MenuItem("10"); + size10.addActionListener(this); + fontSizeMenu.add(size10); + + MenuItem size12 = new MenuItem("12"); + size12.addActionListener(this); + fontSizeMenu.add(size12); + + MenuItem size14 = new MenuItem("14"); + size14.addActionListener(this); + fontSizeMenu.add(size14); + + MenuItem size18 = new MenuItem("18"); + size18.addActionListener(this); + fontSizeMenu.add(size18); + + MenuItem size24 = new MenuItem("24"); + size24.addActionListener(this); + fontSizeMenu.add(size24); + + MenuItem size36 = new MenuItem("36"); + size36.addActionListener(this); + fontSizeMenu.add(size36); + + menuBar.add(fontSizeMenu); + frame.setMenuBar(menuBar); + + Checkbox cbEnglishOnly + = new Checkbox("Toggle", true); + Checkbox cbDingbatsOnly + = new Checkbox("\u274a\u274b\u274c\u274d", true); + Checkbox cbEnglishDingbats + = new Checkbox("Toggle \u274a\u274d", true); + Checkbox cbDingbatsEnglish + = new Checkbox("\u274a\u274d toggle", true); + + CheckboxGroup radioGroup = new CheckboxGroup(); + Checkbox rbEnglishOnly + = new Checkbox("Radio", true, radioGroup); + Checkbox rbDingbatsOnly + = new Checkbox("\u274a\u274b\u274c\u274d", false, radioGroup); + Checkbox rbEnglishDingbats + = new Checkbox("Radio \u274a\u274d", false, radioGroup); + Checkbox rbDingbatsEnglish + = new Checkbox("\u274a\u274d radio", false, radioGroup); + + Label cbLabel = new Label("Checkboxes"); + cbLabel.setBackground(Color.YELLOW); + testPanel.add(cbLabel); + testPanel.add(cbEnglishOnly); + testPanel.add(cbDingbatsOnly); + testPanel.add(cbEnglishDingbats); + testPanel.add(cbDingbatsEnglish); + + Label rbLabel = new Label("Radio buttons"); + rbLabel.setBackground(Color.YELLOW); + testPanel.add(rbLabel); + testPanel.add(rbEnglishOnly); + testPanel.add(rbDingbatsOnly); + testPanel.add(rbEnglishDingbats); + testPanel.add(rbDingbatsEnglish); + + frame.pack(); + return frame; + } + + @Override + public void actionPerformed(ActionEvent e) { + String sizeStr = e.getActionCommand(); + int size = Integer.parseInt(sizeStr); + Font oldFont = testPanel.getFont(); + Font newFont = new Font(oldFont.getName(), oldFont.getStyle(), size); + testPanel.setFont(newFont); + frame.pack(); + frame.setVisible(true); + } +} diff --git a/test/jdk/java/awt/Checkbox/CheckboxNullLabelTest.java b/test/jdk/java/awt/Checkbox/CheckboxNullLabelTest.java new file mode 100644 index 000000000000..c5cb7c278297 --- /dev/null +++ b/test/jdk/java/awt/Checkbox/CheckboxNullLabelTest.java @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2012, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.BorderLayout; +import java.awt.Checkbox; +import java.awt.CheckboxGroup; +import java.awt.Color; +import java.awt.Font; +import java.awt.Frame; +import java.awt.Panel; + +/* + * @test + * @bug 4383735 + * @summary Checkbox buttons are too small with java 1.3 and 1.4 + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual CheckboxNullLabelTest + */ + +public class CheckboxNullLabelTest { + private static final String INSTRUCTIONS = """ + Please look at the frame titled 'CheckboxNullLabelTest'. + Check if all the check boxes in each group + (of 3 check boxes) have the same size. + + If the size of labeled check box is NOT the same as + the size of non-labeled Press FAIL otherwise Press PASS. + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 1) + .columns(35) + .testUI(CheckboxNullLabelTest::createAndShowUI) + .build() + .awaitAndCheck(); + } + + private static Frame createAndShowUI() { + Frame f = new Frame("CheckboxNullLabelTest"); + f.setLayout(new BorderLayout()); + f.add(new CheckboxTest(Color.gray, new Font(null, 0, 12)), "North"); + f.add(new CheckboxTest(Color.green, new Font(null, 0, 18)), "South"); + f.add(new CheckboxTest(Color.red, new Font(null, 0, 24)), "East"); + f.add(new CheckboxTest(Color.white, new Font(null, 0, 30)), "West"); + f.add(new CheckboxTest(f.getBackground(), new Font(null, 0, 36)), "Center"); + f.setSize(600, 450); + return f; + } + + private static class CheckboxTest extends Panel { + Checkbox cb1, cb2, cb3; + + CheckboxTest(Color background, Font font) { + setBackground(background); + CheckboxGroup cbg = new CheckboxGroup(); + + cb1 = new Checkbox(null, cbg, true); + cb1.setFont(font); + + cb2 = new Checkbox("", cbg, true); + cb2.setFont(font); + + cb3 = new Checkbox("Label", cbg, false); + cb3.setFont(font); + + add(cb1); + add(cb2); + add(cb3); + } + } +} diff --git a/test/jdk/java/awt/Checkbox/CheckboxPreferredSizeTest.java b/test/jdk/java/awt/Checkbox/CheckboxPreferredSizeTest.java new file mode 100644 index 000000000000..dd61b52aaedb --- /dev/null +++ b/test/jdk/java/awt/Checkbox/CheckboxPreferredSizeTest.java @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Checkbox; +import java.awt.Color; +import java.awt.Font; +import java.awt.Frame; + +/* + * @test + * @bug 4304049 + * @summary tests that Checkbox fits into its preferred size entirely + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual CheckboxPreferredSizeTest + */ + +public class CheckboxPreferredSizeTest { + private static final String INSTRUCTIONS = """ + As the test starts, ensure that the + whole checkbox with all its text is visible. + If the checkbox is entirely visible, press PASS else, + press FAIL. + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 1) + .columns(35) + .testUI(CheckboxPreferredSizeTest::createAndShowUI) + .build() + .awaitAndCheck(); + } + + private static Frame createAndShowUI() { + Frame frame = new Frame("Checkbox Preferred Size Test"); + frame.setBackground(Color.BLUE); + Checkbox box = new Checkbox("Checkbox_With_Some_Size"); + box.setFont(new Font("Helvetica", Font.PLAIN, 36)); + box.setBackground(Color.RED); + frame.add(box); + frame.pack(); + return frame; + } +} diff --git a/test/jdk/java/awt/Checkbox/DynamicChangeTest/DynamicChangeTest.java b/test/jdk/java/awt/Checkbox/DynamicChangeTest/DynamicChangeTest.java new file mode 100644 index 000000000000..b62255efa458 --- /dev/null +++ b/test/jdk/java/awt/Checkbox/DynamicChangeTest/DynamicChangeTest.java @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2005, 2024, 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 6225679 + * @summary Tests that checkbox changes into radiobutton dynamically + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual DynamicChangeTest + */ + +import java.awt.Checkbox; +import java.awt.CheckboxGroup; +import java.awt.Frame; +import java.awt.GridLayout; + +public class DynamicChangeTest { + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + This test is primarily for Windows platform, but should pass + on other platforms as well. Ensure that 'This is checkbox' is + checkbox, and 'This is radiobutton' is radiobutton. + If it is so, press pass else fail. + """; + + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(35) + .testUI(DynamicChangeTest::createUI) + .build() + .awaitAndCheck(); + } + + public static Frame createUI() { + Frame f = new Frame("Dynamic Change Checkbox Test"); + f.setSize(200, 200); + + f.setLayout(new GridLayout(2, 1)); + Checkbox ch1 = new Checkbox("This is checkbox", + new CheckboxGroup(), true); + f.add(ch1); + Checkbox ch2 = new Checkbox("This is radiobutton", null, true); + f.add(ch2); + + ch1.setCheckboxGroup(null); + ch2.setCheckboxGroup(new CheckboxGroup()); + return f; + } +} diff --git a/test/jdk/java/awt/Choice/CheckChoiceTest.java b/test/jdk/java/awt/Choice/CheckChoiceTest.java new file mode 100644 index 000000000000..3e2e06b1c955 --- /dev/null +++ b/test/jdk/java/awt/Choice/CheckChoiceTest.java @@ -0,0 +1,92 @@ +/* + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.BorderLayout; +import java.awt.Choice; +import java.awt.Frame; +import javax.swing.JComponent; +import javax.swing.JPanel; +import javax.swing.SwingUtilities; + +/* + * @test + * @bug 4151949 + * @summary Verifies that Components are reshaped to their preferred size + * when their Container is packed. + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual CheckChoiceTest + */ + +public class CheckChoiceTest { + + private static JComponent componentToFocus; + + private static final String INSTRUCTIONS = """ + Verify that the widths of the Choice components are all the same + and that none is the minimum possible size. + (The Choices should be at least as wide as the Frame.) + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame passFailJFrame = PassFailJFrame.builder() + .title("CheckChoiceTest Instructions") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 3) + .columns(45) + .testUI(CheckChoiceTest::createAndShowUI) + .splitUIBottom(CheckChoiceTest::createComponentToFocus) + .build(); + + // focus away from the window with choices + Thread.sleep(300); + SwingUtilities.invokeAndWait(() -> componentToFocus.requestFocus()); + + passFailJFrame.awaitAndCheck(); + } + + private static JComponent createComponentToFocus() { + componentToFocus = new JPanel(); + return componentToFocus; + } + + private static Frame createAndShowUI() { + Frame f = new Frame("Check Choice"); + f.setLayout(new BorderLayout()); + + Choice choice1 = new Choice(); + Choice choice2 = new Choice(); + Choice choice3 = new Choice(); + + f.add(choice1, BorderLayout.NORTH); + f.add(choice3, BorderLayout.CENTER); + f.add(choice2, BorderLayout.SOUTH); + f.pack(); + + choice1.add("I am Choice, yes I am : 0"); + choice2.add("I am the same, yes I am : 0"); + choice3.add("I am the same, yes I am : 0"); + + return f; + } +} diff --git a/test/jdk/java/awt/Choice/ChoiceBigTest.java b/test/jdk/java/awt/Choice/ChoiceBigTest.java new file mode 100644 index 000000000000..be82ed2a40db --- /dev/null +++ b/test/jdk/java/awt/Choice/ChoiceBigTest.java @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Choice; +import java.awt.Frame; +import java.awt.FlowLayout; +import java.awt.Window; + +/* + * @test + * @bug 4288285 + * @summary Verifies choice works with many items + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual ChoiceBigTest + */ + +public class ChoiceBigTest { + private static final String INSTRUCTIONS = """ + Click the Choice button, press Pass if: + + - all looks good. + - if you can select the item 1000 + + Otherwise press Fail. + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("ChoiceBigTest Instructions") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 3) + .columns(45) + .testUI(ChoiceBigTest::createAndShowUI) + .build() + .awaitAndCheck(); + } + + private static Window createAndShowUI() { + Frame frame = new Frame("Check Choice"); + frame.setLayout(new FlowLayout()); + Choice choice = new Choice(); + frame.setSize(400, 200); + for (int i = 1; i < 1001; ++i) { + choice.add("I am Choice, yes I am : " + i); + } + frame.add(choice); + return frame; + } +} diff --git a/test/jdk/java/awt/Choice/ChoiceDragEventsInside.java b/test/jdk/java/awt/Choice/ChoiceDragEventsInside.java new file mode 100644 index 000000000000..dde773f19289 --- /dev/null +++ b/test/jdk/java/awt/Choice/ChoiceDragEventsInside.java @@ -0,0 +1,210 @@ +/* + * Copyright (c) 2000, 2024, 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 6251983 6722236 + * @summary MouseDragged events not triggered for Choice when dragging it with left mouse button + * @key headful + * @run main ChoiceDragEventsInside + */ + +import java.awt.Choice; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.EventQueue; +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.Point; +import java.awt.Robot; +import java.awt.event.InputEvent; +import java.awt.event.KeyEvent; +import java.awt.event.MouseEvent; +import java.awt.event.MouseMotionAdapter; +import java.lang.reflect.InvocationTargetException; + +public class ChoiceDragEventsInside extends Frame { + Robot robot; + Choice choice1; + Point pt; + Dimension size; + volatile boolean mouseDragged = false; + volatile boolean mouseDraggedOutside = false; + + public void setupUI() { + setTitle("Choce Drag Events Inside"); + choice1 = new Choice(); + for (int i = 1; i < 50; i++) { + choice1.add("item-0" + i); + } + choice1.setForeground(Color.red); + choice1.setBackground(Color.red); + choice1.addMouseMotionListener(new MouseMotionAdapter() { + public void mouseMoved(MouseEvent me) { + System.out.println(me); + } + + public void mouseDragged(MouseEvent me) { + System.out.println(me); + mouseDragged = true; + if (me.getY() < 0) { + mouseDraggedOutside = true; + } + } + } + ); + add(choice1); + setLayout(new FlowLayout()); + setSize(200, 200); + setLocationRelativeTo(null); + setVisible(true); + validate(); + } + + public void start() { + try { + robot = new Robot(); + robot.setAutoWaitForIdle(true); + robot.setAutoDelay(50); + robot.delay(100); + EventQueue.invokeAndWait(() -> { + pt = choice1.getLocationOnScreen(); + size = choice1.getSize(); + }); + testDragInsideChoice(InputEvent.BUTTON1_MASK); + testDragInsideChoiceList(InputEvent.BUTTON1_MASK); + testDragOutsideChoice(InputEvent.BUTTON1_MASK); + } catch (Throwable e) { + throw new RuntimeException("Test failed. Exception thrown: " + e); + } + } + + public void testDragInsideChoice(int button) { + robot.mouseMove(pt.x + size.width / 2, pt.y + size.height / 2); + robot.delay(100); + robot.mousePress(button); + robot.mouseRelease(button); + robot.delay(200); + robot.mousePress(button); + robot.mouseRelease(button); + robot.delay(200); + + //close opened choice + robot.keyPress(KeyEvent.VK_ESCAPE); + robot.keyRelease(KeyEvent.VK_ESCAPE); + robot.delay(200); + + robot.mouseMove(pt.x + size.width / 4, pt.y + size.height / 2); + robot.mousePress(button); + + dragMouse(pt.x + size.width / 4, pt.y + size.height / 2, + pt.x + size.width * 3 / 4, pt.y + size.height / 2); + robot.mouseRelease(button); + robot.delay(200); + if (!mouseDragged) { + throw new RuntimeException("Test failed. Choice should generate MouseDragged events inside Choice itself"); + } else { + System.out.println("Stage 1 passed. Choice generates MouseDragged events inside Choice itself"); + } + mouseDragged = false; + //close opened choice + robot.keyPress(KeyEvent.VK_ESCAPE); + robot.keyRelease(KeyEvent.VK_ESCAPE); + robot.delay(200); + } + + public void testDragInsideChoiceList(int button) { + robot.mouseMove(pt.x + size.width / 2, pt.y + size.height / 2); + robot.delay(100); + robot.mousePress(button); + robot.mouseRelease(button); + robot.delay(200); + + robot.mouseMove(pt.x + size.width / 2, pt.y + 5 * size.height); + robot.delay(200); + robot.mousePress(button); + + dragMouse(pt.x + size.width / 2, pt.y + 5 * size.height, + pt.x + size.width / 2, pt.y + 8 * size.height); + robot.mouseRelease(button); + robot.delay(200); + if (mouseDragged) { + throw new RuntimeException("Test failed. Choice shouldn't generate MouseDragged events inside Choice's list"); + } else { + System.out.println("Stage 2 passed. Choice doesn't generate MouseDragged events inside Choice's list"); + } + robot.keyPress(KeyEvent.VK_ESCAPE); + robot.keyRelease(KeyEvent.VK_ESCAPE); + robot.delay(200); + mouseDragged = false; + } + + public void testDragOutsideChoice(int button) { + pt = choice1.getLocationOnScreen(); + robot.mouseMove(pt.x + size.width / 2, pt.y + size.height / 2); + robot.delay(100); + + robot.mousePress(button); + //drag mouse outside of Choice + dragMouse(pt.x + size.width / 2, pt.y + size.height / 2, + pt.x + size.width / 2, pt.y - 3 * size.height); + robot.mouseRelease(button); + robot.delay(200); + if (!mouseDragged || !mouseDraggedOutside) { + throw new RuntimeException("Test failed. Choice should generate MouseDragged events outside Choice"); + } else { + System.out.println("Stage 3 passed. Choice generates MouseDragged events outside Choice"); + } + robot.keyPress(KeyEvent.VK_ESCAPE); + robot.keyRelease(KeyEvent.VK_ESCAPE); + robot.delay(200); + mouseDragged = false; + } + + public void dragMouse(int x0, int y0, int x1, int y1) { + int curX = x0; + int curY = y0; + int dx = x0 < x1 ? 1 : -1; + int dy = y0 < y1 ? 1 : -1; + + while (curX != x1) { + curX += dx; + robot.mouseMove(curX, curY); + } + while (curY != y1) { + curY += dy; + robot.mouseMove(curX, curY); + } + } + + public static void main(final String[] args) throws InterruptedException, + InvocationTargetException { + ChoiceDragEventsInside app = new ChoiceDragEventsInside(); + try { + EventQueue.invokeAndWait(app::setupUI); + app.start(); + } finally { + EventQueue.invokeAndWait(app::dispose); + } + } +} diff --git a/test/jdk/java/awt/Choice/ChoiceFocusTest.java b/test/jdk/java/awt/Choice/ChoiceFocusTest.java new file mode 100644 index 000000000000..3ca895f88e6e --- /dev/null +++ b/test/jdk/java/awt/Choice/ChoiceFocusTest.java @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Button; +import java.awt.Choice; +import java.awt.Frame; +import java.awt.Panel; +import java.awt.Window; + +/* + * @test + * @bug 4927930 + * @summary Verify that the focus is set to the selected item after calling the java.awt.Choice.select() method + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual ChoiceFocusTest + */ + +public class ChoiceFocusTest { + + private static final String INSTRUCTIONS = """ + 1. Use the mouse to select Item 5 in the Choice list. + 2. Click on the Choice. Item5 is now selected and highlighted. This is the correct behavior. + 3. Select Item 1 in the Choice list. + 4. Click the "choice.select(5)" button. This causes a call to Choice.select(5). Item 5 is now selected. + 5. Click on the Choice. + 6. If the cursor and focus are on item 5, the test passes. Otherwise, it fails. + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("ChoiceFocusTest Instructions") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 3) + .columns(50) + .testUI(ChoiceFocusTest::createAndShowUI) + .build() + .awaitAndCheck(); + } + + private static Window createAndShowUI() { + Panel panel = new Panel(); + Choice choice = new Choice(); + Button button = new Button("choice.select(5);"); + + for (int i = 0; i < 10; i++) { + choice.add(String.valueOf(i)); + } + + button.addActionListener(e -> choice.select(5)); + + panel.add(button); + panel.add(choice); + + Frame frame = new Frame("ChoiceFocusTest"); + frame.add(panel); + frame.pack(); + + return frame; + } +} diff --git a/test/jdk/java/awt/Choice/ChoiceInLWTest/ChoiceInLWTest.java b/test/jdk/java/awt/Choice/ChoiceInLWTest/ChoiceInLWTest.java new file mode 100644 index 000000000000..9d1ad1954918 --- /dev/null +++ b/test/jdk/java/awt/Choice/ChoiceInLWTest/ChoiceInLWTest.java @@ -0,0 +1,96 @@ +/* + * Copyright (c) 1998, 2024, 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 4130788 + * @summary Choice components move unexpectedly when in lightweight containers + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual ChoiceInLWTest + */ + +import java.awt.BorderLayout; +import java.awt.Choice; +import java.awt.Container; +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.Label; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.lang.reflect.InvocationTargetException; + +public class ChoiceInLWTest extends Frame implements Runnable { + private final Choice choices; + static final String INSTRUCTIONS = """ + After test starts wait for two seconds and open a choice. + If choice's popup obscures the label above it press Fail. + Otherwise press Pass. + """; + + public ChoiceInLWTest() { + setLayout(new BorderLayout()); + Container lwCont = new Container(); + lwCont.setLayout(new FlowLayout()); + choices = new Choice(); + choices.add("This is just a token item to get a nice width."); + lwCont.add(choices); + add("Center", lwCont); + Label label = new Label("You should see an unobscured Choice below."); + label.setAlignment(Label.CENTER); + add("North", label); + addChoiceItem(); + addWindowListener(new WindowAdapter() { + @Override + public void windowOpened(WindowEvent e) { + super.windowOpened(e); + new Thread(ChoiceInLWTest.this).start(); + } + }); + pack(); + } + + private void addChoiceItem() { + choices.add("Adding an item used to move the Choice!"); + } + + public void run() { + try { + Thread.sleep(1000); + } catch (InterruptedException ignore) { + } + addChoiceItem(); + } + + public static void main(String[] args) throws InterruptedException, + InvocationTargetException { + PassFailJFrame.builder() + .title("Choice in LW Container Test") + .testUI(ChoiceInLWTest::new) + .instructions(INSTRUCTIONS) + .columns(40) + .build() + .awaitAndCheck(); + + } +} diff --git a/test/jdk/java/awt/Choice/ChoiceInsertTest.java b/test/jdk/java/awt/Choice/ChoiceInsertTest.java new file mode 100644 index 000000000000..5eafa83a1399 --- /dev/null +++ b/test/jdk/java/awt/Choice/ChoiceInsertTest.java @@ -0,0 +1,89 @@ +/* + * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Choice; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.GridLayout; +import java.awt.Label; +import java.awt.Robot; + +/* + * @test + * @bug 4082078 + * @summary Test for bug(s): 4082078, Multiple calls to Choice.insert cause core dump + * @key headful + * @run main ChoiceInsertTest + */ + +public class ChoiceInsertTest extends Frame { + Choice c; + Label l; + + private static ChoiceInsertTest choiceInsertTest; + + public ChoiceInsertTest() { + c = new Choice(); + l = new Label("If you see this, the choice insert bug is fixed!"); + c.add("Initial choice"); + add(c); + } + + public void testInsertion() { + // inserting 30 or so items aborts Solaris VM + // in JDK's before 1.1.5 + for (int nchoice = 0; nchoice < 30; nchoice++) { + c.insert("new choice", 0); + } + // if you made it to here the bug is not there anymore... + remove(l); + add(l); + validate(); + } + + public static void main(String[] args) throws Exception { + Robot robot = new Robot(); + try { + EventQueue.invokeAndWait(() ->{ + choiceInsertTest = new ChoiceInsertTest(); + choiceInsertTest.setTitle("ChoiceInsertTest"); + choiceInsertTest.setLocationRelativeTo(null); + choiceInsertTest.setSize(500, 300); + choiceInsertTest.setLayout(new GridLayout()); + choiceInsertTest.setVisible(true); + }); + robot.waitForIdle(); + robot.delay(500); + EventQueue.invokeAndWait(choiceInsertTest::testInsertion); + robot.delay(1000); + } finally { + EventQueue.invokeAndWait(() -> { + if (choiceInsertTest != null) { + choiceInsertTest.dispose(); + } + }); + } + + System.err.println("ChoiceInsertTest: Didn't abort VM inserting 30 items, so we passed!"); + } +} diff --git a/test/jdk/java/awt/Choice/ChoiceMouseDragTest.java b/test/jdk/java/awt/Choice/ChoiceMouseDragTest.java new file mode 100644 index 000000000000..0c0c059032dd --- /dev/null +++ b/test/jdk/java/awt/Choice/ChoiceMouseDragTest.java @@ -0,0 +1,138 @@ +/* + * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +import java.awt.BorderLayout; +import java.awt.Choice; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.Point; +import java.awt.event.InputEvent; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; + +/* + * @test + * @bug 4328557 + * @summary Tests that MouseDragged and MouseReleased are triggered on choice + * @library /lib/client + * @build ExtendedRobot + * @key headful + * @run main ChoiceMouseDragTest + */ + + +public class ChoiceMouseDragTest extends Frame { + private static final Choice choice = new Choice(); + + private static ExtendedRobot robot; + private volatile boolean isDragged; + private volatile boolean isReleased; + + private static volatile ChoiceMouseDragTest choiceMouseDragTest; + + public ChoiceMouseDragTest() { + super("ChoiceMouseDragTest"); + this.setLayout(new BorderLayout()); + choice.add("item-1"); + choice.add("item-2"); + choice.add("item-3"); + choice.add("item-4"); + add("Center", choice); + choice.addMouseListener(new MouseEventHandler()); + choice.addMouseMotionListener(new MouseMotionEventHandler()); + setSize(400, 200); + setLocationRelativeTo(null); + setVisible(true); + } + + public static void main(String[] args) throws Exception { + try { + EventQueue.invokeAndWait(() -> + choiceMouseDragTest = new ChoiceMouseDragTest()); + + robot = new ExtendedRobot(); + robot.waitForIdle(); + robot.delay(500); + + Point pointToDrag = choice.getLocationOnScreen(); + pointToDrag.x += choice.getWidth() - 10; + pointToDrag.y += choice.getHeight() / 2 ; + + choiceMouseDragTest.test(InputEvent.BUTTON3_DOWN_MASK, pointToDrag); + choiceMouseDragTest.test(InputEvent.BUTTON1_DOWN_MASK, pointToDrag); + } finally { + EventQueue.invokeAndWait(() -> { + if (choiceMouseDragTest != null) { + choiceMouseDragTest.dispose(); + } + }); + } + } + + void test(int buttonToTest, Point pointToDrag) { + isDragged = false; + isReleased = false; + + robot.mouseMove(pointToDrag.x, pointToDrag.y); + robot.waitForIdle(); + + robot.mousePress(buttonToTest); + + robot.glide(pointToDrag.x + 100, pointToDrag.y); + robot.waitForIdle(); + + robot.mouseRelease(buttonToTest); + robot.waitForIdle(); + + if (!isReleased || !isDragged) { + throw new RuntimeException(("Test failed: button %d dragged(received %b) or " + + "released(received %b)") + .formatted(buttonToTest, isDragged, isReleased)); + } + + robot.delay(500); + } + + class MouseEventHandler extends MouseAdapter { + public void mousePressed(MouseEvent me) { + System.out.println(me.paramString()); + } + + public void mouseReleased(MouseEvent me) { + System.out.println(me.paramString()); + isReleased = true; + } + + public void mouseClicked(MouseEvent me) { + System.out.println(me.paramString()); + } + } + + class MouseMotionEventHandler extends MouseAdapter { + public void mouseDragged(MouseEvent me) { + System.out.println(me.paramString()); + isDragged = true; + } + } +} diff --git a/test/jdk/java/awt/Choice/ChoiceMouseEventTest.java b/test/jdk/java/awt/Choice/ChoiceMouseEventTest.java new file mode 100644 index 000000000000..9603d5c763de --- /dev/null +++ b/test/jdk/java/awt/Choice/ChoiceMouseEventTest.java @@ -0,0 +1,123 @@ +/* + * Copyright (c) 2000, 2024, 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 4319246 + * @summary Tests that MouseReleased, MouseClicked and MouseDragged are triggered on choice + * @key headful + * @run main ChoiceMouseEventTest + */ + +import java.awt.AWTException; +import java.awt.BorderLayout; +import java.awt.Choice; +import java.awt.Dimension; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.Point; +import java.awt.Robot; +import java.awt.event.InputEvent; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.lang.reflect.InvocationTargetException; + + +public class ChoiceMouseEventTest extends Frame { + static volatile boolean mousePressed = false; + static volatile boolean mouseReleased = false; + static volatile boolean mouseClicked = false; + Choice choice = new Choice(); + static Point location; + static Dimension size; + + public void setupGUI() { + setTitle("Choice Mouse Event Test"); + this.setLayout(new BorderLayout()); + choice.add("item-1"); + choice.add("item-2"); + choice.add("item-3"); + choice.add("item-4"); + add("Center", choice); + choice.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + mouseClicked = true; + } + + @Override + public void mousePressed(MouseEvent e) { + mousePressed = true; + } + + @Override + public void mouseReleased(MouseEvent e) { + mouseReleased = true; + } + }); + setLocationRelativeTo(null); + setSize(400, 200); + setVisible(true); + } + + public Point _location() { + return choice.getLocationOnScreen(); + } + + public Dimension _size() { + return choice.getSize(); + } + + public static void main(String[] args) throws InterruptedException, + InvocationTargetException, AWTException { + ChoiceMouseEventTest test = new ChoiceMouseEventTest(); + try { + EventQueue.invokeAndWait(test::setupGUI); + Robot robot = new Robot(); + robot.setAutoDelay(50); + robot.delay(1000); + robot.waitForIdle(); + EventQueue.invokeAndWait(() -> { + location = test._location(); + size = test._size(); + }); + robot.waitForIdle(); + robot.mouseMove(location.x + size.width - 10, location.y + (size.height / 2)); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.delay(2000); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + robot.delay(2000); + robot.waitForIdle(); + if (!mouseClicked || !mousePressed || !mouseReleased) { + throw new RuntimeException(String.format("One of the events not arrived: " + + "mouseClicked = %b, mousePressed = %b, mouseReleased = %b", + mouseClicked, mousePressed, mouseReleased)); + } + } finally { + if (test != null) { + EventQueue.invokeAndWait(test::dispose); + } + } + } +} + diff --git a/test/jdk/java/awt/Choice/ChoicePosTest.java b/test/jdk/java/awt/Choice/ChoicePosTest.java new file mode 100644 index 000000000000..c585e4709bbe --- /dev/null +++ b/test/jdk/java/awt/Choice/ChoicePosTest.java @@ -0,0 +1,137 @@ +/* + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Choice; +import java.awt.Color; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.Insets; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.Robot; +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.IOException; +import javax.imageio.ImageIO; + +/* + * @test + * @bug 4075194 + * @summary 4075194, Choice may not be displayed at the location requested + * @key headful + */ + +public class ChoicePosTest { + + private static Robot robot; + private static Frame frame; + private static final int GAP = 10; + private static volatile Choice c1,c2; + + public static void main(String[] args) throws Exception { + try { + EventQueue.invokeAndWait(ChoicePosTest::createAndShowGUI); + + robot = new Robot(); + robot.waitForIdle(); + robot.delay(500); + + captureAndTestChoices(); + } finally { + EventQueue.invokeAndWait(frame::dispose); + } + + System.out.println("Passed"); + } + + private static void createAndShowGUI() { + frame = new Frame("ChoicePosTest"); + Insets insets = frame.getInsets(); + frame.setSize( insets.left + 400 + insets.right, insets.top + 400 + insets.bottom ); + frame.setBackground(Color.RED); + frame.setLayout(null); + frame.setLocationRelativeTo(null); + + c1 = new Choice(); + c1.setBackground(Color.GREEN); + frame.add( c1 ); + c1.setBounds( 20, 50, 100, 100 ); + + c2 = new Choice(); + c2.setBackground(Color.GREEN); + frame.add(c2); + c2.addItem("One"); + c2.addItem("Two"); + c2.addItem("Three"); + c2.setBounds( 125, 50, 100, 100 ); + + frame.validate(); + frame.setVisible(true); + } + + private static void captureAndTestChoices() { + Point c1loc = c1.getLocationOnScreen(); + Point c2loc = c2.getLocationOnScreen(); + + int startX = c1loc.x - GAP; + int startY = c1loc.y - GAP; + int captureWidth = c2loc.x + c2.getWidth() + GAP - startX; + int captureHeight = c2loc.y + c2.getHeight() + GAP - startY; + + BufferedImage bi = robot.createScreenCapture( + new Rectangle(startX, startY, captureWidth, captureHeight) + ); + + int redPix = Color.RED.getRGB(); + + int lastNonRedCount = 0; + + for (int y = 0; y < captureHeight; y++) { + int nonRedCount = 0; + for (int x = 0; x < captureWidth; x++) { + int pix = bi.getRGB(x, y); + if (pix != redPix) { + nonRedCount++; + } + } + + if (nonRedCount > 0 && lastNonRedCount > 0) { + if (lastNonRedCount - nonRedCount > 0) { + System.err.printf( + "Failed at %d, nonRedCount: %d lastNonRedCount: %d\n", + y, nonRedCount, lastNonRedCount + ); + + try { + ImageIO.write(bi, "png", new File("choices.png")); + } catch (IOException ignored) { + } + + throw new RuntimeException("Choices are not aligned"); + } + } + + lastNonRedCount = nonRedCount; + } + } +} diff --git a/test/jdk/java/awt/Choice/ChoiceRemoveTest.java b/test/jdk/java/awt/Choice/ChoiceRemoveTest.java new file mode 100644 index 000000000000..6de66db93627 --- /dev/null +++ b/test/jdk/java/awt/Choice/ChoiceRemoveTest.java @@ -0,0 +1,111 @@ +/* + * Copyright (c) 1999, 2024, 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 4079027 + * @summary Removing an item dynamically from a Choice object breaks lower items. + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual ChoiceRemoveTest + */ + +import java.awt.Choice; +import java.awt.Frame; +import java.awt.GridLayout; +import java.awt.Label; +import java.awt.Panel; +import java.awt.event.ItemEvent; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.lang.reflect.InvocationTargetException; + +public class ChoiceRemoveTest extends Frame { + Choice selector; + static final String INSTRUCTIONS = """ + After window 'Choice Remove Test' appears wait for three seconds + and then click on the choice. In popup there should be no + 'Choice A' variant. Try selecting each variant with mouse + and verify by the log that the correct variant gets selected. + If after selecting item in the list the correct item gets selected + and correct item name appears in the log press Pass otherwise press Fail. + """; + + public static void main(String[] argv) throws InterruptedException, + InvocationTargetException { + PassFailJFrame.builder() + .title("Test Instructions") + .testUI(ChoiceRemoveTest::new) + .instructions(INSTRUCTIONS) + .columns(40) + .logArea() + .build() + .awaitAndCheck(); + } + + public ChoiceRemoveTest() { + super("Choice Remove Test"); + Panel p; + Label prompt; + + addWindowListener(new WindowAdapter() { + @Override + public void windowOpened(WindowEvent e) { + super.windowOpened(e); + new Thread(() -> { + try { + Thread.sleep(2000); + } catch (InterruptedException ignore) { + } + removeFirst(); + }).start(); + } + }); + + setLayout(new GridLayout()); + p = new Panel(); + + prompt = new Label("Select different items including the last one"); + p.add(prompt); + + selector = new Choice(); + selector.add("Choice A"); + selector.add("Choice B"); + selector.add("Choice C"); + selector.add("Choice D"); + selector.add("Choice E"); + selector.addItemListener(e -> { + if (e.getStateChange() == ItemEvent.SELECTED) { + Object selected = e.getItem(); + PassFailJFrame.log(selected.toString()); + } + }); + p.add(selector); + add(p); + pack(); + } + + public void removeFirst() { + selector.remove("Choice A"); + } +} diff --git a/test/jdk/java/awt/Choice/DeadlockTest.java b/test/jdk/java/awt/Choice/DeadlockTest.java new file mode 100644 index 000000000000..fdc6d94e6ba8 --- /dev/null +++ b/test/jdk/java/awt/Choice/DeadlockTest.java @@ -0,0 +1,113 @@ +/* + * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.BorderLayout; +import java.awt.Choice; +import java.awt.Frame; +import jdk.test.lib.Platform; + +/* + * @test + * @bug 4134619 + * @summary Tests that the EventDispatchThread doesn't deadlock with + * user threads which are modifying a Choice component. + * @library /java/awt/regtesthelpers /test/lib + * @build PassFailJFrame jdk.test.lib.Platform + * @run main/manual DeadlockTest + */ + +public class DeadlockTest extends Thread { + + static volatile Choice choice1; + static volatile Choice choice2; + static volatile Choice choice3; + static volatile Frame frame; + static int itemCount = 0; + + private static final boolean isWindows = Platform.isWindows(); + + private static final String INSTRUCTIONS = """ + Click on the top Choice component and hold the mouse still briefly. + Then, without releasing the mouse button, move the cursor to a menu + item and then again hold the mouse still briefly. + %s + Release the button and repeat this process. + + Verify that this does not cause a deadlock + or crash within a reasonable amount of time. + """.formatted( + isWindows + ? "(menu can automatically collapse sometimes, this is ok)\n" + : "" + + ) ; + + public static void main(String[] args) throws Exception { + DeadlockTest deadlockTest = new DeadlockTest(); + PassFailJFrame passFailJFrame = PassFailJFrame.builder() + .title("DeadlockTest Instructions") + .instructions(INSTRUCTIONS) + .columns(45) + .testUI(deadlockTest::createAndShowUI) + .build(); + + deadlockTest.start(); + + passFailJFrame.awaitAndCheck(); + } + + public Frame createAndShowUI() { + frame = new Frame("Check Choice"); + frame.setLayout(new BorderLayout()); + choice1 = new Choice(); + choice2 = new Choice(); + choice3 = new Choice(); + frame.add(choice1, BorderLayout.NORTH); + frame.add(choice3, BorderLayout.CENTER); + frame.add(choice2, BorderLayout.SOUTH); + frame.pack(); + return frame; + } + + public void run() { + while (true) { + if (choice1 != null && itemCount < 40) { + choice1.add("I am Choice, yes I am : " + itemCount * itemCount); + choice2.add("I am the same, yes I am : " + itemCount * itemCount); + choice3.add("I am the same, yes I am : " + itemCount * itemCount); + itemCount++; + } + if (itemCount >= 20 && choice1 != null && + choice1.getItemCount() > 0) { + choice1.removeAll(); + choice2.removeAll(); + choice3.removeAll(); + itemCount = 0; + } + frame.validate(); + try { + Thread.sleep(1000); + } catch (Exception ignored) {} + } + } +} diff --git a/test/jdk/java/awt/Choice/DisabledList.java b/test/jdk/java/awt/Choice/DisabledList.java new file mode 100644 index 000000000000..d028527303f7 --- /dev/null +++ b/test/jdk/java/awt/Choice/DisabledList.java @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.BorderLayout; +import java.awt.Checkbox; +import java.awt.Choice; +import java.awt.Frame; +import java.awt.Window; +import java.awt.event.ItemEvent; + +/* + * @test + * @bug 6476183 + * @summary Drop down of a Choice changed to enabled state has a disabled like appearance + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual DisabledList + */ + +public class DisabledList { + + private static final String INSTRUCTIONS = """ + 1) Select the checkbox + 2) Open Choice + 3) Drag mouse over the scrollbar or drag out it the choice + 4) If choice's items become disabled press fail, otherwise pass + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("DisabledList Instructions") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 3) + .columns(45) + .testUI(DisabledList::createAndShowUI) + .logArea(4) + .build() + .awaitAndCheck(); + } + + private static Window createAndShowUI() { + Frame frame = new Frame("DisabledList"); + frame.setSize(200, 200); + frame.validate(); + Checkbox checkbox = new Checkbox("checkbox"); + final Choice choice = new Choice(); + choice.setEnabled(false); + for (int i = 0; i < 15; i++) { + choice.addItem("Item" + i); + } + checkbox.addItemListener(event -> { + PassFailJFrame.log("CheckBox.itemStateChanged occurred"); + choice.setEnabled(event.getStateChange() == ItemEvent.SELECTED); + }); + frame.add(BorderLayout.NORTH, checkbox); + frame.add(BorderLayout.CENTER, choice); + return frame; + } +} diff --git a/test/jdk/java/awt/Choice/MultiItemSelected/MultiItemSelected_DragOut.java b/test/jdk/java/awt/Choice/MultiItemSelected/MultiItemSelected_DragOut.java new file mode 100644 index 000000000000..aed154377457 --- /dev/null +++ b/test/jdk/java/awt/Choice/MultiItemSelected/MultiItemSelected_DragOut.java @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2005, 2024, 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 6367251 + * @summary 2 items are highlighted when pressing, dragging the mouse inside the choice, XToolkit + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual MultiItemSelected_DragOut + */ + +import java.awt.Choice; +import java.awt.FlowLayout; +import java.awt.Frame; +import java.lang.reflect.InvocationTargetException; + +public class MultiItemSelected_DragOut extends Frame { + static final String INSTRUCTIONS = """ + 1) Open Choice. + 2) Start drag from first item to second or third one. + 3) Without releasing left mouse button + press and release right mouse button. + 4) Release left mouse button. + 5) Open choice again. + 6) If there is only one selection cursor + in the dropdown list press Pass otherwise press Fail. + """; + + public MultiItemSelected_DragOut() { + Choice choice = new Choice(); + + for (int i = 1; i < 10; i++) { + choice.add("item " + i); + } + add(choice); + choice.addItemListener(ie -> System.out.println(ie)); + + setLayout(new FlowLayout()); + setSize(200, 200); + validate(); + } + + public static void main(String[] args) throws InterruptedException, + InvocationTargetException { + PassFailJFrame.builder() + .title("MultiItemSelected Drag Out Test") + .testUI(MultiItemSelected_DragOut::new) + .instructions(INSTRUCTIONS) + .columns(40) + .build() + .awaitAndCheck(); + } +} diff --git a/test/jdk/java/awt/Choice/MultiItemSelected/MultiItemSelected_KeySelect.java b/test/jdk/java/awt/Choice/MultiItemSelected/MultiItemSelected_KeySelect.java new file mode 100644 index 000000000000..9e930f9923b8 --- /dev/null +++ b/test/jdk/java/awt/Choice/MultiItemSelected/MultiItemSelected_KeySelect.java @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2005, 2024, 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 6367251 + * @summary 2 items are highlighted when dragging inside and press ESC or ENTER + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual MultiItemSelected_KeySelect + */ + +import java.awt.Choice; +import java.awt.FlowLayout; +import java.awt.Frame; +import java.lang.reflect.InvocationTargetException; + +public class MultiItemSelected_KeySelect extends Frame { + static final String INSTRUCTIONS = """ + 1) Open Choice. + 2) Start drag from first item to another one. + 3) Without releasing the mouse button press ESC key. + 4) Open choice again. + 5) Verify that there is only one + selection cursor in the dropdown list. + 6) Repeat steps 2-5 once again but this time + press ENTER key instead of ESC. + 7) If in both scenarios there is only one selection cursor + press Pass otherwise press Fail. + """; + + public MultiItemSelected_KeySelect() { + Choice choice = new Choice(); + + for (int i = 1; i < 10; i++) { + choice.add("item " + i); + } + add(choice); + choice.addItemListener(ie -> System.out.println(ie)); + setLayout(new FlowLayout()); + setSize(200, 200); + validate(); + } + + public static void main(String[] args) throws InterruptedException, + InvocationTargetException { + PassFailJFrame.builder() + .title("MultiItemSelected Key Select Test") + .testUI(MultiItemSelected_KeySelect::new) + .instructions(INSTRUCTIONS) + .columns(40) + .build() + .awaitAndCheck(); + } +} diff --git a/test/jdk/java/awt/Choice/MultiItemSelected/MultiItemSelected_UpDown.java b/test/jdk/java/awt/Choice/MultiItemSelected/MultiItemSelected_UpDown.java new file mode 100644 index 000000000000..5904d98a9081 --- /dev/null +++ b/test/jdk/java/awt/Choice/MultiItemSelected/MultiItemSelected_UpDown.java @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2005, 2024, 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 6367251 + * @summary 2 items are highlighted when dragging outside and press UP or DOWN + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual MultiItemSelected_UpDown + */ + +import java.awt.Choice; +import java.awt.FlowLayout; +import java.awt.Frame; +import java.lang.reflect.InvocationTargetException; + +public class MultiItemSelected_UpDown extends Frame { + static final String INSTRUCTIONS = """ + 1) Open Choice. + 2) Start drag from first item to another one. + 3) Without interrupting drag + move mouse cursor outside the choice popup. + 4) Press UP, DOWN key several times to position + selection cursor to a different item. + 5) Release mouse button. + 6) If popup is closed upon mouse button release open Choice again. + 7) Verify that there is only one + selection cursor in the dropdown list. + 8) If true then press Pass, otherwise press Fail. + """; + + public MultiItemSelected_UpDown() { + Choice choice = new Choice(); + + for (int i = 1; i < 20; i++) { + choice.add(" item " + i); + } + add(choice); + choice.addItemListener(ie -> System.out.println(ie)); + setLayout(new FlowLayout()); + setSize(200, 200); + validate(); + } + + public static void main(String[] args) throws InterruptedException, + InvocationTargetException { + PassFailJFrame.builder() + .title("MultiItemSelected Up/Down Test") + .testUI(MultiItemSelected_UpDown::new) + .instructions(INSTRUCTIONS) + .columns(40) + .build() + .awaitAndCheck(); + } +} diff --git a/test/jdk/java/awt/Choice/PopupMenuOnChoiceArea.java b/test/jdk/java/awt/Choice/PopupMenuOnChoiceArea.java new file mode 100644 index 000000000000..2a56d7281ee4 --- /dev/null +++ b/test/jdk/java/awt/Choice/PopupMenuOnChoiceArea.java @@ -0,0 +1,106 @@ +/* + * Copyright (c) 2005, 2024, 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 6240046 + * @summary REG:Choice's Drop-down does not disappear when clicking somewhere, after popup menu is disposed-XTkt + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual PopupMenuOnChoiceArea + */ + + +import java.awt.CheckboxMenuItem; +import java.awt.Choice; +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.Menu; +import java.awt.PopupMenu; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.lang.reflect.InvocationTargetException; + +public class PopupMenuOnChoiceArea extends Frame { + static final String INSTRUCTIONS = """ + You would see a window named 'Popup menu on choice area' + with Choice in it. Move the mouse pointer to the choice. + Click right mouse button on it. + You should see a popup menu with 'File' in it. + Close this popup menu by pressing Esc. + Click the left mouse button on the Choice. + You should see a Choice drop-down menu. + Move mouse pointer into drop-down menu. + Click right mouse button on any item in it. + If you see a 'File' popup menu press Fail. + If Choice drop-down closes instead press Pass. + """; + + public PopupMenuOnChoiceArea() { + super("Popup menu on choice area"); + this.setLayout(new FlowLayout()); + Choice choice = new Choice(); + choice.add("item-1"); + choice.add("item-2"); + choice.add("item-3"); + choice.add("item-4"); + add("Center", choice); + Menu fileMenu = new Menu("File"); + Menu open = new Menu("Open"); + Menu save = new Menu("save"); + CheckboxMenuItem exit = new CheckboxMenuItem("Exit"); + fileMenu.add(open); + fileMenu.add(save); + fileMenu.add(exit); + final PopupMenu pop = new PopupMenu(); + pop.setLabel("This is a popup menu"); + pop.setName("a menu"); + pop.add(fileMenu); + choice.add(pop); + choice.addMouseListener(new MouseAdapter() { + public void mousePressed(MouseEvent me) { + if (me.isPopupTrigger()) { + pop.show(me.getComponent(), me.getX(), me.getY()); + } + } + + public void mouseReleased(MouseEvent me) { + if (me.isPopupTrigger()) { + pop.show(me.getComponent(), me.getX(), me.getY()); + } + } + }); + setSize(200, 200); + } + + public static void main(String[] args) throws InterruptedException, + InvocationTargetException { + PassFailJFrame.builder() + .title("Test Instructions") + .testUI(PopupMenuOnChoiceArea::new) + .instructions(INSTRUCTIONS) + .columns(40) + .build() + .awaitAndCheck(); + } +} diff --git a/test/jdk/java/awt/Choice/RepaintAfterRemoveLastItemTest/RepaintAfterRemoveLastItemTest.java b/test/jdk/java/awt/Choice/RepaintAfterRemoveLastItemTest/RepaintAfterRemoveLastItemTest.java new file mode 100644 index 000000000000..20acc66b6bda --- /dev/null +++ b/test/jdk/java/awt/Choice/RepaintAfterRemoveLastItemTest/RepaintAfterRemoveLastItemTest.java @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2005, 2024, 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 6292186 + * @summary Choice is not refreshed properly when the last item gets removed + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual RepaintAfterRemoveLastItemTest + */ + +import java.awt.Button; +import java.awt.Choice; +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.lang.reflect.InvocationTargetException; + +public class RepaintAfterRemoveLastItemTest extends Frame implements ActionListener { + Choice ch = new Choice(); + + static final String INSTRUCTIONS = """ + Press on the 'remove' button after that if the choice does not display + 'only item' press Pass. If 'only item' is still displayed press Fail. + """; + + public RepaintAfterRemoveLastItemTest() { + ch.add("only item"); + add(ch); + + Button b = new Button("remove"); + add(b); + b.addActionListener(this); + setLayout(new FlowLayout()); + setSize(200, 200); + validate(); + } + + public void actionPerformed(ActionEvent ae) { + if (ch.getItemCount() != 0) { + ch.remove(0); + } + } + + public static void main(String[] args) throws InterruptedException, + InvocationTargetException { + PassFailJFrame.builder() + .title("Repaint After Remove Test") + .testUI(RepaintAfterRemoveLastItemTest::new) + .instructions(INSTRUCTIONS) + .columns(40) + .build() + .awaitAndCheck(); + } +} diff --git a/test/jdk/java/awt/Choice/ScrollbarFlickers.java b/test/jdk/java/awt/Choice/ScrollbarFlickers.java new file mode 100644 index 000000000000..c35d4900134f --- /dev/null +++ b/test/jdk/java/awt/Choice/ScrollbarFlickers.java @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2006, 2024, 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 6405707 + * @summary Choice popup & scrollbar gets Flickering when mouse is pressed & drag on the scrollbar + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual ScrollbarFlickers + */ + +import java.awt.BorderLayout; +import java.awt.Choice; +import java.awt.Frame; +import java.lang.reflect.InvocationTargetException; + +public class ScrollbarFlickers extends Frame { + static final String INSTRUCTIONS = """ + Open the choice popup. Select any item in it and + drag it with the mouse above or below the choice. + Keep the choice opened. + Continue dragging the mouse outside of the choice + making content of the popup scroll. + If you see that scrollbar flickers press Fail. + Otherwise press Pass. + """; + + public ScrollbarFlickers() { + super("Scrollbar Flickering Test"); + Choice ch = new Choice(); + setLayout(new BorderLayout()); + ch.add("Praveen"); + ch.add("Mohan"); + ch.add("Rakesh"); + ch.add("Menon"); + ch.add("Girish"); + ch.add("Ramachandran"); + ch.add("Elancheran"); + ch.add("Subramanian"); + ch.add("Raju"); + ch.add("Pallath"); + ch.add("Mayank"); + ch.add("Joshi"); + ch.add("Sundar"); + ch.add("Srinivas"); + ch.add("Mandalika"); + ch.add("Suresh"); + ch.add("Chandar"); + add(ch); + setSize(200, 200); + validate(); + } + + public static void main(String[] args) throws InterruptedException, + InvocationTargetException { + PassFailJFrame.builder() + .title("Test Instructions") + .testUI(ScrollbarFlickers::new) + .instructions(INSTRUCTIONS) + .columns(40) + .build() + .awaitAndCheck(); + } +} diff --git a/test/jdk/java/awt/Choice/SetFontTest.java b/test/jdk/java/awt/Choice/SetFontTest.java new file mode 100644 index 000000000000..f38a34a7ed27 --- /dev/null +++ b/test/jdk/java/awt/Choice/SetFontTest.java @@ -0,0 +1,91 @@ +/* + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.BorderLayout; +import java.awt.Choice; +import java.awt.Font; +import java.awt.Frame; +import java.awt.Panel; + +/* + * @test + * @bug 4293346 + * @summary Checks that Choice does update its dimensions on font change + * @requires (os.family == "windows") + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual SetFontTest + */ + +public class SetFontTest { + + private static final String INSTRUCTIONS = """ + Choice component used to not update its dimension on font change. + Select one of fonts on the choice pull down list. + Pull down the list after the font change; if items in the list are + shown correctly the test is passed, otherwise it failed. + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("SetFontTest Instructions") + .instructions(INSTRUCTIONS) + .columns(45) + .testUI(SetFontTest::createAndShowUI) + .build() + .awaitAndCheck(); + } + + private static Frame createAndShowUI() { + Frame frame = new Frame("SetFontTest"); + Choice choice = new Choice(); + frame.setBounds(100, 400, 400, 100); + choice.addItem("dummy"); + choice.addItem("Set LARGE Font"); + choice.addItem("Set small Font"); + choice.addItem("addNewItem"); + choice.addItem("deleteItem"); + + choice.addItemListener(e -> { + if (e.getItem().toString().equals("addNewItem")) { + choice.addItem("very very very very long item"); + frame.validate(); + } else if (e.getItem().toString().equals("deleteItem")) { + if (choice.getItemCount() > 4) { + choice.remove(4); + frame.validate(); + } + } else if (e.getItem().toString().equals("Set LARGE Font")) { + choice.setFont(new Font("Dialog", Font.PLAIN, 24)); + frame.validate(); + } else if (e.getItem().toString().equals("Set small Font")) { + choice.setFont(new Font("Dialog", Font.PLAIN, 10)); + frame.validate(); + } + }); + Panel panel = new Panel(); + panel.add(choice); + frame.add(panel, BorderLayout.CENTER); + return frame; + } +} diff --git a/test/jdk/java/awt/Choice/WheelEventsConsumed.java b/test/jdk/java/awt/Choice/WheelEventsConsumed.java new file mode 100644 index 000000000000..37200214734b --- /dev/null +++ b/test/jdk/java/awt/Choice/WheelEventsConsumed.java @@ -0,0 +1,156 @@ +/* + * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Choice; +import java.awt.EventQueue; +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.Point; +import java.awt.Robot; +import java.awt.Toolkit; +import java.awt.event.InputEvent; +import java.awt.event.KeyEvent; +import java.awt.event.MouseWheelEvent; +import java.awt.event.MouseWheelListener; + +/* + * @test + * @bug 6253211 + * @summary PIT: MouseWheel events not triggered for Choice drop down in XAWT + * @requires (os.family == "linux") + * @key headful + * @run main WheelEventsConsumed + */ + +public class WheelEventsConsumed extends Frame implements MouseWheelListener +{ + Robot robot; + Choice choice1 = new Choice(); + Point pt; + final static int delay = 100; + boolean mouseWheeled = false; + final static int OUTSIDE_CHOICE = 1; + final static int INSIDE_LIST_OF_CHOICE = 2; + final static int INSIDE_CHOICE_COMPONENT = 3; + static String toolkit; + + private static volatile WheelEventsConsumed frame = null; + + public static void main(String[] args) throws Exception { + toolkit = Toolkit.getDefaultToolkit().getClass().getName(); + try { + EventQueue.invokeAndWait(() -> { + frame = new WheelEventsConsumed(); + frame.initAndShow(); + }); + frame.test(); + } finally { + EventQueue.invokeAndWait(() -> { + if (frame != null) { + frame.dispose(); + } + }); + } + } + + public void mouseWheelMoved(MouseWheelEvent me) { + mouseWheeled = true; + System.out.println(me); + } + + public void initAndShow() { + setTitle("WheelEventsConsumed test"); + for (int i = 1; i < 10; i++) { + choice1.add("item-0" + i); + } + + choice1.addMouseWheelListener(this); + add(choice1); + setLayout(new FlowLayout()); + setSize(200, 200); + setLocationRelativeTo(null); + setVisible(true); + validate(); + } + + public void test() { + try { + robot = new Robot(); + robot.setAutoWaitForIdle(true); + robot.setAutoDelay(50); + robot.waitForIdle(); + robot.delay(delay * 5); + testMouseWheel(1, OUTSIDE_CHOICE); + robot.delay(delay); + testMouseWheel(-1, INSIDE_LIST_OF_CHOICE); + robot.delay(delay); + testMouseWheel(1, INSIDE_CHOICE_COMPONENT); + robot.delay(delay); + } catch (Throwable e) { + throw new RuntimeException("Test failed. Exception thrown: " + e); + } + } + + public void testMouseWheel(int amt, int mousePosition) { + pt = choice1.getLocationOnScreen(); + robot.mouseMove(pt.x + choice1.getWidth() / 2, pt.y + choice1.getHeight() / 2); + + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.delay(50); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + robot.delay(50); + + switch (mousePosition) { + case OUTSIDE_CHOICE: + robot.mouseMove(pt.x + choice1.getWidth() * 3 / 2, pt.y + choice1.getHeight() / 2); + break; + case INSIDE_LIST_OF_CHOICE: + robot.mouseMove(pt.x + choice1.getWidth() / 2, pt.y + choice1.getHeight() * 4); + break; + case INSIDE_CHOICE_COMPONENT: + robot.mouseMove(pt.x + choice1.getWidth() / 2, pt.y + choice1.getHeight() / 2); + break; + } + + robot.delay(delay); + for (int i = 0; i < 10; i++) { + robot.mouseWheel(amt); + robot.delay(delay); + } + + if (!mouseWheeled) { + if (toolkit.equals("sun.awt.windows.WToolkit") && mousePosition == OUTSIDE_CHOICE) { + System.out.println("Passed. Separate case on Win32. Choice generated MouseWheel events" + mousePosition); + } else { + throw new RuntimeException("Test failed. Choice should generate MOUSE_WHEEL events." + mousePosition); + } + } else { + System.out.println("Passed. Choice generated MouseWheel events" + mousePosition); + } + robot.keyPress(KeyEvent.VK_ESCAPE); + robot.delay(10); + robot.keyRelease(KeyEvent.VK_ESCAPE); + robot.delay(200); + mouseWheeled = false; + } +} diff --git a/test/jdk/java/awt/Clipboard/ClipRWTest.java b/test/jdk/java/awt/Clipboard/ClipRWTest.java new file mode 100644 index 000000000000..c173dd17f0df --- /dev/null +++ b/test/jdk/java/awt/Clipboard/ClipRWTest.java @@ -0,0 +1,104 @@ +/* + * Copyright (c) 2002, 2025, 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 4177171 4180145 4180148 + * @summary Can't copy to clipboard + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual ClipRWTest + */ + +import java.awt.Button; +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.TextField; +import java.awt.datatransfer.Clipboard; +import java.awt.datatransfer.DataFlavor; +import java.awt.datatransfer.StringSelection; + +public class ClipRWTest { + private static final String INSTRUCTIONS = """ + 1. Type some text in the text field and press Copy Text. + 2. Switch to a _native_ application (e.g. Notepad) and paste the text in + 3. Verify the text that is pasted matches what you typed in the Java window + 4. In the native app, type some new text and copy it + 5. Switch back to the test frame and press Paste Text + 6. Verify the text that is pasted matches what you typed in the native app + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("ClipRWTest Instructions") + .instructions(INSTRUCTIONS) + .columns(40) + .testUI(ClipFrame::new) + .build() + .awaitAndCheck(); + } + + private static class ClipFrame extends Frame { + TextField field =new TextField(50); + Button copyText = new Button("Copy Text"); + Button pasteText = new Button("Paste Text"); + Clipboard clipboard; + + public ClipFrame() { + super("ClipRWTest 4177171"); + setLayout(new FlowLayout()); + + clipboard = getToolkit().getSystemClipboard(); + + add(field); + add(copyText); + add(pasteText); + + copyText.addActionListener( + ev -> { + String text = field.getText(); + try { + clipboard.setContents(new StringSelection(text), null); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + ); + + pasteText.addActionListener( + ev -> { + String text = ""; + try { + text = (String) clipboard.getContents(null) + .getTransferData(DataFlavor.stringFlavor); + } catch (Exception ex) { + ex.printStackTrace(); + } + field.setText(text); + } + ); + + pack(); + } + } +} diff --git a/test/jdk/java/awt/Clipboard/LostOwnershipChainTest/SystemClipboard2ProcTest.java b/test/jdk/java/awt/Clipboard/LostOwnershipChainTest/SystemClipboard2ProcTest.java new file mode 100644 index 000000000000..9bd76ad09626 --- /dev/null +++ b/test/jdk/java/awt/Clipboard/LostOwnershipChainTest/SystemClipboard2ProcTest.java @@ -0,0 +1,171 @@ +/* + * Copyright (c) 2002, 2025, 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 4683804 + * @summary Tests that in ClipboardOwner.lostOwnership() Clipboard.getContents() + * returns actual contents of the clipboard and Clipboard.setContents() + * can set contents of the clipboard and its owner. The clipboard is + * the system clipboard and the owners of the clipboard are in + * 2 different processes. + * @key headful + * @library /test/lib + * @run main SystemClipboard2ProcTest +*/ + +import java.awt.Toolkit; +import java.awt.datatransfer.Clipboard; +import java.awt.datatransfer.ClipboardOwner; +import java.awt.datatransfer.DataFlavor; +import java.awt.datatransfer.StringSelection; +import java.awt.datatransfer.Transferable; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; + +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; + +public class SystemClipboard2ProcTest { + + public static void main(String[] args) throws Exception { + SystemClipboardOwner.run(); + + if (SystemClipboardOwner.failed) { + throw new RuntimeException("test failed: can not get actual " + + "contents of the clipboard or set owner of the clipboard"); + } else { + System.err.println("test passed"); + } + } +} + +class SystemClipboardOwner implements ClipboardOwner { + static volatile boolean failed; + + private static final Object LOCK = new Object(); + + private static final int CHAIN_LENGTH = 5; + private final static Clipboard clipboard = + Toolkit.getDefaultToolkit().getSystemClipboard(); + + private int m, id; + + public SystemClipboardOwner(int m) { this.m = m; id = m; } + + public void lostOwnership(Clipboard cb, Transferable contents) { + System.err.println(id + " lost clipboard ownership"); + + Transferable t = getClipboardContents(cb, null); + // for test passing if t.getTransferData() will throw an exception + String msg = "" + (m + 1); + try { + msg = (String)t.getTransferData(DataFlavor.stringFlavor); + } catch (Exception e) { + System.err.println(id + " can't getTransferData: " + e); + } + System.err.println(id + " Clipboard.getContents(): " + msg); + if (!msg.equals("" + (m + 1))) { + failed = true; + System.err.println("Clipboard.getContents() returned incorrect contents!"); + } + + m += 2; + if (m <= CHAIN_LENGTH) { + System.err.println(id + " Clipboard.setContents(): " + m); + setClipboardContents(cb, new StringSelection(m + ""), this); + } + if (m >= CHAIN_LENGTH) { + synchronized (LOCK) { + LOCK.notifyAll(); + } + } + } + + public static void run() throws Exception { + SystemClipboardOwner cbo1 = new SystemClipboardOwner(0); + System.err.println(cbo1.m + " Clipboard.setContents(): " + cbo1.m); + setClipboardContents(clipboard, new StringSelection(cbo1.m + ""), + cbo1); + + ProcessBuilder pb = ProcessTools + .createTestJavaProcessBuilder(SystemClipboardOwner.class.getName()); + + Process process = ProcessTools.startProcess("Child", pb); + OutputAnalyzer outputAnalyzer = new OutputAnalyzer(process); + + if (!process.waitFor(15, TimeUnit.SECONDS)) { + process.destroyForcibly(); + throw new TimeoutException("Timed out waiting for Child"); + } + + outputAnalyzer.shouldHaveExitValue(0); + + if (cbo1.m < CHAIN_LENGTH) { + failed = true; + System.err.println("chain of calls of lostOwnership() broken!"); + } + } + + public static void main(String[] args) throws InterruptedException { + SystemClipboardOwner cbo2 = new SystemClipboardOwner(1); + System.err.println(cbo2.m + " Clipboard.setContents(): " + cbo2.m); + synchronized (LOCK) { + setClipboardContents(clipboard, new StringSelection(cbo2.m + ""), + cbo2); + LOCK.wait(); + } + } + + private static void setClipboardContents(Clipboard cb, + Transferable contents, + ClipboardOwner owner) { + synchronized (cb) { + boolean set = false; + while (!set) { + try { + cb.setContents(contents, owner); + set = true; + } catch (IllegalStateException ise) { + try { Thread.sleep(100); } + catch (InterruptedException e) { e.printStackTrace(); } + } + } + } + } + + private static Transferable getClipboardContents(Clipboard cb, + Object requestor) { + synchronized (cb) { + while (true) { + try { + Transferable t = cb.getContents(requestor); + return t; + } catch (IllegalStateException ise) { + try { Thread.sleep(100); } + catch (InterruptedException e) { e.printStackTrace(); } + } + } + } + } +} diff --git a/test/jdk/java/awt/Clipboard/NoOwnerNoTargetsTest.java b/test/jdk/java/awt/Clipboard/NoOwnerNoTargetsTest.java new file mode 100644 index 000000000000..178fe9b70745 --- /dev/null +++ b/test/jdk/java/awt/Clipboard/NoOwnerNoTargetsTest.java @@ -0,0 +1,131 @@ +/* + * Copyright (c) 2002, 2025, 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 4655996 + * @summary tests that getting the system clipboard contents doesn't cause + * IOException if there is no clipboard owner or the owner doesn't + * export any target types + * @key headful + * @library /test/lib + * @run main NoOwnerNoTargetsTest + */ + +import java.awt.Toolkit; +import java.awt.datatransfer.Clipboard; +import java.awt.datatransfer.ClipboardOwner; +import java.awt.datatransfer.DataFlavor; +import java.awt.datatransfer.StringSelection; +import java.awt.datatransfer.Transferable; +import java.awt.datatransfer.UnsupportedFlavorException; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; + +import jdk.test.lib.process.OutputAnalyzer; +import jdk.test.lib.process.ProcessTools; + +public class NoOwnerNoTargetsTest implements ClipboardOwner { + + final Clipboard clipboard = + Toolkit.getDefaultToolkit().getSystemClipboard(); + public static final int CLIPBOARD_DELAY = 1000; + + public static void main(String[] args) throws Exception { + if (args.length > 0) { + NoOwnerNoTargetsTest test = new NoOwnerNoTargetsTest(); + test.execute(); + return; + } + + new NoOwnerNoTargetsTest().start(); + } + + public void execute() { + final ClipboardOwner clipboardOwner = new ClipboardOwner() { + public void lostOwnership(Clipboard clip, + Transferable contents) { + System.exit(0); + } + }; + final Transferable emptyTransferable = new Transferable() { + public DataFlavor[] getTransferDataFlavors() { + return new DataFlavor[0]; + } + public boolean isDataFlavorSupported(DataFlavor df) { + return false; + } + public Object getTransferData(DataFlavor df) + throws UnsupportedFlavorException { + throw new UnsupportedFlavorException(df); + } + }; + + clipboard.setContents(emptyTransferable, clipboardOwner); + final Object o = new Object(); + synchronized (o) { + try { + o.wait(); + } catch (InterruptedException ie) { + ie.printStackTrace(); + } + } + } + + public void start() throws Exception { + clipboard.getContents(null); + + Transferable transferable = new StringSelection("TEXT"); + clipboard.setContents(transferable, this); + + ProcessBuilder pb = ProcessTools.createTestJavaProcessBuilder( + NoOwnerNoTargetsTest.class.getName(), + "child" + ); + + Process process = ProcessTools.startProcess("Child", pb); + OutputAnalyzer outputAnalyzer = new OutputAnalyzer(process); + + if (!process.waitFor(15, TimeUnit.SECONDS)) { + process.destroyForcibly(); + throw new TimeoutException("Timed out waiting for Child"); + } + + outputAnalyzer.shouldHaveExitValue(0); + } + + public void lostOwnership(Clipboard clip, Transferable contents) { + final Transferable transferable = new StringSelection("TEXT"); + final Runnable r = () -> { + try { + Thread.sleep(CLIPBOARD_DELAY); + } catch (InterruptedException e) { + e.printStackTrace(); + } + clipboard.getContents(null); + clipboard.setContents(transferable, null); + }; + final Thread t = new Thread(r); + t.start(); + } +} diff --git a/test/jdk/java/awt/Clipboard/PasteNullToTextComponentsTest.java b/test/jdk/java/awt/Clipboard/PasteNullToTextComponentsTest.java new file mode 100644 index 000000000000..191ba2288b7c --- /dev/null +++ b/test/jdk/java/awt/Clipboard/PasteNullToTextComponentsTest.java @@ -0,0 +1,228 @@ +/* + * Copyright (c) 2002, 2025, 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 4401853 + * @summary Tests that pasting null to TextArea and TextField on Solaris/Linux + * removes selected text; doing it on Windows to TextArea does nothing, + * to TextField removes selected text. + * @key headful + * @run main PasteNullToTextComponentsTest + */ + +import java.awt.BorderLayout; +import java.awt.Button; +import java.awt.Component; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.Point; +import java.awt.Robot; +import java.awt.TextArea; +import java.awt.TextComponent; +import java.awt.TextField; +import java.awt.Toolkit; +import java.awt.datatransfer.Clipboard; +import java.awt.datatransfer.ClipboardOwner; +import java.awt.datatransfer.StringSelection; +import java.awt.datatransfer.Transferable; +import java.awt.event.FocusAdapter; +import java.awt.event.FocusEvent; +import java.awt.event.FocusListener; +import java.awt.event.InputEvent; +import java.awt.event.KeyEvent; + +public class PasteNullToTextComponentsTest { + + private static final int NATIVE_EVENT_PROCESSING_TIMEOUT = 500; + private static final int WAIT_TIMEOUT = 3000; + + private boolean failed; + + private static final boolean isOSWindows = + System.getProperty("os.name").startsWith("Windows"); + + private final Object LOCK = new Object(); + + private Robot robot; + + private Frame frame; + private TextArea ta; + private TextField tf; + private Component initialFocusComp; + + private final String beg = "a"; + private final String sel = "b"; + private final String end = "c"; + private final String text = beg + sel + end; + private final String begEnd = beg + end; + + private boolean initialFocusGained; + + public void init() { + ta = new TextArea(text, 3, text.length() + 3); + tf = new TextField(text, text.length() + 3); + initialFocusComp = new Button("Initially focused button"); + + frame = new Frame(); + frame.add(initialFocusComp, BorderLayout.NORTH); + frame.add(ta, BorderLayout.CENTER); + frame.add(tf, BorderLayout.SOUTH); + frame.setSize(200, 200); + + FocusListener fl = new FocusAdapter() { + public void focusGained(FocusEvent e) { + System.out.println(e + "; source class=" + e.getSource().getClass()); + synchronized (LOCK) { + TextComponent tc = (TextComponent) e.getComponent(); + tc.select(1, 2); + robot.keyPress(KeyEvent.VK_CONTROL); + robot.keyPress(KeyEvent.VK_V); + robot.keyRelease(KeyEvent.VK_V); + robot.keyRelease(KeyEvent.VK_CONTROL); + tc.removeFocusListener(this); + LOCK.notifyAll(); + } + } + }; + ta.addFocusListener(fl); + tf.addFocusListener(fl); + + initialFocusComp.addFocusListener(new FocusAdapter() { + public void focusGained(FocusEvent e) { + System.out.println(e + "; source class=" + e.getSource().getClass()); + synchronized (LOCK) { + initialFocusGained = true; + LOCK.notifyAll(); + } + } + }); + + setClipboardContents(Toolkit.getDefaultToolkit().getSystemClipboard(), + new StringSelection(null), null); + + frame.setLocationRelativeTo(null); + frame.setVisible(true); + } + + public void start() throws Exception { + robot = new Robot(); + robot.waitForIdle(); + robot.delay(500); + + Point iniFocusPoint = initialFocusComp.getLocationOnScreen(); + synchronized (LOCK) { + if (!initialFocusGained) { + robot.mouseMove(iniFocusPoint.x + 3, iniFocusPoint.y + 3); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + LOCK.wait(WAIT_TIMEOUT); + } + } + + initialFocusComp.requestFocusInWindow(); + robot.waitForIdle(); + + synchronized (LOCK) { + ta.requestFocusInWindow(); + LOCK.wait(WAIT_TIMEOUT); + } + + // wait until native control process key event (C^V) + robot.waitForIdle(); + robot.delay(NATIVE_EVENT_PROCESSING_TIMEOUT); + + synchronized (LOCK) { + tf.requestFocusInWindow(); + LOCK.wait(WAIT_TIMEOUT); + } + + // wait until native control process key event (C^V) + robot.waitForIdle(); + robot.delay(NATIVE_EVENT_PROCESSING_TIMEOUT); + + String taText = ta.getText(); + String tfText = tf.getText(); + + System.err.println("TextArea text=" + taText + + " TextField text=" + tfText); + + boolean taSelDeleted = begEnd.equals(taText); + boolean taSelRemained = text.equals(taText); + boolean tfSelDeleted = begEnd.equals(tfText); + + System.out.println("taSelDeleted = " + taSelDeleted); + System.out.println("taSelRemained = " + taSelRemained); + System.out.println("tfSelDeleted = " + tfSelDeleted); + + if (isOSWindows + ? !(taSelRemained && tfSelDeleted) + : !(taSelDeleted && tfSelDeleted)) { + failed = true; + } + + if (!initialFocusGained) { + System.err.println("Initial component did not gain focus"); + failed = false; + } + + if (failed) { + throw new RuntimeException("test failed: wrong behavior of text " + + "component on pasting null"); + } else { + System.err.println("test passed"); + } + } + + + private static void setClipboardContents(Clipboard cb, + Transferable contents, + ClipboardOwner owner) { + synchronized (cb) { + boolean set = false; + while (!set) { + try { + cb.setContents(contents, owner); + set = true; + } catch (IllegalStateException ise) { + try { Thread.sleep(100); } + catch (InterruptedException e) { e.printStackTrace(); } + } + } + } + } + + public static void main(String[] args) throws Exception { + PasteNullToTextComponentsTest app = new PasteNullToTextComponentsTest(); + try { + EventQueue.invokeAndWait(app::init); + app.start(); + } finally { + EventQueue.invokeAndWait(() -> { + if (app.frame != null) { + app.frame.dispose(); + } + }); + } + } +} diff --git a/test/jdk/java/awt/Component/BackgroundColorTest/InitialBackgroundSettingTest.java b/test/jdk/java/awt/Component/BackgroundColorTest/InitialBackgroundSettingTest.java new file mode 100644 index 000000000000..3bed6f106c59 --- /dev/null +++ b/test/jdk/java/awt/Component/BackgroundColorTest/InitialBackgroundSettingTest.java @@ -0,0 +1,132 @@ +/* + * Copyright (c) 1998, 2024, 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 4148334 + * @summary tests that background color is initially set correctly. + * @requires os.family == "windows" + * @key headful + * @run main InitialBackgroundSettingTest + */ +import java.awt.Button; +import java.awt.Choice; +import java.awt.Color; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.GridLayout; +import java.awt.List; +import java.awt.TextArea; +import java.awt.TextField; +import java.awt.Scrollbar; +import java.lang.reflect.InvocationTargetException; + +public class InitialBackgroundSettingTest { + Frame frame; + TextField tf; + TextArea ta; + Choice choice; + List list; + Scrollbar bar; + Button button; + + public static void main(String[] args) throws InterruptedException, + InvocationTargetException { + InitialBackgroundSettingTest test= new InitialBackgroundSettingTest(); + try { + EventQueue.invokeAndWait(test::setupGUI); + EventQueue.invokeAndWait(test::test); + } finally { + EventQueue.invokeAndWait(test::dispose); + } + } + + public void setupGUI () { + frame = new Frame("InitialBackgroundSettingTest frame"); + tf = new TextField("I am the TextField"); + ta = new TextArea("I am the TextArea"); + choice = new Choice(); + list = new List(); + bar = new Scrollbar(Scrollbar.HORIZONTAL); + button = new Button("I am the button"); + frame.setBackground(Color.red); + frame.setLayout(new GridLayout(7, 1)); + frame.add(button); + frame.add(bar); + frame.add(choice); + frame.add(list); + frame.add(tf); + frame.add(ta); + frame.setVisible(true); + frame.setBounds (400, 0, 300, 300); + } + + public void test() { + boolean passed = true; + System.out.println("Button background color is:" + + button.getBackground()); + if (Color.red.equals(button.getBackground())) { + System.err.println("Button background is red"); + passed = false; + } + System.out.println("Scrollbar background color is:" + + bar.getBackground()); + if (Color.red.equals(bar.getBackground())) { + System.err.println("ScrollBar background is red"); + passed = false; + } + System.out.println("Choice background color is:" + + choice.getBackground()); + if (Color.red.equals(choice.getBackground())) { + System.err.println("Choice background is red"); + passed = false; + } + System.out.println("List background color is:" + + list.getBackground()); + if (Color.red.equals(list.getBackground())) { + System.err.println("List background is red"); + passed = false; + } + System.out.println("TextField background color is:" + + tf.getBackground()); + if (Color.red.equals(tf.getBackground())) { + System.err.println("TextField background is red"); + passed = false; + } + System.out.println("TextArea background color is:" + + ta.getBackground()); + if (Color.red.equals(ta.getBackground())) { + System.err.println("TextArea background is red"); + passed = false; + } + + if (!passed) { + throw new RuntimeException("One or more component inherited" + + " background from a Frame"); + } + } + + public void dispose() { + frame.dispose(); + } +} diff --git a/test/jdk/java/awt/Component/ComponentLeakTest/ComponentLeakTest.java b/test/jdk/java/awt/Component/ComponentLeakTest/ComponentLeakTest.java new file mode 100644 index 000000000000..2936880dde6c --- /dev/null +++ b/test/jdk/java/awt/Component/ComponentLeakTest/ComponentLeakTest.java @@ -0,0 +1,769 @@ +/* + * Copyright (c) 1997, 2024, 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 + * @key headful + * @requires (os.family != "linux") + * @bug 4119609 4149812 4136116 4171960 4170095 4294016 4343272 + * @summary This test verifies that java.awt objects are being garbage + * collected correctly. That is, it ensures that unneeded + * references (such as JNI global refs or refs in static arrays) + * do not remain after the object is disposed. + * @run main/othervm ComponentLeakTest + */ + +import java.awt.BorderLayout; +import java.awt.Button; +import java.awt.Canvas; +import java.awt.CardLayout; +import java.awt.Checkbox; +import java.awt.CheckboxGroup; +import java.awt.CheckboxMenuItem; +import java.awt.Choice; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dialog; +import java.awt.Dimension; +import java.awt.FileDialog; +import java.awt.FlowLayout; +import java.awt.Font; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.GraphicsConfiguration; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.GridLayout; +import java.awt.Label; +import java.awt.LayoutManager; +import java.awt.List; +import java.awt.Menu; +import java.awt.MenuBar; +import java.awt.MenuItem; +import java.awt.MenuShortcut; +import java.awt.Panel; +import java.awt.PopupMenu; +import java.awt.ScrollPane; +import java.awt.Scrollbar; +import java.awt.TextArea; +import java.awt.TextField; +import java.awt.Window; +import java.awt.dnd.DropTarget; +import java.awt.dnd.DropTargetDragEvent; +import java.awt.dnd.DropTargetDropEvent; +import java.awt.dnd.DropTargetEvent; +import java.awt.dnd.DropTargetListener; +import java.lang.ref.PhantomReference; +import java.lang.ref.Reference; +import java.lang.ref.ReferenceQueue; +import java.util.Map; +import java.util.HashMap; + +public class ComponentLeakTest { + + public static void main(String[] args) { + final int iter = 5; + + for(int count = 0; count < iter; count++) { + MainFrame f = new MainFrame(); + MainWindow w = new MainWindow(f); + MainDialog d = new MainDialog(f); + TestFileDialog fd = new TestFileDialog(f, "TestFileDialog"); + fd.addNotify(); // fd.show() hangs + + fd.dispose(); + d.dispose(); + w.dispose(); + f.dispose(); + } + + // Test layout managers + Frame border = new Frame(); + border.setLayout(new BorderLayout()); + Frame card = new Frame(); + card.setLayout(new CardLayout()); + Frame flow = new Frame(); + flow.setLayout(new FlowLayout()); + Frame gridBag = new Frame(); + gridBag.setLayout(new GridBagLayout()); + Frame grid = new Frame(); + grid.setLayout(new GridLayout(1, 2)); + + for (int count = 0; count < iter; count++) { + border.add(new BorderTestButton("BorderTest"), + BorderLayout.WEST); + border.add(new BorderTestButton("BorderTest"), + BorderLayout.EAST); + card.add(new CardTestButton("CardTest"), "card0"); + card.add(new CardTestButton("CardTest"), "card1"); + flow.add(new FlowTestButton()); + flow.add(new FlowTestButton()); + gridBag.add(new GridBagTestButton(), new GridBagConstraints()); + gridBag.add(new GridBagTestButton(), new GridBagConstraints()); + grid.add(new GridTestButton()); + grid.add(new GridTestButton()); + + border.removeAll(); + card.removeAll(); + flow.removeAll(); + gridBag.removeAll(); + grid.removeAll(); + } + + gc(5); + try { + Thread.sleep(1000); + } catch (InterruptedException ie) { + } + + freeReferences(); + reportLeaks(); + System.err.println("Test passed."); + } + + public static void initWindow(Window w) { + w.setSize(600, 400); + w.setLayout(new FlowLayout()); + + // peered components + w.add(new TestButton("Button")); + w.add(new TestCanvas()); + w.add(new TestCheckbox("Checkbox", true)); + TestChoice choice = new TestChoice(); + choice.add("Choice 1"); + choice.add("Choice Two"); + w.add(choice); + w.add(new TestLabel("Label")); + TestList list = new TestList(); + list.add("List 1"); + list.add("List Two"); + w.add(list); + w.add(new TestScrollbar(Scrollbar.VERTICAL)); + w.add(new TestScrollbar(Scrollbar.HORIZONTAL)); + TestScrollPane scrollpane = new TestScrollPane(); + scrollpane.add(new TestButton("Button in a scrollpane")); + w.add(scrollpane); + w.add(new TestTextArea("TextArea", 3, 30)); + w.add(new TestTextField("TextField")); + + // nested components + TestPanel panel1 = new TestPanel(); + panel1.setLayout(new FlowLayout()); + panel1.setBackground(Color.red); + w.add(panel1); + + panel1.add(new TestButton("level 2")); + + Panel panel2 = new Panel(); + panel2.setLayout(new FlowLayout()); + panel2.setBackground(Color.green); + panel1.add(panel2); + + panel2.add(new TestButton("level 3")); + + w.add(new TestLightweight("Lightweight")); + } + + private static ReferenceQueue queue = new ReferenceQueue(); + private static Map refs = new HashMap(); + + public static void register(Object obj) { + PhantomReference ref = new PhantomReference(obj, queue); + refs.put(ref, obj.getClass().getName()); + } + + private static void gc() { + System.gc(); + try { + Thread.sleep(100); + } catch (InterruptedException ie) { + throw new RuntimeException("Test was interrupted"); + } + } + + private static void gc(int num) { + for (; num > 0; num--) { + gc(); + } + } + + public static void freeReferences() { + System.err.println("Total references: " + refs.size()); + boolean wasFreed = false; + do { + Object[] arr = new Object[2000]; + gc(5); + Reference ref = null; + wasFreed = false; + while ((ref = queue.poll()) != null) { + refs.remove(ref); + wasFreed = true; + gc(); + } + } while (wasFreed); + } + + public static void reportLeaks() { + for (Reference ref : refs.keySet()) { + System.err.println("Leaked " + refs.get(ref)); + } + + if (refs.size() > 0) { + throw new RuntimeException("Some references remained: " + refs.size()); + } + } +} + +class TestFrame extends Frame { + public TestFrame() { + ComponentLeakTest.register(this); + setDropTarget(new TestDropTarget(this)); + } + + public TestFrame(String title) { + super(title); + ComponentLeakTest.register(this); + setDropTarget(new TestDropTarget(this)); + } +} + +class TestWindow extends Window { + public TestWindow(Frame owner) { + super(owner); + ComponentLeakTest.register(this); + setDropTarget(new TestDropTarget(this)); + } + + public TestWindow(Window owner) { + super(owner); + ComponentLeakTest.register(this); + setDropTarget(new TestDropTarget(this)); + } +} + +class TestDialogL extends Dialog { + public TestDialogL(Frame owner) { + super(owner); + ComponentLeakTest.register(this); + setDropTarget(new TestDropTarget(this)); + } + + public TestDialogL(Frame owner, boolean modal) { + super(owner, modal); + ComponentLeakTest.register(this); + setDropTarget(new TestDropTarget(this)); + } + + public TestDialogL(Frame owner, String title) { + super(owner, title); + ComponentLeakTest.register(this); + setDropTarget(new TestDropTarget(this)); + } + + public TestDialogL(Frame owner, String title, boolean modal) { + super(owner, title, modal); + ComponentLeakTest.register(this); + setDropTarget(new TestDropTarget(this)); + } + + public TestDialogL(Dialog owner) { + super(owner); + ComponentLeakTest.register(this); + setDropTarget(new TestDropTarget(this)); + } + + public TestDialogL(Dialog owner, String title) { + super(owner, title); + ComponentLeakTest.register(this); + setDropTarget(new TestDropTarget(this)); + } + + public TestDialogL(Dialog owner, String title, boolean modal) { + super(owner, title, modal); + ComponentLeakTest.register(this); + setDropTarget(new TestDropTarget(this)); + } +} + +class TestFileDialog extends FileDialog { + public TestFileDialog(Frame parent) { + super(parent); + ComponentLeakTest.register(this); + setDropTarget(new TestDropTarget(this)); + } + + public TestFileDialog(Frame parent, String title) { + super(parent, title); + ComponentLeakTest.register(this); + setDropTarget(new TestDropTarget(this)); + } + + public TestFileDialog(Frame parent, String title, int mode) { + super(parent, title, mode); + ComponentLeakTest.register(this); + setDropTarget(new TestDropTarget(this)); + } +} + +class TestButton extends Button { + public TestButton() { + ComponentLeakTest.register(this); + setDropTarget(new TestDropTarget(this)); + } + + public TestButton(String title) { + super(title); + ComponentLeakTest.register(this); + setDropTarget(new TestDropTarget(this)); + } +} + +class TestCanvas extends Canvas { + int width = 100; + int height = 100; + + public TestCanvas() { + ComponentLeakTest.register(this); + setDropTarget(new TestDropTarget(this)); + } + + public TestCanvas(GraphicsConfiguration config) { + super(config); + ComponentLeakTest.register(this); + setDropTarget(new TestDropTarget(this)); + } + + public void paint(Graphics g) { + g.setColor(Color.blue); + g.fillRoundRect(10, 10, 50, 50, 15, 30); + g.setColor(Color.red); + g.fillOval(70, 70, 25, 25); + } + + public Dimension getPreferredSize() { + return new Dimension(width, height); + } +} + +class TestCheckbox extends Checkbox { + public TestCheckbox() { + ComponentLeakTest.register(this); + setDropTarget(new TestDropTarget(this)); + } + + public TestCheckbox(String label) { + super(label); + ComponentLeakTest.register(this); + setDropTarget(new TestDropTarget(this)); + } + + public TestCheckbox(String label, boolean state) { + super(label, state); + ComponentLeakTest.register(this); + setDropTarget(new TestDropTarget(this)); + } + + public TestCheckbox(String label, boolean state, CheckboxGroup group) { + super(label, state, group); + ComponentLeakTest.register(this); + setDropTarget(new TestDropTarget(this)); + } + + public TestCheckbox(String label, CheckboxGroup group, boolean state) { + super(label, group, state); + ComponentLeakTest.register(this); + setDropTarget(new TestDropTarget(this)); + } +} + +class TestChoice extends Choice { + public TestChoice() { + ComponentLeakTest.register(this); + setDropTarget(new TestDropTarget(this)); + } +} + +class TestLabel extends Label { + public TestLabel() { + ComponentLeakTest.register(this); + setDropTarget(new TestDropTarget(this)); + } + + public TestLabel(String text) { + super(text); + ComponentLeakTest.register(this); + setDropTarget(new TestDropTarget(this)); + } + + public TestLabel(String text, int align) { + super(text, align); + ComponentLeakTest.register(this); + setDropTarget(new TestDropTarget(this)); + } +} + +class TestList extends List { + public TestList() { + ComponentLeakTest.register(this); + setDropTarget(new TestDropTarget(this)); + } + + public TestList(int rows) { + super(rows); + ComponentLeakTest.register(this); + setDropTarget(new TestDropTarget(this)); + } + + public TestList(int rows, boolean multipleMode) { + super(rows, multipleMode); + ComponentLeakTest.register(this); + setDropTarget(new TestDropTarget(this)); + } +} + +class TestScrollbar extends Scrollbar { + public TestScrollbar() { + ComponentLeakTest.register(this); + setDropTarget(new TestDropTarget(this)); + } + + public TestScrollbar(int orientation) { + super(orientation); + ComponentLeakTest.register(this); + setDropTarget(new TestDropTarget(this)); + } + + public TestScrollbar(int orient, int val, int visible, int min, int max) { + super(orient, val, visible, min, max); + ComponentLeakTest.register(this); + setDropTarget(new TestDropTarget(this)); + } +} + +class TestScrollPane extends ScrollPane { + public TestScrollPane() { + ComponentLeakTest.register(this); + setDropTarget(new TestDropTarget(this)); + } + + public TestScrollPane(int policy) { + super(policy); + ComponentLeakTest.register(this); + setDropTarget(new TestDropTarget(this)); + } +} + +class TestTextField extends TextField { + public TestTextField() { + ComponentLeakTest.register(this); + requestFocus(); + setDropTarget(new TestDropTarget(this)); + } + + public TestTextField(String text) { + super(text); + ComponentLeakTest.register(this); + requestFocus(); + setDropTarget(new TestDropTarget(this)); + } + + public TestTextField(int columns) { + super(columns); + ComponentLeakTest.register(this); + requestFocus(); + setDropTarget(new TestDropTarget(this)); + } + + public TestTextField(String text, int columns) { + super(text, columns); + ComponentLeakTest.register(this); + requestFocus(); + setDropTarget(new TestDropTarget(this)); + } +} + +class TestTextArea extends TextArea { + public TestTextArea() { + ComponentLeakTest.register(this); + requestFocus(); + setDropTarget(new TestDropTarget(this)); + } + + public TestTextArea(String text) { + super(text); + ComponentLeakTest.register(this); + requestFocus(); + setDropTarget(new TestDropTarget(this)); + } + + public TestTextArea(int rows, int columns) { + super(rows, columns); + ComponentLeakTest.register(this); + requestFocus(); + setDropTarget(new TestDropTarget(this)); + } + + public TestTextArea(String text, int rows, int columns) { + super(text, rows, columns); + ComponentLeakTest.register(this); + requestFocus(); + setDropTarget(new TestDropTarget(this)); + } + + public TestTextArea(String text, int rows, int columns, int bars) { + super(text, rows, columns, bars); + ComponentLeakTest.register(this); + requestFocus(); + setDropTarget(new TestDropTarget(this)); + } +} + +class TestPanel extends Panel { + public TestPanel() { + ComponentLeakTest.register(this); + setDropTarget(new TestDropTarget(this)); + } + + public TestPanel(LayoutManager layout) { + super(layout); + ComponentLeakTest.register(this); + setDropTarget(new TestDropTarget(this)); + } +} +class TestMenu extends Menu { + public TestMenu() { + ComponentLeakTest.register(this); + } + + public TestMenu(String label) { + super(label); + ComponentLeakTest.register(this); + } + + public TestMenu(String label, boolean tearOff) { + super(label, tearOff); + ComponentLeakTest.register(this); + } +} + +class TestMenuItem extends MenuItem { + public TestMenuItem() { + ComponentLeakTest.register(this); + } + public TestMenuItem(String label) { + super(label); + ComponentLeakTest.register(this); + } + + public TestMenuItem(String label, MenuShortcut s) { + super(label, s); + ComponentLeakTest.register(this); + } +} + +class TestMenuBar extends MenuBar { + public TestMenuBar() { + ComponentLeakTest.register(this); + } +} + +class TestPopupMenu extends PopupMenu { + public TestPopupMenu() { + ComponentLeakTest.register(this); + } + + public TestPopupMenu(String label) { + super(label); + ComponentLeakTest.register(this); + } +} + +class TestCheckboxMenuItem extends CheckboxMenuItem { + public TestCheckboxMenuItem() { + ComponentLeakTest.register(this); + } + + public TestCheckboxMenuItem(String label) { + super(label); + ComponentLeakTest.register(this); + } + + public TestCheckboxMenuItem(String label, boolean state) { + super(label, state); + ComponentLeakTest.register(this); + } +} + +class BorderTestButton extends Button { + public BorderTestButton() { + ComponentLeakTest.register(this); + } + + public BorderTestButton(String title) { + super(title); + ComponentLeakTest.register(this); + } +} + +class CardTestButton extends Button { + public CardTestButton() { + ComponentLeakTest.register(this); + } + + public CardTestButton(String title) { + super(title); + ComponentLeakTest.register(this); + } +} + +class FlowTestButton extends Button { + public FlowTestButton() { + ComponentLeakTest.register(this); + } + + public FlowTestButton(String title) { + super(title); + ComponentLeakTest.register(this); + } +} + +class GridBagTestButton extends Button { + public GridBagTestButton() { + ComponentLeakTest.register(this); + } + + public GridBagTestButton(String title) { + super(title); + ComponentLeakTest.register(this); + } +} + +class GridTestButton extends Button { + public GridTestButton() { + ComponentLeakTest.register(this); + } + + public GridTestButton(String title) { + super(title); + ComponentLeakTest.register(this); + } +} + +class TestLightweight extends Component { + String label; + int width = 100; + int height = 30; + + public TestLightweight(String label) { + this.label = label; + ComponentLeakTest.register(this); + } + + public void paint(Graphics g) { + Dimension d = getSize(); + g.setColor(Color.orange); + g.fillRect(0, 0, d.width, d.height); + g.setColor(Color.black); + int x = 5; + int y = (d.height - 5); + g.drawString(label, x, y); + } + + public Dimension getPreferredSize() { + return new Dimension(width,height); + } +} + +class TestDropTarget extends DropTarget { + public TestDropTarget(Component comp) { + super(comp, new DropTargetListener() { + public void dragEnter(DropTargetDragEvent dtde) {} + public void dragOver(DropTargetDragEvent dtde) {} + public void dropActionChanged(DropTargetDragEvent dtde) {} + public void dragExit(DropTargetEvent dte) {} + public void drop(DropTargetDropEvent dtde) {} + }); + ComponentLeakTest.register(this); + } +} + +class MainWindow extends TestWindow { + public MainWindow(Frame f) { + super(f); + ComponentLeakTest.initWindow(this); + setVisible(true); + + TestPopupMenu popup = new TestPopupMenu("hi"); + add(popup); + popup.show(this, 5, 5); + } +} + +class MainDialog extends TestDialogL { + public MainDialog(Frame f) { + super(f, "MainDialog", false); + ComponentLeakTest.initWindow(this); + setVisible(true); + + TestPopupMenu popup = new TestPopupMenu("hi"); + add(popup); + popup.show(this, 5, 5); + } +} + +class MainFrame extends TestFrame { + public MainFrame(){ + super("Component Leak Test MainFrame"); + + ComponentLeakTest.initWindow(this); + + TestMenu menu = new TestMenu("Print"); + TestMenu menu2 = new TestMenu("File"); + TestMenu menu3 = new TestMenu("Edit"); + TestMenu menu4 = new TestMenu("ReallyReallyReallyReallyReallyReallyReallyReally" + + "ReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyLong"); + menu2.setFont(new Font("SansSerif", Font.BOLD, 20)); + menu2.setEnabled(false); + menu3.setFont(new Font("Monospaced", Font.ITALIC, 18)); + menu3.setEnabled(false); + menu4.setEnabled(false); + TestMenuItem itemPrinter = new TestMenuItem("foobar"); + TestMenuItem itemScreen = new TestMenuItem("baz"); + TestCheckboxMenuItem itemCheck = new TestCheckboxMenuItem("yep"); + menu.add(itemPrinter); + menu.add(itemScreen); + menu.add(itemCheck); + TestMenuBar menuBar = new TestMenuBar(); + menuBar.add( menu ); + menuBar.add( menu2 ); + menuBar.add( menu3 ); + menuBar.add( menu4 ); + setMenuBar(menuBar); + + setVisible(true); + + TestPopupMenu popup = new TestPopupMenu("hi"); + add(popup); + popup.show(this, 5, 5); + } +} diff --git a/test/jdk/java/awt/Component/ComponentSerializationTest/ComponentSerializationTest.java b/test/jdk/java/awt/Component/ComponentSerializationTest/ComponentSerializationTest.java new file mode 100644 index 000000000000..ddf7efffdbdf --- /dev/null +++ b/test/jdk/java/awt/Component/ComponentSerializationTest/ComponentSerializationTest.java @@ -0,0 +1,354 @@ +/* + * Copyright (c) 1998, 2024, 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 4146452 + * @summary Tests serialization of peered and lightweight Components. + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual ComponentSerializationTest + */ + +import java.awt.Button; +import java.awt.Canvas; +import java.awt.Checkbox; +import java.awt.CheckboxMenuItem; +import java.awt.Choice; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dialog; +import java.awt.Dimension; +import java.awt.EventQueue; +import java.awt.FileDialog; +import java.awt.FlowLayout; +import java.awt.Font; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Insets; +import java.awt.Label; +import java.awt.List; +import java.awt.Menu; +import java.awt.MenuBar; +import java.awt.MenuItem; +import java.awt.Panel; +import java.awt.ScrollPane; +import java.awt.Scrollbar; +import java.awt.TextArea; +import java.awt.TextField; +import java.awt.Window; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.lang.reflect.InvocationTargetException; +import java.util.ArrayList; +import javax.swing.JPanel; + +public class ComponentSerializationTest extends JPanel { + private MainFrame mf; + private MainWindow mw; + private MainDialog md; + private MainFileDialog mfd; + private static final String INSTRUCTIONS = """ + A Frame, a Window, and a Dialog should appear. From the Frame's + "Serialize" menu, select "Serialize!". Another Frame, Window, and + Dialog should appear exactly on top of the existing ones. The state + and functionality of the two sets of Windows should be identical. If + any errors or exceptions appear in the log area, or if the second set of + Windows is different from the first, the test fails. Otherwise, the + test passes. + """; + + private static final ArrayList toDispose = new ArrayList<>(); + + public ComponentSerializationTest() { + mf = new MainFrame(); + toDispose.add(mf); + mw = new MainWindow(mf); + toDispose.add(mw); + md = new MainDialog(mf); + toDispose.add(md); + mfd = new MainFileDialog(mf); + toDispose.add(mfd); + } + + public static void main(String[] argc) throws InterruptedException, + InvocationTargetException { + PassFailJFrame.builder() + .title("Component Serialization Test") + .splitUI(ComponentSerializationTest::new) + .instructions(INSTRUCTIONS) + .columns(40) + .logArea() + .build() + .awaitAndCheck(); + for (Window w : toDispose) { + if (w != null) { + EventQueue.invokeAndWait(w::dispose); + } + } + } + + private void initWindow(Window w) { + w.setSize(600, 400); + w.setLayout(new FlowLayout()); + + // peered components + w.add(new Button("Button")); + w.add(new TestCanvas()); + w.add(new Checkbox("Checkbox", true)); + Choice choice = new Choice(); + choice.add("Choice 1"); + choice.add("Choice Two"); + w.add(choice); + w.add(new Label("Label")); + List list = new List(); + list.add("List 1"); + list.add("List Two"); + w.add(list); + w.add(new Scrollbar(Scrollbar.VERTICAL)); + w.add(new Scrollbar(Scrollbar.HORIZONTAL)); + ScrollPane scrollpane = new ScrollPane(); + scrollpane.add(new Button("Button in a scrollpane")); + w.add(scrollpane); + w.add(new TextArea("TextArea", 3, 30)); + w.add(new TextField("TextField")); + + // nested components + Panel panel1 = new Panel(); + panel1.setLayout(new FlowLayout()); + panel1.setBackground(Color.red); + w.add(panel1); + + panel1.add(new Button("level 2")); + + Panel panel2 = new Panel(); + panel2.setLayout(new FlowLayout()); + panel2.setBackground(Color.green); + panel1.add(panel2); + + panel2.add(new Button("level 3")); + + // lightweight components + w.add(new LWButton("LWbutton") ); + + // overlapping components + w.add(new ZOrderPanel()); + } + + class MainWindow extends Window { + public MainWindow(Frame f) { + super(f); + initWindow(this); + setLocation(650, 0); + setVisible(true); + } + } + + class MainDialog extends Dialog { + public MainDialog(Frame f) { + super(f, "MainDialog", false); + initWindow(this); + setLocation(0, 450); + setVisible(true); + } + } + + class MainFileDialog extends FileDialog { + public MainFileDialog(Frame f) { + super(f, "MainFileDialog", FileDialog.SAVE); + setLocation(650, 450); + addNotify(); + } + } + + class MainFrame extends Frame { + public MainFrame() { + super("ComponentSerializationTest"); + initWindow(this); + + Menu menu = new Menu("Serialize"); + Menu menu2 = new Menu("File"); + Menu menu3 = new Menu("Edit"); + Menu menu4 = new Menu("ReallyReallyReallyReallyReallyReallyReallyReally" + + "ReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyReallyLong"); + menu2.setFont(new Font("SansSerif", Font.BOLD, 20)); + menu2.setEnabled(false); + menu3.setFont(new Font("Monospaced", Font.ITALIC, 18)); + menu3.setEnabled(false); + menu4.setEnabled(false); + MenuItem itemSerialize = new MenuItem("Serialize!"); + CheckboxMenuItem itemCheck = new CheckboxMenuItem("Check me"); + menu.add(itemSerialize); + menu.add(itemCheck); + MenuBar menuBar = new MenuBar(); + menuBar.add(menu); + menuBar.add(menu2); + menuBar.add(menu3); + menuBar.add(menu4); + setMenuBar(menuBar); + + itemSerialize.addActionListener(new ActionSerialize()); + + setLocation(0, 0); + setVisible(true); + } + } + + class ActionSerialize implements ActionListener { + public void actionPerformed(ActionEvent ev) { + Frame f2 = null; + Window w2 = null; + Dialog d2 = null; + FileDialog fd2 = null; + + try { + FileOutputStream fos = new FileOutputStream("tmp"); + ObjectOutputStream oos = new ObjectOutputStream(fos); + oos.writeObject(mf); + oos.writeObject(mw); + oos.writeObject(md); + oos.writeObject(mfd); + oos.flush(); + + FileInputStream fis = new FileInputStream("tmp"); + ObjectInputStream ois = new ObjectInputStream(fis); + f2 = (Frame)ois.readObject(); + w2 = (Window)ois.readObject(); + d2 = (Dialog)ois.readObject(); + fd2= (FileDialog)ois.readObject(); + } catch (Exception e) { + PassFailJFrame.log(e.getMessage()); + } + + if (f2 == null || w2 == null || d2 == null || fd2 == null) { + PassFailJFrame.log("ERROR: one of the components was not deserialized."); + PassFailJFrame.log("frame = " + f2); + PassFailJFrame.log("window = " + w2); + PassFailJFrame.log("dialog = " + d2); + PassFailJFrame.log("file dalog = " + fd2); + } + + if (f2 != null) { + toDispose.add(f2); + f2.setVisible(true); + } + if (w2 != null) { + toDispose.add(w2); + w2.setVisible(true); + } + if (d2 != null) { + toDispose.add(d2); + d2.setVisible(true); + } + if (fd2 != null) { + toDispose.add(fd2); + fd2.addNotify(); + } + } + } + + class LWButton extends Component { + String label; + int width = 100; + int height = 30; + + public LWButton(String label) { + super(); + this.label = label; + } + + public void paint(Graphics g) { + Dimension d = getSize(); + g.setColor(Color.orange); + g.fillRect(0, 0, d.width, d.height); + g.setColor(Color.black); + int x = 5; + int y = (d.height - 5); + g.drawString(label, x, y); + } + + public Dimension getPreferredSize() { + return new Dimension(width, height); + } + } + + class TestCanvas extends Canvas { + int width = 100; + int height = 100; + + public void paint(Graphics g) { + g.setColor(Color.blue); + g.fillRoundRect(10, 10, 50, 50, 15, 30); + g.setColor(Color.red); + g.fillOval(70, 70, 25, 25); + } + public Dimension getPreferredSize() { + return new Dimension(width, height); + } + } + + class ZOrderPanel extends Panel { + public ZOrderPanel() { + setLayout(null); + + Component first, second, third, fourth; + + show(); + first = makeBox("Second", Color.blue, -1); + second = makeBox("First", Color.yellow, 0); + fourth = makeBox("Fourth", Color.red, 2); + third = makeBox("Third", Color.green, 3); + remove(third); + add(third, 2); + validate(); + add(new LWButton("LWButton"), 0); + } + + public Dimension preferredSize() { + return new Dimension(260, 80); + } + + public void layout() { + int i, n; + Insets ins = insets(); + n = countComponents(); + for (i = n - 1; i >= 0; i--) { + Component p = getComponent(i); + p.reshape(ins.left + 40 * i, ins.top + 5 * i, 60, 60); + } + } + + public Component makeBox(String s, Color c, int index) { + Label l = new Label(s); + l.setBackground(c); + l.setAlignment(Label.RIGHT); + add(l, index); + validate(); + return l; + } + } +} diff --git a/test/jdk/java/awt/Component/FlickeringOnScroll/FlickeringOnScroll.java b/test/jdk/java/awt/Component/FlickeringOnScroll/FlickeringOnScroll.java new file mode 100644 index 000000000000..2119ae7bcc01 --- /dev/null +++ b/test/jdk/java/awt/Component/FlickeringOnScroll/FlickeringOnScroll.java @@ -0,0 +1,139 @@ +/* + * Copyright (c) 2005, 2024, 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 6347994 + * @summary REG: Scrollbar, Choice, Checkbox flickers and grays out when scrolling, XToolkit + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual FlickeringOnScroll + */ + +import java.awt.BorderLayout; +import java.awt.Checkbox; +import java.awt.Choice; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.MenuItem; +import java.awt.Panel; +import java.awt.PopupMenu; +import java.awt.Scrollbar; +import java.awt.TextArea; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.lang.reflect.InvocationTargetException; + +public class FlickeringOnScroll extends Frame { + + static final String INSTRUCTIONS = """ + There are five components in the frame: + Scrollbars(vertical and horizontal), a Choice, + a Checkbox and a TextArea + 1) Drag the thumbs of each Scrollbar. + 2) Do the same with Choice's scrollbar. + 3) Focus on Checkbox and press left mouse button or SPACE repeatedly. + 4) Right click inside TextArea and navigate through all menu items + in PopupMenu using the arrow keys. + If you notice some component or its scrollbar flickers on + key/mouse press or drag, press Fail. Otherwise press Pass. + """; + + public FlickeringOnScroll() { + Choice ch = new Choice(); + ch.add("Praveen"); + ch.add("Mohan"); + ch.add("Rakesh"); + ch.add("Menon"); + ch.add("Girish"); + ch.add("Ramachandran"); + ch.add("Elancheran"); + ch.add("Subramanian"); + ch.add("Raju"); + ch.add("Pallath"); + ch.add("Mayank"); + ch.add("Joshi"); + ch.add("Sundar"); + ch.add("Srinivas"); + ch.add("Mandalika"); + Checkbox chb = new Checkbox ("Checkbox", false); + TextArea ta = new TextArea("Text Area"); + Panel panel = new Panel(); + PopupMenu popup = new PopupMenu("Popup"); + MenuItem mi1 = new MenuItem("mi1"); + MenuItem mi2 = new MenuItem("mi2"); + MenuItem mi3 = new MenuItem("mi3"); + MenuItem mi4 = new MenuItem("mi4"); + + setTitle("Flickering Scroll Area Testing Frame"); + setLayout(new FlowLayout()); + add(ch); + add(chb); + add(ta); + + panel.setLayout(new BorderLayout()); + panel.setPreferredSize(new Dimension(200, 200)); + add(panel); + panel.add("Center",new java.awt.Label("Scrollbar flickering test..." ,java.awt.Label.CENTER)); + panel.add("South",new Scrollbar(Scrollbar.HORIZONTAL, 0, 100, 0, 255)); + panel.add("East",new Scrollbar(Scrollbar.VERTICAL, 0, 100, 0, 255)); + + ta.add(popup); + popup.add (mi1); + popup.add (mi2); + popup.add (mi3); + popup.add (mi4); + + ta.addMouseListener(new MouseAdapter() { + public void mousePressed(MouseEvent me) { + if (me.isPopupTrigger()) { + if (popup != null) { + popup.show(me.getComponent(), me.getX(), me.getY()); + } + } + } + public void mouseReleased(MouseEvent me) { + if (me.isPopupTrigger()) { + if (popup != null) { + popup.show(me.getComponent(), me.getX(), me.getY()); + } + } + } + }); + + pack(); + } + + public static void main(String[] args) throws InterruptedException, + InvocationTargetException { + PassFailJFrame.builder() + .title("Scroll Area Flickering Repaint") + .testUI(FlickeringOnScroll::new) + .instructions(INSTRUCTIONS) + .columns(40) + .logArea() + .build() + .awaitAndCheck(); + } +} diff --git a/test/jdk/java/awt/Component/FocusRepaintTest/FocusRepaintTest.java b/test/jdk/java/awt/Component/FocusRepaintTest/FocusRepaintTest.java new file mode 100644 index 000000000000..ecffdfda6135 --- /dev/null +++ b/test/jdk/java/awt/Component/FocusRepaintTest/FocusRepaintTest.java @@ -0,0 +1,83 @@ +/* + * Copyright (c) 1997, 2024, 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 4079435 + * @summary Calling repaint() in focus handlers messes up the window. + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual FocusRepaintTest + */ + +import java.awt.Button; +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.event.FocusEvent; +import java.awt.event.FocusListener; +import java.lang.reflect.InvocationTargetException; + +public class FocusRepaintTest extends Frame implements FocusListener { + static final String INSTRUCTIONS = """ + Hit the tab key repeatedly in the Test window. + If any of the buttons disappear press Fail, otherwise press Pass. + """; + + public FocusRepaintTest() { + setTitle("Test"); + setLayout(new FlowLayout()); + setSize(200, 100); + Button b1 = new Button("Close"); + Button b2 = new Button("Button"); + add(b1); + add(b2); + b1.setSize(50, 30); + b2.setSize(50, 30); + b1.addFocusListener(this); + b2.addFocusListener(this); + } + + public void focusGained(FocusEvent e) { + Button b = (Button) e.getSource(); + PassFailJFrame.log("Focus gained for " + b.getLabel()); + b.repaint(); + } + + public void focusLost(FocusEvent e) { + Button b = (Button) e.getSource(); + PassFailJFrame.log("Focus lost for " + b.getLabel()); + b.repaint(); + } + + public static void main(String[] args) throws InterruptedException, + InvocationTargetException { + PassFailJFrame.builder() + .title("Focus Repaint") + .testUI(FocusRepaintTest::new) + .instructions(INSTRUCTIONS) + .columns(40) + .logArea() + .build() + .awaitAndCheck(); + } +} diff --git a/test/jdk/java/awt/Component/ListDoubleIndentTest/ListDoubleIndentTest.java b/test/jdk/java/awt/Component/ListDoubleIndentTest/ListDoubleIndentTest.java new file mode 100644 index 000000000000..4c6c1248950e --- /dev/null +++ b/test/jdk/java/awt/Component/ListDoubleIndentTest/ListDoubleIndentTest.java @@ -0,0 +1,148 @@ +/* + * Copyright (c) 1998, 2024, 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 4185460 + * @summary Container list the indentation is 2x the indent param value + * @key headful + * @run main ListDoubleIndentTest + */ + +import java.awt.BorderLayout; +import java.awt.Button; +import java.awt.EventQueue; +import java.awt.Frame; + +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.io.IOException; +import java.io.PipedInputStream; +import java.io.PrintStream; +import java.io.PipedOutputStream; + +import java.lang.reflect.InvocationTargetException; +import java.util.Vector; + +public class ListDoubleIndentTest { + public static void main(final String[] args) throws InterruptedException, + InvocationTargetException { + EventQueue.invokeAndWait(new ListDoubleIndentTest()::performTest); + } + + public void performTest() { + boolean bReturn = false; + int iCompCount = 0; + int iNotEqual = 0; + int iIndentWrong = 0; + System.out.println("Test: Check indentation"); + Vector v = new Vector(); + String sLine; + String sReturn; + String sExpTrim; + Button b1, b2, b3, b4, b5; + Frame f = null; + + try { + f = new Frame("ListDoubleIndentTest"); + + f.add(b1 = new Button("North"), BorderLayout.NORTH, 0); + f.add(b2 = new Button("South"), BorderLayout.SOUTH, 1); + f.add(b3 = new Button("East"), BorderLayout.EAST, 2); + f.add(b4 = new Button("West"), BorderLayout.WEST, 3); + f.add(b5 = new Button("Center"), BorderLayout.CENTER, -1); + + String[] sExpected = {f.toString(), b1.toString(), b2.toString(), + b3.toString(), b4.toString(), b5.toString()}; + + iCompCount = f.getComponentCount(); + System.out.println("Component count: " + iCompCount); + + for (int j = 0; j <= 10; j++) { + PipedInputStream pin = new PipedInputStream(); + PrintStream output = new PrintStream(new PipedOutputStream(pin), true); + BufferedReader input = new BufferedReader(new InputStreamReader(pin)); + + f.list(output, j); + + output.flush(); + output.close(); + + while ((sLine = input.readLine()) != null) { + v.addElement(sLine); + } + + for (int i = 0; i < v.size(); i++) { + sReturn = (String)v.elementAt(i); + sExpTrim = sExpected[i].trim(); + + if (!(sExpTrim.equals(sReturn.trim()))) { + System.out.println("iNotEqual"); + ++iNotEqual; + } + + int iSpace = sReturn.lastIndexOf(' ') + 1; + + if (i == 0) { + System.out.println("Indent set at: " + j); + System.out.println("Indent return: " + iSpace); + if (iSpace != j) { + System.out.println("iIndentWrong1"); + ++iIndentWrong; + } + } else { + if (iSpace != (j + 1)) { + System.out.println(iSpace + "; " + j); + ++iIndentWrong; + } + } + System.out.println(sReturn); + } + v.removeAllElements(); + v.trimToSize(); + } + + if (iNotEqual == 0 && iIndentWrong == 0) { + bReturn = true; + } else { + bReturn = false; + } + + } catch(IOException e) { + bReturn = false; + System.out.println ("Unexpected Exception thrown: " + e.getMessage()); + e.printStackTrace(); + } finally { + if (f != null) { + f.dispose(); + } + } + + if (bReturn) { + System.out.println("Test for Container.list Passed"); + } else { + System.out.println("Test for Container.list Failed"); + throw new RuntimeException("Test FAILED"); + } + } +} diff --git a/test/jdk/java/awt/Component/MinMaxSizeDefensive/GetSizesTest.java b/test/jdk/java/awt/Component/MinMaxSizeDefensive/GetSizesTest.java new file mode 100644 index 000000000000..2b4954879380 --- /dev/null +++ b/test/jdk/java/awt/Component/MinMaxSizeDefensive/GetSizesTest.java @@ -0,0 +1,113 @@ +/* + * Copyright (c) 2003, 2024, 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 4783989 + @summary get(Preferred|Minimum|Maximum)Size() must not return a reference. + The object copy of Dimension class needed. + @key headful + @run main GetSizesTest +*/ + +import java.awt.Button; +import java.awt.Dimension; +import java.awt.EventQueue; +import java.awt.Frame; +import java.lang.reflect.InvocationTargetException; + +public class GetSizesTest extends Frame { + Button b; + + public static void main(final String[] args) throws InterruptedException, + InvocationTargetException { + GetSizesTest app = new GetSizesTest(); + EventQueue.invokeAndWait(() -> { + try { + app.init(); + app.start(); + } finally { + app.dispose(); + } + }); + } + + public void init() { + b = new Button("button"); + add(b); + } + + public void start () { + setSize(200, 200); + setLocationRelativeTo(null); + setVisible(true); + validate(); + + System.out.println("Test set for Container (Frame)."); + + Dimension dimPref = getPreferredSize(); + dimPref.setSize(101, 101); + if (getPreferredSize().equals(new Dimension(101, 101))) { + throw new RuntimeException("Test Failed for: " + dimPref); + } + System.out.println("getPreferredSize() Passed."); + + Dimension dimMin = getMinimumSize(); + dimMin.setSize(101, 101); + if (getMinimumSize().equals(new Dimension(101, 101))) { + throw new RuntimeException("Test Failed for: " + dimMin); + } + System.out.println("getMinimumSize() Passed."); + + Dimension dimMax = getMaximumSize(); + dimMax.setSize(101, 101); + if (getMaximumSize().equals(new Dimension(101, 101))) { + throw new RuntimeException("Test Failed for: " + dimMax); + } + System.out.println("getMaximumSize() Passed."); + + System.out.println("Test set for Component (Button)."); + + dimPref = b.getPreferredSize(); + dimPref.setSize(33, 33); + if (b.getPreferredSize().equals(new Dimension(33, 33))) { + throw new RuntimeException("Test Failed for: " + dimPref); + } + System.out.println("getPreferredSize() Passed."); + + dimMin = b.getMinimumSize(); + dimMin.setSize(33, 33); + if (b.getMinimumSize().equals(new Dimension(33, 33))) { + throw new RuntimeException("Test Failed for: " + dimMin); + } + System.out.println("getMinimumSize() Passed."); + + dimMax = b.getMaximumSize(); + dimMax.setSize(33, 33); + if (b.getMaximumSize().equals(new Dimension(33, 33))) { + throw new RuntimeException("Test Failed for: " + dimMax); + } + System.out.println("getMaximumSize() Passed."); + System.out.println("GetSizesTest Succeeded."); + } +} diff --git a/test/jdk/java/awt/Component/PaintGlitchTest/PaintGlitchTest.java b/test/jdk/java/awt/Component/PaintGlitchTest/PaintGlitchTest.java new file mode 100644 index 000000000000..867d82d32629 --- /dev/null +++ b/test/jdk/java/awt/Component/PaintGlitchTest/PaintGlitchTest.java @@ -0,0 +1,225 @@ +/* + * Copyright (c) 1997, 2024, 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 4045781 + * @summary Exposed/damaged canvases don't always update correctly + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual PaintGlitchTest + */ + +import java.awt.Button; +import java.awt.Canvas; +import java.awt.Checkbox; +import java.awt.Choice; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dialog; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Label; +import java.awt.Menu; +import java.awt.MenuBar; +import java.awt.MenuItem; +import java.awt.Panel; +import java.awt.Scrollbar; +import java.awt.TextArea; +import java.awt.TextField; +import java.lang.reflect.InvocationTargetException; +import javax.swing.JButton; +import javax.swing.JCheckBox; +import javax.swing.JComboBox; +import javax.swing.JLabel; +import javax.swing.JList; +import javax.swing.JPanel; +import javax.swing.JScrollBar; +import javax.swing.JTextArea; +import javax.swing.JTextField; + +public class PaintGlitchTest extends Frame { + static final String INSTRUCTIONS = """ + 1. Click on the 'Painting Glitch Test' window and select from + its menu a content type (text, gradient, fill, + AWT components, Swing components etc.). + 2. Select 'Modal Dialog...' to create a dialog. + 3. Drag the dialog over the content very fast + for 10 seconds or so - make sure you + keep dragging while the content is painting. + 4. Verify that the area exposed by the drag (the damaged regions) + always update properly no white areas or bits of the dialog + should be left after the drag operation is + completed (i.e. after you let go of the mouse). + 5. Repeat for all other content types. + 6. If for any content type the damaged dialog is not properly + repainted press Fail. Otherwise press Pass. + """; + + public PaintGlitchTest() { + super("Painting Glitch Test"); + + TextPanel textPanel = new TextPanel(); + GradientPanel gradientPanel = new GradientPanel(); + ComponentPanel componentPanel = new ComponentPanel(); + SwingPanel swingPanel = new SwingPanel(); + + add(textPanel); + + MenuBar menubar = new MenuBar(); + Menu testMenu = new Menu("Test"); + testMenu.add(makeContentItem("Text Lines", textPanel) ); + testMenu.add(makeContentItem("Gradient Fill", gradientPanel) ); + testMenu.add(makeContentItem("AWT Components", componentPanel) ); + testMenu.add(makeContentItem("Swing Components", swingPanel) ); + testMenu.addSeparator(); + MenuItem dialogItem = new MenuItem("Modal Dialog..."); + dialogItem.addActionListener(ev -> new ObscuringDialog(PaintGlitchTest.this).show()); + testMenu.add(dialogItem); + testMenu.addSeparator(); + menubar.add(testMenu); + + setMenuBar(menubar); + setSize(400,300); + } + + public static void main(String args[]) throws InterruptedException, + InvocationTargetException { + PassFailJFrame.builder() + .title("Repaint Glitch") + .testUI(PaintGlitchTest::new) + .instructions(INSTRUCTIONS) + .columns(40) + .logArea() + .build() + .awaitAndCheck(); + } + + public MenuItem makeContentItem(String title, final Component content) { + MenuItem menuItem = new MenuItem(title); + menuItem.addActionListener( + ev -> { + remove(0); + add(content); + validate(); + } + ); + + return menuItem; + } +} + +class GradientPanel extends Canvas { + public void paint(Graphics g) { + long ms = System.currentTimeMillis(); + // just paint something that'll take a while + int x, y; + int width = getSize().width; + int height = getSize().height; + int step = 8; + + for (x = 0; x < width; x += step) { + for (y = 0; y < height; y += step) { + int red = (255 * y) / height; + int green = (255 * x * y) / (width * height); + int blue = (255 * x) / width; + + Color color = new Color(red, green, blue); + g.setColor(color); + g.fillRect(x, y, step, step); + } + } + long time = System.currentTimeMillis() - ms; + PassFailJFrame.log("GradientPanel paint took " + time + " ms"); + } + + public Dimension getPreferredSize() { + return new Dimension(200,1000); + } +} + +class TextPanel extends Canvas { + public void paint(Graphics g) { + long ms = System.currentTimeMillis(); + Font font = new Font("SanSerif", Font.ITALIC, 12); + + g.setFont(font); + // just paint something that'll take a while + int x, y; + int height = getHeight(); + int step = 16; + + for (x = y = 0; y < height; y += step) { + g.drawString(y + " : The quick brown fox jumps over the lazy dog. " + + "The rain in Spain falls mainly on the plain.", x, y); + } + long time = System.currentTimeMillis() - ms; + PassFailJFrame.log("TextPanel paint took " + time + " ms"); + } + + public Dimension getPreferredSize() { + return new Dimension(640,1000); + } +} + +class ComponentPanel extends Panel { + ComponentPanel() { + add(new Label("Label")); + add(new Button("Button")); + add(new Checkbox("Checkbox")); + Choice c = new Choice(); + c.add("choice"); + java.awt.List l = new java.awt.List(); + l.add("list"); + add(new Scrollbar()); + add(new TextField("TextField")); + add(new TextArea("TextArea")); + add(new Panel()); + add(new Canvas()); + } +} + +class SwingPanel extends JPanel { + SwingPanel() { + add(new JLabel("JLabel")); + add(new JButton("JButton")); + add(new JCheckBox("JCheckBox")); + JComboBox c = new JComboBox(); + JList l = new JList(); + add(new JScrollBar()); + add(new JTextField("This is a JTextField with some text in it to make it longer.")); + add(new JTextArea("This is a JTextArea with some text in it to make it longer.")); + } +} + +class ObscuringDialog extends Dialog { + ObscuringDialog(Frame f) { + super(f, "Obscuring Dialog"); + Button ok = new Button("OK, go away"); + ok.addActionListener(ev -> dispose()); + add(ok); + pack(); + } +} diff --git a/test/jdk/java/awt/Component/ProcessEvent/ProcessEvent.java b/test/jdk/java/awt/Component/ProcessEvent/ProcessEvent.java new file mode 100644 index 000000000000..3dfd5a040380 --- /dev/null +++ b/test/jdk/java/awt/Component/ProcessEvent/ProcessEvent.java @@ -0,0 +1,455 @@ +/* + * Copyright (c) 1999, 2024, 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 4292099 + * @summary AWT Event delivery to processEvent + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual ProcessEvent + */ + +import java.awt.AWTEvent; +import java.awt.AWTEventMulticaster; +import java.awt.Adjustable; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.ItemSelectable; +import java.awt.Toolkit; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.AdjustmentEvent; +import java.awt.event.AdjustmentListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.TextEvent; +import java.awt.event.TextListener; +import java.lang.reflect.InvocationTargetException; + +public class ProcessEvent extends Frame { + + static final String INSTRUCTIONS = """ + Press each of the four buttons for ActionEvent, AdjustmentEvent, + ItemEvent and TextEvent. If a message for each corresponding event + appears in the log area and says the event listener was + called, then press Pass otherwise press Fail. + """; + ActionBtn af; + AdjustmentBtn adjf; + ItemBtn itf; + TextBtn txtf; + + public ProcessEvent() { + setLayout(new FlowLayout()); + add(af = new ActionBtn()); + af.setBackground(Color.green); + + add(adjf = new AdjustmentBtn()); + adjf.setBackground(Color.green); + + add(itf = new ItemBtn()); + itf.setBackground(Color.green); + + add(txtf = new TextBtn()); + txtf.setBackground(Color.green); + + // These action listeners simply provide feedback of when + // the event is delivered properly. + af.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent ae) { + PassFailJFrame.log(af.getText() + + ": action listener called: " + + ae.toString()); + } + }); + + adjf.addAdjustmentListener(new AdjustmentListener() { + public void adjustmentValueChanged(AdjustmentEvent ae) { + PassFailJFrame.log(adjf.getText() + + ": adjustment listener called: " + + ae.toString()); + } + }); + + itf.addItemListener(new ItemListener() { + public void itemStateChanged(ItemEvent e) { + PassFailJFrame.log(itf.getText() + + ": item listener called: " + + e.toString()); + } + }); + + txtf.addTextListener(new TextListener() { + public void textValueChanged(TextEvent e) { + PassFailJFrame.log(txtf.getText() + + ": text listener called: " + + e.toString()); + } + }); + + pack(); + } + + public static void main(String[] args) throws InterruptedException, + InvocationTargetException { + PassFailJFrame.builder() + .title("Process Events Test") + .testUI(ProcessEvent::new) + .instructions(INSTRUCTIONS) + .columns(40) + .logArea() + .build() + .awaitAndCheck(); + } +} + +class ButtonComponent extends Component implements ItemSelectable, Adjustable { + + transient protected TextListener textListener; + transient ActionListener actionListener; + transient AdjustmentListener adjustmentListener; + transient ItemListener itemListener; + String actionCommand = null; + + String text = null; + + public ButtonComponent(String label) { + super(); + text = label; + } + + public String getText() { + return text; + } + + public Dimension getPreferredSize() { + return new Dimension(200, 30); + } + + public Dimension getMinimumSize() { + return getPreferredSize(); + } + + public String getActionCommand() { + if (actionCommand == null) + return getText(); + else + return actionCommand; + } + + public void setActionCommand(String ac) { + actionCommand = ac; + } + + // ActionEvent listener support + + public synchronized void addActionListener(ActionListener l) { + if (l == null) { + return; + } + enableEvents(AWTEvent.ACTION_EVENT_MASK); + actionListener = AWTEventMulticaster.add(actionListener, l); + } + + public synchronized void removeActionListener(ActionListener l) { + if (l == null) { + return; + } + actionListener = AWTEventMulticaster.remove(actionListener, l); + } + + // AdjustmentEvent listener support + + public synchronized void addAdjustmentListener(AdjustmentListener l) { + if (l == null) { + return; + } + enableEvents(AWTEvent.ADJUSTMENT_EVENT_MASK); + adjustmentListener = AWTEventMulticaster.add(adjustmentListener, l); + } + + public synchronized void removeAdjustmentListener(AdjustmentListener l) { + if (l == null) { + return; + } + adjustmentListener = AWTEventMulticaster.remove(adjustmentListener, l); + } + + // ItemEvent listener support + + public synchronized void addItemListener(ItemListener l) { + if (l == null) { + return; + } + enableEvents(AWTEvent.ITEM_EVENT_MASK); + itemListener = AWTEventMulticaster.add(itemListener, l); + } + + public synchronized void removeItemListener(ItemListener l) { + if (l == null) { + return; + } + itemListener = AWTEventMulticaster.remove(itemListener, l); + } + + // TextEvent listener support + + public synchronized void addTextListener(TextListener l) { + if (l == null) { + return; + } + enableEvents(AWTEvent.TEXT_EVENT_MASK); + textListener = AWTEventMulticaster.add(textListener, l); + } + + public synchronized void removeTextListener(TextListener l) { + if (l == null) { + return; + } + textListener = AWTEventMulticaster.remove(textListener, l); + } + + // Implement the processEvent and processXXXEvent methods to + // handle reception and processing of the event types. + + protected void processEvent(AWTEvent e) { + if (e instanceof ActionEvent) { + processActionEvent((ActionEvent) e); + return; + } + if (e instanceof AdjustmentEvent) { + processAdjustmentEvent((AdjustmentEvent) e); + return; + } + if (e instanceof ItemEvent) { + processItemEvent((ItemEvent) e); + return; + } + if (e instanceof TextEvent) { + processTextEvent((TextEvent) e); + return; + } + super.processEvent(e); + } + + protected void processActionEvent(ActionEvent e) { + if (actionListener != null) { + actionListener.actionPerformed(e); + } + } + + protected void processAdjustmentEvent(AdjustmentEvent e) { + if (adjustmentListener != null) { + adjustmentListener.adjustmentValueChanged(e); + } + } + + protected void processItemEvent(ItemEvent e) { + if (itemListener != null) { + itemListener.itemStateChanged(e); + } + } + + protected void processTextEvent(TextEvent e) { + if (textListener != null) { + textListener.textValueChanged(e); + } + } + + public void paint(Graphics g) { + Dimension dim = getSize(); + g.clearRect(0, 0, dim.width, dim.height); + g.setColor(getForeground()); + g.drawString(text, 2, dim.height - 2); + } + + /** + * Returns the selected items or null if no items are selected. + */ + public Object[] getSelectedObjects() { + return null; + } + + /** + * Gets the orientation of the adjustable object. + */ + public int getOrientation() { + return 0; + } + + /** + * Gets the minimum value of the adjustable object. + */ + public int getMinimum() { + return 0; + } + + /** + * Sets the minimum value of the adjustable object. + * + * @param min the minimum value + */ + public void setMinimum(int min) { + } + + /** + * Gets the maximum value of the adjustable object. + */ + public int getMaximum() { + return 0; + } + + /** + * Sets the maximum value of the adjustable object. + * + * @param max the maximum value + */ + public void setMaximum(int max) { + } + + /** + * Gets the unit value increment for the adjustable object. + */ + public int getUnitIncrement() { + return 0; + } + + /** + * Sets the unit value increment for the adjustable object. + * + * @param u the unit increment + */ + public void setUnitIncrement(int u) { + } + + /** + * Gets the block value increment for the adjustable object. + */ + public int getBlockIncrement() { + return 0; + } + + /** + * Sets the block value increment for the adjustable object. + * + * @param b the block increment + */ + public void setBlockIncrement(int b) { + } + + /** + * Gets the length of the propertional indicator. + */ + public int getVisibleAmount() { + return 0; + } + + /** + * Sets the length of the proportionl indicator of the + * adjustable object. + * + * @param v the length of the indicator + */ + public void setVisibleAmount(int v) { + } + + /** + * Gets the current value of the adjustable object. + */ + public int getValue() { + return 0; + } + + /** + * Sets the current value of the adjustable object. This + * value must be within the range defined by the minimum and + * maximum values for this object. + * + * @param v the current value + */ + public void setValue(int v) { + } + +} + +class ActionBtn extends ButtonComponent { + public ActionBtn() { + super("ActionEvent"); + addMouseListener(new MouseAdapter() { + public void mouseClicked(MouseEvent e) { + ActionEvent ae = new ActionEvent(e.getSource(), + ActionEvent.ACTION_PERFORMED, + getActionCommand()); + Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(ae); + } + }); + } +} + +class AdjustmentBtn extends ButtonComponent { + public AdjustmentBtn() { + super("AdjustmentEvent"); + addMouseListener(new MouseAdapter() { + public void mouseClicked(MouseEvent e) { + AdjustmentEvent ae = new AdjustmentEvent((Adjustable) e.getSource(), + AdjustmentEvent.ADJUSTMENT_VALUE_CHANGED, + 1, 1); + Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(ae); + } + }); + } +} + +class ItemBtn extends ButtonComponent { + public ItemBtn() { + super("ItemEvent"); + addMouseListener(new MouseAdapter() { + public void mouseClicked(MouseEvent e) { + ItemEvent ae = new ItemEvent((ItemSelectable) e.getSource(), + ItemEvent.ITEM_STATE_CHANGED, + e.getSource(), 1); + Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(ae); + } + }); + } +} + +class TextBtn extends ButtonComponent { + public TextBtn() { + super("TextEvent"); + addMouseListener(new MouseAdapter() { + public void mouseClicked(MouseEvent e) { + TextEvent ae = new TextEvent(e.getSource(), + TextEvent.TEXT_VALUE_CHANGED); + Toolkit.getDefaultToolkit().getSystemEventQueue().postEvent(ae); + } + }); + } +} diff --git a/test/jdk/java/awt/Component/SetFontOrBackground/SetBgrFnt.java b/test/jdk/java/awt/Component/SetFontOrBackground/SetBgrFnt.java new file mode 100644 index 000000000000..02707ad57847 --- /dev/null +++ b/test/jdk/java/awt/Component/SetFontOrBackground/SetBgrFnt.java @@ -0,0 +1,123 @@ +/* + * Copyright (c) 2003, 2024, 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 4906548 4921849 + * @summary Checks that setFont and setBackground have immediate effect + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual SetBgrFnt + */ + +import java.awt.Button; +import java.awt.Canvas; +import java.awt.Checkbox; +import java.awt.Color; +import java.awt.Font; +import java.awt.Frame; +import java.awt.GridLayout; +import java.awt.Label; +import java.lang.reflect.InvocationTargetException; + +public class SetBgrFnt extends Frame { + static final String INSTRUCTIONS = """ + 1. Press a button marked 'Switch fonts' + fonts in three components below (a Button, a Checkbox + and a Label) must change immediately. + + 2. Press a button marked 'Switch background' + background of three components and canvas must change. + MacOS is an exception - AWT buttons on macOS so not + change color so on macOS only canvas, checkbox + and a label should change background. + + If this is the behavior that you observe press Pass, + otherwise press Fail. + """; + Label la; + Button bu, bu1, bu2; + Checkbox cb; + Font font1, font2; + Canvas ca; + boolean bToggleFont = true; + boolean bToggleBg = true; + + public SetBgrFnt() { + bu = new Button("Switch fonts"); + bu1 = new Button("Switch background"); + bu2 = new Button("I'm a button"); + cb = new Checkbox("Checkbox I am"); + la = new Label("I am a label"); + ca = new Canvas(); + font1 = new Font("Serif", Font.ITALIC, 22); + font2 = new Font("SansSerif", Font.PLAIN, 10); + la.setFont(font1); + cb.setFont(font1); + bu2.setFont(font1); + bu.addActionListener(ae -> { + if (bToggleFont) { + la.setFont(font2); + cb.setFont(font2); + bu2.setFont(font2); + } else { + la.setFont(font1); + cb.setFont(font1); + bu2.setFont(font1); + } + bToggleFont = !bToggleFont; + }); + + bu1.addActionListener(ae -> { + if (bToggleBg) { + ca.setBackground(Color.YELLOW); + setBackground(Color.YELLOW); + } else { + ca.setBackground(Color.GREEN); + setBackground(Color.GREEN); + } + bToggleBg = !bToggleBg; + }); + + setLayout(new GridLayout(8, 1)); + add(bu); + add(bu1); + add(new Label()); + add("South", la); + add("South", bu2); + add("South", cb); + add("South", ca); + pack(); + } + + public static void main(String[] args) throws InterruptedException, + InvocationTargetException { + PassFailJFrame.builder() + .title("Set Font and Background Test") + .testUI(SetBgrFnt::new) + .instructions(INSTRUCTIONS) + .columns(40) + .build() + .awaitAndCheck(); + } +} diff --git a/test/jdk/java/awt/Component/ZOrderTest/ZOrderTest.java b/test/jdk/java/awt/Component/ZOrderTest/ZOrderTest.java new file mode 100644 index 000000000000..15003f753a6f --- /dev/null +++ b/test/jdk/java/awt/Component/ZOrderTest/ZOrderTest.java @@ -0,0 +1,159 @@ +/* + * Copyright (c) 1997, 2024, 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 4059430 + * @summary Test for component z-ordering consistency + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual ZOrderTest + */ + +import java.awt.Color; +import java.awt.Component; +import java.awt.Container; +import java.awt.Frame; +import java.awt.GridLayout; +import java.awt.Insets; +import java.awt.Label; +import java.awt.Panel; +import java.lang.reflect.InvocationTargetException; +import java.util.List; + +public class ZOrderTest { + public final static String INSTRUCTIONS = """ + The ZOrderTest creates two frames. + - Frame 1 has components added to an intermediate panel + - Frame 2 has components added directly to the frame itself + Verify that the components are in the correct z-order. Lower numbered + components should overlap higher numbered ones (e.g. component zero should + appear on top of component one). + Both frames should have the same component ordering, and this ordering should + be the same on all supported operating systems. + """; + + public static void main(String [] args) throws InterruptedException, + InvocationTargetException { + PassFailJFrame.builder() + .title("Component ZOrder Test") + .testUI(ZOrderTest::makeFrames) + .instructions(INSTRUCTIONS) + .columns(40) + .logArea() + .build() + .awaitAndCheck(); + } + + private static List makeFrames() { + Frame frame, frame2; + + // test adding components to panel on a frame + frame = new Frame("ZOrderTest(1) for 4059430"); + frame.pack(); + frame.show(); + Panel panel = new ZOrderPanel(); + frame.setBounds(0, 0, 500, 350); + frame.setLayout(new GridLayout()); + frame.add(panel); + doTest(panel); + + // test adding components directly to frame + frame2 = new ZOrderTestFrame("ZOrderTest(2) for 4059430"); + frame2.pack(); + frame2.show(); + frame2.setBounds(80, 80, 500, 350); + doTest(frame2); + + return List.of(frame, frame2); + } + + /* + * This tests various boundary conditions with z-ordering + * - inserting at the top of the z-order + * - inserting at the bottom of the z-order + * - inserting in the middle of the z-order + */ + private static void doTest(Container cont) { + Component compZero, compOne, compTwo, compThree, compFour; + + compZero = makeBox(cont, "Comp One", Color.blue, -1); + // insert on top + compOne = makeBox(cont, "Comp Zero", Color.yellow, 0); + // put at the back + compThree = makeBox(cont, "Comp Three", Color.red, 2); + // insert in last position + compTwo = makeBox(cont, "Comp Two", Color.green, 3); + // swap compTwo and compThree to correct positions + cont.remove(compTwo); + cont.add(compTwo, 2); + // one more test of adding to the end + compFour = makeBox(cont, "Comp Four", Color.magenta, -1); + // re-validate so components cascade into proper place + cont.validate(); + } + + private static Component makeBox(Container cont, String s, Color c, int index) { + Label l = new Label(s); + l.setBackground(c); + l.setAlignment(Label.RIGHT); + if (index == -1) { + cont.add(l); // semantically equivalent to -1, but why not test this too + } else { + cont.add(l, index); + } + cont.validate(); + return l; + } + + /** + * Cascades components across the container so + * that they overlap, demonstrating their z-ordering + */ + static void doCascadeLayout(Container cont) { + int i, n; + Insets ins = cont.insets(); + n = cont.countComponents(); + for (i = n - 1; i >= 0; i--) { + Component comp = cont.getComponent(i); + comp.reshape(ins.left + 75 * i, ins.top + 30 * i, 100, 100); + } + } +} + +class ZOrderPanel extends Panel { + public void layout() { + ZOrderTest.doCascadeLayout(this); + } +} + +class ZOrderTestFrame extends Frame +{ + public ZOrderTestFrame(String title) { + super(title); + } + + public void layout() { + ZOrderTest.doCascadeLayout(this); + } +} diff --git a/test/jdk/java/awt/Cursor/BlockedWindowTest/BlockedWindowTest.java b/test/jdk/java/awt/Cursor/BlockedWindowTest/BlockedWindowTest.java new file mode 100644 index 000000000000..f1313dbb7424 --- /dev/null +++ b/test/jdk/java/awt/Cursor/BlockedWindowTest/BlockedWindowTest.java @@ -0,0 +1,105 @@ +/* + * Copyright (c) 2006, 2024, 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 6391547 + * @summary Test if the JTextField's cursor is changed when there is a modal dialog + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual BlockedWindowTest + */ + +import java.awt.BorderLayout; +import java.awt.Button; +import java.awt.Cursor; +import java.awt.Dialog; +import java.awt.Frame; +import java.awt.TextField; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +class MyDialog extends Dialog implements ActionListener { + MyDialog(Frame owner) { + super(owner, "Modal dialog", true); + setBounds(owner.getX() + 150, owner.getY() + 150, 100, 100); + setLayout(new BorderLayout()); + Button b = new Button("Close"); + add(b, "South"); + b.addActionListener(this); + setVisible(true); + } + + public void actionPerformed(ActionEvent ae) { + setVisible(false); + this.dispose(); + } +} + +class MyFrame extends Frame implements ActionListener { + Dialog d; + + public MyFrame() { + super("ManualYesNoTest"); + Button b = new Button("Click here"); + TextField tf = new TextField("A text field"); + b.addActionListener(this); + setLayout(new BorderLayout()); + setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); + add(b, "South"); + add(tf, "North"); + setSize(300, 300); + } + + public void actionPerformed(ActionEvent ae) { + d = new MyDialog(this); + } +} + +public class BlockedWindowTest { + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + Verify that the hand cursor is displayed over the window and + text cursor over TextField. + Click the button in the window to display a modal dialog. + Verify that default cursor is displayed over the window + and over TextField now. + Then close modal dialog and verify that hand cursor is + displayed over window and text cursor over TextField. + If so, press PASS, else press FAIL. + """; + + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .columns(35) + .testUI(BlockedWindowTest::createUI) + .build() + .awaitAndCheck(); + } + + public static MyFrame createUI() { + MyFrame f = new MyFrame(); + return f; + } +} diff --git a/test/jdk/java/awt/Cursor/CursorDragTest/ListDragCursor.java b/test/jdk/java/awt/Cursor/CursorDragTest/ListDragCursor.java new file mode 100644 index 000000000000..32923f1d78b0 --- /dev/null +++ b/test/jdk/java/awt/Cursor/CursorDragTest/ListDragCursor.java @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2000, 2024, 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 4313052 + * @summary Test cursor changes after mouse dragging ends + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual ListDragCursor + */ + +import java.awt.Cursor; +import java.awt.Frame; +import java.awt.List; +import java.awt.Panel; +import java.awt.TextArea; + +public class ListDragCursor { + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + 1. Move mouse to the TextArea. + 2. Press the left mouse button. + 3. Drag mouse to the list. + 4. Release the left mouse button. + + If the mouse cursor starts as a Text Line Cursor and changes + to a regular Pointer Cursor, then Hand Cursor when hovering + the list, pass the test. This test fails if the cursor does + not update at all when pointing over the different components. + """; + + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(35) + .testUI(ListDragCursor::createUI) + .build() + .awaitAndCheck(); + } + + public static Frame createUI() { + Frame frame = new Frame("Cursor change after drag"); + Panel panel = new Panel(); + + List list = new List(2); + list.add("List1"); + list.add("List2"); + list.add("List3"); + list.add("List4"); + list.setCursor(new Cursor(Cursor.HAND_CURSOR)); + + TextArea textArea = new TextArea(3, 5); + textArea.setCursor(new Cursor(Cursor.TEXT_CURSOR)); + + panel.add(textArea); + panel.add(list); + + frame.add(panel); + frame.setBounds(300, 100, 300, 150); + return frame; + } +} diff --git a/test/jdk/java/awt/Cursor/CursorUpdateTest/CursorUpdateTest.java b/test/jdk/java/awt/Cursor/CursorUpdateTest/CursorUpdateTest.java new file mode 100644 index 000000000000..33e2a3cb166a --- /dev/null +++ b/test/jdk/java/awt/Cursor/CursorUpdateTest/CursorUpdateTest.java @@ -0,0 +1,118 @@ +/* + * Copyright (c) 2004, 2024, 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 5097531 + * @summary Make sure the cursor updates correctly under certain + * circumstances even when the EDT is busy + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual CursorUpdateTest + */ + +import java.awt.Button; +import java.awt.Color; +import java.awt.Component; +import java.awt.Cursor; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.Graphics; + +public class CursorUpdateTest { + final static String progress = "|/-\\"; + + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + Check the following: + 1. Cursor must be crosshair when hovering the mouse over the + blue square. + 2. Crosshair cursor must not flicker. + 3. The cursor must be "I-beam" when hovering the mouse over the + button. + 4. Click the button - it will display "Busy" message and a + rotating bar for 5 seconds. The cursor must change to + hourglass. + 5. (Windows only) While the cursor is on the button, press Alt. + The cursor must change to normal shape. Pressing Alt again + must revert it back to I-beam. + 6. Move the mouse out of the button and back onto it. The cursor + must update correctly (hourglass over the button, normal + over the frame) even when the button displays "busy". + Do not try to check (1) or (5) when the button displays + "Busy" - this is not required. + Pass if all the steps are as behave as described. Otherwise, + fail this test. + """; + + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .columns(35) + .testUI(CursorUpdateTest::createUI) + .build() + .awaitAndCheck(); + } + + public static Frame createUI() { + Frame f = new Frame(); + f.setLayout(new FlowLayout()); + Button b = new Button("Button"); + f.add(b); + b.setCursor(new Cursor(Cursor.TEXT_CURSOR)); + Component c = new MyComponent(); + f.add(c); + c.setCursor(new Cursor(Cursor.CROSSHAIR_CURSOR)); + b.addActionListener(e -> { + String oldLabel = b.getLabel(); + Cursor oldCursor = b.getCursor(); + b.setCursor(new Cursor(Cursor.WAIT_CURSOR)); + try { + for (int i = 0; i < 50; i++) { + b.setLabel("Busy " + progress.charAt(i % 4)); + Thread.sleep(100); + } + } catch (InterruptedException ex) { + } + b.setCursor(oldCursor); + b.setLabel(oldLabel); + }); + return f; + } +} + +class MyComponent extends Component { + public void paint(Graphics g) { + g.setColor(getBackground()); + g.fillRect(0, 0, getSize().width, getSize().height); + } + + public MyComponent() { + setBackground(Color.blue); + } + + public Dimension getPreferredSize() { + return new Dimension(100, 100); + } +} diff --git a/test/jdk/java/awt/Cursor/CustomCursorTest/CustomCursorTest.java b/test/jdk/java/awt/Cursor/CustomCursorTest/CustomCursorTest.java new file mode 100644 index 000000000000..32c1fdc15062 --- /dev/null +++ b/test/jdk/java/awt/Cursor/CustomCursorTest/CustomCursorTest.java @@ -0,0 +1,137 @@ +/* + * Copyright (c) 1999, 2024, 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 4174035 4106384 4205805 + * @summary Test for functionality of Custom Cursor + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual CustomCursorTest + */ + +import java.awt.Color; +import java.awt.Cursor; +import java.awt.Frame; +import java.awt.Graphics2D; +import java.awt.Image; +import java.awt.Panel; +import java.awt.Point; +import java.awt.Toolkit; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.IOException; +import java.nio.file.Path; + +import javax.imageio.ImageIO; +import javax.swing.JFrame; +import javax.swing.JLabel; + +import static java.awt.image.BufferedImage.TYPE_INT_ARGB; + +public class CustomCursorTest { + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + This test is for switching between a custom cursor and the + system cursor. + + 1. Click on the test window panel to change from the default + system cursor to the custom red square cursor + 2. Verify that the square cursor shows when the panel is clicked + 3. Verify that the square cursor is colored red + """; + + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .columns(35) + .testUI(CustomCursorTest::createUI) + .build() + .awaitAndCheck(); + } + + public static Frame createUI() { + JFrame f = new JFrame("Custom Cursor Test"); + CustomCursorPanel c = null; + try { + c = new CustomCursorPanel(); + } catch (IOException e) { + e.printStackTrace(); + } + + f.setIconImage(c.getImage()); + f.getContentPane().add(c); + f.setSize(400, 400); + return f; + } +} + +class CustomCursorPanel extends Panel { + Toolkit toolkit = Toolkit.getDefaultToolkit(); + Image image; + Cursor cursor; + boolean flip = false; + + public CustomCursorPanel() throws IOException { + generateRedSquareCursor(); + + image = toolkit.getImage(System.getProperty("test.classes", ".") + + java.io.File.separator + "square_cursor.gif"); + + setBackground(Color.green); + cursor = toolkit.createCustomCursor(image, new Point(0, 0), "custom"); + + JLabel c = (JLabel) add(new JLabel("click to switch between " + + "red square and default cursors")); + c.setBackground(Color.white); + c.setForeground(Color.red); + + addMouseListener(new MouseAdapter() { + public void mousePressed(MouseEvent me) { + if (!flip) { + setCursor(cursor); + flip = true; + } else { + setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); + flip = false; + } + } + }); + } + + public Image getImage() { + return image; + } + + private static void generateRedSquareCursor() throws IOException { + Path p = Path.of(System.getProperty("test.classes", ".")); + BufferedImage bImg = new BufferedImage(35, 34, TYPE_INT_ARGB); + Graphics2D cg = bImg.createGraphics(); + cg.setColor(Color.RED); + cg.fillRect(0, 0, 35, 34); + ImageIO.write(bImg, "png", new File(p + java.io.File.separator + + "square_cursor.gif")); + } +} diff --git a/test/jdk/java/awt/Cursor/HiddenDialogParentTest/HiddenDialogParentTest.java b/test/jdk/java/awt/Cursor/HiddenDialogParentTest/HiddenDialogParentTest.java new file mode 100644 index 000000000000..7450f4ec3bb7 --- /dev/null +++ b/test/jdk/java/awt/Cursor/HiddenDialogParentTest/HiddenDialogParentTest.java @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2005, 2024, 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 5079694 + * @summary Test if JDialog respects setCursor + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual HiddenDialogParentTest + */ + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Cursor; + +import javax.swing.JDialog; +import javax.swing.JLabel; +import javax.swing.border.LineBorder; + +public class HiddenDialogParentTest { + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + You can see a label area in the center of JDialog. + Verify that the cursor is a hand cursor in this area. + If so, press pass, else press fail. + """; + + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(35) + .testUI(HiddenDialogParentTest::createUI) + .build() + .awaitAndCheck(); + } + + public static JDialog createUI() { + JDialog dialog = new JDialog(); + dialog.setTitle("JDialog Cursor Test"); + dialog.setLayout(new BorderLayout()); + JLabel centerLabel = new JLabel("Cursor should be a hand in this " + + "label area"); + centerLabel.setBorder(new LineBorder(Color.BLACK)); + centerLabel.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); + dialog.add(centerLabel, BorderLayout.CENTER); + dialog.setSize(300, 200); + + return dialog; + } +} diff --git a/test/jdk/java/awt/Cursor/InvalidImageCustomCursorTest/InvalidImageCustomCursorTest.java b/test/jdk/java/awt/Cursor/InvalidImageCustomCursorTest/InvalidImageCustomCursorTest.java new file mode 100644 index 000000000000..9877df342ec6 --- /dev/null +++ b/test/jdk/java/awt/Cursor/InvalidImageCustomCursorTest/InvalidImageCustomCursorTest.java @@ -0,0 +1,95 @@ +/* + * Copyright (c) 1999, 2024, 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 4212593 + * @summary The Toolkit.createCustomCursor does not check absence of the + * image of cursor + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual InvalidImageCustomCursorTest + */ + +import java.awt.BorderLayout; +import java.awt.Button; +import java.awt.Color; +import java.awt.Cursor; +import java.awt.Frame; +import java.awt.Image; +import java.awt.Panel; +import java.awt.Point; +import java.awt.Toolkit; + +public class InvalidImageCustomCursorTest { + static Cursor cursor; + + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + Press 'Hide' button to hide (set transparent) cursor for the + green panel. Move the pointer over the green panel - pointer + should disappear. Press 'Default' button to set default cursor + for the green panel. + + If you see any exceptions or cursor is not transparent, + test failed, otherwise it passed. + """; + + Toolkit tk = Toolkit.getDefaultToolkit(); + Image image = tk.getImage("NON_EXISTING_FILE.gif"); + Point p = new Point(0, 0); + + cursor = tk.createCustomCursor(image, p, "Test"); + + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(35) + .testUI(InvalidImageCustomCursorTest::createUI) + .logArea(5) + .build() + .awaitAndCheck(); + } + + public static Frame createUI() { + Frame f = new Frame("Invalid Cursor Image Test"); + f.setLayout(new BorderLayout()); + f.setSize(200, 200); + + Button def = new Button("Default"); + Button hide = new Button("Hide"); + Panel panel = new Panel(); + + def.addActionListener(e -> panel.setCursor(Cursor.getDefaultCursor())); + hide.addActionListener(e -> panel.setCursor(cursor)); + + panel.setBackground(Color.green); + panel.setSize(100, 100); + f.add("Center", panel); + f.add("North", hide); + f.add("South", def); + + return f; + } +} diff --git a/test/jdk/java/awt/Cursor/JPanelCursorTest/JPanelCursorTest.java b/test/jdk/java/awt/Cursor/JPanelCursorTest/JPanelCursorTest.java new file mode 100644 index 000000000000..33437a6545ed --- /dev/null +++ b/test/jdk/java/awt/Cursor/JPanelCursorTest/JPanelCursorTest.java @@ -0,0 +1,125 @@ +/* + * Copyright (c) 1999, 2024, 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 4114073 + * @summary Test for setCursor in a JPanel when added to a JFrame's contentPane + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual JPanelCursorTest + */ + +import java.awt.Color; +import java.awt.Cursor; +import java.awt.Dimension; +import java.awt.Graphics; + +import javax.swing.JButton; +import javax.swing.JComponent; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.JSplitPane; +import javax.swing.border.BevelBorder; + +public class JPanelCursorTest { + public static void main(String[] args) throws Exception { + final String INSTRUCTIONS = """ + This test checks for setCursor in a JPanel when added to a + JFrame's contentPane. + + 1. Verify that the cursor in the left side of the test window + is a text cursor. + 2. Verify that the cursor changes to the crosshair cursor when + pointing over the button. + 3. Verify that the cursor changes to the hand cursor when in + the right side of the splitpane (and not on the button). + 4. Verify that the cursor changes to the wait cursor when in + the empty bottom section of the test window. + + If true, then pass the test. Otherwise, fail this test. + """; + + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .columns(37) + .testUI(JPanelCursorTest::createUI) + .build() + .awaitAndCheck(); + } + + public static JFrame createUI() { + JFrame frame = new JFrame("Cursor Test Frame"); + + JSplitPane j = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); + ExtJComponent pane = new ExtJComponent(); + + CursorBugPanel panel = new CursorBugPanel(); + + j.setLeftComponent(pane); + j.setRightComponent(panel); + j.setContinuousLayout(true); + j.setSize(200, 200); + + frame.getContentPane().add("North", j); + pane.setCursor(Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR)); + frame.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); + frame.setSize(300, 200); + return frame; + } +} + +class ExtJComponent extends JComponent { + public ExtJComponent() { + super(); + setOpaque(true); + setBackground(Color.green); + setForeground(Color.red); + setBorder(new BevelBorder(BevelBorder.RAISED)); + } + public void paintComponent(Graphics g) { + g.drawString("Text", 20, 30); + } + public Dimension getPreferredSize() { + return new Dimension(100, 100); + } +} + +class CursorBugPanel extends JPanel { + public CursorBugPanel() { + // BUG: fails to set cursor for panel + setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); + + // Create a button + JButton button = new JButton("Crosshair"); + + // Sets cursor for button, no problem + button.setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR)); + add(button); + } + + public void paintComponent(Graphics g) { + g.drawString("Hand", 20, 60); + } +} diff --git a/test/jdk/java/awt/Cursor/NullCursorTest/NullCursorTest.java b/test/jdk/java/awt/Cursor/NullCursorTest/NullCursorTest.java new file mode 100644 index 000000000000..c2398a80eb2b --- /dev/null +++ b/test/jdk/java/awt/Cursor/NullCursorTest/NullCursorTest.java @@ -0,0 +1,154 @@ +/* + * Copyright (c) 1999, 2024, 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 4111379 + * @summary Test for setting cursor to null for lightweight components + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual NullCursorTest + */ + +import java.awt.Button; +import java.awt.Color; +import java.awt.Component; +import java.awt.Container; +import java.awt.Cursor; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Rectangle; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; + +public class NullCursorTest { + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + 1. Hover over each colored area as described: + Green area shows a CrossCursor. + Red area shows a TextCursor. + Yellow area shows a HandCursor. + 2. Click once in red area, then: + Green area shows a HandCursor. + Red area shows a BusyCursor. + Yellow area shows a HandCursor. + 3. Click again in red area, then: + Green area shows a CrossCursor. + Red area shows a HandCursor. + Yellow area shows a HandCursor. + """; + + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(35) + .testUI(NullCursorTest::createUI) + .build() + .awaitAndCheck(); + } + + public static Frame createUI() { + Frame f = new Frame("Null Cursor Test Frame"); + f.setSize(200, 200); + final Container p = f; + p.setName("parent"); + p.setLayout(null); + + final Component green = p.add(new Component() { + public void paint(Graphics g) { + Rectangle r = getBounds(); + g.setColor(Color.green); + g.fillRect(0, 0, r.width, r.height); + } + }); + green.setName("green"); + green.setBackground(Color.red); + green.setBounds(50, 50, 75, 75); + green.setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR)); + + Container h = new Container() { + public void paint(Graphics g) { + Rectangle r = getBounds(); + g.setColor(Color.yellow); + g.fillRect(0, 0, r.width, r.height); + super.paint(g); + } + }; + h.setBounds(15, 25, 150, 150); + h.setName("container"); + h.setBackground(Color.yellow); + h.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); + final Component red = new Component() { + public void paint(Graphics g) { + Rectangle r = getBounds(); + Color c = getBackground(); + g.setColor(c); + g.fillRect(0, 0, r.width, r.height); + super.paint(g); + } + }; + red.setName("red"); + red.setBackground(Color.red); + red.setBounds(10, 10, 120, 120); + red.setCursor(Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR)); + + final Button b = (Button)h.add(new Button("Test")); + b.setBounds(10, 10, 40, 20); + h.add(red); + p.add(h); + + b.addActionListener(new ActionListener() { + boolean f = false; + public void actionPerformed(ActionEvent e) { + if (f) { + b.setCursor(null); + } else { + b.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); + } + f = !f; + } + }); + red.addMouseListener(new MouseAdapter() { + boolean f = true; + + public void mouseClicked(MouseEvent e) { + Component c = (Component)e.getSource(); + if (f) { + c.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); + p.setCursor(Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR)); + green.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); + f = false; + } else { + c.setCursor(null); + p.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); + green.setCursor(Cursor.getPredefinedCursor(Cursor.CROSSHAIR_CURSOR)); + f = true; + } + } + }); + return f; + } +} diff --git a/test/jdk/java/awt/Cursor/SetCursorTest/SetCursorTest.java b/test/jdk/java/awt/Cursor/SetCursorTest/SetCursorTest.java new file mode 100644 index 000000000000..87f028eb4f61 --- /dev/null +++ b/test/jdk/java/awt/Cursor/SetCursorTest/SetCursorTest.java @@ -0,0 +1,82 @@ +/* + * Copyright (c) 1999, 2024, 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 4160080 + * @summary Test setCursor() on lightweight components when event is generated + * by a button + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual SetCursorTest + */ + +import java.awt.Cursor; + +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JPanel; + + +public class SetCursorTest { + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + This test checks for the behavior of setCursor() when called in + a JFrame's JButton action event. + + 1. Click the "OK" button in the test window. + 2. Verify that the cursor changes to the waiting cursor instead + of the default system cursor. + + If true, then pass the test. Otherwise, fail this test. + """; + + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .columns(35) + .testUI(SetCursorTest::createUI) + .build() + .awaitAndCheck(); + } + + public static myFrame createUI() { + myFrame f = new myFrame(); + return f; + } +} + +class myFrame extends JFrame { + public myFrame() { + super("SetCursor With Button Test"); + setSize(200, 200); + + final JPanel p = new JPanel(); + final JButton okButton = new JButton("OK"); + okButton.addActionListener(e -> + setCursor(new Cursor(Cursor.WAIT_CURSOR))); + + p.add(okButton); + getContentPane().add(p); + } +} diff --git a/test/jdk/java/awt/Desktop/ActionSupportTest.java b/test/jdk/java/awt/Desktop/ActionSupportTest.java new file mode 100644 index 000000000000..e5cdec0e4224 --- /dev/null +++ b/test/jdk/java/awt/Desktop/ActionSupportTest.java @@ -0,0 +1,201 @@ +/* + * Copyright (c) 2005, 2024, 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 6255196 + * @key headful + * @summary Verifies the supported actions on different platforms. + * @library /test/lib + * @run main/othervm ActionSupportTest + */ + +import java.awt.Desktop; +import java.io.File; +import java.net.URI; +import javax.swing.JMenuBar; +import jtreg.SkippedException; + +import static java.awt.desktop.QuitStrategy.NORMAL_EXIT; + +public class ActionSupportTest { + + public static void main(String[] args) { + final File file = new File("nonExistentFile"); + final URI uri = URI.create("nonExistentSchema:anything"); + final StringBuilder error = new StringBuilder(); + + if (!Desktop.isDesktopSupported()) { + throw new SkippedException("Class java.awt.Desktop is not supported on " + + "current platform. Farther testing will not be performed"); + } + + Desktop desktop = Desktop.getDesktop(); + for (Desktop.Action action : Desktop.Action.values()) { + boolean supported = desktop.isSupported(action); + + try { + switch (action) { + case OPEN: + // if not supported, an UnsupportedOperationException will be thrown. + // if supported, other exception might be thrown. + desktop.open(file); + break; + case EDIT: + // if not supported, an UnsupportedOperationException will be thrown. + // if supported, other exception might be thrown. + desktop.edit(file); + break; + case PRINT: + // if not supported, an UnsupportedOperationException will be thrown. + // if supported, other exception might be thrown. + desktop.print(file); + break; + case MAIL: + // if not supported, an UnsupportedOperationException will be thrown. + // if supported, other exception might be thrown. + desktop.mail(uri); + break; + case BROWSE: + if (supported) { + continue; // prevent native message about strange schema + } + // if not supported, an UnsupportedOperationException will be thrown. + // if supported, other exception might be thrown. + desktop.browse(uri); + break; + case APP_EVENT_FOREGROUND: + case APP_EVENT_HIDDEN: + case APP_EVENT_REOPENED: + case APP_EVENT_SCREEN_SLEEP: + case APP_EVENT_SYSTEM_SLEEP: + case APP_EVENT_USER_SESSION: + continue; // Has no effect if SystemEventListener's sub-type + // is unsupported on the current platform. + case APP_ABOUT: + // if not supported, an UnsupportedOperationException will be thrown. + // if supported, other exception might be thrown. + desktop.setAboutHandler(e -> { + }); + break; + case APP_PREFERENCES: + // if not supported, an UnsupportedOperationException will be thrown. + // if supported, other exception might be thrown. + desktop.setPreferencesHandler(e -> { + }); + break; + case APP_OPEN_FILE: + // if not supported, an UnsupportedOperationException will be thrown. + // if supported, other exception might be thrown. + desktop.setOpenFileHandler(e -> { + }); + break; + case APP_PRINT_FILE: + // if not supported, an UnsupportedOperationException will be thrown. + // if supported, other exception might be thrown. + desktop.setPrintFileHandler(e -> { + }); + break; + case APP_OPEN_URI: + // if not supported, an UnsupportedOperationException will be thrown. + // if supported, other exception might be thrown. + desktop.setOpenURIHandler(e -> { + }); + break; + case APP_QUIT_HANDLER: + // if not supported, an UnsupportedOperationException will be thrown. + // if supported, other exception might be thrown. + desktop.setQuitHandler((e, response) -> { + }); + break; + case APP_QUIT_STRATEGY: + // if not supported, an UnsupportedOperationException will be thrown. + // if supported, other exception might be thrown. + desktop.setQuitStrategy(NORMAL_EXIT); + break; + case APP_SUDDEN_TERMINATION: + // if not supported, an UnsupportedOperationException will be thrown. + // if supported, other exception might be thrown. + desktop.enableSuddenTermination(); + break; + case APP_REQUEST_FOREGROUND: + // if not supported, an UnsupportedOperationException will be thrown. + // if supported, other exception might be thrown. + desktop.requestForeground(true); + break; + case APP_HELP_VIEWER: + if (supported) { + continue; // prevent open separate window + } + // if not supported, an UnsupportedOperationException will be thrown. + // if supported, other exception might be thrown. + desktop.openHelpViewer(); + break; + case APP_MENU_BAR: + // if not supported, an UnsupportedOperationException will be thrown. + // if supported, other exception might be thrown. + desktop.setDefaultMenuBar(new JMenuBar()); + break; + case BROWSE_FILE_DIR: + // if not supported, an UnsupportedOperationException will be thrown. + // if supported, other exception might be thrown. + desktop.browseFileDirectory(file); + break; + case MOVE_TO_TRASH: + // if not supported, an UnsupportedOperationException will be thrown. + // if supported, other exception might be thrown. + desktop.moveToTrash(file); + break; + } + // no exception has been thrown. + if (!supported) { + error.append("Action " + action.name() + " is an " + + "unsupported operation, but no exception has been thrown\n"); + } + } catch (UnsupportedOperationException uoe) { + if (!supported) { + System.out.println("Action " + action.name() + "is not supported."); + } else { + error.append("Action " + action.name() + " is a " + + "supported operation, " + + "but UnsupportedOperationException has been thrown\n"); + } + } catch (Exception e) { + if (supported) { + System.out.println("Action " + action.name() + "supported."); + } else { + error.append("Action " + action.name() + " is an " + + "unsupported operation, but " + + "UnsupportedOperationException has not been thrown\n"); + } + } + } + + if (!error.isEmpty()) { + System.err.println(error); + throw new RuntimeException("One or more tests failed. " + + "Look at the error output for details"); + } + System.out.println("Test completed"); + } +} diff --git a/test/jdk/java/awt/Desktop/BrowseTest.java b/test/jdk/java/awt/Desktop/BrowseTest.java new file mode 100644 index 000000000000..1bdccace3fc8 --- /dev/null +++ b/test/jdk/java/awt/Desktop/BrowseTest.java @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2005, 2024, 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 6255196 + * @summary Verifies the function of method browse(java.net.URI uri). + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual BrowseTest + */ + +import java.awt.Desktop; +import java.io.File; +import java.lang.reflect.InvocationTargetException; +import java.net.URI; +import javax.swing.JPanel; + +public class BrowseTest extends JPanel { + static final String INSTRUCTIONS = """ + This test could launch default file manager to open user's home + directory, and default web browser to show the URL of java vendor. + After test execution close the native file manager and web browser + windows if they were launched by test. + Also check output for any unexpected EXCEPTIONS, + if you see any failure messages press Fail otherwise press Pass. + """; + + public BrowseTest() { + if (!Desktop.isDesktopSupported()) { + PassFailJFrame.log("Class java.awt.Desktop is not supported on " + + "current platform. Farther testing will not be performed"); + PassFailJFrame.forcePass(); + } + + Desktop desktop = Desktop.getDesktop(); + + URI dirURI = new File(System.getProperty("user.home")).toURI(); + URI webURI = URI.create(System.getProperty("java.vendor.url", "http://www.java.com")); + boolean failed = false; + try { + PassFailJFrame.log("Try to browse " + dirURI + " ..."); + desktop.browse(dirURI); + PassFailJFrame.log("Succeed.\n"); + } catch (Exception e) { + PassFailJFrame.log("EXCEPTION: " + e.getMessage()); + } + + try { + PassFailJFrame.log("Try to browse " + webURI + " ..."); + desktop.browse(webURI); + PassFailJFrame.log("Succeed.\n"); + } catch (Exception e) { + PassFailJFrame.log("EXCEPTION: " + e.getMessage()); + } + } + + public static void main(String[] args) throws InterruptedException, + InvocationTargetException { + PassFailJFrame.builder() + .title("Browser Test") + .splitUI(BrowseTest::new) + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 1) + .columns(40) + .logArea() + .build() + .awaitAndCheck(); + } +} diff --git a/test/jdk/java/awt/Desktop/DesktopSupportTest.java b/test/jdk/java/awt/Desktop/DesktopSupportTest.java new file mode 100644 index 000000000000..ec8b82ba5ef2 --- /dev/null +++ b/test/jdk/java/awt/Desktop/DesktopSupportTest.java @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2005, 2024, 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 6255196 + * @key headful + * @summary Verifies if class Desktop is supported on current platform. + * @run main DesktopSupportTest + */ + +import java.awt.Desktop; + +public class DesktopSupportTest { + public static void main(String[] args) { + boolean supported = Desktop.isDesktopSupported(); + try { + Desktop desktop = Desktop.getDesktop(); + if (!supported) { + throw new RuntimeException("UnsupportedOperationException " + + "should be thrown, as this class is not supported " + + "on current platform."); + } + } catch (UnsupportedOperationException uoe) { + if (supported) { + throw new RuntimeException("UnsupportedOperationException " + + "should NOT be thrown, as this class is supported " + + "on current platform."); + } + } catch (Exception e) { + if (!supported) { + throw new RuntimeException("UnsupportedOperationException " + + "should be thrown, as this class is not supported " + + "on current platform. But " + e.getClass().getName() + + " has been thrown instead."); + } + } + } +} diff --git a/test/jdk/java/awt/Desktop/EditAndPrintTest/EditAndPrintTest.java b/test/jdk/java/awt/Desktop/EditAndPrintTest/EditAndPrintTest.java new file mode 100644 index 000000000000..3f161f7fcaf9 --- /dev/null +++ b/test/jdk/java/awt/Desktop/EditAndPrintTest/EditAndPrintTest.java @@ -0,0 +1,152 @@ +/* + * Copyright (c) 2005, 2024, 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 + * @key printer + * @bug 6255196 + * @summary Verifies the function of methods edit(java.io.File file) and + * print(java.io.File file) + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual EditAndPrintTest + */ + +import java.awt.Desktop; +import java.awt.Desktop.Action; +import java.io.File; +import java.io.FileWriter; +import java.io.IOException; +import java.lang.reflect.InvocationTargetException; +import javax.swing.JPanel; + +public class EditAndPrintTest extends JPanel { + + static final String INSTRUCTIONS = """ + This test tries to edit and print a directory, which will expectedly raise IOException. + Then this test would edit and print a .txt file, which should be successful. + After test execution close the editor if it was launched by test. + If you see any EXCEPTION messages in the output press FAIL. + """; + + public EditAndPrintTest() { + if (!Desktop.isDesktopSupported()) { + PassFailJFrame.log("Class java.awt.Desktop is not supported on " + + "current platform. Further testing will not be performed"); + PassFailJFrame.forcePass(); + } + + Desktop desktop = Desktop.getDesktop(); + + if (!desktop.isSupported(Action.PRINT) && !desktop.isSupported(Action.EDIT)) { + PassFailJFrame.log("Neither EDIT nor PRINT actions are supported. Nothing to test."); + PassFailJFrame.forcePass(); + } + + /* + * Part 1: print or edit a directory, which should throw an IOException. + */ + File userHome = new File(System.getProperty("user.home")); + try { + if (desktop.isSupported(Action.EDIT)) { + PassFailJFrame.log("Trying to edit " + userHome); + desktop.edit(userHome); + PassFailJFrame.log("No exception has been thrown for editing " + + "directory " + userHome.getPath()); + PassFailJFrame.log("Test failed."); + } else { + PassFailJFrame.log("Action EDIT is unsupported."); + } + } catch (IOException e) { + PassFailJFrame.log("Expected IOException is caught."); + } + + try { + if (desktop.isSupported(Action.PRINT)) { + PassFailJFrame.log("Trying to print " + userHome); + desktop.print(userHome); + PassFailJFrame.log("No exception has been thrown for printing " + + "directory " + userHome.getPath()); + PassFailJFrame.log("Test failed."); + } else { + PassFailJFrame.log("Action PRINT is unsupported.\n"); + } + } catch (IOException e) { + PassFailJFrame.log("Expected IOException is caught."); + } + + /* + * Part 2: print or edit a normal .txt file, which may succeed if there + * is associated application to print or edit the given file. It fails + * otherwise. + */ + // Create a temp .txt file for test. + String testFilePath = System.getProperty("java.io.tmpdir") + File.separator + "JDIC-test.txt"; + File testFile = null; + try { + PassFailJFrame.log("Creating temporary file."); + testFile = File.createTempFile("JDIC-test", ".txt", new File(System.getProperty("java.io.tmpdir"))); + testFile.deleteOnExit(); + FileWriter writer = new FileWriter(testFile); + writer.write("This is a temp file used to test print() method of Desktop."); + writer.flush(); + writer.close(); + } catch (java.io.IOException ioe){ + PassFailJFrame.log("EXCEPTION: " + ioe.getMessage()); + PassFailJFrame.forceFail("Failed to create temp file for testing."); + } + + try { + if (desktop.isSupported(Action.EDIT)) { + PassFailJFrame.log("Try to edit " + testFile); + desktop.edit(testFile); + PassFailJFrame.log("Succeed."); + } + } catch (IOException e) { + PassFailJFrame.log("EXCEPTION: " + e.getMessage()); + } + + try { + if (desktop.isSupported(Action.PRINT)) { + PassFailJFrame.log("Trying to print " + testFile); + desktop.print(testFile); + PassFailJFrame.log("Succeed."); + } + } catch (IOException e) { + PassFailJFrame.log("EXCEPTION: " + e.getMessage()); + } + } + + public static void main(String args[]) throws InterruptedException, + InvocationTargetException { + PassFailJFrame.builder() + .title("Edit and Print test") + .splitUI(EditAndPrintTest::new) + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 1) + .columns(60) + .logArea() + .build() + .awaitAndCheck(); + } +} diff --git a/test/jdk/java/awt/Desktop/MailTest.java b/test/jdk/java/awt/Desktop/MailTest.java new file mode 100644 index 000000000000..2775a671310e --- /dev/null +++ b/test/jdk/java/awt/Desktop/MailTest.java @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2005, 2025, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Desktop; +import java.io.IOException; +import java.lang.reflect.InvocationTargetException; +import java.net.URI; +import javax.swing.JPanel; + +import jtreg.SkippedException; + +/* + * @test + * @bug 6255196 + * @summary Verifies the function of methods mail() and mail(java.net.URI uri). + * @library /java/awt/regtesthelpers /test/lib + * @build PassFailJFrame jtreg.SkippedException + * @run main/manual MailTest + */ + +public class MailTest extends JPanel { + + static final String INSTRUCTIONS = """ + This test could launch the mail client to compose mail + with and without filling the message fields. + After test execution close the mail composing windows if they + were launched by test. + If you see any unexpected EXCEPTION messages in the output + press Fail. Otherwise press Pass. + """; + + private MailTest() { + Desktop desktop = Desktop.getDesktop(); + /* + * Part 1: launch the mail composing window without a mailto URI. + */ + try { + desktop.mail(); + } catch (IOException e) { + PassFailJFrame.log("EXCEPTION: " + e.getMessage()); + } + + /* + * Part 2: launch the mail composing window with a mailto URI. + */ + URI testURI = null; + try { + testURI = new URI("mailto", "foo@bar.com?subject=test subject" + + "&cc=foocc@bar.com&body=test body", null); + desktop.mail(testURI); + } catch (IOException e) { + PassFailJFrame.log("EXCEPTION: " + e.getMessage()); + } catch (java.net.URISyntaxException use) { + // Should not reach here. + PassFailJFrame.log("EXCEPTION: " + use.getMessage()); + } + + /* + * Part 3: try to launch the mail composing window with a URI with a + * scheme which is not "mailto": + * http://java.net. + * An IOException should be thrown in this case. + */ + try { + testURI = URI.create("http://java.com"); + PassFailJFrame.log("Try to mail: " + testURI); + desktop.mail(testURI); + } catch (IllegalArgumentException e) { + PassFailJFrame.log("Caught expected IllegalArgumentException"); + } catch (IOException ioe) { + PassFailJFrame.log("EXCEPTION: " + ioe.getMessage()); + } + } + + public static void main(String[] args) throws InterruptedException, + InvocationTargetException { + if (!Desktop.isDesktopSupported()) { + throw new SkippedException("Class java.awt.Desktop is not supported " + + "on current platform. Further testing will not be performed"); + } + + if (!Desktop.getDesktop().isSupported(Desktop.Action.MAIL)) { + throw new SkippedException("Action.MAIL is not supported."); + } + + PassFailJFrame.builder() + .title("Mail Test") + .splitUI(MailTest::new) + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 1) + .columns(40) + .logArea() + .build() + .awaitAndCheck(); + } +} diff --git a/test/jdk/java/awt/Desktop/OpenTest.java b/test/jdk/java/awt/Desktop/OpenTest.java new file mode 100644 index 000000000000..1ed29067d50e --- /dev/null +++ b/test/jdk/java/awt/Desktop/OpenTest.java @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2005, 2024, 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 6255196 + * @summary Verifies the function of method open(java.io.File file). + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual/othervm OpenTest + */ + +import java.awt.Desktop; +import java.io.File; +import java.io.IOException; +import java.lang.reflect.InvocationTargetException; +import javax.swing.JPanel; + +public class OpenTest extends JPanel { + + static final String INSTRUCTIONS = """ + This test could open the user's home directory and a .txt file. + After test execution, close the native application windows that + are used to open the directory and .txt file if they were launched + by the test. + If you see any unexpected EXCEPTION messages in the output press Fail. + Otherwise press Pass. + """; + + public OpenTest() { + if (!Desktop.isDesktopSupported()) { + PassFailJFrame.log("Class java.awt.Desktop is not supported on " + + "current platform. Further testing will not be performed"); + PassFailJFrame.forcePass(); + } + + Desktop desktop = Desktop.getDesktop(); + + /* + * Part 1: open a directory, which should launch the system default + * file explorer. + * + * On Windows platforms, the default file explorer is explorer; + * on UNIX platforms with Gnome installed and running, the default + * file explorer is Nautilus. + */ + File userHome = new File(System.getProperty("user.home")); + + try { + PassFailJFrame.log("Try to open " + userHome); + desktop.open(userHome); + PassFailJFrame.log("Succeed."); + } catch (IOException e) { + PassFailJFrame.log("EXCEPTION: " + e.getMessage()); + } + + /* + * Part 2: open a normal .txt file, which should launch the registered + * application for .txt files. + */ + // Create a temp .txt file for test. + File testFile = null; + try { + PassFailJFrame.log("Creating temporary file"); + testFile = File.createTempFile("JDIC-test", ".txt", + new File(System.getProperty("java.io.tmpdir"))); + testFile.deleteOnExit(); + } catch (java.io.IOException ioe) { + PassFailJFrame.log("EXCEPTION: " + ioe.getMessage()); + PassFailJFrame.log("Failed to create test file"); + } + + try { + PassFailJFrame.log("Try to open " + testFile); + desktop.open(testFile); + PassFailJFrame.log("Succeed."); + } catch (IOException e) { + PassFailJFrame.log("EXCEPTION: " + e.getMessage()); + } + } + + public static void main(String[] args) throws InterruptedException, + InvocationTargetException { + PassFailJFrame.builder() + .title("Mail Test") + .splitUI(OpenTest::new) + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 1) + .columns(40) + .logArea() + .build() + .awaitAndCheck(); + } +} diff --git a/test/jdk/java/awt/Dialog/ChoiceModalDialogTest.java b/test/jdk/java/awt/Dialog/ChoiceModalDialogTest.java new file mode 100644 index 000000000000..97ce5a83a96b --- /dev/null +++ b/test/jdk/java/awt/Dialog/ChoiceModalDialogTest.java @@ -0,0 +1,140 @@ +/* + * Copyright (c) 2005, 2024, 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 6213128 + * @key headful + * @summary Tests that choice is releasing input capture when a modal + * dialog is shown + * @run main ChoiceModalDialogTest + */ + +import java.awt.Choice; +import java.awt.Dialog; +import java.awt.EventQueue; +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.Robot; +import java.awt.TextField; +import java.awt.event.FocusAdapter; +import java.awt.event.FocusEvent; +import java.awt.event.InputEvent; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; + +public class ChoiceModalDialogTest { + static Frame f; + static Dialog d; + static volatile boolean keyOK; + static volatile boolean mouseOK; + static TextField tf; + static Choice c; + + public static void main(String[] args) throws Exception { + Robot r; + try { + r = new Robot(); + r.setAutoDelay(100); + EventQueue.invokeAndWait(() -> { + f = new Frame("Frame"); + c = new Choice(); + f.setBounds(100, 300, 300, 200); + f.setLayout(new FlowLayout()); + tf = new TextField(3); + f.add(tf); + + c.add("1"); + c.add("2"); + c.add("3"); + c.add("4"); + f.add(c); + + tf.addFocusListener(new FocusAdapter() { + public void focusLost(FocusEvent ev) { + d = new Dialog(f, "Dialog", true); + d.setBounds(300, 300, 200, 150); + d.addKeyListener(new KeyAdapter() { + public void keyPressed(KeyEvent ev) { + keyOK = true; + } + }); + d.addMouseListener(new MouseAdapter() { + public void mousePressed(MouseEvent ev) { + mouseOK = true; + } + }); + d.setVisible(true); + } + }); + + f.setVisible(true); + f.toFront(); + }); + r.waitForIdle(); + r.delay(1000); + EventQueue.invokeAndWait(() -> { + r.mouseMove(tf.getLocationOnScreen().x + tf.getSize().width / 2, + tf.getLocationOnScreen().y + tf.getSize().height / 2); + }); + r.waitForIdle(); + r.delay(500); + EventQueue.invokeAndWait(() -> { + r.mouseMove(c.getLocationOnScreen().x + c.getSize().width - 4, + c.getLocationOnScreen().y + c.getSize().height / 2); + r.mousePress(InputEvent.BUTTON1_DOWN_MASK); + r.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + }); + r.waitForIdle(); + r.delay(500); + EventQueue.invokeAndWait(() -> { + r.mouseMove(d.getLocationOnScreen().x + d.getSize().width / 2, + d.getLocationOnScreen().y + d.getSize().height / 2); + r.mousePress(InputEvent.BUTTON1_DOWN_MASK); + r.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + r.keyPress(KeyEvent.VK_A); + r.keyRelease(KeyEvent.VK_A); + }); + r.waitForIdle(); + r.delay(500); + if (!mouseOK) { + throw new RuntimeException("Test Failed due to Mouse release failure!"); + } + if (!keyOK) { + throw new RuntimeException("Test Failed due to Key release failure!"); + } + System.out.println("Test Passed!"); + } finally { + EventQueue.invokeAndWait(() -> { + if (d != null) { + d.dispose(); + } + if (f != null) { + f.dispose(); + } + }); + } + } +} diff --git a/test/jdk/java/awt/Dialog/DialogBackgroundTest.java b/test/jdk/java/awt/Dialog/DialogBackgroundTest.java new file mode 100644 index 000000000000..793782fc43be --- /dev/null +++ b/test/jdk/java/awt/Dialog/DialogBackgroundTest.java @@ -0,0 +1,153 @@ +/* + * Copyright (c) 1999, 2024, 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 4255230 4191946 + * @summary Tests to verify Dialog inherits background from its owner + * @requires (os.family == "windows") + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual DialogBackgroundTest + */ + +import java.awt.Button; +import java.awt.Color; +import java.awt.Dialog; +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.Label; +import java.awt.Menu; +import java.awt.MenuBar; +import java.awt.MenuItem; +import java.awt.TextField; +import java.awt.Window; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; + +public class DialogBackgroundTest { + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + Perform the following steps: + 1) Select "New Frame" from the "File" menu of the + "TreeCopy Frame #1" frame. + 2) Select "Configure" from the "File" menu in the + *new* frame. + If label text "This is a label:" in the appeared + "Configuration Dialog" dialog has a grey background + test PASSES, otherwise it FAILS + """; + TreeCopy treeCopy = new TreeCopy(++TreeCopy.windowCount, null); + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(35) + .testUI(treeCopy) + .logArea(8) + .build() + .awaitAndCheck(); + } +} + +class TreeCopy extends Frame implements ActionListener { + TextField tfRoot; + ConfigDialog configDlg; + MenuItem miConfigure = new MenuItem("Configure..."); + MenuItem miNewWindow = new MenuItem("New Frame"); + static int windowCount = 0; + Window parent; + + public TreeCopy(int windowNum, Window myParent) { + super(); + setTitle("TreeCopy Frame #" + windowNum); + MenuBar mb = new MenuBar(); + Menu m = new Menu("File"); + configDlg = new ConfigDialog(this); + parent = myParent; + + m.add(miConfigure); + m.add(miNewWindow); + miConfigure.addActionListener(this); + miNewWindow.addActionListener(this); + mb.add(m); + setMenuBar(mb); + m.addActionListener(this); + + tfRoot = new TextField(); + tfRoot.setEditable(false); + add(tfRoot); + + addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent we) { + dispose(); + } + }); + + setSize(200, 100); + setLocationRelativeTo(parent); + } + + public void actionPerformed(ActionEvent ae) { + Object source = ae.getSource(); + + if (source == miConfigure) { + configDlg.setVisible(true); + if (configDlg.getBackground() != configDlg.labelColor) + PassFailJFrame.log("FAIL: Test failed!!!"); + } else if (source == miNewWindow) { + new TreeCopy(++windowCount, this).setVisible(true); + } + } +} + +class ConfigDialog extends Dialog implements ActionListener { + public Button okButton; + public Button cancelButton; + public Label l2; + public Color labelColor; + + public ConfigDialog(Frame parent) { + super(parent, "Configuration Dialog"); + okButton = new Button("OK"); + cancelButton = new Button("Cancel"); + l2 = new Label("This is a label:"); + + setLayout(new FlowLayout()); + add(l2); + add(okButton); + add(cancelButton); + + okButton.addActionListener(this); + cancelButton.addActionListener(this); + + pack(); + labelColor = l2.getBackground(); + } + + public void actionPerformed(ActionEvent ae) { + dispose(); + } +} diff --git a/test/jdk/java/awt/Dialog/DialogIconTest/DialogIconTest.java b/test/jdk/java/awt/Dialog/DialogIconTest/DialogIconTest.java new file mode 100644 index 000000000000..06debe28fc55 --- /dev/null +++ b/test/jdk/java/awt/Dialog/DialogIconTest/DialogIconTest.java @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; +import java.awt.Frame; +import java.awt.Image; +import java.awt.Label; +import java.awt.MediaTracker; +import java.awt.Toolkit; +import java.awt.Window; +import java.util.List; + +/* + * @test + * @bug 4779641 + * @summary Test to verify that Non-resizable dialogs should not show icons + * @requires (os.family == "windows") + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual DialogIconTest + */ + +public class DialogIconTest { + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + 1. This is a Windows-only test of Dialog icons + 2. You can see a frame with a swing icon and two dialogs that it + owns. The resizable dialog should have the same icon as the + frame. The non-resizable dialog should have no icon at all + 3. Press PASS if this is true, press FAIL otherwise + """; + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(35) + .testUI(initialize()) + .build() + .awaitAndCheck(); + } + + public static List initialize() { + Frame f = new Frame("Parent frame"); + f.setBounds(50, 50, 200, 200); + + Dialog dr = new Dialog(f, "Resizable Dialog"); + dr.setLocation(100, 100); + dr.add(new Label("Should inherit icon from parent")); + dr.pack(); + + Dialog dn = new Dialog(f, "NON Resizable Dialog"); + dn.setLocation(150, 150); + dn.add(new Label("Should have no icon")); + dn.pack(); + dn.setResizable(false); + + String fileName = System.getProperty("test.src") + + System.getProperty("file.separator") + "swing.small.gif"; + + Image icon = Toolkit.getDefaultToolkit().createImage(fileName); + MediaTracker tracker = new MediaTracker(f); + tracker.addImage(icon, 0); + try { + tracker.waitForAll(); + } catch (InterruptedException ie) { + throw new RuntimeException("MediaTracker addImage Interrupted!"); + } + f.setIconImage(icon); + return List.of(f, dn, dr); + } +} diff --git a/test/jdk/java/awt/Dialog/DialogIconTest/swing.small.gif b/test/jdk/java/awt/Dialog/DialogIconTest/swing.small.gif new file mode 100644 index 000000000000..14a489ff4e7d Binary files /dev/null and b/test/jdk/java/awt/Dialog/DialogIconTest/swing.small.gif differ diff --git a/test/jdk/java/awt/Dialog/DialogModalityTest.java b/test/jdk/java/awt/Dialog/DialogModalityTest.java new file mode 100644 index 000000000000..d8ac9e4620b4 --- /dev/null +++ b/test/jdk/java/awt/Dialog/DialogModalityTest.java @@ -0,0 +1,114 @@ +/* + * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.BorderLayout; +import java.awt.Button; +import java.awt.Component; +import java.awt.Dialog; +import java.awt.Event; +import java.awt.Frame; +import java.awt.Panel; +import java.awt.Window; +import java.util.List; + +/* + * @test + * @bug 4058370 + * @summary Test to verify Modality of Dialog + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual DialogModalityTest + */ + +public class DialogModalityTest { + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + 1. When the test is running, there will be a Frame, a Modal Dialog + and a Window that is Modal Dialog's parent. + 2. Verify that it is impossible to bring up the menu in Frame before + closing the Modal Dialog. + """; + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(35) + .testUI(initialize()) + .build() + .awaitAndCheck(); + } + + public static List initialize() { + Frame f = new Frame("Parent Frame"); + DialogTest dlg = new DialogTest(f, "Modal Dialog"); + f.add(new Button("push me")); + f.setSize(200, 200); + f.setLocation(210, 1); + dlg.setBounds(210, 203, 200, 200); + return List.of(f, dlg); + } +} + +class DialogTest extends Dialog { + Button closeButton; + Frame parent; + + public DialogTest(Frame parent, String title) { + this(parent, title, true); + } + + public DialogTest(Frame parent, String title, boolean modal) { + super(parent, title, modal); + this.parent = parent; + setLayout(new BorderLayout()); + Panel buttonPanel = new Panel(); + closeButton = new Button("Close"); + buttonPanel.add(closeButton); + add("Center", buttonPanel); + pack(); + } + + public boolean action(Event e, Object arg) { + if (e.target == closeButton) { + Dialog dialog = null; + Component c = (Component) e.target; + + while (c != null && !(c instanceof Dialog)) { + c = c.getParent(); + } + + if (c != null) { + dialog = (Dialog) c; + } + + if (dialog == null) { + return false; + } + + dialog.setVisible(false); + dialog.dispose(); + return true; + } + return false; + } +} diff --git a/test/jdk/java/awt/Dialog/DialogResizeTest.java b/test/jdk/java/awt/Dialog/DialogResizeTest.java new file mode 100644 index 000000000000..e57a52980687 --- /dev/null +++ b/test/jdk/java/awt/Dialog/DialogResizeTest.java @@ -0,0 +1,118 @@ +/* + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Checkbox; +import java.awt.Dialog; +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.Panel; +import java.awt.TextArea; +import java.awt.event.ComponentEvent; +import java.awt.event.ComponentListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.lang.Exception; +import java.lang.String; +import java.lang.System; + +/* + * @test + * @bug 4115213 + * @summary Test to verify Checks that with resizable set to false, + * dialog can not be resized + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual DialogResizeTest + */ + +public class DialogResizeTest { + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + 1. When this test is run a dialog will display (setResizable Test) + Click on the checkbox to change the dialog resizable state + 2. For both dialog resizable states (resizable, non-resizable) try to + change the size of the dialog. When isResizable is true the dialog + is resizable. When isResizable is false the dialog is non-resizable + 3. If this is the behavior that you observe, the test has passed, Press + the Pass button. Otherwise the test has failed, Press the Fail button + """; + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(40) + .testUI(initialize()) + .logArea(8) + .build() + .awaitAndCheck(); + } + + public static Dialog initialize() { + Frame f = new Frame("Owner Frame"); + MyDialog ld = new MyDialog(f); + ld.setBounds(100, 100, 400, 150); + ld.setResizable(false); + System.out.println("isResizable is set to: " + ld.isResizable()); + return ld; + } +} + +class MyDialog extends Dialog implements ItemListener { + String sText = "Tests java.awt.Dialog.setResizable method"; + TextArea ta = new TextArea(sText, 2, 40, TextArea.SCROLLBARS_NONE); + + public MyDialog(Frame f) { + + super(f, "setResizable test", false); + + Panel cbPanel = new Panel(); + cbPanel.setLayout(new FlowLayout()); + + Panel taPanel = new Panel(); + taPanel.setLayout(new FlowLayout()); + taPanel.add(ta); + + Checkbox cb = new Checkbox("Check this box to change the dialog's " + + "resizable state", null, isResizable()); + cb.setState(false); + cb.addItemListener(this); + cbPanel.add(cb); + + add("North", taPanel); + add("South", cbPanel); + pack(); + } + + public void itemStateChanged(ItemEvent evt) { + setResizable(evt.getStateChange() == ItemEvent.SELECTED); + + boolean bResizeState = isResizable(); + PassFailJFrame.log("isResizable is set to: " + bResizeState); + + if (isResizable()) { + ta.setText("dialog is resizable (isResizable = " + bResizeState + ")"); + } else { + ta.setText("dialog is NOT resizable (isResizable = " + bResizeState + ")"); + } + } +} diff --git a/test/jdk/java/awt/Dialog/DialogResizeTest2.java b/test/jdk/java/awt/Dialog/DialogResizeTest2.java new file mode 100644 index 000000000000..3124719637a1 --- /dev/null +++ b/test/jdk/java/awt/Dialog/DialogResizeTest2.java @@ -0,0 +1,105 @@ +/* + * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Button; +import java.awt.Dialog; +import java.awt.Frame; +import java.awt.GridLayout; + +/* + * @test + * @bug 4172302 + * @summary Test to make sure non-resizable Dialogs can be resized with the + * setSize() method. + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual DialogResizeTest2 + */ + +public class DialogResizeTest2 { + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + This tests the programmatic resizability of non-resizable Dialogs + Even when a Dialog is set to be non-resizable, it should be + programmatically resizable using the setSize() method. + + 1. Initially the Dialog will be resizable. Try using the \\"Smaller\\" + and \\"Larger\\" buttons to verify that the Dialog resizes correctly + 2. Then, click the \\"Toggle\\" button to make the Dialog non-resizable + 3. Again, verify that clicking the \\"Larger\\" and \\"Smaller\\" buttons + causes the Dialog to get larger and smaller. If the Dialog does + not change size, or does not re-layout correctly, the test FAILS + """; + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(35) + .testUI(initialize()) + .logArea(8) + .build() + .awaitAndCheck(); + } + + public static Frame initialize() { + Frame frame = new Frame("Parent Frame"); + frame.add(new Button("Button")); + frame.setSize(100, 100); + new dlg(frame).setVisible(true); + return frame; + } + + static class dlg extends Dialog { + public dlg(Frame f_) { + super(f_, "Dialog", false); + setSize(200, 200); + Button bLarger = new Button("Larger"); + bLarger.addActionListener(e -> setSize(400, 400)); + Button bSmaller = new Button("Smaller"); + bSmaller.addActionListener(e -> setSize(200, 100)); + Button bCheck = new Button("Resizable?"); + bCheck.addActionListener(e -> { + if (isResizable()) { + PassFailJFrame.log("Dialog is resizable"); + } else { + PassFailJFrame.log("Dialog is not resizable"); + } + }); + Button bToggle = new Button("Toggle"); + bToggle.addActionListener(e -> { + if (isResizable()) { + setResizable(false); + PassFailJFrame.log("Dialog is now not resizable"); + } else { + setResizable(true); + PassFailJFrame.log("Dialog is now resizable"); + } + }); + setLayout(new GridLayout(1, 4)); + add(bSmaller); + add(bLarger); + add(bCheck); + add(bToggle); + } + } +} diff --git a/test/jdk/java/awt/Dialog/DialogSystemMenu/DialogSystemMenu.java b/test/jdk/java/awt/Dialog/DialogSystemMenu/DialogSystemMenu.java new file mode 100644 index 000000000000..3f1639e90a41 --- /dev/null +++ b/test/jdk/java/awt/Dialog/DialogSystemMenu/DialogSystemMenu.java @@ -0,0 +1,122 @@ +/* + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dialog; +import java.awt.Frame; +import java.awt.event.WindowListener; +import java.util.List; + +/* + * @test + * @bug 4058953 4094035 + * @summary Test to verify system menu of a dialog on win32 + * @requires (os.family == "windows") + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual DialogSystemMenu + */ + +public class DialogSystemMenu { + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + 1. Check the following on the first dialog window: + Right-clicking on the title bar + should bring up a system menu. + The system menu should not allow any + of the Maximize, Minimize and + Restore actions + + 2. The second dialog should be non-resizable + and have no application icon. + """; + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(35) + .testUI(initialize()) + .build() + .awaitAndCheck(); + } + + public static List

    initialize() { + Frame frame = new java.awt.Frame("Parent Frame"); + String txt = """ + This is a resizable dialog + Right-clicking on the title bar + should bring up a system menu + The system menu should not + allow any + of the Maximize, Minimize and + Restore actions + """; + String txt_non = """ + This is a non-resizable dialog + It should be really non-resizable + and have no application icon + """; + TestApp resizable = new TestApp(frame, "Test for 4058953", txt, true); + resizable.setLocation(0, 0); + + TestApp non_resizable = new TestApp(frame, "Test for 4094035", txt_non, false); + non_resizable.setLocation(320, 0); + return List.of(resizable, non_resizable); + } +} + + +class TestApp extends Dialog implements WindowListener { + public TestApp(java.awt.Frame parent, String title, String txt, boolean resize) { + super(parent, title, false); + + java.awt.TextArea ta = new java.awt.TextArea(txt); + ta.setEditable(false); + this.add(ta, "Center"); + this.addWindowListener(this); + this.setSize(300, 200); + this.setResizable(resize); + } + + + public void windowOpened(java.awt.event.WindowEvent myEvent) { + } + + public void windowClosed(java.awt.event.WindowEvent myEvent) { + } + + public void windowIconified(java.awt.event.WindowEvent myEvent) { + } + + public void windowDeiconified(java.awt.event.WindowEvent myEvent) { + } + + public void windowActivated(java.awt.event.WindowEvent myEvent) { + } + + public void windowDeactivated(java.awt.event.WindowEvent myEvent) { + } + + public void windowClosing(java.awt.event.WindowEvent myEvent) { + this.dispose(); + } +} diff --git a/test/jdk/java/awt/Dialog/DialogSystemMenu/icon24x24.gif b/test/jdk/java/awt/Dialog/DialogSystemMenu/icon24x24.gif new file mode 100644 index 000000000000..dfb998733974 Binary files /dev/null and b/test/jdk/java/awt/Dialog/DialogSystemMenu/icon24x24.gif differ diff --git a/test/jdk/java/awt/Dialog/DialogSystemMenu/iconone.gif b/test/jdk/java/awt/Dialog/DialogSystemMenu/iconone.gif new file mode 100644 index 000000000000..698ba29d839e Binary files /dev/null and b/test/jdk/java/awt/Dialog/DialogSystemMenu/iconone.gif differ diff --git a/test/jdk/java/awt/Dialog/DialogSystemMenu/icontwo.gif b/test/jdk/java/awt/Dialog/DialogSystemMenu/icontwo.gif new file mode 100644 index 000000000000..7f344ed1df07 Binary files /dev/null and b/test/jdk/java/awt/Dialog/DialogSystemMenu/icontwo.gif differ diff --git a/test/jdk/java/awt/Dialog/EnabledResetTest.java b/test/jdk/java/awt/Dialog/EnabledResetTest.java new file mode 100644 index 000000000000..d71c9b1801b2 --- /dev/null +++ b/test/jdk/java/awt/Dialog/EnabledResetTest.java @@ -0,0 +1,145 @@ +/* + * Copyright (c) 1999, 2024, 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 4232374 + * @summary Tests that dismissing a modal dialog does not enable + * disabled components + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual EnabledResetTest + */ + +import java.awt.BorderLayout; +import java.awt.Button; +import java.awt.Dialog; +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.Window; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +public class EnabledResetTest { + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + 1. Press "Create Child" twice to create three windows + Verify that the parent windows are disabled + 2. Press "Create Modal Dialog" + Verify that the parent windows are disabled + 3. Press "enable" + Verify that no windows accept mouse events + 4. Press "ok" + Verify that the first window is still disabled + If all the verifications are done, then test is + PASSED, else test fails. + """; + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(35) + .testUI(new ChildDialog(1, null)) + .build() + .awaitAndCheck(); + } +} + +class ChildDialog extends Frame implements ActionListener { + Window parent; + int id; + Button b, c, d; + + public ChildDialog(int frameNumber, Window myParent) { + super(); + id = frameNumber; + parent = myParent; + + setTitle("Frame Number " + id); + + b = new Button("Dismiss me"); + c = new Button("Create Child"); + d = new Button("Create Modal Dialog"); + + setLayout(new BorderLayout()); + add("North", c); + add("Center", d); + add("South", b); + pack(); + + b.addActionListener(this); + c.addActionListener(this); + d.addActionListener(this); + } + + public void setVisible(boolean b) { + if (parent != null) { + if (b) { + parent.setEnabled(false); + } else { + parent.setEnabled(true); + parent.requestFocus(); + } + } + + super.setVisible(b); + } + + public void dispose() { + if (parent != null) { + parent.setEnabled(true); + parent.requestFocus(); + } + super.dispose(); + } + + + public void actionPerformed(ActionEvent evt) { + if (evt.getSource() == c) { + (new ChildDialog(id + 1, this)).setVisible(true); + } else if (evt.getSource() == d) { + Dialog D = new Dialog(this, "Modal Dialog "); + D.setLayout(new FlowLayout()); + Button b = new Button("ok"); + Button e = new Button("enable"); + D.add(b); + D.add(e); + D.setModal(true); + D.pack(); + b.addActionListener(this); + e.addActionListener(this); + D.setVisible(true); + } else if (evt.getSource() == b) { + dispose(); + } else if (evt.getSource() instanceof Button) { + if ("ok".equals(evt.getActionCommand())) { + Button target = (Button) evt.getSource(); + Window w = (Window) target.getParent(); + w.dispose(); + } + if ("enable".equals(evt.getActionCommand())) { + parent.setEnabled(true); + } + } + } +} diff --git a/test/jdk/java/awt/Dialog/FileDialogFilterTest.java b/test/jdk/java/awt/Dialog/FileDialogFilterTest.java new file mode 100644 index 000000000000..e30d8ea58a2d --- /dev/null +++ b/test/jdk/java/awt/Dialog/FileDialogFilterTest.java @@ -0,0 +1,68 @@ +/* + * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.FileDialog; +import java.awt.Frame; +import java.io.File; +import java.io.FilenameFilter; + +/* + * @test + * @bug 4364256 + * @summary Test to File Dialog filter + * @requires (os.family == "windows") + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual FileDialogFilterTest + */ + +public class FileDialogFilterTest { + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + Run the test, make sure a file dialog + comes up with no crash. If the file dialog + comes up successfully then press PASS, else FAIL. + """; + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(35) + .testUI(initialize()) + .build() + .awaitAndCheck(); + } + + public static FileDialog initialize() { + FileDialog fDlg = new FileDialog(new Frame()); + fDlg.addNotify(); + fDlg.setFilenameFilter(new MyFilter()); + return fDlg; + } +} + +class MyFilter implements FilenameFilter { + public boolean accept(File dir, String name) { + return true; + } +} diff --git a/test/jdk/java/awt/Dialog/FileDialogGetFileTest.java b/test/jdk/java/awt/Dialog/FileDialogGetFileTest.java new file mode 100644 index 000000000000..d4670cceb601 --- /dev/null +++ b/test/jdk/java/awt/Dialog/FileDialogGetFileTest.java @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2001, 2024, 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 4414105 + * @summary Tests that FileDialog returns null when cancelled + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual FileDialogGetFileTest + */ + +import java.awt.Button; +import java.awt.FileDialog; +import java.awt.Frame; + +public class FileDialogGetFileTest { + static FileDialog fd; + static Frame frame; + + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + 1. Open FileDialog from "Show File Dialog" button. + 2. Click cancel button without selecting any file/folder. + 3. If FileDialog.getFile return null then test PASSES, + else test FAILS automatically. + """; + + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(35) + .testUI(initialize()) + .logArea(4) + .build() + .awaitAndCheck(); + } + + public static Frame initialize() { + frame = new Frame("FileDialog GetFile test"); + fd = new FileDialog(frame); + fd.setFile("FileDialogGetFileTest.html"); + fd.setBounds(100, 100, 400, 400); + Button showBtn = new Button("Show File Dialog"); + frame.add(showBtn); + frame.pack(); + showBtn.addActionListener(e -> { + fd.setVisible(true); + if (fd.getFile() != null) { + PassFailJFrame.forceFail("Test failed: FileDialog returned non-null value"); + } else { + PassFailJFrame.log("Test Passed!"); + } + }); + return frame; + } +} diff --git a/test/jdk/java/awt/Dialog/FileDialogIconTest/FileDialogIconTest.java b/test/jdk/java/awt/Dialog/FileDialogIconTest/FileDialogIconTest.java new file mode 100644 index 000000000000..e8505681a82a --- /dev/null +++ b/test/jdk/java/awt/Dialog/FileDialogIconTest/FileDialogIconTest.java @@ -0,0 +1,258 @@ +/* + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Button; +import java.awt.FileDialog; +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.Image; +import java.awt.Rectangle; +import java.awt.Robot; +import java.awt.Toolkit; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.image.BufferedImage; +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; + +/* + * @test + * @bug 4035189 + * @summary Test to verify that PIT File Dialog icon not matching with + * the new java icon (frame Icon) - PIT build + * @requires (os.family == "windows") + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual FileDialogIconTest + */ + +public class FileDialogIconTest { + public static Frame frame; + public static Image image; + public static List images; + static String fileBase; + + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + 1. Select the Image for a Dialog and Frame using either + Load/Save/Just Dialog. + 2. Set the Icon Image/s to Frame and Dialog. Verify that the + Icon is set for the respective Frame and Dialog. + If selected Icon is set to Frame and Dialog press PASS + else FAIL. + """; + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(35) + .testUI(initialize()) + .logArea(8) + .build() + .awaitAndCheck(); + } + + public static void setImagesToFD(java.util.List listIcon) { + FileDialogIconTest.images = listIcon; + } + + public static void setImagesToFrame(java.util.List listIcon) { + frame.setIconImages(listIcon); + } + + public static void setImageToFD(Image img) { + FileDialogIconTest.image = img; + } + + public static void setImageToFrame(Image img) { + frame.setIconImage(img); + } + + public static Frame initialize() { + frame = new Frame("FileDialogIconTest"); + Button setImageButton1 = new Button("setIconImageToFrame"); + Button setImageButton2 = new Button("setIconImageToDialog"); + Button setImageButton3 = new Button("setIconImagesToFrame"); + Button setImageButton4 = new Button("setIconImagesToDialog"); + Button setImageButton5 = new Button("setIconBufferedImagesToDialog"); + Button setImageButton6 = new Button("setIconBufferedImagesToFrame"); + + if (System.getProperty("test.src") == null) { + fileBase = ""; + } else { + fileBase = System.getProperty("test.src") + System.getProperty("file.separator"); + } + + final String fileName = fileBase + "loading-msg.gif"; + + setImageButton1.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent event) { + try { + Image image = Toolkit.getDefaultToolkit().getImage(fileName); + setImageToFrame(image); + PassFailJFrame.log("Loaded image . setting to frame"); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + + setImageButton2.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent event) { + try { + Image image = Toolkit.getDefaultToolkit().getImage(fileName); + setImageToFD(image); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + + setImageButton3.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent event) { + try { + Image image; + java.util.List list = new java.util.ArrayList(); + for (int i = 1; i <= 4; i++) { + String fileName = fileBase + "T" + i + ".gif"; + image = Toolkit.getDefaultToolkit().getImage(fileName); + PassFailJFrame.log("Loaded image " + fileName + ". setting to the list for frame"); + list.add(image); + } + setImagesToFrame(list); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + + + setImageButton4.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent event) { + try { + Image image; + List list = new ArrayList<>(); + for (int i = 1; i <= 4; i++) { + String fileName = fileBase + "T" + i + ".gif"; + image = Toolkit.getDefaultToolkit().getImage(fileName); + PassFailJFrame.log("Loaded image " + fileName + ". setting to the list for dialog"); + list.add(image); + } + setImagesToFD(list); + } catch (Exception e) { + e.printStackTrace(); + } + } + }); + + + setImageButton5.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent event) { + List list = new ArrayList<>(); + try { + Robot robot = new Robot(); + Rectangle rectangle; + for (int i = 1; i <= 4; i++) { + rectangle = new Rectangle(i * 10, i * 10, i * 10 + 40, i * 10 + 40); + java.awt.image.BufferedImage image = robot.createScreenCapture(rectangle); + robot.delay(100); + list.add(image); + } + } catch (Throwable t) { + t.printStackTrace(); + } + PassFailJFrame.log("Captured images and set to the list for dialog"); + } + }); + + setImageButton6.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent event) { + List list = new ArrayList<>(); + try { + Robot robot = new Robot(); + Rectangle rectangle; + for (int i = 1; i <= 4; i++) { + rectangle = new Rectangle(i * 10, i * 10, i * 10 + 40, i * 10 + 40); + java.awt.image.BufferedImage image = robot.createScreenCapture(rectangle); + robot.delay(100); + list.add(image); + } + } catch (Throwable t) { + t.printStackTrace(); + } + PassFailJFrame.log("Captured images and set to the list for frame"); + } + }); + + Button buttonLoad = new Button("Load Dialog"); + Button buttonSave = new Button("Save Dialog"); + Button buttonSimple = new Button("Just Dialog"); + buttonLoad.addActionListener(new MyActionListener(FileDialog.LOAD, "LOAD")); + buttonSave.addActionListener(new MyActionListener(FileDialog.SAVE, "SAVE")); + buttonSimple.addActionListener(new MyActionListener(-1, "")); + + frame.setSize(400, 400); + frame.setLayout(new FlowLayout()); + frame.add(buttonLoad); + frame.add(buttonSave); + frame.add(buttonSimple); + frame.add(setImageButton1); + frame.add(setImageButton2); + frame.add(setImageButton3); + frame.add(setImageButton4); + frame.pack(); + return frame; + } +} + +class MyActionListener implements ActionListener { + int id; + String name; + + public MyActionListener(int id, String name) { + this.id = id; + this.name = name; + } + + public void actionPerformed(ActionEvent ae) { + try { + FileDialog filedialog; + if (id == -1 && Objects.equals(name, "")) { + filedialog = new FileDialog(FileDialogIconTest.frame); + } else { + filedialog = new FileDialog(FileDialogIconTest.frame, name, id); + } + if (FileDialogIconTest.image != null) { + filedialog.setIconImage(FileDialogIconTest.image); + } + + if (FileDialogIconTest.images != null) { + filedialog.setIconImages(FileDialogIconTest.images); + } + filedialog.setVisible(true); + } catch (Exception e) { + e.printStackTrace(); + } + } +} diff --git a/test/jdk/java/awt/Dialog/FileDialogIconTest/T1.gif b/test/jdk/java/awt/Dialog/FileDialogIconTest/T1.gif new file mode 100644 index 000000000000..24a7dea299fd Binary files /dev/null and b/test/jdk/java/awt/Dialog/FileDialogIconTest/T1.gif differ diff --git a/test/jdk/java/awt/Dialog/FileDialogIconTest/T2.gif b/test/jdk/java/awt/Dialog/FileDialogIconTest/T2.gif new file mode 100644 index 000000000000..1f3fd66328ba Binary files /dev/null and b/test/jdk/java/awt/Dialog/FileDialogIconTest/T2.gif differ diff --git a/test/jdk/java/awt/Dialog/FileDialogIconTest/T3.gif b/test/jdk/java/awt/Dialog/FileDialogIconTest/T3.gif new file mode 100644 index 000000000000..af6d626058a6 Binary files /dev/null and b/test/jdk/java/awt/Dialog/FileDialogIconTest/T3.gif differ diff --git a/test/jdk/java/awt/Dialog/FileDialogIconTest/T4.gif b/test/jdk/java/awt/Dialog/FileDialogIconTest/T4.gif new file mode 100644 index 000000000000..67876264d8f7 Binary files /dev/null and b/test/jdk/java/awt/Dialog/FileDialogIconTest/T4.gif differ diff --git a/test/jdk/java/awt/Dialog/FileDialogIconTest/loading-msg.gif b/test/jdk/java/awt/Dialog/FileDialogIconTest/loading-msg.gif new file mode 100644 index 000000000000..6c7570a6d843 Binary files /dev/null and b/test/jdk/java/awt/Dialog/FileDialogIconTest/loading-msg.gif differ diff --git a/test/jdk/java/awt/Dialog/FileDialogUserFilterTest.java b/test/jdk/java/awt/Dialog/FileDialogUserFilterTest.java new file mode 100644 index 000000000000..80ff9ed0bde6 --- /dev/null +++ b/test/jdk/java/awt/Dialog/FileDialogUserFilterTest.java @@ -0,0 +1,150 @@ +/* + * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Button; +import java.awt.Checkbox; +import java.awt.Component; +import java.awt.Container; +import java.awt.Event; +import java.awt.FileDialog; +import java.awt.Frame; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.Label; +import java.awt.Panel; +import java.awt.TextField; +import java.io.File; +import java.io.FilenameFilter; + +/* + * @test + * @bug 4293697 4416433 4417139 4409600 + * @summary Test to verify that user filter always gets called on changing the + * directory in FileDialog + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual FileDialogUserFilterTest + */ + +public class FileDialogUserFilterTest { + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + 1. Enter a mask into the field, a directory into + the field (or leave the default values). + 2. Then click the button, file dialog will appear. + Output of the user filter will be shown in the output + area. Enter several different directories to the file dialog + via double-clicking on the directory list. The output + area should show some filtering output on each directory + change. If any output was only given on dialog startup, + the test is FAILED. + 3. Look at the list of files accepted by the filter. + If some files do not match the filter, + the test is FAILED. + 4. Open dialog with an empty filter. + Enter some directories with a lot of files (like /usr/bin). + If dialog crashes the test is FAILED. + Enter the directory that contain files and other directories. + If the directories are shown in the files box along with files + then the test is FAILED. + 5. Click in checkbox 'do not use filter', make it checked. + Open dialog, enter the directory with some files. + If no files is shown in the File list box (while you are sure + there are some files there) the test is FAILED + Otherwise it is PASSED." + """; + + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(35) + .testUI(new DialogFilterTest()) + .build() + .awaitAndCheck(); + } +} + +class DialogFilterTest extends Frame implements FilenameFilter { + FileDialog fd; + static TextField tfDirectory = new TextField(); + static TextField tfFile = new TextField(); + static TextField tfFilter = new TextField(); + static Checkbox useFilterCheck = new Checkbox("do not use filter"); + + public DialogFilterTest() { + setTitle("File Dialog User Filter test"); + add("North", new Button("Load")); + Panel p = new Panel(); + p.setLayout(new GridBagLayout()); + addRow(p, new Label("directory:", Label.RIGHT), tfDirectory); + addRow(p, new Label("file:", Label.RIGHT), tfFile); + addRow(p, new Label("filter:", Label.RIGHT), tfFilter); + addRow(p, new Label(""), useFilterCheck); + tfFilter.setText(".java"); + tfDirectory.setText("."); + add("Center", p); + setSize(300, 200); + } + + static void addRow(Container cont, Component c1, Component c2) { + GridBagLayout gbl = (GridBagLayout) cont.getLayout(); + GridBagConstraints c = new GridBagConstraints(); + c.fill = GridBagConstraints.BOTH; + cont.add(c1); + gbl.setConstraints(c1, c); + + c.gridwidth = GridBagConstraints.REMAINDER; + c.weightx = 1.0; + cont.add(c2); + gbl.setConstraints(c2, c); + } + + public boolean accept(File dir, String name) { + System.out.println("File " + dir + " String " + name); + if (fd.getMode() == FileDialog.LOAD) { + return name.lastIndexOf(tfFilter.getText()) > 0; + } + return true; + } + + public boolean action(Event evt, Object what) { + boolean load = "Load".equals(what); + + if (load || "Save".equals(what)) { + fd = new FileDialog(new Frame(), null, + load ? FileDialog.LOAD : FileDialog.SAVE); + fd.setDirectory(tfDirectory.getText()); + fd.setFile(tfFile.getText()); + if (!useFilterCheck.getState()) { + fd.setFilenameFilter(this); + } + fd.setVisible(true); + tfDirectory.setText(fd.getDirectory()); + tfFile.setText(fd.getFile()); + + return true; + } + return false; + } +} diff --git a/test/jdk/java/awt/Dialog/FileDialogWrongNameCrash.java b/test/jdk/java/awt/Dialog/FileDialogWrongNameCrash.java new file mode 100644 index 000000000000..f3d83a684946 --- /dev/null +++ b/test/jdk/java/awt/Dialog/FileDialogWrongNameCrash.java @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Button; +import java.awt.Frame; + +/* + * @test + * @bug 4779118 + * @summary Tests that FileDialog with wrong initial file name + * doesn't crash when Open button is pressed. + * @requires (os.family == "windows") + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual FileDialogWrongNameCrash + */ + +public class FileDialogWrongNameCrash { + + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + (This is Windows only test) + 1. You should see a frame 'Frame' with button 'Load'. Press button.", + 2. You should see 'Load file' dialog, select any file and press 'Open'", + (not 'Cancel'!!!). If Java doesn't crash - press PASS, else FAIL + """; + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(35) + .testUI(initialize()) + .build() + .awaitAndCheck(); + } + + private static Frame initialize() { + Frame frame = new Frame("File Dialog Wrong Name Crash Test"); + Button fileButton = new Button("Load"); + fileButton.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent e) { + final java.awt.FileDialog selector = + new java.awt.FileDialog(frame); + selector.setFile("Z:\\O2 XDA\\LogiTest\\\\Testcase.xml"); + selector.setVisible(true); + } + }); + frame.add(fileButton); + frame.setSize(100, 60); + return frame; + } +} diff --git a/test/jdk/java/awt/Dialog/GetLocationTest_1.java b/test/jdk/java/awt/Dialog/GetLocationTest_1.java new file mode 100644 index 000000000000..a373f931cf72 --- /dev/null +++ b/test/jdk/java/awt/Dialog/GetLocationTest_1.java @@ -0,0 +1,129 @@ +/* + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Color; +import java.awt.Component; +import java.awt.Dialog; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.Window; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; + +/* + * @test + * @bug 4168481 + * @summary Test to verify Dialog getLocation() regression on Solaris + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual GetLocationTest_1 + */ + +public class GetLocationTest_1 { + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + 1. Click in in the blue square and the yellow window should come + up with the top left by the cursor + 2. If you see this correct behavior press PASS. If you see that + the yellow window location is offset by some inset, press FAIL + """; + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(35) + .testUI(initialize()) + .logArea(8) + .build() + .awaitAndCheck(); + } + + public static Dialog initialize() { + Frame f = new Frame("Owner Frame"); + ColorComponent blue = new ColorComponent(); + blue.setBackground(Color.blue); + blue.setSize(50, 50); + + final Dialog dialog = new Dialog(f, "GetLocation test"); + dialog.setLocation(300, 300); + System.out.println("Dialog location = " + dialog.getLocation()); + blue.setLocation(50, 50); + dialog.setLayout(null); + dialog.add(blue); + dialog.setSize(200, 200); + + final ColorWindow w = new ColorWindow(f); + w.setSize(50, 50); + w.setBackground(Color.yellow); + + blue.addMouseListener(new MouseAdapter() { + public void mousePressed(MouseEvent e) { + PassFailJFrame.log("Dialog location = " + dialog.getLocation()); + Point p = e.getPoint(); + Component c = e.getComponent(); + PassFailJFrame.log("Position = " + p); + convertPointToScreen(p, c); + PassFailJFrame.log("Converted to = " + p); + w.setLocation(p.x, p.y); + w.setVisible(true); + } + }); + return dialog; + } + + static class ColorComponent extends Component { + public void paint(Graphics g) { + g.setColor(getBackground()); + Rectangle bounds = getBounds(); + g.fillRect(0, 0, bounds.width, bounds.height); + } + } + + static class ColorWindow extends Window { + ColorWindow(Frame f) { + super(f); + } + + public void paint(Graphics g) { + g.setColor(getBackground()); + Rectangle bounds = getBounds(); + g.fillRect(0, 0, bounds.width, bounds.height); + } + } + + public static void convertPointToScreen(Point p, Component c) { + do { + Point b = c.getLocation(); + PassFailJFrame.log("Adding " + b + " for " + c); + p.x += b.x; + p.y += b.y; + + if (c instanceof java.awt.Window) { + break; + } + c = c.getParent(); + } while (c != null); + } +} diff --git a/test/jdk/java/awt/Dialog/HideDialogTest.java b/test/jdk/java/awt/Dialog/HideDialogTest.java new file mode 100644 index 000000000000..78d0344a6cf8 --- /dev/null +++ b/test/jdk/java/awt/Dialog/HideDialogTest.java @@ -0,0 +1,138 @@ +/* + * Copyright (c) 1997, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.BorderLayout; +import java.awt.Button; +import java.awt.Color; +import java.awt.Dialog; +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Panel; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +/* + * @test + * @bug 4048664 4065506 4122094 4171979 + * @summary Test if Dialog can be successfully hidden, see that no other app + * comes to front, see if hide + dispose causes assertion failure + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual HideDialogTest + */ + +public class HideDialogTest { + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + 1. A Frame should appear with a "test" button in it + 2. Click on the "test" button. A Dialog will appear with a "dismiss" button + and a "dismiss-with-dispose" button + 3. First, click on the "dismiss-with-dispose" button. Verify that + no assertion failure appears. + 4. Now, click on the "dismiss" button. The Dialog should go away. + 5. Repeat from (2) 10-20 times. + 6. When the dialog goes away check that the frame window does not briefly + get obscured by another app or repaint it's entire area. There should be + no flicker at all in areas obscured by the dialog. (4065506 4122094) + If there is the test fails. + 7. If the Dialog is successfully hidden each time, the test passed. If the + Dialog did not hide, the test failed (4048664). + + NOTE: When the dialog does not go away (meaning the bug has manifested itself), + the "dismiss-with-dispose" button can be used to get rid of it. + """; + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(40) + .testUI(new MyFrame()) + .build() + .awaitAndCheck(); + } +} + +class MyDialog extends Dialog { + public MyDialog(Frame f) { + super(f, "foobar", true); + setSize(200, 200); + setLayout(new BorderLayout()); + Panel p = new Panel(); + p.setLayout(new FlowLayout(FlowLayout.CENTER)); + Button okButton; + okButton = new Button("dismiss"); + p.add(okButton); + okButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + System.out.println("Calling setVisible(false)"); + setVisible(false); + } + }); + Button newButton; + p.add(newButton = new Button("dismiss-with-dispose")); + newButton.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + System.out.println("Calling setVisible(false) + dispose()"); + setVisible(false); + dispose(); + } + }); + add("South", p); + pack(); + } +} + +class MyFrame extends Frame implements ActionListener { + public MyFrame() { + super(); + setSize(600, 400); + setTitle("HideDialogTest"); + setLayout(new BorderLayout()); + Panel toolbar = new Panel(); + toolbar.setLayout(new FlowLayout(FlowLayout.LEFT)); + Button testButton = new Button("test"); + testButton.addActionListener(this); + toolbar.add(testButton); + add("North", toolbar); + } + + public void actionPerformed(ActionEvent e) { + String s = e.getActionCommand(); + if (s.equals("test")) { + System.out.println("Begin test"); + MyDialog d = new MyDialog(this); + d.setVisible(true); + System.out.println("End test"); + } + } + + public void paint(Graphics g) { + for (int i = 0; i < 10; i++) { + g.setColor(Color.red); + g.fillRect(0, 0, 2000, 2000); + g.setColor(Color.blue); + g.fillRect(0, 0, 2000, 2000); + } + } +} diff --git a/test/jdk/java/awt/Dialog/ModalDialogTest.java b/test/jdk/java/awt/Dialog/ModalDialogTest.java new file mode 100644 index 000000000000..aceacc9209a8 --- /dev/null +++ b/test/jdk/java/awt/Dialog/ModalDialogTest.java @@ -0,0 +1,147 @@ +/* + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.BorderLayout; +import java.awt.Button; +import java.awt.Checkbox; +import java.awt.Dialog; +import java.awt.Frame; +import java.awt.Panel; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; + +/* + * @test + * @bug 4078176 + * @summary Test to verify Modal dialogs don't act modal if addNotify() + * is called before setModal(true). + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual ModalDialogTest + */ + +public class ModalDialogTest implements ActionListener { + public boolean modal = true; + Button closeBtn = new Button("Close me"); + Button createBtn = new Button("Create Dialog"); + Button createNewBtn = new Button("Create Modal Dialog"); + Button lastBtn = new Button("Show Last Dialog"); + Dialog dialog; + Dialog newDialog; + Frame testFrame; + + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + 1. Use 'Modal' checkbox to select which dialog you're + going to create - modal or non-modal. + (this checkbox affects only new created dialog but + not existing one) + 2. Use 'Create Dialog' button to create a dialog. + If you have selected 'Modal' checkbox then dialog has to + be created modal - you can make sure of that clicking + on any other control (i.e. 'Modal' checkbox) - they + should not work. + 3. Use 'Show Last Dialog' button to bring up last + created dialog - to make sure that if you show/hide + modal dialog several times it stays modal. + 4. On the appearing dialog there are two buttons: + 'Close Me' which closes the dialog, + and 'Create Modal Dialog' which creates one more + MODAL dialog just to make sure that + in situation with two modal dialogs all is fine. + 5. If created modal dialogs are really modal + (which means that they blocks the calling app) + then test is PASSED, otherwise it's FAILED." + """; + ModalDialogTest test = new ModalDialogTest(); + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(35) + .testUI(test.initialize()) + .build() + .awaitAndCheck(); + } + + public Frame initialize() { + testFrame = new Frame("Parent Frame"); + Frame frame = new Frame("Modal Dialog test"); + Panel panel = new Panel(); + panel.setLayout(new BorderLayout()); + + createBtn.addActionListener(this); + createNewBtn.addActionListener(this); + closeBtn.addActionListener(this); + lastBtn.addActionListener(this); + panel.add("Center", createBtn); + panel.add("South", lastBtn); + Checkbox cb = new Checkbox("Modal", modal); + cb.addItemListener(new ItemListener() { + public void itemStateChanged(ItemEvent e) { + modal = ((Checkbox) e.getSource()).getState(); + } + }); + panel.add("North", cb); + panel.setSize(200, 100); + + frame.add(panel); + frame.pack(); + return frame; + } + + public void actionPerformed(ActionEvent e) { + if (e.getSource() == createBtn) { + if (dialog != null) { + dialog.dispose(); + } + dialog = new Dialog(testFrame, "Modal Dialog"); + dialog.add("North", closeBtn); + dialog.add("South", createNewBtn); + createBtn.setEnabled(false); + dialog.pack(); + dialog.setModal(modal); + dialog.setVisible(true); + } else if (e.getSource() == closeBtn && dialog != null) { + createBtn.setEnabled(true); + dialog.setVisible(false); + } else if (e.getSource() == lastBtn && dialog != null) { + dialog.setVisible(true); + } else if (e.getSource() == createNewBtn && newDialog == null) { + newDialog = new Dialog(testFrame, "New Modal Dialog"); + Button clsBtn = new Button("Close Me"); + clsBtn.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + newDialog.dispose(); + newDialog = null; + } + }); + newDialog.add("North", clsBtn); + newDialog.pack(); + newDialog.setModal(true); + newDialog.setVisible(true); + } + } +} diff --git a/test/jdk/java/awt/Dialog/PrintToFileTest/PrintToFileFrame.java b/test/jdk/java/awt/Dialog/PrintToFileTest/PrintToFileFrame.java new file mode 100644 index 000000000000..a117622d5700 --- /dev/null +++ b/test/jdk/java/awt/Dialog/PrintToFileTest/PrintToFileFrame.java @@ -0,0 +1,40 @@ +import java.awt.Button; +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.PrintJob; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +class PrintToFileFrame extends Frame implements ActionListener { + Button nativeDlg = new Button("Show print dialog"); + + public PrintToFileFrame() { + this.setLayout(new FlowLayout()); + add(nativeDlg); + nativeDlg.addActionListener(this); + + setSize(300, 300); + } + + @SuppressWarnings("removal") + public void actionPerformed(ActionEvent ae) { + if (System.getSecurityManager() == null) { + throw new RuntimeException("Security manager isn't installed."); + } + + try { + System.getSecurityManager().checkPrintJobAccess(); + System.out.println("checkPrintJobAccess - OK"); + } catch (SecurityException e) { + System.out.println("checkPrintJobAccess - ERROR " + e); + } + + PrintJob printJob = getToolkit().getPrintJob(this, null, null); + + if (printJob != null) { + System.out.println("Print Job: " + printJob); + } else { + System.out.println("Print Job is null."); + } + } +} diff --git a/test/jdk/java/awt/Dialog/PrintToFileTest/PrintToFileGranted.java b/test/jdk/java/awt/Dialog/PrintToFileTest/PrintToFileGranted.java new file mode 100644 index 000000000000..05d73123d983 --- /dev/null +++ b/test/jdk/java/awt/Dialog/PrintToFileTest/PrintToFileGranted.java @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.print.PrinterJob; + +/* + * @test + * @bug 6275359 + * @summary Test to verify system menu of a dialog on win32 + * @requires (os.family == "windows") + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @compile PrintToFileFrame.java + * @compile PrintToFileGranted.java + * @run main/manual/policy=granted/othervm PrintToFileGranted + */ + +public class PrintToFileGranted { + public static void main(String[] args) throws Exception { + String INSTRUCTIONS; + if (isPrintSupport()) { + INSTRUCTIONS = """ + 1. Click on 'Show file dialog' button A print dialog will come up + 2. If checkbox 'Print to file' is enabled then the test passed + else the test failed + 3. Close the print dialog before pressing PASS or FAIL buttons + """; + } else { + INSTRUCTIONS = """ + 1. The test requires printer installed in your system, + but there is no printers found + Please install one and re-run the test + """; + } + + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(35) + .testUI(new PrintToFileFrame()) + .build() + .awaitAndCheck(); + } + + public static boolean isPrintSupport() { + PrinterJob pj = PrinterJob.getPrinterJob(); + return pj.getPrintService() != null; + } +} diff --git a/test/jdk/java/awt/Dialog/PrintToFileTest/PrintToFileRevoked.java b/test/jdk/java/awt/Dialog/PrintToFileTest/PrintToFileRevoked.java new file mode 100644 index 000000000000..7c724e97bed5 --- /dev/null +++ b/test/jdk/java/awt/Dialog/PrintToFileTest/PrintToFileRevoked.java @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.print.PrinterJob; + +/* + * @test + * @bug 6275359 + * @summary Test to verify Printing ignores Security permissions + * using native dialog + * @requires (os.family == "windows") + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @compile PrintToFileRevoked.java + * @run main/manual/policy=revoked/othervm PrintToFileRevoked + */ + +public class PrintToFileRevoked { + public static void main(String[] args) throws Exception { + String INSTRUCTIONS; + if (isPrintSupport()) { + INSTRUCTIONS = """ + 1. Click on 'Show file dialog' button A print dialog will come up + 2. If checkbox 'Print to file' is disabled then the test passed + else the test failed + 3. Close the print dialog before pressing PASS or FAIL buttons + """; + } else { + INSTRUCTIONS = """ + 1. The test requires printer installed in your system, + but there is no printers found + Please install one and re-run the test + """; + } + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(35) + .testUI(new PrintToFileFrame()) + .build() + .awaitAndCheck(); + } + + public static boolean isPrintSupport() { + PrinterJob pj = PrinterJob.getPrinterJob(); + return pj.getPrintService() != null; + } +} diff --git a/test/jdk/java/awt/Dialog/PrintToFileTest/granted b/test/jdk/java/awt/Dialog/PrintToFileTest/granted new file mode 100644 index 000000000000..e73b0fdf3cde --- /dev/null +++ b/test/jdk/java/awt/Dialog/PrintToFileTest/granted @@ -0,0 +1,10 @@ +/* AUTOMATICALLY GENERATED ON Thu Jan 03 15:48:39 PST 2002*/ +/* DO NOT EDIT */ + +grant { + permission java.lang.RuntimePermission "queuePrintJob"; + permission java.util.PropertyPermission "*", "read"; + permission java.io.FilePermission "<>", "read"; + permission java.io.FilePermission "<>", "write"; + permission java.lang.RuntimePermission "accessClassInPackage.sun.util.locale.provider"; +}; diff --git a/test/jdk/java/awt/Dialog/PrintToFileTest/revoked b/test/jdk/java/awt/Dialog/PrintToFileTest/revoked new file mode 100644 index 000000000000..d2545e15e115 --- /dev/null +++ b/test/jdk/java/awt/Dialog/PrintToFileTest/revoked @@ -0,0 +1,9 @@ +/* AUTOMATICALLY GENERATED ON Thu Jan 03 15:48:39 PST 2002*/ +/* DO NOT EDIT */ + +grant { + permission java.lang.RuntimePermission "queuePrintJob"; + permission java.util.PropertyPermission "*", "read"; + permission java.lang.RuntimePermission "accessClassInPackage.sun.util.locale.provider"; +}; + diff --git a/test/jdk/java/awt/Dialog/TopmostModalDialogTest.java b/test/jdk/java/awt/Dialog/TopmostModalDialogTest.java new file mode 100644 index 000000000000..7b91d47e248c --- /dev/null +++ b/test/jdk/java/awt/Dialog/TopmostModalDialogTest.java @@ -0,0 +1,152 @@ +/* + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Button; +import java.awt.Dialog; +import java.awt.Frame; +import java.awt.GridLayout; +import java.awt.Window; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; + +/* + * @test + * @bug 4940645 + * @summary Test to verify setAlwaysOnTop(true) does + * work in modal dialog in Windows + * @requires (os.family == "windows" | os.family == "linux" ) + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual TopmostModalDialogTest + */ + +public class TopmostModalDialogTest { + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + (This test verifies that modal dialog can be made always on top + This test should only be run on the platforms which support always-on-top windows + Such platforms are: Windows, Linux with GNOME2/Metacity window manager, + Solaris with GNOME2/Metacity window manager + If you are not running on any of these platforms, please select 'Pass' to skip testing + If you are unsure on which platform you are running please select 'Pass') + + 1. After test started you see a frame with \\"Main Frame\\" title + It contains three buttons. Every button starts one of test stage + You should test all three stages + 2. After you press button to start the stage. It shows modal dialog + This modal dialog should be always-on-top window + 3. Since it's a modal the only way to test this is try to cover it + using some native window + 4. If you will able to cover it be native window - test FAILS, otherwise - PASS + + Note: in stages #2 and #3 dialog is initially shown as regular modal dialogs + You will see \\"Let's wait\\" message in the message area below + Please wait until message \\"Let's make it topmost\\" will be printed in the area + After that you can continue testing. + """; + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(35) + .testUI(initialize()) + .logArea(8) + .build() + .awaitAndCheck(); + } + + public static Frame initialize() { + final Tester tester = new Tester(); + Frame frame = new Frame("Main Frame"); + frame.setLayout(new GridLayout(3, 1)); + for (int i = 0; i < 3; i++) { + Button btn = new Button("Stage #" + i); + frame.add(btn); + btn.addActionListener(tester); + } + frame.pack(); + return frame; + } +} + +class Tester implements ActionListener { + public void actionPerformed(ActionEvent e) { + String command = e.getActionCommand(); + PassFailJFrame.log(command); + int cmd = Integer.parseInt(command.substring(command.length() - 1)); + PassFailJFrame.log("" + cmd); + Dialog dlg = new Dialog(new Frame(""), "Modal Dialog", true); + dlg.setBounds(100, 100, 100, 100); + dlg.addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent we) { + Window self = we.getWindow(); + Window owner = self.getOwner(); + if (owner != null) { + owner.dispose(); + } else { + self.dispose(); + } + } + }); + + switch (cmd) { + case 0: + dlg.setAlwaysOnTop(true); + dlg.setVisible(true); + break; + case 1: + (new Thread(new TopmostMaker(dlg))).start(); + dlg.setVisible(true); + break; + case 2: + dlg.setFocusableWindowState(false); + (new Thread(new TopmostMaker(dlg))).start(); + dlg.setVisible(true); + break; + default: + PassFailJFrame.log("Unsupported operation :("); + } + } +} + +class TopmostMaker implements Runnable { + final Window wnd; + + public TopmostMaker(Window wnd) { + this.wnd = wnd; + } + + public void run() { + PassFailJFrame.log("Let's wait"); + try { + Thread.sleep(1000); + } catch (InterruptedException ie) { + PassFailJFrame.log("Test was interrupted. " + ie); + ie.printStackTrace(); + } + PassFailJFrame.log("Let's make it topmost"); + wnd.setAlwaysOnTop(true); + } +} diff --git a/test/jdk/java/awt/EventQueue/PushPopDeadlock/PushPopDeadlock.java b/test/jdk/java/awt/EventQueue/PushPopDeadlock/PushPopDeadlock.java new file mode 100644 index 000000000000..82ca54871848 --- /dev/null +++ b/test/jdk/java/awt/EventQueue/PushPopDeadlock/PushPopDeadlock.java @@ -0,0 +1,97 @@ +/* + * Copyright (c) 1999, 2024, 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 4212687 + * @summary Verifies that calling EventQueue.push() and EventQueue.pop() + * does not deadlock. + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual PushPopDeadlock + */ + +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.Label; +import java.awt.Robot; +import java.awt.Toolkit; + +public class PushPopDeadlock { + static int counter = 0; + static Robot robot; + static Frame f; + static Label l; + + public static void main(String[] args) throws Exception { + robot = new Robot(); + String INSTRUCTIONS = """ + Click rapidly in the Frame labeled 'Click Here!'. + The number in the Frame should continue to increase. If the number + stops increasing (remains at a constant value), the test fails. + """; + + PassFailJFrame pfJFrame = PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(35) + .testUI(PushPopDeadlock::createUI) + .build(); + PushPopDeadlock.test(); + pfJFrame.awaitAndCheck(); + } + + public static Frame createUI() { + f = new Frame("Click Here!"); + l = new Label("Counter: " + counter); + f.add(l); + f.setSize(200, 200); + return f; + } + + public static void test() { + EventQueue q = new EventQueue() { + public void push(EventQueue queue) { + super.push(queue); + pop(); + } + }; + EventQueue q2 = new EventQueue(); + + Toolkit.getDefaultToolkit().getSystemEventQueue().push(q); + + new Thread(() -> { + while (true) { + robot.delay(500); + l.setText("Counter: " + ++counter); + q.push(q2); + try { + Thread.currentThread().sleep(500); + } catch (InterruptedException e) { + return; + } + } + }).start(); + } +} diff --git a/test/jdk/java/awt/FileDialog/DoubleActionCloseX.java b/test/jdk/java/awt/FileDialog/DoubleActionCloseX.java new file mode 100644 index 000000000000..5d3feaa42ed4 --- /dev/null +++ b/test/jdk/java/awt/FileDialog/DoubleActionCloseX.java @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Button; +import java.awt.FileDialog; +import java.awt.Frame; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +/* + * @test + * @bug 6227750 + * @summary Tests that FileDialog can be closed by clicking the 'close' (X) button + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual DoubleActionCloseX + */ + +public class DoubleActionCloseX { + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + NOTE: On Linux and Mac, there is no 'close'(X) button + when file dialog is visible, press Pass. + + Click the 'Open File Dialog' button to open FileDialog. + A file dialog will appear on the screen. + Click on the 'close'(X) button. + The dialog should be closed. + If not, the test failed, press Fail otherwise press Pass. + """; + + PassFailJFrame.builder() + .title("DoubleActionCloseX Instruction") + .instructions(INSTRUCTIONS) + .columns(40) + .testUI(DoubleActionCloseX::createUI) + .build() + .awaitAndCheck(); + } + public static Frame createUI() { + Frame f = new Frame("DoubleActionCloseX Test"); + Button b = new Button("Open File Dialog"); + FileDialog fd = new FileDialog(f); + b.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + fd.setVisible(true); + } + }); + f.add(b); + f.setSize(300, 200); + return f; + } +} diff --git a/test/jdk/java/awt/FileDialog/DoubleActionESC.java b/test/jdk/java/awt/FileDialog/DoubleActionESC.java new file mode 100644 index 000000000000..748c3aeb5e44 --- /dev/null +++ b/test/jdk/java/awt/FileDialog/DoubleActionESC.java @@ -0,0 +1,122 @@ +/* + * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Button; +import java.awt.Dimension; +import java.awt.EventQueue; +import java.awt.FileDialog; +import java.awt.Frame; +import java.awt.Point; +import java.awt.Robot; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.InputEvent; +import java.awt.event.KeyEvent; +import java.util.concurrent.CountDownLatch; + +/* + * @test + * @bug 5097243 + * @summary Tests that FileDialog can be closed by ESC any time + * @key headful + * @run main DoubleActionESC + */ + +public class DoubleActionESC { + private static Frame f; + private static Button showBtn; + private static FileDialog fd; + private static Robot robot; + private static volatile Point p; + private static volatile Dimension d; + private static volatile CountDownLatch latch; + private static final int REPEAT_COUNT = 2; + + public static void main(String[] args) throws Exception { + latch = new CountDownLatch(1); + + robot = new Robot(); + robot.setAutoDelay(100); + try { + EventQueue.invokeAndWait(() -> { + createAndShowUI(); + }); + + robot.delay(1000); + EventQueue.invokeAndWait(() -> { + p = showBtn.getLocationOnScreen(); + d = showBtn.getSize(); + }); + + for (int i = 0; i < REPEAT_COUNT; ++i) { + Thread thread = new Thread(() -> { + robot.mouseMove(p.x + d.width / 2, p.y + d.height / 2); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + }); + thread.start(); + robot.delay(3000); + + Thread thread1 = new Thread(() -> { + robot.keyPress(KeyEvent.VK_ESCAPE); + robot.keyRelease(KeyEvent.VK_ESCAPE); + robot.waitForIdle(); + }); + thread1.start(); + robot.delay(3000); + } + + latch.await(); + if (fd.isVisible()) { + throw new RuntimeException("File Dialog is not closed"); + } + } finally { + EventQueue.invokeAndWait(() -> { + if (f != null) { + f.dispose(); + } + }); + } + } + + public static void createAndShowUI() { + f = new Frame("DoubleActionESC Test"); + showBtn = new Button("Show File Dialog"); + fd = new FileDialog(f); + showBtn.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + if (e.getSource() == showBtn) { + fd.setSize(200, 200); + fd.setLocation(200, 200); + fd.setVisible(true); + latch.countDown(); + } + } + }); + f.add(showBtn); + f.setSize(300, 200); + f.setLocationRelativeTo(null); + f.setVisible(true); + } +} diff --git a/test/jdk/java/awt/FileDialog/KeyboardInteractionTest.java b/test/jdk/java/awt/FileDialog/KeyboardInteractionTest.java new file mode 100644 index 000000000000..f919a8a338af --- /dev/null +++ b/test/jdk/java/awt/FileDialog/KeyboardInteractionTest.java @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Button; +import java.awt.FileDialog; +import java.awt.Frame; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +/* + * @test + * @bug 6259434 + * @summary PIT: Choice in FileDialog is not responding to keyboard interactions, XToolkit + * @requires (os.family == "linux") + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual KeyboardInteractionTest + */ + +public class KeyboardInteractionTest { + public static void main(String[] args) throws Exception { + System.setProperty("sun.awt.disableGtkFileDialogs", "true"); + String INSTRUCTIONS = """ + 1) Click on 'Show File Dialog' button to bring up the FileDialog window. + A file dialog will come up. + 2) You will see a text field 'Enter full path or filename'. + Right next to it, you will see a button. + Transfer the focus on this button using 'TAB'. + Make sure that the popup choice is not shown. + 3) Press 'ESC'. If file dialog isn't disposed, then the test failed. + 4) Again, click on 'Show File Dialog' to bring up the file dialog. + A file dialog will come up. + 5) You will see a text field 'Enter full path or filename'. + Right next to it, you will see a button. + Click on this button. The popup choice will appear. + 6) Look at the popup choice. Change the current item in the popup + choice by the arrow keys. + If the text in the 'Enter full path or filename' text field isn't + changed, then the test failed. + 7) The test passed. + """; + + PassFailJFrame.builder() + .title("KeyboardInteractionTest Instruction") + .instructions(INSTRUCTIONS) + .columns(40) + .testUI(KeyboardInteractionTest::createUI) + .build() + .awaitAndCheck(); + } + + public static Frame createUI() { + Frame f = new Frame("KeyboardInteractionTest Test"); + Button b = new Button("Show File Dialog"); + FileDialog fd = new FileDialog(f); + b.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + fd.setVisible(true); + } + }); + f.add(b); + f.setSize(300, 200); + return f; + } +} diff --git a/test/jdk/java/awt/FileDialog/PathChoiceDisposeTest.java b/test/jdk/java/awt/FileDialog/PathChoiceDisposeTest.java new file mode 100644 index 000000000000..267b2a807cff --- /dev/null +++ b/test/jdk/java/awt/FileDialog/PathChoiceDisposeTest.java @@ -0,0 +1,76 @@ +/* + * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Button; +import java.awt.FileDialog; +import java.awt.Frame; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +/* + * @test + * @bug 6240084 + * @summary Test that disposing unfurled list by the pressing ESC + * in FileDialog is working properly on XToolkit + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual PathChoiceDisposeTest + */ + +public class PathChoiceDisposeTest { + public static void main(String[] args) throws Exception { + System.setProperty("sun.awt.disableGtkFileDialogs", "true"); + String INSTRUCTIONS = """ + 1) Click on 'Show File Dialog' button to bring up the FileDialog window. + 2) Open the directory selection choice by clicking button next to + 'Enter Path or Folder Name'. A drop-down will appear. + 3) Press 'ESC'. + 4) If you see that the dialog gets disposed and the popup + still remains on the screen, the test failed, otherwise passed. + """; + + PassFailJFrame.builder() + .title("PathChoiceDisposeTest Instruction") + .instructions(INSTRUCTIONS) + .columns(40) + .testUI(PathChoiceDisposeTest::createUI) + .build() + .awaitAndCheck(); + } + + public static Frame createUI() { + Frame f = new Frame("PathChoiceDisposeTest Test"); + Button b = new Button("Show File Dialog"); + FileDialog fd = new FileDialog(f); + b.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + fd.setVisible(true); + } + }); + f.add(b); + f.setSize(300, 200); + return f; + } +} diff --git a/test/jdk/java/awt/FileDialog/PathChoiceWorkArrowsTest.java b/test/jdk/java/awt/FileDialog/PathChoiceWorkArrowsTest.java new file mode 100644 index 000000000000..17aee8abb800 --- /dev/null +++ b/test/jdk/java/awt/FileDialog/PathChoiceWorkArrowsTest.java @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Button; +import java.awt.FileDialog; +import java.awt.Frame; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +/* + * @test + * @bug 6240074 + * @summary Test that file drop-down field in FileDialog is working properly on XToolkit + * @requires (os.family == "linux") + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual PathChoiceWorkArrowsTest + */ + +public class PathChoiceWorkArrowsTest { + public static void main(String[] args) throws Exception { + System.setProperty("sun.awt.disableGtkFileDialogs", "true"); + String INSTRUCTIONS = """ + This is only XAWT test. + + 1) Click on 'Show File Dialog' to bring up the FileDialog window. + A file dialog would come up. + 2) Click on the button next to 'Enter folder name' field. + A drop-down will appear. After this, there are 2 scenarios. + 3) Press the down arrow one by one. You will see a '/' being + appended as soon as the current entry is removed. + Keep pressing till the last entry is reached. Now the drop-down + will stop responding to arrow keys. If yes, the test failed. + 4) Press the up arrow. The cursor will directly go to the last + entry ('/') and navigation will stop there. You will see 2 + entries being selected at the same time. + If yes, the test failed. + """; + + PassFailJFrame.builder() + .title("PathChoiceWorkArrowsTest Instruction") + .instructions(INSTRUCTIONS) + .columns(40) + .testUI(PathChoiceWorkArrowsTest::createUI) + .build() + .awaitAndCheck(); + } + + public static Frame createUI() { + Frame f = new Frame("PathChoiceWorkArrowsTest Test"); + Button b = new Button("Show File Dialog"); + FileDialog fd = new FileDialog(f); + b.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + fd.setSize(200, 200); + fd.setLocation(200, 200); + fd.setVisible(true); + } + }); + f.add(b); + f.setSize(300, 200); + return f; + } +} diff --git a/test/jdk/java/awt/FileDialog/SavedDirInitTest.java b/test/jdk/java/awt/FileDialog/SavedDirInitTest.java new file mode 100644 index 000000000000..7a3b33f55fe1 --- /dev/null +++ b/test/jdk/java/awt/FileDialog/SavedDirInitTest.java @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Button; +import java.awt.FileDialog; +import java.awt.Frame; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +/* + * @test + * @bug 6260650 + * @summary FileDialog.getDirectory() does not return null when file dialog is cancelled + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual SavedDirInitTest + */ + +public class SavedDirInitTest { + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + Click on 'Show File Dialog' button to bring up the FileDialog window. + 1) A file dialog will come up. + 2) Press 'Cancel' button to cancel the file dialog. + 3) The result (passed or failed) will be shown in the message window below. + """; + + PassFailJFrame.builder() + .title("SavedDirInitTest Instruction") + .instructions(INSTRUCTIONS) + .columns(40) + .testUI(SavedDirInitTest::createUI) + .logArea(2) + .build() + .awaitAndCheck(); + } + + public static Frame createUI() { + Frame f = new Frame("SavedDirInitTest Test"); + Button b = new Button("Show File Dialog"); + FileDialog fd = new FileDialog(f); + b.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + fd.setVisible(true); + if (fd.getDirectory() == null && fd.getFile() == null) { + PassFailJFrame.log("TEST PASSED"); + } else { + PassFailJFrame.log("TEST FAILED. dir = " + fd.getDirectory() + + " , file = " + fd.getFile()); + } + } + }); + f.add(b); + f.setSize(300, 200); + return f; + } +} diff --git a/test/jdk/java/awt/FileDialog/TestFileDialogDupJNIRef.java b/test/jdk/java/awt/FileDialog/TestFileDialogDupJNIRef.java new file mode 100644 index 000000000000..56b6c4921448 --- /dev/null +++ b/test/jdk/java/awt/FileDialog/TestFileDialogDupJNIRef.java @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Button; +import java.awt.Dialog; +import java.awt.FileDialog; +import java.awt.FlowLayout; +import java.awt.Frame; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +/* + * @test + * @bug 4906972 + * @summary Tests using of JNI reference to peer object. + * @requires (os.family == "windows") + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual TestFileDialogDupJNIRef + */ + +public class TestFileDialogDupJNIRef { + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + This is a crash test. + After test started you will see 'Test Frame' with one button. + 1. Click the button to open FileDialog. + 2. Go to the dialog and choose any directory with some files in it.. + 3. Click on any file to highlight it. + 4. Click on the file again to rename. + 5. Leave the file in edit mode and click Open button + + If there was no crash the test passed, Press Pass. + """; + + PassFailJFrame.builder() + .title("TestFileDialogDupJNIRef Instruction") + .instructions(INSTRUCTIONS) + .columns(40) + .testUI(TestFileDialogDupJNIRef::createUI) + .build() + .awaitAndCheck(); + } + + public static Frame createUI() { + Frame frame = new Frame("TestFileDialogDupJNIRef Test Frame"); + Button open = new Button("Open File Dialog"); + + open.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + FileDialog fd = new FileDialog(frame); + fd.setVisible(true); + } + }); + + frame.setLayout(new FlowLayout()); + frame.add(open); + frame.setSize(250, 70); + return frame; + } +} diff --git a/test/jdk/java/awt/Focus/ActivateFocusTest.java b/test/jdk/java/awt/Focus/ActivateFocusTest.java new file mode 100644 index 000000000000..09f5bbb172ca --- /dev/null +++ b/test/jdk/java/awt/Focus/ActivateFocusTest.java @@ -0,0 +1,148 @@ +/* + * Copyright (c) 2001, 2024, 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 4369903 + * @summary Focus on window activation does not work correctly + * @key headful + * @run main ActivateFocusTest + */ + +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Toolkit; +import java.awt.event.FocusEvent; +import java.awt.event.FocusListener; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; + +public class ActivateFocusTest { + + public static void main(final String[] args) { + ActivateFocusTest app = new ActivateFocusTest(); + app.doTest(); + } + + public void doTest() { + ActivateFocus[] af = new ActivateFocus[2]; + boolean testFailed = false; + Dimension scrSize = Toolkit.getDefaultToolkit().getScreenSize(); + for (int i = 0; i < 2; i++) { + af[i] = new ActivateFocus(i); + af[i].setLocation(i * 160 + scrSize.width / 2, scrSize.height / 2); + af[i].setVisible(true); + } + try { + Thread.sleep(5000); + } catch (InterruptedException ie) { + throw new RuntimeException("TEST FAILED - thread was interrupted"); + } + for (int i = 0; i < 2; i++) { + testFailed = (af[i].lw.focusCounter > 1); + } + if (testFailed) { + throw new RuntimeException("TEST FAILED - focus is gained more than one time"); + } else { + System.out.println("TEST PASSED"); + } + } + + } + +class ActivateFocus extends Frame { + + public LightWeight lw = null; + int num; + + public String toString() { + return ("Window " + num); + } + + public ActivateFocus(int i) { + setTitle("Window " + i); + lw = new LightWeight(i); + num=i; + addWindowListener(new WindowAdapter() { + public void windowActivated(WindowEvent e) { + if(lw != null) { + lw.requestFocus(); + } + } + }); + add(lw); + pack(); + } + + // A very simple lightweight component + class LightWeight extends Component implements FocusListener { + + boolean focused = false; + int num; + public int focusCounter = 0; + + public LightWeight(int num) { + this.num = num; + addFocusListener(this); + } + + public void paint(Graphics g) { + Dimension size = getSize(); + int w = size.width; + int h = size.height; + g.setColor(getBackground()); + g.fillRect(0, 0, w, h); + g.setColor(Color.black); + g.drawOval(0, 0, w-1, h-1); + if (focused) { + g.drawLine(w/2, 0, w/2, h); + g.drawLine(0, h/2, w, h/2); + } + + } + + public Dimension getPreferredSize() { + return new Dimension(150, 150); + } + + public void focusGained(FocusEvent e) { + focused = true; + focusCounter++; + System.out.println("focusGained on " + e.getComponent()); + repaint(); + } + + public void focusLost(FocusEvent e) { + focused = false; + System.out.println("focusLost on " + e.getComponent()); + repaint(); + } + + public String toString() { + return ("Component " + num); + } + } +} diff --git a/test/jdk/java/awt/Focus/ActivateOnProperAppContextTest.java b/test/jdk/java/awt/Focus/ActivateOnProperAppContextTest.java new file mode 100644 index 000000000000..ab0839833214 --- /dev/null +++ b/test/jdk/java/awt/Focus/ActivateOnProperAppContextTest.java @@ -0,0 +1,245 @@ +/* + * Copyright (c) 2006, 2024, 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 6385277 +* @key headful +* @summary Tests that activation happens on correct AppContext. +* @modules java.desktop/sun.awt +* @run main ActivateOnProperAppContextTest +*/ + +import sun.awt.AppContext; +import sun.awt.SunToolkit; + +import java.awt.Button; +import java.awt.Component; +import java.awt.Container; +import java.awt.Cursor; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.Label; +import java.awt.Point; +import java.awt.Robot; +import java.awt.Toolkit; +import java.awt.Window; +import java.awt.event.InputEvent; +import java.util.concurrent.atomic.AtomicBoolean; + +public class ActivateOnProperAppContextTest { + static Robot robot; + SunToolkit toolkit; + + ThreadGroup threadGroup = new ThreadGroup("Test_Thread_Group"); + AppContext appContext; + Frame frame; + volatile boolean passed = true; + AtomicBoolean cond = new AtomicBoolean(false); + + public static void main(String[] args) throws Exception { + ActivateOnProperAppContextTest app = new ActivateOnProperAppContextTest(); + robot = new Robot(); + app.start(); + } + + public void start() { + toolkit = (SunToolkit)Toolkit.getDefaultToolkit(); + + Runnable runnable = new Runnable() { + public void run() { + test(); + + synchronized (cond) { + cond.set(true); + cond.notifyAll(); + } + } + }; + + Thread thread = new Thread(threadGroup, runnable, "Test Thread"); + + synchronized (cond) { + + thread.start(); + + while (!cond.get()) { + try { + cond.wait(); + } catch (InterruptedException ie) { + ie.printStackTrace(); + } + } + } + + if (passed) { + System.out.println("Test passed."); + } else { + throw new TestFailedException("Test failed!"); + } + } + + void test() { + appContext = SunToolkit.createNewAppContext(); + System.out.println("Created new AppContext: " + appContext); + + frame = new Frame("ActivateOnProperAppContextTest Frame") { + public boolean isActive() { + verifyAppContext("Frame.isActive()"); + return super.isActive(); + } + public boolean isFocused() { + verifyAppContext("Frame.isFocused()"); + return super.isFocused(); + } + public boolean isFocusable() { + verifyAppContext("Frame.isFocusable()"); + return super.isFocusable(); + } + public Window getOwner() { + verifyAppContext("Frame.getOwner()"); + return super.getOwner(); + } + public boolean isEnabled() { + verifyAppContext("Frame.isEnabled()"); + return super.isEnabled(); + } + public boolean isVisible() { + verifyAppContext("Frame.isVisible()"); + return super.isVisible(); + } + public Container getParent() { + verifyAppContext("Frame.getParent()"); + return super.getParent(); + } + public Cursor getCursor() { + verifyAppContext("Frame.getCursor()"); + return super.getCursor(); + } + public Point getLocation() { + verifyAppContext("Frame.getLocation()"); + return super.getLocation(); + } + public Point getLocationOnScreen() { + verifyAppContext("Frame.getLocationOnScreen()"); + return super.getLocationOnScreen(); + } + }; + Window window = new Window(frame) { + public boolean isFocused() { + verifyAppContext("Window.isFocused()"); + return super.isFocused(); + } + public boolean isFocusable() { + verifyAppContext("Window.isFocusable()"); + return super.isFocusable(); + } + public Window getOwner() { + verifyAppContext("Window.getOwner()"); + return super.getOwner(); + } + public boolean isEnabled() { + verifyAppContext("Window.isEnabled()"); + return super.isEnabled(); + } + public boolean isVisible() { + verifyAppContext("Window.isVisible()"); + return super.isVisible(); + } + public Container getParent() { + verifyAppContext("Window.getParent()"); + return super.getParent(); + } + public Cursor getCursor() { + verifyAppContext("Window.getCursor()"); + return super.getCursor(); + } + public Point getLocation() { + verifyAppContext("Window.getLocation()"); + return super.getLocation(); + } + public Point getLocationOnScreen() { + verifyAppContext("Window.getLocationOnScreen()"); + return super.getLocationOnScreen(); + } + }; + Button button = new Button("button"); + Label label = new Label("label"); + + window.setLayout(new FlowLayout()); + window.add(button); + window.add(label); + window.setLocation(800, 0); + window.pack(); + window.setVisible(true); + + frame.setBounds(800, 100, 100, 50); + frame.setVisible(true); + + toolkit.realSync(); + + /* + * When the label is clicked in the window some of + * the owner's public method get called. + */ + clickOn(label); + } + + void verifyAppContext(String methodName) { + AppContext ac = AppContext.getAppContext(); + println(methodName + " called on AppContext: " + ac); + + if (ac != appContext) { + passed = false; + System.err.println("Test failed: " + methodName + " is called on wrong AppContext!"); + Thread.dumpStack(); + } + } + + void clickOn(Component c) { + Point p = c.getLocationOnScreen(); + Dimension d = c.getSize(); + + robot.mouseMove(p.x + (int)(d.getWidth()/2), p.y + (int)(d.getHeight()/2)); + + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.delay(20); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + + toolkit.realSync(); + } + + void println(final String msg) { + SunToolkit.executeOnEventHandlerThread(frame, new Runnable() { + public void run() { + System.out.println(msg); + } + }); + } +} + +class TestFailedException extends RuntimeException { + TestFailedException(String msg) { + super(msg); + } +} diff --git a/test/jdk/java/awt/Focus/AltTabEventsTest.java b/test/jdk/java/awt/Focus/AltTabEventsTest.java new file mode 100644 index 000000000000..15d679ce7295 --- /dev/null +++ b/test/jdk/java/awt/Focus/AltTabEventsTest.java @@ -0,0 +1,151 @@ +/* + * Copyright (c) 2002, 2024, 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 4524015 + * @summary Tests that when user switches between windows using Alt-tab then the appropriate events are generated + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual AltTabEventsTest + */ + +import java.awt.Button; +import java.awt.Choice; +import java.awt.Component; +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.Menu; +import java.awt.MenuBar; +import java.awt.MenuItem; +import java.awt.PopupMenu; +import java.awt.event.ActionListener; +import java.awt.event.ActionEvent; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; + +public class AltTabEventsTest { + + private static final String INSTRUCTIONS = """ + This test verifies that when user switches between windows using Alt-tab + key combination then appropriate window events are generated. Also, when + user interacts with Menu bar, Popup menu, Choice then no excessive window + event is generated. + + After test started you will see Frame('Test for 4524015')-F1 with some + components and Frame('Another frame')-F2 with no components. + 1. Make F1 active by clicking on it. + 2. Press Alt-tab. + In the messqge dialog area you should see that + WINDOW_DEACTIVATED, WINDOW_LOST_FOCUS event were generated. + If you switched to F2 then also WINDOW_ACTIVATED, WINDOW_GAINED_FOCUS + were generated. + If no events were generated the test FAILED. + Repeat the 2) with different circumstances. + + 3. Make F1 active by clicking on it. + 4. Click on Menu bar/Button 'popup'/Choice and select some item from + the list shown. If any of the window events appeared in the output then + the test FAILED. + + else the test PASSED."""; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("AltTabEventsTest Instructions") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 5) + .columns(35) + .testUI(Test::new) + .logArea() + .build() + .awaitAndCheck(); + } + +} + + +class Test extends Frame { + PopupMenu pop; + Frame f; + + void println(String messageIn) { + PassFailJFrame.log(messageIn); + } + + public Test() { + super("Test for 4524015"); + WindowAdapter wa = new WindowAdapter() { + public void windowActivated(WindowEvent e) { + println(e.toString()); + } + public void windowDeactivated(WindowEvent e) { + println(e.toString()); + } + public void windowGainedFocus(WindowEvent e) { + println(e.toString()); + } + public void windowLostFocus(WindowEvent e) { + println(e.toString()); + } + }; + addWindowListener(wa); + addWindowFocusListener(wa); + + f = new Frame("Another frame"); + f.addWindowListener(wa); + f.addWindowFocusListener(wa); + f.setBounds(800, 300, 300, 100); + f.setVisible(true); + + setLayout(new FlowLayout()); + Button b = new Button("popup"); + add(b); + b.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + pop.show((Component)e.getSource(), 10, 10); + } + }); + Choice cho = new Choice(); + add(cho); + cho.addItem("1"); + cho.addItem("2"); + cho.addItem("3"); + + MenuBar bar = new MenuBar(); + Menu menu = new Menu("menu"); + MenuItem item = new MenuItem("first"); + menu.add(item); + item = new MenuItem("second"); + menu.add(item); + bar.add(menu); + setMenuBar(bar); + + pop = new PopupMenu(); + pop.add("1"); + pop.add("@"); + add(pop); + setSize(300, 100); + } +} + diff --git a/test/jdk/java/awt/Focus/CanvasPanelFocusOnClickTest.java b/test/jdk/java/awt/Focus/CanvasPanelFocusOnClickTest.java new file mode 100644 index 000000000000..8df21ba0f0a6 --- /dev/null +++ b/test/jdk/java/awt/Focus/CanvasPanelFocusOnClickTest.java @@ -0,0 +1,212 @@ +/* + * Copyright (c) 1999, 2024, 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 4041703 4096228 4032657 4066152 4149866 4025223 + * @summary Ensures that an Panel/Canvas without heavyweight children + receives focus on mouse click + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual CanvasPanelFocusOnClickTest + */ + +import java.awt.Button; +import java.awt.Canvas; +import java.awt.Color; +import java.awt.Component; +import java.awt.Frame; +import java.awt.GridLayout; +import java.awt.Panel; +import java.awt.event.FocusAdapter; +import java.awt.event.FocusEvent; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; + +public class CanvasPanelFocusOnClickTest { + + private static final String INSTRUCTIONS = """ + + Click on the red Canvas. Verify that it has focus by key pressing. + Click on the yellow Panel. Verify that it has focus by key pressing. + Click on the blue heavyweight Panel (NOT ON THE BUTTON!). + Verify that it doesn't have focus by key pressing. + If two empty containers are able to the get focus by a mouse click + and the container with heavyweight children are unable to get + the focus by a mouse click which can be verified through messages in message dialog + the test passes."""; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("CanvasPanelFocusOnClickTest Instructions") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(40) + .testUI(CanvasPanelFocusOnClickTest::createTestUI) + .logArea() + .build() + .awaitAndCheck(); + } + + private static Frame createTestUI() { + Canvas canvas = new Canvas();; + Panel emptyPanel = new Panel(); + Panel panel = new Panel(); + Button buttonInPanel = new Button("BUTTON ON PANEL"); + + Frame frame = new Frame("CanvasPanelFocusOnClickTest Frame"); + frame.setLayout(new GridLayout(3, 1)); + canvas.setBackground(Color.red); + canvas.setName("RED CANVAS"); + canvas.addFocusListener(new FocusAdapter() { + public void focusGained(FocusEvent e) { + println(e.toString()); + } + public void focusLost(FocusEvent e) { + println(e.toString()); + } + }); + canvas.addKeyListener(new KeyAdapter() { + public void keyPressed(KeyEvent e) { + printKey(e); + } + + public void keyTyped(KeyEvent e) { + printKey(e); + } + + public void keyReleased(KeyEvent e) { + printKey(e); + } + }); + frame.add(canvas); + + emptyPanel.setBackground(Color.yellow); + emptyPanel.setName("YELLOW PANEL"); + emptyPanel.addFocusListener(new FocusAdapter() { + public void focusGained(FocusEvent e) { + println(e.toString()); + } + public void focusLost(FocusEvent e) { + println(e.toString()); + } + }); + emptyPanel.addKeyListener(new KeyAdapter() { + public void keyPressed(KeyEvent e) { + printKey(e); + } + + public void keyTyped(KeyEvent e) { + printKey(e); + } + + public void keyReleased(KeyEvent e) { + printKey(e); + } + }); + frame.add(emptyPanel); + + panel.setBackground(Color.blue); + panel.setName("BLUE PANEL"); + buttonInPanel.setName("BUTTON ON PANEL"); + buttonInPanel.addFocusListener(new FocusAdapter() { + public void focusGained(FocusEvent e) { + println(e.toString()); + } + public void focusLost(FocusEvent e) { + println(e.toString()); + } + }); + buttonInPanel.addKeyListener(new KeyAdapter() { + public void keyPressed(KeyEvent e) { + printKey(e); + } + + public void keyTyped(KeyEvent e) { + printKey(e); + } + + public void keyReleased(KeyEvent e) { + printKey(e); + } + }); + panel.add(buttonInPanel); + panel.addFocusListener(new FocusAdapter() { + public void focusGained(FocusEvent e) { + println(e.toString()); + } + public void focusLost(FocusEvent e) { + println(e.toString()); + } + }); + panel.addKeyListener(new KeyAdapter() { + public void keyPressed(KeyEvent e) { + printKey(e); + } + + public void keyTyped(KeyEvent e) { + printKey(e); + } + + public void keyReleased(KeyEvent e) { + printKey(e); + } + }); + frame.add(panel); + + frame.setSize(200, 200); + + return frame; + + } + + static void printKey(KeyEvent e) { + String typeStr; + switch(e.getID()) { + case KeyEvent.KEY_PRESSED: + typeStr = "KEY_PRESSED"; + break; + case KeyEvent.KEY_RELEASED: + typeStr = "KEY_RELEASED"; + break; + case KeyEvent.KEY_TYPED: + typeStr = "KEY_TYPED"; + break; + default: + typeStr = "unknown type"; + } + + Object source = e.getSource(); + if (source instanceof Component) { + typeStr += " on " + ((Component)source).getName(); + } else { + typeStr += " on " + source; + } + + println(typeStr); + } + + static void println(String messageIn) { + PassFailJFrame.log(messageIn); + } +} diff --git a/test/jdk/java/awt/Focus/ComponentLostFocusTest.java b/test/jdk/java/awt/Focus/ComponentLostFocusTest.java new file mode 100644 index 000000000000..6af8322b2cd8 --- /dev/null +++ b/test/jdk/java/awt/Focus/ComponentLostFocusTest.java @@ -0,0 +1,154 @@ +/* + * Copyright (c) 2004, 2024, 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 4982943 + * @key headful + * @summary focus lost in text fields or text areas, unable to enter characters from keyboard + * @run main ComponentLostFocusTest + */ + +import java.awt.Dialog; +import java.awt.EventQueue; +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.KeyboardFocusManager; +import java.awt.Point; +import java.awt.Robot; +import java.awt.TextField; +import java.awt.event.FocusAdapter; +import java.awt.event.FocusEvent; +import java.awt.event.InputEvent; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; + +public class ComponentLostFocusTest { + + static Frame frame; + static TextField tf; + static Robot r; + static Dialog dialog = null; + static volatile boolean passed; + static volatile Point loc; + static volatile int width; + static volatile int top; + + private static void createTestUI() { + + dialog = new Dialog(frame, "Dialog", true); + + frame = new Frame("ComponentLostFocusTest Frame"); + frame.setLayout(new FlowLayout()); + frame.addWindowFocusListener(new WindowAdapter() { + public void windowGainedFocus(WindowEvent e) { + System.out.println("Frame gained focus: "+e); + } + }); + tf = new TextField("Text Field"); + frame.add(tf); + frame.setSize(400,300); + frame.setVisible(true); + frame.setLocationRelativeTo(null); + frame.validate(); + } + + public static void doTest() { + System.out.println("dialog.setVisible.... "); + new Thread(new Runnable() { + public void run() { + dialog.setVisible(true); + } + }).start(); + + // The bug is that this construction leads to the redundant xRequestFocus + // By the way, the requestFocusInWindow() works fine before the fix + System.out.println("requesting.... "); + frame.requestFocus(); + + r.delay(1000); + + // Returning the focus to the initial frame will work correctly after the fix + System.out.println("disposing.... "); + dialog.dispose(); + + r.delay(1000); + + // We want to track the GAIN_FOCUS from this time + tf.addFocusListener(new FocusAdapter() { + public void focusGained(FocusEvent e) { + System.out.println("TextField gained focus: " + e); + passed = true; + } + }); + + } + + private static void doRequestFocusToTextField() { + // do activation using press title + r.mouseMove(loc.x + width / 2, loc.y + top / 2); + r.waitForIdle(); + r.mousePress(InputEvent.BUTTON1_DOWN_MASK); + r.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + r.waitForIdle(); + + // request focus to the text field + tf.requestFocus(); + } + + public static final void main(String args[]) throws Exception { + r = new Robot(); + r.setAutoDelay(100); + + EventQueue.invokeAndWait(() -> createTestUI()); + r.waitForIdle(); + r.delay(1000); + try { + EventQueue.invokeAndWait(() -> { + doTest(); + loc = frame.getLocationOnScreen(); + width = frame.getWidth(); + top = frame.getInsets().top; + }); + doRequestFocusToTextField(); + + System.out.println("Focused window: " + + KeyboardFocusManager.getCurrentKeyboardFocusManager(). + getFocusedWindow()); + System.out.println("Focus owner: " + + KeyboardFocusManager.getCurrentKeyboardFocusManager(). + getFocusOwner()); + + if (!passed) { + throw new RuntimeException("TextField got no focus! Test failed."); + } + } finally { + EventQueue.invokeAndWait(() -> { + if (frame != null) { + frame.dispose(); + } + }); + } + } +} + diff --git a/test/jdk/java/awt/Focus/ConsumedKeyEventTest.java b/test/jdk/java/awt/Focus/ConsumedKeyEventTest.java new file mode 100644 index 000000000000..dda82adeec58 --- /dev/null +++ b/test/jdk/java/awt/Focus/ConsumedKeyEventTest.java @@ -0,0 +1,197 @@ +/* + * Copyright (c) 2002, 2024, 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 4700276 + * @summary Peers process KeyEvents before KeyEventPostProcessors + * @requires (os.family == "windows") + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual ConsumedKeyEventTest +*/ + +import java.awt.Canvas; +import java.awt.Component; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.KeyboardFocusManager; +import java.awt.KeyEventPostProcessor; +import java.awt.event.KeyEvent; +import java.awt.event.FocusAdapter; +import java.awt.event.FocusEvent; +import java.awt.event.FocusListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; + +public class ConsumedKeyEventTest implements KeyEventPostProcessor { + + private static final String INSTRUCTIONS = """ + This is a Windows-only test. + When the test starts, you will see a Frame with two components in it, + components look like colored rectangles, one of them is lightweight, one is heavyweight. + Do the following: + 1. Click the mouse on the left component. + If it isn't yellow after the click (that means it doesn't have focus), the test fails. + 2. Press and release ALT key. + In the output window, the text should appear stating that those key events were consumed. + If no output appears, the test fails. + 3. Press space bar. If system menu drops down, the test fails. + 4. Click the right rectangle. + It should become red after the click. If it doesn't, it means that it didn't get the focus, and the test fails. + 5. Repeat steps 2. and 3. + 6. If the test didn't fail on any of the previous steps, the test passes."""; + + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("ConsumedKeyEventTest Instructions") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 5) + .columns(35) + .testUI(ConsumedKeyEventTest::createTestUI) + .logArea() + .build() + .awaitAndCheck(); + } + + private static Frame createTestUI() { + KeyboardFocusManager.getCurrentKeyboardFocusManager(). + addKeyEventPostProcessor((e) -> { + System.out.println("postProcessor(" + e + ")"); + // consumes all ALT-events + if (e.getKeyCode() == KeyEvent.VK_ALT) { + println("consumed " + e); + e.consume(); + return true; + } + return false; + }); + FocusRequestor requestor = new FocusRequestor(); + Frame frame = new Frame("Main Frame"); + frame.setLayout(new FlowLayout()); + + Canvas canvas = new CustomCanvas(); + canvas.addMouseListener(requestor); + frame.add(canvas); + canvas.requestFocus(); + + Component lwComp = new LWComponent(); + lwComp.addMouseListener(requestor); + frame.add(lwComp); + + frame.pack(); + + return frame; + } + + public boolean postProcessKeyEvent(KeyEvent e) { + System.out.println("postProcessor(" + e + ")"); + // consumes all ALT-events + if (e.getKeyCode() == KeyEvent.VK_ALT) { + println("consumed " + e); + e.consume(); + return true; + } + return false; + } + + static void println(String messageIn) { + PassFailJFrame.log(messageIn); + } +}// class ConsumedKeyEventTest + +class CustomCanvas extends Canvas { + CustomCanvas() { + super(); + setName("HWComponent"); + setSize(100, 100); + addFocusListener(new FocusAdapter() { + public void focusGained(FocusEvent fe) { + repaint(); + } + + public void focusLost(FocusEvent fe) { + repaint(); + } + }); + } + + public void paint(Graphics g) { + if (isFocusOwner()) { + g.setColor(Color.YELLOW); + } else { + g.setColor(Color.GREEN); + } + g.fillRect(0, 0, 100, 100); + } + +} + +class LWComponent extends Component { + LWComponent() { + super(); + setName("LWComponent"); + addFocusListener(new FocusAdapter() { + public void focusGained(FocusEvent fe) { + repaint(); + } + + public void focusLost(FocusEvent fe) { + repaint(); + } + }); + } + + public Dimension getPreferredSize() { + return new Dimension(100, 100); + } + + public void paint(Graphics g) { + if (isFocusOwner()) { + g.setColor(Color.RED); + } else { + g.setColor(Color.BLACK); + } + g.fillRect(0, 0, 100, 100); + } + +} + +class FocusRequestor extends MouseAdapter { + static int counter = 0; + public void mouseClicked(MouseEvent me) { + System.out.println("mouseClicked on " + me.getComponent().getName()); + } + public void mousePressed(MouseEvent me) { + System.out.println("mousePressed on " + me.getComponent().getName()); + me.getComponent().requestFocus(); + } + public void mouseReleased(MouseEvent me) { + System.out.println("mouseReleased on " + me.getComponent().getName()); + } +} + diff --git a/test/jdk/java/awt/Focus/DeiconifyTest.java b/test/jdk/java/awt/Focus/DeiconifyTest.java new file mode 100644 index 000000000000..e87b13b8e65f --- /dev/null +++ b/test/jdk/java/awt/Focus/DeiconifyTest.java @@ -0,0 +1,79 @@ +/* + * Copyright (c) 2000, 2024, 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 4380809 + * @summary Focus disappears after deiconifying frame + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual DeiconifyTest +*/ + +import java.awt.Button; +import java.awt.Frame; +import java.awt.event.FocusEvent; +import java.awt.event.FocusListener; + +public class DeiconifyTest { + + private static final String INSTRUCTIONS = """ + 1. Activate frame \"Main frame\" + be sure that button has focus + 2. Minimize frame and then restore it. + If the button has focus then test passed, else failed"""; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("DeiconifyTest Instructions") + .instructions(INSTRUCTIONS) + .rows((int)INSTRUCTIONS.lines().count() + 2) + .columns(35) + .testUI(DeiconifyTest::createTestUI) + .logArea() + .build() + .awaitAndCheck(); + } + + private static Frame createTestUI() { + Frame frame = new Frame("Main frame"); + Button button = new Button("button"); + button.addFocusListener(new FocusListener() { + public void focusGained(FocusEvent fe) { + println("focus gained"); + } + public void focusLost(FocusEvent fe) { + println("focus lost"); + } + }); + frame.add(button); + frame.setSize(300, 100); + + return frame; + } + + static void println(String messageIn) { + PassFailJFrame.log(messageIn); + } +} + diff --git a/test/jdk/java/awt/Focus/EmptyWindowKeyTest.java b/test/jdk/java/awt/Focus/EmptyWindowKeyTest.java new file mode 100644 index 000000000000..bbdf8ce4f383 --- /dev/null +++ b/test/jdk/java/awt/Focus/EmptyWindowKeyTest.java @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2001, 2024, 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 4464723 + * @summary Tests simple KeyAdapter / KeyListener on an empty, focusable window + * @key headful + * @run main EmptyWindowKeyTest +*/ + +import java.awt.AWTEvent; +import java.awt.Frame; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; +import java.awt.Robot; + +public class EmptyWindowKeyTest { + + static volatile boolean passed1, passed2; + + public static void main(String[] args) throws Exception { + Robot robot = new Robot(); + robot.setAutoDelay(100); + MainFrame mainFrame = new MainFrame(); + mainFrame.setSize(50,50); + mainFrame.addKeyListener(new KeyboardTracker()); + robot.waitForIdle(); + robot.delay(1000); + robot.keyPress(KeyEvent.VK_A); + robot.keyRelease(KeyEvent.VK_A); + robot.waitForIdle(); + robot.delay(1000); + if (!passed1 || !passed2) { + throw new RuntimeException("KeyPress/keyRelease not seen," + + "passed1 " + passed1 + " passed2 " + passed2); + } + } + + static public class KeyboardTracker extends KeyAdapter { + public KeyboardTracker() { } + public void keyTyped(KeyEvent e) {} + + public void keyPressed(KeyEvent e) { + if (e.getKeyText(e.getKeyCode()).equals("A")) { + passed1 = true; + } + } + public void keyReleased(KeyEvent e) { + if (e.getKeyText(e.getKeyCode()).equals("A")) { + passed2 = true; + } + } + } + + static public class MainFrame extends Frame { + + public MainFrame() { + super(); + enableEvents(AWTEvent.KEY_EVENT_MASK); + setVisible(true); + } + + } + +} + diff --git a/test/jdk/java/awt/Focus/FocusChangeOnResizeTest.java b/test/jdk/java/awt/Focus/FocusChangeOnResizeTest.java new file mode 100644 index 000000000000..a9fa9e5edfd0 --- /dev/null +++ b/test/jdk/java/awt/Focus/FocusChangeOnResizeTest.java @@ -0,0 +1,122 @@ +/* + * Copyright (c) 2002, 2024, 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 4060975 + * @summary tests that a component doesn't lose focus on resize + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual FocusChangeOnResizeTest +*/ + +import java.util.List; + +import java.awt.Button; +import java.awt.Dialog; +import java.awt.Frame; +import java.awt.GridLayout; +import java.awt.Panel; +import java.awt.TextField; +import java.awt.Window; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.FocusEvent; +import java.awt.event.FocusListener; + +public class FocusChangeOnResizeTest { + + private static final String INSTRUCTIONS = """ + For the Frame and the Dialog: + Press the LOWER BUTTON to resize the Frame or Dialog programmatically. + Give the focus to the LOWER BUTTON and resize the Frame or Dialog manually. + If the LOWER BUTTON always has focus after resize + (for both frame and dialog) the test passes."""; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("PopupMenu Instructions") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(35) + .testUI(FocusChangeOnResizeTest::createTestUI) + .logArea() + .build() + .awaitAndCheck(); + } + + private static List createTestUI() { + Frame frame = new Frame("FocusChangeOnResizeTest frame"); + Dialog dialog = new Dialog(frame, "Test dialog"); + frame.add(new TestPanel(frame)); + dialog.add(new TestPanel(dialog)); + frame.setBounds (150, 200, 200, 200); + dialog.setBounds (150, 500, 200, 200); + return List.of(frame, dialog); + } + + static FocusListener eventLogger = new FocusListener() { + public void focusGained(FocusEvent e) { + PassFailJFrame.log(e.toString()); + } + public void focusLost(FocusEvent e) { + PassFailJFrame.log(e.toString()); + } + }; +} + +class TestPanel extends Panel { + + TextField textField = new TextField("TEXT FIELD"); + Button button1 = new Button("UPPER BUTTON"); + Button button2 = new Button("LOWER BUTTON"); + + public TestPanel(Window parent) { + setLayout(new GridLayout(3, 1)); + add(textField); + add(button1); + add(button2); + textField.setName("TEXT FIELD"); + button1.setName("UPPER BUTTON"); + button2.setName("LOWER BUTTON"); + textField.addFocusListener(FocusChangeOnResizeTest.eventLogger); + button1.addFocusListener(FocusChangeOnResizeTest.eventLogger); + button2.addFocusListener(FocusChangeOnResizeTest.eventLogger); + + button2.addActionListener(new Resizer(parent)); + } +} + +class Resizer implements ActionListener { + Window target; + + public Resizer(Window window) { + target = window; + } + + public void actionPerformed(ActionEvent e) { + target.setSize(200, 100); + target.doLayout(); + target.pack(); + } +} + diff --git a/test/jdk/java/awt/Focus/FocusKeepTest.java b/test/jdk/java/awt/Focus/FocusKeepTest.java new file mode 100644 index 000000000000..0adc463f5d9a --- /dev/null +++ b/test/jdk/java/awt/Focus/FocusKeepTest.java @@ -0,0 +1,103 @@ +/* + * Copyright (c) 1999, 2024, 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 4128659 + * @summary Tests whether a focus request will work on a focus lost event. + * @key headful + * @run main FocusKeepTest + */ + +import java.awt.BorderLayout; +import java.awt.KeyboardFocusManager; +import java.awt.Robot; +import java.awt.event.FocusAdapter; +import java.awt.event.FocusEvent; +import java.awt.event.KeyEvent; +import javax.swing.JFrame; +import javax.swing.JTextField; +import javax.swing.SwingUtilities; + +public class FocusKeepTest { + + static JFrame frame; + static JTextField tf; + + public static void main(String[] args) throws Exception { + Robot robot = new Robot(); + robot.setAutoDelay(100); + try { + SwingUtilities.invokeAndWait(() -> createTestUI()); + robot.waitForIdle(); + robot.delay(1000); + robot.keyPress(KeyEvent.VK_TAB); + robot.keyRelease(KeyEvent.VK_TAB); + if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() instanceof JTextField tf1) { + if (!tf1.getText().equals("TextField 1")) { + throw new RuntimeException("Focus on wrong textfield"); + } + } else { + throw new RuntimeException("Focus not on correct component"); + } + } finally { + SwingUtilities.invokeAndWait(() -> { + if (frame != null) { + frame.dispose(); + } + }); + } + } + + private static void createTestUI() { + frame = new JFrame("FocusKeepTest"); + tf = new JTextField("TextField 1"); + tf.addFocusListener(new MyFocusAdapter("TextField 1")); + frame.add(tf, BorderLayout.NORTH); + + tf = new JTextField("TextField 2"); + tf.addFocusListener(new MyFocusAdapter("TextField 2")); + frame.add(tf, BorderLayout.SOUTH); + + frame.pack(); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + } + + static class MyFocusAdapter extends FocusAdapter { + private String myName; + + public MyFocusAdapter (String name) { + myName = name; + } + + public void focusLost (FocusEvent e) { + if (myName.equals ("TextField 1")) { + e.getComponent().requestFocus (); + } + } + + public void focusGained (FocusEvent e) { + } + } +} diff --git a/test/jdk/java/awt/Focus/FocusPolicyTest.java b/test/jdk/java/awt/Focus/FocusPolicyTest.java new file mode 100644 index 000000000000..3ec362acaf08 --- /dev/null +++ b/test/jdk/java/awt/Focus/FocusPolicyTest.java @@ -0,0 +1,177 @@ +/* + * Copyright (c) 2003, 2024, 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 4897459 + * @key headful + * @summary The key does not switches focus in the internal frames in Swing apps. + * @run main FocusPolicyTest + */ + +import java.awt.Container; +import java.awt.Component; +import java.awt.DefaultFocusTraversalPolicy; +import java.awt.Dialog; +import java.awt.FocusTraversalPolicy; +import java.awt.Frame; +import java.awt.KeyboardFocusManager; +import java.awt.Toolkit; +import java.awt.Window; +import javax.swing.JDialog; +import javax.swing.JInternalFrame; +import javax.swing.JFrame; +import javax.swing.JWindow; +import javax.swing.LayoutFocusTraversalPolicy; + +public class FocusPolicyTest { + static int stageNum; + static FocusTraversalPolicy customPolicy = new CustomPolicy(); + final static Class awtDefaultPolicy = DefaultFocusTraversalPolicy.class; + final static Class swingDefaultPolicy = LayoutFocusTraversalPolicy.class; + + public static void main(String[] args) { + final boolean isXawt = "sun.awt.X11.XToolkit".equals(Toolkit.getDefaultToolkit().getClass().getName()); + + System.err.println("isXawt = " + isXawt); + + // 1. Check default policy + if (KeyboardFocusManager.getCurrentKeyboardFocusManager(). + getDefaultFocusTraversalPolicy().getClass() != awtDefaultPolicy) { + throw new RuntimeException("Error: stage 1: default policy is not DefaultFocusTraversalPolicy"); + } + + // 2. Check AWT top-levels policies + stageNum = 2; + checkAWTPoliciesFor(awtDefaultPolicy); + + // 3. Check Swing top-levels policies + stageNum = 3; + checkSwingPoliciesFor(swingDefaultPolicy); + + // 4. Check default policy if not XToolkit + if (!isXawt) { + if (KeyboardFocusManager.getCurrentKeyboardFocusManager(). + getDefaultFocusTraversalPolicy().getClass() != swingDefaultPolicy) { + throw new RuntimeException("Error: stage 4: default policy is not LayoutFocusTraversalPolicy"); + } + } + + // 5. Check AWT top-levels policies + // this is a bug in XAWT we should change the test as soon as + // we will be able to fix this bug. + stageNum = 5; + Class defaultPolicy = swingDefaultPolicy; + if (isXawt) { + defaultPolicy = awtDefaultPolicy; + } + checkAWTPoliciesFor(defaultPolicy); + + // Set custom policy as default + KeyboardFocusManager.getCurrentKeyboardFocusManager().setDefaultFocusTraversalPolicy(customPolicy); + + // 6. Check AWT top-levels policies for custom + stageNum = 6; + checkAWTPoliciesFor(customPolicy.getClass()); + + // 7. Check Swing top-levels policies for custom + stageNum = 7; + checkSwingPoliciesFor(customPolicy.getClass()); + + return; + } + + public static void checkAWTPoliciesFor(Class expectedPolicyClass) { + Window[] tlvs = new Window[7]; + + tlvs[0] = new Frame(""); + tlvs[1] = new Frame("", tlvs[0].getGraphicsConfiguration()); + tlvs[2] = new Window((Frame)tlvs[0]); + tlvs[3] = new Dialog((Frame)tlvs[0], "", false); + tlvs[4] = new Dialog((Frame)tlvs[0], "", false, tlvs[0].getGraphicsConfiguration()); + tlvs[5] = new Dialog((Dialog)tlvs[3], "", false); + tlvs[6] = new Dialog((Dialog)tlvs[3], "", false, tlvs[0].getGraphicsConfiguration()); + + for (int i = 0; i < 7; i++) { + Class policyClass = tlvs[i].getFocusTraversalPolicy().getClass(); + if (policyClass != expectedPolicyClass) { + throw new RuntimeException("Error: stage " + stageNum + ": " + + tlvs[i].getClass().getName() + + "'s policy is " + policyClass.getName() + + " but not " + expectedPolicyClass.getName()); + } + } + } + + public static void checkSwingPoliciesFor(Class expectedPolicyClass) { + Container[] tlvs = new Container[12]; + + tlvs[0] = new JFrame(); + tlvs[1] = new JFrame(tlvs[0].getGraphicsConfiguration()); + tlvs[2] = new JFrame(""); + tlvs[3] = new JFrame("", tlvs[0].getGraphicsConfiguration()); + tlvs[4] = new JWindow((Frame)tlvs[0]); + tlvs[5] = new JWindow((Window)tlvs[4]); + tlvs[6] = new JWindow((Window)tlvs[4], tlvs[0].getGraphicsConfiguration()); + tlvs[7] = new JDialog((Frame)tlvs[0], "", false); + tlvs[8] = new JDialog((Frame)tlvs[0], "", false, tlvs[0].getGraphicsConfiguration()); + tlvs[9] = new JDialog((Dialog)tlvs[7], "", false); + tlvs[10] = new JDialog((Dialog)tlvs[7], "", false, tlvs[0].getGraphicsConfiguration()); + tlvs[11] = new JInternalFrame("", false, false, false, false); + + for (int i = 0; i < tlvs.length; i++) { + Class policyClass = tlvs[i].getFocusTraversalPolicy().getClass(); + if (policyClass != expectedPolicyClass) { + throw new RuntimeException("Error: stage " + stageNum + + ": " + tlvs[i].getClass().getName() + + "'s policy is " + policyClass.getName() + " but not " + + expectedPolicyClass.getName()); + } + } + } + + // Dummy policy. + static class CustomPolicy extends FocusTraversalPolicy { + public Component getComponentAfter(Container focusCycleRoot, + Component aComponent) { + return null; + } + + public Component getComponentBefore(Container focusCycleRoot, + Component aComponent) { + return null; + } + + public Component getFirstComponent(Container focusCycleRoot) { + return null; + } + + public Component getLastComponent(Container focusCycleRoot) { + return null; + } + + public Component getDefaultComponent(Container focusCycleRoot) { + return null; + } + } +} diff --git a/test/jdk/java/awt/Focus/HiddenTraversalTest.java b/test/jdk/java/awt/Focus/HiddenTraversalTest.java new file mode 100644 index 000000000000..59e7f477945e --- /dev/null +++ b/test/jdk/java/awt/Focus/HiddenTraversalTest.java @@ -0,0 +1,72 @@ +/* + * Copyright (c) 1999, 2024, 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 4157017 + * @summary Checks whether focus can be traversed when component not visible + within parent container. + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual HiddenTraversalTest +*/ + +import java.awt.Button; +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.Panel; + +public class HiddenTraversalTest { + + private static final String INSTRUCTIONS = """ + Examine the Frame. If six buttons are visible, resize the frame + so that only four are visible. If fewer than six buttons are + visible, do nothing.\n + Now, repeatedly press the tab key. Focus should cycle through the + visible and invisible buttons. If after six presses of the tab + button 'Button 0' has focus, the test passes. If focus is instead + stuck at 'Button 3', the test fails."""; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("HiddenTraversalTest Instructions") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(35) + .testUI(HiddenTraversalTest::createTestUI) + .build() + .awaitAndCheck(); + } + + private static Frame createTestUI() { + Frame f = new Frame("Focus test"); + Panel p = new Panel(new FlowLayout()); + for (int i = 0; i < 6; i++) { + p.add(new Button("Button " + i)); + } + f.add(p); + f.setSize(200, 100); + return f; + } + +} + diff --git a/test/jdk/java/awt/Focus/InactiveFocusRace.java b/test/jdk/java/awt/Focus/InactiveFocusRace.java new file mode 100644 index 000000000000..efca2dbf53a1 --- /dev/null +++ b/test/jdk/java/awt/Focus/InactiveFocusRace.java @@ -0,0 +1,188 @@ +/* + * Copyright (c) 2002, 2024, 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 4697451 + * @summary Test that there is no race between focus component in inactive window and window activation + * @key headful + * @run main InactiveFocusRace +*/ + +import java.awt.Button; +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.KeyboardFocusManager; +import java.awt.Point; +import java.awt.Robot; +import java.awt.Toolkit; +import java.awt.event.FocusAdapter; +import java.awt.event.FocusEvent; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.awt.event.InputEvent; + +public class InactiveFocusRace { + + static Frame activeFrame, inactiveFrame; + Button activeButton, inactiveButton1, inactiveButton2; + Semaphore sema; + final static int TIMEOUT = 10000; + + public static void main(String[] args) throws Exception { + try { + InactiveFocusRace test = new InactiveFocusRace(); + test.init(); + test.start(); + } finally { + if (activeFrame != null) { + activeFrame.dispose(); + } + if (inactiveFrame != null) { + inactiveFrame.dispose(); + } + } + } + + public void init() { + activeButton = new Button("active button"); + inactiveButton1 = new Button("inactive button1"); + inactiveButton2 = new Button("inactive button2"); + activeFrame = new Frame("Active frame"); + inactiveFrame = new Frame("Inactive frame"); + inactiveFrame.setLayout(new FlowLayout()); + activeFrame.add(activeButton); + inactiveFrame.add(inactiveButton1); + inactiveFrame.add(inactiveButton2); + activeFrame.pack(); + activeFrame.setLocation(300, 10); + inactiveFrame.pack(); + inactiveFrame.setLocation(300, 300); + sema = new Semaphore(); + + inactiveButton1.addFocusListener(new FocusAdapter() { + public void focusGained(FocusEvent e) { + System.err.println("Button 1 got focus"); + } + }); + inactiveButton2.addFocusListener(new FocusAdapter() { + public void focusGained(FocusEvent e) { + System.err.println("Button2 got focus"); + sema.raise(); + } + }); + activeFrame.addWindowListener(new WindowAdapter() { + public void windowActivated(WindowEvent e) { + System.err.println("Window activated"); + sema.raise(); + } + }); + } + + public void start() { + Robot robot = null; + try { + robot = new Robot(); + } catch (Exception e) { + throw new RuntimeException("Unable to create robot"); + } + + inactiveFrame.setVisible(true); + activeFrame.setVisible(true); + + // Wait for active frame to become active + try { + sema.doWait(TIMEOUT); + } catch (InterruptedException ie) { + throw new RuntimeException("Wait was interrupted"); + } + if (!sema.getState()) { + throw new RuntimeException("Frame doesn't become active on show"); + } + sema.setState(false); + + // press on second button in inactive frame + Point loc = inactiveButton2.getLocationOnScreen(); + robot.mouseMove(loc.x+5, loc.y+5); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + + // after all second button should be focus owner. + try { + sema.doWait(TIMEOUT); + } catch (InterruptedException ie) { + throw new RuntimeException("Wait was interrupted"); + } + if (!sema.getState()) { + throw new RuntimeException("Button2 didn't become focus owner"); + } + Toolkit.getDefaultToolkit().sync(); + robot.waitForIdle(); + if (!(KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() == inactiveButton2)) { + throw new RuntimeException("Button2 should be the focus owner after all"); + } + + } + +} + +class Semaphore { + boolean state = false; + int waiting = 0; + public Semaphore() { + } + public void doWait() throws InterruptedException { + synchronized(this) { + if (state) return; + waiting++; + wait(); + waiting--; + } + } + public void doWait(int timeout) throws InterruptedException { + synchronized(this) { + if (state) return; + waiting++; + wait(timeout); + waiting--; + } + } + public void raise() { + synchronized(this) { + state = true; + if (waiting > 0) { + notifyAll(); + } + } + } + public boolean getState() { + synchronized(this) { + return state; + } + } + public void setState(boolean newState) { + synchronized(this) { + state = newState; + } + } +} diff --git a/test/jdk/java/awt/Focus/InitialPrintDlgFocusTest.java b/test/jdk/java/awt/Focus/InitialPrintDlgFocusTest.java new file mode 100644 index 000000000000..cc9d0c037118 --- /dev/null +++ b/test/jdk/java/awt/Focus/InitialPrintDlgFocusTest.java @@ -0,0 +1,107 @@ +/* + * Copyright (c) 2002, 2024, 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 4688591 + * @summary Tab key hangs in Native Print Dialog on win32 + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual InitialPrintDlgFocusTest + */ + +import java.awt.BorderLayout; +import java.awt.Dialog; +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.JobAttributes; +import java.awt.PageAttributes; +import java.awt.PrintJob; +import java.awt.Toolkit; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +import javax.swing.JButton; +import javax.swing.JFrame; + +public class InitialPrintDlgFocusTest { + + private static final String INSTRUCTIONS = """ + After the tests starts you will see a frame titled "PrintTest". + Press the "Print" button and the print dialog should appear. + If you are able to transfer focus between components of the Print dialog + using the TAB key, then the test passes else the test fails. + + Note: close the Print dialog before clicking on "Pass" or "Fail" buttons."""; + + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("InitialPrintDlgFocusTest Instructions") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(35) + .testUI(InitialPrintDlgFocusTest::createTestUI) + .build() + .awaitAndCheck(); + } + + private static JFrame createTestUI() { + return new PrintTest(); + + } +} + +class PrintTest extends JFrame implements ActionListener { + + JButton b; + JobAttributes jbattrib; + Toolkit tk ; + PageAttributes pgattrib; + + public PrintTest() { + setTitle("PrintTest"); + setSize(500, 400); + + b = new JButton("Print"); + jbattrib = new JobAttributes(); + tk = Toolkit.getDefaultToolkit(); + pgattrib = new PageAttributes(); + getContentPane().setLayout(new FlowLayout()); + getContentPane().add(b); + + b.addActionListener(this); + + } + + public void actionPerformed(ActionEvent ae) { + if(ae.getSource()==b) + jbattrib.setDialog(JobAttributes.DialogType.NATIVE); + + PrintJob pjob = tk.getPrintJob(this, "Printing Test", + jbattrib, pgattrib); + + } +} + diff --git a/test/jdk/java/awt/Focus/KeyStrokeTest.java b/test/jdk/java/awt/Focus/KeyStrokeTest.java new file mode 100644 index 000000000000..7c462ce8f22d --- /dev/null +++ b/test/jdk/java/awt/Focus/KeyStrokeTest.java @@ -0,0 +1,118 @@ +/* + * Copyright (c) 2003, 2024, 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 4845868 + * @summary REGRESSION: First keystroke after JDialog is closed is lost + * @key headful + * @run main KeyStrokeTest + */ + +import java.awt.BorderLayout; +import java.awt.Button; +import java.awt.Dialog; +import java.awt.Frame; +import java.awt.Robot; +import java.awt.TextField; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; + +public class KeyStrokeTest { + static boolean keyTyped; + static Frame frame; + + public static void main(String[] args) throws Exception { + try { + KeyStrokeTest test = new KeyStrokeTest(); + test.doTest(); + } finally { + if (frame != null) { + frame.dispose(); + } + } + } + + private static void doTest() throws Exception { + final Object monitor = new Object(); + frame = new Frame(); + TextField textField = new TextField() { + public void transferFocus() { + System.err.println("transferFocus()"); + final Dialog dialog = new Dialog(frame, true); + Button btn = new Button("Close It"); + btn.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + System.err.println("action performed"); + dialog.setVisible(false); + } + }); + dialog.add(btn); + dialog.setSize(200, 200); + dialog.setVisible(true); + } + }; + + textField.addKeyListener(new KeyAdapter() { + public void keyTyped(KeyEvent e) { + System.err.println(e); + if (e.getKeyChar() == 'a') { + keyTyped = true; + } + + synchronized (monitor) { + monitor.notifyAll(); + } + } + }); + frame.add(textField); + frame.setSize(400, 400); + frame.setVisible(true); + + Robot robot = new Robot(); + robot.waitForIdle(); + robot.delay(1000); + robot.keyPress(KeyEvent.VK_TAB); + robot.keyRelease(KeyEvent.VK_TAB); + + robot.delay(1000); + robot.keyPress(KeyEvent.VK_SPACE); + robot.keyRelease(KeyEvent.VK_SPACE); + + robot.delay(1000); + synchronized (monitor) { + robot.keyPress(KeyEvent.VK_A); + robot.keyRelease(KeyEvent.VK_A); + monitor.wait(3000); + } + + if (!keyTyped) { + throw new RuntimeException("TEST FAILED"); + } + + System.out.println("Test passed"); + } + +} diff --git a/test/jdk/java/awt/Focus/KillFocusTest.java b/test/jdk/java/awt/Focus/KillFocusTest.java new file mode 100644 index 000000000000..f61c18971f6f --- /dev/null +++ b/test/jdk/java/awt/Focus/KillFocusTest.java @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2001, 2024, 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 4402942 + * @summary After deactivation and activation of frame, focus should be restored correctlty + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual KillFocusTest +*/ + +import java.awt.Frame; +import java.awt.TextField; +import java.awt.event.FocusEvent; +import java.awt.event.FocusListener; + +public class KillFocusTest { + + private static final String INSTRUCTIONS = """ + After starting the test you should see \"Test Frame\" + with the \"Click me\" text field. + Click on this text field and try to type something in it. + Make sure that the field receives focus and you can enter text in it. + Click on any non-java window. + Click on \"Click me\" text field to return focus to it + If the caret is in the text field and you are able to type + in it then press pass else press fail."""; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("KillFocusTest Instructions") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(35) + .testUI(KillFocusTest::createTestUI) + .logArea() + .build() + .awaitAndCheck(); + } + + private static Frame createTestUI() { + + Frame frame = new Frame("KillFocusTest Frame"); + TextField textField = new TextField("Click me", 10); + textField.addFocusListener(new FocusListener() { + public void focusGained(FocusEvent fe) { + PassFailJFrame.log("Focus gained"); + } + public void focusLost(FocusEvent fe) { + PassFailJFrame.log("Focus lost"); + } + }); + frame.add(textField); + frame.setSize(200, 100); + return frame; + } + + +} + diff --git a/test/jdk/java/awt/Focus/LightweightFocusLostTest.java b/test/jdk/java/awt/Focus/LightweightFocusLostTest.java new file mode 100644 index 000000000000..aff2e5e3b2eb --- /dev/null +++ b/test/jdk/java/awt/Focus/LightweightFocusLostTest.java @@ -0,0 +1,261 @@ +/* + * Copyright (c) 1999, 2024, 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 4124119 + * @summary Checks that lightweight components do not lose focus after + dragging the frame by using the mouse. + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual LightweightFocusLostTest +*/ + +import java.awt.AWTEvent; +import java.awt.AWTEventMulticaster; +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Cursor; +import java.awt.Label; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.FontMetrics; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.SystemColor; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.FocusAdapter; +import java.awt.event.FocusEvent; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; + + +public class LightweightFocusLostTest { + + private static final String INSTRUCTIONS = """ + Steps to try to reproduce this problem: + When this test is run a window will display (Test Focus). + Click in the text field to give it the focus (a blinking cursor + will appear) and then move the frame with the mouse. The text field + (component which uses a lightweight component) should still have focus. + You should still see the blinking cursor in the text field after the + frame has been moved. If this is the behavior that you observe, the + test has passed, Press the Pass button. Otherwise the test has failed, + Press the Fail button."""; + + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("LightweightFocusLostTest Instructions") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 5) + .columns(35) + .testUI(LightweightFocusLostTest::createTestUI) + .logArea() + .build() + .awaitAndCheck(); + } + + private static Frame createTestUI() { + Frame f = new Frame("LightweightFocusLostTest"); + f.setLayout(new BorderLayout()); + String sLabel = "Lightweight component below (text field)"; + Label TFL = new Label(sLabel, Label.LEFT); + f.add(TFL, BorderLayout.NORTH); + SimpleTextField canvas = new SimpleTextField(30, 5); + f.add(canvas, BorderLayout.CENTER); + f.setSize(new Dimension(300,125)); + f.requestFocus(); + return f; + + } + +} + +class SimpleTextField extends Component implements Runnable { + int border; + int length; + Font font; + FontMetrics fontM; + char[] buffer; + int bufferIx; + + boolean hasFocus; + boolean cursorOn; + + SimpleTextField(int len, int bor) { + super(); + border = bor; + length = len; + buffer = new char[len]; + font = getFont(); + if (font == null) { + font = new Font("Dialog", Font.PLAIN, 20); + } + fontM = getFontMetrics(font); + + // Listen for key and mouse events. + this.addMouseListener(new MouseEventHandler()); + this.addFocusListener(new FocusEventHandler()); + this.addKeyListener(new KeyEventHandler()); + + // Set text cursor. + setCursor(Cursor.getPredefinedCursor(Cursor.TEXT_CURSOR)); + + // Start the thread that blinks the cursor. + (new Thread(this)).start(); + } + + public Dimension getMinimumSize() { + // The minimum height depends on the point size. + int w = fontM.charWidth('m') * length; + return new Dimension(w + 2 * border, fontM.getHeight() + 2 * border); + } + public Dimension getPreferredSize() { + return getMinimumSize(); + } + public Dimension getMaximumSize() { + return new Dimension(Short.MAX_VALUE, getPreferredSize().height); + } + + public boolean isFocusTraversable() { + return true; + } + + public void paint(Graphics g) { + int y = (getSize().height-fontM.getHeight())/2; + + // Clear the background using the text background color. + g.setColor(SystemColor.text); + g.fillRect(0, 0, getSize().width, getSize().height); + + g.setFont(font); + g.setColor(SystemColor.textText); + g.drawChars(buffer, 0, bufferIx, border, y + fontM.getAscent()); + + // Draw blinking cursor. + int x = fontM.charsWidth(buffer, 0, bufferIx) + border; + int w = fontM.charWidth('c'); + if (hasFocus) { + g.setColor(getForeground()); + g.fillRect(x, y, w, fontM.getHeight()); + if (cursorOn) { + if (bufferIx < buffer.length) { + g.setColor(SystemColor.text); + g.fillRect(x + 2, y + 2, w - 4, fontM.getHeight() - 4); + } + } + } + } + + // Event handlers + class MouseEventHandler extends MouseAdapter { + public void mousePressed(MouseEvent evt) { + requestFocus(); + } + } + class FocusEventHandler extends FocusAdapter { + public void focusGained(FocusEvent evt) { + PassFailJFrame.log("Focus gained: " + evt); + + hasFocus = true; + repaint(); + } + public void focusLost(FocusEvent evt) { + PassFailJFrame.log("Focus lost: " + evt); + hasFocus = false; + repaint(); + } + } + class KeyEventHandler extends KeyAdapter { + public void keyPressed(KeyEvent evt) { + switch (evt.getKeyCode()) { + case KeyEvent.VK_DELETE: + case KeyEvent.VK_BACK_SPACE: + if (bufferIx > 0) { + bufferIx--; + repaint(); + } + break; + case KeyEvent.VK_ENTER: + ActionEvent action = + new ActionEvent(SimpleTextField.this, + ActionEvent.ACTION_PERFORMED, + String.valueOf(buffer, 0, bufferIx)); + // Send contents of buffer to listeners + processEvent(action); + break; + default: + repaint(); + } + } + public void keyTyped(KeyEvent evt) { + if (bufferIx < buffer.length + && !evt.isActionKey() + && !Character.isISOControl(evt.getKeyChar())) { + buffer[bufferIx++] = evt.getKeyChar(); + } + } + } + + // Support for Action Listener. + ActionListener actionListener; + + public void addActionListener(ActionListener l) { + actionListener = AWTEventMulticaster.add(actionListener, l); + } + + // Override processEvent() to deal with ActionEvent. + protected void processEvent(AWTEvent evt) { + if (evt instanceof ActionEvent) { + processActionEvent((ActionEvent)evt); + } else { + super.processEvent(evt); + } + } + + // Supply method to process Action event. + protected void processActionEvent(ActionEvent evt) { + if (actionListener != null) { + actionListener.actionPerformed(evt); + } + } + + public void run() { + while (true) { + try { + // If component has focus, blink the cursor every 1/2 second. + Thread.sleep(500); + cursorOn = !cursorOn; + if (hasFocus) { + repaint(); + } + } catch (Exception e) { + e.printStackTrace(); + } + } + } +} + diff --git a/test/jdk/java/awt/Focus/LightweightPopupTest.java b/test/jdk/java/awt/Focus/LightweightPopupTest.java new file mode 100644 index 000000000000..bc3dd0d038b9 --- /dev/null +++ b/test/jdk/java/awt/Focus/LightweightPopupTest.java @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2001, 2024, 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 4472032 + * @summary Switching between lightweight menus by horizontal arrow key works incorrect + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual LightweightPopupTest +*/ + +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; + +public class LightweightPopupTest { + + private static final String INSTRUCTIONS = """ + When the test starts, you will see a frame titled + 'Lightweight Popup Test', which contains a button + (titled 'JButton') and two menus ('Menu 1' and 'Menu 2'). + Make sure that both menus, when expanded, fit entirely + into the frame. Now take the following steps: + 1. Click on 'JButton' to focus it. + 2. Click 'Menu 1' to expand it. + 3. Press right arrow to select 'Menu 2'. + Now check where the focus is. If it is on 'JButton' + (you can press space bar to see if it is there), then + the test failed. If 'JButton' is not focused, then + the test passed."""; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("LightweightPopupTest Instructions") + .instructions(INSTRUCTIONS) + .rows((int)INSTRUCTIONS.lines().count() + 2) + .columns(35) + .testUI(LightweightPopupTest::createTestUI) + .build() + .awaitAndCheck(); + } + + private static JFrame createTestUI() { + + JFrame frame = new JFrame("Lightweight Popup Test"); + JButton button = new JButton("JButton"); + JMenuBar menuBar = new JMenuBar(); + JMenu menu1 = new JMenu("Menu 1"); + menu1.add(new JMenuItem("Menu Item 1")); + menu1.add(new JMenuItem("Menu Item 2")); + menuBar.add(menu1); + JMenu menu2 = new JMenu("Menu 2"); + menu2.add(new JMenuItem("Menu Item 3")); + menu2.add(new JMenuItem("Menu Item 4")); + menuBar.add(menu2); + + frame.add(button); + frame.setJMenuBar(menuBar); + frame.setSize(300, 200); + return frame; + } + +} + diff --git a/test/jdk/java/awt/Focus/MixedWeightFocus.java b/test/jdk/java/awt/Focus/MixedWeightFocus.java new file mode 100644 index 000000000000..4b434e4b66d7 --- /dev/null +++ b/test/jdk/java/awt/Focus/MixedWeightFocus.java @@ -0,0 +1,207 @@ +/* + * Copyright (c) 1999, 2024, 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 4098290 4140890 + * @summary Using non-opaque windows - popups are initially not painted correctly + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual MixedWeightFocus +*/ + +import java.util.List; +import java.awt.AWTEvent; +import java.awt.Button; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dialog; +import java.awt.Dimension; +import java.awt.Frame; +import java.awt.FlowLayout; +import java.awt.FontMetrics; +import java.awt.Graphics; +import java.awt.Panel; +import java.awt.Toolkit; +import java.awt.Window; +import java.awt.event.FocusEvent; +import java.awt.event.MouseEvent; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; + +public class MixedWeightFocus { + + static FocusFrame f; + + private static final String INSTRUCTIONS = """ + This tests that permanent FOCUS_LOST messages are sent to lightweight + components when the focus shifts to a heavyweight component. It also + tests that components retain the focus when their parent window is + deactivated and activated. + + 1. Tab or mouse between the light and heavyweight buttons in this test + and verify that the focus rectangle on the lightweight components + disappears when focus shifts to a heavyweight button. + + 2. Activate another application then reactivate the test frame window. + Verify that the component that had the focus (light or heavy) when + the frame was deactivated regains the focus when it's reactivated. Do + the same thing for the modeless dialog. Also test this by moving the + activation between the dialog and the frame. + + 3. Verify that lightweight components with the focus in a deactivated + window draw their focus rectangles in gray instead of blue-- this indicates + they received temporary instead of permanent FOCUS_LOST events. + + NOTE: There is currently another problem with lightweight components + where if you click on one to activate its frame window, the lightweight + that previously had the focus will not get a FOCUS_LOST event. This + may manifest itself with a gray focus rectangle not getting erased. + Ignore this for now (Win32 only)."""; + + public static void main(String[] argv) throws Exception { + PassFailJFrame.builder() + .title("MixedWeightFocus Instructions") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 5) + .columns(45) + .testUI(MixedWeightFocus::createTestUI) + .build() + .awaitAndCheck(); + } + + private static List createTestUI() { + FocusFrame f = new FocusFrame(); + ModelessDialog dlg = new ModelessDialog(f); + + return List.of(f, dlg); + } +} + +class FocusFrame extends Frame { + public FocusFrame() { + super("FocusFrame"); + Panel p = new Panel(); + + p.add(new Button("button 1")); + p.add(new LightweightComp("lw 1")); + p.add(new Button("button 2")); + p.add(new LightweightComp("lw 2")); + add(p); + + pack(); + setLocation(100, 100); + + addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent ev) { + dispose(); + } + }); + } + +} + +class ModelessDialog extends Dialog { + public ModelessDialog(Frame frame) { + super(frame, "ModelessDialog", false); + setLayout( new FlowLayout() ); + add(new Button("button 1")); + add(new LightweightComp("lw 1")); + pack(); + setLocation(100, 400); + } +} + +// simple lightweight component, focus traversable, highlights upon focus +class LightweightComp extends Component { + FontMetrics fm; + String label; + private static final int FOCUS_GONE = 0; + private static final int FOCUS_TEMP = 1; + private static final int FOCUS_HAVE = 2; + int focusLevel = FOCUS_GONE; + public static int nameCounter = 0; + + public LightweightComp(String lwLabel ) { + label = lwLabel; + enableEvents(AWTEvent.FOCUS_EVENT_MASK|AWTEvent.MOUSE_EVENT_MASK); + setName("lw"+Integer.toString(nameCounter++)); + } + + public Dimension getPreferredSize() { + if (fm == null) { + fm = Toolkit.getDefaultToolkit().getFontMetrics(getFont()); + } + return new Dimension(fm.stringWidth(label) + 2, fm.getHeight() + 2); + } + + public void paint(Graphics g) { + Dimension s=getSize(); + + // erase the background + g.setColor(getBackground()); + g.fillRect(0, 0, s.width, s.height); + + g.setColor(getForeground()); + + // draw the string + g.drawString(label, 2, fm.getHeight()); + + // draw a focus rectangle + if (focusLevel > FOCUS_GONE) { + if (focusLevel == FOCUS_TEMP) { + g.setColor(Color.gray); + } else { + g.setColor(Color.blue); + } + g.drawRect(1,1,s.width-2,s.height-2); + } + } + + + public boolean isFocusTraversable() { + return true; + } + + protected void processFocusEvent(FocusEvent e) { + super.processFocusEvent(e); + if (e.getID() == FocusEvent.FOCUS_GAINED) { + focusLevel = FOCUS_HAVE; + } else { + if (e.isTemporary()) { + focusLevel = FOCUS_TEMP; + } else { + focusLevel = FOCUS_GONE; + } + } + repaint(); + } + + protected void processMouseEvent(MouseEvent e) { + + if (e.getID()==MouseEvent.MOUSE_PRESSED) { + requestFocus(); + } + super.processMouseEvent(e); + } +} diff --git a/test/jdk/java/awt/Focus/NextFocusHelperTest.java b/test/jdk/java/awt/Focus/NextFocusHelperTest.java new file mode 100644 index 000000000000..5b3015da6301 --- /dev/null +++ b/test/jdk/java/awt/Focus/NextFocusHelperTest.java @@ -0,0 +1,111 @@ +/* + * Copyright (c) 2001, 2024, 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 4474893 + * @summary Component.nextFocusHelper should search for first visible focus cycle root ancst + * @key headful + * @run main NextFocusHelperTest +*/ + +import java.awt.Button; +import java.awt.Dimension; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.FlowLayout; +import java.awt.KeyboardFocusManager; +import java.awt.Panel; +import java.awt.Point; +import java.awt.Robot; +import java.awt.event.InputEvent; + +public class NextFocusHelperTest { + static Panel panel; + static Frame frame; + static Button btn1; + static Button btn3; + static Button hideButton; + + public static void main(String[] args) throws Exception { + Robot robot = new Robot(); + robot.setAutoDelay(100); + try { + EventQueue.invokeAndWait(() -> createTestUI()); + robot.waitForIdle(); + robot.delay(1000); + + Point loc = btn1.getLocationOnScreen(); + Dimension dim = btn1.getSize(); + robot.mouseMove(loc.x + dim.width/2, loc.y + dim.height/2); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + robot.waitForIdle(); + robot.delay(500); + + Point loc1 = hideButton.getLocationOnScreen(); + Dimension dim1 = hideButton.getSize(); + robot.mouseMove(loc1.x + dim1.width/2, loc1.y + dim1.height/2); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + robot.waitForIdle(); + + if (KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner() + instanceof Button btn) { + if (!btn.getLabel().equals("Button 3")) { + throw new RuntimeException("Wrong button has focus"); + } + } + } finally { + EventQueue.invokeAndWait(() -> { + if (frame != null) { + frame.dispose(); + } + }); + } + } + + private static void createTestUI() { + frame = new Frame("NextFocusHelperTest Frame"); + frame.setLayout(new FlowLayout()); + + panel = new Panel(); + panel.setFocusCycleRoot(true); + btn1 = new Button("Button In Panel"); + panel.add(btn1); + + hideButton = new Button("Hide Panel"); + hideButton.setFocusable(false); + hideButton.addActionListener(e -> { + panel.setVisible(false); + }); + + frame.add(new Button("Button 1")); + frame.add(panel); + frame.add(new Button("Button 3")); + frame.add(hideButton); + frame.setSize(200, 200); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + } +} + diff --git a/test/jdk/java/awt/Focus/ProxiedWindowHideTest.java b/test/jdk/java/awt/Focus/ProxiedWindowHideTest.java new file mode 100644 index 000000000000..a99ec4f0a0d9 --- /dev/null +++ b/test/jdk/java/awt/Focus/ProxiedWindowHideTest.java @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2001, 2024, 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 4396407 + * @summary Tests that after a proxied window is hidden, focus is being restored correctly + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual ProxiedWindowHideTest +*/ + +import java.awt.BorderLayout; +import java.awt.Button; +import java.awt.Container; +import javax.swing.Box; +import javax.swing.JComboBox; +import javax.swing.JFrame; + +public class ProxiedWindowHideTest { + + private static final String INSTRUCTIONS = """ + You will see a JFrame. + Click on JComboBox, list will expand then select any item in it. + After selection, list should collapse. + Click on Button('Push'). + If you are able to make it focused by mouse click, + (black rectangle will appear around it) the test is PASSED, + otherwise the test is FAILED."""; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("ProxiedWindowHideTest Instructions") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(35) + .testUI(ProxiedWindowHideTest::createTestUI) + .build() + .awaitAndCheck(); + } + + private static JFrame createTestUI() { + JFrame frame = new JFrame("ProxiedWindowHideTest frame"); + String[] petStrings = { "Bird", "Cat", "Dog", "Rabbit", "Pig" }; + JComboBox cb = new JComboBox(petStrings); + + cb.setLightWeightPopupEnabled(false); + Container parent = Box.createVerticalBox(); + parent.add(new Button("Push")); + parent.add(cb); + frame.add(parent, BorderLayout.CENTER); + frame.pack(); + return frame; + } + +} + diff --git a/test/jdk/java/awt/Focus/RequestInInactiveFrame.java b/test/jdk/java/awt/Focus/RequestInInactiveFrame.java new file mode 100644 index 000000000000..3297fe17501a --- /dev/null +++ b/test/jdk/java/awt/Focus/RequestInInactiveFrame.java @@ -0,0 +1,106 @@ +/* + * Copyright (c) 2011, 2024, 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 6458497 + * @summary check focus requests in inactive frames + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual RequestInInactiveFrame + */ + +import java.util.ArrayList; + +import java.awt.FlowLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.Window; +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.SwingUtilities; + +public class RequestInInactiveFrame { + + private static final String INSTRUCTIONS = """ + After the tests starts you will see two frames: \"test frame\" and \"opposite frame\" + activate the former by click on its title + Focus should be on \"press me\" button (if it's not, the test fails) + press on \"press me\" button and activate \"opposite frame\" + wait for several seconds. + Focus should either remain on button in the \"opposite frame\" + or goes to \"focus target\" button (in this case \"test frame\" should be activated + if it's not, the test failed. + Activate \"test frame\" one more time, press on \"press me\" button and switch focus + to some native window. Wait for several seconds, + If you see focus border around + \"focus target\" and \"test frame\" is not active then the test failed. + if focus transfered to that button and the frame is activated, or if there is no focus + in java - tests passed."""; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("RequestInInactiveFrame Instructions") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(40) + .testUI(RequestInInactiveFrame::createTestUI) + .build() + .awaitAndCheck(); + } + + private static ArrayList createTestUI() { + JFrame frame = new JFrame("test frame"); + final JButton btn2 = new JButton("focus target"); + JButton btn1 = new JButton("press me"); + btn1.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + System.out.println("waiting..."); + try { + Thread.sleep(3000); + } catch (InterruptedException ie) { + ie.printStackTrace(); + } + System.out.println("requesting focus"); + btn2.requestFocus(); + } + }); + frame.setLayout(new FlowLayout()); + frame.add(btn1); + frame.add(btn2); + frame.pack(); + frame.setLocation(200, 100); + + JFrame frame2 = new JFrame("opposite frame"); + JButton btn3 = new JButton("just a button"); + frame2.add(btn3); + frame2.pack(); + frame2.setLocation(200, 200); + + ArrayList list = new ArrayList<>(); + list.add(frame); + list.add(frame2); + return list; + } + +} diff --git a/test/jdk/java/awt/Focus/TestDisabledAutoTransfer.java b/test/jdk/java/awt/Focus/TestDisabledAutoTransfer.java new file mode 100644 index 000000000000..d7928b7db1c7 --- /dev/null +++ b/test/jdk/java/awt/Focus/TestDisabledAutoTransfer.java @@ -0,0 +1,156 @@ +/* + * Copyright (c) 2004, 2024, 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 6180261 + * @summary Test that auto-transfer doesn't happen when there are pending focus requests + * @key headful + * @run main TestDisabledAutoTransfer +*/ + +import java.awt.Button; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.Point; +import java.awt.Robot; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.FocusAdapter; +import java.awt.event.FocusEvent; +import java.awt.event.FocusListener; +import java.awt.event.InputEvent; +import java.util.concurrent.atomic.AtomicBoolean; + +public class TestDisabledAutoTransfer { + static Frame frame; + static Robot robot; + Button b1; + Button desired; + AtomicBoolean focused = new AtomicBoolean(); + ActionListener mover; + volatile Point loc; + volatile Dimension dim; + + public static void main(String[] args) throws Exception { + robot = new Robot(); + try { + TestDisabledAutoTransfer test = new TestDisabledAutoTransfer(); + test.createTestUI(); + robot.waitForIdle(); + robot.delay(1000); + test.doTest(); + } finally { + if (frame != null) { + frame.dispose(); + } + } + } + + public void createTestUI() { + frame = new Frame("TestDisabledAutoTransfer"); + frame.setLayout(new FlowLayout()); + desired = new Button("Desired"); + FocusAdapter watcher = new FocusAdapter() { + public void focusGained(FocusEvent e) { + synchronized(focused) { + focused.set(true); + } + } + }; + b1 = new Button("Press to disable"); + mover = new ActionListener() { + public void actionPerformed(ActionEvent e) { + desired.requestFocus(); + ((Component)e.getSource()).setEnabled(false); + } + }; + b1.addFocusListener(watcher); + desired.addFocusListener(watcher); + frame.add(b1); + Button misc = new Button("Next"); + frame.add(misc); + misc.addFocusListener(watcher); + frame.add(desired); + frame.setSize(200, 200); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + frame.validate(); + + } + + public void doTest() { + + loc = b1.getLocationOnScreen(); + dim = b1.getSize(); + robot.mouseMove(loc.x + dim.width / 2, loc.y + dim.height / 2); + robot.waitForIdle(); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + robot.waitForIdle(); + b1.requestFocus(); + + try { + synchronized(focused) { + if (!focused.get()) { + focused.wait(1000); + } + } + } catch (InterruptedException ie) { + throw new RuntimeException("Test was interrupted"); + } + + if (!focused.get()) { + throw new RuntimeException("b1 didn't get focus"); + } + focused.set(false); + + b1.addActionListener(mover); + robot.mouseMove(loc.x + dim.width / 2, loc.y + dim.height / 2); + robot.waitForIdle(); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + robot.waitForIdle(); + + try { + synchronized(focused) { + if (!focused.get()) { + focused.wait(1000); + } + } + } catch (InterruptedException ie) { + throw new RuntimeException("Test was interrupted"); + } + + if (!focused.get()) { + throw new RuntimeException("none got focus"); + } + + if (!desired.isFocusOwner()) { + throw new RuntimeException("desired didn't get focus"); + } + } + +} + diff --git a/test/jdk/java/awt/Focus/TestDisabledAutoTransferSwing.java b/test/jdk/java/awt/Focus/TestDisabledAutoTransferSwing.java new file mode 100644 index 000000000000..0793316a989c --- /dev/null +++ b/test/jdk/java/awt/Focus/TestDisabledAutoTransferSwing.java @@ -0,0 +1,165 @@ +/* + * Copyright (c) 2004, 2024, 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 6180261 + * @summary Test that auto-transfer doesn't happen when there are pending focus requests + * @key headful + * @run main TestDisabledAutoTransferSwing +*/ + +import java.awt.Component; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.Point; +import java.awt.Robot; +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.SwingUtilities; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.InputEvent; +import java.awt.event.FocusAdapter; +import java.awt.event.FocusEvent; +import java.util.concurrent.atomic.AtomicBoolean; + +public class TestDisabledAutoTransferSwing { + static JFrame frame; + static Robot robot; + JButton b1; + JButton desired; + AtomicBoolean focused = new AtomicBoolean(); + ActionListener mover; + volatile Point loc; + volatile Dimension dim; + + public static void main(String[] args) throws Exception { + robot = new Robot(); + try { + TestDisabledAutoTransferSwing test = new TestDisabledAutoTransferSwing(); + SwingUtilities.invokeAndWait(() -> { + test.createTestUI(); + }); + robot.waitForIdle(); + robot.delay(1000); + test.doTest(); + } finally { + SwingUtilities.invokeAndWait(() -> { + if (frame != null) { + frame.dispose(); + } + }); + } + } + + public void createTestUI() { + frame = new JFrame("TestDisabledAutoTransferSwing"); + frame.setLayout (new FlowLayout ()); + desired = new JButton("Desired"); + FocusAdapter watcher = new FocusAdapter() { + public void focusGained(FocusEvent e) { + synchronized(focused) { + focused.set(true); + } + } + }; + b1 = new JButton("Press to disable"); + mover = new ActionListener() { + public void actionPerformed(ActionEvent e) { + desired.requestFocus(); + ((Component)e.getSource()).setEnabled(false); + } + }; + b1.addFocusListener(watcher); + desired.addFocusListener(watcher); + frame.add(b1); + JButton misc = new JButton("Next"); + frame.add(misc); + misc.addFocusListener(watcher); + frame.add(desired); + frame.setSize(200, 200); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + frame.validate(); + + } + + public void doTest() throws Exception { + + SwingUtilities.invokeAndWait(() -> { + loc = b1.getLocationOnScreen(); + dim = b1.getSize(); + }); + robot.mouseMove(loc.x + dim.width / 2, loc.y + dim.height / 2); + robot.waitForIdle(); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + robot.waitForIdle(); + SwingUtilities.invokeAndWait(() -> { + b1.requestFocus(); + }); + + try { + synchronized(focused) { + if (!focused.get()) { + focused.wait(2000); + } + } + } catch (InterruptedException ie) { + throw new RuntimeException("Test was interrupted"); + } + + if (!focused.get()) { + throw new RuntimeException("b1 didn't get focus"); + } + focused.set(false); + + SwingUtilities.invokeAndWait(() -> { + b1.addActionListener(mover); + }); + robot.mouseMove(loc.x + dim.width / 2, loc.y + dim.height / 2); + robot.waitForIdle(); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + robot.waitForIdle(); + + try { + synchronized(focused) { + if (!focused.get()) { + focused.wait(2000); + } + } + } catch (InterruptedException ie) { + throw new RuntimeException("Test was interrupted"); + } + + if (!focused.get()) { + throw new RuntimeException("none got focus"); + } + + if (!desired.isFocusOwner()) { + throw new RuntimeException("desired didn't get focus"); + } + } + +} diff --git a/test/jdk/java/awt/Frame/AddRemoveMenuBarTest_5.java b/test/jdk/java/awt/Frame/AddRemoveMenuBarTest_5.java new file mode 100644 index 000000000000..f5f1018c2628 --- /dev/null +++ b/test/jdk/java/awt/Frame/AddRemoveMenuBarTest_5.java @@ -0,0 +1,120 @@ +/* + * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Button; +import java.awt.Dimension; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.Menu; +import java.awt.MenuBar; +import java.awt.Robot; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; + +/* + * @test + * @key headful + * @bug 4159883 + * @summary Adding/Removing a menu causes frame to unexpected small size + * @requires (os.family == "linux" | os.family == "windows") + */ + +public class AddRemoveMenuBarTest_5 { + + static Frame frame; + static MenuBar menu; + static Button btnAdd, btnRemove; + static Dimension oldSize; + + public static void main(String[] args) throws Exception { + Robot robot = new Robot(); + try { + EventQueue.invokeAndWait(AddRemoveMenuBarTest_5::initAndShowGui); + robot.waitForIdle(); + robot.delay(500); + + EventQueue.invokeAndWait(() -> { + oldSize = frame.getSize(); + changeMenubar(true); + }); + robot.waitForIdle(); + robot.delay(500); + + EventQueue.invokeAndWait(() -> { + checkSize(); + changeMenubar(false); + }); + robot.waitForIdle(); + robot.delay(500); + + EventQueue.invokeAndWait(AddRemoveMenuBarTest_5::checkSize); + } finally { + EventQueue.invokeAndWait(frame::dispose); + } + } + + public static void initAndShowGui() { + frame = new Frame(); + frame.setLocationRelativeTo(null); + frame.addWindowListener(new WindowAdapter() { + @Override + public void windowOpened(WindowEvent e) { + System.out.println("Frame size:" + frame.getSize().toString()); + System.out.println("Button size:" + btnAdd.getSize().toString()); + } + }); + frame.add("West", btnAdd = new Button("TRY:ADD")); + frame.add("East", btnRemove = new Button("TRY:REMOVE")); + + + btnAdd.addActionListener((e) -> changeMenubar(true)); + btnRemove.addActionListener((e) -> changeMenubar(false)); + frame.setSize(500, 100); + frame.setVisible(true); + } + + private static void changeMenubar(boolean enable) { + if (enable) { + menu = new MenuBar(); + menu.add(new Menu("BAAAAAAAAAAAAAAA")); + menu.add(new Menu("BZZZZZZZZZZZZZZZ")); + menu.add(new Menu("BXXXXXXXXXXXXXXX")); + } else { + menu = null; + } + frame.setMenuBar(menu); + frame.invalidate(); + frame.validate(); + + System.out.println("Frame size:" + frame.getSize().toString()); + System.out.println("Button size:" + btnAdd.getSize().toString()); + } + + private static void checkSize() { + Dimension newSize = frame.getSize(); + if (!oldSize.equals(newSize)) { + throw new RuntimeException("Frame size changed: old %s new %s" + .formatted(oldSize, newSize)); + } + } +} diff --git a/test/jdk/java/awt/Frame/DefaultLocationTest.java b/test/jdk/java/awt/Frame/DefaultLocationTest.java new file mode 100644 index 000000000000..dfeb5e93e3c8 --- /dev/null +++ b/test/jdk/java/awt/Frame/DefaultLocationTest.java @@ -0,0 +1,66 @@ +/* + * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.Label; + +/* + * @test + * @bug 4085599 + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @summary Test default location for frame + * @run main/manual DefaultLocationTest + */ + +public class DefaultLocationTest { + private static Frame f; + + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + A small frame containing the label 'Hello World' should + appear in the upper left hand corner of the screen. The + exact location is dependent upon the window manager. + + On Linux and Mac machines, the default location for frame + is below the taskbar or close to top-left corner. + + Upon test completion, click Pass or Fail appropriately."""; + + PassFailJFrame passFailJFrame = new PassFailJFrame("DefaultLocationTest " + + " Instructions", INSTRUCTIONS, 5, 10, 40); + EventQueue.invokeAndWait(DefaultLocationTest::createAndShowUI); + passFailJFrame.awaitAndCheck(); + } + + private static void createAndShowUI() { + f = new Frame("DefaultLocation"); + f.add("Center", new Label("Hello World")); + f.pack(); + PassFailJFrame.addTestWindow(f); + PassFailJFrame.positionTestWindow( + null, PassFailJFrame.Position.HORIZONTAL); + f.setVisible(true); + } +} diff --git a/test/jdk/java/awt/Frame/DeiconifyClipTest.java b/test/jdk/java/awt/Frame/DeiconifyClipTest.java new file mode 100644 index 000000000000..c650355f3ec7 --- /dev/null +++ b/test/jdk/java/awt/Frame/DeiconifyClipTest.java @@ -0,0 +1,140 @@ +/* + * Copyright (c) 2003, 2024, 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. + */ + +/* + * DeiconifyClipTest.java + * + * summary: + * + * What happens is that we call AwtWindow::UpdateInsets when + * processing WM_NCCALCSIZE delivered on programmatic deiconification. + * At this point IsIconic returns false (so UpdateInsets proceeds), + * but the rect sizes still seems to be those weird of the iconic + * state. Based on them we compute insets with top = left = 0 (and + * bottom and right that are completely bogus) and pass them to + * PaintUpdateRgn which results in incorrect clip origin. Immediately + * after that we do UpdateInsets again during WM_SIZE processing and + * get real values. + */ + +import javax.swing.BoxLayout; +import javax.swing.JFrame; +import javax.swing.SwingUtilities; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Insets; + +/* + * @test + * @bug 4792958 + * @summary Incorrect clip region after programmatic restore + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual DeiconifyClipTest +*/ + +public class DeiconifyClipTest { + private static final String INSTRUCTIONS = """ + This test creates a frame that is automatically iconified/deiconified + in a cycle. + + The test FAILS if after deiconfication the frame has a greyed-out area + in the lower-right corner. + If the frame contents is drawn completely - the test PASSES. + + Press PASS or FAIL button accordingly. + """; + + static TestFrame testFrame; + static volatile boolean shouldContinue = true; + + public static void main(String[] args) throws Exception { + PassFailJFrame passFailJFrame = PassFailJFrame.builder() + .title("DeiconifyClipTest Instructions") + .instructions(INSTRUCTIONS) + .columns(45) + .testUI(DeiconifyClipTest::createAndShowUI) + .build(); + try { + runThread(); + } finally { + passFailJFrame.awaitAndCheck(); + shouldContinue = false; + } + } + + private static void runThread() { + new Thread(() -> { + for (int i = 0; i < 1000 && shouldContinue; ++i) { + try { + Thread.sleep(3000); + SwingUtilities.invokeAndWait(() -> { + if ((testFrame.getExtendedState() & Frame.ICONIFIED) + != 0) { + testFrame.setExtendedState(Frame.NORMAL); + } else { + testFrame.setState(Frame.ICONIFIED); + } + }); + } catch (Exception ignored) { + } + } + }).start(); + } + + static Frame createAndShowUI() { + testFrame = new TestFrame(); + testFrame.getContentPane().setLayout(new BoxLayout(testFrame.getContentPane(), + BoxLayout.Y_AXIS)); + testFrame.getContentPane().setBackground(Color.yellow); + testFrame.setSize(300, 300); + return testFrame; + } + + static class TestFrame extends JFrame { + public TestFrame() { + super("DeiconifyClipTest"); + } + + // make it more visible if the clip is wrong. + public void paint(Graphics g) { + Insets b = getInsets(); + Dimension d = getSize(); + + int x = b.left; + int y = b.top; + int w = d.width - x - b.right; + int h = d.height - y - b.bottom; + + g.setColor(Color.white); + g.fillRect(0, 0, d.width, d.height); + + g.setColor(Color.green); + g.drawRect(x, y, w-1, h-1); + g.drawLine(x, y, x+w, y+h); + g.drawLine(x, y+h, x+w, y); + } + } +} diff --git a/test/jdk/java/awt/Frame/DisabledParentOfToplevel.java b/test/jdk/java/awt/Frame/DisabledParentOfToplevel.java new file mode 100644 index 000000000000..878809749d35 --- /dev/null +++ b/test/jdk/java/awt/Frame/DisabledParentOfToplevel.java @@ -0,0 +1,99 @@ +/* + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.BorderLayout; +import java.awt.Button; +import java.awt.Dimension; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.Point; +import java.awt.Robot; +import java.awt.Window; +import java.awt.event.InputEvent; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; + +/* + * @test + * @bug 5062118 + * @key headful + * @summary Disabling of a parent should not disable Window. + * @run main DisabledParentOfToplevel + */ + +public class DisabledParentOfToplevel { + private static Button okBtn; + private static Window ww; + private static Frame parentFrame; + private static volatile Point p; + private static volatile Dimension d; + + public static void main(String[] args) throws Exception { + Robot robot = new Robot(); + robot.setAutoDelay(100); + try { + EventQueue.invokeAndWait(() -> { + createAndShowUI(); + }); + robot.delay(1000); + EventQueue.invokeAndWait(() -> { + p = okBtn.getLocationOnScreen(); + d = okBtn.getSize(); + }); + robot.mouseMove(p.x + d.width / 2, p.x + d.height / 2); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + robot.delay(500); + if (ww.isVisible()) { + throw new RuntimeException("Window is visible but should be hidden: failure."); + } + } finally { + EventQueue.invokeAndWait(() -> { + if (parentFrame != null) { + parentFrame.dispose(); + } + }); + } + } + + private static void createAndShowUI() { + parentFrame = new Frame("parentFrame"); + parentFrame.setSize(100, 100); + parentFrame.setEnabled(false); + ww = new Window(parentFrame); + ww.setLayout(new BorderLayout()); + okBtn = new Button("Click to Close Me"); + ww.add(okBtn); + ww.setSize(250, 250); + ww.setLocation(110, 110); + okBtn.addMouseListener(new MouseAdapter() { + public void mousePressed(MouseEvent me) { + System.out.println("Pressed: close"); + ww.setVisible(false); + } + }); + parentFrame.setVisible(true); + ww.setVisible(true); + okBtn.requestFocus(); + } +} diff --git a/test/jdk/java/awt/Frame/EmptyFrameTest.java b/test/jdk/java/awt/Frame/EmptyFrameTest.java new file mode 100644 index 000000000000..7a324a3cbc99 --- /dev/null +++ b/test/jdk/java/awt/Frame/EmptyFrameTest.java @@ -0,0 +1,99 @@ +/* + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.Robot; +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.IOException; +import javax.imageio.ImageIO; + +/* + * @test + * @bug 4237529 + * @key headful + * @summary Test repainting of an empty frame + * @run main EmptyFrameTest + */ + +public class EmptyFrameTest { + private static Frame f; + private static Robot robot; + private static volatile Point p; + private static volatile Dimension d; + private static final int TOLERANCE = 5; + public static void main(String[] args) throws Exception { + robot = new Robot(); + robot.setAutoDelay(100); + try { + EventQueue.invokeAndWait(() -> { + createAndShowUI(); + }); + robot.delay(1000); + f.setSize(50, 50); + robot.delay(500); + EventQueue.invokeAndWait(() -> { + p = f.getLocation(); + d = f.getSize(); + }); + Rectangle rect = new Rectangle(p, d); + BufferedImage img = robot.createScreenCapture(rect); + if (chkImgBackgroundColor(img)) { + try { + ImageIO.write(img, "png", new File("Frame.png")); + } catch (IOException ignored) {} + throw new RuntimeException("Frame doesn't repaint itself on resize"); + } + } finally { + EventQueue.invokeAndWait(() -> { + if (f != null) { + f.dispose(); + } + }); + } + } + + private static void createAndShowUI() { + f = new Frame("EmptyFrameTest"); + f.setUndecorated(true); + f.setBackground(Color.RED); + f.setVisible(true); + } + + private static boolean chkImgBackgroundColor(BufferedImage img) { + for (int x = 1; x < img.getWidth() - 1; ++x) { + for (int y = 1; y < img.getHeight() - 1; ++y) { + Color c = new Color(img.getRGB(x, y)); + if ((c.getRed() - Color.RED.getRed()) > TOLERANCE) { + return true; + } + } + } + return false; + } +} diff --git a/test/jdk/java/awt/Frame/FocusTest.java b/test/jdk/java/awt/Frame/FocusTest.java new file mode 100644 index 000000000000..14d194789fe9 --- /dev/null +++ b/test/jdk/java/awt/Frame/FocusTest.java @@ -0,0 +1,151 @@ +/* + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Canvas; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.GridLayout; +import java.awt.Panel; +import java.awt.Window; +import java.awt.event.FocusEvent; +import java.awt.event.FocusListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; + +/* + * @test + * @bug 4140293 + * @summary Tests that focus is returned to the correct Component when a Frame + * is reactivated. + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual FocusTest + */ + +public class FocusTest { + private static final String INSTRUCTIONS = """ + Click on the bottom rectangle. Move the mouse slightly. + A focus rectangle should appear around the bottom rectangle. + + Now, deactivate the window and then reactivate it. + (You would click on the caption bar of another window, + and then on the caption bar of the FocusTest Frame.) + + If the focus rectangle appears again, the test passes. + If it does not appear, or appears around the top rectangle, + the test fails. + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("FocusTest Instructions") + .instructions(INSTRUCTIONS) + .columns(45) + .logArea(6) + .testUI(FocusTest::createAndShowUI) + .build() + .awaitAndCheck(); + } + + private static Window createAndShowUI() { + Frame frame = new Frame("FocusTest"); + + frame.add(new FocusTestPanel()); + frame.setSize(400, 400); + + frame.addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent e) { + frame.dispose(); + } + }); + + frame.validate(); + return frame; + } + + private static class FocusTestPanel extends Panel { + PassiveClient pc1 = new PassiveClient("pc1"); + PassiveClient pc2 = new PassiveClient("pc2"); + + public FocusTestPanel() { + super(); + setLayout(new GridLayout(2, 1, 10, 10)); + add(pc1); + add(pc2); + } + } + + private static class PassiveClient extends Canvas implements FocusListener { + boolean haveFocus = false; + final String name; + + PassiveClient(String name) { + super(); + this.name = name; + setSize(400, 100); + setBackground(Color.cyan); + setVisible(true); + setEnabled(true); + addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + requestFocus(); + } + }); + addFocusListener(this); + } + + public void paint(Graphics g) { + g.setColor(getBackground()); + Dimension size = getSize(); + g.fillRect(0, 0, size.width, size.height); + if (haveFocus) { + g.setColor(Color.black); + g.drawRect(0, 0, size.width - 1, size.height - 1); + g.drawRect(1, 1, size.width - 3, size.height - 3); + } + g.setColor(getForeground()); + } + + public void focusGained(FocusEvent event) { + haveFocus = true; + paint(getGraphics()); + PassFailJFrame.log("<<<< %s Got focus!! %s>>>>".formatted(this, event)); + } + + public void focusLost(FocusEvent event) { + haveFocus = false; + paint(getGraphics()); + PassFailJFrame.log("<<<< %s Lost focus!! %s>>>>".formatted(this, event)); + } + + @Override + public String toString() { + return "PassiveClient " + name; + } + } +} diff --git a/test/jdk/java/awt/Frame/FrameLayoutTest.java b/test/jdk/java/awt/Frame/FrameLayoutTest.java new file mode 100644 index 000000000000..d6e994beaace --- /dev/null +++ b/test/jdk/java/awt/Frame/FrameLayoutTest.java @@ -0,0 +1,70 @@ +/* + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.BorderLayout; +import java.awt.Button; +import java.awt.Frame; + +/* + * @test + * @bug 4173503 + * @library /java/awt/regtesthelpers + * @requires (os.family == "windows") + * @build PassFailJFrame + * @summary Tests that frame layout is performed when frame is maximized from taskbar + * @run main/manual FrameLayoutTest + */ + +public class FrameLayoutTest { + + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + Right-click on the taskbar button for this test. In the menu appeared, + choose Maximize. The frame will be maximized. Check if buttons inside + the frame are laid out properly, i.e. they occupy the frame entirely. + + If so, test passes. If buttons occupy small rectangle in the top left + corner, test fails."""; + + PassFailJFrame.builder() + .title("Frame's Layout Test Instruction") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(40) + .testUI(FrameLayoutTest::createUI) + .build() + .awaitAndCheck(); + } + + private static Frame createUI() { + Frame f = new Frame("Maximize Test"); + f.add(new Button("North"), BorderLayout.NORTH); + f.add(new Button("South"), BorderLayout.SOUTH); + f.add(new Button("East"), BorderLayout.EAST); + f.add(new Button("West"), BorderLayout.WEST); + f.add(new Button("Cent"), BorderLayout.CENTER); + f.pack(); + f.setState(Frame.ICONIFIED); + return f; + } +} diff --git a/test/jdk/java/awt/Frame/FrameMaximizedTest.java b/test/jdk/java/awt/Frame/FrameMaximizedTest.java new file mode 100644 index 000000000000..368132937fb4 --- /dev/null +++ b/test/jdk/java/awt/Frame/FrameMaximizedTest.java @@ -0,0 +1,62 @@ +/* + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Frame; +import java.awt.Label; + +/* + * @test + * @bug 4106068 + * @summary Test to verify maximized window is not too big + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual FrameMaximizedTest + */ + +public class FrameMaximizedTest { + public static void main (String[] args) throws Exception { + String INSTRUCTIONS = """ + Maximize the frame window. Check that the right and bottom edges of the + window are not off the edge of the screen. If they are not, the test + is successful and the bug is fixed. + """; + + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .rows(4) + .columns(40) + .testUI(new TestFrame()) + .build() + .awaitAndCheck(); + } +} + +class TestFrame extends Frame { + public TestFrame() { + setTitle("FrameMaximizedTest"); + setSize(500, 300); + add("North", new Label("Maximize me and check if my " + + "bottom and right edge are on screen.")); + } +} diff --git a/test/jdk/java/awt/Frame/FrameMenuPackTest.java b/test/jdk/java/awt/Frame/FrameMenuPackTest.java new file mode 100644 index 000000000000..c034acd8eb71 --- /dev/null +++ b/test/jdk/java/awt/Frame/FrameMenuPackTest.java @@ -0,0 +1,99 @@ +/* + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.BorderLayout; +import java.awt.Frame; +import java.awt.Label; +import java.awt.Menu; +import java.awt.MenuBar; +import java.awt.MenuItem; +import java.awt.ScrollPane; +import java.awt.Window; +import java.util.List; + +/* + * @test + * @bug 4084766 + * @summary Test for bug(s): 4084766 + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual FrameMenuPackTest + */ + +public class FrameMenuPackTest { + private static final String INSTRUCTIONS = """ + Check that both frames that appear are properly packed with + the scrollpane visible. + """; + + public static void main(String[] argv) throws Exception { + PassFailJFrame.builder() + .title("FrameMenuPackTest Instructions") + .instructions(INSTRUCTIONS) + .columns(45) + .testUI(FrameMenuPackTest::createAndShowUI) + .positionTestUIRightRow() + .build() + .awaitAndCheck(); + } + + private static List createAndShowUI() { + // Frame without menu, packs correctly + PackedFrame f1 = new PackedFrame(false); + f1.pack(); + + // Frame with menu, doesn't pack right + PackedFrame f2 = new PackedFrame(true); + f2.pack(); + + return List.of(f1, f2); + } + + private static class PackedFrame extends Frame { + public PackedFrame(boolean withMenu) { + super("PackedFrame"); + + MenuBar menubar; + Menu fileMenu; + MenuItem foo; + ScrollPane sp; + + sp = new ScrollPane(); + sp.add(new Label("Label in ScrollPane")); + System.out.println(sp.getMinimumSize()); + + this.setLayout(new BorderLayout()); + this.add(sp, "Center"); + this.add(new Label("Label in Frame"), "South"); + + if (withMenu) { + menubar = new MenuBar(); + fileMenu = new Menu("File"); + foo = new MenuItem("foo"); + fileMenu.add(foo); + menubar.add(fileMenu); + this.setMenuBar(menubar); + } + } + } +} diff --git a/test/jdk/java/awt/Frame/FrameMinimizeTest.java b/test/jdk/java/awt/Frame/FrameMinimizeTest.java new file mode 100644 index 000000000000..cd3459a78418 --- /dev/null +++ b/test/jdk/java/awt/Frame/FrameMinimizeTest.java @@ -0,0 +1,59 @@ +/* + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Frame; + +/* + * @test + * @bug 4172782 + * @summary Test if non-resizable frame is minimizable + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual FrameMinimizeTest + */ + +public class FrameMinimizeTest { + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + When the blank FrameMinimizeTest frame is shown, verify that + 1. It is not resizable; + 2. It is minimizable. + """; + + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .rows(4) + .columns(35) + .testUI(FrameMinimizeTest::initialize) + .build() + .awaitAndCheck(); + } + + public static Frame initialize() { + Frame f = new Frame("FrameMinimizeTest"); + f.setSize(200, 200); + f.setResizable(false); + return f; + } +} diff --git a/test/jdk/java/awt/Frame/FrameResizableTest.java b/test/jdk/java/awt/Frame/FrameResizableTest.java new file mode 100644 index 000000000000..4734ce71670a --- /dev/null +++ b/test/jdk/java/awt/Frame/FrameResizableTest.java @@ -0,0 +1,97 @@ +/* + * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Button; +import java.awt.Frame; +import java.awt.Label; +import java.awt.Panel; +import java.awt.event.ActionListener; + +/* + * @test + * @bug 1231233 + * @summary Tests whether the resizable property of a Frame is + * respected after it is set. + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual FrameResizableTest + */ + +public class FrameResizableTest { + private static final String INSTRUCTIONS = """ + There is a frame with two buttons and a label. The label + reads 'true' or 'false' to indicate whether the frame can be + resized or not. + + When the first button, 'Set Resizable', is + clicked, you should be able to resize the frame. + When the second button, 'UnSet Resizable', is clicked, you should + not be able to resize the frame. + + A frame is resized in a way which depends upon the window manager (WM) running. + You may resize the frame by dragging the corner resize handles or the borders, + or you may use the title bar's resize menu items and buttons. + + Upon test completion, click Pass or Fail appropriately. + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("FrameResizableTest Instructions") + .instructions(INSTRUCTIONS) + .columns(50) + .testUI(FrameResizable::new) + .build() + .awaitAndCheck(); + } + + private static class FrameResizable extends Frame { + Label label; + Button buttonResizable; + Button buttonNotResizable; + + public FrameResizable() { + super("FrameResizable"); + setResizable(false); + Panel panel = new Panel(); + + add("North", panel); + ActionListener actionListener = (e) -> { + if (e.getSource() == buttonResizable) { + setResizable(true); + } else if (e.getSource() == buttonNotResizable) { + setResizable(false); + } + label.setText("Resizable: " + isResizable()); + }; + + panel.add(buttonResizable = new Button("Set Resizable")); + panel.add(buttonNotResizable = new Button("UnSet Resizable")); + panel.add(label = new Label("Resizable: " + isResizable())); + buttonResizable.addActionListener(actionListener); + buttonNotResizable.addActionListener(actionListener); + + setSize(400, 200); + } + } +} diff --git a/test/jdk/java/awt/Frame/FrameResizeTest/FrameResizeTest_3.java b/test/jdk/java/awt/Frame/FrameResizeTest/FrameResizeTest_3.java new file mode 100644 index 000000000000..6fdef005775a --- /dev/null +++ b/test/jdk/java/awt/Frame/FrameResizeTest/FrameResizeTest_3.java @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Button; +import java.awt.Frame; +import java.awt.GridLayout; +import java.awt.Window; +import java.awt.event.ActionListener; + +/* + * @test + * @bug 4097207 + * @summary setSize() on a Frame does not resize its content + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual FrameResizeTest_3 +*/ + +public class FrameResizeTest_3 { + + private static final String INSTRUCTIONS = """ + 1. You would see a frame titled 'TestFrame' with 2 buttons + named 'setSize(500,500)' and 'setSize(400,400)' + 2. Click any button and you would see the frame resized + 3. If the buttons get resized along with the frame + (ie., to fit the frame), press Pass else press Fail. + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("FrameResizeTest_3 Instructions") + .instructions(INSTRUCTIONS) + .columns(45) + .logArea(6) + .testUI(FrameResizeTest_3::createTestUI) + .build() + .awaitAndCheck(); + } + + private static Window createTestUI() { + Frame frame = new Frame("TestFrame"); + frame.setLayout(new GridLayout(2, 1)); + + Button butSize500 = new Button("setSize(500,500)"); + Button butSize400 = new Button("setSize(400,400)"); + + ActionListener actionListener = e -> { + if (e.getSource() instanceof Button) { + if (e.getSource() == butSize500) { + frame.setSize(500, 500); + PassFailJFrame.log("New bounds: " + frame.getBounds()); + } else if (e.getSource() == butSize400) { + frame.setSize(400, 400); + PassFailJFrame.log("New bounds: " + frame.getBounds()); + } + } + }; + butSize500.addActionListener(actionListener); + butSize400.addActionListener(actionListener); + frame.add(butSize500); + frame.add(butSize400); + + frame.setSize(270, 200); + return frame; + } +} diff --git a/test/jdk/java/awt/Frame/FrameResizeTest/FrameResizeTest_4.java b/test/jdk/java/awt/Frame/FrameResizeTest/FrameResizeTest_4.java new file mode 100644 index 000000000000..4428feee3355 --- /dev/null +++ b/test/jdk/java/awt/Frame/FrameResizeTest/FrameResizeTest_4.java @@ -0,0 +1,76 @@ +/* + * Copyright (c) 1999, 2024, 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. + */ + +/* Note that although this test makes use of Swing classes, like JFrame and */ +/* JButton, it is really an AWT test, because it tests mechanism of sending */ +/* paint events. */ + +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JPanel; +import java.awt.BorderLayout; + +/* + * @test + * @bug 4174831 + * @summary Tests that frame do not flicker on diagonal resize + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual FrameResizeTest_4 + */ + +public class FrameResizeTest_4 { + private static final String INSTRUCTIONS = """ + Try enlarging the frame diagonally. + If buttons inside frame excessively repaint themselves and flicker + while you enlarge frame, the test fails. + Otherwise, it passes. + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("FrameResizeTest_4 Instructions") + .instructions(INSTRUCTIONS) + .columns(45) + .testUI(FrameResizeTest_4::createTestUI) + .build() + .awaitAndCheck(); + } + + private static JFrame createTestUI() { + JFrame f = new JFrame("FrameResizeTest_4 Flickering Frame"); + + JPanel panel = new JPanel(new BorderLayout()); + panel.add(new JButton("West"), BorderLayout.WEST); + panel.add(new JButton("East"), BorderLayout.EAST); + panel.add(new JButton("North"), BorderLayout.NORTH); + panel.add(new JButton("South"), BorderLayout.SOUTH); + panel.add(new JButton("Center"), BorderLayout.CENTER); + f.setContentPane(panel); + + f.pack(); + f.setBounds(100, 50, 300, 200); + + return f; + } +} diff --git a/test/jdk/java/awt/Frame/FrameResizeTest/FrameResizeTest_5.java b/test/jdk/java/awt/Frame/FrameResizeTest/FrameResizeTest_5.java new file mode 100644 index 000000000000..5a43b755a521 --- /dev/null +++ b/test/jdk/java/awt/Frame/FrameResizeTest/FrameResizeTest_5.java @@ -0,0 +1,105 @@ +/* + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Button; +import java.awt.Frame; +import java.awt.GridLayout; + +/* + * @test + * @summary Test to make sure non-resizable Frames can be resized with the + * setSize() method. + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual FrameResizeTest_5 +*/ + +public class FrameResizeTest_5 { + private static final String INSTRUCTIONS = """ + This tests the programmatic resizability of non-resizable Frames. + Even when a Frame is set to be non-resizable, it should still be + programmatically resizable using the setSize() method. + + Initially the Frame will be resizable. Try using the "Smaller" + and "Larger" buttons to verify that the Frame resizes correctly. + Then, click the "Toggle" button to make the Frame non-resizable. + Again, verify that clicking the "Larger" and "Smaller" buttons + causes the Frame to get larger and smaller. If the Frame does + not change size, or does not re-layout correctly, the test fails. + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("FrameResizeTest_5 Instructions") + .instructions(INSTRUCTIONS) + .columns(45) + .logArea(6) + .testUI(TestFrame::new) + .build() + .awaitAndCheck(); + } + + private static class TestFrame extends Frame { + Button bLarger, bSmaller, bCheck, bToggle; + + public TestFrame() { + super("Frame Resize Test"); + setSize(200, 200); + bLarger = new Button("Larger"); + bLarger.addActionListener(e -> { + setSize(400, 400); + validate(); + }); + bSmaller = new Button("Smaller"); + bSmaller.addActionListener(e -> { + setSize(200, 100); + validate(); + }); + bCheck = new Button("Resizable?"); + bCheck.addActionListener(e -> { + if (isResizable()) { + PassFailJFrame.log("Frame is resizable"); + setResizable(true); + } else { + PassFailJFrame.log("Frame is not resizable"); + setResizable(false); + } + }); + bToggle = new Button("Toggle"); + bToggle.addActionListener(e -> { + if (isResizable()) { + PassFailJFrame.log("Frame is now not resizable"); + setResizable(false); + } else { + PassFailJFrame.log("Frame is now resizable"); + setResizable(true); + } + }); + setLayout(new GridLayout(4, 1)); + add(bSmaller); + add(bLarger); + add(bCheck); + add(bToggle); + } + } +} diff --git a/test/jdk/java/awt/Frame/FrameSetCursorTest.java b/test/jdk/java/awt/Frame/FrameSetCursorTest.java new file mode 100644 index 000000000000..98968a8fbab8 --- /dev/null +++ b/test/jdk/java/awt/Frame/FrameSetCursorTest.java @@ -0,0 +1,100 @@ +/* + * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.BorderLayout; +import java.awt.Button; +import java.awt.Cursor; +import java.awt.Frame; +import java.awt.Panel; +import java.awt.event.ActionListener; +import java.lang.Exception; +import java.lang.InterruptedException; +import java.lang.Object; +import java.lang.String; +import java.lang.Thread; + +/* + * @test + * @bug 4097226 + * @summary Frame.setCursor() sometimes doesn't update the cursor until user moves the mouse + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual FrameSetCursorTest + */ + +public class FrameSetCursorTest { + private static final String INSTRUCTIONS = """ + 1. Keep the instruction dialog and TestFrame side by side so that + you can read the instructions while doing the test + 2. Click on the 'Start Busy' button on the frame titled 'TestFrame' + and DO NOT MOVE THE MOUSE ANYWHERE till you complete the steps below + 3. The cursor on the TestFrame changes to busy cursor + 4. If you don't see the busy cursor press 'Fail' after + the `done sleeping` message + 5. If the busy cursor is seen, after 5 seconds the message + 'done sleeping' is displayed in the message window + 6. Check for the cursor type after the display of 'done sleeping' + 7. If the cursor on the TestFrame has changed back to default cursor + (without you touching or moving the mouse), then press 'Pass' + else if the frame still shows the busy cursor press 'Fail' + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("FrameSetCursorTest Instructions") + .instructions(INSTRUCTIONS) + .columns(45) + .testUI(FrameSetCursorTest::createAndShowUI) + .logArea(5) + .build() + .awaitAndCheck(); + + } + + static Frame createAndShowUI() { + Frame frame = new Frame("TestFrame"); + Panel panel = new Panel(); + Button busyButton = new Button("Start Busy"); + + ActionListener actionListener = event -> { + Object source = event.getSource(); + if (source == busyButton) { + frame.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); + try { + Thread.sleep(5000); + } catch (InterruptedException ignored) {} + PassFailJFrame.log("done sleeping"); + frame.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); + } + }; + + busyButton.addActionListener(actionListener); + panel.setLayout(new BorderLayout()); + panel.add("North", busyButton); + + frame.add(panel); + frame.pack(); + frame.setSize(200, 200); + return frame; + } +} \ No newline at end of file diff --git a/test/jdk/java/awt/Frame/FrameSetMinimumSizeTest.java b/test/jdk/java/awt/Frame/FrameSetMinimumSizeTest.java new file mode 100644 index 000000000000..929a36e773e4 --- /dev/null +++ b/test/jdk/java/awt/Frame/FrameSetMinimumSizeTest.java @@ -0,0 +1,91 @@ +/* + * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dimension; +import java.awt.EventQueue; +import java.awt.Frame; + +/* + * @test + * @bug 4320050 + * @key headful + * @summary Minimum size for java.awt.Frame is not being enforced. + * @run main FrameSetMinimumSizeTest + */ + +public class FrameSetMinimumSizeTest { + private static Frame f; + private static volatile boolean passed; + + public static void main(String[] args) throws Exception { + EventQueue.invokeAndWait(() -> { + try { + createAndShowUI(); + + f.setSize(200, 200); + passed = verifyFrameSize(new Dimension(300, 300)); + isFrameSizeOk(passed); + + f.setSize(200, 400); + passed = verifyFrameSize(new Dimension(300, 400)); + isFrameSizeOk(passed); + + f.setSize(400, 200); + passed = verifyFrameSize(new Dimension(400, 300)); + isFrameSizeOk(passed); + + f.setMinimumSize(null); + + f.setSize(200, 200); + passed = verifyFrameSize(new Dimension(200, 200)); + isFrameSizeOk(passed); + } finally { + if (f != null) { + f.dispose(); + } + } + }); + } + + private static void createAndShowUI() { + f = new Frame("Minimum Size Test"); + f.setSize(300, 300); + f.setMinimumSize(new Dimension(300, 300)); + f.setVisible(true); + } + + private static boolean verifyFrameSize(Dimension expected) { + + if (f.getSize().width != expected.width || f.getSize().height != expected.height) { + return false; + } + return true; + } + + private static void isFrameSizeOk(boolean passed) { + if (!passed) { + throw new RuntimeException("Frame's setMinimumSize not honoured for the" + + " frame size: " + f.getSize()); + } + } +} diff --git a/test/jdk/java/awt/Frame/FrameVisualTest.java b/test/jdk/java/awt/Frame/FrameVisualTest.java new file mode 100644 index 000000000000..767eb0a18965 --- /dev/null +++ b/test/jdk/java/awt/Frame/FrameVisualTest.java @@ -0,0 +1,117 @@ +/* + * Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.GraphicsConfiguration; +import java.awt.GraphicsEnvironment; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.Robot; +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.IOException; +import javax.imageio.ImageIO; + +/* + * @test + * @bug 4328588 + * @key headful + * @summary Non-default visual on top-level Frame should work + * @run main FrameVisualTest + */ + +public class FrameVisualTest { + private static GraphicsConfiguration[] gcs; + private static volatile Frame[] frames; + private static volatile int index; + + private static Frame f; + private static Robot robot; + private static volatile Point p; + private static volatile Dimension d; + private static final int TOLERANCE = 5; + + public static void main(String[] args) throws Exception { + gcs = GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getConfigurations(); + robot = new Robot(); + robot.setAutoDelay(100); + try { + EventQueue.invokeAndWait(() -> { + createAndShowUI(); + }); + robot.delay(1000); + System.out.println("frames.length: "+frames.length); + for (index = 0; index < frames.length; index++) { + EventQueue.invokeAndWait(() -> { + p = frames[index].getLocation(); + d = frames[index].getSize(); + }); + Rectangle rect = new Rectangle(p, d); + BufferedImage img = robot.createScreenCapture(rect); + if (chkImgBackgroundColor(img)) { + try { + ImageIO.write(img, "png", new File("Frame_" + index + ".png")); + } catch (IOException ignored) {} + throw new RuntimeException("Frame visual test failed with non-white background color"); + } + } + } finally { + for (index = 0; index < frames.length; index++) { + EventQueue.invokeAndWait(() -> { + if (frames[index] != null) { + frames[index].dispose(); + } + }); + } + } + } + + private static void createAndShowUI() { + frames = new Frame[gcs.length]; + for (int i = 0; i < frames.length; i++) { + frames[i] = new Frame("Frame w/ gc " + i, gcs[i]); + frames[i].setSize(100, 100); + frames[i].setUndecorated(true); + frames[i].setBackground(Color.WHITE); + frames[i].setVisible(true); + } + } + + private static boolean chkImgBackgroundColor(BufferedImage img) { + + // scan for mid-line and if it is non-white color then return true. + for (int x = 1; x < img.getWidth() - 1; ++x) { + Color c = new Color(img.getRGB(x, img.getHeight() / 2)); + if ((c.getRed() - Color.WHITE.getRed()) > TOLERANCE && + (c.getGreen() - Color.WHITE.getGreen()) > TOLERANCE && + (c.getBlue() - Color.WHITE.getBlue()) > TOLERANCE) { + return true; + } + } + return false; + } +} + diff --git a/test/jdk/java/awt/Frame/I18NTitle.java b/test/jdk/java/awt/Frame/I18NTitle.java new file mode 100644 index 000000000000..7127fc3dfbf6 --- /dev/null +++ b/test/jdk/java/awt/Frame/I18NTitle.java @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.BorderLayout; +import java.awt.Frame; +import java.awt.Label; +import java.awt.Window; + +/* + * @test + * @bug 6269884 4929291 + * @summary Tests that title which contains mix of non-English characters is displayed correctly + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual I18NTitle + */ + +public class I18NTitle { + private static final String INSTRUCTIONS = """ + You will see a frame with some title (S. Chinese, Cyrillic and German). + Please check if non-English characters are visible and compare + the visible title with the same string shown in the label + (it should not look worse than the label). + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("I18NTitle Instructions") + .instructions(INSTRUCTIONS) + .columns(50) + .testUI(I18NTitle::createAndShowGUI) + .build() + .awaitAndCheck(); + } + + private static Window createAndShowGUI() { + String s = "\u4e2d\u6587\u6d4b\u8bd5 \u0420\u0443\u0441\u0441\u043a\u0438\u0439 Zur\u00FCck"; + Frame frame = new Frame(s); + frame.setLayout(new BorderLayout()); + Label l = new Label(s); + frame.add(l); + frame.setSize(400, 100); + return frame; + } +} diff --git a/test/jdk/java/awt/Frame/IMStatusBar.java b/test/jdk/java/awt/Frame/IMStatusBar.java new file mode 100644 index 000000000000..7e882d01c707 --- /dev/null +++ b/test/jdk/java/awt/Frame/IMStatusBar.java @@ -0,0 +1,70 @@ +/* + * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.BorderLayout; +import java.awt.Frame; +import java.awt.Label; +import java.awt.Panel; +import java.awt.TextField; + +/* + * @test + * @bug 4113040 + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @summary Checks that IMStatusBar does not affect Frame layout + * @run main/manual/othervm -Duser.language=ja -Duser.country=JP IMStatusBar + */ + +public class IMStatusBar { + + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + If the window appears the right size, but then resizes so that the + status field overlaps the bottom label, press Fail; otherwise press Pass. + """; + + PassFailJFrame.builder() + .title("IMStatusBar Instruction") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(40) + .testUI(IMStatusBar::createUI) + .build() + .awaitAndCheck(); + } + + private static Frame createUI() { + Frame f = new Frame(); + Panel centerPanel = new Panel(); + f.setSize(200, 200); + f.setLayout(new BorderLayout()); + f.add(new Label("Top"), BorderLayout.NORTH); + f.add(centerPanel, BorderLayout.CENTER); + f.add(new Label("Bottom"), BorderLayout.SOUTH); + centerPanel.setLayout(new BorderLayout()); + centerPanel.add(new TextField("Middle"), BorderLayout.CENTER); + centerPanel.validate(); + return f; + } +} diff --git a/test/jdk/java/awt/Frame/InitialIconifiedTest.java b/test/jdk/java/awt/Frame/InitialIconifiedTest.java new file mode 100644 index 000000000000..4a8d95956657 --- /dev/null +++ b/test/jdk/java/awt/Frame/InitialIconifiedTest.java @@ -0,0 +1,138 @@ +/* + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import javax.imageio.ImageIO; +import java.awt.Color; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.Rectangle; +import java.awt.Robot; +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.IOException; + +/* + * @test + * @key headful + * @bug 4851435 + * @summary Frame is not shown initially iconified after pack + */ + +public class InitialIconifiedTest { + + private static Frame backgroundFrame; + private static Frame testedFrame; + + private static final Rectangle backgroundFrameBounds = + new Rectangle(100, 100, 200, 200); + private static final Rectangle testedFrameBounds = + new Rectangle(150, 150, 100, 100); + + private static Robot robot; + + private static final StringBuilder FAILURES = new StringBuilder(); + + public static void main(String[] args) throws Exception { + robot = new Robot(); + try { + EventQueue.invokeAndWait(InitialIconifiedTest::initAndShowBackground); + robot.waitForIdle(); + robot.delay(500); + + test(false); + test(true); + } finally { + EventQueue.invokeAndWait(() -> { + backgroundFrame.dispose(); + testedFrame.dispose(); + }); + } + + if (!FAILURES.isEmpty()) { + throw new RuntimeException(FAILURES.toString()); + } + } + + private static void test(boolean isUndecorated) throws Exception { + String prefix = isUndecorated ? "undecorated" : "decorated"; + + EventQueue.invokeAndWait(() -> initAndShowTestedFrame(isUndecorated)); + // On macos, we can observe the animation of the window from the initial + // NORMAL state to the ICONIFIED state, + // even if the window was created in the ICONIFIED state. + // The following delay is commented out to capture this animation + // robot.waitForIdle(); + // robot.delay(500); + if (!testIfIconified(prefix + "_no_extra_delay")) { + FAILURES.append("Case %s frame with no extra delay failed\n" + .formatted(isUndecorated ? "undecorated" : "decorated")); + } + + EventQueue.invokeAndWait(() -> initAndShowTestedFrame(isUndecorated)); + robot.waitForIdle(); + robot.delay(500); + if (!testIfIconified(prefix + "_with_extra_delay")) { + FAILURES.append("Case %s frame with extra delay failed\n" + .formatted(isUndecorated ? "undecorated" : "decorated")); + } + } + + private static void initAndShowBackground() { + backgroundFrame = new Frame("DisposeTest background"); + backgroundFrame.setUndecorated(true); + backgroundFrame.setBackground(Color.RED); + backgroundFrame.setBounds(backgroundFrameBounds); + backgroundFrame.setVisible(true); + } + + private static void initAndShowTestedFrame(boolean isUndecorated) { + if (testedFrame != null) { + testedFrame.dispose(); + } + testedFrame = new Frame("Should have started ICONIC"); + if (isUndecorated) { + testedFrame.setUndecorated(true); + } + testedFrame.setExtendedState(Frame.ICONIFIED); + testedFrame.setBounds(testedFrameBounds); + testedFrame.setVisible(true); + } + + private static boolean testIfIconified(String prefix) { + BufferedImage bi = robot.createScreenCapture(backgroundFrameBounds); + int redPix = Color.RED.getRGB(); + + for (int x = 0; x < bi.getWidth(); x++) { + for (int y = 0; y < bi.getHeight(); y++) { + if (bi.getRGB(x, y) != redPix) { + try { + ImageIO.write(bi, "png", + new File(prefix + "_failure.png")); + } catch (IOException ignored) {} + return false; + } + } + } + return true; + } +} diff --git a/test/jdk/java/awt/Frame/InsetCorrectionTest.java b/test/jdk/java/awt/Frame/InsetCorrectionTest.java new file mode 100644 index 000000000000..1ea6f03b24b1 --- /dev/null +++ b/test/jdk/java/awt/Frame/InsetCorrectionTest.java @@ -0,0 +1,102 @@ +/* + * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.Menu; +import java.awt.MenuBar; +import java.awt.MenuItem; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +/* + * @test + * @bug 4091426 + * @key headful + * @summary Test inset correction when setVisible(true) BEFORE setSize(), setLocation() + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual InsetCorrectionTest + */ + +public class InsetCorrectionTest { + private static final String INSTRUCTIONS = """ + There is a frame of size 300x300 at location (100,100). + It has a menubar with one menu, 'File', but the frame + is otherwise empty. In particular, there should be no + part of the frame that is not shown in the background color. + Upon test completion, click Pass or Fail appropriately. + """; + + private static InsetCorrection testFrame; + + public static void main(String[] args) throws Exception { + EventQueue.invokeAndWait(() -> testFrame = new InsetCorrection()); + + try { + PassFailJFrame passFailJFrame = PassFailJFrame.builder() + .title("InsetCorrectionTest Instructions") + .instructions(INSTRUCTIONS) + .columns(45) + .logArea(3) + .build(); + EventQueue.invokeAndWait(() -> + PassFailJFrame.log("frame location: " + testFrame.getBounds())); + passFailJFrame.awaitAndCheck(); + } finally { + EventQueue.invokeAndWait(testFrame::dispose); + } + } + + static class InsetCorrection extends Frame + implements ActionListener { + MenuBar mb; + Menu file; + MenuItem cause_bug_b; + + public InsetCorrection() { + super("InsetCorrection"); + mb = new MenuBar(); + file = new Menu("File"); + mb.add(file); + cause_bug_b = new MenuItem("cause bug"); + file.add(cause_bug_b); + setMenuBar(mb); + cause_bug_b.addActionListener(this); + + // Making the frame visible before setSize and setLocation() + // are being called causes sometimes strange behaviour with + // JDK1.1.5G. The frame is then sometimes to large and the + // excess areas are drawn in black. This only happens + // sometimes. + setVisible(true); + setSize(300, 300); + setLocation(100, 100); + } + + public void actionPerformed(ActionEvent e) { + setVisible(false); + setVisible(true); + } + } +} diff --git a/test/jdk/java/awt/Frame/MegaIconTest/MegaIconTest.java b/test/jdk/java/awt/Frame/MegaIconTest/MegaIconTest.java new file mode 100644 index 000000000000..3132d49df564 --- /dev/null +++ b/test/jdk/java/awt/Frame/MegaIconTest/MegaIconTest.java @@ -0,0 +1,273 @@ +/* + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.BorderLayout; +import java.awt.Button; +import java.awt.Canvas; +import java.awt.Color; +import java.awt.Dialog; +import java.awt.Dimension; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.GridLayout; +import java.awt.Image; +import java.awt.Label; +import java.awt.MediaTracker; +import java.awt.Panel; +import java.awt.Toolkit; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.awt.image.ImageProducer; +import java.net.URL; + +/* + * @test + * @bug 4175560 + * @summary Test use of user-defined icons + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual MegaIconTest + */ + +public class MegaIconTest { + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + Each of the buttons in the main window represents a test + of certain icon functionality - background transparency/opacity + of the icon, scaling etc. + Clicking on each button brings up a window displaying the graphic + that should appear in the corresponding icon. + Click on each button, minimize the resulting window, and check that + the icon is displayed as the test name indicates. + On Win32, icons should also be displayed correctly in the title bar. + If all the test pass, then this test passes, else fail. + """; + + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .rows(10) + .columns(35) + .testUI(MegaIconTest::initialize) + .build() + .awaitAndCheck(); + } + + public static Frame initialize() { + //Create the iconTestFrames and add to IconTestButtons + IconTestButtons itb = new IconTestButtons(new IconTestFrame[]{ + new IconTestFrame("Opaque, Scaled Icon Test", + "duke_404.gif"), + + new IconTestFrame("Transparent Icon", + "dukeWave.gif"), + + new IconTestFrameBG("Transparent, Scaled Icon with bg", + "fight.gif", Color.red), + + new IconTestFrameDlg("Transparent icon w/ Dialog", + "dukeWave.gif") + }); + itb.pack(); + return itb; + } +} + +class IconTestButtons extends Frame { + public IconTestButtons(IconTestFrame[] iconTests) { + IconTestFrame tempTest; + Button newBtn; + Panel newPnl; + DoneLabel newLbl; + + setTitle("MegaIconTest"); + + setLayout(new GridLayout(iconTests.length, 1)); + + //For each icon test frame + //Get name, add button with name and action to + //display the window, and add label "done" after + + for (int i = 0; i < iconTests.length; i++) { + tempTest = iconTests[i]; + newBtn = new Button(tempTest.getTestName()); + newLbl = new DoneLabel(); + newBtn.addActionListener(new IconTestActionListener(tempTest, + newLbl)); + newPnl = new Panel(); + newPnl.add(newBtn); + newPnl.add(newLbl); + add(newPnl); + } + } + + protected class DoneLabel extends Label { + public DoneLabel() { + super("Done"); + setVisible(false); + } + } + + protected class IconTestActionListener implements ActionListener { + IconTestFrame f; + DoneLabel l; + + public IconTestActionListener(IconTestFrame frame, DoneLabel label) { + this.f = frame; + this.l = label; + } + + public void actionPerformed(ActionEvent e) { + f.pack(); + f.setVisible(true); + l.setVisible(true); + IconTestButtons.this.pack(); + } + } +} + +class IconTestFrame extends Frame { + private String testName; + int width, height; + Image iconImage; + MediaTracker tracker; + + public IconTestFrame(String testName, String iconFileName) { + super(testName); + this.testName = testName; + tracker = new MediaTracker(this); + + //Set icon image + URL url = MegaIconTest.class.getResource(iconFileName); + Toolkit tk = Toolkit.getDefaultToolkit(); + if (tk == null) { + System.out.println("Toolkit is null!"); + } + if (url == null) { + System.out.println("Can't load icon is null!"); + return; + } + try { + iconImage = tk.createImage((ImageProducer) url.getContent()); + } catch (java.io.IOException e) { + System.out.println("Unable to load icon image from url: " + url); + } + tracker.addImage(iconImage, 0); + try { + tracker.waitForAll(); + } catch (java.lang.InterruptedException e) { + System.err.println(e); + } + width = iconImage.getWidth(this); + height = iconImage.getHeight(this); + setIconImage(iconImage); + + addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent e) { + setVisible(false); + } + }); + + setLayout(new BorderLayout()); + setBackground(Color.YELLOW); + + //Add the icon graphic and instructions to the Frame + add(new IconCanvas(), "Center"); + pack(); + } + + class IconCanvas extends Canvas { + public void paint(Graphics g) { + if (IconTestFrame.this.iconImage == null) { + throw new NullPointerException(); + } + g.drawImage(IconTestFrame.this.iconImage, 0, 0, this); + } + + public Dimension getPreferredSize() { + return new Dimension(IconTestFrame.this.width, + IconTestFrame.this.height); + } + + public Dimension getMinimumSize() { + return getPreferredSize(); + } + + public Dimension getMaximumSize() { + return getPreferredSize(); + } + } + + public String getTestName() { + return testName; + } +} + +class IconTestFrameBG extends IconTestFrame { + public IconTestFrameBG(String testName, String iconFileName, Color bg) { + super(testName, iconFileName); + setBackground(bg); + Panel p = new Panel(); + p.setLayout(new GridLayout(3, 1)); + p.add(new Label("The background of this window has been set.")); + p.add(new Label("Unless the default icon background is the same color,")); + p.add(new Label("the icon background should NOT be this color.")); + add(p, "North"); + pack(); + } +} + +class IconTestFrameDlg extends IconTestFrame implements ActionListener { + Dialog dlg; + Button dlgBtn; + + public IconTestFrameDlg(String testName, String iconFilename) { + super(testName, iconFilename); + Panel p = new Panel(); + p.setLayout(new GridLayout(4, 1)); + p.add(new Label("Click on the button below to display a child dialog.")); + p.add(new Label("On Win32, the Dialog's titlebar icon should match")); + p.add(new Label("the titlebar icon of this window.")); + p.add(new Label("Minimizing this Frame should yield only one icon.")); + add(p, "North"); + + dlg = new Dialog(this); + dlg.setSize(200, 200); + dlg.add(new Label("Dialog stuff.")); + dlg.addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent e) { + setVisible(false); + } + }); + + dlgBtn = new Button("Display Dialog"); + dlgBtn.addActionListener(this); + add(dlgBtn, "South"); + } + + public void actionPerformed(ActionEvent e) { + dlg.setVisible(true); + } +} diff --git a/test/jdk/java/awt/Frame/MegaIconTest/dukeWave.gif b/test/jdk/java/awt/Frame/MegaIconTest/dukeWave.gif new file mode 100644 index 000000000000..52ada7979ef5 Binary files /dev/null and b/test/jdk/java/awt/Frame/MegaIconTest/dukeWave.gif differ diff --git a/test/jdk/java/awt/Frame/MegaIconTest/duke_404.gif b/test/jdk/java/awt/Frame/MegaIconTest/duke_404.gif new file mode 100644 index 000000000000..4958e0d0dfa8 Binary files /dev/null and b/test/jdk/java/awt/Frame/MegaIconTest/duke_404.gif differ diff --git a/test/jdk/java/awt/Frame/MegaIconTest/fight.gif b/test/jdk/java/awt/Frame/MegaIconTest/fight.gif new file mode 100644 index 000000000000..6be1b4972d0d Binary files /dev/null and b/test/jdk/java/awt/Frame/MegaIconTest/fight.gif differ diff --git a/test/jdk/java/awt/Frame/MenuBarOffsetTest.java b/test/jdk/java/awt/Frame/MenuBarOffsetTest.java new file mode 100644 index 000000000000..65a4a8ef4bd5 --- /dev/null +++ b/test/jdk/java/awt/Frame/MenuBarOffsetTest.java @@ -0,0 +1,81 @@ +/* + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Insets; +import java.awt.Menu; +import java.awt.MenuBar; + +/* + * @test + * @bug 4180577 + * @summary offset problems with menus in frames: (2 * 1) should be (2 * menuBarBorderSize) + * @requires (os.family == "linux" | os.family == "windows") + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual MenuBarOffsetTest +*/ + +public class MenuBarOffsetTest { + private static final String INSTRUCTIONS = """ + If a menubar containing a menubar item labeled Test appears. + in a frame, and fits within the frame, press Pass, else press Fail. + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("MenuBarOffsetTest Instructions") + .instructions(INSTRUCTIONS) + .columns(45) + .testUI(FrameTest::new) + .build() + .awaitAndCheck(); + } + + private static class FrameTest extends Frame { + public FrameTest() { + super("MenuBarOffsetTest FrameTest"); + MenuBar m = new MenuBar(); + setMenuBar(m); + Menu test = m.add(new Menu("Test")); + test.add("1"); + test.add("2"); + setSize(100, 100); + } + + public void paint(Graphics g) { + setForeground(Color.red); + Insets i = getInsets(); + Dimension d = getSize(); + System.err.println(getBounds()); + System.err.println("" + i); + + g.drawRect(i.left, i.top, + d.width - i.left - i.right - 1, + d.height - i.top - i.bottom - 1); + } + } +} diff --git a/test/jdk/java/awt/Frame/MinimumSizeTest.java b/test/jdk/java/awt/Frame/MinimumSizeTest.java new file mode 100644 index 000000000000..cfff77be5f93 --- /dev/null +++ b/test/jdk/java/awt/Frame/MinimumSizeTest.java @@ -0,0 +1,114 @@ +/* + * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import javax.imageio.ImageIO; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.Robot; +import java.awt.Toolkit; +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.IOException; + +/* + * @test + * @key headful + * @bug 1256759 + * @summary Checks that Frames with a very small size don't cause Motif + * to generate VendorShells which consume the entire desktop. + */ + +public class MinimumSizeTest { + + private static final Color BG_COLOR = Color.RED; + private static Frame backgroundFrame; + private static Frame testedFrame; + + private static Robot robot; + private static final Point location = new Point(200, 200); + private static final Point[] testPointLocations = { + new Point(100, 200), + new Point(200, 100), + new Point(450, 210), + new Point(210, 350), + }; + + public static void main(String[] args) throws Exception { + robot = new Robot(); + + try { + EventQueue.invokeAndWait(MinimumSizeTest::initAndShowGui); + robot.waitForIdle(); + robot.delay(500); + test(); + System.out.println("Test passed."); + } finally { + EventQueue.invokeAndWait(() -> { + backgroundFrame.dispose(); + testedFrame.dispose(); + }); + } + } + + private static void test() { + for (Point testLocation : testPointLocations) { + Color pixelColor = robot.getPixelColor(testLocation.x, testLocation.y); + + if (!pixelColor.equals(BG_COLOR)) { + Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); + BufferedImage screenCapture = robot.createScreenCapture(new Rectangle(screenSize)); + try { + ImageIO.write(screenCapture, "png", new File("failure.png")); + } catch (IOException ignored) {} + throw new RuntimeException("Pixel color does not match expected color %s at %s" + .formatted(pixelColor, testLocation)); + } + } + } + + private static void initAndShowGui() { + backgroundFrame = new Frame("MinimumSizeTest background"); + backgroundFrame.setUndecorated(true); + backgroundFrame.setBackground(BG_COLOR); + backgroundFrame.setBounds(new Rectangle(Toolkit.getDefaultToolkit().getScreenSize())); + backgroundFrame.setVisible(true); + + testedFrame = new MinimumSizeTestFrame(); + testedFrame.setVisible(true); + } + + private static class MinimumSizeTestFrame extends Frame { + public MinimumSizeTestFrame() { + super("MinimumSizeTest"); + setVisible(true); + setBackground(Color.BLUE); + setSize(0, 0); + setLocation(location); + } + } +} + diff --git a/test/jdk/java/awt/Frame/MultiScreenTest.java b/test/jdk/java/awt/Frame/MultiScreenTest.java new file mode 100644 index 000000000000..845f601138b7 --- /dev/null +++ b/test/jdk/java/awt/Frame/MultiScreenTest.java @@ -0,0 +1,485 @@ +/* + * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.BorderLayout; +import java.awt.Button; +import java.awt.Canvas; +import java.awt.Choice; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.FontMetrics; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.GraphicsConfiguration; +import java.awt.GraphicsDevice; +import java.awt.GraphicsEnvironment; +import java.awt.Image; +import java.awt.Label; +import java.awt.LayoutManager; +import java.awt.Panel; +import java.awt.Rectangle; +import java.awt.RenderingHints; +import java.awt.TextField; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +import java.awt.image.ColorModel; +import java.awt.image.MemoryImageSource; + +import java.util.ArrayList; +import java.util.List; + +import javax.swing.JFrame; + +import jtreg.SkippedException; + +/* + * @test + * @bug 4312921 + * @key multimon + * @library /java/awt/regtesthelpers /test/lib + * @build PassFailJFrame + * @summary Tests that no garbage is painted on primary screen with DGA + * @run main/manual MultiScreenTest + */ + +public class MultiScreenTest { + static GraphicsEnvironment ge; + static GraphicsDevice[] gs; + + public static void main(String[] args) throws Exception { + ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); + gs = ge.getScreenDevices(); + if (gs.length < 2) { + throw new SkippedException("You have only one monitor in your system - test passed"); + } + MultiScreenTest obj = new MultiScreenTest(); + String INSTRUCTIONS = + "This test is to be run only on multiscreen machine. " + + "You have " + gs.length + " monitors in your system.\n" + + "Actively drag the DitherTest frames on the secondary screen and " + + "if you see garbage appearing on your primary screen " + + "test failed otherwise it passed.";; + + PassFailJFrame.builder() + .title("MultiScreenTest Instruction") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(40) + .testUI(obj::init) + .build() + .awaitAndCheck(); + } + + public List init() { + List list = new ArrayList<>(); + for (int j = 0; j < gs.length; j++) { + GraphicsConfiguration[] gc = gs[j].getConfigurations(); + if (gc.length > 0) { + for (int i = 0; i < gc.length / 2; i++) { + JFrame f = new JFrame(gc[i]); //test JFrame( gc ) + GCCanvas c = new GCCanvas(gc[i]);//test canvas( gc ) + Rectangle gcBounds = gc[i].getBounds(); //test getBounds() + int xoffs = gcBounds.x; + int yoffs = gcBounds.y; + + f.getContentPane().add(c); + f.setTitle("Screen# " + Integer.toString(j) + ", GC#" + Integer.toString(i)); + f.setSize(300, 200); + f.setLocation(400 + xoffs, (i * 150) + yoffs);//test displaying in right location + list.add(f); + + Frame ditherfs = new Frame("DitherTest GC#" + Integer.toString(i), gc[i]); + ditherfs.setLayout(new BorderLayout()); //showDitherTest + DitherTest ditherTest = new DitherTest(gc[i]); + ditherfs.add("Center", ditherTest); + ditherfs.setBounds(300, 200, 300, 200); + ditherfs.setLocation(750 + xoffs, (i * 50) + yoffs); + ditherfs.pack(); + ditherfs.show(); + ditherTest.start(); + } + } + } + return list; + } +} + +class GCCanvas extends Canvas { + + GraphicsConfiguration gc; + Rectangle bounds; + Graphics g = this.getGraphics(); + Dimension size = getSize(); + + public GCCanvas(GraphicsConfiguration gc) { + super(gc); + this.gc = gc; + bounds = gc.getBounds(); + } + + public void paint( Graphics _g ) { + + Graphics2D g = (Graphics2D) _g; + + g.drawRect(0, 0, size.width-1, size.height-1); + g.setColor(Color.lightGray); + g.draw3DRect(1, 1, size.width-3, size.height-3, true); + + g.setColor(Color.red); + g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + + g.drawString("HELLO!", 110, 10); + + g.setColor(Color.blue); + g.drawString("ScreenSize="+Integer.toString(bounds.width)+"X"+ + Integer.toString(bounds.height), 10, 20); + g.setColor(Color.green); + g.drawString(gc.toString(), 10, 30); + g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_OFF); + + g.setColor(Color.orange); + g.fillRect(40, 20, 50, 50); + + g.setColor(Color.red); + g.drawRect(100, 20, 30, 30); + + g.setColor(Color.gray); + g.drawLine(220, 20, 280, 40); + + g.setColor(Color.cyan); + g.fillArc(150, 30, 30, 30, 0, 200); + } + + public Dimension getPreferredSize(){ + return new Dimension(300, 200); + } +} + +class DitherCanvas extends Canvas { + Image img; + static String calcString = "Calculating..."; + + GraphicsConfiguration mGC; + + public DitherCanvas(GraphicsConfiguration gc) { + super(gc); + mGC = gc; + } + + public GraphicsConfiguration getGraphicsConfig() { + return mGC; + } + + public void paint(Graphics g) { + int w = getSize().width; + int h = getSize().height; + if (img == null) { + super.paint(g); + g.setColor(Color.black); + FontMetrics fm = g.getFontMetrics(); + int x = (w - fm.stringWidth(calcString)) / 2; + int y = h / 2; + g.drawString(calcString, x, y); + } else { + g.drawImage(img, 0, 0, w, h, this); + } + } + + public void update(Graphics g) { + paint(g); + } + + public Dimension getMinimumSize() { + return new Dimension(20, 20); + } + + public Dimension getPreferredSize() { + return new Dimension(200, 200); + } + + public Image getImage() { + return img; + } + + public void setImage(Image img) { + this.img = img; + paint(getGraphics()); + } +} + +class DitherTest extends Panel implements Runnable { + final static int NOOP = 0; + final static int RED = 1; + final static int GREEN = 2; + final static int BLUE = 3; + final static int ALPHA = 4; + final static int SATURATION = 5; + + Thread runner; + + DitherControls XControls; + DitherControls YControls; + DitherCanvas canvas; + + public DitherTest(GraphicsConfiguration gc) { + String xspec, yspec; + int xvals[] = new int[2]; + int yvals[] = new int[2]; + + xspec = "red"; + yspec = "blue"; + int xmethod = colormethod(xspec, xvals); + int ymethod = colormethod(yspec, yvals); + + setLayout(new BorderLayout()); + XControls = new DitherControls(this, xvals[0], xvals[1], + xmethod, false); + YControls = new DitherControls(this, yvals[0], yvals[1], + ymethod, true); + YControls.addRenderButton(); + add("North", XControls); + add("South", YControls); + add("Center", canvas = new DitherCanvas(gc)); + } + + public void start() { + runner = new Thread(this); + runner.start(); + } + + int colormethod(String s, int vals[]) { + int method = NOOP; + + if (s == null) { + s = ""; + } + + String lower = s.toLowerCase(); + int len = 0; + if (lower.startsWith("red")) { + method = RED; + lower = lower.substring(3); + } else if (lower.startsWith("green")) { + method = GREEN; + lower = lower.substring(5); + } else if (lower.startsWith("blue")) { + method = BLUE; + lower = lower.substring(4); + } else if (lower.startsWith("alpha")) { + method = ALPHA; + lower = lower.substring(4); + } else if (lower.startsWith("saturation")) { + method = SATURATION; + lower = lower.substring(10); + } + + if (method == NOOP) { + vals[0] = 0; + vals[1] = 0; + return method; + } + + int begval = 0; + int endval = 255; + + try { + int dash = lower.indexOf('-'); + if (dash < 0) { + begval = endval = Integer.parseInt(lower); + } else { + begval = Integer.parseInt(lower.substring(0, dash)); + endval = Integer.parseInt(lower.substring(dash + 1)); + } + } catch (Exception e) { + } + + if (begval < 0) { + begval = 0; + } + if (endval < 0) { + endval = 0; + } + if (begval > 255) { + begval = 255; + } + if (endval > 255) { + endval = 255; + } + + vals[0] = begval; + vals[1] = endval; + + return method; + } + + void applymethod(int c[], int method, int step, int total, int vals[]) { + if (method == NOOP) + return; + int val = ((total < 2) + ? vals[0] + : vals[0] + ((vals[1] - vals[0]) * step / (total - 1))); + switch (method) { + case RED: + c[0] = val; + break; + case GREEN: + c[1] = val; + break; + case BLUE: + c[2] = val; + break; + case ALPHA: + c[3] = val; + break; + case SATURATION: + int max = Math.max(Math.max(c[0], c[1]), c[2]); + int min = max * (255 - val) / 255; + if (c[0] == 0) { + c[0] = min; + } + if (c[1] == 0) { + c[1] = min; + } + if (c[2] == 0) { + c[2] = min; + } + break; + } + } + + public void run() { + canvas.setImage(null); // Wipe previous image + Image img = calculateImage(); + synchronized (this) { + if (img != null && runner == Thread.currentThread()) { + canvas.setImage(img); + } + } + } + + /** + * Calculates and returns the image. Halts the calculation and returns + * null if stopped during the calculation. + */ + Image calculateImage() { + Thread me = Thread.currentThread(); + + int width = canvas.getSize().width; + int height = canvas.getSize().height; + int xvals[] = new int[2]; + int yvals[] = new int[2]; + int xmethod = XControls.getParams(xvals); + int ymethod = YControls.getParams(yvals); + int pixels[] = new int[width * height]; + int c[] = new int[4]; + int index = 0; + + for (int j = 0; j < height; j++) { + for (int i = 0; i < width; i++) { + c[0] = c[1] = c[2] = 0; + c[3] = 255; + if (xmethod < ymethod) { + applymethod(c, xmethod, i, width, xvals); + applymethod(c, ymethod, j, height, yvals); + } else { + applymethod(c, ymethod, j, height, yvals); + applymethod(c, xmethod, i, width, xvals); + } + pixels[index++] = ((c[3] << 24) | + (c[0] << 16) | + (c[1] << 8) | + (c[2] << 0)); + + } + // Poll once per row to see if we've been told to stop. + if (runner != me) { + return null; + } + } + + return createImage(new MemoryImageSource(width, height, + ColorModel.getRGBdefault(), pixels, 0, width)); + } + + public String getInfo() { + return "An interactive demonstration of dithering."; + } + + public String[][] getParameterInfo() { + String[][] info = { + {"xaxis", "{RED, GREEN, BLUE, PINK, ORANGE, MAGENTA, CYAN, WHITE, YELLOW, GRAY, DARKGRAY}", + "The color of the Y axis. Default is RED."}, + {"yaxis", "{RED, GREEN, BLUE, PINK, ORANGE, MAGENTA, CYAN, WHITE, YELLOW, GRAY, DARKGRAY}", + "The color of the X axis. Default is BLUE."} + }; + return info; + } +} + +class DitherControls extends Panel implements ActionListener { + TextField start; + TextField end; + Button button; + Choice choice; + DitherTest dt; + + static LayoutManager dcLayout = new FlowLayout(FlowLayout.CENTER, 10, 5); + + public DitherControls(DitherTest app, int s, int e, int type, + boolean vertical) { + dt = app; + setLayout(dcLayout); + add(new Label(vertical ? "Vertical" : "Horizontal")); + add(choice = new Choice()); + choice.addItem("Noop"); + choice.addItem("Red"); + choice.addItem("Green"); + choice.addItem("Blue"); + choice.addItem("Alpha"); + choice.addItem("Saturation"); + choice.select(type); + add(start = new TextField(Integer.toString(s), 4)); + add(end = new TextField(Integer.toString(e), 4)); + } + + public void addRenderButton() { + add(button = new Button("New Image")); + button.addActionListener(this); + } + + public int getParams(int vals[]) { + vals[0] = Integer.parseInt(start.getText()); + vals[1] = Integer.parseInt(end.getText()); + return choice.getSelectedIndex(); + } + + public void actionPerformed(ActionEvent e) { + if (e.getSource() == button) { + dt.start(); + } + } +} diff --git a/test/jdk/java/awt/Frame/PackTwiceTest.java b/test/jdk/java/awt/Frame/PackTwiceTest.java new file mode 100644 index 000000000000..63cd20612f0d --- /dev/null +++ b/test/jdk/java/awt/Frame/PackTwiceTest.java @@ -0,0 +1,67 @@ +/* + * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Frame; +import java.awt.TextField; + +/* + * @test + * @bug 4097744 + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @summary packing a frame twice stops it resizing + * @run main/manual PackTwiceTest + */ + +public class PackTwiceTest { + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + 1. You would see a Frame titled 'TestFrame' + 2. The Frame displays a text as below: + 'I am a lengthy sentence...can you see me?' + 3. If you can see the full text without resizing the frame + using mouse, press 'Pass' else press 'Fail'."""; + + PassFailJFrame.builder() + .title("PackTwiceTest Instruction") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(40) + .testUI(PackTwiceTest::createUI) + .build() + .awaitAndCheck(); + } + + private static Frame createUI() { + Frame f = new Frame("PackTwiceTest TestFrame"); + TextField tf = new TextField(); + f.add(tf, "Center"); + tf.setText("I am a short sentence"); + f.pack(); + f.pack(); + tf.setText("I am a lengthy sentence...can you see me?"); + f.pack(); + f.requestFocus(); + return f; + } +} diff --git a/test/jdk/java/awt/Frame/SizeMinimizedTest.java b/test/jdk/java/awt/Frame/SizeMinimizedTest.java new file mode 100644 index 000000000000..2520cf42892f --- /dev/null +++ b/test/jdk/java/awt/Frame/SizeMinimizedTest.java @@ -0,0 +1,140 @@ +/* + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dimension; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.Point; +import java.awt.Robot; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; + +/* + * @test + * @key headful + * @bug 4065534 + * @summary Frame.setSize() doesn't change size if window is in an iconified state + * @run main SizeMinimizedTest + */ + +public class SizeMinimizedTest { + private static Frame frame; + private static final int INITIAL_SIZE = 100; + private static final int INITIAL_X = 150; + private static final int INITIAL_Y = 50; + private static final int RESET_SIZE = 200; + private static final int OFFSET = 10; + private static int iterationCnt = 0; + private static Dimension expectedSize; + private static Dimension frameSize; + private static Point expectedLoc; + private static Point frameLoc; + + public static void main(String[] args) throws Exception { + Robot robot = new Robot(); + try { + EventQueue.invokeAndWait(() -> { + createUI(); + }); + robot.waitForIdle(); + robot.delay(1000); + + EventQueue.invokeAndWait(() -> { + frame.setState(Frame.ICONIFIED); + }); + robot.waitForIdle(); + robot.delay(100); + + EventQueue.invokeAndWait(() -> { + frame.setSize(RESET_SIZE, RESET_SIZE); + }); + robot.waitForIdle(); + robot.delay(100); + + for (int i = 0; i < 5; i++) { + EventQueue.invokeAndWait(() -> { + Point pt = frame.getLocation(); + frame.setLocation(pt.x + OFFSET, pt.y); + }); + iterationCnt++; + robot.waitForIdle(); + robot.delay(100); + } + EventQueue.invokeAndWait(() -> { + frame.setState(Frame.NORMAL); + }); + robot.waitForIdle(); + robot.delay(100); + + System.out.println("Test Passed!"); + } finally { + EventQueue.invokeAndWait(() -> { + if (frame != null) { + frame.dispose(); + } + }); + } + } + + public static void createUI() { + frame = new Frame("Frame size test"); + frame.setSize(INITIAL_SIZE, INITIAL_SIZE); + frame.setLocation(INITIAL_X, INITIAL_Y); + + frame.addWindowListener(new WindowAdapter() { + @Override + public void windowOpened(WindowEvent e) { + System.out.println("Initial Frame Size: " + frame.getSize()); + System.out.println("Initial Frame Location: " + + frame.getLocationOnScreen()); + } + }); + + frame.addWindowStateListener(new WindowAdapter() { + @Override + public void windowStateChanged(WindowEvent e) { + if (e.getNewState() == Frame.NORMAL) { + System.out.println("Frame Size: " + frame.getSize()); + System.out.println("Frame Location: " + + frame.getLocationOnScreen()); + expectedSize = new Dimension(RESET_SIZE, RESET_SIZE); + frameSize = frame.getSize(); + + if (!expectedSize.equals(frameSize)) { + throw new RuntimeException("Test Failed due to size mismatch."); + } + + expectedLoc = new Point(INITIAL_X + OFFSET * iterationCnt, + INITIAL_Y); + frameLoc = frame.getLocationOnScreen(); + + if (!expectedLoc.equals(frameLoc)) { + throw new RuntimeException("Test Failed due to " + + "location mismatch."); + } + } + } + }); + frame.setVisible(true); + } +} diff --git a/test/jdk/java/awt/FullScreen/FullscreenWindowProps/FullscreenWindowProps.java b/test/jdk/java/awt/FullScreen/FullscreenWindowProps/FullscreenWindowProps.java index 7c28c9ed2af7..7116b051e664 100644 --- a/test/jdk/java/awt/FullScreen/FullscreenWindowProps/FullscreenWindowProps.java +++ b/test/jdk/java/awt/FullScreen/FullscreenWindowProps/FullscreenWindowProps.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, 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 @@ -52,6 +52,10 @@ public void paint(Graphics g) { super.paint(g); g.setColor(Color.GREEN); g.fillRect(0, 0, getWidth(), getHeight()); + g.setColor(Color.RED); + DisplayMode displayMode = + getGraphicsConfiguration().getDevice().getDisplayMode(); + g.drawString(displayMode.toString(), 100, 100); } }; diff --git a/test/jdk/java/awt/FullScreen/NoResizeEventOnDMChangeTest/NoResizeEventOnDMChangeTest.java b/test/jdk/java/awt/FullScreen/NoResizeEventOnDMChangeTest/NoResizeEventOnDMChangeTest.java index 455ad2f2b0a3..c7277e8b96ca 100644 --- a/test/jdk/java/awt/FullScreen/NoResizeEventOnDMChangeTest/NoResizeEventOnDMChangeTest.java +++ b/test/jdk/java/awt/FullScreen/NoResizeEventOnDMChangeTest/NoResizeEventOnDMChangeTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,6 +26,8 @@ * @bug 6646411 * @summary Tests that full screen window and its children receive resize event when display mode changes + * @library /test/lib + * @build jdk.test.lib.Platform jtreg.SkippedException * @run main/othervm NoResizeEventOnDMChangeTest * @run main/othervm -Dsun.java2d.d3d=false NoResizeEventOnDMChangeTest */ @@ -44,9 +46,21 @@ import java.awt.event.ComponentEvent; import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; +import java.io.BufferedReader; +import java.io.IOException; + +import static java.util.concurrent.TimeUnit.SECONDS; +import jdk.test.lib.Platform; +import jtreg.SkippedException; public class NoResizeEventOnDMChangeTest { + public static void main(String[] args) { + if (Platform.isOnWayland() && !isFixDelivered()) { + throw new SkippedException("Test skipped because fix was not" + + "delivered in current GnomeShell version"); + } + final GraphicsDevice gd = GraphicsEnvironment. getLocalGraphicsEnvironment().getDefaultScreenDevice(); @@ -231,4 +245,34 @@ public synchronized int getDmChanges() { return dmChanges; } } + + private static boolean isFixDelivered() { + try { + Process process = + new ProcessBuilder("/usr/bin/gnome-shell", "--version") + .start(); + + try (BufferedReader reader = process.inputReader()) { + if (process.waitFor(2, SECONDS) && process.exitValue() == 0) { + String line = reader.readLine(); + if (line != null) { + System.out.println("Gnome shell version: " + line); + String[] versionComponents = line + .replaceAll("[^\\d.]", "") + .split("\\."); + + if (versionComponents.length >= 1) { + return Integer.parseInt(versionComponents[0]) > 42; + } + } + } + } + } catch (IOException + | InterruptedException + | IllegalThreadStateException + | NumberFormatException ignored) { + } + + return false; + } } diff --git a/test/jdk/java/awt/GradientPaint/JerkyGradient.java b/test/jdk/java/awt/GradientPaint/JerkyGradient.java new file mode 100644 index 000000000000..dc33b9c185af --- /dev/null +++ b/test/jdk/java/awt/GradientPaint/JerkyGradient.java @@ -0,0 +1,125 @@ +/* + * Copyright (c) 1999, 2024, 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 4221201 + * @summary Test where the gradient drawn should remain in sync with the + * rotating rectangle. + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual JerkyGradient + */ + +import java.awt.Color; +import java.awt.Frame; +import java.awt.GradientPaint; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Paint; +import java.awt.Panel; +import java.awt.RenderingHints; +import java.awt.Shape; +import java.awt.geom.Rectangle2D; +import java.awt.image.BufferedImage; + +public class JerkyGradient extends Panel implements Runnable { + protected static Shape mShape; + protected static Paint mPaint; + protected static double mTheta; + static Thread animatorThread; + static BufferedImage mImg; + + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + Watch at least one full rotation of the rectangle. Check that + the gradient drawn remains in sync with the rotating + rectangle. If so, pass this test. Otherwise, fail this test. + """; + + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .columns(35) + .testUI(JerkyGradient::createUI) + .build() + .awaitAndCheck(); + } + + public static Frame createUI() { + Frame f = new Frame("Rotating Gradient Test"); + JerkyGradient jg = new JerkyGradient(); + f.add(jg); + f.setSize(200, 200); + return f; + } + + public JerkyGradient() { + mShape = new Rectangle2D.Double(60, 50, 80, 100); + mPaint = new GradientPaint(0, 0, Color.red, + 25, 25, Color.yellow, + true); + mImg = new BufferedImage(200, 200, BufferedImage.TYPE_INT_RGB); + + animatorThread = new Thread(this); + animatorThread.setPriority(Thread.MIN_PRIORITY); + animatorThread.start(); + } + + public synchronized void run() { + Thread me = Thread.currentThread(); + double increment = Math.PI / 36; + double twoPI = Math.PI * 2; + + while (animatorThread == me) { + mTheta = (mTheta + increment) % twoPI; + repaint(); + try { + wait(50); + } catch (InterruptedException ie) { + break; + } + } + } + + public void update(Graphics g) { + Graphics2D g2 = mImg.createGraphics(); + g2.setColor(getBackground()); + g2.fillRect(0, 0, 200, 200); + g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, + RenderingHints.VALUE_ANTIALIAS_ON); + g2.rotate(mTheta, 100, 100); + g2.setPaint(Color.black); + g2.drawLine(100, 30, 100, 55); + g2.setPaint(mPaint); + g2.fill(mShape); + g2.setPaint(Color.black); + g2.draw(mShape); + paint(g); + g2.dispose(); + } + + public void paint(Graphics g) { + g.drawImage(mImg, 0, 0, null); + } +} diff --git a/test/jdk/java/awt/GradientPaint/ShearTest.java b/test/jdk/java/awt/GradientPaint/ShearTest.java new file mode 100644 index 000000000000..95a4e4a6dcd3 --- /dev/null +++ b/test/jdk/java/awt/GradientPaint/ShearTest.java @@ -0,0 +1,137 @@ +/* + * Copyright (c) 1999, 2024, 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 4171820 + * @summary Checks that GradientPaint responds to shearing transforms correctly + * The gradients drawn should be parallel to the sides of the + * indicated anchor rectangle. + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual ShearTest + */ + +import java.awt.Canvas; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Frame; +import java.awt.GradientPaint; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.GridLayout; +import java.awt.Panel; +import java.awt.Rectangle; +import java.awt.geom.AffineTransform; + +public class ShearTest { + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + This test displays 2 rows each containing 4 gradient fills. Each + gradient fill is labeled depending on whether the line or lines + of the gradient should be truly vertical, truly horizontal, or + some slanted diagonal direction. The test passes if the direction + of each gradient matches its label. + """; + + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .columns(35) + .testUI(ShearTest::createUI) + .build() + .awaitAndCheck(); + } + + public static Frame createUI() { + Frame f = new Frame("Shear Gradient Test"); + f.setLayout(new GridLayout(0, 1)); + f.add(getPanelSet(false), "North"); + f.add(getPanelSet(true), "Center"); + f.setSize(500, 300); + return f; + } + + public static Panel getPanelSet(boolean horizontal) { + String direven = horizontal ? "Slanted" : "Vertical"; + String dirodd = horizontal ? "Horizontal" : "Slanted"; + + Panel p = new Panel(); + p.setLayout(new GridLayout(0, 4)); + p.add(new ShearCanvas(direven, false, horizontal, false, true)); + p.add(new ShearCanvas(dirodd, false, horizontal, true, false)); + p.add(new ShearCanvas(direven, true, horizontal, false, true)); + p.add(new ShearCanvas(dirodd, true, horizontal, true, false)); + + return p; + } + + public static class ShearCanvas extends Canvas { + public static final int GRADW = 30; + + public static final Rectangle anchor = + new Rectangle(-GRADW / 2, -GRADW / 2, GRADW, GRADW); + + public static final Color faintblue = new Color(0f, 0f, 1.0f, 0.35f); + + private AffineTransform txform; + private GradientPaint grad; + private String label; + + public ShearCanvas(String label, + boolean cyclic, boolean horizontal, + boolean shearx, boolean sheary) { + txform = new AffineTransform(); + if (shearx) { + txform.shear(-.5, 0); + } + if (sheary) { + txform.shear(0, -.5); + } + int relx = horizontal ? 0 : GRADW / 2; + int rely = horizontal ? GRADW / 2 : 0; + grad = new GradientPaint(-relx, -rely, Color.green, + relx, rely, Color.yellow, cyclic); + this.label = label; + } + + public void paint(Graphics g) { + Graphics2D g2d = (Graphics2D) g; + + AffineTransform at = g2d.getTransform(); + g2d.translate(75, 75); + g2d.transform(txform); + g2d.setPaint(grad); + g2d.fill(g.getClip()); + g2d.setColor(faintblue); + g2d.fill(anchor); + g2d.setTransform(at); + + Dimension d = getSize(); + g2d.setColor(Color.black); + g2d.drawRect(0, 0, d.width - 1, d.height - 1); + g2d.drawString(label, 5, d.height - 5); + g2d.dispose(); + } + } +} diff --git a/test/jdk/java/awt/Graphics/LineLocationTest.java b/test/jdk/java/awt/Graphics/LineLocationTest.java new file mode 100644 index 000000000000..5c382ceac959 --- /dev/null +++ b/test/jdk/java/awt/Graphics/LineLocationTest.java @@ -0,0 +1,106 @@ +/* + * Copyright (c) 2006, 2025, 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 4094059 + * @summary drawing to a subclass of canvas didn't draw to the correct location. + * @key headful + * @run main LineLocationTest + */ + +import java.awt.AWTException; +import java.awt.Canvas; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Panel; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.Robot; +import java.awt.image.BufferedImage; +import java.lang.reflect.InvocationTargetException; + +public class LineLocationTest extends Frame { + private DrawScreen screen; + + public void initialize() { + setSize(400, 400); + setLocationRelativeTo(null); + setTitle("Line Location Test"); + Panel p = new Panel(); + screen = new DrawScreen(); + p.add(screen); + p.setLocation(50, 50); + p.setSize(300, 300); + add(p); + setBackground(Color.white); + setForeground(Color.blue); + setVisible(true); + } + + public void requestCoordinates(Rectangle r) { + Point location = screen.getLocationOnScreen(); + Dimension size = screen.getSize(); + r.setBounds(location.x, location.y, size.width, size.height); + } + + public static void main(String[] args) throws InterruptedException, + InvocationTargetException, AWTException { + LineLocationTest me = new LineLocationTest(); + EventQueue.invokeAndWait(me::initialize); + try { + Robot robot = new Robot(); + robot.delay(1000); + Rectangle coords = new Rectangle(); + EventQueue.invokeAndWait(() -> { + me.requestCoordinates(coords); + }); + BufferedImage capture = robot.createScreenCapture(coords); + robot.delay(2000); + for (int y = 0; y < capture.getHeight(); y++) { + for (int x = 0; x < capture.getWidth(); x++) { + int blue = Color.blue.getRGB(); + if (capture.getRGB(x, y) == blue) { + throw new RuntimeException("Blue detected at " + x + ", " + y); + } + } + } + } finally { + EventQueue.invokeAndWait(me::dispose); + } + } +} + +class DrawScreen extends Canvas { + public Dimension getPreferredSize() { + return new Dimension(300, 300); + } + + public void paint(Graphics g) { + g.setColor(Color.blue); + g.drawLine(5, -3145583, 50, -3145583); + } +} diff --git a/test/jdk/java/awt/Graphics/NativeWin32Clear.java b/test/jdk/java/awt/Graphics/NativeWin32Clear.java new file mode 100644 index 000000000000..6cef4fa810aa --- /dev/null +++ b/test/jdk/java/awt/Graphics/NativeWin32Clear.java @@ -0,0 +1,136 @@ +/* + * Copyright (c) 1999, 2025, 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 4216180 + * @summary This test verifies that Graphics2D.setBackground and clearRect + * performs correctly regardless of antialiasing hint. + * @key headful + * @run main NativeWin32Clear + */ + +import java.awt.AWTException; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Insets; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.RenderingHints; +import java.awt.Robot; +import java.awt.image.BufferedImage; +import java.lang.reflect.InvocationTargetException; + +public class NativeWin32Clear extends Frame { + + public void initialize() { + setLocationRelativeTo(null); + setSize(300, 200); + setBackground(Color.red); + setVisible(true); + } + + public void paint(Graphics g) { + Graphics2D g2 = (Graphics2D) g; + Dimension d = getSize(); + g2.setBackground(Color.green); + g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, + RenderingHints.VALUE_ANTIALIAS_ON); + g2.clearRect(0, 0, d.width / 2, d.height); + g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, + RenderingHints.VALUE_ANTIALIAS_OFF); + g2.clearRect(d.width / 2, 0, d.width / 2, d.height); + g2.setColor(Color.black); + } + + public void cleanup() { + setVisible(false); + dispose(); + } + + public void requestCoordinates(Rectangle r) { + Insets insets = getInsets(); + Point location = getLocationOnScreen(); + Dimension size = getSize(); + r.x = location.x + insets.left + 5; + r.y = location.y + insets.top + 5; + r.width = size.width - (insets.left + insets.right + 10); + r.height = size.height - (insets.top + insets.bottom + 10); + } + + /* + * Check color match within allowed deviation. + * Prints first non-matching pixel coordinates and actual and expected values. + * Returns true if image is filled with the provided color, false otherwise. + */ + private boolean checkColor(BufferedImage img, Color c, int delta) { + int cRed = c.getRed(); + int cGreen = c.getGreen(); + int cBlue = c.getBlue(); + for (int y = 0; y < img.getHeight(); y++) { + for (int x = 0; x < img.getWidth(); x++) { + int rgb = img.getRGB(x, y); + int red = (rgb & 0x00ff0000) >> 16; + int green = (rgb & 0x0000ff00) >> 8; + int blue = rgb & 0x000000ff; + if (cRed > (red + delta) || cRed < (red - delta) + || cGreen > (green + delta) || cGreen < (green - delta) + || cBlue > (blue + delta) || cBlue < (blue - delta)) { + System.err.println("Color at coordinates (" + x + ", " + y + ") does not match"); + System.err.println("Expected color: " + c.getRGB()); + System.err.println("Actual color: " + rgb); + System.err.println("Allowed deviation: " + delta); + return false; + } + } + } + return true; + } + + public static void main(String[] args) throws InterruptedException, + InvocationTargetException, AWTException { + NativeWin32Clear test = new NativeWin32Clear(); + try { + EventQueue.invokeAndWait(test::initialize); + Robot robot = new Robot(); + Rectangle coords = new Rectangle(); + EventQueue.invokeAndWait(() -> { + test.requestCoordinates(coords); + }); + robot.delay(2000); + robot.mouseMove(coords.x - 50, coords.y - 50); + robot.waitForIdle(); + BufferedImage capture = robot.createScreenCapture(coords); + robot.delay(2000); + if (!test.checkColor(capture, Color.green, 5)) { + throw new RuntimeException("Incorrect color encountered, check error log for details"); + } + } finally { + EventQueue.invokeAndWait(test::cleanup); + } + } +} diff --git a/test/jdk/java/awt/Graphics/PolygonFillTest.java b/test/jdk/java/awt/Graphics/PolygonFillTest.java new file mode 100644 index 000000000000..72c216f9e4b5 --- /dev/null +++ b/test/jdk/java/awt/Graphics/PolygonFillTest.java @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2001, 2025, 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 4465509 4453725 4489667 + * @summary verify that fillPolygon completely fills area defined by drawPolygon + * @key headful + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual PolygonFillTest +*/ + +import java.awt.Color; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Image; +import java.awt.Polygon; +import java.lang.reflect.InvocationTargetException; + +public class PolygonFillTest extends Frame { + Polygon poly; + static String INSTRUCTIONS = """ + There should be two hourglass shapes drawn inside the window + called "Polygon Fill Test". The outline should be blue + and the interior should be green and there should be no gaps + between the filled interior and the outline nor should the green + filler spill outside the blue outline. You may need + to use a screen magnifier to inspect the smaller shape + on the left to verify that there are no gaps. + + If both polygons painted correctly press "Pass" otherwise press "Fail". + """; + + public PolygonFillTest() { + poly = new Polygon(); + poly.addPoint(0, 0); + poly.addPoint(10, 10); + poly.addPoint(0, 10); + poly.addPoint(10, 0); + setSize(300, 300); + setTitle("Polygon Fill Test"); + } + + public void paint(Graphics g) { + int w = getWidth(); + int h = getHeight(); + Image img = createImage(20, 20); + Graphics g2 = img.getGraphics(); + drawPolys(g2, 20, 20, 5, 5); + g2.dispose(); + drawPolys(g, w, h, (w / 4) - 5, (h / 2) - 5); + g.drawImage(img, (3 * w / 4) - 40, (h / 2) - 40, 80, 80, null); + } + + public void drawPolys(Graphics g, int w, int h, int x, int y) { + g.setColor(Color.white); + g.fillRect(0, 0, w, h); + g.translate(x, y); + g.setColor(Color.green); + g.fillPolygon(poly); + g.setColor(Color.blue); + g.drawPolygon(poly); + g.translate(-x, -y); + } + + public static void main(String[] args) throws InterruptedException, + InvocationTargetException { + PassFailJFrame.builder() + .title("Polygon Fill Instructions") + .instructions(INSTRUCTIONS) + .testUI(PolygonFillTest::new) + .build() + .awaitAndCheck(); + } +} diff --git a/test/jdk/java/awt/Graphics/TallText.java b/test/jdk/java/awt/Graphics/TallText.java new file mode 100644 index 000000000000..b21b8a985d04 --- /dev/null +++ b/test/jdk/java/awt/Graphics/TallText.java @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2004, 2025, 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 4844952 + * @summary test large text draws properly to the screen + * @key headful + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual TallText + */ + +import java.awt.Color; +import java.awt.Font; +import java.awt.Frame; +import java.awt.Graphics; +import java.lang.reflect.InvocationTargetException; + +public class TallText extends Frame { + static String INSTRUCTIONS = """ + There should be a window called "Tall Text Test" that contains text "ABCDEFGHIJ". + Test should be properly displayed: no missing letters + and all letters fit within the frame without overlapping. + If all letters are properly displayed press "Pass", otherwise press "Fail". + """; + + public TallText() { + setSize(800, 200); + setTitle("Tall Text Test"); + } + + public void paint(Graphics g) { + Font font = new Font("dialog", Font.PLAIN, 99); + g.setFont(font); + g.setColor(Color.black); + g.drawString("ABCDEFGHIJ", 10, 150); + } + + public static void main(String[] args) throws InterruptedException, + InvocationTargetException { + PassFailJFrame.builder() + .title("Tall Text Instructions") + .instructions(INSTRUCTIONS) + .testUI(TallText::new) + .build() + .awaitAndCheck(); + } +} diff --git a/test/jdk/java/awt/Graphics2D/BasicStrokeValidate.java b/test/jdk/java/awt/Graphics2D/BasicStrokeValidate.java new file mode 100644 index 000000000000..251f14e5081b --- /dev/null +++ b/test/jdk/java/awt/Graphics2D/BasicStrokeValidate.java @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2000, 2024, 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 4363534 + * @summary This test verifies that setting a non-thin-line BasicStroke + * on a Graphics2D obtained from a BufferedImage will correctly validate + * the pipelines for the line-widening pipeline even if that is the only + * non-default attribute on the graphics. + * + */ + +import java.awt.BasicStroke; +import java.awt.Color; +import java.awt.Graphics2D; +import java.awt.image.BufferedImage; + +public class BasicStrokeValidate { + + public static final int TESTW = 100; + public static final int TESTH = 100; + + public static void main(String[] args) { + BufferedImage bi1 = createImage(false); + BufferedImage bi2 = createImage(true); + compare(bi1, bi2); // images should differ + } + + static BufferedImage createImage(boolean dashed) { + BufferedImage bi = new BufferedImage(TESTW, TESTH, BufferedImage.TYPE_INT_RGB); + Graphics2D g2d = bi.createGraphics(); + g2d.setColor(Color.white); + g2d.fillRect(0, 0, TESTW, TESTH); + g2d.setColor(Color.black); + if (dashed) { + g2d.setStroke(new BasicStroke(1.0f, BasicStroke.CAP_SQUARE, + BasicStroke.JOIN_MITER, 10.0f, + new float[] {2.5f, 3.5f}, + 0.0f)); + } + g2d.drawRect(10, 10, TESTW-20, TESTH-20); + g2d.setStroke(new BasicStroke(10f)); + g2d.drawRect(20, 20, TESTW-40, TESTH-40); + return bi; + } + + static void compare(BufferedImage i1, BufferedImage i2) { + boolean same = true; + int w = i1.getWidth(), h = i1.getHeight(); + for (int y = 0; y < h; y++) { + for (int x = 0; x < w; x++) { + int p1 = i1.getRGB(x, y); + int p2 = i2.getRGB(x, y); + if (p1 != p2) { + same = false; + } + } + if (!same) { + break; + } + } + if (same) { + throw new RuntimeException("No difference"); + } + } +} diff --git a/test/jdk/java/awt/Graphics2D/DrawImageIAETest/DrawImageIAETest.java b/test/jdk/java/awt/Graphics2D/DrawImageIAETest/DrawImageIAETest.java new file mode 100644 index 000000000000..af7ebae72a6c --- /dev/null +++ b/test/jdk/java/awt/Graphics2D/DrawImageIAETest/DrawImageIAETest.java @@ -0,0 +1,169 @@ +/* + * Copyright (c) 1999, 2024, 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 4191004 + * @summary Tests that no IllegalArgumentException is thrown when calling + * drawImage with certain conditions + * @key headful + */ + +import java.awt.AlphaComposite; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Image; +import java.awt.MediaTracker; +import java.awt.Toolkit; +import java.awt.geom.GeneralPath; +import java.awt.geom.Ellipse2D; +import java.awt.geom.Rectangle2D; +import java.awt.image.BufferedImage; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; +import javax.swing.JFrame; +import javax.swing.JPanel; + +public class DrawImageIAETest extends Frame { + + static String filename = "/duke.gif"; + private volatile Image dimg; + private volatile BufferedImage bimg; + static volatile DrawImageIAETest app; + static volatile JFrame jframe; + static volatile boolean passed = true; + static volatile Exception exception = null; + static volatile CountDownLatch imageLatch = new CountDownLatch(1); + + DrawImageIAETest(String title) { + super(title); + } + + public static void main(final String[] args) throws Exception { + EventQueue.invokeAndWait(DrawImageIAETest:: createUI); + imageLatch.await(3, TimeUnit.MILLISECONDS); + try { + if (!passed) { + throw new RuntimeException("Test FAILED: exception caught:" + exception); + } + } finally { + if (jframe != null) { + EventQueue.invokeAndWait(jframe::dispose); + } + if (app != null) { + EventQueue.invokeAndWait(app::dispose); + } + } + } + + static void createUI() { + app = new DrawImageIAETest("DrawImageIAETest"); + app.setLayout (new BorderLayout()); + app.setSize(200,200); + app.setLocationRelativeTo(null); + app.setVisible(true); + + String file; + try { + String dir = System.getProperty("test.src", + System.getProperty("user.dir")); + file = dir + filename; + } catch (Exception e) { + file = "." + filename; + } + + Image textureAlphaSource = null; + MediaTracker tracker = new MediaTracker(app); + app.dimg = Toolkit.getDefaultToolkit().getImage(file); + tracker.addImage(app.dimg, 1); + try { + tracker.waitForAll(); + imageLatch.countDown(); + } catch (Exception e) { + System.err.println("Can't load images"); + } + + if (app.dimg == null) { + passed = false; + return; + } + + jframe = new JFrame("Test DrawImageIAETest"); + jframe.setSize(300, 300); + JPanel jpanel; + jframe.getContentPane().add("Center", jpanel = new JPanel() { + public void paint(Graphics _g) { + Graphics2D g = (Graphics2D)_g; + Dimension d = getSize(); + Graphics2D g2 = app.createGraphics2D(d.width, d.height); + app.drawDemo(d.width, d.height, g2); + g2.dispose(); + g.drawImage(app.bimg, 0, 0, app); + } + }); + jpanel.setSize(140, 140); + jframe.setVisible(true); + } + + public void drawDemo(int w, int h, Graphics2D g2) { + GeneralPath p1 = new GeneralPath(); + GeneralPath p2 = new GeneralPath(); + + int dukeX = 73; + int dukeY = 26; + + double x = 118; + double y = 17; + double ew = 50; + double eh = 48; + + p1.append(new Ellipse2D.Double(x, y, ew, eh), false); + p2.append(new Rectangle2D.Double(x+5, y+5, ew-10, eh-10),false); + + g2.setClip(p1); + g2.clip(p2); + try { + g2.drawImage(dimg, dukeX, dukeY, null); + } catch (IllegalArgumentException e) { + passed = false; + exception = e; + } + } + + public Graphics2D createGraphics2D(int w, int h) { + Graphics2D g2 = null; + if (bimg == null || bimg.getWidth() != w || bimg.getHeight() != h) { + bimg = (BufferedImage) createImage(w, h); + } + g2 = bimg.createGraphics(); + g2.setBackground(getBackground()); + g2.clearRect(0, 0, w, h); + g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.5f)); + return g2; + } +} diff --git a/test/jdk/java/awt/Graphics2D/DrawImageIAETest/duke.gif b/test/jdk/java/awt/Graphics2D/DrawImageIAETest/duke.gif new file mode 100644 index 000000000000..ed32e0ff79b0 Binary files /dev/null and b/test/jdk/java/awt/Graphics2D/DrawImageIAETest/duke.gif differ diff --git a/test/jdk/java/awt/Graphics2D/ImageRendering/ImageRendering.java b/test/jdk/java/awt/Graphics2D/ImageRendering/ImageRendering.java new file mode 100644 index 000000000000..209a93e92d50 --- /dev/null +++ b/test/jdk/java/awt/Graphics2D/ImageRendering/ImageRendering.java @@ -0,0 +1,66 @@ +/* + * Copyright (c) 1999, 2024, 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 4203598 + * @summary This test verifies that an image with transparent background can be displayed + * correctly with the red background color given. + * The correct display should be the sleeping Duke on a red background. + * + */ + +import java.awt.Color; +import java.awt.Graphics2D; +import java.awt.image.BufferedImage; +import java.io.File; +import javax.imageio.ImageIO; + +public class ImageRendering { + + public static void main(String[] args) throws Exception { + + String imgName = "snooze.gif"; + File file = new File(System.getProperty("test.src", "."), imgName); + BufferedImage image = ImageIO.read(file); + int w = image.getWidth(); + int h = image.getHeight(); + BufferedImage dest = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB); + Graphics2D g2d = dest.createGraphics(); + g2d.drawImage(image, 0, 0, Color.red, null); + int redPixel = Color.red.getRGB(); + for (int y = 0; y < h; y++) { + for (int x = 0; x < w; x++) { + int srcPixel = image.getRGB(x, y); + if ((srcPixel & 0x0ff000000) == 0) { + int destPix = dest.getRGB(x, y); + if (destPix != redPixel) { + throw new RuntimeException("Not red at x=" + x + + " y=" + y + + "pix = " + Integer.toHexString(destPix)); + } + } + } + } + } +} diff --git a/test/jdk/java/awt/Graphics2D/ImageRendering/snooze.gif b/test/jdk/java/awt/Graphics2D/ImageRendering/snooze.gif new file mode 100644 index 000000000000..e357e316cdbe Binary files /dev/null and b/test/jdk/java/awt/Graphics2D/ImageRendering/snooze.gif differ diff --git a/test/jdk/java/awt/Graphics2D/ScaledThinLineTest.java b/test/jdk/java/awt/Graphics2D/ScaledThinLineTest.java new file mode 100644 index 000000000000..fd4a5dd5e7ca --- /dev/null +++ b/test/jdk/java/awt/Graphics2D/ScaledThinLineTest.java @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2001, 2024, 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 4210466 4417756 + * @summary thin lines are not draw correctly under large scales + */ +import java.awt.BasicStroke; +import java.awt.Color; +import java.awt.Graphics2D; +import java.awt.Shape; +import java.awt.image.BufferedImage; +import java.awt.geom.Ellipse2D; + +public class ScaledThinLineTest { + + public static void main(String[] args) { + ScaledThinLineTest c1 = new ScaledThinLineTest(200, 200); + ScaledThinLineTest c2 = new ScaledThinLineTest(1, 10000); + ScaledThinLineTest c3 = new ScaledThinLineTest(10000, 1); + ScaledThinLineTest c4 = new ScaledThinLineTest(0.01, 10000); + ScaledThinLineTest c5 = new ScaledThinLineTest(10000, 0.01); + compare(c1.bi, c2.bi); + compare(c2.bi, c3.bi); + compare(c3.bi, c4.bi); + compare(c4.bi, c5.bi); + } + + private final Shape shape; + private final double scaleX,scaleY; + private BufferedImage bi = null; + + public ScaledThinLineTest(double width, double height) { + shape = new Ellipse2D.Double(0.25*width, 0.25*height, width, height); + scaleX = 200/width; + scaleY = 200/height; + int iw = 300, ih = 300; + bi = new BufferedImage(iw, ih, BufferedImage.TYPE_INT_RGB); + Graphics2D g2 = bi.createGraphics(); + g2.setColor(Color.white); + g2.fillRect(0, 0, iw, ih); + g2.setColor(Color.black); + g2.scale(scaleX,scaleY); + g2.setStroke(new BasicStroke(0)); + g2.draw(shape); + } + + + static void compare(BufferedImage i1, BufferedImage i2) { + int w = i1.getWidth(), h = i1.getHeight(); + for (int y = 0; y < h; y++) { + for (int x = 0; x < w; x++) { + int p1 = i1.getRGB(x, y); + int p2 = i2.getRGB(x, y); + if (p1 != p2) { + System.out.println("images differ at " + x + " " + y); + } + } + } + } +} diff --git a/test/jdk/java/awt/Graphics2D/TextPerf.java b/test/jdk/java/awt/Graphics2D/TextPerf.java new file mode 100644 index 000000000000..d3e5cc2d4d0d --- /dev/null +++ b/test/jdk/java/awt/Graphics2D/TextPerf.java @@ -0,0 +1,159 @@ +/* + * Copyright (c) 1999, 2024, 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 4190429 + * @key headful + * @summary In this bug, text drawing performance should be reasonable. + * And should (per string) be consistent with the size of the + * rectangle in which the string is drawn, not the rectangle + * bounding the whole window. + */ + +import java.awt.BorderLayout; +import java.awt.Canvas; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.EventQueue; +import java.awt.Font; +import java.awt.FontMetrics; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Panel; +import java.awt.RenderingHints; +import java.awt.Toolkit; +import java.awt.font.GlyphVector; +import java.awt.geom.AffineTransform; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; + +public class TextPerf extends Canvas { + + static volatile CountDownLatch paintLatch = new CountDownLatch(1); + static volatile long paintTime = 5000; // causes test fail if it is not updated. + static volatile Frame frame; + + public static void main(String[] args) throws Exception { + EventQueue.invokeAndWait(TextPerf::createUI); + paintLatch.await(5, TimeUnit.SECONDS); + if (paintTime > 2000) { + throw new RuntimeException("Paint time is " + paintTime + "ms"); + } + if (frame != null) { + EventQueue.invokeAndWait(frame::dispose); + } + } + + static void createUI() { + frame = new Frame("TextPerf"); + frame.setLayout(new BorderLayout()); + TextPerf tp = new TextPerf(); + frame.add(tp, BorderLayout.CENTER); + frame.pack(); + frame.setVisible(true); + } + + public Dimension getPreferredSize() { + Dimension d = Toolkit.getDefaultToolkit().getScreenSize(); + return new Dimension(d.width - 50, d.height - 50); + } + + static Font[] fonts = { + new Font(Font.SERIF, Font.PLAIN, 10), + new Font(Font.SANS_SERIF, Font.PLAIN, 10), + new Font(Font.MONOSPACED, Font.ITALIC, 10), + new Font(Font.SERIF, Font.PLAIN, 14), + new Font(Font.SERIF, Font.BOLD, 12), + }; + + public void paint(Graphics g1) { + + Graphics2D g = (Graphics2D)g1; + String text = "Hello,_Wgjpqy!"; + Toolkit.getDefaultToolkit().sync(); + long startTime = System.currentTimeMillis(); + FontMetrics[] cachedMetrics = new FontMetrics[fonts.length]; + Dimension size = getSize(); + int prim = 0; + int spaceWidth = 5; + Color cols[] = { Color.red, Color.blue, Color.yellow, + Color.green, Color.pink, Color.orange} ; + + for (int y = 20; y < size.height; y += 20) { + int i = 0; + for (int x = 0; x < size.width; i++) { + Font font = fonts[i % fonts.length]; + FontMetrics metrics = cachedMetrics[i % fonts.length]; + if (metrics == null) { + metrics = g.getFontMetrics(font); + cachedMetrics[i % fonts.length] = metrics; + } + + g.setFont(font); + g.setColor(cols[i % cols.length]); + switch (prim++) { + case 0: g.drawString(text, x, y); + break; + case 1: g.drawBytes(text.getBytes(), 0, text.length(), x, y); + break; + case 2: char[] chs= new char[text.length()]; + text.getChars(0,text.length(), chs, 0); + g.drawChars(chs, 0, text.length(), x, y); + break; + case 3: GlyphVector gv = font.createGlyphVector( + g.getFontRenderContext(), text); + g.drawGlyphVector(gv, (float)x, (float)y); + default: prim = 0; + } + + x += metrics.stringWidth(text) + spaceWidth; + } + } + + // Draw some transformed text to verify correct bounds calculated + AffineTransform at = AffineTransform.getTranslateInstance(50, 50); + at.scale(7.0,7.0); + at.rotate(1.0); + g.transform(at); + g.setColor(Color.black); + Font font = new Font(Font.SERIF, Font.PLAIN, 20); + RenderingHints hints = new RenderingHints(null); + hints.put(RenderingHints.KEY_ANTIALIASING, + RenderingHints.VALUE_ANTIALIAS_ON); + g.setRenderingHints(hints); + g.setFont(font); + FontMetrics metrics = g.getFontMetrics(font); + g.drawString("Java", 5,5); + + Toolkit.getDefaultToolkit().sync(); + long endTime = System.currentTimeMillis(); + paintTime = endTime - startTime; + String msg = "repainted in " + paintTime + " milliseconds"; + System.out.println(msg); + System.out.flush(); + + paintLatch.countDown(); + } +} diff --git a/test/jdk/java/awt/GraphicsEnvironment/DefaultScreenDeviceTest.java b/test/jdk/java/awt/GraphicsEnvironment/DefaultScreenDeviceTest.java new file mode 100644 index 000000000000..b59460322daf --- /dev/null +++ b/test/jdk/java/awt/GraphicsEnvironment/DefaultScreenDeviceTest.java @@ -0,0 +1,116 @@ +/* + * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.BorderLayout; +import java.awt.Button; +import java.awt.Color; +import java.awt.Frame; +import java.awt.GraphicsConfiguration; +import java.awt.GraphicsDevice; +import java.awt.GraphicsEnvironment; +import java.awt.Label; +import java.awt.Rectangle; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.util.List; + +/* + * @test + * @bug 4473671 + * @summary Test to verify GraphicsEnvironment.getDefaultScreenDevice always + * returning first screen + * @requires (os.family == "windows") + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual DefaultScreenDeviceTest + */ + +public class DefaultScreenDeviceTest { + private static Frame testFrame; + + public static void main(String[] args) throws Exception { + GraphicsEnvironment ge = GraphicsEnvironment. + getLocalGraphicsEnvironment(); + GraphicsDevice[] gds = ge.getScreenDevices(); + if (gds.length < 2) { + System.out.println("Test requires at least 2 displays"); + return; + } + + String INSTRUCTIONS = """ + 1. The test is for systems which allows primary display + selection in multiscreen systems. + Set the system primary screen to be the rightmost + (i.e. the right screen in two screen configuration) + This can be done by going to OS Display Settings + selecting the screen and checking the 'Use this device + as primary monitor' checkbox. + 2. When done, click on 'Frame on Primary Screen' button and + see where the frame will pop up + 3. If Primary Frame pops up on the primary display, + the test passed, otherwise it failed + """; + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(35) + .testUI(initialize()) + .build() + .awaitAndCheck(); + } + + private static List initialize() { + Frame frame = new Frame("Default screen device test"); + GraphicsConfiguration gc = + GraphicsEnvironment.getLocalGraphicsEnvironment(). + getDefaultScreenDevice().getDefaultConfiguration(); + + testFrame = new Frame("Primary screen frame", gc); + frame.setLayout(new BorderLayout()); + frame.setSize(200, 200); + + Button b = new Button("Frame on Primary Screen"); + b.addActionListener(e -> { + if (testFrame != null) { + testFrame.setVisible(false); + testFrame.dispose(); + } + + testFrame.addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent e1) { + testFrame.setVisible(false); + testFrame.dispose(); + } + }); + testFrame.add(new Label("This frame should be on the primary screen")); + testFrame.setBackground(Color.red); + testFrame.pack(); + Rectangle rect = gc.getBounds(); + testFrame.setLocation(rect.x + 100, rect.y + 100); + testFrame.setVisible(true); + }); + frame.add(b); + return List.of(testFrame, frame); + } +} diff --git a/test/jdk/java/awt/JAWT/myfile.cpp b/test/jdk/java/awt/JAWT/myfile.cpp index 6157e2934ebf..80f51f951a90 100644 --- a/test/jdk/java/awt/JAWT/myfile.cpp +++ b/test/jdk/java/awt/JAWT/myfile.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2024, 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 @@ -52,8 +52,8 @@ JNIEXPORT void JNICALL Java_MyCanvas_paint /* Get the drawing surface */ JAWT_DrawingSurface* ds = awt.GetDrawingSurface(env, canvas); - if (ds == NULL) { - printf("NULL drawing surface\n"); + if (ds == nullptr) { + printf("null drawing surface\n"); return; } @@ -67,7 +67,7 @@ JNIEXPORT void JNICALL Java_MyCanvas_paint /* Get the drawing surface info */ JAWT_DrawingSurfaceInfo* dsi = ds->GetDrawingSurfaceInfo(ds); - if (dsi == NULL) { + if (dsi == nullptr) { printf("Error getting surface info\n"); ds->Unlock(ds); return; diff --git a/test/jdk/java/awt/LightweightComponent/LWParentMovedTest/LWParentMovedTest.java b/test/jdk/java/awt/LightweightComponent/LWParentMovedTest/LWParentMovedTest.java new file mode 100644 index 000000000000..d46af3a0d5e5 --- /dev/null +++ b/test/jdk/java/awt/LightweightComponent/LWParentMovedTest/LWParentMovedTest.java @@ -0,0 +1,99 @@ +/* + * Copyright (c) 1999, 2024, 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 4147246 + * @summary Simple check for peer != null in Component.componentMoved + * @key headful + * @run main LWParentMovedTest + */ + +import java.awt.Button; +import java.awt.Color; +import java.awt.Container; +import java.awt.EventQueue; +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.Graphics; + +public class LWParentMovedTest { + static CMTFrame f; + + // test will throw an exception and fail if lwc is null + public static void main(String[] args) throws Exception { + try { + EventQueue.invokeAndWait(() -> f = new CMTFrame()); + } finally { + if (f != null) { + EventQueue.invokeAndWait(() -> f.dispose()); + } + } + } +} + +class CMTFrame extends Frame { + Container lwc; + Button button; + + public CMTFrame() { + super("Moving LWC Test"); + setLayout(new FlowLayout()); + lwc = new LWSquare(Color.blue, 100, 100); + button = new Button(); + lwc.add(button); + add(lwc); + + setSize(400, 300); + setVisible(true); + + // queue up a bunch of COMPONENT_MOVED events + for (int i = 0; i < 1000; i++) { + lwc.setLocation(i, i); + } + + // remove heavyweight from lightweight container + lwc.remove(button); + } +} + +// +// Lightweight container +// +class LWSquare extends Container { + int width; + int height; + + public LWSquare(Color color, int w, int h) { + setBackground(color); + setLayout(new FlowLayout()); + width = w; + height = h; + setName("LWSquare-" + color.toString()); + } + + public void paint(Graphics g) { + g.setColor(getBackground()); + g.fillRect(0, 0, 1000, 1000); + } +} diff --git a/test/jdk/java/awt/LightweightComponent/LightWeightTabFocus/LightWeightTabFocus.java b/test/jdk/java/awt/LightweightComponent/LightWeightTabFocus/LightWeightTabFocus.java new file mode 100644 index 000000000000..05889580fd42 --- /dev/null +++ b/test/jdk/java/awt/LightweightComponent/LightWeightTabFocus/LightWeightTabFocus.java @@ -0,0 +1,154 @@ +/* + * Copyright (c) 2001, 2024, 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 4095214 + * @summary Test change of focus on lightweights using the tab key + * @key headful + * @run main LightWeightTabFocus + */ + +import java.awt.Button; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.EventQueue; +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Point; +import java.awt.Robot; +import java.awt.event.FocusEvent; +import java.awt.event.FocusListener; +import java.awt.event.InputEvent; +import java.awt.event.KeyEvent; + +public class LightWeightTabFocus { + private static Frame f; + private static LightweightButton btn1; + private static Button btn2; + private static Robot robot; + private static volatile Point point; + private static Point loc; + + public static void main(String[] args) throws Exception { + robot = new Robot(); + robot.setAutoDelay(100); + try { + EventQueue.invokeAndWait(() -> createUI()); + robot.delay(1000); + EventQueue.invokeAndWait(() -> { + loc = f.getLocation(); + point = btn2.getLocation(); + }); + robot.mouseMove(loc.x + point.x, loc.y + point.y); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + // First TAB + robot.keyPress(KeyEvent.VK_TAB); + robot.keyRelease(KeyEvent.VK_TAB); + if (!btn1.hasFocus()) { + new RuntimeException("First tab failed"); + } + // Second TAB + robot.keyPress(KeyEvent.VK_TAB); + robot.keyRelease(KeyEvent.VK_TAB); + if (!btn2.hasFocus()) { + new RuntimeException("Second tab failed"); + } + // First SHIFT+TAB + robot.keyPress(KeyEvent.VK_SHIFT); + robot.keyPress(KeyEvent.VK_TAB); + robot.delay(100); + robot.keyRelease(KeyEvent.VK_TAB); + robot.keyRelease(KeyEvent.VK_SHIFT); + if (!btn1.hasFocus()) { + new RuntimeException("First shift+tab failed"); + } + // Second SHIFT+TAB + robot.keyPress(KeyEvent.VK_SHIFT); + robot.keyPress(KeyEvent.VK_TAB); + robot.delay(100); + robot.keyRelease(KeyEvent.VK_TAB); + robot.keyRelease(KeyEvent.VK_SHIFT); + if (!btn2.hasFocus()) { + new RuntimeException("Second shift+tab failed"); + } + + } catch (Exception e) { + e.printStackTrace(); + } finally { + EventQueue.invokeAndWait(() -> { + if (f != null) { + f.dispose(); + } + }); + } + } + + private static Frame createUI() { + f = new Frame("TAB Focus Change on LW Test"); + f.setLayout(new FlowLayout()); + btn1 = new LightweightButton(); + f.add(btn1); + btn2 = new Button("Click Me To start"); + f.add(btn2); + f.pack(); + f.setVisible(true); + return f; + } +} + +class LightweightButton extends Component implements FocusListener { + boolean focus; + LightweightButton() { + focus = false; + addFocusListener(this); + } + + public Dimension getPreferredSize() + { + return new Dimension(100, 100); + } + + public void focusGained(FocusEvent e) { + focus = true; + repaint(); + } + + public void focusLost(FocusEvent e) { + focus = false; + repaint(); + } + + public void paint(Graphics g) { + if (focus) { + g.drawString("Has Focus", 10, 20); + } else { + g.drawString("Not Focused", 10, 20); + } + } + + public boolean isFocusable() { + return true; + } +} diff --git a/test/jdk/java/awt/LightweightComponent/LightweightFontTest/LightweightFontTest.java b/test/jdk/java/awt/LightweightComponent/LightweightFontTest/LightweightFontTest.java new file mode 100644 index 000000000000..4fd90656d612 --- /dev/null +++ b/test/jdk/java/awt/LightweightComponent/LightweightFontTest/LightweightFontTest.java @@ -0,0 +1,182 @@ +/* + * Copyright (c) 1998, 2024, 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 4077709 4153989 + * @summary Lightweight component font settable test + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual LightweightFontTest + */ + +import java.awt.Button; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.Font; +import java.awt.FontMetrics; +import java.awt.Frame; +import java.awt.Graphics; + + +public class LightweightFontTest { + static Font desiredFont = null; + + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + [ There are 7 steps to this test ] + 1. The 2 bordered labels (Emacs vs. vi) should be in a LARGE font + (approximately 1/2 inch tall) + 2. The labels should not overlap. + 3. Each button should be large enough to contain the entire label. + 4. The labels should have red backgrounds + 5. The text in the left label should be blue and the right yellow + 6. Resize the window to make it much smaller and larger + 7. The buttons should never overlap, and they should be large + enough to contain the entire label. + (although the button may disappear if there is not enough + room in the window)" + """; + + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(35) + .testUI(LightweightFontTest::createUI) + .logArea(5) + .build() + .awaitAndCheck(); + } + + private static Frame createUI() { + Frame f = new Frame("Lightweight Font Test"); + f.setLayout(new FlowLayout()); + + desiredFont = new Font(Font.DIALOG, Font.PLAIN, 36); + Component component; + component = new BorderedLabel("Emacs or vi?"); + component.setFont(desiredFont); + component.setBackground(Color.red); + component.setForeground(Color.blue); + f.add(component); + component = new BorderedLabel("Vi or Emacs???"); + component.setFont(desiredFont); + component.setBackground(Color.red); + component.setForeground(Color.yellow); + f.add(component); + f.pack(); + return f; + } +} + +/** + * Lightweight component + */ +class BorderedLabel extends Component { + boolean superIsButton; + String labelString; + + BorderedLabel(String labelString) { + this.labelString = labelString; + + Component thisComponent = this; + superIsButton = (thisComponent instanceof Button); + if(superIsButton) { + ((Button)thisComponent).setLabel(labelString); + } + } + + public Dimension getMinimumSize() { + Dimension minSize = new Dimension(); + + if (superIsButton) { + minSize = super.getMinimumSize(); + } else { + + Graphics g = getGraphics(); + verifyFont(g); + FontMetrics metrics = g.getFontMetrics(); + + minSize.width = metrics.stringWidth(labelString) + 14; + minSize.height = metrics.getMaxAscent() + metrics.getMaxDescent() + 9; + + g.dispose(); + } + return minSize; + } + + public Dimension getPreferredSize() { + Dimension prefSize = new Dimension(); + if (superIsButton) { + prefSize = super.getPreferredSize(); + } else { + prefSize = getMinimumSize(); + } + return prefSize; + } + + public void paint(Graphics g) { + verifyFont(g); + super.paint(g); + if (superIsButton) { + return; + } + Dimension size = getSize(); + Color oldColor = g.getColor(); + + // draw border + g.setColor(getBackground()); + g.fill3DRect(0, 0, size.width, size.height, false); + g.fill3DRect(3, 3, size.width - 6, size.height - 6, true); + + // draw text + FontMetrics metrics = g.getFontMetrics(); + int centerX = size.width / 2; + int centerY = size.height / 2; + int textX = centerX - (metrics.stringWidth(labelString) / 2); + int textY = centerY + ((metrics.getMaxAscent() + + metrics.getMaxDescent()) / 2); + g.setColor(getForeground()); + g.drawString(labelString, textX, textY); + + g.setColor(oldColor); + } + + /** + * Verifies that the font is correct and prints a warning + * message and/or throws a RuntimeException if it is not. + */ + private void verifyFont(Graphics g) { + Font desiredFont = LightweightFontTest.desiredFont; + Font actualFont = g.getFont(); + if (!actualFont.equals(desiredFont)) { + PassFailJFrame.log("AWT BUG: FONT INFORMATION LOST!"); + PassFailJFrame.log(" Desired font: " + desiredFont); + PassFailJFrame.log(" Actual font: " + actualFont); + PassFailJFrame.forceFail(); + } + } +} diff --git a/test/jdk/java/awt/LightweightComponent/MultipleAddNotifyTest/MultipleAddNotifyTest.java b/test/jdk/java/awt/LightweightComponent/MultipleAddNotifyTest/MultipleAddNotifyTest.java new file mode 100644 index 000000000000..fbbc2ae61854 --- /dev/null +++ b/test/jdk/java/awt/LightweightComponent/MultipleAddNotifyTest/MultipleAddNotifyTest.java @@ -0,0 +1,118 @@ +/* + * Copyright (c) 1999, 2024, 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 4058400 + * @summary Tests that calling addNotify on a lightweight component more than + * once does not break event dispatching for that component. + * @key headful + * @run main MultipleAddNotifyTest + */ + +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.EventQueue; +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Robot; +import java.awt.event.InputEvent; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; + +public class MultipleAddNotifyTest { + static volatile boolean passFlag; + static volatile int posX; + static volatile int posY; + static Frame f; + static LightComponent l; + + public static void main(String[] args) throws Exception { + Robot r; + try { + r = new Robot(); + r.setAutoWaitForIdle(true); + passFlag = false; + + EventQueue.invokeAndWait(() -> { + f = new Frame("Multiple addNotify Test"); + l = new LightComponent(); + f.setLayout(new FlowLayout()); + l.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + System.out.println("Mouse Clicked"); + passFlag = true; + } + }); + f.add(l); + f.addNotify(); + f.addNotify(); + + if (!l.isVisible()) { + throw new RuntimeException("Test failed. LW Component " + + "not visible."); + } + f.setSize(200, 200); + f.setLocationRelativeTo(null); + f.setVisible(true); + }); + r.waitForIdle(); + r.delay(1000); + + EventQueue.invokeAndWait(() -> { + posX = f.getX() + l.getWidth() + (l.getWidth() / 2); + posY = f.getY() + l.getHeight(); + }); + + r.mouseMove(posX, posY); + r.delay(500); + + r.mousePress(InputEvent.BUTTON1_DOWN_MASK); + r.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + r.delay(500); + + if (!passFlag) { + throw new RuntimeException("Test failed. MouseClicked event " + + "not working properly."); + } + } finally { + EventQueue.invokeAndWait(() -> { + if (f != null) { + f.dispose(); + } + }); + } + } +} + +class LightComponent extends Component { + public void paint(Graphics g) { + setSize(100, 100); + Dimension d = getSize(); + g.setColor(Color.red); + g.fillRect(0, 0, d.width, d.height); + } +} diff --git a/test/jdk/java/awt/LightweightComponent/PopupTest/PopupTest.java b/test/jdk/java/awt/LightweightComponent/PopupTest/PopupTest.java new file mode 100644 index 000000000000..beae4b4d9042 --- /dev/null +++ b/test/jdk/java/awt/LightweightComponent/PopupTest/PopupTest.java @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2001, 2024, 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 4476083 + * @summary Disabled components do not receive MouseEvent in Popups + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual PopupTest + */ + +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Frame; + +import javax.swing.JButton; +import javax.swing.JLabel; +import javax.swing.JMenuItem; +import javax.swing.JPopupMenu; + +public class PopupTest { + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + PopupMenus should disappear when a disabled component is + clicked. + + Step 1. Pop down the popup menu by clicking on it. + Step 2. Click on the disabled component to make the menu + disappear. + + If the menu disappears when the disabled component is clicked, + the test passes, otherwise, the test fails. + """; + + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .columns(35) + .testUI(PopupTest::createUI) + .build() + .awaitAndCheck(); + } + + private static Frame createUI() { + Frame f = new Frame("Disabled Component in Popup Test"); + f.setLayout(new BorderLayout()); + + JButton b = new JButton("step 1: press me to display menu"); + b.addActionListener(e -> { + JPopupMenu m = new JPopupMenu(); + m.add(new JMenuItem("item 1")); + m.add(new JMenuItem("item 2")); + m.add(new JMenuItem("item 3")); + m.add(new JMenuItem("item 4")); + m.add(new JMenuItem("item 5")); + m.add(new JMenuItem("item 6")); + m.show((Component) e.getSource(), 0, 10); + }); + + JLabel disabled = new JLabel("step 2: click me. the menu should be " + + "dismissed"); + disabled.setEnabled(false); + + JLabel enabled = new JLabel("step 3: there is no step 3"); + + f.add(BorderLayout.NORTH, b); + f.add(BorderLayout.CENTER, disabled); + f.add(BorderLayout.SOUTH, enabled); + f.setSize(300, 200); + return f; + } +} diff --git a/test/jdk/java/awt/List/ActionEventWhenHitEnterTest.java b/test/jdk/java/awt/List/ActionEventWhenHitEnterTest.java new file mode 100644 index 000000000000..232189ef53bb --- /dev/null +++ b/test/jdk/java/awt/List/ActionEventWhenHitEnterTest.java @@ -0,0 +1,126 @@ +/* + * Copyright (c) 2002, 2024, 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 4234245 + * @summary the actionEvent is not invoked when hit enter on list. + * @key headful + * @run main ActionEventWhenHitEnterTest + */ + +import java.awt.BorderLayout; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.IllegalComponentStateException; +import java.awt.List; +import java.awt.Point; +import java.awt.Robot; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.InputEvent; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.awt.event.KeyEvent; + +public class ActionEventWhenHitEnterTest + implements ActionListener, ItemListener { + + volatile boolean passed1; + volatile boolean passed2; + volatile Point pt; + List list; + Frame frame; + + public static void main(final String[] args) throws Exception { + ActionEventWhenHitEnterTest app = new ActionEventWhenHitEnterTest(); + app.doTest(); + } + + public ActionEventWhenHitEnterTest() { + list = new List(7); + for (int i = 0; i < 10; i++) { + list.add("Item " + i); + } + list.addItemListener(this); + list.addActionListener(this); + } + + public void actionPerformed(ActionEvent ae) { + passed1 = true; + System.out.println("--> Action event invoked: " + ae.getSource()); + } + + public void itemStateChanged(ItemEvent ie) { + passed2 = true; + System.out.println("--> Item state changed:" + ie.getSource()); + } + + public void doTest() throws Exception { + EventQueue.invokeAndWait(() -> { + frame = new Frame("ActionEventWhenHitEnterTest"); + frame.add(list); + frame.setSize(200, 200); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + }); + + try { + Robot robot = new Robot(); + robot.setAutoDelay(100); + robot.waitForIdle(); + robot.delay(1000); + + EventQueue.invokeAndWait(() -> { + pt = list.getLocationOnScreen(); + }); + + if (pt.x != 0 || pt.y != 0) { + robot.mouseMove(pt.x + list.getWidth() / 2, + pt.y + list.getHeight() / 2); + robot.waitForIdle(); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + robot.waitForIdle(); + + robot.keyPress(KeyEvent.VK_ENTER); + robot.keyRelease(KeyEvent.VK_ENTER); + } + + robot.waitForIdle(); + } finally { + EventQueue.invokeAndWait(() -> { + if (frame != null) { + frame.dispose(); + } + }); + } + + if (!passed1 || !passed2) { + throw new RuntimeException("ActionEventWhenHitEnterTest FAILED"); + } + System.out.println("Test PASSED"); + + } + +} diff --git a/test/jdk/java/awt/List/DisabledListIsGreyTest.java b/test/jdk/java/awt/List/DisabledListIsGreyTest.java new file mode 100644 index 000000000000..ec1a25706660 --- /dev/null +++ b/test/jdk/java/awt/List/DisabledListIsGreyTest.java @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2006, 2024, 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 6354810 + * @summary Items in the list are not grayed out when disabled, XToolkit + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual DisabledListIsGreyTest +*/ + +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.List; + +public class DisabledListIsGreyTest { + + private static final String INSTRUCTIONS = """ + 1) After the test started you will see two lists. + 2) One of them is enabled, and the second is disabled. + 3) Check that the items of the disabled list are grayed. + 4) If so, the test passed. Otherwise, failed."""; + + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("DisabledListIsGreyTest Instructions") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(35) + .testUI(DisabledListIsGreyTest::createTestUI) + .build() + .awaitAndCheck(); + } + + private static Frame createTestUI() { + Frame frame = new Frame("DisabledListIsGreyTest Frame"); + frame.setLayout(new FlowLayout()); + + List list1 = new List(3); + List list2 = new List(3); + for (int i = 0; i < 5; i++) { + list1.addItem("Item " + i); + list2.addItem("Item " + i); + } + frame.add(list1); + + list2.setEnabled(false); + frame.add(list2); + frame.pack(); + return frame; + } + +} diff --git a/test/jdk/java/awt/List/HorizScrollWorkTest.java b/test/jdk/java/awt/List/HorizScrollWorkTest.java new file mode 100644 index 000000000000..6de1de1a4f26 --- /dev/null +++ b/test/jdk/java/awt/List/HorizScrollWorkTest.java @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2006, 2024, 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 6355467 + * @summary Horizontal scroll bar thumb of a List does not stay at the end + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @requires (os.family == "linux") + * @run main/manual HorizScrollWorkTest +*/ + +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.List; + +public class HorizScrollWorkTest { + + private static final String INSTRUCTIONS = """ + This is a linux only test. + Drag and drop the horizontal scroll bar thumb at the right end. + If the thumb does not stay at the right end, then the test failed. Otherwise passed."""; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("HorizScrollWorkTest Instructions") + .instructions(INSTRUCTIONS) + .rows((int)INSTRUCTIONS.lines().count() + 2) + .columns(35) + .testUI(HorizScrollWorkTest::createTestUI) + .build() + .awaitAndCheck(); + } + + private static Frame createTestUI() { + Frame frame = new Frame("HorizScrollWorkTest Frame"); + List list = new List(4); + + frame.setLayout (new FlowLayout()); + + list.add("veryyyyyyyyyyyyyyyyyyyyyyyyyy longgggggggggggggggggggggg stringggggggggggggggggggggg"); + + frame.add(list); + frame.pack(); + + return frame; + } +} diff --git a/test/jdk/java/awt/List/HorizScrollbarEraseTest.java b/test/jdk/java/awt/List/HorizScrollbarEraseTest.java new file mode 100644 index 000000000000..2601a7ed0b2e --- /dev/null +++ b/test/jdk/java/awt/List/HorizScrollbarEraseTest.java @@ -0,0 +1,139 @@ +/* + * Copyright (c) 2003, 2024, 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 4895367 + * @summary List scrolling w/ down arrow keys obscures horizontal scrollbar + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @requires (os.family == "linux") + * @run main/manual HorizScrollbarEraseTest + */ + +import java.awt.BorderLayout; +import java.awt.Button; +import java.awt.Frame; +import java.awt.GridLayout; +import java.awt.List; +import java.awt.Panel; +import java.awt.TextArea; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +public class HorizScrollbarEraseTest { + + private static final String INSTRUCTIONS = """ + This is a Unix-only test. + Do the four mini-tests below. + If the horizontal scrollbar is ever erased by a rectangle + of the background color, the test FAILS. + If the horizontal scrollbars remain painted, test passes."""; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("HorizScrollbarEraseTest Instructions") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(35) + .testUI(HorizScrollbarEraseTest::createTestUI) + .build() + .awaitAndCheck(); + } + + private static Frame createTestUI() { + Frame frame = new Frame("HorizScrollbarEraseTest"); + Panel borderPanel = new Panel(); + borderPanel.setLayout(new BorderLayout()); + Button focusedButton = new Button("Focus starts here"); + borderPanel.add(focusedButton, BorderLayout.NORTH); + + Panel gridPanel = new Panel(); + gridPanel.setLayout(new GridLayout(0, 4)); + borderPanel.add(gridPanel, BorderLayout.CENTER); + + InstructionList il1 = new InstructionList("Tab to Item 2, then \n" + + "press the down" + + "arrow key to scroll down"); + il1.list.select(2); + il1.list.makeVisible(0); + gridPanel.add(il1); + + InstructionList il2 = new InstructionList("Tab to the next List,\n" + + "then press the down\n" + + "arrow key to select\n" + + "the last item."); + il2.list.select(3); + il2.list.makeVisible(0); + gridPanel.add(il2); + + InstructionList il3 = new InstructionList("Click the button to\n" + + "programmatically\n" + + "select item 3 (not showing)"); + Button selectBtn = new Button("Click Me"); + final List selectList = il3.list; + selectBtn.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + selectList.select(3); + } + }); + il3.add(selectBtn, BorderLayout.CENTER); + gridPanel.add(il3); + + InstructionList il4 = new InstructionList("Click the button to\nprogrammatically\ndeselect item 3\n(not showing)"); + Button deselectBtn = new Button("Click Me"); + final List deselectList = il4.list; + deselectBtn.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + deselectList.deselect(3); + } + }); + il4.add(deselectBtn, BorderLayout.CENTER); + il4.list.select(3); + il4.list.makeVisible(0); + gridPanel.add(il4); + + frame.add(borderPanel); + frame.pack(); + return frame; + + } +} + +class InstructionList extends Panel { + TextArea ta; + public List list; + + public InstructionList(String instructions) { + super(); + setLayout(new BorderLayout()); + ta = new TextArea(instructions, 6, 25, TextArea.SCROLLBARS_NONE); + ta.setFocusable(false); + list = new List(); + for (int i = 0; i < 5; i++) { + list.add("Item " + i + ", a long, long, long, long item"); + } + add(ta, BorderLayout.NORTH); + add(list, BorderLayout.SOUTH); + } +} diff --git a/test/jdk/java/awt/List/ItemEventTest/ItemEventTest.java b/test/jdk/java/awt/List/ItemEventTest/ItemEventTest.java index c5d453799056..ea0f339c92b6 100644 --- a/test/jdk/java/awt/List/ItemEventTest/ItemEventTest.java +++ b/test/jdk/java/awt/List/ItemEventTest/ItemEventTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, 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,8 +27,13 @@ * @bug 8033936 8172510 * @summary Verify that correct ItemEvent is received while selection & * deselection of multi select List items. + * @library /test/lib + * @build jdk.test.lib.Platform + * @run main ItemEventTest */ +// Pass -save to the test to enable screenshots at each select/deselect + import java.awt.AWTException; import java.awt.Event; import java.awt.FlowLayout; @@ -37,26 +42,30 @@ import java.awt.Point; import java.awt.Rectangle; import java.awt.Robot; -import java.awt.event.KeyEvent; import java.awt.event.InputEvent; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; - -public class ItemEventTest extends Frame -{ - List list; - final String expectedSelectionOrder; - StringBuilder actualSelectionOrder; - Robot robot; - - public ItemEventTest() - { - try { - robot = new Robot(); - } catch(AWTException e) { - throw new RuntimeException(e.getMessage()); - } - expectedSelectionOrder = "01230123"; +import java.awt.event.KeyEvent; +import java.awt.image.RenderedImage; +import java.io.File; +import java.io.IOException; + +import javax.imageio.ImageIO; + +import jdk.test.lib.Platform; + +public final class ItemEventTest extends Frame { + private static final String expectedSelectionOrder = "01230123"; + + private static boolean saveScreenshots; + + private final StringBuffer actualSelectionOrder + = new StringBuffer(expectedSelectionOrder.length()); + + private final List list; + private final Robot robot; + + private ItemEventTest() throws AWTException { + robot = new Robot(); + robot.setAutoWaitForIdle(true); list = new List(4, true); list.add("0"); @@ -65,71 +74,76 @@ public ItemEventTest() list.add("3"); add(list); + setSize(400,400); setLayout(new FlowLayout()); pack(); + setLocationRelativeTo(null); setVisible(true); robot.waitForIdle(); } @Override + @SuppressWarnings("deprecation") public boolean handleEvent(Event e) { - if (e.target instanceof List) { - if (e.id == Event.LIST_DESELECT || e.id == Event.LIST_SELECT) { - actualSelectionOrder.append(e.arg); - } + if ((e.target instanceof List) + && (e.id == Event.LIST_DESELECT + || e.id == Event.LIST_SELECT)) { + logEvent("handleEvent: ", e.arg); } return true; } - void testHandleEvent() { + private void logEvent(String method, Object listItem) { + actualSelectionOrder.append(listItem); + System.out.println(method + listItem); + } + + private void testHandleEvent() { // When no ItemListener is added to List, parent's handleEvent is // called with ItemEvent. performTest(); } - void testItemListener() { - list.addItemListener(new ItemListener() { - @Override - public void itemStateChanged(ItemEvent ie) { - actualSelectionOrder.append(ie.getItem()); - } - }); + private void testItemListener() { + list.addItemListener(ie + -> logEvent("testItemListener: ", ie.getItem())); performTest(); } - void performTest() { - actualSelectionOrder = new StringBuilder(); - Point loc = list.getLocationOnScreen(); - Rectangle rect = list.getBounds(); - int dY = rect.height / list.getItemCount(); - loc = new Point(loc.x + 10, loc.y + 5); + private void performTest() { + actualSelectionOrder.setLength(0); + + final Rectangle rect = getListBoundsOnScreen(); + final int dY = rect.height / list.getItemCount(); + final Point loc = new Point(rect.x + rect.width / 2, + rect.y + dY / 2); - String osName = System.getProperty("os.name"); - boolean isMac = osName.contains("Mac") || osName.contains("mac"); - if(isMac) { + if (Platform.isOSX()) { robot.keyPress(KeyEvent.VK_META); - robot.waitForIdle(); } // First loop to select & Second loop to deselect the list items. for (int j = 0; j < 2; ++j) { for (int i = 0; i < list.getItemCount(); ++i) { robot.mouseMove(loc.x, loc.y + i * dY); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); robot.waitForIdle(); - robot.mousePress(InputEvent.BUTTON1_MASK); - robot.waitForIdle(); - robot.mouseRelease(InputEvent.BUTTON1_MASK); - robot.waitForIdle(); + + if (saveScreenshots) { + saveImage(robot.createScreenCapture(rect)); + } } } - if(isMac) { + if (Platform.isOSX()) { robot.keyRelease(KeyEvent.VK_META); } - if (!expectedSelectionOrder.equals(actualSelectionOrder.toString())) { - dispose(); + if (!expectedSelectionOrder.contentEquals(actualSelectionOrder)) { + saveImage(robot.createScreenCapture(rect)); + throw new RuntimeException("ItemEvent for selection & deselection" + " of multi select List's item is not correct" + " Expected : " + expectedSelectionOrder @@ -137,10 +151,32 @@ void performTest() { } } - public static void main(String args[]) { - ItemEventTest test = new ItemEventTest(); - test.testHandleEvent(); - test.testItemListener(); - test.dispose(); + private Rectangle getListBoundsOnScreen() { + return new Rectangle(list.getLocationOnScreen(), + list.getSize()); + } + + private static int imageNo = 0; + + private static void saveImage(RenderedImage image) { + try { + ImageIO.write(image, + "png", + new File(String.format("image-%02d.png", + ++imageNo))); + } catch (IOException ignored) { + } + } + + public static void main(String[] args) throws AWTException { + saveScreenshots = args.length > 0 && "-save".equals(args[0]); + + ItemEventTest test = new ItemEventTest(); + try { + test.testHandleEvent(); + test.testItemListener(); + } finally { + test.dispose(); + } } } diff --git a/test/jdk/java/awt/List/ListAddPerfTest.java b/test/jdk/java/awt/List/ListAddPerfTest.java new file mode 100644 index 000000000000..7ff3eaf882c6 --- /dev/null +++ b/test/jdk/java/awt/List/ListAddPerfTest.java @@ -0,0 +1,99 @@ +/* + * Copyright (c) 1999, 2024, 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 4117288 + * @summary JDKversion1.2beta3-J List's add() method is much slower. + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual ListAddPerfTest + */ + +import java.awt.BorderLayout; +import java.awt.Button; +import java.awt.Frame; +import java.awt.List; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +public class ListAddPerfTest { + + static Button button; + static List list; + + private static final String INSTRUCTIONS = """ + It is used to check the performance of List add operation. + + Instructions: + Click on the Remove All button. + The list should be cleared. + The button is now named "Add Items". + Click on the "Add Items" button. + 800 items should be added to the list. + Notice not only how fast or slow this is, but also how + 'smooth' it goes as well i.e. without any flashing. + + Press pass if the list performance is acceptable."""; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("ListAddPerfTest Instructions") + .instructions(INSTRUCTIONS) + .rows((int)INSTRUCTIONS.lines().count() + 2) + .columns(35) + .testUI(ListAddPerfTest::createTestUI) + .build() + .awaitAndCheck(); + } + + private static Frame createTestUI() { + Frame frame = new Frame("ListAddPerfTest"); + frame.setLayout(new BorderLayout()); + + button = new Button("Remove All"); + button.addActionListener((ActionEvent e) -> { + if (list.getItemCount() > 0) { + list.removeAll(); + list.invalidate(); + button.setLabel("Add Items"); + } else { + for (int i = 0; i < 800; i ++) { + list.add("My number is " + i); + } + button.setLabel("Remove All"); + } + }); + + list = new List(15); + for (int i = 0; i < 800; i ++) { + list.add("My number is " + i); + } + + frame.add("North", button); + frame.add("South", list); + + frame.pack(); + return frame; + } +} diff --git a/test/jdk/java/awt/List/ListFrameResizeTest.java b/test/jdk/java/awt/List/ListFrameResizeTest.java new file mode 100644 index 000000000000..4655e817da58 --- /dev/null +++ b/test/jdk/java/awt/List/ListFrameResizeTest.java @@ -0,0 +1,104 @@ +/* + * Copyright (c) 2000, 2024, 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 4085379 + * @summary List component not properly "resized" with GridBagLayout + * @requires (os.family == "windows") + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual ListFrameResizeTest + */ + +import java.awt.Color; +import java.awt.Frame; +import java.awt.GridBagConstraints; +import java.awt.GridBagLayout; +import java.awt.Insets; +import java.awt.List; + +public class ListFrameResizeTest { + + private static final String INSTRUCTIONS = """ + This test is for windows only. + + 1. A Frame will appear with a List + (the List occupies the whole Frame) + 2. Minimize the Frame, the Frame is now in the Task Bar (ie.,iconified) + 3. Right click (right mouse button) the icon in the task bar + and click on the 'maximize' menuitem to maximize the Frame + 4. If you notice the List has not been resized + (ie.,if it partly occupies the Frame), then press FAIL else press PASS"."""; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("ListFrameResizeTest Instructions") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(35) + .testUI(ListFrameResizeTest::createTestUI) + .build() + .awaitAndCheck(); + } + + private static Frame createTestUI() { + wintest client = new wintest("ListFrameResizeTest Frame"); + client.resize(500, 300); + client.setBackground(Color.blue); + return client; + } + +} + +class wintest extends Frame { + private List msg; + + public wintest(String title) { + super(title); + msg = new List(); + for (int i = 0; i < 100; i++) { + msg.add("" + i); + } + + GridBagLayout gridbag = new GridBagLayout(); + GridBagConstraints constraints = new GridBagConstraints(); + + setLayout(gridbag); + + constraints.fill = GridBagConstraints.BOTH; + + constraints.anchor = GridBagConstraints.CENTER; + constraints.insets = new Insets(10, 10, 10, 10); + constraints.ipadx = 0; + constraints.ipady = 0; + constraints.weightx = 1; + constraints.weighty = 1; + constraints.gridx = 0; + constraints.gridy = 0; + constraints.gridwidth = GridBagConstraints.REMAINDER; + constraints.gridheight = GridBagConstraints.REMAINDER; + gridbag.setConstraints(msg, constraints); + add(msg); + } +} diff --git a/test/jdk/java/awt/List/MouseDraggedOriginatedByScrollBarTest.java b/test/jdk/java/awt/List/MouseDraggedOriginatedByScrollBarTest.java new file mode 100644 index 000000000000..600d38fe3938 --- /dev/null +++ b/test/jdk/java/awt/List/MouseDraggedOriginatedByScrollBarTest.java @@ -0,0 +1,103 @@ +/* + * Copyright (c) 2005, 2024, 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 6240151 + * @summary XToolkit: Dragging the List scrollbar initiates DnD + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual MouseDraggedOriginatedByScrollBarTest +*/ + +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.List; +import java.awt.event.MouseMotionAdapter; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; + +public class MouseDraggedOriginatedByScrollBarTest { + + private static final String INSTRUCTIONS = """ + 1) Click and drag the scrollbar of the list. + 2) Keep dragging till the mouse pointer goes out the scrollbar. + 3) The test failed if you see messages about events. The test passed if you don't."""; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("MouseDraggedOriginatedByScrollBarTest Instructions") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(35) + .testUI(MouseDraggedOriginatedByScrollBarTest::createTestUI) + .logArea() + .build() + .awaitAndCheck(); + } + + private static Frame createTestUI() { + Frame frame = new Frame(); + List list = new List(4, false); + + list.add("000"); + list.add("111"); + list.add("222"); + list.add("333"); + list.add("444"); + list.add("555"); + list.add("666"); + list.add("777"); + list.add("888"); + list.add("999"); + + frame.add(list); + + list.addMouseMotionListener( + new MouseMotionAdapter(){ + @Override + public void mouseDragged(MouseEvent me){ + PassFailJFrame.log(me.toString()); + } + }); + + list.addMouseListener( + new MouseAdapter() { + public void mousePressed(MouseEvent me) { + PassFailJFrame.log(me.toString()); + } + + public void mouseReleased(MouseEvent me) { + PassFailJFrame.log(me.toString()); + } + + public void mouseClicked(MouseEvent me){ + PassFailJFrame.log(me.toString()); + } + }); + + frame.setLayout(new FlowLayout()); + frame.pack(); + return frame; + } +} diff --git a/test/jdk/java/awt/List/MultiSelectionListCrashTest.java b/test/jdk/java/awt/List/MultiSelectionListCrashTest.java new file mode 100644 index 000000000000..b408a12ebbac --- /dev/null +++ b/test/jdk/java/awt/List/MultiSelectionListCrashTest.java @@ -0,0 +1,89 @@ +/* + * Copyright (c) 1999, 2024, 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 4201967 + * @summary tests that a multiselection list doesn't causes crash when FileDialog is invoked + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual MultiSelectionListCrashTest + */ + +import java.awt.Button; +import java.awt.FileDialog; +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.List; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +public class MultiSelectionListCrashTest { + + private static final String INSTRUCTIONS = """ + Press "Invoke dialog" button to invoke a FileDialog. + When it appears close it by pressing cancel button. + If all remaining frames are enabled and + page fault didn't occur the test passed. Otherwise the test failed. + + Try to invoke a FileDialog several times to verify that the bug doesn't exist."""; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("MultiSelectionListCrashTest Instructions") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(35) + .testUI(MultiSelectionListCrashTest::createTestUI) + .build() + .awaitAndCheck(); + } + + private static Frame createTestUI() { + + Frame frame = new Frame("MultiSelectionListCrashTest frame"); + Button button = new Button("Invoke dialog"); + button.addActionListener(new FileDialogInvoker(frame)); + List list = new List(4, true); + list.add("Item1"); + list.add("Item2"); + frame.setLayout(new FlowLayout()); + frame.add(button); + frame.add(list); + frame.setSize(200, 200); + return frame; + } +} + +class FileDialogInvoker implements ActionListener { + FileDialog fileDialog; + + public FileDialogInvoker(Frame frame) { + fileDialog = new FileDialog(frame); + } + + public void actionPerformed(ActionEvent e) { + fileDialog.setVisible(true); + } + +} diff --git a/test/jdk/java/awt/List/ScrollbarPositionTest.java b/test/jdk/java/awt/List/ScrollbarPositionTest.java new file mode 100644 index 000000000000..25167fa56278 --- /dev/null +++ b/test/jdk/java/awt/List/ScrollbarPositionTest.java @@ -0,0 +1,104 @@ +/* + * Copyright (c) 1998, 2024, 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 4024943 + * @summary Test for position of List scrollbar when it is added + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual ScrollbarPositionTest + */ + +import java.awt.Button; +import java.awt.Frame; +import java.awt.GridLayout; +import java.awt.List; +import java.awt.Panel; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +public class ScrollbarPositionTest { + static int item = 0; + static List list; + static Button addButton, delButton; + + private static final String INSTRUCTIONS = """ + Click on the "Add List Item" button many times + until the vertical scrollbar appears. + Verify that the displayed vertical scrollbar does not take the space + that was occupied by buttons before the scrollbar is shown."""; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("ScrollbarPositionTest Instructions") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(35) + .testUI(ScrollbarPositionTest::createTestUI) + .build() + .awaitAndCheck(); + } + + private static Frame createTestUI() { + Panel pan; + + Frame frame = new Frame("ScrollbarPositionTest Frame"); + frame.setLayout(new GridLayout(1, 2)); + list = new List(); + frame.add(list); + frame.add(pan = new Panel()); + pan.setLayout(new GridLayout(4, 1)); + + MyListener listener = new MyListener(); + addButton = new Button("Add List Item"); + addButton.addActionListener(listener); + pan.add(addButton); + + delButton = new Button("Delete List Item"); + delButton.addActionListener(listener); + pan.add(delButton); + + frame.pack(); + return frame; + } + + static class MyListener implements ActionListener { + public void actionPerformed(ActionEvent evt) { + if (evt.getSource() == addButton) { + String s = "item"; + for (int i = 0; i <= item; i++) { + s = s +" "+Integer.toString(i); + } + item++; + list.addItem(s); + } else if (evt.getSource() == delButton) { + int i; + if ((i = list.countItems()) > 0) { + list.delItem(i - 1); + --item; + } + } + } + } +} diff --git a/test/jdk/java/awt/List/ScrollbarPresenceTest.java b/test/jdk/java/awt/List/ScrollbarPresenceTest.java new file mode 100644 index 000000000000..d82cbb80060c --- /dev/null +++ b/test/jdk/java/awt/List/ScrollbarPresenceTest.java @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2006, 2024, 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 6336384 + * @summary ScrollBar does not show up correctly + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual ScrollbarPresenceTest +*/ + +import java.awt.Font; +import java.awt.Frame; +import java.awt.List; + +public class ScrollbarPresenceTest { + + private static final String INSTRUCTIONS = """ + You will see a list, + If a vertical scrollbar appears on the list and the list is big enough + to show all items then the test failed else the test passed."""; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("ScrollbarPresenceTest Instructions") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(35) + .testUI(ScrollbarPresenceTest::createTestUI) + .build() + .awaitAndCheck(); + } + + private static Frame createTestUI() { + Frame frame = new Frame("ScrollbarPresenceTest Frame"); + List list = new List(); + + for (int i = 0; i < 6; i++) { + list.addItem("Row " + i); + } + + list.setFont(new Font("MonoSpaced", Font.PLAIN, 12)); + list.setBounds(30, 30, 128, 104); + frame.add(list); + + frame.pack(); + return frame; + } + +} diff --git a/test/jdk/java/awt/List/SelectedItemVisibilityTest.java b/test/jdk/java/awt/List/SelectedItemVisibilityTest.java new file mode 100644 index 000000000000..53364e937713 --- /dev/null +++ b/test/jdk/java/awt/List/SelectedItemVisibilityTest.java @@ -0,0 +1,128 @@ +/* + * Copyright (c) 2002, 2024, 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 4676536 + * @summary REGRESSION: makeVisible() method of List Component does not perform + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual SelectedItemVisibilityTest + */ + +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.Label; +import java.awt.List; + +public class SelectedItemVisibilityTest { + + static List list1, list2; + static int visibleItem = 4; + static int selectedItems[] = {6, 7, 8}; + static String selectedItemsStr = ""; + + static { + for (int i = 0 ; i < selectedItems.length ; i++) { + selectedItemsStr += ""+selectedItems[i]+" "; + } + } + + private static final String INSTRUCTIONS = + "You should see two lists.\n" + + "\n" + + "list1: \n" + + "\t1. the first visible item should be " + visibleItem + + "\n\t2. the selected item should be " + selectedItems[0] + + "\n" + + "list2:\n" + + "\t1. the first visible item should be " + visibleItem + + "\n\t2. the selected items should be " + selectedItemsStr + + "\n" + + "\nIf it is so the test passed else failed."; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("SelectedItemVisibilityTest Instructions") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(35) + .testUI(SelectedItemVisibilityTest::createTestUI) + .logArea() + .build() + .awaitAndCheck(); + } + + private static Frame createTestUI() { + + Frame frame = new Frame("SelectedItemVisibilityTest Frame"); + frame.setLayout(new FlowLayout()); + + // list1 + list1 = new List(4); + for (int i = 0; i < 20; i++) { + list1.add(""+i); + } + list1.makeVisible(visibleItem); + list1.select(selectedItems[0]); + frame.add(new Label("list1:")); + frame.add(list1); + + // list2 + list2 = new List(4); + list2.setMultipleMode(true); + for (int i = 0; i < 20; i++) { + list2.add(""+i); + } + list2.makeVisible(visibleItem); + for (int i = 0 ; i < selectedItems.length ; i++) { + list2.select(selectedItems[i]); + } + frame.add(new Label("list2:")); + frame.add(list2); + frame.setSize(200, 200); + + // common output + String s; + int sel[]; + + PassFailJFrame.log("list1: "); + PassFailJFrame.log("\tgetVisibleIndex="+list1.getVisibleIndex()); + sel = list1.getSelectedIndexes(); + s = "\tgetSelectedIndexes="; + for (int i = 0 ; i < sel.length ; i++) { + s += "" + sel[i] + " "; + } + PassFailJFrame.log(s); + + PassFailJFrame.log("list2: "); + PassFailJFrame.log("\tgetVisibleIndex="+list2.getVisibleIndex()); + sel = list2.getSelectedIndexes(); + s = "\tgetSelectedIndexes="; + for (int i = 0 ; i < sel.length ; i++) { + s += "" + sel[i] + " "; + } + PassFailJFrame.log(s); + return frame; + } +} diff --git a/test/jdk/java/awt/List/SetForegroundTest.java b/test/jdk/java/awt/List/SetForegroundTest.java new file mode 100644 index 000000000000..7b22e5385088 --- /dev/null +++ b/test/jdk/java/awt/List/SetForegroundTest.java @@ -0,0 +1,109 @@ +/* + * Copyright (c) 2005, 2024, 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 6246467 + * @summary Tests that list works correctly if user specified foreground colors on XToolkit/Motif + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual SetForegroundTest + */ + +import java.awt.Button; +import java.awt.Component; +import java.awt.Checkbox; +import java.awt.Choice; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.Label; +import java.awt.List; +import java.awt.Panel; +import java.awt.TextArea; +import java.awt.TextField; +import java.awt.ScrollPane; + +public class SetForegroundTest { + + private static final String INSTRUCTIONS = """ + To make sure, that for each component + (Button, Checkbox, Label, List, TextArea, TextField, Choice) + in the frame, + the title exist and the color of the title is red. + If not, the test failed."""; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("SetForegroundTest Instructions") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(35) + .testUI(SetForegroundTest::createTestUI) + .build() + .awaitAndCheck(); + } + + private static Frame createTestUI() { + Frame frame = new Frame(); + ScrollPane sp = new ScrollPane() { + public Dimension getPreferredSize() { + return new Dimension(180, 180); + } + }; + Panel p = new Panel(); + Component childs[] = new Component[] {new Button("button"), + new Checkbox("checkbox"), + new Label("label"), + new List(3, false), + new TextArea("text area"), + new TextField("text field"), + new Choice()}; + + p.setLayout (new FlowLayout ()); + + sp.add(p); + + sp.validate(); + + frame.add(sp); + for (int i = 0; i < childs.length; i++){ + childs[i].setForeground(Color.red); + } + + for (int i = 0; i < childs.length; i++) { + p.add(childs[i]); + if (childs[i] instanceof List) { + ((List)childs[i]).add("list1"); + ((List)childs[i]).add("list2"); + } else if (childs[i] instanceof Choice) { + ((Choice)childs[i]).add("choice1"); + ((Choice)childs[i]).add("choice2"); + } + } + frame.pack(); + return frame; + } +} diff --git a/test/jdk/java/awt/Menu/DestroyMenuTest/DestroyMenuTest.java b/test/jdk/java/awt/Menu/DestroyMenuTest/DestroyMenuTest.java new file mode 100644 index 000000000000..b75ba047dfbe --- /dev/null +++ b/test/jdk/java/awt/Menu/DestroyMenuTest/DestroyMenuTest.java @@ -0,0 +1,139 @@ +/* + * Copyright (c) 1999, 2025, 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 4209511 + * @summary Regression test DestroyMenuTest.java Failing + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual DestroyMenuTest + */ + +import java.awt.BorderLayout; +import java.awt.Button; +import java.awt.Canvas; +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Label; +import java.awt.Panel; +import java.awt.Scrollbar; +import java.awt.TextField; + +public class DestroyMenuTest { + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + 1. Create many windows by randomly clicking 'Show Menu Test 1', + 'Show Menu Test 2', 'Show Menu Test 3' buttons. + 2. Ignore the contents of the windows. + Go to the windows created and select menu items inside the menus. + 3. Close the windows by selecting menu item File--> Quit. + 4. Do the above menu item selections as quickly as possible. + If the program crashes when you select File--> Quit, + then the test FAILS. Otherwise the test is PASS. + """; + PassFailJFrame.builder() + .instructions(INSTRUCTIONS) + .columns(38) + .testUI(DestroyMenuTest::initialize) + .build() + .awaitAndCheck(); + } + + static Frame initialize() { + Frame f = new Frame("Destroy Menu Test"); + Button launchButton = new Button("Show Menu Test 1..."); + Button launchButton2 = new Button("Show Menu Test 2..."); + Button launchButton3 = new Button("Show Menu Test 3..."); + f.setLayout(new FlowLayout()); + f.add(launchButton); + f.add(launchButton2); + f.add(launchButton3); + + launchButton.addActionListener(event -> { + MenuTest frame = new MenuTest("Menu Test 1"); + frame.setBounds(300, 300, 300, 300); + frame.setVisible(true); + }); + + launchButton2.addActionListener(event -> { + MenuTest frame = new MenuTest("Menu Test 2"); + + Button closeButton = new Button("Close"); + + Panel X = new Panel(); + X.setLayout(new BorderLayout()); + + Panel topPanel = new Panel(); + Panel bottomPanel = new Panel(); + + bottomPanel.add(closeButton); + + Scrollbar vScrollbar = new Scrollbar(Scrollbar.VERTICAL); + Scrollbar hScrollbar = new Scrollbar(Scrollbar.HORIZONTAL); + hScrollbar.setValues(hScrollbar.getValue(), 0, 0, 50); + vScrollbar.setValues(vScrollbar.getValue(), 0, 0, 50); + topPanel.setLayout(new BorderLayout()); + topPanel.add(vScrollbar, BorderLayout.EAST); + topPanel.add(hScrollbar, BorderLayout.SOUTH); + + X.add(topPanel, BorderLayout.NORTH); + X.add(bottomPanel, BorderLayout.SOUTH); + frame.add(X, BorderLayout.SOUTH); + frame.setBounds(350, 350, 300, 250); + frame.setVisible(true); + }); + + launchButton3.addActionListener(event -> { + MenuTest frame = new MenuTest("Menu Test 3"); + frame.setBounds(400, 400, 300, 300); + + mySimpleCanvas clock = new mySimpleCanvas(); + frame.add(clock, BorderLayout.CENTER); + + Panel p = new Panel(); + Button closeButton = new Button("Close"); + p.add(closeButton); + + p.add(new Label("Label")); + TextField textField = new TextField(8); + p.add(textField); + f.add(p, BorderLayout.EAST); + + frame.add(p, BorderLayout.SOUTH); + frame.setVisible(true); + }); + f.pack(); + return f; + } + + static class mySimpleCanvas extends Canvas { + @Override + public void paint(Graphics g) { + g.drawOval(0, 0, 100, 100); + g.drawOval(2, 2, 100, 100); + g.drawOval(4, 4, 100, 100); + } + } +} diff --git a/test/jdk/java/awt/Menu/DestroyMenuTest/MenuTest.java b/test/jdk/java/awt/Menu/DestroyMenuTest/MenuTest.java new file mode 100644 index 000000000000..95569f13fa22 --- /dev/null +++ b/test/jdk/java/awt/Menu/DestroyMenuTest/MenuTest.java @@ -0,0 +1,172 @@ +/* + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Canvas; +import java.awt.CardLayout; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Label; +import java.awt.Menu; +import java.awt.MenuBar; +import java.awt.MenuItem; +import java.awt.Panel; + +public class MenuTest extends Frame { + private MenuItem quitItem; + private final Panel cards; + private final CardLayout layout; + + public MenuTest(String s) { + super(s); + MenuBar mbar = new MenuBar(); + createMenus(mbar); + setMenuBar(mbar); + + cards = new Panel(); + layout = new CardLayout(); + cards.setLayout(layout); + + cards.add(new MyPanelOne("Options"), "Options"); + cards.add(new MyRectCanvas(), "MyRectCanvas"); + cards.add(new MycircleCanvas(), "MyCircleCanvas"); + + add(cards, "Center"); + } + + public void createMenus(MenuBar mbar) { + mbar.add(createFileMenu()); + mbar.add(createEditMenu()); + mbar.add(createOptionMenu1()); + mbar.add(createOptionMenu2()); + mbar.add(createOptionMenu3()); + mbar.add(createOptionMenu4()); + } + + private Menu createFileMenu() { + Menu fileMenu = new Menu("File"); + fileMenu.add(quitItem = new MenuItem("Quit")); + + quitItem.addActionListener(event -> { + MenuItem item = (MenuItem) event.getSource(); + if (item == quitItem) { + dispose(); + } + }); + return fileMenu; + } + + private Menu createEditMenu() { + Menu editMenu = new Menu("Edit"); + + editMenu.add("Cut"); + editMenu.add("Copy"); + editMenu.add("Paste"); + editMenu.addSeparator(); + editMenu.add("Select all"); + editMenu.addSeparator(); + editMenu.add("Find"); + editMenu.add("Find again"); + + return editMenu; + } + + private Menu createOptionMenu1() { + Menu optionMenu1 = new Menu("Option1"); + MenuItem item1, item2, item3; + optionMenu1.add(item1 = new MenuItem("Item1")); + optionMenu1.add(item2 = new MenuItem("Item2")); + optionMenu1.add(item3 = new MenuItem("Item3")); + + item1.addActionListener(event -> { + MenuItem mItem = (MenuItem) event.getSource(); + if (mItem == item1) { + layout.show(cards, "Options"); + } + }); + item2.addActionListener(event -> { + MenuItem mItem = (MenuItem) event.getSource(); + if (mItem == item2) { + layout.show(cards, "MyRectCanvas"); + } + }); + item3.addActionListener(event -> { + MenuItem mItem = (MenuItem) event.getSource(); + if (mItem == item3) { + layout.show(cards, "MyCircleCanvas"); + } + }); + return optionMenu1; + } + + private Menu createOptionMenu2() { + Menu optionMenu2 = new Menu("Option2"); + + optionMenu2.add("Item1"); + optionMenu2.add("Item2"); + + return optionMenu2; + } + + private Menu createOptionMenu3() { + Menu optionMenu3 = new Menu("Option3"); + + optionMenu3.add("Item1"); + optionMenu3.add("Item2"); + optionMenu3.add("Item3"); + optionMenu3.add("Item4"); + + return optionMenu3; + } + + private Menu createOptionMenu4() { + Menu optionMenu4 = new Menu("Option3"); + + optionMenu4.add("Item1"); + optionMenu4.add("Item2"); + optionMenu4.add("Item3"); + + return optionMenu4; + } +} + +class MyRectCanvas extends Canvas { + @Override + public void paint(Graphics g) { + g.drawRect(0, 0, 100, 100); + } +} + +class MyPanelOne extends Panel { + MyPanelOne(String name) { + add(new Label(name + " panel goes here")); + } +} + +class MycircleCanvas extends Canvas { + @Override + public void paint(Graphics g) { + g.drawOval(0, 0, 100, 100); + g.drawOval(2, 2, 100, 100); + g.drawOval(4, 4, 100, 100); + } +} diff --git a/test/jdk/java/awt/Menu/MenuAddRemoveCrash.java b/test/jdk/java/awt/Menu/MenuAddRemoveCrash.java new file mode 100644 index 000000000000..d5c80c27a4f2 --- /dev/null +++ b/test/jdk/java/awt/Menu/MenuAddRemoveCrash.java @@ -0,0 +1,102 @@ +/* + * Copyright (c) 2001, 2025, 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 4410477 + * @summary Tests that menu does not crash during simultaneous drawing + * and removal of items. + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual MenuAddRemoveCrash + */ + +import java.awt.Frame; +import java.awt.Menu; +import java.awt.MenuBar; +import java.awt.MenuItem; + +public class MenuAddRemoveCrash { + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + 1. Move and resize the frame. + 2. If the test crashes the test is FAILED. + Otherwise it is PASSED. + """; + PassFailJFrame.builder() + .instructions(INSTRUCTIONS) + .columns(35) + .testUI(MenuAddRemoveCrash::initialize) + .build() + .awaitAndCheck(); + } + + public static Frame initialize() { + final TestGui myTestGui = new TestGui(); + Thread test = new Thread() { + public void run() { + while (!Thread.interrupted()) { + myTestGui.changeMenuItems(); + } + } + }; + test.setDaemon(true); + test.start(); + return myTestGui; + } +} + +class TestGui extends Frame { + Menu myMenu1; + Menu myMenu2; + + public TestGui() { + this.setTitle("Try to resize this frame!"); + + this.setSize(300, 300); + this.setVisible(true); + + MenuBar myMenuBar = new MenuBar(); + myMenu1 = new Menu("DemoMenu1"); + myMenu2 = new Menu("DemoMenu2"); + + myMenuBar.add(myMenu1); + myMenuBar.add(myMenu2); + + this.setMenuBar(myMenuBar); + } + + public void changeMenuItems() { + myMenu1.removeAll(); + + for (int i = 0; i < 10; i++) { + MenuItem myMenuItem1 = new MenuItem("DemoMenuItem" + i); + myMenu1.add(myMenuItem1); + } + try { + Thread.sleep(100); + } catch (Exception e) { + throw new RuntimeException("Failed :" + e); + } + } +} diff --git a/test/jdk/java/awt/Menu/MenuZOrderTest.java b/test/jdk/java/awt/Menu/MenuZOrderTest.java new file mode 100644 index 000000000000..fefd3d64c28f --- /dev/null +++ b/test/jdk/java/awt/Menu/MenuZOrderTest.java @@ -0,0 +1,80 @@ +/* + * Copyright (c) 2005, 2025, 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 6267182 + * @summary Menu is not visible after showing and disposing a file dialog. + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual MenuZOrderTest + */ + +import java.awt.Frame; +import java.awt.Menu; +import java.awt.MenuBar; +import java.awt.MenuItem; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +public class MenuZOrderTest { + static class Listener implements ActionListener { + @Override + public void actionPerformed(ActionEvent e) { + Frame f = new Frame("Menu Z order test frame"); + f.setBounds(200, 200, 200, 200); + f.setVisible(true); + } + } + + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + 1. Choose Menu 1 --> Menu Item 1 several times. + 2. If menu window is shown correctly and each click + creates new frame - press PASS. + 3. If menu window is obscured by frame - press FAIL. + """; + PassFailJFrame.builder() + .instructions(INSTRUCTIONS) + .columns(35) + .testUI(MenuZOrderTest::initialize) + .build() + .awaitAndCheck(); + } + + static Frame initialize() { + Frame mf = new Frame("Menu Z order test"); + Listener l = new Listener(); + MenuBar mb = new MenuBar(); + Menu m1 = new Menu("Menu 1"); + MenuItem mi1 = new MenuItem("Menu Item 1"); + + mf.setSize(200, 200); + mi1.addActionListener(l); + m1.add(mi1); + mb.add(m1); + mf.setMenuBar(mb); + mf.setVisible(true); + return mf; + } +} diff --git a/test/jdk/java/awt/Menu/OnFlyRepaintMenuTest.java b/test/jdk/java/awt/Menu/OnFlyRepaintMenuTest.java new file mode 100644 index 000000000000..617d640d9073 --- /dev/null +++ b/test/jdk/java/awt/Menu/OnFlyRepaintMenuTest.java @@ -0,0 +1,103 @@ +/* + * Copyright (c) 2004, 2025, 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 5024051 + * @summary Tests if menu is repainted in enabling/disabling it and + * changing its label while it is visible, either on MenuBar + * or in other Menu. Menu items are covered as well + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual OnFlyRepaintMenuTest + */ + +import java.awt.Button; +import java.awt.CheckboxMenuItem; +import java.awt.Frame; +import java.awt.Menu; +import java.awt.MenuBar; +import java.awt.MenuItem; + +public class OnFlyRepaintMenuTest { + static boolean menuEnabled = true; + + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + 1. Click the button 'Change state' and wait for 5 secs. + 2. If menu is repainted correctly after its setLabel() + and setEnabled() methods called test PASSED, else FAILED. + (During a 5 secs delay you may select the menu to see + the effect for menu items and submenu) + """; + PassFailJFrame.builder() + .instructions(INSTRUCTIONS) + .columns(35) + .testUI(OnFlyRepaintMenuTest::initialize) + .build() + .awaitAndCheck(); + } + + static Frame initialize() { + Frame f = new Frame("OnFly Menu Repaint Test"); + + f.setSize(200, 100); + + MenuBar mb = new MenuBar(); + Menu menu = new Menu("Menu"); + MenuItem menuItem = new MenuItem("MenuItem"); + menu.add(menuItem); + Menu submenu = new Menu("SubMenu"); + MenuItem submenuItem = new MenuItem("SubmenuItem"); + submenu.add(submenuItem); + CheckboxMenuItem checkMenuItem = new CheckboxMenuItem("CheckboxmenuItem"); + checkMenuItem.setState(true); + menu.add(checkMenuItem); + menu.add(submenu); + mb.add(menu); + f.setMenuBar(mb); + + Button b = new Button("Change state"); + b.addActionListener(ev -> new Thread(() -> { + try { + Thread.sleep(5000); + } catch (Exception e) { + } + menuEnabled = !menuEnabled; + String label = menuEnabled ? "Enabled" : "Disabled"; + menu.setLabel(label); + menuItem.setLabel(label); + submenu.setLabel(label); + submenuItem.setLabel(label); + checkMenuItem.setLabel(label); + checkMenuItem.setEnabled(menuEnabled); + checkMenuItem.setState(menuEnabled); + submenuItem.setEnabled(menuEnabled); + submenu.setEnabled(menuEnabled); + menuItem.setEnabled(menuEnabled); + menu.setEnabled(menuEnabled); + }).start()); + f.add(b); + return f; + } +} diff --git a/test/jdk/java/awt/MenuBar/CellsResize.java b/test/jdk/java/awt/MenuBar/CellsResize.java new file mode 100644 index 000000000000..64777095fa8d --- /dev/null +++ b/test/jdk/java/awt/MenuBar/CellsResize.java @@ -0,0 +1,159 @@ +/* + * Copyright (c) 2011, 2024, 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 6502052 + * @summary Menu cells must resize if font changes (XToolkit) + * @requires os.family == "linux" + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual CellsResize + */ + +import java.awt.Button; +import java.awt.Font; +import java.awt.Frame; +import java.awt.GridLayout; +import java.awt.Menu; +import java.awt.MenuBar; +import java.awt.MenuComponent; +import java.awt.MenuItem; +import java.awt.Panel; +import java.awt.PopupMenu; +import java.awt.Toolkit; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; + +public class CellsResize { + private static Frame frame; + private static MenuBar menuBar; + private static PopupMenu popupMenu; + private static Menu barSubMenu; + private static Menu popupSubMenu; + private static boolean fontMultiplied = false; + + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + 1. Open all nested menus in menu bar. + 2. Click on "popup-menu" button to show popup-menus. + 3. Open all nested menus in popup-menu. + 4. Click on "big-font" button (to make all menus have a + bigger font). + 5. Open all nested menus again (as described in 1, 2, 3). + 6. If all menu items use a bigger font now and their labels fit + into menu-item size, press "pass", otherwise press "fail". + """; + + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(35) + .testUI(CellsResize::createUI) + .logArea(5) + .build() + .awaitAndCheck(); + } + + public static Frame createUI () { + if (!checkToolkit()) { + new RuntimeException("Toolkit check failed."); + } + frame = new Frame("MenuBar Cell Resize Test"); + + popupMenu = new PopupMenu(); + popupMenu.add(createMenu(false)); + + frame.add(popupMenu); + + menuBar = new MenuBar(); + menuBar.add(createMenu(true)); + + frame.setMenuBar(menuBar); + + Button bp = new Button("popup-menu"); + bp.addMouseListener(new MouseAdapter() { + public void mouseReleased(MouseEvent e) { + popupMenu.show(e.getComponent(), e.getX(), e.getY()); + } + }); + + Button bf = new Button("big-font"); + bf.addMouseListener(new MouseAdapter() { + public void mouseReleased(MouseEvent e) { + bigFont(); + } + }); + + Panel panel = new Panel(); + panel.setLayout(new GridLayout(2, 1)); + panel.add(bp); + panel.add(bf); + + frame.add(panel); + frame.setSize(300, 300); + return frame; + } + + static boolean checkToolkit() { + String toolkitName = Toolkit.getDefaultToolkit().getClass().getName(); + return toolkitName.equals("sun.awt.X11.XToolkit"); + } + + static Menu createMenu(boolean bar) { + Menu menu1 = new Menu("Menu-1"); + Menu menu11 = new Menu("Menu-11"); + menu1.add(menu11); + if (bar) { + barSubMenu = menu11; + } else { + popupSubMenu = menu11; + } + menu11.add(new MenuItem("MenuItem")); + return menu1; + } + + static void bigFont() { + if (fontMultiplied) { + return; + } else { + fontMultiplied = true; + } + + multiplyFont(barSubMenu, 7); + multiplyFont(popupSubMenu, 7); + + // NOTE: if previous two are moved below following + // two, they get their font multiplied twice. + + multiplyFont(menuBar, 5); + multiplyFont(popupMenu, 5); + } + + static void multiplyFont(MenuComponent comp, int times) { + Font font = comp.getFont(); + float size = font.getSize() * times; + comp.setFont(font.deriveFont(size)); + } +} diff --git a/test/jdk/java/awt/MenuBar/MenuBarAddRemoveTest/MenuBarAddRemoveTest.java b/test/jdk/java/awt/MenuBar/MenuBarAddRemoveTest/MenuBarAddRemoveTest.java new file mode 100644 index 000000000000..fdb9f06e98c7 --- /dev/null +++ b/test/jdk/java/awt/MenuBar/MenuBarAddRemoveTest/MenuBarAddRemoveTest.java @@ -0,0 +1,72 @@ +/* + * Copyright (c) 1998, 2024, 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 4028130 4112308 + * @summary Test for location of Frame/MenuBar when MenuBar is re-added + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual MenuBarAddRemoveTest + */ + +import java.awt.Button; +import java.awt.Frame; +import java.awt.Menu; +import java.awt.MenuBar; + +public class MenuBarAddRemoveTest { + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + 1. Click the left mouse button on the "Re-Add MenuBar" + button several times. + 3. The Frame/MenuBar may repaint or flash, but the location + of its upper left corner should never change. + """; + + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(35) + .testUI(MenuBarAddRemoveTest::createUI) + .build() + .awaitAndCheck(); + } + + private static Frame createUI() { + Frame f = new Frame("Re-Add MenuBar Test Frame"); + Button b = new Button("Re-Add MenuBar"); + b.addActionListener(e -> f.setMenuBar(createMenuBar())); + f.setMenuBar(createMenuBar()); + f.add(b); + f.pack(); + return f; + } + + private static MenuBar createMenuBar() { + MenuBar bar = new MenuBar(); + bar.add(new Menu("foo")); + return bar; + } +} diff --git a/test/jdk/java/awt/MenuBar/MenuBarOnDisabledFrame/MenuBarOnDisabledFrame.java b/test/jdk/java/awt/MenuBar/MenuBarOnDisabledFrame/MenuBarOnDisabledFrame.java new file mode 100644 index 000000000000..06f5d96c19e3 --- /dev/null +++ b/test/jdk/java/awt/MenuBar/MenuBarOnDisabledFrame/MenuBarOnDisabledFrame.java @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2005, 2024, 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 6185057 + * @summary Disabling a frame does not disable the menus on the frame, on + * solaris/linux + * @requires os.family != "mac" + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual MenuBarOnDisabledFrame + */ + +import java.awt.Button; +import java.awt.Frame; +import java.awt.Menu; +import java.awt.MenuBar; +import java.awt.MenuItem; + +public class MenuBarOnDisabledFrame { + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + Check if MenuBar is disabled on 'Disabled frame' + Press pass if menu bar is disabled, fail otherwise + """; + + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(35) + .testUI(MenuBarOnDisabledFrame::createUI) + .build() + .awaitAndCheck(); + } + + public static Frame createUI() { + Frame f = new Frame("Disabled frame"); + MenuBar mb = new MenuBar(); + Menu m1 = new Menu("Disabled Menu 1"); + Menu m2 = new Menu("Disabled Menu 2"); + MenuItem m11 = new MenuItem("MenuItem 1.1"); + MenuItem m21 = new MenuItem("MenuItem 2.1"); + Button b = new Button("Disabled button"); + + m1.add(m11); + m2.add(m21); + mb.add(m1); + mb.add(m2); + f.setMenuBar(mb); + f.add(b); + f.setEnabled(false); + f.setSize(300, 300); + return f; + } +} diff --git a/test/jdk/java/awt/MenuBar/MenuBarRemoveMenu/MenuBarRemoveMenuTest.java b/test/jdk/java/awt/MenuBar/MenuBarRemoveMenu/MenuBarRemoveMenuTest.java new file mode 100644 index 000000000000..098065d1361f --- /dev/null +++ b/test/jdk/java/awt/MenuBar/MenuBarRemoveMenu/MenuBarRemoveMenuTest.java @@ -0,0 +1,93 @@ +/* + * Copyright (c) 1999, 2024, 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 4275848 + * @summary Tests that MenuBar is painted correctly after its submenu is removed + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual MenuBarRemoveMenuTest + */ + +import java.awt.Button; +import java.awt.Frame; +import java.awt.GridLayout; +import java.awt.Menu; +import java.awt.MenuBar; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +public class MenuBarRemoveMenuTest implements ActionListener { + private static MenuBar menubar; + private static Button removeButton; + private static Button addButton; + + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + Press "Remove menu" button. If you see that both menus + disappeared, the test failed. Otherwise try to add and remove + menu several times to verify that the test passed. Every time + you press "Remove menu" button only one menu should go away. + """; + + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(35) + .testUI(MenuBarRemoveMenuTest::createUI) + .build() + .awaitAndCheck(); + } + + private static Frame createUI() { + Frame frame = new Frame(); + menubar = new MenuBar(); + removeButton = new Button("Remove menu"); + addButton = new Button("Add menu"); + removeButton.addActionListener(new MenuBarRemoveMenuTest()); + addButton.addActionListener(new MenuBarRemoveMenuTest()); + addButton.setEnabled(false); + menubar.add(new Menu("menu")); + menubar.add(new Menu("menu")); + frame.setMenuBar(menubar); + frame.setLayout(new GridLayout(1, 2)); + frame.add(removeButton); + frame.add(addButton); + frame.pack(); + return frame; + } + + public void actionPerformed(ActionEvent e) { + if (e.getSource() == removeButton) { + menubar.remove(0); + removeButton.setEnabled(false); + addButton.setEnabled(true); + } else { + menubar.add(new Menu("menu")); + removeButton.setEnabled(true); + addButton.setEnabled(false); + } + } +} diff --git a/test/jdk/java/awt/MenuBar/MenuBarVisuals/MenuBarVisuals.java b/test/jdk/java/awt/MenuBar/MenuBarVisuals/MenuBarVisuals.java new file mode 100644 index 000000000000..7663dd0d99be --- /dev/null +++ b/test/jdk/java/awt/MenuBar/MenuBarVisuals/MenuBarVisuals.java @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2005, 2024, 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 6180416 + * @summary Tests MenuBar and drop down menu visuals + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual MenuBarVisuals + */ + +import java.awt.Frame; +import java.awt.Menu; +import java.awt.MenuBar; +import java.awt.MenuItem; +import java.awt.MenuShortcut; +import java.awt.event.KeyEvent; + +public class MenuBarVisuals { + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + Look at the MenuBar and traverse the menus using mouse and + keyboard. Then check if following is showing correctly: + 1. Mnemonic label Ctrl+A is NOT drawn for Menu 1/Submenu 1.1 + 2. Mnemonic label Ctrl+B is drawn for + Menu 1/Submenu 1.1/Item 1.1.1 + 3. Mnemonic label Ctrl+C is drawn for Menu1/Item 1.2 + Press PASS if Menu is drawing correctly, FAIL otherwise. + """; + + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(35) + .testUI(MenuBarVisuals::createUI) + .build() + .awaitAndCheck(); + } + + private static Frame createUI() { + Frame f = new Frame("MenuBar Visuals Test"); + MenuBar mb = new MenuBar(); + Menu menu1 = new Menu("Menu 1"); + Menu submenu11 = new Menu("Submenu 1.1"); + MenuItem item111 = new MenuItem("Item 1.1.1"); + MenuItem item112 = new MenuItem("Item 1.1.2"); + MenuItem item12 = new MenuItem("Item 1.2"); + Menu menu2 = new Menu("Menu 2"); + MenuItem item21 = new MenuItem("Item 2.1"); + MenuItem item22 = new MenuItem("Item 2.2"); + item111.setShortcut(new MenuShortcut(KeyEvent.VK_B, false)); + submenu11.add(item111); + submenu11.add(item112); + submenu11.setShortcut(new MenuShortcut(KeyEvent.VK_A, false)); + menu1.add(submenu11); + item12.setShortcut(new MenuShortcut(KeyEvent.VK_C, false)); + menu1.add(item12); + mb.add(menu1); + menu2.add(item21); + menu2.add(item22); + mb.add(menu2); + f.setMenuBar(mb); + f.setSize(300, 300); + return f; + } +} diff --git a/test/jdk/java/awt/MenuBar/MenuNPE/MenuNPE.java b/test/jdk/java/awt/MenuBar/MenuNPE/MenuNPE.java new file mode 100644 index 000000000000..a7a3a3480118 --- /dev/null +++ b/test/jdk/java/awt/MenuBar/MenuNPE/MenuNPE.java @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2004, 2024, 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 5005194 + * @summary Frame.remove(getMenuBar()) throws NPE if the frame doesn't + * have a menu bar + * @key headful + * @run main MenuNPE + */ + +import java.awt.Frame; +import java.awt.Menu; +import java.awt.MenuBar; +import java.awt.MenuItem; + +public class MenuNPE { + private static Frame frame; + public static void main(String[] args) throws Exception { + try { + frame = new Frame("Menu NPE"); + MenuBar menuBar = new MenuBar(); + Menu menu1 = new Menu("Menu 01"); + MenuItem menuLabel = new MenuItem("Item 01"); + menu1.add(menuLabel); + menuBar.add(menu1); + frame.setMenuBar(menuBar); + frame.setSize(200, 200); + frame.setVisible(true); + frame.validate(); + frame.remove(frame.getMenuBar()); + frame.remove(frame.getMenuBar()); + System.out.println("Test passed."); + } catch (Exception e) { + e.printStackTrace(); + } finally { + if (frame != null) { + frame.dispose(); + } + } + } +} diff --git a/test/jdk/java/awt/MenuBar/SetHelpMenuTest/SetHelpMenuTest.java b/test/jdk/java/awt/MenuBar/SetHelpMenuTest/SetHelpMenuTest.java new file mode 100644 index 000000000000..fcfc3e80ed34 --- /dev/null +++ b/test/jdk/java/awt/MenuBar/SetHelpMenuTest/SetHelpMenuTest.java @@ -0,0 +1,88 @@ +/* + * Copyright (c) 1999, 2024, 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 4275843 + * @summary MenuBar doesn't display all of its Menus correctly on Windows + * @requires os.family == "windows" + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual SetHelpMenuTest + */ + +import java.awt.Frame; +import java.awt.Menu; +import java.awt.MenuBar; +import java.awt.MenuItem; + +public class SetHelpMenuTest { + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + An empty frame should be visible. When focused, the MenuBar + should have 5 menus ("one", "two", "three", "Help 2", + "four"). If so, then the test passed. Otherwise, the test + failed. + """; + + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(35) + .testUI(SetHelpMenuTest::createUI) + .build() + .awaitAndCheck(); + } + + private static Frame createUI() { + Frame f = new Frame("Help MenuBar Test"); + f.setSize(100, 100); + + MenuBar mb = new MenuBar(); + Menu h1, h2; + + f.setMenuBar(mb); + mb.add(createMenu("one", false)); + mb.add(createMenu("two", false)); + mb.add(createMenu("three", true)); + + mb.add(h1 = createMenu("Help 1", false)); // h1 is HelpMenu + mb.setHelpMenu(h1); + + mb.add(h2 = createMenu("Help 2", false)); // h2 replaced h1 + mb.setHelpMenu(h2); + + mb.add(createMenu("four", false)); + + return f; + } + + private static Menu createMenu(String name, boolean tearOff) { + Menu m = new Menu(name, tearOff); + m.add(new MenuItem(name + " item 1")); + m.add(new MenuItem(name + " item 2")); + m.add(new MenuItem(name + " item 3")); + return m; + } +} diff --git a/test/jdk/java/awt/MenuBar/SetMBarWhenHidden/SetMBarWhenHidden.java b/test/jdk/java/awt/MenuBar/SetMBarWhenHidden/SetMBarWhenHidden.java new file mode 100644 index 000000000000..67eefe489424 --- /dev/null +++ b/test/jdk/java/awt/MenuBar/SetMBarWhenHidden/SetMBarWhenHidden.java @@ -0,0 +1,92 @@ +/* + * Copyright (c) 1999, 2024, 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 4105881 + * @summary Sets the menu bar while frame window is hidden, then shows + frame again + * @key headful + * @run main SetMBarWhenHidden + */ + +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.Menu; +import java.awt.MenuBar; +import java.awt.Rectangle; + +// test case for 4105881: FRAME.SETSIZE() DOESN'T WORK FOR SOME SOLARIS WITH +// JDK115+CASES ON +public class SetMBarWhenHidden { + private static Frame f; + private static Rectangle startBounds; + private static Rectangle endBounds; + + public static void main(String[] args) throws Exception { + try { + EventQueue.invokeAndWait(() -> { + f = new Frame("Set MenuBar When Hidden Test"); + Menu file; + Menu edit; + MenuBar menubar = new MenuBar(); + file = new Menu("File"); + menubar.add(file); + edit = new Menu("Edit"); + menubar.add(edit); + edit.setEnabled(false); + f.setMenuBar(menubar); + f.setSize(200, 200); + startBounds = f.getBounds(); + System.out.println("About to call setVisible(false)"); + f.setVisible(false); + System.out.println("About to call setSize(500, 500)"); + f.setSize(500, 500); + // create a new menubar and add + MenuBar menubar1 = new MenuBar(); + menubar1.add(file); + menubar1.add(edit); + System.out.println("About to call setMenuBar"); + f.setMenuBar(menubar1); + System.out.println("About to call setVisible(true)"); + f.setVisible(true); + endBounds = f.getBounds(); + }); + if (startBounds.getHeight() > endBounds.getHeight() && + startBounds.getWidth() > endBounds.getWidth()) { + throw new RuntimeException("Test failed. Frame size didn't " + + "change.\nStart: " + startBounds + "\n" + + "End: " + endBounds); + } else { + System.out.println("Test passed.\nStart: " + startBounds + + "\nEnd: " + endBounds); + } + } finally { + EventQueue.invokeAndWait(() -> { + if (f != null) { + f.dispose(); + } + }); + } + } +} diff --git a/test/jdk/java/awt/MenuItem/GiantFontTest.java b/test/jdk/java/awt/MenuItem/GiantFontTest.java new file mode 100644 index 000000000000..f1e352373bb1 --- /dev/null +++ b/test/jdk/java/awt/MenuItem/GiantFontTest.java @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Font; +import java.awt.Frame; +import java.awt.Menu; +import java.awt.MenuBar; +import java.awt.MenuItem; + +/* + * @test + * @bug 4700350 + * @requires os.family != "mac" + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @summary Tests menu item font is big + * @run main/manual GiantFontTest + */ + +public class GiantFontTest { + + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + A frame with one menu will appear. + On Linux, the menu's (present on menu bar) font should + be quite large (48 point). + If not, test fails. + + On Windows, the menu's (present on menu bar) font + should be normal size. + If the menu text is clipped by the title bar, or is painted over + the title bar or client area, the test fails. + + On both Windows and Linux, the menu items in the popup + menu should be large. + + If so, test passes."""; + + PassFailJFrame.builder() + .title("GiantFontTest") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(40) + .testUI(GiantFontTest::createAndShowUI) + .build() + .awaitAndCheck(); + } + + private static Frame createAndShowUI() { + Font giantFont = new Font("Dialog", Font.PLAIN, 48); + Frame f = new Frame("GiantFontTest"); + MenuBar mb = new MenuBar(); + Menu m = new Menu("My font is too big!"); + m.setFont(giantFont); + for (int i = 0; i < 5; i++) { + m.add(new MenuItem("Some MenuItems")); + } + mb.add(m); + f.setMenuBar(mb); + f.setSize(450, 400); + return f; + } +} diff --git a/test/jdk/java/awt/MenuItem/LotsOfMenuItemsTest.java b/test/jdk/java/awt/MenuItem/LotsOfMenuItemsTest.java new file mode 100644 index 000000000000..7a528205d27d --- /dev/null +++ b/test/jdk/java/awt/MenuItem/LotsOfMenuItemsTest.java @@ -0,0 +1,117 @@ +/* + * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Frame; +import java.awt.Menu; +import java.awt.MenuBar; +import java.awt.MenuItem; +import java.awt.event.ComponentAdapter; +import java.awt.event.ComponentEvent; + +/* + * @test + * @bug 4175790 + * @requires os.family == "windows" + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @summary Win32: Running out of command ids for menu items + * @run main/manual LotsOfMenuItemsTest + */ + +public class LotsOfMenuItemsTest extends ComponentAdapter { + private static final int NUM_WINDOWS = 400; + private static TestFrame firstFrame; + + public static void main(String[] args) throws Exception { + LotsOfMenuItemsTest obj = new LotsOfMenuItemsTest(); + String INSTRUCTIONS = """ + This test creates lots of frames with menu bars. + When it's done you will see two frames. + Try to select menu items from each of them. + + If everything seems to work - test passed. + Click "Pass" button in the test harness window. + + If test crashes on you - test failed."""; + + PassFailJFrame.builder() + .title("LotsOfMenuItemsTest") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(40) + .testUI(obj::createAndShowUI) + .build() + .awaitAndCheck(); + } + + private Frame createAndShowUI() { + firstFrame = new TestFrame("First frame"); + firstFrame.addComponentListener(this); + return firstFrame; + } + + @Override + public void componentShown(ComponentEvent e) { + final int x = firstFrame.getX(); + final int y = firstFrame.getY() + firstFrame.getHeight() + 8; + TestFrame testFrame; + for (int i = 1; i < NUM_WINDOWS - 1; ++i) { + testFrame = new TestFrame("Running(" + i + ")...", x, y); + testFrame.setVisible(false); + testFrame.dispose(); + } + testFrame = new TestFrame("Last Frame", x, y); + PassFailJFrame.addTestWindow(testFrame); + } + + private static class TestFrame extends Frame { + static int n = 0; + + public TestFrame(String title) { + this(title, 0, 0, false); + } + + public TestFrame(String s, int x, int y) { + this(s, x, y, true); + } + + private TestFrame(String title, int x, int y, boolean visible) { + super(title); + MenuBar mb = new MenuBar(); + for (int i = 0; i < 10; ++i) { + Menu m = new Menu("Menu_" + (i + 1)); + for (int j = 0; j < 20; ++j) { + MenuItem mi = new MenuItem("Menu item " + ++n); + m.add(mi); + } + mb.add(m); + } + setMenuBar(mb); + setLocation(x, y); + setSize(450, 150); + if (visible) { + setVisible(true); + } + } + } +} diff --git a/test/jdk/java/awt/MenuItem/MenuSetFontTest.java b/test/jdk/java/awt/MenuItem/MenuSetFontTest.java new file mode 100644 index 000000000000..9a4e8f858390 --- /dev/null +++ b/test/jdk/java/awt/MenuItem/MenuSetFontTest.java @@ -0,0 +1,72 @@ +/* + * Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Font; +import java.awt.Frame; +import java.awt.Menu; +import java.awt.MenuBar; +import java.awt.MenuItem; + +/* + * @test + * @bug 4066657 8009454 + * @requires os.family != "mac" + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @summary Tests that setting a font on the Menu with MenuItem takes effect. + * @run main/manual MenuSetFontTest + */ + +public class MenuSetFontTest { + + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + Look at the menu in the upper left corner of the 'SetFont Test' frame. + Click on the "File" menu. You will see "menu item" item. + Press Pass if menu item is displayed using bold and large font, + otherwise press Fail. + If you do not see menu at all, press Fail."""; + + PassFailJFrame.builder() + .title("MenuSetFontTest") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(40) + .testUI(MenuSetFontTest::createAndShowUI) + .build() + .awaitAndCheck(); + } + + private static Frame createAndShowUI() { + Frame frame = new Frame("SetFont Test"); + MenuBar menuBar = new MenuBar(); + Menu menu = new Menu("File"); + MenuItem item = new MenuItem("menu item"); + menu.add(item); + menuBar.add(menu); + menuBar.setFont(new Font(Font.MONOSPACED, Font.BOLD, 24)); + frame.setMenuBar(menuBar); + frame.setSize(300, 200); + return frame; + } +} diff --git a/test/jdk/java/awt/MenuItem/NullOrEmptyStringLabelTest.java b/test/jdk/java/awt/MenuItem/NullOrEmptyStringLabelTest.java new file mode 100644 index 000000000000..79d4c02ad246 --- /dev/null +++ b/test/jdk/java/awt/MenuItem/NullOrEmptyStringLabelTest.java @@ -0,0 +1,105 @@ +/* + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.BorderLayout; +import java.awt.Button; +import java.awt.Frame; +import java.awt.Menu; +import java.awt.MenuBar; +import java.awt.MenuItem; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +/* + * @test + * @bug 4251036 + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @summary MenuItem setLabel(null/"") behaves differently under Win32 and Solaris + * @run main/manual NullOrEmptyStringLabelTest + */ + +public class NullOrEmptyStringLabelTest { + + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + The bug is reproducible under Win32 and Solaris. + Setting 'null' and "" as a label of menu item + should set blank label on all platforms according to the specification. + But under Solaris setting "" as a label of menu item used to + cause some garbage to be set as label. + Under Win32 setting 'null' as a label used to result in + throwing NullPointerException. + + If you see any of these things happen test fails otherwise + it passes."""; + + PassFailJFrame.builder() + .title("NullOrEmptyStringLabelTest") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(40) + .testUI(NullOrEmptyStringLabelTest::createAndShowUI) + .build() + .awaitAndCheck(); + } + + private static Frame createAndShowUI() { + Frame frame = new Frame("Null Or Empty String Label Test"); + Menu menu = new Menu("Menu"); + MenuItem mi = new MenuItem("Item"); + MenuBar mb = new MenuBar(); + Button button1 = new Button("Set MenuItem label to 'null'"); + Button button2 = new Button("Set MenuItem label to \"\""); + Button button3 = new Button("Set MenuItem label to 'text'"); + button1.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent ev) { + System.out.println("Setting MenuItem label to null"); + mi.setLabel(null); + } + }); + button2.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent ev) { + System.out.println("Setting MenuItem label to \"\""); + mi.setLabel(""); + } + }); + button3.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent ev) { + System.out.println("Setting MenuItem label to 'text'"); + mi.setLabel("text"); + } + }); + menu.add(mi); + mb.add(menu); + frame.add(button1, BorderLayout.NORTH); + frame.add(button2, BorderLayout.CENTER); + frame.add(button3, BorderLayout.SOUTH); + frame.setMenuBar(mb); + frame.setSize(200, 135); + return frame; + } +} diff --git a/test/jdk/java/awt/MenuItem/UnicodeMenuItemTest.java b/test/jdk/java/awt/MenuItem/UnicodeMenuItemTest.java new file mode 100644 index 000000000000..b73fe954af6d --- /dev/null +++ b/test/jdk/java/awt/MenuItem/UnicodeMenuItemTest.java @@ -0,0 +1,91 @@ +/* + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Frame; +import java.awt.Menu; +import java.awt.MenuBar; +import java.awt.MenuItem; + +/* + * @test + * @bug 4099695 + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @summary menu items with Unicode labels treated as separators + * @run main/manual UnicodeMenuItemTest + */ + +public class UnicodeMenuItemTest { + + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + Click on the "Menu" on the top-left corner of frame. + + The menu should have four entries: + 1) a row of five unicode characters: \u00c4\u00cb\u00cf\u00d6\u00dc + 2) a menu separator + 3) a unicode character: \u012d + 4) a unicode character: \u022d + + If the menu items look like the list above, the test passes. + It is okay if the unicode characters look like empty boxes + or something - as long as they are not separators. + + If either of the last two menu items show up as separators, + the test FAILS. + + Press 'Pass' if above instructions hold good else press 'Fail'."""; + + PassFailJFrame.builder() + .title("UnicodeMenuItemTest") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(40) + .testUI(UnicodeMenuItemTest::createAndShowUI) + .build() + .awaitAndCheck(); + } + private static Frame createAndShowUI() { + Frame frame = new Frame("Unicode MenuItem Test"); + MenuBar mb = new MenuBar(); + Menu m = new Menu("Menu"); + + MenuItem mi1 = new MenuItem("\u00c4\u00cb\u00cf\u00d6\u00dc"); + m.add(mi1); + + MenuItem separator = new MenuItem("-"); + m.add(separator); + + MenuItem mi2 = new MenuItem("\u012d"); + m.add(mi2); + + MenuItem mi3 = new MenuItem("\u022d"); + m.add(mi3); + + mb.add(m); + + frame.setMenuBar(mb); + frame.setSize(450, 150); + return frame; + } +} diff --git a/test/jdk/java/awt/Mouse/DoubleClickTest.java b/test/jdk/java/awt/Mouse/DoubleClickTest.java new file mode 100644 index 000000000000..037332a40981 --- /dev/null +++ b/test/jdk/java/awt/Mouse/DoubleClickTest.java @@ -0,0 +1,88 @@ +/* + * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Event; +import java.awt.Frame; +import java.awt.Panel; +import java.awt.TextArea; + +/* + * @test + * @bug 4092370 + * @summary Test to verify double click + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual DoubleClickTest + */ + +public class DoubleClickTest { + static TextArea ta = new TextArea("", 10, 40); + + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + 1. Double click on the red area. + 2. Verify that the event reports click_count > 1 on + Double-Click. If click_count shows only 1 for every + Double-Clicks then test FAILS, else test PASS. + """; + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(35) + .testUI(initialize()) + .build() + .awaitAndCheck(); + } + + public static Frame initialize() { + Frame frame = new Frame("Double-click Test"); + frame.setLayout(new BorderLayout()); + frame.add("East", new MyPanel(ta)); + frame.add("West", ta); + frame.setSize(200, 200); + return frame; + } +} + +class MyPanel extends Panel { + TextArea ta; + + MyPanel(TextArea ta) { + this.ta = ta; + setBackground(Color.red); + } + + public Dimension getPreferredSize() { + return new Dimension(50, 50); + } + + + public boolean mouseDown(Event event, int x, int y) { + ta.append("event click count= " + event.clickCount + "\n"); + return false; + } +} diff --git a/test/jdk/java/awt/Mouse/MouseClickCount.java b/test/jdk/java/awt/Mouse/MouseClickCount.java new file mode 100644 index 000000000000..a63d24fcb9ff --- /dev/null +++ b/test/jdk/java/awt/Mouse/MouseClickCount.java @@ -0,0 +1,69 @@ +/* + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Frame; +import java.awt.TextArea; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; + +/* + * @test + * @bug 4199397 + * @summary Test to mouse click count + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual MouseClickCount + */ + +public class MouseClickCount { + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + 1. Clicking on Frame panel quickly will produce clickCount larger than 1 + in the TextArea the count is printed for each mouse click + 2. Verify that a left-button click followed by a right button click quickly + will not generate 1, 2, i.e. it's not considered a double clicking. + """; + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(35) + .testUI(initialize()) + .build() + .awaitAndCheck(); + } + + private static Frame initialize() { + Frame f = new Frame("Mouse Click Count Test"); + final TextArea ta = new TextArea(); + f.add("South", ta); + f.addMouseListener(new MouseAdapter() { + public void mousePressed(MouseEvent e) { + if (e.getClickCount() == 1) ta.append("\n1"); + else ta.append(", " + e.getClickCount()); + } + }); + f.setSize(300, 500); + return f; + } +} diff --git a/test/jdk/java/awt/Mouse/MouseDragEnterExitTest.java b/test/jdk/java/awt/Mouse/MouseDragEnterExitTest.java new file mode 100644 index 000000000000..b2d8e446ffc3 --- /dev/null +++ b/test/jdk/java/awt/Mouse/MouseDragEnterExitTest.java @@ -0,0 +1,117 @@ +/* + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Frame; +import java.awt.Panel; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.util.List; + +/* + * @test + * @bug 4141361 + * @summary Test to Ensures that mouse enter / exit is delivered to a new + * frame or component during a drag + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual MouseDragEnterExitTest + */ + +public class MouseDragEnterExitTest { + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + Click on the blue frame, drag to the white frame, and back + You should get enter/exit messages for the frames when dragging + """; + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(35) + .testUI(MouseEvents.initialize()) + .logArea(8) + .build() + .awaitAndCheck(); + } +} + +class MouseEvents extends Frame { + static int WITH_WIDGET = 0; + + public MouseEvents(int mode) { + super("Mouse Drag Enter/Exit Test"); + setSize(300, 300); + + addMouseListener(new MouseAdapter() { + @Override + public void mouseEntered(MouseEvent e) { + PassFailJFrame.log("Frame MOUSE_ENTERED" + ": " + " " + + e.getX() + " " + e.getY()); + } + + @Override + public void mouseExited(MouseEvent e) { + PassFailJFrame.log("Frame MOUSE_EXITED" + ": " + " " + + e.getX() + " " + e.getY()); + } + }); + + if (mode == WITH_WIDGET) { + setLayout(new BorderLayout()); + add("Center", new SimplePanel()); + } + } + + public static List initialize() { + MouseEvents m = new MouseEvents(MouseEvents.WITH_WIDGET); + m.setLocation(500, 300); + MouseEvents t = new MouseEvents(MouseEvents.WITH_WIDGET + 1); + t.setLocation(200, 200); + return List.of(m, t); + } +} + +class SimplePanel extends Panel { + public SimplePanel() { + super(); + setName("Test Panel"); + addMouseListener(new MouseAdapter() { + @Override + public void mouseEntered(MouseEvent e) { + PassFailJFrame.log("Panel MOUSE_ENTERED" + ": " + " " + + e.getX() + " " + e.getY()); + } + + @Override + public void mouseExited(MouseEvent e) { + PassFailJFrame.log("Panel MOUSE_EXITED" + ": " + " " + + e.getX() + " " + e.getY()); + } + }); + setSize(100, 100); + setBackground(Color.blue); + } +} + diff --git a/test/jdk/java/awt/Mouse/MouseDragTest.java b/test/jdk/java/awt/Mouse/MouseDragTest.java new file mode 100644 index 000000000000..cb8be7b0de25 --- /dev/null +++ b/test/jdk/java/awt/Mouse/MouseDragTest.java @@ -0,0 +1,215 @@ +/* + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Canvas; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import java.awt.event.MouseMotionAdapter; +import java.awt.event.MouseMotionListener; + +/* + * @test + * @bug 4035189 + * @summary Test to verify that Drag events go to wrong component + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual MouseDragTest + */ + +class HeavySquare extends Canvas { + private final Color colorNormal; + private boolean gotADragEvent; + + public HeavySquare(Color color) { + colorNormal = color; + setBackground(colorNormal); + new MouseChecker(this); + addMouseMotionListener(new DragAdapter()); + addMouseListener(new PressReleaseAdapter()); + } + + class DragAdapter extends MouseMotionAdapter { + public void mouseDragged(MouseEvent ev) { + if (gotADragEvent) + return; + + Point mousePt = ev.getPoint(); + Dimension csize = getSize(); + boolean inBounds = + (mousePt.x >= 0 && mousePt.x <= csize.width && + mousePt.y >= 0 && mousePt.y <= csize.height); + if (!inBounds) { + setBackground(Color.green); + } + gotADragEvent = true; + } + } + + class PressReleaseAdapter extends MouseAdapter { + public void mousePressed(MouseEvent ev) { + gotADragEvent = false; + } + + public void mouseReleased(MouseEvent ev) { + setBackground(colorNormal); + } + } + + public Dimension preferredSize() { + return new Dimension(50, 50); + } +} + +class MouseFrame extends Frame { + public MouseFrame() { + super("MouseDragTest"); + new MouseChecker(this); + setLayout(new FlowLayout()); + add(new HeavySquare(Color.red)); + add(new HeavySquare(Color.blue)); + setBounds(new Rectangle(20, 20, 400, 300)); + } +} + +public class MouseDragTest { + static Frame TestFrame; + + public MouseDragTest() { + TestFrame = new MouseFrame(); + } + + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + 1. A frame with two boxes will appear. Click and drag _very_ quickly + off one of the components. You will know you were quick enough + when the component you dragged off of turns green + 2. Repeat this several times on both boxes, ensuring you get them + to turn green. The components should revert to their original + color when you release the mouse + 3. The test FAILS if the component doesn't revert to original + color, else PASS. + """; + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(35) + .testUI(new MouseFrame()) + .build() + .awaitAndCheck(); + } +} + +class MouseChecker implements MouseListener, MouseMotionListener { + private boolean isPressed = false; + private MouseEvent evPrev = null; + private MouseEvent evPrevPrev = null; + + public MouseChecker(Component comp) { + comp.addMouseListener(this); + comp.addMouseMotionListener(this); + } + + private void recordEv(MouseEvent ev) { + evPrevPrev = evPrev; + evPrev = ev; + } + + private synchronized void failure(String str) { + PassFailJFrame.forceFail("Test Failed : "+str); + } + + public void mouseClicked(MouseEvent ev) { + if (!(evPrev.getID() == MouseEvent.MOUSE_RELEASED && + evPrevPrev.getID() == MouseEvent.MOUSE_PRESSED)) { + failure("Got mouse click without press/release preceding."); + } + recordEv(ev); + } + + public void mousePressed(MouseEvent ev) { + recordEv(ev); + if (isPressed) { + failure("Got two mouse presses without a release."); + } + isPressed = true; + } + + public void mouseReleased(MouseEvent ev) { + recordEv(ev); + if (!isPressed) { + failure("Got mouse release without being pressed."); + } + isPressed = false; + } + + public void mouseEntered(MouseEvent ev) { + recordEv(ev); + Point mousePt = ev.getPoint(); + Component comp = (Component) ev.getSource(); + Dimension size = comp.getSize(); + boolean inBounds = + (mousePt.x >= 0 && mousePt.x <= size.width && + mousePt.y >= 0 && mousePt.y <= size.height); + + if (!inBounds) { + failure("Got mouse entered, but mouse not inside component."); + } + } + + public void mouseExited(MouseEvent ev) { + recordEv(ev); + Point mousePt = ev.getPoint(); + Component comp = (Component) ev.getSource(); + if (comp instanceof Frame) { + return; + } + Dimension size = comp.getSize(); + boolean isOnChild = (comp != comp.getComponentAt(mousePt)); + boolean inBounds = + (mousePt.x >= 0 && mousePt.x <= size.width && + mousePt.y >= 0 && mousePt.y <= size.height); + if (!isOnChild && inBounds) { + failure("Got mouse exit, but mouse still inside component."); + } + } + + public void mouseDragged(MouseEvent ev) { + recordEv(ev); + if (!isPressed) { + failure("Got drag without a press first."); + } + } + + public void mouseMoved(MouseEvent ev) { + recordEv(ev); + } +} diff --git a/test/jdk/java/awt/Mouse/MouseEnterExitTest.java b/test/jdk/java/awt/Mouse/MouseEnterExitTest.java new file mode 100644 index 000000000000..059ad5c05482 --- /dev/null +++ b/test/jdk/java/awt/Mouse/MouseEnterExitTest.java @@ -0,0 +1,174 @@ +/* + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Color; +import java.awt.Component; +import java.awt.Container; +import java.awt.Cursor; +import java.awt.Dimension; +import java.awt.EventQueue; +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Robot; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; + +/* + * @test + * @bug 4050138 + * @key headful + * @summary Test to verify Lightweight components don't get + * enter/exit during drags + * @run main MouseEnterExitTest + */ + +class LWSquare extends Container { + int width; + int height; + + public LWSquare(Color color, int w, int h) { + setBackground(color); + setLayout(new FlowLayout()); + width = w; + height = h; + addMouseListener(new EnterExitAdapter(this)); + setName("LWSquare-" + color.toString()); + } + + public void paint(Graphics g) { + g.setColor(getBackground()); + g.fillRect(0, 0, getSize().width, getSize().height); + super.paint(g); + } + + public Dimension getPreferredSize() { + return new Dimension(width, height); + } + + public Cursor getCursor() { + return new Cursor(Cursor.CROSSHAIR_CURSOR); + } +} + +class MouseFrame extends Frame { + public LWSquare lw; + + public MouseFrame() { + super("MouseEnterExitTest"); + setLayout(new FlowLayout()); + + lw = new LWSquare(Color.red, 75, 75); + add(lw); + setBounds(50, 50, 300, 200); + setVisible(true); + System.out.println(getInsets()); + + addMouseListener(new EnterExitAdapter(this)); + addWindowListener( + new WindowAdapter() { + public void windowClosing(WindowEvent ev) { + dispose(); + } + } + ); + addKeyListener( + new KeyAdapter() { + public void keyPressed(KeyEvent ev) { + MouseEnterExitTest.getFrame().setTitle("MouseEnterExitTest"); + } + } + ); + } +} + + +public class MouseEnterExitTest { + static MouseFrame testFrame; + + public static void main(String[] args) throws Exception { + Robot robot = new Robot(); + + robot.setAutoDelay(100); + try { + EventQueue.invokeAndWait(() -> testFrame = new MouseFrame()); + if (testFrame.lw.getBackground() != Color.red) { + throw new RuntimeException("Initial Background color not matching"); + } + robot.waitForIdle(); + robot.delay(100); + EventQueue.invokeAndWait(() -> robot.mouseMove( + testFrame.getLocationOnScreen().x + testFrame.getSize().width / 2, + testFrame.getLocationOnScreen().y + testFrame.getSize().height / 2)); + robot.waitForIdle(); + robot.delay(100); + + if (testFrame.lw.getBackground() != Color.green) { + throw new RuntimeException("Initial Background color not matching"); + } + EventQueue.invokeAndWait(() -> robot.mouseMove( + testFrame.getLocationOnScreen().x + testFrame.getSize().width * 2, + testFrame.getLocationOnScreen().y + testFrame.getSize().height / 2)); + robot.waitForIdle(); + robot.delay(100); + + if (testFrame.lw.getBackground() != Color.red) { + throw new RuntimeException("Initial Background color not matching"); + } + } finally { + EventQueue.invokeAndWait(() -> { + if (testFrame != null) { + testFrame.dispose(); + } + }); + } + } + + public static Frame getFrame() { + return testFrame; + } +} + +class EnterExitAdapter extends MouseAdapter { + Component compToColor; + Color colorNormal; + + EnterExitAdapter(Component comp) { + compToColor = comp; + colorNormal = comp.getBackground(); + } + + public void mouseEntered(MouseEvent ev) { + compToColor.setBackground(Color.green); + compToColor.repaint(); + } + + public void mouseExited(MouseEvent ev) { + compToColor.setBackground(colorNormal); + compToColor.repaint(); + } +} diff --git a/test/jdk/java/awt/Mouse/MouseEnterExitTest2.java b/test/jdk/java/awt/Mouse/MouseEnterExitTest2.java new file mode 100644 index 000000000000..e09ac333447f --- /dev/null +++ b/test/jdk/java/awt/Mouse/MouseEnterExitTest2.java @@ -0,0 +1,140 @@ +/* + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Container; +import java.awt.Dimension; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.GridLayout; +import java.awt.Rectangle; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; + +/* + * @test + * @bug 4150851 + * @summary Tests enter and exit events when a lightweight component is on a border + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual MouseEnterExitTest2 + */ + +public class MouseEnterExitTest2 { + + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + 1. Verify that white component turns black whenever mouse enters the frame, + except when it enters the red rectangle. + 2. When the mouse enters the red part of the frame the component should stay white. + """; + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(35) + .testUI(EntryExitTest.initialize()) + .build() + .awaitAndCheck(); + } +} + +class EntryExitTest extends Component { + boolean inWin; + + public Dimension getPreferredSize() { + return new Dimension(200, 150); + } + + public void paint(Graphics g) { + Color c1, c2; + String s; + if (inWin) { + c1 = Color.black; + c2 = Color.white; + s = "IN"; + } else { + c2 = Color.black; + c1 = Color.white; + s = "OUT"; + } + g.setColor(c1); + Rectangle r = getBounds(); + g.fillRect(0, 0, r.width, r.height); + g.setColor(c2); + g.drawString(s, r.width / 2, r.height / 2); + } + + public static Frame initialize() { + EntryExitTest test = new EntryExitTest(); + MouseListener frameEnterExitListener = new MouseAdapter() { + public void mouseEntered(MouseEvent e) { + test.inWin = true; + test.repaint(); + } + + public void mouseExited(MouseEvent e) { + test.inWin = false; + test.repaint(); + } + }; + + Frame f = new Frame("Mouse Modifier Test"); + + f.add(test); + Component jc = new Component() { + public Dimension getPreferredSize() { + return new Dimension(100, 50); + } + + public void paint(Graphics g) { + Dimension d = getSize(); + g.setColor(Color.red); + g.fillRect(0, 0, d.width, d.height); + } + }; + final Container cont = new Container() { + public Dimension getPreferredSize() { + return new Dimension(100, 100); + } + }; + cont.setLayout(new GridLayout(2, 1)); + cont.add(jc); + jc.addMouseListener(new MouseAdapter() { + public void mouseEntered(MouseEvent e) { + //System.out.println("Component entered"); + } + public void mouseExited(MouseEvent e) { + //System.out.println("Component exited"); + } + }); + + f.add(cont, BorderLayout.NORTH); + f.addMouseListener(frameEnterExitListener); + f.pack(); + return f; + } +} diff --git a/test/jdk/java/awt/Mouse/MouseEnterExitTest3.java b/test/jdk/java/awt/Mouse/MouseEnterExitTest3.java new file mode 100644 index 000000000000..d5096d7acf02 --- /dev/null +++ b/test/jdk/java/awt/Mouse/MouseEnterExitTest3.java @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Button; +import java.awt.Frame; +import java.awt.GridLayout; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import javax.swing.JButton; + +/* + * @test + * @bug 4431868 + * @summary Tests that hw container doesn't receive mouse enter/exit events when mouse + * is moved between its lw and hw children + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual MouseEnterExitTest3 + */ + +public class MouseEnterExitTest3 { + static final Button button = new Button("Button"); + static final JButton jbutton = new JButton("JButton"); + static final Frame frame = new Frame("Mouse Enter/Exit Test"); + + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + 1. Move the mouse between Button and JButton + 2. Verify that the frame doesn't receive enter/exit events + (Enter/exit events are dumped to the area below) + 4. If you see enter/exit events dumped the test fails + """; + + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(35) + .testUI(initialize()) + .logArea(4) + .build() + .awaitAndCheck(); + } + + final static MouseListener listener = new MouseAdapter() { + public void mouseEntered(MouseEvent e) { + PassFailJFrame.log(e.toString()); + } + + public void mouseExited(MouseEvent e) { + PassFailJFrame.log(e.toString()); + } + }; + + public static Frame initialize() { + frame.setLayout(new GridLayout(2, 1)); + frame.add(button); + frame.add(jbutton); + frame.addMouseListener(listener); + frame.pack(); + return frame; + } +} diff --git a/test/jdk/java/awt/Mouse/MouseEnterExitTest4.java b/test/jdk/java/awt/Mouse/MouseEnterExitTest4.java new file mode 100644 index 000000000000..2ee3993ae4ed --- /dev/null +++ b/test/jdk/java/awt/Mouse/MouseEnterExitTest4.java @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Button; +import java.awt.Color; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.Robot; +import java.awt.Window; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; + +/* + * @test + * @bug 4431868 + * @key headful + * @summary Tests that window totally obscured by its child doesn't receive + * enter/exit events when located over another frame + * @run main MouseEnterExitTest4 + */ + +public class MouseEnterExitTest4 { + static Button button = new Button("Button"); + static Frame frame = new Frame("Mouse Enter/Exit test"); + static Window window = new Window(frame); + static MouseListener listener = new MouseAdapter() { + public void mouseEntered(MouseEvent e) { + throw new RuntimeException("Test failed due to Mouse Enter event"); + } + + public void mouseExited(MouseEvent e) { + throw new RuntimeException("Test failed due to Mouse Exit event"); + } + }; + + public static void main(String[] args) throws Exception { + Robot robot = new Robot(); + + robot.setAutoDelay(100); + try { + EventQueue.invokeAndWait(() -> { + button.setBackground(Color.red); + window.add(button); + frame.setBounds(100, 100, 300, 300); + window.setBounds(200, 200, 100, 100); + window.addMouseListener(listener); + window.setVisible(true); + frame.setVisible(true); + }); + robot.waitForIdle(); + robot.delay(200); + EventQueue.invokeAndWait(() -> robot.mouseMove( + frame.getLocationOnScreen().x + frame.getSize().width / 2, + frame.getLocationOnScreen().y + frame.getSize().height / 2)); + robot.waitForIdle(); + robot.delay(200); + EventQueue.invokeAndWait(() -> robot.mouseMove( + window.getLocationOnScreen().x + window.getSize().width * 2, + window.getLocationOnScreen().y + window.getSize().height / 2)); + robot.waitForIdle(); + robot.delay(500); + System.out.println("Test Passed"); + + } finally { + EventQueue.invokeAndWait(() -> { + if (frame != null) { + frame.dispose(); + } + if (window != null) { + window.dispose(); + } + }); + } + } +} diff --git a/test/jdk/java/awt/Mouse/MousePressedTest.java b/test/jdk/java/awt/Mouse/MousePressedTest.java new file mode 100644 index 000000000000..721d69bd5ddf --- /dev/null +++ b/test/jdk/java/awt/Mouse/MousePressedTest.java @@ -0,0 +1,87 @@ +/* + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Container; +import java.awt.GridLayout; +import javax.swing.JButton; +import javax.swing.JCheckBox; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.JRadioButton; +import javax.swing.JScrollPane; +import javax.swing.JToggleButton; + +/* + * @test + * @bug 4268759 + * @summary Tests whether clicking on the edge of a lightweight button + * causes sticking behavior + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual MousePressedTest + */ + +public class MousePressedTest { + + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + 1. Click and hold on the very bottom border (2-pixel-wide border) of the + JButton. Then drag the mouse straight down out of the JButton and + into the JRadioButton, and release the mouse button + 2. If the component remains highlighted as if the mouse button is still + down, the test fails + """; + + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(35) + .testUI(initialize()) + .build() + .awaitAndCheck(); + } + + public static JFrame initialize() { + JFrame f = new JFrame("JButton Test"); + JPanel p = new JPanel(); + p.setLayout(new GridLayout(2, 2)); + JButton b = new JButton("JButton"); + p.add(b); + JCheckBox cb = new JCheckBox("JCheckBox"); + p.add(cb); + JRadioButton rb = new JRadioButton("JRadioButton"); + p.add(rb); + p.add(new JToggleButton("JToggleButton")); + + JScrollPane j = new JScrollPane(p, + JScrollPane.VERTICAL_SCROLLBAR_ALWAYS, + JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS); + + Container c = f.getContentPane(); + c.setLayout(new GridLayout(1, 1)); + c.add(j); + f.pack(); + return f; + } +} diff --git a/test/jdk/java/awt/MouseInfo/ContainerResizeMousePositionTest.java b/test/jdk/java/awt/MouseInfo/ContainerResizeMousePositionTest.java new file mode 100644 index 000000000000..72aa4d93a5c7 --- /dev/null +++ b/test/jdk/java/awt/MouseInfo/ContainerResizeMousePositionTest.java @@ -0,0 +1,141 @@ +/* + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.BorderLayout; +import java.awt.Button; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.Point; +import java.awt.Robot; +import java.awt.event.ComponentAdapter; +import java.awt.event.ComponentEvent; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; + +/* + * @test + * @key headful + * @bug 4009555 + * @summary Unit test for a new method in Container class: getMousePosition(boolean) + * while Container resized. + */ + +public class ContainerResizeMousePositionTest { + private static Frame frame; + private static Button button; + private static Robot robot; + private static volatile Point frameLocation; + private static volatile Point newLoc; + private static boolean testSucceeded = false; + + private static final CountDownLatch eventCaught = new CountDownLatch(1); + + public static void main(String[] args) throws Exception { + try { + robot = new Robot(); + EventQueue.invokeAndWait(() -> createAndShowUI()); + robot.waitForIdle(); + robot.delay(1000); + testUI(); + } finally { + EventQueue.invokeAndWait(() -> { + if (frame != null) { + frame.dispose(); + } + }); + } + } + + private static void createAndShowUI() { + frame = new Frame("Testing getMousePosition() after resize"); + button = new Button("Button"); + frame.setLayout(new BorderLayout()); + frame.add(button); + frame.setSize(200, 200); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + } + + private static void testUI() throws Exception { + EventQueue.invokeAndWait(() -> { + frameLocation = frame.getLocationOnScreen(); + newLoc = new Point(frame.getWidth() + 10, frame.getHeight() + 10); + }); + + robot.mouseMove(frameLocation.x + newLoc.x, frameLocation.y + newLoc.y); + EventQueue.invokeAndWait(() -> { + button.addComponentListener(new ResizeAdapter()); + frame.setSize(frame.getWidth() * 2, frame.getHeight() * 2); + frame.validate(); + }); + robot.waitForIdle(); + robot.delay(500); + + if (!eventCaught.await(2, TimeUnit.SECONDS)) { + throw new RuntimeException("componentResized Event isn't" + + " received within a timeout"); + } + + if (!testSucceeded) { + throw new RuntimeException("Container.getMousePosition(boolean)" + + " returned incorrect result while Container resized"); + } + } + + static class ResizeAdapter extends ComponentAdapter { + int testStageCounter = 0; + @Override + public void componentResized(ComponentEvent e) { + Point pTrue = frame.getMousePosition(true); + if (frame.getMousePosition(false) == null) { + testStageCounter++; + System.out.println(""" + TEST STAGE 1 PASSED: + Container.getMousePosition(false) + returned NULL over Child Component + during resize. + """); + } + if (pTrue != null) { + testStageCounter++; + System.out.println(""" + TEST STAGE 2 PASSED: + Container.getMousePosition(true) + returned NON-NULL over Child Component + during resize. + """); + } + if (pTrue != null && pTrue.x == newLoc.x && pTrue.y == newLoc.y) { + testStageCounter++; + System.out.println(""" + TEST STAGE 3 PASSED: + Container.getMousePosition(true) + returned correct result over Child Component + during resize. + """); + } + testSucceeded = testStageCounter == 3; + eventCaught.countDown(); + } + } +} diff --git a/test/jdk/java/awt/Panel/PanelRepaint/PanelRepaint.java b/test/jdk/java/awt/Panel/PanelRepaint/PanelRepaint.java new file mode 100644 index 000000000000..da8de3947be9 --- /dev/null +++ b/test/jdk/java/awt/Panel/PanelRepaint/PanelRepaint.java @@ -0,0 +1,455 @@ +/* + * Copyright (c) 1999, 2024, 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 4148078 + * @summary Repainting problems in scrolled panel + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual PanelRepaint + */ + +import java.awt.Button; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.Panel; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.Scrollbar; +import java.awt.TextField; +import java.awt.event.AdjustmentEvent; +import java.awt.event.AdjustmentListener; +import java.awt.event.FocusEvent; +import java.awt.event.FocusListener; + +public class PanelRepaint extends Panel implements FocusListener { + static ScrollPanel sPanel; + static Panel panel; + + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + Using scrollbars or tab keys to scroll the panel and + the panel is messy sometimes, e.g. one row bumps into + another. If all components painted correctly, the test passes. + Otherwise, the test fails. + """; + + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .columns(35) + .testUI(PanelRepaint::createUI) + .build() + .awaitAndCheck(); + } + + public static Frame createUI() { + Frame f = new Frame("Panel Repaint Test"); + f.setLayout(new FlowLayout()); + f.setSize(620, 288); + PanelRepaint pr = new PanelRepaint(); + + panel = new Panel(); + panel.setLayout(null); + panel.setSize(500, 500); + sPanel = new ScrollPanel(panel); + + Button btn = new Button("Open"); + pr.addComp(btn); + btn.setBounds(400, 10, 60, 20); + btn.setActionCommand("OPEN"); + + Button btn1 = new Button("Close"); + pr.addComp(btn1); + btn1.setBounds(400, 50, 60, 20); + btn1.setActionCommand("CLOSE"); + + TextField t1 = new TextField("1"); + pr.addComp(t1); + t1.setBounds(10, 10, 100, 20); + TextField t2 = new TextField("2"); + pr.addComp(t2); + t2.setBounds(10, 50, 100, 20); + TextField t3 = new TextField("3"); + pr.addComp(t3); + t3.setBounds(10, 90, 100, 20); + TextField t4 = new TextField("4"); + pr.addComp(t4); + t4.setBounds(10, 130, 100, 20); + TextField t5 = new TextField("5"); + pr.addComp(t5); + t5.setBounds(10, 170, 100, 20); + TextField t6 = new TextField("6"); + pr.addComp(t6); + t6.setBounds(10, 210, 100, 20); + TextField t7 = new TextField("7"); + pr.addComp(t7); + t7.setBounds(10, 250, 100, 20); + TextField t8 = new TextField("8"); + pr.addComp(t8); + t8.setBounds(10, 290, 100, 20); + TextField t9 = new TextField("9"); + pr.addComp(t9); + t9.setBounds(10, 330, 100, 20); + + TextField t11 = new TextField("1"); + pr.addComp(t11); + t11.setBounds(120, 10, 100, 20); + TextField t12 = new TextField("2"); + pr.addComp(t12); + t12.setBounds(120, 50, 100, 20); + TextField t13 = new TextField("3"); + pr.addComp(t13); + t13.setBounds(120, 90, 100, 20); + TextField t14 = new TextField("4"); + pr.addComp(t14); + t14.setBounds(120, 130, 100, 20); + TextField t15 = new TextField("5"); + pr.addComp(t15); + t15.setBounds(120, 170, 100, 20); + TextField t16 = new TextField("6"); + pr.addComp(t16); + t16.setBounds(120, 210, 100, 20); + TextField t17 = new TextField("7"); + pr.addComp(t17); + t17.setBounds(120, 250, 100, 20); + TextField t18 = new TextField("8"); + pr.addComp(t18); + t18.setBounds(120, 290, 100, 20); + TextField t19 = new TextField("9"); + pr.addComp(t19); + t19.setBounds(120, 330, 100, 20); + + + TextField t21 = new TextField("1"); + pr.addComp(t21); + t21.setBounds(240, 10, 100, 20); + TextField t22 = new TextField("2"); + pr.addComp(t22); + t22.setBounds(240, 50, 100, 20); + TextField t23 = new TextField("3"); + pr.addComp(t23); + t23.setBounds(240, 90, 100, 20); + TextField t24 = new TextField("4"); + pr.addComp(t24); + t24.setBounds(240, 130, 100, 20); + TextField t25 = new TextField("5"); + pr.addComp(t25); + t25.setBounds(240, 170, 100, 20); + TextField t26 = new TextField("6"); + pr.addComp(t26); + t26.setBounds(240, 210, 100, 20); + TextField t27 = new TextField("7"); + pr.addComp(t27); + t27.setBounds(240, 250, 100, 20); + TextField t28 = new TextField("8"); + pr.addComp(t28); + t28.setBounds(240, 290, 100, 20); + TextField t29 = new TextField("9"); + pr.addComp(t29); + t29.setBounds(240, 330, 100, 20); + + pr.add(sPanel); + f.add(pr); + sPanel.setBounds(100, 100, 500, 250); + sPanel.doLayout(); + return f; + } + + public void addComp(Component c) { + panel.add(c); + c.addFocusListener(this); + } + + public void focusGained(FocusEvent e) { + sPanel.showComponent(e.getComponent()); + } + + public void focusLost(FocusEvent e) { + } +} + +class ScrollPanel extends Panel implements AdjustmentListener { + /** + * Constructor + */ + public ScrollPanel(Component c) { + setLayout(null); + setBackground(Color.lightGray); + add(hScroll = new Scrollbar(Scrollbar.HORIZONTAL)); + add(vScroll = new Scrollbar(Scrollbar.VERTICAL)); + add(square = new Panel()); + square.setBackground(Color.lightGray); + add(c); + } + + /** + * Scroll up/down/left/right to show the component specified + * + * @param comp is the component to be shown + */ + public void showComponent(Component comp) { + Component view = getComponent(3); + Rectangle viewRect = view.getBounds(); + Rectangle scrollRect = getBounds(); + Rectangle rect = comp.getBounds(); + while (comp != null) { + Component parent = comp.getParent(); + if (parent == null || parent == view) { + break; + } + Point p = parent.getLocation(); + rect.x += p.x; + rect.y += p.y; + comp = parent; + } + + int i = viewRect.y + rect.y; + int j = (viewRect.y + rect.y + rect.height + ScrollPanel.H_HEIGHT) + - (scrollRect.height); + + if (i < 0) { + vertUpdate(i); + } else if (j > 0) { + vertUpdate(j); + } + + i = viewRect.x + rect.x; + j = (viewRect.x + rect.x + rect.width + (V_WIDTH * 2)) - (scrollRect.width); + + if (i < 0) { + horzUpdate(i); + } else if (j > 0) { + horzUpdate(j); + } + } + + /** + * Returns the panel component of ScrollPanel + * + * @return the panel component of ScrollPanel + */ + public Component getScrolled() { + return getComponent(3); + } + + /** + * updates the scroll panel vertically with value i passed + * + * @param i the value to be updated with + */ + public void vertUpdate(int i) { + update(true, vScroll.getValue() + i); + } + + /** + * updates the scroll panel horizontally with value i passed + * + * @param i the value to be updated with + */ + public void horzUpdate(int i) { + update(false, hScroll.getValue() + i); + } + + /** + * updates the scroll panel vertically if bVert is true else horizontally + * + * @param n is the value + */ + public void update(boolean bVert, int n) { + if (n < 0) n = 0; + if (bVert) { + if (n > max.height) { + n = max.height; + } + if (offset.y != n) { + offset.y = n; + vScroll.setValue(n); + } + } else { + if (n > max.width) { + n = max.width; + } + if (offset.x != n) { + offset.x = n; + hScroll.setValue(n); + } + } + getScrolled().setLocation(-offset.x, -offset.y); + } + + /** + * Implementation of AdjustmentListener + */ + public void adjustmentValueChanged(AdjustmentEvent e) { + boolean bVert = e.getSource() == vScroll; + update(bVert, e.getValue()); + } + + /** + * Reimplementation of Component Methods + */ + public void addNotify() { + super.addNotify(); + vScroll.addAdjustmentListener(this); + hScroll.addAdjustmentListener(this); + } + + public void removeNotify() { + super.removeNotify(); + vScroll.removeAdjustmentListener(this); + hScroll.removeAdjustmentListener(this); + } + + public void setBounds(int x, int y, int w, int h) { + super.setBounds(x, y, w, h); + doLayout(); + } + + public void doLayout() { + Component c = getScrolled(); + Dimension d = c.getSize(); + if (d.width == 0 || d.height == 0) { + d = c.getPreferredSize(); + } + vert = 0; + horz = 0; + Dimension m = getSize(); + if (d.height > m.height || isScroll(true, m.height - horz, 0, d.height)) { + vert = V_WIDTH; + } + if (d.width + vert > m.width || isScroll(false, m.width - vert, 0, d.width)) { + horz = H_HEIGHT; + } + if (d.height + horz > m.height || isScroll(true, m.height - horz, 0, d.height)) { + vert = V_WIDTH; + } + if (d.width + vert > m.width || isScroll(false, m.width - vert, 0, d.width)) { + horz = H_HEIGHT; + } + if (horz != 0) { + if (m.width <= 0) { + m.width = 1; + } + hScroll.setBounds(0, m.height - H_HEIGHT, m.width - vert, H_HEIGHT); + hScroll.setValues(offset.x, m.width - vert, 0, d.width); + int i = d.width / 10; + if (i < 2) { + i = 2; + } + hScroll.setBlockIncrement(i); + i = d.width / 50; + if (i < 1) { + i = 1; + } + hScroll.setUnitIncrement(i); + max.width = d.width; + hScroll.setVisible(true); + } else { + offset.x = 0; + } + if (vert != 0) { + if (m.height <= 0) { + m.height = 1; + } + vScroll.setBounds(m.width - V_WIDTH, 0, V_WIDTH, m.height - horz); + vScroll.setValues(offset.y, m.height - horz, 0, d.height); + int i = d.height / 10; + if (i < 2) i = 2; + vScroll.setBlockIncrement(i); + i = d.height / 50; + if (i < 1) i = 1; + vScroll.setUnitIncrement(i); + max.height = d.height; + vScroll.setVisible(true); + } else { + offset.y = 0; + } + if (horz != 0 && vert != 0) { + square.setBounds(m.width - V_WIDTH, m.height - H_HEIGHT, V_WIDTH, H_HEIGHT); + square.setVisible(true); + } else { + square.setVisible(false); + } + c.setBounds(-offset.x, -offset.y, d.width, d.height); + c.repaint(); + updateScroll(true, offset.y); + updateScroll(false, offset.x); + } + + public Dimension getPreferredSize() { + return getScrolled().getPreferredSize(); + } + + public Dimension getMinimumSize() { + return getScrolled().getMinimumSize(); + } + + boolean isScroll(boolean bVert, int visible, int min, int max) { + int tot = max - min; + int net = tot - visible; + if (net <= 0) { + return false; + } + return true; + } + + void updateScroll(boolean bVert, int n) { + Component c = getScrolled(); + Dimension d = c.getSize(); + Dimension m = getSize(); + m.width -= vert; + m.height -= horz; + if (bVert) { + if (n >= 0 && d.height > m.height) { + if (n + m.height > d.height) + n = d.height - m.height; + } else + n = 0; + update(true, n); + } else { + if (n >= 0 && d.width > m.width) { + if (n + m.width > d.width) + n = d.width - m.width; + } else + n = 0; + update(false, n); + } + } + + static Scrollbar hScroll; + static Scrollbar vScroll; + static int vert = 0; + static int horz = 0; + + static Point offset = new Point(); + static Dimension max = new Dimension(); + // ScrollTimer timer; + static Component square; + final static int V_WIDTH = 17; + final static int H_HEIGHT = 17; +} diff --git a/test/jdk/java/awt/PopupMenu/ActivePopupCrashTest.java b/test/jdk/java/awt/PopupMenu/ActivePopupCrashTest.java new file mode 100644 index 000000000000..51c12964e629 --- /dev/null +++ b/test/jdk/java/awt/PopupMenu/ActivePopupCrashTest.java @@ -0,0 +1,220 @@ +/* + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.BorderLayout; +import java.awt.Button; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.Label; +import java.awt.Menu; +import java.awt.MenuBar; +import java.awt.MenuItem; +import java.awt.Panel; +import java.awt.Point; +import java.awt.PopupMenu; +import java.awt.Robot; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.InputEvent; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; + +import java.util.Hashtable; + +/* + * @test + * @bug 4214550 + * @summary Tests that there is no seg fault on repeatedly showing + * PopupMenu by right-clicking Label, Panel or Button + * @key headful + * @run main ActivePopupCrashTest + */ + +public class ActivePopupCrashTest { + private static Frame f; + private static Label l; + private static Button b; + private static Panel p; + + private static volatile Point labelCenter; + private static volatile Point buttonCenter; + private static volatile Point panelCenter; + + public static void main(String[] args) throws Exception { + final int REPEAT_COUNT = 5; + try { + Robot robot = new Robot(); + robot.setAutoDelay(50); + EventQueue.invokeAndWait(ActivePopupCrashTest::createAndShowUI); + robot.delay(1000); + + EventQueue.invokeAndWait(() -> { + labelCenter = getCenterPoint(l); + buttonCenter = getCenterPoint(b); + panelCenter = getCenterPoint(p); + }); + + for (int i = 0; i < REPEAT_COUNT; i++) { + robot.mouseMove(labelCenter.x, labelCenter.y); + robot.mousePress(InputEvent.BUTTON3_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON3_DOWN_MASK); + + robot.mouseMove(buttonCenter.x, buttonCenter.y); + robot.mousePress(InputEvent.BUTTON3_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON3_DOWN_MASK); + + robot.mouseMove(panelCenter.x, panelCenter.y); + robot.mousePress(InputEvent.BUTTON3_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON3_DOWN_MASK); + } + + // To close the popup, otherwise test fails on windows with timeout error + robot.mouseMove(panelCenter.x - 5, panelCenter.y - 5); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + } finally { + EventQueue.invokeAndWait(() -> { + if (f != null) { + f.dispose(); + } + }); + } + } + + private static Point getCenterPoint(Component component) { + Point p = component.getLocationOnScreen(); + Dimension size = component.getSize(); + return new Point(p.x + size.width / 2, p.y + size.height / 2); + } + + public static void createAndShowUI() { + f = new Frame("ActivePopupCrashTest Test"); + MenuItem item = new MenuItem("file-1"); + item.addActionListener(ActivePopupCrashTest::logActionEvent); + Menu m = new Menu("file"); + m.add(item); + item = new MenuItem("file-2"); + m.add(item); + MenuBar mb = new MenuBar(); + mb.add(m); + + f.setMenuBar(mb); + f.setSize(200, 200); + f.setLayout(new BorderLayout()); + + l = new Label("label"); + addPopup(l, "label"); + f.add(l, BorderLayout.NORTH); + + p = new Panel(); + addPopup(p, "panel"); + f.add(p, BorderLayout.CENTER); + + b = new Button("button"); + addPopup(b, "button"); + f.add(b, BorderLayout.SOUTH); + + f.setSize(400, 300); + f.setLocationRelativeTo(null); + f.setVisible(true); + } + + static void addPopup(Component c, String name) { + PopupMenu pm = new PopupMenu(); + MenuItem mi = new MenuItem(name + "-1"); + mi.addActionListener(ActivePopupCrashTest::logActionEvent); + pm.add(mi); + + mi = new MenuItem(name + "-2"); + pm.add(mi); + + setHash(c, pm); + c.add(pm); + c.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + mouseAction("mouseClicked", e); + } + + @Override + public void mousePressed(MouseEvent e) { + mouseAction("mousePressed", e); + } + + @Override + public void mouseReleased(MouseEvent e) { + mouseAction("mouseReleased", e); + } + }); + } + + static void logActionEvent(ActionEvent e) { + System.out.println("actionPerformed, event=" + e + ", mod=" + getMods(e)); + System.out.println("command=" + e.getActionCommand()); + System.out.println("param=" + e.paramString()); + System.out.println("source=" + e.getSource()); + } + + static String getMods(ActionEvent e) { return getMods(e.getModifiers()); } + + static String getMods(MouseEvent e) { return getMods(e.getModifiers()); } + + static String getMods(int mods) { + String modstr = ""; + if ((mods & ActionEvent.SHIFT_MASK) == ActionEvent.SHIFT_MASK) { + modstr += (" SHIFT"); + } else if ((mods & ActionEvent.ALT_MASK) == ActionEvent.ALT_MASK) { + modstr += (" ALT"); + } else if ((mods & ActionEvent.CTRL_MASK) == ActionEvent.CTRL_MASK) { + modstr += (" CTRL"); + } else if ((mods & ActionEvent.META_MASK) == ActionEvent.META_MASK) { + modstr += (" META"); + } + return modstr; + } + + static void mouseAction(String which, MouseEvent e) { + Component c = e.getComponent(); + System.out.println(which + " e = " + e + " , mods = " + getMods(e) + + " , component = " + c); + if (e.isPopupTrigger()) { + System.out.println("isPopup"); + PopupMenu pm = getHash(c); + pm.show(c, c.getWidth() / 2, c.getHeight() / 2); + } + } + + static Hashtable popupTable = new Hashtable<>(); + + static void setHash(Component c, PopupMenu p) { + popupTable.put(c, p); + } + + static PopupMenu getHash(Component c) { + return popupTable.get(c); + } + +} diff --git a/test/jdk/java/awt/PopupMenu/KeyTraversalCrash.java b/test/jdk/java/awt/PopupMenu/KeyTraversalCrash.java new file mode 100644 index 000000000000..4d1d4e8f8319 --- /dev/null +++ b/test/jdk/java/awt/PopupMenu/KeyTraversalCrash.java @@ -0,0 +1,126 @@ +/* + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Dimension; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.Label; +import java.awt.Menu; +import java.awt.MenuItem; +import java.awt.Point; +import java.awt.PopupMenu; +import java.awt.Robot; + +import java.awt.event.InputEvent; +import java.awt.event.KeyEvent; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; + +/* + * @test + * @bug 5021183 + * @summary Tests Key Traversal doesn't crash PopupMenu + * @key headful + * @run main KeyTraversalCrash + */ + +public class KeyTraversalCrash { + private static Frame f; + private static Label label; + + private static volatile Point loc; + private static volatile Dimension dim; + + public static void main(String[] args) throws Exception { + try { + Robot robot = new Robot(); + robot.setAutoDelay(100); + EventQueue.invokeAndWait(KeyTraversalCrash::createAndShowUI); + robot.delay(1000); + + EventQueue.invokeAndWait(() -> { + loc = label.getLocationOnScreen(); + dim = label.getSize(); + }); + + robot.mouseMove(loc.x + 20, loc.y + 20); + robot.mousePress(InputEvent.BUTTON3_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON3_DOWN_MASK); + + robot.mouseMove(loc.x + 25, loc.y + 25); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + + robot.keyPress(KeyEvent.VK_LEFT); + robot.keyRelease(KeyEvent.VK_LEFT); + + robot.keyPress(KeyEvent.VK_DOWN); + robot.keyRelease(KeyEvent.VK_DOWN); + + // To close the popup, otherwise test fails on windows with timeout error + robot.mouseMove(loc.x + dim.width - 20, loc.y + dim.height - 20); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + } finally { + EventQueue.invokeAndWait(() -> { + if (f != null) { + f.dispose(); + } + }); + } + } + + public static void createAndShowUI() { + f = new Frame("KeyTraversalCrash Test"); + final PopupMenu popup = new PopupMenu(); + for (int i = 0; i < 10; i++) { + Menu menu = new Menu("Menu " + i); + for(int j = 0; j < 10; j++) { + MenuItem menuItem = new MenuItem("MenuItem " + j); + menu.add(menuItem); + } + popup.add(menu); + } + label = new Label("Label"); + f.add(label); + f.add(popup); + label.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent me) { + if (me.isPopupTrigger()) { + popup.show(me.getComponent(), me.getX(), me.getY()); + } + } + + @Override + public void mouseReleased(MouseEvent me) { + if (me.isPopupTrigger()) { + popup.show(me.getComponent(), me.getX(), me.getY()); + } + } + }); + f.setSize(200, 200); + f.setLocationRelativeTo(null); + f.setVisible(true); + } +} diff --git a/test/jdk/java/awt/PopupMenu/MultiplePopupMenusTest.java b/test/jdk/java/awt/PopupMenu/MultiplePopupMenusTest.java new file mode 100644 index 000000000000..f939186ca072 --- /dev/null +++ b/test/jdk/java/awt/PopupMenu/MultiplePopupMenusTest.java @@ -0,0 +1,86 @@ +/* + * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.AWTEvent; +import java.awt.Button; +import java.awt.Frame; +import java.awt.MenuItem; +import java.awt.PopupMenu; + +import java.awt.event.MouseEvent; + +/* + * @test + * @bug 4186663 4265525 + * @summary Tests that multiple PopupMenus cannot appear at the same time + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual MultiplePopupMenusTest + */ + +public class MultiplePopupMenusTest { + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + Click the right mouse button on the button + If multiple popups appear at the same time the + test fails else passes. + """; + + PassFailJFrame.builder() + .title("MultiplePopupMenusTest Instruction") + .instructions(INSTRUCTIONS) + .columns(30) + .testUI(MultiplePopupMenusTest::createUI) + .build() + .awaitAndCheck(); + } + + private static Frame createUI() { + Frame fr = new Frame("MultiplePopupMenusTest Test"); + TestButton button = new TestButton("button"); + fr.add(button); + fr.setSize(200, 200); + return fr; + } + + static class TestButton extends Button { + public TestButton(String title) { + super(title); + enableEvents(AWTEvent.MOUSE_EVENT_MASK); + } + + @Override + public void processMouseEvent(MouseEvent e) { + if (e.isPopupTrigger()) { + for (int i = 0; i < 10; i++) { + PopupMenu pm = new PopupMenu("Popup " + i); + pm.add(new MenuItem("item 1")); + pm.add(new MenuItem("item 2")); + add(pm); + pm.show(this, e.getX() + i * 5, e.getY() + i * 5); + } + } + super.processMouseEvent(e); + } + } +} diff --git a/test/jdk/java/awt/PopupMenu/PeripheryOfScreen.java b/test/jdk/java/awt/PopupMenu/PeripheryOfScreen.java new file mode 100644 index 000000000000..b169a7d9692a --- /dev/null +++ b/test/jdk/java/awt/PopupMenu/PeripheryOfScreen.java @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Button; +import java.awt.Frame; +import java.awt.MenuItem; +import java.awt.PopupMenu; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +/* + * @test + * @bug 6267162 + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @summary Popup Menu gets hidden below the screen when opened near the periphery + * of the screen, XToolkit Test if popup menu window is adjusted on screen + * when trying to show outside + * @run main/manual PeripheryOfScreen + */ + +public class PeripheryOfScreen { + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + Click on the button to show popup menu in the center of + frame. Move frame beyond the edge of screen and click on + button to show the popup menu and see if popup menu is + adjusted to the edge. + + Press Pass if popup menu behaves as per instruction, otherwise + press Fail. + """; + + PassFailJFrame.builder() + .title("PeripheryOfScreen Instruction") + .instructions(INSTRUCTIONS) + .columns(40) + .testUI(PeripheryOfScreen::createUI) + .build() + .awaitAndCheck(); + } + + private static Frame createUI () { + Frame f = new Frame("PeripheryOfScreen Test frame"); + Button b = new Button("Click to show popup menu"); + PopupMenu pm = new PopupMenu("Test menu"); + MenuItem i = new MenuItem("Click me"); + pm.add(i); + b.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + pm.show(f, 100, 100); + } + }); + f.add(b); + f.add(pm); + f.setSize(300, 200); + f.toFront(); + return f; + } +} diff --git a/test/jdk/java/awt/PopupMenu/PopupHangTest.java b/test/jdk/java/awt/PopupMenu/PopupHangTest.java new file mode 100644 index 000000000000..bfdf6bf2abe3 --- /dev/null +++ b/test/jdk/java/awt/PopupMenu/PopupHangTest.java @@ -0,0 +1,258 @@ +/* + * Copyright (c) 1998, 2024, 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 4145193 + * @summary Mouse event activates multiple pull-down menus when testing Oracle app + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual PopupHangTest +*/ + +import java.awt.BorderLayout; +import java.awt.Component; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Label; +import java.awt.MenuItem; +import java.awt.PopupMenu; +import java.awt.event.FocusEvent; +import java.awt.event.KeyEvent; +import java.awt.event.MouseEvent; +import java.awt.event.FocusListener; +import java.awt.event.KeyListener; +import java.awt.event.MouseListener; +import java.awt.event.MouseMotionListener; + +public class PopupHangTest { + private static final String INSTRUCTIONS = """ + 2 areas yellow and red should be seen. + + Clicking in these areas should cause a menu to popup. See if you can + get the menu to stay up and grab all input. One way to do this is to + click and hold the mouse to popup the menu, move away/outside of the + menu and release the mouse. At that point, the input is grabbed and + the *only* way out is to hit the escape key. Try this on both areas. + + To make things worse, when the popup menu is up, click repeatedly on + the LightWeight component area. Hit escape. Do you see multiple menus appearing ? + + If you do not see either of the two problems above, the problem is fixed. + Press pass, else press Fail"""; + + static Frame frame; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("PopupHangTest") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(45) + .testUI(PopupHangTest::createUI) + .logArea() + .build() + .awaitAndCheck(); + } + + private static Frame createUI() { + TestMenuButton m1; + TestHeavyButton m2; + frame = new Frame(); + + frame.setLayout (new BorderLayout ()); + + m1 = new TestMenuButton("LightWeight component"); + m1.setBackground(Color.yellow); + + m2 = new TestHeavyButton("HeavyWeight component"); + m2.setBackground(Color.red); + + frame.add("North", m1); + frame.add("South", m2); + + m1.requestFocus(); + frame.setSize(200, 110); + return frame; + } + +} + +class TestMenuButton extends Component implements MouseListener, + MouseMotionListener, + KeyListener, + FocusListener { + + PopupMenu popupMenu = null; + String name; + + TestMenuButton(String name) { + PopupMenu menu = popupMenu = new PopupMenu("Popup"); + menu.add(new MenuItem("item 1")); + menu.add(new MenuItem("item 2")); + menu.add(new MenuItem("item 3")); + this.add(menu); + this.name = name; + addMouseListener(this); + addMouseMotionListener(this); + addKeyListener(this); + addFocusListener(this); + } + + void println(String messageIn) { + PassFailJFrame.log(messageIn); + } + + public void mouseClicked(MouseEvent event) { + /* + popupMenu.show(this, event.getX(), event.getY()); + */ + } + public void mousePressed(MouseEvent event) { + println("TestMenuButton.mousePressed() called !!"); + popupMenu.show(this, event.getX(), event.getY()); + } + public void mouseReleased(MouseEvent event) { + println("TestMenuButton.mouseReleased() called !!"); + } + public void mouseEntered(MouseEvent event) { + println("TestMenuButton.mouseEntered() called !!"); + requestFocus(); + } + public void mouseExited(MouseEvent event) { + } + + public void mouseDragged(MouseEvent event) { + println("TestMenuButton.mouseDragged() called !!"); + } + public void mouseMoved(MouseEvent event) { + println("TestMenuButton.mouseMoved() called !!"); + } + + public void keyPressed(KeyEvent event) { + println("TestMenuButton.keyPressed() called !!"); + } + public void keyReleased(KeyEvent event) { + println("TestMenuButton.keyReleased() called !!"); + } + public void keyTyped(KeyEvent event) { + println("TestMenuButton.keyTyped() called !!"); + } + + + public void focusGained(FocusEvent e){ + println("TestMenuButton.focusGained():" + e); + } + public void focusLost(FocusEvent e){ + println("TestMenuButton.focusLost():" + e); + } + + + public void paint(Graphics g) { + Dimension d = getSize(); + + g.setColor(getBackground()); + g.fillRect(0, 0, d.width-1, d.height-1); + + g.setColor(Color.black); + g.drawString(name, 15, 15); + } + + public Dimension getPreferredSize() { + return (new Dimension(200, 50)); + } + +} + +class TestHeavyButton extends Label implements MouseListener, + MouseMotionListener, + KeyListener, + FocusListener { + + PopupMenu popupMenu = null; + String name; + + TestHeavyButton(String name) { + super(name); + PopupMenu menu = popupMenu = new PopupMenu("Popup"); + menu.add(new MenuItem("item 1")); + menu.add(new MenuItem("item 2")); + menu.add(new MenuItem("item 3")); + this.add(menu); + this.name = name; + addMouseListener(this); + addMouseMotionListener(this); + addKeyListener(this); + addFocusListener(this); + } + + void println(String messageIn) { + PassFailJFrame.log(messageIn); + } + + public void mouseClicked(MouseEvent event) { + /* + popupMenu.show(this, event.getX(), event.getY()); + */ + } + public void mousePressed(MouseEvent event) { + println("TestHeavyButton.mousePressed() called !!"); + popupMenu.show(this, event.getX(), event.getY()); + } + public void mouseReleased(MouseEvent event) { + println("TestHeavyButton.mouseReleased() called !!"); + } + public void mouseEntered(MouseEvent event) { + println("TestHeavyButton.mouseEntered() called !!"); + requestFocus(); + } + public void mouseExited(MouseEvent event) { + } + + public void mouseDragged(MouseEvent event) { + println("TestHeavyButton.mouseDragged() called !!"); + } + public void mouseMoved(MouseEvent event) { + println("TestHeavyButton.mouseMoved() called !!"); + } + + public void keyPressed(KeyEvent event) { + println("TestHeavyButton.keyPressed() called !!"); + } + public void keyReleased(KeyEvent event) { + println("TestHeavyButton.keyReleased() called !!"); + } + public void keyTyped(KeyEvent event) { + println("TestHeavyButton.keyTyped() called !!"); + } + + public void focusGained(FocusEvent e){ + println("TestHeavyButton.focusGained():" + e); + } + public void focusLost(FocusEvent e){ + println("TestHeavyButton.focusLost():" + e); + } + +} + diff --git a/test/jdk/java/awt/PopupMenu/PopupLeadingSeparatorTest.java b/test/jdk/java/awt/PopupMenu/PopupLeadingSeparatorTest.java new file mode 100644 index 000000000000..c9274e9b807f --- /dev/null +++ b/test/jdk/java/awt/PopupMenu/PopupLeadingSeparatorTest.java @@ -0,0 +1,81 @@ +/* + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Component; +import java.awt.Frame; +import java.awt.Font; +import java.awt.MenuItem; +import java.awt.PopupMenu; + +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; + +/* + * @test + * @bug 4169155 + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @summary Popup menus get a leading separator on Motif system + * @run main/manual PopupLeadingSeparatorTest + */ + +public class PopupLeadingSeparatorTest { + public static void main(String[] args) throws Exception { + PopupLeadingSeparatorTest obj = new PopupLeadingSeparatorTest(); + String INSTRUCTIONS = """ + Press mouse button on the frame. Popup menu without leading + separator should appear. + If a PopupMenu behaves same, press Pass, else press Fail. + """; + + PassFailJFrame.builder() + .title("PopupLeadingSeparatorTest Instruction") + .instructions(INSTRUCTIONS) + .columns(40) + .testUI(obj::createUI) + .build() + .awaitAndCheck(); + } + + private Frame createUI() { + Frame f = new Frame("PopupLeadingSeparatorTest Test"); + PopupMenu popupMenu = new PopupMenu("Popup Menu Title"); + popupMenu.add(new MenuItem("Item1")); + PopupMenu cascadeMenu = new PopupMenu("Multifont menu"); + cascadeMenu.add(new MenuItem("Item1")); + MenuItem item2 = new MenuItem("Item2"); + item2.setFont(new Font("Serif", Font.BOLD, 36)); + cascadeMenu.add(item2); + + popupMenu.add(cascadeMenu); + f.add(popupMenu); + f.setSize(300, 150); + f.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent evt) { + popupMenu.show((Component) evt.getSource(), evt.getX(), evt.getY()); + } + }); + return f; + } +} diff --git a/test/jdk/java/awt/PopupMenu/PopupMenuCrash.java b/test/jdk/java/awt/PopupMenu/PopupMenuCrash.java new file mode 100644 index 000000000000..7ba738b21d27 --- /dev/null +++ b/test/jdk/java/awt/PopupMenu/PopupMenuCrash.java @@ -0,0 +1,106 @@ +/* + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.Label; +import java.awt.MenuItem; +import java.awt.PopupMenu; + +import java.awt.event.InputEvent; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; + +/* + * @test + * @bug 4281273 + * @summary PopupMenu crashed in Java. Simplified testcase. + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @requires (os.family == "windows") + * @run main/manual PopupMenuCrash + */ + +public class PopupMenuCrash { + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + This tests a windows specific problem. + When you see a frame titled "PopupMenuCrash Test", right-click on it + several times for a few seconds. Then wait about 10 seconds before the + PopupMenus start to appear. Then dispose them one by one by clicking on them. + When PopupMenus do not appear anymore, press Pass. + In case of a failure, you'll see a crash. + """; + + PassFailJFrame.builder() + .title("PopupMenuCrash Instruction") + .instructions(INSTRUCTIONS) + .columns(40) + .testUI(PopupMenuCrash::createUI) + .build() + .awaitAndCheck(); + } + + private static Frame createUI() { + final Frame f = new Frame("PopupMenuCrash Test"); + f.setLayout(new FlowLayout()); + f.add(new Label("Press right mouse button inside this frame.")); + f.add(new Label("A pop-up menu should appear.")); + f.addMouseListener(new MouseAdapter() { + PopupMenu popup; + boolean firstPress = true; + + @Override + public void mousePressed(MouseEvent evt) { + if (firstPress) { + firstPress = false; + try { + Thread.sleep(10000); + } catch (InterruptedException ignored) { + } + } + + if ((evt.getModifiers() & InputEvent.BUTTON3_MASK) != 0) { + popup = new PopupMenu("Popup Menu Title"); + MenuItem mi = new MenuItem("MenuItem"); + popup.add(mi); + f.add(popup); + popup.show(evt.getComponent(), evt.getX(), evt.getY()); + } + } + + @Override + public void mouseReleased(MouseEvent evt) { + if ((evt.getModifiers() & InputEvent.BUTTON3_MASK) != 0) { + if (popup != null) { + f.remove(popup); + popup = null; + } + } + } + }); + + f.setSize(400, 350); + return f; + } +} diff --git a/test/jdk/java/awt/PopupMenu/PopupMenuShowTest.java b/test/jdk/java/awt/PopupMenu/PopupMenuShowTest.java new file mode 100644 index 000000000000..b36fdc5d19c2 --- /dev/null +++ b/test/jdk/java/awt/PopupMenu/PopupMenuShowTest.java @@ -0,0 +1,77 @@ +/* + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.Label; +import java.awt.MenuItem; +import java.awt.PopupMenu; + +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; + +/* + * @test + * @bug 4168006 4196790 + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @summary Popup menu test fails on x86/Solaris 2.6 combination. + * @run main/manual PopupMenuShowTest + */ + +public class PopupMenuShowTest { + public static void main(String[] args) throws Exception { + PopupMenuShowTest obj = new PopupMenuShowTest(); + String INSTRUCTIONS = """ + Press the right mouse button in the PopupTest window. + If a PopupMenu appears, press Pass, else press Fail. + """; + + PassFailJFrame.builder() + .title("PopupMenuShowTest Instruction") + .instructions(INSTRUCTIONS) + .columns(40) + .testUI(obj::createUI) + .build() + .awaitAndCheck(); + } + + private Frame createUI() { + Frame f = new Frame("PopupMenuShowTest Test"); + f.setLayout(new FlowLayout()); + f.add(new Label("Press right mouse button inside this frame.")); + f.add(new Label("A pop-up menu should appear.")); + PopupMenu popupMenu = new PopupMenu("Popup Menu Title"); + MenuItem mi = new MenuItem("Menu Item"); + popupMenu.add(mi); + f.add(popupMenu); + f.setSize(400, 350); + f.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + popupMenu.show(e.getComponent(), e.getX(), e.getY()); + } + }); + return f; + } +} diff --git a/test/jdk/java/awt/PopupMenu/PopupMenuVisuals.java b/test/jdk/java/awt/PopupMenu/PopupMenuVisuals.java new file mode 100644 index 000000000000..3aa437e48454 --- /dev/null +++ b/test/jdk/java/awt/PopupMenu/PopupMenuVisuals.java @@ -0,0 +1,101 @@ +/* + * Copyright (c) 2004, 2024, 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 6180413 6184485 6267144 + * @summary test for popup menu visual bugs in XAWT + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual PopupMenuVisuals +*/ + +import java.awt.Button; +import java.awt.CheckboxMenuItem; +import java.awt.Frame; +import java.awt.Menu; +import java.awt.MenuItem; +import java.awt.MenuShortcut; +import java.awt.PopupMenu; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.KeyEvent; + +public class PopupMenuVisuals { + private static final String INSTRUCTIONS = """ + This test should show a button 'Popup'. + Click on the button. A popup menu should be shown. + If following conditions are met: + - Menu is disabled + - Menu has caption 'Popup menu' (only applicable for linux) + - Menu items don't show shortcuts + + Click Pass else click Fail."""; + + static PopupMenu pm; + static Frame frame; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("PopupMenu Instructions") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(35) + .testUI(PopupMenuVisuals::createTestUI) + .build() + .awaitAndCheck(); + } + + static class Listener implements ActionListener { + public void actionPerformed(ActionEvent e) { + pm.show(frame, 0, 0); + } + } + + private static Frame createTestUI() { + Button b = new Button("Popup"); + pm = new PopupMenu("Popup menu"); + MenuItem mi1 = new MenuItem("Item 1"); + CheckboxMenuItem mi2 = new CheckboxMenuItem("Item 2"); + CheckboxMenuItem mi3 = new CheckboxMenuItem("Item 3"); + Menu sm = new Menu("Submenu"); + + //Get things going. Request focus, set size, et cetera + frame = new Frame("PopupMenuVisuals"); + frame.setSize (200,200); + frame.validate(); + + frame.add(b); + b.addActionListener(new Listener()); + mi1.setShortcut(new MenuShortcut(KeyEvent.VK_A)); + pm.add(mi1); + pm.add(mi2); + pm.add(mi3); + pm.add(sm); + sm.add(new MenuItem("Item")); + pm.setEnabled(false); + mi3.setState(true); + frame.add(pm); + return frame; + } + +} diff --git a/test/jdk/java/awt/PopupMenu/PopupMenuWithMenuBar.java b/test/jdk/java/awt/PopupMenu/PopupMenuWithMenuBar.java new file mode 100644 index 000000000000..1a927e29f84b --- /dev/null +++ b/test/jdk/java/awt/PopupMenu/PopupMenuWithMenuBar.java @@ -0,0 +1,103 @@ +/* + * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Frame; +import java.awt.Menu; +import java.awt.MenuBar; +import java.awt.MenuItem; +import java.awt.PopupMenu; + +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; + +/* + * @test + * @bug 4038140 + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @summary Test for functionality of PopupMenuWithMenuBar + * @run main/manual PopupMenuWithMenuBar + */ + +public class PopupMenuWithMenuBar { + public static void main(String[] args) throws Exception { + PopupMenuWithMenuBar obj = new PopupMenuWithMenuBar(); + String INSTRUCTIONS = """ + There was a bug that prevented the popup menu from appearing properly + (if even at all) for a frame window when there is also a menu bar. + + Right click inside the frame window to display the popup window. If + the popup menu appears normally, then the test is successful and the + bug has been fixed."""; + + PassFailJFrame.builder() + .title("PopupMenuWithMenuBar Instruction") + .instructions(INSTRUCTIONS) + .columns(40) + .testUI(obj::createUI) + .build() + .awaitAndCheck(); + } + + private Frame createUI() { + Frame f = new Frame("PopupMenuWithMenuBar Test"); + f.setBounds(10, 10, 300, 250); + MenuBar menuBar = new MenuBar(); + Menu fileMenu = createFileMenu(); + menuBar.add(fileMenu); + f.setMenuBar(menuBar); + PopupMenu popupMenu = createPopupMenu(); + f.add(popupMenu); + f.addMouseListener(new MouseAdapter() { + @Override + public void mouseClicked(MouseEvent e) { + popupMenu.show(f, e.getX(), e.getY()); + } + }); + return f; + } + + private Menu createFileMenu() { + String[] menu1Labels = new String[] + {"Save As", "Save As", "Quit"}; + MenuItem menuItem; + Menu returnMenu = new Menu("File"); + for (int menu1Index = 0; menu1Index < menu1Labels.length; menu1Index++) { + menuItem = new MenuItem(menu1Labels[menu1Index]); + returnMenu.add(menuItem); + } + return returnMenu; + } + + private PopupMenu createPopupMenu() { + String[] popupLabels = new String[] + {"Popup 1", "Popup 2", "Quit"}; + MenuItem menuItem; + PopupMenu returnMenu = new PopupMenu("Popups"); + for (int popupIndex = 0; popupIndex < popupLabels.length; popupIndex++) { + menuItem = new MenuItem(popupLabels[popupIndex]); + returnMenu.add(menuItem); + } + return returnMenu; + } +} diff --git a/test/jdk/java/awt/PopupMenu/PopupOnButton.java b/test/jdk/java/awt/PopupMenu/PopupOnButton.java new file mode 100644 index 000000000000..581714bf76a8 --- /dev/null +++ b/test/jdk/java/awt/PopupMenu/PopupOnButton.java @@ -0,0 +1,88 @@ +/* + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Button; +import java.awt.Component; +import java.awt.Frame; +import java.awt.MenuItem; +import java.awt.PopupMenu; + +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; + +/* + * @test + * @bug 4181790 + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @summary Tests a popup menu on a button. + * @run main/manual PopupOnButton + */ + +public class PopupOnButton { + public static void main(String[] args) throws Exception { + PopupOnButton obj = new PopupOnButton(); + String INSTRUCTIONS = """ + Right-click on the button. + Popup Menu should appear and behave fine. + If a PopupMenu appears, press Pass, else press Fail. + """; + + PassFailJFrame.builder() + .title("PopupOnButton Instruction") + .instructions(INSTRUCTIONS) + .columns(40) + .testUI(obj::createUI) + .build() + .awaitAndCheck(); + } + + private Frame createUI() { + Frame f = new Frame("PopupOnButton Test"); + Button b = new Button("button with popup menu"); + PopupMenu m = new PopupMenu("popup"); + m.add(new MenuItem("item1")); + m.add(new MenuItem("item2")); + m.add(new MenuItem("item3")); + b.add(m); + b.addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent e) { + if (e.isPopupTrigger()) { + m.show((Component) e.getSource(), e.getX(), e.getY()); + } + } + + @Override + public void mouseReleased(MouseEvent e) { + if (e.isPopupTrigger()) { + m.show((Component) e.getSource(), e.getX(), e.getY()); + } + } + }); + + f.add(b); + f.setSize(200, 150); + return f; + } + } diff --git a/test/jdk/java/awt/PopupMenu/StressTest.java b/test/jdk/java/awt/PopupMenu/StressTest.java new file mode 100644 index 000000000000..221aa252aa0b --- /dev/null +++ b/test/jdk/java/awt/PopupMenu/StressTest.java @@ -0,0 +1,142 @@ +/* + * Copyright (c) 1998, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Component; +import java.awt.Dimension; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.MenuItem; +import java.awt.Panel; +import java.awt.Point; +import java.awt.PopupMenu; +import java.awt.Robot; + +import java.awt.event.InputEvent; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; + +/* + * @test + * @bug 4083400 + * @key headful + * @summary Tests that excessive popping up and down does not crash or + * throw an exception. + * @run main StressTest + */ + +public class StressTest { + private static Frame fr; + private static PopupTestPanel panel; + + private static volatile Point panelCenter; + + public static void main(String[] args) throws Exception { + final int REPEAT_COUNT = 5; + try { + Robot robot = new Robot(); + robot.setAutoDelay(50); + EventQueue.invokeAndWait(StressTest::createAndShowUI); + robot.delay(1000); + + EventQueue.invokeAndWait(() -> { + Point loc = panel.getLocationOnScreen(); + Dimension dim = panel.getSize(); + panelCenter = new Point(loc.x + dim.width / 2, loc.y + dim.height / 2); + }); + + for (int i = 0; i < REPEAT_COUNT; i++) { + robot.mouseMove(panelCenter.x + i * 2, panelCenter.y + i * 2); + + robot.mousePress(InputEvent.BUTTON3_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON3_DOWN_MASK); + + robot.mouseMove(panelCenter.x - i * 2, panelCenter.y - i * 2); + + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + } + } finally { + EventQueue.invokeAndWait(() -> { + if (fr != null) { + fr.dispose(); + } + }); + } + } + + public static void createAndShowUI() { + fr = new Frame("PopupMenu Test"); + panel = new PopupTestPanel(); + fr.add(panel); + fr.setSize(300, 200); + fr.setVisible(true); + } + + static class PopupTestPanel extends Panel { + + static class Item extends MenuItem { + public Item(String text) { + super(text); + } + + public boolean isEnabled() { + try { + Thread.sleep(100); + } catch (InterruptedException ignored) { + } + return super.isEnabled(); + } + } + + final PopupMenu popup; + + public PopupTestPanel() { + popup = new PopupMenu(); + popup.add(new Item("Soap")); + popup.add(new Item("Sponge")); + popup.add(new Item("Flannel")); + popup.add(new Item("Mat")); + popup.add(new Item("Towel")); + add(popup); + addMouseListener(new MouseAdapter() { + @Override + public void mousePressed(MouseEvent e) { + if (e.isPopupTrigger()) { + showPopup(e); + } + } + + @Override + public void mouseReleased(MouseEvent e) { + if (e.isPopupTrigger()) { + showPopup(e); + } + } + + private void showPopup(MouseEvent e) { + popup.show((Component) e.getSource(), e.getX(), e.getY()); + } + }); + } + } +} diff --git a/test/jdk/java/awt/Rectangle/IntersectionTest.java b/test/jdk/java/awt/Rectangle/IntersectionTest.java new file mode 100644 index 000000000000..41680b2e7b6b --- /dev/null +++ b/test/jdk/java/awt/Rectangle/IntersectionTest.java @@ -0,0 +1,88 @@ +/* + * Copyright (c) 1999, 2024, 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 4147957 + * @key headful + * @summary Test to verify setClip with invalid rect changes rect to valid + * @run main IntersectionTest + */ + +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Panel; +import java.awt.Rectangle; +import java.awt.Robot; + +public class IntersectionTest { + public static Frame frame; + + public static void main(String[] args) throws Exception { + Robot robot = new Robot(); + try { + robot.setAutoDelay(100); + EventQueue.invokeAndWait(() -> { + TestFrame panel = new TestFrame(); + frame = new Frame("Rectangle Intersection Test"); + frame.add(panel); + + frame.pack(); + frame.setVisible(true); + }); + robot.waitForIdle(); + robot.delay(200); + } finally { + EventQueue.invokeAndWait(() -> { + if (frame != null) { + frame.dispose(); + } + }); + } + } +} + +class TestFrame extends Panel { + @Override + public void paint(Graphics g) { + Rectangle r1 = new Rectangle(0, 0, 100, 100); + Rectangle r2 = new Rectangle(200, 200, 20, 20); + Rectangle r3 = r1.intersection(r2); + System.out.println("intersect:(" + (int) r3.getX() + "," + + (int) r3.getY() + "," + (int) r3.getWidth() + "," + + (int) r3.getHeight() + ")"); + g.setClip(r3); + Rectangle r4 = g.getClipBounds(); + System.out.println("getClipBounds:(" + (int) r4.getX() + "," + + (int) r4.getY() + "," + (int) r4.getWidth() + "," + + (int) r4.getHeight() + ")"); + + if ((r4.getWidth() <= 0) || (r4.getHeight() <= 0)) { + System.out.println("Test Passed"); + } else { + throw new RuntimeException("IntersectionTest failed. " + + "Non-empty clip bounds."); + } + } +} diff --git a/test/jdk/java/awt/Robot/CreateScreenCapture.java b/test/jdk/java/awt/Robot/CreateScreenCapture.java new file mode 100644 index 000000000000..8060240ba8f1 --- /dev/null +++ b/test/jdk/java/awt/Robot/CreateScreenCapture.java @@ -0,0 +1,81 @@ +/* + * Copyright (c) 1999, 2024, 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 4292503 + * @summary OutOfMemoryError with lots of Robot.createScreenCapture + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @requires (os.family == "linux") + * @run main/manual CreateScreenCapture +*/ + +import java.awt.Dialog; +import java.awt.Frame; +import java.awt.Image; +import java.awt.Rectangle; +import java.awt.Robot; +import java.awt.TextArea; + +public class CreateScreenCapture { + + static TextArea messageText; + + private static final String INSTRUCTIONS = """ + This test is linux only! + Once you see these instructions, run 'top' program. + Watch for java process. + The memory size used by this process should stop growing after several steps. + Numbers of steps test is performing are displayed in output window. + After 5-7 steps the size taken by the process should become stable. + If this happens, then test passed otherwise test failed. + + Small oscillations of the memory size are, however, acceptable."""; + + public static void main(String[] args) throws Exception { + Robot robot = new Robot(); + PassFailJFrame passFail = new PassFailJFrame(INSTRUCTIONS); + Dialog dialog = new Dialog(new Frame(), "Instructions"); + messageText = new TextArea("", 5, 80, TextArea.SCROLLBARS_BOTH); + dialog.add(messageText); + PassFailJFrame.addTestWindow(dialog); + PassFailJFrame.positionTestWindow(dialog, PassFailJFrame.Position.HORIZONTAL); + dialog.setSize(200, 300); + dialog.setVisible(true); + Rectangle rect = new Rectangle(0, 0, 1000, 1000); + for (int i = 0; i < 100; i++) { + Image image = robot.createScreenCapture(rect); + image.flush(); + image = null; + robot.delay(200); + log("step #" + i); + } + passFail.awaitAndCheck(); + } + + private static void log(String messageIn) { + messageText.append(messageIn + "\n"); + } +} + diff --git a/test/jdk/java/awt/Robot/RobotScrollTest.java b/test/jdk/java/awt/Robot/RobotScrollTest.java new file mode 100644 index 000000000000..20dc9f2f4ebd --- /dev/null +++ b/test/jdk/java/awt/Robot/RobotScrollTest.java @@ -0,0 +1,101 @@ +/* + * Copyright (c) 2001, 2024, 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 4374578 + * @summary Test robot wheel scrolling of Text + * @requires (os.family == "Windows") | (os.family == "linux") + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual RobotScrollTest +*/ + +import java.awt.Frame; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.Robot; +import java.awt.TextArea; + +public class RobotScrollTest { + + static TextArea ta; + static Robot robot; + + private static final String INSTRUCTIONS = """ + 0. DON'T TOUCH ANYTHING! + 1. This test is for Windows and Linux only. + 2. Just sit back, and watch the Robot move the mouse to the TextArea. + 3. Once the pointer is on the text area, the Robot will use the mouse wheel + to scroll the text. + If the text scrolled, press PASS, else, press FAIL."""; + + public static void main(String[] args) throws Exception { + robot = new Robot(); + robot.setAutoDelay(100); + PassFailJFrame passFail = new PassFailJFrame(INSTRUCTIONS); + createTestUI(); + passFail.awaitAndCheck(); + } + + private static void createTestUI() { + Frame f = new Frame("RobotScrollTest"); + ta = new TextArea(); + for (int i = 0; i < 100; i++) { + ta.append(i + "\n"); + } + f.add(ta); + f.setLocation(0, 400); + f.pack(); + PassFailJFrame.addTestWindow(f); + PassFailJFrame.positionTestWindow(f, PassFailJFrame.Position.HORIZONTAL); + f.setVisible(true); + doTest(); + } + + private static void doTest() { + robot.waitForIdle(); + robot.delay(1000); + // get loc of TextArea + Point taAt = ta.getLocationOnScreen(); + // get bounds of button + Rectangle bounds = ta.getBounds(); + + // move mouse to middle of button + robot.mouseMove(taAt.x + bounds.width / 2, + taAt.y + bounds.height / 2); + + // rotate wheel a few times + for (int j = 1; j < 8; j++) { + for (int k = 0; k < 5; k++) { + robot.mouseWheel(j); + } + + for (int k = 0; k < 5; k++) { + robot.mouseWheel(-1 * j); + } + } + } + +} + diff --git a/test/jdk/java/awt/TextField/GetTextTest/GetTextTest.java b/test/jdk/java/awt/TextField/GetTextTest/GetTextTest.java new file mode 100644 index 000000000000..ab5aebc11d47 --- /dev/null +++ b/test/jdk/java/awt/TextField/GetTextTest/GetTextTest.java @@ -0,0 +1,104 @@ +/* + * Copyright (c) 1998, 2024, 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 4100188 + * @key headful + * @summary Make sure that TextFields contain all of, + * and exactly, the text that was entered into them. + * @run main GetTextTest + */ + +import java.awt.AWTException; +import java.awt.Dimension; +import java.awt.EventQueue; +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.Label; +import java.awt.Point; +import java.awt.Robot; +import java.awt.TextField; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.InputEvent; +import java.awt.event.KeyEvent; +import java.lang.reflect.InvocationTargetException; + +public class GetTextTest extends Frame implements ActionListener { + private final String s = "test string"; + private volatile String ac; + private TextField t; + private Point location; + private Dimension size; + + public void setupGUI() { + setLayout(new FlowLayout(FlowLayout.LEFT)); + + t = new TextField(s, 32); + add(new Label("Hit after text")); + add(t); + t.addActionListener(this); + setLocationRelativeTo(null); + pack(); + setVisible(true); + } + + public void actionPerformed(ActionEvent evt) { + ac = evt.getActionCommand(); + } + + public void performTest() throws AWTException, InterruptedException, + InvocationTargetException { + EventQueue.invokeAndWait(() -> { + location = t.getLocationOnScreen(); + size = t.getSize(); + }); + Robot robot = new Robot(); + robot.setAutoDelay(50); + robot.delay(1000); + robot.waitForIdle(); + robot.mouseMove(location.x + size.width - 3, location.y + (size.height / 2)); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + robot.delay(1000); + robot.waitForIdle(); + robot.keyPress(KeyEvent.VK_ENTER); + robot.keyRelease(KeyEvent.VK_ENTER); + robot.delay(1000); + if (!s.equals(ac)) { + throw new RuntimeException("Action command should be the same as text field content"); + } + } + + public static void main(String[] args) throws InterruptedException, + InvocationTargetException, AWTException { + GetTextTest test = new GetTextTest(); + EventQueue.invokeAndWait(test::setupGUI); + try { + test.performTest(); + } finally { + EventQueue.invokeAndWait(test::dispose); + } + } +} diff --git a/test/jdk/java/awt/TextField/SetEchoCharTest3/SetEchoCharTest3.java b/test/jdk/java/awt/TextField/SetEchoCharTest3/SetEchoCharTest3.java new file mode 100644 index 000000000000..10779365defc --- /dev/null +++ b/test/jdk/java/awt/TextField/SetEchoCharTest3/SetEchoCharTest3.java @@ -0,0 +1,65 @@ +/* + * Copyright (c) 1999, 2024, 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 4222122 + * @summary TextField.setEchoCharacter() seems to be broken + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual SetEchoCharTest3 + */ + +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.Label; +import java.awt.TextField; +import java.lang.reflect.InvocationTargetException; + +public class SetEchoCharTest3 extends Frame { + static String INSTRUCTIONS = """ + Type in the text field and "*" characters should echo. + If only one "*" echoes and then the system beeps after + the second character is typed, then press Fail, otherwise press Pass. + """; + public SetEchoCharTest3() { + setLayout(new FlowLayout()); + add(new Label("Enter text:")); + TextField tf = new TextField(15); + tf.setEchoChar('*'); + add(tf); + pack(); + } + + public static void main(String[] args) throws InterruptedException, + InvocationTargetException { + PassFailJFrame.builder() + .title("Set Echo Char Test 3") + .testUI(SetEchoCharTest3::new) + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 1) + .columns(40) + .build() + .awaitAndCheck(); + } +} diff --git a/test/jdk/java/awt/Toolkit/Headless/HeadlessToolkit.java b/test/jdk/java/awt/Toolkit/Headless/HeadlessToolkit.java index 87970aab10a2..ebf4c598a15c 100644 --- a/test/jdk/java/awt/Toolkit/Headless/HeadlessToolkit.java +++ b/test/jdk/java/awt/Toolkit/Headless/HeadlessToolkit.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,8 +21,20 @@ * questions. */ -import javax.imageio.ImageIO; -import java.awt.*; +import java.awt.AWTEvent; +import java.awt.Cursor; +import java.awt.Dimension; +import java.awt.EventQueue; +import java.awt.Font; +import java.awt.FontMetrics; +import java.awt.Graphics2D; +import java.awt.GraphicsConfiguration; +import java.awt.GraphicsEnvironment; +import java.awt.HeadlessException; +import java.awt.Image; +import java.awt.Insets; +import java.awt.Point; +import java.awt.Toolkit; import java.awt.datatransfer.Clipboard; import java.awt.event.AWTEventListener; import java.awt.event.KeyEvent; @@ -35,16 +47,16 @@ import java.io.File; import java.io.FileInputStream; import java.io.IOException; -import java.net.URL; import java.util.Map; +import javax.imageio.ImageIO; + /* * @test * @summary Check that Toolkit methods do not throw unexpected exceptions * in headless mode * @run main/othervm -Djava.awt.headless=true HeadlessToolkit */ - public class HeadlessToolkit { class awtEventListener implements AWTEventListener { @@ -275,13 +287,12 @@ void doTest() throws IOException { im = tk.createImage(image.getAbsolutePath()); im.flush(); - } - - im = tk.getImage(new URL("https://openjdk.org/images/openjdk.png")); - im.flush(); + im = tk.getImage(image.toURI().toURL()); + im.flush(); - im = tk.createImage(new URL("https://openjdk.org/images/openjdk.png")); - im.flush(); + im = tk.createImage(image.toURI().toURL()); + im.flush(); + } MemoryImageSource mis; int pixels[] = new int[50 * 50]; diff --git a/test/jdk/java/awt/TrayIcon/ClearPrevImageTest.java b/test/jdk/java/awt/TrayIcon/ClearPrevImageTest.java new file mode 100644 index 000000000000..e97f645bec59 --- /dev/null +++ b/test/jdk/java/awt/TrayIcon/ClearPrevImageTest.java @@ -0,0 +1,126 @@ +/* + * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.AWTException; +import java.awt.Color; +import java.awt.EventQueue; +import java.awt.Graphics2D; +import java.awt.Image; +import java.awt.RenderingHints; +import java.awt.SystemTray; +import java.awt.TrayIcon; +import java.awt.image.BufferedImage; + +import jtreg.SkippedException; + +/* + * @test + * @bug 6267936 + * @library /java/awt/regtesthelpers /test/lib + * @build PassFailJFrame jtreg.SkippedException + * @summary Tests that the previous image in TrayIcon is cleared + * when a new image is set + * @run main/manual ClearPrevImageTest + */ + +public class ClearPrevImageTest { + private static SystemTray tray; + private static TrayIcon icon; + private static final String INSTRUCTIONS = """ + This test checks that the previous image in TrayIcon is cleared + when a new image is set. + + When the test starts, a RED square TrayIcon is added + to the SystemTray (also, called Taskbar Status Area in MS Windows, + Notification Area in, GNOME and System Tray in KDE). + + You should see it change into YELLOW after 5 seconds. + If you still see RED TrayIcon after 5 seconds, + press FAIL, otherwise press PASS + """; + + + public static void main(String[] args) throws Exception { + if (!SystemTray.isSupported()) { + throw new SkippedException("Test not applicable as" + + " System Tray not supported"); + } + + PassFailJFrame passFailJFrame + = PassFailJFrame.builder() + .title("TrayIcon Change Test Instructions") + .instructions(INSTRUCTIONS) + .columns(40) + .build(); + + EventQueue.invokeAndWait(ClearPrevImageTest::createAndShowTrayIcon); + try { + changeTrayIcon(); + passFailJFrame.awaitAndCheck(); + } catch (Exception e) { + throw new RuntimeException("Test failed: ", e); + } finally { + EventQueue.invokeAndWait(() -> { + if (tray != null) { + tray.remove(icon); + } + }); + } + } + + private static void createAndShowTrayIcon() { + Image img1 = createIcon(Color.RED); + tray = SystemTray.getSystemTray(); + icon = new TrayIcon(img1); + icon.setImageAutoSize(true); + + try { + tray.add(icon); + } catch (AWTException e) { + throw new RuntimeException("Error while adding" + + " icon to system tray", e); + } + } + + private static void changeTrayIcon() { + try { + Thread.sleep(5000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + Image img2 = createIcon(Color.YELLOW); + icon.setImage(img2); + } + + private static Image createIcon(Color color) { + BufferedImage image = new BufferedImage(16, 16, + BufferedImage.TYPE_INT_ARGB); + Graphics2D g = image.createGraphics(); + g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, + RenderingHints.VALUE_TEXT_ANTIALIAS_ON); + g.setColor(color); + g.fillRect(0, 0, 16, 16); + g.dispose(); + return image; + } +} diff --git a/test/jdk/java/awt/TrayIcon/FocusLostAfterTrayTest.java b/test/jdk/java/awt/TrayIcon/FocusLostAfterTrayTest.java new file mode 100644 index 000000000000..bd831ce94e4c --- /dev/null +++ b/test/jdk/java/awt/TrayIcon/FocusLostAfterTrayTest.java @@ -0,0 +1,136 @@ +/* + * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.AWTException; +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.Graphics2D; +import java.awt.RenderingHints; +import java.awt.SystemTray; +import java.awt.TextArea; +import java.awt.TrayIcon; +import java.awt.event.FocusAdapter; +import java.awt.event.FocusEvent; +import java.awt.image.BufferedImage; + +import jtreg.SkippedException; + +/* + * @test + * @bug 6269309 + * @library /java/awt/regtesthelpers /test/lib + * @build PassFailJFrame jtreg.SkippedException + * @summary Tests that focus is transferred properly back + * to toplevel after clicking on a tray icon. + * @run main/manual FocusLostAfterTrayTest + */ + +public class FocusLostAfterTrayTest { + private static SystemTray tray; + private static TrayIcon icon; + + private static final String INSTRUCTIONS = """ + This test checks that focus is transferred properly back + to top-level after clicking on a tray icon. + + When the test starts, a Frame with a text area & a RED tray icon + are shown. If you don't see a tray icon please make sure that + the tray area (also called Taskbar Status Area on MS Windows + Notification Area on Gnome or System Tray on KDE) is visible. + + Click with a mouse inside a text area and make sure that it has + received input focus. Then click on the tray icon and then back + on the text area and verify that it has input focus again. Repeat + the last step several times. Ensure that the text area always + has the input focus and there are no "FOCUS LOST" event + for text area in the log section. + + If above is true, Press PASS, else FAIL. + """; + + public static void main(String[] args) throws Exception { + if (!SystemTray.isSupported()) { + throw new SkippedException("Test not applicable as" + + " System Tray not supported"); + } + + try { + PassFailJFrame.builder() + .title("FocusLostAfterTrayTest Instructions") + .instructions(INSTRUCTIONS) + .columns(40) + .testUI(FocusLostAfterTrayTest::createAndShowTrayIcon) + .logArea() + .build() + .awaitAndCheck(); + } finally { + EventQueue.invokeAndWait(() -> { + if (tray != null) { + tray.remove(icon); + } + }); + } + } + + private static Frame createAndShowTrayIcon() { + Frame frame = new Frame("FocusLostAfterTrayTest"); + frame.setBounds(100, 300, 200, 200); + frame.setLayout(new BorderLayout()); + TextArea ta = new TextArea(); + ta.addFocusListener(new FocusAdapter() { + @Override + public void focusGained(FocusEvent e) { + PassFailJFrame.log("FOCUS GAINED: " + + e.getComponent().getClass().toString()); + } + @Override + public void focusLost(FocusEvent e) { + PassFailJFrame.log("FOCUS LOST !! " + + e.getComponent().getClass().toString()); + } + }); + frame.add(ta); + + BufferedImage image = new BufferedImage(16, 16, + BufferedImage.TYPE_INT_ARGB); + Graphics2D g = image.createGraphics(); + g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, + RenderingHints.VALUE_TEXT_ANTIALIAS_ON); + g.setColor(Color.RED); + g.fillRect(0, 0, 16, 16); + g.dispose(); + tray = SystemTray.getSystemTray(); + icon = new TrayIcon(image); + icon.setImageAutoSize(true); + + try { + tray.add(icon); + } catch (AWTException e) { + throw new RuntimeException("Error while adding" + + " icon to system tray", e); + } + return frame; + } +} diff --git a/test/jdk/java/awt/TrayIcon/MouseMoveTest.java b/test/jdk/java/awt/TrayIcon/MouseMoveTest.java new file mode 100644 index 000000000000..51d80ff127b1 --- /dev/null +++ b/test/jdk/java/awt/TrayIcon/MouseMoveTest.java @@ -0,0 +1,107 @@ +/* + * Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.AWTException; +import java.awt.Color; +import java.awt.EventQueue; +import java.awt.Graphics; +import java.awt.SystemTray; +import java.awt.TrayIcon; +import java.awt.event.MouseEvent; +import java.awt.event.MouseMotionAdapter; +import java.awt.image.BufferedImage; + +import jtreg.SkippedException; + +/* + * @test + * @bug 6267980 + * @summary PIT:Spurious MouseMoved events are triggered by Tray Icon + * @library /java/awt/regtesthelpers /test/lib + * @build PassFailJFrame jtreg.SkippedException + * @run main/manual MouseMoveTest + */ + +public class MouseMoveTest { + private static SystemTray tray; + private static TrayIcon icon; + private static final String INSTRUCTIONS = """ + 1) You will see a tray icon (white square) in notification area, + 2) Move mouse pointer to the icon and leave it somewhere inside the icon, + 3) Verify that MOUSE_MOVE events are NOT triggered after you have STOPPED + moving mouse. + 4) If events are still triggered Press FAIL else PASS. + """; + + public static void main(String[] args) throws Exception { + if (!SystemTray.isSupported()) { + throw new SkippedException("Test not applicable as" + + " System Tray not supported"); + } + + PassFailJFrame passFailJFrame + = PassFailJFrame.builder() + .title("TrayIcon Change Test Instructions") + .instructions(INSTRUCTIONS) + .columns(45) + .logArea() + .build(); + + try { + EventQueue.invokeAndWait(MouseMoveTest::createAndShowTrayIcon); + passFailJFrame.awaitAndCheck(); + } finally { + EventQueue.invokeAndWait(() -> { + if (tray != null) { + tray.remove(icon); + } + }); + } + } + + private static void createAndShowTrayIcon() { + BufferedImage img = new BufferedImage(32, 32, + BufferedImage.TYPE_INT_ARGB); + Graphics g = img.createGraphics(); + g.setColor(Color.WHITE); + g.fillRect(0, 0, 32, 32); + g.dispose(); + + tray = SystemTray.getSystemTray(); + icon = new TrayIcon(img); + icon.setImageAutoSize(true); + + icon.addMouseMotionListener(new MouseMotionAdapter() { + public void mouseMoved(MouseEvent me){ + PassFailJFrame.log(me.toString()); + } + }); + + try { + tray.add(icon); + } catch (AWTException e) { + throw new RuntimeException("Error while adding" + + " icon to system tray", e); + } + } +} diff --git a/test/jdk/java/awt/TrayIcon/TrayIconKeySelectTest.java b/test/jdk/java/awt/TrayIcon/TrayIconKeySelectTest.java new file mode 100644 index 000000000000..5e41f5463823 --- /dev/null +++ b/test/jdk/java/awt/TrayIcon/TrayIconKeySelectTest.java @@ -0,0 +1,122 @@ +/* + * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.AWTException; +import java.awt.Color; +import java.awt.EventQueue; +import java.awt.Graphics; +import java.awt.SystemTray; +import java.awt.TrayIcon; +import java.awt.image.BufferedImage; + +import jtreg.SkippedException; + +/* + * @test + * @bug 6267943 + * @requires (os.family == "windows") + * @library /java/awt/regtesthelpers /test/lib + * @build PassFailJFrame jtreg.SkippedException + * @summary Tests the possibility of selecting a tray icon with the keyboard. + * @run main/manual TrayIconKeySelectTest + */ + +public class TrayIconKeySelectTest { + private static SystemTray tray; + private static TrayIcon icon; + private static final String INSTRUCTIONS = """ + Tests that TrayIcon is selectable with the keyboard + When the test is started you will see three-color icon + in the system tray. + + 1. Bring the focus to the icon with TAB. Press ENTER key. + - One or more ActionEvent should be generated + (see the output area of the test) + + 2. Bring the focus again to the icon. Press SPACE key twice. + - One or more ActionEvent should be generated. + + 3. Bring the focus again to the icon. Click on the icon with + the LEFT mouse button twice. + - One or more ActionEvent should be generated. + + 4. Again bring the focus to the icon. Click on the icon with + the LEFT mouse button just once. + - NO ActionEvent should be generated. + + 5. Repeat the 4th step with other mouse buttons. + + If all the above are true press PASS, else FAIL + """; + + public static void main(String[] args) throws Exception { + if (!SystemTray.isSupported()) { + throw new SkippedException("Test not applicable as" + + " System Tray not supported"); + } + PassFailJFrame passFailJFrame; + try { + passFailJFrame + = PassFailJFrame.builder() + .title("TrayIconKeySelectTest Instructions") + .instructions(INSTRUCTIONS) + .columns(40) + .logArea() + .build(); + + EventQueue.invokeAndWait(TrayIconKeySelectTest::createAndShowTrayIcon); + passFailJFrame.awaitAndCheck(); + } finally { + EventQueue.invokeAndWait(() -> { + if (tray != null) { + tray.remove(icon); + } + }); + } + } + + private static void createAndShowTrayIcon() { + BufferedImage im = new BufferedImage(16, 16, + BufferedImage.TYPE_INT_ARGB); + Graphics gr = im.createGraphics(); + gr.setColor(Color.white); + gr.fillRect(0, 0, 16, 5); + gr.setColor(Color.blue); + gr.fillRect(0, 5, 16, 10); + gr.setColor(Color.red); + gr.fillRect(0, 10, 16, 16); + gr.dispose(); + + tray = SystemTray.getSystemTray(); + icon = new TrayIcon(im); + icon.setImageAutoSize(true); + icon.addActionListener(e -> PassFailJFrame.log(e.toString())); + + try { + tray.add(icon); + } catch (AWTException e) { + throw new RuntimeException("Error while adding" + + " icon to system tray", e); + } + } +} diff --git a/test/jdk/java/awt/TrayIcon/TrayIconTest.java b/test/jdk/java/awt/TrayIcon/TrayIconTest.java new file mode 100644 index 000000000000..c78f6c134fed --- /dev/null +++ b/test/jdk/java/awt/TrayIcon/TrayIconTest.java @@ -0,0 +1,613 @@ +/* + * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.AWTException; +import java.awt.BorderLayout; +import java.awt.Button; +import java.awt.Checkbox; +import java.awt.CheckboxGroup; +import java.awt.Choice; +import java.awt.Color; +import java.awt.Container; +import java.awt.EventQueue; +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.Graphics2D; +import java.awt.GridLayout; +import java.awt.Image; +import java.awt.Insets; +import java.awt.Label; +import java.awt.MenuItem; +import java.awt.Panel; +import java.awt.PopupMenu; +import java.awt.RenderingHints; +import java.awt.SystemTray; +import java.awt.TextField; +import java.awt.Toolkit; +import java.awt.TrayIcon; +import java.awt.TrayIcon.MessageType; +import java.awt.event.ActionEvent; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.MouseMotionAdapter; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.awt.image.BufferedImage; +import java.beans.PropertyChangeEvent; +import java.util.HashMap; +import java.util.Map; +import jtreg.SkippedException; + +/* + * @test + * @key headful + * @bug 4310333 + * @library /java/awt/regtesthelpers /test/lib + * @build PassFailJFrame jtreg.SkippedException + * @summary A unit test for TrayIcon RFE + * @run main/manual TrayIconTest + */ + +public class TrayIconTest { + private static SystemTray tray; + static Frame frame = new Frame("TrayIcon Test"); + private static final String INSTRUCTIONS = """ + The test frame contains CheckboxGroup of tray icons. + A selected checkbox represents the TrayIcon (or null + TrayIcon) whose functionality is currently tested. + + If you are under Linux make sure your Application Panel has + System Tray (on Gnome it is called Notification Area). + + Perform all the cases (1-7) documented below. + + CASE 1: Testing ADD/REMOVE/PropertyChange functionality. + -------------------------------------------------------- + 1. Select null TrayIcon and pressAdd button: + - NullPointerException should be thrown. + 2. Select some of the valid TrayIcons and press Add button: + - The selected TrayIcon should appear in the SystemTray. + - PropertyChangeEvent should be fired (the property is + an array of TrayIcons added to the system tray). + 3. Press Add button again: + - IllegalArgumentException should be thrown. + - No PropertyChangeEvent should be fired. + 4. Press Remove button: + - The TrayIcon should disappear from the SystemTray. + - PropertyChangeEvent should be fired. + 5. Press Remove button again: + - It should have no effect. + - No PropertyChangeEvent should be fired. + 6. Add all the valid TrayIcons (by selecting everyone and pressing Add + button): + - All the TrayIcons should appear in the SystemTray. + - PropertyChangeEvent should be fired on each adding. + 7. Remove all the TrayIcons (again by selecting everyone and pressing + Remove): + - All the TrayIcons should disappear from the SystemTray. + - PropertyChangeEvent should be fired on each removing. + 8. Not for Windows! Remove the system tray (Notification Area) from + the desktop. Try to add some valid TrayIcon: + - AWTException should be thrown. + - No PropertyChangeEvent should be fired. + 9. Not for Windows! Add the system tray back to the desktop. Add all the + valid TrayIcons: + - All the TrayIcons should appear in the system tray. + - PropertyChangeEvent should be fired on each adding. + 11. Not for Windows! Remove the system tray from the desktop: + - All the TrayIcons should disappear. + - PropertyChangeEvent should be fired for each TrayIcon + removal. + - PropertyChangeEvent should be fired for SystemTray removal. + 12. Add the system tray and go to the next step. + - All the TrayIcons should appear again. + - PropertyChangeEvent should be fired for SystemTray addition. + - PropertyChangeEvent shouldn't be fired for TrayIcon removal. + + CASE 2: Testing RESIZE functionality. + ------------------------------------- + 1. Select some of the TrayIcons and add it. Then press resize button: + - The TrayIcon selected should be resized to fit the area it occupies. + 2. Press resize button again: + - The TrayIcon should be resized to the original size. + 3. Repeat the 1-2 steps for other TrayIcons: + - The TrayIcons should be resized appropriately. + + CASE 3: Testing EVENTS functionality + --------------------------------- + 1. Select some of the TrayIcons and add it. Select MouseEvent from the + group of checkboxes at the top-right of the test frame. + Click on the TrayIcon in the SystemTray: + - MOUSE_PRESSED MOUSE_RELEASED and MOUSE_CLICKED events should be + generated. + 2. Press mouse inside the TrayIcon dragging mouse and releasing it. + - Make sure that MOUSE_CLICKED event is not triggered. + 3. Click on the TrayIcon with different modification keys: + - there should be appropriate modifiers in the events. + 4. Keep clicking on the TrayIcon: + - there should be correct absolute coordinates in the events. + 5. Only for Windows! Focus the system tray using keyboard: + - press WIN key once to bring up the start menu then press ESC once to + close the menu the focus should be on the start button + - press TAB key for several times until you focus on the system + tray then use ARROW keys to move to the TrayIcon + - press ENTER or SPACE should trigger ACTION_PERFORMED message + make sure that mouse events are not triggered. + 6. Select MouseMotionEvent checkbox. Move mouse over the TrayIcon: + - MOUSE_MOVED event should be generated. It should contain + correct coordinates. + 7. Deselect both the checkboxes and then select AWTEventListener. + Click on the TrayIcon and then move mouse over it: + - Appropriate mouse events should be generated (catched by the + AWTEventListener). + 8. Deselect all the checkboxes and go to the following step. + + CASE 4: Testing DISPLAY MESSAGE functionality. + ---------------------------------------------- + 1. Select some of the TrayIcons and add it. Then press Display message + button: + - A balloon message should appear near the TrayIcon. + 2. After the message is displayed wait for some period: + - The message window should be closed automatically. + 3. Display the message again. Close it by pressing X in its top-right + corner: + - The message window should be closed immediately. + 4. Display the message again. Click inside it: + - The message should be closed an ACTION_PERFORMED event should be + generated with correct information and an Ok dialog should appear. + Close the dialog. + 5. Select a message type from the Type choice and display the message + again: + - It should contain an icon appropriate to the message type selected + or no icon if NONE is selected. + 6. Change the content of the Message and Caption text fields and + display the message: + - The message content should be changed in the accordance with the text + typed. + 7. Not for Windows! Type some too long or too short text for the Caption + and Message: + - The message should process the text correctly. The long text should + be cut. + 8. Not for Windows! Type null in the Message text field and display + the message: + - The message body should contain no text. + 9. Type null in the Caption text field and display the message: + - The message caption should contain no text. + 10. Type null in the both Message and Caption fields and display + the message: + - NullPointerException should be generated and no message should be + displayed. + 11. Try to hide the taskbar. Click Display message for several times. + Then restore the taskbar. Click on the TrayIcon: + - No message should appear. + Try to display the message once more: + - It should appear appropriately. + 12. Try to display the message for other TrayIcons: + - The messages should be displayed appropriately. + + CASE 5: Testing POPUP MENU functionality. + ----------------------------------------- + 1. Add some TrayIcon to the system tray. Press Set button in the + Popup menu test area. Trigger the popup menu for the TrayIcon with + the mouse: + - A popup menu should appear. Make sure it behaves properly. + - Make sure the 'duke.gif' image is animated while the popup menu is shown. + 2. Press Remove button for the popup menu and try to trigger it again: + - No popup menu should appear. + 3. Perform 1-2 steps for other TrayIcons: + - Make sure the popup menu behaves properly. + 4. Add more than one TrayIcons to the system tray. Press Set button in + the PopupMenu test area for some of the TrayIcon added. Trigger + the popup menu for this TrayIcon: + - A popup menu should appear properly. + 5. Try to set the popup menu to the same TrayIcon again: + - It should have no effect + 6. Try to set the popup menu for other TrayIcons you've added to the system + tray: + - for each one IllegalArgumentException should be thrown. + + CASE 6: Testing TOOLTIP functionality. + -------------------------------------- + 1. Type something in the Tooltip text field and press Set button. + Then move mouse cursor over the TrayIcon and wait for a second: + - A tooltip should appear containing the text typed. + 2. Show a tooltip again and keep your mouse over the TrayIcon for some period: + - The tooltip should disappear automatically. + 3. Show a tooltip again and leave the TrayIcon: + - The tooltip should disappear immediately. + 4. Type null in the Tooltip field and press set then move your + mouse to the SystemTray: + - The tooltip shouldn't appear. + 5. Type something too long in the Tooltip field and show the tooltip: + - The tooltip text should be cut. + + CASE 7: Testing ACTION functionality. + ------------------------------------- + 1. Add some TrayIcon to the system tray. Double click it with the left mouse + button: + - An ACTION_PERFORMED event should be generated. + 2. Double click the TrayIcon with the left mouse button several times: + - Several ACTION_PERFORMED events should be generated + - Make sure that the time-stamp of each event ('when' field) is increased. + + If all the above cases work as expected Press PASS else FAIL. + """; + + public static void main(String[] args) throws Exception { + if (!SystemTray.isSupported()) { + throw new SkippedException("Test not applicable as" + + " System Tray not supported"); + } + try { + PassFailJFrame.builder() + .title("TrayIconTest Instructions") + .instructions(INSTRUCTIONS) + .columns(50) + .rows(40) + .testUI(TrayIconTest::createAndShowUI) + .logArea(10) + .build() + .awaitAndCheck(); + + } finally { + EventQueue.invokeAndWait(() -> { + if (tray != null) { + //Remove any remaining tray icons before ending the test. + TrayIcon[] icons = tray.getTrayIcons(); + for (TrayIcon icon : icons) { + tray.remove(icon); + } + } + }); + } + } + + private static Frame createAndShowUI() { + final TrayIconControl ctrl = new TrayIconControl(); + frame.setLayout(new BorderLayout()); + frame.add(ctrl.cont, BorderLayout.CENTER); + frame.setBackground(Color.LIGHT_GRAY); + + frame.addWindowListener(new WindowAdapter() { + public void windowClosing(WindowEvent e) { + ctrl.dispose(); + } + }); + + frame.pack(); + return frame; + } + + private static class TrayIconControl { + final String RED_ICON = "RED ICON"; + final String BLUE_ICON = "BLUE ICON"; + final String GREEN_ICON = "GREEN ICON"; + + CheckboxGroup cbg = new CheckboxGroup(); + Button addButton = new PackedButton(" Add "); + Button remButton = new PackedButton("Remove"); + Button resizeButton = new PackedButton("Resize"); + Button balloonButton = new PackedButton("Display message"); + Choice balloonChoice = new Choice(); + String[] balloonTypes = new String[] { "ERROR", "WARNING", "INFO", "NONE" }; + + TextField balloonText = new TextField( + "A TrayIcon can generate various MouseEvents and" + + " supports adding corresponding listeners to receive" + + " notification of these events. TrayIcon processes" + + " some of the events by itself. For example," + + " by default, when the right-mouse click", 70); + TextField balloonCaption = new TextField("TrayIcon", 70); + + MessageType[] typeArr = new MessageType[] { MessageType.ERROR, MessageType.WARNING, + MessageType.INFO, MessageType.NONE }; + Checkbox mouseListenerCbox = new Checkbox("MouseEvent"); + Checkbox motionListenerCbox = new Checkbox(" MouseMotionEvent"); + Checkbox awtListenerCbox = new Checkbox(" AWTEventListener"); + TextField tipText = new TextField("TrayIcon", 50); + Button tipButton = new PackedButton("Set"); + Button setPopupButton = new PackedButton("Set"); + Button remPopupButton = new PackedButton("Remove"); + + PopupMenu popupMenu = new PopupMenu(); + + Map resToObjMap = new HashMap<>(); + + Container cont = new Container(); + + TrayIconControl() { + Toolkit.getDefaultToolkit().addAWTEventListener(e -> { + if (e.getSource() instanceof TrayIcon && awtListenerCbox.getState()) { + PassFailJFrame.log(e.toString()); + } + }, MouseEvent.MOUSE_EVENT_MASK | MouseEvent.MOUSE_MOTION_EVENT_MASK | + ActionEvent.ACTION_EVENT_MASK); + + cont.setLayout(new GridLayout(4, 1)); + + Container raw1 = new Container(); + raw1.setLayout(new GridLayout(1, 4)); + cont.add(raw1); + + InsetsPanel cbgPanel = new InsetsPanel(); + cbgPanel.setLayout(new GridLayout(4, 1)); + Checkbox nullCbox = new Checkbox("null", cbg, true); + Checkbox redCbox = new Checkbox(RED_ICON, cbg, false); + Checkbox blueCbox = new Checkbox(BLUE_ICON, cbg, false); + Checkbox greenCbox = new Checkbox(GREEN_ICON, cbg, false); + cbgPanel.add(nullCbox); + cbgPanel.add(redCbox); + cbgPanel.add(blueCbox); + cbgPanel.add(greenCbox); + cbgPanel.addTo(raw1); + + InsetsPanel addremPanel = new InsetsPanel(); + addremPanel.setLayout(new BorderLayout()); + addremPanel.add(addButton.getParent(), BorderLayout.NORTH); + addremPanel.add(remButton.getParent(), BorderLayout.SOUTH); + addremPanel.addTo(raw1); + + InsetsPanel resizePanel = new InsetsPanel(); + resizePanel.add(resizeButton); + resizePanel.addTo(raw1); + + InsetsPanel lstPanel = new InsetsPanel(); + lstPanel.setLayout(new GridLayout(3, 1)); + lstPanel.add(mouseListenerCbox); + lstPanel.add(motionListenerCbox); + lstPanel.add(awtListenerCbox); + lstPanel.addTo(raw1); + + Container raw2 = new Container(); + raw2.setLayout(new BorderLayout()); + cont.add(raw2); + + InsetsPanel balloonPanel = new InsetsPanel(); + balloonPanel.setLayout(new BorderLayout()); + balloonPanel.add(balloonButton.getParent(), BorderLayout.NORTH); + Container bc = new Container(); + bc.setLayout(new FlowLayout()); + bc.add(new Label(" Type:")); + bc.add(balloonChoice); + balloonPanel.add(bc, BorderLayout.SOUTH); + balloonPanel.addTo(raw2, BorderLayout.WEST); + + InsetsPanel blnTextPanel = new InsetsPanel(); + blnTextPanel.setLayout(new GridLayout(2, 2)); + Container c1 = new Panel(); + c1.setLayout(new FlowLayout()); + blnTextPanel.add(c1); + c1.add(new Label("Message:")); + c1.add(balloonText); + + Container c2 = new Panel(); + c2.setLayout(new FlowLayout()); + blnTextPanel.add(c2); + c2.add(new Label("Caption:")); + c2.add(balloonCaption); + blnTextPanel.addTo(raw2, BorderLayout.CENTER); + + + Container raw3 = new Container(); + raw3.setLayout(new BorderLayout()); + cont.add(raw3); + + InsetsPanel popupPanel = new InsetsPanel(); + popupPanel.setLayout(new FlowLayout()); + popupPanel.add(new Label("Popup menu:")); + popupPanel.add(setPopupButton); + popupPanel.add(remPopupButton); + popupPanel.addTo(raw3); + + + Container raw4 = new Container(); + raw4.setLayout(new BorderLayout()); + cont.add(raw4); + + InsetsPanel tipPanel = new InsetsPanel(); + tipPanel.setLayout(new FlowLayout()); + tipPanel.add(new Label("Tooltip:")); + tipPanel.add(tipText); + tipPanel.add(tipButton); + tipPanel.addTo(raw4); + + addButton.addActionListener(e -> { + try { + tray.add(getCurIcon()); + } catch (NullPointerException npe) { + if (npe.getMessage() == null) { + PassFailJFrame.log("Probably wrong path to the images."); + throw npe; // if wrong images path was set + } + PassFailJFrame.log(npe.toString()); + } catch (IllegalArgumentException iae) { + PassFailJFrame.log(iae.toString()); + } catch (AWTException ise) { + PassFailJFrame.log(ise.toString()); + } + }); + remButton.addActionListener(e -> tray.remove(getCurIcon())); + + resizeButton.addActionListener( + e -> getCurIcon().setImageAutoSize(!getCurIcon().isImageAutoSize())); + + balloonButton.addActionListener(e -> { + String text = null, caption = null; + if (balloonText.getText().compareToIgnoreCase("null") != 0) { + text = balloonText.getText(); + } + if (balloonCaption.getText().compareToIgnoreCase("null") != 0) { + caption = balloonCaption.getText(); + } + try { + getCurIcon().displayMessage(caption, text, typeArr[balloonChoice.getSelectedIndex()]); + } catch (NullPointerException npe) { + PassFailJFrame.log(npe.toString()); + } + }); + + tipButton.addActionListener(e -> { + String tip = null; + if (tipText.getText().compareToIgnoreCase("null") != 0) { + tip = tipText.getText(); + } + getCurIcon().setToolTip(tip); + }); + + setPopupButton.addActionListener(e -> { + try { + getCurIcon().setPopupMenu(popupMenu); + } catch (IllegalArgumentException iae) { + PassFailJFrame.log(iae.toString()); + } + }); + + remPopupButton.addActionListener(e -> getCurIcon().setPopupMenu(null)); + for (String s: balloonTypes) { + balloonChoice.add(s); + } + + init(); + } + + void init() { + tray = SystemTray.getSystemTray(); + tray.addPropertyChangeListener("trayIcons", + e -> printPropertyChangeEvent(e)); + + tray.addPropertyChangeListener("systemTray", + e -> printPropertyChangeEvent(e)); + + configureTrayIcon(RED_ICON); + configureTrayIcon(BLUE_ICON); + configureTrayIcon(GREEN_ICON); + + for (String s: balloonTypes) { + popupMenu.add(new MenuItem(s)); + } + } + + void printPropertyChangeEvent(PropertyChangeEvent e) { + String name = e.getPropertyName(); + Object oldValue = e.getOldValue(); + Object newValue = e.getNewValue(); + + PassFailJFrame.log("PropertyChangeEvent[name=" + name + + ",oldValue=" + oldValue + ",newValue=" + newValue + "]"); + } + + void configureTrayIcon(String icon) { + Color color = Color.WHITE; + switch (icon) { + case "RED ICON" -> color = Color.RED; + case "BLUE ICON" -> color = Color.BLUE; + case "GREEN ICON" -> color = Color.GREEN; + } + Image image = createIcon(color); + TrayIcon trayIcon = new TrayIcon(image); + + trayIcon.addMouseListener(new MouseAdapter() { + public void mousePressed(MouseEvent e) { + if (mouseListenerCbox.getState()) + PassFailJFrame.log(e.toString()); + } + public void mouseReleased(MouseEvent e) { + if (mouseListenerCbox.getState()) + PassFailJFrame.log(e.toString()); + } + public void mouseClicked(MouseEvent e) { + if (mouseListenerCbox.getState()) + PassFailJFrame.log(e.toString()); + } + }); + trayIcon.addMouseMotionListener(new MouseMotionAdapter() { + public void mouseMoved(MouseEvent e) { + if (motionListenerCbox.getState()) + PassFailJFrame.log(e.toString()); + } + }); + trayIcon.addActionListener(e -> PassFailJFrame.log(e.toString())); + + resToObjMap.remove(icon); + resToObjMap.put(icon, trayIcon); + } + + String getCurImgName() { + return cbg.getSelectedCheckbox().getLabel(); + } + + TrayIcon getCurIcon() { + return resToObjMap.get(getCurImgName()); + } + + public void dispose() { + tray.remove(getCurIcon()); + } + + private static Image createIcon(Color color) { + BufferedImage image = new BufferedImage(16, 16, + BufferedImage.TYPE_INT_ARGB); + Graphics2D g = image.createGraphics(); + g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, + RenderingHints.VALUE_TEXT_ANTIALIAS_ON); + g.setColor(color); + g.fillRect(0, 0, 16, 16); + g.dispose(); + return image; + } + + } + + private static class InsetsPanel extends Panel { + Container parent = new Container() { + public Insets getInsets() { + return new Insets(2, 2, 2, 2); + } + }; + + InsetsPanel() { + parent.setLayout(new BorderLayout()); + setBackground(new Color(240, 240, 240)); + } + + void addTo(Container c) { + parent.add(this); + c.add(parent); + } + + void addTo(Container c, String pos) { + parent.add(this); + c.add(parent, pos); + } + } + + private static class PackedButton extends Button { + Container parent = new Container(); + PackedButton(String l) { + super(l); + parent.setLayout(new FlowLayout()); + parent.add(this); + } + } +} + diff --git a/test/jdk/java/awt/Window/BadConfigure/BadConfigure.java b/test/jdk/java/awt/Window/BadConfigure/BadConfigure.java new file mode 100644 index 000000000000..a25ab9b91b9a --- /dev/null +++ b/test/jdk/java/awt/Window/BadConfigure/BadConfigure.java @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2005, 2024, 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 6261336 + * @summary Tests that Choice inside ScrollPane opens at the right location + * after resize + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual BadConfigure +*/ + +import java.awt.BorderLayout; +import java.awt.Choice; +import java.awt.Frame; + +public class BadConfigure +{ + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + Please resize the BadConfigure window using the left border. + Now click on choice. Its popup will be opened. + Please verify that the popup is opened right under the choice. + """; + + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .columns(35) + .testUI(initialize()) + .build() + .awaitAndCheck(); + } + + private static Frame initialize() { + Frame f = new Frame("BadConfigure"); + f.setLayout(new BorderLayout()); + Choice ch = new Choice(); + f.add(ch, BorderLayout.NORTH); + ch.add("One"); + ch.add("One"); + ch.add("One"); + ch.add("One"); + ch.add("One"); + ch.add("One"); + f.setSize(200, 200); + f.validate(); + return f; + } +} diff --git a/test/jdk/java/awt/Window/InvalidFocusLostEventTest/InvalidFocusLostEventTest.java b/test/jdk/java/awt/Window/InvalidFocusLostEventTest/InvalidFocusLostEventTest.java new file mode 100644 index 000000000000..569d59f146d3 --- /dev/null +++ b/test/jdk/java/awt/Window/InvalidFocusLostEventTest/InvalidFocusLostEventTest.java @@ -0,0 +1,101 @@ +/* + * Copyright (c) 2001, 2024, 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 4397883 + * @summary Tests that non-focusable Window doesn't grab focus + * @key headful + * @run main InvalidFocusLostEventTest + */ + +import java.awt.Button; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.KeyboardFocusManager; +import java.awt.Point; +import java.awt.Robot; +import java.awt.Window; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.InputEvent; + +public class InvalidFocusLostEventTest implements ActionListener { + private static Frame f; + private static Button b; + private static KeyboardFocusManager fm; + private static volatile Point bp; + private static volatile int width, height; + private static Robot robot; + + public static void main(String[] args) throws Exception { + try { + InvalidFocusLostEventTest test = new InvalidFocusLostEventTest(); + EventQueue.invokeAndWait(() -> test.createUI()); + runTest(); + // we should check focus after all events are processed, + // since focus transfers are asynchronous + robot.waitForIdle(); + if (fm.getFocusOwner() != b) { + throw new RuntimeException("Failed: focus was lost"); + } + } finally { + EventQueue.invokeAndWait(() -> { + if (f != null) { + f.dispose(); + } + }); + } + } + + private void createUI() { + f = new Frame("InvalidFocusLostEventTest"); + b = new Button("Press me"); + fm = KeyboardFocusManager.getCurrentKeyboardFocusManager(); + b.addActionListener(this); + f.add(b); + f.pack(); + f.setLocationRelativeTo(null); + f.setVisible(true); + } + + private static void runTest() throws Exception { + robot = new Robot(); + robot.setAutoDelay(100); + robot.setAutoWaitForIdle(true); + EventQueue.invokeAndWait(() -> { + bp = b.getLocationOnScreen(); + width = b.getWidth(); + height = b.getHeight(); + }); + robot.mouseMove(bp.x + width / 2, bp.y + height / 2 ); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + } + + public void actionPerformed(ActionEvent ev) { + // pop up a non-focusable window + Window win = new Window(f); + win.setFocusableWindowState(false); + } +} diff --git a/test/jdk/java/awt/Window/LocationByPlatform/TestLocationByPlatform.java b/test/jdk/java/awt/Window/LocationByPlatform/TestLocationByPlatform.java new file mode 100644 index 000000000000..33b9d048ef2a --- /dev/null +++ b/test/jdk/java/awt/Window/LocationByPlatform/TestLocationByPlatform.java @@ -0,0 +1,105 @@ +/* + * Copyright (c) 2005, 2024, 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 6318630 + * @summary Test that location by platform works + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual TestLocationByPlatform + */ + +import java.awt.BorderLayout; +import java.awt.Canvas; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.Graphics; + +public class TestLocationByPlatform { + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + You should see two frames. One has locationByPlatform set, it + should be displayed somewhere on the screen most probably without + intersecting other Frames or stacked over normal frame with some + offset. Another has its location explicitly set to (0, 450). + Please verify that the frames are located correctly on the screen. + + Also verify that the picture inside of frames looks the same + and consists of red descending triangle occupying exactly the bottom + half of the frame. Make sure that there is a blue rectangle exactly + surrounding the client area of frame with no pixels between it and + the frame's decorations. Press Pass if this all is true, + otherwise press Fail. + """; + + PassFailJFrame passFailJFrame = PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .rows(13) + .columns(40) + .build(); + EventQueue.invokeAndWait(TestLocationByPlatform::createUI); + passFailJFrame.awaitAndCheck(); + } + private static void createUI() { + Frame frame = new Frame("Normal"); + frame.setLocation(0, 450); + Canvas c = new MyCanvas(); + frame.add(c, BorderLayout.CENTER); + frame.pack(); + PassFailJFrame.addTestWindow(frame); + frame.setVisible(true); + + frame = new Frame("Location by platform"); + frame.setLocationByPlatform(true); + c = new MyCanvas(); + frame.add(c, BorderLayout.CENTER); + frame.pack(); + PassFailJFrame.addTestWindow(frame); + frame.setVisible(true); + } + + static class MyCanvas extends Canvas { + @Override + public Dimension getPreferredSize() { + return new Dimension(400, 400); + } + + @Override + public void paint(Graphics g) { + g.setColor(Color.red); + for (int i = 399; i >= 0; i--) { + g.drawLine(400 - i - 1, 400 - i - 1, + 400 - i - 1, 399); + } + g.setColor(Color.blue); + g.drawLine(0, 0, 399, 0); + g.drawLine(0, 0, 0, 399); + g.drawLine(0, 399, 399, 399); + g.drawLine(399, 0, 399, 399); + } + } +} diff --git a/test/jdk/java/awt/Window/LocationByPlatformWithControls/TestLocationByPlatformWithControls.java b/test/jdk/java/awt/Window/LocationByPlatformWithControls/TestLocationByPlatformWithControls.java new file mode 100644 index 000000000000..bfdba97e4eb9 --- /dev/null +++ b/test/jdk/java/awt/Window/LocationByPlatformWithControls/TestLocationByPlatformWithControls.java @@ -0,0 +1,270 @@ +/* + * Copyright (c) 2003, 2024, 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 4102292 + * @summary Tests that location by platform works with other APIs + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual TestLocationByPlatformWithControls + */ + +import java.awt.BorderLayout; +import java.awt.Button; +import java.awt.Checkbox; +import java.awt.Frame; +import java.awt.Label; +import java.awt.Panel; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.ItemEvent; +import java.awt.event.ItemListener; +import java.util.Vector; + +public class TestLocationByPlatformWithControls extends Frame + implements ActionListener, ItemListener { + Panel northP; + Panel centerP; + Checkbox undecoratedCB; + Checkbox defaultLocationCB; + Checkbox visibleCB; + Checkbox iconifiedCB; + Checkbox maximizedCB; + Button createB; + Button packB; + Button moveB; + Button resizeB; + Button reshapeB; + Button disposeB; + Vector frames; + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + This test is to check that LocationByPlatform works with other + controls API. + 1) Create New Frame by clicking on "Create" Button in + "TestLocationByPlatformWithControls" window. + 2) Initially this Frame will not be visible, Click on checkbox + "LocationByPlatform" to set default platform location for the frame + and then click on checkbox "Visible" to see that Frame is displayed + at default offsets. + 3) Now you can play with different controls like Iconified, + Maximized, Pack, Move, Resize and Reshape to verify that these + controls work properly with the Frame. + 4) At the end dispose the Frame by clicking on "Dispose" button. + 5) Also we can do verify this for Undecorated Frame but for that we + need to follow same steps but in step 2 before we click on checkbox + "Visible", select "Undecorated" checkbox along with + "LocationByPlatform". + 6) If everything works properly test is passed, otherwise failed. + """; + + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .columns(40) + .testUI(TestLocationByPlatformWithControls::new) + .logArea(4) + .build() + .awaitAndCheck(); + } + + public TestLocationByPlatformWithControls() { + northP = new Panel(); + centerP = new Panel(); + + undecoratedCB = new Checkbox("Undecorated"); + defaultLocationCB = new Checkbox("LocationByPlatform"); + visibleCB = new Checkbox("Visible"); + iconifiedCB = new Checkbox("Iconified"); + maximizedCB = new Checkbox("Maximized"); + + createB = new Button("Create"); + packB = new Button("Pack"); + moveB = new Button("Move"); + resizeB = new Button("Resize"); + reshapeB = new Button("Reshape"); + disposeB = new Button("Dispose"); + + frames = new Vector(10); + this.setTitle("TestLocationByPlatformWithControls"); + this.setLayout(new BorderLayout()); + this.add(northP, BorderLayout.NORTH); + + northP.add(new Label("New Frame")); + + createB.addActionListener(this); + northP.add(createB); + + centerP.setEnabled(false); + this.add(centerP, BorderLayout.CENTER); + + centerP.add(new Label("Last Frame")); + + centerP.add(defaultLocationCB); + defaultLocationCB.addItemListener(this); + + centerP.add(undecoratedCB); + undecoratedCB.addItemListener(this); + + centerP.add(iconifiedCB); + iconifiedCB.addItemListener(this); + + centerP.add(maximizedCB); + maximizedCB.addItemListener(this); + + centerP.add(visibleCB); + visibleCB.addItemListener(this); + + packB.addActionListener(this); + centerP.add(packB); + + moveB.addActionListener(this); + centerP.add(moveB); + + resizeB.addActionListener(this); + centerP.add(resizeB); + + reshapeB.addActionListener(this); + centerP.add(reshapeB); + + disposeB.addActionListener(this); + centerP.add(disposeB); + this.pack(); + } + + public void actionPerformed(ActionEvent e) { + if (e.getSource() == createB) { + Frame frame = new Frame(); + frame.setSize(200, 200); + frames.add(frame); + updateControls(frame); + Panel panel = new Panel(); + frame.add(panel); + panel.add(new Button ("Test Button")); + panel.add(new Button ("Test Button 1")); + panel.add(new Button ("Test Button 2")); + panel.add(new Button ("Test Button 3")); + centerP.setEnabled(true); + return; + } + + if (frames.isEmpty()) { + return; + } + + Frame last = (Frame)frames.lastElement(); + + if (e.getSource() == packB) { + last.pack(); + } else + if (e.getSource() == moveB) { + int x = (int)(Math.random() * 200); + int y = (int)(Math.random() * 200); + last.setLocation(x, y); + } else + if (e.getSource() == resizeB) { + int w = (int)(Math.random() * 200); + int h = (int)(Math.random() * 200); + last.setSize(w, h); + } else + if (e.getSource() == reshapeB) { + int x = (int)(Math.random() * 200); + int y = (int)(Math.random() * 200); + int w = (int)(Math.random() * 200); + int h = (int)(Math.random() * 200); + last.setBounds(x, y, w, h); + } else + if (e.getSource() == disposeB) { + last.dispose(); + frames.remove(frames.size() - 1); + if (frames.isEmpty()) { + updateControls(null); + centerP.setEnabled(false); + return; + } + last = (Frame)frames.lastElement(); + } + updateControls(last); + } + + public void updateControls(Frame f) { + undecoratedCB.setState(f != null ? + f.isUndecorated() : false); + defaultLocationCB.setState(f != null ? + f.isLocationByPlatform() : false); + visibleCB.setState(f != null ? + f.isVisible() : false); + iconifiedCB.setState(f != null ? + (f.getExtendedState() & Frame.ICONIFIED) != 0 : false); + maximizedCB.setState(f != null ? + (f.getExtendedState() & Frame.MAXIMIZED_BOTH) != 0 : false); + } + + public void itemStateChanged(ItemEvent e) { + Frame last = (Frame)frames.lastElement(); + try { + boolean state = e.getStateChange() == ItemEvent.SELECTED; + if (e.getSource() == visibleCB) { + last.setVisible(state); + } else + if (e.getSource() == defaultLocationCB) { + last.setLocationByPlatform(state); + } else + if (e.getSource() == undecoratedCB) { + last.setUndecorated(state); + } else + if (e.getSource() == iconifiedCB) { + if (state) { + last.setExtendedState(last.getExtendedState() | + Frame.ICONIFIED); + } else { + last.setExtendedState(last.getExtendedState() & + ~Frame.ICONIFIED); + } + } else + if (e.getSource() == maximizedCB) { + if (state) { + last.setExtendedState(last.getExtendedState() | + Frame.MAXIMIZED_BOTH); + } else { + last.setExtendedState(last.getExtendedState() & + ~Frame.MAXIMIZED_BOTH); + } + } + } catch (Throwable ex) { + PassFailJFrame.log(ex.getMessage()); + } finally { + updateControls(last); + } + } + + @Override + public void dispose() { + while (!frames.isEmpty()) { + Frame last = (Frame)frames.lastElement(); + last.dispose(); + frames.remove(frames.size() - 1); + } + } +} diff --git a/test/jdk/java/awt/Window/NoResizeEvent/NoResizeEvent.java b/test/jdk/java/awt/Window/NoResizeEvent/NoResizeEvent.java new file mode 100644 index 000000000000..50b264acde97 --- /dev/null +++ b/test/jdk/java/awt/Window/NoResizeEvent/NoResizeEvent.java @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2003, 2024, 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 4942457 + * @key headful + * @summary Verifies that filtering of resize events on native level works. + * I.E.after Frame is shown no additional resize events are generated. + * @library /java/awt/patchlib ../../regtesthelpers + * @build java.desktop/java.awt.Helper + * @build Util + * @run main NoResizeEvent + */ + +import test.java.awt.regtesthelpers.Util; + +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.event.ComponentAdapter; +import java.awt.event.ComponentEvent; + +public class NoResizeEvent { + //Mutter can send window insets too late, causing additional resize events. + private static final boolean IS_MUTTER = Util.getWMID() == Util.MUTTER_WM; + private static final int RESIZE_COUNT_LIMIT = IS_MUTTER ? 5 : 3; + private static Frame frame; + static int resize_count = 0; + + public static void main(String[] args) throws Exception { + try { + EventQueue.invokeAndWait(() -> createUI()); + } finally { + EventQueue.invokeAndWait(() -> { + if (frame != null) { + frame.dispose(); + } + }); + if (resize_count > RESIZE_COUNT_LIMIT) { + throw new RuntimeException("Resize event arrived: " + + resize_count + " times."); + } + } + } + + private static void createUI() { + frame = new Frame("NoResizeEvent"); + frame.addComponentListener(new ComponentAdapter() { + public void componentResized(ComponentEvent e) { + System.out.println(e); + resize_count++; + } + }); + frame.setVisible(true); + + try { + Thread.sleep(3000); + } catch (InterruptedException ie) { + } + System.out.println("Resize count: " + resize_count); + } +} diff --git a/test/hotspot/jtreg/vmTestbase/vm/share/process/CmdExecutor.java b/test/jdk/java/awt/Window/OwnedWindowShowTest/OwnedWindowShowTest.java similarity index 53% rename from test/hotspot/jtreg/vmTestbase/vm/share/process/CmdExecutor.java rename to test/jdk/java/awt/Window/OwnedWindowShowTest/OwnedWindowShowTest.java index bea1bd8282bb..c8b5ad4a619d 100644 --- a/test/hotspot/jtreg/vmTestbase/vm/share/process/CmdExecutor.java +++ b/test/jdk/java/awt/Window/OwnedWindowShowTest/OwnedWindowShowTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2024, 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,44 +20,35 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package vm.share.process; -import java.io.IOException; -import java.util.Collection; - -public class CmdExecutor extends ProcessExecutor { - private final StringBuilder cmd = new StringBuilder(); - @Override - public void clearArgs() { - cmd.setLength(0); - } +/* + * @test + * @bug 4177156 + * @key headful + * @summary Tests that multiple level of window ownership doesn't cause + * NullPointerException when showing a Window + * @run main OwnedWindowShowTest + */ - @Override - public void addArg(String arg) { - cmd.append(" " + arg); - } +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.Window; - @Override - public void addArgs(String[] args) { - for (String arg : args) { - addArg(arg); - } +public class OwnedWindowShowTest { + public static void main(String[] args) throws Exception { + EventQueue.invokeAndWait(OwnedWindowShowTest::runTest); } - @Override - public void addArgs(Collection args) { - for (String arg : args) { - addArg(arg); + static void runTest() { + Frame parent = new Frame("OwnedWindowShowTest"); + try { + Window owner = new Window(parent); + Window window = new Window(owner); + // Showing a window with multiple levels of ownership + // should not throw NullPointerException + window.setVisible(true); + } finally { + parent.dispose(); } } - - @Override - protected Process createProcess() throws IOException { - return Runtime.getRuntime().exec(cmd.toString()); - } - - @Override - public String toString() { - return cmd.toString(); - } } diff --git a/test/jdk/java/awt/Window/ProxyCrash/PopupProxyCrash.java b/test/jdk/java/awt/Window/ProxyCrash/PopupProxyCrash.java new file mode 100644 index 000000000000..b17b934a7028 --- /dev/null +++ b/test/jdk/java/awt/Window/ProxyCrash/PopupProxyCrash.java @@ -0,0 +1,192 @@ +/* + * Copyright (c) 2001, 2024, 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 4381561 + * @key headful + * @summary Tests that when we show the popup window AWT doesn't crash due to + * the problems with focus proxy window code + * @run main PopupProxyCrash + */ + +import java.awt.BorderLayout; +import java.awt.Button; +import java.awt.Color; +import java.awt.Container; +import java.awt.Dimension; +import java.awt.EventQueue; +import java.awt.Font; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Panel; +import java.awt.Point; +import java.awt.Robot; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.InputEvent; + +import javax.swing.Box; +import javax.swing.JComboBox; +import javax.swing.JTextField; +import javax.swing.plaf.basic.BasicComboBoxUI; +import javax.swing.plaf.basic.BasicComboPopup; +import javax.swing.plaf.basic.ComboPopup; + +public class PopupProxyCrash implements ActionListener { + private static JTextField jtf; + private static Button tf; + private static Panel panel; + private static Font[] fonts; + private static Robot robot; + + private static JComboBox cb; + + private static MyComboBoxUI comboBoxUI; + private static Frame frame; + private static int TEST_COUNT = 10; + public static void main(String[] args) throws Exception { + try { + robot = new Robot(); + robot.setAutoDelay(100); + EventQueue.invokeAndWait(() -> createUI()); + robot.waitForIdle(); + runTest(); + } finally { + EventQueue.invokeAndWait(() -> { + if (frame != null) { + frame.dispose(); + } + }); + } + } + + private static void createUI() { + frame = new Frame("PopupProxyCrash"); + Font dialog = new Font("Dialog", Font.PLAIN, 12); + Font serif = new Font("Serif", Font.PLAIN, 12); + Font monospaced = new Font("Monospaced", Font.PLAIN, 12); + + fonts = new Font[] { dialog, serif, monospaced }; + + cb = new JComboBox(fonts); + + cb.setLightWeightPopupEnabled(false); + comboBoxUI = new MyComboBoxUI(); + cb.setUI(comboBoxUI); + jtf = new JTextField("JTextField"); + jtf.setFont(fonts[1]); + tf = new Button("TextField"); + tf.setFont(fonts[1]); + cb.addActionListener(new PopupProxyCrash()); + + panel = new Panel() { + public Dimension getPreferredSize() { + return new Dimension(100, 20); + } + public void paint(Graphics g) { + System.out.println("Painting with font " + getFont()); + g.setColor(Color.white); + g.fillRect(0, 0, getWidth(), getHeight()); + g.setColor(Color.black); + g.setFont(getFont()); + g.drawString("LightWeight", 10, 10); + } + }; + panel.setFont(fonts[1]); + + Container parent = Box.createVerticalBox(); + parent.add(jtf); + parent.add(tf); + parent.add(panel); + parent.add(cb); + + frame.add(parent, BorderLayout.CENTER); + frame.pack(); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + } + + private static Point getComboBoxLocation() throws Exception { + final Point[] result = new Point[1]; + + EventQueue.invokeAndWait(() -> { + Point point = cb.getLocationOnScreen(); + Dimension size = cb.getSize(); + + point.x += size.width / 2; + point.y += size.height / 2; + result[0] = point; + }); + return result[0]; + } + + private static Point getItemPointToClick(final int item) throws Exception { + final Point[] result = new Point[1]; + + EventQueue.invokeAndWait(() -> { + BasicComboPopup popup = (BasicComboPopup)comboBoxUI.getComboPopup(); + Point point = popup.getLocationOnScreen(); + Dimension size = popup.getSize(); + + int step = size.height / fonts.length; + point.x += size.width / 2; + point.y += step / 2 + step * item; + result[0] = point; + }); + return result[0]; + } + + static void runTest() throws Exception { + for (int i = 0; i < TEST_COUNT; i++) { + Point point = getComboBoxLocation(); + robot.mouseMove(point.x, point.y); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + robot.waitForIdle(); + robot.delay(500); + + point = getItemPointToClick(i % fonts.length); + robot.mouseMove(point.x, point.y); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + robot.waitForIdle(); + robot.delay(500); + } + } + public void actionPerformed(ActionEvent ae) { + System.out.println("Font selected"); + Font font = fonts[((JComboBox)ae.getSource()).getSelectedIndex()]; + + tf.setFont(font); + jtf.setFont(font); + panel.setFont(font); + panel.repaint(); + } + + private static class MyComboBoxUI extends BasicComboBoxUI { + public ComboPopup getComboPopup() { + return popup; + } + } +} diff --git a/test/jdk/java/awt/Window/ResizeTest/ResizeTest.java b/test/jdk/java/awt/Window/ResizeTest/ResizeTest.java new file mode 100644 index 000000000000..a9191f8bd053 --- /dev/null +++ b/test/jdk/java/awt/Window/ResizeTest/ResizeTest.java @@ -0,0 +1,80 @@ +/* + * Copyright (c) 1999, 2024, 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 4225955 + * @summary Tests that focus lost is delivered to a lightweight component + * in a disposed window + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual ResizeTest + */ + +import java.awt.BorderLayout; +import java.awt.Button; +import java.awt.Dialog; +import java.awt.Frame; + +public class ResizeTest +{ + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + 1) Push button A to create modal dialog 2. + 2) Resize dialog 2, then click button B to hide it. + 3) Push button A again. Dialog B should be packed to its original + size. + 4) Push button B again to hide, and A to reshow. + Dialog B should still be the same size, then test is passed, + otherwise failed. + 5) Push button B to hide the modal dialog and then select pass/fail. + """; + + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .columns(40) + .testUI(ResizeTest::createUI) + .build() + .awaitAndCheck(); + } + + private static Frame createUI() { + Frame f = new Frame("1"); + Dialog d = new Dialog(f, "2", true); + d.setLocationRelativeTo(null); + Button b2 = new Button("B"); + b2.addActionListener(e -> d.setVisible(false)); + d.setLayout(new BorderLayout()); + d.add(b2, BorderLayout.CENTER); + + Button b = new Button("A"); + f.add(b, BorderLayout.CENTER); + b.addActionListener(e -> { + d.pack(); + d.setVisible(true); + }); + f.pack(); + return f; + } +} diff --git a/test/jdk/java/awt/Window/ShowWindowTest/ShowWindowTest.java b/test/jdk/java/awt/Window/ShowWindowTest/ShowWindowTest.java new file mode 100644 index 000000000000..4857929c94eb --- /dev/null +++ b/test/jdk/java/awt/Window/ShowWindowTest/ShowWindowTest.java @@ -0,0 +1,88 @@ +/* + * Copyright (c) 1998, 2024, 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 4084997 + * @summary See if Window can be created without its size explicitly set + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual ShowWindowTest + */ + +import java.awt.Button; +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.Label; +import java.awt.Window; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +public class ShowWindowTest implements ActionListener +{ + private static Window window; + private static Button showButton; + private static Button hideButton; + + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + 1. You should see a Frame with a "Show" and a "Hide" button in it. + 2. Click on the "Show" button. A window with a "Hello World" Label + should appear + 3. If the window does not appear, the test failed, otherwise passed. + """; + + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .columns(40) + .testUI(ShowWindowTest::createUI) + .build() + .awaitAndCheck(); + } + + private static Frame createUI() { + Frame frame = new Frame("ShowWindowTest"); + frame.setLayout(new FlowLayout()); + frame.setSize(100,100); + frame.add(showButton = new Button("Show")); + frame.add(hideButton = new Button("Hide")); + + ActionListener handler = new ShowWindowTest(); + showButton.addActionListener(handler); + hideButton.addActionListener(handler); + + window = new Window(frame); + window.add("Center", new Label("Hello World")); + window.setLocationRelativeTo(null); + return frame; + } + + public void actionPerformed(ActionEvent e) { + if (e.getSource() == showButton) { + window.pack(); + window.setVisible(true); + } else if (e.getSource() == hideButton) + window.setVisible(false); + } +} diff --git a/test/jdk/java/awt/Window/WindowToFrontTest/WindowToFrontTest.java b/test/jdk/java/awt/Window/WindowToFrontTest/WindowToFrontTest.java new file mode 100644 index 000000000000..e6bbadcb546d --- /dev/null +++ b/test/jdk/java/awt/Window/WindowToFrontTest/WindowToFrontTest.java @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2001, 2024, 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 4488209 + * @summary JFrame toFront causes the entire frame to be repainted, causes UI + * to flash + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual WindowToFrontTest + */ + +import java.awt.BorderLayout; +import java.awt.Button; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +public class WindowToFrontTest implements ActionListener { + static Frame frame; + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + 1) Click the "toFront" button, this causes the + "WindowToFrontTest" frame to move front and gets repainted + completely. + 2) Move "WindowToFrontTest" window and continue to click on "toFront + multiple times. If the "WindowToFrontTest" Frame content is not + drawn properly and continues to blink, test is failed + otherwise passed. + """; + + PassFailJFrame passFailJFrame = PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .rows(13) + .columns(40) + .build(); + EventQueue.invokeAndWait(() -> createUI()); + passFailJFrame.awaitAndCheck(); + } + + private static void createUI() { + frame = new Frame("WindowToFrontTest"); + frame.setLayout(new BorderLayout()); + frame.setSize(512, 512); + PassFailJFrame.addTestWindow(frame); + frame.setVisible(true); + + Frame buttonFrame = new Frame("Test Button"); + Button push = new Button("toFront"); + push.addActionListener(new WindowToFrontTest()); + buttonFrame.add(push); + buttonFrame.pack(); + PassFailJFrame.addTestWindow(buttonFrame); + buttonFrame.setVisible(true); + } + + public void actionPerformed(ActionEvent e) { + frame.toFront(); + } +} diff --git a/test/jdk/java/awt/Window/bug4189244.java b/test/jdk/java/awt/Window/bug4189244.java new file mode 100644 index 000000000000..df37d2fce0e2 --- /dev/null +++ b/test/jdk/java/awt/Window/bug4189244.java @@ -0,0 +1,120 @@ +/* + * Copyright (c) 2000, 2024, 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 4189244 + * @summary Swing Popup menu is not being refreshed (cleared) under a Dialog + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @requires (os.family == "windows") + * @run main/manual bug4189244 +*/ + +import java.awt.BorderLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JMenuItem; +import javax.swing.JOptionPane; +import javax.swing.JPanel; +import javax.swing.JPopupMenu; + +public class bug4189244 { + + private static final String INSTRUCTIONS = """ + This is Windows only test! + + Click right button on frame to show popup menu. + (menu should be placed inside frame otherwise bug is not reproducible) + click on any menu item (dialog will be shown). + close dialog. + if you see part of popupmenu, under dialog, before it is closed, + then test failed, else passed."""; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("bug4189244 Instructions") + .instructions(INSTRUCTIONS) + .rows((int)INSTRUCTIONS.lines().count() + 2) + .columns(35) + .testUI(bug4189244::createTestUI) + .build() + .awaitAndCheck(); + } + + + private static JFrame createTestUI() { + RefreshBug panel = new RefreshBug(); + JFrame frame = new JFrame("Popup refresh bug"); + + frame.add(panel, BorderLayout.CENTER); + panel.init(); + frame.setSize(400, 400); + return frame; + } +} + +class RefreshBug extends JPanel implements ActionListener { + JPopupMenu _jPopupMenu = new JPopupMenu(); + + public void init() { + JMenuItem menuItem; + JButton jb = new JButton("Bring the popup here and select an item"); + + this.add(jb, BorderLayout.CENTER); + + for(int i = 1; i < 10; i++) { + menuItem = new JMenuItem("Item " + i); + menuItem.addActionListener(this); + _jPopupMenu.add(menuItem); + } + + MouseListener ml = new MouseAdapter() { + public void mouseReleased(MouseEvent e) { + if (e.isPopupTrigger()) { + _jPopupMenu.show(e.getComponent(), + e.getX(), e.getY()); + } + } + }; + this.addMouseListener(ml); + + jb.addMouseListener(ml); + + } + + // An action is requested by the user + public void actionPerformed(java.awt.event.ActionEvent e) { + JOptionPane.showMessageDialog(this, + "Check if there is some popup left under me\n"+ + "if not, retry and let the popup appear where i am", + "WARNING", + JOptionPane.WARNING_MESSAGE); + + } +} diff --git a/test/jdk/java/awt/color/NonICCFilterTest.java b/test/jdk/java/awt/color/NonICCFilterTest.java new file mode 100644 index 000000000000..bddd89ed6b35 --- /dev/null +++ b/test/jdk/java/awt/color/NonICCFilterTest.java @@ -0,0 +1,151 @@ +/* + * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Color; +import java.awt.GradientPaint; +import java.awt.Graphics2D; +import java.awt.Transparency; +import java.awt.color.ColorSpace; +import java.awt.image.BufferedImage; +import java.awt.image.ColorConvertOp; +import java.awt.image.ComponentColorModel; +import java.awt.image.DataBuffer; +import java.awt.image.WritableRaster; + +/* + * @test + * @bug 8316497 + * @summary Verifies Color filter on non-ICC profile + */ +public final class NonICCFilterTest { + private static final int WIDTH = 100; + private static final int HEIGHT = 100; + + private enum ColorSpaceSelector { + GRAY, + RGB, + PYCC, + WRAPPED_GRAY, + WRAPPED_RGB, + WRAPPED_PYCC + } + + private static final class TestColorSpace extends ColorSpace { + + private final ColorSpace cs; + + TestColorSpace(ColorSpace cs) { + super(cs.getType(), cs.getNumComponents()); + this.cs = cs; + } + + @Override + public float[] toRGB(float[] colorvalue) { + return cs.toRGB(colorvalue); + } + + @Override + public float[] fromRGB(float[] rgbvalue) { + return cs.fromRGB(rgbvalue); + } + + @Override + public float[] toCIEXYZ(float[] colorvalue) { + return cs.toCIEXYZ(colorvalue); + } + + @Override + public float[] fromCIEXYZ(float[] xyzvalue) { + return cs.fromCIEXYZ(xyzvalue); + } + } + + private static BufferedImage createTestImage(final ColorSpace cs) { + ComponentColorModel cm = new ComponentColorModel(cs, false, false, + Transparency.OPAQUE, DataBuffer.TYPE_BYTE); + WritableRaster raster = cm.createCompatibleWritableRaster(WIDTH, HEIGHT); + BufferedImage img = new BufferedImage(cm, raster, false, null); + + Graphics2D g = img.createGraphics(); + GradientPaint gp = new GradientPaint(0, 0, Color.GREEN, + raster.getWidth(), raster.getHeight(), Color.BLUE); + g.setPaint(gp); + g.fillRect(0, 0, raster.getWidth(), raster.getHeight()); + g.dispose(); + + return img; + } + + private static ColorSpace createCS(ColorSpaceSelector selector) { + return switch (selector) { + case GRAY -> ColorSpace.getInstance(ColorSpace.CS_GRAY); + case WRAPPED_GRAY -> new TestColorSpace(ColorSpace.getInstance(ColorSpace.CS_GRAY)); + + case RGB -> ColorSpace.getInstance(ColorSpace.CS_sRGB); + case WRAPPED_RGB -> new TestColorSpace(ColorSpace.getInstance(ColorSpace.CS_sRGB)); + + case PYCC -> ColorSpace.getInstance(ColorSpace.CS_PYCC); + case WRAPPED_PYCC -> new TestColorSpace(ColorSpace.getInstance(ColorSpace.CS_PYCC)); + }; + } + + private static boolean areImagesEqual(BufferedImage destTest, BufferedImage destGold) { + for (int x = 0; x < destTest.getWidth(); x++) { + for (int y = 0; y < destTest.getHeight(); y++) { + int rgb1 = destTest.getRGB(x, y); + int rgb2 = destGold.getRGB(x, y); + if (rgb1 != rgb2) { + System.err.println("x = " + x + ", y = " + y); + System.err.println("rgb1 = " + Integer.toHexString(rgb1)); + System.err.println("rgb2 = " + Integer.toHexString(rgb2)); + return false; + } + } + } + return true; + } + + public static void main(String[] args) { + BufferedImage srcTest = createTestImage(createCS(ColorSpaceSelector.WRAPPED_GRAY)); + BufferedImage destTest = createTestImage(createCS(ColorSpaceSelector.WRAPPED_RGB)); + + BufferedImage srcGold = createTestImage(createCS(ColorSpaceSelector.GRAY)); + BufferedImage destGold = createTestImage(createCS(ColorSpaceSelector.RGB)); + + ColorConvertOp gold = new ColorConvertOp(createCS(ColorSpaceSelector.PYCC), null); + gold.filter(srcTest, destTest); + gold.filter(srcGold, destGold); + + if (!areImagesEqual(destTest, destGold)) { + throw new RuntimeException("ICC test failed"); + } + + ColorConvertOp test = new ColorConvertOp(createCS(ColorSpaceSelector.WRAPPED_PYCC), null); + test.filter(srcTest, destTest); + test.filter(srcGold, destGold); + + if (!areImagesEqual(destTest, destGold)) { + throw new RuntimeException("Wrapper test failed"); + } + } +} diff --git a/test/jdk/java/awt/color/XAWTDifference/XAWTColors.jpg b/test/jdk/java/awt/color/XAWTDifference/XAWTColors.jpg new file mode 100644 index 000000000000..f53b30407cc2 Binary files /dev/null and b/test/jdk/java/awt/color/XAWTDifference/XAWTColors.jpg differ diff --git a/test/jdk/java/awt/color/XAWTDifference/XAWTDifference.java b/test/jdk/java/awt/color/XAWTDifference/XAWTDifference.java new file mode 100644 index 000000000000..ef0f5aacf447 --- /dev/null +++ b/test/jdk/java/awt/color/XAWTDifference/XAWTDifference.java @@ -0,0 +1,223 @@ +/* + * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Button; +import java.awt.Canvas; +import java.awt.Checkbox; +import java.awt.Choice; +import java.awt.Component; +import java.awt.Frame; +import java.awt.GridLayout; +import java.awt.Image; +import java.awt.Label; +import java.awt.Menu; +import java.awt.MenuBar; +import java.awt.MenuItem; +import java.awt.Panel; +import java.awt.PopupMenu; +import java.awt.ScrollPane; +import java.awt.Scrollbar; +import java.awt.TextArea; +import java.awt.TextField; +import java.awt.Window; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.io.File; +import java.util.ArrayList; +import java.util.List; + +import javax.swing.ImageIcon; +import javax.swing.JLabel; + +/* + * @test + * @bug 5092883 6513478 7154025 + * @requires (os.family == "linux") + * @summary REGRESSION: SystemColor class gives back wrong values under Linux + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual XAWTDifference + */ + +public class XAWTDifference { + + private static final String INSTRUCTIONS = """ + You would see a frame with title "XAWTDifference Test Frame". + + Test Frame (1) + + a) It has three columns in it. The 1st one with ordinary components. + The 2nd one with disabled components. + The 3rd one with uneditable components (only text components + are there). Verify that the difference between different states + is visible. + + Standard Frame (2) + + b) You would also see a frame named StandardFrame (2) + with a lot of components in it. Actually this is just a jpg-image + in a frame. Verify that every component in the frame (1) looks + similar to the same component in (2). + + They might differ in colors and be darker or brighter but + the whole picture should be the same. + + c) Also check the color of the MenuBar Items in the MenuBar and + the PopupMenu assigned to TextArea. + As you can't compare the colors of menu items with the picture + so just look if the are adequate enough. + """; + private static final int HGAP = 20; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .columns(40) + .testUI(XAWTDifference::createAndShowUI) + .positionTestUI(XAWTDifference::positionMultiTestUI) + .build() + .awaitAndCheck(); + } + + private static Panel addComponentsIntoPanel(boolean enabled, boolean editable) { + TextField tf = new TextField("TextField"); + TextArea ta = new TextArea("TextArea", 10, 10); + + Choice levelChooser = new Choice(); + levelChooser.add("Item #1"); + levelChooser.add("Item #2"); + + Button b = new Button("BUTTON"); + Label label = new Label("LABEL"); + java.awt.List list = new java.awt.List(4, false); + list.add("one"); + list.add("two"); + list.add("three"); + + Checkbox chb = new Checkbox(); + Scrollbar sb = new Scrollbar(Scrollbar.HORIZONTAL); + ScrollPane sp = new ScrollPane(ScrollPane.SCROLLBARS_ALWAYS); + sp.add(new TextArea("this is a textarea in scrollpane")); + sp.setSize(200, 200); + Canvas canvas = new Canvas(); + canvas.setSize(100, 100); + + //add popup menu to Button + final PopupMenu pm = new PopupMenu(); + MenuItem i1 = new MenuItem("Item1"); + MenuItem i2 = new MenuItem("Item2"); + MenuItem i3 = new MenuItem("Item3"); + i3.setEnabled(false); + pm.add(i1); + pm.add(i2); + pm.add(i3); + canvas.add(pm); + + ta.add(pm); + ta.addMouseListener(new MouseAdapter() { + public void mousePressed(MouseEvent me) { + if (me.isPopupTrigger()) { + pm.show(me.getComponent(), me.getX(), me.getY()); + } + } + }); + + ArrayList componentList = new ArrayList<>(); + + componentList.add(tf); + componentList.add(ta); + if (editable){ + componentList.add(levelChooser); + componentList.add(b); + componentList.add(label); + componentList.add(list); + componentList.add(chb); + componentList.add(sb); + componentList.add(sp); + componentList.add(canvas); + } else { + tf.setEditable(false); + ta.setEditable(false); + } + + Panel panel = new Panel(); + panel.setLayout(new GridLayout(0, 1)); + for (Component c : componentList) { + if (!enabled) { + c.setEnabled(false); + } + panel.add(c); + } + return panel; + } + + private static List createAndShowUI() { + Frame testFrame = new Frame("XAWTDifference Test Frame"); + StandardFrame standardFrame = new StandardFrame("StandardFrame"); + standardFrame.pack(); + + testFrame.setLayout(new GridLayout(1, 3)); + testFrame.add(addComponentsIntoPanel(true, true)); + testFrame.add(addComponentsIntoPanel(false, true)); + testFrame.add(addComponentsIntoPanel(true, false)); + + MenuItem mi1 = new MenuItem("Item1"); + MenuItem mi2 = new MenuItem("Item2"); + MenuItem mi3 = new MenuItem("Disabled Item3"); + mi3.setEnabled(false); + + MenuBar mb = new MenuBar(); + Menu enabledMenu = new Menu("Enabled Menu"); + Menu disabledMenu = new Menu("Disabled Menu"); + disabledMenu.setEnabled(false); + mb.add(enabledMenu); + mb.add(disabledMenu); + enabledMenu.add(mi1); + enabledMenu.add(mi2); + enabledMenu.add(mi3); + + testFrame.setMenuBar(mb); + testFrame.setSize(standardFrame.getWidth(), standardFrame.getHeight()); + return List.of(testFrame, standardFrame); + } + + private static void positionMultiTestUI(List windows, + PassFailJFrame.InstructionUI instructionUI) { + int x = instructionUI.getLocation().x + instructionUI.getSize().width + HGAP; + for (Window w : windows) { + w.setLocation(x, instructionUI.getLocation().y); + x += w.getWidth() + HGAP; + } + } + + private static class StandardFrame extends Frame { + public StandardFrame(String name) { + super(name); + String testPath = System.getProperty("test.src", "."); + Panel panel = new Panel(); + panel.add(new JLabel(new ImageIcon(testPath + File.separator + "XAWTColors.jpg"))); + add(panel); + } + } +} diff --git a/test/jdk/java/awt/datatransfer/HTMLDataFlavors/ManualHTMLDataFlavorTest.html b/test/jdk/java/awt/datatransfer/HTMLDataFlavors/ManualHTMLDataFlavorTest.html deleted file mode 100644 index 0a444d5b8ea4..000000000000 --- a/test/jdk/java/awt/datatransfer/HTMLDataFlavors/ManualHTMLDataFlavorTest.html +++ /dev/null @@ -1,43 +0,0 @@ - - - - - -ManualHTMLDataFlavorTest - - - -

    ManualHTMLDataFlavorTest
    Bug ID: 7075105

    - -

    See the dialog box (usually in upper left corner) for instructions

    - - - - diff --git a/test/jdk/java/awt/datatransfer/HTMLDataFlavors/ManualHTMLDataFlavorTest.java b/test/jdk/java/awt/datatransfer/HTMLDataFlavors/ManualHTMLDataFlavorTest.java index bd1ea752edba..4e875461ba27 100644 --- a/test/jdk/java/awt/datatransfer/HTMLDataFlavors/ManualHTMLDataFlavorTest.java +++ b/test/jdk/java/awt/datatransfer/HTMLDataFlavors/ManualHTMLDataFlavorTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,24 +22,32 @@ */ /* - test + @test @bug 7075105 @summary WIN: Provide a way to format HTML on drop - @author Denis Fokin: area=datatransfer - @run applet/manual=yesno ManualHTMLDataFlavorTest + @library /java/awt/regtesthelpers + @run main/manual ManualHTMLDataFlavorTest */ -import java.applet.Applet; -import java.awt.*; + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Frame; +import java.awt.Panel; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.Transferable; import java.awt.datatransfer.UnsupportedFlavorException; -import java.awt.dnd.*; +import java.awt.dnd.DnDConstants; +import java.awt.dnd.DropTarget; +import java.awt.dnd.DropTargetDragEvent; +import java.awt.dnd.DropTargetDropEvent; +import java.awt.dnd.DropTargetEvent; +import java.awt.dnd.DropTargetListener; import java.io.IOException; -public class ManualHTMLDataFlavorTest extends Applet { +public class ManualHTMLDataFlavorTest { - class DropPane extends Panel implements DropTargetListener { + static class DropPane extends Panel implements DropTargetListener { DropPane() { requestFocus(); @@ -49,7 +57,7 @@ class DropPane extends Panel implements DropTargetListener { @Override public Dimension getPreferredSize() { - return new Dimension(200,200); + return new Dimension(400, 400); } @Override @@ -73,15 +81,15 @@ public void dragExit(DropTargetEvent dte) {} @Override public void drop(DropTargetDropEvent dtde) { if (!dtde.isDataFlavorSupported(DataFlavor.allHtmlFlavor)) { - Sysout.println("DataFlavor.allHtmlFlavor is not present in the system clipboard"); + ManualHTMLDataFlavorTest.log("DataFlavor.allHtmlFlavor is not present in the system clipboard"); dtde.rejectDrop(); return; } else if (!dtde.isDataFlavorSupported(DataFlavor.fragmentHtmlFlavor)) { - Sysout.println("DataFlavor.fragmentHtmlFlavor is not present in the system clipboard"); + ManualHTMLDataFlavorTest.log("DataFlavor.fragmentHtmlFlavor is not present in the system clipboard"); dtde.rejectDrop(); return; } else if (!dtde.isDataFlavorSupported(DataFlavor.selectionHtmlFlavor)) { - Sysout.println("DataFlavor.selectionHtmlFlavor is not present in the system clipboard"); + ManualHTMLDataFlavorTest.log("DataFlavor.selectionHtmlFlavor is not present in the system clipboard"); dtde.rejectDrop(); return; } @@ -90,12 +98,13 @@ public void drop(DropTargetDropEvent dtde) { Transferable t = dtde.getTransferable(); try { - Sysout.println("ALL:"); - Sysout.println(t.getTransferData(DataFlavor.allHtmlFlavor).toString()); - Sysout.println("FRAGMENT:"); - Sysout.println(t.getTransferData(DataFlavor.fragmentHtmlFlavor).toString()); - Sysout.println("SELECTION:"); - Sysout.println(t.getTransferData(DataFlavor.selectionHtmlFlavor).toString()); + ManualHTMLDataFlavorTest.log("ALL:"); + ManualHTMLDataFlavorTest.log(t.getTransferData(DataFlavor.allHtmlFlavor).toString()); + t.getTransferData(DataFlavor.allHtmlFlavor).toString(); + ManualHTMLDataFlavorTest.log("FRAGMENT:"); + ManualHTMLDataFlavorTest.log(t.getTransferData(DataFlavor.fragmentHtmlFlavor).toString()); + ManualHTMLDataFlavorTest.log("SELECTION:"); + ManualHTMLDataFlavorTest.log(t.getTransferData(DataFlavor.selectionHtmlFlavor).toString()); } catch (UnsupportedFlavorException | IOException e) { e.printStackTrace(); } @@ -103,189 +112,49 @@ public void drop(DropTargetDropEvent dtde) { } } - public void init() { - - String[] instructions = - { - "1) The test contains a drop-aware panel with a red background", - "2) Open some page in a browser, select some text", - " Drag and drop it on the red panel", - " IMPORTANT NOTE: the page should be stored locally.", - " otherwise for instance iexplore can prohibit drag and drop from", - " the browser to other applications because of", - " the protected mode restrictions.", - " On Mac OS X do NOT use Safari, it does not provide the needed DataFlavor", - "3) Check the data in the output area of this dialog", - "5) The output should not contain information that any of", - " flavors is not present in the system clipboard", - "6) The output should contain data in three different formats", - " provided by the system clipboard", - " - Data after the \"ALL:\" marker should include the data", - " from the \"SELECTION:\" marker", - " - Data after the \"FRAGMENT\" marker should include the data", - " from the \"SELECTION:\" marker and may be some closing", - " tags could be added to the mark-up", - " - Data after the \"SELECTION:\" marker should correspond", - " to the data selected in the browser", - "7) If the above requirements are met, the test is passed" - }; - - add(new DropPane()); - Sysout.createDialogWithInstructions( instructions ); - - new ManualHTMLDataFlavorTest(); + static final String INSTRUCTIONS = """ + 1) The test contains a drop-aware panel with a red background. + 2) Open some page in a browser, select some text. + Drag and drop it on the red panel. + IMPORTANT NOTE: the page should be stored locally. + Otherwise for instance Internet Explorer may prohibit drag and drop from + the browser to other applications because of protected mode restrictions. + On MacOS do NOT use Safari, it does not provide the needed DataFlavor. + 3) Check the data in the output area of this window. + 5) The output should not contain information that any of + flavors is not present in the system clipboard. + 6) The output should contain data in three different formats + provided by the system clipboard. + - Data after the "ALL:" marker should include the data + from the "SELECTION:" marker". + - Data after the "FRAGMENT" marker should include the data + from the "SELECTION:" marker and may be some closing + tags could be added to the mark-up. + - Data after the "SELECTION:" marker should correspond + to the data selected in the browser. + 7) If the above requirements are met, the test is passed. + """; + + static Frame createDropWindow() { + Frame frame = new Frame("Manual HTML DataFlavor Test"); + frame.add(new DropPane()); + frame.setAlwaysOnTop(true); + frame.pack(); + return frame; } - public void start () - { - setSize (200,200); - setVisible(true); - validate(); - - }// start() - + static void log(String msg) { + PassFailJFrame.log(msg); + } + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .instructions(INSTRUCTIONS) + .rows(25) + .columns(50) + .testUI(ManualHTMLDataFlavorTest::createDropWindow) + .logArea() + .build() + .awaitAndCheck(); + } } - - -/* Place other classes related to the test after this line */ - - - - - -/**************************************************** - Standard Test Machinery - DO NOT modify anything below -- it's a standard - chunk of code whose purpose is to make user - interaction uniform, and thereby make it simpler - to read and understand someone else's test. - ****************************************************/ - -/** - This is part of the standard test machinery. - It creates a dialog (with the instructions), and is the interface - for sending text messages to the user. - To print the instructions, send an array of strings to Sysout.createDialog - WithInstructions method. Put one line of instructions per array entry. - To display a message for the tester to see, simply call Sysout.println - with the string to be displayed. - This mimics System.out.println but works within the test harness as well - as standalone. - */ - -class Sysout -{ - private static TestDialog dialog; - - public static void createDialogWithInstructions( String[] instructions ) - { - dialog = new TestDialog( new Frame(), "Instructions" ); - dialog.printInstructions( instructions ); - dialog.setVisible(true); - println( "Any messages for the tester will display here." ); - } - - public static void createDialog( ) - { - dialog = new TestDialog( new Frame(), "Instructions" ); - String[] defInstr = { "Instructions will appear here. ", "" } ; - dialog.printInstructions( defInstr ); - dialog.setVisible(true); - println( "Any messages for the tester will display here." ); - } - - - public static void printInstructions( String[] instructions ) - { - dialog.printInstructions( instructions ); - } - - - public static void println( String messageIn ) - { - dialog.displayMessage( messageIn ); - } - -}// Sysout class - -/** - This is part of the standard test machinery. It provides a place for the - test instructions to be displayed, and a place for interactive messages - to the user to be displayed. - To have the test instructions displayed, see Sysout. - To have a message to the user be displayed, see Sysout. - Do not call anything in this dialog directly. - */ -class TestDialog extends Dialog -{ - - TextArea instructionsText; - TextArea messageText; - int maxStringLength = 80; - - //DO NOT call this directly, go through Sysout - public TestDialog( Frame frame, String name ) - { - super( frame, name ); - int scrollBoth = TextArea.SCROLLBARS_BOTH; - instructionsText = new TextArea( "", 15, maxStringLength, scrollBoth ); - add( "North", instructionsText ); - - messageText = new TextArea( "", 5, maxStringLength, scrollBoth ); - add("Center", messageText); - - pack(); - - setVisible(true); - }// TestDialog() - - //DO NOT call this directly, go through Sysout - public void printInstructions( String[] instructions ) - { - //Clear out any current instructions - instructionsText.setText( "" ); - - //Go down array of instruction strings - - String printStr, remainingStr; - for( int i=0; i < instructions.length; i++ ) - { - //chop up each into pieces maxSringLength long - remainingStr = instructions[ i ]; - while( remainingStr.length() > 0 ) - { - //if longer than max then chop off first max chars to print - if( remainingStr.length() >= maxStringLength ) - { - //Try to chop on a word boundary - int posOfSpace = remainingStr. - lastIndexOf( ' ', maxStringLength - 1 ); - - if( posOfSpace <= 0 ) posOfSpace = maxStringLength - 1; - - printStr = remainingStr.substring( 0, posOfSpace + 1 ); - remainingStr = remainingStr.substring( posOfSpace + 1 ); - } - //else just print - else - { - printStr = remainingStr; - remainingStr = ""; - } - - instructionsText.append( printStr + "\n" ); - - }// while - - }// for - - }//printInstructions() - - //DO NOT call this directly, go through Sysout - public void displayMessage( String messageIn ) - { - messageText.append( messageIn + "\n" ); - System.out.println(messageIn); - } - -}// TestDialog class diff --git a/test/jdk/java/awt/dnd/CustomDragCursorTest.java b/test/jdk/java/awt/dnd/CustomDragCursorTest.java new file mode 100644 index 000000000000..9e5e006b31c8 --- /dev/null +++ b/test/jdk/java/awt/dnd/CustomDragCursorTest.java @@ -0,0 +1,289 @@ +/* + * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Button; +import java.awt.Component; +import java.awt.Cursor; +import java.awt.Dimension; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.GridLayout; +import java.awt.Panel; +import java.awt.Point; +import java.awt.Robot; +import java.awt.datatransfer.DataFlavor; +import java.awt.datatransfer.Transferable; +import java.awt.datatransfer.UnsupportedFlavorException; +import java.awt.dnd.DnDConstants; +import java.awt.dnd.DragGestureEvent; +import java.awt.dnd.DragGestureListener; +import java.awt.dnd.DragSource; +import java.awt.dnd.DragSourceDragEvent; +import java.awt.dnd.DragSourceDropEvent; +import java.awt.dnd.DragSourceEvent; +import java.awt.dnd.DragSourceListener; +import java.awt.dnd.DropTarget; +import java.awt.dnd.DropTargetContext; +import java.awt.dnd.DropTargetDragEvent; +import java.awt.dnd.DropTargetDropEvent; +import java.awt.dnd.DropTargetEvent; +import java.awt.dnd.DropTargetListener; +import java.awt.event.InputEvent; +import java.awt.event.KeyEvent; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.io.Serializable; + +/* + * @test + * @bug 4451328 + * @summary tests that a custom drag cursor is not changed + to the default drag cursor + * @key headful + * @run main CustomDragCursorTest + */ + +public class CustomDragCursorTest { + private static Frame frame; + private static final DragSourcePanel dragSourcePanel = new DragSourcePanel(); + private static final DropTargetPanel dropTargetPanel = new DropTargetPanel(); + + private static volatile Point srcPoint; + private static volatile Point dstPoint; + private static volatile boolean passed = true; + + public static void main(String[] args) throws Exception { + try { + Robot robot = new Robot(); + EventQueue.invokeAndWait(CustomDragCursorTest::createAndShowUI); + robot.waitForIdle(); + robot.delay(1000); + + EventQueue.invokeAndWait(() -> { + Point p = dragSourcePanel.getLocationOnScreen(); + Dimension d = dragSourcePanel.getSize(); + p.translate(d.width / 2, d.height / 2); + srcPoint = p; + + p = dropTargetPanel.getLocationOnScreen(); + d = dropTargetPanel.getSize(); + p.translate(d.width / 2, d.height / 2); + dstPoint = p; + }); + + robot.mouseMove(srcPoint.x, srcPoint.y); + robot.keyPress(KeyEvent.VK_CONTROL); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + for (; !srcPoint.equals(dstPoint); + srcPoint.translate(sign(dstPoint.x - srcPoint.x), + sign(dstPoint.y - srcPoint.y))) { + robot.mouseMove(srcPoint.x, srcPoint.y); + robot.delay(10); + } + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + robot.keyRelease(KeyEvent.VK_CONTROL); + robot.waitForIdle(); + robot.delay(1000); + + if (!passed) { + throw new RuntimeException("Custom drag cursor changed to default."); + } + } finally { + EventQueue.invokeAndWait(() -> { + if (frame != null) { + frame.dispose(); + } + }); + } + } + + private static void createAndShowUI() { + frame = new Frame("CustomDragCursorTest"); + frame.setLayout(new GridLayout(2, 1)); + frame.add(dragSourcePanel); + frame.add(dropTargetPanel); + frame.setLocationRelativeTo(null); + frame.setSize(300, 400); + frame.setVisible(true); + } + + public static void failed() { + passed = false; + } + + private static int sign(int n) { + return Integer.compare(n, 0); + } + + private static class DragSourceButton extends Button implements Serializable, + Transferable, + DragGestureListener, + DragSourceListener { + private final DataFlavor dataflavor = + new DataFlavor(Button.class, "DragSourceButton"); + private final Cursor dragCursor = new Cursor(Cursor.HAND_CURSOR); + + public DragSourceButton() { + this("DragSourceButton"); + } + + public DragSourceButton(String str) { + super(str); + + DragSource ds = DragSource.getDefaultDragSource(); + ds.createDefaultDragGestureRecognizer(this, DnDConstants.ACTION_COPY, + this); + } + + public void dragGestureRecognized(DragGestureEvent dge) { + dge.startDrag(dragCursor, this, this); + } + + public void dragEnter(DragSourceDragEvent dsde) { + if (!dragCursor.equals(dsde.getDragSourceContext().getCursor())) { + CustomDragCursorTest.failed(); + } + } + + public void dragExit(DragSourceEvent dse) { + if (!dragCursor.equals(dse.getDragSourceContext().getCursor())) { + CustomDragCursorTest.failed(); + } + } + + public void dragOver(DragSourceDragEvent dsde) { + if (!dragCursor.equals(dsde.getDragSourceContext().getCursor())) { + CustomDragCursorTest.failed(); + } + } + + public void dragDropEnd(DragSourceDropEvent dsde) { + if (!dragCursor.equals(dsde.getDragSourceContext().getCursor())) { + CustomDragCursorTest.failed(); + } + } + + public void dropActionChanged(DragSourceDragEvent dsde) { + if (!dragCursor.equals(dsde.getDragSourceContext().getCursor())) { + CustomDragCursorTest.failed(); + } + } + + public Object getTransferData(DataFlavor flavor) + throws UnsupportedFlavorException, IOException { + + if (!isDataFlavorSupported(flavor)) { + throw new UnsupportedFlavorException(flavor); + } + + Object retObj; + + ByteArrayOutputStream baoStream = new ByteArrayOutputStream(); + ObjectOutputStream ooStream = new ObjectOutputStream(baoStream); + ooStream.writeObject(this); + + ByteArrayInputStream baiStream = new ByteArrayInputStream(baoStream.toByteArray()); + ObjectInputStream ois = new ObjectInputStream(baiStream); + try { + retObj = ois.readObject(); + } catch (ClassNotFoundException e) { + e.printStackTrace(); + throw new RuntimeException(e.toString()); + } + + return retObj; + } + + public DataFlavor[] getTransferDataFlavors() { + return new DataFlavor[] { dataflavor }; + } + + public boolean isDataFlavorSupported(DataFlavor dflavor) { + return dataflavor.equals(dflavor); + } + } + + private static class DragSourcePanel extends Panel { + + final Dimension preferredDimension = new Dimension(200, 100); + + public DragSourcePanel() { + setLayout(new GridLayout(1, 1)); + add(new DragSourceButton()); + } + + public Dimension getPreferredSize() { + return preferredDimension; + } + } + + private static class DropTargetPanel extends Panel implements DropTargetListener { + + final Dimension preferredDimension = new Dimension(200, 100); + + public DropTargetPanel() { + setDropTarget(new DropTarget(this, this)); + } + + public Dimension getPreferredSize() { + return preferredDimension; + } + + public void dragEnter(DropTargetDragEvent dtde) {} + + public void dragExit(DropTargetEvent dte) {} + + public void dragOver(DropTargetDragEvent dtde) {} + + public void dropActionChanged(DropTargetDragEvent dtde) {} + + public void drop(DropTargetDropEvent dtde) { + DropTargetContext dtc = dtde.getDropTargetContext(); + + if ((dtde.getSourceActions() & DnDConstants.ACTION_COPY) != 0) { + dtde.acceptDrop(DnDConstants.ACTION_COPY); + } else { + dtde.rejectDrop(); + } + + DataFlavor[] dfs = dtde.getCurrentDataFlavors(); + Component comp = null; + + if(dfs != null && dfs.length >= 1) { + Transferable transfer = dtde.getTransferable(); + + try { + comp = (Component)transfer.getTransferData(dfs[0]); + } catch (Throwable e) { + e.printStackTrace(); + dtc.dropComplete(false); + } + } + dtc.dropComplete(true); + add(comp); + } + } +} diff --git a/test/jdk/java/awt/dnd/DnDAcceptanceTest/DnDAcceptanceTest.java b/test/jdk/java/awt/dnd/DnDAcceptanceTest/DnDAcceptanceTest.java new file mode 100644 index 000000000000..700187f9dce4 --- /dev/null +++ b/test/jdk/java/awt/dnd/DnDAcceptanceTest/DnDAcceptanceTest.java @@ -0,0 +1,87 @@ +/* + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Frame; +import java.awt.Panel; + +/* + * @test + * @bug 4166541 4225247 4297663 + * @summary Tests Basic DnD functionality + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual DnDAcceptanceTest + */ + +public class DnDAcceptanceTest { + private static final String INSTRUCTIONS = """ + When test runs a Frame which contains a yellow button labeled + "Drag ME!" and a RED Panel will appear. + + Click on the button and drag to the red panel. + When the mouse enters the red panel + during the drag the panel should turn yellow. + + Release the mouse button, panel should turn red again and + a yellow button labeled Drag ME! should appear inside the panel. + You should be able to repeat this operation multiple times. + + If above is true press PASS, else press FAIL. + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .columns(38) + .testUI(DnDAcceptanceTest::createUI) + .build() + .awaitAndCheck(); + } + + private static Frame createUI() { + Frame frame = new Frame("DnDAcceptanceTest"); + Panel mainPanel; + Component dragSource, dropTarget; + + frame.setSize(400, 400); + frame.setLayout(new BorderLayout()); + + mainPanel = new Panel(); + mainPanel.setLayout(new BorderLayout()); + + mainPanel.setBackground(Color.BLACK); + + dropTarget = new DnDTarget(Color.RED, Color.YELLOW); + dragSource = new DnDSource("Drag ME!"); + + mainPanel.add(dragSource, "North"); + mainPanel.add(dropTarget, "Center"); + frame.add(mainPanel, BorderLayout.CENTER); + frame.setAlwaysOnTop(true); + return frame; + } +} diff --git a/test/jdk/java/awt/dnd/DnDAcceptanceTest/DnDSource.java b/test/jdk/java/awt/dnd/DnDAcceptanceTest/DnDSource.java new file mode 100644 index 000000000000..a35ccd9ee12c --- /dev/null +++ b/test/jdk/java/awt/dnd/DnDAcceptanceTest/DnDSource.java @@ -0,0 +1,155 @@ +/* + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Button; +import java.awt.Color; +import java.awt.Container; +import java.awt.Toolkit; +import java.awt.datatransfer.DataFlavor; +import java.awt.datatransfer.Transferable; +import java.awt.datatransfer.UnsupportedFlavorException; +import java.awt.dnd.DnDConstants; +import java.awt.dnd.MouseDragGestureRecognizer; +import java.awt.dnd.DragGestureEvent; +import java.awt.dnd.DragGestureListener; +import java.awt.dnd.DragSource; +import java.awt.dnd.DragSourceDragEvent; +import java.awt.dnd.DragSourceDropEvent; +import java.awt.dnd.DragSourceEvent; +import java.awt.dnd.DragSourceListener; +import java.awt.dnd.InvalidDnDOperationException; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; + +class DnDSource extends Button implements Transferable, + DragGestureListener, + DragSourceListener { + private DataFlavor df; + private transient int dropAction; + + DnDSource(String label) { + super(label); + Toolkit.getDefaultToolkit().createDragGestureRecognizer(MouseDragGestureRecognizer.class, + DragSource.getDefaultDragSource(), + this, DnDConstants.ACTION_COPY, this); + setBackground(Color.yellow); + setForeground(Color.blue); + df = new DataFlavor(DnDSource.class, "DnDSource"); + } + + public void dragGestureRecognized(DragGestureEvent dge) { + System.err.println("starting Drag"); + try { + dge.startDrag(null, this, this); + } catch (InvalidDnDOperationException e) { + e.printStackTrace(); + } + } + + public void dragEnter(DragSourceDragEvent dsde) { + System.err.println("[Source] dragEnter"); + dsde.getDragSourceContext().setCursor(DragSource.DefaultCopyDrop); + } + + public void dragOver(DragSourceDragEvent dsde) { + System.err.println("[Source] dragOver"); + dropAction = dsde.getDropAction(); + System.out.println("dropAction = " + dropAction); + } + + public void dragGestureChanged(DragSourceDragEvent dsde) { + System.err.println("[Source] dragGestureChanged"); + dropAction = dsde.getDropAction(); + System.out.println("dropAction = " + dropAction); + } + + public void dragExit(DragSourceEvent dsde) { + System.err.println("[Source] dragExit"); + dsde.getDragSourceContext().setCursor(null); + } + + public void dragDropEnd(DragSourceDropEvent dsde) { + System.err.println("[Source] dragDropEnd"); + } + + public void dropActionChanged(DragSourceDragEvent dsde) { + System.err.println("[Source] dropActionChanged"); + dropAction = dsde.getDropAction(); + System.out.println("dropAction = " + dropAction); + } + + public DataFlavor[] getTransferDataFlavors() { + return new DataFlavor[] {df}; + } + + public boolean isDataFlavorSupported(DataFlavor sdf) { + return df.equals(sdf); + } + + public Object getTransferData(DataFlavor tdf) throws UnsupportedFlavorException, IOException { + + Object copy = null; + + if (!df.equals(tdf)) { + throw new UnsupportedFlavorException(tdf); + } + Container parent = getParent(); + switch (dropAction) { + case DnDConstants.ACTION_COPY: + try { + copy = this.clone(); + } catch (CloneNotSupportedException e) { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + ObjectOutputStream oos = new ObjectOutputStream(baos); + + oos.writeObject(this); + ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); + ObjectInputStream ois = new ObjectInputStream(bais); + try { + copy = ois.readObject(); + } catch (ClassNotFoundException cnfe) { + // do nothing + } + } + + parent.add(this); + return copy; + + case DnDConstants.ACTION_MOVE: + synchronized(this) { + if (parent != null) parent.remove(this); + } + return this; + + case DnDConstants.ACTION_LINK: + return this; + + default: + //throw new IOException("bad operation"); + return this; // workaround for: 4135456 getDropAction() always return 0 + } + } +} diff --git a/test/jdk/java/awt/dnd/DnDAcceptanceTest/DnDTarget.java b/test/jdk/java/awt/dnd/DnDAcceptanceTest/DnDTarget.java new file mode 100644 index 000000000000..d147741f0d22 --- /dev/null +++ b/test/jdk/java/awt/dnd/DnDAcceptanceTest/DnDTarget.java @@ -0,0 +1,115 @@ +/* + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Button; +import java.awt.Color; +import java.awt.Panel; +import java.awt.datatransfer.DataFlavor; +import java.awt.datatransfer.Transferable; +import java.awt.datatransfer.UnsupportedFlavorException; +import java.awt.dnd.DnDConstants; +import java.awt.dnd.DropTarget; +import java.awt.dnd.DropTargetContext; +import java.awt.dnd.DropTargetDragEvent; +import java.awt.dnd.DropTargetDropEvent; +import java.awt.dnd.DropTargetEvent; +import java.awt.dnd.DropTargetListener; +import java.io.IOException; + +class DnDTarget extends Panel implements DropTargetListener { + Color bgColor; + Color htColor; + + DnDTarget(Color bgColor, Color htColor) { + super(); + this.bgColor = bgColor; + this.htColor = htColor; + setBackground(bgColor); + setDropTarget(new DropTarget(this, this)); + } + + public void dragEnter(DropTargetDragEvent e) { + System.err.println("[Target] dragEnter"); + e.acceptDrag(DnDConstants.ACTION_COPY); + setBackground(htColor); + repaint(); + } + + public void dragOver(DropTargetDragEvent e) { + System.err.println("[Target] dragOver"); + e.acceptDrag(DnDConstants.ACTION_COPY); + } + + public void dragExit(DropTargetEvent e) { + System.err.println("[Target] dragExit"); + setBackground(bgColor); + repaint(); + } + + public void drop(DropTargetDropEvent dtde) { + System.err.println("[Target] drop"); + DropTargetContext dtc = dtde.getDropTargetContext(); + + if ((dtde.getSourceActions() & DnDConstants.ACTION_COPY) != 0) { + dtde.acceptDrop(DnDConstants.ACTION_COPY); + } else { + dtde.rejectDrop(); + return; + } + + DataFlavor[] dfs = dtde.getCurrentDataFlavors(); + if (dfs != null && dfs.length >= 1) { + Transferable transfer = dtde.getTransferable(); + Object obj; + try { + obj = transfer.getTransferData(dfs[0]); + } catch (IOException | UnsupportedFlavorException ex) { + System.err.println(ex.getMessage()); + dtc.dropComplete(false); + return; + } + + if (obj != null) { + Button button; + try { + button = (Button) obj; + } catch (Exception e) { + System.err.println(e.getMessage()); + dtc.dropComplete(false); + return; + } + add(button); + repaint(); + } + } + setBackground(bgColor); + invalidate(); + validate(); + repaint(); + dtc.dropComplete(true); + } + + public void dropActionChanged(DropTargetDragEvent e) { + System.err.println("[Target] dropActionChanged"); + } +} diff --git a/test/jdk/java/awt/dnd/DnDClipboardDeadlockTest.java b/test/jdk/java/awt/dnd/DnDClipboardDeadlockTest.java new file mode 100644 index 000000000000..ab2bff8ecc5a --- /dev/null +++ b/test/jdk/java/awt/dnd/DnDClipboardDeadlockTest.java @@ -0,0 +1,441 @@ +/* + * Copyright (c) 2001, 2024, 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 4388802 + * @summary tests that clipboard operations during drag-and-drop don't deadlock + * @key headful + * @run main DnDClipboardDeadlockTest + */ + +import java.awt.AWTEvent; +import java.awt.AWTException; +import java.awt.Button; +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.GridLayout; +import java.awt.List; +import java.awt.Panel; +import java.awt.Point; +import java.awt.Robot; +import java.awt.Toolkit; +import java.awt.datatransfer.Clipboard; +import java.awt.datatransfer.DataFlavor; +import java.awt.datatransfer.StringSelection; +import java.awt.datatransfer.Transferable; +import java.awt.dnd.DnDConstants; +import java.awt.dnd.DragGestureEvent; +import java.awt.dnd.DragGestureListener; +import java.awt.dnd.DragSource; +import java.awt.dnd.DragSourceDragEvent; +import java.awt.dnd.DragSourceDropEvent; +import java.awt.dnd.DragSourceEvent; +import java.awt.dnd.DragSourceListener; +import java.awt.dnd.DropTarget; +import java.awt.dnd.DropTargetContext; +import java.awt.dnd.DropTargetDragEvent; +import java.awt.dnd.DropTargetDropEvent; +import java.awt.dnd.DropTargetEvent; +import java.awt.dnd.DropTargetListener; +import java.awt.event.AWTEventListener; +import java.awt.event.InputEvent; +import java.awt.event.KeyEvent; +import java.awt.event.MouseEvent; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.Serializable; + +public class DnDClipboardDeadlockTest { + + public static final int CODE_NOT_RETURNED = -1; + public static final int CODE_OK = 0; + public static final int CODE_FAILURE = 1; + + private int returnCode = CODE_NOT_RETURNED; + + final Frame frame = new Frame(); + Robot robot = null; + Panel panel = null; + + public static void main(String[] args) throws Exception { + DnDClipboardDeadlockTest test = new DnDClipboardDeadlockTest(); + if (args.length == 4) { + test.run(args); + } else { + test.start(); + } + } + + public void run(String[] args) throws InterruptedException, AWTException { + try { + if (args.length != 4) { + throw new RuntimeException("Incorrect command line arguments."); + } + + int x = Integer.parseInt(args[0]); + int y = Integer.parseInt(args[1]); + int w = Integer.parseInt(args[2]); + int h = Integer.parseInt(args[3]); + + Transferable t = new StringSelection("TEXT"); + panel = new DragSourcePanel(t); + + frame.setTitle("DragSource frame"); + frame.setLocation(300, 200); + frame.add(panel); + frame.pack(); + frame.setVisible(true); + + Util.waitForInit(); + + Point sourcePoint = panel.getLocationOnScreen(); + Dimension d = panel.getSize(); + sourcePoint.translate(d.width / 2, d.height / 2); + + Point targetPoint = new Point(x + w / 2, y + h / 2); + + robot = new Robot(); + + if (!Util.pointInComponent(robot, sourcePoint, panel)) { + throw new RuntimeException("WARNING: Cannot locate source panel"); + } + + robot.mouseMove(sourcePoint.x, sourcePoint.y); + robot.keyPress(KeyEvent.VK_CONTROL); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + for (; !sourcePoint.equals(targetPoint); + sourcePoint.translate(sign(targetPoint.x - sourcePoint.x), + sign(targetPoint.y - sourcePoint.y))) { + robot.mouseMove(sourcePoint.x, sourcePoint.y); + Thread.sleep(10); + } + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + robot.keyRelease(KeyEvent.VK_CONTROL); + if (frame != null) { + frame.dispose(); + } + + } catch (Throwable e) { + e.printStackTrace(); + throw new RuntimeException(e); + } + } // run() + + public static int sign(int n) { + return n < 0 ? -1 : n == 0 ? 0 : 1; + } + + public void start() { + panel = new DropTargetPanel(); + + frame.setTitle("DropTarget frame"); + frame.setLocation(10, 200); + frame.add(panel); + + frame.pack(); + frame.setVisible(true); + + try { + Util.waitForInit(); + + Point p = panel.getLocationOnScreen(); + Dimension d = panel.getSize(); + + try { + Robot robot = new Robot(); + Point center = new Point(p); + center.translate(d.width / 2, d.height / 2); + if (!Util.pointInComponent(robot, center, panel)) { + System.err.println("WARNING: Cannot locate target panel"); + return; + } + } catch (AWTException awte) { + awte.printStackTrace(); + return; + } + + String javaPath = System.getProperty("java.home", ""); + String command = javaPath + File.separator + "bin" + + File.separator + "java -cp " + + System.getProperty("java.class.path", ".") + + " DnDClipboardDeadlockTest " + + p.x + " " + p.y + " " + d.width + " " + d.height; + + Process process = Runtime.getRuntime().exec(command); + returnCode = process.waitFor(); + + InputStream errorStream = process.getErrorStream(); + int count = errorStream.available(); + if (count > 0) { + byte[] b = new byte[count]; + errorStream.read(b); + System.err.println("========= Child VM System.err ========"); + System.err.print(new String(b)); + System.err.println("======================================"); + } + + } catch (Throwable e) { + e.printStackTrace(); + } + switch (returnCode) { + case CODE_NOT_RETURNED: + System.err.println("Child VM: failed to start"); + break; + case CODE_OK: + System.err.println("Child VM: normal termination"); + break; + case CODE_FAILURE: + System.err.println("Child VM: abnormal termination"); + break; + } + if (returnCode != CODE_OK) { + throw new RuntimeException("The test failed."); + } + if (frame != null) { + frame.dispose(); + } + } // start() +} // class DnDClipboardDeadlockTest + +class Util implements AWTEventListener { + private static final Toolkit tk = Toolkit.getDefaultToolkit(); + private static final Object SYNC_LOCK = new Object(); + private Component clickedComponent = null; + private static final int PAINT_TIMEOUT = 10000; + private static final int MOUSE_RELEASE_TIMEOUT = 10000; + private static final Util util = new Util(); + + static { + tk.addAWTEventListener(util, 0xFFFFFFFF); + } + + private void reset() { + clickedComponent = null; + } + + public void eventDispatched(AWTEvent e) { + if (e.getID() == MouseEvent.MOUSE_RELEASED) { + clickedComponent = (Component) e.getSource(); + synchronized (SYNC_LOCK) { + SYNC_LOCK.notifyAll(); + } + } + } + + public static boolean pointInComponent(Robot robot, Point p, Component comp) + throws InterruptedException { + return util.isPointInComponent(robot, p, comp); + } + + private boolean isPointInComponent(Robot robot, Point p, Component comp) + throws InterruptedException { + tk.sync(); + robot.waitForIdle(); + reset(); + robot.mouseMove(p.x, p.y); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + synchronized (SYNC_LOCK) { + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + SYNC_LOCK.wait(MOUSE_RELEASE_TIMEOUT); + } + + Component c = clickedComponent; + + while (c != null && c != comp) { + c = c.getParent(); + } + + return c == comp; + } + + public static void waitForInit() throws InterruptedException { + final Frame f = new Frame() { + public void paint(Graphics g) { + dispose(); + synchronized (SYNC_LOCK) { + SYNC_LOCK.notifyAll(); + } + } + }; + f.setBounds(600, 400, 200, 200); + synchronized (SYNC_LOCK) { + f.setVisible(true); + SYNC_LOCK.wait(PAINT_TIMEOUT); + } + tk.sync(); + } +} + +class DragSourceButton extends Button implements Serializable, + DragGestureListener, + DragSourceListener { + static final Clipboard systemClipboard = + Toolkit.getDefaultToolkit().getSystemClipboard(); + final Transferable transferable; + + public DragSourceButton(Transferable t) { + super("DragSourceButton"); + + this.transferable = t; + DragSource ds = DragSource.getDefaultDragSource(); + ds.createDefaultDragGestureRecognizer(this, DnDConstants.ACTION_COPY, + this); + } + + public void dragGestureRecognized(DragGestureEvent dge) { + dge.startDrag(null, transferable, this); + } + + public void dragEnter(DragSourceDragEvent dsde) { + } + + public void dragExit(DragSourceEvent dse) { + } + + public void dragOver(DragSourceDragEvent dsde) { + try { + Transferable t = systemClipboard.getContents(null); + if (t.isDataFlavorSupported(DataFlavor.stringFlavor)) { + String str = (String) t.getTransferData(DataFlavor.stringFlavor); + } + systemClipboard.setContents(new StringSelection("SOURCE"), null); + } catch (IOException ioe) { + ioe.printStackTrace(); + if (!ioe.getMessage().equals("Owner failed to convert data")) { + throw new RuntimeException("Owner failed to convert data"); + } + } catch (IllegalStateException e) { + // IllegalStateExceptions do not indicate a bug in this case. + // They result from concurrent modification of system clipboard + // contents by the parent and child processes. + // These exceptions are numerous, so we avoid dumping their + // backtraces to prevent blocking child process io, which + // causes test failure on timeout. + } catch (Exception e) { + e.printStackTrace(); + } + } + + public void dragDropEnd(DragSourceDropEvent dsde) { + System.exit(DnDClipboardDeadlockTest.CODE_OK); + } + + public void dropActionChanged(DragSourceDragEvent dsde) { + } +} + +class DragSourcePanel extends Panel { + + final Dimension preferredDimension = new Dimension(200, 200); + + public DragSourcePanel(Transferable t) { + setLayout(new GridLayout(1, 1)); + add(new DragSourceButton(t)); + } + + public Dimension getPreferredSize() { + return preferredDimension; + } +} + +class DropTargetPanel extends Panel implements DropTargetListener { + + static final Clipboard systemClipboard = + Toolkit.getDefaultToolkit().getSystemClipboard(); + final Dimension preferredDimension = new Dimension(200, 200); + + public DropTargetPanel() { + setBackground(Color.green); + setDropTarget(new DropTarget(this, this)); + setLayout(new GridLayout(1, 1)); + } + + public Dimension getPreferredSize() { + return preferredDimension; + } + + public void dragEnter(DropTargetDragEvent dtde) { + dtde.acceptDrag(DnDConstants.ACTION_COPY); + } + + public void dragExit(DropTargetEvent dte) { + } + + public void dragOver(DropTargetDragEvent dtde) { + dtde.acceptDrag(DnDConstants.ACTION_COPY); + try { + Transferable t = systemClipboard.getContents(null); + if (t.isDataFlavorSupported(DataFlavor.stringFlavor)) { + String str = (String) t.getTransferData(DataFlavor.stringFlavor); + } + systemClipboard.setContents(new StringSelection("TARGET"), null); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public void drop(DropTargetDropEvent dtde) { + DropTargetContext dtc = dtde.getDropTargetContext(); + + if ((dtde.getSourceActions() & DnDConstants.ACTION_COPY) != 0) { + dtde.acceptDrop(DnDConstants.ACTION_COPY); + } else { + dtde.rejectDrop(); + return; + } + + removeAll(); + final List list = new List(); + add(list); + + Transferable t = dtde.getTransferable(); + DataFlavor[] dfs = t.getTransferDataFlavors(); + + for (int i = 0; i < dfs.length; i++) { + + DataFlavor flavor = dfs[i]; + String str = null; + + if (DataFlavor.stringFlavor.equals(flavor)) { + try { + str = (String) t.getTransferData(flavor); + } catch (Exception e) { + e.printStackTrace(); + } + } + + list.add(str + ":" + flavor.getMimeType()); + } + + dtc.dropComplete(true); + validate(); + } + + public void dropActionChanged(DropTargetDragEvent dtde) { + } +} diff --git a/test/jdk/java/awt/dnd/DnDCursorCrashTest.java b/test/jdk/java/awt/dnd/DnDCursorCrashTest.java new file mode 100644 index 000000000000..7b1f4483ef99 --- /dev/null +++ b/test/jdk/java/awt/dnd/DnDCursorCrashTest.java @@ -0,0 +1,231 @@ +/* + * Copyright (c) 2000, 2024, 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 4343300 + * @summary tests that drag attempt doesn't cause crash when + * custom cursor is used + * @key headful + * @run main DnDCursorCrashTest + */ + +import java.awt.Button; +import java.awt.Component; +import java.awt.Cursor; +import java.awt.Dimension; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.GridLayout; +import java.awt.Panel; +import java.awt.Robot; +import java.awt.datatransfer.DataFlavor; +import java.awt.datatransfer.Transferable; +import java.awt.datatransfer.UnsupportedFlavorException; +import java.awt.dnd.DnDConstants; +import java.awt.dnd.DragGestureEvent; +import java.awt.dnd.DragGestureListener; +import java.awt.dnd.DragSource; +import java.awt.dnd.DragSourceDragEvent; +import java.awt.dnd.DragSourceDropEvent; +import java.awt.dnd.DragSourceEvent; +import java.awt.dnd.DragSourceListener; +import java.awt.dnd.DropTarget; +import java.awt.dnd.DropTargetContext; +import java.awt.dnd.DropTargetDragEvent; +import java.awt.dnd.DropTargetDropEvent; +import java.awt.dnd.DropTargetEvent; +import java.awt.dnd.DropTargetListener; +import java.awt.event.InputEvent; +import java.awt.event.KeyEvent; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.io.Serializable; + +public class DnDCursorCrashTest { + static final Frame frame = new Frame(); + static final DragSourcePanel dragSourcePanel = new DragSourcePanel(); + static final DropTargetPanel dropTargetPanel = new DropTargetPanel(); + + public static void main(String[] args) throws Exception { + try { + EventQueue.invokeAndWait(() -> { + frame.setTitle("DnD Cursor Test Frame"); + frame.setLocation(200, 200); + frame.setLayout(new GridLayout(2, 1)); + frame.add(dragSourcePanel); + frame.add(dropTargetPanel); + frame.pack(); + frame.setVisible(true); + }); + + Robot robot = new Robot(); + robot.delay(1000); + robot.mouseMove(250, 250); + robot.keyPress(KeyEvent.VK_CONTROL); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + for (int y = 250; y < 350; y += 5) { + robot.mouseMove(250, y); + robot.delay(100); + } + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + robot.keyRelease(KeyEvent.VK_CONTROL); + } finally { + if (frame != null) { + EventQueue.invokeAndWait(() -> frame.dispose()); + } + } + } +} + +class DragSourceButton extends Button implements Serializable, + Transferable, + DragGestureListener, + DragSourceListener { + private final DataFlavor dataflavor = + new DataFlavor(Button.class, "DragSourceButton"); + + public DragSourceButton() { + this("DragSourceButton"); + } + + public DragSourceButton(String str) { + super(str); + + DragSource ds = DragSource.getDefaultDragSource(); + ds.createDefaultDragGestureRecognizer(this, DnDConstants.ACTION_COPY, + this); + } + + public void dragGestureRecognized(DragGestureEvent dge) { + dge.startDrag(new Cursor(Cursor.HAND_CURSOR), this, this); + } + + public void dragEnter(DragSourceDragEvent dsde) {} + + public void dragExit(DragSourceEvent dse) {} + + public void dragOver(DragSourceDragEvent dsde) {} + + public void dragDropEnd(DragSourceDropEvent dsde) {} + + public void dropActionChanged(DragSourceDragEvent dsde) {} + + public Object getTransferData(DataFlavor flavor) + throws UnsupportedFlavorException, IOException { + + if (!isDataFlavorSupported(flavor)) { + throw new UnsupportedFlavorException(flavor); + } + + Object retObj; + + ByteArrayOutputStream baoStream = new ByteArrayOutputStream(); + ObjectOutputStream ooStream = new ObjectOutputStream(baoStream); + ooStream.writeObject(this); + + ByteArrayInputStream baiStream = new ByteArrayInputStream(baoStream.toByteArray()); + ObjectInputStream ois = new ObjectInputStream(baiStream); + try { + retObj = ois.readObject(); + } catch (ClassNotFoundException e) { + e.printStackTrace(); + throw new RuntimeException(e.toString()); + } + + return retObj; + } + + public DataFlavor[] getTransferDataFlavors() { + return new DataFlavor[] { dataflavor }; + } + + public boolean isDataFlavorSupported(DataFlavor dflavor) { + return dataflavor.equals(dflavor); + } +} + +class DragSourcePanel extends Panel { + + final Dimension preferredDimension = new Dimension(200, 100); + + public DragSourcePanel() { + setLayout(new GridLayout(1, 1)); + add(new DragSourceButton()); + } + + public Dimension getPreferredSize() { + return preferredDimension; + } +} + +class DropTargetPanel extends Panel implements DropTargetListener { + + final Dimension preferredDimension = new Dimension(200, 100); + + public DropTargetPanel() { + setDropTarget(new DropTarget(this, this)); + } + + public Dimension getPreferredSize() { + return preferredDimension; + } + + public void dragEnter(DropTargetDragEvent dtde) {} + + public void dragExit(DropTargetEvent dte) {} + + public void dragOver(DropTargetDragEvent dtde) {} + + public void dropActionChanged(DropTargetDragEvent dtde) {} + + public void drop(DropTargetDropEvent dtde) { + DropTargetContext dtc = dtde.getDropTargetContext(); + + if ((dtde.getSourceActions() & DnDConstants.ACTION_COPY) != 0) { + dtde.acceptDrop(DnDConstants.ACTION_COPY); + } else { + dtde.rejectDrop(); + } + + DataFlavor[] dfs = dtde.getCurrentDataFlavors(); + Component comp = null; + + if (dfs != null && dfs.length >= 1) { + Transferable transfer = dtde.getTransferable(); + + try { + comp = (Component)transfer.getTransferData(dfs[0]); + } catch (Throwable e) { + e.printStackTrace(); + dtc.dropComplete(false); + } + } + dtc.dropComplete(true); + + add(comp); + } +} diff --git a/test/jdk/java/awt/dnd/DnDHTMLToOutlookTest/DnDHTMLToOutlookTest.java b/test/jdk/java/awt/dnd/DnDHTMLToOutlookTest/DnDHTMLToOutlookTest.java new file mode 100644 index 000000000000..8a39ce537056 --- /dev/null +++ b/test/jdk/java/awt/dnd/DnDHTMLToOutlookTest/DnDHTMLToOutlookTest.java @@ -0,0 +1,82 @@ +/* + * Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Component; +import java.awt.Frame; +import java.awt.Panel; + + +/* + * @test + * @bug 6392086 + * @summary Tests dnd to another screen + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual DnDHTMLToOutlookTest + */ + +public class DnDHTMLToOutlookTest { + + private static final String INSTRUCTIONS = """ + The window contains a yellow button. Click on the button + to copy HTML from DnDSource.html file into the clipboard or drag + HTML context. Paste into or drop over the HTML capable editor in + external application such as Outlook, Word. + + When the mouse enters the editor, cursor should change to indicate + that copy operation is about to happen and then release the mouse + button. HTML text without tags should appear inside the document. + + You should be able to repeat this operation multiple times. + If the above is true Press PASS else FAIL. + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .columns(40) + .testUI(DnDHTMLToOutlookTest::createAndShowUI) + .build() + .awaitAndCheck(); + } + + private static Frame createAndShowUI() { + Frame frame = new Frame("DnDHTMLToOutlookTest"); + Panel mainPanel; + Component dragSource; + + mainPanel = new Panel(); + mainPanel.setLayout(new BorderLayout()); + + mainPanel.setBackground(Color.YELLOW); + dragSource = new DnDSource("Drag ME (HTML)!"); + + mainPanel.add(dragSource, BorderLayout.CENTER); + frame.add(mainPanel); + frame.setSize(200, 200); + return frame; + } +} diff --git a/test/jdk/javax/swing/JFileChooser/4150029/bug4150029.html b/test/jdk/java/awt/dnd/DnDHTMLToOutlookTest/DnDSource.html similarity index 65% rename from test/jdk/javax/swing/JFileChooser/4150029/bug4150029.html rename to test/jdk/java/awt/dnd/DnDHTMLToOutlookTest/DnDSource.html index 9677de3fc54a..0f1b9751decd 100644 --- a/test/jdk/javax/swing/JFileChooser/4150029/bug4150029.html +++ b/test/jdk/java/awt/dnd/DnDHTMLToOutlookTest/DnDSource.html @@ -1,6 +1,5 @@ - - - - - -Follow the instructions below. -1.Go into 'subDir' folder. -2.Press BACKSPACE key. -3.Push OPEN button. -4.Push DONE button. - - +

    DnDHTMLToOutlookTest
    HTML Drag & Paste problem

    +

    if you see the bold header above without HTML tags and without StartHTML as the first word, press PASS

    diff --git a/test/jdk/java/awt/dnd/DnDHTMLToOutlookTest/DnDSource.java b/test/jdk/java/awt/dnd/DnDHTMLToOutlookTest/DnDSource.java new file mode 100644 index 000000000000..58f17e9415c5 --- /dev/null +++ b/test/jdk/java/awt/dnd/DnDHTMLToOutlookTest/DnDSource.java @@ -0,0 +1,142 @@ +/* + * Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Button; +import java.awt.Color; +import java.awt.Toolkit; +import java.awt.datatransfer.DataFlavor; +import java.awt.datatransfer.Transferable; +import java.awt.datatransfer.UnsupportedFlavorException; +import java.awt.dnd.DnDConstants; +import java.awt.dnd.DragGestureEvent; +import java.awt.dnd.DragGestureListener; +import java.awt.dnd.DragSource; +import java.awt.dnd.DragSourceDragEvent; +import java.awt.dnd.DragSourceDropEvent; +import java.awt.dnd.DragSourceEvent; +import java.awt.dnd.DragSourceListener; +import java.awt.dnd.InvalidDnDOperationException; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.io.ByteArrayInputStream; +import java.io.InputStream; +import java.nio.file.Files; +import java.nio.file.Paths; + +class DnDSource extends Button implements Transferable, + DragGestureListener, + DragSourceListener { + private DataFlavor m_df; + private transient int m_dropAction; + private ByteArrayInputStream m_data = null; + + DnDSource(String label) { + super(label); + setBackground(Color.yellow); + setForeground(Color.blue); + setSize(200, 120); + + try { + m_df = new DataFlavor("text/html; Class=" + InputStream.class.getName() + "; charset=UTF-8"); + } catch (Exception e) { + e.printStackTrace(); + } + + DragSource dragSource = new DragSource(); + dragSource.createDefaultDragGestureRecognizer( + this, + DnDConstants.ACTION_COPY_OR_MOVE, + this + ); + dragSource.addDragSourceListener(this); + + String dir = System.getProperty("test.src", "."); + + try { + m_data = new ByteArrayInputStream(Files.readAllBytes( + Paths.get(dir, "DnDSource.html"))); + m_data.mark(m_data.available()); + addActionListener( + new ActionListener(){ + public void actionPerformed(ActionEvent ae){ + Toolkit.getDefaultToolkit().getSystemClipboard() + .setContents( DnDSource.this, null); + } + } + ); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public void dragGestureRecognized(DragGestureEvent dge) { + System.err.println("starting Drag"); + try { + dge.startDrag(null, this, this); + } catch (InvalidDnDOperationException e) { + e.printStackTrace(); + } + } + + public void dragEnter(DragSourceDragEvent dsde) { + System.err.println("[Source] dragEnter"); + } + + public void dragOver(DragSourceDragEvent dsde) { + System.err.println("[Source] dragOver"); + m_dropAction = dsde.getDropAction(); + System.out.println("m_dropAction = " + m_dropAction); + } + + public void dragExit(DragSourceEvent dsde) { + System.err.println("[Source] dragExit"); + } + + public void dragDropEnd(DragSourceDropEvent dsde) { + System.err.println("[Source] dragDropEnd"); + } + + public void dropActionChanged(DragSourceDragEvent dsde) { + System.err.println("[Source] dropActionChanged"); + m_dropAction = dsde.getDropAction(); + System.out.println("m_dropAction = " + m_dropAction); + } + + public DataFlavor[] getTransferDataFlavors() { + return new DataFlavor[] {m_df}; + } + + public boolean isDataFlavorSupported(DataFlavor sdf) { + System.err.println("[Source] isDataFlavorSupported" + m_df.equals(sdf)); + return m_df.equals(sdf); + } + + public Object getTransferData(DataFlavor tdf) throws UnsupportedFlavorException { + if (!m_df.equals(tdf)) { + throw new UnsupportedFlavorException(tdf); + } + System.err.println("[Source] Ok"); + m_data.reset(); + return m_data; + } +} diff --git a/test/jdk/java/awt/dnd/DnDRemoveFocusOwnerCrashTest.java b/test/jdk/java/awt/dnd/DnDRemoveFocusOwnerCrashTest.java new file mode 100644 index 000000000000..1fc7c2e82b89 --- /dev/null +++ b/test/jdk/java/awt/dnd/DnDRemoveFocusOwnerCrashTest.java @@ -0,0 +1,233 @@ +/* + * Copyright (c) 2000, 2024, 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 4357905 + * @summary Tests that removal of the focus owner component during + * drop processing doesn't cause crash + * @key headful + * @run main DnDRemoveFocusOwnerCrashTest + */ + +import java.awt.Button; +import java.awt.Component; +import java.awt.EventQueue; +import java.awt.FlowLayout; +import java.awt.Frame; +import java.awt.Panel; +import java.awt.Point; +import java.awt.Robot; +import java.awt.datatransfer.DataFlavor; +import java.awt.datatransfer.Transferable; +import java.awt.datatransfer.UnsupportedFlavorException; +import java.awt.dnd.DnDConstants; +import java.awt.dnd.DragGestureEvent; +import java.awt.dnd.DragGestureListener; +import java.awt.dnd.DragSource; +import java.awt.dnd.DragSourceDragEvent; +import java.awt.dnd.DragSourceDropEvent; +import java.awt.dnd.DragSourceEvent; +import java.awt.dnd.DragSourceListener; +import java.awt.dnd.DropTarget; +import java.awt.dnd.DropTargetContext; +import java.awt.dnd.DropTargetDragEvent; +import java.awt.dnd.DropTargetDropEvent; +import java.awt.dnd.DropTargetEvent; +import java.awt.dnd.DropTargetListener; +import java.awt.event.InputEvent; +import java.awt.event.KeyEvent; +import java.io.Serializable; + +public class DnDRemoveFocusOwnerCrashTest { + public static final int FRAME_ACTIVATION_TIMEOUT = 1000; + public static Frame frame; + public static Robot robot; + public static DragSourceButton dragSourceButton; + static volatile Point p; + + public static void main(String[] args) throws Exception { + try { + robot = new Robot(); + robot.setAutoWaitForIdle(true); + robot.delay(FRAME_ACTIVATION_TIMEOUT); + EventQueue.invokeAndWait(() -> { + frame = new Frame(); + dragSourceButton = new DragSourceButton(); + DropTargetPanel dropTargetPanel = + new DropTargetPanel(dragSourceButton); + frame.add(new Button("Test")); + frame.setTitle("Remove Focus Owner Test Frame"); + frame.setLocation(200, 200); + frame.add(dropTargetPanel); + frame.pack(); + frame.setVisible(true); + }); + + robot.waitForIdle(); + robot.delay(FRAME_ACTIVATION_TIMEOUT); + + EventQueue.invokeAndWait(() -> { + p = dragSourceButton.getLocationOnScreen(); + p.translate(10, 10); + }); + + robot.delay(FRAME_ACTIVATION_TIMEOUT); + robot.mouseMove(p.x, p.y); + robot.delay(FRAME_ACTIVATION_TIMEOUT); + robot.keyPress(KeyEvent.VK_CONTROL); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + for (int dy = 0; dy < 50; dy++) { + robot.mouseMove(p.x, p.y + dy); + robot.delay(10); + } + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + robot.keyRelease(KeyEvent.VK_CONTROL); + } finally { + EventQueue.invokeAndWait(() -> { + if (frame != null) { + frame.dispose(); + } + }); + } + } + + static class DragSourceButton extends Button implements Serializable, + Transferable, + DragGestureListener, + DragSourceListener { + + private static DataFlavor dataflavor; + + static { + try { + dataflavor = + new DataFlavor(DataFlavor.javaJVMLocalObjectMimeType); + dataflavor.setHumanPresentableName("Local Object Flavor"); + } catch (ClassNotFoundException e) { + e.printStackTrace(); + throw new ExceptionInInitializerError(); + } + } + + public DragSourceButton() { + this("DragSourceButton"); + } + + public DragSourceButton(String str) { + super(str); + + DragSource ds = DragSource.getDefaultDragSource(); + ds.createDefaultDragGestureRecognizer(this, DnDConstants.ACTION_COPY, + this); + } + + public void dragGestureRecognized(DragGestureEvent dge) { + dge.startDrag(null, this, this); + } + + public void dragEnter(DragSourceDragEvent dsde) { + } + + public void dragExit(DragSourceEvent dse) { + } + + public void dragOver(DragSourceDragEvent dsde) { + } + + public void dragDropEnd(DragSourceDropEvent dsde) { + } + + public void dropActionChanged(DragSourceDragEvent dsde) { + } + + public Object getTransferData(DataFlavor flavor) + throws UnsupportedFlavorException { + + if (!isDataFlavorSupported(flavor)) { + throw new UnsupportedFlavorException(flavor); + } + + return this; + } + + public DataFlavor[] getTransferDataFlavors() { + return new DataFlavor[]{dataflavor}; + } + + public boolean isDataFlavorSupported(DataFlavor dflavor) { + return dataflavor.equals(dflavor); + } + } + + static class DropTargetPanel extends Panel implements DropTargetListener { + + public DropTargetPanel(DragSourceButton button) { + setLayout(new FlowLayout(FlowLayout.CENTER, 50, 50)); + add(button); + setDropTarget(new DropTarget(this, this)); + } + + public void dragEnter(DropTargetDragEvent dtde) { + } + + public void dragExit(DropTargetEvent dte) { + } + + public void dragOver(DropTargetDragEvent dtde) { + } + + public void dropActionChanged(DropTargetDragEvent dtde) { + } + + public void drop(DropTargetDropEvent dtde) { + removeAll(); + + DropTargetContext dtc = dtde.getDropTargetContext(); + + if ((dtde.getSourceActions() & DnDConstants.ACTION_COPY) != 0) { + dtde.acceptDrop(DnDConstants.ACTION_COPY); + } else { + dtde.rejectDrop(); + } + + DataFlavor[] dfs = dtde.getCurrentDataFlavors(); + Component comp = null; + + if (dfs != null && dfs.length >= 1) { + Transferable transfer = dtde.getTransferable(); + + try { + comp = (Component) transfer.getTransferData(dfs[0]); + } catch (Throwable e) { + e.printStackTrace(); + dtc.dropComplete(false); + } + } + dtc.dropComplete(true); + + add(comp); + validate(); + } + } +} diff --git a/test/jdk/java/awt/dnd/DnDToWordpadTest.java b/test/jdk/java/awt/dnd/DnDToWordpadTest.java new file mode 100644 index 000000000000..181a6ee873a8 --- /dev/null +++ b/test/jdk/java/awt/dnd/DnDToWordpadTest.java @@ -0,0 +1,237 @@ +/* + * Copyright (c) 2011, 2024, 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 6362095 + * @summary Tests basic DnD functionality to a wordpad + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual DnDToWordpadTest + */ + +import java.awt.Button; +import java.awt.Color; +import java.awt.Component; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Image; +import java.awt.Panel; +import java.awt.Toolkit; +import java.awt.datatransfer.DataFlavor; +import java.awt.datatransfer.Transferable; +import java.awt.datatransfer.UnsupportedFlavorException; +import java.awt.dnd.DnDConstants; +import java.awt.dnd.DragGestureEvent; +import java.awt.dnd.DragGestureListener; +import java.awt.dnd.DragSource; +import java.awt.dnd.DragSourceDragEvent; +import java.awt.dnd.DragSourceDropEvent; +import java.awt.dnd.DragSourceEvent; +import java.awt.dnd.DragSourceListener; +import java.awt.dnd.InvalidDnDOperationException; +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.IOException; +import java.nio.file.Path; + +import javax.imageio.ImageIO; + +import static java.awt.image.BufferedImage.TYPE_INT_ARGB; + +public class DnDToWordpadTest { + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + The test window contains a yellow button. Click on the button + to copy image into the clipboard or drag the image. + Paste or drop the image over Wordpad (when the mouse + enters the Wordpad during the drag, the application + should change the cursor to indicate that a copy operation is + about to happen; release the mouse button). + An image of a red rectangle should appear inside the document. + You should be able to repeat this operation multiple times. + Please, click "Pass" if above conditions are true, + otherwise click "Fail". + """; + + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .columns(35) + .testUI(DnDToWordpadTest::createUI) + .build() + .awaitAndCheck(); + } + + public static Frame createUI() { + Frame f = new Frame("DnD To WordPad Test"); + Panel mainPanel; + Component dragSource; + + mainPanel = new Panel(); + mainPanel.setLayout(null); + + mainPanel.setBackground(Color.black); + try { + dragSource = new DnDSource("Drag ME!"); + mainPanel.add(dragSource); + f.add(mainPanel); + } catch (IOException e) { + e.printStackTrace(); + } + + f.setSize(200, 200); + return f; + } +} + +class DnDSource extends Button implements Transferable, + DragGestureListener, + DragSourceListener { + private DataFlavor m_df; + private transient int m_dropAction; + private Image m_img; + + DnDSource(String label) throws IOException { + super(label); + + setBackground(Color.yellow); + setForeground(Color.blue); + setSize(200, 120); + + m_df = DataFlavor.imageFlavor; + + DragSource dragSource = new DragSource(); + dragSource.createDefaultDragGestureRecognizer( + this, + DnDConstants.ACTION_COPY_OR_MOVE, + this + ); + dragSource.addDragSourceListener(this); + + // Create test gif image to drag + Path p = Path.of(System.getProperty("test.classes", ".")); + BufferedImage bImg = new BufferedImage(79, 109, TYPE_INT_ARGB); + Graphics2D cg = bImg.createGraphics(); + cg.setColor(Color.RED); + cg.fillRect(0, 0, 79, 109); + ImageIO.write(bImg, "png", new File(p + java.io.File.separator + + "DnDSource_Red.gif")); + + m_img = Toolkit.getDefaultToolkit() + .getImage(System.getProperty("test.classes", ".") + + java.io.File.separator + "DnDSource_Red.gif"); + + addActionListener( + ae -> Toolkit.getDefaultToolkit().getSystemClipboard().setContents( + (Transferable) DnDSource.this, + null + ) + ); + } + + public void paint(Graphics g) { + g.drawImage(m_img, 10, 10, null); + } + + /** + * a Drag gesture has been recognized + */ + + public void dragGestureRecognized(DragGestureEvent dge) { + System.err.println("starting Drag"); + try { + dge.startDrag(null, this, this); + } catch (InvalidDnDOperationException e) { + e.printStackTrace(); + } + } + + /** + * as the hotspot enters a platform dependent drop site + */ + + public void dragEnter(DragSourceDragEvent dsde) { + System.err.println("[Source] dragEnter"); + } + + /** + * as the hotspot moves over a platform dependent drop site + */ + + public void dragOver(DragSourceDragEvent dsde) { + System.err.println("[Source] dragOver"); + m_dropAction = dsde.getDropAction(); + System.out.println("m_dropAction = " + m_dropAction); + } + + /** + * as the operation changes + */ + + public void dragGestureChanged(DragSourceDragEvent dsde) { + System.err.println("[Source] dragGestureChanged"); + m_dropAction = dsde.getDropAction(); + System.out.println("m_dropAction = " + m_dropAction); + } + + /** + * as the hotspot exits a platform dependent drop site + */ + + public void dragExit(DragSourceEvent dsde) { + System.err.println("[Source] dragExit"); + } + + /** + * as the operation completes + */ + + public void dragDropEnd(DragSourceDropEvent dsde) { + System.err.println("[Source] dragDropEnd"); + } + + public void dropActionChanged(DragSourceDragEvent dsde) { + System.err.println("[Source] dropActionChanged"); + m_dropAction = dsde.getDropAction(); + System.out.println("m_dropAction = " + m_dropAction); + } + + public DataFlavor[] getTransferDataFlavors() { + return new DataFlavor[]{m_df}; + } + + public boolean isDataFlavorSupported(DataFlavor sdf) { + System.err.println("[Source] isDataFlavorSupported" + m_df.equals(sdf)); + return m_df.equals(sdf); + } + + public Object getTransferData(DataFlavor tdf) throws UnsupportedFlavorException { + if (!m_df.equals(tdf)) { + throw new UnsupportedFlavorException(tdf); + } + System.err.println("[Source] Ok"); + return m_img; + } +} diff --git a/test/jdk/java/awt/dnd/DragExitBeforeDropTest.java b/test/jdk/java/awt/dnd/DragExitBeforeDropTest.java new file mode 100644 index 000000000000..2ef778a18ba4 --- /dev/null +++ b/test/jdk/java/awt/dnd/DragExitBeforeDropTest.java @@ -0,0 +1,257 @@ +/* + * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Button; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.GridLayout; +import java.awt.Panel; +import java.awt.Point; +import java.awt.Robot; +import java.awt.datatransfer.DataFlavor; +import java.awt.datatransfer.Transferable; +import java.awt.datatransfer.UnsupportedFlavorException; +import java.awt.dnd.DnDConstants; +import java.awt.dnd.DragGestureEvent; +import java.awt.dnd.DragGestureListener; +import java.awt.dnd.DragSource; +import java.awt.dnd.DragSourceDragEvent; +import java.awt.dnd.DragSourceDropEvent; +import java.awt.dnd.DragSourceEvent; +import java.awt.dnd.DragSourceListener; +import java.awt.dnd.DropTarget; +import java.awt.dnd.DropTargetContext; +import java.awt.dnd.DropTargetDragEvent; +import java.awt.dnd.DropTargetDropEvent; +import java.awt.dnd.DropTargetEvent; +import java.awt.dnd.DropTargetListener; +import java.awt.event.InputEvent; +import java.awt.event.KeyEvent; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import java.io.Serializable; + +/* + * @test + * @bug 4395290 + * @key headful + * @summary tests that dragExit() is not called before drop() + */ + +public class DragExitBeforeDropTest { + private static Frame frame; + private static final DragSourceButton dragSourceButton = new DragSourceButton(); + private static final DropTargetPanel dropTargetPanel = new DropTargetPanel(); + private static volatile Point srcPoint; + private static volatile Point dstPoint; + + public static void main(String[] args) throws Exception { + try { + Robot robot = new Robot(); + EventQueue.invokeAndWait(DragExitBeforeDropTest::createAndShowUI); + robot.waitForIdle(); + robot.delay(1000); + + EventQueue.invokeAndWait(() -> { + Point p = dragSourceButton.getLocationOnScreen(); + Dimension d = dragSourceButton.getSize(); + p.translate(d.width / 2, d.height / 2); + srcPoint = p; + + p = dropTargetPanel.getLocationOnScreen(); + d = dropTargetPanel.getSize(); + p.translate(d.width / 2, d.height / 2); + dstPoint = p; + }); + + robot.mouseMove(srcPoint.x, srcPoint.y); + robot.keyPress(KeyEvent.VK_CONTROL); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + for (; !srcPoint.equals(dstPoint); + srcPoint.translate(sign(dstPoint.x - srcPoint.x), + sign(dstPoint.y - srcPoint.y))) { + robot.mouseMove(srcPoint.x, srcPoint.y); + robot.delay(10); + } + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + robot.keyRelease(KeyEvent.VK_CONTROL); + robot.waitForIdle(); + robot.delay(1000); + + if (!dropTargetPanel.getStatus()) { + throw new RuntimeException("The test failed: dragExit()" + + " is called before drop()"); + } + } finally { + EventQueue.invokeAndWait(() -> { + if (frame != null) { + frame.dispose(); + } + }); + } + } + + private static void createAndShowUI() { + frame = new Frame("DragExitBeforeDropTest"); + frame.setLayout(new GridLayout(2, 1)); + frame.add(dragSourceButton); + frame.add(dropTargetPanel); + frame.setLocationRelativeTo(null); + frame.setSize(300, 400); + frame.setVisible(true); + } + + public static int sign(int n) { + return Integer.compare(n, 0); + } + + private static class DragSourceButton extends Button implements Serializable, + Transferable, + DragGestureListener, + DragSourceListener { + private final DataFlavor dataflavor = + new DataFlavor(Button.class, "DragSourceButton"); + + public DragSourceButton() { + this("DragSourceButton"); + } + + public DragSourceButton(String str) { + super(str); + + DragSource ds = DragSource.getDefaultDragSource(); + ds.createDefaultDragGestureRecognizer(this, DnDConstants.ACTION_COPY, + this); + } + + public void dragGestureRecognized(DragGestureEvent dge) { + dge.startDrag(null, this, this); + } + + public void dragEnter(DragSourceDragEvent dsde) {} + + public void dragExit(DragSourceEvent dse) {} + + public void dragOver(DragSourceDragEvent dsde) {} + + public void dragDropEnd(DragSourceDropEvent dsde) {} + + public void dropActionChanged(DragSourceDragEvent dsde) {} + + public Object getTransferData(DataFlavor flavor) + throws UnsupportedFlavorException, IOException { + + if (!isDataFlavorSupported(flavor)) { + throw new UnsupportedFlavorException(flavor); + } + + Object retObj; + + ByteArrayOutputStream baoStream = new ByteArrayOutputStream(); + ObjectOutputStream ooStream = new ObjectOutputStream(baoStream); + ooStream.writeObject(this); + + ByteArrayInputStream baiStream = + new ByteArrayInputStream(baoStream.toByteArray()); + ObjectInputStream ois = new ObjectInputStream(baiStream); + try { + retObj = ois.readObject(); + } catch (ClassNotFoundException e) { + e.printStackTrace(); + throw new RuntimeException(e.toString()); + } + + return retObj; + } + + public DataFlavor[] getTransferDataFlavors() { + return new DataFlavor[] { dataflavor }; + } + + public boolean isDataFlavorSupported(DataFlavor dflavor) { + return dataflavor.equals(dflavor); + } + } + + private static class DropTargetPanel extends Panel implements DropTargetListener { + + final Dimension preferredDimension = new Dimension(200, 100); + volatile boolean testPassed = true; + + public DropTargetPanel() { + setDropTarget(new DropTarget(this, this)); + } + + public boolean getStatus() { + return testPassed; + } + + public Dimension getPreferredSize() { + return preferredDimension; + } + + public void dragEnter(DropTargetDragEvent dtde) {} + + public void dragExit(DropTargetEvent dte) { + testPassed = false; + } + + public void dragOver(DropTargetDragEvent dtde) {} + + public void dropActionChanged(DropTargetDragEvent dtde) {} + + public void drop(DropTargetDropEvent dtde) { + DropTargetContext dtc = dtde.getDropTargetContext(); + + if ((dtde.getSourceActions() & DnDConstants.ACTION_COPY) != 0) { + dtde.acceptDrop(DnDConstants.ACTION_COPY); + } else { + dtde.rejectDrop(); + } + + DataFlavor[] dfs = dtde.getCurrentDataFlavors(); + Component comp = null; + + if(dfs != null && dfs.length >= 1) { + Transferable transfer = dtde.getTransferable(); + + try { + comp = (Component)transfer.getTransferData(dfs[0]); + } catch (Throwable e) { + e.printStackTrace(); + dtc.dropComplete(false); + } + } + dtc.dropComplete(true); + add(comp); + } + } +} + + + diff --git a/test/jdk/java/awt/dnd/DragSourceMotionListenerTest.java b/test/jdk/java/awt/dnd/DragSourceMotionListenerTest.java new file mode 100644 index 000000000000..25bf7ef03fd1 --- /dev/null +++ b/test/jdk/java/awt/dnd/DragSourceMotionListenerTest.java @@ -0,0 +1,242 @@ +/* + * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.AWTEvent; +import java.awt.Component; +import java.awt.Container; +import java.awt.Dimension; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.GridLayout; +import java.awt.Panel; +import java.awt.Point; +import java.awt.Robot; +import java.awt.Toolkit; +import java.awt.datatransfer.DataFlavor; +import java.awt.datatransfer.StringSelection; +import java.awt.datatransfer.Transferable; +import java.awt.dnd.DnDConstants; +import java.awt.dnd.DragGestureListener; +import java.awt.dnd.DragSource; +import java.awt.dnd.DragSourceAdapter; +import java.awt.dnd.DragSourceDragEvent; +import java.awt.dnd.DragSourceDropEvent; +import java.awt.dnd.DropTarget; +import java.awt.dnd.DropTargetAdapter; +import java.awt.dnd.DropTargetDropEvent; +import java.awt.dnd.DropTargetListener; +import java.awt.event.AWTEventListener; +import java.awt.event.InputEvent; +import java.awt.event.KeyEvent; +import java.awt.event.MouseEvent; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.TimeUnit; + +/* + * @test + * @key headful + * @bug 4422345 + * @summary tests that DragSourceMotionListeners work correctly and + DragSourceEvents position is correct + */ + +public class DragSourceMotionListenerTest implements AWTEventListener { + static class TestPanel extends Panel { + final Dimension preferredDimension = new Dimension(200, 200); + public Dimension getPreferredSize() { + return preferredDimension; + } + } + + private static Frame frame; + private static final Panel source = new TestPanel(); + private static final Panel target = new TestPanel(); + private static final DragSource ds = DragSource.getDefaultDragSource(); + private static volatile CountDownLatch mouseReleaseEvent; + + static volatile boolean passedTest1 = false; + static volatile boolean passedTest2 = false; + + private static final Point testPoint1 = new Point(); + private static final Point testPoint2 = new Point(); + private static volatile Point srcPoint; + private static volatile Point dstOutsidePoint; + private static volatile Point dstInsidePoint; + + private static final Transferable t = new StringSelection("TEXT"); + private static final DragGestureListener gestureListener = e -> e.startDrag(null, t); + + private static final DragSourceAdapter sourceAdapter = new DragSourceAdapter() { + public void dragMouseMoved(DragSourceDragEvent dsde) { + if (Math.abs(dsde.getX() - testPoint1.getX()) < 5) { + passedTest1 = true; + } + } + + public void dragDropEnd(DragSourceDropEvent dsde) { + if (Math.abs(dsde.getX() - testPoint2.getX()) < 5) { + passedTest2 = true; + } + } + }; + + private static final DropTargetListener targetAdapter = new DropTargetAdapter() { + public void drop(DropTargetDropEvent e) { + e.acceptDrop(DnDConstants.ACTION_COPY); + try { + final Transferable t = e.getTransferable(); + final String str = + (String) t.getTransferData(DataFlavor.stringFlavor); + e.dropComplete(true); + } catch (Exception ex) { + ex.printStackTrace(); + e.dropComplete(false); + } + } + }; + + private static final DropTarget dropTarget = new DropTarget(target, targetAdapter); + Component clickedComponent = null; + + private void createAndShowUI() { + frame = new Frame("DragSourceMotionListenerTest"); + ds.addDragSourceListener(sourceAdapter); + ds.addDragSourceMotionListener(sourceAdapter); + ds.createDefaultDragGestureRecognizer(source, DnDConstants.ACTION_COPY, gestureListener); + target.setDropTarget(dropTarget); + + frame.setLayout(new GridLayout(1, 2)); + + frame.add(source); + frame.add(target); + + Toolkit.getDefaultToolkit() + .addAWTEventListener(this, AWTEvent.MOUSE_EVENT_MASK); + frame.pack(); + frame.setVisible(true); + } + + public static void main(String[] args) throws Exception { + try { + Robot robot = new Robot(); + robot.setAutoDelay(10); + + DragSourceMotionListenerTest dsmObj = new DragSourceMotionListenerTest(); + EventQueue.invokeAndWait(dsmObj::createAndShowUI); + robot.waitForIdle(); + robot.delay(1000); + + EventQueue.invokeAndWait(() -> { + srcPoint = getPoint(source, 1); + + dstOutsidePoint = getPoint(frame, 3); + testPoint1.setLocation(dstOutsidePoint); + + dstInsidePoint = getPoint(target, 1); + testPoint2.setLocation(dstInsidePoint); + }); + robot.waitForIdle(); + + if (!dsmObj.pointInComponent(robot, srcPoint, source)) { + throw new RuntimeException("WARNING: Couldn't locate source panel."); + } + + if (!dsmObj.pointInComponent(robot, dstInsidePoint, target)) { + throw new RuntimeException("WARNING: Couldn't locate target panel."); + } + + robot.mouseMove(srcPoint.x, srcPoint.y); + robot.keyPress(KeyEvent.VK_CONTROL); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + for (; !srcPoint.equals(dstOutsidePoint); + srcPoint.translate(sign(dstOutsidePoint.x - srcPoint.x), + sign(dstOutsidePoint.y - srcPoint.y))) { + robot.mouseMove(srcPoint.x, srcPoint.y); + } + + for (int i = 0; i < 10; i++) { + robot.mouseMove(srcPoint.x, srcPoint.y++); + } + + for (;!srcPoint.equals(dstInsidePoint); + srcPoint.translate(sign(dstInsidePoint.x - srcPoint.x), + sign(dstInsidePoint.y - srcPoint.y))) { + robot.mouseMove(srcPoint.x, srcPoint.y); + } + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + robot.keyRelease(KeyEvent.VK_CONTROL); + robot.waitForIdle(); + robot.delay(1000); + + if (!passedTest1) { + throw new RuntimeException("Failed first test."); + } + + if (!passedTest2) { + throw new RuntimeException("Failed second test."); + } + } finally { + EventQueue.invokeAndWait(() -> { + if (frame != null) { + frame.dispose(); + } + }); + } + } + + private static Point getPoint(Container container, int multiple) { + Point p = container.getLocationOnScreen(); + Dimension d = container.getSize(); + p.translate(multiple * d.width / 2, d.height / 2); + return p; + } + + public static int sign(int n) { + return Integer.compare(n, 0); + } + + public void eventDispatched(AWTEvent e) { + if (e.getID() == MouseEvent.MOUSE_RELEASED) { + clickedComponent = (Component)e.getSource(); + mouseReleaseEvent.countDown(); + } + } + + boolean pointInComponent(Robot robot, Point p, Component comp) throws Exception { + robot.waitForIdle(); + clickedComponent = null; + mouseReleaseEvent = new CountDownLatch(1); + robot.mouseMove(p.x, p.y); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + if (!mouseReleaseEvent.await(2, TimeUnit.SECONDS)) { + throw new RuntimeException("Mouse Release Event not received"); + } + + Component c = clickedComponent; + while (c != null && c != comp) { + c = c.getParent(); + } + return c == comp; + } +} diff --git a/test/jdk/java/awt/dnd/DragThresholdTest.java b/test/jdk/java/awt/dnd/DragThresholdTest.java new file mode 100644 index 000000000000..bcb3bbf91c2c --- /dev/null +++ b/test/jdk/java/awt/dnd/DragThresholdTest.java @@ -0,0 +1,134 @@ +/* + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.Panel; +import java.awt.Point; +import java.awt.Robot; +import java.awt.dnd.DnDConstants; +import java.awt.dnd.DragGestureListener; +import java.awt.dnd.DragSource; +import java.awt.event.InputEvent; +import java.awt.event.MouseEvent; +import java.awt.event.MouseMotionAdapter; + +/* + @test + @key headful + @bug 4415175 + @summary tests DragSource.getDragThreshold() and + that the AWT default drag gesture recognizers + honor the drag gesture motion threshold +*/ + +public class DragThresholdTest { + private static Frame frame; + private static Panel panel; + private static MouseEvent lastMouseEvent; + private static volatile boolean failed; + private static volatile Point startPoint; + private static volatile Point endPoint; + + public static void main(String[] args) throws Exception { + try { + Robot robot = new Robot(); + + EventQueue.invokeAndWait(DragThresholdTest::createAndShowDnD); + robot.waitForIdle(); + robot.delay(1000); + + EventQueue.invokeAndWait(() -> { + Point p = panel.getLocationOnScreen(); + p.translate(50, 50); + startPoint = p; + endPoint = new Point(p.x + 2 * DragSource.getDragThreshold(), + p.y + 2 * DragSource.getDragThreshold()); + }); + + robot.mouseMove(startPoint.x, startPoint.y); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + for (Point p = new Point(startPoint); !p.equals(endPoint); + p.translate(sign(endPoint.x - p.x), + sign(endPoint.y - p.y))) { + robot.mouseMove(p.x, p.y); + robot.delay(100); + } + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + robot.waitForIdle(); + robot.delay(200); + + if (failed) { + throw new RuntimeException("drag gesture recognized too early"); + } + } finally { + EventQueue.invokeAndWait(() -> { + if (frame != null) { + frame.dispose(); + } + }); + } + } + + private static void createAndShowDnD() { + frame = new Frame("DragThresholdTest"); + panel = new Panel(); + // Mouse motion listener mml is added to the panel first. + // We rely on it that this listener will be called first. + panel.addMouseMotionListener(new MouseMotionAdapter() { + public void mouseDragged(MouseEvent evt) { + lastMouseEvent = evt; + System.out.println(evt); + } + }); + frame.add(panel); + frame.setSize(200, 200); + frame.setLocationRelativeTo(null); + + DragGestureListener dgl = dge -> { + Point dragOrigin = dge.getDragOrigin(); + int diffx = Math.abs(dragOrigin.x - lastMouseEvent.getX()); + int diffy = Math.abs(dragOrigin.y - lastMouseEvent.getY()); + System.out.println("dragGestureRecognized(): " + + " diffx=" + diffx + " diffy=" + diffy + + " DragSource.getDragThreshold()=" + + DragSource.getDragThreshold()); + if (diffx <= DragSource.getDragThreshold() && + diffy <= DragSource.getDragThreshold()) { + failed = true; + System.out.println("drag gesture recognized too early!"); + } + }; + + // Default drag gesture recognizer is a mouse motion listener. + // It is added to the panel second. + new DragSource().createDefaultDragGestureRecognizer( + panel, + DnDConstants.ACTION_COPY_OR_MOVE, dgl); + frame.setVisible(true); + } + + private static int sign(int n) { + return Integer.compare(n, 0); + } +} diff --git a/test/jdk/java/awt/dnd/DragToAnotherScreenTest.java b/test/jdk/java/awt/dnd/DragToAnotherScreenTest.java new file mode 100644 index 000000000000..89f18061845f --- /dev/null +++ b/test/jdk/java/awt/dnd/DragToAnotherScreenTest.java @@ -0,0 +1,169 @@ +/* + * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Frame; +import java.awt.GraphicsDevice; +import java.awt.GraphicsEnvironment; +import java.awt.Label; +import java.awt.Toolkit; +import java.awt.Window; +import java.awt.datatransfer.DataFlavor; +import java.awt.datatransfer.StringSelection; +import java.awt.datatransfer.Transferable; +import java.awt.dnd.DnDConstants; +import java.awt.dnd.DragGestureListener; +import java.awt.dnd.DragSource; +import java.awt.dnd.DropTarget; +import java.awt.dnd.DropTargetAdapter; +import java.awt.dnd.DropTargetDropEvent; +import java.util.List; + +import javax.swing.JOptionPane; + +/* + * @test + * @bug 6179157 + * @key multimon + * @summary Tests dnd to another screen + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual DragToAnotherScreenTest + */ + +public class DragToAnotherScreenTest { + private static Label label0; + private static Label label1; + private static final int HGAP = 20; + + private static final String INSTRUCTIONS = """ + The following test is applicable for Single as well + as Multi-monitor screens. + + It is a semi-automated test, the test will prompt + the user whether the drag and drop action was successful or not + and automatically PASS/FAIL the test. + + If on multi-monitor screens then please position + the drag and drop windows on different screens. + + If you can not move the mouse from the frame "Drag Source" + to the frame "Drop Target" press PASS, + else proceed to the next step. + + Drag the label "Drag me" and drop it on the + label "Drop on me". + + If you can not drag to the second label (for example + if you can not drag across screens) press FAIL. + + After the drag and drop action, the test displays + Success/Failure msg in JOptionPane. + Click on OK button and the test is configured to + automatically PASS/FAIL. + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .columns(35) + .testUI(DragToAnotherScreenTest::createAndShowUI) + .positionTestUI(DragToAnotherScreenTest::positionMultiTestUI) + .logArea(10) + .build() + .awaitAndCheck(); + } + + private static List createAndShowUI() { + PassFailJFrame.log("----- System Configuration ----"); + PassFailJFrame.log("Toolkit:" + Toolkit.getDefaultToolkit() + .getClass() + .getName()); + + GraphicsDevice[] gd = GraphicsEnvironment.getLocalGraphicsEnvironment() + .getScreenDevices(); + if (gd.length == 1) { + PassFailJFrame.log("Single Monitor"); + } else { + PassFailJFrame.log("Multi-Monitor"); + } + PassFailJFrame.log("--------------"); + PassFailJFrame.log("Test logs:\n"); + Frame frame0 = new Frame("Drag Source", gd[0].getDefaultConfiguration()); + frame0.setSize(300, 300); + label0 = new Label("Drag me"); + frame0.add(label0); + + Frame frame1 = new Frame("Drop Target", gd[(gd.length > 1 ? 1 : 0)].getDefaultConfiguration()); + frame1.setSize(300, 300); + label1 = new Label("Drop on me"); + frame1.add(label1); + + DragGestureListener dragGestureListener = dge -> dge.startDrag(null, new StringSelection(label0.getText()), null); + new DragSource().createDefaultDragGestureRecognizer(label0, + DnDConstants.ACTION_COPY, dragGestureListener); + + DropTargetAdapter dropTargetAdapter = new DropTargetAdapter() { + public void drop(DropTargetDropEvent dtde) { + Transferable t = dtde.getTransferable(); + if (t.isDataFlavorSupported(DataFlavor.stringFlavor)) { + dtde.acceptDrop(DnDConstants.ACTION_COPY); + try { + String str = (String) t.getTransferData(DataFlavor.stringFlavor); + label1.setText(str); + JOptionPane.showMessageDialog(frame0, + "getTransferData was successful", + "Test Passed", JOptionPane.PLAIN_MESSAGE); + } catch (Exception e) { + dtde.dropComplete(false); + e.printStackTrace(); + PassFailJFrame.log("getTransferData() Failed"); + JOptionPane.showMessageDialog(frame0, + "getTransferData() Failed", + "Test Failed", JOptionPane.ERROR_MESSAGE); + PassFailJFrame.forceFail("getTransferData() Failed"); + } + dtde.dropComplete(true); + } else { + dtde.rejectDrop(); + PassFailJFrame.log("stringFlavor is not supported by Transferable"); + JOptionPane.showMessageDialog(frame0, + "stringFlavor is not supported by Transferable", + "Test Failed", JOptionPane.ERROR_MESSAGE); + PassFailJFrame.forceFail("stringFlavor is not supported by Transferable"); + } + } + }; + new DropTarget(label1, dropTargetAdapter); + return List.of(frame0, frame1); + } + + private static void positionMultiTestUI(List windows, + PassFailJFrame.InstructionUI instructionUI) { + int x = instructionUI.getLocation().x + instructionUI.getSize().width + HGAP; + for (Window w : windows) { + w.setLocation(x, instructionUI.getLocation().y); + x += w.getWidth() + HGAP; + } + } +} diff --git a/test/jdk/java/awt/dnd/NonAsciiFilenames.java b/test/jdk/java/awt/dnd/NonAsciiFilenames.java new file mode 100644 index 000000000000..b508350c05ef --- /dev/null +++ b/test/jdk/java/awt/dnd/NonAsciiFilenames.java @@ -0,0 +1,158 @@ +/* + * Copyright (c) 2000, 2024, 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 4187490 + * @summary Verify that Non-ASCII file names can be dragged and dropped + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual NonAsciiFilenames + */ + +import java.awt.Color; +import java.awt.datatransfer.DataFlavor; +import java.awt.dnd.DnDConstants; +import java.awt.dnd.DropTarget; +import java.awt.dnd.DropTargetDragEvent; +import java.awt.dnd.DropTargetDropEvent; +import java.awt.dnd.DropTargetEvent; +import java.awt.dnd.DropTargetListener; +import java.io.File; +import java.util.AbstractList; + +import javax.swing.JFrame; +import javax.swing.JLabel; + +public class NonAsciiFilenames { + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + This test must be run on an OS which does not use ISO 8859-1 + as its default encoding. + + Open a native file browsing application, such as Windows + Explorer. Try to find a file whose name uses non-ISO 8859-1 + characters. Create a file and name it such that it contains + non-ISO 8859-1 characters (For ex. é, à, ö, €, ¥). Drag + the file from the native application and drop it on the test + Frame. If the file name appears normally, then the test passes. + If boxes or question marks appear for characters, or if you see + the word "Error", then the test fails. + """; + + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .columns(35) + .testUI(NonAsciiFilenames::createUI) + .build() + .awaitAndCheck(); + } + + public static JFrame createUI() { + JFrame frame = new JFrame(); + frame.setTitle("DropLabel test"); + frame.getContentPane().add(new DropLabel("Drop here")); + frame.setSize(300, 100); + return frame; + } +} + +class DropLabel extends JLabel implements DropTargetListener { + public DropLabel(String s) { + setText(s); + new DropTarget(this, DnDConstants.ACTION_COPY, this, true); + showDrop(false); + } + + private void showDrop(boolean b) { + setForeground(b ? Color.white : Color.black); + } + + /** + * Configure to desired flavor of dropped data. + */ + private DataFlavor getDesiredFlavor() { + return DataFlavor.javaFileListFlavor; + } + + /** + * Check to make sure that the contains the expected object types. + */ + private void checkDroppedData(Object data) { + System.out.println("Got data: " + data.getClass().getName()); + if (data instanceof AbstractList) { + AbstractList files = (AbstractList) data; + if (((File) files.get(0)).isFile()) + setText(((File) files.get(0)).toString()); + else + setText("Error: not valid file: " + + ((File) files.get(0)).toString()); + } else { + System.out.println("Error: wrong type of data dropped"); + } + } + + private boolean isDragOk(DropTargetDragEvent e) { + boolean canDrop = false; + try { + canDrop = e.isDataFlavorSupported(getDesiredFlavor()); + } catch (Exception ex) { + } + + if (canDrop) + e.acceptDrag(DnDConstants.ACTION_COPY); + else + e.rejectDrag(); + showDrop(canDrop); + return canDrop; + } + + public void dragEnter(DropTargetDragEvent e) { + isDragOk(e); + } + + + public void dragOver(DropTargetDragEvent e) { + isDragOk(e); + } + + public void dropActionChanged(DropTargetDragEvent e) { + isDragOk(e); + } + + public void dragExit(DropTargetEvent e) { + showDrop(false); + } + + public void drop(DropTargetDropEvent e) { + try { + e.acceptDrop(DnDConstants.ACTION_COPY); + checkDroppedData(e.getTransferable(). + getTransferData(getDesiredFlavor())); + } catch (Exception err) { + } + e.dropComplete(true); + showDrop(false); + } +} diff --git a/test/jdk/java/awt/dnd/RejectDragDropActionTest.java b/test/jdk/java/awt/dnd/RejectDragDropActionTest.java index f8d53ac45bfa..9ff3c00ead00 100644 --- a/test/jdk/java/awt/dnd/RejectDragDropActionTest.java +++ b/test/jdk/java/awt/dnd/RejectDragDropActionTest.java @@ -27,10 +27,9 @@ @summary tests that DropTargetDragEvent.getDropAction() returns correct value after DropTargetDragEvent.rejectDrag() @key headful - @run main RejectDragDropActionTest + @run main/timeout=300 RejectDragDropActionTest */ -import java.awt.AWTException; import java.awt.EventQueue; import java.awt.Frame; import java.awt.Point; @@ -46,14 +45,13 @@ import java.awt.dnd.DropTargetDropEvent; import java.awt.dnd.DropTargetListener; import java.awt.event.InputEvent; -import java.lang.reflect.InvocationTargetException; public class RejectDragDropActionTest { private static volatile boolean incorrectActionDetected = false; - private static final int FRAME_ACTIVATION_TIMEOUT = 3000; + private static final int DELAY_TIME = 500; private static Frame frame; private static DragSource ds; @@ -74,21 +72,23 @@ public void drop(DropTargetDropEvent dtde) { }; private final DropTarget dt = new DropTarget(frame, dtl); - public static void main(String[] args) throws InterruptedException, - InvocationTargetException, AWTException { + public static void main(String[] args) throws Exception { EventQueue.invokeAndWait(() -> { frame = new Frame("RejectDragDropActionTest"); ds = DragSource.getDefaultDragSource(); dgl = dge -> dge.startDrag(null, new StringSelection("OOKK")); - dgr = ds.createDefaultDragGestureRecognizer(frame, DnDConstants.ACTION_COPY, dgl); - frame.setBounds(100, 100, 200, 200); + dgr = ds.createDefaultDragGestureRecognizer(frame, + DnDConstants.ACTION_COPY, dgl); + frame.setSize(200, 200); + frame.setLocationRelativeTo(null); frame.setVisible(true); }); try { Robot robot = new Robot(); + robot.setAutoWaitForIdle(true); robot.waitForIdle(); - robot.delay(FRAME_ACTIVATION_TIMEOUT); + robot.delay(DELAY_TIME); Point startPoint = frame.getLocationOnScreen(); Point endPoint = new Point(startPoint); @@ -97,11 +97,11 @@ public static void main(String[] args) throws InterruptedException, robot.mouseMove(startPoint.x, startPoint.y); robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); - for (Point p = new Point(startPoint); !p.equals(endPoint); + for (Point p = new Point(startPoint); + !p.equals(endPoint) && !incorrectActionDetected; p.translate(sign(endPoint.x - p.x), - sign(endPoint.y - p.y))) { + sign(endPoint.y - p.y))) { robot.mouseMove(p.x, p.y); - robot.delay(50); } robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); diff --git a/test/jdk/java/awt/dnd/RejectDragTest.java b/test/jdk/java/awt/dnd/RejectDragTest.java new file mode 100644 index 000000000000..c65612436bc3 --- /dev/null +++ b/test/jdk/java/awt/dnd/RejectDragTest.java @@ -0,0 +1,174 @@ +/* + * Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.Point; +import java.awt.Robot; +import java.awt.datatransfer.StringSelection; +import java.awt.dnd.DnDConstants; +import java.awt.dnd.DragGestureListener; +import java.awt.dnd.DragSource; +import java.awt.dnd.DragSourceAdapter; +import java.awt.dnd.DragSourceDragEvent; +import java.awt.dnd.DragSourceDropEvent; +import java.awt.dnd.DragSourceEvent; +import java.awt.dnd.DragSourceListener; +import java.awt.dnd.DropTarget; +import java.awt.dnd.DropTargetAdapter; +import java.awt.dnd.DropTargetDragEvent; +import java.awt.dnd.DropTargetDropEvent; +import java.awt.event.InputEvent; + +/* + * @test + * @key headful + * @bug 4407521 + * @summary Tests that DragSourceListener.dragEnter() and + DragSourceListener.dragOver() are not called after + drag rejecting, but DragSourceListener.dragExit() is. + */ + +public class RejectDragTest { + private static Frame frame; + private static Robot robot; + private static volatile boolean dragEnterCalled; + private static volatile boolean dragOverCalled; + private static volatile boolean dragExitCalledAtFirst; + private static volatile Point startPoint; + private static volatile Point endPoint; + + public static void main(String[] args) throws Exception { + try { + robot = new Robot(); + + EventQueue.invokeAndWait(RejectDragTest::createAndShowUI); + robot.waitForIdle(); + robot.delay(1000); + + EventQueue.invokeAndWait(RejectDragTest::addDnDListeners); + robot.waitForIdle(); + + testDnD(); + robot.waitForIdle(); + robot.delay(200); + } finally { + EventQueue.invokeAndWait(() -> { + if (frame != null) { + frame.dispose(); + } + }); + } + } + + private static void addDnDListeners() { + final DragSourceListener dragSourceListener = new DragSourceAdapter() { + private boolean first = true; + + public void dragEnter(DragSourceDragEvent dsde) { + first = false; + dragEnterCalled = true; + } + + public void dragExit(DragSourceEvent dse) { + if (first) { + dragExitCalledAtFirst = true; + first = false; + } + } + + public void dragDropEnd(DragSourceDropEvent dsde) { + first = false; + } + + public void dragOver(DragSourceDragEvent dsde) { + first = false; + dragOverCalled = true; + } + + public void dropActionChanged(DragSourceDragEvent dsde) { + first = false; + } + }; + + DragGestureListener dragGestureListener = + dge -> dge.startDrag(null, new StringSelection("OKAY"), + dragSourceListener); + new DragSource().createDefaultDragGestureRecognizer(frame, + DnDConstants.ACTION_COPY, + dragGestureListener); + + DropTargetAdapter dropTargetListener = new DropTargetAdapter() { + public void dragEnter(DropTargetDragEvent dtde) { + dtde.rejectDrag(); + } + + public void drop(DropTargetDropEvent dtde) { + dtde.rejectDrop(); + } + }; + + new DropTarget(frame, dropTargetListener); + } + + private static void createAndShowUI() { + frame = new Frame("RejectDragTest"); + frame.setSize(200, 200); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + } + + private static void testDnD() throws Exception { + EventQueue.invokeAndWait(() -> { + Point start = frame.getLocationOnScreen(); + start.translate(50, 50); + startPoint = start; + + Point end = new Point(start); + end.translate(150, 150); + endPoint = end; + }); + + robot.mouseMove(startPoint.x, startPoint.y); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + for (Point p = new Point(startPoint); !p.equals(endPoint); + p.translate(sign(endPoint.x - p.x), + sign(endPoint.y - p.y))) { + robot.mouseMove(p.x, p.y); + robot.delay(30); + } + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + + if (dragEnterCalled || dragOverCalled) { + throw new RuntimeException("Test failed: " + + (dragEnterCalled ? "DragSourceListener.dragEnter() was called; " : "") + + (dragOverCalled ? "DragSourceListener.dragOver() was called; " : "") + + (!dragExitCalledAtFirst ? "DragSourceListener.dragExit() was not " + + "called immediately after rejectDrag() " : "")); + } + } + + public static int sign(int n) { + return Integer.compare(n, 0); + } +} diff --git a/test/jdk/java/awt/dnd/WinMoveFileToShellTest.java b/test/jdk/java/awt/dnd/WinMoveFileToShellTest.java new file mode 100644 index 000000000000..5ae7dd3890d7 --- /dev/null +++ b/test/jdk/java/awt/dnd/WinMoveFileToShellTest.java @@ -0,0 +1,131 @@ +/* + * Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Frame; +import java.awt.datatransfer.DataFlavor; +import java.awt.datatransfer.Transferable; +import java.awt.datatransfer.UnsupportedFlavorException; +import java.awt.dnd.DnDConstants; +import java.awt.dnd.DragGestureListener; +import java.awt.dnd.DragSource; +import java.awt.dnd.DragSourceAdapter; +import java.awt.dnd.DragSourceDropEvent; +import java.awt.dnd.DragSourceListener; +import java.io.File; +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; + +/* + * @test + * @bug 4414739 + * @requires (os.family == "windows") + * @summary verifies that getDropSuccess() returns correct value for moving + a file from a Java drag source to the Windows shell + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual WinMoveFileToShellTest + */ + +public class WinMoveFileToShellTest { + private static final String INSTRUCTIONS = """ + Drag from the frame titled "Drag Frame" and drop on to Windows Desktop. + After Drag and Drop, check for "Drop Success" status in the log area. + If "Drop Success" is true press PASS else FAIL. + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .columns(40) + .testUI(WinMoveFileToShellTest::createAndShowUI) + .logArea(5) + .build() + .awaitAndCheck(); + } + + private static Frame createAndShowUI() { + Frame frame = new Frame("Drag Frame"); + final DragSourceListener dsl = new DragSourceAdapter() { + public void dragDropEnd(DragSourceDropEvent e) { + PassFailJFrame.log("Drop Success: " + e.getDropSuccess()); + } + }; + + DragGestureListener dgl = dge -> { + File file = new File(System.getProperty("test.classes", ".") + + File.separator + "move.me"); + try { + file.createNewFile(); + } catch (IOException exc) { + exc.printStackTrace(); + } + ArrayList list = new ArrayList<>(); + list.add(file); + dge.startDrag(null, new FileListSelection(list), dsl); + }; + + new DragSource().createDefaultDragGestureRecognizer(frame, + DnDConstants.ACTION_MOVE, dgl); + frame.setSize(200, 100); + return frame; + } + + private static class FileListSelection implements Transferable { + private static final int FL = 0; + + private static final DataFlavor[] flavors = + new DataFlavor[] { DataFlavor.javaFileListFlavor }; + + + private List data; + + public FileListSelection(List data) { + this.data = data; + } + + public DataFlavor[] getTransferDataFlavors() { + return flavors.clone(); + } + + public boolean isDataFlavorSupported(DataFlavor flavor) { + for (DataFlavor dataFlavor : flavors) { + if (flavor.equals(dataFlavor)) { + return true; + } + } + return false; + } + + public Object getTransferData(DataFlavor flavor) + throws UnsupportedFlavorException, IOException + { + if (flavor.equals(flavors[FL])) { + return data; + } else { + throw new UnsupportedFlavorException(flavor); + } + } + } +} diff --git a/test/jdk/java/awt/event/PaintEvent/RepaintTest.java b/test/jdk/java/awt/event/PaintEvent/RepaintTest.java new file mode 100644 index 000000000000..caeeaf7d5a8e --- /dev/null +++ b/test/jdk/java/awt/event/PaintEvent/RepaintTest.java @@ -0,0 +1,133 @@ +/* + * Copyright (c) 2001, 2023, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Color; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.EventQueue; +import java.awt.FontMetrics; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Panel; +import java.awt.Robot; +import java.util.concurrent.atomic.AtomicInteger; + +/* + * @test + * @bug 4394287 + * @key headful + * @summary Paint pending on heavyweight component move + */ + +public class RepaintTest { + private static Frame frame; + private static Panel panel; + private static volatile IncrementComponent counter; + + public static void main(String[] args) throws Exception { + try { + Robot robot = new Robot(); + EventQueue.invokeAndWait(RepaintTest::createAndShowUI); + robot.waitForIdle(); + robot.delay(1000); + + EventQueue.invokeAndWait(() -> panel.setLocation(panel.getX() + 10, + panel.getY() + 10)); + robot.waitForIdle(); + robot.delay(500); + + int count = counter.getCount().get(); + + EventQueue.invokeAndWait(panel::repaint); + robot.waitForIdle(); + robot.delay(1000); + + if (counter.getCount().get() == count) { + throw new RuntimeException("Failed"); + } + } finally { + EventQueue.invokeAndWait(() -> { + if (frame != null) { + frame.dispose(); + } + }); + } + } + + private static void createAndShowUI() { + frame = new MyFrame("Repaint Test"); + frame.setLayout(null); + + counter = new IncrementComponent(); + panel = new Panel(); + panel.add(counter); + frame.add(panel); + panel.setBounds(0, 0, 100, 100); + frame.setSize(200, 200); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + } + + private static class MyFrame extends Frame { + + public MyFrame(String title) { + super(title); + } + + public void update(Graphics g) { + System.out.println("UPDATE: " + g.getClipBounds()); + super.update(g); + } + + public void paint(Graphics g) { + System.out.println("PAINT: " + g.getClipBounds()); + super.paint(g); + } + } + + // Subclass of Component, everytime paint is invoked a counter + // is incremented, this counter is displayed in the component. + private static class IncrementComponent extends Component { + private static final AtomicInteger paintCount = new AtomicInteger(0); + + public Dimension getPreferredSize() { + return new Dimension(100, 100); + } + + public AtomicInteger getCount() { + return paintCount; + } + + public void paint(Graphics g) { + g.setColor(Color.red); + g.fillRect(0, 0, getWidth(), getHeight()); + g.setColor(Color.white); + + String string = Integer.toString(paintCount.getAndIncrement()); + FontMetrics metrics = g.getFontMetrics(); + int x = (getWidth() - metrics.stringWidth(string)) / 2; + int y = (getHeight() + metrics.getHeight()) / 2; + g.drawString(string, x, y); + } + } +} diff --git a/test/jdk/java/awt/geom/Arc2D/Arc2DHitTest.java b/test/jdk/java/awt/geom/Arc2D/Arc2DHitTest.java new file mode 100644 index 000000000000..de6b39d5c6f7 --- /dev/null +++ b/test/jdk/java/awt/geom/Arc2D/Arc2DHitTest.java @@ -0,0 +1,100 @@ +/* + * Copyright (c) 1999, 2024, 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 4178123 + * @summary Verifies that the Arc2D.contains(point) methods work correctly. + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual Arc2DHitTest + */ + +import java.awt.Color; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Panel; +import java.awt.Point; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.geom.Arc2D; + +public class Arc2DHitTest { + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + This test displays an arc figure and lets the user click on it. + The arc will initially be drawn in red and only when the user clicks + within the arc in the window it will be redrawn into green otherwise + it should stay red. + + For convenience, the point being tested is drawn in black. Note + that rounding in the arc rendering routines may cause points near + the boundary of the arc to render incorrectly. Allow for a pixel + or two of leeway near the boundary. + """; + + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .columns(40) + .testUI(initialize()) + .build() + .awaitAndCheck(); + } + private static Frame initialize() { + Frame f = new Frame("Arc2DHitTest"); + ArcHitPanel panel = new ArcHitPanel(); + f.add(panel); + f.setSize(300, 250); + return f; + } +} + +class ArcHitPanel extends Panel { + private Arc2D arc; + private Point hit; + public ArcHitPanel() { + arc = new Arc2D.Float(10, 10, 100, 100, 0, 120, Arc2D.PIE); + this.addMouseListener(new MouseAdapter() { + public void mouseClicked(MouseEvent e) { + hit = e.getPoint(); + repaint(); + } + }); + } + + @Override + public void paint(Graphics g) { + Graphics2D g2 = (Graphics2D) g; + g2.setColor(Color.white); + g2.fill(g2.getClipBounds()); + g2.setColor((hit != null && arc.contains(hit)) + ? Color.green : Color.red); + g2.fill(arc); + if (hit != null) { + g2.setColor(Color.black); + g2.fillRect(hit.x, hit.y, 1, 1); + } + } +} diff --git a/test/jdk/java/awt/geom/Arc2D/BoundsBug.java b/test/jdk/java/awt/geom/Arc2D/BoundsBug.java new file mode 100644 index 000000000000..a17f45f9dad3 --- /dev/null +++ b/test/jdk/java/awt/geom/Arc2D/BoundsBug.java @@ -0,0 +1,123 @@ +/* + * Copyright (c) 1999, 2024, 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 4197746 + * @summary Verifies that the getBounds2D method of Arc2D returns the + * correct result. + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual BoundsBug + */ + +import java.awt.Color; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Panel; +import java.awt.RenderingHints; +import java.awt.Shape; +import java.awt.geom.Arc2D; +import java.awt.geom.Ellipse2D; +import java.awt.geom.GeneralPath; +import java.awt.geom.Point2D; +import java.awt.geom.Rectangle2D; + +public class BoundsBug { + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + This test displays three figures and draws the outline of their + bounding boxes. The bounding boxes should correctly encompass + the 3 figures. + + This test also paints two highlight rectangles at the ends of the + angular extents of the arc. The two highlights should correctly + appear at the outer circumference of the arc where the radii lines + from its center intersect that circumference. + """; + + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .columns(40) + .testUI(initialize()) + .build() + .awaitAndCheck(); + } + private static Frame initialize() { + Frame f = new Frame("BoundsBug"); + ArcPanel panel = new ArcPanel(); + f.add(panel); + f.setSize(300, 250); + return f; + } +} + +class ArcPanel extends Panel { + protected void drawPoint(Graphics2D g2, Point2D p) { + g2.setColor(Color.green); + g2.fill(new Rectangle2D.Double(p.getX() - 5, p.getY() - 5, 10, 10)); + } + + protected void drawShapeAndBounds(Graphics2D g2, Shape s) { + g2.setColor(Color.orange); + g2.fill(s); + g2.setColor(Color.black); + g2.draw(s); + + Rectangle2D r = s.getBounds2D(); + g2.setColor(Color.gray); + g2.draw(r); + } + + @Override + public void paint(Graphics g) { + Graphics2D g2 = (Graphics2D)g; + g2.setColor(Color.white); + g2.fill(g.getClipBounds()); + g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, + RenderingHints.VALUE_ANTIALIAS_ON); + + // Create some interesting shapes. + Ellipse2D ellipse = new Ellipse2D.Float(20, 40, 60, 80); + Arc2D arc = new Arc2D.Float(60, 40, 100, 120, + -30, -40, Arc2D.PIE); + GeneralPath path = new GeneralPath(GeneralPath.WIND_EVEN_ODD); + path.moveTo(0, 0); + path.lineTo(75, -25); + path.lineTo(25, 75); + path.lineTo(0, 25); + path.lineTo(100, 50); + path.lineTo(50, 0); + path.lineTo(25, 50); + path.closePath(); + // Now draw them and their bounds rectangles. + drawShapeAndBounds(g2, ellipse); + drawShapeAndBounds(g2, arc); + drawPoint(g2, arc.getStartPoint()); + drawPoint(g2, arc.getEndPoint()); + g2.translate(180, 65); + drawShapeAndBounds(g2, path); + } +} diff --git a/test/jdk/java/awt/geom/Area/Translate.java b/test/jdk/java/awt/geom/Area/Translate.java new file mode 100644 index 000000000000..7519f1753bcf --- /dev/null +++ b/test/jdk/java/awt/geom/Area/Translate.java @@ -0,0 +1,122 @@ +/* + * Copyright (c) 1999, 2024, 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 4183373 + * @summary Verifies that the translated Area objects display correctly + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual Translate + */ + +import java.awt.BorderLayout; +import java.awt.CardLayout; +import java.awt.Color; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Image; +import java.awt.Panel; +import java.awt.Rectangle; +import java.awt.geom.AffineTransform; +import java.awt.geom.Area; +import java.awt.geom.Rectangle2D; + +public class Translate { + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + This test displays two sets of rectangular figures. The two sets + should be displayed one on top of the other and should be lined + up vertically with each other. If the two sets of figures are + not directly above and below each other then the test fails + """; + + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .columns(35) + .testUI(initialize()) + .build() + .awaitAndCheck(); + } + private static Frame initialize() { + Frame f = new Frame("Translate"); + TranslatePanel panel = new TranslatePanel(); + f.add(panel); + f.setSize(300, 250); + return f; + } +} + +class TranslatePanel extends Panel { + private static Image bufferedImage; + private static Area a1, a2, a3; + + public TranslatePanel() { + a1 = new Area(new Rectangle2D.Double(20.0, 20.0, 60.0, 60.0)); + + a2 = new Area((Area) a1.clone()); + a2.subtract(new Area(new Rectangle2D.Double(30.0, 30.0, 40.0, 40.0))); + + a3 = new Area((Area) a2.clone()); + a3.add(new Area(new Rectangle2D.Double(40.0, 40.0, 20.0, 20.0))); + + AffineTransform at2 = new AffineTransform(); + at2.translate(100.0, 0.0); + a2.transform(at2); + + AffineTransform at3 = new AffineTransform(); + at3.translate(200.0, 0.0); + a3.transform(at3); + } + private void paintRects(Graphics2D g2) { + Rectangle clip = g2.getClipBounds(); + g2.setColor(Color.white); + g2.fillRect(clip.x, clip.y, clip.width, clip.height); + g2.setPaint(Color.red); + g2.fill(a1); + g2.setPaint(Color.yellow); + g2.fill(a2); + g2.setPaint(Color.blue); + g2.fill(a3); + } + + @Override + public void paint(Graphics g) { + if (bufferedImage == null) { + bufferedImage = createImage(300, 100); + Graphics big = bufferedImage.getGraphics(); + // Notice that if you remove the translate() call, it works fine. + big.translate(-1, -1); + big.setClip(1, 1, 300, 100); + paintRects((Graphics2D)big); + big.translate(1, 1); + } + paintRects((Graphics2D)g); + g.drawImage(bufferedImage, 1, 100, this); + g.setColor(Color.black); + g.drawString("From offscreen image (with translate):", 10, 95); + g.drawString(" (should line up with rectangles above)", 10, 110); + } +} diff --git a/test/jdk/java/awt/image/BufferedImage/GrayAATextTest.java b/test/jdk/java/awt/image/BufferedImage/GrayAATextTest.java new file mode 100644 index 000000000000..a484dd392eb0 --- /dev/null +++ b/test/jdk/java/awt/image/BufferedImage/GrayAATextTest.java @@ -0,0 +1,104 @@ +/* + * Copyright (c) 2000, 2024, 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 4309915 + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @summary Check that Antialiased text drawn on a BYTE_GRAY image + * resolves the color correctly + * @run main/manual GrayAATextTest + */ + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.Panel; +import java.awt.RenderingHints; +import java.awt.image.BufferedImage; + +public class GrayAATextTest extends Panel { + + public static final int WIDTH = 600; + public static final int HEIGHT = 200; + + private static final String INSTRUCTIONS = """ + All of the strings in a given column should be drawn + in the same color. If the bug is present, then the + Antialiased strings will all be of a fixed color that + is not the same as the other strings in their column."""; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("GrayAATextTest Instructions") + .instructions(INSTRUCTIONS) + .rows((int)INSTRUCTIONS.lines().count() + 2) + .columns(35) + .testUI(GrayAATextTest::createTestUI) + .build() + .awaitAndCheck(); + } + + public void paint(Graphics g) { + BufferedImage bi = new BufferedImage(WIDTH, HEIGHT, + BufferedImage.TYPE_BYTE_GRAY); + Graphics2D g2d = bi.createGraphics(); + g2d.setFont(new Font("Helvetica", Font.PLAIN, 24)); + g2d.setColor(Color.white); + g2d.fillRect(0, 0, WIDTH / 2, HEIGHT); + drawText(g2d, Color.black, "Black", 25); + drawText(g2d, Color.lightGray, "Light Gray", 175); + g2d.setColor(Color.black); + g2d.fillRect(WIDTH / 2, 0, WIDTH / 2, HEIGHT); + drawText(g2d, Color.white, "White", 325); + drawText(g2d, Color.lightGray, "Light Gray", 475); + g2d.dispose(); + g.drawImage(bi, 0, 0, null); + } + + public void drawText(Graphics2D g2d, Color c, String colorname, int x) { + g2d.setColor(c); + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, + RenderingHints.VALUE_ANTIALIAS_OFF); + g2d.drawString(colorname, x, 50); + g2d.drawString("Aliased", x, 100); + g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, + RenderingHints.VALUE_ANTIALIAS_ON); + g2d.drawString("Antialiased", x, 150); + } + + public Dimension getPreferredSize() { + return new Dimension(WIDTH, HEIGHT); + } + + private static Frame createTestUI() { + Frame f = new Frame("GrayAATextTest Frame"); + f.add(new GrayAATextTest()); + f.setSize(WIDTH, HEIGHT); + return f; + } +} diff --git a/test/jdk/java/awt/image/GrayAlpha.java b/test/jdk/java/awt/image/GrayAlpha.java new file mode 100644 index 000000000000..cf477c263850 --- /dev/null +++ b/test/jdk/java/awt/image/GrayAlpha.java @@ -0,0 +1,175 @@ +/* + * Copyright (c) 2003, 2024, 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 4243044 + * @summary This test should show two windows filled with checker + * board pattern. The transparency should runs from left to right from + * total transparent to total opaque. + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual GrayAlpha + */ + +import java.util.List; +import java.awt.Frame; +import java.awt.color.ColorSpace; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.geom.AffineTransform; +import java.awt.image.BufferedImage; +import java.awt.image.ColorModel; +import java.awt.image.ComponentColorModel; +import java.awt.image.DataBuffer; +import java.awt.image.Raster; +import java.awt.image.WritableRaster; +import java.awt.Point; +import java.awt.Panel; +import java.awt.Transparency; +import java.awt.Window; + +public class GrayAlpha extends Panel { + + private static final String INSTRUCTIONS = """ + This test should show two windows filled with checker board + vpattern. The transparency should runs from left to right from + totally transparent to totally opaque. If either the pattern or + the transparency is not shown correctly, click Fail, otherwise + click Pass."""; + + BufferedImage bi; + AffineTransform identityTransform = new AffineTransform(); + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("GrayAlpha Instructions") + .instructions(INSTRUCTIONS) + .rows((int)INSTRUCTIONS.lines().count() + 2) + .columns(35) + .testUI(GrayAlpha::createTestUI) + .build() + .awaitAndCheck(); + } + + + public GrayAlpha(int width, int height, + boolean hasAlpha, boolean isAlphaPremultiplied, + boolean useRGB) { + boolean isAlphaPremuliplied = true; + int bands = useRGB ? 3 : 1; + bands = hasAlpha ? bands + 1 : bands; + + ColorSpace cs = useRGB ? + ColorSpace.getInstance(ColorSpace.CS_sRGB) : + ColorSpace.getInstance(ColorSpace.CS_GRAY); + int transparency = hasAlpha ? + Transparency.TRANSLUCENT : Transparency.OPAQUE; + int[] bits = new int[bands]; + for (int i = 0; i < bands; i++) { + bits[i] = 8; + } + + ColorModel cm = new ComponentColorModel(cs, + bits, + hasAlpha, + isAlphaPremultiplied, + transparency, + DataBuffer.TYPE_BYTE); + WritableRaster wr = + Raster.createInterleavedRaster(DataBuffer.TYPE_BYTE, + width, height, bands, + new Point(0, 0)); + + for (int b = 0; b < bands; b++) { + for (int y = 0; y < height; y++) { + for (int x = 0; x < width; x++) { + int s; + + if (b != bands - 1 || !hasAlpha) { + // Gray band(s), fill with a checkerboard pattern + if (((x / 10) % 2) == ((y / 10) % 2)) { + s = 255; + } else { + s = 0; + } + if (isAlphaPremultiplied) { + int alpha = (x*255)/(width - 1); + s = (s*alpha)/255; + } + } else { + // Alpha band, increase opacity left to right + s = (x*255)/(width - 1); + } + + wr.setSample(x, y, b, s); + } + } + } + + this.bi = new BufferedImage(cm, wr, isAlphaPremultiplied, null); + } + + public Dimension getPreferredSize() { + return new Dimension(bi.getWidth(), bi.getHeight()); + } + + public void paint(Graphics g) { + if (bi != null) { + ((Graphics2D)g).drawImage(bi, 0, 0, null); + } + } + + public static Frame makeFrame(String title, + int x, int y, int width, int height, + boolean hasAlpha, + boolean isAlphaPremultiplied, + boolean useRGB) { + Frame f = new Frame(title); + f.add(new GrayAlpha(width, height, + hasAlpha, isAlphaPremultiplied, useRGB)); + f.pack(); + f.setLocation(x, y); + return f; + } + + private static List createTestUI() { + int width = 200; + int height = 200; + + int x = 100; + int y = 100; + + Frame f1 = makeFrame("Gray (non-premultiplied)", + x, y, width, height, + true, false, false); + x += width + 20; + + Frame f2 = makeFrame("Gray (premultiplied)", + x, y, width, height, + true, true, false); + + return List.of(f1, f2); + } +} diff --git a/test/jdk/java/awt/image/ImageOffsetTest.java b/test/jdk/java/awt/image/ImageOffsetTest.java new file mode 100644 index 000000000000..c1d4c3931de9 --- /dev/null +++ b/test/jdk/java/awt/image/ImageOffsetTest.java @@ -0,0 +1,123 @@ +/* + * Copyright (c) 2000, 2024, 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 4259548 + * @summary tests that MemoryImageSource correctly handles images with offsets + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual ImageOffsetTest + */ + +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Image; +import java.awt.Panel; +import java.awt.Toolkit; +import java.awt.image.ColorModel; +import java.awt.image.IndexColorModel; +import java.awt.image.MemoryImageSource; + +public class ImageOffsetTest { + + static int height = 100; + static int width = 100; + static int levels = 3; + static IndexColorModel cm; + static Image image; + static boolean first = true; + + static byte[] db = new byte[height * width * levels] ; + + private static final String INSTRUCTIONS = """ + If on the appeared 'Test frame' all color squares are of one color + test failed, otherwise it's passed."""; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("ImageOffsetTest") + .instructions(INSTRUCTIONS) + .rows((int) INSTRUCTIONS.lines().count() + 2) + .columns(35) + .testUI(ImageOffsetTest::createUI) + .build() + .awaitAndCheck(); + } + + private static Frame createUI() { + Frame frame = new Frame("ImageOffset Frame"); + frame.add(new Panel() { + public void paint(Graphics g) { + for ( int i=0 ; i<3 ; i++ ) { + g.drawImage( + generateBuggyImage(i * width * height), 10 + i * 110, 10, null); + } + } + }); + frame.setSize(400, 200); + frame.setLocation(300, 200); + createColorModel(); + int l = 0; + for (int k = 0; k < levels; k++) { + for (int i = 0; i < height; i++) { + for (int j = 0; j < width; j++) { + if( k == 0) { + db[l] = (byte)(70 & 0xff) ; + } + if (k == 1) { + db[l] = (byte)(150 & 0xff) ; + } + if (k == 2) { + db[l] = (byte)(230 & 0xff) ; + } + l++ ; + } + } + } + return frame; + } + + private static void createColorModel() { + byte[] red = new byte[256]; + byte[] green = new byte[256]; + byte[] blue = new byte[256]; + + for (int i = 0; i < 256; i++) { + red[i] = (byte)(i & 0xff); + //green[i] = (byte)( i & 0xff ) ; + blue[i] = (byte)( i & 0xff ) ; + //commented out green so I could get purple + } + + cm = new IndexColorModel( 8, 256, red, green, blue ) ; + } + + private static Image generateBuggyImage(int offset) { + // Initialize the database, Three slices, different shades of grey + // Here the image is created using the offset, + return Toolkit.getDefaultToolkit().createImage( + new MemoryImageSource(width, height, (ColorModel)cm, + db, offset, width)); + } +} diff --git a/test/jdk/java/awt/image/TransformImage.java b/test/jdk/java/awt/image/TransformImage.java new file mode 100644 index 000000000000..30af3d27f55c --- /dev/null +++ b/test/jdk/java/awt/image/TransformImage.java @@ -0,0 +1,111 @@ +/* + * Copyright (c) 1999, 2024, 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 4090743 + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @summary Make sure that there is no garbage drawn on the rotated image + * @run main/manual TransformImage + */ + +import java.net.URL; +import java.net.MalformedURLException; +import java.awt.Canvas; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.geom.AffineTransform; +import java.awt.Image; +import java.awt.image.ImageObserver; +import java.awt.MediaTracker; +import java.awt.Toolkit; + +public class TransformImage extends Canvas { + static Image image; + + private static final String INSTRUCTIONS = """ + The rotated image should be drawn without garbage."""; + + public static void main(String[] argv) throws Exception { + PassFailJFrame.builder() + .title("TransformImage Instructions") + .instructions(INSTRUCTIONS) + .rows(5) + .columns(35) + .testUI(TransformImage::createTestUI) + .build() + .awaitAndCheck(); + } + + private static Frame createTestUI() { + Frame f = new Frame(); + String dir = System.getProperty("test.src"); + String sep = System.getProperty("file.separator"); + if (dir == null) { + dir = "."; + } + image = Toolkit.getDefaultToolkit().getImage(dir+sep+"duke.gif"); + f.add(new TransformImage()); + + f.pack(); + return f; + } + + public Dimension getPreferredSize() { + return new Dimension (256, 256); + } + + public Dimension getMinimumSize() { + return getPreferredSize(); + } + + public void paint(Graphics g) { + int w, h; + java.awt.Graphics2D g2d = (Graphics2D) g; + AffineTransform at = new AffineTransform(); + + MediaTracker mt = new MediaTracker(this); + mt.addImage(image, 0); + try { + mt.waitForAll(); + } catch (InterruptedException e) { + System.err.println("can't track"); + return; + } + w = image.getWidth(this); + h = image.getHeight(this); + g2d.drawImage(image, 0, 0, this); + g2d.drawRect(0, 0, w, h); + + double rad = .5; + at.rotate(-rad); + g2d.setTransform(at); + g2d.drawImage(image, 0, 100, this); + g2d.drawRect(0, 100, w, h); + } +} diff --git a/test/jdk/java/awt/image/duke.gif b/test/jdk/java/awt/image/duke.gif new file mode 100644 index 000000000000..ed32e0ff79b0 Binary files /dev/null and b/test/jdk/java/awt/image/duke.gif differ diff --git a/test/jdk/java/awt/print/Dialog/PaperSizeError.java b/test/jdk/java/awt/print/Dialog/PaperSizeError.java index fea7bb85af87..18f33704a061 100644 --- a/test/jdk/java/awt/print/Dialog/PaperSizeError.java +++ b/test/jdk/java/awt/print/Dialog/PaperSizeError.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, 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,16 +23,22 @@ /** * @test - * @bug 6360339 + * @bug 6360339 8343224 * @key printer * @summary Test for fp error in paper size calculations. * @run main/manual PaperSizeError */ -import java.awt.print.*; -import javax.print.*; -import javax.print.attribute.*; -import javax.print.attribute.standard.*; +import javax.print.PrintService; +import javax.print.attribute.HashPrintRequestAttributeSet; +import javax.print.attribute.PrintRequestAttributeSet; +import javax.print.attribute.Size2DSyntax; +import javax.print.attribute.standard.MediaSize; +import javax.print.attribute.standard.MediaSizeName; +import javax.print.attribute.standard.OrientationRequested; +import java.awt.print.PageFormat; +import java.awt.print.Paper; +import java.awt.print.PrinterJob; public class PaperSizeError { diff --git a/test/jdk/java/awt/print/Dialog/PrintDlgPageable.java b/test/jdk/java/awt/print/Dialog/PrintDlgPageable.java index eadd3cf9cb6b..ba13ea968254 100644 --- a/test/jdk/java/awt/print/Dialog/PrintDlgPageable.java +++ b/test/jdk/java/awt/print/Dialog/PrintDlgPageable.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2007, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,105 +25,98 @@ * @test * @bug 4869502 4869539 * @key printer - * @summary Confirm that ToPage is populated for argument =2. Range is disabled for argument = 0. - * @run main/manual PrintDlgPageable + * @summary Confirm that ToPage is populated for argument = 2. Range is disabled for argument = 0. + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual PrintDlgPageable 0 + * @run main/manual PrintDlgPageable 2 */ -import java.awt.*; -import java.awt.print.*; -import java.util.Locale; -import javax.print.*; +import java.awt.Color; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.print.PageFormat; +import java.awt.print.Pageable; +import java.awt.print.Printable; +import java.awt.print.PrinterJob; +import java.awt.print.PrinterException; + +public class PrintDlgPageable implements Printable { -class PrintDlgPageable implements Printable { public static int arg; - /** - * Constructor - */ - public PrintDlgPageable() { - super(); + public PrintDlgPageable() { + super(); + } + + public static void main(String[] args) throws Exception { + if (args.length < 1) { + System.out.println("usage: java PrintDlgPageable { 0 | 2}"); + return; } - /** - * Starts the application. - */ - public static void main(java.lang.String[] args) { - if (args.length < 1) { - System.out.println("usage: java PrintDlgPageable { 0 | 2}"); - return; - } - arg = Integer.parseInt(args[0]); - PrintDlgPageable pd = new PrintDlgPageable(); - PrinterJob pj = PrinterJob.getPrinterJob(); - PageableHandler handler = new PageableHandler(); - pj.setPageable(handler); - - System.out.println("open PrintDialog.."); - if (pj.printDialog()) { - try { - System.out.println("About to print the data ..."); - pj.print(); - System.out.println("Printed"); - } - catch (PrinterException pe) { - pe.printStackTrace(); - } - } + arg = Integer.parseInt(args[0]); + String INSTRUCTIONS = " A pagedialog will be shown."; + + if (arg == 0) { + INSTRUCTIONS += "\n Confirm that page range is disabled."; + } else if (arg == 2) { + INSTRUCTIONS += "\n Confirm ToPage is populated with pagerange 2"; } + INSTRUCTIONS += "\nCancel the print dialog. Press PASS if it so seen else press FAIL."; + + PrinterJob pj = PrinterJob.getPrinterJob(); + PageableHandler handler = new PageableHandler(); + pj.setPageable(handler); + + PassFailJFrame passFailJFrame = PassFailJFrame.builder() + .title("Instructions") + .instructions(INSTRUCTIONS) + .columns(35) + .build(); - //printable interface - public int print(Graphics g, PageFormat pf, int pi) throws -PrinterException { - - /*if (pi > 0) { - System.out.println("pi is greater than 0"); - return Printable.NO_SUCH_PAGE; - }*/ - // Simply draw two rectangles - Graphics2D g2 = (Graphics2D)g; - g2.setColor(Color.black); - g2.translate(pf.getImageableX(), pf.getImageableY()); - g2.drawRect(1,1,200,300); - g2.drawRect(1,1,25,25); - System.out.println("print method called "+pi + " Orientation "+pf.getOrientation()); - return Printable.PAGE_EXISTS; + if (pj.printDialog()) { + try { + pj.print(); + } catch (PrinterException pe) { + pe.printStackTrace(); + } } + passFailJFrame.awaitAndCheck(); + } + + //printable interface + public int print(Graphics g, PageFormat pf, int pi) throws PrinterException { + + // Simply draw two rectangles + Graphics2D g2 = (Graphics2D) g; + g2.setColor(Color.black); + g2.translate(pf.getImageableX(), pf.getImageableY()); + g2.drawRect(1, 1, 200, 300); + g2.drawRect(1, 1, 25, 25); + return Printable.PAGE_EXISTS; + } } class PageableHandler implements Pageable { - PageFormat pf = new PageFormat(); + PageFormat pf = new PageFormat(); - public int getNumberOfPages() { - return PrintDlgPageable.arg; - //return 0; - } + public int getNumberOfPages() { + return PrintDlgPageable.arg; + } - public Printable getPrintable(int pageIndex) { - return new PrintDlgPageable(); - } + public Printable getPrintable(int pageIndex) { + return new PrintDlgPageable(); + } - public PageFormat getPageFormat(int pageIndex) { - System.out.println("getPageFormat called "+pageIndex); - if (pageIndex == 0) { - pf.setOrientation(PageFormat.PORTRAIT); - System.out.println("Orientation returned from Pageable "+findOrientation(pf.getOrientation())); - return pf; - } else { - pf.setOrientation(PageFormat.LANDSCAPE); - System.out.println("Orientation returned from Pageable "+findOrientation(pf.getOrientation())); - return pf; - } + public PageFormat getPageFormat(int pageIndex) { + if (pageIndex == 0) { + pf.setOrientation(PageFormat.PORTRAIT); + return pf; + } else { + pf.setOrientation(PageFormat.LANDSCAPE); + return pf; } + } - public String findOrientation(int orient) { - if (orient == PageFormat.LANDSCAPE) { - return "LANDSCAPE"; - }else if (orient == PageFormat.PORTRAIT) { - return "PORTRAIT"; - } else if (orient == PageFormat.REVERSE_LANDSCAPE) { - return "REVERSE LANDSCAPE"; - } else { - return null; - } - } } diff --git a/test/jdk/java/awt/regtesthelpers/PassFailJFrame.java b/test/jdk/java/awt/regtesthelpers/PassFailJFrame.java index 1426b97e3ca6..5b825bb4c37c 100644 --- a/test/jdk/java/awt/regtesthelpers/PassFailJFrame.java +++ b/test/jdk/java/awt/regtesthelpers/PassFailJFrame.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, 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 @@ -359,7 +359,7 @@ public enum Position {HORIZONTAL, VERTICAL, TOP_LEFT_CORNER} * the default values of {@value #ROWS} and {@value #COLUMNS} * for rows and columns. *

    - * See {@link #PassFailJFrame(String,String,long,int,int,boolean)} for + * See {@link #PassFailJFrame(String,String,long,int,int)} for * more details. * * @param instructions the instructions for the tester @@ -382,7 +382,7 @@ public PassFailJFrame(String instructions) * and the default values of {@value #ROWS} and {@value #COLUMNS} * for rows and columns. *

    - * See {@link #PassFailJFrame(String,String,long,int,int,boolean)} for + * See {@link #PassFailJFrame(String,String,long,int,int)} for * more details. * * @param instructions the instructions for the tester @@ -404,9 +404,8 @@ public PassFailJFrame(String instructions, long testTimeOut) * with the given title, instructions and timeout as well as * the default values of {@value #ROWS} and {@value #COLUMNS} * for rows and columns. - * The screenshot feature is not enabled, if you use this constructor. *

    - * See {@link #PassFailJFrame(String,String,long,int,int,boolean)} for + * See {@link #PassFailJFrame(String,String,long,int,int)} for * more details. * * @param title the title of the instruction frame @@ -424,41 +423,11 @@ public PassFailJFrame(String title, String instructions, this(title, instructions, testTimeOut, ROWS, COLUMNS); } - /** - * Constructs a frame which displays test instructions and - * the Pass / Fail buttons - * with the given title, instructions, timeout, number of rows and columns. - * The screenshot feature is not enabled, if you use this constructor. - *

    - * See {@link #PassFailJFrame(String,String,long,int,int,boolean)} for - * more details. - * - * @param title the title of the instruction frame - * @param instructions the instructions for the tester - * @param testTimeOut the test timeout in minutes - * @param rows the number of rows for the text component - * which displays test instructions - * @param columns the number of columns for the text component - * which displays test instructions - * - * @throws InterruptedException if the current thread is interrupted - * while waiting for EDT to finish creating UI components - * @throws InvocationTargetException if an exception is thrown while - * creating UI components on EDT - */ - public PassFailJFrame(String title, String instructions, - long testTimeOut, - int rows, int columns) - throws InterruptedException, InvocationTargetException { - this(title, instructions, testTimeOut, rows, columns, false); - } - /** * Constructs a frame which displays test instructions and * the Pass / Fail buttons * as well as supporting UI components with the given title, instructions, - * timeout, number of rows and columns, - * and screen capture functionality. + * timeout, number of rows and columns. * All the UI components are created on the EDT, so it is safe to call * the constructor on the main thread. *

    @@ -483,12 +452,6 @@ public PassFailJFrame(String title, String instructions, * the size of a text component which displays the instructions. * The preferred size of the instructions is calculated by * creating {@code new JTextArea(rows, columns)}. - *

    - * If you enable screenshots by setting the {@code screenCapture} - * parameter to {@code true}, a Screenshot button is added. - * Clicking the Screenshot button takes screenshots of - * all the monitors or all the windows registered with - * {@code PassFailJFrame}. * * @param title the title of the instruction frame * @param instructions the instructions for the tester @@ -497,8 +460,6 @@ public PassFailJFrame(String title, String instructions, * which displays test instructions * @param columns the number of columns for the text component * which displays test instructions - * @param screenCapture if set to {@code true}, enables screen capture - * functionality * * @throws InterruptedException if the current thread is interrupted * while waiting for EDT to finish creating UI components @@ -510,13 +471,11 @@ public PassFailJFrame(String title, String instructions, */ public PassFailJFrame(String title, String instructions, long testTimeOut, - int rows, int columns, - boolean screenCapture) + int rows, int columns) throws InterruptedException, InvocationTargetException { invokeOnEDT(() -> createUI(title, instructions, testTimeOut, - rows, columns, - screenCapture)); + rows, columns)); } /** @@ -613,8 +572,7 @@ private static void invokeOnEDTUncheckedException(Runnable doRun) { } private static void createUI(String title, String instructions, - long testTimeOut, int rows, int columns, - boolean enableScreenCapture) { + long testTimeOut, int rows, int columns) { frame = new JFrame(title); frame.setLayout(new BorderLayout()); @@ -623,7 +581,7 @@ private static void createUI(String title, String instructions, frame.add(createInstructionUIPanel(instructions, testTimeOut, rows, columns, - enableScreenCapture, + false, false, 0), BorderLayout.CENTER); frame.pack(); @@ -675,6 +633,8 @@ private static JComponent createInstructionUIPanel(String instructions, ? configureHTML(instructions, rows, columns) : configurePlainText(instructions, rows, columns); text.setEditable(false); + text.setBorder(createTextBorder()); + text.setCaretPosition(0); JPanel textPanel = new JPanel(new BorderLayout()); textPanel.setBorder(createEmptyBorder(GAP, 0, GAP, 0)); @@ -729,7 +689,6 @@ private static JTextComponent configurePlainText(String instructions, JTextArea text = new JTextArea(instructions, rows, columns); text.setLineWrap(true); text.setWrapStyleWord(true); - text.setBorder(createTextBorder()); return text; } @@ -743,10 +702,10 @@ private static JTextComponent configureHTML(String instructions, HTMLEditorKit kit = (HTMLEditorKit) text.getEditorKit(); StyleSheet styles = kit.getStyleSheet(); - // Reduce the default margins - styles.addRule("ol, ul { margin-left-ltr: 20; margin-left-rtl: 20 }"); - // Make the size of code blocks the same as other text - styles.addRule("code { font-size: inherit }"); + // Reduce the list default margins + styles.addRule("ol, ul { margin-left-ltr: 30; margin-left-rtl: 30 }"); + // Make the size of code (and other elements) the same as other text + styles.addRule("code, kbd, samp, pre { font-size: inherit }"); return text; } @@ -1829,8 +1788,20 @@ public Builder position(Position position) { public PassFailJFrame build() throws InterruptedException, InvocationTargetException { - validate(); - return new PassFailJFrame(this); + try { + validate(); + return new PassFailJFrame(this); + } catch (final Throwable t) { + // Dispose of all the windows, including those that may not + // be registered with PassFailJFrame to allow AWT to shut down + try { + invokeOnEDT(() -> Arrays.stream(Window.getWindows()) + .forEach(Window::dispose)); + } catch (Throwable edt) { + t.addSuppressed(edt); + } + throw t; + } } /** diff --git a/test/jdk/java/foreign/CompositeLookupTest.java b/test/jdk/java/foreign/CompositeLookupTest.java index 48ffdf3d5ffb..8ca49ef7992f 100644 --- a/test/jdk/java/foreign/CompositeLookupTest.java +++ b/test/jdk/java/foreign/CompositeLookupTest.java @@ -1,24 +1,24 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * Copyright (c) 2023, 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 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). + * 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. + * 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. + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. */ import org.testng.annotations.Test; diff --git a/test/jdk/java/foreign/LibraryLookupTest.java b/test/jdk/java/foreign/LibraryLookupTest.java index e64f959fbc9b..8fec4c533715 100644 --- a/test/jdk/java/foreign/LibraryLookupTest.java +++ b/test/jdk/java/foreign/LibraryLookupTest.java @@ -1,24 +1,24 @@ /* - * Copyright (c) 2022, 2023, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * Copyright (c) 2022, 2023, 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 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). + * 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. + * 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. + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. */ import org.testng.annotations.Test; diff --git a/test/jdk/java/foreign/NativeTestHelper.java b/test/jdk/java/foreign/NativeTestHelper.java index 0ea7dfe89f25..a161d687643b 100644 --- a/test/jdk/java/foreign/NativeTestHelper.java +++ b/test/jdk/java/foreign/NativeTestHelper.java @@ -1,25 +1,24 @@ /* - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * Copyright (c) 2020, 2023, 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 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). + * 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. + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. */ import java.lang.foreign.AddressLayout; diff --git a/test/jdk/java/foreign/SafeFunctionAccessTest.java b/test/jdk/java/foreign/SafeFunctionAccessTest.java index 0b806c3c2090..139c3b3a26bd 100644 --- a/test/jdk/java/foreign/SafeFunctionAccessTest.java +++ b/test/jdk/java/foreign/SafeFunctionAccessTest.java @@ -1,24 +1,24 @@ /* - * Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * Copyright (c) 2021, 2023, 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 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). + * 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. + * 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. + * 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. */ /* diff --git a/test/jdk/java/foreign/TestAddressDereference.java b/test/jdk/java/foreign/TestAddressDereference.java index 934537a86f12..8756afce29e6 100644 --- a/test/jdk/java/foreign/TestAddressDereference.java +++ b/test/jdk/java/foreign/TestAddressDereference.java @@ -1,24 +1,24 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * Copyright (c) 2023, 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 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). + * 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. + * 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. + * 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. */ /* diff --git a/test/jdk/java/foreign/TestDowncallBase.java b/test/jdk/java/foreign/TestDowncallBase.java index de230e8cfac6..ace8867000f0 100644 --- a/test/jdk/java/foreign/TestDowncallBase.java +++ b/test/jdk/java/foreign/TestDowncallBase.java @@ -1,25 +1,24 @@ /* - * Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * Copyright (c) 2020, 2022, 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 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). + * 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. + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. */ import java.lang.foreign.Arena; diff --git a/test/jdk/java/foreign/TestFallbackLookup.java b/test/jdk/java/foreign/TestFallbackLookup.java index 99207383d756..c284222f006b 100644 --- a/test/jdk/java/foreign/TestFallbackLookup.java +++ b/test/jdk/java/foreign/TestFallbackLookup.java @@ -1,24 +1,24 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * Copyright (c) 2022, 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 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). + * 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. + * 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. + * 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. */ /* diff --git a/test/jdk/java/foreign/TestFree.java b/test/jdk/java/foreign/TestFree.java index a61499a2194f..8ec2611b2715 100644 --- a/test/jdk/java/foreign/TestFree.java +++ b/test/jdk/java/foreign/TestFree.java @@ -1,25 +1,24 @@ /* - * Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * Copyright (c) 2020, 2022, 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 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). + * 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. * - * 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. + * 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. */ /* diff --git a/test/jdk/java/foreign/TestFunctionDescriptor.java b/test/jdk/java/foreign/TestFunctionDescriptor.java index 54b212df4723..62cb31b1d5d1 100644 --- a/test/jdk/java/foreign/TestFunctionDescriptor.java +++ b/test/jdk/java/foreign/TestFunctionDescriptor.java @@ -1,25 +1,24 @@ /* - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * Copyright (c) 2020, 2023, 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 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). + * 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. + * 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. */ /* diff --git a/test/jdk/java/foreign/TestHFA.java b/test/jdk/java/foreign/TestHFA.java index 95623edfebed..00aa328f1ce1 100644 --- a/test/jdk/java/foreign/TestHFA.java +++ b/test/jdk/java/foreign/TestHFA.java @@ -5,9 +5,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/foreign/TestHeapAlignment.java b/test/jdk/java/foreign/TestHeapAlignment.java index abe22fb59233..60805d510635 100644 --- a/test/jdk/java/foreign/TestHeapAlignment.java +++ b/test/jdk/java/foreign/TestHeapAlignment.java @@ -1,25 +1,24 @@ /* - * Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * Copyright (c) 2021, 2023, 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 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). + * 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. + * 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. */ /* diff --git a/test/jdk/java/foreign/TestIllegalLink.java b/test/jdk/java/foreign/TestIllegalLink.java index 5d8277a5d4cb..b898ad09a499 100644 --- a/test/jdk/java/foreign/TestIllegalLink.java +++ b/test/jdk/java/foreign/TestIllegalLink.java @@ -1,25 +1,24 @@ /* - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * Copyright (c) 2020, 2023, 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 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). + * 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. + * 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. */ /* diff --git a/test/jdk/java/foreign/TestIntrinsics.java b/test/jdk/java/foreign/TestIntrinsics.java index 95f98b50e7e0..49052d5f7a1f 100644 --- a/test/jdk/java/foreign/TestIntrinsics.java +++ b/test/jdk/java/foreign/TestIntrinsics.java @@ -1,24 +1,24 @@ /* - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * Copyright (c) 2020, 2023, 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 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). + * 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. + * 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. + * 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. */ /* diff --git a/test/jdk/java/foreign/TestLayouts.java b/test/jdk/java/foreign/TestLayouts.java index d062d1f55c1b..0cabcdac5538 100644 --- a/test/jdk/java/foreign/TestLayouts.java +++ b/test/jdk/java/foreign/TestLayouts.java @@ -1,24 +1,24 @@ /* - * Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * Copyright (c) 2019, 2023, 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 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). + * 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. + * 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. + * 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. */ /* diff --git a/test/jdk/java/foreign/TestMemoryAccess.java b/test/jdk/java/foreign/TestMemoryAccess.java index 135f96476f3f..2260e903d24d 100644 --- a/test/jdk/java/foreign/TestMemoryAccess.java +++ b/test/jdk/java/foreign/TestMemoryAccess.java @@ -1,24 +1,24 @@ /* - * Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * Copyright (c) 2019, 2023, 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 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). + * 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. + * 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. + * 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. */ /* diff --git a/test/jdk/java/foreign/TestMemoryAccessInstance.java b/test/jdk/java/foreign/TestMemoryAccessInstance.java index 73a2df898e45..f549a6117f6b 100644 --- a/test/jdk/java/foreign/TestMemoryAccessInstance.java +++ b/test/jdk/java/foreign/TestMemoryAccessInstance.java @@ -1,24 +1,24 @@ /* - * Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * Copyright (c) 2021, 2023, 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 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). + * 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. + * 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. + * 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. */ /* diff --git a/test/jdk/java/foreign/TestMemoryAlignment.java b/test/jdk/java/foreign/TestMemoryAlignment.java index 43623b392a77..b6001284750e 100644 --- a/test/jdk/java/foreign/TestMemoryAlignment.java +++ b/test/jdk/java/foreign/TestMemoryAlignment.java @@ -1,24 +1,24 @@ /* - * Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * Copyright (c) 2019, 2023, 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 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). + * 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. + * 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. + * 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. */ /* diff --git a/test/jdk/java/foreign/TestMemoryDereference.java b/test/jdk/java/foreign/TestMemoryDereference.java index 13dd26ce749d..08172b87a4f9 100644 --- a/test/jdk/java/foreign/TestMemoryDereference.java +++ b/test/jdk/java/foreign/TestMemoryDereference.java @@ -1,24 +1,24 @@ /* - * Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * Copyright (c) 2020, 2022, 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 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). + * 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. + * 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. + * 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. */ /* diff --git a/test/jdk/java/foreign/TestMismatch.java b/test/jdk/java/foreign/TestMismatch.java index a33eab9a7fa5..3c22495ddd15 100644 --- a/test/jdk/java/foreign/TestMismatch.java +++ b/test/jdk/java/foreign/TestMismatch.java @@ -2,23 +2,23 @@ * Copyright (c) 2020, 2024, 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 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). + * 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. + * 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. + * 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. */ /* diff --git a/test/jdk/java/foreign/TestNULLAddress.java b/test/jdk/java/foreign/TestNULLAddress.java index 8a83f4213900..170ec8ba3511 100644 --- a/test/jdk/java/foreign/TestNULLAddress.java +++ b/test/jdk/java/foreign/TestNULLAddress.java @@ -1,24 +1,24 @@ /* - * Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * Copyright (c) 2021, 2023, 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 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). + * 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. + * 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. + * 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. */ /* diff --git a/test/jdk/java/foreign/TestNulls.java b/test/jdk/java/foreign/TestNulls.java index d3582a0e04b8..0e1d13c15867 100644 --- a/test/jdk/java/foreign/TestNulls.java +++ b/test/jdk/java/foreign/TestNulls.java @@ -1,24 +1,24 @@ /* - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * Copyright (c) 2020, 2023, 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 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). + * 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. + * 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. + * 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. */ /* diff --git a/test/jdk/java/foreign/TestScopedOperations.java b/test/jdk/java/foreign/TestScopedOperations.java index ea3dc0262673..bef037ff2c06 100644 --- a/test/jdk/java/foreign/TestScopedOperations.java +++ b/test/jdk/java/foreign/TestScopedOperations.java @@ -1,24 +1,24 @@ /* - * Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * Copyright (c) 2021, 2023, 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 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). + * 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. + * 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. + * 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. */ /* diff --git a/test/jdk/java/foreign/TestSegmentOffset.java b/test/jdk/java/foreign/TestSegmentOffset.java index 9f61f1c35115..f5baa6bc82ce 100644 --- a/test/jdk/java/foreign/TestSegmentOffset.java +++ b/test/jdk/java/foreign/TestSegmentOffset.java @@ -1,24 +1,24 @@ /* - * Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * Copyright (c) 2021, 2023, 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 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). + * 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. + * 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. + * 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. */ /* diff --git a/test/jdk/java/foreign/TestSegmentOverlap.java b/test/jdk/java/foreign/TestSegmentOverlap.java index 8832ffd1a465..da327e3afedf 100644 --- a/test/jdk/java/foreign/TestSegmentOverlap.java +++ b/test/jdk/java/foreign/TestSegmentOverlap.java @@ -1,24 +1,24 @@ /* - * Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * Copyright (c) 2021, 2023, 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 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). + * 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. + * 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. + * 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. */ /* diff --git a/test/jdk/java/foreign/TestSegments.java b/test/jdk/java/foreign/TestSegments.java index 3775d8eb5255..b2cd0d5557a4 100644 --- a/test/jdk/java/foreign/TestSegments.java +++ b/test/jdk/java/foreign/TestSegments.java @@ -1,24 +1,24 @@ /* - * Copyright (c) 2019, 2023, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * Copyright (c) 2019, 2023, 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 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). + * 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. + * 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. + * 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. */ /* diff --git a/test/jdk/java/foreign/TestValueLayouts.java b/test/jdk/java/foreign/TestValueLayouts.java index b39a025fd5f8..97d6273297db 100644 --- a/test/jdk/java/foreign/TestValueLayouts.java +++ b/test/jdk/java/foreign/TestValueLayouts.java @@ -1,24 +1,24 @@ /* - * Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * Copyright (c) 2019, 2022, 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 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). + * 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. + * 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. + * 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. */ /* diff --git a/test/jdk/java/foreign/callarranger/platform/PlatformLayouts.java b/test/jdk/java/foreign/callarranger/platform/PlatformLayouts.java index 97856075befd..48ca23befef2 100644 --- a/test/jdk/java/foreign/callarranger/platform/PlatformLayouts.java +++ b/test/jdk/java/foreign/callarranger/platform/PlatformLayouts.java @@ -1,28 +1,26 @@ /* - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * Copyright (c) 2020, 2023, 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 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). + * 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. + * 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 platform; import jdk.internal.foreign.abi.SharedUtils; diff --git a/test/jdk/java/foreign/enablenativeaccess/org/openjdk/foreigntest/libLinkerInvokerUnnamed.cpp b/test/jdk/java/foreign/enablenativeaccess/org/openjdk/foreigntest/libLinkerInvokerUnnamed.cpp index 42f6a910df5a..5d17c05867a6 100644 --- a/test/jdk/java/foreign/enablenativeaccess/org/openjdk/foreigntest/libLinkerInvokerUnnamed.cpp +++ b/test/jdk/java/foreign/enablenativeaccess/org/openjdk/foreigntest/libLinkerInvokerUnnamed.cpp @@ -1,34 +1,33 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * Copyright (c) 2022, 2024, 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 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). + * 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. + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. */ #include "jni.h" -#include "testlib_threads.h" +#include "testlib_threads.hpp" void call(void* ctxt) { JavaVM* jvm = (JavaVM*) ctxt; JNIEnv* env; - jvm->AttachCurrentThread((void**)&env, NULL); + jvm->AttachCurrentThread((void**)&env, nullptr); jclass linkerClass = env->FindClass("java/lang/foreign/Linker"); jmethodID nativeLinkerMethod = env->GetStaticMethodID(linkerClass, "nativeLinker", "()Ljava/lang/foreign/Linker;"); env->CallStaticVoidMethod(linkerClass, nativeLinkerMethod); diff --git a/test/jdk/java/foreign/enablenativeaccess/panama_module/org/openjdk/foreigntest/libLinkerInvokerModule.cpp b/test/jdk/java/foreign/enablenativeaccess/panama_module/org/openjdk/foreigntest/libLinkerInvokerModule.cpp index 66571b1355d6..6636f93da622 100644 --- a/test/jdk/java/foreign/enablenativeaccess/panama_module/org/openjdk/foreigntest/libLinkerInvokerModule.cpp +++ b/test/jdk/java/foreign/enablenativeaccess/panama_module/org/openjdk/foreigntest/libLinkerInvokerModule.cpp @@ -1,29 +1,28 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * Copyright (c) 2022, 2024, 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 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). + * 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. + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. */ #include "jni.h" -#include "testlib_threads.h" +#include "testlib_threads.hpp" typedef struct { JavaVM* jvm; @@ -35,7 +34,7 @@ typedef struct { void call(void* arg) { Context* context = (Context*)arg; JNIEnv* env; - context->jvm->AttachCurrentThread((void**)&env, NULL); + context->jvm->AttachCurrentThread((void**)&env, nullptr); jclass linkerClass = env->FindClass("java/lang/foreign/Linker"); jmethodID nativeLinkerMethod = env->GetMethodID(linkerClass, "downcallHandle", "(Ljava/lang/foreign/FunctionDescriptor;[Ljava/lang/foreign/Linker$Option;)Ljava/lang/invoke/MethodHandle;"); diff --git a/test/jdk/java/foreign/libAsyncInvokers.cpp b/test/jdk/java/foreign/libAsyncInvokers.cpp index e7d48cbfbcaf..a2ac3b07a587 100644 --- a/test/jdk/java/foreign/libAsyncInvokers.cpp +++ b/test/jdk/java/foreign/libAsyncInvokers.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,7 @@ * questions. */ -#include "testlib_threads.h" +#include "testlib_threads.hpp" #include "shared.h" diff --git a/test/jdk/java/foreign/libLibraryLookup.c b/test/jdk/java/foreign/libLibraryLookup.c index a5375da3026a..dd575f52b962 100644 --- a/test/jdk/java/foreign/libLibraryLookup.c +++ b/test/jdk/java/foreign/libLibraryLookup.c @@ -1,25 +1,24 @@ /* - * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * Copyright (c) 2022, 2024, 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 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). + * 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. + * 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 "export.h" diff --git a/test/jdk/java/foreign/libLookupTest.c b/test/jdk/java/foreign/libLookupTest.c index 5ad75a885ddd..055cae5e23ee 100644 --- a/test/jdk/java/foreign/libLookupTest.c +++ b/test/jdk/java/foreign/libLookupTest.c @@ -1,25 +1,24 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * Copyright (c) 2020, 2024, 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 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). + * 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. + * 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 "export.h" diff --git a/test/jdk/java/foreign/libNativeAccess.c b/test/jdk/java/foreign/libNativeAccess.c index a502734842a4..08bca135c702 100644 --- a/test/jdk/java/foreign/libNativeAccess.c +++ b/test/jdk/java/foreign/libNativeAccess.c @@ -1,25 +1,24 @@ /* - * Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * Copyright (c) 2019, 2020, 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 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). + * 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. + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. */ #include "jni.h" diff --git a/test/jdk/java/foreign/libSafeAccess.c b/test/jdk/java/foreign/libSafeAccess.c index 6202ded299aa..f7a0bdb4554c 100644 --- a/test/jdk/java/foreign/libSafeAccess.c +++ b/test/jdk/java/foreign/libSafeAccess.c @@ -1,25 +1,24 @@ /* - * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * Copyright (c) 2021, 2024, 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 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). + * 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. + * 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 "export.h" diff --git a/test/jdk/java/foreign/loaderLookup/TestLoaderLookupJNI.java b/test/jdk/java/foreign/loaderLookup/TestLoaderLookupJNI.java index eb097f0de5f9..5f9d54dddebd 100644 --- a/test/jdk/java/foreign/loaderLookup/TestLoaderLookupJNI.java +++ b/test/jdk/java/foreign/loaderLookup/TestLoaderLookupJNI.java @@ -1,24 +1,24 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * Copyright (c) 2022, 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 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). + * 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. + * 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. + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. */ import org.testng.annotations.Test; diff --git a/test/jdk/java/foreign/loaderLookup/libLoaderLookupInvoker.cpp b/test/jdk/java/foreign/loaderLookup/libLoaderLookupInvoker.cpp index f988d3b1325a..fff6f80239da 100644 --- a/test/jdk/java/foreign/loaderLookup/libLoaderLookupInvoker.cpp +++ b/test/jdk/java/foreign/loaderLookup/libLoaderLookupInvoker.cpp @@ -1,29 +1,28 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * Copyright (c) 2022, 2024, 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 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). + * 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. + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. */ #include "jni.h" -#include "testlib_threads.h" +#include "testlib_threads.hpp" struct Context { JavaVM* jvm; @@ -33,7 +32,7 @@ struct Context { void call(void* ctxt) { Context* context = (Context*) ctxt; JNIEnv* env; - context->jvm->AttachCurrentThread((void**)&env, NULL); + context->jvm->AttachCurrentThread((void**)&env, nullptr); jclass symbolLookupClass = env->FindClass("java/lang/foreign/SymbolLookup"); jmethodID loaderLookupMethod = env->GetStaticMethodID(symbolLookupClass, "loaderLookup", "()Ljava/lang/foreign/SymbolLookup;"); context->res = env->NewGlobalRef(env->CallStaticObjectMethod(symbolLookupClass, loaderLookupMethod)); diff --git a/test/jdk/java/foreign/stackwalk/TestAsyncStackWalk.java b/test/jdk/java/foreign/stackwalk/TestAsyncStackWalk.java index 4a0e02f9d81a..c8e7fd58e3c8 100644 --- a/test/jdk/java/foreign/stackwalk/TestAsyncStackWalk.java +++ b/test/jdk/java/foreign/stackwalk/TestAsyncStackWalk.java @@ -1,24 +1,24 @@ /* - * Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * Copyright (c) 2021, 2023, 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 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). + * 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. + * 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. + * 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. */ /* diff --git a/test/jdk/java/foreign/stackwalk/TestReentrantUpcalls.java b/test/jdk/java/foreign/stackwalk/TestReentrantUpcalls.java index 69d2230c3403..44ed41327655 100644 --- a/test/jdk/java/foreign/stackwalk/TestReentrantUpcalls.java +++ b/test/jdk/java/foreign/stackwalk/TestReentrantUpcalls.java @@ -1,24 +1,24 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * Copyright (c) 2023, 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 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). + * 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. + * 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. + * 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. */ /* diff --git a/test/jdk/java/foreign/stackwalk/TestStackWalk.java b/test/jdk/java/foreign/stackwalk/TestStackWalk.java index 1ee772752111..785a2b49a9df 100644 --- a/test/jdk/java/foreign/stackwalk/TestStackWalk.java +++ b/test/jdk/java/foreign/stackwalk/TestStackWalk.java @@ -1,24 +1,24 @@ /* - * Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * Copyright (c) 2020, 2023, 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 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). + * 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. + * 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. + * 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. */ /* diff --git a/test/jdk/java/foreign/stackwalk/libAsyncStackWalk.cpp b/test/jdk/java/foreign/stackwalk/libAsyncStackWalk.cpp index e94c58bace4c..afde76788690 100644 --- a/test/jdk/java/foreign/stackwalk/libAsyncStackWalk.cpp +++ b/test/jdk/java/foreign/stackwalk/libAsyncStackWalk.cpp @@ -1,29 +1,28 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * Copyright (c) 2021, 2024, 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 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). + * 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. + * 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 "export.h" -#include "testlib_threads.h" +#include "testlib_threads.hpp" typedef void (*CB_t)(void); diff --git a/test/jdk/java/foreign/stackwalk/libReentrantUpcalls.c b/test/jdk/java/foreign/stackwalk/libReentrantUpcalls.c index a7f33cec19c4..250c31256c6f 100644 --- a/test/jdk/java/foreign/stackwalk/libReentrantUpcalls.c +++ b/test/jdk/java/foreign/stackwalk/libReentrantUpcalls.c @@ -1,25 +1,24 @@ /* - * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * Copyright (c) 2023, 2024, 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 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). + * 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. + * 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 "export.h" diff --git a/test/jdk/java/foreign/stackwalk/libStackWalk.c b/test/jdk/java/foreign/stackwalk/libStackWalk.c index fa72254088be..b2b03b50738a 100644 --- a/test/jdk/java/foreign/stackwalk/libStackWalk.c +++ b/test/jdk/java/foreign/stackwalk/libStackWalk.c @@ -1,25 +1,24 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * Copyright (c) 2020, 2024, 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 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). + * 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. + * 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 "export.h" diff --git a/test/jdk/java/foreign/virtual/TestVirtualCalls.java b/test/jdk/java/foreign/virtual/TestVirtualCalls.java index e0daef8c9417..a48b3e932802 100644 --- a/test/jdk/java/foreign/virtual/TestVirtualCalls.java +++ b/test/jdk/java/foreign/virtual/TestVirtualCalls.java @@ -1,24 +1,24 @@ /* - * Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * Copyright (c) 2021, 2022, 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 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). + * 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. + * 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. + * 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. */ /* diff --git a/test/jdk/java/io/File/GetXSpace.java b/test/jdk/java/io/File/GetXSpace.java index 79fd10d45334..37a4f69962f0 100644 --- a/test/jdk/java/io/File/GetXSpace.java +++ b/test/jdk/java/io/File/GetXSpace.java @@ -59,6 +59,8 @@ public class GetXSpace { private static SecurityManager [] sma = { null, new Allow(), new DenyFSA(), new DenyRead() }; + private static final Pattern DF_PATTERN = Pattern.compile("([^\\s]+)\\s+(\\d+)\\s+(\\d+)\\s+(\\d+)\\s+\\d+%\\s+([^\\s].*)\n"); + private static int fail = 0; private static int pass = 0; private static Throwable first; @@ -109,8 +111,17 @@ private static class Space { Space(String name) { this.name = name; long[] sizes = new long[4]; - if (getSpace0(name, sizes)) - System.err.println("WARNING: total space is estimated"); + if (Platform.isWindows() & isCDDrive(name)) { + try { + getCDDriveSpace(name, sizes); + } catch (IOException e) { + e.printStackTrace(); + throw new RuntimeException("can't get CDDrive sizes"); + } + } else { + if (getSpace0(name, sizes)) + System.err.println("WARNING: total space is estimated"); + } this.size = sizes[0]; this.total = sizes[1]; this.free = sizes[2]; @@ -202,7 +213,8 @@ private static void compare(Space s) { out.format("%s (%d):%n", s.name(), s.size()); String fmt = " %-4s total = %12d free = %12d usable = %12d%n"; - out.format(fmt, "getSpace0", s.total(), s.free(), s.available()); + String method = Platform.isWindows() & isCDDrive(s.name()) ? "getCDDriveSpace" : "getSpace0"; + out.format(fmt, method, s.total(), s.free(), s.available()); out.format(fmt, "getXSpace", ts, fs, us); // If the file system can dynamically change size, this check will fail. @@ -405,7 +417,7 @@ private static int testFile(Path dir) { private static int testVolumes() { out.println("--- Testing volumes"); // Find all of the partitions on the machine and verify that the sizes - // returned by File::getXSpace are equivalent to those from getSpace0 + // returned by File::getXSpace are equivalent to those from getSpace0 or getCDDriveSpace ArrayList l; try { l = paths(); @@ -418,17 +430,17 @@ private static int testVolumes() { if (l.size() == 0) throw new RuntimeException("no partitions?"); - for (int i = 0; i < sma.length; i++) { - System.setSecurityManager(sma[i]); - SecurityManager sm = System.getSecurityManager(); - if (sma[i] != null && sm == null) - throw new RuntimeException("Test configuration error " - + " - can't set security manager"); + for (var p : l) { + Space s = new Space(p); + for (int i = 0; i < sma.length; i++) { + System.setSecurityManager(sma[i]); + SecurityManager sm = System.getSecurityManager(); + if (sma[i] != null && sm == null) + throw new RuntimeException("Test configuration error " + + " - can't set security manager"); - out.format("%nSecurityManager = %s%n" , + out.format("%nSecurityManager = %s%n" , (sm == null ? "null" : sm.getClass().getName())); - for (var p : l) { - Space s = new Space(p); if (sm instanceof Deny) { tryCatch(s); } else { @@ -437,10 +449,9 @@ private static int testVolumes() { compareZeroExist(); } } + System.setSecurityManager(null); } - System.setSecurityManager(null); - if (fail != 0) { err.format("%d tests: %d failure(s); first: %s%n", fail + pass, fail, first); @@ -494,4 +505,40 @@ public static void main(String[] args) throws Exception { // size[3] usable space: number of bytes available to the caller // private static native boolean getSpace0(String root, long[] space); + + private static native boolean isCDDrive(String root); + + private static void getCDDriveSpace(String root, long[] sizes) + throws IOException { + String[] cmd = new String[] {"df", "-k", "-P", root}; + Process p = Runtime.getRuntime().exec(cmd); + StringBuilder sb = new StringBuilder(); + + try (BufferedReader in = new BufferedReader(new InputStreamReader(p.getInputStream()))) { + String s; + int i = 0; + while ((s = in.readLine()) != null) { + // skip header + if (i++ == 0) continue; + sb.append(s).append("\n"); + } + } + out.println(sb); + + Matcher m = DF_PATTERN.matcher(sb); + int j = 0; + while (j < sb.length()) { + if (m.find(j)) { + sizes[0] = Long.parseLong(m.group(2)) * 1024; + sizes[1] = Long.parseLong(m.group(3)) * 1024; + sizes[2] = sizes[0] - sizes[1]; + sizes[3] = Long.parseLong(m.group(4)) * 1024; + j = m.end(); + } else { + throw new RuntimeException("unrecognized df output format: " + + "charAt(" + j + ") = '" + + sb.charAt(j) + "'"); + } + } + } } diff --git a/test/jdk/java/io/File/libGetXSpace.c b/test/jdk/java/io/File/libGetXSpace.c index a4e36bd24316..c45aea146910 100644 --- a/test/jdk/java/io/File/libGetXSpace.c +++ b/test/jdk/java/io/File/libGetXSpace.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2024, 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 @@ -159,6 +159,33 @@ Java_GetXSpace_getSpace0 (*env)->SetLongArrayRegion(env, sizes, 0, 4, array); return totalSpaceIsEstimated; } + +JNIEXPORT jboolean JNICALL +Java_GetXSpace_isCDDrive + (JNIEnv *env, jclass cls, jstring root) +{ +#ifdef WINDOWS + const jchar* strchars = (*env)->GetStringChars(env, root, NULL); + if (strchars == NULL) { + JNU_ThrowByNameWithLastError(env, "java/lang/RuntimeException", + "GetStringChars"); + return JNI_FALSE; + } + + LPCWSTR path = (LPCWSTR)strchars; + UINT driveType = GetDriveTypeW(path); + + (*env)->ReleaseStringChars(env, root, strchars); + + if (driveType != DRIVE_CDROM) { + return JNI_FALSE; + } + + return JNI_TRUE; +#else + return JNI_FALSE; +#endif +} #ifdef __cplusplus } #endif diff --git a/test/jdk/java/io/OutputStreamWriter/CloseWriterOnFailedFlush.java b/test/jdk/java/io/OutputStreamWriter/CloseWriterOnFailedFlush.java new file mode 100644 index 000000000000..b87362ca3761 --- /dev/null +++ b/test/jdk/java/io/OutputStreamWriter/CloseWriterOnFailedFlush.java @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2023, 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 8136895 + * @summary Verify stream closed after write error in StreamEncoder::implClose + */ + +import java.io.IOException; +import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.io.Writer; +import java.nio.charset.MalformedInputException; +import java.nio.charset.StandardCharsets; + +public class CloseWriterOnFailedFlush { + private static final String STR_IOE = "Test"; // IOException + private static final String STR_MIE = "\ud83c"; // MalformedInputException + + public static void main(String[] args) throws IOException { + boolean failed = false; + + for (String s : new String[] {STR_IOE, STR_MIE}) { + System.out.println("string: " + s); + ErroringOutputStream stream = new ErroringOutputStream(); + try (Writer writer = new OutputStreamWriter(stream, + StandardCharsets.UTF_8.newEncoder())) { + writer.write(s); + } catch (IOException ex) { + Class exClass = ex.getClass(); + if (s.equals(STR_IOE) && exClass != IOException.class || + s.equals(STR_MIE) && exClass != MalformedInputException.class) + throw ex; + } + + if (stream.isOpen()) { + System.err.println("Stream is STILL open"); + failed = true; + } else { + System.out.println("Stream is closed"); + } + } + + if (failed) + throw new RuntimeException("Test failed"); + } + + private static class ErroringOutputStream extends OutputStream { + private boolean open = true; + + @Override + public void write(int b) throws IOException { + throw new IOException(); + } + + public boolean isOpen() { + return open; + } + + @Override + public void close() throws IOException { + open = false; + System.out.println("Closing"); + } + } +} diff --git a/test/jdk/java/io/SequenceInputStream/TransferTo.java b/test/jdk/java/io/SequenceInputStream/TransferTo.java index a39d2c1e0136..4c8ff71a4f3c 100644 --- a/test/jdk/java/io/SequenceInputStream/TransferTo.java +++ b/test/jdk/java/io/SequenceInputStream/TransferTo.java @@ -24,6 +24,7 @@ import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.InputStream; +import java.io.IOException; import java.io.OutputStream; import java.io.SequenceInputStream; import java.util.Arrays; @@ -39,6 +40,7 @@ import static java.lang.String.format; import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertNotEquals; import static org.testng.Assert.assertThrows; import static org.testng.Assert.assertTrue; @@ -126,6 +128,49 @@ public void testStreamContents() throws Exception { outputStreamProvider, createRandomBytes(4096, 0), 0, 4096); } + /* + * Special case: Assert subsequent input stream is read when preceding stream already was MAX_VALUE long. + * Note: Not testing actual content as it requires multiple GBs of memory and long time. + */ + @Test + public void testHugeStream() throws Exception { + InputStream is1 = repeat(0, Long.MAX_VALUE); + InputStream is2 = repeat(0, 1); + assertNotEquals(is1.available(), 0); + assertNotEquals(is2.available(), 0); + SequenceInputStream sis = new SequenceInputStream(is1, is2); + OutputStream nos = OutputStream.nullOutputStream(); + sis.transferTo(nos); + assertEquals(is1.available(), 0); + assertEquals(is2.available(), 0); + } + + /* + * Produces an input stream that returns b count times. + * Builds a dysfunctional mock that solely implements + * available() and transferTo() particually, + * but fails with any other operation. + */ + private static InputStream repeat(int b, long count) { + return new InputStream() { + private long pos; + @Override + public int available() throws IOException { + return (int) Math.min(count - pos, Integer.MAX_VALUE); + } + @Override + public int read() throws IOException { + throw new UnsupportedOperationException(); + } + @Override + public long transferTo(OutputStream os) throws IOException { + // skipping actual writing to os to spare time + pos += count; + return count; + } + }; + } + /* * Asserts that the transferred content is correct, i.e., compares the bytes * actually transferred to those expected. The position of the input and diff --git a/test/jdk/java/lang/Character/CharCheck.java b/test/jdk/java/lang/Character/CharCheck.java index d67dd546b1aa..f75217e26aa8 100644 --- a/test/jdk/java/lang/Character/CharCheck.java +++ b/test/jdk/java/lang/Character/CharCheck.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/lang/Character/CheckUnicode.java b/test/jdk/java/lang/Character/CheckUnicode.java index 7a222a8f9939..aa515d4128f0 100644 --- a/test/jdk/java/lang/Character/CheckUnicode.java +++ b/test/jdk/java/lang/Character/CheckUnicode.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/lang/Character/DumpCharProperties.java b/test/jdk/java/lang/Character/DumpCharProperties.java index ed9703c6df07..d225842b3466 100644 --- a/test/jdk/java/lang/Character/DumpCharProperties.java +++ b/test/jdk/java/lang/Character/DumpCharProperties.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/lang/Character/UnicodeBlock/CheckBlocks.java b/test/jdk/java/lang/Character/UnicodeBlock/CheckBlocks.java index 9c3b4487a916..8b06fd8658e7 100644 --- a/test/jdk/java/lang/Character/UnicodeBlock/CheckBlocks.java +++ b/test/jdk/java/lang/Character/UnicodeBlock/CheckBlocks.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/lang/Character/UnicodeCasingTest.java b/test/jdk/java/lang/Character/UnicodeCasingTest.java index d50f2740799c..97e973ac7d3a 100644 --- a/test/jdk/java/lang/Character/UnicodeCasingTest.java +++ b/test/jdk/java/lang/Character/UnicodeCasingTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/lang/Character/UnicodeSpec.java b/test/jdk/java/lang/Character/UnicodeSpec.java index 1c0af1e67e94..8a5592bcbd24 100644 --- a/test/jdk/java/lang/Character/UnicodeSpec.java +++ b/test/jdk/java/lang/Character/UnicodeSpec.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/lang/Package/annotation/jdk.xml.dom/org/w3c/dom/css/FakePackage.java b/test/jdk/java/lang/Package/annotation/jdk.xml.dom/org/w3c/dom/css/FakePackage.java index 4323286115eb..95ce92f267f9 100644 --- a/test/jdk/java/lang/Package/annotation/jdk.xml.dom/org/w3c/dom/css/FakePackage.java +++ b/test/jdk/java/lang/Package/annotation/jdk.xml.dom/org/w3c/dom/css/FakePackage.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/lang/Package/annotation/src/p/Duplicate.java b/test/jdk/java/lang/Package/annotation/src/p/Duplicate.java index eacbd892282c..c12043cbb936 100644 --- a/test/jdk/java/lang/Package/annotation/src/p/Duplicate.java +++ b/test/jdk/java/lang/Package/annotation/src/p/Duplicate.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/lang/StrictMath/FdlibmTranslit.java b/test/jdk/java/lang/StrictMath/FdlibmTranslit.java index 6fa541246c21..f38ca68569b8 100644 --- a/test/jdk/java/lang/StrictMath/FdlibmTranslit.java +++ b/test/jdk/java/lang/StrictMath/FdlibmTranslit.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/lang/String/SpecialCasingTest.java b/test/jdk/java/lang/String/SpecialCasingTest.java index 32d6c01f3441..d4a5122e7adc 100644 --- a/test/jdk/java/lang/String/SpecialCasingTest.java +++ b/test/jdk/java/lang/String/SpecialCasingTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/lang/String/UnicodeCasingTest.java b/test/jdk/java/lang/String/UnicodeCasingTest.java index 1624c79dbce0..8924c4ad20ee 100644 --- a/test/jdk/java/lang/String/UnicodeCasingTest.java +++ b/test/jdk/java/lang/String/UnicodeCasingTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/lang/Thread/ThreadSleepEvent.java b/test/jdk/java/lang/Thread/ThreadSleepEvent.java index 7aa2f507ff08..441e79f3a940 100644 --- a/test/jdk/java/lang/Thread/ThreadSleepEvent.java +++ b/test/jdk/java/lang/Thread/ThreadSleepEvent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,6 +24,7 @@ /** * @test * @summary Test that Thread.sleep emits a JFR jdk.ThreadSleep event + * @requires vm.hasJFR * @modules jdk.jfr * @run junit ThreadSleepEvent */ diff --git a/test/jdk/java/lang/Thread/virtual/JfrEvents.java b/test/jdk/java/lang/Thread/virtual/JfrEvents.java index 282a8959fe87..f731702990f0 100644 --- a/test/jdk/java/lang/Thread/virtual/JfrEvents.java +++ b/test/jdk/java/lang/Thread/virtual/JfrEvents.java @@ -24,7 +24,7 @@ /** * @test * @summary Basic test for JFR jdk.VirtualThreadXXX events - * @requires vm.continuations + * @requires vm.continuations & vm.hasJFR * @modules jdk.jfr java.base/java.lang:+open * @library /test/lib * @run junit/othervm --enable-native-access=ALL-UNNAMED JfrEvents diff --git a/test/jdk/java/lang/annotation/AnnotationVerifier.java b/test/jdk/java/lang/annotation/AnnotationVerifier.java index 890daa3695d3..5606763e285b 100644 --- a/test/jdk/java/lang/annotation/AnnotationVerifier.java +++ b/test/jdk/java/lang/annotation/AnnotationVerifier.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/lang/annotation/AnnotationWithLambda.java b/test/jdk/java/lang/annotation/AnnotationWithLambda.java index 1ca2e0950e8a..a71079aea055 100644 --- a/test/jdk/java/lang/annotation/AnnotationWithLambda.java +++ b/test/jdk/java/lang/annotation/AnnotationWithLambda.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/lang/annotation/ClassFileGenerator.java b/test/jdk/java/lang/annotation/ClassFileGenerator.java index 7ee619292b0d..e5c5f40f4f40 100644 --- a/test/jdk/java/lang/annotation/ClassFileGenerator.java +++ b/test/jdk/java/lang/annotation/ClassFileGenerator.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/lang/annotation/GoodAnnotation.java b/test/jdk/java/lang/annotation/GoodAnnotation.java index 8efbb1c3a591..8b5c94368cb9 100644 --- a/test/jdk/java/lang/annotation/GoodAnnotation.java +++ b/test/jdk/java/lang/annotation/GoodAnnotation.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/lang/constant/ModuleDescTest.java b/test/jdk/java/lang/constant/ModuleDescTest.java index bd2915eb8dc7..4bd84673fe10 100644 --- a/test/jdk/java/lang/constant/ModuleDescTest.java +++ b/test/jdk/java/lang/constant/ModuleDescTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/lang/constant/PackageDescTest.java b/test/jdk/java/lang/constant/PackageDescTest.java index bdb4fad1fa07..fe54a96eb8b5 100644 --- a/test/jdk/java/lang/constant/PackageDescTest.java +++ b/test/jdk/java/lang/constant/PackageDescTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/lang/instrument/modules/AppendToClassPathModuleTest.java b/test/jdk/java/lang/instrument/modules/AppendToClassPathModuleTest.java index 1b0e1f50dd28..76655758b8b8 100644 --- a/test/jdk/java/lang/instrument/modules/AppendToClassPathModuleTest.java +++ b/test/jdk/java/lang/instrument/modules/AppendToClassPathModuleTest.java @@ -24,6 +24,7 @@ /** * @test * @bug 8169909 + * @requires vm.flagless * @library src /test/lib * @build test/* * @run shell AppendToClassPathModuleTest.sh diff --git a/test/jdk/java/lang/invoke/8076596/Test8076596.java b/test/jdk/java/lang/invoke/8076596/Test8076596.java index 7d3cde0f8697..46751e2f87cc 100644 --- a/test/jdk/java/lang/invoke/8076596/Test8076596.java +++ b/test/jdk/java/lang/invoke/8076596/Test8076596.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/lang/invoke/8147078/Test8147078.java b/test/jdk/java/lang/invoke/8147078/Test8147078.java index 6814b2ff73a1..08532d30929e 100644 --- a/test/jdk/java/lang/invoke/8147078/Test8147078.java +++ b/test/jdk/java/lang/invoke/8147078/Test8147078.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/lang/invoke/ArrayConstructorTest.java b/test/jdk/java/lang/invoke/ArrayConstructorTest.java index ff81bb6fe2a9..749bb7926a05 100644 --- a/test/jdk/java/lang/invoke/ArrayConstructorTest.java +++ b/test/jdk/java/lang/invoke/ArrayConstructorTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/lang/invoke/ArrayLengthTest.java b/test/jdk/java/lang/invoke/ArrayLengthTest.java index 2d4bfbe5dc10..9f3cc6fe240c 100644 --- a/test/jdk/java/lang/invoke/ArrayLengthTest.java +++ b/test/jdk/java/lang/invoke/ArrayLengthTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/lang/invoke/ConstantIdentityMHTest.java b/test/jdk/java/lang/invoke/ConstantIdentityMHTest.java index c0db09bb42ae..320fd29abe69 100644 --- a/test/jdk/java/lang/invoke/ConstantIdentityMHTest.java +++ b/test/jdk/java/lang/invoke/ConstantIdentityMHTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/lang/invoke/CountedLoopIterationCountsTest.java b/test/jdk/java/lang/invoke/CountedLoopIterationCountsTest.java index 85208080565e..a55b614d5dec 100644 --- a/test/jdk/java/lang/invoke/CountedLoopIterationCountsTest.java +++ b/test/jdk/java/lang/invoke/CountedLoopIterationCountsTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/lang/invoke/DropArgumentsTest.java b/test/jdk/java/lang/invoke/DropArgumentsTest.java index fd36d07767cb..2df9b5f63ba3 100644 --- a/test/jdk/java/lang/invoke/DropArgumentsTest.java +++ b/test/jdk/java/lang/invoke/DropArgumentsTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/lang/invoke/FindAccessTest.java b/test/jdk/java/lang/invoke/FindAccessTest.java index 75cba87e96f2..f8602ee22bdb 100644 --- a/test/jdk/java/lang/invoke/FindAccessTest.java +++ b/test/jdk/java/lang/invoke/FindAccessTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/lang/invoke/FindClassSecurityManager.java b/test/jdk/java/lang/invoke/FindClassSecurityManager.java index 2fd05c6ab455..2c6a317176c6 100644 --- a/test/jdk/java/lang/invoke/FindClassSecurityManager.java +++ b/test/jdk/java/lang/invoke/FindClassSecurityManager.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/lang/invoke/FoldTest.java b/test/jdk/java/lang/invoke/FoldTest.java index 1e8e4f517dbe..157cfbffe2e5 100644 --- a/test/jdk/java/lang/invoke/FoldTest.java +++ b/test/jdk/java/lang/invoke/FoldTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/lang/invoke/InvokeMethodHandleWithBadArgument.java b/test/jdk/java/lang/invoke/InvokeMethodHandleWithBadArgument.java index 12a1079bdb41..2479c22b2f4b 100644 --- a/test/jdk/java/lang/invoke/InvokeMethodHandleWithBadArgument.java +++ b/test/jdk/java/lang/invoke/InvokeMethodHandleWithBadArgument.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/lang/invoke/LoopCombinatorLongSignatureTest.java b/test/jdk/java/lang/invoke/LoopCombinatorLongSignatureTest.java index ccd8c53c7b04..89118becacc6 100644 --- a/test/jdk/java/lang/invoke/LoopCombinatorLongSignatureTest.java +++ b/test/jdk/java/lang/invoke/LoopCombinatorLongSignatureTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/lang/invoke/LoopCombinatorTest.java b/test/jdk/java/lang/invoke/LoopCombinatorTest.java index fa11affa45ce..15fb9d320a36 100644 --- a/test/jdk/java/lang/invoke/LoopCombinatorTest.java +++ b/test/jdk/java/lang/invoke/LoopCombinatorTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/lang/invoke/MethodHandles/TestCatchException.java b/test/jdk/java/lang/invoke/MethodHandles/TestCatchException.java index 442241cb507e..4416adc4b001 100644 --- a/test/jdk/java/lang/invoke/MethodHandles/TestCatchException.java +++ b/test/jdk/java/lang/invoke/MethodHandles/TestCatchException.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/lang/invoke/MethodTypeSecurityManager.java b/test/jdk/java/lang/invoke/MethodTypeSecurityManager.java index 5096e9c79676..9db88aacb29a 100644 --- a/test/jdk/java/lang/invoke/MethodTypeSecurityManager.java +++ b/test/jdk/java/lang/invoke/MethodTypeSecurityManager.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/lang/invoke/SpreadCollectTest.java b/test/jdk/java/lang/invoke/SpreadCollectTest.java index 78332d671706..bcddcd449f81 100644 --- a/test/jdk/java/lang/invoke/SpreadCollectTest.java +++ b/test/jdk/java/lang/invoke/SpreadCollectTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/lang/invoke/TryFinallyTest.java b/test/jdk/java/lang/invoke/TryFinallyTest.java index 9749b148c3de..4a3c255201ed 100644 --- a/test/jdk/java/lang/invoke/TryFinallyTest.java +++ b/test/jdk/java/lang/invoke/TryFinallyTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/lang/invoke/VarArgsTest.java b/test/jdk/java/lang/invoke/VarArgsTest.java index 23baee3be88f..bb17881b514a 100644 --- a/test/jdk/java/lang/invoke/VarArgsTest.java +++ b/test/jdk/java/lang/invoke/VarArgsTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/lang/invoke/accessClassAndFindClass/TestAccessClass.java b/test/jdk/java/lang/invoke/accessClassAndFindClass/TestAccessClass.java index e75cf8541e6a..083a357a4300 100644 --- a/test/jdk/java/lang/invoke/accessClassAndFindClass/TestAccessClass.java +++ b/test/jdk/java/lang/invoke/accessClassAndFindClass/TestAccessClass.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/lang/invoke/accessClassAndFindClass/TestCls.java b/test/jdk/java/lang/invoke/accessClassAndFindClass/TestCls.java index c46aef619fae..4497f8f832f4 100644 --- a/test/jdk/java/lang/invoke/accessClassAndFindClass/TestCls.java +++ b/test/jdk/java/lang/invoke/accessClassAndFindClass/TestCls.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/lang/invoke/accessClassAndFindClass/TestFindClass.java b/test/jdk/java/lang/invoke/accessClassAndFindClass/TestFindClass.java index d30f48de6ad1..54674729fe38 100644 --- a/test/jdk/java/lang/invoke/accessClassAndFindClass/TestFindClass.java +++ b/test/jdk/java/lang/invoke/accessClassAndFindClass/TestFindClass.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/lang/invoke/accessClassAndFindClass/TestLookup.java b/test/jdk/java/lang/invoke/accessClassAndFindClass/TestLookup.java index fbb976e34016..555213bedcca 100644 --- a/test/jdk/java/lang/invoke/accessClassAndFindClass/TestLookup.java +++ b/test/jdk/java/lang/invoke/accessClassAndFindClass/TestLookup.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/lang/invoke/accessClassAndFindClass/p/Foo.java b/test/jdk/java/lang/invoke/accessClassAndFindClass/p/Foo.java index 90640ed1f30b..d01a1e79384c 100644 --- a/test/jdk/java/lang/invoke/accessClassAndFindClass/p/Foo.java +++ b/test/jdk/java/lang/invoke/accessClassAndFindClass/p/Foo.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/lang/invoke/accessClassAndFindClass/q/Bar.java b/test/jdk/java/lang/invoke/accessClassAndFindClass/q/Bar.java index 25bcd969ecfe..3aba9423d697 100644 --- a/test/jdk/java/lang/invoke/accessClassAndFindClass/q/Bar.java +++ b/test/jdk/java/lang/invoke/accessClassAndFindClass/q/Bar.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/lang/invoke/indify/Indify.java b/test/jdk/java/lang/invoke/indify/Indify.java index da5d61f022c7..6c70e124df84 100644 --- a/test/jdk/java/lang/invoke/indify/Indify.java +++ b/test/jdk/java/lang/invoke/indify/Indify.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/lang/invoke/lookup/ChainedLookupTest.java b/test/jdk/java/lang/invoke/lookup/ChainedLookupTest.java index 2aaa48af17b4..0e81c6a9eec5 100644 --- a/test/jdk/java/lang/invoke/lookup/ChainedLookupTest.java +++ b/test/jdk/java/lang/invoke/lookup/ChainedLookupTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/lang/invoke/lookup/ReflectiveLookupTest.java b/test/jdk/java/lang/invoke/lookup/ReflectiveLookupTest.java index 14178b7fa8f0..6a637a8ad252 100644 --- a/test/jdk/java/lang/invoke/lookup/ReflectiveLookupTest.java +++ b/test/jdk/java/lang/invoke/lookup/ReflectiveLookupTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/lang/invoke/lookup/java.base/java/lang/LookupTest.java b/test/jdk/java/lang/invoke/lookup/java.base/java/lang/LookupTest.java index 3d633dc2082b..c124df3d1c29 100644 --- a/test/jdk/java/lang/invoke/lookup/java.base/java/lang/LookupTest.java +++ b/test/jdk/java/lang/invoke/lookup/java.base/java/lang/LookupTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/lang/management/MemoryMXBean/LowMemoryTest2.java b/test/jdk/java/lang/management/MemoryMXBean/LowMemoryTest2.java index 917e8226bb13..de1b22c4075a 100644 --- a/test/jdk/java/lang/management/MemoryMXBean/LowMemoryTest2.java +++ b/test/jdk/java/lang/management/MemoryMXBean/LowMemoryTest2.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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 @@ -36,7 +36,7 @@ * @bug 4982128 * @summary Test low memory detection of non-heap memory pool * - * @run main/othervm/timeout=600 -noclassgc -XX:MaxMetaspaceSize=32m + * @run main/othervm/timeout=600 -Xnoclassgc -XX:MaxMetaspaceSize=32m * LowMemoryTest2 */ @@ -45,7 +45,7 @@ * @bug 4982128 * @summary Test low memory detection of non-heap memory pool * - * @run main/othervm/timeout=600 -noclassgc -XX:MaxMetaspaceSize=16m + * @run main/othervm/timeout=600 -Xnoclassgc -XX:MaxMetaspaceSize=16m * -XX:CompressedClassSpaceSize=4m LowMemoryTest2 */ diff --git a/test/jdk/java/lang/management/ThreadMXBean/ThreadCpuTime.java b/test/jdk/java/lang/management/ThreadMXBean/ThreadCpuTime.java index 61fff6393638..f8cab540465a 100644 --- a/test/jdk/java/lang/management/ThreadMXBean/ThreadCpuTime.java +++ b/test/jdk/java/lang/management/ThreadMXBean/ThreadCpuTime.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, 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 @@ -177,6 +177,8 @@ private static void waitUntilThreadBlocked() } } } + // Account for threads using CPU for a few millis after their WAITING state is visible: + goSleep(500); } static class MyThread extends Thread { @@ -228,15 +230,6 @@ public void run() { " CurrentThreadCpuTime = " + time1 + " > ThreadCpuTime = " + time2); } -/************* - * FIXME: Seems that on Solaris-sparc, - * It occasionally returns a different current thread user time > thread user time - if (utime1 > utime2) { - throw new RuntimeException("TEST FAILED: " + getName() + - " CurrentThreadUserTime = " + utime1 + - " > ThreadUserTime = " + utime2); - } -*/ } } diff --git a/test/jdk/java/lang/reflect/Generics/TestGenericReturnTypeToString.java b/test/jdk/java/lang/reflect/Generics/TestGenericReturnTypeToString.java index e41f1bdaf1cd..1ccb8d21288d 100644 --- a/test/jdk/java/lang/reflect/Generics/TestGenericReturnTypeToString.java +++ b/test/jdk/java/lang/reflect/Generics/TestGenericReturnTypeToString.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/lang/runtime/SwitchBootstrapsTest.java b/test/jdk/java/lang/runtime/SwitchBootstrapsTest.java index 0e7295320754..1489a6d55b78 100644 --- a/test/jdk/java/lang/runtime/SwitchBootstrapsTest.java +++ b/test/jdk/java/lang/runtime/SwitchBootstrapsTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/math/BigDecimal/ToPlainStringTests.java b/test/jdk/java/math/BigDecimal/ToPlainStringTests.java index 7c7928ca85ca..0a1f617c0e57 100644 --- a/test/jdk/java/math/BigDecimal/ToPlainStringTests.java +++ b/test/jdk/java/math/BigDecimal/ToPlainStringTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2023, 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 4984872 + * @bug 4984872 8318915 * @summary Basic tests of toPlainString method * @run main ToPlainStringTests * @run main/othervm -XX:+IgnoreUnrecognizedVMOptions -XX:+EliminateAutoBox -XX:AutoBoxCacheMax=20000 ToPlainStringTests @@ -67,6 +67,11 @@ public static void main(String argv[]) { {"12345678901234567890", "12345678901234567890"}, {"12345678901234567890e22", "123456789012345678900000000000000000000000"}, {"12345678901234567890e-22", "0.0012345678901234567890"}, + + {"12345e-1", "1234.5"}, + {"12345e-2", "123.45"}, + {"12345e-3", "12.345"}, + {"12345e-4", "1.2345"}, }; int errors = 0; @@ -89,6 +94,38 @@ public static void main(String argv[]) { } } + String[] failingCases = { + "1E-" + (Integer.MAX_VALUE - 0), // MAX_VALUE + 2 chars + "1E-" + (Integer.MAX_VALUE - 1), // MAX_VALUE + 1 chars + + "-1E-" + (Integer.MAX_VALUE - 0), // MAX_VALUE + 3 chars + "-1E-" + (Integer.MAX_VALUE - 1), // MAX_VALUE + 2 chars + "-1E-" + (Integer.MAX_VALUE - 2), // MAX_VALUE + 1 chars + + "123456789E-" + (Integer.MAX_VALUE - 0), // MAX_VALUE + 2 chars + "123456789E-" + (Integer.MAX_VALUE - 1), // MAX_VALUE + 1 chars + + "-123456789E-" + (Integer.MAX_VALUE - 0), // MAX_VALUE + 3 chars + "-123456789E-" + (Integer.MAX_VALUE - 1), // MAX_VALUE + 2 chars + "-123456789E-" + (Integer.MAX_VALUE - 2), // MAX_VALUE + 1 chars + + "1E" + Integer.MAX_VALUE, // MAX_VALUE + 1 chars + "123456789E" + Integer.MAX_VALUE, // MAX_VALUE + 9 chars + + "-1E" + Integer.MAX_VALUE, // MAX_VALUE + 2 chars + "-123456789E" + Integer.MAX_VALUE, // MAX_VALUE + 10 chars + }; + /* We expect pre-emptive OutOfMemoryErrors, nothing else */ + for (String failingCase : failingCases) { + try { + new BigDecimal(failingCase).toPlainString(); + } catch (OutOfMemoryError expected) { + continue; + } catch (Throwable ignored) { + } + ++errors; + } + if(errors > 0) throw new RuntimeException(errors + " errors during run."); } diff --git a/test/jdk/java/net/DatagramSocket/InterruptibleDatagramSocket.java b/test/jdk/java/net/DatagramSocket/InterruptibleDatagramSocket.java index dbe10f9646c8..aca88bb95901 100644 --- a/test/jdk/java/net/DatagramSocket/InterruptibleDatagramSocket.java +++ b/test/jdk/java/net/DatagramSocket/InterruptibleDatagramSocket.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, 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 @@ -37,6 +37,7 @@ * @test * @summary Check interrupt mechanism for DatagramSocket, * MulticastSocket, and DatagramSocketAdaptor + * @library /test/lib * @run main InterruptibleDatagramSocket */ @@ -97,6 +98,10 @@ else if (!s.isClosed() && interruptible) } public static void main(String[] args) throws Exception { + if (Thread.currentThread().isVirtual()) { + throw new jtreg.SkippedException( + "skipping test execution - main thread is a virtual thread"); + } try (DatagramSocket s = new DatagramSocket()) { System.out.println("Testing interrupt of DatagramSocket receive " + "on endpoint " + s.getLocalSocketAddress()); diff --git a/test/jdk/java/net/InetAddress/IsReachableViaLoopbackTest.java b/test/jdk/java/net/InetAddress/IsReachableViaLoopbackTest.java index 4d340a72fba2..2f2ad0ac7ddf 100644 --- a/test/jdk/java/net/InetAddress/IsReachableViaLoopbackTest.java +++ b/test/jdk/java/net/InetAddress/IsReachableViaLoopbackTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,22 +21,24 @@ * questions. */ -import java.io.*; -import java.net.*; -import java.util.*; +import java.io.IOException; +import java.net.InetAddress; +import java.net.NetworkInterface; /** * @test * @bug 8135305 * @key intermittent + * @library /test/lib * @summary ensure we can't ping external hosts via loopback if + * @run main IsReachableViaLoopbackTest */ public class IsReachableViaLoopbackTest { public static void main(String[] args) { try { - InetAddress addr = InetAddress.getByName("localhost"); - InetAddress remoteAddr = InetAddress.getByName("bugs.openjdk.org"); + InetAddress addr = InetAddress.getLoopbackAddress(); + InetAddress remoteAddr = InetAddress.getByName("23.197.138.208"); // use literal address to avoid DNS checks if (!addr.isReachable(10000)) throw new RuntimeException("Localhost should always be reachable"); NetworkInterface inf = NetworkInterface.getByInetAddress(addr); @@ -54,7 +56,6 @@ public static void main(String[] args) { } else { System.out.println("inf == null"); } - } catch (IOException e) { throw new RuntimeException("Unexpected exception:" + e); } diff --git a/test/jdk/java/net/InetAddress/getOriginalHostName.java b/test/jdk/java/net/InetAddress/getOriginalHostName.java index 9f1e6e965d17..71567a7915d6 100644 --- a/test/jdk/java/net/InetAddress/getOriginalHostName.java +++ b/test/jdk/java/net/InetAddress/getOriginalHostName.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, 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 @@ -41,7 +41,9 @@ public class getOriginalHostName { public static void main(String[] args) throws Exception { final String HOST = "dummyserver.java.net"; InetAddress ia = null; - ia = InetAddress.getByName(HOST); + ia = getInetAddress(HOST); + if (ia != null) testInetAddress(ia, HOST); + ia = InetAddress.getByAddress(HOST, new byte[] { 1, 2, 3, 4}); testInetAddress(ia, HOST); ia = InetAddress.getByName("255.255.255.0"); testInetAddress(ia, null); @@ -53,6 +55,14 @@ public static void main(String[] args) throws Exception { testInetAddress(ia, ia.getHostName()); } + private static InetAddress getInetAddress(String host) { + try { + return InetAddress.getByName(host); + } catch (java.net.UnknownHostException uhe) { + System.out.println("Skipping " + host + " due to " + uhe); + return null; + } + } private static void testInetAddress(InetAddress ia, String expected) throws Exception { diff --git a/test/jdk/java/net/Socket/UdpSocket.java b/test/jdk/java/net/Socket/UdpSocket.java index a15f9255b450..5d13c1f916a6 100644 --- a/test/jdk/java/net/Socket/UdpSocket.java +++ b/test/jdk/java/net/Socket/UdpSocket.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -47,6 +47,8 @@ @Test public class UdpSocket { + private static final int MAX_RETRIES = 3; + /** * Test using the Socket API to send/receive datagrams */ @@ -133,16 +135,21 @@ public void testMaxSockets() throws Exception { } - private Socket newUdpSocket() throws IOException { - Socket s = null; - - try { - s = new Socket(InetAddress.getLoopbackAddress(), 8000, false); - } catch (BindException unexpected) { - System.out.println("BindException caught retry Socket creation"); - s = new Socket(InetAddress.getLoopbackAddress(), 8000, false); + private Socket newUdpSocket() throws IOException, InterruptedException { + BindException unexpected = null; + for (int i=0; i < MAX_RETRIES; i++) { + try { + return new Socket(InetAddress.getLoopbackAddress(), 8000, false); + } catch (BindException be) { + unexpected = be; + if (i != MAX_RETRIES - 1) { + System.out.printf("BindException caught: retry Socket creation [%s/%s]%n", + i + 1, MAX_RETRIES); + Thread.sleep(10 + 10 * i); + } + } } - return s; + throw unexpected; } private void closeAll(Deque sockets) throws IOException { diff --git a/test/jdk/java/net/httpclient/CancelRequestTest.java b/test/jdk/java/net/httpclient/CancelRequestTest.java index 32ca1337162a..7851b1124983 100644 --- a/test/jdk/java/net/httpclient/CancelRequestTest.java +++ b/test/jdk/java/net/httpclient/CancelRequestTest.java @@ -35,9 +35,6 @@ */ // * -Dseed=3582896013206826205L // * -Dseed=5784221742235559231L -import com.sun.net.httpserver.HttpServer; -import com.sun.net.httpserver.HttpsConfigurator; -import com.sun.net.httpserver.HttpsServer; import jdk.internal.net.http.common.OperationTrackers.Tracker; import jdk.test.lib.RandomFactory; import jdk.test.lib.net.SimpleSSLContext; @@ -56,8 +53,6 @@ import java.io.InputStream; import java.io.OutputStream; import java.lang.ref.Reference; -import java.net.InetAddress; -import java.net.InetSocketAddress; import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpConnectTimeoutException; @@ -80,17 +75,15 @@ import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicReference; import java.util.stream.Collectors; -import java.util.stream.Stream; import jdk.httpclient.test.lib.common.HttpServerAdapters; -import jdk.httpclient.test.lib.http2.Http2TestServer; -import static java.lang.System.arraycopy; import static java.lang.System.out; import static java.lang.System.err; import static java.net.http.HttpClient.Version.HTTP_1_1; import static java.net.http.HttpClient.Version.HTTP_2; import static java.nio.charset.StandardCharsets.UTF_8; import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertFalse; import static org.testng.Assert.assertTrue; public class CancelRequestTest implements HttpServerAdapters { @@ -179,19 +172,19 @@ void beforeMethod(ITestContext context) { } @AfterClass - static final void printFailedTests(ITestContext context) { + static void printFailedTests(ITestContext context) { out.println("\n========================="); var failed = context.getFailedTests().getAllResults().stream() - .collect(Collectors.toMap(r -> name(r), ITestResult::getThrowable)); + .collect(Collectors.toMap(CancelRequestTest::name, ITestResult::getThrowable)); FAILURES.putAll(failed); try { out.printf("%n%sCreated %d servers and %d clients%n", now(), serverCount.get(), clientCount.get()); if (FAILURES.isEmpty()) return; out.println("Failed tests: "); - FAILURES.entrySet().forEach((e) -> { - out.printf("\t%s: %s%n", e.getKey(), e.getValue()); - e.getValue().printStackTrace(out); + FAILURES.forEach((key, value) -> { + out.printf("\t%s: %s%n", key, value); + value.printStackTrace(out); }); if (tasksFailed) { System.out.println("WARNING: Some tasks failed"); @@ -327,7 +320,7 @@ public void testGetSendAsync(String uri, boolean sameClient, boolean mayInterrup out.println("cf2 after cancel: " + cf2); try { String body = cf2.get().body(); - assertEquals(body, Stream.of(BODY.split("\\|")).collect(Collectors.joining())); + assertEquals(body, String.join("", BODY.split("\\|"))); throw new AssertionError("Expected CancellationException not received"); } catch (ExecutionException x) { out.println("Got expected exception: " + x); @@ -348,14 +341,14 @@ public void testGetSendAsync(String uri, boolean sameClient, boolean mayInterrup // completed yet - so wait for it here... try { String body = response.get().body(); - assertEquals(body, Stream.of(BODY.split("\\|")).collect(Collectors.joining())); + assertEquals(body, String.join("", BODY.split("\\|"))); if (mayInterruptIfRunning) { // well actually - this could happen... In which case we'll need to // increase the latency in the server handler... throw new AssertionError("Expected Exception not received"); } } catch (ExecutionException x) { - assertEquals(response.isDone(), true); + assertTrue(response.isDone()); Throwable wrapped = x.getCause(); Throwable cause = wrapped; if (mayInterruptIfRunning) { @@ -383,11 +376,11 @@ public void testGetSendAsync(String uri, boolean sameClient, boolean mayInterrup } } - assertEquals(response.isDone(), true); - assertEquals(response.isCancelled(), false); + assertTrue(response.isDone()); + assertFalse(response.isCancelled()); assertEquals(cf1.isCancelled(), hasCancellationException); - assertEquals(cf2.isDone(), true); - assertEquals(cf2.isCancelled(), false); + assertTrue(cf2.isDone()); + assertFalse(cf2.isCancelled()); assertEquals(latch.getCount(), 0); var error = TRACKER.check(tracker, 1000, @@ -397,6 +390,8 @@ public void testGetSendAsync(String uri, boolean sameClient, boolean mayInterrup Reference.reachabilityFence(client); if (error != null) throw error; } + assert client != null; + if (!sameClient) client.close(); } @Test(dataProvider = "asyncurls") @@ -413,7 +408,7 @@ public void testPostSendAsync(String uri, boolean sameClient, boolean mayInterru CompletableFuture> cancelFuture = new CompletableFuture<>(); - Iterable iterable = new Iterable() { + Iterable iterable = new Iterable<>() { @Override public Iterator iterator() { // this is dangerous @@ -448,7 +443,7 @@ public Iterator iterator() { out.println("cf2 after cancel: " + cf2); try { String body = cf2.get().body(); - assertEquals(body, Stream.of(BODY.split("\\|")).collect(Collectors.joining())); + assertEquals(body, String.join("", BODY.split("\\|"))); throw new AssertionError("Expected CancellationException not received"); } catch (ExecutionException x) { out.println("Got expected exception: " + x); @@ -469,14 +464,14 @@ public Iterator iterator() { // completed yet - so wait for it here... try { String body = response.get().body(); - assertEquals(body, Stream.of(BODY.split("\\|")).collect(Collectors.joining())); + assertEquals(body, String.join("", BODY.split("\\|"))); if (mayInterruptIfRunning) { // well actually - this could happen... In which case we'll need to // increase the latency in the server handler... throw new AssertionError("Expected Exception not received"); } } catch (ExecutionException x) { - assertEquals(response.isDone(), true); + assertTrue(response.isDone()); Throwable wrapped = x.getCause(); assertTrue(CancellationException.class.isAssignableFrom(wrapped.getClass())); Throwable cause = wrapped.getCause(); @@ -495,11 +490,11 @@ public Iterator iterator() { } } - assertEquals(response.isDone(), true); - assertEquals(response.isCancelled(), false); + assertTrue(response.isDone()); + assertFalse(response.isCancelled()); assertEquals(cf1.isCancelled(), hasCancellationException); - assertEquals(cf2.isDone(), true); - assertEquals(cf2.isCancelled(), false); + assertTrue(cf2.isDone()); + assertFalse(cf2.isCancelled()); assertEquals(latch.getCount(), 0); var error = TRACKER.check(tracker, 1000, @@ -509,6 +504,8 @@ public Iterator iterator() { Reference.reachabilityFence(client); if (error != null) throw error; } + assert client != null; + if (!sameClient) client.close(); } @Test(dataProvider = "urls") @@ -572,17 +569,19 @@ public void testPostInterrupt(String uri, boolean sameClient) } else { assert failed == null; out.println(uriStr + ": got body: " + body); - assertEquals(body, Stream.of(BODY.split("\\|")).collect(Collectors.joining())); + assertEquals(body, String.join("", BODY.split("\\|"))); } out.println("next iteration"); - var error = TRACKER.check(tracker, 1000, + var error = TRACKER.check(tracker, 2000, (t) -> t.getOutstandingOperations() > 0 || t.getOutstandingSubscribers() > 0, "subscribers for testPostInterrupt(%s)\n\t step [%s]".formatted(req.uri(), i), false); Reference.reachabilityFence(client); if (error != null) throw error; } + assert client != null; + if (!sameClient) client.close(); } diff --git a/test/jdk/java/net/httpclient/DependentPromiseActionsTest.java b/test/jdk/java/net/httpclient/DependentPromiseActionsTest.java index 4e17408ee6f5..32c594808a9c 100644 --- a/test/jdk/java/net/httpclient/DependentPromiseActionsTest.java +++ b/test/jdk/java/net/httpclient/DependentPromiseActionsTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2024, 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 @@ -73,6 +73,7 @@ import java.util.concurrent.Executors; import java.util.concurrent.Flow; import java.util.concurrent.Semaphore; +import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicReference; import java.util.function.BiPredicate; @@ -112,6 +113,7 @@ public class DependentPromiseActionsTest implements HttpServerAdapters { static volatile boolean tasksFailed; static final AtomicLong serverCount = new AtomicLong(); static final AtomicLong clientCount = new AtomicLong(); + static final AtomicInteger requestCount = new AtomicInteger(); static final long start = System.nanoTime(); public static String now() { long now = System.nanoTime() - start; @@ -244,14 +246,17 @@ HttpClient newHttpClient(boolean share) { } @Test(dataProvider = "noStalls") - public void testNoStalls(String uri, boolean sameClient) + public void testNoStalls(String rootUri, boolean sameClient) throws Exception { + if (!FAILURES.isEmpty()) return; HttpClient client = null; - out.printf("%ntestNoStalls(%s, %b)%n", uri, sameClient); + out.printf("%ntestNoStalls(%s, %b)%n", rootUri, sameClient); for (int i=0; i< ITERATION_COUNT; i++) { if (!sameClient || client == null) client = newHttpClient(sameClient); + String uri = rootUri + "/" + requestCount.incrementAndGet(); + out.printf("\tsending request %s%n", uri); HttpRequest req = HttpRequest.newBuilder(URI.create(uri)) .build(); BodyHandler> handler = @@ -331,6 +336,10 @@ private void testDependent(String name, String uri, boolean sameClient, SubscriberType subscriberType) throws Exception { + if (!FAILURES.isEmpty()) { + out.printf("%s: skipping test - previous failure detected%n", name); + return; + } out.printf("%n%s%s%n", now(), name); try { testDependent(uri, sameClient, handlers, finisher, @@ -341,7 +350,7 @@ private void testDependent(String name, String uri, boolean sameClient, } } - private void testDependent(String uri, boolean sameClient, + private void testDependent(String rootUri, boolean sameClient, Supplier> handlers, Finisher finisher, Extractor extractor, @@ -354,6 +363,8 @@ private void testDependent(String uri, boolean sameClient, if (!sameClient || client == null) client = newHttpClient(sameClient); + String uri = rootUri + "/" + requestCount.incrementAndGet(); + out.printf("\tsending request %s%n", uri); HttpRequest req = HttpRequest. newBuilder(URI.create(uri)) .build(); @@ -363,7 +374,13 @@ private void testDependent(String uri, boolean sameClient, System.out.println("try stalling in " + where); CompletableFuture> responseCF = client.sendAsync(req, handler, promiseHandler); - assert subscriberType == SubscriberType.LAZZY || !responseCF.isDone(); + // The body of the main response can be received before the body + // of the push promise handlers are received. + // The body of the main response doesn't stall, so the cf of + // the main response may be done here even for EAGER subscribers. + // We cannot make any assumption on the state of the main response + // cf here, so the only thing we can do is to call the finisher + // which will wait for them all. finisher.finish(where, responseCF, promiseHandler, extractor); } } diff --git a/test/jdk/java/net/httpclient/DigestEchoClient.java b/test/jdk/java/net/httpclient/DigestEchoClient.java index 3b6d1a1773f8..757a1c7674ef 100644 --- a/test/jdk/java/net/httpclient/DigestEchoClient.java +++ b/test/jdk/java/net/httpclient/DigestEchoClient.java @@ -260,8 +260,9 @@ public static void main(String[] args) throws Exception { } try { for (DigestEchoServer.HttpAuthType authType : types) { - // The test server does not support PROXY305 properly - if (authType == DigestEchoServer.HttpAuthType.PROXY305) continue; + // The test server does not support PROXY305 or SERVER307 properly + if (authType == DigestEchoServer.HttpAuthType.PROXY305 || + authType == DigestEchoServer.HttpAuthType.SERVER307) continue; EnumSet basics = EnumSet.of(DigestEchoServer.HttpAuthSchemeType.BASICSERVER, DigestEchoServer.HttpAuthSchemeType.BASIC); diff --git a/test/jdk/java/net/httpclient/ExpectContinueTest.java b/test/jdk/java/net/httpclient/ExpectContinueTest.java index 838a5fbd0461..c85d7d13e2c9 100644 --- a/test/jdk/java/net/httpclient/ExpectContinueTest.java +++ b/test/jdk/java/net/httpclient/ExpectContinueTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/net/httpclient/GZIPInputStreamTest.java b/test/jdk/java/net/httpclient/GZIPInputStreamTest.java index e2a382dfc5e2..7db41cde5d63 100644 --- a/test/jdk/java/net/httpclient/GZIPInputStreamTest.java +++ b/test/jdk/java/net/httpclient/GZIPInputStreamTest.java @@ -26,7 +26,7 @@ * @bug 8217264 * @summary Tests that you can map an InputStream to a GZIPInputStream * @library /test/lib /test/jdk/java/net/httpclient/lib - * @build jdk.test.lib.net.SimpleSSLContext jdk.httpclient.test.lib.common.HttpServerAdapters + * @build jdk.test.lib.net.SimpleSSLContext jdk.httpclient.test.lib.common.HttpServerAdapters ReferenceTracker * @run testng/othervm GZIPInputStreamTest */ diff --git a/test/jdk/java/net/httpclient/HeadTest.java b/test/jdk/java/net/httpclient/HeadTest.java index a1d6d71791a0..5b3b1671d437 100644 --- a/test/jdk/java/net/httpclient/HeadTest.java +++ b/test/jdk/java/net/httpclient/HeadTest.java @@ -86,22 +86,21 @@ public class HeadTest implements HttpServerAdapters { @DataProvider(name = "positive") public Object[][] positive() { return new Object[][] { + // HTTP/1.1 { httpURI, "GET", HTTP_NOT_MODIFIED, HTTP_1_1 }, { httpsURI, "GET", HTTP_NOT_MODIFIED, HTTP_1_1 }, - { httpURI, "GET", HTTP_NOT_MODIFIED, HttpClient.Version.HTTP_2 }, - { httpsURI, "GET", HTTP_NOT_MODIFIED, HttpClient.Version.HTTP_2 }, { httpURI, "HEAD", HTTP_OK, HTTP_1_1 }, { httpsURI, "HEAD", HTTP_OK, HTTP_1_1 }, - { httpURI, "HEAD", HTTP_OK, HttpClient.Version.HTTP_2 }, - { httpsURI, "HEAD", HTTP_OK, HttpClient.Version.HTTP_2 }, { httpURI + "transfer/", "GET", HTTP_NOT_MODIFIED, HTTP_1_1 }, { httpsURI + "transfer/", "GET", HTTP_NOT_MODIFIED, HTTP_1_1 }, - { httpURI + "transfer/", "GET", HTTP_NOT_MODIFIED, HttpClient.Version.HTTP_2 }, - { httpsURI + "transfer/", "GET", HTTP_NOT_MODIFIED, HttpClient.Version.HTTP_2 }, { httpURI + "transfer/", "HEAD", HTTP_OK, HTTP_1_1 }, { httpsURI + "transfer/", "HEAD", HTTP_OK, HTTP_1_1 }, - { httpURI + "transfer/", "HEAD", HTTP_OK, HttpClient.Version.HTTP_2 }, - { httpsURI + "transfer/", "HEAD", HTTP_OK, HttpClient.Version.HTTP_2 } + // HTTP/2 + { http2URI, "GET", HTTP_NOT_MODIFIED, HttpClient.Version.HTTP_2 }, + { https2URI, "GET", HTTP_NOT_MODIFIED, HttpClient.Version.HTTP_2 }, + { http2URI, "HEAD", HTTP_OK, HttpClient.Version.HTTP_2 }, + { https2URI, "HEAD", HTTP_OK, HttpClient.Version.HTTP_2 }, + // HTTP2 forbids transfer-encoding }; } @@ -112,17 +111,13 @@ void test(String uriString, String method, URI uri = URI.create(uriString); HttpRequest.Builder requestBuilder = HttpRequest .newBuilder(uri) + .version(version) .method(method, HttpRequest.BodyPublishers.noBody()); - if (version != null) { - requestBuilder.version(version); - } doTest(requestBuilder.build(), expResp); // repeat the test this time by building the request using convenience // GET and HEAD methods - requestBuilder = HttpRequest.newBuilder(uri); - if (version != null) { - requestBuilder.version(version); - } + requestBuilder = HttpRequest.newBuilder(uri) + .version(version); switch (method) { case "GET" -> requestBuilder.GET(); case "HEAD" -> requestBuilder.HEAD(); @@ -146,6 +141,7 @@ private void doTest(HttpRequest request, int expResp) throws Exception { assertEquals(response.statusCode(), expResp); assertEquals(response.body(), ""); assertEquals(response.headers().firstValue("Content-length").get(), CONTENT_LEN); + assertEquals(response.version(), request.version().get()); } // -- Infrastructure @@ -168,7 +164,7 @@ public void setup() throws Exception { http2TestServer = HttpTestServer.create(HTTP_2); http2TestServer.addHandler(new HeadHandler(), "/"); http2URI = "http://" + http2TestServer.serverAuthority() + "/"; - https2TestServer = HttpTestServer.create(HTTP_2, SSLContext.getDefault()); + https2TestServer = HttpTestServer.create(HTTP_2, sslContext); https2TestServer.addHandler(new HeadHandler(), "/"); https2URI = "https://" + https2TestServer.serverAuthority() + "/"; diff --git a/test/jdk/java/net/httpclient/Http1ChunkedTest.java b/test/jdk/java/net/httpclient/Http1ChunkedTest.java index 2df4c9e854df..f51ccf9fd384 100644 --- a/test/jdk/java/net/httpclient/Http1ChunkedTest.java +++ b/test/jdk/java/net/httpclient/Http1ChunkedTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, 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 @@ -97,7 +97,7 @@ private static void test(String name, String headers, List body, long de } } if (!received) { - System.out.printf("%s: Unexpected headers received: dropping request.%n"); + System.out.printf("%s: Unexpected headers received: dropping request.%n", name); continue; } OutputStream os = serverConn.getOutputStream(); diff --git a/test/jdk/java/net/httpclient/HttpGetInCancelledFuture.java b/test/jdk/java/net/httpclient/HttpGetInCancelledFuture.java new file mode 100644 index 000000000000..5efc50138d6b --- /dev/null +++ b/test/jdk/java/net/httpclient/HttpGetInCancelledFuture.java @@ -0,0 +1,391 @@ +/* + * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.io.IOException; +import java.io.UncheckedIOException; +import java.net.InetAddress; +import java.net.InetSocketAddress; +import java.net.ServerSocket; +import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpClient.Version; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.time.Duration; +import java.util.List; +import java.util.Map; +import java.util.concurrent.Callable; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.CopyOnWriteArrayList; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Executor; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.ForkJoinPool; +import java.util.concurrent.Future; +import java.util.concurrent.RejectedExecutionException; +import java.util.concurrent.atomic.AtomicLong; +import java.util.concurrent.atomic.AtomicReference; + +import jdk.internal.net.http.common.OperationTrackers.Tracker; +import jdk.test.lib.net.SimpleSSLContext; +import jdk.test.lib.net.URIBuilder; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.MethodSource; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertTrue; + +/* + * @test + * @bug 8316580 + * @library /test/lib + * @run junit/othervm -Djdk.tracePinnedThreads=full + * -DuseReferenceTracker=false + * HttpGetInCancelledFuture + * @run junit/othervm -Djdk.tracePinnedThreads=full + * -DuseReferenceTracker=true + * HttpGetInCancelledFuture + * @summary This test verifies that cancelling a future that + * does an HTTP request using the HttpClient doesn't cause + * HttpClient::close to block forever. + */ +public class HttpGetInCancelledFuture { + + static final boolean useTracker = Boolean.getBoolean("useReferenceTracker"); + + static final class TestException extends RuntimeException { + public TestException(String message, Throwable cause) { + super(message, cause); + } + } + + static ReferenceTracker TRACKER = ReferenceTracker.INSTANCE; + + HttpClient makeClient(URI uri, Version version, Executor executor) { + var builder = HttpClient.newBuilder(); + if (uri.getScheme().equalsIgnoreCase("https")) { + try { + builder.sslContext(new SimpleSSLContext().get()); + } catch (IOException io) { + throw new UncheckedIOException(io); + } + } + return builder.connectTimeout(Duration.ofSeconds(1)) + .executor(executor) + .version(version) + .build(); + } + + record TestCase(String url, int reqCount, Version version) {} + // A server that doesn't accept + static volatile ServerSocket NOT_ACCEPTING; + + static List parameters() { + ServerSocket ss = NOT_ACCEPTING; + if (ss == null) { + synchronized (HttpGetInCancelledFuture.class) { + if ((ss = NOT_ACCEPTING) == null) { + try { + ss = new ServerSocket(); + var loopback = InetAddress.getLoopbackAddress(); + ss.bind(new InetSocketAddress(loopback, 0), 10); + NOT_ACCEPTING = ss; + } catch (IOException io) { + throw new UncheckedIOException(io); + } + } + } + } + URI http = URIBuilder.newBuilder() + .loopback() + .scheme("http") + .port(ss.getLocalPort()) + .path("/not-accepting/") + .buildUnchecked(); + URI https = URIBuilder.newBuilder() + .loopback() + .scheme("https") + .port(ss.getLocalPort()) + .path("/not-accepting/") + .buildUnchecked(); + // use all HTTP versions, without and with TLS + return List.of( + new TestCase(http.toString(), 200, Version.HTTP_2), + new TestCase(http.toString(), 200, Version.HTTP_1_1), + new TestCase(https.toString(), 200, Version.HTTP_2), + new TestCase(https.toString(), 200, Version.HTTP_1_1) + ); + } + + @ParameterizedTest + @MethodSource("parameters") + void runTest(TestCase test) { + System.out.println("Testing with: " + test); + runTest(test.url, test.reqCount, test.version); + } + + static class TestTaskScope implements AutoCloseable { + final ExecutorService pool = new ForkJoinPool(); + final Map, Future> tasks = new ConcurrentHashMap<>(); + final AtomicReference failed = new AtomicReference<>(); + + class Task implements Callable { + final Callable task; + final CompletableFuture cf = new CompletableFuture<>(); + Task(Callable task) { + this.task = task; + } + @Override + public T call() throws Exception { + try { + var res = task.call(); + cf.complete(res); + return res; + } catch (Throwable t) { + cf.completeExceptionally(t); + throw t; + } + } + CompletableFuture cf() { + return cf; + } + } + + + static class ShutdownOnFailure extends TestTaskScope { + public ShutdownOnFailure() {} + + @Override + protected void completed(Task task, T result, Throwable throwable) { + super.completed(task, result, throwable); + if (throwable != null) { + if (failed.get() == null) { + ExecutionException ex = throwable instanceof ExecutionException x + ? x : new ExecutionException(throwable); + failed.compareAndSet(null, ex); + } + tasks.entrySet().forEach(this::cancel); + } + } + + void cancel(Map.Entry, Future> entry) { + entry.getValue().cancel(true); + entry.getKey().cf().cancel(true); + tasks.remove(entry.getKey(), entry.getValue()); + } + + @Override + public CompletableFuture fork(Callable callable) { + var ex = failed.get(); + if (ex == null) { + return super.fork(callable); + } // otherwise do nothing + return CompletableFuture.failedFuture(new RejectedExecutionException()); + } + } + + public CompletableFuture fork(Callable callable) { + var task = new Task<>(callable); + var res = pool.submit(task); + tasks.put(task, res); + task.cf.whenComplete((r,t) -> completed(task, r, t)); + return task.cf; + } + + protected void completed(Task task, T result, Throwable throwable) { + tasks.remove(task); + } + + public void join() throws InterruptedException { + try { + var cfs = tasks.keySet().stream() + .map(Task::cf).toArray(CompletableFuture[]::new); + CompletableFuture.allOf(cfs).get(); + } catch (InterruptedException it) { + throw it; + } catch (ExecutionException ex) { + failed.compareAndSet(null, ex); + } + } + + public void throwIfFailed() throws ExecutionException { + ExecutionException x = failed.get(); + if (x != null) throw x; + } + + public void close() { + pool.close(); + } + } + + ExecutorService testExecutor() { + return Executors.newCachedThreadPool(); + } + + void runTest(String url, int reqCount, Version version) { + final var dest = URI.create(url); + try (final var executor = testExecutor()) { + var httpClient = makeClient(dest, version, executor); + TRACKER.track(httpClient); + Tracker tracker = TRACKER.getTracker(httpClient); + Throwable failed = null; + try { + try (final var scope = new TestTaskScope.ShutdownOnFailure()) { + launchAndProcessRequests(scope, httpClient, reqCount, dest); + } finally { + System.out.printf("StructuredTaskScope closed: STARTED=%s, SUCCESS=%s, INTERRUPT=%s, FAILED=%s%n", + STARTED.get(), SUCCESS.get(), INTERRUPT.get(), FAILED.get()); + } + System.out.println("ERROR: Expected TestException not thrown"); + throw new AssertionError("Expected TestException not thrown"); + } catch (TestException x) { + System.out.println("Got expected exception: " + x); + } catch (Throwable t) { + System.out.println("ERROR: Unexpected exception: " + t); + failed = t; + throw t; + } finally { + // we can either use the tracker or call HttpClient::close + if (useTracker) { + // using the tracker depends on GC but will give us some diagnostic + // if some operations are not properly cancelled and prevent the client + // from terminating + httpClient = null; + System.gc(); + System.out.println(TRACKER.diagnose(tracker)); + var error = TRACKER.check(tracker, 10000); + if (error != null) { + if (failed != null) error.addSuppressed(failed); + EXCEPTIONS.forEach(x -> { + System.out.println("FAILED: " + x); + }); + EXCEPTIONS.forEach(x -> { + x.printStackTrace(System.out); + }); + throw error; + } + } else { + // if not all operations terminate, close() will block + // forever and the test will fail in jtreg timeout. + // there will be no diagnostic. + httpClient.close(); + } + System.out.println("HttpClient closed"); + } + } finally { + System.out.println("ThreadExecutor closed"); + } + // not all tasks may have been started before the scope was cancelled + // due to the first connect/timeout exception, but all tasks that started + // must have either succeeded, be interrupted, or failed + assertTrue(STARTED.get() > 0); + assertEquals(STARTED.get(), SUCCESS.get() + INTERRUPT.get() + FAILED.get()); + if (SUCCESS.get() > 0) { + // we don't expect any server to be listening and responding + System.out.println("WARNING: got some unexpected successful responses from " + + "\"" + NOT_ACCEPTING.getLocalSocketAddress() + "\": " + SUCCESS.get()); + } + } + + private void launchAndProcessRequests( + TestTaskScope.ShutdownOnFailure scope, + HttpClient httpClient, + int reqCount, + URI dest) { + for (int counter = 0; counter < reqCount; counter++) { + scope.fork(() -> + getAndCheck(httpClient, dest) + ); + } + try { + scope.join(); + } catch (InterruptedException e) { + throw new AssertionError("scope.join() was interrupted", e); + } + try { + scope.throwIfFailed(); + } catch (ExecutionException e) { + throw new TestException("something threw an exception in StructuredTaskScope", e); + } + } + + final static AtomicLong ID = new AtomicLong(); + final AtomicLong SUCCESS = new AtomicLong(); + final AtomicLong INTERRUPT = new AtomicLong(); + final AtomicLong FAILED = new AtomicLong(); + final AtomicLong STARTED = new AtomicLong(); + final CopyOnWriteArrayList EXCEPTIONS = new CopyOnWriteArrayList<>(); + private String getAndCheck(HttpClient httpClient, URI url) { + STARTED.incrementAndGet(); + final var response = sendRequest(httpClient, url); + String res = response.body(); + int statusCode = response.statusCode(); + assertEquals(200, statusCode); + return res; + } + + private HttpResponse sendRequest(HttpClient httpClient, URI url) { + var id = ID.incrementAndGet(); + try { + var request = HttpRequest.newBuilder(url).GET().build(); + var response = httpClient.send(request, HttpResponse.BodyHandlers.ofString()); + // System.out.println("Got response for " + id + ": " + response); + SUCCESS.incrementAndGet(); + return response; + } catch (InterruptedException e) { + INTERRUPT.incrementAndGet(); + // System.out.println("Got interrupted for " + id + ": " + e); + throw new RuntimeException(e); + } catch (Exception e) { + FAILED.incrementAndGet(); + EXCEPTIONS.add(e); + //System.out.println("Got exception for " + id + ": " + e); + throw new RuntimeException(e); + } + } + + @AfterAll + static void tearDown() { + try { + System.gc(); + var error = TRACKER.check(5000); + if (error != null) throw error; + } finally { + ServerSocket ss; + synchronized (HttpGetInCancelledFuture.class) { + ss = NOT_ACCEPTING; + NOT_ACCEPTING = null; + } + if (ss != null) { + try { + ss.close(); + } catch (IOException io) { + throw new UncheckedIOException(io); + } + } + } + } +} + diff --git a/test/jdk/java/net/httpclient/HttpsTunnelAuthTest.java b/test/jdk/java/net/httpclient/HttpsTunnelAuthTest.java index f83118adea3f..83961453f05f 100644 --- a/test/jdk/java/net/httpclient/HttpsTunnelAuthTest.java +++ b/test/jdk/java/net/httpclient/HttpsTunnelAuthTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, 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 @@ -108,6 +108,7 @@ public class HttpsTunnelAuthTest implements HttpServerAdapters, AutoCloseable { } void setUp() throws IOException { + HttpServerAdapters.enableServerLogging(); // Creates an HTTP/1.1 Server that will authenticate for // arthur with password dent http1Server = DigestEchoServer.createServer(Version.HTTP_1_1, @@ -143,10 +144,8 @@ void setUp() throws IOException { // Creates a proxy selector that unconditionally select the // above proxy. - var ps = proxySelector = ProxySelector.of(proxy.getProxyAddress()); + proxySelector = ProxySelector.of(proxy.getProxyAddress()); - // Creates a client that uses the above proxy selector - client = newHttpClient(ps); } @Override @@ -177,23 +176,26 @@ public static void main(String[] args) throws Exception { try (HttpsTunnelAuthTest test = new HttpsTunnelAuthTest()) { test.setUp(); - // tests proxy and server authentication through: - // - plain proxy connection to plain HTTP/1.1 server, - test.test(Version.HTTP_1_1, "http", "/foo/http1"); + try (HttpClient client = test.newHttpClient(test.proxySelector)) { + // tests proxy and server authentication through: + // - plain proxy connection to plain HTTP/1.1 server, + test.test(client, Version.HTTP_1_1, "http", "/foo/http1"); + } // can't really test plain proxy connection to plain HTTP/2 server: // this is not supported: we downgrade to HTTP/1.1 in that case // so that is actually somewhat equivalent to the first case: // therefore we will use a new client to force re-authentication // of the proxy connection. - test.client = test.newHttpClient(test.proxySelector); - test.test(Version.HTTP_2, "http", "/foo/http2"); + try (HttpClient client = test.newHttpClient(test.proxySelector)) { + test.test(client, Version.HTTP_2, "http", "/foo/http2"); - // - proxy tunnel SSL connection to HTTP/1.1 server - test.test(Version.HTTP_1_1, "https", "/foo/https1"); + // - proxy tunnel SSL connection to HTTP/1.1 server + test.test(client, Version.HTTP_1_1, "https", "/foo/https1"); - // - proxy tunnel SSl connection to HTTP/2 server - test.test(Version.HTTP_2, "https", "/foo/https2"); + // - proxy tunnel SSl connection to HTTP/2 server + test.test(client, Version.HTTP_2, "https", "/foo/https2"); + } } } @@ -227,14 +229,14 @@ Version expectedVersion(String scheme, Version version) { return "http".equals(scheme) ? Version.HTTP_1_1 : version; } - public void test(Version version, String scheme, String path) throws Exception { + public void test(HttpClient client, Version version, String scheme, String path) throws Exception { System.out.printf("%nTesting %s, %s, %s%n", version, scheme, path); DigestEchoServer server = server(scheme, version); try { URI uri = jdk.test.lib.net.URIBuilder.newBuilder() .scheme(scheme) - .host("localhost") + .loopback() .port(server.getServerAddress().getPort()) .path(path).build(); diff --git a/test/jdk/java/net/httpclient/ProxySelectorTest.java b/test/jdk/java/net/httpclient/ProxySelectorTest.java index fd8f85fa6d7d..a5407801bcdc 100644 --- a/test/jdk/java/net/httpclient/ProxySelectorTest.java +++ b/test/jdk/java/net/httpclient/ProxySelectorTest.java @@ -376,7 +376,7 @@ public void setup() throws Exception { public void teardown() throws Exception { client = null; Thread.sleep(100); - AssertionError fail = TRACKER.check(500); + AssertionError fail = TRACKER.check(1500); try { proxy.stop(); authproxy.stop(); diff --git a/test/jdk/java/net/httpclient/ReferenceTracker.java b/test/jdk/java/net/httpclient/ReferenceTracker.java index 51dc1f405373..d7e16d01201e 100644 --- a/test/jdk/java/net/httpclient/ReferenceTracker.java +++ b/test/jdk/java/net/httpclient/ReferenceTracker.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2023, 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 @@ -254,6 +254,11 @@ public AssertionError check(Tracker tracker, } long duration = Duration.ofNanos(System.nanoTime() - waitStart).toMillis(); if (hasOutstanding.test(tracker)) { + if (i == 0 && waited == 0) { + // we found nothing and didn't wait expecting success, but then found + // something. Respin to make sure we wait. + return check(tracker, graceDelayMs, hasOutstanding, description, printThreads); + } StringBuilder warnings = diagnose(tracker, new StringBuilder(), hasOutstanding); if (hasOutstanding.test(tracker)) { fail = new AssertionError(warnings.toString()); @@ -310,6 +315,11 @@ public AssertionError check(long graceDelayMs, } long duration = Duration.ofNanos(System.nanoTime() - waitStart).toMillis(); if (TRACKERS.stream().anyMatch(hasOutstanding)) { + if (i == 0 && waited == 0) { + // we found nothing and didn't wait expecting success, but then found + // something. Respin to make sure we wait. + return check(graceDelayMs, hasOutstanding, description, printThreads); + } StringBuilder warnings = diagnose(new StringBuilder(), hasOutstanding); addSummary(warnings); if (TRACKERS.stream().anyMatch(hasOutstanding)) { diff --git a/test/jdk/java/net/httpclient/ShutdownNow.java b/test/jdk/java/net/httpclient/ShutdownNow.java index 3fa2f37615e5..e498446a3aeb 100644 --- a/test/jdk/java/net/httpclient/ShutdownNow.java +++ b/test/jdk/java/net/httpclient/ShutdownNow.java @@ -30,6 +30,7 @@ * isTerminated. * @library /test/lib /test/jdk/java/net/httpclient/lib * @build jdk.httpclient.test.lib.http2.Http2TestServer jdk.test.lib.net.SimpleSSLContext + * jdk.test.lib.RandomFactory jdk.test.lib.Utils * ReferenceTracker * @run testng/othervm * -Djdk.internal.httpclient.debug=true @@ -41,8 +42,6 @@ import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; -import java.net.InetAddress; -import java.net.InetSocketAddress; import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpClient.Redirect; @@ -58,20 +57,12 @@ import java.util.concurrent.CompletionException; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ExecutionException; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; -import java.util.concurrent.RejectedExecutionException; -import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicLong; import jdk.httpclient.test.lib.common.HttpServerAdapters; -import jdk.httpclient.test.lib.http2.Http2TestServer; import javax.net.ssl.SSLContext; -import javax.net.ssl.SSLHandshakeException; -import com.sun.net.httpserver.HttpServer; -import com.sun.net.httpserver.HttpsConfigurator; -import com.sun.net.httpserver.HttpsServer; import jdk.test.lib.RandomFactory; +import jdk.test.lib.Utils; import jdk.test.lib.net.SimpleSSLContext; import org.testng.annotations.AfterTest; import org.testng.annotations.BeforeTest; @@ -211,7 +202,7 @@ void testConcurrent(String uriString) throws Exception { } CompletableFuture.allOf(responses.toArray(new CompletableFuture[0])).get(); } finally { - if (client.awaitTermination(Duration.ofMillis(2000))) { + if (client.awaitTermination(Duration.ofMillis(Utils.adjustTimeout(1000)))) { out.println("Client terminated within expected delay"); } else { throw new AssertionError("client still running"); @@ -273,7 +264,7 @@ void testSequential(String uriString) throws Exception { }).thenCompose((c) -> c).get(); } } finally { - if (client.awaitTermination(Duration.ofMillis(2000))) { + if (client.awaitTermination(Duration.ofMillis(Utils.adjustTimeout(1000)))) { out.println("Client terminated within expected delay"); } else { throw new AssertionError("client still running"); diff --git a/test/jdk/java/net/httpclient/http2/ConnectionFlowControlTest.java b/test/jdk/java/net/httpclient/http2/ConnectionFlowControlTest.java new file mode 100644 index 000000000000..30cc9122d9dc --- /dev/null +++ b/test/jdk/java/net/httpclient/http2/ConnectionFlowControlTest.java @@ -0,0 +1,369 @@ +/* + * Copyright (c) 2024, 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 8342075 + * @summary checks connection flow control + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.httpclient.test.lib.http2.Http2TestServer jdk.test.lib.net.SimpleSSLContext + * @run testng/othervm -Djdk.internal.httpclient.debug=true + * -Djdk.httpclient.connectionWindowSize=65535 + * -Djdk.httpclient.windowsize=16384 + * ConnectionFlowControlTest + */ + +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.ProtocolException; +import java.net.URI; +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.BodyHandler; +import java.net.http.HttpResponse.BodyHandlers; +import java.net.http.HttpResponse.BodySubscriber; +import java.net.http.HttpResponse.ResponseInfo; +import java.nio.ByteBuffer; +import java.nio.charset.StandardCharsets; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.Map.Entry; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.CompletionStage; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Flow.Subscription; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.function.BiFunction; +import java.util.function.Consumer; +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLSession; + +import jdk.httpclient.test.lib.common.HttpServerAdapters.HttpTestServer; +import jdk.httpclient.test.lib.http2.BodyOutputStream; +import jdk.httpclient.test.lib.http2.Http2Handler; +import jdk.httpclient.test.lib.http2.Http2TestExchange; +import jdk.httpclient.test.lib.http2.Http2TestExchangeImpl; +import jdk.httpclient.test.lib.http2.Http2TestServer; +import jdk.httpclient.test.lib.http2.Http2TestServerConnection; +import jdk.internal.net.http.common.HttpHeadersBuilder; +import jdk.internal.net.http.frame.ContinuationFrame; +import jdk.internal.net.http.frame.HeaderFrame; +import jdk.internal.net.http.frame.HeadersFrame; +import jdk.internal.net.http.frame.Http2Frame; +import jdk.internal.net.http.frame.SettingsFrame; +import jdk.test.lib.Utils; +import jdk.test.lib.net.SimpleSSLContext; +import org.testng.annotations.AfterTest; +import org.testng.annotations.BeforeTest; +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; + +import static java.util.List.of; +import static java.util.Map.entry; +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertNotEquals; +import static org.testng.Assert.assertTrue; +import static org.testng.Assert.fail; + +public class ConnectionFlowControlTest { + + SSLContext sslContext; + HttpTestServer http2TestServer; // HTTP/2 ( h2c ) + HttpTestServer https2TestServer; // HTTP/2 ( h2 ) + String http2URI; + String https2URI; + final AtomicInteger reqid = new AtomicInteger(); + + + @DataProvider(name = "variants") + public Object[][] variants() { + return new Object[][] { + { http2URI }, + { https2URI }, + }; + } + + @Test(dataProvider = "variants") + void test(String uri) throws Exception { + System.out.printf("%ntesting %s%n", uri); + ConcurrentHashMap> responseSent = new ConcurrentHashMap<>(); + ConcurrentHashMap> responses = new ConcurrentHashMap<>(); + FCHttp2TestExchange.setResponseSentCB((s) -> responseSent.get(s).complete(s)); + int connectionWindowSize = Math.max(Integer.getInteger( + "jdk.httpclient.connectionWindowSize", 65535), 65535); + int windowSize = Math.max(Integer.getInteger( + "jdk.httpclient.windowsize", 65535), 16384); + int max = connectionWindowSize / windowSize + 2; + System.out.printf("connection window: %s, stream window: %s, will make %s requests%n", + connectionWindowSize, windowSize, max); + + try (HttpClient client = HttpClient.newBuilder().sslContext(sslContext).build()) { + String label = null; + + Throwable t = null; + try { + String[] keys = new String[max]; + for (int i = 0; i < max; i++) { + String query = "reqId=" + reqid.incrementAndGet(); + keys[i] = query; + URI uriWithQuery = URI.create(uri + "?" + query); + CompletableFuture sent = new CompletableFuture<>(); + responseSent.put(query, sent); + HttpRequest request = HttpRequest.newBuilder(uriWithQuery) + .POST(BodyPublishers.ofString("Hello there!")) + .build(); + System.out.println("\nSending request:" + uriWithQuery); + final HttpClient cc = client; + var response = cc.send(request, BodyHandlers.ofInputStream()); + responses.put(query, response); + String ckey = response.headers().firstValue("X-Connection-Key").get(); + if (label == null) label = ckey; + try { + if (i < max - 1) { + // the connection window might be exceeded at i == max - 2, which + // means that the last request could go on a new connection. + assertEquals(ckey, label, "Unexpected key for " + query); + } + } catch (AssertionError ass) { + // since we won't pull all responses, the client + // will not exit unless we ask it to shutdown now. + client.shutdownNow(); + throw ass; + } + } + try { + Thread.sleep(1000); + } catch (InterruptedException ie) { + // ignore + } + CompletableFuture allsent = CompletableFuture.allOf(responseSent.values().stream() + .toArray(CompletableFuture[]::new)); + allsent.get(); + for (int i = 0; i < max; i++) { + try { + String query = keys[i]; + var response = responses.get(keys[i]); + String ckey = response.headers().firstValue("X-Connection-Key").get(); + if (label == null) label = ckey; + if (i < max - 1) { + // the connection window might be exceeded at i == max - 2, which + // means that the last request could go on a new connection. + assertEquals(ckey, label, "Unexpected key for " + query); + } + int wait = uri.startsWith("https://") ? 500 : 250; + try (InputStream is = response.body()) { + Thread.sleep(Utils.adjustTimeout(wait)); + is.readAllBytes(); + } + System.out.printf("%s did not fail: %s%n", query, response.statusCode()); + } catch (AssertionError t1) { + // since we won't pull all responses, the client + // will not exit unless we ask it to shutdown now. + client.shutdownNow(); + throw t1; + } catch (Throwable t0) { + System.out.println("Got EXPECTED: " + t0); + if (t0 instanceof ExecutionException) { + t0 = t0.getCause(); + } + t = t0; + try { + assertDetailMessage(t0, i); + } catch (AssertionError e) { + // since we won't pull all responses, the client + // will not exit unless we ask it to shutdown now. + client.shutdownNow(); + throw e; + } + } + } + } catch (Throwable t0) { + System.out.println("Got EXPECTED: " + t0); + if (t0 instanceof ExecutionException) { + t0 = t0.getCause(); + } + t = t0; + } + if (t == null) { + // we could fail here if we haven't waited long enough + fail("Expected exception, got all responses, should sleep time be raised?"); + } else { + assertDetailMessage(t, max); + } + String query = "reqId=" + reqid.incrementAndGet(); + URI uriWithQuery = URI.create(uri + "?" + query); + CompletableFuture sent = new CompletableFuture<>(); + responseSent.put(query, sent); + HttpRequest request = HttpRequest.newBuilder(uriWithQuery) + .POST(BodyPublishers.ofString("Hello there!")) + .build(); + System.out.println("\nSending last request:" + uriWithQuery); + var response = client.send(request, BodyHandlers.ofString()); + if (label != null) { + String ckey = response.headers().firstValue("X-Connection-Key").get(); + assertNotEquals(ckey, label); + System.out.printf("last request %s sent on different connection as expected:" + + "\n\tlast: %s\n\tprevious: %s%n", query, ckey, label); + } + } + } + + // Assertions based on implementation specific detail messages. Keep in + // sync with implementation. + static void assertDetailMessage(Throwable throwable, int iterationIndex) { + try { + Throwable cause = throwable; + while (cause != null) { + if (cause instanceof ProtocolException) { + if (cause.getMessage().contains("connection window exceeded")) { + System.out.println("Found expected exception: " + cause); + return; + } + } + cause = cause.getCause(); + } + throw new AssertionError( + "ProtocolException(\"protocol error: connection window exceeded\") not found", + throwable); + } catch (AssertionError e) { + System.out.println("Exception does not match expectation: " + throwable); + throwable.printStackTrace(System.out); + throw e; + } + } + + @BeforeTest + public void setup() throws Exception { + sslContext = new SimpleSSLContext().get(); + if (sslContext == null) + throw new AssertionError("Unexpected null sslContext"); + + var http2TestServer = new Http2TestServer("localhost", false, 0); + http2TestServer.addHandler(new Http2TestHandler(), "/http2/"); + this.http2TestServer = HttpTestServer.of(http2TestServer); + http2URI = "http://" + this.http2TestServer.serverAuthority() + "/http2/x"; + + var https2TestServer = new Http2TestServer("localhost", true, sslContext); + https2TestServer.addHandler(new Http2TestHandler(), "/https2/"); + this.https2TestServer = HttpTestServer.of(https2TestServer); + https2URI = "https://" + this.https2TestServer.serverAuthority() + "/https2/x"; + + // Override the default exchange supplier with a custom one to enable + // particular test scenarios + http2TestServer.setExchangeSupplier(FCHttp2TestExchange::new); + https2TestServer.setExchangeSupplier(FCHttp2TestExchange::new); + + this.http2TestServer.start(); + this.https2TestServer.start(); + } + + @AfterTest + public void teardown() throws Exception { + http2TestServer.stop(); + https2TestServer.stop(); + } + + static class Http2TestHandler implements Http2Handler { + + @Override + public void handle(Http2TestExchange t) throws IOException { + String query = t.getRequestURI().getRawQuery(); + + try (InputStream is = t.getRequestBody(); + OutputStream os = t.getResponseBody()) { + + byte[] bytes = is.readAllBytes(); + System.out.println("Server " + t.getLocalAddress() + " received:\n" + + t.getRequestURI() + ": " + new String(bytes, StandardCharsets.UTF_8)); + t.getResponseHeaders().setHeader("X-Connection-Key", t.getConnectionKey()); + + if (bytes.length == 0) bytes = "no request body!".getBytes(StandardCharsets.UTF_8); + int window = Math.max(16384, Integer.getInteger("jdk.httpclient.windowsize", 2*16*1024)); + final int maxChunkSize; + if (t instanceof FCHttp2TestExchange fct) { + maxChunkSize = Math.min(window, fct.conn.getMaxFrameSize()); + } else { + maxChunkSize = Math.min(window, SettingsFrame.MAX_FRAME_SIZE); + } + byte[] resp = bytes.length < maxChunkSize + ? bytes + : Arrays.copyOfRange(bytes, 0, maxChunkSize); + int max = (window / resp.length); + // send in chunks + t.sendResponseHeaders(200, 0); + int sent = 0; + for (int i=0; i<=max; i++) { + int len = Math.min(resp.length, window - sent); + if (len <= 0) break; + if (os instanceof BodyOutputStream bos) { + try { + // we don't wait for the stream window, but we want + // to wait for the connection window + bos.waitForStreamWindow(len); + } catch (InterruptedException ie) { + // ignore and continue... + } + } + ((BodyOutputStream) os).writeUncontrolled(resp, 0, len); + sent += len; + } + if (sent != window) fail("should have sent %s, sent %s".formatted(window, sent)); + } + if (t instanceof FCHttp2TestExchange fct) { + fct.responseSent(query); + } else { + fail("Exchange is not %s but %s" + .formatted(FCHttp2TestExchange.class.getName(), t.getClass().getName())); + } + } + } + + // A custom Http2TestExchangeImpl that overrides sendResponseHeaders to + // allow headers to be sent with a number of CONTINUATION frames. + static class FCHttp2TestExchange extends Http2TestExchangeImpl { + static volatile Consumer responseSentCB; + static void setResponseSentCB(Consumer responseSentCB) { + FCHttp2TestExchange.responseSentCB = responseSentCB; + } + + final Http2TestServerConnection conn; + FCHttp2TestExchange(int streamid, String method, HttpHeaders reqheaders, + HttpHeadersBuilder rspheadersBuilder, URI uri, InputStream is, + SSLSession sslSession, BodyOutputStream os, + Http2TestServerConnection conn, boolean pushAllowed) { + super(streamid, method, reqheaders, rspheadersBuilder, uri, is, sslSession, os, conn, pushAllowed); + this.conn = conn; + } + public void responseSent(String query) { + System.out.println("Server: response sent for " + query); + responseSentCB.accept(query); + } + + } +} diff --git a/test/jdk/java/net/httpclient/http2/H2GoAwayTest.java b/test/jdk/java/net/httpclient/http2/H2GoAwayTest.java new file mode 100644 index 000000000000..755bb2e16cc1 --- /dev/null +++ b/test/jdk/java/net/httpclient/http2/H2GoAwayTest.java @@ -0,0 +1,336 @@ +/* + * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.io.IOException; +import java.io.OutputStream; +import java.net.URI; +import java.net.http.HttpClient; +import java.net.http.HttpRequest; +import java.net.http.HttpResponse; +import java.net.http.HttpResponse.BodyHandlers; +import java.util.ArrayList; +import java.util.LinkedHashSet; +import java.util.List; +import java.util.Map; +import java.util.Random; +import java.util.Set; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Future; +import java.util.concurrent.atomic.AtomicInteger; + +import javax.net.ssl.SSLContext; + +import jdk.httpclient.test.lib.common.HttpServerAdapters.HttpTestExchange; +import jdk.httpclient.test.lib.common.HttpServerAdapters.HttpTestHandler; +import jdk.httpclient.test.lib.common.HttpServerAdapters.HttpTestServer; +import jdk.test.lib.net.SimpleSSLContext; +import jdk.test.lib.net.URIBuilder; +import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import static java.net.http.HttpClient.Version.HTTP_2; +import static java.nio.charset.StandardCharsets.UTF_8; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.fail; + +/* + * @test + * @bug 8335181 + * @summary verify that the HttpClient correctly handles incoming GOAWAY frames and + * retries any unprocessed requests on a new connection + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.httpclient.test.lib.common.HttpServerAdapters + * jdk.test.lib.net.SimpleSSLContext + * @run junit H2GoAwayTest + */ +public class H2GoAwayTest { + private static final String REQ_PATH = "/test"; + private static HttpTestServer server; + private static String REQ_URI_BASE; + private static SSLContext sslCtx; + + @BeforeAll + static void beforeAll() throws Exception { + sslCtx = new SimpleSSLContext().get(); + assertNotNull(sslCtx, "SSLContext couldn't be created"); + server = HttpTestServer.create(HTTP_2, sslCtx); + server.addHandler(new Handler(), REQ_PATH); + server.start(); + System.out.println("Server started at " + server.getAddress()); + REQ_URI_BASE = URIBuilder.newBuilder().scheme("https") + .loopback() + .port(server.getAddress().getPort()) + .path(REQ_PATH) + .build().toString(); + } + + @AfterAll + static void afterAll() { + if (server != null) { + System.out.println("Stopping server at " + server.getAddress()); + server.stop(); + } + } + + /** + * Verifies that when several requests are sent using send() and the server + * connection is configured to send a GOAWAY after processing only a few requests, then + * the remaining requests are retried on a different connection + */ + @Test + public void testSequential() throws Exception { + final LimitedPerConnRequestApprover reqApprover = new LimitedPerConnRequestApprover(); + server.setRequestApprover(reqApprover::allowNewRequest); + try (final HttpClient client = HttpClient.newBuilder().version(HTTP_2) + .sslContext(sslCtx).build()) { + final String[] reqMethods = {"HEAD", "GET", "POST"}; + for (final String reqMethod : reqMethods) { + final int numReqs = LimitedPerConnRequestApprover.MAX_REQS_PER_CONN + 3; + final Set connectionKeys = new LinkedHashSet<>(); + for (int i = 1; i <= numReqs; i++) { + final URI reqURI = new URI(REQ_URI_BASE + "?seq&" + reqMethod + "=" + i); + final HttpRequest req = HttpRequest.newBuilder() + .uri(reqURI) + .method(reqMethod, HttpRequest.BodyPublishers.noBody()) + .build(); + System.out.println("initiating request " + req); + final HttpResponse resp = client.send(req, BodyHandlers.ofString()); + final String respBody = resp.body(); + System.out.println("received response: " + respBody); + assertEquals(200, resp.statusCode(), + "unexpected status code for request " + resp.request()); + // response body is the logical key of the connection on which the + // request was handled + connectionKeys.add(respBody); + } + System.out.println("connections involved in handling the requests: " + + connectionKeys); + // all requests have finished, we now just do a basic check that + // more than one connection was involved in processing these requests + assertEquals(2, connectionKeys.size(), + "unexpected number of connections " + connectionKeys); + } + } finally { + server.setRequestApprover(null); // reset + } + } + + /** + * Verifies that when a server responds with a GOAWAY and then never processes the new retried + * requests on a new connection too, then the application code receives the request failure. + * This tests the send() API of the HttpClient. + */ + @Test + public void testUnprocessedRaisesException() throws Exception { + try (final HttpClient client = HttpClient.newBuilder().version(HTTP_2) + .sslContext(sslCtx).build()) { + final Random random = new Random(); + final String[] reqMethods = {"HEAD", "GET", "POST"}; + for (final String reqMethod : reqMethods) { + final int maxAllowedReqs = 2; + final int numReqs = maxAllowedReqs + 3; // 3 more requests than max allowed + // configure the approver + final LimitedRequestApprover reqApprover = new LimitedRequestApprover(maxAllowedReqs); + server.setRequestApprover(reqApprover::allowNewRequest); + try { + int numSuccess = 0; + int numFailed = 0; + for (int i = 1; i <= numReqs; i++) { + final String reqQueryPart = "?sync&" + reqMethod + "=" + i; + final URI reqURI = new URI(REQ_URI_BASE + reqQueryPart); + final HttpRequest req = HttpRequest.newBuilder() + .uri(reqURI) + .method(reqMethod, HttpRequest.BodyPublishers.noBody()) + .build(); + System.out.println("initiating request " + req); + if (i <= maxAllowedReqs) { + // expected to successfully complete + numSuccess++; + final HttpResponse resp = client.send(req, BodyHandlers.ofString()); + final String respBody = resp.body(); + System.out.println("received response: " + respBody); + assertEquals(200, resp.statusCode(), + "unexpected status code for request " + resp.request()); + } else { + // expected to fail as unprocessed + try { + final HttpResponse resp = client.send(req, BodyHandlers.ofString()); + fail("Request was expected to fail as unprocessed," + + " but got response: " + resp.body() + ", status code: " + + resp.statusCode()); + } catch (IOException ioe) { + // verify it failed for the right reason + if (ioe.getMessage() == null + || !ioe.getMessage().contains("request not processed by peer")) { + // propagate the original failure + throw ioe; + } + numFailed++; // failed due to right reason + System.out.println("received expected failure: " + ioe + + ", for request " + reqURI); + } + } + } + // verify the correct number of requests succeeded/failed + assertEquals(maxAllowedReqs, numSuccess, "unexpected number of requests succeeded"); + assertEquals((numReqs - maxAllowedReqs), numFailed, "unexpected number of requests failed"); + } finally { + server.setRequestApprover(null); // reset + } + } + } + } + + /** + * Verifies that when a server responds with a GOAWAY and then never processes the new retried + * requests on a new connection too, then the application code receives the request failure. + * This tests the sendAsync() API of the HttpClient. + */ + @Test + public void testUnprocessedRaisesExceptionAsync() throws Throwable { + try (final HttpClient client = HttpClient.newBuilder().version(HTTP_2) + .sslContext(sslCtx).build()) { + final Random random = new Random(); + final String[] reqMethods = {"HEAD", "GET", "POST"}; + for (final String reqMethod : reqMethods) { + final int maxAllowedReqs = 2; + final int numReqs = maxAllowedReqs + 3; // 3 more requests than max allowed + // configure the approver + final LimitedRequestApprover reqApprover = new LimitedRequestApprover(maxAllowedReqs); + server.setRequestApprover(reqApprover::allowNewRequest); + try { + final List>> futures = new ArrayList<>(); + for (int i = 1; i <= numReqs; i++) { + final URI reqURI = new URI(REQ_URI_BASE + "?async&" + reqMethod + "=" + i); + final HttpRequest req = HttpRequest.newBuilder() + .uri(reqURI) + .method(reqMethod, HttpRequest.BodyPublishers.noBody()) + .build(); + System.out.println("initiating request " + req); + final Future> f = client.sendAsync(req, BodyHandlers.ofString()); + futures.add(f); + } + // wait for responses + int numFailed = 0; + int numSuccess = 0; + for (int i = 1; i <= numReqs; i++) { + final String reqQueryPart = "?async&" + reqMethod + "=" + i; + try { + System.out.println("waiting response of request " + + REQ_URI_BASE + reqQueryPart); + final HttpResponse resp = futures.get(i - 1).get(); + numSuccess++; + final String respBody = resp.body(); + System.out.println("request: " + resp.request() + + ", received response: " + respBody); + assertEquals(200, resp.statusCode(), + "unexpected status code for request " + resp.request()); + } catch (ExecutionException ee) { + final Throwable cause = ee.getCause(); + if (!(cause instanceof IOException ioe)) { + throw cause; + } + // verify it failed for the right reason + if (ioe.getMessage() == null + || !ioe.getMessage().contains("request not processed by peer")) { + // propagate the original failure + throw ioe; + } + numFailed++; // failed due to the right reason + System.out.println("received expected failure: " + ioe + + ", for request " + REQ_URI_BASE + reqQueryPart); + } + } + // verify the correct number of requests succeeded/failed + assertEquals(maxAllowedReqs, numSuccess, "unexpected number of requests succeeded"); + assertEquals((numReqs - maxAllowedReqs), numFailed, "unexpected number of requests failed"); + } finally { + server.setRequestApprover(null); // reset + } + } + } + } + + // only allows fixed number of requests, irrespective of which server connection handles + // it. requests that are rejected will either be sent a GOAWAY on the connection + // or a RST_FRAME with a REFUSED_STREAM on the stream + private static final class LimitedRequestApprover { + private final int maxAllowedReqs; + private final AtomicInteger numApproved = new AtomicInteger(); + + private LimitedRequestApprover(final int maxAllowedReqs) { + this.maxAllowedReqs = maxAllowedReqs; + } + + public boolean allowNewRequest(final String serverConnKey) { + final int approved = numApproved.incrementAndGet(); + return approved <= maxAllowedReqs; + } + } + + // allows a certain number of requests per server connection. + // requests that are rejected will either be sent a GOAWAY on the connection + // or a RST_FRAME with a REFUSED_STREAM on the stream + private static final class LimitedPerConnRequestApprover { + private static final int MAX_REQS_PER_CONN = 6; + private final Map numApproved = + new ConcurrentHashMap<>(); + private final Map numDisapproved = + new ConcurrentHashMap<>(); + + public boolean allowNewRequest(final String serverConnKey) { + final AtomicInteger approved = numApproved.computeIfAbsent(serverConnKey, + (k) -> new AtomicInteger()); + int curr = approved.get(); + while (curr < MAX_REQS_PER_CONN) { + if (approved.compareAndSet(curr, curr + 1)) { + return true; // new request allowed + } + curr = approved.get(); + } + final AtomicInteger disapproved = numDisapproved.computeIfAbsent(serverConnKey, + (k) -> new AtomicInteger()); + final int numUnprocessed = disapproved.incrementAndGet(); + System.out.println(approved.get() + " processed, " + + numUnprocessed + " unprocessed requests on connection " + serverConnKey); + return false; + } + } + + private static final class Handler implements HttpTestHandler { + + @Override + public void handle(final HttpTestExchange exchange) throws IOException { + final String connectionKey = exchange.getConnectionKey(); + System.out.println("responding to request: " + exchange.getRequestURI() + + " on connection " + connectionKey); + final byte[] response = connectionKey.getBytes(UTF_8); + exchange.sendResponseHeaders(200, response.length); + try (final OutputStream os = exchange.getResponseBody()) { + os.write(response); + } + } + } +} diff --git a/test/jdk/java/net/httpclient/http2/StreamFlowControlTest.java b/test/jdk/java/net/httpclient/http2/StreamFlowControlTest.java new file mode 100644 index 000000000000..31cc58df2a8e --- /dev/null +++ b/test/jdk/java/net/httpclient/http2/StreamFlowControlTest.java @@ -0,0 +1,386 @@ +/* + * Copyright (c) 2024, 2025, 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 8342075 8343855 + * @library /test/lib /test/jdk/java/net/httpclient/lib + * @build jdk.httpclient.test.lib.http2.Http2TestServer jdk.test.lib.net.SimpleSSLContext + * @run testng/othervm -Djdk.internal.httpclient.debug=true + * -Djdk.httpclient.connectionWindowSize=65535 + * -Djdk.httpclient.windowsize=16384 + * StreamFlowControlTest + */ + +import java.io.IOException; +import java.io.InputStream; +import java.io.InterruptedIOException; +import java.io.OutputStream; +import java.net.ProtocolException; +import java.net.URI; +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.BodyHandlers; +import java.nio.charset.StandardCharsets; +import java.util.Arrays; +import java.util.concurrent.CompletableFuture; +import java.util.concurrent.ConcurrentHashMap; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.atomic.AtomicInteger; +import java.util.function.Consumer; +import javax.net.ssl.SSLContext; +import javax.net.ssl.SSLSession; + +import jdk.httpclient.test.lib.common.HttpServerAdapters.HttpHeadOrGetHandler; +import jdk.httpclient.test.lib.common.HttpServerAdapters.HttpTestServer; +import jdk.httpclient.test.lib.http2.BodyOutputStream; +import jdk.httpclient.test.lib.http2.Http2Handler; +import jdk.httpclient.test.lib.http2.Http2TestExchange; +import jdk.httpclient.test.lib.http2.Http2TestExchangeImpl; +import jdk.httpclient.test.lib.http2.Http2TestServer; +import jdk.httpclient.test.lib.http2.Http2TestServerConnection; +import jdk.internal.net.http.common.HttpHeadersBuilder; +import jdk.internal.net.http.frame.SettingsFrame; +import jdk.test.lib.Utils; +import jdk.test.lib.net.SimpleSSLContext; +import org.testng.annotations.AfterTest; +import org.testng.annotations.BeforeTest; +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; + +import static java.util.concurrent.TimeUnit.NANOSECONDS; +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.fail; + +public class StreamFlowControlTest { + + SSLContext sslContext; + HttpTestServer http2TestServer; // HTTP/2 ( h2c ) + HttpTestServer https2TestServer; // HTTP/2 ( h2 ) + String http2URI; + String https2URI; + final AtomicInteger reqid = new AtomicInteger(); + + + @DataProvider(name = "variants") + public Object[][] variants() { + return new Object[][] { + { http2URI, false }, + { https2URI, false }, + { http2URI, true }, + { https2URI, true }, + }; + } + + static void sleep(long wait) throws InterruptedException { + if (wait <= 0) return; + long remaining = Utils.adjustTimeout(wait); + long start = System.nanoTime(); + while (remaining > 0) { + Thread.sleep(remaining); + long end = System.nanoTime(); + remaining = remaining - NANOSECONDS.toMillis(end - start); + } + System.out.printf("Waited %s ms%n", + NANOSECONDS.toMillis(System.nanoTime() - start)); + } + + + @Test(dataProvider = "variants") + void test(String uri, + boolean sameClient) + throws Exception + { + System.out.printf("%ntesting test(%s, %s)%n", uri, sameClient); + ConcurrentHashMap> responseSent = new ConcurrentHashMap<>(); + FCHttp2TestExchange.setResponseSentCB((s) -> responseSent.get(s).complete(s)); + + HttpClient client = null; + try { + int max = sameClient ? 10 : 3; + String label = null; + for (int i = 0; i < max; i++) { + if (!sameClient || client == null) + client = HttpClient.newBuilder().sslContext(sslContext).build(); + + String query = "reqId=" + reqid.incrementAndGet(); + URI uriWithQuery = URI.create(uri + "?" + query); + CompletableFuture sent = new CompletableFuture<>(); + responseSent.put(query, sent); + HttpRequest request = HttpRequest.newBuilder(uriWithQuery) + .GET() + .build(); + System.out.println("\nSending request:" + uriWithQuery); + final HttpClient cc = client; + try { + HttpResponse response = cc.send(request, BodyHandlers.ofInputStream()); + if (sameClient) { + String key = response.headers().firstValue("X-Connection-Key").get(); + if (label == null) label = key; + assertEquals(key, label, "Unexpected key for " + query); + } + sent.join(); + // we have to pull to get the exception, but slow enough + // so that DataFrames are buffered up to the point that + // the window is exceeded... + long wait = uri.startsWith("https://") ? 800 : 350; + try (InputStream is = response.body()) { + sleep(wait); + is.readAllBytes(); + } + // we could fail here if we haven't waited long enough + fail("Expected exception, got :" + response + ", should sleep time be raised?"); + } catch (IOException ioe) { + System.out.println("Got EXPECTED: " + ioe); + assertDetailMessage(ioe, i); + } finally { + if (!sameClient && client != null) { + client.close(); + client = null; + } + } + } + } finally { + if (sameClient && client != null) client.close(); + } + + } + + @Test(dataProvider = "variants") + void testAsync(String uri, + boolean sameClient) + { + System.out.printf("%ntesting testAsync(%s, %s)%n", uri, sameClient); + ConcurrentHashMap> responseSent = new ConcurrentHashMap<>(); + FCHttp2TestExchange.setResponseSentCB((s) -> responseSent.get(s).complete(s)); + + HttpClient client = null; + try { + int max = sameClient ? 5 : 3; + String label = null; + for (int i = 0; i < max; i++) { + if (!sameClient || client == null) + client = HttpClient.newBuilder().sslContext(sslContext).build(); + + String query = "reqId=" + reqid.incrementAndGet(); + URI uriWithQuery = URI.create(uri + "?" + query); + CompletableFuture sent = new CompletableFuture<>(); + responseSent.put(query, sent); + HttpRequest request = HttpRequest.newBuilder(uriWithQuery) + .GET() + .build(); + System.out.println("\nSending request:" + uriWithQuery); + final HttpClient cc = client; + + Throwable t = null; + try { + HttpResponse response = cc.sendAsync(request, BodyHandlers.ofInputStream()).get(); + if (sameClient) { + String key = response.headers().firstValue("X-Connection-Key").get(); + if (label == null) label = key; + assertEquals(key, label, "Unexpected key for " + query); + } + sent.join(); + long wait = uri.startsWith("https://") ? 800 : 350; + try (InputStream is = response.body()) { + sleep(wait); + is.readAllBytes(); + } + // we could fail here if we haven't waited long enough + fail("Expected exception, got :" + response + ", should sleep time be raised?"); + } catch (Throwable t0) { + System.out.println("Got EXPECTED: " + t0); + if (t0 instanceof ExecutionException) { + t0 = t0.getCause(); + } + t = t0; + } finally { + if (!sameClient && client != null) { + client.close(); + client = null; + } + } + assertDetailMessage(t, i); + } + } finally { + if (sameClient && client != null) client.close(); + } + } + + // Assertions based on implementation specific detail messages. Keep in + // sync with implementation. + static void assertDetailMessage(Throwable throwable, int iterationIndex) { + try { + Throwable cause = throwable; + while (cause != null) { + if (cause instanceof ProtocolException) { + if (cause.getMessage().matches("stream [0-9]+ flow control window exceeded")) { + System.out.println("Found expected exception: " + cause); + return; + } + } + cause = cause.getCause(); + } + throw new AssertionError( + "ProtocolException(\"stream X flow control window exceeded\") not found", + throwable); + } catch (AssertionError e) { + System.out.println("Exception does not match expectation: " + throwable); + throwable.printStackTrace(System.out); + throw e; + } + } + + @BeforeTest + public void setup() throws Exception { + sslContext = new SimpleSSLContext().get(); + if (sslContext == null) + throw new AssertionError("Unexpected null sslContext"); + + var http2TestServer = new Http2TestServer("localhost", false, 0); + http2TestServer.addHandler(new Http2TestHandler(), "/http2/"); + this.http2TestServer = HttpTestServer.of(http2TestServer); + http2URI = "http://" + this.http2TestServer.serverAuthority() + "/http2/x"; + + var https2TestServer = new Http2TestServer("localhost", true, sslContext); + https2TestServer.addHandler(new Http2TestHandler(), "/https2/"); + this.https2TestServer = HttpTestServer.of(https2TestServer); + this.https2TestServer.addHandler(new HttpHeadOrGetHandler(), "/https2/head/"); + https2URI = "https://" + this.https2TestServer.serverAuthority() + "/https2/x"; + String h2Head = "https://" + this.https2TestServer.serverAuthority() + "/https2/head/z"; + + // Override the default exchange supplier with a custom one to enable + // particular test scenarios + http2TestServer.setExchangeSupplier(FCHttp2TestExchange::new); + https2TestServer.setExchangeSupplier(FCHttp2TestExchange::new); + + this.http2TestServer.start(); + this.https2TestServer.start(); + + // warmup to eliminate delay due to SSL class loading and initialization. + try (var client = HttpClient.newBuilder().sslContext(sslContext).build()) { + var request = HttpRequest.newBuilder(URI.create(h2Head)).HEAD().build(); + var resp = client.send(request, BodyHandlers.discarding()); + assertEquals(resp.statusCode(), 200); + } + } + + @AfterTest + public void teardown() throws Exception { + http2TestServer.stop(); + https2TestServer.stop(); + } + + static class Http2TestHandler implements Http2Handler { + + @Override + public void handle(Http2TestExchange t) throws IOException { + String query = t.getRequestURI().getRawQuery(); + + try (InputStream is = t.getRequestBody(); + OutputStream os = t.getResponseBody()) { + + byte[] bytes = is.readAllBytes(); + if (bytes.length != 0) { + System.out.println("Server " + t.getLocalAddress() + " received:\n" + + t.getRequestURI() + ": " + new String(bytes, StandardCharsets.UTF_8)); + } else { + System.out.println("No request body for " + t.getRequestMethod()); + } + + t.getResponseHeaders().setHeader("X-Connection-Key", t.getConnectionKey()); + + if (bytes.length == 0) { + bytes = "no request body!" + .repeat(100).getBytes(StandardCharsets.UTF_8); + } + int window = Integer.getInteger("jdk.httpclient.windowsize", 2 * 16 * 1024); + final int maxChunkSize; + if (t instanceof FCHttp2TestExchange fct) { + maxChunkSize = Math.min(window, fct.conn.getMaxFrameSize()); + } else { + maxChunkSize = Math.min(window, SettingsFrame.MAX_FRAME_SIZE); + } + byte[] resp = bytes.length <= maxChunkSize + ? bytes + : Arrays.copyOfRange(bytes, 0, maxChunkSize); + int max = (window / resp.length) + 2; + // send in chunks + t.sendResponseHeaders(200, 0); + for (int i = 0; i <= max; i++) { + if (t instanceof FCHttp2TestExchange fct) { + try { + // we don't wait for the stream window, but we want + // to wait for the connection window + fct.conn.obtainConnectionWindow(resp.length); + } catch (InterruptedException ie) { + var ioe = new InterruptedIOException(ie.toString()); + ioe.initCause(ie); + throw ioe; + } + } + try { + ((BodyOutputStream) os).writeUncontrolled(resp, 0, resp.length); + } catch (IOException x) { + if (t instanceof FCHttp2TestExchange fct) { + fct.conn.updateConnectionWindow(resp.length); + } + throw x; + } + } + } finally { + if (t instanceof FCHttp2TestExchange fct) { + fct.responseSent(query); + } else { + fail("Exchange is not %s but %s" + .formatted(FCHttp2TestExchange.class.getName(), t.getClass().getName())); + } + } + } + } + + // A custom Http2TestExchangeImpl that overrides sendResponseHeaders to + // allow headers to be sent with a number of CONTINUATION frames. + static class FCHttp2TestExchange extends Http2TestExchangeImpl { + static volatile Consumer responseSentCB; + static void setResponseSentCB(Consumer responseSentCB) { + FCHttp2TestExchange.responseSentCB = responseSentCB; + } + + final Http2TestServerConnection conn; + FCHttp2TestExchange(int streamid, String method, HttpHeaders reqheaders, + HttpHeadersBuilder rspheadersBuilder, URI uri, InputStream is, + SSLSession sslSession, BodyOutputStream os, + Http2TestServerConnection conn, boolean pushAllowed) { + super(streamid, method, reqheaders, rspheadersBuilder, uri, is, sslSession, os, conn, pushAllowed); + this.conn = conn; + } + public void responseSent(String query) { + System.out.println("Server: response sent for " + query); + responseSentCB.accept(query); + } + + } +} diff --git a/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/common/HttpServerAdapters.java b/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/common/HttpServerAdapters.java index 98da7d5533f3..d095bffcd205 100644 --- a/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/common/HttpServerAdapters.java +++ b/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/common/HttpServerAdapters.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, 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 @@ -49,6 +49,7 @@ import java.net.InetSocketAddress; import java.net.URI; import java.net.http.HttpHeaders; +import java.nio.charset.StandardCharsets; import java.util.Base64; import java.util.List; import java.util.ListIterator; @@ -58,6 +59,7 @@ import java.util.Set; import java.util.concurrent.CopyOnWriteArrayList; import java.util.concurrent.ExecutorService; +import java.util.function.Predicate; import java.util.logging.Level; import java.util.logging.Logger; import java.util.stream.Collectors; @@ -65,6 +67,9 @@ import javax.net.ssl.SSLContext; +import static java.net.http.HttpClient.Version.HTTP_1_1; +import static java.net.http.HttpClient.Version.HTTP_2; + /** * Defines an adaptation layers so that a test server handlers and filters * can be implemented independently of the underlying server version. @@ -234,12 +239,13 @@ public static abstract class HttpTestExchange implements AutoCloseable { public abstract OutputStream getResponseBody(); public abstract HttpTestRequestHeaders getRequestHeaders(); public abstract HttpTestResponseHeaders getResponseHeaders(); - public abstract void sendResponseHeaders(int code, int contentLength) throws IOException; + public abstract void sendResponseHeaders(int code, long contentLength) throws IOException; public abstract URI getRequestURI(); public abstract String getRequestMethod(); public abstract void close(); public abstract InetSocketAddress getRemoteAddress(); public abstract InetSocketAddress getLocalAddress(); + public abstract String getConnectionKey(); public void serverPush(URI uri, HttpHeaders headers, byte[] body) { ByteArrayInputStream bais = new ByteArrayInputStream(body); serverPush(uri, headers, bais); @@ -254,7 +260,7 @@ public static HttpTestExchange of(HttpExchange exchange) { return new Http1TestExchange(exchange); } public static HttpTestExchange of(Http2TestExchange exchange) { - return new Http2TestExchangeImpl(exchange); + return new H2ExchangeImpl(exchange); } abstract void doFilter(Filter.Chain chain) throws IOException; @@ -266,9 +272,9 @@ private static final class Http1TestExchange extends HttpTestExchange { this.exchange = exch; } @Override - public Version getServerVersion() { return Version.HTTP_1_1; } + public Version getServerVersion() { return HTTP_1_1; } @Override - public Version getExchangeVersion() { return Version.HTTP_1_1; } + public Version getExchangeVersion() { return HTTP_1_1; } @Override public InputStream getRequestBody() { return exchange.getRequestBody(); @@ -286,7 +292,7 @@ public HttpTestResponseHeaders getResponseHeaders() { return HttpTestResponseHeaders.of(exchange.getResponseHeaders()); } @Override - public void sendResponseHeaders(int code, int contentLength) throws IOException { + public void sendResponseHeaders(int code, long contentLength) throws IOException { if (contentLength == 0) contentLength = -1; else if (contentLength < 0) contentLength = 0; exchange.sendResponseHeaders(code, contentLength); @@ -310,21 +316,27 @@ public InetSocketAddress getLocalAddress() { public URI getRequestURI() { return exchange.getRequestURI(); } @Override public String getRequestMethod() { return exchange.getRequestMethod(); } + + @Override + public String getConnectionKey() { + return exchange.getLocalAddress() + "->" + exchange.getRemoteAddress(); + } + @Override public String toString() { return this.getClass().getSimpleName() + ": " + exchange.toString(); } } - private static final class Http2TestExchangeImpl extends HttpTestExchange { + private static final class H2ExchangeImpl extends HttpTestExchange { private final Http2TestExchange exchange; - Http2TestExchangeImpl(Http2TestExchange exch) { + H2ExchangeImpl(Http2TestExchange exch) { this.exchange = exch; } @Override - public Version getServerVersion() { return Version.HTTP_2; } + public Version getServerVersion() { return HTTP_2; } @Override - public Version getExchangeVersion() { return Version.HTTP_2; } + public Version getExchangeVersion() { return HTTP_2; } @Override public InputStream getRequestBody() { return exchange.getRequestBody(); @@ -343,7 +355,7 @@ public HttpTestResponseHeaders getResponseHeaders() { return HttpTestResponseHeaders.of(exchange.getResponseHeaders()); } @Override - public void sendResponseHeaders(int code, int contentLength) throws IOException { + public void sendResponseHeaders(int code, long contentLength) throws IOException { if (contentLength == 0) contentLength = -1; else if (contentLength < 0) contentLength = 0; exchange.sendResponseHeaders(code, contentLength); @@ -371,6 +383,11 @@ public InetSocketAddress getLocalAddress() { return exchange.getLocalAddress(); } + @Override + public String getConnectionKey() { + return exchange.getConnectionKey(); + } + @Override public URI getRequestURI() { return exchange.getRequestURI(); } @Override @@ -408,6 +425,53 @@ private void doHandle(HttpTestExchange t) throws IOException { } } + /** + * An {@link HttpTestHandler} that handles only HEAD and GET + * requests. If another method is used 405 is returned with + * an empty body. + * The response is always returned with fixed length. + */ + public static class HttpHeadOrGetHandler implements HttpTestHandler { + final String responseBody; + public HttpHeadOrGetHandler() { + this("pâté de tête persillé"); + } + public HttpHeadOrGetHandler(String responseBody) { + this.responseBody = Objects.requireNonNull(responseBody); + } + + @Override + public void handle(HttpTestExchange t) throws IOException { + try (var exchg = t) { + exchg.getRequestBody().readAllBytes(); + String method = exchg.getRequestMethod(); + switch (method) { + case "HEAD" -> { + byte[] resp = responseBody.getBytes(StandardCharsets.UTF_8); + if (exchg.getExchangeVersion() != HTTP_1_1) { + // with HTTP/2 or HTTP/3 the server will not send content-length + exchg.getResponseHeaders() + .addHeader("Content-Length", String.valueOf(resp.length)); + } + exchg.sendResponseHeaders(200, resp.length); + exchg.getResponseBody().close(); + } + case "GET" -> { + byte[] resp = responseBody.getBytes(StandardCharsets.UTF_8); + exchg.sendResponseHeaders(200, resp.length); + try (var os = exchg.getResponseBody()) { + os.write(resp); + } + } + default -> { + exchg.sendResponseHeaders(405, 0); + exchg.getResponseBody().close(); + } + } + } + } + } + public static class HttpTestEchoHandler implements HttpTestHandler { @Override @@ -716,6 +780,7 @@ static void enableLogging() { public abstract HttpTestContext addHandler(HttpTestHandler handler, String root); public abstract InetSocketAddress getAddress(); public abstract Version getVersion(); + public abstract void setRequestApprover(final Predicate approver); public String serverAuthority() { InetSocketAddress address = getAddress(); @@ -863,7 +928,12 @@ public InetSocketAddress getAddress() { return new InetSocketAddress(InetAddress.getLoopbackAddress(), impl.getAddress().getPort()); } - public Version getVersion() { return Version.HTTP_1_1; } + public Version getVersion() { return HTTP_1_1; } + + @Override + public void setRequestApprover(final Predicate approver) { + throw new UnsupportedOperationException("not supported"); + } } private static class Http1TestContext extends HttpTestContext { @@ -883,7 +953,7 @@ public void addFilter(HttpTestFilter filter) { public void setAuthenticator(com.sun.net.httpserver.Authenticator authenticator) { context.setAuthenticator(authenticator); } - @Override public Version getVersion() { return Version.HTTP_1_1; } + @Override public Version getVersion() { return HTTP_1_1; } } private static class Http2TestServerImpl extends HttpTestServer { @@ -914,7 +984,12 @@ public InetSocketAddress getAddress() { return new InetSocketAddress(InetAddress.getLoopbackAddress(), impl.getAddress().getPort()); } - public Version getVersion() { return Version.HTTP_2; } + public Version getVersion() { return HTTP_2; } + + @Override + public void setRequestApprover(final Predicate approver) { + this.impl.setRequestApprover(approver); + } } private static class Http2TestContext @@ -947,7 +1022,7 @@ public void setAuthenticator(final Authenticator authenticator) { "only BasicAuthenticator is supported on HTTP/2 context"); } } - @Override public Version getVersion() { return Version.HTTP_2; } + @Override public Version getVersion() { return HTTP_2; } } } diff --git a/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/BodyOutputStream.java b/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/BodyOutputStream.java index c091b7ecf9b8..c6eee5afabfd 100644 --- a/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/BodyOutputStream.java +++ b/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/BodyOutputStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,7 @@ import java.io.*; import java.nio.ByteBuffer; +import java.util.Objects; import jdk.internal.net.http.frame.DataFrame; import jdk.internal.net.http.frame.ResetFrame; @@ -62,18 +63,28 @@ synchronized void updateWindow(int update) { } void waitForWindow(int demand) throws InterruptedException { - // first wait for the connection window + // first wait for the stream window + waitForStreamWindow(demand); + // now wait for the connection window conn.obtainConnectionWindow(demand); - // now wait for the stream window - synchronized (this) { - while (demand > 0) { - int n = Math.min(demand, window); - demand -= n; - window -= n; - if (demand > 0) { - wait(); + } + + public void waitForStreamWindow(int amount) throws InterruptedException { + int demand = amount; + try { + synchronized (this) { + while (amount > 0) { + int n = Math.min(amount, window); + amount -= n; + window -= n; + if (amount > 0) { + wait(); + } } } + } catch (Throwable t) { + window += (demand - amount); + throw t; } } @@ -83,6 +94,7 @@ public void goodToGo() { @Override public void write(byte[] buf, int offset, int len) throws IOException { + Objects.checkFromIndexSize(offset, len, buf.length); if (closed) { throw new IOException("closed"); } @@ -104,6 +116,34 @@ public void write(byte[] buf, int offset, int len) throws IOException { } } + /** + * This method pushes frames onto the stack without checking + * for flow control, allowing the sender to bypass flow + * control for testing purposes + * @param buf data to send + * @param offset offset at which the data starts + * @param len length of the data to send + * @throws IOException if an I/O error occurs + */ + public void writeUncontrolled(byte[] buf, int offset, int len) + throws IOException { + Objects.checkFromIndexSize(offset, len, buf.length); + if (closed) { + throw new IOException("closed"); + } + + if (!goodToGo) { + throw new IllegalStateException("sendResponseHeaders must be called first"); + } + int max = conn.getMaxFrameSize(); + while (len > 0) { + int n = len > max ? max : len; + send(buf, offset, n, 0); + offset += n; + len -= n; + } + } + private void send(byte[] buf, int offset, int len, int flags) throws IOException { ByteBuffer buffer = ByteBuffer.allocate(len); buffer.put(buf, offset, len); diff --git a/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/Http2TestExchange.java b/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/Http2TestExchange.java index 1a8b5d92af53..828c939f53f2 100644 --- a/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/Http2TestExchange.java +++ b/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/Http2TestExchange.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2024, 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 @@ -84,4 +84,10 @@ default void sendFrames(List frames) throws IOException { * It may also complete exceptionally */ CompletableFuture sendPing(); + + /** + * {@return the identification of the connection on which this exchange is being + * processed} + */ + String getConnectionKey(); } diff --git a/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/Http2TestExchangeImpl.java b/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/Http2TestExchangeImpl.java index 0abcd51af636..c867b8bf040f 100644 --- a/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/Http2TestExchangeImpl.java +++ b/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/Http2TestExchangeImpl.java @@ -227,6 +227,11 @@ public void serverPush(URI uri, HttpHeaders headers, InputStream content) { } } + @Override + public String getConnectionKey() { + return conn.connectionKey(); + } + private boolean isHeadRequest() { return HEAD.equalsIgnoreCase(getRequestMethod()); } diff --git a/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/Http2TestServer.java b/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/Http2TestServer.java index ffa05d5c11c3..ca7e7d3dc300 100644 --- a/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/Http2TestServer.java +++ b/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/Http2TestServer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,6 +32,8 @@ import java.util.concurrent.ThreadFactory; import java.util.concurrent.atomic.AtomicLong; import java.util.concurrent.atomic.AtomicReference; +import java.util.function.Predicate; + import javax.net.ServerSocketFactory; import javax.net.ssl.SSLContext; import javax.net.ssl.SSLParameters; @@ -59,6 +61,8 @@ public class Http2TestServer implements AutoCloseable { final Set connections; final Properties properties; final String name; + // request approver which takes the server connection key as the input + private volatile Predicate newRequestApprover; private static ThreadFactory defaultThreadFac = (Runnable r) -> { @@ -285,6 +289,14 @@ public String serverName() { return serverName; } + public void setRequestApprover(final Predicate approver) { + this.newRequestApprover = approver; + } + + Predicate getRequestApprover() { + return this.newRequestApprover; + } + private synchronized void putConnection(InetSocketAddress addr, Http2TestServerConnection c) { if (!stopping) connections.add(c); diff --git a/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/Http2TestServerConnection.java b/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/Http2TestServerConnection.java index b087a0372221..1428bb0db410 100644 --- a/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/Http2TestServerConnection.java +++ b/test/jdk/java/net/httpclient/lib/jdk/httpclient/test/lib/http2/Http2TestServerConnection.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, 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 @@ -77,15 +77,19 @@ import java.util.Optional; import java.util.Properties; import java.util.Random; +import java.util.Set; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ConcurrentLinkedQueue; import java.util.concurrent.ExecutorService; +import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.locks.ReentrantLock; import java.util.function.BiPredicate; import java.util.function.Consumer; +import java.util.function.Predicate; import static java.nio.charset.StandardCharsets.ISO_8859_1; import static java.nio.charset.StandardCharsets.UTF_8; +import static jdk.internal.net.http.frame.ErrorFrame.REFUSED_STREAM; import static jdk.internal.net.http.frame.SettingsFrame.DEFAULT_MAX_FRAME_SIZE; import static jdk.internal.net.http.frame.SettingsFrame.HEADER_TABLE_SIZE; @@ -115,6 +119,10 @@ public class Http2TestServerConnection { volatile boolean stopping; volatile int nextPushStreamId = 2; ConcurrentLinkedQueue pings = new ConcurrentLinkedQueue<>(); + // the max stream id of a processed H2 request. -1 implies none were processed. + private final AtomicInteger maxProcessedRequestStreamId = new AtomicInteger(-1); + // the stream id that was sent in a GOAWAY frame. -1 implies no GOAWAY frame was sent. + private final AtomicInteger goAwayRequestStreamId = new AtomicInteger(-1); final static ByteBuffer EMPTY_BUFFER = ByteBuffer.allocate(0); final static byte[] EMPTY_BARRAY = new byte[0]; @@ -163,7 +171,7 @@ void fail(Throwable t) { Properties properties) throws IOException { - System.err.println("TestServer: New connection from " + socket); + System.err.println(server.name + ": New connection from " + socket); if (socket instanceof SSLSocket) { SSLSocket sslSocket = (SSLSocket)socket; @@ -210,10 +218,10 @@ private SettingsFrame getServerSettingProperties() { String prop = properties.getProperty(propPrefix + key); if (prop != null) { try { - System.err.println("TestServer: setting " + key + " property to: " + + System.err.println(server.name + ": setting " + key + " property to: " + prop); int num = Integer.parseInt(numS); - System.err.println("TestServer: num = " + num); + System.err.println(server.name + ": num = " + num); s.setParameter(num, Integer.parseInt(prop)); } catch (NumberFormatException e) {/* ignore errors */} } @@ -239,11 +247,29 @@ CompletableFuture sendPing() { return ping.response(); } - void goAway(int error) throws IOException { - int laststream = nextstream >= 3 ? nextstream - 2 : 1; - - GoAwayFrame go = new GoAwayFrame(laststream, error); - outputQ.put(go); + private void sendGoAway(final int error) throws IOException { + int maxProcessedStreamId = maxProcessedRequestStreamId.get(); + if (maxProcessedStreamId == -1) { + maxProcessedStreamId = 0; + } + boolean send = false; + int currentGoAwayReqStrmId = goAwayRequestStreamId.get(); + // update the last processed stream id and send a goaway frame if the new last processed + // stream id is lesser than the last processed stream id sent in + // a previous goaway frame (if any) + while (currentGoAwayReqStrmId == -1 || maxProcessedStreamId < currentGoAwayReqStrmId) { + if (goAwayRequestStreamId.compareAndSet(currentGoAwayReqStrmId, maxProcessedStreamId)) { + send = true; + break; + } + currentGoAwayReqStrmId = goAwayRequestStreamId.get(); + } + if (!send) { + return; + } + final GoAwayFrame frame = new GoAwayFrame(maxProcessedStreamId, error); + outputQ.put(frame); + System.err.println(server.name + ": Sending GOAWAY frame " + frame + " from server connection " + this); } /** @@ -259,7 +285,7 @@ private PingRequest getNextRequest() { */ void handlePing(PingFrame ping) throws IOException { if (ping.streamid() != 0) { - System.err.println("Invalid ping received"); + System.err.println(server.name + ": Invalid ping received"); close(ErrorFrame.PROTOCOL_ERROR); return; } @@ -267,7 +293,7 @@ void handlePing(PingFrame ping) throws IOException { // did we send a Ping? PingRequest request = getNextRequest(); if (request == null) { - System.err.println("Invalid ping ACK received"); + System.err.println(server.name + ": Invalid ping ACK received"); close(ErrorFrame.PROTOCOL_ERROR); return; } else if (!Arrays.equals(request.pingData, ping.getData())) { @@ -330,14 +356,15 @@ void close(int error) { if (stopping) return; stopping = true; - System.err.printf("Server connection to %s stopping. %d streams\n", + System.err.printf(server.name + ": Server connection to %s stopping. %d streams\n", socket.getRemoteSocketAddress().toString(), streams.size()); streams.forEach((i, q) -> { q.orderlyClose(); }); try { - if (error != -1) - goAway(error); + if (error != -1) { + sendGoAway(error); + } outputQ.orderlyClose(); socket.close(); } catch (Exception e) { @@ -349,16 +376,20 @@ private void readPreface() throws IOException { byte[] bytes = new byte[len]; int n = is.readNBytes(bytes, 0, len); if (Arrays.compare(clientPreface, bytes) != 0) { - System.err.printf("Invalid preface: read %d/%d bytes%n", n, len); - throw new IOException("Invalid preface: " + - new String(bytes, 0, len, ISO_8859_1)); + String msg = String.format("Invalid preface: read %s/%s bytes", n, len); + System.err.println(server.name + ": " + msg); + throw new IOException(msg +": \"" + + new String(bytes, 0, n, ISO_8859_1) + .replace("\r", "\\r") + .replace("\n", "\\n") + + "\""); } } Http1InitialRequest doUpgrade(Http1InitialRequest upgrade) throws IOException { String h2c = getHeader(upgrade.headers, "Upgrade"); if (h2c == null || !h2c.equals("h2c")) { - System.err.println("Server:HEADERS: " + upgrade); + System.err.println(server.name + ":HEADERS: " + upgrade); throw new IOException("Bad upgrade 1 " + h2c); } @@ -430,7 +461,7 @@ void run() throws Exception { socket.close(); return; } else { - System.err.println("Server:HEADERS: " + upgrade); + System.err.println(server.name + ":HEADERS: " + upgrade); throw new IOException("Bad upgrade 1 " + h2c); } } @@ -529,7 +560,7 @@ private void handleCommonFrame(Http2Frame f) throws IOException { outputQ.put(frame); return; } else if (f instanceof GoAwayFrame) { - System.err.println("Closing: "+ f.toString()); + System.err.println(server.name + ": Closing connection: "+ f.toString()); close(ErrorFrame.NO_ERROR); } else if (f instanceof PingFrame) { handlePing((PingFrame)f); @@ -619,6 +650,14 @@ void createPrimordialStream(Http1InitialRequest request) throws IOException { path = path + "?" + uri.getRawQuery(); headersBuilder.setHeader(":path", path); + // skip processing the request if configured to do so + final String connKey = connectionKey(); + if (!shouldProcessNewHTTPRequest(connKey)) { + System.err.println(server.name + ": Rejecting primordial stream 1 and sending GOAWAY" + + " on server connection " + connKey + ", for request: " + path); + sendGoAway(ErrorFrame.NO_ERROR); + return; + } Queue q = new Queue(sentinel); byte[] body = getRequestBody(request); addHeaders(getHeaders(request.headers), headersBuilder); @@ -627,11 +666,24 @@ void createPrimordialStream(Http1InitialRequest request) throws IOException { addRequestBodyToQueue(body, q); streams.put(1, q); + maxProcessedRequestStreamId.set(1); exec.submit(() -> { handleRequest(headers, q, 1, true /*complete request has been read*/); }); } + private boolean shouldProcessNewHTTPRequest(final String serverConnKey) { + final Predicate approver = this.server.getRequestApprover(); + if (approver == null) { + return true; // process the request + } + return approver.test(serverConnKey); + } + + final String connectionKey() { + return this.server.getAddress() + "->" + this.socket.getRemoteSocketAddress(); + } + // all other streams created here @SuppressWarnings({"rawtypes","unchecked"}) void createStream(HeaderFrame frame) throws IOException { @@ -639,7 +691,7 @@ void createStream(HeaderFrame frame) throws IOException { frames.add(frame); int streamid = frame.streamid(); if (streamid != nextstream) { - throw new IOException("unexpected stream id"); + throw new IOException("unexpected stream id: " + streamid); } nextstream += 2; @@ -670,12 +722,30 @@ void createStream(HeaderFrame frame) throws IOException { throw new IOException("Unexpected Upgrade in headers:" + headers); } disallowedHeader = headers.firstValue("HTTP2-Settings"); - if (disallowedHeader.isPresent()) + if (disallowedHeader.isPresent()) { throw new IOException("Unexpected HTTP2-Settings in headers:" + headers); + } - + // skip processing the request if the server is configured to do so + final String connKey = connectionKey(); + final String path = headers.firstValue(":path").orElse(""); + if (!shouldProcessNewHTTPRequest(connKey)) { + System.err.println(server.name + ": Rejecting stream " + streamid + + " and sending GOAWAY on server connection " + + connKey + ", for request: " + path); + sendGoAway(ErrorFrame.NO_ERROR); + return; + } Queue q = new Queue(sentinel); streams.put(streamid, q); + // keep track of the largest request id that we have processed + int currentLargest = maxProcessedRequestStreamId.get(); + while (streamid > currentLargest) { + if (maxProcessedRequestStreamId.compareAndSet(currentLargest, streamid)) { + break; + } + currentLargest = maxProcessedRequestStreamId.get(); + } exec.submit(() -> { handleRequest(headers, q, streamid, endStreamReceived); }); @@ -698,17 +768,17 @@ void handleRequest(HttpHeaders headers, //System.out.println("scheme = " + scheme); String authority = headers.firstValue(":authority").orElse(""); //System.out.println("authority = " + authority); - System.err.printf("TestServer: %s %s\n", method, path); + System.err.printf(server.name + ": %s %s\n", method, path); int winsize = clientSettings.getParameter( SettingsFrame.INITIAL_WINDOW_SIZE); //System.err.println ("Stream window size = " + winsize); final InputStream bis; if (endStreamReceived && queue.size() == 0) { - System.err.println("Server: got END_STREAM for stream " + streamid); + System.err.println(server.name + ": got END_STREAM for stream " + streamid); bis = NullInputStream.INSTANCE; } else { - System.err.println("Server: creating input stream for stream " + streamid); + System.err.println(server.name + ": creating input stream for stream " + streamid); bis = new BodyInputStream(queue, streamid, this); } try (bis; @@ -736,7 +806,7 @@ headers, rspheadersBuilder, uri, bis, getSSLSession(), if (bos.closed) { Queue q = streams.get(streamid); if (q != null && (q.isClosed() || q.isClosing())) { - System.err.println("TestServer: Stream " + streamid + " closed: " + closed); + System.err.println(server.name + ": Stream " + streamid + " closed: " + closed); return; } } @@ -746,7 +816,7 @@ headers, rspheadersBuilder, uri, bis, getSSLSession(), // everything happens in the exchange from here. Hopefully will // return though. } catch (Throwable e) { - System.err.println("TestServer: handleRequest exception: " + e); + System.err.println(server.name + ": handleRequest exception: " + e); e.printStackTrace(); close(-1); } @@ -778,6 +848,8 @@ void readLoop() { while (!stopping) { Http2Frame frame = readFrameImpl(); if (frame == null) { + System.err.println(server.name + ": EOF reached on connection " + connectionKey() + + ", will no longer accept incoming frames"); closeIncoming(); return; } @@ -797,15 +869,27 @@ void readLoop() { Queue q = streams.get(stream); if (frame.type() == HeadersFrame.TYPE) { if (q != null) { - System.err.println("HEADERS frame for existing stream! Error."); + System.err.println(server.name + ": HEADERS frame for existing stream! Error."); // TODO: close connection continue; } else { + final int streamId = frame.streamid(); + final int finalProcessedStreamId = goAwayRequestStreamId.get(); + // if we already sent a goaway, then don't create new streams with + // higher stream ids. + if (finalProcessedStreamId != -1 && streamId > finalProcessedStreamId) { + System.err.println(server.name + ": " + connectionKey() + + " resetting stream " + streamId + + " as REFUSED_STREAM"); + final ResetFrame rst = new ResetFrame(streamId, REFUSED_STREAM); + outputQ.put(rst); + continue; + } createStream((HeadersFrame) frame); } } else { if (q == null && !pushStreams.contains(stream)) { - System.err.printf("Non Headers frame received with"+ + System.err.printf(server.name + ": Non Headers frame received with"+ " non existing stream (%d) ", frame.streamid()); System.err.println(frame); continue; @@ -835,21 +919,21 @@ void readLoop() { } else if (isClientStreamId(stream) && stream < next) { // We may receive a reset on a client stream that has already // been closed. Just ignore it. - System.err.println("TestServer: received ResetFrame on closed stream: " + stream); + System.err.println(server.name + ": received ResetFrame on closed stream: " + stream); System.err.println(frame); } else if (isServerStreamId(stream) && stream < nextPush) { // We may receive a reset on a push stream that has already // been closed. Just ignore it. - System.err.println("TestServer: received ResetFrame on closed push stream: " + stream); + System.err.println(server.name + ": received ResetFrame on closed push stream: " + stream); System.err.println(frame); } else { - System.err.println("TestServer: Unexpected frame on: " + stream); + System.err.println(server.name + ": Unexpected frame on: " + stream); System.err.println(frame); throw new IOException("Unexpected frame"); } } else { if (!q.putIfOpen(frame)) { - System.err.printf("Stream %s is closed: dropping %s%n", + System.err.printf(server.name + ": Stream %s is closed: dropping %s%n", stream, frame); } } @@ -858,7 +942,7 @@ void readLoop() { } } catch (Throwable e) { if (!stopping) { - System.err.println("Http server reader thread shutdown"); + System.err.println(server.name + ": Http server reader thread shutdown"); e.printStackTrace(); } close(ErrorFrame.PROTOCOL_ERROR); @@ -999,7 +1083,7 @@ void writeLoop() { : new ContinuationFrame(rh.streamid(), flags, list); if (Log.headers()) { // avoid too much chatter: log only if Log.headers() is enabled - System.err.println("TestServer writing " + hf); + System.err.println(server.name + ": writing " + hf); } writeFrame(hf); cont++; @@ -1009,7 +1093,7 @@ void writeLoop() { } else writeFrame(frame); } - System.err.println("TestServer: Connection writer stopping"); + System.err.println(server.name + ": Connection writer stopping " + connectionKey()); } catch (Throwable e) { e.printStackTrace(); /*close(); @@ -1061,7 +1145,7 @@ public void sendEndStream() throws IOException { ii.transferTo(oo); } catch (Throwable ex) { - System.err.printf("TestServer: pushing response error: %s\n", + System.err.printf(server.name + ": pushing response error: %s\n", ex.toString()); } finally { closeIgnore(ii); @@ -1224,7 +1308,7 @@ Http1InitialRequest readHttp1Request() throws IOException { } return new Http1InitialRequest(headers, buf); } catch (IOException e) { - System.err.println("TestServer: headers read: [ " + headers + " ]"); + System.err.println(server.name + ": headers read: [ " + headers + " ]"); throw e; } } @@ -1256,7 +1340,7 @@ void sendHttp1Response(int code, String msg, String... headers) throws IOExcepti } private void unexpectedFrame(Http2Frame frame) { - System.err.println("OOPS. Unexpected"); + System.err.println(server.name + ": OOPS. Unexpected"); assert false; } @@ -1295,19 +1379,45 @@ void registerStreamWindowUpdater(int streamid, Consumer r) { * * @param amount */ - synchronized void obtainConnectionWindow(int amount) throws InterruptedException { - while (amount > 0) { - int n = Math.min(amount, sendWindow); - amount -= n; - sendWindow -= n; - if (amount > 0) - wait(); + public synchronized void obtainConnectionWindow(int amount) throws InterruptedException { + int demand = amount; + try { + int waited = 0; + while (amount > 0) { + int n = Math.min(amount, sendWindow); + amount -= n; + sendWindow -= n; + if (amount > 0) { + // Do not include this print line on a version that does not have + // JDK-8337395 + System.err.printf("%s: blocked waiting for %s connection window, obtained %s%n", + server.name, amount, demand - amount); + waited++; + wait(); + } + } + if (waited > 0) { + // Do not backport this print line on a version that does not have + // JDK-8337395 + System.err.printf("%s: obtained %s connection window, remaining %s%n", + server.name, demand, sendWindow); + } + assert amount == 0; + } catch (Throwable t) { + sendWindow += (demand - amount); + throw t; } } - synchronized void updateConnectionWindow(int amount) { - sendWindow += amount; - notifyAll(); + public void updateConnectionWindow(int amount) { + synchronized (this) { + // Do not backport this print line on a version that does not have + // JDK-8337395 + System.err.printf(server.name + ": update sendWindow (window=%s, amount=%s) is now: %s%n", + sendWindow, amount, sendWindow + amount); + sendWindow += amount; + notifyAll(); + } } // simplified output headers class. really just a type safe container diff --git a/test/jdk/java/net/httpclient/offline/FixedResponseHttpClient.java b/test/jdk/java/net/httpclient/offline/FixedResponseHttpClient.java index 76e32f04186a..255f99a2e1c5 100644 --- a/test/jdk/java/net/httpclient/offline/FixedResponseHttpClient.java +++ b/test/jdk/java/net/httpclient/offline/FixedResponseHttpClient.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, 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 @@ -209,8 +209,11 @@ public HttpClient.Version version() { if (obp.isPresent()) { ConsumingSubscriber subscriber = new ConsumingSubscriber(); obp.get().subscribe(subscriber); + // wait for our subscriber to be completed and get the + // list of ByteBuffers it received. + var buffers = subscriber.getBuffers().join(); if (responseBodyBytes == ECHO_SENTINAL) { - responseBody = subscriber.buffers; + responseBody = buffers; } } @@ -246,6 +249,13 @@ public HttpClient.Version version() { */ private static class ConsumingSubscriber implements Flow.Subscriber { final List buffers = Collections.synchronizedList(new ArrayList<>()); + // A CompletableFuture that will be completed with a list of ByteBuffers that the + // ConsumingSubscriber has consumed. + final CompletableFuture> consumed = new CompletableFuture<>(); + + public final CompletableFuture> getBuffers() { + return consumed; + } @Override public void onSubscribe(Flow.Subscription subscription) { @@ -256,9 +266,9 @@ public void onSubscribe(Flow.Subscription subscription) { buffers.add(item.duplicate()); } - @Override public void onError(Throwable throwable) { assert false : "Unexpected"; } + @Override public void onError(Throwable throwable) { consumed.completeExceptionally(throwable); } - @Override public void onComplete() { /* do nothing */ } + @Override public void onComplete() { consumed.complete(buffers.stream().toList()); } } @Override diff --git a/test/jdk/java/net/ipv6tests/TcpTest.java b/test/jdk/java/net/ipv6tests/TcpTest.java index e0ee7e49dc5d..0ca35737a767 100644 --- a/test/jdk/java/net/ipv6tests/TcpTest.java +++ b/test/jdk/java/net/ipv6tests/TcpTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, 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 @@ -36,6 +36,7 @@ import java.net.*; import java.io.*; +import java.util.concurrent.TimeUnit; public class TcpTest extends Tests { static ServerSocket server, server1, server2; @@ -193,13 +194,14 @@ static void test3 () throws Exception { server = new ServerSocket (0); server.setSoTimeout (5000); int port = server.getLocalPort(); - long t1 = System.currentTimeMillis(); + long t1 = System.nanoTime(); try { server.accept (); throw new RuntimeException ("accept should not have returned"); } catch (SocketTimeoutException e) {} - t1 = System.currentTimeMillis() - t1; - checkTime (t1, 5000); + t1 = TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - t1); + final long expectedTime = TimeUnit.SECONDS.toMillis(5); + checkIfTimeOut(TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - t1), expectedTime); c1 = new Socket (); c1.connect (new InetSocketAddress (ia4addr, port), 1000); diff --git a/test/jdk/java/net/ipv6tests/Tests.java b/test/jdk/java/net/ipv6tests/Tests.java index 7a6917a60382..21cc83571ae3 100644 --- a/test/jdk/java/net/ipv6tests/Tests.java +++ b/test/jdk/java/net/ipv6tests/Tests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, 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 @@ -151,19 +151,14 @@ public static void comparePackets (DatagramPacket p1, DatagramPacket p2) } } - /* check the time got is within 50% of the time expected */ - public static void checkTime (long got, long expected) { - checkTime(got, expected, expected); - } - /* check the time got is between start and end, given 50% tolerance */ - public static void checkTime(long got, long start, long end) { - dprintln("checkTime: got = " + got + " start = " + start + " end = " + end); - long upper = end + (end / 2); - long lower = start - (start / 2); - if (got > upper || got < lower) { - throw new RuntimeException("checkTime failed: got " + got - + ", expected between " + start + " and " + end); + /* check the timeout breached lower bound time rule */ + public static void checkIfTimeOut(long got, long expected) { + dprintln("checkIfTimeOut: got = " + got + " lower bound = " + expected); + + if (got < expected) { + throw new RuntimeException("checkIfTimeOut failed: got " + got + + ", expected at least " + expected ); } } diff --git a/test/jdk/java/net/ipv6tests/UdpTest.java b/test/jdk/java/net/ipv6tests/UdpTest.java index 8986af74ff45..6139db85407d 100644 --- a/test/jdk/java/net/ipv6tests/UdpTest.java +++ b/test/jdk/java/net/ipv6tests/UdpTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, 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 @@ -41,6 +41,7 @@ import java.net.InetAddress; import java.net.PortUnreachableException; import java.net.SocketTimeoutException; +import java.util.concurrent.TimeUnit; public class UdpTest extends Tests { static DatagramSocket c3, s1, s2, s3; @@ -138,26 +139,27 @@ static void test2 () throws Exception { s1 = new DatagramSocket (); s2 = new DatagramSocket (); s1.setSoTimeout (4000); - long t1 = System.currentTimeMillis(); + long t1 = System.nanoTime(); try { s1.receive (new DatagramPacket (new byte [128], 128)); throw new Exception ("expected receive timeout "); } catch (SocketTimeoutException e) { } - checkTime (System.currentTimeMillis() - t1, 4000); + final long expectedTime = TimeUnit.SECONDS.toMillis(4); + checkIfTimeOut(TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - t1), expectedTime); /* check data can be exchanged now */ simpleDataExchange (s1, ia6addr, s2, ia4addr); /* double check timeout still works */ - t1 = System.currentTimeMillis(); + t1 = System.nanoTime(); try { s1.receive (new DatagramPacket (new byte [128], 128)); throw new Exception ("expected receive timeout "); } catch (SocketTimeoutException e) { } - checkTime (System.currentTimeMillis() - t1, 4000); + checkIfTimeOut(TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - t1), expectedTime); /* check receive works after a delay < timeout */ @@ -174,9 +176,10 @@ public void run () { } catch (Exception e) {} } }); - t1 = System.currentTimeMillis(); + t1 = System.nanoTime(); s1.receive (new DatagramPacket (new byte [128], 128)); - checkTime (System.currentTimeMillis() - t1, 2000, 10000); + final long startTime = TimeUnit.SECONDS.toMillis(2); + checkIfTimeOut(TimeUnit.NANOSECONDS.toMillis(System.nanoTime() - t1), startTime); s1.close (); s2.close (); System.out.println ("Test2: OK"); diff --git a/test/jdk/java/net/spi/InetAddressResolverProvider/lib/test.library/testlib/ResolutionRegistry.java b/test/jdk/java/net/spi/InetAddressResolverProvider/lib/test.library/testlib/ResolutionRegistry.java index 019b2603c856..de7f2c5fd122 100644 --- a/test/jdk/java/net/spi/InetAddressResolverProvider/lib/test.library/testlib/ResolutionRegistry.java +++ b/test/jdk/java/net/spi/InetAddressResolverProvider/lib/test.library/testlib/ResolutionRegistry.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/net/vthread/BlockingSocketOps.java b/test/jdk/java/net/vthread/BlockingSocketOps.java index d9ae36fbb77d..1093557edcad 100644 --- a/test/jdk/java/net/vthread/BlockingSocketOps.java +++ b/test/jdk/java/net/vthread/BlockingSocketOps.java @@ -685,7 +685,7 @@ static class Connection implements Closeable { Socket s1 = new Socket(); Socket s2; try { - s1.connect(listener.getLocalSocketAddress(), 10_000); + s1.connect(listener.getLocalSocketAddress()); s2 = listener.accept(); } catch (IOException ioe) { s1.close(); diff --git a/test/jdk/java/nio/channels/Channels/CloseWriterOnFailedFlush.java b/test/jdk/java/nio/channels/Channels/CloseWriterOnFailedFlush.java new file mode 100644 index 000000000000..fc5b17308678 --- /dev/null +++ b/test/jdk/java/nio/channels/Channels/CloseWriterOnFailedFlush.java @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2023, 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 8136895 + * @summary Verify channel closed after write error in StreamEncoder::implClose + */ + +import java.io.IOException; +import java.io.Writer; +import java.nio.ByteBuffer; +import java.nio.channels.Channels; +import java.nio.channels.WritableByteChannel; +import java.nio.charset.MalformedInputException; +import java.nio.charset.StandardCharsets; + +public class CloseWriterOnFailedFlush { + private static final String STR_IOE = "Test"; // IOException + private static final String STR_MIE = "\ud83c"; // MalformedInputException + + public static void main(String[] args) throws IOException { + boolean failed = false; + + for (String s : new String[] {STR_IOE, STR_MIE}) { + System.out.println("string: " + s); + ErroringByteChannel channel = new ErroringByteChannel(); + try (Writer writer = Channels.newWriter + (channel, StandardCharsets.UTF_8.newEncoder(), -1 )) { + writer.write(s); + } catch (IOException ex) { + Class exClass = ex.getClass(); + if (s.equals(STR_IOE) && exClass != IOException.class || + s.equals(STR_MIE) && exClass != MalformedInputException.class) + throw ex; + } + + if (channel.isOpen()) { + System.err.println("Channel is STILL open"); + failed = true; + } else { + System.out.println("Channel is closed"); + } + } + + if (failed) + throw new RuntimeException("Test failed"); + } + + private static class ErroringByteChannel implements WritableByteChannel { + private boolean open = true; + + @Override + public int write(ByteBuffer src) throws IOException { + throw new IOException(); + } + + @Override + public boolean isOpen() { + return open; + } + + @Override + public void close() { + open = false; + System.out.println("Closing"); + } + } +} diff --git a/test/jdk/java/nio/channels/FileChannel/BlockDeviceSize.java b/test/jdk/java/nio/channels/FileChannel/BlockDeviceSize.java index 415e1e52aad1..8597f9a02af3 100644 --- a/test/jdk/java/nio/channels/FileChannel/BlockDeviceSize.java +++ b/test/jdk/java/nio/channels/FileChannel/BlockDeviceSize.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,7 +25,10 @@ * @bug 8054029 8313368 * @requires (os.family == "linux") * @summary FileChannel.size() should be equal to RandomAccessFile.size() and > 0 for block devs on Linux + * @comment The test must be launched with sudo or the block devices listed in + * the BLK_FNAMES array must be readable by the user running the test. * @library /test/lib + * @run main/manual BlockDeviceSize */ import java.io.RandomAccessFile; diff --git a/test/jdk/java/nio/channels/vthread/BlockingChannelOps.java b/test/jdk/java/nio/channels/vthread/BlockingChannelOps.java index bf35fe22aee1..4432570a661e 100644 --- a/test/jdk/java/nio/channels/vthread/BlockingChannelOps.java +++ b/test/jdk/java/nio/channels/vthread/BlockingChannelOps.java @@ -808,7 +808,7 @@ static class Connection implements Closeable { SocketChannel sc1 = SocketChannel.open(); SocketChannel sc2 = null; try { - sc1.socket().connect(listener.getLocalAddress(), 10_000); + sc1.socket().connect(listener.getLocalAddress()); sc2 = listener.accept(); } catch (IOException ioe) { sc1.close(); diff --git a/test/jdk/java/nio/file/Files/probeContentType/Basic.java b/test/jdk/java/nio/file/Files/probeContentType/Basic.java index aee1b19a01db..a82269c6c566 100644 --- a/test/jdk/java/nio/file/Files/probeContentType/Basic.java +++ b/test/jdk/java/nio/file/Files/probeContentType/Basic.java @@ -39,7 +39,6 @@ import java.util.stream.Stream; import jdk.internal.util.OperatingSystem; -import jdk.internal.util.OSVersion; import jdk.internal.util.StaticProperty; /** @@ -189,18 +188,8 @@ public static void main(String[] args) throws IOException { exTypes.add(new ExType("xlsx", List.of("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"))); exTypes.add(new ExType("wasm", List.of("application/wasm"))); - // extensions with content type that differs on Windows 11+ and - // Windows Server 2025 - if (OperatingSystem.isWindows() && - (StaticProperty.osName().matches("^.*[11|2025]$") || - new OSVersion(10, 0).compareTo(OSVersion.current()) > 0)) { - System.out.println("Windows 11+ detected: using different types"); - exTypes.add(new ExType("bz2", List.of("application/bz2", "application/x-bzip2", "application/x-bzip", "application/x-compressed"))); - exTypes.add(new ExType("csv", List.of("text/csv", "application/vnd.ms-excel"))); - exTypes.add(new ExType("rar", List.of("application/rar", "application/vnd.rar", "application/x-rar", "application/x-rar-compressed", "application/x-compressed"))); - exTypes.add(new ExType("rtf", List.of("application/rtf", "text/rtf", "application/msword"))); - exTypes.add(new ExType("7z", List.of("application/x-7z-compressed", "application/x-compressed"))); - } else { + // extensions with consistent content type on Unix (but not on Windows) + if (!OperatingSystem.isWindows()) { exTypes.add(new ExType("bz2", List.of("application/bz2", "application/x-bzip2", "application/x-bzip"))); exTypes.add(new ExType("csv", List.of("text/csv"))); exTypes.add(new ExType("rar", List.of("application/rar", "application/vnd.rar", "application/x-rar", "application/x-rar-compressed"))); diff --git a/test/jdk/java/security/AccessController/DoPrivAccomplice.java b/test/jdk/java/security/AccessController/DoPrivAccomplice.java index 6cc2846deee3..bb58809918e3 100644 --- a/test/jdk/java/security/AccessController/DoPrivAccomplice.java +++ b/test/jdk/java/security/AccessController/DoPrivAccomplice.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/security/AccessController/DoPrivAccompliceTest.java b/test/jdk/java/security/AccessController/DoPrivAccompliceTest.java index a004b4afc9d2..d7a924e00664 100644 --- a/test/jdk/java/security/AccessController/DoPrivAccompliceTest.java +++ b/test/jdk/java/security/AccessController/DoPrivAccompliceTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/security/AccessController/DoPrivTest.java b/test/jdk/java/security/AccessController/DoPrivTest.java index 9ed0f97d000e..6bc319b9a9fd 100644 --- a/test/jdk/java/security/AccessController/DoPrivTest.java +++ b/test/jdk/java/security/AccessController/DoPrivTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/security/KeyFactory/Failover.java b/test/jdk/java/security/KeyFactory/Failover.java index 7107ef1ad028..3fd69a3cbc32 100644 --- a/test/jdk/java/security/KeyFactory/Failover.java +++ b/test/jdk/java/security/KeyFactory/Failover.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ /** * @test * @bug 4894125 7054918 8130181 - * @library ../testlibrary /test/lib + * @library /test/lib * @summary test that failover for KeyFactory works * @author Andreas Sterbenz */ @@ -32,8 +32,8 @@ import java.util.*; import java.security.*; -import java.security.interfaces.*; import java.security.spec.*; +import jdk.test.lib.security.ProvidersSnapshot; import jdk.test.lib.security.SecurityUtils; public class Failover { diff --git a/test/jdk/java/security/KeyPairGenerator/Failover.java b/test/jdk/java/security/KeyPairGenerator/Failover.java index 7fc8da8ccfc3..1bc2bfee2c8d 100644 --- a/test/jdk/java/security/KeyPairGenerator/Failover.java +++ b/test/jdk/java/security/KeyPairGenerator/Failover.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ /** * @test * @bug 4894125 7054918 8130181 - * @library ../testlibrary + * @library /test/lib * @summary test that failover for KeyPairGenerator works * @author Andreas Sterbenz */ @@ -32,8 +32,8 @@ import java.util.*; import java.security.*; -import java.security.interfaces.*; import java.security.spec.*; +import jdk.test.lib.security.ProvidersSnapshot; public class Failover { diff --git a/test/jdk/java/security/KeyStore/PKCS12/CheckDefaults.java b/test/jdk/java/security/KeyStore/PKCS12/CheckDefaults.java index ddab5b5380cb..7c4db3c13914 100644 --- a/test/jdk/java/security/KeyStore/PKCS12/CheckDefaults.java +++ b/test/jdk/java/security/KeyStore/PKCS12/CheckDefaults.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/security/KeyStore/PKCS12/EntryProtectionTest.java b/test/jdk/java/security/KeyStore/PKCS12/EntryProtectionTest.java index 1bc38609a8ce..4b931d4faa63 100644 --- a/test/jdk/java/security/KeyStore/PKCS12/EntryProtectionTest.java +++ b/test/jdk/java/security/KeyStore/PKCS12/EntryProtectionTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/security/KeyStore/PKCS12/KeytoolWriteP12Test.java b/test/jdk/java/security/KeyStore/PKCS12/KeytoolWriteP12Test.java index e73f8aca360a..514ad6c6ddcd 100644 --- a/test/jdk/java/security/KeyStore/PKCS12/KeytoolWriteP12Test.java +++ b/test/jdk/java/security/KeyStore/PKCS12/KeytoolWriteP12Test.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/security/KeyStore/PKCS12/MetadataEmptyTest.java b/test/jdk/java/security/KeyStore/PKCS12/MetadataEmptyTest.java index 5e023b4731f9..e3be859556dd 100644 --- a/test/jdk/java/security/KeyStore/PKCS12/MetadataEmptyTest.java +++ b/test/jdk/java/security/KeyStore/PKCS12/MetadataEmptyTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/security/KeyStore/PKCS12/MetadataStoreLoadTest.java b/test/jdk/java/security/KeyStore/PKCS12/MetadataStoreLoadTest.java index d202628f18b7..302031d89539 100644 --- a/test/jdk/java/security/KeyStore/PKCS12/MetadataStoreLoadTest.java +++ b/test/jdk/java/security/KeyStore/PKCS12/MetadataStoreLoadTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/security/KeyStore/PKCS12/StoreTrustedCertAPITest.java b/test/jdk/java/security/KeyStore/PKCS12/StoreTrustedCertAPITest.java index 1e45bafea85c..335aa8d8da44 100644 --- a/test/jdk/java/security/KeyStore/PKCS12/StoreTrustedCertAPITest.java +++ b/test/jdk/java/security/KeyStore/PKCS12/StoreTrustedCertAPITest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/security/KeyStore/PKCS12/StoreTrustedCertKeytool.java b/test/jdk/java/security/KeyStore/PKCS12/StoreTrustedCertKeytool.java index 745ad215731b..c66fca70bb94 100644 --- a/test/jdk/java/security/KeyStore/PKCS12/StoreTrustedCertKeytool.java +++ b/test/jdk/java/security/KeyStore/PKCS12/StoreTrustedCertKeytool.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/security/KeyStore/PKCS12/Utils.java b/test/jdk/java/security/KeyStore/PKCS12/Utils.java index 22131390d060..7fab279a67d3 100644 --- a/test/jdk/java/security/KeyStore/PKCS12/Utils.java +++ b/test/jdk/java/security/KeyStore/PKCS12/Utils.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/security/Provider/ChangeProviders.java b/test/jdk/java/security/Provider/ChangeProviders.java index 2c699cd70b1a..7c408d70fb62 100644 --- a/test/jdk/java/security/Provider/ChangeProviders.java +++ b/test/jdk/java/security/Provider/ChangeProviders.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,14 +24,13 @@ /* * @test * @bug 4856968 7054918 8130181 - * @library ../testlibrary + * @library /test/lib * @summary make sure add/insert/removeProvider() work correctly * @author Andreas Sterbenz */ -import java.util.*; - import java.security.*; +import jdk.test.lib.security.ProvidersSnapshot; public class ChangeProviders extends Provider { diff --git a/test/jdk/java/security/Provider/GetInstance.java b/test/jdk/java/security/Provider/GetInstance.java index d0d6417f02b0..f0e1a149f5cb 100644 --- a/test/jdk/java/security/Provider/GetInstance.java +++ b/test/jdk/java/security/Provider/GetInstance.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ /* * @test * @bug 4856968 7054918 8130181 - * @library ../testlibrary + * @library /test/lib * @summary make sure getInstance() works correctly, including failover * and delayed provider selection for Signatures * @author Andreas Sterbenz @@ -34,6 +34,7 @@ import java.security.*; import java.security.cert.*; +import jdk.test.lib.security.ProvidersSnapshot; public class GetInstance { diff --git a/test/jdk/java/security/Provider/GetServiceRace.java b/test/jdk/java/security/Provider/GetServiceRace.java index 7f3f6b56ff72..427d555d3756 100644 --- a/test/jdk/java/security/Provider/GetServiceRace.java +++ b/test/jdk/java/security/Provider/GetServiceRace.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,6 @@ /* * @test * @bug 8231387 - * @library ../testlibrary * @summary make sure getService() avoids a race * @author Tianmin Shi */ diff --git a/test/hotspot/jtreg/vmTestbase/vm/share/process/StreamMessageOutput.java b/test/jdk/java/security/Provider/InvalidServiceTest.java similarity index 53% rename from test/hotspot/jtreg/vmTestbase/vm/share/process/StreamMessageOutput.java rename to test/jdk/java/security/Provider/InvalidServiceTest.java index 473ccc071f9a..fd56e6b3286d 100644 --- a/test/hotspot/jtreg/vmTestbase/vm/share/process/StreamMessageOutput.java +++ b/test/jdk/java/security/Provider/InvalidServiceTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2025, 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,37 +20,30 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package vm.share.process; -import java.io.OutputStream; -import java.io.PrintStream; -import java.io.IOException; -import nsk.share.TestFailure; - -public class StreamMessageOutput implements MessageOutput { - private OutputStream out; - private PrintStream pout; - - public StreamMessageOutput() { - } - - public StreamMessageOutput(OutputStream out) { - bind(out); - } +/* + * @test + * @bug 8344361 + * @summary Restore null return for invalid services + */ - public void bind(OutputStream out) { - this.out = out; - this.pout = new PrintStream(out, true); // Autoflush is important - } +import java.security.Provider; - public void start() { - } +public class InvalidServiceTest { - public void send(String msg) { - pout.println(msg); - } + public static void main(String[] args) throws Exception { + Provider p1 = new LProvider("LegacyFormat"); + // this returns a service with null class name. Helps exercise the code path + Provider.Service s1 = p1.getService("MessageDigest", "SHA-1"); + if (s1 != null) + throw new RuntimeException("expecting null service"); + } - public void finish() { - pout.close(); + private static class LProvider extends Provider { + LProvider(String name) { + super(name, "1.0", null); + put("Signature.MD5withRSA", "com.foo.Sig"); + put("MessageDigest.SHA-1 ImplementedIn", "Software"); } + } } diff --git a/test/jdk/java/security/Provider/RemoveProvider.java b/test/jdk/java/security/Provider/RemoveProvider.java index 05ab5eb0549c..9983aa59b2a8 100644 --- a/test/jdk/java/security/Provider/RemoveProvider.java +++ b/test/jdk/java/security/Provider/RemoveProvider.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,13 +24,14 @@ /* * @test * @bug 4190873 7054918 8130181 - * @library ../testlibrary + * @library /test/lib * @summary Make sure provider instance can be removed from list of registered * providers, and "entrySet", "keySet", and "values" methods don't loop * indefinitely. */ import java.security.*; import java.util.*; +import jdk.test.lib.security.ProvidersSnapshot; public class RemoveProvider { diff --git a/test/jdk/java/security/Security/ClassLoaderDeadlock/ClassLoaderDeadlock.java b/test/jdk/java/security/Security/ClassLoaderDeadlock/ClassLoaderDeadlock.java index f5af071654c6..d2794e70a2d9 100644 --- a/test/jdk/java/security/Security/ClassLoaderDeadlock/ClassLoaderDeadlock.java +++ b/test/jdk/java/security/Security/ClassLoaderDeadlock/ClassLoaderDeadlock.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,7 +21,14 @@ * questions. */ -// See bug 5094825 / ClassLoadDeadlock.sh +/* +* @test +* @bug 5094825 +* @summary verify no deadlock if crypto provider in other classloader is used to verify signed jars +* @library ./Deadlock.jar +* @compile provider/HashProvider.java +* @run main/othervm/timeout=30 ClassLoaderDeadlock +*/ import java.net.*; diff --git a/test/jdk/java/security/Security/ClassLoaderDeadlock/ClassLoaderDeadlock.sh b/test/jdk/java/security/Security/ClassLoaderDeadlock/ClassLoaderDeadlock.sh deleted file mode 100644 index e2e573928535..000000000000 --- a/test/jdk/java/security/Security/ClassLoaderDeadlock/ClassLoaderDeadlock.sh +++ /dev/null @@ -1,106 +0,0 @@ -# -# Copyright (c) 2004, 2024, 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 5094825 -# @summary verify no deadlock if crypto provider in other classloader is used to verify signed jars -# -# @run shell/timeout=30 ClassLoaderDeadlock.sh - -# set a few environment variables so that the shell-script can run stand-alone -# in the source directory -if [ "${TESTSRC}" = "" ] ; then - TESTSRC="." -fi - -if [ "${TESTCLASSES}" = "" ] ; then - TESTCLASSES="." -fi - -if [ "${TESTJAVA}" = "" ] ; then - echo "TESTJAVA not set. Test cannot execute." - echo "FAILED!!!" - exit 1 -fi - -if [ "${COMPILEJAVA}" = "" ]; then - COMPILEJAVA="${TESTJAVA}" -fi - -# set platform-dependent variables -OS=`uname -s` -case "$OS" in - Linux ) - PATHSEP=":" - FILESEP="/" - ;; - Darwin ) - PATHSEP=":" - FILESEP="/" - ;; - AIX ) - PATHSEP=":" - FILESEP="/" - ;; - CYGWIN* ) - PATHSEP=";" - FILESEP="/" - ;; - Windows* ) - PATHSEP=";" - FILESEP="\\" - ;; - * ) - echo "Unrecognized system!" - exit 1; - ;; -esac - -cd ${TESTCLASSES}${FILESEP} -if [ ! -d provider ] ; then - mkdir provider -fi - -# compile the test program -${COMPILEJAVA}${FILESEP}bin${FILESEP}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} \ - -d ${TESTCLASSES}${FILESEP} \ - ${TESTSRC}${FILESEP}ClassLoaderDeadlock.java - -${COMPILEJAVA}${FILESEP}bin${FILESEP}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} \ - -d ${TESTCLASSES}${FILESEP}provider${FILESEP} \ - ${TESTSRC}${FILESEP}provider${FILESEP}HashProvider.java - -# run the test -${TESTJAVA}${FILESEP}bin${FILESEP}java ${TESTVMOPTS} ${TESTJAVAOPTS} \ - -classpath "${TESTCLASSES}${PATHSEP}${TESTSRC}${FILESEP}Deadlock.jar" \ - -Djava.awt.headless=true \ - ClassLoaderDeadlock - -STATUS=$? - -# clean up -rm -f 'ClassLoaderDeadlock.class' 'ClassLoaderDeadlock$1.class' \ -'ClassLoaderDeadlock$DelayClassLoader.class' \ -provider${FILESEP}HashProvider.class - -exit $STATUS diff --git a/test/jdk/java/security/Security/ClassLoaderDeadlock/Deadlock.java b/test/jdk/java/security/Security/ClassLoaderDeadlock/Deadlock.java index 5693f4933aa9..0d46b5c8660a 100644 --- a/test/jdk/java/security/Security/ClassLoaderDeadlock/Deadlock.java +++ b/test/jdk/java/security/Security/ClassLoaderDeadlock/Deadlock.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,8 +21,13 @@ * questions. */ - -// see Deadlock.sh +/* + * @test + * @bug 4944382 + * @summary make sure we do not deadlock loading signed JAR with getInstance() + * @library ./Deadlock.jar + * @run main/othervm/timeout=30 Deadlock + */ import java.security.*; diff --git a/test/jdk/java/security/Security/ClassLoaderDeadlock/Deadlock.sh b/test/jdk/java/security/Security/ClassLoaderDeadlock/Deadlock.sh deleted file mode 100644 index 7013c4cc33a1..000000000000 --- a/test/jdk/java/security/Security/ClassLoaderDeadlock/Deadlock.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/sh - -# -# Copyright (c) 2003, 2024, 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 4944382 -# @summary make sure we do not deadlock loading signed JAR with getInstance() -# @author Andreas Sterbenz -# @build Deadlock -# @run shell/timeout=30 Deadlock.sh - -# set platform-dependent variables -OS=`uname -s` -case "$OS" in - Linux ) - PATHSEP=":" - FILESEP="/" - ;; - Darwin ) - PATHSEP=":" - FILESEP="/" - ;; - AIX ) - PATHSEP=":" - FILESEP="/" - ;; - CYGWIN* ) - PATHSEP=";" - FILESEP="/" - ;; - Windows* ) - PATHSEP=";" - FILESEP="\\" - ;; - * ) - echo "Unrecognized system!" - exit 1; - ;; -esac - -JAVA="${TESTJAVA}${FILESEP}bin${FILESEP}java" - -${JAVA} ${TESTVMOPTS} ${TESTJAVAOPTS} -cp "${TESTCLASSES}${PATHSEP}${TESTSRC}${FILESEP}Deadlock.jar" Deadlock - diff --git a/test/jdk/java/security/Security/NoInstalledProviders.java b/test/jdk/java/security/Security/NoInstalledProviders.java index 551f1896ecbe..1e701f9a6e1f 100644 --- a/test/jdk/java/security/Security/NoInstalledProviders.java +++ b/test/jdk/java/security/Security/NoInstalledProviders.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,12 +24,13 @@ /* * @test * @bug 4273454 7054918 7052537 - * @library ../testlibrary + * @library /test/lib * @summary Make sure getProviders(filter) doesn't throw NPE * @run main/othervm NoInstalledProviders */ import java.security.*; +import jdk.test.lib.security.ProvidersSnapshot; public class NoInstalledProviders { diff --git a/test/jdk/java/security/Security/SynchronizedAccess.java b/test/jdk/java/security/Security/SynchronizedAccess.java index 28019213b3c2..c1443529fe79 100644 --- a/test/jdk/java/security/Security/SynchronizedAccess.java +++ b/test/jdk/java/security/Security/SynchronizedAccess.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,13 +24,14 @@ /* * @test * @bug 4162583 7054918 8130181 8028127 - * @library /test/lib ../testlibrary + * @library /test/lib * @summary Make sure Provider api implementations are synchronized properly */ import java.security.*; import jdk.test.lib.Asserts; +import jdk.test.lib.security.ProvidersSnapshot; public class SynchronizedAccess { diff --git a/test/jdk/java/security/Security/removing/RemoveProviders.java b/test/jdk/java/security/Security/removing/RemoveProviders.java index 0d9f6b207c59..38edf983fb02 100644 --- a/test/jdk/java/security/Security/removing/RemoveProviders.java +++ b/test/jdk/java/security/Security/removing/RemoveProviders.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ /** * @test * @bug 4963416 7054918 - * @library ../../testlibrary + * @library /test/lib * @summary make sure removeProvider() always works correctly * @author Andreas Sterbenz */ @@ -32,6 +32,7 @@ import java.util.*; import java.security.*; +import jdk.test.lib.security.ProvidersSnapshot; public class RemoveProviders { diff --git a/test/jdk/java/security/cert/CertPathBuilder/selfIssued/openssl.cnf b/test/jdk/java/security/cert/CertPathBuilder/selfIssued/openssl.cnf index 24f68da0f1a2..718fc633087e 100644 --- a/test/jdk/java/security/cert/CertPathBuilder/selfIssued/openssl.cnf +++ b/test/jdk/java/security/cert/CertPathBuilder/selfIssued/openssl.cnf @@ -4,9 +4,7 @@ # # 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. +# 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 diff --git a/test/jdk/java/security/cert/CertPathValidator/OCSP/GetAndPostTests.java b/test/jdk/java/security/cert/CertPathValidator/OCSP/GetAndPostTests.java index 478e94572bc7..d29ca878cd34 100644 --- a/test/jdk/java/security/cert/CertPathValidator/OCSP/GetAndPostTests.java +++ b/test/jdk/java/security/cert/CertPathValidator/OCSP/GetAndPostTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,8 +25,7 @@ * @test * @bug 8179503 8328638 * @summary Java should support GET OCSP calls - * @library /javax/net/ssl/templates /java/security/testlibrary - * @build SimpleOCSPServer + * @library /javax/net/ssl/templates /test/lib * @modules java.base/sun.security.util * java.base/sun.security.provider.certpath * java.base/sun.security.x509 @@ -64,7 +63,7 @@ import java.util.Set; import java.util.concurrent.TimeUnit; -import sun.security.testlibrary.SimpleOCSPServer; +import jdk.test.lib.security.SimpleOCSPServer; import sun.security.util.DerOutputStream; import sun.security.util.DerValue; import sun.security.util.ObjectIdentifier; diff --git a/test/jdk/java/security/cert/CertPathValidator/OCSP/OCSPTimeout.java b/test/jdk/java/security/cert/CertPathValidator/OCSP/OCSPTimeout.java index dfd7dcdc81ef..342617a5fa93 100644 --- a/test/jdk/java/security/cert/CertPathValidator/OCSP/OCSPTimeout.java +++ b/test/jdk/java/security/cert/CertPathValidator/OCSP/OCSPTimeout.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, 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,8 +34,7 @@ * @modules java.base/sun.security.x509 * java.base/sun.security.provider.certpath * java.base/sun.security.util - * @library ../../../../../java/security/testlibrary - * @build CertificateBuilder SimpleOCSPServer + * @library /test/lib * @run main/othervm -Djava.security.debug=certpath OCSPTimeout 1000 true * @run main/othervm -Djava.security.debug=certpath * -Dcom.sun.security.ocsp.readtimeout=5 OCSPTimeout 1000 true @@ -59,8 +58,8 @@ import java.security.cert.*; import java.util.concurrent.TimeUnit; -import sun.security.testlibrary.SimpleOCSPServer; -import sun.security.testlibrary.CertificateBuilder; +import jdk.test.lib.security.SimpleOCSPServer; +import jdk.test.lib.security.CertificateBuilder; import static java.security.cert.PKIXRevocationChecker.Option.*; @@ -84,7 +83,7 @@ public class OCSPTimeout { public static void main(String[] args) throws Exception { int ocspTimeout = 15000; - boolean expected = false; + boolean expected; createPKI(); @@ -195,7 +194,6 @@ private static void createPKI() throws Exception { rootOcsp = new SimpleOCSPServer(rootKeystore, passwd, ROOT_ALIAS, null); rootOcsp.enableLog(debug); rootOcsp.setNextUpdateInterval(3600); - rootOcsp.setDisableContentLength(true); rootOcsp.start(); // Wait 60 seconds for server ready diff --git a/test/jdk/java/security/cert/CertPathValidator/crlDP/CheckAllCRLs.java b/test/jdk/java/security/cert/CertPathValidator/crlDP/CheckAllCRLs.java new file mode 100644 index 000000000000..88ef85fe6ca9 --- /dev/null +++ b/test/jdk/java/security/cert/CertPathValidator/crlDP/CheckAllCRLs.java @@ -0,0 +1,229 @@ +/* + * Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.nio.file.Files; +import java.nio.file.Path; +import java.math.BigInteger; +import java.security.KeyPair; +import java.security.KeyPairGenerator; +import java.security.cert.CertificateFactory; +import java.security.cert.CertPath; +import java.security.cert.CertPathValidator; +import java.security.cert.CertPathValidatorException; +import java.security.cert.CertPathValidatorException.BasicReason; +import java.security.cert.PKIXParameters; +import java.security.cert.TrustAnchor; +import java.security.cert.X509Certificate; +import java.security.cert.X509CRL; +import java.util.Date; +import java.util.List; +import java.util.Set; +import java.util.concurrent.TimeUnit; +import sun.security.x509.AuthorityKeyIdentifierExtension; +import sun.security.x509.CRLDistributionPointsExtension; +import sun.security.x509.CRLExtensions; +import sun.security.x509.CRLNumberExtension; +import sun.security.x509.DistributionPoint; +import sun.security.x509.Extension; +import sun.security.x509.GeneralName; +import sun.security.x509.GeneralNames; +import sun.security.x509.KeyIdentifier; +import sun.security.x509.URIName; +import sun.security.x509.X500Name; +import sun.security.x509.X509CRLEntryImpl; +import sun.security.x509.X509CRLImpl; +import static sun.security.x509.X509CRLImpl.TBSCertList; +import jdk.test.lib.security.CertificateBuilder; + +/* + * @test + * @bug 8200566 + * @summary Check that CRL validation continues to check other CRLs in + * CRLDP extension after CRL fetching errors and exhibits same + * behavior (fails because cert is revoked) whether CRL cache is + * fresh or stale. + * @modules java.base/sun.security.x509 + * java.base/sun.security.util + * @library /test/lib + * @run main/othervm -Dcom.sun.security.enableCRLDP=true CheckAllCRLs + */ +public class CheckAllCRLs { + + public static void main(String[] args) throws Exception { + + CertificateBuilder cb = new CertificateBuilder(); + + // Create CA cert + KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA"); + KeyPair rootKeyPair = kpg.genKeyPair(); + X509Certificate rootCert = createCert(cb, "CN=Root CA", + rootKeyPair, rootKeyPair, null, "SHA384withRSA", true, false); + + // Create EE cert. This EE cert will contain a CRL Distribution + // Points extension with two DistributionPoints - one will be a HTTP + // URL to a non-existant HTTP server, and the other will be a File + // URL to a file containing the CRL. + KeyPair eeKeyPair = kpg.genKeyPair(); + X509Certificate eeCert1 = createCert(cb, "CN=End Entity", + rootKeyPair, eeKeyPair, rootCert, "SHA384withRSA", false, true); + + // Create another EE cert. This EE cert is similar in that it contains + // a CRL Distribution Points extension but with one DistributionPoint + // containing 2 GeneralName URLs as above. + X509Certificate eeCert2 = createCert(cb, "CN=End Entity", + rootKeyPair, eeKeyPair, rootCert, "SHA384withRSA", false, false); + + // Create a CRL with no revoked certificates and store it in a file + X509CRL crl = createCRL(new X500Name("CN=Root CA"), rootKeyPair, + "SHA384withRSA"); + Files.write(Path.of("root.crl"), crl.getEncoded()); + + // Validate path containing eeCert1 + System.out.println("Validating cert with CRLDP containing one " + + "DistributionPoint with 2 entries, the first non-existent"); + validatePath(eeCert1, rootCert); + + // Validate path containing eeCert2 + System.out.println("Validating cert with CRLDP containing two " + + "DistributionPoints with 1 entry each, the first non-existent"); + validatePath(eeCert2, rootCert); + } + + private static X509Certificate createCert(CertificateBuilder cb, + String subjectDN, KeyPair issuerKeyPair, KeyPair subjectKeyPair, + X509Certificate issuerCert, String sigAlg, boolean isCA, + boolean twoDPs) throws Exception { + cb.setSubjectName(subjectDN); + cb.setPublicKey(subjectKeyPair.getPublic()); + cb.setSerialNumber(new BigInteger("1")); + + if (isCA) { + // Make a 3 year validity starting from 60 days ago + long start = System.currentTimeMillis() - TimeUnit.DAYS.toMillis(60); + long end = start + TimeUnit.DAYS.toMillis(1085); + cb.setValidity(new Date(start), new Date(end)); + cb.addBasicConstraintsExt(true, true, -1); + cb.addKeyUsageExt(new boolean[] + {false, false, false, false, false, true, true, false, false}); + } else { + // Make a 1 year validity starting from 7 days ago + long start = System.currentTimeMillis() - TimeUnit.DAYS.toMillis(7); + long end = start + TimeUnit.DAYS.toMillis(365); + cb.setValidity(new Date(start), new Date(end)); + cb.addAuthorityKeyIdExt(issuerKeyPair.getPublic()); + cb.addKeyUsageExt(new boolean[] + {true, false, false, false, false, false, false, false, false}); + cb.addExtendedKeyUsageExt(List.of("1.3.6.1.5.5.7.3.1")); + GeneralName first = new GeneralName(new URIName( + "http://127.0.0.1:48180/crl/will/always/fail/root.crl")); + GeneralName second = new GeneralName(new URIName("file:./root.crl")); + if (twoDPs) { + GeneralNames gn1 = new GeneralNames().add(first); + DistributionPoint dp1 = new DistributionPoint(gn1, null, null); + GeneralNames gn2 = new GeneralNames().add(second); + DistributionPoint dp2 = new DistributionPoint(gn2, null, null); + cb.addExtension(new CRLDistributionPointsExtension(List.of(dp1, dp2))); + } else { + GeneralNames gn = new GeneralNames().add(first).add(second); + DistributionPoint dp = new DistributionPoint(gn, null, null); + cb.addExtension(new CRLDistributionPointsExtension(List.of(dp))); + } + } + cb.addSubjectKeyIdExt(subjectKeyPair.getPublic()); + + // return signed cert + return cb.build(issuerCert, issuerKeyPair.getPrivate(), sigAlg); + } + + private static X509CRL createCRL(X500Name caIssuer, KeyPair caKeyPair, + String sigAlg) throws Exception { + + CRLExtensions crlExts = new CRLExtensions(); + + // add AuthorityKeyIdentifier extension + KeyIdentifier kid = new KeyIdentifier(caKeyPair.getPublic()); + Extension ext = new AuthorityKeyIdentifierExtension(kid, null, null); + crlExts.setExtension(ext.getId(), + new AuthorityKeyIdentifierExtension(kid, null, null)); + + // add CRLNumber extension + ext = new CRLNumberExtension(1); + crlExts.setExtension(ext.getId(), ext); + + // revoke cert + X509CRLEntryImpl crlEntry = + new X509CRLEntryImpl(new BigInteger("1"), new Date()); + + // Create a 1 year validity CRL starting from 7 days ago + long start = System.currentTimeMillis() - TimeUnit.DAYS.toMillis(7); + long end = start + TimeUnit.DAYS.toMillis(365); + TBSCertList tcl = new TBSCertList(caIssuer, new Date(start), + new Date(end), new X509CRLEntryImpl[]{ crlEntry }, crlExts); + + // return signed CRL + return X509CRLImpl.newSigned(tcl, caKeyPair.getPrivate(), sigAlg); + } + + private static void validatePath(X509Certificate eeCert, + X509Certificate rootCert) throws Exception { + + // Create certification path and set up PKIXParameters. + CertificateFactory cf = CertificateFactory.getInstance("X.509"); + CertPath cp = cf.generateCertPath(List.of(eeCert)); + PKIXParameters pp = + new PKIXParameters(Set.of(new TrustAnchor(rootCert, null))); + pp.setRevocationEnabled(true); + + CertPathValidator cpv = CertPathValidator.getInstance("PKIX"); + + // Validate path twice in succession, making sure we get consistent + // results the second time when the CRL cache is fresh. + System.out.println("First time validating path"); + validate(cpv, cp, pp); + System.out.println("Second time validating path"); + validate(cpv, cp, pp); + + // CRL lookup cache time is 30s. Sleep for 35 seconds to ensure + // cache is stale, and validate one more time to ensure we get + // consistent results. + System.out.println("Waiting for CRL cache to be cleared"); + Thread.sleep(30500); + + System.out.println("Third time validating path"); + validate(cpv, cp, pp); + } + + private static void validate(CertPathValidator cpv, CertPath cp, + PKIXParameters pp) throws Exception { + + try { + cpv.validate(cp, pp); + throw new Exception("Validation passed unexpectedly"); + } catch (CertPathValidatorException cpve) { + if (cpve.getReason() != BasicReason.REVOKED) { + throw new Exception("Validation failed with unexpected reason", cpve); + } + System.out.println("Validation failed as expected: " + cpve); + } + } +} diff --git a/test/jdk/java/security/cert/CertPathValidator/indirectCRL/openssl.cnf b/test/jdk/java/security/cert/CertPathValidator/indirectCRL/openssl.cnf index 6b1d7afcaba3..a2fc7dde03fb 100644 --- a/test/jdk/java/security/cert/CertPathValidator/indirectCRL/openssl.cnf +++ b/test/jdk/java/security/cert/CertPathValidator/indirectCRL/openssl.cnf @@ -4,9 +4,7 @@ # # 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. +# 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 diff --git a/test/jdk/java/security/cert/CertPathValidator/nameConstraints/openssl.cnf b/test/jdk/java/security/cert/CertPathValidator/nameConstraints/openssl.cnf index 565ccd607e1a..f16d069e1bfe 100644 --- a/test/jdk/java/security/cert/CertPathValidator/nameConstraints/openssl.cnf +++ b/test/jdk/java/security/cert/CertPathValidator/nameConstraints/openssl.cnf @@ -4,9 +4,7 @@ # # 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. +# 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 diff --git a/test/jdk/java/security/cert/CertPathValidator/trustAnchor/ValWithAnchorByName.java b/test/jdk/java/security/cert/CertPathValidator/trustAnchor/ValWithAnchorByName.java index 29abfb9f551d..c57abdf243d3 100644 --- a/test/jdk/java/security/cert/CertPathValidator/trustAnchor/ValWithAnchorByName.java +++ b/test/jdk/java/security/cert/CertPathValidator/trustAnchor/ValWithAnchorByName.java @@ -52,8 +52,8 @@ public class ValWithAnchorByName { // The following certificates and OCSP responses were captured from // a test run that used certificates and responses generated by - // sun.security.testlibrary.CertificateBuilder and - // sun.security.testlibrary.SimpleOCSPServer. + // jdk.test.lib.security.CertificateBuilder and + // jdk.test.lib.security.SimpleOCSPServer. // Subject: CN=SSLCertificate, O=SomeCompany // Issuer: CN=Intermediate CA Cert, O=SomeCompany diff --git a/test/jdk/java/text/Format/CompactNumberFormat/TestMutatingInstance.java b/test/jdk/java/text/Format/CompactNumberFormat/TestMutatingInstance.java index 345a7599405e..47b176692fd1 100644 --- a/test/jdk/java/text/Format/CompactNumberFormat/TestMutatingInstance.java +++ b/test/jdk/java/text/Format/CompactNumberFormat/TestMutatingInstance.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/text/Format/CompactNumberFormat/serialization/TestDeserializeCNF.java b/test/jdk/java/text/Format/CompactNumberFormat/serialization/TestDeserializeCNF.java index 5b9a2f98c8e9..0b4710f0086c 100644 --- a/test/jdk/java/text/Format/CompactNumberFormat/serialization/TestDeserializeCNF.java +++ b/test/jdk/java/text/Format/CompactNumberFormat/serialization/TestDeserializeCNF.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/text/Format/DecimalFormat/MantissaDigits.java b/test/jdk/java/text/Format/DecimalFormat/MantissaDigits.java index 9f69196d7469..cffe50cd5f64 100644 --- a/test/jdk/java/text/Format/DecimalFormat/MantissaDigits.java +++ b/test/jdk/java/text/Format/DecimalFormat/MantissaDigits.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/time/tck/java/time/AbstractTCKTest.java b/test/jdk/java/time/tck/java/time/AbstractTCKTest.java index 6272ea723cbb..0db507e400a3 100644 --- a/test/jdk/java/time/tck/java/time/AbstractTCKTest.java +++ b/test/jdk/java/time/tck/java/time/AbstractTCKTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/time/tck/java/time/chrono/CopticChronology.java b/test/jdk/java/time/tck/java/time/chrono/CopticChronology.java index 626b2863dd68..2750254c9624 100644 --- a/test/jdk/java/time/tck/java/time/chrono/CopticChronology.java +++ b/test/jdk/java/time/tck/java/time/chrono/CopticChronology.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/time/tck/java/time/chrono/CopticDate.java b/test/jdk/java/time/tck/java/time/chrono/CopticDate.java index 09e2e47d815c..92f48a9c904d 100644 --- a/test/jdk/java/time/tck/java/time/chrono/CopticDate.java +++ b/test/jdk/java/time/tck/java/time/chrono/CopticDate.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/time/tck/java/time/chrono/CopticEra.java b/test/jdk/java/time/tck/java/time/chrono/CopticEra.java index be78ff5b09c9..24f3056c4c08 100644 --- a/test/jdk/java/time/tck/java/time/chrono/CopticEra.java +++ b/test/jdk/java/time/tck/java/time/chrono/CopticEra.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/time/tck/java/time/chrono/TCKChronoLocalDate.java b/test/jdk/java/time/tck/java/time/chrono/TCKChronoLocalDate.java index 32001354ff27..eb1ccebc0c2b 100644 --- a/test/jdk/java/time/tck/java/time/chrono/TCKChronoLocalDate.java +++ b/test/jdk/java/time/tck/java/time/chrono/TCKChronoLocalDate.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/time/tck/java/time/chrono/TCKChronoLocalDateTime.java b/test/jdk/java/time/tck/java/time/chrono/TCKChronoLocalDateTime.java index 9f9de499dd83..6a3c6a62e084 100644 --- a/test/jdk/java/time/tck/java/time/chrono/TCKChronoLocalDateTime.java +++ b/test/jdk/java/time/tck/java/time/chrono/TCKChronoLocalDateTime.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/time/tck/java/time/chrono/TCKChronoPeriod.java b/test/jdk/java/time/tck/java/time/chrono/TCKChronoPeriod.java index b8b1bd2d5cb8..3fbc4d02beeb 100644 --- a/test/jdk/java/time/tck/java/time/chrono/TCKChronoPeriod.java +++ b/test/jdk/java/time/tck/java/time/chrono/TCKChronoPeriod.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/time/tck/java/time/chrono/TCKChronoZonedDateTime.java b/test/jdk/java/time/tck/java/time/chrono/TCKChronoZonedDateTime.java index c3a1d2dcb709..be2f9fb1ac96 100644 --- a/test/jdk/java/time/tck/java/time/chrono/TCKChronoZonedDateTime.java +++ b/test/jdk/java/time/tck/java/time/chrono/TCKChronoZonedDateTime.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/time/tck/java/time/chrono/TCKHijrahChronology.java b/test/jdk/java/time/tck/java/time/chrono/TCKHijrahChronology.java index 61c19ab16cf2..7301ff67dcac 100644 --- a/test/jdk/java/time/tck/java/time/chrono/TCKHijrahChronology.java +++ b/test/jdk/java/time/tck/java/time/chrono/TCKHijrahChronology.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/time/tck/java/time/chrono/TCKHijrahEra.java b/test/jdk/java/time/tck/java/time/chrono/TCKHijrahEra.java index 23eaf3aaed80..e5a1cd5e1afa 100644 --- a/test/jdk/java/time/tck/java/time/chrono/TCKHijrahEra.java +++ b/test/jdk/java/time/tck/java/time/chrono/TCKHijrahEra.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/time/tck/java/time/chrono/TCKIsoChronology.java b/test/jdk/java/time/tck/java/time/chrono/TCKIsoChronology.java index d753917a7465..d47c58d72b7d 100644 --- a/test/jdk/java/time/tck/java/time/chrono/TCKIsoChronology.java +++ b/test/jdk/java/time/tck/java/time/chrono/TCKIsoChronology.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/time/tck/java/time/chrono/TCKIsoEra.java b/test/jdk/java/time/tck/java/time/chrono/TCKIsoEra.java index e42cbc612db6..223a5a2b92f1 100644 --- a/test/jdk/java/time/tck/java/time/chrono/TCKIsoEra.java +++ b/test/jdk/java/time/tck/java/time/chrono/TCKIsoEra.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/time/tck/java/time/chrono/TCKJapaneseChronology.java b/test/jdk/java/time/tck/java/time/chrono/TCKJapaneseChronology.java index 05659a68fd01..19bb26ed40f1 100644 --- a/test/jdk/java/time/tck/java/time/chrono/TCKJapaneseChronology.java +++ b/test/jdk/java/time/tck/java/time/chrono/TCKJapaneseChronology.java @@ -4,9 +4,7 @@ o Copyright (c) 2012, 2022, Oracle and/or its affiliates. All rights reserved. * * 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. + * 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 diff --git a/test/jdk/java/time/tck/java/time/chrono/TCKJapaneseEra.java b/test/jdk/java/time/tck/java/time/chrono/TCKJapaneseEra.java index aba475469f8a..edd3374b06b0 100644 --- a/test/jdk/java/time/tck/java/time/chrono/TCKJapaneseEra.java +++ b/test/jdk/java/time/tck/java/time/chrono/TCKJapaneseEra.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/time/tck/java/time/chrono/TCKMinguoChronology.java b/test/jdk/java/time/tck/java/time/chrono/TCKMinguoChronology.java index 53089a6eef47..523a267104fa 100644 --- a/test/jdk/java/time/tck/java/time/chrono/TCKMinguoChronology.java +++ b/test/jdk/java/time/tck/java/time/chrono/TCKMinguoChronology.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/time/tck/java/time/chrono/TCKMinguoEra.java b/test/jdk/java/time/tck/java/time/chrono/TCKMinguoEra.java index 19e05e804443..9b7d5bcb535d 100644 --- a/test/jdk/java/time/tck/java/time/chrono/TCKMinguoEra.java +++ b/test/jdk/java/time/tck/java/time/chrono/TCKMinguoEra.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/time/tck/java/time/chrono/TCKThaiBuddhistChronology.java b/test/jdk/java/time/tck/java/time/chrono/TCKThaiBuddhistChronology.java index 0c8da8541f3b..e54ecf9dc236 100644 --- a/test/jdk/java/time/tck/java/time/chrono/TCKThaiBuddhistChronology.java +++ b/test/jdk/java/time/tck/java/time/chrono/TCKThaiBuddhistChronology.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/time/tck/java/time/chrono/TCKThaiBuddhistEra.java b/test/jdk/java/time/tck/java/time/chrono/TCKThaiBuddhistEra.java index 4737edb3d288..c4db30ccd722 100644 --- a/test/jdk/java/time/tck/java/time/chrono/TCKThaiBuddhistEra.java +++ b/test/jdk/java/time/tck/java/time/chrono/TCKThaiBuddhistEra.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/time/tck/java/time/chrono/serial/TCKChronoLocalDateSerialization.java b/test/jdk/java/time/tck/java/time/chrono/serial/TCKChronoLocalDateSerialization.java index 8116457b96a8..8364d0137d85 100644 --- a/test/jdk/java/time/tck/java/time/chrono/serial/TCKChronoLocalDateSerialization.java +++ b/test/jdk/java/time/tck/java/time/chrono/serial/TCKChronoLocalDateSerialization.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/time/tck/java/time/chrono/serial/TCKChronoLocalDateTimeSerialization.java b/test/jdk/java/time/tck/java/time/chrono/serial/TCKChronoLocalDateTimeSerialization.java index 8da904b41c82..eb4e2cb65544 100644 --- a/test/jdk/java/time/tck/java/time/chrono/serial/TCKChronoLocalDateTimeSerialization.java +++ b/test/jdk/java/time/tck/java/time/chrono/serial/TCKChronoLocalDateTimeSerialization.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/time/tck/java/time/chrono/serial/TCKChronoZonedDateTimeSerialization.java b/test/jdk/java/time/tck/java/time/chrono/serial/TCKChronoZonedDateTimeSerialization.java index c941453a969d..bb76aa8e3811 100644 --- a/test/jdk/java/time/tck/java/time/chrono/serial/TCKChronoZonedDateTimeSerialization.java +++ b/test/jdk/java/time/tck/java/time/chrono/serial/TCKChronoZonedDateTimeSerialization.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/time/tck/java/time/chrono/serial/TCKChronologySerialization.java b/test/jdk/java/time/tck/java/time/chrono/serial/TCKChronologySerialization.java index c3222e281e64..950c371c6202 100644 --- a/test/jdk/java/time/tck/java/time/chrono/serial/TCKChronologySerialization.java +++ b/test/jdk/java/time/tck/java/time/chrono/serial/TCKChronologySerialization.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/time/tck/java/time/format/TCKFormatStyle.java b/test/jdk/java/time/tck/java/time/format/TCKFormatStyle.java index 5d28b5409112..d8a754b02712 100644 --- a/test/jdk/java/time/tck/java/time/format/TCKFormatStyle.java +++ b/test/jdk/java/time/tck/java/time/format/TCKFormatStyle.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/time/tck/java/time/format/TCKResolverStyle.java b/test/jdk/java/time/tck/java/time/format/TCKResolverStyle.java index ef4bbb24b2d7..c2b2e6266c68 100644 --- a/test/jdk/java/time/tck/java/time/format/TCKResolverStyle.java +++ b/test/jdk/java/time/tck/java/time/format/TCKResolverStyle.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/time/tck/java/time/format/TCKSignStyle.java b/test/jdk/java/time/tck/java/time/format/TCKSignStyle.java index a6faec3fd83e..602e8f70d420 100644 --- a/test/jdk/java/time/tck/java/time/format/TCKSignStyle.java +++ b/test/jdk/java/time/tck/java/time/format/TCKSignStyle.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/time/tck/java/time/temporal/TCKChronoField.java b/test/jdk/java/time/tck/java/time/temporal/TCKChronoField.java index 1e6c9ea874b2..97329b47f74c 100644 --- a/test/jdk/java/time/tck/java/time/temporal/TCKChronoField.java +++ b/test/jdk/java/time/tck/java/time/temporal/TCKChronoField.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/time/tck/java/time/temporal/TCKChronoUnit.java b/test/jdk/java/time/tck/java/time/temporal/TCKChronoUnit.java index a117030dda19..5e52e23bb00c 100644 --- a/test/jdk/java/time/tck/java/time/temporal/TCKChronoUnit.java +++ b/test/jdk/java/time/tck/java/time/temporal/TCKChronoUnit.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/time/tck/java/time/temporal/TCKIsoFields.java b/test/jdk/java/time/tck/java/time/temporal/TCKIsoFields.java index 37d4e74266d9..386af0162486 100644 --- a/test/jdk/java/time/tck/java/time/temporal/TCKIsoFields.java +++ b/test/jdk/java/time/tck/java/time/temporal/TCKIsoFields.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/time/tck/java/time/temporal/TCKWeekFields.java b/test/jdk/java/time/tck/java/time/temporal/TCKWeekFields.java index f2e948843715..f379766897cd 100644 --- a/test/jdk/java/time/tck/java/time/temporal/TCKWeekFields.java +++ b/test/jdk/java/time/tck/java/time/temporal/TCKWeekFields.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/time/tck/java/time/temporal/serial/TCKChronoFieldSerialization.java b/test/jdk/java/time/tck/java/time/temporal/serial/TCKChronoFieldSerialization.java index a80869dc7752..bb8c5c566a54 100644 --- a/test/jdk/java/time/tck/java/time/temporal/serial/TCKChronoFieldSerialization.java +++ b/test/jdk/java/time/tck/java/time/temporal/serial/TCKChronoFieldSerialization.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/time/tck/java/time/temporal/serial/TCKChronoUnitSerialization.java b/test/jdk/java/time/tck/java/time/temporal/serial/TCKChronoUnitSerialization.java index 15e34c6a1b0b..e97e183d2529 100644 --- a/test/jdk/java/time/tck/java/time/temporal/serial/TCKChronoUnitSerialization.java +++ b/test/jdk/java/time/tck/java/time/temporal/serial/TCKChronoUnitSerialization.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/time/tck/java/time/temporal/serial/TCKWeekFieldsSerialization.java b/test/jdk/java/time/tck/java/time/temporal/serial/TCKWeekFieldsSerialization.java index 00186046c89b..3523f05c88c1 100644 --- a/test/jdk/java/time/tck/java/time/temporal/serial/TCKWeekFieldsSerialization.java +++ b/test/jdk/java/time/tck/java/time/temporal/serial/TCKWeekFieldsSerialization.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/time/test/java/time/chrono/TestChronoLocalDate.java b/test/jdk/java/time/test/java/time/chrono/TestChronoLocalDate.java index 971b3157fe6e..794109412069 100644 --- a/test/jdk/java/time/test/java/time/chrono/TestChronoLocalDate.java +++ b/test/jdk/java/time/test/java/time/chrono/TestChronoLocalDate.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/time/test/java/time/chrono/TestChronologyPerf.java b/test/jdk/java/time/test/java/time/chrono/TestChronologyPerf.java index e8b3a0083b4a..5026ebf17006 100644 --- a/test/jdk/java/time/test/java/time/chrono/TestChronologyPerf.java +++ b/test/jdk/java/time/test/java/time/chrono/TestChronologyPerf.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/time/test/java/time/chrono/TestEraDisplayName.java b/test/jdk/java/time/test/java/time/chrono/TestEraDisplayName.java index 8863692cb190..291eab833c41 100644 --- a/test/jdk/java/time/test/java/time/chrono/TestEraDisplayName.java +++ b/test/jdk/java/time/test/java/time/chrono/TestEraDisplayName.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/time/test/java/time/chrono/TestExampleCode.java b/test/jdk/java/time/test/java/time/chrono/TestExampleCode.java index 7ce850b00078..5258a0b80627 100644 --- a/test/jdk/java/time/test/java/time/chrono/TestExampleCode.java +++ b/test/jdk/java/time/test/java/time/chrono/TestExampleCode.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/time/test/java/time/chrono/TestIsoChronoImpl.java b/test/jdk/java/time/test/java/time/chrono/TestIsoChronoImpl.java index 6b3a4e87fee2..59f5016a6fc6 100644 --- a/test/jdk/java/time/test/java/time/chrono/TestIsoChronoImpl.java +++ b/test/jdk/java/time/test/java/time/chrono/TestIsoChronoImpl.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/time/test/java/time/chrono/TestJapaneseChronoImpl.java b/test/jdk/java/time/test/java/time/chrono/TestJapaneseChronoImpl.java index bcde051e1b90..fc2fa9798af8 100644 --- a/test/jdk/java/time/test/java/time/chrono/TestJapaneseChronoImpl.java +++ b/test/jdk/java/time/test/java/time/chrono/TestJapaneseChronoImpl.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/time/test/java/time/chrono/TestJapaneseChronology.java b/test/jdk/java/time/test/java/time/chrono/TestJapaneseChronology.java index e2da61935a12..6e7df8638f92 100644 --- a/test/jdk/java/time/test/java/time/chrono/TestJapaneseChronology.java +++ b/test/jdk/java/time/test/java/time/chrono/TestJapaneseChronology.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/time/test/java/time/chrono/TestThaiBuddhistChronoImpl.java b/test/jdk/java/time/test/java/time/chrono/TestThaiBuddhistChronoImpl.java index 94bbe0f94dd9..e878ac0dcb33 100644 --- a/test/jdk/java/time/test/java/time/chrono/TestThaiBuddhistChronoImpl.java +++ b/test/jdk/java/time/test/java/time/chrono/TestThaiBuddhistChronoImpl.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/time/test/java/time/chrono/TestUmmAlQuraChronology.java b/test/jdk/java/time/test/java/time/chrono/TestUmmAlQuraChronology.java index 7bd8a6dec864..8d68abfd227d 100644 --- a/test/jdk/java/time/test/java/time/chrono/TestUmmAlQuraChronology.java +++ b/test/jdk/java/time/test/java/time/chrono/TestUmmAlQuraChronology.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/time/test/java/time/temporal/TestChronoField.java b/test/jdk/java/time/test/java/time/temporal/TestChronoField.java index df51dbbfa4df..a353a6b247bc 100644 --- a/test/jdk/java/time/test/java/time/temporal/TestChronoField.java +++ b/test/jdk/java/time/test/java/time/temporal/TestChronoField.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/time/test/java/time/temporal/TestChronoUnit.java b/test/jdk/java/time/test/java/time/temporal/TestChronoUnit.java index eeecea1761db..95e5f6503ed6 100644 --- a/test/jdk/java/time/test/java/time/temporal/TestChronoUnit.java +++ b/test/jdk/java/time/test/java/time/temporal/TestChronoUnit.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/time/test/java/time/temporal/TestIsoFields.java b/test/jdk/java/time/test/java/time/temporal/TestIsoFields.java index 9a2ba79e8591..53cd721c0e50 100644 --- a/test/jdk/java/time/test/java/time/temporal/TestIsoFields.java +++ b/test/jdk/java/time/test/java/time/temporal/TestIsoFields.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/time/test/java/time/temporal/TestIsoWeekFields.java b/test/jdk/java/time/test/java/time/temporal/TestIsoWeekFields.java index de6321f9d82a..4c40e7278ed9 100644 --- a/test/jdk/java/time/test/java/time/temporal/TestIsoWeekFields.java +++ b/test/jdk/java/time/test/java/time/temporal/TestIsoWeekFields.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/util/Arrays/java.base/java/util/SortingHelper.java b/test/jdk/java/util/Arrays/java.base/java/util/SortingHelper.java index 3357aa959ee6..a8318b6e3747 100644 --- a/test/jdk/java/util/Arrays/java.base/java/util/SortingHelper.java +++ b/test/jdk/java/util/Arrays/java.base/java/util/SortingHelper.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/util/Collections/RotateHuge.java b/test/jdk/java/util/Collections/RotateHuge.java new file mode 100644 index 000000000000..44368aff266d --- /dev/null +++ b/test/jdk/java/util/Collections/RotateHuge.java @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2023, 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 8314236 + * @summary Overflow in Collections.rotate + */ + +import java.util.AbstractList; +import java.util.Collections; +import java.util.List; +import java.util.Objects; +import java.util.RandomAccess; + +public class RotateHuge { + + private static final class MockList extends AbstractList + implements RandomAccess { + private final int size; + + public MockList(final int size) { + if (size < 0) + throw new IllegalArgumentException("Illegal size: " + size); + this.size = size; + } + + @Override + public Object get(final int index) { + Objects.checkIndex(index, size); + return null; + } + + @Override + public Object set(final int index, final Object element) { + Objects.checkIndex(index, size); + return null; + } + + @Override + public int size() { + return size; + } + } + + public static void main(final String[] args) { + testRotate((1 << 30) + 1, -(1 << 30) - 2); + testRotate((1 << 30) + 1, 1 << 30); + testRotate(Integer.MAX_VALUE, Integer.MIN_VALUE); + testRotate(Integer.MAX_VALUE, Integer.MIN_VALUE + 3); + testRotate(Integer.MAX_VALUE, 2); + testRotate(Integer.MAX_VALUE, Integer.MAX_VALUE - 1); + } + + /* + * This test covers only index computations. + * Correctness of elements rotation is not checked. + */ + private static void testRotate(final int size, final int distance) { + final List list = new MockList(size); + Collections.rotate(list, distance); + } +} diff --git a/test/jdk/java/util/Currency/ISO4217-list-one.txt b/test/jdk/java/util/Currency/ISO4217-list-one.txt index 1912b5cc7dbb..aa8c2725899e 100644 --- a/test/jdk/java/util/Currency/ISO4217-list-one.txt +++ b/test/jdk/java/util/Currency/ISO4217-list-one.txt @@ -1,12 +1,12 @@ # # -# Amendments up until ISO 4217 AMENDMENT NUMBER 177 -# (As of 20 June 2024) +# Amendments up until ISO 4217 AMENDMENT NUMBER 179 +# (As of 02 May 2025) # # Version FILEVERSION=3 -DATAVERSION=177 +DATAVERSION=179 # ISO 4217 currency data AF AFN 971 2 diff --git a/test/jdk/java/util/Currency/ValidateISO4217.java b/test/jdk/java/util/Currency/ValidateISO4217.java index cd6e4f41a9f0..97cc524b2256 100644 --- a/test/jdk/java/util/Currency/ValidateISO4217.java +++ b/test/jdk/java/util/Currency/ValidateISO4217.java @@ -26,6 +26,7 @@ * @bug 4691089 4819436 4942982 5104960 6544471 6627549 7066203 7195759 * 8039317 8074350 8074351 8145952 8187946 8193552 8202026 8204269 * 8208746 8209775 8264792 8274658 8283277 8296239 8321480 8334653 + * 8356096 * @summary Validate ISO 4217 data for Currency class. * @modules java.base/java.util:open * jdk.localedata @@ -89,7 +90,7 @@ public class ValidateISO4217 { "ADP-AFA-ATS-AYM-AZM-BEF-BGL-BOV-BYB-BYR-CHE-CHW-CLF-COU-CUC-CYP-" + "DEM-EEK-ESP-FIM-FRF-GHC-GRD-GWP-HRK-IEP-ITL-LTL-LUF-LVL-MGF-MRO-MTL-MXV-MZM-NLG-" + "PTE-ROL-RUR-SDD-SIT-SLL-SKK-SRG-STD-TMM-TPE-TRL-VEF-UYI-USN-USS-VEB-VED-" - + "XAG-XAU-XBA-XBB-XBC-XBD-XDR-XFO-XFU-XPD-XPT-XSU-XTS-XUA-XXX-" + + "XAD-XAG-XAU-XBA-XBB-XBC-XBD-XDR-XFO-XFU-XPD-XPT-XSU-XTS-XUA-XXX-" + "YUM-ZMK-ZWD-ZWL-ZWN-ZWR"; private static final String[][] extraCodes = { /* Defined in ISO 4217 list, but don't have code and minor unit info. */ diff --git a/test/jdk/java/util/Map/FunctionalCMEs.java b/test/jdk/java/util/Map/FunctionalCMEs.java index 51cc85efe80f..fc712081f782 100644 --- a/test/jdk/java/util/Map/FunctionalCMEs.java +++ b/test/jdk/java/util/Map/FunctionalCMEs.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/util/Properties/StoreReproducibilityTest.java b/test/jdk/java/util/Properties/StoreReproducibilityTest.java index b77f3262a4ae..7072b24dc0c1 100644 --- a/test/jdk/java/util/Properties/StoreReproducibilityTest.java +++ b/test/jdk/java/util/Properties/StoreReproducibilityTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2024, 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 @@ -45,6 +45,9 @@ * @test * @summary Tests that the Properties.store() APIs generate output that is reproducible * @bug 8231640 8282023 8316540 + * @comment The test launches several processes and in the presence of -Xcomp it's too slow + * and thus causes timeouts + * @requires vm.compMode != "Xcomp" * @library /test/lib * @run driver StoreReproducibilityTest */ diff --git a/test/jdk/java/util/TimeZone/TimeZoneData/VERSION b/test/jdk/java/util/TimeZone/TimeZoneData/VERSION index 5159b3786e38..750d9fae2b13 100644 --- a/test/jdk/java/util/TimeZone/TimeZoneData/VERSION +++ b/test/jdk/java/util/TimeZone/TimeZoneData/VERSION @@ -1 +1 @@ -tzdata2025a +tzdata2025b diff --git a/test/jdk/java/util/concurrent/StructuredTaskScope/StructuredTaskScopeTest.java b/test/jdk/java/util/concurrent/StructuredTaskScope/StructuredTaskScopeTest.java index 11e3f70b3ede..5ed7af8c46be 100644 --- a/test/jdk/java/util/concurrent/StructuredTaskScope/StructuredTaskScopeTest.java +++ b/test/jdk/java/util/concurrent/StructuredTaskScope/StructuredTaskScopeTest.java @@ -279,6 +279,7 @@ void testForkAfterShutdown(ThreadFactory factory) throws Exception { executed.set(true); return null; }); + scope.join(); assertEquals(Subtask.State.UNAVAILABLE, subtask.state()); assertThrows(IllegalStateException.class, subtask::get); assertThrows(IllegalStateException.class, subtask::exception); @@ -673,22 +674,6 @@ void testInterruptJoinUntil2(ThreadFactory factory) throws Exception { } } - /** - * Test that shutdown prevents new threads from starting. - */ - @Test - void testShutdownWithFork() throws Exception { - ThreadFactory factory = task -> null; - try (var scope = new StructuredTaskScope(null, factory)) { - scope.shutdown(); - // should not invoke the ThreadFactory to create thread - Subtask subtask = scope.fork(() -> null); - assertEquals(Subtask.State.UNAVAILABLE, subtask.state()); - assertThrows(IllegalStateException.class, subtask::get); - assertThrows(IllegalStateException.class, subtask::exception); - } - } - /** * Test that shutdown interrupts unfinished subtasks. */ @@ -1377,6 +1362,7 @@ void testSubtaskWhenShutdown(ThreadFactory factory) throws Exception { // fork after shutdown Subtask subtask = scope.fork(task); + scope.join(); assertEquals(task, subtask.task()); assertEquals(Subtask.State.UNAVAILABLE, subtask.state()); assertThrows(IllegalStateException.class, subtask::get); diff --git a/test/jdk/java/util/stream/CustomFJPoolTest.java b/test/jdk/java/util/stream/CustomFJPoolTest.java index d8de85966885..6cc65360b1b1 100644 --- a/test/jdk/java/util/stream/CustomFJPoolTest.java +++ b/test/jdk/java/util/stream/CustomFJPoolTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/java/util/zip/GZIP/BasicGZIPInputStreamTest.java b/test/jdk/java/util/zip/GZIP/BasicGZIPInputStreamTest.java new file mode 100644 index 000000000000..1f52d44146e9 --- /dev/null +++ b/test/jdk/java/util/zip/GZIP/BasicGZIPInputStreamTest.java @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.util.stream.Stream; +import java.util.zip.GZIPInputStream; + +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.function.Executable; +import org.junit.jupiter.params.ParameterizedTest; +import org.junit.jupiter.params.provider.Arguments; +import org.junit.jupiter.params.provider.MethodSource; + +/* + * @test + * @summary basic API verification tests for GZIPInputStream + * @run junit BasicGZIPInputStreamTest + */ +public class BasicGZIPInputStreamTest { + + + private static Stream npeFromConstructors() { + return Stream.of(Arguments.of((Executable) () -> new GZIPInputStream(null)), + Arguments.of((Executable) () -> new GZIPInputStream(null, 1))); + } + + /* + * Verifies that the GZIPInputStream constructors throw the expected NullPointerException + */ + @ParameterizedTest + @MethodSource("npeFromConstructors") + public void testNPEFromConstructors(final Executable constructor) { + Assertions.assertThrows(NullPointerException.class, constructor, + "GZIPInputStream constructor did not throw NullPointerException"); + } + + private static Stream iaeFromConstructors() { + return Stream.of( + Arguments.of((Executable) () -> new GZIPInputStream( + new ByteArrayInputStream(new byte[0]), 0)), + Arguments.of((Executable) () -> new GZIPInputStream( + new ByteArrayInputStream(new byte[0]), -1)), + Arguments.of((Executable) () -> new GZIPInputStream( + new ByteArrayInputStream(new byte[0]), -42))); + } + + /* + * Verifies that the GZIPInputStream constructors throw the expected IllegalArgumentException + */ + @ParameterizedTest + @MethodSource("iaeFromConstructors") + public void testIAEFromConstructors(final Executable constructor) { + Assertions.assertThrows(IllegalArgumentException.class, constructor, + "GZIPInputStream constructor did not throw IllegalArgumentException"); + } + + private static Stream ioeFromConstructors() { + final ByteArrayInputStream notGZIPContent = new ByteArrayInputStream(new byte[0]); + return Stream.of( + Arguments.of((Executable) () -> new GZIPInputStream(notGZIPContent)), + Arguments.of((Executable) () -> new GZIPInputStream( + notGZIPContent, 1024 /* buffer size */))); + } + + /* + * Verifies that the GZIPInputStream constructors throw the expected IOException + */ + @ParameterizedTest + @MethodSource("ioeFromConstructors") + public void testIOEFromConstructors(final Executable constructor) { + Assertions.assertThrows(IOException.class, constructor, + "GZIPInputStream constructor did not throw IOException"); + } +} diff --git a/test/jdk/javax/accessibility/TestJCheckBoxToggleAccessibility.java b/test/jdk/javax/accessibility/TestJCheckBoxToggleAccessibility.java new file mode 100644 index 000000000000..2a1d03117b73 --- /dev/null +++ b/test/jdk/javax/accessibility/TestJCheckBoxToggleAccessibility.java @@ -0,0 +1,129 @@ +/* + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.BorderLayout; +import java.awt.GridLayout; + +import javax.swing.JCheckBox; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.JToggleButton; + +/* + * @test + * @bug 8348936 8345728 + * @summary Verifies that VoiceOver announces the untick state of CheckBox and + * ToggleButton when space key is pressed. Also verifies that CheckBox + * and ToggleButton untick state is magnified with Screen Magnifier. + * @requires os.family == "mac" + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual TestJCheckBoxToggleAccessibility + */ + +public class TestJCheckBoxToggleAccessibility { + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + +

    Testing with VoiceOver

    + +
      +
    1. Start the VoiceOver application + (Press Command + F5) +
    2. Click on the Frame with CheckBox and ToggleButton + window to move focus +
    3. Press Spacebar +
    4. VO should announce the checked state +
    5. Press Spacebar again +
    6. VO should announce the unchecked state +
    7. Press Tab to move focus to ToggleButton +
    8. Repeat steps 3 to 6 and listen the announcement +
    9. If announcements are incorrect, press Fail +
    10. Stop the VoiceOver application + (Press Command + F5 again) +
    + +

    Testing with Screen Magnifier

    +
      +
    1. Enable Screen magnifier on the Mac: + System Settings -> Accessibility -> + Hover Text -> Enable Hover Text
      + Default Hover Text Activation Modifier is Command key +
    2. Move focus back to the test application and perform the following tests + +
        +
      • Test CheckBox states with Screen Magnifier +
          +
        1. Click on CheckBox to select it +
        2. Press the Command key and + hover mouse over CheckBox +
        3. CheckBox ticked state along with its label should be magnified +
        4. Keep the Command key pressed and + click CheckBox to deselect it +
        5. CheckBox unticked state along with its label should be magnified +
        6. Release the Command key +
        7. If Screen Magnifier behaviour is incorrect, press Fail +
        +
      • Test ToggleButton states with Screen Magnifier +
          +
        1. Click on ToggleButton to select it +
        2. Press the Command key and + hover mouse over ToggleButton +
        3. Ticked state along with label should be magnified +
        4. Keep the Command button pressed and + click ToggleButton to deselect it +
        5. Unticked state along with its label should be magnified +
        6. Release the Command key +
        7. If Screen Magnifier behaviour is incorrect, press Fail +
        +
      +
    3. Disable Hover Text (optionally) in the Settings +
    + +

    Press Pass if you are able to hear correct VoiceOver announcements and + able to see the correct screen magnifier behaviour.

    """; + + PassFailJFrame.builder() + .title("TestJCheckBoxToggleAccessibility Instruction") + .instructions(INSTRUCTIONS) + .columns(40) + .rows(25) + .testUI(TestJCheckBoxToggleAccessibility::createUI) + .testTimeOut(8) + .build() + .awaitAndCheck(); + } + + private static JFrame createUI() { + JFrame frame = new JFrame("A Frame with CheckBox and ToggleButton"); + JCheckBox cb = new JCheckBox("CheckBox", false); + JToggleButton tb = new JToggleButton("ToggleButton"); + + JPanel p = new JPanel(new GridLayout(2, 1)); + p.add(cb); + p.add(tb); + frame.getContentPane().add(p, BorderLayout.CENTER); + frame.setSize(400, 400); + return frame; + } +} diff --git a/test/jdk/javax/accessibility/TestJSpinnerAccessibility.java b/test/jdk/javax/accessibility/TestJSpinnerAccessibility.java new file mode 100644 index 000000000000..4926e5b17fab --- /dev/null +++ b/test/jdk/javax/accessibility/TestJSpinnerAccessibility.java @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2025, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.BorderLayout; + +import javax.swing.JFrame; +import javax.swing.JSpinner; +import javax.swing.SpinnerModel; +import javax.swing.SpinnerNumberModel; + +/* + * @test + * @bug 8286204 + * @summary Verifies that VoiceOver announces the JSpinner's value correctly + * @requires os.family == "mac" + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual TestJSpinnerAccessibility + */ + +public class TestJSpinnerAccessibility { + public static void main(String[] args) throws Exception { + String INSTRUCTIONS = """ + Test UI contains a JSpinner with minimum value 0, maximum value 20 + and current value 5. On press of up / down arrow, value will be + incremented / decremented by 1. + + Follow these steps to test the behaviour: + + 1. Start the VoiceOver (Press Command + F5) application + 2. Move focus on test window if it is not focused + 3. Press Up / Down arrow to increase / decrease Spinner value + 4. VO should announce correct values in terms of percentage + (e.g. For JSpinner's value 10, VO should announce 50%) + 5. Press Pass if you are able to hear correct announcements + else Fail"""; + + PassFailJFrame.builder() + .title("TestJSpinnerAccessibility Instruction") + .instructions(INSTRUCTIONS) + .columns(40) + .testUI(TestJSpinnerAccessibility::createUI) + .build() + .awaitAndCheck(); + } + + private static JFrame createUI() { + JFrame frame = new JFrame("A Frame with JSpinner"); + SpinnerModel spinnerModel = new SpinnerNumberModel(5, 0, 20, 1); + JSpinner spinner = new JSpinner(spinnerModel); + frame.getContentPane().add(spinner, BorderLayout.CENTER); + frame.setSize(200, 100); + return frame; + } +} diff --git a/test/jdk/javax/crypto/CryptoPermissions/CryptoPolicyFallback.java b/test/jdk/javax/crypto/CryptoPermissions/CryptoPolicyFallback.java index 8ccdd0cb39ea..bcca221b2a00 100644 --- a/test/jdk/javax/crypto/CryptoPermissions/CryptoPolicyFallback.java +++ b/test/jdk/javax/crypto/CryptoPermissions/CryptoPolicyFallback.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/javax/crypto/CryptoPermissions/InconsistentEntries.java b/test/jdk/javax/crypto/CryptoPermissions/InconsistentEntries.java index 92843e819c6f..9c06cbaf613f 100644 --- a/test/jdk/javax/crypto/CryptoPermissions/InconsistentEntries.java +++ b/test/jdk/javax/crypto/CryptoPermissions/InconsistentEntries.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/javax/crypto/CryptoPermissions/TestExemption.java b/test/jdk/javax/crypto/CryptoPermissions/TestExemption.java index 00b7762f7aba..0809e0a5ff3e 100644 --- a/test/jdk/javax/crypto/CryptoPermissions/TestExemption.java +++ b/test/jdk/javax/crypto/CryptoPermissions/TestExemption.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/javax/crypto/CryptoPermissions/TestUnlimited.java b/test/jdk/javax/crypto/CryptoPermissions/TestUnlimited.java index a367021148e5..92442074d00b 100644 --- a/test/jdk/javax/crypto/CryptoPermissions/TestUnlimited.java +++ b/test/jdk/javax/crypto/CryptoPermissions/TestUnlimited.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/javax/crypto/EncryptedPrivateKeyInfo/GetKeySpecException.java b/test/jdk/javax/crypto/EncryptedPrivateKeyInfo/GetKeySpecException.java index f55f1eea42ce..5385beb9999f 100644 --- a/test/jdk/javax/crypto/EncryptedPrivateKeyInfo/GetKeySpecException.java +++ b/test/jdk/javax/crypto/EncryptedPrivateKeyInfo/GetKeySpecException.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,19 +24,20 @@ /** * @test * @bug 4508341 7055362 - * @library ../../../java/security/testlibrary + * @library /test/lib * @summary Test the error conditions of * EncryptedPrivateKeyInfo.getKeySpec(...) methods. * @author Valerie Peng * @run main/othervm -DcipherAlg=PBEWithMD5AndDES GetKeySpecException * @run main/othervm -DcipherAlg=PBEWithSHA1AndDESede GetKeySpecException */ + import java.security.*; -import java.util.Arrays; import java.util.Vector; import java.security.spec.*; import javax.crypto.*; import javax.crypto.spec.*; +import jdk.test.lib.security.ProvidersSnapshot; public class GetKeySpecException { private static String cipherAlg; diff --git a/test/jdk/javax/crypto/JceSecurity/SunJCE_BC_LoadOrdering.java b/test/jdk/javax/crypto/JceSecurity/SunJCE_BC_LoadOrdering.java index 50a1c188d0fa..82ac4e70899f 100644 --- a/test/jdk/javax/crypto/JceSecurity/SunJCE_BC_LoadOrdering.java +++ b/test/jdk/javax/crypto/JceSecurity/SunJCE_BC_LoadOrdering.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,7 +24,7 @@ /* * @test * @bug 6377058 7055362 - * @library ../../../java/security/testlibrary + * @library /test/lib * @summary SunJCE depends on sun.security.provider.SignatureImpl * behaviour, BC can't load into 1st slot. * @author Brad R. Wetmore @@ -33,7 +33,7 @@ import java.security.*; import javax.crypto.*; -import java.io.*; +import jdk.test.lib.security.ProvidersSnapshot; public class SunJCE_BC_LoadOrdering { diff --git a/test/jdk/javax/crypto/SecretKeyFactory/evilprov/com/evilprovider/EvilHmacSHA1.java b/test/jdk/javax/crypto/SecretKeyFactory/evilprov/com/evilprovider/EvilHmacSHA1.java index 50f66015f377..06310056274f 100644 --- a/test/jdk/javax/crypto/SecretKeyFactory/evilprov/com/evilprovider/EvilHmacSHA1.java +++ b/test/jdk/javax/crypto/SecretKeyFactory/evilprov/com/evilprovider/EvilHmacSHA1.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/javax/crypto/SecretKeyFactory/evilprov/com/evilprovider/EvilProvider.java b/test/jdk/javax/crypto/SecretKeyFactory/evilprov/com/evilprovider/EvilProvider.java index 2976e8db2066..b6f4a2a3dc9e 100644 --- a/test/jdk/javax/crypto/SecretKeyFactory/evilprov/com/evilprovider/EvilProvider.java +++ b/test/jdk/javax/crypto/SecretKeyFactory/evilprov/com/evilprovider/EvilProvider.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/javax/crypto/SecretKeyFactory/evilprov/module-info.java b/test/jdk/javax/crypto/SecretKeyFactory/evilprov/module-info.java index d971726946cd..9c473f25c163 100644 --- a/test/jdk/javax/crypto/SecretKeyFactory/evilprov/module-info.java +++ b/test/jdk/javax/crypto/SecretKeyFactory/evilprov/module-info.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/javax/imageio/plugins/png/RasterReuseWriteTest.java b/test/jdk/javax/imageio/plugins/png/RasterReuseWriteTest.java new file mode 100644 index 000000000000..64adaa6d196d --- /dev/null +++ b/test/jdk/javax/imageio/plugins/png/RasterReuseWriteTest.java @@ -0,0 +1,182 @@ +/* + * Copyright (c) 2024, 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 8337681 + * @summary Test that raster use optimization does not cause any regressions. + */ + +import java.awt.Color; +import java.awt.Graphics2D; +import java.awt.geom.AffineTransform; +import java.awt.image.BufferedImage; +import java.awt.image.RenderedImage; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import javax.imageio.IIOImage; +import javax.imageio.ImageIO; +import javax.imageio.ImageReader; +import javax.imageio.ImageWriteParam; +import javax.imageio.ImageWriter; +import javax.imageio.stream.ImageInputStream; +import javax.imageio.stream.ImageOutputStream; +import javax.imageio.stream.MemoryCacheImageOutputStream; + +public class RasterReuseWriteTest { + + public static void main(String[] args) throws Exception { + test(BufferedImage.TYPE_INT_RGB); + test(BufferedImage.TYPE_INT_ARGB); + test(BufferedImage.TYPE_INT_ARGB_PRE); + test(BufferedImage.TYPE_4BYTE_ABGR); + test(BufferedImage.TYPE_4BYTE_ABGR_PRE); + } + + private static void test(int type) throws Exception { + + // swaps blue and red + int bands = (type == BufferedImage.TYPE_INT_RGB ? 3 : 4); + int[] sourceBands = bands == 3 ? new int[] { 2, 1, 0 } : + new int[] { 2, 1, 0, 3 }; + + // test writing a BufferedImage without source bands + BufferedImage img1 = createImage(256, 256, type); + byte[] bytes1 = writePng(img1, null); + BufferedImage img2 = ImageIO.read(new ByteArrayInputStream(bytes1)); + compare(img1, img2, false); + + // test writing a BufferedImage with source bands + BufferedImage img3 = createImage(256, 256, type); + byte[] bytes3 = writePng(img3, sourceBands); + BufferedImage img4 = ImageIO.read(new ByteArrayInputStream(bytes3)); + compare(img3, img4, true); + + // test writing a non-BufferedImage with source bands and one tile + RenderedImage img5 = toTiledImage(img1, 256); + byte[] bytes5 = writePng(img5, sourceBands); + BufferedImage img6 = ImageIO.read(new ByteArrayInputStream(bytes5)); + compare(img5, img6, true); + + // test writing a non-BufferedImage with source bands and multiple tiles + RenderedImage img7 = toTiledImage(img1, 128); + byte[] bytes7 = writePng(img7, sourceBands); + BufferedImage img8 = ImageIO.read(new ByteArrayInputStream(bytes7)); + compare(img7, img8, true); + } + + private static BufferedImage createImage(int w, int h, int type) throws Exception { + BufferedImage img = new BufferedImage(w, h, type); + Graphics2D g2d = img.createGraphics(); + g2d.setColor(Color.WHITE); + g2d.fillRect(0, 0, w, h); + g2d.setColor(Color.GREEN); + g2d.drawRect(20, 20, 100, 50); + g2d.setColor(Color.RED); + g2d.drawRect(80, 10, 100, 40); + g2d.setColor(Color.BLUE); + g2d.fillRect(40, 60, 120, 30); + g2d.dispose(); + return img; + } + + private static byte[] writePng(RenderedImage img, int[] sourceBands) throws Exception { + ImageWriter writer = ImageIO.getImageWritersByFormatName("png").next(); + ImageWriteParam param = writer.getDefaultWriteParam(); + param.setSourceBands(sourceBands); + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + ImageOutputStream stream = new MemoryCacheImageOutputStream(baos); + writer.setOutput(stream); + writer.write(null, new IIOImage(img, null, null), param); + writer.dispose(); + stream.flush(); + return baos.toByteArray(); + } + + private static void compare(RenderedImage img1, RenderedImage img2, boolean blueAndRedSwapped) { + int[] pixels1 = getRgbPixels(img1); + int[] pixels2 = getRgbPixels(img2); + for (int i = 0; i < pixels1.length; i++) { + int expected; + if (blueAndRedSwapped && pixels1[i] == 0xFFFF0000) { + expected = 0xFF0000FF; // red -> blue + } else if (blueAndRedSwapped && pixels1[i] == 0xFF0000FF) { + expected = 0xFFFF0000; // blue -> red + } else { + expected = pixels1[i]; // no change + } + int actual = pixels2[i]; + if (actual != expected) { + throw new RuntimeException("Pixel " + i + ": expected " + + Integer.toHexString(expected) + ", but got " + + Integer.toHexString(actual)); + } + } + } + + private static int[] getRgbPixels(RenderedImage img) { + int w = img.getWidth(); + int h = img.getHeight(); + if (img instanceof BufferedImage bi) { + return bi.getRGB(0, 0, w, h, null, 0, w); + } else { + BufferedImage bi = new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB); + Graphics2D g2d = bi.createGraphics(); + g2d.drawRenderedImage(img, new AffineTransform()); + g2d.dispose(); + return bi.getRGB(0, 0, w, h, null, 0, w); + } + } + + private static RenderedImage toTiledImage(BufferedImage img, int tileSize) throws Exception { + + // write to TIFF + ImageWriter writer = ImageIO.getImageWritersByFormatName("tiff").next(); + ImageWriteParam param = writer.getDefaultWriteParam(); + param.setTilingMode(ImageWriteParam.MODE_EXPLICIT); + param.setTiling(tileSize, tileSize, 0, 0); + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + ImageOutputStream stream = new MemoryCacheImageOutputStream(baos); + writer.setOutput(stream); + writer.write(null, new IIOImage(img, null, null), param); + writer.dispose(); + stream.flush(); + byte[] bytes = baos.toByteArray(); + + // read from TIFF + ImageReader reader = ImageIO.getImageReadersByFormatName("tiff").next(); + ImageInputStream input = ImageIO.createImageInputStream(new ByteArrayInputStream(bytes)); + reader.setInput(input); + RenderedImage ri = reader.readAsRenderedImage(0, null); + if (ri instanceof BufferedImage) { + throw new RuntimeException("Unexpected BufferedImage"); + } + int tw = ri.getTileWidth(); + int th = ri.getTileHeight(); + if (tw != tileSize || th != tileSize) { + throw new RuntimeException("Expected tile size " + tileSize + + ", but found " + tw + "x" + th); + } + return ri; + } +} diff --git a/test/jdk/javax/management/monitor/DerivedGaugeMonitorTest.java b/test/jdk/javax/management/monitor/DerivedGaugeMonitorTest.java index 36b9dd40b502..1452de5c3ce1 100644 --- a/test/jdk/javax/management/monitor/DerivedGaugeMonitorTest.java +++ b/test/jdk/javax/management/monitor/DerivedGaugeMonitorTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2024, 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,6 +27,8 @@ * @summary Test that the initial derived gauge is (Integer)0 * @author Daniel Fuchs * + * @library /test/lib + * * @run clean DerivedGaugeMonitorTest * @run build DerivedGaugeMonitorTest * @run main DerivedGaugeMonitorTest @@ -40,9 +42,12 @@ import javax.management.ObjectName; import javax.management.monitor.CounterMonitor; import javax.management.monitor.GaugeMonitor; +import jdk.test.lib.Utils; public class DerivedGaugeMonitorTest { + public static final int WAIT_TIME = 1000; + public static interface Things { public long getALong(); public int getAnInt(); @@ -239,7 +244,7 @@ public static void test(String attr) throws Exception { mon1.setGranularityPeriod(5); mon2.setGranularityPeriod(5); - my.cdl.await(1000, TimeUnit.MILLISECONDS); + my.cdl.await(Utils.adjustTimeout(WAIT_TIME), TimeUnit.MILLISECONDS); if (my.cdl.getCount() > 0) throw new Exception(attr+": Count down not reached!"); diff --git a/test/jdk/javax/management/security/HashedPasswordFileTest.java b/test/jdk/javax/management/security/HashedPasswordFileTest.java index 195a9cd34499..f84e00abd4ed 100644 --- a/test/jdk/javax/management/security/HashedPasswordFileTest.java +++ b/test/jdk/javax/management/security/HashedPasswordFileTest.java @@ -110,9 +110,7 @@ private String[] getHash(String algorithm, String password) { } private String getPasswordFilePath() { - String testDir = System.getProperty("test.src"); - String testFileName = "jmxremote.password"; - return testDir + File.separator + testFileName; + return "jmxremote.password"; } private File createNewPasswordFile() throws IOException { diff --git a/test/jdk/javax/net/ssl/ServerName/SSLSocketSNISensitive.java b/test/jdk/javax/net/ssl/ServerName/SSLSocketSNISensitive.java index da2f422149d6..45593b9129e7 100644 --- a/test/jdk/javax/net/ssl/ServerName/SSLSocketSNISensitive.java +++ b/test/jdk/javax/net/ssl/ServerName/SSLSocketSNISensitive.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/javax/net/ssl/Stapling/HttpsUrlConnClient.java b/test/jdk/javax/net/ssl/Stapling/HttpsUrlConnClient.java index 72a68cdddb06..b9829621d686 100644 --- a/test/jdk/javax/net/ssl/Stapling/HttpsUrlConnClient.java +++ b/test/jdk/javax/net/ssl/Stapling/HttpsUrlConnClient.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,8 +28,7 @@ * @test * @bug 8046321 8153829 * @summary OCSP Stapling for TLS - * @library ../../../../java/security/testlibrary - * @build CertificateBuilder SimpleOCSPServer + * @library /test/lib * @run main/othervm HttpsUrlConnClient RSA SHA256withRSA * @run main/othervm HttpsUrlConnClient RSASSA-PSS RSASSA-PSS */ @@ -59,8 +58,8 @@ import java.util.*; import java.util.concurrent.TimeUnit; -import sun.security.testlibrary.SimpleOCSPServer; -import sun.security.testlibrary.CertificateBuilder; +import jdk.test.lib.security.SimpleOCSPServer; +import jdk.test.lib.security.CertificateBuilder; public class HttpsUrlConnClient { diff --git a/test/jdk/javax/net/ssl/Stapling/SSLEngineWithStapling.java b/test/jdk/javax/net/ssl/Stapling/SSLEngineWithStapling.java index ec869f834311..506e7b00e6d2 100644 --- a/test/jdk/javax/net/ssl/Stapling/SSLEngineWithStapling.java +++ b/test/jdk/javax/net/ssl/Stapling/SSLEngineWithStapling.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,8 +28,7 @@ * @test * @bug 8046321 8153829 * @summary OCSP Stapling for TLS - * @library ../../../../java/security/testlibrary - * @build CertificateBuilder SimpleOCSPServer + * @library /test/lib * @run main/othervm SSLEngineWithStapling */ @@ -87,8 +86,8 @@ import java.util.Map; import java.util.concurrent.TimeUnit; -import sun.security.testlibrary.SimpleOCSPServer; -import sun.security.testlibrary.CertificateBuilder; +import jdk.test.lib.security.SimpleOCSPServer; +import jdk.test.lib.security.CertificateBuilder; public class SSLEngineWithStapling { diff --git a/test/jdk/javax/net/ssl/Stapling/SSLSocketWithStapling.java b/test/jdk/javax/net/ssl/Stapling/SSLSocketWithStapling.java index 7e1473c2828a..30f5e5898899 100644 --- a/test/jdk/javax/net/ssl/Stapling/SSLSocketWithStapling.java +++ b/test/jdk/javax/net/ssl/Stapling/SSLSocketWithStapling.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,8 +28,7 @@ * @test * @bug 8046321 8153829 * @summary OCSP Stapling for TLS - * @library ../../../../java/security/testlibrary - * @build CertificateBuilder SimpleOCSPServer + * @library /test/lib * @run main/othervm SSLSocketWithStapling */ @@ -63,8 +62,8 @@ import java.util.HashMap; import java.util.concurrent.TimeUnit; -import sun.security.testlibrary.SimpleOCSPServer; -import sun.security.testlibrary.CertificateBuilder; +import jdk.test.lib.security.SimpleOCSPServer; +import jdk.test.lib.security.CertificateBuilder; public class SSLSocketWithStapling { diff --git a/test/jdk/javax/net/ssl/Stapling/StapleEnableProps.java b/test/jdk/javax/net/ssl/Stapling/StapleEnableProps.java index 14651cf3db92..90b01d19c03b 100644 --- a/test/jdk/javax/net/ssl/Stapling/StapleEnableProps.java +++ b/test/jdk/javax/net/ssl/Stapling/StapleEnableProps.java @@ -28,8 +28,7 @@ * @test * @bug 8145854 8153829 * @summary SSLContextImpl.statusResponseManager should be generated if required - * @library ../../../../java/security/testlibrary - * @build CertificateBuilder SimpleOCSPServer + * @library /test/lib * @run main/othervm StapleEnableProps */ @@ -49,8 +48,8 @@ import java.util.Objects; import java.util.concurrent.TimeUnit; -import sun.security.testlibrary.SimpleOCSPServer; -import sun.security.testlibrary.CertificateBuilder; +import jdk.test.lib.security.SimpleOCSPServer; +import jdk.test.lib.security.CertificateBuilder; public class StapleEnableProps { diff --git a/test/jdk/javax/net/ssl/TLSCommon/ConcurrentClientAccessTest.java b/test/jdk/javax/net/ssl/TLSCommon/ConcurrentClientAccessTest.java index b26c82c8cfb5..5c632f529ab6 100644 --- a/test/jdk/javax/net/ssl/TLSCommon/ConcurrentClientAccessTest.java +++ b/test/jdk/javax/net/ssl/TLSCommon/ConcurrentClientAccessTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/javax/net/ssl/TLSCommon/TLSTest.java b/test/jdk/javax/net/ssl/TLSCommon/TLSTest.java index d13227157491..12de3c0e096a 100644 --- a/test/jdk/javax/net/ssl/TLSCommon/TLSTest.java +++ b/test/jdk/javax/net/ssl/TLSCommon/TLSTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/javax/net/ssl/TLSCommon/TestSessionLocalPrincipal.java b/test/jdk/javax/net/ssl/TLSCommon/TestSessionLocalPrincipal.java index 092a6e4aee8a..9daae683cc90 100644 --- a/test/jdk/javax/net/ssl/TLSCommon/TestSessionLocalPrincipal.java +++ b/test/jdk/javax/net/ssl/TLSCommon/TestSessionLocalPrincipal.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/javax/net/ssl/TLSv11/EmptyCertificateAuthorities.java b/test/jdk/javax/net/ssl/TLSv11/EmptyCertificateAuthorities.java index 7469333e2e0a..f6ba0c1ca648 100644 --- a/test/jdk/javax/net/ssl/TLSv11/EmptyCertificateAuthorities.java +++ b/test/jdk/javax/net/ssl/TLSv11/EmptyCertificateAuthorities.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/javax/net/ssl/TLSv11/ExportableBlockCipher.java b/test/jdk/javax/net/ssl/TLSv11/ExportableBlockCipher.java index 9c46021057e9..2b8ee1229574 100644 --- a/test/jdk/javax/net/ssl/TLSv11/ExportableBlockCipher.java +++ b/test/jdk/javax/net/ssl/TLSv11/ExportableBlockCipher.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/javax/net/ssl/TLSv11/ExportableStreamCipher.java b/test/jdk/javax/net/ssl/TLSv11/ExportableStreamCipher.java index 24cbb988cf81..ecf2eae85a11 100644 --- a/test/jdk/javax/net/ssl/TLSv11/ExportableStreamCipher.java +++ b/test/jdk/javax/net/ssl/TLSv11/ExportableStreamCipher.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/javax/net/ssl/TLSv11/GenericBlockCipher.java b/test/jdk/javax/net/ssl/TLSv11/GenericBlockCipher.java index 24933838e058..cb67903287e8 100644 --- a/test/jdk/javax/net/ssl/TLSv11/GenericBlockCipher.java +++ b/test/jdk/javax/net/ssl/TLSv11/GenericBlockCipher.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/javax/net/ssl/TLSv11/GenericStreamCipher.java b/test/jdk/javax/net/ssl/TLSv11/GenericStreamCipher.java index 99a6599c129e..2c5e00ccf40f 100644 --- a/test/jdk/javax/net/ssl/TLSv11/GenericStreamCipher.java +++ b/test/jdk/javax/net/ssl/TLSv11/GenericStreamCipher.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/javax/net/ssl/TLSv12/DisabledShortDSAKeys.java b/test/jdk/javax/net/ssl/TLSv12/DisabledShortDSAKeys.java index 39937f8b7435..fa82d60c7994 100644 --- a/test/jdk/javax/net/ssl/TLSv12/DisabledShortDSAKeys.java +++ b/test/jdk/javax/net/ssl/TLSv12/DisabledShortDSAKeys.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/javax/net/ssl/TLSv12/DisabledShortRSAKeys.java b/test/jdk/javax/net/ssl/TLSv12/DisabledShortRSAKeys.java index 3f275d8a2853..e14a90b781ad 100644 --- a/test/jdk/javax/net/ssl/TLSv12/DisabledShortRSAKeys.java +++ b/test/jdk/javax/net/ssl/TLSv12/DisabledShortRSAKeys.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/javax/net/ssl/TLSv12/ShortRSAKey512.java b/test/jdk/javax/net/ssl/TLSv12/ShortRSAKey512.java index c9ff202bd2c3..4d4331dc9738 100644 --- a/test/jdk/javax/net/ssl/TLSv12/ShortRSAKey512.java +++ b/test/jdk/javax/net/ssl/TLSv12/ShortRSAKey512.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/javax/net/ssl/TLSv12/ShortRSAKeyGCM.java b/test/jdk/javax/net/ssl/TLSv12/ShortRSAKeyGCM.java index df6767eadfb7..702da61db915 100644 --- a/test/jdk/javax/net/ssl/TLSv12/ShortRSAKeyGCM.java +++ b/test/jdk/javax/net/ssl/TLSv12/ShortRSAKeyGCM.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/javax/net/ssl/TLSv12/SignatureAlgorithms.java b/test/jdk/javax/net/ssl/TLSv12/SignatureAlgorithms.java index 52191ec08820..488903c343d0 100644 --- a/test/jdk/javax/net/ssl/TLSv12/SignatureAlgorithms.java +++ b/test/jdk/javax/net/ssl/TLSv12/SignatureAlgorithms.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/javax/net/ssl/ciphersuites/ECCurvesconstraints.java b/test/jdk/javax/net/ssl/ciphersuites/ECCurvesconstraints.java index 00c19241f589..989d3276bd1a 100644 --- a/test/jdk/javax/net/ssl/ciphersuites/ECCurvesconstraints.java +++ b/test/jdk/javax/net/ssl/ciphersuites/ECCurvesconstraints.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/javax/net/ssl/templates/SSLCapabilities.java b/test/jdk/javax/net/ssl/templates/SSLCapabilities.java index 22ea36000548..a860c51ed0c2 100644 --- a/test/jdk/javax/net/ssl/templates/SSLCapabilities.java +++ b/test/jdk/javax/net/ssl/templates/SSLCapabilities.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/javax/net/ssl/templates/SSLExplorer.java b/test/jdk/javax/net/ssl/templates/SSLExplorer.java index e7642802cc0e..b145c5c68e4d 100644 --- a/test/jdk/javax/net/ssl/templates/SSLExplorer.java +++ b/test/jdk/javax/net/ssl/templates/SSLExplorer.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/javax/print/PrintSEUmlauts/PrintSEUmlauts.java b/test/jdk/javax/print/PrintSEUmlauts/PrintSEUmlauts.java index 962ef5e8bc09..ee7a983f505b 100644 --- a/test/jdk/javax/print/PrintSEUmlauts/PrintSEUmlauts.java +++ b/test/jdk/javax/print/PrintSEUmlauts/PrintSEUmlauts.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/javax/print/StreamPrintingOrientation.java b/test/jdk/javax/print/StreamPrintingOrientation.java index d7736aa4f620..77dd8f4cae04 100644 --- a/test/jdk/javax/print/StreamPrintingOrientation.java +++ b/test/jdk/javax/print/StreamPrintingOrientation.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -24,95 +24,109 @@ /* * @test * @bug 4904236 - * @summary You would see a cross-platform print dialog being popped up. Check whether orientation is shown as LANDSCAPE. Click 'OK'. 'streamexample.ps' will be created in the same dir where this application was executed. Pass if the orientation in the ps file is landscape. - * @run main/manual StreamPrintingOrientation + * @key printer + * @summary StreamPrintService ignores the PrintReqAttrSet when printing through 2D Printing + * @run main StreamPrintingOrientation */ -import java.awt.*; -import java.awt.print.*; -import javax.print.*; -import javax.print.attribute.standard.*; -import javax.print.attribute.*; -import java.io.FileOutputStream; import java.io.File; -import java.util.Locale; +import java.io.FileOutputStream; +import java.nio.file.Files; + +import java.awt.Color; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.print.PageFormat; +import java.awt.print.Printable; +import java.awt.print.PrinterException; +import java.awt.print.PrinterJob; +import javax.print.attribute.Attribute; +import javax.print.PrintService; +import javax.print.StreamPrintServiceFactory; +import javax.print.attribute.standard.Copies; +import javax.print.attribute.standard.JobName; +import javax.print.attribute.standard.OrientationRequested; +import javax.print.attribute.HashPrintRequestAttributeSet; + +public class StreamPrintingOrientation implements Printable { + + public static void main(String[] args) throws Exception { + StreamPrintingOrientation pd = new StreamPrintingOrientation(); + PrinterJob pj = PrinterJob.getPrinterJob(); + HashPrintRequestAttributeSet prSet = new HashPrintRequestAttributeSet(); + PrintService service = null; + + FileOutputStream fos = null; + String mType = "application/postscript"; -class StreamPrintingOrientation implements Printable { - /** - * Constructor - */ - public StreamPrintingOrientation() { - super(); + File fl = new File("stream_landscape.ps"); + fl.deleteOnExit(); + fos = new FileOutputStream(fl); + StreamPrintServiceFactory[] factories = PrinterJob.lookupStreamPrintServices(mType); + if (factories.length > 0) { + service = factories[0].getPrintService(fos); } - /** - * Starts the application. - */ - public static void main(java.lang.String[] args) { - StreamPrintingOrientation pd = new StreamPrintingOrientation(); - PrinterJob pj = PrinterJob.getPrinterJob(); - HashPrintRequestAttributeSet prSet = new HashPrintRequestAttributeSet(); - PrintService service = null; - FileOutputStream fos = null; - File f = null, f1 = null; - String mType = "application/postscript"; + if (service != null) { + System.out.println("Stream Print Service " + service); + pj.setPrintService(service); + } else { + throw new RuntimeException("No stream Print Service available."); + } + + pj.setPrintable(pd); + prSet.add(OrientationRequested.LANDSCAPE); + prSet.add(new Copies(1)); + prSet.add(new JobName("orientation test", null)); + System.out.println("open PrintDialog.."); - try { - f = new File("streamexample.ps"); - fos = new FileOutputStream(f); - StreamPrintServiceFactory[] factories = PrinterJob.lookupStreamPrintServices(mType); - if (factories.length > 0) - service = factories[0].getPrintService(fos); + System.out.println("\nValues in attr set passed to print method"); + Attribute attr[] = prSet.toArray(); + for (int x = 0; x < attr.length; x++) { + System.out.println("Name " + attr[x].getName() + " " + attr[x]); + } + System.out.println("About to print the data ..."); + if (service != null) { + System.out.println("TEST: calling Print"); + pj.print(prSet); + System.out.println("TEST: Printed"); + } - if (service != null) { - System.out.println("Stream Print Service "+service); - pj.setPrintService(service); - } else { - throw new RuntimeException("No stream Print Service available."); - } - } catch (Exception e) { - e.printStackTrace(); - } + File fp = new File("stream_portrait.ps"); + fp.deleteOnExit(); + fos = new FileOutputStream(fp); + if (factories.length > 0) { + service = factories[0].getPrintService(fos); + } - pj.setPrintable(pd); - prSet.add(OrientationRequested.LANDSCAPE); - prSet.add(new Copies(3)); - prSet.add(new JobName("orientation test", null)); - System.out.println("open PrintDialog.."); - if (pj.printDialog(prSet)) { - try { - System.out.println("\nValues in attr set passed to print method"); - Attribute attr[] = prSet.toArray(); - for (int x = 0; x < attr.length; x ++) { - System.out.println("Name "+attr[x].getName()+" "+attr[x]); - } - System.out.println("About to print the data ..."); - if (service != null) { - System.out.println("TEST: calling Print"); - pj.print(prSet); - System.out.println("TEST: Printed"); - } - } - catch (PrinterException pe) { - pe.printStackTrace(); - } - } + pj.setPrintService(service); + pj.setPrintable(pd); + prSet.add(OrientationRequested.PORTRAIT); + prSet.add(new Copies(1)); + prSet.add(new JobName("orientation test", null)); + if (service != null) { + pj.print(prSet); + } + if (Files.mismatch(fl.toPath(), fp.toPath()) == -1) { + throw new RuntimeException("Printing stream orientation is same " + + "for both PORTRAIT and LANDSCAPE"); } + } - //printable interface - public int print(Graphics g, PageFormat pf, int pi) throws PrinterException { + //printable interface + public int print(Graphics g, PageFormat pf, int pi) throws PrinterException { - if (pi > 0) { - return Printable.NO_SUCH_PAGE; - } - // Simply draw two rectangles - Graphics2D g2 = (Graphics2D)g; - g2.setColor(Color.black); - g2.translate(pf.getImageableX(), pf.getImageableY()); - System.out.println("StreamPrinting Test Width "+pf.getWidth()+" Height "+pf.getHeight()); - g2.drawRect(1,1,200,300); - g2.drawRect(1,1,25,25); - return Printable.PAGE_EXISTS; + if (pi > 0) { + return Printable.NO_SUCH_PAGE; } + // Simply draw two rectangles + Graphics2D g2 = (Graphics2D) g; + g2.setColor(Color.black); + g2.translate(pf.getImageableX(), pf.getImageableY()); + System.out.println("StreamPrinting Test Width " + pf.getWidth() + " Height " + pf.getHeight()); + g2.drawRect(1, 1, 200, 300); + g2.drawRect(1, 1, 25, 25); + return Printable.PAGE_EXISTS; + } } diff --git a/test/jdk/javax/print/attribute/PageRangesException.java b/test/jdk/javax/print/attribute/PageRangesException.java new file mode 100644 index 000000000000..81f9eb1a5928 --- /dev/null +++ b/test/jdk/javax/print/attribute/PageRangesException.java @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import javax.print.attribute.standard.PageRanges; + +/* + * @test + * @bug 4433126 4433096 + * @key printer + * @summary The line "ERROR: " should NOT appear. + * @run main PageRangesException + */ + +public class PageRangesException { + public static void main(String[] args) throws Exception { + // test 4433126 + try { + PageRanges pr = new PageRanges("0:22"); + throw new RuntimeException("ERROR: no exceptions"); + } catch (IllegalArgumentException ie) { + System.out.println("OKAY: IllegalArgumentException " + ie); + } + + // test 4433096 + try { + int[][] m = null; + PageRanges pr = new PageRanges(m); + throw new RuntimeException("ERROR: NullPointerException expected"); + } catch (IllegalArgumentException ie) { + throw new RuntimeException("ERROR: IllegalArgumentException", ie); + } catch (NullPointerException e) { + System.out.println("OKAY: NullPointerException"); + } + } +} diff --git a/test/jdk/javax/security/auth/Subject/CurrentSubject.java b/test/jdk/javax/security/auth/Subject/CurrentSubject.java index b2713853b74c..67e19012d1f2 100644 --- a/test/jdk/javax/security/auth/Subject/CurrentSubject.java +++ b/test/jdk/javax/security/auth/Subject/CurrentSubject.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/javax/sound/sampled/Lines/ToString.java b/test/jdk/javax/sound/sampled/Lines/ToString.java index efd73425ecbb..75158ca12ebd 100644 --- a/test/jdk/javax/sound/sampled/Lines/ToString.java +++ b/test/jdk/javax/sound/sampled/Lines/ToString.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/javax/swing/AbstractButton/bug6298940.java b/test/jdk/javax/swing/AbstractButton/bug6298940.java new file mode 100644 index 000000000000..c2857c68ae30 --- /dev/null +++ b/test/jdk/javax/swing/AbstractButton/bug6298940.java @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2005, 2025, 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 6298940 + * @key headful + * @summary Tests that mnemonic keystroke fires an action + * @library /javax/swing/regtesthelpers + * @build Util + * @run main bug6298940 + */ + +import java.awt.Robot; +import java.awt.event.KeyEvent; +import java.util.concurrent.CountDownLatch; + +import javax.swing.ButtonModel; +import javax.swing.DefaultButtonModel; +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.SwingUtilities; + +import static java.util.concurrent.TimeUnit.SECONDS; + +public final class bug6298940 { + private static JFrame frame; + + private static final CountDownLatch actionEvent = new CountDownLatch(1); + + private static void createAndShowGUI() { + ButtonModel model = new DefaultButtonModel(); + model.addActionListener(event -> { + System.out.println("ActionEvent"); + actionEvent.countDown(); + }); + model.setMnemonic('T'); + + JButton button = new JButton("Test"); + button.setModel(model); + + frame = new JFrame("bug6298940"); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + frame.add(button); + frame.pack(); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + frame.toFront(); + } + + public static void main(String[] args) throws Exception { + Robot robot = new Robot(); + + SwingUtilities.invokeAndWait(bug6298940::createAndShowGUI); + + robot.waitForIdle(); + robot.delay(500); + + Util.hitMnemonics(robot, KeyEvent.VK_T); + + try { + if (!actionEvent.await(1, SECONDS)) { + throw new RuntimeException("Mnemonic didn't fire an action"); + } + } finally { + SwingUtilities.invokeAndWait(() -> { + if (frame != null) { + frame.dispose(); + } + }); + } + } +} diff --git a/test/jdk/javax/swing/AncestorNotifier/4817630/bug4817630.java b/test/jdk/javax/swing/AncestorNotifier/4817630/bug4817630.java new file mode 100644 index 000000000000..35c42f6e78be --- /dev/null +++ b/test/jdk/javax/swing/AncestorNotifier/4817630/bug4817630.java @@ -0,0 +1,114 @@ +/* + * Copyright (c) 2003, 2023, 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 4817630 + * @summary AncestorEvent ancestorAdded thrown at JFrame creation, not at show() + * @key headful + * @run main bug4817630 + */ + +import java.lang.reflect.InvocationTargetException; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.SwingUtilities; +import javax.swing.event.AncestorEvent; +import javax.swing.event.AncestorListener; + +public class bug4817630 { + + JFrame fr; + + volatile boolean ancestorAdded = false; + volatile boolean passed = true; + + public void init() { + fr = new JFrame("bug4817630"); + JLabel label = new JLabel("Label"); + + label.addAncestorListener(new AncestorListener() { + public void ancestorAdded(AncestorEvent e) { + if (!fr.isVisible()) { + setPassed(false); + } + synchronized (bug4817630.this) { + ancestorAdded = true; + bug4817630.this.notifyAll(); + } + } + public void ancestorRemoved(AncestorEvent e) { + } + public void ancestorMoved(AncestorEvent e) { + } + }); + + fr.setLocationRelativeTo(null); + fr.getContentPane().add(label); + fr.pack(); + fr.setVisible(true); + } + + public void start() { + try { + synchronized (bug4817630.this) { + while (!ancestorAdded) { + bug4817630.this.wait(); + } + } + } catch(Exception e) { + throw new RuntimeException("Test failed because of " + + e.getLocalizedMessage()); + } + } + + public void destroy() { + if (fr != null) { + fr.setVisible(false); + fr.dispose(); + } + if (!isPassed()) { + throw new RuntimeException("ancestorAdded() method shouldn't be " + + "called before the frame is shown."); + } + } + + synchronized void setPassed(boolean passed) { + this.passed = passed; + } + + synchronized boolean isPassed() { + return passed; + } + + public static void main(String[] args) throws InterruptedException, + InvocationTargetException { + bug4817630 test = new bug4817630(); + try { + SwingUtilities.invokeAndWait(test::init); + test.start(); + } finally { + SwingUtilities.invokeAndWait(test::destroy); + } + } +} diff --git a/test/jdk/javax/swing/BoxLayout/4191948/bug4191948.java b/test/jdk/javax/swing/BoxLayout/4191948/bug4191948.java new file mode 100644 index 000000000000..a7a1f792341a --- /dev/null +++ b/test/jdk/javax/swing/BoxLayout/4191948/bug4191948.java @@ -0,0 +1,86 @@ +/* + * Copyright (c) 1999, 2023, 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 4191948 + * @summary BoxLayout doesn't ignore invisible components + * @key headful + * @run main bug4191948 + */ + +import java.awt.BorderLayout; +import java.lang.reflect.InvocationTargetException; +import javax.swing.BoxLayout; +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.SwingUtilities; + +public class bug4191948 { + JFrame frame; + JPanel p; + JButton foo1; + JButton foo2; + JButton foo3; + + public void init() { + frame = new JFrame("bug4191948"); + p = new JPanel(); + p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS)); + foo1 = (JButton)p.add(new JButton("Foo1")); + foo2 = (JButton)p.add(new JButton("Foo2")); + foo3 = (JButton)p.add(new JButton("Foo3")); + + foo2.setVisible(false); + frame.setLocationRelativeTo(null); + frame.setLayout(new BorderLayout()); + frame.add(p, BorderLayout.CENTER); + frame.pack(); + frame.setVisible(true); + } + + public void start() { + try { + int totalWidth = p.getPreferredSize().width; + int foo1Width = foo1.getPreferredSize().width; + int foo2Width = foo2.getPreferredSize().width; + int foo3Width = foo3.getPreferredSize().width; + if (totalWidth >= (foo1Width + foo2Width + foo3Width)) { + throw new RuntimeException("Panel is too wide"); + } + } finally { + if (frame != null) { + frame.setVisible(false); + frame.dispose(); + } + } + } + + public static void main(String[] args) throws InterruptedException, + InvocationTargetException { + bug4191948 test = new bug4191948(); + SwingUtilities.invokeAndWait(test::init); + SwingUtilities.invokeAndWait(test::start); + } +} diff --git a/test/jdk/javax/swing/ComponentInputMap/4248723/bug4248723.java b/test/jdk/javax/swing/ComponentInputMap/4248723/bug4248723.java new file mode 100644 index 000000000000..0218b2fbc108 --- /dev/null +++ b/test/jdk/javax/swing/ComponentInputMap/4248723/bug4248723.java @@ -0,0 +1,69 @@ +/* + * Copyright (c) 1999, 2023, 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 4248723 + * @summary Tests that ComponentInputMap doesn't throw NPE when deserializing + * @run main bug4248723 + */ + +import java.awt.event.InputEvent; +import java.awt.event.KeyEvent; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; +import javax.swing.ComponentInputMap; +import javax.swing.JButton; +import javax.swing.KeyStroke; + +public class bug4248723 { + public static Object serializeAndDeserialize(Object toWrite) + throws ClassNotFoundException, IOException { + ByteArrayOutputStream ostream = new ByteArrayOutputStream(); + ObjectOutputStream p = new ObjectOutputStream(ostream); + p.writeObject(toWrite); + p.flush(); + byte[] data = ostream.toByteArray(); + ostream.close(); + + ByteArrayInputStream istream = new ByteArrayInputStream(data); + ObjectInputStream q = new ObjectInputStream(istream); + Object retValue = q.readObject(); + istream.close(); + return retValue; + } + + public static void main(String[] argv) { + ComponentInputMap cim = new ComponentInputMap(new JButton()); + cim.put(KeyStroke.getKeyStroke( + KeyEvent.VK_B, InputEvent.CTRL_DOWN_MASK), "A"); + try { + cim = (ComponentInputMap)serializeAndDeserialize(cim); + } catch (ClassNotFoundException|IOException ignore) { + // Should not cause test to fail so silently ignore these + } + } +} diff --git a/test/jdk/javax/swing/DataTransfer/DragOverFeedbackTest.java b/test/jdk/javax/swing/DataTransfer/DragOverFeedbackTest.java new file mode 100644 index 000000000000..824f651a1a09 --- /dev/null +++ b/test/jdk/javax/swing/DataTransfer/DragOverFeedbackTest.java @@ -0,0 +1,117 @@ +/* + * Copyright (c) 2001, 2025, 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 4514071 + * @summary Tests that JTable, JList and JTree provide drag-over feedback. + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual DragOverFeedbackTest + */ + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.GridLayout; +import java.awt.datatransfer.DataFlavor; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import javax.swing.BorderFactory; +import javax.swing.JComponent; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JList; +import javax.swing.JPanel; +import javax.swing.JTable; +import javax.swing.JTree; +import javax.swing.TransferHandler; + +public class DragOverFeedbackTest { + private static final String INSTRUCTIONS = """ + This test is designed to make sure that JTable, JTree, and JList + provide visual feedback when a DnD drag operation occurs over them. + + Click on the label where it says "DRAG FROM HERE" and begin dragging. + Drag over each of the three components (JTable, JTree, JList). + While you're dragging over them, they should visually indicate the + location where a drop would occur. This visual indication may use the + selection but could be some other visual. + + If above is true press PASS else press FAIL. + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .instructions(INSTRUCTIONS) + .columns(50) + .testUI(DragOverFeedbackTest::createTestUI) + .build() + .awaitAndCheck(); + } + + private static final TransferHandler handler = new TransferHandler() { + public boolean canImport(JComponent comp, DataFlavor[] flavors) { + return true; + } + }; + + private static JFrame createTestUI() { + JFrame frame = new JFrame("DragOverFeedbackTest"); + final JLabel label = new JLabel("DRAG FROM HERE"); + label.setPreferredSize(new Dimension(400, 25)); + label.setTransferHandler(new TransferHandler("text")); + label.addMouseListener(new MouseAdapter() { + public void mousePressed(MouseEvent me) { + label.getTransferHandler().exportAsDrag(label, me, TransferHandler.COPY); + } + }); + JTable table = new JTable( + new String[][] {{"one"}, {"two"}, {"three"}, {"four"}}, + new String[] {"1"}); + table.setRowSelectionInterval(1, 1); + table.setTransferHandler(handler); + + JList list = new JList(new String[] {"one", "two", "three", "four"}); + list.setSelectedIndex(1); + list.setTransferHandler(handler); + + JTree tree = new JTree(); + tree.setSelectionRow(1); + tree.setTransferHandler(handler); + + frame.add(label, BorderLayout.NORTH); + + JPanel wrapper = new JPanel(); + wrapper.setLayout(new GridLayout(3, 1)); + table.setBorder(BorderFactory.createLineBorder(Color.BLACK)); + wrapper.add(table); + list.setBorder(BorderFactory.createLineBorder(Color.BLACK)); + wrapper.add(list); + tree.setBorder(BorderFactory.createLineBorder(Color.BLACK)); + wrapper.add(tree); + frame.add(wrapper); + frame.setSize(500, 500); + return frame; + } +} diff --git a/test/jdk/javax/swing/DataTransfer/ListDragOverFeedbackTest.java b/test/jdk/javax/swing/DataTransfer/ListDragOverFeedbackTest.java new file mode 100644 index 000000000000..b41327a106ed --- /dev/null +++ b/test/jdk/javax/swing/DataTransfer/ListDragOverFeedbackTest.java @@ -0,0 +1,119 @@ +/* + * Copyright (c) 2002, 2025, 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 4546134 + * @summary Tests that JList shows the right drop location when it has multiple columns. + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual ListDragOverFeedbackTest + */ + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.GridLayout; +import java.awt.datatransfer.DataFlavor; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import javax.swing.BorderFactory; +import javax.swing.JComponent; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JList; +import javax.swing.JPanel; +import javax.swing.TransferHandler; + +public class ListDragOverFeedbackTest { + private static final String INSTRUCTIONS = """ + JList should provide visual feedback when a DnD drag operation is + occurring over it. This test is to check that it provides the + feedback about the drop location correctly. + + Click on the label where it says "DRAG FROM HERE" and begin dragging. + Drag over each column in each of the three JLists and make sure that + the drop location indicated is appropriate for the mouse location. For + instance, if the mouse is in the first column, the drop location should + also be indicated in that first column. + + If above is true press PASS else press FAIL. + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .instructions(INSTRUCTIONS) + .columns(50) + .testUI(ListDragOverFeedbackTest::createTestUI) + .build() + .awaitAndCheck(); + } + + private static final TransferHandler handler = new TransferHandler() { + public boolean canImport(JComponent comp, DataFlavor[] flavors) { + return true; + } + }; + + private static JFrame createTestUI() { + String[] vals = new String[] { + "one", "two", "three", "four", "five", "six", "seven", "eight", + "nine", "ten", "eleven", "twelve", "thirteen", "fourteen"}; + + JFrame frame = new JFrame("ListDragOverFeedbackTest"); + final JLabel label = new JLabel("DRAG FROM HERE"); + label.setPreferredSize(new Dimension(400, 25)); + label.setTransferHandler(new TransferHandler("text")); + label.addMouseListener(new MouseAdapter() { + public void mousePressed(MouseEvent me) { + label.getTransferHandler().exportAsDrag(label, me, + TransferHandler.COPY); + } + }); + + JList list1 = new JList(vals); + list1.setTransferHandler(handler); + list1.setBorder(BorderFactory.createLineBorder(Color.BLACK)); + + JList list2 = new JList(vals); + list2.setLayoutOrientation(JList.VERTICAL_WRAP); + list2.setTransferHandler(handler); + list2.setBorder(BorderFactory.createLineBorder(Color.BLACK)); + + JList list3 = new JList(vals); + list3.setLayoutOrientation(JList.HORIZONTAL_WRAP); + list3.setTransferHandler(handler); + list3.setBorder(BorderFactory.createLineBorder(Color.BLACK)); + + JPanel wrapper = new JPanel(); + wrapper.setLayout(new GridLayout(3, 1)); + wrapper.add(list1); + wrapper.add(list2); + wrapper.add(list3); + + frame.add(label, BorderLayout.NORTH); + frame.add(wrapper); + frame.setSize(400, 500); + return frame; + } +} diff --git a/test/jdk/javax/swing/DataTransfer/bug4655513.java b/test/jdk/javax/swing/DataTransfer/bug4655513.java new file mode 100644 index 000000000000..c9f49f98939e --- /dev/null +++ b/test/jdk/javax/swing/DataTransfer/bug4655513.java @@ -0,0 +1,106 @@ +/* + * Copyright (c) 2002, 2025, 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 + * @key headful + * @bug 4655513 + * @summary TransferHandler doesn't recognize ACTION_LINK + as a valid drop action + * @library /javax/swing/regtesthelpers + * @build Util + * @run main bug4655513 + */ + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Point; +import java.awt.Robot; +import java.awt.datatransfer.StringSelection; +import java.awt.dnd.DnDConstants; +import java.awt.dnd.DragGestureRecognizer; +import java.awt.dnd.DragSource; +import java.awt.event.InputEvent; +import java.awt.event.MouseEvent; +import javax.swing.JEditorPane; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JScrollPane; +import javax.swing.SwingUtilities; + +public class bug4655513 { + private static final String LINK_URL = "http://www.example.com"; + private static volatile JEditorPane editor; + private static volatile JLabel dragSource; + private static JFrame frame; + + public static void main(String[] args) throws Exception { + try { + Robot robot = new Robot(); + SwingUtilities.invokeAndWait(bug4655513::createAndShowGUI); + robot.waitForIdle(); + robot.delay(1000); + + Point dragStartLoc = Util.getCenterPoint(dragSource); + Point dragEndLoc = Util.getCenterPoint(editor); + robot.mouseMove(dragStartLoc.x, dragStartLoc.y); + robot.mousePress(MouseEvent.BUTTON1_DOWN_MASK); + for (int y = dragStartLoc.y; y < dragEndLoc.y; y += 3) { + robot.mouseMove(dragStartLoc.x, y); + robot.delay(50); + } + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + robot.delay(500); + + SwingUtilities.invokeAndWait(() -> { + if (!editor.getText().contains(LINK_URL)) { + throw new RuntimeException("Test Failed! Drag & Drop did not work."); + } + }); + } finally { + SwingUtilities.invokeAndWait(frame::dispose); + } + } + + private static void createAndShowGUI() { + frame = new JFrame("Bug4655513 - Data Transfer"); + dragSource = new JLabel("To Test DnD, drag this label."); + dragSource.setForeground(Color.RED); + dragSource.setPreferredSize(new Dimension(250, 50)); + frame.add(dragSource, BorderLayout.NORTH); + + editor = new JEditorPane("text/plain", "Drop here."); + editor.setPreferredSize(new Dimension(250, 50)); + frame.add(new JScrollPane(editor), BorderLayout.CENTER); + + DragSource ds = new DragSource(); + DragGestureRecognizer rec = + ds.createDefaultDragGestureRecognizer(dragSource, + DnDConstants.ACTION_LINK, + dge -> dge.startDrag(null, new StringSelection(LINK_URL))); + frame.setSize(300, 150); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + } +} diff --git a/test/jdk/javax/swing/DefaultBoundedRangeModel/4297953/bug4297953.java b/test/jdk/javax/swing/DefaultBoundedRangeModel/4297953/bug4297953.java new file mode 100644 index 000000000000..a19487490720 --- /dev/null +++ b/test/jdk/javax/swing/DefaultBoundedRangeModel/4297953/bug4297953.java @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2002, 2023, 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 4297953 + * @summary Tests that DefaultBoundedRangeModel doesn't zero out the + * extent value when maximum changes + * @run main bug4297953 + */ + +import javax.swing.JScrollBar; + +public class bug4297953 { + public static void main(String[] args) { + JScrollBar sb = new JScrollBar(JScrollBar.HORIZONTAL, 90, 10, 0, 100); + sb.setMaximum(80); + if (sb.getVisibleAmount() != 10) { + throw new RuntimeException("Failed: extent is " + sb.getVisibleAmount()); + } + } +} diff --git a/test/jdk/javax/swing/DefaultButtonModel/4097723/bug4097723.java b/test/jdk/javax/swing/DefaultButtonModel/4097723/bug4097723.java new file mode 100644 index 000000000000..5ffebe3e8ff2 --- /dev/null +++ b/test/jdk/javax/swing/DefaultButtonModel/4097723/bug4097723.java @@ -0,0 +1,44 @@ +/* + * Copyright (c) 1999, 2023, 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 4097723 + * @summary Tests that method DefaultButtonModel.getGroup() exists + * @run main bug4097723 + */ + +import javax.swing.ButtonGroup; +import javax.swing.DefaultButtonModel; + +public class bug4097723 { + public static void main(String[] argv) { + DefaultButtonModel dbm = new DefaultButtonModel(); + ButtonGroup group = new ButtonGroup(); + dbm.setGroup(group); + ButtonGroup g = dbm.getGroup(); + if (g != group) { + throw new RuntimeException("Failure: getGroup() returned wrong thing"); + } + } +} diff --git a/test/jdk/javax/swing/DefaultListCellRenderer/4180943/bug4180943.java b/test/jdk/javax/swing/DefaultListCellRenderer/4180943/bug4180943.java new file mode 100644 index 000000000000..24a6257c155b --- /dev/null +++ b/test/jdk/javax/swing/DefaultListCellRenderer/4180943/bug4180943.java @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2000, 2023, 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 4180943 + * @summary Extra borders created by DefaultListCellRenderer + * @run main bug4180943 + */ + +import javax.swing.DefaultListCellRenderer; + +public class bug4180943 { + public static void main(String[] argv) { + DefaultListCellRenderer lcr1 = new DefaultListCellRenderer(); + DefaultListCellRenderer lcr2 = new DefaultListCellRenderer(); + if (lcr1.getBorder() != lcr2.getBorder()) { + throw new RuntimeException("Extra borders created by DefaultListCellRenderer"); + } + } +} diff --git a/test/jdk/javax/swing/DefaultListModel/4466250/bug4466250.java b/test/jdk/javax/swing/DefaultListModel/4466250/bug4466250.java new file mode 100644 index 000000000000..16c3899ea6d3 --- /dev/null +++ b/test/jdk/javax/swing/DefaultListModel/4466250/bug4466250.java @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2003, 2023, 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 4466250 + * @summary DefaultListModel.removeRange does not throw IllegalArgumentException + * @run main bug4466250 +*/ + +import javax.swing.DefaultListModel; +import javax.swing.JLabel; + +public class bug4466250 { + public static void main(String[] args) { + DefaultListModel model = new DefaultListModel(); + int size = 16; + for (int i = 0; i < size; i++ ) { + model.addElement(new JLabel("wow")); + } + + try { + model.removeRange(3, 1); + throw new RuntimeException("IllegalArgumentException has not been thrown"); + } catch (IllegalArgumentException e) { + } + } +} diff --git a/test/jdk/javax/swing/DefaultListSelectionModel/4140619/bug4140619.java b/test/jdk/javax/swing/DefaultListSelectionModel/4140619/bug4140619.java new file mode 100644 index 000000000000..3ea55270b7a0 --- /dev/null +++ b/test/jdk/javax/swing/DefaultListSelectionModel/4140619/bug4140619.java @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2001, 2023, 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 4140619 + * @summary Breaks SINGLE_SELECTION in DefaultListSelectionModel.setLeadSelectionIndex() + * @run main bug4140619 + */ + +import javax.swing.DefaultListSelectionModel; +import javax.swing.ListSelectionModel; + +public class bug4140619 { + public static void main(String[] args) { + DefaultListSelectionModel selection = new DefaultListSelectionModel(); + selection.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); + selection.setSelectionInterval(10, 10); + selection.removeSelectionInterval(10, 10); + selection.setLeadSelectionIndex(2); + selection.setLeadSelectionIndex(30); + selection.setLeadSelectionIndex(5); + + if (selection.getMinSelectionIndex()!=5 + || selection.getMaxSelectionIndex()!=5) { + throw new RuntimeException("DefaultListSelectionModel: breaks SINGLE_SELECTION " + + "in setLeadSelectionIndex()"); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/vm/share/transform/AbstractClassFileTransformer.java b/test/jdk/javax/swing/DefaultListSelectionModel/4177723/bug4177723.java similarity index 55% rename from test/hotspot/jtreg/vmTestbase/vm/share/transform/AbstractClassFileTransformer.java rename to test/jdk/javax/swing/DefaultListSelectionModel/4177723/bug4177723.java index 95906789fda3..c247429dc198 100644 --- a/test/hotspot/jtreg/vmTestbase/vm/share/transform/AbstractClassFileTransformer.java +++ b/test/jdk/javax/swing/DefaultListSelectionModel/4177723/bug4177723.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2023, 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,32 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package vm.share.transform; -import java.lang.instrument.ClassFileTransformer; -import java.lang.instrument.IllegalClassFormatException; -import java.security.ProtectionDomain; +/* @test + * @bug 4177723 + * @summary ListSelectionEvents fired on model changes affecting JList selection + * @run main bug4177723 + */ + +import javax.swing.DefaultListModel; +import javax.swing.JList; -public abstract class AbstractClassFileTransformer - implements ClassFileTransformer { - protected abstract boolean shouldBeTransformed(String name); +public class bug4177723 { + static int count = 0; + + public static void main (String[] args) { + DefaultListModel model = new DefaultListModel(); + for (int i = 0; i < 10; i++) { + model.addElement("item " + i); + } - protected abstract byte[] transformClass(byte[] bytes); + JList list = new JList(model); + list.addListSelectionListener(e -> count++); - @Override - public byte[] transform(ClassLoader loader, String className, - Class classBeingRedefined, ProtectionDomain protectionDomain, - byte[] classfileBuffer) throws IllegalClassFormatException { - if (shouldBeTransformed(className)) { - return transformClass(classfileBuffer); + list.getSelectionModel().setSelectionInterval(3, 8); + model.removeRange(4, 7); + if (count != 2) { + throw new RuntimeException("ListSelectionEvent wasn't generated"); } - return null; } } diff --git a/test/jdk/javax/swing/ImageIcon/4827074/bug4827074.java b/test/jdk/javax/swing/ImageIcon/4827074/bug4827074.java new file mode 100644 index 000000000000..44a80b520804 --- /dev/null +++ b/test/jdk/javax/swing/ImageIcon/4827074/bug4827074.java @@ -0,0 +1,109 @@ +/* + * Copyright (c) 2003, 2023, 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 4827074 + * @summary ImageIcon serialization does not preload restored images + * @run main bug4827074 + */ + +import javax.swing.ImageIcon; +import java.awt.Image; +import java.awt.Panel; +import java.awt.image.MemoryImageSource; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.io.ObjectInputStream; +import java.io.ObjectOutputStream; + +public class bug4827074 extends Panel { + + static ImageIcon testIcon = null; + private volatile static boolean passed = false; + + public void init() { + testIcon = new TestImageIcon(); + ImageIcon icon = saveAndLoad(testIcon); + + if (!passed) { + throw new RuntimeException("Image was not loaded properly"); + } + } + + synchronized static void setPassed(boolean p) { + passed = p; + } + + static ImageIcon saveAndLoad(ImageIcon ii) { + ImageIcon _ii = null; + try { + ByteArrayOutputStream baos = new ByteArrayOutputStream(); + ObjectOutputStream out = new ObjectOutputStream(baos); + out.writeObject(ii); + out.flush(); + ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray()); + ObjectInputStream in = new ObjectInputStream(bais); + _ii = (ImageIcon)in.readObject(); + } catch (Exception ex) { + ex.printStackTrace(); + } + return _ii; + } + + class TestImageIcon extends ImageIcon { + public TestImageIcon() { + super(); + setImage(buildImage()); + } + + private Image buildImage() { + int w = 32, h = 32; + float halfW = w / 2 , halfH = h / 2; + int col = 0xff0000; + int[] pixels = new int[w * h]; + for(int y = 0; y < h; y++) { + for(int x = 0; x < w; x++) { + float cx = 1f - (float)x / halfW; + float cy = 1f - (float)y / halfH; + double ray = Math.sqrt(cx * cx + cy * cy); + pixels[y * w + x] = ray < 1 ? col | (255 - (int)(ray * 255)) << 24:0; + } + } + MemoryImageSource mis = new MemoryImageSource(w, h, pixels, 0, w); + Image image = createImage(mis); + return image; + } + + protected void loadImage(Image image) { + super.loadImage(image); + if (testIcon != null && image != testIcon.getImage()) { + setPassed(true); + } + } + } + + public static void main(String[] args) { + bug4827074 bug = new bug4827074(); + bug.init(); + } +} diff --git a/test/jdk/javax/swing/InputVerifier/bug4774166.java b/test/jdk/javax/swing/InputVerifier/bug4774166.java new file mode 100644 index 000000000000..644845611b92 --- /dev/null +++ b/test/jdk/javax/swing/InputVerifier/bug4774166.java @@ -0,0 +1,255 @@ +/* + * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.FlowLayout; +import java.awt.event.KeyEvent; +import java.lang.reflect.InvocationTargetException; +import javax.swing.InputVerifier; +import javax.swing.JComponent; +import javax.swing.JDialog; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.JTextField; +import javax.swing.JWindow; +import javax.swing.SwingUtilities; + +import static java.awt.event.InputEvent.BUTTON1_DOWN_MASK; + +/* + * @test + * @bug 4774166 + * @key headful + * @summary InputVerifier should be called after a window loses and then regains focus + * @library /javax/swing/regtesthelpers + * @build JRobot + * @run main bug4774166 + */ + +class TestPanel extends JPanel { + JTextField tf1 = null; + JTextField tf2 = null; + volatile boolean verifierCalled; + + public void init() { + tf1 = new JTextField(10); + tf2 = new JTextField(10); + + InputVerifier verifier = new InputVerifier() { + public boolean verify(JComponent input) { + verifierCalled = true; + return false; + } + }; + + setLayout(new FlowLayout()); + tf1.setInputVerifier(verifier); + add(tf1); + add(tf2); + validate(); + } +} + +public class bug4774166 { + private static JRobot robot = JRobot.getRobot(); + + JFrame testframe; + JFrame testwindowframe; + JFrame customframe; + JWindow testwindow; + JDialog testdialog; + JTextField frametf1, frametf2, windowtf1, windowtf2, dialogtf1, dialogtf2; + TestPanel testpanel; + + volatile boolean isFocused; + volatile boolean verifierCalled; + + public void setupGUI() { + testframe = new JFrame("Test 4774166"); + testframe.setLayout(new FlowLayout()); + testframe.setBounds(100, 100, 200, 100); + + testwindowframe = new JFrame("Owner of JWindow"); + testwindowframe.setBounds(0, 0, 0, 0); + + testwindow = new JWindow(testwindowframe); + testwindow.setBounds(175, 325, 200, 100); + testwindow.setLayout(new FlowLayout()); + + testdialog = new JDialog((JFrame)null, "Test dialog"); + testdialog.setBounds(420, 100, 200, 100); + testdialog.setLayout(new FlowLayout()); + + InputVerifier verifier = new InputVerifier() { + public boolean verify(JComponent input) { + verifierCalled = true; + return false; + } + }; + + frametf1 = new JTextField(10); + frametf2 = new JTextField(10); + frametf1.setInputVerifier(verifier); + testframe.add(frametf1); + testframe.add(frametf2); + testframe.setVisible(true); + + windowtf1 = new JTextField(10); + windowtf2 = new JTextField(10); + windowtf1.setInputVerifier(verifier); + testwindow.add(windowtf1); + testwindow.add(windowtf2); + testwindowframe.setVisible(true); + testwindow.setVisible(true); + + dialogtf1 = new JTextField(10); + dialogtf2 = new JTextField(10); + dialogtf1.setInputVerifier(verifier); + testdialog.add(dialogtf1); + testdialog.add(dialogtf2); + testdialog.setVisible(true); + + customframe = new JFrame("Frame with custom panel"); + customframe.setLayout(new FlowLayout()); + testpanel = new TestPanel(); + testpanel.init(); + + customframe.add(testpanel); + customframe.setBounds(420, 250, 200, 100); + customframe.pack(); + customframe.setVisible(true); + } + + public void performTest() throws InterruptedException, InvocationTargetException { + robot.setAutoDelay(100); + robot.delay(2000); + + robot.clickMouseOn(frametf1, BUTTON1_DOWN_MASK); + robot.hitKey(KeyEvent.VK_A); + robot.hitKey(KeyEvent.VK_B); + robot.hitKey(KeyEvent.VK_C); + robot.hitKey(KeyEvent.VK_D); + robot.hitKey(KeyEvent.VK_E); + + robot.clickMouseOn(windowtf1, BUTTON1_DOWN_MASK); + robot.hitKey(KeyEvent.VK_F); + robot.hitKey(KeyEvent.VK_G); + robot.hitKey(KeyEvent.VK_H); + robot.hitKey(KeyEvent.VK_I); + robot.hitKey(KeyEvent.VK_J); + + robot.clickMouseOn(dialogtf1, BUTTON1_DOWN_MASK); + robot.hitKey(KeyEvent.VK_K); + robot.hitKey(KeyEvent.VK_L); + robot.hitKey(KeyEvent.VK_M); + robot.hitKey(KeyEvent.VK_N); + robot.hitKey(KeyEvent.VK_O); + + robot.clickMouseOn(testpanel.tf1, BUTTON1_DOWN_MASK); + robot.hitKey(KeyEvent.VK_P); + robot.hitKey(KeyEvent.VK_Q); + robot.hitKey(KeyEvent.VK_R); + robot.hitKey(KeyEvent.VK_S); + robot.hitKey(KeyEvent.VK_T); + + verifierCalled = false; + robot.clickMouseOn(frametf2, BUTTON1_DOWN_MASK); + robot.delay(2000); + SwingUtilities.invokeAndWait(() -> { + isFocused = frametf1.isFocusOwner(); + }); + if (!isFocused) { + throw new RuntimeException("Focus error. Test failed!"); + } + if (!verifierCalled) { + throw new RuntimeException("Verifier was not called upon regaining focus"); + } + + verifierCalled = false; + robot.clickMouseOn(windowtf2, BUTTON1_DOWN_MASK); + robot.delay(2000); + SwingUtilities.invokeAndWait(() -> { + isFocused = windowtf1.isFocusOwner(); + }); + if (!isFocused) { + throw new RuntimeException("Focus error. Test failed!"); + } + if (!verifierCalled) { + throw new RuntimeException("Verifier was not called upon regaining focus"); + } + + testpanel.verifierCalled = false; + robot.clickMouseOn(testpanel.tf2, BUTTON1_DOWN_MASK); + robot.delay(2000); + SwingUtilities.invokeAndWait(() -> { + isFocused = testpanel.tf1.isFocusOwner(); + }); + if (!isFocused) { + throw new RuntimeException("Focus error. Test failed!"); + } + if (!testpanel.verifierCalled) { + throw new RuntimeException("Verifier was not called upon regaining focus"); + } + + verifierCalled = false; + robot.clickMouseOn(dialogtf2, BUTTON1_DOWN_MASK); + robot.delay(2000); + SwingUtilities.invokeAndWait(() -> { + isFocused = dialogtf1.isFocusOwner(); + }); + if (!isFocused) { + throw new RuntimeException("Focus error. Test failed!"); + } + if (!verifierCalled) { + throw new RuntimeException("Verifier was not called upon regaining focus"); + } + } + + public void cleanupGUI() { + if (testframe != null) { + testframe.dispose(); + } + if (testwindowframe != null) { + testwindowframe.dispose(); + } + if (testwindow != null) { + testwindow.dispose(); + } + if (customframe != null) { + customframe.dispose(); + } + if (testdialog != null) { + testdialog.dispose(); + } + } + + public static void main(String[] args) throws InterruptedException, + InvocationTargetException { + bug4774166 b = new bug4774166(); + SwingUtilities.invokeAndWait(b::setupGUI); + try { + b.performTest(); + } finally { + SwingUtilities.invokeAndWait(b::cleanupGUI); + } + } +} diff --git a/test/jdk/javax/swing/JButton/4796987/bug4796987.java b/test/jdk/javax/swing/JButton/4796987/bug4796987.java index 62d11fc18c08..bfa6ef8d129e 100644 --- a/test/jdk/javax/swing/JButton/4796987/bug4796987.java +++ b/test/jdk/javax/swing/JButton/4796987/bug4796987.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,67 +26,91 @@ * @bug 4796987 * @key headful * @requires (os.family == "windows") - * @summary XP Only: JButton.setBorderPainted() does not work with XP L&F - * @author Alexander Scherbatiy + * @summary Verify JButton.setBorderPainted(false) removes border + * for Windows visual styles (Windows XP and later) * @library ../../regtesthelpers - * @library /test/lib - * @modules java.desktop/com.sun.java.swing.plaf.windows - * java.desktop/sun.awt - * @build jdk.test.lib.OSVersion jdk.test.lib.Platform * @build Util * @run main bug4796987 */ -import jdk.test.lib.Platform; -import jdk.test.lib.OSVersion; -import java.awt.*; -import javax.swing.*; -import com.sun.java.swing.plaf.windows.WindowsLookAndFeel; +import java.awt.BorderLayout; +import java.awt.Dimension; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.Robot; +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.IOException; + +import javax.imageio.ImageIO; +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; public class bug4796987 { private static JButton button1; private static JButton button2; private static JFrame frame; + private static JPanel panel; public static void main(String[] args) throws Exception { try { - if (Platform.isWindows() - && OSVersion.current().equals(OSVersion.WINDOWS_XP)) { - UIManager.setLookAndFeel(new WindowsLookAndFeel()); - testButtonBorder(); - } + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); + testButtonBorder(); } finally { - if (frame != null) SwingUtilities.invokeAndWait(() -> frame.dispose()); + SwingUtilities.invokeAndWait(() -> { + if (frame != null) { + frame.dispose(); + } + }); } } private static void testButtonBorder() throws Exception { Robot robot = new Robot(); - robot.setAutoDelay(50); - SwingUtilities.invokeAndWait(new Runnable() { - - public void run() { - createAndShowGUI(); - } - }); + SwingUtilities.invokeAndWait(bug4796987::createAndShowGUI); + robot.waitForIdle(); + robot.delay(500); + // Hover over button1 + Point b1Center = Util.getCenterPoint(button1); + robot.mouseMove(b1Center.x, b1Center.y); robot.waitForIdle(); - Thread.sleep(500); - Point p1 = Util.getCenterPoint(button1); - Point p2 = Util.getCenterPoint(button2); + Rectangle panelBounds = Util.invokeOnEDT(() -> + new Rectangle(panel.getLocationOnScreen(), + panel.getSize())); + BufferedImage image = robot.createScreenCapture(panelBounds); + + final Point p1 = Util.invokeOnEDT(() -> getCenterPoint(button1)); + final Point p2 = Util.invokeOnEDT(() -> getCenterPoint(button2)); - Color color = robot.getPixelColor(p1.x, p2.x); - for (int dx = p1.x; dx < p2.x - p1.x; dx++) { - robot.mouseMove(p1.x + dx, p1.y); - if (!color.equals(robot.getPixelColor(p1.x + dx, p1.y))) { + final int color = image.getRGB(p1.x, p1.y); + for (int dx = 0; p1.x + dx < p2.x; dx++) { + if (color != image.getRGB(p1.x + dx, p1.y)) { + System.err.println("Wrong color at " + (p1.x + dx) + ", " + p1.y + + " - expected " + Integer.toHexString(color)); + saveImage(image); throw new RuntimeException("Button has border and background!"); } } } + /** + * {@return the center point of a button relative to its parent} + * @param button the button to calculate the center point + */ + private static Point getCenterPoint(JButton button) { + Point location = button.getLocation(); + Dimension size = button.getSize(); + location.translate(size.width / 2, size.height / 2); + return location; + } + private static JButton getButton() { JButton button = new JButton(); button.setBorderPainted(false); @@ -95,18 +119,24 @@ private static JButton getButton() { } private static void createAndShowGUI() { - frame = new JFrame("Test"); + frame = new JFrame("bug4796987"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setSize(200, 200); - JButton button = new JButton(); - button.setBorder(null); - - JPanel panel = new JPanel(new BorderLayout(50, 50)); + panel = new JPanel(new BorderLayout(50, 50)); panel.add(getButton(), BorderLayout.CENTER); panel.add(button1 = getButton(), BorderLayout.WEST); panel.add(button2 = getButton(), BorderLayout.EAST); frame.getContentPane().add(panel); + frame.setLocationRelativeTo(null); frame.setVisible(true); } + + private static void saveImage(BufferedImage image) { + try { + ImageIO.write(image, "png", + new File("frame.png")); + } catch (IOException ignored) { + } + } } diff --git a/test/jdk/javax/swing/JButton/DefaultButtonLeak.java b/test/jdk/javax/swing/JButton/DefaultButtonLeak.java new file mode 100644 index 000000000000..5e03902e64be --- /dev/null +++ b/test/jdk/javax/swing/JButton/DefaultButtonLeak.java @@ -0,0 +1,69 @@ +/* + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.BorderLayout; +import java.awt.GridLayout; +import java.lang.reflect.InvocationTargetException; +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.SwingUtilities; + +/* + * @test + * @bug 4134035 + * @key headful + * @summary Ensure default button reference is removed from the RootPane + * when a hierarchy containing the RootPane's default button is removed + * from the RootPane. (a memory leak) + * @run main DefaultButtonLeak + */ + +public class DefaultButtonLeak { + public static void main(String[] args) throws InterruptedException, InvocationTargetException { + SwingUtilities.invokeAndWait(() -> { + JFrame frame = new JFrame("DefaultButtonLeak"); + try { + JPanel bigPanel = new JPanel(); + bigPanel.setLayout(new GridLayout(10, 10)); + for (int i = 0; i < 100; i++) { + JButton button = new JButton("Button" + i); + bigPanel.add(button); + if (i == 0) { + frame.getRootPane().setDefaultButton(button); + } + } + frame.add(bigPanel, BorderLayout.CENTER); + frame.pack(); + frame.setVisible(true); + frame.remove(bigPanel); + if (frame.getRootPane().getDefaultButton() != null) { + throw new RuntimeException("RootPane default button reference not removed."); + } + } finally { + frame.setVisible(false); + frame.dispose(); + } + }); + } +} diff --git a/test/jdk/javax/swing/JButton/bug4385611.java b/test/jdk/javax/swing/JButton/bug4385611.java new file mode 100644 index 000000000000..b7360f273601 --- /dev/null +++ b/test/jdk/javax/swing/JButton/bug4385611.java @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Graphics; +import java.awt.Insets; +import java.awt.image.BufferedImage; +import java.lang.reflect.InvocationTargetException; +import javax.swing.ImageIcon; +import javax.swing.JButton; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; + +/* + * @test + * @bug 4385611 8078655 + * @requires (os.family == "windows") + * @summary The button's preferred width/height calculation. + * @run main bug4385611 + */ + +public class bug4385611 { + static JButton bt1, bt2; + static final ImageIcon icon32x32 = generateImageIcon(); + static final Dimension DIM_32X32 = new Dimension(32, 32); + static final Dimension DIM_33X33 = new Dimension(33, 33); + + public static void main(String[] args) throws InterruptedException, + InvocationTargetException { + SwingUtilities.invokeAndWait(() -> { + try { + UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel"); + bt1 = new JButton(icon32x32); + bt1.setMargin(new Insets(0, 0, 0, 0)); + bt1.setBorder(null); + bt1.setFocusPainted(true); + + bt2 = new JButton(icon32x32); + bt2.setMargin(new Insets(0, 0, 0, 0)); + bt2.setBorder(null); + bt2.setFocusPainted(false); + + if (!bt1.getPreferredSize().equals(DIM_32X32) || + !bt2.getPreferredSize().equals(DIM_32X32)) { + throw new RuntimeException("The button's preferred size should be 32x32"); + } + } catch (Exception e) { + throw new RuntimeException("Can not initialize Metal LnF", e); + } + + try { + UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); + bt1.updateUI(); + bt1.setBorder(null); + bt2.updateUI(); + bt2.setBorder(null); + if (!bt1.getPreferredSize().equals(DIM_33X33) || + !bt2.getPreferredSize().equals(DIM_32X32)) { + throw new RuntimeException("The button's preferred size should be " + + "33x33 and 32x32 correspondingly."); + } + } catch (Exception e) { + throw new RuntimeException("Can not initialize Windows LnF", e); + } + }); + } + + private static ImageIcon generateImageIcon() { + BufferedImage image = new BufferedImage(32, 32, BufferedImage.TYPE_INT_ARGB); + Graphics g = image.createGraphics(); + g.setColor(Color.YELLOW); + g.fillRect(0, 0, 32, 32); + g.dispose(); + return new ImageIcon(image); + } +} diff --git a/test/jdk/javax/swing/JComboBox/TestComboBoxComponentRendering.java b/test/jdk/javax/swing/JComboBox/TestComboBoxComponentRendering.java index 0e176a911a39..da914314670a 100644 --- a/test/jdk/javax/swing/JComboBox/TestComboBoxComponentRendering.java +++ b/test/jdk/javax/swing/JComboBox/TestComboBoxComponentRendering.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2025, 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 @@ -33,6 +33,7 @@ import java.awt.Color; import java.awt.Component; import java.awt.image.BufferedImage; +import java.awt.Font; import java.awt.Point; import java.awt.Rectangle; import java.awt.Robot; @@ -137,6 +138,7 @@ class ComboBoxCustomRenderer extends JLabel implements ListCellRenderer { public ComboBoxCustomRenderer() { + setFont(new Font("SansSerif", Font.BOLD, 32)); setOpaque(true); setHorizontalAlignment(CENTER); setVerticalAlignment(CENTER); diff --git a/test/jdk/javax/swing/JComboBox/bug4212498.java b/test/jdk/javax/swing/JComboBox/bug4212498.java new file mode 100644 index 000000000000..b60470fdd327 --- /dev/null +++ b/test/jdk/javax/swing/JComboBox/bug4212498.java @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.event.ActionListener; +import javax.swing.JButton; +import javax.swing.JComboBox; +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JPanel; + +/* + * @test + * @bug 4212498 + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual bug4212498 + */ + +public class bug4212498 { + static JPanel panel = new JPanel(); + static JComboBox comboBox = new JComboBox(new Object[]{ + "Coma Berenices", + "Triangulum", + "Camelopardis", + "Cassiopea"}); + + private static final String INSTRUCTIONS = """ + Edit the value in the text field (without using the popup) + and then press the tab key. If the number doesn't increase, + then test fails. + + Also, try tabbing out without making a change. The number + should NOT increase unless the user changes something. + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("Instructions") + .instructions(INSTRUCTIONS) + .columns(50) + .testUI(bug4212498::createTestUI) + .build() + .awaitAndCheck(); + } + + public static JFrame createTestUI() { + JFrame frame = new JFrame("bug4212498"); + comboBox.setEditable(true); + + final JLabel label = new JLabel("0"); + + ActionListener actionListener = + e -> label.setText("" + (Integer.parseInt(label.getText()) + 1)); + + comboBox.addActionListener(actionListener); + + panel.add(comboBox); + panel.add(label); + panel.add(new JButton("B")); + + frame.getContentPane().add(panel); + frame.pack(); + frame.setLocationRelativeTo(null); + return frame; + } +} diff --git a/test/jdk/javax/swing/JComboBox/bug4459267.java b/test/jdk/javax/swing/JComboBox/bug4459267.java new file mode 100644 index 000000000000..85049936ea7f --- /dev/null +++ b/test/jdk/javax/swing/JComboBox/bug4459267.java @@ -0,0 +1,75 @@ +/* + * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.BorderLayout; +import java.awt.Robot; +import java.awt.event.KeyEvent; +import javax.swing.JComboBox; +import javax.swing.JFrame; +import javax.swing.SwingUtilities; + +/* + * @test + * @bug 4459267 + * @summary Tests that pressing PageUp in combo popup list doesn't cause + * stack overflow + * @key headful + * @run main bug4459267 + */ + +public class bug4459267 { + static JFrame frame; + + public static void main(String[] args) throws Exception { + try { + Robot robot = new Robot(); + robot.setAutoDelay(250); + + SwingUtilities.invokeAndWait(() -> createTestUI()); + robot.waitForIdle(); + robot.delay(1000); + + robot.keyPress(KeyEvent.VK_PAGE_UP); + robot.keyRelease(KeyEvent.VK_PAGE_UP); + robot.waitForIdle(); + } finally { + SwingUtilities.invokeAndWait(() -> { + if (frame != null) { + frame.dispose(); + } + }); + } + } + + public static void createTestUI() { + frame = new JFrame("bug4459267"); + JComboBox jcmb = new JComboBox(); + jcmb.addItem("JComobo1"); + jcmb.addItem("Item2"); + jcmb.addItem("Item3"); + frame.getContentPane().add(jcmb, BorderLayout.NORTH); + frame.pack(); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + } +} diff --git a/test/jdk/javax/swing/JComboBox/bug4519269.java b/test/jdk/javax/swing/JComboBox/bug4519269.java new file mode 100644 index 000000000000..29147998d0a4 --- /dev/null +++ b/test/jdk/javax/swing/JComboBox/bug4519269.java @@ -0,0 +1,94 @@ +/* + * Copyright (c) 2001, 2025, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Point; +import java.awt.Robot; +import java.awt.event.InputEvent; +import java.awt.event.KeyEvent; +import javax.swing.JComboBox; +import javax.swing.JFrame; +import javax.swing.SwingUtilities; + +/* + * @test + * @bug 4519269 + * @summary Tests that DefaultKeySelectionManager doesn't throw NPE + * @key headful + * @run main bug4519269 + */ + +public class bug4519269 { + static JFrame frame; + static JComboBox combo; + static Point p; + static Object[] data = {new CustomString("Item 1"), new CustomString("Item 2"), + new CustomString("Item 3"), new CustomString("Item 4")}; + + public static void main(String[] args) throws Exception { + try { + Robot robot = new Robot(); + robot.setAutoDelay(250); + + SwingUtilities.invokeAndWait(() -> createTestUI()); + robot.waitForIdle(); + robot.delay(1000); + + SwingUtilities.invokeAndWait(() -> p = combo.getLocationOnScreen()); + robot.mouseMove(p.x + 5, p.y + 5); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + robot.waitForIdle(); + + robot.keyPress(KeyEvent.VK_SHIFT); + robot.keyRelease(KeyEvent.VK_SHIFT); + robot.waitForIdle(); + } finally { + SwingUtilities.invokeAndWait(() -> { + if (frame != null) { + frame.dispose(); + } + }); + } + } + + public static void createTestUI() { + frame = new JFrame("bug4519269"); + combo = new JComboBox(data); + frame.getContentPane().add(combo); + frame.pack(); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + } + + static class CustomString { + String string; + + public CustomString(String s) { + string = s; + } + + public String toString() { + return null; + } + } +} diff --git a/test/jdk/javax/swing/JComponent/bug4706883.java b/test/jdk/javax/swing/JComponent/bug4706883.java new file mode 100644 index 000000000000..7375342c7a45 --- /dev/null +++ b/test/jdk/javax/swing/JComponent/bug4706883.java @@ -0,0 +1,109 @@ +/* + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.event.ActionEvent; +import java.awt.event.KeyEvent; +import java.lang.reflect.InvocationTargetException; +import java.util.Date; +import javax.swing.AbstractAction; +import javax.swing.JComponent; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.KeyStroke; +import javax.swing.SwingUtilities; + +/* + * @test + * @bug 4706883 + * @summary REGRESSION: ActionMap misses VK_PRINTSCREEN + * @key headful + * @run main bug4706883 + */ + +public class bug4706883 { + + MyPanel panel; + JFrame fr; + boolean passed = false; + + public static void main(String[] args) throws InterruptedException, + InvocationTargetException { + bug4706883 test = new bug4706883(); + SwingUtilities.invokeAndWait(test::init); + SwingUtilities.invokeAndWait(test::test); + } + public void init() { + fr = new JFrame("Test"); + + panel = new MyPanel(); + fr.add(panel); + + panel.getInputMap(JComponent.WHEN_IN_FOCUSED_WINDOW).put + (KeyStroke.getKeyStroke(KeyEvent.VK_PRINTSCREEN, 0, true), + "RELEASED"); + + panel.getActionMap().put("RELEASED", new AbstractAction() { + public void actionPerformed(ActionEvent ev) { + setPassed(true); + } + }); + + fr.setSize(200, 200); + fr.setVisible(true); + } + + public void test() { + panel.doTest(); + try { + Thread.sleep(1000); + } catch (Exception e) { + e.printStackTrace(); + } finally { + if (fr != null) { + fr.setVisible(false); + fr.dispose(); + } + } + if (!isPassed()) { + throw new RuntimeException("The key binding for VK_PRINTSCREEN wasn't processed"); + } + } + + class MyPanel extends JPanel { + public void doTest() { + KeyEvent e = new KeyEvent(this, KeyEvent.KEY_RELEASED, + (new Date()).getTime(), + 0, KeyEvent.VK_PRINTSCREEN, + KeyEvent.CHAR_UNDEFINED); + processKeyEvent(e); + } + } + + synchronized void setPassed(boolean passed) { + this.passed = passed; + } + + synchronized boolean isPassed() { + return passed; + } +} diff --git a/test/jdk/javax/swing/JDesktopPane/bug4132993.java b/test/jdk/javax/swing/JDesktopPane/bug4132993.java new file mode 100644 index 000000000000..58530ae91e60 --- /dev/null +++ b/test/jdk/javax/swing/JDesktopPane/bug4132993.java @@ -0,0 +1,51 @@ +/* + * Copyright (c) 1999, 2024, 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 4132993 + * @summary JDesktopPane.getAllFramesInLayer(..) return iconified frame + * @run main bug4132993 + */ + +import javax.swing.JDesktopPane; +import javax.swing.JInternalFrame; +import javax.swing.JLayeredPane; + + +public class bug4132993 { + public static void main(String[] args) throws Exception { + JDesktopPane mDesktop = new JDesktopPane(); + JInternalFrame jif = new JInternalFrame("My Frame"); + jif.setIconifiable(true); + mDesktop.add(jif); + jif.setIcon(true); + JInternalFrame[] ji = + mDesktop.getAllFramesInLayer(JLayeredPane.DEFAULT_LAYER); + for (int i = 0; i < ji.length; i++) { + if (jif == ji[i]) { + return; + } + } + throw new RuntimeException("JDesktopPane.getAllFramesInLayer() failed..."); + } +} diff --git a/test/jdk/javax/swing/JDesktopPane/bug4773378.java b/test/jdk/javax/swing/JDesktopPane/bug4773378.java new file mode 100644 index 000000000000..b961c77d4045 --- /dev/null +++ b/test/jdk/javax/swing/JDesktopPane/bug4773378.java @@ -0,0 +1,120 @@ +/* + * Copyright (c) 2003, 2024, 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 4773378 + * @summary BasicDesktopPaneUI.desktopManager nulled after JDesktopPane.updateUI() + * @key headful + * @run main bug4773378 + */ + +import java.awt.AWTException; +import java.awt.BorderLayout; +import java.awt.Robot; +import java.awt.event.KeyEvent; +import java.beans.PropertyVetoException; +import java.lang.reflect.InvocationTargetException; +import java.util.concurrent.CountDownLatch; +import javax.swing.DefaultDesktopManager; +import javax.swing.JDesktopPane; +import javax.swing.JFrame; +import javax.swing.JInternalFrame; +import javax.swing.SwingUtilities; +import javax.swing.event.InternalFrameAdapter; +import javax.swing.event.InternalFrameEvent; + +public class bug4773378 { + JFrame frame; + + JDesktopPane desktop; + DefaultDesktopManager desktopManager; + JInternalFrame jif; + + Robot robot; + private final CountDownLatch frameActivated = new CountDownLatch(1); + public void setupGUI() { + frame = new JFrame("bug4773378"); + frame.setLayout(new BorderLayout()); + desktop = new JDesktopPane(); + frame.add(desktop, BorderLayout.CENTER); + + jif = new JInternalFrame("jif", true, false, true, true); + jif.setSize(150, 100); + jif.setVisible(true); + desktop.add(jif); + + jif.addInternalFrameListener(new InternalFrameAdapter() { + public void internalFrameActivated(InternalFrameEvent e) { + frameActivated.countDown(); + } + }); + + desktopManager = new MyDesktopManager(); + desktop.setDesktopManager(desktopManager); + desktop.updateUI(); + + frame.setSize(200, 200); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + jif.requestFocus(); + } + + public void performTest() throws InterruptedException, + InvocationTargetException, AWTException { + SwingUtilities.invokeAndWait(() -> { + try { + jif.setSelected(true); + } catch (PropertyVetoException e) { + throw new RuntimeException(e); + } + }); + + frameActivated.await(); + + robot = new Robot(); + robot.keyPress(KeyEvent.VK_CONTROL); + robot.keyPress(KeyEvent.VK_F6); + robot.keyRelease(KeyEvent.VK_F6); + robot.keyRelease(KeyEvent.VK_CONTROL); + + robot.waitForIdle(); + } + + public void cleanupGUI() { + if (frame != null) { + frame.setVisible(false); + frame.dispose(); + } + } + + private static class MyDesktopManager extends DefaultDesktopManager { + } + + public static void main(String[] args) throws InterruptedException, + InvocationTargetException, AWTException { + bug4773378 b = new bug4773378(); + SwingUtilities.invokeAndWait(b::setupGUI); + b.performTest(); + SwingUtilities.invokeAndWait(b::cleanupGUI); + } +} diff --git a/test/jdk/javax/swing/JEditorPane/bug4325606.java b/test/jdk/javax/swing/JEditorPane/bug4325606.java new file mode 100644 index 000000000000..fa82e3f9e0ac --- /dev/null +++ b/test/jdk/javax/swing/JEditorPane/bug4325606.java @@ -0,0 +1,123 @@ +/* + * Copyright (c) 2000, 2024, 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 4325606 + * @summary Tests getting row start + * @key headful + * @run main bug4325606 + */ + +import java.awt.AWTException; +import java.awt.BorderLayout; +import java.awt.Point; +import java.awt.Robot; +import java.awt.event.InputEvent; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import java.lang.reflect.InvocationTargetException; +import javax.swing.JEditorPane; +import javax.swing.JFrame; +import javax.swing.JScrollPane; +import javax.swing.SwingUtilities; +import javax.swing.text.BadLocationException; +import javax.swing.text.Utilities; + +public class bug4325606 { + + public volatile boolean passed = true; + private JFrame frame; + private JEditorPane pane; + + public void setupGUI() { + frame = new JFrame("Click Bug"); + frame.setLayout(new BorderLayout()); + + pane = new JEditorPane(); + pane.addMouseListener(new ClickListener()); + pane.setContentType("text/html"); + pane.setText("" + + "

    Here is line one

    " + + "

    Here is line two

    " + + ""); + + frame.add(new JScrollPane(pane), BorderLayout.CENTER); + + frame.addWindowListener(new TestStateListener()); + frame.setLocation(50, 50); + frame.setSize(400, 300); + frame.setVisible(true); + } + + class TestStateListener extends WindowAdapter { + public void windowOpened(WindowEvent ev) { + Robot robo; + try { + robo = new Robot(); + } catch (AWTException e) { + throw new RuntimeException("Robot could not be created", e); + } + robo.setAutoDelay(100); + robo.delay(1000); + Point p = frame.getLocationOnScreen(); + robo.mouseMove(p.x + 50, p.y + 50); + robo.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robo.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + robo.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robo.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + robo.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robo.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + } + } + + class ClickListener extends MouseAdapter { + public void mouseClicked(MouseEvent event) { + try { + Utilities.getRowStart(pane, pane.getCaretPosition()); + } catch (BadLocationException blex) { + throw new RuntimeException("Test failed.", blex); + } + } + } + + public void cleanupGUI() { + if (frame != null) { + frame.setVisible(false); + frame.dispose(); + } + } + + public static void main(String[] args) throws InterruptedException, + InvocationTargetException, AWTException { + bug4325606 b = new bug4325606(); + try { + Robot robot = new Robot(); + SwingUtilities.invokeAndWait(b::setupGUI); + robot.waitForIdle(); + } finally { + SwingUtilities.invokeAndWait(b::cleanupGUI); + } + } +} diff --git a/test/hotspot/jtreg/vmTestbase/vm/share/process/MessageOutput.java b/test/jdk/javax/swing/JEditorPane/bug4330998.java similarity index 73% rename from test/hotspot/jtreg/vmTestbase/vm/share/process/MessageOutput.java rename to test/jdk/javax/swing/JEditorPane/bug4330998.java index 3a0b4549c485..cb8a348b591b 100644 --- a/test/hotspot/jtreg/vmTestbase/vm/share/process/MessageOutput.java +++ b/test/jdk/javax/swing/JEditorPane/bug4330998.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2024, 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,10 +20,18 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package vm.share.process; -public interface MessageOutput { - public void start(); - public void send(String msg); - public void finish(); +/* @test + * @bug 4330998 + * @summary JEditorPane.setText(null) throws NullPointerException. + * @run main bug4330998 + */ + +import javax.swing.JEditorPane; + +public class bug4330998 { + public static void main(String[] args) { + JEditorPane jep = new JEditorPane(); + jep.setText(null); + } } diff --git a/test/jdk/javax/swing/JEditorPane/bug4694598.java b/test/jdk/javax/swing/JEditorPane/bug4694598.java new file mode 100644 index 000000000000..c0dcc34b62b9 --- /dev/null +++ b/test/jdk/javax/swing/JEditorPane/bug4694598.java @@ -0,0 +1,119 @@ +/* + * Copyright (c) 2002, 2024, 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 4694598 + * @key headful + * @summary JEditor pane throws NullPointerException on mouse movement. + * @run main bug4694598 + */ + +import java.awt.AWTException; +import java.awt.Robot; +import java.io.IOException; +import java.io.Writer; +import java.lang.reflect.InvocationTargetException; +import java.net.MalformedURLException; +import java.net.URL; +import java.nio.file.Files; +import java.nio.file.Path; +import javax.swing.JEditorPane; +import javax.swing.JFrame; +import javax.swing.SwingUtilities; + +public class bug4694598 { + JFrame frame; + volatile int bottom; + final Path frameContentFile = Path.of("FrameContent.html"); + + public void setupGUI() { + frame = new JFrame("Test 4694598"); + JEditorPane jep = new JEditorPane(); + jep.setEditable(false); + frame.getContentPane().add(jep); + frame.setLocation(50, 50); + frame.setSize(400, 400); + + String frameContentString = "\n" + + " Frame content.\n" + + ""; + try (Writer writer = Files.newBufferedWriter(frameContentFile)) { + writer.write(frameContentString); + } catch (IOException ioe){ + throw new RuntimeException("Could not create html file to embed", ioe); + } + URL frameContentUrl; + try { + frameContentUrl = frameContentFile.toUri().toURL(); + } catch (MalformedURLException mue) { + throw new RuntimeException("Can not convert path to URL", mue); + } + jep.setContentType("text/html"); + String html = " " + + "" + + "" + + "" + + // ! Without bug is not reproducable + "<NOFRAMES>" + + "" + + " "; + jep.setText(html); + + frame.setVisible(true); + } + + public void performTest() throws InterruptedException, + InvocationTargetException, AWTException { + Robot robo = new Robot(); + robo.waitForIdle(); + + final int range = 20; + SwingUtilities.invokeAndWait(() -> { + bottom = frame.getLocationOnScreen().y + + frame.getSize().height - range; + }); + for (int i = 0; i < range; i++) { + robo.mouseMove(300, bottom + i); + robo.waitForIdle(); + robo.delay(50); + } + } + + public void cleanupGUI() { + if (frame != null) { + frame.setVisible(false); + frame.dispose(); + } + try { + Files.deleteIfExists(frameContentFile); + } catch (IOException ignore) {} + } + + public static void main(String[] args) throws InterruptedException, + InvocationTargetException, AWTException { + bug4694598 app = new bug4694598(); + SwingUtilities.invokeAndWait(app::setupGUI); + app.performTest(); + SwingUtilities.invokeAndWait(app::cleanupGUI); + } +} diff --git a/test/jdk/javax/swing/JFileChooser/4150029/bug4150029.java b/test/jdk/javax/swing/JFileChooser/4150029/bug4150029.java index 5388ba106a63..d5c7dab4d8ec 100644 --- a/test/jdk/javax/swing/JFileChooser/4150029/bug4150029.java +++ b/test/jdk/javax/swing/JFileChooser/4150029/bug4150029.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2010, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2010, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,73 +21,117 @@ * questions. */ -/* - bug 4150029 8006087 - summary BackSpace keyboard button does not lead to parent directory - author Oleg Mokhovikov -*/ +import java.awt.BorderLayout; +import java.awt.Point; +import java.awt.Robot; +import java.awt.event.InputEvent; +import java.awt.event.KeyEvent; +import java.io.File; +import javax.swing.JFileChooser; +import javax.swing.JFrame; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; import jdk.test.lib.Platform; -import javax.swing.*; -import java.io.File; -import java.io.IOException; +/* + * @test + * @bug 4150029 8006087 + * @key headful + * @summary BackSpace keyboard button does not lead to parent directory + * @library /test/lib + * @build jdk.test.lib.Platform + * @run main bug4150029 + */ + +public class bug4150029 { + private static JFrame frame; + private static JFileChooser fileChooser; + private static Robot robot; + private static File prevDir; + private static File crntDir; + private static volatile Point p; -public class bug4150029 extends JApplet { - private boolean res; + public static void main(String[] args) throws Exception { + robot = new Robot(); + robot.setAutoDelay(100); - public void init() { - if (Platform.isOSX()) { - try { - UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel"); - } catch (Exception e) { - throw new RuntimeException(e); + try { + if (Platform.isOSX()) { + try { + UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel"); + } catch (Exception e) { + throw new RuntimeException(e); + } } - } - String tmpDir = System.getProperty("java.io.tmpdir"); + String tmpDir = System.getProperty("java.io.tmpdir"); - if (tmpDir.length() == 0) {//'java.io.tmpdir' isn't guaranteed to be defined - tmpDir = System.getProperty("user.home"); + //'java.io.tmpdir' isn't guaranteed to be defined + if (tmpDir.length() == 0) { + tmpDir = System.getProperty("user.home"); + } + System.out.println("Temp directory: " + tmpDir); + + File testDir = new File(tmpDir, "testDir"); + testDir.mkdir(); + testDir.deleteOnExit(); + System.out.println("Created directory: " + testDir); + + File subDir = new File(testDir, "subDir"); + subDir.mkdir(); + subDir.deleteOnExit(); + System.out.println("Created sub-directory: " + subDir); + + SwingUtilities.invokeAndWait(() -> { + createAndShowUI(); + fileChooser.setCurrentDirectory(subDir); + }); + + doTesting(); + } finally { + SwingUtilities.invokeAndWait(() -> { + if (frame != null) { + frame.dispose(); + } + }); } + } - System.out.println("Temp directory: " + tmpDir); - - File testDir = new File(tmpDir, "testDir"); - - testDir.mkdir(); - - File subDir = new File(testDir, "subDir"); - - subDir.mkdir(); - - System.out.println("Created directory: " + testDir); - System.out.println("Created sub-directory: " + subDir); - - JFileChooser fileChooser = new JFileChooser(testDir); + private static void createAndShowUI() { + frame = new JFrame("Backspace Shortcut for Directory Navigation Test"); + frame.setLayout(new BorderLayout()); + fileChooser = new JFileChooser(); + fileChooser.setControlButtonsAreShown(false); + frame.add(fileChooser, BorderLayout.CENTER); + frame.pack(); + frame.setLocationRelativeTo(null); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + frame.setVisible(true); + } - fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY); + private static void doTesting() throws Exception { + SwingUtilities.invokeAndWait(() -> { + p = frame.getLocationOnScreen(); + }); + robot.mouseMove(p.x + 200, p.y + 200); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); - try { - res = fileChooser.showOpenDialog(this) != JFileChooser.APPROVE_OPTION || - testDir.getCanonicalPath().equals(fileChooser.getSelectedFile().getCanonicalPath()); - } catch (IOException e) { - res = false; + robot.waitForIdle(); - e.printStackTrace(); - } + // check backspace key at subDir level + clickBackSpace(); - try { - subDir.delete(); - testDir.delete(); - } catch (SecurityException e) { - e.printStackTrace(); + if (prevDir.equals(crntDir)) { + throw new RuntimeException("BackSpace does not lead to parent directory"); } } - public void destroy() { - if (!res) { - throw new RuntimeException("BackSpace keyboard button does not lead to parent directory"); - } + private static void clickBackSpace() { + prevDir = fileChooser.getCurrentDirectory(); + robot.keyPress(KeyEvent.VK_BACK_SPACE); + robot.keyRelease(KeyEvent.VK_BACK_SPACE); + crntDir = fileChooser.getCurrentDirectory(); } } diff --git a/test/jdk/javax/swing/JFileChooser/EnterEmptyDirectory.java b/test/jdk/javax/swing/JFileChooser/EnterEmptyDirectory.java new file mode 100644 index 000000000000..5a9a7945f601 --- /dev/null +++ b/test/jdk/javax/swing/JFileChooser/EnterEmptyDirectory.java @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.BorderLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import javax.swing.JButton; +import javax.swing.JFileChooser; +import javax.swing.JPanel; +import javax.swing.UIManager; + +/* + * @test + * @bug 4913368 + * @requires (os.family == "linux") + * @summary Test repainting when entering an empty directory w/ GTK LAF + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual EnterEmptyDirectory + */ + +public class EnterEmptyDirectory { + + private static final String INSTRUCTIONS = """ + This test is only for the GTK Look & Feel. + + Step 1: + Find or create an empty directory. This directory should + be in a directory with other files and directories, such that + there are items in both the Folders and Files lists of the + JFileChooser. + + Step 2: + Click the "Show JFileChooser" button and enter the empty directory. + If both lists are correctly repainted such that they are both empty + (except for the ./ and ../) then the test passes. + + If the contents of the Folders or Files lists are unchanged, test FAILS. """; + + public static void main(String[] args) throws Exception { + UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel"); + PassFailJFrame.builder() + .title("JFileChooser Instructions") + .instructions(INSTRUCTIONS) + .rows(15) + .columns(40) + .splitUI(EnterEmptyDirectory::createAndShowUI) + .build() + .awaitAndCheck(); + } + + public static JPanel createAndShowUI() { + JButton button = new JButton("Show JFileChooser"); + button.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + JFileChooser jfc = new JFileChooser(); + jfc.setMultiSelectionEnabled(true); + jfc.showOpenDialog(null); + } + }); + JPanel p = new JPanel(); + p.setLayout(new BorderLayout()); + p.setSize(200, 200); + p.add(button); + return p; + } +} diff --git a/test/jdk/javax/swing/JFileChooser/FileSelectionTests.java b/test/jdk/javax/swing/JFileChooser/FileSelectionTests.java new file mode 100644 index 000000000000..728f7dc2b22e --- /dev/null +++ b/test/jdk/javax/swing/JFileChooser/FileSelectionTests.java @@ -0,0 +1,145 @@ +/* + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.BorderLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import javax.swing.JButton; +import javax.swing.JFileChooser; +import javax.swing.JPanel; +import javax.swing.UIManager; + +/* + * @test + * @bug 4835633 + * @requires (os.family == "windows") + * @summary Test various file selection scenarios + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual FileSelectionTests + */ + +public class FileSelectionTests { + private static final String INSTRUCTIONS = """ + This test is only for the Windows Look & Feel. + This is a test of file selection/deselection using the mouse. + There are quite a few steps. If any step doesn't behave as + expected, press Fail else press Pass. + + Make sure that you are in a directory with at least a few files. + Note that if you don't wait long enough between mouse buttons presses + that the action will be interpreted as a double-click and will dismiss + the dialog. Just re-show the dialog in this case. + + Press "Show Windows JFileChooser" button to show the JFileChooser. + + TEST 1: + Click on a filename. The file should become selected. + TEST 2: + Clear any selection. Click to right of a filename, + in the space between the filename and the file's icon in the next column. + The file should NOT be selected. If it becomes selected, press Fail. + TEST 3: + Select a filename. As in TEST 2, click in the empty space to the right of + the filename. The file should be deselected. + TEST 4: + Clear any selection. If necessary, resize the file dialog and/or change to + a directory with only a couple files, so that there is some space between + the list of files and the bottom of the file pane. + Click below the file list, in the empty space between the last file and + bottom of the file pane. The last file in the column above the cursor + should NOT become selected. If any file becomes selected, press Fail. + TEST 5: + Select a file. As in TEST 4, click in the empty space below the file list. + The selected file should become deselected. + TEST 6: + Clear any selection. As in TEST 4, click below the file list. + Then click on the last filename in the list. It should NOT go into edit mode. + TEST 7: + Clear any selection. Double-click below file list. The dialog should not be + dismissed, and no exception should be thrown. + TEST 8: + Clear any selection. As in TEST 2, press the mouse button in the empty space + to the right of a filename, but this time drag the mouse onto the filename. + The file should NOT become selected. + TEST 9: + Clear any selection. As in TEST 4, press the mouse button in the empty space + below the file list, but this time drag onto the last filename in the column. + The file should NOT become selected. + TEST 10: + Click on a filename, and then click again to go into rename mode. + Modify the filename, and then click to the right of the edit box. + The filename should be the new filename. + TEST 11: + As in TEST 10, rename a file, but this time end the editing by clicking below + the file list. Again, the file should retain the new name. + TEST 12: + Use shift-click to select several files. Hold "shift down" and click in + (1) the empty space to the right of a file name and + (2) in the empty space below the list of files. + The files should remain selected. If the selection is cleared press Fail. + TEST 13: + Switch to Details view. Repeat TESTS 1-11. + TEST 14: + Details view. Clear any selection. Click in the Size column. + No file should become selected. + TEST 15: + Details view. Select a file. Click in the Size column. + The file should be deselected. + TEST 16: + Details view. Shift-click to select several files. Shift-click in + (1) the empty space to the right of a filename + (2) in the Size column and + (3) below the list of files. + The files should remain selected. If the selection is cleared, press Fail. """; + + public static void main(String[] args) throws Exception { + UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); + PassFailJFrame.builder() + .title("JFileChooser Instructions") + .instructions(INSTRUCTIONS) + .rows(25) + .columns(50) + .testTimeOut(10) + .splitUI(FileSelectionTests::createAndShowUI) + .build() + .awaitAndCheck(); + } + + public static JPanel createAndShowUI() { + JButton button = new JButton("Show Windows JFileChooser"); + button.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + JFileChooser jfc = new JFileChooser(); + jfc.setMultiSelectionEnabled(true); + jfc.showOpenDialog(null); + } + }); + JPanel p = new JPanel(); + p.setLayout(new BorderLayout()); + p.setSize(200, 200); + p.add(button); + return p; + } +} diff --git a/test/jdk/javax/swing/JFileChooser/JFileChooserSetLocationTest.java b/test/jdk/javax/swing/JFileChooser/JFileChooserSetLocationTest.java index 0e1831afb315..c1d49127f76e 100644 --- a/test/jdk/javax/swing/JFileChooser/JFileChooserSetLocationTest.java +++ b/test/jdk/javax/swing/JFileChooser/JFileChooserSetLocationTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2024, 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 @@ -29,6 +29,7 @@ import java.awt.Point; import java.awt.Rectangle; import java.awt.Robot; +import java.awt.Toolkit; import java.awt.event.ActionListener; import java.awt.event.InputEvent; import java.awt.event.KeyEvent; @@ -209,7 +210,11 @@ private static void hitKeys(int... keys) { } public static void createUI() { - frame = new JFrame(); + Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); + + int xPos = (int) screenSize.getWidth() / 2; + int yPos = (int) screenSize.getHeight() / 2; + frame = new JFrame("FileChooser set location test"); panel = new JPanel(); btn = new JButton(SHOW_DIALOG_OUTSIDE_THE_PANEL); btn1 = new JButton(SHOW_DIALOG_OVER_THE_PANEL); @@ -238,6 +243,7 @@ public static void createUI() { frame.setLocationRelativeTo(null); frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); frame.pack(); + frame.setLocation(xPos, yPos - 200); frame.setVisible(true); } @@ -280,7 +286,6 @@ protected JDialog createDialog(Component parent) System.out.println( "createDialog and set location to (" + x + ", " + y + ")"); dialog.setLocation(x, y); - return dialog; } @@ -289,5 +294,4 @@ public Point getDialogLocation() { } } - } diff --git a/test/jdk/javax/swing/JFileChooser/ShowHiddenFiles.java b/test/jdk/javax/swing/JFileChooser/ShowHiddenFiles.java new file mode 100644 index 000000000000..ddca13675559 --- /dev/null +++ b/test/jdk/javax/swing/JFileChooser/ShowHiddenFiles.java @@ -0,0 +1,209 @@ +/* + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.BorderLayout; +import java.awt.GridLayout; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.beans.PropertyChangeListener; +import java.beans.PropertyChangeEvent; +import javax.swing.JComponent; +import javax.swing.JButton; +import javax.swing.JFileChooser; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; + +/* + * @test + * @bug 4835479 + * @requires (os.family == "windows") + * @summary JFileChooser should respect native setting for showing hidden files + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual ShowHiddenFiles + */ + +public class ShowHiddenFiles +{ + private static final String INSTRUCTIONS = """ + This tests JFileChooser's ability to track the native setting for + displaying of hidden files. + This test has four parts. If any portion of any of the tests don't + behave as specified, press FAIL else press PASS. + Before beginning the tests, you'll want to find the Folder Options + dialog on your Windows platform. Open an Explorer window for c:/ + and select Tools->Folder Options. Under the View tab, locate + the option to show hidden files. You will need this for the tests. + + TEST 1: + This tests that JFileChooser tracks the native platform setting. + Configure windows to Show Hidden Files, and in an Explorer window + locate a hidden file that is now shown (there are usually hidden + files in c:/). + Click on the TEST 1 button to display a JFileChooser. + Confirm that the hidden files are shown in the JFileChooser. + On Windows 98, TEST 1 is now complete. + On Windows 2000 and later, configure Folder Options to hide hidden + files. Confirm that + (1) the files are hidden in the JFileChooser and + (2) "PropertyChangeEvent for FILE_HIDING_CHANGED_PROPERTY" + appears in the accessory text field. + Re-enable showing of hidden files and confirm that + (1) the hidden files are again shown and + (2) you get another PropertyChangeEvent. + Press "Cancel" button to close JFileChooser window. + + TEST 2: + This tests that JFileChooser.setFileHidingEnabled(true) overrides the + native platform setting. + Make sure Windows is configured to Show Hidden Files. + Click on the TEST 2 button. + Confirm that hidden files are NOT displayed in the JFileChooser. + Press "Cancel" button to close JFileChooser window. + + TEST 3: + This tests that JFileChooser.setFileHidingEnabled(false) overrides the + Make sure Windows is configured to NOT show hidden files. + Click on the TEST 3 button. + Confirm that hidden files ARE displayed in the JFileChooser. + Press "Cancel" button to close JFileChooser window. + + TEST 4: + This tests that calling setFileHidingEnabled() on a showing + JFileChooser will cause it to ignore further changes in the + native platform setting. + Click on the TEST 4 button. As in TEST 1, confirm that the + JFileChooser tracks the native setting. + Click on the "Show Hidden Files" button. + Confirm that hidden files remain visible, even when you change + the native setting. + Repeat the test for the "Hide Hidden Files" button. + Press "Cancel" button to close JFileChooser window. + """; + private static JButton test1, test2, test3, test4; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("JFileChooser Instructions") + .instructions(INSTRUCTIONS) + .rows(25) + .columns(50) + .splitUI(ShowHiddenFiles::createAndShowUI) + .build() + .awaitAndCheck(); + } + + public static JPanel createAndShowUI() { + test1 = new JButton("TEST 1: Track native setting"); + test2 = new JButton("TEST 2: setFileHidingEnabled(true)"); + test3 = new JButton("TEST 3: setFileHidingEnabled(false)"); + test4 = new JButton("TEST 4: setFileHidingEnabled() on showing JFC"); + + ButtonListener bl = new ButtonListener(); + test1.addActionListener(bl); + test2.addActionListener(bl); + test3.addActionListener(bl); + test4.addActionListener(bl); + + JPanel p = new JPanel(); + p.setLayout(new GridLayout(4,1)); + p.setSize(200, 200); + p.add(test1); + p.add(test2); + p.add(test3); + p.add(test4); + return p; + } + + private static class ButtonListener implements ActionListener { + public void actionPerformed(ActionEvent e) { + JFileChooser jfc = new JFileChooser("c:/"); + if (e.getSource() == test1) { + jfc.setAccessory(createTest1Acc(jfc)); + } + else if (e.getSource() == test2) { + jfc.setAccessory(null); + jfc.setFileHidingEnabled(true); + } + else if (e.getSource() == test3) { + jfc.setAccessory(null); + jfc.setFileHidingEnabled(false); + } + else if (e.getSource() == test4) { + jfc.setAccessory(createTest4Acc(jfc)); + } + else { + return; + } + jfc.showOpenDialog(new JFrame()); + } + } + + private static class JFCHideButton extends JButton implements ActionListener { + JFileChooser jfc; + boolean setVal; + + public JFCHideButton(String label, JFileChooser jfc, boolean setVal) { + super(label); + this.jfc = jfc; + this.setVal = setVal; + addActionListener(this); + } + public void actionPerformed(ActionEvent e) { + jfc.setFileHidingEnabled(setVal); + } + } + + private static JPanel createTest1Acc(JFileChooser jfc) { + JPanel jpl = new JPanel(); + jpl.add(createTAListener(jfc)); + return jpl; + } + + private static JPanel createTest4Acc(JFileChooser jfc) { + JPanel jpl = new JPanel(); + jpl.setLayout(new BorderLayout()); + + JPanel north = new JPanel(); + north.setLayout(new GridLayout(2,1)); + north.add(new JFCHideButton("Show Hidden Files", jfc, false)); + north.add(new JFCHideButton("Hide Hidden Files", jfc, true)); + jpl.add(BorderLayout.NORTH, north); + jpl.add(BorderLayout.CENTER, createTAListener(jfc)); + return jpl; + } + + private static JComponent createTAListener(JFileChooser jfc) { + final JTextArea jta = new JTextArea(10,20); + PropertyChangeListener pcl = new PropertyChangeListener() { + public void propertyChange(PropertyChangeEvent e) { + jta.append("PropertyChangeEvent for FILE_HIDING_CHANGED_PROPERTY\n"); + } + }; + jfc.addPropertyChangeListener(JFileChooser.FILE_HIDING_CHANGED_PROPERTY, pcl); + JScrollPane jsp = new JScrollPane(jta); + return jsp; + } +} diff --git a/test/jdk/javax/swing/JFrame/bug4614881.java b/test/jdk/javax/swing/JFrame/bug4614881.java new file mode 100644 index 000000000000..bbefc1ebf3c2 --- /dev/null +++ b/test/jdk/javax/swing/JFrame/bug4614881.java @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2002, 2025, 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 4614881 + * @summary Ensure that client decorated frames can be brought to the front + * via mouse click on the title pane. + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual bug4614881 + */ + +import java.awt.FlowLayout; +import java.awt.Toolkit; +import javax.swing.JDialog; +import javax.swing.JFrame; + +public class bug4614881 { + + private static final String INSTRUCTIONS = """ + Select a native window so that it obscures the client decorated frame. + Select the decorated frame by clicking on the title pane. + If the decorated frame is brought to the front, then test passes else fails."""; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("bug4614881 Instructions") + .instructions(INSTRUCTIONS) + .columns(35) + .testUI(bug4614881::createTestUI) + .build() + .awaitAndCheck(); + } + + private static JFrame createTestUI() { + Toolkit.getDefaultToolkit().setDynamicLayout(true); + JFrame.setDefaultLookAndFeelDecorated(true); + JDialog.setDefaultLookAndFeelDecorated(true); + final JFrame frame = new JFrame("4614881 - Decorated Frame"); + frame.setSize(600, 400); + frame.setResizable(false); + frame.getContentPane().setLayout(new FlowLayout()); + return frame; + } +} diff --git a/test/jdk/javax/swing/JInternalFrame/Ctrli.java b/test/jdk/javax/swing/JInternalFrame/Ctrli.java new file mode 100644 index 000000000000..c97e87b7952b --- /dev/null +++ b/test/jdk/javax/swing/JInternalFrame/Ctrli.java @@ -0,0 +1,132 @@ +/* + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.BorderLayout; +import java.awt.Point; +import java.awt.Robot; +import java.awt.event.ActionEvent; +import java.awt.event.InputEvent; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; +import java.awt.event.KeyListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.MouseListener; + +import javax.swing.JFrame; +import javax.swing.JComponent; +import javax.swing.SwingUtilities; + +/* + * @test + * @bug 4199401 + * @summary DefaultFocusManager interferes with comps that + * return true to isManagingFocus(). + * @key headful + * @run main Ctrli + */ + +public class Ctrli { + private static JFrame frame; + private static JComponent keyecho; + private static volatile boolean iPressed = false; + private static volatile Point compLoc; + private static volatile int compWidth; + private static volatile int compHeight; + + public static void main(String[] args) throws Exception { + Robot robot = new Robot(); + robot.setAutoDelay(50); + robot.setAutoWaitForIdle(true); + try { + SwingUtilities.invokeAndWait(Ctrli::createAndShowUI); + robot.waitForIdle(); + robot.delay(1000); + + SwingUtilities.invokeAndWait(() -> { + compLoc = keyecho.getLocationOnScreen(); + compWidth = keyecho.getWidth(); + compHeight = keyecho.getHeight(); + }); + + robot.mouseMove(compLoc.x + compWidth / 2, compLoc.y + compHeight / 2); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + robot.waitForIdle(); + + robot.keyPress(KeyEvent.VK_CONTROL); + robot.keyPress(KeyEvent.VK_I); + robot.waitForIdle(); + robot.keyRelease(KeyEvent.VK_I); + robot.keyRelease(KeyEvent.VK_CONTROL); + robot.waitForIdle(); + + if (!iPressed) { + throw new RuntimeException("Test failed: CTRL+I not pressed."); + } + } finally { + SwingUtilities.invokeAndWait(() -> { + if (frame != null) { + frame.dispose(); + } + }); + } + } + + private static void createAndShowUI() { + frame = new JFrame("Test Ctrl+I operation"); + keyecho = new JComponent() { + public boolean isManagingFocus() { + return true; + } + }; + KeyListener keyListener = new KeyAdapter() { + public void keyPressed(KeyEvent e) { + if (((e.getModifiers() & ActionEvent.CTRL_MASK) == ActionEvent.CTRL_MASK) + && (e.getKeyCode() == 73)) + iPressed = true; + } + + public void keyTyped(KeyEvent e) { + if (!iPressed) { + throw new RuntimeException("Test failed: CTRL+I not pressed."); + } + } + }; + + MouseListener mouseListener = new MouseAdapter() { + public void mousePressed(MouseEvent e) { + keyecho.requestFocus(); + } + }; + + keyecho.addKeyListener(keyListener); + keyecho.addMouseListener(mouseListener); + frame.setLayout(new BorderLayout()); + frame.add(keyecho); + frame.setSize(200, 200); + frame.setLocationRelativeTo(null); + frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + frame.setVisible(true); + } +} diff --git a/test/jdk/javax/swing/JInternalFrame/bug4131008.java b/test/jdk/javax/swing/JInternalFrame/bug4131008.java new file mode 100644 index 000000000000..9f45175a7857 --- /dev/null +++ b/test/jdk/javax/swing/JInternalFrame/bug4131008.java @@ -0,0 +1,86 @@ +/* + * Copyright (c) 2000, 2025, 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 4131008 + * @summary JInternalFrame should refresh title after it changing + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual bug4131008 +*/ + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +import javax.swing.JButton; +import javax.swing.JDesktopPane; +import javax.swing.JFrame; +import javax.swing.JInternalFrame; +import javax.swing.UIManager; + +public class bug4131008 { + + private static final String INSTRUCTIONS = """ + Press button "Change title" at the internal frame "Old". + If title of this frame will replaced by "New", + then test passed, else test fails."""; + + public static void main(String[] args) throws Exception { + + UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel"); + + PassFailJFrame.builder() + .title("bug4131008 Instructions") + .instructions(INSTRUCTIONS) + .columns(50) + .testUI(bug4131008::createTestUI) + .build() + .awaitAndCheck(); + } + + private static JFrame createTestUI() { + JFrame frame = new JFrame("bug4131008"); + JInternalFrame jif = new JInternalFrame("Old"); + JDesktopPane jdp = new JDesktopPane(); + frame.setContentPane(jdp); + + jif.setSize(150, 100); + jif.setVisible(true); + JButton bt = new JButton("Change title"); + bt.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + jif.setTitle("New"); + } + }); + jif.getContentPane().add(bt); + jdp.add(jif); + try { + jif.setSelected(true); + } catch (Exception e) { + throw new RuntimeException(e); + } + frame.setSize(300, 200); + return frame; + } +} diff --git a/test/jdk/javax/swing/JInternalFrame/bug4176136.java b/test/jdk/javax/swing/JInternalFrame/bug4176136.java new file mode 100644 index 000000000000..019e453750c6 --- /dev/null +++ b/test/jdk/javax/swing/JInternalFrame/bug4176136.java @@ -0,0 +1,70 @@ +/* + * Copyright (c) 1999, 2025, 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 4176136 + * @summary Default close operation JInternalFrame.DO_NOTHING_ON_CLOSE works correctly + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual bug4176136 + */ + + +import javax.swing.JDesktopPane; +import javax.swing.JFrame; +import javax.swing.JInternalFrame; + +public class bug4176136 { + + private static final String INSTRUCTIONS = """ + Click the close button of the internal frame. + You will see the close button activate, + but nothing else should happen. + If the internal frame closes, the test fails. + If it doesn't close, the test passes."""; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("bug4176136 Instructions") + .instructions(INSTRUCTIONS) + .columns(25) + .testUI(bug4176136::createTestUI) + .build() + .awaitAndCheck(); + } + + private static JFrame createTestUI() { + JFrame frame = new JFrame("bug4176136"); + JDesktopPane dp = new JDesktopPane(); + frame.add(dp); + JInternalFrame inf = new JInternalFrame(); + dp.add(inf); + inf.setDefaultCloseOperation(JInternalFrame.DO_NOTHING_ON_CLOSE); + inf.setSize(100, 100); + inf.setClosable(true); + inf.setVisible(true); + frame.setSize(200, 200); + return frame; + } +} diff --git a/test/jdk/javax/swing/JInternalFrame/bug4244536.java b/test/jdk/javax/swing/JInternalFrame/bug4244536.java new file mode 100644 index 000000000000..85acb833d2aa --- /dev/null +++ b/test/jdk/javax/swing/JInternalFrame/bug4244536.java @@ -0,0 +1,75 @@ +/* + * Copyright (c) 1999, 2025, 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 4244536 + * @summary Tests that Motif JInternalFrame can be maximized + * after it was iconified. + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual bug4244536 + */ + +import javax.swing.JDesktopPane; +import javax.swing.JFrame; +import javax.swing.JInternalFrame; +import javax.swing.UIManager; + +public class bug4244536 { + + private static final String INSTRUCTIONS = """ + Minimize the internal frame using the minimize button. + Then double-click on it to restore its size. + Then press the maximize button. + If the frame gets maximized, test passes. + If its size don't change, test fails."""; + + public static void main(String[] args) throws Exception { + UIManager.setLookAndFeel( + "com.sun.java.swing.plaf.motif.MotifLookAndFeel"); + + PassFailJFrame.builder() + .title("bug4244536 Instructions") + .instructions(INSTRUCTIONS) + .columns(50) + .testUI(bug4244536::createTestUI) + .build() + .awaitAndCheck(); + } + + private static JFrame createTestUI() { + JFrame frame = new JFrame("bug4244536"); + JDesktopPane desktop = new JDesktopPane(); + JInternalFrame jif = new JInternalFrame("Internal Frame"); + jif.setSize(150, 150); + jif.setMaximizable(true); + jif.setIconifiable(true); + jif.setVisible(true); + desktop.add(jif); + frame.add("Center", desktop); + frame.setSize(300, 300); + return frame; + } + +} diff --git a/test/jdk/javax/swing/JInternalFrame/bug4305284.java b/test/jdk/javax/swing/JInternalFrame/bug4305284.java new file mode 100644 index 000000000000..8801c8c678c6 --- /dev/null +++ b/test/jdk/javax/swing/JInternalFrame/bug4305284.java @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2000, 2025, 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 4305284 + * @summary JInternalFrames can't be sized off of the desktop + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual bug4305284 + */ + +import javax.swing.JDesktopPane; +import javax.swing.JFrame; +import javax.swing.JInternalFrame; + +public class bug4305284 { + + private static final String INSTRUCTIONS = """ + Try to resize the shown internal frame. + If it can't be sized of the desktop bounds, + then test passes, else test fails."""; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("bug4305284 Instructions") + .instructions(INSTRUCTIONS) + .columns(25) + .testUI(bug4305284::createTestUI) + .build() + .awaitAndCheck(); + } + + private static JFrame createTestUI() { + JFrame frame = new JFrame("bug4305284"); + JInternalFrame jif = new JInternalFrame("Test", + true, true, true, true); + JDesktopPane dp = new JDesktopPane(); + frame.setContentPane(dp); + dp.add(jif); + + try { + jif.setBounds(50, 50, 200, 200); + jif.setMaximum(false); + jif.setVisible(true); + } catch (Exception e) { + e.printStackTrace(); + } + frame.setSize(300, 300); + return frame; + } + +} diff --git a/test/jdk/javax/swing/JMenu/4213634/bug4213634.java b/test/jdk/javax/swing/JMenu/4213634/bug4213634.java index dd699b7e5bc1..ad26ff2bc595 100644 --- a/test/jdk/javax/swing/JMenu/4213634/bug4213634.java +++ b/test/jdk/javax/swing/JMenu/4213634/bug4213634.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,103 +21,91 @@ * questions. */ -import java.awt.AWTException; import java.awt.Robot; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; import java.awt.event.KeyEvent; -import java.lang.reflect.InvocationTargetException; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JMenu; import javax.swing.JMenuBar; import javax.swing.JMenuItem; -import javax.swing.JTextArea; import javax.swing.SwingUtilities; /* * @test * @key headful * @bug 4213634 8017187 - * @author Scott Violet * @library ../../regtesthelpers * @build Util + * @summary Verifies if Alt+mnemonic char works when + * menu & menuitem have same mnemonic char * @run main bug4213634 */ - public class bug4213634 { - private JMenu menu; - - private JFrame frame; + private static JMenu menu; + private static JFrame frame; + private static Robot robot; - public static void main(String[] args) throws Throwable { - new bug4213634(); - } + public static void main(String[] args) throws Exception { + try { + robot = new Robot(); + SwingUtilities.invokeAndWait(bug4213634::createAndShowGUI); - bug4213634() throws AWTException, InterruptedException, InvocationTargetException { - SwingUtilities.invokeAndWait(new Runnable() { - @Override - public void run() { - createAndShowGUI(); - } - }); - - test(); + robot.waitForIdle(); + robot.delay(1000); + test(); + } finally { + SwingUtilities.invokeAndWait(() -> { + if (frame != null) { + frame.dispose(); + } + }); + } } - public void createAndShowGUI() { - frame = new JFrame("TEST"); + public static void createAndShowGUI() { + frame = new JFrame("bug4213634"); JMenuBar mb = new JMenuBar(); menu = mb.add(createMenu("1 - First Menu", true)); mb.add(createMenu("2 - Second Menu", false)); frame.setJMenuBar(mb); - JTextArea ta = new JTextArea("This test dedicated to Nancy and Kathleen, testers and bowlers extraordinaire\n\n\nNo exception means pass."); - frame.getContentPane().add("Center", ta); JButton button = new JButton("Test"); frame.getContentPane().add("South", button); - frame.setBounds(100, 100, 400, 400); + frame.setSize(300, 300); + frame.setLocationRelativeTo(null); frame.setVisible(true); button.requestFocusInWindow(); } - private void test() throws AWTException, InterruptedException, InvocationTargetException { - Robot robot = new Robot(); - robot.setAutoDelay(50); - robot.waitForIdle(); - + private static void test() throws Exception { Util.hitMnemonics(robot, KeyEvent.VK_1); robot.waitForIdle(); + robot.delay(100); - SwingUtilities.invokeAndWait(new Runnable() { - @Override - public void run() { - if (!menu.isSelected()) { - throw new RuntimeException( - "Failed: Menu didn't remain posted at end of test"); - } else { - System.out.println("Test passed!"); - frame.dispose(); - } + SwingUtilities.invokeAndWait(() -> { + if (!menu.isSelected()) { + throw new RuntimeException( + "Failed: Menu didn't remain posted at end of test"); + } else { + System.out.println("Test passed!"); } }); } - private JMenu createMenu(String str, boolean bFlag) { + + private static JMenu createMenu(String str, boolean bFlag) { JMenuItem menuitem; JMenu menu = new JMenu(str); menu.setMnemonic(str.charAt(0)); - for(int i = 0; i < 10; i ++) { + for (int i = 0; i < 10; i++) { menuitem = new JMenuItem("JMenuItem" + i); - menuitem.addActionListener(new ActionListener() { - public void actionPerformed(ActionEvent e) { - throw new RuntimeException( - "Failed: Mnemonic activated"); - } + menuitem.addActionListener(e -> { + throw new RuntimeException("Failed: Mnemonic activated"); }); - if(bFlag) + if (bFlag) { menuitem.setMnemonic('0' + i); + } menu.add(menuitem); } return menu; diff --git a/test/jdk/javax/swing/JMenu/TestUngrab.java b/test/jdk/javax/swing/JMenu/TestUngrab.java new file mode 100644 index 000000000000..64326009c6c7 --- /dev/null +++ b/test/jdk/javax/swing/JMenu/TestUngrab.java @@ -0,0 +1,120 @@ +/* + * Copyright (c) 2024, 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. + */ + +/* + * @test + * @bug 8267374 + * @key headful + * @requires (os.family == "mac") + * @summary Verifies menu closes when main window is resized + * @run main TestUngrab + */ + +import java.awt.Point; +import java.awt.Dimension; +import java.awt.Robot; +import java.awt.event.ActionEvent; +import java.awt.event.InputEvent; +import java.awt.event.KeyEvent; +import java.awt.event.MouseEvent; +import javax.swing.JFrame; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.SwingUtilities; + +public class TestUngrab { + /** + * Menu (JMenuBar and JPopupMenu) not hidden when resizing the window. + * -> UngrabEvent not sent. + */ + static JMenu menu; + static JFrame frame; + static volatile Point loc; + static volatile Point point; + static volatile Dimension dim; + static volatile int width; + static volatile int height; + static volatile boolean popupVisible; + + private static void createAndShowGUI() { + frame = new JFrame(); + JMenuBar mb = new JMenuBar(); + menu = new JMenu("Menu"); + menu.add(new JMenuItem("Item 1")); + menu.add(new JMenuItem("Item 2")); + mb.add(menu); + + frame.setJMenuBar(mb); + frame.setSize(300, 300); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + } + + public static void main(String[] args) throws Exception { + try { + Robot robot = new Robot(); + robot.setAutoDelay(100); + SwingUtilities.invokeAndWait(() -> createAndShowGUI()); + robot.waitForIdle(); + robot.delay(1000); + + SwingUtilities.invokeAndWait(() -> { + point = menu.getLocationOnScreen(); + dim = menu.getSize(); + }); + robot.mouseMove(point.x + dim.width / 2, point.y + dim.height / 2); + robot.waitForIdle(); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + robot.waitForIdle(); + + SwingUtilities.invokeAndWait(() -> { + loc = frame.getLocationOnScreen(); + width = frame.getWidth(); + height = frame.getHeight(); + }); + robot.mouseMove(loc.x + width, loc.y + height); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + robot.delay(1000); + + SwingUtilities.invokeAndWait(() -> { + popupVisible = menu.isPopupMenuVisible(); + }); + System.out.println("isPopupMenuVisible " + popupVisible); + if (popupVisible) { + throw new RuntimeException("popup menu not closed on resize"); + } + } finally { + SwingUtilities.invokeAndWait(() -> { + if (frame != null) { + frame.dispose(); + } + }); + } + } + +} diff --git a/test/jdk/javax/swing/JMenu/bug4140643.java b/test/jdk/javax/swing/JMenu/bug4140643.java new file mode 100644 index 000000000000..e9205dfcfc63 --- /dev/null +++ b/test/jdk/javax/swing/JMenu/bug4140643.java @@ -0,0 +1,107 @@ +/* + * Copyright (c) 2001, 2025, 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 4140643 + * @summary Tests that Motif menus open with both Alt-key and Meta-key + * @key headful + * @run main bug4140643 + */ + +import java.awt.Robot; +import java.awt.event.KeyEvent; +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; +import javax.swing.UnsupportedLookAndFeelException; + +public class bug4140643 { + private static JFrame frame; + private static JMenu menu; + private static volatile boolean isPopMenuVisible; + + public static void main(String[] args) throws Exception { + Robot robot = new Robot(); + try { + SwingUtilities.invokeAndWait(() -> { + try { + UIManager.setLookAndFeel( + "com.sun.java.swing.plaf.motif.MotifLookAndFeel"); + } catch (ClassNotFoundException | InstantiationException + | UnsupportedLookAndFeelException + | IllegalAccessException e) { + throw new RuntimeException(e); + } + frame = new JFrame("bug4140643"); + + menu = new JMenu("File"); + menu.setMnemonic(KeyEvent.VK_F); + menu.add(new JMenuItem("Open...")); + menu.add(new JMenuItem("Save")); + + JMenuBar mbar = new JMenuBar(); + mbar.add(menu); + frame.setJMenuBar(mbar); + + frame.add(new JButton("Click Here")); + frame.pack(); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + }); + robot.waitForIdle(); + robot.delay(1000); + if (System.getProperty("os.name").contains("OS X")) { + robot.keyPress(KeyEvent.VK_CONTROL); + robot.keyPress(KeyEvent.VK_ALT); + robot.keyPress(KeyEvent.VK_F); + robot.keyRelease(KeyEvent.VK_F); + robot.keyRelease(KeyEvent.VK_ALT); + robot.keyRelease(KeyEvent.VK_CONTROL); + } else { + robot.keyPress(KeyEvent.VK_ALT); + robot.keyPress(KeyEvent.VK_F); + robot.keyRelease(KeyEvent.VK_F); + robot.keyRelease(KeyEvent.VK_ALT); + } + robot.waitForIdle(); + robot.delay(1000); + SwingUtilities.invokeAndWait(() -> { + isPopMenuVisible = menu.isPopupMenuVisible(); + }); + if (!isPopMenuVisible) { + throw new RuntimeException("Menu popup is not shown"); + } + } finally { + SwingUtilities.invokeAndWait(() -> { + if (frame != null) { + frame.dispose(); + } + }); + } + } +} diff --git a/test/jdk/javax/swing/JMenu/bug4146588.java b/test/jdk/javax/swing/JMenu/bug4146588.java new file mode 100644 index 000000000000..a27380daa230 --- /dev/null +++ b/test/jdk/javax/swing/JMenu/bug4146588.java @@ -0,0 +1,100 @@ +/* + * Copyright (c) 2001, 2025, 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 4146588 + * @summary JMenu.setMenuLocation has no effect + * @key headful + * @run main bug4146588 + */ + +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.Robot; +import javax.swing.JFrame; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.SwingUtilities; + +public class bug4146588 { + + private static JFrame fr; + private static JMenu menu; + private static volatile Point loc; + private static volatile Point popupLoc; + private static volatile Point menuLoc; + private static volatile Rectangle frameBounds; + private static volatile Rectangle popupBounds; + + public static void main(String[] args) throws Exception { + Robot robot = new Robot(); + try { + SwingUtilities.invokeAndWait(() -> { + fr = new JFrame("bug4146588 frame"); + + JMenuBar menubar = new JMenuBar(); + menu = new JMenu("Menu"); + menu.add("Item 1"); + menu.add("Item 2"); + menu.add("Item 3"); + menu.setMenuLocation(150, 150); + menubar.add(menu); + fr.setJMenuBar(menubar); + + fr.setSize(400, 400); + fr.setLocationRelativeTo(null); + fr.setVisible(true); + }); + robot.waitForIdle(); + robot.delay(1000); + SwingUtilities.invokeAndWait(() -> { + menu.doClick(0); + }); + robot.waitForIdle(); + robot.delay(200); + SwingUtilities.invokeAndWait(() -> { + popupLoc = menu.getPopupMenu().getLocationOnScreen(); + menuLoc = menu.getLocationOnScreen(); + frameBounds = fr.getBounds(); + popupBounds = menu.getPopupMenu().getBounds(); + }); + System.out.println(popupLoc); + System.out.println(popupBounds); + System.out.println(frameBounds); + System.out.println(menuLoc); + if (!(popupLoc.getX() + > ((frameBounds.getX() + frameBounds.getWidth() / 2) - popupBounds.getWidth())) + && (popupLoc.getY() + > ((frameBounds.getY() + frameBounds.getHeight() / 2) - popupBounds.getHeight()))) { + throw new RuntimeException("popup is not at center of frame"); + } + } finally { + SwingUtilities.invokeAndWait(() -> { + if (fr != null) { + fr.dispose(); + } + }); + } + } +} diff --git a/test/jdk/javax/swing/JMenu/bug4342646.java b/test/jdk/javax/swing/JMenu/bug4342646.java new file mode 100644 index 000000000000..610eb349bcfd --- /dev/null +++ b/test/jdk/javax/swing/JMenu/bug4342646.java @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2001, 2025, 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 4342646 + * @summary Tests that very long menus are properly placed on the screen. + * @key headful + * @run main bug4342646 + */ + +import java.awt.Point; +import java.awt.Robot; + +import javax.swing.JFrame; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.SwingUtilities; + +public class bug4342646 { + + private static JFrame frame; + private static JMenu menu; + private static volatile Point popupLoc; + private static volatile Point menuLoc; + + public static void main(String[] args) throws Exception { + Robot robot = new Robot(); + try { + SwingUtilities.invokeAndWait(() -> { + JMenuBar mbar = new JMenuBar(); + menu = new JMenu("Menu"); + menu.add(new JMenuItem( + "AAAAAAAAAAAAAAAAAAAAAAAAAAAA" + + "AAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + + "AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA" + + "AAAAAAAAAAAAAAAAAAAAAAA")); + mbar.add(menu); + + frame = new JFrame("4342646"); + frame.setJMenuBar(mbar); + frame.setBounds(10, 10, 200, 100); + frame.setVisible(true); + }); + robot.waitForIdle(); + robot.delay(1000); + SwingUtilities.invokeAndWait(() -> { + menu.doClick(); + }); + robot.waitForIdle(); + robot.delay(200); + SwingUtilities.invokeAndWait(() -> { + popupLoc = menu.getPopupMenu().getLocationOnScreen(); + menuLoc = menu.getLocationOnScreen(); + }); + System.out.println(menuLoc); + System.out.println(popupLoc); + if (popupLoc.getX() < menuLoc.getX()) { + throw new RuntimeException("PopupMenu is incorrectly placed at left of menu"); + } + } finally { + SwingUtilities.invokeAndWait(() -> { + if (frame != null) { + frame.dispose(); + } + }); + } + } +} diff --git a/test/jdk/javax/swing/JMenuItem/JActionCommandTest.java b/test/jdk/javax/swing/JMenuItem/JActionCommandTest.java new file mode 100644 index 000000000000..0041a509a2f1 --- /dev/null +++ b/test/jdk/javax/swing/JMenuItem/JActionCommandTest.java @@ -0,0 +1,159 @@ +/* + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.BorderLayout; +import java.awt.Point; +import java.awt.Robot; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.InputEvent; +import java.awt.event.KeyEvent; + +import javax.swing.JFrame; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.JTextField; +import javax.swing.KeyStroke; +import javax.swing.SwingUtilities; + +/* + * @test + * @bug 4159610 + * @key headful + * @summary Verifies that JMenuItem's shortcuts are not inserted in JTextField + * @run main JActionCommandTest + */ + +public class JActionCommandTest { + + private static Robot robot; + private static JMenu m; + private static JMenuItem mi; + private static JFrame f; + private static JTextField tf; + private static volatile Point menuLoc; + private static volatile Point menuItemLoc; + private static volatile Point textFieldLoc; + private static volatile int menuWidth; + private static volatile int menuHeight; + private static volatile int menuItemWidth; + private static volatile int menuItemHeight; + private static volatile int textFieldWidth; + private static volatile int textFieldHeight; + private static volatile boolean passed = false; + + public static void main(String[] args) throws Exception { + robot = new Robot(); + robot.setAutoDelay(50); + robot.setAutoWaitForIdle(true); + try { + SwingUtilities.invokeAndWait(JActionCommandTest::createAndShowUI); + robot.waitForIdle(); + robot.delay(1000); + SwingUtilities.invokeAndWait(() -> { + menuLoc = m.getLocationOnScreen(); + menuWidth = m.getWidth(); + menuHeight = m.getHeight(); + + textFieldLoc = tf.getLocationOnScreen(); + textFieldWidth = tf.getWidth(); + textFieldHeight = tf.getHeight(); + }); + moveAndPressMouse(menuLoc.x, menuLoc.y, menuWidth, menuHeight); + + SwingUtilities.invokeAndWait(() -> { + menuItemLoc = mi.getLocationOnScreen(); + menuItemWidth = mi.getWidth(); + menuItemHeight = mi.getHeight(); + }); + moveAndPressMouse(menuItemLoc.x, menuItemLoc.y, menuItemWidth, menuItemHeight); + System.out.println("passed is: "+passed); + if (!passed) { + throw new RuntimeException("Test Failed: JMenuItem label is not" + + " equals to 'Testitem'."); + } + passed = false; + moveAndPressMouse(textFieldLoc.x, textFieldLoc.y, textFieldWidth, textFieldHeight); + robot.keyPress(KeyEvent.VK_ALT); + robot.keyPress(KeyEvent.VK_T); + robot.keyRelease(KeyEvent.VK_T); + robot.keyRelease(KeyEvent.VK_ALT); + robot.waitForIdle(); + + System.out.println("passed is: "+passed); + System.out.println("tf.getText() is: "+tf.getText()); + if (!passed && tf.getText().equals("t")) { + throw new RuntimeException("Test Failed: Either JMenuItem label is not" + + " equal to 'Testitem' or JTextField contains text 't'. "); + } + } finally { + SwingUtilities.invokeAndWait(() -> { + if (f != null) { + f.dispose(); + } + }); + } + } + + private static void createAndShowUI() { + CustomActionListener customListener = new CustomActionListener(); + f = new JFrame("Test JMenuItem Shortcut"); + f.setLayout(new BorderLayout()); + tf = new JTextField(12); + tf.addActionListener(customListener); + JMenuBar mb = new JMenuBar(); + m = new JMenu("Test"); + mi = new JMenuItem("Testitem"); + KeyStroke ks = KeyStroke.getKeyStroke(java.awt.event.KeyEvent.VK_T, + java.awt.Event.ALT_MASK, false); + mi.setAccelerator(ks); + mi.addActionListener(customListener); + m.add(mi); + mb.add(m); + f.setJMenuBar(mb); + f.add("South", tf); + f.setSize(200, 200); + f.setLocationRelativeTo(null); + f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + f.setVisible(true); + } + + public static void moveAndPressMouse(int x, int y, int width, int height) { + robot.mouseMove(x + width / 2, y + height / 2); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.waitForIdle(); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + robot.waitForIdle(); + } + + static class CustomActionListener implements ActionListener { + @Override + public void actionPerformed(ActionEvent e) { + if (e.getSource() == mi && e.getActionCommand().equals("Testitem")) { + System.out.println("MenuItem's label: " + e.getActionCommand()); + passed = true; + } + } + } +} diff --git a/test/jdk/javax/swing/JMenuItem/RightLeftOrientation.java b/test/jdk/javax/swing/JMenuItem/RightLeftOrientation.java new file mode 100644 index 000000000000..6c7185b547ac --- /dev/null +++ b/test/jdk/javax/swing/JMenuItem/RightLeftOrientation.java @@ -0,0 +1,166 @@ +/* + * Copyright (c) 1999, 2025, 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 4211052 + * @requires (os.family == "windows") + * @summary + * This test checks if menu items lay out correctly when their + * ComponentOrientation property is set to RIGHT_TO_LEFT. + * The tester is asked to compare left-to-right and + * right-to-left menus and judge whether they are mirror images of each + * other. + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual RightLeftOrientation + */ + +import java.awt.Color; +import java.awt.Component; +import java.awt.ComponentOrientation; +import java.awt.Font; +import java.awt.Graphics; +import java.awt.event.ActionEvent; +import java.awt.event.KeyEvent; + +import javax.swing.Icon; +import javax.swing.JCheckBoxMenuItem; +import javax.swing.JFrame; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.JRadioButtonMenuItem; +import javax.swing.KeyStroke; +import javax.swing.LookAndFeel; +import javax.swing.SwingConstants; +import javax.swing.UIManager; + +public class RightLeftOrientation { + + private static final String INSTRUCTIONS = """ + A menu bar is shown containing a menu for each look and feel. + A disabled menu means that the look and feel is not available for + testing in this environment. + Every effort should be made to run this test + in an environment that covers all look and feels. + + Each menu is divided into two halves. The upper half is oriented + left-to-right and the lower half is oriented right-to-left. + For each menu, ensure that the lower half mirrors the upper half. + + Note that when checking the positioning of the sub-menus, it + helps to position the frame away from the screen edges."""; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("RightLeftOrientation Instructions") + .instructions(INSTRUCTIONS) + .columns(35) + .testUI(RightLeftOrientation::createTestUI) + .build() + .awaitAndCheck(); + } + + private static JFrame createTestUI() { + JFrame frame = new JFrame("RightLeftOrientation"); + JMenuBar menuBar = new JMenuBar(); + + menuBar.add(createMenu("javax.swing.plaf.metal.MetalLookAndFeel", + "Metal")); + menuBar.add(createMenu("com.sun.java.swing.plaf.motif.MotifLookAndFeel", + "Motif")); + menuBar.add(createMenu("com.sun.java.swing.plaf.windows.WindowsLookAndFeel", + "Windows")); + + frame.setJMenuBar(menuBar); + frame.pack(); + return frame; + } + + + static JMenu createMenu(String laf, String name) { + JMenu menu = new JMenu(name); + try { + LookAndFeel save = UIManager.getLookAndFeel(); + UIManager.setLookAndFeel(laf); + addMenuItems(menu, ComponentOrientation.LEFT_TO_RIGHT); + menu.addSeparator(); + addMenuItems(menu, ComponentOrientation.RIGHT_TO_LEFT); + UIManager.setLookAndFeel(save); + } catch (Exception e) { + menu = new JMenu(name); + menu.setEnabled(false); + } + return menu; + } + + static void addMenuItems(JMenu menu, ComponentOrientation o) { + + JMenuItem menuItem; + + menuItem = new JMenuItem("Menu Item"); + menuItem.setComponentOrientation(o); + menu.add(menuItem); + + menuItem = new JMenuItem("Text trails icon", new MyMenuItemIcon()); + menuItem.setComponentOrientation(o); + menu.add(menuItem); + + menuItem = new JMenuItem("Text leads icon", new MyMenuItemIcon()); + menuItem.setComponentOrientation(o); + menuItem.setHorizontalTextPosition(SwingConstants.LEADING); + menu.add(menuItem); + + menuItem = new JRadioButtonMenuItem("Radio Button Menu Item"); + menuItem.setComponentOrientation(o); + menuItem.setSelected(true); + menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_1, ActionEvent.ALT_MASK)); + menu.add(menuItem); + + menuItem = new JCheckBoxMenuItem("Check box Menu Item"); + menuItem.setComponentOrientation(o); + menuItem.setSelected(true); + menuItem.setFont( new Font("Serif",Font.PLAIN, 24) ); + menuItem.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_2, ActionEvent.ALT_MASK)); + menu.add(menuItem); + + menuItem = new JMenu("Sub Menu"); + menuItem.setComponentOrientation(o); + menuItem.add(new JMenuItem("Sub Menu One")).setComponentOrientation(o); + menuItem.add(new JMenuItem("Sub Menu Two")).setComponentOrientation(o); + menu.add(menuItem); + } + + + private static class MyMenuItemIcon implements Icon { + public void paintIcon(Component c, Graphics g, int x, int y) { + Color oldColor = g.getColor(); + g.setColor(Color.orange); + g.fill3DRect(x, y, getIconWidth(), getIconHeight(), true); + g.setColor(oldColor); + } + public int getIconWidth() { return 15; } + public int getIconHeight() { return 15; } + } +} diff --git a/test/jdk/javax/swing/JMenuItem/bug4729669.java b/test/jdk/javax/swing/JMenuItem/bug4729669.java new file mode 100644 index 000000000000..815558fc8fdc --- /dev/null +++ b/test/jdk/javax/swing/JMenuItem/bug4729669.java @@ -0,0 +1,186 @@ +/* + * Copyright (c) 2005, 2025, 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 4729669 + * @summary 1.4 REGRESSION: Text edge of different types of JMenuItems are not aligned + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual bug4729669 + */ + +import java.awt.Color; +import java.awt.ComponentOrientation; +import java.awt.Component; +import java.awt.Graphics; +import java.awt.event.ActionEvent; +import java.awt.event.KeyEvent; + +import javax.swing.AbstractAction; +import javax.swing.Icon; +import javax.swing.JCheckBoxMenuItem; +import javax.swing.JFrame; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.JRadioButtonMenuItem; +import javax.swing.KeyStroke; + +import java.util.List; + +public class bug4729669 { + + private static final String INSTRUCTIONS = """ + Two windows should appear: Left-to-right and Right-to-left. + Check that text on all the menu items of all menus + is properly vertically aligned."""; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("bug4729669 Instructions") + .instructions(INSTRUCTIONS) + .columns(35) + .testUI(bug4729669::createTestUI) + .position(PassFailJFrame.Position.TOP_LEFT_CORNER) + .logArea() + .build() + .awaitAndCheck(); + } + + private static List createTestUI() { + JFrame f1 = MenuItemTest.doMenuItemTest(true); + f1.setLocation(300, 300); + JFrame f2 = MenuItemTest.doMenuItemTest(false); + f2.setLocation(500, 300); + return List.of(f1, f2); + } +} + +class MenuItemTest { + public static JFrame doMenuItemTest(boolean isLeft) { + JMenu menu = new JMenu("View"); + menu.setMnemonic('V'); + + menu.add(new JMenuItem("Refresh")); + menu.add(new JMenuItem("Customize...")); + menu.add(new JCheckBoxMenuItem("Show Toolbar")); + menu.addSeparator(); + menu.add(new JRadioButtonMenuItem("List")); + menu.add(new JRadioButtonMenuItem("Icons")); + JRadioButtonMenuItem rm2 = new JRadioButtonMenuItem("And icon."); + rm2.setAccelerator(KeyStroke.getKeyStroke(KeyEvent.VK_F1, + KeyEvent.SHIFT_MASK)); + menu.add(rm2); + JRadioButtonMenuItem mi3 = new JRadioButtonMenuItem("Radio w/icon"); + + Icon myIcon = new Icon() { // 10 pixel red + public void paintIcon(Component c, Graphics g, int x, int y) { + Color color = g.getColor(); + g.setColor(Color.RED); + g.fillRect(x, y, 10, 10); + g.setColor(color); + } + + public int getIconWidth() { + return 10; + } + + public int getIconHeight() { + return 10; + } + }; + + Icon myIcon2 = new Icon() { // 15 pixel green + public void paintIcon(Component c, Graphics g, int x, int y) { + Color color = g.getColor(); + g.setColor(Color.GREEN); + g.fillRect(x, y, 15, 10); + g.setColor(color); + } + + public int getIconWidth() { + return 15; + } + + public int getIconHeight() { + return 10; + } + }; + + rm2.setIcon(myIcon2); + + mi3.setIcon(myIcon); + menu.add(mi3); + menu.add(new JMenuItem(myIcon2)); + + final JMenu menu2 = new JMenu("No nothing"); + menu2.add("One").addActionListener(new AbstractAction() { + public void actionPerformed(ActionEvent e) { + PassFailJFrame.log("menu.width = " + menu2.getPopupMenu().getWidth()); + } + }); + menu2.add("Two").addActionListener(new AbstractAction() { + public void actionPerformed(ActionEvent e) { + PassFailJFrame.log("menu.width = " + menu2.getPopupMenu().getWidth()); + } + }); + menu2.add("Threeee").addActionListener(new AbstractAction() { + public void actionPerformed(ActionEvent e) { + PassFailJFrame.log("menu.width = " + menu2.getPopupMenu().getWidth()); + } + }); + + JMenuItem mi4 = new JMenuItem("Item with icon"); + mi4.setIcon(myIcon); + menu.addSeparator(); + menu.add(mi4); + String title = "Menu Item Test " + (isLeft ? "(Left-to-right)" : "(Right-to-left)"); + JFrame frame = new JFrame(title); + + JMenuBar menuBar = new JMenuBar(); + menuBar.add(menu); + menuBar.add(menu2); + + JMenu someIcons = new JMenu("Some icons"); + JMenuItem imi1 = new JMenuItem("Icon!"); + imi1.setIcon(myIcon); + someIcons.add(imi1); + JMenuItem imi2 = new JMenuItem("Wide icon!"); + imi2.setIcon(myIcon2); + someIcons.add(imi2); + someIcons.add(new JCheckBoxMenuItem("CheckBox")); + someIcons.add(new JRadioButtonMenuItem("RadioButton")); + menuBar.add(someIcons); + frame.setJMenuBar(menuBar); + ComponentOrientation co = (isLeft ? + ComponentOrientation.LEFT_TO_RIGHT : + ComponentOrientation.RIGHT_TO_LEFT); + frame.applyComponentOrientation(co); + frame.setSize(300, 300); + int frameX = isLeft ? 0 : 600; + frame.setLocation(frameX, 20); + return frame; + } + +} diff --git a/test/jdk/javax/swing/JPopupMenu/bug4236750.java b/test/jdk/javax/swing/JPopupMenu/bug4236750.java new file mode 100644 index 000000000000..2090c7feb23b --- /dev/null +++ b/test/jdk/javax/swing/JPopupMenu/bug4236750.java @@ -0,0 +1,106 @@ +/* + * Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import javax.swing.Action; +import javax.swing.JMenuItem; +import javax.swing.JPopupMenu; +import javax.swing.MenuElement; +import javax.swing.SwingUtilities; +import java.awt.event.ActionEvent; +import java.beans.PropertyChangeListener; + +/* + * @test + * @bug 4236750 + * @summary Tests presence of JPopupMenu.insert(Action, int) + * @run main bug4236750 + */ + +public class bug4236750 { + private static MenuElement[] elements; + private static volatile boolean passed = true; + + /** + * Auxilliary class implementing Action + */ + static class NullAction implements Action { + public void addPropertyChangeListener( + PropertyChangeListener listener) { + } + + public void removePropertyChangeListener( + PropertyChangeListener listener) { + } + + public void setEnabled(boolean b) { + } + + public boolean isEnabled() { + return true; + } + + public void actionPerformed(ActionEvent e) { + } + + private String name; + + public NullAction(String s) { + name = s; + } + + public void putValue(String key, Object value) { + if (key.equals(Action.NAME)) { + name = (String) value; + } + } + + public Object getValue(String key) { + if (key.equals(Action.NAME)) { + return name; + } + return null; + } + } + + public static void main(String[] args) throws Exception { + SwingUtilities.invokeAndWait(() -> { + JPopupMenu popup; + popup = new JPopupMenu("Test Popup"); + JMenuItem item0 = popup.add(new NullAction("0")); + JMenuItem item2 = popup.add(new NullAction("2")); + popup.insert(new NullAction("1"), 1); + elements = popup.getSubElements(); + for (int i = 0; i < 3; i++) { + JMenuItem mi = (JMenuItem) elements[i]; + if (!mi.getText().equals("" + i)) { + passed = false; + } + } + }); + + if (!passed) { + throw new RuntimeException("Failed: wrong order of menuitems"); + } + System.out.println("Test Passed!"); + } +} diff --git a/test/jdk/javax/swing/JPopupMenu/bug4321273.java b/test/jdk/javax/swing/JPopupMenu/bug4321273.java new file mode 100644 index 000000000000..a19210373fd6 --- /dev/null +++ b/test/jdk/javax/swing/JPopupMenu/bug4321273.java @@ -0,0 +1,88 @@ +/* + * Copyright (c) 2002, 2023, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import javax.swing.JFrame; +import javax.swing.JMenu; +import javax.swing.JMenuBar; +import javax.swing.JMenuItem; +import javax.swing.SwingUtilities; +import java.awt.Robot; +import java.io.ByteArrayOutputStream; +import java.io.ObjectOutputStream; + + +/* + * @test + * @bug 4321273 + * @summary NotSerializableException during the menu serialization + * @key headful + * @run main bug4321273 +*/ + +public class bug4321273 { + public static JFrame frame; + public static JMenu menu; + + public static void main(String[] args) throws Exception { + try { + Robot robot = new Robot(); + SwingUtilities.invokeAndWait(() -> { + JMenuBar menuBar = new JMenuBar(); + frame = new JFrame(); + frame.setJMenuBar(menuBar); + menu = new JMenu("Menu"); + menuBar.add(menu); + menu.add(new JMenuItem("item 1")); + menu.add(new JMenuItem("item 2")); + menu.add(new JMenuItem("item 3")); + frame.pack(); + frame.setVisible(true); + }); + robot.waitForIdle(); + robot.delay(1000); + SwingUtilities.invokeAndWait(() -> { + menu.doClick(); + try { + ByteArrayOutputStream byteArrayOutputStream = + new ByteArrayOutputStream(); + ObjectOutputStream oos = + new ObjectOutputStream(byteArrayOutputStream); + oos.writeObject(menu); + } catch (Exception se) { + throw new RuntimeException("NotSerializableException " + + "during the menu serialization", se); + } + }); + + robot.waitForIdle(); + robot.delay(100); + System.out.println("Test Passed!"); + } finally { + SwingUtilities.invokeAndWait(() -> { + if (frame != null) { + frame.dispose(); + } + }); + } + } +} diff --git a/test/jdk/javax/swing/JPopupMenu/bug4711693.java b/test/jdk/javax/swing/JPopupMenu/bug4711693.java new file mode 100644 index 000000000000..f24b2eb7c429 --- /dev/null +++ b/test/jdk/javax/swing/JPopupMenu/bug4711693.java @@ -0,0 +1,126 @@ +/* + * Copyright (c) 2002, 2023, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import javax.swing.JFrame; +import javax.swing.JMenuItem; +import javax.swing.JPopupMenu; +import javax.swing.SwingUtilities; +import java.awt.Component; +import java.awt.Dimension; +import java.awt.GraphicsConfiguration; +import java.awt.GraphicsDevice; +import java.awt.GraphicsEnvironment; +import java.awt.Insets; +import java.awt.Robot; +import java.awt.Window; +import java.awt.Toolkit; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; +import java.awt.event.InputEvent; + +/* + * @test + * @bug 4711693 + * @summary Pop-up doesn't stay up + * @key headful + * @run main bug4711693 + */ + +public class bug4711693 { + static JFrame fr; + static Robot robot; + static volatile boolean passed = true; + static volatile Dimension scr; + + public static void main(String[] args) throws Exception { + try { + robot = new Robot(); + SwingUtilities.invokeAndWait(() -> { + fr = new JFrame("Test 4711693"); + scr = new Dimension(); + fr.setSize(600, 600); + GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); + GraphicsDevice[] gs = ge.getScreenDevices(); + GraphicsConfiguration gc = null; + + for (int j = 0; j < gs.length; j++) { + GraphicsDevice gd = gs[j]; + gc = gd.getDefaultConfiguration(); + if (gc.getBounds().contains(100, 100)) break; + } + scr = Toolkit.getDefaultToolkit().getScreenSize(); + Insets ins = Toolkit.getDefaultToolkit().getScreenInsets(gc); + scr.width -= ins.right; + scr.height -= ins.bottom; + fr.setLocation(scr.width - 400, scr.height - 400); + fr.setVisible(true); + }); + robot.waitForIdle(); + robot.delay(1000); + SwingUtilities.invokeAndWait(() -> { + final JPopupMenu popupMenu = new JPopupMenu(); + final Component pane = fr.getContentPane(); + for (int i = 1; i < 10; i++) { + final String itemName = "Item " + i; + JMenuItem it = popupMenu.add(new JMenuItem(itemName)); + it.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent a) { + passed = false; + } + }); + } + + pane.addMouseListener(new MouseAdapter() { + public void mousePressed(MouseEvent e) { + if ((e.isAltDown() || + ((e.getModifiersEx() & + InputEvent.BUTTON3_DOWN_MASK) != 0))) { + Component parent = e.getComponent(); + while (parent != null && !(parent instanceof Window)) { + parent = parent.getParent(); + } + popupMenu.show(pane, e.getX(), e.getY()); + } + } + }); + }); + + robot.mouseMove(scr.width - 55, scr.height - 55); + robot.mousePress(InputEvent.BUTTON3_DOWN_MASK); + robot.mouseRelease(InputEvent.BUTTON3_DOWN_MASK); + } finally { + SwingUtilities.invokeAndWait(() -> { + if (fr != null) { + fr.dispose(); + } + }); + } + if (!passed) { + throw new RuntimeException("Test failed. Popup disposed on mouse release."); + } else { + System.out.println("Test Passed!"); + } + } +} diff --git a/test/jdk/javax/swing/JPopupMenu/bug4962731.java b/test/jdk/javax/swing/JPopupMenu/bug4962731.java new file mode 100644 index 000000000000..651678cf3866 --- /dev/null +++ b/test/jdk/javax/swing/JPopupMenu/bug4962731.java @@ -0,0 +1,136 @@ +/* + * Copyright (c) 2004, 2023, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JPopupMenu; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; +import javax.swing.plaf.PopupMenuUI; +import java.awt.BorderLayout; +import java.awt.Robot; +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; + +/* + * @test + * @bug 4962731 + * @summary The PopupMenu is not repainted if the LAF is changed. + * @key headful + * @run main bug4962731 + */ + +public class bug4962731 { + + public static volatile boolean passed = false; + public static boolean isLafOk = true; + public static JFrame mainFrame; + public static JButton button; + public static MyPopup popup; + public static Robot robot; + + public static void main(String[] args) throws Exception { + + try { + UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel"); + } catch (Exception ex) { + System.err.println("Can not initialize Motif L&F. Testing skipped."); + isLafOk = false; + } + + try { + UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel"); + } catch (Exception ex) { + System.err.println("Can not initialize Metal L&F. Testing skipped."); + isLafOk = false; + } + + if (isLafOk) { + try { + robot = new Robot(); + SwingUtilities.invokeAndWait(() -> { + mainFrame = new JFrame("Bug4962731"); + button = new JButton("Popup!"); + popup = new MyPopup(); + popup.add("one"); + popup.add("two"); + button.setComponentPopupMenu(popup); + button.addActionListener(new ActionListener() { + public void actionPerformed(ActionEvent e) { + popup.show(button, 300, 300); + popup.engage(); + try { + Thread.sleep(1000); + } catch (InterruptedException e1) { + } + try { + UIManager.setLookAndFeel + ("com.sun.java.swing.plaf.motif.MotifLookAndFeel"); + } catch (Exception ex) { + } + try { + Thread.sleep(1000); + } catch (InterruptedException e1) { + } + SwingUtilities.updateComponentTreeUI(mainFrame); + passed = popup.check(); + } + }); + mainFrame.setLayout(new BorderLayout()); + mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + mainFrame.add(button, BorderLayout.CENTER); + mainFrame.pack(); + mainFrame.setVisible(true); + }); + + robot.delay(1000); + SwingUtilities.invokeAndWait(() -> { + button.doClick(); + }); + + if (!passed) { + throw new RuntimeException("The UI of popup was not changed"); + } + } finally { + SwingUtilities.invokeAndWait(() -> { + if (mainFrame != null) { + mainFrame.dispose(); + } + }); + } + } + System.out.println("test Passed!"); + } + + public static class MyPopup extends JPopupMenu { + PopupMenuUI thisUI; + + public void engage() { + thisUI = getUI(); + } + + public boolean check() { + return getUI() != thisUI; + } + } +} diff --git a/test/jdk/javax/swing/JPopupMenu/bug4966109.java b/test/jdk/javax/swing/JPopupMenu/bug4966109.java new file mode 100644 index 000000000000..a643448a7bb4 --- /dev/null +++ b/test/jdk/javax/swing/JPopupMenu/bug4966109.java @@ -0,0 +1,144 @@ +/* + * Copyright (c) 2004, 2023, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import javax.swing.JLabel; +import javax.swing.JFrame; +import javax.swing.JPopupMenu; +import javax.swing.SwingUtilities; +import java.awt.BorderLayout; +import java.awt.Point; +import java.awt.Robot; +import java.awt.event.MouseAdapter; +import java.awt.event.MouseEvent; + +/* + * @test + * @bug 4966109 + * @summary Popup is not populated by mouse actions on lightweight components without mouse + * @key headful + * @run main bug4966109 + */ + +public class bug4966109 { + public static JFrame mainFrame; + public static JPopupMenu popup; + public static JLabel label1; + public static JLabel label2; + public static Robot robot; + public static volatile Point loc; + public static volatile Boolean passed = true; + public static int popupTrigger; + + public static void main(String[] args) throws Exception { + try { + robot = new Robot(); + SwingUtilities.invokeAndWait(() -> { + mainFrame = new JFrame("Bug4966109"); + popup = new JPopupMenu(); + label1 = new JLabel("Label with the listener"); + label2 = new JLabel("Label w/o listener"); + mainFrame.setLayout(new BorderLayout()); + mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + mainFrame.add(label1, BorderLayout.NORTH); + mainFrame.add(label2, BorderLayout.SOUTH); + mainFrame.pack(); + mainFrame.setVisible(true); + popup.add("One"); + popup.add("Two"); + popup.add("Three"); + label1.setComponentPopupMenu(popup); + label1.addMouseListener(new MouseAdapter() { + }); + label2.setComponentPopupMenu(popup); + }); + robot.waitForIdle(); + robot.delay(1000); + + SwingUtilities.invokeAndWait(() -> { + loc = label1.getLocationOnScreen(); + loc.x = loc.x + (int) (label1.getWidth() / 2); + loc.y = loc.y + (int) (label1.getHeight() / 2); + }); + popupTrigger = MouseEvent.BUTTON2_DOWN_MASK; + robot.mouseMove(loc.x, loc.y); + robot.mousePress(popupTrigger); + robot.mouseRelease(popupTrigger); + robot.waitForIdle(); + robot.delay(100); + + SwingUtilities.invokeAndWait(() -> { + if (popup.isVisible()) { + System.out.println("ZAV: Good!!! BUTTON2 is the way to go."); + } else { + System.out.println("ZAV: Bad :( Let's try BUTTON3"); + popupTrigger = MouseEvent.BUTTON3_DOWN_MASK; + } + }); + + robot.mousePress(popupTrigger); + robot.mouseRelease(popupTrigger); + robot.waitForIdle(); + robot.delay(100); + + SwingUtilities.invokeAndWait(() -> { + if (popup.isVisible()) { + System.out.println("ZAV: Good!!! BUTTON3 is working. At last :)"); + popup.setVisible(false); + } else { + System.out.println("ZAV: Bad :( Very bad. Nothing is working..."); + passed = false; + } + }); + if (!passed) { + throw new RuntimeException("No popup trigger mouse events found"); + } + robot.waitForIdle(); + robot.delay(100); + + SwingUtilities.invokeAndWait(() -> { + loc = label2.getLocationOnScreen(); + loc.x = loc.x + (int) (label2.getWidth() / 2); + loc.y = loc.y + (int) (label2.getHeight() / 2); + }); + robot.mouseMove(loc.x, loc.y); + robot.mousePress(popupTrigger); + robot.mouseRelease(popupTrigger); + robot.waitForIdle(); + robot.delay(100); + + SwingUtilities.invokeAndWait(() -> { + if (!popup.isVisible()) { + passed = false; + } + }); + if (!passed) { + throw new RuntimeException("Regression: bug 4966109, popup is not visible"); + } + } finally { + if (mainFrame != null) { + mainFrame.dispose(); + } + } + System.out.println("test Passed!"); + } +} diff --git a/test/jdk/javax/swing/JPopupMenu/bug5091257.java b/test/jdk/javax/swing/JPopupMenu/bug5091257.java new file mode 100644 index 000000000000..cd4d285f9cb7 --- /dev/null +++ b/test/jdk/javax/swing/JPopupMenu/bug5091257.java @@ -0,0 +1,150 @@ +/* + * Copyright (c) 2004, 2023, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JPopupMenu; +import javax.swing.SwingUtilities; +import javax.swing.event.PopupMenuListener; +import javax.swing.event.PopupMenuEvent; +import java.awt.BorderLayout; +import java.awt.Point; +import java.awt.Robot; +import java.awt.event.KeyEvent; +import java.awt.event.KeyListener; +import java.awt.event.MouseEvent; + +/* + * @test + * @bug 5091257 + * @summary Application key does not display a pop-up menu in users view. + * @key headful + * @run main bug5091257 + */ + +public class bug5091257 { + public static volatile boolean passed = false; + public static volatile boolean isKeyOk = false; + public static JFrame mainFrame; + public static JButton button; + public static Robot robot; + public static JPopupMenu popup; + public static volatile Point loc; + + public static void main(String[] args) throws Exception { + try { + robot = new Robot(); + robot.setAutoDelay(50); + SwingUtilities.invokeAndWait(() -> { + button = new JButton("Popup button"); + button.addKeyListener(new KeyListener() { + public void keyTyped(KeyEvent e) { + if (e.getKeyCode() == KeyEvent.VK_CONTEXT_MENU) { + isKeyOk = true; + } + } + + public void keyPressed(KeyEvent e) { + if (e.getKeyCode() == KeyEvent.VK_CONTEXT_MENU) { + isKeyOk = true; + } + } + + public void keyReleased(KeyEvent e) { + if (e.getKeyCode() == KeyEvent.VK_CONTEXT_MENU) { + isKeyOk = true; + } + } + }); + mainFrame = new JFrame("Bug5091257"); + mainFrame.setLayout(new BorderLayout()); + mainFrame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + mainFrame.add(button, BorderLayout.CENTER); + mainFrame.pack(); + mainFrame.setVisible(true); + }); + robot.waitForIdle(); + robot.delay(1000); + + SwingUtilities.invokeAndWait(() -> { + loc = button.getLocationOnScreen(); + loc.x = loc.x + (int) (button.getWidth() / 2); + loc.y = loc.y + (int) (button.getHeight() / 2); + }); + robot.mouseMove(loc.x, loc.y); + robot.mousePress(MouseEvent.BUTTON3_DOWN_MASK); + robot.mouseRelease(MouseEvent.BUTTON3_DOWN_MASK); + + robot.waitForIdle(); + robot.delay(100); + + try { + robot.keyPress(KeyEvent.VK_CONTEXT_MENU); + robot.keyRelease(KeyEvent.VK_CONTEXT_MENU); + } catch (IllegalArgumentException ex) { + isKeyOk = false; + } + + if (!isKeyOk) { + System.out.println("KeyEvent can't create or deliver " + + "VK_CONTEXT_MENU event to component. Testing skipped."); + passed = true; + } else { + SwingUtilities.invokeAndWait(() -> { + popup = new JPopupMenu(); + popup.add("Item to make popup not empty"); + popup.addPopupMenuListener(new PopupMenuListener() { + public void popupMenuWillBecomeVisible(PopupMenuEvent e) { + System.out.println("Popup menu became visible " + + "on context menu key press. Test passed."); + passed = true; + } + + public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { + } + + public void popupMenuCanceled(PopupMenuEvent e) { + } + }); + button.setComponentPopupMenu(popup); + }); + robot.keyPress(KeyEvent.VK_CONTEXT_MENU); + robot.keyRelease(KeyEvent.VK_CONTEXT_MENU); + + robot.waitForIdle(); + robot.delay(100); + + if (!passed) { + throw new RuntimeException("Popup did not open on " + + "VK_CONTEXT_MENU press. Test failed."); + } + } + } finally { + SwingUtilities.invokeAndWait(() -> { + if (mainFrame != null) { + mainFrame.dispose(); + } + }); + } + } +} diff --git a/test/jdk/javax/swing/JRadioButton/8033699/bug8033699.java b/test/jdk/javax/swing/JRadioButton/8033699/bug8033699.java index 9365e6ba45b2..30d83a0538eb 100644 --- a/test/jdk/javax/swing/JRadioButton/8033699/bug8033699.java +++ b/test/jdk/javax/swing/JRadioButton/8033699/bug8033699.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,6 +28,7 @@ * @summary Incorrect radio button behavior when pressing tab key * @run main bug8033699 */ + import java.awt.KeyboardFocusManager; import java.awt.Robot; import java.awt.event.ActionListener; @@ -57,42 +58,49 @@ public class bug8033699 { public static void main(String[] args) throws Throwable { SwingUtilities.invokeAndWait(() -> { - changeLAF(); - createAndShowGUI(); + changeLAF(); + createAndShowGUI(); }); robot = new Robot(); - Thread.sleep(100); robot.waitForIdle(); - - robot.setAutoDelay(100); + robot.delay(1000); // tab key test grouped radio button runTest1(); + robot.delay(100); // tab key test non-grouped radio button runTest2(); + robot.delay(100); // shift tab key test grouped and non-grouped radio button runTest3(); + robot.delay(100); // left/up key test in grouped radio button runTest4(); + robot.delay(100); // down/right key test in grouped radio button runTest5(); + robot.delay(100); // tab from radio button in group to next component in the middle of button group layout runTest6(); + robot.delay(100); // tab to radio button in group from component in the middle of button group layout runTest7(); + robot.delay(100); // down key circle back to first button in grouped radio button runTest8(); + robot.delay(100); // Verify that ActionListener is called when a RadioButton is selected using arrow key. runTest9(); + robot.delay(100); SwingUtilities.invokeAndWait(() -> mainFrame.dispose()); } diff --git a/test/jdk/javax/swing/JRadioButton/ButtonGroupFocus/ButtonGroupFocusTest.java b/test/jdk/javax/swing/JRadioButton/ButtonGroupFocus/ButtonGroupFocusTest.java index c696b166dd08..633b0356f85d 100644 --- a/test/jdk/javax/swing/JRadioButton/ButtonGroupFocus/ButtonGroupFocusTest.java +++ b/test/jdk/javax/swing/JRadioButton/ButtonGroupFocus/ButtonGroupFocusTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,26 +28,53 @@ * @run main ButtonGroupFocusTest */ -import javax.swing.*; -import java.awt.*; +import java.awt.AWTEvent; +import java.awt.Container; +import java.awt.FlowLayout; +import java.awt.KeyboardFocusManager; +import java.awt.Rectangle; +import java.awt.Robot; +import java.awt.Toolkit; +import java.awt.event.FocusAdapter; +import java.awt.event.FocusEvent; import java.awt.event.KeyEvent; +import java.awt.image.BufferedImage; +import java.io.File; +import java.util.concurrent.CountDownLatch; -public class ButtonGroupFocusTest { +import javax.imageio.ImageIO; +import javax.swing.ButtonGroup; +import javax.swing.JFrame; +import javax.swing.JRadioButton; +import javax.swing.SwingUtilities; + +import static java.awt.KeyboardFocusManager.getCurrentKeyboardFocusManager; +import static java.util.concurrent.TimeUnit.MILLISECONDS; +import static java.util.concurrent.TimeUnit.SECONDS; + +public final class ButtonGroupFocusTest { private static JRadioButton button1; private static JRadioButton button2; private static JRadioButton button3; private static JRadioButton button4; private static JRadioButton button5; - private static Robot robot; + + private static final CountDownLatch button2FocusLatch = new CountDownLatch(1); + private static final CountDownLatch button3FocusLatch = new CountDownLatch(1); + private static final CountDownLatch button4FocusLatch = new CountDownLatch(1); + + private static final CountDownLatch button2FocusLatch2 = new CountDownLatch(2); + + private static final long FOCUS_TIMEOUT = 4; + private static JFrame frame; public static void main(String[] args) throws Exception { - robot = new Robot(); - robot.setAutoDelay(100); + final Robot robot = new Robot(); SwingUtilities.invokeAndWait(() -> { - frame = new JFrame(); + frame = new JFrame("ButtonGroupFocusTest"); Container contentPane = frame.getContentPane(); contentPane.setLayout(new FlowLayout()); button1 = new JRadioButton("Button 1"); @@ -60,6 +87,7 @@ public static void main(String[] args) throws Exception { contentPane.add(button4); button5 = new JRadioButton("Button 5"); contentPane.add(button5); + ButtonGroup group = new ButtonGroup(); group.add(button1); group.add(button2); @@ -69,52 +97,96 @@ public static void main(String[] args) throws Exception { group.add(button4); group.add(button5); + button2.addFocusListener(new LatchFocusListener(button2FocusLatch)); + button3.addFocusListener(new LatchFocusListener(button3FocusLatch)); + button4.addFocusListener(new LatchFocusListener(button4FocusLatch)); + + button2.addFocusListener(new LatchFocusListener(button2FocusLatch2)); + button2.setSelected(true); + // Debugging aid: log focus owner changes... + KeyboardFocusManager focusManager = getCurrentKeyboardFocusManager(); + focusManager.addPropertyChangeListener("focusOwner", + e -> System.out.println(e.getPropertyName() + + "\n\t" + e.getOldValue() + + "\n\t" + e.getNewValue())); + + // ...and dispatched key events + Toolkit.getDefaultToolkit().addAWTEventListener( + e -> System.out.println("Dispatched " + e), + AWTEvent.KEY_EVENT_MASK); + frame.pack(); + frame.setLocationRelativeTo(null); frame.setVisible(true); }); - robot.waitForIdle(); - robot.delay(200); - - SwingUtilities.invokeAndWait(() -> { - if( !button2.hasFocus() ) { - frame.dispose(); - throw new RuntimeException( - "Button 2 should get focus after activation"); + try { + if (!button2FocusLatch.await(FOCUS_TIMEOUT, SECONDS)) { + throw new RuntimeException("Button 2 should get focus " + + "after activation"); } - }); + robot.waitForIdle(); + robot.delay(200); - robot.keyPress(KeyEvent.VK_TAB); - robot.keyRelease(KeyEvent.VK_TAB); + System.out.println("\n\n*** Tab 1st"); + robot.keyPress(KeyEvent.VK_TAB); + robot.keyRelease(KeyEvent.VK_TAB); - robot.waitForIdle(); - robot.delay(200); + if (!button4FocusLatch.await(FOCUS_TIMEOUT, SECONDS)) { + throw new RuntimeException("Button 4 should get focus"); + } + robot.waitForIdle(); + robot.delay(200); - SwingUtilities.invokeAndWait(() -> { - if( !button4.hasFocus() ) { - frame.dispose(); - throw new RuntimeException( - "Button 4 should get focus"); + if (button2FocusLatch2.await(1, MILLISECONDS)) { + throw new RuntimeException("Focus moved back to Button 2"); } - button3.setSelected(true); - }); - robot.keyPress(KeyEvent.VK_TAB); - robot.keyRelease(KeyEvent.VK_TAB); + SwingUtilities.invokeAndWait(() -> button3.setSelected(true)); + robot.waitForIdle(); + robot.delay(200); - robot.waitForIdle(); - robot.delay(200); + System.out.println("\n\n*** Tab 2nd"); + robot.keyPress(KeyEvent.VK_TAB); + robot.keyRelease(KeyEvent.VK_TAB); - SwingUtilities.invokeAndWait(() -> { - if( !button3.hasFocus() ) { - frame.dispose(); - throw new RuntimeException( - "selected Button 3 should get focus"); + if (!button3FocusLatch.await(FOCUS_TIMEOUT, SECONDS)) { + throw new RuntimeException("Selected Button 3 should get focus"); } - }); + } catch (Exception e) { + BufferedImage image = robot.createScreenCapture(getFrameBounds()); + ImageIO.write(image, "png", + new File("image.png")); + + SwingUtilities.invokeAndWait(() -> + System.err.println("Current focus owner: " + + getCurrentKeyboardFocusManager() + .getFocusOwner())); + + throw e; + } finally { + SwingUtilities.invokeAndWait(frame::dispose); + } + } + + private static Rectangle getFrameBounds() throws Exception { + Rectangle[] bounds = new Rectangle[1]; + SwingUtilities.invokeAndWait(() -> bounds[0] = frame.getBounds()); + return bounds[0]; + } + + private static final class LatchFocusListener extends FocusAdapter { + private final CountDownLatch focusGainedLatch; + + private LatchFocusListener(CountDownLatch focusGainedLatch) { + this.focusGainedLatch = focusGainedLatch; + } - SwingUtilities.invokeLater(frame::dispose); + @Override + public void focusGained(FocusEvent e) { + focusGainedLatch.countDown(); + } } } diff --git a/test/jdk/javax/swing/JRootPane/bug4207333.java b/test/jdk/javax/swing/JRootPane/bug4207333.java new file mode 100644 index 000000000000..b93438eae50b --- /dev/null +++ b/test/jdk/javax/swing/JRootPane/bug4207333.java @@ -0,0 +1,70 @@ +/* + * Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import javax.swing.JButton; +import javax.swing.JRootPane; +import java.lang.reflect.Field; + +/* + * @test + * @bug 4207333 + * @summary Inadvertant API regression in JRootPane + * @run main bug4207333 + */ + +public class bug4207333 { + public static void main(String[] argv) { + TestableRootPane rp = new TestableRootPane(); + rp.setDefaultButton(new JButton("Default, eh?")); + + if (!rp.test("defaultPressAction")) { + throw new RuntimeException("Failed test for bug 4207333"); + } + if (!rp.test("defaultReleaseAction")) { + throw new RuntimeException("Failed test for bug 4207333"); + } + System.out.println("Test Passed!"); + } + + private static class TestableRootPane extends JRootPane { + public boolean test(String fieldName) { + boolean result = false; + try { + Class superClass = getClass().getSuperclass(); + Field field = superClass.getDeclaredField(fieldName); + Class fieldClass = field.getType(); + Class actionClass = Class.forName("javax.swing.Action"); + + // Is the Field an Action? + result = actionClass.isAssignableFrom(fieldClass); + } catch (NoSuchFieldException pe) { + // Not a bug if the fields are removed since their + // type was a package private class! + result = true; + } catch (Exception iae) { + System.out.println("Exception " + iae); + } + return result; + } + } +} diff --git a/test/jdk/javax/swing/JRootPane/bug4224113.java b/test/jdk/javax/swing/JRootPane/bug4224113.java new file mode 100644 index 000000000000..e52b369a8868 --- /dev/null +++ b/test/jdk/javax/swing/JRootPane/bug4224113.java @@ -0,0 +1,41 @@ +/* + * Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import javax.swing.plaf.RootPaneUI; + +/* + * @test + * @bug 4224113 + * @summary Tests the presence of RootPaneUI + * @run main bug4224113 + */ + +public class bug4224113 { + public static class TestRootPaneUI extends RootPaneUI { + } + + public static void main(String[] args) { + TestRootPaneUI r = new TestRootPaneUI(); + System.out.println("Test Passed!"); + } +} diff --git a/test/jdk/javax/swing/JRootPane/bug4627806.java b/test/jdk/javax/swing/JRootPane/bug4627806.java new file mode 100644 index 000000000000..cd6d64213a2e --- /dev/null +++ b/test/jdk/javax/swing/JRootPane/bug4627806.java @@ -0,0 +1,65 @@ +/* + * Copyright (c) 2002, 2023, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import javax.swing.JFrame; +import javax.swing.JMenuItem; +import javax.swing.JPanel; +import javax.swing.JRootPane; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; + +/* + * @test + * @bug 4627806 + * @key headful + * @summary MetalRootPaneUI calls validate() instead of revalidate() + * @run main bug4627806 + */ + +public class bug4627806 { + private static JFrame frame; + + public static void main(String[] args) throws Exception { + try { + UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel"); + SwingUtilities.invokeAndWait(() -> { + frame = new JFrame("Test"); + JPanel p = new JPanel(); + JMenuItem c = new JMenuItem(); + p.add(c); + frame.getContentPane().add(p); + frame.pack(); + c.getUI().uninstallUI(c); + JRootPane rootPane = frame.getRootPane(); + rootPane.getUI().uninstallUI(rootPane); + System.out.println("Test Passed!"); + }); + } finally { + SwingUtilities.invokeAndWait(() -> { + if (frame != null) { + frame.dispose(); + } + }); + } + } +} diff --git a/test/jdk/javax/swing/JScrollBar/bug4495822.java b/test/jdk/javax/swing/JScrollBar/bug4495822.java new file mode 100644 index 000000000000..01f3024b1a4e --- /dev/null +++ b/test/jdk/javax/swing/JScrollBar/bug4495822.java @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Robot; +import java.awt.event.AdjustmentEvent; +import java.awt.event.AdjustmentListener; +import javax.swing.JScrollBar; +import javax.swing.SwingUtilities; + +/* + * @test + * @bug 4495822 + * @summary AdjustmentEvent.getValueIsAdjusting() always returns false + * @run main bug4495822 + */ + +public class bug4495822 { + public static volatile boolean isAdjusted = false; + + public static void main(String[] args) throws Exception { + + SwingUtilities.invokeAndWait(() -> { + JScrollBar scrollBar = new JScrollBar(JScrollBar.HORIZONTAL); + scrollBar.addAdjustmentListener(new AdjustmentListener() { + public void adjustmentValueChanged(AdjustmentEvent e) { + if (e.getValueIsAdjusting() != scrollBar.getValueIsAdjusting()) { + throw new RuntimeException("The AdjustmentEvent has incorrect \"valueIsAdjusting\" value"); + } + + isAdjusted = true; + } + }); + + scrollBar.setValueIsAdjusting(true); + }); + Thread.sleep(1000); + if (!isAdjusted) { + throw new RuntimeException("adjustmentValueChanged() not invoked!"); + } + System.out.println("Test Passed!"); + } +} diff --git a/test/jdk/javax/swing/JScrollBar/bug4696826.java b/test/jdk/javax/swing/JScrollBar/bug4696826.java new file mode 100644 index 000000000000..f82ad6dfa73e --- /dev/null +++ b/test/jdk/javax/swing/JScrollBar/bug4696826.java @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import javax.swing.JComponent; +import javax.swing.JScrollBar; +import javax.swing.SwingUtilities; +import javax.swing.plaf.basic.BasicScrollBarUI; +import java.awt.Graphics; +import java.awt.Rectangle; +import java.awt.image.BufferedImage; + +/* + * @test + * @bug 4696826 + * @summary BasicScrollBarUI should check if it needs to paint the thumb + * @run main bug4696826 + */ + +public class bug4696826 { + public static void main(String[] args) throws Exception { + SwingUtilities.invokeAndWait(() -> { + JScrollBar sb = new JScrollBar(); + sb.setBounds(new Rectangle(0, 0, 20, 20)); + + TestScrollBarUI ui = new TestScrollBarUI(); + sb.setUI(ui); + ui.setThumbBounds(0, 0, 20, 20); + + BufferedImage image = new BufferedImage(100, 100, + BufferedImage.TYPE_3BYTE_BGR); + Graphics g = image.getGraphics(); + g.setClip(200, 200, 100, 100); + sb.paint(g); + }); + System.out.println("Test Passed!"); + } + + static class TestScrollBarUI extends BasicScrollBarUI { + protected void paintThumb(Graphics g, JComponent c, Rectangle thumbBounds) { + throw new RuntimeException("Thumb shouldn't be painted"); + } + public void setThumbBounds(int x, int y, int width, int height) { + super.setThumbBounds(x, y, width, height); + } + } +} diff --git a/test/jdk/javax/swing/JScrollBar/bug4842792.java b/test/jdk/javax/swing/JScrollBar/bug4842792.java new file mode 100644 index 000000000000..09ada58315a7 --- /dev/null +++ b/test/jdk/javax/swing/JScrollBar/bug4842792.java @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import javax.swing.JScrollBar; +import javax.swing.SwingUtilities; +import java.awt.Dimension; +import java.awt.event.MouseEvent; +import java.util.Date; + +/* + * @test + * @bug 4842792 + * @summary JScrollBar behaves incorrectly if "Block increment" value is big enough + * @run main bug4842792 + */ + +public class bug4842792 { + public static TestScrollBar scrollBar; + + public static void main(String[] args) throws Exception { + SwingUtilities.invokeAndWait(() -> { + scrollBar = new TestScrollBar(JScrollBar.HORIZONTAL, 10, 10, 0, 100); + scrollBar.setPreferredSize(new Dimension(200, 20)); + scrollBar.setBlockIncrement(Integer.MAX_VALUE); + + if (scrollBar.doTest() == 0) { + throw new RuntimeException("The scrollbar new value should not be 0"); + } + }); + System.out.println("Test Passed!"); + } + + static class TestScrollBar extends JScrollBar { + public TestScrollBar(int orientation, int value, int extent, + int min, int max) { + super(orientation, value, extent, min, max); + } + + public int doTest() { + MouseEvent mouseEvent = new MouseEvent(scrollBar, + MouseEvent.MOUSE_PRESSED, + (new Date()).getTime(), + MouseEvent.BUTTON1_DOWN_MASK, + 150, 10, 1, true); + processMouseEvent(mouseEvent); + return scrollBar.getValue(); + } + } +} diff --git a/test/jdk/javax/swing/JScrollPane/bug4247092.java b/test/jdk/javax/swing/JScrollPane/bug4247092.java new file mode 100644 index 000000000000..a1fa369d67ea --- /dev/null +++ b/test/jdk/javax/swing/JScrollPane/bug4247092.java @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2002, 2023, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import javax.swing.JScrollPane; + +/* + * @test + * @bug 4247092 + * @summary JScrollPane.setCorner(corner,null) causes NPE, but defolt getCorner() rtns null + * @run main bug4247092 + */ + +public class bug4247092 { + public static void main(String[] args) { + JScrollPane sp = new JScrollPane(); + sp.setCorner(JScrollPane.LOWER_RIGHT_CORNER, null); + if (sp.getCorner(JScrollPane.LOWER_RIGHT_CORNER) != null) { + throw new RuntimeException("The corner component should be null"); + } + System.out.println("Test Passed!"); + } +} diff --git a/test/jdk/javax/swing/JScrollPane/bug4264640.java b/test/jdk/javax/swing/JScrollPane/bug4264640.java new file mode 100644 index 000000000000..ca1bfc146df5 --- /dev/null +++ b/test/jdk/javax/swing/JScrollPane/bug4264640.java @@ -0,0 +1,81 @@ +/* + * Copyright (c) 2001, 2023, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JScrollPane; +import javax.swing.SwingUtilities; +import java.awt.BorderLayout; +import java.awt.Container; +import java.awt.Robot; + +/* + * @test + * @bug 4264640 + * @summary Tests that JScrollPane sets correct position of its column header view + * @key headful + * @run main bug4264640 + */ + +public class bug4264640 { + public static JFrame frame; + public static JButton b; + public static Robot robot; + public static volatile int yPos; + + public static void main(String[] args) throws Exception { + try { + robot = new Robot(); + SwingUtilities.invokeAndWait(() -> { + frame = new JFrame("Scroll Pane test"); + JScrollPane scroller = new JScrollPane(); + b = new JButton("This is BUG !"); + b.setBounds(12, 12, 169, 133); + scroller.setColumnHeaderView(b); + + Container pane = frame.getContentPane(); + pane.setLayout(new BorderLayout()); + pane.add(scroller); + frame.setSize(200,200); + frame.setVisible(true); + }); + + robot.waitForIdle(); + robot.delay(1000); + + SwingUtilities.invokeAndWait(() -> { + yPos = b.getY(); + }); + if (yPos != 0) { + throw new RuntimeException("Failed: Y = " + yPos + " (should be 0)"); + } + } finally { + SwingUtilities.invokeAndWait(() -> { + if (frame != null) { + frame.dispose(); + } + }); + } + System.out.println("Test Passed!"); + } +} diff --git a/test/jdk/javax/swing/JScrollPane/bug4467063.java b/test/jdk/javax/swing/JScrollPane/bug4467063.java new file mode 100644 index 000000000000..8bce485e48df --- /dev/null +++ b/test/jdk/javax/swing/JScrollPane/bug4467063.java @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import javax.swing.JButton; +import javax.swing.JScrollPane; +import javax.swing.SwingUtilities; +import java.awt.ComponentOrientation; + +/* + * @test + * @bug 4467063 + * @summary JScrollPane.setCorner() causes IllegalArgumentException. (invalid corner key) + * @run main bug4467063 + */ + +public class bug4467063 { + + public static void main(String[] args) throws Exception { + SwingUtilities.invokeAndWait(() -> { + JScrollPane sp = new JScrollPane(); + + //Test corners for left-to-right orientation + sp.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT); + sp.setCorner(JScrollPane.LOWER_LEADING_CORNER, new JButton("0")); + sp.setCorner(JScrollPane.LOWER_TRAILING_CORNER, new JButton("1")); + sp.setCorner(JScrollPane.UPPER_LEADING_CORNER, new JButton("2")); + sp.setCorner(JScrollPane.UPPER_TRAILING_CORNER, new JButton("3")); + + if (!sp.getCorner(JScrollPane.LOWER_LEADING_CORNER).equals( + sp.getCorner(JScrollPane.LOWER_LEFT_CORNER))) { + throw new RuntimeException("Incorrect LOWER_LEADING_CORNER value"); + } + + if (!sp.getCorner(JScrollPane.LOWER_TRAILING_CORNER).equals( + sp.getCorner(JScrollPane.LOWER_RIGHT_CORNER))) { + throw new RuntimeException("Incorrect LOWER_TRAILING_CORNER value"); + } + + if (!sp.getCorner(JScrollPane.UPPER_LEADING_CORNER).equals( + sp.getCorner(JScrollPane.UPPER_LEFT_CORNER))) { + throw new RuntimeException("Incorrect UPPER_LEADING_CORNER value"); + } + + if (!sp.getCorner(JScrollPane.UPPER_TRAILING_CORNER).equals( + sp.getCorner(JScrollPane.UPPER_RIGHT_CORNER))) { + throw new RuntimeException("Incorrect UPPER_TRAILING_CORNER value"); + } + + //Test corners for right-to-left orientation + sp.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); + sp.setCorner(JScrollPane.LOWER_LEADING_CORNER, new JButton("0")); + sp.setCorner(JScrollPane.LOWER_TRAILING_CORNER, new JButton("1")); + sp.setCorner(JScrollPane.UPPER_LEADING_CORNER, new JButton("2")); + sp.setCorner(JScrollPane.UPPER_TRAILING_CORNER, new JButton("3")); + + if (!sp.getCorner(JScrollPane.LOWER_LEADING_CORNER).equals( + sp.getCorner(JScrollPane.LOWER_RIGHT_CORNER))) { + throw new RuntimeException("Incorrect LOWER_LEADING_CORNER value"); + } + + if (!sp.getCorner(JScrollPane.LOWER_TRAILING_CORNER).equals( + sp.getCorner(JScrollPane.LOWER_LEFT_CORNER))) { + throw new RuntimeException("Incorrect LOWER_TRAILING_CORNER value"); + } + + if (!sp.getCorner(JScrollPane.UPPER_LEADING_CORNER).equals( + sp.getCorner(JScrollPane.UPPER_RIGHT_CORNER))) { + throw new RuntimeException("Incorrect UPPER_LEADING_CORNER value"); + } + + if (!sp.getCorner(JScrollPane.UPPER_TRAILING_CORNER).equals( + sp.getCorner(JScrollPane.UPPER_LEFT_CORNER))) { + throw new RuntimeException("Incorrect UPPER_TRAILING_CORNER value"); + } + }); + System.out.println("Test Passed!"); + } +} diff --git a/test/jdk/javax/swing/JSlider/bug4200901.java b/test/jdk/javax/swing/JSlider/bug4200901.java new file mode 100644 index 000000000000..cf4810a54cad --- /dev/null +++ b/test/jdk/javax/swing/JSlider/bug4200901.java @@ -0,0 +1,44 @@ +/* + * Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import javax.swing.JSlider; + +/* + * @test + * @bug 4200901 + * @summary Test to check if JSlider.createStandardLabels() throws Exception + * @run main bug4200901 + */ + +public class bug4200901 { + public static void main(String[] args) { + try { + JSlider slider = new JSlider(); + slider.createStandardLabels( -1 ); + } catch ( IllegalArgumentException e ) { + System.out.println("Test Passed!"); + return; + } + throw new RuntimeException( "TEST FAILED!"); + } +} diff --git a/test/jdk/javax/swing/JSlider/bug4203754.java b/test/jdk/javax/swing/JSlider/bug4203754.java new file mode 100644 index 000000000000..21eb898d2757 --- /dev/null +++ b/test/jdk/javax/swing/JSlider/bug4203754.java @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2004, 2023, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JSlider; +import javax.swing.SwingUtilities; +import java.awt.FlowLayout; +import java.awt.Robot; +import java.util.Dictionary; +import java.util.Hashtable; + +/* + * @test + * @bug 4203754 + * @key headful + * @summary Labels in a JSlider don't disable or enable with the slider + * @run main bug4203754 + */ + +public class bug4203754 { + private static JFrame frame; + private static Robot robot; + private static JLabel label; + + public static void main(String[] argv) throws Exception { + try { + robot = new Robot(); + SwingUtilities.invokeAndWait(() -> { + frame = new JFrame("Test"); + frame.getContentPane().setLayout(new FlowLayout()); + JSlider slider = new JSlider(0, 100, 25); + frame.getContentPane().add(slider); + + label = new JLabel("0", JLabel.CENTER) { + public void setEnabled(boolean b) { + super.setEnabled(b); + } + }; + + Dictionary labels = new Hashtable(); + labels.put(Integer.valueOf(0), label); + slider.setLabelTable(labels); + slider.setPaintLabels(true); + slider.setEnabled(false); + frame.setSize(250, 150); + frame.setVisible(true); + }); + robot.waitForIdle(); + robot.delay(1000); + if (label.isEnabled()) { + throw new RuntimeException("Label should be disabled"); + } + System.out.println("Test Passed!"); + } finally { + SwingUtilities.invokeAndWait(() -> { + if (frame != null) { + frame.dispose(); + } + }); + } + } +} diff --git a/test/jdk/javax/swing/JSplitPane/bug4749792.java b/test/jdk/javax/swing/JSplitPane/bug4749792.java new file mode 100644 index 000000000000..1d9823073b72 --- /dev/null +++ b/test/jdk/javax/swing/JSplitPane/bug4749792.java @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2003, 2025, 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 4749792 + * @requires (os.family == "windows") + * @summary Split pane border is not painted properly + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual bug4749792 + */ + +import java.awt.BorderLayout; +import java.awt.Dimension; + +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.JSplitPane; + +public class bug4749792 { + static final String INSTRUCTIONS = """ + If the right/bottom edges of JSplitPane's border is missing then the + test fails. If it is visible, then the test passes. + """; + + static JFrame createUI() { + JFrame frame = new JFrame("JSplitPane Border Test"); + frame.setSize(450, 220); + JPanel left = new JPanel(); + JPanel right = new JPanel(); + left.setPreferredSize(new Dimension(200, 200)); + right.setPreferredSize(new Dimension(200, 200)); + JSplitPane sp = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, left, right); + frame.add(sp); + + JPanel south = new JPanel(); + south.setPreferredSize(new Dimension(20, 20)); + frame.add(south, BorderLayout.SOUTH); + + JPanel east = new JPanel(); + east.setPreferredSize(new Dimension(20, 20)); + frame.add(east, BorderLayout.EAST); + + return frame; + } + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("bug4749792 Test Instructions") + .instructions(INSTRUCTIONS) + .columns(40) + .testUI(bug4749792::createUI) + .build() + .awaitAndCheck(); + } +} diff --git a/test/jdk/javax/swing/JTabbedPane/8007563/Test8007563.java b/test/jdk/javax/swing/JTabbedPane/8007563/Test8007563.java deleted file mode 100644 index 25d3ad41eca5..000000000000 --- a/test/jdk/javax/swing/JTabbedPane/8007563/Test8007563.java +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -import java.awt.*; -import java.util.ArrayList; -import java.util.concurrent.CountDownLatch; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JTabbedPane; - -import static javax.swing.UIManager.*; -import static javax.swing.SwingUtilities.*; - -/* - * @test - * @key headful - * @bug 8007563 - * @summary Tests JTabbedPane background - * @author Sergey Malenkov - */ - -public class Test8007563 implements Runnable { - private static final ArrayList LIST = new ArrayList<>(); - private static final LookAndFeelInfo[] INFO = getInstalledLookAndFeels(); - private static final CountDownLatch LATCH = new CountDownLatch(INFO.length); - private static Robot ROBOT; - - public static void main(String[] args) throws Exception { - ROBOT = new Robot(); - invokeLater(new Test8007563()); - LATCH.await(); - if (!LIST.isEmpty()) { - throw new Error(LIST.toString()); - } - } - - private static void addOpaqueError(boolean opaque) { - LIST.add(getLookAndFeel().getName() + " opaque=" + opaque); - } - - private static boolean updateLookAndFeel() { - int index = (int) LATCH.getCount() - 1; - if (index >= 0) { - try { - LookAndFeelInfo info = INFO[index]; - System.err.println("L&F: " + info.getName()); - setLookAndFeel(info.getClassName()); - return true; - } catch (Exception exception) { - exception.printStackTrace(); - } - } - return false; - } - - private JFrame frame; - private JTabbedPane pane; - - public void run() { - if (this.frame == null) { - if (!updateLookAndFeel()) { - return; - } - this.pane = new JTabbedPane(); - this.pane.setOpaque(false); - this.pane.setBackground(Color.RED); - for (int i = 0; i < 3; i++) { - this.pane.addTab("Tab " + i, new JLabel("Content area " + i)); - } - this.frame = new JFrame(getClass().getSimpleName()); - this.frame.getContentPane().setBackground(Color.BLUE); - this.frame.add(this.pane); - this.frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); - this.frame.setSize(400, 200); - this.frame.setLocationRelativeTo(null); - this.frame.setVisible(true); - } else { - Point point = new Point(this.pane.getWidth() - 2, 2); - convertPointToScreen(point, this.pane); - Color actual = ROBOT.getPixelColor(point.x, point.y); - - boolean opaque = this.pane.isOpaque(); - Color expected = opaque - ? this.pane.getBackground() - : this.frame.getContentPane().getBackground(); - - if (!expected.equals(actual)){ - addOpaqueError(opaque); - } - if (!opaque) { - this.pane.setOpaque(true); - this.pane.repaint(); - } else { - this.frame.dispose(); - this.frame = null; - this.pane = null; - LATCH.countDown(); - } - - } - SecondaryLoop secondaryLoop = - Toolkit.getDefaultToolkit().getSystemEventQueue() - .createSecondaryLoop(); - new Thread() { - @Override - public void run() { - try { - Thread.sleep(200); - } catch (InterruptedException e) { - } - secondaryLoop.exit(); - invokeLater(Test8007563.this); - } - }.start(); - secondaryLoop.enter(); - } -} diff --git a/test/jdk/javax/swing/JTabbedPane/TestJTabbedPaneBackgroundColor.java b/test/jdk/javax/swing/JTabbedPane/TestJTabbedPaneBackgroundColor.java new file mode 100644 index 000000000000..cc4ca41802cd --- /dev/null +++ b/test/jdk/javax/swing/JTabbedPane/TestJTabbedPaneBackgroundColor.java @@ -0,0 +1,148 @@ +/* + * Copyright (c) 2015, 2025, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Point; +import java.awt.Robot; +import java.util.ArrayList; + +import javax.swing.JFrame; +import javax.swing.JLabel; +import javax.swing.JTabbedPane; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; +import javax.swing.UnsupportedLookAndFeelException; + +/* + * @test + * @key headful + * @bug 8007563 + * @summary Tests JTabbedPane background + */ + +public class TestJTabbedPaneBackgroundColor { + private static ArrayList lafList = new ArrayList<>(); + private static JFrame frame; + private static JTabbedPane pane; + private static Robot robot; + private static volatile Dimension dim; + private static volatile Point loc; + private static volatile boolean isOpaque; + private static volatile Color c1 = null; + private static volatile Color c2 = null; + + public static void main(String[] args) throws Exception { + robot = new Robot(); + + for (UIManager.LookAndFeelInfo laf : + UIManager.getInstalledLookAndFeels()) { + System.out.println("Testing: " + laf.getName()); + + try { + SwingUtilities.invokeAndWait(() -> { + setLookAndFeel(laf); + createAndShowUI(); + }); + robot.waitForIdle(); + robot.delay(500); + + SwingUtilities.invokeAndWait(() -> { + loc = pane.getLocationOnScreen(); + dim = pane.getSize(); + }); + + loc = new Point(loc.x + dim.width - 2, loc.y + 2); + doTesting(loc, laf); + + SwingUtilities.invokeAndWait(() -> { + if (!pane.isOpaque()) { + pane.setOpaque(true); + pane.repaint(); + } + }); + robot.waitForIdle(); + robot.delay(500); + + doTesting(loc, laf); + + } finally { + SwingUtilities.invokeAndWait(() -> { + if (frame != null) { + frame.dispose(); + } + }); + } + } + if (!lafList.isEmpty()) { + throw new RuntimeException(lafList.toString()); + } + } + + private static void setLookAndFeel(UIManager.LookAndFeelInfo laf) { + try { + UIManager.setLookAndFeel(laf.getClassName()); + } catch (UnsupportedLookAndFeelException ignored) { + System.out.println("Unsupported LAF: " + laf.getClassName()); + } catch (ClassNotFoundException | InstantiationException + | IllegalAccessException e) { + throw new RuntimeException(e); + } + } + + private static void createAndShowUI() { + pane = new JTabbedPane(); + pane.setOpaque(false); + pane.setBackground(Color.RED); + for (int i = 0; i < 3; i++) { + pane.addTab("Tab " + i, new JLabel("Content area " + i)); + } + frame = new JFrame("Test Background Color"); + frame.getContentPane().setBackground(Color.BLUE); + frame.add(pane); + frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); + frame.setSize(400, 200); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + } + + private static void doTesting(Point p, UIManager.LookAndFeelInfo laf) throws Exception { + SwingUtilities.invokeAndWait(() -> { + isOpaque = pane.isOpaque(); + c1 = pane.getBackground(); + c2 = frame.getContentPane().getBackground(); + }); + Color actual = robot.getPixelColor(p.x, p.y); + Color expected = isOpaque ? c1 : c2; + + if (!expected.equals(actual)) { + System.out.println("Expected Color : " + expected); + System.out.println("Actual Color : " + actual); + addOpaqueError(laf.getName(), isOpaque); + } + } + + private static void addOpaqueError(String lafName, boolean opaque) { + lafList.add(lafName + " opaque=" + opaque); + } +} diff --git a/test/jdk/javax/swing/JToolBar/4529206/bug4529206.java b/test/jdk/javax/swing/JToolBar/4529206/bug4529206.java index ed4f062b24cc..56f4a224e3b1 100644 --- a/test/jdk/javax/swing/JToolBar/4529206/bug4529206.java +++ b/test/jdk/javax/swing/JToolBar/4529206/bug4529206.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2004, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2004, 2024, 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,6 +30,7 @@ import javax.swing.JTextField; import javax.swing.JToolBar; import javax.swing.SwingUtilities; +import javax.swing.plaf.basic.BasicToolBarUI; /* * @test @@ -45,7 +46,7 @@ public class bug4529206 { static JButton jButton1; private static void test() { - frame = new JFrame(); + frame = new JFrame("bug4529206"); JPanel jPanFrame = (JPanel) frame.getContentPane(); jPanFrame.setLayout(new BorderLayout()); frame.setSize(new Dimension(200, 100)); @@ -64,7 +65,7 @@ private static void test() { } private static void makeToolbarFloat() { - javax.swing.plaf.basic.BasicToolBarUI ui = (javax.swing.plaf.basic.BasicToolBarUI) jToolBar1.getUI(); + BasicToolBarUI ui = (BasicToolBarUI) jToolBar1.getUI(); if (!ui.isFloating()) { ui.setFloatingLocation(100, 100); ui.setFloating(true, jToolBar1.getLocation()); @@ -79,16 +80,17 @@ public static void main(String[] args) throws Exception { try { SwingUtilities.invokeAndWait(() -> test()); Robot robot = new Robot(); - robot.setAutoWaitForIdle(true); + robot.waitForIdle(); robot.delay(1000); SwingUtilities.invokeAndWait(() -> makeToolbarFloat()); + robot.waitForIdle(); robot.delay(300); SwingUtilities.invokeAndWait(() -> { if (frame.isFocused()) { - throw - new RuntimeException("setFloating does not work correctly"); + throw new RuntimeException( + "setFloating does not work correctly"); } }); } finally { diff --git a/test/jdk/javax/swing/JToolBar/bug4188825.java b/test/jdk/javax/swing/JToolBar/bug4188825.java new file mode 100644 index 000000000000..e5dd6538de42 --- /dev/null +++ b/test/jdk/javax/swing/JToolBar/bug4188825.java @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2000, 2025, 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 4188825 + * @summary Tests if toolbars return to original location when closed + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual bug4188825 + */ + +import java.awt.BorderLayout; + +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JToolBar; + +public class bug4188825 { + static final String INSTRUCTIONS = """ + Drag the toolbar out of frame and close it. If it returns to + the original location, then the test succeeded, otherwise it failed. + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("bug4188825 Test Instructions") + .instructions(INSTRUCTIONS) + .columns(40) + .testUI(bug4188825::createUI) + .build() + .awaitAndCheck(); + } + + static JFrame createUI() { + JFrame frame = new JFrame("Toolbar Drag Test"); + frame.setLayout(new BorderLayout()); + JToolBar tb = new JToolBar(); + tb.setOrientation(JToolBar.VERTICAL); + tb.add(new JButton("a")); + tb.add(new JButton("b")); + tb.add(new JButton("c")); + frame.add(tb, BorderLayout.WEST); + JButton l = new JButton("Get me!!!"); + l.setSize(200, 200); + frame.add(l); + frame.setSize(200, 200); + return frame; + } +} diff --git a/test/jdk/javax/swing/JToolBar/bug4251592.java b/test/jdk/javax/swing/JToolBar/bug4251592.java new file mode 100644 index 000000000000..add4eb8ec923 --- /dev/null +++ b/test/jdk/javax/swing/JToolBar/bug4251592.java @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2000, 2025, 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 4251592 + * @summary JToolBar should have ability to set custom layout. + * @key headful + * @run main bug4251592 + */ + +import java.awt.BorderLayout; +import java.awt.GridLayout; +import java.awt.Point; +import java.awt.Robot; +import java.awt.event.InputEvent; + +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JToolBar; +import javax.swing.SwingUtilities; + +public class bug4251592 { + private static final int OFFSET = 3; + private static volatile Point loc; + private static JFrame frame; + private static JToolBar toolBar; + private static GridLayout customLayout; + + public static void main(String[] args) throws Exception { + Robot robot = new Robot(); + robot.setAutoDelay(100); + try { + SwingUtilities.invokeAndWait(() -> { + frame = new JFrame("Toolbar Layout Save Test"); + toolBar = new JToolBar(); + customLayout = new GridLayout(); + frame.setLayout(new BorderLayout()); + frame.add(toolBar, BorderLayout.NORTH); + + toolBar.setLayout(customLayout); + toolBar.add(new JButton("Button1")); + toolBar.add(new JButton("Button2")); + toolBar.add(new JButton("Button3")); + toolBar.setFloatable(true); + + frame.setSize(200, 200); + frame.setLocationRelativeTo(null); + frame.setVisible(true); + }); + + robot.waitForIdle(); + robot.delay(1000); + + SwingUtilities.invokeAndWait(() -> loc = toolBar.getLocationOnScreen()); + + robot.mouseMove(loc.x + OFFSET, loc.y + OFFSET); + robot.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robot.mouseMove(loc.x + OFFSET, loc.y + 50); + robot.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + + if (toolBar.getLayout() != customLayout) { + throw new RuntimeException("Custom layout not saved..."); + } + } finally { + SwingUtilities.invokeAndWait(() -> { + if (frame != null) { + frame.dispose(); + } + }); + } + } +} diff --git a/test/jdk/javax/swing/JToolBar/bug5035668.java b/test/jdk/javax/swing/JToolBar/bug5035668.java new file mode 100644 index 000000000000..b0cdef7c7ef7 --- /dev/null +++ b/test/jdk/javax/swing/JToolBar/bug5035668.java @@ -0,0 +1,113 @@ +/* + * Copyright (c) 2004, 2025, 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 5035668 + * @summary Test that metal ToolBar border correctly sizes the MetalBumps used + * for the grip + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual bug5035668 + */ + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.ComponentOrientation; +import java.awt.GridLayout; + +import javax.swing.JButton; +import javax.swing.JFrame; +import javax.swing.JPanel; +import javax.swing.JToolBar; +import javax.swing.UIManager; +import javax.swing.border.CompoundBorder; +import javax.swing.border.EmptyBorder; + +public class bug5035668 { + static final String INSTRUCTIONS = """ + This test is for Metal LaF only. + + All of them have an empty border around their own border. + If you see that in any toolbar the grip (little dotted strip) overlaps + the empty border press Fail. If you see that grips are completely + inside empty borders press Pass. + """; + + public static void main(String[] args) throws Exception { + // Set metal l&f + UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel"); + PassFailJFrame.builder() + .title("bug4251592 Test Instructions") + .instructions(INSTRUCTIONS) + .columns(40) + .testUI(bug5035668::createUI) + .build() + .awaitAndCheck(); + } + + static JFrame createUI() { + JFrame frame = new JFrame("Metal JToolBar Border Overlap Test"); + frame.setLayout(new BorderLayout()); + frame.setBackground(Color.white); + + // Horizontal toolbar left-to-right + final JToolBar toolBar = new JToolBar(); + toolBar.setBorder(new CompoundBorder(new EmptyBorder(10, 10, 10, 10), + toolBar.getBorder())); + toolBar.setComponentOrientation(ComponentOrientation.LEFT_TO_RIGHT); + toolBar.add(new ToolBarButton(toolBar)); + + // Horizontal toolbar right-to-left + JToolBar toolBar2 = new JToolBar(); + toolBar2.setBorder(new CompoundBorder(new EmptyBorder(10, 10, 10, 10), + toolBar2.getBorder())); + toolBar2.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT); + toolBar2.add(new ToolBarButton(toolBar2)); + + JPanel topPanel = new JPanel(new GridLayout(2, 0)); + topPanel.add(toolBar); + topPanel.add(toolBar2); + frame.add(topPanel, BorderLayout.NORTH); + + JToolBar toolBar3 = new JToolBar(); + toolBar3.setBorder(new CompoundBorder(new EmptyBorder(10, 10, 10, 10), + toolBar3.getBorder())); + toolBar3.setOrientation(JToolBar.VERTICAL); + toolBar3.add(new ToolBarButton(toolBar3)); + frame.add(toolBar3, BorderLayout.EAST); + + frame.setSize(200, 200); + return frame; + } + + static class ToolBarButton extends JButton { + final JToolBar toolBar; + + public ToolBarButton(JToolBar p_toolBar) { + super("Change toolbar's orientation"); + this.toolBar = p_toolBar; + addActionListener(e -> toolBar.setOrientation(1 - toolBar.getOrientation())); + } + } +} diff --git a/test/jdk/javax/swing/Popup/TaskbarPositionTest.java b/test/jdk/javax/swing/Popup/TaskbarPositionTest.java index 5378f61c96f7..a64995674836 100644 --- a/test/jdk/javax/swing/Popup/TaskbarPositionTest.java +++ b/test/jdk/javax/swing/Popup/TaskbarPositionTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2025, 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 @@ -37,7 +37,11 @@ import java.awt.event.KeyEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; +import java.awt.image.BufferedImage; +import java.io.File; +import java.io.IOException; +import javax.imageio.ImageIO; import javax.swing.AbstractAction; import javax.swing.JComboBox; import javax.swing.JFrame; @@ -337,11 +341,11 @@ public static void main(String[] args) throws Throwable { } } - try { - // Use Robot to automate the test - Robot robot = new Robot(); - robot.setAutoDelay(50); + // Use Robot to automate the test + Robot robot = new Robot(); + robot.setAutoDelay(50); + try { SwingUtilities.invokeAndWait(TaskbarPositionTest::new); robot.waitForIdle(); @@ -442,6 +446,9 @@ public static void main(String[] args) throws Throwable { hidePopup(robot); robot.waitForIdle(); + } catch (Throwable t) { + saveScreenCapture(robot, screens); + throw t; } finally { SwingUtilities.invokeAndWait(() -> { if (frame != null) { @@ -450,4 +457,17 @@ public static void main(String[] args) throws Throwable { }); } } + + private static void saveScreenCapture(Robot robot, GraphicsDevice[] screens) { + for (int i = 0; i < screens.length; i++) { + Rectangle bounds = screens[i].getDefaultConfiguration() + .getBounds(); + BufferedImage image = robot.createScreenCapture(bounds); + try { + ImageIO.write(image, "png", new File("Screenshot.png")); + } catch (IOException e) { + e.printStackTrace(); + } + } + } } diff --git a/test/jdk/javax/swing/SwingUtilities/bug4369355.java b/test/jdk/javax/swing/SwingUtilities/bug4369355.java new file mode 100644 index 000000000000..f55d888ef317 --- /dev/null +++ b/test/jdk/javax/swing/SwingUtilities/bug4369355.java @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2000, 2025, 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 + * @key headful + * @bug 4369355 + * @summary To verify if SwingUtilities.convertPointToScreen() (for invisible frame) + * and SwingUtilities.convertPointFromScreen() return correct values + * @run main bug4369355 + */ + +import java.awt.Point; +import java.awt.Robot; +import javax.swing.JFrame; +import javax.swing.SwingUtilities; + +public class bug4369355 { + private static JFrame frame; + + private static volatile Point frameToScreenLoc; + private static volatile Point frameFromScreenLoc; + + private static final Point EXPECTED_FROM_SCREEN_LOC = new Point(0, 0); + private static final Point EXPECTED_TO_SCREEN_LOC = new Point(100, 100); + + public static void main (String[] args) throws Exception { + try { + Robot robot = new Robot(); + SwingUtilities.invokeAndWait(() -> { + frame = new JFrame("bug4369355"); + frame.setBounds(100, 100, 100, 100); + }); + robot.waitForIdle(); + robot.delay(1000); + + SwingUtilities.invokeAndWait(() -> { + frameToScreenLoc = new Point(0, 0); + SwingUtilities.convertPointToScreen(frameToScreenLoc, frame); + }); + robot.delay(100); + + if (!frameToScreenLoc.equals(EXPECTED_TO_SCREEN_LOC)) { + throw new RuntimeException("SwingUtilities.convertPointToScreen()" + + " returns incorrect point " + frameToScreenLoc + "\n" + + "Should be " + EXPECTED_TO_SCREEN_LOC); + } + + SwingUtilities.invokeAndWait(() -> frame.setVisible(true)); + robot.delay(500); + + SwingUtilities.invokeAndWait(() -> { + frameFromScreenLoc = frame.getLocationOnScreen(); + SwingUtilities.convertPointFromScreen(frameFromScreenLoc, frame); + }); + robot.delay(100); + + if (!frameFromScreenLoc.equals(EXPECTED_FROM_SCREEN_LOC)) { + throw new RuntimeException("SwingUtilities.convertPointFromScreen()" + + " returns incorrect point " + frameFromScreenLoc + "\n" + + "Should be " + EXPECTED_FROM_SCREEN_LOC); + } + } finally { + SwingUtilities.invokeAndWait(frame::dispose); + } + } +} diff --git a/test/jdk/javax/swing/SwingUtilities/bug4967768.java b/test/jdk/javax/swing/SwingUtilities/bug4967768.java new file mode 100644 index 000000000000..43f9f7cabfbe --- /dev/null +++ b/test/jdk/javax/swing/SwingUtilities/bug4967768.java @@ -0,0 +1,66 @@ +/* + * Copyright (c) 2004, 2025, 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 4967768 + * @requires (os.family != "mac") + * @summary Tests that underline is painted correctly in mnemonics + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual bug4967768 + */ + +import java.awt.Font; +import javax.swing.JButton; +import javax.swing.JPanel; + +public class bug4967768 { + private static final String INSTRUCTIONS = """ + When the test starts you'll see a button "Oops" + with the "p" letter underlined at the bottom + of the instruction frame. + + Ensure the underline cuts through the descender + of letter "p", i.e. the underline is painted + not below the letter but below the baseline. + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .instructions(INSTRUCTIONS) + .columns(35) + .splitUIBottom(bug4967768::createTestUI) + .build() + .awaitAndCheck(); + } + + private static JPanel createTestUI() { + JPanel panel = new JPanel(); + JButton but = new JButton("Oops"); + but.setFont(new Font("Dialog", Font.BOLD, 24)); + but.setMnemonic('p'); + panel.add(but); + return panel; + } +} diff --git a/test/jdk/javax/swing/plaf/motif/bug4150591.java b/test/jdk/javax/swing/plaf/motif/bug4150591.java new file mode 100644 index 000000000000..66c668a441c3 --- /dev/null +++ b/test/jdk/javax/swing/plaf/motif/bug4150591.java @@ -0,0 +1,42 @@ +/* + * Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import com.sun.java.swing.plaf.motif.MotifInternalFrameTitlePane; +import javax.swing.JInternalFrame; + +/* + * @test + * @bug 4150591 + * @summary MotifInternalFrameTitlePane is public now and can be + * instantiated by other classes within the desktop module without using Reflection. + * This does not mean that this class will ever become part + * of the official public Java API. + * @modules java.desktop/com.sun.java.swing.plaf.motif + * @run main bug4150591 + */ + +public class bug4150591 { + public static void main(String[] args) { + MotifInternalFrameTitlePane mtp = new MotifInternalFrameTitlePane(new JInternalFrame()); + } +} diff --git a/test/jdk/javax/swing/text/DefaultCaret/PaintTest.java b/test/jdk/javax/swing/text/DefaultCaret/PaintTest.java new file mode 100644 index 000000000000..c554764527ea --- /dev/null +++ b/test/jdk/javax/swing/text/DefaultCaret/PaintTest.java @@ -0,0 +1,63 @@ +/* + * Copyright (c) 1999, 2025, 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 4193062 + * @summary Tests that when a TextField first gets focus, if modelToView fails + * (null is returned) that the caret will start to blink again. + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual PaintTest +*/ + +import java.awt.FlowLayout; +import javax.swing.JFrame; +import javax.swing.JTextField; + +public class PaintTest { + + static final String INSTRUCTIONS = """ + If the test window displays with the text caret flashing (do wait at + least several second for it to start) the test PASSES, otherwise it FAILS. + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("PaintTest Test Instructions") + .instructions(INSTRUCTIONS) + .columns(50) + .testUI(PaintTest::createUI) + .build() + .awaitAndCheck(); + } + + static JFrame createUI() { + JFrame frame = new JFrame("PaintTest"); + JTextField tf = new JTextField(20); + frame.setLayout(new FlowLayout()); + frame.add(tf); + frame.setSize(300, 300); + return frame; + } +} diff --git a/test/jdk/javax/swing/text/DefaultCaret/bug4785160.java b/test/jdk/javax/swing/text/DefaultCaret/bug4785160.java new file mode 100644 index 000000000000..644becf8ae6a --- /dev/null +++ b/test/jdk/javax/swing/text/DefaultCaret/bug4785160.java @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2003, 2025, 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 4785160 + * @summary Test that the cursor is always visible when typing in JTextArea with JScrollBar + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual bug4785160 +*/ + +import javax.swing.JFrame; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; + +public class bug4785160 { + + static final String INSTRUCTIONS = """ + Ensure that the horizontal scrollbar is visible in the JTextArea. + If necessary, reduce the width of the window so that the scrollbar becomes visible. + Scroll all the way to the right so the end of the line is visible. + If necessary, move the text caret in the text area to the end of line. + The test PASSES if the caret is visible at the end of the line. + The test FAILS if the caret disappears when moved to the end of the line. + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("bug4785160 Test Instructions") + .instructions(INSTRUCTIONS) + .columns(50) + .testUI(bug4785160::createUI) + .build() + .awaitAndCheck(); + } + + static JFrame createUI() { + JFrame frame = new JFrame("bug4785160"); + JTextArea area = new JTextArea(); + String s = ""; + for (int i = 0; i < 80; i++) { + s += "m"; + } + area.setText(s); + area.getCaret().setDot(area.getText().length() + 1); + frame.add(new JScrollPane(area)); + frame.setSize(300, 300); + return frame; + } +} diff --git a/test/jdk/javax/swing/text/DefaultEditorKit/4278839/bug4278839.java b/test/jdk/javax/swing/text/DefaultEditorKit/4278839/bug4278839.java index e67d2ddb5884..980a9c9f5281 100644 --- a/test/jdk/javax/swing/text/DefaultEditorKit/4278839/bug4278839.java +++ b/test/jdk/javax/swing/text/DefaultEditorKit/4278839/bug4278839.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,17 +26,22 @@ * @key headful * @bug 4278839 8233634 * @summary Incorrect cursor movement between words at the end of line - * @author Anton Nashatyrev * @library ../../../regtesthelpers * @build Util * @run main bug4278839 */ -import java.awt.*; -import java.awt.event.*; -import javax.swing.*; +import java.awt.Rectangle; +import java.awt.Robot; +import java.awt.event.KeyEvent; +import java.awt.event.InputEvent; +import javax.swing.JFrame; +import javax.swing.JScrollPane; +import javax.swing.JTextArea; +import javax.swing.SwingUtilities; +import javax.swing.UIManager; -public class bug4278839 extends JFrame { +public class bug4278839 { private static boolean passed = true; private static JTextArea area; @@ -47,16 +52,12 @@ public static void main(String[] args) throws Exception { try { robo = new Robot(); - robo.setAutoDelay(200); + robo.setAutoDelay(100); - SwingUtilities.invokeAndWait(new Runnable() { - @Override - public void run() { - createAndShowGUI(); - } - }); + SwingUtilities.invokeAndWait(() -> createAndShowGUI()); robo.waitForIdle(); + robo.delay(1000); clickMouse(); robo.waitForIdle(); @@ -100,33 +101,27 @@ private static int moveCaret(boolean right) throws Exception { final int[] result = new int[1]; - SwingUtilities.invokeAndWait(new Runnable() { - - @Override - public void run() { - result[0] = area.getCaretPosition(); - } + SwingUtilities.invokeAndWait(() -> { + result[0] = area.getCaretPosition(); }); - int pos = result[0]; - return pos; + return result[0]; } private static void clickMouse() throws Exception { final Rectangle result[] = new Rectangle[1]; - SwingUtilities.invokeAndWait(new Runnable() { - @Override - public void run() { - result[0] = new Rectangle(area.getLocationOnScreen(), area.getSize()); - } + SwingUtilities.invokeAndWait(() -> { + result[0] = new Rectangle(area.getLocationOnScreen(), area.getSize()); }); Rectangle rect = result[0]; robo.mouseMove(rect.x + rect.width / 2, rect.y + rect.width / 2); - robo.mousePress(InputEvent.BUTTON1_MASK); - robo.mouseRelease(InputEvent.BUTTON1_MASK); + robo.waitForIdle(); + robo.mousePress(InputEvent.BUTTON1_DOWN_MASK); + robo.mouseRelease(InputEvent.BUTTON1_DOWN_MASK); + robo.waitForIdle(); } /** diff --git a/test/jdk/javax/swing/text/html/CSS/bug4174871.java b/test/jdk/javax/swing/text/html/CSS/bug4174871.java new file mode 100644 index 000000000000..7ae27150be5f --- /dev/null +++ b/test/jdk/javax/swing/text/html/CSS/bug4174871.java @@ -0,0 +1,101 @@ +/* + * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Robot; +import java.awt.Shape; +import javax.swing.JFrame; +import javax.swing.JTextPane; +import javax.swing.SwingUtilities; +import javax.swing.text.View; + +/* + * @test + * @bug 4174871 + * @key headful + * @summary Tests if CELLSPACING attribute in HTML table is rendered. + */ + +public class bug4174871 { + private static JFrame frame; + private static JTextPane pane; + private static volatile boolean passed = false; + + public static void main(String[] args) throws Exception { + try { + Robot robot = new Robot(); + + SwingUtilities.invokeAndWait(bug4174871::createAndShowUI); + robot.waitForIdle(); + robot.delay(500); + + SwingUtilities.invokeAndWait(bug4174871::testUI); + + if (!passed) { + throw new RuntimeException("Test failed!!" + + " CELLSPACING attribute in HTML table is NOT rendered"); + } + } finally { + SwingUtilities.invokeAndWait(() -> { + if (frame != null) { + frame.dispose(); + } + }); + } + } + + public static void createAndShowUI() { + pane = new JTextPane(); + pane.setContentType("text/html"); + pane.setText("" + + "" + + "" + + "
    onetwothree
    "); + + frame = new JFrame("Table CellSpacing Test"); + frame.getContentPane().add(pane); + frame.setSize(600, 200); + frame.setVisible(true); + } + + private static void testUI() { + int tableWidth = 0; + Shape r = pane.getBounds(); + View v = pane.getUI().getRootView(pane); + + while (!(v instanceof javax.swing.text.html.ParagraphView)) { + int n = v.getViewCount(); + Shape sh = v.getChildAllocation(n - 1, r); + String viewName = v.getClass().getName(); + if (viewName.endsWith("TableView")) { + tableWidth = r.getBounds().width; + } + v = v.getView(n - 1); + if (sh != null) { + r = sh; + } + } + // tableWidth should be the sum of TD's widths (300) + // and cellspacings (80) + passed = (tableWidth >= 380); + } +} diff --git a/test/jdk/javax/swing/text/html/CSS/bug4174874.java b/test/jdk/javax/swing/text/html/CSS/bug4174874.java new file mode 100644 index 000000000000..b6ba85014daf --- /dev/null +++ b/test/jdk/javax/swing/text/html/CSS/bug4174874.java @@ -0,0 +1,100 @@ +/* + * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import javax.swing.JFrame; +import javax.swing.JTextPane; +import javax.swing.SwingUtilities; +import javax.swing.text.View; +import java.awt.Robot; +import java.awt.Shape; + +/* + * @test + * @bug 4174874 + * @key headful + * @summary Tests if borders in HTML table are rendered + */ + +public class bug4174874 { + private static JFrame frame; + private static JTextPane pane; + private static volatile boolean passed = false; + + public static void main(String[] args) throws Exception { + try { + Robot robot = new Robot(); + + SwingUtilities.invokeAndWait(bug4174874::createAndShowUI); + robot.waitForIdle(); + robot.delay(500); + + SwingUtilities.invokeAndWait(bug4174874::testUI); + + if (!passed) { + throw new RuntimeException("Test failed!!" + + " Borders of HTML table not rendered correctly"); + } + } finally { + SwingUtilities.invokeAndWait(() -> { + if (frame != null) { + frame.dispose(); + } + }); + } + } + + public static void createAndShowUI() { + pane = new JTextPane(); + pane.setContentType("text/html"); + pane.setText("" + + "" + + "" + + "
    onetwothree
    "); + + frame = new JFrame("Table Border Test"); + frame.getContentPane().add(pane); + frame.setSize(600, 200); + frame.setVisible(true); + } + + private static void testUI() { + Shape r = pane.getBounds(); + View v = pane.getUI().getRootView(pane); + int tableWidth = 0; + while (!(v instanceof javax.swing.text.html.ParagraphView)) { + int n = v.getViewCount(); + Shape sh = v.getChildAllocation(n - 1, r); + String viewName = v.getClass().getName(); + if (viewName.endsWith("TableView")) { + tableWidth = r.getBounds().width; + } + v = v.getView(n - 1); + if (sh != null) { + r = sh; + } + } + // tableWidth should be the sum of TD's widths (300) + // and border width * 2 (40) + passed = tableWidth >= 340; + } +} diff --git a/test/jdk/javax/swing/text/html/CSS/bug4271058.java b/test/jdk/javax/swing/text/html/CSS/bug4271058.java new file mode 100644 index 000000000000..83aad377b1de --- /dev/null +++ b/test/jdk/javax/swing/text/html/CSS/bug4271058.java @@ -0,0 +1,92 @@ +/* + * Copyright (c) 1999, 2024, 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 4270889 4271058 4285098 + * @summary Tests that ,
    and
    tags work + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual bug4271058 +*/ + +import javax.swing.JEditorPane; +import javax.swing.JFrame; + +public class bug4271058 { + + private static String INSTRUCTIONS = """ + What should be seen is three 2x2 tables. + + The first table should have borders and lines distinguishing + table cells. If they are not shown, test fails (bug 4271058). + + In the second table, the first (left) column should be about + four times as wide as the second (right) column. + If this is not so, test fails (bug 4270889). + + The third table should be right aligned, i.e. its right edge + should be close to the right edge of the viewable area. + Otherwise test fails (bug 4285098). + """; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("CSS html tag verification Instructions") + .instructions(INSTRUCTIONS) + .rows(15) + .columns(30) + .testUI(bug4271058::createTestUI) + .screenCapture() + .build() + .awaitAndCheck(); + } + + private static JFrame createTestUI() { + String htmlText = + "" + + "" + + "" + + "" + + "" + + "
    col Acol B
    aaaaaabbbbbbb
    " + + "" + + "" + + "" + + "" + + "" + + "
    AB
    ab
    " + + "" + + "" + + "" + + "" + + "" + + "
    col Acol B
    aaaaaabbbbbbb
    "; + + JEditorPane lbl = new JEditorPane("text/html", htmlText); + JFrame frame = new JFrame("bug4271058"); + frame.add(lbl); + frame.pack(); + return frame; + } +} diff --git a/test/jdk/javax/swing/text/html/CSS/bug4284162.java b/test/jdk/javax/swing/text/html/CSS/bug4284162.java new file mode 100644 index 000000000000..e1f7116c0a82 --- /dev/null +++ b/test/jdk/javax/swing/text/html/CSS/bug4284162.java @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Robot; +import javax.swing.JEditorPane; +import javax.swing.JFrame; +import javax.swing.SwingUtilities; +import javax.swing.text.AttributeSet; +import javax.swing.text.StyleConstants; +import javax.swing.text.View; +import javax.swing.text.html.HTMLEditorKit; + + +/* + * @test + * @bug 4284162 + * @key headful + * @summary Tests if css text-indent attribute is supported with negative values. + */ + +public class bug4284162 { + private static JEditorPane jep; + private static JFrame frame; + private static volatile boolean passed = false; + + public static void main(String[] args) throws Exception { + try { + Robot robot = new Robot(); + + SwingUtilities.invokeAndWait(bug4284162::createAndShowUI); + robot.waitForIdle(); + robot.delay(500); + + SwingUtilities.invokeAndWait(bug4284162::testUI); + + if (!passed) { + throw new RuntimeException("Test failed!!" + + " CSS Text-indent attribute doesn't support negative values"); + } + } finally { + SwingUtilities.invokeAndWait(() -> { + if (frame != null) { + frame.dispose(); + } + }); + } + } + + public static void createAndShowUI() { + String text ="" + + "

    paragraph"; + + frame = new JFrame("CSS Text-Indent Test"); + jep = new JEditorPane(); + jep.setEditorKit(new HTMLEditorKit()); + jep.setEditable(false); + + jep.setText(text); + + frame.getContentPane().add(jep); + frame.setSize(200, 200); + frame.setVisible(true); + } + + private static void testUI() { + View v = jep.getUI().getRootView(jep); + while (!(v instanceof javax.swing.text.html.ParagraphView)) { + int n = v.getViewCount(); + v = v.getView(n - 1); + } + + AttributeSet attrs = v.getAttributes(); + Object attr = attrs.getAttribute(StyleConstants.FirstLineIndent); + passed = (attr.toString().startsWith("-")); + } +} diff --git a/test/jdk/javax/swing/text/html/CSS/bug4286458.java b/test/jdk/javax/swing/text/html/CSS/bug4286458.java new file mode 100644 index 000000000000..110967d9e1dd --- /dev/null +++ b/test/jdk/javax/swing/text/html/CSS/bug4286458.java @@ -0,0 +1,69 @@ +/* + * Copyright (c) 2003, 2024, 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 4286458 + * @summary Tests if cellpadding in tables is non-negative number + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual bug4286458 +*/ + +import javax.swing.JEditorPane; +import javax.swing.JFrame; +import javax.swing.text.html.HTMLEditorKit; + +public class bug4286458 { + + private static String INSTRUCTIONS = """ + If you can clearly read the line of text in the appeared frame + press PASS. Otherwise test fails."""; + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("CSS tag Instructions") + .instructions(INSTRUCTIONS) + .rows(5) + .columns(30) + .testUI(bug4286458::createTestUI) + .build() + .awaitAndCheck(); + } + + private static JFrame createTestUI() { + + String text = + "" + + "" + + "
    This line should be clearly readable
    "; + + JFrame f = new JFrame("bug4286458"); + JEditorPane jep = new JEditorPane("text/html", text); + jep.setEditable(false); + + f.add(jep); + f.pack(); + return f; + } +} diff --git a/test/jdk/javax/swing/text/html/CSS/bug4764897.java b/test/jdk/javax/swing/text/html/CSS/bug4764897.java new file mode 100644 index 000000000000..68de9b1bb847 --- /dev/null +++ b/test/jdk/javax/swing/text/html/CSS/bug4764897.java @@ -0,0 +1,107 @@ +/* + * Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.awt.Robot; +import java.awt.Shape; +import javax.swing.JEditorPane; +import javax.swing.JFrame; +import javax.swing.JTextPane; +import javax.swing.SwingUtilities; +import javax.swing.text.View; + +/* + * @test + * @bug 4764897 + * @key headful + * @summary Tests if text and borders in HTML table doesn't run over right edge + */ + +public class bug4764897 { + private static JEditorPane pane; + private static JFrame frame; + private static volatile boolean passed = false; + + public static void main(String[] args) throws Exception { + try { + Robot robot = new Robot(); + + SwingUtilities.invokeAndWait(bug4764897::createAndShowUI); + robot.waitForIdle(); + robot.delay(500); + + SwingUtilities.invokeAndWait(bug4764897::testUI); + + if (!passed) { + throw new RuntimeException("Test failed!!" + + " Text and Borders of HTML table run over the right edge"); + } + } finally { + SwingUtilities.invokeAndWait(() -> { + if (frame != null) { + frame.dispose(); + } + }); + } + } + + public static void createAndShowUI() { + pane = new JTextPane(); + pane.setContentType("text/html"); + pane.setText("" + + "" + + "" + + "" + + "
    one ThisIsAnExtraWideWord" + + "This is text that won't get displayed correctly.
    "); + + frame = new JFrame("Table Border & Text Test"); + frame.getContentPane().add(pane); + frame.setSize(600, 200); + frame.setVisible(true); + } + + private static void testUI() { + Shape r = pane.getBounds(); + View v = pane.getUI().getRootView(pane); + int tableWidth = 0; + int cellsWidth = 0; + while (!(v instanceof javax.swing.text.html.ParagraphView)) { + int n = v.getViewCount(); + Shape sh = v.getChildAllocation(n - 1, r); + String viewName = v.getClass().getName(); + if (viewName.endsWith("TableView")) { + tableWidth = r.getBounds().width; + } + + if (viewName.endsWith("CellView")) { + cellsWidth = r.getBounds().x + r.getBounds().width; + } + + v = v.getView(n - 1); + if (sh != null) { + r = sh; + } + } + passed = cellsWidth <= tableWidth; + } +} diff --git a/test/jdk/javax/swing/text/html/FrameView/4463014/bug4463014.java b/test/jdk/javax/swing/text/html/FrameView/4463014/bug4463014.java new file mode 100644 index 000000000000..4b7199c90175 --- /dev/null +++ b/test/jdk/javax/swing/text/html/FrameView/4463014/bug4463014.java @@ -0,0 +1,74 @@ +/* + * Copyright (c) 2005, 2025, 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 4463014 + * @summary Tests if JEditorPane updates the correct frame when using

    + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual bug4463014 + */ + +import java.io.File; +import javax.swing.JEditorPane; +import javax.swing.JFrame; +import javax.swing.text.html.HTMLEditorKit; + +public class bug4463014 { + + static final String INSTRUCTIONS = """ + The test window displays an HTML frameset with a frame + on the left and another to the right. + Follow the instructions displayed in the left frame to perform testing. + The test PASSES only if the test behaves as per instructions. + """; + + static JFrame createUI() { + JFrame frame = new JFrame("bug4463014"); + JEditorPane jep = new JEditorPane(); + jep.setEditorKit(new HTMLEditorKit()); + jep.setEditable(false); + + try { + File file = new File(System.getProperty("test.src", "."), "frameset.html"); + System.out.println(file.toURL()); + jep.setPage(file.toURL()); + } catch (Exception e) { + } + + frame.add(jep); + frame.setSize(500,500); + return frame; + } + + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .columns(40) + .testUI(bug4463014::createUI) + .build() + .awaitAndCheck(); + } +} diff --git a/test/jdk/javax/swing/text/html/FrameView/4463014/frame1.html b/test/jdk/javax/swing/text/html/FrameView/4463014/frame1.html new file mode 100644 index 000000000000..833bc1f63529 --- /dev/null +++ b/test/jdk/javax/swing/text/html/FrameView/4463014/frame1.html @@ -0,0 +1,9 @@ + + +Push the Submit query button + +
    + +
    + + diff --git a/test/jdk/javax/swing/text/html/FrameView/4463014/frame2.html b/test/jdk/javax/swing/text/html/FrameView/4463014/frame2.html new file mode 100644 index 000000000000..5bc6dba57fc4 --- /dev/null +++ b/test/jdk/javax/swing/text/html/FrameView/4463014/frame2.html @@ -0,0 +1,4 @@ + + + + diff --git a/test/jdk/javax/swing/text/html/FrameView/4463014/frameresult.html b/test/jdk/javax/swing/text/html/FrameView/4463014/frameresult.html new file mode 100644 index 000000000000..a31045833b5c --- /dev/null +++ b/test/jdk/javax/swing/text/html/FrameView/4463014/frameresult.html @@ -0,0 +1,7 @@ + + +If you see this text in the RIGHT frame the test PASSED. +

    If you see this text in the LEFT frame the test FAILED. + + + diff --git a/test/jdk/javax/swing/text/html/FrameView/4463014/frameset.html b/test/jdk/javax/swing/text/html/FrameView/4463014/frameset.html new file mode 100644 index 000000000000..1e7f8298d628 --- /dev/null +++ b/test/jdk/javax/swing/text/html/FrameView/4463014/frameset.html @@ -0,0 +1,11 @@ + + + + Manual test for bug 4463014 + + + + + + + \ No newline at end of file diff --git a/test/hotspot/jtreg/vmTestbase/vm/share/UnsafeAccess.java b/test/jdk/javax/swing/text/html/HTMLDocument/bug4209280.java similarity index 70% rename from test/hotspot/jtreg/vmTestbase/vm/share/UnsafeAccess.java rename to test/jdk/javax/swing/text/html/HTMLDocument/bug4209280.java index 79a0a7392def..e9170d8cf2da 100644 --- a/test/hotspot/jtreg/vmTestbase/vm/share/UnsafeAccess.java +++ b/test/jdk/javax/swing/text/html/HTMLDocument/bug4209280.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2023, 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,23 +20,20 @@ * or visit www.oracle.com if you need additional information or have any * questions. */ -package vm.share; -import java.lang.reflect.Field; +import javax.swing.JLabel; -import jdk.internal.misc.Unsafe; +/* + * @test + * @bug 4209280 + * @summary Tests that no exception is thrown on unknown HTML tag + */ -@SuppressWarnings("restriction") -public class UnsafeAccess { - public static Unsafe unsafe; +public class bug4209280 { - static { - try { - unsafe = Unsafe.getUnsafe(); - } catch ( Exception e ) { - e.printStackTrace(); - } + public static void main(String[] args) throws Exception { + String html = "Foo"; + // The following line should throw no exceptions + new JLabel(html); } - - } diff --git a/test/jdk/javax/swing/text/html/HTMLEditorKit/bug4102068.java b/test/jdk/javax/swing/text/html/HTMLEditorKit/bug4102068.java new file mode 100644 index 000000000000..39dd1d539255 --- /dev/null +++ b/test/jdk/javax/swing/text/html/HTMLEditorKit/bug4102068.java @@ -0,0 +1,77 @@ +/* + * Copyright (c) 1999, 2025, 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 4102068 + * @summary Tests HTML editor JEditorPane change mouse icon over the link + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual bug4102068 + */ + +import java.awt.Cursor; +import javax.swing.JFrame; +import javax.swing.JTextPane; +import javax.swing.text.html.HTMLEditorKit; + +public class bug4102068 { + + static final String INSTRUCTIONS = """ + The test window contains an HTML frame containing a string with one hyperlink. + Move the mouse pointer over this hyperlink. + If the pointer over the hyperlink became a HAND cursor then the test PASSES, + otherwise the test FAILS. + """; + + static JFrame createUI() { + + JFrame frame = new JFrame("bug4102068"); + JTextPane ep = new JTextPane(); + ep.setContentType("text/html"); + HTMLEditorKit ek = new HTMLEditorKit(); + ep.setEditorKit(ek); + ep.setText("Here is a HyperLink Cursor Test"); + ek.setDefaultCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); + Cursor ct = ek.getDefaultCursor(); + ek.setLinkCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); + Cursor cl = ek.getLinkCursor(); + if (ct.getType() != Cursor.DEFAULT_CURSOR || cl.getType() != Cursor.HAND_CURSOR) { + throw new RuntimeException("Error with cursor settings..."); + } + ep.setEditable(false); + + frame.add(ep); + frame.setSize(300, 300); + return frame; + } + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .columns(50) + .testUI(bug4102068::createUI) + .build() + .awaitAndCheck(); + } +} diff --git a/test/jdk/javax/swing/text/html/HTMLEditorKit/bug4198022.java b/test/jdk/javax/swing/text/html/HTMLEditorKit/bug4198022.java new file mode 100644 index 000000000000..2d26ace21318 --- /dev/null +++ b/test/jdk/javax/swing/text/html/HTMLEditorKit/bug4198022.java @@ -0,0 +1,81 @@ +/* + * Copyright (c) 1999, 2025, 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 4198022 + * @summary Tests if HTML tags , and are supported in JEditorPane + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual bug4198022 + */ + +import javax.swing.JEditorPane; +import javax.swing.JFrame; +import javax.swing.text.html.HTMLEditorKit; + +public class bug4198022 { + + static final String INSTRUCTIONS = """ + There are two "lines" of text in the displayed HTML window + The first line/string contains and HTML elements. + The word "subscript" should be subscripted (placed lower than the word "Testing"), + and the word "superscript" should be superscripted (placed higher than "Testing"). + If instead these words are placed on the same level then the test FAILS. + + The second line/string contains a sentence marked with tag. + It should be presented as one long line without breaks. + It is OK for the line to extend past the end of the window and not be all visible. + If the line is broken up so you see multiple lines the test FAILS. + + If all behaves as expected, the test PASSES. + """; + + static JFrame createUI() { + + JFrame frame = new JFrame("bug4198022"); + JEditorPane ep = new JEditorPane(); + HTMLEditorKit ek = new HTMLEditorKit(); + ep.setEditorKit(ek); + ep.setText( + "Testing subscript and superscript.
    " + + "
    This text is intended to be presented as a single line without " + + "any word wrapping, regardless of whether it fits the viewable area of " + + "the editor pane or not."); + + ep.setEditable(false); + + frame.add(ep); + frame.setSize(500, 300); + return frame; + } + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .columns(60) + .testUI(bug4198022::createUI) + .build() + .awaitAndCheck(); + } +} diff --git a/test/jdk/javax/swing/text/html/HTMLEditorKit/bug4214848.java b/test/jdk/javax/swing/text/html/HTMLEditorKit/bug4214848.java new file mode 100644 index 000000000000..9a5353598660 --- /dev/null +++ b/test/jdk/javax/swing/text/html/HTMLEditorKit/bug4214848.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.io.StringReader; +import java.io.StringWriter; +import javax.swing.text.Document; +import javax.swing.text.html.HTMLEditorKit; + +/* + * @test + * @bug 4214848 + * @summary Tests whether HTMLEditorKit.read(...) + * creates Document for html with empty BODY + */ + +public class bug4214848 { + public static void main (String[] args) throws Exception { + StringWriter sw = new StringWriter(); + String test = ""; + HTMLEditorKit kit = new HTMLEditorKit(); + Document doc = kit.createDefaultDocument(); + kit.read(new StringReader(test), doc, 0); // prepare test document + kit.write(sw, doc, 0, 10); + String out = sw.toString().toLowerCase(); + if (out.indexOf("") != out.lastIndexOf("")) { + throw new RuntimeException("Test failed: extra section generated"); + } + } +} diff --git a/test/jdk/javax/swing/text/html/HTMLEditorKit/bug4230197.java b/test/jdk/javax/swing/text/html/HTMLEditorKit/bug4230197.java new file mode 100644 index 000000000000..59d4952c3230 --- /dev/null +++ b/test/jdk/javax/swing/text/html/HTMLEditorKit/bug4230197.java @@ -0,0 +1,58 @@ +/* + * Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.io.StringWriter; +import javax.swing.text.html.HTML; +import javax.swing.text.html.HTMLDocument; +import javax.swing.text.html.HTMLEditorKit; + +/* + * @test + * @bug 4230197 + * @summary Tests if HTMLEditorKit.insertHTML() works for font/phrase tags + */ + +public class bug4230197 { + + public static void main(String[] args) throws Exception { + HTMLEditorKit kit = new HTMLEditorKit(); + StringWriter sw = new StringWriter(); + HTMLDocument doc = (HTMLDocument) kit.createDefaultDocument(); + kit.insertHTML(doc, doc.getLength(), "0", 0, 0, HTML.Tag.SUB); + kit.insertHTML(doc, doc.getLength(), "0", 0, 0, HTML.Tag.SUP); + kit.insertHTML(doc, doc.getLength(), "0", 0, 0, HTML.Tag.B); + kit.insertHTML(doc, doc.getLength(), "0", 0, 0, HTML.Tag.I); + kit.insertHTML(doc, doc.getLength(), "0", 0, 0, HTML.Tag.CODE); + kit.write(sw, doc, 0, doc.getLength()); + + String out = sw.toString().toLowerCase(); + if ((!out.contains("0")) + || (!out.contains("0")) + || (!out.contains("0")) + || (!out.contains("0")) + || (!out.contains("0"))) { + throw new RuntimeException("Test failed: HTMLEditorKit.insertHTML()" + + " doesn't work for font/phrase tags"); + } + } +} diff --git a/test/jdk/javax/swing/text/html/HTMLEditorKit/bug4238223.java b/test/jdk/javax/swing/text/html/HTMLEditorKit/bug4238223.java new file mode 100644 index 000000000000..86479ea55709 --- /dev/null +++ b/test/jdk/javax/swing/text/html/HTMLEditorKit/bug4238223.java @@ -0,0 +1,125 @@ +/* + * Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.io.Reader; +import java.io.StringReader; +import javax.swing.text.MutableAttributeSet; +import javax.swing.text.html.HTML; +import javax.swing.text.html.HTMLEditorKit; +import javax.swing.text.html.parser.ParserDelegator; + +/* + * @test + * @bug 4238223 + * @summary Tests that HTMLEditorKit.ParserCallback methods receive + * correct 'pos' argument. + */ + +public class bug4238223 { + + public static void main(String[] argv) throws Exception { + TestParser parser = new TestParser(); + String testHTML = "Text" + + "Simple text"; + parser.parse(testHTML); + } + + static class TestCallback extends HTMLEditorKit.ParserCallback { + String commentData = "comment"; + int commentIndex = 65; + + public void handleComment(char[] data, int pos) { + if (!(new String(data)).equals(commentData) + || pos != commentIndex) { + + throw new RuntimeException("handleComment failed"); + } + } + + HTML.Tag[] endTags = {HTML.Tag.TITLE, HTML.Tag.HEAD, + HTML.Tag.BODY, HTML.Tag.HTML}; + int[] endTagPositions = {23, 31, 79, 86}; + int endTagIndex = 0; + public void handleEndTag(HTML.Tag tag, int pos) { + if (!tag.equals(endTags[endTagIndex]) + || pos != endTagPositions[endTagIndex]) { + + throw new RuntimeException("handleEndTag failed"); + } else { + endTagIndex++; + } + } + + int errorIndex = 54; + public void handleError(String errorMsg, int pos) { + if (pos != errorIndex) { + throw new RuntimeException("handleError failed"); + } + } + + int[] simpleTagPositions = {44, 93}; + int simpleTagIndex = 0; + public void handleSimpleTag(HTML.Tag tag, MutableAttributeSet attr, + int pos) { + if (pos != simpleTagPositions[simpleTagIndex++]) { + throw new RuntimeException("handleSimpleTag failed"); + } + } + + HTML.Tag[] startTags = {HTML.Tag.HTML, HTML.Tag.HEAD, + HTML.Tag.TITLE, HTML.Tag.BODY}; + int[] startTagPositions = {0, 6, 12, 38}; + int startTagIndex = 0; + public void handleStartTag(HTML.Tag tag, MutableAttributeSet attr, + int pos) { + if (!tag.equals(startTags[startTagIndex]) + || pos != startTagPositions[startTagIndex]) { + + throw new RuntimeException("handleStartTag failed"); + } else { + startTagIndex++; + } + } + + String[] textData = {"Text", "Simple text"}; + int[] textPositions = {19, 54}; + int textIndex = 0; + public void handleText(char[] data, int pos) { + if (!textData[textIndex].equals(new String(data)) + || pos != textPositions[textIndex]) { + + throw new RuntimeException("handleText failed"); + } else { + textIndex++; + } + } + } + + static class TestParser extends ParserDelegator { + public void parse(String html) throws Exception { + Reader r = new StringReader(html); + super.parse(r, new TestCallback(), false); + r.close(); + } + } +} diff --git a/test/jdk/javax/swing/text/html/HTMLEditorKit/bug4245401.java b/test/jdk/javax/swing/text/html/HTMLEditorKit/bug4245401.java new file mode 100644 index 000000000000..1f9bc7da914e --- /dev/null +++ b/test/jdk/javax/swing/text/html/HTMLEditorKit/bug4245401.java @@ -0,0 +1,78 @@ +/* + * Copyright (c) 1999, 2025, 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 4245401 + * @summary Tests that JTextPane with HTMLEditorKit handles the HEAD tag properly + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual bug4245401 + */ + +import java.io.StringReader; +import javax.swing.JFrame; +import javax.swing.JTextPane; +import javax.swing.text.html.HTMLDocument; +import javax.swing.text.html.HTMLEditorKit; + +public class bug4245401 { + + static final String INSTRUCTIONS = """ + Place the cursor before the "H" in the word "HTML" + Then press and . + If an extra HEAD tag appear, the test FAILS, otherwise it PASSES. + """; + + static JFrame createUI() { + + JFrame frame = new JFrame("bug4245401"); + JTextPane ep = new JTextPane(); + ep.setEditable(true); + ep.setContentType("text/html"); + HTMLEditorKit kit = (HTMLEditorKit) ep.getEditorKit(); + ep.setEditorKit(kit); + HTMLDocument doc = (HTMLDocument) kit.createDefaultDocument(); + ep.setDocument(doc); + + try { + String text = "HTML Test... Test is a test..."; + kit.read(new StringReader(text), doc, 0); + } catch (Exception e) { + throw new RuntimeException(e); + } + + frame.add(ep); + frame.setSize(300, 300); + return frame; + } + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .columns(40) + .testUI(bug4245401::createUI) + .build() + .awaitAndCheck(); + } +} diff --git a/test/jdk/javax/swing/text/html/StyleSheet/bug4619595.java b/test/jdk/javax/swing/text/html/StyleSheet/bug4619595.java new file mode 100644 index 000000000000..2d99d867cddd --- /dev/null +++ b/test/jdk/javax/swing/text/html/StyleSheet/bug4619595.java @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2003, 2025, 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 4619595 + * @summary Tests that embedded list items do not inherit the 'value' + * property from their parent list item + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual bug4619595 + */ + +import javax.swing.JEditorPane; +import javax.swing.JFrame; + +public class bug4619595 { + + static final String INSTRUCTIONS = """ + The test window contains numbered lists. + Look at the three indented/embedded list items (the ones that are bold). + If they are not numbered 1, 2 and 3, then press FAIL. + + Below the lists there should also be a line saying: "The quick brown fox". + If you don't see this, press FAIL. + + If all is as expected, PASS the test. + """; + + final static String HTML = "" + + "

    1. Let's start
    2. Look @ inner list" + + "
      1. Inner list starts
      2. Second inner item" + + "
      3. Inner list ends
      " + + "
    3. That's all
    " + + "

    The quick brown fox

    " + + " "; + + static JFrame createUI() { + + JFrame frame = new JFrame("bug4619595"); + JEditorPane pane = new JEditorPane(); + pane.setContentType("text/html"); + pane.setText(HTML); + frame.add(pane); + frame.setSize(400, 400); + return frame; + } + + public static void main(String[] args) throws Exception { + PassFailJFrame.builder() + .title("Test Instructions") + .instructions(INSTRUCTIONS) + .columns(40) + .testUI(bug4619595::createUI) + .build() + .awaitAndCheck(); + } +} diff --git a/test/jdk/javax/xml/crypto/dsig/ErrorHandlerPermissions.java b/test/jdk/javax/xml/crypto/dsig/ErrorHandlerPermissions.java index 1231d3cfe335..5ae366e82abb 100644 --- a/test/jdk/javax/xml/crypto/dsig/ErrorHandlerPermissions.java +++ b/test/jdk/javax/xml/crypto/dsig/ErrorHandlerPermissions.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/classfile/AccessFlagsTest.java b/test/jdk/jdk/classfile/AccessFlagsTest.java index 1f839d14dc1b..6a4b8dbe6f67 100644 --- a/test/jdk/jdk/classfile/AccessFlagsTest.java +++ b/test/jdk/jdk/classfile/AccessFlagsTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/classfile/AdaptCodeTest.java b/test/jdk/jdk/classfile/AdaptCodeTest.java index 309e5bb969a8..ddfda6230cdb 100644 --- a/test/jdk/jdk/classfile/AdaptCodeTest.java +++ b/test/jdk/jdk/classfile/AdaptCodeTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/classfile/AdvancedTransformationsTest.java b/test/jdk/jdk/classfile/AdvancedTransformationsTest.java index e9403b75ac03..8a5af04f7019 100644 --- a/test/jdk/jdk/classfile/AdvancedTransformationsTest.java +++ b/test/jdk/jdk/classfile/AdvancedTransformationsTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/classfile/AnnotationModelTest.java b/test/jdk/jdk/classfile/AnnotationModelTest.java index 529df063db85..7422bb6c6f0c 100644 --- a/test/jdk/jdk/classfile/AnnotationModelTest.java +++ b/test/jdk/jdk/classfile/AnnotationModelTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/classfile/AnnotationTest.java b/test/jdk/jdk/classfile/AnnotationTest.java index e649c0e0a5c9..df3b58a1840f 100644 --- a/test/jdk/jdk/classfile/AnnotationTest.java +++ b/test/jdk/jdk/classfile/AnnotationTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/classfile/ArrayTest.java b/test/jdk/jdk/classfile/ArrayTest.java index 2c2ab0948f2e..37fe78626b2a 100644 --- a/test/jdk/jdk/classfile/ArrayTest.java +++ b/test/jdk/jdk/classfile/ArrayTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/classfile/BSMTest.java b/test/jdk/jdk/classfile/BSMTest.java index b2f63b9fb45c..1b5717a674b1 100644 --- a/test/jdk/jdk/classfile/BSMTest.java +++ b/test/jdk/jdk/classfile/BSMTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/classfile/BasicBlockTest.java b/test/jdk/jdk/classfile/BasicBlockTest.java index d16219d08ede..c274e505c7fc 100644 --- a/test/jdk/jdk/classfile/BasicBlockTest.java +++ b/test/jdk/jdk/classfile/BasicBlockTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/classfile/BoundAttributeTest.java b/test/jdk/jdk/classfile/BoundAttributeTest.java index 3dc09a79bc05..bb60290f23ac 100644 --- a/test/jdk/jdk/classfile/BoundAttributeTest.java +++ b/test/jdk/jdk/classfile/BoundAttributeTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/classfile/BuilderBlockTest.java b/test/jdk/jdk/classfile/BuilderBlockTest.java index 45b8904eae05..3f14096ef283 100644 --- a/test/jdk/jdk/classfile/BuilderBlockTest.java +++ b/test/jdk/jdk/classfile/BuilderBlockTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/classfile/BuilderParamTest.java b/test/jdk/jdk/classfile/BuilderParamTest.java index ca49a88005dd..3898c92618bc 100644 --- a/test/jdk/jdk/classfile/BuilderParamTest.java +++ b/test/jdk/jdk/classfile/BuilderParamTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/classfile/ClassBuildingTest.java b/test/jdk/jdk/classfile/ClassBuildingTest.java index f774ac97608a..cd8b591059a5 100644 --- a/test/jdk/jdk/classfile/ClassBuildingTest.java +++ b/test/jdk/jdk/classfile/ClassBuildingTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/classfile/ClassHierarchyInfoTest.java b/test/jdk/jdk/classfile/ClassHierarchyInfoTest.java index 1cd69ccc541d..a86c65a30faf 100644 --- a/test/jdk/jdk/classfile/ClassHierarchyInfoTest.java +++ b/test/jdk/jdk/classfile/ClassHierarchyInfoTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/classfile/ClassPrinterTest.java b/test/jdk/jdk/classfile/ClassPrinterTest.java index 9b4491d11be4..e2199afcec1e 100644 --- a/test/jdk/jdk/classfile/ClassPrinterTest.java +++ b/test/jdk/jdk/classfile/ClassPrinterTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/classfile/ConstantPoolCopyTest.java b/test/jdk/jdk/classfile/ConstantPoolCopyTest.java index ffb75d5b7a00..ac2baa2f4259 100644 --- a/test/jdk/jdk/classfile/ConstantPoolCopyTest.java +++ b/test/jdk/jdk/classfile/ConstantPoolCopyTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/classfile/CorpusTest.java b/test/jdk/jdk/classfile/CorpusTest.java index 422d9bd658ee..35b450d18ad4 100644 --- a/test/jdk/jdk/classfile/CorpusTest.java +++ b/test/jdk/jdk/classfile/CorpusTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/classfile/DiscontinuedInstructionsTest.java b/test/jdk/jdk/classfile/DiscontinuedInstructionsTest.java index 16fce074a41b..227656a449be 100644 --- a/test/jdk/jdk/classfile/DiscontinuedInstructionsTest.java +++ b/test/jdk/jdk/classfile/DiscontinuedInstructionsTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/classfile/FilterDeadLabelsTest.java b/test/jdk/jdk/classfile/FilterDeadLabelsTest.java index 1608f532ae41..d9fe6210e821 100644 --- a/test/jdk/jdk/classfile/FilterDeadLabelsTest.java +++ b/test/jdk/jdk/classfile/FilterDeadLabelsTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/classfile/LDCTest.java b/test/jdk/jdk/classfile/LDCTest.java index 482f677fdfef..dc8d513250ea 100644 --- a/test/jdk/jdk/classfile/LDCTest.java +++ b/test/jdk/jdk/classfile/LDCTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/classfile/LimitsTest.java b/test/jdk/jdk/classfile/LimitsTest.java index 83b4c37cc568..43795aa57873 100644 --- a/test/jdk/jdk/classfile/LimitsTest.java +++ b/test/jdk/jdk/classfile/LimitsTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/classfile/LowAdaptTest.java b/test/jdk/jdk/classfile/LowAdaptTest.java index a50514789f0f..8253b0f4e2dd 100644 --- a/test/jdk/jdk/classfile/LowAdaptTest.java +++ b/test/jdk/jdk/classfile/LowAdaptTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/classfile/LowJCovAttributeTest.java b/test/jdk/jdk/classfile/LowJCovAttributeTest.java index 7767d9459206..c0f441ab7591 100644 --- a/test/jdk/jdk/classfile/LowJCovAttributeTest.java +++ b/test/jdk/jdk/classfile/LowJCovAttributeTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/classfile/LowModuleTest.java b/test/jdk/jdk/classfile/LowModuleTest.java index 5886ada824c5..839646368a1e 100644 --- a/test/jdk/jdk/classfile/LowModuleTest.java +++ b/test/jdk/jdk/classfile/LowModuleTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/classfile/LvtTest.java b/test/jdk/jdk/classfile/LvtTest.java index 41231c6434ef..cb23d5d2f645 100644 --- a/test/jdk/jdk/classfile/LvtTest.java +++ b/test/jdk/jdk/classfile/LvtTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/classfile/MassAdaptCopyCodeTest.java b/test/jdk/jdk/classfile/MassAdaptCopyCodeTest.java index 9cbba5e9d89a..97a669bafe73 100644 --- a/test/jdk/jdk/classfile/MassAdaptCopyCodeTest.java +++ b/test/jdk/jdk/classfile/MassAdaptCopyCodeTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/classfile/MassAdaptCopyPrimitiveMatchCodeTest.java b/test/jdk/jdk/classfile/MassAdaptCopyPrimitiveMatchCodeTest.java index d43a79cbf64a..97aa7a54fd06 100644 --- a/test/jdk/jdk/classfile/MassAdaptCopyPrimitiveMatchCodeTest.java +++ b/test/jdk/jdk/classfile/MassAdaptCopyPrimitiveMatchCodeTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/classfile/ModuleBuilderTest.java b/test/jdk/jdk/classfile/ModuleBuilderTest.java index 03845db3221d..7d2fe1616844 100644 --- a/test/jdk/jdk/classfile/ModuleBuilderTest.java +++ b/test/jdk/jdk/classfile/ModuleBuilderTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/classfile/OneToOneTest.java b/test/jdk/jdk/classfile/OneToOneTest.java index 6e85b4046cbe..78aa29b4af16 100644 --- a/test/jdk/jdk/classfile/OneToOneTest.java +++ b/test/jdk/jdk/classfile/OneToOneTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/classfile/OpcodesValidationTest.java b/test/jdk/jdk/classfile/OpcodesValidationTest.java index 43e2ec630d59..2a38040abad9 100644 --- a/test/jdk/jdk/classfile/OpcodesValidationTest.java +++ b/test/jdk/jdk/classfile/OpcodesValidationTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/classfile/PrimitiveClassConstantTest.java b/test/jdk/jdk/classfile/PrimitiveClassConstantTest.java index f4e14c3da434..e399388c67fe 100644 --- a/test/jdk/jdk/classfile/PrimitiveClassConstantTest.java +++ b/test/jdk/jdk/classfile/PrimitiveClassConstantTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/classfile/ShortJumpsFixTest.java b/test/jdk/jdk/classfile/ShortJumpsFixTest.java index dedef7e13218..0b1144684035 100644 --- a/test/jdk/jdk/classfile/ShortJumpsFixTest.java +++ b/test/jdk/jdk/classfile/ShortJumpsFixTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/classfile/SignaturesTest.java b/test/jdk/jdk/classfile/SignaturesTest.java index 2827ce177c79..18174a931785 100644 --- a/test/jdk/jdk/classfile/SignaturesTest.java +++ b/test/jdk/jdk/classfile/SignaturesTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/classfile/StackMapsTest.java b/test/jdk/jdk/classfile/StackMapsTest.java index 0d5a4053085c..2f25d6523868 100644 --- a/test/jdk/jdk/classfile/StackMapsTest.java +++ b/test/jdk/jdk/classfile/StackMapsTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/classfile/StackTrackerTest.java b/test/jdk/jdk/classfile/StackTrackerTest.java index bfa2b033ff56..2bcef30df34e 100644 --- a/test/jdk/jdk/classfile/StackTrackerTest.java +++ b/test/jdk/jdk/classfile/StackTrackerTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/classfile/StreamedVsListTest.java b/test/jdk/jdk/classfile/StreamedVsListTest.java index 8b0148103797..9557b9f6015e 100644 --- a/test/jdk/jdk/classfile/StreamedVsListTest.java +++ b/test/jdk/jdk/classfile/StreamedVsListTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/classfile/TempConstantPoolBuilderTest.java b/test/jdk/jdk/classfile/TempConstantPoolBuilderTest.java index a1881932cbf3..baf3cdd9f72e 100644 --- a/test/jdk/jdk/classfile/TempConstantPoolBuilderTest.java +++ b/test/jdk/jdk/classfile/TempConstantPoolBuilderTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/classfile/TestRecordComponent.java b/test/jdk/jdk/classfile/TestRecordComponent.java index 4aeb4f65b4c4..c96ab25ade9f 100644 --- a/test/jdk/jdk/classfile/TestRecordComponent.java +++ b/test/jdk/jdk/classfile/TestRecordComponent.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/classfile/TransformTests.java b/test/jdk/jdk/classfile/TransformTests.java index f4dce1425988..b3663eaa09b3 100644 --- a/test/jdk/jdk/classfile/TransformTests.java +++ b/test/jdk/jdk/classfile/TransformTests.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/classfile/Utf8EntryTest.java b/test/jdk/jdk/classfile/Utf8EntryTest.java index c13d27d39b27..7df90a7b6056 100644 --- a/test/jdk/jdk/classfile/Utf8EntryTest.java +++ b/test/jdk/jdk/classfile/Utf8EntryTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/classfile/UtilTest.java b/test/jdk/jdk/classfile/UtilTest.java index 2790213acfae..77b88a0043c3 100644 --- a/test/jdk/jdk/classfile/UtilTest.java +++ b/test/jdk/jdk/classfile/UtilTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/classfile/VerifierSelfTest.java b/test/jdk/jdk/classfile/VerifierSelfTest.java index 2bfaae3c99a9..6a85d645ba80 100644 --- a/test/jdk/jdk/classfile/VerifierSelfTest.java +++ b/test/jdk/jdk/classfile/VerifierSelfTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/classfile/WriteTest.java b/test/jdk/jdk/classfile/WriteTest.java index 6402c3d3775c..df2b87db7c96 100644 --- a/test/jdk/jdk/classfile/WriteTest.java +++ b/test/jdk/jdk/classfile/WriteTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/classfile/examples/AnnotationsExamples.java b/test/jdk/jdk/classfile/examples/AnnotationsExamples.java index e371d559f508..eb0ed3a38a16 100644 --- a/test/jdk/jdk/classfile/examples/AnnotationsExamples.java +++ b/test/jdk/jdk/classfile/examples/AnnotationsExamples.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/classfile/examples/ExampleGallery.java b/test/jdk/jdk/classfile/examples/ExampleGallery.java index 4975fe064c58..37d6fcf4e481 100644 --- a/test/jdk/jdk/classfile/examples/ExampleGallery.java +++ b/test/jdk/jdk/classfile/examples/ExampleGallery.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/classfile/examples/ExperimentalTransformExamples.java b/test/jdk/jdk/classfile/examples/ExperimentalTransformExamples.java index c26e8622b26e..edd87971d089 100644 --- a/test/jdk/jdk/classfile/examples/ExperimentalTransformExamples.java +++ b/test/jdk/jdk/classfile/examples/ExperimentalTransformExamples.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/classfile/examples/ModuleExamples.java b/test/jdk/jdk/classfile/examples/ModuleExamples.java index 8b97b7f87706..28fbd59ad748 100644 --- a/test/jdk/jdk/classfile/examples/ModuleExamples.java +++ b/test/jdk/jdk/classfile/examples/ModuleExamples.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/classfile/examples/TransformExamples.java b/test/jdk/jdk/classfile/examples/TransformExamples.java index d944955b70b2..08523ba435c2 100644 --- a/test/jdk/jdk/classfile/examples/TransformExamples.java +++ b/test/jdk/jdk/classfile/examples/TransformExamples.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/classfile/helpers/ByteArrayClassLoader.java b/test/jdk/jdk/classfile/helpers/ByteArrayClassLoader.java index cbd311783cc4..9a776757eb83 100644 --- a/test/jdk/jdk/classfile/helpers/ByteArrayClassLoader.java +++ b/test/jdk/jdk/classfile/helpers/ByteArrayClassLoader.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/classfile/helpers/ClassRecord.java b/test/jdk/jdk/classfile/helpers/ClassRecord.java index 834bdaad2345..bbf8fff049bb 100644 --- a/test/jdk/jdk/classfile/helpers/ClassRecord.java +++ b/test/jdk/jdk/classfile/helpers/ClassRecord.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/classfile/helpers/InstructionModelToCodeBuilder.java b/test/jdk/jdk/classfile/helpers/InstructionModelToCodeBuilder.java index b75b4c39d059..7432462bbbd6 100644 --- a/test/jdk/jdk/classfile/helpers/InstructionModelToCodeBuilder.java +++ b/test/jdk/jdk/classfile/helpers/InstructionModelToCodeBuilder.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/classfile/helpers/RebuildingTransformation.java b/test/jdk/jdk/classfile/helpers/RebuildingTransformation.java index 0c21d17b9c91..d2d16beb3c63 100644 --- a/test/jdk/jdk/classfile/helpers/RebuildingTransformation.java +++ b/test/jdk/jdk/classfile/helpers/RebuildingTransformation.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/classfile/helpers/TestConstants.java b/test/jdk/jdk/classfile/helpers/TestConstants.java index a726607033af..5bdf4c36f32e 100644 --- a/test/jdk/jdk/classfile/helpers/TestConstants.java +++ b/test/jdk/jdk/classfile/helpers/TestConstants.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/classfile/helpers/TestUtil.java b/test/jdk/jdk/classfile/helpers/TestUtil.java index f690a72f6d4a..a3e450d88924 100644 --- a/test/jdk/jdk/classfile/helpers/TestUtil.java +++ b/test/jdk/jdk/classfile/helpers/TestUtil.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/classfile/helpers/Transforms.java b/test/jdk/jdk/classfile/helpers/Transforms.java index 7dc043acdd8b..943907492f4a 100644 --- a/test/jdk/jdk/classfile/helpers/Transforms.java +++ b/test/jdk/jdk/classfile/helpers/Transforms.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/classfile/testdata/Lvt.java b/test/jdk/jdk/classfile/testdata/Lvt.java index 35a0637a5e83..d9252ab042d8 100644 --- a/test/jdk/jdk/classfile/testdata/Lvt.java +++ b/test/jdk/jdk/classfile/testdata/Lvt.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/classfile/testdata/Pattern1.java b/test/jdk/jdk/classfile/testdata/Pattern1.java index 80bb479d2eb9..190c0162c573 100644 --- a/test/jdk/jdk/classfile/testdata/Pattern1.java +++ b/test/jdk/jdk/classfile/testdata/Pattern1.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/classfile/testdata/Pattern10.java b/test/jdk/jdk/classfile/testdata/Pattern10.java index ffec7324abda..9634d151cb5c 100644 --- a/test/jdk/jdk/classfile/testdata/Pattern10.java +++ b/test/jdk/jdk/classfile/testdata/Pattern10.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/classfile/testdata/Pattern2.java b/test/jdk/jdk/classfile/testdata/Pattern2.java index 3b227c403204..dde252814902 100644 --- a/test/jdk/jdk/classfile/testdata/Pattern2.java +++ b/test/jdk/jdk/classfile/testdata/Pattern2.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/classfile/testdata/Pattern3.java b/test/jdk/jdk/classfile/testdata/Pattern3.java index d99329e9b727..2b98b628a2a2 100644 --- a/test/jdk/jdk/classfile/testdata/Pattern3.java +++ b/test/jdk/jdk/classfile/testdata/Pattern3.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/classfile/testdata/Pattern4.java b/test/jdk/jdk/classfile/testdata/Pattern4.java index 2d5aa7d22bba..e624b924a0af 100644 --- a/test/jdk/jdk/classfile/testdata/Pattern4.java +++ b/test/jdk/jdk/classfile/testdata/Pattern4.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/classfile/testdata/Pattern5.java b/test/jdk/jdk/classfile/testdata/Pattern5.java index 967d8e11a06e..69a64e82a6f1 100644 --- a/test/jdk/jdk/classfile/testdata/Pattern5.java +++ b/test/jdk/jdk/classfile/testdata/Pattern5.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/classfile/testdata/Pattern6.java b/test/jdk/jdk/classfile/testdata/Pattern6.java index 723c1ae5cc10..5ec1b0f00fea 100644 --- a/test/jdk/jdk/classfile/testdata/Pattern6.java +++ b/test/jdk/jdk/classfile/testdata/Pattern6.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/classfile/testdata/Pattern7.java b/test/jdk/jdk/classfile/testdata/Pattern7.java index 30f6c1860282..d04fc357b3a8 100644 --- a/test/jdk/jdk/classfile/testdata/Pattern7.java +++ b/test/jdk/jdk/classfile/testdata/Pattern7.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/classfile/testdata/Pattern8.java b/test/jdk/jdk/classfile/testdata/Pattern8.java index 158f00a09c6c..20dcca87d012 100644 --- a/test/jdk/jdk/classfile/testdata/Pattern8.java +++ b/test/jdk/jdk/classfile/testdata/Pattern8.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/classfile/testdata/Pattern9.java b/test/jdk/jdk/classfile/testdata/Pattern9.java index 70dfd348bcb1..5125bb631982 100644 --- a/test/jdk/jdk/classfile/testdata/Pattern9.java +++ b/test/jdk/jdk/classfile/testdata/Pattern9.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/classfile/testdata/TypeAnnotationPattern.java b/test/jdk/jdk/classfile/testdata/TypeAnnotationPattern.java index 7a839045b0fd..1250f78e0f8b 100644 --- a/test/jdk/jdk/classfile/testdata/TypeAnnotationPattern.java +++ b/test/jdk/jdk/classfile/testdata/TypeAnnotationPattern.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/dynalink/BeanLinkerTest.java b/test/jdk/jdk/dynalink/BeanLinkerTest.java index fafc1be447f9..0097902b2983 100644 --- a/test/jdk/jdk/dynalink/BeanLinkerTest.java +++ b/test/jdk/jdk/dynalink/BeanLinkerTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/dynalink/BeansLinkerTest.java b/test/jdk/jdk/dynalink/BeansLinkerTest.java index 474bfa60d197..95c8619203d6 100644 --- a/test/jdk/jdk/dynalink/BeansLinkerTest.java +++ b/test/jdk/jdk/dynalink/BeansLinkerTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/dynalink/CallSiteTest.java b/test/jdk/jdk/dynalink/CallSiteTest.java index f31adbd5a949..8d6d8b5016e2 100644 --- a/test/jdk/jdk/dynalink/CallSiteTest.java +++ b/test/jdk/jdk/dynalink/CallSiteTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/dynalink/CallerSensitiveTest.java b/test/jdk/jdk/dynalink/CallerSensitiveTest.java index c196abebc04c..4446509cbe43 100644 --- a/test/jdk/jdk/dynalink/CallerSensitiveTest.java +++ b/test/jdk/jdk/dynalink/CallerSensitiveTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/dynalink/ClassLoaderAware.java b/test/jdk/jdk/dynalink/ClassLoaderAware.java index d9c65b7c6ee2..6bac6dffc89e 100644 --- a/test/jdk/jdk/dynalink/ClassLoaderAware.java +++ b/test/jdk/jdk/dynalink/ClassLoaderAware.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/dynalink/LinkedCallSiteLocationTest.java b/test/jdk/jdk/dynalink/LinkedCallSiteLocationTest.java index a9533dac58db..baa1d089057a 100644 --- a/test/jdk/jdk/dynalink/LinkedCallSiteLocationTest.java +++ b/test/jdk/jdk/dynalink/LinkedCallSiteLocationTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/dynalink/LookupTest.java b/test/jdk/jdk/dynalink/LookupTest.java index 405937ec4309..b1cc39c87158 100644 --- a/test/jdk/jdk/dynalink/LookupTest.java +++ b/test/jdk/jdk/dynalink/LookupTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/dynalink/TestGuardingDynamicLinkerExporter.java b/test/jdk/jdk/dynalink/TestGuardingDynamicLinkerExporter.java index 4595db7ba520..6e981b86962d 100644 --- a/test/jdk/jdk/dynalink/TestGuardingDynamicLinkerExporter.java +++ b/test/jdk/jdk/dynalink/TestGuardingDynamicLinkerExporter.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/dynalink/TrustedDynamicLinkerFactoryTest.java b/test/jdk/jdk/dynalink/TrustedDynamicLinkerFactoryTest.java index 560c307b1ce6..adf6bdc8a3b4 100644 --- a/test/jdk/jdk/dynalink/TrustedDynamicLinkerFactoryTest.java +++ b/test/jdk/jdk/dynalink/TrustedDynamicLinkerFactoryTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/dynalink/UntrustedDynamicLinkerFactoryTest.java b/test/jdk/jdk/dynalink/UntrustedDynamicLinkerFactoryTest.java index 866aacbf6cb7..890fa906a956 100644 --- a/test/jdk/jdk/dynalink/UntrustedDynamicLinkerFactoryTest.java +++ b/test/jdk/jdk/dynalink/UntrustedDynamicLinkerFactoryTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/incubator/vector/LoadJsvmlTest.java b/test/jdk/jdk/incubator/vector/LoadJsvmlTest.java index e6e613bbc90b..f654b179e616 100644 --- a/test/jdk/jdk/incubator/vector/LoadJsvmlTest.java +++ b/test/jdk/jdk/incubator/vector/LoadJsvmlTest.java @@ -29,6 +29,7 @@ * @requires vm.compiler2.enabled * @requires os.arch == "x86_64" | os.arch == "amd64" * @requires os.family == "linux" | os.family == "windows" + * @requires vm.flagless * @library /test/lib * @run main LoadJsvmlTest */ diff --git a/test/jdk/jdk/incubator/vector/clean.sh b/test/jdk/jdk/incubator/vector/clean.sh index 7c177d800164..6b2d6f5e0ea3 100644 --- a/test/jdk/jdk/incubator/vector/clean.sh +++ b/test/jdk/jdk/incubator/vector/clean.sh @@ -5,9 +5,7 @@ # # 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. +# 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 diff --git a/test/jdk/jdk/incubator/vector/config.sh b/test/jdk/jdk/incubator/vector/config.sh index 15bfe647c3a4..19551b4d8809 100644 --- a/test/jdk/jdk/incubator/vector/config.sh +++ b/test/jdk/jdk/incubator/vector/config.sh @@ -5,9 +5,7 @@ # # 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. +# 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 diff --git a/test/jdk/jdk/incubator/vector/gen-template.sh b/test/jdk/jdk/incubator/vector/gen-template.sh index 8a009bb9fb93..5a7167c0b31c 100644 --- a/test/jdk/jdk/incubator/vector/gen-template.sh +++ b/test/jdk/jdk/incubator/vector/gen-template.sh @@ -5,9 +5,7 @@ # # 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. +# 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 diff --git a/test/jdk/jdk/incubator/vector/gen-tests.sh b/test/jdk/jdk/incubator/vector/gen-tests.sh index 583ab0c01106..8b87d9d9efb2 100644 --- a/test/jdk/jdk/incubator/vector/gen-tests.sh +++ b/test/jdk/jdk/incubator/vector/gen-tests.sh @@ -5,9 +5,7 @@ # # 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. +# 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 diff --git a/test/jdk/jdk/internal/math/ToDecimal/MathUtilsTest.java b/test/jdk/jdk/internal/math/ToDecimal/MathUtilsTest.java index 044df7a025df..ebd24404dc0c 100644 --- a/test/jdk/jdk/internal/math/ToDecimal/MathUtilsTest.java +++ b/test/jdk/jdk/internal/math/ToDecimal/MathUtilsTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/jfr/event/compiler/TestCodeCacheFull.java b/test/jdk/jdk/jfr/event/compiler/TestCodeCacheFull.java index 70cdb7c31da0..13a473100c86 100644 --- a/test/jdk/jdk/jfr/event/compiler/TestCodeCacheFull.java +++ b/test/jdk/jdk/jfr/event/compiler/TestCodeCacheFull.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2025, 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 @@ -36,6 +36,7 @@ /** * @test TestCodeCacheFull * @requires vm.hasJFR + * @requires vm.opt.UseCodeCacheFlushing == null | vm.opt.UseCodeCacheFlushing == true * * @library /test/lib * @modules jdk.jfr diff --git a/test/jdk/jdk/jfr/event/gc/collection/TestSystemGC.java b/test/jdk/jdk/jfr/event/gc/collection/TestSystemGC.java index 05b6aa45b8c3..f5ddb5f34c38 100644 --- a/test/jdk/jdk/jfr/event/gc/collection/TestSystemGC.java +++ b/test/jdk/jdk/jfr/event/gc/collection/TestSystemGC.java @@ -4,9 +4,7 @@ * * 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. + * 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 @@ -68,12 +66,12 @@ public static void main(String[] args) throws Exception { RecordedEvent event2 = events.get(1); Events.assertFrame(event2, Runtime.class, "gc"); Events.assertEventThread(event2, Thread.currentThread()); - Events.assertField(event1, "invokedConcurrent").isEqual(concurrent); + Events.assertField(event2, "invokedConcurrent").isEqual(concurrent); RecordedEvent event3 = events.get(2); // MemoryMXBean.class is an interface so can't assertFrame on it Events.assertEventThread(event3, Thread.currentThread()); - Events.assertField(event1, "invokedConcurrent").isEqual(concurrent); + Events.assertField(event3, "invokedConcurrent").isEqual(concurrent); } } } diff --git a/test/jdk/jdk/jfr/event/gc/collection/gc-testsettings.jfc b/test/jdk/jdk/jfr/event/gc/collection/gc-testsettings.jfc index cfe73edca958..589efd807d1d 100644 --- a/test/jdk/jdk/jfr/event/gc/collection/gc-testsettings.jfc +++ b/test/jdk/jdk/jfr/event/gc/collection/gc-testsettings.jfc @@ -5,9 +5,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/jfr/event/gc/detailed/concurrentmodefailure-testsettings.jfc b/test/jdk/jdk/jfr/event/gc/detailed/concurrentmodefailure-testsettings.jfc index e8ae59b4b4dd..c7a5f1922888 100644 --- a/test/jdk/jdk/jfr/event/gc/detailed/concurrentmodefailure-testsettings.jfc +++ b/test/jdk/jdk/jfr/event/gc/detailed/concurrentmodefailure-testsettings.jfc @@ -5,9 +5,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/jfr/event/gc/detailed/promotionfailed-testsettings.jfc b/test/jdk/jdk/jfr/event/gc/detailed/promotionfailed-testsettings.jfc index 1404e4d2cbed..5574c85c9b8e 100644 --- a/test/jdk/jdk/jfr/event/gc/detailed/promotionfailed-testsettings.jfc +++ b/test/jdk/jdk/jfr/event/gc/detailed/promotionfailed-testsettings.jfc @@ -5,9 +5,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/jfr/jvm/E.java b/test/jdk/jdk/jfr/jvm/E.java index 1981cd65eec1..eea6272cccb7 100644 --- a/test/jdk/jdk/jfr/jvm/E.java +++ b/test/jdk/jdk/jfr/jvm/E.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/jdk/jfr/startupargs/TestMemoryOptions.java b/test/jdk/jdk/jfr/startupargs/TestMemoryOptions.java index 9c90d04691ab..00424760c942 100644 --- a/test/jdk/jdk/jfr/startupargs/TestMemoryOptions.java +++ b/test/jdk/jdk/jfr/startupargs/TestMemoryOptions.java @@ -485,6 +485,7 @@ private static void launchTestVM(TestCase tc) throws Exception { if (flightRecorderOptions != null) { pb = ProcessTools.createTestJavaProcessBuilder("--add-exports=jdk.jfr/jdk.jfr.internal=ALL-UNNAMED", "--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED", + "-Xmx256m", flightRecorderOptions, "-XX:StartFlightRecording", SUT.class.getName(), @@ -493,6 +494,7 @@ private static void launchTestVM(TestCase tc) throws Exception { // default, no FlightRecorderOptions passed pb = ProcessTools.createTestJavaProcessBuilder("--add-exports=jdk.jfr/jdk.jfr.internal=ALL-UNNAMED", "--add-exports=java.base/jdk.internal.misc=ALL-UNNAMED", + "-Xmx256m", "-XX:StartFlightRecording", SUT.class.getName(), tc.getTestName()); diff --git a/test/jdk/jni/nullCaller/CallHelper.hpp b/test/jdk/jni/nullCaller/CallHelper.hpp index 1e8772bda096..40b3917966c3 100644 --- a/test/jdk/jni/nullCaller/CallHelper.hpp +++ b/test/jdk/jni/nullCaller/CallHelper.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, 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 @@ -37,9 +37,9 @@ class CallHelper { public: CallHelper(JNIEnv* e, const std::string& cname, const std::string& mname, const std::string& sig) : - classname(cname), method(mname), signature(sig), m(NULL), env(e) { + classname(cname), method(mname), signature(sig), m(nullptr), env(e) { c = env->FindClass(classname.c_str()); - assert (c != NULL); + assert (c != nullptr); } protected: @@ -53,7 +53,7 @@ class CallHelper { // check the given object which is expected to be null void checkReturnNull(jobject obj) { - if (obj != NULL) { + if (obj != nullptr) { emitErrorMessage("Null return expected"); ::exit(-1); } @@ -61,7 +61,7 @@ class CallHelper { // check the given object which is expected to NOT be null void checkReturnNotNull(jobject obj) { - if (obj == NULL) { + if (obj == nullptr) { emitErrorMessage("Non-Null return expected"); ::exit(-1); } @@ -69,7 +69,7 @@ class CallHelper { // check if any unexpected exceptions were thrown void checkException() { - if (env->ExceptionOccurred() != NULL) { + if (env->ExceptionOccurred() != nullptr) { emitErrorMessage("Exception was thrown"); env->ExceptionDescribe(); ::exit(-1); @@ -79,7 +79,7 @@ class CallHelper { // check if an expected exception was thrown void checkExpectedExceptionThrown(const std::string& exception) { jclass expected = env->FindClass(exception.c_str()); - assert(expected != NULL); + assert(expected != nullptr); jthrowable t = env->ExceptionOccurred(); if (env->IsInstanceOf(t, expected) == JNI_FALSE) { emitErrorMessage("Didn't get the expected " + exception); @@ -106,7 +106,7 @@ class InstanceCall : public CallHelper { : CallHelper(e, cname, mname, sig) { m = env->GetMethodID(c, method.c_str(), signature.c_str()); - assert(m != NULL); + assert(m != nullptr); } // call on the given object, checking for exceptions and that the return is not null @@ -168,7 +168,7 @@ class StaticCall : public CallHelper { : CallHelper(e, cname, mname, sig) { m = env->GetStaticMethodID(c, method.c_str(), signature.c_str()); - assert(m != NULL); + assert(m != nullptr); } // call a method returning an object checking for exceptions and diff --git a/test/jdk/jni/nullCaller/exeNullCallerTest.cpp b/test/jdk/jni/nullCaller/exeNullCallerTest.cpp index 260a1edb9b4c..db4e300eeb49 100644 --- a/test/jdk/jni/nullCaller/exeNullCallerTest.cpp +++ b/test/jdk/jni/nullCaller/exeNullCallerTest.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -131,9 +131,9 @@ void getResourceAsStream(JNIEnv *env) { // fetch the open and closed classes jclass class_OpenResources = env->FindClass("open/OpenResources"); - assert(class_OpenResources != NULL); + assert(class_OpenResources != nullptr); jclass class_ClosedResources = env->FindClass("closed/ClosedResources"); - assert(class_ClosedResources != NULL); + assert(class_ClosedResources != nullptr); // Fetch the Module from one of the classes in the module jobject n = m_Class_getModule.callReturnNotNull(class_OpenResources); @@ -202,7 +202,7 @@ int main(int argc, char *argv[]) { fprintf(stderr, "Error: pthread_create failed with error code %d \n", result); return -1; } - pthread_join(id, NULL); + pthread_join(id, nullptr); #else run(&argv); #endif //AIX diff --git a/test/jdk/lib/client/ExtendedRobot.java b/test/jdk/lib/client/ExtendedRobot.java index 778cd9e6cd3c..2a39017231c1 100644 --- a/test/jdk/lib/client/ExtendedRobot.java +++ b/test/jdk/lib/client/ExtendedRobot.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/lib/testlibrary/bootlib/java.base/java/util/stream/DefaultMethodStreams.java b/test/jdk/lib/testlibrary/bootlib/java.base/java/util/stream/DefaultMethodStreams.java index 8ff48472ff9e..d16603e9cf8b 100644 --- a/test/jdk/lib/testlibrary/bootlib/java.base/java/util/stream/DefaultMethodStreams.java +++ b/test/jdk/lib/testlibrary/bootlib/java.base/java/util/stream/DefaultMethodStreams.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/Action.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/Action.java index a092d342ce68..1d5c359b533b 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/Action.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/Action.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/ActionProducer.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/ActionProducer.java index 907d264e740a..4af9d0d88c49 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/ActionProducer.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/ActionProducer.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/Bundle.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/Bundle.java index 5a0b1699c741..19a15024c92a 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/Bundle.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/Bundle.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/BundleManager.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/BundleManager.java index dcfc408cd64e..308f5b36ddbd 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/BundleManager.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/BundleManager.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/CharBindingMap.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/CharBindingMap.java index 145aa192d883..6b6c51ef93b4 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/CharBindingMap.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/CharBindingMap.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/ClassReference.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/ClassReference.java index 282e2647668c..fb3f7b07c281 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/ClassReference.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/ClassReference.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/ComponentChooser.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/ComponentChooser.java index 445810fdbb9d..1c6802faa0c5 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/ComponentChooser.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/ComponentChooser.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/ComponentIsNotFocusedException.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/ComponentIsNotFocusedException.java index 6a5a2fedcf72..de6dc9a37dd9 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/ComponentIsNotFocusedException.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/ComponentIsNotFocusedException.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/ComponentIsNotVisibleException.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/ComponentIsNotVisibleException.java index 38c33b725fe4..e4212c3cdd1c 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/ComponentIsNotVisibleException.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/ComponentIsNotVisibleException.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/ComponentSearcher.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/ComponentSearcher.java index a41553dd2fa0..b03e24ccb31b 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/ComponentSearcher.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/ComponentSearcher.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/DefaultCharBindingMap.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/DefaultCharBindingMap.java index 3e2e7918d4d2..36c9ca498806 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/DefaultCharBindingMap.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/DefaultCharBindingMap.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/DialogWaiter.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/DialogWaiter.java index ed03083702d6..2817d60decb8 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/DialogWaiter.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/DialogWaiter.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/EventDispatcher.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/EventDispatcher.java index a8545df6ea09..65fef2552dbe 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/EventDispatcher.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/EventDispatcher.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/EventTool.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/EventTool.java index 790c366d1cf7..5cd2e4d2b1ad 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/EventTool.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/EventTool.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/FrameWaiter.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/FrameWaiter.java index 00080a3e69ae..3ca7c5408cd4 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/FrameWaiter.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/FrameWaiter.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/JemmyException.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/JemmyException.java index 7f0afc2a86b6..a704af0cfea2 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/JemmyException.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/JemmyException.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/JemmyInputException.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/JemmyInputException.java index 13ef9036cc75..f38fed9a9a0a 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/JemmyInputException.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/JemmyInputException.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/JemmyProperties.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/JemmyProperties.java index ef69e6e1c087..8d39e086a7dd 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/JemmyProperties.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/JemmyProperties.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/NoComponentUnderMouseException.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/NoComponentUnderMouseException.java index 58b439bf0cb1..4bc7b1c0005a 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/NoComponentUnderMouseException.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/NoComponentUnderMouseException.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/ObjectBrowser.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/ObjectBrowser.java index 17a68a555692..bf17fe8e361b 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/ObjectBrowser.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/ObjectBrowser.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/Outputable.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/Outputable.java index 8ab46b7bb32d..832b311921f8 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/Outputable.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/Outputable.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/QueueTool.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/QueueTool.java index df3a39ac6e15..dbb9d58f494c 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/QueueTool.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/QueueTool.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/Scenario.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/Scenario.java index 989090c0e086..216bd1c30c03 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/Scenario.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/Scenario.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/Test.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/Test.java index c1aa27810046..1cfa549ec0c4 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/Test.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/Test.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/TestCompletedException.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/TestCompletedException.java index e93ce81e5110..7cff80dd6692 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/TestCompletedException.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/TestCompletedException.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/TestOut.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/TestOut.java index 90da498fd72d..c3552c045e99 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/TestOut.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/TestOut.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/Timeout.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/Timeout.java index 1b9e4ddd66e5..ca47fde59165 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/Timeout.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/Timeout.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/TimeoutExpiredException.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/TimeoutExpiredException.java index 0c35a65442b3..90c6fca4f84e 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/TimeoutExpiredException.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/TimeoutExpiredException.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/Timeoutable.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/Timeoutable.java index e7f943c58f3a..a1c428cb4430 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/Timeoutable.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/Timeoutable.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/Timeouts.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/Timeouts.java index 7edb588b8bef..4b71d23bf5d0 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/Timeouts.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/Timeouts.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/Waitable.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/Waitable.java index 2b4533a3593f..e9dbabead5f0 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/Waitable.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/Waitable.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/Waiter.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/Waiter.java index ff222dfff2ce..9aaa68c0e426 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/Waiter.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/Waiter.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/WindowWaiter.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/WindowWaiter.java index 0e2c6866fd01..6d50378ba7ed 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/WindowWaiter.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/WindowWaiter.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/accessibility/AccessibilityChooser.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/accessibility/AccessibilityChooser.java index d281ee815fb8..2e9aa1e6330f 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/accessibility/AccessibilityChooser.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/accessibility/AccessibilityChooser.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/accessibility/AccessibleDescriptionChooser.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/accessibility/AccessibleDescriptionChooser.java index 820993677513..984637c339b2 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/accessibility/AccessibleDescriptionChooser.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/accessibility/AccessibleDescriptionChooser.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/accessibility/AccessibleNameChooser.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/accessibility/AccessibleNameChooser.java index 363a9be5a5bb..8a173e5d1d79 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/accessibility/AccessibleNameChooser.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/accessibility/AccessibleNameChooser.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/APIDriverInstaller.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/APIDriverInstaller.java index 08cf39298bc9..3d15e61089ca 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/APIDriverInstaller.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/APIDriverInstaller.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/ArrayDriverInstaller.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/ArrayDriverInstaller.java index d7bebdb420f0..fa57275eb7fc 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/ArrayDriverInstaller.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/ArrayDriverInstaller.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/ButtonDriver.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/ButtonDriver.java index 9eb6ebb71e69..befd9b1bc8a6 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/ButtonDriver.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/ButtonDriver.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/DefaultDriverInstaller.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/DefaultDriverInstaller.java index 0ae044b3fc2d..dff87470f86a 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/DefaultDriverInstaller.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/DefaultDriverInstaller.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/DescriptablePathChooser.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/DescriptablePathChooser.java index c3111e86cd49..8c6ddcea6a88 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/DescriptablePathChooser.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/DescriptablePathChooser.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/Driver.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/Driver.java index 2922dcf71c61..7ea0d174205c 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/Driver.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/Driver.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/DriverInstaller.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/DriverInstaller.java index e0a0659c17d8..af50e0257cc7 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/DriverInstaller.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/DriverInstaller.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/DriverManager.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/DriverManager.java index 20c27f120ebf..f38d836f81a4 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/DriverManager.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/DriverManager.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/EditorDriver.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/EditorDriver.java index abf0152dd59b..852790d5d496 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/EditorDriver.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/EditorDriver.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/FocusDriver.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/FocusDriver.java index f7e1904a8591..7f87905fb7ff 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/FocusDriver.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/FocusDriver.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/FrameDriver.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/FrameDriver.java index e28eb441dff0..d0123d6bfb58 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/FrameDriver.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/FrameDriver.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/InputDriverInstaller.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/InputDriverInstaller.java index 200e9fdfecc9..c42d8d0bb83d 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/InputDriverInstaller.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/InputDriverInstaller.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/InternalFrameDriver.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/InternalFrameDriver.java index 784d08245cad..cc297809e45c 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/InternalFrameDriver.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/InternalFrameDriver.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/KeyDriver.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/KeyDriver.java index d6b9a405e9c2..f006050efe79 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/KeyDriver.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/KeyDriver.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/LightDriver.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/LightDriver.java index e201c0b6b47b..9e39c72ae365 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/LightDriver.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/LightDriver.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/LightSupportiveDriver.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/LightSupportiveDriver.java index 46d31edbbc43..06c2d737de7a 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/LightSupportiveDriver.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/LightSupportiveDriver.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/ListDriver.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/ListDriver.java index 5da9c1a2a41d..609ee44765b9 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/ListDriver.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/ListDriver.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/MenuDriver.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/MenuDriver.java index be9a2ecc07dd..b006a9ab48bf 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/MenuDriver.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/MenuDriver.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/MouseDriver.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/MouseDriver.java index 5407292c3ef4..94738edac8a4 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/MouseDriver.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/MouseDriver.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/MultiSelListDriver.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/MultiSelListDriver.java index 0974ff5e46dd..eea518aa68ab 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/MultiSelListDriver.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/MultiSelListDriver.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/OrderedListDriver.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/OrderedListDriver.java index b51326db13ec..db80dfa2687b 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/OrderedListDriver.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/OrderedListDriver.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/PathChooser.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/PathChooser.java index 5c8c70d6a8c1..876457f835c6 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/PathChooser.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/PathChooser.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/ScrollDriver.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/ScrollDriver.java index d4494edd0c3f..dfbcf0572553 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/ScrollDriver.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/ScrollDriver.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/SupportiveDriver.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/SupportiveDriver.java index 21a37ddbd4cf..cc4ae68a1652 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/SupportiveDriver.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/SupportiveDriver.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/TableDriver.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/TableDriver.java index 6cb16855072d..5243666abdb5 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/TableDriver.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/TableDriver.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/TextDriver.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/TextDriver.java index 6de5485d3712..7866072fb758 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/TextDriver.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/TextDriver.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/TreeDriver.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/TreeDriver.java index ad10db5676d9..fdb90c27d48c 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/TreeDriver.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/TreeDriver.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/UnsupportedOperatorException.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/UnsupportedOperatorException.java index 50cb1672c344..31522d0ebd71 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/UnsupportedOperatorException.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/UnsupportedOperatorException.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/WindowDriver.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/WindowDriver.java index 10c4039d46d0..1f554c681278 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/WindowDriver.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/WindowDriver.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/buttons/ButtonMouseDriver.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/buttons/ButtonMouseDriver.java index e114c3ac4b63..e546665face4 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/buttons/ButtonMouseDriver.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/buttons/ButtonMouseDriver.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/buttons/package-info.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/buttons/package-info.java index 32022579ba5c..f937529f082d 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/buttons/package-info.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/buttons/package-info.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/focus/APIFocusDriver.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/focus/APIFocusDriver.java index 246f884f65f4..4f76f0731e17 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/focus/APIFocusDriver.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/focus/APIFocusDriver.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/focus/MouseFocusDriver.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/focus/MouseFocusDriver.java index ff0de6fb334d..4eb21fd704d6 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/focus/MouseFocusDriver.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/focus/MouseFocusDriver.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/focus/package-info.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/focus/package-info.java index ed1fb82f6f17..71f9b43be6a4 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/focus/package-info.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/focus/package-info.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/input/EventDriver.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/input/EventDriver.java index 0df11a229e0f..b88b6c0b5f48 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/input/EventDriver.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/input/EventDriver.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/input/KeyEventDriver.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/input/KeyEventDriver.java index a95b5a93bde4..ef6976f91061 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/input/KeyEventDriver.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/input/KeyEventDriver.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/input/KeyRobotDriver.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/input/KeyRobotDriver.java index 64e61e1ac731..63d75f4bd8e9 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/input/KeyRobotDriver.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/input/KeyRobotDriver.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/input/MouseEventDriver.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/input/MouseEventDriver.java index 013ccae79ddb..705239b35beb 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/input/MouseEventDriver.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/input/MouseEventDriver.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/input/MouseRobotDriver.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/input/MouseRobotDriver.java index 2abddec8d3c5..be466f8951d5 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/input/MouseRobotDriver.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/input/MouseRobotDriver.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/input/RobotDriver.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/input/RobotDriver.java index 9cd19834ae35..44d8638d76e9 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/input/RobotDriver.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/input/RobotDriver.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/input/package-info.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/input/package-info.java index 88d0a1e892d0..90d7263cdfb3 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/input/package-info.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/input/package-info.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/lists/ChoiceDriver.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/lists/ChoiceDriver.java index 99cd8ef33510..a6fa8217f52b 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/lists/ChoiceDriver.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/lists/ChoiceDriver.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/lists/JComboMouseDriver.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/lists/JComboMouseDriver.java index 721143c09ac1..8781721eae90 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/lists/JComboMouseDriver.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/lists/JComboMouseDriver.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/lists/JListMouseDriver.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/lists/JListMouseDriver.java index c7aeb314cfd3..be02eabffd6e 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/lists/JListMouseDriver.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/lists/JListMouseDriver.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/lists/JTabAPIDriver.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/lists/JTabAPIDriver.java index 91890b67143e..f9a9b1ba707e 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/lists/JTabAPIDriver.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/lists/JTabAPIDriver.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/lists/JTabMouseDriver.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/lists/JTabMouseDriver.java index 3c827d542660..9cb1f85d5963 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/lists/JTabMouseDriver.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/lists/JTabMouseDriver.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/lists/JTableHeaderDriver.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/lists/JTableHeaderDriver.java index 411a8dc6dfc9..e55dc8bf9c98 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/lists/JTableHeaderDriver.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/lists/JTableHeaderDriver.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/lists/ListAPIDriver.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/lists/ListAPIDriver.java index 0caf8b9dcfae..bf464cfc67d9 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/lists/ListAPIDriver.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/lists/ListAPIDriver.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/lists/ListKeyboardDriver.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/lists/ListKeyboardDriver.java index 90f9644734d1..927d62a570d5 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/lists/ListKeyboardDriver.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/lists/ListKeyboardDriver.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/lists/package-info.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/lists/package-info.java index 49bd27858a31..0187ea93b2ab 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/lists/package-info.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/lists/package-info.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/menus/APIJMenuDriver.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/menus/APIJMenuDriver.java index 3887ef7793f0..8df8776d61ee 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/menus/APIJMenuDriver.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/menus/APIJMenuDriver.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/menus/AppleMenuDriver.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/menus/AppleMenuDriver.java index 4a124e13d5f7..1d6fcdd88a21 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/menus/AppleMenuDriver.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/menus/AppleMenuDriver.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/menus/DefaultJMenuDriver.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/menus/DefaultJMenuDriver.java index 5cd41fe5d692..e4ef079ef601 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/menus/DefaultJMenuDriver.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/menus/DefaultJMenuDriver.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/menus/QueueJMenuDriver.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/menus/QueueJMenuDriver.java index f185af799a5a..d327fb6e67bd 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/menus/QueueJMenuDriver.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/menus/QueueJMenuDriver.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/menus/package-info.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/menus/package-info.java index 964d7764c6ec..071b87542c95 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/menus/package-info.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/menus/package-info.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/package-info.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/package-info.java index b6c2e8546f15..ab944add2b14 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/package-info.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/package-info.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/scrolling/AWTScrollDriver.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/scrolling/AWTScrollDriver.java index 6db23d49e3f9..3f8f254f8dda 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/scrolling/AWTScrollDriver.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/scrolling/AWTScrollDriver.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/scrolling/AbstractScrollDriver.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/scrolling/AbstractScrollDriver.java index 8666ab5eb3c4..e029fadf283b 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/scrolling/AbstractScrollDriver.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/scrolling/AbstractScrollDriver.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/scrolling/JScrollBarAPIDriver.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/scrolling/JScrollBarAPIDriver.java index b209dc84017d..c50f6f5832ad 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/scrolling/JScrollBarAPIDriver.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/scrolling/JScrollBarAPIDriver.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/scrolling/JScrollBarDriver.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/scrolling/JScrollBarDriver.java index 8dcf587a2128..98e375950088 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/scrolling/JScrollBarDriver.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/scrolling/JScrollBarDriver.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/scrolling/JSliderAPIDriver.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/scrolling/JSliderAPIDriver.java index 210fa0059f6b..9fbff80ce3e9 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/scrolling/JSliderAPIDriver.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/scrolling/JSliderAPIDriver.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/scrolling/JSliderDriver.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/scrolling/JSliderDriver.java index 9cdb8b5a58df..692f5fbbdd6e 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/scrolling/JSliderDriver.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/scrolling/JSliderDriver.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/scrolling/JSpinnerDriver.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/scrolling/JSpinnerDriver.java index b2755675da91..9c7389d01002 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/scrolling/JSpinnerDriver.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/scrolling/JSpinnerDriver.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/scrolling/JSplitPaneDriver.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/scrolling/JSplitPaneDriver.java index 4b9caa1b7216..cc21e09bb5d4 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/scrolling/JSplitPaneDriver.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/scrolling/JSplitPaneDriver.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/scrolling/KeyboardJSliderScrollDriver.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/scrolling/KeyboardJSliderScrollDriver.java index 9ae9340a4c6e..12522ee74c0b 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/scrolling/KeyboardJSliderScrollDriver.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/scrolling/KeyboardJSliderScrollDriver.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/scrolling/ScrollAdjuster.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/scrolling/ScrollAdjuster.java index a184d7bd63d2..852b43515ef9 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/scrolling/ScrollAdjuster.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/scrolling/ScrollAdjuster.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/scrolling/ScrollPaneDriver.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/scrolling/ScrollPaneDriver.java index dd758e1ad752..505157bf5fbb 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/scrolling/ScrollPaneDriver.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/scrolling/ScrollPaneDriver.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/scrolling/ScrollbarDriver.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/scrolling/ScrollbarDriver.java index c11668f0f71b..8d831302c0b9 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/scrolling/ScrollbarDriver.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/scrolling/ScrollbarDriver.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/scrolling/package-info.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/scrolling/package-info.java index 414d8cdc1150..e3e930a658d8 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/scrolling/package-info.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/scrolling/package-info.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/tables/JTableMouseDriver.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/tables/JTableMouseDriver.java index 4fa9564e8ba2..cbf011393b1c 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/tables/JTableMouseDriver.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/tables/JTableMouseDriver.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/tables/package-info.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/tables/package-info.java index 62f7d050845a..6cbe4a1545a3 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/tables/package-info.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/tables/package-info.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/text/AWTTextAPIDriver.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/text/AWTTextAPIDriver.java index 64e727c669ad..2d87edde8515 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/text/AWTTextAPIDriver.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/text/AWTTextAPIDriver.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/text/AWTTextKeyboardDriver.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/text/AWTTextKeyboardDriver.java index 9caff0ec5f19..b2a84dbc4ca0 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/text/AWTTextKeyboardDriver.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/text/AWTTextKeyboardDriver.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/text/DownKey.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/text/DownKey.java index ebb6919d95f5..cfe40cb46620 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/text/DownKey.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/text/DownKey.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/text/EndKey.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/text/EndKey.java index 36d15f7e874e..9d7c8289cc73 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/text/EndKey.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/text/EndKey.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/text/GoAndBackKey.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/text/GoAndBackKey.java index f2ddfaa80e37..9de2fbf8904b 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/text/GoAndBackKey.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/text/GoAndBackKey.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/text/HomeKey.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/text/HomeKey.java index 0aa4f329ebed..e34cca5c2209 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/text/HomeKey.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/text/HomeKey.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/text/NavigationKey.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/text/NavigationKey.java index e1b3e910b1f8..d4bd137282ba 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/text/NavigationKey.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/text/NavigationKey.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/text/OffsetKey.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/text/OffsetKey.java index 9a8e3ec5487e..1c9a2ee2bc65 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/text/OffsetKey.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/text/OffsetKey.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/text/SwingTextAPIDriver.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/text/SwingTextAPIDriver.java index 5558f704a077..723121d0272b 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/text/SwingTextAPIDriver.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/text/SwingTextAPIDriver.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/text/SwingTextKeyboardDriver.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/text/SwingTextKeyboardDriver.java index bce36f8027f0..e3e71e37fcdd 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/text/SwingTextKeyboardDriver.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/text/SwingTextKeyboardDriver.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/text/TextAPIDriver.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/text/TextAPIDriver.java index 0d7f507a2e15..fdc626e45ab3 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/text/TextAPIDriver.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/text/TextAPIDriver.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/text/TextKeyboardDriver.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/text/TextKeyboardDriver.java index 48818cc7c2d1..d5121504c41d 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/text/TextKeyboardDriver.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/text/TextKeyboardDriver.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/text/UpKey.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/text/UpKey.java index 857e778d0c07..5bc5393bc255 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/text/UpKey.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/text/UpKey.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/text/package-info.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/text/package-info.java index c8fdc01ab4ac..ecf613098462 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/text/package-info.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/text/package-info.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/trees/JTreeAPIDriver.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/trees/JTreeAPIDriver.java index cb6954bb69d8..921d50985b06 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/trees/JTreeAPIDriver.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/trees/JTreeAPIDriver.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/trees/JTreeMouseDriver.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/trees/JTreeMouseDriver.java index d08258c6135e..a0368477ee52 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/trees/JTreeMouseDriver.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/trees/JTreeMouseDriver.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/trees/package-info.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/trees/package-info.java index 5359d257161c..64c6d8927859 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/trees/package-info.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/trees/package-info.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/windows/DefaultFrameDriver.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/windows/DefaultFrameDriver.java index 2560e7e0f4ed..01520509f1d5 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/windows/DefaultFrameDriver.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/windows/DefaultFrameDriver.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/windows/DefaultInternalFrameDriver.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/windows/DefaultInternalFrameDriver.java index 48b1dadd231d..27421ab9b4d5 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/windows/DefaultInternalFrameDriver.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/windows/DefaultInternalFrameDriver.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/windows/DefaultWindowDriver.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/windows/DefaultWindowDriver.java index 55c14eca16b2..238d053ba2be 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/windows/DefaultWindowDriver.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/windows/DefaultWindowDriver.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/windows/InternalFrameAPIDriver.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/windows/InternalFrameAPIDriver.java index ffb8855aedea..0cd47d62bb51 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/windows/InternalFrameAPIDriver.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/windows/InternalFrameAPIDriver.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/windows/InternalFramePopupMenuDriver.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/windows/InternalFramePopupMenuDriver.java index 8c8c7126c2c8..0b15b5302ae4 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/windows/InternalFramePopupMenuDriver.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/windows/InternalFramePopupMenuDriver.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/windows/package-info.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/windows/package-info.java index 49f436821289..0432f2e5e0e0 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/windows/package-info.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/drivers/windows/package-info.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/explorer/GUIBrowser.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/explorer/GUIBrowser.java index f90043f13fde..0166f7e97d73 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/explorer/GUIBrowser.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/explorer/GUIBrowser.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/explorer/TrialListenerManager.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/explorer/TrialListenerManager.java index 280d82035a22..3c50b405cb50 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/explorer/TrialListenerManager.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/explorer/TrialListenerManager.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/explorer/package-info.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/explorer/package-info.java index bceed9c0c5ce..aa05f9aff1dc 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/explorer/package-info.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/explorer/package-info.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/image/ColorImageComparator.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/image/ColorImageComparator.java index ff85c30741cd..1f4472cda4ea 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/image/ColorImageComparator.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/image/ColorImageComparator.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/image/FileImageComparator.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/image/FileImageComparator.java index 3a5904d69b29..9898a875d561 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/image/FileImageComparator.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/image/FileImageComparator.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/image/ImageComparator.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/image/ImageComparator.java index 1a3d7854eea8..f3fbde9eaab7 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/image/ImageComparator.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/image/ImageComparator.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/image/ImageFinder.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/image/ImageFinder.java index 7204385b5dca..9a2189945268 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/image/ImageFinder.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/image/ImageFinder.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/image/ImageLoader.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/image/ImageLoader.java index 1e115b7b9334..b3e4bab9408d 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/image/ImageLoader.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/image/ImageLoader.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/image/ImageSaver.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/image/ImageSaver.java index d78622d9a62c..07f45d4d9d1b 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/image/ImageSaver.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/image/ImageSaver.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/image/ImageTool.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/image/ImageTool.java index 0e53ff6ceb3e..cca418332b4b 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/image/ImageTool.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/image/ImageTool.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/image/PNGImageLoader.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/image/PNGImageLoader.java index 8425bf6b0737..935f90df8b35 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/image/PNGImageLoader.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/image/PNGImageLoader.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/image/PNGImageSaver.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/image/PNGImageSaver.java index 66f790960cc5..d2fae52470d1 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/image/PNGImageSaver.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/image/PNGImageSaver.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/image/RoughImageComparator.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/image/RoughImageComparator.java index a5e8be2424a2..cdf8ddd9ae52 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/image/RoughImageComparator.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/image/RoughImageComparator.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/image/RoughImageFinder.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/image/RoughImageFinder.java index 1cb9056bd998..6848fc825c3a 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/image/RoughImageFinder.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/image/RoughImageFinder.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/image/StrictImageComparator.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/image/StrictImageComparator.java index 3df8ee8b4281..dce51c568f7c 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/image/StrictImageComparator.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/image/StrictImageComparator.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/image/StrictImageFinder.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/image/StrictImageFinder.java index 5e6ecc16ac39..674e550c122a 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/image/StrictImageFinder.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/image/StrictImageFinder.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/image/package-info.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/image/package-info.java index bb7c14d462dd..f1987a4caf4b 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/image/package-info.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/image/package-info.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/AbstractButtonOperator.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/AbstractButtonOperator.java index 656458bfea08..577ce4fb95d2 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/AbstractButtonOperator.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/AbstractButtonOperator.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/ButtonOperator.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/ButtonOperator.java index 937784cfbbf5..e1af1f252a06 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/ButtonOperator.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/ButtonOperator.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/CheckboxOperator.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/CheckboxOperator.java index 0ebea0049a17..bdda5e636835 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/CheckboxOperator.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/CheckboxOperator.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/ChoiceOperator.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/ChoiceOperator.java index 6290f97c1cdd..0f22ac004419 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/ChoiceOperator.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/ChoiceOperator.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/ComponentOperator.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/ComponentOperator.java index 4575c4dbe981..2c70afc68796 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/ComponentOperator.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/ComponentOperator.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/ContainerOperator.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/ContainerOperator.java index b43904de6bef..37ea08f0695a 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/ContainerOperator.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/ContainerOperator.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/DialogOperator.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/DialogOperator.java index 08d608066b4d..a15ebc5356da 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/DialogOperator.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/DialogOperator.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/FrameOperator.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/FrameOperator.java index 4e3566d599d7..d1e3b4dd6541 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/FrameOperator.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/FrameOperator.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JButtonOperator.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JButtonOperator.java index 955a7a647448..5880960b4c45 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JButtonOperator.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JButtonOperator.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JCheckBoxMenuItemOperator.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JCheckBoxMenuItemOperator.java index 76b083d6bcd8..8331629e7925 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JCheckBoxMenuItemOperator.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JCheckBoxMenuItemOperator.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JCheckBoxOperator.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JCheckBoxOperator.java index 88bfe8bd8697..a4a641f32b03 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JCheckBoxOperator.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JCheckBoxOperator.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JColorChooserOperator.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JColorChooserOperator.java index 1f1597869c2c..944cc720762f 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JColorChooserOperator.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JColorChooserOperator.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JComboBoxOperator.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JComboBoxOperator.java index 0606f1d71605..91a4eec633f7 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JComboBoxOperator.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JComboBoxOperator.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JComponentOperator.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JComponentOperator.java index 565f883dd283..076ca3c0db57 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JComponentOperator.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JComponentOperator.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JDialogOperator.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JDialogOperator.java index 2179023b0542..883369265ea4 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JDialogOperator.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JDialogOperator.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JEditorPaneOperator.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JEditorPaneOperator.java index c90289f1f792..e018c1f7ab5f 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JEditorPaneOperator.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JEditorPaneOperator.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JFileChooserOperator.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JFileChooserOperator.java index 21a9f63c8d10..dbf9640618c6 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JFileChooserOperator.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JFileChooserOperator.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JFrameOperator.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JFrameOperator.java index dc83b95b7ca5..02672f85785a 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JFrameOperator.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JFrameOperator.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JInternalFrameOperator.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JInternalFrameOperator.java index 2c632ad456bf..ece4d2ffd23b 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JInternalFrameOperator.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JInternalFrameOperator.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JLabelOperator.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JLabelOperator.java index f5567bfd1422..c3c0005c2e02 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JLabelOperator.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JLabelOperator.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JListOperator.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JListOperator.java index 97138980bcb3..e8184f8dd857 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JListOperator.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JListOperator.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JMenuBarOperator.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JMenuBarOperator.java index 4e26c82c029d..b1786c17d9d4 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JMenuBarOperator.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JMenuBarOperator.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JMenuItemOperator.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JMenuItemOperator.java index 2a406bfbcb95..69b3dd9b6aba 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JMenuItemOperator.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JMenuItemOperator.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JMenuOperator.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JMenuOperator.java index fe28b31ffeca..50e53488d72a 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JMenuOperator.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JMenuOperator.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JPasswordFieldOperator.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JPasswordFieldOperator.java index 5b74dcf8777c..2b39f265934b 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JPasswordFieldOperator.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JPasswordFieldOperator.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JPopupMenuOperator.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JPopupMenuOperator.java index cd242eec71b5..2b4af3db3c2f 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JPopupMenuOperator.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JPopupMenuOperator.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JProgressBarOperator.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JProgressBarOperator.java index e07cd48e772c..951eef05ee9e 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JProgressBarOperator.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JProgressBarOperator.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JRadioButtonMenuItemOperator.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JRadioButtonMenuItemOperator.java index 5e7e9d4164d6..b8d499ccdc4b 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JRadioButtonMenuItemOperator.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JRadioButtonMenuItemOperator.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JRadioButtonOperator.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JRadioButtonOperator.java index ed55c21e5479..c25b4656a883 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JRadioButtonOperator.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JRadioButtonOperator.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JScrollBarOperator.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JScrollBarOperator.java index 365f54509f51..912611abd6c6 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JScrollBarOperator.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JScrollBarOperator.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JScrollPaneOperator.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JScrollPaneOperator.java index 6960cf85485c..c69d96159029 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JScrollPaneOperator.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JScrollPaneOperator.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JSliderOperator.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JSliderOperator.java index 2b8a014e51c3..e16516fa1970 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JSliderOperator.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JSliderOperator.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JSpinnerOperator.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JSpinnerOperator.java index 5449ab97d3e8..1cbf118c5945 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JSpinnerOperator.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JSpinnerOperator.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JSplitPaneOperator.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JSplitPaneOperator.java index 03cde254a36b..d9c25b5cfbcb 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JSplitPaneOperator.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JSplitPaneOperator.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JTabbedPaneOperator.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JTabbedPaneOperator.java index ba6d58dec170..7e7b6b49115a 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JTabbedPaneOperator.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JTabbedPaneOperator.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JTableHeaderOperator.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JTableHeaderOperator.java index a78b42f60fea..72d4c846db96 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JTableHeaderOperator.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JTableHeaderOperator.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JTableOperator.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JTableOperator.java index 329699c9623d..08caa0065215 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JTableOperator.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JTableOperator.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JTextAreaOperator.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JTextAreaOperator.java index da10b549a68a..dae8f4c8da7e 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JTextAreaOperator.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JTextAreaOperator.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JTextComponentOperator.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JTextComponentOperator.java index 09d136f91256..1fa674a5c141 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JTextComponentOperator.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JTextComponentOperator.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JTextFieldOperator.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JTextFieldOperator.java index e50f40aa2b69..00e702208692 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JTextFieldOperator.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JTextFieldOperator.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JTextPaneOperator.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JTextPaneOperator.java index 4f76f1b21723..0e7f3a3c8b86 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JTextPaneOperator.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JTextPaneOperator.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JToggleButtonOperator.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JToggleButtonOperator.java index a9b34bb4b10e..bbad2992f15a 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JToggleButtonOperator.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JToggleButtonOperator.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JToolTipOperator.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JToolTipOperator.java index 5252b49db835..e5cf67b5573e 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JToolTipOperator.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JToolTipOperator.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JTreeOperator.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JTreeOperator.java index 29d7c238b794..f9f8b8d86238 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JTreeOperator.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/JTreeOperator.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/LabelOperator.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/LabelOperator.java index ec81e60344e8..5c30cd09b516 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/LabelOperator.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/LabelOperator.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/ListOperator.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/ListOperator.java index 24bc6757fa8d..46545826cb6a 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/ListOperator.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/ListOperator.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/Operator.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/Operator.java index e29bf9b116b0..09ffb5301b10 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/Operator.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/Operator.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/ScrollPaneOperator.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/ScrollPaneOperator.java index 31d4fcc42597..0a1e60e1c281 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/ScrollPaneOperator.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/ScrollPaneOperator.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/ScrollbarOperator.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/ScrollbarOperator.java index d46585248a62..c7d484487634 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/ScrollbarOperator.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/ScrollbarOperator.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/TextAreaOperator.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/TextAreaOperator.java index a5f99db99411..d473fdf2f76b 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/TextAreaOperator.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/TextAreaOperator.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/TextComponentOperator.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/TextComponentOperator.java index 5a698b1a9a2e..fda075a52c33 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/TextComponentOperator.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/TextComponentOperator.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/TextFieldOperator.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/TextFieldOperator.java index b3e49dad1410..7f7011a16ed2 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/TextFieldOperator.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/TextFieldOperator.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/WindowOperator.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/WindowOperator.java index e20e55f8bc5b..5fe37e39f949 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/WindowOperator.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/WindowOperator.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/package-info.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/package-info.java index 59bf22188579..70221db65ee2 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/package-info.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/operators/package-info.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/package-info.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/package-info.java index 4e01d79249e0..b1f1117dcaff 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/package-info.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/package-info.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/AbstractTextStyleChooser.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/AbstractTextStyleChooser.java index c190b25ee903..95e2d7ba04bf 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/AbstractTextStyleChooser.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/AbstractTextStyleChooser.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/DefaultVisualizer.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/DefaultVisualizer.java index 546b4f21ea02..efa7660ddab4 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/DefaultVisualizer.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/DefaultVisualizer.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/DumpController.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/DumpController.java index 60230ce3b535..d0734cf9c0d2 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/DumpController.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/DumpController.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/Dumper.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/Dumper.java index 0e326542c3d0..565e3d0fa5e2 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/Dumper.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/Dumper.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/EmptyVisualizer.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/EmptyVisualizer.java index f589a212e830..db59c21ea741 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/EmptyVisualizer.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/EmptyVisualizer.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/LookAndFeel.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/LookAndFeel.java index c2fa73b7055a..da46bcc96a98 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/LookAndFeel.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/LookAndFeel.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/MouseVisualizer.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/MouseVisualizer.java index d040daf1b357..8517a2c661bf 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/MouseVisualizer.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/MouseVisualizer.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/NameComponentChooser.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/NameComponentChooser.java index c179aa91fb3a..820aa8902627 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/NameComponentChooser.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/NameComponentChooser.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/PNGDecoder.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/PNGDecoder.java index 246446daa6bb..26de3c639301 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/PNGDecoder.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/PNGDecoder.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/PNGEncoder.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/PNGEncoder.java index 3a0c940d13f2..08b45ee23745 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/PNGEncoder.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/PNGEncoder.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/Platform.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/Platform.java index b84cebf73fe3..d20e8044dab0 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/Platform.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/Platform.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/PropChooser.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/PropChooser.java index 984ffb0658b3..3184498f0672 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/PropChooser.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/PropChooser.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/RegExComparator.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/RegExComparator.java index 49700816cc0f..eee6a7640130 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/RegExComparator.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/RegExComparator.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/StringPropChooser.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/StringPropChooser.java index 401b109497f5..297e813451db 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/StringPropChooser.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/StringPropChooser.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/TextStyleChooser.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/TextStyleChooser.java index f4b75f9ea8f8..5260f5c9ea04 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/TextStyleChooser.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/TextStyleChooser.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/WindowJob.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/WindowJob.java index ad8397180852..92be8384f6c2 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/WindowJob.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/WindowJob.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/WindowManager.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/WindowManager.java index f51ef1524cf9..5a1aaa6b6afe 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/WindowManager.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/WindowManager.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/package-info.java b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/package-info.java index 1eef43bae246..ab6122c48cab 100644 --- a/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/package-info.java +++ b/test/jdk/sanity/client/lib/jemmy/src/org/netbeans/jemmy/util/package-info.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/CAInterop.java b/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/CAInterop.java index 3f16717153bd..cc348f5af852 100644 --- a/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/CAInterop.java +++ b/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/CAInterop.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, 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 @@ -557,6 +557,36 @@ * @run main/othervm/manual -Djava.security.debug=certpath CAInterop ssltlsrootrsa2022 CRL */ +/* + * @test id=sectigotlsrootr46 + * @bug 8359170 + * @summary Interoperability tests with Sectigo Public Server Authentication + * Root R46 + * @library /test/lib + * @build jtreg.SkippedException ValidatePathWithURL CAInterop + * @run main/othervm/manual -Djava.security.debug=certpath,ocsp CAInterop + * sectigotlsrootr46 OCSP + * @run main/othervm/manual -Djava.security.debug=certpath,ocsp + * -Dcom.sun.security.ocsp.useget=false CAInterop sectigotlsrootr46 OCSP + * @run main/othervm/manual -Djava.security.debug=certpath CAInterop + * sectigotlsrootr46 CRL + */ + +/* + * @test id=sectigotlsroote46 + * @bug 8359170 + * @summary Interoperability tests with Sectigo Public Server Authentication + * Root E46 + * @library /test/lib + * @build jtreg.SkippedException ValidatePathWithURL CAInterop + * @run main/othervm/manual -Djava.security.debug=certpath,ocsp CAInterop + * sectigotlsroote46 OCSP + * @run main/othervm/manual -Djava.security.debug=certpath,ocsp + * -Dcom.sun.security.ocsp.useget=false CAInterop sectigotlsroote46 OCSP + * @run main/othervm/manual -Djava.security.debug=certpath CAInterop + * sectigotlsroote46 CRL + */ + /** * Collection of certificate validation tests for interoperability with external CAs. * These tests are marked as manual as they depend on external infrastructure and may fail @@ -742,6 +772,13 @@ private CATestURLs getTestURLs(String alias) { new CATestURLs("https://test-root-2022-rsa.ssl.com", "https://revoked-root-2022-rsa.ssl.com"); + case "sectigotlsrootr46" -> + new CATestURLs("https://sectigopublicserverauthenticationrootr46-ev.sectigo.com", + "https://sectigopublicserverauthenticationrootr46-ev.sectigo.com:444"); + case "sectigotlsroote46" -> + new CATestURLs("https://sectigopublicserverauthenticationroote46-ev.sectigo.com", + "https://sectigopublicserverauthenticationroote46-ev.sectigo.com:444"); + default -> throw new RuntimeException("No test setup found for: " + alias); }; } diff --git a/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/SectigoCSRootCAs.java b/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/SectigoCSRootCAs.java new file mode 100644 index 000000000000..80cd1d41cbc6 --- /dev/null +++ b/test/jdk/security/infra/java/security/cert/CertPathValidator/certification/SectigoCSRootCAs.java @@ -0,0 +1,310 @@ +/* + * Copyright (c) 2025, 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 8359170 + * @summary Interoperability tests with Sectigo Public Code Signing Root CAs + * @build ValidatePathWithParams + * @run main/othervm/manual -Djava.security.debug=ocsp,certpath SectigoCSRootCAs OCSP + * @run main/othervm/manual -Djava.security.debug=certpath SectigoCSRootCAs CRL + */ + +public class SectigoCSRootCAs { + + public static void main(String[] args) throws Exception { + + ValidatePathWithParams pathValidator = new ValidatePathWithParams(null); + + if (args.length >= 1 && "CRL".equalsIgnoreCase(args[0])) { + pathValidator.enableCRLCheck(); + } else { + // OCSP check by default + pathValidator.enableOCSPCheck(); + } + + new SectigoCSRootCA_R46().runTest(pathValidator); + new SectigoCSRootCA_E46().runTest(pathValidator); + } +} + +class SectigoCSRootCA_R46 { + + // Owner: CN=Sectigo Public Code Signing CA R36, O=Sectigo Limited, C=GB + // Issuer: CN=Sectigo Public Code Signing Root R46, O=Sectigo Limited, C=GB + // Serial number: 621d6d0c52019e3b9079152089211c0a + // Valid from: Sun Mar 21 17:00:00 PDT 2021 until: Fri Mar 21 16:59:59 + // PDT 2036 + private static final String INT = "-----BEGIN CERTIFICATE-----\n" + + "MIIGGjCCBAKgAwIBAgIQYh1tDFIBnjuQeRUgiSEcCjANBgkqhkiG9w0BAQwFADBW\n" + + "MQswCQYDVQQGEwJHQjEYMBYGA1UEChMPU2VjdGlnbyBMaW1pdGVkMS0wKwYDVQQD\n" + + "EyRTZWN0aWdvIFB1YmxpYyBDb2RlIFNpZ25pbmcgUm9vdCBSNDYwHhcNMjEwMzIy\n" + + "MDAwMDAwWhcNMzYwMzIxMjM1OTU5WjBUMQswCQYDVQQGEwJHQjEYMBYGA1UEChMP\n" + + "U2VjdGlnbyBMaW1pdGVkMSswKQYDVQQDEyJTZWN0aWdvIFB1YmxpYyBDb2RlIFNp\n" + + "Z25pbmcgQ0EgUjM2MIIBojANBgkqhkiG9w0BAQEFAAOCAY8AMIIBigKCAYEAmyud\n" + + "U/o1P45gBkNqwM/1f/bIU1MYyM7TbH78WAeVF3llMwsRHgBGRmxDeEDIArCS2VCo\n" + + "Vk4Y/8j6stIkmYV5Gej4NgNjVQ4BYoDjGMwdjioXan1hlaGFt4Wk9vT0k2oWJMJj\n" + + "L9G//N523hAm4jF4UjrW2pvv9+hdPX8tbbAfI3v0VdJiJPFy/7XwiunD7mBxNtec\n" + + "M6ytIdUlh08T2z7mJEXZD9OWcJkZk5wDuf2q52PN43jc4T9OkoXZ0arWZVeffvMr\n" + + "/iiIROSCzKoDmWABDRzV/UiQ5vqsaeFaqQdzFf4ed8peNWh1OaZXnYvZQgWx/SXi\n" + + "JDRSAolRzZEZquE6cbcH747FHncs/Kzcn0Ccv2jrOW+LPmnOyB+tAfiWu01TPhCr\n" + + "9VrkxsHC5qFNxaThTG5j4/Kc+ODD2dX/fmBECELcvzUHf9shoFvrn35XGf2RPaNT\n" + + "O2uSZ6n9otv7jElspkfK9qEATHZcodp+R4q2OIypxR//YEb3fkDn3UayWW9bAgMB\n" + + "AAGjggFkMIIBYDAfBgNVHSMEGDAWgBQy65Ka/zWWSC8oQEJwIDaRXBeF5jAdBgNV\n" + + "HQ4EFgQUDyrLIIcouOxvSK4rVKYpqhekzQwwDgYDVR0PAQH/BAQDAgGGMBIGA1Ud\n" + + "EwEB/wQIMAYBAf8CAQAwEwYDVR0lBAwwCgYIKwYBBQUHAwMwGwYDVR0gBBQwEjAG\n" + + "BgRVHSAAMAgGBmeBDAEEATBLBgNVHR8ERDBCMECgPqA8hjpodHRwOi8vY3JsLnNl\n" + + "Y3RpZ28uY29tL1NlY3RpZ29QdWJsaWNDb2RlU2lnbmluZ1Jvb3RSNDYuY3JsMHsG\n" + + "CCsGAQUFBwEBBG8wbTBGBggrBgEFBQcwAoY6aHR0cDovL2NydC5zZWN0aWdvLmNv\n" + + "bS9TZWN0aWdvUHVibGljQ29kZVNpZ25pbmdSb290UjQ2LnA3YzAjBggrBgEFBQcw\n" + + "AYYXaHR0cDovL29jc3Auc2VjdGlnby5jb20wDQYJKoZIhvcNAQEMBQADggIBAAb/\n" + + "guF3YzZue6EVIJsT/wT+mHVEYcNWlXHRkT+FoetAQLHI1uBy/YXKZDk8+Y1LoNqH\n" + + "rp22AKMGxQtgCivnDHFyAQ9GXTmlk7MjcgQbDCx6mn7yIawsppWkvfPkKaAQsiqa\n" + + "T9DnMWBHVNIabGqgQSGTrQWo43MOfsPynhbz2Hyxf5XWKZpRvr3dMapandPfYgoZ\n" + + "8iDL2OR3sYztgJrbG6VZ9DoTXFm1g0Rf97Aaen1l4c+w3DC+IkwFkvjFV3jS49ZS\n" + + "c4lShKK6BrPTJYs4NG1DGzmpToTnwoqZ8fAmi2XlZnuchC4NPSZaPATHvNIzt+z1\n" + + "PHo35D/f7j2pO1S8BCysQDHCbM5Mnomnq5aYcKCsdbh0czchOm8bkinLrYrKpii+\n" + + "Tk7pwL7TjRKLXkomm5D1Umds++pip8wH2cQpf93at3VDcOK4N7EwoIJB0kak6pSz\n" + + "Eu4I64U6gZs7tS/dGNSljf2OSSnRr7KWzq03zl8l75jy+hOds9TWSenLbjBQUGR9\n" + + "6cFr6lEUfAIEHVC1L68Y1GGxx4/eRI82ut83axHMViw1+sVpbPxg51Tbnio1lB93\n" + + "079WPFnYaOvfGAA0e0zcfF/M9gXr+korwQTh2Prqooq2bYNMvUoUKD85gnJ+t0sm\n" + + "rWrb8dee2CvYZXD5laGtaAxOfy/VKNmwuWuAh9kc\n" + + "-----END CERTIFICATE-----"; + + // Owner: CN=Sectigo Limited, O=Sectigo Limited, ST=West Yorkshire, C=GB + // Issuer: CN=Sectigo Public Code Signing CA R36, O=Sectigo Limited, C=GB + // Serial number: c1de046377578f1605414f3fa91bf5f6 + // Valid from: Wed Jun 04 17:00:00 PDT 2025 until: Fri Jun 05 16:59:59 + // PDT 2026 + private static final String VALID = "-----BEGIN CERTIFICATE-----\n" + + "MIIGRDCCBKygAwIBAgIRAMHeBGN3V48WBUFPP6kb9fYwDQYJKoZIhvcNAQEMBQAw\n" + + "VDELMAkGA1UEBhMCR0IxGDAWBgNVBAoTD1NlY3RpZ28gTGltaXRlZDErMCkGA1UE\n" + + "AxMiU2VjdGlnbyBQdWJsaWMgQ29kZSBTaWduaW5nIENBIFIzNjAeFw0yNTA2MDUw\n" + + "MDAwMDBaFw0yNjA2MDUyMzU5NTlaMFoxCzAJBgNVBAYTAkdCMRcwFQYDVQQIDA5X\n" + + "ZXN0IFlvcmtzaGlyZTEYMBYGA1UECgwPU2VjdGlnbyBMaW1pdGVkMRgwFgYDVQQD\n" + + "DA9TZWN0aWdvIExpbWl0ZWQwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoIC\n" + + "AQDCYjakgsoYkqVpENW0MuN5hBZDdIM60WJgBXU7zTAXORntSu/Grn/SQywwTg4o\n" + + "ltRcKuCp0Cd5zLAIjtgpVDDACWHgxKUtxerjjBZeGp0+viR+biLL0mVNPXgZZ5bQ\n" + + "AnDYVKJaGnPsXQD8l+Bn/R2c4cw7mXjBYp2KrTuqOBkPzk4LmdgpKXjxiw1yYb+n\n" + + "WKZ+3BMLIU6/k+LB9+WB6Odrl4Lff1jB4C6XhQELGjZAbpkFB2+Qr0ajIA3ZFXqU\n" + + "IMh0j5oD5juuXxryOvCgSBkEwxPHnlXxZBNd3DmrZ9NGClBIGE2f9FOjzo5Rl7lV\n" + + "KlzFdFmcH8LaLtWjniF+iT+YZw3Ld1O9VMK7RaHePsS4JYfbjeapoCEgudecmIz4\n" + + "5Q2tTjCdR5s/SxiVbynfEw+cAGeiv4sRXNSg0uhZ2eGMHh6mPley2pUoRMR8Qx1U\n" + + "0Uzg2NtPsHAo0DIH3jKEWU2zP5UPwCfqKYGaZLNLeGh07NZHBCp3TGp9kPVen5Ib\n" + + "tnJssu+pab7fixvbpDM4/r9MkKU6C1IsE6lffyON0PA6LaywwecYTJGpieXqoz03\n" + + "5UmQXvAzkb9omIAcQ6yWMZNrqwwG9XRKQEhvG3v7sbFkck1KZOz4r/KHkLx9sIxm\n" + + "vngdD/qLFebxPIvPT0GKnvSzuGcdQXVTdkZBBBrunv+XpQIDAQABo4IBiTCCAYUw\n" + + "HwYDVR0jBBgwFoAUDyrLIIcouOxvSK4rVKYpqhekzQwwHQYDVR0OBBYEFGMpbbJO\n" + + "xiuD6t+HEyA3hjp4devXMA4GA1UdDwEB/wQEAwIHgDAMBgNVHRMBAf8EAjAAMBMG\n" + + "A1UdJQQMMAoGCCsGAQUFBwMDMEoGA1UdIARDMEEwNQYMKwYBBAGyMQECAQMCMCUw\n" + + "IwYIKwYBBQUHAgEWF2h0dHBzOi8vc2VjdGlnby5jb20vQ1BTMAgGBmeBDAEEATBJ\n" + + "BgNVHR8EQjBAMD6gPKA6hjhodHRwOi8vY3JsLnNlY3RpZ28uY29tL1NlY3RpZ29Q\n" + + "dWJsaWNDb2RlU2lnbmluZ0NBUjM2LmNybDB5BggrBgEFBQcBAQRtMGswRAYIKwYB\n" + + "BQUHMAKGOGh0dHA6Ly9jcnQuc2VjdGlnby5jb20vU2VjdGlnb1B1YmxpY0NvZGVT\n" + + "aWduaW5nQ0FSMzYuY3J0MCMGCCsGAQUFBzABhhdodHRwOi8vb2NzcC5zZWN0aWdv\n" + + "LmNvbTANBgkqhkiG9w0BAQwFAAOCAYEAP2OCzJ+0hrg4XK3w+Ypoe0G5hKfzZ9RH\n" + + "nDcgY8BjgWYVOlN9ad2bU70RfgkZzylkaSt02KHOpkXmYpgfjZsovmyUchvlZ4fU\n" + + "RmivZleuO3G/ZvDFX373S40QFDd+lC1LYYUolRVz7/ZU2Vzql4FxsM1psRaW17xj\n" + + "jf9qaAvDlOH45eEEkfRUbIDdn1UYqDxdCN+90jtD1vRWkYINvE1T6mq3rHpEVoTS\n" + + "dIOgmcSL3MAKMB0LxWUPfoVdhnoUuoIxIAcV1SuR6zej4wHjClEaR8ReT/C23Jr3\n" + + "hQ4VDbfGu3gvlZG8/+lNmT+t4WaNPECxbFP0BgbD70FP594mSVH3fgptYiiRN7ez\n" + + "iUfOSBeCZpSMm7Z5P0KkxkagyFIR3vzgvqbJS/iaomvd9ZIkd9AwMEhugJpITeZj\n" + + "lKSXs+2q2UHQdLTPGVoOjmqyPhDGKAeVVF+jLIUWwtAaAoJm6ooXSp8sAeLA+e+K\n" + + "6RUFETVxhCefCjkbWq64OYLXriDb0l+W\n" + + "-----END CERTIFICATE-----"; + + // Owner: CN=Sectigo Limited, O=Sectigo Limited, ST=West Yorkshire, C=GB + // Issuer: CN=Sectigo Public Code Signing CA R36, O=Sectigo Limited, C=GB + // Serial number: 5ca6fb60da04db99dedbbc0c37131ec + // Valid from: Wed Jun 04 17:00:00 PDT 2025 until: Sun Jun 04 16:59:59 + // PDT 2028 + private static final String REVOKED = "-----BEGIN CERTIFICATE-----\n" + + "MIIGQzCCBKugAwIBAgIQBcpvtg2gTbmd7bvAw3Ex7DANBgkqhkiG9w0BAQwFADBU\n" + + "MQswCQYDVQQGEwJHQjEYMBYGA1UEChMPU2VjdGlnbyBMaW1pdGVkMSswKQYDVQQD\n" + + "EyJTZWN0aWdvIFB1YmxpYyBDb2RlIFNpZ25pbmcgQ0EgUjM2MB4XDTI1MDYwNTAw\n" + + "MDAwMFoXDTI4MDYwNDIzNTk1OVowWjELMAkGA1UEBhMCR0IxFzAVBgNVBAgMDldl\n" + + "c3QgWW9ya3NoaXJlMRgwFgYDVQQKDA9TZWN0aWdvIExpbWl0ZWQxGDAWBgNVBAMM\n" + + "D1NlY3RpZ28gTGltaXRlZDCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIB\n" + + "ALDjoFCMN16zlrcv/saieSYT7FXEhTVDPLNzGAbNdBEX09FoL5EIkiN3biVIbDki\n" + + "bIocCFpo/yTrjARG/zz82AjdWHyomdtDjL35CQmgiUX7V8tu64xUfUAgadqm+0PL\n" + + "by1LRddKE7chpdJu+EDEmeYDPqcRGM+u8suPgosFf6XfVNFy/FZJiD1c7q6JNZ8i\n" + + "5NrvTs0zA9HckKE3uvPO9rw56EyF3SfUz9+zHKHwSElv8nCYpREudUf4yCzPNisK\n" + + "MVovzeCo36nzJFEdWTnDOr4mtvfCEGvJOU3mgzpECK7QF+yFifr90SG4lvrwzkig\n" + + "wYQymukXmB2gxN1tGOvgLig3Q/b4vljBiEeRPEba/L8YQnaXpR/BnPze8yb2t39l\n" + + "bzmnghkWkGA0PAB2vrzpi7pq12fGOD0+ErtAzAl/TAD/UFWwXDQLWX9LXRRKi5E+\n" + + "ScTlqLl9U1q9HsWYfM6CvLbc32TByaQ8yBytvsSRB0C0blp7CtP5MAc8j9xJdwAs\n" + + "Mj2bvSOfA+NJ0Kdg/tqdHHU6hex2HnGzDiEhovm6u/oAfDp/i2bBKLgARglMfGaC\n" + + "hFWeHLL6GAyBezMv+AQNCDCTYDMlqAihVMRUAfYgoHcVCfvTSETTTGdRUDFzIdCA\n" + + "wNwSVfykpadsev43I2IF+F3aNgJYuXnpxSCLPngemcgxAgMBAAGjggGJMIIBhTAf\n" + + "BgNVHSMEGDAWgBQPKssghyi47G9IritUpimqF6TNDDAdBgNVHQ4EFgQUlff/C/GC\n" + + "faJ+Y7ua3hKsCsrW9y4wDgYDVR0PAQH/BAQDAgeAMAwGA1UdEwEB/wQCMAAwEwYD\n" + + "VR0lBAwwCgYIKwYBBQUHAwMwSgYDVR0gBEMwQTA1BgwrBgEEAbIxAQIBAwIwJTAj\n" + + "BggrBgEFBQcCARYXaHR0cHM6Ly9zZWN0aWdvLmNvbS9DUFMwCAYGZ4EMAQQBMEkG\n" + + "A1UdHwRCMEAwPqA8oDqGOGh0dHA6Ly9jcmwuc2VjdGlnby5jb20vU2VjdGlnb1B1\n" + + "YmxpY0NvZGVTaWduaW5nQ0FSMzYuY3JsMHkGCCsGAQUFBwEBBG0wazBEBggrBgEF\n" + + "BQcwAoY4aHR0cDovL2NydC5zZWN0aWdvLmNvbS9TZWN0aWdvUHVibGljQ29kZVNp\n" + + "Z25pbmdDQVIzNi5jcnQwIwYIKwYBBQUHMAGGF2h0dHA6Ly9vY3NwLnNlY3RpZ28u\n" + + "Y29tMA0GCSqGSIb3DQEBDAUAA4IBgQAfVq3mY7ggMcTJeWKKrGxs9RUiuAY0p4Xv\n" + + "CHNQViM/tHAn0t/nkPp+d2Ji3Zr6PefN+1F6zmsxsbZHse52JNHWYUwCb/Dx4Vw6\n" + + "3Wnc1zhXtZnvUTUfgrivuIsMjUG8yzTdEt/taMKEO0KqlKPsBPgFKveDVVaq9UZa\n" + + "FfxTWqgrnvkvP/Lag/YeKKj4cJG+a/MJZJm7kvyaBNKXVAamr/bumoxKDzpD67ds\n" + + "n9qwBi2Mv0rRXvZ2SHQXzsJ/zjNKWUhpPVrpypaER7EUxjNuSgC4L8AmfvHiO67v\n" + + "9EVIEud+beP3FtCXl/cSHhVeDxiC0KBXXBl9zLBaYvCH+8iABnZLStLgBDtfdkfk\n" + + "TZEAGbrNOXJDMnKRxr8y377Zq+KHwfiTnyizACHyMMTi+CCwg1ZFGcLOHa5shByc\n" + + "Ln9lYysM1/5vrEjt3ZUw11+pDqbPCGS++xgAwcftKfJ0TZrW/g6NZ9URg+11H9ad\n" + + "WalBv2VkhJAFJam9P2Y+pi9luk85sGo=\n" + + "-----END CERTIFICATE-----"; + + public void runTest(ValidatePathWithParams pathValidator) throws Exception { + // Validate valid + pathValidator.validate(new String[]{VALID, INT}, + ValidatePathWithParams.Status.GOOD, null, System.out); + + // Validate Revoked + pathValidator.validate(new String[]{REVOKED, INT}, + ValidatePathWithParams.Status.REVOKED, + "Thu Jun 05 10:27:45 PDT 2025", System.out); + } +} + +class SectigoCSRootCA_E46 { + + // Owner: CN=Sectigo Public Code Signing CA EV E36, O=Sectigo Limited, C=GB + // Issuer: CN=Sectigo Public Code Signing Root E46, O=Sectigo Limited, C=GB + // Serial number: 3774434f9eb40e221f9236ca1f2f2717 + // Valid from: Sun Mar 21 17:00:00 PDT 2021 until: Fri Mar 21 16:59:59 + // PDT 2036 + private static final String INT_VALID = "-----BEGIN CERTIFICATE-----\n" + + "MIIDMDCCAragAwIBAgIQN3RDT560DiIfkjbKHy8nFzAKBggqhkjOPQQDAzBWMQsw\n" + + "CQYDVQQGEwJHQjEYMBYGA1UEChMPU2VjdGlnbyBMaW1pdGVkMS0wKwYDVQQDEyRT\n" + + "ZWN0aWdvIFB1YmxpYyBDb2RlIFNpZ25pbmcgUm9vdCBFNDYwHhcNMjEwMzIyMDAw\n" + + "MDAwWhcNMzYwMzIxMjM1OTU5WjBXMQswCQYDVQQGEwJHQjEYMBYGA1UEChMPU2Vj\n" + + "dGlnbyBMaW1pdGVkMS4wLAYDVQQDEyVTZWN0aWdvIFB1YmxpYyBDb2RlIFNpZ25p\n" + + "bmcgQ0EgRVYgRTM2MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE3mMV9nNViYoH\n" + + "4aSrPwFjpbbeXHw2pMbqezwDGb45uEZQr3qI9Hgt0k4R26o5upfXzJt03F8efu0r\n" + + "RNEs4yDDz6OCAWMwggFfMB8GA1UdIwQYMBaAFM99LKCQepgd3bZehcLg2hVx0uVe\n" + + "MB0GA1UdDgQWBBQadKQ417m2DrNb+txerj+28HM9iDAOBgNVHQ8BAf8EBAMCAYYw\n" + + "EgYDVR0TAQH/BAgwBgEB/wIBADATBgNVHSUEDDAKBggrBgEFBQcDAzAaBgNVHSAE\n" + + "EzARMAYGBFUdIAAwBwYFZ4EMAQMwSwYDVR0fBEQwQjBAoD6gPIY6aHR0cDovL2Ny\n" + + "bC5zZWN0aWdvLmNvbS9TZWN0aWdvUHVibGljQ29kZVNpZ25pbmdSb290RTQ2LmNy\n" + + "bDB7BggrBgEFBQcBAQRvMG0wRgYIKwYBBQUHMAKGOmh0dHA6Ly9jcnQuc2VjdGln\n" + + "by5jb20vU2VjdGlnb1B1YmxpY0NvZGVTaWduaW5nUm9vdEU0Ni5wN2MwIwYIKwYB\n" + + "BQUHMAGGF2h0dHA6Ly9vY3NwLnNlY3RpZ28uY29tMAoGCCqGSM49BAMDA2gAMGUC\n" + + "MQCger3L4CYx2W7HyHzvLaAnNee9QVqOwOrBYZyyqXERLtZg1DscsdoYZ2gszEW3\n" + + "zaUCMAaLtcwdoV35ADpru29wChS7kFgXt599Ex27wmL++uJCJth6xYr3nyF2b2YJ\n" + + "DAatOw==\n" + + "-----END CERTIFICATE-----"; + + // Owner: CN=Sectigo Public Code Signing CA E36, O=Sectigo Limited, C=GB + // Issuer: CN=Sectigo Public Code Signing Root E46, O=Sectigo Limited, C=GB + // Serial number: 3602617636e7034b9cc1fc5ffeac2d54 + // Valid from: Sun Mar 21 17:00:00 PDT 2021 until: Fri Mar 21 16:59:59 + // PDT 2036 + private static final String INT_REVOKED = "-----BEGIN CERTIFICATE-----\n" + + "MIIDLjCCArSgAwIBAgIQNgJhdjbnA0ucwfxf/qwtVDAKBggqhkjOPQQDAzBWMQsw\n" + + "CQYDVQQGEwJHQjEYMBYGA1UEChMPU2VjdGlnbyBMaW1pdGVkMS0wKwYDVQQDEyRT\n" + + "ZWN0aWdvIFB1YmxpYyBDb2RlIFNpZ25pbmcgUm9vdCBFNDYwHhcNMjEwMzIyMDAw\n" + + "MDAwWhcNMzYwMzIxMjM1OTU5WjBUMQswCQYDVQQGEwJHQjEYMBYGA1UEChMPU2Vj\n" + + "dGlnbyBMaW1pdGVkMSswKQYDVQQDEyJTZWN0aWdvIFB1YmxpYyBDb2RlIFNpZ25p\n" + + "bmcgQ0EgRTM2MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAElDe1m6jawDhrwMxJ\n" + + "yFPhKYf8EGu+lBw3bF5CzmfaH1I7Zi+WAmkeEwS3tiNxzPh8GbBBLtdaRuqGuyWc\n" + + "W6ERmaOCAWQwggFgMB8GA1UdIwQYMBaAFM99LKCQepgd3bZehcLg2hVx0uVeMB0G\n" + + "A1UdDgQWBBQlDZtt2Bh3t4rDOFFW5cfytf+DajAOBgNVHQ8BAf8EBAMCAYYwEgYD\n" + + "VR0TAQH/BAgwBgEB/wIBADATBgNVHSUEDDAKBggrBgEFBQcDAzAbBgNVHSAEFDAS\n" + + "MAYGBFUdIAAwCAYGZ4EMAQQBMEsGA1UdHwREMEIwQKA+oDyGOmh0dHA6Ly9jcmwu\n" + + "c2VjdGlnby5jb20vU2VjdGlnb1B1YmxpY0NvZGVTaWduaW5nUm9vdEU0Ni5jcmww\n" + + "ewYIKwYBBQUHAQEEbzBtMEYGCCsGAQUFBzAChjpodHRwOi8vY3J0LnNlY3RpZ28u\n" + + "Y29tL1NlY3RpZ29QdWJsaWNDb2RlU2lnbmluZ1Jvb3RFNDYucDdjMCMGCCsGAQUF\n" + + "BzABhhdodHRwOi8vb2NzcC5zZWN0aWdvLmNvbTAKBggqhkjOPQQDAwNoADBlAjBM\n" + + "ykNTSVvegC1m17yIi87qgx6QIGbw1Mw2bQ4gtOWBVb/C8ALByC1YK7yQJNLJFTkC\n" + + "MQCNBv3fe1eLrGELS5KQD0cEFbXGlzQ5r1mnOHePMqlK5d+rmMxff58/t6bo3QEb\n" + + "8SQ=\n" + + "-----END CERTIFICATE-----"; + + // Owner: CN=Sectigo Limited, O=Sectigo Limited, ST=West Yorkshire, C=GB, + // OID.2.5.4.15=Private Organization, OID.1.3.6.1.4.1.311.60.2.1.3=GB, + // SERIALNUMBER=04058690 + // Issuer: CN=Sectigo Public Code Signing CA EV E36, O=Sectigo Limited, C=GB + // Serial number: fa2aa131f36b337717ac73f606a6ec49 + // Valid from: Tue Feb 13 16:00:00 PST 2024 until: Sat Feb 13 15:59:59 + // PST 2027 + private static final String VALID = "-----BEGIN CERTIFICATE-----\n" + + "MIIDrjCCA1SgAwIBAgIRAPoqoTHzazN3F6xz9gam7EkwCgYIKoZIzj0EAwIwVzEL\n" + + "MAkGA1UEBhMCR0IxGDAWBgNVBAoTD1NlY3RpZ28gTGltaXRlZDEuMCwGA1UEAxMl\n" + + "U2VjdGlnbyBQdWJsaWMgQ29kZSBTaWduaW5nIENBIEVWIEUzNjAeFw0yNDAyMTQw\n" + + "MDAwMDBaFw0yNzAyMTMyMzU5NTlaMIGhMREwDwYDVQQFEwgwNDA1ODY5MDETMBEG\n" + + "CysGAQQBgjc8AgEDEwJHQjEdMBsGA1UEDxMUUHJpdmF0ZSBPcmdhbml6YXRpb24x\n" + + "CzAJBgNVBAYTAkdCMRcwFQYDVQQIDA5XZXN0IFlvcmtzaGlyZTEYMBYGA1UECgwP\n" + + "U2VjdGlnbyBMaW1pdGVkMRgwFgYDVQQDDA9TZWN0aWdvIExpbWl0ZWQwWTATBgcq\n" + + "hkjOPQIBBggqhkjOPQMBBwNCAASwXGEU01WkW/hWNYza08ZT7i0ZeZ9M1s93JYEB\n" + + "rZ/f1Ho1YzxtToqgIK2o+32afablPFYWlE6wGyuL/TYggBpKo4IBtDCCAbAwHwYD\n" + + "VR0jBBgwFoAUGnSkONe5tg6zW/rcXq4/tvBzPYgwHQYDVR0OBBYEFHEcsJgcYuDO\n" + + "dv1raL6h83a6j9C/MA4GA1UdDwEB/wQEAwIHgDAMBgNVHRMBAf8EAjAAMBMGA1Ud\n" + + "JQQMMAoGCCsGAQUFBwMDMEkGA1UdIARCMEAwNQYMKwYBBAGyMQECAQYBMCUwIwYI\n" + + "KwYBBQUHAgEWF2h0dHBzOi8vc2VjdGlnby5jb20vQ1BTMAcGBWeBDAEDMEsGA1Ud\n" + + "HwREMEIwQKA+oDyGOmh0dHA6Ly9jcmwuc2VjdGlnby5jb20vU2VjdGlnb1B1Ymxp\n" + + "Y0NvZGVTaWduaW5nQ0FFVkUzNi5jcmwwewYIKwYBBQUHAQEEbzBtMEYGCCsGAQUF\n" + + "BzAChjpodHRwOi8vY3J0LnNlY3RpZ28uY29tL1NlY3RpZ29QdWJsaWNDb2RlU2ln\n" + + "bmluZ0NBRVZFMzYuY3J0MCMGCCsGAQUFBzABhhdodHRwOi8vb2NzcC5zZWN0aWdv\n" + + "LmNvbTAmBgNVHREEHzAdoBsGCCsGAQUFBwgDoA8wDQwLR0ItMDQwNTg2OTAwCgYI\n" + + "KoZIzj0EAwIDSAAwRQIgQVp7IIkEZNmC7GfmT1MSEhDebIjjzd75ZVEEbPP/4ocC\n" + + "IQDSyfPDKNMbKNOKrweDLwSE2GZV6nDWbiLz6ZmSZHob8w==\n" + + "-----END CERTIFICATE-----"; + + // Owner: CN=Sectigo Limited, O=Sectigo Limited, ST=West Yorkshire, C=GB + // Issuer: CN=Sectigo Public Code Signing CA E36, O=Sectigo Limited, C=GB + // Serial number: a1f601514271f24ca0a31c0d7b856705 + // Valid from: Wed Jun 04 17:00:00 PDT 2025 until: Sun Jun 04 16:59:59 + // PDT 2028 + private static final String REVOKED = "-----BEGIN CERTIFICATE-----\n" + + "MIIDOTCCAt6gAwIBAgIRAKH2AVFCcfJMoKMcDXuFZwUwCgYIKoZIzj0EAwIwVDEL\n" + + "MAkGA1UEBhMCR0IxGDAWBgNVBAoTD1NlY3RpZ28gTGltaXRlZDErMCkGA1UEAxMi\n" + + "U2VjdGlnbyBQdWJsaWMgQ29kZSBTaWduaW5nIENBIEUzNjAeFw0yNTA2MDUwMDAw\n" + + "MDBaFw0yODA2MDQyMzU5NTlaMFoxCzAJBgNVBAYTAkdCMRcwFQYDVQQIDA5XZXN0\n" + + "IFlvcmtzaGlyZTEYMBYGA1UECgwPU2VjdGlnbyBMaW1pdGVkMRgwFgYDVQQDDA9T\n" + + "ZWN0aWdvIExpbWl0ZWQwWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAASwXGEU01Wk\n" + + "W/hWNYza08ZT7i0ZeZ9M1s93JYEBrZ/f1Ho1YzxtToqgIK2o+32afablPFYWlE6w\n" + + "GyuL/TYggBpKo4IBiTCCAYUwHwYDVR0jBBgwFoAUJQ2bbdgYd7eKwzhRVuXH8rX/\n" + + "g2owHQYDVR0OBBYEFHEcsJgcYuDOdv1raL6h83a6j9C/MA4GA1UdDwEB/wQEAwIH\n" + + "gDAMBgNVHRMBAf8EAjAAMBMGA1UdJQQMMAoGCCsGAQUFBwMDMEoGA1UdIARDMEEw\n" + + "NQYMKwYBBAGyMQECAQMCMCUwIwYIKwYBBQUHAgEWF2h0dHBzOi8vc2VjdGlnby5j\n" + + "b20vQ1BTMAgGBmeBDAEEATBJBgNVHR8EQjBAMD6gPKA6hjhodHRwOi8vY3JsLnNl\n" + + "Y3RpZ28uY29tL1NlY3RpZ29QdWJsaWNDb2RlU2lnbmluZ0NBRTM2LmNybDB5Bggr\n" + + "BgEFBQcBAQRtMGswRAYIKwYBBQUHMAKGOGh0dHA6Ly9jcnQuc2VjdGlnby5jb20v\n" + + "U2VjdGlnb1B1YmxpY0NvZGVTaWduaW5nQ0FFMzYuY3J0MCMGCCsGAQUFBzABhhdo\n" + + "dHRwOi8vb2NzcC5zZWN0aWdvLmNvbTAKBggqhkjOPQQDAgNJADBGAiEAlEkiISLz\n" + + "PdJsFmVzJ2VZ8hnnVsOBXKbqISFQvIdguJoCIQCH4T0vwxn6uVkJpMvtxiMG/rYg\n" + + "jRFhfbxDcVee6likOw==\n" + + "-----END CERTIFICATE-----"; + + public void runTest(ValidatePathWithParams pathValidator) throws Exception { + // Validate valid + pathValidator.validate(new String[]{VALID, INT_VALID}, + ValidatePathWithParams.Status.GOOD, null, System.out); + + // Validate Revoked + pathValidator.validate(new String[]{REVOKED, INT_REVOKED}, + ValidatePathWithParams.Status.REVOKED, + "Thu Jun 05 10:27:19 PDT 2025", System.out); + } +} diff --git a/test/jdk/start-Xvfb.sh b/test/jdk/start-Xvfb.sh index ec6a4a2b1c76..f52b7ce1812e 100644 --- a/test/jdk/start-Xvfb.sh +++ b/test/jdk/start-Xvfb.sh @@ -5,9 +5,7 @@ # # 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. +# 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 diff --git a/test/jdk/sun/awt/font/CacheFlushTest.java b/test/jdk/sun/awt/font/CacheFlushTest.java new file mode 100644 index 000000000000..f3b329312753 --- /dev/null +++ b/test/jdk/sun/awt/font/CacheFlushTest.java @@ -0,0 +1,106 @@ +/* + * Copyright (c) 1999, 2024, 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 4286726 + * @summary Java2D raster printing: large text may overflow glyph cache. + * Draw a large glyphvector, the 'A' glyph should appear and not get flushed. +*/ + +import java.awt.Color; +import java.awt.Font; +import java.awt.Graphics2D; +import java.awt.RenderingHints; +import java.awt.font.FontRenderContext; +import java.awt.font.GlyphVector; +import java.awt.geom.Point2D; +import java.awt.image.BufferedImage; +import java.util.HashMap; + +/** + * Draw a very large glyphvector on a surface. + * If the cache was flushed the first glyph is not rendered. + * Note: the implementation no longer uses glyphs for rendering large text, + * but in principle the test is still useful. + */ +public class CacheFlushTest { + + static final int WIDTH = 400, HEIGHT = 600; + static final int FONTSIZE = 250; + static final String TEST = "ABCDEFGHIJKLMNOP"; + static final HashMap HINTS = new HashMap<>(); + + static { + HINTS.put(RenderingHints.KEY_ANTIALIASING, + RenderingHints.VALUE_ANTIALIAS_ON); + HINTS.put(RenderingHints.KEY_TEXT_ANTIALIASING, + RenderingHints.VALUE_TEXT_ANTIALIAS_ON); + HINTS.put(RenderingHints.KEY_FRACTIONALMETRICS, + RenderingHints.VALUE_FRACTIONALMETRICS_ON); + } + + public static void main(String args[]) { + BufferedImage bi = new BufferedImage(WIDTH, HEIGHT, BufferedImage.TYPE_INT_RGB); + + Graphics2D g2d = bi.createGraphics(); + g2d.addRenderingHints(HINTS); + g2d.setColor(Color.white); + g2d.fillRect(0, 0, WIDTH, HEIGHT); + g2d.setColor(Color.black); + + FontRenderContext frc = g2d.getFontRenderContext(); + Font font = new Font(Font.DIALOG, Font.PLAIN, 250); + GlyphVector gv = font.createGlyphVector(frc, TEST); + + /* Set the positions of all but the first glyph to be offset vertically but + * FONTSIZE pixels. So if the first glyph "A" is not flushed we can tell this + * by checking for non-white pixels in the range for the default y offset of 0 + * from the specified y location. + */ + Point2D.Float pt = new Point2D.Float(20f, FONTSIZE); + for (int i = 1; i < gv.getNumGlyphs(); ++i) { + gv.setGlyphPosition(i, pt); + pt.x += 25f; + pt.y = FONTSIZE; + } + g2d.drawGlyphVector(gv, 20, FONTSIZE); + /* Now expect to find at least one black pixel in the rect (0,0) -> (WIDTH, FONTSIZE) */ + boolean found = false; + int blackPixel = Color.black.getRGB(); + for (int y = 0; y < FONTSIZE; y++) { + for (int x = 0; x < WIDTH; x++) { + if (bi.getRGB(x, y) == blackPixel) { + found = true; + break; + } + } + if (found == true) { + break; + } + } + if (!found) { + throw new RuntimeException("NO BLACK PIXELS"); + } + } +} diff --git a/test/jdk/sun/awt/font/TestArabicHebrew.java b/test/jdk/sun/awt/font/TestArabicHebrew.java new file mode 100644 index 000000000000..61cbe931c32c --- /dev/null +++ b/test/jdk/sun/awt/font/TestArabicHebrew.java @@ -0,0 +1,215 @@ +/* + * Copyright (c) 1999, 2024, 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 4198081 + * @key headful + * @summary Arabic characters should appear instead of boxes and be correctly shaped. + * Hebrew characters should appear instead of boxes. + * Test is made headful so there's no excuse for test systems not having the fonts. + */ + +import java.awt.BorderLayout; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.EventQueue; +import java.awt.Graphics; +import java.awt.Graphics2D; +import java.awt.GridLayout; +import java.awt.Font; +import java.awt.Frame; +import java.awt.Panel; +import java.awt.font.FontRenderContext; +import java.awt.font.GlyphVector; +import java.awt.geom.Rectangle2D; + +public class TestArabicHebrew extends Panel { + + static volatile Frame frame; + static volatile Font font = new Font(Font.DIALOG, Font.PLAIN, 36); + + static void createUI() { + frame = new Frame("Test Arabic/Hebrew"); + frame.setLayout(new BorderLayout()); + TestArabicHebrew panel = new TestArabicHebrew(); + frame.add(panel, BorderLayout.CENTER); + frame.pack(); + frame.setVisible(true); + } + + public static void main(String args[]) throws Exception { + EventQueue.invokeAndWait(TestArabicHebrew::createUI); + try { + checkStrings(); + } finally { + if (frame != null && args.length == 0) { + EventQueue.invokeAndWait(frame::dispose); + } + } + } + + static void checkString(String script, String str) { + int index = font.canDisplayUpTo(str); + if (index != -1) { + throw new RuntimeException("Cannot display char " + index + " for " + script); + } + } + + static void checkStrings() { + checkString("Arabic", arabic); + checkString("Hebrew", hebrew); + checkString("Latin-1 Supplement", latin1sup); + } + + // Table of arabic unicode characters - minimal support level + // Includes arabic chars from basic block up to 0652 and + // corresponding shaped characters from the arabic + // extended-B block from fe80 to fefc (does include lam-alef + // ligatures). + // Does not include arabic-indic digits nor "arabic extended" + // range. + + static final String arabic = + "\u060c\u061b\u061f\u0621\u0622\u0623\u0624\u0625\u0626\u0627" + + "\u0628\u0629\u062a\u062b\u062c\u062d\u062e\u062f\u0630\u0631" + + "\u0632\u0633\u0634\u0635\u0636\u0637\u0638\u0639\u063a\u0640" + + "\u0641\u0642\u0643\u0644\u0645\u0646\u0647\u0648\u0649\u064a" + + "\u064b\u064c\u064d\u064e\u064f\u0650\u0651\u0652\ufe80\ufe81" + + "\ufe82\ufe83\ufe84\ufe85\ufe86\ufe87\ufe88\ufe89\ufe8a\ufe8b" + + "\ufe8c\ufe8d\ufe8e\ufe8f\ufe90\ufe91\ufe92\ufe93\ufe94\ufe95" + + "\ufe96\ufe97\ufe98\ufe99\ufe9a\ufe9b\ufe9c\ufe9d\ufe9e\ufe9f" + + "\ufea0\ufea1\ufea2\ufea3\ufea4\ufea5\ufea6\ufea7\ufea8\ufea9" + + "\ufeaa\ufeab\ufeac\ufead\ufeae\ufeaf\ufeb0\ufeb1\ufeb2\ufeb3" + + "\ufeb4\ufeb5\ufeb6\ufeb7\ufeb8\ufeb9\ufeba\ufebb\ufebc\ufebd" + + "\ufebe\ufebf\ufec0\ufec1\ufec2\ufec3\ufec4\ufec5\ufec6\ufec7" + + "\ufec8\ufec9\ufeca\ufecb\ufecc\ufecd\ufece\ufecf\ufed0\ufed1" + + "\ufed2\ufed3\ufed4\ufed5\ufed6\ufed7\ufed8\ufed9\ufeda\ufedb" + + "\ufedc\ufedd\ufede\ufedf\ufee0\ufee1\ufee2\ufee3\ufee4\ufee5" + + "\ufee6\ufee7\ufee8\ufee9\ufeea\ufeeb\ufeec\ufeed\ufeee\ufeef" + + "\ufef0\ufef1\ufef2\ufef3\ufef4\ufef5\ufef6\ufef7\ufef8\ufef9" + + "\ufefa\ufefb\ufefc"; + + // hebrew table includes all characters in hebrew block + + static final String hebrew = + "\u0591\u0592\u0593\u0594\u0595\u0596\u0597\u0598\u0599\u059a" + + "\u059b\u059c\u059d\u059e\u059f\u05a0\u05a1\u05a3\u05a4\u05a5" + + "\u05a6\u05a7\u05a8\u05a9\u05aa\u05ab\u05ac\u05ad\u05ae\u05af" + + "\u05b0\u05b1\u05b2\u05b3\u05b4\u05b5\u05b6\u05b7\u05b8\u05b9" + + "\u05bb\u05bc\u05bd\u05be\u05bf\u05c0\u05c1\u05c2\u05c3\u05c4" + + "\u05d0\u05d1\u05d2\u05d3\u05d4\u05d5\u05d6\u05d7\u05d8\u05d9" + + "\u05da\u05db\u05dc\u05dd\u05de\u05df\u05e0\u05e1\u05e2\u05e3" + + "\u05e4\u05e5\u05e6\u05e7\u05e8\u05e9\u05ea\u05f0\u05f1\u05f2" + + "\u05f3\u05f4"; + + // latin 1 supplement table includes all non-control characters + // in this range. Included because of comment in code that claims + // some problems displaying this range with some SJIS fonts. + + static final String latin1sup = + "\u00a0\u00a1\u00a2\u00a3\u00a4\u00a5\u00a6\u00a7" + + "\u00a8\u00a9\u00aa\u00ab\u00ac\u00ad\u00ae\u00af\u00b0\u00b1" + + "\u00b2\u00b3\u00b4\u00b5\u00b6\u00b7\u00b8\u00b9\u00ba\u00bb" + + "\u00bc\u00bd\u00be\u00bf\u00c0\u00c1\u00c2\u00c3\u00c4\u00c5" + + "\u00c6\u00c7\u00c8\u00c9\u00ca\u00cb\u00cc\u00cd\u00ce\u00cf" + + "\u00d0\u00d1\u00d2\u00d3\u00d4\u00d5\u00d6\u00d7\u00d8\u00d9" + + "\u00da\u00db\u00dc\u00dd\u00de\u00df\u00e0\u00e1\u00e2\u00e3" + + "\u00e4\u00e5\u00e6\u00e7\u00e8\u00e9\u00ea\u00eb\u00ec\u00ed" + + "\u00ee\u00ef\u00f0\u00f1\u00f2\u00f3\u00f4\u00f5\u00f6\u00f7" + + "\u00f8\u00f9\u00fa\u00fb\u00fc\u00fd\u00fe\u00ff"; + + public TestArabicHebrew() { + setLayout(new GridLayout(3, 1)); + + FontRenderContext frc = new FontRenderContext(null, false, false); + add(new SubGlyphPanel("Arabic", arabic, font, frc)); + add(new SubGlyphPanel("Hebrew", hebrew, font, frc)); + add(new SubGlyphPanel("Latin-1 Supplement", latin1sup, font, frc)); + } + + static class SubGlyphPanel extends Panel { + String title; + Dimension extent; + GlyphVector[] vectors; + + static final int kGlyphsPerLine = 20; + + SubGlyphPanel(String title, String chars, Font font, FontRenderContext frc) { + + this.title = title; + setBackground(Color.white); + + double width = 0; + double height = 0; + + int max = chars.length(); + vectors = new GlyphVector[(max + kGlyphsPerLine - 1) / kGlyphsPerLine]; + for (int i = 0; i < vectors.length; i++) { + int start = i * 20; + int limit = Math.min(max, (i + 1) * kGlyphsPerLine); + String substr = ""; + for (int j = start; j < limit; ++j) { + substr = substr.concat(chars.charAt(j) + " "); + } + GlyphVector gv = font.createGlyphVector(frc, substr); + vectors[i] = gv; + Rectangle2D bounds = gv.getLogicalBounds(); + + width = Math.max(width, bounds.getWidth()); + height += bounds.getHeight(); + } + + extent = new Dimension((int)(width + 1), (int)(height + 1 + 30)); // room for title + + setSize(getPreferredSize()); + } + + public Dimension getPreferredSize() { + return new Dimension(extent); + } + + public Dimension getMinimumSize() { + return getPreferredSize(); + } + + public Dimension getMaximumSize() { + return getPreferredSize(); + } + + public void paint(Graphics g) { + Graphics2D g2d = (Graphics2D)g; + + g.drawString(title, 10, 20); + + float x = 10; + float y = 30; + for (int i = 0; i < vectors.length; ++i) { + GlyphVector gv = vectors[i]; + Rectangle2D bounds = gv.getLogicalBounds(); + g2d.drawGlyphVector(gv, x, (float)(y - bounds.getY())); + y += bounds.getHeight(); + } + } + } +} diff --git a/test/jdk/sun/awt/font/TestDevTransform.java b/test/jdk/sun/awt/font/TestDevTransform.java new file mode 100644 index 000000000000..2783401c0f2d --- /dev/null +++ b/test/jdk/sun/awt/font/TestDevTransform.java @@ -0,0 +1,174 @@ +/* + * Copyright (c) 1999, 2024, 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 4269775 8341535 + * @summary Check that different text rendering APIs agree + */ + +/** + * Draw into an image rendering the same text string nine different + * ways: as a TextLayout, a simple String, and a GlyphVector, each + * with three different x scale factors. The expectation is that each + * set of three strings would appear the same although offset in y to + * avoid overlap. The bug was that the y positions of the individual characters + * of the TextLayout and GlyphVector were wrong, so the strings appeared + * to be rendered at different angles. + */ + +import java.awt.Color; +import java.awt.Font; +import java.awt.Graphics2D; +import java.awt.RenderingHints; +import java.awt.font.FontRenderContext; +import java.awt.font.GlyphVector; +import java.awt.font.TextLayout; +import java.awt.geom.AffineTransform; +import java.awt.image.BufferedImage; +import javax.imageio.ImageIO; +import java.io.File; +import java.util.HashMap; + +public class TestDevTransform { + + static HashMap hints = new HashMap<>(); + + static { + hints.put(RenderingHints.KEY_ANTIALIASING, + RenderingHints.VALUE_ANTIALIAS_ON); + hints.put(RenderingHints.KEY_TEXT_ANTIALIASING, + RenderingHints.VALUE_TEXT_ANTIALIAS_ON); + hints.put(RenderingHints.KEY_FRACTIONALMETRICS, + RenderingHints.VALUE_FRACTIONALMETRICS_ON); + } + + static String test = "This is only a test"; + static double angle = Math.PI / 6.0; // Rotate 30 degrees + static final int W = 400, H = 400; + + static void draw(Graphics2D g2d, TextLayout layout, + float x, float y, float scalex) { + AffineTransform saveTransform = g2d.getTransform(); + g2d.translate(x, y); + g2d.rotate(angle); + g2d.scale(scalex, 1f); + layout.draw(g2d, 0f, 0f); + g2d.setTransform(saveTransform); + } + + static void draw(Graphics2D g2d, String string, + float x, float y, float scalex) { + AffineTransform saveTransform = g2d.getTransform(); + g2d.translate(x, y); + g2d.rotate(angle); + g2d.scale(scalex, 1f); + g2d.drawString(string, 0f, 0f); + g2d.setTransform(saveTransform); + } + + static void draw(Graphics2D g2d, GlyphVector gv, + float x, float y, float scalex) { + AffineTransform saveTransform = g2d.getTransform(); + g2d.translate(x, y); + g2d.rotate(angle); + g2d.scale(scalex, 1f); + g2d.drawGlyphVector(gv, 0f, 0f); + g2d.setTransform(saveTransform); + } + + static void init(Graphics2D g2d) { + g2d.setColor(Color.white); + g2d.fillRect(0, 0, W, H); + g2d.setColor(Color.black); + g2d.scale(1.481f, 1.481); // Convert to 108 dpi + g2d.addRenderingHints(hints); + Font font = new Font(Font.DIALOG, Font.PLAIN, 12); + g2d.setFont(font); + } + + static void compare(BufferedImage bi1, String name1, BufferedImage bi2, String name2) throws Exception { + int nonWhite1 = 0; + int nonWhite2 = 0; + int differences = 0; + int whitePixel = Color.white.getRGB(); + for (int x = 0; x < bi1.getWidth(); x++) { + for (int y = 0; y < bi1.getHeight(); y++) { + int pix1 = bi1.getRGB(x, y); + int pix2 = bi2.getRGB(x, y); + if (pix1 != whitePixel) { nonWhite1++; } + if (pix2 != whitePixel) { nonWhite2++; } + if (bi1.getRGB(x, y) != bi2.getRGB(x, y)) { + differences++; + } + } + } + int nonWhite = (nonWhite1 < nonWhite2) ? nonWhite1 : nonWhite2; + if (differences > 0 && ((nonWhite / differences) < 20)) { + ImageIO.write(bi1, "png", new File(name1 + ".png")); + ImageIO.write(bi2, "png", new File(name2 + ".png")); + System.err.println("nonWhite image 1 = " + nonWhite1); + System.err.println("nonWhite image 2 = " + nonWhite2); + System.err.println("Number of non-white differing pixels=" + differences); + throw new RuntimeException("Different rendering: " + differences + " pixels differ."); + } + } + + public static void main(String args[]) throws Exception { + + BufferedImage tl_Image = new BufferedImage(W, H, BufferedImage.TYPE_INT_RGB); + { + Graphics2D tl_g2d = tl_Image.createGraphics(); + init(tl_g2d); + FontRenderContext frc = tl_g2d.getFontRenderContext(); + // Specify font from graphics to be sure it is the same as the other cases. + TextLayout tl = new TextLayout(test, tl_g2d.getFont(), frc); + draw(tl_g2d, tl, 10f, 12f, 3.0f); + draw(tl_g2d, tl, 10f, 24f, 1.0f); + draw(tl_g2d, tl, 10f, 36f, 0.33f); + } + + BufferedImage st_Image = new BufferedImage(400, 400, BufferedImage.TYPE_INT_RGB); + { + Graphics2D st_g2d = st_Image.createGraphics(); + init(st_g2d); + draw(st_g2d, test, 10f, 12f, 3.0f); + draw(st_g2d, test, 10f, 24f, 1.0f); + draw(st_g2d, test, 10f, 36f, .33f); + } + + BufferedImage gv_Image = new BufferedImage(400, 400, BufferedImage.TYPE_INT_RGB); + { + Graphics2D gv_g2d = gv_Image.createGraphics(); + init(gv_g2d); + FontRenderContext frc = gv_g2d.getFontRenderContext(); + GlyphVector gv = gv_g2d.getFont().createGlyphVector(frc, test); + draw(gv_g2d, gv, 10f, 12f, 3.0f); + draw(gv_g2d, gv, 10f, 24f, 1.0f); + draw(gv_g2d, gv, 10f, 36f, .33f); + } + + compare(tl_Image, "textlayout", st_Image, "string"); + compare(gv_Image, "glyphvector", st_Image, "string"); + } +} diff --git a/test/jdk/sun/awt/windows/TestPen.java b/test/jdk/sun/awt/windows/TestPen.java new file mode 100644 index 000000000000..25b7304bdc86 --- /dev/null +++ b/test/jdk/sun/awt/windows/TestPen.java @@ -0,0 +1,102 @@ +/* + * Copyright (c) 1999, 2024, 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 4277201 + * @summary verifies that invoking a fill on a brand new Graphics object + * does not stroke the shape in addition to filling it + * @key headful + */ + +/* + * This test case tests for a problem with initializing GDI graphics + * contexts (HDCs) where a pen is left installed in the graphics object + * even though the AWT believes that there is no Pen installed. The + * result is that when you try to fill a shape, GDI will both fill and + * stroke it. +*/ + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.EventQueue; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Panel; +import java.awt.Point; +import java.awt.Rectangle; +import java.awt.Robot; +import java.awt.image.BufferedImage; + +public class TestPen extends Panel { + + static volatile TestPen pen; + static volatile Frame frame; + + public TestPen() { + setForeground(Color.black); + setBackground(Color.white); + } + + public Dimension getPreferredSize() { + return new Dimension(200, 200); + } + + public void paint(Graphics g) { + g.setColor(Color.green); + g.fillOval(50, 50, 100, 100); + } + + static void createUI() { + frame = new Frame(); + pen = new TestPen(); + frame.add(pen); + frame.pack(); + frame.setVisible(true); + } + + public static void main(String argv[]) throws Exception { + try { + EventQueue.invokeAndWait(TestPen::createUI); + Robot robot = new Robot(); + robot.waitForIdle(); + robot.delay(2000); + Point p = pen.getLocationOnScreen(); + Dimension d = pen.getSize(); + Rectangle r = new Rectangle(p.x + 1, p.y + 1, d.width - 2, d.height - 2); + BufferedImage bi = robot.createScreenCapture(r); + int blackPixel = Color.black.getRGB(); + for (int y = 0; y < bi.getHeight(); y++ ) { + for (int x = 0; x < bi.getWidth(); x++ ) { + if (bi.getRGB(x, y) == blackPixel) { + throw new RuntimeException("Black pixel !"); + } + } + } + } finally { + if (frame != null) { + EventQueue.invokeAndWait(frame::dispose); + } + } + } +} diff --git a/test/jdk/sun/java2d/loops/ARGBBgToRGB.java b/test/jdk/sun/java2d/loops/ARGBBgToRGB.java new file mode 100644 index 000000000000..55764af2c135 --- /dev/null +++ b/test/jdk/sun/java2d/loops/ARGBBgToRGB.java @@ -0,0 +1,57 @@ +/* + * Copyright (c) 1999, 2024, 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 4238978 + * @summary This test verifies that the correct blitting loop is being used. + * The correct output should have a yellow border on the top and + * left sides of a red box. The incorrect output would have only + * a red box -- no yellow border." + */ + +import java.awt.Color; +import java.awt.Graphics2D; +import java.awt.image.BufferedImage; + +public class ARGBBgToRGB { + + public static void main(String[] argv) { + BufferedImage bi = new BufferedImage(256, 256, BufferedImage.TYPE_INT_ARGB); + Graphics2D big = bi.createGraphics(); + big.setColor(Color.red); + big.fillRect(30, 30, 150, 150); + + BufferedImage bi2 = new BufferedImage(100, 100, BufferedImage.TYPE_INT_ARGB); + Graphics2D big2 = bi2.createGraphics(); + big2.drawImage(bi, 0, 0, Color.yellow, null); + + int expectYellowPix = bi2.getRGB(0, 0); + int expectRedPix = bi2.getRGB(50, 50); + if ((expectYellowPix != Color.yellow.getRGB()) || + (expectRedPix != Color.red.getRGB())) + { + throw new RuntimeException("Unexpected colors " + expectYellowPix + " " + expectRedPix); + } + } +} diff --git a/test/jdk/sun/java2d/loops/CopyNegative.java b/test/jdk/sun/java2d/loops/CopyNegative.java new file mode 100644 index 000000000000..0b8296918ac6 --- /dev/null +++ b/test/jdk/sun/java2d/loops/CopyNegative.java @@ -0,0 +1,103 @@ +/* + * Copyright (c) 1999, 2024, 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 4188744 + * @summary This test verifies that copyArea performs correctly for negative offset values. + * The correct output shows that the text area is moved to the left and down, + * leaving some garbage on the right and the top. + * The incorrect copy would show the text area garbled and no text is legible. + * @library /java/awt/regtesthelpers + * @build PassFailJFrame + * @run main/manual CopyNegative + */ + +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Frame; +import java.awt.Graphics; +import java.awt.Image; +import java.awt.Panel; + +public class CopyNegative extends Panel { + + private static final String INSTRUCTIONS = """ + This test verifies that copyArea performs correctly for negative offset values. + The test draws text in an image, then copies the contents repeatedly. + The correct output shows that the text is moved to the left and down, + leaving some garbage on the top / right and some legible text at the bottom left. + The incorrect copy would show the whole text area garbled and no text is legible. + """; + + public static void main(String[] argv) throws Exception { + PassFailJFrame.builder() + .title("CopyNegativeTest") + .instructions(INSTRUCTIONS) + .testUI(CopyNegative::createUI) + .testTimeOut(5) + .rows(10) + .columns(50) + .build() + .awaitAndCheck(); + } + + Image img; + + static final int W = 200, H = 200; + + static Frame createUI() { + Frame f = new Frame("CopyNegative"); + f.add(new CopyNegative()); + f.pack(); + return f; + } + + public Dimension getPreferredSize() { + return new Dimension(W, H); + } + + private void doCopy() { + Graphics g = img.getGraphics(); + g.setColor(Color.white); + g.fillRect(0, 0, W, H); + g.setColor(Color.black); + String text = "Some Text To Display, it is long enough to fill the entire display line."; + StringBuffer sb = new StringBuffer(text); + + for (int i = 1; i < 50; i++) { + g.drawString(sb.toString(), 5,20 * i - 10); + sb.insert(0, Integer.toString(i)); + } + for (int i = 0 ; i < 20 ; i++ ) { + g.copyArea(0, 0, W, H, -3, 3); + } + } + + public void paint(Graphics g) { + img = createImage(W, H); + doCopy(); + g.drawImage(img, 0, 0, this); + } + +} diff --git a/test/jdk/sun/java2d/loops/DitheredSolidFill.java b/test/jdk/sun/java2d/loops/DitheredSolidFill.java new file mode 100644 index 000000000000..509b0bbe3b23 --- /dev/null +++ b/test/jdk/sun/java2d/loops/DitheredSolidFill.java @@ -0,0 +1,73 @@ +/* + * Copyright (c) 1999, 2024, 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 4181172 + * @summary Confirm that solid white fill is not dithered on an 8-bit indexed surface. + * The test draws two areas filled with white solid color. + * The upper left square is filled in aliasing mode and + * the lower right square is filled in anti-aliasing mode. + */ + +import java.awt.Color; +import java.awt.Graphics2D; +import java.awt.RenderingHints; +import java.awt.image.BufferedImage; + +public class DitheredSolidFill { + + public static void main(String args[]) { + BufferedImage bi = new BufferedImage(120, 120, BufferedImage.TYPE_BYTE_INDEXED); + Graphics2D g2D = bi.createGraphics(); + + g2D.setColor(Color.black); + g2D.fillRect(0, 0, 100, 100); + + g2D.setColor(Color.white); + g2D.fillRect(5, 5, 40, 40); + checkPixels(bi, 5, 5, 40, 40); + + g2D.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); + g2D.fillRect(55, 55, 40, 40); + checkPixels(bi, 55, 55, 40, 40); + } + + static void checkPixels(BufferedImage bi, int x, int y, int w, int h) { + // pixel can be off white, but must be the same in all cases. + int expectedPix = bi.getRGB(x, y); + for (int x0 = x; x0 < x + w; x0++) { + for (int y0 = y; y0 < y + h; y0++) { + if (bi.getRGB(x0, y0) != expectedPix) { + try { + javax.imageio.ImageIO.write(bi, "png", new java.io.File("failed.png")); + } catch (Exception e) { + } + throw new RuntimeException("Not expected pix : " + + Integer.toHexString(bi.getRGB(x0, y0)) + + " at " + x0 + "," + y0); + } + } + } + } +} diff --git a/test/jdk/sun/java2d/loops/GraphicsPrimitiveMgrTest.java b/test/jdk/sun/java2d/loops/GraphicsPrimitiveMgrTest.java index 3dacf7083d29..b41f8c57207b 100644 --- a/test/jdk/sun/java2d/loops/GraphicsPrimitiveMgrTest.java +++ b/test/jdk/sun/java2d/loops/GraphicsPrimitiveMgrTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sun/java2d/loops/OffsetCalculationTest.java b/test/jdk/sun/java2d/loops/OffsetCalculationTest.java new file mode 100644 index 000000000000..fe30107f22a9 --- /dev/null +++ b/test/jdk/sun/java2d/loops/OffsetCalculationTest.java @@ -0,0 +1,68 @@ +/* + * Copyright (c) 1999, 2024, 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 4236576 + @summary tests that a BufferedImage in TYPE_3BYTE_BGR format is correctly + drawn when there is an offset between the Graphics clip bounds + and the clip box of the underlying device context. + @run main OffsetCalculationTest +*/ + +import java.awt.Color; +import java.awt.Graphics2D; +import java.awt.Rectangle; +import java.awt.image.BufferedImage; +import java.awt.image.DataBuffer; + +public class OffsetCalculationTest { + + public static void main(String[] args) { + BufferedImage srcImage = new BufferedImage(500, 500, BufferedImage.TYPE_3BYTE_BGR); + + DataBuffer buffer = srcImage.getRaster().getDataBuffer(); + for (int i = 2; i < buffer.getSize(); i+=3) { + // setting each pixel to blue via the data buffer elements. + buffer.setElem(i - 2, 0xff); + buffer.setElem(i - 1, 0); + buffer.setElem(i, 0); + } + + int w = 200, h = 200; + BufferedImage destImage = new BufferedImage(w, h, BufferedImage.TYPE_3BYTE_BGR); + Graphics2D g = destImage.createGraphics(); + Rectangle r = new Rectangle(0, 0, w, h); + g.setClip(r.x - 1, r.y, r.width + 1, r.height); + g.drawImage(srcImage, 0, 0, null); + + int bluepix = Color.blue.getRGB(); + for (int y = 0; y < w; y++) { + for (int x = 0; x < h; x++) { + if (destImage.getRGB(x, y) != bluepix) { + throw new RuntimeException("Not Blue"); + } + } + } + } +} diff --git a/test/jdk/sun/java2d/loops/XORClearRect.java b/test/jdk/sun/java2d/loops/XORClearRect.java new file mode 100644 index 000000000000..f5c30581cf1f --- /dev/null +++ b/test/jdk/sun/java2d/loops/XORClearRect.java @@ -0,0 +1,93 @@ +/* + * Copyright (c) 1999, 2024, 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 4088173 + * @summary This interactive test verifies that the XOR mode is not affecting + * the clearRect() call. The correct output looks like: + * + * \ / + * \ / + * The backgound is blue. + * The lines outside the central rectangle are green. + * The central rectangle is also blue (the result of clearRect()) + * / \ + * / \ + * + * @key headful + * @run main XORClearRect + */ + +import java.awt.Color; +import java.awt.EventQueue; +import java.awt.Graphics; +import java.awt.Frame; +import java.awt.Panel; +import java.awt.Point; +import java.awt.Robot; + +public class XORClearRect extends Panel { + + public static void main(String args[]) throws Exception { + EventQueue.invokeAndWait(XORClearRect::createUI); + try { + Robot robot = new Robot(); + robot.waitForIdle(); + robot.delay(2000); + Point p = frame.getLocationOnScreen(); + int pix = robot.getPixelColor(p.x + 100, p.y + 100).getRGB(); + if (pix != Color.blue.getRGB()) { + throw new RuntimeException("Not blue"); + } + } finally { + if (frame != null) { + EventQueue.invokeAndWait(frame::dispose); + } + } + } + + static volatile Frame frame; + + static void createUI() { + frame = new Frame("XORClearRect"); + frame.setBackground(Color.blue); + XORClearRect xor = new XORClearRect(); + frame.add(xor); + frame.setSize(200,200); + frame.setVisible(true); + } + + public XORClearRect() { + setBackground(Color.blue); + } + + public void paint(Graphics g) { + g.setColor(Color.green); + g.drawLine(0,0,200,200); + g.drawLine(0,200,200,0); + g.setXORMode(Color.blue); + g.clearRect(50,50,100,100); //expecting the rectangle to be filled + // with the background color (blue) + } +} diff --git a/test/jdk/sun/jvmstat/monitor/MonitoredVm/ConcurrentGetMonitoredHost.java b/test/jdk/sun/jvmstat/monitor/MonitoredVm/ConcurrentGetMonitoredHost.java new file mode 100644 index 000000000000..333981bd1ff0 --- /dev/null +++ b/test/jdk/sun/jvmstat/monitor/MonitoredVm/ConcurrentGetMonitoredHost.java @@ -0,0 +1,90 @@ +/* + * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.util.ArrayList; +import java.util.List; +import java.util.Objects; +import java.util.concurrent.Callable; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; +import java.util.concurrent.Future; + +import sun.jvmstat.monitor.MonitoredHost; +import sun.jvmstat.monitor.VmIdentifier; + +/* + * @test + * @bug 8320687 + * @summary verify that sun.jvmstat.monitor.MonitoredHost.getMonitoredHost() doesn't + * unexpectedly throw an exception when invoked by concurrent threads + * + * @run main/othervm ConcurrentGetMonitoredHost + */ +public class ConcurrentGetMonitoredHost { + + /* + * Launches multiple concurrent threads and invokes MonitoredHost.getMonitoredHost() + * in each of these threads and expects the call to return successfully without any + * exceptions. + */ + public static void main(final String[] args) throws Exception { + final String pidStr = "12345"; + final VmIdentifier vmid = new VmIdentifier(pidStr); + final int numTasks = 100; + final List tasks = new ArrayList<>(); + for (int i = 0; i < numTasks; i++) { + tasks.add(new Task(vmid)); + } + System.out.println("Submitting " + numTasks + " concurrent tasks to" + + " get MonitoredHost for " + vmid); + try (ExecutorService executor = Executors.newCachedThreadPool()) { + // wait for all tasks to complete + final List> results = executor.invokeAll(tasks); + // verify each one successfully completed and each of + // the returned MonitoredHost is not null + for (final Future result : results) { + final MonitoredHost mh = result.get(); + if (mh == null) { + throw new AssertionError("MonitoredHost.getMonitoredHost() returned" + + " null for vmid " + vmid); + } + } + } + System.out.println("All " + numTasks + " completed successfully"); + } + + // a task which just calls MonitoredHost.getMonitoredHost(VmIdentifier) and + // returns the resultant MonitoredHost + private static final class Task implements Callable { + private final VmIdentifier vmid; + + private Task(final VmIdentifier vmid) { + this.vmid = Objects.requireNonNull(vmid); + } + + @Override + public MonitoredHost call() throws Exception { + return MonitoredHost.getMonitoredHost(this.vmid); + } + } +} diff --git a/test/jdk/sun/management/jdp/DynamicLauncher.java b/test/jdk/sun/management/jdp/DynamicLauncher.java index 9102fe32a94d..b79672211b1e 100644 --- a/test/jdk/sun/management/jdp/DynamicLauncher.java +++ b/test/jdk/sun/management/jdp/DynamicLauncher.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, 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 @@ -37,6 +37,8 @@ */ public abstract class DynamicLauncher { + private static final int MAX_RETRY_ATTEMPTS = 10; + final String jdpName = UUID.randomUUID().toString(); OutputAnalyzer output; int jmxPort; @@ -52,7 +54,7 @@ protected void run() throws Exception { try { output.shouldNotContain("Port already in use"); } catch (RuntimeException e) { - if (retries < 3) { + if (retries < MAX_RETRY_ATTEMPTS) { retries++; tryAgain = true; } diff --git a/test/jdk/sun/management/jmxremote/bootstrap/JMXInterfaceBindingTest.java b/test/jdk/sun/management/jmxremote/bootstrap/JMXInterfaceBindingTest.java index c062f7c75b89..61359084297d 100644 --- a/test/jdk/sun/management/jmxremote/bootstrap/JMXInterfaceBindingTest.java +++ b/test/jdk/sun/management/jmxremote/bootstrap/JMXInterfaceBindingTest.java @@ -52,7 +52,7 @@ public class JMXInterfaceBindingTest { public static final int JMX_PORT_RANGE_UPPER = 9200; public static final int JMX_PORT_RANGE_LOWER_SSL = 9201; // 9200 might be RMI Port public static final int JMX_PORT_RANGE_UPPER_SSL = 9300; - private static final int MAX_RETRY_ATTEMTS = 10; + private static final int MAX_RETRY_ATTEMPTS = 10; public static final String READY_MSG = "MainThread: Ready for connections"; public static final String TEST_CLASS = JMXAgentInterfaceBinding.class.getSimpleName(); public static final String KEYSTORE_LOC = System.getProperty("test.src", ".") + @@ -159,7 +159,7 @@ public void run() { System.err.println("Retrying the test for " + name); } needRetry = runTest(); - } while (needRetry && (attempts++ < MAX_RETRY_ATTEMTS)); + } while (needRetry && (attempts++ < MAX_RETRY_ATTEMPTS)); if (testFailed) { int exitValue = output.getExitValue(); diff --git a/test/jdk/sun/misc/SunMiscSignalTest.java b/test/jdk/sun/misc/SunMiscSignalTest.java index ff88ccf24850..e6bc7e976e3d 100644 --- a/test/jdk/sun/misc/SunMiscSignalTest.java +++ b/test/jdk/sun/misc/SunMiscSignalTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sun/net/www/protocol/jar/FileURLConnectionLeak.java b/test/jdk/sun/net/www/protocol/jar/FileURLConnectionLeak.java new file mode 100644 index 000000000000..5ff687ca42df --- /dev/null +++ b/test/jdk/sun/net/www/protocol/jar/FileURLConnectionLeak.java @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2023, 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 6956385 + * @summary JarURLConnection may fail to close its underlying FileURLConnection + * @run main/othervm FileURLConnectionLeak + */ + +import java.net.URI; +import java.net.URLConnection; +import java.nio.file.Files; +import java.nio.file.Path; +import java.util.jar.Attributes; +import java.util.jar.JarOutputStream; +import java.util.jar.Manifest; +public class FileURLConnectionLeak { + public static void main(String[] args) throws Exception { + URLConnection.setDefaultUseCaches("file", false); + URLConnection.setDefaultUseCaches("jar", false); + var jar = Path.of("x.jar").toAbsolutePath(); + var mani = new Manifest(); + mani.getMainAttributes().put(Attributes.Name.MANIFEST_VERSION, "1.0"); + try (var os = Files.newOutputStream(jar); var jos = new JarOutputStream(os, mani)) {} + var u = URI.create("jar:" + jar.toUri() + "!/META-INF/MANIFEST.MF").toURL(); + // FileURLConnection.is not used, so was always fine: + try (var is = u.openStream()) { + is.transferTo(System.out); + } + // FileURLConnection.is opened implicitly: + var conn = u.openConnection(); + conn.getLastModified(); + // Idiom to close URLConnection (cf. JDK-8224095), which must also close the other stream: + conn.getInputStream().close(); + var fds = Path.of("/proc/" + ProcessHandle.current().pid() + "/fd"); + if (Files.isDirectory(fds)) { + // Linux: verify that x.jar is not open + for (var fd : (Iterable) Files.list(fds)::iterator) { + if (Files.isSymbolicLink(fd)) { + var file = Files.readSymbolicLink(fd); + if (file.equals(jar)) { + throw new IllegalStateException("Still held open " + jar + " from " + fd); + } + } + } + } + // Windows: verify that mandatory file locks do not prevent deletion + Files.delete(jar); + } +} diff --git a/test/jdk/sun/nio/cs/OLD/DBCSDecoderMapping.java b/test/jdk/sun/nio/cs/OLD/DBCSDecoderMapping.java index 2210f0271584..d629d0d899f9 100644 --- a/test/jdk/sun/nio/cs/OLD/DBCSDecoderMapping.java +++ b/test/jdk/sun/nio/cs/OLD/DBCSDecoderMapping.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sun/nio/cs/OLD/DBCS_IBM_ASCII_Decoder.java b/test/jdk/sun/nio/cs/OLD/DBCS_IBM_ASCII_Decoder.java index 6c271e7e89a2..49c0c0c8f5b7 100644 --- a/test/jdk/sun/nio/cs/OLD/DBCS_IBM_ASCII_Decoder.java +++ b/test/jdk/sun/nio/cs/OLD/DBCS_IBM_ASCII_Decoder.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sun/nio/cs/OLD/DBCS_IBM_ASCII_Encoder.java b/test/jdk/sun/nio/cs/OLD/DBCS_IBM_ASCII_Encoder.java index c6819914c901..0b228eb586f1 100644 --- a/test/jdk/sun/nio/cs/OLD/DBCS_IBM_ASCII_Encoder.java +++ b/test/jdk/sun/nio/cs/OLD/DBCS_IBM_ASCII_Encoder.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sun/nio/cs/OLD/DBCS_IBM_EBCDIC_Decoder.java b/test/jdk/sun/nio/cs/OLD/DBCS_IBM_EBCDIC_Decoder.java index 9fe702715fec..eb2ed7a17b5e 100644 --- a/test/jdk/sun/nio/cs/OLD/DBCS_IBM_EBCDIC_Decoder.java +++ b/test/jdk/sun/nio/cs/OLD/DBCS_IBM_EBCDIC_Decoder.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sun/nio/cs/OLD/DBCS_IBM_EBCDIC_Encoder.java b/test/jdk/sun/nio/cs/OLD/DBCS_IBM_EBCDIC_Encoder.java index dde25fe335ae..8c527d7560ec 100644 --- a/test/jdk/sun/nio/cs/OLD/DBCS_IBM_EBCDIC_Encoder.java +++ b/test/jdk/sun/nio/cs/OLD/DBCS_IBM_EBCDIC_Encoder.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sun/nio/cs/OLD/DBCS_ONLY_IBM_EBCDIC_Decoder.java b/test/jdk/sun/nio/cs/OLD/DBCS_ONLY_IBM_EBCDIC_Decoder.java index dd5a08812fe1..150c69b78af4 100644 --- a/test/jdk/sun/nio/cs/OLD/DBCS_ONLY_IBM_EBCDIC_Decoder.java +++ b/test/jdk/sun/nio/cs/OLD/DBCS_ONLY_IBM_EBCDIC_Decoder.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sun/nio/cs/OLD/DoubleByteDecoder.java b/test/jdk/sun/nio/cs/OLD/DoubleByteDecoder.java index 97748a1cb53c..bab40fff498a 100644 --- a/test/jdk/sun/nio/cs/OLD/DoubleByteDecoder.java +++ b/test/jdk/sun/nio/cs/OLD/DoubleByteDecoder.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sun/nio/cs/OLD/DoubleByteEncoder.java b/test/jdk/sun/nio/cs/OLD/DoubleByteEncoder.java index 505a583f8711..277cf3082af5 100644 --- a/test/jdk/sun/nio/cs/OLD/DoubleByteEncoder.java +++ b/test/jdk/sun/nio/cs/OLD/DoubleByteEncoder.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sun/nio/cs/OLD/EUC_CN_OLD.java b/test/jdk/sun/nio/cs/OLD/EUC_CN_OLD.java index 2308b6e9b703..ec7ca71eb01b 100644 --- a/test/jdk/sun/nio/cs/OLD/EUC_CN_OLD.java +++ b/test/jdk/sun/nio/cs/OLD/EUC_CN_OLD.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sun/nio/cs/OLD/EUC_JP_LINUX_OLD.java b/test/jdk/sun/nio/cs/OLD/EUC_JP_LINUX_OLD.java index d4bebb61da1b..b54531958242 100644 --- a/test/jdk/sun/nio/cs/OLD/EUC_JP_LINUX_OLD.java +++ b/test/jdk/sun/nio/cs/OLD/EUC_JP_LINUX_OLD.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sun/nio/cs/OLD/EUC_JP_OLD.java b/test/jdk/sun/nio/cs/OLD/EUC_JP_OLD.java index 94fa1730d0ca..63186ef91bbb 100644 --- a/test/jdk/sun/nio/cs/OLD/EUC_JP_OLD.java +++ b/test/jdk/sun/nio/cs/OLD/EUC_JP_OLD.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sun/nio/cs/OLD/EUC_JP_Open_OLD.java b/test/jdk/sun/nio/cs/OLD/EUC_JP_Open_OLD.java index 554d8e645558..ab6064a94034 100644 --- a/test/jdk/sun/nio/cs/OLD/EUC_JP_Open_OLD.java +++ b/test/jdk/sun/nio/cs/OLD/EUC_JP_Open_OLD.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sun/nio/cs/OLD/EUC_KR_OLD.java b/test/jdk/sun/nio/cs/OLD/EUC_KR_OLD.java index dd8169a3eecc..d7150f05f9b9 100644 --- a/test/jdk/sun/nio/cs/OLD/EUC_KR_OLD.java +++ b/test/jdk/sun/nio/cs/OLD/EUC_KR_OLD.java @@ -5,9 +5,7 @@ * * 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. + * 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 diff --git a/test/jdk/sun/nio/cs/OLD/GBK_OLD.java b/test/jdk/sun/nio/cs/OLD/GBK_OLD.java index cb6544c8b8ba..0599ad4edf91 100644 --- a/test/jdk/sun/nio/cs/OLD/GBK_OLD.java +++ b/test/jdk/sun/nio/cs/OLD/GBK_OLD.java @@ -5,9 +5,7 @@ * * 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. + * 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 diff --git a/test/jdk/sun/nio/cs/OLD/IBM1381_OLD.java b/test/jdk/sun/nio/cs/OLD/IBM1381_OLD.java index 50747812239d..7f93d677e5c2 100644 --- a/test/jdk/sun/nio/cs/OLD/IBM1381_OLD.java +++ b/test/jdk/sun/nio/cs/OLD/IBM1381_OLD.java @@ -5,9 +5,7 @@ * * 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. + * 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 diff --git a/test/jdk/sun/nio/cs/OLD/IBM1383_OLD.java b/test/jdk/sun/nio/cs/OLD/IBM1383_OLD.java index cfa2ad1782db..162294a46952 100644 --- a/test/jdk/sun/nio/cs/OLD/IBM1383_OLD.java +++ b/test/jdk/sun/nio/cs/OLD/IBM1383_OLD.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sun/nio/cs/OLD/IBM930_OLD.java b/test/jdk/sun/nio/cs/OLD/IBM930_OLD.java index fde816408aab..0f6e8afdc4c2 100644 --- a/test/jdk/sun/nio/cs/OLD/IBM930_OLD.java +++ b/test/jdk/sun/nio/cs/OLD/IBM930_OLD.java @@ -5,9 +5,7 @@ * * 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. + * 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 diff --git a/test/jdk/sun/nio/cs/OLD/IBM933_OLD.java b/test/jdk/sun/nio/cs/OLD/IBM933_OLD.java index 0b116da2aa20..0bd4ce95439f 100644 --- a/test/jdk/sun/nio/cs/OLD/IBM933_OLD.java +++ b/test/jdk/sun/nio/cs/OLD/IBM933_OLD.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sun/nio/cs/OLD/IBM935_OLD.java b/test/jdk/sun/nio/cs/OLD/IBM935_OLD.java index c9f554ee9b38..ba048239278a 100644 --- a/test/jdk/sun/nio/cs/OLD/IBM935_OLD.java +++ b/test/jdk/sun/nio/cs/OLD/IBM935_OLD.java @@ -5,9 +5,7 @@ * * 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. + * 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 diff --git a/test/jdk/sun/nio/cs/OLD/IBM937_OLD.java b/test/jdk/sun/nio/cs/OLD/IBM937_OLD.java index 9419b30d03f3..665ab1656253 100644 --- a/test/jdk/sun/nio/cs/OLD/IBM937_OLD.java +++ b/test/jdk/sun/nio/cs/OLD/IBM937_OLD.java @@ -5,9 +5,7 @@ * * 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. + * 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 diff --git a/test/jdk/sun/nio/cs/OLD/IBM939_OLD.java b/test/jdk/sun/nio/cs/OLD/IBM939_OLD.java index 04ffe2859b99..3e7ecf46b114 100644 --- a/test/jdk/sun/nio/cs/OLD/IBM939_OLD.java +++ b/test/jdk/sun/nio/cs/OLD/IBM939_OLD.java @@ -5,9 +5,7 @@ * * 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. + * 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 diff --git a/test/jdk/sun/nio/cs/OLD/IBM942C_OLD.java b/test/jdk/sun/nio/cs/OLD/IBM942C_OLD.java index 598fae0a630f..c89dc75b26ca 100644 --- a/test/jdk/sun/nio/cs/OLD/IBM942C_OLD.java +++ b/test/jdk/sun/nio/cs/OLD/IBM942C_OLD.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sun/nio/cs/OLD/IBM942_OLD.java b/test/jdk/sun/nio/cs/OLD/IBM942_OLD.java index 66636f1f6e29..ede863c1262f 100644 --- a/test/jdk/sun/nio/cs/OLD/IBM942_OLD.java +++ b/test/jdk/sun/nio/cs/OLD/IBM942_OLD.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sun/nio/cs/OLD/IBM943C_OLD.java b/test/jdk/sun/nio/cs/OLD/IBM943C_OLD.java index f5d95f61b443..67edfd85ed91 100644 --- a/test/jdk/sun/nio/cs/OLD/IBM943C_OLD.java +++ b/test/jdk/sun/nio/cs/OLD/IBM943C_OLD.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sun/nio/cs/OLD/IBM943_OLD.java b/test/jdk/sun/nio/cs/OLD/IBM943_OLD.java index 3a6a558db1e9..f1a65f188fce 100644 --- a/test/jdk/sun/nio/cs/OLD/IBM943_OLD.java +++ b/test/jdk/sun/nio/cs/OLD/IBM943_OLD.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sun/nio/cs/OLD/IBM948_OLD.java b/test/jdk/sun/nio/cs/OLD/IBM948_OLD.java index 5d2b4bf0c6e2..b48928f001c5 100644 --- a/test/jdk/sun/nio/cs/OLD/IBM948_OLD.java +++ b/test/jdk/sun/nio/cs/OLD/IBM948_OLD.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sun/nio/cs/OLD/IBM949C_OLD.java b/test/jdk/sun/nio/cs/OLD/IBM949C_OLD.java index 5d6581e3547b..dd25e5bdcb9a 100644 --- a/test/jdk/sun/nio/cs/OLD/IBM949C_OLD.java +++ b/test/jdk/sun/nio/cs/OLD/IBM949C_OLD.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sun/nio/cs/OLD/IBM949_OLD.java b/test/jdk/sun/nio/cs/OLD/IBM949_OLD.java index 6b09ab79f4d8..4ac497673311 100644 --- a/test/jdk/sun/nio/cs/OLD/IBM949_OLD.java +++ b/test/jdk/sun/nio/cs/OLD/IBM949_OLD.java @@ -5,9 +5,7 @@ * * 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. + * 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 diff --git a/test/jdk/sun/nio/cs/OLD/IBM950_OLD.java b/test/jdk/sun/nio/cs/OLD/IBM950_OLD.java index c9ad905a97c3..7cb3877d0986 100644 --- a/test/jdk/sun/nio/cs/OLD/IBM950_OLD.java +++ b/test/jdk/sun/nio/cs/OLD/IBM950_OLD.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sun/nio/cs/OLD/IBM970_OLD.java b/test/jdk/sun/nio/cs/OLD/IBM970_OLD.java index d6df2048c394..15b42ea17ecf 100644 --- a/test/jdk/sun/nio/cs/OLD/IBM970_OLD.java +++ b/test/jdk/sun/nio/cs/OLD/IBM970_OLD.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sun/nio/cs/OLD/JIS_X_0201_OLD.java b/test/jdk/sun/nio/cs/OLD/JIS_X_0201_OLD.java index add11764288b..b975990dfffe 100644 --- a/test/jdk/sun/nio/cs/OLD/JIS_X_0201_OLD.java +++ b/test/jdk/sun/nio/cs/OLD/JIS_X_0201_OLD.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sun/nio/cs/OLD/JIS_X_0208_Decoder.java b/test/jdk/sun/nio/cs/OLD/JIS_X_0208_Decoder.java index d64010dfa382..a3622b53e09f 100644 --- a/test/jdk/sun/nio/cs/OLD/JIS_X_0208_Decoder.java +++ b/test/jdk/sun/nio/cs/OLD/JIS_X_0208_Decoder.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sun/nio/cs/OLD/JIS_X_0208_Encoder.java b/test/jdk/sun/nio/cs/OLD/JIS_X_0208_Encoder.java index 412d61eb6416..63007e556f6e 100644 --- a/test/jdk/sun/nio/cs/OLD/JIS_X_0208_Encoder.java +++ b/test/jdk/sun/nio/cs/OLD/JIS_X_0208_Encoder.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sun/nio/cs/OLD/JIS_X_0208_OLD.java b/test/jdk/sun/nio/cs/OLD/JIS_X_0208_OLD.java index 570d3ccd0874..225f4713240d 100644 --- a/test/jdk/sun/nio/cs/OLD/JIS_X_0208_OLD.java +++ b/test/jdk/sun/nio/cs/OLD/JIS_X_0208_OLD.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sun/nio/cs/OLD/JIS_X_0208_Solaris_Decoder.java b/test/jdk/sun/nio/cs/OLD/JIS_X_0208_Solaris_Decoder.java index 1359ee6df2a6..8dc06a422544 100644 --- a/test/jdk/sun/nio/cs/OLD/JIS_X_0208_Solaris_Decoder.java +++ b/test/jdk/sun/nio/cs/OLD/JIS_X_0208_Solaris_Decoder.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sun/nio/cs/OLD/JIS_X_0208_Solaris_Encoder.java b/test/jdk/sun/nio/cs/OLD/JIS_X_0208_Solaris_Encoder.java index cb06cdbedd33..f99acb9a1cee 100644 --- a/test/jdk/sun/nio/cs/OLD/JIS_X_0208_Solaris_Encoder.java +++ b/test/jdk/sun/nio/cs/OLD/JIS_X_0208_Solaris_Encoder.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sun/nio/cs/OLD/JIS_X_0212_Decoder.java b/test/jdk/sun/nio/cs/OLD/JIS_X_0212_Decoder.java index 03d6d7fbab87..af9c32d9f887 100644 --- a/test/jdk/sun/nio/cs/OLD/JIS_X_0212_Decoder.java +++ b/test/jdk/sun/nio/cs/OLD/JIS_X_0212_Decoder.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sun/nio/cs/OLD/JIS_X_0212_Encoder.java b/test/jdk/sun/nio/cs/OLD/JIS_X_0212_Encoder.java index f44ecf123626..908a757adc66 100644 --- a/test/jdk/sun/nio/cs/OLD/JIS_X_0212_Encoder.java +++ b/test/jdk/sun/nio/cs/OLD/JIS_X_0212_Encoder.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sun/nio/cs/OLD/JIS_X_0212_OLD.java b/test/jdk/sun/nio/cs/OLD/JIS_X_0212_OLD.java index 63813d049a0b..b716463dc4d3 100644 --- a/test/jdk/sun/nio/cs/OLD/JIS_X_0212_OLD.java +++ b/test/jdk/sun/nio/cs/OLD/JIS_X_0212_OLD.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sun/nio/cs/OLD/JIS_X_0212_Solaris_Decoder.java b/test/jdk/sun/nio/cs/OLD/JIS_X_0212_Solaris_Decoder.java index 49ac7459d84d..7b65db639f77 100644 --- a/test/jdk/sun/nio/cs/OLD/JIS_X_0212_Solaris_Decoder.java +++ b/test/jdk/sun/nio/cs/OLD/JIS_X_0212_Solaris_Decoder.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sun/nio/cs/OLD/JIS_X_0212_Solaris_Encoder.java b/test/jdk/sun/nio/cs/OLD/JIS_X_0212_Solaris_Encoder.java index a8f6f5ea2c0e..1ef18c7074db 100644 --- a/test/jdk/sun/nio/cs/OLD/JIS_X_0212_Solaris_Encoder.java +++ b/test/jdk/sun/nio/cs/OLD/JIS_X_0212_Solaris_Encoder.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sun/nio/cs/OLD/Johab_OLD.java b/test/jdk/sun/nio/cs/OLD/Johab_OLD.java index 73963c10feee..13c6500263ac 100644 --- a/test/jdk/sun/nio/cs/OLD/Johab_OLD.java +++ b/test/jdk/sun/nio/cs/OLD/Johab_OLD.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sun/nio/cs/OLD/MS932DB.java b/test/jdk/sun/nio/cs/OLD/MS932DB.java index 2a8c2efaa121..6c313c0a06ff 100644 --- a/test/jdk/sun/nio/cs/OLD/MS932DB.java +++ b/test/jdk/sun/nio/cs/OLD/MS932DB.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sun/nio/cs/OLD/MS932_OLD.java b/test/jdk/sun/nio/cs/OLD/MS932_OLD.java index 0f1dd889c769..11ff8953239f 100644 --- a/test/jdk/sun/nio/cs/OLD/MS932_OLD.java +++ b/test/jdk/sun/nio/cs/OLD/MS932_OLD.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sun/nio/cs/OLD/MS936_OLD.java b/test/jdk/sun/nio/cs/OLD/MS936_OLD.java index d80eecc3ec52..18fd3e46c355 100644 --- a/test/jdk/sun/nio/cs/OLD/MS936_OLD.java +++ b/test/jdk/sun/nio/cs/OLD/MS936_OLD.java @@ -5,9 +5,7 @@ * * 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. + * 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 diff --git a/test/jdk/sun/nio/cs/OLD/MS949_OLD.java b/test/jdk/sun/nio/cs/OLD/MS949_OLD.java index 5464585ee957..8ad51d168b3a 100644 --- a/test/jdk/sun/nio/cs/OLD/MS949_OLD.java +++ b/test/jdk/sun/nio/cs/OLD/MS949_OLD.java @@ -5,9 +5,7 @@ * * 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. + * 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 diff --git a/test/jdk/sun/nio/cs/OLD/MS950_OLD.java b/test/jdk/sun/nio/cs/OLD/MS950_OLD.java index 7425ccff8e6e..d66e44090e95 100644 --- a/test/jdk/sun/nio/cs/OLD/MS950_OLD.java +++ b/test/jdk/sun/nio/cs/OLD/MS950_OLD.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sun/nio/cs/OLD/PCK_OLD.java b/test/jdk/sun/nio/cs/OLD/PCK_OLD.java index 9fcd98537951..a4f8c63a2bf3 100644 --- a/test/jdk/sun/nio/cs/OLD/PCK_OLD.java +++ b/test/jdk/sun/nio/cs/OLD/PCK_OLD.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sun/nio/cs/OLD/SJIS_OLD.java b/test/jdk/sun/nio/cs/OLD/SJIS_OLD.java index 343e0525f70b..2647e3a7d191 100644 --- a/test/jdk/sun/nio/cs/OLD/SJIS_OLD.java +++ b/test/jdk/sun/nio/cs/OLD/SJIS_OLD.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sun/nio/cs/OLD/SimpleEUCDecoder.java b/test/jdk/sun/nio/cs/OLD/SimpleEUCDecoder.java index ff4dd302938e..ee9e267e6cf2 100644 --- a/test/jdk/sun/nio/cs/OLD/SimpleEUCDecoder.java +++ b/test/jdk/sun/nio/cs/OLD/SimpleEUCDecoder.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sun/nio/cs/OLD/SingleByteDecoder.java b/test/jdk/sun/nio/cs/OLD/SingleByteDecoder.java index 1e1b0912673f..b3d1972bf589 100644 --- a/test/jdk/sun/nio/cs/OLD/SingleByteDecoder.java +++ b/test/jdk/sun/nio/cs/OLD/SingleByteDecoder.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sun/nio/cs/OLD/SingleByteEncoder.java b/test/jdk/sun/nio/cs/OLD/SingleByteEncoder.java index 6c9b6f928ebd..fb488297367a 100644 --- a/test/jdk/sun/nio/cs/OLD/SingleByteEncoder.java +++ b/test/jdk/sun/nio/cs/OLD/SingleByteEncoder.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sun/nio/cs/StreamEncoderClose.java b/test/jdk/sun/nio/cs/StreamEncoderClose.java index 68b4111fb476..8e0d259536cf 100644 --- a/test/jdk/sun/nio/cs/StreamEncoderClose.java +++ b/test/jdk/sun/nio/cs/StreamEncoderClose.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2008, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2008, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -31,6 +31,15 @@ import java.io.*; public class StreamEncoderClose { + private static void ck(String s, int actual, int expected) + throws IOException { + if (actual != expected) { + String msg = String.format("%s: actual (%d) != expected (%d)%n", + s, actual, expected); + throw new IOException(msg); + } + } + public static void main( String arg[] ) throws Exception { byte[] expected = {(byte)0x1b,(byte)0x24,(byte)0x42, (byte)0x30,(byte)0x6c, @@ -46,13 +55,10 @@ public static void main( String arg[] ) throws Exception { //double check, probably not necessary byte[] out = baos.toByteArray(); - if (out.length != expected.length) { - throw new IOException("Failed"); - } + ck("Lengths are unequal", out.length, expected.length); for (int i = 0; i < out.length; i++) { //System.out.printf("(byte)0x%x,", out[i] & 0xff); - if (out[i] != expected[i]) - throw new IOException("Failed"); + ck("Values are unequal", out[i], expected[i]); } } diff --git a/test/jdk/sun/nio/cs/TestUnmappable.java b/test/jdk/sun/nio/cs/TestUnmappable.java index 8204fdf4d10b..81c141e5cd7a 100644 --- a/test/jdk/sun/nio/cs/TestUnmappable.java +++ b/test/jdk/sun/nio/cs/TestUnmappable.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sun/security/ec/TestEC.java b/test/jdk/sun/security/ec/TestEC.java index dacb67ce892f..3720df03e1fd 100644 --- a/test/jdk/sun/security/ec/TestEC.java +++ b/test/jdk/sun/security/ec/TestEC.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,7 +34,6 @@ * @library ../pkcs11 * @library ../pkcs11/ec * @library ../pkcs11/sslecc - * @library ../../../java/security/testlibrary * @library ../../../javax/net/ssl/TLSCommon * @modules jdk.crypto.cryptoki/sun.security.pkcs11.wrapper * @run main/othervm -Djdk.tls.namedGroups="secp256r1" TestEC @@ -45,6 +44,7 @@ import java.security.NoSuchProviderException; import java.security.Provider; import java.security.Security; +import jdk.test.lib.security.ProvidersSnapshot; /* * Leverage the collection of EC tests used by PKCS11 diff --git a/test/jdk/sun/security/jca/NullPreferredList.java b/test/jdk/sun/security/jca/NullPreferredList.java new file mode 100644 index 000000000000..0a8cf73443c2 --- /dev/null +++ b/test/jdk/sun/security/jca/NullPreferredList.java @@ -0,0 +1,41 @@ +/* + * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +import java.security.*; + +/** + * @test + * @bug 8328864 + * @summary Test that ProviderList.getService checks configs when + * ProviderList.getProvider fails for preferred providers. + * @run main/othervm + * -Djava.security.properties=${test.src}/app-security.properties NullPreferredList + */ + +public class NullPreferredList { + + public static void main(final String[] args) throws Exception { + final KeyStore ks = KeyStore.getInstance("PKCS12"); + System.out.println("Got keystore " + ks); + } +} diff --git a/test/jdk/sun/security/jca/app-security.properties b/test/jdk/sun/security/jca/app-security.properties new file mode 100644 index 000000000000..1f15a7797c29 --- /dev/null +++ b/test/jdk/sun/security/jca/app-security.properties @@ -0,0 +1 @@ +jdk.security.provider.preferred=KeyStore.PKCS12:NonExistingProvider diff --git a/test/jdk/sun/security/krb5/config/native/libTestDynamicStore.m b/test/jdk/sun/security/krb5/config/native/libTestDynamicStore.m index ddb2f11f18fa..4a5508ada43a 100644 --- a/test/jdk/sun/security/krb5/config/native/libTestDynamicStore.m +++ b/test/jdk/sun/security/krb5/config/native/libTestDynamicStore.m @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sun/security/lib/cacerts/VerifyCACerts.java b/test/jdk/sun/security/lib/cacerts/VerifyCACerts.java index d64c5d7c52b0..86a612ac3ba1 100644 --- a/test/jdk/sun/security/lib/cacerts/VerifyCACerts.java +++ b/test/jdk/sun/security/lib/cacerts/VerifyCACerts.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2017, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,7 +28,7 @@ * 8223499 8225392 8232019 8234245 8233223 8225068 8225069 8243321 8243320 * 8243559 8225072 8258630 8259312 8256421 8225081 8225082 8225083 8245654 * 8305975 8304760 8307134 8295894 8314960 8317373 8317374 8318759 8319187 - * 8321408 8316138 8341057 + * 8321408 8316138 8341057 8303770 8350498 8359170 * @summary Check root CA entries in cacerts file */ import java.io.ByteArrayInputStream; @@ -47,12 +47,12 @@ public class VerifyCACerts { + File.separator + "security" + File.separator + "cacerts"; // The numbers of certs now. - private static final int COUNT = 112; + private static final int COUNT = 113; // SHA-256 of cacerts, can be generated with // shasum -a 256 cacerts | sed -e 's/../&:/g' | tr '[:lower:]' '[:upper:]' | cut -c1-95 private static final String CHECKSUM - = "21:68:E7:16:5B:94:23:D2:60:5C:BB:F2:AF:C1:66:5C:EC:36:BC:20:FF:5C:54:AF:91:D1:2C:38:AE:55:D3:27"; + = "18:36:49:15:B6:71:85:FF:F1:8E:C0:10:BE:0A:41:52:5B:DC:F7:B3:1F:51:7A:45:7D:7A:14:10:3A:59:42:4C"; // Hex formatter to upper case with ":" delimiter private static final HexFormat HEX = HexFormat.ofDelimiter(":").withUpperCase(); @@ -69,10 +69,6 @@ public class VerifyCACerts { "ED:F7:EB:BC:A2:7A:2A:38:4D:38:7B:7D:40:10:C6:66:E2:ED:B4:84:3E:4C:29:B4:AE:1D:5B:93:32:E6:B2:4D"); put("camerfirmachambersca [jdk]", "06:3E:4A:FA:C4:91:DF:D3:32:F3:08:9B:85:42:E9:46:17:D8:93:D7:FE:94:4E:10:A7:93:7E:E2:9D:96:93:C0"); - put("camerfirmachambersignca [jdk]", - "13:63:35:43:93:34:A7:69:80:16:A0:D3:24:DE:72:28:4E:07:9D:7B:52:20:BB:8F:BD:74:78:16:EE:BE:BA:CA"); - put("camerfirmachamberscommerceca [jdk]", - "0C:25:8A:12:A5:67:4A:EF:25:F2:8B:A7:DC:FA:EC:EE:A3:48:E5:41:E6:F5:CC:4E:E6:3B:71:B3:61:60:6A:C3"); put("certumca [jdk]", "D8:E0:FE:BC:1D:B2:E3:8D:00:94:0F:37:D2:7D:41:34:4D:99:3E:73:4B:99:D5:65:6D:97:78:D4:D8:14:36:24"); put("certumtrustednetworkca [jdk]", @@ -95,8 +91,6 @@ public class VerifyCACerts { "68:7F:A4:51:38:22:78:FF:F0:C8:B1:1F:8D:43:D5:76:67:1C:6E:B2:BC:EA:B4:13:FB:83:D9:65:D0:6D:2F:F2"); put("addtrustqualifiedca [jdk]", "80:95:21:08:05:DB:4B:BC:35:5E:44:28:D8:FD:6E:C2:CD:E3:AB:5F:B9:7A:99:42:98:8E:B8:F4:DC:D0:60:16"); - put("baltimorecybertrustca [jdk]", - "16:AF:57:A9:F6:76:B0:AB:12:60:95:AA:5E:BA:DE:F2:2A:B3:11:19:D6:44:AC:95:CD:4B:93:DB:F3:F2:6A:EB"); put("digicertglobalrootca [jdk]", "43:48:A0:E9:44:4C:78:CB:26:5E:05:8D:5E:89:44:B4:D8:4F:96:62:BD:26:DB:25:7F:89:34:A4:43:C7:01:61"); put("digicertglobalrootg2 [jdk]", @@ -285,6 +279,14 @@ public class VerifyCACerts { "C3:2F:FD:9F:46:F9:36:D1:6C:36:73:99:09:59:43:4B:9A:D6:0A:AF:BB:9E:7C:F3:36:54:F1:44:CC:1B:A1:43"); put("ssltlsrootrsa2022 [jdk]", "8F:AF:7D:2E:2C:B4:70:9B:B8:E0:B3:36:66:BF:75:A5:DD:45:B5:DE:48:0F:8E:A8:D4:BF:E6:BE:BC:17:F2:ED"); + put("sectigotlsrootr46 [jdk]", + "7B:B6:47:A6:2A:EE:AC:88:BF:25:7A:A5:22:D0:1F:FE:A3:95:E0:AB:45:C7:3F:93:F6:56:54:EC:38:F2:5A:06"); + put("sectigotlsroote46 [jdk]", + "C9:0F:26:F0:FB:1B:40:18:B2:22:27:51:9B:5C:A2:B5:3E:2C:A5:B3:BE:5C:F1:8E:FE:1B:EF:47:38:0C:53:83"); + put("sectigocodesignrootr46 [jdk]", + "7E:76:26:0A:E6:9A:55:D3:F0:60:B0:FD:18:B2:A8:C0:14:43:C8:7B:60:79:10:30:C9:FA:0B:05:85:10:1A:38"); + put("sectigocodesignroote46 [jdk]", + "8F:63:71:D8:CC:5A:A7:CA:14:96:67:A9:8B:54:96:39:89:51:E4:31:9F:7A:FB:CC:6A:66:0D:67:3E:43:8D:0B"); } }; diff --git a/test/jdk/sun/security/mscapi/nonUniqueAliases/NonUniqueAliases.java b/test/jdk/sun/security/mscapi/nonUniqueAliases/NonUniqueAliases.java index b78ade34eae3..9384ac4b1311 100644 --- a/test/jdk/sun/security/mscapi/nonUniqueAliases/NonUniqueAliases.java +++ b/test/jdk/sun/security/mscapi/nonUniqueAliases/NonUniqueAliases.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, 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,20 +27,32 @@ * @requires os.family == "windows" * @library /test/lib * @summary Test "keytool -list" displays correctly same named certificates - * @ignore Uses certutil.exe that isn't guaranteed to be installed */ import jdk.test.lib.process.ProcessTools; +import java.io.IOException; import java.security.KeyStore; import java.util.Collections; +import jtreg.SkippedException; public class NonUniqueAliases { public static void main(String[] args) throws Throwable { - try { - String testSrc = System.getProperty("test.src", "."); + runTest(); + } catch (IOException ex) { + // It uses certutil.exe that isn't guaranteed to be installed + String certutilMsg = "Cannot run program \"certutil\""; + if (ex.getMessage().contains(certutilMsg)) { + throw new SkippedException("certutil is not installed"); + } + throw ex; + } + } + private static void runTest() throws Exception { + String testSrc = System.getProperty("test.src", "."); + try { // removing the alias NonUniqueName if it already exists ProcessTools.executeCommand("certutil", "-user", "-delstore", "MY", "NonUniqueName"); diff --git a/test/jdk/sun/security/pkcs11/PKCS11Test.java b/test/jdk/sun/security/pkcs11/PKCS11Test.java index 1bd87104857e..61a7b9e489b4 100644 --- a/test/jdk/sun/security/pkcs11/PKCS11Test.java +++ b/test/jdk/sun/security/pkcs11/PKCS11Test.java @@ -84,7 +84,7 @@ public abstract class PKCS11Test { // Version of the NSS artifact. This coincides with the version of // the NSS version - private static final String NSS_BUNDLE_VERSION = "3.101"; + private static final String NSS_BUNDLE_VERSION = "3.107"; private static final String NSSLIB = "jpg.tests.jdk.nsslib"; static double nss_version = -1; diff --git a/test/jdk/sun/security/pkcs11/ec/ReadCertificates.java b/test/jdk/sun/security/pkcs11/ec/ReadCertificates.java index 4b4a6a20a4a3..e0700a45553a 100644 --- a/test/jdk/sun/security/pkcs11/ec/ReadCertificates.java +++ b/test/jdk/sun/security/pkcs11/ec/ReadCertificates.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,7 +28,6 @@ * and verify their signatures * @author Andreas Sterbenz * @library /test/lib .. - * @library ../../../../java/security/testlibrary * @modules jdk.crypto.cryptoki * @run main/othervm ReadCertificates * @run main/othervm -Djava.security.manager=allow ReadCertificates sm policy @@ -56,6 +55,7 @@ import java.util.List; import java.util.Map; import javax.security.auth.x500.X500Principal; +import jdk.test.lib.security.Providers; public class ReadCertificates extends PKCS11Test { diff --git a/test/jdk/sun/security/pkcs11/ec/ReadPKCS12.java b/test/jdk/sun/security/pkcs11/ec/ReadPKCS12.java index 6005d88aec4d..7acd4c2dc691 100644 --- a/test/jdk/sun/security/pkcs11/ec/ReadPKCS12.java +++ b/test/jdk/sun/security/pkcs11/ec/ReadPKCS12.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,7 +27,6 @@ * @summary Verify that we can parse ECPrivateKeys from PKCS#12 and use them * @author Andreas Sterbenz * @library /test/lib .. - * @library ../../../../java/security/testlibrary * @key randomness * @modules jdk.crypto.cryptoki jdk.crypto.ec/sun.security.ec * @run main/othervm ReadPKCS12 @@ -55,6 +54,7 @@ import java.util.List; import java.util.Map; import java.util.Random; +import jdk.test.lib.security.Providers; public class ReadPKCS12 extends PKCS11Test { diff --git a/test/jdk/sun/security/pkcs11/ec/TestECDH.java b/test/jdk/sun/security/pkcs11/ec/TestECDH.java index 49061f1288dc..d2a45f3842db 100644 --- a/test/jdk/sun/security/pkcs11/ec/TestECDH.java +++ b/test/jdk/sun/security/pkcs11/ec/TestECDH.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,7 +27,6 @@ * @summary Basic known answer test for ECDH * @author Andreas Sterbenz * @library /test/lib .. - * @library ../../../../java/security/testlibrary * @modules jdk.crypto.cryptoki * @run main/othervm TestECDH * @run main/othervm -Djava.security.manager=allow TestECDH sm policy @@ -44,6 +43,8 @@ import java.security.spec.X509EncodedKeySpec; import java.util.Arrays; import javax.crypto.KeyAgreement; +import jdk.test.lib.security.Providers; + public class TestECDH extends PKCS11Test { diff --git a/test/jdk/sun/security/pkcs11/ec/TestECDH2.java b/test/jdk/sun/security/pkcs11/ec/TestECDH2.java index 69ea7275193a..1e4de55da028 100644 --- a/test/jdk/sun/security/pkcs11/ec/TestECDH2.java +++ b/test/jdk/sun/security/pkcs11/ec/TestECDH2.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,7 +27,6 @@ * @summary basic test of ECDSA signatures for P-256 and P-384 from the * example data in "Suite B Implementer's Guide to FIPS 186-3". * @library /test/lib .. - * @library ../../../../java/security/testlibrary * @modules java.base/sun.security.util * jdk.crypto.cryptoki * @compile -XDignore.symbol.file TestECDH2.java diff --git a/test/jdk/sun/security/pkcs11/ec/TestECDSA.java b/test/jdk/sun/security/pkcs11/ec/TestECDSA.java index 59db0a3ed013..8ce69c61667e 100644 --- a/test/jdk/sun/security/pkcs11/ec/TestECDSA.java +++ b/test/jdk/sun/security/pkcs11/ec/TestECDSA.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,7 +27,6 @@ * @summary basic test of SHA1withECDSA and NONEwithECDSA signing/verifying * @author Andreas Sterbenz * @library /test/lib .. - * @library ../../../../java/security/testlibrary * @key randomness * @modules jdk.crypto.cryptoki * @run main/othervm TestECDSA @@ -46,6 +45,7 @@ import java.security.spec.PKCS8EncodedKeySpec; import java.security.spec.X509EncodedKeySpec; import java.util.Random; +import jdk.test.lib.security.Providers; public class TestECDSA extends PKCS11Test { diff --git a/test/jdk/sun/security/pkcs11/ec/TestECDSA2.java b/test/jdk/sun/security/pkcs11/ec/TestECDSA2.java index 4b6cb6f14ed0..88edb93668e6 100644 --- a/test/jdk/sun/security/pkcs11/ec/TestECDSA2.java +++ b/test/jdk/sun/security/pkcs11/ec/TestECDSA2.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,7 +27,6 @@ * @summary basic test of ECDSA signatures for P-256 and P-384 from the * example data in "Suite B Implementer's Guide to FIPS 186-3". * @library /test/lib .. - * @library ../../../../java/security/testlibrary * @modules java.base/sun.security.util * jdk.crypto.cryptoki * @compile -XDignore.symbol.file TestECDSA2.java diff --git a/test/jdk/sun/security/pkcs11/rsa/TestCACerts.java b/test/jdk/sun/security/pkcs11/rsa/TestCACerts.java index c95d27bc3d8c..a6844d28f782 100644 --- a/test/jdk/sun/security/pkcs11/rsa/TestCACerts.java +++ b/test/jdk/sun/security/pkcs11/rsa/TestCACerts.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -27,7 +27,6 @@ * @summary Test the new RSA provider can verify all the RSA certs in the cacerts file * @author Andreas Sterbenz * @library /test/lib .. - * @library ../../../../java/security/testlibrary * @modules jdk.crypto.cryptoki * @run main/othervm TestCACerts * @run main/othervm -Djava.security.manager=allow TestCACerts sm TestCACerts.policy @@ -43,6 +42,7 @@ import java.security.Security; import java.security.cert.X509Certificate; import java.util.Enumeration; +import jdk.test.lib.security.Providers; public class TestCACerts extends PKCS11Test { diff --git a/test/jdk/sun/security/pkcs11/sslecc/ClientJSSEServerJSSE.java b/test/jdk/sun/security/pkcs11/sslecc/ClientJSSEServerJSSE.java index 08b29fe6df18..e57ba07741c9 100644 --- a/test/jdk/sun/security/pkcs11/sslecc/ClientJSSEServerJSSE.java +++ b/test/jdk/sun/security/pkcs11/sslecc/ClientJSSEServerJSSE.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -32,7 +32,6 @@ * @summary Verify that all ciphersuites work (incl. ECC using NSS crypto) * @author Andreas Sterbenz * @library /test/lib .. ../../../../javax/net/ssl/TLSCommon - * @library ../../../../java/security/testlibrary * @modules jdk.crypto.cryptoki * @run main/othervm -Djdk.tls.namedGroups="secp256r1,sect193r1" * ClientJSSEServerJSSE @@ -42,6 +41,7 @@ import java.security.Provider; import java.security.Security; +import jdk.test.lib.security.Providers; public class ClientJSSEServerJSSE extends PKCS11Test { diff --git a/test/jdk/sun/security/pkcs12/AttributesCorrectness.java b/test/jdk/sun/security/pkcs12/AttributesCorrectness.java new file mode 100644 index 000000000000..70fb08124ebf --- /dev/null +++ b/test/jdk/sun/security/pkcs12/AttributesCorrectness.java @@ -0,0 +1,149 @@ +/* + * Copyright (c) 2023, 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 8309667 + * @library /test/lib + * @modules java.base/sun.security.tools.keytool + * java.base/sun.security.x509 + * @summary ensures attributes reading is correct + */ +import jdk.test.lib.Asserts; +import sun.security.tools.keytool.CertAndKeyGen; +import sun.security.x509.X500Name; + +import javax.crypto.EncryptedPrivateKeyInfo; +import javax.crypto.spec.SecretKeySpec; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; +import java.security.KeyStore; +import java.security.PKCS12Attribute; +import java.security.cert.Certificate; +import java.security.cert.X509Certificate; +import java.util.Set; + +public class AttributesCorrectness { + + static final char[] PASSWORD = "changeit".toCharArray(); + static final String LOCAL_KEY_ID = "1.2.840.113549.1.9.21"; + static final String TRUSTED_KEY_USAGE = "2.16.840.1.113894.746875.1.1"; + static final String FRIENDLY_NAME = "1.2.840.113549.1.9.20"; + + static CertAndKeyGen cag; + static KeyStore ks; + + public static void main(String[] args) throws Exception { + + ks = KeyStore.getInstance("pkcs12"); + ks.load(null, null); + cag = new CertAndKeyGen("Ed25519", "Ed25519"); + + cag.generate(-1); + ks.setCertificateEntry("c", ss("c")); + + cag.generate(-1); + ks.setKeyEntry("d", cag.getPrivateKey(), PASSWORD, chain("d")); + + cag.generate(-1); + ks.setKeyEntry("e", new EncryptedPrivateKeyInfo( + "PBEWithMD5AndDES", new byte[100]).getEncoded(), chain("e")); + + var f = new KeyStore.SecretKeyEntry(new SecretKeySpec(new byte[16], "AES"), + Set.of(new PKCS12Attribute("1.2.3", "456"))); + ks.setEntry("f", f, new KeyStore.PasswordProtection(PASSWORD)); + + cag.generate(-1); + var g = new KeyStore.TrustedCertificateEntry(ss("g"), + Set.of(new PKCS12Attribute("1.2.4", "456"))); + ks.setEntry("g", g, null); + + cag.generate(-1); + var h = new KeyStore.PrivateKeyEntry(cag.getPrivateKey(), chain("h"), + Set.of(new PKCS12Attribute("1.2.5", "456"))); + ks.setEntry("h", h, new KeyStore.PasswordProtection(PASSWORD)); + + var i = new KeyStore.SecretKeyEntry(new SecretKeySpec(new byte[16], "AES")); + ks.setEntry("i", i, new KeyStore.PasswordProtection(PASSWORD)); + + cag.generate(-1); + var j = new KeyStore.TrustedCertificateEntry(ss("g")); + ks.setEntry("j", j, null); + + cag.generate(-1); + var k = new KeyStore.PrivateKeyEntry(cag.getPrivateKey(), chain("h")); + ks.setEntry("k", k, new KeyStore.PasswordProtection(PASSWORD)); + check(); + + var bout = new ByteArrayOutputStream(); + ks.store(bout, PASSWORD); + ks.load(new ByteArrayInputStream(bout.toByteArray()), PASSWORD); + check(); + } + + static X509Certificate ss(String alias) throws Exception { + return cag.getSelfCertificate(new X500Name("CN=" + alias), 100); + } + + static Certificate[] chain(String alias) throws Exception { + return new Certificate[] { ss(alias) }; + } + + static Void check() { + checkAttributes("c", TRUSTED_KEY_USAGE); + checkAttributes("d", LOCAL_KEY_ID); + checkAttributes("e", LOCAL_KEY_ID); + checkAttributes("f", LOCAL_KEY_ID, "1.2.3"); + checkAttributes("g", TRUSTED_KEY_USAGE, "1.2.4"); + checkAttributes("h", LOCAL_KEY_ID, "1.2.5"); + checkAttributes("i", LOCAL_KEY_ID); + checkAttributes("j", TRUSTED_KEY_USAGE); + checkAttributes("k", LOCAL_KEY_ID); + return null; + } + + static void checkAttributes(String alias, String... keys) { + try { + var attrs = keys[0].equals(LOCAL_KEY_ID) + ? ks.getAttributes(alias) + : ks.getEntry(alias, null).getAttributes(); + Asserts.assertEQ(attrs.size(), keys.length + 1); + Asserts.assertTrue( + attrs.contains(new PKCS12Attribute(FRIENDLY_NAME, alias))); + for (var attr : attrs) { + var name = attr.getName(); + if (name.equals(FRIENDLY_NAME)) continue; + var found = false; + for (var key : keys) { + if (key.equals(name)) { + found = true; + break; + } + } + Asserts.assertTrue(found, name); + } + } catch (Exception e) { + throw new RuntimeException(e); + } + } +} diff --git a/test/jdk/sun/security/pkcs12/AttributesMultiThread.java b/test/jdk/sun/security/pkcs12/AttributesMultiThread.java new file mode 100644 index 000000000000..314340fd2f77 --- /dev/null +++ b/test/jdk/sun/security/pkcs12/AttributesMultiThread.java @@ -0,0 +1,96 @@ +/* + * Copyright (c) 2023, 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 8309667 + * @library /test/lib + * @modules java.base/sun.security.tools.keytool + * java.base/sun.security.x509 + * @summary ensures attributes reading is thread safe + */ +import sun.security.tools.keytool.CertAndKeyGen; +import sun.security.x509.X500Name; + +import java.security.KeyStore; +import java.security.PKCS12Attribute; +import java.util.Set; +import java.util.concurrent.Executors; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.atomic.AtomicBoolean; + +public class AttributesMultiThread { + + static KeyStore ks; + static AtomicBoolean ab = new AtomicBoolean(); + + public static void main(String[] args) throws Exception { + + ks = KeyStore.getInstance("pkcs12"); + ks.load(null, null); + var cak = new CertAndKeyGen("ed25519", "ed25519"); + cak.generate("ed25519"); + var c = cak.getSelfCertificate(new X500Name("CN=A"), 1000); + Set ss = Set.of( + new PKCS12Attribute("1.1.1.1", "b"), + new PKCS12Attribute("1.1.1.2", "b"), + new PKCS12Attribute("1.1.1.3", "b"), + new PKCS12Attribute("1.1.1.4", "b"), + new PKCS12Attribute("1.1.1.5", "b"), + new PKCS12Attribute("1.1.1.6", "b"), + new PKCS12Attribute("1.1.1.7", "b"), + new PKCS12Attribute("1.1.1.8", "b"), + new PKCS12Attribute("1.1.1.9", "b"), + new PKCS12Attribute("1.1.1.10", "b")); + ks.setEntry("a", new KeyStore.TrustedCertificateEntry(c, ss), null); + + var x = Executors.newVirtualThreadPerTaskExecutor(); + for (int i = 0; i < 1000; i++) { + x.submit(AttributesMultiThread::check); + } + x.shutdown(); + x.awaitTermination(1, TimeUnit.MINUTES); + + if (ab.get()) { + throw new RuntimeException(); + } + } + + static void check() { + for (int i = 0; i < 100; i++) { + var s = get(); + if (s.size() != 12) { // 10 presets and 2 added by PKCS12 + ab.set(true); + throw new RuntimeException(); + } + } + } + + static Set get() { + try { + return ks.getAttributes("a"); + } catch (Exception e) { + throw new RuntimeException(e); + } + } +} diff --git a/test/jdk/sun/security/pkcs12/GetSetEntryTest.java b/test/jdk/sun/security/pkcs12/GetSetEntryTest.java new file mode 100644 index 000000000000..00e6e2b69e78 --- /dev/null +++ b/test/jdk/sun/security/pkcs12/GetSetEntryTest.java @@ -0,0 +1,149 @@ +/* + * Copyright (c) 2024, 2025, 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 8327461 + * @summary engineGetEntry in PKCS12KeyStore should be thread-safe + * @library /test/lib + * @modules java.base/sun.security.x509 + * java.base/sun.security.util + * @run main GetSetEntryTest + */ + +import java.math.BigInteger; +import java.security.cert.X509Certificate; +import java.security.KeyPair; +import java.security.KeyPairGenerator; +import java.security.KeyStore; +import java.security.spec.ECGenParameterSpec; +import java.util.concurrent.atomic.AtomicBoolean; +import java.util.concurrent.TimeUnit; +import java.util.Date; + +import jdk.test.lib.security.CertificateBuilder; + +public class GetSetEntryTest { + + public static final String TEST = "test"; + + public static void main(String[] args) throws Exception { + KeyStore ks = KeyStore.getInstance("PKCS12"); + char[] password = "password".toCharArray(); + KeyStore.PasswordProtection protParam = new KeyStore.PasswordProtection(password); + ks.load(null, null); + + CertificateBuilder cbld = new CertificateBuilder(); + KeyPairGenerator keyPairGen1 = KeyPairGenerator.getInstance("EC"); + keyPairGen1.initialize(new ECGenParameterSpec("secp256r1")); + KeyPair ecKeyPair = keyPairGen1.genKeyPair(); + + long start = System.currentTimeMillis() - TimeUnit.DAYS.toMillis(60); + long end = start + TimeUnit.DAYS.toMillis(1085); + boolean[] kuBitSettings = {true, false, false, false, false, true, + true, false, false}; + + // Set up the EC Cert + cbld.setSubjectName("CN=EC Test Cert, O=SomeCompany"). + setPublicKey(ecKeyPair.getPublic()). + setSerialNumber(new BigInteger("1")). + setValidity(new Date(start), new Date(end)). + addSubjectKeyIdExt(ecKeyPair.getPublic()). + addAuthorityKeyIdExt(ecKeyPair.getPublic()). + addBasicConstraintsExt(true, true, -1). + addKeyUsageExt(kuBitSettings); + + X509Certificate ecCert = cbld.build(null, ecKeyPair.getPrivate(), "SHA256withECDSA"); + + KeyPairGenerator keyPairGen2 = KeyPairGenerator.getInstance("RSA"); + keyPairGen2.initialize(4096); + KeyPair rsaKeyPair = keyPairGen2.genKeyPair(); + + cbld.reset(); + // Set up the RSA Cert + cbld.setSubjectName("CN=RSA Test Cert, O=SomeCompany"). + setPublicKey(rsaKeyPair.getPublic()). + setSerialNumber(new BigInteger("1")). + setValidity(new Date(start), new Date(end)). + addSubjectKeyIdExt(rsaKeyPair.getPublic()). + addAuthorityKeyIdExt(rsaKeyPair.getPublic()). + addBasicConstraintsExt(true, true, -1). + addKeyUsageExt(kuBitSettings); + + X509Certificate rsaCert = cbld.build(null, rsaKeyPair.getPrivate(), "SHA256withRSA"); + + KeyStore.PrivateKeyEntry ecEntry = new KeyStore.PrivateKeyEntry(ecKeyPair.getPrivate(), + new X509Certificate[]{ecCert}); + KeyStore.PrivateKeyEntry rsaEntry = new KeyStore.PrivateKeyEntry(rsaKeyPair.getPrivate(), + new X509Certificate[]{rsaCert}); + + test(ks, ecEntry, rsaEntry, protParam); + } + + private static final int MAX_ITERATIONS = 100; + + private static void test(KeyStore ks, KeyStore.PrivateKeyEntry ec, + KeyStore.PrivateKeyEntry rsa, + KeyStore.PasswordProtection protParam) + throws Exception { + ks.setEntry(TEST, ec, protParam); + + AtomicBoolean syncIssue = new AtomicBoolean(false); + + Thread thread = new Thread(() -> { + int iterations = 0; + while (!syncIssue.get() && iterations < MAX_ITERATIONS) { + try { + ks.setEntry(TEST, ec, protParam); + ks.setEntry(TEST, rsa, protParam); + } catch (Exception ex) { + syncIssue.set(true); + ex.printStackTrace(); + System.out.println("Test failed"); + System.exit(1); + } + iterations++; + } + }); + thread.start(); + + int iterations = 0; + while (!syncIssue.get() && iterations < MAX_ITERATIONS) { + try { + ks.getEntry(TEST, protParam); + } catch (Exception ex) { + syncIssue.set(true); + ex.printStackTrace(); + System.out.println("Test failed"); + System.exit(1); + } + iterations++; + } + + thread.join(); + + if (!syncIssue.get()) { + System.out.println("Test completed successfully"); + } + } +} diff --git a/test/jdk/sun/security/pkcs12/KeytoolOpensslInteropTest.java b/test/jdk/sun/security/pkcs12/KeytoolOpensslInteropTest.java index c35bf47d56db..846f036cd5f2 100644 --- a/test/jdk/sun/security/pkcs12/KeytoolOpensslInteropTest.java +++ b/test/jdk/sun/security/pkcs12/KeytoolOpensslInteropTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -22,7 +22,7 @@ */ /* - * @test + * @test id=GenerateOpensslPKCS12 * @bug 8076190 8242151 8153005 8266182 * @summary This is java keytool <-> openssl interop test. This test generates * some openssl keystores on the fly, java operates on it and @@ -31,13 +31,24 @@ * Note: This test executes some openssl command, so need to set * openssl path using system property "test.openssl.path" or it should * be available in /usr/bin or /usr/local/bin - * Required OpenSSL version : OpenSSL 1.1.* + * Required OpenSSL version : OpensslArtifactFetcher.OPENSSL_BUNDLE_VERSION * * @modules java.base/sun.security.pkcs * java.base/sun.security.util - * @library /test/lib - * @library /sun/security/pkcs11/ - * @run main/othervm/timeout=600 KeytoolOpensslInteropTest + * @library /test/lib /sun/security/pkcs11/ + * @run main/othervm KeytoolOpensslInteropTest true + */ + +/* + * @test id=UseExistingPKCS12 + * @bug 8076190 8242151 8153005 8266182 + * @summary This is java keytool <-> openssl interop test. This test uses + * the existing PKCS12 files located in ./params dir and java operates on it + * + * @modules java.base/sun.security.pkcs + * java.base/sun.security.util + * @library /test/lib /sun/security/pkcs11/ + * @run main/othervm KeytoolOpensslInteropTest false */ import jdk.test.lib.Asserts; @@ -45,6 +56,7 @@ import jdk.test.lib.process.ProcessTools; import jdk.test.lib.process.OutputAnalyzer; import jdk.test.lib.security.OpensslArtifactFetcher; +import jtreg.SkippedException; import java.io.File; import java.io.FileInputStream; @@ -67,22 +79,25 @@ public class KeytoolOpensslInteropTest { public static void main(String[] args) throws Throwable { - String opensslPath = OpensslArtifactFetcher.getOpenssl1dot1dotStar(); - if (opensslPath != null) { - // if preferred version of openssl is available perform all - // keytool <-> openssl interop tests - generateInitialKeystores(opensslPath); - testWithJavaCommands(); - testWithOpensslCommands(opensslPath); + boolean generatePKCS12 = Boolean.parseBoolean(args[0]); + if (generatePKCS12) { + String opensslPath = OpensslArtifactFetcher.getOpensslPath(); + if (opensslPath != null) { + // if the current version of openssl is available, perform all + // keytool <-> openssl interop tests + generateInitialKeystores(opensslPath); + testWithJavaCommands(); + testWithOpensslCommands(opensslPath); + } else { + String exMsg = "Can't find the version: " + + OpensslArtifactFetcher.getTestOpensslBundleVersion() + + " of openssl binary on this machine, please install" + + " and set openssl path with property 'test.openssl.path'"; + throw new SkippedException(exMsg); + } } else { - // since preferred version of openssl is not available skip all - // openssl command dependent tests with a warning - System.out.println("\n\u001B[31mWarning: Can't find openssl " - + "(version 1.1.*) binary on this machine, please install" - + " and set openssl path with property " - + "'test.openssl.path'. Now running only half portion of " - + "the test, skipping all tests which depends on openssl " - + "commands.\u001B[0m\n"); + // since this scenario is using preexisting PKCS12, skip all + // openssl command dependent tests // De-BASE64 textual files in ./params to `pwd` try (DirectoryStream stream = Files.newDirectoryStream( Path.of(System.getProperty("test.src"), "params"), @@ -103,6 +118,8 @@ public static void main(String[] args) throws Throwable { private static void generateInitialKeystores(String opensslPath) throws Throwable { + Path providerPath = OpensslArtifactFetcher.getProviderPath(opensslPath); + keytool("-keystore ks -keyalg ec -genkeypair -storepass" + " changeit -alias a -dname CN=A").shouldHaveExitValue(0); @@ -123,7 +140,8 @@ private static void generateInitialKeystores(String opensslPath) ProcessTools.executeCommand(opensslPath, "pkcs12", "-export", "-in", "kandc", "-out", "os4", "-name", "a", "-passout", "pass:changeit", "-certpbe", "PBE-SHA1-RC4-128", "-keypbe", - "PBE-SHA1-RC4-128", "-macalg", "SHA224") + "PBE-SHA1-RC4-128", "-macalg", "SHA224", + "-legacy", "-provider-path", providerPath.toString()) .shouldHaveExitValue(0); ProcessTools.executeCommand(opensslPath, "pkcs12", "-export", "-in", @@ -480,12 +498,14 @@ private static void testWithOpensslCommands(String opensslPath) output1 = ProcessTools.executeCommand(opensslPath, "pkcs12", "-in", "ksnopass", "-passin", "pass:changeit", "-info", "-nokeys", "-nocerts"); - output1.shouldNotHaveExitValue(0); + output1.shouldHaveExitValue(0) + .shouldContain("Warning: MAC is absent!"); output1 = ProcessTools.executeCommand(opensslPath, "pkcs12", "-in", "ksnopass", "-passin", "pass:changeit", "-info", "-nokeys", "-nocerts", "-nomacver"); output1.shouldHaveExitValue(0) + .shouldNotContain("Warning: MAC is absent!") .shouldNotContain("PKCS7 Encrypted data:") .shouldContain("Shrouded Keybag: PBES2, PBKDF2, AES-256-CBC," + " Iteration 10000, PRF hmacWithSHA256") diff --git a/test/jdk/sun/security/pkcs12/P12SecretKey.java b/test/jdk/sun/security/pkcs12/P12SecretKey.java index ed599a559620..80f037138bf8 100644 --- a/test/jdk/sun/security/pkcs12/P12SecretKey.java +++ b/test/jdk/sun/security/pkcs12/P12SecretKey.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,7 @@ * @test * @bug 8149411 8007632 * @summary Get AES key from keystore (uses SecretKeySpec not SecretKeyFactory) + * @library /test/lib * @run main P12SecretKey pkcs12 AES 128 * @run main P12SecretKey pkcs12 DES 56 * @run main P12SecretKey pkcs12 DESede 168 @@ -33,14 +34,14 @@ import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; -import java.nio.file.Files; import java.security.KeyStore; -import java.security.cert.CertificateException; import java.util.Arrays; import javax.crypto.KeyGenerator; import javax.crypto.SecretKey; +import static jdk.test.lib.Utils.createTempFile; + public class P12SecretKey { private static final String ALIAS = "alias"; @@ -66,30 +67,32 @@ private void run(String keystoreType, String algName, int keySize) throws Except KeyStore.ProtectionParameter kspp = new KeyStore.PasswordProtection(pw); ks.setEntry(ALIAS, ske, kspp); - File ksFile = File.createTempFile("test", ".test"); + // temporary files are created in scratch directory + final File ksFile = createTempFile( + String.format("%s-%s-%d-", + keystoreType, + algName, + keySize), + ".ks").toFile(); - try { - try (FileOutputStream fos = new FileOutputStream(ksFile)) { - ks.store(fos, pw); - fos.flush(); - } + try (FileOutputStream fos = new FileOutputStream(ksFile)) { + ks.store(fos, pw); + fos.flush(); + } - // now see if we can get it back - try (FileInputStream fis = new FileInputStream(ksFile)) { - KeyStore ks2 = KeyStore.getInstance(keystoreType); - ks2.load(fis, pw); - KeyStore.Entry entry = ks2.getEntry(ALIAS, kspp); - SecretKey keyIn = ((KeyStore.SecretKeyEntry) entry).getSecretKey(); - if (Arrays.equals(key.getEncoded(), keyIn.getEncoded())) { - System.err.println("OK: worked just fine with " + keystoreType + - " keystore"); - } else { - System.err.println("ERROR: keys are NOT equal after storing in " - + keystoreType + " keystore"); - } + // now see if we can get it back + try (FileInputStream fis = new FileInputStream(ksFile)) { + KeyStore ks2 = KeyStore.getInstance(keystoreType); + ks2.load(fis, pw); + KeyStore.Entry entry = ks2.getEntry(ALIAS, kspp); + SecretKey keyIn = ((KeyStore.SecretKeyEntry) entry).getSecretKey(); + if (Arrays.equals(key.getEncoded(), keyIn.getEncoded())) { + System.err.println("OK: worked just fine with " + keystoreType + + " keystore"); + } else { + throw new RuntimeException("ERROR: keys are NOT equal after storing in " + + keystoreType + " keystore"); } - } finally { - Files.deleteIfExists(ksFile.toPath()); } } } diff --git a/test/jdk/sun/security/provider/certpath/DisabledAlgorithms/generate.sh b/test/jdk/sun/security/provider/certpath/DisabledAlgorithms/generate.sh index 6eaec960b37e..d61e6cc1c07c 100644 --- a/test/jdk/sun/security/provider/certpath/DisabledAlgorithms/generate.sh +++ b/test/jdk/sun/security/provider/certpath/DisabledAlgorithms/generate.sh @@ -4,9 +4,7 @@ # # 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. +# 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 diff --git a/test/jdk/sun/security/provider/certpath/DisabledAlgorithms/openssl.cnf b/test/jdk/sun/security/provider/certpath/DisabledAlgorithms/openssl.cnf index 6b1d7afcaba3..a2fc7dde03fb 100644 --- a/test/jdk/sun/security/provider/certpath/DisabledAlgorithms/openssl.cnf +++ b/test/jdk/sun/security/provider/certpath/DisabledAlgorithms/openssl.cnf @@ -4,9 +4,7 @@ # # 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. +# 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 diff --git a/test/jdk/sun/security/provider/certpath/OCSP/OCSPNoContentLength.java b/test/jdk/sun/security/provider/certpath/OCSP/OCSPNoContentLength.java index 8be1b05cd85a..979d270d8a5a 100644 --- a/test/jdk/sun/security/provider/certpath/OCSP/OCSPNoContentLength.java +++ b/test/jdk/sun/security/provider/certpath/OCSP/OCSPNoContentLength.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -28,8 +28,7 @@ * @modules java.base/sun.security.x509 * java.base/sun.security.provider.certpath * java.base/sun.security.util - * @library ../../../../../java/security/testlibrary - * @build CertificateBuilder SimpleOCSPServer + * @library /test/lib * @run main/othervm OCSPNoContentLength */ @@ -46,8 +45,8 @@ import java.util.concurrent.TimeUnit; -import sun.security.testlibrary.SimpleOCSPServer; -import sun.security.testlibrary.CertificateBuilder; +import jdk.test.lib.security.SimpleOCSPServer; +import jdk.test.lib.security.CertificateBuilder; public class OCSPNoContentLength { diff --git a/test/jdk/sun/security/provider/certpath/OCSP/OCSPReadTimeoutDefault.java b/test/jdk/sun/security/provider/certpath/OCSP/OCSPReadTimeoutDefault.java new file mode 100644 index 000000000000..312435b00262 --- /dev/null +++ b/test/jdk/sun/security/provider/certpath/OCSP/OCSPReadTimeoutDefault.java @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2025, 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 8347506 + * @summary Compatible OCSP readtimeout property with OCSP timeout + * @modules java.base/sun.security.provider.certpath + * @run main/othervm + * --add-opens java.base/sun.security.provider.certpath=ALL-UNNAMED + * OCSPReadTimeoutDefault 15000 + * @run main/othervm + * --add-opens java.base/sun.security.provider.certpath=ALL-UNNAMED + * -Dcom.sun.security.ocsp.timeout=6 + * OCSPReadTimeoutDefault 6000 + * @run main/othervm + * --add-opens java.base/sun.security.provider.certpath=ALL-UNNAMED + * -Dcom.sun.security.ocsp.timeout=6 -Dcom.sun.security.ocsp.readtimeout=1 + * OCSPReadTimeoutDefault 1000 + */ + +import java.lang.reflect.*; + +public class OCSPReadTimeoutDefault { + + public static void main(String[] args) throws Exception { + if (args == null || args.length < 1) { + throw new RuntimeException("Missing mandatory readtimeout value"); + } + + int expectedReadTimeout = Integer.parseInt(args[0]); + + Class ocspClazz = sun.security.provider.certpath.OCSP.class; + System.out.println("OCSP Class: " + ocspClazz); + + Field cto = ocspClazz.getDeclaredField("CONNECT_TIMEOUT"); + Field rto = ocspClazz.getDeclaredField("READ_TIMEOUT"); + cto.setAccessible(true); + rto.setAccessible(true); + int ctoVal = cto.getInt(null); + int rtoVal = rto.getInt(null); + + System.out.println("Expected read timeout: " + expectedReadTimeout); + System.out.println("CTOVal: " + ctoVal + ", RTOVal: " + rtoVal); + if (rtoVal != expectedReadTimeout) { + throw new RuntimeException("Expected read timeout value of " + + expectedReadTimeout + ", found " + rtoVal); + } + } +} \ No newline at end of file diff --git a/test/jdk/sun/security/provider/hss/TestHSS.java b/test/jdk/sun/security/provider/hss/TestHSS.java index 0af911f806be..8056855cc1ac 100644 --- a/test/jdk/sun/security/provider/hss/TestHSS.java +++ b/test/jdk/sun/security/provider/hss/TestHSS.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, 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 8298127 + * @bug 8298127 8347596 * @library /test/lib * @summary tests for HSS/LMS provider * @modules java.base/sun.security.util @@ -40,6 +40,7 @@ import java.security.spec.X509EncodedKeySpec; import java.util.HexFormat; +import jdk.test.lib.Asserts; import sun.security.util.*; import jdk.test.lib.util.SerializationUtils; @@ -61,9 +62,7 @@ public static void main(String[] args) throws Exception { i++; } - if (!serializeTest()) { - throw new RuntimeException("serializeTest failed"); - } + serializeTest(); System.out.println("All tests passed"); } @@ -88,7 +87,7 @@ static boolean kat(TestCase t) throws Exception { } } - static boolean serializeTest() throws Exception { + static void serializeTest() throws Exception { final ObjectIdentifier oid; var pk = decode(""" 00000002 @@ -106,7 +105,19 @@ static boolean serializeTest() throws Exception { throw new AssertionError(e); } - var keyBits = new DerOutputStream().putOctetString(pk).toByteArray(); + // Encoding without inner OCTET STRING + var pk0 = makeKey(oid, pk); + // Encoding with inner OCTET STRING + var pk1 = makeKey(oid, new DerOutputStream().putOctetString(pk).toByteArray()); + Asserts.assertEquals(pk0, pk1); + + PublicKey pk2 = (PublicKey) SerializationUtils + .deserialize(SerializationUtils.serialize(pk1)); + Asserts.assertEquals(pk1, pk2); + } + + static PublicKey makeKey(ObjectIdentifier oid, byte[] keyBits) + throws Exception { var oidBytes = new DerOutputStream().write(DerValue.tag_Sequence, new DerOutputStream().putOID(oid)); var x509encoding = new DerOutputStream().write(DerValue.tag_Sequence, @@ -115,11 +126,7 @@ static boolean serializeTest() throws Exception { .toByteArray(); var x509KeySpec = new X509EncodedKeySpec(x509encoding); - var pk1 = KeyFactory.getInstance(ALG).generatePublic(x509KeySpec); - - PublicKey pk2 = (PublicKey) SerializationUtils - .deserialize(SerializationUtils.serialize(pk1)); - return pk2.equals(pk1); + return KeyFactory.getInstance(ALG).generatePublic(x509KeySpec); } static boolean verify(byte[] pk, byte[] sig, byte[] msg) throws Exception { diff --git a/test/jdk/sun/security/ssl/SSLContextImpl/MD2InTrustAnchor.java b/test/jdk/sun/security/ssl/SSLContextImpl/MD2InTrustAnchor.java index f2e06337dd39..f61ba818e4c6 100644 --- a/test/jdk/sun/security/ssl/SSLContextImpl/MD2InTrustAnchor.java +++ b/test/jdk/sun/security/ssl/SSLContextImpl/MD2InTrustAnchor.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sun/security/ssl/SSLContextImpl/MultipleChooseAlias.java b/test/jdk/sun/security/ssl/SSLContextImpl/MultipleChooseAlias.java index 5ba949d134d9..67950b9bc908 100644 --- a/test/jdk/sun/security/ssl/SSLContextImpl/MultipleChooseAlias.java +++ b/test/jdk/sun/security/ssl/SSLContextImpl/MultipleChooseAlias.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sun/security/ssl/SSLContextImpl/TrustTrustedCert.java b/test/jdk/sun/security/ssl/SSLContextImpl/TrustTrustedCert.java index 463dd2878831..9f1ff84a4c09 100644 --- a/test/jdk/sun/security/ssl/SSLContextImpl/TrustTrustedCert.java +++ b/test/jdk/sun/security/ssl/SSLContextImpl/TrustTrustedCert.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sun/security/ssl/SSLSessionImpl/NoInvalidateSocketException.java b/test/jdk/sun/security/ssl/SSLSessionImpl/NoInvalidateSocketException.java index ed488b946c08..7b2efd2c59c3 100644 --- a/test/jdk/sun/security/ssl/SSLSessionImpl/NoInvalidateSocketException.java +++ b/test/jdk/sun/security/ssl/SSLSessionImpl/NoInvalidateSocketException.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sun/security/ssl/SignatureScheme/CustomizedClientSchemes.java b/test/jdk/sun/security/ssl/SignatureScheme/CustomizedClientSchemes.java index 7659057baa4e..6bc9f9ad36e4 100644 --- a/test/jdk/sun/security/ssl/SignatureScheme/CustomizedClientSchemes.java +++ b/test/jdk/sun/security/ssl/SignatureScheme/CustomizedClientSchemes.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sun/security/ssl/SignatureScheme/CustomizedServerSchemes.java b/test/jdk/sun/security/ssl/SignatureScheme/CustomizedServerSchemes.java index 469698c5dd44..6871cff4964e 100644 --- a/test/jdk/sun/security/ssl/SignatureScheme/CustomizedServerSchemes.java +++ b/test/jdk/sun/security/ssl/SignatureScheme/CustomizedServerSchemes.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sun/security/ssl/SignatureScheme/SigSchemePropOrdering.java b/test/jdk/sun/security/ssl/SignatureScheme/SigSchemePropOrdering.java index 8ee04b39c282..6c6583bf81fb 100644 --- a/test/jdk/sun/security/ssl/SignatureScheme/SigSchemePropOrdering.java +++ b/test/jdk/sun/security/ssl/SignatureScheme/SigSchemePropOrdering.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sun/security/ssl/SignatureScheme/Tls13NamedGroups.java b/test/jdk/sun/security/ssl/SignatureScheme/Tls13NamedGroups.java index ed428df60bc7..8b5a2bff2b71 100644 --- a/test/jdk/sun/security/ssl/SignatureScheme/Tls13NamedGroups.java +++ b/test/jdk/sun/security/ssl/SignatureScheme/Tls13NamedGroups.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sun/security/ssl/Stapling/StatusResponseManager.java b/test/jdk/sun/security/ssl/Stapling/StatusResponseManager.java index 58ebb5b876af..0f66db4064cf 100644 --- a/test/jdk/sun/security/ssl/Stapling/StatusResponseManager.java +++ b/test/jdk/sun/security/ssl/Stapling/StatusResponseManager.java @@ -23,10 +23,12 @@ /* * @test + * @library /test/lib + * @build jdk.test.lib.security.SimpleOCSPServer + * jdk.test.lib.security.CertificateBuilder * @bug 8046321 - * @library ../../../../java/security/testlibrary - * @build CertificateBuilder SimpleOCSPServer - * @run main/othervm -Djavax.net.debug=ssl:respmgr java.base/sun.security.ssl.StatusResponseManagerTests * @summary OCSP Stapling for TLS + * @run main/othervm -Djavax.net.debug=ssl:respmgr + * java.base/sun.security.ssl.StatusResponseManagerTests */ diff --git a/test/jdk/sun/security/ssl/Stapling/java.base/sun/security/ssl/StatusResponseManagerTests.java b/test/jdk/sun/security/ssl/Stapling/java.base/sun/security/ssl/StatusResponseManagerTests.java index 07058a29c252..63910c67e2d9 100644 --- a/test/jdk/sun/security/ssl/Stapling/java.base/sun/security/ssl/StatusResponseManagerTests.java +++ b/test/jdk/sun/security/ssl/Stapling/java.base/sun/security/ssl/StatusResponseManagerTests.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, 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 @@ -33,8 +33,8 @@ import java.security.PublicKey; import java.util.concurrent.TimeUnit; -import sun.security.testlibrary.SimpleOCSPServer; -import sun.security.testlibrary.CertificateBuilder; +import jdk.test.lib.security.SimpleOCSPServer; +import jdk.test.lib.security.CertificateBuilder; import static sun.security.ssl.CertStatusExtension.*; diff --git a/test/jdk/sun/security/ssl/X509TrustManagerImpl/distrust/Camerfirma.java b/test/jdk/sun/security/ssl/X509TrustManagerImpl/distrust/Camerfirma.java index 50a723441a51..8d9dfe1ef18f 100644 --- a/test/jdk/sun/security/ssl/X509TrustManagerImpl/distrust/Camerfirma.java +++ b/test/jdk/sun/security/ssl/X509TrustManagerImpl/distrust/Camerfirma.java @@ -21,17 +21,19 @@ * questions. */ +import javax.net.ssl.X509TrustManager; import java.io.File; import java.security.Security; -import java.time.*; -import java.util.*; -import javax.net.ssl.*; +import java.time.LocalDate; +import java.time.ZoneOffset; +import java.time.ZonedDateTime; +import java.util.Date; -/** +/* * @test - * @bug 8346587 + * @bug 8346587 8350498 * @summary Check that TLS Server certificates chaining back to distrusted - * Camerfirma roots are invalid + * Camerfirma root are invalid * @library /test/lib * @modules java.base/sun.security.validator * @run main/othervm Camerfirma after policyOn invalid @@ -42,13 +44,11 @@ public class Camerfirma { - private static final String certPath = "chains" + File.separator + "camerfirma"; + private static final String CERT_PATH = "chains" + File.separator + "camerfirma"; // Each of the roots have a test certificate chain stored in a file // named "-chain.pem". - private static String[] rootsToTest = new String[] { - "camerfirmachamberscommerceca", "camerfirmachambersca", - "camerfirmachambersignca"}; + private static final String ROOT_TO_TEST = "camerfirmachambersca"; // Date after the restrictions take effect private static final ZonedDateTime DISTRUST_DATE = @@ -56,7 +56,7 @@ public class Camerfirma { public static void main(String[] args) throws Exception { - // All of the test certificates are signed with SHA-1 so we need + // All the test certificates are signed with SHA-1, so we need // to remove the constraint that disallows SHA-1 certificates. String prop = Security.getProperty("jdk.certpath.disabledAlgorithms"); String newProp = prop.replace(", SHA1 jdkCA & usage TLSServer", ""); @@ -70,6 +70,6 @@ public static void main(String[] args) throws Exception { }; Date notBefore = distrust.getNotBefore(DISTRUST_DATE); - distrust.testCertificateChain(certPath, notBefore, tms, rootsToTest); + distrust.testCertificateChain(CERT_PATH, notBefore, tms, ROOT_TO_TEST); } } diff --git a/test/jdk/sun/security/ssl/X509TrustManagerImpl/distrust/chains/camerfirma/camerfirmachamberscommerceca-chain.pem b/test/jdk/sun/security/ssl/X509TrustManagerImpl/distrust/chains/camerfirma/camerfirmachamberscommerceca-chain.pem deleted file mode 100644 index b27d46c17c8c..000000000000 --- a/test/jdk/sun/security/ssl/X509TrustManagerImpl/distrust/chains/camerfirma/camerfirmachamberscommerceca-chain.pem +++ /dev/null @@ -1,48 +0,0 @@ -Owner: CN=AC Camerfirma Certificados Camerales, - O=AC Camerfirma SA, SERIALNUMBER=A82743287, - L=Madrid (see current address at www.camerfirma.com/address), - EMAILADDRESS=ac_camerfirma_cc@camerfirma.com, C=ES -Issuer: CN=Chambers of Commerce Root, OU=http://www.chambersign.org, - O=AC Camerfirma SA CIF A82743287, C=EU -Serial number: 5 -Valid from: Mon Feb 09 07:42:47 PST 2004 until: Thu Feb 09 07:42:47 PST 2034 -Certificate fingerprints: - SHA1: 9F:36:B4:BE:9D:AF:1C:91:01:B2:D7:61:58:FB:95:CB:53:82:01:10 - SHA256: C7:D8:43:81:E1:1F:7C:57:46:77:1A:F5:B0:50:DC:51:FC:6F:DA:D6:F6:F3:5B:B5:3A:3D:E9:13:82:2E:A0:9E -Signature algorithm name: SHA1withRSA (weak) -Subject Public Key Algorithm: 2048-bit RSA key -Version: 3 - ------BEGIN CERTIFICATE----- -MIIFwDCCBKigAwIBAgIBBTANBgkqhkiG9w0BAQUFADB/MQswCQYDVQQGEwJFVTEn -MCUGA1UEChMeQUMgQ2FtZXJmaXJtYSBTQSBDSUYgQTgyNzQzMjg3MSMwIQYDVQQL -ExpodHRwOi8vd3d3LmNoYW1iZXJzaWduLm9yZzEiMCAGA1UEAxMZQ2hhbWJlcnMg -b2YgQ29tbWVyY2UgUm9vdDAeFw0wNDAyMDkxNTQyNDdaFw0zNDAyMDkxNTQyNDda -MIHgMQswCQYDVQQGEwJFUzEuMCwGCSqGSIb3DQEJARYfYWNfY2FtZXJmaXJtYV9j -Y0BjYW1lcmZpcm1hLmNvbTFDMEEGA1UEBxM6TWFkcmlkIChzZWUgY3VycmVudCBh -ZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNvbS9hZGRyZXNzKTESMBAGA1UEBRMJ -QTgyNzQzMjg3MRkwFwYDVQQKExBBQyBDYW1lcmZpcm1hIFNBMS0wKwYDVQQDEyRB -QyBDYW1lcmZpcm1hIENlcnRpZmljYWRvcyBDYW1lcmFsZXMwggEgMA0GCSqGSIb3 -DQEBAQUAA4IBDQAwggEIAoIBAQCjxnvvj01f36lgGhihRYVf1fAPEXsTJKrY4aLQ -cEUSh5szZE7VTtGiyMTMc2uCmnaXafjYHK8Lgmy6T9xxGEZ5OS4x6rgtuPyy13AP -tu3X3Y2kPVLu7ZMw5HoQC64wBj6YcnxTnBwmVW05DjzRXp6OyBIEKEaAB9vv2qEl -fh/Y234FG6Wd/ut1s0ScRZAo+6CSMNQxaY+ryXKD11uWkzWXJa9UZOasG7z4uPqc -Gr4/Hz2/CTLDTgp0xkMJYuzOztpUvOACrxlkS2utKUwVlAikJnboNwf/en94RbHN -zkKc5t0SAbzCf57ueawbzxSdPa+SAC25FNur64FKkfdq5PPjAgEDo4IB5TCCAeEw -EgYDVR0TAQH/BAgwBgEB/wIBCzA8BgNVHR8ENTAzMDGgL6AthitodHRwOi8vY3Js -LmNoYW1iZXJzaWduLm9yZy9jaGFtYmVyc3Jvb3QuY3JsMB0GA1UdDgQWBBS2H06d -HGiRLjdyYOFGj1qlKjExuTCBqwYDVR0jBIGjMIGggBTjlPWxTenboSlbV4tNdgZ2 -4dGiiqGBhKSBgTB/MQswCQYDVQQGEwJFVTEnMCUGA1UEChMeQUMgQ2FtZXJmaXJt -YSBTQSBDSUYgQTgyNzQzMjg3MSMwIQYDVQQLExpodHRwOi8vd3d3LmNoYW1iZXJz -aWduLm9yZzEiMCAGA1UEAxMZQ2hhbWJlcnMgb2YgQ29tbWVyY2UgUm9vdIIBADAO -BgNVHQ8BAf8EBAMCAYYwKgYDVR0RBCMwIYEfYWNfY2FtZXJmaXJtYV9jY0BjYW1l -cmZpcm1hLmNvbTAnBgNVHRIEIDAegRxjaGFtYmVyc3Jvb3RAY2hhbWJlcnNpZ24u -b3JnMFsGA1UdIARUMFIwUAYLKwYBBAGBhy4KCQEwQTA/BggrBgEFBQcCARYzaHR0 -cDovL2Nwcy5jYW1lcmZpcm1hLmNvbS9jcHMvYWNfY2FtZXJmaXJtYV9jYy5odG1s -MA0GCSqGSIb3DQEBBQUAA4IBAQBl8KoPBYL//EBonqQWS0N+hLfxImP1eQ6nac+v -R5QfF/0w+VCTkShfKwHaa6V/W1dPlVwXSECuvXHkX6DYrtxFGGFB6qxuP1rkIpRs -sTkAlpvOx3REiFjIkhsijKd/ijvqxjbMbuYU+EFACK/jQIRoj+LEEZ+haiqbALZB -Iqq/26HTqX0itDosBj6M94YWcIpbTDefQNWCGsSnZcw2+k+az/wAOZT6xAxlnEim -HpDDlgRsmaLrHpDPDoIRYOih0gbJTnn4mKex9Wgr0sZ+XFl03j+bvcXL1tiuQnwb -9dMRDe/OdXABT35W4ZzLbpost65ZW3Tx+oi/bLbmu6pbKCgs ------END CERTIFICATE----- diff --git a/test/jdk/sun/security/ssl/X509TrustManagerImpl/distrust/chains/camerfirma/camerfirmachambersignca-chain.pem b/test/jdk/sun/security/ssl/X509TrustManagerImpl/distrust/chains/camerfirma/camerfirmachambersignca-chain.pem deleted file mode 100644 index 2ab3091439cb..000000000000 --- a/test/jdk/sun/security/ssl/X509TrustManagerImpl/distrust/chains/camerfirma/camerfirmachambersignca-chain.pem +++ /dev/null @@ -1,62 +0,0 @@ -Owner: CN=AC Camerfirma - 2009, - L=Madrid (see current address at https://www.camerfirma.com/address), - SERIALNUMBER=A82743287, O=AC Camerfirma S.A., C=ES -Issuer: CN=Global Chambersign Root - 2008, - O=AC Camerfirma S.A., SERIALNUMBER=A82743287, - L=Madrid (see current address at www.camerfirma.com/address), C=EU -Serial number: 2 -Valid from: Mon Mar 16 10:16:25 PDT 2009 until: Sun Mar 11 10:16:25 PDT 2029 -Certificate fingerprints: - SHA1: BA:BA:69:CF:D5:CC:C9:4D:05:6B:5B:E7:80:5F:E2:03:CB:EB:5C:57 - SHA256: B6:8D:5D:9B:4E:A6:35:95:7C:0C:32:15:C2:0D:35:B2:21:7B:69:E3:49:C7:A3:04:C4:F9:7F:20:C4:08:1F:88 -Signature algorithm name: SHA1withRSA (weak) -Subject Public Key Algorithm: 4096-bit RSA key -Version: 3 - ------BEGIN CERTIFICATE----- -MIIIPzCCBiegAwIBAgIBAjANBgkqhkiG9w0BAQUFADCBrDELMAkGA1UEBhMCRVUx -QzBBBgNVBAcTOk1hZHJpZCAoc2VlIGN1cnJlbnQgYWRkcmVzcyBhdCB3d3cuY2Ft -ZXJmaXJtYS5jb20vYWRkcmVzcykxEjAQBgNVBAUTCUE4Mjc0MzI4NzEbMBkGA1UE -ChMSQUMgQ2FtZXJmaXJtYSBTLkEuMScwJQYDVQQDEx5HbG9iYWwgQ2hhbWJlcnNp -Z24gUm9vdCAtIDIwMDgwHhcNMDkwMzE2MTcxNjI1WhcNMjkwMzExMTcxNjI1WjCB -qjELMAkGA1UEBhMCRVMxGzAZBgNVBAoTEkFDIENhbWVyZmlybWEgUy5BLjESMBAG -A1UEBRMJQTgyNzQzMjg3MUswSQYDVQQHE0JNYWRyaWQgKHNlZSBjdXJyZW50IGFk -ZHJlc3MgYXQgaHR0cHM6Ly93d3cuY2FtZXJmaXJtYS5jb20vYWRkcmVzcykxHTAb -BgNVBAMTFEFDIENhbWVyZmlybWEgLSAyMDA5MIICIjANBgkqhkiG9w0BAQEFAAOC -Ag8AMIICCgKCAgEAmbHxFEYTJmMdPcYiPlWUGZu2+tQo4voohYi3dwCwoVuGdHSp -kyoqs1B3YGx4u5KT4n0A7+Bb8YQ/QzbNy7UQ4JXAK+rT8JpNeKIvfN4lHnQJaChE -4fdn0KpvHWymaNq2k+EbQClquZB6OsTLvsivwSuSnyLcUw5rbajj53wq77fwB12y -phMjwz2AnD1BvHZd3vLOaH1jRQP3zzNmyjT/Oj6+jdux7SBKlJWgQEaKflwcvYyc -DPFPhGM4KPwEGX61PCrS+l8Lw0Kdy6K4lE+GrfgJrXM5m1Ey1R0c9McYQQPAtYcm -cOnHHgkJdEAFVDa76T9C+lcMP6DNckbJIyc/ENrmM2v4rq/JnsJKEEx0VLyLizQx -cGU3gp4ckg0ImQ9hV3H/DLWEqfrPuD++zaV81gpstnc9+pLg0Jibvwg3qvIr7nS5 -acc//qqxH0iJGYoStHW5J5HoM9HcBvhACq5rjzjrNLPYSJqbPJwBHKcql/uUjQ6S -SVWe3/CeJp6/vGuY1aRXAk9c/8oO0ZDrLKE8LsUgZesTLnWGd1LQcyQf6UMG1nb9 -5C3eZRkCVpKma6Hl/SUQNukerlbLOU9InFGNPdeEVq1Jo62XeEi8KMbTPdXou6Yl -rpe99dFnOUjVOdY7gfBGSgIVJjORqf/V70jwsxcYz7j6PKl0XulJs06vpSECAwEA -AaOCAmowggJmMBIGA1UdEwEB/wQIMAYBAf8CAQIwHQYDVR0OBBYEFMgAD/zGUvyf -2ztkLjK5bi5x82V5MIHhBgNVHSMEgdkwgdaAFLkJypwe29NsOmuu7VTxW5MGNS5e -oYGypIGvMIGsMQswCQYDVQQGEwJFVTFDMEEGA1UEBxM6TWFkcmlkIChzZWUgY3Vy -cmVudCBhZGRyZXNzIGF0IHd3dy5jYW1lcmZpcm1hLmNvbS9hZGRyZXNzKTESMBAG -A1UEBRMJQTgyNzQzMjg3MRswGQYDVQQKExJBQyBDYW1lcmZpcm1hIFMuQS4xJzAl -BgNVBAMTHkdsb2JhbCBDaGFtYmVyc2lnbiBSb290IC0gMjAwOIIJAMnN0+nVfSPO -MH0GCCsGAQUFBwEBBHEwbzBFBggrBgEFBQcwAoY5aHR0cDovL3d3dy5jYW1lcmZp -cm1hLmNvbS9jZXJ0cy9yb290X2NoYW1iZXJzaWduLTIwMDguY3J0MCYGCCsGAQUF -BzABhhpodHRwOi8vb2NzcC5jYW1lcmZpcm1hLmNvbTAOBgNVHQ8BAf8EBAMCAQYw -PgYDVR0gBDcwNTAzBgRVHSAAMCswKQYIKwYBBQUHAgEWHWh0dHBzOi8vcG9saWN5 -LmNhbWVyZmlybWEuY29tMH4GA1UdHwR3MHUwOKA2oDSGMmh0dHA6Ly9jcmwuY2Ft -ZXJmaXJtYS5jb20vY2hhbWJlcnNpZ25yb290LTIwMDguY3JsMDmgN6A1hjNodHRw -Oi8vY3JsMS5jYW1lcmZpcm1hLmNvbS9jaGFtYmVyc2lnbnJvb3QtMjAwOC5jcmww -DQYJKoZIhvcNAQEFBQADggIBABNYG4jBwoI7e8pCuUyDc6rwpE9H6AgrUdL7O1xK -TgTjDGBrMOBK+ZPS4Si8J3yZngvSrL694a1HmiiblJ+CmCdNGli2nBBM+OPK3tQB -4TW6hgkIe3vSNg/9o9y6+MAJcm8Kn0nPCBkSRME87NwvpehtekuF1G2ng1KDVwAn -F+eCXfNanEwY++vWbJAuPE69Z/0+rCgNyH1PzihiNu6vrUlSlLWKaG34O1DEttX+ -SsWTpEbpH9w5y9Vmw6WQ/B5nfhPM551HaMbiGgSxT9jHmf8APYQ3iT8EktcdTAdw -m1miiyxfKG+WjPT7P/x8Np1spJZw+sNIDTLdZ0T1XQ6obVkBTFUDSULKW8949HDu -VSwdl9Hu9lkDzzh9tyVYwwjEWVFZOiD/4TPVLfphf4ZEiyHt5YpNd9kZJIGGDxdc -CdtzPm2dQODFpv72LnPQHbuBQPJ71zkoAmyeM/1Qj0DlrFsPcYnbRasck1VmYgDc -Xc0+is0wcgCd7Gpx1zpEeVqwMD96am2xZPzd6nsbXvo+6TzsKLRMJo6nOERwrzuI -F+/eq3WXxYMt2UenJsHqwSgPJRMdl3SFz0+SZN0viHeLuwb7qaHN74qC6GP8yHGp -2xe6Z11mJDPLDSrQQ2dOceSJ1LurJgLP7amYmFlWwVnmM7LnfShhMWMV+MDrICnL -2ksL ------END CERTIFICATE----- diff --git a/test/jdk/sun/security/tools/jarsigner/ConciseJarsigner.java b/test/jdk/sun/security/tools/jarsigner/ConciseJarsigner.java index 69b45ea22930..e81a25712a6b 100644 --- a/test/jdk/sun/security/tools/jarsigner/ConciseJarsigner.java +++ b/test/jdk/sun/security/tools/jarsigner/ConciseJarsigner.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2009, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2009, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -43,8 +43,15 @@ public class ConciseJarsigner { static OutputAnalyzer kt(String cmd) throws Exception { // Choose 2048-bit RSA to make sure it runs fine and fast. In // fact, every keyalg/keysize combination is OK for this test. - return SecurityTools.keytool("-storepass changeit -keypass changeit " - + "-keystore ks -keyalg rsa -keysize 2048 " + cmd); + // The start date is set to -1M to prevent the certificate not yet valid during fast enough execution. + // If -startdate is specified in cmd, cmd version will be used. + if (cmd.contains("-startdate")) { + return SecurityTools.keytool("-storepass changeit -keypass changeit " + + "-keystore ks -keyalg rsa -keysize 2048 " + cmd); + } else { + return SecurityTools.keytool("-storepass changeit -keypass changeit " + + "-keystore ks -keyalg rsa -keysize 2048 -startdate -1M " + cmd); + } } static void gencert(String owner, String cmd) throws Exception { diff --git a/test/jdk/sun/security/tools/jarsigner/TimestampCheck.java b/test/jdk/sun/security/tools/jarsigner/TimestampCheck.java index c4cf1ef6a985..ace7e44f07c1 100644 --- a/test/jdk/sun/security/tools/jarsigner/TimestampCheck.java +++ b/test/jdk/sun/security/tools/jarsigner/TimestampCheck.java @@ -905,7 +905,7 @@ static void prepare() throws Exception { } gencert("tsold", "-ext eku:critical=ts -startdate -40d -validity 500"); - gencert("tsbefore2019", "-ext eku:critical=ts -startdate 2018/01/01 -validity 3000"); + gencert("tsbefore2019", "-ext eku:critical=ts -startdate 2018/01/01 -validity 5000"); gencert("tsweak", "-ext eku:critical=ts"); gencert("tsdisabled", "-ext eku:critical=ts"); diff --git a/test/jdk/sun/security/tools/jarsigner/TsacertOptionTest.java b/test/jdk/sun/security/tools/jarsigner/TsacertOptionTest.java index 06b5ed082f51..3655c01b5b0b 100644 --- a/test/jdk/sun/security/tools/jarsigner/TsacertOptionTest.java +++ b/test/jdk/sun/security/tools/jarsigner/TsacertOptionTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, 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 @@ -103,6 +103,7 @@ void start() throws Throwable { "-alias", CA_KEY_ALIAS, "-keystore", KEYSTORE, "-storepass", PASSWORD, + "-startdate", "-1M", "-keypass", PASSWORD, "-validity", Integer.toString(VALIDITY), "-infile", "certreq", diff --git a/test/jdk/sun/security/tools/keytool/KeyToolTest.java b/test/jdk/sun/security/tools/keytool/KeyToolTest.java index 954951a1a78d..793ffd627935 100644 --- a/test/jdk/sun/security/tools/keytool/KeyToolTest.java +++ b/test/jdk/sun/security/tools/keytool/KeyToolTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2025, 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 - * @library /java/security/testlibrary + * @library /test/lib * @bug 6251120 8231950 8242151 * @summary Testing keytool * @@ -68,10 +68,10 @@ import java.util.*; import java.security.cert.X509Certificate; import jdk.test.lib.util.FileUtils; +import jdk.test.lib.security.HumanInputStream; import jdk.test.lib.security.SecurityUtils; import sun.security.util.ObjectIdentifier; - public class KeyToolTest { // The stdout and stderr outputs after a keytool run diff --git a/test/jdk/sun/security/tools/keytool/NssTest.java b/test/jdk/sun/security/tools/keytool/NssTest.java index 1ed2d4c3f391..6f82da4b4c8a 100644 --- a/test/jdk/sun/security/tools/keytool/NssTest.java +++ b/test/jdk/sun/security/tools/keytool/NssTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2025, 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 @@ -29,7 +29,7 @@ /* * @test * @summary It tests (almost) all keytool behaviors with NSS. - * @library /test/lib /test/jdk/sun/security/pkcs11 /java/security/testlibrary + * @library /test/lib /test/jdk/sun/security/pkcs11 * @modules java.base/sun.security.tools.keytool * java.base/sun.security.util * java.base/sun.security.x509 diff --git a/test/jdk/sun/security/util/math/BigIntegerModuloP.java b/test/jdk/sun/security/util/math/BigIntegerModuloP.java index f4af2979656f..e47b796e2684 100644 --- a/test/jdk/sun/security/util/math/BigIntegerModuloP.java +++ b/test/jdk/sun/security/util/math/BigIntegerModuloP.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sun/security/x509/URICertStore/AIACertTimeout.java b/test/jdk/sun/security/x509/URICertStore/AIACertTimeout.java index 487f5e2471ce..cabb225bf1cc 100644 --- a/test/jdk/sun/security/x509/URICertStore/AIACertTimeout.java +++ b/test/jdk/sun/security/x509/URICertStore/AIACertTimeout.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, 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,8 +27,7 @@ * @summary Enhance OCSP, CRL and Certificate Fetch Timeouts * @modules java.base/sun.security.x509 * java.base/sun.security.util - * @library /test/lib ../../../../java/security/testlibrary - * @build CertificateBuilder + * @library /test/lib * @run main/othervm -Dcom.sun.security.enableAIAcaIssuers=true * -Dcom.sun.security.cert.readtimeout=1 AIACertTimeout 5000 false * @run main/othervm -Dcom.sun.security.enableAIAcaIssuers=true @@ -55,10 +54,7 @@ import java.util.*; import java.util.concurrent.TimeUnit; -import sun.security.testlibrary.CertificateBuilder; - -import sun.security.x509.*; -import sun.security.util.*; +import jdk.test.lib.security.CertificateBuilder; public class AIACertTimeout { diff --git a/test/jdk/sun/security/x509/URICertStore/ExtensionsWithLDAP.java b/test/jdk/sun/security/x509/URICertStore/ExtensionsWithLDAP.java index f8d9a393971c..3b598d78d9f5 100644 --- a/test/jdk/sun/security/x509/URICertStore/ExtensionsWithLDAP.java +++ b/test/jdk/sun/security/x509/URICertStore/ExtensionsWithLDAP.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/sun/tools/jcmd/JcmdOutputEncodingTest.java b/test/jdk/sun/tools/jcmd/JcmdOutputEncodingTest.java index 14f5a2be1671..01797a6a82af 100644 --- a/test/jdk/sun/tools/jcmd/JcmdOutputEncodingTest.java +++ b/test/jdk/sun/tools/jcmd/JcmdOutputEncodingTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2019, 2024, 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,6 +23,8 @@ import java.nio.charset.Charset; import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; import jdk.test.lib.Utils; import jdk.test.lib.process.OutputAnalyzer; @@ -31,7 +33,7 @@ /* * @test - * @bug 8222491 8273187 + * @bug 8222491 8273187 8308033 * @summary Tests if we handle the encoding of jcmd output correctly. * @library /test/lib * @run main JcmdOutputEncodingTest @@ -52,12 +54,43 @@ private static void testThreadDump() throws Exception { launcher.addVMArg("-Dfile.encoding=" + cs); launcher.addVMArg("-Dsun.stdout.encoding=" + cs); launcher.addToolArg(Long.toString(ProcessTools.getProcessId())); - launcher.addToolArg("Thread.print"); + boolean isVirtualThread = Thread.currentThread().isVirtual(); + Path threadDumpFile = null; + if (isVirtualThread) { + // "jcmd Thread.print" will not print thread dumps of virtual threads. + // So we use "Thread.dump_to_file" command instead and dump the thread + // stacktraces in a file + threadDumpFile = Files.createTempFile(Path.of("."), "jcmd", ".tdump").toAbsolutePath(); + launcher.addToolArg("Thread.dump_to_file"); + launcher.addToolArg("-overwrite"); + launcher.addToolArg(threadDumpFile.toString()); + } else { + launcher.addToolArg("Thread.print"); + } ProcessBuilder processBuilder = new ProcessBuilder(); processBuilder.command(launcher.getCommand()); OutputAnalyzer output = ProcessTools.executeProcess(processBuilder, null, cs); output.shouldHaveExitValue(0); - output.shouldContain(marker); + if (isVirtualThread) { + // verify the file containing the thread dump has the expected text + try (var br = Files.newBufferedReader(threadDumpFile, cs)) { + String line = null; + boolean found = false; + while ((line = br.readLine()) != null) { + if (line.contains(marker)) { + found = true; + break; + } + } + if (!found) { + output.reportDiagnosticSummary(); + throw new RuntimeException("'" + marker + "' missing in thread dump in file " + + threadDumpFile); + } + } + } else { + output.shouldContain(marker); + } } } diff --git a/test/jdk/sun/tools/jstack/BasicJStackTest.java b/test/jdk/sun/tools/jstack/BasicJStackTest.java index e0a9c96d6ad2..ec0a80e8d78c 100644 --- a/test/jdk/sun/tools/jstack/BasicJStackTest.java +++ b/test/jdk/sun/tools/jstack/BasicJStackTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2024, 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,9 +30,11 @@ import jdk.test.lib.process.ProcessTools; import jdk.test.lib.JDKToolLauncher; +import jtreg.SkippedException; + /* * @test - * @bug 8273187 + * @bug 8273187 8308033 * @summary Unit test for jstack utility * @library /test/lib * @run main BasicJStackTest @@ -42,6 +44,13 @@ public class BasicJStackTest { private static ProcessBuilder processBuilder = new ProcessBuilder(); public static void main(String[] args) throws Exception { + if (Thread.currentThread().isVirtual()) { + // This test runs jstack against the current process and then asserts the + // presence of current thread in the stacktraces. We skip this test + // when the current thread is a virtual thread since "jstack" command doesn't + // print the stacktraces of virtual threads. + throw new SkippedException("skipping test since current thread is a virtual thread"); + } testJstackNoArgs(); testJstack_l(); testJstackUTF8Encoding(); diff --git a/test/jdk/tools/jlink/plugins/DefaultStripDebugPluginTest.java b/test/jdk/tools/jlink/plugins/DefaultStripDebugPluginTest.java index e9e49cc43c88..10d534348fab 100644 --- a/test/jdk/tools/jlink/plugins/DefaultStripDebugPluginTest.java +++ b/test/jdk/tools/jlink/plugins/DefaultStripDebugPluginTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/tools/jlink/plugins/StripNativeDebugSymbolsPlugin/FakeObjCopy.java b/test/jdk/tools/jlink/plugins/StripNativeDebugSymbolsPlugin/FakeObjCopy.java index 6bfd1686ff24..e2caa293732c 100644 --- a/test/jdk/tools/jlink/plugins/StripNativeDebugSymbolsPlugin/FakeObjCopy.java +++ b/test/jdk/tools/jlink/plugins/StripNativeDebugSymbolsPlugin/FakeObjCopy.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/tools/jlink/plugins/StripNativeDebugSymbolsPlugin/StripNativeDebugSymbolsPluginTest.java b/test/jdk/tools/jlink/plugins/StripNativeDebugSymbolsPlugin/StripNativeDebugSymbolsPluginTest.java index 57a784b31ba3..53214fd373cd 100644 --- a/test/jdk/tools/jlink/plugins/StripNativeDebugSymbolsPlugin/StripNativeDebugSymbolsPluginTest.java +++ b/test/jdk/tools/jlink/plugins/StripNativeDebugSymbolsPlugin/StripNativeDebugSymbolsPluginTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jdk/tools/jpackage/windows/WinInstallerUiTest.java b/test/jdk/tools/jpackage/windows/WinInstallerUiTest.java index c6489ab68cf4..7dcf025a506c 100644 --- a/test/jdk/tools/jpackage/windows/WinInstallerUiTest.java +++ b/test/jdk/tools/jpackage/windows/WinInstallerUiTest.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, 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 @@ -122,13 +122,13 @@ private void setPackageName(JPackageCommand cmd) { StringBuilder sb = new StringBuilder(cmd.name()); sb.append("With"); if (withDirChooser) { - sb.append("DirChooser"); + sb.append("Dc"); // DirChooser } if (withShortcutPrompt) { - sb.append("ShortcutPrompt"); + sb.append("Sp"); // ShortcutPrompt } if (withLicense) { - sb.append("License"); + sb.append("L"); // License } cmd.setArgumentValue("--name", sb.toString()); } diff --git a/test/jdk/tools/launcher/exeJliLaunchTest.c b/test/jdk/tools/launcher/exeJliLaunchTest.c index 6220a2f4b3b3..9157b309f56d 100644 --- a/test/jdk/tools/launcher/exeJliLaunchTest.c +++ b/test/jdk/tools/launcher/exeJliLaunchTest.c @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/jtreg-ext/requires/VMProps.java b/test/jtreg-ext/requires/VMProps.java index c6ba2790286c..ffe981072b6c 100644 --- a/test/jtreg-ext/requires/VMProps.java +++ b/test/jtreg-ext/requires/VMProps.java @@ -383,6 +383,7 @@ protected void vmOptFinalFlags(SafeMap map) { vmOptFinalFlag(map, "EliminateAllocations"); vmOptFinalFlag(map, "UnlockExperimentalVMOptions"); vmOptFinalFlag(map, "UseCompressedOops"); + vmOptFinalFlag(map, "UseLargePages"); vmOptFinalFlag(map, "UseVectorizedMismatchIntrinsic"); vmOptFinalFlag(map, "UseVtableBasedCHA"); vmOptFinalFlag(map, "ZGenerational"); diff --git a/test/langtools/jdk/jshell/FailOverDirectExecutionControlTest.java b/test/langtools/jdk/jshell/FailOverDirectExecutionControlTest.java index a094ed4a86f3..99457ea2ce6d 100644 --- a/test/langtools/jdk/jshell/FailOverDirectExecutionControlTest.java +++ b/test/langtools/jdk/jshell/FailOverDirectExecutionControlTest.java @@ -62,6 +62,7 @@ public class FailOverDirectExecutionControlTest extends ExecutionControlTestBase ClassLoader ccl; ExecutionControlProvider provider; + Logger logger; LogTestHandler hndlr; Map> logged; @@ -95,7 +96,7 @@ public void close() throws SecurityException { @BeforeMethod @Override public void setUp() { - Logger logger = Logger.getLogger("jdk.jshell.execution"); + logger = Logger.getLogger("jdk.jshell.execution"); logger.setLevel(Level.ALL); hndlr = new LogTestHandler(); logger.addHandler(hndlr); @@ -137,8 +138,8 @@ public void setUp() { @Override public void tearDown() { super.tearDown(); - Logger logger = Logger.getLogger("jdk.jshell.execution"); logger.removeHandler(hndlr); + logger = null; Thread.currentThread().setContextClassLoader(ccl); } diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/CompletionErrorOnEnclosingType.java b/test/langtools/tools/javac/annotations/typeAnnotations/CompletionErrorOnEnclosingType.java new file mode 100644 index 000000000000..4928ee273517 --- /dev/null +++ b/test/langtools/tools/javac/annotations/typeAnnotations/CompletionErrorOnEnclosingType.java @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2024, Alphabet LLC. 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 8337998 + * @summary CompletionFailure in getEnclosingType attaching type annotations + * @library /tools/javac/lib /tools/lib + * @modules jdk.compiler/com.sun.tools.javac.api + * jdk.compiler/com.sun.tools.javac.main + */ + +import toolbox.*; +import toolbox.Task.*; + +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.List; + +public class CompletionErrorOnEnclosingType { + ToolBox tb = new ToolBox(); + + public static void main(String... args) throws Exception { + CompletionErrorOnEnclosingType t = new CompletionErrorOnEnclosingType(); + t.testMissingEnclosingType(); + } + + void testMissingEnclosingType() throws Exception { + String annoSrc = + """ + import static java.lang.annotation.ElementType.TYPE_USE; + import java.lang.annotation.Target; + @Target(TYPE_USE) + @interface Anno {} + + class A {} + + class B { + private @Anno A a; + } + """; + String cSrc = + """ + class C { + B b; + } + """; + + Path base = Paths.get("."); + Path src = base.resolve("src"); + tb.createDirectories(src); + tb.writeJavaFiles(src, annoSrc, cSrc); + Path out = base.resolve("out"); + tb.createDirectories(out); + new JavacTask(tb).outdir(out).files(tb.findJavaFiles(src)).run(); + + // now if we remove A.class there will be an error but javac should not crash + tb.deleteFiles(out.resolve("A.class")); + List log = + new JavacTask(tb) + .outdir(out) + .classpath(out) + .options("-XDrawDiagnostics", "-XDaddTypeAnnotationsToSymbol=true") + .files(src.resolve("C.java")) + .run(Expect.FAIL) + .writeAll() + .getOutputLines(Task.OutputKind.DIRECT); + + var expectedOutput = + List.of( + "B.class:-:-: compiler.err.cant.attach.type.annotations: @Anno, B, a," + + " (compiler.misc.class.file.not.found: A)", + "1 error"); + if (!expectedOutput.equals(log)) { + throw new Exception("expected output not found: " + log); + } + } +} diff --git a/test/langtools/tools/javac/annotations/typeAnnotations/TypeAnnosOnConstructorsTest.java b/test/langtools/tools/javac/annotations/typeAnnotations/TypeAnnosOnConstructorsTest.java new file mode 100644 index 000000000000..996d12b35a4f --- /dev/null +++ b/test/langtools/tools/javac/annotations/typeAnnotations/TypeAnnosOnConstructorsTest.java @@ -0,0 +1,137 @@ +/* + * Copyright (c) 2023, 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 8320001 + * @summary javac crashes while adding type annotations to the return type of a constructor + * @library /tools/lib /tools/javac/lib + * @modules + * jdk.compiler/com.sun.tools.javac.api + * jdk.compiler/com.sun.tools.javac.main + * @build toolbox.ToolBox toolbox.JavacTask + * @run main TypeAnnosOnConstructorsTest + */ + +import java.io.IOException; + +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; + +import java.util.List; +import java.util.Set; +import javax.annotation.processing.AbstractProcessor; +import javax.annotation.processing.RoundEnvironment; +import javax.annotation.processing.SupportedAnnotationTypes; +import javax.lang.model.SourceVersion; +import javax.lang.model.element.TypeElement; + +import toolbox.JavacTask; +import toolbox.Task; +import toolbox.Task.Mode; +import toolbox.Task.OutputKind; +import toolbox.TestRunner; +import toolbox.ToolBox; + +public class TypeAnnosOnConstructorsTest extends TestRunner { + protected ToolBox tb; + + TypeAnnosOnConstructorsTest() { + super(System.err); + tb = new ToolBox(); + } + + public static void main(String... args) throws Exception { + new TypeAnnosOnConstructorsTest().runTests(); + } + + protected void runTests() throws Exception { + runTests(m -> new Object[]{Paths.get(m.getName())}); + } + + Path[] findJavaFiles(Path... paths) throws IOException { + return tb.findJavaFiles(paths); + } + + @Test + public void testAnnoOnConstructors(Path base) throws Exception { + Path src = base.resolve("src"); + Path y = src.resolve("Y.java"); + Path classes = base.resolve("classes"); + + Files.createDirectories(classes); + + tb.writeJavaFiles(src, + """ + import java.lang.annotation.Target; + import java.lang.annotation.ElementType; + import java.lang.annotation.Retention; + import java.lang.annotation.RetentionPolicy; + + class Y { + @TA public Y() {} + } + + @Target(ElementType.TYPE_USE) + @Retention(RetentionPolicy.RUNTIME) + @interface TA {} + """); + + // we need to compile Y first + new JavacTask(tb) + .files(y) + .outdir(classes) + .run(); + + Path classDir = getClassDir(); + new JavacTask(tb) + .classpath(classes, classDir) + .options("-processor", SimpleProcessor.class.getName()) + .classes("Y") + .outdir(classes) + .run(Task.Expect.SUCCESS); + } + + public Path getClassDir() { + String classes = ToolBox.testClasses; + if (classes == null) { + return Paths.get("build"); + } else { + return Paths.get(classes); + } + } + + @SupportedAnnotationTypes("*") + public static final class SimpleProcessor extends AbstractProcessor { + @Override + public SourceVersion getSupportedSourceVersion() { + return SourceVersion.latestSupported(); + } + + @Override + public boolean process(Set annotations, RoundEnvironment roundEnv) { + return false; + } + } +} diff --git a/test/langtools/tools/javac/diags/examples.not-yet.txt b/test/langtools/tools/javac/diags/examples.not-yet.txt index 983469b78c24..e460a494a655 100644 --- a/test/langtools/tools/javac/diags/examples.not-yet.txt +++ b/test/langtools/tools/javac/diags/examples.not-yet.txt @@ -41,6 +41,7 @@ compiler.err.signature.doesnt.match.intf # UNUSED compiler.err.signature.doesnt.match.supertype # UNUSED compiler.err.source.cant.overwrite.input.file compiler.err.stack.sim.error +compiler.err.cant.attach.type.annotations # bad class file compiler.err.type.var.more.than.once # UNUSED compiler.err.type.var.more.than.once.in.result # UNUSED compiler.err.unexpected.type diff --git a/test/langtools/tools/javac/processing/model/type/BasicAnnoTests.java b/test/langtools/tools/javac/processing/model/type/BasicAnnoTests.java index b8e50f9b15f6..1606d93e6f80 100644 --- a/test/langtools/tools/javac/processing/model/type/BasicAnnoTests.java +++ b/test/langtools/tools/javac/processing/model/type/BasicAnnoTests.java @@ -33,6 +33,7 @@ * jdk.compiler/com.sun.tools.javac.util * @build JavacTestingAbstractProcessor DPrinter BasicAnnoTests * @compile/process -XDaccessInternalAPI -processor BasicAnnoTests -proc:only BasicAnnoTests.java + * @compile/process -XDaccessInternalAPI -XDaddTypeAnnotationsToSymbol=true -processor BasicAnnoTests -proc:only BasicAnnoTests */ import java.io.PrintWriter; @@ -585,4 +586,8 @@ class Inner90<@TA(90) T> { @Test(posn=4, annoType = TB.class, expect = "100") class Inner100> { } + + @Test(posn=1, annoType=TA.class, expect="130") + @Test(posn=23, annoType=TA.class, expect="131") + public Map<@TA(130) String, @TA(131) String> f130; } diff --git a/test/langtools/tools/javac/recovery/CrashDueToUnreportedError.java b/test/langtools/tools/javac/recovery/CrashDueToUnreportedError.java new file mode 100644 index 000000000000..4520a01f7ec8 --- /dev/null +++ b/test/langtools/tools/javac/recovery/CrashDueToUnreportedError.java @@ -0,0 +1,29 @@ +/** + * @test /nodynamiccopyright/ + * @bug 8320948 + * @summary NPE due to unreported compiler error + * @compile/fail/ref=CrashDueToUnreportedError.out -XDrawDiagnostics CrashDueToUnreportedError.java + */ + +import java.util.List; + +public class CrashDueToUnreportedError { + class Builder { + private Builder(Person person, String unused) {} + public Builder withTypes(Entity entities) { + return new Builder(Person.make(Entity.combineAll(entities))); + } + } + + interface Person { + static Person make(List> eventSubtypes) { + return null; + } + } + + class Entity { + public static List> combineAll(Entity subtypes) { + return null; + } + } +} diff --git a/test/langtools/tools/javac/recovery/CrashDueToUnreportedError.out b/test/langtools/tools/javac/recovery/CrashDueToUnreportedError.out new file mode 100644 index 000000000000..83655eb07baa --- /dev/null +++ b/test/langtools/tools/javac/recovery/CrashDueToUnreportedError.out @@ -0,0 +1,2 @@ +CrashDueToUnreportedError.java:14:43: compiler.err.prob.found.req: (compiler.misc.infer.no.conforming.assignment.exists: E,compiler.misc.type.captureof: 1, ? extends CrashDueToUnreportedError.Entity,Root, (compiler.misc.inconvertible.types: java.util.List>, java.util.List>)) +1 error diff --git a/test/lib/jdk/test/lib/Asserts.java b/test/lib/jdk/test/lib/Asserts.java index 2febd00e9754..893f1a1a7376 100644 --- a/test/lib/jdk/test/lib/Asserts.java +++ b/test/lib/jdk/test/lib/Asserts.java @@ -201,10 +201,7 @@ public static void assertEquals(Object lhs, Object rhs) { */ public static void assertEquals(Object lhs, Object rhs, String msg) { if ((lhs != rhs) && ((lhs == null) || !(lhs.equals(rhs)))) { - msg = Objects.toString(msg, "assertEquals") - + ": expected " + Objects.toString(lhs) - + " to equal " + Objects.toString(rhs); - fail(msg); + fail((msg == null ? "assertEquals" : msg) + " expected: " + lhs + " but was: " + rhs); } } diff --git a/test/lib/jdk/test/lib/OSVersion.java b/test/lib/jdk/test/lib/OSVersion.java index bb9f128bda52..776e25fe096b 100644 --- a/test/lib/jdk/test/lib/OSVersion.java +++ b/test/lib/jdk/test/lib/OSVersion.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/lib/jdk/test/lib/cds/CDSArchiveUtils.java b/test/lib/jdk/test/lib/cds/CDSArchiveUtils.java index 38748ec432b7..fd76df92ef63 100644 --- a/test/lib/jdk/test/lib/cds/CDSArchiveUtils.java +++ b/test/lib/jdk/test/lib/cds/CDSArchiveUtils.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2024, 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 @@ -145,6 +145,7 @@ public class CDSArchiveUtils { public static int dynamicArchiveHeaderSize() { return dynamicArchiveHeaderSize; } public static int cdsFileMapRegionSize() { return cdsFileMapRegionSize; } public static long alignment() { return alignment; } + public static int num_regions() { return num_regions; } @@ -495,9 +496,14 @@ public static File deleteBytesAtTheEnd(File orgFile, String newFileName) throws } // used region size - public static long usedRegionSizeAligned(File archiveFile, int region) throws Exception { + public static long usedRegionSize(File archiveFile, int region) throws Exception { long offset = spOffset + cdsFileMapRegionSize * region + spUsedOffset; - long used = readInt(archiveFile, offset, sizetSize); + return readInt(archiveFile, offset, sizetSize); + } + + // used region size + public static long usedRegionSizeAligned(File archiveFile, int region) throws Exception { + long used = usedRegionSize(archiveFile, region); return alignUpWithAlignment(used); } } diff --git a/test/lib/jdk/test/lib/compiler/InMemoryJavaCompiler.java b/test/lib/jdk/test/lib/compiler/InMemoryJavaCompiler.java index 6016e48bf4e5..4722ef3b67a9 100644 --- a/test/lib/jdk/test/lib/compiler/InMemoryJavaCompiler.java +++ b/test/lib/jdk/test/lib/compiler/InMemoryJavaCompiler.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2013, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2013, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -26,11 +26,18 @@ import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.OutputStream; +import java.io.StringWriter; +import java.io.Writer; import java.net.URI; import java.util.ArrayList; import java.util.Arrays; +import java.util.Collection; +import java.util.HashMap; +import java.util.LinkedList; import java.util.List; +import java.util.Map; +import java.util.Map.Entry; import javax.tools.FileObject; import javax.tools.ForwardingJavaFileManager; @@ -76,36 +83,6 @@ * */ public class InMemoryJavaCompiler { - private static class MemoryJavaFileObject extends SimpleJavaFileObject { - private final String className; - private final CharSequence sourceCode; - private final ByteArrayOutputStream byteCode; - - public MemoryJavaFileObject(String className, CharSequence sourceCode) { - super(URI.create("string:///" + className.replace('.','/') + Kind.SOURCE.extension), Kind.SOURCE); - this.className = className; - this.sourceCode = sourceCode; - this.byteCode = new ByteArrayOutputStream(); - } - - @Override - public CharSequence getCharContent(boolean ignoreEncodingErrors) { - return sourceCode; - } - - @Override - public OutputStream openOutputStream() throws IOException { - return byteCode; - } - - public byte[] getByteCode() { - return byteCode.toByteArray(); - } - - public String getClassName() { - return className; - } - } private static class FileManagerWrapper extends ForwardingJavaFileManager { private static final Location PATCH_LOCATION = new Location() { @@ -119,12 +96,13 @@ public boolean isOutputLocation() { return false; } }; - private final MemoryJavaFileObject file; + private final SourceFile srcFile; + private ClassFile clsFile; private final String moduleOverride; - public FileManagerWrapper(MemoryJavaFileObject file, String moduleOverride) { + public FileManagerWrapper(SourceFile file, String moduleOverride) { super(getCompiler().getStandardFileManager(null, null, null)); - this.file = file; + this.srcFile = file; this.moduleOverride = moduleOverride; } @@ -132,16 +110,17 @@ public FileManagerWrapper(MemoryJavaFileObject file, String moduleOverride) { public JavaFileObject getJavaFileForOutput(Location location, String className, Kind kind, FileObject sibling) throws IOException { - if (!file.getClassName().equals(className)) { - throw new IOException("Expected class with name " + file.getClassName() + + if (!srcFile.getClassName().equals(className)) { + throw new IOException("Expected class with name " + srcFile.getClassName() + ", but got " + className); } - return file; + clsFile = new ClassFile(className); + return clsFile; } @Override public Location getLocationForModule(Location location, JavaFileObject fo) throws IOException { - if (fo == file && moduleOverride != null) { + if (fo == srcFile && moduleOverride != null) { return PATCH_LOCATION; } return super.getLocationForModule(location, fo); @@ -160,6 +139,100 @@ public boolean hasLocation(Location location) { return super.hasLocation(location) || location == StandardLocation.PATCH_MODULE_PATH; } + public byte[] getByteCode() { + return clsFile.toByteArray(); + } + + } + + // Wraper for class file + static class ClassFile extends SimpleJavaFileObject { + + private final ByteArrayOutputStream baos = new ByteArrayOutputStream(); + + protected ClassFile(String name) { + super(URI.create("memo:///" + name.replace('.', '/') + Kind.CLASS.extension), Kind.CLASS); + } + + @Override + public ByteArrayOutputStream openOutputStream() { return this.baos; } + + byte[] toByteArray() { return baos.toByteArray(); } + } + + // File manager which spawns ClassFile instances by demand + static class FileManager extends ForwardingJavaFileManager { + + private Map classesMap = new HashMap(); + + protected FileManager(JavaFileManager fileManager) { + super(fileManager); + } + + @Override + public ClassFile getJavaFileForOutput(Location location, String name, JavaFileObject.Kind kind, FileObject source) { + ClassFile classFile = new ClassFile(name); + classesMap.put(name, classFile); + return classFile; + } + + public Map getByteCode() { + Map result = new HashMap(); + for (Entry entry : classesMap.entrySet()) { + result.put(entry.getKey(), entry.getValue().toByteArray()); + } + return result; + } + } + + // Wrapper for source file + static class SourceFile extends SimpleJavaFileObject { + + private CharSequence sourceCode; + private String className; + + public SourceFile(String name, CharSequence sourceCode) { + super(URI.create("memo:///" + name.replace('.', '/') + Kind.SOURCE.extension), Kind.SOURCE); + this.sourceCode = sourceCode; + this.className = name; + } + + @Override + public CharSequence getCharContent(boolean ignore) { + return this.sourceCode; + } + + public String getClassName() { + return this.className; + } + } + + /** + * Compiles the list of classes with the given map of name and source code. + * This overloaded version of compile is useful for batch compile use cases. + * + * @param inputMap The map containing the name of the class and corresponding source code + * @throws RuntimeException if the compilation did not succeed + * @return The resulting byte code from the compilation + */ + public static Map compile(Map inputMap) { + Collection sourceFiles = new LinkedList(); + for (Entry entry : inputMap.entrySet()) { + sourceFiles.add(new SourceFile(entry.getKey(), entry.getValue())); + } + + JavaCompiler compiler = ToolProvider.getSystemJavaCompiler(); + FileManager fileManager = new FileManager(compiler.getStandardFileManager(null, null, null)); + + Writer writer = new StringWriter(); + Boolean exitCode = compiler.getTask(writer, fileManager, null, null, null, sourceFiles).call(); + if (!exitCode) { + System.out.println("*********** javac output begin ***********"); + System.out.println(writer.toString()); + System.out.println("*********** javac output end ***********"); + throw new RuntimeException("Test bug: in memory compilation failed."); + } + return fileManager.getByteCode(); } /** @@ -173,7 +246,7 @@ public boolean hasLocation(Location location) { * @return The resulting byte code from the compilation */ public static byte[] compile(String className, CharSequence sourceCode, String... options) { - MemoryJavaFileObject file = new MemoryJavaFileObject(className, sourceCode); + SourceFile file = new SourceFile(className, sourceCode); List opts = new ArrayList<>(); String moduleOverride = null; for (String opt : options) { @@ -183,13 +256,13 @@ public static byte[] compile(String className, CharSequence sourceCode, String.. opts.add(opt); } } - try (JavaFileManager fileManager = new FileManagerWrapper(file, moduleOverride)) { + try (FileManagerWrapper fileManager = new FileManagerWrapper(file, moduleOverride)) { CompilationTask task = getCompiler().getTask(null, fileManager, null, opts, null, Arrays.asList(file)); if (!task.call()) { throw new RuntimeException("Could not compile " + className + " with source code " + sourceCode); } - return file.getByteCode(); + return fileManager.getByteCode(); } catch (IOException ioe) { throw new RuntimeException(ioe); } diff --git a/test/lib/jdk/test/lib/hprof/model/AbstractJavaHeapObjectVisitor.java b/test/lib/jdk/test/lib/hprof/model/AbstractJavaHeapObjectVisitor.java index 4624347ff6b2..0ad43d0a1fbc 100644 --- a/test/lib/jdk/test/lib/hprof/model/AbstractJavaHeapObjectVisitor.java +++ b/test/lib/jdk/test/lib/hprof/model/AbstractJavaHeapObjectVisitor.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/lib/jdk/test/lib/hprof/model/ArrayTypeCodes.java b/test/lib/jdk/test/lib/hprof/model/ArrayTypeCodes.java index c6ac3ac372a3..0c12c4ee03c2 100644 --- a/test/lib/jdk/test/lib/hprof/model/ArrayTypeCodes.java +++ b/test/lib/jdk/test/lib/hprof/model/ArrayTypeCodes.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/lib/jdk/test/lib/hprof/model/HackJavaValue.java b/test/lib/jdk/test/lib/hprof/model/HackJavaValue.java index cc43b59b92f0..c7bf9bb92601 100644 --- a/test/lib/jdk/test/lib/hprof/model/HackJavaValue.java +++ b/test/lib/jdk/test/lib/hprof/model/HackJavaValue.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/lib/jdk/test/lib/hprof/model/JavaBoolean.java b/test/lib/jdk/test/lib/hprof/model/JavaBoolean.java index e96766ddba6b..66cadb5311b2 100644 --- a/test/lib/jdk/test/lib/hprof/model/JavaBoolean.java +++ b/test/lib/jdk/test/lib/hprof/model/JavaBoolean.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/lib/jdk/test/lib/hprof/model/JavaByte.java b/test/lib/jdk/test/lib/hprof/model/JavaByte.java index e4a1d3300087..4cda9d7d5794 100644 --- a/test/lib/jdk/test/lib/hprof/model/JavaByte.java +++ b/test/lib/jdk/test/lib/hprof/model/JavaByte.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/lib/jdk/test/lib/hprof/model/JavaChar.java b/test/lib/jdk/test/lib/hprof/model/JavaChar.java index 7c04f503efd1..134cc6d19943 100644 --- a/test/lib/jdk/test/lib/hprof/model/JavaChar.java +++ b/test/lib/jdk/test/lib/hprof/model/JavaChar.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/lib/jdk/test/lib/hprof/model/JavaClass.java b/test/lib/jdk/test/lib/hprof/model/JavaClass.java index 75b345336763..eea149ceee85 100644 --- a/test/lib/jdk/test/lib/hprof/model/JavaClass.java +++ b/test/lib/jdk/test/lib/hprof/model/JavaClass.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/lib/jdk/test/lib/hprof/model/JavaDouble.java b/test/lib/jdk/test/lib/hprof/model/JavaDouble.java index 3b643029896a..fce2e6647ff3 100644 --- a/test/lib/jdk/test/lib/hprof/model/JavaDouble.java +++ b/test/lib/jdk/test/lib/hprof/model/JavaDouble.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/lib/jdk/test/lib/hprof/model/JavaField.java b/test/lib/jdk/test/lib/hprof/model/JavaField.java index d343f913abd7..1352616c9a6e 100644 --- a/test/lib/jdk/test/lib/hprof/model/JavaField.java +++ b/test/lib/jdk/test/lib/hprof/model/JavaField.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/lib/jdk/test/lib/hprof/model/JavaFloat.java b/test/lib/jdk/test/lib/hprof/model/JavaFloat.java index 446921250244..7ddb8daf7774 100644 --- a/test/lib/jdk/test/lib/hprof/model/JavaFloat.java +++ b/test/lib/jdk/test/lib/hprof/model/JavaFloat.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/lib/jdk/test/lib/hprof/model/JavaHeapObject.java b/test/lib/jdk/test/lib/hprof/model/JavaHeapObject.java index a6c1cafb2c96..03eb0b657a3a 100644 --- a/test/lib/jdk/test/lib/hprof/model/JavaHeapObject.java +++ b/test/lib/jdk/test/lib/hprof/model/JavaHeapObject.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/lib/jdk/test/lib/hprof/model/JavaHeapObjectVisitor.java b/test/lib/jdk/test/lib/hprof/model/JavaHeapObjectVisitor.java index 77607655a8e3..560a64a8b979 100644 --- a/test/lib/jdk/test/lib/hprof/model/JavaHeapObjectVisitor.java +++ b/test/lib/jdk/test/lib/hprof/model/JavaHeapObjectVisitor.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/lib/jdk/test/lib/hprof/model/JavaInt.java b/test/lib/jdk/test/lib/hprof/model/JavaInt.java index 9360f858eb82..d2d2a22e5deb 100644 --- a/test/lib/jdk/test/lib/hprof/model/JavaInt.java +++ b/test/lib/jdk/test/lib/hprof/model/JavaInt.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/lib/jdk/test/lib/hprof/model/JavaLazyReadObject.java b/test/lib/jdk/test/lib/hprof/model/JavaLazyReadObject.java index 8e88d2613c1d..dcae8fa13e3f 100644 --- a/test/lib/jdk/test/lib/hprof/model/JavaLazyReadObject.java +++ b/test/lib/jdk/test/lib/hprof/model/JavaLazyReadObject.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/lib/jdk/test/lib/hprof/model/JavaLong.java b/test/lib/jdk/test/lib/hprof/model/JavaLong.java index 28aca95670ba..b051392cad65 100644 --- a/test/lib/jdk/test/lib/hprof/model/JavaLong.java +++ b/test/lib/jdk/test/lib/hprof/model/JavaLong.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/lib/jdk/test/lib/hprof/model/JavaObject.java b/test/lib/jdk/test/lib/hprof/model/JavaObject.java index e7f93e01a366..6ab2634588fd 100644 --- a/test/lib/jdk/test/lib/hprof/model/JavaObject.java +++ b/test/lib/jdk/test/lib/hprof/model/JavaObject.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/lib/jdk/test/lib/hprof/model/JavaObjectArray.java b/test/lib/jdk/test/lib/hprof/model/JavaObjectArray.java index 232c62794e1b..123fbfafbac8 100644 --- a/test/lib/jdk/test/lib/hprof/model/JavaObjectArray.java +++ b/test/lib/jdk/test/lib/hprof/model/JavaObjectArray.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/lib/jdk/test/lib/hprof/model/JavaObjectRef.java b/test/lib/jdk/test/lib/hprof/model/JavaObjectRef.java index 6b8d2a50be14..b2f3242d286e 100644 --- a/test/lib/jdk/test/lib/hprof/model/JavaObjectRef.java +++ b/test/lib/jdk/test/lib/hprof/model/JavaObjectRef.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/lib/jdk/test/lib/hprof/model/JavaShort.java b/test/lib/jdk/test/lib/hprof/model/JavaShort.java index 7c4e46acc021..dc171fe908d0 100644 --- a/test/lib/jdk/test/lib/hprof/model/JavaShort.java +++ b/test/lib/jdk/test/lib/hprof/model/JavaShort.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/lib/jdk/test/lib/hprof/model/JavaStatic.java b/test/lib/jdk/test/lib/hprof/model/JavaStatic.java index 79a5b0d64b7b..0fa3fbb06dc5 100644 --- a/test/lib/jdk/test/lib/hprof/model/JavaStatic.java +++ b/test/lib/jdk/test/lib/hprof/model/JavaStatic.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/lib/jdk/test/lib/hprof/model/JavaThing.java b/test/lib/jdk/test/lib/hprof/model/JavaThing.java index 024928ec0191..a76c9cc3198c 100644 --- a/test/lib/jdk/test/lib/hprof/model/JavaThing.java +++ b/test/lib/jdk/test/lib/hprof/model/JavaThing.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/lib/jdk/test/lib/hprof/model/JavaValue.java b/test/lib/jdk/test/lib/hprof/model/JavaValue.java index e7d10055d375..662b069577e4 100644 --- a/test/lib/jdk/test/lib/hprof/model/JavaValue.java +++ b/test/lib/jdk/test/lib/hprof/model/JavaValue.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/lib/jdk/test/lib/hprof/model/JavaValueArray.java b/test/lib/jdk/test/lib/hprof/model/JavaValueArray.java index 0779a0aaaa45..74812701a43e 100644 --- a/test/lib/jdk/test/lib/hprof/model/JavaValueArray.java +++ b/test/lib/jdk/test/lib/hprof/model/JavaValueArray.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/lib/jdk/test/lib/hprof/model/ReachableExcludes.java b/test/lib/jdk/test/lib/hprof/model/ReachableExcludes.java index b95183251ab1..0ebd61573742 100644 --- a/test/lib/jdk/test/lib/hprof/model/ReachableExcludes.java +++ b/test/lib/jdk/test/lib/hprof/model/ReachableExcludes.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/lib/jdk/test/lib/hprof/model/ReachableExcludesImpl.java b/test/lib/jdk/test/lib/hprof/model/ReachableExcludesImpl.java index af4abbfea9b4..9c4f68a13997 100644 --- a/test/lib/jdk/test/lib/hprof/model/ReachableExcludesImpl.java +++ b/test/lib/jdk/test/lib/hprof/model/ReachableExcludesImpl.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/lib/jdk/test/lib/hprof/model/ReachableObjects.java b/test/lib/jdk/test/lib/hprof/model/ReachableObjects.java index 1ba41e9fe86c..3dcc5a088230 100644 --- a/test/lib/jdk/test/lib/hprof/model/ReachableObjects.java +++ b/test/lib/jdk/test/lib/hprof/model/ReachableObjects.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/lib/jdk/test/lib/hprof/model/ReferenceChain.java b/test/lib/jdk/test/lib/hprof/model/ReferenceChain.java index 3b2175194479..62a53919b48a 100644 --- a/test/lib/jdk/test/lib/hprof/model/ReferenceChain.java +++ b/test/lib/jdk/test/lib/hprof/model/ReferenceChain.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/lib/jdk/test/lib/hprof/model/Root.java b/test/lib/jdk/test/lib/hprof/model/Root.java index ae7c08bfeb1a..b223c1370a5c 100644 --- a/test/lib/jdk/test/lib/hprof/model/Root.java +++ b/test/lib/jdk/test/lib/hprof/model/Root.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/lib/jdk/test/lib/hprof/model/Snapshot.java b/test/lib/jdk/test/lib/hprof/model/Snapshot.java index bbbcb2372e37..05902d7028ea 100644 --- a/test/lib/jdk/test/lib/hprof/model/Snapshot.java +++ b/test/lib/jdk/test/lib/hprof/model/Snapshot.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/lib/jdk/test/lib/hprof/model/StackFrame.java b/test/lib/jdk/test/lib/hprof/model/StackFrame.java index 723cf64986e0..0ea2b0e47166 100644 --- a/test/lib/jdk/test/lib/hprof/model/StackFrame.java +++ b/test/lib/jdk/test/lib/hprof/model/StackFrame.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/lib/jdk/test/lib/hprof/model/StackTrace.java b/test/lib/jdk/test/lib/hprof/model/StackTrace.java index 75c92fc9cdfd..ecab592e3420 100644 --- a/test/lib/jdk/test/lib/hprof/model/StackTrace.java +++ b/test/lib/jdk/test/lib/hprof/model/StackTrace.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/lib/jdk/test/lib/hprof/parser/FileReadBuffer.java b/test/lib/jdk/test/lib/hprof/parser/FileReadBuffer.java index 660bdf72d3ad..eab5cff84c83 100644 --- a/test/lib/jdk/test/lib/hprof/parser/FileReadBuffer.java +++ b/test/lib/jdk/test/lib/hprof/parser/FileReadBuffer.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/lib/jdk/test/lib/hprof/parser/HprofReader.java b/test/lib/jdk/test/lib/hprof/parser/HprofReader.java index 073ec5ee13e7..ac7666367714 100644 --- a/test/lib/jdk/test/lib/hprof/parser/HprofReader.java +++ b/test/lib/jdk/test/lib/hprof/parser/HprofReader.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/lib/jdk/test/lib/hprof/parser/MappedReadBuffer.java b/test/lib/jdk/test/lib/hprof/parser/MappedReadBuffer.java index 7a1e6b860304..d91c453a0f69 100644 --- a/test/lib/jdk/test/lib/hprof/parser/MappedReadBuffer.java +++ b/test/lib/jdk/test/lib/hprof/parser/MappedReadBuffer.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/lib/jdk/test/lib/hprof/parser/PositionDataInputStream.java b/test/lib/jdk/test/lib/hprof/parser/PositionDataInputStream.java index 8435dd12a3a0..e83da8cf1c3a 100644 --- a/test/lib/jdk/test/lib/hprof/parser/PositionDataInputStream.java +++ b/test/lib/jdk/test/lib/hprof/parser/PositionDataInputStream.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/lib/jdk/test/lib/hprof/parser/PositionInputStream.java b/test/lib/jdk/test/lib/hprof/parser/PositionInputStream.java index 0c0e43de8e58..43e8f8efc9d4 100644 --- a/test/lib/jdk/test/lib/hprof/parser/PositionInputStream.java +++ b/test/lib/jdk/test/lib/hprof/parser/PositionInputStream.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/lib/jdk/test/lib/hprof/parser/ReadBuffer.java b/test/lib/jdk/test/lib/hprof/parser/ReadBuffer.java index 04abc88331a8..4b06b79a53b2 100644 --- a/test/lib/jdk/test/lib/hprof/parser/ReadBuffer.java +++ b/test/lib/jdk/test/lib/hprof/parser/ReadBuffer.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/lib/jdk/test/lib/hprof/parser/Reader.java b/test/lib/jdk/test/lib/hprof/parser/Reader.java index bfca980a4e11..447d96e770ed 100644 --- a/test/lib/jdk/test/lib/hprof/parser/Reader.java +++ b/test/lib/jdk/test/lib/hprof/parser/Reader.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/lib/jdk/test/lib/hprof/util/ArraySorter.java b/test/lib/jdk/test/lib/hprof/util/ArraySorter.java index 5378528a93ec..9b64a6f14a7e 100644 --- a/test/lib/jdk/test/lib/hprof/util/ArraySorter.java +++ b/test/lib/jdk/test/lib/hprof/util/ArraySorter.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/lib/jdk/test/lib/hprof/util/Comparer.java b/test/lib/jdk/test/lib/hprof/util/Comparer.java index 182f37edf612..750d76e8510c 100644 --- a/test/lib/jdk/test/lib/hprof/util/Comparer.java +++ b/test/lib/jdk/test/lib/hprof/util/Comparer.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/lib/jdk/test/lib/hprof/util/CompositeEnumeration.java b/test/lib/jdk/test/lib/hprof/util/CompositeEnumeration.java index ddebd0fb3ed1..9aa610026193 100644 --- a/test/lib/jdk/test/lib/hprof/util/CompositeEnumeration.java +++ b/test/lib/jdk/test/lib/hprof/util/CompositeEnumeration.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/lib/jdk/test/lib/hprof/util/Misc.java b/test/lib/jdk/test/lib/hprof/util/Misc.java index 42e0ce0b46e2..b1d6cfeabdbc 100644 --- a/test/lib/jdk/test/lib/hprof/util/Misc.java +++ b/test/lib/jdk/test/lib/hprof/util/Misc.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/lib/jdk/test/lib/hprof/util/VectorSorter.java b/test/lib/jdk/test/lib/hprof/util/VectorSorter.java index fb2ac13e175f..b835d49719f3 100644 --- a/test/lib/jdk/test/lib/hprof/util/VectorSorter.java +++ b/test/lib/jdk/test/lib/hprof/util/VectorSorter.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/lib/jdk/test/lib/jfr/AppExecutorHelper.java b/test/lib/jdk/test/lib/jfr/AppExecutorHelper.java index 5268e05b6888..90621c2ed994 100644 --- a/test/lib/jdk/test/lib/jfr/AppExecutorHelper.java +++ b/test/lib/jdk/test/lib/jfr/AppExecutorHelper.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/lib/jdk/test/lib/jfr/CommonHelper.java b/test/lib/jdk/test/lib/jfr/CommonHelper.java index 10ae4dffaf8c..943837f6d90b 100644 --- a/test/lib/jdk/test/lib/jfr/CommonHelper.java +++ b/test/lib/jdk/test/lib/jfr/CommonHelper.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/lib/jdk/test/lib/jfr/EventField.java b/test/lib/jdk/test/lib/jfr/EventField.java index 3b802e755868..22b78258b796 100644 --- a/test/lib/jdk/test/lib/jfr/EventField.java +++ b/test/lib/jdk/test/lib/jfr/EventField.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/lib/jdk/test/lib/jfr/EventNames.java b/test/lib/jdk/test/lib/jfr/EventNames.java index 10c7ee20a015..ba53f9598df5 100644 --- a/test/lib/jdk/test/lib/jfr/EventNames.java +++ b/test/lib/jdk/test/lib/jfr/EventNames.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/lib/jdk/test/lib/jfr/EventTypePrototype.java b/test/lib/jdk/test/lib/jfr/EventTypePrototype.java index d5afe8578318..cdedcd975e01 100644 --- a/test/lib/jdk/test/lib/jfr/EventTypePrototype.java +++ b/test/lib/jdk/test/lib/jfr/EventTypePrototype.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/lib/jdk/test/lib/jfr/EventVerifier.java b/test/lib/jdk/test/lib/jfr/EventVerifier.java index a72fb1c4ba65..5422a701d7ec 100644 --- a/test/lib/jdk/test/lib/jfr/EventVerifier.java +++ b/test/lib/jdk/test/lib/jfr/EventVerifier.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/lib/jdk/test/lib/jfr/Events.java b/test/lib/jdk/test/lib/jfr/Events.java index 68a757af5e95..620e5b0fcc3e 100644 --- a/test/lib/jdk/test/lib/jfr/Events.java +++ b/test/lib/jdk/test/lib/jfr/Events.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/lib/jdk/test/lib/jfr/FileHelper.java b/test/lib/jdk/test/lib/jfr/FileHelper.java index d84c47613f64..9c0f5afe15e9 100644 --- a/test/lib/jdk/test/lib/jfr/FileHelper.java +++ b/test/lib/jdk/test/lib/jfr/FileHelper.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/lib/jdk/test/lib/jfr/GCHelper.java b/test/lib/jdk/test/lib/jfr/GCHelper.java index 316a4767e256..6d1c424e0920 100644 --- a/test/lib/jdk/test/lib/jfr/GCHelper.java +++ b/test/lib/jdk/test/lib/jfr/GCHelper.java @@ -4,9 +4,7 @@ * * 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. + * 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 @@ -197,8 +195,7 @@ public static List removeFirstAndLastGC(List event "Survivor", "Starts Humongous", "Continues Humongous", - "Old", - "Archive" + "Old" }; g1HeapRegionTypes = Collections.unmodifiableList(Arrays.asList(g1HeapRegionTypeLiterals)); diff --git a/test/lib/jdk/test/lib/jfr/RecurseThread.java b/test/lib/jdk/test/lib/jfr/RecurseThread.java index 479af0996410..854afe7db6d8 100644 --- a/test/lib/jdk/test/lib/jfr/RecurseThread.java +++ b/test/lib/jdk/test/lib/jfr/RecurseThread.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/lib/jdk/test/lib/jfr/SimpleEvent.java b/test/lib/jdk/test/lib/jfr/SimpleEvent.java index 8476b0011b5b..cd8b5966b8ac 100644 --- a/test/lib/jdk/test/lib/jfr/SimpleEvent.java +++ b/test/lib/jdk/test/lib/jfr/SimpleEvent.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/lib/jdk/test/lib/jfr/SimpleEventHelper.java b/test/lib/jdk/test/lib/jfr/SimpleEventHelper.java index cec1d075dcb4..d4cc76938a16 100644 --- a/test/lib/jdk/test/lib/jfr/SimpleEventHelper.java +++ b/test/lib/jdk/test/lib/jfr/SimpleEventHelper.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/lib/jdk/test/lib/jfr/SimpleSetting.java b/test/lib/jdk/test/lib/jfr/SimpleSetting.java index 25c1db9d0f4f..2680412c992f 100644 --- a/test/lib/jdk/test/lib/jfr/SimpleSetting.java +++ b/test/lib/jdk/test/lib/jfr/SimpleSetting.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/lib/jdk/test/lib/jfr/StreamingUtils.java b/test/lib/jdk/test/lib/jfr/StreamingUtils.java index 427a4eb4262f..5df291a3ba7a 100644 --- a/test/lib/jdk/test/lib/jfr/StreamingUtils.java +++ b/test/lib/jdk/test/lib/jfr/StreamingUtils.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/lib/jdk/test/lib/jfr/Stressor.java b/test/lib/jdk/test/lib/jfr/Stressor.java index 4d525d1965a7..e9062ae4a59a 100644 --- a/test/lib/jdk/test/lib/jfr/Stressor.java +++ b/test/lib/jdk/test/lib/jfr/Stressor.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/lib/jdk/test/lib/jfr/TestClassLoader.java b/test/lib/jdk/test/lib/jfr/TestClassLoader.java index 4e463828c666..650fad5a0d83 100644 --- a/test/lib/jdk/test/lib/jfr/TestClassLoader.java +++ b/test/lib/jdk/test/lib/jfr/TestClassLoader.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/lib/jdk/test/lib/jfr/VoidFunction.java b/test/lib/jdk/test/lib/jfr/VoidFunction.java index 22bd1d328a77..76b1966e0b87 100644 --- a/test/lib/jdk/test/lib/jfr/VoidFunction.java +++ b/test/lib/jdk/test/lib/jfr/VoidFunction.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/lib/jdk/test/lib/jvmti/jvmti_common.h b/test/lib/jdk/test/lib/jvmti/jvmti_common.hpp similarity index 94% rename from test/lib/jdk/test/lib/jvmti/jvmti_common.h rename to test/lib/jdk/test/lib/jvmti/jvmti_common.hpp index 6a0bcf253310..9fdd4cf4cb8a 100644 --- a/test/lib/jdk/test/lib/jvmti/jvmti_common.h +++ b/test/lib/jdk/test/lib/jvmti/jvmti_common.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,8 +21,8 @@ * questions. */ -#ifndef JVMTI_COMMON_H -#define JVMTI_COMMON_H +#ifndef JVMTI_COMMON_HPP +#define JVMTI_COMMON_HPP #include #include @@ -60,8 +60,8 @@ const char* TranslateState(jint flags); const char* TranslateError(jvmtiError err); -static jvmtiExtensionFunction GetVirtualThread_func = NULL; -static jvmtiExtensionFunction GetCarrierThread_func = NULL; +static jvmtiExtensionFunction GetVirtualThread_func = nullptr; +static jvmtiExtensionFunction GetCarrierThread_func = nullptr; /** * Convert the digits of the given value argument to a null-terminated @@ -203,15 +203,15 @@ deallocate(jvmtiEnv *jvmti, JNIEnv* jni, void* ptr) { static char* get_method_class_name(jvmtiEnv *jvmti, JNIEnv* jni, jmethodID method) { - jclass klass = NULL; - char* cname = NULL; - char* result = NULL; + jclass klass = nullptr; + char* cname = nullptr; + char* result = nullptr; jvmtiError err; err = jvmti->GetMethodDeclaringClass(method, &klass); check_jvmti_status(jni, err, "get_method_class_name: error in JVMTI GetMethodDeclaringClass"); - err = jvmti->GetClassSignature(klass, &cname, NULL); + err = jvmti->GetClassSignature(klass, &cname, nullptr); check_jvmti_status(jni, err, "get_method_class_name: error in JVMTI GetClassSignature"); size_t len = strlen(cname) - 2; // get rid of leading 'L' and trailing ';' @@ -228,14 +228,14 @@ get_method_class_name(jvmtiEnv *jvmti, JNIEnv* jni, jmethodID method) { static void print_method(jvmtiEnv *jvmti, JNIEnv* jni, jmethodID method, jint depth) { - char* cname = NULL; - char* mname = NULL; - char* msign = NULL; + char* cname = nullptr; + char* mname = nullptr; + char* msign = nullptr; jvmtiError err; cname = get_method_class_name(jvmti, jni, method); - err = jvmti->GetMethodName(method, &mname, &msign, NULL); + err = jvmti->GetMethodName(method, &mname, &msign, nullptr); check_jvmti_status(jni, err, "print_method: error in JVMTI GetMethodName"); LOG("%2d: %s: %s%s\n", depth, cname, mname, msign); @@ -297,14 +297,14 @@ get_thread_name(jvmtiEnv *jvmti, JNIEnv* jni, jthread thread) { memset(&thr_info, 0, sizeof(thr_info)); err = jvmti->GetThreadInfo(thread, &thr_info); if (err == JVMTI_ERROR_WRONG_PHASE || err == JVMTI_ERROR_THREAD_NOT_ALIVE) { - return NULL; // VM or target thread completed its work + return nullptr; // VM or target thread completed its work } check_jvmti_status(jni, err, "get_thread_name: error in JVMTI GetThreadInfo call"); static const char* UNNAMED_STR = ""; static size_t UNNAMED_LEN = strlen(UNNAMED_STR); char* tname = thr_info.name; - if (tname == NULL) { + if (tname == nullptr) { err = jvmti->Allocate((jlong)(UNNAMED_LEN + 1), (unsigned char**)&tname); check_jvmti_status(jni, err, "get_method_class_name: error in JVMTI Allocate"); strncpy(tname, UNNAMED_STR, UNNAMED_LEN); @@ -315,10 +315,10 @@ get_thread_name(jvmtiEnv *jvmti, JNIEnv* jni, jthread thread) { static char* get_method_name(jvmtiEnv *jvmti, JNIEnv* jni, jmethodID method) { - char* mname = NULL; + char* mname = nullptr; jvmtiError err; - err = jvmti->GetMethodName(method, &mname, NULL, NULL); + err = jvmti->GetMethodName(method, &mname, nullptr, nullptr); check_jvmti_status(jni, err, "get_method_name: error in JVMTI GetMethodName call"); return mname; @@ -326,7 +326,7 @@ get_method_name(jvmtiEnv *jvmti, JNIEnv* jni, jmethodID method) { static jclass find_class(jvmtiEnv *jvmti, JNIEnv *jni, jobject loader, const char* cname) { - jclass *classes = NULL; + jclass *classes = nullptr; jint count = 0; jvmtiError err; @@ -335,10 +335,10 @@ find_class(jvmtiEnv *jvmti, JNIEnv *jni, jobject loader, const char* cname) { // Find the jmethodID of the specified method while (--count >= 0) { - char* name = NULL; + char* name = nullptr; jclass klass = classes[count]; - err = jvmti->GetClassSignature(klass, &name, NULL); + err = jvmti->GetClassSignature(klass, &name, nullptr); check_jvmti_status(jni, err, "find_class: error in JVMTI GetClassSignature call"); bool found = (strcmp(name, cname) == 0); @@ -347,13 +347,13 @@ find_class(jvmtiEnv *jvmti, JNIEnv *jni, jobject loader, const char* cname) { return klass; } } - return NULL; + return nullptr; } static jmethodID find_method(jvmtiEnv *jvmti, JNIEnv *jni, jclass klass, const char* mname) { - jmethodID *methods = NULL; - jmethodID method = NULL; + jmethodID *methods = nullptr; + jmethodID method = nullptr; jint count = 0; jvmtiError err; @@ -362,11 +362,11 @@ find_method(jvmtiEnv *jvmti, JNIEnv *jni, jclass klass, const char* mname) { // Find the jmethodID of the specified method while (--count >= 0) { - char* name = NULL; + char* name = nullptr; jmethodID meth = methods[count]; - err = jvmti->GetMethodName(meth, &name, NULL, NULL); + err = jvmti->GetMethodName(meth, &name, nullptr, nullptr); check_jvmti_status(jni, err, "find_method: error in JVMTI GetMethodName call"); bool found = (strcmp(name, mname) == 0); @@ -387,7 +387,7 @@ print_current_stack_trace(jvmtiEnv *jvmti, JNIEnv* jni) { jvmtiFrameInfo frames[MAX_FRAME_COUNT_PRINT_STACK_TRACE]; jint count = 0; - jvmtiError err = jvmti->GetStackTrace(NULL, 0, MAX_FRAME_COUNT_PRINT_STACK_TRACE, frames, &count); + jvmtiError err = jvmti->GetStackTrace(nullptr, 0, MAX_FRAME_COUNT_PRINT_STACK_TRACE, frames, &count); check_jvmti_status(jni, err, "print_stack_trace: error in JVMTI GetStackTrace"); LOG("JVMTI Stack Trace for current thread: frame count: %d\n", count); @@ -759,19 +759,19 @@ isThreadExpected(jvmtiEnv *jvmti, jthread thread) { } jthread find_thread_by_name(jvmtiEnv* jvmti, JNIEnv* jni, const char name[]) { - jthread* threads = NULL; + jthread* threads = nullptr; jint count = 0; - jthread found_thread = NULL; + jthread found_thread = nullptr; - if (name == NULL) { - return NULL; + if (name == nullptr) { + return nullptr; } check_jvmti_status(jni, jvmti->GetAllThreads(&count, &threads), ""); for (int i = 0; i < count; i++) { jvmtiThreadInfo info = get_thread_info(jvmti, jni, threads[i]); - if (info.name != NULL && strcmp(name, info.name) == 0) { + if (info.name != nullptr && strcmp(name, info.name) == 0) { found_thread = threads[i]; break; } @@ -793,22 +793,22 @@ static const jvmtiEvent static jvmtiExtensionFunction find_ext_function(jvmtiEnv* jvmti, JNIEnv* jni, const char* fname) { jint extCount = 0; - jvmtiExtensionFunctionInfo* extList = NULL; + jvmtiExtensionFunctionInfo* extList = nullptr; jvmtiError err = jvmti->GetExtensionFunctions(&extCount, &extList); check_jvmti_status(jni, err, "jvmti_common find_ext_function: Error in JVMTI GetExtensionFunctions"); for (int i = 0; i < extCount; i++) { - if (strstr(extList[i].id, (char*)fname) != NULL) { + if (strstr(extList[i].id, (char*)fname) != nullptr) { return extList[i].func; } } - return NULL; + return nullptr; } static jvmtiError GetVirtualThread(jvmtiEnv* jvmti, JNIEnv* jni, jthread cthread, jthread* vthread_ptr) { - if (GetVirtualThread_func == NULL) { // lazily initialize function pointer + if (GetVirtualThread_func == nullptr) { // lazily initialize function pointer GetVirtualThread_func = find_ext_function(jvmti, jni, "GetVirtualThread"); } jvmtiError err = (*GetVirtualThread_func)(jvmti, cthread, vthread_ptr); @@ -818,7 +818,7 @@ GetVirtualThread(jvmtiEnv* jvmti, JNIEnv* jni, jthread cthread, jthread* vthread static jvmtiError GetCarrierThread(jvmtiEnv* jvmti, JNIEnv* jni, jthread vthread, jthread* cthread_ptr) { - if (GetCarrierThread_func == NULL) { // lazily initialize function pointer + if (GetCarrierThread_func == nullptr) { // lazily initialize function pointer GetCarrierThread_func = find_ext_function(jvmti, jni, "GetCarrierThread"); } jvmtiError err = (*GetCarrierThread_func)(jvmti, vthread, cthread_ptr); @@ -828,7 +828,7 @@ GetCarrierThread(jvmtiEnv* jvmti, JNIEnv* jni, jthread vthread, jthread* cthread static jthread get_virtual_thread(jvmtiEnv* jvmti, JNIEnv* jni, jthread cthread) { - jthread vthread = NULL; + jthread vthread = nullptr; jvmtiError err = GetVirtualThread(jvmti, jni, cthread, &vthread); check_jvmti_status(jni, err, "jvmti_common get_virtual_thread: Error in JVMTI extension GetVirtualThread"); return vthread; @@ -836,7 +836,7 @@ get_virtual_thread(jvmtiEnv* jvmti, JNIEnv* jni, jthread cthread) { static jthread get_carrier_thread(jvmtiEnv* jvmti, JNIEnv* jni, jthread vthread) { - jthread cthread = NULL; + jthread cthread = nullptr; jvmtiError err = GetCarrierThread(jvmti, jni, vthread, &cthread); check_jvmti_status(jni, err, "jvmti_common get_carrier_thread: Error in JVMTI extension GetCarrierThread"); @@ -846,26 +846,26 @@ get_carrier_thread(jvmtiEnv* jvmti, JNIEnv* jni, jthread vthread) { static jvmtiExtensionEventInfo* find_ext_event(jvmtiEnv* jvmti, const char* ename) { jint extCount = 0; - jvmtiExtensionEventInfo* extList = NULL; + jvmtiExtensionEventInfo* extList = nullptr; jvmtiError err = jvmti->GetExtensionEvents(&extCount, &extList); if (err != JVMTI_ERROR_NONE) { LOG("jvmti_common find_ext_event: Error in JVMTI GetExtensionFunctions: %s(%d)\n",TranslateError(err), err); - return NULL; + return nullptr; } for (int i = 0; i < extCount; i++) { - if (strstr(extList[i].id, (char*)ename) != NULL) { + if (strstr(extList[i].id, (char*)ename) != nullptr) { return &extList[i]; } } - return NULL; + return nullptr; } static jvmtiError set_ext_event_callback(jvmtiEnv* jvmti, const char* ename, jvmtiExtensionEvent callback) { jvmtiExtensionEventInfo* info = find_ext_event(jvmti, ename); - if (info == NULL) { + if (info == nullptr) { LOG("jvmti_common set_ext_event_callback: Extension event was not found: %s\n", ename); return JVMTI_ERROR_NOT_AVAILABLE; } diff --git a/test/lib/jdk/test/lib/jvmti/jvmti_thread.h b/test/lib/jdk/test/lib/jvmti/jvmti_thread.hpp similarity index 90% rename from test/lib/jdk/test/lib/jvmti/jvmti_thread.h rename to test/lib/jdk/test/lib/jvmti/jvmti_thread.hpp index ed27eb521d45..9d1c612bed41 100644 --- a/test/lib/jdk/test/lib/jvmti/jvmti_thread.h +++ b/test/lib/jdk/test/lib/jvmti/jvmti_thread.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,8 +21,8 @@ * questions. */ -#ifndef JVMTI_THREAD_H -#define JVMTI_THREAD_H +#ifndef JVMTI_THREAD_HPP +#define JVMTI_THREAD_HPP #include #include @@ -55,14 +55,14 @@ extern "C" { #define STATUS_PASSED 0 #define STATUS_FAILED 2 -static jvmtiEnv* agent_jvmti_env = NULL; -static JNIEnv* agent_jni_env = NULL; +static jvmtiEnv* agent_jvmti_env = nullptr; +static JNIEnv* agent_jni_env = nullptr; static volatile int current_agent_status = STATUS_PASSED; -static jthread jvmti_agent_thread = NULL; -static jvmtiStartFunction agent_thread_proc = NULL; -static void* agent_thread_arg = NULL; +static jthread jvmti_agent_thread = nullptr; +static jvmtiStartFunction agent_thread_proc = nullptr; +static void* agent_thread_arg = nullptr; void set_agent_fail_status() { current_agent_status = STATUS_FAILED; @@ -185,7 +185,7 @@ static void JNICALL agent_thread_wrapper(jvmtiEnv* jvmti_env, JNIEnv* agentJNI, { /* gelete global ref for agent thread */ agentJNI->DeleteGlobalRef(jvmti_agent_thread); - jvmti_agent_thread = NULL; + jvmti_agent_thread = nullptr; } } @@ -198,37 +198,37 @@ static jthread start_agent_thread_wrapper(JNIEnv *jni_env, jvmtiEnv* jvmti_env) const char* THREAD_CTOR_NAME = ""; const char* THREAD_CTOR_SIGNATURE = "(Ljava/lang/String;)V"; - jobject threadName = NULL; - jclass threadClass = NULL; - jmethodID threadCtor = NULL; - jobject threadObject = NULL; - jobject threadGlobalRef = NULL; + jobject threadName = nullptr; + jclass threadClass = nullptr; + jmethodID threadCtor = nullptr; + jobject threadObject = nullptr; + jobject threadGlobalRef = nullptr; jvmtiError err; threadClass = jni_env->FindClass(THREAD_CLASS_NAME); - if (threadClass == NULL) { - return NULL; + if (threadClass == nullptr) { + return nullptr; } threadCtor = jni_env->GetMethodID(threadClass, THREAD_CTOR_NAME, THREAD_CTOR_SIGNATURE); - if (threadCtor == NULL) { - return NULL; + if (threadCtor == nullptr) { + return nullptr; } threadName = jni_env->NewStringUTF(THREAD_NAME); - if (threadName == NULL) { - return NULL; + if (threadName == nullptr) { + return nullptr; } threadObject = jni_env->NewObject(threadClass, threadCtor, threadName); - if (threadObject == NULL) { - return NULL; + if (threadObject == nullptr) { + return nullptr; } threadGlobalRef = jni_env->NewGlobalRef(threadObject); - if (threadGlobalRef == NULL) { + if (threadGlobalRef == nullptr) { jni_env->DeleteLocalRef(threadObject); - return NULL; + return nullptr; } jvmti_agent_thread = (jthread)threadGlobalRef; @@ -236,7 +236,7 @@ static jthread start_agent_thread_wrapper(JNIEnv *jni_env, jvmtiEnv* jvmti_env) if (err != JVMTI_ERROR_NONE) { jni_env->DeleteGlobalRef(threadGlobalRef); jni_env->DeleteLocalRef(threadObject); - return NULL; + return nullptr; } return jvmti_agent_thread; } @@ -245,9 +245,9 @@ static jthread start_agent_thread_wrapper(JNIEnv *jni_env, jvmtiEnv* jvmti_env) static jthread run_agent_thread(JNIEnv *jni_env, jvmtiEnv* jvmti_env) { /* start agent thread wrapper */ jthread thread = start_agent_thread_wrapper(jni_env, jvmti_env); - if (thread == NULL) { + if (thread == nullptr) { set_agent_fail_status(); - return NULL; + return nullptr; } return thread; @@ -265,7 +265,7 @@ static jint sync_debuggee_status(JNIEnv* jni_env, jvmtiEnv* jvmti_env, jint debu /* we don't enter if-stmt in second call */ if (agent_data.thread_state == NEW) { - if (run_agent_thread(jni_env, jvmti_env) == NULL) { + if (run_agent_thread(jni_env, jvmti_env) == nullptr) { return result; } diff --git a/test/lib/jdk/test/lib/process/OutputAnalyzer.java b/test/lib/jdk/test/lib/process/OutputAnalyzer.java index 743345f1faba..4b4e97274770 100644 --- a/test/lib/jdk/test/lib/process/OutputAnalyzer.java +++ b/test/lib/jdk/test/lib/process/OutputAnalyzer.java @@ -217,6 +217,13 @@ public OutputAnalyzer stderrShouldNotBeEmpty() { return this; } + /** + * Returns true if stdout contains the given string + */ + public boolean stdoutContains(String expectedString) { + return getStdout().contains(expectedString); + } + /** * Verify that the stdout and stderr contents of output buffer contains the string * diff --git a/test/jdk/java/security/testlibrary/CertificateBuilder.java b/test/lib/jdk/test/lib/security/CertificateBuilder.java similarity index 98% rename from test/jdk/java/security/testlibrary/CertificateBuilder.java rename to test/lib/jdk/test/lib/security/CertificateBuilder.java index 1e26d471c979..57de86d600f5 100644 --- a/test/jdk/java/security/testlibrary/CertificateBuilder.java +++ b/test/lib/jdk/test/lib/security/CertificateBuilder.java @@ -1,12 +1,10 @@ /* - * Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, 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. + * 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 @@ -23,7 +21,7 @@ * questions. */ -package sun.security.testlibrary; +package jdk.test.lib.security; import java.io.*; import java.util.*; diff --git a/test/jdk/java/security/testlibrary/HumanInputStream.java b/test/lib/jdk/test/lib/security/HumanInputStream.java similarity index 98% rename from test/jdk/java/security/testlibrary/HumanInputStream.java rename to test/lib/jdk/test/lib/security/HumanInputStream.java index 50e5dd0bcc8c..c68f515881e0 100644 --- a/test/jdk/java/security/testlibrary/HumanInputStream.java +++ b/test/lib/jdk/test/lib/security/HumanInputStream.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2024, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,6 +21,7 @@ * questions. */ +package jdk.test.lib.security; import java.io.BufferedReader; import java.io.IOException; @@ -82,6 +83,7 @@ public HumanInputStream(String input) { } return re; } + @Override public int read(byte[] buffer, int offset, int len) { inLine = true; try { @@ -92,6 +94,7 @@ public HumanInputStream(String input) { inLine = false; } } + @Override public int available() { if (pos < length) return 1; return 0; diff --git a/test/lib/jdk/test/lib/security/OpensslArtifactFetcher.java b/test/lib/jdk/test/lib/security/OpensslArtifactFetcher.java index 55ff8c9ef98b..5035fae1bc4c 100644 --- a/test/lib/jdk/test/lib/security/OpensslArtifactFetcher.java +++ b/test/lib/jdk/test/lib/security/OpensslArtifactFetcher.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2021, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -25,6 +25,7 @@ import java.io.File; +import java.nio.file.Path; import jdk.test.lib.Platform; import jdk.test.lib.process.ProcessTools; import jdk.test.lib.artifacts.Artifact; @@ -33,43 +34,49 @@ public class OpensslArtifactFetcher { + private static final String OPENSSL_BUNDLE_VERSION = "3.0.14"; + private static final String OPENSSL_ORG = "jpg.tests.jdk.openssl"; + /** - * Gets the openssl binary path of version 1.1.* + * Gets the openssl binary path of OPENSSL_BUNDLE_VERSION * * Openssl selection flow: 1. Check whether property test.openssl.path is set and it's the - preferred version(1.1.*) of openssl, then return that path. - 2. Else look for already installed openssl (version 1.1.*) in system + current version of openssl, then return that path. + 2. Else look for already installed openssl in system path /usr/bin/openssl or /usr/local/bin/openssl, then return that path. - 3. Else try to download openssl (version 1.1.*) from the artifactory + 3. Else try to download the current version of openssl from the artifactory and return that path, if download fails then return null. * - * @return openssl binary path of version 1.1.* + * @return openssl binary path of the current version */ - public static String getOpenssl1dot1dotStar() { - String version = "1.1."; - String path = getOpensslFromSystemProp(version); + public static String getOpensslPath() { + String path = getOpensslFromSystemProp(OPENSSL_BUNDLE_VERSION); if (path != null) { return path; - } else { - path = getDefaultSystemOpensslPath(version); - if (path != null) { - return path; - } else if (Platform.is64bit()) { - if (Platform.isLinux()) { - path = fetchOpenssl(LINUX_X64.class); - } else if (Platform.isOSX()) { - path = fetchOpenssl(MACOSX_X64.class); - } else if (Platform.isWindows()) { - path = fetchOpenssl(WINDOWS_X64.class); - } - if (verifyOpensslVersion(path, version)) { - return path; - } + } + path = getDefaultSystemOpensslPath(OPENSSL_BUNDLE_VERSION); + if (path != null) { + return path; + } + if (Platform.isX64()) { + if (Platform.isLinux()) { + path = fetchOpenssl(LINUX_X64.class); + } else if (Platform.isOSX()) { + path = fetchOpenssl(MACOSX_X64.class); + } else if (Platform.isWindows()) { + path = fetchOpenssl(WINDOWS_X64.class); + } + } else if (Platform.isAArch64()) { + if (Platform.isLinux()) { + path = fetchOpenssl(LINUX_AARCH64.class); + } + if (Platform.isOSX()) { + path = fetchOpenssl(MACOSX_AARCH64.class); } } - return null; + return verifyOpensslVersion(path, OPENSSL_BUNDLE_VERSION) ? path : null; } private static String getOpensslFromSystemProp(String version) { @@ -124,24 +131,52 @@ private static String fetchOpenssl(Class clazz) { return path; } + // retrieve the provider directory path from /bin/openssl + public static Path getProviderPath(String opensslPath) { + Path openSslRootPath = Path.of(opensslPath).getParent().getParent(); + String libDir = "lib"; + if (Platform.isX64() && (Platform.isLinux() || Platform.isWindows())) { + libDir = "lib64"; + } + return openSslRootPath.resolve(libDir).resolve("ossl-modules"); + } + + public static String getTestOpensslBundleVersion() { + return OPENSSL_BUNDLE_VERSION; + } + @Artifact( - organization = "jpg.tests.jdk.openssl", + organization = OPENSSL_ORG, name = "openssl-linux_x64", - revision = "1.1.1g", + revision = OPENSSL_BUNDLE_VERSION, extension = "zip") private static class LINUX_X64 { } @Artifact( - organization = "jpg.tests.jdk.openssl", + organization = OPENSSL_ORG, + name = "openssl-linux_aarch64", + revision = OPENSSL_BUNDLE_VERSION, + extension = "zip") + private static class LINUX_AARCH64{ } + + @Artifact( + organization = OPENSSL_ORG, name = "openssl-macosx_x64", - revision = "1.1.1g", + revision = OPENSSL_BUNDLE_VERSION, extension = "zip") private static class MACOSX_X64 { } @Artifact( - organization = "jpg.tests.jdk.openssl", + organization = OPENSSL_ORG, + name = "openssl-macosx_aarch64", + revision = OPENSSL_BUNDLE_VERSION, + extension = "zip") + private static class MACOSX_AARCH64 { } + + @Artifact( + organization = OPENSSL_ORG, name = "openssl-windows_x64", - revision = "1.1.1g", + revision = OPENSSL_BUNDLE_VERSION, extension = "zip") private static class WINDOWS_X64 { } } diff --git a/test/jdk/java/security/testlibrary/Providers.java b/test/lib/jdk/test/lib/security/Providers.java similarity index 92% rename from test/jdk/java/security/testlibrary/Providers.java rename to test/lib/jdk/test/lib/security/Providers.java index b3e9f3e96b64..42dd69840364 100644 --- a/test/jdk/java/security/testlibrary/Providers.java +++ b/test/lib/jdk/test/lib/security/Providers.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,6 +21,8 @@ * questions. */ +package jdk.test.lib.security; + import java.security.Provider; import java.security.Security; diff --git a/test/jdk/java/security/testlibrary/ProvidersSnapshot.java b/test/lib/jdk/test/lib/security/ProvidersSnapshot.java similarity index 93% rename from test/jdk/java/security/testlibrary/ProvidersSnapshot.java rename to test/lib/jdk/test/lib/security/ProvidersSnapshot.java index 33c45329e3f4..cef02f814bef 100644 --- a/test/jdk/java/security/testlibrary/ProvidersSnapshot.java +++ b/test/lib/jdk/test/lib/security/ProvidersSnapshot.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2011, 2025, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,6 +21,8 @@ * questions. */ +package jdk.test.lib.security; + import java.security.Provider; import java.security.Security; diff --git a/test/jdk/java/security/testlibrary/SimpleOCSPServer.java b/test/lib/jdk/test/lib/security/SimpleOCSPServer.java similarity index 99% rename from test/jdk/java/security/testlibrary/SimpleOCSPServer.java rename to test/lib/jdk/test/lib/security/SimpleOCSPServer.java index 405ed7212671..e8ce021b1387 100644 --- a/test/jdk/java/security/testlibrary/SimpleOCSPServer.java +++ b/test/lib/jdk/test/lib/security/SimpleOCSPServer.java @@ -1,12 +1,10 @@ /* - * Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2025, 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. + * 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 @@ -23,7 +21,7 @@ * questions. */ -package sun.security.testlibrary; +package jdk.test.lib.security; import java.io.*; import java.net.*; diff --git a/test/lib/jdk/test/lib/security/timestamp/TsaServer.java b/test/lib/jdk/test/lib/security/timestamp/TsaServer.java index 9bffa1a240ff..e103821c9b81 100644 --- a/test/lib/jdk/test/lib/security/timestamp/TsaServer.java +++ b/test/lib/jdk/test/lib/security/timestamp/TsaServer.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2020, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2020, 2025, 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 @@ -87,7 +87,7 @@ public TsaServer(int port, KeyStore keyStore, String passphrase) * * @param handler a {@link TsaHandler} */ - public void setHandler(TsaHandler handler) { + public final void setHandler(TsaHandler handler) { server.createContext("/", handler); } @@ -113,7 +113,7 @@ public int getPort() { } @Override - public void close() throws Exception { + public void close() { stop(); } } diff --git a/test/lib/native/testlib_threads.h b/test/lib/native/testlib_threads.hpp similarity index 88% rename from test/lib/native/testlib_threads.h rename to test/lib/native/testlib_threads.hpp index 575a5a3c15fc..3a7b18eccf6e 100644 --- a/test/lib/native/testlib_threads.h +++ b/test/lib/native/testlib_threads.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2022, 2024, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -21,8 +21,8 @@ * questions. */ -#ifndef TEST_LIB_NATIVE_THREAD_H -#define TEST_LIB_NATIVE_THREAD_H +#ifndef TEST_LIB_NATIVE_THREAD_HPP +#define TEST_LIB_NATIVE_THREAD_HPP // Header only library for using threads in tests @@ -70,8 +70,8 @@ void run_in_new_thread_and_join(PROCEDURE proc, void* context) { helper.proc = proc; helper.context = context; #ifdef _WIN32 - HANDLE thread = CreateThread(NULL, 0, procedure, &helper, 0, NULL); - if (thread == NULL) { + HANDLE thread = CreateThread(nullptr, 0, procedure, &helper, 0, nullptr); + if (thread == nullptr) { fatal("failed to create thread", GetLastError()); } if (WaitForSingleObject(thread, INFINITE) != WAIT_OBJECT_0) { @@ -90,7 +90,7 @@ void run_in_new_thread_and_join(PROCEDURE proc, void* context) { fatal("failed to create thread", result); } pthread_attr_destroy(&attr); - result = pthread_join(thread, NULL); + result = pthread_join(thread, nullptr); if (result != 0) { fatal("failed to join thread", result); } @@ -99,4 +99,4 @@ void run_in_new_thread_and_join(PROCEDURE proc, void* context) { } -#endif // TEST_LIB_NATIVE_THREAD_H +#endif // TEST_LIB_NATIVE_THREAD_HPP diff --git a/test/make/TestCompileCommands.gmk b/test/make/TestCompileCommands.gmk index d79805c4b0ef..26a3913138d3 100644 --- a/test/make/TestCompileCommands.gmk +++ b/test/make/TestCompileCommands.gmk @@ -4,9 +4,7 @@ # # 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. +# 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 diff --git a/test/make/TestCopyFiles.gmk b/test/make/TestCopyFiles.gmk index 40853693b45e..cbfa1cc003c9 100644 --- a/test/make/TestCopyFiles.gmk +++ b/test/make/TestCopyFiles.gmk @@ -4,9 +4,7 @@ # # 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. +# 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 diff --git a/test/make/TestFixDepsFile.gmk b/test/make/TestFixDepsFile.gmk index 22308260d617..26145d604f2d 100644 --- a/test/make/TestFixDepsFile.gmk +++ b/test/make/TestFixDepsFile.gmk @@ -4,9 +4,7 @@ # # 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. +# 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 diff --git a/test/make/TestIdea.gmk b/test/make/TestIdea.gmk index 96ca96b8527c..fce8769b239c 100644 --- a/test/make/TestIdea.gmk +++ b/test/make/TestIdea.gmk @@ -4,9 +4,7 @@ # # 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. +# 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 diff --git a/test/make/TestJavaCompilation.gmk b/test/make/TestJavaCompilation.gmk index 4c951e68dc42..039830241a98 100644 --- a/test/make/TestJavaCompilation.gmk +++ b/test/make/TestJavaCompilation.gmk @@ -4,9 +4,7 @@ # # 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. +# 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 diff --git a/test/make/TestMake.gmk b/test/make/TestMake.gmk index de715933b3b8..3ff8a255e8e8 100644 --- a/test/make/TestMake.gmk +++ b/test/make/TestMake.gmk @@ -4,9 +4,7 @@ # # 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. +# 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 diff --git a/test/make/TestMakeBase.gmk b/test/make/TestMakeBase.gmk index c0662d396f94..78f2c1884c90 100644 --- a/test/make/TestMakeBase.gmk +++ b/test/make/TestMakeBase.gmk @@ -4,9 +4,7 @@ # # 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. +# 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 diff --git a/test/make/UtilsForTests.gmk b/test/make/UtilsForTests.gmk index d55e83265805..25c1aab2af31 100644 --- a/test/make/UtilsForTests.gmk +++ b/test/make/UtilsForTests.gmk @@ -4,9 +4,7 @@ # # 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. +# 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 diff --git a/test/make/autoconf/test.m4 b/test/make/autoconf/test.m4 index 3c40eda1fd2c..07fb91f6ff7c 100644 --- a/test/make/autoconf/test.m4 +++ b/test/make/autoconf/test.m4 @@ -4,9 +4,7 @@ # # 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. +# 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 diff --git a/test/micro/org/openjdk/bench/java/lang/Characters.java b/test/micro/org/openjdk/bench/java/lang/Characters.java index 317d2121501b..246b4f5ccc88 100644 --- a/test/micro/org/openjdk/bench/java/lang/Characters.java +++ b/test/micro/org/openjdk/bench/java/lang/Characters.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/micro/org/openjdk/bench/java/lang/ObjectHashCode.java b/test/micro/org/openjdk/bench/java/lang/ObjectHashCode.java index 9b89f6d1b5a4..3cc836cd59e2 100644 --- a/test/micro/org/openjdk/bench/java/lang/ObjectHashCode.java +++ b/test/micro/org/openjdk/bench/java/lang/ObjectHashCode.java @@ -50,37 +50,37 @@ public int mode_default() { // Experimental hashCode generation schemes. See synchronizer.cpp get_next_hash /* @Benchmark - @Fork(jvmArgsPrepend = {"-XX:+UnlockExperimentalVMOptions", "-XX:hashCode=0"}) + @Fork(jvmArgs = {"-XX:+UnlockExperimentalVMOptions", "-XX:hashCode=0"}) public int mode_0() { return System.identityHashCode(new Object()); } @Benchmark - @Fork(jvmArgsPrepend = {"-XX:+UnlockExperimentalVMOptions", "-XX:hashCode=1"}) + @Fork(jvmArgs = {"-XX:+UnlockExperimentalVMOptions", "-XX:hashCode=1"}) public int mode_1() { return System.identityHashCode(new Object()); } @Benchmark - @Fork(jvmArgsPrepend = {"-XX:+UnlockExperimentalVMOptions", "-XX:hashCode=2"}) + @Fork(jvmArgs = {"-XX:+UnlockExperimentalVMOptions", "-XX:hashCode=2"}) public int mode_2() { return System.identityHashCode(new Object()); } @Benchmark - @Fork(jvmArgsPrepend = {"-XX:+UnlockExperimentalVMOptions", "-XX:hashCode=3"}) + @Fork(jvmArgs = {"-XX:+UnlockExperimentalVMOptions", "-XX:hashCode=3"}) public int mode_3() { return System.identityHashCode(new Object()); } @Benchmark - @Fork(jvmArgsPrepend = {"-XX:+UnlockExperimentalVMOptions", "-XX:hashCode=4"}) + @Fork(jvmArgs = {"-XX:+UnlockExperimentalVMOptions", "-XX:hashCode=4"}) public int mode_4() { return System.identityHashCode(new Object()); } @Benchmark - @Fork(jvmArgsPrepend = {"-XX:+UnlockExperimentalVMOptions", "-XX:hashCode=5"}) + @Fork(jvmArgs = {"-XX:+UnlockExperimentalVMOptions", "-XX:hashCode=5"}) public int mode_5() { return System.identityHashCode(new Object()); } diff --git a/test/micro/org/openjdk/bench/java/lang/ScopedValues.java b/test/micro/org/openjdk/bench/java/lang/ScopedValues.java index 69ce3d63fe46..020b3b3eb89a 100644 --- a/test/micro/org/openjdk/bench/java/lang/ScopedValues.java +++ b/test/micro/org/openjdk/bench/java/lang/ScopedValues.java @@ -41,7 +41,7 @@ @Measurement(iterations=10, time=1) @Threads(1) @Fork(value = 1, - jvmArgsPrepend = {"-Djmh.executor.class=org.openjdk.bench.java.lang.ScopedValuesExecutorService", + jvmArgs = {"-Djmh.executor.class=org.openjdk.bench.java.lang.ScopedValuesExecutorService", "-Djmh.executor=CUSTOM", "-Djmh.blackhole.mode=COMPILER", "--enable-preview"}) diff --git a/test/micro/org/openjdk/bench/java/lang/StringHashCode.java b/test/micro/org/openjdk/bench/java/lang/StringHashCode.java index 20735a3bf766..5578712f0f98 100644 --- a/test/micro/org/openjdk/bench/java/lang/StringHashCode.java +++ b/test/micro/org/openjdk/bench/java/lang/StringHashCode.java @@ -96,7 +96,7 @@ public int empty() { @State(Scope.Thread) @Warmup(iterations = 5, time = 1) @Measurement(iterations = 5, time = 1) - @Fork(value = 3, jvmArgsAppend = {"--add-exports", "java.base/java.lang=ALL-UNNAMED", "--add-opens", "java.base/java.lang=ALL-UNNAMED"}) + @Fork(value = 3, jvmArgs = {"--add-exports", "java.base/java.lang=ALL-UNNAMED", "--add-opens", "java.base/java.lang=ALL-UNNAMED"}) public static class Algorithm { private final static String alphabet = "abcdefghijklmnopqrstuvwxyz"; diff --git a/test/micro/org/openjdk/bench/java/lang/StringTemplateFMT.java b/test/micro/org/openjdk/bench/java/lang/StringTemplateFMT.java index bd730f9ef873..5070d4dc8bce 100644 --- a/test/micro/org/openjdk/bench/java/lang/StringTemplateFMT.java +++ b/test/micro/org/openjdk/bench/java/lang/StringTemplateFMT.java @@ -45,7 +45,7 @@ @State(Scope.Benchmark) @Warmup(iterations = 5, time = 1) @Measurement(iterations = 5, time = 1) -@Fork(value = 3, jvmArgsAppend = "--enable-preview") +@Fork(value = 3, jvmArgs = "--enable-preview") public class StringTemplateFMT { public String s = "str"; diff --git a/test/micro/org/openjdk/bench/java/lang/foreign/BulkOps.java b/test/micro/org/openjdk/bench/java/lang/foreign/BulkOps.java index a521192e9247..9f67332c2cc8 100644 --- a/test/micro/org/openjdk/bench/java/lang/foreign/BulkOps.java +++ b/test/micro/org/openjdk/bench/java/lang/foreign/BulkOps.java @@ -51,7 +51,7 @@ @Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS) @State(org.openjdk.jmh.annotations.Scope.Thread) @OutputTimeUnit(TimeUnit.MILLISECONDS) -@Fork(value = 3, jvmArgsAppend = "--enable-preview") +@Fork(value = 3, jvmArgs = "--enable-preview") public class BulkOps { static final Unsafe unsafe = Utils.unsafe; diff --git a/test/micro/org/openjdk/bench/java/lang/foreign/CallOverheadConstant.java b/test/micro/org/openjdk/bench/java/lang/foreign/CallOverheadConstant.java index 3e1614f32dcc..a1b9ae09c8d3 100644 --- a/test/micro/org/openjdk/bench/java/lang/foreign/CallOverheadConstant.java +++ b/test/micro/org/openjdk/bench/java/lang/foreign/CallOverheadConstant.java @@ -41,7 +41,7 @@ @Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS) @State(org.openjdk.jmh.annotations.Scope.Thread) @OutputTimeUnit(TimeUnit.NANOSECONDS) -@Fork(value = 3, jvmArgsAppend = { "--enable-native-access=ALL-UNNAMED", "--enable-preview" }) +@Fork(value = 3, jvmArgs = { "--enable-native-access=ALL-UNNAMED", "--enable-preview" }) public class CallOverheadConstant { @Benchmark diff --git a/test/micro/org/openjdk/bench/java/lang/foreign/CallOverheadVirtual.java b/test/micro/org/openjdk/bench/java/lang/foreign/CallOverheadVirtual.java index 6797eda9924f..7e0badcae866 100644 --- a/test/micro/org/openjdk/bench/java/lang/foreign/CallOverheadVirtual.java +++ b/test/micro/org/openjdk/bench/java/lang/foreign/CallOverheadVirtual.java @@ -41,7 +41,7 @@ @Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS) @State(org.openjdk.jmh.annotations.Scope.Thread) @OutputTimeUnit(TimeUnit.NANOSECONDS) -@Fork(value = 3, jvmArgsAppend = { "--enable-native-access=ALL-UNNAMED", "--enable-preview" }) +@Fork(value = 3, jvmArgs = { "--enable-native-access=ALL-UNNAMED", "--enable-preview" }) public class CallOverheadVirtual { @Benchmark diff --git a/test/micro/org/openjdk/bench/java/lang/foreign/LinkUpcall.java b/test/micro/org/openjdk/bench/java/lang/foreign/LinkUpcall.java index 0adbc72e5b4d..2e4b989d63a8 100644 --- a/test/micro/org/openjdk/bench/java/lang/foreign/LinkUpcall.java +++ b/test/micro/org/openjdk/bench/java/lang/foreign/LinkUpcall.java @@ -47,7 +47,7 @@ @Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS) @State(Scope.Benchmark) @OutputTimeUnit(TimeUnit.MICROSECONDS) -@Fork(value = 3, jvmArgsAppend = { "--enable-native-access=ALL-UNNAMED", "--enable-preview" }) +@Fork(value = 3, jvmArgs = { "--enable-native-access=ALL-UNNAMED", "--enable-preview" }) public class LinkUpcall extends CLayouts { static final Linker LINKER = Linker.nativeLinker(); diff --git a/test/micro/org/openjdk/bench/java/lang/foreign/LoopOverConstant.java b/test/micro/org/openjdk/bench/java/lang/foreign/LoopOverConstant.java index c592c8c95992..f41c10ec57c2 100644 --- a/test/micro/org/openjdk/bench/java/lang/foreign/LoopOverConstant.java +++ b/test/micro/org/openjdk/bench/java/lang/foreign/LoopOverConstant.java @@ -48,7 +48,7 @@ @Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS) @State(org.openjdk.jmh.annotations.Scope.Thread) @OutputTimeUnit(TimeUnit.MILLISECONDS) -@Fork(value = 3, jvmArgsAppend = "--enable-preview") +@Fork(value = 3, jvmArgs = "--enable-preview") public class LoopOverConstant extends JavaLayouts { static final Unsafe unsafe = Utils.unsafe; diff --git a/test/micro/org/openjdk/bench/java/lang/foreign/LoopOverNew.java b/test/micro/org/openjdk/bench/java/lang/foreign/LoopOverNew.java index 73a7f803164f..dbe8d8d1c7d9 100644 --- a/test/micro/org/openjdk/bench/java/lang/foreign/LoopOverNew.java +++ b/test/micro/org/openjdk/bench/java/lang/foreign/LoopOverNew.java @@ -47,7 +47,7 @@ @Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS) @State(org.openjdk.jmh.annotations.Scope.Thread) @OutputTimeUnit(TimeUnit.MILLISECONDS) -@Fork(value = 3, jvmArgsAppend = "--enable-preview") +@Fork(value = 3, jvmArgs = "--enable-preview") public class LoopOverNew extends JavaLayouts { static final Unsafe unsafe = Utils.unsafe; diff --git a/test/micro/org/openjdk/bench/java/lang/foreign/LoopOverNewHeap.java b/test/micro/org/openjdk/bench/java/lang/foreign/LoopOverNewHeap.java index 2fd596d8a369..46e697c9d93a 100644 --- a/test/micro/org/openjdk/bench/java/lang/foreign/LoopOverNewHeap.java +++ b/test/micro/org/openjdk/bench/java/lang/foreign/LoopOverNewHeap.java @@ -47,7 +47,7 @@ @Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS) @State(org.openjdk.jmh.annotations.Scope.Thread) @OutputTimeUnit(TimeUnit.MILLISECONDS) -@Fork(value = 3, jvmArgsAppend = "--enable-preview") +@Fork(value = 3, jvmArgs = "--enable-preview") public class LoopOverNewHeap extends JavaLayouts { static final Unsafe unsafe = Utils.unsafe; diff --git a/test/micro/org/openjdk/bench/java/lang/foreign/LoopOverNonConstant.java b/test/micro/org/openjdk/bench/java/lang/foreign/LoopOverNonConstant.java index 46c4091a8bf4..18538865c573 100644 --- a/test/micro/org/openjdk/bench/java/lang/foreign/LoopOverNonConstant.java +++ b/test/micro/org/openjdk/bench/java/lang/foreign/LoopOverNonConstant.java @@ -48,7 +48,7 @@ @Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS) @State(org.openjdk.jmh.annotations.Scope.Thread) @OutputTimeUnit(TimeUnit.MILLISECONDS) -@Fork(value = 3, jvmArgsAppend = { "--enable-preview", "--enable-native-access=ALL-UNNAMED" }) +@Fork(value = 3, jvmArgs = { "--enable-preview", "--enable-native-access=ALL-UNNAMED" }) public class LoopOverNonConstant extends JavaLayouts { static final Unsafe unsafe = Utils.unsafe; diff --git a/test/micro/org/openjdk/bench/java/lang/foreign/LoopOverNonConstantFP.java b/test/micro/org/openjdk/bench/java/lang/foreign/LoopOverNonConstantFP.java index 2bfb3ef2a037..ad3e32cd3c97 100644 --- a/test/micro/org/openjdk/bench/java/lang/foreign/LoopOverNonConstantFP.java +++ b/test/micro/org/openjdk/bench/java/lang/foreign/LoopOverNonConstantFP.java @@ -48,7 +48,7 @@ @Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS) @State(org.openjdk.jmh.annotations.Scope.Thread) @OutputTimeUnit(TimeUnit.MILLISECONDS) -@Fork(value = 3, jvmArgsAppend = "--enable-preview") +@Fork(value = 3, jvmArgs = "--enable-preview") public class LoopOverNonConstantFP { static final Unsafe unsafe = Utils.unsafe; diff --git a/test/micro/org/openjdk/bench/java/lang/foreign/LoopOverNonConstantHeap.java b/test/micro/org/openjdk/bench/java/lang/foreign/LoopOverNonConstantHeap.java index 3b7b8052f5f2..876fa3aafb3f 100644 --- a/test/micro/org/openjdk/bench/java/lang/foreign/LoopOverNonConstantHeap.java +++ b/test/micro/org/openjdk/bench/java/lang/foreign/LoopOverNonConstantHeap.java @@ -49,7 +49,7 @@ @Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS) @State(org.openjdk.jmh.annotations.Scope.Thread) @OutputTimeUnit(TimeUnit.MILLISECONDS) -@Fork(value = 3, jvmArgsAppend = "--enable-preview") +@Fork(value = 3, jvmArgs = "--enable-preview") public class LoopOverNonConstantHeap extends JavaLayouts { static final Unsafe unsafe = Utils.unsafe; diff --git a/test/micro/org/openjdk/bench/java/lang/foreign/LoopOverNonConstantMapped.java b/test/micro/org/openjdk/bench/java/lang/foreign/LoopOverNonConstantMapped.java index 43ea54f67034..9bdcb3b63a66 100644 --- a/test/micro/org/openjdk/bench/java/lang/foreign/LoopOverNonConstantMapped.java +++ b/test/micro/org/openjdk/bench/java/lang/foreign/LoopOverNonConstantMapped.java @@ -55,7 +55,7 @@ @Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS) @State(org.openjdk.jmh.annotations.Scope.Thread) @OutputTimeUnit(TimeUnit.MILLISECONDS) -@Fork(value = 3, jvmArgsAppend = "--enable-preview") +@Fork(value = 3, jvmArgs = "--enable-preview") public class LoopOverNonConstantMapped extends JavaLayouts { static final Unsafe unsafe = Utils.unsafe; diff --git a/test/micro/org/openjdk/bench/java/lang/foreign/LoopOverNonConstantShared.java b/test/micro/org/openjdk/bench/java/lang/foreign/LoopOverNonConstantShared.java index f3c440e58792..f9e99c77e514 100644 --- a/test/micro/org/openjdk/bench/java/lang/foreign/LoopOverNonConstantShared.java +++ b/test/micro/org/openjdk/bench/java/lang/foreign/LoopOverNonConstantShared.java @@ -48,7 +48,7 @@ @Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS) @State(org.openjdk.jmh.annotations.Scope.Thread) @OutputTimeUnit(TimeUnit.MILLISECONDS) -@Fork(value = 3, jvmArgsAppend = "--enable-preview") +@Fork(value = 3, jvmArgs = "--enable-preview") public class LoopOverNonConstantShared extends JavaLayouts { static final Unsafe unsafe = Utils.unsafe; diff --git a/test/micro/org/openjdk/bench/java/lang/foreign/LoopOverOfAddress.java b/test/micro/org/openjdk/bench/java/lang/foreign/LoopOverOfAddress.java index fd6ba4415894..30a637bce99f 100644 --- a/test/micro/org/openjdk/bench/java/lang/foreign/LoopOverOfAddress.java +++ b/test/micro/org/openjdk/bench/java/lang/foreign/LoopOverOfAddress.java @@ -43,7 +43,7 @@ @Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS) @State(org.openjdk.jmh.annotations.Scope.Thread) @OutputTimeUnit(TimeUnit.MILLISECONDS) -@Fork(value = 3, jvmArgsAppend = "--enable-preview") +@Fork(value = 3, jvmArgs = "--enable-preview") public class LoopOverOfAddress extends JavaLayouts { static final int ITERATIONS = 1_000_000; diff --git a/test/micro/org/openjdk/bench/java/lang/foreign/LoopOverPollutedBuffer.java b/test/micro/org/openjdk/bench/java/lang/foreign/LoopOverPollutedBuffer.java index b0344a719623..d272dc3ce7c8 100644 --- a/test/micro/org/openjdk/bench/java/lang/foreign/LoopOverPollutedBuffer.java +++ b/test/micro/org/openjdk/bench/java/lang/foreign/LoopOverPollutedBuffer.java @@ -4,9 +4,7 @@ * * 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. + * 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 @@ -49,7 +47,7 @@ @Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS) @State(org.openjdk.jmh.annotations.Scope.Thread) @OutputTimeUnit(TimeUnit.MILLISECONDS) -@Fork(value = 3, jvmArgsAppend = "--enable-preview") +@Fork(value = 3, jvmArgs = "--enable-preview") public class LoopOverPollutedBuffer { static final int ELEM_SIZE = 1_000_000; diff --git a/test/micro/org/openjdk/bench/java/lang/foreign/LoopOverPollutedSegments.java b/test/micro/org/openjdk/bench/java/lang/foreign/LoopOverPollutedSegments.java index d396432d6e23..39e8153b5e72 100644 --- a/test/micro/org/openjdk/bench/java/lang/foreign/LoopOverPollutedSegments.java +++ b/test/micro/org/openjdk/bench/java/lang/foreign/LoopOverPollutedSegments.java @@ -46,7 +46,7 @@ @Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS) @State(org.openjdk.jmh.annotations.Scope.Thread) @OutputTimeUnit(TimeUnit.MILLISECONDS) -@Fork(value = 3, jvmArgsAppend = "--enable-preview") +@Fork(value = 3, jvmArgs = "--enable-preview") public class LoopOverPollutedSegments extends JavaLayouts { static final int ELEM_SIZE = 1_000_000; diff --git a/test/micro/org/openjdk/bench/java/lang/foreign/LoopOverSlice.java b/test/micro/org/openjdk/bench/java/lang/foreign/LoopOverSlice.java index 2979547ba403..25ad97fd7eb7 100644 --- a/test/micro/org/openjdk/bench/java/lang/foreign/LoopOverSlice.java +++ b/test/micro/org/openjdk/bench/java/lang/foreign/LoopOverSlice.java @@ -49,7 +49,7 @@ @Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS) @State(org.openjdk.jmh.annotations.Scope.Thread) @OutputTimeUnit(TimeUnit.MILLISECONDS) -@Fork(value = 3, jvmArgsAppend = { "--enable-preview", "--enable-native-access=ALL-UNNAMED" }) +@Fork(value = 3, jvmArgs = { "--enable-preview", "--enable-native-access=ALL-UNNAMED" }) public class LoopOverSlice { diff --git a/test/micro/org/openjdk/bench/java/lang/foreign/MemorySegmentVsBits.java b/test/micro/org/openjdk/bench/java/lang/foreign/MemorySegmentVsBits.java index 5ad20afeebf3..bc174b012210 100644 --- a/test/micro/org/openjdk/bench/java/lang/foreign/MemorySegmentVsBits.java +++ b/test/micro/org/openjdk/bench/java/lang/foreign/MemorySegmentVsBits.java @@ -4,9 +4,7 @@ * * 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. + * 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 @@ -60,7 +58,7 @@ @Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS) @State(org.openjdk.jmh.annotations.Scope.Thread) @OutputTimeUnit(TimeUnit.NANOSECONDS) -@Fork(value = 3, jvmArgsAppend = {"--enable-native-access=ALL-UNNAMED", "--enable-preview"}) +@Fork(value = 3, jvmArgs = {"--enable-native-access=ALL-UNNAMED", "--enable-preview"}) public class MemorySegmentVsBits { public static final VarHandle LONG_ARRAY_VH = MethodHandles.byteArrayViewVarHandle(long[].class, BIG_ENDIAN); diff --git a/test/micro/org/openjdk/bench/java/lang/foreign/MemorySessionClose.java b/test/micro/org/openjdk/bench/java/lang/foreign/MemorySessionClose.java index fa4207709eda..4fdc30e3b488 100644 --- a/test/micro/org/openjdk/bench/java/lang/foreign/MemorySessionClose.java +++ b/test/micro/org/openjdk/bench/java/lang/foreign/MemorySessionClose.java @@ -46,7 +46,7 @@ @Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS) @State(org.openjdk.jmh.annotations.Scope.Thread) @OutputTimeUnit(TimeUnit.MICROSECONDS) -@Fork(value = 3, jvmArgsAppend = "--enable-preview") +@Fork(value = 3, jvmArgs = "--enable-preview") public class MemorySessionClose { static final int ALLOC_SIZE = 1024; diff --git a/test/micro/org/openjdk/bench/java/lang/foreign/ParallelSum.java b/test/micro/org/openjdk/bench/java/lang/foreign/ParallelSum.java index 1579951127ec..f940ad8a0754 100644 --- a/test/micro/org/openjdk/bench/java/lang/foreign/ParallelSum.java +++ b/test/micro/org/openjdk/bench/java/lang/foreign/ParallelSum.java @@ -52,7 +52,7 @@ @Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS) @State(org.openjdk.jmh.annotations.Scope.Thread) @OutputTimeUnit(TimeUnit.MILLISECONDS) -@Fork(value = 3, jvmArgsAppend = "--enable-preview") +@Fork(value = 3, jvmArgs = "--enable-preview") public class ParallelSum extends JavaLayouts { final static int CARRIER_SIZE = 4; diff --git a/test/micro/org/openjdk/bench/java/lang/foreign/PointerInvoke.java b/test/micro/org/openjdk/bench/java/lang/foreign/PointerInvoke.java index ccf0c8a4c71e..4c054a4356a7 100644 --- a/test/micro/org/openjdk/bench/java/lang/foreign/PointerInvoke.java +++ b/test/micro/org/openjdk/bench/java/lang/foreign/PointerInvoke.java @@ -4,9 +4,7 @@ * * 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. + * 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 @@ -45,7 +43,7 @@ @Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS) @State(org.openjdk.jmh.annotations.Scope.Thread) @OutputTimeUnit(TimeUnit.NANOSECONDS) -@Fork(value = 3, jvmArgsAppend = { "--enable-native-access=ALL-UNNAMED", "--enable-preview" }) +@Fork(value = 3, jvmArgs = { "--enable-native-access=ALL-UNNAMED", "--enable-preview" }) public class PointerInvoke extends CLayouts { Arena arena = Arena.ofConfined(); diff --git a/test/micro/org/openjdk/bench/java/lang/foreign/QSort.java b/test/micro/org/openjdk/bench/java/lang/foreign/QSort.java index 90b7693db3d4..3d13e28b6f4e 100644 --- a/test/micro/org/openjdk/bench/java/lang/foreign/QSort.java +++ b/test/micro/org/openjdk/bench/java/lang/foreign/QSort.java @@ -46,7 +46,7 @@ @Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS) @State(org.openjdk.jmh.annotations.Scope.Thread) @OutputTimeUnit(TimeUnit.NANOSECONDS) -@Fork(value = 3, jvmArgsAppend = { "--enable-native-access=ALL-UNNAMED", "--enable-preview" }) +@Fork(value = 3, jvmArgs = { "--enable-native-access=ALL-UNNAMED", "--enable-preview" }) public class QSort extends CLayouts { static final Linker abi = Linker.nativeLinker(); diff --git a/test/micro/org/openjdk/bench/java/lang/foreign/StrLenTest.java b/test/micro/org/openjdk/bench/java/lang/foreign/StrLenTest.java index 496a3bf397e5..1cf14fb7f42f 100644 --- a/test/micro/org/openjdk/bench/java/lang/foreign/StrLenTest.java +++ b/test/micro/org/openjdk/bench/java/lang/foreign/StrLenTest.java @@ -4,9 +4,7 @@ * * 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. + * 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 @@ -50,7 +48,7 @@ @Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS) @State(org.openjdk.jmh.annotations.Scope.Thread) @OutputTimeUnit(TimeUnit.NANOSECONDS) -@Fork(value = 3, jvmArgsAppend = { "--enable-native-access=ALL-UNNAMED", "--enable-preview" }) +@Fork(value = 3, jvmArgs = { "--enable-native-access=ALL-UNNAMED", "--enable-preview" }) public class StrLenTest extends CLayouts { Arena arena = Arena.ofConfined(); diff --git a/test/micro/org/openjdk/bench/java/lang/foreign/TestAdaptVarHandles.java b/test/micro/org/openjdk/bench/java/lang/foreign/TestAdaptVarHandles.java index 055956460723..3d1b1539d7f5 100644 --- a/test/micro/org/openjdk/bench/java/lang/foreign/TestAdaptVarHandles.java +++ b/test/micro/org/openjdk/bench/java/lang/foreign/TestAdaptVarHandles.java @@ -47,7 +47,7 @@ @Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS) @State(org.openjdk.jmh.annotations.Scope.Thread) @OutputTimeUnit(TimeUnit.MILLISECONDS) -@Fork(value = 3, jvmArgsAppend = "--enable-preview") +@Fork(value = 3, jvmArgs = "--enable-preview") public class TestAdaptVarHandles extends JavaLayouts { static class IntBox { diff --git a/test/micro/org/openjdk/bench/java/lang/foreign/TestLoadBytes.java b/test/micro/org/openjdk/bench/java/lang/foreign/TestLoadBytes.java index 40d09b7b7625..29e4042285df 100644 --- a/test/micro/org/openjdk/bench/java/lang/foreign/TestLoadBytes.java +++ b/test/micro/org/openjdk/bench/java/lang/foreign/TestLoadBytes.java @@ -48,7 +48,7 @@ @Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS) @State(org.openjdk.jmh.annotations.Scope.Thread) @OutputTimeUnit(TimeUnit.NANOSECONDS) -@Fork(value = 1, jvmArgsAppend = { +@Fork(value = 1, jvmArgs = { "-Dforeign.restricted=permit", "--enable-native-access", "ALL-UNNAMED", "--enable-preview"}) diff --git a/test/micro/org/openjdk/bench/java/lang/foreign/UnrolledAccess.java b/test/micro/org/openjdk/bench/java/lang/foreign/UnrolledAccess.java index 2ba4ac2c4148..b77fd4a52820 100644 --- a/test/micro/org/openjdk/bench/java/lang/foreign/UnrolledAccess.java +++ b/test/micro/org/openjdk/bench/java/lang/foreign/UnrolledAccess.java @@ -40,7 +40,7 @@ @Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS) @State(org.openjdk.jmh.annotations.Scope.Thread) @OutputTimeUnit(TimeUnit.MICROSECONDS) -@Fork(value = 3, jvmArgsAppend = { "--enable-preview", "--enable-native-access=ALL-UNNAMED" }) +@Fork(value = 3, jvmArgs = { "--enable-preview", "--enable-native-access=ALL-UNNAMED" }) public class UnrolledAccess extends JavaLayouts { static final Unsafe U = Utils.unsafe; diff --git a/test/micro/org/openjdk/bench/java/lang/foreign/Upcalls.java b/test/micro/org/openjdk/bench/java/lang/foreign/Upcalls.java index e0de2fbfcb7d..a458f4c78466 100644 --- a/test/micro/org/openjdk/bench/java/lang/foreign/Upcalls.java +++ b/test/micro/org/openjdk/bench/java/lang/foreign/Upcalls.java @@ -45,7 +45,7 @@ @Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS) @State(org.openjdk.jmh.annotations.Scope.Thread) @OutputTimeUnit(TimeUnit.NANOSECONDS) -@Fork(value = 3, jvmArgsAppend = { "--enable-native-access=ALL-UNNAMED", "--enable-preview" }) +@Fork(value = 3, jvmArgs = { "--enable-native-access=ALL-UNNAMED", "--enable-preview" }) public class Upcalls extends CLayouts { static final Linker abi = Linker.nativeLinker(); diff --git a/test/micro/org/openjdk/bench/java/lang/foreign/VarHandleExact.java b/test/micro/org/openjdk/bench/java/lang/foreign/VarHandleExact.java index 4f8f9638c240..825e91459510 100644 --- a/test/micro/org/openjdk/bench/java/lang/foreign/VarHandleExact.java +++ b/test/micro/org/openjdk/bench/java/lang/foreign/VarHandleExact.java @@ -47,7 +47,7 @@ @Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS) @State(org.openjdk.jmh.annotations.Scope.Thread) @OutputTimeUnit(TimeUnit.NANOSECONDS) -@Fork(value = 3, jvmArgsAppend = "--enable-preview") +@Fork(value = 3, jvmArgs = "--enable-preview") public class VarHandleExact { static final VarHandle exact; diff --git a/test/micro/org/openjdk/bench/java/lang/foreign/libPtr.c b/test/micro/org/openjdk/bench/java/lang/foreign/libPtr.c index bb61791693d9..ed8bf5ffd4d6 100644 --- a/test/micro/org/openjdk/bench/java/lang/foreign/libPtr.c +++ b/test/micro/org/openjdk/bench/java/lang/foreign/libPtr.c @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/micro/org/openjdk/bench/java/lang/foreign/libStrLen.c b/test/micro/org/openjdk/bench/java/lang/foreign/libStrLen.c index 3d696b7a745f..ef105df63908 100644 --- a/test/micro/org/openjdk/bench/java/lang/foreign/libStrLen.c +++ b/test/micro/org/openjdk/bench/java/lang/foreign/libStrLen.c @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/micro/org/openjdk/bench/java/lang/foreign/pointers/PointerBench.java b/test/micro/org/openjdk/bench/java/lang/foreign/pointers/PointerBench.java index cd13aa0290ea..47c48ddc4486 100644 --- a/test/micro/org/openjdk/bench/java/lang/foreign/pointers/PointerBench.java +++ b/test/micro/org/openjdk/bench/java/lang/foreign/pointers/PointerBench.java @@ -46,7 +46,7 @@ @Warmup(iterations = 3, time = 500, timeUnit = TimeUnit.MILLISECONDS) @Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS) @OutputTimeUnit(TimeUnit.MILLISECONDS) -@Fork(value = 3, jvmArgsAppend = "--enable-preview") +@Fork(value = 3, jvmArgs = "--enable-preview") @State(Scope.Benchmark) public class PointerBench { diff --git a/test/micro/org/openjdk/bench/java/lang/foreign/points/PointsAccess.java b/test/micro/org/openjdk/bench/java/lang/foreign/points/PointsAccess.java index 34af75af0aba..2d824887bca4 100644 --- a/test/micro/org/openjdk/bench/java/lang/foreign/points/PointsAccess.java +++ b/test/micro/org/openjdk/bench/java/lang/foreign/points/PointsAccess.java @@ -43,7 +43,7 @@ @Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS) @State(org.openjdk.jmh.annotations.Scope.Thread) @OutputTimeUnit(TimeUnit.NANOSECONDS) -@Fork(value = 3, jvmArgsAppend = { "--enable-native-access=ALL-UNNAMED" }) +@Fork(value = 3, jvmArgs = { "--enable-native-access=ALL-UNNAMED" }) public class PointsAccess { BBPoint BBPoint; diff --git a/test/micro/org/openjdk/bench/java/lang/foreign/points/PointsAlloc.java b/test/micro/org/openjdk/bench/java/lang/foreign/points/PointsAlloc.java index 10e0be953513..01cf9fd35d66 100644 --- a/test/micro/org/openjdk/bench/java/lang/foreign/points/PointsAlloc.java +++ b/test/micro/org/openjdk/bench/java/lang/foreign/points/PointsAlloc.java @@ -41,7 +41,7 @@ @Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS) @State(org.openjdk.jmh.annotations.Scope.Thread) @OutputTimeUnit(TimeUnit.NANOSECONDS) -@Fork(value = 3, jvmArgsAppend = { "--enable-native-access=ALL-UNNAMED" }) +@Fork(value = 3, jvmArgs = { "--enable-native-access=ALL-UNNAMED" }) public class PointsAlloc { @Benchmark diff --git a/test/micro/org/openjdk/bench/java/lang/foreign/points/PointsDistance.java b/test/micro/org/openjdk/bench/java/lang/foreign/points/PointsDistance.java index aa6cc7bebe83..f6026f95069b 100644 --- a/test/micro/org/openjdk/bench/java/lang/foreign/points/PointsDistance.java +++ b/test/micro/org/openjdk/bench/java/lang/foreign/points/PointsDistance.java @@ -43,7 +43,7 @@ @Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS) @State(org.openjdk.jmh.annotations.Scope.Thread) @OutputTimeUnit(TimeUnit.NANOSECONDS) -@Fork(value = 3, jvmArgsAppend = { "--enable-native-access=ALL-UNNAMED" }) +@Fork(value = 3, jvmArgs = { "--enable-native-access=ALL-UNNAMED" }) public class PointsDistance { BBPoint jniP1; diff --git a/test/micro/org/openjdk/bench/java/lang/foreign/points/PointsFree.java b/test/micro/org/openjdk/bench/java/lang/foreign/points/PointsFree.java index e17d2550aa78..56763a2227f6 100644 --- a/test/micro/org/openjdk/bench/java/lang/foreign/points/PointsFree.java +++ b/test/micro/org/openjdk/bench/java/lang/foreign/points/PointsFree.java @@ -42,7 +42,7 @@ @Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS) @State(org.openjdk.jmh.annotations.Scope.Thread) @OutputTimeUnit(TimeUnit.NANOSECONDS) -@Fork(value = 3, jvmArgsAppend = { "--enable-native-access=ALL-UNNAMED" }) +@Fork(value = 3, jvmArgs = { "--enable-native-access=ALL-UNNAMED" }) public class PointsFree { JNIPoint jniPoint; diff --git a/test/micro/org/openjdk/bench/java/lang/invoke/Wrappers.java b/test/micro/org/openjdk/bench/java/lang/invoke/Wrappers.java index 931afeb16037..8db732efaafa 100644 --- a/test/micro/org/openjdk/bench/java/lang/invoke/Wrappers.java +++ b/test/micro/org/openjdk/bench/java/lang/invoke/Wrappers.java @@ -45,7 +45,7 @@ @Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS) @OutputTimeUnit(TimeUnit.NANOSECONDS) @State(Scope.Thread) -@Fork(value = 3, jvmArgsAppend = "--add-exports=java.base/sun.invoke.util=ALL-UNNAMED") +@Fork(value = 3, jvmArgs = "--add-exports=java.base/sun.invoke.util=ALL-UNNAMED") public class Wrappers { public static Class[] PRIM_CLASSES = { diff --git a/test/micro/org/openjdk/bench/java/net/NetworkInterfaceLookup.java b/test/micro/org/openjdk/bench/java/net/NetworkInterfaceLookup.java index 2a77e6a16ecb..4b1a5bc439a4 100644 --- a/test/micro/org/openjdk/bench/java/net/NetworkInterfaceLookup.java +++ b/test/micro/org/openjdk/bench/java/net/NetworkInterfaceLookup.java @@ -45,7 +45,7 @@ @BenchmarkMode(Mode.Throughput) @OutputTimeUnit(TimeUnit.SECONDS) @State(Scope.Thread) -@Fork(value = 2, jvmArgsAppend = "--add-opens=java.base/java.net=ALL-UNNAMED") +@Fork(value = 2, jvmArgs = "--add-opens=java.base/java.net=ALL-UNNAMED") @Warmup(iterations = 5, time = 1) @Measurement(iterations = 5, time = 1) public class NetworkInterfaceLookup { diff --git a/test/micro/org/openjdk/bench/java/net/SocketChannelConnectionSetup.java b/test/micro/org/openjdk/bench/java/net/SocketChannelConnectionSetup.java index c41005681611..704cca94af03 100644 --- a/test/micro/org/openjdk/bench/java/net/SocketChannelConnectionSetup.java +++ b/test/micro/org/openjdk/bench/java/net/SocketChannelConnectionSetup.java @@ -125,7 +125,7 @@ public static void main(String[] args) throws RunnerException { opt = new OptionsBuilder() .include(org.openjdk.bench.java.net.SocketChannelConnectionSetup.class.getSimpleName()) - .jvmArgsPrepend("-Djdk.net.useFastTcpLoopback=true") + .jvmArgs("-Djdk.net.useFastTcpLoopback=true") .warmupForks(1) .forks(2) .build(); diff --git a/test/micro/org/openjdk/bench/java/net/ThreadLocalParseUtil.java b/test/micro/org/openjdk/bench/java/net/ThreadLocalParseUtil.java index 93af26379a7c..180de650ede5 100644 --- a/test/micro/org/openjdk/bench/java/net/ThreadLocalParseUtil.java +++ b/test/micro/org/openjdk/bench/java/net/ThreadLocalParseUtil.java @@ -48,7 +48,7 @@ @State(Scope.Thread) @Warmup(iterations = 5, time = 1) @Measurement(iterations = 5, time = 1) -@Fork(value = 1, jvmArgsAppend = "--add-exports=java.base/sun.net.www=ALL-UNNAMED") +@Fork(value = 1, jvmArgs = "--add-exports=java.base/sun.net.www=ALL-UNNAMED") public class ThreadLocalParseUtil { private static final MethodHandle MH_DECODE; diff --git a/test/micro/org/openjdk/bench/java/nio/X-Buffers-bin.java.template b/test/micro/org/openjdk/bench/java/nio/X-Buffers-bin.java.template index 1e8b6eae4a56..86baf26cb405 100644 --- a/test/micro/org/openjdk/bench/java/nio/X-Buffers-bin.java.template +++ b/test/micro/org/openjdk/bench/java/nio/X-Buffers-bin.java.template @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/micro/org/openjdk/bench/java/nio/X-ByteBuffers-bin.java.template b/test/micro/org/openjdk/bench/java/nio/X-ByteBuffers-bin.java.template index 14916b299ae9..0629d81582f3 100644 --- a/test/micro/org/openjdk/bench/java/nio/X-ByteBuffers-bin.java.template +++ b/test/micro/org/openjdk/bench/java/nio/X-ByteBuffers-bin.java.template @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/micro/org/openjdk/bench/java/security/AlgorithmConstraintsPermits.java b/test/micro/org/openjdk/bench/java/security/AlgorithmConstraintsPermits.java index 46e68ea627fd..683d069bc7e7 100644 --- a/test/micro/org/openjdk/bench/java/security/AlgorithmConstraintsPermits.java +++ b/test/micro/org/openjdk/bench/java/security/AlgorithmConstraintsPermits.java @@ -45,7 +45,7 @@ @BenchmarkMode(Mode.AverageTime) @OutputTimeUnit(TimeUnit.NANOSECONDS) -@Fork(value = 3, jvmArgsAppend = {"--add-exports", "java.base/sun.security.util=ALL-UNNAMED"}) +@Fork(value = 3, jvmArgs = {"--add-exports", "java.base/sun.security.util=ALL-UNNAMED"}) @State(Scope.Thread) @Warmup(iterations = 5, time = 1) @Measurement(iterations = 5, time = 1) diff --git a/test/micro/org/openjdk/bench/java/security/CacheBench.java b/test/micro/org/openjdk/bench/java/security/CacheBench.java index 9b7c39a3cf2d..7366a18c020d 100644 --- a/test/micro/org/openjdk/bench/java/security/CacheBench.java +++ b/test/micro/org/openjdk/bench/java/security/CacheBench.java @@ -44,7 +44,7 @@ @BenchmarkMode(Mode.AverageTime) @OutputTimeUnit(TimeUnit.NANOSECONDS) -@Fork(value = 3, jvmArgsAppend = {"--add-exports", "java.base/sun.security.util=ALL-UNNAMED"}) +@Fork(value = 3, jvmArgs = {"--add-exports", "java.base/sun.security.util=ALL-UNNAMED"}) @Warmup(iterations = 5, time = 1) @Measurement(iterations = 5, time = 1) public class CacheBench { diff --git a/test/micro/org/openjdk/bench/java/security/CipherSuiteBench.java b/test/micro/org/openjdk/bench/java/security/CipherSuiteBench.java index e37cec895caa..c1b15eeb1a6b 100644 --- a/test/micro/org/openjdk/bench/java/security/CipherSuiteBench.java +++ b/test/micro/org/openjdk/bench/java/security/CipherSuiteBench.java @@ -30,7 +30,7 @@ import java.util.concurrent.TimeUnit; -@Fork(value = 3, jvmArgsAppend = {"--add-exports", "java.base/sun.security.ssl=ALL-UNNAMED", "--add-opens", "java.base/sun.security.ssl=ALL-UNNAMED"}) +@Fork(value = 3, jvmArgs = {"--add-exports", "java.base/sun.security.ssl=ALL-UNNAMED", "--add-opens", "java.base/sun.security.ssl=ALL-UNNAMED"}) @State(Scope.Benchmark) @OutputTimeUnit(TimeUnit.MICROSECONDS) @BenchmarkMode(Mode.Throughput) diff --git a/test/micro/org/openjdk/bench/java/security/GetContext.java b/test/micro/org/openjdk/bench/java/security/GetContext.java index 1e36165d3f07..0e7b8c488c95 100644 --- a/test/micro/org/openjdk/bench/java/security/GetContext.java +++ b/test/micro/org/openjdk/bench/java/security/GetContext.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/micro/org/openjdk/bench/java/security/HSS.java b/test/micro/org/openjdk/bench/java/security/HSS.java index d89147406dcd..c2f746d2449e 100644 --- a/test/micro/org/openjdk/bench/java/security/HSS.java +++ b/test/micro/org/openjdk/bench/java/security/HSS.java @@ -55,7 +55,7 @@ @OutputTimeUnit(TimeUnit.MICROSECONDS) @Warmup(iterations = 5, time = 1) @Measurement(iterations = 5, time = 1) -@Fork(value = 3, jvmArgsAppend = {"--add-exports", "java.base/sun.security.util=ALL-UNNAMED"}) +@Fork(value = 3, jvmArgs = {"--add-exports", "java.base/sun.security.util=ALL-UNNAMED"}) // Tests 1-2 are from RFC 8554, Appendix F. diff --git a/test/micro/org/openjdk/bench/java/security/MessageDigests.java b/test/micro/org/openjdk/bench/java/security/MessageDigests.java index a3ab483c39c1..2a4e3933d31f 100644 --- a/test/micro/org/openjdk/bench/java/security/MessageDigests.java +++ b/test/micro/org/openjdk/bench/java/security/MessageDigests.java @@ -47,7 +47,7 @@ @OutputTimeUnit(TimeUnit.MILLISECONDS) @Warmup(iterations = 5, time = 1) @Measurement(iterations = 5, time = 1) -@Fork(jvmArgsAppend = {"-Xms1024m", "-Xmx1024m", "-Xmn768m", "-XX:+UseParallelGC"}, value = 3) +@Fork(jvmArgs = {"-Xms1024m", "-Xmx1024m", "-Xmn768m", "-XX:+UseParallelGC"}, value = 3) public class MessageDigests { @Param({"64", "16384"}) diff --git a/test/micro/org/openjdk/bench/java/security/PKCS12KeyStores.java b/test/micro/org/openjdk/bench/java/security/PKCS12KeyStores.java index f68b4503ef52..065bd96c4bf3 100644 --- a/test/micro/org/openjdk/bench/java/security/PKCS12KeyStores.java +++ b/test/micro/org/openjdk/bench/java/security/PKCS12KeyStores.java @@ -41,7 +41,7 @@ @Warmup(iterations = 5, time = 1) @Measurement(iterations = 5, time = 1) @BenchmarkMode(Mode.AverageTime) -@Fork(jvmArgsAppend = {"-Xms1024m", "-Xmx1024m", "-Xmn768m", "-XX:+UseParallelGC"}, value = 3) +@Fork(jvmArgs = {"-Xms1024m", "-Xmx1024m", "-Xmn768m", "-XX:+UseParallelGC"}, value = 3) public class PKCS12KeyStores { private static final char[] PASS = "changeit".toCharArray(); diff --git a/test/micro/org/openjdk/bench/java/security/ProtectionDomainBench.java b/test/micro/org/openjdk/bench/java/security/ProtectionDomainBench.java index ec85e09634f0..cf302d83e9bb 100644 --- a/test/micro/org/openjdk/bench/java/security/ProtectionDomainBench.java +++ b/test/micro/org/openjdk/bench/java/security/ProtectionDomainBench.java @@ -123,7 +123,7 @@ void work() throws ClassNotFoundException { } @Benchmark - @Fork(value = 3, jvmArgsPrepend={"-Djava.security.manager=allow"}) + @Fork(value = 3, jvmArgs={"-Djava.security.manager=allow"}) public void withSecurityManager() throws ClassNotFoundException { work(); } diff --git a/test/micro/org/openjdk/bench/java/security/Signatures.java b/test/micro/org/openjdk/bench/java/security/Signatures.java index 7a14cb24b88b..1bd723343437 100644 --- a/test/micro/org/openjdk/bench/java/security/Signatures.java +++ b/test/micro/org/openjdk/bench/java/security/Signatures.java @@ -34,7 +34,7 @@ @State(Scope.Thread) @Warmup(iterations = 5, time = 1) @Measurement(iterations = 5, time = 1) -@Fork(jvmArgsAppend = {"-Xms1024m", "-Xmx1024m", "-Xmn768m", "-XX:+UseParallelGC"}, value = 3) +@Fork(jvmArgs = {"-Xms1024m", "-Xmx1024m", "-Xmn768m", "-XX:+UseParallelGC"}, value = 3) public class Signatures { private static Signature signer; diff --git a/test/micro/org/openjdk/bench/java/time/format/ZonedDateTimeFormatterBenchmark.java b/test/micro/org/openjdk/bench/java/time/format/ZonedDateTimeFormatterBenchmark.java index 5d2acc161639..1b8f83899747 100644 --- a/test/micro/org/openjdk/bench/java/time/format/ZonedDateTimeFormatterBenchmark.java +++ b/test/micro/org/openjdk/bench/java/time/format/ZonedDateTimeFormatterBenchmark.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2023, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2023, 2025, 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 @@ -40,7 +40,7 @@ public class ZonedDateTimeFormatterBenchmark { private static final DateTimeFormatter df = new DateTimeFormatterBuilder() .appendPattern("yyyy:MM:dd:HH:mm:v") .toFormatter(); - private static final String TEXT = "2015:03:10:12:13:ECT"; + private static final String TEXT = "2015:03:10:12:13:PST"; @Setup public void setUp() { diff --git a/test/micro/org/openjdk/bench/java/util/ListArgs.java b/test/micro/org/openjdk/bench/java/util/ListArgs.java index a3e192712594..1d7a8ca9d09c 100644 --- a/test/micro/org/openjdk/bench/java/util/ListArgs.java +++ b/test/micro/org/openjdk/bench/java/util/ListArgs.java @@ -36,7 +36,7 @@ */ @State(Scope.Benchmark) @OutputTimeUnit(TimeUnit.MILLISECONDS) -@Fork(value = 3, jvmArgsAppend = { "-verbose:gc", "-XX:+UseParallelGC", "-Xms4g", "-Xmx4g", "-Xint" }) +@Fork(value = 3, jvmArgs = { "-verbose:gc", "-XX:+UseParallelGC", "-Xms4g", "-Xmx4g", "-Xint" }) @Warmup(iterations = 5, time = 1, timeUnit = TimeUnit.SECONDS) @Measurement(iterations = 5, time = 2, timeUnit = TimeUnit.SECONDS) public class ListArgs { diff --git a/test/micro/org/openjdk/bench/java/util/StringJoinerBenchmark.java b/test/micro/org/openjdk/bench/java/util/StringJoinerBenchmark.java index 6df0045ef32b..38b6389db54e 100644 --- a/test/micro/org/openjdk/bench/java/util/StringJoinerBenchmark.java +++ b/test/micro/org/openjdk/bench/java/util/StringJoinerBenchmark.java @@ -45,7 +45,7 @@ @OutputTimeUnit(TimeUnit.NANOSECONDS) @Warmup(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS) @Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS) -@Fork(value = 3, jvmArgsAppend = {"-Xms1g", "-Xmx1g"}) +@Fork(value = 3, jvmArgs = {"-Xms1g", "-Xmx1g"}) public class StringJoinerBenchmark { @Benchmark diff --git a/test/micro/org/openjdk/bench/java/util/stream/tasks/README b/test/micro/org/openjdk/bench/java/util/stream/tasks/README index 35095b7cfeb3..3387a6588087 100644 --- a/test/micro/org/openjdk/bench/java/util/stream/tasks/README +++ b/test/micro/org/openjdk/bench/java/util/stream/tasks/README @@ -3,9 +3,7 @@ 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. +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 diff --git a/test/micro/org/openjdk/bench/javax/crypto/AES.java b/test/micro/org/openjdk/bench/javax/crypto/AES.java index 23ecdb33f94a..8bd4a6ff9b3a 100644 --- a/test/micro/org/openjdk/bench/javax/crypto/AES.java +++ b/test/micro/org/openjdk/bench/javax/crypto/AES.java @@ -59,19 +59,19 @@ public void setup() throws Exception { } @Benchmark - @Fork(jvmArgsAppend = {"-XX:+UnlockDiagnosticVMOptions", "-XX:-UseAES", "-XX:-UseAESIntrinsics"}) + @Fork(jvmArgs = {"-XX:+UnlockDiagnosticVMOptions", "-XX:-UseAES", "-XX:-UseAESIntrinsics"}) public byte[] testBaseline() throws Exception { return cipher.doFinal(src); } @Benchmark - @Fork(jvmArgsAppend = {"-XX:+UnlockDiagnosticVMOptions", "-XX:+UseAES", "-XX:-UseAESIntrinsics"}) + @Fork(jvmArgs = {"-XX:+UnlockDiagnosticVMOptions", "-XX:+UseAES", "-XX:-UseAESIntrinsics"}) public byte[] testUseAes() throws Exception { return cipher.doFinal(src); } @Benchmark - @Fork(jvmArgsAppend = {"-XX:+UnlockDiagnosticVMOptions", "-XX:+UseAES", "-XX:+UseAESIntrinsics"}) + @Fork(jvmArgs = {"-XX:+UnlockDiagnosticVMOptions", "-XX:+UseAES", "-XX:+UseAESIntrinsics"}) public byte[] testUseAesIntrinsics() throws Exception { return cipher.doFinal(src); } diff --git a/test/micro/org/openjdk/bench/javax/crypto/AESReinit.java b/test/micro/org/openjdk/bench/javax/crypto/AESReinit.java index 6a0fa8926885..dafcc5446498 100644 --- a/test/micro/org/openjdk/bench/javax/crypto/AESReinit.java +++ b/test/micro/org/openjdk/bench/javax/crypto/AESReinit.java @@ -32,7 +32,7 @@ @Warmup(iterations = 5, time = 1, timeUnit = TimeUnit.SECONDS) @Measurement(iterations = 5, time = 1, timeUnit = TimeUnit.SECONDS) -@Fork(value = 3, jvmArgsAppend = {"-Xms1g", "-Xmx1g"}) +@Fork(value = 3, jvmArgs = {"-Xms1g", "-Xmx1g"}) @BenchmarkMode(Mode.AverageTime) @OutputTimeUnit(TimeUnit.NANOSECONDS) @State(Scope.Benchmark) diff --git a/test/micro/org/openjdk/bench/javax/crypto/Crypto.java b/test/micro/org/openjdk/bench/javax/crypto/Crypto.java index 6a9a49bd84e0..38e88d0171e9 100644 --- a/test/micro/org/openjdk/bench/javax/crypto/Crypto.java +++ b/test/micro/org/openjdk/bench/javax/crypto/Crypto.java @@ -51,7 +51,7 @@ @OutputTimeUnit(TimeUnit.MILLISECONDS) @Warmup(iterations = 5) @Measurement(iterations = 10) -@Fork(jvmArgsAppend = {"-Xms1024m", "-Xmx1024m", "-Xmn768m", "-XX:+UseParallelGC"}, value = 5) +@Fork(jvmArgs = {"-Xms1024m", "-Xmx1024m", "-Xmn768m", "-XX:+UseParallelGC"}, value = 5) public class Crypto { @Param({"64", "1024", "16384"}) diff --git a/test/micro/org/openjdk/bench/javax/crypto/full/AESGCMByteBuffer.java b/test/micro/org/openjdk/bench/javax/crypto/full/AESGCMByteBuffer.java index 1f7e0eaa2c35..3e07c6b69102 100644 --- a/test/micro/org/openjdk/bench/javax/crypto/full/AESGCMByteBuffer.java +++ b/test/micro/org/openjdk/bench/javax/crypto/full/AESGCMByteBuffer.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/micro/org/openjdk/bench/javax/crypto/full/CryptoBase.java b/test/micro/org/openjdk/bench/javax/crypto/full/CryptoBase.java index c0fbcdcaa019..b2d08204d7b3 100644 --- a/test/micro/org/openjdk/bench/javax/crypto/full/CryptoBase.java +++ b/test/micro/org/openjdk/bench/javax/crypto/full/CryptoBase.java @@ -45,7 +45,7 @@ import java.util.concurrent.TimeUnit; -@Fork(jvmArgsAppend = {"-XX:+AlwaysPreTouch"}, value = 5) +@Fork(jvmArgs = {"-XX:+AlwaysPreTouch"}, value = 5) @Warmup(iterations = 3, time = 3) @Measurement(iterations = 8, time = 2) @OutputTimeUnit(TimeUnit.SECONDS) diff --git a/test/micro/org/openjdk/bench/javax/crypto/full/Poly1305DigestBench.java b/test/micro/org/openjdk/bench/javax/crypto/full/Poly1305DigestBench.java index 529ce9a2b32d..bff0918b7a8c 100644 --- a/test/micro/org/openjdk/bench/javax/crypto/full/Poly1305DigestBench.java +++ b/test/micro/org/openjdk/bench/javax/crypto/full/Poly1305DigestBench.java @@ -41,7 +41,7 @@ @Measurement(iterations = 3, time = 10) @Warmup(iterations = 3, time = 10) -@Fork(value = 1, jvmArgsAppend = {"--add-opens", "java.base/com.sun.crypto.provider=ALL-UNNAMED"}) +@Fork(value = 1, jvmArgs = {"--add-opens", "java.base/com.sun.crypto.provider=ALL-UNNAMED"}) public class Poly1305DigestBench extends CryptoBase { public static final int SET_SIZE = 128; diff --git a/test/micro/org/openjdk/bench/jdk/classfile/AbstractCorpusBenchmark.java b/test/micro/org/openjdk/bench/jdk/classfile/AbstractCorpusBenchmark.java index 3fa1de47c53e..90cf24aa2536 100644 --- a/test/micro/org/openjdk/bench/jdk/classfile/AbstractCorpusBenchmark.java +++ b/test/micro/org/openjdk/bench/jdk/classfile/AbstractCorpusBenchmark.java @@ -4,9 +4,7 @@ * * 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. + * 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 @@ -45,7 +43,7 @@ */ @Warmup(iterations = 2) @Measurement(iterations = 4) -@Fork(value = 1, jvmArgsAppend = { +@Fork(value = 1, jvmArgs = { "--add-exports", "java.base/jdk.internal.org.objectweb.asm=ALL-UNNAMED", "--add-exports", "java.base/jdk.internal.org.objectweb.asm.tree=ALL-UNNAMED", "--add-exports", "java.base/jdk.internal.classfile=ALL-UNNAMED", diff --git a/test/micro/org/openjdk/bench/jdk/classfile/AdHocAdapt.java b/test/micro/org/openjdk/bench/jdk/classfile/AdHocAdapt.java index 5213f7ca8ff5..9b7b42b8c340 100644 --- a/test/micro/org/openjdk/bench/jdk/classfile/AdHocAdapt.java +++ b/test/micro/org/openjdk/bench/jdk/classfile/AdHocAdapt.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/micro/org/openjdk/bench/jdk/classfile/AdaptInjectNoop.java b/test/micro/org/openjdk/bench/jdk/classfile/AdaptInjectNoop.java index c6cb4e095dcf..16696db672ca 100644 --- a/test/micro/org/openjdk/bench/jdk/classfile/AdaptInjectNoop.java +++ b/test/micro/org/openjdk/bench/jdk/classfile/AdaptInjectNoop.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/micro/org/openjdk/bench/jdk/classfile/AdaptMetadata.java b/test/micro/org/openjdk/bench/jdk/classfile/AdaptMetadata.java index d3e1cc8924bb..4d1bcaefd80d 100644 --- a/test/micro/org/openjdk/bench/jdk/classfile/AdaptMetadata.java +++ b/test/micro/org/openjdk/bench/jdk/classfile/AdaptMetadata.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/micro/org/openjdk/bench/jdk/classfile/AdaptNull.java b/test/micro/org/openjdk/bench/jdk/classfile/AdaptNull.java index 81032e4c0dab..55c33b36805a 100644 --- a/test/micro/org/openjdk/bench/jdk/classfile/AdaptNull.java +++ b/test/micro/org/openjdk/bench/jdk/classfile/AdaptNull.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/micro/org/openjdk/bench/jdk/classfile/GenerateStackMaps.java b/test/micro/org/openjdk/bench/jdk/classfile/GenerateStackMaps.java index e11edf16edcf..b4c570448e29 100644 --- a/test/micro/org/openjdk/bench/jdk/classfile/GenerateStackMaps.java +++ b/test/micro/org/openjdk/bench/jdk/classfile/GenerateStackMaps.java @@ -4,9 +4,7 @@ * * 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. + * 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 @@ -55,7 +53,7 @@ @BenchmarkMode(Mode.Throughput) @State(Scope.Benchmark) -@Fork(value = 1, jvmArgsAppend = { +@Fork(value = 1, jvmArgs = { "--add-exports", "java.base/jdk.internal.classfile=ALL-UNNAMED", "--add-exports", "java.base/jdk.internal.classfile.attribute=ALL-UNNAMED", "--add-exports", "java.base/jdk.internal.classfile.constantpool=ALL-UNNAMED", diff --git a/test/micro/org/openjdk/bench/jdk/classfile/ParseOptions.java b/test/micro/org/openjdk/bench/jdk/classfile/ParseOptions.java index 42a9f4d9ff4f..0003566a2f81 100644 --- a/test/micro/org/openjdk/bench/jdk/classfile/ParseOptions.java +++ b/test/micro/org/openjdk/bench/jdk/classfile/ParseOptions.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/micro/org/openjdk/bench/jdk/classfile/ReadDeep.java b/test/micro/org/openjdk/bench/jdk/classfile/ReadDeep.java index 81ed7b534622..7cd9a0cf28c1 100644 --- a/test/micro/org/openjdk/bench/jdk/classfile/ReadDeep.java +++ b/test/micro/org/openjdk/bench/jdk/classfile/ReadDeep.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/micro/org/openjdk/bench/jdk/classfile/ReadMetadata.java b/test/micro/org/openjdk/bench/jdk/classfile/ReadMetadata.java index 8b254004ab0a..e8d93f6f9394 100644 --- a/test/micro/org/openjdk/bench/jdk/classfile/ReadMetadata.java +++ b/test/micro/org/openjdk/bench/jdk/classfile/ReadMetadata.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/micro/org/openjdk/bench/jdk/classfile/RebuildMethodBodies.java b/test/micro/org/openjdk/bench/jdk/classfile/RebuildMethodBodies.java index c18433deffa6..bc8adf8cf6fc 100644 --- a/test/micro/org/openjdk/bench/jdk/classfile/RebuildMethodBodies.java +++ b/test/micro/org/openjdk/bench/jdk/classfile/RebuildMethodBodies.java @@ -4,9 +4,7 @@ * * 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. + * 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 @@ -39,7 +37,7 @@ @BenchmarkMode(Mode.Throughput) @State(Scope.Benchmark) -@Fork(value = 1, jvmArgsAppend = { +@Fork(value = 1, jvmArgs = { "--add-exports", "java.base/jdk.internal.classfile=ALL-UNNAMED", "--add-exports", "java.base/jdk.internal.classfile.constantpool=ALL-UNNAMED", "--add-exports", "java.base/jdk.internal.classfile.instruction=ALL-UNNAMED"}) diff --git a/test/micro/org/openjdk/bench/jdk/classfile/RepeatedModelTraversal.java b/test/micro/org/openjdk/bench/jdk/classfile/RepeatedModelTraversal.java index 601dba50806f..0b7fd770e160 100644 --- a/test/micro/org/openjdk/bench/jdk/classfile/RepeatedModelTraversal.java +++ b/test/micro/org/openjdk/bench/jdk/classfile/RepeatedModelTraversal.java @@ -4,9 +4,7 @@ * * 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. + * 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 @@ -38,7 +36,7 @@ @BenchmarkMode(Mode.Throughput) @State(Scope.Benchmark) -@Fork(value = 1, jvmArgsAppend = { +@Fork(value = 1, jvmArgs = { "--add-exports", "java.base/jdk.internal.classfile=ALL-UNNAMED", "--add-exports", "java.base/jdk.internal.classfile.components=ALL-UNNAMED"}) @Warmup(iterations = 3) diff --git a/test/micro/org/openjdk/bench/jdk/classfile/TestConstants.java b/test/micro/org/openjdk/bench/jdk/classfile/TestConstants.java index 60697569ef06..67e65c796616 100644 --- a/test/micro/org/openjdk/bench/jdk/classfile/TestConstants.java +++ b/test/micro/org/openjdk/bench/jdk/classfile/TestConstants.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/micro/org/openjdk/bench/jdk/classfile/Transforms.java b/test/micro/org/openjdk/bench/jdk/classfile/Transforms.java index cd647858a1b6..b68347e07ce1 100644 --- a/test/micro/org/openjdk/bench/jdk/classfile/Transforms.java +++ b/test/micro/org/openjdk/bench/jdk/classfile/Transforms.java @@ -4,9 +4,7 @@ * * 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. + * 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 diff --git a/test/micro/org/openjdk/bench/jdk/classfile/Write.java b/test/micro/org/openjdk/bench/jdk/classfile/Write.java index 485e61e39eda..f813bc2c065e 100644 --- a/test/micro/org/openjdk/bench/jdk/classfile/Write.java +++ b/test/micro/org/openjdk/bench/jdk/classfile/Write.java @@ -4,9 +4,7 @@ * * 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. + * 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 @@ -65,7 +63,7 @@ */ @Warmup(iterations = 3) @Measurement(iterations = 5) -@Fork(value = 1, jvmArgsAppend = { +@Fork(value = 1, jvmArgs = { "--add-exports", "java.base/jdk.internal.org.objectweb.asm=ALL-UNNAMED", "--add-exports", "java.base/jdk.internal.org.objectweb.asm.tree=ALL-UNNAMED", "--add-exports", "java.base/jdk.internal.classfile=ALL-UNNAMED", diff --git a/test/micro/org/openjdk/bench/jdk/incubator/vector/ArrayMismatchBenchmark.java b/test/micro/org/openjdk/bench/jdk/incubator/vector/ArrayMismatchBenchmark.java index c6c34e890fa1..8d0cce89f98c 100644 --- a/test/micro/org/openjdk/bench/jdk/incubator/vector/ArrayMismatchBenchmark.java +++ b/test/micro/org/openjdk/bench/jdk/incubator/vector/ArrayMismatchBenchmark.java @@ -47,7 +47,7 @@ @OutputTimeUnit(TimeUnit.MILLISECONDS) @State(Scope.Thread) -@Fork(jvmArgsPrepend = {"--add-modules=jdk.incubator.vector"}) +@Fork(jvmArgs = {"--add-modules=jdk.incubator.vector"}) public class ArrayMismatchBenchmark { @Param({"9", "257", "100000"}) diff --git a/test/micro/org/openjdk/bench/jdk/incubator/vector/BlackScholes.java b/test/micro/org/openjdk/bench/jdk/incubator/vector/BlackScholes.java index f58821b66972..5db2c6b7d071 100644 --- a/test/micro/org/openjdk/bench/jdk/incubator/vector/BlackScholes.java +++ b/test/micro/org/openjdk/bench/jdk/incubator/vector/BlackScholes.java @@ -39,7 +39,7 @@ @State(Scope.Thread) @Warmup(iterations = 3, time = 5) @Measurement(iterations = 3, time = 5) -@Fork(jvmArgsPrepend = {"--add-modules=jdk.incubator.vector"}) +@Fork(jvmArgs = {"--add-modules=jdk.incubator.vector"}) public class BlackScholes { @Param("1024") diff --git a/test/micro/org/openjdk/bench/jdk/incubator/vector/EqualsIgnoreCaseBenchmark.java b/test/micro/org/openjdk/bench/jdk/incubator/vector/EqualsIgnoreCaseBenchmark.java index 888029f3c119..20d7646586d1 100644 --- a/test/micro/org/openjdk/bench/jdk/incubator/vector/EqualsIgnoreCaseBenchmark.java +++ b/test/micro/org/openjdk/bench/jdk/incubator/vector/EqualsIgnoreCaseBenchmark.java @@ -46,7 +46,7 @@ @State(Scope.Benchmark) @Warmup(iterations = 5, time = 1) @Measurement(iterations = 5, time = 1) -@Fork(value = 3, jvmArgsPrepend = {"--add-modules=jdk.incubator.vector"}) +@Fork(value = 3, jvmArgs = {"--add-modules=jdk.incubator.vector"}) public class EqualsIgnoreCaseBenchmark { static final VectorSpecies SPECIES = ByteVector.SPECIES_PREFERRED; private byte[] a; diff --git a/test/micro/org/openjdk/bench/jdk/incubator/vector/IndexInRangeBenchmark.java b/test/micro/org/openjdk/bench/jdk/incubator/vector/IndexInRangeBenchmark.java index da4842bc34a2..594abf4b1757 100644 --- a/test/micro/org/openjdk/bench/jdk/incubator/vector/IndexInRangeBenchmark.java +++ b/test/micro/org/openjdk/bench/jdk/incubator/vector/IndexInRangeBenchmark.java @@ -32,7 +32,7 @@ @State(Scope.Benchmark) @Warmup(iterations = 3, time = 1) @Measurement(iterations = 5, time = 1) -@Fork(value = 1, jvmArgsPrepend = {"--add-modules=jdk.incubator.vector"}) +@Fork(value = 1, jvmArgs = {"--add-modules=jdk.incubator.vector"}) public class IndexInRangeBenchmark { @Param({"7", "256", "259", "512"}) private int size; @@ -48,7 +48,7 @@ public class IndexInRangeBenchmark { @Setup(Level.Trial) public void Setup() { - mask = new boolean[512]; + mask = new boolean[size + 64]; } @Benchmark diff --git a/test/micro/org/openjdk/bench/jdk/incubator/vector/IndexVectorBenchmark.java b/test/micro/org/openjdk/bench/jdk/incubator/vector/IndexVectorBenchmark.java index 186e998bc65d..dc2b364c067b 100644 --- a/test/micro/org/openjdk/bench/jdk/incubator/vector/IndexVectorBenchmark.java +++ b/test/micro/org/openjdk/bench/jdk/incubator/vector/IndexVectorBenchmark.java @@ -32,7 +32,7 @@ @State(Scope.Benchmark) @Warmup(iterations = 3, time = 1) @Measurement(iterations = 5, time = 1) -@Fork(value = 1, jvmArgsPrepend = {"--add-modules=jdk.incubator.vector"}) +@Fork(value = 1, jvmArgs = {"--add-modules=jdk.incubator.vector"}) public class IndexVectorBenchmark { @Param({"1024"}) private int size; diff --git a/test/micro/org/openjdk/bench/jdk/incubator/vector/LoadMaskedIOOBEBenchmark.java b/test/micro/org/openjdk/bench/jdk/incubator/vector/LoadMaskedIOOBEBenchmark.java index 0bfd8a72e5a2..fc473e347cec 100644 --- a/test/micro/org/openjdk/bench/jdk/incubator/vector/LoadMaskedIOOBEBenchmark.java +++ b/test/micro/org/openjdk/bench/jdk/incubator/vector/LoadMaskedIOOBEBenchmark.java @@ -32,7 +32,7 @@ @State(Scope.Benchmark) @Warmup(iterations = 3, time = 1) @Measurement(iterations = 5, time = 1) -@Fork(value = 1, jvmArgsPrepend = {"--add-modules=jdk.incubator.vector"}) +@Fork(value = 1, jvmArgs = {"--add-modules=jdk.incubator.vector"}) public class LoadMaskedIOOBEBenchmark { @Param({"1026"}) private int inSize; diff --git a/test/micro/org/openjdk/bench/jdk/incubator/vector/MaskCastOperationsBenchmark.java b/test/micro/org/openjdk/bench/jdk/incubator/vector/MaskCastOperationsBenchmark.java index 93871392f26e..e277fd9114f1 100644 --- a/test/micro/org/openjdk/bench/jdk/incubator/vector/MaskCastOperationsBenchmark.java +++ b/test/micro/org/openjdk/bench/jdk/incubator/vector/MaskCastOperationsBenchmark.java @@ -30,7 +30,7 @@ @OutputTimeUnit(TimeUnit.MILLISECONDS) @State(Scope.Thread) -@Fork(jvmArgsPrepend = {"--add-modules=jdk.incubator.vector"}) +@Fork(jvmArgs = {"--add-modules=jdk.incubator.vector"}) public class MaskCastOperationsBenchmark { VectorMask bmask64; VectorMask bmask128; diff --git a/test/micro/org/openjdk/bench/jdk/incubator/vector/MaskFromLongBenchmark.java b/test/micro/org/openjdk/bench/jdk/incubator/vector/MaskFromLongBenchmark.java index a7c73ea64608..ee0fadd6db8f 100644 --- a/test/micro/org/openjdk/bench/jdk/incubator/vector/MaskFromLongBenchmark.java +++ b/test/micro/org/openjdk/bench/jdk/incubator/vector/MaskFromLongBenchmark.java @@ -29,7 +29,7 @@ @OutputTimeUnit(TimeUnit.MILLISECONDS) @State(Scope.Thread) -@Fork(jvmArgsPrepend = {"--add-modules=jdk.incubator.vector"}) +@Fork(jvmArgs = {"--add-modules=jdk.incubator.vector"}) public class MaskFromLongBenchmark { private static final int ITERATION = 20000; diff --git a/test/micro/org/openjdk/bench/jdk/incubator/vector/MaskQueryOperationsBenchmark.java b/test/micro/org/openjdk/bench/jdk/incubator/vector/MaskQueryOperationsBenchmark.java index 373bd5017cc2..20537fe74f6a 100644 --- a/test/micro/org/openjdk/bench/jdk/incubator/vector/MaskQueryOperationsBenchmark.java +++ b/test/micro/org/openjdk/bench/jdk/incubator/vector/MaskQueryOperationsBenchmark.java @@ -31,7 +31,7 @@ @OutputTimeUnit(TimeUnit.MILLISECONDS) @State(Scope.Thread) -@Fork(jvmArgsPrepend = {"--add-modules=jdk.incubator.vector"}) +@Fork(jvmArgs = {"--add-modules=jdk.incubator.vector"}) public class MaskQueryOperationsBenchmark { @Param({"128","256","512"}) int bits; diff --git a/test/micro/org/openjdk/bench/jdk/incubator/vector/MaskedLogicOpts.java b/test/micro/org/openjdk/bench/jdk/incubator/vector/MaskedLogicOpts.java index 97922c2f9ee7..eb08aa38b8f4 100644 --- a/test/micro/org/openjdk/bench/jdk/incubator/vector/MaskedLogicOpts.java +++ b/test/micro/org/openjdk/bench/jdk/incubator/vector/MaskedLogicOpts.java @@ -32,7 +32,7 @@ @BenchmarkMode(Mode.Throughput) @OutputTimeUnit(TimeUnit.SECONDS) @State(Scope.Thread) -@Fork(jvmArgsPrepend = {"--add-modules=jdk.incubator.vector"}) +@Fork(jvmArgs = {"--add-modules=jdk.incubator.vector"}) public class MaskedLogicOpts { @Param({"256","512","1024"}) private int ARRAYLEN; diff --git a/test/micro/org/openjdk/bench/jdk/incubator/vector/MemorySegmentVectorAccess.java b/test/micro/org/openjdk/bench/jdk/incubator/vector/MemorySegmentVectorAccess.java index 65b2ccb5165a..703be3d25d48 100644 --- a/test/micro/org/openjdk/bench/jdk/incubator/vector/MemorySegmentVectorAccess.java +++ b/test/micro/org/openjdk/bench/jdk/incubator/vector/MemorySegmentVectorAccess.java @@ -48,7 +48,7 @@ @Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS) @State(org.openjdk.jmh.annotations.Scope.Benchmark) @OutputTimeUnit(TimeUnit.NANOSECONDS) -@Fork(value = 1, jvmArgsAppend = { +@Fork(value = 1, jvmArgs = { "--add-modules=jdk.incubator.vector", "--enable-preview", "--enable-native-access", "ALL-UNNAMED"}) diff --git a/test/micro/org/openjdk/bench/jdk/incubator/vector/RearrangeBytesBenchmark.java b/test/micro/org/openjdk/bench/jdk/incubator/vector/RearrangeBytesBenchmark.java index daa15d41067b..375ae9a03955 100644 --- a/test/micro/org/openjdk/bench/jdk/incubator/vector/RearrangeBytesBenchmark.java +++ b/test/micro/org/openjdk/bench/jdk/incubator/vector/RearrangeBytesBenchmark.java @@ -32,7 +32,7 @@ @OutputTimeUnit(TimeUnit.MILLISECONDS) @State(Scope.Thread) -@Fork(jvmArgsPrepend = {"--add-modules=jdk.incubator.vector"}) +@Fork(jvmArgs = {"--add-modules=jdk.incubator.vector"}) public class RearrangeBytesBenchmark { @Param({"256", "512", "1024"}) int size; diff --git a/test/micro/org/openjdk/bench/jdk/incubator/vector/RotateBenchmark.java b/test/micro/org/openjdk/bench/jdk/incubator/vector/RotateBenchmark.java index 3628479342a4..0ebf844e94b8 100644 --- a/test/micro/org/openjdk/bench/jdk/incubator/vector/RotateBenchmark.java +++ b/test/micro/org/openjdk/bench/jdk/incubator/vector/RotateBenchmark.java @@ -32,7 +32,7 @@ @OutputTimeUnit(TimeUnit.MILLISECONDS) @State(Scope.Thread) -@Fork(jvmArgsPrepend = {"--add-modules=jdk.incubator.vector"}) +@Fork(jvmArgs = {"--add-modules=jdk.incubator.vector"}) public class RotateBenchmark { @Param({"256","512"}) int size; diff --git a/test/micro/org/openjdk/bench/jdk/incubator/vector/StoreMaskTrueCount.java b/test/micro/org/openjdk/bench/jdk/incubator/vector/StoreMaskTrueCount.java index 372edd0cfb52..db9f7cf1028a 100644 --- a/test/micro/org/openjdk/bench/jdk/incubator/vector/StoreMaskTrueCount.java +++ b/test/micro/org/openjdk/bench/jdk/incubator/vector/StoreMaskTrueCount.java @@ -30,7 +30,7 @@ @OutputTimeUnit(TimeUnit.MILLISECONDS) @State(Scope.Thread) -@Fork(jvmArgsPrepend = {"--add-modules=jdk.incubator.vector"}) +@Fork(jvmArgs = {"--add-modules=jdk.incubator.vector"}) public class StoreMaskTrueCount { private static final VectorSpecies S_SPECIES = ShortVector.SPECIES_PREFERRED; private static final VectorSpecies I_SPECIES = IntVector.SPECIES_PREFERRED; diff --git a/test/micro/org/openjdk/bench/jdk/incubator/vector/StoreMaskedBenchmark.java b/test/micro/org/openjdk/bench/jdk/incubator/vector/StoreMaskedBenchmark.java index 9e7796994a35..57de9137b684 100644 --- a/test/micro/org/openjdk/bench/jdk/incubator/vector/StoreMaskedBenchmark.java +++ b/test/micro/org/openjdk/bench/jdk/incubator/vector/StoreMaskedBenchmark.java @@ -32,7 +32,7 @@ @State(Scope.Benchmark) @Warmup(iterations = 3, time = 1) @Measurement(iterations = 5, time = 1) -@Fork(value = 1, jvmArgsPrepend = {"--add-modules=jdk.incubator.vector"}) +@Fork(value = 1, jvmArgs = {"--add-modules=jdk.incubator.vector"}) public class StoreMaskedBenchmark { @Param({"1024"}) private int size; diff --git a/test/micro/org/openjdk/bench/jdk/incubator/vector/StoreMaskedIOOBEBenchmark.java b/test/micro/org/openjdk/bench/jdk/incubator/vector/StoreMaskedIOOBEBenchmark.java index 1794e4f9a242..d61ca560a8b4 100644 --- a/test/micro/org/openjdk/bench/jdk/incubator/vector/StoreMaskedIOOBEBenchmark.java +++ b/test/micro/org/openjdk/bench/jdk/incubator/vector/StoreMaskedIOOBEBenchmark.java @@ -31,7 +31,7 @@ @State(Scope.Benchmark) @Warmup(iterations = 3, time = 1) @Measurement(iterations = 5, time = 1) -@Fork(value = 1, jvmArgsPrepend = {"--add-modules=jdk.incubator.vector"}) +@Fork(value = 1, jvmArgs = {"--add-modules=jdk.incubator.vector"}) public class StoreMaskedIOOBEBenchmark { @Param({"1024"}) private int inSize; diff --git a/test/micro/org/openjdk/bench/jdk/incubator/vector/TestLoadStoreBytes.java b/test/micro/org/openjdk/bench/jdk/incubator/vector/TestLoadStoreBytes.java index 7a42a247b125..d6a4be569074 100644 --- a/test/micro/org/openjdk/bench/jdk/incubator/vector/TestLoadStoreBytes.java +++ b/test/micro/org/openjdk/bench/jdk/incubator/vector/TestLoadStoreBytes.java @@ -47,7 +47,7 @@ @Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS) @State(org.openjdk.jmh.annotations.Scope.Thread) @OutputTimeUnit(TimeUnit.NANOSECONDS) -@Fork(value = 1, jvmArgsAppend = { +@Fork(value = 1, jvmArgs = { "--add-modules=jdk.incubator.vector", "--enable-preview", "--enable-native-access", "ALL-UNNAMED", diff --git a/test/micro/org/openjdk/bench/jdk/incubator/vector/TestLoadStoreShorts.java b/test/micro/org/openjdk/bench/jdk/incubator/vector/TestLoadStoreShorts.java index 2aec829fba8d..19411bbc615c 100644 --- a/test/micro/org/openjdk/bench/jdk/incubator/vector/TestLoadStoreShorts.java +++ b/test/micro/org/openjdk/bench/jdk/incubator/vector/TestLoadStoreShorts.java @@ -50,7 +50,7 @@ @Measurement(iterations = 10, time = 500, timeUnit = TimeUnit.MILLISECONDS) @State(org.openjdk.jmh.annotations.Scope.Thread) @OutputTimeUnit(TimeUnit.NANOSECONDS) -@Fork(value = 1, jvmArgsAppend = { +@Fork(value = 1, jvmArgs = { "--add-modules=jdk.incubator.vector", "--enable-preview", "--enable-native-access", "ALL-UNNAMED"}) diff --git a/test/micro/org/openjdk/bench/jdk/incubator/vector/VectorFPtoIntCastOperations.java b/test/micro/org/openjdk/bench/jdk/incubator/vector/VectorFPtoIntCastOperations.java index 0318971ffef0..a538fb345109 100644 --- a/test/micro/org/openjdk/bench/jdk/incubator/vector/VectorFPtoIntCastOperations.java +++ b/test/micro/org/openjdk/bench/jdk/incubator/vector/VectorFPtoIntCastOperations.java @@ -31,7 +31,7 @@ @OutputTimeUnit(TimeUnit.MILLISECONDS) @State(Scope.Thread) -@Fork(jvmArgsPrepend = {"--add-modules=jdk.incubator.vector"}) +@Fork(jvmArgs = {"--add-modules=jdk.incubator.vector"}) public class VectorFPtoIntCastOperations { @Param({"512", "1024"}) static int SIZE; diff --git a/test/micro/org/openjdk/bench/loom/obsolete/FreezeAndThaw.java b/test/micro/org/openjdk/bench/loom/obsolete/FreezeAndThaw.java deleted file mode 100644 index dd011f2033a3..000000000000 --- a/test/micro/org/openjdk/bench/loom/obsolete/FreezeAndThaw.java +++ /dev/null @@ -1,149 +0,0 @@ -/* - * Copyright (c) 2018, 2022, 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 org.openjdk.bench.loom.obsolete; - -import jdk.internal.vm.Continuation; -import jdk.internal.vm.ContinuationScope; - -import java.util.concurrent.TimeUnit; -import org.openjdk.jmh.annotations.*; - -@BenchmarkMode(Mode.AverageTime) -@OutputTimeUnit(TimeUnit.NANOSECONDS) -@State(Scope.Thread) -@Warmup(iterations = 5, time = 1, timeUnit = TimeUnit.SECONDS) -@Measurement(iterations = 5, time = 1, timeUnit = TimeUnit.SECONDS) -@Fork(1) -public class FreezeAndThaw { - static final ContinuationScope SCOPE = new ContinuationScope() { }; - - static class Arg { - volatile int field; - } - - /** - * A recursive task that optionally yields when the stack gets to a specific - * depth. If continued after yielding, it runs to completion. - */ - static class Yielder implements Runnable { - private final int paramCount; - private final int maxDepth; - private final boolean yieldAtLimit; - - private Yielder(int paramCount, int maxDepth, boolean yieldAtLimit) { - if (paramCount < 1 || paramCount > 3) - throw new IllegalArgumentException(); - this.paramCount = paramCount; - this.maxDepth = maxDepth; - this.yieldAtLimit = yieldAtLimit; - } - - @Override - public void run() { - switch (paramCount) { - case 1: run1(maxDepth); break; - case 2: run2(maxDepth, new Arg()); break; - case 3: run3(maxDepth, new Arg(), new Arg()); break; - default: throw new Error("should not happen"); - } - } - - private void run1(int depth) { - if (depth > 0) { - run1(depth - 1); - } if (depth == 0) { - if (yieldAtLimit) Continuation.yield(SCOPE); - } - } - - private void run2(int depth, Arg arg2) { - if (depth > 0) { - run2(depth - 1, arg2); - } if (depth == 0) { - if (yieldAtLimit) Continuation.yield(SCOPE); - } else { - // never executed - arg2.field = 0; - } - } - - private void run3(int depth, Arg arg2, Arg arg3) { - if (depth > 0) { - run3(depth - 1, arg2, arg3); - } if (depth == 0) { - if (yieldAtLimit) { - Continuation.yield(SCOPE); - } - } else { - // never executed - arg2.field = 0; - arg3.field = 0; - } - } - - static Continuation continuation(int paramCount, int maxDepth, - boolean yieldAtLimit) { - Runnable task = new Yielder(paramCount, maxDepth, yieldAtLimit); - return new Continuation(SCOPE, task); - } - } - - @Param({"1", "2", "3"}) - public int paramCount; - - @Param({"5", "10", "20", "100"}) - public int stackDepth; - - Continuation cont; - Continuation cont0; - - @Setup(Level.Invocation) - public void setup() { - // System.out.println("pc = " + paramCount + " sd = " + stackDepth); - cont = Yielder.continuation(paramCount, stackDepth, true); - cont0 = Yielder.continuation(paramCount, stackDepth, false); - } - - /** - * Creates and runs a continuation that yields at a given stack depth. - */ - @Benchmark - public void baseline() { - // Continuation cont0 = Yielder.continuation(paramCount, stackDepth, false); - cont0.run(); - assert cont0.isDone(); - } - - /** - * Creates and runs a continuation that yields at a given stack depth. - */ - @Benchmark - public void yieldAndContinue() { - // Continuation cont = Yielder.continuation(paramCount, stackDepth, true); - cont.run(); - assert !cont.isDone(); - cont.run(); - assert cont.isDone(); - } -} diff --git a/test/micro/org/openjdk/bench/loom/obsolete/OneShot.java b/test/micro/org/openjdk/bench/loom/obsolete/OneShot.java deleted file mode 100644 index bd96153315bc..000000000000 --- a/test/micro/org/openjdk/bench/loom/obsolete/OneShot.java +++ /dev/null @@ -1,252 +0,0 @@ -/* - * Copyright (c) 2018, 2022, 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 org.openjdk.bench.loom.obsolete; - -import jdk.internal.vm.Continuation; -import jdk.internal.vm.ContinuationScope; - -import java.util.concurrent.TimeUnit; -import org.openjdk.jmh.annotations.*; - -@BenchmarkMode(Mode.AverageTime) -@OutputTimeUnit(TimeUnit.NANOSECONDS) -@State(Scope.Thread) -@Warmup(iterations = 5, time = 1, timeUnit = TimeUnit.SECONDS) -@Measurement(iterations = 5, time = 1, timeUnit = TimeUnit.SECONDS) -@Fork(1) -public class OneShot { - static final ContinuationScope SCOPE = new ContinuationScope() { }; - - static class Arg { - volatile int field; - } - - /** - * A recursive task that optionally yields when the stack gets to a specific - * depth. If continued after yielding, it runs to completion. - */ - static class Yielder implements Runnable { - private final int paramCount; - private final int maxDepth; - private final boolean yieldAtLimit; - - private Yielder(int paramCount, int maxDepth, boolean yieldAtLimit) { - if (paramCount < 1 || paramCount > 3) - throw new IllegalArgumentException(); - this.paramCount = paramCount; - this.maxDepth = maxDepth; - this.yieldAtLimit = yieldAtLimit; - } - - @Override - public void run() { - switch (paramCount) { - case 1: run1(maxDepth); break; - case 2: run2(maxDepth, new Arg()); break; - case 3: run3(maxDepth, new Arg(), new Arg()); break; - default: throw new Error("should not happen"); - } - } - - private void run1(int depth) { - if (depth > 0) { - run1(depth - 1); - } if (depth == 0) { - if (yieldAtLimit) Continuation.yield(SCOPE); - } - } - - private void run2(int depth, Arg arg2) { - if (depth > 0) { - run2(depth - 1, arg2); - } if (depth == 0) { - if (yieldAtLimit) Continuation.yield(SCOPE); - } else { - // never executed - arg2.field = 0; - } - } - - private void run3(int depth, Arg arg2, Arg arg3) { - if (depth > 0) { - run3(depth - 1, arg2, arg3); - } if (depth == 0) { - if (yieldAtLimit) Continuation.yield(SCOPE); - } else { - // never executed - arg2.field = 0; - arg3.field = 0; - } - } - - static Continuation continuation(int paramCount, int maxDepth, - boolean yieldAtLimit) { - Runnable task = new Yielder(paramCount, maxDepth, yieldAtLimit); - return new Continuation(SCOPE, task); - } - } - - /** - * A recursive task that optionally yields before and/or after each call. - */ - static class Stepper implements Runnable { - private final int paramCount; - private final int maxDepth; - private final boolean yieldBefore; - private final boolean yieldAfter; - - private Stepper(int paramCount, - int maxDepth, - boolean yieldBefore, - boolean yieldAfter) { - this.paramCount = paramCount; - this.maxDepth = maxDepth; - this.yieldBefore = yieldBefore; - this.yieldAfter = yieldAfter; - } - - public void run() { - switch (paramCount) { - case 1: run1(maxDepth); break; - case 2: run2(maxDepth, new Arg()); break; - case 3: run3(maxDepth, new Arg(), new Arg()); break; - default: throw new Error("should not happen"); - } - } - - private void run1(int depth) { - if (depth > 0) { - if (yieldBefore) Continuation.yield(SCOPE); - run1(depth - 1); - if (yieldAfter) Continuation.yield(SCOPE); - } - } - - private void run2(int depth, Arg arg2) { - if (depth > 0) { - if (yieldBefore) Continuation.yield(SCOPE); - run2(depth - 1, arg2); - if (yieldAfter) Continuation.yield(SCOPE); - } else if (depth < 0) { - // never executed - arg2.field = 0; - } - } - - private void run3(int depth, Arg arg2, Arg arg3) { - if (depth > 0) { - if (yieldBefore) Continuation.yield(SCOPE); - run3(depth - 1, arg2, arg3); - if (yieldAfter) Continuation.yield(SCOPE); - } else if (depth < 0) { - // never executed - arg2.field = 0; - arg3.field = 0; - } - } - - static Continuation continuation(int paramCount, int maxDepth, - boolean yieldBefore, boolean yieldAfter) { - Runnable task = new Stepper(paramCount, maxDepth, yieldBefore, yieldAfter); - return new Continuation(SCOPE, task); - } - } - - @Param({"1", "2", "3"}) - public int paramCount; - - @Param({"5", "10", "20", "100"}) - public int stackDepth; - - /** - * Creates and run continuation that does not yield. - */ - @Benchmark - public void noYield() { - Continuation cont = Yielder.continuation(paramCount, stackDepth, false); - cont.run(); - if (!cont.isDone()) - throw new RuntimeException("continuation not done???"); - } - - /** - * Creates and runs a continuation that yields at a given stack depth. - */ - @Benchmark - public void yield() { - Continuation cont = Yielder.continuation(paramCount, stackDepth, true); - cont.run(); - if (cont.isDone()) - throw new RuntimeException("continuation done???"); - } - - /** - * Creates and runs a continuation that yields at a given stack depth, it is - * then continued to run to completion. - */ - @Benchmark - public void yieldThenContinue() { - Continuation cont = Yielder.continuation(paramCount, stackDepth, true); - cont.run(); - cont.run(); // continue - if (!cont.isDone()) - throw new RuntimeException("continuation not done???"); - } - - /** - * Creates and runs a continuation to the given stack depth, yielding before - * each call. - */ - @Benchmark - public void yieldBeforeEachCall() { - Continuation cont = Stepper.continuation(paramCount, stackDepth, true, false); - while (!cont.isDone()) { - cont.run(); - } - } - - /** - * Creates and runs a continuation to the given stack depth, yielding after - * each call. - */ - @Benchmark - public void yieldAfterEachCall() { - Continuation cont = Stepper.continuation(paramCount, stackDepth, false, true); - while (!cont.isDone()) { - cont.run(); - } - } - - /** - * Creates and runs a continuation to the given stack depth, yielding before - * and after each call. - */ - @Benchmark - public void yieldBeforeAndAfterEachCall() { - Continuation cont = Stepper.continuation(paramCount, stackDepth, true, true); - while (!cont.isDone()) { - cont.run(); - } - } -} diff --git a/test/micro/org/openjdk/bench/loom/obsolete/Oscillation.java b/test/micro/org/openjdk/bench/loom/obsolete/Oscillation.java deleted file mode 100644 index 0117508bd8dd..000000000000 --- a/test/micro/org/openjdk/bench/loom/obsolete/Oscillation.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * Copyright (c) 2018, 2022, 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 org.openjdk.bench.loom.obsolete; - -import jdk.internal.vm.Continuation; -import jdk.internal.vm.ContinuationScope; - -import java.util.concurrent.TimeUnit; -import org.openjdk.jmh.annotations.*; - -@BenchmarkMode(Mode.AverageTime) -@OutputTimeUnit(TimeUnit.NANOSECONDS) -@State(Scope.Benchmark) -@Warmup(iterations = 5, time = 1, timeUnit = TimeUnit.SECONDS) -@Measurement(iterations = 5, time = 1, timeUnit = TimeUnit.SECONDS) -@Fork(1) -public class Oscillation { - static final ContinuationScope SCOPE = new ContinuationScope() { }; - - /** - * A task that oscillates between a minimum and maximum stack depth, yielding - * at the maximum stack until continued. - */ - static class Wave implements Runnable { - private final int min; - private final int max; - - private enum Mode { GROW, SHRINK } - private Mode mode; - - Wave(int min, int max) { - if (min < 0) - throw new IllegalArgumentException("negative min"); - if (max <= min) - throw new IllegalArgumentException("max must be greater than min"); - this.min = min; - this.max = max; - this.mode = Mode.GROW; - } - - private void run(int depth) { - if (depth == max) { - Continuation.yield(SCOPE); - mode = Mode.SHRINK; - } else if (depth == min) { - while (true) { - mode = Mode.GROW; - run(depth + 1); - } - } else if (mode == Mode.GROW) { - run(depth + 1); - } - } - - @Override - public void run() { - run(0); - } - } - - @Param({"2", "3", "4"}) - public int minDepth; - - @Param({"5", "6", "7", "8"}) - public int maxDepth; - - @Param({"10", "100", "1000"}) - public int repeat; - - /** - * Creates and runs a continuation that oscillates between a minimum and - * maximum stack depth, yielding at the maximum stack until continued. - * - * Useful to measure freeze and thaw, also to compare full stack vs. lazy copy. - */ - @Benchmark - public void oscillate() { - Continuation cont = new Continuation(SCOPE, new Wave(minDepth, maxDepth)); - for (int i=0; i getSuper(int idx) { + int i = Math.abs(idx) % 10; + switch (i) { + case 0: return I01.class; + case 1: return I02.class; + case 2: return I03.class; + case 3: return I04.class; + case 4: return I05.class; + case 5: return I06.class; + case 6: return I07.class; + case 7: return I08.class; + case 8: return I09.class; + case 9: return I10.class; + } + throw new InternalError("" + i); + } + + @Setup + public void warmup() { + for (int i = 0; i < 20_000; i++) { + Class s = getSuper(i); + test(obj01, s, s.isInstance(obj01)); + test(obj02, s, s.isInstance(obj02)); + test(obj03, s, s.isInstance(obj03)); + test(obj04, s, s.isInstance(obj04)); + test(obj05, s, s.isInstance(obj05)); + test(obj06, s, s.isInstance(obj06)); + test(obj07, s, s.isInstance(obj07)); + test(obj08, s, s.isInstance(obj08)); + test(obj09, s, s.isInstance(obj09)); + } + } + + private static void test(Object obj, Class cls, boolean expected) { + if (cls.isInstance(obj) != expected) { + throw new InternalError(obj.getClass() + " " + cls + " " + expected); + } + } + @Benchmark + public void testPositive01() { + test(obj01, I01.class, true); + } + @Benchmark public void testPositive02() { + test(obj02, I02.class, true); + } + @Benchmark public void testPositive03() { + test(obj03, I03.class, true); + } + @Benchmark public void testPositive04() { + test(obj04, I04.class, true); + } + @Benchmark public void testPositive05() { + test(obj05, I05.class, true); + } + @Benchmark public void testPositive06() { + test(obj06, I06.class, true); + } + @Benchmark public void testPositive07() { + test(obj07, I07.class, true); + } + @Benchmark public void testPositive08() { + test(obj08, I08.class, true); + } + @Benchmark public void testPositive09() { + test(obj09, I09.class, true); + } + @Benchmark public void testPositive10() { + test(obj10, I10.class, true); + } + @Benchmark public void testPositive16() { + test(obj16, I16.class, true); + } + @Benchmark public void testPositive20() { + test(obj20, I20.class, true); + } + @Benchmark public void testPositive30() { + test(obj30, I30.class, true); + } + @Benchmark public void testPositive32() { + test(obj32, I32.class, true); + } + @Benchmark public void testPositive40() { + test(obj40, I40.class, true); + } + @Benchmark public void testPositive50() { + test(obj50, I50.class, true); + } + @Benchmark public void testPositive60() { + test(obj60, I60.class, true); + } + @Benchmark public void testPositive63() { + test(obj63, I63.class, true); + } + @Benchmark public void testPositive64() { + test(obj64, I64.class, true); + } + + @Benchmark public void testNegative00() { + test(obj00, J.class, false); + } + @Benchmark public void testNegative01() { + test(obj01, J.class, false); + } + @Benchmark public void testNegative02() { + test(obj02, J.class, false); + } + @Benchmark public void testNegative03() { + test(obj03, J.class, false); + } + @Benchmark public void testNegative04() { + test(obj04, J.class, false); + } + @Benchmark public void testNegative05() { + test(obj05, J.class, false); + } + @Benchmark public void testNegative06() { + test(obj06, J.class, false); + } + @Benchmark public void testNegative07() { + test(obj07, J.class, false); + } + @Benchmark public void testNegative08() { + test(obj08, J.class, false); + } + @Benchmark public void testNegative09() { + test(obj09, J.class, false); + } + @Benchmark public void testNegative10() { + test(obj10, J.class, false); + } + @Benchmark public void testNegative16() { + test(obj16, J.class, false); + } + @Benchmark public void testNegative20() { + test(obj20, J.class, false); + } + @Benchmark public void testNegative30() { + test(obj30, J.class, false); + } + @Benchmark public void testNegative32() { + test(obj32, J.class, false); + } + @Benchmark public void testNegative40() { + test(obj40, J.class, false); + } + @Benchmark public void testNegative50() { + test(obj50, J.class, false); + } + @Benchmark public void testNegative55() { + test(obj55, J.class, false); + } + @Benchmark public void testNegative56() { + test(obj56, J.class, false); + } + @Benchmark public void testNegative57() { + test(obj57, J.class, false); + } + @Benchmark public void testNegative58() { + test(obj58, J.class, false); + } + @Benchmark public void testNegative59() { + test(obj59, J.class, false); + } + @Benchmark public void testNegative60() { + test(obj60, J.class, false); + } + @Benchmark public void testNegative61() { + test(obj61, J.class, false); + } + @Benchmark public void testNegative62() { + test(obj62, J.class, false); + } + @Benchmark public void testNegative63() { + test(obj63, J.class, false); + } + + @Benchmark public void testNegative64() { + test(obj64, J.class, false); + } +}