From e8aaa9e59cd35ae6225c065cfea7af834db5fdef Mon Sep 17 00:00:00 2001 From: Coleen Phillimore Date: Wed, 24 Jun 2026 17:37:11 +0000 Subject: [PATCH] 8387214: TraceJavaAssertions is unused Reviewed-by: jsjolen, shade --- .../share/classfile/javaAssertions.cpp | 20 +------------------ .../share/classfile/javaAssertions.hpp | 9 +-------- src/hotspot/share/runtime/globals.hpp | 3 --- 3 files changed, 2 insertions(+), 30 deletions(-) diff --git a/src/hotspot/share/classfile/javaAssertions.cpp b/src/hotspot/share/classfile/javaAssertions.cpp index 2a8f94d81b9..d2781e6e5e1 100644 --- a/src/hotspot/share/classfile/javaAssertions.cpp +++ b/src/hotspot/share/classfile/javaAssertions.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2025, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2026, Oracle and/or its affiliates. All rights reserved. * 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,13 +83,6 @@ void JavaAssertions::addOption(const char* name, bool enable) { if (name_copy[i] == JVM_SIGNATURE_DOT) name_copy[i] = JVM_SIGNATURE_SLASH; } - if (TraceJavaAssertions) { - tty->print_cr("JavaAssertions: adding %s %s=%d", - head == &_classes ? "class" : "package", - name_copy[0] != '\0' ? name_copy : "'default'", - enable); - } - // Prepend a new item to the list. Items added later take precedence, so // prepending allows us to stop searching the list after the first match. *head = new OptionList(name_copy, enable, *head); @@ -183,14 +176,6 @@ JavaAssertions::match_package(const char* classname) { return nullptr; } -inline void JavaAssertions::trace(const char* name, -const char* typefound, const char* namefound, bool enabled) { - if (TraceJavaAssertions) { - tty->print_cr("JavaAssertions: search for %s found %s %s=%d", - name, typefound, namefound[0] != '\0' ? namefound : "'default'", enabled); - } -} - bool JavaAssertions::enabled(const char* classname, bool systemClass) { assert(classname != nullptr, "must have a classname"); @@ -201,18 +186,15 @@ bool JavaAssertions::enabled(const char* classname, bool systemClass) { // First check options that apply to classes. If we find a match we're done. OptionList* p; if ((p = match_class(classname))) { - trace(classname, "class", p->name(), p->enabled()); return p->enabled(); } // Now check packages, from most specific to least. if ((p = match_package(classname))) { - trace(classname, "package", p->name(), p->enabled()); return p->enabled(); } // No match. Return the default status. bool result = systemClass ? systemClassDefault() : userClassDefault(); - trace(classname, systemClass ? "system" : "user", "default", result); return result; } diff --git a/src/hotspot/share/classfile/javaAssertions.hpp b/src/hotspot/share/classfile/javaAssertions.hpp index 58d03eacd48..3477e79c3c5 100644 --- a/src/hotspot/share/classfile/javaAssertions.hpp +++ b/src/hotspot/share/classfile/javaAssertions.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2026, Oracle and/or its affiliates. All rights reserved. * 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,9 +57,6 @@ private: static void fillJavaArrays(const OptionList* p, int len, objArrayHandle names, typeArrayHandle status, TRAPS); - static inline void trace(const char* name, const char* typefound, - const char* namefound, bool enabled); - static inline OptionList* match_class(const char* classname); static OptionList* match_package(const char* classname); @@ -90,8 +87,6 @@ inline bool JavaAssertions::userClassDefault() { } inline void JavaAssertions::setUserClassDefault(bool enabled) { - if (TraceJavaAssertions) - tty->print_cr("JavaAssertions::setUserClassDefault(%d)", enabled); _userDefault = enabled; } @@ -100,8 +95,6 @@ inline bool JavaAssertions::systemClassDefault() { } inline void JavaAssertions::setSystemClassDefault(bool enabled) { - if (TraceJavaAssertions) - tty->print_cr("JavaAssertions::setSystemClassDefault(%d)", enabled); _sysDefault = enabled; } diff --git a/src/hotspot/share/runtime/globals.hpp b/src/hotspot/share/runtime/globals.hpp index dd89a3847c7..cd34d874a3c 100644 --- a/src/hotspot/share/runtime/globals.hpp +++ b/src/hotspot/share/runtime/globals.hpp @@ -461,9 +461,6 @@ const int ObjectAlignmentInBytes = 8; develop(bool, VerifyStackAtCalls, false, \ "Verify that the stack pointer is unchanged after calls") \ \ - develop(bool, TraceJavaAssertions, false, \ - "Trace java language assertions") \ - \ develop(bool, VerifyCodeCache, false, \ "Verify code cache on memory allocation/deallocation") \ \