diff options
| author | Manoj Palat | 2013-02-08 16:19:33 +0000 |
|---|---|---|
| committer | Markus Keller | 2013-02-08 16:19:33 +0000 |
| commit | d22cc5d84178d171847e96f4fb5b97fb98c95448 (patch) | |
| tree | e9d007c3686b3318c0e5d07ffc586574d39fa441 | |
| parent | efe090f6261554948e74283c11a7aa9dc9b10357 (diff) | |
| download | eclipse.jdt.core-d22cc5d84178d171847e96f4fb5b97fb98c95448.tar.gz eclipse.jdt.core-d22cc5d84178d171847e96f4fb5b97fb98c95448.tar.xz eclipse.jdt.core-d22cc5d84178d171847e96f4fb5b97fb98c95448.zip | |
Bug 395658: [1.8][ast rewrite] MethodDeclaration's thrown exceptions
should be Types and not Names.
2 files changed, 8 insertions, 3 deletions
diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteAnalyzer.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteAnalyzer.java index 26b723d4fe..892c06850b 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteAnalyzer.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteAnalyzer.java @@ -1853,7 +1853,8 @@ public final class ASTRewriteAnalyzer extends ASTVisitor { int extraDims= rewriteExtraDimensions(node, INTERNAL_METHOD_EXTRA_DIMENSIONS_PROPERTY, pos); - boolean hasExceptionChanges= isChanged(node, MethodDeclaration.THROWN_EXCEPTIONS_PROPERTY); + ChildListPropertyDescriptor exceptionsProperty = node.getAST().apiLevel() < AST.JLS8 ? MethodDeclaration.THROWN_EXCEPTIONS_PROPERTY : MethodDeclaration.THROWN_EXCEPTION_TYPES_PROPERTY; + boolean hasExceptionChanges= isChanged(node, exceptionsProperty); int bodyChangeKind= getChangeKind(node, MethodDeclaration.BODY_PROPERTY); @@ -1865,7 +1866,8 @@ public final class ASTRewriteAnalyzer extends ASTVisitor { } } - pos= rewriteNodeList(node, MethodDeclaration.THROWN_EXCEPTIONS_PROPERTY, pos, " throws ", ", "); //$NON-NLS-1$ //$NON-NLS-2$ + pos= rewriteNodeList(node, exceptionsProperty, pos, " throws ", ", "); //$NON-NLS-1$ //$NON-NLS-2$ + rewriteMethodBody(node, pos); } catch (CoreException e) { // ignore diff --git a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteFlattener.java b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteFlattener.java index fca95726a1..ed521d1372 100644 --- a/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteFlattener.java +++ b/org.eclipse.jdt.core/dom/org/eclipse/jdt/internal/core/dom/rewrite/ASTRewriteFlattener.java @@ -645,7 +645,10 @@ public class ASTRewriteFlattener extends ASTVisitor { for (int i = 0; i < extraDims; i++) { this.result.append("[]"); //$NON-NLS-1$ } - visitList(node, MethodDeclaration.THROWN_EXCEPTIONS_PROPERTY, String.valueOf(','), " throws ", Util.EMPTY_STRING); //$NON-NLS-1$ + + ChildListPropertyDescriptor exceptionsProperty = node.getAST().apiLevel() < AST.JLS8 ? + MethodDeclaration.THROWN_EXCEPTIONS_PROPERTY : MethodDeclaration.THROWN_EXCEPTION_TYPES_PROPERTY; + visitList(node, exceptionsProperty, String.valueOf(','), " throws ", Util.EMPTY_STRING); //$NON-NLS-1$ ASTNode body= getChildNode(node, MethodDeclaration.BODY_PROPERTY); if (body == null) { this.result.append(';'); |
