Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there an annotation to generate a warning if a callback parameter is not used?

I see a lot of answers for the opposite of this, or how to suppress unused "something".

What I want is different:

I have a method that provides a value to callback and often find myself not using it when in this case I want to enforce (or at least warn) if the parameter is not used.

Since Kotlin allows you to reference these by it, it often goes unused and unnoticed since there isn't an explicit variable for lint to report as "unused".

I assumed this was possible because Material's Scaffold for Jetpack Compose does this and I get a warning if I don't use the PaddingValues provided. However, I looked at the source and couldn't find any annotation for this.

There must be one right? I really doubt this would be something Android Studio/lint would do for one particular library…

like image 934
lbarbosa Avatar asked Feb 02 '26 17:02

lbarbosa


1 Answers

There is no builtin annotation for it, compose Scaffold is using this lint rule

like image 123
Philip Dukhov Avatar answered Feb 05 '26 05:02

Philip Dukhov



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!