Warnings in JExtract generated code
Martin Pernollet
martin.pernollet at protonmail.com
Mon Jun 3 15:17:20 UTC 2024
Hi all,
Having already generated all code in a dedicated maven artifact, it should be easy to try both OpenRewrite and IDE code style per project.
Thank you all for the suggestions!
Cheers,
Martin
Envoyé avec la messagerie sécurisée Proton Mail.
Le lundi 3 juin 2024 à 2:19 PM, Jerven Tjalling Bolleman <jerven.bolleman at sib.swiss> a écrit :
> 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