Skip to content

Commit b33d2fe

Browse files
committed
Clean up warnings in Gradle build, polishing, etc.
1 parent bc9b9bc commit b33d2fe

File tree

11 files changed

+67
-83
lines changed

11 files changed

+67
-83
lines changed

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2020 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.
@@ -198,8 +198,8 @@ public void testMatchWithArgs() throws Exception {
198198
// not currently testable in a reliable fashion
199199
//assertDoesNotMatchStringClass(classFilter);
200200

201-
assertThat(methodMatcher.matches(setSomeNumber, TestBean.class, new Double(12))).as("Should match with setSomeNumber with Double input").isTrue();
202-
assertThat(methodMatcher.matches(setSomeNumber, TestBean.class, new Integer(11))).as("Should not match setSomeNumber with Integer input").isFalse();
201+
assertThat(methodMatcher.matches(setSomeNumber, TestBean.class, 12D)).as("Should match with setSomeNumber with Double input").isTrue();
202+
assertThat(methodMatcher.matches(setSomeNumber, TestBean.class, 11)).as("Should not match setSomeNumber with Integer input").isFalse();
203203
assertThat(methodMatcher.matches(getAge, TestBean.class)).as("Should not match getAge").isFalse();
204204
assertThat(methodMatcher.isRuntime()).as("Should be a runtime match").isTrue();
205205
}
@@ -224,10 +224,10 @@ public void testDynamicMatchingProxy() {
224224
TestBean testBean = getAdvisedProxy(expression, interceptor);
225225

226226
assertThat(interceptor.getCount()).as("Calls should be 0").isEqualTo(0);
227-
testBean.setSomeNumber(new Double(30));
227+
testBean.setSomeNumber(30D);
228228
assertThat(interceptor.getCount()).as("Calls should be 1").isEqualTo(1);
229229

230-
testBean.setSomeNumber(new Integer(90));
230+
testBean.setSomeNumber(90);
231231
assertThat(interceptor.getCount()).as("Calls should be 1").isEqualTo(1);
232232
}
233233

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2020 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.
@@ -91,9 +91,8 @@ public void testManualProxyJavaWithStaticPointcutAndTwoClassLoaders() throws Exc
9191
// Make sure the interface is loaded from the parent class loader
9292
loader.excludeClass(TestService.class.getName());
9393
loader.excludeClass(TestException.class.getName());
94-
TestService other = (TestService) loader.loadClass(TestServiceImpl.class.getName()).newInstance();
94+
TestService other = (TestService) loader.loadClass(TestServiceImpl.class.getName()).getDeclaredConstructor().newInstance();
9595
testAdvice(new DefaultPointcutAdvisor(pointcut, logAdvice), logAdvice, other, "TestServiceImpl");
96-
9796
}
9897

9998
private void testAdvice(Advisor advisor, LogUserAdvice logAdvice, TestService target, String message)
@@ -127,7 +126,6 @@ public static class SimpleThrowawayClassLoader extends OverridingClassLoader {
127126
public SimpleThrowawayClassLoader(ClassLoader parent) {
128127
super(parent);
129128
}
130-
131129
}
132130

133131

spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AspectProxyFactoryTests.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ public void testWithInstanceWithNonAspect() throws Exception {
8383
}
8484

