Inspectopedia 2025.2 Help

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 }

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.

Settings or Preferences | Editor | Inspections | Java | Method metrics

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

Default value:

5
Ignore constructors with visibility

Default value:

none

Other available settings:

  • private

  • package-private & private

  • protected, package-private & private

Suppressing Inspection

You can suppress this inspection by placing the following comment marker before the code fragment where you no longer want messages from this inspection to appear:

//noinspection ConstructorWithTooManyParameters

More detailed instructions as well as other ways and options that you have can be found in the product documentation:

Inspection Details

By default bundled with:

IntelliJ IDEA 2025.2, Qodana for JVM 2025.2,

Last modified: 18 September 2025