From adb2eef749ba6692d2c7d4a67f6d0ced9d5a5dd2 Mon Sep 17 00:00:00 2001 From: Sam Brannen Date: Sun, 3 Jul 2022 18:56:47 +0200 Subject: [PATCH] Clean up warnings and remove unused code --- .../org/springframework/aot/test/SampleReflection.java | 3 +++ .../springframework/aot/agent/InstrumentedMethodTests.java | 7 ------- .../web/util/pattern/PathPatternParser.java | 1 + .../annotation/RequestMappingReflectiveProcessorTests.java | 4 +++- .../web/util/NestedServletExceptionTests.java | 1 + 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/integration-tests/src/test/java/org/springframework/aot/test/SampleReflection.java b/integration-tests/src/test/java/org/springframework/aot/test/SampleReflection.java index d043ec0b20..3f8cbadffc 100644 --- a/integration-tests/src/test/java/org/springframework/aot/test/SampleReflection.java +++ b/integration-tests/src/test/java/org/springframework/aot/test/SampleReflection.java @@ -20,14 +20,17 @@ import java.lang.reflect.Method; /** * @author Brian Clozel + * @since 6.0 */ public class SampleReflection { + @SuppressWarnings("unused") public void sample() { String value = "Sample"; Method[] methods = String.class.getMethods(); } + @SuppressWarnings("unused") public void multipleCalls() { String value = "Sample"; Method[] methods = String.class.getMethods(); diff --git a/spring-core-test/src/test/java/org/springframework/aot/agent/InstrumentedMethodTests.java b/spring-core-test/src/test/java/org/springframework/aot/agent/InstrumentedMethodTests.java index b80f1ec4a9..7f7d78197d 100644 --- a/spring-core-test/src/test/java/org/springframework/aot/agent/InstrumentedMethodTests.java +++ b/spring-core-test/src/test/java/org/springframework/aot/agent/InstrumentedMethodTests.java @@ -312,7 +312,6 @@ class InstrumentedMethodTests { @Test void classGetDeclaredMethodsShouldMatchIntrospectPublicMethodsHint() { - RecordedInvocation invocation = RecordedInvocation.of(InstrumentedMethod.CLASS_GETDECLAREDMETHODS).onInstance(String.class).build(); hints.reflection().registerType(String.class, typeHint -> typeHint.withMembers(MemberCategory.INTROSPECT_PUBLIC_METHODS)); assertThatInvocationDoesNotMatch(InstrumentedMethod.CLASS_GETDECLAREDMETHODS, this.stringGetScaleMethod); } @@ -634,12 +633,6 @@ class InstrumentedMethodTests { assertThat(method.matcher(invocation)).rejects(this.hints); } - private static class PrivateConstructor { - - private PrivateConstructor() { - - } - } static class PublicField { diff --git a/spring-web/src/main/java/org/springframework/web/util/pattern/PathPatternParser.java b/spring-web/src/main/java/org/springframework/web/util/pattern/PathPatternParser.java index cc3e3a7950..22e24bede7 100644 --- a/spring-web/src/main/java/org/springframework/web/util/pattern/PathPatternParser.java +++ b/spring-web/src/main/java/org/springframework/web/util/pattern/PathPatternParser.java @@ -128,6 +128,7 @@ public class PathPatternParser { */ public final static PathPatternParser defaultInstance = new PathPatternParser() { + @SuppressWarnings("deprecation") @Override public void setMatchOptionalTrailingSeparator(boolean matchOptionalTrailingSeparator) { raiseError(); diff --git a/spring-web/src/test/java/org/springframework/web/bind/annotation/RequestMappingReflectiveProcessorTests.java b/spring-web/src/test/java/org/springframework/web/bind/annotation/RequestMappingReflectiveProcessorTests.java index 7a58aaa6f4..c97d3aadd3 100644 --- a/spring-web/src/test/java/org/springframework/web/bind/annotation/RequestMappingReflectiveProcessorTests.java +++ b/spring-web/src/test/java/org/springframework/web/bind/annotation/RequestMappingReflectiveProcessorTests.java @@ -185,10 +185,11 @@ public class RequestMappingReflectiveProcessorTests { @GetMapping HttpEntity getHttpEntity() { - return new HttpEntity(new Response("response")); + return new HttpEntity<>(new Response("response")); } @GetMapping + @SuppressWarnings({ "rawtypes", "unchecked" }) HttpEntity getRawHttpEntity() { return new HttpEntity(new Response("response")); } @@ -198,6 +199,7 @@ public class RequestMappingReflectiveProcessorTests { } @PostMapping + @SuppressWarnings({ "rawtypes", "unchecked" }) void postRawHttpEntity(HttpEntity entity) { } diff --git a/spring-web/src/test/java/org/springframework/web/util/NestedServletExceptionTests.java b/spring-web/src/test/java/org/springframework/web/util/NestedServletExceptionTests.java index 631f15ea56..f7f29e62cc 100644 --- a/spring-web/src/test/java/org/springframework/web/util/NestedServletExceptionTests.java +++ b/spring-web/src/test/java/org/springframework/web/util/NestedServletExceptionTests.java @@ -22,6 +22,7 @@ import org.springframework.core.NestedExceptionUtils; import static org.assertj.core.api.Assertions.assertThat; +@SuppressWarnings("deprecation") public class NestedServletExceptionTests { @Test