summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormichelou <michelou@epfl.ch>2007-12-21 16:52:44 +0000
committermichelou <michelou@epfl.ch>2007-12-21 16:52:44 +0000
commit5fbcd57e9651bc9ad8cf28bef4c299b597ca03b6 (patch)
treeae2b01b99931b86f47e7d8318616d37b35b12731
parenta2109868840d6cc181270fc00820dd22943d5c71 (diff)
downloadscala-5fbcd57e9651bc9ad8cf28bef4c299b597ca03b6.tar.gz
scala-5fbcd57e9651bc9ad8cf28bef4c299b597ca03b6.tar.bz2
scala-5fbcd57e9651bc9ad8cf28bef4c299b597ca03b6.zip
updated CLDC library for Class[T]
-rw-r--r--src/cldc-library/scala/Predef.scala10
-rw-r--r--src/cldc-library/scala/compat/Platform.scala6
-rw-r--r--src/cldc-library/scala/runtime/BoxedAnyArray.scala12
-rw-r--r--src/cldc-library/scala/runtime/BoxedObjectArray.scala4
-rw-r--r--src/cldc-library/scala/runtime/ScalaRunTime.scala14
5 files changed, 20 insertions, 26 deletions
diff --git a/src/cldc-library/scala/Predef.scala b/src/cldc-library/scala/Predef.scala
index 1e57534124..4e2ced1c61 100644
--- a/src/cldc-library/scala/Predef.scala
+++ b/src/cldc-library/scala/Predef.scala
@@ -1,6 +1,6 @@
/* __ *\
** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2002-2007, LAMP/EPFL **
+** / __/ __// _ | / / / _ | (c) 2002-2008, LAMP/EPFL **
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
@@ -21,7 +21,7 @@ object Predef {
// classOf dummy ------------------------------------------------------
/** Return the runtime representation of a class type. */
- def classOf[T]: Class = null
+ def classOf[T]: Class[T] = null
// aliases ------------------------------------------------------------
@@ -33,10 +33,6 @@ object Predef {
type boolean = scala.Boolean
type unit = scala.Unit
- /** @deprecated use <code>Nothing</code> instead */
- @deprecated type All = Nothing
- /** @deprecated use <code>Null</code> instead */
- @deprecated type AllRef = Null
/** @deprecated use <code>Int</code> instead */
@deprecated type Integer = java.lang.Integer
/** @deprecated use <code>Char</code> instead */
@@ -44,7 +40,7 @@ object Predef {
type String = java.lang.String
type StringBuilder = compat.StringBuilder
- type Class = java.lang.Class
+ type Class[T] = java.lang.Class[T]
type Runnable = java.lang.Runnable
type Throwable = java.lang.Throwable
diff --git a/src/cldc-library/scala/compat/Platform.scala b/src/cldc-library/scala/compat/Platform.scala
index 8598994a8a..6d2ccbcfbb 100644
--- a/src/cldc-library/scala/compat/Platform.scala
+++ b/src/cldc-library/scala/compat/Platform.scala
@@ -1,6 +1,6 @@
/* __ *\
** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2002-2007, LAMP/EPFL **
+** / __/ __// _ | / / / _ | (c) 2002-2008, LAMP/EPFL **
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
@@ -37,14 +37,14 @@ object Platform {
* @param length ..
* @return ..
*/
- def createArray(elemClass: Class, length: Int): AnyRef =
+ def createArray(elemClass: Class[_], length: Int): AnyRef =
throw new RuntimeException("" + elemClass + "[" + length+ "]")
//java.lang.reflect.Array.newInstance(elemClass, length)
//def arrayclear(arr: Array[Int]): Unit = java.util.Arrays.fill(arr, 0)
def arrayclear(arr: Array[Int]): Unit = for (i <- 0 to arr.length) arr(i) = 0
- def getClassForName(name: String): Class = java.lang.Class.forName(name)
+ def getClassForName(name: String): Class[_] = java.lang.Class.forName(name)
val EOL = "\n"
diff --git a/src/cldc-library/scala/runtime/BoxedAnyArray.scala b/src/cldc-library/scala/runtime/BoxedAnyArray.scala
index b09884d5ec..23768c87bd 100644
--- a/src/cldc-library/scala/runtime/BoxedAnyArray.scala
+++ b/src/cldc-library/scala/runtime/BoxedAnyArray.scala
@@ -1,6 +1,6 @@
/* __ *\
** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2002-2007, LAMP/EPFL **
+** / __/ __// _ | / / / _ | (c) 2002-2008, LAMP/EPFL **
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
@@ -25,7 +25,7 @@ final class BoxedAnyArray(val length: Int) extends BoxedArray {
private var boxed = new Array[AnyRef](length)
private val hash = boxed.hashCode()
private var unboxed: AnyRef = null
- private var elemClass: Class = null
+ private var elemClass: Class[_] = null
def apply(index: Int): Any = synchronized {
if (unboxed eq null)
@@ -75,9 +75,9 @@ final class BoxedAnyArray(val length: Int) extends BoxedArray {
else if (elemTag eq ScalaRunTime.BooleanTag) unbox(classOf[Boolean])
else unbox(Platform.getClassForName(elemTag))
- def unbox(elemClass: Class): AnyRef = synchronized {
+ def unbox(elemClass: Class[_]): AnyRef = synchronized {
if (unboxed eq null) {
- this.elemClass = elemClass;
+ this.elemClass = elemClass
if (elemClass eq classOf[Int]) {
val newvalue = new Array[Int](length)
var i = 0
@@ -109,7 +109,7 @@ final class BoxedAnyArray(val length: Int) extends BoxedArray {
newvalue(i) = Byte.unbox(boxed(i))
i += 1
}
- unboxed = newvalue;
+ unboxed = newvalue
} else if (elemClass eq classOf[Short]) {
val newvalue = new Array[Short](length)
var i = 0
@@ -117,7 +117,7 @@ final class BoxedAnyArray(val length: Int) extends BoxedArray {
newvalue(i) = Short.unbox(boxed(i))
i += 1
}
- unboxed = newvalue;
+ unboxed = newvalue
} else if (elemClass eq classOf[Boolean]) {
val newvalue = new Array[Boolean](length)
var i = 0
diff --git a/src/cldc-library/scala/runtime/BoxedObjectArray.scala b/src/cldc-library/scala/runtime/BoxedObjectArray.scala
index 07b7b9f569..878b7ac042 100644
--- a/src/cldc-library/scala/runtime/BoxedObjectArray.scala
+++ b/src/cldc-library/scala/runtime/BoxedObjectArray.scala
@@ -1,6 +1,6 @@
/* __ *\
** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2002-2007, LAMP/EPFL **
+** / __/ __// _ | / / / _ | (c) 2002-2008, LAMP/EPFL **
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
@@ -27,7 +27,7 @@ final class BoxedObjectArray(val value: Array[AnyRef]) extends BoxedArray {
}
def unbox(elemTag: String): AnyRef = value
- def unbox(elemClass: Class): AnyRef = value
+ def unbox(elemClass: Class[_]): AnyRef = value
override def equals(other: Any): Boolean =
value == other ||
diff --git a/src/cldc-library/scala/runtime/ScalaRunTime.scala b/src/cldc-library/scala/runtime/ScalaRunTime.scala
index 8cabf9c623..004234af8f 100644
--- a/src/cldc-library/scala/runtime/ScalaRunTime.scala
+++ b/src/cldc-library/scala/runtime/ScalaRunTime.scala
@@ -1,6 +1,6 @@
/* __ *\
** ________ ___ / / ___ Scala API **
-** / __/ __// _ | / / / _ | (c) 2002-2007, LAMP/EPFL **
+** / __/ __// _ | / / / _ | (c) 2002-2008, LAMP/EPFL **
** __\ \/ /__/ __ |/ /__/ __ | http://scala-lang.org/ **
** /____/\___/_/ |_/____/_/ | | **
** |/ **
@@ -31,12 +31,10 @@ object ScalaRunTime {
def isValueTag(tag: String) = tag.charAt(0) == '.'
- def isValueClass(clazz: Class) = (clazz == classOf[Boolean]
- || clazz == classOf[Byte]
- || clazz == classOf[Short]
- || clazz == classOf[Char]
- || clazz == classOf[Int]
- || clazz == classOf[Long])
+ def isValueClass(clazz: Class[_]) =
+ clazz == classOf[Boolean] || clazz == classOf[Byte] ||
+ clazz == classOf[Short ] || clazz == classOf[Char] ||
+ clazz == classOf[Int ] || clazz == classOf[Long]
def checkInitialized[T <: AnyRef](x: T): T =
if (x == null) throw new UninitializedError else x
@@ -128,7 +126,7 @@ object ScalaRunTime {
def arrayValue(x: BoxedArray, elemTag: String): AnyRef =
if (x eq null) null else x.unbox(elemTag)
- def arrayValue(x: BoxedArray, elemClass: Class): AnyRef =
+ def arrayValue(x: BoxedArray, elemClass: Class[_]): AnyRef =
if (x eq null) null else x.unbox(elemClass)
def boxArray(value: AnyRef): BoxedArray = value match {