8318091: Remove empty initIDs functions

Reviewed-by: prr, aivanov
This commit is contained in:
Daniel Jeliński 2023-10-27 16:09:27 +00:00
parent 4f9f1955ab
commit c593f8bf59
17 changed files with 16 additions and 361 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2011, 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
@ -32,11 +32,6 @@ JNIEXPORT void JNICALL Java_java_awt_AWTEvent_initIDs
{
}
JNIEXPORT void JNICALL Java_java_awt_Button_initIDs
(JNIEnv *env, jclass cls)
{
}
JNIEXPORT void JNICALL Java_java_awt_Checkbox_initIDs
(JNIEnv *env, jclass cls)
{
@ -52,11 +47,6 @@ JNIEXPORT void JNICALL Java_java_awt_Choice_initIDs
{
}
JNIEXPORT void JNICALL Java_java_awt_Color_initIDs
(JNIEnv *env, jclass cls)
{
}
JNIEXPORT void JNICALL Java_java_awt_Component_initIDs
(JNIEnv *env, jclass cls)
{
@ -87,11 +77,6 @@ JNIEXPORT void JNICALL Java_java_awt_Event_initIDs
{
}
JNIEXPORT void JNICALL Java_java_awt_FileDialog_initIDs
(JNIEnv *env, jclass cls)
{
}
JNIEXPORT void JNICALL Java_java_awt_Font_initIDs
(JNIEnv *env, jclass cls)
{
@ -112,11 +97,6 @@ JNIEXPORT void JNICALL Java_java_awt_Insets_initIDs
{
}
JNIEXPORT void JNICALL Java_java_awt_KeyboardFocusManager_initIDs
(JNIEnv *env, jclass cls)
{
}
JNIEXPORT void JNICALL Java_java_awt_Label_initIDs
(JNIEnv *env, jclass cls)
{
@ -142,11 +122,6 @@ JNIEXPORT void JNICALL Java_java_awt_MenuItem_initIDs
{
}
JNIEXPORT void JNICALL Java_java_awt_Rectangle_initIDs
(JNIEnv *env, jclass cls)
{
}
JNIEXPORT void JNICALL Java_java_awt_ScrollPane_initIDs
(JNIEnv *env, jclass cls)
{
@ -167,11 +142,6 @@ JNIEXPORT void JNICALL Java_java_awt_TextArea_initIDs
{
}
JNIEXPORT void JNICALL Java_java_awt_TextField_initIDs
(JNIEnv *env, jclass cls)
{
}
JNIEXPORT void JNICALL Java_java_awt_Toolkit_initIDs
(JNIEnv *env, jclass cls)
{

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2021, 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
@ -122,21 +122,6 @@ public class Button extends Component implements Accessible {
@Serial
private static final long serialVersionUID = -8774683716313001058L;
static {
/* ensure that the necessary native libraries are loaded */
Toolkit.loadLibraries();
if (!GraphicsEnvironment.isHeadless()) {
initIDs();
}
}
/**
* Initialize JNI field and method IDs for fields that may be
* accessed from C.
*/
private static native void initIDs();
/**
* Constructs a button with an empty string for its label.
*

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2021, 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
@ -260,26 +260,6 @@ public class Color implements Paint, java.io.Serializable {
@Serial
private static final long serialVersionUID = 118526816881161077L;
/**
* Initialize JNI field and method IDs
*/
private static native void initIDs();
static {
/** 4112352 - Calling getDefaultToolkit()
** here can cause this class to be accessed before it is fully
** initialized. DON'T DO IT!!!
**
** Toolkit.getDefaultToolkit();
**/
/* ensure that the necessary native libraries are loaded */
Toolkit.loadLibraries();
if (!GraphicsEnvironment.isHeadless()) {
initIDs();
}
}
/**
* Checks the color integer components supplied for validity.
* Throws an {@link IllegalArgumentException} if the value is out of

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2021, 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
@ -31,6 +31,7 @@ import java.io.FilenameFilter;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.Serial;
import java.lang.annotation.Native;
import sun.awt.AWTAccessor;
@ -55,12 +56,14 @@ public class FileDialog extends Dialog {
* This constant value indicates that the purpose of the file
* dialog window is to locate a file from which to read.
*/
@Native
public static final int LOAD = 0;
/**
* This constant value indicates that the purpose of the file
* dialog window is to locate a file to which to write.
*/
@Native
public static final int SAVE = 1;
/**
@ -140,15 +143,6 @@ public class FileDialog extends Dialog {
@Serial
private static final long serialVersionUID = 5035145889651310422L;
static {
/* ensure that the necessary native libraries are loaded */
Toolkit.loadLibraries();
if (!GraphicsEnvironment.isHeadless()) {
initIDs();
}
}
static {
AWTAccessor.setFileDialogAccessor(
new AWTAccessor.FileDialogAccessor() {
@ -169,12 +163,6 @@ public class FileDialog extends Dialog {
});
}
/**
* Initialize JNI field and method IDs for fields that may be
accessed from C.
*/
private static native void initIDs();
/**
* Creates a file dialog for loading a file. The title of the
* file dialog is initially empty. This is a convenience method for

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2022, 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
@ -109,11 +109,6 @@ public abstract class KeyboardFocusManager
private static final PlatformLogger focusLog = PlatformLogger.getLogger("java.awt.focus.KeyboardFocusManager");
static {
/* ensure that the necessary native libraries are loaded */
Toolkit.loadLibraries();
if (!GraphicsEnvironment.isHeadless()) {
initIDs();
}
AWTAccessor.setKeyboardFocusManagerAccessor(
new AWTAccessor.KeyboardFocusManagerAccessor() {
public int shouldNativelyFocusHeavyweight(Component heavyweight,
@ -157,11 +152,6 @@ public abstract class KeyboardFocusManager
transient KeyboardFocusManagerPeer peer;
/**
* Initialize JNI field and method IDs
*/
private static native void initIDs();
private static final PlatformLogger log = PlatformLogger.getLogger("java.awt.KeyboardFocusManager");
/**

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2021, 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
@ -165,19 +165,6 @@ public class Rectangle extends Rectangle2D
@Serial
private static final long serialVersionUID = -4345857070255674764L;
/**
* Initialize JNI field and method IDs
*/
private static native void initIDs();
static {
/* ensure that the necessary native libraries are loaded */
Toolkit.loadLibraries();
if (!GraphicsEnvironment.isHeadless()) {
initIDs();
}
}
/**
* Constructs a new {@code Rectangle} whose upper-left corner
* is at (0, 0) in the coordinate space, and whose width and

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1995, 2021, 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
@ -137,19 +137,6 @@ public non-sealed class TextField extends TextComponent {
@Serial
private static final long serialVersionUID = -2966288784432217853L;
/**
* Initialize JNI field and method ids
*/
private static native void initIDs();
static {
/* ensure that the necessary native libraries are loaded */
Toolkit.loadLibraries();
if (!GraphicsEnvironment.isHeadless()) {
initIDs();
}
}
/**
* Constructs a new text field.
* @throws HeadlessException if GraphicsEnvironment.isHeadless()

View File

@ -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
@ -39,7 +39,6 @@
#include <X11/Xutil.h>
#endif /* !HEADLESS */
#include "awt_p.h"
#include "java_awt_Color.h"
#include "java_awt_SystemColor.h"
#include "java_awt_color_ColorSpace.h"
#include "java_awt_Transparency.h"

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 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,12 +23,10 @@
* questions.
*/
#include "java_awt_Color.h"
#include "java_awt_Dimension.h"
#include "java_awt_MenuBar.h"
#include "java_awt_FontMetrics.h"
#include "java_awt_event_MouseEvent.h"
#include "java_awt_Rectangle.h"
#include "java_awt_ScrollPaneAdjustable.h"
#include "java_awt_Toolkit.h"
#include "java_awt_CheckboxMenuItem.h"
@ -40,12 +38,6 @@
* which are used in the win32 awt.
*/
JNIEXPORT void JNICALL
Java_java_awt_Color_initIDs
(JNIEnv *env, jclass clazz)
{
}
JNIEXPORT void JNICALL
Java_java_awt_MenuBar_initIDs
(JNIEnv *env, jclass clazz)
@ -94,12 +86,6 @@ Java_java_awt_Dimension_initIDs
{
}
JNIEXPORT void JNICALL
Java_java_awt_Rectangle_initIDs
(JNIEnv *env, jclass clazz)
{
}
JNIEXPORT void JNICALL
Java_java_awt_event_MouseEvent_initIDs
(JNIEnv *env, jclass clazz)

View File

@ -78,16 +78,6 @@ 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);
/* This function gets called from the static initializer for FileDialog.java
to initialize the fieldIDs for fields that may be accessed from C */
JNIEXPORT void JNICALL
Java_java_awt_FileDialog_initIDs
(JNIEnv *env, jclass cls)
{
}
JNIEXPORT void JNICALL
Java_sun_awt_X11_XToolkit_initIDs
(JNIEnv *env, jclass clazz)
@ -223,14 +213,6 @@ Java_java_awt_Container_initIDs
}
JNIEXPORT void JNICALL
Java_java_awt_Button_initIDs
(JNIEnv *env, jclass cls)
{
}
JNIEXPORT void JNICALL
Java_java_awt_Scrollbar_initIDs
(JNIEnv *env, jclass cls)
@ -297,12 +279,6 @@ JNIEXPORT void JNICALL Java_java_awt_ScrollPane_initIDs
{
}
JNIEXPORT void JNICALL
Java_java_awt_TextField_initIDs
(JNIEnv *env, jclass cls)
{
}
JNIEXPORT void JNICALL Java_java_awt_Dialog_initIDs (JNIEnv *env, jclass cls)
{
}
@ -733,17 +709,6 @@ static void wakeUp() {
/* ========================== End poll section ================================= */
/*
* Class: java_awt_KeyboardFocusManager
* Method: initIDs
* Signature: ()V
*/
JNIEXPORT void JNICALL
Java_java_awt_KeyboardFocusManager_initIDs
(JNIEnv *env, jclass cls)
{
}
/*
* Class: sun_awt_X11_XToolkit
* Method: getEnv

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2009, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 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
@ -28,7 +28,6 @@
#include "awt_Component.h"
#include "java_awt_Button.h"
#include "sun_awt_windows_WButtonPeer.h"

View File

@ -1,44 +0,0 @@
/*
* Copyright (c) 1996, 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. 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.
*/
#include "java_awt_Color.h"
/************************************************************************
* Color native methods
*/
extern "C" {
/*
* Class: java_awt_Color
* Method: initIDs
* Signature: ()V;
*/
JNIEXPORT void JNICALL
Java_java_awt_Color_initIDs(JNIEnv *env, jclass cls)
{
}
} /* extern "C" */

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2022, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 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
@ -56,7 +56,6 @@
#include <java_awt_Toolkit.h>
#include <java_awt_FontMetrics.h>
#include <java_awt_Color.h>
#include <java_awt_Event.h>
#include <java_awt_event_KeyEvent.h>
#include <java_awt_Insets.h>

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2009, 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
@ -26,7 +26,6 @@
#include "awt.h"
#include "awt_Component.h"
#include "awt_Toolkit.h"
#include <java_awt_KeyboardFocusManager.h>
#include <jni.h>
static jobject getNativeFocusState(JNIEnv *env, void*(*ftn)()) {
@ -42,17 +41,6 @@ static jobject getNativeFocusState(JNIEnv *env, void*(*ftn)()) {
extern "C" {
/*
* Class: java_awt_KeyboardFocusManager
* Method: initIDs
* Signature: ()V
*/
JNIEXPORT void JNICALL
Java_java_awt_KeyboardFocusManager_initIDs
(JNIEnv *env, jclass cls)
{
}
/*
* Class: sun_awt_windows_WKeyboardFocusManagerPeer
* Method: setNativeFocusOwner

View File

@ -1,38 +0,0 @@
/*
* Copyright (c) 1998, 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. 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.
*/
#include "java_awt_Rectangle.h"
/************************************************************************
* AwtRectangle native methods
*/
extern "C" {
JNIEXPORT void JNICALL
Java_java_awt_Rectangle_initIDs(JNIEnv *env, jclass cls) {
}
} /* extern "C" */

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 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
@ -28,7 +28,6 @@
#include "awt_TextComponent.h"
#include "java_awt_TextField.h"
#include "sun_awt_windows_WTextFieldPeer.h"
#include <ole2.h>

View File

@ -1,85 +0,0 @@
/*
* Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software 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.
*/
#include <jni.h>
#include <jni_util.h>
/************************************************************************
* Button initIDs
*/
extern "C" {
/*
* Class: java_awt_Button
* Method: initIDs
* Signature: ()V
*/
JNIEXPORT void JNICALL
Java_java_awt_Button_initIDs(JNIEnv *env, jclass cls)
{
/* This stub is needed, because the Solaris code needs this method. */
}
} /* extern "C" */
/************************************************************************
* FileDialog initIDs
*/
extern "C" {
/*
* Class: java_awt_FileDialog
* Method: initIDs
* Signature: ()V
*/
JNIEXPORT void JNICALL
Java_java_awt_FileDialog_initIDs(JNIEnv *env, jclass cls)
{
/* This stub is needed, because the Solaris code needs this method. */
}
} /* extern "C" */
/************************************************************************
* TextField initIDs
*/
extern "C" {
/*
* Class: java_awt_TextField
* Method: initIDs
* Signature: ()V
*/
JNIEXPORT void JNICALL
Java_java_awt_TextField_initIDs(JNIEnv *env, jclass cls)
{
/* This stub is needed, because the Solaris code needs this method. */
}
} /* extern "C" */