In scala 2.9.x I used tools.nsc.Global
directly to compile certain string into a class and execute it.
In scala 2.10, it is possible to replace it with something like the following:
import scala.reflect.runtime._;
val cm = universe.runtimeMirror(getClass.getClassLoader)
import scala.tools.reflect.ToolBox;
val tb = cm.mkToolBox()
tb.eval(tb.parse("class C; new C"))
And it works flawlessly. The only problem is that with old (deprecated) approach, I could get extremely pretty summary of all compilation failures using StoreReporter (with error messages, line numbers), and new approach just throws an exception on compilation error.
Is there some way to reify that?