File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
src/main/java/org/apache/ibatis/reflection Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -35,6 +35,15 @@ public class ParamNameResolver {
35
35
36
36
public static final String GENERIC_NAME_PREFIX = "param" ;
37
37
38
+ public static final String [] GENERIC_NAME_CACHE = new String [255 ];
39
+
40
+ static {
41
+ // the max length of java method parameter list is 255
42
+ for (int i = 0 ; i < 255 ; i ++) {
43
+ GENERIC_NAME_CACHE [i ] = GENERIC_NAME_PREFIX + (i + 1 );
44
+ }
45
+ }
46
+
38
47
private final boolean useActualParamName ;
39
48
40
49
/**
@@ -132,7 +141,7 @@ public Object getNamedParams(Object[] args) {
132
141
for (Map .Entry <Integer , String > entry : names .entrySet ()) {
133
142
param .put (entry .getValue (), args [entry .getKey ()]);
134
143
// add generic param names (param1, param2, ...)
135
- final String genericParamName = GENERIC_NAME_PREFIX + ( i + 1 ) ;
144
+ final String genericParamName = GENERIC_NAME_CACHE [ i ] ;
136
145
// ensure not to overwrite parameter named with @Param
137
146
if (!names .containsValue (genericParamName )) {
138
147
param .put (genericParamName , args [entry .getKey ()]);
You can’t perform that action at this time.
0 commit comments