Buggy code:
public final RubyString cat ( ByteList str ) { } public final RubyString cat ( byte ch ) { } public final RubyString cat ( int ch ) { } public final RubyString cat ( int code , Encoding enc ) { } public final int cat ( byte [ ] bytes , int p , int len , Encoding enc ) { } public final RubyString catAscii ( byte [ ] bytes , int p , int len ) { } @ JRubyMethod ( name = { "replace" } , required = 1 , compat = CompatVersion . RUBY1_8 ) public IRubyObject replace ( IRubyObject other ) { } @ JRubyMethod ( name = { "replace" } , required = 1 , compat = CompatVersion . RUBY1_9 ) public RubyString replace19 ( IRubyObject other ) { } @ JRubyMethod ( name = { "initialize_copy" } , required = 1 , compat = CompatVersion . RUBY1_8 , visibility = PRIVATE ) public IRubyObject initialize_copy ( IRubyObject other ) { } @ JRubyMethod ( name = { "initialize_copy" } , required = 1 , compat = CompatVersion . RUBY1_9 , visibility = PRIVATE ) public RubyString initialize_copy19 ( IRubyObject other ) { } private RubyString replaceCommon ( IRubyObject other ) { } @ JRubyMethod ( name = "clear" , compat = CompatVersion . RUBY1_9 ) public RubyString clear ( ) { } @ JRubyMethod ( name = "reverse" , compat = CompatVersion . RUBY1_8 ) public IRubyObject reverse ( ThreadContext context ) { } @ JRubyMethod ( name = "reverse" , compat = CompatVersion . RUBY1_9 ) public IRubyObject reverse19 ( ThreadContext context ) { } @ JRubyMethod ( name = "reverse!" , compat = CompatVersion . RUBY1_8 ) public RubyString reverse_bang ( ThreadContext context ) { } @ JRubyMethod ( name = "reverse!" , compat = CompatVersion . RUBY1_9 ) public RubyString reverse_bang19 ( ThreadContext context ) { } public static RubyString newInstance ( IRubyObject recv , IRubyObject [ ] args , Block block ) { } @ JRubyMethod ( visibility = PRIVATE , compat = CompatVersion . RUBY1_8 ) @ Override public IRubyObject initialize ( ThreadContext context ) { } @ JRubyMethod ( visibility = PRIVATE , compat = CompatVersion . RUBY1_8 ) public IRubyObject initialize ( ThreadContext context , IRubyObject arg0 ) { } @ JRubyMethod ( name = "initialize" , visibility = PRIVATE , compat = CompatVersion . RUBY1_9 ) @ Override public IRubyObject initialize19 ( ThreadContext context ) { } @ JRubyMethod ( name = "initialize" , visibility = PRIVATE , compat = CompatVersion . RUBY1_9 ) public IRubyObject initialize19 ( ThreadContext context , IRubyObject arg0 ) { } @ JRubyMethod ( compat = CompatVersion . RUBY1_8 ) public IRubyObject casecmp ( ThreadContext context , IRubyObject other ) { } @ JRubyMethod ( name = "casecmp" , compat = CompatVersion . RUBY1_9 ) public IRubyObject casecmp19 ( ThreadContext context , IRubyObject other ) { } private IRubyObject multiByteCasecmp ( Ruby runtime , Encoding enc , ByteList value , ByteList otherValue ) { byte [ ] bytes = value . getUnsafeBytes ( ) ; int p = value . getBegin ( ) ; int end = p + ( value . getRealSize ( ) ) ; byte [ ] obytes = otherValue . getUnsafeBytes ( ) ; int op = otherValue . getBegin ( ) ; int oend = op + ( otherValue . getRealSize ( ) ) ; while ( ( p < end ) && ( op < oend ) ) { final int c ; final int oc ; if ( enc . isAsciiCompatible ( ) ) { c = ( bytes [ p ] ) & 255 ; oc = ( obytes [ op ] ) & 255 ; } else { c = StringSupport . preciseCodePoint ( enc , bytes , p , end ) ; oc = StringSupport . preciseCodePoint ( enc , obytes , op , oend ) ; } int cl ; int ocl ; <START_BUG> if ( ( Encoding . isAscii ( c ) ) && ( Encoding . isAscii ( oc ) ) ) { <END_BUG> byte uc = AsciiTables . ToUpperCaseTable [ c ] ; byte uoc = AsciiTables . ToUpperCaseTable [ oc ] ; if ( uc != uoc ) { return uc < uoc ? RubyFixnum . minus_one ( runtime ) : RubyFixnum . one ( runtime ) ; } cl = ocl = 1 ; } else { cl = StringSupport . length ( enc , bytes , p , end ) ; ocl = StringSupport . length ( enc , obytes , op , oend ) ; int ret = StringSupport . caseCmp ( bytes , p , obytes , op , ( cl < ocl ? cl : ocl ) ) ; if ( ret != 0 ) return ret < 0 ? RubyFixnum . minus_one ( runtime ) : RubyFixnum . one ( runtime ) ; if ( cl != ocl ) return cl < ocl ? RubyFixnum . minus_one ( runtime ) : RubyFixnum . one ( runtime ) ; } p += cl ; op += ocl ; } if ( ( end - p ) == ( oend - op ) ) return RubyFixnum . zero ( runtime ) ; return ( end - p ) > ( oend - op ) ? RubyFixnum . one ( runtime ) : RubyFixnum . minus_one ( runtime ) ; } @ JRubyMethod ( name = "=~" , compat = CompatVersion . RUBY1_8 , writes = BACKREF ) @ Override public IRubyObject op_match ( ThreadContext context , IRubyObject other ) { } @ JRubyMethod ( name = "=~" , compat = CompatVersion . RUBY1_9 , writes = BACKREF ) @ Override public IRubyObject op_match19 ( ThreadContext context , IRubyObject other ) { } @ JRubyMethod ( compat = CompatVersion . RUBY1_8 , reads = BACKREF ) public IRubyObject match ( ThreadContext context , IRubyObject pattern ) { }

Fix:
if ( ( ( enc . isAsciiCompatible ( ) ) && ( Encoding . isAscii ( c ) ) ) && ( Encoding . isAscii ( oc ) ) ) {