-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AutoValue 1.10.4 no longer works with GraalVM native image resource loading #1783
Comments
Do you by chance have something I could run to reproduce the problem? Your proposed fixes seem reasonable but I would want to be able to test them. I'm also a little puzzled because I believe we do run a graalified Turbine internally at Google. Perhaps @cushon might have some insights? |
@eamonnmcmanus Here you go: https://github.com/timothyg-stripe/auto-1783 It's as minimal as I could make it, but it's still rather large as it needs to include numerous Maven jars and rules_graalvm. The README has more details, including an appendix on overriding jars that you could use to test a locally built jar. |
We include some annotation processors in the internal GraalVM native-image for turbine, but AutoValue isn't included because it doesn't generate API and shouldn't need to run during annotation processing. We also use AutoValue with @timothyg-stripe is your use-case that you have code that deliberately references generated |
Ah, that makes a lot of sense. I'm not sure historically why we have AutoValue on |
Thanks for putting together the repro! I did finally manage to make it work with my own compiled jar, though given my Bazel ignorance it wasn't straightforward. :-) |
This should have no user-visible effect. It is intended for the unusual case where someone is generating AutoValue (etc) code from code that has been compiled with GraalVM. Fixes #1783. RELNOTES=n/a PiperOrigin-RevId: 638389412
The just-released 1.11.0 includes this change. |
Thank you for the quick fix! |
AutoValue 1.10.4 includes commit 3f69cd2 (intending to fix #1572), by explicitly enumerating possible URL schemes returned by
Class.getResource
and reading the URL appropriately. The code supportsfile
andjar
URLs, but GraalVM native image's resource loading support would return aresource
URL likeresource:/com/google/auto/value/processor/autovalue.vm
, which is not supported:AutoValue 1.10.3 works correctly in GraalVM.
Recommended fixes:
TemplateVars.readerFromUrl
to callgetResourceAsStream
for theresource
URL scheme, orgetResourceAsStream
.(Context: I am compiling Turbine as a GraalVM native image with built-in support for AutoValue.)
cc @eamonnmcmanus
The text was updated successfully, but these errors were encountered: