I know how preferences work however I do not seem to be able to do it on the following class: Magento\Framework\Code\Generator
Plugins don't seem to work either, I need to exclude a few classes from the default factory generation logic. Has anybody been able to get this to work?