Deprecate methods in Java
(, en)
Methods (or elements) can be marked as deprecated with the @Deprecated
annotation in Java.
To make the work of your colleagues (or library users) easier, you can even go
a step futher and add Javadoc documentation so that IDEs, such as Intellij,
can suggest replacements methods:
public class MathUtil {
/**
* @deprecated
* use {@link MathUtil#newAndBetterSum(int, int)}
*/
@Deprecated
public static int sum(int a, int b) {
return a + b;
}
public static int newAndBetterSum(int a, int b) {
return a + b;
}
}