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 writes

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

Report written initializers and bare-target simple assignments for regular block locals in their own ordinary method, with original declaration, variable, write, target and direct RHS identities, raw nullable types and source ranges. Preserve individual declarator order, repeated and nested write sites, explicit binding states and direct RHS roots without unwrapping. Excludes fields, formals, lambda-body locals, captures and constructor or initializer bodies; nested ordinary methods own their locals. Does not change sources, evaluate RHS values or infer 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 FindJavaLocalVariableWrites

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 writes
io.moderne.prethink.table.JavaLocalVariableWrites

Written INITIALIZER or SIMPLE_ASSIGNMENT sites for supported regular block locals in their own ordinary method. Retains original declaration, individual variable, write, target and direct RHS identities and ranges, raw nullable types, occurrence multiplicity and explicit binding states. Unknown or ambiguous bindings retain written site facts with null declaration cells. No initializer evaluation, reaching-write selection, value identity, taint or runtime-flow inference.

Export after a run
mod study . --last-recipe-run \
--data-table io.moderne.prethink.table.JavaLocalVariableWrites
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. Preserve empty values.
Project IDActual sole JavaProject marker UUID; null for missing or ambiguous project markers. Never normalize, borrow or identify by project name.
Project nameActual sole JavaProject name, descriptive only; preserve null and empty independently of source-set markers.
Source set IDActual sole JavaSourceSet marker UUID; null for missing or ambiguous source-set markers independently of project markers.
Source file IDActual compilation-unit UUID in the externally verified original VCS, commit, model-input and producer namespace. Equal CU IDs alone do not prove nested-node identity.
Declaration IDActual J.VariableDeclarations wrapper UUID for a safely RESOLVED supported local binding. Null for UNRESOLVED or AMBIGUOUS; no synthetic identity.
Variable IDActual individual NamedVariable UUID for a safely RESOLVED local binding. Multiple declarators have distinct IDs sharing the real wrapper; never a JavaType.Variable object identity.
Variable typeOpaque observed declaration JavaType.toString for a RESOLVED binding; null for missing or whole Unknown type and unsafe bindings. Never parse or substitute RHS/use type.
Variable start lineFull actual individual NamedVariable start, including any initializer and excluding enclosing type or semicolon. One-based line; null unless binding is RESOLVED.
Variable start columnFull actual individual NamedVariable start from unchanged Coordinates. One-based UTF-16 column, tab one, CRLF-aware; null unless binding is RESOLVED.
Variable end lineExclusive full actual individual NamedVariable end. One-based line; null unless binding is RESOLVED. Initializer syntax does not establish a value.
Variable end columnExclusive full actual individual NamedVariable end from unchanged Coordinates. One-based UTF-16 column, tab one, CRLF-aware; null unless binding is RESOLVED.
Write IDINITIALIZER uses the actual NamedVariable.id; SIMPLE_ASSIGNMENT uses the actual J.Assignment.id. Tagged original node identity, never a synthetic write UUID.
Write kindINITIALIZER for a supported local with a non-Empty written initializer; SIMPLE_ASSIGNMENT for exactly J.Assignment with a whole bare Identifier LHS naming a supported in-scope local. No reaching-use selection.
Write start lineWhole actual NamedVariable start for INITIALIZER or whole J.Assignment expression start for SIMPLE_ASSIGNMENT. One-based line; no trailing statement semicolon or generated coordinate.
Write start columnWhole actual write-node start from unchanged Coordinates. One-based UTF-16 column, tab one, CRLF-aware.
Write end lineExclusive whole actual write-node end: NamedVariable or J.Assignment expression, excluding a trailing statement semicolon. One-based line.
Write end columnExclusive whole actual write-node end from unchanged Coordinates. One-based UTF-16 column, tab one, CRLF-aware.
Target IDINITIALIZER uses the actual bare declaration-name Identifier.id; SIMPLE_ASSIGNMENT uses the actual bare LHS Identifier.id. A declaration token is not a read reference; writeKind distinguishes the roles.
Target nameActual target Identifier spelling metadata. Name alone never establishes declaration binding or a cross-table join.
Target start lineActual target Identifier token start from unchanged Coordinates. One-based line; not a generated name span.
Target start columnActual target Identifier token start. One-based UTF-16 column, tab one, CRLF-aware.
Target end lineExclusive actual target Identifier token end. One-based line.
Target end columnExclusive actual target Identifier token end. One-based UTF-16 column, tab one, CRLF-aware.
RHS IDActual direct getInitializer() or getAssignment() expression UUID. Preserve parentheses, cast, assignment, lambda and new roots; never substitute an inner invocation ID.
RHS kindStable direct AST kind label: Identifier, FieldAccess, MethodInvocation, NewClass, NewArray, Literal, TypeCast, Parentheses, Assignment, AssignmentOperation, Binary, Unary, Ternary, Lambda, MemberReference, ArrayAccess, InstanceOf or Other. No lazy-proxy class names or unwrapping.
RHS typeOpaque actual direct RHS JavaType.toString; null for missing or whole Unknown. Actual literal-null type text may be the string null. Never replace with declared local type, FQN or an effective runtime value; no RHS/declaration type equality requirement.
RHS start lineActual direct RHS expression start from unchanged Coordinates. One-based line; wrappers retained, no guessed or generated range.
RHS start columnActual direct RHS expression start. One-based UTF-16 column, tab one, CRLF-aware.
RHS end lineExclusive actual direct RHS expression end. One-based line; no inner-expression substitution.
RHS end columnExclusive actual direct RHS expression end. One-based UTF-16 column, tab one, CRLF-aware.
Binding stateRESOLVED for a safely bound supported actual local, UNRESOLVED for unavailable or conflicting metadata, or AMBIGUOUS for multiple surviving distinct candidates. Unsafe bindings null all seven declaration cells while retaining real write, target and RHS facts.
Binding reasonUNIQUE_LOCAL_DECLARATION, BINDING_UNAVAILABLE, CONFLICTING_ATTRIBUTION, MULTIPLE_LOCAL_CANDIDATES or UNSUPPORTED_BINDING_LAYOUT. Initializer association is structurally its own NamedVariable; neither a state nor a reason establishes values, execution, reaching definitions or taint.
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.