Community
Participate
Working Groups
This request refers to the compiler warning "Usage of deprecated API", which yields warnings like: The method <class>.<method>(<params>) overrides a deprecated method from <class>. While I consider this warning in principle very useful, there is one case where this warning IMHO is superfluous and annoying, because one can't do anything about it and that is the case if one is implementing an interface where that interface contains a method marked as deprecated. One HAS to implement that method (or else the interface is not fully implemented and the class simply does not compile), so that warning is unavoidable (unless of course one switches off that kind of warning, but then one is not warned when inadvertedly USING a deprecated method). So, in this particular case, the warning doesn't really help to avoid or spot a potential problem and thus I would prefer to get this warning ONLY if I am actually USING deprecated stuff (as the name of the option suggests...) not if I am *implementing* or *extending* a deprecated method, because that - as described - is usually unavoidable.
Trick: simply tag this method implementation as deprecated itself (which is actually a good idea anyway), then assuming you configure your setting to not complain about deprecation inside deprecated code, you should no longer see the offending warning. Ok to close ?
Closing.
Sorry, but I think this should NOT be closed. It does not seem to work as you describe. I have e.g. here a piece of code, that implements the javax.servlet.http.HttpServletResponse. The methods labeled as deprecated in the interface are here marked as deprecated as well (I just picked two methods here as examples, there are a couple more...) ---------------------- ... private class TestHttpServletResponse implements HttpServletResponse { ... // methods to implement HttpServletResponse: ... /** @deprecated */ public String encodeUrl(String url) { return url; } /** @deprecated */ public String encodeRedirectUrl(String url) { return url; } ... ---------------------- Furthermore, I have the compiler flasgs set as follows: "Usage of deprecated API" is set to Warning "Signal use of deprecated API inside deprecated code" is checked OFF And still, when I compile the above I get warnings for these (and all other) deprecated methods: Severity Description Resource In Folder Location Creation Time The method ConnectionDaemon.TestHttpServletResponse.encodeUrl(String) overrides a deprecated method from HttpServletResponse ConnectionDaemon.java wdosync/src/com/ibm/wdosync/connection_daemon line 302 23. Oktober 2003 15:01:23 The method ConnectionDaemon.TestHttpServletResponse.encodeRedirectUrl (String) overrides a deprecated method from HttpServletResponse ConnectionDaemon.java wdosync/src/com/ibm/wdosync/connection_daemon line 305 23. Oktober 2003 15:01:23 So, IMHO, this is NOT working as it should. I am using Eclipse 3.0.0 M4 (the build from Oct. 10th) on Windows 2000. Cheers, Michael ----------------- Dr. Michael Moser phone: +41 (0)1 724 85 39 IBM Zurich Research Laboratory fax : +41 (0)1 724 89 53 Säumerstr. 4 email: mmo@zurich.ibm.com CH-8803 Rüschlikon / Switzerland Notes: Michael Moser/Zurich/IBM@IBMCH
Cannot reproduce. I do not get any warning against following: /* (non-Javadoc) * @see HttpServletResponse#encodeRedirectUrl(String) */ /** @deprecated */ public String encodeRedirectUrl(String arg0) { // TODO Auto-generated method stub return null; } Please reopen with exact steps to reproduce.
From reporter: Very odd - when I just try to reproduce it here, these warnings were indeed gone! But on Friday - when I appended the below example - they were still there and would not go away (even though had set all flags as described and even after closing & restarting eclipse and after triggering "rebuild all" a couple of times). Well, let's hope they won't re-appear... ;-)
Closing
As of now 'LATER' and 'REMIND' resolutions are no longer supported. Please reopen this bug if it is still valid for you.