LuciferYang opened a new pull request, #7732:
URL: https://github.com/apache/kyuubi/pull/7732

   ### Why are the changes needed?
   
   Closes #7731.
   
   `ReflectUtils.getField` and `invokeAs` wrapped the whole body in one `try` 
and rewrote any `Exception` as `RuntimeException(s"$clz does not have ...", 
e)`. Because `bind`/`get`/`invoke` ran inside that same `try`, 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`/`catch` to wrap only the lookup 
(`DynFields`/`DynMethods` `build`/`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 `ReflectUtilsSuite` cases: an invoked method that throws 
`IllegalArgumentException("bad input")` must propagate that exception rather 
than a "does not have" message, and binding a `Class` target to an instance 
field must surface the field wrapper's "Cannot bind" 
`IllegalArgumentException`. Both fail if the catch is widened back over the 
invocation.
   
   ```
   build/mvn test -pl kyuubi-util-scala -am
   build/mvn scalastyle:check spotless:check -pl kyuubi-util-scala -am
   ```
   
   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
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to