Inspectopedia 2026.1 Help

String compared with referential equality

Reports code that uses === or !== to compare strings.

These operators determine referential equality instead of comparing content. In most cases, strings should be compared using == or !=, which does a character-by-character comparison when the strings are different objects.

Example:

fun foo(s: String, t: String) { val b = t === s }
fun foo(s: String, t: String) { val b = t == s }

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.

StringReferentialEquality
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 | Kotlin | Probable bugs

Inspection ID: StringReferentialEquality

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 StringReferentialEquality

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 2026.1, Qodana for JVM 2026.1,

Last modified: 31 March 2026