diff --git a/src/main/java/org/apache/ibatis/reflection/ParamNameResolver.java b/src/main/java/org/apache/ibatis/reflection/ParamNameResolver.java
index 942a7351844..87f5583ce44 100644
--- a/src/main/java/org/apache/ibatis/reflection/ParamNameResolver.java
+++ b/src/main/java/org/apache/ibatis/reflection/ParamNameResolver.java
@@ -35,6 +35,8 @@ public class ParamNameResolver {
public static final String GENERIC_NAME_PREFIX = "param";
+ private final boolean useActualParamName;
+
/**
*
* The key is the index and the value is the name of the parameter.
@@ -51,9 +53,9 @@ public class ParamNameResolver {
private final SortedMap names;
private boolean hasParamAnnotation;
- private boolean useActualParamName;
public ParamNameResolver(Configuration config, Method method) {
+ this.useActualParamName = config.isUseActualParamName();
final Class>[] paramTypes = method.getParameterTypes();
final Annotation[][] paramAnnotations = method.getParameterAnnotations();
final SortedMap map = new TreeMap<>();
@@ -74,15 +76,13 @@ public ParamNameResolver(Configuration config, Method method) {
}
if (name == null) {
// @Param was not specified.
- if (config.isUseActualParamName()) {
+ if (useActualParamName) {
name = getActualParamName(method, paramIndex);
}
if (name == null) {
// use the parameter index as the name ("0", "1", ...)
// gcode issue #71
name = String.valueOf(map.size());
- } else {
- useActualParamName = true;
}
}
map.put(paramIndex, name);