square / javapoet

A Java API for generating .java source files.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

$L combined with ExecutableElement in ecj produces unexpected results

rzpt opened this issue · comments

commented

In ecj, $L combined with an ExecutableElement representing Supplier#get will insert public abstract T get() instead of get(). I am not sure what the intended behavior is, but it seems to work fine with javac.

I have written a workaround in derive4j for this specific case, but I am wondering if this is javapoet bug.
derive4j/derive4j#105

If you're not using an explicitly supported type, I believe literal output falls back to toString. That would explain the difference in compilers.

commented

Aha, thank you for the pointer. From the readme: Arguments for literals may be strings, primitives, and a few JavaPoet types described below. Indeed, it does seem that ecj's toString on the ExecutableElement will produce the entire method signature. Closing.