Author: bfitzpat
Date: 2011-04-11 11:45:10 -0400 (Mon, 11 Apr 2011)
New Revision: 30475
Modified:
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ImplementationClassCreationCommand.java
Log:
OPEN - issue JBIDE-8347: top down ws impl class should contain throws clause if it's
present in generated ws interface
https://issues.jboss.org/browse/JBIDE-8347
Modified:
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ImplementationClassCreationCommand.java
===================================================================
---
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ImplementationClassCreationCommand.java 2011-04-11
15:43:39 UTC (rev 30474)
+++
trunk/ws/plugins/org.jboss.tools.ws.creation.core/src/org/jboss/tools/ws/creation/core/commands/ImplementationClassCreationCommand.java 2011-04-11
15:45:10 UTC (rev 30475)
@@ -39,6 +39,7 @@
import org.eclipse.jdt.core.dom.MemberValuePair;
import org.eclipse.jdt.core.dom.MethodDeclaration;
import org.eclipse.jdt.core.dom.Modifier;
+import org.eclipse.jdt.core.dom.Name;
import org.eclipse.jdt.core.dom.NormalAnnotation;
import org.eclipse.jdt.core.dom.NumberLiteral;
import org.eclipse.jdt.core.dom.PackageDeclaration;
@@ -46,6 +47,7 @@
import org.eclipse.jdt.core.dom.PrimitiveType;
import org.eclipse.jdt.core.dom.QualifiedName;
import org.eclipse.jdt.core.dom.ReturnStatement;
+import org.eclipse.jdt.core.dom.SimpleName;
import org.eclipse.jdt.core.dom.SimpleType;
import org.eclipse.jdt.core.dom.SingleVariableDeclaration;
import org.eclipse.jdt.core.dom.StringLiteral;
@@ -198,6 +200,7 @@
protected void generateImplClass(ICompilationUnit service)
throws CoreException, BadLocationException {
ASTParser astp = ASTParser.newParser(AST.JLS3);
+ astp.setKind(ASTParser.K_COMPILATION_UNIT);
astp.setSource(service);
CompilationUnit cu = (CompilationUnit) astp.createAST(null);
IPackageFragment pack = getImplPakcage();
@@ -416,8 +419,18 @@
Type sType = copyTypeFromOtherASTNode(ast, inMethod.getReturnType2());
md.setReturnType2(sType);
-
+
@SuppressWarnings("rawtypes")
+ List thrownExceptions = inMethod.thrownExceptions();
+ for (Object obj : thrownExceptions) {
+ if (obj instanceof SimpleName) {
+ SimpleName sname = (SimpleName) obj;
+ Name newName = ast.newName(sname.getFullyQualifiedName());
+ md.thrownExceptions().add(newName);
+ }
+ }
+
+ @SuppressWarnings("rawtypes")
List parameters = inMethod.parameters();
for (Object obj : parameters) {
@@ -429,7 +442,7 @@
implSvd.setType(copyTypeFromOtherASTNode(ast, svd.getType()));
md.parameters().add(implSvd);
}
-
+
// create method body
Block block = ast.newBlock();
// add log info statement