Skip to content

8356130: Improper Implementation of hasNext method in ArrayList Class #25027

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ictorv
Copy link

@ictorv ictorv commented May 5, 2025

In arrayList, hasNext() method we were checking cursor!=size , After internally increasing cursor more than size of ArrayList will cause method to work improperly. Fixed using < operators.
Also in hasPrevious() method earlier cursor!=0 after decreasing cursor internally to any negative value this function will not work properly fixed using > operator.

Type: Bug
Component: core-libs
Sub-Component: java.util.collection
Affected version:8,25
Priority: P4


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue

Error

 ⚠️ OCA signatory status must be verified

Issue

  • JDK-8356130: Improper Implementation of hasNext method in ArrayList Class (Bug - P4) ⚠️ Issue is not open.

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/25027/head:pull/25027
$ git checkout pull/25027

Update a local copy of the PR:
$ git checkout pull/25027
$ git pull https://git.openjdk.org/jdk.git pull/25027/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 25027

View PR using the GUI difftool:
$ git pr show -t 25027

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/25027.diff

In this method we were checking cursor!=size, which on internally increasing or decreasing cause method to work improperly.
Fixed using < and > operators.
@bridgekeeper bridgekeeper bot added the oca Needs verification of OCA signatory status label May 5, 2025
@bridgekeeper
Copy link

bridgekeeper bot commented May 5, 2025

Hi @ictorv, welcome to this OpenJDK project and thanks for contributing!

We do not recognize you as Contributor and need to ensure you have signed the Oracle Contributor Agreement (OCA). If you have not signed the OCA, please follow the instructions. Please fill in your GitHub username in the "Username" field of the application. Once you have signed the OCA, please let us know by writing /signed in a comment in this pull request.

If you already are an OpenJDK Author, Committer or Reviewer, please click here to open a new issue so that we can record that fact. Please use "Add GitHub user ictorv" as summary for the issue.

If you are contributing this work on behalf of your employer and your employer has signed the OCA, please let us know by writing /covered in a comment in this pull request.

@openjdk
Copy link

openjdk bot commented May 5, 2025

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk
Copy link

openjdk bot commented May 5, 2025

⚠️ @ictorv a branch with the same name as the source branch for this pull request (master) is present in the target repository. If you eventually integrate this pull request then the branch master in your personal fork will diverge once you sync your personal fork with the upstream repository.

To avoid this situation, create a new branch for your changes and reset the master branch. You can do this by running the following commands in a local repository for your personal fork. Note: you do not have to name the new branch NEW-BRANCH-NAME.

$ git checkout -b NEW-BRANCH-NAME
$ git branch -f master 03f0ec4a35855b59c8faaf4be2e7569a12b4d5db
$ git push -f origin master

Then proceed to create a new pull request with NEW-BRANCH-NAME as the source branch and close this one.

@openjdk
Copy link

openjdk bot commented May 5, 2025

@ictorv The following label will be automatically applied to this pull request:

  • core-libs

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the core-libs core-libs-dev@openjdk.org label May 5, 2025
@ictorv ictorv changed the title 8356130: Fixed Logic of hasNext and hasPrevious Method in ArrayList 8356130: mproper Implementation of hasNext method in ArrayList Class May 5, 2025
@ictorv ictorv changed the title 8356130: mproper Implementation of hasNext method in ArrayList Class 8356130: Improper Implementation of hasNext method in ArrayList Class May 5, 2025
@ictorv
Copy link
Author

ictorv commented May 5, 2025

Hi @hns I reported this issue and fixed it kindly assign this issue to me.
Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core-libs core-libs-dev@openjdk.org oca Needs verification of OCA signatory status
Development

Successfully merging this pull request may close these issues.

1 participant