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

Henry Jen henryjen at openjdk.java.net
Thu Feb 27 04:53:36 UTC 2020


On Tue, 25 Feb 2020 21:11:43 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> The pull request has been updated with 1 additional commit.
> 
> src/jdk.incubator.jextract/share/classes/jdk/internal/jextract/impl/TreeMaker.java line 94:
> 
>> 93:         Objects.requireNonNull(c);
>> 94:         Map<String, List<ConstantDesc>> attrs = collectAttributes(c);
>> 95:         switch (c.kind()) {
> 
> Rather than collecting attributes upfront, and then having to pass down the attributes to all the various createXYZ functions, wouldn't it be easier to take the parsed declaration and adding the attributes after the fact? That way the createXYZ could remain unchanged and the attribute changes would be more orthogonal. This could be implemented on top of either a public or an impl-only withAttribute functionality.

That's certainly possible, but the change won't be that straightforward. We will need to change the checkCache mechanism as what need to be in cache should be with attributes after parsing.

Thus I don't think the change will be smaller, and the constructor with map are still needed. I'll give it a go and see how we feel about that.

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

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


More information about the panama-dev mailing list