Class with too many fields
Reports classes whose number of fields exceeds the specified maximum.
Classes with a large number of fields are often trying to do too much. Consider splitting such a class into multiple smaller classes.
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.
ClassWithTooManyFields- 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 Field count limit field to specify the maximum allowed number of fields in a class.
Use the Include constant fields in count option to indicate whether constant fields should be counted.
By default only immutable
static finalobjects are counted as constants. Use the 'static final' fields count as constant option to count anystatic finalfield as constant.Use the Include enum constants in count option to specify whether
enumconstants inenumclasses should be counted.
Inspection ID: FieldCount
Inspection options
Here you can find the description of settings available for the Class with too many fields inspection, and the reference of their default values.
- Field count limit
Option ID:
m_limitDefault value:
10- Include constant fields in count
Option ID:
m_countConstantFieldsDefault value:
Not selected- 'static final' fields count as constant
Option ID:
m_considerStaticFinalFieldsConstantDefault value:
Not selected- Include enum constants in count
Option ID:
myCountEnumConstantsDefault value:
Not selected
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:
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: |