Skip to content
This repository was archived by the owner on Sep 8, 2022. It is now read-only.

some changes so it compiles on Java 9 #111

Merged
merged 1 commit into from
Jun 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=0.13.15
sbt.version=0.13.17
7 changes: 6 additions & 1 deletion src/main/scala/scala/tools/partest/nest/StreamCapture.scala
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,12 @@ object StreamCapture {
def withExtraProperties[A](extra: Map[String, String])(action: => A): A = {
val saved = System.getProperties()
val modified = new java.util.Properties()
modified.putAll(saved)
// on Java 9, we need to cast our way around this:
// src/main/scala/scala/tools/partest/nest/StreamCapture.scala:44: ambiguous reference to overloaded definition,
// both method putAll in class Properties of type (x$1: java.util.Map[_, _])Unit
// and method putAll in class Hashtable of type (x$1: java.util.Map[_ <: Object, _ <: Object])Unit
// match argument types (java.util.Properties)
(modified: java.util.Hashtable[AnyRef, AnyRef]).putAll(saved)
extra.foreach { case (k, v) => modified.setProperty(k, v) }
// Trying to avoid other threads seeing the new properties object prior to the new entries
// https://github.com/scala/scala/pull/6391#issuecomment-371346171
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/scala/tools/partest/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ package object partest {
*/
def instantiate[A >: Null](name: String): A = (
catching(classOf[ClassNotFoundException], classOf[SecurityException]) opt
(loader loadClass name).newInstance.asInstanceOf[A] orNull
(loader loadClass name).getConstructor().newInstance().asInstanceOf[A] orNull
)
}

Expand Down