Skip to content

Commit

Permalink
[javac] Correctly take into account the @NullMarked status of enclo…
Browse files Browse the repository at this point in the history
…sing types.

PiperOrigin-RevId: 716367513
  • Loading branch information
rluble authored and copybara-github committed Jan 16, 2025
1 parent bab9e6e commit b976bcc
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1331,8 +1331,13 @@ private static boolean isNullMarked(Element element) {
}

Element enclosingElement = element.getEnclosingElement();
return (enclosingElement instanceof TypeElement || enclosingElement instanceof PackageElement)
&& isNullMarked(enclosingElement);
while (enclosingElement != null
&& !(enclosingElement instanceof TypeElement
|| enclosingElement instanceof PackageElement)) {
enclosingElement = enclosingElement.getEnclosingElement();
}

return enclosingElement != null && isNullMarked(enclosingElement);
}

private static List<TypeParameterElement> getTypeParameters(TypeElement typeElement) {
Expand Down

0 comments on commit b976bcc

Please sign in to comment.