Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add a warning if a method is not called in a specific class

So, what I'd like to achieve is: I have a custom class which is basically a HttpRequest, I create the object with url, parameters, etc. And then I have to call execute() to execute it.

I was wondering, is there a way - by annotations, or whatever - to make Android Studio remind me to call this method?

I remember the was something similar with the android Toast, in the IDE a message like 'Did you forget to call show?' was shown if, in fact, I forgot to call show() after creating the Toast.

Thanks much to anyone who will help :)

like image 220
Manza Avatar asked Jan 18 '26 18:01

Manza


1 Answers

You could try to create

  1. Create a custom IntelliJ inspection
  2. A custom LINT rule, if you want to check it on your build server and not on your local machine.
like image 96
Lovis Avatar answered Jan 21 '26 06:01

Lovis



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!