I made hashmap that contains varous type of data in java and would like to pass it to scala.
In java
HashMap<String, Object> myMap = new HashMap<String, Object>();
In scala
def myApp(myMap: HashMap[String, Any]) // Object -> Any
The hashmap was passed well and used it like below.
val aValue = myMap.getOrDefault("A", "a").asInstanceOf[String]
val bValue = myMap.getOrDefault("B", new Hashmap[String, String]).asInstanceOf[ Hashmap[String, String]]
It wored as I expected, BUT when I tried to build it with gradle to make a jar. It came with this error.
[ant:scalac] myApp.scala:44: error: value getOrDefault is not a member of java.util.HashMap[String, Any]
[ant:scalac] Note: implicit method myEncoder is not applicable here because it comes after the application point and it lacks an explicit result type
[ant:scalac] val aValue = myMap.getOrDefault("A", "a").asInstanceOf[String]
[ant:scalac] ^