Skip to content

Commit

Permalink
remove overdue deprecations
Browse files Browse the repository at this point in the history
  • Loading branch information
cornerman committed Nov 10, 2023
1 parent e677b91 commit 5d52d9d
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 88 deletions.
3 changes: 0 additions & 3 deletions colibri/src/main/scala/colibri/CanCancel.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ package colibri

trait CanCancel[-T] {
def unsafeCancel(cancelable: T): Unit

@deprecated("Use unsafeCancel instead", "0.2.7")
@inline final def cancel(cancelable: T): Unit = unsafeCancel(cancelable)
}
object CanCancel {
@inline def apply[T](implicit unsafeCancel: CanCancel[T]): CanCancel[T] = unsafeCancel
Expand Down
3 changes: 0 additions & 3 deletions colibri/src/main/scala/colibri/Cancelable.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ trait Cancelable {
def isEmpty(): Boolean
def unsafeCancel(): Unit

@deprecated("Use unsafeCancel() instead", "0.2.7")
@inline final def cancel(): Unit = unsafeCancel()

final def cancelF[F[_]: Sync]: F[Unit] = Sync[F].delay(unsafeCancel())
final def cancelIO: IO[Unit] = cancelF[IO]
final def cancelSyncIO: SyncIO[Unit] = cancelF[SyncIO]
Expand Down
70 changes: 1 addition & 69 deletions colibri/src/main/scala/colibri/Observable.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package colibri

import cats._
import cats.implicits._
import colibri.effect.{RunSyncEffect, RunEffect}
import colibri.effect.RunEffect
import cats.effect.{Sync, SyncIO, Async, IO, Resource}

import scala.scalajs.js
Expand Down Expand Up @@ -114,8 +114,6 @@ object Observable {
def unsafeSubscribe(sink: Observer[T]): Cancelable = value.unsafeSubscribe(sink)
}

@deprecated("Use Observable.raiseError instead", "0.3.0")
def failure[T](error: Throwable): Observable[T] = raiseError(error)
def raiseError[T](error: Throwable): Observable[T] = new Observable[T] {
def unsafeSubscribe(sink: Observer[T]): Cancelable = {
sink.unsafeOnError(error)
Expand Down Expand Up @@ -158,10 +156,6 @@ object Observable {
}
}

@deprecated("Use fromEffect instead", "0.3.0")
def fromSync[F[_]: RunSyncEffect, A](effect: F[A]): Observable[A] = fromEffect(effect)
@deprecated("Use fromEffect instead", "0.3.0")
def fromAsync[F[_]: RunEffect, A](effect: F[A]): Observable[A] = fromEffect(effect)
def fromEffect[F[_]: RunEffect, A](effect: F[A]): Observable[A] = new Observable[A] {
def unsafeSubscribe(sink: Observer[A]): Cancelable =
RunEffect[F].unsafeRunSyncOrAsyncCancelable[A](effect)(_.fold(sink.unsafeOnError, sink.unsafeOnNext))
Expand Down Expand Up @@ -197,11 +191,6 @@ object Observable {

def like[H[_]: ObservableLike, A](observableLike: H[A]): Observable[A] = ObservableLike[H].toObservable(observableLike)

@deprecated("Use concatEffect instead", "0.3.0")
def concatSync[F[_]: RunSyncEffect, T](effects: F[T]*): Observable[T] = concatEffect(effects: _*)
@deprecated("Use concatEffect instead", "0.3.0")
def concatAsync[F[_]: RunEffect, T](effects: F[T]*): Observable[T] = concatEffect(effects: _*)

def concatEffect[F[_]: RunEffect, T](effects: F[T]*): Observable[T] = fromIterable(effects).mapEffect(identity)

def concatFuture[T](value1: => Future[T]): Observable[T] = concatEffect(IO.fromFuture(IO(value1)))
Expand All @@ -225,10 +214,6 @@ object Observable {
IO.fromFuture(IO(value5)),
)

@deprecated("Use concatEffect instead", "0.3.0")
def concatSync[F[_]: RunSyncEffect, T](effect: F[T], source: Observable[T]): Observable[T] = concatEffect(effect, source)
@deprecated("Use concatEffect instead", "0.3.0")
def concatAsync[F[_]: RunEffect, T](effect: F[T], source: Observable[T]): Observable[T] = concatEffect(effect, source)
def concatEffect[F[_]: RunEffect, T](effect: F[T], source: Observable[T]): Observable[T] = new Observable[T] {
def unsafeSubscribe(sink: Observer[T]): Cancelable = {
val consecutive = Cancelable.consecutive()
Expand All @@ -248,8 +233,6 @@ object Observable {

@inline def merge[A](sources: Observable[A]*): Observable[A] = mergeIterable(sources)

@deprecated("Use mergeIterable instead", "0.4.5")
def mergeSeq[A](sources: Seq[Observable[A]]): Observable[A] = mergeIterable(sources)
def mergeIterable[A](sources: Iterable[Observable[A]]): Observable[A] = new Observable[A] {
def unsafeSubscribe(sink: Observer[A]): Cancelable = {
val subscriptions = sources.map { source =>
Expand All @@ -262,8 +245,6 @@ object Observable {

@inline def switch[A](sources: Observable[A]*): Observable[A] = switchIterable(sources)

@deprecated("Use switchIterable instead", "0.4.5")
def switchSeq[A](sources: Seq[Observable[A]]): Observable[A] = switchIterable(sources)
def switchIterable[A](sources: Iterable[Observable[A]]): Observable[A] = new Observable[A] {
def unsafeSubscribe(sink: Observer[A]): Cancelable = {
val variable = Cancelable.variable()
Expand All @@ -278,8 +259,6 @@ object Observable {

@inline def concat[A](sources: Observable[A]*): Observable[A] = concatIterable(sources)

@deprecated("Use concatIterable instead", "0.4.5")
def concatSeq[A](sources: Seq[Observable[A]]): Observable[A] = concatIterable(sources)
def concatIterable[A](sources: Iterable[Observable[A]]): Observable[A] = new Observable[A] {
def unsafeSubscribe(sink: Observer[A]): Cancelable = {
val consecutive = Cancelable.consecutive()
Expand Down Expand Up @@ -549,9 +528,6 @@ object Observable {
source.unsafeSubscribe(Observer.createFromEither(sink.unsafeOnNext))
}

@deprecated("Use attempt instead", "0.3.0")
def recoverToEither: Observable[Either[Throwable, A]] = source.attempt

def recoverMap(f: Throwable => A): Observable[A] = recover { case t => f(t) }

def recover(f: PartialFunction[Throwable, A]): Observable[A] = recoverOption(f andThen (Some(_)))
Expand Down Expand Up @@ -599,8 +575,6 @@ object Observable {
def tapFailedEffect[F[_]: RunEffect: Applicative](f: Throwable => F[Unit]): Observable[A] =
attempt.tapEffect(_.swap.traverseTap(f).void).flattenEither

@deprecated("Use .tapSubscribe(f) instead", "0.3.4")
def doOnSubscribe(f: () => Cancelable): Observable[A] = tapSubscribe(f)
def tapSubscribe(f: () => Cancelable): Observable[A] = new Observable[A] {
def unsafeSubscribe(sink: Observer[A]): Cancelable = {
val cancelable = f()
Expand All @@ -622,8 +596,6 @@ object Observable {
}
}

@deprecated("Use .tap(f) instead", "0.3.4")
def doOnNext(f: A => Unit): Observable[A] = tap(f)
def tap(f: A => Unit): Observable[A] = new Observable[A] {
def unsafeSubscribe(sink: Observer[A]): Cancelable = {
source.unsafeSubscribe(sink.doOnNext { value =>
Expand All @@ -633,8 +605,6 @@ object Observable {
}
}

@deprecated("Use .tapFailed(f) instead", "0.3.4")
def doOnError(f: Throwable => Unit): Observable[A] = tapFailed(f)
def tapFailed(f: Throwable => Unit): Observable[A] = new Observable[A] {
def unsafeSubscribe(sink: Observer[A]): Cancelable = {
source.unsafeSubscribe(sink.doOnError { error =>
Expand Down Expand Up @@ -681,11 +651,6 @@ object Observable {
}
}

@deprecated("Use mapEffect instead", "0.3.0")
@inline def mapSync[F[_]: RunSyncEffect, B](f: A => F[B]): Observable[B] = mapEffect(f)
@deprecated("Use mapEffect instead", "0.3.0")
def mapAsync[F[_]: RunEffect, B](f: A => F[B]): Observable[B] = mapEffect(f)

@inline def mapEffect[F[_]: RunEffect, B](f: A => F[B]): Observable[B] = concatMapEffect(f)
def concatMapEffect[F[_]: RunEffect, B](f: A => F[B]): Observable[B] = new Observable[B] {
def unsafeSubscribe(sink: Observer[B]): Cancelable = {
Expand Down Expand Up @@ -768,10 +733,6 @@ object Observable {
}
}

@deprecated("Use singleMapEffect instead", "0.3.0")
def mapAsyncSingleOrDrop[F[_]: RunEffect, B](f: A => F[B]): Observable[B] = singleMapEffect(f)
@deprecated("Use singleMapEffect instead", "0.7.2")
def mapEffectSingleOrDrop[F[_]: RunEffect, B](f: A => F[B]): Observable[B] = singleMapEffect(f)
def singleMapEffect[F[_]: RunEffect, B](f: A => F[B]): Observable[B] = new Observable[B] {
def unsafeSubscribe(sink: Observer[B]): Cancelable = {
val single = Cancelable.singleOrDrop()
Expand Down Expand Up @@ -802,8 +763,6 @@ object Observable {
}
}

@deprecated("Use singleMapFuture instead", "0.7.2")
@inline def mapFutureSingleOrDrop[B](f: A => Future[B]): Observable[B] = singleMapFuture(f)
@inline def singleMapFuture[B](f: A => Future[B]): Observable[B] =
singleMapEffect(v => IO.fromFuture(IO(f(v))))

Expand Down Expand Up @@ -1362,21 +1321,6 @@ object Observable {
@inline def distinctByOnEquals[B](f: A => B): Observable[A] = distinctBy(f)(Eq.fromUniversalEquals)
@inline def distinctOnEquals: Observable[A] = distinct(Eq.fromUniversalEquals)

@deprecated("Manage subscriptions directly with subscribe, via, etc.", "0.4.3")
def withDefaultSubscription(sink: Observer[A]): Observable[A] = new Observable[A] {
private var defaultSubscription = source.unsafeSubscribe(sink)

def unsafeSubscribe(sink: Observer[A]): Cancelable = {
// stop the default subscription.
if (defaultSubscription != null) {
defaultSubscription.unsafeCancel()
defaultSubscription = null
}

source.unsafeSubscribe(sink)
}
}

@inline def transformSource[B](transform: Observable[A] => Observable[B]): Observable[B] = new Observable[B] {
def unsafeSubscribe(sink: Observer[B]): Cancelable = transform(source).unsafeSubscribe(sink)
}
Expand Down Expand Up @@ -1415,11 +1359,6 @@ object Observable {
def foldIO[B](seed: B)(f: (B, A) => B): IO[B] = scan(seed)(f).lastIO
def unsafeFoldFuture[B](seed: B)(f: (B, A) => B): Future[B] = scan(seed)(f).unsafeLastFuture()

@deprecated("Use prependEffect instead", "0.3.0")
@inline def prependSync[F[_]: RunSyncEffect](value: F[A]): Observable[A] = prependEffect(value)
@deprecated("Use prependEffect instead", "0.3.0")
@inline def prependAsync[F[_]: RunEffect](value: F[A]): Observable[A] = prependEffect(value)

@inline def prependEffect[F[_]: RunEffect](value: F[A]): Observable[A] = concatEffect[F, A](value, source)
@inline def prependFuture(value: => Future[A]): Observable[A] = concatFuture[A](value, source)

Expand Down Expand Up @@ -1732,13 +1671,6 @@ object Observable {

@inline def unsafeSubscribe(): Cancelable = source.unsafeSubscribe(Observer.empty)
@inline def unsafeForeach(f: A => Unit): Cancelable = source.unsafeSubscribe(Observer.create(f))

@deprecated("Use unsafeSubscribe(sink) or to(sink).unsafeSubscribe() or to(sink).subscribeF[F] instead", "0.3.0")
@inline def subscribe(sink: Observer[A]): Cancelable = source.unsafeSubscribe(sink)
@deprecated("Use unsafeSubscribe() or subscribeF[F] instead", "0.3.0")
@inline def subscribe(): Cancelable = unsafeSubscribe()
@deprecated("Use unsafeForeach(f) or foreach_(f).subscribeF[F] instead", "0.3.0")
@inline def foreach(f: A => Unit): Cancelable = unsafeForeach(f)
}

@inline implicit class ThrowableOperations(private val source: Observable[Throwable]) extends AnyVal {
Expand Down
10 changes: 0 additions & 10 deletions colibri/src/main/scala/colibri/Observer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@ object Observer {
}
}

@deprecated("Use createUnrecovered instead", "")
@inline def unsafeCreate[A](
consume: A => Unit,
failure: Throwable => Unit = UnhandledErrorReporter.errorSubject.unsafeOnNext,
): Observer[A] = createUnrecovered(consume, failure)
@inline def createUnrecovered[A](
consume: A => Unit,
failure: Throwable => Unit = UnhandledErrorReporter.errorSubject.unsafeOnNext,
Expand Down Expand Up @@ -215,11 +210,6 @@ object Observer {
Connectable(handler, () => source.unsafeSubscribe(sink))
}

@deprecated("Use unsafeOnNext instead", "")
def onNext(value: A): Unit = sink.unsafeOnNext(value)
@deprecated("Use unsafeOnError instead", "")
def onError(error: Throwable): Unit = sink.unsafeOnError(error)

def onNextF[F[_]: Sync](value: A): F[Unit] = Sync[F].delay(sink.unsafeOnNext(value))
def onNextIO(value: A): IO[Unit] = onNextF[IO](value)
def onNextSyncIO(value: A): SyncIO[Unit] = onNextF[SyncIO](value)
Expand Down
3 changes: 0 additions & 3 deletions colibri/src/main/scala/colibri/Source.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@ package colibri

trait Source[-H[_]] {
def unsafeSubscribe[A](source: H[A])(sink: Observer[A]): Cancelable

@deprecated("Use unsafeSubscribe instead", "0.2.7")
@inline final def subscribe[A](source: H[A])(sink: Observer[A]): Cancelable = unsafeSubscribe(source)(sink)
}
object Source {
@inline def apply[H[_]](implicit source: Source[H]): Source[H] = source
Expand Down

0 comments on commit 5d52d9d

Please sign in to comment.