8223766: Remains of ancient code in AWT initialization
authorserb
Fri, 17 May 2019 22:48:03 -0700
changeset 55171 9ee0b8733ee4
parent 55170 d23707ad2b00
child 55172 1a80806e7d15
8223766: Remains of ancient code in AWT initialization Reviewed-by: jdv
src/java.desktop/unix/native/libawt_xawt/awt/awt_AWTEvent.c
src/java.desktop/unix/native/libawt_xawt/awt/awt_AWTEvent.h
src/java.desktop/unix/native/libawt_xawt/awt/awt_Event.c
src/java.desktop/unix/native/libawt_xawt/awt/awt_Event.h
src/java.desktop/unix/native/libawt_xawt/awt/awt_Insets.c
src/java.desktop/unix/native/libawt_xawt/awt/awt_Insets.h
src/java.desktop/unix/native/libawt_xawt/xawt/XWindow.c
src/java.desktop/windows/native/libawt/windows/awt_Color.cpp
src/java.desktop/windows/native/libawt/windows/awt_Color.h
src/java.desktop/windows/native/libawt/windows/awt_MenuItem.cpp
src/java.desktop/windows/native/libawt/windows/awt_MenuItem.h
src/java.desktop/windows/native/libawt/windows/awt_Rectangle.cpp
src/java.desktop/windows/native/libawt/windows/awt_Rectangle.h
--- a/src/java.desktop/unix/native/libawt_xawt/awt/awt_AWTEvent.c	Fri May 17 22:37:27 2019 -0700
+++ b/src/java.desktop/unix/native/libawt_xawt/awt/awt_AWTEvent.c	Fri May 17 22:48:03 2019 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -34,42 +34,27 @@
     #error This file should not be included in headless library
 #endif
 
-#include "awt_p.h"
 #include "java_awt_AWTEvent.h"
 #include "java_awt_event_InputEvent.h"
 #include "java_awt_event_KeyEvent.h"
-#include "jni_util.h"
-
-#include "awt_AWTEvent.h"
-
-struct AWTEventIDs awtEventIDs;
-struct InputEventIDs inputEventIDs;
-struct KeyEventIDs keyEventIDs;
 
 JNIEXPORT void JNICALL
 Java_java_awt_AWTEvent_initIDs(JNIEnv *env, jclass cls)
 {
-    CHECK_NULL(awtEventIDs.bdata = (*env)->GetFieldID(env, cls, "bdata", "[B"));
-    CHECK_NULL(awtEventIDs.consumed = (*env)->GetFieldID(env, cls, "consumed", "Z"));
-    CHECK_NULL(awtEventIDs.id = (*env)->GetFieldID(env, cls, "id", "I"));
 }
 
 JNIEXPORT void JNICALL
 Java_java_awt_event_InputEvent_initIDs(JNIEnv *env, jclass cls)
 {
-    CHECK_NULL(inputEventIDs.modifiers = (*env)->GetFieldID(env, cls, "modifiers", "I"));
 }
 
 JNIEXPORT void JNICALL
 Java_java_awt_event_KeyEvent_initIDs(JNIEnv *env, jclass cls)
 {
-    CHECK_NULL(keyEventIDs.keyCode = (*env)->GetFieldID(env, cls, "keyCode", "I"));
-    CHECK_NULL(keyEventIDs.keyChar = (*env)->GetFieldID(env, cls, "keyChar", "C"));
 }
 
 JNIEXPORT void JNICALL
 Java_java_awt_AWTEvent_nativeSetSource(JNIEnv *env, jobject self,
                                        jobject newSource)
 {
-
 }
--- a/src/java.desktop/unix/native/libawt_xawt/awt/awt_AWTEvent.h	Fri May 17 22:37:27 2019 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,56 +0,0 @@
-/*
- * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software 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.
- */
-/*
- * Implements the native code for the java.awt.AWTEvent class
- * and all of the classes in the java.awt.event package.
- *
- * THIS FILE DOES NOT IMPLEMENT ANY OF THE OBSOLETE java.awt.Event
- * CLASS. SEE awt_Event.[ch] FOR THAT CLASS' IMPLEMENTATION.
- */
-#ifndef _AWT_AWTEVENT_H_
-#define _AWT_AWTEVENT_H_
-
-#include "jni_util.h"
-
-struct AWTEventIDs {
-  jfieldID bdata;
-  jfieldID consumed;
-  jfieldID id;
-};
-
-struct InputEventIDs {
-  jfieldID modifiers;
-};
-
-struct KeyEventIDs {
-  jfieldID keyCode;
-  jfieldID keyChar;
-};
-
-extern struct AWTEventIDs awtEventIDs;
-extern struct InputEventIDs inputEventIDs;
-extern struct KeyEventIDs keyEventIDs;
-
-#endif /* _AWT_AWTEVENT_H_ */
--- a/src/java.desktop/unix/native/libawt_xawt/awt/awt_Event.c	Fri May 17 22:37:27 2019 -0700
+++ b/src/java.desktop/unix/native/libawt_xawt/awt/awt_Event.c	Fri May 17 22:48:03 2019 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -33,16 +33,8 @@
 #endif
 
 #include "java_awt_Event.h"
