Upgrade to Spring Java Format 0.0.29

Closes gh-28205
This commit is contained in:
Andy Wilkinson 2021-10-04 12:48:23 +01:00
parent 747cd9d5d1
commit 9c9fbf400e
29 changed files with 66 additions and 64 deletions

View File

@ -1 +1 @@
javaFormatVersion=0.0.26
javaFormatVersion=0.0.29

View File

@ -24,9 +24,9 @@ import java.util.Set;
import java.util.TreeMap;
import java.util.stream.Collectors;
import io.spring.javaformat.gradle.CheckTask;
import io.spring.javaformat.gradle.FormatTask;
import io.spring.javaformat.gradle.SpringJavaFormatPlugin;
import io.spring.javaformat.gradle.tasks.CheckFormat;
import io.spring.javaformat.gradle.tasks.Format;
import org.gradle.api.JavaVersion;
import org.gradle.api.Project;
import org.gradle.api.artifacts.Configuration;
@ -70,8 +70,8 @@ import org.springframework.boot.build.toolchain.ToolchainPlugin;
* <li>A {@code testRuntimeOnly} dependency upon
* {@code org.junit.platform:junit-platform-launcher} is added to projects with the
* {@link JavaPlugin} applied
* <li>{@link JavaCompile}, {@link Javadoc}, and {@link FormatTask} tasks are configured
* to use UTF-8 encoding
* <li>{@link JavaCompile}, {@link Javadoc}, and {@link Format} tasks are configured to
* use UTF-8 encoding
* <li>{@link JavaCompile} tasks are configured to use {@code -parameters}.
* <li>When building with Java 8, {@link JavaCompile} tasks are also configured to:
* <ul>
@ -157,7 +157,7 @@ class JavaConventions {
test.useJUnitPlatform();
test.setMaxHeapSize("1024M");
project.getTasks().withType(Checkstyle.class, (checkstyle) -> test.mustRunAfter(checkstyle));
project.getTasks().withType(CheckTask.class, (checkFormat) -> test.mustRunAfter(checkFormat));
project.getTasks().withType(CheckFormat.class, (checkFormat) -> test.mustRunAfter(checkFormat));
});
project.getPlugins().withType(JavaPlugin.class, (javaPlugin) -> project.getDependencies()
.add(JavaPlugin.TEST_RUNTIME_ONLY_CONFIGURATION_NAME, "org.junit.platform:junit-platform-launcher"));
@ -206,10 +206,10 @@ class JavaConventions {
private void configureSpringJavaFormat(Project project) {
project.getPlugins().apply(SpringJavaFormatPlugin.class);
project.getTasks().withType(FormatTask.class, (formatTask) -> formatTask.setEncoding("UTF-8"));
project.getTasks().withType(Format.class, (Format) -> Format.setEncoding("UTF-8"));
project.getPlugins().apply(CheckstylePlugin.class);
CheckstyleExtension checkstyle = project.getExtensions().getByType(CheckstyleExtension.class);
checkstyle.setToolVersion("8.29");
checkstyle.setToolVersion("8.45.1");
checkstyle.getConfigDirectory().set(project.getRootProject().file("src/checkstyle"));
String version = SpringJavaFormatPlugin.class.getPackage().getImplementationVersion();
DependencySet checkstyleDependencies = project.getConfigurations().getByName("checkstyle").getDependencies();

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 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.
@ -26,8 +26,8 @@ import io.micrometer.core.instrument.MeterRegistry;
* Customizers are guaranteed to be applied before any {@link Meter} is registered with
* the registry.
*
* @author Jon Schneider
* @param <T> the registry type to customize
* @author Jon Schneider
* @since 2.0.0
*/
@FunctionalInterface

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 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.
@ -55,9 +55,9 @@ import org.springframework.util.StringUtils;
/**
* {@link EnableAutoConfiguration Auto-configuration} for exporting metrics to Prometheus.
*
* @since 2.0.0
* @author Jon Schneider
* @author David J. M. Karlsen
* @since 2.0.0
*/
@Configuration(proxyBeanMethods = false)
@AutoConfigureBefore({ CompositeMeterRegistryAutoConfiguration.class, SimpleMetricsExportAutoConfiguration.class })

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 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,8 +19,8 @@ package org.springframework.boot.actuate.endpoint;
/**
* Strategy class that can be used to filter {@link ExposableEndpoint endpoints}.
*
* @author Phillip Webb
* @param <E> the endpoint type
* @author Phillip Webb
* @since 2.0.0
*/
@FunctionalInterface

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 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.
@ -34,8 +34,8 @@ import org.springframework.data.cassandra.repository.support.CassandraRepository
* Repositories.
*
* @author Eddú Meléndez
* @see EnableCassandraRepositories
* @since 1.3.0
* @see EnableCassandraRepositories
*/
@Configuration(proxyBeanMethods = false)
@ConditionalOnClass({ CqlSession.class, CassandraRepository.class })

View File

@ -33,9 +33,9 @@ import org.springframework.data.elasticsearch.repository.config.EnableReactiveEl
* @author Brian Clozel
* @author Artur Konczak
* @author Mohsin Husen
* @since 1.1.0
* @see EnableElasticsearchRepositories
* @see EnableReactiveElasticsearchRepositories
* @since 1.1.0
*/
@Configuration(proxyBeanMethods = false)
@ConditionalOnClass({ ElasticsearchRestTemplate.class })

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 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.
@ -34,8 +34,8 @@ import org.springframework.data.elasticsearch.repository.support.ElasticsearchRe
*
* @author Artur Konczak
* @author Mohsin Husen
* @see EnableElasticsearchRepositories
* @since 1.1.0
* @see EnableElasticsearchRepositories
*/
@Configuration(proxyBeanMethods = false)
@ConditionalOnClass({ Client.class, ElasticsearchRepository.class })

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 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.
@ -32,8 +32,8 @@ import org.springframework.data.elasticsearch.repository.support.ReactiveElastic
* Reactive Repositories.
*
* @author Brian Clozel
* @see EnableReactiveElasticsearchRepositories
* @since 2.2.0
* @see EnableReactiveElasticsearchRepositories
*/
@Configuration(proxyBeanMethods = false)
@ConditionalOnClass({ ReactiveElasticsearchClient.class, ReactiveElasticsearchRepository.class })

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 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.
@ -35,8 +35,8 @@ import org.springframework.r2dbc.core.DatabaseClient;
* {@link EnableAutoConfiguration Auto-configuration} for Spring Data R2DBC Repositories.
*
* @author Mark Paluch
* @see EnableR2dbcRepositories
* @since 2.3.0
* @see EnableR2dbcRepositories
*/
@Configuration(proxyBeanMethods = false)
@ConditionalOnClass({ ConnectionFactory.class, R2dbcRepository.class })

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 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.
@ -34,8 +34,8 @@ import org.springframework.data.redis.repository.support.RedisRepositoryFactoryB
*
* @author Eddú Meléndez
* @author Stephane Nicoll
* @see EnableRedisRepositories
* @since 1.4.0
* @see EnableRedisRepositories
*/
@Configuration(proxyBeanMethods = false)
@ConditionalOnClass(EnableRedisRepositories.class)

View File

@ -40,8 +40,8 @@ import org.springframework.data.solr.repository.support.SolrRepositoryFactoryBea
*
* @author Christoph Strobl
* @author Oliver Gierke
* @deprecated since 2.3.9 for removal in 2.5 as Spring Data Solr is deprecated
* @since 1.1.0
* @deprecated since 2.3.9 for removal in 2.5 as Spring Data Solr is deprecated
*/
@Configuration(proxyBeanMethods = false)
@ConditionalOnClass({ SolrClient.class, SolrRepository.class })

View File

@ -50,8 +50,9 @@ import static org.assertj.core.api.Assertions.assertThat;
*
* @author Dave Syer
*/
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT, properties = { "spring.jersey.type=filter",
"server.servlet.context-path=/app", "server.servlet.register-default-servlet=true" })
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT,
properties = { "spring.jersey.type=filter", "server.servlet.context-path=/app",
"server.servlet.register-default-servlet=true" })
@DirtiesContext
class JerseyAutoConfigurationCustomFilterContextPathTests {

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 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.
@ -53,8 +53,8 @@ import org.springframework.util.ReflectionUtils;
*
* @author Phillip Webb
* @author Eddú Meléndez
* @see AutoConfigureJsonTesters
* @since 1.4.0
* @see AutoConfigureJsonTesters
*/
@Configuration(proxyBeanMethods = false)
@ConditionalOnClass(name = "org.assertj.core.api.Assert")

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 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.
@ -44,8 +44,8 @@ import org.springframework.web.servlet.DispatcherServlet;
* @author Phillip Webb
* @author Andy Wilkinson
* @author Stephane Nicoll
* @see AutoConfigureWebMvc
* @since 1.4.0
* @see AutoConfigureWebMvc
*/
@Configuration(proxyBeanMethods = false)
@ConditionalOnWebApplication(type = Type.SERVLET)

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 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.
@ -28,8 +28,8 @@ import org.springframework.ws.test.client.MockWebServiceServer;
* Auto-configuration for {@link MockWebServiceServer} support.
*
* @author Dmytro Nosan
* @see AutoConfigureMockWebServiceServer
* @since 2.3.0
* @see AutoConfigureMockWebServiceServer
*/
@Configuration(proxyBeanMethods = false)
@ConditionalOnProperty(prefix = "spring.test.webservice.client.mockserver", name = "enabled")

View File

@ -37,8 +37,9 @@ import static org.assertj.core.api.Assertions.assertThat;
*
* @author Stephane Nicoll
*/
@SpringBootTest(properties = "spring.main.web-application-type=reactive", classes = {
WebTestClientSpringBootTestIntegrationTests.TestConfiguration.class, ExampleWebFluxApplication.class })
@SpringBootTest(properties = "spring.main.web-application-type=reactive",
classes = { WebTestClientSpringBootTestIntegrationTests.TestConfiguration.class,
ExampleWebFluxApplication.class })
@AutoConfigureWebTestClient
class WebTestClientSpringBootTestIntegrationTests {

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 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.
@ -22,9 +22,9 @@ import org.springframework.context.ApplicationContext;
* Callback interface used to process an {@link ApplicationContext} with the ability to
* throw a (checked) exception.
*
* @param <C> the application context type
* @author Stephane Nicoll
* @author Andy Wilkinson
* @param <C> the application context type
* @since 2.0.0
* @see AbstractApplicationContextRunner
*/

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 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,9 @@ package org.springframework.boot.loader.tools.layer;
/**
* Callback interface that can be used to filter layer contents.
*
* @param <T> the content type
* @author Madhura Bhave
* @author Phillip Webb
* @param <T> the content type
* @since 2.3.0
*/
@FunctionalInterface

View File

@ -85,8 +85,8 @@ public interface Archive extends Iterable<Archive.Entry>, AutoCloseable {
/**
* Return a new iterator for the archive entries.
* @see java.lang.Iterable#iterator()
* @deprecated since 2.3.0 for removal in 2.5.0 in favor of using
* @see java.lang.Iterable#iterator()
* {@link org.springframework.boot.loader.jar.JarFile} to access entries and
* {@link #getNestedArchives(EntryFilter, EntryFilter)} for accessing nested archives.
*/
@ -97,10 +97,10 @@ public interface Archive extends Iterable<Archive.Entry>, AutoCloseable {
/**
* Performs the given action for each element of the {@code Iterable} until all
* elements have been processed or the action throws an exception.
* @see Iterable#forEach
* @deprecated since 2.3.0 for removal in 2.5.0 in favor of using
* {@link org.springframework.boot.loader.jar.JarFile} to access entries and
* {@link #getNestedArchives(EntryFilter, EntryFilter)} for accessing nested archives.
* @see Iterable#forEach {@link org.springframework.boot.loader.jar.JarFile} to access
* entries and {@link #getNestedArchives(EntryFilter, EntryFilter)} for accessing
* nested archives.
*/
@Deprecated
@Override
@ -113,10 +113,10 @@ public interface Archive extends Iterable<Archive.Entry>, AutoCloseable {
/**
* Creates a {@link Spliterator} over the elements described by this {@code Iterable}.
* @see Iterable#spliterator
* @deprecated since 2.3.0 for removal in 2.5.0 in favor of using
* {@link org.springframework.boot.loader.jar.JarFile} to access entries and
* {@link #getNestedArchives(EntryFilter, EntryFilter)} for accessing nested archives.
* @see Iterable#spliterator {@link org.springframework.boot.loader.jar.JarFile} to
* access entries and {@link #getNestedArchives(EntryFilter, EntryFilter)} for
* accessing nested archives.
*/
@Deprecated
@Override

View File

@ -225,8 +225,8 @@ public class JarFile extends AbstractJarFile implements Iterable<java.util.jar.J
/**
* Return an iterator for the contained entries.
* @see java.lang.Iterable#iterator()
* @since 2.3.0
* @see java.lang.Iterable#iterator()
*/
@Override
@SuppressWarnings({ "unchecked", "rawtypes" })

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2020 the original author or authors.
* Copyright 2012-2021 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.
@ -22,8 +22,8 @@ import io.rsocket.core.RSocketServer;
* Callback interface that can be used to customize a {@link RSocketServer}.
*
* @author Brian Clozel
* @see RSocketServer
* @since 2.3.0
* @see RSocketServer
*/
@FunctionalInterface
public interface RSocketServerCustomizer {

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 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.
@ -22,8 +22,8 @@ import org.eclipse.jetty.server.Server;
* Callback interface that can be used to customize a Jetty {@link Server}.
*
* @author Dave Syer
* @see JettyServletWebServerFactory
* @since 2.0.0
* @see JettyServletWebServerFactory
*/
@FunctionalInterface
public interface JettyServerCustomizer {

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 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.
@ -24,8 +24,8 @@ import reactor.netty.http.server.HttpServerRoutes;
* Function that can add new routes to an {@link HttpServerRoutes} instance.
*
* @author Brian Clozel
* @see NettyReactiveWebServerFactory
* @since 2.2.0
* @see NettyReactiveWebServerFactory
*/
@FunctionalInterface
public interface NettyRouteProvider extends Function<HttpServerRoutes, HttpServerRoutes> {

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 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.
@ -24,8 +24,8 @@ import reactor.netty.http.server.HttpServer;
* Mapping function that can be used to customize a Reactor Netty server instance.
*
* @author Brian Clozel
* @see NettyReactiveWebServerFactory
* @since 2.1.0
* @see NettyReactiveWebServerFactory
*/
@FunctionalInterface
public interface NettyServerCustomizer extends Function<HttpServer, HttpServer> {

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 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.
@ -22,8 +22,8 @@ import org.apache.catalina.connector.Connector;
* Callback interface that can be used to customize a Tomcat {@link Connector}.
*
* @author Dave Syer
* @see ConfigurableTomcatWebServerFactory
* @since 2.0.0
* @see ConfigurableTomcatWebServerFactory
*/
@FunctionalInterface
public interface TomcatConnectorCustomizer {

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 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.
@ -22,8 +22,8 @@ import org.apache.catalina.Context;
* Callback interface that can be used to customize a Tomcat {@link Context}.
*
* @author Dave Syer
* @see TomcatServletWebServerFactory
* @since 2.0.0
* @see TomcatServletWebServerFactory
*/
@FunctionalInterface
public interface TomcatContextCustomizer {

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 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.
@ -25,8 +25,8 @@ import org.apache.coyote.ProtocolHandler;
*
* @param <T> specified type for customization based on {@link ProtocolHandler}
* @author Pascal Zwick
* @see ConfigurableTomcatWebServerFactory
* @since 2.2.0
* @see ConfigurableTomcatWebServerFactory
*/
@FunctionalInterface
public interface TomcatProtocolHandlerCustomizer<T extends ProtocolHandler> {

View File

@ -1,5 +1,5 @@
/*
* Copyright 2012-2019 the original author or authors.
* Copyright 2012-2021 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.
@ -23,8 +23,8 @@ import org.springframework.boot.web.servlet.ServletContextInitializer;
* Factory interface that can be used to create a {@link WebServer}.
*
* @author Phillip Webb
* @see WebServer
* @since 2.0.0
* @see WebServer
*/
@FunctionalInterface
public interface ServletWebServerFactory {