Upgrade to checkstyle 6.17
Fixes gh-5547
This commit is contained in:
@@ -134,8 +134,8 @@ public class DataSourceAutoConfigurationTests {
|
||||
public void hikariValidatesConnectionByDefault() throws Exception {
|
||||
HikariDataSource dataSource = autoConfigureDataSource(HikariDataSource.class,
|
||||
"org.apache.tomcat");
|
||||
assertThat(dataSource.getConnectionTestQuery()).isNull(); // Use
|
||||
// Connection#isValid()
|
||||
assertThat(dataSource.getConnectionTestQuery()).isNull();
|
||||
// Use Connection#isValid()
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -37,6 +37,7 @@ public @interface DependencyManagementBom {
|
||||
* One or more sets of colon-separated coordinates ({@code group:module:version}) of a
|
||||
* Maven bom that contains dependency management that will add to and override the
|
||||
* default dependency management.
|
||||
* @return the BOM coordinates
|
||||
*/
|
||||
String[] value();
|
||||
|
||||
|
||||
@@ -141,10 +141,10 @@ public class FileSystemWatcher {
|
||||
this.watchThread = new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
int remainingScans = FileSystemWatcher.this.remainingScans.get();
|
||||
while (remainingScans > 0 || remainingScans == -1) {
|
||||
int remaining = FileSystemWatcher.this.remainingScans.get();
|
||||
while (remaining > 0 || remaining == -1) {
|
||||
try {
|
||||
if (remainingScans > 0) {
|
||||
if (remaining > 0) {
|
||||
FileSystemWatcher.this.remainingScans.decrementAndGet();
|
||||
}
|
||||
scan();
|
||||
@@ -152,7 +152,7 @@ public class FileSystemWatcher {
|
||||
catch (InterruptedException ex) {
|
||||
// Ignore
|
||||
}
|
||||
remainingScans = FileSystemWatcher.this.remainingScans.get();
|
||||
remaining = FileSystemWatcher.this.remainingScans.get();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
@@ -244,12 +244,12 @@
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-checkstyle-plugin</artifactId>
|
||||
<version>2.16</version>
|
||||
<version>2.17</version>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.puppycrawl.tools</groupId>
|
||||
<artifactId>checkstyle</artifactId>
|
||||
<version>6.10.1</version>
|
||||
<version>6.17</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</plugin>
|
||||
|
||||
@@ -20,22 +20,4 @@
|
||||
<suppress files="Ansi.*\.java" checks="JavadocStyle" />
|
||||
<suppress files="LogLevel\.java" checks="JavadocVariable" />
|
||||
<suppress files="HelpMojo\.java" checks=".*"/>
|
||||
|
||||
<!-- https://github.com/checkstyle/checkstyle/issues/2141 -->
|
||||
<suppress files="ConfigurationProperties.java" checks="JavadocMethod" />
|
||||
<suppress files="DeprecatedConfigurationProperty\.java" checks="JavadocMethod" />
|
||||
<suppress files="EnableConfigurationProperties\.java" checks="JavadocMethod" />
|
||||
<suppress files="EntityScan\.java" checks="JavadocMethod" />
|
||||
<suppress files="SpringApplication\.java" checks="JavadocMethod" />
|
||||
<suppress files="IntegrationTest\.java" checks="JavadocMethod" />
|
||||
<suppress files="SpringApplicationConfiguration\.java" checks="JavadocMethod" />
|
||||
<suppress files="WebIntegrationTest\.java" checks="JavadocMethod" />
|
||||
<suppress files="ServletComponentScan\.java" checks="JavadocMethod" />
|
||||
<suppress files="AutoConfigureAfter\.java" checks="JavadocMethod" />
|
||||
<suppress files="AutoConfigureBefore\.java" checks="JavadocMethod" />
|
||||
<suppress files="ConditionalOn.*\.java" checks="JavadocMethod" />
|
||||
<suppress files="AutoConfigureOrder.java" checks="JavadocMethod" />
|
||||
<suppress files="EnableAutoConfiguration.java" checks="JavadocMethod" />
|
||||
<suppress files="SpringBootApplication.java" checks="JavadocMethod" />
|
||||
<suppress files="ImportAutoConfiguration.java" checks="JavadocMethod" />
|
||||
</suppressions>
|
||||
|
||||
@@ -114,7 +114,9 @@
|
||||
</module>
|
||||
|
||||
<!-- Miscellaneous -->
|
||||
<module name="CommentsIndentation" />
|
||||
<module name="CommentsIndentation">
|
||||
<property name="tokens" value="BLOCK_COMMENT_BEGIN"/>
|
||||
</module>
|
||||
<module name="UpperEll" />
|
||||
<module name="ArrayTypeStyle" />
|
||||
<module name="OuterTypeFilename" />
|
||||
|
||||
@@ -43,6 +43,7 @@ public @interface OverrideAutoConfiguration {
|
||||
/**
|
||||
* The value of the {@link EnableAutoConfiguration#ENABLED_OVERRIDE_PROPERTY enabled
|
||||
* property override}.
|
||||
* @return the override value
|
||||
*/
|
||||
boolean enabled();
|
||||
|
||||
|
||||
@@ -103,8 +103,10 @@ public abstract class AnnotationCustomizableTypeExcludeFilter extends TypeExclud
|
||||
|
||||
protected abstract Set<Class<?>> getDefaultIncludes();
|
||||
|
||||
protected static enum FilterType {
|
||||
protected enum FilterType {
|
||||
|
||||
INCLUDE, EXCLUDE
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -45,6 +45,7 @@ public @interface TypeExcludeFilters {
|
||||
* specified here can either have a no-arg constructor or accept a single
|
||||
* {@code Class<?>} argument if then need access to the {@code testClass}.
|
||||
* @see TypeExcludeFilter
|
||||
* @return the type exclude filters to apply
|
||||
*/
|
||||
Class<? extends TypeExcludeFilter>[] value();
|
||||
|
||||
|
||||
@@ -52,6 +52,7 @@ public @interface AutoConfigureJsonTesters {
|
||||
/**
|
||||
* If {@link BasicJsonTester}, {@link JacksonTester} and {@link GsonTester} fields
|
||||
* should be initialized using marshallers from the {@link ApplicationContext}.
|
||||
* @return if JSON tester fields should be initialized
|
||||
*/
|
||||
boolean initFields() default true;
|
||||
|
||||
|
||||
@@ -47,18 +47,22 @@ public @interface JsonTest {
|
||||
* {@code @JsonComponent} and {@code Module} beans are included.
|
||||
* @see #includeFilters()
|
||||
* @see #excludeFilters()
|
||||
* @return if default filters should be used
|
||||
*/
|
||||
boolean useDefaultFilters() default true;
|
||||
|
||||
/**
|
||||
* A set of include filters which can be used to add otherwise filtered beans to the
|
||||
* application context.
|
||||
* @return include filters to apply
|
||||
*/
|
||||
Filter[] includeFilters() default {};
|
||||
|
||||
/**
|
||||
* A set of exclude filters which can be used to filter beans that would otherwise be
|
||||
* added to the application context.
|
||||
* @return exclude filters to apply
|
||||
*/
|
||||
Filter[] excludeFilters() default {};
|
||||
|
||||
}
|
||||
|
||||
@@ -43,13 +43,15 @@ import org.springframework.boot.test.autoconfigure.properties.PropertyMapping;
|
||||
public @interface AutoConfigureTestDatabase {
|
||||
|
||||
/**
|
||||
* If the test database should replace any existing.
|
||||
* Determines what type of existing DataSource beans can be replaced.
|
||||
* @return the type of existing DataSource to replace
|
||||
*/
|
||||
Replace replace() default Replace.ANY;
|
||||
|
||||
/**
|
||||
* The type of connection to be establish when {@link #replace() replacing} the data
|
||||
* source. By default will attempt to detect the connection based on the classpath.
|
||||
* @return the type of connection to use
|
||||
*/
|
||||
EmbeddedDatabaseConnection connection() default EmbeddedDatabaseConnection.NONE;
|
||||
|
||||
|
||||
@@ -69,6 +69,7 @@ public @interface DataJpaTest {
|
||||
|
||||
/**
|
||||
* If SQL output should be logged.
|
||||
* @return if SQL is logged
|
||||
*/
|
||||
@PropertyMapping("spring.jpa.show-sql")
|
||||
boolean showSql() default true;
|
||||
@@ -79,18 +80,21 @@ public @interface DataJpaTest {
|
||||
* included.
|
||||
* @see #includeFilters()
|
||||
* @see #excludeFilters()
|
||||
* @return if default filters should be used
|
||||
*/
|
||||
boolean useDefaultFilters() default true;
|
||||
|
||||
/**
|
||||
* A set of include filters which can be used to add otherwise filtered beans to the
|
||||
* application context.
|
||||
* @return include filters to apply
|
||||
*/
|
||||
Filter[] includeFilters() default {};
|
||||
|
||||
/**
|
||||
* A set of exclude filters which can be used to filter beans that would otherwise be
|
||||
* added to the application context.
|
||||
* @return exclude filters to apply
|
||||
*/
|
||||
Filter[] excludeFilters() default {};
|
||||
|
||||
|
||||
@@ -58,6 +58,7 @@ public @interface PropertyMapping {
|
||||
* Defines the property mapping. When used at the type-level, this value will be used
|
||||
* as a prefix for all mapped attributes. When used on an attribute, the value
|
||||
* overrides the generated (kebab case) name.
|
||||
* @return the property mapping
|
||||
*/
|
||||
String value() default "";
|
||||
|
||||
@@ -65,6 +66,7 @@ public @interface PropertyMapping {
|
||||
* Determines if mapping should occur. When specified at the type-level indicates if
|
||||
* mapping should occur by default or not. When used at the attribute-level, overrides
|
||||
* the type-level default.
|
||||
* @return if mapping should occur
|
||||
*/
|
||||
boolean map() default true;
|
||||
|
||||
|
||||
@@ -51,18 +51,21 @@ public @interface AutoConfigureMockMvc {
|
||||
/**
|
||||
* If filters from the application context should be registered with MockMVC. Defaults
|
||||
* to {@code true}.
|
||||
* @return if filters should be added
|
||||
*/
|
||||
boolean addFilters() default true;
|
||||
|
||||
/**
|
||||
* If {@link MvcResult} information should always be printed after each MockMVC
|
||||
* invocation. Defaults to {@code true}.
|
||||
* @return if result information is always printed
|
||||
*/
|
||||
boolean alwaysPrint() default true;
|
||||
|
||||
/**
|
||||
* If a {@link WebClient} should be auto-configured when HtmlUnit is on the classpath.
|
||||
* Defaults to {@code true}.
|
||||
* @return if a {@link WebClient} is auto-configured
|
||||
*/
|
||||
@PropertyMapping("webclient.enabled")
|
||||
boolean webClientEnabled() default true;
|
||||
@@ -70,6 +73,7 @@ public @interface AutoConfigureMockMvc {
|
||||
/**
|
||||
* If a {@link WebDriver} should be auto-configured when Selenium is on the classpath.
|
||||
* Defaults to {@code true}.
|
||||
* @return if a {@link WebDriver} is auto-configured
|
||||
*/
|
||||
@PropertyMapping("webdriver.enabled")
|
||||
boolean webDriverEnabled() default true;
|
||||
|
||||
@@ -78,6 +78,7 @@ public @interface WebMvcTest {
|
||||
* can be used for brevity if no other attributes are defined. See
|
||||
* {@link #controllers()} for details.
|
||||
* @see #controllers()
|
||||
* @return the controllers to test
|
||||
*/
|
||||
@AliasFor("controllers")
|
||||
Class<?>[] value() default {};
|
||||
@@ -86,6 +87,7 @@ public @interface WebMvcTest {
|
||||
* Specifies the controllers to test. May be left blank if all {@code @Controller}
|
||||
* beans should be added to the application context.
|
||||
* @see #value()
|
||||
* @return the controllers to test
|
||||
*/
|
||||
@AliasFor("value")
|
||||
Class<?>[] controllers() default {};
|
||||
@@ -98,18 +100,21 @@ public @interface WebMvcTest {
|
||||
* included.
|
||||
* @see #includeFilters()
|
||||
* @see #excludeFilters()
|
||||
* @return if default filters should be used
|
||||
*/
|
||||
boolean useDefaultFilters() default true;
|
||||
|
||||
/**
|
||||
* A set of include filters which can be used to add otherwise filtered beans to the
|
||||
* application context.
|
||||
* @return include filters to apply
|
||||
*/
|
||||
Filter[] includeFilters() default {};
|
||||
|
||||
/**
|
||||
* A set of exclude filters which can be used to filter beans that would otherwise be
|
||||
* added to the application context.
|
||||
* @return exclude filters to apply
|
||||
*/
|
||||
Filter[] excludeFilters() default {};
|
||||
|
||||
|
||||
@@ -61,6 +61,7 @@ public @interface SpringApplicationTest {
|
||||
/**
|
||||
* Properties in form {@literal key=value} that should be added to the Spring
|
||||
* {@link Environment} before the test runs.
|
||||
* @return the properties to add
|
||||
*/
|
||||
String[] value() default {};
|
||||
|
||||
|
||||
@@ -48,6 +48,7 @@ public @interface TestComponent {
|
||||
/**
|
||||
* The value may indicate a suggestion for a logical component name, to be turned into
|
||||
* a Spring bean in case of an auto-detected component.
|
||||
* @return the specified bean name, if any
|
||||
*/
|
||||
String value() default "";
|
||||
|
||||
|
||||
@@ -45,6 +45,7 @@ public @interface TestConfiguration {
|
||||
/**
|
||||
* Explicitly specify the name of the Spring bean definition associated with this
|
||||
* Configuration class. See {@link Configuration#value()} for details.
|
||||
* @return the specified bean name, if any
|
||||
*/
|
||||
String value() default "";
|
||||
|
||||
|
||||
@@ -85,12 +85,14 @@ public @interface MockBean {
|
||||
* The name of the bean that should be registered with the application context. If not
|
||||
* specified the name will either be generated or, if the mock replaces an existing
|
||||
* bean, the existing name will be used.
|
||||
* @return the name of the bean
|
||||
*/
|
||||
String name() default "";
|
||||
|
||||
/**
|
||||
* The classes to mock. This is an alias of {@link #classes()} which can be used for
|
||||
* brevity if no other attributes are defined. See {@link #classes()} for details.
|
||||
* @return the classes to mock
|
||||
*/
|
||||
@AliasFor("classes")
|
||||
Class<?>[] value() default {};
|
||||
@@ -105,6 +107,7 @@ public @interface MockBean {
|
||||
* <p>
|
||||
* If this is the only attribute specified consider using the {@code value} alias
|
||||
* instead.
|
||||
* @return the classes to mock
|
||||
*/
|
||||
@AliasFor("value")
|
||||
Class<?>[] classes() default {};
|
||||
@@ -112,23 +115,27 @@ public @interface MockBean {
|
||||
/**
|
||||
* Any extra interfaces that should also be declared on the mock. See
|
||||
* {@link MockSettings#extraInterfaces(Class...)} for details.
|
||||
* @return any extra interfaces
|
||||
*/
|
||||
Class<?>[] extraInterfaces() default {};
|
||||
|
||||
/**
|
||||
* The {@link Answers} type to use on the mock.
|
||||
* @return the answer type
|
||||
*/
|
||||
Answers answer() default Answers.RETURNS_DEFAULTS;
|
||||
|
||||
/**
|
||||
* If the generated mock is serializable. See {@link MockSettings#serializable()} for
|
||||
* details.
|
||||
* @return if the mock is serializable
|
||||
*/
|
||||
boolean serializable() default false;
|
||||
|
||||
/**
|
||||
* The reset mode to apply to the mock bean. The default is {@link MockReset#AFTER}
|
||||
* meaning that mocks are automatically reset after each test method is invoked.
|
||||
* @return the reset mode
|
||||
*/
|
||||
MockReset reset() default MockReset.AFTER;
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ public @interface MockBeans {
|
||||
|
||||
/**
|
||||
* Return the contained {@link MockBean} annotations.
|
||||
* @return the mock beans
|
||||
*/
|
||||
MockBean[] value();
|
||||
|
||||
|
||||
@@ -240,30 +240,31 @@ public class RepackageTask extends DefaultTask {
|
||||
}
|
||||
|
||||
private void setMainClass(Repackager repackager) {
|
||||
String mainClass;
|
||||
if (getProject().hasProperty("mainClassName")) {
|
||||
mainClass = (String) getProject().property("mainClassName");
|
||||
}
|
||||
else {
|
||||
ExtraPropertiesExtension extraProperties = (ExtraPropertiesExtension) getProject()
|
||||
.getExtensions().getByName("ext");
|
||||
mainClass = (String) extraProperties.get("mainClassName");
|
||||
}
|
||||
String mainClassName = getMainClassNameProperty();
|
||||
if (RepackageTask.this.mainClass != null) {
|
||||
mainClass = RepackageTask.this.mainClass;
|
||||
mainClassName = RepackageTask.this.mainClass;
|
||||
}
|
||||
else if (this.extension.getMainClass() != null) {
|
||||
mainClass = this.extension.getMainClass();
|
||||
mainClassName = this.extension.getMainClass();
|
||||
}
|
||||
else {
|
||||
Task runTask = getProject().getTasks().findByName("run");
|
||||
if (runTask != null && runTask.hasProperty("main")) {
|
||||
mainClass = (String) getProject().getTasks().getByName("run")
|
||||
mainClassName = (String) getProject().getTasks().getByName("run")
|
||||
.property("main");
|
||||
}
|
||||
}
|
||||
getLogger().info("Setting mainClass: " + mainClass);
|
||||
repackager.setMainClass(mainClass);
|
||||
getLogger().info("Setting mainClass: " + mainClassName);
|
||||
repackager.setMainClass(mainClassName);
|
||||
}
|
||||
|
||||
private String getMainClassNameProperty() {
|
||||
if (getProject().hasProperty("mainClassName")) {
|
||||
return (String) getProject().property("mainClassName");
|
||||
}
|
||||
ExtraPropertiesExtension extraProperties = (ExtraPropertiesExtension) getProject()
|
||||
.getExtensions().getByName("ext");
|
||||
return (String) extraProperties.get("mainClassName");
|
||||
}
|
||||
|
||||
private LaunchScript getLaunchScript() throws IOException {
|
||||
|
||||
@@ -65,6 +65,7 @@ public @interface JsonComponent {
|
||||
/**
|
||||
* The value may indicate a suggestion for a logical component name, to be turned into
|
||||
* a Spring bean in case of an autodetected component.
|
||||
* @return the component name
|
||||
*/
|
||||
String value() default "";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user