public static boolean writeModifiers(StringBuilder builder, PsiModifierList modifierList, String[] modifiers, boolean writeAnnotations) {
    boolean wasAddedModifiers = false;

    if (writeAnnotations && modifierList instanceof GrModifierList) {
      GrAnnotation[] annotations = ((GrModifierList)modifierList).getAnnotations();
      AnnotationGenerator annotationGenerator = new AnnotationGenerator(builder, new ExpressionContext(modifierList.getProject(), GroovyFile.EMPTY_ARRAY));
      wasAddedModifiers = annotations.length > 0;
      for (GrAnnotation annotation : annotations) {
        annotation.accept(annotationGenerator);
        builder.append(' ');
      }
    }

    for (String modifierType : modifiers) {
      if (modifierList.hasModifierProperty(modifierType)) {
        builder.append(modifierType);
        builder.append(' ');
        wasAddedModifiers = true;
      }
    }



    return wasAddedModifiers;
  }
public static boolean writeModifiers(StringBuilder builder, PsiModifierList modifierList, String[] modifiers, boolean writeAnnotations)