Reports methods with a boolean return type the usages of which always occur in negated context. Since this inspection requires global code analysis, it is only available in batch inspection mode.

For example:

class C {
  boolean inverted() {
    return true;
  }

  void f() {
    if (!inverted()) {
      return;
    }
  }
  boolean member = !inverted();
}  

Powered by InspectionGadgets