Esempio n. 1
0
  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();

    for (AnnotationWithTarget annotationWithTarget : getAnnotations().getAllAnnotations()) {
      sb.append("[");
      sb.append(
          DescriptorRenderer.DEBUG_TEXT.renderAnnotation(
              annotationWithTarget.getAnnotation(), annotationWithTarget.getTarget()));
      sb.append("] ");
    }

    sb.append(getConstructor());

    List<TypeProjection> arguments = getArguments();
    if (!arguments.isEmpty()) {
      sb.append("<");
      for (Iterator<TypeProjection> i = arguments.iterator(); i.hasNext(); ) {
        sb.append(i.next());
        if (i.hasNext()) {
          sb.append(", ");
        }
      }
      sb.append(">");
    }

    if (isMarkedNullable()) {
      sb.append("?");
    }

    return sb.toString();
  }
Esempio n. 2
0
 @Nullable
 public static AnnotationDescriptor getAnnotationByFqName(
     @NotNull Annotations annotations, @NotNull FqName name) {
   AnnotationWithTarget annotationWithTarget =
       Annotations.Companion.findAnyAnnotation(annotations, name);
   return annotationWithTarget == null ? null : annotationWithTarget.getAnnotation();
 }