Browse Source

Fix [rawtypes] compiler warnings

- Suppress rawtypes warnings for src/main
 - Enable rawtypes warnings for src/test

This commit attempts to to resolve all rawtypes problems across tests as
aggressively as possible, i.e. without regard for binary compatibility,
whereas main sources must be treated much more cautiously with an eye
toward compatibility.
pull/213/head
Chris Beams 13 years ago
parent
commit
8d2e125e7b
  1. 2
      spring-context/src/test/java/org/springframework/aop/config/MethodLocatingFactoryBeanTests.java
  2. 34
      spring-context/src/test/java/org/springframework/aop/framework/AbstractAopProxyTests.java
  3. 26
      spring-context/src/test/java/org/springframework/aop/framework/CglibProxyTests.java
  4. 10
      spring-context/src/test/java/org/springframework/aop/framework/JdkDynamicProxyTests.java
  5. 4
      spring-context/src/test/java/org/springframework/aop/framework/ProxyFactoryBeanTests.java
  6. 2
      spring-context/src/test/java/org/springframework/aop/scope/ScopedProxyTests.java
  7. 43
      spring-context/src/test/java/org/springframework/beans/IndexedTestBean.java
  8. 44
      spring-context/src/test/java/org/springframework/beans/TestBean.java
  9. 4
      spring-context/src/test/java/org/springframework/beans/factory/DummyFactory.java
  10. 18
      spring-context/src/test/java/org/springframework/beans/factory/HasMap.java
  11. 6
      spring-context/src/test/java/org/springframework/beans/factory/access/TestBean.java
  12. 8
      spring-context/src/test/java/org/springframework/beans/factory/config/SimpleMapScope.java
  13. 26
      spring-context/src/test/java/org/springframework/beans/factory/parsing/CollectingReaderEventListener.java
  14. 4
      spring-context/src/test/java/org/springframework/context/BeanThatListens.java
  15. 2
      spring-context/src/test/java/org/springframework/context/TestListener.java
  16. 2
      spring-context/src/test/java/org/springframework/context/annotation/CommonAnnotationBeanPostProcessorTests.java
  17. 2
      spring-context/src/test/java/org/springframework/context/annotation/SimpleConfigTests.java
  18. 2
      spring-context/src/test/java/org/springframework/context/annotation/configuration/ConfigurationClassProcessingTests.java
  19. 12
      spring-context/src/test/java/org/springframework/context/event/ApplicationContextEventTests.java
  20. 4
      spring-context/src/test/java/org/springframework/context/event/EventPublicationInterceptorTests.java
  21. 2
      spring-context/src/test/java/org/springframework/context/event/LifecycleEventTests.java
  22. 2
      spring-context/src/test/java/org/springframework/context/expression/ApplicationContextExpressionTests.java
  23. 5
      spring-context/src/test/java/org/springframework/context/support/ConversionServiceFactoryBeanTests.java
  24. 4
      spring-context/src/test/java/org/springframework/context/support/DefaultLifecycleProcessorTests.java
  25. 6
      spring-context/src/test/java/org/springframework/context/support/FactoryBeanAndApplicationListener.java
  26. 4
      spring-context/src/test/java/org/springframework/context/support/ResourceBundleMessageSourceTests.java
  27. 2
      spring-context/src/test/java/org/springframework/context/support/Spr7283Tests.java
  28. 2
      spring-context/src/test/java/org/springframework/context/support/StaticApplicationContextMulticasterTests.java
  29. 2
      spring-context/src/test/java/org/springframework/context/support/StaticApplicationContextTests.java
  30. 4
      spring-context/src/test/java/org/springframework/context/support/StaticMessageSourceTests.java
  31. 6
      spring-context/src/test/java/org/springframework/ejb/access/LocalSlsbInvokerInterceptorTests.java
  32. 2
      spring-context/src/test/java/org/springframework/ejb/access/SimpleRemoteSlsbInvokerInterceptorTests.java
  33. 2
      spring-context/src/test/java/org/springframework/jmx/export/MBeanExporterTests.java
  34. 2
      spring-context/src/test/java/org/springframework/jmx/export/assembler/AbstractMetadataAssemblerTests.java
  35. 2
      spring-context/src/test/java/org/springframework/jmx/export/assembler/InterfaceBasedMBeanInfoAssemblerCustomTests.java
  36. 2
      spring-context/src/test/java/org/springframework/jmx/export/assembler/InterfaceBasedMBeanInfoAssemblerMappedTests.java
  37. 18
      spring-context/src/test/java/org/springframework/remoting/rmi/RmiSupportTests.java
  38. 2
      spring-context/src/test/java/org/springframework/scheduling/timer/TimerSupportTests.java
  39. 14
      spring-context/src/test/java/org/springframework/scripting/bsh/BshScriptFactoryTests.java
  40. 8
      spring-context/src/test/java/org/springframework/scripting/groovy/GroovyClassLoadingTests.java
  41. 6
      spring-context/src/test/java/org/springframework/scripting/groovy/GroovyScriptFactoryTests.java
  42. 12
      spring-context/src/test/java/org/springframework/scripting/jruby/JRubyScriptFactoryTests.java
  43. 2
      spring-context/src/test/java/org/springframework/scripting/jruby/WrapperAdder.java
  44. 2
      spring-context/src/test/java/org/springframework/ui/ModelMapTests.java
  45. 6
      spring-context/src/test/java/org/springframework/validation/DataBinderFieldAccessTests.java
  46. 22
      spring-context/src/test/java/org/springframework/validation/DataBinderTests.java
  47. 4
      spring-context/src/test/java/org/springframework/validation/ValidationUtilsTests.java
  48. 2
      spring-context/src/test/java/org/springframework/validation/beanvalidation/ValidatorFactoryTests.java
  49. 8
      spring-core/src/test/java/org/springframework/core/ConventionsTests.java
  50. 23
      spring-core/src/test/java/org/springframework/core/LocalVariableTableParameterNameDiscovererTests.java
  51. 10
      spring-core/src/test/java/org/springframework/util/AssertTests.java
  52. 14
      spring-core/src/test/java/org/springframework/util/AutoPopulatingListTests.java
  53. 58
      spring-core/src/test/java/org/springframework/util/CollectionUtilsTests.java
  54. 16
      spring-core/src/test/java/org/springframework/util/MethodInvokerTests.java

2
spring-context/src/test/java/org/springframework/aop/config/MethodLocatingFactoryBeanTests.java

@ -106,6 +106,7 @@ public final class MethodLocatingFactoryBeanTests {
} }
@Test @Test
@SuppressWarnings({ "unchecked", "rawtypes" })
public void testSunnyDayPath() throws Exception { public void testSunnyDayPath() throws Exception {
expect((Class) beanFactory.getType(BEAN_NAME)).andReturn(String.class); expect((Class) beanFactory.getType(BEAN_NAME)).andReturn(String.class);
replay(beanFactory); replay(beanFactory);
@ -121,6 +122,7 @@ public final class MethodLocatingFactoryBeanTests {
} }
@Test(expected=IllegalArgumentException.class) @Test(expected=IllegalArgumentException.class)
@SuppressWarnings({ "unchecked", "rawtypes" })
public void testWhereMethodCannotBeResolved() { public void testWhereMethodCannotBeResolved() {
expect((Class) beanFactory.getType(BEAN_NAME)).andReturn(String.class); expect((Class) beanFactory.getType(BEAN_NAME)).andReturn(String.class);
replay(beanFactory); replay(beanFactory);

34
spring-context/src/test/java/org/springframework/aop/framework/AbstractAopProxyTests.java

@ -120,7 +120,7 @@ public abstract class AbstractAopProxyTests {
@Test @Test
public void testNoInterceptorsAndNoTarget() { public void testNoInterceptorsAndNoTarget() {
AdvisedSupport pc = new AdvisedSupport(new Class[] {ITestBean.class}); AdvisedSupport pc = new AdvisedSupport(new Class<?>[] {ITestBean.class});
// Add no interceptors // Add no interceptors
try { try {
AopProxy aop = createAopProxy(pc); AopProxy aop = createAopProxy(pc);
@ -418,7 +418,7 @@ public abstract class AbstractAopProxyTests {
return s; return s;
} }
}; };
AdvisedSupport pc = new AdvisedSupport(new Class[] {ITestBean.class}); AdvisedSupport pc = new AdvisedSupport(new Class<?>[] {ITestBean.class});
if (context) { if (context) {
pc.addAdvice(ExposeInvocationInterceptor.INSTANCE); pc.addAdvice(ExposeInvocationInterceptor.INSTANCE);
} }
@ -445,7 +445,7 @@ public abstract class AbstractAopProxyTests {
TestBean raw = new OwnSpouse(); TestBean raw = new OwnSpouse();
ProxyCreatorSupport pc = new ProxyCreatorSupport(); ProxyCreatorSupport pc = new ProxyCreatorSupport();
pc.setInterfaces(new Class[] {ITestBean.class}); pc.setInterfaces(new Class<?>[] {ITestBean.class});
pc.setTarget(raw); pc.setTarget(raw);
ITestBean tb = (ITestBean) createProxy(pc); ITestBean tb = (ITestBean) createProxy(pc);
@ -461,7 +461,7 @@ public abstract class AbstractAopProxyTests {
throw expectedException; throw expectedException;
} }
}; };
AdvisedSupport pc = new AdvisedSupport(new Class[] {ITestBean.class}); AdvisedSupport pc = new AdvisedSupport(new Class<?>[] {ITestBean.class});
pc.addAdvice(ExposeInvocationInterceptor.INSTANCE); pc.addAdvice(ExposeInvocationInterceptor.INSTANCE);
pc.addAdvice(mi); pc.addAdvice(mi);
@ -495,7 +495,7 @@ public abstract class AbstractAopProxyTests {
throw unexpectedException; throw unexpectedException;
} }
}; };
AdvisedSupport pc = new AdvisedSupport(new Class[] {ITestBean.class}); AdvisedSupport pc = new AdvisedSupport(new Class<?>[] {ITestBean.class});
pc.addAdvice(ExposeInvocationInterceptor.INSTANCE); pc.addAdvice(ExposeInvocationInterceptor.INSTANCE);
pc.addAdvice(mi); pc.addAdvice(mi);
@ -527,7 +527,7 @@ public abstract class AbstractAopProxyTests {
throw unexpectedException; throw unexpectedException;
} }
}; };
AdvisedSupport pc = new AdvisedSupport(new Class[] {ITestBean.class}); AdvisedSupport pc = new AdvisedSupport(new Class<?>[] {ITestBean.class});
pc.addAdvice(ExposeInvocationInterceptor.INSTANCE); pc.addAdvice(ExposeInvocationInterceptor.INSTANCE);
pc.addAdvice(mi); pc.addAdvice(mi);
@ -555,7 +555,7 @@ public abstract class AbstractAopProxyTests {
@Test @Test
public void testTargetCanGetInvocationEvenIfNoAdviceChain() throws Throwable { public void testTargetCanGetInvocationEvenIfNoAdviceChain() throws Throwable {
NeedsToSeeProxy target = new NeedsToSeeProxy(); NeedsToSeeProxy target = new NeedsToSeeProxy();
AdvisedSupport pc = new AdvisedSupport(new Class[] {INeedsToSeeProxy.class}); AdvisedSupport pc = new AdvisedSupport(new Class<?>[] {INeedsToSeeProxy.class});
pc.setTarget(target); pc.setTarget(target);
pc.setExposeProxy(true); pc.setExposeProxy(true);
@ -570,7 +570,7 @@ public abstract class AbstractAopProxyTests {
public void testTargetCanGetInvocation() throws Throwable { public void testTargetCanGetInvocation() throws Throwable {
final InvocationCheckExposedInvocationTestBean expectedTarget = new InvocationCheckExposedInvocationTestBean(); final InvocationCheckExposedInvocationTestBean expectedTarget = new InvocationCheckExposedInvocationTestBean();
AdvisedSupport pc = new AdvisedSupport(new Class[] {ITestBean.class, IOther.class}); AdvisedSupport pc = new AdvisedSupport(new Class<?>[] {ITestBean.class, IOther.class});
pc.addAdvice(ExposeInvocationInterceptor.INSTANCE); pc.addAdvice(ExposeInvocationInterceptor.INSTANCE);
TrapTargetInterceptor tii = new TrapTargetInterceptor() { TrapTargetInterceptor tii = new TrapTargetInterceptor() {
public Object invoke(MethodInvocation invocation) throws Throwable { public Object invoke(MethodInvocation invocation) throws Throwable {
@ -615,7 +615,7 @@ public abstract class AbstractAopProxyTests {
@Test @Test
public void testMixinWithIntroductionAdvisor() throws Throwable { public void testMixinWithIntroductionAdvisor() throws Throwable {
TestBean tb = new TestBean(); TestBean tb = new TestBean();
ProxyFactory pc = new ProxyFactory(new Class[] {ITestBean.class}); ProxyFactory pc = new ProxyFactory(new Class<?>[] {ITestBean.class});
pc.addAdvisor(new LockMixinAdvisor()); pc.addAdvisor(new LockMixinAdvisor());
pc.setTarget(tb); pc.setTarget(tb);
@ -625,7 +625,7 @@ public abstract class AbstractAopProxyTests {
@Test @Test
public void testMixinWithIntroductionInfo() throws Throwable { public void testMixinWithIntroductionInfo() throws Throwable {
TestBean tb = new TestBean(); TestBean tb = new TestBean();
ProxyFactory pc = new ProxyFactory(new Class[] {ITestBean.class}); ProxyFactory pc = new ProxyFactory(new Class<?>[] {ITestBean.class});
// We don't use an IntroductionAdvisor, we can just add an advice that implements IntroductionInfo // We don't use an IntroductionAdvisor, we can just add an advice that implements IntroductionInfo
pc.addAdvice(new LockMixin()); pc.addAdvice(new LockMixin());
pc.setTarget(tb); pc.setTarget(tb);
@ -664,7 +664,7 @@ public abstract class AbstractAopProxyTests {
@Test @Test
public void testReplaceArgument() throws Throwable { public void testReplaceArgument() throws Throwable {
TestBean tb = new TestBean(); TestBean tb = new TestBean();
ProxyFactory pc = new ProxyFactory(new Class[] {ITestBean.class}); ProxyFactory pc = new ProxyFactory(new Class<?>[] {ITestBean.class});
pc.setTarget(tb); pc.setTarget(tb);
pc.addAdvisor(new StringSetterNullReplacementAdvice()); pc.addAdvisor(new StringSetterNullReplacementAdvice());
@ -952,7 +952,7 @@ public abstract class AbstractAopProxyTests {
public void testProxyConfigString() { public void testProxyConfigString() {
TestBean target = new TestBean(); TestBean target = new TestBean();
ProxyFactory pc = new ProxyFactory(target); ProxyFactory pc = new ProxyFactory(target);
pc.setInterfaces(new Class[] {ITestBean.class}); pc.setInterfaces(new Class<?>[] {ITestBean.class});
pc.addAdvice(new NopInterceptor()); pc.addAdvice(new NopInterceptor());
MethodBeforeAdvice mba = new CountingBeforeAdvice(); MethodBeforeAdvice mba = new CountingBeforeAdvice();
Advisor advisor = new DefaultPointcutAdvisor(new NameMatchMethodPointcut(), mba); Advisor advisor = new DefaultPointcutAdvisor(new NameMatchMethodPointcut(), mba);
@ -968,7 +968,7 @@ public abstract class AbstractAopProxyTests {
public void testCanPreventCastToAdvisedUsingOpaque() { public void testCanPreventCastToAdvisedUsingOpaque() {
TestBean target = new TestBean(); TestBean target = new TestBean();
ProxyFactory pc = new ProxyFactory(target); ProxyFactory pc = new ProxyFactory(target);
pc.setInterfaces(new Class[] {ITestBean.class}); pc.setInterfaces(new Class<?>[] {ITestBean.class});
pc.addAdvice(new NopInterceptor()); pc.addAdvice(new NopInterceptor());
CountingBeforeAdvice mba = new CountingBeforeAdvice(); CountingBeforeAdvice mba = new CountingBeforeAdvice();
Advisor advisor = new DefaultPointcutAdvisor(new NameMatchMethodPointcut().addMethodName("setAge"), mba); Advisor advisor = new DefaultPointcutAdvisor(new NameMatchMethodPointcut().addMethodName("setAge"), mba);
@ -1069,7 +1069,7 @@ public abstract class AbstractAopProxyTests {
@Test @Test
public void testDynamicMethodPointcutThatAlwaysAppliesStatically() throws Throwable { public void testDynamicMethodPointcutThatAlwaysAppliesStatically() throws Throwable {
TestBean tb = new TestBean(); TestBean tb = new TestBean();
ProxyFactory pc = new ProxyFactory(new Class[] {ITestBean.class}); ProxyFactory pc = new ProxyFactory(new Class<?>[] {ITestBean.class});
TestDynamicPointcutAdvice dp = new TestDynamicPointcutAdvice(new NopInterceptor(), "getAge"); TestDynamicPointcutAdvice dp = new TestDynamicPointcutAdvice(new NopInterceptor(), "getAge");
pc.addAdvisor(dp); pc.addAdvisor(dp);
pc.setTarget(tb); pc.setTarget(tb);
@ -1085,7 +1085,7 @@ public abstract class AbstractAopProxyTests {
@Test @Test
public void testDynamicMethodPointcutThatAppliesStaticallyOnlyToSetters() throws Throwable { public void testDynamicMethodPointcutThatAppliesStaticallyOnlyToSetters() throws Throwable {
TestBean tb = new TestBean(); TestBean tb = new TestBean();
ProxyFactory pc = new ProxyFactory(new Class[] {ITestBean.class}); ProxyFactory pc = new ProxyFactory(new Class<?>[] {ITestBean.class});
// Could apply dynamically to getAge/setAge but not to getName // Could apply dynamically to getAge/setAge but not to getName
TestDynamicPointcutForSettersOnly dp = new TestDynamicPointcutForSettersOnly(new NopInterceptor(), "Age"); TestDynamicPointcutForSettersOnly dp = new TestDynamicPointcutForSettersOnly(new NopInterceptor(), "Age");
pc.addAdvisor(dp); pc.addAdvisor(dp);
@ -1107,7 +1107,7 @@ public abstract class AbstractAopProxyTests {
@Test @Test
public void testStaticMethodPointcut() throws Throwable { public void testStaticMethodPointcut() throws Throwable {
TestBean tb = new TestBean(); TestBean tb = new TestBean();
ProxyFactory pc = new ProxyFactory(new Class[] {ITestBean.class}); ProxyFactory pc = new ProxyFactory(new Class<?>[] {ITestBean.class});
NopInterceptor di = new NopInterceptor(); NopInterceptor di = new NopInterceptor();
TestStaticPointcutAdvice sp = new TestStaticPointcutAdvice(di, "getAge"); TestStaticPointcutAdvice sp = new TestStaticPointcutAdvice(di, "getAge");
pc.addAdvisor(sp); pc.addAdvisor(sp);
@ -1353,7 +1353,7 @@ public abstract class AbstractAopProxyTests {
return invocation.proceed(); return invocation.proceed();
} }
}; };
AdvisedSupport pc = new AdvisedSupport(new Class[] {ITestBean.class}); AdvisedSupport pc = new AdvisedSupport(new Class<?>[] {ITestBean.class});
MapAwareMethodInterceptor mami1 = new MapAwareMethodInterceptor(new HashMap<String, String>(), new HashMap<String, String>()); MapAwareMethodInterceptor mami1 = new MapAwareMethodInterceptor(new HashMap<String, String>(), new HashMap<String, String>());
Map<String, String> firstValuesToAdd = new HashMap<String, String>(); Map<String, String> firstValuesToAdd = new HashMap<String, String>();
firstValuesToAdd.put("test", ""); firstValuesToAdd.put("test", "");

26
spring-context/src/test/java/org/springframework/aop/framework/CglibProxyTests.java

@ -87,7 +87,7 @@ public final class CglibProxyTests extends AbstractAopProxyTests implements Seri
@Test @Test
public void testNoTarget() { public void testNoTarget() {
AdvisedSupport pc = new AdvisedSupport(new Class[]{ITestBean.class}); AdvisedSupport pc = new AdvisedSupport(new Class<?>[]{ITestBean.class});
pc.addAdvice(new NopInterceptor()); pc.addAdvice(new NopInterceptor());
try { try {
AopProxy aop = createAopProxy(pc); AopProxy aop = createAopProxy(pc);
@ -104,7 +104,7 @@ public final class CglibProxyTests extends AbstractAopProxyTests implements Seri
ProtectedMethodTestBean bean = new ProtectedMethodTestBean(); ProtectedMethodTestBean bean = new ProtectedMethodTestBean();
mockTargetSource.setTarget(bean); mockTargetSource.setTarget(bean);
AdvisedSupport as = new AdvisedSupport(new Class[]{}); AdvisedSupport as = new AdvisedSupport(new Class<?>[]{});
as.setTargetSource(mockTargetSource); as.setTargetSource(mockTargetSource);
as.addAdvice(new NopInterceptor()); as.addAdvice(new NopInterceptor());
AopProxy aop = new CglibAopProxy(as); AopProxy aop = new CglibAopProxy(as);
@ -158,7 +158,7 @@ public final class CglibProxyTests extends AbstractAopProxyTests implements Seri
CglibTestBean bean = new CglibTestBean(); CglibTestBean bean = new CglibTestBean();
bean.setName("Rob Harrop"); bean.setName("Rob Harrop");
AdvisedSupport as = new AdvisedSupport(new Class[]{}); AdvisedSupport as = new AdvisedSupport(new Class<?>[]{});
as.setTarget(bean); as.setTarget(bean);
as.addAdvice(new NopInterceptor()); as.addAdvice(new NopInterceptor());
AopProxy aop = new CglibAopProxy(as); AopProxy aop = new CglibAopProxy(as);
@ -174,7 +174,7 @@ public final class CglibProxyTests extends AbstractAopProxyTests implements Seri
CglibTestBean target = new CglibTestBean(); CglibTestBean target = new CglibTestBean();
target.setName("Rob Harrop"); target.setName("Rob Harrop");
AdvisedSupport pc = new AdvisedSupport(new Class[]{}); AdvisedSupport pc = new AdvisedSupport(new Class<?>[]{});
pc.setFrozen(true); pc.setFrozen(true);
pc.setTarget(target); pc.setTarget(target);
@ -202,7 +202,7 @@ public final class CglibProxyTests extends AbstractAopProxyTests implements Seri
} }
private ITestBean getAdvisedProxy(TestBean target) { private ITestBean getAdvisedProxy(TestBean target) {
ProxyFactory pf = new ProxyFactory(new Class[]{ITestBean.class}); ProxyFactory pf = new ProxyFactory(new Class<?>[]{ITestBean.class});
pf.setProxyTargetClass(true); pf.setProxyTargetClass(true);
MethodInterceptor advice = new NopInterceptor(); MethodInterceptor advice = new NopInterceptor();
@ -241,7 +241,7 @@ public final class CglibProxyTests extends AbstractAopProxyTests implements Seri
} }
private ITestBean getIntroductionAdvisorProxy(TestBean target) { private ITestBean getIntroductionAdvisorProxy(TestBean target) {
ProxyFactory pf = new ProxyFactory(new Class[]{ITestBean.class}); ProxyFactory pf = new ProxyFactory(new Class<?>[]{ITestBean.class});
pf.setProxyTargetClass(true); pf.setProxyTargetClass(true);
pf.addAdvisor(new LockMixinAdvisor()); pf.addAdvisor(new LockMixinAdvisor());
@ -258,11 +258,11 @@ public final class CglibProxyTests extends AbstractAopProxyTests implements Seri
target.reset(); target.reset();
mockTargetSource.setTarget(target); mockTargetSource.setTarget(target);
AdvisedSupport pc = new AdvisedSupport(new Class[]{}); AdvisedSupport pc = new AdvisedSupport(new Class<?>[]{});
pc.setTargetSource(mockTargetSource); pc.setTargetSource(mockTargetSource);
CglibAopProxy aop = new CglibAopProxy(pc); CglibAopProxy aop = new CglibAopProxy(pc);
aop.setConstructorArguments(new Object[] {"Rob Harrop", new Integer(22)}, aop.setConstructorArguments(new Object[] {"Rob Harrop", new Integer(22)},
new Class[] {String.class, int.class}); new Class<?>[] {String.class, int.class});
NoArgCtorTestBean proxy = (NoArgCtorTestBean) aop.getProxy(); NoArgCtorTestBean proxy = (NoArgCtorTestBean) aop.getProxy();
proxy = (NoArgCtorTestBean) aop.getProxy(); proxy = (NoArgCtorTestBean) aop.getProxy();
@ -275,7 +275,7 @@ public final class CglibProxyTests extends AbstractAopProxyTests implements Seri
ITestBean target = new TestBean(); ITestBean target = new TestBean();
mockTargetSource.setTarget(target); mockTargetSource.setTarget(target);
AdvisedSupport as = new AdvisedSupport(new Class[]{}); AdvisedSupport as = new AdvisedSupport(new Class<?>[]{});
as.setTargetSource(mockTargetSource); as.setTargetSource(mockTargetSource);
as.addAdvice(new NopInterceptor()); as.addAdvice(new NopInterceptor());
CglibAopProxy cglib = new CglibAopProxy(as); CglibAopProxy cglib = new CglibAopProxy(as);
@ -283,7 +283,7 @@ public final class CglibProxyTests extends AbstractAopProxyTests implements Seri
ITestBean proxy1 = (ITestBean) cglib.getProxy(); ITestBean proxy1 = (ITestBean) cglib.getProxy();
mockTargetSource.setTarget(proxy1); mockTargetSource.setTarget(proxy1);
as = new AdvisedSupport(new Class[]{}); as = new AdvisedSupport(new Class<?>[]{});
as.setTargetSource(mockTargetSource); as.setTargetSource(mockTargetSource);
as.addAdvice(new NopInterceptor()); as.addAdvice(new NopInterceptor());
cglib = new CglibAopProxy(as); cglib = new CglibAopProxy(as);
@ -296,7 +296,7 @@ public final class CglibProxyTests extends AbstractAopProxyTests implements Seri
ITestBean target = new TestBean(); ITestBean target = new TestBean();
mockTargetSource.setTarget(target); mockTargetSource.setTarget(target);
AdvisedSupport as = new AdvisedSupport(new Class[]{}); AdvisedSupport as = new AdvisedSupport(new Class<?>[]{});
as.setTargetSource(mockTargetSource); as.setTargetSource(mockTargetSource);
as.addAdvice(new NopInterceptor()); as.addAdvice(new NopInterceptor());
as.addInterface(Serializable.class); as.addInterface(Serializable.class);
@ -305,7 +305,7 @@ public final class CglibProxyTests extends AbstractAopProxyTests implements Seri
ITestBean proxy1 = (ITestBean) cglib.getProxy(); ITestBean proxy1 = (ITestBean) cglib.getProxy();
mockTargetSource.setTarget(proxy1); mockTargetSource.setTarget(proxy1);
as = new AdvisedSupport(new Class[]{}); as = new AdvisedSupport(new Class<?>[]{});
as.setTargetSource(mockTargetSource); as.setTargetSource(mockTargetSource);
as.addAdvice(new NopInterceptor()); as.addAdvice(new NopInterceptor());
cglib = new CglibAopProxy(as); cglib = new CglibAopProxy(as);
@ -319,7 +319,7 @@ public final class CglibProxyTests extends AbstractAopProxyTests implements Seri
ExceptionThrower bean = new ExceptionThrower(); ExceptionThrower bean = new ExceptionThrower();
mockTargetSource.setTarget(bean); mockTargetSource.setTarget(bean);
AdvisedSupport as = new AdvisedSupport(new Class[]{}); AdvisedSupport as = new AdvisedSupport(new Class<?>[]{});
as.setTargetSource(mockTargetSource); as.setTargetSource(mockTargetSource);
as.addAdvice(new NopInterceptor()); as.addAdvice(new NopInterceptor());
AopProxy aop = new CglibAopProxy(as); AopProxy aop = new CglibAopProxy(as);

10
spring-context/src/test/java/org/springframework/aop/framework/JdkDynamicProxyTests.java

@ -66,7 +66,7 @@ public final class JdkDynamicProxyTests extends AbstractAopProxyTests implements
public void testProxyIsJustInterface() throws Throwable { public void testProxyIsJustInterface() throws Throwable {
TestBean raw = new TestBean(); TestBean raw = new TestBean();
raw.setAge(32); raw.setAge(32);
AdvisedSupport pc = new AdvisedSupport(new Class[] {ITestBean.class}); AdvisedSupport pc = new AdvisedSupport(new Class<?>[] {ITestBean.class});
pc.setTarget(raw); pc.setTarget(raw);
JdkDynamicAopProxy aop = new JdkDynamicAopProxy(pc); JdkDynamicAopProxy aop = new JdkDynamicAopProxy(pc);
@ -80,7 +80,7 @@ public final class JdkDynamicProxyTests extends AbstractAopProxyTests implements
int age = 25; int age = 25;
MethodInterceptor mi = createMock(MethodInterceptor.class); MethodInterceptor mi = createMock(MethodInterceptor.class);
AdvisedSupport pc = new AdvisedSupport(new Class[] { ITestBean.class }); AdvisedSupport pc = new AdvisedSupport(new Class<?>[] { ITestBean.class });
pc.addAdvice(mi); pc.addAdvice(mi);
AopProxy aop = createAopProxy(pc); AopProxy aop = createAopProxy(pc);
@ -101,7 +101,7 @@ public final class JdkDynamicProxyTests extends AbstractAopProxyTests implements
} }
}; };
AdvisedSupport pc = new AdvisedSupport(new Class[] { ITestBean.class, IOther.class }); AdvisedSupport pc = new AdvisedSupport(new Class<?>[] { ITestBean.class, IOther.class });
pc.addAdvice(ExposeInvocationInterceptor.INSTANCE); pc.addAdvice(ExposeInvocationInterceptor.INSTANCE);
TrapTargetInterceptor tii = new TrapTargetInterceptor() { TrapTargetInterceptor tii = new TrapTargetInterceptor() {
public Object invoke(MethodInvocation invocation) throws Throwable { public Object invoke(MethodInvocation invocation) throws Throwable {
@ -130,7 +130,7 @@ public final class JdkDynamicProxyTests extends AbstractAopProxyTests implements
public void testProxyNotWrappedIfIncompatible() { public void testProxyNotWrappedIfIncompatible() {
FooBar bean = new FooBar(); FooBar bean = new FooBar();
ProxyCreatorSupport as = new ProxyCreatorSupport(); ProxyCreatorSupport as = new ProxyCreatorSupport();
as.setInterfaces(new Class[] {Foo.class}); as.setInterfaces(new Class<?>[] {Foo.class});
as.setTarget(bean); as.setTarget(bean);
Foo proxy = (Foo) createProxy(as); Foo proxy = (Foo) createProxy(as);
@ -140,7 +140,7 @@ public final class JdkDynamicProxyTests extends AbstractAopProxyTests implements
} }
public void testEqualsAndHashCodeDefined() throws Exception { public void testEqualsAndHashCodeDefined() throws Exception {
AdvisedSupport as = new AdvisedSupport(new Class[]{Named.class}); AdvisedSupport as = new AdvisedSupport(new Class<?>[]{Named.class});
as.setTarget(new Person()); as.setTarget(new Person());
JdkDynamicAopProxy aopProxy = new JdkDynamicAopProxy(as); JdkDynamicAopProxy aopProxy = new JdkDynamicAopProxy(as);
Named proxy = (Named) aopProxy.getProxy(); Named proxy = (Named) aopProxy.getProxy();

4
spring-context/src/test/java/org/springframework/aop/framework/ProxyFactoryBeanTests.java

@ -539,7 +539,7 @@ public final class ProxyFactoryBeanTests {
// 2 globals + 2 explicit // 2 globals + 2 explicit
assertEquals("Have 2 globals and 2 explicit advisors", 3, pfb.getAdvisors().length); assertEquals("Have 2 globals and 2 explicit advisors", 3, pfb.getAdvisors().length);
ApplicationListener l = (ApplicationListener) factory.getBean("validGlobals"); ApplicationListener<?> l = (ApplicationListener<?>) factory.getBean("validGlobals");
agi = (AddedGlobalInterface) l; agi = (AddedGlobalInterface) l;
assertTrue(agi.globalsAdded() == -1); assertTrue(agi.globalsAdded() == -1);
@ -760,7 +760,7 @@ public final class ProxyFactoryBeanTests {
} }
public Class<?>[] getInterfaces() { public Class<?>[] getInterfaces() {
return new Class[] { AddedGlobalInterface.class }; return new Class<?>[] { AddedGlobalInterface.class };
} }
public boolean isPerInstance() { public boolean isPerInstance() {

2
spring-context/src/test/java/org/springframework/aop/scope/ScopedProxyTests.java

@ -126,7 +126,7 @@ public class ScopedProxyTests {
assertTrue(scope.getMap().containsKey("scopedTarget.scopedList")); assertTrue(scope.getMap().containsKey("scopedTarget.scopedList"));
assertEquals(ArrayList.class, scope.getMap().get("scopedTarget.scopedList").getClass()); assertEquals(ArrayList.class, scope.getMap().get("scopedTarget.scopedList").getClass());
ArrayList deserialized = (ArrayList) SerializationTestUtils.serializeAndDeserialize(tb.getFriends()); ArrayList<?> deserialized = (ArrayList<?>) SerializationTestUtils.serializeAndDeserialize(tb.getFriends());
assertNotNull(deserialized); assertNotNull(deserialized);
assertTrue(AopUtils.isCglibProxy(deserialized)); assertTrue(AopUtils.isCglibProxy(deserialized));
assertTrue(deserialized.contains("myFriend")); assertTrue(deserialized.contains("myFriend"));

43
spring-context/src/test/java/org/springframework/beans/IndexedTestBean.java

@ -34,17 +34,17 @@ public class IndexedTestBean {
private TestBean[] array; private TestBean[] array;
private Collection collection; private Collection<?> collection;
private List list; private List<TestBean> list;
private Set set; private Set<TestBean> set;
private SortedSet sortedSet; private SortedSet<?> sortedSet;
private Map map; private Map<String, Object> map;
private SortedMap sortedMap; private SortedMap<?, ?> sortedMap;
public IndexedTestBean() { public IndexedTestBean() {
@ -69,17 +69,17 @@ public class IndexedTestBean {
TestBean tbX = new TestBean("nameX", 0); TestBean tbX = new TestBean("nameX", 0);
TestBean tbY = new TestBean("nameY", 0); TestBean tbY = new TestBean("nameY", 0);
this.array = new TestBean[] {tb0, tb1}; this.array = new TestBean[] {tb0, tb1};
this.list = new ArrayList(); this.list = new ArrayList<>();
this.list.add(tb2); this.list.add(tb2);
this.list.add(tb3); this.list.add(tb3);
this.set = new TreeSet(); this.set = new TreeSet<>();
this.set.add(tb6); this.set.add(tb6);
this.set.add(tb7); this.set.add(tb7);
this.map = new HashMap(); this.map = new HashMap<>();
this.map.put("key1", tb4); this.map.put("key1", tb4);
this.map.put("key2", tb5); this.map.put("key2", tb5);
this.map.put("key.3", tb5); this.map.put("key.3", tb5);
List list = new ArrayList(); List<Object> list = new ArrayList<>();
list.add(tbX); list.add(tbX);
list.add(tbY); list.add(tbY);
this.map.put("key4", list); this.map.put("key4", list);
@ -94,51 +94,52 @@ public class IndexedTestBean {
this.array = array; this.array = array;
} }
public Collection getCollection() { public Collection<?> getCollection() {
return collection; return collection;
} }
public void setCollection(Collection collection) { public void setCollection(Collection<?> collection) {
this.collection = collection; this.collection = collection;
} }
public List getList() { public List<TestBean> getList() {
return list; return list;
} }
public void setList(List list) { public void setList(List<TestBean> list) {
this.list = list; this.list = list;
} }
public Set getSet() { public Set<TestBean> getSet() {
return set; return set;
} }
@SuppressWarnings({ "rawtypes", "unchecked" })
public void setSet(Set set) { public void setSet(Set set) {
this.set = set; this.set = set;
} }
public SortedSet getSortedSet() { public SortedSet<?> getSortedSet() {
return sortedSet; return sortedSet;
} }
public void setSortedSet(SortedSet sortedSet) { public void setSortedSet(SortedSet<?> sortedSet) {
this.sortedSet = sortedSet; this.sortedSet = sortedSet;
} }
public Map getMap() { public Map<String, Object> getMap() {
return map; return map;
} }
public void setMap(Map map) { public void setMap(Map<String, Object> map) {
this.map = map; this.map = map;
} }
public SortedMap getSortedMap() { public SortedMap<?, ?> getSortedMap() {
return sortedMap; return sortedMap;
} }
public void setSortedMap(SortedMap sortedMap) { public void setSortedMap(SortedMap<?, ?> sortedMap) {
this.sortedMap = sortedMap; this.sortedMap = sortedMap;
} }

44
spring-context/src/test/java/org/springframework/beans/TestBean.java

@ -40,7 +40,7 @@ import org.springframework.util.ObjectUtils;
* @author Juergen Hoeller * @author Juergen Hoeller
* @since 15 April 2001 * @since 15 April 2001
*/ */
public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOther, Comparable { public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOther, Comparable<Object> {
private String beanName; private String beanName;
@ -70,13 +70,13 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
private Float myFloat = new Float(0.0); private Float myFloat = new Float(0.0);
private Collection friends = new LinkedList(); private Collection<? super Object> friends = new LinkedList<>();
private Set someSet = new HashSet(); private Set<?> someSet = new HashSet<>();
private Map someMap = new HashMap(); private Map<?, ?> someMap = new HashMap<>();
private List someList = new ArrayList(); private List<?> someList = new ArrayList<>();
private Properties someProperties = new Properties(); private Properties someProperties = new Properties();
@ -94,9 +94,9 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
private Boolean someBoolean; private Boolean someBoolean;
private List otherColours; private List<?> otherColours;
private List pets; private List<?> pets;
public TestBean() { public TestBean() {
@ -120,15 +120,15 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
this.someProperties = someProperties; this.someProperties = someProperties;
} }
public TestBean(List someList) { public TestBean(List<?> someList) {
this.someList = someList; this.someList = someList;
} }
public TestBean(Set someSet) { public TestBean(Set<?> someSet) {
this.someSet = someSet; this.someSet = someSet;
} }
public TestBean(Map someMap) { public TestBean(Map<?, ?> someMap) {
this.someMap = someMap; this.someMap = someMap;
} }
@ -262,35 +262,35 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
this.myFloat = myFloat; this.myFloat = myFloat;
} }
public Collection getFriends() { public Collection<? super Object> getFriends() {
return friends; return friends;
} }
public void setFriends(Collection friends) { public void setFriends(Collection<? super Object> friends) {
this.friends = friends; this.friends = friends;
} }
public Set getSomeSet() { public Set<?> getSomeSet() {
return someSet; return someSet;
} }
public void setSomeSet(Set someSet) { public void setSomeSet(Set<?> someSet) {
this.someSet = someSet; this.someSet = someSet;
} }
public Map getSomeMap() { public Map<?, ?> getSomeMap() {
return someMap; return someMap;
} }
public void setSomeMap(Map someMap) { public void setSomeMap(Map<?, ?> someMap) {
this.someMap = someMap; this.someMap = someMap;
} }
public List getSomeList() { public List<?> getSomeList() {
return someList; return someList;
} }
public void setSomeList(List someList) { public void setSomeList(List<?> someList) {
this.someList = someList; this.someList = someList;
} }
@ -350,19 +350,19 @@ public class TestBean implements BeanNameAware, BeanFactoryAware, ITestBean, IOt
this.nestedIndexedBean = nestedIndexedBean; this.nestedIndexedBean = nestedIndexedBean;
} }
public List getOtherColours() { public List<?> getOtherColours() {
return otherColours; return otherColours;
} }
public void setOtherColours(List otherColours) { public void setOtherColours(List<?> otherColours) {
this.otherColours = otherColours; this.otherColours = otherColours;
} }
public List getPets() { public List<?> getPets() {
return pets; return pets;
} }
public void setPets(List pets) { public void setPets(List<?> pets) {
this.pets = pets; this.pets = pets;
} }

4
spring-context/src/test/java/org/springframework/beans/factory/DummyFactory.java

@ -32,7 +32,7 @@ import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
* @since 10.03.2003 * @since 10.03.2003
*/ */
public class DummyFactory public class DummyFactory
implements FactoryBean, BeanNameAware, BeanFactoryAware, InitializingBean, DisposableBean { implements FactoryBean<Object>, BeanNameAware, BeanFactoryAware, InitializingBean, DisposableBean {
public static final String SINGLETON_NAME = "Factory singleton"; public static final String SINGLETON_NAME = "Factory singleton";
@ -158,7 +158,7 @@ public class DummyFactory
} }
} }
public Class getObjectType() { public Class<TestBean> getObjectType() {
return TestBean.class; return TestBean.class;
} }

18
spring-context/src/test/java/org/springframework/beans/factory/HasMap.java

@ -28,34 +28,34 @@ import java.util.Set;
*/ */
public class HasMap { public class HasMap {
private Map map; private Map<?, ?> map;
private Set set; private Set<?> set;
private Properties props; private Properties props;
private Object[] objectArray; private Object[] objectArray;
private Class[] classArray; private Class<?>[] classArray;
private Integer[] intArray; private Integer[] intArray;
private HasMap() { private HasMap() {
} }
public Map getMap() { public Map<?, ?> getMap() {
return map; return map;
} }
public void setMap(Map map) { public void setMap(Map<?, ?> map) {
this.map = map; this.map = map;
} }
public Set getSet() { public Set<?> getSet() {
return set; return set;
} }
public void setSet(Set set) { public void setSet(Set<?> set) {
this.set = set; this.set = set;
} }
@ -75,11 +75,11 @@ public class HasMap {
this.objectArray = objectArray; this.objectArray = objectArray;
} }
public Class[] getClassArray() { public Class<?>[] getClassArray() {
return classArray; return classArray;
} }
public void setClassArray(Class[] classArray) { public void setClassArray(Class<?>[] classArray) {
this.classArray = classArray; this.classArray = classArray;
} }

6
spring-context/src/test/java/org/springframework/beans/factory/access/TestBean.java

@ -27,7 +27,7 @@ public class TestBean {
private String name; private String name;
private List list; private List<?> list;
private Object objRef; private Object objRef;
@ -48,14 +48,14 @@ public class TestBean {
/** /**
* @return Returns the list. * @return Returns the list.
*/ */
public List getList() { public List<?> getList() {
return list; return list;
} }
/** /**
* @param list The list to set. * @param list The list to set.
*/ */
public void setList(List list) { public void setList(List<?> list) {
this.list = list; this.list = list;
} }

8
spring-context/src/test/java/org/springframework/beans/factory/config/SimpleMapScope.java

@ -31,20 +31,20 @@ import org.springframework.beans.factory.ObjectFactory;
@SuppressWarnings("serial") @SuppressWarnings("serial")
public class SimpleMapScope implements Scope, Serializable { public class SimpleMapScope implements Scope, Serializable {
private final Map map = new HashMap(); private final Map<String, Object> map = new HashMap<String, Object>();
private final List callbacks = new LinkedList(); private final List<Runnable> callbacks = new LinkedList<Runnable>();
public SimpleMapScope() { public SimpleMapScope() {
} }
public final Map getMap() { public final Map<String, Object> getMap() {
return this.map; return this.map;
} }
public Object get(String name, ObjectFactory objectFactory) { public Object get(String name, ObjectFactory<?> objectFactory) {
synchronized (this.map) { synchronized (this.map) {
Object scopedObject = this.map.get(name); Object scopedObject = this.map.get(name);
if (scopedObject == null) { if (scopedObject == null) {

26
spring-context/src/test/java/org/springframework/beans/factory/parsing/CollectingReaderEventListener.java

@ -31,20 +31,20 @@ import org.springframework.core.CollectionFactory;
*/ */
public class CollectingReaderEventListener implements ReaderEventListener { public class CollectingReaderEventListener implements ReaderEventListener {
private final List defaults = new LinkedList(); private final List<DefaultsDefinition> defaults = new LinkedList<DefaultsDefinition>();
private final Map componentDefinitions = CollectionFactory.createLinkedMapIfPossible(8); private final Map<String, ComponentDefinition> componentDefinitions = CollectionFactory.createLinkedMapIfPossible(8);
private final Map aliasMap = CollectionFactory.createLinkedMapIfPossible(8); private final Map<String, List<AliasDefinition>> aliasMap = CollectionFactory.createLinkedMapIfPossible(8);
private final List imports = new LinkedList(); private final List<ImportDefinition> imports = new LinkedList<ImportDefinition>();
public void defaultsRegistered(DefaultsDefinition defaultsDefinition) { public void defaultsRegistered(DefaultsDefinition defaultsDefinition) {
this.defaults.add(defaultsDefinition); this.defaults.add(defaultsDefinition);
} }
public List getDefaults() { public List<DefaultsDefinition> getDefaults() {
return Collections.unmodifiableList(this.defaults); return Collections.unmodifiableList(this.defaults);
} }
@ -53,25 +53,25 @@ public class CollectingReaderEventListener implements ReaderEventListener {
} }
public ComponentDefinition getComponentDefinition(String name) { public ComponentDefinition getComponentDefinition(String name) {
return (ComponentDefinition) this.componentDefinitions.get(name); return this.componentDefinitions.get(name);
} }
public ComponentDefinition[] getComponentDefinitions() { public ComponentDefinition[] getComponentDefinitions() {
Collection collection = this.componentDefinitions.values(); Collection<ComponentDefinition> collection = this.componentDefinitions.values();
return (ComponentDefinition[]) collection.toArray(new ComponentDefinition[collection.size()]); return collection.toArray(new ComponentDefinition[collection.size()]);
} }
public void aliasRegistered(AliasDefinition aliasDefinition) { public void aliasRegistered(AliasDefinition aliasDefinition) {
List aliases = (List) this.aliasMap.get(aliasDefinition.getBeanName()); List<AliasDefinition> aliases = this.aliasMap.get(aliasDefinition.getBeanName());
if(aliases == null) { if(aliases == null) {
aliases = new ArrayList(); aliases = new ArrayList<AliasDefinition>();
this.aliasMap.put(aliasDefinition.getBeanName(), aliases); this.aliasMap.put(aliasDefinition.getBeanName(), aliases);
} }
aliases.add(aliasDefinition); aliases.add(aliasDefinition);
} }
public List getAliases(String beanName) { public List<?> getAliases(String beanName) {
List aliases = (List) this.aliasMap.get(beanName); List<?> aliases = this.aliasMap.get(beanName);
return aliases == null ? null : Collections.unmodifiableList(aliases); return aliases == null ? null : Collections.unmodifiableList(aliases);
} }
@ -79,7 +79,7 @@ public class CollectingReaderEventListener implements ReaderEventListener {
this.imports.add(importDefinition); this.imports.add(importDefinition);
} }
public List getImports() { public List<ImportDefinition> getImports() {
return Collections.unmodifiableList(this.imports); return Collections.unmodifiableList(this.imports);
} }

4
spring-context/src/test/java/org/springframework/context/BeanThatListens.java

@ -24,7 +24,7 @@ import java.util.Map;
* @author Thomas Risberg * @author Thomas Risberg
* @author Juergen Hoeller * @author Juergen Hoeller
*/ */
public class BeanThatListens implements ApplicationListener { public class BeanThatListens implements ApplicationListener<ApplicationEvent> {
private BeanThatBroadcasts beanThatBroadcasts; private BeanThatBroadcasts beanThatBroadcasts;
@ -36,7 +36,7 @@ public class BeanThatListens implements ApplicationListener {
public BeanThatListens(BeanThatBroadcasts beanThatBroadcasts) { public BeanThatListens(BeanThatBroadcasts beanThatBroadcasts) {
this.beanThatBroadcasts = beanThatBroadcasts; this.beanThatBroadcasts = beanThatBroadcasts;
Map beans = beanThatBroadcasts.applicationContext.getBeansOfType(BeanThatListens.class); Map<?, BeanThatListens> beans = beanThatBroadcasts.applicationContext.getBeansOfType(BeanThatListens.class);
if (!beans.isEmpty()) { if (!beans.isEmpty()) {
throw new IllegalStateException("Shouldn't have found any BeanThatListens instances"); throw new IllegalStateException("Shouldn't have found any BeanThatListens instances");
} }

2
spring-context/src/test/java/org/springframework/context/TestListener.java

@ -22,7 +22,7 @@ package org.springframework.context;
* @author Rod Johnson * @author Rod Johnson
* @since January 21, 2001 * @since January 21, 2001
*/ */
public class TestListener implements ApplicationListener { public class TestListener implements ApplicationListener<ApplicationEvent> {
private int eventCount; private int eventCount;

2
spring-context/src/test/java/org/springframework/context/annotation/CommonAnnotationBeanPostProcessorTests.java

@ -206,7 +206,7 @@ public class CommonAnnotationBeanPostProcessorTests {
bf.registerBeanDefinition("testBean4", new RootBeanDefinition(TestBean.class, false)); bf.registerBeanDefinition("testBean4", new RootBeanDefinition(TestBean.class, false));
bf.registerResolvableDependency(BeanFactory.class, bf); bf.registerResolvableDependency(BeanFactory.class, bf);
bf.registerResolvableDependency(INestedTestBean.class, new ObjectFactory() { bf.registerResolvableDependency(INestedTestBean.class, new ObjectFactory<Object>() {
public Object getObject() throws BeansException { public Object getObject() throws BeansException {
return new NestedTestBean(); return new NestedTestBean();
} }

2
spring-context/src/test/java/org/springframework/context/annotation/SimpleConfigTests.java

@ -42,7 +42,7 @@ public class SimpleConfigTests {
String value = fooService.foo(1); String value = fooService.foo(1);
assertEquals("bar", value); assertEquals("bar", value);
Future future = fooService.asyncFoo(1); Future<?> future = fooService.asyncFoo(1);
assertTrue(future instanceof FutureTask); assertTrue(future instanceof FutureTask);
assertEquals("bar", future.get()); assertEquals("bar", future.get());

2
spring-context/src/test/java/org/springframework/context/annotation/configuration/ConfigurationClassProcessingTests.java

@ -230,7 +230,7 @@ public class ConfigurationClassProcessingTests {
public @Bean Object stringBean() { public @Bean Object stringBean() {
return "foo"; return "foo";
} }
public @Bean FactoryBean factoryBean() { public @Bean FactoryBean<?> factoryBean() {
ListFactoryBean fb = new ListFactoryBean(); ListFactoryBean fb = new ListFactoryBean();
fb.setSourceList(Arrays.asList("element1", "element2")); fb.setSourceList(Arrays.asList("element1", "element2"));
return fb; return fb;

12
spring-context/src/test/java/org/springframework/context/event/ApplicationContextEventTests.java

@ -47,7 +47,8 @@ public class ApplicationContextEventTests {
@Test @Test
public void simpleApplicationEventMulticaster() { public void simpleApplicationEventMulticaster() {
ApplicationListener listener = EasyMock.createMock(ApplicationListener.class); @SuppressWarnings("unchecked")
ApplicationListener<ApplicationEvent> listener = mock(ApplicationListener.class);
ApplicationEvent evt = new ContextClosedEvent(new StaticApplicationContext()); ApplicationEvent evt = new ContextClosedEvent(new StaticApplicationContext());
listener.onApplicationEvent(evt); listener.onApplicationEvent(evt);
@ -73,11 +74,12 @@ public class ApplicationContextEventTests {
} }
@Test @Test
@SuppressWarnings("unchecked")
public void proxiedListeners() { public void proxiedListeners() {
MyOrderedListener1 listener1 = new MyOrderedListener1(); MyOrderedListener1 listener1 = new MyOrderedListener1();
MyOrderedListener2 listener2 = new MyOrderedListener2(listener1); MyOrderedListener2 listener2 = new MyOrderedListener2(listener1);
ApplicationListener proxy1 = (ApplicationListener) new ProxyFactory(listener1).getProxy(); ApplicationListener<ApplicationEvent> proxy1 = (ApplicationListener<ApplicationEvent>) new ProxyFactory(listener1).getProxy();
ApplicationListener proxy2 = (ApplicationListener) new ProxyFactory(listener2).getProxy(); ApplicationListener<ApplicationEvent> proxy2 = (ApplicationListener<ApplicationEvent>) new ProxyFactory(listener2).getProxy();
SimpleApplicationEventMulticaster smc = new SimpleApplicationEventMulticaster(); SimpleApplicationEventMulticaster smc = new SimpleApplicationEventMulticaster();
smc.addApplicationListener(proxy1); smc.addApplicationListener(proxy1);
@ -208,7 +210,7 @@ public class ApplicationContextEventTests {
} }
public static class MyOrderedListener1 implements ApplicationListener, Ordered { public static class MyOrderedListener1 implements ApplicationListener<ApplicationEvent>, Ordered {
public final Set<ApplicationEvent> seenEvents = new HashSet<ApplicationEvent>(); public final Set<ApplicationEvent> seenEvents = new HashSet<ApplicationEvent>();
@ -248,7 +250,7 @@ public class ApplicationContextEventTests {
} }
public static class MyNonSingletonListener implements ApplicationListener { public static class MyNonSingletonListener implements ApplicationListener<ApplicationEvent> {
public static final Set<ApplicationEvent> seenEvents = new HashSet<ApplicationEvent>(); public static final Set<ApplicationEvent> seenEvents = new HashSet<ApplicationEvent>();

4
spring-context/src/test/java/org/springframework/context/event/EventPublicationInterceptorTests.java

@ -138,13 +138,13 @@ public class EventPublicationInterceptorTests {
} }
public static class FactoryBeanTestListener extends TestListener implements FactoryBean { public static class FactoryBeanTestListener extends TestListener implements FactoryBean<Object> {
public Object getObject() throws Exception { public Object getObject() throws Exception {
return "test"; return "test";
} }
public Class getObjectType() { public Class<String> getObjectType() {
return String.class; return String.class;
} }

2
spring-context/src/test/java/org/springframework/context/event/LifecycleEventTests.java

@ -63,7 +63,7 @@ public class LifecycleEventTests extends TestCase {
} }
private static class LifecycleListener implements ApplicationListener { private static class LifecycleListener implements ApplicationListener<ApplicationEvent> {
private ApplicationContext context; private ApplicationContext context;

2
spring-context/src/test/java/org/springframework/context/expression/ApplicationContextExpressionTests.java

@ -57,7 +57,7 @@ public class ApplicationContextExpressionTests {
AnnotationConfigUtils.registerAnnotationConfigProcessors(ac); AnnotationConfigUtils.registerAnnotationConfigProcessors(ac);
ac.getBeanFactory().registerScope("myScope", new Scope() { ac.getBeanFactory().registerScope("myScope", new Scope() {
public Object get(String name, ObjectFactory objectFactory) { public Object get(String name, ObjectFactory<?> objectFactory) {
return objectFactory.getObject(); return objectFactory.getObject();
} }
public Object remove(String name) { public Object remove(String name) {

5
spring-context/src/test/java/org/springframework/context/support/ConversionServiceFactoryBeanTests.java

@ -61,6 +61,7 @@ public class ConversionServiceFactoryBeanTests {
converters.add(new ConverterFactory<String, Bar>() { converters.add(new ConverterFactory<String, Bar>() {
public <T extends Bar> Converter<String, T> getConverter(Class<T> targetType) { public <T extends Bar> Converter<String, T> getConverter(Class<T> targetType) {
return new Converter<String, T> () { return new Converter<String, T> () {
@SuppressWarnings("unchecked")
public T convert(String source) { public T convert(String source) {
return (T) new Bar(); return (T) new Bar();
} }
@ -103,7 +104,7 @@ public class ConversionServiceFactoryBeanTests {
doTestConversionServiceInApplicationContext("conversionServiceWithResourceOverriding.xml", FileSystemResource.class); doTestConversionServiceInApplicationContext("conversionServiceWithResourceOverriding.xml", FileSystemResource.class);
} }
private void doTestConversionServiceInApplicationContext(String fileName, Class resourceClass) { private void doTestConversionServiceInApplicationContext(String fileName, Class<?> resourceClass) {
ApplicationContext ctx = new ClassPathXmlApplicationContext(fileName, getClass()); ApplicationContext ctx = new ClassPathXmlApplicationContext(fileName, getClass());
ResourceTestBean tb = ctx.getBean("resourceTestBean", ResourceTestBean.class); ResourceTestBean tb = ctx.getBean("resourceTestBean", ResourceTestBean.class);
assertTrue(resourceClass.isInstance(tb.getResource())); assertTrue(resourceClass.isInstance(tb.getResource()));
@ -128,7 +129,7 @@ public class ConversionServiceFactoryBeanTests {
public static class ComplexConstructorArgument { public static class ComplexConstructorArgument {
public ComplexConstructorArgument(Map<String, Class> map) { public ComplexConstructorArgument(Map<String, Class<?>> map) {
assertTrue(!map.isEmpty()); assertTrue(!map.isEmpty());
assertTrue(map.keySet().iterator().next() instanceof String); assertTrue(map.keySet().iterator().next() instanceof String);
assertTrue(map.values().iterator().next() instanceof Class); assertTrue(map.values().iterator().next() instanceof Class);

4
spring-context/src/test/java/org/springframework/context/support/DefaultLifecycleProcessorTests.java

@ -692,7 +692,7 @@ public class DefaultLifecycleProcessorTests {
} }
public static class DummySmartLifecycleFactoryBean implements FactoryBean, SmartLifecycle { public static class DummySmartLifecycleFactoryBean implements FactoryBean<Object>, SmartLifecycle {
public boolean running = false; public boolean running = false;
@ -702,7 +702,7 @@ public class DefaultLifecycleProcessorTests {
return this.bean; return this.bean;
} }
public Class getObjectType() { public Class<?> getObjectType() {
return DummySmartLifecycleBean.class; return DummySmartLifecycleBean.class;
} }

6
spring-context/src/test/java/org/springframework/context/support/FactoryBeanAndApplicationListener.java

@ -8,13 +8,13 @@ import org.springframework.context.ApplicationListener;
* @author Juergen Hoeller * @author Juergen Hoeller
* @since 06.10.2004 * @since 06.10.2004
*/ */
public class FactoryBeanAndApplicationListener implements FactoryBean, ApplicationListener { public class FactoryBeanAndApplicationListener implements FactoryBean<String>, ApplicationListener<ApplicationEvent> {
public Object getObject() throws Exception { public String getObject() throws Exception {
return ""; return "";
} }
public Class getObjectType() { public Class<String> getObjectType() {
return String.class; return String.class;
} }

4
spring-context/src/test/java/org/springframework/context/support/ResourceBundleMessageSourceTests.java

@ -115,8 +115,8 @@ public class ResourceBundleMessageSourceTests extends TestCase {
if (alwaysUseMessageFormat) { if (alwaysUseMessageFormat) {
pvs.add("alwaysUseMessageFormat", Boolean.TRUE); pvs.add("alwaysUseMessageFormat", Boolean.TRUE);
} }
Class clazz = reloadable ? Class<?> clazz = reloadable ?
(Class) ReloadableResourceBundleMessageSource.class : ResourceBundleMessageSource.class; (Class<?>) ReloadableResourceBundleMessageSource.class : ResourceBundleMessageSource.class;
ac.registerSingleton("messageSource", clazz, pvs); ac.registerSingleton("messageSource", clazz, pvs);
ac.refresh(); ac.refresh();

2
spring-context/src/test/java/org/springframework/context/support/Spr7283Tests.java

@ -30,7 +30,7 @@ public class Spr7283Tests {
@Test @Test
public void testListWithInconsistentElementType() { public void testListWithInconsistentElementType() {
ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("spr7283.xml", getClass()); ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("spr7283.xml", getClass());
List list = ctx.getBean("list", List.class); List<?> list = ctx.getBean("list", List.class);
assertEquals(2, list.size()); assertEquals(2, list.size());
assertTrue(list.get(0) instanceof A); assertTrue(list.get(0) instanceof A);
assertTrue(list.get(1) instanceof B); assertTrue(list.get(1) instanceof B);

2
spring-context/src/test/java/org/springframework/context/support/StaticApplicationContextMulticasterTests.java

@ -45,7 +45,7 @@ public class StaticApplicationContextMulticasterTests extends AbstractApplicatio
/** Run for each test */ /** Run for each test */
protected ConfigurableApplicationContext createContext() throws Exception { protected ConfigurableApplicationContext createContext() throws Exception {
StaticApplicationContext parent = new StaticApplicationContext(); StaticApplicationContext parent = new StaticApplicationContext();
Map m = new HashMap(); Map<String, String> m = new HashMap<String, String>();
m.put("name", "Roderick"); m.put("name", "Roderick");
parent.registerPrototype("rod", TestBean.class, new MutablePropertyValues(m)); parent.registerPrototype("rod", TestBean.class, new MutablePropertyValues(m));
m.put("name", "Albert"); m.put("name", "Albert");

2
spring-context/src/test/java/org/springframework/context/support/StaticApplicationContextTests.java

@ -41,7 +41,7 @@ public class StaticApplicationContextTests extends AbstractApplicationContextTes
/** Run for each test */ /** Run for each test */
protected ConfigurableApplicationContext createContext() throws Exception { protected ConfigurableApplicationContext createContext() throws Exception {
StaticApplicationContext parent = new StaticApplicationContext(); StaticApplicationContext parent = new StaticApplicationContext();
Map m = new HashMap(); Map<String, String> m = new HashMap<String, String>();
m.put("name", "Roderick"); m.put("name", "Roderick");
parent.registerPrototype("rod", TestBean.class, new MutablePropertyValues(m)); parent.registerPrototype("rod", TestBean.class, new MutablePropertyValues(m));
m.put("name", "Albert"); m.put("name", "Albert");

4
spring-context/src/test/java/org/springframework/context/support/StaticMessageSourceTests.java

@ -198,7 +198,7 @@ public class StaticMessageSourceTests extends AbstractApplicationContextTests {
protected ConfigurableApplicationContext createContext() throws Exception { protected ConfigurableApplicationContext createContext() throws Exception {
StaticApplicationContext parent = new StaticApplicationContext(); StaticApplicationContext parent = new StaticApplicationContext();
Map m = new HashMap(); Map<String, String> m = new HashMap<String, String>();
m.put("name", "Roderick"); m.put("name", "Roderick");
parent.registerPrototype("rod", org.springframework.beans.TestBean.class, new MutablePropertyValues(m)); parent.registerPrototype("rod", org.springframework.beans.TestBean.class, new MutablePropertyValues(m));
m.put("name", "Albert"); m.put("name", "Albert");
@ -221,7 +221,7 @@ public class StaticMessageSourceTests extends AbstractApplicationContextTests {
sac.addListener(listener); sac.addListener(listener);
StaticMessageSource messageSource = sac.getStaticMessageSource(); StaticMessageSource messageSource = sac.getStaticMessageSource();
Map usMessages = new HashMap(3); Map<String, String> usMessages = new HashMap<String, String>(3);
usMessages.put("message.format.example1", MSG_TXT1_US); usMessages.put("message.format.example1", MSG_TXT1_US);
usMessages.put("message.format.example2", MSG_TXT2_US); usMessages.put("message.format.example2", MSG_TXT2_US);
usMessages.put("message.format.example3", MSG_TXT3_US); usMessages.put("message.format.example3", MSG_TXT3_US);

6
spring-context/src/test/java/org/springframework/ejb/access/LocalSlsbInvokerInterceptorTests.java

@ -90,7 +90,7 @@ public class LocalSlsbInvokerInterceptorTests {
LocalSlsbInvokerInterceptor si = configuredInterceptor(mockContext, jndiName); LocalSlsbInvokerInterceptor si = configuredInterceptor(mockContext, jndiName);
ProxyFactory pf = new ProxyFactory(new Class[] { BusinessMethods.class } ); ProxyFactory pf = new ProxyFactory(new Class<?>[] { BusinessMethods.class } );
pf.addAdvice(si); pf.addAdvice(si);
BusinessMethods target = (BusinessMethods) pf.getProxy(); BusinessMethods target = (BusinessMethods) pf.getProxy();
@ -113,7 +113,7 @@ public class LocalSlsbInvokerInterceptorTests {
LocalSlsbInvokerInterceptor si = configuredInterceptor(mockContext, jndiName); LocalSlsbInvokerInterceptor si = configuredInterceptor(mockContext, jndiName);
ProxyFactory pf = new ProxyFactory(new Class[] { BusinessMethods.class } ); ProxyFactory pf = new ProxyFactory(new Class<?>[] { BusinessMethods.class } );
pf.addAdvice(si); pf.addAdvice(si);
BusinessMethods target = (BusinessMethods) pf.getProxy(); BusinessMethods target = (BusinessMethods) pf.getProxy();
@ -133,7 +133,7 @@ public class LocalSlsbInvokerInterceptorTests {
LocalSlsbInvokerInterceptor si = configuredInterceptor(mockContext, jndiName); LocalSlsbInvokerInterceptor si = configuredInterceptor(mockContext, jndiName);
ProxyFactory pf = new ProxyFactory(new Class[] { LocalInterfaceWithBusinessMethods.class } ); ProxyFactory pf = new ProxyFactory(new Class<?>[] { LocalInterfaceWithBusinessMethods.class } );
pf.addAdvice(si); pf.addAdvice(si);
LocalInterfaceWithBusinessMethods target = (LocalInterfaceWithBusinessMethods) pf.getProxy(); LocalInterfaceWithBusinessMethods target = (LocalInterfaceWithBusinessMethods) pf.getProxy();

2
spring-context/src/test/java/org/springframework/ejb/access/SimpleRemoteSlsbInvokerInterceptorTests.java

@ -79,7 +79,7 @@ public class SimpleRemoteSlsbInvokerInterceptorTests {
protected Object configuredProxy(SimpleRemoteSlsbInvokerInterceptor si, Class<?> ifc) throws NamingException { protected Object configuredProxy(SimpleRemoteSlsbInvokerInterceptor si, Class<?> ifc) throws NamingException {
si.afterPropertiesSet(); si.afterPropertiesSet();
ProxyFactory pf = new ProxyFactory(new Class[] {ifc}); ProxyFactory pf = new ProxyFactory(new Class<?>[] {ifc});
pf.addAdvice(si); pf.addAdvice(si);
return pf.getProxy(); return pf.getProxy();
} }

2
spring-context/src/test/java/org/springframework/jmx/export/MBeanExporterTests.java

@ -238,7 +238,7 @@ public final class MBeanExporterTests extends AbstractMBeanServerTests {
ProxyFactory factory = new ProxyFactory(); ProxyFactory factory = new ProxyFactory();
factory.setTarget(bean); factory.setTarget(bean);
factory.addAdvice(new NopInterceptor()); factory.addAdvice(new NopInterceptor());
factory.setInterfaces(new Class[] { IJmxTestBean.class }); factory.setInterfaces(new Class<?>[] { IJmxTestBean.class });
IJmxTestBean proxy = (IJmxTestBean) factory.getProxy(); IJmxTestBean proxy = (IJmxTestBean) factory.getProxy();
String name = "bean:mmm=whatever"; String name = "bean:mmm=whatever";

2
spring-context/src/test/java/org/springframework/jmx/export/assembler/AbstractMetadataAssemblerTests.java

@ -158,7 +158,7 @@ public abstract class AbstractMetadataAssemblerTests extends AbstractJmxAssemble
String objectName = "spring:bean=test,proxy=true"; String objectName = "spring:bean=test,proxy=true";
Map beans = new HashMap(); Map<String, Object> beans = new HashMap<String, Object>();
beans.put(objectName, proxy); beans.put(objectName, proxy);
exporter.setBeans(beans); exporter.setBeans(beans);
exporter.afterPropertiesSet(); exporter.afterPropertiesSet();

2
spring-context/src/test/java/org/springframework/jmx/export/assembler/InterfaceBasedMBeanInfoAssemblerCustomTests.java

@ -40,7 +40,7 @@ public class InterfaceBasedMBeanInfoAssemblerCustomTests extends AbstractJmxAsse
protected MBeanInfoAssembler getAssembler() { protected MBeanInfoAssembler getAssembler() {
InterfaceBasedMBeanInfoAssembler assembler = new InterfaceBasedMBeanInfoAssembler(); InterfaceBasedMBeanInfoAssembler assembler = new InterfaceBasedMBeanInfoAssembler();
assembler.setManagedInterfaces(new Class[] {ICustomJmxBean.class}); assembler.setManagedInterfaces(new Class<?>[] {ICustomJmxBean.class});
return assembler; return assembler;
} }

2
spring-context/src/test/java/org/springframework/jmx/export/assembler/InterfaceBasedMBeanInfoAssemblerMappedTests.java

@ -60,7 +60,7 @@ public class InterfaceBasedMBeanInfoAssemblerMappedTests extends AbstractJmxAsse
public void ignoreTestWithFallThrough() throws Exception { public void ignoreTestWithFallThrough() throws Exception {
InterfaceBasedMBeanInfoAssembler assembler = InterfaceBasedMBeanInfoAssembler assembler =
getWithMapping("foobar", "org.springframework.jmx.export.assembler.ICustomJmxBean"); getWithMapping("foobar", "org.springframework.jmx.export.assembler.ICustomJmxBean");
assembler.setManagedInterfaces(new Class[] {IAdditionalTestMethods.class}); assembler.setManagedInterfaces(new Class<?>[] {IAdditionalTestMethods.class});
ModelMBeanInfo inf = assembler.getMBeanInfo(getBean(), getObjectName()); ModelMBeanInfo inf = assembler.getMBeanInfo(getBean(), getObjectName());
MBeanAttributeInfo attr = inf.getAttribute("NickName"); MBeanAttributeInfo attr = inf.getAttribute("NickName");

18
spring-context/src/test/java/org/springframework/remoting/rmi/RmiSupportTests.java

@ -88,7 +88,7 @@ public class RmiSupportTests extends TestCase {
doTestRmiProxyFactoryBeanWithException(UnmarshalException.class); doTestRmiProxyFactoryBeanWithException(UnmarshalException.class);
} }
private void doTestRmiProxyFactoryBeanWithException(Class exceptionClass) throws Exception { private void doTestRmiProxyFactoryBeanWithException(Class<?> exceptionClass) throws Exception {
CountingRmiProxyFactoryBean factory = new CountingRmiProxyFactoryBean(); CountingRmiProxyFactoryBean factory = new CountingRmiProxyFactoryBean();
factory.setServiceInterface(IRemoteBean.class); factory.setServiceInterface(IRemoteBean.class);
factory.setServiceUrl("rmi://localhost:1090/test"); factory.setServiceUrl("rmi://localhost:1090/test");
@ -130,7 +130,7 @@ public class RmiSupportTests extends TestCase {
doTestRmiProxyFactoryBeanWithExceptionAndRefresh(StubNotFoundException.class); doTestRmiProxyFactoryBeanWithExceptionAndRefresh(StubNotFoundException.class);
} }
private void doTestRmiProxyFactoryBeanWithExceptionAndRefresh(Class exceptionClass) throws Exception { private void doTestRmiProxyFactoryBeanWithExceptionAndRefresh(Class<?> exceptionClass) throws Exception {
CountingRmiProxyFactoryBean factory = new CountingRmiProxyFactoryBean(); CountingRmiProxyFactoryBean factory = new CountingRmiProxyFactoryBean();
factory.setServiceInterface(IRemoteBean.class); factory.setServiceInterface(IRemoteBean.class);
factory.setServiceUrl("rmi://localhost:1090/test"); factory.setServiceUrl("rmi://localhost:1090/test");
@ -217,7 +217,7 @@ public class RmiSupportTests extends TestCase {
} }
private void doTestRmiProxyFactoryBeanWithBusinessInterfaceAndException( private void doTestRmiProxyFactoryBeanWithBusinessInterfaceAndException(
Class rmiExceptionClass, Class springExceptionClass) throws Exception { Class<?> rmiExceptionClass, Class<?> springExceptionClass) throws Exception {
CountingRmiProxyFactoryBean factory = new CountingRmiProxyFactoryBean(); CountingRmiProxyFactoryBean factory = new CountingRmiProxyFactoryBean();
factory.setServiceInterface(IBusinessBean.class); factory.setServiceInterface(IBusinessBean.class);
@ -272,7 +272,7 @@ public class RmiSupportTests extends TestCase {
} }
private void doTestRmiProxyFactoryBeanWithBusinessInterfaceAndExceptionAndRefresh( private void doTestRmiProxyFactoryBeanWithBusinessInterfaceAndExceptionAndRefresh(
Class rmiExceptionClass, Class springExceptionClass) throws Exception { Class<?> rmiExceptionClass, Class<?> springExceptionClass) throws Exception {
CountingRmiProxyFactoryBean factory = new CountingRmiProxyFactoryBean(); CountingRmiProxyFactoryBean factory = new CountingRmiProxyFactoryBean();
factory.setServiceInterface(IBusinessBean.class); factory.setServiceInterface(IBusinessBean.class);
@ -319,7 +319,7 @@ public class RmiSupportTests extends TestCase {
// let's see if the remote invocation object works // let's see if the remote invocation object works
final RemoteBean rb = new RemoteBean(); final RemoteBean rb = new RemoteBean();
final Method setNameMethod = rb.getClass().getDeclaredMethod("setName", new Class[] {String.class}); final Method setNameMethod = rb.getClass().getDeclaredMethod("setName", new Class<?>[] {String.class});
MethodInvocation mi = new MethodInvocation() { MethodInvocation mi = new MethodInvocation() {
public Method getMethod() { public Method getMethod() {
@ -351,10 +351,10 @@ public class RmiSupportTests extends TestCase {
assertEquals("bla", inv.getArguments()[0]); assertEquals("bla", inv.getArguments()[0]);
inv.setMethodName("setName"); inv.setMethodName("setName");
assertEquals("setName", inv.getMethodName()); assertEquals("setName", inv.getMethodName());
inv.setParameterTypes(new Class[] {String.class}); inv.setParameterTypes(new Class<?>[] {String.class});
assertEquals(String.class, inv.getParameterTypes()[0]); assertEquals(String.class, inv.getParameterTypes()[0]);
inv = new RemoteInvocation("setName", new Class[] {String.class}, new Object[] {"bla"}); inv = new RemoteInvocation("setName", new Class<?>[] {String.class}, new Object[] {"bla"});
assertEquals("bla", inv.getArguments()[0]); assertEquals("bla", inv.getArguments()[0]);
assertEquals("setName", inv.getMethodName()); assertEquals("setName", inv.getMethodName());
assertEquals(String.class, inv.getParameterTypes()[0]); assertEquals(String.class, inv.getParameterTypes()[0]);
@ -436,8 +436,8 @@ public class RmiSupportTests extends TestCase {
if (nam != null && nam.endsWith("Exception")) { if (nam != null && nam.endsWith("Exception")) {
RemoteException rex = null; RemoteException rex = null;
try { try {
Class exClass = Class.forName(nam); Class<?> exClass = Class.forName(nam);
Constructor ctor = exClass.getConstructor(new Class[] {String.class}); Constructor<?> ctor = exClass.getConstructor(new Class<?>[] {String.class});
rex = (RemoteException) ctor.newInstance(new Object[] {"myMessage"}); rex = (RemoteException) ctor.newInstance(new Object[] {"myMessage"});
} }
catch (Exception ex) { catch (Exception ex) {

2
spring-context/src/test/java/org/springframework/scheduling/timer/TimerSupportTests.java

@ -48,7 +48,7 @@ public class TimerSupportTests extends TestCase {
tasks[1] = new ScheduledTimerTask(timerTask1, 10, 20, true); tasks[1] = new ScheduledTimerTask(timerTask1, 10, 20, true);
tasks[2] = new ScheduledTimerTask(timerTask2, 20); tasks[2] = new ScheduledTimerTask(timerTask2, 20);
final List success = new ArrayList(3); final List<Boolean> success = new ArrayList<Boolean>(3);
final Timer timer = new Timer(true) { final Timer timer = new Timer(true) {
public void schedule(TimerTask task, long delay, long period) { public void schedule(TimerTask task, long delay, long period) {
if (task == timerTask0 && delay == 0 && period == 10) { if (task == timerTask0 && delay == 0 && period == 10) {

14
spring-context/src/test/java/org/springframework/scripting/bsh/BshScriptFactoryTests.java

@ -199,9 +199,9 @@ public class BshScriptFactoryTests extends TestCase {
mock.replay(); mock.replay();
BshScriptFactory factory = new BshScriptFactory( BshScriptFactory factory = new BshScriptFactory(
ScriptFactoryPostProcessor.INLINE_SCRIPT_PREFIX + badScript, ScriptFactoryPostProcessor.INLINE_SCRIPT_PREFIX + badScript,
new Class[] {Messenger.class}); new Class<?>[] {Messenger.class});
try { try {
Messenger messenger = (Messenger) factory.getScriptedObject(script, new Class[]{Messenger.class}); Messenger messenger = (Messenger) factory.getScriptedObject(script, new Class<?>[]{Messenger.class});
messenger.getMessage(); messenger.getMessage();
fail("Must have thrown a BshScriptUtils.BshExecutionException."); fail("Must have thrown a BshScriptUtils.BshExecutionException.");
} }
@ -212,7 +212,7 @@ public class BshScriptFactoryTests extends TestCase {
public void testCtorWithNullScriptSourceLocator() throws Exception { public void testCtorWithNullScriptSourceLocator() throws Exception {
try { try {
new BshScriptFactory(null, new Class[] {Messenger.class}); new BshScriptFactory(null, new Class<?>[] {Messenger.class});
fail("Must have thrown exception by this point."); fail("Must have thrown exception by this point.");
} }
catch (IllegalArgumentException expected) { catch (IllegalArgumentException expected) {
@ -221,7 +221,7 @@ public class BshScriptFactoryTests extends TestCase {
public void testCtorWithEmptyScriptSourceLocator() throws Exception { public void testCtorWithEmptyScriptSourceLocator() throws Exception {
try { try {
new BshScriptFactory("", new Class[] {Messenger.class}); new BshScriptFactory("", new Class<?>[] {Messenger.class});
fail("Must have thrown exception by this point."); fail("Must have thrown exception by this point.");
} }
catch (IllegalArgumentException expected) { catch (IllegalArgumentException expected) {
@ -230,7 +230,7 @@ public class BshScriptFactoryTests extends TestCase {
public void testCtorWithWhitespacedScriptSourceLocator() throws Exception { public void testCtorWithWhitespacedScriptSourceLocator() throws Exception {
try { try {
new BshScriptFactory("\n ", new Class[] {Messenger.class}); new BshScriptFactory("\n ", new Class<?>[] {Messenger.class});
fail("Must have thrown exception by this point."); fail("Must have thrown exception by this point.");
} }
catch (IllegalArgumentException expected) { catch (IllegalArgumentException expected) {
@ -241,7 +241,7 @@ public class BshScriptFactoryTests extends TestCase {
ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("bsh-with-xsd.xml", getClass()); ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext("bsh-with-xsd.xml", getClass());
TestBean testBean = (TestBean) ctx.getBean("testBean"); TestBean testBean = (TestBean) ctx.getBean("testBean");
Collection beanNames = Arrays.asList(ctx.getBeanNamesForType(Messenger.class)); Collection<String> beanNames = Arrays.asList(ctx.getBeanNamesForType(Messenger.class));
assertTrue(beanNames.contains("messenger")); assertTrue(beanNames.contains("messenger"));
assertTrue(beanNames.contains("messengerImpl")); assertTrue(beanNames.contains("messengerImpl"));
assertTrue(beanNames.contains("messengerInstance")); assertTrue(beanNames.contains("messengerInstance"));
@ -262,7 +262,7 @@ public class BshScriptFactoryTests extends TestCase {
TestBeanAwareMessenger messengerByName = (TestBeanAwareMessenger) ctx.getBean("messengerByName"); TestBeanAwareMessenger messengerByName = (TestBeanAwareMessenger) ctx.getBean("messengerByName");
assertEquals(testBean, messengerByName.getTestBean()); assertEquals(testBean, messengerByName.getTestBean());
Collection beans = ctx.getBeansOfType(Messenger.class).values(); Collection<Messenger> beans = ctx.getBeansOfType(Messenger.class).values();
assertTrue(beans.contains(messenger)); assertTrue(beans.contains(messenger));
assertTrue(beans.contains(messengerImpl)); assertTrue(beans.contains(messengerImpl));
assertTrue(beans.contains(messengerInstance)); assertTrue(beans.contains(messengerInstance));

8
spring-context/src/test/java/org/springframework/scripting/groovy/GroovyClassLoadingTests.java

@ -34,12 +34,12 @@ public class GroovyClassLoadingTests extends TestCase {
StaticApplicationContext context = new StaticApplicationContext(); StaticApplicationContext context = new StaticApplicationContext();
GroovyClassLoader gcl = new GroovyClassLoader(); GroovyClassLoader gcl = new GroovyClassLoader();
Class class1 = gcl.parseClass("class TestBean { def myMethod() { \"foo\" } }"); Class<?> class1 = gcl.parseClass("class TestBean { def myMethod() { \"foo\" } }");
Class class2 = gcl.parseClass("class TestBean { def myMethod() { \"bar\" } }"); Class<?> class2 = gcl.parseClass("class TestBean { def myMethod() { \"bar\" } }");
context.registerBeanDefinition("testBean", new RootBeanDefinition(class1)); context.registerBeanDefinition("testBean", new RootBeanDefinition(class1));
Object testBean1 = context.getBean("testBean"); Object testBean1 = context.getBean("testBean");
Method method1 = class1.getDeclaredMethod("myMethod", new Class[0]); Method method1 = class1.getDeclaredMethod("myMethod", new Class<?>[0]);
Object result1 = ReflectionUtils.invokeMethod(method1, testBean1); Object result1 = ReflectionUtils.invokeMethod(method1, testBean1);
assertEquals("foo", (String) result1); assertEquals("foo", (String) result1);
@ -48,7 +48,7 @@ public class GroovyClassLoadingTests extends TestCase {
context.registerBeanDefinition("testBean", new RootBeanDefinition(class2)); context.registerBeanDefinition("testBean", new RootBeanDefinition(class2));
Object testBean2 = context.getBean("testBean"); Object testBean2 = context.getBean("testBean");
Method method2 = class2.getDeclaredMethod("myMethod", new Class[0]); Method method2 = class2.getDeclaredMethod("myMethod", new Class<?>[0]);
Object result2 = ReflectionUtils.invokeMethod(method2, testBean2); Object result2 = ReflectionUtils.invokeMethod(method2, testBean2);
assertEquals("bar", (String) result2); assertEquals("bar", (String) result2);
} }

6
spring-context/src/test/java/org/springframework/scripting/groovy/GroovyScriptFactoryTests.java

@ -201,7 +201,7 @@ public class GroovyScriptFactoryTests {
GroovyScriptFactory factory = new GroovyScriptFactory(ScriptFactoryPostProcessor.INLINE_SCRIPT_PREFIX GroovyScriptFactory factory = new GroovyScriptFactory(ScriptFactoryPostProcessor.INLINE_SCRIPT_PREFIX
+ badScript); + badScript);
try { try {
factory.getScriptedObject(script, new Class[] {}); factory.getScriptedObject(script, new Class<?>[] {});
fail("Must have thrown a ScriptCompilationException (no public no-arg ctor in scripted class)."); fail("Must have thrown a ScriptCompilationException (no public no-arg ctor in scripted class).");
} catch (ScriptCompilationException expected) { } catch (ScriptCompilationException expected) {
assertTrue(expected.contains(InstantiationException.class)); assertTrue(expected.contains(InstantiationException.class));
@ -219,7 +219,7 @@ public class GroovyScriptFactoryTests {
GroovyScriptFactory factory = new GroovyScriptFactory(ScriptFactoryPostProcessor.INLINE_SCRIPT_PREFIX GroovyScriptFactory factory = new GroovyScriptFactory(ScriptFactoryPostProcessor.INLINE_SCRIPT_PREFIX
+ badScript); + badScript);
try { try {
factory.getScriptedObject(script, new Class[] {}); factory.getScriptedObject(script, new Class<?>[] {});
fail("Must have thrown a ScriptCompilationException (no oublic no-arg ctor in scripted class)."); fail("Must have thrown a ScriptCompilationException (no oublic no-arg ctor in scripted class).");
} catch (ScriptCompilationException expected) { } catch (ScriptCompilationException expected) {
assertTrue(expected.contains(IllegalAccessException.class)); assertTrue(expected.contains(IllegalAccessException.class));
@ -402,7 +402,7 @@ public class GroovyScriptFactoryTests {
@Test @Test
public void testAnonymousScriptDetected() throws Exception { public void testAnonymousScriptDetected() throws Exception {
ApplicationContext ctx = new ClassPathXmlApplicationContext("groovy-with-xsd.xml", getClass()); ApplicationContext ctx = new ClassPathXmlApplicationContext("groovy-with-xsd.xml", getClass());
Map beans = ctx.getBeansOfType(Messenger.class); Map<?, Messenger> beans = ctx.getBeansOfType(Messenger.class);
assertEquals(4, beans.size()); assertEquals(4, beans.size());
} }

12
spring-context/src/test/java/org/springframework/scripting/jruby/JRubyScriptFactoryTests.java

@ -94,7 +94,7 @@ public class JRubyScriptFactoryTests extends TestCase {
public void testCtorWithNullScriptSourceLocator() throws Exception { public void testCtorWithNullScriptSourceLocator() throws Exception {
try { try {
new JRubyScriptFactory(null, new Class[]{Messenger.class}); new JRubyScriptFactory(null, new Class<?>[]{Messenger.class});
fail("Must have thrown exception by this point."); fail("Must have thrown exception by this point.");
} }
catch (IllegalArgumentException expected) { catch (IllegalArgumentException expected) {
@ -103,7 +103,7 @@ public class JRubyScriptFactoryTests extends TestCase {
public void testCtorWithEmptyScriptSourceLocator() throws Exception { public void testCtorWithEmptyScriptSourceLocator() throws Exception {
try { try {
new JRubyScriptFactory("", new Class[]{Messenger.class}); new JRubyScriptFactory("", new Class<?>[]{Messenger.class});
fail("Must have thrown exception by this point."); fail("Must have thrown exception by this point.");
} }
catch (IllegalArgumentException expected) { catch (IllegalArgumentException expected) {
@ -112,7 +112,7 @@ public class JRubyScriptFactoryTests extends TestCase {
public void testCtorWithWhitespacedScriptSourceLocator() throws Exception { public void testCtorWithWhitespacedScriptSourceLocator() throws Exception {
try { try {
new JRubyScriptFactory("\n ", new Class[]{Messenger.class}); new JRubyScriptFactory("\n ", new Class<?>[]{Messenger.class});
fail("Must have thrown exception by this point."); fail("Must have thrown exception by this point.");
} }
catch (IllegalArgumentException expected) { catch (IllegalArgumentException expected) {
@ -130,7 +130,7 @@ public class JRubyScriptFactoryTests extends TestCase {
public void testCtorWithEmptyScriptInterfacesArray() throws Exception { public void testCtorWithEmptyScriptInterfacesArray() throws Exception {
try { try {
new JRubyScriptFactory(RUBY_SCRIPT_SOURCE_LOCATOR, new Class[]{}); new JRubyScriptFactory(RUBY_SCRIPT_SOURCE_LOCATOR, new Class<?>[]{});
fail("Must have thrown exception by this point."); fail("Must have thrown exception by this point.");
} }
catch (IllegalArgumentException expected) { catch (IllegalArgumentException expected) {
@ -250,14 +250,14 @@ public class JRubyScriptFactoryTests extends TestCase {
assertEquals("2", lol[1][0]); assertEquals("2", lol[1][0]);
assertEquals("3", lol[2][0]); assertEquals("3", lol[2][0]);
Map singleValueMap = adder.toMap("key", "value"); Map<?, ?> singleValueMap = adder.toMap("key", "value");
assertNotNull(singleValueMap); assertNotNull(singleValueMap);
assertEquals(1, singleValueMap.size()); assertEquals(1, singleValueMap.size());
assertEquals("key", singleValueMap.keySet().iterator().next()); assertEquals("key", singleValueMap.keySet().iterator().next());
assertEquals("value", singleValueMap.values().iterator().next()); assertEquals("value", singleValueMap.values().iterator().next());
String[] expectedStrings = new String[]{"1", "2", "3"}; String[] expectedStrings = new String[]{"1", "2", "3"};
Map map = adder.toMap("key", expectedStrings); Map<?, ?> map = adder.toMap("key", expectedStrings);
assertNotNull(map); assertNotNull(map);
assertEquals(1, map.size()); assertEquals(1, map.size());
assertEquals("key", map.keySet().iterator().next()); assertEquals("key", map.keySet().iterator().next());

2
spring-context/src/test/java/org/springframework/scripting/jruby/WrapperAdder.java

@ -47,6 +47,6 @@ public interface WrapperAdder {
String[][] createListOfLists(String one, String second, String third); String[][] createListOfLists(String one, String second, String third);
Map toMap(String key, Object value); Map<?, ?> toMap(String key, Object value);
} }

2
spring-context/src/test/java/org/springframework/ui/ModelMapTests.java

@ -276,7 +276,7 @@ public final class ModelMapTests {
ModelMap map = new ModelMap(); ModelMap map = new ModelMap();
Object proxy = Proxy.newProxyInstance( Object proxy = Proxy.newProxyInstance(
getClass().getClassLoader(), getClass().getClassLoader(),
new Class[] {Map.class}, new Class<?>[] {Map.class},
new InvocationHandler() { new InvocationHandler() {
public Object invoke(Object proxy, Method method, Object[] args) { public Object invoke(Object proxy, Method method, Object[] args) {
return "proxy"; return "proxy";

6
spring-context/src/test/java/org/springframework/validation/DataBinderFieldAccessTests.java

@ -50,7 +50,7 @@ public class DataBinderFieldAccessTests extends TestCase {
assertTrue("changed name correctly", rod.getName().equals("Rod")); assertTrue("changed name correctly", rod.getName().equals("Rod"));
assertTrue("changed age correctly", rod.getAge() == 32); assertTrue("changed age correctly", rod.getAge() == 32);
Map m = binder.getBindingResult().getModel(); Map<?, ?> m = binder.getBindingResult().getModel();
assertTrue("There is one element in map", m.size() == 2); assertTrue("There is one element in map", m.size() == 2);
FieldAccessBean tb = (FieldAccessBean) m.get("person"); FieldAccessBean tb = (FieldAccessBean) m.get("person");
assertTrue("Same object", tb.equals(rod)); assertTrue("Same object", tb.equals(rod));
@ -92,7 +92,7 @@ public class DataBinderFieldAccessTests extends TestCase {
assertTrue("changed name correctly", rod.getName().equals("Rod")); assertTrue("changed name correctly", rod.getName().equals("Rod"));
//assertTrue("changed age correctly", rod.getAge() == 32); //assertTrue("changed age correctly", rod.getAge() == 32);
Map map = binder.getBindingResult().getModel(); Map<?, ?> map = binder.getBindingResult().getModel();
//assertTrue("There are 3 element in map", m.size() == 1); //assertTrue("There are 3 element in map", m.size() == 1);
FieldAccessBean tb = (FieldAccessBean) map.get("person"); FieldAccessBean tb = (FieldAccessBean) map.get("person");
assertTrue("Same object", tb.equals(rod)); assertTrue("Same object", tb.equals(rod));
@ -136,7 +136,7 @@ public class DataBinderFieldAccessTests extends TestCase {
assertTrue("changed name correctly", rod.getName().equals("Rod")); assertTrue("changed name correctly", rod.getName().equals("Rod"));
//assertTrue("changed age correctly", rod.getAge() == 32); //assertTrue("changed age correctly", rod.getAge() == 32);
Map model = binder.getBindingResult().getModel(); Map<?, ?> model = binder.getBindingResult().getModel();
//assertTrue("There are 3 element in map", m.size() == 1); //assertTrue("There are 3 element in map", m.size() == 1);
FieldAccessBean tb = (FieldAccessBean) model.get("person"); FieldAccessBean tb = (FieldAccessBean) model.get("person");
assertTrue("Same object", tb.equals(rod)); assertTrue("Same object", tb.equals(rod));

22
spring-context/src/test/java/org/springframework/validation/DataBinderTests.java

@ -80,7 +80,7 @@ public class DataBinderTests extends TestCase {
assertTrue("changed name correctly", rod.getName().equals("Rod")); assertTrue("changed name correctly", rod.getName().equals("Rod"));
assertTrue("changed age correctly", rod.getAge() == 32); assertTrue("changed age correctly", rod.getAge() == 32);
Map map = binder.getBindingResult().getModel(); Map<?, ?> map = binder.getBindingResult().getModel();
assertTrue("There is one element in map", map.size() == 2); assertTrue("There is one element in map", map.size() == 2);
TestBean tb = (TestBean) map.get("person"); TestBean tb = (TestBean) map.get("person");
assertTrue("Same object", tb.equals(rod)); assertTrue("Same object", tb.equals(rod));
@ -190,7 +190,7 @@ public class DataBinderTests extends TestCase {
assertTrue("changed name correctly", rod.getName().equals("Rod")); assertTrue("changed name correctly", rod.getName().equals("Rod"));
//assertTrue("changed age correctly", rod.getAge() == 32); //assertTrue("changed age correctly", rod.getAge() == 32);
Map map = binder.getBindingResult().getModel(); Map<?, ?> map = binder.getBindingResult().getModel();
//assertTrue("There are 3 element in map", m.size() == 1); //assertTrue("There are 3 element in map", m.size() == 1);
TestBean tb = (TestBean) map.get("person"); TestBean tb = (TestBean) map.get("person");
assertTrue("Same object", tb.equals(rod)); assertTrue("Same object", tb.equals(rod));
@ -284,7 +284,7 @@ public class DataBinderTests extends TestCase {
assertTrue("changed name correctly", rod.getName().equals("Rod")); assertTrue("changed name correctly", rod.getName().equals("Rod"));
//assertTrue("changed age correctly", rod.getAge() == 32); //assertTrue("changed age correctly", rod.getAge() == 32);
Map model = binder.getBindingResult().getModel(); Map<?, ?> model = binder.getBindingResult().getModel();
//assertTrue("There are 3 element in map", m.size() == 1); //assertTrue("There are 3 element in map", m.size() == 1);
TestBean tb = (TestBean) model.get("person"); TestBean tb = (TestBean) model.get("person");
assertTrue("Same object", tb.equals(rod)); assertTrue("Same object", tb.equals(rod));
@ -1177,8 +1177,8 @@ public class DataBinderTests extends TestCase {
pvs.add("array[0].nestedIndexedBean.list[0].name", "test1"); pvs.add("array[0].nestedIndexedBean.list[0].name", "test1");
pvs.add("array[1].nestedIndexedBean.list[1].name", "test2"); pvs.add("array[1].nestedIndexedBean.list[1].name", "test2");
binder.bind(pvs); binder.bind(pvs);
assertEquals("listtest1", ((TestBean) tb.getArray()[0].getNestedIndexedBean().getList().get(0)).getName()); assertEquals("listtest1", tb.getArray()[0].getNestedIndexedBean().getList().get(0).getName());
assertEquals("listtest2", ((TestBean) tb.getArray()[1].getNestedIndexedBean().getList().get(1)).getName()); assertEquals("listtest2", tb.getArray()[1].getNestedIndexedBean().getList().get(1).getName());
assertEquals("test1", binder.getBindingResult().getFieldValue("array[0].nestedIndexedBean.list[0].name")); assertEquals("test1", binder.getBindingResult().getFieldValue("array[0].nestedIndexedBean.list[0].name"));
assertEquals("test2", binder.getBindingResult().getFieldValue("array[1].nestedIndexedBean.list[1].name")); assertEquals("test2", binder.getBindingResult().getFieldValue("array[1].nestedIndexedBean.list[1].name"));
} }
@ -1200,8 +1200,8 @@ public class DataBinderTests extends TestCase {
pvs.add("array[0].nestedIndexedBean.list[0].name", "test1"); pvs.add("array[0].nestedIndexedBean.list[0].name", "test1");
pvs.add("array[1].nestedIndexedBean.list[1].name", "test2"); pvs.add("array[1].nestedIndexedBean.list[1].name", "test2");
binder.bind(pvs); binder.bind(pvs);
assertEquals("listtest1", ((TestBean) tb.getArray()[0].getNestedIndexedBean().getList().get(0)).getName()); assertEquals("listtest1", tb.getArray()[0].getNestedIndexedBean().getList().get(0).getName());
assertEquals("test2", ((TestBean) tb.getArray()[1].getNestedIndexedBean().getList().get(1)).getName()); assertEquals("test2", tb.getArray()[1].getNestedIndexedBean().getList().get(1).getName());
assertEquals("test1", binder.getBindingResult().getFieldValue("array[0].nestedIndexedBean.list[0].name")); assertEquals("test1", binder.getBindingResult().getFieldValue("array[0].nestedIndexedBean.list[0].name"));
assertEquals("test2", binder.getBindingResult().getFieldValue("array[1].nestedIndexedBean.list[1].name")); assertEquals("test2", binder.getBindingResult().getFieldValue("array[1].nestedIndexedBean.list[1].name"));
} }
@ -1223,8 +1223,8 @@ public class DataBinderTests extends TestCase {
pvs.add("array[0].nestedIndexedBean.list[0].name", "test1"); pvs.add("array[0].nestedIndexedBean.list[0].name", "test1");
pvs.add("array[1].nestedIndexedBean.list[1].name", "test2"); pvs.add("array[1].nestedIndexedBean.list[1].name", "test2");
binder.bind(pvs); binder.bind(pvs);
assertEquals("listtest1", ((TestBean) tb.getArray()[0].getNestedIndexedBean().getList().get(0)).getName()); assertEquals("listtest1", tb.getArray()[0].getNestedIndexedBean().getList().get(0).getName());
assertEquals("test2", ((TestBean) tb.getArray()[1].getNestedIndexedBean().getList().get(1)).getName()); assertEquals("test2", tb.getArray()[1].getNestedIndexedBean().getList().get(1).getName());
assertEquals("test1", binder.getBindingResult().getFieldValue("array[0].nestedIndexedBean.list[0].name")); assertEquals("test1", binder.getBindingResult().getFieldValue("array[0].nestedIndexedBean.list[0].name"));
assertEquals("test2", binder.getBindingResult().getFieldValue("array[1].nestedIndexedBean.list[1].name")); assertEquals("test2", binder.getBindingResult().getFieldValue("array[1].nestedIndexedBean.list[1].name"));
} }
@ -1647,7 +1647,7 @@ public class DataBinderTests extends TestCase {
private static class TestBeanValidator implements Validator { private static class TestBeanValidator implements Validator {
public boolean supports(Class clazz) { public boolean supports(Class<?> clazz) {
return TestBean.class.isAssignableFrom(clazz); return TestBean.class.isAssignableFrom(clazz);
} }
@ -1674,7 +1674,7 @@ public class DataBinderTests extends TestCase {
private static class SpouseValidator implements Validator { private static class SpouseValidator implements Validator {
public boolean supports(Class clazz) { public boolean supports(Class<?> clazz) {
return TestBean.class.isAssignableFrom(clazz); return TestBean.class.isAssignableFrom(clazz);
} }

4
spring-context/src/test/java/org/springframework/validation/ValidationUtilsTests.java

@ -161,7 +161,7 @@ public class ValidationUtilsTests {
private static class EmptyValidator implements Validator { private static class EmptyValidator implements Validator {
public boolean supports(Class clazz) { public boolean supports(Class<?> clazz) {
return TestBean.class.isAssignableFrom(clazz); return TestBean.class.isAssignableFrom(clazz);
} }
@ -173,7 +173,7 @@ public class ValidationUtilsTests {
private static class EmptyOrWhitespaceValidator implements Validator { private static class EmptyOrWhitespaceValidator implements Validator {
public boolean supports(Class clazz) { public boolean supports(Class<?> clazz) {
return TestBean.class.isAssignableFrom(clazz); return TestBean.class.isAssignableFrom(clazz);
} }

2
spring-context/src/test/java/org/springframework/validation/beanvalidation/ValidatorFactoryTests.java

@ -95,7 +95,7 @@ public class ValidatorFactoryTests {
Set<ConstraintViolation<ValidPerson>> result = validator.validate(person); Set<ConstraintViolation<ValidPerson>> result = validator.validate(person);
assertEquals(1, result.size()); assertEquals(1, result.size());
Iterator<ConstraintViolation<ValidPerson>> iterator = result.iterator(); Iterator<ConstraintViolation<ValidPerson>> iterator = result.iterator();
ConstraintViolation cv = iterator.next(); ConstraintViolation<?> cv = iterator.next();
assertEquals("", cv.getPropertyPath().toString()); assertEquals("", cv.getPropertyPath().toString());
assertTrue(cv.getConstraintDescriptor().getAnnotation() instanceof NameAddressValid); assertTrue(cv.getConstraintDescriptor().getAnnotation() instanceof NameAddressValid);
} }

8
spring-core/src/test/java/org/springframework/core/ConventionsTests.java

@ -41,15 +41,15 @@ public class ConventionsTests extends TestCase {
} }
public void testCollections() { public void testCollections() {
List list = new ArrayList(); List<TestBean> list = new ArrayList<TestBean>();
list.add(new TestBean()); list.add(new TestBean());
assertEquals("Incorrect plural List form", "testBeanList", Conventions.getVariableName(list)); assertEquals("Incorrect plural List form", "testBeanList", Conventions.getVariableName(list));
Set set = new HashSet(); Set<TestBean> set = new HashSet<TestBean>();
set.add(new TestBean()); set.add(new TestBean());
assertEquals("Incorrect plural Set form", "testBeanList", Conventions.getVariableName(set)); assertEquals("Incorrect plural Set form", "testBeanList", Conventions.getVariableName(set));
List emptyList = new ArrayList(); List<?> emptyList = new ArrayList<Object>();
try { try {
Conventions.getVariableName(emptyList); Conventions.getVariableName(emptyList);
fail("Should not be able to generate name for empty collection"); fail("Should not be able to generate name for empty collection");
@ -67,7 +67,7 @@ public class ConventionsTests extends TestCase {
public void testGetQualifiedAttributeName() throws Exception { public void testGetQualifiedAttributeName() throws Exception {
String baseName = "foo"; String baseName = "foo";
Class cls = String.class; Class<String> cls = String.class;
String desiredResult = "java.lang.String.foo"; String desiredResult = "java.lang.String.foo";
assertEquals(desiredResult, Conventions.getQualifiedAttributeName(cls, baseName)); assertEquals(desiredResult, Conventions.getQualifiedAttributeName(cls, baseName));
} }

23
spring-core/src/test/java/org/springframework/core/LocalVariableTableParameterNameDiscovererTests.java

@ -50,14 +50,14 @@ public class LocalVariableTableParameterNameDiscovererTests extends TestCase {
} }
public void testConsParameterNameDiscoveryNoArgs() throws NoSuchMethodException { public void testConsParameterNameDiscoveryNoArgs() throws NoSuchMethodException {
Constructor noArgsCons = TestBean.class.getConstructor(new Class[0]); Constructor<TestBean> noArgsCons = TestBean.class.getConstructor(new Class[0]);
String[] names = discoverer.getParameterNames(noArgsCons); String[] names = discoverer.getParameterNames(noArgsCons);
assertNotNull("should find cons info", names); assertNotNull("should find cons info", names);
assertEquals("no argument names", 0, names.length); assertEquals("no argument names", 0, names.length);
} }
public void testConsParameterNameDiscoveryArgs() throws NoSuchMethodException { public void testConsParameterNameDiscoveryArgs() throws NoSuchMethodException {
Constructor twoArgCons = TestBean.class.getConstructor(new Class[] { String.class, int.class }); Constructor<TestBean> twoArgCons = TestBean.class.getConstructor(new Class[] { String.class, int.class });
String[] names = discoverer.getParameterNames(twoArgCons); String[] names = discoverer.getParameterNames(twoArgCons);
assertNotNull("should find cons info", names); assertNotNull("should find cons info", names);
assertEquals("one argument", 2, names.length); assertEquals("one argument", 2, names.length);
@ -73,7 +73,7 @@ public class LocalVariableTableParameterNameDiscovererTests extends TestCase {
} }
public void testOverloadedStaticMethod() throws Exception { public void testOverloadedStaticMethod() throws Exception {
Class clazz = this.getClass(); Class<? extends LocalVariableTableParameterNameDiscovererTests> clazz = this.getClass();
Method m1 = clazz.getMethod("staticMethod", new Class[] { Long.TYPE, Long.TYPE }); Method m1 = clazz.getMethod("staticMethod", new Class[] { Long.TYPE, Long.TYPE });
String[] names = discoverer.getParameterNames(m1); String[] names = discoverer.getParameterNames(m1);
@ -92,7 +92,7 @@ public class LocalVariableTableParameterNameDiscovererTests extends TestCase {
} }
public void testOverloadedStaticMethodInInnerClass() throws Exception { public void testOverloadedStaticMethodInInnerClass() throws Exception {
Class clazz = InnerClass.class; Class<InnerClass> clazz = InnerClass.class;
Method m1 = clazz.getMethod("staticMethod", new Class[] { Long.TYPE }); Method m1 = clazz.getMethod("staticMethod", new Class[] { Long.TYPE });
String[] names = discoverer.getParameterNames(m1); String[] names = discoverer.getParameterNames(m1);
@ -109,7 +109,7 @@ public class LocalVariableTableParameterNameDiscovererTests extends TestCase {
} }
public void testOverloadedMethod() throws Exception { public void testOverloadedMethod() throws Exception {
Class clazz = this.getClass(); Class<? extends LocalVariableTableParameterNameDiscovererTests> clazz = this.getClass();
Method m1 = clazz.getMethod("instanceMethod", new Class[] { Double.TYPE, Double.TYPE }); Method m1 = clazz.getMethod("instanceMethod", new Class[] { Double.TYPE, Double.TYPE });
String[] names = discoverer.getParameterNames(m1); String[] names = discoverer.getParameterNames(m1);
@ -128,7 +128,7 @@ public class LocalVariableTableParameterNameDiscovererTests extends TestCase {
} }
public void testOverloadedMethodInInnerClass() throws Exception { public void testOverloadedMethodInInnerClass() throws Exception {
Class clazz = InnerClass.class; Class<InnerClass> clazz = InnerClass.class;
Method m1 = clazz.getMethod("instanceMethod", new Class[] { String.class }); Method m1 = clazz.getMethod("instanceMethod", new Class[] { String.class });
String[] names = discoverer.getParameterNames(m1); String[] names = discoverer.getParameterNames(m1);
@ -145,9 +145,9 @@ public class LocalVariableTableParameterNameDiscovererTests extends TestCase {
} }
public void testGenerifiedClass() throws Exception { public void testGenerifiedClass() throws Exception {
Class clazz = GenerifiedClass.class; Class<?> clazz = (Class<?>)GenerifiedClass.class;
Constructor ctor = clazz.getDeclaredConstructor(Object.class); Constructor<?> ctor = clazz.getDeclaredConstructor(Object.class);
String[] names = discoverer.getParameterNames(ctor); String[] names = discoverer.getParameterNames(ctor);
assertEquals(1, names.length); assertEquals(1, names.length);
assertEquals("key", names[0]); assertEquals("key", names[0]);
@ -199,7 +199,7 @@ public class LocalVariableTableParameterNameDiscovererTests extends TestCase {
@Ignore @Ignore
public void ignore_testClassesWithoutDebugSymbols() throws Exception { public void ignore_testClassesWithoutDebugSymbols() throws Exception {
// JDK classes don't have debug information (usually) // JDK classes don't have debug information (usually)
Class clazz = Component.class; Class<Component> clazz = Component.class;
String methodName = "list"; String methodName = "list";
Method m = clazz.getMethod(methodName); Method m = clazz.getMethod(methodName);
@ -275,9 +275,6 @@ public class LocalVariableTableParameterNameDiscovererTests extends TestCase {
public static class GenerifiedClass<K, V> { public static class GenerifiedClass<K, V> {
private static long date; private static long date;
private K key;
private V value;
static { static {
// some custom static bloc or <clinit> // some custom static bloc or <clinit>
date = new Date().getTime(); date = new Date().getTime();
@ -292,8 +289,6 @@ public class LocalVariableTableParameterNameDiscovererTests extends TestCase {
} }
public GenerifiedClass(K key, V value) { public GenerifiedClass(K key, V value) {
this.key = key;
this.value = value;
} }
public static <P> long generifiedStaticMethod(P param) { public static <P> long generifiedStaticMethod(P param) {

10
spring-core/src/test/java/org/springframework/util/AssertTests.java

@ -38,7 +38,7 @@ public class AssertTests {
@Test(expected = IllegalArgumentException.class) @Test(expected = IllegalArgumentException.class)
public void instanceOf() { public void instanceOf() {
final Set set = new HashSet(); final Set<?> set = new HashSet<Object>();
Assert.isInstanceOf(HashSet.class, set); Assert.isInstanceOf(HashSet.class, set);
Assert.isInstanceOf(HashMap.class, set); Assert.isInstanceOf(HashMap.class, set);
} }
@ -105,12 +105,12 @@ public class AssertTests {
@Test(expected = IllegalArgumentException.class) @Test(expected = IllegalArgumentException.class)
public void assertNotEmptyWithNullCollectionThrowsException() throws Exception { public void assertNotEmptyWithNullCollectionThrowsException() throws Exception {
Assert.notEmpty((Collection) null); Assert.notEmpty((Collection<?>) null);
} }
@Test(expected = IllegalArgumentException.class) @Test(expected = IllegalArgumentException.class)
public void assertNotEmptyWithEmptyCollectionThrowsException() throws Exception { public void assertNotEmptyWithEmptyCollectionThrowsException() throws Exception {
Assert.notEmpty(new ArrayList()); Assert.notEmpty(new ArrayList<Object>());
} }
@Test @Test
@ -122,12 +122,12 @@ public class AssertTests {
@Test(expected = IllegalArgumentException.class) @Test(expected = IllegalArgumentException.class)
public void assertNotEmptyWithNullMapThrowsException() throws Exception { public void assertNotEmptyWithNullMapThrowsException() throws Exception {
Assert.notEmpty((Map) null); Assert.notEmpty((Map<?, ?>) null);
} }
@Test(expected = IllegalArgumentException.class) @Test(expected = IllegalArgumentException.class)
public void assertNotEmptyWithEmptyMapThrowsException() throws Exception { public void assertNotEmptyWithEmptyMapThrowsException() throws Exception {
Assert.notEmpty(new HashMap()); Assert.notEmpty(new HashMap<Object, Object>());
} }
@Test @Test

14
spring-core/src/test/java/org/springframework/util/AutoPopulatingListTests.java

@ -30,22 +30,22 @@ import org.springframework.beans.TestBean;
public class AutoPopulatingListTests extends TestCase { public class AutoPopulatingListTests extends TestCase {
public void testWithClass() throws Exception { public void testWithClass() throws Exception {
doTestWithClass(new AutoPopulatingList(TestBean.class)); doTestWithClass(new AutoPopulatingList<Object>(TestBean.class));
} }
public void testWithClassAndUserSuppliedBackingList() throws Exception { public void testWithClassAndUserSuppliedBackingList() throws Exception {
doTestWithClass(new AutoPopulatingList(new LinkedList(), TestBean.class)); doTestWithClass(new AutoPopulatingList<Object>(new LinkedList<Object>(), TestBean.class));
} }
public void testWithElementFactory() throws Exception { public void testWithElementFactory() throws Exception {
doTestWithElementFactory(new AutoPopulatingList(new MockElementFactory())); doTestWithElementFactory(new AutoPopulatingList<Object>(new MockElementFactory()));
} }
public void testWithElementFactoryAndUserSuppliedBackingList() throws Exception { public void testWithElementFactoryAndUserSuppliedBackingList() throws Exception {
doTestWithElementFactory(new AutoPopulatingList(new LinkedList(), new MockElementFactory())); doTestWithElementFactory(new AutoPopulatingList<Object>(new LinkedList<Object>(), new MockElementFactory()));
} }
private void doTestWithClass(AutoPopulatingList list) { private void doTestWithClass(AutoPopulatingList<Object> list) {
Object lastElement = null; Object lastElement = null;
for (int x = 0; x < 10; x++) { for (int x = 0; x < 10; x++) {
Object element = list.get(x); Object element = list.get(x);
@ -66,7 +66,7 @@ public class AutoPopulatingListTests extends TestCase {
assertTrue(list.get(20) instanceof TestBean); assertTrue(list.get(20) instanceof TestBean);
} }
private void doTestWithElementFactory(AutoPopulatingList list) { private void doTestWithElementFactory(AutoPopulatingList<Object> list) {
doTestWithClass(list); doTestWithClass(list);
for(int x = 0; x < list.size(); x++) { for(int x = 0; x < list.size(); x++) {
@ -78,7 +78,7 @@ public class AutoPopulatingListTests extends TestCase {
} }
public void testSerialization() throws Exception { public void testSerialization() throws Exception {
AutoPopulatingList list = new AutoPopulatingList(TestBean.class); AutoPopulatingList<?> list = new AutoPopulatingList<Object>(TestBean.class);
Assert.assertEquals(list, SerializationTestUtils.serializeAndDeserialize(list)); Assert.assertEquals(list, SerializationTestUtils.serializeAndDeserialize(list));
} }

58
spring-core/src/test/java/org/springframework/util/CollectionUtilsTests.java

@ -40,16 +40,16 @@ public class CollectionUtilsTests {
@Test @Test
public void testIsEmpty() { public void testIsEmpty() {
assertTrue(CollectionUtils.isEmpty((Set) null)); assertTrue(CollectionUtils.isEmpty((Set<Object>) null));
assertTrue(CollectionUtils.isEmpty((Map) null)); assertTrue(CollectionUtils.isEmpty((Map<String, String>) null));
assertTrue(CollectionUtils.isEmpty(new HashMap())); assertTrue(CollectionUtils.isEmpty(new HashMap<String, String>()));
assertTrue(CollectionUtils.isEmpty(new HashSet())); assertTrue(CollectionUtils.isEmpty(new HashSet<Object>()));
List list = new LinkedList(); List<Object> list = new LinkedList<Object>();
list.add(new Object()); list.add(new Object());
assertFalse(CollectionUtils.isEmpty(list)); assertFalse(CollectionUtils.isEmpty(list));
Map map = new HashMap(); Map<String, String> map = new HashMap<String, String>();
map.put("foo", "bar"); map.put("foo", "bar");
assertFalse(CollectionUtils.isEmpty(map)); assertFalse(CollectionUtils.isEmpty(map));
} }
@ -57,7 +57,7 @@ public class CollectionUtilsTests {
@Test @Test
public void testMergeArrayIntoCollection() { public void testMergeArrayIntoCollection() {
Object[] arr = new Object[] {"value1", "value2"}; Object[] arr = new Object[] {"value1", "value2"};
List list = new LinkedList(); List<Comparable<?>> list = new LinkedList<Comparable<?>>();
list.add("value3"); list.add("value3");
CollectionUtils.mergeArrayIntoCollection(arr, list); CollectionUtils.mergeArrayIntoCollection(arr, list);
@ -69,7 +69,7 @@ public class CollectionUtilsTests {
@Test @Test
public void testMergePrimitiveArrayIntoCollection() { public void testMergePrimitiveArrayIntoCollection() {
int[] arr = new int[] {1, 2}; int[] arr = new int[] {1, 2};
List list = new LinkedList(); List<Comparable<?>> list = new LinkedList<Comparable<?>>();
list.add(new Integer(3)); list.add(new Integer(3));
CollectionUtils.mergeArrayIntoCollection(arr, list); CollectionUtils.mergeArrayIntoCollection(arr, list);
@ -86,7 +86,7 @@ public class CollectionUtilsTests {
props.setProperty("prop2", "value2"); props.setProperty("prop2", "value2");
props.put("prop3", new Integer(3)); props.put("prop3", new Integer(3));
Map map = new HashMap(); Map<String, String> map = new HashMap<String, String>();
map.put("prop4", "value4"); map.put("prop4", "value4");
CollectionUtils.mergePropertiesIntoMap(props, map); CollectionUtils.mergePropertiesIntoMap(props, map);
@ -98,28 +98,28 @@ public class CollectionUtilsTests {
@Test @Test
public void testContains() { public void testContains() {
assertFalse(CollectionUtils.contains((Iterator) null, "myElement")); assertFalse(CollectionUtils.contains((Iterator<String>) null, "myElement"));
assertFalse(CollectionUtils.contains((Enumeration) null, "myElement")); assertFalse(CollectionUtils.contains((Enumeration<String>) null, "myElement"));
assertFalse(CollectionUtils.contains(new LinkedList().iterator(), "myElement")); assertFalse(CollectionUtils.contains(new LinkedList<String>().iterator(), "myElement"));
assertFalse(CollectionUtils.contains(new Hashtable().keys(), "myElement")); assertFalse(CollectionUtils.contains(new Hashtable<String, Object>().keys(), "myElement"));
List list = new LinkedList(); List<String> list = new LinkedList<String>();
list.add("myElement"); list.add("myElement");
assertTrue(CollectionUtils.contains(list.iterator(), "myElement")); assertTrue(CollectionUtils.contains(list.iterator(), "myElement"));
Hashtable ht = new Hashtable(); Hashtable<String, String> ht = new Hashtable<String, String>();
ht.put("myElement", "myValue"); ht.put("myElement", "myValue");
assertTrue(CollectionUtils.contains(ht.keys(), "myElement")); assertTrue(CollectionUtils.contains(ht.keys(), "myElement"));
} }
@Test @Test
public void testContainsAny() throws Exception { public void testContainsAny() throws Exception {
List source = new ArrayList(); List<String> source = new ArrayList<String>();
source.add("abc"); source.add("abc");
source.add("def"); source.add("def");
source.add("ghi"); source.add("ghi");
List candidates = new ArrayList(); List<String> candidates = new ArrayList<String>();
candidates.add("xyz"); candidates.add("xyz");
candidates.add("def"); candidates.add("def");
candidates.add("abc"); candidates.add("abc");
@ -139,7 +139,7 @@ public class CollectionUtilsTests {
@Test @Test
public void testContainsInstanceWithInstancesThatAreEqualButDistinct() throws Exception { public void testContainsInstanceWithInstancesThatAreEqualButDistinct() throws Exception {
List list = new ArrayList(); List<Instance> list = new ArrayList<Instance>();
list.add(new Instance("fiona")); list.add(new Instance("fiona"));
assertFalse("Must return false if instance is not in the supplied Collection argument", assertFalse("Must return false if instance is not in the supplied Collection argument",
CollectionUtils.containsInstance(list, new Instance("fiona"))); CollectionUtils.containsInstance(list, new Instance("fiona")));
@ -147,7 +147,7 @@ public class CollectionUtilsTests {
@Test @Test
public void testContainsInstanceWithSameInstance() throws Exception { public void testContainsInstanceWithSameInstance() throws Exception {
List list = new ArrayList(); List<Instance> list = new ArrayList<Instance>();
list.add(new Instance("apple")); list.add(new Instance("apple"));
Instance instance = new Instance("fiona"); Instance instance = new Instance("fiona");
list.add(instance); list.add(instance);
@ -157,7 +157,7 @@ public class CollectionUtilsTests {
@Test @Test
public void testContainsInstanceWithNullInstance() throws Exception { public void testContainsInstanceWithNullInstance() throws Exception {
List list = new ArrayList(); List<Instance> list = new ArrayList<Instance>();
list.add(new Instance("apple")); list.add(new Instance("apple"));
list.add(new Instance("fiona")); list.add(new Instance("fiona"));
assertFalse("Must return false if null instance is supplied", assertFalse("Must return false if null instance is supplied",
@ -166,12 +166,12 @@ public class CollectionUtilsTests {
@Test @Test
public void testFindFirstMatch() throws Exception { public void testFindFirstMatch() throws Exception {
List source = new ArrayList(); List<String> source = new ArrayList<String>();
source.add("abc"); source.add("abc");
source.add("def"); source.add("def");
source.add("ghi"); source.add("ghi");
List candidates = new ArrayList(); List<String> candidates = new ArrayList<String>();
candidates.add("xyz"); candidates.add("xyz");
candidates.add("def"); candidates.add("def");
candidates.add("abc"); candidates.add("abc");
@ -181,35 +181,35 @@ public class CollectionUtilsTests {
@Test @Test
public void testHasUniqueObject() { public void testHasUniqueObject() {
List list = new LinkedList(); List<String> list = new LinkedList<String>();
list.add("myElement"); list.add("myElement");
list.add("myOtherElement"); list.add("myOtherElement");
assertFalse(CollectionUtils.hasUniqueObject(list)); assertFalse(CollectionUtils.hasUniqueObject(list));
list = new LinkedList(); list = new LinkedList<String>();
list.add("myElement"); list.add("myElement");
assertTrue(CollectionUtils.hasUniqueObject(list)); assertTrue(CollectionUtils.hasUniqueObject(list));
list = new LinkedList(); list = new LinkedList<String>();
list.add("myElement"); list.add("myElement");
list.add(null); list.add(null);
assertFalse(CollectionUtils.hasUniqueObject(list)); assertFalse(CollectionUtils.hasUniqueObject(list));
list = new LinkedList(); list = new LinkedList<String>();
list.add(null); list.add(null);
list.add("myElement"); list.add("myElement");
assertFalse(CollectionUtils.hasUniqueObject(list)); assertFalse(CollectionUtils.hasUniqueObject(list));
list = new LinkedList(); list = new LinkedList<String>();
list.add(null); list.add(null);
list.add(null); list.add(null);
assertTrue(CollectionUtils.hasUniqueObject(list)); assertTrue(CollectionUtils.hasUniqueObject(list));
list = new LinkedList(); list = new LinkedList<String>();
list.add(null); list.add(null);
assertTrue(CollectionUtils.hasUniqueObject(list)); assertTrue(CollectionUtils.hasUniqueObject(list));
list = new LinkedList(); list = new LinkedList<String>();
assertFalse(CollectionUtils.hasUniqueObject(list)); assertFalse(CollectionUtils.hasUniqueObject(list));
} }

16
spring-core/src/test/java/org/springframework/util/MethodInvokerTests.java

@ -43,14 +43,14 @@ public class MethodInvokerTests extends TestCase {
mi = new MethodInvoker(); mi = new MethodInvoker();
mi.setTargetClass(TestClass1.class); mi.setTargetClass(TestClass1.class);
mi.setTargetMethod("supertypes"); mi.setTargetMethod("supertypes");
mi.setArguments(new Object[] {new ArrayList(), new ArrayList(), "hello"}); mi.setArguments(new Object[] {new ArrayList<>(), new ArrayList<>(), "hello"});
mi.prepare(); mi.prepare();
assertEquals("hello", mi.invoke()); assertEquals("hello", mi.invoke());
mi = new MethodInvoker(); mi = new MethodInvoker();
mi.setTargetClass(TestClass1.class); mi.setTargetClass(TestClass1.class);
mi.setTargetMethod("supertypes2"); mi.setTargetMethod("supertypes2");
mi.setArguments(new Object[] {new ArrayList(), new ArrayList(), "hello", "bogus"}); mi.setArguments(new Object[] {new ArrayList<>(), new ArrayList<>(), "hello", "bogus"});
mi.prepare(); mi.prepare();
assertEquals("hello", mi.invoke()); assertEquals("hello", mi.invoke());
@ -58,7 +58,7 @@ public class MethodInvokerTests extends TestCase {
mi = new MethodInvoker(); mi = new MethodInvoker();
mi.setTargetClass(TestClass1.class); mi.setTargetClass(TestClass1.class);
mi.setTargetMethod("supertypes2"); mi.setTargetMethod("supertypes2");
mi.setArguments(new Object[] {new ArrayList(), new ArrayList(), "hello", Boolean.TRUE}); mi.setArguments(new Object[] {new ArrayList<>(), new ArrayList<>(), "hello", Boolean.TRUE});
try { try {
mi.prepare(); mi.prepare();
fail("Shouldn't have matched without argument conversion"); fail("Shouldn't have matched without argument conversion");
@ -169,23 +169,23 @@ public class MethodInvokerTests extends TestCase {
public static void intArguments(int[] arg) { public static void intArguments(int[] arg) {
} }
public static String supertypes(Collection c, Integer i) { public static String supertypes(Collection<?> c, Integer i) {
return i.toString(); return i.toString();
} }
public static String supertypes(Collection c, List l, String s) { public static String supertypes(Collection<?> c, List<?> l, String s) {
return s; return s;
} }
public static String supertypes2(Collection c, List l, Integer i) { public static String supertypes2(Collection<?> c, List<?> l, Integer i) {
return i.toString(); return i.toString();
} }
public static String supertypes2(Collection c, List l, String s, Integer i) { public static String supertypes2(Collection<?> c, List<?> l, String s, Integer i) {
return s; return s;
} }
public static String supertypes2(Collection c, List l, String s, String s2) { public static String supertypes2(Collection<?> c, List<?> l, String s, String s2) {
return s; return s;
} }
} }

Loading…
Cancel
Save