You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to parse in generic i.e. DomainBuilder to the StudentMapper. However, the compiler throws error at this.studentMapper.toStudentDomain, saying 'Únchecked call to toStudentDomain as a member of raw type'. Can anyone advise what am I doing wrong here?
The StudentMapper interface is declared with a generic type parameter DomainBuilder. In controller, when you are using this.studentMapper.toStudentDomain you are not mentioning DomainBuilder - so the compiler is thinking StudentMapper as a raw type and resulting this error.
To fix this, in your controller, the StudentMapper should be declared with StudentDomain.StudentDomainBuilder type to ensure the compiler its actual generic type.
StudentBuilder is generated by the use of lombok @Builder(toBuilder=true) upon Student. The toBuilder=true part of the annotation will create a new toBuilder() under the current object's value. Thus, currentStudentDomain.toBuilder() in your StudentController code returns an instance of StudentDomain.StudentDomainBuilder
So, the studentMapper should be declared as the actual type not the raw type-
private final StudentMapper<StudentDomain.StudentDomainBuilder> studentMapper; in controller class.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I am trying to parse in generic i.e. DomainBuilder to the StudentMapper. However, the compiler throws error at
this.studentMapper.toStudentDomain, saying 'Únchecked call to toStudentDomain as a member of raw type'. Can anyone advise what am I doing wrong here?Beta Was this translation helpful? Give feedback.
All reactions