Skip to content

Commit 8c476e7

Browse files
msridharError Prone Team
authored and
Error Prone Team
committed
Make return of findPathFromEnclosingNodeToTopLevel @nullable
It can clearly return `null` Fixes #4903 COPYBARA_INTEGRATE_REVIEW=#4903 from msridhar:add-nullable-annot 33fe001 PiperOrigin-RevId: 737557860
1 parent c124fc6 commit 8c476e7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

check_api/src/main/java/com/google/errorprone/util/ASTHelpers.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,8 @@ public static ExpressionTree stripParentheses(ExpressionTree tree) {
440440
* Given a TreePath, finds the first enclosing node of the given type and returns the path from
441441
* the enclosing node to the top-level {@code CompilationUnitTree}.
442442
*/
443-
public static <T> TreePath findPathFromEnclosingNodeToTopLevel(TreePath path, Class<T> klass) {
443+
public static <T> @Nullable TreePath findPathFromEnclosingNodeToTopLevel(
444+
TreePath path, Class<T> klass) {
444445
if (path != null) {
445446
do {
446447
path = path.getParentPath();

0 commit comments

Comments
 (0)