-
Notifications
You must be signed in to change notification settings - Fork 356
gradle generateAot task failed Cannot subclass primitive, array or final types class java.lang.String #969
Comments
I am experiencing this issue as well. I opened a bug springdoc/springdoc-openapi#1437 that I thought was related to Springdoc but actually appears to be related to this issue. You can see a minimal reproduction here: https://github.com/AlexanderNZ/springdoc-native-sample |
This attempts to fix the problem by adjusting the hateaos hint computation class, so that it filters out final classes. Issue: #969
We shouldn't be attempting to create proxies for those. I've added a guard to bail out earlier but fundamentally it suggests to me a problem with the computation of the hints in this case. So I have also put this change into
See the guard filter on not attempting to proxy final types. @christophstrobl what do you think? Does that look reasonable? Should it be even more selective of which return types it tries to proxy? Clearly some endpoints in springdoc have this characteristic. I don't skip proxy creation because I think it is more important for the hint computation to get it right. |
(This is the commit I made b972daf) |
Thanks @aclement for taking care of it. |
Configuring our internal projects to build native images, using gradle, got this error by the
generateAot
taskI debugged the gradle build by setting an exception break point on IllegalArgumentException class. The classes are related to spring hateoas. The issue is bytebuddy being unable to subclass java.lang.String as it is a final class, but I'm not very familiar with the spring aot plugin code so opening an issue here, to get help to further troubleshoot this.
These are the variables and their values where the exception breakpoint stops, at the point of throwing the IllegalArgumentException, I inspected a few frames back this method
org.springframework.aop.framework.ProxyGenerator#getProxyBytes
Currently using
JDK 11
gradle 7.1.1
springboot 2.5.3
spring-native 0.10.2
spring-cloud 2020.0.3
The text was updated successfully, but these errors were encountered: