@@ -234,8 +234,8 @@ public Class<?>[] determineValidationGroups(Object target, Method method) {
234
234
235
235
@ Override
236
236
public final MethodValidationResult validateArguments (
237
- Object target , Method method , @ Nullable MethodParameter [] parameters , Object [] arguments ,
238
- Class <?>[] groups ) {
237
+ Object target , Method method , @ Nullable MethodParameter [] parameters ,
238
+ Object [] arguments , Class <?>[] groups ) {
239
239
240
240
Set <ConstraintViolation <Object >> violations =
241
241
invokeValidatorForArguments (target , method , arguments , groups );
@@ -256,23 +256,21 @@ public final Set<ConstraintViolation<Object>> invokeValidatorForArguments(
256
256
Object target , Method method , Object [] arguments , Class <?>[] groups ) {
257
257
258
258
ExecutableValidator execVal = this .validator .get ().forExecutables ();
259
- Set <ConstraintViolation <Object >> violations ;
260
259
try {
261
- violations = execVal .validateParameters (target , method , arguments , groups );
260
+ return execVal .validateParameters (target , method , arguments , groups );
262
261
}
263
262
catch (IllegalArgumentException ex ) {
264
263
// Probably a generic type mismatch between interface and impl as reported in SPR-12237 / HV-1011
265
264
// Let's try to find the bridged method on the implementation class...
266
265
Method bridgedMethod = BridgeMethodResolver .getMostSpecificMethod (method , target .getClass ());
267
- violations = execVal .validateParameters (target , bridgedMethod , arguments , groups );
266
+ return execVal .validateParameters (target , bridgedMethod , arguments , groups );
268
267
}
269
- return violations ;
270
268
}
271
269
272
270
@ Override
273
271
public final MethodValidationResult validateReturnValue (
274
- Object target , Method method , @ Nullable MethodParameter returnType , @ Nullable Object returnValue ,
275
- Class <?>[] groups ) {
272
+ Object target , Method method , @ Nullable MethodParameter returnType ,
273
+ @ Nullable Object returnValue , Class <?>[] groups ) {
276
274
277
275
Set <ConstraintViolation <Object >> violations =
278
276
invokeValidatorForReturnValue (target , method , returnValue , groups );
@@ -305,9 +303,9 @@ private MethodValidationResult adaptViolations(
305
303
Map <Path .Node , ParamErrorsBuilder > nestedViolations = new LinkedHashMap <>();
306
304
307
305
for (ConstraintViolation <Object > violation : violations ) {
308
- Iterator <Path .Node > itr = violation .getPropertyPath ().iterator ();
309
- while (itr .hasNext ()) {
310
- Path .Node node = itr .next ();
306
+ Iterator <Path .Node > nodes = violation .getPropertyPath ().iterator ();
307
+ while (nodes .hasNext ()) {
308
+ Path .Node node = nodes .next ();
311
309
312
310
MethodParameter parameter ;
313
311
if (node .getKind ().equals (ElementKind .PARAMETER )) {
@@ -328,8 +326,8 @@ else if (node.getKind().equals(ElementKind.RETURN_VALUE)) {
328
326
// https://github.com/jakartaee/validation/issues/194
329
327
330
328
Path .Node parameterNode = node ;
331
- if (itr .hasNext ()) {
332
- node = itr .next ();
329
+ if (nodes .hasNext ()) {
330
+ node = nodes .next ();
333
331
}
334
332
335
333
Object value ;
@@ -425,7 +423,6 @@ public interface ObjectNameResolver {
425
423
* @return the name to use
426
424
*/
427
425
String resolveName (MethodParameter parameter , @ Nullable Object value );
428
-
429
426
}
430
427
431
428
@@ -456,6 +453,7 @@ private final class ParamValidationResultBuilder {
456
453
public ParamValidationResultBuilder (
457
454
Object target , MethodParameter parameter , @ Nullable Object value , @ Nullable Object container ,
458
455
@ Nullable Integer containerIndex , @ Nullable Object containerKey ) {
456
+
459
457
this .target = target ;
460
458
this .parameter = parameter ;
461
459
this .value = value ;
@@ -473,7 +471,6 @@ public ParameterValidationResult build() {
473
471
this .parameter , this .value , this .resolvableErrors , this .container ,
474
472
this .containerIndex , this .containerKey );
475
473
}
476
-
477
474
}
478
475
479
476
@@ -527,8 +524,7 @@ public ParameterErrors build() {
527
524
528
525
529
526
/**
530
- * Default algorithm to select an object name, as described in
531
- * {@link #setObjectNameResolver(ObjectNameResolver)}.
527
+ * Default algorithm to select an object name, as described in {@link #setObjectNameResolver}.
532
528
*/
533
529
private static class DefaultObjectNameResolver implements ObjectNameResolver {
534
530
0 commit comments