Inspectopedia
 
2024.3

Collection declared by class, not interface

Warning
New
Last modified: 03 December 2024

Reports declarations of Collection variables made by using the collection class as a type, rather than an appropriate interface. The warning is not issued if weakening the variable type will cause a compilation error.

Example:

A quick-fix is suggested to use the appropriate collection interface (e.g. Collection, Set, or List).