Constructor with too many parameters
Reports constructors whose number of parameters exceeds the specified maximum. Such objects are hard to instantiate, especially if some parameters are optional. Constructors with too many parameters may indicate that refactoring is necessary. Consider applying the builder pattern, for example.
Example:
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.
ConstructorWithTooManyParameters- 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.
Configure the inspection:
Use the Parameter limit field to specify the maximum allowed number of parameters in a constructor.
Use the Ignore constructors with visibility list to specify whether the inspection should ignore constructors with specific visibility.
Inspection options
Here you can find the description of settings available for the Constructor with too many parameters inspection, and the reference of their default values.
- Parameter limit
5
- Ignore constructors with visibility
Default setting: none
Other available settings:
private
package-private & private
protected, package-private & private
Inspection Details | |
---|---|
By default bundled with: | |
Can be installed with plugin: | Java, 243.23126 |