Lombok version is 1.18.0.
I have @Builder
set on class level.
When I try to set a default value for a list variable:
@Builder.Default
@Singular
private List<Class<? extends Exception>> retryTriggers = Lists.newArrayList(Exception.class);
I got an error:
Error:(46, 5) java: @Builder.Default and @Singular cannot be mixed.
Besides writing the builder myself, is there another way to do this?
I would suggest replacing the generated builder()
method with the following one:
@Builder
class ExceptionHandler {
@Singular
private final List<Class<? extends Exception>> retryTriggers;
public static ExceptionHandlerBuilder builder() {
return new ExceptionHandlerBuilder().retryTrigger(Exception.class);
}
}