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

299
Views
How can I specify a generic type parameter in a Kotlin @Deprecated annotation?

I want to rename a Kotlin type, leaving a deprecated typealias to allow existing code to compile.

typealias TestContext<F> = ContextBuilder<F>

@Deprecated("TestContext is now ContextBuilder", 
    replaceWith = ReplaceWith("ContextBuilder<F>"))

leads to TextContext<Unit> being replaced with ContextBuilder<F>

@Deprecated("TestContext is now ContextBuilder", 
    replaceWith = ReplaceWith("ContextBuilder"))

leads to TextContext<Unit> being replaced with ContextBuilder

How can I write the replaceWith expression so that IntelliJ replaces TextContext<Unit> with ContextBuilder<Unit>?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

This is possible now! The ReplaceWith intention saves generic type arguments from Kotlin plugin v1.3.40 on (see change log).

over 4 years ago · Santiago Trujillo Report
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!