报告用作 ifwhilefordo 语句或条件表达式的赋值。

虽然有时是有意为之,但这种用法令人困惑,并且可能表明存在拼写错误(例如,应使用 = 而不是 ==)。

该快速修复会将 = 替换为 ==

示例:


  void update(String str, boolean empty) {
    // 警告:'empty' 被重新赋值,
    // 不与 str.isEmpty() 进行比较
    if (empty = str.isEmpty()) {
      ...
    }
  }

在应用快速修复后:


  void update(String str, boolean empty) {
    if (empty == str.isEmpty()) {
      ...
    }
  }