diff options
Diffstat (limited to 'src')
7 files changed, 99 insertions, 79 deletions
diff --git a/src/library/scala/Predef.scala b/src/library/scala/Predef.scala index 6f3fd1ba23..9cd2a2b8de 100644 --- a/src/library/scala/Predef.scala +++ b/src/library/scala/Predef.scala @@ -28,13 +28,11 @@ import scala.io.StdIn * constructors ([[scala.collection.immutable.::]] and * [[scala.collection.immutable.Nil]]). * - * === Console I/O === - * Predef provides a number of simple functions for console I/O, such as - * `print`, `println`, `readLine`, `readInt`, etc. These functions are all - * aliases of the functions provided by [[scala.Console]]. + * === Console Output === + * For basic console output, `Predef` provides convenience methods [[print(x:Any* print]] and [[println(x:Any* println]], + * which are aliases of the methods in the object [[scala.Console]]. * * === Assertions === - * * A set of `assert` functions are provided for use as a way to document * and dynamically check invariants in code. Invocations of `assert` can be elided * at compile time by providing the command line option `-Xdisable-assertions`, @@ -304,9 +302,37 @@ object Predef extends LowPriorityImplicits with DeprecatedPredef { // printing ----------------------------------------------------------- + /** Prints an object to `out` using its `toString` method. + * + * @param x the object to print; may be null. + */ def print(x: Any) = Console.print(x) + + /** Prints a newline character on the default output. + */ def println() = Console.println() + + /** Prints out an object to the default output, followed by a newline character. + * + * @param x the object to print. + */ def println(x: Any) = Console.println(x) + + /** Prints its arguments as a formatted string to the default output, + * based on a string pattern (in a fashion similar to printf in C). + * + * The interpretation of the formatting patterns is described in + * <a href="" target="contentFrame" class="java/util/Formatter"> + * `java.util.Formatter`</a>. + * + * Consider using the [[scala.StringContext.f f interpolator]] as more type safe and idiomatic. + * + * @param text the pattern for formatting the arguments. + * @param args the arguments used to instantiating the pattern. + * @throws java.lang.IllegalArgumentException if there was a problem with the format string or arguments + * + * @see [[scala.StringContext.f StringContext.f]] + */ def printf(text: String, xs: Any*) = Console.print(text.format(xs: _*)) // views -------------------------------------------------------------- diff --git a/src/library/scala/collection/JavaConversions.scala b/src/library/scala/collection/JavaConversions.scala index 7bfa60771f..f9a34f78d5 100644 --- a/src/library/scala/collection/JavaConversions.scala +++ b/src/library/scala/collection/JavaConversions.scala @@ -16,12 +16,12 @@ import convert._ * * The following conversions are supported: *{{{ - * scala.collection.Iterable <=> java.lang.Iterable - * scala.collection.Iterable <=> java.util.Collection - * scala.collection.Iterator <=> java.util.{ Iterator, Enumeration } + * scala.collection.Iterable <=> java.lang.Iterable + * scala.collection.Iterable <=> java.util.Collection + * scala.collection.Iterator <=> java.util.{ Iterator, Enumeration } * scala.collection.mutable.Buffer <=> java.util.List - * scala.collection.mutable.Set <=> java.util.Set - * scala.collection.mutable.Map <=> java.util.{ Map, Dictionary } + * scala.collection.mutable.Set <=> java.util.Set + * scala.collection.mutable.Map <=> java.util.{ Map, Dictionary } * scala.collection.concurrent.Map <=> java.util.concurrent.ConcurrentMap *}}} * In all cases, converting from a source type to a target type and back diff --git a/src/library/scala/collection/JavaConverters.scala b/src/library/scala/collection/JavaConverters.scala index 86e86d4584..58fbc5afa5 100644 --- a/src/library/scala/collection/JavaConverters.scala +++ b/src/library/scala/collection/JavaConverters.scala @@ -19,14 +19,14 @@ import convert._ * Scala and Java collections using `asScala` and `asJava` methods. * * The following conversions are supported via `asJava`, `asScala` - * - * - `scala.collection.Iterable` <=> `java.lang.Iterable` - * - `scala.collection.Iterator` <=> `java.util.Iterator` - * - `scala.collection.mutable.Buffer` <=> `java.util.List` - * - `scala.collection.mutable.Set` <=> `java.util.Set` - * - `scala.collection.mutable.Map` <=> `java.util.Map` - * - `scala.collection.mutable.concurrent.Map` <=> `java.util.concurrent.ConcurrentMap` - * + *{{{ + * scala.collection.Iterable <=> java.lang.Iterable + * scala.collection.Iterator <=> java.util.Iterator + * scala.collection.mutable.Buffer <=> java.util.List + * scala.collection.mutable.Set <=> java.util.Set + * scala.collection.mutable.Map <=> java.util.Map + * scala.collection.mutable.concurrent.Map <=> java.util.concurrent.ConcurrentMap + *}}} * In all cases, converting from a source type to a target type and back * again will return the original source object, e.g. * {{{ @@ -40,22 +40,22 @@ import convert._ * The following conversions are also supported, but the * direction from Scala to Java is done by the more specifically named methods: * `asJavaCollection`, `asJavaEnumeration`, `asJavaDictionary`. - * - * - `scala.collection.Iterable` <=> `java.util.Collection` - * - `scala.collection.Iterator` <=> `java.util.Enumeration` - * - `scala.collection.mutable.Map` <=> `java.util.Dictionary` - * + *{{{ + * scala.collection.Iterable <=> java.util.Collection + * scala.collection.Iterator <=> java.util.Enumeration + * scala.collection.mutable.Map <=> java.util.Dictionary + *}}} * In addition, the following one way conversions are provided via `asJava`: - * - * - `scala.collection.Seq` => `java.util.List` - * - `scala.collection.mutable.Seq` => `java.util.List` - * - `scala.collection.Set` => `java.util.Set` - * - `scala.collection.Map` => `java.util.Map` - * + *{{{ + * scala.collection.Seq => java.util.List + * scala.collection.mutable.Seq => java.util.List + * scala.collection.Set => java.util.Set + * scala.collection.Map => java.util.Map + *}}} * The following one way conversion is provided via `asScala`: - * - * - `java.util.Properties` => `scala.collection.mutable.Map` - * + *{{{ + * java.util.Properties => scala.collection.mutable.Map + *}}} * @since 2.8.1 */ object JavaConverters extends DecorateAsJava with DecorateAsScala diff --git a/src/library/scala/collection/convert/DecorateAsJava.scala b/src/library/scala/collection/convert/DecorateAsJava.scala index e6aa5da067..0ed67a86d7 100644 --- a/src/library/scala/collection/convert/DecorateAsJava.scala +++ b/src/library/scala/collection/convert/DecorateAsJava.scala @@ -20,14 +20,14 @@ import scala.language.implicitConversions * Scala and Java collections using `asScala` and `asJava` methods. * * The following conversions are supported via `asJava`, `asScala` - * - * - `scala.collection.Iterable` <=> `java.lang.Iterable` - * - `scala.collection.Iterator` <=> `java.util.Iterator` - * - `scala.collection.mutable.Buffer` <=> `java.util.List` - * - `scala.collection.mutable.Set` <=> `java.util.Set` - * - `scala.collection.mutable.Map` <=> `java.util.Map` - * - `scala.collection.mutable.concurrent.Map` <=> `java.util.concurrent.ConcurrentMap` - * + *{{{ + * scala.collection.Iterable <=> java.lang.Iterable + * scala.collection.Iterator <=> java.util.Iterator + * scala.collection.mutable.Buffer <=> java.util.List + * scala.collection.mutable.Set <=> java.util.Set + * scala.collection.mutable.Map <=> java.util.Map + * scala.collection.mutable.concurrent.Map <=> java.util.concurrent.ConcurrentMap + *}}} * In all cases, converting from a source type to a target type and back * again will return the original source object, e.g. * {{{ @@ -41,22 +41,22 @@ import scala.language.implicitConversions * The following conversions are also supported, but the * direction from Scala to Java is done by the more specifically named methods: * `asJavaCollection`, `asJavaEnumeration`, `asJavaDictionary`. - * - * - `scala.collection.Iterable` <=> `java.util.Collection` - * - `scala.collection.Iterator` <=> `java.util.Enumeration` - * - `scala.collection.mutable.Map` <=> `java.util.Dictionary` - * + *{{{ + * scala.collection.Iterable <=> java.util.Collection + * scala.collection.Iterator <=> java.util.Enumeration + * scala.collection.mutable.Map <=> java.util.Dictionary + *}}} * In addition, the following one way conversions are provided via `asJava`: - * - * - `scala.collection.Seq` => `java.util.List` - * - `scala.collection.mutable.Seq` => `java.util.List` - * - `scala.collection.Set` => `java.util.Set` - * - `scala.collection.Map` => `java.util.Map` - * + *{{{ + * scala.collection.Seq => java.util.List + * scala.collection.mutable.Seq => java.util.List + * scala.collection.Set => java.util.Set + * scala.collection.Map => java.util.Map + *}}} * The following one way conversion is provided via `asScala`: - * - * - `java.util.Properties` => `scala.collection.mutable.Map` - * + *{{{ + * java.util.Properties => scala.collection.mutable.Map + *}}} * @since 2.8.1 */ trait DecorateAsJava { diff --git a/src/reflect/scala/reflect/internal/util/WeakHashSet.scala b/src/reflect/scala/reflect/internal/util/WeakHashSet.scala index f8dfa720d5..fffe4dd881 100644 --- a/src/reflect/scala/reflect/internal/util/WeakHashSet.scala +++ b/src/reflect/scala/reflect/internal/util/WeakHashSet.scala @@ -56,9 +56,9 @@ final class WeakHashSet[A <: AnyRef](val initialCapacity: Int, val loadFactor: D /** * the limit at which we'll increase the size of the hash table */ - var threshhold = computeThreshHold + private[this] var threshold = computeThreshold - private[this] def computeThreshHold: Int = (table.size * loadFactor).ceil.toInt + private[this] def computeThreshold: Int = (table.size * loadFactor).ceil.toInt /** * find the bucket associated with an element's hash code @@ -121,7 +121,7 @@ final class WeakHashSet[A <: AnyRef](val initialCapacity: Int, val loadFactor: D private[this] def resize() { val oldTable = table table = new Array[Entry[A]](oldTable.size * 2) - threshhold = computeThreshHold + threshold = computeThreshold @tailrec def tableLoop(oldBucket: Int): Unit = if (oldBucket < oldTable.size) { @@ -176,7 +176,7 @@ final class WeakHashSet[A <: AnyRef](val initialCapacity: Int, val loadFactor: D def add() = { table(bucket) = new Entry(elem, hash, oldHead, queue) count += 1 - if (count > threshhold) resize() + if (count > threshold) resize() elem } @@ -206,7 +206,7 @@ final class WeakHashSet[A <: AnyRef](val initialCapacity: Int, val loadFactor: D def add() { table(bucket) = new Entry(elem, hash, oldHead, queue) count += 1 - if (count > threshhold) resize() + if (count > threshold) resize() } @tailrec @@ -252,7 +252,7 @@ final class WeakHashSet[A <: AnyRef](val initialCapacity: Int, val loadFactor: D // empty this set override def clear(): Unit = { table = new Array[Entry[A]](table.size) - threshhold = computeThreshHold + threshold = computeThreshold count = 0 // drain the queue - doesn't do anything because we're throwing away all the values anyway diff --git a/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/index.js b/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/index.js index 494ad91cc8..55224eae52 100644 --- a/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/index.js +++ b/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/index.js @@ -33,14 +33,11 @@ $(document).ready(function() { configureTextFilter(); - $("#index-input").on("focus", function(e) { - $("#textfilter > .input > .clear").show(); - }); - - $("#index-input").on("blur", function() { - setTimeout(function() { + $("#index-input").on("input", function(e) { + if($(this).val().length > 0) + $("#textfilter > .input > .clear").show(); + else $("#textfilter > .input > .clear").hide(); - }, 10); }); }); @@ -229,6 +226,8 @@ function configureTextFilter() { $("div#search-results").hide(); $("#search > span.close-results").hide(); $("#search > span#doc-title").show(); + + $(this).hide(); }); }); diff --git a/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/template.js b/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/template.js index ae39f83852..5f42dfa114 100644 --- a/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/template.js +++ b/src/scaladoc/scala/tools/nsc/doc/html/resource/lib/template.js @@ -147,10 +147,10 @@ $(document).ready(function() { }); $("#memberfilter > .clear").click(function() { $("#memberfilter input").attr("value", ""); + $(this).hide(); filter(); }); $(document).keydown(function(event) { - if (event.keyCode == 9) { // tab $("#index-input", window.parent.document).focus(); input.attr("value", ""); @@ -162,8 +162,7 @@ $(document).ready(function() { if ($(this).hasClass("in")) { $(this).removeClass("in"); $(this).addClass("out"); - } - else if ($(this).hasClass("out")) { + } else if ($(this).hasClass("out")) { $(this).removeClass("out"); $(this).addClass("in"); } @@ -174,8 +173,7 @@ $(document).ready(function() { if ($(this).hasClass("in")) { $(this).removeClass("in"); $(this).addClass("out"); - } - else if ($(this).hasClass("out")) { + } else if ($(this).hasClass("out")) { $(this).removeClass("out"); $(this).addClass("in"); } @@ -307,14 +305,11 @@ $(document).ready(function() { exposeMember(jqElem); } - $("#mbrsel-input").on("focus", function() { - $("#memberfilter > .clear").show(); - }); - - $("#mbrsel-input").on("blur", function() { - setTimeout(function() { + $("#mbrsel-input").on("input", function() { + if ($(this).val().length > 0) + $("#memberfilter > .clear").show(); + else $("#memberfilter > .clear").hide(); - }, 10); }); }); |