Merge branch 'cleanup-3.2.x' into 3.2.x

* cleanup-3.2.x:
  Fix unnecessary @SupressWarnings annotations
  Fix Javadoc warnings
  Fix unused local variable warnings
  Fix unused type compiler warnings
  Fix 'is already an instance of type' warnings
This commit is contained in:
Phillip Webb
2013-01-31 12:52:51 -08:00
94 changed files with 280 additions and 193 deletions

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -658,6 +658,7 @@ public class PathMatchingResourcePatternResolver implements ResourcePatternResol
/**
* VFS visitor for path matching purposes.
*/
@SuppressWarnings("unused")
private static class PatternVirtualFileVisitor implements InvocationHandler {
private final String subPattern;

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -481,7 +481,7 @@ public abstract class ObjectUtils {
}
/**
* Return the same value as {@code {@link Boolean#hashCode()}}.
* Return the same value as {@link Boolean#hashCode()}}.
* @see Boolean#hashCode()
*/
public static int hashCode(boolean bool) {
@@ -489,7 +489,7 @@ public abstract class ObjectUtils {
}
/**
* Return the same value as {@code {@link Double#hashCode()}}.
* Return the same value as {@link Double#hashCode()}}.
* @see Double#hashCode()
*/
public static int hashCode(double dbl) {
@@ -498,7 +498,7 @@ public abstract class ObjectUtils {
}
/**
* Return the same value as {@code {@link Float#hashCode()}}.
* Return the same value as {@link Float#hashCode()}}.
* @see Float#hashCode()
*/
public static int hashCode(float flt) {
@@ -506,7 +506,7 @@ public abstract class ObjectUtils {
}
/**
* Return the same value as {@code {@link Long#hashCode()}}.
* Return the same value as {@link Long#hashCode()}}.
* @see Long#hashCode()
*/
public static int hashCode(long lng) {

View File

@@ -560,6 +560,7 @@ public class BridgeMethodResolverTests {
}
@SuppressWarnings("unused")
private static class StringGenericParameter implements GenericParameter<String> {
@Override
@@ -1163,6 +1164,7 @@ public class BridgeMethodResolverTests {
}
@SuppressWarnings("unused")
private static class MegaMessageProducerImpl extends Other<Long, String> implements MegaMessageProducer {
public void receive(NewMegaMessageEvent event) {
@@ -1198,6 +1200,7 @@ public class BridgeMethodResolverTests {
}
@SuppressWarnings("unused")
private static abstract class AbstractImplementsInterface<D extends DomainObjectSuper> implements IGenericInterface<D> {
@Override

View File

@@ -358,7 +358,6 @@ public class GenericConversionServiceTests {
GenericConversionService service = new DefaultConversionService();
List<String> list1 = Arrays.asList("Foo", "Bar");
List<String> list2 = Arrays.asList("Baz", "Boop");
@SuppressWarnings("unchecked")
List<List<String>> list = Arrays.asList(list1, list2);
String result = service.convert(list, String.class);
assertNotNull(result);

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -104,7 +104,7 @@ public class LabeledEnumTests extends TestCase {
public void testDoesNotMatchWrongClass() {
try {
LabeledEnum none = StaticLabeledEnumResolver.instance().getLabeledEnumByCode(Dog.class,
StaticLabeledEnumResolver.instance().getLabeledEnumByCode(Dog.class,
new Short((short) 1));
fail("Should have failed");
}
@@ -119,10 +119,11 @@ public class LabeledEnumTests extends TestCase {
}
@SuppressWarnings("serial")
@SuppressWarnings({ "serial", "unused" })
private static class Other extends StaticLabeledEnum {
public static final Other THING1 = new Other(1, "Thing1");
public static final Other THING2 = new Other(2, "Thing2");

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2011 the original author or authors.
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -122,10 +122,12 @@ public class AnnotationTypeFilterTests {
}
@SuppressWarnings("unused")
private static class SomeSubClassOfSomeComponentInterface implements SomeComponentInterface {
}
@SuppressWarnings("unused")
private static class SomeSubClassOfSomeComponent extends SomeComponent {
}
@@ -139,10 +141,12 @@ public class AnnotationTypeFilterTests {
}
@SuppressWarnings("unused")
private static class SomeSubclassOfSomeClassMarkedWithNonInheritedAnnotation extends SomeClassMarkedWithNonInheritedAnnotation {
}
@SuppressWarnings("unused")
private static class SomeNonCandidateClass {
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -81,6 +81,7 @@ public class AssignableTypeFilterTests extends TestCase {
}
@SuppressWarnings("unused")
private static class TestInterfaceImpl implements TestInterface {
}
@@ -89,6 +90,7 @@ public class AssignableTypeFilterTests extends TestCase {
}
@SuppressWarnings("unused")
private static class SomeDaoLikeImpl extends SimpleJdbcDaoSupport implements SomeDaoLikeInterface {
}

View File

@@ -31,7 +31,7 @@ import org.springframework.tests.Assume;
import org.springframework.tests.TestGroup;
/**
* Unit test checking the behaviour of {@link CachingMetadataReaderFactory under load.
* Unit test checking the behaviour of {@link CachingMetadataReaderFactory} under load.
* If the cache is not controller, this test should fail with an out of memory exception around entry
* 5k.
*

View File

@@ -308,19 +308,25 @@ public class ClassUtilsTests extends TestCase {
}
}
@SuppressWarnings("unused")
private static class OverloadedMethodsClass {
public void print(String messages) {
/* no-op */
}
public void print(String[] messages) {
/* no-op */
}
}
private static class SubOverloadedMethodsClass extends OverloadedMethodsClass{
@SuppressWarnings("unused")
private static class SubOverloadedMethodsClass extends OverloadedMethodsClass {
public void print(String header, String[] messages) {
/* no-op */
}
void print(String header, String[] messages, String footer) {
/* no-op */
}

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -191,6 +191,7 @@ public class MethodInvokerTests extends TestCase {
}
@SuppressWarnings("unused")
public static class Greeter {
// should handle Salesman (only interface)

View File

@@ -1,6 +1,6 @@
/*
* Copyright 2002-2012 the original author or authors.
* Copyright 2002-2013 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -34,7 +34,6 @@ public class StopWatchTests extends TestCase {
String name1 = "Task 1";
String name2 = "Task 2";
long fudgeFactor = 5L;
assertFalse(sw.isRunning());
sw.start(name1);
Thread.sleep(int1);
@@ -44,6 +43,7 @@ public class StopWatchTests extends TestCase {
// TODO are timings off in JUnit? Why do these assertions sometimes fail
// under both Ant and Eclipse?
//long fudgeFactor = 5L;
//assertTrue("Unexpected timing " + sw.getTotalTime(), sw.getTotalTime() >= int1);
//assertTrue("Unexpected timing " + sw.getTotalTime(), sw.getTotalTime() <= int1 + fudgeFactor);
sw.start(name2);
@@ -72,7 +72,6 @@ public class StopWatchTests extends TestCase {
String name1 = "Task 1";
String name2 = "Task 2";
long fudgeFactor = 5L;
assertFalse(sw.isRunning());
sw.start(name1);
Thread.sleep(int1);
@@ -82,6 +81,7 @@ public class StopWatchTests extends TestCase {
// TODO are timings off in JUnit? Why do these assertions sometimes fail
// under both Ant and Eclipse?
//long fudgeFactor = 5L;
//assertTrue("Unexpected timing " + sw.getTotalTime(), sw.getTotalTime() >= int1);
//assertTrue("Unexpected timing " + sw.getTotalTime(), sw.getTotalTime() <= int1 + fudgeFactor);
sw.start(name2);