Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spring Framework 6.1 - Add -parameters compiler flag if missing #467

Open
nmck257 opened this issue Jan 2, 2024 · 0 comments
Open

Spring Framework 6.1 - Add -parameters compiler flag if missing #467

nmck257 opened this issue Jan 2, 2024 · 0 comments
Labels
recipe Recipe requested

Comments

@nmck257
Copy link
Collaborator

nmck257 commented Jan 2, 2024

What problem are you trying to solve?

Spring Framework 6.1 made this change: https://github.com/spring-projects/spring-framework/wiki/Upgrading-to-Spring-Framework-6.x?secureweb=Teams#parameter-name-retention

Looking at the discussion behind that change (spring-projects/spring-framework#29531), it seems that the Spring Team expects that ~all Spring Framework apps are using the -parameters option already, by convention. And now in 6.1, many features break if the project is not using that compiler option.

What precondition(s) should be checked before applying this recipe?

  • Check that project is not using Spring Boot Starter Parent as a Maven Parent (or similar for Gradle), as this applies the relevant -parameters config already
    • Maybe transitively check the parent hierarchy for anything setting the -parameters option instead of hardcoding spring-boot-starter-parent
  • Check that the project doesn't already set -parameters in its own config

Describe the situation before applying the recipe

Describe the situation after applying the recipe

See the examples in the Spring Release Notes up above

Have you considered any alternatives or workarounds?

A collection of recipes could attempt to tweak source code to avoid using every feature which relies on parameter names (eg always explicitly give the name in every @PathVariable), but this would be a large scope and seems inconsistent with Spring conventions.

Any additional context

Are you interested in contributing this recipe to OpenRewrite?

Maybe; probably not in the short term

@nmck257 nmck257 added the recipe Recipe requested label Jan 2, 2024
@timtebeek timtebeek moved this to Recipes Wanted in OpenRewrite Jan 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
recipe Recipe requested
Projects
Status: Recipes Wanted
Development

No branches or pull requests

1 participant