Warnings in JExtract generated code
Jerven Tjalling Bolleman
jerven.bolleman at sib.swiss
Mon Jun 3 12:19:36 UTC 2024
Dear Martin, Jorn,
May I point you all to the IMHO excellent openrewrite project.
https://docs.openrewrite.org/running-recipes/running-rewrite-on-a-maven-project-without-modifying-the-build
For example
mvn -U org.openrewrite.maven:rewrite-maven-plugin:run \
-Drewrite.activeRecipes=org.openrewrite.java.RemoveUnusedImports
Should remove all those unused imports. This or similar could be run
after jextract and before opening the resulting files in any editor.
Regards,
Jerven
PS. I am just a pleased openrewrite user.
On 6/3/24 14:02, Jorn Vernee wrote:
> Hello Martin,
>
> We generate all the imports up front, before we know which ones will be
> needed in the file. We could probably cut down on some of them depending
> on the type of class being generated (e.g. struct vs. header file), but
> completely removing all unused imports would take a lot of effort. We
> essentially build up a source file from a series of source code
> snippets, so we'd have to manually track the imports that each snippet
> uses. I'm not sure if it's worth the effort just to get rid of the
> unused imports, tbh. My feeling is that, because we are mechanically
> generating code, even if we removed the unused imports, there will
> always be /some/ oddities in the generated sources that you won't find
> in hand-written code (which might trigger warnings).
>
> I think Christoph has some good suggestions for workarounds,
> particularly putting the generated sources in a separate folder with a
> different warning profile.
>
> Jorn
>
> On 2-6-2024 21:27, Martin Pernollet wrote:
>> Hi,
>>
>> There are lot of unused imports in JExtract generated code leading to
>> lot of warnings.
>>
>> That would be nice to get rid of them : PanamaGL has +100.000 warnings
>> in the bindings part :)
>>
>> image.png
>>
>>
>> image.png
>>
>> Regards,
>>
>> Martin
More information about the panama-dev
mailing list