From 25ceeb3af0fa27fa28e5a1af1675e352128a977f Mon Sep 17 00:00:00 2001 From: konsoletyper Date: Sun, 25 Jan 2015 18:32:15 +0400 Subject: [PATCH] Fix error in System.arraycopy --- .../java/org/teavm/classlib/java/lang/TSystem.java | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TSystem.java b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TSystem.java index f8b19f4da..3c44a0938 100644 --- a/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TSystem.java +++ b/teavm-classlib/src/main/java/org/teavm/classlib/java/lang/TSystem.java @@ -47,15 +47,8 @@ public final class TSystem extends TObject { } if (srcType != targetType) { if (!srcType.isPrimitive() && !targetType.isPrimitive()) { - Object[] srcArray = (Object[])(Object)src; - Object[] dstArray = (Object[])(Object)dest; - for (int i = 0; i < length; ++i) { - Object elem = srcArray[srcPos++]; - if (!targetType.isInstance(elem)) { - throw new TArrayStoreException(); - } - dstArray[destPos++] = elem; - } + doArrayCopy(src, srcPos, dest, destPos, length); + return; } else if (!srcType.isPrimitive() || !targetType.isPrimitive()) { throw new TArrayStoreException(); }