From cb8fa8278ce690a800e6454d3fcd2058100e0d71 Mon Sep 17 00:00:00 2001 From: Dmitry Petrashko Date: Fri, 1 May 2015 16:00:10 +0200 Subject: It seems one cannot define clone member in scala trait. Do it in Java. [error] /Users/dark/workspace/dotty/src/dotty/runtime/vc/VCPrototype.scala:10: overriding method clone in class VCArrayPrototype of type ()Object; [error] method clone in class Object of type ()Object has weaker access privileges; it should be public; [error] (Note that method clone in class VCArrayPrototype of type ()Object is abstract, [error] and is therefore overridden by concrete method clone in class Object of type ()Object) [error] abstract class VCArrayPrototype[T <: VCPrototype] extends Object with Cloneable { --- src/dotty/runtime/vc/VCArrayClone.java | 9 +++++++++ src/dotty/runtime/vc/VCPrototype.scala | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 src/dotty/runtime/vc/VCArrayClone.java (limited to 'src') diff --git a/src/dotty/runtime/vc/VCArrayClone.java b/src/dotty/runtime/vc/VCArrayClone.java new file mode 100644 index 000000000..0b0fa40ce --- /dev/null +++ b/src/dotty/runtime/vc/VCArrayClone.java @@ -0,0 +1,9 @@ +package dotty.runtime.vc; + +/** + * Exists for the sole reason of Scala not accepting such trait + */ + +interface VCArrayClone { + Object clone(); +} diff --git a/src/dotty/runtime/vc/VCPrototype.scala b/src/dotty/runtime/vc/VCPrototype.scala index b9c931bbc..a91654864 100644 --- a/src/dotty/runtime/vc/VCPrototype.scala +++ b/src/dotty/runtime/vc/VCPrototype.scala @@ -3,7 +3,8 @@ package dotty.runtime.vc abstract class VCPrototype { } -abstract class VCArrayPrototype[T <: VCPrototype] extends Cloneable { + +abstract class VCArrayPrototype[T <: VCPrototype] extends Object with Cloneable with VCArrayClone { def apply(idx: Int): Object def update(idx: Int, el: T): Unit def length: Int -- cgit v1.2.3