-
Notifications
You must be signed in to change notification settings - Fork 376
Fix WPI Non-Termination Issue with @UnknownInitialization Annotations #6657
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
base: master
Are you sure you want to change the base?
Changes from 19 commits
ebb561b
30d842f
05ef6fb
ebf782c
5167ed1
ee517ea
f3a08a7
5df02b7
42d7812
711ae4d
d9a6504
342bc94
b5a62d8
5f3f89d
81f1f2b
8c345fd
118b771
4818ac2
134e76f
1c31423
131e864
4691e84
872d7e1
33c82a6
5b642c3
d7acb57
1b1d56f
8826275
388e584
fd16cc8
eb79855
6ae7fba
f057894
1a32487
90129a3
cf451ba
8eafe7d
1d5fb60
217ba50
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1001,6 +1001,10 @@ protected void updateAnnotationSet( | |
return; | ||
} | ||
|
||
// Update Initialization Annotations in WPI. It is only applied to | ||
// Nullness-related qualifiers' inference to prevent possible loops. | ||
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. This comment is inappropriate, because it may not remain true. In particular, it is mixing implementation details of a specific checker (nullness) with the generic WPI algorithm (which is what this code implements). The comment should explain the general purpose of this callback hook, not the specific use in one checker. |
||
atypeFactory.wpiAdjustForInitializationAnnotations(rhsATM); | ||
|
||
AnnotatedTypeMirror atmFromStorage = | ||
storage.atmFromStorageLocation(rhsATM.getUnderlyingType(), annotationsToUpdate); | ||
updateAtmWithLub(rhsATM, atmFromStorage); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5523,6 +5523,15 @@ public boolean wpiShouldInferTypesForReceivers() { | |
return true; | ||
} | ||
|
||
/** | ||
* Changes the type of {@code rhsATM} when being assigned to anything, for use by whole-program | ||
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. "when being assigned to anything" isn't quite correct, I think. This method is called anytime an annotation set is updated, so it is not called just at assignments - instead, it is called any time that WPI does an update, which conceptually is at all pseudo-assignments. The other text that you have here makes that clear, as well; please make this consistent. |
||
* inference. The default implementation does nothing. | ||
* | ||
* @param rhsATM the type of the rhs of the pseudo-assignment, which is side-effected by this | ||
* method | ||
*/ | ||
public void wpiAdjustForInitializationAnnotations(AnnotatedTypeMirror rhsATM) {} | ||
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. The name "wpiAdjustForInitializationAnnotations" doesn't convey the generic purpose of this method. Rather, it conveys the specific purpose that you've used the method for in the Nullness Checker. The name here should be chosen to explain when this method is called and what it might be used for in the general case, not the specific case that you're trying to fix in this PR. I suggest choosing a name that will help someone reading |
||
|
||
/** | ||
* Side-effects the method or constructor annotations to make any desired changes before writing | ||
* to an annotation file. | ||
|
Uh oh!
There was an error while loading. Please reload this page.