Usually when I want to remove a method and I don't have access to all the client code easily, I start by putting the @depreacted javadoc tag like this:
/**
* blablabla.
*
* @deprecated use foo.bar.MyClass#method instead
*/
public void oldMethod() {}
I try to give a clue of what should be use instead of this method to help my fellow developers.
I wanted to do the same but with the new
@Deprecated annotation But you can't pass a string to it!
I couldn't believe it, just adding a simple string parameter... and I'm not
the only one:
Is the @Deprecated annotation more useful than @Override? I think not. The annotation doesn't support any arguments, so unlike the Javadoc tag you can't provide a string to explain the deprecation and recommend an alternative method to use. The @Deprecated annotation actually provides less value than the @deprecated tag. The only advantage with the annotation is that you can programatically detect deprecated items at runtime. For that reason, conventional wisdom says to use both the @deprecated tag and the @Deprecated annotation, one for documentation and the other for runtime reflection.
Ok the @Depreacted annotation will be pick up by any compiler whereas the javadoc tag will only be pick by modern/intelligent IDE (but most people use eclipse so this point is not really important)
Adding twice the same info (deprecated) is a leap backward to me :(