[foreign] RFR 8221154: jextract should generate java source files
Maurizio Cimadamore
maurizio.cimadamore at oracle.com
Wed Mar 20 11:08:18 UTC 2019
Hi,
looks a solid piece of work! Comments:
1) In JType there seems to be a dependency on what the sourceSignature
method generates and the set of imports generated by the source factory.
I wonder if we could make the dependency explicit by adding another
virtual method to JType which lists the packages it depends on (so that
the source factory can collect them all in a set, and add an import at
the end).
2) In JavaSourceBuilder::addMethod (both variant) shouldn't we use
getSourceSignature(TRUE) for the parameter types?
3) Seems like there's a lot of duplication between the two
JavaSourceBuilder::addMethod. The main differences seem to be where the
function name comes from and the fact that the tree-based version also
has (optional) parameter names; maybe we can rebase both methods on top
of a third version which is more low level?
The rest looks good; there's obvious duplication with
AsmCodeFactory/Ext, but I think that's mostly by design (e.g. you
started from those builders and replaced ASM calls with SourceBuilder
calls, which is a fine approach).
Maurizio
On 20/03/2019 10:29, Sundararajan Athijegannathan wrote:
> Please review.
>
> This is initial change for moving jextract towards source generation.
> The option --src-dump-dir will most likely be changed/removed later.
> It is a development/debug option for now. Reasons for source instead
> of direct .class generation are documented in the bug report.
>
> Bug: https://bugs.openjdk.java.net/browse/JDK-8221154
> Webrev: https://cr.openjdk.java.net/~sundar/8221154/webrev.00/
>
> Thanks,
> -Sundar
More information about the panama-dev
mailing list