rometools / rome

Java library for RSS and Atom feeds
https://rometools.github.io/rome
Apache License 2.0
905 stars 168 forks source link

GH-599: Add support for GraalVM native images #636

Closed artembilan closed 1 year ago

artembilan commented 1 year ago

Fixes https://github.com/rometools/rome/issues/599

There is a lot of reflection in the project which probably has to be reworked this or other way eventually. But for now it is enough to have a proper reflection info exposed for GraalVM when it builds a native image for our application.

Used a native-image-agent to take a required native image config from the running sample application. More info in GraalVM docs: https://www.graalvm.org/22.0/reference-manual/native-image/Agent/. Works only if GraalVM is used to run the application, of course.

In general it is probably better to rework all the content of the rome.properties into a Java ServiceLoader API.

There is also too much clone() operations with reflection in the project: perhaps better to look into something like deep copy approach.

So, the fix is like this:

PatrickGotthard commented 1 year ago

Hi @artembilan,

can I merge this as-is to add support for GraalVM? I really have no time to dig deeper into this but at least I'm sure that this change does not break anything 🙃

Regards, Patrick

artembilan commented 1 year ago

You are right: it does not. As you see there is no code change , but this will help consumers of this project to be able to build GraalVM native images smoothly.

PatrickGotthard commented 1 year ago

Thanks for your contribution. I've merged it right now and all your mentioned improvements are planned for the future :)

artembilan commented 1 year ago

Good. Let me know when those changes are in, so I'll try it against native image and possibly contribute back according to a new state of matters.