protected void init() {
    com.redhat.ceylon.compiler.typechecker.model.ClassOrInterface decl =
        (com.redhat.ceylon.compiler.typechecker.model.ClassOrInterface)
            producedType.getDeclaration();
    this.declaration = (FreeClassOrInterface) Metamodel.getOrCreateMetamodel(decl);
    java.util.Map<
            ceylon.language.meta.declaration.TypeParameter,
            ceylon.language.meta.declaration.OpenType>
        typeArguments =
            new LinkedHashMap<
                ceylon.language.meta.declaration.TypeParameter,
                ceylon.language.meta.declaration.OpenType>();
    Iterator<? extends ceylon.language.meta.declaration.TypeParameter> typeParameters =
        declaration.getTypeParameterDeclarations().iterator();
    Object it;
    java.util.Map<
            com.redhat.ceylon.compiler.typechecker.model.TypeParameter,
            com.redhat.ceylon.compiler.typechecker.model.ProducedType>
        ptArguments = producedType.getTypeArguments();
    while ((it = typeParameters.next()) != finished_.$get()) {
      com.redhat.ceylon.compiler.java.runtime.metamodel.FreeTypeParameter tp =
          (com.redhat.ceylon.compiler.java.runtime.metamodel.FreeTypeParameter) it;
      com.redhat.ceylon.compiler.typechecker.model.TypeParameter tpDecl =
          (com.redhat.ceylon.compiler.typechecker.model.TypeParameter) tp.declaration;
      com.redhat.ceylon.compiler.typechecker.model.ProducedType ptArg = ptArguments.get(tpDecl);
      OpenType ptArgWrapped = Metamodel.getMetamodel(ptArg);
      typeArguments.put(tp, ptArgWrapped);
    }
    this.typeArguments =
        new InternalMap<
            ceylon.language.meta.declaration.TypeParameter,
            ceylon.language.meta.declaration.OpenType>(
            ceylon.language.meta.declaration.TypeParameter.$TypeDescriptor,
            ceylon.language.meta.declaration.OpenType.$TypeDescriptor,
            typeArguments);

    com.redhat.ceylon.compiler.typechecker.model.ProducedType superType = decl.getExtendedType();
    if (superType != null) {
      com.redhat.ceylon.compiler.typechecker.model.ProducedType superTypeResolved =
          superType.substitute(producedType.getTypeArguments());
      this.superclass =
          (ceylon.language.meta.declaration.OpenClassType)
              Metamodel.getMetamodel(superTypeResolved);
    }

    List<com.redhat.ceylon.compiler.typechecker.model.ProducedType> satisfiedTypes =
        decl.getSatisfiedTypes();
    ceylon.language.meta.declaration.OpenInterfaceType[] interfaces =
        new ceylon.language.meta.declaration.OpenInterfaceType[satisfiedTypes.size()];
    int i = 0;
    for (com.redhat.ceylon.compiler.typechecker.model.ProducedType pt : satisfiedTypes) {
      com.redhat.ceylon.compiler.typechecker.model.ProducedType resolvedPt =
          pt.substitute(producedType.getTypeArguments());
      interfaces[i++] =
          (ceylon.language.meta.declaration.OpenInterfaceType) Metamodel.getMetamodel(resolvedPt);
    }
    this.interfaces =
        Util.sequentialInstance(
            ceylon.language.meta.declaration.OpenInterfaceType.$TypeDescriptor, interfaces);
  }
  protected final void doc(ClassOrInterface d) throws IOException {
    open("tr");

    open("td id='" + d.getName() + "' nowrap");
    writeIcon(d);
    around("a class='link-discreet' href='" + linkRenderer().to(d).getUrl() + "'", d.getName());
    close("td");

    open("td");
    writeLinkOneSelf(d);
    writeLinkSourceCode(d);
    writeTagged(d);
    open("div class='signature'");
    around("span class='modifiers'", getModifiers(d));
    write(" ");
    linkRenderer().to(d.getType()).write();
    close("div");
    writeDescription(d);
    close("td");

    close("tr");
  }