On Tue, 23 Jun 2026 11:37:16 GMT, Viktor Klang <[email protected]> wrote:
> It's possible to avoid the creation of the two prototype arrays Note that in the reference implementation, [`Stream::toArray(IntFunction<…>)`] calls the array factory with the size of the spliterator if it’s exact like in this case (unlike [`Collection::toArray(IntFunction<…>)`], which passes `0` in the default implementation). [`Stream::toArray(IntFunction<…>)`]: https://docs.oracle.com/en/java/javase/26/docs/api/java.base/java/util/stream/Stream.html#toArray(java.util.function.IntFunction) [`Collection::toArray(IntFunction<…>)`]: https://docs.oracle.com/en/java/javase/26/docs/api/java.base/java/util/Collection.html#toArray(java.util.function.IntFunction) > src/java.base/share/classes/java/lang/Class.java line 645: > >> 643: } else { >> 644: int mask = ClassFile.ACC_IDENTITY | ClassFile.ACC_INTERFACE; >> 645: return !primitive && (getModifiers() & mask) == 0; > > To align with the other "getters" below, it seems like declaring the mask > inline is the thing to do > > Suggestion: > > return !primitive && (getModifiers() & (ClassFile.ACC_IDENTITY | > ClassFile.ACC_INTERFACE)) == 0; Correct spacing: Suggestion: return !primitive && (getModifiers() & (ClassFile.ACC_IDENTITY | ClassFile.ACC_INTERFACE)) == 0; ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/31123#discussion_r3484397366 PR Review Comment: https://git.openjdk.org/jdk/pull/31123#discussion_r3484406649
