Skip to content

Commit 14c8779

Browse files
committed
Improve naming of ReadStdin
We don't need to say everything twice, methods are already prefixed with “read”.
1 parent 0311088 commit 14c8779

File tree

4 files changed

+33
-33
lines changed

4 files changed

+33
-33
lines changed

src/library/scala/Console.scala

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
package scala
1010

1111
import java.io.{ BufferedReader, InputStream, InputStreamReader, OutputStream, PrintStream, Reader }
12-
import scala.io.{ AnsiColor, ReadStdin }
12+
import scala.io.{ AnsiColor, StdIn }
1313
import scala.util.DynamicVariable
1414

1515
/** Implements functionality for
@@ -169,20 +169,20 @@ private[scala] abstract class DeprecatedConsole {
169169
protected def setErrDirect(err: PrintStream): Unit
170170
protected def setInDirect(in: BufferedReader): Unit
171171

172-
@deprecated("Use the method in scala.io.ReadStdin", "2.11.0") def readBoolean(): Boolean = ReadStdin.readBoolean()
173-
@deprecated("Use the method in scala.io.ReadStdin", "2.11.0") def readByte(): Byte = ReadStdin.readByte()
174-
@deprecated("Use the method in scala.io.ReadStdin", "2.11.0") def readChar(): Char = ReadStdin.readChar()
175-
@deprecated("Use the method in scala.io.ReadStdin", "2.11.0") def readDouble(): Double = ReadStdin.readDouble()
176-
@deprecated("Use the method in scala.io.ReadStdin", "2.11.0") def readFloat(): Float = ReadStdin.readFloat()
177-
@deprecated("Use the method in scala.io.ReadStdin", "2.11.0") def readInt(): Int = ReadStdin.readInt()
178-
@deprecated("Use the method in scala.io.ReadStdin", "2.11.0") def readLine(): String = ReadStdin.readLine()
179-
@deprecated("Use the method in scala.io.ReadStdin", "2.11.0") def readLine(text: String, args: Any*): String = ReadStdin.readLine(text, args: _*)
180-
@deprecated("Use the method in scala.io.ReadStdin", "2.11.0") def readLong(): Long = ReadStdin.readLong()
181-
@deprecated("Use the method in scala.io.ReadStdin", "2.11.0") def readShort(): Short = ReadStdin.readShort()
182-
@deprecated("Use the method in scala.io.ReadStdin", "2.11.0") def readf(format: String): List[Any] = ReadStdin.readf(format)
183-
@deprecated("Use the method in scala.io.ReadStdin", "2.11.0") def readf1(format: String): Any = ReadStdin.readf1(format)
184-
@deprecated("Use the method in scala.io.ReadStdin", "2.11.0") def readf2(format: String): (Any, Any) = ReadStdin.readf2(format)
185-
@deprecated("Use the method in scala.io.ReadStdin", "2.11.0") def readf3(format: String): (Any, Any, Any) = ReadStdin.readf3(format)
172+
@deprecated("Use the method in scala.io.StdIn", "2.11.0") def readBoolean(): Boolean = StdIn.readBoolean()
173+
@deprecated("Use the method in scala.io.StdIn", "2.11.0") def readByte(): Byte = StdIn.readByte()
174+
@deprecated("Use the method in scala.io.StdIn", "2.11.0") def readChar(): Char = StdIn.readChar()
175+
@deprecated("Use the method in scala.io.StdIn", "2.11.0") def readDouble(): Double = StdIn.readDouble()
176+
@deprecated("Use the method in scala.io.StdIn", "2.11.0") def readFloat(): Float = StdIn.readFloat()
177+
@deprecated("Use the method in scala.io.StdIn", "2.11.0") def readInt(): Int = StdIn.readInt()
178+
@deprecated("Use the method in scala.io.StdIn", "2.11.0") def readLine(): String = StdIn.readLine()
179+
@deprecated("Use the method in scala.io.StdIn", "2.11.0") def readLine(text: String, args: Any*): String = StdIn.readLine(text, args: _*)
180+
@deprecated("Use the method in scala.io.StdIn", "2.11.0") def readLong(): Long = StdIn.readLong()
181+
@deprecated("Use the method in scala.io.StdIn", "2.11.0") def readShort(): Short = StdIn.readShort()
182+
@deprecated("Use the method in scala.io.StdIn", "2.11.0") def readf(format: String): List[Any] = StdIn.readf(format)
183+
@deprecated("Use the method in scala.io.StdIn", "2.11.0") def readf1(format: String): Any = StdIn.readf1(format)
184+
@deprecated("Use the method in scala.io.StdIn", "2.11.0") def readf2(format: String): (Any, Any) = StdIn.readf2(format)
185+
@deprecated("Use the method in scala.io.StdIn", "2.11.0") def readf3(format: String): (Any, Any, Any) = StdIn.readf3(format)
186186

187187
/** Sets the default output stream.
188188
*

src/library/scala/Predef.scala

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import generic.CanBuildFrom
1515
import scala.annotation.{ elidable, implicitNotFound }
1616
import scala.annotation.elidable.ASSERTION
1717
import scala.language.{implicitConversions, existentials}
18-
import scala.io.ReadStdin
18+
import scala.io.StdIn
1919

2020
/** The `Predef` object provides definitions that are accessible in all Scala
2121
* compilation units without explicit qualification.
@@ -415,20 +415,20 @@ private[scala] trait DeprecatedPredef {
415415
@deprecated("Use `SeqCharSequence`", "2.11.0") def seqToCharSequence(xs: scala.collection.IndexedSeq[Char]): CharSequence = new SeqCharSequence(xs)
416416
@deprecated("Use `ArrayCharSequence`", "2.11.0") def arrayToCharSequence(xs: Array[Char]): CharSequence = new ArrayCharSequence(xs)
417417

418-
@deprecated("Use the method in `scala.io.ReadStdin`", "2.11.0") def readLine(): String = ReadStdin.readLine()
419-
@deprecated("Use the method in `scala.io.ReadStdin`", "2.11.0") def readLine(text: String, args: Any*) = ReadStdin.readLine(text, args: _*)
420-
@deprecated("Use the method in `scala.io.ReadStdin`", "2.11.0") def readBoolean() = ReadStdin.readBoolean()
421-
@deprecated("Use the method in `scala.io.ReadStdin`", "2.11.0") def readByte() = ReadStdin.readByte()
422-
@deprecated("Use the method in `scala.io.ReadStdin`", "2.11.0") def readShort() = ReadStdin.readShort()
423-
@deprecated("Use the method in `scala.io.ReadStdin`", "2.11.0") def readChar() = ReadStdin.readChar()
424-
@deprecated("Use the method in `scala.io.ReadStdin`", "2.11.0") def readInt() = ReadStdin.readInt()
425-
@deprecated("Use the method in `scala.io.ReadStdin`", "2.11.0") def readLong() = ReadStdin.readLong()
426-
@deprecated("Use the method in `scala.io.ReadStdin`", "2.11.0") def readFloat() = ReadStdin.readFloat()
427-
@deprecated("Use the method in `scala.io.ReadStdin`", "2.11.0") def readDouble() = ReadStdin.readDouble()
428-
@deprecated("Use the method in `scala.io.ReadStdin`", "2.11.0") def readf(format: String) = ReadStdin.readf(format)
429-
@deprecated("Use the method in `scala.io.ReadStdin`", "2.11.0") def readf1(format: String) = ReadStdin.readf1(format)
430-
@deprecated("Use the method in `scala.io.ReadStdin`", "2.11.0") def readf2(format: String) = ReadStdin.readf2(format)
431-
@deprecated("Use the method in `scala.io.ReadStdin`", "2.11.0") def readf3(format: String) = ReadStdin.readf3(format)
418+
@deprecated("Use the method in `scala.io.StdIn`", "2.11.0") def readLine(): String = StdIn.readLine()
419+
@deprecated("Use the method in `scala.io.StdIn`", "2.11.0") def readLine(text: String, args: Any*) = StdIn.readLine(text, args: _*)
420+
@deprecated("Use the method in `scala.io.StdIn`", "2.11.0") def readBoolean() = StdIn.readBoolean()
421+
@deprecated("Use the method in `scala.io.StdIn`", "2.11.0") def readByte() = StdIn.readByte()
422+
@deprecated("Use the method in `scala.io.StdIn`", "2.11.0") def readShort() = StdIn.readShort()
423+
@deprecated("Use the method in `scala.io.StdIn`", "2.11.0") def readChar() = StdIn.readChar()
424+
@deprecated("Use the method in `scala.io.StdIn`", "2.11.0") def readInt() = StdIn.readInt()
425+
@deprecated("Use the method in `scala.io.StdIn`", "2.11.0") def readLong() = StdIn.readLong()
426+
@deprecated("Use the method in `scala.io.StdIn`", "2.11.0") def readFloat() = StdIn.readFloat()
427+
@deprecated("Use the method in `scala.io.StdIn`", "2.11.0") def readDouble() = StdIn.readDouble()
428+
@deprecated("Use the method in `scala.io.StdIn`", "2.11.0") def readf(format: String) = StdIn.readf(format)
429+
@deprecated("Use the method in `scala.io.StdIn`", "2.11.0") def readf1(format: String) = StdIn.readf1(format)
430+
@deprecated("Use the method in `scala.io.StdIn`", "2.11.0") def readf2(format: String) = StdIn.readf2(format)
431+
@deprecated("Use the method in `scala.io.StdIn`", "2.11.0") def readf3(format: String) = StdIn.readf3(format)
432432
}
433433

434434
/** The `LowPriorityImplicits` class provides implicit values that

src/library/scala/io/ReadStdin.scala renamed to src/library/scala/io/StdIn.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import java.text.MessageFormat
77
* in the standard library, at least not in this idiosyncractic form.
88
* Factored into trait because it is better code structure regardless.
99
*/
10-
private[scala] trait ReadStdin {
10+
private[scala] trait StdIn {
1111
import scala.Console._
1212

1313
/** Read a full line from the default input. Returns `null` if the end of the
@@ -225,4 +225,4 @@ private[scala] trait ReadStdin {
225225
}
226226
}
227227

228-
object ReadStdin extends ReadStdin { }
228+
object StdIn extends StdIn

test/files/run/Predef.readLine.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import java.io.StringReader
2-
import scala.io.ReadStdin.readLine
2+
import scala.io.StdIn.readLine
33

44
object Test extends App {
55
Console.withIn(new StringReader("")) {

0 commit comments

Comments
 (0)