Write native configuration file when only lambda hints are present - #36989
Closed
junhyeong9812 wants to merge 1 commit into
Closed
junhyeong9812 wants to merge 1 commit into
junhyeong9812 wants to merge 1 commit into
Conversation
FileNativeConfigurationWriter did not write reachability-metadata.json when a RuntimeHints instance contained only lambda hints, because NativeConfigurationWriter.hasAnyHint() omitted ReflectionHints.lambdaHints() from its checks. As a result, lambda metadata emitted by RuntimeHintsWriter was silently dropped. Include lambda hints in hasAnyHint() so the configuration file is written whenever lambda hints are present. Signed-off-by: junhyeong9812 <pickjog@gmail.com>
Member
|
Good catch! 👍 This is effectively a bug that was introduced when the support for lambda hints was added in 7.0.6. |
Contributor
Author
|
Thank you for the review and merge, @sbrannen. Thanks to your work, I get to use a great framework every day. I really appreciate it. |
Member
|
@junhyeong9812, you're very welcome, and thanks for the kinds words! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
FileNativeConfigurationWriterfails to writereachability-metadata.jsonwhen aRuntimeHintsinstance contains only lambda hints, silently dropping the lambda metadata.Problem
NativeConfigurationWriter.write(RuntimeHints)only writes the configuration file whenhasAnyHint(hints)returnstrue:However
hasAnyHint(hints)does not checkReflectionHints.lambdaHints():RuntimeHintsWriteralready serializes lambda hints (see theoneLambdatest inRuntimeHintsWriterTests), so when aRuntimeHintsholds only lambda hints registered viaReflectionHints.registerLambda(...),hasAnyHintreturnsfalse, the file is never written, and the lambda metadata is lost. This is not caught on the JVM; it only surfaces as a native-image runtime failure.Fix
Include lambda hints in
hasAnyHint()so the configuration file is written whenever lambda hints are present:Adds a
lambdaConfig()test that registers only a lambda hint and asserts the file is written with the expected JSON. Without the fix the test fails withNoSuchFileExceptionbecause no file is produced.