0

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:

Community
  • 1
  • 1
david.perez
  • 6,090
  • 4
  • 34
  • 57

1 Answers1

1

Are you quite sure your method takes an Option[Activity]? Because that message suggests it's taking an Option[Class[_ <: Activity]]. Please post the Scala code and how you're calling it.

lmm
  • 17,386
  • 3
  • 26
  • 37