Skip to content

Commit 6a1e841

Browse files
committed
Fix unused type compiler warnings
1 parent 88f5dd6 commit 6a1e841

File tree

40 files changed

+119
-57
lines changed

40 files changed

+119
-57
lines changed

spring-aop/src/test/java/org/springframework/aop/aspectj/AspectJExpressionPointcutTests.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -309,10 +309,6 @@ private void assertMatchesTestBeanClass(ClassFilter classFilter) {
309309
assertTrue("Expression should match TestBean class", classFilter.matches(TestBean.class));
310310
}
311311

312-
private void assertDoesNotMatchStringClass(ClassFilter classFilter) {
313-
assertFalse("Expression should not match String class", classFilter.matches(String.class));
314-
}
315-
316312
@Test
317313
public void testWithUnsupportedPointcutPrimitive() throws Exception {
318314
String expression = "call(int org.springframework.tests.sample.beans.TestBean.getAge())";

spring-aop/src/test/java/org/springframework/aop/aspectj/TigerAspectJExpressionPointcutTests.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,8 @@ public void testMatchGenericArgument() {
8989

9090
@Test
9191
public void testMatchVarargs() throws SecurityException, NoSuchMethodException {
92+
93+
@SuppressWarnings("unused")
9294
class MyTemplate {
9395
public int queryForInt(String sql, Object... params) {
9496
return 0;

spring-aop/src/test/java/org/springframework/aop/framework/adapter/ThrowsAdviceInterceptorTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ public void afterThrowing(RemoteException ex) throws Throwable {
144144
}
145145

146146
@SuppressWarnings("serial")
147-
private static class MyThrowsHandler extends MethodCounter implements ThrowsAdvice {
147+
static class MyThrowsHandler extends MethodCounter implements ThrowsAdvice {
148148
// Full method signature
149149
public void afterThrowing(Method m, Object[] args, Object target, IOException ex) {
150150
count("ioException");

spring-aspects/src/test/java/org/springframework/beans/factory/aspectj/AbstractBeanConfigurerTests.java

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ public Object readResolve() throws ObjectStreamException {
304304
// }
305305
// }
306306

307-
307+
@SuppressWarnings("unused")
308308
private static class ShouldNotBeConfiguredBySpring {
309309

310310
private String name;
@@ -335,6 +335,7 @@ public String getName() {
335335

336336

337337
@Configurable
338+
@SuppressWarnings("unused")
338339
private static class ShouldBeConfiguredBySpringUsingTypeNameAsBeanName {
339340

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

351352

352353
@Configurable(autowire=Autowire.BY_TYPE)
354+
@SuppressWarnings("unused")
353355
private static class ShouldBeConfiguredBySpringUsingAutowireByType {
354356

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

366368

367369
@Configurable(autowire=Autowire.BY_NAME)
370+
@SuppressWarnings("unused")
368371
private static class ValidAutowireByName {
369372

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

381384

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

385389
private TestBean friend;
@@ -393,7 +397,7 @@ public void setFriend(TestBean friend) {
393397
}
394398
}
395399

396-
400+
@SuppressWarnings("unused")
397401
private static class ArbitraryExistingPojo {
398402

399403
private TestBean friend;
@@ -426,6 +430,7 @@ public boolean isSingleton() {
426430

427431

428432
@Configurable
433+
@SuppressWarnings("unused")
429434
private static class BaseBean {
430435

431436
public int setterCount;
@@ -447,7 +452,7 @@ private static class SubBeanPreConstruction extends BaseBean {
447452
}
448453

449454
@Configurable
450-
@SuppressWarnings("serial")
455+
@SuppressWarnings({"serial", "unused"})
451456
private static class BaseSerializableBean implements Serializable {
452457

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

468473

469474
@Aspect
475+
@SuppressWarnings("unused")
470476
private static class WireArbitraryExistingPojo extends AbstractBeanConfigurerAspect {
471477

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

478484

479485
@Aspect
486+
@SuppressWarnings("unused")
480487
private static class AspectThatWillNotBeUsed extends AbstractBeanConfigurerAspect {
481488

482489
@Pointcut("initialization(ClassThatWillNotActuallyBeWired.new(..)) && this(beanInstance)")

spring-beans/src/test/java/org/springframework/beans/BeanUtilsTests.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,7 @@ private void assertSignatureEquals(Method desiredMethod, String signature) {
267267
}
268268

269269

270+
@SuppressWarnings("unused")
270271
private static class NameAndSpecialProperty {
271272

272273
private String name;
@@ -291,6 +292,7 @@ public int getSpecialProperty() {
291292
}
292293

293294

295+
@SuppressWarnings("unused")
294296
private static class ContainerBean {
295297

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

307309

310+
@SuppressWarnings("unused")
308311
private static class ContainedBean {
309312

310313
private String name;
@@ -319,6 +322,7 @@ public void setName(String name) {
319322
}
320323

321324

325+
@SuppressWarnings("unused")
322326
private static class MethodSignatureBean {
323327

324328
public void doSomething() {

spring-beans/src/test/java/org/springframework/beans/BeanWrapperGenericsTests.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,7 @@ private static abstract class BaseGenericCollectionBean {
497497
}
498498

499499

500+
@SuppressWarnings("unused")
500501
private static class NestedGenericCollectionBean extends BaseGenericCollectionBean {
501502

502503
private Map<String, Integer> mapOfInteger;
@@ -544,6 +545,7 @@ public void setMapOfListOfListOfInteger(Map<String, List<List<Integer>>> mapOfLi
544545
}
545546

546547

548+
@SuppressWarnings("unused")
547549
private static class ComplexMapHolder {
548550

549551
private Map<List<Integer>, List<Long>> genericMap;

spring-beans/src/test/java/org/springframework/beans/BeanWrapperTests.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1569,6 +1569,7 @@ public static void setProp1(String prop1) {
15691569
}
15701570

15711571

1572+
@SuppressWarnings("unused")
15721573
private static class Foo {
15731574

15741575
private List list;
@@ -1598,13 +1599,15 @@ private static class DifferentTestBean extends TestBean {
15981599
}
15991600

16001601

1602+
@SuppressWarnings("unused")
16011603
private static class NoRead {
16021604

16031605
public void setAge(int age) {
16041606
}
16051607
}
16061608

16071609

1610+
@SuppressWarnings("unused")
16081611
private static class EnumTester {
16091612

16101613
private Autowire autowire;
@@ -1619,6 +1622,7 @@ public Autowire getAutowire() {
16191622
}
16201623

16211624

1625+
@SuppressWarnings("unused")
16221626
private static class PropsTester {
16231627

16241628
private Properties props;
@@ -1647,6 +1651,7 @@ public void setIntArray(int[] intArray) {
16471651
}
16481652

16491653

1654+
@SuppressWarnings("unused")
16501655
private static class GetterBean {
16511656

16521657
private String name;
@@ -1664,6 +1669,7 @@ public String getName() {
16641669
}
16651670

16661671

1672+
@SuppressWarnings("unused")
16671673
private static class ThrowsException {
16681674

16691675
public void doSomething(Throwable t) throws Throwable {
@@ -1672,6 +1678,7 @@ public void doSomething(Throwable t) throws Throwable {
16721678
}
16731679

16741680

1681+
@SuppressWarnings("unused")
16751682
private static class PrimitiveArrayBean {
16761683

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

16881695

1696+
@SuppressWarnings("unused")
16891697
private static class NumberPropertyBean {
16901698

16911699
private byte myPrimitiveByte;
@@ -1804,6 +1812,7 @@ public void setMyDouble(Double myDouble) {
18041812
}
18051813

18061814

1815+
@SuppressWarnings("unused")
18071816
private static class IntelliBean {
18081817

18091818
public void setName(String name) {}
@@ -1818,6 +1827,7 @@ public void setMyStringss(String string) {}
18181827
}
18191828

18201829

1830+
@SuppressWarnings("unused")
18211831
private static class Employee extends TestBean {
18221832

18231833
private String co;

spring-beans/src/test/java/org/springframework/beans/ConcurrentBeanWrapperTests.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2013 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -135,6 +135,7 @@ public void run() {
135135
}
136136

137137

138+
@SuppressWarnings("unused")
138139
private static class TestBean {
139140

140141
private Properties properties;

spring-beans/src/test/java/org/springframework/beans/factory/DefaultListableBeanFactoryTests.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2334,6 +2334,7 @@ public ConstructorDependency(TestBean spouse) {
23342334
this.spouse = spouse;
23352335
}
23362336

2337+
@SuppressWarnings("unused")
23372338
private ConstructorDependency(TestBean spouse, TestBean otherSpouse) {
23382339
throw new IllegalArgumentException("Should never be called");
23392340
}
@@ -2560,6 +2561,7 @@ public Resource[] getResourceArray() {
25602561
/**
25612562
* Bean with a dependency on a {@link FactoryBean}.
25622563
*/
2564+
@SuppressWarnings("unused")
25632565
private static class FactoryBeanDependentBean {
25642566

25652567
private FactoryBean<?> factoryBean;
@@ -2646,6 +2648,7 @@ public int hashCode() {
26462648
}
26472649

26482650

2651+
@SuppressWarnings("unused")
26492652
private static class TestSecuredBean {
26502653

26512654
private String userName;
@@ -2675,6 +2678,7 @@ public String getUserName() {
26752678
}
26762679
}
26772680

2681+
@SuppressWarnings("unused")
26782682
private static class KnowsIfInstantiated {
26792683

26802684
private static boolean instantiated;

spring-beans/src/test/java/org/springframework/beans/factory/parsing/CustomProblemReporterTests.java

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,6 @@ public void warning(Problem problem) {
9191
System.out.println(problem);
9292
this.warnings.add(problem);
9393
}
94-
95-
public Problem[] getWarnings() {
96-
return this.warnings.toArray(new Problem[this.warnings.size()]);
97-
}
9894
}
9995

10096
}

0 commit comments

Comments
 (0)