Inspectopedia Help

Abstract method called during object construction

Reports calls to abstract methods of the current class during object construction.

A method is called during object construction if it is inside a:

  • Constructor

  • Non-static instance initializer

  • Non-static field initializer

  • clone() method

  • readObject() method

  • readObjectNoData() method

Such calls may result in subtle bugs, as object initialization may happen before the method call.


abstract class Parent { abstract void abstractMethod(); } class Child extends Parent { Child() { abstractMethod(); } }

This inspection shares the functionality with the following inspections:

  • Overridable method called during object construction

  • Overridden method called during object construction

Only one inspection should be enabled at once to prevent warning duplication.

Inspection Details

Available in:

IntelliJ IDEA 2023.3, Qodana for JVM 2023.3


Java, 233.SNAPSHOT

Last modified: 13 July 2023