8585
@Test
86+
@SuppressWarnings("unchecked")
8687
public void testSerializable() throws Exception {
8788
AspectJProxyFactory proxyFactory = new AspectJProxyFactory(new TestBean());
8889
proxyFactory.addAspect(LoggingAspectOnVarargs.class);
@@ -114,11 +115,11 @@ public void testWithInstance() throws Exception {
114115
@Test
115116
public void testWithNonSingletonAspectInstance() throws Exception {
116117
AspectJProxyFactory pf = new AspectJProxyFactory();
117-
assertThatIllegalArgumentException().isThrownBy(() ->
118-
pf.addAspect(new PerThisAspect()));
118+
assertThatIllegalArgumentException().isThrownBy(() -> pf.addAspect(new PerThisAspect()));
119119
}
120120

121121
@Test // SPR-13328
122+
@SuppressWarnings("unchecked")
122123
public void testProxiedVarargsWithEnumArray() throws Exception {
123124
AspectJProxyFactory proxyFactory = new AspectJProxyFactory(new TestBean());
124125
proxyFactory.addAspect(LoggingAspectOnVarargs.class);
@@ -127,6 +128,7 @@ public void testProxiedVarargsWithEnumArray() throws Exception {
127128
}
128129

129130
@Test // SPR-13328
131+
@SuppressWarnings("unchecked")
130132
public void testUnproxiedVarargsWithEnumArray() throws Exception {
131133
AspectJProxyFactory proxyFactory = new AspectJProxyFactory(new TestBean());
132134
proxyFactory.addAspect(LoggingAspectOnSetter.class);

spring-aop/src/test/java/org/springframework/aop/interceptor/CustomizableTraceInterceptorTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ public void testSunnyDayPathLogsCorrectlyWithPrettyMuchAllPlaceholdersMatching()
136136

137137
given(methodInvocation.getMethod()).willReturn(String.class.getMethod("toString", new Class[0]));
138138
given(methodInvocation.getThis()).willReturn(this);
139-
given(methodInvocation.getArguments()).willReturn(new Object[]{"$ One \\$", new Long(2)});
139+
given(methodInvocation.getArguments()).willReturn(new Object[]{"$ One \\$", 2L});
140140
given(methodInvocation.proceed()).willReturn("Hello!");
141141

142142
Log log = mock(Log.class);

spring-jdbc/src/main/java/org/springframework/jdbc/core/namedparam/SqlParameterSourceUtils.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2018 the original author or authors.
2+
* Copyright 2002-2020 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.
@@ -44,7 +44,6 @@ public abstract class SqlParameterSourceUtils {
4444
* @see BeanPropertySqlParameterSource
4545
* @see NamedParameterJdbcTemplate#batchUpdate(String, SqlParameterSource[])
4646
*/
47-
@SuppressWarnings("unchecked")
4847
public static SqlParameterSource[] createBatch(Object... candidates) {
4948
return createBatch(Arrays.asList(candidates));
5049
}

spring-messaging/src/main/java/org/springframework/messaging/rsocket/annotation/support/RSocketMessageHandler.java

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,9 @@
7171
* {@link SocketAcceptor} adapter to register with the
7272
* {@link io.rsocket.core.RSocketServer}.
7373
*
74-
* <p>For a client, possibly in the same process as a server, consider
75-
* consider using the static factory method
76-
* {@link #responder(RSocketStrategies, Object...)} to obtain a client
77-
* responder to be registered via
74+
* <p>For a client, possibly in the same process as a server, consider using the
75+
* static factory method {@link #responder(RSocketStrategies, Object...)} to
76+
* obtain a client responder to be registered via
7877
* {@link org.springframework.messaging.rsocket.RSocketRequester.Builder#rsocketConnector
7978
* RSocketRequester.Builder}.
8079
*
@@ -500,24 +499,25 @@ public static SocketAcceptor responder(RSocketStrategies strategies, Object... c
500499
* annotated handler methods. This is intended to be passed into
501500
* {@link org.springframework.messaging.rsocket.RSocketRequester.Builder#rsocketFactory}.
502501
* <p>In effect a shortcut to create and initialize
503-
* {@code RSocketMessageHandler} with the given strategies and handlers,
504-
* use {@link #responder()} to obtain the responder, and plug that into
502+
* {@code RSocketMessageHandler} with the given strategies and handlers.
503+
* Use {@link #responder()} to obtain the responder and plug that into
505504
* {@link io.rsocket.RSocketFactory.ClientRSocketFactory ClientRSocketFactory}.
506505
* For more advanced scenarios, e.g. discovering handlers through a custom
507506
* stereotype annotation, consider declaring {@code RSocketMessageHandler}
508507
* as a bean, and then obtain the responder from it.
509508
* @param strategies the strategies to set on the created
510509
* {@code RSocketMessageHandler}
511510
* @param candidateHandlers a list of Objects and/or Classes with annotated
512-
* handler methods; used to call {@link #setHandlers(List)} with
513-
* on the created {@code RSocketMessageHandler}
511+
* handler methods; used to call {@link #setHandlers(List)} on the created
512+
* {@code RSocketMessageHandler}
514513
* @return a configurer that may be passed into
515514
* {@link org.springframework.messaging.rsocket.RSocketRequester.Builder#rsocketFactory}
516-
* @deprecated as of 5.2.6 following the deprecation of
515+
* @deprecated as of 5.2.6 following the deprecation of
517516
* {@link io.rsocket.RSocketFactory.ClientRSocketFactory RSocketFactory.ClientRSocketFactory}
518-
* in RSocket 1.0 RC7.
517+
* in RSocket 1.0 RC7
519518
*/
520519
@Deprecated
520+
@SuppressWarnings("deprecation")
521521
public static org.springframework.messaging.rsocket.ClientRSocketFactoryConfigurer clientResponder(
522522
RSocketStrategies strategies, Object... candidateHandlers) {
523523

@@ -536,5 +536,3 @@ public static org.springframework.messaging.rsocket.ClientRSocketFactoryConfigur
536536
};
537537
}
538538
}
539-
540-

0 commit comments

Comments
 (0)