RFR: 8318324: Drop redundant default methods from FFM API
Jorn Vernee
jvernee at openjdk.org
Wed Oct 18 12:10:27 UTC 2023
On Tue, 17 Oct 2023 17:31:30 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
> This PR moves turns default methods in `MemorySegment` and `MemoryLayout` into ordinary abstract methods.
> These interfaces cannot be subclasses by developers (they are sealed), so there is no reson for having default methods there. Also, default methods can have some detrimental effects, as they cause the interfaces to be initialized more eagerly.
Marked as reviewed by jvernee (Reviewer).
src/java.base/share/classes/jdk/internal/foreign/layout/AbstractLayout.java line 47:
> 45: import java.util.Optional;
> 46: import java.util.Set;
> 47: import java.util.function.Function;
There are quite a few new imports here. Is it possible some imports in `MemoryLayout` are now unused?
src/java.base/share/classes/jdk/internal/foreign/layout/AbstractLayout.java line 153:
> 151: }
> 152:
> 153: public long scale(long offset, long index) {
Could you add `@Override` to these as well? I think it makes it clearer that these methods might be accessed through a super type.
-------------
PR Review: https://git.openjdk.org/jdk/pull/16224#pullrequestreview-1683950393
PR Review Comment: https://git.openjdk.org/jdk/pull/16224#discussion_r1363143556
PR Review Comment: https://git.openjdk.org/jdk/pull/16224#discussion_r1363143273
More information about the core-libs-dev
mailing list