private void createAbstractMethodInTargetClass(IMethod sourceMethod, CompilationUnit declaringCuNode, TypeDeclaration targetClass, TypeVariableMaplet[] mapping, ASTRewrite rewrite, IProgressMonitor pm, RefactoringStatus status) throws JavaModelException { MethodDeclaration methodDeclaration= ASTNodeSearchUtil.getMethodDeclarationNode(sourceMethod, declaringCuNode); AST ast= rewrite.getAST(); MethodDeclaration newMethod= ast.newMethodDeclaration(); newMethod.setBody(null); newMethod.setConstructor(false); newMethod.setExtraDimensions(methodDeclaration.getExtraDimensions()); newMethod.setJavadoc(null); newMethod.modifiers().addAll(ASTNodeFactory.newModifiers(ast, createModifiersForAbstractDeclaration(sourceMethod, pm, status))); newMethod.setName(createCopyOfSimpleName(methodDeclaration.getName(), ast)); copyReturnType(rewrite, getDeclaringCU(), methodDeclaration, newMethod, mapping); copyParameters(rewrite, getDeclaringCU(), methodDeclaration, newMethod, mapping); copyThrownExceptions(methodDeclaration, newMethod); ListRewrite list= rewrite.getListRewrite(targetClass, TypeDeclaration.BODY_DECLARATIONS_PROPERTY); list.insertAt(newMethod, ASTNodes.getInsertionIndex(newMethod, targetClass.bodyDeclarations()), null); // rewrite.getListRewrite(targetClass, TypeDeclaration.BODY_DECLARATIONS_PROPERTY).insertAt(newMethod, ASTNodes.getInsertionIndex(newMethod, targetClass.bodyDeclarations()), null); }