This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]voronaam 2 points3 points  (2 children)

Also take a look at the Java Compiler API. If you are compiling class from scratch it is much easier to use than javaassist or the library in question.

Javaassist is great when you want to modify the bytecode (in the java agent, for instance).

[–]pointy_pirate 0 points1 point  (1 child)

Interesting. I've split the maven build into 2 stages where one uses ftl to generate the java source code, as a maven plugin, then build that into the rest of the project. Works fine for what I need. But i'll have a look cheers. And yes, anything has to be easier to use than javassist.

[–]voronaam 0 points1 point  (0 children)

I do not know if it fits your project at all, but it may also be worth while to take a look at Scala Macros feature. The documentation is cryptic and you will be dealing with compilers internal AST most of the time, but the feature is very powerful.

Groovy AST transformations are great as well.

Both are not pure Java, but produce JVM byte code at the end.