Skip to content

Conversation

@Pankraz76
Copy link

@Pankraz76 Pankraz76 commented Nov 20, 2025

Congratulations on the recent major release — a lot of work has clearly gone into it.
I'm sure Spring Boot will continue to succeed as well.

I’d kindly like to suggest considering Error Prone integration featuring the TimeRules findings:

As discussed in:

Changes have been made to spring-context/src/main/java/org/springframework/scheduling/support/CronTrigger.java by:
    tech.picnic.errorprone.refasterrules.TimeRulesRecipes
        tech.picnic.errorprone.refasterrules.TimeRulesRecipes$InstantAtZoneRecipe
Changes have been made to spring-context/src/main/java/org/springframework/format/datetime/standard/DateTimeConverters.java by:
    tech.picnic.errorprone.refasterrules.TimeRulesRecipes
        tech.picnic.errorprone.refasterrules.TimeRulesRecipes$InstantAtZoneRecipe
Changes have been made to spring-context/src/test/java/org/springframework/scheduling/concurrent/DefaultManagedTaskSchedulerTests.java by:
    tech.picnic.errorprone.refasterrules.TimeRulesRecipes
        tech.picnic.errorprone.refasterrules.TimeRulesRecipes$DurationOfMinutesRecipe
Changes have been made to spring-test/src/main/java/org/springframework/test/http/HttpHeadersAssert.java by:
    tech.picnic.errorprone.refasterrules.TimeRulesRecipes
        tech.picnic.errorprone.refasterrules.TimeRulesRecipes$UtcConstantRecipe
        tech.picnic.errorprone.refasterrules.TimeRulesRecipes$InstantAtZoneRecipe
Changes have been made to spring-test/src/test/java/org/springframework/test/web/servlet/result/HeaderResultMatchersTests.java by:
    tech.picnic.errorprone.refasterrules.TimeRulesRecipes
        tech.picnic.errorprone.refasterrules.TimeRulesRecipes$UtcConstantRecipe
Changes have been made to spring-test/src/test/java/org/springframework/test/web/servlet/client/RestTestClientTests.java by:
    tech.picnic.errorprone.refasterrules.TimeRulesRecipes
        tech.picnic.errorprone.refasterrules.TimeRulesRecipes$UtcConstantRecipe
Changes have been made to spring-test/src/test/java/org/springframework/test/web/support/HeaderAssertionTests.java by:
    tech.picnic.errorprone.refasterrules.TimeRulesRecipes
        tech.picnic.errorprone.refasterrules.TimeRulesRecipes$UtcConstantRecipe
Changes have been made to spring-web/src/main/java/org/springframework/web/server/session/InMemoryWebSessionStore.java by:
    tech.picnic.errorprone.refasterrules.TimeRulesRecipes
        tech.picnic.errorprone.refasterrules.TimeRulesRecipes$UtcConstantRecipe
        tech.picnic.errorprone.refasterrules.TimeRulesRecipes$UtcClockRecipe
Changes have been made to spring-web/src/main/java/org/springframework/http/HttpHeaders.java by:
    tech.picnic.errorprone.refasterrules.TimeRulesRecipes
        tech.picnic.errorprone.refasterrules.TimeRulesRecipes$UtcConstantRecipe
        tech.picnic.errorprone.refasterrules.TimeRulesRecipes$InstantAtZoneRecipe
Changes have been made to spring-web/src/test/java/org/springframework/web/server/i18n/FixedLocaleContextResolverTests.java by:
    tech.picnic.errorprone.refasterrules.TimeRulesRecipes
        tech.picnic.errorprone.refasterrules.TimeRulesRecipes$UtcConstantRecipe
Changes have been made to spring-web/src/test/java/org/springframework/http/HttpHeadersTests.java by:
    tech.picnic.errorprone.refasterrules.TimeRulesRecipes
        tech.picnic.errorprone.refasterrules.TimeRulesRecipes$UtcConstantRecipe
Changes have been made to spring-web/src/test/java/org/springframework/http/client/reactive/ClientHttpConnectorTests.java by:
    tech.picnic.errorprone.refasterrules.TimeRulesRecipes
        tech.picnic.errorprone.refasterrules.TimeRulesRecipes$UtcConstantRecipe
