[foreign-jextract] [Rev 01] RFR: 8239809: Need API to access attributes

Jorn Vernee jvernee at openjdk.java.net
Wed Feb 26 11:03:24 UTC 2020


On Tue, 25 Feb 2020 20:50:05 GMT, Henry Jen <henryjen at openjdk.org> wrote:

>> Add API to allow associate attributes with Declaration.
>> 
>> An attribute can have multiple values, thus a list of ConstantDesc.
>> 
>> The test case is based on [JDK-8223105](https://bugs.openjdk.java.net/browse/JDK-8223105), Windows test is simply parsing at this point, need to add validation as the header is implemented differently. 
>> 
>> We may want to add a more generic test case with some standard attributes.
> 
> The pull request has been updated with 1 additional commit.

src/jdk.incubator.jextract/share/classes/jdk/internal/jextract/impl/DeclarationImpl.java line 44:

> 43:     private final Position pos;
> 44:     private final Map<String, List<ConstantDesc>> attributes;
> 45: 

I think we want `Map<String, List<Constable>>` here instead? We use Constable for layout annotations as well: https://github.com/openjdk/panama-foreign/blob/foreign-jextract/src/jdk.incubator.foreign/share/classes/jdk/incubator/foreign/AbstractLayout.java#L47

We only care that they can be turned into constants, and I guess live values would be easier to work with (as opposed to descriptors).

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

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


More information about the panama-dev mailing list