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:
public BankAccount(long accountNumber,
String owner,
double balance,
double interestRate) {
// fields initialization
}
- 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
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.
Here you can find the description of settings available for the Constructor with too many parameters inspection, and the reference of their default values.
Inspection Details | |
---|---|
By default bundled with: | |
Can be installed with plugin: | Java, 243.23126 |
Thanks for your feedback!