On Wed, 18 Oct 2023 04:06:17 GMT, Jorn Vernee <jver...@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. > > 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? No unused import here - these are just the imports required for the overrides to compile successfully. > 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. Would be nice - but note that `AbstractLayoutImpl` does not extend `MemoryLayout`. ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/16224#discussion_r1363753942 PR Review Comment: https://git.openjdk.org/jdk/pull/16224#discussion_r1363755711