private String formatSubcomponentDeclaration(SubcomponentDeclaration subcomponentDeclaration) {
    ImmutableList<TypeMirror> moduleSubcomponents =
        getModuleSubcomponents(subcomponentDeclaration.moduleAnnotation());
    int index =
        Iterables.indexOf(
            moduleSubcomponents,
            MoreTypes.equivalence()
                .equivalentTo(subcomponentDeclaration.subcomponentType().asType()));
    StringBuilder annotationValue = new StringBuilder();
    if (moduleSubcomponents.size() != 1) {
      annotationValue.append("{");
    }
    annotationValue.append(
        formatArgumentInList(
            index,
            moduleSubcomponents.size(),
            subcomponentDeclaration.subcomponentType().getQualifiedName() + ".class"));
    if (moduleSubcomponents.size() != 1) {
      annotationValue.append("}");
    }

    return String.format(
        "@%s(subcomponents = %s) for %s",
        simpleName(subcomponentDeclaration.moduleAnnotation()),
        annotationValue,
        subcomponentDeclaration.contributingModule().get());
  }