Class Reachability

java.lang.Object
com.google.errorprone.util.Reachability

public class Reachability extends Object
An implementation of JLS 14.21 reachability.
  • Constructor Details

    • Reachability

      public Reachability()
  • Method Details

    • canCompleteNormally

      public static boolean canCompleteNormally(StatementTree statement)
      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 given patches. The patches are a (possibly empty) map from Tree to a boolean indicating whether that specific Tree 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

      public static boolean canFallThrough(CaseTree caseTree)
      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.