You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
GraalVM Native Image support and tooling also allows to run tests in Native Image style (e.g. see docs of Spring Boot Native Image support).
As Hamcrest is a popular matcher library and Spring Boot includes Hamcrest for example in it's spring-boot-starter-test it is very likely that Hamcrest is also used in tests executed inside a GraalVM Native Image.
There are some areas where Hamcrest is relying on Java reflection most prominently through ReflectiveTypeFinder, which is used in various matcher implementations. Some of these reflection usages - but not all - can be known upfront in the library. GraalVM requires reflection usage to be registered in reflect-config.json files (see GraalVM docs here and here).
A good starting point that should suit many usecases already are reflection hints for the usages of ReflectiveTypeFinder.
Therefore my suggestion is to place the following reflect-config.json file, placed under hamcrest/src/main/resources/META-INF/native-image/org.hamcrest/hamcrest/
As it is preferred to add GraalVM Native Image support to the libraries directly I wanted to ask, if there is willingness to add this configuration to Hamcrest? If not, an alternative solution would be to add the reflection hints to the community maintained GraalVM Reachability Metadata.
The text was updated successfully, but these errors were encountered:
GraalVM Native Image support and tooling also allows to run tests in Native Image style (e.g. see docs of Spring Boot Native Image support).
As Hamcrest is a popular matcher library and Spring Boot includes Hamcrest for example in it's spring-boot-starter-test it is very likely that Hamcrest is also used in tests executed inside a GraalVM Native Image.
There are some areas where Hamcrest is relying on Java reflection most prominently through
ReflectiveTypeFinder
, which is used in various matcher implementations. Some of these reflection usages - but not all - can be known upfront in the library. GraalVM requires reflection usage to be registered inreflect-config.json
files (see GraalVM docs here and here).A good starting point that should suit many usecases already are reflection hints for the usages of
ReflectiveTypeFinder
.Therefore my suggestion is to place the following
reflect-config.json
file, placed underhamcrest/src/main/resources/META-INF/native-image/org.hamcrest/hamcrest/
As it is preferred to add GraalVM Native Image support to the libraries directly I wanted to ask, if there is willingness to add this configuration to Hamcrest? If not, an alternative solution would be to add the reflection hints to the community maintained GraalVM Reachability Metadata.
The text was updated successfully, but these errors were encountered: