I need to call from Java a Scala API that has a parameter with signature Option[Activity]
.
I want to pass Some(this)
, whose class is a derived class from Activity
.
I have tried many things:
new Some<Activity>.apply(this)
Some.apply((Activity)this)
Option.apply((Activity)this)
but I get a compilation error like this:
actual argument Some<Activity> cannot be converted
to Option<Class<? extends Activity>> by method invocation conversion
What is the right way of passing this?
Related questions:
- It talks about
Option[Double]
, and doesn't have inheritance issues: How to call scala's Option constructors from Java