There is unsafe code in LWWindowPeer. The method notifyReshape, which is called on the AppKit main thread, uses AWTAccessor to directly alter bounds-related fields in JWindow instances (those changes are performed on the current thread).
It should not be surprising that errors might arise if the application (on the AWT thread) is doing something that might interfere. What I have discovered is a case where this happens. Two things are needed: 1. The application sets the “apple.awt.fullWindowContent” property, which may cause AppKit to change the window size. AWT only finds out about this size change later. The JWindow size properties are stale until that happens. 2. The application tries to change the location of the window (for example, JOptionPane.createDialog does this). There are primitives for setting the bounds of a native window, but none for setting only the location. Therefore, the current size of the window must be added to create a reshape request. If the JWindow size is stale, then the window will be resized to that obsolete size. Perhaps the easiest fix would be to add primitives for independently setting the location and size of native windows.
