Buggy code:
gc . setBackground ( selectionBackground ) ; } else { gc . setForeground ( item . getForeground ( columnIndex ) ) ; gc . setBackground ( item . getBackground ( columnIndex ) ) ; } if ( ! ( drawExpansion ) ) { gc . setClipping ( ( ( int ) ( ( cellRect . x ) - offsetX ) ) , ( ( int ) ( ( cellRect . y ) - offsetY ) ) , ( ( int ) ( cellRect . width ) ) , ( ( int ) ( cellRect . height ) ) ) ; } Event event = new Event ( ) ; event . item = item ; event . gc = gc ; event . index = columnIndex ; event . detail = SWT . FOREGROUND ; if ( drawBackground ) event . detail |= SWT . BACKGROUND ; if ( isSelected ) event . detail |= SWT . SELECTED ; event . x = ( ( int ) ( cellRect . x ) ) ; event . y = ( ( int ) ( cellRect . y ) ) ; event . width = ( ( int ) ( cellRect . width ) ) ; event . height = ( ( int ) ( cellRect . height ) ) ; sendEvent ( EraseItem , event ) ; if ( ! ( event . doit ) ) { drawForeground = drawBackground = drawSelection = false ; } else { drawBackground = drawBackground && ( ( ( event . detail ) & ( SWT . BACKGROUND ) ) != 0 ) ; drawForeground = ( ( event . detail ) & ( SWT . FOREGROUND ) ) != 0 ; drawSelection = drawSelection && ( ( ( event . detail ) & ( SWT . SELECTED ) ) != 0 ) ; } if ( ( ! drawSelection ) && isSelected ) { userForeground = Color . cocoa_new ( display , gc . getForeground ( ) . handle ) ; } gc . dispose ( ) ; context . restoreGraphicsState ( ) ; if ( isDisposed ( ) ) return ; if ( item . isDisposed ( ) ) return ; if ( drawSelection && ( ( ( ( style ) & ( SWT . HIDE_SELECTION ) ) == 0 ) || hasFocus ) ) { cellRect . height -= spacing . height ; callSuper ( widget . id , sel_highlightSelectionInClipRect_ , cellRect ) ; cellRect . height += spacing . height ; } } if ( drawBackground && ( ! drawSelection ) ) { context . saveGraphicsState ( ) ; float [ ] colorRGB = background . handle ; NSColor color = NSColor . colorWithDeviceRed ( colorRGB [ 0 ] , colorRGB [ 1 ] , colorRGB [ 2 ] , 1.0F ) ; color . setFill ( ) ; NSBezierPath . fillRect ( cellRect ) ; context . restoreGraphicsState ( ) ; } if ( drawForeground ) { if ( ( ( ! ( drawExpansion ) ) || hooksMeasure ) && ( image != null ) ) { NSRect destRect = new NSRect ( ) ; destRect . x = ( rect . x ) + ( Table . IMAGE_GAP ) ; destRect . y = ( rect . y ) + ( ( float ) ( Math . ceil ( ( ( ( rect . height ) - ( imageBounds . height ) ) // 2 ) ) ) ) ; destRect . width = imageBounds . width ; destRect . height = imageBounds . height ; NSRect srcRect = new NSRect ( ) ; NSSize size = image . size ( ) ; srcRect . width = size . width ; srcRect . height = size . height ; context . saveGraphicsState ( ) ; <START_BUG> NSBezierPath . bezierPathWithRect ( rect ) . setClip ( ) ; <END_BUG> NSAffineTransform transform = NSAffineTransform . transform ( ) ; transform . scaleXBy ( 1 , ( - 1 ) ) ; transform . translateXBy ( 0 , ( - ( ( destRect . height ) + ( 2 * ( destRect . y ) ) ) ) ) ; transform . concat ( ) ; image . drawInRect ( destRect , srcRect , NSCompositeSourceOver , 1 ) ; context . restoreGraphicsState ( ) ; int imageWidth = ( imageBounds . width ) + ( Table . IMAGE_GAP ) ; rect . x += imageWidth ; rect . width -= imageWidth ; } cell . setHighlighted ( false ) ; boolean callSuper = false ; if ( userForeground != null ) { float [ ] color = userForeground . handle ; if ( ( ( ( ( color [ 0 ] ) == 0 ) && ( ( color [ 1 ] ) == 0 ) ) && ( ( color [ 2 ] ) == 0 ) ) && ( ( color [ 3 ] ) == 1 ) ) { NSMutableAttributedString newStr = new NSMutableAttributedString ( cell . attributedStringValue ( ) . mutableCopy ( ) ) ; NSRange range = new NSRange ( ) ; range . length = newStr . length ( ) ; newStr . removeAttribute ( NSForegroundColorAttributeName , range ) ; NSRect newRect = new NSRect ( ) ; newRect . x = ( rect . x ) + ( Table . TEXT_GAP ) ; newRect . y = rect . y ; newRect . width = ( rect . width ) - ( Table . TEXT_GAP ) ; newRect . height = rect . height ; NSSize size = newStr . size ( ) ; if ( ( newRect . height ) > ( size . height ) ) { newRect . y += ( ( newRect . height ) - ( size . height ) ) // 2 ; newRect . height = size . height ; } newStr . drawInRect ( newRect ) ;

Fix:
NSBezierPath . bezierPathWithRect ( rect ) . addClip ( ) ;