Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@jtaub
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
@rstoyanchev rstoyanchev added the in: test Issues in the test module label Nov 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in: test Issues in the test module 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.

3 participants