Hello,

Could you please review the following fix for the bug.

Bug: https://bugs.openjdk.java.net/browse/JDK-8249183
Webrev: http://cr.openjdk.java.net/~alitvinov/8249183/jdk16/webrev.00

The bug is the JVM crash caused by attempt to invoke "sun.awt.windows.WFramePeer.setExtendedState(int)" Java method through JNI in the C++ function AwtFrame::WmSize(UINT, int, int)" defined in the file "src/java.desktop/windows/native/libawt/windows/awt_Frame.cpp" on a Java peer instance of the class "sun.awt.windows.WDialogPeer" which does not have "setExtendedState(int)" method. C++ class "AwtFrame" is designed to assume that an associated with its instance Java peer object is instance of "sun.awt.windows.WFramePeer".

On Java code level "javax.swing.JFrame" and "javax.swing.JDialog" similarly as "java.awt.Frame" and "java.awt.Dialog" are unrelated to each other in inheritance hierarchies, and "JFrame", "Frame" classes contain the method "setExtendedState(int)", while "JDialog", "Dialog" do not contain this method. But on C++ code level the C++ class "AwtDialog" extends "AwtFrame" class and the involved in this crash method "AwtFrame::WmSize(UINT, int, int)", which is executed on "AwtDialog" instance, does not take into account the fact that corresponding Java classes "java.awt.Frame", "java.awt.Dialog" do not have relation inheritance hierarchy.

THE FIX:
The fix lets to avoid execution of the code invoking "sun.awt.windows.WFramePeer.setExtendedState(int)", "sun.awt.windows.WFramePeer.getExtendedState()" methods through JNI in "awt_Frame.cpp" file, if "AwtFrame" C++ class states that its Java object peer does not have these two Java methods.

Thank you,
Anton

Reply via email to