Skip to content

Commit

Permalink
Fix enclosingPackage after 3ac0471
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 441783482
  • Loading branch information
cushon authored and Error Prone Team committed Apr 14, 2022
1 parent f6323b2 commit 8fa64d4
Showing 1 changed file with 2 additions and 1 deletion.
Expand Up @@ -1163,10 +1163,11 @@ public static ClassSymbol enclosingClass(Symbol sym) {
@Nullable
public static PackageSymbol enclosingPackage(Symbol sym) {
Symbol curr = sym;
for (; curr != null && curr.owner != null; curr = curr.owner) {
while (curr != null) {
if (curr.getKind().equals(ElementKind.PACKAGE)) {
return (PackageSymbol) curr;
}
curr = curr.owner;
}
return null;
}
Expand Down

0 comments on commit 8fa64d4

Please sign in to comment.