Buggy code:
boolean update ; boolean deferDispose ; boolean active ; boolean disposed ; boolean opened ; int invalRgn ; Control lastActive ; Region region ; Rect rgnRect ; static int DEFAULT_CLIENT_WIDTH = - 1 ; static int DEFAULT_CLIENT_HEIGHT = - 1 ; 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 internal_new ( Display display , int handle ) { } static int checkStyle ( int style ) { } public void addShellListener ( ShellListener listener ) { } void bringToTop ( boolean force ) { } void checkOpen ( ) { } public void close ( ) { } void closeWidget ( ) { } public Rectangle computeTrim ( int x , int y , int width , int height ) { } void createHandle ( ) { state |= ( ( CANVAS ) | ( GRAB ) ) | ( HIDDEN ) ; int attributes = OS . kWindowStandardHandlerAttribute ; attributes |= OS . kWindowCompositingAttribute ; if ( ( ( style ) & ( SWT . NO_TRIM ) ) == 0 ) { if ( ( ( style ) & ( SWT . CLOSE ) ) != 0 ) attributes |= OS . kWindowCloseBoxAttribute ; if ( ( ( style ) & ( SWT . MIN ) ) != 0 ) attributes |= OS . kWindowCollapseBoxAttribute ; if ( ( ( style ) & ( SWT . MAX ) ) != 0 ) attributes |= OS . kWindowFullZoomAttribute ; if ( ( ( style ) & ( SWT . RESIZE ) ) != 0 ) { attributes |= OS . kWindowResizableAttribute ; if ( ( ( style ) & ( SWT . TITLE ) ) == 0 ) attributes |= OS . kWindowLiveResizeAttribute ; if ( ! ( OS . __BIG_ENDIAN__ ( ) ) ) attributes |= OS . kWindowLiveResizeAttribute ; } } int windowClass = OS . kDocumentWindowClass ; if ( ( ( style ) & ( ( SWT . CLOSE ) | ( SWT . TITLE ) ) ) == 0 ) windowClass = OS . kSheetWindowClass ; if ( ( ( style ) & ( ( ( SWT . APPLICATION_MODAL ) | ( SWT . PRIMARY_MODAL ) ) | ( SWT . SYSTEM_MODAL ) ) ) != 0 ) { if ( ( ( style ) & ( ( ( SWT . CLOSE ) | ( SWT . MAX ) ) | ( SWT . MIN ) ) ) == 0 ) { windowClass = ( ( ( style ) & ( SWT . TITLE ) ) != 0 ) ? OS . kMovableModalWindowClass : OS . kModalWindowClass ; } } if ( ( shellHandle ) == 0 ) { Monitor monitor = getMonitor ( ) ; Rectangle rect = monitor . getClientArea ( ) ; int width = ( ( rect . width ) * 5 ) // 8 ; int height = ( ( rect . height ) * 5 ) // 8 ; Rect bounds = new Rect ( ) ; OS . SetRect ( bounds , ( ( short ) ( 0 ) ) , ( ( short ) ( 0 ) ) , ( ( short ) ( width ) ) , ( ( short ) ( height ) ) ) ; int [ ] outWindow = new int [ 1 ] ; attributes &= OS . GetAvailableWindowAttributes ( windowClass ) ; OS . CreateNewWindow ( windowClass , attributes , bounds , outWindow ) ; if ( ( outWindow [ 0 ] ) == 0 ) error ( ERROR_NO_HANDLES ) ; shellHandle = outWindow [ 0 ] ; OS . RepositionWindow ( shellHandle , 0 , kWindowCascadeOnMainScreen ) ; int [ ] theRoot = new int [ 1 ] ; <START_BUG> OS . HIViewFindByID ( shellHandle , OS . kHIViewWindowContentID ( ) , theRoot ) ; <END_BUG> if ( ( theRoot [ 0 ] ) == 0 ) OS . GetRootControl ( shellHandle , theRoot ) ; if ( ( theRoot [ 0 ] ) == 0 ) error ( ERROR_NO_HANDLES ) ; if ( ( ( style ) & ( ( SWT . H_SCROLL ) | ( SWT . V_SCROLL ) ) ) != 0 ) { createScrolledHandle ( theRoot [ 0 ] ) ; } else { createHandle ( theRoot [ 0 ] ) ; } OS . SetControlVisibility ( topHandle ( ) , false , false ) ; } else { int [ ] theRoot = new int [ 1 ] ; OS . HIViewFindByID ( shellHandle , OS . kHIViewWindowContentID ( ) , theRoot ) ; if ( ( theRoot [ 0 ] ) == 0 ) OS . GetRootControl ( shellHandle , theRoot ) ; handle = OS . HIViewGetFirstSubview ( theRoot [ 0 ] ) ; if ( ( handle ) == 0 ) error ( ERROR_NO_HANDLES ) ; if ( OS . IsWindowVisible ( shellHandle ) ) state &= ~ ( HIDDEN ) ; } int [ ] outGroup = new int [ 1 ] ; OS . CreateWindowGroup ( kWindowGroupAttrHideOnCollapse , outGroup ) ; if ( ( outGroup [ 0 ] ) == 0 ) error ( ERROR_NO_HANDLES ) ; windowGroup = outGroup [ 0 ] ; int parentGroup ; if ( ( ( style ) & ( SWT . ON_TOP ) ) != 0 ) { parentGroup = OS . GetWindowGroupOfClass ( kFloatingWindowClass ) ; } else { if ( ( parent ) != null ) { parentGroup = parent . getShell ( ) . windowGroup ; } else { parentGroup = OS . GetWindowGroupOfClass ( windowClass ) ; } }

Fix:
OS . HIViewFindByID ( OS . HIViewGetRoot ( shellHandle ) , OS . kHIViewWindowContentID ( ) , theRoot ) ;