Skip to content

Commit 8fa64d4

Browse files
cushonError Prone Team
authored and
Error Prone Team
committed
Fix enclosingPackage after 3ac0471
PiperOrigin-RevId: 441783482
1 parent f6323b2 commit 8fa64d4

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1163,10 +1163,11 @@ public static ClassSymbol enclosingClass(Symbol sym) {
11631163
@Nullable
11641164
public static PackageSymbol enclosingPackage(Symbol sym) {
11651165
Symbol curr = sym;
1166-
for (; curr != null && curr.owner != null; curr = curr.owner) {
1166+
while (curr != null) {
11671167
if (curr.getKind().equals(ElementKind.PACKAGE)) {
11681168
return (PackageSymbol) curr;
11691169
}
1170+
curr = curr.owner;
11701171
}
11711172
return null;
11721173
}

0 commit comments

Comments
 (0)