Skip to content

Correction to hasNext and hasPrevious Javadoc#1395

Merged
otaviojava merged 2 commits intojakartaee:mainfrom
njr-11:Page-hasNext-inconsistency-with-nextPageRequest
Mar 12, 2026
Merged

Correction to hasNext and hasPrevious Javadoc#1395
otaviojava merged 2 commits intojakartaee:mainfrom
njr-11:Page-hasNext-inconsistency-with-nextPageRequest

Conversation

@njr-11
Copy link
Copy Markdown
Member

@njr-11 njr-11 commented Mar 9, 2026

Page.hasNext and hasPrevious say they are a way of knowing
that {@link #nextPageRequest()} will definitely not return {@code null}.
that {@link #previousPageRequest()} will not return {@code null}

However, nextPageRequest and previousPageRequest are written to never return null. They likely did so at one point but were switched to raise NoSuchElementException rather than returning null. The Javadoc for hasNext and hasPrevious needs to be updated to be consistent with that.

There is no behavior change here, only a correction to the informative statement we are making to the user.

Also, I corrected some indenting in PageRequest but there are no updates to wording in that class.

@njr-11 njr-11 added this to the 1.1 milestone Mar 9, 2026
@njr-11 njr-11 added the documentation Improvements or additions to documentation label Mar 9, 2026
Copy link
Copy Markdown
Member

@KyleAure KyleAure left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, this clarifies the expected behavior well.

@otaviojava otaviojava merged commit a3a2b2a into jakartaee:main Mar 12, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants