Problem with Java Generics
plblueraven opened this issue · 1 comments
Hello.
I'm using rocker 1.2.0
+ jdk 1.8.0_191
Rocker java output is not compiling when template contains e.g. @args(Collection<? extends Foo> foos)
. For this input rocker generate something like private Collection<?extendsFoo> foos;
etc. Which does not contain spaces between ?
and extends
and between extends
and class name and therefore cannot by compiled by java compiler.
Is there any configuration option to turn of such optimization? When (default) optimize = Boolean.FALSE, rocker still produces wrong java output.
@plblueraven Looks like this is a new issue you've found. I'm actually surprised we (and no one else) has hit this issue yet in the past few years -- I guess we always tend to render generics w/o needing an extends on it. There's some handling of generics, clearly not this and probably not really complicated ones with any number of recursive generics.
There's probably some changes needed to the ANTLR grammar underneath to correctly parse it and/or changing how the argument is written in the generated .java file. If you wanted to take a stab at a fix, that would be amazing!