-
-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use portable-scala-reflect instead of the deprecated TestUtils.
`TestUtils` is deprecated in Scala.js 0.6.25. It has been replaced by the more general portable-scala-reflect library. This commit migrates to using the latter. Since portable-scala-reflect does not support Scala Native yet, we need a bit more stuff in `PlatformShims`. These won't be necessary when Scala Native implements scala-native/scala-native#1279 and portable-scala-reflect starts supporting Scala Native.
- Loading branch information
Showing
6 changed files
with
37 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,22 @@ | ||
package utest | ||
|
||
import scala.concurrent.{Await, Future} | ||
import scala.util.{Failure, Success} | ||
import concurrent.duration._ | ||
import java.io.{PrintWriter, StringWriter} | ||
import org.portablescala.reflect.Reflect | ||
|
||
/** | ||
* Platform specific stuff that differs between JVM and JS | ||
*/ | ||
object PlatformShims { | ||
def await[T](f: Future[T]): T = Await.result(f, 10.hours) | ||
|
||
type EnableReflectiveInstantiation = | ||
org.portablescala.reflect.annotation.EnableReflectiveInstantiation | ||
|
||
def loadModule(name: String, loader: ClassLoader): Any = { | ||
Reflect | ||
.lookupLoadableModuleClass(name + "$", loader) | ||
.getOrElse(throw new ClassNotFoundException(name)) | ||
.loadModule() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters