Bug 45398 - Implementing deprecated methods should NOT yield a depracted warning
Summary: Implementing deprecated methods should NOT yield a depracted warning
Status: CLOSED INVALID
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.0   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 3.0 M5   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: needinfo
Depends on:
Blocks:
 
Reported: 2003-10-22 13:27 EDT by Michael Moser CLA
Modified: 2009-08-30 02:06 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Moser CLA 2003-10-22 13:27:36 EDT
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.
Comment 1 Philipe Mulet CLA 2003-10-22 15:30:50 EDT
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 ?
Comment 2 Philipe Mulet CLA 2003-10-23 09:43:37 EDT
Closing.
Comment 3 Michael Moser CLA 2003-10-24 11:50:48 EDT
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

Comment 4 Philipe Mulet CLA 2003-10-28 05:03:00 EST
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.
Comment 5 Philipe Mulet CLA 2003-10-28 05:25:51 EST
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... ;-)
Comment 6 Philipe Mulet CLA 2003-10-28 05:26:14 EST
Closing
Comment 7 Denis Roy CLA 2009-08-30 02:06:12 EDT
As of now 'LATER' and 'REMIND' resolutions are no longer supported.
Please reopen this bug if it is still valid for you.