Bug 31554 QuickFix Add catch clause to surrounding try in catch clause incorrect [code manipulation] [refactoring]
With the following code in the editor: try{ someMethod(); //throws SomeException }catch(SomeException e){ someOtherMethod(); //throws SomeException } You will get a QuickFix that suggests to add a catch clause to the surrounding try. There is no surrounding try. It will add another catch(SomeException e) to the try clause above! This catch clause is unreachable (which the editor notices). The exception is still uncaught (which the editor doesn't notice). Build: 2.1-M5
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/correction/LocalCorrectionsSubProcessor.java
if (selectedNode.getNodeType() == ASTNode.BLOCK && selectedNode.getParent().getNodeType() == ASTNode.CATCH_CLAUSE ) {
			CatchClause clause= (CatchClause) selectedNode.getParent();
			TryStatement tryStatement= (TryStatement) clause.getParent();
			ASTRewrite rewrite= new ASTRewrite(tryStatement.getParent());
			
			if (tryStatement.catchClauses().size() > 1 || tryStatement.getFinally() != null) {
				rewrite.markAsRemoved(clause);
			} else {
				List statements= tryStatement.getBody().statements();
				if (statements.size() > 0) {
					ASTNode placeholder= rewrite.createCopy((ASTNode) statements.get(0), (ASTNode) statements.get(statements.size() - 1));
					rewrite.markAsReplaced(tryStatement, placeholder);
				} else {
					rewrite.markAsRemoved(tryStatement);
				}
			}
			String label= CorrectionMessages.getString("LocalCorrectionsSubProcessor.removecatchclause.description"); 
			Image image= JavaPluginImages.get(JavaPluginImages.IMG_OBJS_EXCEPTION);
			ASTRewriteCorrectionProposal proposal= new ASTRewriteCorrectionProposal(label, cu, rewrite, 6, image);
			proposal.ensureNoModifications();
			proposals.add(proposal);
		}
	}	
	
	public static void addNLSProposals(ICorrectionContext context, List proposals) throws CoreException {
		final ICompilationUnit cu= context.getCompilationUnit();
		String name= CorrectionMessages.getString("LocalCorrectionsSubProcessor.externalizestrings.description"); 
		
		ChangeCorrectionProposal proposal= new ChangeCorrectionProposal(name, null, 0) {