Class Finally

java.lang.Object
com.google.errorprone.bugpatterns.BugChecker
com.google.errorprone.bugpatterns.Finally
All Implemented Interfaces:
BugChecker.BreakTreeMatcher, BugChecker.ContinueTreeMatcher, BugChecker.ReturnTreeMatcher, BugChecker.ThrowTreeMatcher, Suppressible, Serializable

public class Finally
extends BugChecker
implements BugChecker.ContinueTreeMatcher, BugChecker.ThrowTreeMatcher, BugChecker.BreakTreeMatcher, BugChecker.ReturnTreeMatcher
Matches the behaviour of javac's finally Xlint warning.

1) Any return statement in a finally block is an error 2) An uncaught throw statement in a finally block is an error. We can't always know whether a specific exception will be caught, so we report errors for throw statements that are not contained in a try with at least one catch block. 3) A continue statement in a finally block is an error if it breaks out of a (possibly labeled) loop that is outside the enclosing finally. 4) A break statement in a finally block is an error if it breaks out of a (possibly labeled) loop or a switch statement that is outside the enclosing finally.

Author:
eaftan@google.com (Eddie Aftandilian), cushon@google.com (Liam Miller-Cushon)
See Also:
Serialized Form