RemoveToBeRemoved deletes declarations but not their references, so the
recipe output on its own does not compile:
- The `getStyle`/`addStyleMarker`/`evaluate`/`shouldKnowInflowStyle`
helpers existed only to shim older parent runtimes. Their callers now
go to `StyleHelper` directly, or to the style call the shim guarded.
`StyleHelper.getStyle(Class, List, Supplier)` and
`getStyle(Class, List, SourceFile)` are ambiguous for a lambda or
method reference, so those arguments carry an explicit `Supplier` cast.
- `J.VariableDeclarations`' deprecated `dimensionsBeforeName` constructor
is gone, so the Java 8/11 parser visitors, the Groovy parser visitor
and one test drop that always-empty argument.
- `JavaParser.Builder.classpath(byte[]...)` is gone, taking
`JavaParserTest#parseFromByteArray` and its class fixtures with it.
Ran
org.openrewrite.java.recipes.RemoveToBeRemovedand enabled it inrewrite.yml; the first commit is the recipe's raw output, the second fixes what it leaves behind (it deletes declarations but explicitly not their references).Most past-due annotations sat on private shims for older parent runtimes (
getStyle,addStyleMarker,evaluate,shouldKnowInflowStyle), so their callers now go toorg.openrewrite.style.StyleHelperdirectly — with an explicit(Supplier<X>)cast, becauseStyleHelper.getStyle(Class, List, Supplier)andgetStyle(Class, List, T extends SourceFile)are ambiguous to javac for a lambda or method reference. RemovingJ.VariableDeclarations' deprecateddimensionsBeforeNameconstructor means the Java 8/11 parser visitors,GroovyParserVisitorand one test drop that always-empty argument, and removingJavaParser.Builder.classpath(byte[]...)takesJavaParserTest#parseFromByteArray, its.classfixtures and the now-unusedclassgraphtest dependency with it.Two things left alone and worth a reviewer's call:
protected Collection<byte[]> classBytesClasspathnow has no in-repo writer, so theByteArrayCapableJavacFileManagerpath is reachable only by external subclasses — ripping the plumbing out would change protected API across five parser modules; and the six// TO-BE-REMOVED(date)comments (five past due) are out of the recipe's reach, since its precondition isUsesType(ToBeRemoved)and none of those files import the annotation.Verified with
compileJava compileTestJavaacross every module, therewrite-java/-test/-groovy/-kotlin/-yaml/-hcltest tasks, andcompatibilityTest(TCK) on all five parser modules; the only remaining@ToBeRemovedisJ.MethodDeclaration's, dated 2026-09-17, so the newly enabled recipe is a no-op until then.