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
Detect variables and properties that are declared as Nullable but they never contain a null value.
Non-compilant:
val a:String?="hello"val a:String?
get() ="hello"
Context
The tanslator of code from java to kotlin adds a lot of unnecesary ?. And when you are refactoring maybe changes a property that could hold null to something that couldn't hold null but you can forget about redeclaring the type.
I don't know if we could handle var too.
After reading the last commits of #4353 I relasied that this rule shouldn't be that difficult to implement.
The text was updated successfully, but these errors were encountered:
I think the case where var could be flagged is if the analyzer could prove that any values that it gets assigned are non-null (or at least not nullable). Private vars - along with vars that have private setters - seen pretty feasible for this; vars that are settable outside of their containing object/class might balloon the complexity (and/or computational time) quite a bit. In any case, I'll take a look.
Expected Behavior of the rule
Detect variables and properties that are declared as Nullable but they never contain a
null
value.Non-compilant:
Context
The tanslator of code from java to kotlin adds a lot of unnecesary
?
. And when you are refactoring maybe changes a property that could holdnull
to something that couldn't holdnull
but you can forget about redeclaring the type.I don't know if we could handle
var
too.After reading the last commits of #4353 I relasied that this rule shouldn't be that difficult to implement.
The text was updated successfully, but these errors were encountered: