Currently I am facing the following compilation error in Scala against Java 9:
: 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)
newProps.putAll(props)
newProps is defined as:
val newProps = new Properties
I tried variants of newProps.asInstanceOf[java.util.Map[...]] but got different compilation errors.
Any hint is welcome.
As @Ted pointed out this is a known issue. One workardound would be to subsitute putAll with something like this:
props.forEach((k, v) => newProps.put(k, v))
Note that by doing this your operation is not atomic anymore but most probably this is not important in your case.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With