Community
Participate
Working Groups
The compiler needs to make a distinction between implemented methods and overridden methods regarding the "overrides a deprecated method" warning. The warning should not be generated when a deprecated method for a non-deprecated interface is being implemented, and no concrete implementation is actually overridden (For example, providing an implementation of java.sql.ResultSet for testing).
*** Bug 41567 has been marked as a duplicate of this bug. ***
The trick is to tag the implementation as deprecated itself, then we will no complaint (when complain in deprecated code is turned off).
That only works if the implementation is not intended to be used by anyone else, but just for something like, as in my example, testing. If the implementation is meant to be used within an application, marking it as deprecated will most likely cause it not to be used at all, and result in questions from other developers as to where the correct implementation is.
I just tried the trick you suggested, and this doesn't work either. Now I get a slew of warnings about both the type and the constructor being deprecated. This is happening with the "Signal use of deprecated API inside deprecated code" compiler preference unchecked.
Responding to comment #3, I would say that it is probably a good idea to carry the deprecation tag anyway on the implementation, since this is useful information to retain anyway.
Remember to tag the implementation as deprecated using a javadoc comment. I checked it works ok then.
Okay, I think we can close this bug. I misunderstood what you meant by "implementation". I thought you meant the entire class, not just the methods in question. It turns out these methods had non-JavaDoc comments (since the default code generation comment template specifies non-JavaDoc comments for some odd reason). After changing these to JavaDoc comments and adding the @deprecated tag to them, the warnings went away.
Glad it works now. Closing
New Gerrit change created: https://git.eclipse.org/r/41488