Skip to content

Recipe to apply Kotlin's @Deprecated(replaceWith=...) suggestions #5929

@timtebeek

Description

@timtebeek

What problem are you trying to solve?

Support trivial replacements built into the Kotlin language, but then scaled up through recipes, as per:

Describe the situation before applying the recipe

Any usage of these deprecated methods

  @Deprecated(
    "orNone is being renamed to getOrNone to be more consistent with the Kotlin Standard Library naming",
    ReplaceWith("getOrNone()")
  )
  public fun orNone(): Option<B> = getOrNone()
  @Deprecated(
    DeprMsg + "Use isLeft on Either after refactoring",
    ReplaceWith("toEither().isLeft()")
  )
  public val isInvalid: Boolean =
    fold({ true }, { false })
@Deprecated(
  DeprMsg + "Use left instead to construct the equivalent Either value",
  ReplaceWith("this.left()", "arrow.core.left")
)
public inline fun <E> E.invalid(): Validated<E, Nothing> =
  Invalid(this)

Describe the situation after applying the recipe

Those usages converted to their suggested replacements.

Have you considered any alternatives or workarounds?

Generate recipes based on such patterns identified in well known libraries; not as usable or easily updated.

Any additional context

We already have similar support for Java's @InlineMe`; we can copy the same approach here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    recipeRequested Recipe

    Type

    No type

    Projects

    Status

    Recipes Wanted

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions