Skip to content

Commit cd50464

Browse files
author
Vlad Ureche
committed
Merge pull request scala#4089 from gourlaysama/wip/t6626-scaladoc-throws-links
SI-6626 make @throws tags create links to exceptions
2 parents 954b57b + 9d0d44c commit cd50464

34 files changed

+143
-74
lines changed

src/library/scala/Option.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ sealed abstract class Option[+A] extends Product with Serializable {
107107

108108
/** Returns the option's value.
109109
* @note The option must be nonEmpty.
110-
* @throws Predef.NoSuchElementException if the option is empty.
110+
* @throws java.util.NoSuchElementException if the option is empty.
111111
*/
112112
def get: A
113113

src/library/scala/Predef.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ object Predef extends LowPriorityImplicits with DeprecatedPredef {
220220
}
221221

222222
/** `???` can be used for marking methods that remain to be implemented.
223-
* @throws A `NotImplementedError`
223+
* @throws NotImplementedError
224224
*/
225225
def ??? : Nothing = throw new NotImplementedError
226226

src/library/scala/Product.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ trait Product extends Any with Equals {
2222
* product `A(x,,1,,, ..., x,,k,,)`, returns `x,,(n+1),,` where `0 < n < k`.
2323
*
2424
* @param n the index of the element to return
25-
* @throws `IndexOutOfBoundsException`
25+
* @throws IndexOutOfBoundsException
2626
* @return the element `n` elements after the first element
2727
*/
2828
def productElement(n: Int): Any

src/library/scala/StringContext.scala

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ case class StringContext(parts: String*) {
5858
/** Checks that the length of the given argument `args` is one less than the number
5959
* of `parts` supplied to the enclosing `StringContext`.
6060
* @param `args` The arguments to be checked.
61-
* @throws An `IllegalArgumentException` if this is not the case.
61+
* @throws IllegalArgumentException if this is not the case.
6262
*/
6363
def checkLengths(args: Seq[Any]): Unit =
6464
if (parts.length != args.length + 1)
@@ -85,10 +85,11 @@ case class StringContext(parts: String*) {
8585
* will print the string `1 + 1 = 2`.
8686
*
8787
* @param `args` The arguments to be inserted into the resulting string.
88-
* @throws An `IllegalArgumentException`
88+
* @throws IllegalArgumentException
8989
* if the number of `parts` in the enclosing `StringContext` does not exceed
9090
* the number of arguments `arg` by exactly 1.
91-
* @throws A `StringContext.InvalidEscapeException` if a `parts` string contains a backslash (`\`) character
91+
* @throws StringContext.InvalidEscapeException
92+
* if a `parts` string contains a backslash (`\`) character
9293
* that does not start a valid escape sequence.
9394
*/
9495
def s(args: Any*): String = standardInterpolator(treatEscapes, args)
@@ -109,7 +110,7 @@ case class StringContext(parts: String*) {
109110
* }}}
110111
*
111112
* @param `args` The arguments to be inserted into the resulting string.
112-
* @throws An `IllegalArgumentException`
113+
* @throws IllegalArgumentException
113114
* if the number of `parts` in the enclosing `StringContext` does not exceed
114115
* the number of arguments `arg` by exactly 1.
115116
*/
@@ -144,10 +145,11 @@ case class StringContext(parts: String*) {
144145
* }}}
145146
*
146147
* @param `args` The arguments to be inserted into the resulting string.
147-
* @throws An `IllegalArgumentException`
148+
* @throws IllegalArgumentException
148149
* if the number of `parts` in the enclosing `StringContext` does not exceed
149150
* the number of arguments `arg` by exactly 1.
150-
* @throws A `StringContext.InvalidEscapeException` if a `parts` string contains a backslash (`\`) character
151+
* @throws StringContext.InvalidEscapeException
152+
* if a `parts` string contains a backslash (`\`) character
151153
* that does not start a valid escape sequence.
152154
*
153155
* Note: The `f` method works by assembling a format string from all the `parts` strings and using

src/library/scala/collection/GenSeqLike.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ trait GenSeqLike[+A, +Repr] extends Any with GenIterableLike[A, Repr] with Equal
4747
*
4848
* @param idx The index to select.
4949
* @return the element of this $coll at index `idx`, where `0` indicates the first element.
50-
* @throws `IndexOutOfBoundsException` if `idx` does not satisfy `0 <= idx < length`.
50+
* @throws IndexOutOfBoundsException if `idx` does not satisfy `0 <= idx < length`.
5151
*/
5252
def apply(idx: Int): A
5353

src/library/scala/collection/GenTraversableLike.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ trait GenTraversableLike[+A, +Repr] extends Any with GenTraversableOnce[A] with
6363
/** Selects the first element of this $coll.
6464
* $orderDependent
6565
* @return the first element of this $coll.
66-
* @throws `NoSuchElementException` if the $coll is empty.
66+
* @throws NoSuchElementException if the $coll is empty.
6767
*/
6868
def head: A
6969

@@ -83,7 +83,7 @@ trait GenTraversableLike[+A, +Repr] extends Any with GenTraversableOnce[A] with
8383
* $orderDependent
8484
* @return a $coll consisting of all elements of this $coll
8585
* except the first one.
86-
* @throws `UnsupportedOperationException` if the $coll is empty.
86+
* @throws UnsupportedOperationException if the $coll is empty.
8787
*/
8888
def tail: Repr
8989

@@ -105,7 +105,7 @@ trait GenTraversableLike[+A, +Repr] extends Any with GenTraversableOnce[A] with
105105
* $orderDependent
106106
* @return a $coll consisting of all elements of this $coll
107107
* except the last one.
108-
* @throws `UnsupportedOperationException` if the $coll is empty.
108+
* @throws UnsupportedOperationException if the $coll is empty.
109109
*/
110110
def init: Repr
111111

src/library/scala/collection/GenTraversableOnce.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ trait GenTraversableOnce[+A] extends Any {
268268
* op(x_1, op(x_2, ..., op(x_{n-1}, x_n)...))
269269
* }}}
270270
* where `x,,1,,, ..., x,,n,,` are the elements of this $coll.
271-
* @throws `UnsupportedOperationException` if this $coll is empty.
271+
* @throws UnsupportedOperationException if this $coll is empty.
272272
*/
273273
def reduceRight[B >: A](op: (A, B) => B): B
274274

src/library/scala/collection/LinearSeqOptimized.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ trait LinearSeqOptimized[+A, +Repr <: LinearSeqOptimized[A, Repr]] extends Linea
4444

4545
/** Selects an element by its index in the $coll.
4646
* Note: the execution of `apply` may take time proportial to the index value.
47-
* @throws `IndexOutOfBoundsException` if `idx` does not satisfy `0 <= idx < length`.
47+
* @throws IndexOutOfBoundsException if `idx` does not satisfy `0 <= idx < length`.
4848
*/
4949
def apply(n: Int): A = {
5050
val rest = drop(n)

src/library/scala/collection/MapLike.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ self =>
222222
* but it might be overridden in subclasses.
223223
*
224224
* @param key the given key value for which a binding is missing.
225-
* @throws `NoSuchElementException`
225+
* @throws NoSuchElementException
226226
*/
227227
def default(key: A): B =
228228
throw new NoSuchElementException("key not found: " + key)

src/library/scala/collection/TraversableLike.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -419,7 +419,7 @@ trait TraversableLike[+A, +Repr] extends Any
419419
/** Selects the first element of this $coll.
420420
* $orderDependent
421421
* @return the first element of this $coll.
422-
* @throws `NoSuchElementException` if the $coll is empty.
422+
* @throws NoSuchElementException if the $coll is empty.
423423
*/
424424
def head: A = {
425425
var result: () => A = () => throw new NoSuchElementException
@@ -473,7 +473,7 @@ trait TraversableLike[+A, +Repr] extends Any
473473
* $orderDependent
474474
* @return a $coll consisting of all elements of this $coll
475475
* except the last one.
476-
* @throws `UnsupportedOperationException` if the $coll is empty.
476+
* @throws UnsupportedOperationException if the $coll is empty.
477477
*/
478478
def init: Repr = {
479479
if (isEmpty) throw new UnsupportedOperationException("empty.init")

src/library/scala/collection/TraversableOnce.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ trait TraversableOnce[+A] extends Any with GenTraversableOnce[A] {
159159
* op( op( ... op(x_1, x_2) ..., x_{n-1}), x_n)
160160
* }}}
161161
* where `x,,1,,, ..., x,,n,,` are the elements of this $coll.
162-
* @throws `UnsupportedOperationException` if this $coll is empty. */
162+
* @throws UnsupportedOperationException if this $coll is empty. */
163163
def reduceLeft[B >: A](op: (B, A) => B): B = {
164164
if (isEmpty)
165165
throw new UnsupportedOperationException("empty.reduceLeft")

src/library/scala/collection/generic/GenericTraversableTemplate.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ trait GenericTraversableTemplate[+A, +CC[X] <: GenTraversable[X]] extends HasNew
4545
/** Selects the first element of this $coll.
4646
*
4747
* @return the first element of this $coll.
48-
* @throws `NoSuchElementException` if the $coll is empty.
48+
* @throws NoSuchElementException if the $coll is empty.
4949
*/
5050
def head: A
5151

@@ -202,7 +202,7 @@ trait GenericTraversableTemplate[+A, +CC[X] <: GenTraversable[X]] extends HasNew
202202
* element type of this $coll is a `Traversable`.
203203
* @return a two-dimensional $coll of ${coll}s which has as ''n''th row
204204
* the ''n''th column of this $coll.
205-
* @throws `IllegalArgumentException` if all collections in this $coll
205+
* @throws IllegalArgumentException if all collections in this $coll
206206
* are not of the same size.
207207
*/
208208
@migration("`transpose` throws an `IllegalArgumentException` if collections are not uniformly sized.", "2.9.0")

src/library/scala/collection/immutable/ListSet.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ class ListSet[A] extends AbstractSet[A]
111111

112112
/** Creates a new iterator over all elements contained in this set.
113113
*
114-
* @throws Predef.NoSuchElementException
114+
* @throws java.util.NoSuchElementException
115115
* @return the new iterator
116116
*/
117117
def iterator: Iterator[A] = new AbstractIterator[A] {
@@ -127,12 +127,12 @@ class ListSet[A] extends AbstractSet[A]
127127
}
128128

129129
/**
130-
* @throws Predef.NoSuchElementException
130+
* @throws java.util.NoSuchElementException
131131
*/
132132
override def head: A = throw new NoSuchElementException("Set has no elements")
133133

134134
/**
135-
* @throws Predef.NoSuchElementException
135+
* @throws java.util.NoSuchElementException
136136
*/
137137
override def tail: ListSet[A] = throw new NoSuchElementException("Next of an empty set")
138138

src/library/scala/collection/immutable/Queue.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ class Queue[+A] protected(protected val in: List[A], protected val out: List[A])
5353
*
5454
* @param n index of the element to return
5555
* @return the element at position `n` in this queue.
56-
* @throws Predef.NoSuchElementException if the queue is too short.
56+
* @throws java.util.NoSuchElementException if the queue is too short.
5757
*/
5858
override def apply(n: Int): A = {
5959
val len = out.length
@@ -120,7 +120,7 @@ class Queue[+A] protected(protected val in: List[A], protected val out: List[A])
120120
/** Returns a tuple with the first element in the queue,
121121
* and a new queue with this element removed.
122122
*
123-
* @throws Predef.NoSuchElementException
123+
* @throws java.util.NoSuchElementException
124124
* @return the first element of the queue.
125125
*/
126126
def dequeue: (A, Queue[A]) = out match {
@@ -139,7 +139,7 @@ class Queue[+A] protected(protected val in: List[A], protected val out: List[A])
139139
/** Returns the first element in the queue, or throws an error if there
140140
* is no element contained in the queue.
141141
*
142-
* @throws Predef.NoSuchElementException
142+
* @throws java.util.NoSuchElementException
143143
* @return the first element.
144144
*/
145145
def front: A = head

src/library/scala/collection/immutable/Stack.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ class Stack[+A] protected (protected val elems: List[A])
9595
/** Returns the top element of the stack. An error is signaled if
9696
* there is no element on the stack.
9797
*
98-
* @throws Predef.NoSuchElementException
98+
* @throws java.util.NoSuchElementException
9999
* @return the top element.
100100
*/
101101
def top: A =
@@ -105,7 +105,7 @@ class Stack[+A] protected (protected val elems: List[A])
105105
/** Removes the top element from the stack.
106106
* Note: should return `(A, Stack[A])` as for queues (mics)
107107
*
108-
* @throws Predef.NoSuchElementException
108+
* @throws java.util.NoSuchElementException
109109
* @return the new stack without the former top element.
110110
*/
111111
def pop: Stack[A] =

src/library/scala/collection/immutable/Stream.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ self =>
225225
* }}}
226226
*
227227
* @return The first element of the `Stream`.
228-
* @throws Predef.NoSuchElementException if the stream is empty.
228+
* @throws java.util.NoSuchElementException if the stream is empty.
229229
*/
230230
def head: A
231231

@@ -236,7 +236,7 @@ self =>
236236
* returns the lazy result.
237237
*
238238
* @return The tail of the `Stream`.
239-
* @throws Predef.UnsupportedOperationException if the stream is empty.
239+
* @throws UnsupportedOperationException if the stream is empty.
240240
*/
241241
def tail: Stream[A]
242242

@@ -876,7 +876,7 @@ self =>
876876
* @return A new `Stream` containing everything but the last element. If your
877877
* `Stream` represents an infinite series, this method will not return.
878878
*
879-
* @throws `Predef.UnsupportedOperationException` if the stream is empty.
879+
* @throws UnsupportedOperationException if the stream is empty.
880880
*/
881881
override def init: Stream[A] =
882882
if (isEmpty) super.init

src/library/scala/collection/immutable/StringLike.scala

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -230,31 +230,31 @@ self =>
230230
def r(groupNames: String*): Regex = new Regex(toString, groupNames: _*)
231231

232232
/**
233-
* @throws `java.lang.IllegalArgumentException` - If the string does not contain a parsable boolean.
233+
* @throws java.lang.IllegalArgumentException - If the string does not contain a parsable boolean.
234234
*/
235235
def toBoolean: Boolean = parseBoolean(toString)
236236
/**
237-
* @throws `java.lang.NumberFormatException` - If the string does not contain a parsable byte.
237+
* @throws java.lang.NumberFormatException - If the string does not contain a parsable byte.
238238
*/
239239
def toByte: Byte = java.lang.Byte.parseByte(toString)
240240
/**
241-
* @throws `java.lang.NumberFormatException` - If the string does not contain a parsable short.
241+
* @throws java.lang.NumberFormatException - If the string does not contain a parsable short.
242242
*/
243243
def toShort: Short = java.lang.Short.parseShort(toString)
244244
/**
245-
* @throws `java.lang.NumberFormatException` - If the string does not contain a parsable int.
245+
* @throws java.lang.NumberFormatException - If the string does not contain a parsable int.
246246
*/
247247
def toInt: Int = java.lang.Integer.parseInt(toString)
248248
/**
249-
* @throws `java.lang.NumberFormatException` - If the string does not contain a parsable long.
249+
* @throws java.lang.NumberFormatException - If the string does not contain a parsable long.
250250
*/
251251
def toLong: Long = java.lang.Long.parseLong(toString)
252252
/**
253-
* @throws `java.lang.NumberFormatException` - If the string does not contain a parsable float.
253+
* @throws java.lang.NumberFormatException - If the string does not contain a parsable float.
254254
*/
255255
def toFloat: Float = java.lang.Float.parseFloat(toString)
256256
/**
257-
* @throws `java.lang.NumberFormatException` - If the string does not contain a parsable double.
257+
* @throws java.lang.NumberFormatException - If the string does not contain a parsable double.
258258
*/
259259
def toDouble: Double = java.lang.Double.parseDouble(toString)
260260

@@ -287,7 +287,7 @@ self =>
287287
* understands.
288288
*
289289
* @param args the arguments used to instantiating the pattern.
290-
* @throws `java.lang.IllegalArgumentException`
290+
* @throws java.lang.IllegalArgumentException
291291
*/
292292
def format(args : Any*): String =
293293
java.lang.String.format(toString, args map unwrapArg: _*)
@@ -304,7 +304,7 @@ self =>
304304
*
305305
* @param l an instance of `java.util.Locale`
306306
* @param args the arguments used to instantiating the pattern.
307-
* @throws `java.lang.IllegalArgumentException`
307+
* @throws java.lang.IllegalArgumentException
308308
*/
309309
def formatLocal(l: java.util.Locale, args: Any*): String =
310310
java.lang.String.format(l, toString, args map unwrapArg: _*)

src/library/scala/collection/mutable/ArrayBuffer.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ class ArrayBuffer[A](override protected val initialSize: Int)
133133
*
134134
* @param n the index where a new element will be inserted.
135135
* @param seq the traversable object providing all elements to insert.
136-
* @throws Predef.IndexOutOfBoundsException if `n` is out of bounds.
136+
* @throws IndexOutOfBoundsException if `n` is out of bounds.
137137
*/
138138
def insertAll(n: Int, seq: Traversable[A]) {
139139
if (n < 0 || n > size0) throw new IndexOutOfBoundsException(n.toString)
@@ -150,7 +150,7 @@ class ArrayBuffer[A](override protected val initialSize: Int)
150150
*
151151
* @param n the index which refers to the first element to delete.
152152
* @param count the number of elements to delete
153-
* @throws Predef.IndexOutOfBoundsException if `n` is out of bounds.
153+
* @throws IndexOutOfBoundsException if `n` is out of bounds.
154154
*/
155155
override def remove(n: Int, count: Int) {
156156
require(count >= 0, "removing negative number of elements")

src/library/scala/collection/mutable/ListBuffer.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ final class ListBuffer[A]
132132
*
133133
* @param n the index of the element to replace.
134134
* @param x the new element.
135-
* @throws Predef.IndexOutOfBoundsException if `n` is out of bounds.
135+
* @throws IndexOutOfBoundsException if `n` is out of bounds.
136136
*/
137137
def update(n: Int, x: A) {
138138
// We check the bounds early, so that we don't trigger copying.
@@ -217,7 +217,7 @@ final class ListBuffer[A]
217217
*
218218
* @param n the index where a new element will be inserted.
219219
* @param seq the iterable object providing all elements to insert.
220-
* @throws Predef.IndexOutOfBoundsException if `n` is out of bounds.
220+
* @throws IndexOutOfBoundsException if `n` is out of bounds.
221221
*/
222222
def insertAll(n: Int, seq: Traversable[A]) {
223223
// We check the bounds early, so that we don't trigger copying.
@@ -330,7 +330,7 @@ final class ListBuffer[A]
330330
* @param n the index which refers to the element to delete.
331331
* @return n the element that was formerly at position `n`.
332332
* @note an element must exists at position `n`.
333-
* @throws Predef.IndexOutOfBoundsException if `n` is out of bounds.
333+
* @throws IndexOutOfBoundsException if `n` is out of bounds.
334334
*/
335335
def remove(n: Int): A = {
336336
if (n < 0 || n >= len) throw new IndexOutOfBoundsException(n.toString())

src/library/scala/collection/mutable/PriorityQueue.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ class PriorityQueue[A](implicit val ord: Ordering[A])
126126
/** Returns the element with the highest priority in the queue,
127127
* and removes this element from the queue.
128128
*
129-
* @throws Predef.NoSuchElementException
129+
* @throws java.util.NoSuchElementException
130130
* @return the element with the highest priority.
131131
*/
132132
def dequeue(): A =

src/library/scala/collection/mutable/Queue.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ extends MutableList[A]
5858
/** Returns the first element in the queue, and removes this element
5959
* from the queue.
6060
*
61-
* @throws Predef.NoSuchElementException
61+
* @throws java.util.NoSuchElementException
6262
* @return the first element of the queue.
6363
*/
6464
def dequeue(): A =

0 commit comments

Comments
 (0)