From 68d527c83939a024de831575a041c48dec335bce Mon Sep 17 00:00:00 2001 From: James Strachan Date: Tue, 20 Dec 2011 17:02:30 +0000 Subject: [PATCH] removed some warnings and reduntant code --- stdlib/ktSrc/JavaUtil.kt | 14 +++++--------- testlib/src/Test.kt | 2 +- testlib/test/CollectionTest.kt | 2 +- 3 files changed, 7 insertions(+), 11 deletions(-) diff --git a/stdlib/ktSrc/JavaUtil.kt b/stdlib/ktSrc/JavaUtil.kt index c9ef555cf0d..a96ac23b357 100644 --- a/stdlib/ktSrc/JavaUtil.kt +++ b/stdlib/ktSrc/JavaUtil.kt @@ -156,15 +156,11 @@ inline fun java.lang.Iterable.toList() : List { } inline fun java.util.Collection.toArray() : Array { - if (this is Array) - return this - else { - val answer = Array(this.size) - var idx = 0 - for (elem in this) - answer[idx++] = elem - return answer as Array - } + val answer = Array(this.size) + var idx = 0 + for (elem in this) + answer[idx++] = elem + return answer as Array } diff --git a/testlib/src/Test.kt b/testlib/src/Test.kt index b586a0ff4e3..80fc3550f26 100644 --- a/testlib/src/Test.kt +++ b/testlib/src/Test.kt @@ -44,7 +44,7 @@ fun fails(block: fun() : Any) { } fun todo(block: fun(): Any) { - println("TODO at " + Exception().getStackTrace()?.get(1)) + println("TODO at " + Exception().getStackTrace()?.get(1) + " for " + block) } /* diff --git a/testlib/test/CollectionTest.kt b/testlib/test/CollectionTest.kt index 3768820f61a..eb079534850 100644 --- a/testlib/test/CollectionTest.kt +++ b/testlib/test/CollectionTest.kt @@ -104,7 +104,7 @@ class CollectionTest() : TestSupport() { fun testForeach() { var count = 0 - val x = data.foreach{ count += it.length } + data.foreach{ count += it.length } assertEquals(6, count) }