Buggy code:
public class Shell extends Decorations { Control lastActive ; boolean closing ; boolean moved ; boolean resized ; boolean opened ; boolean fullScreen ; int oldX ; int oldY ; int oldWidth ; int oldHeight ; int oldWindowStyle ; int oldWindowState ; public Shell ( ) { } public Shell ( int style ) { } public Shell ( Display display ) { } public Shell ( Display display , int style ) { } Shell ( Display display , Shell parent , int style , int handle , boolean embedded ) { } public Shell ( Shell parent ) { } public Shell ( Shell parent , int style ) { } public static Shell wpf_new ( Display display , int handle ) { } public static Shell internal_new ( Display display , int handle ) { } static int checkStyle ( int style ) { } public void addShellListener ( ShellListener listener ) { } void addWidget ( ) { } void bringToTop ( ) { } void checkOpened ( ) { } public void close ( ) { } void createHandle ( ) { if ( ( shellHandle ) != 0 ) { scrolledHandle = OS . ContentControl_Content ( shellHandle ) ; if ( ( scrolledHandle ) == 0 ) error ( ERROR_NO_HANDLES ) ; int children = OS . Panel_Children ( scrolledHandle ) ; handle = OS . UIElementCollection_default ( children , 0 ) ; if ( ( handle ) == 0 ) error ( ERROR_NO_HANDLES ) ; OS . GCHandle_Free ( children ) ; return ; } state |= CANVAS ; if ( ( ( style ) & ( SWT . ON_TOP ) ) != 0 ) { shellHandle = OS . gcnew_Popup ( ) ; if ( ( shellHandle ) == 0 ) error ( ERROR_NO_HANDLES ) ; if ( ( ( style ) & ( SWT . NO_TRIM ) ) != 0 ) OS . Popup_AllowsTransparency ( shellHandle , true ) ; OS . KeyboardNavigation_SetTabNavigation ( shellHandle , KeyboardNavigationMode_None ) ; boolean scrolled = ( ( style ) & ( ( SWT . H_SCROLL ) | ( SWT . V_SCROLL ) ) ) != 0 ; createHandle ( scrolled , true ) ; OS . Popup_Child ( shellHandle , super . topHandle ( ) ) ; OS . Popup_IsOpen ( shellHandle , true ) ; OS . Popup_IsOpen ( shellHandle , false ) ; return ; } shellHandle = OS . gcnew_Window ( ) ; if ( ( shellHandle ) == 0 ) error ( ERROR_NO_HANDLES ) ; if ( ( ( style ) & ( SWT . NO_TRIM ) ) != 0 ) OS . Window_AllowsTransparency ( shellHandle , true ) ; OS . Window_ShowInTaskbar ( shellHandle , false ) ; OS . Window_ResizeMode ( shellHandle , ResizeMode_NoResize ) ; OS . Window_WindowStyle ( shellHandle , WindowStyle_None ) ; OS . FrameworkElement_Width ( shellHandle , 0 ) ; OS . FrameworkElement_Height ( shellHandle , 0 ) ; OS . Window_Show ( shellHandle ) ; OS . Window_Hide ( shellHandle ) ; <START_BUG> Rectangle bounds = display . getBounds ( ) ; <END_BUG> OS . FrameworkElement_Width ( shellHandle , ( ( ( bounds . width ) * 5 ) // 8 ) ) ; OS . FrameworkElement_Height ( shellHandle , ( ( ( bounds . height ) * 5 ) // 8 ) ) ; int windowStyle = OS . WindowStyle_None ; int resizeMode = OS . ResizeMode_NoResize ; if ( ( ( style ) & ( SWT . NO_TRIM ) ) == 0 ) { if ( ( ( style ) & ( SWT . TOOL ) ) != 0 ) { windowStyle = OS . WindowStyle_ToolWindow ; } else if ( ( ( style ) & ( SWT . SHELL_TRIM ) ) != 0 ) { windowStyle = OS . WindowStyle_SingleBorderWindow ; } if ( ( ( style ) & ( SWT . RESIZE ) ) != 0 ) { resizeMode |= OS . ResizeMode_CanResize ; } } OS . Window_ShowInTaskbar ( shellHandle , ( ( parent ) == null ) ) ; OS . Window_ResizeMode ( shellHandle , resizeMode ) ; OS . Window_WindowStyle ( shellHandle , windowStyle ) ; OS . KeyboardNavigation_SetTabNavigation ( shellHandle , KeyboardNavigationMode_None ) ; boolean scrolled = ( ( style ) & ( ( SWT . H_SCROLL ) | ( SWT . V_SCROLL ) ) ) != 0 ; createHandle ( scrolled , true ) ; OS . ContentControl_Content ( shellHandle , super . topHandle ( ) ) ; } void createWidget ( ) { } public Rectangle computeTrim ( int x , int y , int width , int height ) { } void deregister ( ) { } void destroyWidget ( ) { } public void dispose ( ) { } Control findBackgroundControl ( ) { } Control findThemeControl ( ) { } public void forceActive ( ) { } public int getAlpha ( ) { } public Rectangle getBounds ( ) { } public boolean getFullScreen ( ) { } public int getImeInputMode ( ) { } public Point getLocation ( ) { } public boolean getMaximized ( ) { } public Point getMinimumSize ( ) { } public Region getRegion ( ) { } public Shell getShell ( ) { } public boolean getVisible ( ) { } public Shell [ ] getShells ( ) { } Composite findDeferredControl ( ) { } public boolean isEnabled ( ) { } void hookEvents ( ) { } void HandleActivated ( int sender , int e ) { } void HandleClosed ( int sender , int e ) { } void HandleClosing ( int sender , int e ) { } void HandleDeactivated ( int sender , int e ) { } void HandleLocationChanged ( int sender , int e ) { } void HandleLostKeyboardFocusDeactivate ( int sender , int e ) { } void HandleMouseLeave ( int sender , int e ) { }

Fix:
Rectangle bounds = getMonitor ( ) . getBounds ( ) ;