summaryrefslogtreecommitdiff
path: root/src/reflect/scala/tools/nsc/io/ZipArchive.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-09-16 20:44:56 -0700
committerPaul Phillips <paulp@improving.org>2012-09-16 20:53:59 -0700
commitd918144f16111358a61d6f5f847227946bcc17a9 (patch)
tree55dd3ae2790e5ed453575205f83a700b6732dcd4 /src/reflect/scala/tools/nsc/io/ZipArchive.scala
parent5cf6a750eac94d159fe4c67b75e24dde13495e71 (diff)
downloadscala-d918144f16111358a61d6f5f847227946bcc17a9.tar.gz
scala-d918144f16111358a61d6f5f847227946bcc17a9.tar.bz2
scala-d918144f16111358a61d6f5f847227946bcc17a9.zip
Moved constant empty arrays into Array companion.
This reminds me of at least one reason I didn't put them here before: I don't feel like I can return these from calls to Array.empty, because there's no way of knowing whether anyone has been relying upon this property: scala> Array.empty[Byte] eq Array.empty[Byte] res0: Boolean = false Since that is exactly the property I need to alter. The test above is true in all the "real" collections, which is all the more reason to be concerned that someone might be using empty arrays as not-equivalent sentinels. I can still move them here, but it'd be a lot better if array creation could use them - not only def empty but def apply[T: ClassTag](xs: T*): Array[T] which probably creates millions of empty arrays where one would do in almost every case.
Diffstat (limited to 'src/reflect/scala/tools/nsc/io/ZipArchive.scala')
-rw-r--r--src/reflect/scala/tools/nsc/io/ZipArchive.scala2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/reflect/scala/tools/nsc/io/ZipArchive.scala b/src/reflect/scala/tools/nsc/io/ZipArchive.scala
index 9d9d9a46f2..49d2200895 100644
--- a/src/reflect/scala/tools/nsc/io/ZipArchive.scala
+++ b/src/reflect/scala/tools/nsc/io/ZipArchive.scala
@@ -177,7 +177,7 @@ final class URLZipArchive(val url: URL) extends ZipArchive(null) {
class FileEntry() extends Entry(zipEntry.getName) {
override val toByteArray: Array[Byte] = {
val len = zipEntry.getSize().toInt
- val arr = if (len == 0) Byte.emptyArray else new Array[Byte](len)
+ val arr = if (len == 0) Array.emptyByteArray else new Array[Byte](len)
var offset = 0
def loop() {