docs: Iterable<ClassData> compile() {
      List<ClassData> classes = new ArrayList<>();
  
      // first generate the factory
      if (templateNode.getVisibility() != Visibility.PRIVATE) {
        // Don't generate factory if the template is private.  The factories are only
        // useful to instantiate templates for calls from java.  Soy->Soy calls should invoke
        // constructors directly.
        new TemplateFactoryCompiler(template, templateNode, innerClasses).compile();
      }
  
      writer =
          SoyClassWriter.builder(template.typeInfo())
              .setAccess(Opcodes.ACC_PUBLIC + Opcodes.ACC_SUPER + Opcodes.ACC_FINAL)
              .implementing(TEMPLATE_TYPE)
              .sourceFileName(templateNode.getSourceLocation().getFileName())
              .build();
      generateTemplateMetadata();
      generateKindMethod();
      stateField.defineField(writer);
      paramsField.defineField(writer);
      ijField.defineField(writer);
      for (FieldRef field : paramFields.values()) {
        field.defineField(writer);
      }
  
      ImmutableMap<TemplateParam, SoyExpression> defaultParamInitializers = generateRenderMethod();
  
      generateConstructor(defaultParamInitializers);
  
      innerClasses.registerAllInnerClasses(writer);
      writer.visitEnd();
  
      classes.add(writer.toClassData());
      classes.addAll(innerClasses.getInnerClassData());
      writer = null;
      return classes;
    }