[KYUUBI #7731][UTIL] Stop re-labeling invocation failures as missing members in ReflectUtils - #7732
Open
LuciferYang wants to merge 1 commit into
Open
Conversation
…ssing members in ReflectUtils
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.
Why are the changes needed?
Closes #7731.
ReflectUtils.getFieldandinvokeAswrapped the whole body in onetryand rewrote anyExceptionasRuntimeException(s"$clz does not have ...", e). Becausebind/get/invokeran inside that sametry, a failure thrown by the found field or the invoked method itself was relabeled as a missing member, and the real exception survived only as the cause.This moves the
try/catchto wrap only the lookup (DynFields/DynMethodsbuild/buildChecked). The "does not have" message now applies only when the lookup fails; a failure while binding, reading, or invoking the found member keeps its own type and message.How was this patch tested?
Added two
ReflectUtilsSuitecases: an invoked method that throwsIllegalArgumentException("bad input")must propagate that exception rather than a "does not have" message, and binding aClasstarget to an instance field must surface the field wrapper's "Cannot bind"IllegalArgumentException. Both fail if the catch is widened back over the invocation.Module green on Zulu 17.0.18 (23/23), scalastyle 0 errors, spotless clean.
Was this patch assisted by generative AI tooling?
Assisted-by: Claude Opus 4.8