Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

166
Views
Kotlin. Deprecation with multiple choice

What is the best option to provide a multiple-choice deprecation in Kotlin?

I'm trying to find the best way to provide a replacement for deprecated parameter.

Having a enum class A with a deprecated element X

enum class A {
  @Derecated
  X,
  Y,
  Z
}

I want IDE to suggest a quickfix replacement for X in my code. To support it I can provide a replaceWith value. However, it's not possible to provide a multiple-choice option.

X could be replaced with Y or Z.

enum class A {
  @Derecated(
    message = "...",
    replaceWith = ReplaceWith("Y or Z"),
    DeprecationLevel.WARNING,
  )
  X,
  Y,
  Z
}

With ReplaceWith("Y or Z") IDE can suggest a quickfix, but it will break a compilation:

// works, but breaks compilation
A.X -> A.Y or Z 
over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!