Skip to content

Explore the idea of marking the Data Builder DSL with @DslMarker to make it harder to make mistakes when trying to generate deeply nested types #5185

Closed
@StylianosGakis

Description

@StylianosGakis

Use case

When using the data builders, a common mistake that I do, (and apparently others do too) is that inside the data builder, and especially when I am nested quite a lot, there are a lot of builders at the time in the scope; aka this refers to a lot of builder types.
This makes it easy to reference something from a higher up scope, resulting in confusing looking code if you seemingly set some field that is not present in your correct scope, but it comes from a higher up one.

This comment shows an example of this.

Describe the solution you'd like

Marking the generated DSL builders with @DslScope would most likely make this mistake a build-time error, making our life just a bit easier when working with this feature.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions