Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Improve the deprecation experience for ContentResultMatchersDsl.json #35544

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

Open
jtaub wants to merge 1 commit into spring-projects:main
base: main
Choose a base branch
Loading
from jtaub:main

Conversation

Copy link

@jtaub jtaub commented Sep 25, 2025

Problem Statement

It can be tedious to fix all of the deprecation warnings you get from using json(jsonContent, strict = true). It's not as easy as a find-and-replace, because it requires an import. Also, in my experience, an AI agent will be extremely likely to mess it up somehow (at least Copilot on a large project).

Solution

The Kotlin @Deprecation annotation has support for automatically replacing deprecated code with the new, supported code. I have modified the annotation on this method so that users can automatically upgrade.

Testing evidence

Here are some screenshots showing how this works in Intellij Idea:

  1. Original deprecated code.
Screenshot From 2025年09月25日 10-27-43
  1. The deprecation message now has a button you can click to replace the code.
Screenshot From 2025年09月25日 10-27-52
  1. After performing the automatic replacement. Note that the code compiles, but has a warning.
Screenshot From 2025年09月25日 10-28-05
  1. Intellij offers to automatically fix the warning. This can be applied to the entire file or project at once if there are multiple occurrences.
Screenshot From 2025年09月25日 10-28-18
  1. Done.
Screenshot From 2025年09月25日 10-28-29

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Sep 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
status: waiting-for-triage An issue we've not yet triaged or decided on
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /