https://kotlinlang.org logo
Title
s

sreich

06/24/2022, 8:17 PM
specifically i get,
a non-expression cannot be replaced with an expression
e

Endre Deak

06/24/2022, 8:24 PM
you could try doing regex
I guess the trick is that you need to match every
@Slf4J
class Whatever { 
   val field = ...
and be replaced to
class Whatever { 
   val logger = KotlinLogging.logger { }
   val field = ...
s

sreich

06/24/2022, 8:25 PM
well it's even easier than that actually, since logger is top level as well
e

Endre Deak

06/24/2022, 8:25 PM
even better
s

sreich

06/24/2022, 8:25 PM
or, the end state is for it to be roughly where the @Slf4j was
e

Endre Deak

06/24/2022, 8:25 PM
but regex will do it for you
s

sreich

06/24/2022, 8:25 PM
i don't know how to do that within structural search & replace
i am trying to create an inspection, so it has to be done through this
e

Endre Deak

06/24/2022, 8:26 PM
oh
I thought you just need this to be replaced and in that case you could just do plain text search & replace
s

sreich

06/24/2022, 8:26 PM
there must be some syntax to get it to ignore. like, do i need to wrap it in quotes or something?