Bug 34029 - "False-positive" deprecated warning
Summary: "False-positive" deprecated warning
Status: RESOLVED WORKSFORME
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 2.1   Edit
Hardware: PC Windows XP
: P3 minor (vote)
Target Milestone: 2.1 RC3   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-03-06 17:16 EST by James Fleming CLA
Modified: 2003-03-13 09:47 EST (History)
0 users

See Also:


Attachments
Screen capture of source and warning message (190.08 KB, image/jpeg)
2003-03-07 12:23 EST, James Fleming CLA
no flags Details
Screen capture of package explorer (201.10 KB, image/jpeg)
2003-03-07 12:25 EST, James Fleming CLA
no flags Details
Options export (11.63 KB, application/octet-stream)
2003-03-07 13:19 EST, James Fleming CLA
no flags Details
Exported project (1.81 KB, application/octet-stream)
2003-03-07 13:22 EST, James Fleming CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description James Fleming CLA 2003-03-06 17:16:42 EST
Eclipse is telling me that my method is overriding a deprecated method, but it 
is not.  However, the method name IS overloaded, and some of the other methods 
with the same name ARE deprecated.  Here are the details:

My method declaration:
public ActionForward perform(ActionMapping mapping, ActionForm form, 
HttpServletRequest request, HttpServletResponse response) throws IOException, 
ServletException

The warning message:
"The method IsogisAction.perform(ActionMapping, ActionForm, 
HttpServletRequest, HttpServletResponse) overrides a deprecated method from 
Action"

From the Struts javadoc:
- ActionForward perform(ActionMapping mapping, ActionForm form, 
javax.servlet.http.HttpServletRequest request, 
javax.servlet.http.HttpServletResponse response) 

- ActionForward perform(ActionMapping mapping, ActionForm form, 
javax.servlet.ServletRequest request, javax.servlet.ServletResponse response) 

- ActionForward perform(ActionServlet servlet, ActionMapping mapping, 
ActionForm form, javax.servlet.http.HttpServletRequest request, 
javax.servlet.http.HttpServletResponse response) (DEPRECATED)

- ActionForward perform(ActionServlet servlet, ActionMapping mapping, 
ActionForm form, javax.servlet.ServletRequest request, 
javax.servlet.ServletResponse response) (DEPRECATED)

According to the javadoc, the method I am overriding is not deprecated.  
However, there are other methods with the same name but different parameters 
that ARE deprecated.  Perhaps Eclipse is getting confused here?
Comment 1 Philipe Mulet CLA 2003-03-06 17:36:22 EST
Maybe indeed. Could you please provide a testcase reproducing this issue ? Did 
you also check whether the declaring class of the overriden method was 
deprecated itself ? If so, then it would be propagated to its methods for free.
Comment 2 Olivier Thomann CLA 2003-03-07 11:00:26 EST
Using 0306 build, I wrote the following class:

package p1;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

public class B extends Action {

	public ActionForward perform(
		ActionMapping arg0,
		ActionForm arg1,
		HttpServletRequest arg2,
		HttpServletResponse arg3)
		throws IOException, ServletException {
		return super.perform(arg0, arg1, arg2, arg3);
	}
}

using struts 1.0.2 libraries and I don't get any error for deprecation. I set
the deprecation level to error.
Could you please specify what build you are using, struts library version and a
small test case that exhibits the problem?

Thanks.
Comment 3 James Fleming CLA 2003-03-07 12:22:07 EST
I'm using the following build of Eclipse:

Version: 2.1.0
Build id: 200302211557

Also with Struts 1.0.2 libraries.

I also created a test class, and did NOT receive the warning message.  
However, I then tried to rename the class (just by changing the declaration, 
oops!) and got the error that the class must be in its own file (because my 
file was called TestClass.java).  I changed the declaration back to TestClass, 
and saved the file, and now the warning is showing up again.  Here is the 
source:

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

/*
 * Created on 7-Mar-03
 *
 * To change this generated comment go to 
 * Window>Preferences>Java>Code Generation>Code and Comments
 */
/**
 * @author jamesf
 *
 * To change this generated comment go to 
 * Window>Preferences>Java>Code Generation>Code and Comments
 */
public class TestClass extends Action
{
	public ActionForward perform(
			ActionMapping arg0,
			ActionForm arg1,
			HttpServletRequest arg2,
			HttpServletResponse arg3)
			throws IOException, ServletException {
			return super.perform(arg0, arg1, arg2, arg3);
		}

}


Comment 4 James Fleming CLA 2003-03-07 12:23:46 EST
Created attachment 3911 [details]
Screen capture of source and warning message
Comment 5 James Fleming CLA 2003-03-07 12:25:34 EST
Created attachment 3912 [details]
Screen capture of package explorer
Comment 6 Olivier Thomann CLA 2003-03-07 12:45:11 EST
I still cannot reproduce the problem. Your build is RC1.
I took RC1.
1) Start Eclipse with a new workspace (default options unchanged).
2) Create a new Java Project P
3) Add struts.jar and jsdk23.jar in the classpath of P.
4) Create a new class in the default package using your class TestClass.
5) In the editor, I changed TestClass for G.
6) Got an error because the class G is not defined in its own source file.
7) Change it back to TestClass and I got no warning for deprecation.

I can see that you get it, but I cannot reproduce it. I really don't see what I
missed.
Are you using the default compiler options?
Comment 7 James Fleming CLA 2003-03-07 13:19:05 EST
Created attachment 3914 [details]
Options export

I have changed a few compiler options from the defaults.
Comment 8 James Fleming CLA 2003-03-07 13:22:28 EST
Created attachment 3915 [details]
Exported project

This is the test project.  This is the one where the warning didn't show up
until I had generated an error and then fixed the error.  In my "real" project,
where I first saw this problem, I'm not sure exactly when it showed up, whether
it was there all along or not.	I imported the project into Eclipse after using
Visual Age for the past year or so.  Maybe I have done something wrong in my
migration from Visual Age to Eclipse?  I guess that wouldn't explain why I also
am seeing the problem in my "TestProject", though.
Comment 9 Olivier Thomann CLA 2003-03-07 16:57:06 EST
Using your project and your options files, I could not reproduce the problem
after I corrected my classpath variable to point to the libraries on my machine.
So I really don't know what is going on with your build. Impossible to reproduce
for now.
Comment 10 James Fleming CLA 2003-03-07 17:24:26 EST
Fair enough.  If I discover any more information, I'll post it.  Thanks for 
trying.
Comment 11 Olivier Thomann CLA 2003-03-13 09:47:52 EST
Closed as WORKSFORME.
Reopen if you get something new.