Buggy code:
public class CorrectionEngine implements ProblemReasons { protected int correctionStart ; protected int correctionEnd ; protected int prefixLength ; protected ICompilationUnit unit ; protected ICorrectionRequestor requestor ; protected static final int CLASSES = 1 ; protected static final int INTERFACES = 2 ; protected static final int IMPORT = 4 ; protected static final int METHOD = 8 ; protected static final int FIELD = 16 ; protected static final int LOCAL = 32 ; protected int filter ; public CorrectionEngine ( Map setting ) { } public void computeCorrections ( IMarker marker , ICompilationUnit targetUnit , int positionOffset , ICorrectionRequestor requestor ) throws JavaModelException { } public void computeCorrections ( IProblem problem , ICompilationUnit targetUnit , ICorrectionRequestor requestor ) throws JavaModelException { } private void computeCorrections ( ICompilationUnit unit , int id , int start , int end , String [ ] arguments , ICorrectionRequestor requestor ) throws JavaModelException { } private void correct ( char [ ] argument ) throws JavaModelException { try { String source = unit . getSource ( ) ; Scanner scanner = new Scanner ( ) ; <START_BUG> scanner . setSourceBuffer ( source . toCharArray ( ) ) ; <END_BUG> scanner . resetTo ( correctionStart , correctionEnd ) ; int token = 0 ; char [ ] argumentSource = new char [ 0 ] ; while ( true ) { token = scanner . getNextToken ( ) ; if ( token == ( ITerminalSymbols . TokenNameEOF ) ) return ; char [ ] tokenSource = scanner . getCurrentTokenSource ( ) ; argumentSource = CharOperation . concat ( argumentSource , tokenSource ) ; if ( ! ( CharOperation . startsWith ( argument , argumentSource ) ) ) return ; if ( CharOperation . equals ( argument , argumentSource ) ) { correctionStart = scanner . startPosition ; correctionEnd = scanner . currentPosition ; prefixLength = ( CharOperation . lastIndexOf ( '.' , argument ) ) + 1 ; break ; } } int completionPosition = correctionStart ; scanner . resetTo ( completionPosition , correctionEnd ) ; int position = completionPosition ; for ( int i = 0 ; i < 4 ; i ++ ) { if ( scanner . getNextCharAsJavaIdentifierPart ( ) ) { completionPosition = position ; position = scanner . currentPosition ; } else { break ; } } unit . codeComplete ( completionPosition , completionRequestor ) ; } catch ( JavaModelException e ) { return ; } catch ( InvalidInputException e ) { return ; } } protected ICompletionRequestor completionRequestor = new ICompletionRequestor ( ) { public void acceptAnonymousType ( char [ ] superTypePackageName , char [ ] superTypeName , char [ ] [ ] parameterPackageNames , char [ ] [ ] parameterTypeNames , char [ ] [ ] parameterNames , char [ ] completionName , int modifiers , int completionStart , int completionEnd ) { } public void acceptClass ( char [ ] packageName , char [ ] className , char [ ] completionName , int modifiers , int completionStart , int completionEnd ) { } public void acceptError ( IProblem error ) { } public void acceptField ( char [ ] declaringTypePackageName , char [ ] declaringTypeName , char [ ] name , char [ ] typePackageName , char [ ] typeName , char [ ] completionName , int modifiers , int completionStart , int completionEnd ) { } public void acceptInterface ( char [ ] packageName , char [ ] interfaceName , char [ ] completionName , int modifiers , int completionStart , int completionEnd ) { } public void acceptKeyword ( char [ ] keywordName , int completionStart , int completionEnd ) { } public void acceptLabel ( char [ ] labelName , int completionStart , int completionEnd ) { } public void acceptLocalVariable ( char [ ] name , char [ ] typePackageName , char [ ] typeName , int modifiers , int completionStart , int completionEnd ) { } public void acceptMethod ( char [ ] declaringTypePackageName , char [ ] declaringTypeName , char [ ] selector , char [ ] [ ] parameterPackageNames , char [ ] [ ] parameterTypeNames , char [ ] [ ] parameterNames , char [ ] returnTypePackageName , char [ ] returnTypeName , char [ ] completionName , int modifiers , int completionStart , int completionEnd ) { } public void acceptMethodDeclaration ( char [ ] declaringTypePackageName , char [ ] declaringTypeName , char [ ] selector , char [ ] [ ] parameterPackageNames , char [ ] [ ] parameterTypeNames , char [ ] [ ] parameterNames , char [ ] returnTypePackageName , char [ ] returnTypeName , char [ ] completionName , int modifiers , int completionStart , int completionEnd ) { } public void acceptModifier ( char [ ] modifierName , int completionStart , int completionEnd ) { } public void acceptPackage ( char [ ] packageName , char [ ] completionName , int completionStart , int completionEnd ) { } public void acceptType ( char [ ] packageName , char [ ] typeName , char [ ] completionName , int completionStart , int completionEnd ) { } public void acceptVariableName ( char [ ] typePackageName , char [ ] typeName , char [ ] name , char [ ] completionName , int completionStart , int completionEnd ) { } } ; }

Fix:
scanner . setSource ( source . toCharArray ( ) ) ;