We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Mapping: abstract JPAProduct productFromDto( Product dto, @Context Language language, @Context Shop shop );
abstract JPAProduct productFromDto( Product dto, @Context Language language, @Context Shop shop );
generates:
JPAProduct productFromDto(Product dto, Language language, Shop shop) { ... jPAProduct.setShop( shopToJPAShop( dto.getShop(), language, shop ) );
where the generated shopToJPAShop method has duplicate variable name: protected JPAShop shopToJPAShop(Shop shop, Language language, Shop shop) {
shopToJPAShop
protected JPAShop shopToJPAShop(Shop shop, Language language, Shop shop) {
Compile error: error: variable shop is already defined in method shopToJPAShop(Shop,Language,Shop)
error: variable shop is already defined in method shopToJPAShop(Shop,Language,Shop)
MapStruct version: 1.4.2.Final
The text was updated successfully, but these errors were encountered:
Workaround, add explicit mapping method: abstract JPAShop fromShop( Shop shop ); then this method will be used instead of the invalid generated one.
abstract JPAShop fromShop( Shop shop );
Sorry, something went wrong.
mapstruct#2478 Make sure that forged methods do not generate duplicat…
0250bd7
…e method parameters
Good catch @cdalexndr. There is a PR for fixing the problem.
Apart from adding an explicit method a workaround will be to change the name of the @Context parameter.
@Context
e.g
abstract JPAProduct productFromDto( Product dto, @Context Language language, @Context Shop contextShop );
aef4312
#2478 Make sure that forged methods do not generate duplicate method …
934a473
…parameters
filiphr
Successfully merging a pull request may close this issue.
Mapping:
abstract JPAProduct productFromDto( Product dto, @Context Language language, @Context Shop shop );
generates:
where the generated
shopToJPAShop
method has duplicate variable name:protected JPAShop shopToJPAShop(Shop shop, Language language, Shop shop) {
Compile error:
error: variable shop is already defined in method shopToJPAShop(Shop,Language,Shop)
MapStruct version: 1.4.2.Final
The text was updated successfully, but these errors were encountered: