Fix various compiler warnings in spring-context

All warning types other than [deprecation] and [unchecked] are now
fixed in spring-context/src/test
This commit is contained in:
Chris Beams 2012-12-19 16:03:11 +01:00
parent 4c7cafbde6
commit 40357be72b
4 changed files with 5 additions and 9 deletions

View File

@ -40,8 +40,7 @@ public class ServiceInvocationCounter {
@Before("serviceExecution()") @Before("serviceExecution()")
public void countUse() { public void countUse() {
this.useCount++; this.useCount++;
this.threadLocalCount.set(this.useCount); threadLocalCount.set(this.useCount);
System.out.println("");
} }
public int getCount() { public int getCount() {

View File

@ -70,8 +70,8 @@ public class SimpleMapScope implements Scope, Serializable {
} }
public void close() { public void close() {
for (Iterator it = this.callbacks.iterator(); it.hasNext();) { for (Iterator<Runnable> it = this.callbacks.iterator(); it.hasNext();) {
Runnable runnable = (Runnable) it.next(); Runnable runnable = it.next();
runnable.run(); runnable.run();
} }
} }

View File

@ -99,14 +99,11 @@ public class ConfigurationClassAndBFPPTests {
@Test @Test
@SuppressWarnings("static-access")
public void staticBeanMethodsDoNotRespectScoping() { public void staticBeanMethodsDoNotRespectScoping() {
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(); AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
ctx.register(ConfigWithStaticBeanMethod.class); ctx.register(ConfigWithStaticBeanMethod.class);
ctx.refresh(); ctx.refresh();
assertThat(ConfigWithStaticBeanMethod.testBean(), not(sameInstance(ConfigWithStaticBeanMethod.testBean())));
ConfigWithStaticBeanMethod config = ctx.getBean(ConfigWithStaticBeanMethod.class);
assertThat(config.testBean(), not(sameInstance(config.testBean())));
} }

View File

@ -1444,7 +1444,6 @@ public class DataBinderTests extends TestCase {
assertEquals("badName", nameError.getCode()); assertEquals("badName", nameError.getCode());
} }
@SuppressWarnings("unchecked")
public void testBindingWithResortedList() { public void testBindingWithResortedList() {
IndexedTestBean tb = new IndexedTestBean(); IndexedTestBean tb = new IndexedTestBean();
DataBinder binder = new DataBinder(tb, "tb"); DataBinder binder = new DataBinder(tb, "tb");
@ -1590,6 +1589,7 @@ public class DataBinderTests extends TestCase {
mpv.add("f[list][1]", "secondValue"); mpv.add("f[list][1]", "secondValue");
binder.bind(mpv); binder.bind(mpv);
assertFalse(binder.getBindingResult().hasErrors()); assertFalse(binder.getBindingResult().hasErrors());
@SuppressWarnings("unchecked")
List<Object> list = (List<Object>) form.getF().get("list"); List<Object> list = (List<Object>) form.getF().get("list");
assertEquals("firstValue", list.get(0)); assertEquals("firstValue", list.get(0));
assertEquals("secondValue", list.get(1)); assertEquals("secondValue", list.get(1));