#2131 Pod Doc Rendering -> java.lang.ClassCastException

SlimerDude Mon 8 Apr 2013

Rendering a pod's pod-doc with its default renderer generates a java.lang.ClassCastException. It may be argued that you're (we're?) not supposed to render the pod-doc but it does appear in the pod's list of docs and it is passed into the DocPod.eachPod method.

I think either non-API docs should be left of API DocPods or the default renderer should be able to handle .fandocs.

Test case:

using compilerDoc
using web

class Wotever
  static Void main(Str[] args) {
    fwtPod  := Env.cur.findFile(`lib/fan/fwt.pod`)
    docPod  := DocPod.load(fwtPod)
    doc     := docPod.doc("pod-doc")
    docEnv  := DefaultDocEnv()
    webOut  := WebOutStream(StrBuf().out)
    render  := doc.renderer.method("make").call(docEnv, webOut, doc) as DocRenderer

    // render fwt's pod-doc
    render.writeDoc
  }
}

Gives:

sys::CastErr: java.lang.ClassCastException: fan.compilerDoc.DocType cannot be cast to fan.compilerDoc.DocChapter
  compilerDoc::DocChapterRenderer.writeToc (DocChapterRenderer.fan:117)
  fan.sys.List.each (List.java:534)
  compilerDoc::DocChapterRenderer.writeToc (DocChapterRenderer.fan:111)
  compilerDoc::DocChapterRenderer.writeContent (DocChapterRenderer.fan:68)
  compilerDoc::DocRenderer.writeDoc (DocRenderer.fan:65)
  wotever::Wotever.main (Wotever.fan:XXX)

Login or Signup to reply.