boolean (PsiElement @NotNull [] elements, @NotNull Set<PsiVariable> variables) { Set<PsiField> fields = StreamEx.of(variables) .select(PsiField.class) .filter(field -> !field.hasModifierProperty(PsiModifier.FINAL)) .toSet(); if (!fields.isEmpty()) { FieldModificationVisitor visitor = new FieldModificationVisitor(fields); for (PsiElement element : elements) { element.accept(visitor); if (visitor.myModified) { return true; } } } return false; }