I am getting following option like "Add method contract to 'setDisplayHomeAsUpEnabled'
", I know that inspection is because of NPE can throw by getSupportActionBar()
but I want to know actual use of Method Contract
If I Press Enter on that selection, I am getting:
Any Sharing? Any Help? It will appreciated :)
This relates to creating method contracts that describe when a method may return null or not null.
IntelliJ/Android Studio is sometimes able to to infer this from the context of the code. But when it is not able to know for sure, you can specify a method contract that tells the caller what will happen in different circumstances.
Read more about method contracts here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With