You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The problem of course is that the access of clone() will be widened to public in any number of AnyRef subclasses, any of which could legally call the method if it would compile.
I can't figure any way to get this signature in. Type alias doesn't get us any closer despite accepting the declaration of a public method:
scala>typeFakeClone= { defclone():AnyRef }
defined typealiasFakeClone
scala>deff(x: FakeClone) = x.clone()
<console>:6:error: method clone cannot be accessed in FakeClonedeff(x: FakeClone) = x.clone()
^
The text was updated successfully, but these errors were encountered:
scala> class A { override def clone(): A = new A }
defined class A
scala> class C { override def clone(): A = new A }
defined class C
scala> List(new A, new C)
res0: List[ScalaObject{protected[package lang] def clone(): A}] = List(A@2b619bca, C@153b0106)
The problem of course is that the access of clone() will be widened to public in any number of AnyRef subclasses, any of which could legally call the method if it would compile.
I can't figure any way to get this signature in. Type alias doesn't get us any closer despite accepting the declaration of a public method:
The text was updated successfully, but these errors were encountered: