private void createBuilderForAnnotatedMethod(
      BuilderASTTransformation transform, MethodNode mNode, AnnotationNode anno) {
    if (transform.getMemberValue(anno, "includes") != null
        || transform.getMemberValue(anno, "includes") != null) {
      transform.addError(
          "Error during "
              + BuilderASTTransformation.MY_TYPE_NAME
              + " processing: includes/excludes only allowed on classes",
          anno);
    }
    if (mNode instanceof ConstructorNode) {
      mNode.setModifiers(ACC_PRIVATE | ACC_SYNTHETIC);
    } else {
      if ((mNode.getModifiers() & ACC_STATIC) == 0) {
        transform.addError(
            "Error during "
                + BuilderASTTransformation.MY_TYPE_NAME
                + " processing: method builders only allowed on static methods",
            anno);
      }
      mNode.setModifiers(ACC_PRIVATE | ACC_SYNTHETIC | ACC_STATIC);
    }
    ClassNode buildee = mNode.getDeclaringClass();
    Parameter[] parameters = mNode.getParameters();
    ClassNode builder =
        createInnerHelperClass(buildee, getBuilderClassName(buildee, anno), parameters.length);
    List<FieldNode> convertedFields = convertParamsToFields(builder, parameters);

    buildCommon(buildee, anno, convertedFields, builder);
    if (mNode instanceof ConstructorNode) {
      createBuildeeConstructors(transform, buildee, builder, convertedFields, false);
    } else {
      createBuildeeMethods(buildee, mNode, builder, convertedFields);
    }
  }
 private void visitDeprecation(AnnotatedNode node, AnnotationNode visited) {
   if (visited.getClassNode().isResolved()
       && visited.getClassNode().getName().equals("java.lang.Deprecated")) {
     if (node instanceof MethodNode) {
       MethodNode mn = (MethodNode) node;
       mn.setModifiers(mn.getModifiers() | Opcodes.ACC_DEPRECATED);
     } else if (node instanceof FieldNode) {
       FieldNode fn = (FieldNode) node;
       fn.setModifiers(fn.getModifiers() | Opcodes.ACC_DEPRECATED);
     } else if (node instanceof ClassNode) {
       ClassNode cn = (ClassNode) node;
       cn.setModifiers(cn.getModifiers() | Opcodes.ACC_DEPRECATED);
     }
   }
 }
 private void revertVisibility(MethodNode mNode) {
   mNode.setModifiers(mNode.getModifiers() & ~ACC_PUBLIC);
 }
  private boolean makeGetPropertyWithGetter(
      final Expression receiver,
      final ClassNode receiverType,
      final String methodName,
      final boolean safe,
      final boolean implicitThis) {
    // does a getter exists ?
    String getterName = "get" + MetaClassHelper.capitalize(methodName);
    MethodNode getterNode = receiverType.getGetterMethod(getterName);
    if (getterNode == null) {
      getterName = "is" + MetaClassHelper.capitalize(methodName);
      getterNode = receiverType.getGetterMethod(getterName);
    }
    if (getterNode != null
        && receiver instanceof ClassExpression
        && !CLASS_Type.equals(receiverType)
        && !getterNode.isStatic()) {
      return false;
    }

    // GROOVY-5561: if two files are compiled in the same source unit
    // and that one references the other, the getters for properties have not been
    // generated by the compiler yet (generated by the Verifier)
    PropertyNode propertyNode = receiverType.getProperty(methodName);
    if (propertyNode != null) {
      // it is possible to use a getter
      String prefix = "get";
      if (boolean_TYPE.equals(propertyNode.getOriginType())) {
        prefix = "is";
      }
      getterName = prefix + MetaClassHelper.capitalize(methodName);
      getterNode =
          new MethodNode(
              getterName,
              ACC_PUBLIC,
              propertyNode.getOriginType(),
              Parameter.EMPTY_ARRAY,
              ClassNode.EMPTY_ARRAY,
              EmptyStatement.INSTANCE);
      getterNode.setDeclaringClass(receiverType);
      if (propertyNode.isStatic()) getterNode.setModifiers(ACC_PUBLIC + ACC_STATIC);
    }
    if (getterNode != null) {
      MethodCallExpression call =
          new MethodCallExpression(receiver, getterName, ArgumentListExpression.EMPTY_ARGUMENTS);
      call.setSourcePosition(receiver);
      call.setMethodTarget(getterNode);
      call.setImplicitThis(implicitThis);
      call.setSafe(safe);
      call.visit(controller.getAcg());
      return true;
    }

    if (receiverType instanceof InnerClassNode && !receiverType.isStaticClass()) {
      if (makeGetPropertyWithGetter(
          receiver, receiverType.getOuterClass(), methodName, safe, implicitThis)) {
        return true;
      }
    }

    // go upper level
    ClassNode superClass = receiverType.getSuperClass();
    if (superClass != null) {
      return makeGetPropertyWithGetter(receiver, superClass, methodName, safe, implicitThis);
    }
    return false;
  }