-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move JDK shims to munit.internal
#441
Changes from 1 commit
c6395a4
2a5cdbd
5b91547
48faab5
efcfccc
ee265eb
9ea90ef
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,5 +3,4 @@ | |
-Xmx2G | ||
-XX:ReservedCodeCacheSize=1024m | ||
-XX:+TieredCompilation | ||
-XX:+CMSClassUnloadingEnabled | ||
-Dfile.encoding=UTF-8 |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package java.nio.file | ||
package munit.internal | ||
|
||
import scala.scalajs.js | ||
import java.{util => ju} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
package java.lang.reflect | ||
package munit.internal | ||
|
||
class InvocationTargetException extends java.lang.RuntimeException |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,7 @@ | ||
package java.nio.file | ||
package munit.internal | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's introduce a new
The reason is mostly historical because MUnit includes a reimplementation of the java difflib and it didn't feel right to have all of those diff classes inside There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done. |
||
|
||
import java.io.File | ||
import java.net.URI | ||
|
||
import munit.internal.NodeNIOPath | ||
|
||
object Paths { | ||
// NOTE: We can't use Scala-style varargs since those have a different jvm | ||
// signature than Java-style varargs. The boot classpath contains nio.file.Path | ||
|
@@ -14,7 +11,7 @@ object Paths { | |
val path = | ||
if (more.isEmpty) first | ||
else first + File.separator + more.mkString(File.separator) | ||
NodeNIOPath(path) | ||
Path(path) | ||
} | ||
|
||
def get(uri: URI): Path = { | ||
|
@@ -25,8 +22,8 @@ object Paths { | |
val (leading, trailing) = parts.span(_ == "") | ||
trailing match { | ||
case drive :: path if (drive.length == 2 && drive(1) == ':') => | ||
NodeNIOPath(trailing.mkString("\\")) | ||
case _ => NodeNIOPath(uripath) | ||
Path(trailing.mkString("\\")) | ||
case _ => Path(uripath) | ||
} | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
package java.lang.reflect | ||
package munit.internal | ||
|
||
class UndeclaredThrowableException extends java.lang.RuntimeException |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package munit | ||
|
||
package object internal { | ||
type File = java.io.File | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we add an object called There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I moved the io-related ones to |
||
object Files { | ||
def readAllLines(path: Path) = java.nio.file.Files.readAllLines(path) | ||
} | ||
|
||
type Path = java.nio.file.Path | ||
object Paths { | ||
def get(path: String) = java.nio.file.Paths.get(path) | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package munit | ||
|
||
package object internal { | ||
type File = java.io.File | ||
object Files { | ||
def readAllLines(path: Path) = java.nio.file.Files.readAllLines(path) | ||
} | ||
|
||
type Path = java.nio.file.Path | ||
object Paths { | ||
def get(path: String) = java.nio.file.Paths.get(path) | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's call this
MUnitPath
instead ofPath
. Or something else if you have suggestions. I don't like it when libraries use generic names for internal classes because it pollutes the namespace when you're auto-completing symbols.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense, done.