RFR: Make attributes mutable

Maurizio Cimadamore mcimadamore at openjdk.org
Wed Nov 29 18:25:48 UTC 2023


On Wed, 29 Nov 2023 18:15:23 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

> This PR makes the attribute list associated with a declaration (and a type) mutable. This means that we can now tweak a declaration/type after the fact. While the declaration/type is still immutable, the information attached to it can grow over time. This should be useful to reduce coupling between different steps in the extraction process. I plan to use this to simplify the way we deal with name mangling.

src/main/java/org/openjdk/jextract/Declaration.java line 563:

> 561:      * @param attributes a map from attribute name to attribute values.
> 562:      */
> 563:     record ClangAttributes(Map<String, List<String>> attributes) { }

I had to expose that here because of the test.

test/testng/org/openjdk/jextract/test/api/TestAttributes.java line 108:

> 106: 
> 107:     @Test
> 108:     public void testAddAttribute() {

These tests were geared towards adding and removing attributes. Since the new attribute machinery is "add-only", these tests no longer made sense.

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

PR Review Comment: https://git.openjdk.org/jextract/pull/146#discussion_r1409701155
PR Review Comment: https://git.openjdk.org/jextract/pull/146#discussion_r1409700458


More information about the jextract-dev mailing list