Skip to content

Fix RedundantNullabilityCheck for nested types - #14430

Open
Kukzze wants to merge 1 commit into
PaperMC:mainfrom
Kukzze:fix/redundant-nullmarked-nested-types
Open

Kukzze wants to merge 1 commit into
PaperMC:mainfrom
Kukzze:fix/redundant-nullmarked-nested-types

Conversation

@Kukzze

@Kukzze Kukzze commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

Summary

RedundantNullabilityCheck previously only verified whether package-info.java was annotated with @NullMarked. If an outer class or enclosing type declaration was marked with @NullMarked, redundant @NullMarked annotations on inner/nested classes, interfaces, records, and enums were silently overlooked.

This PR updates RedundantNullabilityCheck to inspect enclosing type declarations (using Util.getEnclosingTypeDeclaration) to flag redundant @NullMarked annotations on nested types, and adds comprehensive unit tests and test data for RedundantNullabilityCheck.

Test Plan

  • Added TestRedundantNullabilityCheck with test cases covering nested classes, interfaces, records, and enums within @NullMarked outer types, as well as valid non-redundant nested types.
  • Ran ./gradlew :paper-checkstyle:check — all tests and checkstyle checks pass cleanly.

@Kukzze
Kukzze requested a review from a team as a code owner October 28, 2026 05:07
@github-project-automation github-project-automation Bot moved this to Awaiting review in Paper PR Queue Oct 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Awaiting review

Development

Successfully merging this pull request may close these issues.

1 participant