Skip to content

Commit 2567b20

Browse files
committed
Upgrade to spring-javaformat 0.0.28 and downgrade to Checkstyle 8.41
In order to be able to use text blocks and other new Java language features, we are upgrading to a recent version of Checkstyle. The latest version of spring-javaformat-checkstyle (0.0.28) is built against Checkstyle 8.32 which does not include support for language features such as text blocks. Support for text blocks was added in Checkstyle 8.36. In addition, there is a binary compatibility issue between spring-javaformat-checkstyle 0.0.28 and Checkstyle 8.42. Thus we cannot use Checkstyle 8.42 or higher. In this commit, we therefore upgrade to spring-javaformat-checkstyle 0.0.28 and downgrade to Checkstyle 8.41. This change is being applied to `5.3.x` as well as `main` in order to benefit from the enhanced checking provided in more recent versions of Checkstyle. Closes gh-27481
1 parent 119c78b commit 2567b20

File tree

173 files changed

+221
-138
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

173 files changed

+221
-138
lines changed

build.gradle

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,7 @@ configure([rootProject] + javaProjects) { project ->
340340
}
341341

342342
checkstyle {
343-
toolVersion = "8.45.1"
343+
toolVersion = "8.41"
344344
configDirectory.set(rootProject.file("src/checkstyle"))
345345
}
346346

@@ -362,7 +362,8 @@ configure([rootProject] + javaProjects) { project ->
362362
// JSR-305 only used for non-required meta-annotations
363363
compileOnly("com.google.code.findbugs:jsr305")
364364
testCompileOnly("com.google.code.findbugs:jsr305")
365-
checkstyle("io.spring.javaformat:spring-javaformat-checkstyle:0.0.15")
365+
checkstyle("io.spring.javaformat:spring-javaformat-checkstyle:0.0.28")
366+
checkstyle("com.puppycrawl.tools:checkstyle:8.41")
366367
}
367368

368369
ext.javadocLinks = [

spring-aop/src/main/java/org/springframework/aop/support/ControlFlowPointcut.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2020 the original author or authors.
2+
* Copyright 2002-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -146,7 +146,7 @@ public int hashCode() {
146146

147147
@Override
148148
public String toString() {
149-
return getClass().getName() + ": class = " + this.clazz.getName() + "; methodName = " + methodName;
149+
return getClass().getName() + ": class = " + this.clazz.getName() + "; methodName = " + this.methodName;
150150
}
151151

152152
}

spring-aop/src/test/java/org/springframework/aop/support/ClassUtilsTests.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -13,6 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
1617
package org.springframework.aop.support;
1718

1819
import org.junit.jupiter.api.Test;
@@ -29,10 +30,10 @@
2930
* @author Rob Harrop
3031
* @author Rick Evans
3132
*/
32-
public class ClassUtilsTests {
33+
class ClassUtilsTests {
3334

3435
@Test
35-
public void getShortNameForCglibClass() {
36+
void getShortNameForCglibClass() {
3637
TestBean tb = new TestBean();
3738
ProxyFactory pf = new ProxyFactory();
3839
pf.setTarget(tb);
@@ -41,4 +42,5 @@ public void getShortNameForCglibClass() {
4142
String className = ClassUtils.getShortName(proxy.getClass());
4243
assertThat(className).as("Class name did not match").isEqualTo("TestBean");
4344
}
45+
4446
}

spring-aspects/src/main/java/org/springframework/beans/factory/aspectj/ConfigurableObject.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -13,14 +13,14 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
1617
package org.springframework.beans.factory.aspectj;
1718

1819
/**
19-
* Marker interface for domain object that need DI through aspects.
20+
* Marker interface for domain objects that need DI through aspects.
2021
*
2122
* @author Ramnivas Laddad
2223
* @since 2.5
2324
*/
2425
public interface ConfigurableObject {
25-
2626
}

spring-aspects/src/test/java/org/springframework/transaction/aspectj/ClassWithPrivateAnnotatedMember.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
1617
package org.springframework.transaction.aspectj;
1718

1819
import org.springframework.transaction.annotation.Transactional;
@@ -29,4 +30,5 @@ public void doSomething() {
2930

3031
@Transactional
3132
private void doInTransaction() {}
33+
3234
}

spring-aspects/src/test/java/org/springframework/transaction/aspectj/ClassWithProtectedAnnotatedMember.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
1617
package org.springframework.transaction.aspectj;
1718

1819
import org.springframework.transaction.annotation.Transactional;
@@ -29,4 +30,5 @@ public void doSomething() {
2930

3031
@Transactional
3132
protected void doInTransaction() {}
33+
3234
}

spring-beans/src/test/java/org/springframework/beans/factory/support/security/support/CustomCallbackBean.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -13,6 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
1617
package org.springframework.beans.factory.support.security.support;
1718

1819
/**
@@ -27,4 +28,5 @@ public void init() {
2728
public void destroy() {
2829
System.setProperty("security.destroy", "true");
2930
}
31+
3032
}

spring-beans/src/test/java/org/springframework/beans/factory/support/security/support/DestroyBean.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -13,6 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
1617
package org.springframework.beans.factory.support.security.support;
1718

1819
import org.springframework.beans.factory.DisposableBean;
@@ -26,4 +27,5 @@ public class DestroyBean implements DisposableBean {
2627
public void destroy() throws Exception {
2728
System.setProperty("security.destroy", "true");
2829
}
30+
2931
}

spring-beans/src/test/java/org/springframework/beans/factory/support/security/support/FactoryBean.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -13,6 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
1617
package org.springframework.beans.factory.support.security.support;
1718

1819
/**
@@ -33,4 +34,5 @@ public Object makeInstance() {
3334
System.getProperties();
3435
return new Object();
3536
}
37+
3638
}

spring-beans/src/test/java/org/springframework/beans/factory/support/security/support/InitBean.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2021 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -13,6 +13,7 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16+
1617
package org.springframework.beans.factory.support.security.support;
1718

1819
import org.springframework.beans.factory.InitializingBean;
@@ -26,4 +27,5 @@ public class InitBean implements InitializingBean {
2627
public void afterPropertiesSet() throws Exception {
2728
System.getProperties();
2829
}
30+
2931
}

0 commit comments

Comments
 (0)