-
Notifications
You must be signed in to change notification settings - Fork 437
Don't output top annotations to .ajava files #6432
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
mernst
wants to merge
10
commits into
typetools:master
Choose a base branch
from
mernst:ainfer-no-top
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
9c86360
Define `isTop(AnnotationMirror)`
mernst 708e478
Don't output top annotations to .ajava files
mernst 15b761b
Merge ../checker-framework-fork-mernst-branch-isTop into ainfer-no-top
mernst e87bfc0
Fix compilation errors
mernst 703645f
Merge ../checker-framework-fork-mernst-branch-isTop into ainfer-no-top
mernst bc64479
Compilation fixes
mernst 3bcc498
Merge ../checker-framework-branch-master into ainfer-no-top
mernst 625d478
Merge ../checker-framework-branch-master into ainfer-no-top
mernst 67c4a90
Merge ../checker-framework-branch-master into ainfer-no-top
mernst a214a13
Merge ../checker-framework-branch-master into ainfer-no-top
mernst File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -34,4 +34,3 @@ annotation @G: @Retention(RUNTIME) | |
| boolean[] fieldC | ||
| int fieldD | ||
| int fieldE | ||
|
|
||
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -737,7 +737,7 @@ public boolean removePrimaryAnnotationByClass(Class<? extends Annotation> a) { | |
| * Remove any primary annotation that is in the same qualifier hierarchy as the parameter. | ||
| * | ||
| * @param a an annotation from the same qualifier hierarchy | ||
| * @return if an annotation was removed | ||
| * @return true if an annotation was removed | ||
| */ | ||
| public boolean removePrimaryAnnotationInHierarchy(AnnotationMirror a) { | ||
| AnnotationMirror prev = this.getPrimaryAnnotationInHierarchy(a); | ||
|
|
@@ -747,6 +747,17 @@ public boolean removePrimaryAnnotationInHierarchy(AnnotationMirror a) { | |
| return false; | ||
| } | ||
|
|
||
| /** | ||
| * Remove any annotation that is the top annotation in its qualifier hierarchy. | ||
| * | ||
|
Comment on lines
+751
to
+752
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. JavaDoc scope is too broad; method only removes primary annotations. Please tighten wording to match behavior and avoid API ambiguity. Suggested doc fix- * Remove any annotation that is the top annotation in its qualifier hierarchy.
+ * Remove any primary annotation that is the top annotation in its qualifier hierarchy.🤖 Prompt for AI Agents |
||
| * @return true if an annotation was removed | ||
| */ | ||
| public boolean removePrimaryTopAnnotations() { | ||
| int oldSize = primaryAnnotations.size(); | ||
| primaryAnnotations.removeIf(am -> atypeFactory.isTop(am)); | ||
| return oldSize != primaryAnnotations.size(); | ||
| } | ||
|
|
||
| /** | ||
| * Removes multiple primary annotations from the type. | ||
| * | ||
|
|
||
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Guard nullable parameter slots before dereference.
parameterTypescontains nullable entries; Line 1920 can throwNullPointerExceptionwhen a parameter slot has never been initialized.Proposed fix
if (parameterTypes != null) { for (AnnotatedTypeMirror atm : parameterTypes) { - atm.removePrimaryTopAnnotations(); + if (atm != null) { + atm.removePrimaryTopAnnotations(); + } } }🤖 Prompt for AI Agents