Overridden method called during object construction
Reports any calls to overridden methods of the current class during object construction. This happens if an object construction is inside:
A constructor
A non-static instance initializer
A non-static field initializer
clone()readObject()readObjectNoData()
Such calls may result in subtle bugs, as the object is not guaranteed to be initialized before the method call occurs.
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.
OverriddenMethodCallDuringObjectConstruction- 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.
This inspection shares its functionality with:
The Abstract method called during object construction inspection
The Overridable method called during object construction inspection
Only one inspection should be enabled at the same time to prevent duplicate warnings.
Inspection ID: OverriddenMethodCallDuringObjectConstruction
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: |