Class Reachability
java.lang.Object
com.google.errorprone.util.Reachability
An implementation of JLS 14.21 reachability.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
canCompleteNormally
(StatementTree statement) Returns true if the given statement can complete normally, as defined by JLS 14.21.static boolean
canCompleteNormally
(StatementTree statement, com.google.common.collect.ImmutableMap<Tree, Boolean> patches) Returns whether the given statement can complete normally, as defined by JLS 14.21, when taking into account the givenpatches
.static boolean
canFallThrough
(CaseTree caseTree) Returns true if the given case tree can fall through to the next case tree.
-
Constructor Details
-
Reachability
public Reachability()
-
-
Method Details
-
canCompleteNormally
Returns true if the given statement can complete normally, as defined by JLS 14.21.An exception is made for
System.exit
, which cannot complete normally in practice. -
canCompleteNormally
public static boolean canCompleteNormally(StatementTree statement, com.google.common.collect.ImmutableMap<Tree, Boolean> patches) Returns whether the given statement can complete normally, as defined by JLS 14.21, when taking into account the givenpatches
. The patches are a (possibly empty) map fromTree
to a boolean indicating whether that specificTree
can complete normally. All relevant tree(s) not present in the patches will be analyzed as per the JLS.An exception is made for
System.exit
, which cannot complete normally in practice. -
canFallThrough
Returns true if the given case tree can fall through to the next case tree.An exception is made for
System.exit
, which cannot complete normally in practice.
-