Skip to content

Warn if the record type is ERROR#271

Open
Randgalt wants to merge 1 commit intomasterfrom
jordanz/warn-on-unresolved-types
Open

Warn if the record type is ERROR#271
Randgalt wants to merge 1 commit intomasterfrom
jordanz/warn-on-unresolved-types

Conversation

@Randgalt
Copy link
Copy Markdown
Owner

This can happen with circular/nested references. It appears to be a bug in the JDK compiler. You can work around it by using the FQPN so this warning instructs to do that.

Relates to #269

This can happen with circular/nested references. It appears to be a
bug in the JDK compiler. You can work around it by using the FQPN
so this warning instructs to do that.

Relates to #269
@Randgalt
Copy link
Copy Markdown
Owner Author

attn @brandondahler

@brandondahler
Copy link
Copy Markdown

There's a few additional places that we should probably emit this warning at.

Specifically:

@brandondahler
Copy link
Copy Markdown

Tests for those looks straightforward:

ChildDeconstructorMethod.java

package io.soabase.recordbuilder.test.circular.nested;

import io.soabase.recordbuilder.core.RecordBuilder;
import java.util.function.Consumer;

public class ChildDeconstructorMethod {
    private final io.soabase.recordbuilder.test.circular.ParentBuilder parentBuilder;

    public ChildDeconstructorMethod(io.soabase.recordbuilder.test.circular.ParentBuilder parentBuilder) {
        this.parentBuilder = parentBuilder;
    }

    @RecordBuilder.Deconstructor
    public void deconstructor(Consumer<io.soabase.recordbuilder.test.circular.ParentBuilder> parentBuilder) {
        parentBuilder.accept(this.parentBuilder);
    }
}

ChildDeconstructorRecord.java

package io.soabase.recordbuilder.test.circular.nested;

import io.soabase.recordbuilder.core.RecordBuilder.Deconstructor;
import io.soabase.recordbuilder.core.RecordBuilder.DeconstructorAccessor;

@Deconstructor
public record ChildDeconstructorRecord(@DeconstructorAccessor io.soabase.recordbuilder.test.circular.ParentBuilder parentBuilder) {

}

ChildInterface.java

package io.soabase.recordbuilder.test.circular.nested;

import io.soabase.recordbuilder.core.RecordBuilder;

@RecordInterface
public interface ChildInterface {
    io.soabase.recordbuilder.test.circular.ParentBuilder parentBuilder();
}

For posterity/licensing - the code snippets above are good to be released under the Apache 2.0 license -- I omitted the license header for conciseness.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants