diff --git a/compile/src/test/scala/ApplicationsTest.scala b/compile/src/test/scala/ApplicationsTest.scala index adec9fdf0..5e799422b 100644 --- a/compile/src/test/scala/ApplicationsTest.scala +++ b/compile/src/test/scala/ApplicationsTest.scala @@ -116,9 +116,7 @@ object ApplicationsTest extends Specification } private def testRun(loader: ClassLoader, className: String) { - val obj = Class.forName(className+"$", true, loader) - val singletonField = obj.getField("MODULE$") - val singleton = singletonField.get(null) - singleton.asInstanceOf[{def main(args: Array[String]): Unit}].main(Array[String]()) + val obj = Class.forName(className, true, loader) + obj.getMethod("main", classOf[Array[String]]).invoke(null, new Array[String](0)) } } \ No newline at end of file diff --git a/compile/src/test/scala/CompileTest.scala b/compile/src/test/scala/CompileTest.scala index 3d08eca21..c68f2f129 100644 --- a/compile/src/test/scala/CompileTest.scala +++ b/compile/src/test/scala/CompileTest.scala @@ -43,22 +43,20 @@ object WithCompiler val manager = new ComponentManager(xsbt.boot.Locks, new boot.ComponentProvider(componentDirectory), log) val compiler = new AnalyzingCompiler(ScalaInstance(scalaVersion, launch), manager) compiler.newComponentCompiler(log).clearCache(ComponentCompiler.compilerInterfaceID) - prepare(manager, ComponentCompiler.compilerInterfaceSrcID, "CompilerInterface.scala") - prepare(manager, ComponentCompiler.xsbtiID, classOf[xsbti.AnalysisCallback]) + define(manager, ComponentCompiler.compilerInterfaceSrcID, getResource("CompilerInterface.scala"), getClassResource(classOf[jline.Completor])) + define(manager, ComponentCompiler.xsbtiID, getClassResource(classOf[xsbti.AnalysisCallback])) f(compiler, log) } } } } - def prepare(manager: ComponentManager, id: String, resource: Class[_]): Unit = define(manager, id, FileUtilities.classLocationFile(resource) :: Nil) - def prepare(manager: ComponentManager, id: String, resource: String) + def getClassResource(resource: Class[_]): File = FileUtilities.classLocationFile(resource) + def getResource(resource: String): File = { val src = getClass.getClassLoader.getResource(resource) - if(src eq null) - error("Resource not found: " + resource) - define(manager, id, FileUtilities.asFile(src) :: Nil) + if(src ne null) FileUtilities.asFile(src) else error("Resource not found: " + resource) } - def define(manager: ComponentManager, id: String, files: List[File]) + def define(manager: ComponentManager, id: String, files: File*) { manager.clearCache(id) manager.define(id, files)