Browse Source

Clean up warnings and remove unused code

pull/28751/head
Sam Brannen 2 years ago
parent
commit
adb2eef749
  1. 3
      integration-tests/src/test/java/org/springframework/aot/test/SampleReflection.java
  2. 7
      spring-core-test/src/test/java/org/springframework/aot/agent/InstrumentedMethodTests.java
  3. 1
      spring-web/src/main/java/org/springframework/web/util/pattern/PathPatternParser.java
  4. 4
      spring-web/src/test/java/org/springframework/web/bind/annotation/RequestMappingReflectiveProcessorTests.java
  5. 1
      spring-web/src/test/java/org/springframework/web/util/NestedServletExceptionTests.java

3
integration-tests/src/test/java/org/springframework/aot/test/SampleReflection.java

@ -20,14 +20,17 @@ import java.lang.reflect.Method; @@ -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();

7
spring-core-test/src/test/java/org/springframework/aot/agent/InstrumentedMethodTests.java

@ -312,7 +312,6 @@ class InstrumentedMethodTests { @@ -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 { @@ -634,12 +633,6 @@ class InstrumentedMethodTests {
assertThat(method.matcher(invocation)).rejects(this.hints);
}
private static class PrivateConstructor {
private PrivateConstructor() {
}
}
static class PublicField {

1
spring-web/src/main/java/org/springframework/web/util/pattern/PathPatternParser.java

@ -128,6 +128,7 @@ public class PathPatternParser { @@ -128,6 +128,7 @@ public class PathPatternParser {
*/
public final static PathPatternParser defaultInstance = new PathPatternParser() {
@SuppressWarnings("deprecation")
@Override
public void setMatchOptionalTrailingSeparator(boolean matchOptionalTrailingSeparator) {
raiseError();

4
spring-web/src/test/java/org/springframework/web/bind/annotation/RequestMappingReflectiveProcessorTests.java

@ -185,10 +185,11 @@ public class RequestMappingReflectiveProcessorTests { @@ -185,10 +185,11 @@ public class RequestMappingReflectiveProcessorTests {
@GetMapping
HttpEntity<Response> 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 { @@ -198,6 +199,7 @@ public class RequestMappingReflectiveProcessorTests {
}
@PostMapping
@SuppressWarnings({ "rawtypes", "unchecked" })
void postRawHttpEntity(HttpEntity entity) {
}

1
spring-web/src/test/java/org/springframework/web/util/NestedServletExceptionTests.java

@ -22,6 +22,7 @@ import org.springframework.core.NestedExceptionUtils; @@ -22,6 +22,7 @@ import org.springframework.core.NestedExceptionUtils;
import static org.assertj.core.api.Assertions.assertThat;
@SuppressWarnings("deprecation")
public class NestedServletExceptionTests {
@Test

Loading…
Cancel
Save