diff options
author | Lukas Rytz <lukas.rytz@gmail.com> | 2015-11-27 17:09:34 +0100 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@gmail.com> | 2015-11-27 17:09:34 +0100 |
commit | 2a750349094591227e601a2d010d9bda415c99dc (patch) | |
tree | 27fef27c28ef973039d929ecea365046b57a95f0 /src/reflect | |
parent | f5de0a5c7cbb28e6983fed31605faa6d26f80bb4 (diff) | |
parent | 5e99f82159842c5e2b60a1427e129b0b720a0d38 (diff) | |
download | scala-2a750349094591227e601a2d010d9bda415c99dc.tar.gz scala-2a750349094591227e601a2d010d9bda415c99dc.tar.bz2 scala-2a750349094591227e601a2d010d9bda415c99dc.zip |
Merge commit '5e99f82' into merge-2.11-to-2.12-nov-27
Diffstat (limited to 'src/reflect')
4 files changed, 8 insertions, 8 deletions
diff --git a/src/reflect/scala/reflect/internal/util/WeakHashSet.scala b/src/reflect/scala/reflect/internal/util/WeakHashSet.scala index 3a7a7626fb..83d2a3453b 100644 --- a/src/reflect/scala/reflect/internal/util/WeakHashSet.scala +++ b/src/reflect/scala/reflect/internal/util/WeakHashSet.scala @@ -41,7 +41,7 @@ final class WeakHashSet[A <: AnyRef](val initialCapacity: Int, val loadFactor: D * power of two equal to or greater than the specified initial capacity */ private def computeCapacity = { - if (initialCapacity < 0) throw new IllegalArgumentException("initial capacity cannot be less than 0"); + if (initialCapacity < 0) throw new IllegalArgumentException("initial capacity cannot be less than 0") var candidate = 1 while (candidate < initialCapacity) { candidate *= 2 @@ -372,13 +372,13 @@ final class WeakHashSet[A <: AnyRef](val initialCapacity: Int, val loadFactor: D * Number of buckets that hold collisions. Useful for diagnosing performance issues. */ def collisionBucketsCount: Int = - (table filter (entry => entry != null && entry.tail != null)).size + (table count (entry => entry != null && entry.tail != null)) /** * Number of buckets that are occupied in this hash table. */ def fullBucketsCount: Int = - (table filter (entry => entry != null)).size + (table count (entry => entry != null)) /** * Number of buckets in the table diff --git a/src/reflect/scala/reflect/macros/Attachments.scala b/src/reflect/scala/reflect/macros/Attachments.scala index b5c340645a..0b5360c004 100644 --- a/src/reflect/scala/reflect/macros/Attachments.scala +++ b/src/reflect/scala/reflect/macros/Attachments.scala @@ -39,7 +39,7 @@ abstract class Attachments { self => /** An underlying payload of the given class type `T`. */ def get[T: ClassTag]: Option[T] = - (all filter matchesTag[T]).headOption.asInstanceOf[Option[T]] + (all find matchesTag[T]).asInstanceOf[Option[T]] /** Check underlying payload contains an instance of type `T`. */ def contains[T: ClassTag]: Boolean = diff --git a/src/reflect/scala/reflect/runtime/ReflectionUtils.scala b/src/reflect/scala/reflect/runtime/ReflectionUtils.scala index a4bd698068..a278ed3fd7 100644 --- a/src/reflect/scala/reflect/runtime/ReflectionUtils.scala +++ b/src/reflect/scala/reflect/runtime/ReflectionUtils.scala @@ -72,7 +72,7 @@ object ReflectionUtils { def singletonAccessor(clazz: Class[_]): Option[Method] = if (clazz == null) None else { - val declaredAccessor = clazz.getDeclaredMethods.filter(_.getName == accessorName).headOption + val declaredAccessor = clazz.getDeclaredMethods.find(_.getName == accessorName) declaredAccessor orElse singletonAccessor(clazz.getSuperclass) } @@ -92,7 +92,7 @@ object ReflectionUtils { } class EnclosedIn[T](enclosure: jClass[_] => T) { - def unapply(jclazz: jClass[_]): Option[T] = if (enclosure(jclazz) != null) Some(enclosure(jclazz)) else None + def unapply(jclazz: jClass[_]): Option[T] = Option(enclosure(jclazz)) } object EnclosedInMethod extends EnclosedIn(_.getEnclosingMethod) diff --git a/src/reflect/scala/reflect/runtime/SynchronizedOps.scala b/src/reflect/scala/reflect/runtime/SynchronizedOps.scala index 4a8585d616..f0d96e0fd6 100644 --- a/src/reflect/scala/reflect/runtime/SynchronizedOps.scala +++ b/src/reflect/scala/reflect/runtime/SynchronizedOps.scala @@ -15,7 +15,7 @@ private[reflect] trait SynchronizedOps extends internal.SymbolTable override protected def newBaseTypeSeq(parents: List[Type], elems: Array[Type]) = // only need to synchronize BaseTypeSeqs if they contain refined types - if (elems.filter(_.isInstanceOf[RefinedType]).nonEmpty) new BaseTypeSeq(parents, elems) with SynchronizedBaseTypeSeq + if (elems.exists(_.isInstanceOf[RefinedType])) new BaseTypeSeq(parents, elems) with SynchronizedBaseTypeSeq else new BaseTypeSeq(parents, elems) trait SynchronizedBaseTypeSeq extends BaseTypeSeq { @@ -31,7 +31,7 @@ private[reflect] trait SynchronizedOps extends internal.SymbolTable override def lateMap(f: Type => Type): BaseTypeSeq = // only need to synchronize BaseTypeSeqs if they contain refined types - if (map(f).toList.filter(_.isInstanceOf[RefinedType]).nonEmpty) new MappedBaseTypeSeq(this, f) with SynchronizedBaseTypeSeq + if (map(f).toList.exists(_.isInstanceOf[RefinedType])) new MappedBaseTypeSeq(this, f) with SynchronizedBaseTypeSeq else new MappedBaseTypeSeq(this, f) } |