diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/backend/icode/GenICode.scala | 10 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala | 11 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/symtab/Definitions.scala | 107 | ||||
-rw-r--r-- | src/library/scala/runtime/BoxedAnyArray.scala | 48 | ||||
-rw-r--r-- | src/library/scala/runtime/BoxedBooleanArray.scala | 4 | ||||
-rw-r--r-- | src/library/scala/runtime/BoxedByteArray.scala | 4 | ||||
-rw-r--r-- | src/library/scala/runtime/BoxedCharArray.scala | 4 | ||||
-rw-r--r-- | src/library/scala/runtime/BoxedDoubleArray.scala | 4 | ||||
-rw-r--r-- | src/library/scala/runtime/BoxedFloatArray.scala | 4 | ||||
-rw-r--r-- | src/library/scala/runtime/BoxedIntArray.scala | 4 | ||||
-rw-r--r-- | src/library/scala/runtime/BoxedLongArray.scala | 4 | ||||
-rw-r--r-- | src/library/scala/runtime/BoxedShortArray.scala | 4 |
12 files changed, 69 insertions, 139 deletions
diff --git a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala index 0bf4bfe83c..3cf3034dcf 100644 --- a/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala +++ b/src/compiler/scala/tools/nsc/backend/icode/GenICode.scala @@ -43,6 +43,10 @@ abstract class GenICode extends SubComponent { val SCALA_ALLREF = REFERENCE(definitions.AllRefClass) val THROWABLE = REFERENCE(definitions.ThrowableClass) + val BoxedCharacterClass = definitions.getClass("java.lang.Character") + val Comparator_equals = definitions.getMember(definitions.getModule("scala.runtime.Comparator"), + nme.equals_) + /** Tree transformer that makes fresh label defs. */ val duplicator = new DuplicateLabels @@ -1380,16 +1384,16 @@ abstract class GenICode extends SubComponent { (lsym == definitions.ObjectClass) || (rsym == definitions.ObjectClass) || (lsym isNonBottomSubClass definitions.BoxedNumberClass)|| - (lsym isNonBottomSubClass definitions.BoxedCharacterClass) || + (lsym isNonBottomSubClass BoxedCharacterClass) || (rsym isNonBottomSubClass definitions.BoxedNumberClass) || - (rsym isNonBottomSubClass definitions.BoxedCharacterClass) + (rsym isNonBottomSubClass BoxedCharacterClass) } if (mustUseAnyComparator) { val ctx1 = genLoad(l, ctx, ANY_REF_CLASS) val ctx2 = genLoad(r, ctx1, ANY_REF_CLASS) - ctx2.bb.emit(CALL_METHOD(definitions.Comparator_equals, Static(false))) + ctx2.bb.emit(CALL_METHOD(Comparator_equals, Static(false))) ctx2.bb.emit(CZJUMP(thenCtx.bb, elseCtx.bb, NE, BOOL)) ctx2.bb.close diff --git a/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala b/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala index 14ba2de049..197c95d4d6 100644 --- a/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala +++ b/src/compiler/scala/tools/nsc/backend/jvm/GenJVM.scala @@ -57,6 +57,7 @@ abstract class GenJVM extends SubComponent { class BytecodeGenerator { val MIN_SWITCH_DENSITY = 0.7 val StringBufferClass = if (settings.target.value == "jvm-1.5") "java.lang.StringBuilder" else "java.lang.StringBuffer" + val BoxesUtility = "scala.runtime.BoxesUtility" val stringBufferType = new JObjectType(StringBufferClass) val toStringType = new JMethodType(JObjectType.JAVA_LANG_STRING, JType.EMPTY_ARRAY) @@ -787,17 +788,13 @@ abstract class GenJVM extends SubComponent { } case BOX(kind) => - val kindSymbol = kind.toType.symbol - val boxMethod = definitions.boxMethod(kindSymbol) - val boxedType = definitions.boxedClass(kindSymbol) + val boxedType = definitions.boxedClass(kind.toType.symbol) val mtype = new JMethodType(javaType(boxedType), Array(javaType(kind))) - jcode.emitINVOKESTATIC(javaName(definitions.BoxesUtilityModule), boxMethod.name.toString, mtype) + jcode.emitINVOKESTATIC(BoxesUtility, "boxTo" + boxedType.nameString, mtype) case UNBOX(kind) => - val kindSymbol = kind.toType.symbol - val unboxMethod = definitions.unboxMethod(kindSymbol) val mtype = new JMethodType(javaType(kind), Array(JObjectType.JAVA_LANG_OBJECT)) - jcode.emitINVOKESTATIC(javaName(definitions.BoxesUtilityModule), unboxMethod.name.toString, mtype) + jcode.emitINVOKESTATIC(BoxesUtility, "unboxTo" + kind.toType.symbol.nameString, mtype) case NEW(REFERENCE(cls)) => val className = javaName(cls) diff --git a/src/compiler/scala/tools/nsc/symtab/Definitions.scala b/src/compiler/scala/tools/nsc/symtab/Definitions.scala index b52b4fbdca..c52f2c7c4c 100644 --- a/src/compiler/scala/tools/nsc/symtab/Definitions.scala +++ b/src/compiler/scala/tools/nsc/symtab/Definitions.scala @@ -109,9 +109,6 @@ trait Definitions { def checkDefinedMethod = getMember(ScalaRunTimeModule, "checkDefined") def isArrayMethod = getMember(ScalaRunTimeModule, "isArray") var NotNullClass: Symbol = _ - var BoxesUtilityModule: Symbol = _ - var ComparatorModule: Symbol = _ - def Comparator_equals = getMember(ComparatorModule, nme.equals_) var RepeatedParamClass: Symbol = _ var ByNameParamClass: Symbol = _ //var UnsealedClass: Symbol = _ @@ -362,7 +359,6 @@ trait Definitions { var BoxedObjectArrayClass: Symbol = _ var BoxedUnitClass: Symbol = _ var BoxedNumberClass: Symbol = _ - var BoxedCharacterClass: Symbol = _ var BoxedUnitModule: Symbol = _ def BoxedUnit_UNIT = getMember(BoxedUnitModule, "UNIT") var ObjectRefClass: Symbol = _ @@ -453,82 +449,11 @@ trait Definitions { .setInfo(mkTypeBounds(AllClass.typeConstructor, AnyClass.typeConstructor)) val boxedClass = new HashMap[Symbol, Symbol] + val unboxMethod = new HashMap[Symbol, Symbol] // Type -> Method + val boxMethod = new HashMap[Symbol, Symbol] // Type -> Method + val boxedArrayClass = new HashMap[Symbol, Symbol] - private var unboxMethodCache: collection.mutable.Map[Symbol, Symbol] = null - def unboxMethod = - if (unboxMethodCache != null) unboxMethodCache - else { - unboxMethodCache = new collection.mutable.Map[Symbol, Symbol] { - private val container = new HashMap[Symbol, Symbol] - private val classes = - List(BooleanClass, ByteClass, ShortClass, CharClass, IntClass, LongClass, FloatClass, DoubleClass) - for (val cl <- classes) - container.update(cl, getMember(BoxesUtilityModule, "unboxTo" + cl.name)) - def -= (key: Symbol): Unit = throw new Error() - def update(key: Symbol, value: Symbol): Unit = - container.update(key, value) - def size: Int = container.size - def elements = container.elements - def get(key: Symbol): Option[Symbol] = container.get(key) - } - unboxMethodCache - } - - private var boxMethodCache: collection.mutable.Map[Symbol, Symbol] = null - def boxMethod = - if (boxMethodCache != null) boxMethodCache - else { - boxMethodCache = new collection.mutable.Map[Symbol, Symbol] { - private val container = new HashMap[Symbol, Symbol] - private val BooleanClass = definitions.BooleanClass - private val ByteClass = definitions.ByteClass - private val CharClass = definitions.CharClass - private val ShortClass = definitions.ShortClass - private val IntClass = definitions.IntClass - private val LongClass = definitions.LongClass - private val FloatClass = definitions.FloatClass - private val DoubleClass = definitions.DoubleClass - private val classes = - List(BooleanClass, ByteClass, ShortClass, CharClass, IntClass, LongClass, FloatClass, DoubleClass) - for (val cl <- classes) { - val boxedName = - if (!forMSIL) cl match { - case BooleanClass => "Boolean" - case ByteClass => "Byte" - case CharClass => "Character" - case ShortClass => "Short" - case IntClass => "Integer" - case LongClass => "Long" - case FloatClass => "Float" - case DoubleClass => "Double" - } - else cl match { - case BooleanClass => "Boolean" - case ByteClass => "Byte" - case CharClass => "Char" - case ShortClass => "Int16" - case IntClass => "Int32" - case LongClass => "Int64" - case FloatClass => "Single" - case DoubleClass => "Double" - } - container.update(cl, getMember(BoxesUtilityModule, "boxTo" + boxedName)) - } - def -= (key: Symbol): Unit = throw new Error() - def update(key: Symbol, value: Symbol): Unit = { - assert(value.isMethod) - container.update(key, value) - } - def size: Int = container.size - def elements = container.elements - def get(key: Symbol): Option[Symbol] = container.get(key) - } - boxMethodCache - } - - val boxedArrayClass: collection.mutable.Map[Symbol, Symbol] = new HashMap[Symbol, Symbol] - - def isUnbox(m: Symbol) = (unboxMethod.values contains m) && { + def isUnbox(m: Symbol) = m.name == nme.unbox && { m.tpe match { case MethodType(_, restpe) => (unboxMethod get restpe.symbol) match { case Some(`m`) => true @@ -554,7 +479,7 @@ trait Definitions { private def newValueClass(name: Name, tag: char): Symbol = { val boxedName = - if (!forMSIL) name match { + if (!forMSIL) "java.lang." + (name match { case nme.Boolean => "Boolean" case nme.Byte => "Byte" case nme.Char => "Character" @@ -563,8 +488,8 @@ trait Definitions { case nme.Long => "Long" case nme.Float => "Float" case nme.Double => "Double" - } - else name match { + }) + else "System." + (name match { case nme.Boolean => "Boolean" case nme.Byte => "Byte" case nme.Char => "Char" @@ -573,13 +498,12 @@ trait Definitions { case nme.Long => "Int64" case nme.Float => "Single" case nme.Double => "Double" - } - val boxedPathName = - if (!forMSIL) "java.lang." + boxedName else "System." + boxedName + }) + val clazz = newClass(ScalaPackageClass, name, List(AnyValClass.typeConstructor)) .setFlag(ABSTRACT | FINAL) - boxedClass(clazz) = getClass(boxedPathName) + boxedClass(clazz) = getClass(boxedName) boxedArrayClass(clazz) = getClass("scala.runtime.Boxed" + name + "Array") refClass(clazz) = getClass("scala.runtime." + name + "Ref") abbrvTag(clazz) = tag @@ -589,6 +513,14 @@ trait Definitions { val mclass = module.moduleClass mclass.setInfo(ClassInfoType(List(), newScope, mclass)) module.setInfo(mclass.tpe) + + val box = newMethod(mclass, nme.box, List(clazz.typeConstructor), + ObjectClass.typeConstructor) + boxMethod(clazz) = box + val unbox = newMethod(mclass, nme.unbox, List(ObjectClass.typeConstructor), + clazz.typeConstructor) + unboxMethod(clazz) = unbox + clazz } @@ -877,8 +809,6 @@ trait Definitions { else "java.lang.IndexOutOfBoundsException") ScalaRunTimeModule = getModule("scala.runtime.ScalaRunTime") NotNullClass = getClass("scala.NotNull") - BoxesUtilityModule = getModule("scala.runtime.BoxesUtility") - ComparatorModule = getModule("scala.runtime.Comparator") RepeatedParamClass = newCovariantPolyClass( ScalaPackageClass, nme.REPEATED_PARAM_CLASS_NAME, tparam => typeRef(SeqClass.typeConstructor.prefix, SeqClass, List(tparam.typeConstructor))) @@ -947,7 +877,6 @@ trait Definitions { BoxedAnyArrayClass = getClass("scala.runtime.BoxedAnyArray") BoxedObjectArrayClass = getClass("scala.runtime.BoxedObjectArray") BoxedUnitClass = getClass("scala.runtime.BoxedUnit") - BoxedCharacterClass = getClass("java.lang.Character") BoxedUnitModule = getModule("scala.runtime.BoxedUnit") ObjectRefClass = getClass("scala.runtime.ObjectRef") diff --git a/src/library/scala/runtime/BoxedAnyArray.scala b/src/library/scala/runtime/BoxedAnyArray.scala index d6093fe027..34cf4b3776 100644 --- a/src/library/scala/runtime/BoxedAnyArray.scala +++ b/src/library/scala/runtime/BoxedAnyArray.scala @@ -31,21 +31,21 @@ final class BoxedAnyArray(val length: Int) extends BoxedArray { if (unboxed eq null) boxed(index); else if (elemClass eq classOf[Int]) - BoxesUtility.boxToInteger(unboxed.asInstanceOf[Array[Int]](index)) + Int.box(unboxed.asInstanceOf[Array[Int]](index)) else if (elemClass eq classOf[Double]) - BoxesUtility.boxToDouble(unboxed.asInstanceOf[Array[Double]](index)) + Double.box(unboxed.asInstanceOf[Array[Double]](index)) else if (elemClass eq classOf[Float]) - BoxesUtility.boxToFloat(unboxed.asInstanceOf[Array[Float]](index)) + Float.box(unboxed.asInstanceOf[Array[Float]](index)) else if (elemClass eq classOf[Long]) - BoxesUtility.boxToLong(unboxed.asInstanceOf[Array[Long]](index)) + Long.box(unboxed.asInstanceOf[Array[Long]](index)) else if (elemClass eq classOf[Char]) - BoxesUtility.boxToCharacter(unboxed.asInstanceOf[Array[Char]](index)) + Char.box(unboxed.asInstanceOf[Array[Char]](index)) else if (elemClass eq classOf[Byte]) - BoxesUtility.boxToByte(unboxed.asInstanceOf[Array[Byte]](index)) + Byte.box(unboxed.asInstanceOf[Array[Byte]](index)) else if (elemClass eq classOf[Short]) - BoxesUtility.boxToShort(unboxed.asInstanceOf[Array[Short]](index)) + Short.box(unboxed.asInstanceOf[Array[Short]](index)) else if (elemClass eq classOf[Boolean]) - BoxesUtility.boxToBoolean(unboxed.asInstanceOf[Array[Boolean]](index)) + Boolean.box(unboxed.asInstanceOf[Array[Boolean]](index)) else unboxed.asInstanceOf[Array[AnyRef]](index) } @@ -55,21 +55,21 @@ final class BoxedAnyArray(val length: Int) extends BoxedArray { if (unboxed eq null) boxed(index) = elem else if (elemClass eq classOf[Int]) - unboxed.asInstanceOf[Array[Int]](index) = BoxesUtility.unboxToInt(elem) + unboxed.asInstanceOf[Array[Int]](index) = Int.unbox(elem) else if (elemClass eq classOf[Double]) - unboxed.asInstanceOf[Array[Double]](index) = BoxesUtility.unboxToDouble(elem) + unboxed.asInstanceOf[Array[Double]](index) = Double.unbox(elem) else if (elemClass eq classOf[Float]) - unboxed.asInstanceOf[Array[Float]](index) = BoxesUtility.unboxToFloat(elem) + unboxed.asInstanceOf[Array[Float]](index) = Float.unbox(elem) else if (elemClass eq classOf[Long]) - unboxed.asInstanceOf[Array[Long]](index) = BoxesUtility.unboxToLong(elem) + unboxed.asInstanceOf[Array[Long]](index) = Long.unbox(elem) else if (elemClass eq classOf[Char]) - unboxed.asInstanceOf[Array[Char]](index) = BoxesUtility.unboxToChar(elem) + unboxed.asInstanceOf[Array[Char]](index) = Char.unbox(elem) else if (elemClass eq classOf[Byte]) - unboxed.asInstanceOf[Array[Byte]](index) = BoxesUtility.unboxToByte(elem) + unboxed.asInstanceOf[Array[Byte]](index) = Byte.unbox(elem) else if (elemClass eq classOf[Short]) - unboxed.asInstanceOf[Array[Short]](index) = BoxesUtility.unboxToShort(elem) + unboxed.asInstanceOf[Array[Short]](index) = Short.unbox(elem) else if (elemClass eq classOf[Boolean]) - unboxed.asInstanceOf[Array[Boolean]](index) = BoxesUtility.unboxToBoolean(elem) + unboxed.asInstanceOf[Array[Boolean]](index) = Boolean.unbox(elem) else unboxed.asInstanceOf[Array[AnyRef]](index) = elem } @@ -92,7 +92,7 @@ final class BoxedAnyArray(val length: Int) extends BoxedArray { val newvalue = new Array[Int](length) var i = 0 while (i < length) { - newvalue(i) = BoxesUtility.unboxToInt(boxed(i)) + newvalue(i) = Int.unbox(boxed(i)) i = i + 1 } unboxed = newvalue @@ -100,7 +100,7 @@ final class BoxedAnyArray(val length: Int) extends BoxedArray { val newvalue = new Array[Double](length) var i = 0 while (i < length) { - newvalue(i) = BoxesUtility.unboxToDouble(boxed(i)) + newvalue(i) = Double.unbox(boxed(i)) i = i + 1 } unboxed = newvalue; @@ -108,7 +108,7 @@ final class BoxedAnyArray(val length: Int) extends BoxedArray { val newvalue = new Array[Float](length) var i = 0 while (i < length) { - newvalue(i) = BoxesUtility.unboxToFloat(boxed(i)) + newvalue(i) = Float.unbox(boxed(i)) i = i + 1 } unboxed = newvalue; @@ -116,7 +116,7 @@ final class BoxedAnyArray(val length: Int) extends BoxedArray { val newvalue = new Array[Long](length) var i = 0 while (i < length) { - newvalue(i) = BoxesUtility.unboxToLong(boxed(i)) + newvalue(i) = Long.unbox(boxed(i)) i = i + 1 } unboxed = newvalue; @@ -124,7 +124,7 @@ final class BoxedAnyArray(val length: Int) extends BoxedArray { val newvalue = new Array[Char](length) var i = 0 while (i < length) { - newvalue(i) = BoxesUtility.unboxToChar(boxed(i)) + newvalue(i) = Char.unbox(boxed(i)) i = i + 1 } unboxed = newvalue @@ -132,7 +132,7 @@ final class BoxedAnyArray(val length: Int) extends BoxedArray { val newvalue = new Array[Byte](length) var i = 0 while (i < length) { - newvalue(i) = BoxesUtility.unboxToByte(boxed(i)) + newvalue(i) = Byte.unbox(boxed(i)) i = i + 1 } unboxed = newvalue; @@ -140,7 +140,7 @@ final class BoxedAnyArray(val length: Int) extends BoxedArray { val newvalue = new Array[Short](length) var i = 0 while (i < length) { - newvalue(i) = BoxesUtility.unboxToShort(boxed(i)) + newvalue(i) = Short.unbox(boxed(i)) i = i + 1 } unboxed = newvalue; @@ -148,7 +148,7 @@ final class BoxedAnyArray(val length: Int) extends BoxedArray { val newvalue = new Array[Boolean](length) var i = 0 while (i < length) { - newvalue(i) = BoxesUtility.unboxToBoolean(boxed(i)) + newvalue(i) = Boolean.unbox(boxed(i)) i = i + 1 } unboxed = newvalue; diff --git a/src/library/scala/runtime/BoxedBooleanArray.scala b/src/library/scala/runtime/BoxedBooleanArray.scala index e0ff708205..1f0567abad 100644 --- a/src/library/scala/runtime/BoxedBooleanArray.scala +++ b/src/library/scala/runtime/BoxedBooleanArray.scala @@ -19,10 +19,10 @@ final class BoxedBooleanArray(val value: Array[Boolean]) extends BoxedArray { def length: Int = value.length - def apply(index: Int): Any = BoxesUtility.boxToBoolean(value(index)) + def apply(index: Int): Any = Boolean.box(value(index)) def update(index: Int, elem: Any): Unit = { - value(index) = BoxesUtility.unboxToBoolean(elem.asInstanceOf[AnyRef]) + value(index) = Boolean.unbox(elem.asInstanceOf[AnyRef]) } def unbox(elemTag: String): AnyRef = value diff --git a/src/library/scala/runtime/BoxedByteArray.scala b/src/library/scala/runtime/BoxedByteArray.scala index cf3d6bee6a..753dbaea04 100644 --- a/src/library/scala/runtime/BoxedByteArray.scala +++ b/src/library/scala/runtime/BoxedByteArray.scala @@ -19,10 +19,10 @@ final class BoxedByteArray(val value: Array[Byte]) extends BoxedArray { def length: Int = value.length - def apply(index: Int): Any = BoxesUtility.boxToByte(value(index)) + def apply(index: Int): Any = Byte.box(value(index)) def update(index: Int, elem: Any): Unit = { - value(index) = BoxesUtility.unboxToByte(elem.asInstanceOf[AnyRef]) + value(index) = Byte.unbox(elem.asInstanceOf[AnyRef]) } def unbox(elemTag: String): AnyRef = value diff --git a/src/library/scala/runtime/BoxedCharArray.scala b/src/library/scala/runtime/BoxedCharArray.scala index c13a31134a..adb14dda51 100644 --- a/src/library/scala/runtime/BoxedCharArray.scala +++ b/src/library/scala/runtime/BoxedCharArray.scala @@ -19,10 +19,10 @@ final class BoxedCharArray(val value: Array[Char]) extends BoxedArray { def length: Int = value.length - def apply(index: Int): Any = BoxesUtility.boxToCharacter(value(index)) + def apply(index: Int): Any = Char.box(value(index)) def update(index: Int, elem: Any): Unit = { - value(index) = BoxesUtility.unboxToChar(elem.asInstanceOf[AnyRef]) + value(index) = Char.unbox(elem.asInstanceOf[AnyRef]) } def unbox(elemTag: String): AnyRef = value diff --git a/src/library/scala/runtime/BoxedDoubleArray.scala b/src/library/scala/runtime/BoxedDoubleArray.scala index 08c3b6b843..9a4564e439 100644 --- a/src/library/scala/runtime/BoxedDoubleArray.scala +++ b/src/library/scala/runtime/BoxedDoubleArray.scala @@ -19,10 +19,10 @@ final class BoxedDoubleArray(val value: Array[Double]) extends BoxedArray { def length: Int = value.length - def apply(index: Int): Any = BoxesUtility.boxToDouble(value(index)) + def apply(index: Int): Any = Double.box(value(index)) def update(index: Int, elem: Any): Unit = { - value(index) = BoxesUtility.unboxToDouble(elem.asInstanceOf[AnyRef]) + value(index) = Double.unbox(elem.asInstanceOf[AnyRef]) } def unbox(elemTag: String): AnyRef = value diff --git a/src/library/scala/runtime/BoxedFloatArray.scala b/src/library/scala/runtime/BoxedFloatArray.scala index 13424f136b..1b8ccb3797 100644 --- a/src/library/scala/runtime/BoxedFloatArray.scala +++ b/src/library/scala/runtime/BoxedFloatArray.scala @@ -19,10 +19,10 @@ final class BoxedFloatArray(val value: Array[Float]) extends BoxedArray { def length: Int = value.length - def apply(index: Int): Any = BoxesUtility.boxToFloat(value(index)) + def apply(index: Int): Any = Float.box(value(index)) def update(index: Int, elem: Any): Unit = { - value(index) = BoxesUtility.unboxToFloat(elem.asInstanceOf[AnyRef]) + value(index) = Float.unbox(elem.asInstanceOf[AnyRef]) } def unbox(elemTag: String): AnyRef = value diff --git a/src/library/scala/runtime/BoxedIntArray.scala b/src/library/scala/runtime/BoxedIntArray.scala index a64f4fdb60..d2f5fd0371 100644 --- a/src/library/scala/runtime/BoxedIntArray.scala +++ b/src/library/scala/runtime/BoxedIntArray.scala @@ -19,10 +19,10 @@ final class BoxedIntArray(val value: Array[Int]) extends BoxedArray { def length: Int = value.length - def apply(index: Int): Any = BoxesUtility.boxToInteger(value(index)) + def apply(index: Int): Any = Int.box(value(index)) def update(index: Int, elem: Any): Unit = { - value(index) = BoxesUtility.unboxToInt(elem.asInstanceOf[AnyRef]) + value(index) = Int.unbox(elem.asInstanceOf[AnyRef]) } def unbox(elemTag: String): AnyRef = value diff --git a/src/library/scala/runtime/BoxedLongArray.scala b/src/library/scala/runtime/BoxedLongArray.scala index db4b266e1b..6accc84484 100644 --- a/src/library/scala/runtime/BoxedLongArray.scala +++ b/src/library/scala/runtime/BoxedLongArray.scala @@ -19,10 +19,10 @@ final class BoxedLongArray(val value: Array[Long]) extends BoxedArray { def length: Int = value.length - def apply(index: Int): Any = BoxesUtility.boxToLong(value(index)) + def apply(index: Int): Any = Long.box(value(index)) def update(index: Int, elem: Any): Unit = { - value(index) = BoxesUtility.unboxToLong(elem.asInstanceOf[AnyRef]) + value(index) = Long.unbox(elem.asInstanceOf[AnyRef]) } def unbox(elemTag: String): AnyRef = value diff --git a/src/library/scala/runtime/BoxedShortArray.scala b/src/library/scala/runtime/BoxedShortArray.scala index 229ee46727..161b7b921b 100644 --- a/src/library/scala/runtime/BoxedShortArray.scala +++ b/src/library/scala/runtime/BoxedShortArray.scala @@ -19,10 +19,10 @@ final class BoxedShortArray(val value: Array[Short]) extends BoxedArray { def length: Int = value.length - def apply(index: Int): Any = BoxesUtility.boxToShort(value(index)) + def apply(index: Int): Any = Short.box(value(index)) def update(index: Int, elem: Any): Unit = { - value(index) = BoxesUtility.unboxToShort(elem.asInstanceOf[AnyRef]) + value(index) = Short.unbox(elem.asInstanceOf[AnyRef]) } def unbox(elemTag: String): AnyRef = value |