mirror of
https://github.com/mapstruct/mapstruct.git
synced 2025-07-12 00:00:08 +08:00
#921 Avoid generation of duplicate local variable name
This commit is contained in:
parent
d94d5857ce
commit
c36f4577ab
@ -388,8 +388,9 @@ public class PropertyMapping extends ModelElement {
|
||||
|
||||
private void useLocalVarWhenNested(Assignment rightHandSide) {
|
||||
if ( sourceReference.getPropertyEntries().size() > 1 ) {
|
||||
String sourceTypeName = rightHandSide.getSourceType().getName();
|
||||
String safeName = Strings.getSaveVariableName( sourceTypeName, existingVariableNames );
|
||||
String name = first( sourceReference.getPropertyEntries() ).getName();
|
||||
String safeName = Strings.getSaveVariableName( name, existingVariableNames );
|
||||
existingVariableNames.add( safeName );
|
||||
rightHandSide.setSourceLocalVarName( safeName );
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user