onDIComplete() is called twice using virtual inheritance

Description

If a base class is virtually inherited, any onDIComplete method is called as part of the getInstance() that creates the base class. Then the child class "inherits" the onDIComplete and it gets called a second time when the child class is autowired.

We need to decide which way to fix this

  • Do not allow the child to inherit any onDICOmplete methods. Easy fix, but it means the super's onDIComplete will be called technically prior to final child instance being created which differs from natrual inheritance

  • Defer the onDIComplete methods from the base class and add them into the metadata of the child class tagged as onDIcomplete methods so they all get executed as part of the final post-autowire step of the child class. More complicated but closer to natural inheritance.

  • A third option I'm not a super fan of, but it's technically the closest to natural inheritance. If the child class has an onDIComplete method, require them to manually call the base method via $super. Methods with other names bearing the onDIComplete annotation could follow the flow of either the first or second bullet.

Assignee

Luis Majano

Reporter

Brad Wood

Labels

None

Components

Priority

Major
Configure