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 ; 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 . setSourceBuffer ( 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 ) || ( currentCharacter == '\r' ) ) || ( currentCharacter == '\n' ) ) { 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 ; } scanner . resetTo ( nextCharacterPosition , selectionEnd ) ; do { try { token = scanner . getNextToken ( ) ; } catch ( InvalidInputException e ) { return false ; } if ( ( ( ( ( token == ( TerminalSymbols . TokenNamethis ) ) || ( token == ( TerminalSymbols . TokenNamesuper ) ) ) || ( token == ( TerminalSymbols . TokenNameIdentifier ) ) ) && ( ( scanner . startPosition ) <= selectionStart ) ) && ( selectionStart <= ( scanner . currentPosition ) ) ) { lastIdentifierStart = scanner . startPosition ; <START_BUG> lastIdentifierEnd = scanner . currentPosition ; <END_BUG> lastIdentifier = scanner . getCurrentTokenSource ( ) ; } } while ( token != ( TerminalSymbols . TokenNameEOF ) ) ; } else { scanner . resetTo ( selectionStart , selectionEnd ) ; boolean expectingIdentifier = true ; do { try { token = scanner . getNextToken ( ) ; } catch ( InvalidInputException e ) { return false ; } switch ( token ) { case TerminalSymbols . TokenNamethis : case TerminalSymbols . TokenNamesuper : case TerminalSymbols . 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 TerminalSymbols . TokenNameDOT : if ( expectingIdentifier ) return false ; entireSelection . append ( '.' ) ; expectingIdentifier = true ; break ; case TerminalSymbols . TokenNameEOF : if ( expectingIdentifier ) return false ; break ; default : return false ; } } while ( token != ( TerminalSymbols . TokenNameEOF ) ) ; } if ( lastIdentifierStart > 0 ) { actualSelectionStart = lastIdentifierStart ; actualSelectionEnd = lastIdentifierEnd ; selectedIdentifier = lastIdentifier ; if ( identCount > 1 ) qualifiedSelection = entireSelection . toString ( ) . toCharArray ( ) ; return true ; } return false ; } public AssistParser getParser ( ) { } public void select ( ICompilationUnit sourceUnit , int selectionSourceStart , int selectionSourceEnd ) { } private void selectFrom ( Binding binding ) { } public void selectType ( ISourceType sourceType , char [ ] typeName ) { } private void selectDeclaration ( CompilationUnitDeclaration compilationUnit ) { }

Fix:
lastIdentifierEnd = ( scanner . currentPosition ) - 1 ;