Changes have been made to spring-webflux/src/test/java/org/springframework/web/reactive/function/server/DefaultRenderingResponseTests.java by:
    tech.picnic.errorprone.refasterrules.TimeRulesRecipes
        tech.picnic.errorprone.refasterrules.TimeRulesRecipes$DurationOfMillisRecipe
Changes have been made to spring-webmvc/src/test/java/org/springframework/web/servlet/mvc/method/annotation/HttpEntityMethodProcessorMockTests.java by:
    tech.picnic.errorprone.refasterrules.TimeRulesRecipes
        tech.picnic.errorprone.refasterrules.TimeRulesRecipes$UtcConstantRecipe
Please review and commit the results.
Estimate time saved: 1h 10m

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Nov 20, 2025
- tech.picnic.errorprone.refasterrules.StreamRulesRecipes
# TBD
# - org.openrewrite.java.migrate.Java8toJava11 # https://github.com/google/error-prone/pull/5328
# - org.openrewrite.java.migrate.UpgradeToJava17 # https://github.com/checkstyle/checkstyle/pull/17730
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since Checkstyle is already used within Spring, it’s effectively part of the project transitively.

Integrating these rules directly could improve a lot of code and allow best practices to be applied effortlessly and consistently.

version=$(sed -n 's/version=\(.*\)/\1/p' gradle.properties)
echo "Version is $version"
echo "version=$version" >> $GITHUB_OUTPUT
- name: SanityCheck
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’m not sure if this is the right place to check. Having this last in place should allow most of the other steps to work, but it still ends up failing with a corrupt version.

import java.util.Set;
import java.util.stream.StreamSupport;

import com.google.common.collect.Streams;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart from the commons-logging and micrometer-api dependencies there are no 3rd party dependencies in Spring. I doubt adding a dependency on Google Guava is going to happen anytime soon.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes this seems questionable. Thanks for the hint.


List<Element> subList = elements.subList(fromIndex, toIndex);
String path = subList.stream().map(Element::value).collect(Collectors.joining(""));
String path = subList.stream().map(Element::value).collect(joining());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe there is a no static import rule.

Copy link
Author

@Pankraz76 Pankraz76 Nov 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

@mdeinum mdeinum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at existing rules and deliberate care in dependencies I would expect some changes. Which would mean that the rewrite rules aren't applicable.

@Pankraz76 Pankraz76 changed the title [prone] Add StreamRulesRecipes [prone] Add TimeRulesRecipes Nov 21, 2025
Signed-off-by: Vincent Potucek <vpotucek@me.com>
@Pankraz76 Pankraz76 force-pushed the fix-StreamRulesRecipes branch from a8e5b97 to def2188 Compare November 21, 2025 10:03
@Pankraz76
Copy link
Author

Looking at existing rules and deliberate care in dependencies I would expect some changes. Which would mean that the rewrite rules aren't applicable.

Thank you for the kind feedback.

I’ve reworked the scope to focus on the TimeRules. Hopefully this is something easier to consider.

the rewrite rules aren't applicable.

I think it’s difficult to judge something universally or generically; each scope has its own individual context.

This is the first project that passed the included GradleBestPractices checks without any findings.
That suggests the codebase is already very up-to-date regarding this scope — well done.

Considering the Java8toJava11 migration, as explored in

the code compiles on Java 21+ while still largely using Java 8–era and Java 17–era constructs.
That’s something to consider — similar to how Checkstyle, Google Error Prone, and Spotless have already done clean up the entire codebase in a glance.

@Test
void resolveCustomizedAndTimeZoneLocale() {
TimeZone timeZone = TimeZone.getTimeZone(ZoneId.of("UTC"));
TimeZone timeZone = TimeZone.getTimeZone(ZoneOffset.UTC);
Copy link
Author

@Pankraz76 Pankraz76 Nov 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this seems a good thing to consider, being straight up instead of "error prone".

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sorry i meant this is a good thing and seems easy consider suggest, as it avoids error prone (random) string.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

status: waiting-for-triage An issue we've not yet triaged or decided on

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants