From 0459db43728e1dc38c3a1db6b7b1920810d0f858 Mon Sep 17 00:00:00 2001 From: Simon Ochsenreither Date: Fri, 5 Jul 2013 17:13:47 +0200 Subject: SI-7624 Fix a few remaining -Xlint warnings ... in various places. This includes actors, compiler (mostly some new macro parts) continuations, partest, scaladoc, scalap. --- src/reflect/scala/reflect/internal/Kinds.scala | 2 +- .../scala/reflect/internal/util/WeakHashSet.scala | 31 +++++++++++----------- .../scala/reflect/runtime/ReflectSetup.scala | 2 +- 3 files changed, 18 insertions(+), 17 deletions(-) (limited to 'src/reflect') diff --git a/src/reflect/scala/reflect/internal/Kinds.scala b/src/reflect/scala/reflect/internal/Kinds.scala index 315bf7e9c4..d1c215713e 100644 --- a/src/reflect/scala/reflect/internal/Kinds.scala +++ b/src/reflect/scala/reflect/internal/Kinds.scala @@ -380,7 +380,7 @@ trait Kinds { object TypeConKind { def apply(args: Seq[TypeConKind.Argument]): TypeConKind = this(TypeBounds.empty, args) def apply(bounds: TypeBounds, args: Seq[TypeConKind.Argument]): TypeConKind = new TypeConKind(bounds, args) - def unapply(tck: TypeConKind): Some[(TypeBounds, Seq[TypeConKind.Argument])] = Some(tck.bounds, tck.args) + def unapply(tck: TypeConKind): Some[(TypeBounds, Seq[TypeConKind.Argument])] = Some((tck.bounds, tck.args)) case class Argument(variance: Variance, kind: Kind)(val sym: Symbol) {} } diff --git a/src/reflect/scala/reflect/internal/util/WeakHashSet.scala b/src/reflect/scala/reflect/internal/util/WeakHashSet.scala index 9b792a3f43..a8bc79d832 100644 --- a/src/reflect/scala/reflect/internal/util/WeakHashSet.scala +++ b/src/reflect/scala/reflect/internal/util/WeakHashSet.scala @@ -4,7 +4,7 @@ package reflect.internal.util import java.lang.ref.{WeakReference, ReferenceQueue} import scala.annotation.tailrec import scala.collection.generic.Clearable -import scala.collection.mutable.{Set => mSet} +import scala.collection.mutable.{Set => MSet} /** * A HashSet where the elements are stored weakly. Elements in this set are elligible for GC if no other @@ -16,8 +16,8 @@ import scala.collection.mutable.{Set => mSet} * This set implmeentation is not in general thread safe without external concurrency control. However it behaves * properly when GC concurrently collects elements in this set. */ -final class WeakHashSet[A <: AnyRef](val initialCapacity: Int, val loadFactor: Double) extends Set[A] with Function1[A, Boolean] with mSet[A] { - +final class WeakHashSet[A <: AnyRef](val initialCapacity: Int, val loadFactor: Double) extends Set[A] with Function1[A, Boolean] with MSet[A] { + import WeakHashSet._ def this() = this(initialCapacity = WeakHashSet.defaultInitialCapacity, loadFactor = WeakHashSet.defaultLoadFactor) @@ -47,7 +47,7 @@ final class WeakHashSet[A <: AnyRef](val initialCapacity: Int, val loadFactor: D candidate *= 2 } candidate - } + } /** * the underlying table of entries which is an array of Entry linked lists @@ -65,7 +65,7 @@ final class WeakHashSet[A <: AnyRef](val initialCapacity: Int, val loadFactor: D * find the bucket associated with an elements's hash code */ private[this] def bucketFor(hash: Int): Int = { - // spread the bits around to try to avoid accidental collisions using the + // spread the bits around to try to avoid accidental collisions using the // same algorithm as java.util.HashMap var h = hash h ^= h >>> 20 ^ h >>> 12 @@ -98,7 +98,7 @@ final class WeakHashSet[A <: AnyRef](val initialCapacity: Int, val loadFactor: D def poll(): Entry[A] = queue.poll().asInstanceOf[Entry[A]] @tailrec - def queueLoop { + def queueLoop(): Unit = { val stale = poll() if (stale != null) { val bucket = bucketFor(stale.hash) @@ -109,11 +109,11 @@ final class WeakHashSet[A <: AnyRef](val initialCapacity: Int, val loadFactor: D linkedListLoop(null, table(bucket)) - queueLoop + queueLoop() } } - - queueLoop + + queueLoop() } /** @@ -123,7 +123,7 @@ final class WeakHashSet[A <: AnyRef](val initialCapacity: Int, val loadFactor: D val oldTable = table table = new Array[Entry[A]](oldTable.size * 2) threshhold = computeThreshHold - + @tailrec def tableLoop(oldBucket: Int): Unit = if (oldBucket < oldTable.size) { @tailrec @@ -225,7 +225,7 @@ final class WeakHashSet[A <: AnyRef](val initialCapacity: Int, val loadFactor: D def +=(elem: A) = this + elem // from scala.reflect.interanl.Set - override def addEntry(x: A) { this += x } + override def addEntry(x: A) { this += x } // remove an element from this set and return this set override def -(elem: A): this.type = elem match { @@ -274,6 +274,7 @@ final class WeakHashSet[A <: AnyRef](val initialCapacity: Int, val loadFactor: D override def foreach[U](f: A => U): Unit = iterator foreach f + // It has the `()` because iterator runs `removeStaleEntries()` override def toList(): List[A] = iterator.toList // Iterator over all the elements in this set in no particular order @@ -292,7 +293,7 @@ final class WeakHashSet[A <: AnyRef](val initialCapacity: Int, val loadFactor: D */ private[this] var entry: Entry[A] = null - /** + /** * the element that will be the result of the next call to next() */ private[this] var lookaheadelement: A = null.asInstanceOf[A] @@ -339,7 +340,7 @@ final class WeakHashSet[A <: AnyRef](val initialCapacity: Int, val loadFactor: D * the entries must be stable. If any are garbage collected during validation * then an assertion may inappropriately fire. */ - def fullyValidate { + def fullyValidate: Unit = { var computedCount = 0 var bucket = 0 while (bucket < table.size) { @@ -407,10 +408,10 @@ final class WeakHashSet[A <: AnyRef](val initialCapacity: Int, val loadFactor: D e = e.tail } count - } + } } - private[util] def diagnostics = new Diagnostics + private[util] def diagnostics = new Diagnostics } /** diff --git a/src/reflect/scala/reflect/runtime/ReflectSetup.scala b/src/reflect/scala/reflect/runtime/ReflectSetup.scala index 84f159be00..6a364ff0be 100644 --- a/src/reflect/scala/reflect/runtime/ReflectSetup.scala +++ b/src/reflect/scala/reflect/runtime/ReflectSetup.scala @@ -2,7 +2,7 @@ package scala package reflect package runtime -import internal.{SomePhase, NoPhase, Phase, TreeGen} +import internal.{SomePhase, NoPhase, Phase} /** A helper trait to initialize things that need to be set before JavaMirrors and other * reflect specific traits are initialized */ -- cgit v1.2.3