diff --git a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/implementmethod/ImplementMethodRefactoringTest.java b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/implementmethod/ImplementMethodRefactoringTest.java old mode 100644 new mode 100755 index 9071317e29f..9233b1798d8 --- a/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/implementmethod/ImplementMethodRefactoringTest.java +++ b/core/org.eclipse.cdt.ui.tests/ui/org/eclipse/cdt/ui/tests/refactoring/implementmethod/ImplementMethodRefactoringTest.java @@ -788,4 +788,37 @@ public class ImplementMethodRefactoringTest extends RefactoringTestBase { public void testExplicitConstructor_Bug363111() throws Exception { assertRefactoringSuccess(); } + + //A.h + // + //class TestClass { + //public: + // /*$*/void foo() throw ();/*$$*/ + //}; + // + + //A.cpp + //==================== + //void TestClass::foo() throw () { + //} + public void testEmptyThowsClause_Bug393833() throws Exception { + assertRefactoringSuccess(); + } + + //A.h + // + //class TestClass { + //public: + // /*$*/void foo() throw (TestClass);/*$$*/ + //}; + // + + //A.cpp + //==================== + //void TestClass::foo() throw (TestClass) { + //} + public void testNonEmptyThowsClause_Bug393833() throws Exception { + assertRefactoringSuccess(); + } + } diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/implementmethod/ImplementMethodRefactoring.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/implementmethod/ImplementMethodRefactoring.java old mode 100644 new mode 100755 index 0fef24d8eee..5385fd8fabc --- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/implementmethod/ImplementMethodRefactoring.java +++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/refactoring/implementmethod/ImplementMethodRefactoring.java @@ -38,6 +38,7 @@ import org.eclipse.cdt.core.dom.ast.IASTFunctionDeclarator; import org.eclipse.cdt.core.dom.ast.IASTFunctionDefinition; import org.eclipse.cdt.core.dom.ast.IASTName; import org.eclipse.cdt.core.dom.ast.IASTNode; +import org.eclipse.cdt.core.dom.ast.IASTTypeId; import org.eclipse.cdt.core.dom.ast.IASTNode.CopyStyle; import org.eclipse.cdt.core.dom.ast.IASTPointerOperator; import org.eclipse.cdt.core.dom.ast.IASTSimpleDeclaration; @@ -266,7 +267,13 @@ public class ImplementMethodRefactoring extends CRefactoring { for (IASTPointerOperator pop : functionDeclarator.getPointerOperators()) { createdMethodDeclarator.addPointerOperator(pop.copy(CopyStyle.withLocations)); } - + IASTTypeId[] exceptionSpecification = functionDeclarator.getExceptionSpecification(); + if (exceptionSpecification != ICPPASTFunctionDeclarator.NO_EXCEPTION_SPECIFICATION) { + createdMethodDeclarator.setEmptyExceptionSpecification(); + for (IASTTypeId typeId : exceptionSpecification) { + createdMethodDeclarator.addExceptionSpecificationTypeId(typeId == null ? null : typeId.copy(CopyStyle.withLocations)); + } + } IASTFunctionDefinition functionDefinition = nodeFactory.newFunctionDefinition(declSpecifier, createdMethodDeclarator, nodeFactory.newCompoundStatement()); functionDefinition.setParent(unit);