On Tue, 30 Jun 2026 14:57:22 GMT, April Ivy <[email protected]> wrote:

>> As noted in https://bugs.openjdk.org/browse/JDK-8386802, `Util.entryList` 
>> and `Util.moduleEntryList` copy their input lists using indexed access. This 
>> is fine for `RandomAccess` lists but can be inefficient for 
>> sequentially-accessed implementations.
>> 
>> This patch keeps the existing indexed path for `RandomAccess` lists and 
>> falls back to iteration otherwise. Regression coverage is added for 
>> non-`RandomAccess` inputs.
>> 
>> Testing:
>> - `make CONF_CHECK=ignore java.base-java images`
>> - `make CONF_CHECK=ignore test-only 
>> TEST="test/jdk/jdk/classfile/UtilTest.java"`
>> - `make CONF_CHECK=ignore test-only TEST="test/jdk/jdk/classfile"`
>> - `make CONF_CHECK=ignore test-only TEST="test/jdk:tier1" 
>> JTREG="VERBOSE=summary"`
>> 
>> ---------
>> - [x] I confirm that I make this contribution in accordance with the 
>> [OpenJDK Interim AI Policy](https://openjdk.org/legal/ai).
>
> April Ivy has refreshed the contents of this pull request, and previous 
> commits have been removed. The incremental views will show differences 
> compared to the previous content of the PR. The pull request contains one new 
> commit since the last revision:
> 
>   8386802: ClassFile Util.entryList should consider non-RandomAccess lists

This should be fine - if the list has toctou, a `null` entry will immediately 
cause NPE, the iterator can throw NSEE if the list shrinks unexpectedly, and 
the loop can throw AIOOBE if the list grows unexpectedly.

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

Marked as reviewed by liach (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/31719#pullrequestreview-4601619302

Reply via email to