RFR: 8344912: Sharpen the return type of various internal methods in jdk.internal.foreign

Chen Liang liach at openjdk.org
Sat Nov 23 17:30:23 UTC 2024


On Sat, 23 Nov 2024 16:29:10 GMT, Quan Anh Mai <qamai at openjdk.org> wrote:

> Hi,
> 
> This patch sharpens the return types of various internal methods. This helps the compiler to have better information when the corresponding methods are not inlined.
> 
> Please take a look and leave your reviews, thanks a lot.

I see this patch is in 2 parts:
1. Move of `AbstractMemorySegmentImpl::sessionImpl` to `scope` (a covariant override).  This involves a lot of usage updates.
2. More specific return types for many other methods.

Should these 2 be in 2 patches, as 1 has a lot of renaming changes?

src/java.base/share/classes/jdk/internal/foreign/AbstractMemorySegmentImpl.java line 392:

> 390: 
> 391:     @Override
> 392:     public MemorySessionImpl scope() {

Should this be `final` and `@ForceInline` to better match the old behavior of `sessionImpl`?

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

PR Review: https://git.openjdk.org/jdk/pull/22344#pullrequestreview-2456444601
PR Review Comment: https://git.openjdk.org/jdk/pull/22344#discussion_r1855230734


More information about the core-libs-dev mailing list