-#include "jni_util.h"
-
-#include "awt_Event.h"
-
-struct EventIDs eventIDs;
 
 JNIEXPORT void JNICALL
 Java_java_awt_Event_initIDs(JNIEnv *env, jclass cls)
 {
-    CHECK_NULL(eventIDs.data = (*env)->GetFieldID(env, cls, "data", "J"));
-    CHECK_NULL(eventIDs.consumed = (*env)->GetFieldID(env, cls, "consumed", "Z"));
-    CHECK_NULL(eventIDs.id = (*env)->GetFieldID(env, cls, "id", "I"));
 }
--- a/src/java.desktop/unix/native/libawt_xawt/awt/awt_Event.h	Fri May 17 22:37:27 2019 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 1998, 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.  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.
- */
-/***
- *** THIS IMPLEMENTS ONLY THE OBSOLETE java.awt.Event CLASS! SEE
- *** awt_AWTEvent.[ch] FOR THE NEWER EVENT CLASSES.
- ***
- ***/
-#ifndef _AWT_EVENT_H_
-#define _AWT_EVENT_H_
-
-#include "jni_util.h"
-
-struct EventIDs {
-  jfieldID data;
-  jfieldID consumed;
-  jfieldID id;
-};
-
-extern struct EventIDs eventIDs;
-
-#endif /* _AWT_EVENT_H_ */
--- a/src/java.desktop/unix/native/libawt_xawt/awt/awt_Insets.c	Fri May 17 22:37:27 2019 -0700
+++ b/src/java.desktop/unix/native/libawt_xawt/awt/awt_Insets.c	Fri May 17 22:48:03 2019 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -24,18 +24,8 @@
  */
 
 #include "java_awt_Insets.h"
-#include "jni_util.h"
-
-#include "awt_Insets.h"
-
-struct InsetsIDs insetsIDs;
-
 
 JNIEXPORT void JNICALL
 Java_java_awt_Insets_initIDs(JNIEnv *env, jclass cls)
 {
-    CHECK_NULL(insetsIDs.top = (*env)->GetFieldID(env, cls, "top", "I"));
-    CHECK_NULL(insetsIDs.bottom = (*env)->GetFieldID(env, cls, "bottom", "I"));
-    CHECK_NULL(insetsIDs.left = (*env)->GetFieldID(env, cls, "left", "I"));
-    CHECK_NULL(insetsIDs.right = (*env)->GetFieldID(env, cls, "right", "I"));
 }
--- a/src/java.desktop/unix/native/libawt_xawt/awt/awt_Insets.h	Fri May 17 22:37:27 2019 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,33 +0,0 @@
-/*
- * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software 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_util.h"
-
-struct InsetsIDs {
-  jfieldID top;
-  jfieldID bottom;
-  jfieldID left;
-  jfieldID right;
-};
--- a/src/java.desktop/unix/native/libawt_xawt/xawt/XWindow.c	Fri May 17 22:37:27 2019 -0700
+++ b/src/java.desktop/unix/native/libawt_xawt/xawt/XWindow.c	Fri May 17 22:48:03 2019 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 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
@@ -46,7 +46,6 @@
 
 #include "awt_p.h"
 #include "awt_GraphicsEnv.h"
-#include "awt_AWTEvent.h"
 
 #define XK_KATAKANA
 #include <X11/keysym.h>     /* standard X keysyms */
--- a/src/java.desktop/windows/native/libawt/windows/awt_Color.cpp	Fri May 17 22:37:27 2019 -0700
+++ b/src/java.desktop/windows/native/libawt/windows/awt_Color.cpp	Fri May 17 22:48:03 2019 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -23,16 +23,7 @@
  * questions.
  */
 
-#include "awt.h"
-#include "awt_Color.h"
-
-
-/************************************************************************
- * AwtColor fields
- */
-
-jmethodID AwtColor::getRGBMID;
-
+#include "java_awt_Color.h"
 
 /************************************************************************
  * Color native methods
@@ -48,12 +39,6 @@
 JNIEXPORT void JNICALL
 Java_java_awt_Color_initIDs(JNIEnv *env, jclass cls)
 {
-    TRY;
-
-    AwtColor::getRGBMID = env->GetMethodID(cls, "getRGB", "()I");
-    DASSERT(AwtColor::getRGBMID != NULL);
-
-    CATCH_BAD_ALLOC;
 }
 
 } /* extern "C" */
