<AWT Dev> RFR: 8270058: Use Objects.check{Index, FromToIndex, FromIndexSize} for java.desktop [v2]

Prasanta Sadhukhan psadhukhan at openjdk.java.net
Thu Jul 22 05:51:51 UTC 2021

On Wed, 21 Jul 2021 09:58:23 GMT, Yi Yang <yyang at openjdk.org> wrote:

>> After JDK-8265518(#3615), it's possible to replace all variants of checkIndex by Objects.checkIndex/Objects.checkFromToIndex/Objects.checkFromIndexSize in the whole JDK codebase.
>> As Mandy suggested, I create this PR for changes involving client code:
>> src/java.desktop/share/classes/com/sun/media/sound/AudioFloatInputStream.java
>> src/java.desktop/share/classes/javax/swing/JTabbedPane.java
>> test/jdk/java/awt/print/PrinterJob/ImagePrinting/ClippedImages.java
>> test/jdk/javax/imageio/AppletResourceTest.java
>> test/jdk/javax/imageio/ImageReaderReadAll.java
>> test/jdk/javax/imageio/metadata/IIOMetadataFormat/UserPluginMetadataFormatTest.java
> Yi Yang has updated the pull request incrementally with one additional commit since the last revision:
>   checkFromIndexSize(off, len,...)

test/jdk/javax/imageio/ImageReaderReadAll.java line 94:

> 92:             if (seekForwardOnly) {
> 93:                 if (imageIndex < minIndex)
> 94:                     throw new IndexOutOfBoundsException();

Can't we use checkFromToIndex​ for this IOOBE too? Used in many other places in this PR...

Please also confirm all tests modified are green after this modification..


PR: https://git.openjdk.java.net/jdk/pull/4718

More information about the awt-dev mailing list