[foreign] RFR 8223185: Consolidate jextract output logic in Writer

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Thu May 2 11:27:39 UTC 2019


Looks good!

Yes, compilation is important - but I always look at the code from the 
perspective of: what would happen in 5 months when we update the code to 
do something else? The fact that we have an ordering dependency between 
Main and Writer is likely going to bite once we all forgot about this 
(and we will :-)).

Maurizio

On 02/05/2019 12:21, Jorn Vernee wrote:
> Thanks, I had my doubts about that myself.
>
> Updated webrev: 
> http://cr.openjdk.java.net/~jvernee/panama/webrevs/8223185/webrev.01/
>
> FWIW; I thought the compilation was a pretty big side-effect to have, 
> so it should rather be triggered explicitly. But, I didn't really have 
> a strong opinion either way.
>
> Jorn
>
> Maurizio Cimadamore schreef op 2019-05-02 12:34:
>> Overall I like it. The only thing I don't like much is that Main seems
>> to be in control of whether classes are being compiled (see call to
>> Writer::compileClasses). I think it would be better if that was hidden
>> inside Writer itself - e.g. in order to write classfiles, jars or
>> jmod, first the internals will have to call 'compileClasses'. That
>> way, Main would be free from any ordering issue.
>>
>> Maurizio
>>
>> On 01/05/2019 14:06, Jorn Vernee wrote:
>>> Hi,
>>>
>>> I have been experimenting with a plugin based on jextract's new 
>>> source code generation, for my earlier idea to generate LayoutType 
>>> constants in various generated classes [1].
>>>
>>> I ran into a problem using --src-dump-dir. Since the dumping is done 
>>> inline in the JavaSourceFactory* classes this meant the the changes 
>>> from the plugin were not being shown in the output.
>>>
>>> It seems good to move the source output logic to Writer, since then 
>>> we can do the source output once and for all in Main, after the 
>>> jextract run. I've also moved the JModWriter and JarWriter calls 
>>> into Writer, so that we have 1 main interface for doing output 
>>> (Writer).
>>>
>>> Please review the following:
>>>
>>> Bug: https://bugs.openjdk.java.net/browse/JDK-8223185
>>> Webrev: 
>>> http://cr.openjdk.java.net/~jvernee/panama/webrevs/8223185/webrev.00/
>>>
>>> Thanks,
>>> Jorn
>>>
>>> [1] : https://bugs.openjdk.java.net/browse/JDK-8220063


More information about the panama-dev mailing list