Buggy code:
public class MetaPattern implements IClusterable { private static final long serialVersionUID = 1L ; private Pattern pattern ; private List < MetaPattern > patterns ; private Pattern compiledPattern ; private static final String _DOUBLE_QUOTED_STRING = "\"[^\"]*?\"" ; private static final String _SINGLE_QUOTED_STRING = "\'[^\']*?\'" ; private static final String _STRING = ( ( ( "(?:[\\w\\-\\.]+|" + ( MetaPattern . _DOUBLE_QUOTED_STRING ) ) + "|" ) + ( MetaPattern . _SINGLE_QUOTED_STRING ) ) + ")" ; private static final String _OPTIONAL_STRING = ( MetaPattern . _STRING ) + "?" ; private static final String _VARIABLE_NAME = "[A-Za-z_][A-Za-z0-9_]*" ; private static final String _XML_NAME = "[A-Za-z_][A-Za-z0-9_.-]*" ; public static final MetaPattern WHITESPACE = new MetaPattern ( "\\s+" ) ; public static final MetaPattern OPTIONAL_WHITESPACE = new MetaPattern ( "\\s*" ) ; public static final MetaPattern NON_WORD = new MetaPattern ( "\\W+" ) ; public static final MetaPattern COMMA = new MetaPattern ( "," ) ; public static final MetaPattern COLON = new MetaPattern ( ":" ) ; public static final MetaPattern SEMICOLON = new MetaPattern ( ";" ) ; public static final MetaPattern SLASH = new MetaPattern ( "//" ) ; public static final MetaPattern BACKSLASH = new MetaPattern ( "\\\\" ) ; public static final MetaPattern DOT = new MetaPattern ( "\\." ) ; public static final MetaPattern PLUS = new MetaPattern ( "\\+" ) ; public static final MetaPattern MINUS = new MetaPattern ( "-" ) ; public static final MetaPattern DASH = new MetaPattern ( "-" ) ; public static final MetaPattern UNDERSCORE = new MetaPattern ( "_" ) ; public static final MetaPattern AMPERSAND = new MetaPattern ( "&" ) ; public static final MetaPattern PERCENT = new MetaPattern ( "%" ) ; public static final MetaPattern DOLLAR_SIGN = new MetaPattern ( "$" ) ; public static final MetaPattern POUND_SIGN = new MetaPattern ( "#" ) ; public static final MetaPattern AT_SIGN = new MetaPattern ( "@" ) ; public static final MetaPattern EXCLAMATION_POINT = new MetaPattern ( "!" ) ; public static final MetaPattern TILDE = new MetaPattern ( "~" ) ; public static final MetaPattern EQUALS = new MetaPattern ( "=" ) ; public static final MetaPattern STAR = new MetaPattern ( "\\*" ) ; public static final MetaPattern PIPE = new MetaPattern ( "\\|" ) ; public static final MetaPattern LEFT_PAREN = new MetaPattern ( "\\(" ) ; public static final MetaPattern RIGHT_PAREN = new MetaPattern ( "\\)" ) ; public static final MetaPattern LEFT_CURLY = new MetaPattern ( "\\{" ) ; public static final MetaPattern RIGHT_CURLY = new MetaPattern ( "\\}" ) ; public static final MetaPattern LEFT_SQUARE = new MetaPattern ( "\\[" ) ; public static final MetaPattern RIGHT_SQUARE = new MetaPattern ( "\\]" ) ; public static final MetaPattern DIGIT = new MetaPattern ( "\\d" ) ; public static final MetaPattern DIGITS = new MetaPattern ( "\\d+" ) ; public static final MetaPattern INTEGER = new MetaPattern ( "-?\\d+" ) ; public static final MetaPattern FLOATING_POINT_NUMBER = new MetaPattern ( "-?\\d+\\.?\\d*|-?\\.\\d+" ) ; public static final MetaPattern POSITIVE_INTEGER = new MetaPattern ( "\\d+" ) ; public static final MetaPattern HEXADECIMAL_DIGIT = new MetaPattern ( "[0-9a-fA-F]" ) ; public static final MetaPattern HEXADECIMAL_DIGITS = new MetaPattern ( "[0-9a-fA-F]+" ) ; public static final MetaPattern ANYTHING = new MetaPattern ( ".*" ) ; public static final MetaPattern ANYTHING_NON_EMPTY = new MetaPattern ( ".+" ) ; public static final MetaPattern WORD = new MetaPattern ( "\\w+" ) ; public static final MetaPattern OPTIONAL_WORD = new MetaPattern ( "\\w*" ) ; public static final MetaPattern VARIABLE_NAME = new MetaPattern ( MetaPattern . _VARIABLE_NAME ) ; public static final MetaPattern XML_ELEMENT_NAME = new MetaPattern ( MetaPattern . _XML_NAME ) ; public static final MetaPattern XML_ATTRIBUTE_NAME = new MetaPattern ( MetaPattern . _XML_NAME ) ; public static final MetaPattern PERL_INTERPOLATION = new MetaPattern ( ( ( "$\\{" + ( MetaPattern . _VARIABLE_NAME ) ) + "\\}" ) ) ; public static final MetaPattern DOUBLE_QUOTED_STRING = new MetaPattern ( MetaPattern . _DOUBLE_QUOTED_STRING ) ; public static final MetaPattern STRING = new MetaPattern ( MetaPattern . _STRING ) ; public static final MetaPattern OPTIONAL_STRING = new MetaPattern ( MetaPattern . _OPTIONAL_STRING ) ; public MetaPattern ( final String pattern ) { } public MetaPattern ( final MetaPattern pattern ) { } public MetaPattern ( final MetaPattern ... patterns ) { } public MetaPattern ( final List < MetaPattern > patterns ) { } public final Matcher matcher ( final CharSequence input ) { } public final Matcher matcher ( final CharSequence input , final int flags ) { } public final Pattern pattern ( ) { } public final Pattern pattern ( final int flags ) { } @ Override public String toString ( ) { if ( ( pattern ) != null ) { return pattern . pattern ( ) ; } else { <START_BUG> final StringBuffer buffer = new StringBuffer ( ) ; <END_BUG> for ( int i = 0 ; i < ( patterns . size ( ) ) ; i ++ ) { buffer . append ( patterns . get ( i ) ) ; } return buffer . toString ( ) ; } } private synchronized void compile ( final int flags ) { } private int bind ( int group ) { } }

Fix:
final StringBuilder buffer = new StringBuilder ( ) ;