Search code examples
javaandroidlintsuppress-warningsandroid-lint

SuppressWarnings for: Boolean method 'methodName' is always inverted


The list of the most common SuppressWarnings annotations is so long and non-intuitive, that I am lost to find a correct annotation for warning

Boolean method 'methodName' is always inverted

I don't want to change the method to return a negative value, since there is a logic consistency in the naming - e.g. method name is: hasFlag(...).

What is the right annotation for this type of Lint Analysis warning?


Solution

  • @SuppressWarnings("BooleanMethodIsAlwaysInverted")
    

    You can discover these with the help of Android Studio. Expand the quick fix menu (alt+enter on my computer) and then choose one of the suppress quick fixes.