@codemod/spring7-requestcontext-jstl-present
Rename Java references to Spring Web MVC RequestContext.jstPresent so they use RequestContext.JSTL_PRESENT for Spring Framework 7.
Installation
bash
Usage
This codemod targets Java source files and renames only AST-backed member references that can be confidently matched to Spring's org.springframework.web.servlet.support.RequestContext.jstPresent field.
It rewrites:
RequestContext.jstPresentwhenRequestContextis imported from Spring Web MVCorg.springframework.web.servlet.support.RequestContext.jstPresentSomeSubclass.jstPresentwhenSomeSubclassis a uniquely resolvable in-file subclass of Spring'sRequestContext- inherited bare accesses like
jstPresent,this.jstPresent, andsuper.jstPresentinside confidently resolvable subclasses, including nested, local, and anonymous classes - exact static imports of
org.springframework.web.servlet.support.RequestContext.jstPresentand matching bare usages
It does not rewrite:
- string literals, comments, Javadoc, or reflection strings like
"jstPresent" - unrelated classes or user-defined fields named
jstPresent - ambiguous bare identifiers when the enclosing class hierarchy or symbol target cannot be resolved conservatively from the current file
- non-Java files
By default the workflow excludes common generated-source directories. To include them, run the workflow with --param includeGeneratedSources=true.
Examples:
java
becomes:
java
java
becomes:
java
Development
bash
License
MIT