Inspectopedia 2025.2 Help

Non-boolean method name must not start with question word

Reports non-boolean methods whose names start with a question word. Such method names may be confusing.

Non-boolean methods that override library methods are ignored by this inspection.

Example:

public void hasName(String name) { assert names.contains(name); }

A quick-fix that renames such methods is available only in the editor.

Locating this inspection

By ID

Can be used to locate inspection in e.g. Qodana configuration files, where you can quickly enable or disable it, or adjust its settings.

NonBooleanMethodNameMayNotStartWithQuestion
Via Settings dialog

Path to the inspection settings via IntelliJ Platform IDE Settings dialog, when you need to adjust inspection settings directly from your IDE.

Settings or Preferences | Editor | Inspections | Java | Naming conventions | Method

Configure the inspection:

  • Use the Boolean method name prefixes list to specify the question words that should be used only for boolean methods.

  • Use the Ignore methods with 'java.lang.Boolean' return type option to ignore methods with java.lang.Boolean return type.

  • Use the Ignore methods overriding/implementing a super method option to ignore methods which have supers.

Inspection options

Here you can find the description of settings available for the Non-boolean method name must not start with question word inspection, and the reference of their default values.

Boolean method name prefixes

Default value:

[are, can, check, contains, could, endsWith, equals, has, is, matches, must, shall, should, startsWith, was, were, will, would]
Ignore methods with 'java.lang.Boolean' return type

Default value:

Not selected
Ignore methods overriding/implementing a super method

Default value:

Selected

Suppressing Inspection

You can suppress this inspection by placing the following comment marker before the code fragment where you no longer want messages from this inspection to appear:

//noinspection NonBooleanMethodNameMayNotStartWithQuestion

More detailed instructions as well as other ways and options that you have can be found in the product documentation:

Inspection Details

By default bundled with:

IntelliJ IDEA 2025.2, Qodana for JVM 2025.2,

Last modified: 18 September 2025