Buggy code:
public static final int CR_BROKEN = ( RubyObject . USER0_F ) | ( RubyObject . USER1_F ) ; public static final Object UNSAFE = StringSupport . getUnsafe ( ) ; private static final int OFFSET = ( ( StringSupport . UNSAFE ) != null ) ? ( ( Unsafe ) ( StringSupport . UNSAFE ) ) . arrayBaseOffset ( byte [ ] . class ) : 0 ; private static Object getUnsafe ( ) { } public static String codeRangeAsString ( int codeRange ) { } public static int length ( Encoding enc , byte [ ] bytes , int p , int end ) { } public static int preciseLength ( Encoding enc , byte [ ] bytes , int p , int end ) { } public static boolean MBCLEN_NEEDMORE_P ( int r ) { } public static boolean MBCLEN_INVALID_P ( int r ) { } public static int MBCLEN_CHARFOUND_LEN ( int r ) { } public static int searchNonAscii ( byte [ ] bytes , int p , int end ) { } public static int searchNonAscii ( ByteList bytes ) { } public static int codeRangeScan ( Encoding enc , byte [ ] bytes , int p , int len ) { } private static int codeRangeScanAsciiCompatible ( Encoding enc , byte [ ] bytes , int p , int len ) { } private static int codeRangeScanNonAsciiCompatible ( Encoding enc , byte [ ] bytes , int p , int len ) { } public static int codeRangeScan ( Encoding enc , ByteList bytes ) { } public static long codeRangeScanRestartable ( Encoding enc , byte [ ] bytes , int s , int end , int cr ) { } private static final long NONASCII_MASK = - 9187201950435737472L ; private static int countUtf8LeadBytes ( long d ) { } private static final int LONG_SIZE = 8 ; private static final int LOWBITS = ( StringSupport . LONG_SIZE ) - 1 ; @ SuppressWarnings ( "deprecation" ) public static int utf8Length ( byte [ ] bytes , int p , int end ) { } public static int utf8Length ( ByteList bytes ) { } public static int strLength ( Encoding enc , byte [ ] bytes , int p , int end ) { } public static int strLength ( ByteList bytes ) { } public static long strLengthWithCodeRange ( Encoding enc , byte [ ] bytes , int p , int end ) { } private static long strLengthWithCodeRangeAsciiCompatible ( Encoding enc , byte [ ] bytes , int p , int end ) { } private static long strLengthWithCodeRangeNonAsciiCompatible ( Encoding enc , byte [ ] bytes , int p , int end ) { } public static long strLengthWithCodeRange ( ByteList bytes ) { } public static long strLengthWithCodeRange ( ByteList bytes , Encoding enc ) { } static long pack ( int result , int arg ) { } public static int unpackResult ( long len ) { } public static int unpackArg ( long cr ) { } public static int codePoint ( Ruby runtime , Encoding enc , byte [ ] bytes , int p , int end ) { } public static int codeLength ( Ruby runtime , Encoding enc , int c ) { } public static long getAscii ( Encoding enc , byte [ ] bytes , int p , int end ) { } public static long getAscii ( Encoding enc , byte [ ] bytes , int p , int end , int len ) { } public static int preciseCodePoint ( Encoding enc , byte [ ] bytes , int p , int end ) { int l = StringSupport . preciseLength ( enc , bytes , p , end ) ; if ( l > 0 ) <START_BUG> enc . mbcToCode ( bytes , p , end ) ; <END_BUG> return - 1 ; } @ SuppressWarnings ( "deprecation" ) public static int utf8Nth ( byte [ ] bytes , int p , int e , int nth ) { } public static int nth ( Encoding enc , byte [ ] bytes , int p , int end , int n ) { } private static int nthAsciiCompatible ( Encoding enc , byte [ ] bytes , int p , int end , int n ) { } private static int nthNonAsciiCompatible ( Encoding enc , byte [ ] bytes , int p , int end , int n ) { } public static int utf8Offset ( byte [ ] bytes , int p , int end , int n ) { } public static int offset ( Encoding enc , byte [ ] bytes , int p , int end , int n ) { } public static int offset ( RubyString str , int pos ) { } public static int toLower ( Encoding enc , int c ) { } public static int toUpper ( Encoding enc , int c ) { } public static int caseCmp ( byte [ ] bytes1 , int p1 , byte [ ] bytes2 , int p2 , int len ) { } public static int scanHex ( byte [ ] bytes , int p , int len ) { } public static int scanHex ( byte [ ] bytes , int p , int len , Encoding enc ) { } public static int hexLength ( byte [ ] bytes , int p , int len ) { } public static int hexLength ( byte [ ] bytes , int p , int len , Encoding enc ) { } public static int scanOct ( byte [ ] bytes , int p , int len ) { } public static int scanOct ( byte [ ] bytes , int p , int len , Encoding enc ) { } public static int octLength ( byte [ ] bytes , int p , int len ) { }

Fix:
return enc . mbcToCode ( bytes , p , end ) ;