Inspectopedia 2025.3 Help

Nullable type argument in Java collection that doesn't support nulls

Reports providing nullable type arguments to Java collections that don't accept nulls.

Some Java collections shipped in Java Standard Library do not support null elements, keys, or values. Such collections' type arguments shouldn't be instantiated with nullable types.

Example:

val map = ConcurrentHashMap<String, String?>()

After the quick-fix is applied:

val map = ConcurrentHashMap<String, String>()

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.

JavaCollectionWithNullableTypeArgument
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 | Java interop issues

Inspection ID: JavaCollectionWithNullableTypeArgument

Inspection options

Here you can find the description of settings available for the Nullable type argument in Java collection that doesn't support nulls inspection, and the reference of their default values.

Java collections to process

Option ID:

fqNameCollectionsNamesStrings

Default value:

[java.util.concurrent.ConcurrentHashMap, java.util.concurrent.ConcurrentSkipListMap, java.util.concurrent.ConcurrentSkipListSet, java.util.concurrent.ConcurrentLinkedQueue, java.util.concurrent.ConcurrentLinkedDeque, java.util.concurrent.ArrayBlockingQueue, java.util.concurrent.BlockingQueue, java.util.concurrent.LinkedTransferQueue, java.util.concurrent.LinkedBlockingQueue, java.util.concurrent.LinkedBlockingDeque, java.util.concurrent.DelayQueue, java.util.concurrent.PriorityBlockingQueue, java.util.concurrent.SynchronousQueue, java.util.concurrent.TransferQueue, java.util.PriorityQueue]

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 JavaCollectionWithNullableTypeArgument

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.3, Qodana for JVM 2025.3,

Last modified: 03 December 2025