Back to Intellij Community

CloneCallsConstructors

java/java-impl/resources/inspectionDescriptions/CloneCallsConstructors.html

2025.3-rc-2339 B
Original Source

Reports calls to object constructors inside clone() methods.

It is considered good practice to call clone() to instantiate objects inside of a clone() method instead of creating them directly to support later subclassing. This inspection will not report clone() methods declared as final or clone() methods on final classes.