Skip to main content
Moderne OnlyThis recipe is proprietary to Moderne and runs on the Moderne platform or CLI — it isn’t part of the open-source catalog. Available with a Moderne subscription.Contact Sales

Find Java local variable references

Recipe IDio.moderne.prethink.FindJavaLocalVariableReferences
Artifactio.moderne.recipe:rewrite-prethink

Report regular block-local declarations referenced by bare ordinary invocation argument, select or direct method-return identifiers, with original declaration and reference identities, source ranges and explicit binding states. Binding follows lexical visibility and declarator order in the same nearest ordinary method; reassignment retains declaration identity. Excludes fields, formals, lambda bodies, captures, constructors, initializers and assignment-target context. Does not change sources or establish initializer values, reaching definitions, taint or runtime flow.

Single recipeOpenRewriteModerne Proprietary License
Try in PlatformTry this recipe in the Moderne platform. Not a user yet? You’ll get a no-setup demo environment, with nothing to install or configure.

Usage​

Run this recipe

This recipe has no required configuration options. Users of Moderne can run it via the Moderne CLI.

You will need to have configured the Moderne CLI on your machine before you can run the following command.

shell
mod run . --recipe FindJavaLocalVariableReferences

If the recipe is not available locally, then you can install it using:

RELEASE resolves to the newest release and LATEST to the newest build of any kind, including snapshots. Either one lets mod config recipes upgrade pull in later versions without editing this command; a pinned version stays where you put it.

mod config recipes jar install io.moderne.recipe:rewrite-prethink:RELEASE

Data tables​

Java local variable references
io.moderne.prethink.table.JavaLocalVariableReferences

Regular block-local declarations referenced by bare ordinary invocation argument, select or direct return identifiers in their own ordinary method. Retains original node identities, individual declaration and reference ranges, occurrence multiplicity and explicit binding states. Unknown or ambiguous bindings have null declaration cells. No fields, formal parameters, captures, assignment-target context, initializer evaluation, reaching-value, taint or runtime-flow inference.

Export after a run
mod study . --last-recipe-run \
--data-table io.moderne.prethink.table.JavaLocalVariableReferences
ColumnDescription
Source pathActual Java compilation-unit source path.
Source setActual sole JavaSourceSet name; null for missing or ambiguous source-set markers, independently of project markers; empty preserved.
Project IDActual sole JavaProject marker UUID; null for missing or ambiguous project markers. Never normalized or borrowed from another namespace.
Project nameActual sole JavaProject name; descriptive only. Null and empty values are preserved independently of source-set markers.
Source set IDActual sole JavaSourceSet marker UUID; null for missing or ambiguous source-set markers.
Source file IDActual compilation-unit UUID in the exact original VCS, model-input and producer namespace. Equal CU IDs alone never establish nested-node identity.
Declaration IDActual J.VariableDeclarations UUID only for a unique RESOLVED block-local binding. Null for UNRESOLVED or AMBIGUOUS; no synthetic declaration identity.
Variable IDActual individual NamedVariable UUID only for a unique RESOLVED binding. Multiple declarators retain distinct IDs sharing their actual declaration wrapper. Never a trait-created UUID or JavaType.Variable object identity.
Variable typeActual declaration JavaType.toString() opaque string for a RESOLVED binding; null for missing or Unknown type and for UNRESOLVED or AMBIGUOUS bindings. Never parsed, evaluated or copied from a reference.
Variable start lineActual full individual NamedVariable node start from unchanged Coordinates, not the wrapper or a synthetic name span. One-based line; null unless binding is RESOLVED. Initializer syntax in a span does not evaluate its value.
Variable start columnActual full individual NamedVariable node start from unchanged Coordinates. One-based UTF-16 column, tab one, CRLF-aware; null unless binding is RESOLVED.
Variable end lineActual exclusive full individual NamedVariable node end from unchanged Coordinates. One-based line; null unless binding is RESOLVED.
Variable end columnActual exclusive full individual NamedVariable node end from unchanged Coordinates. One-based UTF-16 column, tab one, CRLF-aware; null unless binding is RESOLVED.
Reference IDActual bare J.Identifier UUID. Join whole argumentId, outer selectId or direct return expressionId only within the exact verified input, source scope, CU and all four reference coordinates.
Reference roleARGUMENT for a whole bare ordinary invocation argument, SELECT for a whole bare ordinary invocation select, or RETURN for a whole bare direct ordinary-method returned expression. No wrapper unwrapping, parent-row duplication or target-formal mapping.
Reference nameActual reference Identifier simple name. Spelling alone never establishes declaration binding; reassignment does not change lexical declaration identity.
Reference start lineActual bare Identifier start from unchanged Coordinates. One-based line; no generated coordinate.
Reference start columnActual bare Identifier start from unchanged Coordinates. One-based UTF-16 column, tab one, CRLF-aware.
Reference end lineActual exclusive bare Identifier end from unchanged Coordinates. One-based line.
Reference end columnActual exclusive bare Identifier end from unchanged Coordinates. One-based UTF-16 column, tab one, CRLF-aware.
Binding stateRESOLVED for a unique supported actual source-local declaration, UNRESOLVED when safe binding is unavailable, or AMBIGUOUS for multiple surviving distinct declarations. Unresolved and ambiguous rows retain reference facts with null declaration cells.
Binding reasonStable reason code: UNIQUE_LOCAL_DECLARATION, BINDING_UNAVAILABLE, CONFLICTING_ATTRIBUTION, MULTIPLE_LOCAL_CANDIDATES or UNSUPPORTED_BINDING_LAYOUT. Does not establish initializer values, reaching definitions, taint or runtime flow.
Source files that had results
org.openrewrite.table.SourcesFileResults

Source files that were modified by the recipe run.

Export after a run
mod study . --last-recipe-run \
--data-table org.openrewrite.table.SourcesFileResults
ColumnDescription
Source path before the runThe source path of the file before the run. null when a source file was created during the run.
Source path after the runA recipe may modify the source path. This is the path after the run. null when a source file was deleted during the run.
Parent of the recipe that made changesIn a hierarchical recipe, the parent of the recipe that made a change. Empty if this is the root of a hierarchy or if the recipe is not hierarchical at all.
Recipe that made changesThe specific recipe that made a change.
Estimated time savingAn estimated effort that a developer to fix manually instead of using this recipe, in unit of seconds.
CycleThe recipe cycle in which the change was made.
Source files that had search results
org.openrewrite.table.SearchResults

Search results that were found during the recipe run.

Export after a run
mod study . --last-recipe-run \
--data-table org.openrewrite.table.SearchResults
ColumnDescription
Source path of search result before the runThe source path of the file with the search result markers present.
Source path of search result after run the runA recipe may modify the source path. This is the path after the run. null when a source file was deleted during the run.
ResultThe trimmed printed tree of the LST element that the marker is attached to.
DescriptionThe content of the description of the marker.
Recipe that added the search markerThe specific recipe that added the Search marker.
Source files that errored on a recipe
org.openrewrite.table.SourcesFileErrors

The details of all errors produced by a recipe run.

Export after a run
mod study . --last-recipe-run \
--data-table org.openrewrite.table.SourcesFileErrors
ColumnDescription
Source pathThe file that failed to parse.
Recipe that made changesThe specific recipe that made a change.
Stack traceThe stack trace of the failure.
Recipe performance
org.openrewrite.table.RecipeRunStats

Statistics used in analyzing the performance of recipes.

Export after a run
mod study . --last-recipe-run \
--data-table org.openrewrite.table.RecipeRunStats
ColumnDescription
The recipeThe recipe whose stats are being measured both individually and cumulatively.
Source file countThe number of source files the recipe ran over.
Source file changed countThe number of source files which were changed in the recipe run. Includes files created, deleted, and edited.
Cumulative scanning time (ns)The total time spent across the scanning phase of this recipe.
Max scanning time (ns)The max time scanning any one source file.
Cumulative edit time (ns)The total time spent across the editing phase of this recipe.
Max edit time (ns)The max time editing any one source file.