Buggy code:
public final class TextLayout { Device device ; Font font ; String text ; int lineSpacing ; int ascent ; int descent ; int alignment ; int wrapWidth ; int orientation ; int indent ; boolean justify ; int [ ] tabs ; int [ ] segments ; TextLayout . StyleItem [ ] styles ; TextLayout . StyleItem [ ] [ ] runs ; int [ ] lineOffset ; int [ ] lineY ; int [ ] lineWidth ; static class StyleItem { TextStyle style ; int start ; int length ; int width ; int ascent ; int descent ; boolean lineBreak ; boolean softBreak ; boolean tab ; } public TextLayout ( Device device ) { } void checkLayout ( ) { } void computeRuns ( GC gc ) { } public void dispose ( ) { } public void draw ( GC gc , int x , int y ) { } public void draw ( GC gc , int x , int y , int selectionStart , int selectionEnd , Color selectionForeground , Color selectionBackground ) { } void freeRuns ( ) { } public int getAlignment ( ) { } public int getAscent ( ) { } public Rectangle getBounds ( ) { } public Rectangle getBounds ( int start , int end ) { } public int getDescent ( ) { } public Font getFont ( ) { } public int getIndent ( ) { } public boolean getJustify ( ) { } public int getLevel ( int offset ) { } public int [ ] getLineOffsets ( ) { } public Rectangle getLineBounds ( int lineIndex ) { } public int getLineCount ( ) { } int getLineIndent ( int lineIndex ) { } public int getLineIndex ( int offset ) { } public FontMetrics getLineMetrics ( int lineIndex ) { checkLayout ( ) ; computeRuns ( null ) ; if ( ! ( ( 0 <= lineIndex ) && ( lineIndex < ( runs . length ) ) ) ) SWT . error ( ERROR_INVALID_RANGE ) ; GC gc = new GC ( device ) ; gc . setFont ( ( ( this . font ) != null ? this . font : device . getSystemFont ( ) ) ) ; FontMetrics metrics = gc . getFontMetrics ( ) ; int ascent = Math . max ( metrics . getAscent ( ) , this . ascent ) ; int descent = Math . max ( metrics . getDescent ( ) , this . descent ) ; if ( ( text . length ( ) ) != 0 ) { TextLayout . StyleItem [ ] lineRuns = runs [ lineIndex ] ; for ( int i = 0 ; i < ( lineRuns . length ) ; i ++ ) { TextLayout . StyleItem run = lineRuns [ i ] ; if ( ( run . style ) != null ) { int runAscent = 0 ; int runDescent = 0 ; if ( ( run . style . metrics ) != null ) { GlyphMetrics glyphMetrics = run . style . metrics ; runAscent = glyphMetrics . ascent ; runDescent = glyphMetrics . descent ; } else if ( ( run . style . font ) != null ) { gc . setFont ( run . style . font ) ; metrics = gc . getFontMetrics ( ) ; runAscent = metrics . getAscent ( ) ; runDescent = metrics . getDescent ( ) ; } ascent = Math . max ( ascent , ( runAscent + ( run . style . rise ) ) ) ; descent = Math . max ( descent , ( runDescent - ( run . style . rise ) ) ) ; } } } gc . dispose ( ) ; <START_BUG> return FontMetrics . gtk_new ( ascent , descent , 0 , 0 , ( ascent + descent ) ) ; <END_BUG> } public Point getLocation ( int offset , boolean trailing ) { } Font getItemFont ( TextLayout . StyleItem item ) { } public int getNextOffset ( int offset , int movement ) { } public int getOffset ( Point point , int [ ] trailing ) { } public int getOffset ( int x , int y , int [ ] trailing ) { } public int getOrientation ( ) { } public int getPreviousOffset ( int offset , int movement ) { } public int getSpacing ( ) { } public int [ ] getSegments ( ) { } public TextStyle getStyle ( int offset ) { } public int [ ] getTabs ( ) { } public String getText ( ) { } public int getWidth ( ) { } public boolean isDisposed ( ) { } TextLayout . StyleItem [ ] itemize ( ) { } TextLayout . StyleItem [ ] merge ( TextLayout . StyleItem [ ] items , int itemCount ) { } void place ( GC gc , TextLayout . StyleItem run ) { } public void setAlignment ( int alignment ) { } public void setAscent ( int ascent ) { } public void setDescent ( int descent ) { } public void setFont ( Font font ) { } public void setIndent ( int indent ) { } public void setJustify ( boolean justify ) { } public void setOrientation ( int orientation ) { } public void setSpacing ( int spacing ) { } public void setSegments ( int [ ] segments ) { } public void setStyle ( TextStyle style , int start , int end ) { } public void setTabs ( int [ ] tabs ) { } public void setText ( String text ) { } public void setWidth ( int width ) { } public String toString ( ) { } }

Fix:
return FontMetrics . internal_new ( ascent , descent , 0 , 0 , ( ascent + descent ) ) ;