mardi 21 avril 2015

How to implement a nested java interface in scala

Say I have the following legacy java defined:

abstract class A {

  abstract I foo();

  public interface I
  {
    int bar();
  }
}

And I want to implement this in scala something like the following:

class MyA extends A {

  def foo() = new I {

    def bar = 3

  }
}

The scala will not compile with the error

not found: type I

How can I refer to the java interface I in my scala code?

Aucun commentaire:

Enregistrer un commentaire