The problem can be summarised as follows:
I have a class that defines several methods to be called from java. one of them has a signature like:
import java.lang.{Double => JDouble}
def compute(x: Double, fun: Function1[Double,Double]) = ???
or
def compute(x: Double, fun: Double => Double) = ???
when i use javap on any of them, it looks like this:
Double compute(double, scala.Function1<java.lang.Object, java.lang.Object>)
if I use the following aliasing
import java.lang.{Double => JDouble}
def compute(x: Double, fun: JDouble => JDouble) =
it looks correct with javap
public Double compute( double, scala.Function1<java.lang.Double, java.lang.Double>);
Why is this?
In Scala Double extends AnyVal. When you javap this function the nearest super class finds and in case AnyVal the nearest Java super class is Object.
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