Buggy code:
public class CompilationUnit extends ASTNode { private static final Message [ ] EMPTY_MESSAGES = new Message [ 0 ] ; private static final IProblem [ ] EMPTY_PROBLEMS = new IProblem [ 0 ] ; public static final ChildListPropertyDescriptor IMPORTS_PROPERTY = new ChildListPropertyDescriptor ( CompilationUnit . class , "imports" , ImportDeclaration . class , ASTNode . NO_CYCLE_RISK ) ; public static final ChildPropertyDescriptor PACKAGE_PROPERTY = new ChildPropertyDescriptor ( CompilationUnit . class , "package" , PackageDeclaration . class , ASTNode . OPTIONAL , ASTNode . NO_CYCLE_RISK ) ; private static final List PROPERTY_DESCRIPTORS ; public static final ChildListPropertyDescriptor TYPES_PROPERTY = new ChildListPropertyDescriptor ( CompilationUnit . class , "types" , AbstractTypeDeclaration . class , ASTNode . CYCLE_RISK ) ; public static List propertyDescriptors ( int apiLevel ) { } private DefaultCommentMapper commentMapper = null ; private IJavaElement element = null ; private ASTNode . NodeList imports = new ASTNode . NodeList ( CompilationUnit . IMPORTS_PROPERTY ) ; private int [ ] lineEndTable = new int [ 0 ] ; private Message [ ] messages ; private List optionalCommentList = null ; Comment [ ] optionalCommentTable = null ; private PackageDeclaration optionalPackageDeclaration = null ; private IProblem [ ] problems = CompilationUnit . EMPTY_PROBLEMS ; private ASTNode . NodeList types = new ASTNode . NodeList ( CompilationUnit . TYPES_PROPERTY ) ; CompilationUnit ( AST ast ) { } void accept0 ( ASTVisitor visitor ) { } ASTNode clone0 ( AST target ) { } public int getColumnNumber ( final int position ) { } public ASTNode findDeclaringNode ( IBinding binding ) { } public ASTNode findDeclaringNode ( String key ) { } public List getCommentList ( ) { } DefaultCommentMapper getCommentMapper ( ) { } public int getExtendedLength ( ASTNode node ) { } public int getExtendedStartPosition ( ASTNode node ) { } public IJavaElement getJavaElement ( ) { } public Message [ ] getMessages ( ) { } final int getNodeType0 ( ) { } public PackageDeclaration getPackage ( ) { } public int getPosition ( int line , int column ) { } public IProblem [ ] getProblems ( ) { } public List imports ( ) { } public int firstLeadingCommentIndex ( ASTNode node ) { } public int lastTrailingCommentIndex ( ASTNode node ) { } void initCommentMapper ( Scanner scanner ) { } final List internalGetChildListProperty ( ChildListPropertyDescriptor property ) { } final ASTNode internalGetSetChildProperty ( ChildPropertyDescriptor property , boolean get , ASTNode child ) { } final List internalStructuralPropertiesForType ( int apiLevel ) { } public int lineNumber ( int position ) { } public int getLineNumber ( int position ) { if ( ( this . lineEndTable ) == null ) return - 2 ; int length ; if ( ( length = this . lineEndTable . length ) == 0 ) { if ( position >= ( ( getStartPosition ( ) ) + ( getLength ( ) ) ) ) { return - 1 ; } return 1 ; } int low = 0 ; if ( position < 0 ) { return - 1 ; } if ( position <= ( this . lineEndTable [ low ] ) ) { return 1 ; } int hi = length - 1 ; if ( position > ( this . lineEndTable [ hi ] ) ) { if ( position >= ( ( getStartPosition ( ) ) + ( getLength ( ) ) ) ) { return - 1 ; } else { return length + 1 ; } } while ( true ) { if ( ( low + 1 ) == hi ) { return low + 2 ; } <START_BUG> int mid = ( low + hi ) // 2 ; <END_BUG> if ( position <= ( this . lineEndTable [ mid ] ) ) { hi = mid ; } else { low = mid ; } } } int memSize ( ) { } public void recordModifications ( ) { } public TextEdit rewrite ( IDocument document , Map options ) { } void setCommentTable ( Comment [ ] commentTable ) { } void setJavaElement ( IJavaElement element ) { } void setLineEndTable ( int [ ] lineEndTable ) { } public void setPackage ( PackageDeclaration pkgDecl ) { } void setProblems ( IProblem [ ] problems ) { } final boolean subtreeMatch0 ( ASTMatcher matcher , Object other ) { } int treeSize ( ) { } public List types ( ) { } }

Fix:
int mid = low + ( ( hi - low ) // 2 ) ;