Buggy code:
public class RecoveryScanner extends Scanner { private RecoveryScannerData data ; private int [ ] pendingTokens ; private int pendingTokensPtr = - 1 ; private char [ ] fakeTokenSource = null ; private boolean isInserted = true ; private boolean precededByRemoved = false ; private int skipNextInsertedTokens = - 1 ; public boolean record = true ; public RecoveryScanner ( Scanner scanner , RecoveryScannerData data ) { } public void insertToken ( int token , int completedToken , int position ) { } private int [ ] reverse ( int [ ] tokens ) { } public void insertTokens ( int [ ] tokens , int completedToken , int position ) { } public void replaceTokens ( int token , int start , int end ) { } public void replaceTokens ( int [ ] tokens , int start , int end ) { } public void removeTokens ( int start , int end ) { } public int getNextToken ( ) throws InvalidInputException { if ( ( this . pendingTokensPtr ) > ( - 1 ) ) { return this . pendingTokens [ ( ( this . pendingTokensPtr ) -- ) ] ; } this . fakeTokenSource = null ; this . precededByRemoved = false ; if ( ( this . data . insertedTokens ) != null ) { for ( int i = 0 ; i <= ( this . data . insertedTokensPtr ) ; i ++ ) { if ( ( ( this . data . insertedTokensPosition [ i ] ) == ( ( this . currentPosition ) - 1 ) ) && ( i > ( skipNextInsertedTokens ) ) ) { this . data . insertedTokenUsed [ i ] = true ; this . pendingTokens = this . data . insertedTokens [ i ] ; this . pendingTokensPtr = ( this . data . insertedTokens [ i ] . length ) - 1 ; this . fakeTokenSource = CharOperation . NO_CHAR ; this . isInserted = true ; <START_BUG> this . startPosition = ( this . currentPosition ) - 1 ; <END_BUG> this . skipNextInsertedTokens = i ; return this . pendingTokens [ ( ( this . pendingTokensPtr ) -- ) ] ; } } this . skipNextInsertedTokens = - 1 ; } int previousLocation = this . currentPosition ; int currentToken = super . getNextToken ( ) ; if ( ( this . data . replacedTokens ) != null ) { for ( int i = 0 ; i <= ( this . data . replacedTokensPtr ) ; i ++ ) { if ( ( ( ( this . data . replacedTokensStart [ i ] ) >= previousLocation ) && ( ( this . data . replacedTokensStart [ i ] ) <= ( this . startPosition ) ) ) && ( ( this . data . replacedTokensEnd [ i ] ) >= ( ( this . currentPosition ) - 1 ) ) ) { this . data . replacedTokenUsed [ i ] = true ; this . pendingTokens = this . data . replacedTokens [ i ] ; this . pendingTokensPtr = ( this . data . replacedTokens [ i ] . length ) - 1 ; this . fakeTokenSource = CharOperation . NO_CHAR ; this . isInserted = false ; this . currentPosition = ( this . data . replacedTokensEnd [ i ] ) + 1 ; return this . pendingTokens [ ( ( this . pendingTokensPtr ) -- ) ] ; } } } if ( ( this . data . removedTokensStart ) != null ) { for ( int i = 0 ; i <= ( this . data . removedTokensPtr ) ; i ++ ) { if ( ( ( ( this . data . removedTokensStart [ i ] ) >= previousLocation ) && ( ( this . data . removedTokensStart [ i ] ) <= ( this . startPosition ) ) ) && ( ( this . data . removedTokensEnd [ i ] ) >= ( ( this . currentPosition ) - 1 ) ) ) { this . data . removedTokenUsed [ i ] = true ; this . currentPosition = ( this . data . removedTokensEnd [ i ] ) + 1 ; this . precededByRemoved = false ; return getNextToken ( ) ; } } } return currentToken ; } public char [ ] getCurrentIdentifierSource ( ) { } public char [ ] getCurrentTokenSourceString ( ) { } public char [ ] getCurrentTokenSource ( ) { } public RecoveryScannerData getData ( ) { } public boolean isFakeToken ( ) { } public boolean isInsertedToken ( ) { } public boolean isReplacedToken ( ) { } public boolean isPrecededByRemovedToken ( ) { } public void setData ( RecoveryScannerData data ) { } }

Fix:
this . startPosition = this . currentPosition ;