diff options
author | Josh Suereth <Joshua.Suereth@gmail.com> | 2012-09-14 12:22:11 -0700 |
---|---|---|
committer | Josh Suereth <Joshua.Suereth@gmail.com> | 2012-09-14 12:22:11 -0700 |
commit | 261b1c785668ae42a29d9217cc4a8f305a724e2f (patch) | |
tree | 77024bdb9e9885b4cc84ea0095eaa84864caeb5d /src/compiler/scala/tools/cmd | |
parent | 83c1b1062957e50e5336c1b3409e54e0a5cce275 (diff) | |
parent | 47587dca4d3fb7c171cff21587b42f40bab77e21 (diff) | |
download | scala-261b1c785668ae42a29d9217cc4a8f305a724e2f.tar.gz scala-261b1c785668ae42a29d9217cc4a8f305a724e2f.tar.bz2 scala-261b1c785668ae42a29d9217cc4a8f305a724e2f.zip |
Merge pull request #1304 from paulp/topic/empty-array-optimization
Topic/empty array optimization
Diffstat (limited to 'src/compiler/scala/tools/cmd')
-rw-r--r-- | src/compiler/scala/tools/cmd/gen/AnyVals.scala | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/compiler/scala/tools/cmd/gen/AnyVals.scala b/src/compiler/scala/tools/cmd/gen/AnyVals.scala index 910804245b..b4f5641b98 100644 --- a/src/compiler/scala/tools/cmd/gen/AnyVals.scala +++ b/src/compiler/scala/tools/cmd/gen/AnyVals.scala @@ -320,7 +320,13 @@ def unbox(x: java.lang.Object): @name@ = @unboxImpl@ override def toString = "object scala.@name@" """ - def nonUnitCompanions = "" // todo + def nonUnitCompanions = """ +/** A highly reusable empty array, useful for avoiding + * allocations when you need one. + * + * @return a constant 0-length Array[@name@] + */ +final val emptyArray = new Array[@name@](0)""" def cardinalCompanion = """ /** The smallest value representable as a @name@. @@ -341,9 +347,6 @@ final val NaN = @boxed@.NaN final val PositiveInfinity = @boxed@.POSITIVE_INFINITY final val NegativeInfinity = @boxed@.NEGATIVE_INFINITY -@deprecated("use @name@.MinPositiveValue instead", "2.9.0") -final val Epsilon = MinPositiveValue - /** The negative number with the greatest (finite) absolute value which is representable * by a @name@. Note that it differs from [[java.lang.@name@.MIN_VALUE]], which * is the smallest positive value representable by a @name@. In Scala that number |