Is there a specific @SuppressWarnings for this warning?


I am getting a highlighted warning "condition ... is always true" on an if statement in a situation where the condition may not always be true (when a method is invoked by a superclass constructor, admittedly an obscure case). I can suppress the highlighted warning using @SuppressWarnings("all"), but I would prefer to use a more specific category. Is there one, and in general, how can I find it? I tried using the Show Inspection Description contextual menu item (which is itself not that easy to find). It gives a verbal description of the inspection and examples, and suggests adjusting the inspection options. But it does not give the name of the inspection or explain how to find it! I must be missing something obvious!


See .


You never have to type the specific inspection name manually, IDE will add it for you.

For this specific inspection the name is ConstantConditions.



Thank you for the reply. That fixed my specific issue.

However, I think there are a couple of areas for improvement.

(1) How would I know to look under "Unwrap if statement" for the options related to the warning? I would expect that menu action to do what it says, namely, unwrap the if statement, not show me a menu of inspection options. Wouldn't it be better to have a top level menu item with a label "Inspection options..." or similar?

(2) Once I disable this inspection, the "Unwrap if statement" menu item is no longer shown. If I want to change how I disable it (e.g. globally, for method method, etc.), I no longer have access to the menu to do that. What I actually did (by mistake) was Disable inspection. (It should probably say "Disable inspection globally".) To undo that I had to go to preferences and search for the inspection based on my memory of the description shown in the original menu.


Hello Alan,

Thank you for the feedback. Unfortunately the suggested points will make the inspections' UI look cumbersome in case several inspections trigger in one place of code. The current variant hides the particular inspection's settings.


I agree that the case of multiple inspections must be handled, but I presume that is not a typical case, so I would not optimize the UI for that case.

The current solution is compact, but confusing to users. That is not the trade-off that I would choose.




Please follow/comment the issue that describes your usability case: Thank you 


Please sign in to leave a comment.