From c1a76844ed9f1ab43dc6757e9c8d7866a5ccc998 Mon Sep 17 00:00:00 2001 From: mihaylov Date: Tue, 10 Oct 2006 11:14:06 +0000 Subject: Made some test cases platform-independent --- src/library/scala/compat/Platform.scala | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src') diff --git a/src/library/scala/compat/Platform.scala b/src/library/scala/compat/Platform.scala index d988df7e3b..9a579af2a1 100644 --- a/src/library/scala/compat/Platform.scala +++ b/src/library/scala/compat/Platform.scala @@ -13,12 +13,29 @@ package scala.compat; object Platform { + + type Class = java.lang.Class; + + type StackOverflowError = java.lang.StackOverflowError; + type ClassCastException = java.lang.ClassCastException; + type RuntimeException = java.lang.RuntimeException; + type IndexOutOfBoundsException = java.lang.IndexOutOfBoundsException; + def arraycopy(src: AnyRef, srcPos: Int, dest: AnyRef, destPos: Int, length: Int): Unit = Array.copy(src, srcPos, dest, destPos, length) + + /** create array of the same type as arrayInstance with the given length */ + def createArray(elemClass: Class, length: Int): Object = + java.lang.reflect.Array.newInstance(elemClass, length); + def getClass(obj: AnyRef) = obj.getClass(); def getClassName(obj: AnyRef) = obj.getClass().getName(); + def getName(cls: Class) = cls.getName(); + def getElementClass(obj: AnyRef) = obj.getClass().getComponentType(); + def printStackTrace(exc: java.lang.Throwable) = exc.printStackTrace(); def getMessage(exc: java.lang.Throwable) = exc.getMessage(); + def split(str: String, separator: Char): Array[String] = { str.split(separator.toString()); } -- cgit v1.2.3