#941 undesired too postfixes in local variable names

This commit is contained in:
sjaakd 2016-12-21 00:26:21 +01:00
parent ea6493d983
commit d1388c3a45
2 changed files with 11 additions and 7 deletions

View File

@ -90,23 +90,25 @@ public abstract class MappingMethod extends ModelElement {
} }
protected MappingMethod(Method method, List<Parameter> parameters) { protected MappingMethod(Method method, List<Parameter> parameters) {
this( method, parameters, method.getParameterNames(), null, null, Collections.<ForgedMethod>emptyList() ); this( method, parameters, new ArrayList<String>( method.getParameterNames() ), null, null,
Collections.<ForgedMethod>emptyList() );
} }
protected MappingMethod(Method method) { protected MappingMethod(Method method) {
this( method, method.getParameterNames(), null, null ); this( method, new ArrayList<String>( method.getParameterNames() ), null, null );
} }
protected MappingMethod(Method method, List<LifecycleCallbackMethodReference> beforeMappingReferences, protected MappingMethod(Method method, List<LifecycleCallbackMethodReference> beforeMappingReferences,
List<LifecycleCallbackMethodReference> afterMappingReferences) { List<LifecycleCallbackMethodReference> afterMappingReferences) {
this( method, method.getParameterNames(), beforeMappingReferences, afterMappingReferences ); this( method, new ArrayList<String>( method.getParameterNames() ), beforeMappingReferences,
afterMappingReferences );
} }
protected MappingMethod(Method method, List<LifecycleCallbackMethodReference> beforeMappingReferences, protected MappingMethod(Method method, List<LifecycleCallbackMethodReference> beforeMappingReferences,
List<LifecycleCallbackMethodReference> afterMappingReferences, List<LifecycleCallbackMethodReference> afterMappingReferences,
List<ForgedMethod> forgedMethods) { List<ForgedMethod> forgedMethods) {
this( method, method.getParameters(), method.getParameterNames(), beforeMappingReferences, this( method, method.getParameters(), new ArrayList<String>( method.getParameterNames() ),
afterMappingReferences, forgedMethods ); beforeMappingReferences, afterMappingReferences, forgedMethods );
} }
public MappingMethod(Method method, Collection<String> existingVariableNames, public MappingMethod(Method method, Collection<String> existingVariableNames,

View File

@ -314,11 +314,13 @@ public class SourceMethod implements Method {
@Override @Override
public List<String> getParameterNames() { public List<String> getParameterNames() {
if ( parameterNames == null ) { if ( parameterNames == null ) {
parameterNames = new ArrayList<String>( parameters.size() ); List<String> names = new ArrayList<String>( parameters.size() );
for ( Parameter parameter : parameters ) { for ( Parameter parameter : parameters ) {
parameterNames.add( parameter.getName() ); names.add( parameter.getName() );
} }
parameterNames = Collections.unmodifiableList( names );
} }
return parameterNames; return parameterNames;