Bug 38089 Suggest 'Add exception to supertype' when overriden method has more exceptions than superclass [quick assist]
If I have the two classes: public class A { public void method() { } } public class B extends A { public void method() throws Wobbly { } } then I (obviously) get a compile time error. However, it would be useful if the suggestion list (currently empty) could add options o Add exception to superclass implementation o Surround internally with try/catch You would then end up with (either): public class A { public void method() throws Wobbly { } } public class B extends A { public void method() throws Wobbly { } } or public class A { public void method() { } } public class B extends A { public void method() { try { } catch (Wobbly w) { // use uncaught exception code generation } } } Both would be useful options, but I'd recommend that adding an exception to the superclass' implementation is the preferred one of the two, in much the same way that the preferred unhandled exception is to declare a throws rather than a try/catch
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/QuickFixProcessor.java
LocalCorrectionsSubProcessor.addConstructorFromSuperclassProposal(context, problem, proposals);
				break;
			case IProblem.UnusedPrivateMethod:
			case IProblem.UnusedPrivateConstructor:
			case IProblem.UnusedPrivateField:
			case IProblem.UnusedPrivateType:
			case IProblem.LocalVariableIsNeverUsed:
			case IProblem.ArgumentIsNeverUsed:			
				LocalCorrectionsSubProcessor.addUnusedMemberProposal(context, problem, proposals);
				break;
			case IProblem.NeedToEmulateFieldReadAccess:
			case IProblem.NeedToEmulateFieldWriteAccess:
			case IProblem.NeedToEmulateMethodAccess:
			case IProblem.NeedToEmulateConstructorAccess:
				ModifierCorrectionSubProcessor.addNonAccessibleReferenceProposal(context, problem, proposals, ModifierCorrectionSubProcessor.TO_NON_PRIVATE, 5);
				break;
			case IProblem.SuperfluousSemicolon:
				LocalCorrectionsSubProcessor.addSuperfluousSemicolonProposal(context, problem, proposals);
				break;
			case IProblem.UnnecessaryCast:
			case IProblem.UnnecessaryArgumentCast:
				LocalCorrectionsSubProcessor.addUnnecessaryCastProposal(context, problem, proposals);
				break;
			case IProblem.UnnecessaryInstanceof:	
				LocalCorrectionsSubProcessor.addUnnecessaryInstanceofProposal(context, problem, proposals);
				break;
			case IProblem.UnusedMethodDeclaredThrownException:
			case IProblem.UnusedConstructorDeclaredThrownException:
				LocalCorrectionsSubProcessor.addUnnecessaryThrownExceptionProposal(context, problem, proposals);
				break;