From bcb6cbc935fba12991868bdf582301e29e8d91de Mon Sep 17 00:00:00 2001 From: Andrey Breslav Date: Thu, 25 Apr 2013 21:56:07 +0400 Subject: [PATCH] Premature optimization removed from preloader --- .../jet/preloading/ClassPreloadingUtils.java | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/compiler/preloader/src/org/jetbrains/jet/preloading/ClassPreloadingUtils.java b/compiler/preloader/src/org/jetbrains/jet/preloading/ClassPreloadingUtils.java index e2586a57d5f..733a166d230 100644 --- a/compiler/preloader/src/org/jetbrains/jet/preloading/ClassPreloadingUtils.java +++ b/compiler/preloader/src/org/jetbrains/jet/preloading/ClassPreloadingUtils.java @@ -142,16 +142,15 @@ public class ClassPreloadingUtils { if (resources.containsKey(name)) continue; // Only the first resource is stored int size = (int) entry.getSize(); - boolean unknownArraySize = size < 0; - int effectiveSize = unknownArraySize ? 32 : size; - ByteArrayOutputStreamWithPublicArray bytes = new ByteArrayOutputStreamWithPublicArray(effectiveSize); + int effectiveSize = size < 0 ? 32 : size; + ByteArrayOutputStream bytes = new ByteArrayOutputStream(effectiveSize); int count; while ((count = stream.read(buffer)) > 0) { bytes.write(buffer, 0, count); } - resources.put(name, new ResourceData(jarFile, name, unknownArraySize ? bytes.toByteArray() : bytes.getBytes())); + resources.put(name, new ResourceData(jarFile, name, bytes.toByteArray())); } } finally { @@ -170,17 +169,6 @@ public class ClassPreloadingUtils { return resources; } - private static class ByteArrayOutputStreamWithPublicArray extends ByteArrayOutputStream { - public ByteArrayOutputStreamWithPublicArray(int size) { - super(size); - } - - // To avoid copying the array - public byte[] getBytes() { - return buf; - } - } - private static class ResourceData { private final File jarFile; private final String resourceName;