Example usage for org.eclipse.jdt.core.dom MethodDeclaration isConstructor

List of usage examples for org.eclipse.jdt.core.dom MethodDeclaration isConstructor

Introduction

In this page you can find the example usage for org.eclipse.jdt.core.dom MethodDeclaration isConstructor.

Prototype

boolean isConstructor

To view the source code for org.eclipse.jdt.core.dom MethodDeclaration isConstructor.

Click Source Link

Document

true for a constructor, false for a method.

Usage

From source file:at.bestsolution.fxide.jdt.corext.dom.ASTFlattener.java

License:Open Source License

@Override
public boolean visit(MethodDeclaration node) {
    if (node.getJavadoc() != null) {
        node.getJavadoc().accept(this);
    }// w ww.  jav  a 2s  .co m
    if (node.getAST().apiLevel() >= JLS3) {
        printModifiers(node.modifiers());
        if (!node.typeParameters().isEmpty()) {
            this.fBuffer.append("<");//$NON-NLS-1$
            for (Iterator<TypeParameter> it = node.typeParameters().iterator(); it.hasNext();) {
                TypeParameter t = it.next();
                t.accept(this);
                if (it.hasNext()) {
                    this.fBuffer.append(", ");//$NON-NLS-1$
                }
            }
            this.fBuffer.append("> ");//$NON-NLS-1$
        }
    }
    if (!node.isConstructor()) {
        if (node.getReturnType2() != null) {
            node.getReturnType2().accept(this);
        } else {
            // methods really ought to have a return type
            this.fBuffer.append("void");//$NON-NLS-1$
        }
        this.fBuffer.append(" ");//$NON-NLS-1$
    }
    node.getName().accept(this);
    this.fBuffer.append("(");//$NON-NLS-1$
    if (node.getAST().apiLevel() >= AST.JLS8) {
        Type receiverType = node.getReceiverType();
        if (receiverType != null) {
            receiverType.accept(this);
            this.fBuffer.append(' ');
            SimpleName qualifier = node.getReceiverQualifier();
            if (qualifier != null) {
                qualifier.accept(this);
                this.fBuffer.append('.');
            }
            this.fBuffer.append("this"); //$NON-NLS-1$
            if (node.parameters().size() > 0) {
                this.fBuffer.append(',');
            }
        }
    }
    for (Iterator<SingleVariableDeclaration> it = node.parameters().iterator(); it.hasNext();) {
        SingleVariableDeclaration v = it.next();
        v.accept(this);
        if (it.hasNext()) {
            this.fBuffer.append(", ");//$NON-NLS-1$
        }
    }
    this.fBuffer.append(")");//$NON-NLS-1$
    if (node.getAST().apiLevel() >= AST.JLS8) {
        List<Dimension> dimensions = node.extraDimensions();
        for (Iterator<Dimension> it = dimensions.iterator(); it.hasNext();) {
            Dimension e = it.next();
            e.accept(this);
        }
    } else {
        for (int i = 0; i < node.getExtraDimensions(); i++) {
            this.fBuffer.append("[]"); //$NON-NLS-1$
        }
    }
    List<? extends ASTNode> thrownExceptions = node.getAST().apiLevel() >= AST.JLS8
            ? node.thrownExceptionTypes()
            : getThrownExceptions(node);
    if (!thrownExceptions.isEmpty()) {
        this.fBuffer.append(" throws ");//$NON-NLS-1$
        for (Iterator<? extends ASTNode> it = thrownExceptions.iterator(); it.hasNext();) {
            ASTNode n = it.next();
            n.accept(this);
            if (it.hasNext()) {
                this.fBuffer.append(", ");//$NON-NLS-1$
            }
        }
        this.fBuffer.append(" ");//$NON-NLS-1$
    }
    if (node.getBody() == null) {
        this.fBuffer.append(";");//$NON-NLS-1$
    } else {
        node.getBody().accept(this);
    }
    return false;
}

From source file:boa.datagen.util.Java7Visitor.java

License:Apache License

@Override
public boolean visit(MethodDeclaration node) {
    List<boa.types.Ast.Method> list = methods.peek();
    Method.Builder b = Method.newBuilder();
    //      b.setPosition(pos.build());
    if (node.isConstructor())
        b.setName("<init>");
    else/*from   ww w  .  ja  va  2s  .c  o m*/
        b.setName(node.getName().getFullyQualifiedName());
    for (Object m : node.modifiers()) {
        if (((IExtendedModifier) m).isAnnotation())
            ((Annotation) m).accept(this);
        else
            ((org.eclipse.jdt.core.dom.Modifier) m).accept(this);
        b.addModifiers(modifiers.pop());
    }
    boa.types.Ast.Type.Builder tb = boa.types.Ast.Type.newBuilder();
    if (node.getReturnType2() != null) {
        String name = typeName(node.getReturnType2());
        for (int i = 0; i < node.getExtraDimensions(); i++)
            name += "[]";
        tb.setName(getIndex(name));
        tb.setKind(boa.types.Ast.TypeKind.OTHER);
        b.setReturnType(tb.build());
    } else {
        tb.setName(getIndex("void"));
        tb.setKind(boa.types.Ast.TypeKind.OTHER);
        b.setReturnType(tb.build());
    }
    for (Object t : node.typeParameters()) {
        boa.types.Ast.Type.Builder tp = boa.types.Ast.Type.newBuilder();
        String name = ((TypeParameter) t).getName().getFullyQualifiedName();
        String bounds = "";
        for (Object o : ((TypeParameter) t).typeBounds()) {
            if (bounds.length() > 0)
                bounds += " & ";
            bounds += typeName((org.eclipse.jdt.core.dom.Type) o);
        }
        if (bounds.length() > 0)
            name = name + " extends " + bounds;
        tp.setName(getIndex(name));
        tp.setKind(boa.types.Ast.TypeKind.GENERIC);
        b.addGenericParameters(tp.build());
    }
    for (Object o : node.parameters()) {
        SingleVariableDeclaration ex = (SingleVariableDeclaration) o;
        Variable.Builder vb = Variable.newBuilder();
        //         vb.setPosition(pos.build()); // FIXME
        vb.setName(ex.getName().getFullyQualifiedName());
        for (Object m : ex.modifiers()) {
            if (((IExtendedModifier) m).isAnnotation())
                ((Annotation) m).accept(this);
            else
                ((org.eclipse.jdt.core.dom.Modifier) m).accept(this);
            vb.addModifiers(modifiers.pop());
        }
        boa.types.Ast.Type.Builder tp = boa.types.Ast.Type.newBuilder();
        String name = typeName(ex.getType());
        for (int i = 0; i < ex.getExtraDimensions(); i++)
            name += "[]";
        if (ex.isVarargs())
            name += "...";
        tp.setName(getIndex(name));
        tp.setKind(boa.types.Ast.TypeKind.OTHER);
        vb.setVariableType(tp.build());
        if (ex.getInitializer() != null) {
            ex.getInitializer().accept(this);
            vb.setInitializer(expressions.pop());
        }
        b.addArguments(vb.build());
    }
    for (Object o : node.thrownExceptions()) {
        boa.types.Ast.Type.Builder tp = boa.types.Ast.Type.newBuilder();
        tp.setName(getIndex(((Name) o).getFullyQualifiedName()));
        tp.setKind(boa.types.Ast.TypeKind.CLASS);
        b.addExceptionTypes(tp.build());
    }
    if (node.getBody() != null) {
        statements.push(new ArrayList<boa.types.Ast.Statement>());
        node.getBody().accept(this);
        for (boa.types.Ast.Statement s : statements.pop())
            b.addStatements(s);
    }
    list.add(b.build());
    return false;
}

From source file:boa.datagen.util.Java8Visitor.java

License:Apache License

@Override
public boolean visit(MethodDeclaration node) {
    List<boa.types.Ast.Method> list = methods.peek();
    Method.Builder b = Method.newBuilder();
    //      b.setPosition(pos.build());
    if (node.isConstructor())
        b.setName("<init>");
    else/*w w  w.j a  v  a  2 s  .  c  om*/
        b.setName(node.getName().getFullyQualifiedName());
    for (Object m : node.modifiers()) {
        if (((IExtendedModifier) m).isAnnotation())
            ((Annotation) m).accept(this);
        else
            ((org.eclipse.jdt.core.dom.Modifier) m).accept(this);
        b.addModifiers(modifiers.pop());
    }
    boa.types.Ast.Type.Builder tb = boa.types.Ast.Type.newBuilder();
    if (node.getReturnType2() != null) {
        String name = typeName(node.getReturnType2());
        // FIXME JLS8: Deprecated getExtraDimensions() and added extraDimensions()
        for (int i = 0; i < node.getExtraDimensions(); i++)
            name += "[]";
        tb.setName(getIndex(name));
        tb.setKind(boa.types.Ast.TypeKind.OTHER);
        b.setReturnType(tb.build());
    } else {
        tb.setName(getIndex("void"));
        tb.setKind(boa.types.Ast.TypeKind.OTHER);
        b.setReturnType(tb.build());
    }
    for (Object t : node.typeParameters()) {
        boa.types.Ast.Type.Builder tp = boa.types.Ast.Type.newBuilder();
        String name = ((TypeParameter) t).getName().getFullyQualifiedName();
        String bounds = "";
        for (Object o : ((TypeParameter) t).typeBounds()) {
            if (bounds.length() > 0)
                bounds += " & ";
            bounds += typeName((org.eclipse.jdt.core.dom.Type) o);
        }
        if (bounds.length() > 0)
            name = name + " extends " + bounds;
        tp.setName(getIndex(name));
        tp.setKind(boa.types.Ast.TypeKind.GENERIC);
        b.addGenericParameters(tp.build());
    }
    if (node.getReceiverType() != null) {
        Variable.Builder vb = Variable.newBuilder();
        //         vb.setPosition(pos.build()); // FIXME
        vb.setName("this");
        boa.types.Ast.Type.Builder tp = boa.types.Ast.Type.newBuilder();
        String name = typeName(node.getReceiverType());
        if (node.getReceiverQualifier() != null)
            name = node.getReceiverQualifier().getFullyQualifiedName() + "." + name;
        tp.setName(getIndex(name));
        tp.setKind(boa.types.Ast.TypeKind.OTHER); // FIXME change to receiver? or something?
        vb.setVariableType(tp.build());
        b.addArguments(vb.build());
    }
    for (Object o : node.parameters()) {
        SingleVariableDeclaration ex = (SingleVariableDeclaration) o;
        Variable.Builder vb = Variable.newBuilder();
        //         vb.setPosition(pos.build()); // FIXME
        vb.setName(ex.getName().getFullyQualifiedName());
        for (Object m : ex.modifiers()) {
            if (((IExtendedModifier) m).isAnnotation())
                ((Annotation) m).accept(this);
            else
                ((org.eclipse.jdt.core.dom.Modifier) m).accept(this);
            vb.addModifiers(modifiers.pop());
        }
        boa.types.Ast.Type.Builder tp = boa.types.Ast.Type.newBuilder();
        String name = typeName(ex.getType());
        // FIXME JLS8: Deprecated getExtraDimensions() and added extraDimensions()
        for (int i = 0; i < ex.getExtraDimensions(); i++)
            name += "[]";
        if (ex.isVarargs())
            name += "...";
        tp.setName(getIndex(name));
        tp.setKind(boa.types.Ast.TypeKind.OTHER);
        vb.setVariableType(tp.build());
        if (ex.getInitializer() != null) {
            ex.getInitializer().accept(this);
            vb.setInitializer(expressions.pop());
        }
        b.addArguments(vb.build());
    }
    for (Object o : node.thrownExceptionTypes()) {
        boa.types.Ast.Type.Builder tp = boa.types.Ast.Type.newBuilder();
        tb.setName(getIndex(typeName((org.eclipse.jdt.core.dom.Type) o)));
        tp.setKind(boa.types.Ast.TypeKind.CLASS);
        b.addExceptionTypes(tp.build());
    }
    if (node.getBody() != null) {
        statements.push(new ArrayList<boa.types.Ast.Statement>());
        node.getBody().accept(this);
        for (boa.types.Ast.Statement s : statements.pop())
            b.addStatements(s);
    }
    list.add(b.build());
    return false;
}

From source file:ca.ecliptical.pde.internal.ds.AnnotationProcessor.java

License:Open Source License

private boolean hasDefaultConstructor(TypeDeclaration type) {
    boolean hasConstructor = false;
    for (MethodDeclaration method : type.getMethods()) {
        if (method.isConstructor()) {
            hasConstructor = true;//from   w ww  .j  a v a  2  s .  co  m
            if (Modifier.isPublic(method.getModifiers()) && method.parameters().isEmpty())
                return true;
        }
    }

    return !hasConstructor;
}

From source file:cc.kave.eclipse.commons.analysis.transformer.DeclarationVisitor.java

License:Apache License

@Override
public boolean visit(MethodDeclaration decl) {

    if (decl.isConstructor()) {
        constructorHelper(decl);//from   ww w  . j  a  v a2s . com
    } else {
        methodDeclHelper(decl);
    }

    return super.visit(decl);
}

From source file:coloredide.utils.CopiedNaiveASTFlattener.java

License:Open Source License

public boolean visit(MethodDeclaration node) {
    if (node.getJavadoc() != null) {
        node.getJavadoc().accept(this);
    }/*ww w .j a  v a  2  s . co  m*/
    printIndent();
    hook_beforeVisitMethodDeclaration(node);
    if (node.getAST().apiLevel() >= AST.JLS3) {
        printModifiers(node.modifiers());
        if (!node.typeParameters().isEmpty()) {
            this.buffer.append("<");//$NON-NLS-1$
            for (Iterator it = node.typeParameters().iterator(); it.hasNext();) {
                TypeParameter t = (TypeParameter) it.next();
                t.accept(this);
                if (it.hasNext()) {
                    this.buffer.append(",");//$NON-NLS-1$
                }
            }
            this.buffer.append(">");//$NON-NLS-1$
        }
    }
    if (!node.isConstructor()) {
        if (node.getReturnType2() != null) {
            node.getReturnType2().accept(this);
        } else {
            // methods really ought to have a return type
            this.buffer.append("void");//$NON-NLS-1$
        }

        this.buffer.append(" ");//$NON-NLS-1$
    }
    node.getName().accept(this);
    this.buffer.append("(");//$NON-NLS-1$
    for (Iterator it = node.parameters().iterator(); it.hasNext();) {
        SingleVariableDeclaration v = (SingleVariableDeclaration) it.next();
        v.accept(this);
        if (it.hasNext()) {
            this.buffer.append(",");//$NON-NLS-1$
        }
    }
    this.buffer.append(")");//$NON-NLS-1$
    for (int i = 0; i < node.getExtraDimensions(); i++) {
        this.buffer.append("[]"); //$NON-NLS-1$
    }
    if (!node.thrownExceptions().isEmpty()) {
        this.buffer.append(" throws ");//$NON-NLS-1$
        for (Iterator it = node.thrownExceptions().iterator(); it.hasNext();) {
            Name n = (Name) it.next();
            n.accept(this);
            if (it.hasNext()) {
                this.buffer.append(", ");//$NON-NLS-1$
            }
        }
        this.buffer.append(" ");//$NON-NLS-1$
    }
    if (node.getBody() == null) {
        this.buffer.append(";\n");//$NON-NLS-1$
    } else {
        node.getBody().accept(this);
    }
    return false;
}

From source file:com.bsiag.eclipse.jdt.java.formatter.LineBreaksPreparator.java

License:Open Source License

@Override
public boolean visit(MethodDeclaration node) {
    this.declarationModifierVisited = false;

    if (node.getBody() == null)
        return true;

    if (node.isConstructor()) {
        handleBracedCode(node.getBody(), null, this.options.brace_position_for_constructor_declaration,
                this.options.indent_statements_compare_to_body,
                this.options.insert_new_line_in_empty_method_body);
    } else {/*from   w  w  w. j  av  a  2  s.co m*/
        handleBracedCode(node.getBody(), null, this.options.brace_position_for_method_declaration,
                this.options.indent_statements_compare_to_body,
                this.options.insert_new_line_in_empty_method_body);
        Token openBrace = this.tm.firstTokenIn(node.getBody(), TokenNameLBRACE);
        if (openBrace.getLineBreaksAfter() > 0) // if not, these are empty braces
            openBrace.putLineBreaksAfter(this.options.blank_lines_at_beginning_of_method_body + 1);
    }
    return true;
}

From source file:com.bsiag.eclipse.jdt.java.formatter.linewrap.WrapPreparator.java

License:Open Source License

@Override
public boolean visit(MethodDeclaration node) {
    List<SingleVariableDeclaration> parameters = node.parameters();
    Type receiverType = node.getReceiverType();
    if (!parameters.isEmpty() || receiverType != null) {
        if (receiverType != null)
            this.wrapIndexes.add(this.tm.firstIndexIn(receiverType, -1));
        int wrappingOption = node.isConstructor()
                ? this.options.alignment_for_parameters_in_constructor_declaration
                : this.options.alignment_for_parameters_in_method_declaration;
        this.wrapGroupEnd = this.tm
                .lastIndexIn(parameters.isEmpty() ? receiverType : parameters.get(parameters.size() - 1), -1);
        handleArguments(parameters, wrappingOption);
    }//from  w  w w  .  ja v a  2s  .c om

    List<Type> exceptionTypes = node.thrownExceptionTypes();
    if (!exceptionTypes.isEmpty()) {
        this.wrapParentIndex = this.tm.firstIndexBefore(exceptionTypes.get(0), TokenNameRPAREN);
        this.wrapGroupEnd = this.tm.lastIndexIn(exceptionTypes.get(exceptionTypes.size() - 1), -1);
        int wrappingOption = node.isConstructor()
                ? this.options.alignment_for_throws_clause_in_constructor_declaration
                : this.options.alignment_for_throws_clause_in_method_declaration;
        for (Type exceptionType : exceptionTypes)
            this.wrapIndexes.add(this.tm.firstIndexIn(exceptionType, -1));
        // instead of the first exception type, wrap the "throws" token
        this.wrapIndexes.set(0, this.tm.firstIndexBefore(exceptionTypes.get(0), TokenNamethrows));
        handleWrap(wrappingOption, 0.5f);
    }

    if (!node.isConstructor()) {
        this.wrapParentIndex = this.tm.findFirstTokenInLine(this.tm.firstIndexIn(node.getName(), -1));
        List<TypeParameter> typeParameters = node.typeParameters();
        if (!typeParameters.isEmpty())
            this.wrapIndexes.add(this.tm.firstIndexIn(typeParameters.get(0), -1));
        if (node.getReturnType2() != null) {
            int returTypeIndex = this.tm.firstIndexIn(node.getReturnType2(), -1);
            if (returTypeIndex != this.wrapParentIndex)
                this.wrapIndexes.add(returTypeIndex);
        }
        this.wrapIndexes.add(this.tm.firstIndexIn(node.getName(), -1));
        this.wrapGroupEnd = this.tm.lastIndexIn(node.getName(), -1);
        handleWrap(this.options.alignment_for_method_declaration);
    }
    return true;
}

From source file:com.bsiag.eclipse.jdt.java.formatter.SpacePreparator.java

License:Open Source License

@Override
public boolean visit(MethodDeclaration node) {
    handleToken(node.getName(), TokenNameIdentifier, true, false);

    boolean spaceBeforeOpenParen = node.isConstructor()
            ? this.options.insert_space_before_opening_paren_in_constructor_declaration
            : this.options.insert_space_before_opening_paren_in_method_declaration;
    boolean spaceAfterOpenParen = node.isConstructor()
            ? this.options.insert_space_after_opening_paren_in_constructor_declaration
            : this.options.insert_space_after_opening_paren_in_method_declaration;
    boolean spaceBetweenEmptyParens = node.isConstructor()
            ? this.options.insert_space_between_empty_parens_in_constructor_declaration
            : this.options.insert_space_between_empty_parens_in_method_declaration;
    if (handleEmptyParens(node.getName(), spaceBetweenEmptyParens)) {
        handleToken(node.getName(), TokenNameLPAREN, spaceBeforeOpenParen, false);
    } else {/*from  w w w. j a  va2  s .c  om*/
        handleToken(node.getName(), TokenNameLPAREN, spaceBeforeOpenParen, spaceAfterOpenParen);

        boolean spaceBeforeCloseParen = node.isConstructor()
                ? this.options.insert_space_before_closing_paren_in_constructor_declaration
                : this.options.insert_space_before_closing_paren_in_method_declaration;
        handleTokenBefore(node.getBody(), TokenNameRPAREN, spaceBeforeCloseParen, false);
    }

    if ((node.isConstructor() ? this.options.insert_space_before_opening_brace_in_constructor_declaration
            : this.options.insert_space_before_opening_brace_in_method_declaration) && node.getBody() != null)
        this.tm.firstTokenIn(node.getBody(), TokenNameLBRACE).spaceBefore();

    boolean beforeComma = node.isConstructor()
            ? this.options.insert_space_before_comma_in_constructor_declaration_parameters
            : this.options.insert_space_before_comma_in_method_declaration_parameters;
    boolean afterComma = node.isConstructor()
            ? this.options.insert_space_after_comma_in_constructor_declaration_parameters
            : this.options.insert_space_after_comma_in_method_declaration_parameters;
    handleCommas(node.parameters(), beforeComma, afterComma);

    List<Type> thrownExceptionTypes = node.thrownExceptionTypes();
    if (!thrownExceptionTypes.isEmpty()) {
        this.tm.firstTokenBefore(thrownExceptionTypes.get(0), TokenNamethrows).spaceBefore();

        beforeComma = node.isConstructor()
                ? this.options.insert_space_before_comma_in_constructor_declaration_throws
                : this.options.insert_space_before_comma_in_method_declaration_throws;
        afterComma = node.isConstructor()
                ? this.options.insert_space_after_comma_in_constructor_declaration_throws
                : this.options.insert_space_after_comma_in_method_declaration_throws;
        handleCommas(thrownExceptionTypes, beforeComma, afterComma);
    }

    List<TypeParameter> typeParameters = node.typeParameters();
    if (!typeParameters.isEmpty()) {
        handleTypeParameters(typeParameters);
        handleTokenBefore(typeParameters.get(0), TokenNameLESS, true, false);
        handleTokenAfter(typeParameters.get(typeParameters.size() - 1), TokenNameGREATER, false, true);
    }
    return true;
}

From source file:com.crispico.flower.mp.metamodel.codesyncjava.algorithm.forward.ForwardJavaMethod.java

License:Open Source License

@SuppressWarnings("unchecked")
@Override// w  ww.j a  v a 2  s  .c  om
protected void setASTFeatureValue(EStructuralFeature feature, MethodDeclaration astElement, Object value)
        throws CodeSyncException {
    if (astElement == null)
        throw new IllegalArgumentException("astElement null ");
    AST ast = astElement.getAST();

    switch (feature.getFeatureID()) {
    case UMLPackage.NAMED_ELEMENT__NAME:
        if (value == null)
            throw new IllegalArgumentException("setting name to null value ");
        astElement.setName(ast.newSimpleName((String) value));
        break;
    case UMLPackage.OPERATION__TYPE:
        parentForwardJavaClass_OwnedMethods.parentForwardJavaType.parentForwardJavaSrcDir_Files
                .createImportDeclarationIfNeeded((Type) value);
        String modelReturnType = value == null ? null : ((Type) value).getName();
        if (!astElement.isConstructor()) {
            TypeDeclaration parent = (TypeDeclaration) astElement.getParent();
            if (value == null
                    && astElement.getName().getIdentifier().equals(parent.getName().getIdentifier())) {
                // transform this method to constructor
                astElement.setConstructor(true);
            } else //if null value => return void type
                astElement.setReturnType2(JavaSyncUtils.getJavaTypeFromString(ast, modelReturnType, true));
        } else if (value != null) {
            // transforming from constructor to ordinary method
            astElement.setConstructor(false);
            astElement.setReturnType2(JavaSyncUtils.getJavaTypeFromString(ast, modelReturnType, true));
        }
        break;
    case UMLPackage.BEHAVIORAL_FEATURE__OWNED_PARAMETER:
        astElement.parameters().clear();
        for (Parameter par : (List<Parameter>) value)
            if (par.getDirection().equals(ParameterDirectionKind.IN_LITERAL)) {
                parentForwardJavaClass_OwnedMethods.parentForwardJavaType.parentForwardJavaSrcDir_Files
                        .createImportDeclarationIfNeeded(par.getType());

                SingleVariableDeclaration variableDeclaration = ast.newSingleVariableDeclaration();
                String paramName = par.getName();
                String paramType = par.getType() == null ? null : par.getType().getName();
                if (paramName == null)
                    throw new IllegalArgumentException("Parameter name is null: " + par);
                variableDeclaration.setType(JavaSyncUtils.getJavaTypeFromString(ast, paramType, true));
                try {
                    variableDeclaration.setName(ast.newSimpleName(paramName));
                } catch (IllegalArgumentException e) {
                    throw new CodeSyncException("Invalid Parameter Name: \"" + paramName
                            + "\" on java operation: " + astElement.getName() + "()", e);
                }
                astElement.parameters().add(variableDeclaration);
            }
        break;
    case UMLPackage.BEHAVIORAL_FEATURE__IS_ABSTRACT:
        JavaSyncUtils.updateModifierFromModelToJavaClass(astElement, (Boolean) value,
                JavaSyncUtils.MODIFIER_ABSTRACT);
        break;
    case UMLPackage.ELEMENT__EANNOTATIONS:
        List<EAnnotation> annotations = (List<EAnnotation>) value;
        for (EAnnotation annot : annotations) {
            // search for a template method annotation
            if (annot.getSource().equals("TemplateMethod") && annot.getDetails().containsKey("id")) {
                String bodyContent = JetTemplateFactory.INSTANCE
                        .invokeOperationJetTemplate(annot.getEModelElement(), annot.getDetails().get("id"));
                if (annot.getDetails().containsKey("comment")) { // if it must contain also the template comment
                    String commentLine = JetTemplateFactory.INSTANCE.invokeOperationJetTemplate(
                            annot.getEModelElement(), annot.getDetails().get("comment"));
                    JavaSyncUtils.generateBodyWithCommentForMethod(astElement, bodyContent, commentLine);
                } else { // add only content to method
                    JavaSyncUtils.generateBodyForMethod(astElement, bodyContent);
                }
                // remove annotation; it doesn't need to be synchronized
                annotations.remove(annot);
                break;
            }
        }
        break;
    default:
        super.setASTFeatureValue(feature, astElement, value);
    }
}