Package lombok.ast

Examples of lombok.ast.MethodDeclaration


                    return true;
                }
            } else if (type == MethodDeclaration.class) {
                // Method
                // Look for annotations on the method
                MethodDeclaration declaration = (MethodDeclaration) scope;
                if (isSuppressed(issue, declaration.astModifiers())) {
                    return true;
                }
            } else if (type == ConstructorDeclaration.class) {
                // Constructor
                // Look for annotations on the method
                ConstructorDeclaration declaration = (ConstructorDeclaration) scope;
                if (isSuppressed(issue, declaration.astModifiers())) {
                    return true;
                }
            } else if (type == ClassDeclaration.class) {
                // Class
                ClassDeclaration declaration = (ClassDeclaration) scope;
                if (isSuppressed(issue, declaration.astModifiers())) {
                    return true;
                }
            }

            scope = scope.getParent();
View Full Code Here


                    return true;
                }
            } else if (type == MethodDeclaration.class) {
                // Method
                // Look for annotations on the method
                MethodDeclaration declaration = (MethodDeclaration) scope;
                if (isSuppressed(issue, declaration.astModifiers())) {
                    return true;
                }
            } else if (type == ConstructorDeclaration.class) {
                // Constructor
                // Look for annotations on the method
                ConstructorDeclaration declaration = (ConstructorDeclaration) scope;
                if (isSuppressed(issue, declaration.astModifiers())) {
                    return true;
                }
            } else if (type == ClassDeclaration.class) {
                // Class
                ClassDeclaration declaration = (ClassDeclaration) scope;
                if (isSuppressed(issue, declaration.astModifiers())) {
                    return true;
                }
            }

            scope = scope.getParent();
View Full Code Here

 
  public void varargsOnlyLegalOnMethods(VariableDefinition node) {
    if (!node.astVarargs()) return;
    if (node.getParent() == null) return;
   
    MethodDeclaration md = node.upIfParameterToMethodDeclaration();
    ConstructorDeclaration cd = node.upIfParameterToConstructorDeclaration();
    Node last;
   
    if (md != null) last = md.astParameters().last();
    else if (cd != null) last = cd.astParameters().last();
    else last = null;
   
    if (node != last) {
      node.addMessage(error(VARIABLEDEFINITION_VARARGS_NOT_LEGAL_HERE, "Varargs are only legal on the last parameter of a constructor or method."));
View Full Code Here

  }
 
  public Node createMethodDeclaration(Node modifiers, Node typeParameters, Node resultType, Node name,
      Node params, List<org.parboiled.Node<Node>> dims, Node throwsHead, List<Node> throwsTail, Node body) {
   
    MethodDeclaration decl = new MethodDeclaration();
   
    if (params instanceof TemporaryNode.MethodParameters) {
      for (Node param : ((TemporaryNode.MethodParameters)params).parameters) {
        decl.rawParameters().addToEnd(param);
      }
    } else DanglingNodes.addDanglingNode(decl, params);
   
    decl.astMethodName(createIdentifierIfNeeded(name, currentPos())).rawBody(body);
    if (modifiers != null) decl.astModifiers(createModifiersIfNeeded(modifiers, currentPos()));
    int extraDims = dims == null ? 0 : dims.size();
    Node returnType = resultType;
    if (extraDims > 0 && returnType instanceof TypeReference) {
      ((TypeReference)returnType).astArrayDimensions(((TypeReference)returnType).astArrayDimensions() + extraDims);
    }
    decl.rawReturnTypeReference(returnType);
    if (typeParameters instanceof TemporaryNode.OrphanedTypeVariables) {
      TemporaryNode.OrphanedTypeVariables otv = (TemporaryNode.OrphanedTypeVariables)typeParameters;
      if (otv.variables != null) for (Node typeParameter : otv.variables) {
        if (typeParameter != null) decl.rawTypeVariables().addToEnd(typeParameter);
      }
    }
   
    for (org.parboiled.Node<Node> dim : dims) {
      for (org.parboiled.Node<Node> dimSub : dim.getChildren()) {
        source.registerStructure(decl, dimSub);
      }
    }
   
    if (throwsHead != null) decl.rawThrownTypeReferences().addToEnd(throwsHead);
    if (throwsTail != null) for (Node n : throwsTail) if (n != null) decl.rawThrownTypeReferences().addToEnd(n);
    return posify(decl);
  }
View Full Code Here

        addJavadoc(md, node.mods);
        set(node, md);
        return;
      }
     
      MethodDeclaration md = new MethodDeclaration();
      md.rawBody(toTree(node.getBody()));
      md.astModifiers((Modifiers) toTree(node.getModifiers()));
      md.astMethodName(setPos(node, new Identifier().astValue(name)));
      fillList(node.getThrows(), md.rawThrownTypeReferences(), FlagKey.TYPE_REFERENCE);
      fillList(node.getTypeParameters(), md.rawTypeVariables());
      fillList(node.getParameters(), md.rawParameters(), FlagKey.NO_VARDECL_FOLDING, FlagKey.VARDEF_IS_DEFINITION);
      md.rawReturnTypeReference(toTree(node.getReturnType(), FlagKey.TYPE_REFERENCE));
      addJavadoc(md, node.mods);
      set(node, md);
    }
View Full Code Here

                    return true;
                }
            } else if (type == MethodDeclaration.class) {
                // Method
                // Look for annotations on the method
                MethodDeclaration declaration = (MethodDeclaration) scope;
                if (isSuppressed(issue, declaration.astModifiers())) {
                    return true;
                }
            } else if (type == ConstructorDeclaration.class) {
                // Constructor
                // Look for annotations on the method
                ConstructorDeclaration declaration = (ConstructorDeclaration) scope;
                if (isSuppressed(issue, declaration.astModifiers())) {
                    return true;
                }
            } else if (type == ClassDeclaration.class) {
                // Class
                ClassDeclaration declaration = (ClassDeclaration) scope;
                if (isSuppressed(issue, declaration.astModifiers())) {
                    return true;
                }
            }

            if (checkComments && context.isSuppressed(scope, issue)) {
View Full Code Here

TOP

Related Classes of lombok.ast.MethodDeclaration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.