Buggy code:
public final class WhileyParser { private String filename ; private ArrayList < Token > tokens ; private int index ; public WhileyParser ( String filename , List < Token > tokens ) { } public WhileyFile read ( ) { } private ArrayList < String > parsePackage ( ) { } private void parseImport ( WhileyFile wf ) { } private void parseFunctionOrMethodOrMessage ( List < Modifier > modifiers , WhileyFile wf ) { } private void parseDefType ( List < Modifier > modifiers , WhileyFile wf ) { } private List < Modifier > parseModifiers ( ) { } private String [ ] modifiers = new String [ ] { "public" , "export" , "native" } ; private boolean isModifier ( Token tok ) { } private List < Stmt > parseBlock ( int indent ) { } private void parseIndent ( int indent ) { } private Tabs getIndent ( ) { } private UnresolvedType parseThrowsClause ( ) { } private Pair < Expr , Expr > parseRequiresEnsures ( ) { } private Stmt parseStatement ( int indent ) { } private AbstractInvoke parseInvokeStmt ( ) { } private Stmt parseReturn ( ) { } private Stmt parseAssert ( ) { } private Stmt parseSkip ( ) { } private Stmt parseDebug ( ) { } private Stmt parseIf ( int indent ) { } private Case parseCase ( int indent ) { } private ArrayList < Stmt . Case > parseCaseBlock ( int indent ) { } private Stmt parseSwitch ( int indent ) { } private Catch parseCatch ( int indent ) { } private ArrayList < Stmt . Catch > parseCatchBlock ( int indent ) { } private Stmt parseTryCatch ( int indent ) { } private Stmt parseThrow ( int indent ) { } private Stmt parseBreak ( int indent ) { } private Stmt parseWhile ( int indent ) { } private Stmt parseDoWhile ( int indent ) { } private Stmt parseFor ( int indent ) { } private Bytecode parseBytecode ( ) { } private Stmt parseAssign ( ) { } private Expr parseTupleExpression ( ) { } private Expr parseCondition ( boolean startSet ) { } private Expr parseConditionExpression ( boolean startSet ) { } private Expr parseTypeEquals ( Expr lhs , int start ) { } private static boolean isBitwiseTok ( Token tok , boolean startSet ) { } private static BOp bitwiseOp ( Token tok ) { } private Expr parseBitwiseExpression ( boolean startSet ) { int start = index ; ArrayList < Expr > exprs = new ArrayList < Expr > ( ) ; ArrayList < Expr . BOp > ops = new ArrayList < Expr . BOp > ( ) ; ArrayList < Integer > ends = new ArrayList < Integer > ( ) ; exprs . add ( parseShiftExpression ( ) ) ; while ( ( ( index ) < ( tokens . size ( ) ) ) && ( WhileyParser . isBitwiseTok ( tokens . get ( index ) , startSet ) ) ) { Token token = tokens . get ( index ) ; match ( token . getClass ( ) ) ; ops . add ( WhileyParser . bitwiseOp ( token ) ) ; exprs . add ( parseShiftExpression ( ) ) ; <START_BUG> ends . add ( index ) ; <END_BUG> } Expr result = exprs . get ( 0 ) ; for ( int i = 1 ; i < ( exprs . size ( ) ) ; ++ i ) { Expr rhs = exprs . get ( i ) ; Expr . BOp bop = ops . get ( ( i - 1 ) ) ; result = new Expr . BinOp ( bop , result , rhs , sourceAttr ( start , ends . get ( ( i - 1 ) ) ) ) ; } return result ; } private static boolean isShiftTok ( Token tok ) { } private static BOp shiftOp ( Token tok ) { } private Expr parseShiftExpression ( ) { } private Expr parseRangeExpression ( ) { } private static boolean isAddSubTok ( Token tok ) { } private static BOp addSubOp ( Token tok ) { } private Expr parseAddSubExpression ( ) { } private static boolean isMulDivTok ( Token t ) { } private BOp mulDivOp ( Token t ) { } private Expr parseMulDivExpression ( ) { } private Expr parseCastExpression ( ) { } private Expr parseIndexTerm ( ) { } private Expr parseTerm ( ) { } private Expr parseFunVal ( ) { } private New parseNew ( ) { } private Expr parseListVal ( ) { } private Comprehension parseQuantifierSet ( ) { } private Expr parseSetVal ( ) { } private Expr parseDictionaryVal ( int start , Expr key ) { } private Expr parseRecordVal ( int start , String ident ) { } private Expr parseLengthOf ( ) { } private Expr parseNegation ( ) { } private AbstractInvoke parseInvokeExpr ( ) { } private Expr parseString ( ) { } private UnresolvedType parseType ( ) { } private UnresolvedType parseUnionIntersectionType ( ) { } private UnresolvedType parseNegationType ( ) { } private UnresolvedType parseBraceType ( ) { } private UnresolvedType parseBaseType ( ) { } private void skipWhiteSpace ( ) { } private boolean isWhiteSpace ( Token t ) { } private void checkNotEof ( ) { } private < T extends Token > T match ( Class < T > c ) { } private Identifier matchIdentifier ( ) { } private Keyword matchKeyword ( String keyword ) { } private void matchEndLine ( ) { } private Source sourceAttr ( int start , int end ) { } private void syntaxError ( String msg , Expr e ) { } private void syntaxError ( String msg , Token t ) { } }

Fix:
ends . add ( ( ( index ) - 1 ) ) ;