-
-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Renaming a @Getter annotated field results in a getter inside the mapping definition (instead of the new field name) #197
Comments
Hi @lmartelli! Which version of the plugin are you currently using? How does your model look like in detail? Not able to reproduce this with the following code: import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
@Mapper
interface Issue197Mapper {
@Mapping(source="name", target="nom")
UserDto toDto(User user);
}
class UserDto {
public String nom;
}
class User {
String name;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
} |
1.7.0
I use Lombok to generate getters, sorry for no specifying this in the first place : import lombok.Getter;
@Getter
static class User {
private String name2;
} |
Yes, this is reproducible when using Lombok: I don't think we can fix this on our end. We just provide elements that can be renamed in the |
Thanks for the analysis @thunderhook. I'm also not sure what we can do. Perhaps this is some kind of a bug in the Lombok plugin. It works correctly when renaming a field (which triggers method rename) and renaming the getter directly |
When you rename User.name to lastName, the mapping becomes
@Mapping(source="getLastName", target="nom")
The text was updated successfully, but these errors were encountered: