openrewrite / openrewrite/rewrite-spring

`ImplicitWebAnnotationNames` removes `@RequestParam` argument even when `-parameters` is missing

Open
#736 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Java
Stars
403
Forks
149
Avg merge
2h 33m
Merged PRs (30d)
10

Description

After running the spring boot 3.4 migration some Spring @RequestParam annotations had their arguments removed, which caused IllegalStateException during a subsequent test pass.

So in a function like:

@GetMapping
String foo(@RequestParam("a") String a) { ...}

Some part of the migration was changing it to:

@GetMapping
String foo(@RequestParam String a) { ...}

This would be fine if the compiler configuration included the -parameters argument, but it didn't, so this change is erroneous.

The recipe responsible is org.openrewrite.java.spring.ImplicitWebAnnotationNames. In the short term I'm going to remove it from spring boot best practices. Ideally it would be fixed to only make its change if -parameters is part of the compiler configuration.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the org.openrewrite.java.spring.ImplicitWebAnnotationNames recipe and trace how it determines whether @RequestParam arguments can be omitted. Confirm how the compiler configuration exposes -parameters, then add coverage showing that explicit arguments are preserved when it is absent and run the recipe's relevant tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.