Skip to content
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

All types are immutable for nullness. Field visibility shouldn't matter. #6709

Merged

Conversation

mernst
Copy link
Member

@mernst mernst commented Jul 14, 2024

Fixes #4923
Co-authored-by: Werner Dietl wdietl@gmail.com

@mernst
Copy link
Member Author

mernst commented Jul 14, 2024

Fixes #4923

@mernst mernst requested a review from smillst July 15, 2024 18:25
smillst
smillst previously approved these changes Jul 15, 2024
@@ -487,14 +487,16 @@ private boolean isExpressionOrStatementPure(
* @param classTree the class that contains {@code methodTree}
* @param methodTree the method or constructor tree
*/
// TODO: should field visibility matter? An access from outside the class might observe
// the declared type instead of a refined type. Issue a warning to alert users?
private void addInitialFieldValues(S store, ClassTree classTree, MethodTree methodTree) {
boolean isConstructor = TreeUtils.isConstructor(methodTree);
TypeElement classEle = TreeUtils.elementFromDeclaration(classTree);
for (FieldInitialValue<V> fieldInitialValue : analysis.getFieldInitialValues()) {
VariableElement varEle = fieldInitialValue.fieldDecl.getField();
// Insert the value from the initializer of private final fields.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This comment is now incorrect. I would move the TODO that's on the method to here.

@smillst smillst assigned mernst and unassigned smillst Jul 15, 2024
@mernst mernst merged commit 89cf92a into typetools:master Jul 16, 2024
28 checks passed
@mernst mernst deleted the eisopbe24aec178bfbb36fe7c00e675b091b36291cb64 branch July 16, 2024 01:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Nullness false positive referring to a field from an inner class's method
2 participants