--- a/src/java.desktop/windows/native/libawt/windows/awt_Color.h	Fri May 17 22:37:27 2019 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-/*
- * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software 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.
- */
-
-#ifndef AWT_COLOR_H
-#define AWT_COLOR_H
-
-#include "stdhdrs.h"
-
-class AwtColor {
-public:
-
-    /* java.awt.Color fields and methods */
-    static jmethodID getRGBMID;
-};
-
-#endif /* AWT_COLOR_H */
--- a/src/java.desktop/windows/native/libawt/windows/awt_MenuItem.cpp	Fri May 17 22:37:27 2019 -0700
+++ b/src/java.desktop/windows/native/libawt/windows/awt_MenuItem.cpp	Fri May 17 22:48:03 2019 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2017, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -69,8 +69,6 @@
 
 jfieldID AwtMenuItem::labelID;
 jfieldID AwtMenuItem::enabledID;
-jfieldID AwtMenuItem::fontID;
-jfieldID AwtMenuItem::appContextID;
 jfieldID AwtMenuItem::shortcutLabelID;
 jfieldID AwtMenuItem::isCheckboxID;
 jfieldID AwtMenuItem::stateID;
@@ -958,13 +956,6 @@
 JNIEXPORT void JNICALL
 Java_java_awt_MenuComponent_initIDs(JNIEnv *env, jclass cls)
 {
-    TRY;
-
-    AwtMenuItem::fontID = env->GetFieldID(cls, "font", "Ljava/awt/Font;");
-    CHECK_NULL(AwtMenuItem::fontID);
-    AwtMenuItem::appContextID = env->GetFieldID(cls, "appContext", "Lsun/awt/AppContext;");
-
-    CATCH_BAD_ALLOC;
 }
 
 } /* extern "C" */
--- a/src/java.desktop/windows/native/libawt/windows/awt_MenuItem.h	Fri May 17 22:37:27 2019 -0700
+++ b/src/java.desktop/windows/native/libawt/windows/awt_MenuItem.h	Fri May 17 22:48:03 2019 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1996, 2012, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -45,9 +45,6 @@
 
 class AwtMenuItem : public AwtObject {
 public:
-    /* java.awt.MenuComponent fields */
-    static jfieldID fontID;
-    static jfieldID appContextID;
 
     /* java.awt.MenuItem fields */
     static jfieldID labelID;
--- a/src/java.desktop/windows/native/libawt/windows/awt_Rectangle.cpp	Fri May 17 22:37:27 2019 -0700
+++ b/src/java.desktop/windows/native/libawt/windows/awt_Rectangle.cpp	Fri May 17 22:48:03 2019 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
+ * 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
@@ -23,17 +23,7 @@
  * questions.
  */
 
-#include "awt_Rectangle.h"
-#include "awt.h"
-
-/************************************************************************
- * AwtRectangle fields
- */
-
-jfieldID AwtRectangle::xID;
-jfieldID AwtRectangle::yID;
-jfieldID AwtRectangle::widthID;
-jfieldID AwtRectangle::heightID;
+#include "java_awt_Rectangle.h"
 
 /************************************************************************
  * AwtRectangle native methods
@@ -43,25 +33,6 @@
 
 JNIEXPORT void JNICALL
 Java_java_awt_Rectangle_initIDs(JNIEnv *env, jclass cls) {
-    TRY;
-
-    AwtRectangle::xID = env->GetFieldID(cls, "x", "I");
-    DASSERT(AwtRectangle::xID != NULL);
-    CHECK_NULL(AwtRectangle::xID);
-
-    AwtRectangle::yID = env->GetFieldID(cls, "y", "I");
-    DASSERT(AwtRectangle::yID != NULL);
-    CHECK_NULL(AwtRectangle::yID);
-
-    AwtRectangle::widthID = env->GetFieldID(cls, "width", "I");
-    DASSERT(AwtRectangle::widthID != NULL);
-    CHECK_NULL(AwtRectangle::widthID);
-
-    AwtRectangle::heightID = env->GetFieldID(cls, "height", "I");
-    DASSERT(AwtRectangle::heightID != NULL);
-    CHECK_NULL(AwtRectangle::heightID);
-
-    CATCH_BAD_ALLOC;
 }
 
 } /* extern "C" */
--- a/src/java.desktop/windows/native/libawt/windows/awt_Rectangle.h	Fri May 17 22:37:27 2019 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,47 +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.
- */
-
-/************************************************************************
- * AwtRectangle class
- */
-
-#ifndef AWT_RECTANGLE_H
-#define AWT_RECTANGLE_H
-
-#include <jni.h>
-#include <jni_util.h>
-
-class AwtRectangle {
-public:
-
-    /* java.awt.Rectangle field ids */
-    static jfieldID xID;
-    static jfieldID yID;
-    static jfieldID widthID;
-    static jfieldID heightID;
-
-};
-
-#endif // AWT_RECTANGLE_H