I don't believe this is the same ask as #211
I have a base interface for a group of record classes. One of the things this accomplishes is providing a type for specific with*() methods that should be common to every subclass:
interface CommonWithers {
public CommonWithers withId(int id);
}
@RecordBuilder
record Foo(int id, Foo foo) implements CommonWithers, FooBuilder.With {}
However, this doesn't compile. The FooBuilder.With.withId(int) method doesn't satisfy the CommonWithers.withId(int) requirement - even though copy+pasting that generated method into Foo does satisfy it.
What I'm looking for is a way to make FooBuilder.With extend CommonWithers, so its default method can satisfy the interface. Something similar to:
@RecordBuilder
@RecordBuilder.Options( withExtendsInterface = CommonWithers.class )
record Foo(int id, Foo foo) implements FooBuilder.With {}
which would generate a With interface like
public class FooBuilder {
// . . .
public interface With extends CommonWithers {
default Foo withId(int id) {
// . . .
I don't believe this is the same ask as #211
I have a base interface for a group of record classes. One of the things this accomplishes is providing a type for specific
with*()methods that should be common to every subclass:However, this doesn't compile. The
FooBuilder.With.withId(int)method doesn't satisfy theCommonWithers.withId(int)requirement - even though copy+pasting that generated method intoFoodoes satisfy it.What I'm looking for is a way to make
FooBuilder.WithextendCommonWithers, so its default method can satisfy the interface. Something similar to:which would generate a
Withinterface like