Skip to content
This repository was archived by the owner on Jul 30, 2024. It is now read-only.

Commit 7ec3b4e

Browse files
authored
Merge pull request #96 from exoego/final-implicit-class
Final implicit class
2 parents e1dbd20 + d06a4d1 commit 7ec3b4e

22 files changed

+36
-36
lines changed

app/current/src/main/scala/io/scalajs/nodejs/fs/FSWatcher.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ object FSWatcher {
2828
/**
2929
* File System Watcher Extensions
3030
*/
31-
implicit class FSWatcherExtensions(val watcher: FSWatcher) extends AnyVal {
31+
implicit final class FSWatcherExtensions(val watcher: FSWatcher) extends AnyVal {
3232

3333
/**
3434
* Emitted when something changes in a watched directory or file. See more details in fs.watch().

app/current/src/main/scala/io/scalajs/nodejs/fs/ReadStream.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ object ReadStream {
5757
/**
5858
* Read Stream Events
5959
*/
60-
implicit class ReadStreamEvents(val stream: ReadStream) extends AnyVal {
60+
implicit final class ReadStreamEvents(val stream: ReadStream) extends AnyVal {
6161

6262
/**
6363
* Emitted when the ReadStream's underlying file descriptor has been closed using the fs.close() method.
@@ -83,7 +83,7 @@ object ReadStream {
8383
/**
8484
* Read Stream Extensions
8585
*/
86-
implicit class ReadStreamExtensions(val stream: ReadStream) extends AnyVal {
86+
implicit final class ReadStreamExtensions(val stream: ReadStream) extends AnyVal {
8787

8888
@inline
8989
def closeFuture: Future[Unit] = promiseCallback1[Unit](stream.close)

app/current/src/main/scala/io/scalajs/nodejs/fs/WriteStream.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ object WriteStream {
5454
/**
5555
* Write Stream Events
5656
*/
57-
implicit class WriteStreamEvents(val stream: WriteStream) extends AnyVal {
57+
implicit final class WriteStreamEvents(val stream: WriteStream) extends AnyVal {
5858

5959
/**
6060
* Emitted when the WriteStream's underlying file descriptor has been closed using the fs.close() method.
@@ -80,7 +80,7 @@ object WriteStream {
8080
/**
8181
* Write Stream Extensions
8282
*/
83-
implicit class WriteStreamExtensions(val stream: WriteStream) extends AnyVal {
83+
implicit final class WriteStreamExtensions(val stream: WriteStream) extends AnyVal {
8484

8585
@inline
8686
def closeFuture: Future[Unit] = promiseCallback1[Unit](stream.close)

app/current/src/main/scala/io/scalajs/nodejs/fs/package.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ package object fs {
3636
* File System Extensions
3737
* @param fs the given [[Fs file system]] instance
3838
*/
39-
final implicit class FsExtensions(private val fs: Fs) extends AnyVal {
39+
implicit final class FsExtensions(private val fs: Fs) extends AnyVal {
4040
@inline
4141
def accessFuture(path: Buffer | String): Future[Unit] = {
4242
promiseWithError0[FileIOError](fs.access(path, _))

app/current/src/main/scala/io/scalajs/nodejs/http/Server.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ object Server {
3232
* Server Events
3333
* @param server the given [[Server]]
3434
*/
35-
final implicit class ServerEvents(val server: Server) extends AnyVal {
35+
implicit final class ServerEvents(val server: Server) extends AnyVal {
3636

3737
/**
3838
* Emitted each time a request with an HTTP Expect: 100-continue is received. If this event is not listened for,

app/current/src/main/scala/io/scalajs/nodejs/https/package.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ package object https {
1616
/**
1717
* Https Extensions
1818
*/
19-
final implicit class HttpExtensions(val https: Https) extends AnyVal {
19+
implicit final class HttpExtensions(val https: Https) extends AnyVal {
2020

2121
/**
2222
* Like http.get() but for HTTPS.

app/current/src/main/scala/io/scalajs/nodejs/net/package.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ package object net {
1717
* net.Server Events
1818
* @param server the given [[Server server]]
1919
*/
20-
implicit class ServerEvents(val server: Server) extends AnyVal {
20+
implicit final class ServerEvents(val server: Server) extends AnyVal {
2121

2222
/**
2323
* Emitted when a new connection is made. socket is an instance of net.Socket.
@@ -46,7 +46,7 @@ package object net {
4646
* net.Socket Extensions
4747
* @param socket the given [[Socket socket]]
4848
*/
49-
implicit class SocketExtensions(val socket: Socket) extends AnyVal {
49+
implicit final class SocketExtensions(val socket: Socket) extends AnyVal {
5050

5151
/////////////////////////////////////////////////////////////////////////////////
5252
// Futures

app/current/src/main/scala/io/scalajs/nodejs/readline/Interface.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ object Interface {
100100
* Readline Interface Events
101101
* @param readline the given [[Interface Readline Interface]]
102102
*/
103-
implicit class ReadlineEvents(val readline: Interface) extends AnyVal {
103+
implicit final class ReadlineEvents(val readline: Interface) extends AnyVal {
104104

105105
/**
106106
* Emitted when close() is called. Also emitted when the input stream receives its 'end' event.

app/current/src/main/scala/io/scalajs/nodejs/repl/REPLServer.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ object REPLServer {
7676
* REPL Server Extensions
7777
* @param server the given [[REPLServer REPL Server]]
7878
*/
79-
final implicit class REPLServerExtensions[T <: REPLServer](val server: T) extends AnyVal {
79+
implicit final class REPLServerExtensions[T <: REPLServer](val server: T) extends AnyVal {
8080

8181
/**
8282
* Emitted when the user exits the REPL in any of the defined ways. Namely, typing .exit at the repl,

app/current/src/main/scala/io/scalajs/nodejs/repl/package.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ package object repl {
1313
* REPL Server events
1414
* @param server the given [[REPLServer instance]]
1515
*/
16-
final implicit class REPLServerEvents(val server: REPLServer) extends AnyVal {
16+
implicit final class REPLServerEvents(val server: REPLServer) extends AnyVal {
1717

1818
@inline
1919
def contextAs[T]: T = server.context.asInstanceOf[T]
@@ -47,7 +47,7 @@ package object repl {
4747
* <li>NODE_REPL_MODE</li>
4848
* </ul>
4949
*/
50-
final implicit class EnvironmentVariableOptions(private val env: process.Environment) extends AnyVal {
50+
implicit final class EnvironmentVariableOptions(private val env: process.Environment) extends AnyVal {
5151

5252
/**
5353
* When a valid path is given, persistent REPL history will be saved to the specified file rather

app/current/src/main/scala/io/scalajs/nodejs/timers/Immediate.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ object Immediate {
3232
* Immediate Enrichment
3333
* @param immediate the given [[Immediate immediate]] handle
3434
*/
35-
implicit class ImmediateEnrichment(val immediate: Immediate) extends AnyVal {
35+
implicit final class ImmediateEnrichment(val immediate: Immediate) extends AnyVal {
3636

3737
@inline
3838
def clear(): Unit = clearImmediate(immediate)

app/current/src/main/scala/io/scalajs/nodejs/timers/Interval.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ object Interval {
2727
* Interval Enrichment
2828
* @param handle the given [[Interval interval]] handle
2929
*/
30-
implicit class IntervalEnrichment(val handle: Interval) extends AnyVal {
30+
implicit final class IntervalEnrichment(val handle: Interval) extends AnyVal {
3131

3232
@inline
3333
def clear(): Unit = clearInterval(handle)

app/current/src/main/scala/io/scalajs/nodejs/timers/Timeout.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ object Timeout {
3535
* Timeout Enrichment
3636
* @param handle the given [[Timeout timeout]] handle
3737
*/
38-
implicit class TimeoutEnrichment(val handle: Timeout) extends AnyVal {
38+
implicit final class TimeoutEnrichment(val handle: Timeout) extends AnyVal {
3939

4040
@inline
4141
def clear(): Unit = clearTimeout(handle)

app/current/src/main/scala/io/scalajs/nodejs/tty/package.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ package object tty {
99
* Write Stream Events
1010
* @param stream the given [[WriteStream stream]]
1111
*/
12-
implicit class WriteStreamEvents(val stream: WriteStream) extends AnyVal {
12+
implicit final class WriteStreamEvents(val stream: WriteStream) extends AnyVal {
1313

1414
/**
1515
* The 'resize' event is emitted whenever either of the writeStream.columns or writeStream.rows properties have

core/src/main/scala/io/scalajs/collection/JsCollection.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ object JsCollection {
4040
* JavaScript Collection Enrichment
4141
* @param collection the given [[JsCollection collection]]
4242
*/
43-
implicit class JsCollectionEnrichment[T](val collection: JsCollection[T]) extends AnyVal {
43+
implicit final class JsCollectionEnrichment[T](val collection: JsCollection[T]) extends AnyVal {
4444

4545
@inline
4646
def get(index: Int): Option[T] = Option(collection(index))

core/src/main/scala/io/scalajs/package.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ package object scalajs {
1818
* JSON Enrichment
1919
* @param json the given [[JSON]] object
2020
*/
21-
implicit class JSONEnrichment(val json: JSON) extends AnyVal {
21+
implicit final class JSONEnrichment(val json: JSON) extends AnyVal {
2222

2323
@inline
2424
def parseAs[T](text: String): T = json.parse(text).asInstanceOf[T]

core/src/main/scala/io/scalajs/util/DateHelper.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ object DateHelper {
1212
* Date Enrichment
1313
* @param date0 the given [[js.Date date]]
1414
*/
15-
implicit class DateEnrichment(val date0: js.Date) extends AnyVal {
15+
implicit final class DateEnrichment(private val date0: js.Date) extends AnyVal {
1616

1717
@inline
1818
def +(duration: Duration) = new js.Date(date0.getTime() + duration.toMillis)
@@ -41,7 +41,7 @@ object DateHelper {
4141
* Duration Enrichment
4242
* @param duration the given [[Duration duration]]
4343
*/
44-
implicit class DurationEnrichment(val duration: Duration) extends AnyVal {
44+
implicit final class DurationEnrichment(private val duration: Duration) extends AnyVal {
4545

4646
@inline
4747
def +(date: js.Date) = new js.Date(date.getTime() + duration.toMillis)

core/src/main/scala/io/scalajs/util/JSONHelper.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ object JSONHelper {
1313
* JSON Conversions
1414
* @param value the given JavaScript value
1515
*/
16-
implicit class JSONConversionsToJson[T <: js.Any](val value: T) extends AnyVal {
16+
implicit final class JSONConversionsToJson[T <: js.Any](val value: T) extends AnyVal {
1717

1818
@inline
1919
def toJson: String = JSON.stringify(value)
@@ -27,7 +27,7 @@ object JSONHelper {
2727
* JSON Conversions
2828
* @param text the given text string
2929
*/
30-
implicit class JSONConversionFromJson(val text: String) extends AnyVal {
30+
implicit final class JSONConversionFromJson(val text: String) extends AnyVal {
3131

3232
@inline
3333
def fromJson[T <: js.Any]: T = JSON.parse(text).asInstanceOf[T]

core/src/main/scala/io/scalajs/util/JsUnderOrHelper.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ object JsUnderOrHelper {
1212
* UndefOr Extensions
1313
* @param valueA the given [[js.UndefOr value]]
1414
*/
15-
implicit class UndefOrExtensions[T](val valueA: js.UndefOr[T]) extends AnyVal {
15+
implicit final class UndefOrExtensions[T](private val valueA: js.UndefOr[T]) extends AnyVal {
1616

1717
@inline def ?==(valueB: js.UndefOr[T]): Boolean = valueA.exists(valueB.contains)
1818

@@ -40,7 +40,7 @@ object JsUnderOrHelper {
4040
* UndefOr Boolean Extensions
4141
* @param value the given [[js.UndefOr value]]
4242
*/
43-
implicit class UndefOrBoolExtensions(val value: js.UndefOr[Boolean]) extends AnyVal {
43+
implicit final class UndefOrBoolExtensions(private val value: js.UndefOr[Boolean]) extends AnyVal {
4444

4545
@inline
4646
def isTrue: Boolean = value.flat.contains(true)
@@ -51,7 +51,7 @@ object JsUnderOrHelper {
5151
* UndefOr Double Extensions
5252
* @param value the given [[js.UndefOr value]]
5353
*/
54-
implicit class UndefOrDoubleExtensions(val value: js.UndefOr[Double]) extends AnyVal {
54+
implicit final class UndefOrDoubleExtensions(val value: js.UndefOr[Double]) extends AnyVal {
5555

5656
@inline
5757
def orZero: Double = value.flat getOrElse 0.0
@@ -62,7 +62,7 @@ object JsUnderOrHelper {
6262
* UndefOr Integer Extensions
6363
* @param value the given [[js.UndefOr value]]
6464
*/
65-
implicit class UndefOrIntExtensions(val value: js.UndefOr[Int]) extends AnyVal {
65+
implicit final class UndefOrIntExtensions(val value: js.UndefOr[Int]) extends AnyVal {
6666

6767
@inline
6868
def orZero: Int = value.flat getOrElse 0

core/src/main/scala/io/scalajs/util/OptionHelper.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ object OptionHelper {
1313
* Option Extensions
1414
* @param valueA the given [[Option optional value]]
1515
*/
16-
implicit class OptionExtensions[T](val valueA: Option[T]) extends AnyVal {
16+
implicit final class OptionExtensions[T](val valueA: Option[T]) extends AnyVal {
1717

1818
@inline def ?==(valueB: js.UndefOr[T]): Boolean = valueA.exists(v => valueB.exists(_ == v))
1919

@@ -39,7 +39,7 @@ object OptionHelper {
3939
* Option Boolean Extensions
4040
* @param value the given [[Option value]]
4141
*/
42-
implicit class OptionBoolExtensions(val value: Option[Boolean]) extends AnyVal {
42+
implicit final class OptionBoolExtensions(val value: Option[Boolean]) extends AnyVal {
4343

4444
@inline def isTrue: Boolean = value.contains(true)
4545

@@ -49,7 +49,7 @@ object OptionHelper {
4949
* Option Double Extensions
5050
* @param value the given [[Option value]]
5151
*/
52-
implicit class OptionDoubleExtensions(val value: Option[Double]) extends AnyVal {
52+
implicit final class OptionDoubleExtensions(val value: Option[Double]) extends AnyVal {
5353

5454
@inline def orZero: Double = value getOrElse 0.0
5555

@@ -59,7 +59,7 @@ object OptionHelper {
5959
* Option Integer Extensions
6060
* @param value the given [[Option value]]
6161
*/
62-
implicit class OptionIntExtensions(val value: Option[Int]) extends AnyVal {
62+
implicit final class OptionIntExtensions(val value: Option[Int]) extends AnyVal {
6363

6464
@inline def orZero: Int = value getOrElse 0
6565

core/src/main/scala/io/scalajs/util/PromiseHelper.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ object PromiseHelper {
273273
* @param task the given [[Future task]]
274274
* @tparam T the return type of the task
275275
*/
276-
implicit class TimeExtensions[T](val task: Future[T]) extends AnyVal {
276+
implicit final class TimeExtensions[T](val task: Future[T]) extends AnyVal {
277277

278278
@inline
279279
def withTimer(action: String, showHeader: Boolean = false)(implicit ec: ExecutionContext): Future[T] = {

core/src/main/scala/io/scalajs/util/ScalaJsHelper.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ object ScalaJsHelper {
3030
* js.Dynamic to Value Extensions
3131
* @param obj the given [[js.Dynamic object]]
3232
*/
33-
implicit class JsAnyExtensions(val obj: js.Any) extends AnyVal {
33+
implicit final class JsAnyExtensions(val obj: js.Any) extends AnyVal {
3434

3535
@inline
3636
def asUndefOr[T]: js.UndefOr[T] = obj.asInstanceOf[js.UndefOr[T]].flat
@@ -61,7 +61,7 @@ object ScalaJsHelper {
6161
* js.Array Extensions
6262
* @param array the given [[js.Array array]]
6363
*/
64-
implicit class JsArrayExtensions[A](val array: js.Array[A]) extends AnyVal {
64+
implicit final class JsArrayExtensions[A](val array: js.Array[A]) extends AnyVal {
6565

6666
@inline
6767
def indexWhereOpt(f: A => Boolean): Option[Int] = array.indexWhere(f) match {
@@ -83,7 +83,7 @@ object ScalaJsHelper {
8383
* js.Dictionary Extensions
8484
* @param dict the given [[js.Dictionary dictionary]]
8585
*/
86-
implicit class JsDictionaryExtensions[A](val dict: js.Dictionary[A]) extends AnyVal {
86+
implicit final class JsDictionaryExtensions[A](val dict: js.Dictionary[A]) extends AnyVal {
8787

8888
@inline
8989
def replaceWith(items: (String, A)*): Unit = {

0 commit comments

Comments
 (0)