-
Notifications
You must be signed in to change notification settings - Fork 299
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Analysis Fails On Conditional Initialization #35
Comments
Hrm, NullAway doesn't currently track this kind of conditional non-nullness. Adding it would be some work and it might significantly impact performance. Besides suppression, the one workaround I can think of is to put all the code using |
I can do that. I try to prevent wrapping Since conditional nullness is some work and might impact performance could we try to detect this scenario upfront and mention in the error message NullAway can't verify the expression is safe? I'm not sure how easy this would be. An interesting datapoint is that Intellij didn't flag passing |
Not sure what IntelliJ does exactly; it may well track more precise info than we do. I don't immediately see a way to figure out when this case is happening in the error message without doing the analysis itself 😄 One thing we could do eventually is to run a more precise path-sensitive analysis only if our current analysis can't prove safety. Since the common case is no error, this shouldn't affect performance too much. Still not clear it's worth the implementation effort, though. We can keep this issue open and see if this kind of thing comes up frequently. FWIW, on our internal code base I don't think this code pattern is a major cause of warning suppressions (/cc @lazaroclapp) |
expect to see new progress ... |
@SolomonSun2010 there has been more recent discussion of this issue in #98, so you can see what is happening there |
Duplicate of #98 |
In the example above
dep1
anddep2
are both nullable. If they're both present I want them to share the samething
. If neither are present I don't want to instantiatething
.The text was updated successfully, but these errors were encountered: