-1

ERROR: the resulttype of an implicit conversion must be more specific than Object

scala implicit conversion is not work while pass parameter as HashMap to use java thirdparty library.

Looks scala implicit not support java generic type.

I have to explicitly call type convertion function to avoid this issue, such like int2Integer(scala.Int)

suiwenfeng
  • 1,865
  • 1
  • 25
  • 32
  • do you have the appropiate import which is import scala.language.implicitConversions – Raman Mishra Sep 12 '18 at 11:52
  • @RamanMishra not working even added compiler option `-language:implicitConversions` – suiwenfeng Sep 12 '18 at 12:10
  • Have you tried to pass it without conversion? I wrote small Java static method which accept primitive `int` and prints it in the console. In my Scala code I passed Scala's `Int` to the Java's method and it works well. I used Java 8 with Scala 2.12.6. – Duelist Sep 12 '18 at 12:35
  • You need to provide more information. What function are you calling that takes `Integer`? Where are you getting the `Int` from? What is the simplest example of failure you can show? – Tim Sep 12 '18 at 12:41

1 Answers1

0

when this error happen, it means scala cannot know the real type needed from java generic type definition.

suiwenfeng
  • 1,865
  • 1
  • 25
  • 32