8000 AutoValue 1.10.4 no longer works with GraalVM native image resource loading · Issue #1783 · google/auto · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
AutoValue 1.10.4 no longer works with GraalVM native image resource loading #1783
Closed
@timothyg-stripe

Description

@timothyg-stripe

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 supports file and jar URLs, but GraalVM native image's resource loading support would return a resource URL like resource:/com/google/auto/value/processor/autovalue.vm, which is not supported:

java.lang.AssertionError: Template search logic fails for: resource:/com/google/auto/value/processor/autovalue.vm
    at com.google.auto.value.processor.TemplateVars.readerFromUrl(TemplateVars.java:148)
    at autovalue.shaded.com.google.escapevelocity.Template.parseFrom(Template.java:146)
    at autovalue.shaded.com.google.escapevelocity.Template.parseFrom(Template.java:140)
    at com.google.auto.value.
57FE
processor.TemplateVars.parsedTemplateForResource(TemplateVars.java:125)
    at com.google.auto.value.processor.AutoValueTemplateVars.<clinit>(AutoValueTemplateVars.java:44)
    at com.google.auto.value.processor.AutoValueProcessor.processType(AutoValueProcessor.java:245)
    at com.google.auto.value.processor.AutoValueishProcessor.process(AutoValueishProcessor.java:442)

AutoValue 1.10.3 works correctly in GraalVM.

Recommended fixes:

  • Add a special case in TemplateVars.readerFromUrl to call getResourceAsStream for the resource URL scheme, or
  • If an unknown URL scheme is encountered, default to calling getResourceAsStream.

(Context: I am compiling Turbine as a GraalVM native image with built-in support for AutoValue.)

cc @eamonnmcmanus

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0