Inspectopedia Help

'public static' collection field

Reports modifiable public static Collection fields.

Even though they are often used to store collections of constant values, these fields nonetheless represent a security hazard, as their contents may be modified even if the field is declared as final.

Example:

public static final List<String> EVENTS = new ArrayList<>();

Use the table in the Options section to specify methods returning unmodifiable collections. public static collection fields initialized with these methods will not be reported.

Inspection options

Option

Type

Default

Table

None

Class Name

TableColumn

[java.util.Collections, java.util.List, java.util.Set, java.util.Map, com.google.common.collect.ImmutableCollection, com.google.common.collect.ImmutableMap, com.google.common.collect.ImmutableMultimap, com.google.common.collect.ImmutableTable]

Method Name Regex

TableColumn

[(empty|unmodifiable).*, of, of, of, .*, .*, .*, .*]

Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for JVM 2023.3

Plugin:

Java, 233.SNAPSHOT

Last modified: 13 July 2023