Inspectopedia Help

Static collection

Reports static fields of a Collection type. While it's not necessarily a problem, static collections often cause memory leaks and are therefore prohibited by some coding standards.

Example:

public class Example { static List<String> list = new ArrayList<>(); }

Configure the inspection:

  • Use the Ignore weak static collections or maps option to ignore the fields of the java.util.WeakHashMap type.

Inspection options

Option

Type

Default

Ignore weak static collections or maps

Checkbox

false

Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for JVM 2023.3

Plugin:

Java, 233.SNAPSHOT

Last modified: 13 July 2023