-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Closed
Milestone
Description
Expected behavior
When use a defaultValue with a long value, ex:
class MyObject {
private Long myField;
....
}
class MyMapper {
@Mapping(target="myField", source="myField", defaultValue="0L")
abstract MyObject map(MyOtherObject obj);
}
The generated code should not produce any compiler warnings.
Actual behavior
class MyMapperImpl {
abstract MyObject map(MyOtherObject obj) {
...
if(obj.getMyField() != null) {
myObject.setMyField( obj.getMyField() );
} else {
obj.setMyField( (long) 0L ); // <--- This cast is unnecessary and produces a warning when compiling with -Xlint:all
}
}
}
Steps to reproduce the problem
See expected behavior above.
MapStruct Version
1.5.5