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

Commit 1761ee5

Browse files
authored
Merge pull request #111 from SethTisue/be-java-9-friendly
some changes so it compiles on Java 9
2 parents b0cc1b6 + 3b1ab83 commit 1761ee5

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

project/build.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
sbt.version=0.13.15
1+
sbt.version=0.13.17

src/main/scala/scala/tools/partest/nest/StreamCapture.scala

+6-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,12 @@ object StreamCapture {
4141
def withExtraProperties[A](extra: Map[String, String])(action: => A): A = {
4242
val saved = System.getProperties()
4343
val modified = new java.util.Properties()
44-
modified.putAll(saved)
44+
// on Java 9, we need to cast our way around this:
45+
// src/main/scala/scala/tools/partest/nest/StreamCapture.scala:44: ambiguous reference to overloaded definition,
46+
// both method putAll in class Properties of type (x$1: java.util.Map[_, _])Unit
47+
// and method putAll in class Hashtable of type (x$1: java.util.Map[_ <: Object, _ <: Object])Unit
48+
// match argument types (java.util.Properties)
49+
(modified: java.util.Hashtable[AnyRef, AnyRef]).putAll(saved)
4550
extra.foreach { case (k, v) => modified.setProperty(k, v) }
4651
// Trying to avoid other threads seeing the new properties object prior to the new entries
4752
// https://github.com/scala/scala/pull/6391#issuecomment-371346171

src/main/scala/scala/tools/partest/package.scala

+1-1
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ package object partest {
9797
*/
9898
def instantiate[A >: Null](name: String): A = (
9999
catching(classOf[ClassNotFoundException], classOf[SecurityException]) opt
100-
(loader loadClass name).newInstance.asInstanceOf[A] orNull
100+
(loader loadClass name).getConstructor().newInstance().asInstanceOf[A] orNull
101101
)
102102
}
103103

0 commit comments

Comments
 (0)