Buggy code:
protected RecoveredType currentRecoveryType ( ) { } public CompilationUnitDeclaration dietParse ( ICompilationUnit sourceUnit , CompilationResult compilationResult ) { } protected void dispatchDeclarationInto ( int length ) { } protected void dispatchDeclarationIntoEnumDeclaration ( int length ) { } protected CompilationUnitDeclaration endParse ( int act ) { } public int flushCommentsDefinedPriorTo ( int position ) { } protected TypeReference getAnnotationType ( ) { } public int getFirstToken ( ) { } public int [ ] getJavaDocPositions ( ) { } public void getMethodBodies ( CompilationUnitDeclaration unit ) { } protected char getNextCharacter ( char [ ] comment , int [ ] index ) { } protected Expression getTypeReference ( Expression exp ) { } protected TypeReference getTypeReference ( int dim ) { } protected TypeReference getTypeReferenceForGenericType ( int dim , int identifierLength , int numberOfIdentifiers ) { } protected NameReference getUnspecifiedReference ( ) { } protected NameReference getUnspecifiedReferenceOptimized ( ) { } public void goForBlockStatementsopt ( ) { } public void goForBlockStatementsOrCatchHeader ( ) { } public void goForClassBodyDeclarations ( ) { } public void goForCompilationUnit ( ) { } public void goForExpression ( ) { } public void goForFieldDeclaration ( ) { } public void goForGenericMethodDeclaration ( ) { } public void goForHeaders ( ) { } public void goForImportDeclaration ( ) { } public void goForInitializer ( ) { } public void goForMemberValue ( ) { } public void goForMethodBody ( ) { } public void goForPackageDeclaration ( ) { } public void goForTypeDeclaration ( ) { } protected void ignoreExpressionAssignment ( ) { } public void initialize ( ) { } public void initialize ( boolean initializeNLS ) { } public void initializeScanner ( ) { } public void jumpOverMethodBody ( ) { } private void jumpOverType ( ) { } protected void markEnclosingMemberWithLocalType ( ) { } protected void markInitializersWithLocalType ( TypeDeclaration type ) { } protected boolean moveRecoveryCheckpoint ( ) { } protected MessageSend newMessageSend ( ) { } protected MessageSend newMessageSendWithTypeArguments ( ) { } protected void optimizedConcatNodeLists ( ) { } protected void parse ( ) { } public void parse ( ConstructorDeclaration cd , CompilationUnitDeclaration unit ) { } public void parse ( ConstructorDeclaration cd , CompilationUnitDeclaration unit , boolean recordLineSeparator ) { } public void parse ( FieldDeclaration field , TypeDeclaration type , CompilationUnitDeclaration unit , char [ ] initializationSource ) { } public CompilationUnitDeclaration parse ( ICompilationUnit sourceUnit , CompilationResult compilationResult ) { } public CompilationUnitDeclaration parse ( ICompilationUnit sourceUnit , CompilationResult compilationResult , int start , int end ) { } public void parse ( Initializer initializer , TypeDeclaration type , CompilationUnitDeclaration unit ) { } public void parse ( MethodDeclaration md , CompilationUnitDeclaration unit ) { } public ASTNode [ ] parseClassBodyDeclarations ( char [ ] source , int offset , int length , CompilationUnitDeclaration unit ) { } public Expression parseExpression ( char [ ] source , int offset , int length , CompilationUnitDeclaration unit ) { } public Expression parseMemberValue ( char [ ] source , int offset , int length , CompilationUnitDeclaration unit ) { } public void parseStatements ( ReferenceContext rc , int start , int end , TypeDeclaration [ ] types , CompilationUnitDeclaration unit ) { } public void persistLineSeparatorPositions ( ) { } protected void prepareForBlockStatements ( ) { } public ProblemReporter problemReporter ( ) { } protected void pushIdentifier ( ) { } protected void pushIdentifier ( int flag ) { } protected void pushOnAstLengthStack ( int pos ) { } protected void pushOnAstStack ( ASTNode node ) { } protected void pushOnExpressionStack ( Expression expr ) { } protected void pushOnExpressionStackLengthStack ( int pos ) { } protected void pushOnGenericsStack ( ASTNode node ) { } protected void pushOnGenericsIdentifiersLengthStack ( int pos ) { } protected void pushOnGenericsLengthStack ( int pos ) { } protected void pushOnIntStack ( int pos ) { } protected void pushOnRealBlockStack ( int i ) { } protected void recoverStatements ( ) { } public void recoveryExitFromVariable ( ) { } public void recoveryTokenCheck ( ) { } protected void reportSyntaxErrors ( boolean isDietParse , int oldFirstToken ) { if ( ( this . referenceContext ) instanceof MethodDeclaration ) { MethodDeclaration methodDeclaration = ( ( MethodDeclaration ) ( this . referenceContext ) ) ; if ( methodDeclaration . errorInSignature ) { return ; } } this . compilationUnit . compilationResult . lineSeparatorPositions = this . scanner . getLineEnds ( ) ; this . scanner . recordLineSeparator = false ; int start = this . scanner . initialPosition ; <START_BUG> int end = ( ( this . scanner . eofPosition ) <= ( Integer . MAX_VALUE ) ) ? ( this . scanner . eofPosition ) - 1 : this . scanner . eofPosition ; <END_BUG> if ( isDietParse ) { TypeDeclaration [ ] types = this . compilationUnit . types ; int [ ] [ ] intervalToSkip = RangeUtil . computeDietRange ( types ) ; DiagnoseParser diagnoseParser = new DiagnoseParser ( this , oldFirstToken , start , end , intervalToSkip [ 0 ] , intervalToSkip [ 1 ] , intervalToSkip [ 2 ] , this . options ) ; diagnoseParser . diagnoseParse ( false ) ; reportSyntaxErrorsForSkippedMethod ( types ) ; this . scanner . resetTo ( start , end ) ; } else { DiagnoseParser diagnoseParser = new DiagnoseParser ( this , oldFirstToken , start , end , this . options ) ; diagnoseParser . diagnoseParse ( this . options . performStatementsRecovery ) ; } } private void reportSyntaxErrorsForSkippedMethod ( TypeDeclaration [ ] types ) { } protected void resetModifiers ( ) { } protected void resetStacks ( ) { } protected boolean resumeAfterRecovery ( ) { } protected boolean resumeOnSyntaxError ( ) { } public void setMethodsFullRecovery ( boolean enabled ) { } public void setStatementsRecovery ( boolean enabled ) { } public String toString ( ) { } protected void updateRecoveryState ( ) { } protected void updateSourceDeclarationParts ( int variableDeclaratorsCounter ) { } protected void updateSourcePosition ( Expression exp ) { } }

Fix:
int end = ( ( this . scanner . eofPosition ) == ( Integer . MAX_VALUE ) ) ? this . scanner . eofPosition : ( this . scanner . eofPosition ) - 1 ;