Skip to content

Commit

Permalink
Fix unused type compiler warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
philwebb committed Jan 25, 2013
1 parent 88f5dd6 commit 6a1e841
Show file tree
Hide file tree
Showing 40 changed files with 119 additions and 57 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -309,10 +309,6 @@ private void assertMatchesTestBeanClass(ClassFilter classFilter) {
assertTrue("Expression should match TestBean class", classFilter.matches(TestBean.class));
}

private void assertDoesNotMatchStringClass(ClassFilter classFilter) {
assertFalse("Expression should not match String class", classFilter.matches(String.class));
}

@Test
public void testWithUnsupportedPointcutPrimitive() throws Exception {
String expression = "call(int org.springframework.tests.sample.beans.TestBean.getAge())";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ public void testMatchGenericArgument() {

@Test
public void testMatchVarargs() throws SecurityException, NoSuchMethodException {

@SuppressWarnings("unused")
class MyTemplate {
public int queryForInt(String sql, Object... params) {
return 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public void afterThrowing(RemoteException ex) throws Throwable {
}

@SuppressWarnings("serial")
private static class MyThrowsHandler extends MethodCounter implements ThrowsAdvice {
static class MyThrowsHandler extends MethodCounter implements ThrowsAdvice {
// Full method signature
public void afterThrowing(Method m, Object[] args, Object target, IOException ex) {
count("ioException");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ public Object readResolve() throws ObjectStreamException {
// }
// }


@SuppressWarnings("unused")
private static class ShouldNotBeConfiguredBySpring {

private String name;
Expand Down Expand Up @@ -335,6 +335,7 @@ public String getName() {


@Configurable
@SuppressWarnings("unused")
private static class ShouldBeConfiguredBySpringUsingTypeNameAsBeanName {

private String name;
Expand All @@ -350,6 +351,7 @@ public String getName() {


@Configurable(autowire=Autowire.BY_TYPE)
@SuppressWarnings("unused")
private static class ShouldBeConfiguredBySpringUsingAutowireByType {

private TestBean friend = null;
Expand All @@ -365,6 +367,7 @@ public void setFriend(TestBean friend) {


@Configurable(autowire=Autowire.BY_NAME)
@SuppressWarnings("unused")
private static class ValidAutowireByName {

private TestBean friend = null;
Expand All @@ -380,6 +383,7 @@ public void setRamnivas(TestBean friend) {


@Configurable(autowire=Autowire.BY_NAME, dependencyCheck=true)
@SuppressWarnings("unused")
private static class InvalidAutowireByName {

private TestBean friend;
Expand All @@ -393,7 +397,7 @@ public void setFriend(TestBean friend) {
}
}


@SuppressWarnings("unused")
private static class ArbitraryExistingPojo {

private TestBean friend;
Expand Down Expand Up @@ -426,6 +430,7 @@ public boolean isSingleton() {


@Configurable
@SuppressWarnings("unused")
private static class BaseBean {

public int setterCount;
Expand All @@ -447,7 +452,7 @@ private static class SubBeanPreConstruction extends BaseBean {
}

@Configurable
@SuppressWarnings("serial")
@SuppressWarnings({"serial", "unused"})
private static class BaseSerializableBean implements Serializable {

public int setterCount;
Expand All @@ -467,6 +472,7 @@ private static class SubSerializableBean extends BaseSerializableBean {


@Aspect
@SuppressWarnings("unused")
private static class WireArbitraryExistingPojo extends AbstractBeanConfigurerAspect {

@Pointcut("initialization(ArbitraryExistingPojo.new(..)) && this(beanInstance)")
Expand All @@ -477,6 +483,7 @@ protected void beanCreation(Object beanInstance){


@Aspect
@SuppressWarnings("unused")
private static class AspectThatWillNotBeUsed extends AbstractBeanConfigurerAspect {

@Pointcut("initialization(ClassThatWillNotActuallyBeWired.new(..)) && this(beanInstance)")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ private void assertSignatureEquals(Method desiredMethod, String signature) {
}


@SuppressWarnings("unused")
private static class NameAndSpecialProperty {

private String name;
Expand All @@ -291,6 +292,7 @@ public int getSpecialProperty() {
}


@SuppressWarnings("unused")
private static class ContainerBean {

private ContainedBean[] containedBeans;
Expand All @@ -305,6 +307,7 @@ public void setContainedBeans(ContainedBean[] containedBeans) {
}


@SuppressWarnings("unused")
private static class ContainedBean {

private String name;
Expand All @@ -319,6 +322,7 @@ public void setName(String name) {
}


@SuppressWarnings("unused")
private static class MethodSignatureBean {

public void doSomething() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,7 @@ private static abstract class BaseGenericCollectionBean {
}


@SuppressWarnings("unused")
private static class NestedGenericCollectionBean extends BaseGenericCollectionBean {

private Map<String, Integer> mapOfInteger;
Expand Down Expand Up @@ -544,6 +545,7 @@ public void setMapOfListOfListOfInteger(Map<String, List<List<Integer>>> mapOfLi
}


@SuppressWarnings("unused")
private static class ComplexMapHolder {

private Map<List<Integer>, List<Long>> genericMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1569,6 +1569,7 @@ public static void setProp1(String prop1) {
}


@SuppressWarnings("unused")
private static class Foo {

private List list;
Expand Down Expand Up @@ -1598,13 +1599,15 @@ private static class DifferentTestBean extends TestBean {
}


@SuppressWarnings("unused")
private static class NoRead {

public void setAge(int age) {
}
}


@SuppressWarnings("unused")
private static class EnumTester {

private Autowire autowire;
Expand All @@ -1619,6 +1622,7 @@ public Autowire getAutowire() {
}


@SuppressWarnings("unused")
private static class PropsTester {

private Properties props;
Expand Down Expand Up @@ -1647,6 +1651,7 @@ public void setIntArray(int[] intArray) {
}


@SuppressWarnings("unused")
private static class GetterBean {

private String name;
Expand All @@ -1664,6 +1669,7 @@ public String getName() {
}


@SuppressWarnings("unused")
private static class ThrowsException {

public void doSomething(Throwable t) throws Throwable {
Expand All @@ -1672,6 +1678,7 @@ public void doSomething(Throwable t) throws Throwable {
}


@SuppressWarnings("unused")
private static class PrimitiveArrayBean {

private int[] array;
Expand All @@ -1686,6 +1693,7 @@ public void setArray(int[] array) {
}


@SuppressWarnings("unused")
private static class NumberPropertyBean {

private byte myPrimitiveByte;
Expand Down Expand Up @@ -1804,6 +1812,7 @@ public void setMyDouble(Double myDouble) {
}


@SuppressWarnings("unused")
private static class IntelliBean {

public void setName(String name) {}
Expand All @@ -1818,6 +1827,7 @@ public void setMyStringss(String string) {}
}


@SuppressWarnings("unused")
private static class Employee extends TestBean {

private String co;
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -135,6 +135,7 @@ public void run() {
}


@SuppressWarnings("unused")
private static class TestBean {

private Properties properties;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2334,6 +2334,7 @@ public ConstructorDependency(TestBean spouse) {
this.spouse = spouse;
}

@SuppressWarnings("unused")
private ConstructorDependency(TestBean spouse, TestBean otherSpouse) {
throw new IllegalArgumentException("Should never be called");
}
Expand Down Expand Up @@ -2560,6 +2561,7 @@ public Resource[] getResourceArray() {
/**
* Bean with a dependency on a {@link FactoryBean}.
*/
@SuppressWarnings("unused")
private static class FactoryBeanDependentBean {

private FactoryBean<?> factoryBean;
Expand Down Expand Up @@ -2646,6 +2648,7 @@ public int hashCode() {
}


@SuppressWarnings("unused")
private static class TestSecuredBean {

private String userName;
Expand Down Expand Up @@ -2675,6 +2678,7 @@ public String getUserName() {
}
}

@SuppressWarnings("unused")
private static class KnowsIfInstantiated {

private static boolean instantiated;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,6 @@ public void warning(Problem problem) {
System.out.println(problem);
this.warnings.add(problem);
}

public Problem[] getWarnings() {
return this.warnings.toArray(new Problem[this.warnings.size()]);
}
}

}
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -208,6 +208,7 @@ public void testAutowireCandidateWithMultipleCandidatesDescriptor() throws Excep
}


@SuppressWarnings("unused")
private static class QualifiedTestBean {

@TestQualifier
Expand All @@ -226,6 +227,7 @@ public void autowireNonqualified(Person tpb) {
}


@SuppressWarnings("unused")
private static class Person {

private String name;
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -75,6 +75,7 @@ public class CallbacksSecurityTests {
private DefaultListableBeanFactory beanFactory;
private SecurityContextProvider provider;

@SuppressWarnings("unused")
private static class NonPrivilegedBean {

private String expectedName;
Expand Down Expand Up @@ -117,6 +118,7 @@ private void checkCurrentContext() {
}
}

@SuppressWarnings("unused")
private static class NonPrivilegedSpringCallbacksBean implements
InitializingBean, DisposableBean, BeanClassLoaderAware,
BeanFactoryAware, BeanNameAware {
Expand Down Expand Up @@ -161,6 +163,7 @@ private void checkCurrentContext() {
}
}

@SuppressWarnings("unused")
private static class NonPrivilegedFactoryBean implements SmartFactoryBean {
private String expectedName;

Expand Down Expand Up @@ -204,6 +207,7 @@ private void checkCurrentContext() {
}
}

@SuppressWarnings("unused")
private static class NonPrivilegedFactory {

private final String expectedName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ static FactoryMethods newInstance(TestBean tb, int num, Integer something) {
return new FactoryMethods(tb, null, num);
}

@SuppressWarnings("unused")
private static List listInstance() {
return Collections.EMPTY_LIST;
}
Expand Down Expand Up @@ -99,6 +100,7 @@ protected TestBean protectedGetTestBean() {
return this.tb;
}

@SuppressWarnings("unused")
private TestBean privateGetTestBean() {
return this.tb;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2006 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.
Expand Down Expand Up @@ -85,7 +85,7 @@ public void testSunnyDaySetAsTextYieldsSingleValue() throws Exception {
}


@SuppressWarnings("serial")
@SuppressWarnings({ "serial", "unused" })
private static final class CollectionTypeWithNoNoArgCtor extends ArrayList<Object> {
public CollectionTypeWithNoNoArgCtor(String anArg) {
}
Expand Down
Loading

0 comments on commit 6a1e841

Please sign in to comment.