UnsupportedOperationException is thrown with Lombok Builder annotation

Try this:

@Builder
@Data @AllArgsConstructor
public class ScreenDefinitionDTO {
    @Builder.Default
    private List<ScreenDeclaration> screens = new ArrayList<>();
}

This way you are telling lombok to, on build, initialize screens with an empty ArrayList.


Due to GitHub issue

Lombok @Builder is primarily meant for immutables (and uses either Collections.unmodifiableList or Guava's ImmutableList

that's why you have UnsupportedOperationException

For greater certainty reproduce full code pattern where you have exception please.