There is that
@Deprecated annotation which suits well for Java libraries.
A minor release change would not break an existing code if a deprecated library method remains. The library compilation will not report deprecated code use warnings because the library itself does not call its own deprecated methods.
But what if the deprecated method is in a monolithic server class code, where a highly reused code migration is a slow process executed by a number of developers sequentially?
Let us say, we have an original method that is used in multiple parts of server code for multiple clients and one day we come up with a decision to introduce a new method to replace it. But there will still remain some uses of the original method in our server code because the code migration is a long incremental process.
Should we mark the original method with the
@Deprecated annotation immediately?
The pros are that future implementations will avoid using it because the method is marked with the annotation and thus with strikethrough line style in IDE.
The cons are that remaining implementations also become marked with strikethrough line style as well, and the Java compiler reports warnings about the remaining uses, until all of the assigned developers update their respective parts of the monolithic code to get rid of using the deprecated method.
So, what would be the best method deprecation approach for a monolithic application with slow code migration process?