Buggy code:
public final class SelectionEngine extends Engine implements ISearchRequestor { public static boolean DEBUG = false ; SelectionParser parser ; ISelectionRequestor requestor ; boolean acceptedAnswer ; private int actualSelectionStart ; private int actualSelectionEnd ; private char [ ] qualifiedSelection ; private char [ ] selectedIdentifier ; private char [ ] [ ] [ ] acceptedClasses ; private char [ ] [ ] [ ] acceptedInterfaces ; int acceptedClassesCount ; int acceptedInterfacesCount ; boolean noProposal = true ; IProblem problem = null ; public SelectionEngine ( ISearchableNameEnvironment nameEnvironment , ISelectionRequestor requestor , Map settings ) { } public void acceptClass ( char [ ] packageName , char [ ] className , int modifiers ) { } public void acceptInterface ( char [ ] packageName , char [ ] interfaceName , int modifiers ) { } public void acceptPackage ( char [ ] packageName ) { } private void acceptQualifiedTypes ( ) { } public void acceptType ( char [ ] packageName , char [ ] typeName ) { } private boolean checkSelection ( char [ ] source , int selectionStart , int selectionEnd ) { Scanner scanner = new Scanner ( ) ; scanner . setSource ( source ) ; int lastIdentifierStart = - 1 ; int lastIdentifierEnd = - 1 ; char [ ] lastIdentifier = null ; int token ; int identCount = 0 ; StringBuffer entireSelection = new StringBuffer ( ( ( selectionEnd - selectionStart ) + 1 ) ) ; if ( selectionStart > selectionEnd ) { int currentPosition = selectionStart - 1 ; int nextCharacterPosition = selectionStart ; char currentCharacter = '<seq2seq4repair_space>' ; try { while ( currentPosition > 0 ) { if ( ( ( source [ currentPosition ] ) == '\\' ) && ( ( source [ ( currentPosition + 1 ) ] ) == 'u' ) ) { int pos = currentPosition + 2 ; int c1 = 0 ; int c2 = 0 ; int c3 = 0 ; int c4 = 0 ; while ( ( source [ pos ] ) == 'u' ) { pos ++ ; } if ( ( ( ( ( ( ( ( ( c1 = Character . getNumericValue ( source [ ( pos ++ ) ] ) ) > 15 ) || ( c1 < 0 ) ) || ( ( c2 = Character . getNumericValue ( source [ ( pos ++ ) ] ) ) > 15 ) ) || ( c2 < 0 ) ) || ( ( c3 = Character . getNumericValue ( source [ ( pos ++ ) ] ) ) > 15 ) ) || ( c3 < 0 ) ) || ( ( c4 = Character . getNumericValue ( source [ ( pos ++ ) ] ) ) > 15 ) ) || ( c4 < 0 ) ) { return false ; } else { currentCharacter = ( ( char ) ( ( ( ( ( ( c1 * 16 ) + c2 ) * 16 ) + c3 ) * 16 ) + c4 ) ) ; nextCharacterPosition = pos ; } } else { currentCharacter = source [ currentPosition ] ; nextCharacterPosition = currentPosition + 1 ; } if ( ( currentCharacter == '\r' ) || ( currentCharacter == '\n' ) ) { break ; } currentPosition -- ; } } catch ( ArrayIndexOutOfBoundsException e ) { return false ; } <START_BUG> scanner . resetTo ( nextCharacterPosition , ( selectionEnd + 1 ) ) ; <END_BUG> do { try { token = scanner . getNextToken ( ) ; } catch ( InvalidInputException e ) { return false ; } if ( ( ( ( ( token == ( TerminalTokens . TokenNamethis ) ) || ( token == ( TerminalTokens . TokenNamesuper ) ) ) || ( token == ( TerminalTokens . TokenNameIdentifier ) ) ) && ( ( scanner . startPosition ) <= selectionStart ) ) && ( selectionStart <= ( scanner . currentPosition ) ) ) { lastIdentifierStart = scanner . startPosition ; lastIdentifierEnd = ( scanner . currentPosition ) - 1 ; lastIdentifier = scanner . getCurrentTokenSource ( ) ; } } while ( token != ( TerminalTokens . TokenNameEOF ) ) ; } else { scanner . resetTo ( selectionStart , selectionEnd ) ; boolean expectingIdentifier = true ; do { try { token = scanner . getNextToken ( ) ; } catch ( InvalidInputException e ) { return false ; } switch ( token ) { case TerminalTokens . TokenNamethis : case TerminalTokens . TokenNamesuper : case TerminalTokens . TokenNameIdentifier : if ( ! expectingIdentifier ) return false ; lastIdentifier = scanner . getCurrentTokenSource ( ) ; lastIdentifierStart = scanner . startPosition ; lastIdentifierEnd = ( scanner . currentPosition ) - 1 ; if ( lastIdentifierEnd > selectionEnd ) { lastIdentifierEnd = selectionEnd ; lastIdentifier = CharOperation . subarray ( lastIdentifier , 0 , ( ( lastIdentifierEnd - lastIdentifierStart ) + 1 ) ) ; } entireSelection . append ( lastIdentifier ) ; identCount ++ ; expectingIdentifier = false ; break ; case TerminalTokens . TokenNameDOT : if ( expectingIdentifier ) return false ; entireSelection . append ( '.' ) ; expectingIdentifier = true ; break ; case TerminalTokens . TokenNameEOF : if ( expectingIdentifier ) return false ; break ; default : return false ; } } while ( token != ( TerminalTokens . TokenNameEOF ) ) ; } if ( lastIdentifierStart > 0 ) { actualSelectionStart = lastIdentifierStart ; actualSelectionEnd = lastIdentifierEnd ; selectedIdentifier = lastIdentifier ; if ( identCount > 1 ) qualifiedSelection = entireSelection . toString ( ) . toCharArray ( ) ; return true ; } return false ; } public AssistParser getParser ( ) { } private boolean isLocal ( ReferenceBinding binding ) { } public void select ( ICompilationUnit sourceUnit , int selectionSourceStart , int selectionSourceEnd ) { } private void selectFrom ( Binding binding , CompilationUnitDeclaration parsedUnit ) { } private void selectLocalDeclaration ( ASTNode node ) { }

Fix:
scanner . resetTo ( nextCharacterPosition , ( ( selectionEnd + 1 ) == ( source . length ) ? selectionEnd : selectionEnd + 1 ) ) ;