Add subpackage controls to package annotations - #138
Open
aosen-xiong wants to merge 2 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
This PR extends three Checker Framework package-level annotations with an applyToSubpackages element, enabling callers to control whether a package annotation should propagate to subpackages while keeping the current default behavior.
Changes:
- Add
boolean applyToSubpackages() default true;to@AnnotatedFor,@HasQualifierParameter, and@ReportUse. - Update Javadoc to describe the new subpackage-inheritance control and its interaction with enclosing packages.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/java.base/share/classes/org/checkerframework/framework/qual/HasQualifierParameter.java | Adds applyToSubpackages and updates package-usage semantics in Javadoc. |
| src/java.base/share/classes/org/checkerframework/framework/qual/AnnotatedFor.java | Adds applyToSubpackages and documents subpackage inheritance behavior. |
| src/java.base/share/classes/org/checkerframework/common/util/report/qual/ReportUse.java | Expands Javadoc and adds applyToSubpackages to control package vs. subpackage reporting scope. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| * field to false to limit it to the package itself; doing so does not block an applicable | ||
| * {@code @HasQualifierParameter} on an enclosing package. It can be disabled on a specific class | ||
| * and its subclasses by writing {@code @NoQualifierParameter} on that class. This annotation may | ||
| * not be written on the same class as {@code NoQualifierParameter} for the same hierarchy. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
applyToSubpackagesto@AnnotatedFor,@HasQualifierParameter, and@ReportUse.The element defaults to
true, preserving existing behavior while allowing each annotation to be limited to the package where it is written.Corresponding Checker Framework issue: eisop/checker-framework#1990