I want to do some annotation processing (serialization):
What I want:
- I dont want to subclass the classes in question
- I want to insert a method into an existing class
- I want to use ASM to add these methods
- I dont want to generate them by hand, but automatically on compilation
What I have:
- An annotation :)
- The code to scan and modify a .class file with ASM
The problem:
- I don't know when to process the .class files
- As far as I know, the AbstractProcessor approach only allows creating new source files
- With ASM, I modify .class files, but how can the compiler compile the .java files when the method still needs to be created by me?
Ideas:
- Right now, the methods to be added are defined by an interface, but using a superclass, I could have a do-nothing implementation, which I can override in post. However, this robs a lot of flexibility, and still, I don't know how to compile it with javac in one step...
Thank you in advance for any tips, suggestions and solutions,
Till