[foreign-memaccess+abi] RFR: 8264434: Remove ResourceScope-less overload from API [v2]

Maurizio Cimadamore mcimadamore at openjdk.java.net
Tue Mar 30 16:25:46 UTC 2021


On Tue, 30 Mar 2021 15:47:10 GMT, Paul Sandoz <psandoz at openjdk.org> wrote:

> Looking at the changes in the tests it occurred to me that `Resource.ofX` does not work so well with a static import, `Resource.XScope` would work better and is consistent with `globalScope`.

Ha! I had exactly this conversation earlier (offline).

Same applied to MemoryLayout.ofStruct and others.

I'm happy to rename all this, but (i) I'd like to separate from this change and (ii) I need some guidance from JDK API gurus - e.g. some JDK factories do use `ofXYZ` (e.g. List.of, ClassDesc.of) is there some rule about naming which will land the API in a more consistent place with the rest of the JDK?
> 
> May be worth reviewing factory methods of other classes too, namely `SegmentAllocator`.
> 
> For common cases i would imagine static imports may be useful, so the method names should stand on their own, at the expense of a few more characters (3 for scope) when the method is qualified.

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

PR: https://git.openjdk.java.net/panama-foreign/pull/485


More information about the panama-dev mailing list