Inspectopedia
 
2024.3

'public' constructor can be replaced with factory method

Warning
New
Last modified: 03 December 2024

Reports public constructors.

Some coding standards discourage the use of public constructors and recommend static factory methods instead. This way the implementation can be swapped out without affecting the call sites.

Example:

After quick-fix is applied: