assertj-assertions-generator icon indicating copy to clipboard operation
assertj-assertions-generator copied to clipboard

Using JavaPoet ?

Open fduminy opened this issue 9 years ago • 4 comments

What do you think about using JavaPoet to generate java source code ? I recommend this article about generation of java code (with JavaPoet).

fduminy avatar Apr 30 '16 10:04 fduminy

I'm not sure it is applicable as the generator exposes templates that users can change as they wish (as long as it still generates working code).

joel-costigliola avatar May 30 '16 10:05 joel-costigliola

An alternative here can also be: javaparser. It allows for creating AST from snippets of code as well, so I think it should work with the templates quite easily.

filiphr avatar May 20 '17 10:05 filiphr

We can try that as a spike, my main concern is to keep the flexibility of the template mechanism that allows users to change the generated code relatively easily.

joel-costigliola avatar May 21 '17 03:05 joel-costigliola

I would also advocate usage of JavaPoet. In order to stay compatible with template files, i would suggest first generating classes as usual and then using JavaPoet to model them, along with original classes, adding plugin abstraction allowing more complex code modifications, like for example conditional method generation based on property type

jbytecoder avatar Mar 25 '20 11:03 jbytecoder