With the introduction of `RuntimeHints`, we can now contribute reflection, resources and proxies hints that describe the expected runtime behavior of the application. While this can be verified at runtime with smoke tests, managing such tests and compiling to native there is not very efficient. This commit introduces the new `RuntimeHintsAgent`, a Java agent that instruments JDK methods related to `RuntimeHints`. It is different from the GraalVM agent, which aims at collecting all the required hints for the runtime behavior of an application and dump those in the expected format. Here, the `RuntimeHintsAgent` can collect the related invocations only for a delimited scope (typically, a lambda within a test) and later check those against a `RuntimeHints` instance. In the case of testing `RuntimeHintsRegistrar` implementations, the process is reversed: instead of manually checking for registered hints in a `RuntimeHints` instance, tests should exercise the use cases and then check that the recorded behavior is in line with the prepared hints. This first commit adds the agent infrastructure that collects the invocations for all relevant JDK methods. See gh-27981
21 lines
506 B
Groovy
21 lines
506 B
Groovy
description = "Spring Core Test"
|
|
|
|
dependencies {
|
|
api(project(":spring-core"))
|
|
api("org.junit.jupiter:junit-jupiter-api")
|
|
api("org.assertj:assertj-core")
|
|
api("com.thoughtworks.qdox:qdox")
|
|
compileOnly("org.junit.jupiter:junit-jupiter")
|
|
compileOnly("org.junit.platform:junit-platform-engine")
|
|
compileOnly("org.junit.platform:junit-platform-launcher")
|
|
}
|
|
|
|
jar {
|
|
manifest {
|
|
attributes(
|
|
'Premain-Class': 'org.springframework.aot.agent.RuntimeHintsAgent',
|
|
'Can-Redefine-Classes': 'true'
|
|
)
|
|
}
|
|
}
|