private MethodDeclaration createNewMethodDeclarationNode(MemberActionInfo info, TypeVariableMaplet[] mapping, CompilationUnitRewrite rewriter, MethodDeclaration oldMethod) throws JavaModelException { Assert.isTrue(!info.isFieldInfo()); IMethod method= (IMethod) info.getMember(); ASTRewrite rewrite= rewriter.getASTRewrite(); AST ast= rewrite.getAST(); MethodDeclaration newMethod= ast.newMethodDeclaration(); copyBodyOfPushedDownMethod(rewrite, method, oldMethod, newMethod, mapping); newMethod.setConstructor(oldMethod.isConstructor()); copyExtraDimensions(oldMethod, newMethod); if (info.copyJavadocToCopiesInSubclasses()) copyJavadocNode(rewrite, oldMethod, newMethod); final IJavaProject project= rewriter.getCu().getJavaProject(); if (info.isNewMethodToBeDeclaredAbstract() && JavaModelUtil.is50OrHigher(project) && JavaPreferencesSettings.getCodeGenerationSettings(project).overrideAnnotation) { final MarkerAnnotation annotation= ast.newMarkerAnnotation(); annotation.setTypeName(ast.newSimpleName("Override")); //$NON-NLS-1$ newMethod.modifiers().add(annotation); } copyAnnotations(oldMethod, newMethod); newMethod.modifiers().addAll(ASTNodeFactory.newModifiers(ast, info.getNewModifiersForCopyInSubclass(oldMethod.getModifiers()))); newMethod.setName(ast.newSimpleName(oldMethod.getName().getIdentifier())); copyReturnType(rewrite, method.getCompilationUnit(), oldMethod, newMethod, mapping); copyParameters(rewrite, method.getCompilationUnit(), oldMethod, newMethod, mapping); copyThrownExceptions(oldMethod, newMethod); copyTypeParameters(oldMethod, newMethod); return newMethod; }
private MethodDeclaration createNewMethodDeclarationNode(MemberActionInfo info, TypeVariableMaplet[] mapping, CompilationUnitRewrite rewriter, MethodDeclaration oldMethod) throws JavaModelException { Assert.isTrue(!info.isFieldInfo()); IMethod method= (IMethod) info.getMember(); ASTRewrite rewrite= rewriter.getASTRewrite(); AST ast= rewrite.getAST(); MethodDeclaration newMethod= ast.newMethodDeclaration(); copyBodyOfPushedDownMethod(rewrite, method, oldMethod, newMethod, mapping); newMethod.setConstructor(oldMethod.isConstructor()); copyExtraDimensions(oldMethod, newMethod); if (info.copyJavadocToCopiesInSubclasses()) copyJavadocNode(rewrite, oldMethod, newMethod); final IJavaProject project= rewriter.getCu().getJavaProject(); if (info.isNewMethodToBeDeclaredAbstract() && JavaModelUtil.is50OrHigher(project) && JavaPreferencesSettings.getCodeGenerationSettings(project).overrideAnnotation) { final MarkerAnnotation annotation= ast.newMarkerAnnotation(); annotation.setTypeName(ast.newSimpleName("Override")); //$NON-NLS-1$ newMethod.modifiers().add(annotation); } copyAnnotations(oldMethod, newMethod); newMethod.modifiers().addAll(ASTNodeFactory.newModifiers(ast, info.getNewModifiersForCopyInSubclass(oldMethod.getModifiers()))); newMethod.setName(ast.newSimpleName(oldMethod.getName().getIdentifier())); copyReturnType(rewrite, method.getCompilationUnit(), oldMethod, newMethod, mapping); copyParameters(rewrite, method.getCompilationUnit(), oldMethod, newMethod, mapping); copyThrownExceptions(oldMethod, newMethod); copyTypeParameters(oldMethod, newMethod); return newMethod; }
private MethodDeclaration createNewMethodDeclarationNode(MemberActionInfo info, CompilationUnit declaringCuNode, TypeVariableMaplet[] mapping, CompilationUnitRewrite rewriter, MethodDeclaration oldMethod) throws JavaModelException { Assert.isTrue(!info.isFieldInfo()); IMethod method= (IMethod) info.getMember(); ASTRewrite rewrite= rewriter.getASTRewrite(); AST ast= rewrite.getAST(); MethodDeclaration newMethod= ast.newMethodDeclaration(); copyBodyOfPushedDownMethod(rewrite, method, oldMethod, newMethod, mapping); newMethod.setConstructor(oldMethod.isConstructor()); newMethod.setExtraDimensions(oldMethod.getExtraDimensions()); if (info.copyJavadocToCopiesInSubclasses()) copyJavadocNode(rewrite, method, oldMethod, newMethod); final IJavaProject project= rewriter.getCu().getJavaProject(); if (info.isNewMethodToBeDeclaredAbstract() && JavaModelUtil.is50OrHigher(project) && JavaPreferencesSettings.getCodeGenerationSettings(project).overrideAnnotation) { final MarkerAnnotation annotation= ast.newMarkerAnnotation(); annotation.setTypeName(ast.newSimpleName("Override")); //$NON-NLS-1$ newMethod.modifiers().add(annotation); } copyAnnotations(oldMethod, newMethod); newMethod.modifiers().addAll(ASTNodeFactory.newModifiers(ast, info.getNewModifiersForCopyInSubclass(oldMethod.getModifiers()))); newMethod.setName(ast.newSimpleName(oldMethod.getName().getIdentifier())); copyReturnType(rewrite, method.getCompilationUnit(), oldMethod, newMethod, mapping); copyParameters(rewrite, method.getCompilationUnit(), oldMethod, newMethod, mapping); copyThrownExceptions(oldMethod, newMethod); copyTypeParameters(oldMethod, newMethod); return newMethod; }