i want to write an annotation that is able to carry type parameter from super class declaration to sub class declarations. Assumed the following scenario:
Problem with this is, if a type parameter changes, i have to adjust all of them in every sub class by hand. The idea is to develop an annotation that can carry type declarations to the corresponding subclasses. Like this:
The annotation is responsible for completing the declaration of the sub class.
I know how to develop annotations, i know that i need an annotation processor and i know the mirrors api. What i don't know is, how to alter the source code. So i'm asking, is there any convenient way to do this or is it pain?
I'm not sure if it's possible but maybe you could alter bytecode with a manipulator like javassist.
You'll probably need a custom class loader for that because once a class has been loaded it
can't be changed.
"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.