Class NullCheck
java.lang.Object
org.openrewrite.java.migrate.lang.NullCheck
- All Implemented Interfaces:
org.openrewrite.trait.Trait<org.openrewrite.java.tree.J.If>
public class NullCheck
extends Object
implements org.openrewrite.trait.Trait<org.openrewrite.java.tree.J.If>
-
Nested Class Summary
Nested Classes -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.openrewrite.trait.Trait
getCursor, getTree
-
Constructor Details
-
NullCheck
public NullCheck()
-
-
Method Details
-
whenNull
public org.openrewrite.java.tree.Statement whenNull() -
whenNotNull
public @Nullable org.openrewrite.java.tree.Statement whenNotNull() -
returns
public boolean returns() -
couldModifyNullCheckedValue
public boolean couldModifyNullCheckedValue()Calculates few potential cases where the null checked variable gets reassigned and only returns false if these cases DO NOT match. In any other case this returns true as we do not know that particular situation yet -> no harm -> assume it could be altered in the block.- Returns:
- false only if we are 100% sure the block does not reassigns/changes the null checked variable.
-