ADDITIONAL SYSTEM INFORMATION :
Windows 10, Java OpenJDK 64-Bit build 16+36-2231
A DESCRIPTION OF THE PROBLEM :
If a file drag is happening and an AWT Frame is shown under it, the EDT hangs forever.
This happens quite often in real world applications. For example, a user starts an app, then starts dragging a file with the intent to drop it on the app after the window appears.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Run the attached code. During the sleep, drag a Windows desktop icon to the screen center, so the JFrame appears beneath it.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
The window to appear and the EDT to continue as normal.
ACTUAL -
The window appears, but the EDT hangs in WInputMethod#createNativeContext(). This happens every time.
---------- BEGIN SOURCE ----------
import javax.awt.Frame;
import java.awt.EventQueue;
import java.awt.dnd.DnDConstants;
import java.awt.dnd.DropTarget;
import java.awt.dnd.DropTargetAdapter;
import java.awt.dnd.DropTargetDropEvent;
public class Test {
static public void main (String[] args) throws Exception {
Thread.sleep(1000);
EventQueue.invokeLater( () -> {
var frame = new JFrame();
new DropTarget(frame, DnDConstants.ACTION_COPY_OR_MOVE | DnDConstants.ACTION_LINK, new DropTargetAdapter() {
public void drop (DropTargetDropEvent event) {
}
}, true);
frame.setSize(1024, 768);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
});
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
There is no workaround, the app is broken and Java must be forcibly terminated.
FREQUENCY : always