RFR: 8364146: JList getScrollableUnitIncrement return 0 [v9]

Phil Race prr at openjdk.org
Mon Dec 1 20:40:53 UTC 2025


On Thu, 27 Nov 2025 02:41:27 GMT, Prasanta Sadhukhan <psadhukhan at openjdk.org> wrote:

>> It seems JList.getScrollableUnitIncrement can sometime return 0 instead of positive number which is not specified in the javadoc which can lead to confusion. Clarified javadoc as to when it can return 0.
>
> Prasanta Sadhukhan has updated the pull request incrementally with one additional commit since the last revision:
> 
>   javadoc clarification for 0 value

src/java.desktop/share/classes/javax/swing/JList.java line 2510:

> 2508:      * @param direction less or equal to zero to scroll up/back,
> 2509:      *                  greater than zero for down/forward
> 2510:      * @return the "unit" increment for scrolling in the specified direction;

I don't think all of this should be in the @return statement.
I think it should just say
@return the non-negative "unit" increment for scrolling in the specified direction.

And the explanatory text should be in the body of the doc and be (something like) this, after the very first sentence of the existing doc.
"The scrolling distance returned will be positive, unless scrolling for the specified parameters is already at its furthest extent, in which case it will return zero".

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/26500#discussion_r2578566037


More information about the client-libs-dev mailing list