Skip to content

Using immutables @Value.Default causes failure in instantiating immutable #1819

Closed as not planned
@hpalma

Description

@hpalma

I'm using immutable.io and the converter configuration exactly as exemplified here.

This works fine, but if i add a @Value.Default to my domain class, like:

@Value.Default
default Integer getNumberOfStudents() {
   return 0;
}

I start getting the following error:

java.lang.NoSuchMethodException: org.myapp.ImmutableDomainClass.<init>()

I've found that this is because when you add @Value.Default immutables actually generates a second constructor that receives the Builder as parameter. Because of this then the spring converter is not able to select which constructor to use (because it finds 2) and just fails to initialize.

Metadata

Metadata

Assignees

Labels

status: declinedA suggestion or change that we don't feel we should currently apply

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions