diff --git a/src/hotspot/share/oops/compressedKlass.hpp b/src/hotspot/share/oops/compressedKlass.hpp index f0615283f33..dd54c8130eb 100644 --- a/src/hotspot/share/oops/compressedKlass.hpp +++ b/src/hotspot/share/oops/compressedKlass.hpp @@ -258,9 +258,15 @@ class CompressedKlassPointers : public AllStatic { is_aligned(addr, klass_alignment_in_bytes()); } - // Check that with the given base, shift and range, aarch64 an encode and decode the klass pointer. - static bool check_klass_decode_mode(address base, int shift, const size_t range) NOT_AARCH64({ return true;}); - static bool set_klass_decode_mode() NOT_AARCH64({ return true;}); // can be called after initialization +#if defined(AARCH64) && !defined(ZERO) + // Check that with the given base, shift and range, aarch64 code can encode and decode the klass pointer. + static bool check_klass_decode_mode(address base, int shift, const size_t range); + // Called after initialization. + static bool set_klass_decode_mode(); +#else + static bool check_klass_decode_mode(address base, int shift, const size_t range) { return true; } + static bool set_klass_decode_mode() { return true; } +#endif }; #endif // SHARE_OOPS_COMPRESSEDKLASS_HPP diff --git a/src/java.base/share/classes/java/lang/classfile/CompoundElement.java b/src/java.base/share/classes/java/lang/classfile/CompoundElement.java index 38d149623e1..d9f9fe1e5f9 100644 --- a/src/java.base/share/classes/java/lang/classfile/CompoundElement.java +++ b/src/java.base/share/classes/java/lang/classfile/CompoundElement.java @@ -34,6 +34,8 @@ import java.util.stream.Stream; import java.util.stream.StreamSupport; +import jdk.internal.classfile.components.ClassPrinter; + /** * A {@link ClassFileElement} that has complex structure defined in terms of * other classfile elements, such as a method, field, method body, or entire @@ -92,4 +94,14 @@ public void accept(E e) { return Collections.unmodifiableList(list); } + /** + * {@return a text representation of the compound element and its contents for debugging purposes} + * + * The format, structure and exact contents of the returned string are not specified and may change at any time in the future. + */ + default String toDebugString() { + StringBuilder text = new StringBuilder(); + ClassPrinter.toYaml(this, ClassPrinter.Verbosity.TRACE_ALL, text::append); + return text.toString(); + } } diff --git a/src/java.base/share/classes/java/util/ResourceBundle.java b/src/java.base/share/classes/java/util/ResourceBundle.java index 989cc09f388..4206dda6a3a 100644 --- a/src/java.base/share/classes/java/util/ResourceBundle.java +++ b/src/java.base/share/classes/java/util/ResourceBundle.java @@ -3654,8 +3654,7 @@ private static String toPackageName(String bundleName) { } - private static final boolean TRACE_ON = Boolean.getBoolean( - System.getProperty("resource.bundle.debug", "false")); + private static final boolean TRACE_ON = Boolean.getBoolean("resource.bundle.debug"); private static void trace(String format, Object... params) { if (TRACE_ON) diff --git a/test/jdk/jdk/classfile/ClassPrinterTest.java b/test/jdk/jdk/classfile/ClassPrinterTest.java index 5dc136f59c3..506f3382b83 100644 --- a/test/jdk/jdk/classfile/ClassPrinterTest.java +++ b/test/jdk/jdk/classfile/ClassPrinterTest.java @@ -23,7 +23,7 @@ /* * @test - * @bug 8335927 + * @bug 8335927 8345773 * @summary Testing ClassFile ClassPrinter. * @run junit ClassPrinterTest */ @@ -122,8 +122,7 @@ ClassModel getClassModel() { @Test void testPrintYamlTraceAll() throws IOException { - var out = new StringBuilder(); - ClassPrinter.toYaml(getClassModel(), ClassPrinter.Verbosity.TRACE_ALL, out::append); + var out = getClassModel().toDebugString(); assertOut(out, """ - class name: Foo @@ -904,7 +903,7 @@ void testWalkMembersOnly() throws IOException { assertEquals(node.walk().count(), 42); } - private static void assertOut(StringBuilder out, String expected) { + private static void assertOut(CharSequence out, String expected) { // System.out.println("-----------------"); // System.out.println(out.toString()); // System.out.println("-----------------");