Randgalt / record-builder

Record builder generator for Java records

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot find symbol in code generated with addSingleItemCollectionBuilders

mwisnicki opened this issue · comments

Code:

@RecordBuilder
@RecordBuilder.Options(addSingleItemCollectionBuilders = true)
record Person(String name, int age, Map<String, Object> other) implements PersonBuilder.With {}

POM:

    <dependencies>
        <dependency>
            <groupId>io.soabase.record-builder</groupId>
            <artifactId>record-builder-processor</artifactId>
            <version>35</version>
            <scope>provided</scope>
        </dependency>
    </dependencies>

Compiler error:

\target\generated-sources\annotations\org\example\PersonBuilder.java:141:22
java: cannot find symbol
  symbol:   method __map(java.util.Map<capture#1 of ? extends java.lang.String,capture#2 of ?>)
  location: class org.example.PersonBuilder

Generated snippet:

    /**
     * Re-create the internally allocated {@code Map<String, Object>} for {@code other} by copying the argument
     */
    @Generated("io.soabase.recordbuilder.core.RecordBuilder")
    public PersonBuilder other(Map<? extends String, ?> other) {
        this.other = __map(other);
        return this;
    }

There is no __map defined anywhere
Lists fail the same way with missing __list.

OpenJDK18 on Win11

This is a duplicate of #129 I believe. We don't have a good solution yet. I had a PR but it was not acceptable by the community. I didn't write the original PR that is causing the error and I'm not sure what the correct solution is here. I'd really like the community to detail what the correct behavior should be.