Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 167422

Summary: [quick fix] Quick fix for Exceptions not appropriate/doesn't work
Product: [Eclipse Project] JDT Reporter: Renny Barrett <rbarrett>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3    
Version: 3.2.1   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard: stalebug

Description Renny Barrett CLA 2006-12-11 09:31:45 EST
If I create the following 3 classes (each in their own file):

public abstract class MyBaseClass {
	public abstract void myMethod() throws Exception;
}

public interface MyInterface {
	public void myMethod();
}

public class MyImplementation extends MyBaseClass implements MyInterface {
	public void myMethod() throws Exception {
	}
}

...then the compile rightly shows that MyImplementation.myMethod is in error ("Exception Exception is not compatible with throws clause in MyInterface.myMethod()").

However, there are two quick fixes suggested:
- Add Exceptions to MyBaseClass.myMethod(), which is inappropriate as the base class's method already throws the Exception - if I choose this, the base class opens in an editor but nothing of significance happens; and
- Remove Exceptions from myMethod(), which is also ignored if I choose it.

Presumably the "remove" exceptions should work as described, and a more appropriate "add exception" message would be to add the exception to the interface, not the base class?
Comment 1 Eclipse Genie CLA 2020-04-23 00:53:16 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.