You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Sometimes it is quiet easy to figure out when @Contract("null -> null") should be added at the method declaration itself. Currently, autoannotator adds @Nullunmarked on the invocations.
Thanks for the report @ketkarameya! We discussed this today and let me summarize the findings. We'd like to only infer @Contract in cases where we can give a guarantee that the inferred annotation is valid. Right now, @Contract verification is not enabled at Uber, and we also discovered the verification is not powerful enough to validate some common cases. Basically, we'd need to enhance the NullAway dataflow analysis to reason about dead code. Consider the following case (adapted from an example by @lazaroclapp):
Currently, NullAway fails to verify this @Contract annotation and reports it may be invalid (when contract checking is enabled). To verify the contract, the analysis has to reason that when b != null the return null statement is unreachable. Currently, NullAway does not do any kind of reasoning about (conditional) code reachability.
So, we are tabling support for @Contract inference until we can enhance NullAway's ability to verify @Contract annotations for these kinds of cases.
Is your feature request related to a problem? Please describe.
Sometimes it is quiet easy to figure out when
@Contract("null -> null")
should be added at the method declaration itself. Currently, autoannotator adds@Nullunmarked
on the invocations.Describe the solution you'd like
Add
@Contract
cc: @lazaroclapp
The text was updated successfully, but these errors were encountered: