find_reflection_usage
Detect Java reflection API calls like Class.forName and Method.invoke to reveal dynamic usages static reference searches miss and renames can break.
Instructions
Find places where Java reflection API is used.
USAGE: find_reflection_usage() OUTPUT: All reflection calls grouped by method type
Detects calls to:
Class.forName(), Class.newInstance()
Class.getMethod/getDeclaredMethod/getField/getDeclaredField
Class.getConstructor/getDeclaredConstructor
Method.invoke(), Field.get/set(), Constructor.newInstance()
These usages are invisible to static reference searches and can break when types or methods are renamed.
maxResults caps the calls listed for each reflection method, all its overloads together (default 100), in source order: by file, then position. summary counts every call of each reflection method, and totalCalls and meta.totalCount count every call; meta.truncated is true when calls are left out. potentialMatches lists, the first maxResults of each reflection method in source order, the calls JDT could not confirm, each with its reflection method.
potentialMatches, present only when there are any, holds the places JDT's search reports as possible matches but cannot confirm, because a type or name there does not resolve (a missing dependency or a compile error): count is their exact number, and locations lists them, as many as the results it stands beside may list. They are never counted or listed as results.
Requires load_project to be called first.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| maxResults | No | Maximum results per reflection method (default 100) |