Class FinalLocalVariableCheck.ThrowingBranch
java.lang.Object
com.puppycrawl.tools.checkstyle.checks.coding.FinalLocalVariableCheck.ThrowingBranch
- Enclosing class:
FinalLocalVariableCheck
Assignment state for a conditional branch that cannot complete normally.
-
Field Summary
FieldsModifier and TypeFieldDescriptionCandidates that were unassigned before entering the branch, with their scopes. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateCaptures the state before entering a throwing branch. -
Method Summary
Modifier and TypeMethodDescriptionprivate static booleanChecks for a block ending in a throw outside exception handlers.private voidrestore()Restores assignment state on the path that does not enter the branch.
-
Field Details
-
unassigned
private final Map<FinalLocalVariableCheck.FinalVariableCandidate,FinalLocalVariableCheck.ScopeData> unassignedCandidates that were unassigned before entering the branch, with their scopes.
-
-
Constructor Details
-
ThrowingBranch
Captures the state before entering a throwing branch.- Parameters:
scopes- enclosing scopes
-
-
Method Details
-
isThrowingBranch
Checks for a block ending in a throw outside exception handlers. Enclosing try statements are excluded because a handler can resume execution.- Parameters:
ast- block to inspect- Returns:
- whether assignments in the block cannot reach following statements
-
restore
Restores assignment state on the path that does not enter the branch.
-