Virtual inheritance breaks AOP on on base class methods.

Description

If using AOP on a class that is also being used as the base class for virtual inheritance, you can get the following error:

The reason is that the AOP mixins rely on $wbAOPTargetMapping which is added to the base class. However, the toVirtualInheritance() method in Builder.cfc does not copy over $WBAOPTARGETMAPPING and $WBAOPTARGETS which leaves the AOP mixins in the sub class with no access to them.

An easy way to see this in action is to create a handler without the "extends" attribute and no init()., then bind an AOP aspect like so:

When WireBox creates the sub class, it will replace the "init()" in the base class with an AOP proxy which will then be copied over into your handler without the supporting properties needed to execute. This will cause the init to error out when it is called as part of the sub class.

Can we stop excluding $WBAOPTARGETMAPPING and $WBAOPTARGETS from being copied from the base class to the target during virtual inheritance? Some changes might need to be made to AOP to append to $WBAOPTARGETS instead of overriding it in Mixer.decorateAOPTarget().

Fixed

Assignee

Brad Wood

Reporter

Brad Wood

Labels

None

Components

Fix versions

Priority

Major