Browse Source

Clean up warnings in Gradle build

pull/32896/head
Sam Brannen 2 years ago
parent
commit
dac18a3ff1
  1. 8
      spring-aop/src/test/java/org/springframework/aop/aspectj/annotation/AspectProxyFactoryTests.java
  2. 3
      spring-web/src/test/java/org/springframework/http/converter/FormHttpMessageConverterTests.java
  3. 4
      spring-web/src/test/java/org/springframework/web/context/request/RequestAttributesThreadLocalAccessorTests.java
  4. 7
      spring-web/src/testFixtures/java/org/springframework/web/testfixture/http/server/reactive/bootstrap/ReactorHttpsServer.java

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

@ -41,8 +41,7 @@ class AspectProxyFactoryTests { @@ -41,8 +41,7 @@ class AspectProxyFactoryTests {
@Test
void testWithNonAspect() {
AspectJProxyFactory proxyFactory = new AspectJProxyFactory(new TestBean());
assertThatIllegalArgumentException().isThrownBy(() ->
proxyFactory.addAspect(TestBean.class));
assertThatIllegalArgumentException().isThrownBy(() -> proxyFactory.addAspect(TestBean.class));
}
@Test
@ -78,8 +77,7 @@ class AspectProxyFactoryTests { @@ -78,8 +77,7 @@ class AspectProxyFactoryTests {
@Test
void testWithInstanceWithNonAspect() {
AspectJProxyFactory pf = new AspectJProxyFactory();
assertThatIllegalArgumentException().isThrownBy(() ->
pf.addAspect(new TestBean()));
assertThatIllegalArgumentException().isThrownBy(() -> pf.addAspect(new TestBean()));
}
@Test
@ -119,6 +117,7 @@ class AspectProxyFactoryTests { @@ -119,6 +117,7 @@ class AspectProxyFactoryTests {
}
@Test // SPR-13328
@SuppressWarnings("unchecked")
public void testProxiedVarargsWithEnumArray() {
AspectJProxyFactory proxyFactory = new AspectJProxyFactory(new TestBean());
proxyFactory.addAspect(LoggingAspectOnVarargs.class);
@ -127,6 +126,7 @@ class AspectProxyFactoryTests { @@ -127,6 +126,7 @@ class AspectProxyFactoryTests {
}
@Test // SPR-13328
@SuppressWarnings("unchecked")
public void testUnproxiedVarargsWithEnumArray() {
AspectJProxyFactory proxyFactory = new AspectJProxyFactory(new TestBean());
proxyFactory.addAspect(LoggingAspectOnSetter.class);

3
spring-web/src/test/java/org/springframework/http/converter/FormHttpMessageConverterTests.java

@ -119,6 +119,7 @@ class FormHttpMessageConverterTests { @@ -119,6 +119,7 @@ class FormHttpMessageConverterTests {
}
@Test
@SuppressWarnings("unchecked")
void readFormMultiValue() throws Exception {
String body = "name+1=value+1&name+2=value+2%2B1&name+2=value+2%2B2&name+3";
MockHttpInputMessage inputMessage = new MockHttpInputMessage(body.getBytes(StandardCharsets.ISO_8859_1));
@ -134,7 +135,7 @@ class FormHttpMessageConverterTests { @@ -134,7 +135,7 @@ class FormHttpMessageConverterTests {
}
@Test
@SuppressWarnings("rawtypes")
@SuppressWarnings({ "rawtypes", "unchecked" })
void readFormSingleValue() throws Exception {
String body = "name+1=value+1&name+2=value+2%2B1&name+2=value+2%2B2&name+3";
MockHttpInputMessage inputMessage = new MockHttpInputMessage(body.getBytes(StandardCharsets.ISO_8859_1));

4
spring-web/src/test/java/org/springframework/web/context/request/RequestAttributesThreadLocalAccessorTests.java

@ -58,7 +58,6 @@ class RequestAttributesThreadLocalAccessorTests { @@ -58,7 +58,6 @@ class RequestAttributesThreadLocalAccessorTests {
@MethodSource
@SuppressWarnings({ "try", "unused" })
void propagation(RequestAttributes previousRequest, RequestAttributes currentRequest) throws Exception {
ContextSnapshot snapshot = getSnapshotFor(currentRequest);
AtomicReference<RequestAttributes> requestInScope = new AtomicReference<>();
@ -80,6 +79,7 @@ class RequestAttributesThreadLocalAccessorTests { @@ -80,6 +79,7 @@ class RequestAttributesThreadLocalAccessorTests {
}
@Test
@SuppressWarnings("try")
void accessAfterRequestMarkedCompleted() {
MockHttpServletRequest servletRequest = new MockHttpServletRequest();
servletRequest.setAttribute("k1", "v1");
@ -100,8 +100,8 @@ class RequestAttributesThreadLocalAccessorTests { @@ -100,8 +100,8 @@ class RequestAttributesThreadLocalAccessorTests {
}
@Test
@SuppressWarnings("try")
void accessBeforeRequestMarkedCompleted() {
MockHttpServletRequest servletRequest = new MockHttpServletRequest();
ServletRequestAttributes previous = new ServletRequestAttributes(servletRequest, new MockHttpServletResponse());

7
spring-web/src/testFixtures/java/org/springframework/web/testfixture/http/server/reactive/bootstrap/ReactorHttpsServer.java

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
/*
* Copyright 2002-2021 the original author or authors.
* Copyright 2002-2024 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.
@ -19,9 +19,11 @@ package org.springframework.web.testfixture.http.server.reactive.bootstrap; @@ -19,9 +19,11 @@ package org.springframework.web.testfixture.http.server.reactive.bootstrap;
import java.net.InetSocketAddress;
import java.util.concurrent.atomic.AtomicReference;
import io.netty.handler.ssl.SslContextBuilder;
import io.netty.handler.ssl.util.SelfSignedCertificate;
import reactor.netty.DisposableServer;
import reactor.netty.http.Http11SslContextSpec;
import reactor.netty.tcp.SslProvider.GenericSslContextSpec;
import org.springframework.http.server.reactive.ReactorHttpHandlerAdapter;
@ -40,7 +42,8 @@ public class ReactorHttpsServer extends AbstractHttpServer { @@ -40,7 +42,8 @@ public class ReactorHttpsServer extends AbstractHttpServer {
@Override
protected void initServer() throws Exception {
SelfSignedCertificate cert = new SelfSignedCertificate();
Http11SslContextSpec http11SslContextSpec = Http11SslContextSpec.forServer(cert.certificate(), cert.privateKey());
GenericSslContextSpec<SslContextBuilder> http11SslContextSpec =
Http11SslContextSpec.forServer(cert.certificate(), cert.privateKey());
this.reactorHandler = createHttpHandlerAdapter();
this.reactorServer = reactor.netty.http.server.HttpServer.create()

Loading…
Cancel
Save