Skip to content
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

Bean methods with generic array/varargs parameters break native compilation #30407

Closed
eiswind opened this issue Apr 29, 2023 · 5 comments
Closed
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) theme: aot An issue related to Ahead-of-time processing type: regression A bug that is also a regression
Milestone

Comments

@eiswind
Copy link

eiswind commented Apr 29, 2023

When upgrading from 3.0.5 to 3.0.6 I find that having spring-boot-starter-hateoas on the classpath breaks the native build.

The error I see is

com.oracle.svm.core.util.VMError$HostedError: Registering type as reachable after analysis: AnalysisType<org.springframework.plugin.core.Plugin[]

I could make this go away by excluding the HyperMediaAutoConfiguration, which does not help if spring data is also on the classpath (there is a check for hateoas in spring data web configuration) which again breaks my build.

I created an mre at

https://github.com/eiswind/mre-hateoas-breaks-native

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Apr 29, 2023
@wilkinsona
Copy link
Member

Thanks for the MRE. This regression is due to changes in Spring Framework 6.0.8 and does not occur when setting spring-framework.version to 6.0.7. I believe the change that causes the problem is this one. @bclozel, should this be addressed in Framework or will Spring HATEOAS/Spring Plugin have to be updated to adapt to the Framework change?

@bclozel
Copy link
Member

bclozel commented May 1, 2023

Let’s move this to Framework and figure out if this is a duplicate of oracle/graal#6510

@bclozel bclozel transferred this issue from spring-projects/spring-boot May 1, 2023
@bclozel bclozel added the in: core Issues in core modules (aop, beans, core, context, expression) label May 1, 2023
@sdeleuze
Copy link
Contributor

sdeleuze commented May 2, 2023

Looks like another GraalVM bug, same kind and inded related to the same change on Spring side, but a different one since using Spring Framework 6.0.9-SNAPSHOT or using latest GraalVM 23.1.0-dev build does not solve the issue.

It can be workaround by a org.springframework.plugin.core.Plugin[] reflection hint.

I am going to create a related GraalVM issue and bring it to the attention of GraalVM team.

@eiswind
Copy link
Author

eiswind commented May 2, 2023

I can confirm that this workaround helps. I had already tried adding Plugin.class but using Plugin[].class does the trick.
Thanks for caring!

@sdeleuze sdeleuze self-assigned this May 4, 2023
@sdeleuze sdeleuze added this to the 6.0.9 milestone May 4, 2023
@sdeleuze
Copy link
Contributor

sdeleuze commented May 4, 2023

Looks like indeed a GraalVM bug where a fix will be provided as discussed in oracle/graal#6529. It seems triggered by a bug in the GraalVM reflection metadata registration for generic arrays / varargs in OrderAwarePluginRegistry.of(T[]).

Like #30383, and as discussed during the latest Spring Framework weekly meeting, I am going to try to add a temporary workaround in order to handle this use case, and update #30394 to mention we should also remove this additional workaround when fixed on GraalVM side.

@sdeleuze sdeleuze added type: regression A bug that is also a regression and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels May 4, 2023
@sdeleuze sdeleuze changed the title Regression: Hateoas on the classpath breaks native build Bean methods with generic array/varargs parameters break native compilation May 5, 2023
sdeleuze added a commit to sdeleuze/spring-framework that referenced this issue May 5, 2023
This commit adds a workaround for oracle/graal#6529
triggered by b374824.

When the GraalVM fix will have reached a wide enough
audience, it should be removed via spring-projectsgh-30394.

Closes spring-projectsgh-30407
@sdeleuze sdeleuze closed this as completed May 5, 2023
mdeinum pushed a commit to mdeinum/spring-framework that referenced this issue Jun 29, 2023
This commit adds a workaround for oracle/graal#6529
triggered by b374824.

When the GraalVM fix will have reached a wide enough
audience, it should be removed via spring-projectsgh-30394.

Closes spring-projectsgh-30407
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) theme: aot An issue related to Ahead-of-time processing type: regression A bug that is also a regression
Projects
None yet
Development

No branches or pull requests

5 participants