I want to call a Java method with the following API from Scala:
// Java API
public interface JavaAPI {
JustSomeAPISpecificType clone();
}
// Scala code in class a.b.c.D
val api: JavaAPI = factory.getAPI
val result: JustSomeAPISpecificType = api.clone
However, this does not work, as the Scala compiler (2.10) thinks I want to call Object.clone:
Error: method clone in class Object cannot be accessed in Option[JavaAPI] Access to protected method clone not permitted because prefix type Option[JavaAPI] does not conform to class D in package a.b.c where the access take place
Any ideas? Thanks.
()
at the end of the call toclone
? – wheaties