@@ -210,11 +210,11 @@ protected ValueRef getValueRef(ExpressionState state) throws EvaluationException
210
210
211
211
/**
212
212
* Generate code that handles building the argument values for the specified method.
213
- * This method will take account of whether the invoked method is a varargs method
213
+ * <p> This method will take into account whether the invoked method is a varargs method,
214
214
* and if it is then the argument values will be appropriately packaged into an array.
215
215
* @param mv the method visitor where code should be generated
216
216
* @param cf the current codeflow
217
- * @param member the method or constructor for which arguments are being setup
217
+ * @param member the method or constructor for which arguments are being set up
218
218
* @param arguments the expression nodes for the expression supplied argument values
219
219
*/
220
220
protected static void generateCodeForArguments (MethodVisitor mv , CodeFlow cf , Member member , SpelNodeImpl [] arguments ) {
@@ -237,15 +237,15 @@ protected static void generateCodeForArguments(MethodVisitor mv, CodeFlow cf, Me
237
237
238
238
// Fulfill all the parameter requirements except the last one
239
239
for (p = 0 ; p < paramDescriptors .length - 1 ; p ++) {
240
- generateCodeForArgument (mv , cf , arguments [p ], paramDescriptors [p ]);
240
+ cf . generateCodeForArgument (mv , arguments [p ], paramDescriptors [p ]);
241
241
}
242
242
243
243
SpelNodeImpl lastChild = (childCount == 0 ? null : arguments [childCount - 1 ]);
244
244
String arrayType = paramDescriptors [paramDescriptors .length - 1 ];
245
245
// Determine if the final passed argument is already suitably packaged in array
246
246
// form to be passed to the method
247
247
if (lastChild != null && arrayType .equals (lastChild .getExitDescriptor ())) {
248
- generateCodeForArgument (mv , cf , lastChild , paramDescriptors [p ]);
248
+ cf . generateCodeForArgument (mv , lastChild , paramDescriptors [p ]);
249
249
}
250
250
else {
251
251
arrayType = arrayType .substring (1 ); // trim the leading '[', may leave other '['
@@ -257,41 +257,28 @@ protected static void generateCodeForArguments(MethodVisitor mv, CodeFlow cf, Me
257
257
SpelNodeImpl child = arguments [p ];
258
258
mv .visitInsn (DUP );
259
259
CodeFlow .insertOptimalLoad (mv , arrayindex ++);
260
- generateCodeForArgument (mv , cf , child , arrayType );
260
+ cf . generateCodeForArgument (mv , child , arrayType );
261
261
CodeFlow .insertArrayStore (mv , arrayType );
262
262
p ++;
263
263
}
264
264
}
265
265
}
266
266
else {
267
267
for (int i = 0 ; i < paramDescriptors .length ;i ++) {
268
- generateCodeForArgument (mv , cf , arguments [i ], paramDescriptors [i ]);
268
+ cf . generateCodeForArgument (mv , arguments [i ], paramDescriptors [i ]);
269
269
}
270
270
}
271
271
}
272
272
273
273
/**
274
274
* Ask an argument to generate its bytecode and then follow it up
275
275
* with any boxing/unboxing/checkcasting to ensure it matches the expected parameter descriptor.
276
+ * @deprecated As of Spring Framework 6.2, in favor of
277
+ * {@link CodeFlow#generateCodeForArgument(MethodVisitor, SpelNode, String)}
276
278
*/
279
+ @ Deprecated (since = "6.2" )
277
280
protected static void generateCodeForArgument (MethodVisitor mv , CodeFlow cf , SpelNodeImpl argument , String paramDesc ) {
278
- cf .enterCompilationScope ();
279
- argument .generateCode (mv , cf );
280
- String lastDesc = cf .lastDescriptor ();
281
- Assert .state (lastDesc != null , "No last descriptor" );
282
- boolean primitiveOnStack = CodeFlow .isPrimitive (lastDesc );
283
- // Check if need to box it for the method reference?
284
- if (primitiveOnStack && paramDesc .charAt (0 ) == 'L' ) {
285
- CodeFlow .insertBoxIfNecessary (mv , lastDesc .charAt (0 ));
286
- }
287
- else if (paramDesc .length () == 1 && !primitiveOnStack ) {
288
- CodeFlow .insertUnboxInsns (mv , paramDesc .charAt (0 ), lastDesc );
289
- }
290
- else if (!paramDesc .equals (lastDesc )) {
291
- // This would be unnecessary in the case of subtyping (e.g. method takes Number but Integer passed in)
292
- CodeFlow .insertCheckCast (mv , paramDesc );
293
- }
294
- cf .exitCompilationScope ();
281
+ cf .generateCodeForArgument (mv , argument , paramDesc );
295
282
}
296
283
297
284
}
0 commit comments