@@ -232,7 +232,6 @@ public int loadBeanDefinitions(Resource resource) throws BeanDefinitionStoreExce
232
232
* @return the number of bean definitions found
233
233
* @throws BeanDefinitionStoreException in case of loading or parsing errors
234
234
*/
235
- @ SuppressWarnings ("rawtypes" )
236
235
public int loadBeanDefinitions (EncodedResource encodedResource ) throws BeanDefinitionStoreException {
237
236
// Check for XML files and redirect them to the "standard" XmlBeanDefinitionReader
238
237
String filename = encodedResource .getResource ().getFilename ();
@@ -245,10 +244,10 @@ public int loadBeanDefinitions(EncodedResource encodedResource) throws BeanDefin
245
244
}
246
245
247
246
@ SuppressWarnings ("serial" )
248
- Closure beans = new Closure (this ) {
247
+ Closure < Object > beans = new Closure < Object > (this ) {
249
248
@ Override
250
249
public Object call (Object ... args ) {
251
- invokeBeanDefiningClosure ((Closure ) args [0 ]);
250
+ invokeBeanDefiningClosure ((Closure <?> ) args [0 ]);
252
251
return null ;
253
252
}
254
253
};
@@ -290,8 +289,7 @@ public void setVariable(String name, Object value) {
290
289
* @param closure the block or closure
291
290
* @return this {@code GroovyBeanDefinitionReader} instance
292
291
*/
293
- @ SuppressWarnings ("rawtypes" )
294
- public GroovyBeanDefinitionReader beans (Closure closure ) {
292
+ public GroovyBeanDefinitionReader beans (Closure <?> closure ) {
295
293
return invokeBeanDefiningClosure (closure );
296
294
}
297
295
@@ -312,29 +310,25 @@ public GenericBeanDefinition bean(Class<?> type) {
312
310
* @param args the constructors arguments and closure configurer
313
311
* @return the bean definition
314
312
*/
315
- @ SuppressWarnings ("rawtypes" )
316
313
public AbstractBeanDefinition bean (Class <?> type , Object ...args ) {
317
314
GroovyBeanDefinitionWrapper current = this .currentBeanDefinition ;
318
315
try {
319
- Closure callable = null ;
320
- Collection constructorArgs = null ;
316
+ Closure <?> callable = null ;
317
+ Collection < Object > constructorArgs = null ;
321
318
if (!ObjectUtils .isEmpty (args )) {
322
319
int index = args .length ;
323
320
Object lastArg = args [index - 1 ];
324
- if (lastArg instanceof Closure ) {
325
- callable = (Closure ) lastArg ;
321
+ if (lastArg instanceof Closure <?> ) {
322
+ callable = (Closure <?> ) lastArg ;
326
323
index --;
327
324
}
328
- if (index > -1 ) {
329
- constructorArgs = resolveConstructorArguments (args , 0 , index );
330
- }
325
+ constructorArgs = resolveConstructorArguments (args , 0 , index );
331
326
}
332
327
this .currentBeanDefinition = new GroovyBeanDefinitionWrapper (null , type , constructorArgs );
333
328
if (callable != null ) {
334
329
callable .call (this .currentBeanDefinition );
335
330
}
336
331
return this .currentBeanDefinition .getBeanDefinition ();
337
-
338
332
}
339
333
finally {
340
334
this .currentBeanDefinition = current ;
@@ -381,11 +375,10 @@ public void importBeans(String resourcePattern) throws IOException {
381
375
* takes a class argument.
382
376
*/
383
377
@ Override
384
- @ SuppressWarnings ("rawtypes" )
385
378
public Object invokeMethod (String name , Object arg ) {
386
379
Object [] args = (Object [])arg ;
387
380
if ("beans" .equals (name ) && args .length == 1 && args [0 ] instanceof Closure ) {
388
- return beans ((Closure ) args [0 ]);
381
+ return beans ((Closure <?> ) args [0 ]);
389
382
}
390
383
else if ("ref" .equals (name )) {
391
384
String refName ;
@@ -435,14 +428,13 @@ private boolean addDeferredProperty(String property, Object newValue) {
435
428
return false ;
436
429
}
437
430
438
- @ SuppressWarnings ("rawtypes" )
439
431
private void finalizeDeferredProperties () {
440
432
for (DeferredProperty dp : this .deferredProperties .values ()) {
441
433
if (dp .value instanceof List ) {
442
- dp .value = manageListIfNecessary ((List ) dp .value );
434
+ dp .value = manageListIfNecessary ((List <?> ) dp .value );
443
435
}
444
436
else if (dp .value instanceof Map ) {
445
- dp .value = manageMapIfNecessary ((Map ) dp .value );
437
+ dp .value = manageMapIfNecessary ((Map <?, ?> ) dp .value );
446
438
}
447
439
dp .apply ();
448
440
}
@@ -454,8 +446,7 @@ else if (dp.value instanceof Map) {
454
446
* @param callable the closure argument
455
447
* @return this {@code GroovyBeanDefinitionReader} instance
456
448
*/
457
- @ SuppressWarnings ("rawtypes" )
458
- protected GroovyBeanDefinitionReader invokeBeanDefiningClosure (Closure callable ) {
449
+ protected GroovyBeanDefinitionReader invokeBeanDefiningClosure (Closure <?> callable ) {
459
450
callable .setDelegate (this );
460
451
callable .call ();
461
452
finalizeDeferredProperties ();
@@ -469,7 +460,6 @@ protected GroovyBeanDefinitionReader invokeBeanDefiningClosure(Closure callable)
469
460
* argument is sometimes a closure. All the arguments in between are constructor arguments.
470
461
* @return the bean definition wrapper
471
462
*/
472
- @ SuppressWarnings ("rawtypes" )
473
463
private GroovyBeanDefinitionWrapper invokeBeanDefiningMethod (String beanName , Object [] args ) {
474
464
boolean hasClosureArgument = (args [args .length - 1 ] instanceof Closure );
475
465
if (args [0 ] instanceof Class ) {
@@ -495,9 +485,10 @@ else if (args[0] instanceof RuntimeBeanReference) {
495
485
else if (args [0 ] instanceof Map ) {
496
486
// named constructor arguments
497
487
if (args .length > 1 && args [1 ] instanceof Class ) {
498
- List <Object > constructorArgs = resolveConstructorArguments (args , 2 , hasClosureArgument ? args .length - 1 : args .length );
488
+ List <Object > constructorArgs =
489
+ resolveConstructorArguments (args , 2 , hasClosureArgument ? args .length - 1 : args .length );
499
490
this .currentBeanDefinition = new GroovyBeanDefinitionWrapper (beanName , (Class <?>) args [1 ], constructorArgs );
500
- Map namedArgs = (Map ) args [0 ];
491
+ Map <?, ?> namedArgs = (Map <?, ?> ) args [0 ];
501
492
for (Object o : namedArgs .keySet ()) {
502
493
String propName = (String ) o ;
503
494
setProperty (propName , namedArgs .get (propName ));
@@ -507,7 +498,7 @@ else if (args[0] instanceof Map) {
507
498
else {
508
499
this .currentBeanDefinition = new GroovyBeanDefinitionWrapper (beanName );
509
500
// First arg is the map containing factoryBean : factoryMethod
510
- Map .Entry factoryBeanEntry = (Map . Entry ) (( Map ) args [0 ]).entrySet ().iterator ().next ();
501
+ Map .Entry <?, ?> factoryBeanEntry = (( Map <?, ?> ) args [0 ]).entrySet ().iterator ().next ();
511
502
// If we have a closure body, that will be the last argument.
512
503
// In between are the constructor args
513
504
int constructorArgsTest = (hasClosureArgument ? 2 : 1 );
@@ -531,12 +522,13 @@ else if (args[0] instanceof Closure) {
531
522
this .currentBeanDefinition .getBeanDefinition ().setAbstract (true );
532
523
}
533
524
else {
534
- List constructorArgs = resolveConstructorArguments (args , 0 , hasClosureArgument ? args .length - 1 : args .length );
525
+ List <Object > constructorArgs =
526
+ resolveConstructorArguments (args , 0 , hasClosureArgument ? args .length - 1 : args .length );
535
527
this .currentBeanDefinition = new GroovyBeanDefinitionWrapper (beanName , null , constructorArgs );
536
528
}
537
529
538
530
if (hasClosureArgument ) {
539
- Closure callable = (Closure ) args [args .length - 1 ];
531
+ Closure <?> callable = (Closure <?> ) args [args .length - 1 ];
540
532
callable .setDelegate (this );
541
533
callable .setResolveStrategy (Closure .DELEGATE_FIRST );
542
534
callable .call (this .currentBeanDefinition );
@@ -549,18 +541,17 @@ else if (args[0] instanceof Closure) {
549
541
return beanDefinition ;
550
542
}
551
543
552
- @ SuppressWarnings ("rawtypes" )
553
544
protected List <Object > resolveConstructorArguments (Object [] args , int start , int end ) {
554
545
Object [] constructorArgs = Arrays .copyOfRange (args , start , end );
555
546
for (int i = 0 ; i < constructorArgs .length ; i ++) {
556
547
if (constructorArgs [i ] instanceof GString ) {
557
548
constructorArgs [i ] = constructorArgs [i ].toString ();
558
549
}
559
550
else if (constructorArgs [i ] instanceof List ) {
560
- constructorArgs [i ] = manageListIfNecessary ((List ) constructorArgs [i ]);
551
+ constructorArgs [i ] = manageListIfNecessary ((List <?> ) constructorArgs [i ]);
561
552
}
562
553
else if (constructorArgs [i ] instanceof Map ){
563
- constructorArgs [i ] = manageMapIfNecessary ((Map ) constructorArgs [i ]);
554
+ constructorArgs [i ] = manageMapIfNecessary ((Map <?, ?> ) constructorArgs [i ]);
564
555
}
565
556
}
566
557
return Arrays .asList (constructorArgs );
@@ -621,7 +612,6 @@ public void setProperty(String name, Object value) {
621
612
}
622
613
}
623
614
624
- @ SuppressWarnings ("rawtypes" )
625
615
protected void applyPropertyToBeanDefinition (String name , Object value ) {
626
616
if (value instanceof GString ) {
627
617
value = value .toString ();
@@ -632,7 +622,7 @@ protected void applyPropertyToBeanDefinition(String name, Object value) {
632
622
else if (value instanceof Closure ) {
633
623
GroovyBeanDefinitionWrapper current = this .currentBeanDefinition ;
634
624
try {
635
- Closure callable = (Closure ) value ;
625
+ Closure <?> callable = (Closure <?> ) value ;
636
626
Class <?> parameterType = callable .getParameterTypes ()[0 ];
637
627
if (Object .class == parameterType ) {
638
628
this .currentBeanDefinition = new GroovyBeanDefinitionWrapper ("" );
@@ -833,8 +823,8 @@ public boolean add(Object value) {
833
823
return retVal ;
834
824
}
835
825
836
- @ SuppressWarnings ({ "rawtypes" , " unused" } )
837
- public boolean addAll (Collection values ) {
826
+ @ SuppressWarnings (" unused" )
827
+ public boolean addAll (Collection <?> values ) {
838
828
boolean retVal = (Boolean ) InvokerHelper .invokeMethod (this .propertyValue , "addAll" , values );
839
829
for (Object value : values ) {
840
830
updateDeferredProperties (value );
0 commit comments