Buggy code:
public Point computeSize ( int wHint , int hHint , boolean changed ) { } int defaultBackground ( ) { } public void deselect ( int [ ] indices ) { } public void deselect ( int index ) { } public void deselect ( int start , int end ) { } public void deselectAll ( ) { } public int getFocusIndex ( ) { } public String getItem ( int index ) { } public int getItemCount ( ) { } public int getItemHeight ( ) { } public String [ ] getItems ( ) { } public String [ ] getSelection ( ) { } public int getSelectionCount ( ) { } public int getSelectionIndex ( ) { } public int [ ] getSelectionIndices ( ) { } public int getTopIndex ( ) { } public int indexOf ( String string ) { } public int indexOf ( String string , int start ) { } public boolean isSelected ( int index ) { } public void remove ( int [ ] indices ) { } public void remove ( int index ) { } public void remove ( int start , int end ) { } public void remove ( String string ) { } public void removeAll ( ) { } public void removeSelectionListener ( SelectionListener listener ) { } public void select ( int [ ] indices ) { } void select ( int [ ] indices , boolean scroll ) { } public void select ( int index ) { } void select ( int index , boolean scroll ) { } public void select ( int start , int end ) { } void select ( int start , int end , boolean scroll ) { } public void selectAll ( ) { } void setFocusIndex ( int index ) { } public void setFont ( Font font ) { } public void setItem ( int index , String string ) { } public void setItems ( String [ ] items ) { checkWidget ( ) ; if ( items == null ) error ( ERROR_NULL_ARGUMENT ) ; for ( int i = 0 ; i < ( items . length ) ; i ++ ) { if ( ( items [ i ] ) == null ) error ( ERROR_INVALID_ARGUMENT ) ; } int oldProc = OS . GetWindowLong ( handle , GWL_WNDPROC ) ; OS . SetWindowLong ( handle , GWL_WNDPROC , List . ListProc ) ; boolean redraw = ( ( drawCount ) == 0 ) && ( OS . IsWindowVisible ( handle ) ) ; if ( redraw ) { OS . SendMessage ( handle , WM_SETREDRAW , 0 , 0 ) ; } RECT rect = null ; int hDC = 0 ; int oldFont = 0 ; int newFont = 0 ; int newWidth = 0 ; if ( ( ( style ) & ( SWT . H_SCROLL ) ) != 0 ) { rect = new RECT ( ) ; hDC = OS . GetDC ( handle ) ; newFont = OS . SendMessage ( handle , WM_GETFONT , 0 , 0 ) ; if ( newFont != 0 ) oldFont = OS . SelectObject ( hDC , newFont ) ; OS . SendMessage ( handle , LB_SETHORIZONTALEXTENT , 0 , 0 ) ; } int length = items . length ; OS . SendMessage ( handle , LB_RESETCONTENT , 0 , 0 ) ; OS . SendMessage ( handle , LB_INITSTORAGE , length , ( length * 32 ) ) ; int index = 0 ; int cp = getCodePage ( ) ; while ( index < length ) { String string = items [ index ] ; TCHAR buffer = new TCHAR ( cp , string , true ) ; int result = OS . SendMessage ( handle , LB_ADDSTRING , 0 , buffer ) ; if ( ( result == ( OS . LB_ERR ) ) || ( result == ( OS . LB_ERRSPACE ) ) ) break ; if ( ( ( style ) & ( SWT . H_SCROLL ) ) != 0 ) { int flags = ( ( OS . DT_CALCRECT ) | ( OS . DT_SINGLELINE ) ) | ( OS . DT_NOPREFIX ) ; <START_BUG> OS . DrawText ( hDC , buffer , buffer . length ( ) , rect , flags ) ; <END_BUG> newWidth = Math . max ( newWidth , ( ( rect . right ) - ( rect . left ) ) ) ; } index ++ ; } if ( ( ( style ) & ( SWT . H_SCROLL ) ) != 0 ) { if ( newFont != 0 ) OS . SelectObject ( hDC , oldFont ) ; OS . ReleaseDC ( handle , hDC ) ; OS . SendMessage ( handle , LB_SETHORIZONTALEXTENT , ( newWidth + 3 ) , 0 ) ; } if ( redraw ) { OS . SendMessage ( handle , WM_SETREDRAW , 1 , 0 ) ; } OS . SetWindowLong ( handle , GWL_WNDPROC , oldProc ) ; if ( index < ( items . length ) ) error ( ERROR_ITEM_NOT_ADDED ) ; } void setScrollWidth ( ) { } void setScrollWidth ( TCHAR buffer , boolean grow ) { } void setScrollWidth ( int newWidth , boolean grow ) { } public void setSelection ( int [ ] indices ) { } public void setSelection ( String [ ] items ) { } public void setSelection ( int index ) { } public void setSelection ( int start , int end ) { } public void setTopIndex ( int index ) { } public void showSelection ( ) { } int widgetStyle ( ) { } TCHAR windowClass ( ) { } int windowProc ( ) { } LRESULT WM_SIZE ( int wParam , int lParam ) { } LRESULT wmCommandChild ( int wParam , int lParam ) { } }

Fix:
OS . DrawText ( hDC , buffer , ( - 1 ) , rect , flags ) ;