Skip to content

Commit cd8a692

Browse files
committed
Update to Spring Javaformat / checkstyle (prepare for JSpecify)
This commit updates to Javaformat to 0.0.47 and the Checkstyle tools to 10.25.0. The `SpringAnnotationLocationCheck` has also been added to the checkstyle rules in order to prepare for the migration to Jspecify for nullability constraints. Also, various code has been updated to abide by the new format and checkstyle rules in the updated versions. See #1150 Signed-off-by: Chris Bono <[email protected]>
1 parent 73e88c8 commit cd8a692

File tree

7 files changed

+15
-11
lines changed

7 files changed

+15
-11
lines changed

buildSrc/src/main/java/org/springframework/pulsar/gradle/JavaConventionsPlugin.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,12 @@ private void configureSpringJavaFormat(Project project) {
120120
});
121121
project.getPlugins().apply(CheckstylePlugin.class);
122122
CheckstyleExtension checkstyle = project.getExtensions().getByType(CheckstyleExtension.class);
123-
checkstyle.setToolVersion("10.12.4");
123+
checkstyle.setToolVersion("10.25.0");
124124
checkstyle.getConfigDirectory().set(project.getRootProject().file("src/checkstyle"));
125125
String version = SpringJavaFormatPlugin.class.getPackage().getImplementationVersion();
126126
DependencySet checkstyleDependencies = project.getConfigurations().getByName("checkstyle").getDependencies();
127+
checkstyleDependencies
128+
.add(project.getDependencies().create("com.puppycrawl.tools:checkstyle:" + checkstyle.getToolVersion()));
127129
checkstyleDependencies
128130
.add(project.getDependencies().create("io.spring.javaformat:spring-javaformat-checkstyle:" + version));
129131
}

integration-tests/src/intTest/java/org/springframework/pulsar/inttest/config/DefaultTenantAndNamespaceTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ void produceConsumeWithDefaultTenantNamespace(CapturedOutput output,
8787

8888
}
8989

90-
private static class TestVerifyUtils {
90+
private static final class TestVerifyUtils {
9191

9292
static void verifyProduceConsume(CapturedOutput output, int numExpectedMessages,
9393
Function<Integer, Object> expectedMessageFactory) {

integration-tests/src/intTest/java/org/springframework/pulsar/inttest/logging/PulsarTemplateLambdaWarnLoggerTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ static class TestAppConfig {
148148

149149
}
150150

151-
private static class TestUtils {
151+
private static final class TestUtils {
152152

153153
private static void sendRequestsWithCustomizer(String testPrefix, int numberOfSends,
154154
PulsarTemplate<String> template) {

spring-pulsar-sample-apps/sample-pulsar-functions/sample-signup-app/src/main/java/org/springframework/pulsar/sample/signup/config/AppConfig.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
import org.springframework.pulsar.function.PulsarSource;
3535
import org.springframework.pulsar.sample.signup.model.SignupGenerator;
3636

37+
@SuppressWarnings("removal")
3738
@Configuration(proxyBeanMethods = false)
3839
class AppConfig {
3940

@@ -42,6 +43,7 @@ SignupGenerator signupGenerator() {
4243
return new SignupGenerator();
4344
}
4445

46+
4547
@Bean
4648
Jackson2JsonMessageConverter jackson2JsonMessageConverter() {
4749
return new Jackson2JsonMessageConverter();

spring-pulsar/src/main/java/org/springframework/pulsar/config/ConcurrentPulsarListenerContainerFactory.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ public ConcurrentPulsarListenerContainerFactory(PulsarConsumerFactory<? super T>
5454
/**
5555
* Specify the container concurrency.
5656
* @param concurrency the number of consumers to create.
57+
* @deprecated since 1.2.0 for removal in 2.0.0 in favor of
58+
* {@link PulsarContainerProperties#setConcurrency}
5759
*/
5860
@Deprecated(since = "1.2.0", forRemoval = true)
5961
public void setConcurrency(Integer concurrency) {

spring-pulsar/src/test/java/org/springframework/pulsar/core/SchemaResolverTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ void schemaTypeNoneWithMessageTypeAndKeyType() {
103103

104104
}
105105

106-
private static class TestSchemaResolver implements SchemaResolver {
106+
private static final class TestSchemaResolver implements SchemaResolver {
107107

108108
private final SchemaResolver delegate = mock(SchemaResolver.class);
109109

src/checkstyle/checkstyle.xml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,10 @@
2727
<module name="AnnotationUseStyle">
2828
<property name="elementStyle" value="compact"/>
2929
</module>
30-
<module name="MissingOverride"/>
31-
<module name="PackageAnnotation"/>
32-
<module name="AnnotationLocation">
33-
<property name="allowSamelineSingleParameterlessAnnotation"
34-
value="false"/>
35-
</module>
30+
<module name="MissingOverride" />
31+
<module name="MissingDeprecated" />
32+
<module name="PackageAnnotation" />
33+
<module name="io.spring.javaformat.checkstyle.check.SpringAnnotationLocationCheck" />
3634

3735
<!-- Block Checks -->
3836
<module name="EmptyBlock">
@@ -119,7 +117,7 @@
119117
<module name="JavadocMethod">
120118
</module>
121119
<module name="JavadocVariable">
122-
<property name="scope" value="public"/>
120+
<property name="accessModifiers" value="public"/>
123121
</module>
124122
<module name="JavadocStyle">
125123
<property name="checkEmptyJavadoc" value="true"/>

0 commit comments

Comments
 (0)