Buggy code:
public void packageCollidesWithType ( CompilationUnitDeclaration compUnitDecl ) { } public void packageIsNotExpectedPackage ( CompilationUnitDeclaration compUnitDecl ) { } private String parametersAsString ( MethodBinding method ) { } public void parseError ( int startPosition , int endPosition , char [ ] currentTokenSource , String errorTokenName , String [ ] possibleTokens ) { } public void publicClassMustMatchFileName ( CompilationUnitDeclaration compUnitDecl , TypeDeclaration typeDecl ) { } public void recursiveConstructorInvocation ( TypeDeclaration typeDeclaration ) { } public void redefineArgument ( Argument arg ) { } public void redefineLocal ( LocalDeclaration localDecl ) { } public void referenceMustBeArrayTypeAt ( TypeBinding arrayType , ArrayReference arrayRef ) { } public void returnTypeCannotBeVoidArray ( SourceTypeBinding type , MethodDeclaration methodDecl ) { } public void returnTypeProblem ( SourceTypeBinding type , MethodDeclaration methodDecl , TypeBinding expectedType ) { } public void scannerError ( Parser parser , String errorTokenName ) { } public void shouldReturn ( TypeBinding returnType , AstNode location ) { } public void signalNoImplicitStringConversionForCharArrayExpression ( Expression expression ) { } public void staticAndInstanceConflict ( MethodBinding currentMethod , MethodBinding inheritedMethod ) { } public void staticFieldAccessToNonStaticVariable ( FieldReference fieldRef , FieldBinding field ) { } public void staticFieldAccessToNonStaticVariable ( QualifiedNameReference nameRef , FieldBinding field ) { } public void staticFieldAccessToNonStaticVariable ( SingleNameReference nameRef , FieldBinding field ) { } public void staticInheritedMethodConflicts ( SourceTypeBinding type , MethodBinding concreteMethod , MethodBinding [ ] abstractMethods ) { } public void stringConstantIsExceedingUtf8Limit ( AstNode location ) { } public void superclassMustBeAClass ( SourceTypeBinding type , TypeReference superclassRef , ReferenceBinding superType ) { } public void superinterfaceMustBeAnInterface ( SourceTypeBinding type , TypeDeclaration typeDecl , ReferenceBinding superType ) { } public void typeCastError ( CastExpression expression , TypeBinding leftType , TypeBinding rightType ) { } public void typeCollidesWithPackage ( CompilationUnitDeclaration compUnitDecl , TypeDeclaration typeDecl ) { } public void typeMismatchError ( TypeBinding resultType , TypeBinding expectedType , AstNode location ) { } public void typeMismatchErrorActualTypeExpectedType ( Expression expression , TypeBinding constantType , TypeBinding expectedType ) { } public void undefinedLabel ( BranchStatement statement ) { } public void unexpectedStaticModifierForField ( SourceTypeBinding type , FieldDeclaration fieldDecl ) { } public void unexpectedStaticModifierForMethod ( ReferenceBinding type , AbstractMethodDeclaration methodDecl ) { } public void unhandledException ( TypeBinding exceptionType , AstNode location , Scope scope ) { } public void uninitializedBlankFinalField ( FieldBinding binding , AstNode location ) { } public void uninitializedLocalVariable ( LocalVariableBinding binding , AstNode location ) { } public void unmatchedBracket ( int position , ReferenceContext context , CompilationResult compilationResult ) { } public void unnecessaryEnclosingInstanceSpecification ( Expression expression , ReferenceBinding targetType ) { } public void unreachableCode ( Statement statement ) { } public void unreachableExceptionHandler ( ReferenceBinding exceptionType , AstNode location ) { } public void unresolvableReference ( NameReference nameRef , Binding binding ) { } public void unusedArgument ( LocalDeclaration localDecl ) { } public void unusedLocalVariable ( LocalDeclaration localDecl ) { } public void useAssertAsAnIdentifier ( int sourceStart , int sourceEnd ) { } public void variableTypeCannotBeVoid ( AbstractVariableDeclaration varDecl ) { } public void variableTypeCannotBeVoidArray ( AbstractVariableDeclaration varDecl ) { } public void visibilityConflict ( MethodBinding currentMethod , MethodBinding inheritedMethod ) { } public void wrongSequenceOfExceptionTypesError ( TryStatement statement , int under , int upper ) { } public void nonExternalizedStringLiteral ( AstNode location ) { } public void noMoreAvailableSpaceInConstantPool ( TypeDeclaration typeDeclaration ) { } private boolean isKeyword ( char [ ] tokenSource ) { if ( tokenSource == null ) { return false ; } try { Scanner scanner = new Scanner ( ) ; <START_BUG> scanner . setSourceBuffer ( tokenSource ) ; <END_BUG> int token = scanner . getNextToken ( ) ; char [ ] currentKeyword ; try { currentKeyword = scanner . getCurrentIdentifierSource ( ) ; } catch ( ArrayIndexOutOfBoundsException e ) { return false ; } int nextToken = scanner . getNextToken ( ) ; if ( ( nextToken == ( ITerminalSymbols . TokenNameEOF ) ) && ( ( scanner . startPosition ) == ( scanner . source . length ) ) ) { switch ( token ) { case Scanner . TokenNameERROR : if ( ( CharOperation . equals ( "goto" . toCharArray ( ) , currentKeyword ) ) || ( CharOperation . equals ( "const" . toCharArray ( ) , currentKeyword ) ) ) { return true ; } else { return false ; } case Scanner . TokenNameabstract : case Scanner . TokenNameassert : case Scanner . TokenNamebyte : case Scanner . TokenNamebreak : case Scanner . TokenNameboolean : case Scanner . TokenNamecase : case Scanner . TokenNamechar : case Scanner . TokenNamecatch : case Scanner . TokenNameclass : case Scanner . TokenNamecontinue : case Scanner . TokenNamedo : case Scanner . TokenNamedouble : case Scanner . TokenNamedefault : case Scanner . TokenNameelse : case Scanner . TokenNameextends : case Scanner . TokenNamefor : case Scanner . TokenNamefinal : case Scanner . TokenNamefloat : case Scanner . TokenNamefalse : case Scanner . TokenNamefinally : case Scanner . TokenNameif : case Scanner . TokenNameint : case Scanner . TokenNameimport : case Scanner . TokenNameinterface : case Scanner . TokenNameimplements : case Scanner . TokenNameinstanceof : case Scanner . TokenNamelong : case Scanner . TokenNamenew : case Scanner . TokenNamenull : case Scanner . TokenNamenative : case Scanner . TokenNamepublic : case Scanner . TokenNamepackage : case Scanner . TokenNameprivate : case Scanner . TokenNameprotected : case Scanner . TokenNamereturn : case Scanner . TokenNameshort : case Scanner . TokenNamesuper : case Scanner . TokenNamestatic : case Scanner . TokenNameswitch : case Scanner . TokenNamestrictfp : case Scanner . TokenNamesynchronized : case Scanner . TokenNametry : case Scanner . TokenNamethis : case Scanner . TokenNametrue : case Scanner . TokenNamethrow : case Scanner . TokenNamethrows : case Scanner . TokenNametransient : case Scanner . TokenNamevoid : case Scanner . TokenNamevolatile : case Scanner . TokenNamewhile : return true ; default : return false ; } } else { return false ; } } catch ( InvalidInputException e ) { return false ; } } }

Fix:
scanner . setSource ( tokenSource ) ;