-
Notifications
You must be signed in to change notification settings - Fork 38.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not require full type reflection when listing methods/fields
Prior to this commit, the `RuntimeHintsAgent` and its testing infrastructure would assume that calling `MyClass.class.getMethods()` requires a reflection hint on the class for introspecting public/private methods. GraalVM does not require this, in fact this call only returns methods that have reflection hints in the native image. This commit refines the agent behavior for `Class.getMethods()`, `Class.getDeclaredMethods()`, `Class.getFields()` and `Class.getDeclaredFields()`. With this change, registering at least one method/field for reflection is enough to match. During the execution of Java tests, all methods and fields will be provided, regardless of hints being registered or not. This could cause false negatives where we're missing reflection hints on methods or fields. This risk is mitigated thanks to additional instrumentation on `Method.getAnnotations()`, `Method.getParameterTypes()` and `Method.invoke()`. If a method is found reflectively, chances are it will be used for further reflection. Closes gh-29091
- Loading branch information
Showing
6 changed files
with
288 additions
and
54 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.