abstract layouts
Ty Young
youngty1997 at gmail.com
Thu Aug 12 09:23:08 UTC 2021
Hi,
When decorating a layout with attributes, there is no way to declare
that some attributes need to be filled in by an API user. In order to
fix this, I'd like to introduce some simple changes in order to support
that[1]:
1. withAttribute no longer accepts a null value as an attribute value.
2. Addition of an asAbstract method[2], which takes in a var args of
attributes that need to be filled in(indicated by a null value).
3. Addition of an isAbstract method[3], which returns true if any
attribute has a value of null.
4. Addition of an unfilledAttributes method[4] which returns a list of
all attributes that have a null attribute value and need filled in.
There are some minor code style consistency mistakes with the asAbstract
method and the docs could be improved, but this is more about just
putting the idea out there.
[1] https://github.com/BlueGoliath/panama-foreign/tree/abstract_layouts
[2]
https://github.com/BlueGoliath/panama-foreign/blob/a1c81e0b2b929cc3e1738c31acc97830294e0346/src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/MemoryLayout.java#L251
[3]
https://github.com/BlueGoliath/panama-foreign/blob/a1c81e0b2b929cc3e1738c31acc97830294e0346/src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/MemoryLayout.java#L610
[4]
https://github.com/BlueGoliath/panama-foreign/blob/a1c81e0b2b929cc3e1738c31acc97830294e0346/src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/MemoryLayout.java#L342
More information about the panama-dev
mailing list