see scala.tools.nsc.util.stringFromWriter