I've hunted through the Javassist API, but I can't find what I think is something it should be able to do.
I'd like to read in a .java file and create a class in memory without writing out a .class file. Unfortunately, com.sun.tools.javac.Main doesn't seem to have a way to output the bytecode to anything other than a file in the filesystem. And CtClass doesn't seem to have a constructor that accepts a source code stream rather than a stream of bytecodes.
Is this possible with Javassist? If not, any other ideas how I might go about it?
Thanks,
Todd
You cannot make a CtClass from source code of a whole
class declaration. However, you can first create an empty
CtClass and then append to it a CtMethod created from
source code of a method declaration.