Community
Participate
Working Groups
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?
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.
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.
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); } }
Created attachment 3911 [details] Screen capture of source and warning message
Created attachment 3912 [details] Screen capture of package explorer
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?
Created attachment 3914 [details] Options export I have changed a few compiler options from the defaults.
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.
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.
Fair enough. If I discover any more information, I'll post it. Thanks for trying.
Closed as WORKSFORME. Reopen if you get something new.