From 3cd65ce2a492726cf1c30bf0c4bfaf0980323fab Mon Sep 17 00:00:00 2001 From: Sergey Bylokhov Date: Wed, 6 Dec 2023 00:19:28 +0000 Subject: [PATCH] 8321325: Remove unused Java_java_awt_MenuComponent_initIDs function Reviewed-by: prr, aivanov --- .../macosx/native/libawt_lwawt/awt/InitIDs.m | 5 --- .../share/classes/java/awt/MenuComponent.java | 16 +-------- .../libawt_xawt/awt/awt_MenuComponent.h | 36 ------------------- .../unix/native/libawt_xawt/xawt/XToolkit.c | 10 ------ .../native/libawt/windows/awt_MenuItem.cpp | 14 -------- .../native/libawt/windows/awt_MenuItem.h | 1 - 6 files changed, 1 insertion(+), 81 deletions(-) delete mode 100644 src/java.desktop/unix/native/libawt_xawt/awt/awt_MenuComponent.h diff --git a/src/java.desktop/macosx/native/libawt_lwawt/awt/InitIDs.m b/src/java.desktop/macosx/native/libawt_lwawt/awt/InitIDs.m index 38d453ff835..289e63ba98c 100644 --- a/src/java.desktop/macosx/native/libawt_lwawt/awt/InitIDs.m +++ b/src/java.desktop/macosx/native/libawt_lwawt/awt/InitIDs.m @@ -112,11 +112,6 @@ JNIEXPORT void JNICALL Java_java_awt_MenuBar_initIDs { } -JNIEXPORT void JNICALL Java_java_awt_MenuComponent_initIDs -(JNIEnv *env, jclass cls) -{ -} - JNIEXPORT void JNICALL Java_java_awt_MenuItem_initIDs (JNIEnv *env, jclass cls) { diff --git a/src/java.desktop/share/classes/java/awt/MenuComponent.java b/src/java.desktop/share/classes/java/awt/MenuComponent.java index a9b9be85564..b2bc22c2e93 100644 --- a/src/java.desktop/share/classes/java/awt/MenuComponent.java +++ b/src/java.desktop/share/classes/java/awt/MenuComponent.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 2022, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1995, 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 @@ -59,14 +59,6 @@ import sun.awt.ComponentFactory; */ public abstract class MenuComponent implements java.io.Serializable { - static { - /* ensure that the necessary native libraries are loaded */ - Toolkit.loadLibraries(); - if (!GraphicsEnvironment.isHeadless()) { - initIDs(); - } - } - transient volatile MenuComponentPeer peer; transient volatile MenuContainer parent; @@ -464,12 +456,6 @@ public abstract class MenuComponent implements java.io.Serializable { appContext = AppContext.getAppContext(); } - /** - * Initialize JNI field and method IDs. - */ - private static native void initIDs(); - - /* * --- Accessibility Support --- */ diff --git a/src/java.desktop/unix/native/libawt_xawt/awt/awt_MenuComponent.h b/src/java.desktop/unix/native/libawt_xawt/awt/awt_MenuComponent.h deleted file mode 100644 index 19dd1f590cb..00000000000 --- a/src/java.desktop/unix/native/libawt_xawt/awt/awt_MenuComponent.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 1998, 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. 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. - */ - -#ifdef HEADLESS - #error This file should not be included in headless library -#endif - -#include "jni_util.h" - -struct MenuComponentIDs { - jfieldID font; - jfieldID appContext; - jmethodID getParent; -}; diff --git a/src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c b/src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c index 4e69c2a1c66..abe3a1c54ce 100644 --- a/src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c +++ b/src/java.desktop/unix/native/libawt_xawt/xawt/XToolkit.c @@ -39,7 +39,6 @@ #include "awt_p.h" #include "awt_Component.h" -#include "awt_MenuComponent.h" #include "awt_util.h" #include "sun_awt_X11_XToolkit.h" @@ -72,8 +71,6 @@ static int tracing = 0; struct ComponentIDs componentIDs; -struct MenuComponentIDs menuComponentIDs; - extern Display* awt_init_Display(JNIEnv *env, jobject this); extern void freeNativeStringArray(char **array, jsize length); extern char** stringArrayToNative(JNIEnv *env, jobjectArray array, jsize * ret_length); @@ -236,13 +233,6 @@ Java_java_awt_Frame_initIDs } -JNIEXPORT void JNICALL -Java_java_awt_MenuComponent_initIDs(JNIEnv *env, jclass cls) -{ - menuComponentIDs.appContext = - (*env)->GetFieldID(env, cls, "appContext", "Lsun/awt/AppContext;"); -} - JNIEXPORT void JNICALL Java_java_awt_Cursor_initIDs(JNIEnv *env, jclass cls) { diff --git a/src/java.desktop/windows/native/libawt/windows/awt_MenuItem.cpp b/src/java.desktop/windows/native/libawt/windows/awt_MenuItem.cpp index 72f5a70a8e0..ace140593f6 100644 --- a/src/java.desktop/windows/native/libawt/windows/awt_MenuItem.cpp +++ b/src/java.desktop/windows/native/libawt/windows/awt_MenuItem.cpp @@ -892,20 +892,6 @@ BOOL AwtMenuItem::IsSeparator() { return isSeparator; } -/************************************************************************ - * MenuComponent native methods - */ - -extern "C" { - -JNIEXPORT void JNICALL -Java_java_awt_MenuComponent_initIDs(JNIEnv *env, jclass cls) -{ -} - -} /* extern "C" */ - - /************************************************************************ * MenuItem native methods */ diff --git a/src/java.desktop/windows/native/libawt/windows/awt_MenuItem.h b/src/java.desktop/windows/native/libawt/windows/awt_MenuItem.h index 15c71357f7f..448c397c9b8 100644 --- a/src/java.desktop/windows/native/libawt/windows/awt_MenuItem.h +++ b/src/java.desktop/windows/native/libawt/windows/awt_MenuItem.h @@ -33,7 +33,6 @@ #include #include #include -#include #include class AwtMenu;