Miha-x64 / Mikes_IDEA_extensions

IntelliJ IDEA: missing parts.
Apache License 2.0
34 stars 7 forks source link

Request: for Kotlin, offer remove un-needed `?` and `!!` when you see `?)!!` #19

Open AndroidDeveloperLB opened 2 years ago

AndroidDeveloperLB commented 2 years ago

Often when I convert from Java to Kotlin, I see something like this:

foo((value as Boolean?)!!)

Instead, it should be like this:

foo(value as Boolean)

If foo is defined only as foo(Boolean) , it could even be replaced in this case to just:

foo(value)

Can you please add this ? I don't know of similar cases, but maybe there are some...

Miha-x64 commented 2 years ago

Yes! Any chain with ?s inside looks suspicious when ends with !!.

AndroidDeveloperLB commented 2 years ago

You say you know of other, similar cases?