Skip to content

Commit

Permalink
Move a comment
Browse files Browse the repository at this point in the history
  • Loading branch information
mernst committed Jul 15, 2024
1 parent f273d9a commit 16ad2b2
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -487,16 +487,14 @@ 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.
// 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?
if (fieldInitialValue.initializer != null
// && varEle.getModifiers().contains(Modifier.PRIVATE)
&& ElementUtils.isFinal(varEle)
&& analysis.atypeFactory.isImmutable(ElementUtils.getType(varEle))) {
store.insertValue(fieldInitialValue.fieldDecl, fieldInitialValue.initializer);
Expand Down

0 comments on commit 16ad2b2

Please sign in to comment.