3 ms·
An annotation processor does not seem to be a good fit here. Annotation processors can only generate new classes, not modify existing ones. So you would have to
by needusername 9y ago
An annotation processor does not seem to be a good fit here. Annotation processors can only generate new classes, not modify existing ones. So you would have to make all classes abstract and then generate non-abstract ones that have a #children() method and refer to the generated classes everywhere in your code.
- norswap 9y agoThere are ways if you're not too worried about using private compiler APIs: http://scg.unibe.ch/archive/projects/Erni08b.pdf http://scg.unibe.ch/archive/projects/Erni08b.pdf
- needusername 9y agoI'm really not a fan of these "clever" hacks that rely on compiler internals. That doesn't even work on ecj.